(function (global, factory) {
	typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
	typeof define === 'function' && define.amd ? define(['exports'], factory) :
	(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.CKEDITOR = {}));
})(this, (function (exports) { 'use strict';

	/**
	 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
	 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
	 */
	exports.global = void 0;try{exports.global={window:window,document:document};}catch{exports.global={window:{},document:{}};}function t(){try{return navigator.userAgent.toLowerCase()}catch{return ""}}const i=t(),n={isMac:s(i),isWindows:o(i),isGecko:r(i),isSafari:a(i),isiOS:l(i),isAndroid:c(i),isBlink:u(i),get isMediaForcedColors(){return h()},get isMotionReduced(){return m()},features:{isRegExpUnicodePropertySupported:d()}};function s(e){return e.indexOf("macintosh")>-1}function o(e){return e.indexOf("windows")>-1}function r(e){return !!e.match(/gecko\/\d+/)}function a(e){return e.indexOf(" applewebkit/")>-1&&-1===e.indexOf("chrome")}function l(e){return !!e.match(/iphone|ipad/i)||s(e)&&navigator.maxTouchPoints>0}function c(e){return e.indexOf("android")>-1}function u(e){return e.indexOf("chrome/")>-1&&e.indexOf("edge/")<0}function d(){let e=false;try{e=0==="ć".search(new RegExp("[\\p{L}]","u"));}catch{}return e}function h(){return !!exports.global.window.matchMedia&&exports.global.window.matchMedia("(forced-colors: active)").matches}function m(){return !!exports.global.window.matchMedia&&exports.global.window.matchMedia("(prefers-reduced-motion)").matches}function g(e,t,i,n){i=i||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,i){const n=f(e,t,i);if(-1===n)return {firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};const s=p(e,n),o=p(t,n),r=f(s,o,i),a=e.length-r,l=t.length-r;return {firstIndex:n,lastIndexOld:a,lastIndexNew:l}}(s,o,i),a=n?function(e,t){const{firstIndex:i,lastIndexOld:n,lastIndexNew:s}=e;if(-1===i)return Array(t).fill("equal");let o=[];i>0&&(o=o.concat(Array(i).fill("equal")));s-i>0&&(o=o.concat(Array(s-i).fill("insert")));n-i>0&&(o=o.concat(Array(n-i).fill("delete")));s<t&&(o=o.concat(Array(t-s).fill("equal")));return o}(r,o.length):function(e,t){const i=[],{firstIndex:n,lastIndexOld:s,lastIndexNew:o}=t;o-n>0&&i.push({index:n,type:"insert",values:e.slice(n,o)});s-n>0&&i.push({index:n+(o-n),type:"delete",howMany:s-n});return i}(o,r);return a}function f(e,t,i){for(let n=0;n<Math.max(e.length,t.length);n++)if(void 0===e[n]||void 0===t[n]||!i(e[n],t[n]))return n;return  -1}function p(e,t){return e.slice(t).reverse()}function b(e,t,i){i=i||function(e,t){return e===t};const n=e.length,s=t.length;if(n>200||s>200||n+s>300)return b.fastDiff(e,t,i,true);let o,r;if(s<n){const i=e;e=t,t=i,o="delete",r="insert";}else o="insert",r="delete";const a=e.length,l=t.length,c=l-a,u={},d={};function h(n){const s=(void 0!==d[n-1]?d[n-1]:-1)+1,c=void 0!==d[n+1]?d[n+1]:-1,h=s>c?-1:1;u[n+h]&&(u[n]=u[n+h].slice(0)),u[n]||(u[n]=[]),u[n].push(s>c?o:r);let m=Math.max(s,c),g=m-n;for(;g<a&&m<l&&i(e[g],t[m]);)g++,m++,u[n].push("equal");return m}let m,g=0;do{for(m=-g;m<c;m++)d[m]=h(m);for(m=c+g;m>c;m--)d[m]=h(m);d[c]=h(c),g++;}while(d[c]!==l);return u[c].slice(1)}function w(e,t){const i=[];let n=0,s=null;return e.forEach(e=>{"equal"==e?(o(),n++):"insert"==e?(s&&"insert"==s.type?s.values.push(t[n]):(o(),s={type:"insert",index:n,values:[t[n]]}),n++):s&&"delete"==s.type?s.howMany++:(o(),s={type:"delete",index:n,howMany:1});}),o(),i;function o(){s&&(i.push(s),s=null);}}function v(e,t){if(e===t&&("object"==typeof(i=e)&&null!==i))return  true;var i;const n=_(e),s=_(t);for(const e of n)if(s.has(e))return  true;return  false}function _(e){const t=[e],i=new Set;for(;t.length>0;){const e=t.shift();if(!i.has(e)&&!y(e))if(i.add(e),e[Symbol.iterator])try{t.push(...e);}catch{}else t.push(...Object.values(e));}return i}function y(e){const t=Object.prototype.toString.call(e);return "[object Number]"===t||"[object Boolean]"===t||"[object String]"===t||"[object Symbol]"===t||"[object Function]"===t||"[object Date]"===t||"[object RegExp]"===t||null==e||e instanceof EventTarget||e instanceof Event}function k(){return function e(){e.called=true;}}b.fastDiff=g;class C{source;name;path;stop;off;return;constructor(e,t){this.source=e,this.name=t,this.path=[],this.stop=function e(){e.called=true;},this.off=function e(){e.called=true;};}}const x=new Array(256).fill("").map((e,t)=>("0"+t.toString(16)).slice(-2));function A(){const[e,t,i,n]=crypto.getRandomValues(new Uint32Array(4));return "e"+x[255&e]+x[e>>8&255]+x[e>>16&255]+x[e>>24&255]+x[255&t]+x[t>>8&255]+x[t>>16&255]+x[t>>24&255]+x[255&i]+x[i>>8&255]+x[i>>16&255]+x[i>>24&255]+x[255&n]+x[n>>8&255]+x[n>>16&255]+x[n>>24&255]}const E={get(e="normal"){return "number"!=typeof e?this[e]||this.normal:e},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5};function T(e,t){const i=E.get(t.priority);let n=0,s=e.length;for(;n<s;){const t=n+s>>1;E.get(e[t].priority)<i?s=t:n=t+1;}e.splice(n,0,t);}const S="https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html";class I extends Error{context;data;constructor(e,t,i,n){super(function(e,t,i){const n=new WeakSet,s=(e,t)=>{if("object"==typeof t&&null!==t){if(n.has(t))return `[object ${t.constructor.name}]`;n.add(t);}return t},o=t?` ${JSON.stringify(t,s)}`:"",r=R(e),a=i?`\nOriginal error: ${i.name}: ${i.message}`:"";return e+o+r+a}(e,i,n)),this.name="CKEditorError",this.context=t,this.data=i,n&&(this.stack=n.stack);}is(e){return "CKEditorError"===e}static rethrowUnexpectedError(e,t){if(e.is&&e.is("CKEditorError"))throw e;throw new I("unexpected-error",t,void 0,e)}}function P(e,t){console.warn(...O(e,t));}function V(e,t){console.error(...O(e,t));}function R(e){return `\nRead more: ${S}#error-${e}`}function O(e,t){const i=R(e);return t?[e,t,i]:[e,i]}const B="48.0.1",L=new Date(2026,3,22);if(globalThis.CKEDITOR_VERSION)throw new I("ckeditor-duplicated-modules",null);globalThis.CKEDITOR_VERSION=B;const M=Symbol("listeningTo"),F=Symbol("emitterId"),N=Symbol("delegations"),D=z(Object);function z(e){if(!e)return D;return class extends e{on(e,t,i){this.listenTo(this,e,t,i);}once(e,t,i){let n=false;this.listenTo(this,e,(e,...i)=>{n||(n=true,e.off(),t.call(this,e,...i));},i);}off(e,t){this.stopListening(this,e,t);}listenTo(e,t,i,n={}){let s,o;this[M]||(this[M]={});const r=this[M];U(e)||q(e);const a=U(e);(s=r[a])||(s=r[a]={emitter:e,callbacks:{}}),(o=s.callbacks[t])||(o=s.callbacks[t]=[]),o.push(i),function(e,t,i,n,s){t._addEventListener?t._addEventListener(i,n,s):e._addEventListener.call(t,i,n,s);}(this,e,t,i,n);}stopListening(e,t,i){const n=this[M];let s=e&&U(e);const o=n&&s?n[s]:void 0,r=o&&t?o.callbacks[t]:void 0;if(!(!n||e&&!o||t&&!r))if(i){K(this,e,t,i);-1!==r.indexOf(i)&&(1===r.length?delete o.callbacks[t]:K(this,e,t,i));}else if(r){for(;i=r.pop();)K(this,e,t,i);delete o.callbacks[t];}else if(o){for(t in o.callbacks)this.stopListening(e,t);delete n[s];}else {for(s in n)this.stopListening(n[s].emitter);delete this[M];}}fire(e,...t){try{const i=e instanceof C?e:new C(this,e),n=i.name;let s=function(e,t){if(!e._events)return null;let i=t;do{const t=e._events[i];if(t&&t.callbacks&&t.callbacks.length)return t.callbacks;const n=i.lastIndexOf(":");i=n>-1?i.substring(0,n):"";}while(i);return null}(this,n);if(i.path.push(this),s){s=s.slice();for(let e=0;e<s.length;e++){const o=s[e].callback;if(o.call(this,i,...t),i.off.called&&(delete i.off.called,this._removeEventListener(n,o)),i.stop.called)break}}const o=this[N];if(o){const e=o.get(n),s=o.get("*");e&&G(e,i,t),s&&G(s,i,t);}return i.return}catch(e){I.rethrowUnexpectedError(e,this);}}delegate(...e){return {to:(t,i)=>{this[N]||(this[N]=new Map),e.forEach(e=>{const n=this[N].get(e);n?n.set(t,i):this[N].set(e,new Map([[t,i]]));});}}}stopDelegating(e,t){if(this[N])if(e)if(t){const i=this[N].get(e);i&&i.delete(t);}else this[N].delete(e);else this[N].clear();}_addEventListener(e,t,i){!function(e,t){const i=j(e);if(i[t])return;let n=t,s=null;const o=[];for(;""!==n&&!i[n];)i[n]=$(),o.push(i[n]),s&&i[n].childEvents.push(s),s=n,n=n.substr(0,n.lastIndexOf(":"));if(""!==n){for(const e of o)e.callbacks=i[n].callbacks.slice();i[n].childEvents.push(s);}}(this,e);const n=W(this,e),s={callback:t,priority:E.get(i.priority)};for(const e of n)T(e,s);}_removeEventListener(e,t){const i=W(this,e);for(const e of i)for(let i=0;i<e.length;i++)e[i].callback==t&&(e.splice(i,1),i--);}}}function H(e,t){const i=e[M];return i&&i[t]?i[t].emitter:null}function q(e,t){e[F]||(e[F]=t||A());}function U(e){return e[F]}function j(e){return e._events||Object.defineProperty(e,"_events",{value:{}}),e._events}function $(){return {callbacks:[],childEvents:[]}}function W(e,t){const i=j(e)[t];if(!i)return [];let n=[i.callbacks];for(let t=0;t<i.childEvents.length;t++){const s=W(e,i.childEvents[t]);n=n.concat(s);}return n}function G(e,t,i){for(let[n,s]of e){s?"function"==typeof s&&(s=s(t.name)):s=t.name;const e=new C(t.source,s);e.path=[...t.path],n.fire(e,...i);}}function K(e,t,i,n){t._removeEventListener?t._removeEventListener(i,n):e._removeEventListener.call(t,i,n);}function J(e){return null!=e&&"function"!=typeof e&&function(e){return Number.isSafeInteger(e)&&e>=0}(e.length)}function Q(e){return e}function Y(e){return "__proto__"===e}function Z(e){switch(typeof e){case "number":case "symbol":return  false;case "string":return e.includes(".")||e.includes("[")||e.includes("]")}}function X(e){return "string"==typeof e||"symbol"==typeof e?e:Object.is(e?.valueOf?.(),-0)?"-0":String(e)}function ee(e){if(null==e)return "";if("string"==typeof e)return e;if(Array.isArray(e))return e.map(ee).join(",");const t=String(e);return "0"===t&&Object.is(Number(e),-0)?"-0":t}function te(e){if(Array.isArray(e))return e.map(X);if("symbol"==typeof e)return [e];const t=[],i=(e=ee(e)).length;if(0===i)return t;let n=0,s="",o="",r=false;for(46===e.charCodeAt(0)&&(t.push(""),n++);n<i;){const a=e[n];o?"\\"===a&&n+1<i?(n++,s+=e[n]):a===o?o="":s+=a:r?'"'===a||"'"===a?o=a:"]"===a?(r=false,t.push(s),s=""):s+=a:"["===a?(r=true,s&&(t.push(s),s="")):"."===a?s&&(t.push(s),s=""):s+=a,n++;}return s&&t.push(s),t}function ie(e,t,i){if(null==e)return i;switch(typeof t){case "string":{if(Y(t))return i;const n=e[t];return void 0===n?Z(t)?ie(e,te(t),i):i:n}case "number":case "symbol":{"number"==typeof t&&(t=X(t));const n=e[t];return void 0===n?i:n}default:{if(Array.isArray(t))return function(e,t,i){if(0===t.length)return i;let n=e;for(let e=0;e<t.length;e++){if(null==n)return i;if(Y(t[e]))return i;n=n[t[e]];}if(void 0===n)return i;return n}(e,t,i);if(Y(t=Object.is(t?.valueOf(),-0)?"-0":String(t)))return i;const n=e[t];return void 0===n?i:n}}}function ne(e){return null!==e&&("object"==typeof e||"function"==typeof e)}function se(e){return null==e||"object"!=typeof e&&"function"!=typeof e}function oe(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function re(e,t,i){return "function"!=typeof i?re(e,t,()=>{}):ae(e,t,function e(t,n,s,o,r,a){const l=i(t,n,s,o,r,a);return void 0!==l?Boolean(l):ae(t,n,e,a)},new Map)}function ae(e,t,i,n){if(t===e)return  true;switch(typeof t){case "object":return function(e,t,i,n){if(null==t)return  true;if(Array.isArray(t))return le(e,t,i,n);if(t instanceof Map)return function(e,t,i,n){if(0===t.size)return  true;if(!(e instanceof Map))return  false;for(const[s,o]of t.entries()){if(false===i(e.get(s),o,s,e,t,n))return  false}return  true}(e,t,i,n);if(t instanceof Set)return function(e,t,i,n){if(0===t.size)return  true;if(!(e instanceof Set))return  false;return le([...e],[...t],i,n)}(e,t,i,n);const s=Object.keys(t);if(null==e||se(e))return 0===s.length;if(0===s.length)return  true;if(n?.has(t))return n.get(t)===e;n?.set(t,e);try{for(let o=0;o<s.length;o++){const r=s[o];if(!se(e)&&!(r in e))return !1;if(void 0===t[r]&&void 0!==e[r])return !1;if(null===t[r]&&null!==e[r])return !1;if(!i(e[r],t[r],r,e,t,n))return !1}return !0}finally{n?.delete(t);}}(e,t,i,n);case "function":return Object.keys(t).length>0?ae(e,{...t},i,n):oe(e,t);default:return ne(e)?"string"!=typeof t||""===t:oe(e,t)}}function le(e,t,i,n){if(0===t.length)return  true;if(!Array.isArray(e))return  false;const s=new Set;for(let o=0;o<t.length;o++){const r=t[o];let a=false;for(let l=0;l<e.length;l++){if(s.has(l))continue;let c=false;if(i(e[l],r,o,e,t,n)&&(c=true),c){s.add(l),a=true;break}}if(!a)return  false}return  true}function ce(e,t){return re(e,t,()=>{})}function ue(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function de(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const he="[object RegExp]",me="[object String]",ge="[object Number]",fe="[object Boolean]",pe="[object Arguments]",be="[object Symbol]",we="[object Date]",ve="[object Map]",_e="[object Set]",ye="[object Array]",ke="[object ArrayBuffer]",Ce="[object Object]",xe="[object DataView]",Ae="[object Uint8Array]",Ee="[object Uint8ClampedArray]",Te="[object Uint16Array]",Se="[object Uint32Array]",Ie="[object Int8Array]",Pe="[object Int16Array]",Ve="[object Int32Array]",Re="[object Float32Array]",Oe="[object Float64Array]";function Be(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Le(e,t,i,n=new Map,s=void 0){const o=s?.(e,t,i,n);if(void 0!==o)return o;if(se(e))return e;if(n.has(e))return n.get(e);if(Array.isArray(e)){const t=new Array(e.length);n.set(e,t);for(let o=0;o<e.length;o++)t[o]=Le(e[o],o,i,n,s);return Object.hasOwn(e,"index")&&(t.index=e.index),Object.hasOwn(e,"input")&&(t.input=e.input),t}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){const t=new RegExp(e.source,e.flags);return t.lastIndex=e.lastIndex,t}if(e instanceof Map){const t=new Map;n.set(e,t);for(const[o,r]of e)t.set(o,Le(r,o,i,n,s));return t}if(e instanceof Set){const t=new Set;n.set(e,t);for(const o of e)t.add(Le(o,void 0,i,n,s));return t}if("undefined"!=typeof Buffer&&Buffer.isBuffer(e))return e.subarray();if(Be(e)){const t=new(Object.getPrototypeOf(e).constructor)(e.length);n.set(e,t);for(let o=0;o<e.length;o++)t[o]=Le(e[o],o,i,n,s);return t}if(e instanceof ArrayBuffer||"undefined"!=typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){const t=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return n.set(e,t),Me(t,e,i,n,s),t}if("undefined"!=typeof File&&e instanceof File){const t=new File([e],e.name,{type:e.type});return n.set(e,t),Me(t,e,i,n,s),t}if("undefined"!=typeof Blob&&e instanceof Blob){const t=new Blob([e],{type:e.type});return n.set(e,t),Me(t,e,i,n,s),t}if(e instanceof Error){const t=structuredClone(e);return n.set(e,t),t.message=e.message,t.name=e.name,t.stack=e.stack,t.cause=e.cause,t.constructor=e.constructor,Me(t,e,i,n,s),t}if(e instanceof Boolean){const t=new Boolean(e.valueOf());return n.set(e,t),Me(t,e,i,n,s),t}if(e instanceof Number){const t=new Number(e.valueOf());return n.set(e,t),Me(t,e,i,n,s),t}if(e instanceof String){const t=new String(e.valueOf());return n.set(e,t),Me(t,e,i,n,s),t}if("object"==typeof e&&function(e){switch(de(e)){case pe:case ye:case ke:case xe:case fe:case we:case Re:case Oe:case Ie:case Pe:case Ve:case ve:case ge:case Ce:case he:case _e:case me:case be:case Ae:case Ee:case Te:case Se:return  true;default:return  false}}(e)){const t=Object.create(Object.getPrototypeOf(e));return n.set(e,t),Me(t,e,i,n,s),t}return e}function Me(e,t,i=e,n,s){const o=[...Object.keys(t),...ue(t)];for(let r=0;r<o.length;r++){const a=o[r],l=Object.getOwnPropertyDescriptor(e,a);(null==l||l.writable)&&(e[a]=Le(t[a],a,i,n,s));}}function Fe(e){var t;return e=Le(t=e,void 0,t,new Map,void 0),t=>ce(t,e)}function Ne(e,t){return function(e,t){return Le(e,void 0,e,new Map,t)}(e,(i,n,s,o)=>{const r=t?.(i,n,s,o);if(void 0!==r)return r;if("object"==typeof e){if(de(e)===Ce&&"function"!=typeof e.constructor){const t={};return o.set(e,t),Me(t,e,s,o),t}switch(Object.prototype.toString.call(e)){case ge:case me:case fe:{const t=new e.constructor(e?.valueOf());return Me(t,e),t}case pe:{const t={};return Me(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}}})}function De(e){return Ne(e)}const ze=/^(?:0|[1-9]\d*)$/;function He(e,t=Number.MAX_SAFE_INTEGER){switch(typeof e){case "number":return Number.isInteger(e)&&e>=0&&e<t;case "symbol":return  false;case "string":return ze.test(e)}}function qe(e){return null!==e&&"object"==typeof e&&"[object Arguments]"===de(e)}function Ue(e,t){let i;if(i=Array.isArray(t)?t:"string"==typeof t&&Z(t)&&null==e?.[t]?te(t):[t],0===i.length)return  false;let n=e;for(let e=0;e<i.length;e++){const t=i[e];if(null==n||!Object.hasOwn(n,t)){if(!((Array.isArray(n)||qe(n))&&He(t)&&t<n.length))return  false}n=n[t];}return  true}function je(e){if(null==e)return Q;switch(typeof e){case "function":return e;case "object":return Array.isArray(e)&&2===e.length?function(e,t){switch(typeof e){case "object":Object.is(e?.valueOf(),-0)&&(e="-0");break;case "number":e=X(e);}return t=De(t),function(i){const n=ie(i,e);return void 0===n?Ue(i,e):void 0===t?void 0===n:ce(n,t)}}(e[0],e[1]):Fe(e);case "string":case "symbol":case "number":return function(e){return function(t){return ie(t,e)}}(e)}}function $e(e){return "object"==typeof e&&null!==e}function We(e){return $e(e)&&J(e)}function Ge(e){return "symbol"==typeof e||e instanceof Symbol}function Ke(e){if(!e)return 0===e?e:0;if((e=function(e){return Ge(e)?NaN:Number(e)}(e))===1/0||e===-1/0){return (e<0?-1:1)*Number.MAX_VALUE}return e==e?e:0}function Je(e){return "string"==typeof e||e instanceof String}function Qe(e){return e}function Ye(e,t){if(null==e)return {};return function(e,t){const i={};for(let n=0;n<e.length;n++){const s=e[n],o=t(s,n,e);Object.hasOwn(i,o)||(i[o]=[]),i[o].push(s);}return i}(J(e)?Array.from(e):Object.values(e),je(t??Q))}const Ze=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Xe=/^\w*$/;const et=(e,t,i)=>{const n=e[t];Object.hasOwn(e,t)&&oe(n,i)&&(void 0!==i||t in e)||(e[t]=i);};function tt(e,t,i,n){if(null==e&&!ne(e))return e;let s;var o,r;o=t,r=e,s=!Array.isArray(o)&&("number"==typeof o||"boolean"==typeof o||null==o||Ge(o)||"string"==typeof o&&(Xe.test(o)||!Ze.test(o))||null!=r&&Object.hasOwn(r,o))?[t]:Array.isArray(t)?t:te(t);const a=i(ie(e,s));let l=e;for(let t=0;t<s.length&&null!=l;t++){const i=X(s[t]);if(Y(i))continue;let o;if(t===s.length-1)o=a;else {const r=l[i],a=n?.(r,i,e);o=void 0!==a?a:ne(r)?r:He(s[t+1])?[]:{};}et(l,i,o),l=l[i];}return e}function it(e,t,i){return tt(e,t,()=>i,()=>{})}function nt(e,t,{signal:i,edges:n}={}){let s,o=null;const r=null!=n&&n.includes("leading"),a=null==n||n.includes("trailing"),l=()=>{null!==o&&(e.apply(s,o),s=void 0,o=null);};let c=null;const u=()=>{null!=c&&clearTimeout(c),c=setTimeout(()=>{c=null,a&&l(),d();},t);},d=()=>{null!==c&&(clearTimeout(c),c=null),s=void 0,o=null;},h=function(...e){if(i?.aborted)return;s=this,o=e;const t=null==c;u(),r&&t&&l();};return h.schedule=u,h.cancel=d,h.flush=()=>{l();},i?.addEventListener("abort",d,{once:true}),h}function st(e,t=0,i={}){"object"!=typeof i&&(i={});const{leading:n=false,trailing:s=true,maxWait:o}=i,r=Array(2);let a;n&&(r[0]="leading"),s&&(r[1]="trailing");let l=null;const c=nt(function(...t){a=e.apply(this,t),l=null;},t,{edges:r}),u=function(...t){return null!=o&&(null===l&&(l=Date.now()),Date.now()-l>=o)?(a=e.apply(this,t),l=Date.now(),c.cancel(),c.schedule(),a):(c.apply(this,t),a)};return u.cancel=c.cancel,u.flush=()=>(c.flush(),a),u}function ot(e,t=0,i={}){const{leading:n=true,trailing:s=true}=i;return st(e,t,{leading:n,maxWait:t,trailing:s})}function rt(e){if(!e||"object"!=typeof e)return  false;const t=Object.getPrototypeOf(e);return !(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t))&&"[object Object]"===Object.prototype.toString.call(e)}function at(e,t,i){return lt(e,t,void 0,void 0,void 0,void 0,i)}function lt(e,t,i,n,s,o,r){const a=r(e,t,i,n,s,o);if(void 0!==a)return a;if(typeof e==typeof t)switch(typeof e){case "bigint":case "string":case "boolean":case "symbol":case "undefined":case "function":return e===t;case "number":return e===t||Object.is(e,t);case "object":return ct(e,t,o,r)}return ct(e,t,o,r)}function ct(e,t,i,n){if(Object.is(e,t))return  true;let s=de(e),o=de(t);if(s===pe&&(s=Ce),o===pe&&(o=Ce),s!==o)return  false;switch(s){case me:return e.toString()===t.toString();case ge:return oe(e.valueOf(),t.valueOf());case fe:case we:case be:return Object.is(e.valueOf(),t.valueOf());case he:return e.source===t.source&&e.flags===t.flags;case "[object Function]":return e===t}const r=(i=i??new Map).get(e),a=i.get(t);if(null!=r&&null!=a)return r===t;i.set(e,t),i.set(t,e);try{switch(s){case ve:if(e.size!==t.size)return !1;for(const[s,o]of e.entries())if(!t.has(s)||!lt(o,t.get(s),s,e,t,i,n))return !1;return !0;case _e:{if(e.size!==t.size)return !1;const s=Array.from(e.values()),o=Array.from(t.values());for(let r=0;r<s.length;r++){const a=s[r],l=o.findIndex(s=>lt(a,s,void 0,e,t,i,n));if(-1===l)return !1;o.splice(l,1);}return !0}case ye:case Ae:case Ee:case Te:case Se:case "[object BigUint64Array]":case Ie:case Pe:case Ve:case "[object BigInt64Array]":case Re:case Oe:if("undefined"!=typeof Buffer&&Buffer.isBuffer(e)!==Buffer.isBuffer(t))return !1;if(e.length!==t.length)return !1;for(let s=0;s<e.length;s++)if(!lt(e[s],t[s],s,e,t,i,n))return !1;return !0;case ke:return e.byteLength===t.byteLength&&ct(new Uint8Array(e),new Uint8Array(t),i,n);case xe:return e.byteLength===t.byteLength&&e.byteOffset===t.byteOffset&&ct(new Uint8Array(e),new Uint8Array(t),i,n);case "[object Error]":return e.name===t.name&&e.message===t.message;case Ce:{if(!(ct(e.constructor,t.constructor,i,n)||rt(e)&&rt(t)))return !1;const s=[...Object.keys(e),...ue(e)],o=[...Object.keys(t),...ue(t)];if(s.length!==o.length)return !1;for(let o=0;o<s.length;o++){const r=s[o],a=e[r];if(!Object.hasOwn(t,r))return !1;if(!lt(a,t[r],r,e,t,i,n))return !1}return !0}default:return !1}}finally{i.delete(e),i.delete(t);}}function ut(){}function dt(e,t){return at(e,t,ut)}function ht(e){const t=e?.constructor;return e===("function"==typeof t?t.prototype:Object.prototype)}function mt(e){return Be(e)}function gt(e,t){if((e=function(e){const t=Ke(e),i=t%1;return i?t-i:t}(e))<1||!Number.isSafeInteger(e))return [];const i=new Array(e);for(let n=0;n<e;n++)i[n]="function"==typeof t?t(n):n;return i}function ft(e){if(null==e)return [];switch(typeof e){case "object":case "function":return J(e)?function(e){const t=gt(e.length,e=>`${e}`),i=new Set(t);(function(e){return "undefined"!=typeof Buffer&&Buffer.isBuffer(e)})(e)&&(i.add("offset"),i.add("parent"));mt(e)&&(i.add("buffer"),i.add("byteLength"),i.add("byteOffset"));const n=pt(e).filter(e=>!i.has(e));if(Array.isArray(e))return [...t,...n];return [...t.filter(t=>Object.hasOwn(e,t)),...n]}(e):ht(e)?function(e){const t=pt(e);return t.filter(e=>"constructor"!==e)}(e):pt(e);default:return pt(Object(e))}}function pt(e){const t=[];for(const i in e)t.push(i);return t}function bt(e,...t){for(let i=0;i<t.length;i++)wt(e,t[i]);return e}function wt(e,t){const i=ft(t);for(let n=0;n<i.length;n++){const s=i[n];s in e&&oe(e[s],t[s])||(e[s]=t[s]);}}function vt(e){if(se(e))return e;const t=de(e);if(!function(e){switch(de(e)){case pe:case ye:case ke:case xe:case fe:case we:case Re:case Oe:case Ie:case Pe:case Ve:case ve:case ge:case Ce:case he:case _e:case me:case be:case Ae:case Ee:case Te:case Se:return  true;default:return  false}}(e))return {};if(i=e,Array.isArray(i)){const t=Array.from(e);return e.length>0&&"string"==typeof e[0]&&Object.hasOwn(e,"index")&&(t.index=e.index,t.input=e.input),t}var i;if(mt(e)){const t=e;return new(t.constructor)(t.buffer,t.byteOffset,t.length)}if(t===ke)return new ArrayBuffer(e.byteLength);if(t===xe){const t=e,i=t.buffer,n=t.byteOffset,s=t.byteLength,o=new ArrayBuffer(s),r=new Uint8Array(i,n,s);return new Uint8Array(o).set(r),new DataView(o)}if(t===fe||t===ge||t===me){const i=new(e.constructor)(e.valueOf());return t===me?function(e,t){const i=t.valueOf().length;for(const n in t)Object.hasOwn(t,n)&&(Number.isNaN(Number(n))||Number(n)>=i)&&(e[n]=t[n]);}(i,e):_t(i,e),i}if(t===we)return new Date(Number(e));if(t===he){const t=e,i=new RegExp(t.source,t.flags);return i.lastIndex=t.lastIndex,i}if(t===be)return Object(Symbol.prototype.valueOf.call(e));if(t===ve){const t=e,i=new Map;return t.forEach((e,t)=>{i.set(t,e);}),i}if(t===_e){const t=e,i=new Set;return t.forEach(e=>{i.add(e);}),i}if(t===pe){const t=e,i={};return _t(i,t),i.length=t.length,i[Symbol.iterator]=t[Symbol.iterator],i}const n={};return function(e,t){const i=Object.getPrototypeOf(t);if(null!==i){"function"==typeof t.constructor&&Object.setPrototypeOf(e,i);}}(n,e),_t(n,e),function(e,t){const i=Object.getOwnPropertySymbols(t);for(let n=0;n<i.length;n++){const s=i[n];Object.prototype.propertyIsEnumerable.call(t,s)&&(e[s]=t[s]);}}(n,e),n}function _t(e,t){for(const i in t)Object.hasOwn(t,i)&&(e[i]=t[i]);}function yt(e){if("object"!=typeof e)return  false;if(null==e)return  false;if(null===Object.getPrototypeOf(e))return  true;if("[object Object]"!==Object.prototype.toString.call(e)){const t=e[Symbol.toStringTag];if(null==t)return  false;return !!Object.getOwnPropertyDescriptor(e,Symbol.toStringTag)?.writable&&e.toString()===`[object ${t}]`}let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function kt(e,t=Q){return null==e?{}:function(e,t){const i={},n=Object.keys(e);for(let s=0;s<n.length;s++){const o=n[s],r=e[o];i[o]=t(r,o,e);}return i}(e,je(t))}function Ct(e,...t){const i=t.slice(0,-1),n=t[t.length-1];let s=e;for(let e=0;e<i.length;e++){s=xt(s,i[e],n,new Map);}return s}function xt(e,t,i,n){if(se(e)&&(e=Object(e)),null==t||"object"!=typeof t)return e;if(n.has(t))return function(e){if(se(e))return e;if(Array.isArray(e)||Be(e)||e instanceof ArrayBuffer||"undefined"!=typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer)return e.slice(0);const t=Object.getPrototypeOf(e);if(null==t)return Object.assign(Object.create(t),e);const i=t.constructor;if(e instanceof Date||e instanceof Map||e instanceof Set)return new i(e);if(e instanceof RegExp){const t=new i(e);return t.lastIndex=e.lastIndex,t}if(e instanceof DataView)return new i(e.buffer.slice(0));if(e instanceof Error){let t;return t=e instanceof AggregateError?new i(e.errors,e.message,{cause:e.cause}):new i(e.message,{cause:e.cause}),t.stack=e.stack,Object.assign(t,e),t}if("undefined"!=typeof File&&e instanceof File)return new i([e],e.name,{type:e.type,lastModified:e.lastModified});if("object"==typeof e){const i=Object.create(t);return Object.assign(i,e)}return e}(n.get(t));if(n.set(t,e),Array.isArray(t)){t=t.slice();for(let e=0;e<t.length;e++)t[e]=t[e]??void 0;}const s=[...Object.keys(t),...ue(t)];for(let o=0;o<s.length;o++){const r=s[o];if(Y(r))continue;let a=t[r],l=e[r];if(qe(a)&&(a={...a}),qe(l)&&(l={...l}),"undefined"!=typeof Buffer&&Buffer.isBuffer(a)&&(a=De(a)),Array.isArray(a))if(Array.isArray(l)){const e=[],t=Reflect.ownKeys(l);for(let i=0;i<t.length;i++){const n=t[i];e[n]=l[n];}l=e;}else if(We(l)){const e=[];for(let t=0;t<l.length;t++)e[t]=l[t];l=e;}else l=[];const c=i(l,a,r,e,t,n);void 0!==c?e[r]=c:Array.isArray(a)||$e(l)&&$e(a)&&(yt(l)||yt(a)||mt(l)||mt(a))?e[r]=xt(l,a,i,n):null==l&&yt(a)?e[r]=xt({},a,i,n):null==l&&mt(a)?e[r]=De(a):void 0!==l&&void 0===a||(e[r]=a);}return e}function At(e,...t){return Ct(e,...t,ut)}function Et(e,...t){if(function(e){return null==e}(e))return {};const i={};for(let n=0;n<t.length;n++){let s=t[n];switch(typeof s){case "object":Array.isArray(s)||(s=J(s)?Array.from(s):[s]);break;case "string":case "symbol":case "number":s=[s];}for(const t of s){const n=ie(e,t);(void 0!==n||Ue(e,t))&&("string"==typeof t&&Object.hasOwn(e,t)?i[t]=n:it(i,t,n));}}return i}function Tt(e){return "function"==typeof e}function St(e){return $e(e)&&1===e.nodeType&&!yt(e)}function It(e,t){if(!Number.isInteger(e)||e<0)throw new Error("n must be a non-negative integer.");let i=0;return (...n)=>{if(++i>=e)return t(...n)}}function Pt(e,t,i){return "function"!=typeof i&&(i=()=>{}),at(e,t,(...n)=>{const s=i(...n);return void 0!==s?Boolean(s):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?Pt(Array.from(e),Array.from(t),It(2,i)):void 0})}const Vt=new Map([["Æ","Ae"],["Ð","D"],["Ø","O"],["Þ","Th"],["ß","ss"],["æ","ae"],["ð","d"],["ø","o"],["þ","th"],["Đ","D"],["đ","d"],["Ħ","H"],["ħ","h"],["ı","i"],["Ĳ","IJ"],["ĳ","ij"],["ĸ","k"],["Ŀ","L"],["ŀ","l"],["Ł","L"],["ł","l"],["ŉ","'n"],["Ŋ","N"],["ŋ","n"],["Œ","Oe"],["œ","oe"],["Ŧ","T"],["ŧ","t"],["ſ","s"]]);function Rt(e){return function(e){e=e.normalize("NFD");let t="";for(let i=0;i<e.length;i++){const n=e[i];n>="̀"&&n<="ͯ"||n>="︠"&&n<="︣"||(t+=Vt.get(n)??n);}return t}(ee(e))}const Ot=/\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;const Bt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Lt(e){return ee(e).replace(/[&<>"']/g,e=>Bt[e])}function Mt(e){return function(e){return e.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&")}(ee(e))}function Ft(e){const t=function(e){return Array.from(e.match(Ot)??[])}(function(e){return "string"!=typeof e&&(e=ee(e)),e.replace(/['\u2019]/g,"")}(Rt(e)).trim());let i="";for(let e=0;e<t.length;e++){const n=t[e];i&&(i+=" "),n===n.toUpperCase()?i+=n:i+=n[0].toUpperCase()+n.slice(1).toLowerCase();}return i}function Nt(e){return function(e){return e.substring(0,1).toUpperCase()+e.substring(1)}(ee(e))}const Dt=Symbol("observableProperties"),zt=Symbol("boundObservables"),Ht=Symbol("boundProperties"),qt=Symbol("decoratedMethods"),Ut=Symbol("decoratedOriginal"),jt=$t(z());function $t(e){if(!e)return jt;return class extends e{set(e,t){if(ne(e))return void Object.keys(e).forEach(t=>{this.set(t,e[t]);},this);Wt(this);const i=this[Dt];if(e in this&&!i.has(e))throw new I("observable-set-cannot-override",this);Object.defineProperty(this,e,{enumerable:true,configurable:true,get:()=>i.get(e),set(t){const n=i.get(e);let s=this.fire(`set:${e}`,e,t,n);void 0===s&&(s=t),n===s&&i.has(e)||(i.set(e,s),this.fire(`change:${e}`,e,s,n));}}),this[e]=t;}bind(...e){if(!e.length||!Jt(e))throw new I("observable-bind-wrong-properties",this);if(new Set(e).size!==e.length)throw new I("observable-bind-duplicate-properties",this);Wt(this);const t=this[Ht];e.forEach(e=>{if(t.has(e))throw new I("observable-bind-rebind",this)});const i=new Map;return e.forEach(e=>{const n={property:e,to:[]};t.set(e,n),i.set(e,n);}),{to:Gt,toMany:Kt,_observable:this,_bindProperties:e,_to:[],_bindings:i}}unbind(...e){if(!this[Dt])return;const t=this[Ht],i=this[zt];if(e.length){if(!Jt(e))throw new I("observable-unbind-wrong-properties",this);e.forEach(e=>{const n=t.get(e);n&&(n.to.forEach(([e,t])=>{const s=i.get(e),o=s[t];o.delete(n),o.size||delete s[t],Object.keys(s).length||(i.delete(e),this.stopListening(e,"change"));}),t.delete(e));});}else i.forEach((e,t)=>{this.stopListening(t,"change");}),i.clear(),t.clear();}decorate(e){Wt(this);const t=this[e];if(!t)throw new I("observablemixin-cannot-decorate-undefined",this,{object:this,methodName:e});this.on(e,(e,i)=>{e.return=t.apply(this,i);}),this[e]=function(...t){return this.fire(e,t)},this[e][Ut]=t,this[qt]||(this[qt]=[]),this[qt].push(e);}stopListening(e,t,i){if(!e&&this[qt]){for(const e of this[qt])this[e]=this[e][Ut];delete this[qt];}super.stopListening(e,t,i);}[Dt];[qt];[Ht];[zt]}}function Wt(e){e[Dt]||(Object.defineProperty(e,Dt,{value:new Map}),Object.defineProperty(e,zt,{value:new Map}),Object.defineProperty(e,Ht,{value:new Map}));}function Gt(...e){const t=function(...e){if(!e.length)throw new I("observable-bind-to-parse-error",null);const t={to:[]};let i;"function"==typeof e[e.length-1]&&(t.callback=e.pop());return e.forEach(e=>{if("string"==typeof e)i.properties.push(e);else {if("object"!=typeof e)throw new I("observable-bind-to-parse-error",null);i={observable:e,properties:[]},t.to.push(i);}}),t}(...e),i=Array.from(this._bindings.keys()),n=i.length;if(!t.callback&&t.to.length>1)throw new I("observable-bind-to-no-callback",this);if(n>1&&t.callback)throw new I("observable-bind-to-extra-callback",this);var s;t.to.forEach(e=>{if(e.properties.length&&e.properties.length!==n)throw new I("observable-bind-to-properties-length",this);e.properties.length||(e.properties=this._bindProperties);}),this._to=t.to,t.callback&&(this._bindings.get(i[0]).callback=t.callback),s=this._observable,this._to.forEach(e=>{const t=s[zt];let i;t.get(e.observable)||s.listenTo(e.observable,"change",(n,o)=>{i=t.get(e.observable)[o],i&&i.forEach(e=>{Qt(s,e.property);});});}),function(e){let t;e._bindings.forEach((i,n)=>{e._to.forEach(s=>{t=s.properties[i.callback?0:e._bindProperties.indexOf(n)],i.to.push([s.observable,t]),function(e,t,i,n){const s=e[zt],o=s.get(i),r=o||{};r[n]||(r[n]=new Set);r[n].add(t),o||s.set(i,r);}(e._observable,i,s.observable,t);});});}(this),this._bindProperties.forEach(e=>{Qt(this._observable,e);});}function Kt(e,t,i){if(this._bindings.size>1)throw new I("observable-bind-to-many-not-one-binding",this);this.to(...function(e,t){const i=e.map(e=>[e,t]);return Array.prototype.concat.apply([],i)}(e,t),i);}function Jt(e){return e.every(e=>"string"==typeof e)}function Qt(e,t){const i=e[Ht].get(t);let n;i.callback?n=i.callback.apply(e,i.to.map(e=>e[0][e[1]])):(n=i.to[0],n=n[0][n[1]]),Object.prototype.hasOwnProperty.call(e,t)?e[t]=n:e.set(t,n);}class Yt{_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 Zt(e){let t=new AbortController;function i(...i){return t.abort(),t=new AbortController,e(t.signal,...i)}return i.abort=()=>t.abort(),i}function Xt(e){let t=0;for(const i of e)t++;return t}function ei(e,t){const i=Math.min(e.length,t.length);for(let n=0;n<i;n++)if(e[n]!=t[n])return n;return e.length==t.length?"same":e.length<t.length?"prefix":"extension"}function ti(e){return !(!e||!e[Symbol.iterator])}function ii(e,t,i={},n=[]){const s=i&&i.xmlns,o=s?e.createElementNS(s,t):e.createElement(t);for(const e in i)o.setAttribute(e,i[e]);!Je(n)&&ti(n)||(n=[n]);for(let t of n)Je(t)&&(t=e.createTextNode(t)),o.appendChild(t);return o}class ni{_config;constructor(e,t){this._config=Object.create(null),t&&this.define(si(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,true);}get(e){return this._getFromSource(this._config,e)}*names(){for(const e of Object.keys(this._config))yield e;}_setToTarget(e,t,i,n=false){if(yt(t))return void this._setObjectToTarget(e,t,n);const s=t.split(".");t=s.pop();for(const t of s)yt(e[t])||(e[t]=Object.create(null)),e=e[t];if(yt(i))return yt(e[t])||(e[t]=Object.create(null)),e=e[t],void this._setObjectToTarget(e,i,n);n&&void 0!==e[t]||(e[t]=i);}_getFromSource(e,t){const i=t.split(".");t=i.pop();for(const t of i){if(!yt(e[t])){e=null;break}e=e[t];}return e?si(e[t]):void 0}_setObjectToTarget(e,t,i){Object.keys(t).forEach(n=>{this._setToTarget(e,n,t[n],i);});}}function si(e){return Ne(e,oi)}function oi(e){return St(e)||"function"==typeof e?e:void 0}function ri(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  false}function ai(e){const t=Object.prototype.toString.apply(e);return "[object Window]"==t||"[object global]"==t}const li=ci(z());function ci(t){if(!t)return li;return class extends t{listenTo(t,i,n,s={}){if(ri(t)||ai(t)||t instanceof exports.global.window.EventTarget){const e={capture:!!s.useCapture,passive:!!s.usePassive},o=this._getProxyEmitter(t,e)||new ui(t,e);this.listenTo(o,i,n,s);}else super.listenTo(t,i,n,s);}stopListening(t,i,n){if(ri(t)||ai(t)||t instanceof exports.global.window.EventTarget){const e=this._getAllProxyEmitters(t);for(const t of e)this.stopListening(t,i,n);}else super.stopListening(t,i,n);}_getProxyEmitter(e,t){return H(this,di(e,t))}_getAllProxyEmitters(e){return [{capture:false,passive:false},{capture:false,passive:true},{capture:true,passive:false},{capture:true,passive:true}].map(t=>this._getProxyEmitter(e,t)).filter(e=>!!e)}}}class ui extends(z()){_domNode;_options;constructor(e,t){super(),q(this,di(e,t)),this._domNode=e,this._options=t;}_domListeners;attach(e){if(this._domListeners&&this._domListeners[e])return;const t=this._createDomListener(e);this._domNode.addEventListener(e,t,this._options),this._domListeners||(this._domListeners={}),this._domListeners[e]=t;}detach(e){let t;!this._domListeners[e]||(t=this._events[e])&&t.callbacks.length||this._domListeners[e].removeListener();}_addEventListener(e,t,i){this.attach(e),z().prototype._addEventListener.call(this,e,t,i);}_removeEventListener(e,t){z().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 di(e,t){let i=function(e){return e["data-ck-expando"]||(e["data-ck-expando"]=A())}(e);for(const e of Object.keys(t).sort())t[e]&&(i+="-"+e);return i}function hi(t){let i=t.parentElement;if(!i)return null;for(;"BODY"!=i.tagName;){const t=i.style.overflowY||exports.global.window.getComputedStyle(i).overflowY;if("auto"===t||"scroll"===t)break;if(i=i.parentElement,!i)return null}return i}function mi(e){const t=[];let i=e;for(;i&&i.nodeType!=Node.DOCUMENT_NODE;)t.unshift(i),i=i.parentNode;return t}function gi(e){return e instanceof HTMLTextAreaElement?e.value:e.innerHTML}function fi(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 pi(e){if(!e.target)return null;const t=e.target.ownerDocument,i=e.clientX,n=e.clientY;let s=null;return t.caretRangeFromPoint&&t.caretRangeFromPoint(i,n)?s=t.caretRangeFromPoint(i,n):e.rangeParent&&(s=t.createRange(),s.setStart(e.rangeParent,e.rangeOffset),s.collapse(true)),s}function bi(e,t){const i=mi(e),n=mi(t);let s=0;for(;i[s]==n[s]&&i[s];)s++;return 0===s?null:i[s-1]}function wi(t){return t&&t.parentNode?t.offsetParent===exports.global.document.body?null:t.offsetParent:null}function vi(e){return "[object Text]"==Object.prototype.toString.call(e)}function _i(e){return "[object Range]"==Object.prototype.toString.apply(e)}const yi=["top","right","bottom","left","width","height"],ki=new Set(["relative","absolute","fixed","sticky"]);class Ci{top;right;bottom;left;width;height;_source;constructor(e){const t=_i(e);if(Object.defineProperty(this,"_source",{value:e._source||e,writable:true,enumerable:false}),Ei(e)||t)if(t){const t=Ci.getDomRangeRects(e);xi(this,Ci.getBoundingRect(t));}else xi(this,e.getBoundingClientRect());else if(ai(e)){const{innerWidth:t,innerHeight:i}=e;xi(this,{top:0,right:t,bottom:i,left:0,width:t,height:i});}else xi(this,e);}clone(){return new Ci(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 Ci(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(Ai(e))return t;let i,n=e,s=e.parentNode||e.commonAncestorContainer;for(;s&&!Ai(s);){const e="visible"===Si(s);if(Ii(n)&&(i=n),e||i&&"absolute"===Ti(i)&&!Ii(s)){n=s,s=s.parentNode;continue}const o=new Ci(s),r=t.getIntersection(o);if(!r)return null;r.getArea()<t.getArea()&&(t=r),n=s,s=s.parentNode;}return t}isEqual(e){for(const t of yi)if(this[t]!==e[t])return  false;return  true}contains(e){const t=this.getIntersection(e);return !(!t||!t.isEqual(e))}toAbsoluteRect(){const{scrollX:t,scrollY:i}=exports.global.window,n=this.clone().moveBy(t,i);if(Ei(n._source)){const e=wi(n._source);e&&function(e,t){const i=new Ci(t),n=fi(t);let s=0,o=0;s-=i.left,o-=i.top,s+=t.scrollLeft,o+=t.scrollTop,s-=n.left,o-=n.top,e.moveBy(s,o);}(n,e);}return n}excludeScrollbarsAndBorders(){const e=this._source;let t,i,n;if(ai(e))t=e.innerWidth-e.document.documentElement.clientWidth,i=e.innerHeight-e.document.documentElement.clientHeight,n=e.getComputedStyle(e.document.documentElement).direction;else {const s=fi(e);t=e.offsetWidth-e.clientWidth-s.left-s.right,i=e.offsetHeight-e.clientHeight-s.top-s.bottom,n=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"===n?this.right-=t:this.left+=t,this.height-=i,this.bottom-=i,this}static getDomRangeRects(e){const t=[],i=Array.from(e.getClientRects());if(i.length)for(const n of i){const i=new Ci(n);i._source=e,t.push(i);}else {let i=e.startContainer;vi(i)&&(i=i.parentNode);const n=new Ci(i.getBoundingClientRect());n.right=n.left,n.width=0,t.push(n);}return t}static getDomElementRects(e){return Array.from(e.getClientRects()).map(t=>{const i=new Ci(t);return i._source=e,i})}static getBoundingRect(e){const t={left:Number.POSITIVE_INFINITY,top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,width:0,height:0};let i=0;for(const n of e)i++,t.left=Math.min(t.left,n.left),t.top=Math.min(t.top,n.top),t.right=Math.max(t.right,n.right),t.bottom=Math.max(t.bottom,n.bottom);return 0==i?null:(t.width=t.right-t.left,t.height=t.bottom-t.top,new Ci(t))}}function xi(e,t){for(const i of yi)e[i]=t[i];}function Ai(e){return !!Ei(e)&&e===e.ownerDocument.body}function Ei(e){return null!==e&&"object"==typeof e&&1===e.nodeType&&"function"==typeof e.getBoundingClientRect}function Ti(e){return e.ownerDocument.defaultView.getComputedStyle(e).position}function Si(e){return e instanceof HTMLElement?e.ownerDocument.defaultView.getComputedStyle(e).overflow:"visible"}function Ii(e){return e instanceof HTMLElement&&ki.has(Ti(e))}class Pi{_element;_callback;static _observerInstance=null;static _elementCallbacks=null;constructor(e,t){Pi._observerInstance||Pi._createObserver(),this._element=e,this._callback=t,Pi._addElementCallback(e,t),Pi._observerInstance.observe(e);}get element(){return this._element}destroy(){Pi._deleteElementCallback(this._element,this._callback);}static _addElementCallback(e,t){Pi._elementCallbacks||(Pi._elementCallbacks=new Map);let i=Pi._elementCallbacks.get(e);i||(i=new Set,Pi._elementCallbacks.set(e,i)),i.add(t);}static _deleteElementCallback(e,t){const i=Pi._getElementCallbacks(e);i&&(i.delete(t),i.size||(Pi._elementCallbacks.delete(e),Pi._observerInstance.unobserve(e))),Pi._elementCallbacks&&!Pi._elementCallbacks.size&&(Pi._observerInstance=null,Pi._elementCallbacks=null);}static _getElementCallbacks(e){return Pi._elementCallbacks?Pi._elementCallbacks.get(e):null}static _createObserver(){Pi._observerInstance=new exports.global.window.ResizeObserver(e=>{for(const t of e){const e=Pi._getElementCallbacks(t.target);if(e)for(const i of e)i(t);}});}}function Vi(e,t){e instanceof HTMLTextAreaElement&&(e.value=t),e.innerHTML=t;}function Ri(e){return t=>t+e}function Oi(e){let t=0;for(;e.previousSibling;)e=e.previousSibling,t++;return t}function Bi(e,t,i){e.insertBefore(i,e.childNodes[t]||null);}function Li(e){return e&&e.nodeType===Node.COMMENT_NODE}function Mi(t){try{exports.global.document.createAttribute(t);}catch{return  false}return  true}function Fi(e){return !!e&&(vi(e)?Fi(e.parentElement):!!e.getClientRects&&!!e.getClientRects().length)}function Ni({element:e,target:t,positions:i,limiter:n,fitInViewport:s,viewportOffsetConfig:o}){Tt(t)&&(t=t()),Tt(n)&&(n=n());const r=wi(e),a=zi(o),l=new Ci(e),c=Di(t,a);let u;if(!c||!a.getIntersection(c))return null;const d={targetRect:c,elementRect:l,positionedElementAncestor:r,viewportRect:a};if(n||s){if(n){const e=Di(n,a);e&&(d.limiterRect=e);}u=function(e,t){const{elementRect:i}=t,n=i.getArea(),s=e.map(e=>new Hi(e,t)).filter(e=>!!e.name);let o=0,r=null;for(const e of s){const{limiterIntersectionArea:t,viewportIntersectionArea:i}=e;if(t===n)return e;const s=i**2+t**2;s>o&&(o=s,r=e);}return r}(i,d);}else u=new Hi(i[0],d);return u}function Di(e,t){const i=new Ci(e).getVisible();return i?i.getIntersection(t):null}function zi(t){t=Object.assign({top:0,bottom:0,left:0,right:0},t);const i=new Ci(exports.global.window);return i.top+=t.top,i.height-=t.top,i.bottom-=t.bottom,i.height-=t.bottom,i.left+=t.left,i.right-=t.right,i.width-=t.left+t.right,i}class Hi{name;config;_positioningFunctionCoordinates;_options;_cachedRect;_cachedAbsoluteRect;constructor(e,t){const i=e(t.targetRect,t.elementRect,t.viewportRect,t.limiterRect);if(!i)return;const{left:n,top:s,name:o,config:r}=i;this.name=o,this.config=r,this._positioningFunctionCoordinates={left:n,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 qi(e){const t=e.parentNode;t&&t.removeChild(e);}function Ui(){const t=exports.global.window.visualViewport;if(!t||!n.isiOS&&!n.isSafari)return {left:0,top:0};return {left:Math.max(Math.round(t.offsetLeft),0),top:Math.max(Math.round(t.offsetTop),0)}}function ji({target:e,viewportOffset:t=0,ancestorOffset:i=0,alignToTop:n,forceScroll:s}){const o=Zi(e);let r=o,a=null;for(t=function(e){if("number"==typeof e)return {top:e,bottom:e,left:e,right:e};return e}(t);r;){let l;l=Xi(r==o?e:a),Gi({parent:l,getRect:()=>en(e,r),alignToTop:n,ancestorOffset:i,forceScroll:s});let c=en(e,r);const u=en(l,r);if(c.height>u.height){const e=c.getIntersection(u);e&&(c=e);}if(Wi({window:r,rect:c,viewportOffset:t,alignToTop:n,forceScroll:s}),r.parent!=r){if(a=r.frameElement,r=r.parent,!a)return}else r=null;}}function $i(e,t,i,n,s){Gi({parent:Xi(e),getRect:()=>new Ci(e),ancestorOffset:t,limiterElement:i,alignToTop:n,forceScroll:s});}function Wi({window:e,rect:t,alignToTop:i,forceScroll:n,viewportOffset:s}){const o=t.clone().moveBy(0,s.bottom),r=t.clone().moveBy(0,-s.top),a=new Ci(e).excludeScrollbarsAndBorders(),l=i&&n,c=[r,o].every(e=>a.contains(e));let{scrollX:u,scrollY:d}=e;const h=u,m=d;l?d-=a.top-t.top+s.top:c||(Ji(r,a)?d-=a.top-t.top+s.top:Ki(o,a)&&(d+=i?t.top-a.top-s.top:t.bottom-a.bottom+s.bottom)),c||(Qi(t,a)?u-=a.left-t.left+s.left:Yi(t,a)&&(u+=t.right-a.right+s.right)),u==h&&d===m||e.scrollTo(u,d);}function Gi({parent:e,getRect:t,alignToTop:i,forceScroll:n,ancestorOffset:s=0,limiterElement:o}){const r=Zi(e),a=i&&n;let l,c,u;const d=o||r.document.body;for(;e!=d;)c=t(),l=new Ci(e).excludeScrollbarsAndBorders(),u=l.contains(c),a?e.scrollTop-=l.top-c.top+s:u||(Ji(c,l)?e.scrollTop-=l.top-c.top+s:Ki(c,l)&&(e.scrollTop+=i?c.top-l.top-s:c.bottom-l.bottom+s)),u||(Qi(c,l)?e.scrollLeft-=l.left-c.left+s:Yi(c,l)&&(e.scrollLeft+=c.right-l.right+s)),e=e.parentNode;}function Ki(e,t){return e.bottom>t.bottom}function Ji(e,t){return e.top<t.top}function Qi(e,t){return e.left<t.left}function Yi(e,t){return e.right>t.right}function Zi(e){return _i(e)?e.startContainer.ownerDocument.defaultView:e.ownerDocument.defaultView}function Xi(e){if(_i(e)){let t=e.commonAncestorContainer;return vi(t)&&(t=t.parentNode),t}return e.parentNode}function en(e,t){const i=Zi(e),n=new Ci(e);if(i===t)return n;{let e=i;for(;e!=t;){const t=e.frameElement,i=new Ci(t).excludeScrollbarsAndBorders();n.moveBy(i.left,i.top),e=e.parent;}}return n}const tn={ctrl:"⌃",cmd:"⌘",alt:"⌥",shift:"⇧"},nn={ctrl:"Ctrl+",alt:"Alt+",shift:"Shift+"},sn={37:"←",38:"↑",39:"→",40:"↓",9:"⇥",33:"Page Up",34:"Page Down"},on=mn(),rn=Object.fromEntries(Object.entries(on).map(([e,t])=>{let i;return i=t in sn?sn[t]:e.charAt(0).toUpperCase()+e.slice(1),[t,i]}));function an(e){let t;if("string"==typeof e){if(t=on[e.toLowerCase()],!t)throw new I("keyboard-unknown-key",null,{key:e})}else t=e.keyCode+(e.altKey?on.alt:0)+(e.ctrlKey?on.ctrl:0)+(e.shiftKey?on.shift:0)+(e.metaKey?on.cmd:0);return t}function ln(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 an(e.slice(0,-1));const t=an(e);return (n.isMac||n.isiOS)&&t==on.ctrl?on.cmd:t}(e):e).reduce((e,t)=>t+e,0)}function cn(e,t){let i=ln(e);const s=t?"Mac"===t:n.isMac||n.isiOS;return Object.entries(s?tn:nn).reduce((e,[t,n])=>(0!=(i&on[t])&&(i&=~on[t],e+=n),e),"")+(i?rn[i]:"")}function un(e){return e==on.arrowright||e==on.arrowleft||e==on.arrowup||e==on.arrowdown}function dn(e,t){const i="ltr"===t;switch(e){case on.arrowleft:return i?"left":"right";case on.arrowright:return i?"right":"left";case on.arrowup:return "up";case on.arrowdown:return "down"}}function hn(e,t){const i=dn(e,t);return "down"===i||"right"===i}function mn(){const e={pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,backspace:8,delete:46,enter:13,space:32,esc:27,tab:9,ctrl:1114112,shift:2228224,alt:4456448,cmd:8912896};for(let 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 gn=["ar","ara","dv","div","fa","per","fas","he","heb","ku","kur","ug","uig","ur","urd"];function fn(e){return gn.includes(e)?"rtl":"ltr"}function pn(e){return Array.isArray(e)?e:[e]}function bn(t,i,n){exports.global.window.CKEDITOR_TRANSLATIONS[t]||(exports.global.window.CKEDITOR_TRANSLATIONS[t]={});const s=exports.global.window.CKEDITOR_TRANSLATIONS[t];s.dictionary=s.dictionary||{},s.getPluralForm=n||s.getPluralForm,Object.assign(s.dictionary,i);}function wn(t,i,n=1,s){if("number"!=typeof n)throw new I("translation-service-quantity-not-a-number",null,{quantity:n});const o=s||exports.global.window.CKEDITOR_TRANSLATIONS,r=function(e){return Object.keys(e).length}(o);1===r&&(t=Object.keys(o)[0]);const a=i.id||i.string;if(0===r||!function(e,t,i){return !!i[e]&&!!i[e].dictionary[t]}(t,a,o))return 1!==n?i.plural:i.string;const l=o[t].dictionary,c=o[t].getPluralForm||(e=>1===e?0:1),u=l[a];if("string"==typeof u)return u;return u[Number(c(n))]}function vn(){exports.global.window.CKEDITOR_TRANSLATIONS&&(exports.global.window.CKEDITOR_TRANSLATIONS={});}function _n(e){return Array.isArray(e)?e.reduce((e,t)=>At(e,t)):e}exports.global.window.CKEDITOR_TRANSLATIONS||(exports.global.window.CKEDITOR_TRANSLATIONS={});class yn{uiLanguage;uiLanguageDirection;contentLanguage;contentLanguageDirection;t;translations;constructor({uiLanguage:e="en",contentLanguage:t,translations:i}={}){this.uiLanguage=e,this.contentLanguage=t||this.uiLanguage,this.uiLanguageDirection=fn(this.uiLanguage),this.contentLanguageDirection=fn(this.contentLanguage),this.translations=_n(i),this.t=(e,t)=>this._t(e,t);}_t(e,t=[]){t=pn(t),"string"==typeof e&&(e={string:e});const i=!!e.plural?t[0]:1;return function(e,t){return e.replace(/%(\d+)/g,(e,i)=>i<t.length?t[i]:e)}(wn(this.uiLanguage,e,i,this.translations),t)}}class kn extends(z()){_items;_itemMap;_idProperty;_bindToCollection;_bindToExternalToInternalMap;_bindToInternalToExternalMap;_skippedIndexesFromExternal;constructor(e={},t={}){super();const i=ti(e);if(i||(t=e),this._items=[],this._itemMap=new Map,this._idProperty=t.idProperty||"id",this._bindToExternalToInternalMap=new WeakMap,this._bindToInternalToExternalMap=new WeakMap,this._skippedIndexesFromExternal=[],i)for(const t of e)this._items.push(t),this._itemMap.set(this._getItemIdBeforeAdding(t),t);}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 I("collection-add-item-invalid-index",this);let i=0;for(const n of e){const e=this._getItemIdBeforeAdding(n),s=t+i;this._items.splice(s,0,n),this._itemMap.set(e,n),this.fire("add",n,s),i++;}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 I("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,i]=this._remove(e);return this.fire("change",{added:[],removed:[t],index:i}),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 I("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,i=(i,n,s)=>{const o=t._bindToCollection==this,r=t._bindToInternalToExternalMap.get(n);if(o&&r)this._bindToExternalToInternalMap.set(n,r),this._bindToInternalToExternalMap.set(r,n);else {const i=e(n);if(!i)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(n,i),this._bindToInternalToExternalMap.set(i,n),this.add(i,o);for(let e=0;e<t._skippedIndexesFromExternal.length;e++)o<=t._skippedIndexesFromExternal[e]&&t._skippedIndexesFromExternal[e]++;}};for(const e of t)i(0,e,t.getIndex(e));this.listenTo(t,"add",i),this.listenTo(t,"remove",(e,t,i)=>{const n=this._bindToExternalToInternalMap.get(t);n&&this.remove(n),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce((e,t)=>(i<t&&e.push(t-1),i>t&&e.push(t),e),[]);});}_getItemIdBeforeAdding(e){const t=this._idProperty;let i;if(t in e){if(i=e[t],"string"!=typeof i)throw new I("collection-add-invalid-id",this);if(this.get(i))throw new I("collection-add-item-already-exists",this)}else e[t]=i=A();return i}_remove(e){let t,i,n,s=false;const o=this._idProperty;if("string"==typeof e?(i=e,n=this._itemMap.get(i),s=!n,n&&(t=this._items.indexOf(n))):"number"==typeof e?(t=e,n=this._items[t],s=!n,n&&(i=n[o])):(n=e,i=n[o],t=this._items.indexOf(n),s=-1==t||!this._itemMap.get(i)),s)throw new I("collection-remove-404",this);this._items.splice(t,1),this._itemMap.delete(i);const r=this._bindToInternalToExternalMap.get(n);return this._bindToInternalToExternalMap.delete(n),this._bindToExternalToInternalMap.delete(r),this.fire("remove",n,t),[n,t]}[Symbol.iterator](){return this._items[Symbol.iterator]()}}function Cn(e){const t=e.next();return t.done?null:t.value}function xn(e,t){for(const i of t){if(0===e)return i;e-=1;}return null}class An extends(ci($t())){_elements=new Set;_externalViews=new Set;_blurTimeout=null;constructor(){super(),this.set("isFocused",false),this.set("focusedElement",null);}get elements(){return Array.from(this._elements.values())}get externalViews(){return Array.from(this._externalViews.values())}add(e){if(Tn(e))this._addElement(e);else if(En(e))this._addView(e);else {if(!e.element)throw new I("focustracker-add-view-missing-element",{focusTracker:this,view:e});this._addElement(e.element);}}remove(e){Tn(e)?this._removeElement(e):En(e)?this._removeView(e):this._removeElement(e.element);}_addElement(e){if(this._elements.has(e))throw new I("focustracker-add-element-already-exist",this);this.listenTo(e,"focus",()=>{const t=this.externalViews.find(t=>function(e,t){if(Sn(e,t))return  true;return !!t.focusTracker.externalViews.find(t=>Sn(e,t))}(e,t));t?this._focus(t.element):this._focus(e);},{useCapture:true}),this.listenTo(e,"blur",()=>{this._blur();},{useCapture:true}),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=false,this.focusedElement=null;}_focus(e){this._clearBlurTimeout(),this.focusedElement=e,this.isFocused=true;}_blur(){const e=this.elements.find(e=>e.contains(document.activeElement));if(e)return;this.externalViews.find(e=>e.focusTracker.isFocused&&!e.focusTracker._blurTimeout)||(this._clearBlurTimeout(),this._blurTimeout=setTimeout(()=>{this.focusedElement=null,this.isFocused=false;},0));}_clearBlurTimeout(){clearTimeout(this._blurTimeout),this._blurTimeout=null;}}function En(e){return "focusTracker"in e&&e.focusTracker instanceof An}function Tn(e){return St(e)}function Sn(e,t){return !!t.element&&t.element.contains(document.activeElement)&&e.contains(t.element)}class In{_listener;constructor(){this._listener=new(ci());}listenTo(e){this._listener.listenTo(e,"keydown",(e,t)=>{this._listener.fire("_keydown:"+an(t),t);});}set(e,t,i={}){const n=ln(e),s=i.priority;this._listener.listenTo(this._listener,"_keydown:"+n,(e,n)=>{i.filter&&!i.filter(n)||(t(n,()=>{n.preventDefault(),n.stopPropagation(),e.stop();}),e.return=true);},{priority:s});}press(e){return !!this._listener.fire("_keydown:"+an(e),e)}stopListening(e){this._listener.stopListening(e);}destroy(){this.stopListening();}}function Pn(e){const t=new Map;for(const i in e)t.set(i,e[i]);return t}function Vn(e){return ti(e)?new Map(e):Pn(e)}function Rn(e,t){if(e.size!=t.size)return  false;for(const i of e.entries()){if(JSON.stringify(i[1])!==JSON.stringify(t.get(i[0])))return  false}return  true}function On(e,t={}){return new Promise((i,n)=>{const s=t.signal||(new AbortController).signal;s.throwIfAborted();const o=setTimeout(function(){s.removeEventListener("abort",r),i();},e);function r(){clearTimeout(o),n(s.reason);}s.addEventListener("abort",r,{once:true});})}async function Bn(e,t={}){const{maxAttempts:i=4,retryDelay:n=Ln(),signal:s=(new AbortController).signal}=t;s.throwIfAborted();for(let t=0;;t++){try{return await e()}catch(e){if(t+1>=i)throw e}await On(n(t),{signal:s});}}function Ln(e={}){const{delay:t=1e3,factor:i=2,maxDelay:n=1e4}=e;return e=>Math.min(i**e*t,n)}function Mn(e,t,i){const n=e.length,s=t.length;for(let t=n-1;t>=i;t--)e[t+s]=e[t];for(let n=0;n<s;n++)e[i+n]=t[n];}function Fn(e,t){let i;function n(...s){n.cancel(),i=setTimeout(()=>e(...s),t);}return n.cancel=()=>{clearTimeout(i);},n}function Nn(e){try{if(!e.startsWith("ey"))return null;const t=atob(e.replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(t)}catch{return null}}function Dn(e){const t=Array.isArray(e)?e:[e],i=function(){const e=[];for(let t=0;t<256;t++){let i=t;for(let e=0;e<8;e++)1&i?i=3988292384^i>>>1:i>>>=1;e[t]=i;}return e}();let n=-1;const s=t.map(e=>Array.isArray(e)?e.join(""):String(e)).join("");for(let e=0;e<s.length;e++){n=n>>>8^i[255&(n^s.charCodeAt(e))];}return n=(-1^n)>>>0,n.toString(16).padStart(8,"0")}async function zn(e){if(!e)return "";return (await Promise.all(e.map(async e=>{if("EDITOR_STYLES"===e)return function(){const e=[],t=[];for(const i of Array.from(document.styleSheets)){if(i.ownerNode.hasAttribute("data-cke"))for(const n of Array.from(i.cssRules)) -1!==n.cssText.indexOf(".ck-content")?e.push(n.cssText):-1!==n.cssText.indexOf(":root")&&t.push(n.cssText);}e.length||console.warn("The editor stylesheet could not be found in the document. Check your webpack config - style-loader should use data-cke=true attribute for the editor stylesheet.");return [...t,...e].join(" ").trim()}();return (await window.fetch(e)).text()}))).join(" ").trim()}function Hn(e){const t=[{name:"address",isVoid:false},{name:"article",isVoid:false},{name:"aside",isVoid:false},{name:"blockquote",isVoid:false},{name:"details",isVoid:false},{name:"dialog",isVoid:false},{name:"dd",isVoid:false},{name:"div",isVoid:false},{name:"dl",isVoid:false},{name:"dt",isVoid:false},{name:"fieldset",isVoid:false},{name:"figcaption",isVoid:false},{name:"figure",isVoid:false},{name:"footer",isVoid:false},{name:"form",isVoid:false},{name:"h1",isVoid:false},{name:"h2",isVoid:false},{name:"h3",isVoid:false},{name:"h4",isVoid:false},{name:"h5",isVoid:false},{name:"h6",isVoid:false},{name:"header",isVoid:false},{name:"hgroup",isVoid:false},{name:"hr",isVoid:true},{name:"li",isVoid:false},{name:"main",isVoid:false},{name:"nav",isVoid:false},{name:"ol",isVoid:false},{name:"p",isVoid:false},{name:"section",isVoid:false},{name:"table",isVoid:false},{name:"tbody",isVoid:false},{name:"td",isVoid:false},{name:"th",isVoid:false},{name:"thead",isVoid:false},{name:"tfoot",isVoid:false},{name:"tr",isVoid:false},{name:"ul",isVoid:false}],i=t.map(e=>e.name).join("|"),n=e.replace(new RegExp(`</?(${i})( .*?)?>`,"g"),"\n$&\n").replace(/<br[^>]*>/g,"$&\n").split("\n");let s=0,o=false;return n.map(e=>(o=function(e,t){const i=/<pre( .*?)?>/.test(e),n=/<\/pre>/.test(e);return (!i||!n)&&(i?"first":n?"last":("first"===t||"middle"===t)&&"middle")}(e,o),e.length||o?function(e,t){return t.some(t=>!t.isVoid&&!!new RegExp(`<${t.name}( .*?)?>`).test(e))}(e,t)?qn(e,s++):function(e,t){return t.some(t=>new RegExp(`</${t.name}>`).test(e))}(e,t)?qn(e,--s):qn(e,"middle"===o||"last"===o?0:s):"")).join("").trimEnd()}function qn(e,t,i="    "){return `${i.repeat(Math.max(0,t))}${e}\n`}function Un(e){return !!e&&1==e.length&&/[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/.test(e)}function jn(e){return !!e&&1==e.length&&/[\ud800-\udbff]/.test(e)}function $n(e){return !!e&&1==e.length&&/[\udc00-\udfff]/.test(e)}function Wn(e,t){return jn(e.charAt(t-1))&&$n(e.charAt(t))}function Gn(e,t){return Un(e.charAt(t))}const Kn=Qn();function Jn(e,t){const i=String(e).matchAll(Kn);return Array.from(i).some(e=>e.index<t&&t<e.index+e[0].length)}function Qn(){const e=/\p{Regional_Indicator}{2}/u.source,t="(?:"+[/\p{Emoji}[\u{E0020}-\u{E007E}]+\u{E007F}/u,/\p{Emoji}\u{FE0F}?\u{20E3}/u,/\p{Emoji}\u{FE0F}/u,/(?=\p{General_Category=Other_Symbol})\p{Emoji}\p{Emoji_Modifier}*/u].map(e=>e.source).join("|")+")";return new RegExp(`${e}|${t}(?:‍${t})*`,"ug")}function Yn(e){if(!e)return null;const t=function(e){const t=e.split(".");if(3!=t.length)return null;return t[1]}(e);return t?Nn(t):null}function Zn(e,t){return (e.removeFeatures||[]).includes(t)}class Xn extends kn{_parentElement;constructor(e=[]){super(e,{idProperty:"viewUid"}),this.on("add",(e,t,i)=>{this._renderViewIntoCollectionParent(t,i);}),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 e of this)this._renderViewIntoCollectionParent(e);}delegate(...e){if(!e.length||!e.every(e=>"string"==typeof e))throw new I("ui-viewcollection-delegate-wrong-events",this);return {to:t=>{for(const i of this)for(const n of e)i.delegate(n).to(t);this.on("add",(i,n)=>{for(const i of e)n.delegate(i).to(t);}),this.on("remove",(i,n)=>{for(const i of e)n.stopDelegating(i,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 es extends(z()){ns;tag;text;attributes;children;eventListeners;_isRendered;_revertData;constructor(e){super(),Object.assign(this,ds(us(e))),this._isRendered=false,this._revertData=null;}render(){const e=this._renderNode({intoFragment:true});return this._isRendered=true,e}apply(e){return this._revertData={children:[],bindings:[],attributes:{}},this._renderNode({node:e,intoFragment:false,isApplying:true,revertData:this._revertData}),e}revert(e){if(!this._revertData)throw new I("ui-template-revert-not-applied",[this,e]);this._revertTemplateFromNode(e,this._revertData);}*getViews(){yield*function*e(t){if(t.children)for(const i of t.children)bs(i)?yield i:ws(i)&&(yield*e(i));}(this);}static bind(e,t){return {to:(i,n)=>new is({eventNameOrFunction:i,attribute:i,observable:e,emitter:t,callback:n}),if:(i,n,s)=>new ns({observable:e,emitter:t,attribute:i,valueIfTrue:n,callback:s})}}static extend(e,t){if(e._isRendered)throw new I("template-extend-render",[this,e]);fs(e,ds(us(t)));}_renderNode(e){let t;if(t=e.node?this.tag&&this.text:this.tag?this.text:!this.text,t)throw new I("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(""),ss(this.text)?this._bindToObservable({schema:this.text,updater:as(t),data:e}):t.textContent=this.text.join(""),t}_renderAttributes(e){if(!this.attributes)return;const t=e.node,i=e.revertData;for(const n in this.attributes){const s=t.getAttribute(n),o=this.attributes[n];i&&(i.attributes[n]=s);const r=_s(o)?o[0].ns:null;if(ss(o)){const a=_s(o)?o[0].value:o;i&&ks(n)&&a.unshift(s),this._bindToObservable({schema:a,updater:ls(t,n,r),data:e});}else if("style"==n&&"string"!=typeof o[0])this._renderStyleAttribute(o[0],e);else {i&&s&&ks(n)&&o.unshift(s);const e=o.map(e=>e&&e.value||e).reduce((e,t)=>e.concat(t),[]).reduce(ms,"");ps(e)||t.setAttributeNS(r,n,e);}}}_renderStyleAttribute(e,t){const i=t.node;for(const n in e){const s=e[n];ss(s)?this._bindToObservable({schema:[s],updater:cs(i,n),data:t}):os(n)?i.style.setProperty(n,s):i.style[n]=s;}}_renderElementChildren(e){const t=e.node,i=e.intoFragment?document.createDocumentFragment():t,n=e.isApplying;let s=0;for(const o of this.children)if(vs(o)){if(!n){o.setParent(t);for(const e of o)i.appendChild(e.element);}}else if(bs(o))n||(o.isRendered||o.render(),i.appendChild(o.element));else if(ri(o))i.appendChild(o);else if(n){const t=e.revertData,n=ys();t.children.push(n),o._renderNode({intoFragment:false,node:i.childNodes[s++],isApplying:true,revertData:n});}else i.appendChild(o.render());e.intoFragment&&t.appendChild(i);}_setUpListeners(e){if(this.eventListeners)for(const t in this.eventListeners){const i=this.eventListeners[t].map(i=>{const[n,s]=t.split("@");return i.activateDomEventListener(n,s,e)});e.revertData&&e.revertData.bindings.push(i);}}_bindToObservable({schema:e,updater:t,data:i}){const n=i.revertData;rs(e,t,i);const s=e.filter(e=>!ps(e)).filter(e=>e.observable).map(n=>n.activateAttributeListener(e,t,i));n&&n.bindings.push(s);}_revertTemplateFromNode(e,t){for(const e of t.bindings)for(const t of e)t();if(t.text)return void(e.textContent=t.text);const i=e;for(const e in t.attributes){const n=t.attributes[e];null===n?i.removeAttribute(e):i.setAttribute(e,n);}for(let e=0;e<t.children.length;++e)this._revertTemplateFromNode(i.childNodes[e],t.children[e]);}}class ts{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,i){const n=()=>rs(e,t,i);return this.emitter.listenTo(this.observable,`change:${this.attribute}`,n),()=>{this.emitter.stopListening(this.observable,`change:${this.attribute}`,n);}}}class is extends ts{eventNameOrFunction;constructor(e){super(e),this.eventNameOrFunction=e.eventNameOrFunction;}activateDomEventListener(e,t,i){const n=(e,i)=>{t&&!i.target.matches(t)||("function"==typeof this.eventNameOrFunction?this.eventNameOrFunction(i):this.observable.fire(this.eventNameOrFunction,i));};return this.emitter.listenTo(i.node,e,n),()=>{this.emitter.stopListening(i.node,e,n);}}}class ns extends ts{valueIfTrue;constructor(e){super(e),this.valueIfTrue=e.valueIfTrue;}getValue(e){return !ps(super.getValue(e))&&(this.valueIfTrue||true)}}function ss(e){return !!e&&(e.value&&(e=e.value),Array.isArray(e)?e.some(ss):e instanceof ts)}function os(e){return /^--[a-zA-Z_-][\w-]*$/.test(e)}function rs(e,t,{node:i}){const n=function(e,t){return e.map(e=>e instanceof ts?e.getValue(t):e)}(e,i);let s;s=1==e.length&&e[0]instanceof ns?n[0]:n.reduce(ms,""),ps(s)?t.remove():t.set(s);}function as(e){return {set(t){e.textContent=t;},remove(){e.textContent="";}}}function ls(e,t,i){return {set(n){e.setAttributeNS(i,t,n);},remove(){e.removeAttributeNS(i,t);}}}function cs(e,t){return {set(i){os(t)?e.style.setProperty(t,i):e.style[t]=i;},remove(){os(t)?e.style.removeProperty(t):e.style[t]=null;}}}function us(e){return Ne(e,e=>{if(e&&(e instanceof ts||ws(e)||bs(e)||vs(e)))return e})}function ds(e){if("string"==typeof e?e=function(e){return {text:[e]}}(e):e.text&&function(e){e.text=pn(e.text);}(e),e.on&&(e.eventListeners=function(e){for(const t in e)hs(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=pn(e[t].value)),hs(e,t);}(e.attributes);const t=[];if(e.children)if(vs(e.children))t.push(e.children);else for(const i of e.children)ws(i)||bs(i)||ri(i)?t.push(i):t.push(new es(i));e.children=t;}return e}function hs(e,t){e[t]=pn(e[t]);}function ms(e,t){return ps(t)?e:ps(e)?t:`${e} ${t}`}function gs(e,t){for(const i in t)e[i]?e[i].push(...t[i]):e[i]=t[i];}function fs(e,t){if(t.attributes&&(e.attributes||(e.attributes={}),gs(e.attributes,t.attributes)),t.eventListeners&&(e.eventListeners||(e.eventListeners={}),gs(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 I("ui-template-extend-children-mismatch",e);let i=0;for(const n of t.children)fs(e.children[i++],n);}}function ps(e){return !e&&0!==e}function bs(e){return e instanceof Cs}function ws(e){return e instanceof es}function vs(e){return e instanceof Xn}function _s(e){return ne(e[0])&&e[0].ns}function ys(){return {children:[],bindings:[],attributes:{}}}function ks(e){return "class"==e||"style"==e}class Cs extends(ci($t())){element;isRendered;locale;t;template;_viewCollections;_unboundChildren;_bindTemplate;constructor(e){super(),this.element=null,this.isRendered=false,this.locale=e,this.t=e&&e.t,this._viewCollections=new kn,this._unboundChildren=this.createCollection(),this._viewCollections.on("add",(t,i)=>{i.locale=e,i.t=e&&e.t;}),this.decorate("render");}get bindTemplate(){return this._bindTemplate?this._bindTemplate:this._bindTemplate=es.bind(this,this)}createCollection(e){const t=new Xn(e);return this._viewCollections.add(t),t}registerChild(e){ti(e)||(e=[e]);for(const t of e)this._unboundChildren.add(t);}deregisterChild(e){ti(e)||(e=[e]);for(const t of e)this._unboundChildren.remove(t);}setTemplate(e){this.template=new es(e);}extendTemplate(e){es.extend(this.template,e);}render(){if(this.isRendered)throw new I("ui-view-render-already-rendered",this);this.template&&(this.element=this.template.render(),this.registerChild(this.template.getViews())),this.isRendered=true;}destroy(){this.stopListening(),this._viewCollections.map(e=>e.destroy()),this.template&&this.template._revertData&&this.template.revert(this.element);}}const xs={POLITE:"polite",ASSERTIVE:"assertive"};class As{editor;view;constructor(e){this.editor=e,e.once("ready",()=>{for(const e of Object.values(xs))this.announce("",e);});}announce(e,t=xs.POLITE){const i=this.editor;if(!i.ui.view)return;this.view||(this.view=new Es(i.locale),i.ui.view.body.add(this.view));const{politeness:n,isUnsafeHTML:s}="string"==typeof t?{politeness:t}:t;let o=this.view.regionViews.find(e=>e.politeness===n);o||(o=new Ts(i,n),this.view.regionViews.add(o)),o.announce({announcement:e,isUnsafeHTML:s});}}class Es extends Cs{regionViews;constructor(e){super(e),this.regionViews=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-aria-live-announcer"]},children:this.regionViews});}}class Ts extends Cs{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 i=document.createElement("li");t?this._domConverter.setContentOf(i,e):i.innerText=e,this._listElement.appendChild(i);}get _listElement(){return this.element.querySelector("ul")}}function Ss({emitter:e,activator:t,callback:i,contextElements:n,listenerOptions:s}){e.listenTo(document,"mousedown",(e,s)=>{if(!t())return;const o="function"==typeof s.composedPath?s.composedPath():[],r="function"==typeof n?n():n;for(const e of r)if(e.contains(s.target)||o.includes(e))return;i();},s);}function Is(e){return class extends e{disableCssTransitions(){this._isCssTransitionsDisabled=true;}enableCssTransitions(){this._isCssTransitionsDisabled=false;}constructor(...e){super(...e),this.set("_isCssTransitionsDisabled",false),this.initializeCssTransitionDisablerMixin();}initializeCssTransitionDisablerMixin(){this.template&&this.extendTemplate({attributes:{class:[this.bindTemplate.if("_isCssTransitionsDisabled","ck-transitions-disabled")]}});}}}function Ps(t){return class extends t{_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",false);}_attachListeners(){this.listenTo(this.element,"mousedown",this._onDragStart.bind(this)),this.listenTo(this.element,"touchstart",this._onDragStart.bind(this));}_attachDragListeners(){this.listenTo(exports.global.document,"mouseup",this._onDragEndBound),this.listenTo(exports.global.document,"touchend",this._onDragEndBound),this.listenTo(exports.global.document,"mousemove",this._onDragBound),this.listenTo(exports.global.document,"touchmove",this._onDragBound);}_detachDragListeners(){this.stopListening(exports.global.document,"mouseup",this._onDragEndBound),this.stopListening(exports.global.document,"touchend",this._onDragEndBound),this.stopListening(exports.global.document,"mousemove",this._onDragBound),this.stopListening(exports.global.document,"touchmove",this._onDragBound);}_onDragStart(e,t){if(!this._isHandleElementPressed(t))return;this._attachDragListeners();let i=0,n=0;t instanceof MouseEvent?(i=t.clientX,n=t.clientY):(i=t.touches[0].clientX,n=t.touches[0].clientY),this._lastDraggingCoordinates={x:i,y:n},this.isDragging=true;}_onDrag(e,t){if(!this.isDragging)return void this._detachDragListeners();let i=0,n=0;t instanceof MouseEvent?(i=t.clientX,n=t.clientY):(i=t.touches[0].clientX,n=t.touches[0].clientY),t.preventDefault(),this.fire("drag",{deltaX:Math.round(i-this._lastDraggingCoordinates.x),deltaY:Math.round(n-this._lastDraggingCoordinates.y)}),this._lastDraggingCoordinates={x:i,y:n};}_onDragEnd(){this._detachDragListeners(),this.isDragging=false;}_isHandleElementPressed(e){return !!this.dragHandleElement&&(this.dragHandleElement===e.target||e.target instanceof HTMLElement&&this.dragHandleElement.contains(e.target))}}}function Vs({view:e}){e.listenTo(e.element,"submit",(t,i)=>{i.preventDefault(),e.fire("submit");},{useCapture:true});}function Rs({keystrokeHandler:e,focusTracker:t,gridItems:i,numberOfColumns:n,uiLanguageDirection:s}){const o="number"==typeof n?()=>n:n;function r(e){return n=>{const s=i.find(e=>e.element===t.focusedElement),o=i.getIndex(s),r=e(o,i);i.get(r).focus(),n.stopPropagation(),n.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 i=e-o();return i<0&&(i=e+o()*Math.floor(t.length/o()),i>t.length-1&&(i-=o())),i})),e.set("arrowdown",r((e,t)=>{let i=e+o();return i>t.length-1&&(i=e%o()),i}));}class Os extends Cs{id;constructor(e){super(e),this.set("text",void 0),this.set("for",void 0),this.id=`ck-editor__label_${A()}`;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 Bs extends Cs{constructor(e,t){super(e);const i=e.t,n=new Os;n.text=i("Help Contents. To close this dialog press ESC."),this.setTemplate({tag:"div",attributes:{class:["ck","ck-accessibility-help-dialog__content"],"aria-labelledby":n.id,role:"document",tabindex:-1},children:[ii(document,"p",{},i("Below, you can find a list of keyboard shortcuts that can be used in the editor.")),...this._createCategories(Array.from(t.values())),n]});}focus(){this.element.focus();}_createCategories(e){return e.map(e=>{const t=[ii(document,"h3",{},e.label),...Array.from(e.groups.values()).map(e=>this._createGroup(e)).flat()];return e.description&&t.splice(1,0,ii(document,"p",{},e.description)),ii(document,"section",{},t)})}_createGroup(e){const t=e.keystrokes.sort((e,t)=>e.label.localeCompare(t.label)).map(e=>this._createGroupRow(e)).flat(),i=[ii(document,"dl",{},t)];return e.label&&i.unshift(ii(document,"h4",{},e.label)),i}_createGroupRow(e){const t=this.locale.t,i=ii(document,"dt"),s=ii(document,"dd"),o=function(e){if("string"==typeof e)return [[e]];if("string"==typeof e[0])return [e];return e}(e.keystroke),r=[];for(const e of o)r.push(e.map(Ls).join(""));return i.innerHTML=e.label,s.innerHTML=r.join(", ")+(e.mayRequireFn&&n.isMac?` ${t("(may require <kbd>Fn</kbd>)")}`:""),[i,s]}}function Ls(e){return cn(e).split("+").map(e=>`<kbd>${e}</kbd>`).join("+")}class Ms extends($t()){editor;_disableStack=new Set;constructor(e){super(),this.editor=e,this.set("isEnabled",true);}forceDisabled(e){this._disableStack.add(e),1==this._disableStack.size&&(this.on("set:isEnabled",Fs,{priority:"highest"}),this.isEnabled=false);}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",Fs),this.isEnabled=true);}destroy(){this.stopListening();}static get isContextPlugin(){return  false}static get isOfficialPlugin(){return  false}static get isPremiumPlugin(){return  false}}function Fs(e){e.return=false,e.stop();}class Ns extends($t()){editor;_isEnabledBasedOnSelection;_affectsData;_disableStack;static get _throwErrorWhenUsedAsAPlugin(){return  true}constructor(e){super(),this.editor=e,this.set("value",void 0),this.set("isEnabled",false),this._affectsData=true,this._isEnabledBasedOnSelection=true,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 i=e.model.document.selection,n=!("$graveyard"==i.getFirstPosition().root.rootName)&&e.model.canEditAt(i);(e.isReadOnly||this._isEnabledBasedOnSelection&&!n)&&(t.return=false,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=true;}forceDisabled(e){this._disableStack.add(e),1==this._disableStack.size&&(this.on("set:isEnabled",Ds,{priority:"highest"}),this.isEnabled=false);}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",Ds),this.refresh());}execute(...e){}destroy(){this.stopListening();}}function Ds(e){e.return=false,e.stop();}class zs extends Ns{_childCommandsDefinitions=[];refresh(){}execute(...e){const t=this._getFirstEnabledCommand();return !!t&&t.execute(e)}registerChildCommand(e,t={}){T(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 Hs{_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 i=this.get(e);if(!i)throw new I("commandcollection-command-not-found",this,{commandName:e});return i.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 qs extends(z()){_context;_plugins=new Map;_availablePlugins;_contextPlugins;constructor(e,t=[],i=[]){super(),this._context=e,this._availablePlugins=new Map;for(const e of t)e.pluginName&&this._availablePlugins.set(e.pluginName,e);this._contextPlugins=new Map;for(const[e,t]of i)this._contextPlugins.set(e,t),this._contextPlugins.set(t,e),e.pluginName&&this._availablePlugins.set(e.pluginName,e);}*[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 I("plugincollection-plugin-not-loaded",this._context,{plugin:t})}return t}has(e){return this._plugins.has(e)}async init(e,t=[],i=[]){const n=this,s=this._context;!function e(t,i=new Set){t.forEach(t=>{a(t)&&(i.has(t)||(i.add(t),t.pluginName&&!n._availablePlugins.has(t.pluginName)&&n._availablePlugins.set(t.pluginName,t),t.requires&&e(t.requires,i)));});}(e),d(e);const o=[...function e(t,i=new Set){return t.map(e=>a(e)?e:n._availablePlugins.get(e)).reduce((t,n)=>i.has(n)?t:(i.add(n),n.requires&&(d(n.requires,n),e(n.requires,i).forEach(e=>t.add(e))),t.add(n)),new Set)}(e.filter(e=>!c(e,t)))];!function(e,t){for(const i of t){if("function"!=typeof i)throw new I("plugincollection-replace-plugin-invalid-type",null,{pluginItem:i});const t=i.pluginName;if(!t)throw new I("plugincollection-replace-plugin-missing-name",null,{pluginItem:i});if(i.requires&&i.requires.length)throw new I("plugincollection-plugin-for-replacing-cannot-have-dependencies",null,{pluginName:t});const s=n._availablePlugins.get(t);if(!s)throw new I("plugincollection-plugin-for-replacing-not-exist",null,{pluginName:t});const o=e.indexOf(s);if(-1===o){if(n._contextPlugins.has(s))return;throw new I("plugincollection-plugin-for-replacing-not-loaded",null,{pluginName:t})}if(s.requires&&s.requires.length)throw new I("plugincollection-replaced-plugin-cannot-have-dependencies",null,{pluginName:t});e.splice(o,1,i),n._availablePlugins.set(t,i);}}(o,i);const r=function(e){return e.map(e=>{let t=n._contextPlugins.get(e);return t=t||new e(s),n._add(e,t),t})}(o);return await h(r,"init"),await h(r,"afterInit"),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||(u(e)===t||u(t)===e))}function u(e){return a(e)?e.pluginName||e.name:e}function d(e,i=null){e.map(e=>a(e)?e:n._availablePlugins.get(e)||e).forEach(e=>{!function(e){if("function"!=typeof e)return;if(e._throwErrorWhenUsedAsAPlugin)throw new I("plugincollection-plugin-invalid-constructor",s,{name:e.name})}(e),function(e,t){if(a(e))return;if(t)throw new I("plugincollection-soft-required",s,{missingPlugin:e,requiredBy:u(t)});throw new I("plugincollection-plugin-not-found",s,{plugin:e})}(e,i),function(e,t){if(!l(t))return;if(l(e))return;throw new I("plugincollection-context-required",s,{plugin:u(e),requiredBy:u(t)})}(e,i),function(e,i){if(!i)return;if(!c(e,t))return;throw new I("plugincollection-required",s,{plugin:u(e),requiredBy:u(i)})}(e,i);});}function h(e,t){return e.reduce((e,i)=>i[t]?n._contextPlugins.has(i)?e:e.then(i[t].bind(i)):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 i=e.pluginName;if(i){if(this._plugins.has(i))throw new I("plugincollection-plugin-name-conflict",null,{pluginName:i,plugin1:this._plugins.get(i).constructor,plugin2:e});this._plugins.set(i,t);}}}class Us{config;plugins;locale;t;editors;static defaultConfig;static builtinPlugins;_contextOwner=null;constructor(e){const{translations:t,...i}=e||{};this.config=new ni(i,this.constructor.defaultConfig);const n=this.constructor.builtinPlugins;this.config.define("plugins",n),this.plugins=new qs(this,n);const s=this.config.get("language")||{};this.locale=new yn({uiLanguage:"string"==typeof s?s:s.ui,contentLanguage:this.config.get("language.content"),translations:t}),this.t=this.locale.t,this.editors=new kn;}initPlugins(){const e=this.config.get("plugins")||[],t=this.config.get("substitutePlugins")||[];for(const i of e.concat(t)){if("function"!=typeof i)throw new I("context-initplugins-constructor-only",null,{Plugin:i});if(true!==i.isContextPlugin)throw new I("context-initplugins-invalid-plugin",null,{Plugin:i})}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 I("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 i=new this(e);t(i.initPlugins().then(()=>i));})}static get _throwErrorWhenUsedAsAPlugin(){return  true}}class js extends($t()){context;constructor(e){super(),this.context=e;}destroy(){this.stopListening();}static get isContextPlugin(){return  true}static get isOfficialPlugin(){return  false}static get isPremiumPlugin(){return  false}}class $s extends In{editor;constructor(e){super(),this.editor=e;}set(e,t,i={}){if("string"==typeof t){const e=t;t=(t,i)=>{this.editor.execute(e),i();};}super.set(e,t,i);}}const Ws=new WeakMap;let Gs=false;function Ks({view:e,element:t,text:i,isDirectHost:n=true,keepOnFocus:s=false}){const o=e.document;function r(i){const r={text:i,isDirectHost:n,keepOnFocus:s,hostElement:n?t:null};Ws.get(o).set(t,r),e.change(e=>Xs([[t,r]],e));}Ws.has(o)||(Ws.set(o,new Map),o.registerPostFixer(e=>Xs(Ws.get(o),e)),o.on("change:isComposing",()=>{e.change(e=>Xs(Ws.get(o),e));},{priority:"high"})),t.is("editableElement")&&t.on("change:placeholder",(e,t,i)=>r(i)),t.placeholder?r(t.placeholder):i&&r(i),i&&function(){Gs||P("enableViewPlaceholder-deprecated-text-option");Gs=true;}();}function Js(e,t){const i=t.document;Ws.has(i)&&e.change(e=>{const n=Ws.get(i),s=n.get(t);e.removeAttribute("data-placeholder",s.hostElement),Ys(e,s.hostElement),n.delete(t);});}function Qs(e,t){return !t.hasClass("ck-placeholder")&&(e.addClass("ck-placeholder",t),true)}function Ys(e,t){return !!t.hasClass("ck-placeholder")&&(e.removeClass("ck-placeholder",t),true)}function Zs(e,t){if(!e.isAttached())return  false;if(function(e){for(const t of e.getChildren())if(!t.is("uiElement"))return  true;return  false}(e))return  false;const i=e.document,n=i.selection.anchor;return (!i.isComposing||!n||n.parent!==e)&&(!!t||(!i.isFocused||!!n&&n.parent!==e))}function Xs(e,t){const i=[];let n=false;for(const[s,o]of e)o.isDirectHost&&(i.push(s),eo(t,s,o)&&(n=true));for(const[s,o]of e){if(o.isDirectHost)continue;const e=to(s);e!==o.hostElement&&o.hostElement&&(t.removeAttribute("data-placeholder",o.hostElement),Ys(t,o.hostElement),o.hostElement=null,n=true),e&&(i.includes(e)||(o.hostElement=e,eo(t,s,o)&&(n=true)));}return n}function eo(e,t,i){const{text:n,isDirectHost:s,hostElement:o}=i;let r=false;o.getAttribute("data-placeholder")!==n&&(e.setAttribute("data-placeholder",n,o),r=true);return (s||1==t.childCount)&&Zs(o,i.keepOnFocus)?Qs(e,o)&&(r=true):Ys(e,o)&&(r=true),r}function to(e){if(e.childCount){const t=e.getChild(0);if(t.is("element")&&!t.is("uiElement")&&!t.is("attributeElement"))return t}return null}class io{is(){throw new Error("is() method is abstract")}}class no extends(z(io)){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 I("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 i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}getCommonAncestor(e,t={}){const i=this.getAncestors(t),n=e.getAncestors(t);let s=0;for(;i[s]==n[s]&&i[s];)s++;return 0===s?null:i[s-1]}isBefore(e){if(this==e)return  false;if(this.root!==e.root)return  false;const t=this.getPath(),i=e.getPath(),n=ei(t,i);switch(n){case "prefix":return  true;case "extension":return  false;default:return t[n]<i[n]}}isAfter(e){return this!=e&&(this.root===e.root&&!this.isBefore(e))}_remove(){this.parent._removeChildren(this.index);}_fireChange(e,t,i){this.fire(`change:${e}`,t,i),this.parent&&this.parent._fireChange(e,t,i);}toJSON(){const e={path:this.getPath(),type:"Node"};return this!==this.root&&this.root.is("rootElement")&&(e.root=this.root.toJSON()),e}}no.prototype.is=function(e){return "node"===e||"view:node"===e};class so extends no{_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(e){return e instanceof so&&(this===e||this.data===e.data)}toJSON(){const e=super.toJSON();return e.type="Text",e.data=this.data,e}_clone(){return new so(this.document,this.data)}}so.prototype.is=function(e){return "$text"===e||"view:$text"===e||"text"===e||"view:text"===e||"node"===e||"view:node"===e};class oo extends io{textNode;data;offsetInText;constructor(e,t,i){if(super(),this.textNode=e,t<0||t>e.data.length)throw new I("view-textproxy-wrong-offsetintext",this);if(i<0||t+i>e.data.length)throw new I("view-textproxy-wrong-length",this);this.data=e.data.substring(t,t+i),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 i=e.includeSelf?this.textNode:this.parent;for(;null!==i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}}oo.prototype.is=function(e){return "$textProxy"===e||"view:$textProxy"===e||"textProxy"===e||"view:textProxy"===e};class ro{_consumables=new Map;add(e,t){let i;e.is("$text")||e.is("documentFragment")?this._consumables.set(e,true):(this._consumables.has(e)?i=this._consumables.get(e):(i=new ao(e),this._consumables.set(e,i)),i.add(t?lo(t):e._getConsumables()));}test(e,t){const i=this._consumables.get(e);return void 0===i?null:e.is("$text")||e.is("documentFragment")?i:i.test(lo(t))}consume(e,t){if(e.is("$text")||e.is("documentFragment"))return !!this.test(e,t)&&(this._consumables.set(e,false),true);const i=this._consumables.get(e);return void 0!==i&&i.consume(lo(t))}revert(e,t){const i=this._consumables.get(e);void 0!==i&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,true):i.revert(lo(t)));}static createFrom(e,t){if(t||(t=new ro),e.is("$text"))t.add(e);else if(e.is("element")||e.is("documentFragment")){t.add(e);for(const i of e.getChildren())ro.createFrom(i,t);}return t}}class ao{element;_canConsumeName=null;_attributes=new Map;constructor(e){this.element=e;}add(e){e.name&&(this._canConsumeName=true);for(const[t,i]of e.attributes)if(i){let e=this._attributes.get(t);e&&"boolean"!=typeof e||(e=new Map,this._attributes.set(t,e)),e.set(i,true);}else {if("style"==t||"class"==t)throw new I("viewconsumable-invalid-attribute",this);this._attributes.set(t,true);}}test(e){if(e.name&&!this._canConsumeName)return this._canConsumeName;for(const[t,i]of e.attributes){const e=this._attributes.get(t);if(void 0===e)return null;if(false===e)return  false;if(true!==e)if(i){const t=e.get(i);if(void 0===t)return null;if(!t)return  false}else for(const t of e.values())if(!t)return  false}return  true}consume(e){if(!this.test(e))return  false;e.name&&(this._canConsumeName=false);for(const[t,i]of e.attributes){const e=this._attributes.get(t);if("boolean"==typeof e)for(const[e]of this.element._getConsumables(t,i).attributes)this._attributes.set(e,false);else if(i)for(const[,n]of this.element._getConsumables(t,i).attributes)e.set(n,false);else for(const t of e.keys())e.set(t,false);}return  true}revert(e){e.name&&(this._canConsumeName=true);for(const[t,i]of e.attributes){const e=this._attributes.get(t);if(false!==e){if(void 0!==e&&true!==e)if(i){ false===e.get(i)&&e.set(i,true);}else for(const t of e.keys())e.set(t,true);}else this._attributes.set(t,true);}}}function lo(e){const t=[];return "attributes"in e&&e.attributes&&co(t,e.attributes),"classes"in e&&e.classes&&co(t,e.classes,"class"),"styles"in e&&e.styles&&co(t,e.styles,"style"),{name:e.name||false,attributes:t}}function co(e,t,i){if("string"!=typeof t)for(const n of t)Array.isArray(n)?e.push(n):e.push(i?[i,n]:[n]);else e.push(i?[i,t]:[t]);}class uo{_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 i=this._isElementMatching(t,e);if(i)return {element:t,pattern:e,match:i}}return null}matchAll(...e){const t=[];for(const i of e)for(const e of this._patterns){const n=this._isElementMatching(i,e);n&&t.push({element:i,pattern:e,match:n});}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}_isElementMatching(e,t){if("function"==typeof t){const i=t(e);return i&&"object"==typeof i?lo(i):i}const i={};if(t.name&&(i.name=function(e,t){if(e instanceof RegExp)return !!t.match(e);return e===t}(t.name,e.name),!i.name))return null;const n=[];return t.attributes&&!function(e,t,i){let n;"object"!=typeof e||e instanceof RegExp||Array.isArray(e)?n=["class","style"]:(void 0!==e.style&&P("matcher-pattern-deprecated-attributes-style-key",e),void 0!==e.class&&P("matcher-pattern-deprecated-attributes-class-key",e));return t._collectAttributesMatch(mo(e),i,n)}(t.attributes,e,n)||t.classes&&!function(e,t,i){return t._collectAttributesMatch(mo(e,"class"),i)}(t.classes,e,n)||t.styles&&!function(e,t,i){return t._collectAttributesMatch(mo(e,"style"),i)}(t.styles,e,n)?null:(n.length&&(i.attributes=n),i)}}function ho(e,t){return  true===e||e===t||e instanceof RegExp&&!!String(t).match(e)}function mo(e,t){if(Array.isArray(e))return e.map(e=>"object"!=typeof e||e instanceof RegExp?t?[t,e,true]:[e,true]:(void 0!==e.key&&void 0!==e.value||P("matcher-pattern-missing-key-or-value",e),t?[t,e.key,e.value]:[e.key,e.value]));if("object"!=typeof e||e instanceof RegExp)return [t?[t,e,true]:[e,true]];const i=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&i.push(t?[t,n,e[n]]:[n,e[n]]);return i}class go{_styles;_cachedStyleNames=null;_cachedExpandedStyleNames=null;_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,i=0,n=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(i,r-i),n=r+1);break;case '"':case "'":t=a;break;case ";":{const t=e.substr(n,r-n);s&&o.set(s.trim(),t.trim()),s=null,i=r+1;break}}else a===t&&(t=null);}return o}(e);for(const[e,i]of t)this._styleProcessor.toNormalizedForm(e,i,this._styles);return this}has(e){if(this.isEmpty)return  false;const t=this._styleProcessor.getReducedForm(e,this._styles).find(([t])=>t===e);return Array.isArray(t)}set(e,t){if(this._cachedStyleNames=null,this._cachedExpandedStyleNames=null,ne(e))for(const[t,i]of Object.entries(e))this._styleProcessor.toNormalizedForm(t,i,this._styles);else this._styleProcessor.toNormalizedForm(e,t,this._styles);}remove(e){const t={};for(const i of pn(e)){const e=po(i),n=ie(this._styles,e);if(n)bo(t,e,n);else {const e=this.getAsString(i);void 0!==e&&this._styleProcessor.toNormalizedForm(i,e,t);}}Object.keys(t).length&&(wo(this._styles,t),this._cachedStyleNames=null,this._cachedExpandedStyleNames=null);}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]&&!ne(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=false){return this.isEmpty?[]:e?(this._cachedExpandedStyleNames||=this._styleProcessor.getStyleNames(this._styles),this._cachedExpandedStyleNames):(this._cachedStyleNames||=this.getStylesEntries().map(([e])=>e),this._cachedStyleNames)}keys(){return this.getStyleNames()}clear(){this._styles={},this._cachedStyleNames=null,this._cachedExpandedStyleNames=null;}isSimilar(e){if(this.size!==e.size)return  false;for(const t of this.getStyleNames())if(!e.has(t)||e.getAsString(t)!==this.getAsString(t))return  false;return  true}getStylesEntries(){const e=[],t=Object.keys(this._styles);for(const i of t)e.push(...this._styleProcessor.getReducedForm(i,this._styles));return e}_clone(){const e=new this.constructor(this._styleProcessor);return e.set(this.getNormalized()),e}_getTokensMatch(e,t){const i=[];for(const n of this.getStyleNames(true))if(ho(e,n)){if(true===t){i.push(n);continue}ho(t,this.getAsString(n))&&i.push(n);}return i.length?i:void 0}_getConsumables(e){const t=[];if(e){t.push(e);for(const i of this._styleProcessor.getRelatedStyles(e))t.push(i);}else for(const e of this.getStyleNames()){for(const i of this._styleProcessor.getRelatedStyles(e))t.push(i);t.push(e);}return t}_canMergeFrom(e){for(const t of e.getStyleNames())if(this.has(t)&&this.getAsString(t)!==e.getAsString(t))return  false;return  true}_mergeFrom(e){for(const t of e.getStyleNames())this.has(t)||this.set(t,e.getAsString(t));}_isMatching(e){for(const t of e.getStyleNames())if(!this.has(t)||this.getAsString(t)!==e.getAsString(t))return  false;return  true}}class fo{_normalizers;_extractors;_reducers;_consumables;constructor(){this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map;}toNormalizedForm(e,t,i){if(ne(t))bo(i,po(e),t);else if(this._normalizers.has(e)){const n=this._normalizers.get(e),{path:s,value:o}=n(t);bo(i,s,o);}else bo(i,e,t);}getNormalized(e,t){if(!e)return At({},t);if(void 0!==t[e])return t[e];if(this._extractors.has(e)){const i=this._extractors.get(e);if("string"==typeof i)return ie(t,i);const n=i(e,t);if(n)return n}return ie(t,po(e))}getReducedForm(e,t){const i=this.getNormalized(e,t);if(void 0===i)return [];if(this._reducers.has(e)){return this._reducers.get(e)(i)}return [[e,i]]}getStyleNames(e){const t=new Set;for(const i of this._consumables.keys()){const n=this.getNormalized(i,e);n&&("object"!=typeof n||Object.keys(n).length)&&t.add(i);}for(const i of Object.keys(e))t.add(i);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 i of t)this._mapStyleNames(i,[e]);}_mapStyleNames(e,t){this._consumables.has(e)||this._consumables.set(e,[]),this._consumables.get(e).push(...t);}}function po(e){return e.replace("-",".")}function bo(e,t,i){let n=i;ne(i)&&!Array.isArray(i)&&(n=At({},ie(e,t),i)),it(e,t,n);}function wo(e,t){for(const i of Object.keys(t))null===e[i]||Array.isArray(e[i])||"object"!=typeof e[i]||"object"!=typeof t[i]?delete e[i]:(wo(e[i],t[i]),Object.keys(e[i]).length||delete e[i]);}class vo{_set=new Set;get isEmpty(){return 0==this._set.size}get size(){return this._set.size}has(e){return this._set.has(e)}keys(){return Array.from(this._set.keys())}setTo(e){this.clear();for(const t of e.split(/\s+/))t&&this._set.add(t);return this}set(e){for(const t of pn(e))t&&this._set.add(t);}remove(e){for(const t of pn(e))this._set.delete(t);}clear(){this._set.clear();}toString(){return Array.from(this._set).join(" ")}isSimilar(e){if(this.size!==e.size)return  false;for(const t of this.keys())if(!e.has(t))return  false;return  true}_clone(){const e=new this.constructor;return e._set=new Set(this._set),e}_getTokensMatch(e){const t=[];if(true===e){for(const e of this._set.keys())t.push(e);return t}if("string"==typeof e){for(const i of e.split(/\s+/)){if(!this._set.has(i))return;t.push(i);}return t}for(const i of this._set.keys())i.match(e)&&t.push(i);return t.length?t:void 0}_getConsumables(e){return e?[e]:this.keys()}_canMergeFrom(){return  true}_mergeFrom(e){for(const t of e._set.keys())this._set.has(t)||this._set.add(t);}_isMatching(e){for(const t of e._set.keys())if(!this._set.has(t))return  false;return  true}}class _o extends no{name;_unsafeAttributesToRender=[];_attrs;_children;_customProperties=new Map;get _classes(){return this._attrs.get("class")}get _styles(){return this._attrs.get("style")}constructor(e,t,i,n){super(e),this.name=t,this._attrs=this._parseAttributes(i),this._children=[],n&&this._insertChild(0,n);}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&&(yield "class"),this._styles&&(yield "style");for(const e of this._attrs.keys())"class"!=e&&"style"!=e&&(yield e);}*getAttributes(){for(const[e,t]of this._attrs.entries())yield [e,String(t)];}getAttribute(e){return this._attrs.has(e)?String(this._attrs.get(e)):void 0}hasAttribute(e,t){return !!this._attrs.has(e)&&(void 0===t||(ko(this.name,e)||yo(this.name,e)?this._attrs.get(e).has(t):this._attrs.get(e)===t))}isSimilar(e){if(!(e instanceof _o))return  false;if(this===e)return  true;if(this.name!=e.name)return  false;if(this._attrs.size!==e._attrs.size)return  false;for(const[t,i]of this._attrs){const n=e._attrs.get(t);if(void 0===n)return  false;if("string"==typeof i||"string"==typeof n){if(n!==i)return  false}else if(!i.isSimilar(n))return  false}return  true}hasClass(...e){for(const t of e)if(!this._classes||!this._classes.has(t))return  false;return  true}getClassNames(){const e=this._classes?this._classes.keys():[],t=e[Symbol.iterator]();return Object.assign(e,{next:t.next.bind(t)})}getStyle(e){return this._styles&&this._styles.getAsString(e)}getNormalizedStyle(e){return this._styles&&this._styles.getNormalized(e)}getStyleNames(e){return this._styles?this._styles.getStyleNames(e):[]}hasStyle(...e){for(const t of e)if(!this._styles||!this._styles.has(t))return  false;return  true}findAncestor(...e){const t=new uo(...e);let i=this.parent;for(;i&&!i.is("documentFragment");){if(t.match(i))return i;i=i.parent;}return null}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries();}getIdentity(){const e=this._classes?this._classes.keys().sort().join(","):"",t=this._styles&&String(this._styles),i=Array.from(this._attrs).filter(([e])=>"style"!=e&&"class"!=e).map(e=>`${e[0]}="${e[1]}"`).sort().join(" ");return this.name+(""==e?"":` class="${e}"`)+(t?` style="${t}"`:"")+(""==i?"":` ${i}`)}shouldRenderUnsafeAttribute(e){return this._unsafeAttributesToRender.includes(e)}toJSON(){const e=super.toJSON();if(e.name=this.name,e.type="Element",this._attrs.size&&(e.attributes=Object.fromEntries(this.getAttributes())),this._children.length>0){e.children=[];for(const t of this._children)e.children.push(t.toJSON());}return e}_clone(e=false){const t=[];if(e)for(const i of this.getChildren())t.push(i._clone(e));const i=new this.constructor(this.document,this.name,this._attrs,t);return i._customProperties=new Map(this._customProperties),i.getFillerOffset=this.getFillerOffset,i._unsafeAttributesToRender=this._unsafeAttributesToRender,i}_appendChild(e){return this._insertChild(this.childCount,e)}_insertChild(e,t){this._fireChange("children",this,{index:e});let i=0;const n=function(e,t){if("string"==typeof t)return [new so(e,t)];ti(t)||(t=[t]);const i=[];for(const n of t)"string"==typeof n?i.push(new so(e,n)):n instanceof oo?i.push(new so(e,n.data)):i.push(n);return i}(this.document,t);for(const t of n)null!==t.parent&&t._remove(),t.parent=this,t.document=this.document,this._children.splice(e,0,t),e++,i++;return i}_removeChildren(e,t=1){this._fireChange("children",this,{index:e});for(let i=e;i<e+t;i++)this._children[i].parent=null;return this._children.splice(e,t)}_setAttribute(e,t,i=true){if(this._fireChange("attributes",this),ko(this.name,e)||yo(this.name,e)){let n=this._attrs.get(e);n||(n=ko(this.name,e)?new go(this.document.stylesProcessor):new vo,this._attrs.set(e,n)),i?n.setTo(String(t)):ko(this.name,e)?Array.isArray(t)?n.set(t[0],t[1]):n.set(t):n.set("string"==typeof t?t.split(/\s+/):t);}else this._attrs.set(e,String(t));}_removeAttribute(e,t){if(this._fireChange("attributes",this),void 0!==t&&(ko(this.name,e)||yo(this.name,e))){const i=this._attrs.get(e);return !!i&&(yo(this.name,e)&&"string"==typeof t&&(t=t.split(/\s+/)),i.remove(t),!!i.isEmpty&&this._attrs.delete(e))}return this._attrs.delete(e)}_addClass(e){this._setAttribute("class",e,false);}_removeClass(e){this._removeAttribute("class",e);}_setStyle(e,t){"string"!=typeof e?this._setAttribute("style",e,false):this._setAttribute("style",[e,t],false);}_removeStyle(e){this._removeAttribute("style",e);}_collectAttributesMatch(e,t,i){for(const[n,s,o]of e){let e=false,r=false;for(const[a,l]of this._attrs)if(!(i&&i.includes(a)||!ho(n,a)))if(e=true,"string"==typeof l){if(ho(s,l))t.push([a]),r=true;else if(!(n instanceof RegExp))return  false}else {const e=l._getTokensMatch(s,o||true);if(e){r=true;for(const i of e)t.push([a,i]);}else if(!(n instanceof RegExp))return  false}if(!e||!r)return  false}return  true}_getConsumables(e,t){const i=[];if(e){const n=this._attrs.get(e);if(void 0!==n)if("string"==typeof n)i.push([e]);else for(const s of n._getConsumables(t))i.push([e,s]);}else for(const[e,t]of this._attrs)if("string"==typeof t)i.push([e]);else for(const n of t._getConsumables())i.push([e,n]);return {name:!e,attributes:i}}_canMergeAttributesFrom(e){if(this.name!=e.name)return  false;for(const[t,i]of e._attrs){const e=this._attrs.get(t);if(void 0!==e)if("string"==typeof e||"string"==typeof i){if(e!==i)return  false}else if(!e._canMergeFrom(i))return  false}return  true}_mergeAttributesFrom(e){this._fireChange("attributes",this);for(const[t,i]of e._attrs){const e=this._attrs.get(t);void 0===e||"string"==typeof e||"string"==typeof i?this._setAttribute(t,i):e._mergeFrom(i);}}_canSubtractAttributesOf(e){if(this.name!=e.name)return  false;for(const[t,i]of e._attrs){const e=this._attrs.get(t);if(void 0===e)return  false;if("string"==typeof e||"string"==typeof i){if(e!==i)return  false}else if(!e._isMatching(i))return  false}return  true}_subtractAttributesOf(e){this._fireChange("attributes",this);for(const[t,i]of e._attrs){const e=this._attrs.get(t);"string"==typeof e||"string"==typeof i?this._attrs.delete(t):(e.remove(i.keys()),e.isEmpty&&this._attrs.delete(t));}}_setCustomProperty(e,t){this._customProperties.set(e,t);}_removeCustomProperty(e){return this._customProperties.delete(e)}_parseAttributes(e){const t=Vn(e);for(const[e,i]of t)if(null===i)t.delete(e);else if(ko(this.name,e)){const n=i instanceof go?i._clone():new go(this.document.stylesProcessor).setTo(String(i));t.set(e,n);}else if(yo(this.name,e)){const n=i instanceof vo?i._clone():(new vo).setTo(String(i));t.set(e,n);}else "string"!=typeof i&&t.set(e,String(i));return t}}function yo(e,t){return "class"==t||"a"==e&&"rel"==t}function ko(e,t){return "style"==t}_o.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 Co extends _o{constructor(e,t,i,n){super(e,t,i,n),this.getFillerOffset=xo;}toJSON(){const e=super.toJSON();return e.type="ContainerElement",e}}function xo(){const e=[...this.getChildren()],t=e[this.childCount-1];if(t&&t.is("element","br"))return this.childCount;for(const t of e)if(!t.is("uiElement"))return null;return this.childCount}Co.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 Ao extends($t(Co)){constructor(e,t,i,n){super(e,t,i,n),this.set("isReadOnly",false),this.set("isFocused",false),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();}toJSON(){const e=super.toJSON();return e.type="EditableElement",e.isReadOnly=this.isReadOnly,e.isFocused=this.isFocused,e}}Ao.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 Eo=Symbol("rootName");class To extends Ao{constructor(e,t){super(e,t),this.rootName="main";}get rootName(){return this.getCustomProperty(Eo)}set rootName(e){this._setCustomProperty(Eo,e);}toJSON(){return this.rootName}set _name(e){this.name=e;}}To.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};class So{direction;boundaries;singleCharacters;shallow;ignoreElementEnd;_position;_boundaryStartParent;_boundaryEndParent;constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new I("view-tree-walker-no-start-position",null);if(e.direction&&"forward"!=e.direction&&"backward"!=e.direction)throw new I("view-tree-walker-unknown-direction",e.startPosition,{direction:e.direction});this.boundaries=e.boundaries||null,e.startPosition?this._position=Io._createAt(e.startPosition):this._position=Io._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,i;do{i=this.position,t=this.next();}while(!t.done&&e(t.value));t.done||(this._position=i);}jumpTo(e){this._boundaryStartParent&&e.isBefore(this.boundaries.start)?e=this.boundaries.start:this._boundaryEndParent&&e.isAfter(this.boundaries.end)&&(e=this.boundaries.end),this._position=e.clone();}next(){return "forward"==this.direction?this._next():this._previous()}_next(){let e=this.position.clone();const t=this.position,i=e.parent;if(null===i.parent&&e.offset===i.childCount)return {done:true,value:void 0};if(i===this._boundaryEndParent&&e.offset==this.boundaries.end.offset)return {done:true,value:void 0};let n;if(i&&i.is("view:$text")){if(e.isAtEnd)return this._position=Io._createAfter(i),this._next();n=i.data[e.offset];}else n=i.getChild(e.offset);if("string"==typeof n){let n;if(this.singleCharacters)n=1;else {n=(i===this._boundaryEndParent?this.boundaries.end.offset:i.data.length)-e.offset;}const s=new oo(i,e.offset,n);return e.offset+=n,this._position=e,this._formatReturnValue("text",s,t,e,n)}if(n&&n.is("view:element")){if(this.shallow){if(this.boundaries&&this.boundaries.end.isBefore(e))return {done:true,value:void 0};e.offset++;}else e=new Io(n,0);return this._position=e,this._formatReturnValue("elementStart",n,t,e,1)}if(n&&n.is("view:$text")){if(this.singleCharacters)return e=new Io(n,0),this._position=e,this._next();let i,s=n.data.length;return n==this._boundaryEndParent?(s=this.boundaries.end.offset,i=new oo(n,0,s),e=Io._createAfter(i)):(i=new oo(n,0,n.data.length),e.offset++),this._position=e,this._formatReturnValue("text",i,t,e,s)}return e=Io._createAfter(i),this._position=e,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",i,t,e)}_previous(){let e=this.position.clone();const t=this.position,i=e.parent;if(null===i.parent&&0===e.offset)return {done:true,value:void 0};if(i==this._boundaryStartParent&&e.offset==this.boundaries.start.offset)return {done:true,value:void 0};let n;if(i.is("view:$text")){if(e.isAtStart)return this._position=Io._createBefore(i),this._previous();n=i.data[e.offset-1];}else n=i.getChild(e.offset-1);if("string"==typeof n){let n;if(this.singleCharacters)n=1;else {const t=i===this._boundaryStartParent?this.boundaries.start.offset:0;n=e.offset-t;}e.offset-=n;const s=new oo(i,e.offset,n);return this._position=e,this._formatReturnValue("text",s,t,e,n)}if(n&&n.is("view:element"))return this.shallow?(e.offset--,this._position=e,this._formatReturnValue("elementStart",n,t,e,1)):(e=new Io(n,n.childCount),this._position=e,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",n,t,e));if(n&&n.is("view:$text")){if(this.singleCharacters)return e=new Io(n,n.data.length),this._position=e,this._previous();let i,s=n.data.length;if(n==this._boundaryStartParent){const t=this.boundaries.start.offset;i=new oo(n,t,n.data.length-t),s=i.data.length,e=Io._createBefore(i);}else i=new oo(n,0,n.data.length),e.offset--;return this._position=e,this._formatReturnValue("text",i,t,e,s)}return e=Io._createBefore(i),this._position=e,this._formatReturnValue("elementStart",i,t,e,1)}_formatReturnValue(e,t,i,n,s){return t.is("view:$textProxy")&&(t.offsetInText+t.data.length==t.textNode.data.length&&("forward"!=this.direction||this.boundaries&&this.boundaries.end.isEqual(this.position)?i=Io._createAfter(t.textNode):(n=Io._createAfter(t.textNode),this._position=n)),0===t.offsetInText&&("backward"!=this.direction||this.boundaries&&this.boundaries.start.isEqual(this.position)?i=Io._createBefore(t.textNode):(n=Io._createBefore(t.textNode),this._position=n))),{done:false,value:{type:e,item:t,previousPosition:i,nextPosition:n,length:s}}}}class Io extends io{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 Ao);){if(!e.parent)return null;e=e.parent;}return e}getShiftedBy(e){const t=Io._createAt(this),i=t.offset+e;return t.offset=i<0?0:i,t}getLastMatchingPosition(e,t={}){t.startPosition=this;const i=new So(t);return i.skip(e),i.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:true})}getCommonAncestor(e){const t=this.getAncestors(),i=e.getAncestors();let n=0;for(;t[n]==i[n]&&t[n];)n++;return 0===n?null:t[n-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():[],i=e.parent.is("node")?e.parent.getPath():[];t.push(this.offset),i.push(e.offset);const n=ei(t,i);switch(n){case "prefix":return "before";case "extension":return "after";default:return t[n]<i[n]?"before":"after"}}getWalker(e={}){return e.startPosition=this,new So(e)}clone(){return new Io(this.parent,this.offset)}toJSON(){return {parent:this.parent.toJSON(),offset:this.offset}}static _createAt(e,t){if(e instanceof Io)return new this(e.parent,e.offset);{const i=e;if("end"==t)t=i.is("$text")?i.data.length:i.childCount;else {if("before"==t)return this._createBefore(i);if("after"==t)return this._createAfter(i);if(0!==t&&!t)throw new I("view-createpositionat-offset-required",i)}return new Io(i,t)}}static _createAfter(e){if(e.is("$textProxy"))return new Io(e.textNode,e.offsetInText+e.data.length);if(!e.parent)throw new I("view-position-after-root",e,{root:e});return new Io(e.parent,e.index+1)}static _createBefore(e){if(e.is("$textProxy"))return new Io(e.textNode,e.offsetInText);if(!e.parent)throw new I("view-position-before-root",e,{root:e});return new Io(e.parent,e.index)}}Io.prototype.is=function(e){return "position"===e||"view:position"===e};class Po extends io{start;end;constructor(e,t=null){super(),this.start=e.clone(),this.end=t?t.clone():e.clone();}*[Symbol.iterator](){yield*new So({boundaries:this,ignoreElementEnd:true});}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return this.start.parent===this.end.parent}get root(){return this.start.root}getEnlarged(){let e=this.start.getLastMatchingPosition(Vo,{direction:"backward"}),t=this.end.getLastMatchingPosition(Vo);return e.parent.is("$text")&&e.isAtStart&&(e=Io._createBefore(e.parent)),t.parent.is("$text")&&t.isAtEnd&&(t=Io._createAfter(t.parent)),new Po(e,t)}getTrimmed(){let e=this.start.getLastMatchingPosition(Vo);if(e.isAfter(this.end)||e.isEqual(this.end))return new Po(e,e);let t=this.end.getLastMatchingPosition(Vo,{direction:"backward"});const i=e.nodeAfter,n=t.nodeBefore;return i&&i.is("$text")&&(e=new Io(i,0)),n&&n.is("$text")&&(t=new Io(n,n.data.length)),new Po(e,t)}isEqual(e){return this==e||this.start.isEqual(e.start)&&this.end.isEqual(e.end)}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=false){e.isCollapsed&&(t=false);const i=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),n=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return i&&n}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new Po(this.start,e.start)),this.containsPosition(e.end)&&t.push(new Po(e.end,this.end))):t.push(this.clone()),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,i=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(i=e.end),new Po(t,i)}return null}getWalker(e={}){return e.boundaries=this,new So(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 Po(this.start,this.end)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=true;const t=new So(e);for(const e of t)yield e.item;}*getPositions(e={}){e.boundaries=this;const t=new So(e);yield t.position;for(const e of t)yield e.nextPosition;}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}toJSON(){return {start:this.start.toJSON(),end:this.end.toJSON()}}static _createFromParentsAndOffsets(e,t,i,n){return new this(new Io(e,t),new Io(i,n))}static _createFromPositionAndShift(e,t){const i=e,n=e.getShiftedBy(t);return t>0?new this(i,n):new this(n,i)}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(Io._createBefore(e),t)}}function Vo(e){return !(!e.item.is("attributeElement")&&!e.item.is("uiElement"))}Po.prototype.is=function(e){return "range"===e||"view:range"===e};class Ro extends(z(io)){_ranges;_lastRangeBackward;_isFake;_fakeSelectionLabel;constructor(...e){super(),this._ranges=[],this._lastRangeBackward=false,this._isFake=false,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  false;if(this.isFake&&this.fakeSelectionLabel!=e.fakeSelectionLabel)return  false;if(this.rangeCount!=e.rangeCount)return  false;if(0===this.rangeCount)return  true;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return  false;for(const t of this._ranges){let i=false;for(const n of e._ranges)if(t.isEqual(n)){i=true;break}if(!i)return  false}return  true}isSimilar(e){if(this.isBackward!=e.isBackward)return  false;const t=Xt(this.getRanges());if(t!=Xt(e.getRanges()))return  false;if(0==t)return  true;for(let t of this.getRanges()){t=t.getTrimmed();let i=false;for(let n of e.getRanges())if(n=n.getTrimmed(),t.start.isEqual(n.start)&&t.end.isEqual(n.end)){i=true;break}if(!i)return  false}return  true}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}setTo(...e){let[t,i,n]=e;if("object"==typeof i&&(n=i,i=void 0),null===t)this._setRanges([]),this._setFakeOptions(n);else if(t instanceof Ro||t instanceof Oo)this._setRanges(t.getRanges(),t.isBackward),this._setFakeOptions({fake:t.isFake,label:t.fakeSelectionLabel});else if(t instanceof Po)this._setRanges([t],n&&n.backward),this._setFakeOptions(n);else if(t instanceof Io)this._setRanges([new Po(t)]),this._setFakeOptions(n);else if(t instanceof no){const e=!!n&&!!n.backward;let s;if(void 0===i)throw new I("view-selection-setto-required-second-parameter",this);s="in"==i?Po._createIn(t):"on"==i?Po._createOn(t):new Po(Io._createAt(t,i)),this._setRanges([s],e),this._setFakeOptions(n);}else {if(!ti(t))throw new I("view-selection-setto-not-selectable",this);this._setRanges(t,n&&n.backward),this._setFakeOptions(n);}this.fire("change");}setFocus(e,t){if(null===this.anchor)throw new I("view-selection-setfocus-no-ranges",this);const i=Io._createAt(e,t);if("same"==i.compareWith(this.focus))return;const n=this.anchor;this._ranges.pop(),"before"==i.compareWith(n)?this._addRange(new Po(i,n),true):this._addRange(new Po(n,i)),this.fire("change");}toJSON(){const e={ranges:Array.from(this.getRanges()).map(e=>e.toJSON())};return this.isBackward&&(e.isBackward=true),this.isFake&&(e.isFake=true),e}_setRanges(e,t=false){e=Array.from(e),this._ranges=[];for(const t of e)this._addRange(t);this._lastRangeBackward=!!t;}_setFakeOptions(e={}){this._isFake=!!e.fake,this._fakeSelectionLabel=e.fake&&e.label||"";}_addRange(e,t=false){if(!(e instanceof Po))throw new I("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 I("view-selection-range-intersects",this,{addedRange:e,intersectingRange:t});this._ranges.push(new Po(e.start,e.end));}}Ro.prototype.is=function(e){return "selection"===e||"view:selection"===e};class Oo extends(z(io)){_selection;constructor(...e){super(),this._selection=new Ro,this._selection.delegate("change").to(this),e.length&&this._selection.setTo(...e);}get isFake(){return this._selection.isFake}get fakeSelectionLabel(){return this._selection.fakeSelectionLabel}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get isCollapsed(){return this._selection.isCollapsed}get rangeCount(){return this._selection.rangeCount}get isBackward(){return this._selection.isBackward}get editableElement(){return this._selection.editableElement}get _ranges(){return this._selection._ranges}*getRanges(){yield*this._selection.getRanges();}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getSelectedElement(){return this._selection.getSelectedElement()}isEqual(e){return this._selection.isEqual(e)}isSimilar(e){return this._selection.isSimilar(e)}toJSON(){return this._selection.toJSON()}_setTo(...e){this._selection.setTo(...e);}_setFocus(e,t){this._selection.setFocus(e,t);}}Oo.prototype.is=function(e){return "selection"===e||"documentSelection"==e||"view:selection"==e||"view:documentSelection"==e};class Bo extends C{startRange;_eventPhase;_currentTarget;constructor(e,t,i){super(e,t),this.startRange=i,this._eventPhase="none",this._currentTarget=null;}get eventPhase(){return this._eventPhase}get currentTarget(){return this._currentTarget}}const Lo=Symbol("bubblingEmitter"),Mo=Symbol("bubblingCallbacks"),Fo=Symbol("bubblingContexts");function No(e){return class extends e{fire(e,...t){try{const i=e instanceof C?e:new C(this,e),n=Ho(this),s=Uo(this);if(Do(i,"capturing",this),zo(n,"$capture",i,...t))return i.return;const o=i.startRange||this.selection.getFirstRange(),r=o?o.getContainedElement():null,a=!!r&&function(e,t){for(const i of e)if(i(t))return !0;return !1}(s,r);let l=r||function(e){if(!e)return null;const t=e.start.parent,i=e.end.parent,n=t.getPath(),s=i.getPath();return n.length>s.length?t:i}(o);if(Do(i,"atTarget",l),!a){if(zo(n,"$text",i,...t))return i.return;Do(i,"bubbling",l);}for(;l;){if(l.is("element")&&zo(n,l,i,...t))return i.return;l=l.parent,Do(i,"bubbling",l);}return Do(i,"bubbling",this),zo(n,"$document",i,...t),i.return}catch(e){I.rethrowUnexpectedError(e,this);}}_addEventListener(e,t,i){const n=pn(i.context||"$document"),s=Ho(this),o=qo(this);for(const e of n)"function"==typeof e&&Uo(this).add(e);const r=function(e,t,i){return function(n,s){const{currentTarget:o,eventArgs:r}=s;if("string"!=typeof o){if(o.is("rootElement")&&t.includes("$root"))i.call(e,n,...r);else if(t.includes(o.name))i.call(e,n,...r);else for(const s of t)if("function"==typeof s&&s(o))return void i.call(e,n,...r)}else t.includes(o)&&i.call(e,n,...r);}}(this,n,t);o.set(t,r),this.listenTo(s,e,r,i);}_removeEventListener(e,t){const i=Ho(this),n=qo(this),s=n.get(t);s&&(n.delete(t),this.stopListening(i,e,s));}}}function Do(e,t,i){e instanceof Bo&&(e._eventPhase=t,e._currentTarget=i);}function zo(e,t,i,...n){return e.fire(i,{currentTarget:t,eventArgs:n}),!!i.stop.called}function Ho(e){return e[Lo]||(e[Lo]=new(z())),e[Lo]}function qo(e){return e[Mo]||(e[Mo]=new Map),e[Mo]}function Uo(e){return e[Fo]||(e[Fo]=new Set),e[Fo]}class jo extends(No($t())){selection;roots;stylesProcessor;_postFixers=new Set;constructor(e){super(),this.selection=new Oo,this.roots=new kn({idProperty:"rootName"}),this.stylesProcessor=e,this.set("isReadOnly",false),this.set("isFocused",false),this.set("isSelecting",false),this.set("isComposing",false);}getRoot(e="main"){return this.roots.get(e)}registerPostFixer(e){this._postFixers.add(e);}destroy(){this.roots.forEach(e=>e.destroy()),this.stopListening();}_callPostFixers(e){let t=false;do{for(const i of this._postFixers)if(t=i(e),t)break}while(t)}}class $o extends _o{static DEFAULT_PRIORITY=10;_priority=10;_id=null;_clonesGroup=null;constructor(e,t,i,n){super(e,t,i,n),this.getFillerOffset=Wo;}get priority(){return this._priority}get id(){return this._id}getElementsWithSameId(){if(null===this.id)throw new I("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}toJSON(){const e=super.toJSON();return e.type="AttributeElement",e}_clone(e=false){const t=super._clone(e);return t._priority=this._priority,t._id=this._id,t}_canMergeAttributesFrom(e){return null===this.id&&null===e.id&&this.priority===e.priority&&super._canMergeAttributesFrom(e)}_canSubtractAttributesOf(e){return null===this.id&&null===e.id&&this.priority===e.priority&&super._canSubtractAttributesOf(e)}}function Wo(){if(Go(this))return null;let e=this.parent;for(;e&&e.is("attributeElement");){if(Go(e)>1)return null;e=e.parent;}return !e||Go(e)>1?null:this.childCount}function Go(e){return Array.from(e.getChildren()).filter(e=>!e.is("uiElement")).length}$o.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 Ko extends _o{constructor(e,t,i,n){super(e,t,i,n),this.getFillerOffset=Jo;}toJSON(){const e=super.toJSON();return e.type="EmptyElement",e}_insertChild(e,t){if(t&&(t instanceof no||Array.from(t).length>0))throw new I("view-emptyelement-cannot-add",[this,t]);return 0}}function Jo(){return null}Ko.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 Qo extends _o{constructor(e,t,i,n){super(e,t,i,n),this.getFillerOffset=Zo;}_insertChild(e,t){if(t&&(t instanceof no||Array.from(t).length>0))throw new I("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 e of this.getAttributeKeys())t.setAttribute(e,this.getAttribute(e));return t}toJSON(){const e=super.toJSON();return e.type="UIElement",e}}function Yo(e){e.document.on("arrowKey",(t,i)=>function(e,t,i){if(t.keyCode==on.arrowright){const e=t.domTarget.ownerDocument.defaultView.getSelection(),n=1==e.rangeCount&&e.getRangeAt(0).collapsed;if(n||t.shiftKey){const t=e.focusNode,s=e.focusOffset,o=i.domPositionToView(t,s);if(null===o)return;let r=false;const a=o.getLastMatchingPosition(e=>(e.item.is("uiElement")&&(r=true),!(!e.item.is("uiElement")&&!e.item.is("attributeElement"))));if(r){const t=i.viewPositionToDom(a);n?e.collapse(t.parent,t.offset):e.extend(t.parent,t.offset);}}}}(0,i,e.domConverter),{priority:"low"});}function Zo(){return null}Qo.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 Xo extends _o{constructor(e,t,i,n){super(e,t,i,n),this.getFillerOffset=er;}toJSON(){const e=super.toJSON();return e.type="RawElement",e}_insertChild(e,t){if(t&&(t instanceof no||Array.from(t).length>0))throw new I("view-rawelement-cannot-add",[this,t]);return 0}render(e,t){}}function er(){return null}Xo.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};class tr extends(z(io)){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();}toJSON(){const e=[];for(const t of this._children)e.push(t.toJSON());return e}_appendChild(e){return this._insertChild(this.childCount,e)}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}_insertChild(e,t){this._fireChange("children",this,{index:e});let i=0;const n=function(e,t){if("string"==typeof t)return [new so(e,t)];ti(t)||(t=[t]);return Array.from(t).map(t=>"string"==typeof t?new so(e,t):t instanceof oo?new so(e,t.data):t)}(this.document,t);for(const t of n)null!==t.parent&&t._remove(),t.parent=this,this._children.splice(e,0,t),e++,i++;return i}_removeChildren(e,t=1){this._fireChange("children",this,{index:e});for(let i=e;i<e+t;i++)this._children[i].parent=null;return this._children.splice(e,t)}_fireChange(e,t,i){this.fire(`change:${e}`,t,i);}_setCustomProperty(e,t){this._customProperties.set(e,t);}_removeCustomProperty(e){return this._customProperties.delete(e)}}tr.prototype.is=function(e){return "documentFragment"===e||"view:documentFragment"===e};class ir{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 tr(this.document,e)}createText(e){return new so(this.document,e)}createAttributeElement(e,t,i={}){const n=new $o(this.document,e,t);return "number"==typeof i.priority&&(n._priority=i.priority),i.id&&(n._id=i.id),i.renderUnsafeAttributes&&n._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),n}createContainerElement(e,t,i={},n={}){let s;!function(e){return yt(e)}(i)?s=i:n=i;const o=new Co(this.document,e,t,s);return n.renderUnsafeAttributes&&o._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),o}createEditableElement(e,t,i={}){const n=new Ao(this.document,e,t);return i.renderUnsafeAttributes&&n._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),n}createEmptyElement(e,t,i={}){const n=new Ko(this.document,e,t);return i.renderUnsafeAttributes&&n._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),n}createUIElement(e,t,i){const n=new Qo(this.document,e,t);return i&&(n.render=i),n}createRawElement(e,t,i,n={}){const s=new Xo(this.document,e,t);return i&&(s.render=i),n.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),s}setAttribute(e,t,i,n){ void 0!==n?n._setAttribute(e,t,i):i._setAttribute(e,t);}removeAttribute(e,t,i){ void 0!==i?i._removeAttribute(e,t):t._removeAttribute(e);}addClass(e,t){t._addClass(e);}removeClass(e,t){t._removeClass(e);}setStyle(e,t,i){yt(e)&&void 0===i?t._setStyle(e):i._setStyle(e,t);}removeStyle(e,t){t._removeStyle(e);}setCustomProperty(e,t,i){i._setCustomProperty(e,t);}removeCustomProperty(e,t){return t._removeCustomProperty(e)}breakAttributes(e){return e instanceof Io?this._breakAttributes(e):this._breakAttributesRange(e)}breakContainer(e){const t=e.parent;if(!t.is("containerElement"))throw new I("view-writer-break-non-container-element",this.document);if(!t.parent)throw new I("view-writer-break-root",this.document);if(e.isAtStart)return Io._createBefore(t);if(!e.isAtEnd){const i=t._clone(false);this.insert(Io._createAfter(t),i);const n=new Po(e,Io._createAt(t,"end")),s=new Io(i,0);this.move(n,s);}return Io._createAfter(t)}mergeAttributes(e){const t=e.offset,i=e.parent;if(i.is("$text"))return e;if(i.is("attributeElement")&&0===i.childCount){const e=i.parent,t=i.index;return i._remove(),this._removeFromClonedElementsGroup(i),this.mergeAttributes(new Io(e,t))}const n=i.getChild(t-1),s=i.getChild(t);if(!n||!s)return e;if(n.is("$text")&&s.is("$text"))return ar(n,s);if(n.is("attributeElement")&&s.is("attributeElement")&&n.isSimilar(s)){const e=n.childCount;return n._appendChild(s.getChildren()),s._remove(),this._removeFromClonedElementsGroup(s),this.mergeAttributes(new Io(n,e))}return e}mergeContainers(e){const t=e.nodeBefore,i=e.nodeAfter;if(!(t&&i&&t.is("containerElement")&&i.is("containerElement")))throw new I("view-writer-merge-containers-invalid-position",this.document);const n=t.getChild(t.childCount-1),s=n instanceof so?Io._createAt(n,"end"):Io._createAt(t,"end");return this.move(Po._createIn(i),Io._createAt(t,"end")),this.remove(Po._createOn(i)),s}insert(e,t){cr(t=ti(t)?[...t]:[t],this.document);const i=t.reduce((e,t)=>{const i=e[e.length-1],n=!t.is("uiElement");return i&&i.breakAttributes==n?i.nodes.push(t):e.push({breakAttributes:n,nodes:[t]}),e},[]);let n=null,s=e;for(const{nodes:e,breakAttributes:t}of i){const i=this._insertNodes(s,e,t);n||(n=i.start),s=i.end;}return n?new Po(n,s):new Po(e)}remove(e){const t=e instanceof Po?e:Po._createOn(e);if(dr(t,this.document),t.isCollapsed)return new tr(this.document);const{start:i,end:n}=this._breakAttributesRange(t,true),s=i.parent,o=n.offset-i.offset,r=s._removeChildren(i.offset,o);for(const e of r)this._removeFromClonedElementsGroup(e);const a=this.mergeAttributes(i);return t.start=a,t.end=a.clone(),new tr(this.document,r)}clear(e,t){dr(e,this.document);const i=e.getWalker({direction:"backward",ignoreElementEnd:true});for(const n of i){const i=n.item;let s;if(i.is("element")&&t.isSimilar(i))s=Po._createOn(i);else if(!n.nextPosition.isAfter(e.start)&&i.is("$textProxy")){const e=i.getAncestors().find(e=>e.is("element")&&t.isSimilar(e));e&&(s=Po._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 i;if(t.isAfter(e.end)){const n=(t=this._breakAttributes(t,true)).parent,s=n.childCount;e=this._breakAttributesRange(e,true),i=this.remove(e),t.offset+=n.childCount-s;}else i=this.remove(e);return this.insert(t,i)}wrap(e,t){if(!(t instanceof $o))throw new I("view-writer-wrap-invalid-attribute",this.document);if(dr(e,this.document),e.isCollapsed){let n=e.start;n.parent.is("element")&&(i=n.parent,!Array.from(i.getChildren()).some(e=>!e.is("uiElement")))&&(n=n.getLastMatchingPosition(e=>e.item.is("uiElement"))),n=this._wrapPosition(n,t);const s=this.document.selection;return s.isCollapsed&&s.getFirstPosition().isEqual(e.start)&&this.setSelection(n),new Po(n)}return this._wrapRange(e,t);var i;}unwrap(e,t){if(!(t instanceof $o))throw new I("view-writer-unwrap-invalid-attribute",this.document);if(dr(e,this.document),e.isCollapsed)return e;const{start:i,end:n}=this._breakAttributesRange(e,true),s=i.parent,o=this._unwrapChildren(s,i.offset,n.offset,t),r=this.mergeAttributes(o.start);r.isEqual(o.start)||o.end.offset--;const a=this.mergeAttributes(o.end);return new Po(r,a)}rename(e,t){const i=new Co(this.document,e,t.getAttributes());return this.insert(Io._createAfter(t),i),this.move(Po._createIn(t),Io._createAt(i,0)),this.remove(Po._createOn(t)),i}clearClonedElementsGroup(e){this._cloneGroups.delete(e);}createPositionAt(e,t){return Io._createAt(e,t)}createPositionAfter(e){return Io._createAfter(e)}createPositionBefore(e){return Io._createBefore(e)}createRange(e,t){return new Po(e,t)}createRangeOn(e){return Po._createOn(e)}createRangeIn(e){return Po._createIn(e)}createSelection(...e){return new Ro(...e)}createSlot(e="children"){if(!this._slotFactory)throw new I("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,i){let n,s;if(n=i?nr(e):e.parent.is("$text")?e.parent.parent:e.parent,!n)throw new I("view-writer-invalid-position-container",this.document);s=i?this._breakAttributes(e,true):e.parent.is("$text")?rr(e):e;const o=n._insertChild(s.offset,t);for(const e of t)this._addToClonedElementsGroup(e);const r=s.getShiftedBy(o),a=this.mergeAttributes(s);a.isEqual(s)||r.offset--;const l=this.mergeAttributes(r);return new Po(a,l)}_wrapChildren(e,t,i,n){let s=t;const o=[];for(;s<i;){const t=e.getChild(s),i=t.is("$text"),r=t.is("attributeElement");if(r&&t._canMergeAttributesFrom(n))t._mergeAttributesFrom(n),o.push(new Io(e,s));else if(i||!r||sr(n,t)){const i=n._clone();t._remove(),i._appendChild(t),e._insertChild(s,i),this._addToClonedElementsGroup(i),o.push(new Io(e,s));}else this._wrapChildren(t,0,t.childCount,n);s++;}let r=0;for(const e of o){if(e.offset-=r,e.offset==t)continue;this.mergeAttributes(e).isEqual(e)||(r++,i--);}return Po._createFromParentsAndOffsets(e,t,e,i)}_unwrapChildren(e,t,i,n){let s=t;const o=[];for(;s<i;){const t=e.getChild(s);if(t.is("attributeElement")){if(t.isSimilar(n)){const n=t.getChildren(),r=t.childCount;t._remove(),e._insertChild(s,n),this._removeFromClonedElementsGroup(t),o.push(new Io(e,s),new Io(e,s+r)),s+=r,i+=r-1;continue}t._canSubtractAttributesOf(n)?(t._subtractAttributesOf(n),o.push(new Io(e,s),new Io(e,s+1)),s++):(this._unwrapChildren(t,0,t.childCount,n),s++);}else s++;}let r=0;for(const e of o){if(e.offset-=r,e.offset==t||e.offset==i)continue;this.mergeAttributes(e).isEqual(e)||(r++,i--);}return Po._createFromParentsAndOffsets(e,t,e,i)}_wrapRange(e,t){const{start:i,end:n}=this._breakAttributesRange(e,true),s=i.parent,o=this._wrapChildren(s,i.offset,n.offset,t),r=this.mergeAttributes(o.start);r.isEqual(o.start)||o.end.offset--;const a=this.mergeAttributes(o.end);return new Po(r,a)}_wrapPosition(e,t){if(t.isSimilar(e.parent))return or(e.clone());e.parent.is("$text")&&(e=rr(e));const i=this.createAttributeElement("_wrapPosition-fake-element");i._priority=Number.POSITIVE_INFINITY,i.isSimilar=()=>false,e.parent._insertChild(e.offset,i);const n=new Po(e,e.getShiftedBy(1));this.wrap(n,t);const s=new Io(i.parent,i.index);i._remove();const o=s.nodeBefore,r=s.nodeAfter;return o&&o.is("view:$text")&&r&&r.is("view:$text")?ar(o,r):or(s)}_breakAttributesRange(e,t=false){const i=e.start,n=e.end;if(dr(e,this.document),e.isCollapsed){const i=this._breakAttributes(e.start,t);return new Po(i,i)}const s=this._breakAttributes(n,t),o=s.parent.childCount,r=this._breakAttributes(i,t);return s.offset+=s.parent.childCount-o,new Po(r,s)}_breakAttributes(e,t=false){const i=e.offset,n=e.parent;if(e.parent.is("emptyElement"))throw new I("view-writer-cannot-break-empty-element",this.document);if(e.parent.is("uiElement"))throw new I("view-writer-cannot-break-ui-element",this.document);if(e.parent.is("rawElement"))throw new I("view-writer-cannot-break-raw-element",this.document);if(!t&&n.is("$text")&&ur(n.parent))return e.clone();if(ur(n))return e.clone();if(n.is("$text"))return this._breakAttributes(rr(e),t);if(i==n.childCount){const e=new Io(n.parent,n.index+1);return this._breakAttributes(e,t)}if(0===i){const e=new Io(n.parent,n.index);return this._breakAttributes(e,t)}{const e=n.index+1,s=n._clone();n.parent._insertChild(e,s),this._addToClonedElementsGroup(s);const o=n.childCount-i,r=n._removeChildren(i,o);s._appendChild(r);const a=new Io(n.parent,e);return this._breakAttributes(a,t)}}_addToClonedElementsGroup(e){if(!e.root.is("rootElement"))return;if(e.is("element"))for(const t of e.getChildren())this._addToClonedElementsGroup(t);const t=e.id;if(!t)return;let i=this._cloneGroups.get(t);i||(i=new Set,this._cloneGroups.set(t,i)),i.add(e),e._clonesGroup=i;}_removeFromClonedElementsGroup(e){if(e.is("element"))for(const t of e.getChildren())this._removeFromClonedElementsGroup(t);const t=e.id;if(!t)return;const i=this._cloneGroups.get(t);i&&i.delete(e);}}function nr(e){let t=e.parent;for(;!ur(t);){if(!t)return;t=t.parent;}return t}function sr(e,t){return e.priority<t.priority||!(e.priority>t.priority)&&e.getIdentity()<t.getIdentity()}function or(e){const t=e.nodeBefore;if(t&&t.is("$text"))return new Io(t,t.data.length);const i=e.nodeAfter;return i&&i.is("$text")?new Io(i,0):e}function rr(e){if(e.offset==e.parent.data.length)return new Io(e.parent.parent,e.parent.index+1);if(0===e.offset)return new Io(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 so(e.root.document,t)),new Io(e.parent.parent,e.parent.index+1)}function ar(e,t){const i=e.data.length;return e._data+=t.data,t._remove(),new Io(e,i)}const lr=[so,$o,Co,Ko,Xo,Qo];function cr(e,t){for(const i of e){if(!lr.some(e=>i instanceof e))throw new I("view-writer-insert-invalid-node-type",t);i.is("$text")||cr(i.getChildren(),t);}}function ur(e){return e&&(e.is("containerElement")||e.is("documentFragment"))}function dr(e,t){const i=nr(e.start),n=nr(e.end);if(!i||!n||i!==n)throw new I("view-writer-invalid-range-container",t)}const hr=e=>e.createTextNode(" "),mr=e=>{const t=e.createElement("span");return t.dataset.ckeFiller="true",t.innerText=" ",t},gr=e=>{const t=e.createElement("br");return t.dataset.ckeFiller="true",t},fr=7,pr="⁠".repeat(7);function br(e){return "string"==typeof e?e.substr(0,7)===pr:vi(e)&&e.data.substr(0,7)===pr}function wr(e){return 7==e.data.length&&br(e)}function vr(e){const t="string"==typeof e?e:e.data;return br(e)?t.slice(7):t}function _r(e){e.document.on("arrowKey",yr,{priority:"low"});}function yr(e,t){if(t.keyCode==on.arrowleft){const e=t.domTarget.ownerDocument.defaultView.getSelection();if(1==e.rangeCount&&e.getRangeAt(0).collapsed){const t=e.getRangeAt(0).startContainer,i=e.getRangeAt(0).startOffset;br(t)&&i<=7&&e.collapse(t,0);}}}class kr extends($t()){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",false),this.set("isSelecting",false),this.set("isComposing",false),n.isBlink&&!n.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 I("view-renderer-unknown-type",this);this.markedChildren.add(t);}}}render(){if(this.isComposing&&!n.isAndroid)return;let e=null;const t=!(n.isBlink&&!n.isAndroid)||!this.isSelecting;for(const e of this.markedChildren)this._updateChildrenMappings(e);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=Io._createBefore(e.parent)));for(const e of this.markedAttributes)this._updateAttrs(e);for(const t of this.markedChildren)this._updateChildren(t,{inlineFillerPosition:e});for(const t of this.markedTexts)!this.markedChildren.has(t.parent)&&this.domConverter.mapViewToDom(t.parent)&&this._updateText(t,{inlineFillerPosition:e});if(t)if(e){const t=this.domConverter.viewPositionToDom(e),i=t.parent.ownerDocument;br(t.parent)?this._inlineFiller=t.parent:this._inlineFiller=Cr(i,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 i=Array.from(t.childNodes),n=Array.from(this.domConverter.viewChildrenToDom(e,{withChildren:false})),s=this._diffNodeLists(i,n),o=this._findUpdateActions(s,i,n,xr);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,i[o]),qi(n[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")?Io._createBefore(e.parent):e}_isSelectionInInlineFiller(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return  false;const e=this.selection.getFirstPosition(),t=this.domConverter.viewPositionToDom(e);return !!(t&&vi(t.parent)&&br(t.parent))}_removeInlineFiller(){const e=this._inlineFiller;if(!br(e))throw new I("view-renderer-filler-was-lost",this);wr(e)?e.remove():e.data=e.data.substr(7),this._inlineFiller=null;}_needsInlineFillerAtSelection(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return  false;const e=this.selection.getFirstPosition(),t=e.parent,i=e.offset;if(!this.domConverter.mapViewToDom(t.root))return  false;if(!t.is("element"))return  false;if(!function(e){if("false"==e.getAttribute("contenteditable"))return  false;const t=e.findAncestor(e=>e.hasAttribute("contenteditable"));return !t||"true"==t.getAttribute("contenteditable")}(t))return  false;const s=e.nodeBefore,o=e.nodeAfter;return !(s instanceof so||o instanceof so)&&(!!(i!==t.getFillerOffset()||s&&s.is("element","br"))&&(!n.isAndroid||!s&&!o))}_updateText(e,t){const i=this.domConverter.findCorrespondingDomText(e);let n=this.domConverter.viewToDom(e).data;const s=t.inlineFillerPosition;s&&s.parent==e.parent&&s.offset==e.index&&(n=pr+n),this._updateTextNode(i,n);}_updateAttrs(e){const t=this.domConverter.mapViewToDom(e);if(t){for(const i of Array.from(t.attributes)){const n=i.name;e.hasAttribute(n)||this.domConverter.removeDomElementAttribute(t,n);}for(const i of e.getAttributeKeys())this.domConverter.setDomElementAttribute(t,i,e.getAttribute(i),e);}}_updateChildren(e,t){const i=this.domConverter.mapViewToDom(e);if(!i)return;if(n.isAndroid){let e=null;for(const t of Array.from(i.childNodes)){if(e&&vi(e)&&vi(t)){i.normalize();break}e=t;}}const s=t.inlineFillerPosition,o=i.childNodes,r=Array.from(this.domConverter.viewChildrenToDom(e,{bind:true}));s&&s.parent===e&&Cr(i.ownerDocument,r,s.offset);const a=this._diffNodeLists(o,r),l=this._findUpdateActions(a,o,r,Ar);let c=0;const u=new Set;for(const e of l)"delete"===e?(u.add(o[c]),qi(o[c])):"equal"!==e&&"update"!==e||c++;c=0;for(const e of l)"insert"===e?(Bi(i,c,r[c]),c++):"update"===e?(this._updateTextNode(o[c],r[c].data),c++):"equal"===e&&(this._markDescendantTextToSync(this.domConverter.domToView(r[c])),c++);for(const e of u)e.parentNode||this.domConverter.unbindDomElement(e);}_diffNodeLists(e,t){return b(e=function(e,t){const i=Array.from(e);if(0==i.length||!t)return i;i[i.length-1]==t&&i.pop();return i}(e,this._fakeSelectionContainer),t,Er.bind(null,this.domConverter))}_findUpdateActions(e,t,i,n){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(i[a.equal+a.insert]):"delete"===l?o.push(t[a.equal+a.delete]):(s=s.concat(b(o,r,n).map(e=>"equal"===e?"update":e)),s.push("equal"),o=[],r=[]),a[l]++;return s.concat(b(o,r,n).map(e=>"equal"===e?"update":e))}_updateTextNode(e,t){const i=e.data;i!=t&&(n.isAndroid&&this.isComposing&&i.replace(/\u00A0/g," ")==t.replace(/\u00A0/g," ")||this._updateTextNodeInternal(e,t));}_updateTextNodeInternal(e,t){const i=g(e.data,t);for(const t of i)"insert"===t.type?e.insertData(t.index,t.values.join("")):e.deleteData(t.index,t.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(n.isBlink&&!n.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&&n.isAndroid||this._updateDomSelection(e):!this.selection.isFake&&this._fakeSelectionContainer&&this._fakeSelectionContainer.isConnected&&this._removeFakeSelection();}_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 i=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(i,this.selection),!this._fakeSelectionNeedsUpdate(e))return;i.parentElement&&i.parentElement==e||e.appendChild(i),i.textContent=this.selection.fakeSelectionLabel||" ";const n=t.getSelection(),s=t.createRange();n.removeAllRanges(),s.selectNodeContents(i),n.addRange(s);}_updateDomSelection(e){const t=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(t))return;const i=this.domConverter.viewPositionToDom(this.selection.anchor),s=this.domConverter.viewPositionToDom(this.selection.focus);t.setBaseAndExtent(i.parent,i.offset,s.parent,s.offset),n.isGecko&&function(e,t){let i=e.parent,n=e.offset;vi(i)&&wr(i)&&(n=Oi(i)+1,i=i.parentNode);if(i.nodeType!=Node.ELEMENT_NODE||n!=i.childNodes.length-1)return;const s=i.childNodes[n];s&&"BR"==s.tagName&&t.addRange(t.getRangeAt(0));}(s,t);}_domSelectionNeedsUpdate(e){if(!this.domConverter.isDomSelectionCorrect(e))return  true;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,i=e.ownerDocument.getSelection();return !t||t.parentElement!==e||(i.anchorNode!==t&&!t.contains(i.anchorNode)||t.textContent!==this.selection.fakeSelectionLabel)}_removeDomSelection(){for(const e of this.domDocuments){const t=e.getSelection();if(t.rangeCount){const i=e.activeElement,n=this.domConverter.mapDomToView(i);i&&n&&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 Cr(e,t,i){const n=t instanceof Array?t:t.childNodes,s=n[i];if(vi(s))return s.data=pr+s.data,s;{const s=e.createTextNode(pr);return Array.isArray(t)?n.splice(i,0,s):Bi(t,i,s),s}}function xr(e,t){return ri(e)&&ri(t)&&!vi(e)&&!vi(t)&&!Li(e)&&!Li(t)&&e.tagName.toLowerCase()===t.tagName.toLowerCase()}function Ar(e,t){return ri(e)&&ri(t)&&vi(e)&&vi(t)}function Er(e,t,i){return t===i||(vi(t)&&vi(i)?t.data===i.data:!(!e.isBlockFiller(t)||!e.isBlockFiller(i)))}const Tr=gr(exports.global.document),Sr=hr(exports.global.document),Ir=mr(exports.global.document),Pr="data-ck-unsafe-attribute-",Vr="data-ck-unsafe-element";class Rr{document;renderingMode;blockFillerMode;preElements;blockElements;inlineObjectElements;unsafeElements;_domDocument;_domToViewMapping=new WeakMap;_viewToDomMapping=new WeakMap;_fakeSelectionMapping=new WeakMap;_rawContentElementMatcher=new uo;_inlineObjectElementMatcher=new uo;_elementsWithTemporaryCustomProperties=new Set;constructor(t,{blockFillerMode:i,renderingMode:n="editing"}={}){this.document=t,this.renderingMode=n,this.blockFillerMode=i||("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?exports.global.document:exports.global.document.implementation.createHTMLDocument("");}get domDocument(){return this._domDocument}bindFakeSelection(e,t){this._fakeSelectionMapping.set(e,new Ro(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,i){return "data"===this.renderingMode||!(e=e.toLowerCase()).startsWith("on")&&("srcdoc"!==e&&("img"===i&&("src"===e||"srcset"===e)||("source"===i&&"srcset"===e||!t.replace(/\s+/g,"").match(/^(javascript:|data:(image\/svg|text\/x?html))/i))))}setContentOf(e,t){if("data"===this.renderingMode)return void(e.innerHTML=t);const i=(new DOMParser).parseFromString(t,"text/html"),n=i.createDocumentFragment(),s=i.body.childNodes;for(;s.length>0;)n.appendChild(s[0]);const o=i.createTreeWalker(n,NodeFilter.SHOW_ELEMENT),r=[];let a;for(;a=o.nextNode();)r.push(a);for(const e of r){for(const t of e.getAttributeNames())this.setDomElementAttribute(e,t,e.getAttribute(t));const t=e.tagName.toLowerCase();this._shouldRenameElement(t)&&(Dr(t),e.replaceWith(this._createReplacementDomElement(t,e)));}for(;e.firstChild;)e.firstChild.remove();e.append(n);}viewToDom(e,t={}){if(e.is("$text")){const t=this._processDataFromViewText(e);return this._domDocument.createTextNode(t)}{const i=e;if(this.mapViewToDom(i)){if(!i.getCustomProperty("editingPipeline:doNotReuseOnce"))return this.mapViewToDom(i);this._elementsWithTemporaryCustomProperties.add(i);}let n;if(i.is("documentFragment"))n=this._domDocument.createDocumentFragment(),t.bind&&this.bindDocumentFragments(n,i);else {if(i.is("uiElement"))return n="$comment"===i.name?this._domDocument.createComment(i.getCustomProperty("$rawContent")):i.render(this._domDocument,this),t.bind&&this.bindElements(n,i),n;this._shouldRenameElement(i.name)?(Dr(i.name),n=this._createReplacementDomElement(i.name)):n=i.hasAttribute("xmlns")?this._domDocument.createElementNS(i.getAttribute("xmlns"),i.name):this._domDocument.createElement(i.name),i.is("rawElement")&&i.render(n,this),t.bind&&this.bindElements(n,i);for(const e of i.getAttributeKeys())this.setDomElementAttribute(n,e,i.getAttribute(e),i);}if(false!==t.withChildren)for(const e of this.viewChildrenToDom(i,t))n instanceof HTMLTemplateElement?n.content.appendChild(e):n.appendChild(e);return n}}setDomElementAttribute(e,t,i,n){const s=this.shouldRenderAttribute(t,i,e.tagName.toLowerCase())||n&&n.shouldRenderUnsafeAttribute(t);s||P("domconverter-unsafe-attribute-detected",{domElement:e,key:t,value:i}),Mi(t)?(e.hasAttribute(t)&&!s?e.removeAttribute(t):e.hasAttribute(Pr+t)&&s&&e.removeAttribute(Pr+t),e.setAttribute(s?t:Pr+t,i)):P("domconverter-invalid-attribute-detected",{domElement:e,key:t,value:i});}removeDomElementAttribute(e,t){t!=Vr&&(e.removeAttribute(t),e.removeAttribute(Pr+t));}*viewChildrenToDom(e,t={}){const i=e.getFillerOffset&&e.getFillerOffset();let n=0;for(const s of e.getChildren()){i===n&&(yield this._getBlockFiller());const e=s.is("element")&&!!s.getCustomProperty("dataPipeline:transparentRendering")&&!Cn(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&&P("domconverter-transparent-rendering-unsupported-in-editing-pipeline",{viewElement:s}),yield this.viewToDom(s,t);n++;}i===n&&(yield this._getBlockFiller());}viewRangeToDom(e){const t=this.viewPositionToDom(e.start),i=this.viewPositionToDom(e.end),n=this._domDocument.createRange();return n.setStart(t.parent,t.offset),n.setEnd(i.parent,i.offset),n}viewPositionToDom(e){const t=e.parent;if(t.is("$text")){const i=this.findCorrespondingDomText(t);if(!i)return null;let n=e.offset;return br(i)&&(n+=7),i.data&&n>i.data.length&&(n=i.data.length),{parent:i,offset:n}}{let i,n,s;if(0===e.offset){if(i=this.mapViewToDom(t),!i)return null;s=i.childNodes[0];}else {const t=e.nodeBefore;if(n=t.is("$text")?this.findCorrespondingDomText(t):this.mapViewToDom(t),!n)return null;i=n.parentNode,s=n.nextSibling;}if(vi(s)&&br(s))return {parent:s,offset:7};return {parent:i,offset:n?Oi(n)+1:0}}}domToView(e,t={}){const i=[],n=this._domToView(e,t,i),s=n.next().value;return s?(n.next(),this._processDomInlineNodes(null,i,t),"br"==this.blockFillerMode&&Fr(s)||s.is("$text")&&0==s.data.length?null:s):null}*domChildrenToView(e,t={},i=[]){let n=[];n=e instanceof HTMLTemplateElement?[...e.content.childNodes]:[...e.childNodes];for(let s=0;s<n.length;s++){const o=n[s],r=this._domToView(o,t,i),a=r.next().value;null!==a&&(this._isBlockViewElement(a)&&this._processDomInlineNodes(e,i,t),"br"==this.blockFillerMode&&Fr(a)||(yield a),r.next());}this._processDomInlineNodes(e,i,t);}domSelectionToView(e){if(function(e){if(!n.isGecko)return  false;if(!e.rangeCount)return  false;const t=e.getRangeAt(0).startContainer;try{Object.prototype.toString.call(t);}catch{return  true}return  false}(e))return new Ro([]);if(1===e.rangeCount){let t=e.getRangeAt(0).startContainer;vi(t)&&(t=t.parentNode);const i=this.fakeSelectionToView(t);if(i)return i}const t=this.isDomSelectionBackward(e),i=[];for(let t=0;t<e.rangeCount;t++){const n=e.getRangeAt(t),s=this.domRangeToView(n);s&&i.push(s);}return new Ro(i,{backward:t})}domRangeToView(e){const t=this.domPositionToView(e.startContainer,e.startOffset),i=this.domPositionToView(e.endContainer,e.endOffset);return t&&i?new Po(t,i):null}domPositionToView(e,t=0){if(this.isBlockFiller(e))return this.domPositionToView(e.parentNode,Oi(e));const i=this.mapDomToView(e);if(i&&(i.is("uiElement")||i.is("rawElement")))return Io._createBefore(i);if(vi(e)){if(wr(e))return this.domPositionToView(e.parentNode,Oi(e));const i=this.findCorrespondingViewText(e);let n=t;return i?(br(e)&&(n-=7,n=n<0?0:n),new Io(i,n)):null}if(0===t){const t=this.mapDomToView(e);if(t)return new Io(t,0)}else {const i=e.childNodes[t-1];if(vi(i)&&wr(i)||i&&this.isBlockFiller(i))return this.domPositionToView(i.parentNode,Oi(i));const n=vi(i)?this.findCorrespondingViewText(i):this.mapDomToView(i);if(n&&n.parent)return new Io(n.parent,n.index+1)}return null}mapDomToView(e){return this.getHostViewElement(e)||this._domToViewMapping.get(e)}findCorrespondingViewText(e){if(wr(e))return null;const t=this.getHostViewElement(e);if(t)return t;const i=e.previousSibling;if(i){if(!this.isElement(i))return null;const e=this.mapDomToView(i);if(e){const t=e.nextSibling;return t instanceof so?t:null}}else {const t=this.mapDomToView(e.parentNode);if(t){const e=t.getChild(0);return e instanceof so?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(t){const i=this.mapViewToDom(t);if(!i||i.ownerDocument.activeElement===i)return;const{scrollX:n,scrollY:s}=exports.global.window,o=[];Or(i,e=>{const{scrollLeft:t,scrollTop:i}=e;o.push([t,i]);}),i.focus({preventScroll:true}),Or(i,e=>{const[t,i]=o.shift();e.scrollLeft=t,e.scrollTop=i;}),exports.global.window.scrollTo(n,s);}_clearDomSelection(){const e=this.mapViewToDom(this.document.selection.editableElement);if(!e)return;const t=e.ownerDocument.defaultView.getSelection(),i=this.domSelectionToView(t);i&&i.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(Tr):!!Nr(e,this.blockElements)||(e.isEqualNode(Ir)||function(e,t){const i=e.isEqualNode(Sr);return i&&Br(e,t)&&1===e.parentNode.childNodes.length}(e,this.blockElements))}isDomSelectionBackward(e){if(e.isCollapsed)return  false;const t=this._domDocument.createRange();try{t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset);}catch{return  false}const i=t.collapsed;return t.detach(),i}getHostViewElement(e){const t=mi(e);for(t.pop();t.length;){const e=t.pop(),i=this._domToViewMapping.get(e);if(i&&(i.is("uiElement")||i.is("rawElement")))return i}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 hr(this._domDocument);case "markedNbsp":return mr(this._domDocument);case "br":return gr(this._domDocument)}}_isDomSelectionPositionCorrect(e,t){if(vi(e)&&br(e)&&t<7)return  false;if(this.isElement(e)&&br(e.childNodes[t]))return  false;const i=this.mapDomToView(e);return !i||!i.is("uiElement")&&!i.is("rawElement")}*_domToView(e,t,i){if("br"!=this.blockFillerMode&&Nr(e,this.blockElements))return null;const n=this.getHostViewElement(e);if(n)return n;if(Li(e)&&t.skipComments)return null;if(vi(e)){if(wr(e))return null;{const t=e.data;if(""===t)return null;const n=new so(this.document,t);return i.push(n),n}}{let n=this.mapDomToView(e);if(n)return this._isInlineObjectElement(n)&&i.push(n),n;if(this.isDocumentFragment(e))n=new tr(this.document),t.bind&&this.bindDocumentFragments(e,n);else {n=this._createViewElement(e,t),t.bind&&this.bindElements(e,n);const s=e.attributes;if(s)for(let e=s.length,t=0;t<e;t++)n._setAttribute(s[t].name,s[t].value);if(this._isViewElementWithRawContent(n,t))return n._setCustomProperty("$rawContent",e.innerHTML),this._isBlockViewElement(n)||i.push(n),n;if(Li(e))return n._setCustomProperty("$rawContent",e.data),n}yield n;const s=[];if(false!==t.withChildren)for(const i of this.domChildrenToView(e,t,s))n._appendChild(i);if(this._isInlineObjectElement(n))i.push(n),this._processDomInlineNodes(null,s,t);else for(const e of s)i.push(e);}}_processDomInlineNodes(e,t,i){if(!t.length)return;if(e&&!this.isDocumentFragment(e)&&!this._isBlockDomElement(e))return;let n=false;for(let e=0;e<t.length;e++){const s=t[e];if(!s.is("$text")){n=false;continue}let o,r=false;if(this._isPreFormatted(s))o=vr(s.data);else {o=s.data.replace(/[ \n\t\r]{1,}/g," "),r=/[^\S\u00A0]/.test(o.charAt(o.length-1));const a=e>0?t[e-1]:null,l=e+1<t.length?t[e+1]:null,c=!a||a.is("element")&&"br"==a.name||n,u=!l&&!br(s.data);false!==i.withChildren&&(c&&(o=o.replace(/^ /,"")),u&&(o=o.replace(/ $/,""))),o=vr(o),"br"!=this.blockFillerMode&&s.parent&&(Mr(s.parent,o)?(o="",s.parent.parent&&(s.parent.parent._setCustomProperty("$hasBlockFiller",true),s.parent._remove())):Lr(s.parent,o,this.blockElements)&&(o="",s.parent._setCustomProperty("$hasBlockFiller",true))),o=o.replace(/ \u00A0/g,"  ");const d=l&&l.is("element")&&"br"!=l.name,h=l&&l.is("$text")&&" "==l.data.charAt(0);(/[ \u00A0]\u00A0$/.test(o)||!l||d||h)&&(o=o.replace(/\u00A0$/," ")),(c||a&&a.is("element")&&"br"!=a.name)&&(o=o.replace(/^\u00A0/," "));}0==o.length&&s.parent?(s._remove(),t.splice(e,1),e--):(s._data=o,n=r);}t.length=0;}_processDataFromViewText(e){let t=e.data;if(this._isPreFormatted(e))return t;if(" "==t.charAt(0)){const i=this._getTouchingInlineViewNode(e,false);!(i&&i.is("$textProxy")&&this._nodeEndsWithSpace(i))&&i||(t=" "+t.substr(1));}if(" "==t.charAt(t.length-1)){const i=this._getTouchingInlineViewNode(e,true),n=i&&i.is("$textProxy")&&" "==i.data.charAt(0);" "!=t.charAt(t.length-2)&&i&&!n||(t=t.substr(0,t.length-1)+" ");}return t.replace(/ {2}/g,"  ")}_nodeEndsWithSpace(e){if(this._isPreFormatted(e))return  false;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  true;for(const t of e.getAncestors({parentFirst:true}))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  false}_getTouchingInlineViewNode(e,t){const i=new So({startPosition:t?Io._createAfter(e):Io._createBefore(e),direction:t?"forward":"backward"});for(const{item:e}of i){if(e.is("$textProxy"))return e;if(!e.is("element")||!e.getCustomProperty("dataPipeline:transparentRendering")){if(e.is("element","br"))return null;if(this._isInlineObjectElement(e))return e;if(e.is("containerElement")||this._isBlockViewElement(e))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(Li(e))return new Qo(this.document,"$comment");const i=t.keepOriginalCase?e.tagName:e.tagName.toLowerCase();return new _o(this.document,i)}_isViewElementWithRawContent(e,t){return  false!==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 i=this._domDocument.createElement("span");if(i.setAttribute(Vr,e),t){for(;t.firstChild;)i.appendChild(t.firstChild);for(const e of t.getAttributeNames())i.setAttribute(e,t.getAttribute(e));}return i}}function Or(e,t){let i=e;for(;i;)t(i),i=i.parentElement;}function Br(e,t){const i=e.parentNode;return !!i&&!!i.tagName&&t.includes(i.tagName.toLowerCase())}function Lr(e,t,i){return " "==t&&e&&e.is("element")&&1==e.childCount&&i.includes(e.name)}function Mr(e,t){return " "==t&&e&&e.is("element","span")&&1==e.childCount&&e.hasAttribute("data-cke-filler")}function Fr(e){return e.is("element","br")&&e.hasAttribute("data-cke-filler")}function Nr(e,t){return "BR"===e.tagName&&Br(e,t)&&1===e.parentNode.childNodes.length}function Dr(e){"script"===e&&P("domconverter-unsafe-script-element-detected"),"style"===e&&P("domconverter-unsafe-style-element-detected");}class zr extends(ci()){view;document;_isEnabled=false;constructor(e){super(),this.view=e,this.document=e.document;}get isEnabled(){return this._isEnabled}enable(){this._isEnabled=true;}disable(){this._isEnabled=false;}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 Hr{view;document;domEvent;domTarget;constructor(e,t,i){this.view=e,this.document=e.document,this.domEvent=t,this.domTarget=t.target,bt(this,i);}get target(){return this.view.domConverter.mapDomToView(this.domTarget)}preventDefault(){this.domEvent.preventDefault();}stopPropagation(){this.domEvent.stopPropagation();}}class qr extends zr{useCapture=false;usePassive=false;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,i){this.isEnabled&&this.document.fire(e,new Hr(this.view,t,i));}}class Ur extends qr{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 an(this)}};this.fire(e.type,e,t);}}class jr extends zr{_fireSelectionChangeDoneDebounced;constructor(e){super(e),this._fireSelectionChangeDoneDebounced=st(e=>{this.document.fire("selectionChangeDone",e);},200);}observe(){const e=this.document;e.on("arrowKey",(t,i)=>{e.selection.isFake&&this.isEnabled&&i.preventDefault();},{context:"$capture"}),e.on("arrowKey",(t,i)=>{e.selection.isFake&&this.isEnabled&&this._handleSelectionMove(i.keyCode);},{priority:"lowest"});}stopObserving(){}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel();}_handleSelectionMove(e){const t=this.document.selection,i=new Ro(t.getRanges(),{backward:t.isBackward,fake:false});e!=on.arrowleft&&e!=on.arrowup||i.setTo(i.getFirstPosition()),e!=on.arrowright&&e!=on.arrowdown||i.setTo(i.getLastPosition());const n={oldSelection:t,newSelection:i,domSelection:null};this.document.fire("selectionChange",n),this._fireSelectionChangeDoneDebounced(n);}}let $r=class extends zr{domConverter;_config;_domElements;_mutationObserver;constructor(e){super(e),this._config={childList:true,characterData:true,subtree:true},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,i=new Set,n=new Set;for(const i of e){const e=t.mapDomToView(i.target);e&&(e.is("uiElement")||e.is("rawElement")||"childList"!==i.type||this._isBogusBrMutation(i)||n.add(e));}for(const s of e){const e=t.mapDomToView(s.target);if((!e||!e.is("uiElement")&&!e.is("rawElement"))&&"characterData"===s.type){const e=t.findCorrespondingViewText(s.target);e&&!n.has(e.parent)?i.add(e):!e&&br(s.target)&&n.add(t.mapDomToView(s.target.parentNode));}}const s=[];for(const e of i)s.push({type:"text",node:e});for(const e of n){const i=t.mapViewToDom(e);Pt(Array.from(e.getChildren()),Array.from(t.domChildrenToView(i,{withChildren:false})),Wr)||s.push({type:"children",node:e});}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:false})),t&&t.is("element","br")}};function Wr(e,t){if(!Array.isArray(e))return e===t||!(!e.is("$text")||!t.is("$text"))&&e.data===t.data}class Gr extends qr{_renderTimeoutId=null;_isFocusChanging=false;domEventType=["focus","blur"];constructor(e){super(e),this.useCapture=true;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=false,this.document.isFocused=true);}onDomEvent(e){this.fire(e.type,e);}destroy(){this._clearTimeout(),super.destroy();}_handleFocus(){this._clearTimeout(),this._isFocusChanging=true,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=false,this._isFocusChanging=false,this.view.change(()=>{}));}_clearTimeout(){this._renderTimeoutId&&(clearTimeout(this._renderTimeoutId),this._renderTimeoutId=null);}}class Kr extends zr{mutationObserver;focusObserver;selection;domConverter;_documents=new WeakSet;_fireSelectionChangeDoneDebounced;_clearInfiniteLoopInterval;_documentIsSelectingInactivityTimeoutDebounced;_loopbackCounter=0;_pendingSelectionChange=new Set;constructor(e){super(e),this.mutationObserver=e.getObserver($r),this.focusObserver=e.getObserver(Gr),this.selection=this.document.selection,this.domConverter=e.domConverter,this._fireSelectionChangeDoneDebounced=st(e=>{this.document.fire("selectionChangeDone",e);},200),this._clearInfiniteLoopInterval=setInterval(()=>this._clearInfiniteLoop(),1e3),this._documentIsSelectingInactivityTimeoutDebounced=st(()=>this.document.isSelecting=false,5e3),this.view.document.on("change:isFocused",(e,t,i)=>{if(i&&this._pendingSelectionChange.size){for(const e of Array.from(this._pendingSelectionChange))this._handleSelectionChange(e);this._pendingSelectionChange.clear();}});}observe(e){const t=e.ownerDocument,i=()=>{this.document.isSelecting&&(this._handleSelectionChange(t),this.document.isSelecting=false,this._documentIsSelectingInactivityTimeoutDebounced.cancel());};this.listenTo(e,"selectstart",()=>{this.document.isSelecting=true,this._documentIsSelectingInactivityTimeoutDebounced();},{priority:"highest"}),this.listenTo(e,"keydown",i,{priority:"highest",useCapture:true}),this.listenTo(e,"keyup",i,{priority:"highest",useCapture:true}),this._documents.has(t)||(this.listenTo(t,"mouseup",i,{priority:"highest",useCapture:true}),this.listenTo(t,"selectionchange",()=>{this.document.isComposing&&!n.isAndroid||(this._handleSelectionChange(t),this._documentIsSelectingInactivityTimeoutDebounced());}),this.listenTo(this.view.document,"compositionstart",()=>{this._handleSelectionChange(t);},{priority:"lowest"}),this._documents.add(t));}stopObserving(e){this.stopListening(e);}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel(),this._documentIsSelectingInactivityTimeoutDebounced.cancel();}_reportInfiniteLoop(){}_handleSelectionChange(e){if(!this.isEnabled)return;const t=e.defaultView.getSelection();if(this.checkShouldIgnoreEventFromTarget(t.anchorNode))return;this.mutationObserver.flush();const i=this.domConverter.domSelectionToView(t);if(0!=i.rangeCount)if(this.view.hasDomSelection=true,this.focusObserver.flush(),this.view.document.isFocused||this.view.document.isReadOnly){if(this._pendingSelectionChange.delete(e),!this.selection.isEqual(i)||!this.domConverter.isDomSelectionCorrect(t))if(++this._loopbackCounter>60)this._reportInfiniteLoop();else if(function(e){return Array.from(e.getRanges()).flatMap(e=>[e.start.root,e.end.root]).every(e=>e&&e.is("rootElement"))}(i))if(this.selection.isSimilar(i))this.view.forceRender();else {const e={oldSelection:this.selection,newSelection:i,domSelection:t};this.document.fire("selectionChange",e),this._fireSelectionChangeDoneDebounced(e);}else this.view.forceRender();}else this._pendingSelectionChange.add(e);else this.view.hasDomSelection=false;}_clearInfiniteLoop(){this._loopbackCounter=0;}}class Jr extends qr{domEventType=["compositionstart","compositionupdate","compositionend"];constructor(e){super(e);const t=this.document;t.on("compositionstart",()=>{t.isComposing=true;}),t.on("compositionend",()=>{t.isComposing=false;});}onDomEvent(e){this.fire(e.type,e,{data:e.data});}}class Qr{_files;_native;constructor(e,t={}){this._files=t.cacheFiles?Yr(e):null,this._native=e;}get files(){return this._files||(this._files=Yr(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,i){this._native.setDragImage(e,t,i);}get isCanceled(){return "none"==this._native.dropEffect||!!this._native.mozUserCancelled}}function Yr(e){const t=Array.from(e.files||[]),i=Array.from(e.items||[]);return t.length?t:i.filter(e=>"file"===e.kind).map(e=>e.getAsFile())}class Zr extends qr{domEventType="beforeinput";onDomEvent(e){const t=e.getTargetRanges(),i=this.view,s=i.document;let o=null,r=null,a=[];if(e.dataTransfer&&(o=new Qr(e.dataTransfer)),null!==e.data?r=e.data:o&&(r=o.getData("text/plain")),s.selection.isFake)a=Array.from(s.selection.getRanges()),e.preventDefault();else if(t.length)a=t.map(t=>{let n=i.domConverter.domPositionToView(t.startContainer,t.startOffset);const s=i.domConverter.domPositionToView(t.endContainer,t.endOffset);if(n&&br(t.startContainer)&&t.startOffset<7){e.preventDefault();let i=7-t.startOffset;n=n.getLastMatchingPosition(e=>!(!e.item.is("attributeElement")&&!e.item.is("uiElement"))||!(!e.item.is("$textProxy")||!i--),{direction:"backward",singleCharacters:true});}return function(e,t){for(;e.parentNode;){if(vi(e)){if(t!=e.data.length)return  false}else if(t!=e.childNodes.length)return  false;if((t=Oi(e)+1)<(e=e.parentNode).childNodes.length&&br(e.childNodes[t]))return  true}return  false}(t.endContainer,t.endOffset)&&e.preventDefault(),n?i.createRange(n,s):s?i.createRange(s):void 0}).filter(e=>!!e);else if(n.isAndroid){const t=e.target.ownerDocument.defaultView.getSelection();a=Array.from(i.domConverter.domSelectionToView(t).getRanges());}if(n.isAndroid&&"insertCompositionText"==e.inputType&&r&&r.endsWith("\n"))this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:[i.createRange(a[0].end)]});else {if(["insertText","insertReplacementText"].includes(e.inputType)&&r&&r.includes("\n")){const t=r.split(/\n{1,2}/g);let i=a;e.preventDefault();for(let n=0;n<t.length;n++){const r=t[n];""!=r&&(this.fire(e.type,e,{data:r,dataTransfer:o,targetRanges:i,inputType:e.inputType,isComposing:e.isComposing}),i=[s.selection.getFirstRange()]),n+1<t.length&&(this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:i}),i=[s.selection.getFirstRange()]);}return}this.fire(e.type,e,{data:r,dataTransfer:o,targetRanges:a,inputType:e.inputType,isComposing:e.isComposing});}}}class Xr extends zr{constructor(e){super(e),this.document.on("keydown",(e,t)=>{if(this.isEnabled&&un(t.keyCode)){const i=new Bo(this.document,"arrowKey",this.document.selection.getFirstRange());this.document.fire(i,t),i.stop.called&&e.stop();}});}observe(){}stopObserving(){}}class ea extends zr{constructor(e){super(e);const t=this.document;t.on("keydown",(e,i)=>{if(!this.isEnabled||i.keyCode!=on.tab||i.ctrlKey)return;const n=new Bo(t,"tab",t.selection.getFirstRange());t.fire(n,i),n.stop.called&&e.stop();});}observe(){}stopObserving(){}}class ta extends($t()){document;domConverter;domRoots=new Map;_renderer;_initialDomRootAttributes=new WeakMap;_observers=new Map;_writer;_ongoingChange=false;_postFixersInProgress=false;_renderingDisabled=false;_hasChangedSinceTheLastRendering=false;constructor(e){super(),this.document=new jo(e),this.domConverter=new Rr(this.document),this.set("isRenderingInProgress",false),this.set("hasDomSelection",false),this._renderer=new kr(this.domConverter,this.document.selection),this._renderer.bind("isFocused","isSelecting","isComposing").to(this.document,"isFocused","isSelecting","isComposing"),this._writer=new ir(this.document),this.addObserver($r),this.addObserver(Gr),this.addObserver(Kr),this.addObserver(Ur),this.addObserver(jr),this.addObserver(Jr),this.addObserver(Xr),this.addObserver(Zr),this.addObserver(ea),_r(this),Yo(this),this.on("render",()=>{this._render(),this.document.fire("layoutChanged"),this._hasChangedSinceTheLastRendering=false;}),this.listenTo(this.document.selection,"change",()=>{this._hasChangedSinceTheLastRendering=true;}),this.listenTo(this.document,"change:isFocused",()=>{this._hasChangedSinceTheLastRendering=true;}),n.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 i=this.document.getRoot(t);i._name=e.tagName.toLowerCase();const n={};for(const{name:t,value:s}of Array.from(e.attributes))n[t]=s,"class"===t?this._writer.addClass(s.split(" "),i):i.hasAttribute(t)||this._writer.setAttribute(t,s,i);this._initialDomRootAttributes.set(e,n);const s=()=>{this._writer.setAttribute("contenteditable",(!i.isReadOnly).toString(),i),i.isReadOnly?this._writer.addClass("ck-read-only",i):this._writer.removeClass("ck-read-only",i);};s(),this.domRoots.set(t,e),this.domConverter.bindElements(e,i),this._renderer.markToSync("children",i),this._renderer.markToSync("attributes",i),this._renderer.domDocuments.add(e.ownerDocument),i.on("change:children",(e,t)=>this._renderer.markToSync("children",t)),i.on("change:attributes",(e,t)=>this._renderer.markToSync("attributes",t)),i.on("change:text",(e,t)=>this._renderer.markToSync("text",t)),i.on("change:isReadOnly",()=>this.change(s)),i.on("change",()=>{this._hasChangedSinceTheLastRendering=true;});for(const i of this._observers.values())i.observe(e,t);}detachDomRoot(e){const t=this.domRoots.get(e);Array.from(t.attributes).forEach(({name:e})=>t.removeAttribute(e));const i=this._initialDomRootAttributes.get(t);for(const e in i)t.setAttribute(e,i[e]);this.domRoots.delete(e),this.domConverter.unbindDomElement(t);for(const e of this._observers.values())e.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[e,i]of this.domRoots)t.observe(i,e);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:i=20,ancestorOffset:n=20}={}){const s=this.document.selection.getFirstRange();if(!s)return;const o=De({alignToTop:e,forceScroll:t,viewportOffset:i,ancestorOffset:n});"number"==typeof i&&(i={top:i,bottom:i,left:i,right:i});const r={target:this.domConverter.viewRangeToDom(s),viewportOffset:i,ancestorOffset:n,alignToTop:e,forceScroll:t};this.fire("scrollToTheSelection",r,o),ji(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 I("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(e){I.rethrowUnexpectedError(e,this);}}forceRender(){this._hasChangedSinceTheLastRendering=true,this.getObserver(Gr).flush(),this.change(()=>{});}destroy(){for(const e of this._observers.values())e.destroy();this.document.destroy(),this.stopListening();}createPositionAt(e,t){return Io._createAt(e,t)}createPositionAfter(e){return Io._createAfter(e)}createPositionBefore(e){return Io._createBefore(e)}createRange(e,t){return new Po(e,t)}createRangeOn(e){return Po._createOn(e)}createRangeIn(e){return Po._createIn(e)}createSelection(...e){return new Ro(...e)}_disableRendering(e){this._renderingDisabled=e,0==e&&this.change(()=>{});}_render(){this.isRenderingInProgress=true,this.disableObservers(),this._renderer.render(),this.enableObservers(),this.isRenderingInProgress=false;}}class ia{is(){throw new Error("is() method is abstract")}}class na extends ia{textNode;data;offsetInText;constructor(e,t,i){if(super(),this.textNode=e,t<0||t>e.offsetSize)throw new I("model-textproxy-wrong-offsetintext",this);if(i<0||t+i>e.offsetSize)throw new I("model-textproxy-wrong-length",this);this.data=e.data.substring(t,t+i),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 i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.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()}}na.prototype.is=function(e){return "$textProxy"===e||"model:$textProxy"===e||"textProxy"===e||"model:textProxy"===e};class sa{direction;boundaries;singleCharacters;shallow;ignoreElementEnd;_position;_boundaryStartParent;_boundaryEndParent;_visitedParent;constructor(e){if(!e||!e.boundaries&&!e.startPosition)throw new I("model-tree-walker-no-start-position",null);const t=e.direction||"forward";if("forward"!=t&&"backward"!=t)throw new I("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=ra._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,i,n,s;do{n=this.position,s=this._visitedParent,({done:t,value:i}=this.next());}while(!t&&e(i));t||(this._position=n,this._visitedParent=s);}jumpTo(e){this._boundaryStartParent&&e.isBefore(this.boundaries.start)?e=this.boundaries.start:this._boundaryEndParent&&e.isAfter(this.boundaries.end)&&(e=this.boundaries.end),this._position=e.clone(),this._visitedParent=e.parent;}next(){return "forward"==this.direction?this._next():this._previous()}_next(){const e=this.position,t=this.position.clone(),i=this._visitedParent;if(null===i.parent&&t.offset===i.maxOffset)return {done:true,value:void 0};if(i===this._boundaryEndParent&&t.offset==this.boundaries.end.offset)return {done:true,value:void 0};const n=aa(t,i),s=n||la(t,i,n);if(s&&s.is("model:element")){if(this.shallow){if(this.boundaries&&this.boundaries.end.isBefore(t))return {done:true,value:void 0};t.offset++;}else t.path.push(0),this._visitedParent=s;return this._position=t,oa("elementStart",s,e,t,1)}if(s&&s.is("model:$text")){let n;if(this.singleCharacters)n=1;else {let e=s.endOffset;this._boundaryEndParent==i&&this.boundaries.end.offset<e&&(e=this.boundaries.end.offset),n=e-t.offset;}const o=t.offset-s.startOffset,r=new na(s,o,n);return t.offset+=n,this._position=t,oa("text",r,e,t,n)}return t.path.pop(),t.offset++,this._position=t,this._visitedParent=i.parent,this.ignoreElementEnd?this._next():oa("elementEnd",i,e,t)}_previous(){const e=this.position,t=this.position.clone(),i=this._visitedParent;if(null===i.parent&&0===t.offset)return {done:true,value:void 0};if(i==this._boundaryStartParent&&t.offset==this.boundaries.start.offset)return {done:true,value:void 0};const n=t.parent,s=aa(t,n),o=s||ca(t,n,s);if(o&&o.is("model:element"))return t.offset--,this.shallow?(this._position=t,oa("elementStart",o,e,t,1)):(t.path.push(o.maxOffset),this._position=t,this._visitedParent=o,this.ignoreElementEnd?this._previous():oa("elementEnd",o,e,t));if(o&&o.is("model:$text")){let n;if(this.singleCharacters)n=1;else {let e=o.startOffset;this._boundaryStartParent==i&&this.boundaries.start.offset>e&&(e=this.boundaries.start.offset),n=t.offset-e;}const s=t.offset-o.startOffset,r=new na(o,s-n,n);return t.offset-=n,this._position=t,oa("text",r,e,t,n)}return t.path.pop(),this._position=t,this._visitedParent=i.parent,oa("elementStart",i,e,t,1)}}function oa(e,t,i,n,s){return {done:false,value:{type:e,item:t,previousPosition:i,nextPosition:n,length:s}}}class ra extends ia{root;path;stickiness;constructor(e,t,i="toNone"){if(super(),!e.is("element")&&!e.is("documentFragment"))throw new I("model-position-root-invalid",e);if(!Array.isArray(t)||0===t.length)throw new I("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=i;}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 I("model-position-path-incorrect",this,{position:this});if(e.is("$text"))throw new I("model-position-path-incorrect",this,{position:this});return e}get index(){return this.parent.offsetToIndex(this.offset)}get textNode(){return aa(this,this.parent)}get nodeAfter(){const e=this.parent;return la(this,e,aa(this,e))}get nodeBefore(){const e=this.parent;return ca(this,e,aa(this,e))}get isAtStart(){return 0===this.offset}get isAtEnd(){return this.offset==this.parent.maxOffset}isValid(){if(this.offset<0)return  false;let e=this.root;for(let t=0;t<this.path.length-1;t++)if(e=e.getChildAtOffset(this.path[t]),!e)return  false;return this.offset<=e.maxOffset}compareWith(e){if(this.root!=e.root)return "different";const t=ei(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"}}getLastMatchingPosition(e,t={}){t.startPosition=this;const i=new sa(t);return i.skip(e),i.position}getParentPath(){return this.path.slice(0,-1)}getAncestors(){const e=this.parent;return e.is("documentFragment")?[e]:e.getAncestors({includeSelf:true})}findAncestor(e){const t=this.parent;return t.is("element")?t.findAncestor(e,{includeSelf:true}):null}getCommonPath(e){if(this.root!=e.root)return [];const t=ei(this.path,e.path),i="string"==typeof t?Math.min(this.path.length,e.path.length):t;return this.path.slice(0,i)}getCommonAncestor(e){const t=this.getAncestors(),i=e.getAncestors();let n=0;for(;t[n]==i[n]&&t[n];)n++;return 0===n?null:t[n-1]}getShiftedBy(e){const t=this.clone(),i=t.offset+e;return t.offset=i<0?0:i,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  false;const t=Math.min(this.path.length,e.path.length);for(let i=0;i<t;i++){const t=this.path[i]-e.path[i];if(t<-1||t>1)return  false;if(1===t)return ua(e,this,i);if(-1===t)return ua(this,e,i)}return this.path.length===e.path.length||(this.path.length>e.path.length?da(this.path,t):da(e.path,t))}hasSameParentAs(e){if(this.root!==e.root)return  false;return "same"==ei(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=ra._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 i;return t.containsPosition(this)||t.start.isEqual(this)?(i=this._getCombined(e.sourcePosition,e.targetPosition),e.sourcePosition.isBefore(e.targetPosition)&&(i=i._getTransformedByDeletion(e.deletionPosition,1))):i=this.isEqual(e.deletionPosition)?ra._createAt(e.deletionPosition):this._getTransformedByMove(e.deletionPosition,e.graveyardPosition,1),i}_getTransformedByDeletion(e,t){const i=ra._createAt(this);if(this.root!=e.root)return i;if("same"==ei(e.getParentPath(),this.getParentPath())){if(e.offset<this.offset){if(e.offset+t>this.offset)return null;i.offset-=t;}}else if("prefix"==ei(e.getParentPath(),this.getParentPath())){const n=e.path.length-1;if(e.offset<=this.path[n]){if(e.offset+t>this.path[n])return null;i.path[n]-=t;}}return i}_getTransformedByInsertion(e,t){const i=ra._createAt(this);if(this.root!=e.root)return i;if("same"==ei(e.getParentPath(),this.getParentPath()))(e.offset<this.offset||e.offset==this.offset&&"toPrevious"!=this.stickiness)&&(i.offset+=t);else if("prefix"==ei(e.getParentPath(),this.getParentPath())){const n=e.path.length-1;e.offset<=this.path[n]&&(i.path[n]+=t);}return i}_getTransformedByMove(e,t,i){if(t=t._getTransformedByDeletion(e,i),e.isEqual(t))return ra._createAt(this);const n=this._getTransformedByDeletion(e,i);return null===n||e.isEqual(this)&&"toNext"==this.stickiness||e.getShiftedBy(i).isEqual(this)&&"toPrevious"==this.stickiness?this._getCombined(e,t):n._getTransformedByInsertion(t,i)}_getCombined(e,t){const i=e.path.length-1,n=ra._createAt(t);return n.stickiness=this.stickiness,n.offset=n.offset+this.path[i]-e.offset,n.path=[...n.path,...this.path.slice(i+1)],n}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,i="toNone"){if(e.is("model:position"))return new ra(e.root,e.path,e.stickiness);{const n=e;if("end"==t)t=n.maxOffset;else {if("before"==t)return this._createBefore(n,i);if("after"==t)return this._createAfter(n,i);if(0!==t&&!t)throw new I("model-createpositionat-offset-required",[this,e])}if(!n.is("element")&&!n.is("documentFragment"))throw new I("model-position-parent-incorrect",[this,e]);const s=n.getPath();return s.push(t),new this(n.root,s,i)}}static _createAfter(e,t){if(!e.parent)throw new I("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 I("model-position-before-root",e,{root:e});return this._createAt(e.parent,e.startOffset,t)}static fromJSON(e,t){if("$graveyard"===e.root){const i=new ra(t.graveyard,e.path);return i.stickiness=e.stickiness,i}if(!t.getRoot(e.root))throw new I("model-position-fromjson-no-root",t,{rootName:e.root});return new ra(t.getRoot(e.root),e.path,e.stickiness)}}function aa(e,t){const i=t.getChildAtOffset(e.offset);return i&&i.is("$text")&&i.startOffset<e.offset?i:null}function la(e,t,i){return null!==i?null:t.getChildAtOffset(e.offset)}function ca(e,t,i){return null!==i?null:t.getChild(t.offsetToIndex(e.offset)-1)}function ua(e,t,i){return i+1!==e.path.length&&(!!da(t.path,i+1)&&!!function(e,t){let i=e.parent,n=e.path.length-1,s=0;for(;n>=t;){if(e.path[n]+s!==i.maxOffset)return  false;s=1,n--,i=i.parent;}return  true}(e,i+1))}function da(e,t){for(;t<e.length;){if(0!==e[t])return  false;t++;}return  true}ra.prototype.is=function(e){return "position"===e||"model:position"===e};class ha extends ia{start;end;constructor(e,t){super(),this.start=ra._createAt(e),this.end=t?ra._createAt(t):ra._createAt(e),this.start.stickiness=this.isCollapsed?"toNone":"toNext",this.end.stickiness=this.isCollapsed?"toNone":"toPrevious";}*[Symbol.iterator](){yield*new sa({boundaries:this,ignoreElementEnd:true});}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return "same"==ei(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=false){e.isCollapsed&&(t=false);const i=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),n=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return i&&n}containsItem(e){const t=ra._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 ha(this.start,e.start)),this.containsPosition(e.end)&&t.push(new ha(e.end,this.end))):t.push(new ha(this.start,this.end)),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,i=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(i=e.end),new ha(t,i)}return null}getJoined(e,t=false){let i=this.isIntersecting(e);if(i||(i=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)),!i)return null;let n=this.start,s=this.end;return e.start.isBefore(n)&&(n=e.start),e.end.isAfter(s)&&(s=e.end),new ha(n,s)}getMinimalFlatRanges(){const e=[],t=this.start.getCommonPath(this.end).length,i=ra._createAt(this.start);let n=i.parent;for(;i.path.length>t+1;){const t=n.maxOffset-i.offset;0!==t&&e.push(new ha(i,i.getShiftedBy(t))),i.path=i.path.slice(0,-1),i.offset++,n=n.parent;}for(;i.path.length<=this.end.path.length;){const t=this.end.path[i.path.length-1],n=t-i.offset;0!==n&&e.push(new ha(i,i.getShiftedBy(n))),i.offset=t,i.path.push(0);}return e}getWalker(e={}){return e.boundaries=this,new sa(e)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=true;const t=new sa(e);for(const e of t)yield e.item;}*getPositions(e={}){e.boundaries=this;const t=new sa(e);yield t.position;for(const e of t)yield e.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 ha(this.start,this.end)]}getTransformedByOperations(e){const t=[new ha(this.start,this.end)];for(const i of e)for(let e=0;e<t.length;e++){const n=t[e].getTransformedByOperation(i);t.splice(e,1,...n),e+=n.length-1;}for(let e=0;e<t.length;e++){const i=t[e];for(let n=e+1;n<t.length;n++){const e=t[n];(i.containsRange(e)||e.containsRange(i)||i.isEqual(e))&&t.splice(n,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=false){return this._getTransformedByInsertion(e.position,e.howMany,t)}_getTransformedByMoveOperation(e,t=false){const i=e.sourcePosition,n=e.howMany,s=e.targetPosition;return this._getTransformedByMove(i,s,n,t)}_getTransformedBySplitOperation(e){const t=this.start._getTransformedBySplitOperation(e);let i=this.end._getTransformedBySplitOperation(e);return this.end.isEqual(e.insertionPosition)&&(i=this.end.getShiftedBy(1)),t.root!=i.root&&(i=this.end.getShiftedBy(-1)),new ha(t,i)}_getTransformedByMergeOperation(e){if(this.start.isEqual(e.targetPosition)&&this.end.isEqual(e.deletionPosition))return new ha(this.start);let t=this.start._getTransformedByMergeOperation(e),i=this.end._getTransformedByMergeOperation(e);return t.root!=i.root&&(i=this.end.getShiftedBy(-1)),t.isAfter(i)?(e.sourcePosition.isBefore(e.targetPosition)?(t=ra._createAt(i),t.offset=0):(e.deletionPosition.isEqual(t)||(i=e.deletionPosition),t=e.targetPosition),new ha(t,i)):new ha(t,i)}_getTransformedByInsertion(e,t,i=false){if(i&&this.containsPosition(e))return [new ha(this.start,e),new ha(e.getShiftedBy(t),this.end._getTransformedByInsertion(e,t))];{const i=new ha(this.start,this.end);return i.start=i.start._getTransformedByInsertion(e,t),i.end=i.end._getTransformedByInsertion(e,t),[i]}}_getTransformedByMove(e,t,i,n=false){if(this.isCollapsed){const n=this.start._getTransformedByMove(e,t,i);return [new ha(n)]}const s=ha._createFromPositionAndShift(e,i),o=t._getTransformedByDeletion(e,i);if(this.containsPosition(t)&&!n&&(s.containsPosition(this.start)||s.containsPosition(this.end))){const n=this.start._getTransformedByMove(e,t,i),s=this.end._getTransformedByMove(e,t,i);return [new ha(n,s)]}let r;const a=this.getDifference(s);let l=null;const c=this.getIntersection(s);if(1==a.length?l=new ha(a[0].start._getTransformedByDeletion(e,i),a[0].end._getTransformedByDeletion(e,i)):2==a.length&&(l=new ha(this.start,this.end._getTransformedByDeletion(e,i))),r=l?l._getTransformedByInsertion(o,i,null!==c||n):[],c){const e=new ha(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 i=this.start._getTransformedByDeletion(e,t),n=this.end._getTransformedByDeletion(e,t);return null==i&&null==n?null:(null==i&&(i=e),null==n&&(n=e),new ha(i,n))}static _createFromPositionAndShift(e,t){const i=e,n=e.getShiftedBy(t);return t>0?new this(i,n):new this(n,i)}static _createIn(e){return new this(ra._createAt(e,0),ra._createAt(e,e.maxOffset))}static _createOn(e){return this._createFromPositionAndShift(ra._createBefore(e),e.offsetSize)}static _createFromRanges(e){if(0===e.length)throw new I("range-create-from-ranges-empty-array",null);if(1==e.length)return e[0].clone();const t=e[0];e.sort((e,t)=>e.start.isAfter(t.start)?1:-1);const i=e.indexOf(t),n=new this(t.start,t.end);for(let t=i-1;t>=0&&e[t].end.isEqual(n.start);t--)n.start=ra._createAt(e[t].start);for(let t=i+1;t<e.length&&e[t].start.isEqual(n.end);t++)n.end=ra._createAt(e[t].end);return n}static fromJSON(e,t){return new this(ra.fromJSON(e.start,t),ra.fromJSON(e.end,t))}}ha.prototype.is=function(e){return "range"===e||"model:range"===e};class ma extends(z()){_modelToViewMapping=new WeakMap;_viewToModelMapping=new WeakMap;_viewToModelLengthCallbacks=new Map;_markerNameToElements=new Map;_elementToMarkerNames=new Map;_deferredBindingRemovals=new Map;_unboundMarkerNames=new Set;_cache=new ga;constructor(){super(),this.on("modelToViewPosition",(e,t)=>{if(t.viewPosition)return;const i=this._modelToViewMapping.get(t.modelPosition.parent);if(!i)throw new I("mapping-model-position-view-parent-not-found",this,{modelPosition:t.modelPosition});t.viewPosition=this.findPositionIn(i,t.modelPosition.offset);},{priority:"low"}),this.on("viewToModelPosition",(e,t)=>{if(t.modelPosition)return;const i=this.findMappedViewAncestor(t.viewPosition),n=this._viewToModelMapping.get(i),s=this._toModelOffset(t.viewPosition.parent,t.viewPosition.offset,i);t.modelPosition=ra._createAt(n,s);},{priority:"low"});}bindElements(e,t){this._modelToViewMapping.set(e,t),this._viewToModelMapping.set(t,e);}unbindViewElement(e,t={}){const i=this.toModelElement(e);if(this._elementToMarkerNames.has(e))for(const t of this._elementToMarkerNames.get(e))this._unboundMarkerNames.add(t);if(t.defer)this._deferredBindingRemovals.set(e,e.root);else {this._viewToModelMapping.delete(e)&&this._cache.stopTracking(e),this._modelToViewMapping.get(i)==e&&this._modelToViewMapping.delete(i);}}unbindModelElement(e){const t=this.toViewElement(e);if(this._modelToViewMapping.delete(e),this._viewToModelMapping.get(t)==e){this._viewToModelMapping.delete(t)&&this._cache.stopTracking(t);}}bindElementToMarker(e,t){const i=this._markerNameToElements.get(t)||new Set;i.add(e);const n=this._elementToMarkerNames.get(e)||new Set;n.add(t),this._markerNameToElements.set(t,i),this._elementToMarkerNames.set(e,n);}unbindElementFromMarkerName(e,t){const i=this._markerNameToElements.get(t);i&&(i.delete(e),0==i.size&&this._markerNameToElements.delete(t));const n=this._elementToMarkerNames.get(e);n&&(n.delete(t),0==n.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 ha(this.toModelPosition(e.start),this.toModelPosition(e.end))}toViewRange(e){return new Po(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 i={modelPosition:e,mapper:this,isPhantom:t.isPhantom};return this.fire("modelToViewPosition",i),i.viewPosition}markerNameToElements(e){const t=this._markerNameToElements.get(e);if(!t)return null;const i=new Set;for(const e of t)if(e.is("attributeElement"))for(const t of e.getElementsWithSameId())i.add(t);else i.add(e);return i}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,i){if(i!=e){return this._toModelOffset(e.parent,e.index,i)+this._toModelOffset(e,t,e)}if(e.is("$text"))return t;let n=0;for(let i=0;i<t;i++)n+=this.getModelLength(e.getChild(i));return n}getModelLength(e){const t=[e];let i=0;for(;t.length>0;){const e=t.pop(),n=e.name&&this._viewToModelLengthCallbacks.size>0&&this._viewToModelLengthCallbacks.get(e.name);if(n)i+=n(e);else if(this._viewToModelMapping.has(e))i+=1;else if(e.is("$text"))i+=e.data.length;else {if(e.is("uiElement"))continue;for(const i of e.getChildren())t.push(i);}}return i}findPositionIn(e,t){if(0===t)return this._moveViewPositionToTextNode(new Io(e,0));if(0==this._viewToModelLengthCallbacks.size&&this._viewToModelMapping.has(e)){const i=this._cache.getClosest(e,t);return this._findPositionStartingFrom(i.viewPosition,i.modelOffset,t,e,true)}return this._findPositionStartingFrom(new Io(e,0),0,t,e,false)}_findPositionStartingFrom(e,t,i,n,s){let o,r=e.parent,a=e.offset;if(r.is("$text"))return new Io(r,i-t);let l=t,c=0;for(;l<i;)if(o=r.getChild(a),o)c=s?this._getModelLengthAndCache(o,n,l):this.getModelLength(o),l+=c,a++;else {if(r==n)throw new I("mapping-model-offset-not-found",this,{modelOffset:i,viewContainer:n});a=r.parent.getChildIndex(r)+1,r=r.parent,s&&this._cache.save(r,a,n,l);}let u=new Io(r,a);if(s)for(;u.isAtEnd&&u.parent!==n&&u.parent.parent;){const e=u.parent.parent,t=e.getChildIndex(u.parent)+1;this._cache.save(e,t,n,l),u=new Io(e,t);}return l==i?this._moveViewPositionToTextNode(u):this._findPositionStartingFrom(new Io(o,0),l-c,i,n,s)}_getModelLengthAndCache(e,t,i){let n=0;if(this._viewToModelMapping.has(e))n=1;else if(e.is("$text"))n=e.data.length;else if(!e.is("uiElement"))for(const s of e.getChildren())n+=this._getModelLengthAndCache(s,t,i+n);return this._cache.save(e.parent,e.index+1,t,i+n),n}_moveViewPositionToTextNode(e){const t=e.nodeBefore,i=e.nodeAfter;return t&&t.is("view:$text")?new Io(t,t.data.length):i&&i.is("view:$text")?new Io(i,0):e}}class ga extends(z()){_cachedMapping=new WeakMap;_nodeToCacheListIndex=new WeakMap;_invalidateOnChildrenChangeCallback=(e,t,i)=>{this._clearCacheInsideParent(t,i.index);};_invalidateOnTextChangeCallback=(e,t)=>{this._clearCacheAfter(t);};save(e,t,i,n){const s=this._cachedMapping.get(i),o=s.cacheMap.get(n);if(o){const i=e.getChild(t-1),n=o.viewPosition.nodeBefore?this._nodeToCacheListIndex.get(o.viewPosition.nodeBefore):0;return void this._nodeToCacheListIndex.set(i,n)}const r={viewPosition:new Io(e,t),modelOffset:n};s.maxModelOffset=n>s.maxModelOffset?n:s.maxModelOffset,s.cacheMap.set(n,r);let a=s.cacheList.length-1;for(;a>=0&&s.cacheList[a].modelOffset>n;)a--;if(s.cacheList.splice(a+1,0,r),t>0){const i=e.getChild(t-1);this._nodeToCacheListIndex.set(i,a+1);}}getClosest(e,t){const i=this._cachedMapping.get(e);let n;if(i)if(t>i.maxModelOffset)n=i.cacheList[i.cacheList.length-1];else {const e=i.cacheMap.get(t);n=e||this._findInCacheList(i.cacheList,t);}else n=this.startTracking(e);return {modelOffset:n.modelOffset,viewPosition:n.viewPosition.clone()}}startTracking(e){const t={viewPosition:new Io(e,0),modelOffset:0},i={maxModelOffset:0,cacheList:[t],cacheMap:new Map([[0,t]])};return this._cachedMapping.set(e,i),e.on("change:children",this._invalidateOnChildrenChangeCallback),e.on("change:text",this._invalidateOnTextChangeCallback),t}stopTracking(e){e.off("change:children",this._invalidateOnChildrenChangeCallback),e.off("change:text",this._invalidateOnTextChangeCallback),this._cachedMapping.delete(e);}_clearCacheInsideParent(e,t){if(0==t)this._cachedMapping.has(e)?this._clearCacheAll(e):this._clearCacheInsideParent(e.parent,e.index);else {const i=e.getChild(t-1);this._clearCacheAfter(i);}}_clearCacheAll(e){const t=this._cachedMapping.get(e);t.maxModelOffset>0&&(t.maxModelOffset=0,t.cacheList.length=1,t.cacheMap.clear(),t.cacheMap.set(0,t.cacheList[0]));}_clearCacheAfter(e){const t=this._nodeToCacheListIndex.get(e);if(void 0===t){const t=e.parent;return void(this._cachedMapping.has(t)||this._clearCacheInsideParent(t.parent,t.index))}let i=e.parent;for(;!this._cachedMapping.has(i);)i=i.parent;this._clearCacheFromCacheIndex(i,t);}_clearCacheFromCacheIndex(e,t){0===t&&(t=1);const i=this._cachedMapping.get(e),n=i.cacheList[t-1];if(!n)return;i.maxModelOffset=n.modelOffset;const s=i.cacheList.splice(t);for(const e of s){i.cacheMap.delete(e.modelOffset);const t=e.viewPosition.nodeBefore;this._nodeToCacheListIndex.delete(t);}}_findInCacheList(e,t){let i=0,n=e.length-1,s=n-i>>1,o=e[s];for(;i<n;)o.modelOffset<t?i=s+1:n=s-1,s=i+(n-i>>1),o=e[s];return o.modelOffset<=t?o:e[s-1]}}class fa{_consumable=new Map;_textProxyRegistry=new Map;add(e,t){t=pa(t),e instanceof na&&(e=this._getSymbolForTextProxy(e)),this._consumable.has(e)||this._consumable.set(e,new Map),this._consumable.get(e).set(t,true);}consume(e,t){return t=pa(t),e instanceof na&&(e=this._getSymbolForTextProxy(e)),!!this.test(e,t)&&(this._consumable.get(e).set(t,false),true)}test(e,t){t=pa(t),e instanceof na&&(e=this._getSymbolForTextProxy(e));const i=this._consumable.get(e);if(void 0===i)return null;const n=i.get(t);return void 0===n?null:n}revert(e,t){t=pa(t),e instanceof na&&(e=this._getSymbolForTextProxy(e));const i=this.test(e,t);return  false===i?(this._consumable.get(e).set(t,true),true):true!==i&&null}verifyAllConsumed(e){const t=[];for(const[i,n]of this._consumable)for(const[s,o]of n){const n=s.split(":")[0];o&&e==n&&t.push({event:s,item:i.name||i.description});}if(t.length)throw new I("conversion-model-consumable-not-consumed",null,{items:t})}_getSymbolForTextProxy(e){let t=null;const i=this._textProxyRegistry.get(e.startOffset);if(i){const n=i.get(e.endOffset);n&&(t=n.get(e.parent));}return t||(t=this._addSymbolForTextProxy(e)),t}_addSymbolForTextProxy(e){const t=e.startOffset,i=e.endOffset,n=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(i),r||(r=new Map,o.set(i,r)),r.set(n,s),s}}function pa(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 ba extends(z()){_conversionApi;_firedEventsMap;constructor(e){super(),this._conversionApi={dispatcher:this,...e},this._firedEventsMap=new WeakMap;}convertChanges(e,t,i){const n=e.getRefreshedItems(),s=this._createConversionApi(i,n);for(const t of e.getMarkersToRemove())this._convertMarkerRemove(t.name,t.range,s);const o=this._reduceChanges(e.getChanges(),n);for(const e of o)"insert"===e.type?this._convertInsert(ha._createFromPositionAndShift(e.position,e.length),s):"reinsert"===e.type?this._convertReinsert(ha._createFromPositionAndShift(e.position,e.length),s):"remove"===e.type?this._convertRemove(e.position,e.length,e.name,s):this._convertAttribute(e.range,e.attributeKey,e.attributeOldValue,e.attributeNewValue,s);s.mapper.flushDeferredBindings();for(const e of s.mapper.flushUnboundMarkerNames()){const i=t.get(e).getRange();this._convertMarkerRemove(e,i,s),this._convertMarkerAdd(e,i,s);}for(const t of e.getMarkersToAdd())this._convertMarkerAdd(t.name,t.range,s);s.consumable.verifyAllConsumed("insert");}convert(e,t,i,n={}){const s=this._createConversionApi(i,void 0,n);this._convertInsert(e,s);for(const[e,i]of t)this._convertMarkerAdd(e,i,s);s.consumable.verifyAllConsumed("insert");}convertSelection(e,t,i){const n=this._createConversionApi(i);this.fire("cleanSelection",{selection:e},n);const s=e.getFirstPosition().root;if(!n.mapper.toViewElement(s))return;const o=Array.from(t.getMarkersAtPosition(e.getFirstPosition()));if(this._addConsumablesForSelection(n.consumable,e,o),this.fire("selection",{selection:e},n),e.isCollapsed){for(const t of o)if(n.consumable.test(e,"addMarker:"+t.name)){const i=t.getRange();if(!wa(e.getFirstPosition(),t,n.mapper))continue;const s={item:e,markerName:t.name,markerRange:i};this.fire(`addMarker:${t.name}`,s,n);}for(const t of e.getAttributeKeys())if(n.consumable.test(e,"attribute:"+t)){const i={item:e,range:e.getFirstRange(),attributeKey:t,attributeOldValue:null,attributeNewValue:e.getAttribute(t)};this.fire(`attribute:${t}:$text`,i,n);}}}_convertInsert(e,t,i={}){i.doNotAddConsumables||this._addConsumablesForInsert(t.consumable,e);for(const i of e.getWalker({shallow:true}))this._testAndFire("insert",va(i),t);}_convertRemove(e,t,i,n){this.fire(`remove:${i}`,{position:e,length:t},n);}_convertAttribute(e,t,i,n,s){this._addConsumablesForRange(s.consumable,e,`attribute:${t}`);for(const o of e){const e={item:o.item,range:ha._createFromPositionAndShift(o.previousPosition,o.length),attributeKey:t,attributeOldValue:i,attributeNewValue:n};this._testAndFire(`attribute:${t}`,e,s);}}_convertReinsert(e,t){const i=Array.from(e.getWalker({shallow:true}));this._addConsumablesForInsert(t.consumable,i);for(const e of i.map(va))this.fire(`remove:${e.item.is("element")?e.item.name:"$text"}`,{position:e.range.start,length:e.item.offsetSize,reconversion:true},t),this._testAndFire("insert",{...e,reconversion:true},t);}_convertMarkerAdd(e,t,i){if("$graveyard"==t.root.rootName)return;const n=`addMarker:${e}`;if(i.consumable.add(t,n),this.fire(n,{markerName:e,markerRange:t},i),i.consumable.consume(t,n)){this._addConsumablesForRange(i.consumable,t,n);for(const s of t.getItems()){if(!i.consumable.test(s,n))continue;const o={item:s,range:ha._createOn(s),markerName:e,markerRange:t};this.fire(n,o,i);}}}_convertMarkerRemove(e,t,i){"$graveyard"!=t.root.rootName&&this.fire(`removeMarker:${e}`,{markerName:e,markerRange:t},i);}_reduceChanges(e,t){const i={changes:e,refreshedItems:t};return this.fire("reduceChanges",i),i.changes}_addConsumablesForInsert(e,t){for(const i of t){const t=i.item;if(null===e.test(t,"insert")){e.add(t,"insert");for(const i of t.getAttributeKeys())e.add(t,"attribute:"+i);}}return e}_addConsumablesForRange(e,t,i){for(const n of t.getItems())e.add(n,i);return e}_addConsumablesForSelection(e,t,i){e.add(t,"selection");for(const n of i)e.add(t,"addMarker:"+n.name);for(const i of t.getAttributeKeys())e.add(t,"attribute:"+i);return e}_testAndFire(e,t,i){const n=function(e,t){const i=t.item.is("element")?t.item.name:"$text";return `${e}:${i}`}(e,t),s=t.item.is("$textProxy")?i.consumable._getSymbolForTextProxy(t.item):t.item,o=this._firedEventsMap.get(i),r=o.get(s);if(r){if(r.has(n))return;r.add(n);}else o.set(s,new Set([n]));this.fire(n,t,i);}_testAndFireAddAttributes(e,t){const i={item:e,range:ha._createOn(e)};for(const e of i.item.getAttributeKeys())i.attributeKey=e,i.attributeOldValue=null,i.attributeNewValue=i.item.getAttribute(e),this._testAndFire(`attribute:${e}`,i,t);}_createConversionApi(e,t=new Set,i={}){const n={...this._conversionApi,consumable:new fa,writer:e,options:i,convertItem:e=>this._convertInsert(ha._createOn(e),n),convertChildren:e=>this._convertInsert(ha._createIn(e),n,{doNotAddConsumables:true}),convertAttributes:e=>this._testAndFireAddAttributes(e,n),canReuseView:e=>!t.has(n.mapper.toModelElement(e))};return this._firedEventsMap.set(n,new Map),n}}function wa(e,t,i){const n=t.getRange(),s=Array.from(e.getAncestors());s.shift(),s.reverse();const o=s.some(e=>{if(n.containsItem(e)){return !!i.toViewElement(e).getCustomProperty("addHighlight")}});return !o}function va(e){return {item:e.item,range:ha._createFromPositionAndShift(e.previousPosition,e.length)}}class _a extends ia{parent=null;_attrs;_index=null;_startOffset=null;constructor(e){super(),this._attrs=Vn(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 i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}getCommonAncestor(e,t={}){const i=this.getAncestors(t),n=e.getAncestors(t);let s=0;for(;i[s]==n[s]&&i[s];)s++;return 0===s?null:i[s-1]}isBefore(e){if(this==e)return  false;if(this.root!==e.root)return  false;const t=this.getPath(),i=e.getPath(),n=ei(t,i);switch(n){case "prefix":return  true;case "extension":return  false;default:return t[n]<i[n]}}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=Vn(e);}_removeAttribute(e){return this._attrs.delete(e)}_clearAttributes(){this._attrs.clear();}}_a.prototype.is=function(e){return "node"===e||"model:node"===e};class ya extends(z(ia)){_lastRangeBackward=false;_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  false;if(0===this.rangeCount)return  true;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return  false;for(const t of this._ranges){let i=false;for(const n of e._ranges)if(t.isEqual(n)){i=true;break}if(!i)return  false}return  true}*getRanges(){for(const e of this._ranges)yield new ha(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 ha(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 ha(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,i,n]=e;if("object"==typeof i&&(n=i,i=void 0),null===t)this._setRanges([]);else if(t instanceof ya)this._setRanges(t.getRanges(),t.isBackward);else if(t&&"function"==typeof t.getRanges)this._setRanges(t.getRanges(),t.isBackward);else if(t instanceof ha)this._setRanges([t],!!n&&!!n.backward);else if(t instanceof ra)this._setRanges([new ha(t)]);else if(t instanceof _a){const e=!!n&&!!n.backward;let s;if("in"==i)s=ha._createIn(t);else if("on"==i)s=ha._createOn(t);else {if(void 0===i)throw new I("model-selection-setto-required-second-parameter",[this,t]);s=new ha(ra._createAt(t,i));}this._setRanges([s],e);}else {if(!ti(t))throw new I("model-selection-setto-not-selectable",[this,t]);this._setRanges(t,n&&!!n.backward);}}_setRanges(e,t=false){const i=Array.from(e),n=i.some(t=>{if(!(t instanceof ha))throw new I("model-selection-set-ranges-not-range",[this,e]);return this._ranges.every(e=>!e.isEqual(t))});(i.length!==this._ranges.length||n)&&(this._replaceAllRanges(i),this._lastRangeBackward=!!t,this.fire("change:range",{directChange:true}));}setFocus(e,t){if(null===this.anchor)throw new I("model-selection-setfocus-no-ranges",[this,e]);const i=ra._createAt(e,t);if("same"==i.compareWith(this.focus))return;const n=this.anchor;this._ranges.length&&this._popRange(),"before"==i.compareWith(n)?(this._pushRange(new ha(i,n)),this._lastRangeBackward=true):(this._pushRange(new ha(n,i)),this._lastRangeBackward=false),this.fire("change:range",{directChange:true});}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:true}));}setAttribute(e,t){this.getAttribute(e)!==t&&(this._attrs.set(e,t),this.fire("change:attribute",{attributeKeys:[e],directChange:true}));}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}*getSelectedBlocks(){const e=new WeakSet;for(const t of this.getRanges()){const i=xa(t.start,e);Ea(i,t)&&(yield i);const n=t.getWalker();for(const i of n){const s=i.item;"elementEnd"==i.type&&Ca(s,e,t)?yield s:"elementStart"==i.type&&s.is("model:element")&&s.root.document.model.schema.isBlock(s)&&n.jumpTo(ra._createAt(s,"end"));}const s=xa(t.end,e);Ta(s,t)&&(yield s);}}containsEntireContent(e=this.anchor.root){const t=ra._createAt(e,0),i=ra._createAt(e,"end");return t.isTouching(this.getFirstPosition())&&i.isTouching(this.getLastPosition())}toJSON(){const e={ranges:Array.from(this.getRanges()).map(e=>e.toJSON())},t=Object.fromEntries(this.getAttributes());return Object.keys(t).length&&(e.attributes=t),this.isBackward&&(e.isBackward=true),e}_pushRange(e){this._checkRange(e),this._ranges.push(new ha(e.start,e.end));}_checkRange(e){for(let t=0;t<this._ranges.length;t++)if(e.isIntersecting(this._ranges[t]))throw new I("model-selection-range-intersects",[this,e],{addedRange:e,intersectingRange:this._ranges[t]})}_replaceAllRanges(e){this._removeAllRanges();for(const t of e)this._pushRange(t);}_removeAllRanges(){for(;this._ranges.length>0;)this._popRange();}_popRange(){this._ranges.pop();}}function ka(e,t){return !t.has(e)&&(t.add(e),e.root.document.model.schema.isBlock(e)&&!!e.parent)}function Ca(e,t,i){return ka(e,t)&&Aa(e,i)}function xa(e,t){const i=e.parent.root.document.model.schema,n=e.parent.getAncestors({parentFirst:true,includeSelf:true});let s=false;const o=n.find(e=>!s&&(s=i.isLimit(e),!s&&ka(e,t)));return n.forEach(e=>t.add(e)),o}function Aa(e,t){const i=function(e){const t=e.root.document.model.schema;let i=e.parent;for(;i;){if(t.isBlock(i))return i;i=i.parent;}}(e);if(!i)return  true;return !t.containsRange(ha._createOn(i),true)}function Ea(e,t){return !!e&&(!(!t.isCollapsed&&!e.isEmpty)||!t.start.isTouching(ra._createAt(e,e.maxOffset))&&Aa(e,t))}function Ta(e,t){return !!e&&(!(!t.isCollapsed&&!e.isEmpty)||!t.end.isTouching(ra._createAt(e,0))&&Aa(e,t))}ya.prototype.is=function(e){return "selection"===e||"model:selection"===e};class Sa extends(z(ha)){constructor(e,t){super(e,t),Ia.call(this);}detach(){this.stopListening();}toRange(){return new ha(this.start,this.end)}static fromRange(e){return new Sa(e.start,e.end)}}function Ia(){this.listenTo(this.root.document.model,"applyOperation",(e,t)=>{const i=t[0];i.isDocumentOperation&&Pa.call(this,i);},{priority:"low"});}function Pa(e){const t=this.getTransformedByOperation(e),i=ha._createFromRanges(t),n=!i.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  false}(this,e);let o=null;if(n){"$graveyard"==i.root.rootName&&(o="remove"==e.type?e.sourcePosition:e.deletionPosition);const t=this.toRange();this.start=i.start,this.end=i.end,this.fire("change:range",t,{deletionPosition:o});}else s&&this.fire("change:content",this.toRange(),{deletionPosition:o});}Sa.prototype.is=function(e){return "liveRange"===e||"model:liveRange"===e||"range"==e||"model:range"===e};class Va extends _a{_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 Va(this.data,this.getAttributes())}static fromJSON(e){return new Va(e.data,e.attributes)}}Va.prototype.is=function(e){return "$text"===e||"model:$text"===e||"text"===e||"model:text"===e||"node"===e||"model:node"===e};const Ra="selection:";class Oa extends(z(ia)){_selection;constructor(e){super(),this._selection=new Ba(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(false);}observeMarkers(e){this._selection.observeMarkers(e);}toJSON(){return this._selection.toJSON()}_setFocus(e,t){this._selection.setFocus(e,t);}_setTo(...e){this._selection.setTo(...e);}_setAttribute(e,t){this._selection.setAttribute(e,t);}_removeAttribute(e){this._selection.removeAttribute(e);}_getStoredAttributes(){return this._selection.getStoredAttributes()}_overrideGravity(){return this._selection.overrideGravity()}_restoreGravity(e){this._selection.restoreGravity(e);}static _getStoreAttributeKey(e){return Ra+e}static _isStoreAttributeKey(e){return e.startsWith(Ra)}}Oa.prototype.is=function(e){return "selection"===e||"model:selection"==e||"documentSelection"==e||"model:documentSelection"==e};class Ba extends ya{markers=new kn({idProperty:"name"});_model;_document;_attributePriority=new Map;_selectionRestorePosition=null;_hasChangedRange=false;_overriddenGravityRegister=new Set;_observedMarkers=new Set;constructor(e){super(),this._model=e.model,this._document=e,this.listenTo(this._model,"applyOperation",(e,t)=>{const i=t[0];i.isDocumentOperation&&"marker"!=i.type&&"rename"!=i.type&&"noop"!=i.type&&(0==this._ranges.length&&this._selectionRestorePosition&&this._fixGraveyardSelection(this._selectionRestorePosition),this._selectionRestorePosition=null,this._hasChangedRange&&(this._hasChangedRange=false,this.fire("change:range",{directChange:false})));},{priority:"lowest"}),this.on("change:range",()=>{this._validateSelectionRanges(this.getRanges());}),this.listenTo(this._model.markers,"update",(e,t,i,n)=>{this._updateMarker(t,n);}),this.listenTo(this._document,"change",(e,t)=>{!function(e,t){const i=e.document.differ;for(const n of i.getChanges()){if("insert"!=n.type)continue;const i=n.position.parent;n.length===i.maxOffset&&e.enqueueChange(t,e=>{const t=Array.from(i.getAttributeKeys()).filter(e=>e.startsWith(Ra));for(const n of t)e.removeAttribute(n,i);});}}(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(true),this.updateMarkers();}setFocus(e,t){super.setFocus(e,t),this._updateAttributes(true),this.updateMarkers();}setAttribute(e,t){if(this._setAttribute(e,t)){const t=[e];this.fire("change:attribute",{attributeKeys:t,directChange:true});}}removeAttribute(e){if(this._removeAttribute(e)){const t=[e];this.fire("change:attribute",{attributeKeys:t,directChange:true});}}overrideGravity(){const e=A();return this._overriddenGravityRegister.add(e),1===this._overriddenGravityRegister.size&&this._updateAttributes(true),e}restoreGravity(e){if(!this._overriddenGravityRegister.has(e))throw new I("document-selection-gravity-wrong-restore",this,{uid:e});this._overriddenGravityRegister.delete(e),this.isGravityOverridden||this._updateAttributes(true);}observeMarkers(e){this._observedMarkers.add(e),this.updateMarkers();}_replaceAllRanges(e){this._validateSelectionRanges(e),super._replaceAllRanges(e);}_popRange(){this._ranges.pop().detach();}_pushRange(e){const t=this._prepareRange(e);t&&this._ranges.push(t);}toJSON(){const e=super.toJSON();return this.markers.length&&(e.markers=this.markers.map(e=>e.toJSON())),e}_validateSelectionRanges(e){for(const t of e)if(!this._document._validateSelectionRange(t))throw new I("document-selection-wrong-position",this,{range:t})}_prepareRange(e){if(this._checkRange(e),e.root==this._document.graveyard)return;const t=Sa.fromRange(e);return t.on("change:range",(e,i,n)=>{if(this._hasChangedRange=true,t.root==this._document.graveyard){this._selectionRestorePosition=n.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=false;for(const t of this._model.markers){const i=t.name.split(":",1)[0];if(!this._observedMarkers.has(i))continue;const n=t.getRange();for(const i of this.getRanges())n.containsRange(i,!i.isCollapsed)&&e.push(t);}const i=Array.from(this.markers);for(const i of e)this.markers.has(i)||(this.markers.add(i),t=true);for(const i of Array.from(this.markers))e.includes(i)||(this.markers.remove(i),t=true);t&&this.fire("change:marker",{oldMarkers:i,directChange:false});}_updateMarker(e,t){const i=e.name.split(":",1)[0];if(!this._observedMarkers.has(i))return;let n=false;const s=Array.from(this.markers),o=this.markers.has(e);if(t){let i=false;for(const e of this.getRanges())if(t.containsRange(e,!e.isCollapsed)){i=true;break}i&&!o?(this.markers.add(e),n=true):!i&&o&&(this.markers.remove(e),n=true);}else o&&(this.markers.remove(e),n=true);n&&this.fire("change:marker",{oldMarkers:s,directChange:false});}_updateAttributes(e){const t=Vn(this._getSurroundingAttributes()),i=Vn(this.getAttributes());if(e)this._attributePriority=new Map,this._attrs=new Map;else for(const[e,t]of this._attributePriority)"low"==t&&(this._attrs.delete(e),this._attributePriority.delete(e));this._setAttributesTo(t);const n=[];for(const[e,t]of this.getAttributes())i.has(e)&&i.get(e)===t||n.push(e);for(const[e]of i)this.hasAttribute(e)||n.push(e);n.length>0&&this.fire("change:attribute",{attributeKeys:n,directChange:false});}_setAttribute(e,t,i=true){const n=i?"normal":"low";if("low"==n&&"normal"==this._attributePriority.get(e))return  false;return super.getAttribute(e)!==t&&(this._attrs.set(e,t),this._attributePriority.set(e,n),true)}_removeAttribute(e,t=true){const i=t?"normal":"low";return ("low"!=i||"normal"!=this._attributePriority.get(e))&&(this._attributePriority.set(e,i),!!super.hasAttribute(e)&&(this._attrs.delete(e),true))}_setAttributesTo(e){const t=new Set;for(const[t,i]of this.getAttributes())e.get(t)!==i&&this._removeAttribute(t,false);for(const[i,n]of e){this._setAttribute(i,n,false)&&t.add(i);}return t}*getStoredAttributes(){const e=this.getFirstPosition().parent;if(this.isCollapsed&&e.isEmpty)for(const t of e.getAttributeKeys())if(t.startsWith(Ra)){const i=t.substr(10);yield [i,e.getAttribute(t)];}}_getSurroundingAttributes(){const e=this.getFirstPosition(),t=this._model.schema;if("$graveyard"==e.root.rootName)return null;let i=null;if(this.isCollapsed){const n=e.textNode?e.textNode:e.nodeBefore,s=e.textNode?e.textNode:e.nodeAfter;if(this.isGravityOverridden||(i=La(n,t)),i||(i=La(s,t)),!this.isGravityOverridden&&!i){let e=n;for(;e&&!i;)e=e.previousSibling,i=La(e,t);}if(!i){let e=s;for(;e&&!i;)e=e.nextSibling,i=La(e,t);}i||(i=this.getStoredAttributes());}else {const e=this.getFirstRange();for(const n of e){if(n.item.is("element")&&t.isObject(n.item)){i=La(n.item,t);break}if("text"==n.type){i=n.item.getAttributes();break}}}return i}_fixGraveyardSelection(e){const t=this._model.schema.getNearestSelectionRange(e);t&&this._pushRange(t);}}function La(e,t){if(!e)return null;if(e instanceof na||e instanceof Va)return e.getAttributes();if(!t.isInline(e))return null;if(!t.isObject(e))return [];const i=[];for(const[n,s]of e.getAttributes())t.checkAttribute("$text",n)&&false!==t.getAttributeProperties(n).copyFromObject&&i.push([n,s]);return i}class Ma{_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 I("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 I("model-nodelist-offset-out-of-bounds",this,{offset:e,nodeList:this});return this.getNodeIndex(t)}_insertNodes(e,t){const i=[];for(const e of t){if(!(e instanceof _a))throw new I("model-nodelist-insertnodes-not-node",this);i.push(e);}let n=this.indexToOffset(e);Mn(this._nodes,i,e),Mn(this._offsetToNode,function(e){const t=[];let i=0;for(const n of e)for(let e=0;e<n.offsetSize;e++)t[i++]=n;return t}(i),n);for(let t=e;t<this._nodes.length;t++)this._nodes[t]._index=t,this._nodes[t]._startOffset=n,n+=this._nodes[t].offsetSize;}_removeNodes(e,t=1){if(0==t)return [];let i=this.indexToOffset(e);const n=this._nodes.splice(e,t),s=n[n.length-1],o=s.startOffset+s.offsetSize-i;this._offsetToNode.splice(i,o);for(const e of n)e._index=null,e._startOffset=null;for(let t=e;t<this._nodes.length;t++)this._nodes[t]._index=t,this._nodes[t]._startOffset=i,i+=this._nodes[t].offsetSize;return n}_removeNodesArray(e){if(0==e.length)return;for(const t of e)t._index=null,t._startOffset=null;this._nodes=this._nodes.filter(e=>null!==e.index),this._offsetToNode=this._offsetToNode.filter(e=>null!==e.index);let t=0;for(let e=0;e<this._nodes.length;e++)this._nodes[e]._index=e,this._nodes[e]._startOffset=t,t+=this._nodes[e].offsetSize;}toJSON(){return this._nodes.map(e=>e.toJSON())}}class Fa extends _a{name;_children=new Ma;constructor(e,t,i){super(t),this.name=e,i&&this._insertChild(0,i);}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 i of e)t=t.getChildAtOffset(i);return t}findAncestor(e,t={}){let i=t.includeSelf?this:this.parent;for(;i;){if(i.name===e)return i;i=i.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=false){const t=e?function(e){const t=[];for(const i of e)t.push(i._clone(true));return t}(this._children):void 0;return new Fa(this.name,this.getAttributes(),t)}_appendChild(e){this._insertChild(this.childCount,e);}_insertChild(e,t){const i=function(e){if("string"==typeof e)return [new Va(e)];ti(e)||(e=[e]);const t=[];for(const i of e)"string"==typeof i?t.push(new Va(i)):i instanceof na?t.push(new Va(i.data,i.getAttributes())):t.push(i);return t}(t);for(const e of i)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,i);}_removeChildren(e,t=1){const i=this._children._removeNodes(e,t);for(const e of i)e.parent=null;return i}_removeChildrenArray(e){this._children._removeNodesArray(e);for(const t of e)t.parent=null;}static fromJSON(e){let t;if(e.children){t=[];for(const i of e.children)i.name?t.push(Fa.fromJSON(i)):t.push(Va.fromJSON(i));}return new Fa(e.name,e.attributes,t)}}Fa.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 Na{_dispatchers;constructor(e){this._dispatchers=e;}add(e){for(const t of this._dispatchers)e(t);return this}}class Da extends Na{elementToElement(e){return this.add(function(e){const t=el(e.model),i=tl(e.view,"container");t.attributes.length&&(t.children=true);return n=>{n.on(`insert:${t.name}`,Ka(i,rl(t)),{priority:e.converterPriority||"normal"}),(t.children||t.attributes.length)&&n.on("reduceChanges",ol(t),{priority:"low"});}}(e))}elementToStructure(e){return this.add(function(e){const t=el(e.model),i=tl(e.view,"container");return t.children=true,n=>{if(n._conversionApi.schema.checkChild(t.name,"$text"))throw new I("conversion-element-to-structure-disallowed-text",n,{elementName:t.name});n.on(`insert:${t.name}`,Ja(i,rl(t)),{priority:e.converterPriority||"normal"}),n.on("reduceChanges",ol(t),{priority:"low"});}}(e))}attributeToElement(e){return this.add(function(e){e=De(e);let t=e.model;"string"==typeof t&&(t={key:t});let i=`attribute:${t.key}`;t.name&&(i+=":"+t.name);if(t.values)for(const i of t.values)e.view[i]=tl(e.view[i],"attribute");else e.view=tl(e.view,"attribute");const n=il(e);return t=>{t.on(i,Ga(n),{priority:e.converterPriority||"normal"});}}(e))}attributeToAttribute(e){return this.add(function(e){e=De(e);let t=e.model;"string"==typeof t&&(t={key:t});let i=`attribute:${t.key}`;t.name&&(i+=":"+t.name);if(t.values)for(const i of t.values)e.view[i]=nl(e.view[i]);else e.view=nl(e.view);const n=il(e);return t=>{var s;t.on(i,(s=n,(e,t,i)=>{if(!i.consumable.test(t.item,e.name))return;const n=s(t.attributeOldValue,i,t),o=s(t.attributeNewValue,i,t);if(!n&&!o)return;i.consumable.consume(t.item,e.name);const r=i.mapper.toViewElement(t.item),a=i.writer;if(!r)throw new I("conversion-attribute-to-attribute-on-text",i.dispatcher,t);if(null!==t.attributeOldValue&&n){let e=n.value;"style"==n.key&&(e="string"==typeof n.value?new go(a.document.stylesProcessor).setTo(n.value).getStylesEntries().map(([e])=>e):Object.keys(n.value)),a.removeAttribute(n.key,e,r);}if(null!==t.attributeNewValue&&o){let e=o.value;"style"==o.key&&"string"==typeof o.value&&(e=Object.fromEntries(new go(a.document.stylesProcessor).setTo(o.value).getStylesEntries())),a.setAttribute(o.key,e,false,r);}}),{priority:e.converterPriority||"normal"});}}(e))}markerToElement(e){return this.add(function(e){const t=tl(e.view,"ui");return i=>{i.on(`addMarker:${e.model}`,Qa(t),{priority:e.converterPriority||"normal"}),i.on(`removeMarker:${e.model}`,(e,t,i)=>{const n=i.mapper.markerNameToElements(t.markerName);if(n){for(const e of n)i.mapper.unbindElementFromMarkerName(e,t.markerName),i.writer.clear(i.writer.createRangeOn(e),e);i.writer.clearClonedElementsGroup(t.markerName),e.stop();}},{priority:e.converterPriority||"normal"});}}(e))}markerToHighlight(e){return this.add(function(e){return t=>{var i;t.on(`addMarker:${e.model}`,(i=e.view,(e,t,n)=>{if(!t.item)return;if(!(t.item instanceof ya||t.item instanceof Oa||t.item.is("$textProxy")))return;const s=sl(i,t,n);if(!s)return;if(!n.consumable.consume(t.item,e.name))return;const o=n.writer,r=Ua(o,s),a=o.document.selection;if(t.item instanceof ya||t.item instanceof Oa)o.wrap(a.getFirstRange(),r);else {const e=n.mapper.toViewRange(t.range),i=o.wrap(e,r);for(const e of i.getItems())if(e.is("attributeElement")&&e.isSimilar(r)){n.mapper.bindElementToMarker(e,t.markerName);break}}}),{priority:e.converterPriority||"normal"}),t.on(`addMarker:${e.model}`,function(e){return (t,i,n)=>{if(!i.item)return;if(!(i.item instanceof Fa))return;const s=sl(e,i,n);if(!s)return;if(!n.consumable.test(i.item,t.name))return;const o=n.mapper.toViewElement(i.item);if(o&&o.getCustomProperty("addHighlight")){n.consumable.consume(i.item,t.name);for(const e of ha._createIn(i.item))n.consumable.consume(e.item,t.name);o.getCustomProperty("addHighlight")(o,s,n.writer),n.mapper.bindElementToMarker(o,i.markerName);}}}(e.view),{priority:e.converterPriority||"normal"}),t.on(`removeMarker:${e.model}`,function(e){return (t,i,n)=>{if(i.markerRange.isCollapsed)return;const s=sl(e,i,n);if(!s)return;const o=Ua(n.writer,s),r=n.mapper.markerNameToElements(i.markerName);if(r){for(const e of r)if(n.mapper.unbindElementFromMarkerName(e,i.markerName),e.is("attributeElement"))n.writer.unwrap(n.writer.createRangeOn(e),o);else {e.getCustomProperty("removeHighlight")(e,s.id,n.writer);}n.writer.clearClonedElementsGroup(i.markerName),t.stop();}}}(e.view),{priority:e.converterPriority||"normal"});}}(e))}markerToData(e){return this.add(function(e){e=De(e);const t=e.model;let i=e.view;i||(i=i=>({group:t,name:i.substr(e.model.length+1)}));return n=>{var s;n.on(`addMarker:${t}`,(s=i,(e,t,i)=>{const n=s(t.markerName,i);if(!n)return;const o=t.markerRange;i.consumable.consume(o,e.name)&&(Xa(o,false,i,t,n),Xa(o,true,i,t,n),e.stop());}),{priority:e.converterPriority||"normal"}),n.on(`removeMarker:${t}`,function(e){return (t,i,n)=>{const s=e(i.markerName,n);if(!s)return;const o=n.mapper.markerNameToElements(i.markerName);if(o){for(const e of o)n.mapper.unbindElementFromMarkerName(e,i.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)):n.writer.clear(n.writer.createRangeOn(e),e);n.writer.clearClonedElementsGroup(i.markerName),t.stop();}function r(e,t){if(t.hasAttribute(e)){const i=new Set(t.getAttribute(e).split(","));i.delete(s.name),0==i.size?n.writer.removeAttribute(e,t):n.writer.setAttribute(e,Array.from(i).join(","),t);}}}}(i),{priority:e.converterPriority||"normal"});}}(e))}}function za(){return (e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const n=i.writer,s=i.mapper.toViewPosition(t.range.start),o=n.createText(t.item.data);n.insert(s,o);}}function Ha(){return (e,t,i)=>{i.convertAttributes(t.item),t.reconversion||!t.item.is("element")||t.item.isEmpty||i.convertChildren(t.item);}}function qa(){return (e,t,i)=>{if(t.reconversion)return;const n=i.mapper.toViewPosition(t.position),s=t.position.getShiftedBy(t.length),o=i.mapper.toViewPosition(s,{isPhantom:true});Ya(i.writer.createRange(n,o).getTrimmed(),i);}}function Ua(e,t){const i=e.createAttributeElement("span",t.attributes);return t.classes&&i._addClass(t.classes),"number"==typeof t.priority&&(i._priority=t.priority),i._id=t.id,i}function ja(){return (e,t,i)=>{const n=t.selection;if(n.isCollapsed)return;if(!i.consumable.consume(n,"selection"))return;const s=[];for(const e of n.getRanges())s.push(i.mapper.toViewRange(e));i.writer.setSelection(s,{backward:n.isBackward});}}function $a(){return (e,t,i)=>{const n=t.selection;if(!n.isCollapsed)return;if(!i.consumable.consume(n,"selection"))return;const s=i.writer,o=n.getFirstPosition(),r=i.mapper.toViewPosition(o),a=s.breakAttributes(r);s.setSelection(a);}}function Wa(){return (e,t,i)=>{const n=i.writer,s=n.document.selection;for(const e of s.getRanges())e.isCollapsed&&e.end.parent.isAttached()&&i.writer.mergeAttributes(e.start);n.setSelection(null);}}function Ga(e){return (t,i,n)=>{if(!n.consumable.test(i.item,t.name))return;const s=e(i.attributeOldValue,n,i),o=e(i.attributeNewValue,n,i);if(!s&&!o)return;n.consumable.consume(i.item,t.name);const r=n.writer,a=r.document.selection;if(i.item instanceof ya||i.item instanceof Oa)r.wrap(a.getFirstRange(),o);else {let e=n.mapper.toViewRange(i.range);null!==i.attributeOldValue&&s&&(e=r.unwrap(e,s)),null!==i.attributeNewValue&&o&&r.wrap(e,o);}}}function Ka(e,t=cl){return (i,n,s)=>{if(!t(n.item,s.consumable,{preflight:true}))return;const o=e(n.item,s,n);if(!o)return;t(n.item,s.consumable);const r=n.reconversion&&Za(n.item,s)||s.mapper.toViewPosition(n.range.start);s.mapper.bindElements(n.item,o),s.writer.insert(r,o),s.convertAttributes(n.item),al(o,n.item.getChildren(),s,{reconversion:n.reconversion});}}function Ja(e,t){return (i,n,s)=>{if(!t(n.item,s.consumable,{preflight:true}))return;const o=new Map;s.writer._registerSlotFactory(function(e,t,i){return (n,s)=>{const o=n.createContainerElement("$slot");let r=null;if("children"===s)r=Array.from(e.getChildren());else {if("function"!=typeof s)throw new I("conversion-slot-mode-unknown",i.dispatcher,{modeOrFilter:s});r=Array.from(e.getChildren()).filter(e=>s(e));}return t.set(o,r),o}}(n.item,o,s));const r=e(n.item,s,n);if(s.writer._clearSlotFactory(),!r)return;!function(e,t,i){const n=Array.from(t.values()).flat(),s=new Set(n);if(s.size!=n.length)throw new I("conversion-slot-filter-overlap",i.dispatcher,{element:e});if(s.size!=e.childCount)throw new I("conversion-slot-filter-incomplete",i.dispatcher,{element:e})}(n.item,o,s),t(n.item,s.consumable);const a=n.reconversion&&Za(n.item,s)||s.mapper.toViewPosition(n.range.start);s.mapper.bindElements(n.item,r),s.writer.insert(a,r),s.convertAttributes(n.item),function(e,t,i,n){i.mapper.on("modelToViewPosition",r,{priority:"highest"});let s=null,o=null;for([s,o]of t)al(e,o,i,n),i.writer.setCustomProperty("$structureSlotParent",true,s.parent),i.writer.move(i.writer.createRangeIn(s),i.writer.createPositionBefore(s)),i.writer.remove(s);function r(e,t){const i=t.modelPosition.nodeAfter,n=o.indexOf(i);n<0||(t.viewPosition=t.mapper.findPositionIn(s,n));}i.mapper.off("modelToViewPosition",r);}(r,o,s,{reconversion:n.reconversion});}}function Qa(e){return (t,i,n)=>{i.isOpening=true;const s=e(i,n);i.isOpening=false;const o=e(i,n);if(!s||!o)return;const r=i.markerRange;if(r.isCollapsed&&!n.consumable.consume(r,t.name))return;for(const e of r)if(!n.consumable.consume(e.item,t.name))return;const a=n.mapper,l=n.writer;l.insert(a.toViewPosition(r.start),s),n.mapper.bindElementToMarker(s,i.markerName),r.isCollapsed||(l.insert(a.toViewPosition(r.end),o),n.mapper.bindElementToMarker(o,i.markerName)),t.stop();}}function Ya(e,t){const i=t.writer.remove(e);for(const e of t.writer.createRangeIn(i).getItems())t.mapper.unbindViewElement(e,{defer:true});return e.start}function Za(e,t){const i=t.mapper.toViewElement(e);return i&&Ya(t.writer.createRangeOn(i),t)}function Xa(e,t,i,n,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=true):(e=a,o=false);const l=i.mapper.toViewElement(e);if(l)return void function(e,t,i,n,s,o){const r=`data-${o.group}-${t?"start":"end"}-${i?"before":"after"}`,a=e.hasAttribute(r)?e.getAttribute(r).split(","):[];a.unshift(o.name),n.writer.setAttribute(r,a.join(","),e),n.mapper.bindElementToMarker(e,s.markerName);}(l,t,o,i,n,s)}!function(e,t,i,n,s){const o=`${s.group}-${t?"start":"end"}`,r=s.name?{name:s.name}:null,a=i.writer.createUIElement(o,r);i.writer.insert(e,a),i.mapper.bindElementToMarker(a,n.markerName);}(i.mapper.toViewPosition(o),t,i,n,s);}function el(e){return "string"==typeof e&&(e={name:e}),{name:e.name,attributes:e.attributes?pn(e.attributes):[],children:!!e.children}}function tl(e,t){return "function"==typeof e?e:(i,n)=>function(e,t,i){"string"==typeof e&&(e={name:e});let n;const s=t.writer,o=Object.assign({},e.attributes);if("container"==i)n=s.createContainerElement(e.name,o);else if("attribute"==i){const t={priority:e.priority||$o.DEFAULT_PRIORITY};n=s.createAttributeElement(e.name,o,t);}else n=s.createUIElement(e.name,o);if(e.styles){const t=Object.keys(e.styles);for(const i of t)s.setStyle(i,e.styles[i],n);}if(e.classes){const t=e.classes;if("string"==typeof t)s.addClass(t,n);else for(const e of t)s.addClass(e,n);}return n}(e,n,t)}function il(e){return e.model.values?(t,i,n)=>{const s=e.view[t];return s?s(t,i,n):null}:e.view}function nl(e){return "string"==typeof e?t=>({key:e,value:t}):"object"==typeof e?e.value?()=>e:t=>({key:e.key,value:t}):e}function sl(e,t,i){const n="function"==typeof e?e(t,i):{...e};return n?(n.priority||(n.priority=10),n.id||(n.id=t.markerName),n):null}function ol(e){const t=function(e){return (t,i)=>{if(!t.is("element",e.name))return  false;if("attribute"==i.type){if(e.attributes.includes(i.attributeKey))return  true}else if(e.children)return  true;return  false}}(e);return (e,i)=>{const n=[];i.reconvertedElements||(i.reconvertedElements=new Set);for(const e of i.changes){const s="attribute"==e.type?e.range.start.nodeAfter:e.position.parent;if(s&&t(s,e)&&"reinsert"!=e.type){if("insert"==e.type&&"rename"==e.action&&i.refreshedItems.add(e.position.nodeAfter),!i.reconvertedElements.has(s)){i.reconvertedElements.add(s);const e=ra._createBefore(s);let t=n.length;for(let i=n.length-1;i>=0;i--){const s=n[i],o=("attribute"==s.type?s.range.start:s.position).compareWith(e);if("before"==o||"remove"==s.type&&"same"==o)break;t=i;}n.splice(t,0,{type:"reinsert",name:s.name,position:e,length:1});}}else n.push(e);}i.changes=n;}}function rl(e){return (t,i,n={})=>{const s=["insert"];for(const i of e.attributes)t.hasAttribute(i)&&s.push(`attribute:${i}`);return !!s.every(e=>i.test(t,e))&&(n.preflight||s.forEach(e=>i.consume(t,e)),true)}}function al(e,t,i,n){for(const s of t)ll(e.root,s,i,n)||i.convertItem(s);}function ll(e,t,i,n){const{writer:s,mapper:o}=i;if(!n.reconversion)return  false;const r=o.toViewElement(t);return !(!r||r.root==e)&&(!!i.canReuseView(r)&&(s.move(s.createRangeOn(r),o.toViewPosition(ra._createBefore(t))),true))}function cl(e,t,{preflight:i}={}){return i?t.test(e,"insert"):t.consume(e,"insert")}function ul(e){const{schema:t,document:i}=e.model;for(const n of i.getRoots())if(n.isEmpty&&!t.checkChild(n,"$text")&&t.checkChild(n,"paragraph"))return e.insertElement("paragraph",n),true;return  false}function dl(e,t,i){const n=i.createContext(e);return !!i.checkChild(n,"paragraph")&&!!i.checkChild(n.push("paragraph"),t)}function hl(e,t){const i=t.createElement("paragraph");return t.insert(i,e),t.createPositionAt(i,0)}class ml extends Na{elementToElement(e){return this.add(bl(e))}elementToAttribute(e){return this.add(function(e){e=De(e),_l(e);const t=yl(e,false),i=wl(e.view),n=i?`element:${i}`:"element";return i=>{i.on(n,t,{priority:e.converterPriority||"low"});}}(e))}attributeToAttribute(e){return this.add(function(e){e=De(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,i=void 0===e.view.value?/[\s\S]*/:e.view.value;let n;if("class"==t||"style"==t){const e="class"==t?"classes":"styles";n={[e]:i};}else n={attributes:{[t]:i}};e.view.name&&(n.name=e.view.name);return e.view=n,t}(e));_l(e,t);const i=yl(e,true);return t=>{t.on("element",i,{priority:e.converterPriority||"low"});}}(e))}elementToMarker(e){return this.add(function(e){const t=function(e){return (t,i)=>{const n="string"==typeof e?e:e(t,i);return i.writer.createElement("$marker",{"data-name":n})}}(e.model);return bl({...e,model:t})}(e))}dataToMarker(e){return this.add(function(e){e=De(e),e.model||(e.model=t=>t?e.view+":"+t:e.view);const t={view:e.view,model:e.model},i=vl(kl(t,"start")),n=vl(kl(t,"end"));return s=>{s.on(`element:${e.view}-start`,i,{priority:e.converterPriority||"normal"}),s.on(`element:${e.view}-end`,n,{priority:e.converterPriority||"normal"});const o=E.low,r=E.highest,a=E.get(e.converterPriority)/r;s.on("element",function(e){return (t,i,n)=>{const s=`data-${e.view}`;function o(t,s){for(const o of s){const s=e.model(o,n),r=n.writer.createElement("$marker",{"data-name":s});n.writer.insert(r,t),i.modelCursor.isEqual(t)?i.modelCursor=i.modelCursor.getShiftedBy(1):i.modelCursor=i.modelCursor._getTransformedByInsertion(t,1),i.modelRange=i.modelRange._getTransformedByInsertion(t,1)[0];}}(n.consumable.test(i.viewItem,{attributes:s+"-end-after"})||n.consumable.test(i.viewItem,{attributes:s+"-start-after"})||n.consumable.test(i.viewItem,{attributes:s+"-end-before"})||n.consumable.test(i.viewItem,{attributes:s+"-start-before"}))&&(i.modelRange||Object.assign(i,n.convertChildren(i.viewItem,i.modelCursor)),n.consumable.consume(i.viewItem,{attributes:s+"-end-after"})&&o(i.modelRange.end,i.viewItem.getAttribute(s+"-end-after").split(",")),n.consumable.consume(i.viewItem,{attributes:s+"-start-after"})&&o(i.modelRange.end,i.viewItem.getAttribute(s+"-start-after").split(",")),n.consumable.consume(i.viewItem,{attributes:s+"-end-before"})&&o(i.modelRange.start,i.viewItem.getAttribute(s+"-end-before").split(",")),n.consumable.consume(i.viewItem,{attributes:s+"-start-before"})&&o(i.modelRange.start,i.viewItem.getAttribute(s+"-start-before").split(",")));}}(t),{priority:o+a});}}(e))}}function gl(){return (e,t,i)=>{if(!t.modelRange&&i.consumable.consume(t.viewItem,{name:true})){const{modelRange:e,modelCursor:n}=i.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=n;}}}function fl(){return (e,t,{schema:i,consumable:n,writer:s})=>{let o=t.modelCursor;if(!n.test(t.viewItem))return;if(!i.checkChild(o,"$text")){if(!dl(o,"$text",i))return;if(0==t.viewItem.data.trim().length)return;o=hl(o,s);}n.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;}}function pl(e,t){return (i,n)=>{const s=n.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);});}}function bl(e){const t=vl(e=De(e)),i=wl(e.view),n=i?`element:${i}`:"element";return i=>{i.on(n,t,{priority:e.converterPriority||"normal"});}}function wl(e){return "string"==typeof e?e:"object"==typeof e&&"string"==typeof e.name?e.name:null}function vl(e){const t=new uo(e.view);return (i,n,s)=>{const o=t.match(n.viewItem);if(!o)return;const r=o.match;if(r.name=true,!s.consumable.test(n.viewItem,r))return;const a=function(e,t,i){return e instanceof Function?e(t,i):i.writer.createElement(e)}(e.model,n.viewItem,s);a&&s.safeInsert(a,n.modelCursor)&&(s.consumable.consume(n.viewItem,r),s.convertChildren(n.viewItem,a),s.updateConversionResult(a,n));}}function _l(e,t=null){const i=null===t||(e=>e.getAttribute(t)),n="object"!=typeof e.model?e.model:e.model.key,s="object"!=typeof e.model||void 0===e.model.value?i:e.model.value;e.model={key:n,value:s};}function yl(e,t){const i=new uo(e.view);return (n,s,o)=>{if(!s.modelRange&&t)return;const r=i.match(s.viewItem);if(!r)return;if(!function(e,t){const i="function"==typeof e?e(t):e;if("object"==typeof i&&!wl(i))return  false;return !i.classes&&!i.attributes&&!i.styles}(e.view,s.viewItem)?delete r.match.name:r.match.name=true,!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,s):e.model.value;if(null==l)return;s.modelRange||Object.assign(s,o.convertChildren(s.viewItem,s.modelCursor));const c=function(e,t,i,n){let s=false;for(const o of Array.from(e.getItems({shallow:i})))n.schema.checkAttribute(o,t.key)&&(s=true,o.hasAttribute(t.key)||n.writer.setAttribute(t.key,t.value,o));return s}(s.modelRange,{key:a,value:l},t,o);c&&(o.consumable.test(s.viewItem,{name:true})&&(r.match.name=true),o.consumable.consume(s.viewItem,r.match));}}function kl(e,t){return {view:`${e.view}-${t}`,model:(t,i)=>{const n=t.getAttribute("name"),s=e.model(n,i);return i.writer.createElement("$marker",{"data-name":s})}}}class Cl extends($t()){model;view;mapper;downcastDispatcher;constructor(e,t){super(),this.model=e,this.view=new ta(t),this.mapper=new ma,this.downcastDispatcher=new ba({mapper:this.mapper,schema:e.schema});const i=this.model.document,n=i.selection,s=this.model.markers;this.listenTo(this.model,"_beforeChanges",()=>{this.view._disableRendering(true);},{priority:"highest"}),this.listenTo(this.model,"_afterChanges",()=>{this.view._disableRendering(false);},{priority:"lowest"}),this.listenTo(i,"change",()=>{this.view.change(e=>{this.downcastDispatcher.convertChanges(i.differ,s,e),this.downcastDispatcher.convertSelection(n,s,e);});},{priority:"low"}),this.listenTo(this.view.document,"selectionChange",pl(this.model,this.mapper)),this.downcastDispatcher.on("insert:$text",(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const n=i.writer,s=i.mapper.toViewPosition(t.range.start),o=n.createText(t.item.data);n.insert(s,o);},{priority:"lowest"}),this.downcastDispatcher.on("insert",(e,t,i)=>{i.convertAttributes(t.item),t.reconversion||!t.item.is("element")||t.item.isEmpty||i.convertChildren(t.item);},{priority:"lowest"}),this.downcastDispatcher.on("remove",qa(),{priority:"low"}),this.downcastDispatcher.on("cleanSelection",(e,t,i)=>{const n=i.writer,s=n.document.selection;for(const e of s.getRanges())e.isCollapsed&&e.end.parent.isAttached()&&i.writer.mergeAttributes(e.start);n.setSelection(null);}),this.downcastDispatcher.on("selection",(e,t,i)=>{const n=t.selection;if(n.isCollapsed)return;if(!i.consumable.consume(n,"selection"))return;const s=[];for(const e of n.getRanges())s.push(i.mapper.toViewRange(e));i.writer.setSelection(s,{backward:n.isBackward});},{priority:"low"}),this.downcastDispatcher.on("selection",(e,t,i)=>{const n=t.selection;if(!n.isCollapsed)return;if(!i.consumable.consume(n,"selection"))return;const s=i.writer,o=n.getFirstPosition(),r=i.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 To(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,i=this.model.markers.get(t);if(!i)throw new I("editingcontroller-reconvertmarker-marker-not-exist",this,{markerName:t});this.model.change(()=>{this.model.markers._refresh(i);});}reconvertItem(e){this.model.change(()=>{this.model.document.differ._refreshItem(e);});}}class xl extends($t()){_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 Al(t[0]);},{priority:"highest"}),this.on("checkChild",(e,t)=>{t[0]=new Al(t[0]),t[1]=this.getDefinition(t[1]);},{priority:"highest"});}register(e,t){if(this._sourceDefinitions[e])throw new I("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 I("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 i=this.getDefinition(e.last);if(!i)return  false;const n=this._evaluateAttributeChecks(e,t);return void 0!==n?n:i.allowAttributes.includes(t)}checkMerge(e,t){if(e instanceof ra){const t=e.nodeBefore,i=e.nodeAfter;if(!(t instanceof Fa))throw new I("schema-check-merge-no-element-before",this);if(!(i instanceof Fa))throw new I("schema-check-merge-no-element-after",this);return this.checkMerge(t,i)}if(this.isLimit(e)||this.isLimit(t))return  false;for(const i of t.getChildren())if(!this.checkChild(e,i))return  false;return  true}addChildCheck(e,t){const i=void 0!==t?t:this._genericCheckSymbol,n=this._customChildChecks.get(i)||[];n.push(e),this._customChildChecks.set(i,n);}addAttributeCheck(e,t){const i=void 0!==t?t:this._genericCheckSymbol,n=this._customAttributeChecks.get(i)||[];n.push(e),this._customAttributeChecks.set(i,n);}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 ra)t=e.parent;else {t=(e instanceof ha?[e]:Array.from(e.getRanges())).reduce((e,t)=>{const i=t.getCommonAncestor();return e?e.getCommonAncestor(i,{includeSelf:true}):i},null);}for(;!this.isLimit(t)&&t.parent;)t=t.parent;return t}checkAttributeInSelection(e,t){if(e.isCollapsed){const i=[...e.getFirstPosition().getAncestors(),new Va("",e.getAttributes())];return this.checkAttribute(i,t)}{const i=e.getRanges();for(const e of i)for(const i of e)if(this.checkAttribute(i.item,t))return  true}return  false}*getValidRanges(e,t,i={}){e=function*(e){for(const t of e)yield*t.getMinimalFlatRanges();}(e);for(const n of e)yield*this._getValidRangesForRange(n,t,i);}getNearestSelectionRange(e,t="both"){if("$graveyard"==e.root.rootName)return null;if(this.checkChild(e,"$text"))return new ha(e);let i,n;const s=e.getAncestors().reverse().find(e=>this.isLimit(e))||e.root;"both"!=t&&"backward"!=t||(i=new sa({boundaries:ha._createIn(s),startPosition:e,direction:"backward"})),"both"!=t&&"forward"!=t||(n=new sa({boundaries:ha._createIn(s),startPosition:e}));for(const e of function*(e,t){let i=false;for(;!i;){if(i=true,e){const t=e.next();t.done||(i=false,yield {walker:e,value:t.value});}if(t){const e=t.next();e.done||(i=false,yield {walker:t,value:e.value});}}}(i,n)){const t=e.walker==i?"elementEnd":"elementStart",n=e.value;if(n.type==t&&this.isObject(n.item))return ha._createOn(n.item);if(this.checkChild(n.nextPosition,"$text"))return new ha(n.nextPosition)}return null}findAllowedParent(e,t){let i=e.parent;for(;i;){if(this.checkChild(i,t))return i;if(this.isLimit(i))return null;i=i.parent;}return null}setAllowedAttributes(e,t,i){const n=i.model;for(const[s,o]of Object.entries(t))n.schema.checkAttribute(e,s)&&i.setAttribute(s,o,e);}removeDisallowedAttributes(e,t){for(const i of e)if(i.is("$text"))Nl(this,i,t);else {const e=ha._createIn(i).getPositions();for(const i of e){Nl(this,i.nodeBefore||i.parent,t);}}}getAttributesWithProperty(e,t,i){const n={};for(const[s,o]of e.getAttributes()){const e=this.getAttributeProperties(s);void 0!==e[t]&&(void 0!==i&&i!==e[t]||(n[s]=o));}return n}createContext(e){return new Al(e)}_clearCache(){this._compiledDefinitions=null;}_compile(){const e={},t=this._sourceDefinitions,i=Object.keys(t);for(const n of i)e[n]=El(t[n],n);const n=Object.values(e);for(const t of n)Tl(e,t),Sl(e,t),Il(e,t),Pl(e,t);for(const t of n)Vl(e,t);for(const t of n)Rl(e,t);for(const t of n)Ol(e,t);for(const t of n)Bl(e,t);for(const t of n)Ll(e,t);this._compiledDefinitions=function(e){const t={};for(const i of Object.values(e))t[i.name]={name:i.name,isBlock:!!i.isBlock,isContent:!!i.isContent,isInline:!!i.isInline,isLimit:!!i.isLimit,isObject:!!i.isObject,isSelectable:!!i.isSelectable,allowIn:Array.from(i.allowIn).filter(t=>!!e[t]),allowChildren:Array.from(i.allowChildren).filter(t=>!!e[t]),allowAttributes:Array.from(i.allowAttributes)};return t}(e);}_checkContextMatch(e,t){const i=e.last;let n=this._evaluateChildChecks(e,t);if(n=void 0!==n?n:t.allowIn.includes(i.name),!n)return  false;const s=this.getDefinition(i),o=e.trimLast();return !!s&&(0==o.length||this._checkContextMatch(o,s))}_evaluateChildChecks(e,t){const i=this._customChildChecks.get(this._genericCheckSymbol)||[],n=this._customChildChecks.get(t.name)||[];for(const s of [...i,...n]){const i=s(e,t);if(void 0!==i)return i}}_evaluateAttributeChecks(e,t){const i=this._customAttributeChecks.get(this._genericCheckSymbol)||[],n=this._customAttributeChecks.get(t)||[];for(const s of [...i,...n]){const i=s(e,t);if(void 0!==i)return i}}*_getValidRangesForRange(e,t,i){let n=e.start,s=e.start;for(const o of e.getItems({shallow:true})){if(o.is("element"))if(i.includeEmptyRanges&&o.isEmpty){const e=this.createContext(o);this.checkChild(e,"$text")&&this.checkAttribute(e.push("$text"),t)&&(yield ha._createIn(o));}else yield*this._getValidRangesForRange(ha._createIn(o),t,i);this.checkAttribute(o,t)||(n.isEqual(s)||(yield new ha(n,s)),n=ra._createAfter(o)),s=ra._createAfter(o);}n.isEqual(s)||(yield new ha(n,s));}findOptimalInsertionRange(e,t){const i=e.getSelectedElement();if(i&&this.isObject(i)&&!this.isInline(i))return "before"==t||"after"==t?new ha(ra._createAt(i,t)):ha._createOn(i);const n=Cn(e.getSelectedBlocks());if(!n)return new ha(e.focus);if(n.isEmpty)return new ha(ra._createAt(n,0));const s=ra._createAfter(n);return e.focus.isTouching(s)?new ha(s):new ha(ra._createBefore(n))}}class Al{_items;constructor(e){if(e instanceof Al)return e;let t;t="string"==typeof e?[e]:Array.isArray(e)?e:e.getAncestors({includeSelf:true}),this._items=t.map(Fl);}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 Al([e]);return t._items=[...this._items,...t._items],t}trimLast(){const e=new Al([]);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 El(e,t){const i={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 i of e){const e=Object.keys(i).filter(e=>e.startsWith("is"));for(const n of e)t[n]=!!i[n];}}(e,i),Ml(e,i,"allowIn"),Ml(e,i,"allowChildren"),Ml(e,i,"disallowIn"),Ml(e,i,"disallowChildren"),Ml(e,i,"allowContentOf"),Ml(e,i,"allowWhere"),Ml(e,i,"allowAttributes"),Ml(e,i,"disallowAttributes"),Ml(e,i,"allowAttributesOf"),Ml(e,i,"inheritTypesFrom"),function(e,t){for(const i of e){const e=i.inheritAllFrom;e&&(t.allowContentOf.add(e),t.allowWhere.add(e),t.allowAttributesOf.add(e),t.inheritTypesFrom.add(e));}}(e,i),i}function Tl(e,t){for(const i of t.allowIn){const n=e[i];n?n.allowChildren.add(t.name):t.allowIn.delete(i);}}function Sl(e,t){for(const i of t.allowChildren){const n=e[i];n?n.allowIn.add(t.name):t.allowChildren.delete(i);}}function Il(e,t){for(const i of t.disallowIn){const n=e[i];n?n.disallowChildren.add(t.name):t.disallowIn.delete(i);}}function Pl(e,t){for(const i of t.disallowChildren){const n=e[i];n?n.disallowIn.add(t.name):t.disallowChildren.delete(i);}}function Vl(e,t){for(const e of t.disallowChildren)t.allowChildren.delete(e);for(const e of t.disallowIn)t.allowIn.delete(e);for(const e of t.disallowAttributes)t.allowAttributes.delete(e);}function Rl(e,t){for(const i of t.allowContentOf){const n=e[i];n&&(n.disallowChildren.forEach(i=>{t.allowChildren.has(i)||(t.disallowChildren.add(i),e[i].disallowIn.add(t.name));}),n.allowChildren.forEach(i=>{t.disallowChildren.has(i)||(t.allowChildren.add(i),e[i].allowIn.add(t.name));}));}}function Ol(e,t){for(const i of t.allowWhere){const n=e[i];n&&(n.disallowIn.forEach(i=>{t.allowIn.has(i)||(t.disallowIn.add(i),e[i].disallowChildren.add(t.name));}),n.allowIn.forEach(i=>{t.disallowIn.has(i)||(t.allowIn.add(i),e[i].allowChildren.add(t.name));}));}}function Bl(e,t){for(const i of t.allowAttributesOf){const n=e[i];if(!n)return;n.allowAttributes.forEach(e=>{t.disallowAttributes.has(e)||t.allowAttributes.add(e);});}}function Ll(e,t){for(const i of t.inheritTypesFrom){const n=e[i];if(n){const e=Object.keys(n).filter(e=>e.startsWith("is"));for(const i of e)i in t||(t[i]=n[i]);}}}function Ml(e,t,i){for(const n of e){let e=n[i];"string"==typeof e&&(e=[e]),Array.isArray(e)&&e.forEach(e=>t[i].add(e));}}function Fl(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 Nl(e,t,i){for(const n of t.getAttributeKeys())e.checkAttribute(t,n)||i.removeAttribute(n,t);}class Dl extends(z()){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)=>this._splitToAllowedParent(e,t),getSplitParts:e=>this._getSplitParts(e),keepEmptyElement:e=>this._keepEmptyElement(e)};}convert(e,t,i=["$root"]){this.fire("viewCleanup",e),this._modelCursor=function(e,t){let i;for(const n of new Al(e)){const e={};for(const t of n.getAttributeKeys())e[t]=n.getAttribute(t);const s=t.createElement(n.name,e);i&&t.insert(s,i),i=ra._createAt(s,0);}return i}(i,t),this.conversionApi.writer=t,this.conversionApi.consumable=ro.createFrom(e),this.conversionApi.store={};const{modelRange:n}=this._convertItem(e,this._modelCursor),s=t.createDocumentFragment();if(n){this._removeEmptyElements();const e=this._modelCursor.parent,i=e._removeChildren(0,e.childCount);s._insertChild(0,i),s.markers=function(e,t){const i=new Set,n=new Map,s=ha._createIn(e).getItems();for(const e of s)e.is("element","$marker")&&i.add(e);for(const e of i){const i=e.getAttribute("data-name"),s=t.createPositionBefore(e);n.has(i)?n.get(i).end=s.clone():n.set(i,new ha(s.clone())),t.remove(e);}return n}(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 i={viewItem:e,modelCursor:t,modelRange:null};if(e.is("element")?this.fire(`element:${e.name}`,i,this.conversionApi):e.is("$text")?this.fire("text",i,this.conversionApi):this.fire("documentFragment",i,this.conversionApi),i.modelRange&&!(i.modelRange instanceof ha))throw new I("view-conversion-dispatcher-incorrect-result",this);return {modelRange:i.modelRange,modelCursor:i.modelCursor}}_convertChildren(e,t){let i=t.is("position")?t:ra._createAt(t,0);const n=new ha(i);for(const t of Array.from(e.getChildren())){const e=this._convertItem(t,i);e.modelRange instanceof ha&&(n.end=e.modelRange.end,i=e.modelCursor);}return {modelRange:n,modelCursor:i}}_safeInsert(e,t){const i=this._splitToAllowedParent(e,t);return !!i&&(this.conversionApi.writer.insert(e,i.position),true)}_updateConversionResult(e,t){const i=this._getSplitParts(e),n=this.conversionApi.writer;t.modelRange||(t.modelRange=n.createRange(n.createPositionBefore(e),n.createPositionAfter(i[i.length-1])));const s=this._cursorParents.get(e);t.modelCursor=s?n.createPositionAt(s,0):t.modelRange.end;}_splitToAllowedParent(e,t){const{schema:i,writer:n}=this.conversionApi;let s=i.findAllowedParent(t,e);if(s){if(s===t.parent)return {position:t};this._modelCursor.parent.getAncestors().includes(s)&&(s=null);}if(!s)return dl(t,e,i)?{position:hl(t,n)}:null;const o=this.conversionApi.writer.split(t,s),r=[];for(const e of o.range.getWalker())if("elementEnd"==e.type)r.push(e.item);else {const t=r.pop(),i=e.item;this._registerSplitPair(t,i);}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 i=this._splitParts.get(e);this._splitParts.set(t,i),i.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(){const e=new Map;for(const t of this._splitParts.keys())if(t.isEmpty&&!this._emptyElementsToKeep.has(t)){const i=e.get(t.parent)||[];i.push(t),this._splitParts.delete(t),e.set(t.parent,i);}for(const[t,i]of e)t._removeChildrenArray(i);e.size&&this._removeEmptyElements();}}class zl{getHtml(t){const i=exports.global.document.implementation.createHTMLDocument("").createElement("div");return i.appendChild(t),i.innerHTML}}class Hl{domParser;domConverter;htmlWriter;skipComments=true;constructor(e){this.domParser=new DOMParser,this.domConverter=new Rr(e,{renderingMode:"data"}),this.htmlWriter=new zl;}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"),i=t.createDocumentFragment(),n=t.body.childNodes;for(;n.length>0;)i.appendChild(n[0]);return i}}class ql extends(z()){model;mapper;downcastDispatcher;upcastDispatcher;viewDocument;stylesProcessor;htmlProcessor;processor;_viewWriter;constructor(e,t){super(),this.model=e,this.mapper=new ma,this.downcastDispatcher=new ba({mapper:this.mapper,schema:e.schema}),this.downcastDispatcher.on("insert:$text",(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const n=i.writer,s=i.mapper.toViewPosition(t.range.start),o=n.createText(t.item.data);n.insert(s,o);},{priority:"lowest"}),this.downcastDispatcher.on("insert",(e,t,i)=>{i.convertAttributes(t.item),t.reconversion||!t.item.is("element")||t.item.isEmpty||i.convertChildren(t.item);},{priority:"lowest"}),this.upcastDispatcher=new Dl({schema:e.schema}),this.viewDocument=new jo(t),this.stylesProcessor=t,this.htmlProcessor=new Hl(this.viewDocument),this.processor=this.htmlProcessor,this._viewWriter=new ir(this.viewDocument),this.upcastDispatcher.on("text",fl(),{priority:"lowest"}),this.upcastDispatcher.on("element",(e,t,i)=>{if(!t.modelRange&&i.consumable.consume(t.viewItem,{name:true})){const{modelRange:e,modelCursor:n}=i.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=n;}},{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",(e,t,i)=>{if(!t.modelRange&&i.consumable.consume(t.viewItem,{name:true})){const{modelRange:e,modelCursor:n}=i.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=n;}},{priority:"lowest"}),$t().prototype.decorate.call(this,"init"),$t().prototype.decorate.call(this,"set"),$t().prototype.decorate.call(this,"get"),$t().prototype.decorate.call(this,"toView"),$t().prototype.decorate.call(this,"toModel"),this.on("init",()=>{this.fire("ready");},{priority:"lowest"}),this.on("ready",()=>{this.model.enqueueChange({isUndoable:false},ul);},{priority:"lowest"});}get(e={}){const{rootName:t="main",trim:i="empty"}=e;if(!this._checkIfRootsExists([t]))throw new I("datacontroller-get-non-existent-root",this);const n=this.model.document.getRoot(t);return n.isAttached()||P("datacontroller-get-detached-root",this),"empty"!==i||this.model.hasContent(n,{ignoreWhitespaces:true})?this.stringify(n,e):""}stringify(e,t={}){const i=this.toView(e,t);return this.processor.toData(i)}toView(e,t={}){const i=this.viewDocument,n=this._viewWriter;this.mapper.clearBindings();const s=ha._createIn(e),o=new tr(i);this.mapper.bindElements(e,o);const r=e.is("documentFragment")?e.markers:function(e){const t=[],i=e.root.document;if(!i)return new Map;const n=ha._createIn(e);for(const e of i.model.markers){const i=e.getRange(),s=i.isCollapsed,o=i.start.isEqual(n.start)||i.end.isEqual(n.end);if(s&&o)t.push([e.name,i]);else {const s=n.getIntersection(i);s&&t.push([e.name,s]);}}return t.sort(([e,t],[i,n])=>{if("after"!==t.end.compareWith(n.start))return 1;if("before"!==t.start.compareWith(n.end))return  -1;switch(t.start.compareWith(n.start)){case "before":return 1;case "after":return  -1;default:switch(t.end.compareWith(n.end)){case "before":return 1;case "after":return  -1;default:return i.localeCompare(e)}}}),new Map(t)}(e);return this.downcastDispatcher.convert(s,r,n,t),o}init(e){if(this.model.document.version)throw new I("datacontroller-init-document-not-empty",this);let t={};if("string"==typeof e?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new I("datacontroller-init-non-existent-root",this);return this.model.enqueueChange({isUndoable:false},e=>{for(const i of Object.keys(t)){const n=this.model.document.getRoot(i);e.insert(this.parse(t[i],n),n,0);}}),Promise.resolve()}set(e,t={}){let i={};if("string"==typeof e?i.main=e:i=e,!this._checkIfRootsExists(Object.keys(i)))throw new I("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(i)){const n=this.model.document.getRoot(t);e.remove(e.createRangeIn(n)),e.insert(this.parse(i[t],n),n,0);}});}parse(e,t="$root"){const i=this.processor.toView(e);return this.toModel(i,t)}toModel(e,t="$root"){return this.model.change(i=>this.upcastDispatcher.convert(e,i,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  false;return  true}}class Ul{_helpers=new Map;_downcast;_upcast;constructor(e,t){this._downcast=pn(e),this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:true}),this._upcast=pn(t),this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:false});}addAlias(e,t){const i=this._downcast.includes(t);if(!this._upcast.includes(t)&&!i)throw new I("conversion-add-alias-dispatcher-not-registered",this);this._createConversionHelpers({name:e,dispatchers:[t],isDowncast:i});}for(e){if(!this._helpers.has(e))throw new I("conversion-for-unknown-group",this);return this._helpers.get(e)}elementToElement(e){this.for("downcast").elementToElement(e);for(const{model:t,view:i}of jl(e))this.for("upcast").elementToElement({model:t,view:i,converterPriority:e.converterPriority});}attributeToElement(e){this.for("downcast").attributeToElement(e);for(const{model:t,view:i}of jl(e))this.for("upcast").elementToAttribute({view:i,model:t,converterPriority:e.converterPriority});}attributeToAttribute(e){this.for("downcast").attributeToAttribute(e);for(const{model:t,view:i}of jl(e))this.for("upcast").attributeToAttribute({view:i,model:t});}_createConversionHelpers({name:e,dispatchers:t,isDowncast:i}){if(this._helpers.has(e))throw new I("conversion-group-exists",this);const n=i?new Da(t):new ml(t);this._helpers.set(e,n);}}function*jl(e){if(e.model.values)for(const t of e.model.values){const i={key:e.model.key,value:t},n=e.view[t],s=e.upcastAlso?e.upcastAlso[t]:void 0;yield*$l(i,n,s);}else yield*$l(e.model,e.view,e.upcastAlso);}function*$l(e,t,i){if(yield {model:e,view:t},i)for(const t of pn(i))yield {model:e,view:t};}class Wl{namespaces;domParser;domConverter;htmlWriter;skipComments=true;constructor(e,t={}){this.namespaces=t.namespaces||[],this.domParser=new DOMParser,this.domConverter=new Rr(e,{renderingMode:"data"}),this.htmlWriter=new zl;}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,{keepOriginalCase:true,skipComments:this.skipComments})}registerRawContentMatcher(e){this.domConverter.registerRawContentMatcher(e);}useFillerType(e){this.domConverter.blockFillerMode="marked"==e?"markedNbsp":"nbsp";}_toDom(e){e=`<xml ${this.namespaces.map(e=>`xmlns:${e}="nsp"`).join(" ")}>${e}</xml>`;const t=this.domParser.parseFromString(e,"text/xml"),i=t.querySelector("parsererror");if(i)throw new Error("Parse error - "+i.textContent);const n=t.createDocumentFragment(),s=t.documentElement.childNodes;for(;s.length>0;)n.appendChild(s[0]);return n}}class Gl{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 Kl(e,t){const i=Zl(t),n=i.reduce((e,t)=>e+t.offsetSize,0),s=e.parent;ec(e);const o=e.index;return s._insertChild(o,i),Xl(s,o+i.length),Xl(s,o),new ha(e,e.getShiftedBy(n))}function Jl(e){if(!e.isFlat)throw new I("operation-utils-remove-range-not-flat",this);const t=e.start.parent;ec(e.start),ec(e.end);const i=t._removeChildren(e.start.index,e.end.index-e.start.index);return Xl(t,e.start.index),i}function Ql(e,t){if(!e.isFlat)throw new I("operation-utils-move-range-not-flat",this);const i=Jl(e);return Kl(t=t._getTransformedByDeletion(e.start,e.end.offset-e.start.offset),i)}function Yl(e,t,i){ec(e.start),ec(e.end);for(const n of e.getItems({shallow:true})){const e=n.is("$textProxy")?n.textNode:n;null!==i?e._setAttribute(t,i):e._removeAttribute(t),Xl(e.parent,e.index);}Xl(e.end.parent,e.end.index);}function Zl(e){const t=[];!function e(i){if("string"==typeof i)t.push(new Va(i));else if(i instanceof na)t.push(new Va(i.data,i.getAttributes()));else if(i instanceof _a)t.push(i);else if(ti(i))for(const t of i)e(t);}(e);for(let e=1;e<t.length;e++){const i=t[e],n=t[e-1];i instanceof Va&&n instanceof Va&&tc(i,n)&&(t.splice(e-1,2,new Va(n.data+i.data,n.getAttributes())),e--);}return t}function Xl(e,t){const i=e.getChild(t-1),n=e.getChild(t);if(i&&n&&i.is("$text")&&n.is("$text")&&tc(i,n)){const s=new Va(i.data+n.data,i.getAttributes());e._removeChildren(t-1,2),e._insertChild(t-1,s);}}function ec(e){const t=e.textNode,i=e.parent;if(t){const n=e.offset-t.startOffset,s=t.index;i._removeChildren(s,1);const o=new Va(t.data.substr(0,n),t.getAttributes()),r=new Va(t.data.substr(n),t.getAttributes());i._insertChild(s,[o,r]);}}function tc(e,t){const i=e.getAttributes(),n=t.getAttributes();for(const e of i){if(e[1]!==t.getAttribute(e[0]))return  false;n.next();}return n.next().done}class ic extends Gl{sourcePosition;howMany;targetPosition;constructor(e,t,i,n){super(n),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toNext",this.howMany=t,this.targetPosition=i.clone(),this.targetPosition.stickiness="toNone";}get type(){return this.targetPosition.root.rootName==this.sourcePosition.root.rootName?"move":"$graveyard"==this.targetPosition.root.rootName?"remove":"$graveyard"==this.sourcePosition.root.rootName?"reinsert":"move"}get affectedSelectable(){return [ha._createFromPositionAndShift(this.sourcePosition,this.howMany),ha._createFromPositionAndShift(this.targetPosition,0)]}clone(){return new ic(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 ic(this.getMovedRangeStart(),this.howMany,e,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent,i=this.sourcePosition.offset,n=this.targetPosition.offset;if(i+this.howMany>e.maxOffset)throw new I("move-operation-nodes-do-not-exist",this);if(e===t&&i<n&&n<i+this.howMany)throw new I("move-operation-range-into-itself",this);if(this.sourcePosition.root==this.targetPosition.root&&"prefix"==ei(this.sourcePosition.getParentPath(),this.targetPosition.getParentPath())){const e=this.sourcePosition.path.length-1;if(this.targetPosition.path[e]>=i&&this.targetPosition.path[e]<i+this.howMany)throw new I("move-operation-node-into-itself",this)}}_execute(){Ql(ha._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 i=ra.fromJSON(e.sourcePosition,t),n=ra.fromJSON(e.targetPosition,t);return new this(i,e.howMany,n,e.baseVersion)}}class nc extends Gl{position;nodes;shouldReceiveAttributes;constructor(e,t,i){super(i),this.position=e.clone(),this.position.stickiness="toNone",this.nodes=new Ma(Zl(t)),this.shouldReceiveAttributes=false;}get type(){return "insert"}get howMany(){return this.nodes.maxOffset}get affectedSelectable(){return this.position.clone()}clone(){const e=new Ma([...this.nodes].map(e=>e._clone(true))),t=new nc(this.position,e,this.baseVersion);return t.shouldReceiveAttributes=this.shouldReceiveAttributes,t}getReversed(){const e=this.position.root.document.graveyard,t=new ra(e,[0]);return new ic(this.position,this.nodes.maxOffset,t,this.baseVersion+1)}_validate(){const e=this.position.parent;if(!e||e.maxOffset<this.position.offset)throw new I("insert-operation-position-invalid",this)}_execute(){const e=this.nodes;this.nodes=new Ma([...e].map(e=>e._clone(true))),Kl(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 i=[];for(const t of e.nodes)t.name?i.push(Fa.fromJSON(t)):i.push(Va.fromJSON(t));const n=new nc(ra.fromJSON(e.position,t),i,e.baseVersion);return n.shouldReceiveAttributes=e.shouldReceiveAttributes,n}}class sc extends Gl{splitPosition;howMany;insertionPosition;graveyardPosition;constructor(e,t,i,n,s){super(s),this.splitPosition=e.clone(),this.splitPosition.stickiness="toNext",this.howMany=t,this.insertionPosition=i,this.graveyardPosition=n?n.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 ra(this.insertionPosition.root,e)}get movedRange(){const e=this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);return new ha(this.splitPosition,e)}get affectedSelectable(){const e=[ha._createFromPositionAndShift(this.splitPosition,0),ha._createFromPositionAndShift(this.insertionPosition,0)];return this.graveyardPosition&&e.push(ha._createFromPositionAndShift(this.graveyardPosition,0)),e}clone(){return new sc(this.splitPosition,this.howMany,this.insertionPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.splitPosition.root.document.graveyard,t=new ra(e,[0]);return new oc(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 I("split-operation-position-invalid",this);if(!e.parent)throw new I("split-operation-split-in-root",this);if(this.howMany!==Number.NEGATIVE_INFINITY&&this.howMany!=e.maxOffset-this.splitPosition.offset)throw new I("split-operation-how-many-invalid",this);if(this.graveyardPosition&&!this.graveyardPosition.nodeAfter)throw new I("split-operation-graveyard-position-invalid",this);this.howMany=this.splitPosition.parent.maxOffset-this.splitPosition.offset;}_execute(){const e=this.splitPosition.parent;if(this.graveyardPosition)Ql(ha._createFromPositionAndShift(this.graveyardPosition,1),this.insertionPosition);else {const t=e._clone();Kl(this.insertionPosition,t);}Ql(new ha(ra._createAt(e,this.splitPosition.offset),ra._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 ra(e.root,t,"toPrevious")}static fromJSON(e,t){const i=ra.fromJSON(e.splitPosition,t),n=ra.fromJSON(e.insertionPosition,t),s=e.graveyardPosition?ra.fromJSON(e.graveyardPosition,t):null;return new this(i,e.howMany,n,s,e.baseVersion)}}class oc extends Gl{sourcePosition;howMany;targetPosition;graveyardPosition;constructor(e,t,i,n,s){super(s),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toPrevious",this.howMany=t,this.targetPosition=i.clone(),this.targetPosition.stickiness="toNext",this.graveyardPosition=n.clone();}get type(){return "merge"}get deletionPosition(){return new ra(this.sourcePosition.root,this.sourcePosition.path.slice(0,-1))}get movedRange(){const e=this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);return new ha(this.sourcePosition,e)}get affectedSelectable(){const e=this.sourcePosition.parent;return [ha._createOn(e),ha._createFromPositionAndShift(this.targetPosition,0),ha._createFromPositionAndShift(this.graveyardPosition,0)]}clone(){return new oc(this.sourcePosition,this.howMany,this.targetPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.targetPosition._getTransformedByMergeOperation(this),t=this.sourcePosition.path.slice(0,-1),i=new ra(this.sourcePosition.root,t)._getTransformedByMergeOperation(this);return new sc(e,this.howMany,i,this.graveyardPosition,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent;if(!e.parent)throw new I("merge-operation-source-position-invalid",this);if(!t.parent)throw new I("merge-operation-target-position-invalid",this);if(this.howMany!==Number.NEGATIVE_INFINITY&&this.howMany!=e.maxOffset)throw new I("merge-operation-how-many-invalid",this);this.howMany=this.sourcePosition.parent.maxOffset;}_execute(){const e=this.sourcePosition.parent;Ql(ha._createIn(e),this.targetPosition),Ql(ha._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 i=ra.fromJSON(e.sourcePosition,t),n=ra.fromJSON(e.targetPosition,t),s=ra.fromJSON(e.graveyardPosition,t);return new this(i,e.howMany,n,s,e.baseVersion)}}class rc extends Gl{name;oldRange;newRange;affectsData;_markers;constructor(e,t,i,n,s,o){super(o),this.name=e,this.oldRange=t?t.clone():null,this.newRange=i?i.clone():null,this.affectsData=s,this._markers=n;}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 rc(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new rc(this.name,this.newRange,this.oldRange,this._markers,this.affectsData,this.baseVersion+1)}_execute(){this.newRange?this._markers._set(this.name,this.newRange,true,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 rc(e.name,e.oldRange?ha.fromJSON(e.oldRange,t):null,e.newRange?ha.fromJSON(e.newRange,t):null,t.model.markers,e.affectsData,e.baseVersion)}}class ac extends Gl{range;key;oldValue;newValue;constructor(e,t,i,n,s){super(s),this.range=e.clone(),this.key=t,this.oldValue=void 0===i?null:i,this.newValue=void 0===n?null:n;}get type(){return null===this.oldValue?"addAttribute":null===this.newValue?"removeAttribute":"changeAttribute"}get affectedSelectable(){return this.range.clone()}clone(){return new ac(this.range,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new ac(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 I("attribute-operation-range-not-flat",this);for(const e of this.range.getItems({shallow:true})){if(null!==this.oldValue&&!dt(e.getAttribute(this.key),this.oldValue))throw new I("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 I("attribute-operation-attribute-exists",this,{node:e,key:this.key})}}_execute(){dt(this.oldValue,this.newValue)||Yl(this.range,this.key,this.newValue);}static get className(){return "AttributeOperation"}static fromJSON(e,t){return new ac(ha.fromJSON(e.range,t),e.key,e.oldValue,e.newValue,e.baseVersion)}}class lc extends Gl{get type(){return "noop"}get affectedSelectable(){return null}clone(){return new lc(this.baseVersion)}getReversed(){return new lc(this.baseVersion+1)}_execute(){}static get className(){return "NoOperation"}}class cc extends Gl{position;oldName;newName;constructor(e,t,i,n){super(n),this.position=e,this.position.stickiness="toNext",this.oldName=t,this.newName=i;}get type(){return "rename"}get affectedSelectable(){return this.position.nodeAfter}clone(){return new cc(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new cc(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){const e=this.position.nodeAfter;if(!(e instanceof Fa))throw new I("rename-operation-wrong-position",this);if(""!==this.oldName&&e.name!==this.oldName)throw new I("rename-operation-wrong-name",this);this.oldName=e.name;}_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 cc(ra.fromJSON(e.position,t),e.oldName,e.newName,e.baseVersion)}}class uc extends Gl{root;key;oldValue;newValue;constructor(e,t,i,n,s){super(s),this.root=e,this.key=t,this.oldValue=void 0===i?null:i,this.newValue=void 0===n?null:n;}get type(){return null===this.oldValue?"addRootAttribute":null===this.newValue?"removeRootAttribute":"changeRootAttribute"}get affectedSelectable(){return this.root}clone(){return new uc(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new uc(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is("documentFragment"))throw new I("rootattribute-operation-not-a-root",this,{root:this.root,key:this.key});if(null!==this.oldValue&&!dt(this.root.getAttribute(this.key),this.oldValue))throw new I("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 I("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 I("rootattribute-operation-fromjson-no-root",this,{rootName:e.root});return new uc(t.getRoot(e.root),e.key,e.oldValue,e.newValue,e.baseVersion)}}class dc extends Gl{rootName;elementName;isAdd;_document;constructor(e,t,i,n,s){if(super(s),this.rootName=e,this.elementName=t,this.isAdd=i,this._document=n,!this._document.getRoot(this.rootName)){this._document.createRoot(this.elementName,this.rootName)._isAttached=false;}}get type(){return this.isAdd?"addRoot":"detachRoot"}get affectedSelectable(){return this._document.getRoot(this.rootName)}clone(){return new dc(this.rootName,this.elementName,this.isAdd,this._document,this.baseVersion)}getReversed(){return new dc(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 dc(e.rootName,e.elementName,e.isAdd,t,e.baseVersion)}}const hc={};hc[ac.className]=ac,hc[nc.className]=nc,hc[rc.className]=rc,hc[ic.className]=ic,hc[lc.className]=lc,hc[Gl.className]=Gl,hc[cc.className]=cc,hc[uc.className]=uc,hc[dc.className]=dc,hc[sc.className]=sc,hc[oc.className]=oc;class mc{static fromJSON(e,t){return hc[e.__className].fromJSON(e,t)}}const gc=new Map;function fc(e,t,i){let n=gc.get(e);n||(n=new Map,gc.set(e,n)),n.set(t,i);}function pc(e){return [e]}function bc(e,t,i={}){const n=function(e,t){const i=gc.get(e);return i&&i.has(t)?i.get(t):pc}(e.constructor,t.constructor);try{return n(e=e.clone(),t,i)}catch(e){throw e}}function wc(e,t,i){e=e.slice(),t=t.slice();const n=new vc(i.document,i.useRelations,i.forceWeakRemove);n.setOriginalOperations(e),n.setOriginalOperations(t);const s=n.originalOperations;if(0==e.length||0==t.length)return {operationsA:e,operationsB:t,originalOperations:s};const o=new WeakMap;for(const t of e)o.set(t,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 i=e[a],s=o.get(i);if(s==t.length){a++;continue}const r=t[s],l=bc(i,r,n.getContext(i,r,true)),c=bc(r,i,n.getContext(r,i,false));n.updateRelation(i,r),n.setOriginalOperations(l,i),n.setOriginalOperations(c,r);for(const e of l)o.set(e,s+c.length);e.splice(a,1,...l),t.splice(s,1,...c);}if(kc(e),kc(t),i.padWithNoOps){const i=e.length-r.originalOperationsACount,n=t.length-r.originalOperationsBCount;yc(e,n-i),yc(t,i-n);}return _c(e,r.nextBaseVersionB),_c(t,r.nextBaseVersionA),{operationsA:e,operationsB:t,originalOperations:s}}class vc{originalOperations;_history;_useRelations;_forceWeakRemove;_relations;constructor(e,t,i=false){this.originalOperations=new Map,this._history=e.history,this._useRelations=t,this._forceWeakRemove=!!i,this._relations=new Map;}setOriginalOperations(e,t=null){const i=t?this.originalOperations.get(t):null;for(const t of e)this.originalOperations.set(t,i||t);}updateRelation(e,t){if(e instanceof ic)t instanceof oc?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"):e.howMany>1&&e.sourcePosition.isEqual(t.deletionPosition)?this._setRelation(e,t,"firstToMoveMerged"):e.howMany>1&&e.sourcePosition.getShiftedBy(e.howMany-1).isEqual(t.deletionPosition)&&this._setRelation(e,t,"lastToMoveMerged"):t instanceof ic&&(e.targetPosition.isEqual(t.sourcePosition)||e.targetPosition.isBefore(t.sourcePosition)?this._setRelation(e,t,"insertBefore"):this._setRelation(e,t,"insertAfter"));else if(e instanceof sc){if(t instanceof oc)e.splitPosition.isBefore(t.sourcePosition)&&this._setRelation(e,t,"splitBefore");else if(t instanceof ic)if(e.splitPosition.isEqual(t.sourcePosition)||e.splitPosition.isBefore(t.sourcePosition))this._setRelation(e,t,"splitBefore");else {const i=ha._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&i.containsPosition(e.splitPosition)){const n=i.end.offset-e.splitPosition.offset,s=e.splitPosition.offset-i.start.offset;this._setRelation(e,t,{howMany:n,offset:s});}}}else if(e instanceof oc)t instanceof oc?(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 sc?e.sourcePosition.isEqual(t.splitPosition)&&this._setRelation(e,t,"splitAtSource"):t instanceof ic&&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 rc){const i=e.newRange;if(!i)return;if(t instanceof oc){const n=i.start.isEqual(t.targetPosition),s=i.start.isEqual(t.deletionPosition),o=i.end.isEqual(t.deletionPosition),r=i.end.isEqual(t.sourcePosition);(n||s||o||r)&&this._setRelation(e,t,{wasInLeftElement:n,wasStartBeforeMergedElement:s,wasEndBeforeMergedElement:o,wasInRightElement:r});}}}getContext(e,t,i){return {aIsStrong:i,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 i=this.originalOperations.get(t),n=this._history.getUndoneOperation(i);if(!n)return null;const s=this.originalOperations.get(e),o=this._relations.get(s);return o&&o.get(n)||null}_setRelation(e,t,i){const n=this.originalOperations.get(e),s=this.originalOperations.get(t);let o=this._relations.get(n);o||(o=new Map,this._relations.set(n,o)),o.set(s,i);}}function _c(e,t){for(const i of e)i.baseVersion=t++;}function yc(e,t){for(let i=0;i<t;i++)e.push(new lc(0));}function kc(e){const t=new Map;for(let i=0;i<e.length;i++){const n=e[i];if(n instanceof rc)if(-1!==n.baseVersion)t.set(n.name,{op:n,ranges:n.newRange?[n.newRange]:[]});else {if(n.newRange){const e=t.get(n.name).ranges;e[0].containsRange(n.newRange,true)||e.push(n.newRange);}e.splice(i,1),i--;}}for(const{op:e,ranges:i}of t.values())i.length?e.newRange=ha._createFromRanges(i):e.newRange=null;}function Cc(e,t,i){const n=e.nodes.getNode(0).getAttribute(t);if(n==i)return null;const s=new ha(e.position,e.position.getShiftedBy(e.howMany));return new ac(s,t,n,i,0)}function xc(e,t){return null===e.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany)}function Ac(e,t){const i=[];for(let n=0;n<e.length;n++){const s=e[n],o=new ic(s.start,s.end.offset-s.start.offset,t,0);i.push(o);for(let t=n+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 i}fc(ac,ac,(e,t,i)=>{if(e.key===t.key&&e.range.start.hasSameParentAs(t.range.start)){const n=e.range.getDifference(t.range).map(t=>new ac(t,e.key,e.oldValue,e.newValue,0)),s=e.range.getIntersection(t.range);return s&&i.aIsStrong&&n.push(new ac(s,t.key,t.newValue,e.newValue,0)),0==n.length?[new lc(0)]:n}return [e]}),fc(ac,nc,(e,t)=>{if(e.range.start.hasSameParentAs(t.position)&&e.range.containsPosition(t.position)){const i=e.range._getTransformedByInsertion(t.position,t.howMany,!t.shouldReceiveAttributes).map(t=>new ac(t,e.key,e.oldValue,e.newValue,e.baseVersion));if(t.shouldReceiveAttributes){const n=Cc(t,e.key,e.oldValue);n&&i.unshift(n);}return i}return e.range=e.range._getTransformedByInsertion(t.position,t.howMany,false)[0],[e]}),fc(ac,oc,(e,t)=>{const i=[];e.range.start.hasSameParentAs(t.deletionPosition)&&(e.range.containsPosition(t.deletionPosition)||e.range.start.isEqual(t.deletionPosition))&&i.push(ha._createFromPositionAndShift(t.graveyardPosition,1));const n=e.range._getTransformedByMergeOperation(t);return n.isCollapsed||i.push(n),i.map(t=>new ac(t,e.key,e.oldValue,e.newValue,e.baseVersion))}),fc(ac,ic,(e,t)=>{const i=function(e,t){const i=ha._createFromPositionAndShift(t.sourcePosition,t.howMany);let n=null,s=[];i.containsRange(e,true)?n=e:e.start.hasSameParentAs(i.start)?(s=e.getDifference(i),n=e.getIntersection(i)):s=[e];const o=[];for(let e of s){e=e._getTransformedByDeletion(t.sourcePosition,t.howMany);const i=t.getMovedRangeStart(),n=e.start.hasSameParentAs(i),s=e._getTransformedByInsertion(i,t.howMany,n);o.push(...s);}n&&o.push(n._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany,false)[0]);return o}(e.range,t);return i.map(t=>new ac(t,e.key,e.oldValue,e.newValue,e.baseVersion))}),fc(ac,sc,(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 i=e.clone();return i.range=new ha(t.moveTargetPosition.clone(),e.range.end._getCombined(t.splitPosition,t.moveTargetPosition)),e.range.end=t.splitPosition.clone(),e.range.end.stickiness="toPrevious",[e,i]}return e.range=e.range._getTransformedBySplitOperation(t),[e]}),fc(nc,ac,(e,t)=>{const i=[e];if(e.shouldReceiveAttributes&&e.position.hasSameParentAs(t.range.start)&&t.range.containsPosition(e.position)){const n=Cc(e,t.key,t.newValue);n&&i.push(n);}return i}),fc(nc,nc,(e,t,i)=>(e.position.isEqual(t.position)&&i.aIsStrong||(e.position=e.position._getTransformedByInsertOperation(t)),[e])),fc(nc,ic,(e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e])),fc(nc,sc,(e,t)=>(e.position=e.position._getTransformedBySplitOperation(t),[e])),fc(nc,oc,(e,t)=>(e.position=e.position._getTransformedByMergeOperation(t),[e])),fc(rc,nc,(e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByInsertOperation(t)[0]),e.newRange&&(e.newRange=e.newRange._getTransformedByInsertOperation(t)[0]),[e])),fc(rc,rc,(e,t,i)=>{if(e.name==t.name){if(!i.aIsStrong)return [new lc(0)];e.oldRange=t.newRange?t.newRange.clone():null;}return [e]}),fc(rc,oc,(e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByMergeOperation(t)),e.newRange&&(e.newRange=e.newRange._getTransformedByMergeOperation(t)),[e])),fc(rc,ic,(e,t)=>{const i=[e];if(e.oldRange&&(e.oldRange=ha._createFromRanges(e.oldRange._getTransformedByMoveOperation(t))),e.newRange){const n=e.newRange._getTransformedByMoveOperation(t);e.newRange=n[0];for(let t=1;t<n.length;t++){const s=e.clone();s.oldRange=null,s.newRange=n[t],s.baseVersion=-1,i.push(s);}}return i}),fc(rc,sc,(e,t,i)=>{if(e.oldRange&&(e.oldRange=e.oldRange._getTransformedBySplitOperation(t)),e.newRange){if(i.abRelation){const n=e.newRange._getTransformedBySplitOperation(t);return e.newRange.start.isEqual(t.splitPosition)?i.abRelation.wasStartBeforeMergedElement?e.newRange.start=ra._createAt(t.insertionPosition):i.abRelation.wasInLeftElement?e.newRange.start=ra._createAt(e.newRange.start):e.newRange.start=ra._createAt(t.moveTargetPosition):e.newRange.start=n.start,e.newRange.end.isEqual(t.splitPosition)?e.newRange.end.isEqual(t.splitPosition)&&i.abRelation.wasEndBeforeMergedElement?e.newRange.end=ra._createAt(t.insertionPosition):i.abRelation.wasInRightElement?e.newRange.end=ra._createAt(t.moveTargetPosition):e.newRange.end=ra._createAt(e.newRange.end):e.newRange.end=n.end,[e]}e.newRange=e.newRange._getTransformedBySplitOperation(t);}return [e]}),fc(oc,nc,(e,t)=>(e.sourcePosition.hasSameParentAs(t.position)&&(e.howMany+=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByInsertOperation(t),e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t),[e])),fc(oc,oc,(e,t,i)=>{if(e.sourcePosition.isEqual(t.sourcePosition)&&e.targetPosition.isEqual(t.targetPosition)){if(i.bWasUndone){const i=t.graveyardPosition.path.slice();return i.push(0),e.sourcePosition=new ra(t.graveyardPosition.root,i),e.howMany=0,[e]}return [new lc(0)]}if(e.sourcePosition.isEqual(t.sourcePosition)&&!e.targetPosition.isEqual(t.targetPosition)&&!i.bWasUndone&&"splitAtSource"!=i.abRelation){const n="$graveyard"==e.targetPosition.root.rootName,s="$graveyard"==t.targetPosition.root.rootName;if(s&&!n||!(n&&!s)&&i.aIsStrong){const i=t.targetPosition._getTransformedByMergeOperation(t),n=e.targetPosition._getTransformedByMergeOperation(t);return [new ic(i,e.howMany,n,0)]}return [new lc(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)&&i.aIsStrong||(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]}),fc(oc,ic,(e,t,i)=>{const n=ha._createFromPositionAndShift(t.sourcePosition,t.howMany);return "remove"==t.type&&!i.bWasUndone&&e.deletionPosition.hasSameParentAs(t.sourcePosition)&&n.containsPosition(e.sourcePosition)?[new lc(0)]:(t.sourcePosition.getShiftedBy(t.howMany).isEqual(e.sourcePosition)?e.sourcePosition.stickiness="toNone":t.targetPosition.isEqual(e.sourcePosition)&&"mergeSourceAffected"==i.abRelation?e.sourcePosition.stickiness="toNext":t.sourcePosition.isEqual(e.targetPosition)?(e.targetPosition.stickiness="toNone",e.howMany-=t.howMany):t.targetPosition.isEqual(e.targetPosition)&&"mergeTargetWasBefore"==i.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])}),fc(oc,sc,(e,t,i)=>{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"==i.abRelation)return e.sourcePosition=e.sourcePosition._getTransformedBySplitOperation(t),[e]}if(e.sourcePosition.isEqual(t.splitPosition)){if("mergeSourceNotMoved"==i.abRelation)return e.howMany=0,e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e];if("mergeSameElement"==i.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]}),fc(ic,nc,(e,t)=>{const i=ha._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByInsertOperation(t,false)[0];return e.sourcePosition=i.start,e.howMany=i.end.offset-i.start.offset,e.targetPosition.isEqual(t.position)||(e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t)),[e]}),fc(ic,ic,(e,t,i)=>{const n=ha._createFromPositionAndShift(e.sourcePosition,e.howMany),s=ha._createFromPositionAndShift(t.sourcePosition,t.howMany);let o,r=i.aIsStrong,a=!i.aIsStrong;if("insertBefore"==i.abRelation||"insertAfter"==i.baRelation?a=true:"insertAfter"!=i.abRelation&&"insertBefore"!=i.baRelation||(a=false),o=e.targetPosition.isEqual(t.targetPosition)&&a?e.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany):e.targetPosition._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),xc(e,t)&&xc(t,e))return [t.getReversed()];if(n.containsPosition(t.targetPosition)&&n.containsRange(s,true))return n.start=n.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),n.end=n.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),Ac([n],o);if(s.containsPosition(e.targetPosition)&&s.containsRange(n,true))return n.start=n.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),n.end=n.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),Ac([n],o);const l=ei(e.sourcePosition.getParentPath(),t.sourcePosition.getParentPath());if("prefix"==l||"extension"==l)return n.start=n.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),n.end=n.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),Ac([n],o);"remove"!=e.type||"remove"==t.type||i.aWasUndone||i.forceWeakRemove?"remove"==e.type||"remove"!=t.type||i.bWasUndone||i.forceWeakRemove||(r=false):r=true;const c=[],u=n.getDifference(s);for(const e of u){e.start=e.start._getTransformedByDeletion(t.sourcePosition,t.howMany),e.end=e.end._getTransformedByDeletion(t.sourcePosition,t.howMany);const i="same"==ei(e.start.getParentPath(),t.getMovedRangeStart().getParentPath()),n=e._getTransformedByInsertion(t.getMovedRangeStart(),t.howMany,i);c.push(...n);}const d=n.getIntersection(s);return null!==d&&r&&(d.start=d.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),d.end=d.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),0===c.length?c.push(d):1==c.length?s.start.isBefore(n.start)||s.start.isEqual(n.start)?c.unshift(d):c.push(d):c.splice(1,0,d)),0===c.length?[new lc(e.baseVersion)]:Ac(c,o)}),fc(ic,sc,(e,t,i)=>{let n=e.targetPosition.clone();if(e.targetPosition.isEqual(t.insertionPosition)&&t.graveyardPosition&&"moveTargetAfter"!=i.abRelation||(n=e.targetPosition._getTransformedBySplitOperation(t)),e.sourcePosition.isEqual(t.insertionPosition)&&"firstToMoveMerged"==i.abRelation)return e.howMany++,e.targetPosition=n,[e];const s=ha._createFromPositionAndShift(e.sourcePosition,e.howMany);if(s.end.isEqual(t.insertionPosition))return t.graveyardPosition&&"lastToMoveMerged"!=i.abRelation||e.howMany++,e.targetPosition=n,[e];if(s.start.hasSameParentAs(t.splitPosition)&&s.containsPosition(t.splitPosition)){let e=new ha(t.splitPosition,s.end);e=e._getTransformedBySplitOperation(t);return Ac([new ha(s.start,t.splitPosition),e],n)}e.targetPosition.isEqual(t.splitPosition)&&"insertAtSource"==i.abRelation&&(n=t.moveTargetPosition),e.targetPosition.isEqual(t.insertionPosition)&&"insertBetween"==i.abRelation&&(n=e.targetPosition);const o=[s._getTransformedBySplitOperation(t)];if(t.graveyardPosition){const n=s.start.isEqual(t.graveyardPosition)||s.containsPosition(t.graveyardPosition);e.howMany>1&&n&&!i.aWasUndone&&o.push(ha._createFromPositionAndShift(t.insertionPosition,1));}return Ac(o,n)}),fc(ic,oc,(e,t,i)=>{const n=ha._createFromPositionAndShift(e.sourcePosition,e.howMany);if(t.deletionPosition.hasSameParentAs(e.sourcePosition)&&n.containsPosition(t.sourcePosition))if("remove"!=e.type||i.forceWeakRemove){if(1==e.howMany)return i.bWasUndone?(e.sourcePosition=t.graveyardPosition.clone(),e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),[e]):[new lc(0)]}else if(!i.aWasUndone){const i=[];let n=t.graveyardPosition.clone(),s=t.targetPosition._getTransformedByMergeOperation(t);const o=e.targetPosition.getTransformedByOperation(t);e.howMany>1&&(i.push(new ic(e.sourcePosition,e.howMany-1,o,0)),n=n._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 ic(n,1,r,0),l=a.getMovedRangeStart().path.slice();l.push(0);const c=new ra(a.targetPosition.root,l);s=s._getTransformedByMove(n,r,1);const u=new ic(s,t.howMany,c,0);return i.push(a),i.push(u),i}const s=ha._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]}),fc(cc,nc,(e,t)=>(e.position=e.position._getTransformedByInsertOperation(t),[e])),fc(cc,oc,(e,t)=>e.position.isEqual(t.deletionPosition)?(e.position=t.graveyardPosition.clone(),e.position.stickiness="toNext",[e]):(e.position=e.position._getTransformedByMergeOperation(t),[e])),fc(cc,ic,(e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e])),fc(cc,cc,(e,t,i)=>{if(e.position.isEqual(t.position)){if(!i.aIsStrong)return [new lc(0)];e.oldName=t.newName;}return [e]}),fc(cc,sc,(e,t)=>{if("same"==ei(e.position.path,t.splitPosition.getParentPath())&&!t.graveyardPosition){const t=new cc(e.position.getShiftedBy(1),e.oldName,e.newName,0);return [e,t]}return e.position=e.position._getTransformedBySplitOperation(t),[e]}),fc(uc,uc,(e,t,i)=>{if(e.root===t.root&&e.key===t.key){if(!i.aIsStrong)return [new lc(0)];e.oldValue=t.newValue;}return [e]}),fc(dc,dc,(e,t)=>e.rootName===t.rootName&&e.isAdd===t.isAdd?[new lc(0)]:[e]),fc(sc,nc,(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])),fc(sc,oc,(e,t,i)=>{if(!e.graveyardPosition&&!i.bWasUndone&&e.splitPosition.hasSameParentAs(t.sourcePosition)){const i=t.graveyardPosition.path.slice();i.push(0);const n=new ra(t.graveyardPosition.root,i),s=sc.getInsertionPosition(new ra(t.graveyardPosition.root,i)),o=new sc(n,0,s,null,0);return e.splitPosition=e.splitPosition._getTransformedByMergeOperation(t),e.insertionPosition=sc.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=sc.getInsertionPosition(e.splitPosition),e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]}),fc(sc,ic,(e,t,i)=>{const n=ha._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.graveyardPosition){const s=n.start.isEqual(e.graveyardPosition)||n.containsPosition(e.graveyardPosition);if(!i.bWasUndone&&s){const i=e.splitPosition._getTransformedByMoveOperation(t),n=e.graveyardPosition._getTransformedByMoveOperation(t),s=n.path.slice();s.push(0);const o=new ra(n.root,s);return [new ic(i,e.howMany,o,0)]}e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(t);}const s=e.splitPosition.isEqual(t.targetPosition);if(s&&("insertAtSource"==i.baRelation||"splitBefore"==i.abRelation))return e.howMany+=t.howMany,e.splitPosition=e.splitPosition._getTransformedByDeletion(t.sourcePosition,t.howMany),e.insertionPosition=sc.getInsertionPosition(e.splitPosition),[e];if(s&&i.abRelation&&i.abRelation.howMany){const{howMany:t,offset:n}=i.abRelation;return e.howMany+=t,e.splitPosition=e.splitPosition.getShiftedBy(n),[e]}if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&n.containsPosition(e.splitPosition)){const i=t.howMany-(e.splitPosition.offset-t.sourcePosition.offset);return e.howMany-=i,e.splitPosition.hasSameParentAs(t.targetPosition)&&e.splitPosition.offset<t.targetPosition.offset&&(e.howMany+=t.howMany),e.splitPosition=t.sourcePosition.clone(),e.insertionPosition=sc.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=sc.getInsertionPosition(e.splitPosition),[e]}),fc(sc,sc,(e,t,i)=>{if(e.splitPosition.isEqual(t.splitPosition)){if(!e.graveyardPosition&&!t.graveyardPosition)return [new lc(0)];if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition))return [new lc(0)];if("splitBefore"==i.abRelation)return e.howMany=0,e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t),[e]}if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition)){const n="$graveyard"==e.splitPosition.root.rootName,s="$graveyard"==t.splitPosition.root.rootName;if(s&&!n||!(n&&!s)&&i.aIsStrong){const i=[];return t.howMany&&i.push(new ic(t.moveTargetPosition,t.howMany,t.splitPosition,0)),e.howMany&&i.push(new ic(e.splitPosition,e.howMany,e.moveTargetPosition,0)),i}return [new lc(0)]}if(e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t)),e.splitPosition.isEqual(t.insertionPosition)&&"splitBefore"==i.abRelation)return e.howMany++,[e];if(t.splitPosition.isEqual(e.insertionPosition)&&"splitBefore"==i.baRelation){const i=t.insertionPosition.path.slice();i.push(0);const n=new ra(t.insertionPosition.root,i);return [e,new ic(e.insertionPosition,1,n,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=sc.getInsertionPosition(e.splitPosition),[e]});class Ec extends(z(ra)){constructor(e,t,i="toNone"){if(super(e,t,i),!this.root.is("rootElement"))throw new I("model-liveposition-root-not-rootelement",e);Tc.call(this);}detach(){this.stopListening();}toPosition(){return new ra(this.root,this.path.slice(),this.stickiness)}static fromPosition(e,t){return new this(e.root,e.path.slice(),t||e.stickiness)}}function Tc(){this.listenTo(this.root.document.model,"applyOperation",(e,t)=>{const i=t[0];i.isDocumentOperation&&Sc.call(this,i);},{priority:"low"});}function Sc(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);}}Ec.prototype.is=function(e){return "livePosition"===e||"model:livePosition"===e||"position"==e||"model:position"===e};class Ic{operations;isUndoable;isLocal;isUndo;isTyping;constructor(e={}){"string"==typeof e&&(e="transparent"===e?{isUndoable:false}:{},P("batch-constructor-deprecated-string-type"));const{isUndoable:t=true,isLocal:i=true,isUndo:n=false,isTyping:s=false}=e;this.operations=[],this.isUndoable=t,this.isLocal=i,this.isUndo=n,this.isTyping=s;}get baseVersion(){for(const e of this.operations)if(null!==e.baseVersion)return e.baseVersion;return null}addOperation(e){return e.isDocumentOperation&&(e.batch=this,this.operations.push(e)),e}}class Pc{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:true}))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),i=this._isInInsertedElement(t.targetPosition.parent);e||this._markRemove(t.sourcePosition.parent,t.sourcePosition.offset,t.howMany),i||this._markInsert(t.targetPosition.parent,t.getMovedRangeStart().offset,t.howMany);const n=ha._createFromPositionAndShift(t.sourcePosition,t.howMany);for(const e of n.getItems({shallow:true}))this._setElementState(e,"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=ha._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 i=ha._createFromPositionAndShift(t.splitPosition,t.howMany);for(const e of i.getItems({shallow:true}))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 i=t.graveyardPosition.parent;this._markInsert(i,t.graveyardPosition.offset,1),this._setElementState(e,"move");const n=t.targetPosition.parent;if(!this._isInInsertedElement(n)){this._markInsert(n,t.targetPosition.offset,e.maxOffset);const i=ha._createFromPositionAndShift(t.sourcePosition,t.howMany);for(const e of i.getItems({shallow:true}))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;this._bufferRootAttributeChange(e,t.key,t.oldValue,t.newValue);break}}this._cachedChanges=null;}bufferMarkerChange(e,t,i){t.range&&t.range.root.is("rootElement")&&!t.range.root._isLoaded&&(t.range=null),i.range&&i.range.root.is("rootElement")&&!i.range.root._isLoaded&&(i.range=null);let n=this._changedMarkers.get(e);n?n.newMarkerData=i:(n={newMarkerData:i,oldMarkerData:t},this._changedMarkers.set(e,n)),null==n.oldMarkerData.range&&null==i.range&&this._changedMarkers.delete(e);}getMarkersToRemove(){const e=[];for(const[t,i]of this._changedMarkers)null!=i.oldMarkerData.range&&e.push({name:t,range:i.oldMarkerData.range});return e}getMarkersToAdd(){const e=[];for(const[t,i]of this._changedMarkers)null!=i.newMarkerData.range&&e.push({name:t,range:i.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  true;if(this._changedRoots.size>0)return  true;for(const{newMarkerData:e,oldMarkerData:t}of this._changedMarkers.values()){if(e.affectsData!==t.affectsData)return  true;if(e.affectsData){const i=e.range&&!t.range,n=!e.range&&t.range,s=e.range&&t.range&&!e.range.isEqual(t.range);if(i||n||s)return  true}}return  false}getChanges(e={}){if(this._cachedChanges)return e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice();let t=[];for(const e of this._changesInElement.keys()){const i=this._changesInElement.get(e).sort((e,t)=>e.offset===t.offset?e.type!=t.type?"remove"==e.type?-1:1:0:e.offset<t.offset?-1:1),n=this._elementChildrenSnapshots.get(e),s=Rc(e.getChildren()),o=Oc(n.length,i);let r=0,a=0;for(const i of o)if("i"===i){const i=this._getDiffActionForNode(s[r].node,"insert"),n=this._elementsSnapshots.get(s[r].node),o=this._getInsertDiff(e,r,i,s[r],n);t.push(o),r++;}else if("r"===i){const i=this._getDiffActionForNode(n[a].node,"remove"),s=this._getRemoveDiff(e,r,i,n[a]);t.push(s),a++;}else if("a"===i){const i=n[a].attributes,o=s[r].attributes;let l;if("$text"==s[r].name)l=new ha(ra._createAt(e,r),ra._createAt(e,r+1));else {const t=e.offsetToIndex(r);l=new ha(ra._createAt(e,r),ra._createAt(e.getChild(t),0));}const c=this._getAttributesDiff(l,i,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 e=1,i=0;e<t.length;e++){const n=t[i],s=t[e],o="remove"==n.type&&"remove"==s.type&&"$text"==n.name&&"$text"==s.name&&n.position.isEqual(s.position),r="insert"==n.type&&"insert"==s.type&&"$text"==n.name&&"$text"==s.name&&n.position.parent==s.position.parent&&n.position.offset+n.length==s.position.offset,a="attribute"==n.type&&"attribute"==s.type&&n.position.parent==s.position.parent&&n.range.isFlat&&s.range.isFlat&&n.position.offset+n.length==s.position.offset&&n.attributeKey==s.attributeKey&&n.attributeOldValue==s.attributeOldValue&&n.attributeNewValue==s.attributeNewValue;o||r||a?(n.length++,a&&(n.range.end=n.range.end.getShiftedBy(1)),t[e]=null):i=e;}t=t.filter(e=>e);for(const e of t)delete e.changeCount,"attribute"==e.type&&(delete e.position,delete e.length);return this._changeCount=0,this._cachedChangesWithGraveyard=t,this._cachedChanges=t.filter(Bc),e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice()}getChangedRoots(){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=ha._createOn(e);for(const e of this._markerCollection.getMarkersIntersectingRange(t)){const t=e.getData();this.bufferMarkerChange(e.name,t,t);}this._cachedChanges=null;}_bufferRootLoad(e){if(e.isAttached()){this._bufferRootStateChange(e.rootName,true),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 i=this._changedRoots.get(e);void 0!==i.state?(delete i.state,void 0===i.attributes&&this._changedRoots.delete(e)):i.state=t?"attached":"detached";}_bufferRootAttributeChange(e,t,i,n){const s=this._changedRoots.get(e)||{name:e},o=s.attributes||{};if(o[t]){const e=o[t];n===e.oldValue?delete o[t]:e.newValue=n;}else o[t]={oldValue:i,newValue:n};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,i){if(e.root.is("rootElement")&&!e.root._isLoaded)return;const n={type:"insert",offset:t,howMany:i,count:this._changeCount++};this._markChange(e,n);}_markRemove(e,t,i){if(e.root.is("rootElement")&&!e.root._isLoaded)return;const n={type:"remove",offset:t,howMany:i,count:this._changeCount++};this._markChange(e,n),this._removeAllNestedChanges(e,t,i);}_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 i=this._getChangesForElement(e);this._handleChange(t,i),i.push(t);for(let e=0;e<i.length;e++)i[e].howMany<1&&(i.splice(e,1),e--);}_setElementState(e,t){if(!e.is("element"))return;const i=Pc._statesPriority.indexOf(this._elementState.get(e));Pc._statesPriority.indexOf(t)>i&&this._elementState.set(e,t);}_getDiffActionForNode(e,t){if(!e.is("element"))return t;if(!this._elementsSnapshots.has(e))return t;const i=this._elementState.get(e);return i&&"move"!=i?i: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=Rc(e.getChildren());this._elementChildrenSnapshots.set(e,t);for(const e of t)this._elementsSnapshots.set(e.node,e);}_handleChange(e,t){e.nodesToHandle=e.howMany;for(const i of t){const n=e.offset+e.howMany,s=i.offset+i.howMany;if("insert"==e.type&&("insert"==i.type&&(e.offset<=i.offset?i.offset+=e.howMany:e.offset<s&&(i.howMany+=e.nodesToHandle,e.nodesToHandle=0)),"remove"==i.type&&e.offset<i.offset&&(i.offset+=e.howMany),"attribute"==i.type))if(e.offset<=i.offset)i.offset+=e.howMany;else if(e.offset<s){const s=i.howMany;i.howMany=e.offset-i.offset,t.unshift({type:"attribute",offset:n,howMany:s-i.howMany,count:this._changeCount++});}if("remove"==e.type){if("insert"==i.type)if(n<=i.offset)i.offset-=e.howMany;else if(n<=s)if(e.offset<i.offset){const t=n-i.offset;i.offset=e.offset,i.howMany-=t,e.nodesToHandle-=t;}else i.howMany-=e.nodesToHandle,e.nodesToHandle=0;else if(e.offset<=i.offset)e.nodesToHandle-=i.howMany,i.howMany=0;else if(e.offset<s){const t=s-e.offset;i.howMany-=t,e.nodesToHandle-=t;}if("remove"==i.type&&(n<=i.offset?i.offset-=e.howMany:e.offset<i.offset&&(e.nodesToHandle+=i.howMany,i.howMany=0)),"attribute"==i.type)if(n<=i.offset)i.offset-=e.howMany;else if(e.offset<i.offset){const t=n-i.offset;i.offset=e.offset,i.howMany-=t;}else if(e.offset<s)if(n<=s){const n=i.howMany;i.howMany=e.offset-i.offset;const s=n-i.howMany-e.nodesToHandle;t.unshift({type:"attribute",offset:e.offset,howMany:s,count:this._changeCount++});}else i.howMany-=s-e.offset;}if("attribute"==e.type){if("insert"==i.type)if(e.offset<i.offset&&n>i.offset){if(n>s){const e={type:"attribute",offset:s,howMany:n-s,count:this._changeCount++};this._handleChange(e,t),t.push(e);}e.nodesToHandle=i.offset-e.offset,e.howMany=e.nodesToHandle;}else e.offset>=i.offset&&e.offset<s&&(n>s?(e.nodesToHandle=n-s,e.offset=s):e.nodesToHandle=0);if("remove"==i.type&&e.offset<i.offset&&n>i.offset){const s={type:"attribute",offset:i.offset,howMany:n-i.offset,count:this._changeCount++};this._handleChange(s,t),t.push(s),e.nodesToHandle=i.offset-e.offset,e.howMany=e.nodesToHandle;}"attribute"==i.type&&(e.offset>=i.offset&&n<=s?(e.nodesToHandle=0,e.howMany=0,e.offset=0):e.offset<=i.offset&&n>=s&&(i.howMany=0));}}e.howMany=e.nodesToHandle,delete e.nodesToHandle;}_getInsertDiff(e,t,i,n,s){const o={type:"insert",position:ra._createAt(e,t),name:n.name,attributes:new Map(n.attributes),length:1,changeCount:this._changeCount++,action:i};return "insert"!=i&&s&&(o.before={name:s.name,attributes:new Map(s.attributes)}),o}_getRemoveDiff(e,t,i,n){return {type:"remove",action:i,position:ra._createAt(e,t),name:n.name,attributes:new Map(n.attributes),length:1,changeCount:this._changeCount++}}_getAttributesDiff(e,t,i){const n=[];i=new Map(i);for(const[s,o]of t){const t=i.has(s)?i.get(s):null;t!==o&&n.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:s,attributeOldValue:o,attributeNewValue:t,changeCount:this._changeCount++}),i.delete(s);}for(const[t,s]of i)n.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:t,attributeOldValue:null,attributeNewValue:s,changeCount:this._changeCount++});return n}_isInInsertedElement(e){const t=e.parent;if(!t)return  false;const i=this._changesInElement.get(t),n=e.startOffset;if(i)for(const e of i)if("insert"==e.type&&n>=e.offset&&n<e.offset+e.howMany)return  true;return this._isInInsertedElement(t)}_removeAllNestedChanges(e,t,i){const n=new ha(ra._createAt(e,t),ra._createAt(e,t+i));for(const e of n.getItems({shallow:true}))e.is("element")&&(this._changesInElement.delete(e),this._removeAllNestedChanges(e,0,e.maxOffset));}}function Vc(e){return {node:e,name:e.is("$text")?"$text":e.name,attributes:new Map(e.getAttributes())}}function Rc(e){const t=[];for(const i of e)if(i.is("$text"))for(let e=0;e<i.data.length;++e)t.push(Vc(i));else t.push(Vc(i));return t}function Oc(e,t){const i=[];let n=0,s=0;for(const e of t){if(e.offset>n){for(let t=0;t<e.offset-n;t++)i.push("e");s+=e.offset-n;}if("insert"==e.type){for(let t=0;t<e.howMany;t++)i.push("i");n=e.offset+e.howMany;}else if("remove"==e.type){for(let t=0;t<e.howMany;t++)i.push("r");n=e.offset,s+=e.howMany;}else {if(e.howMany>1500)for(let t=0;t<e.howMany;t++)i.push("a");else i.push(..."a".repeat(e.howMany).split(""));n=e.offset+e.howMany,s+=e.howMany;}}if(s<e)for(let t=0;t<e-s-n;t++)i.push("e");return i}function Bc(e){const t="position"in e&&"$graveyard"==e.position.root.rootName,i="range"in e&&"$graveyard"==e.range.root.rootName;return !t&&!i}class Lc{_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 I("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 i=this._operations[0];void 0===e&&(e=i.baseVersion);let n=t-1;for(const[t,i]of this._gaps)e>t&&e<i&&(e=i),n>t&&n<i&&(n=t-1);if(n<i.baseVersion||e>this.lastOperation.baseVersion)return [];let s=this._baseVersionToOperationIndex.get(e);void 0===s&&(s=0);let o=this._baseVersionToOperationIndex.get(n);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 Mc extends Fa{rootName;_document;_isAttached=true;_isLoaded=true;constructor(e,t,i="main"){super(t),this._document=e,this.rootName=i;}get document(){return this._document}isAttached(){return this._isAttached}toJSON(){return this.rootName}}Mc.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 Fc="$graveyard";class Nc extends(z()){model;history;selection;roots;differ;isReadOnly;_postFixers;_hasSelectionChangedFromTheLastChangeBlock;constructor(e){super(),this.model=e,this.history=new Lc,this.selection=new Oa(this),this.roots=new kn({idProperty:"rootName"}),this.differ=new Pc(e.markers),this.isReadOnly=false,this._postFixers=new Set,this._hasSelectionChangedFromTheLastChangeBlock=false,this.createRoot("$root",Fc),this.listenTo(e,"applyOperation",(e,t)=>{const i=t[0];i.isDocumentOperation&&this.differ.bufferOperation(i);},{priority:"high"}),this.listenTo(e,"applyOperation",(e,t)=>{const i=t[0];i.isDocumentOperation&&this.history.addOperation(i);},{priority:"low"}),this.listenTo(this.selection,"change",()=>{this._hasSelectionChangedFromTheLastChangeBlock=true;}),this.listenTo(e.markers,"update",(e,t,i,n,s)=>{const o={...t.getData(),range:n};this.differ.bufferMarkerChange(t.name,s,o),null===i&&t.on("change",(e,i)=>{const n=t.getData();this.differ.bufferMarkerChange(t.name,{...n,range:i},n);});}),this.registerPostFixer(e=>{let t=false;for(const i of this.roots)i.isAttached()||i.isEmpty||(e.remove(e.createRangeIn(i)),t=true);for(const i of this.model.markers)i.getRange().root.isAttached()||(e.removeMarker(i),t=true);return t});}get version(){return this.history.version}set version(e){this.history.version=e;}get graveyard(){return this.getRoot(Fc)}createRoot(e="$root",t="main"){if(this.roots.get(t))throw new I("model-document-createroot-name-exists",this,{name:t});const i=new Mc(this,e,t);return this.roots.add(i),i}destroy(){this.selection.destroy(),this.stopListening();}getRoot(e="main"){return this.roots.get(e)}getRootNames(e=false){return this.getRoots(e).map(e=>e.rootName)}getRoots(e=false){return this.roots.filter(t=>t!=this.graveyard&&(e||t.isAttached())&&t._isLoaded)}registerPostFixer(e){this._postFixers.add(e);}toJSON(){const e=vt(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=false;}_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,i=t.schema,n=t.createPositionFromPath(e,[0]);return i.getNearestSelectionRange(n)||t.createRange(n)}_validateSelectionRange(e){return e.start.isValid()&&e.end.isValid()&&Dc(e.start)&&Dc(e.end)}_callPostFixers(e){let t=false;do{for(const i of this._postFixers)if(this.selection.refresh(),t=i(e),t)break}while(t)}}function Dc(e){const t=e.textNode;if(t){const i=t.data,n=e.offset-t.startOffset;return !Wn(i,n)&&!Gn(i,n)}return  true}class zc extends(z()){_markers=new Map;[Symbol.iterator](){return this._markers.values()}has(e){const t=e instanceof Hc?e.name:e;return this._markers.has(t)}get(e){return this._markers.get(e)||null}_set(e,t,i=false,n=false){const s=e instanceof Hc?e.name:e;if(s.includes(","))throw new I("markercollection-incorrect-marker-name",this);const o=this._markers.get(s);if(o){const e=o.getData(),r=o.getRange();let a=false;return r.isEqual(t)||(o._attachLiveRange(Sa.fromRange(t)),a=true),i!=o.managedUsingOperations&&(o._managedUsingOperations=i,a=true),"boolean"==typeof n&&n!=o.affectsData&&(o._affectsData=n,a=true),a&&this.fire(`update:${s}`,o,r,t,e),o}const r=Sa.fromRange(t),a=new Hc(s,r,i,n);return this._markers.set(s,a),this.fire(`update:${s}`,a,null,t,{...a.getData(),range:null}),a}_remove(e){const t=e instanceof Hc?e.name:e,i=this._markers.get(t);return !!i&&(this._markers.delete(t),this.fire(`update:${t}`,i,i.getRange(),null,i.getData()),this._destroyMarker(i),true)}_refresh(e){const t=e instanceof Hc?e.name:e,i=this._markers.get(t);if(!i)throw new I("markercollection-refresh-marker-not-exists",this);const n=i.getRange();this.fire(`update:${t}`,i,n,n,i.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 Hc extends(z(ia)){name;_managedUsingOperations;_affectsData;_liveRange;constructor(e,t,i,n){super(),this.name=e,this._liveRange=this._attachLiveRange(t),this._managedUsingOperations=i,this._affectsData=n;}get managedUsingOperations(){if(!this._liveRange)throw new I("marker-destroyed",this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new I("marker-destroyed",this);return this._affectsData}getData(){return {range:this.getRange(),affectsData:this.affectsData,managedUsingOperations:this.managedUsingOperations}}getStart(){if(!this._liveRange)throw new I("marker-destroyed",this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new I("marker-destroyed",this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new I("marker-destroyed",this);return this._liveRange.toRange()}toJSON(){return {name:this.name,range:this._liveRange?.toJSON(),usingOperations:this._managedUsingOperations,affectsData:this._affectsData}}_attachLiveRange(e){return this._liveRange&&this._detachLiveRange(),e.delegate("change:range").to(this),e.delegate("change:content").to(this),this._liveRange=e,e}_detachLiveRange(){this._liveRange.stopDelegating("change:range",this),this._liveRange.stopDelegating("change:content",this),this._liveRange.detach(),this._liveRange=null;}}Hc.prototype.is=function(e){return "marker"===e||"model:marker"===e};class qc extends Gl{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 I("detach-operation-on-document-node",this)}_execute(){Jl(ha._createFromPositionAndShift(this.sourcePosition,this.howMany));}static get className(){return "DetachOperation"}}class Uc extends ia{markers=new Map;_children=new Ma;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  false}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 i of e)t=t.getChildAtOffset(i);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 i of e)i.name?t.push(Fa.fromJSON(i)):t.push(Va.fromJSON(i));return new Uc(t)}_appendChild(e){this._insertChild(this.childCount,e);}_insertChild(e,t){const i=function(e){if("string"==typeof e)return [new Va(e)];ti(e)||(e=[e]);return Array.from(e).map(e=>"string"==typeof e?new Va(e):e instanceof na?new Va(e.data,e.getAttributes()):e)}(t);for(const e of i)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,i);}_removeChildren(e,t=1){const i=this._children._removeNodes(e,t);for(const e of i)e.parent=null;return i}_removeChildrenArray(e){this._children._removeNodesArray(e);for(const t of e)t.parent=null;}}Uc.prototype.is=function(e){return "documentFragment"===e||"model:documentFragment"===e};class jc{model;batch;constructor(e,t){this.model=e,this.batch=t;}createText(e,t){return new Va(e,t)}createElement(e,t){return new Fa(e,t)}createDocumentFragment(){return new Uc}cloneElement(e,t=true){return e._clone(t)}insert(e,t,i=0){if(this._assertWriterUsedCorrectly(),e instanceof Va&&""==e.data)return;const n=ra._createAt(t,i);if(e.parent){if(Jc(e.root,n.root))return void this.move(ha._createOn(e),n);if(e.root.document)throw new I("model-writer-insert-forbidden-move",this);this.remove(e);}const s=n.root.document?n.root.document.version:null,o=e instanceof Uc?e._removeChildren(0,e.childCount):e,r=new nc(n,o,s);if(e instanceof Va&&(r.shouldReceiveAttributes=true),this.batch.addOperation(r),this.model.applyOperation(r),e instanceof Uc)for(const[t,i]of e.markers){const e=ra._createAt(i.root,0),s={range:new ha(i.start._getCombined(e,n),i.end._getCombined(e,n)),usingOperation:true,affectsData:true};this.model.markers.has(t)?this.updateMarker(t,s):this.addMarker(t,s);}}insertText(e,t,i,n){t instanceof Uc||t instanceof Fa||t instanceof ra?this.insert(this.createText(e),t,i):this.insert(this.createText(e,t),i,n);}insertElement(e,t,i,n){t instanceof Uc||t instanceof Fa||t instanceof ra?this.insert(this.createElement(e),t,i):this.insert(this.createElement(e,t),i,n);}append(e,t){this.insert(e,t,"end");}appendText(e,t,i){t instanceof Uc||t instanceof Fa?this.insert(this.createText(e),t,"end"):this.insert(this.createText(e,t),i,"end");}appendElement(e,t,i){t instanceof Uc||t instanceof Fa?this.insert(this.createElement(e),t,"end"):this.insert(this.createElement(e,t),i,"end");}setAttribute(e,t,i){if(this._assertWriterUsedCorrectly(),i instanceof ha){const n=i.getMinimalFlatRanges();for(const i of n)$c(this,e,t,i);}else Wc(this,e,t,i);}setAttributes(e,t){for(const[i,n]of Vn(e))this.setAttribute(i,n,t);}removeAttribute(e,t){if(this._assertWriterUsedCorrectly(),t instanceof ha){const i=t.getMinimalFlatRanges();for(const t of i)$c(this,e,null,t);}else Wc(this,e,null,t);}clearAttributes(e){this._assertWriterUsedCorrectly();const t=e=>{for(const t of e.getAttributeKeys())this.removeAttribute(t,e);};if(e instanceof ha)for(const i of e.getItems())t(i);else t(e);}move(e,t,i){if(this._assertWriterUsedCorrectly(),!(e instanceof ha))throw new I("writer-move-invalid-range",this);if(!e.isFlat)throw new I("writer-move-range-not-flat",this);const n=ra._createAt(t,i);if(n.isEqual(e.start))return;if(this._addOperationForAffectedMarkers("move",e),!Jc(e.root,n.root))throw new I("writer-move-different-document",this);const s=e.root.document?e.root.document.version:null,o=new ic(e.start,e.end.offset-e.start.offset,n,s);this.batch.addOperation(o),this.model.applyOperation(o);}remove(e){this._assertWriterUsedCorrectly();const t=(e instanceof ha?e:ha._createOn(e)).getMinimalFlatRanges().reverse();for(const e of t)this._addOperationForAffectedMarkers("move",e),Kc(e.start,e.end.offset-e.start.offset,this.batch,this.model);}merge(e){this._assertWriterUsedCorrectly();const t=e.nodeBefore,i=e.nodeAfter;if(this._addOperationForAffectedMarkers("merge",e),!(t instanceof Fa))throw new I("writer-merge-no-element-before",this);if(!(i instanceof Fa))throw new I("writer-merge-no-element-after",this);e.root.document?this._merge(e):this._mergeDetached(e);}createPositionFromPath(e,t,i){return this.model.createPositionFromPath(e,t,i)}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,i=e.nodeAfter;this.move(ha._createIn(i),ra._createAt(t,"end")),this.remove(i);}_merge(e){const t=ra._createAt(e.nodeBefore,"end"),i=ra._createAt(e.nodeAfter,0),n=e.root.document.graveyard,s=new ra(n,[0]),o=e.root.document.version,r=new oc(i,e.nodeAfter.maxOffset,t,s,o);this.batch.addOperation(r),this.model.applyOperation(r);}rename(e,t){if(this._assertWriterUsedCorrectly(),!(e instanceof Fa))throw new I("writer-rename-not-element-instance",this);const i=e.root.document?e.root.document.version:null,n=new cc(ra._createBefore(e),e.name,t,i);this.batch.addOperation(n),this.model.applyOperation(n);}split(e,t){this._assertWriterUsedCorrectly();let i,n,s=e.parent;if(!s.parent)throw new I("writer-split-element-no-parent",this);if(t||(t=s.parent),!e.parent.getAncestors({includeSelf:true}).includes(t))throw new I("writer-split-invalid-limit-element",this);do{const t=s.root.document?s.root.document.version:null,o=s.maxOffset-e.offset,r=sc.getInsertionPosition(e),a=new sc(e,o,r,null,t);this.batch.addOperation(a),this.model.applyOperation(a),i||n||(i=s,n=e.parent.nextSibling),s=(e=this.createPositionAfter(e.parent)).parent;}while(s!==t);return {position:e,range:new ha(ra._createAt(i,"end"),ra._createAt(n,0))}}wrap(e,t){if(this._assertWriterUsedCorrectly(),!e.isFlat)throw new I("writer-wrap-range-not-flat",this);const i=t instanceof Fa?t:new Fa(t);if(i.childCount>0)throw new I("writer-wrap-element-not-empty",this);if(null!==i.parent)throw new I("writer-wrap-element-attached",this);this.insert(i,e.start);const n=new ha(e.start.getShiftedBy(1),e.end.getShiftedBy(1));this.move(n,ra._createAt(i,0));}unwrap(e){if(this._assertWriterUsedCorrectly(),null===e.parent)throw new I("writer-unwrap-element-no-parent",this);this.move(ha._createIn(e),this.createPositionAfter(e)),this.remove(e);}addMarker(e,t){if(this._assertWriterUsedCorrectly(),!t||"boolean"!=typeof t.usingOperation)throw new I("writer-addmarker-no-usingoperation",this);const i=t.usingOperation,n=t.range,s=void 0!==t.affectsData&&t.affectsData;if(this.model.markers.has(e))throw new I("writer-addmarker-marker-exists",this);if(!n)throw new I("writer-addmarker-no-range",this);return i?(Gc(this,e,null,n,s),this.model.markers.get(e)):this.model.markers._set(e,n,i,s)}updateMarker(e,t){this._assertWriterUsedCorrectly();const i="string"==typeof e?e:e.name,n=this.model.markers.get(i);if(!n)throw new I("writer-updatemarker-marker-not-exists",this);if(!t)return P("writer-updatemarker-reconvert-using-editingcontroller",{markerName:i}),void this.model.markers._refresh(n);const s="boolean"==typeof t.usingOperation,o="boolean"==typeof t.affectsData,r=o?t.affectsData:n.affectsData;if(!s&&!t.range&&!o)throw new I("writer-updatemarker-wrong-options",this);const a=n.getRange(),l=t.range?t.range:a;s&&t.usingOperation!==n.managedUsingOperations?t.usingOperation?Gc(this,i,null,l,r):(Gc(this,i,a,null,r),this.model.markers._set(i,l,void 0,r)):n.managedUsingOperations?Gc(this,i,a,l,r):this.model.markers._set(i,l,void 0,r);}removeMarker(e){this._assertWriterUsedCorrectly();const t="string"==typeof e?e:e.name;if(!this.model.markers.has(t))throw new I("writer-removemarker-no-marker",this);const i=this.model.markers.get(t);if(!i.managedUsingOperations)return void this.model.markers._remove(t);Gc(this,t,i.getRange(),null,i.affectsData);}addRoot(e,t="$root"){this._assertWriterUsedCorrectly();const i=this.model.document.getRoot(e);if(i&&i.isAttached())throw new I("writer-addroot-root-exists",this);const n=this.model.document,s=new dc(e,t,true,n,n.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 I("writer-detachroot-no-root",this);for(const e of this.model.markers)e.getRange().root===t&&this.removeMarker(e);for(const e of t.getAttributeKeys())this.removeAttribute(e,t);this.remove(this.createRangeIn(t));const i=this.model.document,n=new dc(t.rootName,t.name,false,i,i.version);this.batch.addOperation(n),this.model.applyOperation(n);}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[t,i]of Vn(e))this._setSelectionAttribute(t,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 i=this.model.document.selection;if(i.isCollapsed&&i.anchor.parent.isEmpty){const n=Oa._getStoreAttributeKey(e);this.setAttribute(n,t,i.anchor.parent);}i._setAttribute(e,t);}_removeSelectionAttribute(e){const t=this.model.document.selection;if(t.isCollapsed&&t.anchor.parent.isEmpty){const i=Oa._getStoreAttributeKey(e);this.removeAttribute(i,t.anchor.parent);}t._removeAttribute(e);}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new I("writer-incorrect-use",this)}_addOperationForAffectedMarkers(e,t){for(const i of this.model.markers){if(!i.managedUsingOperations)continue;const n=i.getRange();let s=false;if("move"===e){const e=t;s=e.containsPosition(n.start)||e.start.isEqual(n.start)||e.containsPosition(n.end)||e.end.isEqual(n.end);}else {const e=t,i=e.nodeBefore,o=e.nodeAfter,r=n.start.parent==i&&n.start.isAtEnd,a=n.end.parent==o&&0==n.end.offset,l=n.end.nodeAfter==o,c=n.start.nodeAfter==o;s=r||a||l||c;}s&&this.updateMarker(i.name,{range:n});}}}function $c(e,t,i,n){const s=e.model,o=s.document;let r,a,l,c=n.start;for(const e of n.getWalker({shallow:true}))l=e.item.getAttribute(t),r&&a!=l&&(a!=i&&u(),c=r),r=e.nextPosition,a=l;function u(){const n=new ha(c,r),l=n.root.document?o.version:null,u=new ac(n,t,a,i,l);e.batch.addOperation(u),s.applyOperation(u);}r instanceof ra&&r!=c&&a!=i&&u();}function Wc(e,t,i,n){const s=e.model,o=s.document,r=n.getAttribute(t);let a,l;if(r!=i){if(n.root===n){const e=n.document?o.version:null;l=new uc(n,t,r,i,e);}else {a=new ha(ra._createBefore(n),e.createPositionAfter(n));const s=a.root.document?o.version:null;l=new ac(a,t,r,i,s);}e.batch.addOperation(l),s.applyOperation(l);}}function Gc(e,t,i,n,s){const o=e.model,r=o.document,a=new rc(t,i,n,o.markers,!!s,r.version);e.batch.addOperation(a),o.applyOperation(a);}function Kc(e,t,i,n){let s;if(e.root.document){const i=n.document,o=new ra(i.graveyard,[0]);s=new ic(e,t,o,i.version);}else s=new qc(e,t);i.addOperation(s),n.applyOperation(s);}function Jc(e,t){return e===t||e instanceof Mc&&t instanceof Mc}function Qc(e){e.document.registerPostFixer(t=>function(e,t){const i=t.document.selection,n=t.schema,s=[];let o=false;for(const e of i.getRanges()){const t=Yc(e,n);t&&!t.isEqual(e)?(s.push(t),o=true):s.push(e);}o&&e.setSelection(Xc(s),{backward:i.isBackward});return  false}(t,e));}function Yc(e,t){return e.isCollapsed?function(e,t){const i=e.start,n=t.getNearestSelectionRange(i);if(!n){const e=i.getAncestors().reverse().find(e=>t.isObject(e));return e?ha._createOn(e):null}if(!n.isCollapsed)return n;const s=n.start;if(i.isEqual(s))return null;return new ha(s)}(e,t):function(e,t){const{start:i,end:n}=e,s=t.checkChild(i,"$text"),o=t.checkChild(n,"$text"),r=t.getLimitElement(i),a=t.getLimitElement(n);if(r===a){if(s&&o)return null;if(function(e,t,i){const n=e.nodeAfter&&!i.isLimit(e.nodeAfter)||i.checkChild(e,"$text"),s=t.nodeBefore&&!i.isLimit(t.nodeBefore)||i.checkChild(t,"$text");return n||s}(i,n,t)){const e=i.nodeAfter&&t.isSelectable(i.nodeAfter)?null:t.getNearestSelectionRange(i,"forward"),s=n.nodeBefore&&t.isSelectable(n.nodeBefore)?null:t.getNearestSelectionRange(n,"backward"),o=e?e.start:i,r=s?s.end:n;return new ha(o,r)}}const l=r&&!r.is("rootElement"),c=a&&!a.is("rootElement");if(l||c){const e=i.nodeAfter&&n.nodeBefore&&i.nodeAfter.parent===n.nodeBefore.parent,s=l&&(!e||!eu(i.nodeAfter,t)),o=c&&(!e||!eu(n.nodeBefore,t));let u=i,d=n;return s&&(u=ra._createBefore(Zc(r,t))),o&&(d=ra._createAfter(Zc(a,t))),new ha(u,d)}return null}(e,t)}function Zc(e,t){let i=e,n=i;for(;t.isLimit(n)&&n.parent;)i=n,n=n.parent;return i}function Xc(e){const t=[...e],i=new Set;let n=1;for(;n<t.length;){const e=t[n],s=t.slice(0,n);for(const[o,r]of s.entries())if(!i.has(o))if(e.isEqual(r))i.add(o);else if(e.isIntersecting(r)){i.add(o),i.add(n);const s=e.getJoined(r);t.push(s);}n++;}const s=t.filter((e,t)=>!i.has(t));return s}function eu(e,t){return e&&t.isSelectable(e)}function tu(e,t,i={}){if(t.isCollapsed)return;const n=t.getFirstRange();if("$graveyard"==n.root.rootName)return;const s=e.schema;e.change(e=>{if(!i.doNotResetEntireContent&&function(e,t){const i=e.getLimitElement(t);if(!t.containsEntireContent(i))return  false;const n=t.getFirstRange();if(n.start.parent==n.end.parent)return  false;return e.checkChild(i,"paragraph")}(s,t))return void function(e,t){const i=e.model.schema.getLimitElement(t);e.remove(e.createRangeIn(i)),ou(e,e.createPositionAt(i,0),t);}(e,t);const o={};if(!i.doNotAutoparagraph){const e=t.getSelectedElement();e&&Object.assign(o,s.getAttributesWithProperty(e,"copyOnReplace",true));}let r,a;i.doNotFixSelection?(r=Ec.fromPosition(n.start,"toPrevious"),a=Ec.fromPosition(n.end,"toNext")):[r,a]=function(e){const t=e.root.document.model,i=e.start;let n=e.end;if(t.hasContent(e,{ignoreMarkers:true})){const i=function(e){const t=e.parent,i=t.root.document.model.schema,n=t.getAncestors({parentFirst:true,includeSelf:true});for(const e of n){if(i.isLimit(e))return null;if(i.isBlock(e))return e}}(n);if(i&&n.isTouching(t.createPositionAt(i,0))){const i=t.createSelection(e);t.modifySelection(i,{direction:"backward"});const s=i.getLastPosition(),o=t.createRange(s,n);t.hasContent(o,{ignoreMarkers:true})||(n=s);}}return [Ec.fromPosition(i,"toPrevious"),Ec.fromPosition(n,"toNext")]}(n),r.isTouching(a)||e.remove(e.createRange(r,a)),i.leaveUnmerged||(!function(e,t,i){const n=e.model;if(!su(e.model.schema,t,i))return;const[s,o]=function(e,t){const i=e.getAncestors(),n=t.getAncestors();let s=0;for(;i[s]&&i[s]==n[s];)s++;return [i[s],n[s]]}(t,i);if(!s||!o)return;!n.hasContent(s,{ignoreMarkers:true})&&n.hasContent(o,{ignoreMarkers:true})?nu(e,t,i,s.parent):iu(e,t,i,s.parent);}(e,r,a),s.removeDisallowedAttributes(r.parent.getChildren(),e)),ru(e,t,r),!i.doNotAutoparagraph&&function(e,t){const i=e.checkChild(t,"$text"),n=e.checkChild(t,"paragraph");return !i&&n}(s,r)&&ou(e,r,t,o),r.detach(),a.detach();});}function iu(e,t,i,n){const s=t.parent,o=i.parent;if(s!=n&&o!=n){for(t=e.createPositionAfter(s),(i=e.createPositionBefore(o)).isEqual(t)||e.insert(o,t),e.merge(t);i.parent.isEmpty;){const t=i.parent;i=e.createPositionBefore(t),e.remove(t);}su(e.model.schema,t,i)&&iu(e,t,i,n);}}function nu(e,t,i,n){const s=t.parent,o=i.parent;if(s!=n&&o!=n){for(t=e.createPositionAfter(s),(i=e.createPositionBefore(o)).isEqual(t)||e.insert(s,i);t.parent.isEmpty;){const i=t.parent;t=e.createPositionBefore(i),e.remove(i);}i=e.createPositionBefore(o),function(e,t){const i=t.nodeBefore,n=t.nodeAfter;i.name!=n.name&&e.rename(i,n.name);e.clearAttributes(i),e.setAttributes(Object.fromEntries(n.getAttributes()),i),e.merge(t);}(e,i),su(e.model.schema,t,i)&&nu(e,t,i,n);}}function su(e,t,i){const n=t.parent,s=i.parent;return n!=s&&(!e.isLimit(n)&&!e.isLimit(s)&&function(e,t,i){const n=new ha(e,t);for(const e of n.getWalker())if(i.isLimit(e.item))return  false;return  true}(t,i,e))}function ou(e,t,i,n={}){const s=e.createElement("paragraph");e.model.schema.setAllowedAttributes(s,n,e),e.insert(s,t),ru(e,i,e.createPositionAt(s,0));}function ru(e,t,i){t instanceof Oa?e.setSelection(i):t.setTo(i);}function au(e,t){return e.change(e=>{const i=e.createDocumentFragment(),n=t.getFirstRange();if(!n||n.isCollapsed)return i;const s=n.start.root,o=n.start.getCommonPath(n.end),r=s.getNodeByPath(o);let a;a=n.start.parent==n.end.parent?n:e.createRange(e.createPositionAt(r,n.start.path[o.length]),e.createPositionAt(r,n.end.path[o.length]+1));const l=a.end.offset-a.start.offset;for(const t of a.getItems({shallow:true}))t.is("$textProxy")?e.appendText(t.data,t.getAttributes(),i):e.append(e.cloneElement(t,true),i);if(a!=n){const t=n._getTransformedByMove(a.start,e.createPositionAt(i,0),l)[0],s=e.createRange(e.createPositionAt(i,0),t.start);lu(e.createRange(t.end,e.createPositionAt(i,"end")),e),lu(s,e);}return i})}function lu(e,t){const i=[];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))).forEach(e=>{i.push(e.start.parent),t.remove(e);}),i.forEach(e=>{let i=e;for(;i.parent&&i.isEmpty;){const e=t.createRangeOn(i);i=i.parent,t.remove(e);}});}function cu(e,t,i){return e.change(n=>{const s=i||e.document.selection;s.isCollapsed||e.deleteContent(s,{doNotAutoparagraph:true});const o=new uu(e,n,s.anchor),r=[];let a;if(t.is("documentFragment")){if(t.markers.size){const e=[];for(const[i,n]of t.markers){const{start:t,end:s}=n,o=t.isEqual(s);e.push({position:t,name:i,isCollapsed:o},{position:s,name:i,isCollapsed:o});}e.sort(({position:e},{position:t})=>e.isBefore(t)?1:-1);for(const{position:i,name:s,isCollapsed:o}of e){let e=null,a=null;const l=i.parent===t&&i.isAtStart,c=i.parent===t&&i.isAtEnd;l||c?o&&(a=l?"start":"end"):(e=n.createElement("$marker"),n.insert(e,i)),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?Sa.fromRange(l):null,t={};for(let e=r.length-1;e>=0;e--){const{name:i,element:s,collapsed:a}=r[e],l=!t[i];if(l&&(t[i]=[]),s){const e=n.createPositionAt(s,"before");t[i].push(e),n.remove(s);}else {const e=o.getAffectedRange();if(!e){a&&t[i].push(o.position);continue}a?t[i].push(e[a]):t[i].push(l?e.start:e.end);}}for(const[e,[i,s]]of Object.entries(t))i&&s&&i.root===s.root&&i.root.document&&!n.model.markers.has(e)&&n.addMarker(e,{usingOperation:true,affectsData:true,range:new ha(i,s)});e&&(l=e.toRange(),e.detach());}l&&(s instanceof Oa?n.setSelection(l):s.setTo(l));const c=o.getAffectedRange()||e.createRange(s.anchor);return o.destroy(),c})}class uu{model;writer;position;canMergeWith;schema;_documentFragment;_documentFragmentPosition;_firstNode=null;_lastNode=null;_lastAutoParagraph=null;_filterAttributesAndChildrenOf=[];_affectedStart=null;_affectedEnd=null;_nodeToSelect=null;constructor(e,t,i){this.model=e,this.writer=t,this.position=i,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))t.offsetSize>0&&this._handleNode(t);this._insertPartialFragment(),this._lastAutoParagraph&&this._updateLastNodeFromAutoParagraph(this._lastAutoParagraph),this._mergeOnRight(),this.schema.removeDisallowedAttributes(this._filterAttributesAndChildrenOf,this.writer),false!==this.model._config?.get("experimentalFlags.modelInsertContentDeepSchemaVerification")&&this._removeDisallowedChildren(this._filterAttributesAndChildrenOf),this._filterAttributesAndChildrenOf=[];}_removeDisallowedChildren(e){const t=Array.from(e);for(const e of t){if(!e.is("element"))continue;const i=[],n=[],s=this.writer.createRangeIn(e).getWalker({ignoreElementEnd:true});for(const{item:e}of s){const o=e.parent;this.schema.checkChild(o,e)||(e.is("element")&&!this.schema.isObject(e)?(n.push(e),t.push(o)):i.push(e),s.jumpTo(this.writer.createPositionAfter(e)));}for(const e of n)this.writer.unwrap(e);for(const e of i)this.writer.remove(e);}}_updateLastNodeFromAutoParagraph(e){const t=this.writer.createPositionAfter(this._lastNode),i=this.writer.createPositionAfter(e);if(i.isAfter(t)){if(this._lastNode=e,this.position.parent!=e||!this.position.isAtEnd)throw new I("insertcontent-invalid-insertion-position",this);this.position=i,this._setAffectedBoundaries(this.position);}}getSelectionRange(){return this._nodeToSelect?ha._createOn(this._nodeToSelect):this.model.schema.getNearestSelectionRange(this.position)}getAffectedRange(){return this._affectedStart?new ha(this._affectedStart,this._affectedEnd):null}destroy(){this._affectedStart&&this._affectedStart.detach(),this._affectedEnd&&this._affectedEnd.detach();}_handleNode(e){this._checkAndSplitToAllowedPosition(e)?(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=Ec.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 I("insertcontent-wrong-position",this,{node:e,position:this.position});return this.writer.insert(e,this._documentFragmentPosition),this._documentFragmentPosition=this._documentFragmentPosition.getShiftedBy(e.offsetSize),e.parent||(e=this._documentFragmentPosition.nodeBefore),this.schema.isObject(e)&&!this.schema.checkChild(this.position,"$text")?this._nodeToSelect=e:this._nodeToSelect=null,this._filterAttributesAndChildrenOf.push(e),e}_setAffectedBoundaries(e){this._affectedStart||(this._affectedStart=Ec.fromPosition(e,"toPrevious")),this._affectedEnd&&!this._affectedEnd.isBefore(e)||(this._affectedEnd&&this._affectedEnd.detach(),this._affectedEnd=Ec.fromPosition(e,"toNext"));}_mergeOnLeft(){const e=this._firstNode;if(!(e instanceof Fa))return;if(!this._canMergeLeft(e))return;const t=Ec._createBefore(e);t.stickiness="toNext";const i=Ec.fromPosition(this.position,"toNext");this._affectedStart.isEqual(t)&&(this._affectedStart.detach(),this._affectedStart=Ec._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=Ec._createAt(t.nodeBefore,"end","toNext")),this.position=i.toPosition(),i.detach(),this._filterAttributesAndChildrenOf.push(this.position.parent),t.detach();}_mergeOnRight(){const e=this._lastNode;if(!(e instanceof Fa))return;if(!this._canMergeRight(e))return;const t=Ec._createAfter(e);if(t.stickiness="toNext",!this.position.isEqual(t))throw new I("insertcontent-invalid-insertion-position",this);this.position=ra._createAt(t.nodeBefore,"end");const i=Ec.fromPosition(this.position,"toPrevious");this._affectedEnd.isEqual(t)&&(this._affectedEnd.detach(),this._affectedEnd=Ec._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=Ec._createAt(t.nodeBefore,0,"toPrevious")),this.position=i.toPosition(),i.detach(),this._filterAttributesAndChildrenOf.push(this.position.parent),t.detach();}_canMergeLeft(e){const t=e.previousSibling;return t instanceof Fa&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(t,e)}_canMergeRight(e){const t=e.nextSibling;return t instanceof Fa&&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  false;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);}else 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(),true}_getAllowedIn(e,t){const i=this.schema.createContext(e);return this.schema.checkChild(i,t)||this.schema.checkChild(i,"paragraph")&&this.schema.checkChild(i.push("paragraph"),t)?e:this.schema.isLimit(e)?null:this._getAllowedIn(e.parent,t)}}function du(e,t,i,n={}){if(!e.schema.isObject(t))throw new I("insertobject-element-not-an-object",e,{object:t});const s=i||e.document.selection;let o=s;n.findOptimalPosition&&e.schema.isBlock(t)&&(o=e.createSelection(e.schema.findOptimalInsertionRange(s,n.findOptimalPosition)));const r=Cn(s.getSelectedBlocks()),a={};return r&&Object.assign(a,e.schema.getAttributesWithProperty(r,"copyOnReplace",true)),e.change(i=>{o.isCollapsed||e.deleteContent(o,{doNotAutoparagraph:true});let s=t;const r=o.anchor.parent,l=e.schema.createContext(r);!e.schema.checkChild(l,t)&&e.schema.checkChild(l,"paragraph")&&e.schema.checkChild(l.push("paragraph"),t)&&(s=i.createElement("paragraph"),i.insert(t,s)),e.schema.setAllowedAttributes(s,a,i);const c=e.insertContent(s,o);return c.isCollapsed||n.setSelection&&function(e,t,i,n){const s=e.model;if("on"==i)return void e.setSelection(t,"on");if("after"!=i)throw new I("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,n,e),s.insertContent(o,e.createPositionAfter(t)));o&&e.setSelection(o,0);}(i,t,n.setSelection,a),c})}function hu(e,t,i={}){const n=e.schema,s="backward"!=i.direction,o=i.unit?i.unit:"character",r=!!i.treatEmojiAsSingleUnit,a=t.focus,l=new sa({boundaries:gu(a,s),singleCharacters:true,direction:s?"forward":"backward"}),c={walker:l,schema:n,isForward:s,unit:o,treatEmojiAsSingleUnit:r};let u;for(;u=l.next();){if(u.done)return;const i=mu(c,u.value);if(i)return void(t instanceof Oa?e.change(e=>{e.setSelectionFocus(i);}):t.setFocus(i))}}function mu(e,t){const{isForward:i,walker:n,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 i=e.position.textNode;i||(i=t?e.position.nodeAfter:e.position.nodeBefore);for(;i&&i.is("$text");){const n=e.position.offset-i.startOffset;if(pu(i,n,t))i=t?e.position.nodeAfter:e.position.nodeBefore;else {if(fu(i.data,n,t))break;e.next();}}return e.position}(n,i):function(e,t,i){const n=e.position.textNode;if(n){const s=n.data;let o=e.position.offset-n.startOffset;for(;Wn(s,o)||"character"==t&&Gn(s,o)||i&&Jn(s,o);)e.next(),o=e.position.offset-n.startOffset;}return e.position}(n,s,r);if(a==(i?"elementStart":"elementEnd")){if(o.isSelectable(l))return ra._createAt(l,i?"after":"before");if(o.checkChild(c,"$text"))return c}else {if(o.isLimit(l))return void n.skip(()=>true);if(o.checkChild(c,"$text"))return c}}function gu(e,t){const i=e.root,n=ra._createAt(i,t?"end":0);return t?new ha(e,n):new ha(n,e)}function fu(e,t,i){const n=t+(i?0:-1);return ' ,.?!:;"-()'.includes(e.charAt(n))}function pu(e,t,i){return t===(i?e.offsetSize:0)}class bu extends($t()){markers;document;schema;_config;_pendingChanges;_currentWriter;constructor(e){super(),this.markers=new zc,this.document=new Nc(this),this.schema=new xl,this._config=e,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:true}),this.schema.register("$container",{allowIn:["$root","$container"]}),this.schema.register("$block",{allowIn:["$root","$container"],isBlock:true}),this.schema.register("$blockObject",{allowWhere:"$block",isBlock:true,isObject:true}),this.schema.register("$inlineObject",{allowWhere:"$text",allowAttributesOf:"$text",isInline:true,isObject:true}),this.schema.register("$text",{allowIn:"$block",isInline:true,isContent:true}),this.schema.register("$clipboardHolder",{allowContentOf:"$root",allowChildren:"$text",isLimit:true}),this.schema.register("$documentFragment",{allowContentOf:"$root",allowChildren:"$text",isLimit:true}),this.schema.register("$marker"),this.schema.addChildCheck(()=>true,"$marker"),Qc(this),this.document.registerPostFixer(ul),this.on("insertContent",(e,[t,i])=>{e.return=cu(this,t,i);}),this.on("insertObject",(e,[t,i,n])=>{e.return=du(this,t,i,n);}),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 Ic,callback:e}),this._runPendingChanges()[0]):e(this._currentWriter)}catch(e){I.rethrowUnexpectedError(e,this);}}enqueueChange(e,t){try{e?"function"==typeof e?(t=e,e=new Ic):e instanceof Ic||(e=new Ic(e)):e=new Ic,this._pendingChanges.push({batch:e,callback:t}),1==this._pendingChanges.length&&this._runPendingChanges();}catch(e){I.rethrowUnexpectedError(e,this);}}applyOperation(e){e._execute();}insertContent(e,t,i,...n){const s=wu(t,i);return this.fire("insertContent",[e,s,i,...n])}insertObject(e,t,i,n,...s){const o=wu(t,i);return this.fire("insertObject",[e,o,n,n,...s])}deleteContent(e,t){tu(this,e,t);}modifySelection(e,t){hu(this,e,t);}getSelectedContent(e){return au(this,e)}hasContent(e,t={}){let i;i=e.is("selection")?Array.from(e.getRanges()):e.is("range")?[e]:[ha._createIn(e)];for(const e of i)if(this._rangeHasContent(e,t))return  true;return  false}_rangeHasContent(e,t){if(e.isCollapsed)return  false;const{ignoreWhitespaces:i=false,ignoreMarkers:n=false}=t;if(!n)for(const t of this.markers.getMarkersIntersectingRange(e))if(t.affectsData)return  true;for(const t of e.getItems())if(this.schema.isContent(t)){if(!t.is("$textProxy"))return  true;if(!i)return  true;if(-1!==t.data.search(/\S/))return  true}return  false}canEditAt(e){const t=wu(e);return this.fire("canEditAt",[t])}createPositionFromPath(e,t,i){return new ra(e,t,i)}createPositionAt(e,t){return ra._createAt(e,t)}createPositionAfter(e){return ra._createAfter(e)}createPositionBefore(e){return ra._createBefore(e)}createRange(e,t){return new ha(e,t)}createRangeIn(e){return ha._createIn(e)}createRangeOn(e){return ha._createOn(e)}createSelection(...e){return new ya(...e)}createBatch(e){return new Ic(e)}createOperationFromJSON(e){return mc.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 jc(this,t);const i=this._pendingChanges[0].callback(this._currentWriter);e.push(i),this.document._handleChangeBlock(this._currentWriter),this._pendingChanges.shift(),this._currentWriter=null;}}finally{this._pendingChanges.length=0,this._currentWriter=null,this.fire("_afterChanges");}return e}}function wu(e,t){if(e)return e instanceof ya||e instanceof Oa?e:e instanceof _a?t||0===t?new ya(e,t):e.is("rootElement")?new ya(e,"in"):new ya(e,"on"):new ya(e)}class vu extends qr{domEventType="click";onDomEvent(e){this.fire(e.type,e);}}class _u extends qr{domEventType=["mousedown","mouseup","mouseover","mouseout"];onDomEvent(e){this.fire(e.type,e);}}class yu extends qr{domEventType=["touchstart","touchend","touchmove"];onDomEvent(e){this.fire(e.type,e);}}class ku extends qr{domEventType=["pointerdown","pointerup","pointermove"];onDomEvent(e){this.fire(e.type,e);}}class Cu{document;constructor(e){this.document=e;}createDocumentFragment(e){return new tr(this.document,e)}createElement(e,t,i){return new _o(this.document,e,t,i)}createText(e){return new so(this.document,e)}clone(e,t=false){return e._clone(t)}appendChild(e,t){return t._appendChild(e)}insertChild(e,t,i){return i._insertChild(e,t)}removeChildren(e,t,i){return i._removeChildren(e,t)}remove(e){const t=e.parent;return t?this.removeChildren(t.getChildIndex(e),1,t):[]}replace(e,t){const i=e.parent;if(i){const n=i.getChildIndex(e);return this.removeChildren(n,1,i),this.insertChild(n,t,i),true}return  false}unwrapElement(e){const t=e.parent;if(t){const i=t.getChildIndex(e);this.remove(e),this.insertChild(i,e.getChildren(),t);}}rename(e,t){const i=new _o(this.document,e,t.getAttributes(),t.getChildren());return this.replace(t,i)?i:null}setAttribute(e,t,i){i._setAttribute(e,t);}removeAttribute(e,t){t._removeAttribute(e);}addClass(e,t){t._addClass(e);}removeClass(e,t){t._removeClass(e);}setStyle(e,t,i){yt(e)&&void 0===i?t._setStyle(e):i._setStyle(e,t);}removeStyle(e,t){t._removeStyle(e);}setCustomProperty(e,t,i){i._setCustomProperty(e,t);}removeCustomProperty(e,t){return t._removeCustomProperty(e)}createPositionAt(e,t){return Io._createAt(e,t)}createPositionAfter(e){return Io._createAfter(e)}createPositionBefore(e){return Io._createBefore(e)}createRange(e,t){return new Po(e,t)}createRangeOn(e){return Po._createOn(e)}createRangeIn(e){return Po._createIn(e)}createSelection(...e){return new Ro(...e)}}const xu=/^#([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,Eu=/^rgba\([ ]?([0-9]{1,3}[ %]?,[ ]?){3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,Tu=/^hsl\([ ]?([0-9]{1,3}[ %]?[,]?[ ]*){3}(1|[0-9]+%|[0]?\.?[0-9]+)?\)$/i,Su=/^hsla\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,Iu=/\w+\((?:[^()]|\([^()]*\))*\)|\S+/gi,Pu=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 Vu(e){return e.startsWith("#")?xu.test(e):e.startsWith("rgb")?Au.test(e)||Eu.test(e):e.startsWith("hsl")?Tu.test(e)||Su.test(e):Pu.has(e.toLowerCase())}const Ru=["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset"];function Ou(e){return Ru.includes(e)}const Bu=/^([+-]?[0-9]*([.][0-9]+)?(px|cm|mm|in|pc|pt|ch|em|ex|rem|vh|vw|vmin|vmax)|0)$/;function Lu(e){return Bu.test(e)}const Mu=/^[+-]?[0-9]*([.][0-9]+)?%$/;function Fu(e){return Mu.test(e)}const Nu=["auto","cover","contain"];function Du(e){return Nu.includes(e)||Lu(e)||Fu(e)}const zu=["repeat-x","repeat-y","repeat","space","round","no-repeat"];function Hu(e){return zu.includes(e)}const qu=["center","top","bottom","left","right"];function Uu(e){return qu.includes(e)}const ju=["fixed","scroll","local"];function $u(e){return ju.includes(e)}const Wu=["border-box","padding-box","content-box"];function Gu(e){return Wu.includes(e)}const Ku=["border-box","padding-box","content-box","text"];function Ju(e){return Ku.includes(e)}const Qu=/^url\(/;function Yu(e){return Qu.test(e)}function Zu(e=""){if(""===e)return {top:void 0,right:void 0,bottom:void 0,left:void 0};const t=id(e),i=t[0],n=t[2]||i,s=t[1]||i;return {top:i,bottom:n,right:s,left:t[3]||s}}function Xu(e){return t=>{const{top:i,right:n,bottom:s,left:o}=t,r=[];return [i,n,o,s].every(e=>!!e)?r.push([e,ed(t)]):(i&&r.push([e+"-top",i]),n&&r.push([e+"-right",n]),s&&r.push([e+"-bottom",s]),o&&r.push([e+"-left",o])),r}}function ed({top:e,right:t,bottom:i,left:n}){const s=[];return n!==t?s.push(e,t,i,n):i!==e?s.push(e,t,i):t!==e?s.push(e,t):s.push(e),s.join(" ")}function td(e){return t=>({path:e,value:Zu(t)})}function id(e){const t=e.trim().slice(0,1500).matchAll(Iu);return Array.from(t).map(e=>e[0])}const nd={image:"none",repeat:"repeat",position:"0% 0%",size:"auto",origin:"padding-box",clip:"border-box",attachment:"scroll"},sd=["linear-gradient","repeating-linear-gradient","radial-gradient","repeating-radial-gradient","conic-gradient","repeating-conic-gradient","url"];function od(e){e.setNormalizer("background-color",e=>({path:"background.color",value:e}));for(const t in nd)e.setNormalizer(`background-${t}`,rd(`background.${t}`)),e.setReducer(`background-${t}`,ad(`background-${t}`));e.setNormalizer("background",e=>{const t=function(e){return ud(e).map(ld).filter(e=>null!==e)}(e);t.length||t.push({...cd(),color:e});const i=function(e){const t={image:[],position:[],size:[],repeat:[],attachment:[],origin:[],clip:[]};for(const i of e)t.position.push(i.position.join(" ")),t.size.push(i.size.join(" ")),t.repeat.push(i.repeat.join(" ")),t.image.push(i.image),t.attachment.push(i.attachment),t.origin.push(i.origin),t.clip.push(i.clip);return e.at(-1)?.color&&(t.color=e.at(-1).color),t}(t);return {path:"background",value:i}}),e.setReducer("background",e=>{const t=e,i=Object.keys(nd).every(e=>{const i=t[e];return void 0!==i&&(!Array.isArray(i)||i.length>0)});return i?function(e){const t=[],i=function(e){const t=function(e){let t=0;for(const i of Object.values(e))Array.isArray(i)&&i.length>t&&(t=i.length);return t}(e),i=Array.from({length:t},(t,i)=>{const n=cd();return e.image?.[i]&&(n.image=e.image[i]),e.position?.[i]&&(n.position=e.position[i].split(" ")),e.size?.[i]&&(n.size=e.size[i].split(" ")),e.repeat?.[i]&&(n.repeat=e.repeat[i].split(" ")),e.attachment?.[i]&&(n.attachment=e.attachment[i]),e.origin?.[i]&&(n.origin=e.origin[i]),e.clip?.[i]&&(n.clip=e.clip[i]),n});return e.color&&(i.at(-1).color=e.color),i}(e).map(e=>function(e){const t=[];e.image&&e.image!==nd.image&&t.push(e.image);const i=e.position.join(" "),n=!i||i===nd.position;n||t.push(i);const s=e.size.join(" ");s&&s!==nd.size&&(n&&t.push("0% 0%"),t.push("/",s));const o=e.repeat.join(" ");o&&o!==nd.repeat&&t.push(o),e.attachment&&e.attachment!==nd.attachment&&t.push(e.attachment);const r=e.origin===nd.origin,a=e.clip===nd.clip;return r&&a||(t.push(e.origin),e.clip!==e.origin&&t.push(e.clip)),e.color&&t.push(e.color),t.join(" ")}(e).trim()).filter(Boolean).join(", ");return i&&t.push(["background",i]),t}(t):function(e){const t=[];for(const i in nd){const n=e[i];Array.isArray(n)&&t.push([`background-${i}`,n.join(", ")]);}return void 0!==e.color&&t.push(["background-color",e.color]),t}(t)}),e.setStyleRelation("background",["background-color","background-image","background-repeat","background-position","background-size","background-attachment","background-origin","background-clip"]);}function rd(e){return t=>({path:e,value:ud(t)})}function ad(e){return t=>{const i=t.join(", ");return [[e,i]]}}function ld(e){const t={},{value:i,image:n}=function(e){for(const t of sd){const i=t+"(",n=e.indexOf(i);if(n<0)continue;let s=t,o=0;for(let i=n+t.length;i<e.length;i++){const t=e[i];if("("===t?o++:")"===t&&o--,s+=t,0===o)return {value:e.slice(0,n)+e.slice(i+1),image:s}}}if(e.includes("none"))return {value:e.replace("none",""),image:"none"};return {value:e,image:null}}(e),s=id(i);n&&(t.image=n);for(let e=0;e<s.length;e++){const i=s[e];if("/"===i)for(t.size=[];e+1<s.length&&Du(s[e+1]);)t.size.push(s[++e]);else Hu(i)?(t.repeat||=[],t.repeat.push(i)):Uu(i)||Fu(i)?(t.position||=[],t.position.push(i),e+1<s.length&&Fu(i)&&Fu(s[e+1])&&t.position.push(s[++e])):$u(i)?t.attachment=i:Ju(i)?Gu(i)&&!t.origin?(t.origin=i,t.clip=i):t.clip=i:Vu(i)&&(t.color=i);}return function(e){if(null==e)return  true;if(J(e))return !!("function"==typeof e.splice||"string"==typeof e||"undefined"!=typeof Buffer&&Buffer.isBuffer(e)||mt(e)||qe(e))&&0===e.length;if("object"==typeof e){if(e instanceof Map||e instanceof Set)return 0===e.size;const t=Object.keys(e);return ht(e)?0===t.filter(e=>"constructor"!==e).length:0===t.length}return  true}(t)?null:{...cd(),...t}}function cd(){return {attachment:nd.attachment,image:nd.image,origin:nd.origin,clip:nd.clip,position:nd.position.split(" "),repeat:nd.repeat.split(" "),size:nd.size.split(" ")}}function ud(e){const t=[];let i="",n=0;for(const s of e){if("("===s)n++;else if(")"===s)n--;else if(","===s&&0===n){t.push(i.trim()),i="";continue}i+=s;}return i.trim()&&t.push(i.trim()),t}function dd(e){e.setNormalizer("border",e=>{const{color:t,style:i,width:n}=wd(e);return {path:"border",value:{color:Zu(t),style:Zu(i),width:Zu(n)}}}),e.setNormalizer("border-top",hd("top")),e.setNormalizer("border-right",hd("right")),e.setNormalizer("border-bottom",hd("bottom")),e.setNormalizer("border-left",hd("left")),e.setNormalizer("border-color",md("color")),e.setNormalizer("border-width",md("width")),e.setNormalizer("border-style",md("style")),e.setNormalizer("border-top-color",fd("color","top")),e.setNormalizer("border-top-style",fd("style","top")),e.setNormalizer("border-top-width",fd("width","top")),e.setNormalizer("border-right-color",fd("color","right")),e.setNormalizer("border-right-style",fd("style","right")),e.setNormalizer("border-right-width",fd("width","right")),e.setNormalizer("border-bottom-color",fd("color","bottom")),e.setNormalizer("border-bottom-style",fd("style","bottom")),e.setNormalizer("border-bottom-width",fd("width","bottom")),e.setNormalizer("border-left-color",fd("color","left")),e.setNormalizer("border-left-style",fd("style","left")),e.setNormalizer("border-left-width",fd("width","left")),e.setExtractor("border-top",pd("top")),e.setExtractor("border-right",pd("right")),e.setExtractor("border-bottom",pd("bottom")),e.setExtractor("border-left",pd("left")),e.setExtractor("border-top-color","border.color.top"),e.setExtractor("border-right-color","border.color.right"),e.setExtractor("border-bottom-color","border.color.bottom"),e.setExtractor("border-left-color","border.color.left"),e.setExtractor("border-top-width","border.width.top"),e.setExtractor("border-right-width","border.width.right"),e.setExtractor("border-bottom-width","border.width.bottom"),e.setExtractor("border-left-width","border.width.left"),e.setExtractor("border-top-style","border.style.top"),e.setExtractor("border-right-style","border.style.right"),e.setExtractor("border-bottom-style","border.style.bottom"),e.setExtractor("border-left-style","border.style.left"),e.setReducer("border-color",Xu("border-color")),e.setReducer("border-style",Xu("border-style")),e.setReducer("border-width",Xu("border-width")),e.setReducer("border-top",vd("top")),e.setReducer("border-right",vd("right")),e.setReducer("border-bottom",vd("bottom")),e.setReducer("border-left",vd("left")),e.setReducer("border",function(){return t=>{const i=bd(t,"top"),n=bd(t,"right"),s=bd(t,"bottom"),o=bd(t,"left"),r=[i,n,s,o],a={width:e(r,"width"),style:e(r,"style"),color:e(r,"color")},l=_d(a,"all");if(l.length)return l;const c=Object.entries(a).reduce((e,[t,i])=>(i&&(e.push([`border-${t}`,i]),r.forEach(e=>delete e[t])),e),[]);return [...c,..._d(i,"top"),..._d(n,"right"),..._d(s,"bottom"),..._d(o,"left")]};function e(e,t){return e.map(e=>e[t]).reduce((e,t)=>e==t?e:null)}}()),e.setStyleRelation("border",["border-color","border-style","border-width","border-top","border-right","border-bottom","border-left","border-top-color","border-right-color","border-bottom-color","border-left-color","border-top-style","border-right-style","border-bottom-style","border-left-style","border-top-width","border-right-width","border-bottom-width","border-left-width"]),e.setStyleRelation("border-color",["border-top-color","border-right-color","border-bottom-color","border-left-color"]),e.setStyleRelation("border-style",["border-top-style","border-right-style","border-bottom-style","border-left-style"]),e.setStyleRelation("border-width",["border-top-width","border-right-width","border-bottom-width","border-left-width"]),e.setStyleRelation("border-top",["border-top-color","border-top-style","border-top-width"]),e.setStyleRelation("border-right",["border-right-color","border-right-style","border-right-width"]),e.setStyleRelation("border-bottom",["border-bottom-color","border-bottom-style","border-bottom-width"]),e.setStyleRelation("border-left",["border-left-color","border-left-style","border-left-width"]);}function hd(e){return t=>{const{color:i,style:n,width:s}=wd(t),o={};return void 0!==i&&(o.color={[e]:i}),void 0!==n&&(o.style={[e]:n}),void 0!==s&&(o.width={[e]:s}),{path:"border",value:o}}}function md(e){return t=>({path:"border",value:gd(t,e)})}function gd(e,t){return {[t]:Zu(e)}}function fd(e,t){return i=>({path:"border",value:{[e]:{[t]:i}}})}function pd(e){return (t,i)=>{if(i.border)return bd(i.border,e)}}function bd(e,t){const i={};return e.width&&e.width[t]&&(i.width=e.width[t]),e.style&&e.style[t]&&(i.style=e.style[t]),e.color&&e.color[t]&&(i.color=e.color[t]),i}function wd(e){const t={},i=id(e);for(const e of i)Lu(e)||/thin|medium|thick/.test(e)?t.width=e:Ou(e)?t.style=e:t.color=e;return t}function vd(e){return t=>_d(t,e)}function _d(e,t){const i=[];if(e&&e.width&&i.push("width"),e&&e.style&&i.push("style"),e&&e.color&&i.push("color"),3==i.length){const n=i.map(t=>e[t]).join(" ");return ["all"==t?["border",n]:[`border-${t}`,n]]}return "all"==t?[]:i.map(i=>[`border-${t}-${i}`,e[i]])}function yd(e){e.setNormalizer("margin",td("margin")),e.setNormalizer("margin-top",e=>({path:"margin.top",value:e})),e.setNormalizer("margin-right",e=>({path:"margin.right",value:e})),e.setNormalizer("margin-bottom",e=>({path:"margin.bottom",value:e})),e.setNormalizer("margin-left",e=>({path:"margin.left",value:e})),e.setReducer("margin",Xu("margin")),e.setStyleRelation("margin",["margin-top","margin-right","margin-bottom","margin-left"]);}function kd(e){e.setNormalizer("padding",td("padding")),e.setNormalizer("padding-top",e=>({path:"padding.top",value:e})),e.setNormalizer("padding-right",e=>({path:"padding.right",value:e})),e.setNormalizer("padding-bottom",e=>({path:"padding.bottom",value:e})),e.setNormalizer("padding-left",e=>({path:"padding.left",value:e})),e.setReducer("padding",Xu("padding")),e.setStyleRelation("padding",["padding-top","padding-right","padding-bottom","padding-left"]);}const Cd="[",xd="]",Ad="{",Ed="}",Td={container:Co,attribute:$o,empty:Ko,ui:Qo,raw:Xo},Sd={setContentOf:(e,t)=>{e.innerHTML=t;}};function Id(e,t={}){if(!(e instanceof ta))throw new TypeError("View needs to be an instance of module:engine/view/view~EditingView.");const i=e.document,n=!!t.withoutSelection,s=t.rootName||"main",o=i.getRoot(s),r={showType:t.showType,showPriority:t.showPriority,renderUIElements:t.renderUIElements,renderRawElements:t.renderRawElements,ignoreRoot:true,domConverter:t.domConverter,skipListItemIds:t.skipListItemIds};return n?Id._stringify(o,null,r):Id._stringify(o,i.selection,r)}function Pd(e,t,i={}){if(!(e instanceof ta))throw new TypeError("View needs to be an instance of module:engine/view/view~EditingView.");const n=e.document,s=i.rootName||"main",o=n.getRoot(s);e.change(e=>{const i=Pd._parse(t,{rootElement:o});i.view&&i.selection&&e.setSelection(i.selection);});}function Vd(e,t=null,i={}){let n;n=t instanceof Io||t instanceof Po?new Oo(t):t;return new Bd(e,n,i).stringify()}function Rd(e,t={}){const i=new jo(new fo);t.order=t.order||[];const n=new Od({sameSelectionCharacters:t.sameSelectionCharacters}),s=new Wl(i,{namespaces:Object.keys(Td)});t.inlineObjectElements&&s.domConverter.inlineObjectElements.push(...t.inlineObjectElements);let o=s.toView(e);if(o=Ld(o),t.rootElement){const e=t.rootElement,i=o._removeChildren(0,o.childCount);e._removeChildren(0,e.childCount),e._appendChild(i),o=e;}const r=n._parseView(o,t.order);if(o.is("documentFragment")&&1===o.childCount&&(o=o.getChild(0)),r.length){return {view:o,selection:new Oo(r,{backward:!!t.lastRangeBackward})}}return o.parent&&o._remove(),o}Id._stringify=Vd,Pd._parse=Rd;class Od{sameSelectionCharacters;_positions;constructor(e){this.sameSelectionCharacters=!!e.sameSelectionCharacters;}_parseView(e,t){this._positions=[],this._getPositions(e);let i=this._createRanges();if(t.length){if(t.length!=i.length)throw new Error(`Parse error - there are ${i.length} ranges found, but ranges order array contains ${t.length} elements.`);i=this._sortRanges(i,t);}return i}_getPositions(e){if(e.is("documentFragment")||e.is("element")){const t=[...e.getChildren()];for(const e of t)this._getPositions(e);}if(e.is("$text")){const t=new RegExp(`[${Ad}${Ed}\\${xd}\\${Cd}]`,"g");let i,n=e.data,s=0;const o=[];for(;i=t.exec(n);){const e=i.index,t=i[0];o.push({bracket:t,textOffset:e-s}),s++;}n=n.replace(t,""),e._data=n;const r=e.index,a=e.parent;n||e._remove();for(const t of o)if(n)if(this.sameSelectionCharacters||!this.sameSelectionCharacters&&(t.bracket==Ad||t.bracket==Ed))this._positions.push({bracket:t.bracket,position:new Io(e,t.textOffset)});else {if(!this.sameSelectionCharacters&&0!==t.textOffset&&t.textOffset!==n.length)throw new Error(`Parse error - range delimiter '${t.bracket}' is placed inside text node.`);const e=0===t.textOffset?r:r+1;this._positions.push({bracket:t.bracket,position:new Io(a,e)});}else {if(!this.sameSelectionCharacters&&t.bracket==Ad||t.bracket==Ed)throw new Error(`Parse error - text range delimiter '${t.bracket}' is placed inside empty text node. `);this._positions.push({bracket:t.bracket,position:new Io(a,r)});}}}_sortRanges(e,t){const i=[];let n=0;for(const s of t){if(void 0===e[s-1])throw new Error("Parse error - provided ranges order is invalid.");i[s-1]=e[n],n++;}return i}_createRanges(){const e=[];let t=null;for(const i of this._positions){if(!t&&(i.bracket==xd||i.bracket==Ed))throw new Error(`Parse error - end of range was found '${i.bracket}' but range was not started before.`);if(t&&(i.bracket==Cd||i.bracket==Ad))throw new Error(`Parse error - start of range was found '${i.bracket}' but one range is already started.`);i.bracket==Cd||i.bracket==Ad?t=new Po(i.position,i.position):(t.end=i.position,e.push(t),t=null);}if(null!==t)throw new Error("Parse error - range was started but no end delimiter was found.");return e}}class Bd{root;selection;ranges;showType;showPriority;showAttributeElementId;ignoreRoot;sameSelectionCharacters;renderUIElements;renderRawElements;domConverter;skipListItemIds;constructor(e,t,i){this.root=e,this.selection=t,this.ranges=[],t&&(this.ranges=[...t.getRanges()]),this.showType=!!i.showType,this.showPriority=!!i.showPriority,this.showAttributeElementId=!!i.showAttributeElementId,this.ignoreRoot=!!i.ignoreRoot,this.sameSelectionCharacters=!!i.sameSelectionCharacters,this.renderUIElements=!!i.renderUIElements,this.renderRawElements=!!i.renderRawElements,this.domConverter=i.domConverter||Sd,this.skipListItemIds=void 0===i.skipListItemIds||!!i.skipListItemIds;}stringify(){let e="";return this._walkView(this.root,t=>{e+=t;}),this.skipListItemIds&&(e=e.replaceAll(/ data-list-item-id="[^"]+"/g,"")),e}_walkView(e,t){const i=this.ignoreRoot&&this.root===e;if(e.is("element")||e.is("documentFragment")){if(e.is("element")&&!i&&t(this._stringifyElementOpen(e)),this.renderUIElements&&e.is("uiElement"))t(e.render(document,this.domConverter).innerHTML);else if(this.renderRawElements&&e.is("rawElement")){const i=document.createElement("div");e.render(i,this.domConverter),t(i.innerHTML);}else {let i=0;t(this._stringifyElementRanges(e,i));for(const n of e.getChildren())this._walkView(n,t),i++,t(this._stringifyElementRanges(e,i));}e.is("element")&&!i&&t(this._stringifyElementClose(e));}e.is("$text")&&t(this._stringifyTextRanges(e));}_stringifyElementRanges(e,t){let i="",n="",s="";for(const o of this.ranges)o.start.parent==e&&o.start.offset===t&&(o.isCollapsed?s+=Cd+xd:i+=Cd),o.end.parent!==e||o.end.offset!==t||o.isCollapsed||(n+=xd);return n+s+i}_stringifyTextRanges(e){const t=e.data.length,i=e.data.split("");let n,s;this.sameSelectionCharacters?(n=Cd,s=xd):(n=Ad,s=Ed),i[t]="";const o=i.map(e=>({letter:e,start:"",end:"",collapsed:""}));for(const i of this.ranges){const r=i.start,a=i.end;r.parent==e&&r.offset>=0&&r.offset<=t&&(i.isCollapsed?o[a.offset].collapsed+=n+s:o[r.offset].start+=n),a.parent==e&&a.offset>=0&&a.offset<=t&&!i.isCollapsed&&(o[a.offset].end+=s);}return o.map(e=>e.end+e.collapsed+e.start+e.letter).join("")}_stringifyElementOpen(e){const t=this._stringifyElementPriority(e),i=this._stringifyElementId(e);return `<${[[this._stringifyElementType(e),e.name].filter(e=>""!==e).join(":"),t,i,this._stringifyElementAttributes(e)].filter(e=>""!==e).join(" ")}>`}_stringifyElementClose(e){return `</${[this._stringifyElementType(e),e.name].filter(e=>""!==e).join(":")}>`}_stringifyElementType(e){if(this.showType)for(const t in Td)if(e instanceof Td[t])return t;return ""}_stringifyElementPriority(e){return this.showPriority&&e.is("attributeElement")?`view-priority="${e.priority}"`:""}_stringifyElementId(e){return this.showAttributeElementId&&e.is("attributeElement")&&e.id?`view-id="${e.id}"`:""}_stringifyElementAttributes(e){const t=[],i=[...e.getAttributeKeys()].sort();for(const n of i){let i;i="class"===n?[...e.getClassNames()].sort().join(" "):"style"===n?[...e.getStyleNames()].sort().map(t=>`${t}:${e.getStyle(t).replace(/"/g,"&quot;")}`).join(";"):e.getAttribute(n),t.push(`${n}="${i}"`);}return t.join(" ")}}function Ld(e){if(e.is("element")||e.is("documentFragment")){const t=e.is("documentFragment")?new tr(e.document):function(e,t){const i=function(e){const t=e.name.split(":"),i=function(e){const t=parseInt(e,10);if(!isNaN(t))return t;return null}(e.getAttribute("view-priority")),n=e.hasAttribute("view-id")?e.getAttribute("view-id"):null;if(e._removeAttribute("view-priority"),e._removeAttribute("view-id"),1==t.length)return {name:t[0],type:null!==i?"attribute":null,priority:i,id:n};const s=function(e){return e in Td?e:null}(t[0]);if(s)return {name:t[1],type:s,priority:i,id:n};throw new Error(`Parse error - cannot parse element's name: ${e.name}.`)}(t),n=Td[i.type],s=n?new n(e,i.name):new _o(e,i.name);s.is("attributeElement")&&(null!==i.priority&&(s._priority=i.priority),null!==i.id&&(s._id=i.id));for(const e of t.getAttributeKeys())s._setAttribute(e,t.getAttribute(e));return s}(e.document,e);for(const i of [...e.getChildren()]){if(t.is("emptyElement"))throw new Error("Parse error - cannot parse inside ViewEmptyElement.");if(t.is("uiElement"))throw new Error("Parse error - cannot parse inside UIElement.");if(t.is("rawElement"))throw new Error("Parse error - cannot parse inside RawElement.");t._appendChild(Ld(i));}return t}return e}function Md(e,t={}){if(!(e instanceof bu))throw new TypeError("Model needs to be an instance of module:engine/model/model~Model.");const i=t.rootName||"main",n=e.document.getRoot(i);return Md._stringify(n,t.withoutSelection?null:e.document.selection,t.convertMarkers?e.markers:null)}function Fd(e,t,i={}){if(!(e instanceof bu))throw new TypeError("Model needs to be an instance of module:engine/model/model~Model.");let n,s=null;const o=e.document.getRoot(i.rootName||"main"),r=Fd._parse(t,e.schema,{lastRangeBackward:i.lastRangeBackward,selectionAttributes:i.selectionAttributes,context:[o.name],inlineObjectElements:i.inlineObjectElements});function a(t){if(t.remove(t.createRangeIn(o)),t.insert(n,o),t.setSelection(null),t.removeSelectionAttribute(e.document.selection.getAttributeKeys()),s){const e=[];for(const t of s.getRanges()){const i=new ra(o,t.start.path),n=new ra(o,t.end.path);e.push(new ha(i,n));}t.setSelection(e,{backward:s.isBackward}),i.selectionAttributes&&t.setSelectionAttribute(s.getAttributes());}}"model"in r?(n=r.model,s=r.selection):n=r,void 0!==i.batchType?e.enqueueChange(i.batchType,a):e.change(a);}function Nd(e,t=null,i=null){const n=new bu,s=new ma;let o,r=null;if(e instanceof Mc||e instanceof Uc)o=n.createRangeIn(e);else if(e.parent)o=new ha(n.createPositionBefore(e),n.createPositionAfter(e));else {const t=new Uc(e);o=n.createRangeIn(t);}t instanceof ya||t instanceof Oa?r=t:(t instanceof ha||t instanceof ra)&&(r=new ya(t));const a=new fo,l=new ta(a),c=l.document,u=new To(c,"div");u.rootName="main",c.roots.add(u);const d=new ba({mapper:s,schema:n.schema});s.bindElements(e.root,u),d.on("insert:$text",(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const n=i.writer,s=i.mapper.toViewPosition(t.range.start),o=n.createText(t.item.data);n.insert(s,o);}),d.on("insert",(e,t,i)=>{i.convertAttributes(t.item),t.reconversion||!t.item.is("element")||t.item.isEmpty||i.convertChildren(t.item);},{priority:"lowest"}),d.on("attribute",(e,t,i)=>{if(t.item instanceof ya||t.item instanceof Oa||t.item.is("$textProxy")){const n=Ga((e,{writer:i})=>i.createAttributeElement("model-text-with-attributes",{[t.attributeKey]:qd(e)}));n(e,t,i);}}),d.on("insert",Ka(e=>{const t=Ud(e.getAttributes(),qd);return new Co(c,e.name,t)})),d.on("selection",(e,t,i)=>{const n=t.selection;if(n.isCollapsed)return;if(!i.consumable.consume(n,"selection"))return;const s=[];for(const e of n.getRanges())s.push(i.mapper.toViewRange(e));i.writer.setSelection(s,{backward:n.isBackward});}),d.on("selection",(e,t,i)=>{const n=t.selection;if(!n.isCollapsed)return;if(!i.consumable.consume(n,"selection"))return;const s=i.writer,o=n.getFirstPosition(),r=i.mapper.toViewPosition(o),a=s.breakAttributes(r);s.setSelection(a);}),d.on("addMarker",Qa((e,{writer:t})=>{const i=e.markerName+":"+(e.isOpening?"start":"end");return t.createUIElement(i)}));const h=new Map;if(i)for(const e of Array.from(i).sort((e,t)=>e.name<t.name?1:-1))h.set(e.name,e.getRange());const m=l._writer;d.convert(o,h,m),r&&d.convertSelection(r,i||n.markers,m);let g=Vd(u,c.selection,{sameSelectionCharacters:true});return g=g.substr(5,g.length-11),l.destroy(),g.replace(new RegExp("model-text-with-attributes","g"),"$text")}function Dd(e,t,i={}){const n=new ma,s=Rd(e=e.replace(new RegExp("\\$text","g"),"model-text-with-attributes"),{sameSelectionCharacters:true,lastRangeBackward:!!i.lastRangeBackward,inlineObjectElements:i.inlineObjectElements});let o,r=null,a=null;"view"in s&&"selection"in s?(o=s.view,r=s.selection):o=s;const l=new bu,c=new Dl({schema:t});c.on("documentFragment",function(e){return (t,i,n)=>{const s=n.convertChildren(i.viewItem,i.modelCursor);e.bindElements(i.modelCursor.parent,i.viewItem),i=Object.assign(i,s),t.stop();}}(n)),c.on("element:model-text-with-attributes",zd()),c.on("element",function(e){return (t,i,n)=>{const s=i.viewItem.name;if(!n.schema.checkChild(i.modelCursor,s))throw new Error(`Element '${s}' was not allowed in given position.`);const o=Ud(i.viewItem.getAttributes(),Hd),r=n.writer.createElement(i.viewItem.name,o);n.writer.insert(r,i.modelCursor),e.bindElements(r,i.viewItem),n.convertChildren(i.viewItem,r),i.modelRange=ha._createOn(r),i.modelCursor=i.modelRange.end,t.stop();}}(n)),c.on("text",zd());let u=l.change(e=>c.convert(o.root,e,i.context||"$root"));if(n.bindElements(u,o.root),1==u.childCount&&(u=u.getChild(0)),r){const e=[];for(const t of r.getRanges())e.push(n.toModelRange(t));a=new ya(e,{backward:r.isBackward});for(const[e,t]of Vn(i.selectionAttributes||[]))a.setAttribute(e,t);}return a?{model:u,selection:a}:u}function zd(){return (e,t,i)=>{if(!i.schema.checkChild(t.modelCursor,"$text"))throw new Error("Text was not allowed in given position.");let n;if(t.viewItem.is("element")){const e=Ud(t.viewItem.getAttributes(),Hd),s=t.viewItem.getChild(0);n=i.writer.createText(s.data,e);}else n=i.writer.createText(t.viewItem.data);i.writer.insert(n,t.modelCursor),t.modelRange=ha._createFromPositionAndShift(t.modelCursor,n.offsetSize),t.modelCursor=t.modelRange.end,e.stop();}}function Hd(e){try{return JSON.parse(e)}catch{return e}}function qd(e){return yt(e)?JSON.stringify(e):e}function*Ud(e,t){for(const[i,n]of e)yield [i,t(n)];}function jd(e){let t="";for(const i of e)t+=` ${i[0]}=${JSON.stringify(i[1])}`;return t}function $d(e){const t={};for(const i of e)t[i[0]]=i[1];return JSON.stringify(t)}Md._stringify=Nd,Fd._parse=Dd;const Wd=Symbol("_treeDump");function Gd(e,t){console.log(e,t);let i="";for(const t of e.roots)i+=t.printTree()+"\n";e[Wd][t]=i.substr(0,i.length-1);const n=e[Wd].length-20;n>0&&(e[Wd][n-1]=null);}function Kd(e){e[Wd]=[];}function Jd(e,t){console.log("--------------------"),e[Wd][t]?console.log(e[Wd][t]):console.log("Tree log unavailable for given version: "+t);}class Qd{_model;_logSeparator;_operationsToReplay;constructor(e,t,i){this._model=e,this._logSeparator=t,this.setStringifiedOperations(i);}setStringifiedOperations(e){this._operationsToReplay=""!==e?e.split(this._logSeparator).map(e=>JSON.parse(e)):[];}getOperationsToReplay(){return this._operationsToReplay}play(e=1e3){const t=this;return new Promise((i,n)=>{!function s(){t.applyNextOperation().then(t=>{if(t)return i();setTimeout(s,e);}).catch(e=>{n(e);});}();})}applyOperations(e){if(!(e<=0))return this.applyNextOperation().then(t=>{if(!t)return this.applyOperations(e-1)})}applyAllOperations(){return this.applyNextOperation().then(e=>{if(!e)return this.applyAllOperations()})}applyNextOperation(){const e=this._model;return new Promise(t=>{e.enqueueChange(i=>{const n=this._operationsToReplay.shift();if(!n)return t(true);const s=mc.fromJSON(n,e.document);i.batch.addOperation(s),e.applyOperation(s),t(false);});})}}class Yd{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 i=this._listeners[e]||[];for(const e of i)e.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 i=this._shouldRestart();this.state="crashed",this._fire("stateChange"),this._fire("error",{error:e,causesRestart:i}),i?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)}_shouldRestart(){if(this.crashes.length<=this._crashNumberLimit)return  true;return (this.crashes[this.crashes.length-1].date-this.crashes[this.crashes.length-1-this._crashNumberLimit].date)/this._crashNumberLimit>this._minimumNonErrorTimePeriod}}function Zd(e,t=new Set){const i=[e],n=new Set;let s=0;for(;i.length>s;){const e=i[s++];if(!n.has(e)&&Xd(e)&&!t.has(e))if(n.add(e),Symbol.iterator in e)try{for(const t of e)i.push(t);}catch{}else for(const t in e)"defaultValue"!==t&&i.push(e[t]);}return n}function Xd(e){const t=Object.prototype.toString.call(e),i=typeof e;return !("number"===i||"boolean"===i||"string"===i||"symbol"===i||"function"===i||"[object Date]"===t||"[object RegExp]"===t||"[object Module]"===t||null==e||e._watchdogExcluded||e instanceof EventTarget||e instanceof Event)}function eh(e,t,i=new Set){if(e===t&&("object"==typeof(n=e)&&null!==n))return  true;var n;const s=Zd(e,i),o=Zd(t,i);for(const e of s)if(o.has(e))return  true;return  false}function th(e,t,i){const n=t.root,s=t.roots||Object.create(null);i&&!s[i]&&(s[i]=n||Object.create(null));const o=function(e){return !!e&&"object"==typeof e&&!Array.isArray(e)&&(t=e,!St(t));var t;}(e),r=function(e,t,i){return t||!i?e.initialData||Object.create(null):{[i]:e.initialData}}(t,o,i),a=Array.from(new Set([...o?Object.keys(e):[],...Object.keys(s),...Object.keys(r)]));for(const e of a){const i=s[e]||Object.create(null);i.initialData="",i.placeholder??=ih(t,"placeholder",e),i.label??=ih(t,"label",e),s[e]=i;}t.roots=s;}function ih(e,t,i){const n=e[t];if(n)return "string"==typeof n?n:n[i]}class nh extends Yd{_editor=null;_lifecyclePromise=null;_throttledSave;_data;_lastDocumentVersion;_elementOrData;_editorAttachTo=null;_isSingleRootEditor=true;_isUsingConfigBasedCreator=false;_editables={};_config;_excludedProps;constructor(e,t={}){super(t),this._throttledSave=ot(this._save.bind(this),"number"==typeof t.saveInterval?t.saveInterval:5e3),e&&(this._creator=(t,i)=>void 0===i?e.create(t):e.create(t,i)),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(()=>{this._isUsingConfigBasedCreator?th(this._isSingleRootEditor?"":{},this._config,!!this._isSingleRootEditor&&"main"):th(this._isSingleRootEditor?this._editorAttachTo||"":this._editables,this._config,!!this._isSingleRootEditor&&"main");const e={...this._config,extraPlugins:this._config.extraPlugins||[],_watchdogInitialData:this._data};e.extraPlugins.push(sh);const t={};for(const[i,n]of Object.entries(this._data.roots)){const s=e.roots[i]||Object.create(null);s.initialData="",n.isLoaded?s.lazyLoad=false:delete s.modelAttributes,t[i]=s;}if(e.roots=t,delete e.initialData,delete e.root,this._isUsingConfigBasedCreator)return this.create(e,e.context);const i=this._isSingleRootEditor?this._editorAttachTo||"":this._editables;return this.create(i,e,e.context)}).then(()=>{this._fire("restart");})}create(e=(this._isUsingConfigBasedCreator?this._config:this._elementOrData),t=(this._isUsingConfigBasedCreator?void 0:this._config),i){const n=this._detectConfigBasedCreator(e,t),s=n?void 0:e,o=n?e:t,r=n?t:i;return this._lifecyclePromise=Promise.resolve(this._lifecyclePromise).then(()=>{if(super._startErrorHandling(),this._isUsingConfigBasedCreator=n,this._elementOrData=s,this._config=this._cloneEditorConfiguration(o||{}),this._config.context=r,n){this._editorAttachTo=null;const e=this._config.roots?Object.keys(this._config.roots).length:0,t=this._config.initialData,i=t&&"object"==typeof t;this._isSingleRootEditor=!i&&e<=1;}else this._editorAttachTo=oh(s)?s:null,this._isSingleRootEditor=oh(s)||"string"==typeof s;return n?this._creator(this._config):this._creator(s,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._editorAttachTo||(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._editorAttachTo||(this._editables=this._getEditables()),this._lastDocumentVersion=e;}catch(e){console.error(e,"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:i}=e,n=i.has("CommentsRepository")&&i.get("CommentsRepository"),s=i.has("TrackChanges")&&i.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 t of e.model.markers)t._affectsData&&(o.markers[t.name]={rangeJSON:t.getRange().toJSON(),usingOperation:t._managedUsingOperations,affectsData:t._affectsData});return n&&(o.commentThreads=JSON.stringify(n.getCommentThreads({toJSON:true,skipNotAttached:true}))),s&&(o.suggestions=JSON.stringify(s.getSuggestions({toJSON:true,skipNotAttached:true}))),o}_getEditables(){const e={};for(const t of this.editor.model.document.getRootNames()){const i=this.editor.ui.getEditableElement(t);i&&(e[t]=i);}return e}_isErrorComingFromThisItem(e){return eh(this._editor,e.context,this._excludedProps)}_detectConfigBasedCreator(e,t){if("string"==typeof e||oh(e))return  false;if(t&&"object"==typeof t&&!("destroy"in t)&&Object.keys(t).length>0)return  false;if(e&&"object"==typeof e){const t=Object.values(e);if(t.length>0&&t.every(e=>"string"==typeof e||oh(e)))return  false}return  true}_cloneEditorConfiguration(e){return Ne(e,(e,t)=>oh(e)||"context"===t?e:void 0)}}class sh{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:false},e=>{this._restoreCollaborationData(),this._restoreEditorData(e);}),this.editor.data.fire("ready");},{priority:999});}_createNode(e,t){if("name"in t){const i=e.createElement(t.name,t.attributes);if(t.children)for(const n of t.children)i._appendChild(this._createNode(e,n));return i}return e.createText(t.data,t.attributes)}_restoreEditorData(e){const t=this.editor;Object.entries(this._data.roots).forEach(([i,{content:n,attributes:s}])=>{const o=JSON.parse(n),r=JSON.parse(s),a=t.model.document.getRoot(i);for(const[t,i]of r)e.setAttribute(t,i,a);for(const t of o){const i=this._createNode(e,t);e.insert(i,a,"end");}}),Object.entries(this._data.markers).forEach(([i,n])=>{const{document:s}=t.model,{rangeJSON:{start:o,end:r},...a}=n,l=s.getRoot(o.root),c=e.createPositionFromPath(l,o.path,o.stickiness),u=e.createPositionFromPath(l,r.path,r.stickiness),d=e.createRange(c,u);e.addMarker(i,{range:d,...a});});}_restoreCollaborationData(){const e=JSON.parse(this._data.commentThreads),t=JSON.parse(this._data.suggestions);if(this.editor.plugins.has("CommentsRepository")){const t=this.editor.plugins.get("CommentsRepository");for(const e of t.getCommentThreads())t._removeCommentThread({threadId:e.id});e.forEach(e=>{const t=this.editor.config.get("collaboration.channelId");this.editor.plugins.get("CommentsRepository").addCommentThread({channelId:t,...e});});}if(this.editor.plugins.has("TrackChangesEditing")){const e=this.editor.plugins.get("TrackChangesEditing");for(const t of e.getSuggestions())e._removeSuggestion(t);t.forEach(t=>{e.addSuggestionData(t);});}}}function oh(e){return St(e)}const rh=Symbol("MainQueueId");class ah extends Yd{_watchdogs=new Map;_watchdogConfig;_context=null;_contextProps=new Set;_actionQueues=new lh;_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(rh,()=>(this._contextConfig=e,this._create()))}getItem(e){return this._getWatchdog(e)._item}getItemState(e){return this._getWatchdog(e).state}add(e){const t=ch(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 nh(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",(i,{error:n,causesRestart:s})=>{this._fire("itemError",{itemId:e.id,error:n}),s&&this._actionQueues.enqueue(e.id,()=>new Promise(i=>{const n=()=>{t.off("restart",n),this._fire("itemRestart",{itemId:e.id}),i();};t.on("restart",n);}));}),void 0!==e.sourceElementOrData?t.create(e.sourceElementOrData,e.config,this._context):t.create(e.config,this._context);throw new Error(`Not supported item type: '${e.type}'.`)})))}remove(e){const t=ch(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(rh,()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy()))}_restart(){return this._actionQueues.enqueue(rh,()=>(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=Zd(this._context),Promise.all(Array.from(this._watchdogs.values()).map(e=>(e._setExcludedProperties(this._contextProps),e._isUsingConfigBasedCreator?e.create(void 0,this._context):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  false;return eh(this._context,e.context)}}class lh{_onEmptyCallbacks=[];_queues=new Map;_activeActions=0;onEmpty(e){this._onEmptyCallbacks.push(e);}enqueue(e,t){const i=e===rh;this._activeActions++,this._queues.get(e)||this._queues.set(e,Promise.resolve());const n=(i?Promise.all(this._queues.values()):Promise.all([this._queues.get(rh),this._queues.get(e)])).then(t),s=n.catch(()=>{});return this._queues.set(e,s),n.finally(()=>{this._activeActions--,this._queues.get(e)===s&&0===this._activeActions&&this._onEmptyCallbacks.forEach(e=>e());})}}function ch(e){return Array.isArray(e)?e:[e]}class uh{editor;_entries=[];_frameStack=[];_errors=new Set;_maxEntries;_errorCallback;_filterCallback;_maxEntriesCallback;static get pluginName(){return "ActionsRecorder"}static get isOfficialPlugin(){return  true}constructor(e){this.editor=e,e.config.define("actionsRecorder.maxEntries",1e3);const t=e.config.get("actionsRecorder");this._maxEntries=t.maxEntries,this._filterCallback=t.onFilter,this._errorCallback=t.onError,this._maxEntriesCallback=t.onMaxEntries||this._maxEntriesDefaultHandler,this._tapCommands(),this._tapOperationApply(),this._tapModelMethods(),this._tapModelSelection(),this._tapComponentFactory(),this._tapViewDocumentEvents();}getEntries(){return this._entries.slice()}flushEntries(){this._entries=[];}_enterFrame(e,t){const i={timeStamp:(new Date).toISOString(),...this._frameStack.length&&{parentEntry:this._frameStack.at(-1)},action:e,params:t?.map(e=>hh(e)),before:this._buildStateSnapshot()};return this._filterCallback&&!this._filterCallback(i,this._entries)||this._entries.push(i),this._frameStack.push(i),i}_leaveFrame(e,t,i){const n=this._frameStack.pop();n&&n===e&&(void 0!==t&&(n.result=hh(t)),i&&(n.error=hh(i)),n.after=this._buildStateSnapshot(),i&&this._callErrorCallback(i),0==this._frameStack.length&&this._errors.clear(),this._entries.length>=this._maxEntries&&this._maxEntriesCallback());}_buildStateSnapshot(){const{model:e,isReadOnly:t,editing:i}=this.editor;return {documentVersion:e.document.version,editorReadOnly:t,editorFocused:i.view.document.isFocused,modelSelection:hh(e.document.selection)}}_tapCommands(){for(const[e,t]of this.editor.commands)this._tapCommand(e,t);dh(this.editor.commands,"add",{before:(e,[t,i])=>(this._tapCommand(t,i),false)});}_tapOperationApply(){dh(this.editor.model,"applyOperation",{before:(e,[t])=>null!==t.baseVersion&&(e.callFrame=this._enterFrame("model.applyOperation",[t]),true),after:e=>{this._leaveFrame(e.callFrame);},error:(e,t)=>{this._leaveFrame(e.callFrame,void 0,t);}});}_tapModelMethods(){for(const e of ["insertContent","insertObject","deleteContent"])dh(this.editor.model,e,{before:(t,...i)=>(t.callFrame=this._enterFrame(`model.${e}`,i),true),after:(e,t)=>{this._leaveFrame(e.callFrame,t);},error:(e,t)=>{this._leaveFrame(e.callFrame,void 0,t);}});}_tapModelSelection(){this._tapFireMethod(this.editor.model.document.selection,["change:range","change:attribute","change:marker"],{eventSource:"model-selection"});}_tapCommand(e,t){dh(t,"execute",{before:(t,i)=>(t.callFrame=this._enterFrame(`commands.${e}:execute`,i),true),after:(e,t)=>{this._leaveFrame(e.callFrame,t);},error:(e,t)=>{this._leaveFrame(e.callFrame,void 0,t);}});}_tapComponentFactory(){dh(this.editor.ui.componentFactory,"create",{before:(e,[t])=>(e.componentName=t,e.callFrame=this._enterFrame(`component-factory.create:${t}`),true),after:(e,t)=>{const i={...e,eventSource:`component.${e.componentName}`};"function"==typeof t.fire&&this._tapFireMethod(t,["execute"],i),"function"==typeof t.panelView?.fire&&this._tapFireMethod(t.panelView,["execute"],i),"function"==typeof t.buttonView?.actionView?.fire&&this._tapFireMethod(t.buttonView.actionView,["execute"],i),this._leaveFrame(e.callFrame);},error:(e,t)=>{this._leaveFrame(e.callFrame,void 0,t);}});}_tapViewDocumentEvents(){this._tapFireMethod(this.editor.editing.view.document,["click","mousedown","mouseup","pointerdown","pointerup","focus","blur","keydown","keyup","selectionChange","compositionstart","compositionend","beforeinput","mutations","enter","delete","insertText","paste","copy","cut","dragstart","drop"],{eventSource:"observers"});}_tapFireMethod(e,t,i={}){dh(e,"fire",{before:(e,[i,...n])=>{const s="string"==typeof i?i:i.name;return !!t.includes(s)&&(e.callFrame=this._enterFrame(`${e.eventSource}:${s}`,n),true)},after:(e,t)=>{this._leaveFrame(e.callFrame,t);},error:(e,t)=>{this._leaveFrame(e.callFrame,void 0,t);}},i);}_callErrorCallback(e){if(this._errorCallback&&!this._errors.has(e)){this._errors.add(e);try{this._errorCallback(e,this.getEntries());}catch(e){console.error("ActionsRecorder onError callback error:",e);}}}_maxEntriesDefaultHandler(){this._entries.shift();}}function dh(e,t,i,n={}){const s=e[t];s[Symbol.for("Tapped method")]||(e[t]=(...t)=>{const o=Object.assign({},n);let r;try{r=i.before?.(o,t);const n=s.apply(e,t);return r&&i.after?.(o,n),n}catch(e){throw r&&i.error?.(o,e),e}},e[t][Symbol.for("Tapped method")]=s);}function hh(e,t=new WeakSet){if(!e||["boolean","number","string"].includes(typeof e))return e;if("function"==typeof e.toJSON){const i=e.toJSON();if(yt(i)||Array.isArray(i)||["string","number","boolean"].includes(typeof i))return hh(i,t)}if(e instanceof Error)return {name:e.name,message:e.message,stack:e.stack};if(function(e){return e&&"function"==typeof e.is}(e)||"object"!=typeof e)return {type:typeof e,constructor:e.constructor?.name||"unknown",string:String(e)};if(e instanceof File||e instanceof Blob||e instanceof FormData||e instanceof DataTransfer)return String(e);if(t.has(e))return;if(t.add(e),Array.isArray(e))return e.length?e.map(e=>hh(e,t)):void 0;const i={},n=[];e.domEvent&&(n.push("domEvent","domTarget","view","document"),i.domEvent=function(e){let t={type:e.type,target:i(e.target)};e instanceof MouseEvent&&(t={...t,button:e.button,buttons:e.buttons,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey});e instanceof KeyboardEvent&&(t={...t,key:e.key,code:e.code,keyCode:e.keyCode,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,repeat:e.repeat});e instanceof InputEvent&&(t={...t,data:e.data,inputType:e.inputType,isComposing:e.isComposing});e instanceof PointerEvent&&(t={...t,isPrimary:e.isPrimary});function i(e){return e?e instanceof Element?{tagName:e.tagName,className:e.className,id:e.id}:e instanceof Window||e instanceof Document?{type:e.constructor.name}:{}:null}return t}(e.domEvent),i.target=hh(e.target),e.dataTransfer&&(i.dataTransfer={types:e.dataTransfer.types,htmlData:e.dataTransfer.getData("text/html"),files:hh(e.dataTransfer.files)}));for(const[s,o]of Object.entries(e)){if(s.startsWith("_")||n.includes(s)||"function"==typeof o)continue;const e=hh(o,t);void 0!==e&&(i[s]=e);}if(Symbol.iterator in e){const n=Array.from(e[Symbol.iterator]()).map(e=>hh(e,t));n.length&&(i._items=n);}return Object.keys(i).length?i:void 0}const mh="contentEditing",gh="common";class fh{keystrokeInfos=new Map;_editor;constructor(e){this._editor=e;const t=e.config.get("menuBar.isVisible"),i=e.locale.t;this.addKeystrokeInfoCategory({id:mh,label:i("Content editing keystrokes"),description:i("These keyboard shortcuts allow for quick access to content editing features.")});const n=[{label:i("Close contextual balloons, dropdowns, and dialogs"),keystroke:"Esc"},{label:i("Open the accessibility help dialog"),keystroke:"Alt+0"},{label:i("Move focus between form fields (inputs, buttons, etc.)"),keystroke:[["Tab"],["Shift+Tab"]]},{label:i("Move focus to the toolbar, navigate between toolbars"),keystroke:"Alt+F10",mayRequireFn:true},{label:i("Navigate through the toolbar or menu bar"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]},{label:i("Execute the currently focused button. Executing buttons that interact with the editor content moves the focus back to the content."),keystroke:[["Enter"],["Space"]]}];t&&n.push({label:i("Move focus to the menu bar, navigate between menu bars"),keystroke:"Alt+F9",mayRequireFn:true}),this.addKeystrokeInfoCategory({id:"navigation",label:i("User interface and content navigation keystrokes"),description:i("Use the following keystrokes for more efficient navigation in the CKEditor 5 user interface."),groups:[{id:"common",keystrokes:n}]});}addKeystrokeInfoCategory({id:e,label:t,description:i,groups:n}){this.keystrokeInfos.set(e,{id:e,label:t,description:i,groups:new Map}),this.addKeystrokeInfoGroup({categoryId:e,id:gh}),n&&n.forEach(t=>{this.addKeystrokeInfoGroup({categoryId:e,...t});});}addKeystrokeInfoGroup({categoryId:e=mh,id:t,label:i,keystrokes:n}){const s=this.keystrokeInfos.get(e);if(!s)throw new I("accessibility-unknown-keystroke-info-category",this._editor,{groupId:t,categoryId:e});s.groups.set(t,{id:t,label:i,keystrokes:n||[]});}addKeystrokeInfos({categoryId:e=mh,groupId:t=gh,keystrokes:i}){if(!this.keystrokeInfos.has(e))throw new I("accessibility-unknown-keystroke-info-category",this._editor,{categoryId:e,keystrokes:i});const n=this.keystrokeInfos.get(e);if(!n.groups.has(t))throw new I("accessibility-unknown-keystroke-info-group",this._editor,{groupId:t,categoryId:e,keystrokes:i});n.groups.get(t).keystrokes.push(...i);}}function ph(e){return {sessionId:_h(),pageSessionId:yh(),hostname:window.location.hostname,version:globalThis.CKEDITOR_VERSION,type:bh(e),plugins:(t=e.plugins,Array.from(t).filter(([e])=>!!e.pluginName).map(([e])=>{const{pluginName:t,isContextPlugin:i,isOfficialPlugin:n,isPremiumPlugin:s}=e;return {isContext:!!i,isOfficial:!!n,isPremium:!!s,name:t}})),distribution:{channel:window[Symbol.for("cke distribution")]||"sh"},env:vh(),integration:Object.create(null),menuBar:{isVisible:!!e.config.get("menuBar.isVisible")},language:{ui:e.locale.uiLanguage,content:e.locale.contentLanguage},toolbar:{main:wh(e.config.get("toolbar")),block:wh(e.config.get("blockToolbar")),balloon:wh(e.config.get("balloonToolbar"))}};var t;}function bh(e){return Object.getPrototypeOf(e).constructor.editorName}function wh(e){if(!e)return;const t=Array.isArray(e)?{items:e}:e,i=function e(t){return t.flatMap(t=>"string"==typeof t?[t]:e(t.items))}(t.items||[]);return {isMultiline:i.includes("-"),shouldNotGroupWhenFull:!!t.shouldNotGroupWhenFull,items:(n=i,n.filter(e=>"|"!==e&&"-"!==e))};var n;}function vh(){let e="unknown",t="unknown";return n.isMac?e="mac":n.isWindows?e="windows":n.isiOS?e="ios":n.isAndroid&&(e="android"),n.isGecko?t="gecko":n.isBlink?t="blink":n.isSafari&&(t="safari"),{os:e,browser:t}}function _h(){return localStorage.getItem("__ckeditor-session-id")||localStorage.setItem("__ckeditor-session-id",A()),localStorage.getItem("__ckeditor-session-id")}function yh(){return exports.global.window.CKEDITOR_PAGE_SESSION_ID=exports.global.window.CKEDITOR_PAGE_SESSION_ID||A(),exports.global.window.CKEDITOR_PAGE_SESSION_ID}class kh extends($t()){static get editorName(){return "Editor"}accessibility;commands;config;conversion;data;editing;locale;model;plugins;keystrokes;t;static defaultConfig;static builtinPlugins;_context;_readOnlyLocks;static get _throwErrorWhenUsedAsAPlugin(){return  true}constructor(e={}){if(super(),"object"!=typeof e||Array.isArray(e))throw new I("editor-config-invalid-type");if("sanitizeHtml"in e)throw new I("editor-config-sanitizehtml-not-supported");const t=this.constructor,{translations:i,...n}=t.defaultConfig||{},{translations:s=i,...o}=e,r=e.language||n.language;this._context=e.context||new Us({language:r,translations:s}),this._context._addEditor(this,!e.context);const a=Array.from(t.builtinPlugins||[]);this.config=new ni(o,n),this.config.define("plugins",a),this.config.define(this._context._getEditorConfig()),function(e){let t=e.get("licenseKey");!t&&window.CKEDITOR_GLOBAL_LICENSE_KEY&&(t=window.CKEDITOR_GLOBAL_LICENSE_KEY,e.set("licenseKey",t));if(!t)throw new I("license-key-missing")}(this.config),this.plugins=new qs(this,a,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this._readOnlyLocks=new Set,this.commands=new Hs,this.set("state","initializing"),this.once("ready",()=>this.state="ready",{priority:"high"}),this.once("destroy",()=>this.state="destroyed",{priority:"high"}),this.model=new bu(this.config),this.on("change:isReadOnly",()=>{this.model.document.isReadOnly=this.isReadOnly;});const l=new fo;this.data=new ql(this.model,l),this.editing=new Cl(this.model,l),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new Ul([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 $s(this),this.keystrokes.listenTo(this.editing.view.document),this.accessibility=new fh(this),function(e){const t=e.config.get("licenseKey"),i=window[Symbol.for("cke distribution")]||"sh";function n(t,i){e.enableReadOnlyMode(Symbol("invalidLicense")),e._showLicenseError(t,i);}if("GPL"==t)return void("cloud"==i&&n("distributionChannel"));const s=Yn(t);if(!s)return void n("invalid");if(!function(e){return ["exp","jti","vc"].every(t=>t in e)}(s))return void n("invalid");if(s.distributionChannel&&!pn(s.distributionChannel).includes(i))return void n("distributionChannel");if(Dn(function(e){const t=Object.getOwnPropertyNames(e).sort().filter(t=>"vc"!=t&&null!=e[t]).map(t=>e[t]);return t}(s))!=s.vc.toLowerCase())return void n("invalid");if(new Date(1e3*s.exp)<L)return void n("expired");const o=s.licensedHosts;if(o&&o.length>0&&!function(e){const{hostname:t}=new URL(window.location.href);if(e.includes(t))return  true;const i=t.split(".");return e.filter(e=>e.includes("*")).map(e=>e.split(".")).filter(e=>e.length<=i.length).map(e=>Array(i.length-e.length).fill("*"===e[0]?"*":"").concat(e)).some(e=>i.every((t,i)=>e[i]===t||"*"===e[i]))}(o))return void n("domainLimit");if(["evaluation","trial"].includes(s.licenseType)&&1e3*s.exp<Date.now())return void n("expired");if(["development","evaluation","trial"].includes(s.licenseType)){const{licenseType:e}=s;window.CKEDITOR_WARNING_SUPPRESSIONS=window.CKEDITOR_WARNING_SUPPRESSIONS||{},window.CKEDITOR_WARNING_SUPPRESSIONS[e]||(!function(e){const t=e[0].toUpperCase()+e.slice(1),i="evaluation"===e?"an":"a";console.info(`%cCKEditor 5 ${t} License`,"color: #ffffff; background: #743CCD; font-size: 14px; padding: 4px 8px; border-radius: 4px;"),console.warn(`⚠️ You are using ${i} ${e} license of CKEditor 5`+("trial"===e?" which is for evaluation purposes only":"")+". For production usage, please obtain a production license at https://portal.ckeditor.com/");}(e),window.CKEDITOR_WARNING_SUPPRESSIONS[e]=true);}if("evaluation"===s.licenseType){const t=setTimeout(()=>{n("evaluationLimit");},6e5);e.on("destroy",()=>{clearTimeout(t);});}s.usageEndpoint&&e.once("ready",()=>{const i={requestId:A(),requestTime:Math.round(Date.now()/1e3),license:t,editor:Ch(e)};e._sendUsageRequest(s.usageEndpoint,i).then(e=>{const{status:t,message:i}=e;i&&console.warn(i),"ok"!=t&&n("usageLimit");},()=>{V("license-key-validation-endpoint-not-reachable",{url:s.usageEndpoint});});},{priority:"high"});}(this);}get isReadOnly(){return this._readOnlyLocks.size>0}set isReadOnly(e){throw new I("editor-isreadonly-has-no-setter")}enableReadOnlyMode(e){if("string"!=typeof e&&"symbol"!=typeof e)throw new I("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",true,false));}disableReadOnlyMode(e){if("string"!=typeof e&&"symbol"!=typeof e)throw new I("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",false,true));}setData(e){this.data.set(e);}getData(e){return this.data.get(e)}initPlugins(){const e=this.config,t=e.get("plugins"),i=e.get("removePlugins")||[],n=e.get("extraPlugins")||[],s=e.get("substitutePlugins")||[];return this.plugins.init(t.concat(n),i,s).then(e=>(function(e){const t=e.config.get("licenseKey");if("GPL"===t)return;const i=Yn(t);if(!i)return;const n=[...e.plugins].map(([e])=>e).find(e=>!!e.pluginName&&(!!e.licenseFeatureCode&&Zn(i,e.licenseFeatureCode)));n&&(e.enableReadOnlyMode(Symbol("invalidLicense")),e._showLicenseError("pluginNotAllowed",n.pluginName));}(this),e))}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(e){I.rethrowUnexpectedError(e,this);}}focus(){this.editing.view.focus();}static create(...e){throw new Error("This is an abstract method.")}static Context=Us;static EditorWatchdog=nh;static ContextWatchdog=ah;_showLicenseError(e,t){setTimeout(()=>{if("invalid"==e)throw new I("invalid-license-key");if("expired"==e)throw new I("license-key-expired");if("domainLimit"==e)throw new I("license-key-domain-limit");if("pluginNotAllowed"==e){const e=t.replace(/(Editing|UI)$/,""),i=this.plugins.has(e);throw new I("license-key-plugin-not-allowed",null,{pluginName:i?e:t})}if("featureNotAllowed"==e)throw new I("license-key-feature-not-allowed",null,{featureName:t});if("evaluationLimit"==e)throw new I("license-key-evaluation-limit");if("trialLimit"==e)throw new I("license-key-trial-limit");if("developmentLimit"==e)throw new I("license-key-development-limit");if("usageLimit"==e)throw new I("license-key-usage-limit");if("distributionChannel"==e)throw new I("license-key-invalid-distribution-channel")},0),this._showLicenseError=()=>{};}async _sendUsageRequest(e,t){const i=new Headers({"Content-Type":"application/json"}),n=await fetch(new URL(e),{method:"POST",headers:i,body:JSON.stringify(t)});if(!n.ok)throw new Error(`HTTP Response: ${n.status}`);return n.json()}}function Ch(e){const t=ph(e);return e.fire("collectUsageData",{setUsageData:function(e,i){if(void 0!==ie(t,e))throw new I("editor-usage-data-path-already-set",{path:e});it(t,e,i);}}),t}function xh(e){if(!Tt(e.updateSourceElement))throw new I("attachtoform-missing-elementapi-interface",e);const t=e.sourceElement;if(function(e){return !!e&&"textarea"===e.tagName.toLowerCase()}(t)&&t.form){let i;const n=t.form,s=()=>e.updateSourceElement();Tt(n.submit)&&(i=n.submit,n.submit=()=>{s(),i.apply(n);}),n.addEventListener("submit",s),e.on("destroy",()=>{n.removeEventListener("submit",s),i&&(n.submit=i);});}}function Ah(e){return class extends e{sourceElement;updateSourceElement(e){if(!this.sourceElement)throw new I("editor-missing-sourceelement",this);const t=this.config.get("updateSourceElementOnDestroy"),i=this.sourceElement instanceof HTMLTextAreaElement;if(!t&&!i)return void Vi(this.sourceElement,"");const n="string"==typeof e?e:this.data.get();Vi(this.sourceElement,n);}}}function Eh(e,t){if(t.ckeditorInstance)throw new I("editor-source-element-already-used",e);t.ckeditorInstance=e,e.once("destroy",()=>{delete t.ckeditorInstance;});}function Th(e,t,i="main",n=false){const s=t.get("root"),o=t.get("roots")||Object.create(null);if(s){if(!i)throw new I("editor-create-multi-root-with-main",null);if(i in o)throw new I("editor-create-roots-with-main",null)}i&&!o[i]&&(o[i]=s||Object.create(null));const r=function(e){return !!e&&"object"==typeof e&&!Array.isArray(e)&&!Rh(e)}(e),a=function(e,t,i){return t||!i?e.get("initialData")||Object.create(null):{[i]:e.get("initialData")}}(t,r,i),l=Array.from(new Set([...r?Object.keys(e):[],...Object.keys(o),...Object.keys(a)]));for(const i of l){const s=o[i]||Object.create(null),l=r?e[i]:e;if(!n&&Rh(l)){if(s.element)throw new I("editor-create-root-element-overspecified",null);s.element=l;}if(n&&Rh(s.element)&&P("editor-create-root-element-not-supported"),void 0===s.initialData)if(void 0===a[i])s.initialData=Ph(l||s.element||n&&t.get("attachTo")||"");else {if(l&&!Rh(l))throw new I("editor-create-initial-data-overspecified",null);s.initialData=a[i];}else {if(l&&!Rh(l))throw new I("editor-create-root-initial-data-overspecified",null);if(void 0!==a[i])throw new I("editor-create-legacy-initial-data-overspecified",null)}s.placeholder??=Vh(t,"placeholder",i),s.label??=Vh(t,"label",i),o[i]=s;}if(n&&Rh(e)){if(t.get("attachTo"))throw new I("editor-create-attachto-overspecified",null);t.set("attachTo",e);}if(!n&&t.get("attachTo"))throw new I("editor-create-attachto-ignored",null);t.set("roots",o);}function Sh(e,t){return "string"==typeof e||Rh(e)||t&&Object.keys(t).length?{sourceElementOrData:e,editorConfig:t}:{sourceElementOrData:"",editorConfig:e}}function Ih(e,t){return t&&Object.keys(t).length||0==Object.keys(e).length||Object.values(e).every(e=>"string"==typeof e||Rh(e))?{sourceElementsOrData:e,editorConfig:t}:{sourceElementsOrData:{},editorConfig:e}}function Ph(e){return Rh(e)?gi(e):e}function Vh(e,t,i){const n=e.get(t);if(n)return "string"==typeof n?n:n[i]}function Rh(e){return St(e)}class Oh extends js{_actions;static get pluginName(){return "PendingActions"}static get isOfficialPlugin(){return  true}init(){this.set("hasAny",false),this._actions=new kn({idProperty:"_id"}),this._actions.delegate("add","remove").to(this);}add(e){if("string"!=typeof e)throw new I("pendingactions-add-invalid-message",this);const t=new($t());return t.set("message",e),this._actions.add(t),this.hasAny=true,t}remove(e){this._actions.remove(e),this.hasAny=!!this._actions.length;}get first(){return this._actions.get(0)}[Symbol.iterator](){return this._actions[Symbol.iterator]()}}var Bh='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10 6.628a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M8.5 9.125a.3.3 0 0 0-.253-.296L5.11 8.327a.75.75 0 1 1 .388-1.449l4.04.716c.267.072.624.08.893.009l4.066-.724a.75.75 0 1 1 .388 1.45l-3.132.5a.3.3 0 0 0-.253.296v1.357a.3.3 0 0 0 .018.102l1.615 4.438a.75.75 0 0 1-1.41.513l-1.35-3.71a.3.3 0 0 0-.281-.197h-.209a.3.3 0 0 0-.282.198l-1.35 3.711a.75.75 0 0 1-1.41-.513l1.64-4.509a.3.3 0 0 0 .019-.103z"/><path d="M10 18.5a8.5 8.5 0 1 1 0-17 8.5 8.5 0 0 1 0 17m0 1.5c5.523 0 10-4.477 10-10S15.523 0 10 0 0 4.477 0 10s4.477 10 10 10" clip-rule="evenodd"/></svg>',Lh='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M4 1.5h12A3.5 3.5 0 0 1 19.5 5v8l-.005.192a3.5 3.5 0 0 1-2.927 3.262l-.062.008v1.813a1.5 1.5 0 0 1-2.193 1.33l-.371-.193-.38-.212a13.5 13.5 0 0 1-3.271-2.63l-.062-.07H4A3.5 3.5 0 0 1 .5 13V5A3.5 3.5 0 0 1 4 1.5M4 3a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h6.924a11.9 11.9 0 0 0 3.71 3.081l.372.194v-3.268L14.962 15H16a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2z"/><path d="M9.75 5a.75.75 0 0 0-.75.75v2.5H6.5a.75.75 0 0 0 0 1.5H9v2.5a.75.75 0 0 0 1.5 0v-2.5H13a.75.75 0 0 0 0-1.5h-2.5v-2.5A.75.75 0 0 0 9.75 5"/></svg>',Mh='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M13.903 7.617a3.35 3.35 0 0 0 1.98 1.98L19 10.752l-3.117 1.153a3.35 3.35 0 0 0-1.98 1.98l-1.154 3.117-1.153-3.116a3.35 3.35 0 0 0-1.98-1.98L6.5 10.75l3.116-1.153a3.35 3.35 0 0 0 1.98-1.98L12.75 4.5zm-9.647 4.755c.15.404.469.723.872.872l1.372.507-1.372.507c-.403.15-.722.468-.872.872L3.75 16.5l-.507-1.371a1.48 1.48 0 0 0-.872-.872L1 13.75l1.37-.507a1.48 1.48 0 0 0 .873-.872L3.75 11zM6.441 2.87c.204.55.639.985 1.19 1.189L9.5 4.75l-1.87.691A2.02 2.02 0 0 0 6.44 6.63L5.75 8.5l-.692-1.87a2.01 2.01 0 0 0-1.19-1.189L2 4.751l1.869-.692a2.02 2.02 0 0 0 1.19-1.189L5.748 1z"/></svg>',Fh='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m13.749 15.5.691-1.87c.204-.55.638-.984 1.189-1.188l1.87-.692-1.87-.692A2.01 2.01 0 0 1 14.44 9.87L13.75 8l-.692 1.87c-.204.55-.638.984-1.189 1.188l-1.87.692 1.87.692c.55.204.985.638 1.189 1.188zm.5-11.5a.75.75 0 0 1 0 1.5h-11a.75.75 0 0 1 0-1.5zm-4 4a.75.75 0 0 1 0 1.5h-7a.75.75 0 0 1 0-1.5zm-3 4a.75.75 0 0 1 0 1.5h-4a.75.75 0 0 1 0-1.5z"/></svg>',Nh='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M.773 12.536a.75.75 0 0 1 .945.498l.018.051a9 9 0 0 0 .42.964c.317.62.799 1.397 1.473 2.072.701.7 1.38 1.191 1.88 1.505a8 8 0 0 0 .746.417l.037.016.005.003a.75.75 0 0 1-.522 1.404l-.072-.027-.01-.004-.018-.008-.058-.027a10 10 0 0 1-.905-.504 12.3 12.3 0 0 1-2.143-1.715c-.82-.82-1.388-1.744-1.748-2.451a10 10 0 0 1-.5-1.145l-.026-.075-.006-.021-.003-.007v-.003l-.001-.001L1 13.25l-.715.228a.75.75 0 0 1 .488-.942M13.314.953a.75.75 0 0 1 .913-.419l.072.028.009.004.018.007.059.028q.075.034.204.1c.172.09.413.223.701.404a12.3 12.3 0 0 1 2.143 1.715c.82.82 1.387 1.744 1.748 2.45a10 10 0 0 1 .499 1.145l.026.075.007.022.003.007v.003h.001c-.002.002-.043.015-.715.228l.715-.227a.751.751 0 0 1-1.43.455l-.004-.011-.017-.052a9 9 0 0 0-.42-.964c-.317-.619-.8-1.397-1.474-2.07a10.8 10.8 0 0 0-1.88-1.507 8 8 0 0 0-.746-.417l-.036-.015-.006-.003a.75.75 0 0 1-.39-.986M11.29 6.84a3.76 3.76 0 0 0 2.22 2.22L17 10.35l-3.49 1.292a3.76 3.76 0 0 0-2.219 2.22L10 17.35l-1.292-3.49a3.76 3.76 0 0 0-2.22-2.22L3 10.35l3.49-1.291A3.76 3.76 0 0 0 8.71 6.84L10 3.35zm6.009 8.66a.75.75 0 1 1 1.5 0 .75.75 0 0 1-1.5 0M14.8 18a.75.75 0 1 1 1.5 0 .75.75 0 0 1-1.5 0M3.798 2.001a.75.75 0 1 1 1.5 0 .75.75 0 0 1-1.5 0m-2.499 2.5a.75.75 0 1 1 1.5 0 .75.75 0 0 1-1.5 0"/></svg>',Dh='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M11.282 2.775a4.274 4.274 0 0 1 5.466.466 4.23 4.23 0 0 1 .47 5.443.75.75 0 0 1-.113.907.75.75 0 0 1-.913.114 4.27 4.27 0 0 1-2.846.759l-2.625 2.362a1 1 0 0 1 .015.14v4.788a.75.75 0 0 1-1.5 0v-3.59l-2.678 2.41a1.26 1.26 0 0 1-1.083.298l-1.134-.226-1.062 1.058a.75.75 0 0 1-1.059-1.063l1.06-1.056-.224-1.121c-.078-.39.035-.792.3-1.085l6.14-6.752c-.09-.983.165-1.99.761-2.83a.75.75 0 0 1 .113-.906.75.75 0 0 1 .912-.116m-6.73 11.519.164.82a1 1 0 0 1 .097.097l.834.165 6.027-5.426a4.26 4.26 0 0 1-1.665-1.658zm6.779-9.39a2.73 2.73 0 0 0 .455 3.274 2.77 2.77 0 0 0 3.294.456zm4.359-.6a2.77 2.77 0 0 0-3.294-.456l3.748 3.728a2.73 2.73 0 0 0-.454-3.272" clip-rule="evenodd"/><path d="M4.44 1.87c.205.55.639.985 1.19 1.189l1.87.691-1.87.691c-.551.204-.985.64-1.19 1.19L3.75 7.5l-.693-1.87A2.01 2.01 0 0 0 1.87 4.442L0 3.751l1.87-.691c.55-.204.984-.64 1.188-1.19L3.75 0z"/></svg>',zh='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M15.739 13.009c0-.416.44-.644.749-.422l.06.05 3.297 3.232.036.039a.53.53 0 0 1 0 .666l-.036.039-3.297 3.232c-.288.283-.747.098-.803-.292l-.006-.08v-1.468c-.343.04-.898.142-1.57.404l-.189.077c-.654.276-1.15.766-1.464 1.156l-.123.16a.48.48 0 0 1-.574.163.516.516 0 0 1-.314-.56l.064-.388c.074-.426.184-.955.335-1.474.196-.676.483-1.408.906-1.854l.113-.114c.986-.957 2.195-1.094 2.816-1.094zM.773 12.536a.75.75 0 0 1 .945.498l.018.052a9 9 0 0 0 .42.964c.316.619.8 1.396 1.473 2.07.701.702 1.38 1.193 1.88 1.507a8 8 0 0 0 .746.417l.037.015.005.003a.75.75 0 0 1-.522 1.404l-.072-.027-.01-.004-.018-.008-.058-.027a10 10 0 0 1-.905-.504 12.3 12.3 0 0 1-2.143-1.715c-.82-.82-1.388-1.744-1.748-2.45a10 10 0 0 1-.5-1.145l-.026-.076-.006-.021-.003-.007v-.003H.285a.75.75 0 0 1 .488-.943M11.29 6.84a3.76 3.76 0 0 0 2.22 2.218L17 10.35l-3.49 1.291a3.76 3.76 0 0 0-2.22 2.22L10 17.35l-1.291-3.49a3.76 3.76 0 0 0-2.22-2.22l-3.49-1.29 3.49-1.292a3.76 3.76 0 0 0 2.22-2.218l1.29-3.49zM13.314.953a.75.75 0 0 1 .913-.42l.072.028.01.004.018.008.058.027q.076.035.204.1c.172.09.413.223.702.404.576.362 1.348.92 2.142 1.715.82.82 1.388 1.744 1.748 2.451a10 10 0 0 1 .5 1.145l.026.075.006.021.003.007v.003l.001.001a.75.75 0 0 1-1.43.455l-.003-.01-.018-.052-.079-.21a9 9 0 0 0-.342-.754c-.315-.62-.798-1.397-1.472-2.071a10.8 10.8 0 0 0-1.88-1.506 8 8 0 0 0-.746-.417l-.037-.016-.005-.003a.75.75 0 0 1-.391-.985M2.05 3.75a.75.75 0 1 1-.002 1.502.75.75 0 0 1 .001-1.501M4.548 1.25a.75.75 0 1 1 0 1.501.75.75 0 0 1 0-1.5"/></svg>',Hh='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M7.591 16.502c.421 0 .762.336.762.75s-.341.75-.762.75h-5.08a.757.757 0 0 1-.761-.751c0-.414.34-.749.761-.749zm3.302-8.942c0-1.009 1.135-1.576 1.952-1.056l.158.12 4.817 4.182c.576.5.572 1.386-.008 1.882L12.996 16.8c-.823.702-2.103.127-2.103-.945V14.46H2.511a.756.756 0 0 1-.761-.75c0-.414.34-.75.761-.75h8.636c.701 0 1.27.56 1.27 1.25v1.098l4.176-3.568-4.175-3.627V9.28c0 .69-.57 1.25-1.271 1.25H2.511a.756.756 0 0 1-.761-.75c0-.414.34-.75.761-.75h8.382zm6.047-5.689c.205.55.639.986 1.19 1.19l1.869.691-1.87.691c-.55.204-.984.64-1.188 1.19l-.692 1.869-.692-1.87a2.01 2.01 0 0 0-1.188-1.189l-1.87-.691 1.87-.691c.55-.204.984-.64 1.188-1.19l.691-1.869zM7.591 5.502c.421 0 .762.336.762.75s-.34.75-.762.75h-5.08a.756.756 0 0 1-.761-.75c0-.414.34-.75.761-.75z"/></svg>',qh='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M17.413 12.037 10.487 19l-3.421-3.446 1.053-1.058 2.37 2.386 5.873-5.902z"/><path fill-rule="evenodd" d="m12.976 12.465-1.004 1.009-.737-1.995H5.378l-1.39 3.492H2.5L7.463 3H9.05zm-7.1-2.183h4.764L8.257 4.496z" clip-rule="evenodd"/><path d="M16.958 1.87c.203.55.634.985 1.182 1.189l1.859.691-1.86.691a2.01 2.01 0 0 0-1.181 1.19L16.27 7.5l-.689-1.87A2 2 0 0 0 14.4 4.442l-1.858-.691L14.4 3.06c.548-.204.98-.64 1.182-1.19L16.27 0z"/></svg>',Uh='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M14.832 15.502a.75.75 0 0 1 .754.749.75.75 0 0 1-.755.749H7.28a.753.753 0 0 1-.756-.749c0-.414.339-.749.756-.749zm1.237-12.5a.946.946 0 0 1 .851 1.322c-.69 1.575-1.272 2.683-1.893 3.406-.563.655-1.17 1.005-1.884 1.126-.449 1.736-1.662 2.854-2.73 3.527a8.8 8.8 0 0 1-2.038.937q-.092.029-.146.042l-.042.012-.013.003H8.17l-.002.002a.76.76 0 0 1-.917-.546.75.75 0 0 1 .55-.908l.002-.001.023-.006.104-.03a7.3 7.3 0 0 0 1.673-.77c.952-.6 1.888-1.526 2.14-2.92a.97.97 0 0 1 .91-.792l.168-.014c.382-.05.694-.212 1.056-.633.377-.438.782-1.133 1.293-2.229-2.808.253-5.14 2.025-6.952 4.332-1.991 2.537-3.253 5.6-3.728 7.563a.757.757 0 0 1-.911.553.75.75 0 0 1-.559-.903c.519-2.144 1.867-5.409 4.007-8.134 2.136-2.72 5.164-5.024 9.042-4.939M4.44 1.87c.205.55.64.985 1.19 1.189l1.87.691-1.87.691c-.55.204-.985.64-1.19 1.19L3.75 7.5l-.692-1.87a2.01 2.01 0 0 0-1.19-1.189L0 3.75l1.869-.691c.55-.204.985-.64 1.19-1.19L3.748 0z"/></svg>',jh='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m16.25 0 .69 1.87c.205.55.639.984 1.19 1.188L20 3.75l-1.87.692a2.02 2.02 0 0 0-1.19 1.188l-.69 1.87-.693-1.87a2.01 2.01 0 0 0-1.188-1.188l-1.87-.692 1.87-.692c.55-.204.985-.638 1.188-1.188z"/><path d="M10 1c.704 0 1.053-.003 1.474.09.445.099.635.613.426 1.019-.163.315-.523.465-.875.423C10.712 2.495 10.42 2.5 10 2.5a7.5 7.5 0 1 0 7.5 7.5c0-.26-.047-.582-.102-.89a.82.82 0 0 1 .458-.89c.456-.214 1.007.027 1.08.525.053.375.064.746.064 1.255a9 9 0 1 1-9-9"/><path d="M7.05 10a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0m4.2 0a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0m4.2 0a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0"/></svg>',$h='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M7.718 5.12c.285.77.893 1.378 1.663 1.663l2.618.97-2.618.968a2.82 2.82 0 0 0-1.663 1.664l-.969 2.617-.969-2.617A2.82 2.82 0 0 0 4.117 8.72l-2.618-.969 2.618-.969A2.82 2.82 0 0 0 5.78 5.12l.969-2.618zm10.609 9.086a.75.75 0 0 1 0 1.492l-.078.004h-8a.75.75 0 0 1 0-1.5h8zm-.077-4.504a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5zm.002-4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5zM3.461 12.749c.136.367.425.657.791.793l1.247.46-1.247.46a1.34 1.34 0 0 0-.79.793l-.463 1.247-.46-1.246a1.34 1.34 0 0 0-.793-.793l-1.247-.46 1.247-.461a1.34 1.34 0 0 0 .792-.793L3 11.502z"/></svg>',Wh='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m14.57 9.33-8.194 8.194H3.598V14.75l8.193-8.198 2.779 2.78Zm-.108-5.14a.73.73 0 0 1 .522.217l1.734 1.73a.736.736 0 0 1 0 1.043l-1.355 1.36-2.78-2.78 1.357-1.352a.74.74 0 0 1 .522-.218M4.05.19l.692 1.869c.204.55.638.985 1.189 1.189l1.87.691-1.87.692c-.55.204-.985.638-1.189 1.189L4.05 7.69l-.69-1.87a2.01 2.01 0 0 0-1.19-1.189L.3 3.94l1.87-.691c.55-.204.985-.638 1.189-1.189z"/></svg>',Gh='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M19 19h-1.486l-1.289-3.5h-5.85L8.989 19H7.501l4.957-12h1.586zm-8.13-4.7h4.76l-2.38-5.8z" clip-rule="evenodd"/><path d="M5.648.5c.414 0 .75.337.75.751v.95h4.35a.75.75 0 0 1 0 1.5H9.486c-.337 1.817-1.254 4.38-3.062 6.917.234.25.42.434.56.563a5 5 0 0 0 .293.253h.001a.75.75 0 0 1-.857 1.231H6.42l-.003-.002-.004-.003-.01-.008-.028-.02-.092-.072a7 7 0 0 1-.317-.278 12 12 0 0 1-.472-.463c-1.345 1.606-2.094 2.28-4.376 3.584a.75.75 0 0 1-.736-1.306c2.018-.997 2.852-1.878 4.11-3.42-.546-.738-.982-1.637-1.286-2.357a19 19 0 0 1-.563-1.516l-.008-.026-.002-.007-.001-.002-.019-.076A.75.75 0 0 1 4.04 6.26l.026.072.001.004.006.02.025.078.101.297c.09.255.22.61.388 1.005.233.553.525 1.152.852 1.67C6.86 7.313 7.63 5.146 7.953 3.7H.948a.75.75 0 0 1 0-1.5h3.95v-.949A.75.75 0 0 1 5.648.5m11.293 1.37c.204.55.638.984 1.189 1.188l1.869.692-1.87.691c-.55.204-.984.638-1.188 1.189L16.25 7.5l-.692-1.87a2.01 2.01 0 0 0-1.188-1.19l-1.87-.691 1.87-.692c.55-.204.985-.638 1.188-1.189L16.25 0z"/></svg>',Kh='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M.773 12.536a.75.75 0 0 1 .945.498l.018.051a9 9 0 0 0 .42.964c.317.62.799 1.397 1.473 2.072.701.7 1.38 1.191 1.88 1.505a8 8 0 0 0 .746.417l.037.016.005.003a.75.75 0 0 1-.522 1.404l-.072-.027-.01-.004-.018-.008-.058-.027a10 10 0 0 1-.905-.504 12.3 12.3 0 0 1-2.143-1.715c-.82-.82-1.388-1.744-1.748-2.451a10 10 0 0 1-.5-1.145l-.026-.075-.006-.021-.003-.007v-.003l-.001-.001L1 13.25l-.715.228a.75.75 0 0 1 .488-.942M13.314.953a.75.75 0 0 1 .913-.419l.072.028.009.004.018.007.059.028q.075.034.204.1c.172.09.413.223.701.404a12.3 12.3 0 0 1 2.143 1.715c.82.82 1.387 1.744 1.748 2.45a10 10 0 0 1 .499 1.145l.026.075.007.022.003.007v.003h.001c-.002.002-.043.015-.715.228l.715-.227a.751.751 0 0 1-1.43.455l-.004-.011-.017-.052a9 9 0 0 0-.42-.964c-.317-.619-.8-1.397-1.474-2.07a10.8 10.8 0 0 0-1.88-1.507 8 8 0 0 0-.746-.417l-.036-.015-.006-.003a.75.75 0 0 1-.39-.986M11.29 6.84a3.76 3.76 0 0 0 2.22 2.22L17 10.35l-3.49 1.292a3.76 3.76 0 0 0-2.219 2.22L10 17.35l-1.292-3.49a3.76 3.76 0 0 0-2.22-2.22L3 10.35l3.49-1.291A3.76 3.76 0 0 0 8.71 6.84L10 3.35zm6.009 8.66a.75.75 0 1 1 1.5 0 .75.75 0 0 1-1.5 0M14.8 18a.75.75 0 1 1 1.5 0 .75.75 0 0 1-1.5 0M3.798 2.001a.75.75 0 1 1 1.5 0 .75.75 0 0 1-1.5 0m-2.499 2.5a.75.75 0 1 1 1.5 0 .75.75 0 0 1-1.5 0"/></svg>',Jh='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M16.942 1.87c.203.55.637.985 1.188 1.189L20 3.75l-1.87.691a2.01 2.01 0 0 0-1.188 1.19L16.249 7.5l-.691-1.87a2.01 2.01 0 0 0-1.19-1.189L12.5 3.75l1.87-.691c.55-.204.985-.639 1.189-1.19L16.249 0zm2.03 5.43c.305 0 .58.192.671.483a7 7 0 0 1 .352 2.4 9 9 0 0 1-9.361 8.809 9 9 0 0 1-7.662-4.917L4.1 12.946A7.502 7.502 0 0 0 18.5 10c0-1.017-.1-1.266-.5-2.2-.097-.224.143-.5.387-.5z"/><path d="m11.5 9.999 3.195 3.196-1.06 1.06-3.536-3.536-.1-.112V5h1.5zM10.7 1q.168 0 .336.006a.703.703 0 0 1 .664.716c0 .451-.398.795-.849.785a7 7 0 0 0-.531.007c-1.015.052-1.71.309-2.623.756a7.5 7.5 0 0 0-4.17 6.125l.965-.737a.75.75 0 0 1 .979.057l.073.083a.75.75 0 0 1-.058.978l-.083.072-2.27 1.738a.75.75 0 0 1-.972-.052l-.074-.082-1.741-2.23a.75.75 0 0 1 1.107-1.005l.074.082.531.68a9 9 0 0 1 5.32-7.218C8.519 1.259 9.453 1 10.7 1"/></svg>',Qh='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m9.239 13.938-2.88-1.663a.75.75 0 0 1 .75-1.3L9 12.067V4.75a.75.75 0 1 1 1.5 0v7.318l1.89-1.093a.75.75 0 0 1 .75 1.3l-2.879 1.663a.75.75 0 0 1-.511.187.75.75 0 0 1-.511-.187M4.25 17a.75.75 0 1 1 0-1.5h10.5a.75.75 0 0 1 0 1.5z"/></svg>',Yh='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m2.286 4c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75m0-8c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75"/></svg>',Zh='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m0-8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75"/></svg>',Xh='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m0-8c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75"/></svg>',em='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M9.75 11.875a.75.75 0 0 1 .508.184l2.883 1.666a.75.75 0 0 1-.659 1.344l-.091-.044-1.892-1.093.001 4.318a.75.75 0 1 1-1.5 0v-4.317l-1.89 1.092a.75.75 0 0 1-.75-1.3l2.879-1.663a.75.75 0 0 1 .51-.187zM15.25 9a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.5zM9.75.375a.75.75 0 0 1 .75.75v4.318l1.89-1.093.092-.045a.75.75 0 0 1 .659 1.344l-2.883 1.667a.75.75 0 0 1-.508.184.75.75 0 0 1-.511-.187L6.359 5.65a.75.75 0 0 1 .75-1.299L9 5.442V1.125a.75.75 0 0 1 .75-.75"/></svg>',tm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M18 3.75a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75m0 8a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75m0 4a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75m0-8a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75"/></svg>',im='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m10.261 7.062 2.88 1.663a.75.75 0 0 1-.75 1.3L10.5 8.933v7.317a.75.75 0 1 1-1.5 0V8.932l-1.89 1.093a.75.75 0 0 1-.75-1.3l2.879-1.663a.75.75 0 0 1 .511-.187.75.75 0 0 1 .511.187M15.25 4a.75.75 0 1 1 0 1.5H4.75a.75.75 0 0 1 0-1.5z"/></svg>',nm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10 .75a9.25 9.25 0 1 1 0 18.5 9.25 9.25 0 0 1 0-18.5m0 1.5a7.75 7.75 0 1 0 0 15.5 7.75 7.75 0 0 0 0-15.5m0 2.022a.75.75 0 0 1 .743.649l.007.101v8.165l2.714-2.705a.75.75 0 0 1 .977-.07l.084.072a.75.75 0 0 1 .07.976l-.072.084-3.994 3.981a.75.75 0 0 1-.975.073l-.084-.073-3.99-3.98a.75.75 0 0 1 .975-1.135l.085.072 2.71 2.706V5.022a.75.75 0 0 1 .75-.75"/></svg>',sm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10 19.25a9.25 9.25 0 1 0 0-18.5 9.25 9.25 0 0 0 0 18.5m0-1.5a7.75 7.75 0 1 1 0-15.5 7.75 7.75 0 0 1 0 15.5m0-2.022a.75.75 0 0 0 .743-.649l.007-.101V6.813l2.714 2.705a.75.75 0 0 0 .977.07l.084-.072a.75.75 0 0 0 .07-.976l-.072-.084-3.994-3.981a.75.75 0 0 0-.975-.073l-.084.073-3.99 3.98a.75.75 0 0 0 .975 1.135l.085-.072 2.71-2.706v8.166c0 .414.336.75.75.75"/></svg>',om='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10.187 17H5.773q-.956 0-1.364-.415-.41-.416-.409-1.323V4.738q0-.926.419-1.332.418-.405 1.354-.406h4.68q1.035 0 1.793.124.76.124 1.36.478.512.296.906.75a3.26 3.26 0 0 1 .808 2.162q0 2.102-2.167 3.075 2.846.879 2.847 3.421a3.76 3.76 0 0 1-2.296 3.504 6 6 0 0 1-1.517.377q-.857.11-2 .11zm-.217-6.217H7v4.087h3.069q2.965 0 2.965-2.072 0-1.061-.768-1.537-.768-.478-2.296-.478M7 5.13v3.619h2.606q1.093 0 1.69-.2a1.6 1.6 0 0 0 .91-.765q.247-.4.247-.897 0-1.06-.778-1.409-.778-.348-2.375-.348z"/></svg>',rm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 16"><path d="M2 14.436V2a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v12.436a.5.5 0 0 1-.819.385l-3.862-3.2a.5.5 0 0 0-.638 0l-3.862 3.2A.5.5 0 0 1 2 14.436" class="ck-icon__fill"/></svg>',am='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M5.68 3.417a.24.24 0 0 0-.24.236v12.66l3.793-3.102a1.215 1.215 0 0 1 1.534 0l3.793 3.103V3.654a.24.24 0 0 0-.24-.237zM4 3.653C4 2.74 4.752 2 5.68 2h8.64c.928 0 1.68.74 1.68 1.653v13.164c0 1-1.185 1.547-1.967.908L10 14.426l-4.033 3.299c-.782.64-1.967.092-1.967-.908z" clip-rule="evenodd"/></svg>',lm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M4.4 2.24c-.11 0-.2.092-.2.207v11.077l3.16-2.714a.975.975 0 0 1 1.28 0l3.16 2.714V2.447a.203.203 0 0 0-.2-.207zM3 2.447C3 1.647 3.627 1 4.4 1h7.2c.773 0 1.4.648 1.4 1.447v11.518c0 .875-.988 1.354-1.64.794L8 11.873 4.64 14.76c-.652.56-1.64.081-1.64-.794z" clip-rule="evenodd"/></svg>',cm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14"><path d="M4.216 2.031a.503.503 0 0 0-.489.516v9.42l2.648-2.324a.94.94 0 0 1 1.25 0l2.648 2.324v-9.42a.503.503 0 0 0-.489-.516zm-1.466.516C2.75 1.693 3.406 1 4.216 1h5.568c.81 0 1.466.693 1.466 1.547v9.42c0 .873-.965 1.351-1.602.793L7 10.436 4.352 12.76c-.637.558-1.602.08-1.602-.793z" clip-rule="evenodd"/></svg>',um='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M3.95 4a.75.75 0 0 1 0 1.5H3a.5.5 0 0 0-.5.5v11a.5.5 0 0 0 .5.5h11a.5.5 0 0 0 .5-.5v-1.25a.75.75 0 0 1 1.5 0V17a2 2 0 0 1-2 2H3l-.204-.01A2 2 0 0 1 1 17V6a2 2 0 0 1 2-2z"/><path d="M17.483 3c.27 0 .529.107.72.296a1.007 1.007 0 0 1 0 1.429l-7.432 7.48a1 1 0 0 1-.758.294 1.02 1.02 0 0 1-.757-.295L6.31 9.381a1.01 1.01 0 0 1-.235-1.11 1 1 0 0 1 .556-.551 1.03 1.03 0 0 1 1.117.232l2.264 2.148 6.75-6.804c.191-.19.45-.296.72-.296"/></svg>',dm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M3.95 4a.75.75 0 0 1 0 1.5H3a.5.5 0 0 0-.5.5v11a.5.5 0 0 0 .5.5h11a.5.5 0 0 0 .5-.5v-1.25a.75.75 0 0 1 1.5 0V17a2 2 0 0 1-2 2H3l-.204-.01A2 2 0 0 1 1 17V6a2 2 0 0 1 2-2zm8.554-3a6.5 6.5 0 1 1 0 13 6.5 6.5 0 0 1 0-13m2.74 3.759a.81.81 0 0 0-1.148 0l-1.592 1.593-1.593-1.593a.812.812 0 1 0-1.148 1.15L11.355 7.5 9.763 9.092a.813.813 0 0 0 1.148 1.15l1.593-1.593 1.592 1.592a.812.812 0 1 0 1.148-1.15L13.652 7.5l1.592-1.592a.813.813 0 0 0 0-1.15"/><path d="M3.95 4a.75.75 0 0 1 0 1.5H3a.5.5 0 0 0-.5.5v11a.5.5 0 0 0 .5.5h11a.5.5 0 0 0 .5-.5v-1.25a.75.75 0 0 1 1.5 0V17a2 2 0 0 1-2 2H3l-.204-.01A2 2 0 0 1 1 17V6a2 2 0 0 1 2-2zm8.554-3a6.5 6.5 0 1 1 0 13 6.5 6.5 0 0 1 0-13m2.74 3.759a.81.81 0 0 0-1.148 0l-1.592 1.593-1.593-1.593a.812.812 0 1 0-1.148 1.15L11.355 7.5 9.763 9.092a.813.813 0 0 0 1.148 1.15l1.593-1.593 1.592 1.592a.812.812 0 1 0 1.148-1.15L13.652 7.5l1.592-1.592a.813.813 0 0 0 0-1.15Z"/></svg>',hm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M3.95 4a.75.75 0 0 1 0 1.5H3a.5.5 0 0 0-.5.5v11a.5.5 0 0 0 .5.5h11a.5.5 0 0 0 .5-.5v-1.25a.75.75 0 0 1 1.5 0V17a2 2 0 0 1-2 2H3l-.204-.01A2 2 0 0 1 1 17V6a2 2 0 0 1 2-2z"/><path d="m6.923 13.22.205-.305q-.389-.198-.436-.371-.048-.18.101-.733.124-.329.147-.521a4 4 0 0 0 0-.634q-.274-.816-.248-1.102.026-.288.416-.756L13.033.56q.708-1.194 2.8.158 2.09 1.354 1.561 2.35l-5.143 9.067q-.209.541-.46.685-.255.141-1.08.183-.335.11-.646.279a2.7 2.7 0 0 0-.46.41q-.384.348-.552.349-.126 0-.46-.2l-.27.359-1.401-.98zm-.244.364 1.379.965-.344.451H5.728z"/></svg>',mm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M17.5 9.303V8h-13v8.5h4.341c.191.54.457 1.044.785 1.5H2a1.5 1.5 0 0 1-1.5-1.5v-13A1.5 1.5 0 0 1 2 2h4.5a1.5 1.5 0 0 1 1.06.44L9.122 4H16a1.5 1.5 0 0 1 1.5 1.5v1A1.5 1.5 0 0 1 19 8v2.531a6 6 0 0 0-1.5-1.228M16 6.5v-1H8.5l-2-2H2v13h1V8a1.5 1.5 0 0 1 1.5-1.5z"/><path d="M14.5 19.5a5 5 0 1 1 0-10 5 5 0 0 1 0 10M15 14v-2h-1v2h-2v1h2v2h1v-2h2v-1z"/></svg>',gm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M11.91 18.255a.747.747 0 0 1 .663.746.747.747 0 0 1-.664.746l-.075.004H8.382a.745.745 0 0 1-.74-.75c0-.414.331-.75.74-.75h3.452z"/><path fill-rule="evenodd" d="M10.104 3.752c.807 0 1.59.193 2.415.548l.404.185c.913.452 1.62 1.026 2.129 1.77.578.848.852 1.85.95 2.991l.014.258c.031 1.26-.537 2.059-1.096 2.722-.562.665-1.05 1.151-1.322 1.935l-.053.161c-.204.698-.397 1.704-.504 2.314a1.34 1.34 0 0 1-1.308 1.114H8.476c-.65 0-1.196-.476-1.308-1.114a31 31 0 0 0-.354-1.743l-.15-.57c-.258-.882-.776-1.387-1.375-2.097-.596-.707-1.203-1.57-1.082-2.98l.045-.422c.126-.968.4-1.827.906-2.568.58-.851 1.422-1.478 2.533-1.956l.307-.126c.713-.274 1.401-.422 2.106-.422m0 1.5c-.492 0-1.001.102-1.582.325l-.254.104c-.927.398-1.513.87-1.894 1.43-.337.492-.551 1.106-.656 1.909l-.038.356c-.07.806.224 1.272.732 1.874.506.599 1.299 1.384 1.67 2.645l.084.307c.181.688.338 1.508.435 2.048h3.007c.112-.624.304-1.619.52-2.355l.075-.232c.394-1.127 1.12-1.852 1.594-2.413.476-.565.764-1.01.74-1.727l-.008-.147c-.084-.981-.308-1.702-.693-2.266-.334-.49-.824-.912-1.563-1.277l-.332-.152c-.688-.296-1.274-.43-1.837-.43" clip-rule="evenodd"/><path d="M3.597 13.637a.73.73 0 0 1 1.045 0 .76.76 0 0 1 0 1.06l-1.05 1.064-.056.052a.73.73 0 0 1-.99-.052.76.76 0 0 1-.05-1.004l.05-.057zm11.761 0a.73.73 0 0 1 1.045 0l1.05 1.063.05.057c.237.294.22.73-.05 1.004a.73.73 0 0 1-.99.052l-.055-.052-1.05-1.064a.76.76 0 0 1 0-1.06M2.472 8.257c.409 0 .74.336.74.75s-.331.75-.74.75L.99 9.756l-.075-.004a.746.746 0 0 1-.664-.746c0-.388.291-.708.664-.746l.075-.004zm16.614.003a.747.747 0 0 1 .664.746.746.746 0 0 1-.664.746l-.075.004h-1.483a.745.745 0 0 1-.74-.75c0-.413.331-.75.74-.75h1.483zM3.334 2.581c.27-.274.7-.29.99-.05l.055.05 1.048 1.065a.76.76 0 0 1 0 1.061.73.73 0 0 1-1.045 0L3.334 3.642l-.05-.057a.76.76 0 0 1 .05-1.004m12.343-.051a.73.73 0 0 1 .989.051.76.76 0 0 1 .05 1.004l-.05.057-1.048 1.065a.73.73 0 0 1-1.046 0 .76.76 0 0 1 0-1.06l1.049-1.066zM10.007.251c.383 0 .698.296.736.674l.003.076.001 1.505c0 .414-.33.75-.738.75a.745.745 0 0 1-.74-.75L9.268 1l.004-.076a.745.745 0 0 1 .735-.674"/></svg>',fm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75m-6 0C1 4.784 1.777 4 2.75 4c.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75C1.784 7.5 1 6.723 1 5.75m6 9c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75m-6 0c0-.966.777-1.75 1.75-1.75.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75-.966 0-1.75-.777-1.75-1.75"/></svg>',pm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m11.591 10.177 4.243 4.242a1 1 0 0 1-1.415 1.415l-4.242-4.243-4.243 4.243a1 1 0 0 1-1.414-1.415l4.243-4.242L4.52 5.934A1 1 0 0 1 5.934 4.52l4.243 4.243 4.242-4.243a1 1 0 1 1 1.415 1.414z"/></svg>',bm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 16h9a1 1 0 0 1 0 2H2a1 1 0 0 1 0-2"/><path fill-opacity=".6" d="M17 1a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2zm0 1.5H3a.5.5 0 0 0-.492.41L2.5 3v9a.5.5 0 0 0 .41.492L3 12.5h14a.5.5 0 0 0 .492-.41L17.5 12V3a.5.5 0 0 0-.41-.492z"/></svg>',wm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M5.789 3 0 17h1.664l1.664-4.027h6.797l.227.548c.046-.172.112-.352.209-.545.217-.436.556-.609.898-.798L7.664 3H5.79Zm.938 1.758 2.777 6.715H3.949zM15.956 7.5c-1.584-.02-3.226.824-3.843 2.882l1.495.106c.904-2.082 4.594-2.13 4.375.534-3.245 1.024-4.838.117-6.082 2.62-.208.418-.17 1.57.54 2.397s2.014 1.149 3.409.85 2.24-1.386 2.24-1.386L18.205 17h1.493l-.059-1.72-.056-5.274C19.51 8.612 17.75 7.524 15.956 7.5m2.027 4.696s.641 2.453-1.528 3.27c-3.376 1.269-4.188-2.141-1.775-2.638 1.704-.352 1.873-.25 3.303-.632"/></svg>',vm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M6.972 16.615a1 1 0 0 1-.744-.292l-4.596-4.596a1 1 0 1 1 1.414-1.414l3.926 3.926 9.937-9.937a1 1 0 0 1 1.414 1.415L7.717 16.323a1 1 0 0 1-.745.292"/></svg>',_m='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M16.435 5.506a.75.75 0 0 1 1.197.899l-.067.089-6.992 8a.75.75 0 0 1-1.05.078l-.079-.078-7.008-8a.75.75 0 0 1 1.049-1.066l.08.078 6.442 7.354z"/></svg>',ym='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M16.435 14.494a.75.75 0 0 0 1.197-.899l-.067-.089-6.992-8a.75.75 0 0 0-1.05-.078l-.079.078-7.008 8a.75.75 0 0 0 1.049 1.066l.08-.078 6.442-7.354z"/></svg>',km='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 21 21"><path d="M9.064 14.666a.75.75 0 1 1-1.06-1.06L11.01 10.6 8.004 7.595a.75.75 0 1 1 1.06-1.06l3.55 3.549a.748.748 0 0 1-.136 1.168z"/></svg>',Cm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M1.201 1C.538 1 0 1.47 0 2.1v14.363c0 .64.534 1.037 1.186 1.037H5.06l5.058-5.078L6.617 9.15a.696.696 0 0 0-.957-.033L1.5 13.6V2.5h15v4.354a3.5 3.5 0 0 1 1.5.049V2.1c0-.63-.547-1.1-1.2-1.1zm11.713 2.803a2.147 2.147 0 0 0-2.049 1.992 2.14 2.14 0 0 0 1.28 2.096 2.13 2.13 0 0 0 2.642-3.11 2.13 2.13 0 0 0-1.873-.978M8.089 17.635v2.388h2.389l7.046-7.046-2.39-2.39zm11.282-6.507a.64.64 0 0 0 .139-.692.6.6 0 0 0-.139-.205l-1.49-1.488a.63.63 0 0 0-.899 0l-1.166 1.163 2.39 2.39z"/></svg>',xm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m11.538 9.44 6.362 6.362a1.503 1.503 0 1 1-2.125 2.125L9.418 11.56l-6.365 6.365A1.5 1.5 0 1 1 .93 15.803L7.295 9.44.93 3.075A1.5 1.5 0 0 1 3.052.955L9.416 7.32 15.78.955a1.5 1.5 0 0 1 2.123 2.12z"/></svg>',Am='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M12.87 12.61a.75.75 0 0 1-.089.976l-.085.07-3.154 2.254 3.412 2.414a.75.75 0 0 1 .237.95l-.057.095a.75.75 0 0 1-.95.237l-.096-.058-4.272-3.022-.003-1.223 4.01-2.867a.75.75 0 0 1 1.047.174m2.795-.231.095.057 4.011 2.867-.003 1.223-4.272 3.022-.095.058a.75.75 0 0 1-.88-.151l-.07-.086-.058-.095a.75.75 0 0 1 .15-.88l.087-.07 3.412-2.414-3.154-2.253-.085-.071a.75.75 0 0 1 .862-1.207M16 0a2 2 0 0 1 2 2v9.354l-.663-.492-.837-.001V2a.5.5 0 0 0-.5-.5H2a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h3.118L7.156 19H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2zM5.009 15l.003 1H3v-1zm2.188-2-1.471 1H5v-1zM10 11v.095L8.668 12H7v-1zm4-2v1H7V9zm0-2v1H7V7zm-4-2v1H5V5zM6 3v1H3V3z"/></svg>',Em='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m12.5 5.7 5.2 3.9v1.3l-5.6 4c-.1.2-.3.2-.5.2-.3-.1-.6-.7-.6-1l.3-.4 4.7-3.5L11.5 7l-.2-.2c-.1-.3-.1-.6 0-.8.2-.2.5-.4.8-.4a.8.8 0 0 1 .4.1m-5.2 0L2 9.6v1.3l5.6 4c.1.2.3.2.5.2.3-.1.7-.7.6-1 0-.1 0-.3-.2-.4l-5-3.5L8.2 7l.2-.2c.1-.3.1-.6 0-.8-.2-.2-.5-.4-.8-.4a.8.8 0 0 0-.3.1"/></svg>',Tm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m11.333 2 .19 2.263a6 6 0 0 1 1.458.604L14.714 3.4 16.6 5.286l-1.467 1.733c.263.452.468.942.605 1.46L18 8.666v2.666l-2.263.19a6 6 0 0 1-.604 1.458l1.467 1.733-1.886 1.886-1.733-1.467a6 6 0 0 1-1.46.605L11.334 18H8.667l-.19-2.263a6 6 0 0 1-1.458-.604L5.286 16.6 3.4 14.714l1.467-1.733a6 6 0 0 1-.604-1.458L2 11.333V8.667l2.262-.189a6 6 0 0 1 .605-1.459L3.4 5.286 5.286 3.4l1.733 1.467a6 6 0 0 1 1.46-.605L8.666 2zM10 6.267a3.733 3.733 0 1 0 0 7.466 3.733 3.733 0 0 0 0-7.466"/></svg>',Sm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10.209 18.717A8.5 8.5 0 1 1 18.686 9.6h-.008l.002.12a3 3 0 0 1-2.866 2.997h-.268l-.046-.002v.002h-4.791a2 2 0 1 0 0 4 1 1 0 1 1-.128 1.992 9 9 0 0 1-.372.008m-3.918-7.01a1.25 1.25 0 1 0-2.415-.648 1.25 1.25 0 0 0 2.415.647ZM5.723 8.18a1.25 1.25 0 1 0 .647-2.414 1.25 1.25 0 0 0-.647 2.414M9.76 6.155a1.25 1.25 0 1 0 .647-2.415 1.25 1.25 0 0 0-.647 2.415m4.028 1.759a1.25 1.25 0 1 0 .647-2.415 1.25 1.25 0 0 0-.647 2.415"/></svg>',Im='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M16.935 5.328a2 2 0 0 1 0 2.829l-7.778 7.778a2 2 0 0 1-2.829 0L3.5 13.107a1.999 1.999 0 1 1 2.828-2.829l.707.707a1 1 0 0 0 1.414 0l5.658-5.657a2 2 0 0 1 2.828 0" class="ck-icon__fill"/><path d="M14.814 6.035 8.448 12.4a1 1 0 0 1-1.414 0l-1.413-1.415A1 1 0 1 0 4.207 12.4l2.829 2.829a1 1 0 0 0 1.414 0l7.778-7.778a1 1 0 1 0-1.414-1.415z"/></svg>',Pm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M14 3.5A3.5 3.5 0 0 1 17.5 7v6l-.005.192a3.5 3.5 0 0 1-2.927 3.262l-.062.008v1.813a1.5 1.5 0 0 1-2.193 1.33l-.37-.193-.38-.212a13.5 13.5 0 0 1-3.272-2.63l-.062-.07-4.729-.046a3.5 3.5 0 0 1-3.5-3.5v-6a3.5 3.5 0 0 1 3.5-3.5zM3.5 4.954a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2L8.924 15a11.9 11.9 0 0 0 3.71 3.081l.372.194v-3.268L12.962 15H14a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z" clip-rule="evenodd"/><path d="M16.5.5h-10a3.5 3.5 0 0 0-3.162 2h1.84A2 2 0 0 1 6.5 2h10a2 2 0 0 1 2 2v8.873a3.5 3.5 0 0 0 1.495-2.681L20 10V4A3.5 3.5 0 0 0 16.5.5"/><path d="M12.013 7.453a.75.75 0 0 1 .034 1.06l-3.75 4a.75.75 0 0 1-1.045.048l-2.25-2a.75.75 0 0 1 .996-1.122l1.704 1.515 3.25-3.467a.75.75 0 0 1 1.061-.034" clip-rule="evenodd"/></svg>',Vm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M15.5 6.5a3.5 3.5 0 0 1 3.495 3.308L19 10v2a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1h-7a1 1 0 0 1-1-1v-5a1 1 0 0 1 1-1v-2l.005-.192A3.5 3.5 0 0 1 15.5 6.5m0 7.5a.5.5 0 0 0-.492.41L15 14.5v2a.5.5 0 0 0 .992.09L16 16.5v-2a.5.5 0 0 0-.5-.5m0-6a2 2 0 0 0-2 2v2h4v-2a2 2 0 0 0-2-2m-9.25 8a.75.75 0 1 1 0 1.5H.75a.75.75 0 1 1 0-1.5zm0-5a.75.75 0 1 1 0 1.5H.75a.75.75 0 1 1 0-1.5zm3-5a.75.75 0 0 1 0 1.5H.75a.75.75 0 0 1 0-1.5zm6-5a.75.75 0 1 1 0 1.5H.75a.75.75 0 0 1 0-1.5z"/></svg>',Rm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M6.25 16a.75.75 0 1 1 0 1.5H.75a.75.75 0 1 1 0-1.5zm0-5a.75.75 0 1 1 0 1.5H.75a.75.75 0 1 1 0-1.5zm3-5a.75.75 0 0 1 0 1.5H.75a.75.75 0 0 1 0-1.5zm6-5a.75.75 0 1 1 0 1.5H.75a.75.75 0 0 1 0-1.5zm.25 5.5a3.5 3.5 0 0 1 3.143 1.959.75.75 0 0 1-1.36.636A2 2 0 0 0 13.5 10v2H19a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1h-7a1 1 0 0 1-1-1v-5a1 1 0 0 1 1-1v-2l.005-.192A3.5 3.5 0 0 1 15.5 6.5m0 7.5a.5.5 0 0 0-.492.41L15 14.5v2a.5.5 0 0 0 .992.09L16 16.5v-2a.5.5 0 0 0-.5-.5"/></svg>',Om='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M5 2.801a.7.7 0 0 0-.7.7v11.5a.8.8 0 0 1-1.6 0v-11.5a2.3 2.3 0 0 1 2.3-2.3h6.5a.8.8 0 0 1 0 1.6zm.7 3.7a2.3 2.3 0 0 1 2.3-2.3h7a2.3 2.3 0 0 1 2.3 2.3v10a2.3 2.3 0 0 1-2.3 2.3H8a2.3 2.3 0 0 1-2.3-2.3zm2.3-.7a.7.7 0 0 0-.7.7v10a.7.7 0 0 0 .7.7h7a.7.7 0 0 0 .7-.7v-10a.7.7 0 0 0-.7-.7z"/></svg>',Bm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M2.75 1.701a.95.95 0 0 1 .95-.95h7.61l5.94 5.94V18.3a.95.95 0 0 1-.95.95H3.7a.95.95 0 0 1-.95-.95zm1.5.55v15.5h11.5v-10H11.2a.95.95 0 0 1-.95-.95v-4.55zm7.5 1.06 2.94 2.94h-2.94z" clip-rule="evenodd"/></svg>',Lm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M1.95.001a.95.95 0 0 0-.95.95v16.6c0 .525.425.95.95.95h5.641c.415 0 .75-.313.75-.727 0-.415-.335-.773-.75-.773H2.5v-15.5h6v4.55c0 .525.425.95.95.95H14V8.24c0 .414.342.75.757.75a.744.744 0 0 0 .743-.75v-2.3L9.56.001zm10.99 5.5L10 2.561v2.94z"/><path d="M18.03 11.531a.75.75 0 0 0-1.06-1.06L12 15.44l-2.47-2.47a.75.75 0 0 0-1.06 1.06L12 17.56z"/></svg>',Mm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M1.95.001a.95.95 0 0 0-.95.95v16.6c0 .525.425.95.95.95h5.641c.415 0 .75-.32.75-.735a.763.763 0 0 0-.75-.765H2.5v-15.5h6v4.55c0 .525.425.95.95.95H14v1.25c0 .414.342.75.757.75a.744.744 0 0 0 .743-.75v-2.31L9.56 0zm10.99 5.5L10 2.561v2.94z"/><path d="M11.47 10.47a.75.75 0 0 1 1.06 0l2.97 2.97 2.97-2.97a.75.75 0 0 1 1.06 1.061l-2.97 2.97 2.97 2.97a.75.75 0 0 1-1.06 1.06l-2.97-2.97-2.97 2.97a.75.75 0 1 1-1.06-1.06l2.97-2.97-2.97-2.97a.75.75 0 0 1 0-1.06"/></svg>',Fm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><g fill-rule="evenodd" clip-rule="evenodd"><path d="M1 .95A.95.95 0 0 1 1.95 0h7.61l5.94 5.94v3.249A6 6 0 0 0 14 9V7H9.45a.95.95 0 0 1-.95-.95V1.5h-6V17h5.841c.191.54.457 1.044.785 1.5H1.95a.95.95 0 0 1-.95-.95zm9 1.61 2.94 2.94H10z"/><path d="M12.895 17.79c.805 0 1.553-.243 2.173-.661l2.653 2.653a.75.75 0 0 0 1.06-1.061l-2.652-2.653a3.895 3.895 0 1 0-3.233 1.722m0-1.6a2.295 2.295 0 1 1 0-4.59 2.295 2.295 0 0 1 0 4.59"/></g></svg>',Nm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.587 17.028a1.88 1.88 0 0 1-1.882-1.881V1.976A1.88 1.88 0 0 1 2.587.094H17.64a1.88 1.88 0 0 1 1.881 1.882v13.17a1.88 1.88 0 0 1-1.881 1.882zm5.645-1.41h9.408a.47.47 0 0 0 .47-.471V1.976a.47.47 0 0 0-.47-.47H8.232zM6.82 1.504H2.587a.47.47 0 0 0-.47.47v13.172a.47.47 0 0 0 .47.47H6.82z"/></svg>',Dm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M5 9.5a.5.5 0 0 0 .5-.5v-.5A.5.5 0 0 0 5 8H3.5a.5.5 0 0 0-.5.5V9a.5.5 0 0 0 .5.5zm.5 2.5a.5.5 0 0 1-.5.5H3.5A.5.5 0 0 1 3 12v-.5a.5.5 0 0 1 .5-.5H5a.5.5 0 0 1 .5.5zM5 6.5a.5.5 0 0 0 .5-.5v-.5A.5.5 0 0 0 5 5H3.5a.5.5 0 0 0-.5.5V6a.5.5 0 0 0 .5.5z"/><path d="M2 19a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2zm6-1.5h10a.5.5 0 0 0 .5-.5V3a.5.5 0 0 0-.5-.5H8zm-1.5-15H2a.5.5 0 0 0-.5.5v14a.5.5 0 0 0 .5.5h4.5z" clip-rule="evenodd"/></svg>',zm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M4 0v1H1v3H0V.5A.5.5 0 0 1 .5 0zm8 0h3.5a.5.5 0 0 1 .5.5V4h-1V1h-3zM4 16H.5a.5.5 0 0 1-.5-.5V12h1v3h3zm8 0v-1h3v-3h1v3.5a.5.5 0 0 1-.5.5z"/><path fill-opacity=".256" d="M1 1h14v14H1z"/><g class="ck-icon__selected-indicator"><path d="M7 0h2v1H7zM0 7h1v2H0zm15 0h1v2h-1zm-8 8h2v1H7z"/><path fill-opacity=".254" d="M1 1h14v14H1z"/></g></svg>',Hm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M5 3.25a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 0a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 0a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m-7 6.75a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 0a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/></svg>',qm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M5.972 3.115A.75.75 0 0 1 6.374 3c.14 0 .28.037.402.115l3.229 2.059 3.228-2.057a.75.75 0 0 1 .805 0l3.629 2.31h.002a.757.757 0 0 1 0 1.264h-.002L15.034 8.37l2.633 1.678h.002a.756.756 0 0 1 0 1.262h-.002l-3.63 2.312a1 1 0 0 1-.161.076c.234.08.409.275.482.5a.75.75 0 0 1-.322.854l-3.629 2.308a.75.75 0 0 1-.805 0l-3.63-2.31a.75.75 0 0 1-.229-1.031l.076-.122h.022a.75.75 0 0 1 .32-.189.8.8 0 0 1-.19-.086l-3.63-2.312a.756.756 0 0 1 0-1.264l2.632-1.678-2.632-1.676a.757.757 0 0 1 0-1.263zm2.64 2.946L6.374 4.635 4.136 6.06l2.238 1.423L8.612 6.06Zm7.262 0-2.236-1.426-2.239 1.426 2.237 1.423zm-3.637 2.306-2.232-1.422-2.233 1.422 2.235 1.422zm-3.625 2.31L6.374 9.253l-2.238 1.426 2.238 1.424 2.238-1.424Zm7.262 0-2.236-1.425-2.239 1.426 2.237 1.424 2.238-1.424Zm-2.64 2.944-3.23-2.056-3.228 2.056a.8.8 0 0 1-.185.084.7.7 0 0 1 .185.08l3.229 2.057 3.226-2.055a.8.8 0 0 1 .18-.084.8.8 0 0 1-.178-.082Z" clip-rule="evenodd"/></svg>',Um='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><path d="M.941 4.523a.75.75 0 1 1 1.06-1.06l3.006 3.005 3.005-3.005a.75.75 0 1 1 1.06 1.06l-3.549 3.55a.75.75 0 0 1-1.168-.136z"/></svg>',jm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M3 13.598v2.777h2.778l8.194-8.193-2.78-2.78L3 13.6zm13.12-7.566a.735.735 0 0 0 0-1.044l-1.734-1.73a.735.735 0 0 0-1.044 0L11.985 4.61l2.78 2.78 1.354-1.358z"/></svg>',$m='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M8.5 8.25a1.25 1.25 0 1 1-2.499.001A1.25 1.25 0 0 1 8.5 8.25m5.5 0a1.25 1.25 0 1 1-2.499.001A1.25 1.25 0 0 1 14 8.25m-6.873 3.838a.75.75 0 1 0-1.254.824C6.88 14.444 8.423 15.25 10 15.25c1.578 0 3.12-.805 4.127-2.338a.75.75 0 0 0-1.254-.824C12.13 13.221 11.048 13.75 10 13.75c-1.047 0-2.13-.529-2.873-1.662" clip-rule="evenodd"/><path d="M10 19a9 9 0 1 0 0-18 9 9 0 0 0 0 18m0-1.5a7.5 7.5 0 1 1 0-15 7.5 7.5 0 0 1 0 15"/></svg>',Wm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m8.636 9.531-2.758 3.94a.5.5 0 0 0 .122.696l3.224 2.284h1.314l2.636-3.736L8.636 9.53zm.288 8.451L5.14 15.396a2 2 0 0 1-.491-2.786l6.673-9.53a2 2 0 0 1 2.785-.49l3.742 2.62a2 2 0 0 1 .491 2.785l-7.269 10.053z"/><path d="M4 18h5.523v-1H4zm-2 0h1v-1H2z"/></svg>',Gm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M9.9 4.385a1.2 1.2 0 0 0-.44.44h.002l-5.284 9.15a1.2 1.2 0 0 0 1.04 1.8h10.564a1.2 1.2 0 0 0 1.04-1.8l-5.282-9.15a1.2 1.2 0 0 0-1.64-.44m.05 8.363a.3.3 0 0 1 .115-.023h.9a.3.3 0 0 1 .3.3v.9a.3.3 0 0 1-.3.3h-.9a.3.3 0 0 1-.3-.3v-.9a.3.3 0 0 1 .185-.277m-.185-4.723a.3.3 0 0 1 .3-.3h.9a.3.3 0 0 1 .3.3v3.4a.3.3 0 0 1-.3.3h-.9a.3.3 0 0 1-.3-.3z" clip-rule="evenodd"/></svg>',Km='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M19 4.5 14 0H3v6.5h1.5v-5h8v5h5V11H19zM14 2l3.3 3H14zm-1.548 16.5 1.25 1.5H3v-3h1.5v1.5zm7.374-1.657a.75.75 0 1 0-1.152-.96L17.5 17.29V13H16v4.29l-1.174-1.408a.75.75 0 1 0-1.152.96l2.346 2.816a.95.95 0 0 0 1.46 0z"/><path d="M1.63 14.24V12.3h.88c.66 0 1.14-.15 1.46-.45s.48-.71.48-1.24c0-.52-.15-.91-.44-1.2C3.7 9.15 3.28 9 2.69 9H0v5.24zm.4-3h-.4v-1.17h.46c.3 0 .5.05.62.17.1.11.16.25.16.42 0 .16-.06.3-.19.41s-.34.16-.66.16zm5.7 3c.28 0 .6-.05.96-.14.26-.07.5-.21.73-.42.22-.2.4-.47.53-.77.12-.31.19-.75.19-1.3 0-.37-.04-.7-.13-1.02a2.3 2.3 0 0 0-.42-.84c-.19-.24-.43-.43-.72-.56C8.57 9.06 8.2 9 7.72 9h-2.4v5.24zm-.4-1.19h-.4v-2.86h.4c.43 0 .73.1.91.3s.27.59.27 1.14c0 .42-.04.73-.12.91a.76.76 0 0 1-.34.4c-.14.07-.38.11-.72.11m5.3 1.2V12.1h2.02v-1.06h-2.03v-.91H15V9h-4v5.24h1.62z"/></svg>',Jm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M17.826 16.843a.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 0z"/><path d="m14 0 5 4.5v9.741a2.74 2.74 0 0 0-1.5-.617V6.5h-5v-5h-8v3H3V0zm0 2v3h3.3zM3 17.5h6.746q.15.331.391.623l.731.877H3z"/><path d="M8.5 6a1.5 1.5 0 0 1 1.493 1.356L10 7.5v7a1.5 1.5 0 0 1-1.356 1.493L8.5 16h-7a1.5 1.5 0 0 1-1.493-1.356L0 14.5v-7a1.5 1.5 0 0 1 1.356-1.493L1.5 6zM7.483 8.795l-.042.088-.986 2.534-.947-2.528-.043-.092a.601.601 0 0 0-1.042.008l-.042.093-.883 2.465-.937-2.475-.042-.089a.6.6 0 0 0-1.107.42l.027.093 1.514 4 .044.092a.6.6 0 0 0 1.041-.01l.041-.092.88-2.458.925 2.467.046.096a.6.6 0 0 0 1.032 0l.043-.09 1.554-4 .028-.093a.6.6 0 0 0-1.104-.43z"/></svg>',Qm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 6.002a4 4 0 1 1 0 8 4 4 0 0 1 0-8m1.2 1.2a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3" clip-rule="evenodd"/><path fill-rule="evenodd" d="M10.02 3.003c1.249.032 2.49.494 3.617 1.116 1.133.625 2.2 1.44 3.109 2.235a28.6 28.6 0 0 1 2.858 2.898l.171.204.046.054.012.016.004.004v.002a.8.8 0 0 1 .11.193l.02.05q.013.045.02.09l.01.054a.7.7 0 0 1 0 .146q-.002.032-.009.065l-.017.082-.024.061q-.014.038-.03.075l-.01.019a1 1 0 0 1-.06.093l-.002-.002h-.001l.002.003h-.001l-.004.005-.012.016-.046.058-.17.21a27.5 27.5 0 0 1-2.861 2.977c-.912.811-1.981 1.635-3.12 2.252-1.132.614-2.387 1.053-3.652 1.02-1.249-.031-2.49-.493-3.618-1.115-1.133-.626-2.199-1.44-3.108-2.235a28.6 28.6 0 0 1-3.029-3.102l-.045-.055-.012-.016-.004-.004-.001-.002a1 1 0 0 1-.065-.092l-.007-.015q-.025-.045-.041-.094l-.017-.042q-.014-.044-.02-.092-.007-.026-.01-.053Q0 10.042 0 10q-.002-.033 0-.065.004-.04.013-.079l.013-.06a1 1 0 0 1 .031-.084q.011-.03.025-.058l.012-.022a1 1 0 0 1 .06-.09h.001V9.54l.004-.005.012-.016.046-.057.17-.211a27.5 27.5 0 0 1 2.86-2.977c.911-.81 1.98-1.635 3.119-2.252 1.133-.614 2.388-1.052 3.652-1.02m-.04 1.499c-.902-.023-1.89.293-2.897.84-1.002.543-1.976 1.289-2.836 2.054a26 26 0 0 0-2.103 2.112l-.014.016a.695.695 0 0 0 .007.932 27 27 0 0 0 2.105 2.064c.861.753 1.838 1.495 2.846 2.051 1.013.56 2.014.906 2.931.93.903.022 1.89-.293 2.898-.84 1.002-.544 1.977-1.288 2.837-2.054a26 26 0 0 0 2.117-2.13.695.695 0 0 0-.008-.93 27 27 0 0 0-2.104-2.064c-.862-.753-1.839-1.495-2.847-2.052-1.014-.56-2.014-.906-2.932-.93" clip-rule="evenodd"/></svg>',Ym='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.97 2.97a.75.75 0 0 1 1.06 0L5.56 4.5q.397-.254.807-.477c1.133-.614 2.388-1.052 3.652-1.02 1.25.032 2.492.494 3.618 1.116 1.133.625 2.2 1.44 3.109 2.235a29 29 0 0 1 2.858 2.898q.112.13.171.204l.046.055.012.015.004.004v.002q.07.091.11.193l.02.05q.013.045.02.09l.01.054a1 1 0 0 1 0 .146q-.002.033-.009.065l-.017.082-.024.061q-.014.039-.03.075l-.01.019a1 1 0 0 1-.06.093l-.003-.002.002.003h-.002l-.003.006-.012.015-.046.058-.17.21a27.5 27.5 0 0 1-2.861 2.978q-.508.452-1.072.892l1.35 1.35a.75.75 0 0 1-1.02 1.098 1 1 0 0 0-.08-.097l-13-13-.043-.039a.75.75 0 0 1 .083-.961m1.27 4.432a26 26 0 0 0-2.096 2.106l-.014.016a.695.695 0 0 0 .007.932 27 27 0 0 0 2.105 2.064c.861.753 1.838 1.495 2.846 2.051 1.013.56 2.014.906 2.931.93.612.015 1.26-.128 1.93-.39l1.14 1.14c-.984.466-2.043.776-3.109.749-1.249-.032-2.491-.494-3.618-1.116-1.132-.626-2.199-1.44-3.108-2.235a28.6 28.6 0 0 1-3.029-3.102l-.045-.055-.012-.016-.004-.004-.001-.002a1 1 0 0 1-.065-.092l-.007-.015a1 1 0 0 1-.041-.094l-.017-.042q-.014-.045-.02-.091-.007-.027-.01-.054Q0 10.042 0 10v-.064q.004-.04.013-.079l.013-.06a1 1 0 0 1 .031-.084q.011-.03.025-.058l.012-.022a1 1 0 0 1 .06-.09h.001V9.54l.004-.005.012-.016.046-.057.17-.211a27.6 27.6 0 0 1 2.788-2.913zm6.522 6.523a4 4 0 0 1-.762.077 4 4 0 0 1-3.926-4.766zM9.98 4.502c-.902-.023-1.89.293-2.897.84q-.218.117-.434.248l1.103 1.102a4 4 0 0 1 5.557 5.557l1.3 1.3c.397-.301.782-.619 1.145-.942a26 26 0 0 0 2.117-2.13.696.696 0 0 0-.008-.93 27 27 0 0 0-2.104-2.064c-.861-.753-1.84-1.495-2.847-2.052-1.014-.559-2.014-.906-2.932-.93m1.22 2.7c-.809 0-1.466.64-1.497 1.441l1.555 1.555a1.5 1.5 0 0 0-.058-2.996"/></svg>',Zm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10.01 2C5.59 2 2 5.59 2 10.01a8.01 8.01 0 0 0 6.775 7.914.75.75 0 0 0 .598-.17.75.75 0 0 0 .262-.565v-5.02a.75.75 0 0 0-.22-.524.75.75 0 0 0-.526-.221H7.77v-.627h1.12a.75.75 0 0 0 .525-.22c.14-.14.22-.329.22-.526V8.324c0-.466.122-1.083.524-1.48.33-.326 1.017-.6 2.332-.43v.408c-.152.012-.305.017-.457.04-.335.048-.662.136-.943.326-.313.21-.497.505-.59.804s-.107.602-.107.88v1.18a.746.746 0 0 0 .744.746h1.158l-.098.63h-1.06a.744.744 0 0 0-.744.744v5.017a.75.75 0 0 0 .26.567q.123.105.28.148a.75.75 0 0 0 .319.022A8.012 8.012 0 0 0 10.01 2m0 1.486a6.52 6.52 0 0 1 6.521 6.524c0 2.945-1.973 5.386-4.65 6.197v-3.291h.951a.75.75 0 0 0 .736-.63l.332-2.12a.74.74 0 0 0-.17-.6.75.75 0 0 0-.564-.26h-1.285V8.87c0-.252.024-.384.039-.433q.003-.011.002-.016c.016-.011.104-.055.326-.088a7 7 0 0 1 .984-.05.75.75 0 0 0 .528-.218.74.74 0 0 0 .217-.527V5.76a.75.75 0 0 0-.586-.729c-2.04-.438-3.433-.083-4.278.75-.818.807-.968 1.884-.968 2.543v.983H7.027a.74.74 0 0 0-.525.22.74.74 0 0 0-.219.526v2.119c0 .197.08.386.219.525.14.14.328.221.525.221h1.118v3.291c-2.681-.809-4.659-3.25-4.659-6.197a6.523 6.523 0 0 1 6.524-6.526"/></svg>',Xm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M6.146 11.22a.75.75 0 0 1 1.061 0l3.677 3.678a.75.75 0 0 1-1.06 1.06l-2.397-2.396v5.689a.75.75 0 0 1-1.5 0v-5.69L3.53 15.959a.75.75 0 0 1-1.06-1.06z"/><path fill-rule="evenodd" d="M17.75 5.94v11.61a.95.95 0 0 1-.95.951h-6.3a.75.75 0 0 1 0-1.5h5.75v-10H11.7a.95.95 0 0 1-.95-.95V1.5h-6v8.66l-1.5 1.5V.95A.95.95 0 0 1 4.2 0h7.61zm-5.5-.439h2.94l-2.94-2.94z" clip-rule="evenodd"/></svg>',eg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m12.87 13.786 1.532-1.286 3.857 4.596a1 1 0 1 1-1.532 1.286z"/><path d="M16.004 8.5a6.5 6.5 0 0 1-9.216 5.905c-1.154-.53-.863-1.415-.663-1.615.194-.194.564-.592 1.635-.141a4.5 4.5 0 0 0 5.89-5.904l-.104-.227 1.332-1.331c.045-.046.196-.041.224.007a6.47 6.47 0 0 1 .902 3.306m-3.4-5.715c.562.305.742 1.106.354 1.494s-.995.414-1.476.178a4.5 4.5 0 0 0-6.086 5.882l.114.236-1.348 1.349c-.038.037-.17.022-.198-.023a6.5 6.5 0 0 1 5.54-9.9 6.5 6.5 0 0 1 3.1.784"/><path d="M4.001 11.93.948 8.877a.2.2 0 0 1 .141-.341h6.106a.2.2 0 0 1 .141.341L4.283 11.93a.2.2 0 0 1-.282 0m11.083-6.789 3.053 3.053a.2.2 0 0 1-.14.342H11.89a.2.2 0 0 1-.14-.342l3.052-3.053a.2.2 0 0 1 .282 0"/></svg>',tg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M4 2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2m8.38 9.262H7.62L10 5.506zm.532 1.285L14.34 16h1.426L10.804 4H9.196L4.234 16H5.66l1.428-3.453z"/></svg>',ig='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M12.4 10.3 10 4.5l-2.4 5.8zm.5 1.2H7.1L5.7 15H4.2l5-12h1.6l5 12h-1.5L13 11.5zm3.1 7H4a1 1 0 0 1 0-2h12a1 1 0 0 1 0 2"/></svg>',ng='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M11.03 3h6.149a.75.75 0 1 1 0 1.5h-5.514zm1.27 3h4.879a.75.75 0 1 1 0 1.5h-4.244zm1.27 3h3.609a.75.75 0 1 1 0 1.5h-2.973zm-2.754 2.5L8.038 4.785 5.261 11.5zm.62 1.5H4.641l-1.666 4.028H1.312l5.789-14h1.875l5.789 14h-1.663z"/></svg>',sg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M9.816 11.5 7.038 4.785 4.261 11.5zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663zm7.55 2.279.779-.779.707.707-2.265 2.265-2.193-2.265.707-.707.765.765V4.825q0-.063.002-.123l-.77.77-.707-.707L17.207 2.5l2.265 2.265-.707.707-.782-.782q.003.065.003.135z"/></svg>',og='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><path d="M19.832 7.469V1h-1.004q-.21.59-.778 1.03-.567.443-1.05.6v1.121a4.3 4.3 0 0 0 1.595-.936v4.654zM5.465 7.452q1.19 0 1.934.27t1.094.682q.35.405.49 1.029.08.387.08 1.398v2.021q0 2.115.095 2.68.105.556.404 1.07H7.916a3.1 3.1 0 0 1-.315-1.103q-.876.716-1.69 1.01a5 5 0 0 1-1.733.296q-1.531 0-2.355-.716-.822-.725-.823-1.846 0-.657.307-1.196.315-.547.814-.876a4 4 0 0 1 1.138-.497q.465-.118 1.4-.228 1.908-.219 2.81-.522.009-.312.009-.397 0-.926-.447-1.305-.603-.514-1.794-.514-1.111 0-1.646.379-.525.37-.779 1.322l-1.54-.202q.21-.953.69-1.533.483-.59 1.392-.902.911-.32 2.11-.32m7.048 1.034Q13.51 7.26 15.06 7.26q.858 0 1.62.343.77.334 1.26.952.5.61.78 1.475a6 6 0 0 1 .28 1.854q0 2.341-1.182 3.62t-2.837 1.278q-1.645 0-2.582-1.347v1.141h-1.461V4h1.575zm-5.044 3.625q-.858.337-2.573.574-.972.134-1.375.303a1.35 1.35 0 0 0-.622.497 1.24 1.24 0 0 0-.218.716q0 .606.472 1.01.482.405 1.4.405.912 0 1.62-.379.71-.387 1.043-1.052.253-.515.253-1.517zM14.92 8.53q-1.033 0-1.786.884-.753.875-.753 2.54 0 1.638.455 2.367.744 1.193 2.014 1.193 1.032 0 1.785-.875.753-.884.753-2.625 0-1.785-.727-2.634-.717-.85-1.741-.85"/></svg>',rg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M11.5 5.75a.75.75 0 0 1 0-1.5H15a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0V6.81l-2.72 2.72a.75.75 0 0 1-1.06-1.06l2.72-2.72zm-1.97 4.72a.75.75 0 0 1 0 1.06l-2.72 2.72H8.5a.75.75 0 0 1 0 1.5H5a.75.75 0 0 1-.75-.75v-3.5a.75.75 0 0 1 1.5 0v1.69l2.72-2.72a.75.75 0 0 1 1.06 0"/><path d="M2 0h16a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2m16 1.5H2a.5.5 0 0 0-.5.5v16a.5.5 0 0 0 .5.5h16a.5.5 0 0 0 .5-.5V2a.5.5 0 0 0-.5-.5"/></svg>',ag='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M15.53 5.53a.75.75 0 0 0-1.06-1.06l-2.72 2.72V5.5a.75.75 0 0 0-1.5 0V9a.75.75 0 0 0 .75.75h3.5a.75.75 0 0 0 0-1.5h-1.69zM5.5 10.25a.75.75 0 0 0 0 1.5h1.69l-2.72 2.72a.75.75 0 1 0 1.06 1.06l2.72-2.72v1.69a.75.75 0 0 0 1.5 0V11a.75.75 0 0 0-.75-.75z"/><path d="M0 2a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm18.5 0a.5.5 0 0 0-.5-.5H2a.5.5 0 0 0-.5.5v16a.5.5 0 0 0 .5.5h16a.5.5 0 0 0 .5-.5z"/></svg>',lg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M7.666 3a.74.74 0 0 0-.371.1.75.75 0 0 0-.275.267l-4.918 8.397a.74.74 0 0 0-.006.744l2.46 4.318a.75.75 0 0 0 .65.377h9.606a.75.75 0 0 0 .65-.377l2.46-4.318a.74.74 0 0 0 .002-.735l-4.688-8.392a.75.75 0 0 0-.654-.38H7.666Zm1.285 1.492h3.195l3.854 6.9h-3.1zm-1.293.742L9.223 7.97l-4.016 6.988-1.6-2.813zm2.424 4.237 1.098 1.922H8.977zM8.12 12.885h7.87l-1.61 2.825H6.494z"/></svg>',cg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M9.258 3.082c0-.594.486-1.082 1.08-1.082a4.38 4.38 0 0 1 4.239 5.489c-.18.688-.633 1.245-1.109 1.767h3.468c.595 0 1.082.488 1.082 1.082a4.382 4.382 0 0 1-5.49 4.24v-.001c-.689-.18-1.246-.633-1.768-1.109v3.468c0 .595-.487 1.082-1.082 1.082a4.38 4.38 0 0 1-4.111-2.866 4.4 4.4 0 0 1-.125-2.624c.18-.689.632-1.246 1.108-1.768H3.082A1.085 1.085 0 0 1 2 9.68a4.382 4.382 0 0 1 5.49-4.238c.69.18 1.246.632 1.768 1.108zm3.164 1.32c-.435-.46-1.043-.667-1.662-.767v5.49c.619-.1 1.227-.307 1.662-.766a2.875 2.875 0 0 0 0-3.958ZM7.21 6.918a2.88 2.88 0 0 0-2.93.789c-.396.423-.569.983-.658 1.55h5.56c-.045-.295-.091-.59-.224-.859a2.88 2.88 0 0 0-1.748-1.48m9.254 3.841h-5.653l.013.1c.012.098.025.197.053.292a2.873 2.873 0 0 0 4.862 1.158 3 3 0 0 0 .398-.54v-.001q.167-.294.263-.619c.026-.092.038-.188.05-.283zm-8.872 4.86c.437.459 1.045.666 1.665.766V10.89c-1.369.222-2.456 1.314-2.456 2.747 0 .738.283 1.447.791 1.981Z" clip-rule="evenodd"/></svg>',ug='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M19 9v10h-2v-8h-2V9zM4 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1H10a1 1 0 0 1-1-1V11H4v4.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1H3a1 1 0 0 1 1 1z"/></svg>',dg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M3 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V11H3v4.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1H2a1 1 0 0 1 1 1zm16.076 8.343V18.5h-6.252q.1-.94.61-1.78.507-.841 2.005-2.232 1.206-1.124 1.479-1.523.368-.552.368-1.092 0-.597-.32-.917-.321-.32-.886-.32-.559 0-.889.336t-.38 1.117l-1.778-.178q.159-1.473.997-2.114t2.095-.64q1.377 0 2.164.742t.787 1.847q0 .629-.225 1.197-.225.567-.714 1.19-.324.412-1.168 1.187-.845.774-1.07 1.028a3 3 0 0 0-.365.495z"/></svg>',hg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M3 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V11H3v4.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1H2a1 1 0 0 1 1 1zm9.989 7.53 1.726-.209q.082.66.445 1.01.36.348.876.349.552 0 .93-.42.377-.418.377-1.13 0-.672-.362-1.066a1.15 1.15 0 0 0-.882-.393q-.342 0-.819.133l.197-1.453q.723.019 1.105-.315.38-.333.38-.885 0-.47-.279-.75-.28-.278-.743-.278a1.07 1.07 0 0 0-.78.317q-.324.317-.394.927l-1.644-.28q.172-.844.517-1.348.347-.505.965-.794a3.24 3.24 0 0 1 1.387-.289q1.314 0 2.108.838.654.685.653 1.549 0 1.225-1.339 1.955.8.171 1.28.768.478.597.478 1.441 0 1.226-.895 2.088-.894.864-2.228.864-1.263 0-2.094-.727-.832-.727-.965-1.901z"/></svg>',mg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M3.5 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V11h-5v4.5a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1zm13.55 10v-1.873h-3.81v-1.561l4.037-5.91h1.498v5.904h1.156v1.567h-1.156V18.5zm0-3.44v-3.18l-2.14 3.18z"/></svg>',gg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M3.5 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V11h-5v4.5a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1zm9.578 7.607 1.777-.184q.076.603.45.955a1.223 1.223 0 0 0 1.81-.101q.387-.455.387-1.368 0-.857-.384-1.286-.384-.428-1-.428-.768 0-1.377.679l-1.448-.21.915-4.843h4.716v1.67H15.56l-.28 1.58a2.7 2.7 0 0 1 1.219-.298 2.68 2.68 0 0 1 2.012.863q.825.864.825 2.241a3.36 3.36 0 0 1-.666 2.05q-.907 1.232-2.52 1.232-1.29 0-2.101-.692-.813-.691-.971-1.86"/></svg>',fg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M3.5 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V11h-5v4.5a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1zm15.595 2.973-1.726.19q-.064-.532-.33-.787-.267-.253-.692-.253-.565 0-.956.507-.39.508-.492 2.114.667-.787 1.657-.787 1.117 0 1.914.85.797.852.797 2.197 0 1.428-.838 2.291-.838.864-2.152.864-1.41 0-2.317-1.095t-.908-3.59q0-2.558.946-3.688t2.457-1.13q1.059 0 1.755.594.694.593.885 1.723m-4.043 3.891q0 .87.4 1.343.398.473.914.473.495 0 .825-.388.33-.386.33-1.27 0-.906-.355-1.329a1.12 1.12 0 0 0-.89-.422q-.513 0-.869.403c-.356.403-.355.666-.355 1.19"/></svg>',pg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M11 1a9 9 0 1 1-8.027 13.075l1.128-1.129A7.502 7.502 0 0 0 18.5 10a7.5 7.5 0 1 0-14.962.759l-.745-.746-.76.76A9 9 0 0 1 11 1"/><path d="M.475 8.17a.75.75 0 0 1 .978.047l.075.082 1.284 1.643 1.681-1.284a.75.75 0 0 1 .978.057l.073.083a.75.75 0 0 1-.057.978l-.083.073-2.27 1.737a.75.75 0 0 1-.973-.052l-.074-.082-1.741-2.23a.75.75 0 0 1 .13-1.052zM11.5 5v4.999l3.196 3.196-1.06 1.06L10.1 10.72l-.1-.113V5z"/></svg>',bg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 9h16v2H2z"/></svg>',wg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M17 0a2 2 0 0 1 2 2v7a1 1 0 0 1 1 1v5a1 1 0 0 1-.883.993l-.118.006L19 17a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2l-.001-1.001-.116-.006A1 1 0 0 1 0 15v-5a1 1 0 0 1 .999-1L1 2a2 2 0 0 1 2-2zm.499 15.999h-15L2.5 17a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5zm-3.478-6.013-.014.014H14v.007l-1.525 1.525-1.46-1.46-.015.013V10h-1v5h1v-3.53l1.428 1.43.048.043.131-.129L14 11.421V15h1v-5h-.965zM2 10H1v5h1v-2h2v2h1v-5H4v2H2zm7 0H6v1h1v4h1v-4h1zm8 0h-1v5h3v-1h-2zm0-8.5H3a.5.5 0 0 0-.5.5l-.001 6.999h15L17.5 2a.5.5 0 0 0-.5-.5M10 7v1H4V7zm3-2v1H4V5zm-3-2v1H4V3z"/></svg>',vg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M1.201 1c-.662 0-1.2.47-1.2 1.1v14.248c0 .64.533 1.152 1.185 1.152h6.623v-7.236L6.617 9.15a.694.694 0 0 0-.957-.033L1.602 13.55V2.553l14.798.003V9.7H18V2.1c0-.63-.547-1.1-1.2-1.1zm11.723 2.805a2.1 2.1 0 0 0-1.621.832 2.127 2.127 0 0 0 1.136 3.357 2.13 2.13 0 0 0 2.611-1.506 2.13 2.13 0 0 0-.76-2.244 2.13 2.13 0 0 0-1.366-.44Z"/><path d="M19.898 12.369v6.187a.844.844 0 0 1-.844.844h-8.719a.844.844 0 0 1-.843-.844v-7.312a.844.844 0 0 1 .843-.844h2.531a.84.84 0 0 1 .597.248l.838.852h4.75c.223 0 .441.114.6.272a.84.84 0 0 1 .247.597m-1.52.654-4.377.02-1.1-1.143H11v6h7.4l-.023-4.877Z" clip-rule="evenodd"/></svg>',_g='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M6.66 9.118a.693.693 0 0 1 .956.032l3.65 3.411 2.422-2.238a.695.695 0 0 1 .945 0L17.5 13.6V2.5h-15v11.1zM17.8 1c.652 0 1.2.47 1.2 1.1v14.362c0 .64-.532 1.038-1.184 1.038H2.184C1.532 17.5 1 17.103 1 16.462V2.1C1 1.47 1.537 1 2.2 1zm-5.655 6a2.13 2.13 0 0 1 .157-2.364A2.133 2.133 0 1 1 12.145 7"/></svg>',yg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M1.201 1C.538 1 0 1.47 0 2.1v14.363c0 .64.534 1.037 1.186 1.037h9.494a3 3 0 0 1-.414-.287 3 3 0 0 1-1.055-2.03 3 3 0 0 1 .693-2.185l.383-.455-.02.018-3.65-3.41a.695.695 0 0 0-.957-.034L1.5 13.6V2.5h15v5.535a2.97 2.97 0 0 1 1.412.932l.088.105V2.1c0-.63-.547-1.1-1.2-1.1zm11.713 2.803a2.146 2.146 0 0 0-2.049 1.992 2.14 2.14 0 0 0 1.28 2.096 2.13 2.13 0 0 0 2.644-3.11 2.13 2.13 0 0 0-1.875-.978"/><path d="M15.522 19.1a.79.79 0 0 0 .79-.79v-5.373l2.059 2.455a.79.79 0 1 0 1.211-1.015l-3.352-3.995a.79.79 0 0 0-.995-.179.8.8 0 0 0-.299.221l-3.35 3.99a.79.79 0 1 0 1.21 1.017l1.936-2.306v5.185c0 .436.353.79.79.79"/><path d="M15.522 19.1a.79.79 0 0 0 .79-.79v-5.373l2.059 2.455a.79.79 0 1 0 1.211-1.015l-3.352-3.995a.79.79 0 0 0-.995-.179.8.8 0 0 0-.299.221l-3.35 3.99a.79.79 0 1 0 1.21 1.017l1.936-2.306v5.185c0 .436.353.79.79.79"/></svg>',kg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M1.201 1C.538 1 0 1.47 0 2.1v14.363c0 .64.534 1.037 1.186 1.037h7.029a5.4 5.4 0 0 1 .615-4.338l.762-1.232-2.975-2.78a.696.696 0 0 0-.957-.033L1.5 13.6V2.5h15v6.023q.675.195 1.307.573l.058.033q.068.042.135.086V2.1c0-.63-.547-1.1-1.2-1.1zm11.713 2.803a2.15 2.15 0 0 0-1.611.834 2.1 2.1 0 0 0-.438 1.158 2.14 2.14 0 0 0 1.277 2.096 2.132 2.132 0 0 0 2.645-3.11 2.13 2.13 0 0 0-1.873-.978"/><path d="M16.63 10.294a3.003 3.003 0 0 0-4.142.887l-.117.177a.65.65 0 0 0-.096.492.66.66 0 0 0 .278.418.7.7 0 0 0 .944-.234 1.74 1.74 0 0 1 2.478-.463 1.87 1.87 0 0 1 .476 2.55.64.64 0 0 0-.071.5.65.65 0 0 0 .309.396.627.627 0 0 0 .869-.19l.027-.041a3.226 3.226 0 0 0-.956-4.492Zm-6.061 3.78-.044.066a3.23 3.23 0 0 0 .82 4.403 3.005 3.005 0 0 0 4.275-.798l.13-.197a.63.63 0 0 0 .092-.475.64.64 0 0 0-.268-.402.713.713 0 0 0-.99.26l-.018.029a1.74 1.74 0 0 1-2.477.461 1.87 1.87 0 0 1-.475-2.55l.029-.047a.65.65 0 0 0 .086-.485.66.66 0 0 0-.275-.408l-.04-.027a.61.61 0 0 0-.845.17"/><path d="M15.312 13.925c.24-.36.154-.838-.19-1.067-.346-.23-.82-.124-1.059.236l-1.268 1.907c-.239.36-.153.838.192 1.067.345.23.818.123 1.057-.236z"/></svg>',Cg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M19 4.5 14 0H3v12.673l.868-1.041c.185-.222.4-.402.632-.54V1.5h8v5h5v7.626a2.24 2.24 0 0 1 1.5.822zM14 5V2l3.3 3zm-3.692 12.5q.093.157.213.303L11.52 19H8v-.876a2.24 2.24 0 0 0 1.82-.624zm7.518-.657a.75.75 0 0 0-1.152-.96L15.5 17.29V12H14v5.29l-1.174-1.408a.75.75 0 0 0-1.152.96l2.346 2.816a.95.95 0 0 0 1.46 0zm-15.056-.38a.75.75 0 0 1-.096-1.056l2.346-2.815a.95.95 0 0 1 1.46 0l2.346 2.815a.75.75 0 1 1-1.152.96L6.5 14.96V20H5v-5.04l-1.174 1.408a.75.75 0 0 1-1.056.096Z"/></svg>',xg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m14 0 5 4.5v8.892l-1.5-1.8V6.5h-5v-5h-8v3H3V0zm0 2v3h3.3zm-3.26 16a2.8 2.8 0 0 1-.469-.5H3V19h9.25v-.374A2.74 2.74 0 0 1 10.74 18"/><path d="M8.5 6a1.5 1.5 0 0 1 1.493 1.356L10 7.5v7a1.5 1.5 0 0 1-1.356 1.493L8.5 16h-7a1.5 1.5 0 0 1-1.493-1.356L0 14.5v-7a1.5 1.5 0 0 1 1.356-1.493L1.5 6zM7.483 8.795l-.042.088-.986 2.534-.947-2.528-.043-.092a.601.601 0 0 0-1.042.008l-.042.093-.883 2.465-.937-2.475-.042-.089a.6.6 0 0 0-1.107.42l.027.093 1.514 4 .044.092a.6.6 0 0 0 1.041-.01l.041-.092.88-2.458.925 2.467.046.096a.602.602 0 0 0 1.032 0l.043-.09 1.554-4 .028-.093a.6.6 0 0 0-1.104-.43zm4.191 6.612a.75.75 0 1 0 1.152.96L14 14.96V20h1.5v-5.04l1.174 1.408a.75.75 0 1 0 1.152-.96l-2.346-2.816a.95.95 0 0 0-1.46 0z"/></svg>',Ag='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75M2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5M1.632 6.95 5.02 9.358a.4.4 0 0 1-.013.661l-3.39 2.207A.4.4 0 0 1 1 11.892V7.275a.4.4 0 0 1 .632-.326z"/></svg>',Eg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10 8.251a.75.75 0 0 1 .75.75v5.5a.75.75 0 0 1-1.5 0v-5.5a.75.75 0 0 1 .75-.75m0-3.5a.75.75 0 0 1 .75.75v.5a.75.75 0 0 1-1.5 0v-.5a.75.75 0 0 1 .75-.75"/><path fill-rule="evenodd" d="M10 .751a9.25 9.25 0 1 1 0 18.5 9.25 9.25 0 0 1 0-18.5m0 1.5a7.75 7.75 0 1 0 0 15.5 7.75 7.75 0 0 0 0-15.5" clip-rule="evenodd"/></svg>',Tg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><circle cx="10" cy="9.8" r="1.5"/><path d="M13.25 2.75V2h.035a6 6 0 0 1 .363.014c.21.013.517.041.785.109.397.1.738.281 1.007.55s.429.587.524.907c.182.608.15 1.314.108 1.913l-.03.408c-.038.487-.073.93-.053 1.353.026.527.136.879.333 1.112.223.263.494.428.72.528a2 2 0 0 0 .335.117l.01.002.613.109v.628h-2.402a3.3 3.3 0 0 1-.42-.415c-.509-.601-.655-1.345-.687-2.009-.025-.527.02-1.094.059-1.592l.026-.347c.044-.621.044-1.067-.049-1.377a.63.63 0 0 0-.148-.276.64.64 0 0 0-.313-.157 3 3 0 0 0-.512-.066 6 6 0 0 0-.286-.01h-.016L13.25 3.5h-.75V2h.75z"/><path d="M13.25 16.75v.75h.035a7 7 0 0 0 .363-.014 4.6 4.6 0 0 0 .785-.109c.397-.1.738-.28 1.007-.55.268-.269.429-.587.524-.907.182-.608.15-1.314.108-1.912l-.03-.41c-.038-.486-.073-.93-.053-1.352.026-.527.136-.879.333-1.112.223-.263.494-.428.72-.528a2 2 0 0 1 .335-.117l.01-.002.613-.109V9.75h-2.402a3.3 3.3 0 0 0-.42.416c-.509.6-.655 1.344-.687 2.008-.025.527.02 1.095.059 1.592l.026.347c.044.621.044 1.067-.049 1.378a.63.63 0 0 1-.148.275.64.64 0 0 1-.313.157 3 3 0 0 1-.512.066 6 6 0 0 1-.286.01l-.016.001H12.5v1.5h.75zm-6.5-14V2h-.035a6 6 0 0 0-.363.014 4.6 4.6 0 0 0-.785.109 2.13 2.13 0 0 0-1.008.55 2.1 2.1 0 0 0-.524.907c-.181.608-.15 1.314-.108 1.913l.031.408c.038.487.073.93.052 1.353-.025.527-.136.879-.333 1.112a2 2 0 0 1-.718.528 2 2 0 0 1-.337.117l-.01.002L2 9.122v.628h2.402a3.3 3.3 0 0 0 .42-.415c.509-.601.654-1.345.686-2.009.026-.527-.019-1.094-.058-1.592q-.015-.18-.026-.347c-.044-.621-.044-1.067.048-1.377a.63.63 0 0 1 .149-.276.64.64 0 0 1 .312-.157c.13-.032.323-.054.513-.066a6 6 0 0 1 .286-.01h.015L6.75 3.5h.75V2h-.75zm0 14v.75h-.035a7 7 0 0 1-.363-.014 4.6 4.6 0 0 1-.785-.109 2.13 2.13 0 0 1-1.008-.55 2.1 2.1 0 0 1-.524-.907c-.181-.608-.15-1.314-.108-1.912l.031-.41c.038-.486.073-.93.052-1.352-.025-.527-.136-.879-.333-1.112a2 2 0 0 0-.718-.528 2 2 0 0 0-.337-.117l-.01-.002L2 10.378V9.75h2.402q.218.178.42.416c.509.6.654 1.344.686 2.008.026.527-.019 1.095-.058 1.592q-.015.18-.026.347c-.044.621-.044 1.067.048 1.378a.63.63 0 0 0 .149.275.64.64 0 0 0 .312.157c.13.032.323.054.513.066a6 6 0 0 0 .286.01l.015.001H7.5v1.5h-.75z"/></svg>',Sg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m9.586 14.633.021.004q-.054.502.393.962.123.125.274.201h1.474a.6.6 0 1 1 0 1.2H5.304a.6.6 0 0 1 0-1.2h1.15q.711-.106 1.005-.334.235-.182.404-.597l2.416-9.55a1.05 1.05 0 0 0-.281-.823 1.1 1.1 0 0 0-.442-.296H8.15a.6.6 0 0 1 0-1.2h6.443a.6.6 0 1 1 0 1.2h-1.195q-.564.084-.823.296-.323.263-.623.79z"/></svg>',Ig='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><path fill-opacity=".16" d="M35 20a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-8a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H15.5a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1z"/><path d="M8.508 9.561q.567-.44.778-1.03h1.004V15H9.053v-4.654a4.3 4.3 0 0 1-1.595.936v-1.121q.483-.158 1.05-.6m4.525 4.204V15h-1.235v-1.235zm1.299 10.204v-6.47h-1.004q-.21.59-.778 1.03-.567.444-1.05.6v1.122a4.3 4.3 0 0 0 1.595-.936v4.654zm2.743 0v-1.235H15.84v1.235zm4.099 0v-6.47H20.17q-.21.59-.778 1.03-.567.444-1.05.6v1.122a4.3 4.3 0 0 0 1.595-.936v4.654zm2.743 0v-1.235h-1.235v1.235zM19.032 27.5v6.469h-1.237v-4.654a4.3 4.3 0 0 1-1.595.936V29.13q.483-.158 1.05-.6.568-.44.778-1.03zm2.743 5.234v1.235H20.54v-1.235zm4.357 1.335v-6.47h-1.004q-.21.59-.778 1.03-.567.444-1.05.6v1.122a4.3 4.3 0 0 0 1.595-.936v4.654zm2.743 0v-1.235H27.64v1.235zm4.357 0v-6.47h-1.004q-.21.59-.778 1.03-.567.444-1.05.6v1.122a4.3 4.3 0 0 0 1.595-.936v4.654zm2.743 0v-1.235H34.74v1.235z"/></svg>',Pg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m17.975 15.279.779-.779.707.707-2.265 2.265-2.193-2.265.707-.707.765.765V4.825q0-.063.002-.123l-.77.77L15 4.765 17.196 2.5l2.265 2.265-.707.707-.782-.782q.003.065.003.135zM1 15.75c0 .414.273.75.61.75h8.067a.56.56 0 0 0 .43-.22.85.85 0 0 0 .18-.53.85.85 0 0 0-.18-.53.56.56 0 0 0-.43-.22H1.609a.56.56 0 0 0-.43.22.85.85 0 0 0-.179.53m0-12c0 .414.273.75.61.75h11.78a.56.56 0 0 0 .431-.22.85.85 0 0 0 .179-.53.85.85 0 0 0-.178-.53.56.56 0 0 0-.431-.22H1.609a.56.56 0 0 0-.43.22.85.85 0 0 0-.179.53m0 4c0 .414.273.75.61.75h11.78a.56.56 0 0 0 .431-.22.85.85 0 0 0 .179-.53.85.85 0 0 0-.178-.53.56.56 0 0 0-.431-.22H1.609a.56.56 0 0 0-.43.22.85.85 0 0 0-.179.53m0 4c0 .414.273.75.61.75h11.78a.56.56 0 0 0 .431-.22.85.85 0 0 0 .179-.53.85.85 0 0 0-.178-.53.56.56 0 0 0-.431-.22H1.609a.56.56 0 0 0-.43.22.85.85 0 0 0-.179.53"/></svg>',Vg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.8.8 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.7.7 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294zm5.494-5.335a.8.8 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.8.8 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955m-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184"/></svg>',Rg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><path fill-opacity=".163" d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1z"/><path d="M11 27a3 3 0 1 1 0 6 3 3 0 0 1 0-6m0 1a2 2 0 1 0 0 4 2 2 0 0 0 0-4m0-10a3 3 0 1 1 0 6 3 3 0 0 1 0-6m0 1a2 2 0 1 0 0 4 2 2 0 0 0 0-4m0-10a3 3 0 1 1 0 6 3 3 0 0 1 0-6m0 1a2 2 0 1 0 0 4 2 2 0 0 0 0-4"/></svg>',Og='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><path fill-opacity=".163" d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1z"/><path d="M5.714 15.11q.935 0 1.46-.66.632-.799.632-2.627 0-1.832-.629-2.624-.527-.668-1.463-.668t-1.459.66q-.633.8-.633 2.619 0 1.854.576 2.577.577.723 1.516.723m0-1.024a.6.6 0 0 1-.398-.14q-.173-.141-.287-.565-.115-.424-.115-1.558c0-1.134.043-1.294.128-1.613q.096-.37.272-.512a.62.62 0 0 1 .4-.143.6.6 0 0 1 .398.143q.173.143.288.567t.114 1.558c0 1.134-.043 1.292-.128 1.608q-.096.37-.272.512a.62.62 0 0 1-.4.143m6.078.914V8.531H10.79q-.21.59-.778 1.03-.567.442-1.05.6v1.121a4.3 4.3 0 0 0 1.595-.936V15zm3.344 0v-1.235h-1.235V15zm-9.422 9.11q.935 0 1.46-.66.632-.799.632-2.627 0-1.833-.629-2.624-.527-.668-1.463-.668t-1.459.66q-.633.8-.633 2.619 0 1.854.576 2.577.577.723 1.516.723m0-1.024a.6.6 0 0 1-.398-.14q-.173-.142-.287-.565-.115-.424-.115-1.558c0-1.134.043-1.294.128-1.613q.096-.37.272-.512a.62.62 0 0 1 .4-.143.6.6 0 0 1 .398.143q.173.142.288.567t.114 1.558c0 1.134-.043 1.292-.128 1.608q-.096.37-.272.512a.62.62 0 0 1-.4.143m7.088.914v-1.147H10.35q.097-.167.253-.343.155-.175.74-.712t.81-.821q.338-.431.493-.824.156-.394.156-.829 0-.765-.544-1.279-.546-.514-1.499-.514-.87 0-1.45.444t-.69 1.463l1.23.124q.036-.54.264-.774t.615-.233q.391 0 .613.222t.222.635q0 .374-.255.756-.189.277-1.024 1.055-1.037.962-1.388 1.544-.352.583-.422 1.233zm2.334 0v-1.235h-1.235V24zM5.714 34.11q.935 0 1.46-.66.632-.799.632-2.627 0-1.832-.629-2.624-.527-.668-1.463-.668t-1.459.66q-.633.8-.633 2.619 0 1.854.576 2.577.577.723 1.516.723m0-1.024a.6.6 0 0 1-.398-.14q-.173-.142-.287-.565-.115-.424-.115-1.558c0-1.134.043-1.294.128-1.613q.096-.37.272-.512a.62.62 0 0 1 .4-.143.6.6 0 0 1 .398.143q.173.142.288.567t.114 1.558c0 1.134-.043 1.292-.128 1.608q-.096.37-.272.512a.62.62 0 0 1-.4.143m4.992 1.024q.924 0 1.543-.598.62-.597.62-1.446 0-.585-.332-.997a1.5 1.5 0 0 0-.886-.532q.927-.505.927-1.353 0-.598-.452-1.073-.55-.58-1.46-.58a2.25 2.25 0 0 0-.96.2 1.6 1.6 0 0 0-.667.55q-.24.349-.359.933l1.139.194q.048-.422.272-.642t.54-.22q.321 0 .515.194c.194.194.193.302.193.518q0 .383-.264.613-.263.231-.764.218l-.136 1.006q.33-.092.566-.092.36 0 .611.272.25.273.25.739 0 .492-.26.782a.83.83 0 0 1-.644.29.84.84 0 0 1-.607-.242q-.25-.241-.308-.698l-1.195.145q.093.813.668 1.316t1.45.503m4.43-.11v-1.235h-1.235V34z"/></svg>',Bg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><path fill-opacity=".163" d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1z"/><path d="M10.29 15V8.531H9.286q-.21.59-.778 1.03-.567.442-1.05.6v1.121a4.3 4.3 0 0 0 1.595-.936V15h1.235zm3.343 0v-1.235h-1.235V15zM11.3 24v-1.147H8.848q.096-.167.252-.343.156-.175.74-.712.585-.536.81-.821.338-.431.494-.824.156-.394.156-.829 0-.765-.545-1.279t-1.499-.514q-.87 0-1.45.444t-.69 1.463l1.23.124q.036-.54.264-.774.23-.233.616-.233.39 0 .613.222t.222.635q0 .374-.255.756-.19.277-1.024 1.055-1.038.962-1.389 1.544T6.971 24zm2.333 0v-1.235h-1.235V24zM9.204 34.11q.922 0 1.542-.598.62-.597.62-1.446 0-.585-.332-.997a1.5 1.5 0 0 0-.886-.532q.928-.505.928-1.353 0-.598-.453-1.073-.549-.58-1.459-.58a2.25 2.25 0 0 0-.96.2 1.6 1.6 0 0 0-.668.55q-.24.349-.358.933l1.138.194q.048-.422.272-.642t.54-.22q.322 0 .515.194c.193.194.193.302.193.518q0 .383-.263.613-.263.231-.765.218l-.136 1.006q.33-.092.567-.092.36 0 .61.272.251.273.251.739 0 .492-.261.782a.83.83 0 0 1-.644.29.84.84 0 0 1-.607-.242q-.251-.241-.307-.698l-1.196.145q.093.813.668 1.316t1.45.503zm4.43-.11v-1.235h-1.236V34h1.235z"/></svg>',Lg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><path fill-opacity=".163" d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1z"/><path d="M11 27a3 3 0 1 1 0 6 3 3 0 0 1 0-6m0-9a3 3 0 1 1 0 6 3 3 0 0 1 0-6m0-9a3 3 0 1 1 0 6 3 3 0 0 1 0-6"/></svg>',Mg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><path fill-opacity=".163" d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1z"/><path d="M9.62 14.105q.408 0 .768-.153c.36-.153.466-.257.677-.462q.013.036.044.145.07.242.119.365h1.221a2.7 2.7 0 0 1-.222-.626q-.06-.293-.059-.908l.013-1.441q0-.804-.165-1.105-.165-.302-.569-.497-.405-.195-1.23-.195-.91 0-1.371.325-.462.325-.65 1.002l1.12.202q.114-.326.299-.455.184-.13.514-.13.488 0 .663.152.176.151.176.508v.123q-.333.14-1.2.303-.641.123-.982.288t-.53.474a1.33 1.33 0 0 0-.188.706q0 .598.415.988.416.391 1.136.391zm.368-.87a.68.68 0 0 1-.492-.189.6.6 0 0 1-.193-.448q0-.263.241-.435.159-.105.673-.215a7 7 0 0 0 .751-.19v.247q0 .443-.048.602a.77.77 0 0 1-.295.409 1.07 1.07 0 0 1-.637.22zm4.645.765v-1.235h-1.235V14zM10.2 25.105q.813 0 1.382-.646.57-.645.57-1.84 0-1.156-.559-1.774a1.82 1.82 0 0 0-1.41-.617q-.783 0-1.354.65v-2.32H7.594V25h1.147v-.686a1.9 1.9 0 0 0 .67.592q.39.2.79.2zm-.299-.975q-.531 0-.852-.492-.23-.348-.229-1.073 0-.703.295-1.048a.93.93 0 0 1 .738-.345q.453 0 .743.354t.29 1.154q0 .751-.288 1.1t-.697.35m4.478.87v-1.235h-1.234V25zm-4.017 9.105q.9 0 1.437-.426.536-.426.725-1.261l-1.213-.207q-.092.489-.316.688a.83.83 0 0 1-.576.2.92.92 0 0 1-.75-.343q-.278-.343-.278-1.173 0-.747.274-1.066.275-.318.736-.318.348 0 .565.184t.28.55l1.216-.22q-.22-.751-.722-1.119-.504-.366-1.356-.366-1.042 0-1.653.643-.61.645-.61 1.8 0 1.143.608 1.788.609.646 1.633.646M14.633 34v-1.235h-1.235V34z"/></svg>',Fg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><path fill-opacity=".163" d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1z"/><path d="M11.88 8.7V7.558h-1.234V8.7zm0 5.3V9.333h-1.234V14zm2.5 0v-1.235h-1.234V14zm-4.75 4.7v-1.142H8.395V18.7zm0 5.3v-4.667H8.395V24zm2.5-5.3v-1.142h-1.234V18.7zm0 5.3v-4.667h-1.234V24zm2.501 0v-1.235h-1.235V24zM7.38 28.7v-1.142H6.145V28.7zm0 5.3v-4.667H6.145V34zm2.5-5.3v-1.142H8.646V28.7zm0 5.3v-4.667H8.646V34zm2.5-5.3v-1.142h-1.234V28.7zm0 5.3v-4.667h-1.234V34zm2.501 0v-1.235h-1.235V34z"/></svg>',Ng='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><path fill-opacity=".163" d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1z"/><path d="M14 27v6H8v-6zm0-9v6H8v-6zm0-9v6H8V9z"/></svg>',Dg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><path fill-opacity=".163" d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1z"/><path d="m7.88 15 .532-1.463h2.575L11.549 15h1.415l-2.58-6.442H9.01L6.5 15zm2.69-2.549H8.811l.87-2.39.887 2.39zM14.88 15v-1.235h-1.234V15zM9.352 25q1.244-.009 1.569-.044.518-.057.872-.305.354-.249.558-.664t.205-.855q0-.558-.317-.97-.315-.414-.905-.585a1.5 1.5 0 0 0 .661-.567 1.5 1.5 0 0 0 .244-.83q0-.419-.197-.754a1.65 1.65 0 0 0-.495-.539 1.7 1.7 0 0 0-.672-.266q-.375-.063-1.14-.063H7.158V25zm.142-3.88H8.46v-1.49h.747q.918 0 1.112.022.325.04.49.226.165.188.165.486a.68.68 0 0 1-.192.503.86.86 0 0 1-.525.23 12 12 0 0 1-.944.023h.18zm.17 2.795H8.46v-1.723h1.05q.888 0 1.154.092.266.093.406.295a.84.84 0 0 1 .14.492q0 .342-.181.547a.8.8 0 0 1-.473.257q-.189.04-.892.04M14.88 25v-1.235h-1.234V25zm-5.018 9.11q1.037 0 1.711-.512t.965-1.567l-1.261-.4q-.163.708-.536 1.037-.375.33-.892.33-.704 0-1.143-.519-.44-.518-.44-1.74 0-1.15.447-1.665.445-.514 1.162-.514.52 0 .881.29.362.29.477.79l1.288-.307q-.22-.774-.66-1.187-.738-.698-1.92-.698-1.353 0-2.184.89-.83.89-.83 2.498 0 1.521.825 2.397.826.877 2.11.877M14.88 34v-1.235h-1.234V34z"/></svg>',zg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><path fill-opacity=".163" d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1z"/><path d="M11.916 15V8.558h-1.301V15zm2.465 0v-1.235h-1.235V15zM9.665 25v-6.442h-1.3V25zm2.5 0v-6.442h-1.3V25zm2.466 0v-1.235h-1.235V25zm-7.216 9v-6.442h-1.3V34zm2.5 0v-6.442h-1.3V34zm2.501 0v-6.442h-1.3V34zm2.465 0v-1.235h-1.235V34z"/></svg>',Hg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44 44"><path fill-opacity=".163" d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1z"/><path d="M14.88 15v-1.235h-1.234V15zm0 10v-1.235h-1.234V25zm0 9v-1.235h-1.234V34z"/><text x="9" y="15" font-family="sans-serif" font-size="8" font-weight="bold" text-anchor="middle">١</text><text x="9" y="25" font-family="sans-serif" font-size="8" font-weight="bold" text-anchor="middle">٢</text><text x="9" y="34" font-family="sans-serif" font-size="8" font-weight="bold" text-anchor="middle">٣</text></svg>',qg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M4.2 3c-.584 0-1.145.23-1.557.643A2.2 2.2 0 0 0 2 5.199v8.719a2.194 2.194 0 0 0 2.2 2.195h11.624a2.194 2.194 0 0 0 2.196-2.195V7.621a2.194 2.194 0 0 0-2.195-2.2h-5.393l-1.237-2.06A.75.75 0 0 0 8.56 3zm0 1.488h3.935l1.236 2.06a.75.75 0 0 0 .64.362h5.813a.71.71 0 0 1 .707.71v6.298a.707.707 0 0 1-.707.707H4.2a.71.71 0 0 1-.71-.707V5.199a.71.71 0 0 1 .71-.71Z"/></svg>',Ug='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m12.68 13.74 4.209 4.208a1 1 0 1 0 1.414-1.414l-4.267-4.268a6 6 0 1 0-1.355 1.474M13 9a4 4 0 1 1-8 0 4 4 0 0 1 8 0"/></svg>',jg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M5.085 6.22 2.943 4.078a.75.75 0 1 1 1.06-1.06l2.592 2.59A11.1 11.1 0 0 1 10 5.068c4.738 0 8.578 3.101 8.578 5.083 0 1.197-1.401 2.803-3.555 3.887l1.714 1.713a.75.75 0 0 1-.09 1.138.5.5 0 0 1-.15.084.75.75 0 0 1-.821-.16L6.17 7.304q-.387.166-.757.365l6.239 6.24-.006.005.78.78q-.582.141-1.174.215l-1.11-1.11h.011L4.55 8.197a7 7 0 0 0-.665.514l-.112.098 4.897 4.897-.005.006 1.276 1.276a10 10 0 0 1-1.477-.117l-.479-.479-.009.009-4.863-4.863-.022.031a3 3 0 0 0-.124.2q-.065.116-.108.241a.5.5 0 0 0-.028.133.3.3 0 0 0 .008.072 1 1 0 0 0 .082.226q.1.2.234.379l3.242 3.365.025.01.59.623c-3.265-.918-5.59-3.155-5.59-4.668 0-1.194 1.448-2.838 3.663-3.93m7.07.531a4.63 4.63 0 0 1 1.108 5.992l.345.344.046-.018a9.3 9.3 0 0 0 2-1.112q.385-.281.727-.613.207-.2.392-.431.109-.135.203-.286.086-.14.148-.292a1 1 0 0 0 .036-.12.3.3 0 0 0 .008-.072.5.5 0 0 0-.028-.133 1 1 0 0 0-.036-.096 2 2 0 0 0-.071-.145 3 3 0 0 0-.125-.2 4 4 0 0 0-.263-.335 5.4 5.4 0 0 0-.53-.523 8 8 0 0 0-1.054-.768 9.8 9.8 0 0 0-1.879-.891q-.506-.178-1.027-.301m-2.85.21-.069.002a.5.5 0 0 0-.254.097.496.496 0 0 0-.104.679.5.5 0 0 0 .326.199l.045.005c.091.003.181.003.272.012a2.45 2.45 0 0 1 2.017 1.513c.024.061.043.125.069.185a.49.49 0 0 0 .45.287h.008a.5.5 0 0 0 .35-.158.48.48 0 0 0 .13-.335.6.6 0 0 0-.048-.219 3.4 3.4 0 0 0-.36-.723 3.44 3.44 0 0 0-2.791-1.543l-.028-.001z"/></svg>',$g='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M15.346 9.422a.151.151 0 0 1 .284 0l.548 1.484a.15.15 0 0 0 .09.089l1.483.549a.151.151 0 0 1 0 .284l-1.483.548a.15.15 0 0 0-.09.09l-.548 1.483a.15.15 0 0 1-.142.1.15.15 0 0 1-.142-.1l-.549-1.483a.15.15 0 0 0-.09-.09l-1.483-.548a.15.15 0 0 1 0-.284l1.484-.549a.15.15 0 0 0 .089-.09zm.96-7.68a.151.151 0 0 1 .284 0l.549 1.483a.15.15 0 0 0 .089.09l1.483.548a.15.15 0 0 1 .072.229.15.15 0 0 1-.072.055l-1.483.549a.15.15 0 0 0-.09.09l-.548 1.482a.151.151 0 0 1-.284 0l-.549-1.483a.15.15 0 0 0-.09-.09l-1.483-.548a.151.151 0 0 1 0-.284l1.484-.549a.15.15 0 0 0 .09-.089zm-8.641 0a.151.151 0 0 1 .284 0l.549 1.483a.15.15 0 0 0 .09.09l1.482.548a.15.15 0 0 1 .072.229.15.15 0 0 1-.072.055l-1.483.549a.15.15 0 0 0-.09.09L7.95 6.267a.151.151 0 0 1-.284 0l-.549-1.483a.15.15 0 0 0-.089-.09l-1.483-.548a.151.151 0 0 1 0-.284l1.483-.549a.15.15 0 0 0 .09-.089l.548-1.483zm7.055 6.204a.85.85 0 0 0 .25-.591.82.82 0 0 0-.241-.588l-1.943-1.938a.8.8 0 0 0-.588-.241.84.84 0 0 0-.591.25l-1.545 1.539 3.115 3.115z"/><path d="M1.19 15.636a.96.96 0 0 1 .281-.679l7.835-7.834 3.121 3.12-7.834 7.835a.96.96 0 0 1-1.358 0l-1.764-1.764a.96.96 0 0 1-.28-.678Zm9.22-5.391-1.121-1.12-6.479 6.478 1.121 1.121z" clip-rule="evenodd"/></svg>',Wg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10.798 1.59 3.002 12.875l1.895 1.852 2.521 1.402 6.997-12.194z" class="ck-icon__fill"/><path d="m2.556 16.727.234-.348q-.445-.226-.498-.426-.054-.206.115-.837.14-.375.169-.595a4.5 4.5 0 0 0 0-.725q-.313-.931-.284-1.26.03-.327.475-.862l6.77-9.414q.808-1.365 3.199.18 2.39 1.549 1.784 2.686l-5.877 10.36q-.237.618-.526.782-.29.163-1.232.21-.543.196-.738.318t-.526.47q-.44.397-.632.397-.143 0-.524-.226l-.31.41zm-.279.415 1.575 1.103-.392.515H1.19zm8.1-13.656-4.953 6.9L8.75 12.57l4.247-7.574q.263-.375-1.092-1.192-1.354-.819-1.528-.32zM8.244 18.5 9.59 17h9.406v1.5z"/></svg>',Gg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M16.754 2.501a.75.75 0 0 1 .75.75v5.2a.75.75 0 1 1-1.5 0V5.06L11.98 9.086a.75.75 0 0 1-1.061-1.061L14.943 4h-3.389a.75.75 0 0 1 0-1.5zM3.25 17.504a.75.75 0 0 1-.75-.75v-5.2a.75.75 0 0 1 1.5 0v3.39l4.023-4.023a.75.75 0 1 1 1.061 1.06l-4.023 4.023H8.45a.75.75 0 0 1 0 1.5z"/></svg>',Kg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 42"><path d="M47.426 17V3.713L63.102 0v19.389h-.001l.001.272c0 1.595-2.032 3.43-4.538 4.098s-4.538-.083-4.538-1.678 2.032-3.43 4.538-4.098c.914-.244 2.032-.565 2.888-.603V4.516L49.076 7.447v9.556L49 17zM29.5 17h-8.343a7.073 7.073 0 1 0-4.657 4.06v3.781H3.3a2.803 2.803 0 0 1-2.8-2.804V8.63a2.803 2.803 0 0 1 2.8-2.805h4.082L8.58 2.768A1.99 1.99 0 0 1 10.435 1.5h8.985c.773 0 1.477.448 1.805 1.149l1.488 3.177H26.7c1.546 0 2.8 1.256 2.8 2.805zm-11.637 0H17.5a1 1 0 0 0-1 1v.05A4.244 4.244 0 1 1 17.863 17m29.684 2c.97 0 .953-.048.953.889v20.743c0 .953.016.905-.953.905H19.453c-.97 0-.953.048-.953-.905V19.89c0-.937-.016-.889.97-.889h28.077zm-4.701 19.338V22.183H24.154v16.155zM20.6 21.375v1.616h1.616v-1.616zm0 3.231v1.616h1.616v-1.616zm0 3.231v1.616h1.616v-1.616zm0 3.231v1.616h1.616v-1.616zm0 3.231v1.616h1.616v-1.616zm0 3.231v1.616h1.616V37.53zm24.233-16.155v1.616h1.615v-1.616zm0 3.231v1.616h1.615v-1.616zm0 3.231v1.616h1.615v-1.616zm0 3.231v1.616h1.615v-1.616zm0 3.231v1.616h1.615v-1.616zm0 3.231v1.616h1.615V37.53zM29.485 25.283a.4.4 0 0 1 .593-.35l9.05 4.977a.4.4 0 0 1 0 .701l-9.05 4.978a.4.4 0 0 1-.593-.35z"/></svg>',Jg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 20"><path d="M1.587 1.5c-.612 0-.601-.029-.601.551v14.84c0 .59-.01.559.591.559h18.846c.602 0 .591.03.591-.56V2.052c0-.58.01-.55-.591-.55H1.587Zm.701.971h1.003v1H2.288zm16.448 0h1.003v1h-1.003zm-14.24 1h13.008v12H4.467zm-2.208 1h1.003v1H2.288zm16.448 0h1.003v1h-1.003zm-16.448 2h1.003v1H2.288zm16.448 0h1.003v1h-1.003zm-16.448 2h1.003v1H2.288zm16.448 0h1.003v1h-1.003zm-16.448 2h1.003v1H2.288zm16.448 0h1.003v1h-1.003zm-16.448 2h1.003l-.029 1h-.974zm16.448 0h1.003v1h-1.003zm-16.448 2h.974v1h-.974zm16.448 0h1.003v1h-1.003z"/><path d="M8.374 6.648a.4.4 0 0 1 .395-.4.4.4 0 0 1 .2.049l5.148 2.824a.4.4 0 0 1 0 .7l-5.148 2.824a.403.403 0 0 1-.595-.35z"/></svg>',Qg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M11.45 9.304a.75.75 0 0 1-.75-.75v-5.2a.75.75 0 0 1 1.5 0v3.39l4.023-4.023a.75.75 0 0 1 1.06 1.06l-4.022 4.023h3.389a.75.75 0 0 1 0 1.5zm-2.896 1.397a.75.75 0 0 1 .75.75v5.2a.75.75 0 0 1-1.5 0v-3.39L3.78 17.286a.75.75 0 1 1-1.06-1.061l4.022-4.023H3.354a.75.75 0 0 1 0-1.5z"/></svg>',Yg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M7.85 6.5a.75.75 0 0 1 0-1.5h9.5a.75.75 0 1 1 0 1.5zM3 8V2.7H.5v1h1V8zm10.42 6.185a.75.75 0 0 0 .53 1.28h3.4a.75.75 0 1 0 0-1.5h-3.4a.75.75 0 0 0-.53.22m-7.784-6.15V6.8H4.4v1.235zM9 17.865v-5.3H6.5v1h1v4.3zm2.636.035v-1.235H10.4V17.9zM3.2 17.865v-5.3H.7v1h1v4.3zm2.636.035v-1.235H4.6V17.9z"/></svg>',Zg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M8.537 14.813a.888.888 0 1 1-1.254-1.255L10.84 10 7.283 6.442a.888.888 0 1 1 1.254-1.255L12.74 9.39a.888.888 0 0 1-.16 1.382z"/></svg>',Xg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10 0C4.48 0 0 4.48 0 10s4.48 10 10 10 10-4.48 10-10S15.52 0 10 0m1 15H9v-2h2zm0-4H9V5h2z"/></svg>',ef='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75M3.5 3v5H2V3.7H1v-1h2.5zM.343 17.857l2.59-3.257H2.92a.6.6 0 1 0-1.04 0H.302a2 2 0 1 1 3.995 0h-.001q-.073.607-.333.988-.263.381-1.244 1.312H4.3v1h-4zM7 14.75a.75.75 0 0 1 .75-.75h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75"/></svg>',tf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 3h16v1.5H2zm0 12h16v1.5H2z" opacity=".5"/><path d="M15.003 7v5.5a1 1 0 0 1-1 1H5.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1m-1.506.5H6.5V12h6.997z"/></svg>',nf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 3h16v1.5H2zm0 12h16v1.5H2z" opacity=".5"/><path d="M18 7v5.5a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1m-1.505.5H3.504V12h12.991z"/></svg>',sf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zm0-3H18v1.5h-4.5zm0-3H18v1.5h-4.5zM2 15h16v1.5H2z" opacity=".5"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1m-1.506.5H3.5V12h6.997z"/></svg>',of='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 3h16v1.5H2zm0 12h16v1.5H2zm0-9h5v1.5H2zm0 3h5v1.5H2zm0 3h5v1.5H2z" opacity=".5"/><path d="M18.003 7v5.5a1 1 0 0 1-1 1H8.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1m-1.506.5H9.5V12h6.997z"/></svg>',rf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zM2 15h16v1.5H2z" opacity=".5"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1m-1.506.5H3.5V12h6.997z"/></svg>',af='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 3h16v1.5H2zm0 12h16v1.5H2z" opacity=".5"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1m-1.506.5H3.5V12h6.997z"/></svg>',lf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 3h16v1.5H2zm0 12h16v1.5H2z" opacity=".5"/><path d="M18.003 7v5.5a1 1 0 0 1-1 1H8.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1m-1.506.5H9.5V12h6.997z"/></svg>',cf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M.95 1.43a.95.95 0 0 0-.95.95v3.1a.95.95 0 0 0 .95.95h.75v6.3H.95a.95.95 0 0 0-.95.95v3.1a.95.95 0 0 0 .95.95h3.1a.95.95 0 0 0 .95-.95v-.65h1.932l1.539-1.5H5v-.95a.95.95 0 0 0-.95-.95H3.2v-6.3h.85A.95.95 0 0 0 5 5.48v-.55h10v.55a.95.95 0 0 0 .95.95h3.1a.95.95 0 0 0 .95-.95v-3.1a.95.95 0 0 0-.95-.95h-3.1a.95.95 0 0 0-.95.95v1.05H5V2.38a.95.95 0 0 0-.95-.95zm.55 3.5v-2h2v2zm0 9.3v2h2v-2zm15-11.3v2h2v-2zM8.139 20.004v-2.388l7.045-7.048 2.391 2.391-7.046 7.046zm11.421-9.101a.6.6 0 0 1-.138.206l-1.165 1.168-2.391-2.391 1.167-1.163a.6.6 0 0 1 .206-.138.6.6 0 0 1 .243-.049.63.63 0 0 1 .449.187l1.491 1.488c.059.059.108.129.138.206s.049.16.049.243a.6.6 0 0 1-.049.243"/></svg>',uf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 17v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zM1 15.5v1H0v-1zm19 0v1h-1v-1zm-19-2v1H0v-1zm19 0v1h-1v-1zm-19-2v1H0v-1zm19 0v1h-1v-1zm-19-2v1H0v-1zm19 0v1h-1v-1zm-19-2v1H0v-1zm19 0v1h-1v-1zm-19-2v1H0v-1zm19 0v1h-1v-1zm0-2v1h-1v-1zm-19 0v1H0v-1zM14.5 2v1h-1V2zm2 0v1h-1V2zm2 0v1h-1V2zm-8 0v1h-1V2zm-2 0v1h-1V2zm-2 0v1h-1V2zm-2 0v1h-1V2zm8 0v1h-1V2zm-10 0v1h-1V2z"/><path d="M18.095 2H1.905C.853 2 0 2.895 0 4v12c0 1.105.853 2 1.905 2h16.19C19.147 18 20 17.105 20 16V4c0-1.105-.853-2-1.905-2m0 1.5c.263 0 .476.224.476.5v12c0 .276-.213.5-.476.5H1.905a.49.49 0 0 1-.476-.5V4c0-.276.213-.5.476-.5z"/></svg>',df='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 16.5v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zM1 15v1H0v-1zm19 0v1h-1v-1zM1 13v1H0v-1zm19 0v1h-1v-1zM1 11v1H0v-1zm19 0v1h-1v-1zM1 9v1H0V9zm19 0v1h-1V9zM1 7v1H0V7zm19 0v1h-1V7zM1 5v1H0V5zm19 0v1h-1V5zm0-2v1h-1V3zM1 3v1H0V3zm13.5-1.5v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm-8 0v1h-1v-1zm-2 0v1h-1v-1zm-2 0v1h-1v-1zm-2 0v1h-1v-1zm8 0v1h-1v-1zm-10 0v1h-1v-1z"/><path d="M13 5.5H2a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-8a2 2 0 0 0-2-2M13 7a.5.5 0 0 1 .5.5v8a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-8A.5.5 0 0 1 2 7z"/></svg>',hf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 16.5v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zM1 15v1H0v-1zm19 0v1h-1v-1zM1 13v1H0v-1zm19 0v1h-1v-1zM1 11v1H0v-1zm19 0v1h-1v-1zM1 9v1H0V9zm19 0v1h-1V9zM1 7v1H0V7zm19 0v1h-1V7zM1 5v1H0V5zm19 0v1h-1V5zm0-2v1h-1V3zM1 3v1H0V3zm13.5-1.5v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm-8 0v1h-1v-1zm-2 0v1h-1v-1zm-2 0v1h-1v-1zm-2 0v1h-1v-1zm8 0v1h-1v-1zm-10 0v1h-1v-1z"/><path d="M10 7.5H2a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2M10 9a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-6A.5.5 0 0 1 2 9z"/></svg>',mf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 16.5v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zM1 15v1H0v-1zm19 0v1h-1v-1zM1 13v1H0v-1zm19 0v1h-1v-1zM1 11v1H0v-1zm19 0v1h-1v-1zM1 9v1H0V9zm19 0v1h-1V9zM1 7v1H0V7zm19 0v1h-1V7zM1 5v1H0V5zm19 0v1h-1V5zm0-2v1h-1V3zM1 3v1H0V3zm13.5-1.5v1h-1v-1zm2 0v1h-1v-1zm2 0v1h-1v-1zm-8 0v1h-1v-1zm-2 0v1h-1v-1zm-2 0v1h-1v-1zm-2 0v1h-1v-1zm8 0v1h-1v-1zm-10 0v1h-1v-1z"/><path d="M7 9.5H2a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h5a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2M7 11a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-4A.5.5 0 0 1 2 11z"/></svg>',gf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10.223 5.001a5.28 5.28 0 0 0-4.408 2.258c-3.224.423-4.908 4.123-3.032 6.814l.004.008.002.004c.48.627 1.712 1.84 3.588 1.84h7.936c.667 0 1.32-.179 1.894-.522a3.84 3.84 0 0 0 1.381-1.46v-.005c1.13-2.16-.133-4.777-2.488-5.298-.617-1.853-2.177-3.242-4.111-3.565a5 5 0 0 0-.766-.074m-.092 1.5a3 3 0 0 1 .23.008c.077.004.154.014.231.021l.226.035a5 5 0 0 1 .45.116 3 3 0 0 1 .433.166 4 4 0 0 1 .606.348 4 4 0 0 1 .37.293 4 4 0 0 1 .33.348 3.5 3.5 0 0 1 .505.778 3 3 0 0 0-.42.117q-.123.044-.244.094l-1.49.627-2.686-1.61a4.4 4.4 0 0 0-1.002-.445c.015-.01.032-.026.047-.039a4 4 0 0 1 .4-.289 4 4 0 0 1 .424-.23 3 3 0 0 1 .219-.094q.112-.043.225-.076a4 4 0 0 1 .222-.06q.117-.029.233-.05.112-.022.228-.033.115-.011.233-.02.116-.005.23-.005m-3.8 2.193h.003c.54.001 1.111.156 1.551.428l1.783 1.07-5.867 2.471c-.535-1.29-.15-2.788 1.059-3.537l.007-.004a2.9 2.9 0 0 1 1.463-.428Zm7.974 1.33.152.008q.13.011.258.033a2 2 0 0 1 .477.145 2.2 2.2 0 0 1 .918.756q.07.1.127.2a2.3 2.3 0 0 1 .269.919c.004.081.008.165.002.248q-.006.083-.02.166l-3.507-2.102.459-.193.015-.008a2 2 0 0 1 .41-.125 2.3 2.3 0 0 1 .44-.047m-3.008 1.112 4.506 2.699a2.2 2.2 0 0 1-.338.26 2.2 2.2 0 0 1-.668.275q-.116.027-.24.04c-.081.007-.164.015-.246.015H6.373a3 3 0 0 1-.168-.004 2 2 0 0 1-.164-.016l-.154-.023q-.077-.01-.15-.026a3 3 0 0 1-.77-.3 3 3 0 0 1-.21-.133c-.012-.008-.019-.016-.03-.024z"/></svg>',ff='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M11 1a9 9 0 1 1-8.027 13.075l1.128-1.129A7.502 7.502 0 0 0 18.5 10a7.5 7.5 0 1 0-14.962.759l-.745-.746-.76.76A9 9 0 0 1 11 1"/><path d="M.475 8.17a.75.75 0 0 1 .978.047l.075.082 1.284 1.643 1.681-1.284a.75.75 0 0 1 .978.057l.073.083a.75.75 0 0 1-.057.978l-.083.073-2.27 1.737a.75.75 0 0 1-.973-.052l-.074-.082-1.741-2.23a.75.75 0 0 1 .13-1.052zM11.5 5v4.999l3.196 3.196-1.06 1.06L10.1 10.72l-.1-.113V5z"/></svg>',pf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75m5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75M2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5m1.618-9.55L.98 9.358a.4.4 0 0 0 .013.661l3.39 2.207A.4.4 0 0 0 5 11.892V7.275a.4.4 0 0 0-.632-.326z"/></svg>',bf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M3.598.687h1.5v5h-1.5zm14.5 0h1.5v5h-1.5z"/><path d="M19.598 4.187v1.5h-16v-1.5zm-16 14.569h1.5v-5h-1.5zm14.5 0h1.5v-5h-1.5z"/><path d="M19.598 15.256v-1.5h-16v1.5zM5.081 9h6v2h-6zm8 0h6v2h-6zm-9.483 1L0 12.5v-5z"/></svg>',wf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="2 2 56 18"><path d="m12.527 14.733-.514.022-.057-.057-.058-.058.006-2.44.007-2.44-.834-.023-.833-.022.023-.406.024-.405.536-.1.536-.098.25-.145.25-.145.17-.429.172-.428.399-.024.398-.023v7.08l.02.059.02.059zm17.894.016h-.457l.043-.138.043-.137.635-2.004.636-2.004.437-1.375.436-1.375.055-.196.054-.197.38-.024.378-.024.07.069.07.07-1.162 3.667-1.16 3.667zm11.733 0h-.55V9.72h-1.65v-.864h.385l.4-.086.398-.086.233-.195.232-.196.138-.386.137-.387h.827v7.229zm6.404 0h-.51V13.02h-3.143v-1.01l1.044-1.44 1.045-1.44.59-.824.592-.825h.854l.02 2.298.021 2.298h1.02v.943H49.07v1.729zM47 12.06l1.008-.022.022-1.4.021-1.401-.07.044-.07.043-.901 1.279-.901 1.278-.058.1-.059.101zM12.256 22.893l-10.53.01-.157-.038-.157-.038-.255-.12L.9 22.59v-.19l.228-.218.228-.218.16.086.16.085h20.922l.16-.085.16-.086.228.218.227.218v.189l-.294.146-.295.147z"/></svg>',vf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 31 20"><mask id="a" width="17" height="18" x="13" y="1" maskUnits="userSpaceOnUse"><path d="M13 1h17v18H13z"/><path d="M14 3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H15a1 1 0 0 1-1-1z"/><path d="M27 3.25a1.5 1.5 0 0 1 1.5 1.5v1.7a2.25 2.25 0 0 1-1.932 2.226l-4.424.632a.75.75 0 0 0-.644.743V11a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1H20a1 1 0 0 1-1-1v-5a1 1 0 0 1 1-1v-.95a2.25 2.25 0 0 1 1.932-2.226l4.424-.632A.75.75 0 0 0 27 6.449z"/></mask><path d="M14 3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H15a1 1 0 0 1-1-1z"/><path d="M27 3.25a1.5 1.5 0 0 1 1.5 1.5v1.7a2.25 2.25 0 0 1-1.932 2.226l-4.424.632a.75.75 0 0 0-.644.743V11a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1H20a1 1 0 0 1-1-1v-5a1 1 0 0 1 1-1v-.95a2.25 2.25 0 0 1 1.932-2.226l4.424-.632A.75.75 0 0 0 27 6.449z"/><path d="M14 3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H15a1 1 0 0 1-1-1z" mask="url(#a)"/><path d="M27 3.25a1.5 1.5 0 0 1 1.5 1.5v1.7a2.25 2.25 0 0 1-1.932 2.226l-4.424.632a.75.75 0 0 0-.644.743V11a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1H20a1 1 0 0 1-1-1v-5a1 1 0 0 1 1-1v-.95a2.25 2.25 0 0 1 1.932-2.226l4.424-.632A.75.75 0 0 0 27 6.449z" mask="url(#a)"/><mask id="b" width="12" height="17" x="1.75" y="1.165" maskUnits="userSpaceOnUse"><path d="M1.75 1.165h12v17h-12z"/><path d="m12.25 9.96-9.5-7.795 2 12.124 2.384-2.53 2.75 4.762 1.732-1-2.75-4.763z"/></mask><path d="m12.25 9.96-9.5-7.795 2 12.124 2.384-2.53 2.75 4.762 1.732-1-2.75-4.763z"/><path d="m12.25 9.96-9.5-7.795 2 12.124 2.384-2.53 2.75 4.762 1.732-1-2.75-4.763z" mask="url(#b)"/></svg>',_f='<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 31 20" width="30" height="20">\n  <path d="M14 3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H15a1 1 0 0 1-1-1V3Z" fill="#000"/>\n  <path d="M27 3.25a1.5 1.5 0 0 1 1.5 1.5v1.7a2.25 2.25 0 0 1-1.932 2.226l-4.424.632a.75.75 0 0 0-.644.743V11a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1H20a1 1 0 0 1-1-1v-5a1 1 0 0 1 1-1v-.95a2.25 2.25 0 0 1 1.932-2.226l4.424-.632A.75.75 0 0 0 27 6.449V3.25Z" fill="#000"/>\n  <path fill-rule="evenodd" clip-rule="evenodd" d="M26.855 2.25H27a2.5 2.5 0 0 1 2.5 2.5v1.7a3.25 3.25 0 0 1-2.79 3.216l-4.21.602a2 2 0 0 1 1 1.732v5a2 2 0 0 1-2 2H20a2 2 0 0 1-2-2v-5a2 2 0 0 1 1-1.732v-.217A3.25 3.25 0 0 1 21.129 7H15a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h10a2 2 0 0 1 1.855 1.25ZM20 10.05V11a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h1.5a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1v-.95c0-.016 0-.033.002-.05a.75.75 0 0 1 .642-.692l4.424-.632A2.25 2.25 0 0 0 28.5 6.45V4.75a1.496 1.496 0 0 0-1.5-1.5v3.2a.75.75 0 0 1-.644.742l-4.424.632A2.25 2.25 0 0 0 20 10.05ZM15 2a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1H15Z" fill="#fff"/>\n  <path d="M2.5 2.5A.5.5 0 0 1 3 2h2.5a.5.5 0 0 1 .354.146l.646.647.646-.647A.5.5 0 0 1 7.5 2H10a.5.5 0 0 1 0 1H7.707L7 3.707V10h.5a.5.5 0 0 1 0 1H7v4.793l.707.707H10a.5.5 0 0 1 0 1H7.5a.5.5 0 0 1-.354-.146l-.646-.647-.646.647a.5.5 0 0 1-.354.146H3a.5.5 0 0 1 0-1h2.293L6 15.793V11h-.5a.5.5 0 0 1 0-1H6V3.707L5.293 3H3a.5.5 0 0 1-.5-.5Z" fill="#000"/>\n  <path fill-rule="evenodd" clip-rule="evenodd" d="m5.793 3.5-.5-.5H3a.5.5 0 0 1 0-1h2.5a.5.5 0 0 1 .354.146l.145.146.501.5.646-.646A.5.5 0 0 1 7.5 2H10a.5.5 0 0 1 0 1H7.707L7 3.707V10h.5a.5.5 0 0 1 0 1H7v4.793l.707.707H10a.5.5 0 0 1 0 1H7.5a.5.5 0 0 1-.354-.146l-.646-.647-.5.5-.146.147a.5.5 0 0 1-.354.146H3a.5.5 0 0 1 0-1h2.293L6 15.793V11h-.5a.5.5 0 0 1 0-1H6V3.707L5.793 3.5Zm-.914.5L5 4.121v4.964a1.5 1.5 0 0 0 0 2.83v3.464l-.121.121H3a1.5 1.5 0 0 0 0 3h2.5a1.5 1.5 0 0 0 1-.382 1.5 1.5 0 0 0 1 .382H10a1.5 1.5 0 0 0 0-3H8.121L8 15.379v-3.464a1.5 1.5 0 0 0 0-2.83V4.121L8.121 4H10a1.5 1.5 0 0 0 0-3H7.5a1.5 1.5 0 0 0-1 .382A1.5 1.5 0 0 0 5.5 1H3a1.5 1.5 0 1 0 0 3h1.879Z" fill="#fff"/>\n</svg>\n',yf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M3 3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1z"/><path d="M16 3.25a1.5 1.5 0 0 1 1.5 1.5v1.7a2.25 2.25 0 0 1-1.932 2.226l-4.424.632a.75.75 0 0 0-.644.743V11a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1v-5a1 1 0 0 1 1-1v-.95a2.25 2.25 0 0 1 1.932-2.226l4.424-.632A.75.75 0 0 0 16 6.449z"/></svg>',kf='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><path d="M8.514.5c1.007 0 2.056.352 2.866.96.813.611 1.449 1.539 1.449 2.69v7.8c0 .777-.382 1.457-.888 1.93-.505.474-1.195.8-1.92.82-1.473.04-2.848-1.237-2.848-2.75v-3.7a.75.75 0 0 1 1.5 0v3.7c0 .642.65 1.268 1.306 1.25.312-.008.663-.157.938-.414.274-.256.412-.562.412-.836v-7.8c0-.556-.303-1.08-.85-1.49A3.4 3.4 0 0 0 8.513 2a3.4 3.4 0 0 0-1.946.65c-.556.41-.868.934-.868 1.5v.028l-.001.013-.002.055-.006.212-.02.787c-.015.67-.034 1.605-.046 2.663-.025 2.123-.025 4.729.074 6.704.058 1.155.628 1.948 1.466 2.478.864.547 2.017.81 3.135.81 1.114 0 2.092-.265 2.789-.785.671-.5 1.152-1.286 1.213-2.503a80 80 0 0 0 .074-5.299 82 82 0 0 0-.073-2.283L14.301 7v-.086A.75.75 0 0 1 15.8 6.91v.013l.002.033.005.127c.005.11.013.273.02.48.017.413.035 1.007.048 1.725a82 82 0 0 1-.075 5.4c-.082 1.63-.758 2.843-1.815 3.631-1.032.77-2.358 1.082-3.684 1.082-1.322 0-2.774-.306-3.939-1.044-1.191-.754-2.076-1.962-2.161-3.669-.101-2.024-.101-4.67-.076-6.796.012-1.066.03-2.006.047-2.68.007-.337.015-.608.02-.794l.006-.215.002-.056v-.02c.009-1.162.663-2.082 1.477-2.683A4.9 4.9 0 0 1 8.514.5"/></svg>',Cf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10.5 5.5H7v5h3.5a2.5 2.5 0 1 0 0-5M5 3h6.5v.025a5 5 0 0 1 0 9.95V13H7v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1"/></svg>',xf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m7.3 17.37-.061.088a1.52 1.52 0 0 1-.934.535l-4.178.663-.806-4.153a1.5 1.5 0 0 1 .187-1.058l.056-.086L8.77 2.639c.958-1.351 2.803-1.076 4.296-.03 1.497 1.047 2.387 2.693 1.433 4.055zM9.14 4.728l-5.545 8.346 3.277 2.294 5.544-8.346zM6.07 16.512l-3.276-2.295.53 2.73zM9.994 3.506 13.271 5.8c.316-.452-.16-1.333-1.065-1.966-.905-.634-1.895-.78-2.212-.328M8 18.5 9.375 17H19v1.5z"/></svg>',Af='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10.126 2.268 2.002 13.874l1.895 1.852 2.521 1.402L14.47 5.481l-1.543-2.568z" class="ck-icon__fill"/><path d="m4.5 18.088-2.645-1.852-.04-2.95-.006-.005.006-.008v-.025l.011.008L8.73 2.97q.249-.348.567-.557l-1.212.308L4.604 7.9l-.83-.558 3.694-5.495 2.708-.69 1.65 1.145.046.018.85-1.216 2.16 1.512-.856 1.222c.828.967 1.144 2.141.432 3.158L7.55 17.286l.006.005zm-.634.166-1.976.516-.026-1.918zM9.968 3.817l-.006-.004-6.123 9.184 3.277 2.294 6.108-9.162.005.003c.317-.452-.16-1.332-1.064-1.966-.891-.624-1.865-.776-2.197-.349M8.245 18.5 9.59 17h9.406v1.5z"/></svg>',Ef='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M6.999 2H15a1 1 0 0 1 0 2h-1.004v13a1 1 0 1 1-2 0V4H8.999v13a1 1 0 1 1-2 0v-7A4 4 0 0 1 3 6a4 4 0 0 1 3.999-4"/></svg>',Tf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10 19a9 9 0 1 0 0-18 9 9 0 0 0 0 18m3.45-9.872a1 1 0 0 1 0 1.744l-4.96 2.79A1 1 0 0 1 7 12.79V7.21a1 1 0 0 1 1.49-.872z" clip-rule="evenodd"/></svg>',Sf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10 2a1 1 0 0 0-1 1v6H3a1 1 0 1 0 0 2h6v6a1 1 0 1 0 2 0v-6h6a1 1 0 1 0 0-2h-6V3a1 1 0 0 0-1-1"/></svg>',If='<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">\n<circle cx="9.00037" cy="9.79993" r="1.5"/>\n<path d="M5.75024 2.75005C5.75019 2.00005 5.75006 2.00005 5.75006 2.00005L5.74877 2.00005L5.74647 2.00006L5.73927 2.00009L5.71503 2.0003C5.6947 2.00053 5.66619 2.00098 5.63111 2.00185C5.56123 2.0036 5.46388 2.00707 5.35241 2.01402C5.14095 2.02722 4.83482 2.05536 4.56712 2.12276C4.1703 2.22267 3.82938 2.40399 3.55967 2.67392C3.29221 2.94161 3.1311 3.26001 3.03544 3.5803C2.85401 4.18776 2.8854 4.89393 2.92747 5.49256C2.9373 5.6324 2.94792 5.76849 2.95828 5.90131C2.99629 6.38849 3.03087 6.83163 3.01038 7.25369C2.98475 7.78147 2.87469 8.13279 2.6777 8.3656C2.45517 8.6286 2.1841 8.79405 1.95875 8.89436C1.84756 8.94386 1.75282 8.97509 1.68956 8.99319C1.65813 9.00219 1.63513 9.00776 1.62253 9.01062L1.61304 9.01269L1.00024 9.12173V9.75005H3.4023C3.54579 9.63123 3.68814 9.49364 3.82278 9.33451C4.33087 8.73405 4.47638 7.99036 4.50861 7.32643C4.5342 6.79933 4.48942 6.23163 4.4502 5.73429C4.44071 5.61404 4.43155 5.49785 4.42378 5.3874C4.38011 4.76596 4.37986 4.32043 4.4727 4.00956C4.51418 3.87069 4.56668 3.78828 4.62078 3.73414C4.67264 3.68223 4.76124 3.6207 4.93336 3.57736C5.06269 3.5448 5.25656 3.52293 5.44585 3.51111C5.53475 3.50556 5.61296 3.50277 5.66854 3.50139C5.6962 3.5007 5.71789 3.50036 5.73209 3.5002L5.74748 3.50007L5.75054 3.50005L6.5003 3.5L6.50019 2L5.75006 2.00005L5.75024 2.75005Z"/>\n<path d="M5.75024 16.7501C5.75019 17.5001 5.75006 17.5001 5.75006 17.5001L5.74877 17.5001L5.74647 17.5001L5.73927 17.5L5.71503 17.4998C5.6947 17.4996 5.66619 17.4991 5.63111 17.4983C5.56123 17.4965 5.46388 17.493 5.35241 17.4861C5.14095 17.4729 4.83482 17.4448 4.56712 17.3774C4.1703 17.2774 3.82938 17.0961 3.55967 16.8262C3.29221 16.5585 3.1311 16.2401 3.03544 15.9198C2.85401 15.3124 2.8854 14.6062 2.92747 14.0076C2.9373 13.8677 2.94792 13.7316 2.95828 13.5988C2.99629 13.1116 3.03087 12.6685 3.01038 12.2464C2.98475 11.7186 2.87469 11.3673 2.6777 11.1345C2.45517 10.8715 2.1841 10.7061 1.95875 10.6058C1.84756 10.5563 1.75282 10.525 1.68956 10.5069C1.65813 10.4979 1.63513 10.4924 1.62253 10.4895L1.61304 10.4874L1.00024 10.3784V9.75005H3.4023C3.54579 9.86887 3.68814 10.0065 3.82278 10.1656C4.33087 10.7661 4.47638 11.5098 4.50861 12.1737C4.5342 12.7008 4.48942 13.2685 4.4502 13.7658C4.44071 13.8861 4.43155 14.0023 4.42378 14.1127C4.38011 14.7341 4.37986 15.1797 4.4727 15.4906C4.51418 15.6294 4.56668 15.7118 4.62078 15.766C4.67264 15.8179 4.76124 15.8794 4.93336 15.9228C5.06269 15.9553 5.25656 15.9772 5.44585 15.989C5.53475 15.9945 5.61296 15.9973 5.66854 15.9987C5.6962 15.9994 5.71789 15.9998 5.73209 15.9999L5.74748 16L5.75054 16.0001L6.5003 16.0001L6.50019 17.5001L5.75006 17.5001L5.75024 16.7501Z"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M12.2514 2.00005L12.2501 2.00005L11.5 2L11.4999 3.5L12.2496 3.50005L12.2527 3.50007L12.2681 3.5002C12.2823 3.50036 12.304 3.5007 12.3316 3.50139C12.3872 3.50277 12.4654 3.50556 12.5543 3.51111C12.7436 3.52293 12.9375 3.5448 13.0668 3.57736C13.2389 3.6207 13.3275 3.68223 13.3794 3.73414C13.4335 3.78828 13.486 3.87069 13.5275 4.00956C13.6203 4.32043 13.6201 4.76596 13.5764 5.3874C13.5686 5.49785 13.5595 5.61404 13.55 5.73429C13.5108 6.23163 13.466 6.79933 13.4916 7.32643C13.5238 7.99036 13.6693 8.73405 14.1774 9.33451C14.312 9.49364 14.4544 9.63123 14.5979 9.75005C14.4544 9.86887 14.312 10.0065 14.1774 10.1656C13.7121 10.7154 13.5509 11.3854 13.5023 12.0042C13.6011 12.0012 13.7003 11.9997 13.7999 11.9997C14.208 11.9997 14.6093 12.0247 15.0018 12.0729C15.0416 11.6402 15.1479 11.3408 15.3225 11.1345C15.545 10.8715 15.8161 10.7061 16.0414 10.6058C16.1526 10.5563 16.2474 10.525 16.3106 10.5069C16.342 10.4979 16.365 10.4924 16.3776 10.4895L16.3871 10.4874L16.9999 10.3784V9.75005V9.12173L16.3871 9.01269L16.3776 9.01062C16.365 9.00776 16.342 9.00219 16.3106 8.99319C16.2474 8.97509 16.1526 8.94386 16.0414 8.89436C15.8161 8.79405 15.545 8.6286 15.3225 8.3656C15.1255 8.13279 15.0154 7.78147 14.9898 7.25369C14.9693 6.83163 15.0039 6.38849 15.0419 5.90131C15.0523 5.76849 15.0629 5.6324 15.0727 5.49256C15.1148 4.89393 15.1462 4.18776 14.9647 3.5803C14.8691 3.26001 14.708 2.94161 14.4405 2.67392C14.1708 2.40399 13.8299 2.22267 13.433 2.12276C13.1654 2.05536 12.8592 2.02722 12.6478 2.01402C12.5363 2.00707 12.4389 2.0036 12.3691 2.00185C12.334 2.00098 12.3055 2.00053 12.2851 2.0003L12.2609 2.00009L12.2537 2.00006L12.2514 2.00005Z"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M9.00335 17.2062L9.00308 17.2065C8.7234 17.5118 8.24919 17.5327 7.94372 17.2532C7.63816 16.9735 7.61716 16.4991 7.89681 16.1935L8.45008 16.6999C7.89681 16.1935 7.89697 16.1934 7.89713 16.1932L7.89751 16.1928L7.89844 16.1918L7.90098 16.189L7.90879 16.1806L7.93517 16.1526C7.95746 16.1292 7.98914 16.0963 8.02971 16.0555C8.11079 15.9738 8.22768 15.8597 8.37644 15.724C8.6732 15.4532 9.10079 15.0927 9.62744 14.7314C10.6647 14.0198 12.1659 13.2499 13.8501 13.2499C15.5343 13.2499 17.0355 14.0198 18.0727 14.7314C18.5994 15.0927 19.027 15.4532 19.3237 15.724C19.4725 15.8597 19.5894 15.9738 19.6705 16.0555C19.711 16.0963 19.7427 16.1292 19.765 16.1526L19.7914 16.1806L19.7992 16.189L19.8017 16.1918L19.8027 16.1928L19.803 16.1932C19.8032 16.1934 19.8034 16.1935 19.2501 16.6999L19.8034 16.1935C20.083 16.4991 20.062 16.9735 19.7565 17.2532C19.4511 17.5326 18.9772 17.5118 18.6975 17.207L18.6971 17.2065L18.6968 17.2062L18.6945 17.2037L18.6783 17.1865C18.6629 17.1704 18.6386 17.1452 18.6059 17.1123C18.5404 17.0463 18.4414 16.9494 18.3127 16.8321C18.0546 16.5966 17.6814 16.282 17.2242 15.9683C16.9805 15.8012 16.7185 15.6381 16.4421 15.4883C16.7016 15.9322 16.8502 16.4487 16.8502 16.9999C16.8502 18.6567 15.5071 19.9999 13.8502 19.9999C12.1934 19.9999 10.8502 18.6567 10.8502 16.9999C10.8502 16.4486 10.9989 15.932 11.2584 15.4881C10.9819 15.6379 10.7198 15.8011 10.476 15.9683C10.0188 16.282 9.64555 16.5966 9.38746 16.8321C9.25879 16.9494 9.15975 17.0463 9.09425 17.1123C9.06153 17.1452 9.03726 17.1704 9.02192 17.1865L9.00572 17.2037L9.00335 17.2062Z"/>\n<circle cx="14.8253" cy="16.1749" r="1.125" fill="white"/>\n</svg>\n',Pf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M11.463 5.187a.888.888 0 1 1 1.254 1.255L9.16 10l3.557 3.557a.888.888 0 1 1-1.254 1.255L7.26 10.61a.888.888 0 0 1 .16-1.382l4.043-4.042z"/></svg>',Vf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M15 2.5H5v4h10zm-1 1v2H6v-2z"/><path d="M16 5.5a2.5 2.5 0 0 1 2.495 2.336L18.5 8v5a2.5 2.5 0 0 1-2.336 2.495L16 15.5h-1V14h1a1 1 0 0 0 .993-.883L17 13V8a1 1 0 0 0-.883-.993L16 7H4a1 1 0 0 0-.993.883L3 8v5a1 1 0 0 0 .883.993L4 14h1v1.5H4a2.5 2.5 0 0 1-2.495-2.336L1.5 13V8a2.5 2.5 0 0 1 2.336-2.495L4 5.5zM6.5 8a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1z"/><path d="M15 12H5v7h10zm-1 1v5H6v-5z"/><path d="M7 14h6v1H7zm0 2h6v1H7z"/></svg>',Rf='<svg xmlns="http://www.w3.org/2000/svg" width="53" height="10" viewBox="0 0 53 10"><path fill="#1C2331" d="M31.724 1.492a15.139 15.139 0 0 0 .045 1.16 2.434 2.434 0 0 0-.687-.34 3.68 3.68 0 0 0-1.103-.166 2.332 2.332 0 0 0-1.14.255 1.549 1.549 0 0 0-.686.87c-.15.41-.225.98-.225 1.712 0 .939.148 1.659.444 2.161.297.503.792.754 1.487.754.452.015.9-.094 1.294-.316.296-.174.557-.4.771-.669l.14.852h1.282V.007h-1.623v1.485ZM31 6.496a1.77 1.77 0 0 1-.494.061.964.964 0 0 1-.521-.127.758.758 0 0 1-.296-.466 3.984 3.984 0 0 1-.093-.992 4.208 4.208 0 0 1 .098-1.052.753.753 0 0 1 .307-.477 1.08 1.08 0 0 1 .55-.122c.233-.004.466.026.69.089l.483.144v2.553c-.11.076-.213.143-.307.2a1.73 1.73 0 0 1-.417.189ZM35.68 0l-.702.004c-.322.002-.482.168-.48.497l.004.581c.002.33.164.493.486.49l.702-.004c.322-.002.481-.167.48-.496L36.165.49c-.002-.33-.164-.493-.486-.491ZM36.145 2.313l-1.612.01.034 5.482 1.613-.01-.035-5.482ZM39.623.79 37.989.8 38 2.306l-.946.056.006 1.009.949-.006.024 2.983c.003.476.143.844.419 1.106.275.26.658.39 1.148.387.132 0 .293-.01.483-.03.19-.02.38-.046.57-.08.163-.028.324-.068.482-.119l-.183-1.095-.702.004a.664.664 0 0 1-.456-.123.553.553 0 0 1-.14-.422l-.016-2.621 1.513-.01-.006-1.064-1.514.01-.01-1.503ZM46.226 2.388c-.41-.184-.956-.274-1.636-.27-.673.004-1.215.101-1.627.29-.402.179-.72.505-.888.91-.18.419-.268.979-.264 1.68.004.688.1 1.24.285 1.655.172.404.495.724.9.894.414.18.957.268 1.63.264.68-.004 1.224-.099 1.632-.284.4-.176.714-.501.878-.905.176-.418.263-.971.258-1.658-.004-.702-.097-1.261-.28-1.677a1.696 1.696 0 0 0-.888-.9Zm-.613 3.607a.77.77 0 0 1-.337.501 1.649 1.649 0 0 1-1.317.009.776.776 0 0 1-.343-.497 4.066 4.066 0 0 1-.105-1.02 4.136 4.136 0 0 1 .092-1.03.786.786 0 0 1 .337-.507 1.59 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"/><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',Of='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M3 10.423a6.5 6.5 0 0 1 6.056-6.408l.038.67C6.448 5.423 5.354 7.663 5.22 10H9c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003zm8 0a6.5 6.5 0 0 1 6.056-6.408l.038.67c-2.646.739-3.74 2.979-3.873 5.315H17c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003z"/></svg>',Bf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m14.958 9.367-2.189 1.837a.75.75 0 0 0 .965 1.149l3.788-3.18a.75.75 0 0 0 .21-.284.75.75 0 0 0-.17-.945L13.77 4.762a.75.75 0 1 0-.964 1.15l2.331 1.955H6.22A.8.8 0 0 0 6 7.9a4 4 0 1 0 1.477 7.718l-.344-1.489A2.5 2.5 0 1 1 6.039 9.4l-.008-.032z"/></svg>',Lf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M5.106 4.946c.272.274.27.712.033 1.016a6.1 6.1 0 0 0-1.291 3.764c0 3.375 2.722 6.111 6.08 6.111q.418 0 .822-.057l-.964-.968-.048-.054a.71.71 0 0 1 .048-.943.7.7 0 0 1 .939-.05l.053.05 1.984 1.994c.143.144.21.335.204.523a.7.7 0 0 1-.156.495l-.048.053-1.984 1.994a.7.7 0 0 1-.992 0 .71.71 0 0 1 0-.997l.645-.647a8 8 0 0 1-.504.018c-4.132 0-7.482-3.368-7.482-7.522 0-1.803.632-3.458 1.684-4.754.248-.304.701-.304.977-.026M9.057.464a.7.7 0 0 1 .992 0 .71.71 0 0 1 0 .997l-.966.97q.46-.058.938-.058c4.132 0 7.483 3.367 7.483 7.521a7.5 7.5 0 0 1-1.685 4.754c-.247.304-.7.304-.977.026-.271-.273-.27-.712-.032-1.016a6.1 6.1 0 0 0 1.29-3.764c0-3.375-2.721-6.11-6.079-6.111a6 6 0 0 0-.673.039l.701.705.049.053a.71.71 0 0 1-.049.944.7.7 0 0 1-.939.048l-.053-.048L7.073 3.53a.7.7 0 0 1-.203-.524.7.7 0 0 1 .155-.495l.048-.053z"/></svg>',Mf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M5.2 7h9.2c.6 0 1 .4 1 1v9.9c0 .5-.4 1-1 1H5.2a1 1 0 0 1-1-1V8c0-.6.4-1 1-1m1 1.5c-.3 0-.5.2-.5.5v8c0 .3.2.5.5.5h.5c.2 0 .5-.2.5-.5V9c0-.3-.3-.5-.5-.5zm3.2 0c-.2 0-.5.2-.5.5v8c0 .3.3.5.5.5h.5c.3 0 .5-.2.5-.5V9c0-.3-.2-.5-.5-.5h-.4zm3.5 0c-.2 0-.5.2-.5.5v8c0 .3.3.5.5.5h.5c.3 0 .5-.2.5-.5V9c0-.3-.2-.5-.5-.5zm-1.4-7.1H8.3L6.5 3.6H3.8c-.5 0-.7.3-.7.8s.2.7.7.7h12c.6 0 .9-.2.9-.7s-.3-.8-1-.8h-2.4z"/></svg>',Ff='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M8.69 14.915q.08.078.36.093a.366.366 0 0 1 .345.485l-.003.01a.74.74 0 0 1-.697.497h-2.67a.374.374 0 0 1-.353-.496l.013-.038a.68.68 0 0 1 .644-.458q.295-.018.386-.093a.3.3 0 0 0 .072-.11L9.592 4.5H6.269q-.538-.026-.75.09-.213.117-.442.563c-.192.29-.516.464-.864.464H4.17a.43.43 0 0 1-.407-.569L4.46 3h13.08l-.62 2.043a.81.81 0 0 1-.775.574h-.114a.486.486 0 0 1-.486-.486q.002-.426-.167-.54-.168-.114-.766-.091h-3.28l-2.68 10.257q-.009.111.038.158M3 17h8a.5.5 0 1 1 0 1H3a.5.5 0 1 1 0-1m11.299 1.17a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.06-1.06l1.415 1.414 1.414-1.415a.75.75 0 1 1 1.06 1.06l-1.413 1.415 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414z"/></svg>',Nf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M5.2 7h9.2c.6 0 1 .4 1 1v9.9c0 .5-.4 1-1 1H5.2a1 1 0 0 1-1-1V8c0-.6.4-1 1-1m1 1.5c-.3 0-.5.2-.5.5v8c0 .3.2.5.5.5h.5c.2 0 .5-.2.5-.5V9c0-.3-.3-.5-.5-.5zm3.2 0c-.2 0-.5.2-.5.5v8c0 .3.3.5.5.5h.5c.3 0 .5-.2.5-.5V9c0-.3-.2-.5-.5-.5zm3.5 0c-.2 0-.5.2-.5.5v8c0 .3.3.5.5.5h.5c.3 0 .5-.2.5-.5V9c0-.3-.2-.5-.5-.5zm-1.4-7.1H8.3L6.5 3.6H3.8c-.5 0-.7.3-.7.8s.2.7.7.7h12c.6 0 .9-.2.9-.7s-.3-.8-1-.8h-2.4z"/></svg>',Df='<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>',zf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M11 1a9 9 0 1 1-8.027 13.075l1.128-1.129A7.502 7.502 0 0 0 18.5 10a7.5 7.5 0 1 0-14.962.759l-.745-.746-.76.76A9 9 0 0 1 11 1"/><path d="M.475 8.17a.75.75 0 0 1 .978.047l.075.082 1.284 1.643 1.681-1.284a.75.75 0 0 1 .978.057l.073.083a.75.75 0 0 1-.057.978l-.083.073-2.27 1.737a.75.75 0 0 1-.973-.052l-.074-.082-1.741-2.23a.75.75 0 0 1 .13-1.052zM11.5 5v4.999l3.196 3.196-1.06 1.06L10.1 10.72l-.1-.113V5z"/></svg>',Hf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M9.61 2.66a1.406 1.406 0 1 0-1.407 0v.891H3.28a2.11 2.11 0 0 0-2.11 2.11v10.312a2.11 2.11 0 0 0 2.11 2.109h5.684l-.054-1.157.18-.25H3.28a.703.703 0 0 1-.703-.702V5.66c0-.389.315-.704.703-.704h11.25c.388 0 .703.315.703.704v2.484l.358-.497a2.5 2.5 0 0 1 1.048-.84V5.66a2.11 2.11 0 0 0-2.11-2.11H9.61z"/><path d="M5.625 10.817c.518 0 .937-.63.937-1.407 0-.776-.42-1.406-.937-1.406s-.938.63-.938 1.406c0 .777.42 1.407.938 1.407m7.5-1.407c0 .777-.42 1.407-.938 1.407s-.937-.63-.937-1.407c0-.776.42-1.406.937-1.406s.938.63.938 1.406M.937 8.004A.937.937 0 0 0 0 8.942v1.875c0 .517.42.937.937.937zm5.191 4.506a.78.78 0 0 1 1.085.216c.272.408.907.707 1.693.707s1.421-.3 1.693-.707a.782.782 0 0 1 1.302.868c-.666 1-1.906 1.403-2.995 1.403s-2.329-.404-2.995-1.403a.78.78 0 0 1 .217-1.085Zm10.859-3.6-.622.864 2.879 2.074.622-.864a.71.71 0 0 0-.161-.99l-1.728-1.245a.71.71 0 0 0-.99.161m-5.352 11.041a.355.355 0 0 1-.449-.31l-.214-2.38 4.978-6.911 2.88 2.074-4.978 6.91z"/></svg>',qf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M.75 15.5a.75.75 0 0 1 .75.75V18l.008.09A.5.5 0 0 0 2 18.5h1.75a.75.75 0 1 1 0 1.5H1.5l-.144-.007a1.5 1.5 0 0 1-1.35-1.349L0 18.5v-2.25a.75.75 0 0 1 .75-.75m18.5 0a.75.75 0 0 1 .75.75v2.25l-.007.144a1.5 1.5 0 0 1-1.349 1.35L18.5 20h-2.25a.75.75 0 1 1 0-1.5H18a.5.5 0 0 0 .492-.41L18.5 18v-1.75a.75.75 0 0 1 .75-.75m-10.45 3c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2H7.2a.2.2 0 0 1-.2-.2v-1.1c0-.11.09-.2.2-.2zm4 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2h-1.6a.2.2 0 0 1-.2-.2v-1.1c0-.11.09-.2.2-.2zm.45-5.5a.75.75 0 1 1 0 1.5h-8.5a.75.75 0 1 1 0-1.5zM1.3 11c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2H.2a.2.2 0 0 1-.2-.2v-1.6c0-.11.09-.2.2-.2zm18.5 0c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2h-1.1a.2.2 0 0 1-.2-.2v-1.6c0-.11.09-.2.2-.2zm-4.55-2a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.5zM1.3 7c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2H.2a.2.2 0 0 1-.2-.2V7.2c0-.11.09-.2.2-.2zm18.5 0c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2h-1.1a.2.2 0 0 1-.2-.2V7.2c0-.11.09-.2.2-.2zm-4.55-2a.75.75 0 1 1 0 1.5h-2.5a.75.75 0 1 1 0-1.5zm-5 0a.75.75 0 1 1 0 1.5h-5.5a.75.75 0 0 1 0-1.5zm-6.5-5a.75.75 0 0 1 0 1.5H2a.5.5 0 0 0-.492.41L1.5 2v1.75a.75.75 0 0 1-1.5 0V1.5l.007-.144A1.5 1.5 0 0 1 1.356.006L1.5 0zM18.5 0l.144.007a1.5 1.5 0 0 1 1.35 1.349L20 1.5v2.25a.75.75 0 1 1-1.5 0V2l-.008-.09A.5.5 0 0 0 18 1.5h-1.75a.75.75 0 1 1 0-1.5zM8.8 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2H7.2a.2.2 0 0 1-.2-.2V.2c0-.11.09-.2.2-.2zm4 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2h-1.6a.2.2 0 0 1-.2-.2V.2c0-.11.09-.2.2-.2z"/></svg>',Uf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M1.583.45a.95.95 0 0 0-.95.95v5.3h1.5V1.95h4.75V.45zm17.05.95a.95.95 0 0 0-.95-.95h-5.3v1.5h4.75V6.7h1.5zm0 16.1a.95.95 0 0 1-.95.95h-5.3v-1.5h4.75V12.2h1.5zm-18 0c0 .525.425.95.95.95h5.3v-1.5h-4.75V12.2h-1.5zm5-10.8a.75.75 0 1 0 0 1.5h8a.75.75 0 1 0 0-1.5zm0 4a.75.75 0 1 0 0 1.5h4a.75.75 0 1 0 0-1.5z"/></svg>',jf='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.734 6.375H1.75a.75.75 0 0 1 0-1.5h1.984a2.626 2.626 0 0 1 5.032 0h9.48a.75.75 0 0 1 0 1.5h-9.48a2.626 2.626 0 0 1-5.032 0Zm1.141-.75a1.375 1.375 0 1 1 2.75 0 1.375 1.375 0 0 1-2.75 0ZM16.263 14.625h1.983a.75.75 0 0 1 0 1.5h-1.983a2.626 2.626 0 0 1-5.033 0H1.75a.75.75 0 0 1 0-1.5h9.48a2.626 2.626 0 0 1 5.033 0Zm-1.142.75a1.375 1.375 0 1 1-2.75 0 1.375 1.375 0 0 1 2.75 0Z"/></svg>\n',$f='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m6.395 9.196 2.545-.007V6.498a.6.6 0 0 1 .598-.598h.299a.6.6 0 0 1 .598.598v6.877a.6.6 0 0 1-.598.598h-.299a.6.6 0 0 1-.598-.598v-2.691l-2.545.007v2.691a.6.6 0 0 1-.598.598h-.299a.6.6 0 0 1-.598-.598V6.505a.6.6 0 0 1 .598-.598h.299a.6.6 0 0 1 .598.598zm8.699 4.221V6.462a.56.56 0 0 0-.562-.562h-.782a1 1 0 0 0-.39.08l-1.017.43a.56.56 0 0 0-.343.517v.197c0 .4.406.67.775.519l.819-.337v6.111c0 .31.251.562.561.562h.377c.31 0 .562-.251.562-.562M0 15.417v1.5h1.5v-1.5zm18.5 0v1.5H20v-1.5zm0-3.084v1.5H20v-1.5zm0-3.083v1.5H20v-1.5zm0-3.083v1.5H20v-1.5zM0 18.5v.5a1 1 0 0 0 1 1h.5v-1.5zm3.083 0V20h1.5v-1.5zm3.084 0V20h1.5v-1.5zm3.083 0V20h1.5v-1.5zm3.083 0V20h1.5v-1.5zm3.084 0V20h1.5v-1.5zm3.083 0V20h.5a1 1 0 0 0 1-1v-.5z"/><path d="M0 1a1 1 0 0 1 1-1h18a1 1 0 0 1 1 1v3.583h-1.5V1.5h-17v12.333H0z" clip-rule="evenodd"/></svg>',Wf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M3.23 2.93a.88.88 0 0 1 1.248 0l1.47 1.468q.298-.186.605-.353c1.066-.58 2.247-.992 3.438-.961 1.176.03 2.344.464 3.405 1.05 1.066.588 2.069 1.355 2.925 2.104a27 27 0 0 1 2.852 2.918l.043.052.011.016.005.004a.7.7 0 0 1 .103.183l.018.047.02.083.01.05.002.078-.003.062-.01.06q-.005.038-.016.077l-.02.06-.03.07-.01.016-.056.087-.002-.001.002.002h-.002l-.003.006-.011.014-.044.054-.161.2a26 26 0 0 1-2.693 2.803q-.414.367-.868.73l1.256 1.256a.881.881 0 0 1-.785 1.49.87.87 0 0 0-.25-.55L3.444 3.872a.9.9 0 0 0-.465-.245.88.88 0 0 1 .252-.698m1.19 4.413A25 25 0 0 0 2.58 9.204l-.013.016a.654.654 0 0 0 .006.876c.484.53 1.173 1.236 1.98 1.943.812.708 1.73 1.407 2.679 1.93.954.527 1.896.853 2.76.876.52.013 1.07-.094 1.635-.298l1.082 1.082c-.877.395-1.812.651-2.754.626-1.176-.03-2.345-.464-3.406-1.05-1.066-.587-2.068-1.354-2.924-2.103a27 27 0 0 1-2.851-2.918l-.044-.052-.01-.014-.005-.004v-.002a1 1 0 0 1-.06-.087l-.008-.014q-.022-.044-.038-.089l-.016-.04-.02-.086q-.005-.024-.007-.05-.006-.039-.003-.075v-.06q.004-.038.012-.076l.012-.056q.013-.041.03-.08l.023-.054.012-.02.055-.086h.002l-.002-.001.003-.005.012-.015.043-.054.16-.2A26 26 0 0 1 3.42 6.343zm6.057 6.058q-.247.035-.506.035a3.765 3.765 0 0 1-3.73-4.27zm-.524-8.906c-.85-.021-1.779.276-2.727.79l-.25.142L8.011 6.46a3.77 3.77 0 0 1 1.96-.555 3.765 3.765 0 0 1 3.766 3.764 3.77 3.77 0 0 1-.558 1.96l1.272 1.271c.323-.25.637-.513.936-.778a25 25 0 0 0 1.977-1.988l.015-.016a.655.655 0 0 0-.006-.878 26 26 0 0 0-1.981-1.941c-.81-.708-1.73-1.407-2.679-1.932-.954-.526-1.896-.852-2.76-.874m1.148 2.541a1.41 1.41 0 0 0-1.384 1.132l1.662 1.662a1.412 1.412 0 0 0-.278-2.794"/></svg>',Gf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><g fill-rule="evenodd"><path d="M9.972 5.906a3.765 3.765 0 1 1 0 7.53 3.765 3.765 0 0 1 0-7.53m1.13 1.13a1.412 1.412 0 1 0 0 2.823 1.412 1.412 0 0 0 0-2.824"/><path d="M9.99 3.084c1.177.03 2.345.465 3.406 1.05 1.066.588 2.07 1.355 2.925 2.105a27 27 0 0 1 2.852 2.917q.027.036.043.053l.011.015.004.003v.002q.068.084.103.183l.019.047.019.083.01.05a.7.7 0 0 1 0 .139q-.002.031-.01.06l-.016.078q-.009.029-.022.058-.012.035-.028.07l-.01.018-.056.087-.002-.002v.004l-.004.005-.012.015-.042.054-.161.198a26 26 0 0 1-2.694 2.803c-.856.762-1.863 1.537-2.933 2.117-1.066.58-2.247.992-3.438.962-1.176-.03-2.345-.465-3.406-1.05-1.066-.59-2.07-1.355-2.924-2.103a27 27 0 0 1-2.851-2.92l-.044-.052-.011-.015-.003-.004v-.001a1 1 0 0 1-.062-.088l-.006-.013-.039-.088-.016-.042q-.013-.043-.02-.086-.006-.025-.008-.05L.56 9.669v-.06q.005-.036.013-.075l.012-.056.03-.08.023-.054.012-.022.055-.083v.001h.001v-.002l.005-.005.01-.015.044-.054q.055-.071.16-.198a26 26 0 0 1 2.692-2.801c.858-.764 1.864-1.54 2.935-2.12 1.066-.58 2.247-.99 3.438-.961m-.037 1.411c-.85-.022-1.779.276-2.727.79-.943.511-1.859 1.214-2.67 1.934A24 24 0 0 0 2.58 9.207l-.014.015a.654.654 0 0 0 .007.877c.484.53 1.173 1.235 1.98 1.943.813.709 1.73 1.406 2.68 1.93.953.527 1.894.853 2.759.875.849.021 1.778-.276 2.727-.79.943-.512 1.86-1.212 2.67-1.933a25 25 0 0 0 1.977-1.989l.015-.016a.654.654 0 0 0-.007-.875 26 26 0 0 0-1.98-1.943c-.812-.71-1.73-1.407-2.68-1.932-.953-.525-1.894-.853-2.759-.874"/></g></svg>',Kf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m12.5 0 5 4.5v15.003h-16V0zM3 1.5v3.25l-1.497 1-.003 8 1.5 1v3.254L7.685 18l-.001 1.504H17.5V8.002L16 9.428l-.004-4.22-4.222-3.692z"/><path d="M4.06 6.64a.75.75 0 0 1 .958 1.15l-.085.07L2.29 9.75l2.646 1.89c.302.216.4.62.232.951l-.058.095a.75.75 0 0 1-.951.232l-.095-.058-3.5-2.5V9.14zm4.194 6.22a.75.75 0 0 1-.958-1.149l.085-.07 2.643-1.89-2.646-1.89a.75.75 0 0 1-.232-.952l.058-.095a.75.75 0 0 1 .95-.232l.096.058 3.5 2.5v1.22zm7.644-.836 2.122 2.122-5.825 5.809-2.125-.005.003-2.116zm2.539-1.847 1.414 1.414a.5.5 0 0 1 0 .707l-1.06 1.06-2.122-2.12 1.061-1.061a.5.5 0 0 1 .707 0"/></svg>',Jf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10 2.5a7.47 7.47 0 0 1 4.231 1.31 7.27 7.27 0 0 1 2.703 3.454 7.13 7.13 0 0 1 .199 4.353c-.39 1.436-1.475 2.72-2.633 3.677h2.013c0-.226.092-.443.254-.603a.876.876 0 0 1 1.229 0c.163.16.254.377.254.603v.853c0 .209-.078.41-.22.567a.87.87 0 0 1-.547.28l-.101.006h-4.695a.517.517 0 0 1-.516-.518v-1.265c0-.21.128-.398.317-.489a5.6 5.6 0 0 0 2.492-2.371 5.46 5.46 0 0 0 .552-3.693 5.53 5.53 0 0 0-1.955-3.2A5.7 5.7 0 0 0 10 4.206 5.7 5.7 0 0 0 6.419 5.46 5.53 5.53 0 0 0 4.46 8.663a5.46 5.46 0 0 0 .554 3.695 5.6 5.6 0 0 0 2.497 2.37.55.55 0 0 1 .317.49v1.264c0 .286-.23.518-.516.518H2.618a.88.88 0 0 1-.614-.25.85.85 0 0 1-.254-.603v-.853c0-.226.091-.443.254-.603a.876.876 0 0 1 1.228 0c.163.16.255.377.255.603h1.925c-1.158-.958-2.155-2.241-2.545-3.678a7.13 7.13 0 0 1 .199-4.352 7.27 7.27 0 0 1 2.703-3.455A7.5 7.5 0 0 1 10 2.5"/></svg>',Qf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 3.778C2 2.796 2.796 2 3.778 2h12.444C17.204 2 18 2.796 18 3.778v12.444c0 .982-.796 1.778-1.778 1.778H3.778A1.78 1.78 0 0 1 2 16.222z"/></svg>',Yf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M7 16.4c-.8-.4-1.5-.9-2.2-1.5a.6.6 0 0 1-.2-.5l.3-.6h1c1 1.2 2.1 1.7 3.7 1.7 1 0 1.8-.3 2.3-.6.6-.4.6-1.2.6-1.3.2-1.2-.9-2.1-.9-2.1h2.1c.3.7.4 1.2.4 1.7v.8l-.6 1.2c-.6.8-1.1 1-1.6 1.2a6 6 0 0 1-2.4.6c-1 0-1.8-.3-2.5-.6M6.8 9 6 8.3c-.4-.5-.5-.8-.5-1.6 0-.7.1-1.3.5-1.8.4-.6 1-1 1.6-1.3a6.3 6.3 0 0 1 4.7 0 4 4 0 0 1 1.7 1l.3.7c0 .1.2.4-.2.7-.4.2-.9.1-1 0a3 3 0 0 0-1.2-1c-.4-.2-1-.3-2-.4-.7 0-1.4.2-2 .6-.8.6-1 .8-1 1.5 0 .8.5 1 1.2 1.5.6.4 1.1.7 1.9 1H6.8z"/><path d="M3 10.5V9h14v1.5z"/></svg>',Zf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M15.875 4.419a.75.75 0 0 0-1.5 0v7.25H6.818l2.33-1.955a.75.75 0 0 0-.963-1.15l-3.792 3.182a.75.75 0 0 0-.17.945c.046.11.118.208.21.284l3.788 3.18a.75.75 0 1 0 .965-1.149l-2.19-1.837h7.629c.69 0 1.25-.56 1.25-1.25z"/></svg>',Xf='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m7.03 10.349 3.818-3.819a.8.8 0 1 1 1.132 1.132L8.16 11.48l3.819 3.818a.8.8 0 1 1-1.132 1.132L7.03 12.61l-3.818 3.82a.8.8 0 1 1-1.132-1.132L5.9 11.48 2.08 7.662A.8.8 0 1 1 3.212 6.53zm8.147 7.829h2.549q.38 0 .58.152a.49.49 0 0 1 .201.413.54.54 0 0 1-.159.393q-.158.162-.48.162h-3.594q-.367 0-.572-.197a.62.62 0 0 1-.205-.463q0-.171.132-.453a1.6 1.6 0 0 1 .288-.444q.65-.654 1.172-1.122t.747-.615q.401-.275.667-.553t.405-.57.139-.57a1.01 1.01 0 0 0-.554-.917 1.2 1.2 0 0 0-.56-.133q-.639 0-1.005.546a2.3 2.3 0 0 0-.164.39 1.6 1.6 0 0 1-.258.488q-.144.17-.423.17a.56.56 0 0 1-.405-.156.57.57 0 0 1-.161-.427q0-.327.151-.683.152-.357.452-.646c.3-.289.454-.349.762-.467a3 3 0 0 1 1.081-.178q.747 0 1.274.228a1.92 1.92 0 0 1 1.004 1.032 1.98 1.98 0 0 1-.156 1.794q-.3.48-.613.754-.312.273-1.048.857-.735.584-1.008.906a3 3 0 0 0-.24.309z"/></svg>',ep='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><path d="m7.184 10.353 3.818-3.819a.8.8 0 0 1 1.132 1.132l-3.82 3.818 3.82 3.818a.802.802 0 0 1-.873 1.306.8.8 0 0 1-.26-.174l-3.817-3.82-3.818 3.82a.8.8 0 0 1-1.305-.26.8.8 0 0 1 .173-.872l3.82-3.818-3.82-3.818a.8.8 0 0 1 1.132-1.132l3.818 3.82M15.68 6.88h2.549q.38 0 .58.153a.49.49 0 0 1 .201.413.54.54 0 0 1-.159.393q-.158.162-.48.162h-3.594q-.367 0-.572-.197A.62.62 0 0 1 14 7.34q0-.171.132-.453a1.6 1.6 0 0 1 .288-.444q.65-.654 1.172-1.122t.747-.615q.401-.275.667-.553.266-.277.405-.57.14-.291.139-.57a1.01 1.01 0 0 0-.554-.917 1.2 1.2 0 0 0-.56-.133q-.639 0-1.005.546a2.3 2.3 0 0 0-.164.39 1.6 1.6 0 0 1-.258.488q-.144.17-.423.17a.56.56 0 0 1-.405-.156.57.57 0 0 1-.161-.427q0-.327.151-.683.152-.357.452-.646t.762-.467A3 3 0 0 1 16.466 1q.747 0 1.274.228c.456.2.816.57 1.004 1.032a1.99 1.99 0 0 1-.156 1.794q-.3.48-.613.754-.312.273-1.048.857-.735.583-1.008.906-.131.146-.24.309z"/></svg>',tp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m11.105 18-.17 1H2.5A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1h15A1.5 1.5 0 0 1 19 2.5v9.975l-.85-.124-.15-.302V8h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5zM2 12h5V8H2zm10-4H8v4h4zM2 2v5h5V2zm0 16h5v-5H2zM13 7h5V2h-5zM8 2v5h4V2z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43zM13 6a1 1 0 0 1 1 1v3.172a2 2 0 0 0-.293.443l-.858 1.736-1.916.28-.151.027A1.98 1.98 0 0 0 9.315 14H7a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm-1 2H8v4h4z"/></svg>',ip='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1M2 2v16h16V2z" opacity=".6"/><path d="M18 7v1H2V7zm0 5v1H2v-1z" opacity=".6"/><path d="M14 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1m-2 1H8v4h4zm0 6H8v4h4zm0 6H8v4h4z"/></svg>',np='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1M2 2v16h16V2z" opacity=".6"/><path d="M7 2h1v16H7zm5 0h1v7h-1zm6 5v1H2V7zM8 12v1H2v-1z" opacity=".6"/><path d="M7 7h12a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1m1 2v9h10V9z"/></svg>',sp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M3 19a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v8.022a6.5 6.5 0 0 0-1.5-.709V2a.5.5 0 0 0-.5-.5H3a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h6.313c.173.534.412 1.037.709 1.5z"/><path d="M9.174 14a6.5 6.5 0 0 0-.155 1H6v-1zm.848-2a6.5 6.5 0 0 0-.524 1H4v-1zm2.012-2c-.448.283-.86.62-1.224 1H6v-1zM12 4v1H4V4zm2 3V6H6v1zm1 2V8H7v1z"/><path d="M20 15.5a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0M15.5 13a.5.5 0 0 0-.5.5V15h-1.5a.5.5 0 0 0 0 1H15v1.5a.5.5 0 0 0 1 0V16h1.5a.5.5 0 0 0 0-1H16v-1.5a.5.5 0 0 0-.5-.5" clip-rule="evenodd"/></svg>',op='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M8 2v5h4V2h1v5h5v1h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5H7v-5H2v-1h5V8H2V7h5V2zm4 6H8v4h4z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43zM17 1a2 2 0 0 1 2 2v9.475l-.85-.124-.857-1.736a2 2 0 0 0-.292-.44L17 3H3v14h7.808l.402.392L10.935 19H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2z"/></svg>',rp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1M2 2v16h16V2z" opacity=".6"/><path d="M7 2h1v16H7zm5 0h1v16h-1z" opacity=".6"/><path d="M1 6h18a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1m1 2v4h4V8zm6 0v4h4V8zm6 0v4h4V8z"/></svg>',ap='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M3 5.5v3h4v-3zm0 4v3h4v-3zm0 4v3h4v-3zm5 3h4v-3H8zm5 0h4v-3h-4zm4-4v-3h-4v3zm0-4v-3h-4v3zm1.5 8A1.5 1.5 0 0 1 17 18H3a1.5 1.5 0 0 1-1.5-1.5V3c.222-.863 1.068-1.5 2-1.5h13c.932 0 1.778.637 2 1.5zm-6.5-4v-3H8v3zm0-4v-3H8v3z"/></svg>',lp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M1.5 4.121C1.5 2.95 2.426 2 3.568 2h12.864c1.142 0 2.068.95 2.068 2.121V16.38c0 1.171-.926 2.121-2.068 2.121H3.568c-1.142 0-2.068-.95-2.068-2.121zm2.068-.707a.7.7 0 0 0-.69.707V6.38h14.244V4.12a.7.7 0 0 0-.69-.707zm13.554 4.38h-4.968v3.939h4.968zm0 5.353h-4.968v3.939h4.278c.381 0 .69-.317.69-.707zm-6.347 3.939V7.794H2.878v8.585c0 .39.309.707.69.707z"/></svg>',cp='<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 45 45">\n    <path fill="#F0F0F0" d="M2 0h41s2 0 2 2v41s0 2 -2 2h-41s-2 0 -2 -2v-41s0 -2 2 -2" />\n    <path fill="#D5D5D5" d="M11 10h10s1 0 1 1v24s0 1 -1 1h-10s-1 0 -1 -1v-24s0 -1 1 -1" />\n    <path fill="#D5D5D5" d="M25 10h10s1 0 1 1v10s0 1 -1 1h-10s-1 0 -1 -1v-10s0 -1 1 -1" />\n    <path fill="#D5D5D5" d="M25 24h10s1 0 1 1v10s0 1 -1 1h-10s-1 0 -1 -1v-10s0 -1 1 -1" />\n</svg>\n',up='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M8 0H3a2 2 0 0 0-2 2v15a2 2 0 0 0 2 2h5a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2M2.5 2a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v15a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5zM13 0h5a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-5a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2m0 1.5a.5.5 0 0 0-.5.5v5a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5V2a.5.5 0 0 0-.5-.5zm0 8.5h5a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-5a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2m0 1.5a.5.5 0 0 0-.5.5v5a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-5a.5.5 0 0 0-.5-.5z" clip-rule="evenodd"/></svg>',dp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M3.035 1C2.446 1 2 1.54 2 2.098V10.5h1.5v-8h13v8H18V2.098C18 1.539 17.48 1 16.9 1zm10.453 2.61a1.89 1.89 0 0 0-1.442.736 1.89 1.89 0 0 0 1.011 2.976 1.9 1.9 0 0 0 2.253-1.114 1.887 1.887 0 0 0-1.822-2.598M7.463 8.163a.6.6 0 0 0-.432.154L5.071 10.5h5.119L7.88 8.348a.63.63 0 0 0-.417-.185m6.236 1.059a.62.62 0 0 0-.42.164L12.07 10.5h2.969l-.92-1.113a.62.62 0 0 0-.42-.165M.91 11.5a.91.91 0 0 0-.91.912v6.877c0 .505.405.91.91.91h18.178a.91.91 0 0 0 .912-.91v-6.877a.91.91 0 0 0-.912-.912zM3.668 13h1.947l2.135 5.7H5.898l-.28-.946H3.601l-.278.945H1.516zm4.947 0h1.801v4.3h2.7v1.4h-4.5zm4.5 0h5.4v1.4h-1.798v4.3h-1.701v-4.3h-1.9zm-8.517 1.457-.614 2.059h1.262z"/></svg>',hp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M9.816 11.5 7.038 4.785 4.261 11.5zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663z"/><path d="m12.09 17-.534-1.292.848-1.971.545 1.319L12.113 17zm1.142-5.187.545 1.319L15.5 9.13l1.858 4.316h-3.45l.398.965h3.467L18.887 17H20l-3.873-9h-1.254z"/></svg>',mp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M14.5 10.001a1.5 1.5 0 1 0 3 0 1.5 1.5 0 0 0-3 0m-6 0a1.5 1.5 0 1 0 3 0 1.5 1.5 0 0 0-3 0m-6 0a1.5 1.5 0 1 0 3 0 1.5 1.5 0 0 0-3 0"/></svg>',gp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m5.977 2 .708 1.914A2.06 2.06 0 0 0 7.902 5.13l1.914.708-1.914.709a2.06 2.06 0 0 0-1.217 1.216l-.708 1.914-.708-1.914a2.06 2.06 0 0 0-1.216-1.216l-1.914-.709 1.914-.708a2.06 2.06 0 0 0 1.216-1.216zm6.87 3.417 1.135 3.067a3.3 3.3 0 0 0 1.95 1.95L19 11.57l-3.067 1.135a3.3 3.3 0 0 0-1.95 1.95l-1.136 3.067-1.135-3.067a3.3 3.3 0 0 0-1.95-1.95l-3.068-1.136 3.068-1.135a3.3 3.3 0 0 0 1.95-1.95zm-8.418 8.276-.534-1.443-.534 1.443c-.158.425-.493.76-.918.918L1 15.145l1.443.534c.425.157.76.492.918.917l.534 1.443.534-1.443a1.55 1.55 0 0 1 .917-.917l1.443-.534-1.443-.534a1.55 1.55 0 0 1-.917-.918"/></svg>',fp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><circle cx="9.5" cy="4.5" r="1.5"/><circle cx="9.5" cy="10.5" r="1.5"/><circle cx="9.5" cy="16.5" r="1.5"/></svg>',pp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M6.05 8.609v8.38c0 1.11.903 2.01 2.017 2.01h7.553c.896 0 1.684-.588 1.936-1.445l2.361-8.041a2.012 2.012 0 0 0-1.935-2.575h-4.353l.788-2.618a2.01 2.01 0 0 0-1.294-2.485l-.698-.232a2.02 2.02 0 0 0-2.269.725l-3.72 5.098c-.25.344-.386.758-.386 1.183m1.513 8.38V8.61c0-.107.034-.21.096-.296l3.72-5.099a.505.505 0 0 1 .567-.18l.699.231a.5.5 0 0 1 .323.621l-1.177 3.912a.503.503 0 0 0 .483.647h5.708c.336 0 .578.322.484.644l-2.362 8.041a.504.504 0 0 1-.484.362H8.067a.503.503 0 0 1-.504-.503M3.328 6.937H1.714C.767 6.937 0 7.703 0 8.647v8.644C0 18.234.767 19 1.714 19h1.614c.946 0 1.714-.766 1.714-1.71V8.647c0-.943-.768-1.709-1.714-1.709m-1.815 1.71c0-.112.09-.202.201-.202h1.614c.111 0 .201.09.201.201v8.645a.2.2 0 0 1-.201.2H1.714a.2.2 0 0 1-.201-.2z" clip-rule="evenodd"/></svg>',bp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M13.95 11.89V3.51c0-1.11-.903-2.01-2.017-2.01H4.38c-.896 0-1.684.589-1.936 1.446l-2.361 8.04a2.012 2.012 0 0 0 1.935 2.576h4.353l-.788 2.618a2.01 2.01 0 0 0 1.294 2.485l.698.232a2.02 2.02 0 0 0 2.269-.725l3.72-5.099c.25-.343.386-.757.386-1.182m-1.513-8.38v8.38c0 .107-.034.21-.096.296l-3.72 5.1a.505.505 0 0 1-.567.18l-.699-.232a.5.5 0 0 1-.323-.62L8.209 12.7a.503.503 0 0 0-.483-.647H2.018a.503.503 0 0 1-.484-.643l2.362-8.042a.504.504 0 0 1 .484-.361h7.553c.278 0 .504.225.504.502m4.235 10.053h1.614c.947 0 1.714-.765 1.714-1.709V3.21c0-.944-.767-1.709-1.714-1.709h-1.614c-.946 0-1.714.765-1.714 1.709v8.644c0 .944.768 1.709 1.714 1.709m1.815-1.709c0 .111-.09.201-.201.201h-1.614a.2.2 0 0 1-.201-.2V3.208c0-.111.09-.201.201-.201h1.614a.2.2 0 0 1 .201.2z" clip-rule="evenodd"/></svg>',wp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m2.315 14.705 2.224-2.24a.69.69 0 0 1 .963 0 .664.664 0 0 1 0 .949L2.865 16.07a.7.7 0 0 1-.112.089.65.65 0 0 1-.852-.051L.688 14.886a.635.635 0 0 1 0-.903.647.647 0 0 1 .91 0zm5.185.045a.75.75 0 0 1 .75-.75h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75M2.329 5.745l2.21-2.226a.69.69 0 0 1 .963 0 .664.664 0 0 1 0 .95L2.865 7.125a.7.7 0 0 1-.496.196.64.64 0 0 1-.468-.187L.688 5.912a.635.635 0 0 1 0-.903.647.647 0 0 1 .91 0l.73.736zM7.5 5.75A.75.75 0 0 1 8.25 5h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75"/></svg>',vp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 2.28C2 1.574 2.574 1 3.272 1l11.456.001c.703 0 1.272.573 1.272 1.28v8.453l-1.5 1.464V2.465c0-.003-11-.005-11-.005V16.5h2.356q.188.34.462.62l.868.88-3.914-.001A1.274 1.274 0 0 1 2 16.719z"/><path d="M14.525 18H9.293l-1.48-1.5h3.75l.332.336.344-.336H14.5v-2.207L16 12.83v3.73zm-4.819-5.362a2.84 2.84 0 0 0-1.38-.36 2.8 2.8 0 0 0-1.602.5H6.18a.635.635 0 0 1-.633-.639.64.64 0 0 1 .633-.639h3.133a.639.639 0 0 1 .393 1.138m-4.16-6.484c0-.353.292-.64.636-.64h5.682a.637.637 0 0 1 .449 1.09.64.64 0 0 1-.449.188H6.182a.636.636 0 0 1-.635-.639zm0 2.984c0-.352.292-.638.636-.638h5.682a.635.635 0 0 1 .45 1.088.64.64 0 0 1-.45.189H6.182a.636.636 0 0 1-.636-.639"/><path d="m13.117 19.374 6.192-6.044a1.316 1.316 0 0 0 0-1.876 1.354 1.354 0 0 0-1.899 0l-5.515 5.382-2.63-2.666a1.3 1.3 0 0 0-.938-.393 1.32 1.32 0 0 0-.939.394 1.354 1.354 0 0 0 0 1.898l3.49 3.538a1.32 1.32 0 0 0 1.447.29 2.7 2.7 0 0 0 .792-.523" style="fill:#1fb11f"/></svg>',_p='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 2.28C2 1.574 2.574 1 3.272 1l11.456.001c.703 0 1.272.573 1.272 1.28v8.106l-.889.899-.611-.619V2.465c0-.003-11-.005-11-.005V16.5h6.458l-.136.138-.003.003c-.372.378-.628.85-.745 1.359l-5.802-.001A1.274 1.274 0 0 1 2 16.719zM14.338 18h-3.676q.09-.169.227-.308l1.178-1.192H14.5v-3.699l.61.618.89-.899v4.199c0 .383-.168.726-.431.96l-.457-.462z"/><path d="M9.043 11.5a2.85 2.85 0 0 0 .066 1.278H6.18a.635.635 0 0 1-.632-.639.64.64 0 0 1 .633-.639h2.863Zm3.45-2.267a2.82 2.82 0 0 0-2.434.544H6.182a.636.636 0 0 1-.636-.639c0-.352.292-.638.636-.638h5.682a.635.635 0 0 1 .629.733M5.546 6.154c0-.353.292-.64.636-.64h5.682a.637.637 0 0 1 .449 1.09.64.64 0 0 1-.449.188H6.182a.636.636 0 0 1-.635-.639z"/><path d="m15.11 13.42 2.348-2.374a1.32 1.32 0 0 1 1.877 0 1.354 1.354 0 0 1 0 1.9l-2.346 2.372 2.346 2.374a1.354 1.354 0 0 1 0 1.898 1.316 1.316 0 0 1-1.877 0l-2.346-2.373-2.346 2.373a1.316 1.316 0 0 1-1.877 0 1.354 1.354 0 0 1 0-1.898l2.346-2.374-2.346-2.373a1.354 1.354 0 0 1 0-1.899 1.32 1.32 0 0 1 1.877 0l2.346 2.374z" style="fill:#da2020"/></svg>',yp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M6.182 5.514a.643.643 0 0 0-.636.64v-.001a.636.636 0 0 0 .636.639h5.682a.64.64 0 0 0 .636-.638.637.637 0 0 0-.636-.64zm0 2.986a.642.642 0 0 0-.588.882.64.64 0 0 0 .588.395h5.682a.64.64 0 0 0 .636-.639.635.635 0 0 0-.636-.638zm-.002 3a.64.64 0 0 0 0 1.278h3.133a.64.64 0 0 0 0-1.278zm5.592 6.808.154-.23q-.292-.148-.328-.28-.037-.135.076-.551.093-.248.11-.393a3 3 0 0 0 0-.479q-.206-.614-.186-.83.02-.218.313-.57l4.465-6.207q.534-.9 2.11.118 1.576 1.021 1.177 1.772l-3.876 6.833q-.157.407-.347.515c-.128.07-.4.119-.813.139a3 3 0 0 0-.487.21q-.191.135-.347.31-.29.261-.416.262-.095 0-.346-.15l-.204.27zm-.184.274 1.039.727-.26.34h-1.496z"/><path d="M3.272 1A1.28 1.28 0 0 0 2 2.28v14.439a1.276 1.276 0 0 0 1.272 1.28h6.838a2.1 2.1 0 0 1 .003-.61 4 4 0 0 1 .156-.67l.025-.069v-.008l-.042-.142H3.5V2.46s11 .002 11 .005v6.341l.627-.872c.204-.32.49-.614.873-.819V2.281c0-.707-.569-1.28-1.272-1.28zM16 9.29l-1.5 2.085V16.5h-2.708q.007.177-.007.354l-.013.075-.001.005a3 3 0 0 1-.097.312q-.04.152-.062.266a.7.7 0 0 0-.014.287.25.25 0 0 0 .068.105 1 1 0 0 0 .088.074l.017.011.016.01h.175L14.73 18c.697 0 1.271-.573 1.271-1.281v-7.43Z" clip-rule="evenodd"/></svg>',kp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M3 18v-1.5h14V18zm2.2-8V3.6c0-.4.4-.6.8-.6.3 0 .7.2.7.6v6.2c0 2 1.3 2.8 3.2 2.8s3.4-.9 3.4-2.9V3.6c0-.3.4-.5.8-.5.3 0 .7.2.7.5V10c0 2.7-2.2 4-4.9 4-2.6 0-4.7-1.2-4.7-4"/></svg>',Cp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m5.042 9.367 2.189 1.837a.75.75 0 0 1-.965 1.149l-3.788-3.18a.75.75 0 0 1-.21-.284.75.75 0 0 1 .17-.945L6.23 4.762a.75.75 0 1 1 .964 1.15L4.863 7.866h8.917A.8.8 0 0 1 14 7.9a4 4 0 1 1-1.477 7.718l.344-1.489a2.5 2.5 0 1 0 1.094-4.73l.008-.032z"/></svg>',xp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.8.8 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.7.7 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294zm5.494-5.335a.8.8 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.8.8 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955m-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184m4.919 10.562-1.414 1.414a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.061-1.06l1.414 1.414 1.414-1.415a.75.75 0 0 1 1.061 1.061l-1.414 1.414 1.414 1.415a.75.75 0 0 1-1.06 1.06z"/></svg>',Ap='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M1.201 1C.538 1 0 1.47 0 2.1v14.363c0 .64.534 1.037 1.186 1.037H5.06l5.058-5.078L6.617 9.15a.696.696 0 0 0-.957-.033L1.5 13.6V2.5h15v4.354a3.5 3.5 0 0 1 1.5.049V2.1c0-.63-.547-1.1-1.2-1.1zm11.713 2.803a2.147 2.147 0 0 0-2.049 1.992 2.14 2.14 0 0 0 1.28 2.096 2.13 2.13 0 0 0 2.642-3.11 2.13 2.13 0 0 0-1.873-.978M8.089 17.635v2.388h2.389l7.046-7.046-2.39-2.39zm11.282-6.507a.64.64 0 0 0 .139-.692.6.6 0 0 0-.139-.205l-1.49-1.488a.63.63 0 0 0-.899 0l-1.166 1.163 2.39 2.39z"/></svg>',Ep='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 21 21"><path d="M1.801 1.4C1.138 1.4.6 1.87.6 2.5v14.363c0 .64.534 1.037 1.186 1.037h9.494a3 3 0 0 1-.414-.287A3 3 0 0 1 9.81 15.59v-.007a3 3 0 0 1 .693-2.186l.383-.455-.02.018-3.65-3.41a.695.695 0 0 0-.957-.034L2.1 14V2.9h15v5.535a2.97 2.97 0 0 1 1.412.932l.088.105V2.5c0-.63-.547-1.1-1.2-1.1zm11.713 2.803a2.146 2.146 0 0 0-2.049 1.992 2.14 2.14 0 0 0 1.28 2.096 2.13 2.13 0 0 0 2.644-3.11 2.13 2.13 0 0 0-1.875-.978"/><path d="M16.122 19.5a.79.79 0 0 0 .79-.79v-5.373l2.059 2.455a.79.79 0 0 0 1.211-1.015l-3.351-3.995a.79.79 0 0 0-.996-.179.8.8 0 0 0-.299.221l-3.35 3.99a.79.79 0 1 0 1.21 1.017l1.936-2.306v5.185c0 .436.353.79.79.79"/><path d="M16.122 19.5a.79.79 0 0 0 .79-.79v-5.373l2.059 2.455a.79.79 0 0 0 1.211-1.015l-3.351-3.995a.79.79 0 0 0-.996-.179.8.8 0 0 0-.299.221l-3.35 3.99a.79.79 0 1 0 1.21 1.017l1.936-2.306v5.185c0 .436.353.79.79.79"/></svg>',Tp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M12.748 2a4.62 4.62 0 0 0-3.174 1.362L8.02 4.915a.783.783 0 0 0 .002 1.11.786.786 0 0 0 1.11 0l1.55-1.553c1.185-1.185 3.024-1.195 4.116-.104l.851.854c1.092 1.091 1.083 2.927-.101 4.11l-1.555 1.554a.787.787 0 0 0 .557 1.34.78.78 0 0 0 .553-.23l1.554-1.552c1.758-1.757 1.838-4.597.102-6.332l-.854-.853A4.3 4.3 0 0 0 12.748 2m-.488 4.973a.78.78 0 0 0-.553.23L7.2 11.71l-.004.002a.784.784 0 0 0 1.11 1.107l.003-.002 4.504-4.505a.785.785 0 0 0-.554-1.339Zm-6.79.815a.8.8 0 0 0-.554.234L3.36 9.573c-1.757 1.758-1.836 4.597-.101 6.332l.853.852c1.736 1.734 4.572 1.655 6.33-.102l1.547-1.547.006-.008a.78.78 0 0 0 .244-.554.78.78 0 0 0-.799-.797.77.77 0 0 0-.56.248l-1.545 1.547c-1.184 1.184-3.021 1.195-4.113.104l-.854-.854c-1.091-1.091-1.083-2.927.102-4.111l1.552-1.555a.8.8 0 0 0 .233-.555.8.8 0 0 0-.06-.3.8.8 0 0 0-.173-.253s-.104-.14-.183-.185c-.051-.03-.133-.047-.37-.047Z"/></svg>',Sp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11 10"><path d="M5.5 5C8.538 5 11 7.015 11 9.5q0 .255-.034.5H.034A4 4 0 0 1 0 9.5C0 7.015 2.462 5 5.5 5m0-5a2.5 2.5 0 1 1 0 5 2.5 2.5 0 0 1 0-5"/></svg>',Ip='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M3.273 17.818 2 18l.182-1.273 4.363-4.363 1.091 1.09zM18 7.818c-.897.897-1.997 1.284-2.847.732l-2.971 3.632c1.205 1.205.841 2.795-.364 4l-8-8c1.205-1.205 2.795-1.569 4-.364l3.632-2.972c-.552-.85-.165-1.949.732-2.846z"/></svg>',Pp='<svg width="12" height="12" viewBox="0 0 13 13" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M12 6C12 9.31371 9.31371 12 6 12C2.68629 12 0 9.31371 0 6C0 2.68629 2.68629 0 6 0C9.31371 0 12 2.68629 12 6ZM5.27988 2.40003H6.71988V6.72003H5.27988V2.40003ZM6.72009 8.16003H5.28009V9.60003H6.72009V8.16003Z" fill="#DB3700"/>\n</svg>\n',Vp='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M20 10.001c0 5.523-4.477 10-10 10s-10-4.477-10-10 4.477-10 10-10 10 4.477 10 10m-9.662 8.493a9 9 0 0 1-.676 0c-.838-1.316-1.492-2.931-1.877-4.743h4.43c-.385 1.812-1.039 3.427-1.877 4.743m1.815-.268c.671-1.327 1.184-2.84 1.497-4.475h3.98a8.52 8.52 0 0 1-5.477 4.475m6.046-5.975a8.5 8.5 0 0 0 .301-2.25 8.5 8.5 0 0 0-.301-2.25h-4.323a20.3 20.3 0 0 1 0 4.5zm-.569-6a8.52 8.52 0 0 0-5.477-4.475c.671 1.327 1.184 2.84 1.497 4.475zm-7.292-4.743c.838 1.316 1.492 2.93 1.877 4.743h-4.43c.385-1.812 1.039-3.427 1.877-4.743a9 9 0 0 1 .676 0m-2.49.268c-.672 1.327-1.185 2.84-1.498 4.475H2.37a8.52 8.52 0 0 1 5.477-4.475M1.8 7.751a8.5 8.5 0 0 0-.301 2.25c0 .779.105 1.533.301 2.25h4.323a20.3 20.3 0 0 1 0-4.5zm.569 6a8.52 8.52 0 0 0 5.477 4.475c-.671-1.327-1.184-2.84-1.497-4.475zm10.095-1.5h-4.93a18.5 18.5 0 0 1 0-4.5h4.93a18.5 18.5 0 0 1 0 4.5" clip-rule="evenodd"/></svg>';class Rp extends Cs{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",true),this.set("isVisible",true),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"),"aria-hidden":true}});}render(){super.render(),this._updateXMLContent(),this._colorFillPaths(),this.on("change:content",()=>{this._updateXMLContent(),this._colorFillPaths();}),this.on("change:fillColor",()=>{this._colorFillPaths();});}_updateXMLContent(){if(this.content){const e=(new DOMParser).parseFromString(this.content.trim(),"image/svg+xml").querySelector("svg");if(!e)throw new I("ui-iconview-invalid-svg",this);const t=e.getAttribute("viewBox");t&&(this.viewBox=t);for(const{name:t,value:i}of Array.from(e.attributes))Rp.presentationalAttributeNames.includes(t)&&this.element.setAttribute(t,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 Op extends Cs{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 Bp extends Cs{children;labelView;iconView;keystrokeView;_focusDelayed=null;constructor(e,t=new Op){super(e);const i=this.bindTemplate,s=A();this.set("_ariaPressed",false),this.set("_ariaChecked",false),this.set("ariaLabel",void 0),this.set("ariaLabelledBy",`ck-editor__aria-label_${s}`),this.set("class",void 0),this.set("labelStyle",void 0),this.set("icon",void 0),this.set("isEnabled",true),this.set("isOn",false),this.set("isVisible",true),this.set("isToggleable",false),this.set("keystroke",void 0),this.set("label",void 0),this.set("role",void 0),this.set("tabindex",-1),this.set("tooltip",false),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",false),this.set("withKeystroke",false),this.children=this.createCollection(),this.labelView=this._setupLabelView(t),this.iconView=new Rp,this.iconView.extendTemplate({attributes:{class:"ck-button__icon"}}),this.iconView.bind("content").to(this,"icon"),this.keystrokeView=this._createKeystrokeView(),this.bind("_tooltipString").to(this,"tooltip",this,"label",this,"keystroke",this._getTooltipString.bind(this));const o={tag:"button",attributes:{class:["ck","ck-button",i.to("class"),i.if("isEnabled","ck-disabled",e=>!e),i.if("isVisible","ck-hidden",e=>!e),i.to("isOn",e=>e?"ck-on":"ck-off"),i.if("withText","ck-button_with-text"),i.if("withKeystroke","ck-button_with-keystroke")],role:i.to("role"),type:i.to("type",e=>e||"button"),tabindex:i.to("tabindex"),"aria-checked":i.to("_ariaChecked"),"aria-pressed":i.to("_ariaPressed"),"aria-label":i.to("ariaLabel"),"aria-labelledby":i.to("ariaLabelledBy"),"aria-disabled":i.if("isEnabled",true,e=>!e),"data-cke-tooltip-text":i.to("_tooltipString"),"data-cke-tooltip-position":i.to("tooltipPosition")},children:this.children,on:{click:i.to(e=>{this.isEnabled?this.fire("execute"):e.preventDefault();})}};this.bind("_ariaPressed").to(this,"isOn",this,"isToggleable",this,"role",(e,t,i)=>!(!t||Lp(i))&&String(!!e)),this.bind("_ariaChecked").to(this,"isOn",this,"isToggleable",this,"role",(e,t,i)=>!(!t||!Lp(i))&&String(!!e)),n.isSafari&&(this._focusDelayed||(this._focusDelayed=Fn(()=>this.focus(),0)),o.on.mousedown=i.to(()=>{this._focusDelayed();}),o.on.mouseup=i.to(()=>{this._focusDelayed.cancel();})),this.setTemplate(o);}render(){super.render(),this.icon&&this.children.add(this.iconView),this.on("change:icon",(e,t,i,n)=>{i&&!n?this.children.add(this.iconView,0):!i&&n&&this.children.remove(this.iconView);}),this.children.add(this.labelView),this.withKeystroke&&this.keystroke&&this.children.add(this.keystrokeView);}focus(){this.element.focus();}destroy(){this._focusDelayed&&this._focusDelayed.cancel(),super.destroy();}_setupLabelView(e){return e.bind("text","style","id").to(this,"label","labelStyle","ariaLabelledBy"),e}_createKeystrokeView(){const e=new Cs;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__keystroke"]},children:[{text:this.bindTemplate.to("keystroke",e=>cn(e))}]}),e}_getTooltipString(e,t,i){return e?"string"==typeof e?e:(i&&(i=cn(i)),e instanceof Function?e(t,i):`${t}${i?` (${i})`:""}`):""}}function Lp(e){switch(e){case "radio":case "checkbox":case "option":case "switch":case "menuitemcheckbox":case "menuitemradio":return  true;default:return  false}}class Mp extends Cs{children;iconView;constructor(e,t={}){super(e);const i=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",i.to("class")]},children:this.children}),t.icon&&(this.iconView=new Rp,this.iconView.content=t.icon,this.children.add(this.iconView));const n=new Cs(e);n.setTemplate({tag:"h2",attributes:{class:["ck","ck-form__header__label"],role:"presentation"},children:[{text:i.to("label")}]}),this.children.add(n);}}class Fp extends(z()){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 i=e.actions[t];"string"==typeof i&&(i=[i]);for(const n of i)e.keystrokeHandler.set(n,(e,i)=>{this[t](),i();},e.keystrokeHandlerOptions);}this.on("forwardCycle",()=>this.focusFirst(),{priority:"low"}),this.on("backwardCycle",()=>this.focusLast(),{priority:"low"});}get first(){return this.focusables.find(Np)||null}get last(){return this.focusables.filter(Np).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,i)=>{const n=t.element===this.focusTracker.focusedElement;return n&&(e=i),n}),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 i=t();this.focusNext(),i!==t()&&e.stop();},{priority:"low"}),this.listenTo(e,"backwardCycle",e=>{const i=t();this.focusPrevious(),i!==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 i=this.current;if(null===i)return this[1===e?"first":"last"];let n=this.focusables.get(i),s=(i+t+e)%t;do{const i=this.focusables.get(s);if(Np(i)){n=i;break}s=(s+t+e)%t;}while(s!==i);return n}}function Np(e){return Dp(e)&&Fi(e.element)}function Dp(e){return !(!("focus"in e)||"function"!=typeof e.focus)}function zp(e){return Dp(e)&&"focusCycler"in e&&e.focusCycler instanceof Fp}class Hp extends Cs{children;keystrokes;focusCycler;_focusTracker;_focusables;constructor(e){super(e),this.children=this.createCollection(),this.keystrokes=new In,this._focusTracker=new An,this._focusables=new Xn,this.focusCycler=new Fp({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 Bp(this.locale);let i;for(i in e.on("execute",()=>t.onExecute()),t.onCreate&&t.onCreate(e),t)"onExecute"!=i&&"onCreate"!=i&&e.set(i,t[i]);this.children.add(e);}this._updateFocusCyclableItems();}focus(e){ -1===e?this.focusCycler.focusLast():this.focusCycler.focusFirst();}_updateFocusCyclableItems(){Array.from(this.children).forEach(e=>{this._focusables.add(e),this._focusTracker.add(e.element);});}}class qp extends Cs{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 Up={SCREEN_CENTER:"screen-center",EDITOR_CENTER:"editor-center",EDITOR_TOP_SIDE:"editor-top-side",EDITOR_TOP_CENTER:"editor-top-center",EDITOR_BOTTOM_CENTER:"editor-bottom-center",EDITOR_ABOVE_CENTER:"editor-above-center",EDITOR_BELOW_CENTER:"editor-below-center"},jp=Ri("px");class $p extends(Ps(Cs)){parts;headerView;closeButtonView;actionsView;static defaultOffset=15;contentView;keystrokes;focusTracker;wasMoved=false;_getCurrentDomRoot;_getViewportOffset;_focusables;_focusCycler;constructor(e,{getCurrentDomRoot:t,getViewportOffset:i,keystrokeHandlerOptions:n}){super(e);const s=this.bindTemplate,o=e.t;this.set("className",""),this.set("ariaLabel",o("Editor dialog")),this.set("isModal",false),this.set("position",Up.SCREEN_CENTER),this.set("_isVisible",false),this.set("_isTransparent",false),this.set("_top",0),this.set("_left",0),this._getCurrentDomRoot=t,this._getViewportOffset=i,this.decorate("moveTo"),this.parts=this.createCollection(),this.keystrokes=new In,this.focusTracker=new An,this._focusables=new Xn,this._focusCycler=new Fp({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"},keystrokeHandlerOptions:n}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-dialog-overlay",s.if("isModal","ck-dialog-overlay__transparent",e=>!e),s.if("_isVisible","ck-hidden",e=>!e)],tabindex:"-1"},children:[{tag:"div",attributes:{tabindex:"-1",class:["ck","ck-dialog",s.if("isModal","ck-dialog_modal"),s.to("className")],role:"dialog","aria-label":s.to("ariaLabel"),style:{top:s.to("_top",e=>jp(e)),left:s.to("_left",e=>jp(e)),visibility:s.if("_isTransparent","hidden")}},children:this.parts}]});}render(){super.render(),this.keystrokes.set("Esc",(e,t)=>{e.defaultPrevented||(this.fire("close",{source:"escKeyPress"}),t());}),this.on("drag",(e,{deltaX:t,deltaY:i})=>{this.wasMoved=true,this.moveBy(t,i);}),this.listenTo(exports.global.window,"resize",()=>{this._isVisible&&!this.wasMoved&&this.updatePosition();}),this.listenTo(exports.global.document,"scroll",()=>{this._isVisible&&!this.wasMoved&&this.updatePosition();}),this.on("change:_isVisible",(e,t,i)=>{i&&(this._isTransparent=true,setTimeout(()=>{this.updatePosition(),this._isTransparent=false,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:i=true,content:n,actionButtons:s}){t&&(this.headerView=new Mp(this.locale,{icon:e}),i&&(this.closeButtonView=this._createCloseButton(),this.headerView.children.add(this.closeButtonView)),this.headerView.label=t,this.ariaLabel=t,this.parts.add(this.headerView,0)),n&&(n instanceof Cs&&(n=[n]),this.contentView=new qp(this.locale),this.contentView.children.addMany(n),this.parts.add(this.contentView)),s&&(this.actionsView=new Hp(this.locale),this.actionsView.setButtons(s),this.parts.add(this.actionsView)),this._updateFocusCyclableItems();}focus(){this._focusCycler.focusFirst();}moveTo(e,t){const i=this._getViewportRect(),n=this._getDialogRect();e+n.width>i.right&&(e=i.right-n.width),e<i.left&&(e=i.left),t<i.top&&(t=i.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,i=this.position;this._getCurrentDomRoot()?t=this._getVisibleDomRootRect(e):i=Up.SCREEN_CENTER;const n=$p.defaultOffset,s=this._getDialogRect();if(null!=this.position){if("function"==typeof this.position){const e=this.position(s,t);return null==e?void this._moveOffScreen():void this._moveTo(e.left,e.top)}switch(i){case Up.EDITOR_TOP_SIDE:if(t){const e="ltr"===this.locale.contentLanguageDirection?t.right-s.width-n:t.left+n;this.moveTo(e,t.top+n);}else this._moveOffScreen();break;case Up.EDITOR_CENTER: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 Up.SCREEN_CENTER:this.moveTo(Math.round((e.width-s.width)/2),Math.round((e.height-s.height)/2));break;case Up.EDITOR_TOP_CENTER:t?this.moveTo(Math.round(t.left+t.width/2-s.width/2),t.top+n):this._moveOffScreen();break;case Up.EDITOR_BOTTOM_CENTER:t?this.moveTo(Math.round(t.left+t.width/2-s.width/2),t.bottom-s.height-n):this._moveOffScreen();break;case Up.EDITOR_ABOVE_CENTER:t?this.moveTo(Math.round(t.left+t.width/2-s.width/2),t.top-s.height-n):this._moveOffScreen();break;case Up.EDITOR_BELOW_CENTER:t?this.moveTo(Math.round(t.left+t.width/2-s.width/2),t.bottom+n):this._moveOffScreen();}}}_getVisibleDomRootRect(e){let t=new Ci(this._getCurrentDomRoot()).getVisible();return t?(t=e.getIntersection(t),t||null):null}_getDialogRect(){return new Ci(this.element.firstElementChild)}_getViewportRect(){const t=new Ci(exports.global.window);return this.isModal?t:zi(this._getViewportOffset())}_updateFocusCyclableItems(){const e=[];if(this.contentView)for(const t of this.contentView.children)Dp(t)&&e.push(t);this.actionsView&&e.push(this.actionsView),this.closeButtonView&&e.push(this.closeButtonView),e.forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element),zp(e)&&this._focusCycler.chain(e.focusCycler);});}_createCloseButton(){const e=new Bp(this.locale),t=this.locale.t;return e.set({label:t("Close"),tooltip:true,icon:pm}),e.on("execute",()=>this.fire("close",{source:"closeButton"})),e}}class Wp extends Ms{view;static _visibleDialogPlugin;_onHide;static get pluginName(){return "Dialog"}static get isOfficialPlugin(){return  true}constructor(e){super(e);const t=e.t;this._initShowHideListeners(),this._initFocusToggler(),this._initMultiRootIntegration(),this.set({id:null,isOpen:false}),e.accessibility.addKeystrokeInfos({categoryId:"navigation",keystrokes:[{label:t("Move focus in and out of an active dialog window"),keystroke:"Ctrl+F6",mayRequireFn:true}]});}destroy(){super.destroy(),Wp._visibleDialogPlugin===this&&this._unlockBodyScroll();}_initShowHideListeners(){this.on("show",(e,t)=>{this._show(t);}),this.on("show",(e,t)=>{t.onShow&&t.onShow(this);},{priority:"low"}),this.on("hide",()=>{Wp._visibleDialogPlugin&&Wp._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,i)=>{this.isOpen&&!this.view.isModal&&(this.view.focusTracker.isFocused?e.editing.view.focus():this.view.focus(),i());});}_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:i,hasCloseButton:n=true,content:s,actionButtons:o,className:r,isModal:a,position:l,onHide:c,keystrokeHandlerOptions:u}){const d=this.editor;this.view=new $p(d.locale,{getCurrentDomRoot:()=>d.editing.view.getDomRoot(d.model.document.selection.anchor.root.rootName),getViewportOffset:()=>d.ui.viewportOffset,keystrokeHandlerOptions:u});const h=this.view;h.on("close",()=>{this.hide();}),d.ui.view.body.add(h),d.keystrokes.listenTo(h.element),l||(l=a?Up.SCREEN_CENTER:Up.EDITOR_CENTER),a&&this._lockBodyScroll(),h.set({position:l,_isVisible:true,className:r,isModal:a}),h.setupParts({icon:t,title:i,hasCloseButton:n,content:s,actionButtons:o}),this.id=e,c&&(this._onHide=c),this.isOpen=true,Wp._visibleDialogPlugin=this;}hide(){Wp._visibleDialogPlugin&&Wp._visibleDialogPlugin.fire(`hide:${Wp._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=false,Wp._visibleDialogPlugin=null;}_lockBodyScroll(){document.documentElement.classList.add("ck-dialog-scroll-locked");}_unlockBodyScroll(){document.documentElement.classList.remove("ck-dialog-scroll-locked");}}class Gp extends Bp{_checkIconHolderView=new Kp;constructor(e,t=new Op){super(e,t),this.set({hasCheckSpace:false,_hasCheck:this.isToggleable});const i=this.bindTemplate;this.extendTemplate({attributes:{class:["ck-list-item-button",i.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,i)=>{const{children:n,_checkIconHolderView:s}=this;i?n.add(s,0):n.remove(s);});}}class Kp extends Cs{children;_checkIconView=this._createCheckIconView();constructor(){super();const e=this.bindTemplate;this.children=this.createCollection(),this.set("isOn",false),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,i)=>{const{children:n,_checkIconView:s}=this;i&&!n.has(s)?n.add(s):!i&&n.has(s)&&n.remove(s);});}_createCheckIconView(){const e=new Rp;return e.content=vm,e.extendTemplate({attributes:{class:"ck-list-item-button__check-icon"}}),e}}class Jp extends Gp{constructor(e){super(e),this.set({withText:true,withKeystroke:true,tooltip:false,role:"menuitem"}),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item__button"]}});}}class Qp extends Ms{contentView=null;static get requires(){return [Wp]}static get pluginName(){return "AccessibilityHelp"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.locale.t;e.ui.componentFactory.add("accessibilityHelp",()=>{const e=this._createButton(Bp);return e.set({tooltip:true,withText:false,label:t("Accessibility help")}),e}),e.ui.componentFactory.add("menuBar:accessibilityHelp",()=>{const e=this._createButton(Jp);return e.label=t("Accessibility"),e}),e.keystrokes.set("Alt+0",(e,t)=>{this._toggleDialog(),t();}),this._setupRootLabels();}_createButton(e){const t=this.editor,i=t.plugins.get("Dialog"),n=new e(t.locale);return n.set({keystroke:"Alt+0",icon:Bh,isToggleable:true}),n.on("execute",()=>this._toggleDialog()),n.bind("isOn").to(i,"id",e=>"accessibilityHelp"===e),n}_setupRootLabels(){const e=this.editor,t=e.editing.view,i=e.t;function n(e,t){const n=[t.getAttribute("aria-label"),i("Press %0 for help.",[cn("Alt+0")])].filter(e=>e).join(". ");e.setAttribute("aria-label",n,t);}e.ui.on("ready",()=>{t.change(e=>{for(const i of t.document.roots)n(e,i);}),e.on("addRoot",(i,s)=>{const o=e.editing.view.document.getRoot(s.rootName);t.change(e=>n(e,o));},{priority:"low"});});}_toggleDialog(){const e=this.editor,t=e.plugins.get("Dialog"),i=e.locale.t;this.contentView||(this.contentView=new Bs(e.locale,e.accessibility.keystrokeInfos)),"accessibilityHelp"===t.id?t.hide():t.show({id:"accessibilityHelp",className:"ck-accessibility-help-dialog",title:i("Accessibility help"),icon:Bh,hasCloseButton:true,content:this.contentView});}}class Yp extends Xn{locale;_bodyCollectionContainer;static _bodyWrapper;constructor(e,t=[]){super(t),this.locale=e;}get bodyCollectionContainer(){return this._bodyCollectionContainer}attachToDom(){this._bodyCollectionContainer=new es({tag:"div",attributes:{class:["ck","ck-reset_all","ck-body","ck-rounded-corners"],dir:this.locale.uiLanguageDirection,role:"application"},children:this}).render(),Yp._bodyWrapper&&Yp._bodyWrapper.isConnected||(Yp._bodyWrapper=ii(document,"div",{class:"ck-body-wrapper"}),document.body.appendChild(Yp._bodyWrapper)),Yp._bodyWrapper.appendChild(this._bodyCollectionContainer);}detachFromDom(){super.destroy(),this._bodyCollectionContainer&&this._bodyCollectionContainer.remove(),Yp._bodyWrapper&&!Yp._bodyWrapper.childElementCount&&(Yp._bodyWrapper.remove(),delete Yp._bodyWrapper);}}const Zp=Ri("px"),Xp={top:-99999,left:-99999,name:"arrowless",config:{withArrow:false}};class eb extends Cs{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",false),this.set("withArrow",true),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",Zp),left:t.to("left",Zp)}},children:this.content});}destroy(){this.hide(),super.destroy();}show(){this.isVisible=true;}hide(){this.isVisible=false;}attachTo(t){const i=tb(t.target);if(i&&!Fi(i))return  false;this.show();const n=eb.defaultPositions,s=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:exports.global.document.body,fitInViewport:true},t),o=eb._getOptimalPosition(s)||Xp,r=parseInt(o.left),a=parseInt(o.top),l=o.name,c=o.config||{},{withArrow:u=true}=c;return this.top=a,this.left=r,this.position=l,this.withArrow=u,true}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(t){if(!this.attachTo(t))return  false;let i=tb(t.target);const n=t.limiter?tb(t.limiter):exports.global.document.body;if(this.listenTo(exports.global.document,"scroll",(e,s)=>{const o=s.target,r=i&&o.contains(i),a=n&&o.contains(n);!r&&!a&&i&&n||this.attachTo(t);},{useCapture:true}),this.listenTo(exports.global.window,"resize",()=>{this.attachTo(t);}),!this._resizeObserver&&(i&&vi(i)&&(i=i.parentElement),i)){const e=()=>{Fi(i)||this.unpin();};this._resizeObserver=new Pi(i,e);}return  true}_stopPinning(){this.stopListening(exports.global.document,"scroll"),this.stopListening(exports.global.window,"resize"),this._resizeObserver&&(this._resizeObserver.destroy(),this._resizeObserver=null);}static generatePositions(t={}){const{sideOffset:i=eb.arrowSideOffset,heightOffset:n=eb.arrowHeightOffset,stickyVerticalOffset:s=eb.stickyVerticalOffset,config:o}=t;return {northWestArrowSouthWest:(e,t)=>({top:r(e,t),left:e.left-i,name:"arrow_sw",...o&&{config:o}}),northWestArrowSouthMiddleWest:(e,t)=>({top:r(e,t),left:e.left-.25*t.width-i,name:"arrow_smw",...o&&{config:o}}),northWestArrowSouth:(e,t)=>({top:r(e,t),left:e.left-t.width/2,name:"arrow_s",...o&&{config:o}}),northWestArrowSouthMiddleEast:(e,t)=>({top:r(e,t),left:e.left-.75*t.width+i,name:"arrow_sme",...o&&{config:o}}),northWestArrowSouthEast:(e,t)=>({top:r(e,t),left:e.left-t.width+i,name:"arrow_se",...o&&{config:o}}),northArrowSouthWest:(e,t)=>({top:r(e,t),left:e.left+e.width/2-i,name:"arrow_sw",...o&&{config:o}}),northArrowSouthMiddleWest:(e,t)=>({top:r(e,t),left:e.left+e.width/2-.25*t.width-i,name:"arrow_smw",...o&&{config:o}}),northArrowSouth:(e,t)=>({top:r(e,t),left:e.left+e.width/2-t.width/2,name:"arrow_s",...o&&{config:o}}),northArrowSouthMiddleEast:(e,t)=>({top:r(e,t),left:e.left+e.width/2-.75*t.width+i,name:"arrow_sme",...o&&{config:o}}),northArrowSouthEast:(e,t)=>({top:r(e,t),left:e.left+e.width/2-t.width+i,name:"arrow_se",...o&&{config:o}}),northEastArrowSouthWest:(e,t)=>({top:r(e,t),left:e.right-i,name:"arrow_sw",...o&&{config:o}}),northEastArrowSouthMiddleWest:(e,t)=>({top:r(e,t),left:e.right-.25*t.width-i,name:"arrow_smw",...o&&{config:o}}),northEastArrowSouth:(e,t)=>({top:r(e,t),left:e.right-t.width/2,name:"arrow_s",...o&&{config:o}}),northEastArrowSouthMiddleEast:(e,t)=>({top:r(e,t),left:e.right-.75*t.width+i,name:"arrow_sme",...o&&{config:o}}),northEastArrowSouthEast:(e,t)=>({top:r(e,t),left:e.right-t.width+i,name:"arrow_se",...o&&{config:o}}),southWestArrowNorthWest:e=>({top:a(e),left:e.left-i,name:"arrow_nw",...o&&{config:o}}),southWestArrowNorthMiddleWest:(e,t)=>({top:a(e),left:e.left-.25*t.width-i,name:"arrow_nmw",...o&&{config:o}}),southWestArrowNorth:(e,t)=>({top:a(e),left:e.left-t.width/2,name:"arrow_n",...o&&{config:o}}),southWestArrowNorthMiddleEast:(e,t)=>({top:a(e),left:e.left-.75*t.width+i,name:"arrow_nme",...o&&{config:o}}),southWestArrowNorthEast:(e,t)=>({top:a(e),left:e.left-t.width+i,name:"arrow_ne",...o&&{config:o}}),southArrowNorthWest:e=>({top:a(e),left:e.left+e.width/2-i,name:"arrow_nw",...o&&{config:o}}),southArrowNorthMiddleWest:(e,t)=>({top:a(e),left:e.left+e.width/2-.25*t.width-i,name:"arrow_nmw",...o&&{config:o}}),southArrowNorth:(e,t)=>({top:a(e),left:e.left+e.width/2-t.width/2,name:"arrow_n",...o&&{config:o}}),southArrowNorthMiddleEast:(e,t)=>({top:a(e),left:e.left+e.width/2-.75*t.width+i,name:"arrow_nme",...o&&{config:o}}),southArrowNorthEast:(e,t)=>({top:a(e),left:e.left+e.width/2-t.width+i,name:"arrow_ne",...o&&{config:o}}),southEastArrowNorthWest:e=>({top:a(e),left:e.right-i,name:"arrow_nw",...o&&{config:o}}),southEastArrowNorthMiddleWest:(e,t)=>({top:a(e),left:e.right-.25*t.width-i,name:"arrow_nmw",...o&&{config:o}}),southEastArrowNorth:(e,t)=>({top:a(e),left:e.right-t.width/2,name:"arrow_n",...o&&{config:o}}),southEastArrowNorthMiddleEast:(e,t)=>({top:a(e),left:e.right-.75*t.width+i,name:"arrow_nme",...o&&{config:o}}),southEastArrowNorthEast:(e,t)=>({top:a(e),left:e.right-t.width+i,name:"arrow_ne",...o&&{config:o}}),westArrowEast:(e,t)=>({top:e.top+e.height/2-t.height/2,left:e.left-t.width-n,name:"arrow_e",...o&&{config:o}}),eastArrowWest:(e,t)=>({top:e.top+e.height/2-t.height/2,left:e.right+n,name:"arrow_w",...o&&{config:o}}),viewportStickyNorth:(t,i,n)=>{const r=new Ci(exports.global.document.body).getIntersection(n.getVisible());if(!r)return null;const a=r.getVisible();return t.getIntersection(a)&&a.top-t.top-s<i.height&&a.bottom-t.bottom<i.height?{top:a.top+s,left:t.left+t.width/2-i.width/2,name:"arrowless",config:{withArrow:false,...o}}:null}};function r(e,t){return e.top-t.height-n}function a(e){return e.bottom+n}}static arrowSideOffset=25;static arrowHeightOffset=10;static stickyVerticalOffset=20;static _getOptimalPosition=Ni;static defaultPositions=eb.generatePositions()}function tb(e){return St(e)?e:_i(e)?e.commonAncestorContainer:"function"==typeof e?tb(e()):null}class ib extends(ci()){editor;_balloonView=null;_showBalloonThrottled=ot(()=>this._showBalloon(),50,{leading:true});_lastFocusedEditableElement=null;_balloonClass;constructor(e,t={}){super(),this.editor=e,this._balloonClass=t.balloonClass,e.on("ready",()=>this._handleEditorReady());}destroy(){const e=this._balloonView;e&&(e.unpin(),this._balloonView=null),this._showBalloonThrottled.cancel(),this.stopListening();}_handleEditorReady(){const e=this.editor;this._isEnabled()&&e.ui.view&&(e.ui.focusTracker.on("change:isFocused",(e,t,i)=>{this._updateLastFocusedEditableElement(),i?this._showBalloon():this._hideBalloon();}),e.ui.focusTracker.on("change:focusedElement",(e,t,i)=>{this._updateLastFocusedEditableElement(),i&&this._showBalloon();}),e.ui.on("update",()=>{this._showBalloonThrottled();}));}_getNormalizedConfig(){return {side:"ltr"===this.editor.locale.contentLanguageDirection?"right":"left",position:"border",verticalOffset:0,horizontalOffset:5}}_showBalloon(){const e=this._getBalloonAttachOptions();e&&(this._balloonView||(this._balloonView=this._createBalloonView()),this._balloonView.pin(e));}_hideBalloon(){this._balloonView&&this._balloonView.unpin();}_createBalloonView(){const e=this.editor,t=new eb,i=this._createBadgeContent();return t.content.add(i),this._balloonClass&&(t.class=this._balloonClass),e.ui.view.body.add(t),t}_getBalloonAttachOptions(){if(!this._lastFocusedEditableElement)return null;const e=this._getNormalizedConfig(),t="right"===e.side?nb(this._lastFocusedEditableElement,i=e,(e,t)=>e.left+e.width-t.width-i.horizontalOffset):function(e,t){return nb(e,t,e=>e.left+t.horizontalOffset)}(this._lastFocusedEditableElement,e);var i;return {target:this._lastFocusedEditableElement,positions:[t]}}_updateLastFocusedEditableElement(){const e=this.editor,t=e.ui.focusTracker.isFocused,i=e.ui.focusTracker.focusedElement;if(!t||!i)return void(this._lastFocusedEditableElement=null);const n=Array.from(e.ui.getEditableElementsNames()).map(t=>e.ui.getEditableElement(t));n.includes(i)?this._lastFocusedEditableElement=i:this._lastFocusedEditableElement=n[0];}}function nb(e,t,i){return (n,s)=>{const o=new Ci(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=i(o,s),l=n.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:false}}}}class sb extends ib{constructor(e){super(e,{balloonClass:"ck-powered-by-balloon"});}_isEnabled(){const e=this.editor;if(e.config.get("ui.poweredBy.forceVisible"))return  true;const t=e.config.get("licenseKey");if("GPL"==t)return  true;const i=Nn(t.split(".")[1]);return !i||!i.whiteLabel}_createBadgeContent(){return new ob(this.editor.locale,this._getNormalizedConfig().label)}_getNormalizedConfig(){const e=super._getNormalizedConfig(),t=this.editor.config.get("ui.poweredBy")||{},i=t.position||e.position,n="inside"===i?5:e.verticalOffset;return {position:i,side:t.side||e.side,label:void 0===t.label?"Powered by":t.label,verticalOffset:void 0!==t.verticalOffset?t.verticalOffset:n,horizontalOffset:void 0!==t.horizontalOffset?t.horizontalOffset:e.horizontalOffset,forceVisible:!!t.forceVisible}}}class ob extends Cs{constructor(e,t){super(e);const i=new Rp,n=this.bindTemplate;i.set({content:Rf,isColorInherited:false}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-powered-by"],"aria-hidden":true},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]}]:[],i],on:{dragstart:n.to(e=>e.preventDefault())}}]});}}class rb extends Bp{toggleSwitchView;constructor(e){super(e),this.isToggleable=true,this.toggleSwitchView=this._createToggleView(),this.extendTemplate({attributes:{class:"ck-switchbutton"}});}render(){super.render(),this.children.add(this.toggleSwitchView);}_createToggleView(){const e=new Cs;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),e}}class ab extends(cb(Bp)){}class lb extends(cb(Gp)){}function cb(e){return class extends e{_fileInputView;constructor(...e){super(...e),this._fileInputView=new ub(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 ub extends Cs{constructor(e){super(e),this.set("acceptedType",void 0),this.set("allowMultipleFiles",false);const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:t.to("acceptedType"),multiple:t.to("allowMultipleFiles")},on:{change:t.to(()=>{this.element?.files?.length&&this.fire("done",this.element.files),this.element.value="";})}});}open(){this.element.click();}}class db extends Cs{buttonView;children;constructor(e,t){super(e);const i=this.bindTemplate;this.set("isCollapsed",false),this.set("label",""),this.buttonView=this._createButtonView(),this.children=this.createCollection(),this.set("_collapsibleAriaLabelUid",void 0),t&&this.children.addMany(t),this.setTemplate({tag:"div",attributes:{class:["ck","ck-collapsible",i.if("isCollapsed","ck-collapsible_collapsed")]},children:[this.buttonView,{tag:"div",attributes:{class:["ck","ck-collapsible__children"],role:"region",hidden:i.if("isCollapsed","hidden"),"aria-labelledby":i.to("_collapsibleAriaLabelUid")},children:this.children}]});}render(){super.render(),this._collapsibleAriaLabelUid=this.buttonView.labelView.element.id;}focus(){this.buttonView.focus();}_createButtonView(){const e=new Bp(this.locale),t=e.bindTemplate;return e.set({withText:true,icon:Um}),e.extendTemplate({attributes:{"aria-expanded":t.to("isOn",e=>String(e))}}),e.bind("label").to(this),e.bind("isOn").to(this,"isCollapsed",e=>!e),e.on("execute",()=>{this.isCollapsed=!this.isCollapsed;}),e}}function hb(e,t){const i=e.t,n={Black:i("Black"),"Dim grey":i("Dim grey"),Grey:i("Grey"),"Light grey":i("Light grey"),White:i("White"),Red:i("Red"),Orange:i("Orange"),Yellow:i("Yellow"),"Light green":i("Light green"),Green:i("Green"),Aquamarine:i("Aquamarine"),Turquoise:i("Turquoise"),"Light blue":i("Light blue"),Blue:i("Blue"),Purple:i("Purple")};return t.map(e=>{const t=n[e.label];return t&&t!=e.label&&(e.label=t),e})}function mb(e){return e.map(gb).filter(e=>!!e)}function gb(e){return "string"==typeof e?{model:e,label:e,hasBorder:false,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 fb extends Bp{constructor(e){super(e);const t=this.bindTemplate;this.set("color",void 0),this.set("hasBorder",false),this.icon=Im,this.extendTemplate({attributes:{style:{backgroundColor:t.to("color",e=>n.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 pb extends Cs{columns;items;focusTracker;keystrokes;constructor(e,t){super(e);const i=t&&t.colorDefinitions?t.colorDefinitions:[];this.columns=t?.columns||5;const n={gridTemplateColumns:`repeat( ${this.columns}, 1fr)`};this.set("selectedColor",void 0),this.items=this.createCollection(),this.focusTracker=new An,this.keystrokes=new In,this.items.on("add",(e,t)=>{t.isOn=t.color===this.selectedColor;}),i.forEach(e=>{const t=new fb;t.set({color:e.color,label:e.label,tooltip:true,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:n}}),this.on("change:selectedColor",(e,t,i)=>{for(const e of this.items)e.isOn=e.color===i;});}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),Rs({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:this.columns,uiLanguageDirection:this.locale?.uiLanguageDirection});}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy();}}var bb={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},wb={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function vb(e){var t,i,n=[],s=1;if("number"==typeof e)return {space:"rgb",values:[e>>>16,(65280&e)>>>8,255&e],alpha:1};if("number"==typeof e)return {space:"rgb",values:[e>>>16,(65280&e)>>>8,255&e],alpha:1};if(e=String(e).toLowerCase(),bb[e])n=bb[e].slice(),i="rgb";else if("transparent"===e)s=0,i="rgb",n=[0,0,0];else if("#"===e[0]){var o=e.slice(1),r=o.length;s=1,r<=4?(n=[parseInt(o[0]+o[0],16),parseInt(o[1]+o[1],16),parseInt(o[2]+o[2],16)],4===r&&(s=parseInt(o[3]+o[3],16)/255)):(n=[parseInt(o[0]+o[1],16),parseInt(o[2]+o[3],16),parseInt(o[4]+o[5],16)],8===r&&(s=parseInt(o[6]+o[7],16)/255)),n[0]||(n[0]=0),n[1]||(n[1]=0),n[2]||(n[2]=0),i="rgb";}else if(t=/^((?:rgba?|hs[lvb]a?|hwba?|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms|oklch|oklab|color))\s*\(([^\)]*)\)/.exec(e)){var a=t[1],l="cmyk"===(i=a.replace(/a$/,""))?4:"gray"===i?1:3;n=t[2].trim().split(/\s*[,\/]\s*|\s+/),"color"===i&&(i=n.shift()),n=n.map(function(e,t){if("%"===e[e.length-1])return e=parseFloat(e)/100,3===t?e:"rgb"===i?255*e:"h"===i[0]?100*e:"l"!==i[0]||t?"lab"===i?125*e:"lch"===i?t<2?150*e:360*e:"o"!==i[0]||t?"oklab"===i?.4*e:"oklch"===i?t<2?.4*e:360*e:e:e:100*e;if("h"===i[t]||2===t&&"h"===i[i.length-1]){if(void 0!==wb[e])return wb[e];if(e.endsWith("deg"))return parseFloat(e);if(e.endsWith("turn"))return 360*parseFloat(e);if(e.endsWith("grad"))return 360*parseFloat(e)/400;if(e.endsWith("rad"))return 180*parseFloat(e)/Math.PI}return "none"===e?0:parseFloat(e)}),s=n.length>l?n.pop():1;}else /[0-9](?:\s|\/|,)/.test(e)&&(n=e.match(/([0-9]+)/g).map(function(e){return parseFloat(e)}),i=e.match(/([a-z])/gi)?.join("")?.toLowerCase()||"rgb");return {space:i,values:n,alpha:s}}const _b={};for(const e of Object.keys(bb))_b[bb[e]]=e;const yb={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},oklab:{channels:3,labels:["okl","oka","okb"]},lch:{channels:3,labels:"lch"},oklch:{channels:3,labels:["okl","okc","okh"]},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}},kb=(6/29)**3;function Cb(e){const t=e>.0031308?1.055*e**(1/2.4)-.055:12.92*e;return Math.min(Math.max(0,t),1)}function xb(e){return e>.04045?((e+.055)/1.055)**2.4:e/12.92}for(const e of Object.keys(yb)){if(!("channels"in yb[e]))throw new Error("missing channels property: "+e);if(!("labels"in yb[e]))throw new Error("missing channel labels property: "+e);if(yb[e].labels.length!==yb[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:i}=yb[e];delete yb[e].channels,delete yb[e].labels,Object.defineProperty(yb[e],"channels",{value:t}),Object.defineProperty(yb[e],"labels",{value:i});}function Ab(e,t){return (e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}function Eb(e){const t=function(){const e={},t=Object.keys(yb);for(let{length:i}=t,n=0;n<i;n++)e[t[n]]={distance:-1,parent:null};return e}(),i=[e];for(t[e].distance=0;i.length>0;){const e=i.pop(),n=Object.keys(yb[e]);for(let{length:s}=n,o=0;o<s;o++){const s=n[o],r=t[s];-1===r.distance&&(r.distance=t[e].distance+1,r.parent=e,i.unshift(s));}}return t}function Tb(e,t){return function(i){return t(e(i))}}function Sb(e,t){const i=[t[e].parent,e];let n=yb[t[e].parent][e],s=t[e].parent;for(;t[s].parent;)i.unshift(t[s].parent),n=Tb(yb[t[s].parent][s],n),s=t[s].parent;return n.conversion=i,n}function Ib(e){const t=Eb(e),i={},n=Object.keys(t);for(let{length:e}=n,s=0;s<e;s++){const e=n[s];null!==t[e].parent&&(i[e]=Sb(e,t));}return i}yb.rgb.hsl=function(e){const t=e[0]/255,i=e[1]/255,n=e[2]/255,s=Math.min(t,i,n),o=Math.max(t,i,n),r=o-s;let a,l;switch(o){case s:a=0;break;case t:a=(i-n)/r;break;case i:a=2+(n-t)/r;break;case n:a=4+(t-i)/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]},yb.rgb.hsv=function(e){let t,i,n,s,o;const r=e[0]/255,a=e[1]/255,l=e[2]/255,c=Math.max(r,a,l),u=c-Math.min(r,a,l),d=function(e){return (c-e)/6/u+.5};if(0===u)s=0,o=0;else {switch(o=u/c,t=d(r),i=d(a),n=d(l),c){case r:s=n-i;break;case a:s=1/3+t-n;break;case l:s=2/3+i-t;}s<0?s+=1:s>1&&(s-=1);}return [360*s,100*o,100*c]},yb.rgb.hwb=function(e){const t=e[0],i=e[1];let n=e[2];const s=yb.rgb.hsl(e)[0],o=1/255*Math.min(t,Math.min(i,n));return n=1-1/255*Math.max(t,Math.max(i,n)),[s,100*o,100*n]},yb.rgb.oklab=function(e){const t=xb(e[0]/255),i=xb(e[1]/255),n=xb(e[2]/255),s=Math.cbrt(.4122214708*t+.5363325363*i+.0514459929*n),o=Math.cbrt(.2119034982*t+.6806995451*i+.1073969566*n),r=Math.cbrt(.0883024619*t+.2817188376*i+.6299787005*n);return [100*(.2104542553*s+.793617785*o-.0040720468*r),100*(1.9779984951*s-2.428592205*o+.4505937099*r),100*(.0259040371*s+.7827717662*o-.808675766*r)]},yb.rgb.cmyk=function(e){const t=e[0]/255,i=e[1]/255,n=e[2]/255,s=Math.min(1-t,1-i,1-n);return [100*((1-t-s)/(1-s)||0),100*((1-i-s)/(1-s)||0),100*((1-n-s)/(1-s)||0),100*s]},yb.rgb.keyword=function(e){const t=_b[e];if(t)return t;let i,n=Number.POSITIVE_INFINITY;for(const t of Object.keys(bb)){const s=Ab(e,bb[t]);s<n&&(n=s,i=t);}return i},yb.keyword.rgb=function(e){return bb[e]},yb.rgb.xyz=function(e){const t=xb(e[0]/255),i=xb(e[1]/255),n=xb(e[2]/255);return [100*(.4124564*t+.3575761*i+.1804375*n),100*(.2126729*t+.7151522*i+.072175*n),100*(.0193339*t+.119192*i+.9503041*n)]},yb.rgb.lab=function(e){const t=yb.rgb.xyz(e);let i=t[0],n=t[1],s=t[2];i/=95.047,n/=100,s/=108.883,i=i>kb?i**(1/3):7.787*i+16/116,n=n>kb?n**(1/3):7.787*n+16/116,s=s>kb?s**(1/3):7.787*s+16/116;return [116*n-16,500*(i-n),200*(n-s)]},yb.hsl.rgb=function(e){const t=e[0]/360,i=e[1]/100,n=e[2]/100;let s,o;if(0===i)return o=255*n,[o,o,o];const r=n<.5?n*(1+i):n+i-n*i,a=2*n-r,l=[0,0,0];for(let e=0;e<3;e++)s=t+1/3*-(e-1),s<0&&s++,s>1&&s--,o=6*s<1?a+6*(r-a)*s:2*s<1?r:3*s<2?a+(r-a)*(2/3-s)*6:a,l[e]=255*o;return l},yb.hsl.hsv=function(e){const t=e[0];let i=e[1]/100,n=e[2]/100,s=i;const o=Math.max(n,.01);n*=2,i*=n<=1?n:2-n,s*=o<=1?o:2-o;return [t,100*(0===n?2*s/(o+s):2*i/(n+i)),100*((n+i)/2)]},yb.hsv.rgb=function(e){const t=e[0]/60,i=e[1]/100;let n=e[2]/100;const s=Math.floor(t)%6,o=t-Math.floor(t),r=255*n*(1-i),a=255*n*(1-i*o),l=255*n*(1-i*(1-o));switch(n*=255,s){case 0:return [n,l,r];case 1:return [a,n,r];case 2:return [r,n,l];case 3:return [r,a,n];case 4:return [l,r,n];case 5:return [n,r,a]}},yb.hsv.hsl=function(e){const t=e[0],i=e[1]/100,n=e[2]/100,s=Math.max(n,.01);let o,r;r=(2-i)*n;const a=(2-i)*s;return o=i*s,o/=a<=1?a:2-a,o=o||0,r/=2,[t,100*o,100*r]},yb.hwb.rgb=function(e){const t=e[0]/360;let i=e[1]/100,n=e[2]/100;const s=i+n;let o;s>1&&(i/=s,n/=s);const r=Math.floor(6*t),a=1-n;o=6*t-r,1&r&&(o=1-o);const l=i+o*(a-i);let c,u,d;switch(r){default:case 6:case 0:c=a,u=l,d=i;break;case 1:c=l,u=a,d=i;break;case 2:c=i,u=a,d=l;break;case 3:c=i,u=l,d=a;break;case 4:c=l,u=i,d=a;break;case 5:c=a,u=i,d=l;}return [255*c,255*u,255*d]},yb.cmyk.rgb=function(e){const t=e[0]/100,i=e[1]/100,n=e[2]/100,s=e[3]/100;return [255*(1-Math.min(1,t*(1-s)+s)),255*(1-Math.min(1,i*(1-s)+s)),255*(1-Math.min(1,n*(1-s)+s))]},yb.xyz.rgb=function(e){const t=e[0]/100,i=e[1]/100,n=e[2]/100;let s,o,r;return s=3.2404542*t+-1.5371385*i+-0.4985314*n,o=-0.969266*t+1.8760108*i+.041556*n,r=.0556434*t+-0.2040259*i+1.0572252*n,s=Cb(s),o=Cb(o),r=Cb(r),[255*s,255*o,255*r]},yb.xyz.lab=function(e){let t=e[0],i=e[1],n=e[2];t/=95.047,i/=100,n/=108.883,t=t>kb?t**(1/3):7.787*t+16/116,i=i>kb?i**(1/3):7.787*i+16/116,n=n>kb?n**(1/3):7.787*n+16/116;return [116*i-16,500*(t-i),200*(i-n)]},yb.xyz.oklab=function(e){const t=e[0]/100,i=e[1]/100,n=e[2]/100,s=Math.cbrt(.8189330101*t+.3618667424*i-.1288597137*n),o=Math.cbrt(.0329845436*t+.9293118715*i+.0361456387*n),r=Math.cbrt(.0482003018*t+.2643662691*i+.633851707*n);return [100*(.2104542553*s+.793617785*o-.0040720468*r),100*(1.9779984951*s-2.428592205*o+.4505937099*r),100*(.0259040371*s+.7827717662*o-.808675766*r)]},yb.oklab.oklch=function(e){return yb.lab.lch(e)},yb.oklab.xyz=function(e){const t=e[0]/100,i=e[1]/100,n=e[2]/100,s=(.999999998*t+.396337792*i+.215803758*n)**3,o=(1.000000008*t-.105561342*i-.063854175*n)**3,r=(1.000000055*t-.089484182*i-1.291485538*n)**3;return [100*(1.227013851*s-.55779998*o+.281256149*r),100*(-0.040580178*s+1.11225687*o-.071676679*r),100*(-0.076381285*s-.421481978*o+1.58616322*r)]},yb.oklab.rgb=function(e){const t=e[0]/100,i=e[1]/100,n=e[2]/100,s=(t+.3963377774*i+.2158037573*n)**3,o=(t-.1055613458*i-.0638541728*n)**3,r=(t-.0894841775*i-1.291485548*n)**3;return [255*Cb(4.0767416621*s-3.3077115913*o+.2309699292*r),255*Cb(-1.2684380046*s+2.6097574011*o-.3413193965*r),255*Cb(-0.0041960863*s-.7034186147*o+1.707614701*r)]},yb.oklch.oklab=function(e){return yb.lch.lab(e)},yb.lab.xyz=function(e){let t,i,n;i=(e[0]+16)/116,t=e[1]/500+i,n=i-e[2]/200;const s=i**3,o=t**3,r=n**3;return i=s>kb?s:(i-16/116)/7.787,t=o>kb?o:(t-16/116)/7.787,n=r>kb?r:(n-16/116)/7.787,t*=95.047,i*=100,n*=108.883,[t,i,n]},yb.lab.lch=function(e){const t=e[0],i=e[1],n=e[2];let s;s=360*Math.atan2(n,i)/2/Math.PI,s<0&&(s+=360);return [t,Math.sqrt(i*i+n*n),s]},yb.lch.lab=function(e){const t=e[0],i=e[1],n=e[2]/360*2*Math.PI;return [t,i*Math.cos(n),i*Math.sin(n)]},yb.rgb.ansi16=function(e,t=null){const[i,n,s]=e;let o=null===t?yb.rgb.hsv(e)[2]:t;if(o=Math.round(o/50),0===o)return 30;let r=30+(Math.round(s/255)<<2|Math.round(n/255)<<1|Math.round(i/255));return 2===o&&(r+=60),r},yb.hsv.ansi16=function(e){return yb.rgb.ansi16(yb.hsv.rgb(e),e[2])},yb.rgb.ansi256=function(e){const t=e[0],i=e[1],n=e[2];if(t>>4==i>>4&&i>>4==n>>4)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(i/255*5)+Math.round(n/255*5)},yb.ansi16.rgb=function(e){let t=(e=e[0])%10;if(0===t||7===t)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const i=.5*(Math.trunc(e>50)+1);return [(1&t)*i*255,(t>>1&1)*i*255,(t>>2&1)*i*255]},yb.ansi256.rgb=function(e){if((e=e[0])>=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]},yb.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".slice(t.length)+t},yb.hex.rgb=function(e){const t=e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!t)return [0,0,0];let i=t[0];3===t[0].length&&(i=[...i].map(e=>e+e).join(""));const n=Number.parseInt(i,16);return [n>>16&255,n>>8&255,255&n]},yb.rgb.hcg=function(e){const t=e[0]/255,i=e[1]/255,n=e[2]/255,s=Math.max(Math.max(t,i),n),o=Math.min(Math.min(t,i),n),r=s-o;let a;return a=r<=0?0:s===t?(i-n)/r%6:s===i?2+(n-t)/r:4+(t-i)/r,a/=6,a%=1,[360*a,100*r,100*(r<1?o/(1-r):0)]},yb.hsl.hcg=function(e){const t=e[1]/100,i=e[2]/100,n=i<.5?2*t*i:2*t*(1-i);let s=0;return n<1&&(s=(i-.5*n)/(1-n)),[e[0],100*n,100*s]},yb.hsv.hcg=function(e){const t=e[1]/100,i=e[2]/100,n=t*i;let s=0;return n<1&&(s=(i-n)/(1-n)),[e[0],100*n,100*s]},yb.hcg.rgb=function(e){const t=e[0]/360,i=e[1]/100,n=e[2]/100;if(0===i)return [255*n,255*n,255*n];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-i)*n,[255*(i*s[0]+l),255*(i*s[1]+l),255*(i*s[2]+l)]},yb.hcg.hsv=function(e){const t=e[1]/100,i=t+e[2]/100*(1-t);let n=0;return i>0&&(n=t/i),[e[0],100*n,100*i]},yb.hcg.hsl=function(e){const t=e[1]/100,i=e[2]/100*(1-t)+.5*t;let n=0;return i>0&&i<.5?n=t/(2*i):i>=.5&&i<1&&(n=t/(2*(1-i))),[e[0],100*n,100*i]},yb.hcg.hwb=function(e){const t=e[1]/100,i=t+e[2]/100*(1-t);return [e[0],100*(i-t),100*(1-i)]},yb.hwb.hcg=function(e){const t=e[1]/100,i=1-e[2]/100,n=i-t;let s=0;return n<1&&(s=(i-n)/(1-n)),[e[0],100*n,100*s]},yb.apple.rgb=function(e){return [e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},yb.rgb.apple=function(e){return [e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},yb.gray.rgb=function(e){return [e[0]/100*255,e[0]/100*255,e[0]/100*255]},yb.gray.hsl=function(e){return [0,0,e[0]]},yb.gray.hsv=yb.gray.hsl,yb.gray.hwb=function(e){return [0,100,e[0]]},yb.gray.cmyk=function(e){return [0,0,0,e[0]]},yb.gray.lab=function(e){return [e[0],0,0]},yb.gray.hex=function(e){const t=255&Math.round(e[0]/100*255),i=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return "000000".slice(i.length)+i},yb.rgb.gray=function(e){return [(e[0]+e[1]+e[2])/3/255*100]};const Pb={},Vb=Object.keys(yb);function Rb(e){const t=function(...t){const i=t[0];return null==i?i:(i.length>1&&(t=i),e(t))};return "conversion"in e&&(t.conversion=e.conversion),t}function Ob(e){const t=function(...t){const i=t[0];if(null==i)return i;i.length>1&&(t=i);const n=e(t);if("object"==typeof n)for(let{length:e}=n,t=0;t<e;t++)n[t]=Math.round(n[t]);return n};return "conversion"in e&&(t.conversion=e.conversion),t}for(const e of Vb){Pb[e]={},Object.defineProperty(Pb[e],"channels",{value:yb[e].channels}),Object.defineProperty(Pb[e],"labels",{value:yb[e].labels});const t=Ib(e),i=Object.keys(t);for(const n of i){const i=t[n];Pb[e][n]=Ob(i),Pb[e][n].raw=Rb(i);}}function Bb(e,t){if(!e)return "";const i=Fb(e);if(!i)return "";if(i.space===t)return e;if(n=i,!Object.keys(Pb).includes(n.space))return "";var n;const s=Pb[i.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"===i.space?i.hexValue:i.values),t)}function Lb(e){if(!e)return "";const t=Fb(e);return t?"hex"===t.space?t.hexValue:Bb(e,"hex"):"#000"}function Mb(e,t){ void 0===customElements.get(e)&&customElements.define(e,t);}function Fb(e){if(e.startsWith("#")){const t=vb(e);return {space:"hex",values:t.values,hexValue:e,alpha:t.alpha}}const t=vb(e);return t.space?t:null}class Nb extends Cs{fieldView;labelView;statusView;fieldWrapperChildren;constructor(e,t){super(e);const i=`ck-labeled-field-view-${A()}`,n=`ck-labeled-field-view-status-${A()}`;this.fieldView=t(this,i,n),this.set("label",void 0),this.set("isEnabled",true),this.set("isEmpty",true),this.set("isFocused",false),this.set("errorText",null),this.set("infoText",null),this.set("class",void 0),this.set("placeholder",void 0),this.labelView=this._createLabelView(i),this.statusView=this._createStatusView(n),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 Os(this.locale);return t.for=e,t.bind("text").to(this,"label"),t}_createStatusView(e){const t=new Cs(this.locale),i=this.bindTemplate;return t.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view__status",i.if("errorText","ck-labeled-field-view__status_error"),i.if("_statusText","ck-hidden",e=>!e)],id:e,role:i.if("errorText","alert")},children:[{text:i.to("_statusText")}]}),t}focus(e){this.fieldView.focus(e);}}class Db extends Cs{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",false),this.set("hasError",false),this.set("ariaDescribedById",void 0),this.set("ariaLabel",void 0),this.focusTracker=new An,this.bind("isFocused").to(this.focusTracker),this.set("isEmpty",true);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",true),"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,i)=>{this._setDomElementValue(i),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 zb extends Db{constructor(e){super(e),this.set("inputMode","text");const t=this.bindTemplate;this.extendTemplate({attributes:{inputmode:t.to("inputMode")}});}}class Hb extends zb{constructor(e){super(e),this.extendTemplate({attributes:{type:"text",class:["ck-input-text"]}});}}class qb extends zb{constructor(e,{min:t,max:i,step:n}={}){super(e);const s=this.bindTemplate;this.set("min",t),this.set("max",i),this.set("step",n),this.extendTemplate({attributes:{type:"number",class:["ck-input-number"],min:s.to("min"),max:s.to("max"),step:s.to("step")}});}}class Ub extends Db{_resizeObserver;_isUpdateAutoGrowHeightPending=false;constructor(e){super(e);const t=Ri("px");this.set("minRows",2),this.set("maxRows",5),this.set("_height",null),this.set("resize","none"),this._resizeObserver=null,this.on("change:minRows",this._validateMinMaxRows.bind(this)),this.on("change:maxRows",this._validateMinMaxRows.bind(this));const i=this.bindTemplate;this.template.tag="textarea",this.extendTemplate({attributes:{class:["ck-textarea"],style:{height:i.to("_height",e=>e?t(e):null),resize:i.to("resize")},rows:i.to("minRows")}});}render(){super.render();let t=false;this.on("input",()=>{this._updateAutoGrowHeight(true),this.fire("update");}),this.on("change:value",()=>{exports.global.window.requestAnimationFrame(()=>{Fi(this.element)?(this._updateAutoGrowHeight(),this.fire("update")):this._isUpdateAutoGrowHeightPending=true;});}),this._resizeObserver=new Pi(this.element,i=>{const n=!!i.contentRect.width&&!!i.contentRect.height;!t&&n&&this._isUpdateAutoGrowHeightPending&&exports.global.window.requestAnimationFrame(()=>{this._updateAutoGrowHeight(),this.fire("update");}),t=n;});}destroy(){this._resizeObserver&&this._resizeObserver.destroy();}reset(){super.reset(),this._updateAutoGrowHeight(),this.fire("update");}_updateAutoGrowHeight(e){const t=this.element;if(!t.offsetParent)return void(this._isUpdateAutoGrowHeightPending=true);this._isUpdateAutoGrowHeightPending=false;const i=jb(t,"1"),n=jb(t,t.value),s=i.ownerDocument.defaultView.getComputedStyle(i),o=parseFloat(s.paddingTop)+parseFloat(s.paddingBottom),r=fi(i),a=parseFloat(s.lineHeight),l=r.top+r.bottom,c=new Ci(i).height,u=Math.round((n.scrollHeight-o)/a),d=this.maxRows*a+o+l,h=1===u?c:this.minRows*a+o+l;this._height=Math.min(Math.max(Math.max(u,this.minRows)*a+o+l,h),d),e&&(t.scrollTop=t.scrollHeight),i.remove(),n.remove();}_validateMinMaxRows(){if(this.minRows>this.maxRows)throw new I("ui-textarea-view-min-rows-greater-than-max-rows",{textareaView:this,minRows:this.minRows,maxRows:this.maxRows})}}function jb(e,t){const i=e.cloneNode();return i.style.position="absolute",i.style.top="-99999px",i.style.left="-99999px",i.style.height="auto",i.style.overflow="hidden",i.style.width=e.ownerDocument.defaultView.getComputedStyle(e).width,i.tabIndex=-1,i.rows=1,i.value=t,e.parentNode.insertBefore(i,e),i}class $b extends Cs{children;constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",false),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=>{const t=e.target;t instanceof Element&&"input"===t.tagName.toLocaleLowerCase()||e.preventDefault();})}});}focus(){if(this.children.length){const e=this.children.first;"function"==typeof e.focus?e.focus():P("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 Wb extends Cs{buttonView;panelView;focusTracker;keystrokes;listView;toolbarView;menuView;constructor(e,t,i){super(e);const n=this.bindTemplate;this.buttonView=t,this.panelView=i,this.set("isOpen",false),this.set("isEnabled",true),this.set("class",void 0),this.set("id",void 0),this.set("panelPosition","auto"),this.panelView.bind("isVisible").to(this,"isOpen"),this.keystrokes=new In,this.focusTracker=new An,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",n.to("class"),n.if("isEnabled","ck-disabled",e=>!e)],id:n.to("id"),"aria-describedby":n.to("ariaDescribedById")},children:[t,i]}),t.extendTemplate({attributes:{class:["ck-dropdown__button"],"data-cke-tooltip-disabled":n.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,i)=>{if(i)if("auto"===this.panelPosition){const e=Wb._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:true,positions:this._panelPositions});this.panelView.position=e?e.name:this._defaultPanelPositionName;}else this.panelView.position=this.panelPosition;}),this.keystrokes.listenTo(this.element);const e=(e,t)=>{this.isOpen&&(this.isOpen=false,t());};this.keystrokes.set("arrowdown",(e,t)=>{this.buttonView.isEnabled&&!this.isOpen&&(this.isOpen=true,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:i,southWest:n,northEast:s,northWest:o,southMiddleEast:r,southMiddleWest:a,northMiddleEast:l,northMiddleWest:c}=Wb.defaultPanelPositions;return "rtl"!==this.locale.uiLanguageDirection?[i,n,r,a,e,s,o,l,c,t]:[n,i,a,r,e,o,s,c,l,t]}get _defaultPanelPositionName(){return "rtl"===this.locale.uiLanguageDirection?"sw":"se"}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=Ni}class Gb extends Bp{arrowView;constructor(e){super(e),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{"aria-haspopup":true,"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 Rp;return e.content=Um,e.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),e}}class Kb extends Bp{id;constructor(e,t,i){super(e),this.id=t,this.set({withText:true,withKeystroke:true,tooltip:false,role:"menuitem",label:i}),this.extendTemplate({attributes:{class:["ck-dropdown-menu-list__nested-menu__item__button"]}});}}class Jb extends Gp{arrowView;constructor(e){super(e);const t=this.bindTemplate;this.set({withText:true,role:"menuitem"}),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{class:["ck-dropdown-menu-list__nested-menu__button"],"aria-haspopup":true,"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 Rp;return e.content=Um,e.extendTemplate({attributes:{class:"ck-dropdown-menu-list__nested-menu__button__arrow"}}),e}}class Qb extends Cs{children;constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",true),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 Yb extends Cs{constructor(e){super(e),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}});}}class Zb extends Cs{labelView;items;children;constructor(e,t=new Os){super(e);const i=this.bindTemplate,n=new Xb(e);this.set({label:"",isVisible:true}),this.labelView=t,this.labelView.bind("text").to(this,"label"),this.children=this.createCollection(),this.children.addMany([this.labelView,n]),n.set({role:"group",ariaLabelledBy:t.id}),n.focusTracker.destroy(),n.keystrokes.destroy(),this.items=n.items,this.setTemplate({tag:"li",attributes:{role:"presentation",class:["ck","ck-list__group",i.if("isVisible","ck-hidden",e=>!e)]},children:this.children});}focus(){if(this.items){const e=this.items.find(e=>!(e instanceof Yb));e&&e.focus();}}}class Xb extends Cs{focusables;items;focusTracker;keystrokes;_focusCycler;_listItemGroupToChangeListeners=new WeakMap;constructor(e){super(e);const t=this.bindTemplate;this.focusables=new Xn,this.items=this.createCollection(),this.focusTracker=new An,this.keystrokes=new In,this._focusCycler=new Fp({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 Zb?this._registerFocusableItemsGroup(e):e instanceof Qb&&this._registerFocusableListItem(e);this.items.on("change",(e,t)=>{for(const e of t.removed)e instanceof Zb?this._deregisterFocusableItemsGroup(e):e instanceof Qb&&this._deregisterFocusableListItem(e);for(const e of Array.from(t.added).reverse())e instanceof Zb?this._registerFocusableItemsGroup(e,t.index):this._registerFocusableListItem(e,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,i)=>{for(const e of i.removed)this._deregisterFocusableListItem(e);for(const t of Array.from(i.added).reverse())this._registerFocusableListItem(t,this.items.getIndex(e)+i.index);}}_registerFocusableItemsGroup(e,t){Array.from(e.items).forEach((e,i)=>{const n=void 0!==t?t+i:void 0;this._registerFocusableListItem(e,n);});const i=this._getOnGroupItemsChangeCallback(e);this._listItemGroupToChangeListeners.set(e,i),e.items.on("change",i);}_deregisterFocusableItemsGroup(e){for(const t of e.items)this._deregisterFocusableListItem(t);e.items.off("change",this._listItemGroupToChangeListeners.get(e)),this._listItemGroupToChangeListeners.delete(e);}}class ew extends Xb{constructor(e){super(e);const t=this.bindTemplate;this.role="menu",this.set("isVisible",true),this.extendTemplate({attributes:{class:["ck-dropdown-menu-list",t.if("isVisible","ck-hidden",e=>!e)]}});}}const tw={eastSouth:e=>({top:e.top,left:e.right-5,name:"es"}),eastNorth:(e,t)=>({top:e.top-t.height+e.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+e.height,left:e.left-t.width+5,name:"wn"})};class iw extends Qb{childView;constructor(e,t,i){super(e);const n=this.bindTemplate;this.childView=i,this.children.add(i),this.extendTemplate({attributes:{class:["ck-dropdown-menu-list__nested-menu__item"]},on:{mouseenter:n.to("mouseenter")}}),t&&(this.delegate("mouseenter").to(t),i instanceof Kb&&i.delegate("execute").to(t));}}const nw={toggleMenusAndFocusItemsOnHover(e){e.on("menu:mouseenter",t=>{const[i]=t.path;t.source.focus();for(const n of e.menus){const e=i instanceof iw&&i.childView===n;n.isOpen=(t.path.includes(n)||e)&&n.isEnabled;}});},closeMenuWhenAnotherOnTheSameLevelOpens(e){e.on("menu:change:isOpen",(t,i,n)=>{if(!n)return;const s=t.source;for(const t of e.menus)s.parentMenuView===t.parentMenuView&&s!==t&&(t.isOpen=false);});}},sw={openOnArrowRightKey(e){const t="rtl"===e.locale.uiLanguageDirection?"arrowleft":"arrowright";e.keystrokes.set(t,(t,i)=>{e.focusTracker.focusedElement===e.buttonView.element&&e.isEnabled&&(e.isOpen||(e.isOpen=true),e.panelView.focus(),i());});},openOnButtonClick(e){e.buttonView.on("execute",()=>{e.isEnabled&&(e.isOpen=true);});},openAndFocusOnEnterKeyPress(e){e.keystrokes.set("enter",(t,i)=>{e.focusTracker.focusedElement===e.buttonView.element&&(e.isOpen=true,e.panelView.focus(),i());});},closeOnArrowLeftKey(e){const t="rtl"===e.locale.uiLanguageDirection?"arrowright":"arrowleft";e.keystrokes.set(t,(t,i)=>{e.isOpen&&(e.focus(),e.isOpen=false,i());});},closeOnEscKey(e){e.keystrokes.set("esc",(t,i)=>{e.isOpen&&(e.focus(),e.isOpen=false,i());});},closeOnParentClose(e,t){t.on("change:isOpen",(i,n,s)=>{s||i.source!==t||(e.isOpen=false);});}};class ow extends eb{constructor(e){super(e);const t=this.bindTemplate;this.set({isVisible:false,position:"se",class:null,top:0,left:0}),this.extendTemplate({tag:"div",attributes:{class:["ck-reset","ck-dropdown-menu__nested-menu__panel"],tabindex:"-1"},on:{selectstart:t.to(e=>{"input"!==e.target.tagName.toLocaleLowerCase()&&e.preventDefault();})}});}focus(e=1){const{content:t}=this;t.length&&(1===e?t.first.focus():t.last.focus());}}class rw extends Cs{static DELEGATED_EVENTS=["mouseenter","execute","change:isOpen"];id;buttonView;panelView;listView;focusTracker;keystrokes;_bodyCollection;constructor(e,t,i,n,s){super(e),this._bodyCollection=t,this.id=i,this.set({isOpen:false,isEnabled:true,panelPosition:"w",class:void 0,parentMenuView:null}),this.keystrokes=new In,this.focusTracker=new An,this.buttonView=new Jb(e),this.buttonView.delegate("mouseenter").to(this),this.buttonView.bind("isOn","isEnabled").to(this,"isOpen","isEnabled"),this.buttonView.label=n,this.panelView=new ow(e),this.panelView.isVisible=true,this.listView=new ew(e),this.listView.bind("ariaLabel").to(this.buttonView,"label"),this.panelView.content.add(this.listView);const o=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown-menu-list__nested-menu",o.to("class"),o.if("isEnabled","ck-disabled",e=>!e)],role:"presentation"},children:[this.buttonView]}),this.parentMenuView=s,this.parentMenuView&&this._handleParentMenuView(),this._attachBehaviors();}get _panelPositions(){const{westSouth:e,eastSouth:t,westNorth:i,eastNorth:n}=tw;return "ltr"===this.locale.uiLanguageDirection?[t,n,e,i]:[e,i,t,n]}render(){super.render(),this.panelView.render(),this.focusTracker.add(this.buttonView.element),this.focusTracker.add(this.panelView.element),this.focusTracker.add(this.listView),this.keystrokes.listenTo(this.element),this._mountPanelOnOpen();}destroy(){this._removePanelFromBody(),this.panelView.destroy(),super.destroy();}focus(){this.buttonView.focus();}_handleParentMenuView(){this.delegate(...rw.DELEGATED_EVENTS).to(this.parentMenuView),sw.closeOnParentClose(this,this.parentMenuView);}_attachBehaviors(){sw.openOnButtonClick(this),sw.openAndFocusOnEnterKeyPress(this),sw.openOnArrowRightKey(this),sw.closeOnEscKey(this),sw.closeOnArrowLeftKey(this);}_mountPanelOnOpen(){const{panelView:e}=this;this.on("change:isOpen",(t,i,n)=>{t.source===this&&(n||!this._bodyCollection.has(e)?n&&!this._bodyCollection.has(e)&&this._addPanelToBody():this._removePanelFromBody());});}_removePanelFromBody(){const{panelView:e,keystrokes:t}=this;this._bodyCollection.has(e)&&(this._bodyCollection.remove(e),t.stopListening(e.element));}_addPanelToBody(){const{panelView:t,buttonView:i,keystrokes:n}=this;this._bodyCollection.has(t)||(this._bodyCollection.add(t),n.listenTo(t.element),t.pin({positions:this._panelPositions,limiter:exports.global.document.body,element:t.element,target:i.element,fitInViewport:true}));}}class aw extends ew{_definition;_cachedMenus=[];_cachedButtons=[];_bodyCollection;constructor(e,t,i){super(e),this._bodyCollection=t,this._definition=i,this.set("menuPanelClass",void 0);}get menus(){return Array.from(this._cachedMenus.values())}get buttons(){return Array.from(this._cachedButtons.values())}render(){this._createStructure(this._definition,null),super.render(),nw.toggleMenusAndFocusItemsOnHover(this),nw.closeMenuWhenAnotherOnTheSameLevelOpens(this);}closeMenus(){this.menus.forEach(e=>{e.isOpen=false;});}_createStructure(e,t){const i=[];for(const n of e){let e;"menu"in n?(e=new rw(this.locale,this._bodyCollection,n.id,n.menu,t),e.panelView.bind("class").to(this,"menuPanelClass"),t||e.delegate(...rw.DELEGATED_EVENTS).to(this,e=>`menu:${e}`),this._cachedMenus.push(e),this._createStructure(n.children,e)):(e=new Kb(this.locale,n.id,n.label),t||e.delegate("execute").to(this,"menu:execute"),this._cachedButtons.push(e));const s=new iw(this.locale,t,e);t||s.delegate("mouseenter").to(this,"menu:mouseenter"),i.push(s);}(t?t.listView:this).items.addMany(i);}}class lw extends Cs{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}});}}class cw extends Cs{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__line-break"]}});}}function uw(e){return e.bindTemplate.to(t=>{t.target===e.element&&t.preventDefault();})}function dw(e){if(Array.isArray(e))return {items:e,removeItems:[]};const t={items:[],removeItems:[]};return e?{...t,...e}:t}const hw=(()=>({alignLeft:Xh,bold:om,importExport:Cg,paragraph:Cf,plus:Sf,text:hp,threeVerticalDots:fp,pilcrow:Ef,dragIndicator:Hm}))();class mw extends Cs{options;items;focusTracker;keystrokes;itemsView;children;focusables;_focusCycler;_behavior;constructor(e,t){super(e);const i=this.bindTemplate,n=this.t;this.options=t||{},this.set("ariaLabel",n("Editor toolbar")),this.set("maxWidth","auto"),this.set("role","toolbar"),this.set("isGrouping",!!this.options.shouldGroupWhenFull),this.items=this.createCollection(),this.focusTracker=new An,this.keystrokes=new In,this.set("class",void 0),this.set("isCompact",false),this.set("isVertical",false),this.itemsView=new gw(e),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection();const s="rtl"===e.uiLanguageDirection;this._focusCycler=new Fp({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",i.to("class"),i.if("isCompact","ck-toolbar_compact"),i.if("isGrouping","ck-toolbar_grouping"),i.if("isVertical","ck-toolbar_vertical")];this.options.shouldGroupWhenFull&&this.options.isFloating&&o.push("ck-toolbar_floating"),this.setTemplate({tag:"div",attributes:{class:o,role:i.to("role"),"aria-label":i.to("ariaLabel"),style:{maxWidth:i.to("maxWidth")},tabindex:-1},children:this.children,on:{mousedown:uw(this)}}),this._behavior=this.options.shouldGroupWhenFull?new pw(this):new fw(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,i){this.items.addMany(this._buildItemsFromConfig(e,t,i));}switchBehavior(e){this._behavior.type!==e&&(this._behavior.destroy(),this.itemsView.children.clear(),this.focusables.clear(),"dynamic"===e?(this._behavior=new pw(this),this._behavior.render(this),this._behavior.refreshItems()):(this._behavior=new fw(this),this._behavior.render(this)));}_buildItemsFromConfig(e,t,i){const n=dw(e),s=i||n.removeItems;return this._cleanItemsConfiguration(n.items,t,s).map(e=>ne(e)?this._createNestedToolbarDropdown(e,t,s):"|"===e?new lw:"-"===e?new cw:t.create(e)).filter(e=>!!e)}_cleanItemsConfiguration(e,t,i){const n=e.filter((e,n,s)=>"|"===e||-1===i.indexOf(e)&&("-"===e?!this.options.shouldGroupWhenFull||(P("toolbarview-line-break-ignored-when-grouping-items",s),false):!(!ne(e)&&!t.has(e))||(P("toolbarview-item-unavailable",{item:e}),false)));return this._cleanSeparatorsAndLineBreaks(n)}_cleanSeparatorsAndLineBreaks(e){const t=e=>"-"!==e&&"|"!==e,i=e.length,n=e.findIndex(t);if(-1===n)return [];const s=i-e.slice().reverse().findIndex(t);return e.slice(n,s).filter((e,i,n)=>{if(t(e))return  true;return !(i>0&&n[i-1]===e)})}_createNestedToolbarDropdown(e,t,i){let{label:n,icon:s,items:o,tooltip:r=true,withText:a=false}=e;if(o=this._cleanItemsConfiguration(o,t,i),!o.length)return null;const l=ww(this.locale);return n||P("toolbarview-nested-toolbar-dropdown-missing-label",e),l.class="ck-toolbar__nested-toolbar-dropdown",l.buttonView.set({label:n,tooltip:r,withText:!!a}),false!==s?l.buttonView.icon=hw[s]||s||fp:l.buttonView.withText=true,yw(l,()=>l.toolbarView._buildItemsFromConfig(o,t,i)),l}}class gw extends Cs{children;constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children});}}class fw{type="static";constructor(e){e.isGrouping=false,e.itemsView.children.bindTo(e.items).using(e=>e),e.focusables.bindTo(e.items).using(e=>Dp(e)?e:null);}render(){}destroy(){}}class pw{type="dynamic";view;viewChildren;viewFocusables;viewItemsView;viewFocusTracker;viewLocale;ungroupedItems;groupedItems;groupedItemsDropdown;resizeObserver=null;cachedPadding=null;shouldUpdateGroupingOnNextResize=false;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.view.isGrouping=true,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 i=t.index,n=Array.from(t.added);for(const e of t.removed)i>=this.ungroupedItems.length?this.groupedItems.remove(e):this.ungroupedItems.remove(e);for(let e=i;e<i+n.length;e++){const t=n[e-i];e>this.ungroupedItems.length?this.groupedItems.add(t,e-this.ungroupedItems.length):this.ungroupedItems.add(t,e);}this._updateGrouping();});}render(e){this.viewElement=e.element,this._enableGroupingOnResize(),this._enableGroupingOnMaxWidthChange(e);}destroy(){this.groupedItemsDropdown.destroy(),this.viewChildren.length>1&&(this.viewChildren.remove(this.groupedItemsDropdown),this.viewChildren.remove(this.viewChildren.last)),this.resizeObserver.destroy();}refreshItems(){const e=this.view;if(e.items.length){for(let t=0;t<e.items.length;t++){const i=[...e.items][t];this.ungroupedItems.add(i,t);}this._updateGrouping();}}_updateGrouping(){if(!this.viewElement.ownerDocument.body.contains(this.viewElement))return;if(!Fi(this.viewElement))return void(this.shouldUpdateGroupingOnNextResize=true);const e=this.groupedItems.length;let t;for(;this._areItemsOverflowing;)this._groupLastItem(),t=true;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  false;const t=this.viewElement,i=this.viewLocale.uiLanguageDirection,n=new Ci(t.lastChild),s=new Ci(t);if(!this.cachedPadding){const n=exports.global.window.getComputedStyle(t),s="ltr"===i?"paddingRight":"paddingLeft";this.cachedPadding=Number.parseInt(n[s]);}return "ltr"===i?n.right>s.right-this.cachedPadding:n.left<s.left+this.cachedPadding}_enableGroupingOnResize(){let e;this.resizeObserver=new Pi(this.viewElement,t=>{e&&e===t.contentRect.width&&!this.shouldUpdateGroupingOnNextResize||(this.shouldUpdateGroupingOnNextResize=false,this._updateGrouping(),e=t.contentRect.width);}),this._updateGrouping();}_enableGroupingOnMaxWidthChange(e){e.on("change:maxWidth",()=>{this._updateGrouping();});}_groupLastItem(){this.groupedItems.length||(this.viewChildren.add(new lw),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,i=ww(e);return i.class="ck-toolbar__grouped-dropdown",i.panelPosition="ltr"===e.uiLanguageDirection?"sw":"se",yw(i,this.groupedItems),i.buttonView.set({label:t("Show more items"),tooltip:true,tooltipPosition:"rtl"===e.uiLanguageDirection?"se":"sw",icon:fp}),i}_updateFocusCyclableItems(){this.viewFocusables.clear(),this.ungroupedItems.map(e=>{Dp(e)&&this.viewFocusables.add(e);}),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown);}}class bw extends Cs{children;actionView;arrowView;keystrokes;focusTracker;constructor(e,t){super(e);const i=this.bindTemplate;this.set("class",void 0),this.set("labelStyle",void 0),this.set("icon",void 0),this.set("isEnabled",true),this.set("isOn",false),this.set("isToggleable",false),this.set("isVisible",true),this.set("keystroke",void 0),this.set("withKeystroke",false),this.set("label",void 0),this.set("tabindex",-1),this.set("tooltip",false),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",false),this.children=this.createCollection(),this.actionView=this._createActionView(t),this.arrowView=this._createArrowView(),this.keystrokes=new In,this.focusTracker=new An,this.setTemplate({tag:"div",attributes:{class:["ck","ck-splitbutton",i.to("class"),i.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 Bp;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 Bp,t=e.bindTemplate;return e.icon=Um,e.extendTemplate({attributes:{class:["ck-splitbutton__arrow"],"data-cke-tooltip-disabled":t.to("isOn"),"aria-haspopup":true,"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 ww(t,i=Gb){const n="function"==typeof i?new i(t):i,s=new $b(t),o=new Wb(t,n,s);return n.bind("isEnabled").to(o),n instanceof bw?n.arrowView.bind("isOn").to(o,"isOpen"):n.bind("isOn").to(o,"isOpen"),function(t){((function(e){Ss({emitter:e,activator:()=>e.isRendered&&e.isOpen,callback:()=>{e.isOpen=false;},contextElements:()=>[e.element,...Ew(e.focusTracker).filter(t=>!e.element.contains(t))]});}))(t),function(e){e.on("execute",t=>{t.source instanceof rb||(e.isOpen=false);});}(t),function(e){e.focusTracker.on("change:isFocused",(t,i,n)=>{!n&&e.isOpen&&(e.isOpen=false);});}(t),function(e){e.keystrokes.set("arrowdown",(t,i)=>{e.isOpen&&(e.panelView.focus(),i());}),e.keystrokes.set("arrowup",(t,i)=>{e.isOpen&&(e.panelView.focusLast(),i());});}(t),function(t){t.on("change:isOpen",(i,n,s)=>{if(s)return;t.focusTracker.elements.some(t=>t.contains(exports.global.document.activeElement))&&t.buttonView.focus();});}(t),function(e){e.on("change:isOpen",(t,i,n)=>{n&&e.panelView.focus();},{priority:"low"});}(t);}(o),o}function vw(e,t,i,n={}){e.menuView=new aw(e.locale,t,i),e.focusTracker.add(e.menuView),e.isOpen?_w(e,n):e.once("change:isOpen",()=>{_w(e,n);},{priority:"highest"});}function _w(e,t){const i=e.menuView,n=e.locale.t;i.delegate("menu:execute").to(e,"execute"),i.listenTo(e,"change:isOpen",(e,t,n)=>{n||i.closeMenus();},{priority:"low"}),e.panelView.children.add(i);for(const t of i.menus)e.focusTracker.add(t);i.ariaLabel=t.ariaLabel||n("Dropdown menu");}function yw(e,t,i={}){e.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),e.isOpen?kw(e,t,i):e.once("change:isOpen",()=>kw(e,t,i),{priority:"highest"}),i.enableActiveItemFocusOnDropdownOpen&&Aw(e,()=>e.toolbarView.items.find(e=>e.isOn));}function kw(e,t,i){const n=e.locale,s=n.t,o=e.toolbarView=new mw(n),r="function"==typeof t?t():t;o.ariaLabel=i.ariaLabel||s("Dropdown toolbar"),i.maxWidth&&(o.maxWidth=i.maxWidth),i.class&&(o.class=i.class),i.isCompact&&(o.isCompact=i.isCompact),i.isVertical&&(o.isVertical=true),r instanceof Xn?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 Cw(e,t,i={}){e.isOpen?xw(e,t,i):e.once("change:isOpen",()=>xw(e,t,i),{priority:"highest"}),Aw(e,()=>e.listView.items.find(e=>e instanceof Qb&&e.children.first.isOn));}function xw(e,t,i){const n=e.locale,s=e.listView=new Xb(n),o="function"==typeof t?t():t;s.ariaLabel=i.ariaLabel,s.role=i.role,Tw(e,s.items,o,n),e.panelView.children.add(s),s.items.delegate("execute").to(e);}function Aw(e,t){e.on("change:isOpen",()=>{if(!e.isOpen)return;const i=t();i&&("function"==typeof i.focus?i.focus():P("ui-dropdown-focus-child-on-open-child-missing-focus",{view:i}));},{priority:E.low-10});}function Ew(e){return [...e.elements,...e.externalViews.flatMap(e=>Ew(e.focusTracker))]}function Tw(e,t,i,n){!function(e){let t=0;const i=e=>e instanceof Qb&&e.children.first instanceof Gp?e.children.first:null,n=e=>{const t=i(e);return t&&t.isToggleable?t:null},s=t=>{for(const n of e){const e=i(n);e&&(e.hasCheckSpace=t);}};e.on("change",(e,o)=>{const r=t>0;for(const e of o.removed)n(e)&&t--;for(const e of o.added){const n=i(e);n&&(n.isToggleable&&t++,n.hasCheckSpace=t>0);}const a=t>0;r!==a&&s(a);});}(t),t.bindTo(i).using(t=>{if("separator"===t.type)return new Yb(n);if("group"===t.type){const i=new Zb(n);return i.set({label:t.label}),Tw(e,i.items,t.items,n),i.items.delegate("execute").to(e),i}if("button"===t.type||"switchbutton"===t.type){const e="menuitemcheckbox"===t.model.role||"menuitemradio"===t.model.role,i=new Qb(n);let s;return "button"===t.type?(s=new Gp(n,t.labelView),s.set({isToggleable:e})):s=new rb(n),s.bind(...Object.keys(t.model)).to(t.model),s.delegate("execute").to(i),i.children.add(s),i}return null});}const Sw=(e,t,i)=>{const n=new Hb(e.locale);return n.set({id:t,ariaDescribedById:i}),n.bind("isReadOnly").to(e,"isEnabled",e=>!e),n.bind("hasError").to(e,"errorText",e=>!!e),n.on("input",()=>{e.errorText=null;}),e.bind("isEmpty","isFocused","placeholder").to(n),n},Iw=(e,t,i)=>{const n=new qb(e.locale);return n.set({id:t,ariaDescribedById:i,inputMode:"numeric"}),n.bind("isReadOnly").to(e,"isEnabled",e=>!e),n.bind("hasError").to(e,"errorText",e=>!!e),n.on("input",()=>{e.errorText=null;}),e.bind("isEmpty","isFocused","placeholder").to(n),n},Pw=(e,t,i)=>{const n=new Ub(e.locale);return n.set({id:t,ariaDescribedById:i}),n.bind("isReadOnly").to(e,"isEnabled",e=>!e),n.bind("hasError").to(e,"errorText",e=>!!e),n.on("input",()=>{e.errorText=null;}),e.bind("isEmpty","isFocused","placeholder").to(n),n},Vw=(e,t,i)=>{const n=ww(e.locale);return n.set({id:t,ariaDescribedById:i}),n.bind("isEnabled").to(e),n},Rw=(e,t=0,i=1)=>e>i?i:e<t?t:e,Ow=(e,t=0,i=Math.pow(10,t))=>Math.round(i*e)/i,Bw=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?Ow(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?Ow(parseInt(e.substring(6,8),16)/255,2):1}),Lw=e=>{const{h:t,s:i,l:n}=(({h:e,s:t,v:i,a:n})=>{const s=(200-t)*i/100;return {h:Ow(e),s:Ow(s>0&&s<200?t*i/100/(s<=100?s:200-s)*100:0),l:Ow(s/2),a:Ow(n,2)}})(e);return `hsl(${t}, ${i}%, ${n}%)`},Mw=({h:e,s:t,v:i,a:n})=>{e=e/360*6,t/=100,i/=100;const s=Math.floor(e),o=i*(1-t),r=i*(1-(e-s)*t),a=i*(1-(1-e+s)*t),l=s%6;return {r:Ow(255*[i,r,o,o,a,i][l]),g:Ow(255*[a,i,i,r,o,o][l]),b:Ow(255*[o,o,a,i,i,r][l]),a:Ow(n,2)}},Fw=e=>{const t=e.toString(16);return t.length<2?"0"+t:t},Nw=({r:e,g:t,b:i,a:n})=>{const s=n<1?Fw(Ow(255*n)):"";return "#"+Fw(e)+Fw(t)+Fw(i)+s},Dw=({r:e,g:t,b:i,a:n})=>{const s=Math.max(e,t,i),o=s-Math.min(e,t,i),r=o?s===e?(t-i)/o:s===t?2+(i-e)/o:4+(e-t)/o:0;return {h:Ow(60*(r<0?r+6:r)),s:Ow(s?o/s*100:0),v:Ow(s/255*100),a:n}},zw=(e,t)=>{if(e===t)return  true;for(const i in e)if(e[i]!==t[i])return  false;return  true},Hw={},qw=e=>{let t=Hw[e];return t||(t=document.createElement("template"),t.innerHTML=e,Hw[e]=t),t},Uw=(e,t,i)=>{e.dispatchEvent(new CustomEvent(t,{bubbles:true,detail:i}));};let jw=false;const $w=e=>"touches"in e,Ww=(e,t)=>{const i=$w(t)?t.touches[0]:t,n=e.el.getBoundingClientRect();Uw(e.el,"move",e.getMove({x:Rw((i.pageX-(n.left+window.pageXOffset))/n.width),y:Rw((i.pageY-(n.top+window.pageYOffset))/n.height)}));};class Gw{constructor(e,t,i,n){const s=qw(`<div role="slider" tabindex="0" part="${t}" ${i}><div part="${t}-pointer"></div></div>`);e.appendChild(s.content.cloneNode(true));const o=e.querySelector(`[part=${t}]`);o.addEventListener("mousedown",this),o.addEventListener("touchstart",this),o.addEventListener("keydown",this),this.el=o,this.xy=n,this.nodes=[o.firstChild,o];}set dragging(e){const t=e?document.addEventListener:document.removeEventListener;t(jw?"touchmove":"mousemove",this),t(jw?"touchend":"mouseup",this);}handleEvent(e){switch(e.type){case "mousedown":case "touchstart":if(e.preventDefault(),!(e=>!(jw&&!$w(e)||(jw||(jw=$w(e)),0)))(e)||!jw&&0!=e.button)return;this.el.focus(),Ww(this,e),this.dragging=true;break;case "mousemove":case "touchmove":e.preventDefault(),Ww(this,e);break;case "mouseup":case "touchend":this.dragging=false;break;case "keydown":((e,t)=>{const i=t.keyCode;i>40||e.xy&&i<37||i<33||(t.preventDefault(),Uw(e.el,"move",e.getMove({x:39===i?.01:37===i?-0.01:34===i?.05:33===i?-0.05:35===i?1:36===i?-1:0,y:40===i?.01:38===i?-0.01:0},true)));})(this,e);}}style(e){e.forEach((e,t)=>{for(const i in e)this.nodes[t].style.setProperty(i,e[i]);});}}class Kw extends Gw{constructor(e){super(e,"hue",'aria-label="Hue" aria-valuemin="0" aria-valuemax="360"',false);}update({h:e}){this.h=e,this.style([{left:e/360*100+"%",color:Lw({h:e,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuenow",`${Ow(e)}`);}getMove(e,t){return {h:t?Rw(this.h+360*e.x,0,360):360*e.x}}}class Jw extends Gw{constructor(e){super(e,"saturation",'aria-label="Color"',true);}update(e){this.hsva=e,this.style([{top:100-e.v+"%",left:`${e.s}%`,color:Lw(e)},{"background-color":Lw({h:e.h,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuetext",`Saturation ${Ow(e.s)}%, Brightness ${Ow(e.v)}%`);}getMove(e,t){return {s:t?Rw(this.hsva.s+100*e.x,0,100):100*e.x,v:t?Rw(this.hsva.v-100*e.y,0,100):Math.round(100-100*e.y)}}}const Qw=Symbol("same"),Yw=Symbol("color"),Zw=Symbol("hsva"),Xw=Symbol("update"),ev=Symbol("parts"),tv=Symbol("css"),iv=Symbol("sliders");class nv extends HTMLElement{static get observedAttributes(){return ["color"]}get[tv](){return [':host{display:flex;flex-direction:column;position:relative;width:200px;height:200px;user-select:none;-webkit-user-select:none;cursor:default}:host([hidden]){display:none!important}[role=slider]{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;outline:0}[role=slider]:last-child{border-radius:0 0 8px 8px}[part$=pointer]{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;display:flex;place-content:center center;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}[part$=pointer]::after{content:"";width:100%;height:100%;border-radius:inherit;background-color:currentColor}[role=slider]:focus [part$=pointer]{transform:translate(-50%,-50%) scale(1.1)}',"[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[iv](){return [Jw,Kw]}get color(){return this[Yw]}set color(e){if(!this[Qw](e)){const t=this.colorModel.toHsva(e);this[Xw](t),this[Yw]=e;}}constructor(){super();const e=qw(`<style>${this[tv].join("")}</style>`),t=this.attachShadow({mode:"open"});t.appendChild(e.content.cloneNode(true)),t.addEventListener("move",this),this[ev]=this[iv].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,i){const n=this.colorModel.fromAttr(i);this[Qw](n)||(this.color=n);}handleEvent(e){const t=this[Zw],i={...t,...e.detail};let n;this[Xw](i),zw(i,t)||this[Qw](n=this.colorModel.fromHsva(i))||(this[Yw]=n,Uw(this,"color-changed",{value:n}));}[Qw](e){return this.color&&this.colorModel.equal(e,this.color)}[Xw](e){this[Zw]=e,this[ev].forEach(t=>t.update(e));}}const sv={defaultColor:"#000",toHsva:e=>Dw(Bw(e)),fromHsva:({h:e,s:t,v:i})=>Nw(Mw({h:e,s:t,v:i,a:1})),equal:(e,t)=>e.toLowerCase()===t.toLowerCase()||zw(Bw(e),Bw(t)),fromAttr:e=>e};class ov extends nv{get colorModel(){return sv}}class rv extends Cs{hexInputRow;_debounceColorPickerEvent;_config;constructor(e,t={}){super(e),this.set({color:"",_hexColor:""}),this.hexInputRow=this._createInputRow();const i=this.createCollection();t.hideInput||i.add(this.hexInputRow),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker"],tabindex:-1},children:i}),this._config=t,this._debounceColorPickerEvent=st(e=>{this.set("color",e),this.fire("colorSelected",{color:this.color});},150,{leading:true}),this.on("set:color",(e,t,i)=>{e.return=Bb(i,this._config.format||"hsl");}),this.on("change:color",()=>{this._hexColor=av(this.color);}),this.on("change:_hexColor",()=>{document.activeElement!==this.picker&&this.picker.setAttribute("color",this._hexColor),av(this.color)!=av(this._hexColor)&&(this.color=this._hexColor);});}render(){if(super.render(),Mb("hex-color-picker",ov),this.picker=exports.global.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&&(n.isGecko||n.isiOS||n.isSafari||n.isBlink)){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 lv(e));this.slidersView=this.createCollection(),e.forEach(e=>{this.slidersView.add(e);});}_createInputRow(){const e=this._createColorInput();return new uv(this.locale,e)}_createColorInput(){const e=new Nb(this.locale,Sw),{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=dv(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").'),false))}resetValidationStatus(){this.hexInputRow.inputView.errorText=null;}}function av(e){let t=Lb(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 lv extends Cs{constructor(e){super(),this.element=e;}focus(){this.element.focus();}}class cv extends Cs{constructor(e){super(e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker__hash-view"]},children:"#"});}}class uv extends Cs{children;inputView;constructor(e,t){super(e),this.inputView=t,this.children=this.createCollection([new cv,this.inputView]),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker__row"]},children:this.children});}getParsedColor(){return dv(this.inputView.fieldView.element.value)}}function dv(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 hv extends($t(kn)){constructor(e){super(e),this.set("isEmpty",true),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 mv extends Cs{items;colorDefinitions;focusTracker;columns;documentColors;documentColorsCount;staticColorsGrid;documentColorsGrid;colorPickerButtonView;removeColorButtonView;_focusables;_documentColorsLabel;_removeButtonLabel;_colorPickerLabel;constructor(e,{colors:t,columns:i,removeButtonLabel:n,documentColorsLabel:s,documentColorsCount:o,colorPickerLabel:r,focusTracker:a,focusables:l}){super(e);const c=this.bindTemplate;this.set("isVisible",true),this.focusTracker=a,this.items=this.createCollection(),this.colorDefinitions=t,this.columns=i,this.documentColors=new hv,this.documentColorsCount=o,this._focusables=l,this._removeButtonLabel=n,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 i=e.document,n=this.documentColorsCount;this.documentColors.clear();for(const s of i.getRoots()){const i=e.createRangeIn(s);for(const e of i.getItems())if(e.is("$textProxy")&&e.hasAttribute(t)&&(this._addColorToDocumentColors(e.getAttribute(t)),this.documentColors.length>=n))return}}updateSelectedColors(){const e=this.documentColorsGrid,t=this.staticColorsGrid,i=this.selectedColor;t.selectedColor=i,e&&(e.selectedColor=i);}render(){if(super.render(),this.staticColorsGrid=this._createStaticColorsGrid(),this.items.add(this.staticColorsGrid),this.documentColorsCount){const e=es.bind(this.documentColors,this.documentColors),t=new Cs(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 Bp,this.colorPickerButtonView.set({label:this._colorPickerLabel,withText:true,icon:Sm,class:"ck-color-selector__color-picker"}),this.colorPickerButtonView.on("execute",()=>{this.fire("colorPicker:show");});}_createRemoveColorButton(){const e=new Bp;return e.set({withText:true,icon:Wm,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 pb(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=es.bind(this.documentColors,this.documentColors),t=new pb(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 fb;return t.set({color:e.color,hasBorder:e.options?.hasBorder}),e.label&&t.set({label:e.label,tooltip:true}),t.on("execute",()=>{this.fire("execute",{value:e.color,source:"documentColorsGrid"});}),t}),this.documentColors.on("change:isEmpty",(e,i,n)=>{n&&(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:false}});}}class gv extends Cs{items;colorPickerView;saveButtonView;cancelButtonView;actionBarView;focusTracker;keystrokes;_focusables;_colorPickerViewConfig;constructor(e,{focusTracker:t,focusables:i,keystrokes:n,colorPickerViewConfig:s}){super(e),this.items=this.createCollection(),this.focusTracker=t,this.keystrokes=n,this.set("isVisible",false),this.set("selectedColor",void 0),this._focusables=i,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 rv(this.locale,{...this._colorPickerViewConfig});this.colorPickerView=e,this.colorPickerView.render(),this.selectedColor&&(e.color=this.selectedColor),this.listenTo(this,"change:selectedColor",(t,i,n)=>{e.color=n;}),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 e of this.colorPickerView.slidersView)this.focusTracker.add(e.element),this._focusables.add(e);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 i=new Cs,n=this.createCollection();return n.add(e),n.add(t),i.setTemplate({tag:"div",attributes:{class:["ck","ck-color-selector_action-bar"]},children:n}),i}_createActionButtons(){const e=this.locale,t=e.t,i=new Bp(e),n=new Bp(e);return i.set({icon:vm,class:"ck-button-save",type:"button",withText:false,label:t("Accept")}),n.set({icon:pm,class:"ck-button-cancel",type:"button",withText:false,label:t("Cancel")}),i.on("execute",()=>{this.colorPickerView.isValid()&&this.fire("execute",{source:"colorPickerSaveButton",value:this.selectedColor});}),n.on("execute",()=>{this.fire("colorPicker:cancel");}),{saveButtonView:i,cancelButtonView:n}}_executeUponColorChange(){this.colorPickerView.on("colorSelected",(e,t)=>{this.fire("execute",{value:t.color,source:"colorPicker"}),this.set("selectedColor",t.color);});}}class fv extends Cs{focusTracker;keystrokes;items;colorGridsFragmentView;colorPickerFragmentView;_focusCycler;_focusables;_colorPickerViewConfig;constructor(e,{colors:t,columns:i,removeButtonLabel:n,documentColorsLabel:s,documentColorsCount:o,colorPickerLabel:r,colorPickerViewConfig:a}){super(e),this.items=this.createCollection(),this.focusTracker=new An,this.keystrokes=new In,this._focusables=new Xn,this._colorPickerViewConfig=a,this._focusCycler=new Fp({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.colorGridsFragmentView=new mv(e,{colors:t,columns:i,removeButtonLabel:n,documentColorsLabel:s,documentColorsCount:o,colorPickerLabel:r,focusTracker:this.focusTracker,focusables:this._focusables}),this.colorPickerFragmentView=new gv(e,{focusables:this._focusables,focusTracker:this.focusTracker,keystrokes:this.keystrokes,colorPickerViewConfig:a}),this.set("_isColorGridsFragmentVisible",true),this.set("_isColorPickerFragmentVisible",false),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,i)=>{this.colorGridsFragmentView.set("selectedColor",i),this.colorPickerFragmentView.set("selectedColor",i);}),this.colorGridsFragmentView.on("change:selectedColor",(e,t,i)=>{this.set("selectedColor",i);}),this.colorPickerFragmentView.on("change:selectedColor",(e,t,i)=>{this.set("selectedColor",i);}),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=true,this.colorPickerFragmentView.focus(),this.colorPickerFragmentView.resetValidationStatus(),this._isColorGridsFragmentVisible=false);}showColorGridsFragment(){this._isColorGridsFragmentVisible||(this._isColorGridsFragmentVisible=true,this.colorGridsFragmentView.focus(),this._isColorPickerFragmentVisible=false);}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 pv{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(bv(e),{callback:t,originalName:e});}create(e){if(!this.has(e))throw new I("componentfactory-item-missing",this,{name:e});return this._components.get(bv(e)).callback(this.editor.locale)}has(e){return this._components.has(bv(e))}}function bv(e){return String(e).toLowerCase()}const wv="ck-tooltip";class vv extends(ci()){tooltipTextView;balloonPanelView;static defaultBalloonPositions=eb.generatePositions({heightOffset:5,sideOffset:13});_currentElementWithTooltip=null;_currentTooltipPosition=null;_mutationObserver=null;_pinTooltipDebounced;_unpinTooltipDebounced;_watchdogExcluded;static _editors=new Set;static _instance=null;constructor(t){if(super(),vv._editors.add(t),vv._instance)return vv._instance;vv._instance=this,this.tooltipTextView=new Cs(t.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 eb(t.locale),this.balloonPanelView.class=wv,this.balloonPanelView.content.add(this.tooltipTextView),this._mutationObserver=function(e){const t=new MutationObserver(()=>{e();});return {attach(e){t.observe(e,{attributes:true,attributeFilter:["data-cke-tooltip-text","data-cke-tooltip-position"]});},detach(){t.disconnect();}}}(()=>{this._updateTooltipPosition();}),this._pinTooltipDebounced=st(this._pinTooltip,600),this._unpinTooltipDebounced=st(this._unpinTooltip,400),this.listenTo(exports.global.document,"keydown",this._onKeyDown.bind(this),{useCapture:true}),this.listenTo(exports.global.document,"mouseenter",this._onEnterOrFocus.bind(this),{useCapture:true}),this.listenTo(exports.global.document,"mouseleave",this._onLeaveOrBlur.bind(this),{useCapture:true}),this.listenTo(exports.global.document,"focus",this._onEnterOrFocus.bind(this),{useCapture:true}),this.listenTo(exports.global.document,"blur",this._onLeaveOrBlur.bind(this),{useCapture:true}),this.listenTo(exports.global.document,"scroll",this._onScroll.bind(this),{useCapture:true}),this._watchdogExcluded=true;}destroy(e){const t=e.ui.view&&e.ui.view.body;vv._editors.delete(e),this.stopListening(e.ui),t&&t.has(this.balloonPanelView)&&t.remove(this.balloonPanelView),vv._editors.size||(this._unpinTooltip(),this.balloonPanelView.destroy(),this.stopListening(),vv._instance=null);}static getPositioningFunctions(e){const t=vv.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 i=_v(t);i?i!==this._currentElementWithTooltip?(this._unpinTooltip(),"focus"===e.name&&!i.matches(":hover")||i.matches("[data-cke-tooltip-instant]")?this._pinTooltip(i,yv(i)):this._pinTooltipDebounced(i,yv(i))):this._unpinTooltipDebounced.cancel():"focus"===e.name&&this._unpinTooltip();}_onLeaveOrBlur(e,{target:t,relatedTarget:i}){if("mouseleave"===e.name){if(!St(t))return;const e=this.balloonPanelView.element,n=e&&(e===i||e.contains(i)),s=!n&&t===e;if(n)return void this._unpinTooltipDebounced.cancel();if(!s&&this._currentElementWithTooltip&&t!==this._currentElementWithTooltip)return;const o=_v(t),r=_v(i);(s||o&&o!==r)&&(this._pinTooltipDebounced.cancel(),this._currentElementWithTooltip&&this._currentElementWithTooltip.matches("[data-cke-tooltip-instant]")||o&&o.matches("[data-cke-tooltip-instant]")?this._unpinTooltip():this._unpinTooltipDebounced());}else {if(this._currentElementWithTooltip&&t!==this._currentElementWithTooltip)return;this._pinTooltipDebounced.cancel(),this._unpinTooltipDebounced();}}_onScroll(e,{target:t}){this._currentElementWithTooltip&&(t.contains(this.balloonPanelView.element)&&t.contains(this._currentElementWithTooltip)||this._unpinTooltip());}_pinTooltip(e,{text:t,position:i,cssClass:n}){this._unpinTooltip();const s=Cn(vv._editors.values()).ui.view.body;s.has(this.balloonPanelView)||s.add(this.balloonPanelView),this.tooltipTextView.text=t,this.balloonPanelView.class=[wv,n].filter(e=>e).join(" "),this.balloonPanelView.pin({target:e,positions:vv.getPositioningFunctions(i)}),this._mutationObserver.attach(e);for(const e of vv._editors)this.listenTo(e.ui,"update",this._updateTooltipPosition.bind(this),{priority:"low"});this._currentElementWithTooltip=e,this._currentTooltipPosition=i;}_unpinTooltip(){this._unpinTooltipDebounced.cancel(),this._pinTooltipDebounced.cancel(),this.balloonPanelView.unpin();for(const e of vv._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=yv(this._currentElementWithTooltip);Fi(this._currentElementWithTooltip)&&e.text?this.balloonPanelView.pin({target:this._currentElementWithTooltip,positions:vv.getPositioningFunctions(e.position)}):this._unpinTooltip();}}function _v(e){return St(e)?e.closest("[data-cke-tooltip-text]:not([data-cke-tooltip-disabled])"):null}function yv(e){return {text:e.dataset.ckeTooltipText,position:e.dataset.ckeTooltipPosition||"s",cssClass:e.dataset.ckeTooltipClass||""}}class kv extends ib{licenseTypeMessage={evaluation:"For evaluation purposes only",trial:"For evaluation purposes only",development:"For development purposes only"};constructor(e){super(e,{balloonClass:"ck-evaluation-badge-balloon"});}_isEnabled(){const e=xv(this.editor.config.get("licenseKey"));return Boolean(e&&this.licenseTypeMessage[e])}_createBadgeContent(){const e=xv(this.editor.config.get("licenseKey"));return new Cv(this.editor.locale,this.licenseTypeMessage[e])}_getNormalizedConfig(){const e=super._getNormalizedConfig(),t=this.editor.config.get("ui.poweredBy")||{};return {position:t.position||e.position,side:"left"===(t.side||e.side)?"right":"left",verticalOffset:e.verticalOffset,horizontalOffset:e.horizontalOffset}}}class Cv extends Cs{constructor(e,t){super(e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-evaluation-badge"],"aria-hidden":true},children:[{tag:"span",attributes:{class:["ck","ck-evaluation-badge__label"]},children:[t]}]});}}function xv(e){if("GPL"==e)return "GPL";const t=Nn(e.split(".")[1]);return t?t.licenseType||"production":null}class Av extends Qb{constructor(e,t){super(e);const i=this.bindTemplate;this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item"]},on:{mouseenter:i.to("mouseenter")}}),this.delegate("mouseenter").to(t);}}const Ev={toggleMenusAndFocusItemsOnHover(e){e.on("menu:mouseenter",t=>{if(e.isFocusBorderEnabled||e.isOpen){if(e.isOpen)for(const i of e.menus){const e=t.path[0],n=e instanceof Av&&e.children.first===i;i.isOpen=(t.path.includes(i)||n)&&i.isEnabled;}t.source.focus();}});},focusCycleMenusOnArrows(e){const t="rtl"===e.locale.uiLanguageDirection;function i(t,i){const n=e.children.getIndex(t),s=t.isOpen,o=e.children.length,r=e.children.get((n+o+i)%o);t.isOpen=false,s&&(r.isOpen=true),r.buttonView.focus();}e.on("menu:arrowright",e=>{i(e.source,t?-1:1);}),e.on("menu:arrowleft",e=>{i(e.source,t?1:-1);});},closeMenusWhenTheBarCloses(e){e.on("change:isOpen",()=>{e.isOpen||e.menus.forEach(e=>{e.isOpen=false;});});},closeMenuWhenAnotherOnTheSameLevelOpens(e){e.on("menu:change:isOpen",(t,i,n)=>{n&&e.menus.filter(e=>t.source.parentMenuView===e.parentMenuView&&t.source!==e&&e.isOpen).forEach(e=>{e.isOpen=false;});});},closeOnClickOutside(e){Ss({emitter:e,activator:()=>e.isOpen,callback:()=>e.close(),contextElements:()=>e.children.map(e=>e.element)});},enableFocusHighlightOnInteraction(e){let t=false;e.on("change:isOpen",(i,n,s)=>{s||(t||(e.isFocusBorderEnabled=false),t=false);}),e.listenTo(e.element,"keydown",()=>{t=true;},{useCapture:true}),e.listenTo(e.element,"keyup",()=>{t=false;},{useCapture:true}),e.listenTo(e.element,"focus",()=>{t&&(e.isFocusBorderEnabled=true);},{useCapture:true});}},Tv={openAndFocusPanelOnArrowDownKey(e){e.keystrokes.set("arrowdown",(t,i)=>{e.isEnabled&&e.focusTracker.focusedElement===e.buttonView.element&&(e.isOpen||(e.isOpen=true),e.panelView.focus(),i());});},openOnArrowRightKey(e){const t="rtl"===e.locale.uiLanguageDirection?"arrowleft":"arrowright";e.keystrokes.set(t,(t,i)=>{e.focusTracker.focusedElement===e.buttonView.element&&e.isEnabled&&(e.isOpen||(e.isOpen=true),e.panelView.focus(),i());});},openOnButtonClick(e){e.buttonView.on("execute",()=>{e.isOpen=true;});},toggleOnButtonClick(e){e.buttonView.on("execute",()=>{e.isOpen=!e.isOpen;});},openAndFocusOnEnterKeyPress(e){e.keystrokes.set("enter",(t,i)=>{e.focusTracker.focusedElement===e.buttonView.element&&(e.isOpen=true,e.panelView.focus(),i());});},closeOnArrowLeftKey(e){const t="rtl"===e.locale.uiLanguageDirection?"arrowright":"arrowleft";e.keystrokes.set(t,(t,i)=>{e.isOpen&&(e.isOpen=false,e.focus(),i());});},closeOnEscKey(e){e.keystrokes.set("esc",(t,i)=>{e.isOpen&&(e.isOpen=false,e.focus(),i());});},closeOnParentClose(e){e.parentMenuView.on("change:isOpen",(t,i,n)=>{n||t.source!==e.parentMenuView||(e.isOpen=false);});}},Sv={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"})},Iv=[{menuId:"file",label:"File",groups:[{groupId:"export",items:["menuBar:exportPdf","menuBar:exportWord"]},{groupId:"import",items:["menuBar:importWord"]},{groupId:"revisionHistory",items:["menuBar:revisionHistory"]}]},{menuId:"edit",label:"Edit",groups:[{groupId:"undo",items:["menuBar:undo","menuBar:redo"]},{groupId:"selectAll",items:["menuBar:selectAll"]},{groupId:"findAndReplace",items:["menuBar:findAndReplace"]}]},{menuId:"view",label:"View",groups:[{groupId:"sourceEditingEnhanced",items:["menuBar:sourceEditingEnhanced"]},{groupId:"sourceEditing",items:["menuBar:sourceEditing"]},{groupId:"showBlocks",items:["menuBar:showBlocks"]},{groupId:"previewMergeFields",items:["menuBar:previewMergeFields"]},{groupId:"fullscreen",items:["menuBar:fullscreen"]},{groupId:"restrictedEditing",items:["menuBar:restrictedEditing"]}]},{menuId:"insert",label:"Insert",groups:[{groupId:"insertMainWidgets",items:["menuBar:insertImage","menuBar:ckbox","menuBar:ckfinder","menuBar:insertTable","menuBar:insertTableLayout"]},{groupId:"insertInline",items:["menuBar:link","menuBar:insertFootnote","menuBar:bookmark","menuBar:comment","menuBar:insertMergeField","menuBar:emoji"]},{groupId:"insertMinorWidgets",items:["menuBar:mediaEmbed","menuBar:insertTemplate","menuBar:specialCharacters","menuBar:blockQuote","menuBar:codeBlock","menuBar:htmlEmbed"]},{groupId:"insertStructureWidgets",items:["menuBar:horizontalLine","menuBar:pageBreak","menuBar:tableOfContents"]},{groupId:"restrictedEditingException",items:["menuBar:restrictedEditingException:inline","menuBar:restrictedEditingException:block"]}]},{menuId:"format",label:"Format",groups:[{groupId:"textAndFont",items:[{menuId:"text",label:"Text",groups:[{groupId:"basicStyles",items:["menuBar:bold","menuBar:italic","menuBar:underline","menuBar:strikethrough","menuBar:superscript","menuBar:subscript","menuBar:code"]},{groupId:"textPartLanguage",items:["menuBar:textPartLanguage"]}]},{menuId:"font",label:"Font",groups:[{groupId:"fontProperties",items:["menuBar:fontSize","menuBar:fontFamily"]},{groupId:"fontColors",items:["menuBar:fontColor","menuBar:fontBackgroundColor"]},{groupId:"highlight",items:["menuBar:highlight"]}]},"menuBar:heading"]},{groupId:"list",items:["menuBar:bulletedList","menuBar:numberedList","menuBar:multiLevelList","menuBar:todoList"]},{groupId:"indent",items:["menuBar:alignment","menuBar:lineHeight","menuBar:indent","menuBar:outdent"]},{groupId:"caseChange",items:["menuBar:caseChange"]},{groupId:"removeFormat",items:["menuBar:removeFormat"]}]},{menuId:"tools",label:"Tools",groups:[{groupId:"aiTools",items:["menuBar:aiAssistant","menuBar:aiCommands","menuBar:toggleAi","menuBar:aiQuickActions"]},{groupId:"tools",items:["menuBar:trackChanges","menuBar:commentsArchive"]}]},{menuId:"help",label:"Help",groups:[{groupId:"help",items:["menuBar:accessibilityHelp"]}]}];function Pv(e){let t;return t="items"in e&&e.items?{items:e.items,removeItems:[],addItems:[],isVisible:true,isUsingDefaultConfig:false,...e}:{items:De(Iv),addItems:[],removeItems:[],isVisible:true,isUsingDefaultConfig:true,...e},t}function Vv({normalizedConfig:e,locale:t,componentFactory:i,extraItems:n}){const s=De(e);return Rv(e,s,n),function(e,t){const i=t.removeItems,n=[];t.items=t.items.filter(({menuId:e})=>!i.includes(e)||(n.push(e),false)),Mv(t.items,e=>{e.groups=e.groups.filter(({groupId:e})=>!i.includes(e)||(n.push(e),false));for(const t of e.groups)t.items=t.items.filter(e=>{const t=Hv(e);return !i.includes(t)||(n.push(t),false)});});for(const t of i)n.includes(t)||P("menu-bar-item-could-not-be-removed",{menuBarConfig:e,itemName:t});}(e,s),Rv(e,s,s.addItems),function(e,t,i){Mv(t.items,n=>{for(const s of n.groups)s.items=s.items.filter(s=>{const o="string"==typeof s&&!i.has(s);return o&&!t.isUsingDefaultConfig&&P("menu-bar-item-unavailable",{menuBarConfig:e,parentMenuConfig:De(n),componentName:s}),!o});});}(e,s,i),Bv(e,s),function(e,t){const i=t.t,n={File:i({string:"File",id:"MENU_BAR_MENU_FILE"}),Edit:i({string:"Edit",id:"MENU_BAR_MENU_EDIT"}),View:i({string:"View",id:"MENU_BAR_MENU_VIEW"}),Insert:i({string:"Insert",id:"MENU_BAR_MENU_INSERT"}),Format:i({string:"Format",id:"MENU_BAR_MENU_FORMAT"}),Tools:i({string:"Tools",id:"MENU_BAR_MENU_TOOLS"}),Help:i({string:"Help",id:"MENU_BAR_MENU_HELP"}),Text:i({string:"Text",id:"MENU_BAR_MENU_TEXT"}),Font:i({string:"Font",id:"MENU_BAR_MENU_FONT"})};Mv(e.items,e=>{e.label in n&&(e.label=n[e.label]);});}(s,t),s}function Rv(e,t,i){const n=[];if(0!=i.length){for(const e of i){const i=Dv(e.position),s=zv(e.position);if(Fv(e))if(s){const o=t.items.findIndex(e=>e.menuId===s);if(-1!=o)"before"===i?(t.items.splice(o,0,e.menu),n.push(e)):"after"===i&&(t.items.splice(o+1,0,e.menu),n.push(e));else {Ov(t,e.menu,s,i)&&n.push(e);}}else "start"===i?(t.items.unshift(e.menu),n.push(e)):"end"===i&&(t.items.push(e.menu),n.push(e));else if(Nv(e))Mv(t.items,t=>{if(t.menuId===s)"start"===i?(t.groups.unshift(e.group),n.push(e)):"end"===i&&(t.groups.push(e.group),n.push(e));else {const o=t.groups.findIndex(e=>e.groupId===s);-1!==o&&("before"===i?(t.groups.splice(o,0,e.group),n.push(e)):"after"===i&&(t.groups.splice(o+1,0,e.group),n.push(e)));}});else {Ov(t,e.item,s,i)&&n.push(e);}}for(const t of i)n.includes(t)||P("menu-bar-item-could-not-be-added",{menuBarConfig:e,addedItemConfig:t});}}function Ov(e,t,i,n){let s=false;return Mv(e.items,e=>{for(const{groupId:o,items:r}of e.groups){if(s)return;if(o===i)"start"===n?(r.unshift(t),s=true):"end"===n&&(r.push(t),s=true);else {const e=r.findIndex(e=>Hv(e)===i);-1!==e&&("before"===n?(r.splice(e,0,t),s=true):"after"===n&&(r.splice(e+1,0,t),s=true));}}}),s}function Bv(e,t){const i=t.isUsingDefaultConfig;let n=false;t.items=t.items.filter(t=>!!t.groups.length||(Lv(e,t,i),false)),t.items.length?(Mv(t.items,t=>{t.groups=t.groups.filter(e=>!!e.items.length||(n=true,false));for(const s of t.groups)s.items=s.items.filter(t=>!(qv(t)&&!t.groups.length)||(Lv(e,t,i),n=true,false));}),n&&Bv(e,t)):Lv(e,e,i);}function Lv(e,t,i){i||P("menu-bar-menu-empty",{menuBarConfig:e,emptyMenuConfig:t});}function Mv(e,t){if(Array.isArray(e))for(const t of e)i(t);function i(e){t(e);for(const t of e.groups)for(const e of t.items)qv(e)&&i(e);}}function Fv(e){return "object"==typeof e&&"menu"in e}function Nv(e){return "object"==typeof e&&"group"in e}function Dv(e){return e.startsWith("start")?"start":e.startsWith("end")?"end":e.startsWith("after")?"after":"before"}function zv(e){const t=e.match(/^[^:]+:(.+)/);return t?t[1]:null}function Hv(e){return "string"==typeof e?e:e.menuId}function qv(e){return "object"==typeof e&&"menuId"in e}class Uv extends($t()){editor;componentFactory;focusTracker;tooltipManager;poweredBy;evaluationBadge;ariaLiveAnnouncer;isReady=false;_editableElementsMap=new Map;_focusableToolbarDefinitions=[];_extraMenuBarElements=[];_lastFocusedForeignElement=null;_domEmitter;constructor(e){super();const t=e.editing.view;this.editor=e,this.componentFactory=new pv(e),this.focusTracker=new An,this.tooltipManager=new vv(e),this.poweredBy=new sb(e),this.evaluationBadge=new kv(e),this.ariaLiveAnnouncer=new As(e),this._initViewportOffset(this._readViewportOffsetFromConfig()),this.once("ready",()=>{this._bindBodyCollectionWithFocusTracker(),this.isReady=true;}),this.listenTo(t.document,"layoutChanged",this.update.bind(this)),this.listenTo(t,"scrollToTheSelection",this._handleScrollToTheSelection.bind(this)),this._initFocusTracking(),this._initVisualViewportSupport();}get element(){return null}update(){this.fire("update");}destroy(){this.stopListening(),this.focusTracker.destroy(),this.tooltipManager.destroy(this.editor),this.poweredBy.destroy(),this.evaluationBadge.destroy();for(const e of this._editableElementsMap.values())e.ckeditorInstance=null,this.editor.keystrokes.stopListening(e);this._editableElementsMap=new Map,this._focusableToolbarDefinitions=[],this._domEmitter&&this._domEmitter.stopListening();}setEditableElement(e,t){this._editableElementsMap.set(e,t),t.ckeditorInstance||(t.ckeditorInstance=this.editor),this.focusTracker.add(t);const i=()=>{this.editor.editing.view.getDomRoot(e)||this.editor.keystrokes.listenTo(t);};this.isReady?i():this.once("ready",i);}removeEditableElement(e){const t=this._editableElementsMap.get(e);t&&(this._editableElementsMap.delete(e),this.editor.keystrokes.stopListening(t),this.focusTracker.remove(t),t.ckeditorInstance=null);}getEditableElement(e="main"){return this._editableElementsMap.get(e)}getEditableElementsNames(){return this._editableElementsMap.keys()}addToolbar(e,t={}){e.isRendered?(this.focusTracker.add(e),this.editor.keystrokes.listenTo(e.element)):e.once("render",()=>{this.focusTracker.add(e),this.editor.keystrokes.listenTo(e.element);}),this._focusableToolbarDefinitions.push({toolbarView:e,options:t});}extendMenuBar(e){this._extraMenuBarElements.push(e);}initMenuBar(e){const t=e.element;this.focusTracker.add(t),this.editor.keystrokes.listenTo(t);const i=Pv(this.editor.config.get("menuBar")||{});e.fillFromConfig(i,this.componentFactory,this._extraMenuBarElements),this.editor.keystrokes.set("Esc",(e,i)=>{t.contains(this.editor.ui.focusTracker.focusedElement)&&(this._lastFocusedForeignElement?(this._lastFocusedForeignElement.focus(),this._lastFocusedForeignElement=null):this.editor.editing.view.focus(),i());}),this.editor.keystrokes.set("Alt+F9",(i,n)=>{t.contains(this.editor.ui.focusTracker.focusedElement)||(this._saveLastFocusedForeignElement(),e.isFocusBorderEnabled=true,e.focus(),n());});}_readViewportOffsetFromConfig(){const e=this.editor,t=e.config.get("ui.viewportOffset");if(t)return t;const i=e.config.get("toolbar.viewportTopOffset");return i?(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:i}):{top:0}}_initFocusTracking(){const e=this.editor;let t;e.keystrokes.set("Alt+F10",(e,i)=>{this._saveLastFocusedForeignElement();const n=this._getCurrentFocusedToolbarDefinition();n&&t||(t=this._getFocusableCandidateToolbarDefinitions());for(let e=0;e<t.length;e++){const e=t.shift();if(t.push(e),e!==n&&this._focusFocusableCandidateToolbar(e)){n&&n.options.afterBlur&&n.options.afterBlur();break}}i();}),e.keystrokes.set("Esc",(t,i)=>{const n=this._getCurrentFocusedToolbarDefinition();n&&(this._lastFocusedForeignElement?(this._lastFocusedForeignElement.focus(),this._lastFocusedForeignElement=null):e.editing.view.focus(),n.options.afterBlur&&n.options.afterBlur(),i());});}_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:i,options:n}=t;(Fi(i.element)||n.beforeFocus)&&e.push(t);}return e.sort((e,t)=>jv(e)-jv(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:i}}=e;return i&&i(),!!Fi(t.element)&&(t.focus(),true)}_handleScrollToTheSelection(e,t){const i={top:0,bottom:0,left:0,right:0,...this.viewportOffset};t.viewportOffset.top+=i.top,t.viewportOffset.bottom+=i.bottom,t.viewportOffset.left+=i.left,t.viewportOffset.right+=i.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);});}_initViewportOffset(e){this.on("set:viewportOffset",(e,t,i)=>{const n=this._getVisualViewportTopOffset(i);i.visualTop!==n&&(e.return={...i,visualTop:n});}),this.set("viewportOffset",e);}_initVisualViewportSupport(){if(!exports.global.window.visualViewport)return;const t=()=>{const e=this._getVisualViewportTopOffset(this.viewportOffset);this.viewportOffset.visualTop!==e&&(this.viewportOffset={...this.viewportOffset,visualTop:e});};this._domEmitter=new(ci()),this._domEmitter.listenTo(exports.global.window.visualViewport,"scroll",t),this._domEmitter.listenTo(exports.global.window.visualViewport,"resize",t);}_getVisualViewportTopOffset(e){const t=Ui().top,i=e.top||0;return t>i?0:i-t}}function jv(e){const{toolbarView:t,options:i}=e;let n=10;return Fi(t.element)&&n--,i.isContextual&&(n-=2),n}class $v extends Cs{body;menuBarView;toolbar;constructor(e){super(e),this.body=new Yp(e);}render(){super.render(),this.body.attachToDom();}destroy(){return this.body.detachFromDom(),super.destroy()}}class Wv extends $v{top;main;_voiceLabelView;constructor(e){super(e),this.top=this.createCollection(),this.main=this.createCollection(),this._voiceLabelView=this._createVoiceLabel(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-editor","ck-rounded-corners"],role:"application",dir:e.uiLanguageDirection,lang:e.uiLanguage,"aria-labelledby":this._voiceLabelView.id},children:[this._voiceLabelView,{tag:"div",attributes:{class:["ck","ck-editor__top","ck-reset_all"],role:"presentation"},children:this.top},{tag:"div",attributes:{class:["ck","ck-editor__main"],role:"presentation"},children:this.main}]});}_createVoiceLabel(){const e=this.t,t=new Os;return t.text=e("Rich Text Editor"),t.extendTemplate({attributes:{class:"ck-voice-label"}}),t}}class Gv extends Cs{name=null;_editingView;_editableElement;_hasExternalElement;constructor(e,t,i){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",false),this._editableElement=i,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(i=>{const n=e.document.getRoot(t.name);i.addClass(t.isFocused?"ck-focused":"ck-blurred",n),i.removeClass(t.isFocused?"ck-blurred":"ck-focused",n);});}e.isRenderingInProgress?function i(n){e.once("change:isRenderingInProgress",(e,s,o)=>{o?i(n):t(n);});}(this):t(this);}}class Kv extends Gv{_options;constructor(e,t,i,n={}){super(e,t,i),this._options=n,this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}});}render(){super.render();const e=this._editingView;e.change(t=>{const i=e.document.getRoot(this.name);t.setAttribute("aria-label",this.getEditableAriaLabel(),i);});}getEditableAriaLabel(){const e=this.locale.t,t=this._options.label,i=this._editableElement,n=this.name;if("string"==typeof t)return t;if("object"==typeof t)return t[n];if("function"==typeof t)return t(this);if(i){const e=i.getAttribute("aria-label");if(e)return e}return e("Rich Text Editor. Editing area: %0",n)}}class Jv extends Cs{children;constructor(e,t={}){super(e);const i=this.bindTemplate;this.set("class",["ck","ck-form__row",...pn(t.class||[])]),this.children=this.createCollection(),t.children&&t.children.forEach(e=>this.children.add(e)),this.set("_role",null),this.set("_ariaLabelledBy",null),t.labelView&&this.set({_role:"group",_ariaLabelledBy:t.labelView.id}),this.setTemplate({tag:"div",attributes:{class:i.to("class",e=>e.join(" ")),role:i.to("_role"),"aria-labelledby":i.to("_ariaLabelledBy")},children:this.children});}}class Qv extends Cs{constructor(e){super(e);const t=this.bindTemplate;this.setTemplate({tag:"iframe",attributes:{class:["ck","ck-reset_all"],sandbox:"allow-same-origin allow-scripts"},on:{load:t.to("loaded")}});}render(){return new Promise(e=>(this.on("loaded",e),super.render()))}}class Yv extends Cs{labelView;inputView;statusView;constructor(e,t){super(e);const i=`ck-input-${A()}`,n=`ck-status-${A()}`;this.set("label",void 0),this.set("value",void 0),this.set("isReadOnly",false),this.set("errorText",null),this.set("infoText",null),this.labelView=this._createLabelView(i),this.inputView=this._createInputView(t,i,n),this.statusView=this._createStatusView(n),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-input",s.if("isReadOnly","ck-disabled")]},children:[this.labelView,this.inputView,this.statusView]});}_createLabelView(e){const t=new Os(this.locale);return t.for=e,t.bind("text").to(this,"label"),t}_createInputView(e,t,i){const n=new e(this.locale,i);return n.id=t,n.ariaDescribedById=i,n.bind("value").to(this),n.bind("isReadOnly").to(this),n.bind("hasError").to(this,"errorText",e=>!!e),n.on("input",()=>{this.errorText=null;}),n}_createStatusView(e){const t=new Cs(this.locale),i=this.bindTemplate;return t.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-input__status",i.if("errorText","ck-labeled-input__status_error"),i.if("_statusText","ck-hidden",e=>!e)],id:e,role:i.if("errorText","alert")},children:[{text:i.to("_statusText")}]}),t}select(){this.inputView.select();}focus(){this.inputView.focus();}}function Zv(e,t){let i=0,n=0;for(const s of t){const t=s,o=t.items,r=e&&!!t.label.match(e);t.labelView.highlightText(r?e:null);for(const t of o){const i=t.children.first,n=i.labelView;if(e){const s=!!i.label.match(e);n.highlightText(s?e:null),t.isVisible=r||s;}else t.isVisible=true,n.highlightText(null);}const a=o.filter(e=>e.isVisible).length;i+=t.items.length,n+=r?t.items.length:a,t.isVisible=r||!!a;}return {resultsCount:n,totalItemsCount:i}}class Xv extends js{static get pluginName(){return "Notification"}static get isOfficialPlugin(){return  true}init(){this.on("show:warning",(e,t)=>{window.alert(t.message);},{priority:"lowest"});}showSuccess(e,t={}){this._showNotification({message:e,type:"success",namespace:t.namespace,title:t.title});}showInfo(e,t={}){this._showNotification({message:e,type:"info",namespace:t.namespace,title:t.title});}showWarning(e,t={}){this._showNotification({message:e,type:"warning",namespace:t.namespace,title:t.title});}_showNotification(e){const t=e.namespace?`show:${e.type}:${e.namespace}`:`show:${e.type}`;this.fire(t,{message:e.message,type:e.type,title:e.title||""});}}class e_ extends($t()){constructor(e,t){super(),t&&bt(this,t),e&&this.set(e);}}const t_=Ri("px");class i_ extends Ms{positionLimiter;visibleStack;_viewToStack=new Map;_idToStack=new Map;_view=null;_rotatorView=null;_fakePanelsView=null;static get pluginName(){return "ContextualBalloon"}static get isOfficialPlugin(){return  true}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",false);}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 I("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 i=this._idToStack.get(t);e.singleViewMode&&this.showStack(t),i.set(e.view,e),this._viewToStack.set(e.view,i),i===this._visibleStack&&this._showView(e);}remove(e){if(!this.hasView(e))throw new I("contextualballoon-remove-view-not-exist",[this,e]);const t=this._viewToStack.get(e);this._singleViewMode&&this.visibleView===e&&(this._singleViewMode=false),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,top:this.editor.ui.viewportOffset.visualTop}})),e}showStack(e){this.visibleStack=e;const t=this._idToStack.get(e);if(!t)throw new I("contextualballoon-showstack-stack-not-exist",this);this._visibleStack!==t&&this._showView(Array.from(t.values()).pop());}_createPanelView(){this._view=new eb(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 n_(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,i)=>{if(i<2)return "";const n=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return t("%0 of %1",[n,i])}),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 s_(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:i=true,singleViewMode:n=false}){this.view.class=t,this.view.withArrow=i,this._rotatorView.showView(e),this.visibleView=e,this.view.pin(this.getPositionOptions()),this._fakePanelsView.updatePosition(),n&&(this._singleViewMode=true);}}class n_ extends Cs{focusTracker;buttonPrevView;buttonNextView;content;constructor(e){super(e);const t=e.t,i=this.bindTemplate;this.set("isNavigationVisible",true),this.focusTracker=new An,this.buttonPrevView=this._createButtonView(t("Previous"),Pf),this.buttonNextView=this._createButtonView(t("Next"),Zg),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",i.to("isNavigationVisible",e=>e?"":"ck-hidden")]},children:[this.buttonPrevView,{tag:"span",attributes:{class:["ck-balloon-rotator__counter"]},children:[{text:i.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 i=new Bp(this.locale);return i.set({label:e,icon:t,tooltip:true}),i}}class s_ extends Cs{content;_balloonPanelView;constructor(e,t){super(e);const i=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",i.to("numberOfPanels",e=>e?"":"ck-hidden")],style:{top:i.to("top",t_),left:i.to("left",t_),width:i.to("width",t_),height:i.to("height",t_)}},children:this.content}),this.on("change:numberOfPanels",(e,t,i,n)=>{i>n?this._addPanels(i-n):this._removePanels(n-i),this.updatePosition();});}_addPanels(e){for(;e--;){const e=new Cs;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:i,height:n}=new Ci(this._balloonPanelView.element);Object.assign(this,{top:e,left:t,width:i,height:n});}}}const o_=Ri("px");class r_ extends Cs{content;contentPanelElement;_contentPanelPlaceholder;constructor(e){super(e);const t=this.bindTemplate;this.set("isActive",false),this.set("isSticky",false),this.set("limiterElement",null),this.set("limiterBottomOffset",50),this.set("viewportTopOffset",0),this.set("_marginLeft",null),this.set("_isStickyToTheBottomOfLimiter",false),this.set("_stickyTopOffset",null),this.set("_stickyBottomOffset",null),this.content=this.createCollection(),this._contentPanelPlaceholder=new es({tag:"div",attributes:{class:["ck","ck-sticky-panel__placeholder"],style:{display:t.to("isSticky",e=>e?"block":"none"),height:t.to("isSticky",e=>e?o_(this._contentPanelRect.height):null)}}}).render(),this.contentPanelElement=new es({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?o_(this._contentPanelPlaceholder.getBoundingClientRect().width):null),top:t.to("_stickyTopOffset",e=>e?o_(e):e),bottom:t.to("_stickyBottomOffset",e=>e?o_(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(exports.global.document,"scroll",()=>{this.checkIfShouldBeSticky();},{useCapture:true}),this.listenTo(this,"change:isActive",()=>{this.checkIfShouldBeSticky();}),exports.global.window.visualViewport&&(this.listenTo(exports.global.window.visualViewport,"scroll",()=>{this.checkIfShouldBeSticky();}),this.listenTo(exports.global.window.visualViewport,"resize",()=>{this.checkIfShouldBeSticky();}));}checkIfShouldBeSticky(){if(!this.limiterElement||!this.isActive)return void this._unstick();const t=new Ci(this.limiterElement);let i=t.getVisible();if(i){const t=new Ci(exports.global.window);t.top+=this.viewportTopOffset,t.height-=this.viewportTopOffset,i=i.getIntersection(t);}const{left:n,top:s}=Ui();if(t.moveBy(n,s),i&&i.moveBy(n,s),i&&t.top<i.top)if(this._contentPanelRect.height+this.limiterBottomOffset>i.height){const e=Math.max(t.bottom-i.bottom,0)+this.limiterBottomOffset;this._contentPanelRect.height+e+1<t.height?this._stickToBottomOfLimiter(e):this._unstick();}else this._contentPanelRect.height+this.limiterBottomOffset<t.height?this._stickToTopOfAncestors(i.top):this._unstick();else this._unstick();}_stickToTopOfAncestors(t){this.isSticky=true,this._isStickyToTheBottomOfLimiter=false,this._stickyTopOffset=t,this._stickyBottomOffset=null,this._marginLeft=o_(-exports.global.window.scrollX+Ui().left);}_stickToBottomOfLimiter(t){this.isSticky=true,this._isStickyToTheBottomOfLimiter=true,this._stickyTopOffset=null,this._stickyBottomOffset=t,this._marginLeft=o_(-exports.global.window.scrollX+Ui().left);}_unstick(){this.isSticky=false,this._isStickyToTheBottomOfLimiter=false,this._stickyTopOffset=null,this._stickyBottomOffset=null,this._marginLeft=null;}get _contentPanelRect(){return new Ci(this.contentPanelElement)}}class a_ extends Nb{iconView;resetButtonView;_viewConfig;constructor(e,t){const i=e.t,n=Object.assign({},{showResetButton:true,showIcon:true,creator:Sw},t);super(e,n.creator),this.label=t.label,this._viewConfig=n,this._viewConfig.showIcon&&(this.iconView=new Rp,this.iconView.content=Ug,this.fieldWrapperChildren.add(this.iconView,0),this.extendTemplate({attributes:{class:"ck-search__query_with-icon"}})),this._viewConfig.showResetButton&&(this.resetButtonView=new Bp(e),this.resetButtonView.set({label:i("Clear"),icon:pm,class:"ck-search__reset",isVisible:false,tooltip:true}),this.resetButtonView.on("execute",()=>{this.reset(),this.focus(),this.fire("reset");}),this.resetButtonView.bind("isVisible").to(this.fieldView,"isEmpty",e=>!e),this.fieldWrapperChildren.add(this.resetButtonView),this.extendTemplate({attributes:{class:"ck-search__query_with-reset"}}));}reset(){this.fieldView.reset(),this._viewConfig.showResetButton&&(this.resetButtonView.isVisible=false);}}class l_ extends Cs{constructor(){super();const e=this.bindTemplate;this.set({isVisible:false,primaryText:"",secondaryText:""}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-search__info",e.if("isVisible","ck-hidden",e=>!e)],tabindex:-1},children:[{tag:"span",children:[{text:[e.to("primaryText")]}]},{tag:"span",children:[{text:[e.to("secondaryText")]}]}]});}focus(){this.element.focus();}}class c_ extends Cs{focusTracker;children;_focusCycler;constructor(e){super(e),this.children=this.createCollection(),this.focusTracker=new An,this.setTemplate({tag:"div",attributes:{class:["ck","ck-search__results"],tabindex:-1},children:this.children}),this._focusCycler=new Fp({focusables:this.children,focusTracker:this.focusTracker});}render(){super.render();for(const e of this.children)this.focusTracker.add(e.element);}focus(){this._focusCycler.focusFirst();}focusFirst(){this._focusCycler.focusFirst();}focusLast(){this._focusCycler.focusLast();}}class u_ extends Cs{focusTracker;keystrokes;resultsView;filteredView;infoView;queryView;focusCycler;_config;constructor(e,t){super(e),this._config=t,this.filteredView=t.filteredView,this.queryView=this._createSearchTextQueryView(),this.focusTracker=new An,this.keystrokes=new In,this.resultsView=new c_(e),this.children=this.createCollection(),this.focusableChildren=this.createCollection([this.queryView,this.resultsView]),this.set("isEnabled",true),this.set("resultsCount",0),this.set("totalItemsCount",0),t.infoView&&t.infoView.instance?this.infoView=t.infoView.instance:(this.infoView=new l_,this._enableDefaultInfoViewBehavior(),this.on("render",()=>{this.search("");})),this.resultsView.children.addMany([this.infoView,this.filteredView]),this.focusCycler=new Fp({focusables:this.focusableChildren,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.on("search",(e,{resultsCount:t,totalItemsCount:i})=>{this.resultsCount=t,this.totalItemsCount=i;}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-search",t.class||null],tabindex:"-1"},children:this.children});}render(){super.render(),this.children.addMany([this.queryView,this.resultsView]);const e=e=>e.stopPropagation();for(const e of this.focusableChildren)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element),this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e);}focus(){this.queryView.focus();}reset(){this.queryView.reset(),this.search(""),this.filteredView.element.scrollTo(0,0);}search(e){const t=e?new RegExp(Mt(e),"ig"):null,i=this.filteredView.filter(t);this.fire("search",{query:e,...i});}_createSearchTextQueryView(){const e=new a_(this.locale,this._config.queryView);return this.listenTo(e.fieldView,"input",()=>{this.search(e.fieldView.element.value);}),e.on("reset",()=>this.reset()),e.bind("isEnabled").to(this),e}_enableDefaultInfoViewBehavior(){const e=this.locale.t,t=this.infoView;function i(e,{query:t,resultsCount:i,totalItemsCount:n}){return "function"==typeof e?e(t,i,n):e}this.on("search",(n,s)=>{if(s.resultsCount)t.set({isVisible:false});else {const n=this._config.infoView&&this._config.infoView.text;let o,r;s.totalItemsCount?n?.notFound?(o=n.notFound.primary,r=n.notFound.secondary):(o=e("No results found"),r=""):n?.noSearchableItems?(o=n.noSearchableItems.primary,r=n.noSearchableItems.secondary):(o=e("No searchable items"),r=""),t.set({primaryText:i(o,s),secondaryText:i(r,s),isVisible:true});}});}}class d_ extends u_{_config;constructor(t,i){super(t,i),this._config=i;const n=Ri("px");this.extendTemplate({attributes:{class:["ck-autocomplete"]}});const s=this.resultsView.bindTemplate;this.resultsView.set("isVisible",false),this.resultsView.set("_position","s"),this.resultsView.set("_width",0),this.resultsView.extendTemplate({attributes:{class:[s.if("isVisible","ck-hidden",e=>!e),s.to("_position",e=>`ck-search__results_${e}`)],style:{width:s.to("_width",n)}}}),this.focusTracker.on("change:isFocused",(e,t,n)=>{this._updateResultsVisibility(),n?this.resultsView.element.scrollTop=0:i.resetOnBlur&&this.queryView.reset();}),this.on("search",()=>{this._updateResultsVisibility(),this._updateResultsViewWidthAndPosition();}),this.keystrokes.set("esc",(e,t)=>{this.resultsView.isVisible&&(this.queryView.focus(),this.resultsView.isVisible=false,t());}),this.listenTo(exports.global.document,"scroll",()=>{this._updateResultsViewWidthAndPosition();}),this.on("change:isEnabled",()=>{this._updateResultsVisibility();}),this.filteredView.on("execute",(e,{value:t})=>{this.focus(),this.reset(),this.queryView.fieldView.value=this.queryView.fieldView.element.value=t,this.resultsView.isVisible=false;}),this.resultsView.on("change:isVisible",()=>{this._updateResultsViewWidthAndPosition();});}_updateResultsViewWidthAndPosition(){if(!this.resultsView.isVisible)return;this.resultsView._width=new Ci(this.queryView.fieldView.element).width;const e=d_._getOptimalPosition({element:this.resultsView.element,target:this.queryView.element,fitInViewport:true,positions:d_.defaultResultsPositions});this.resultsView._position=e?e.name:"s";}_updateResultsVisibility(){const e=void 0===this._config.queryMinChars?0:this._config.queryMinChars,t=this.queryView.fieldView.element.value.length;this.resultsView.isVisible=this.focusTracker.isFocused&&this.isEnabled&&t>=e;}static defaultResultsPositions=[e=>({top:e.bottom,left:e.left,name:"s"}),(e,t)=>({top:e.top-t.height,left:e.left,name:"n"})];static _getOptimalPosition=Ni}class h_ extends Cs{constructor(){super(),this.set("text",void 0),this.setTemplate({tag:"span",attributes:{class:["ck","ck-highlighted-text"]}}),this.on("render",()=>{this.on("change:text",()=>{this._updateInnerHTML(this.text);}),this._updateInnerHTML(this.text);});}highlightText(e){this._updateInnerHTML(function(e,t){if(!t)return Lt(e);const i=[];let n=0,s=t.exec(e);for(;null!==s;){const o=s.index;o!==n&&i.push({text:e.substring(n,o),isMatch:false}),i.push({text:s[0],isMatch:true}),n=t.lastIndex,s=t.exec(e);}n!==e.length&&i.push({text:e.substring(n),isMatch:false});return i.map(e=>(e.text=Lt(e.text),e)).map(e=>e.isMatch?`<mark>${e.text}</mark>`:e.text).join("")}(this.text||"",e));}_updateInnerHTML(e){this.element.innerHTML=e||"";}}class m_ extends h_{constructor(){super(),this.set({style:void 0,text:void 0,id:void 0});const e=this.bindTemplate;this.extendTemplate({attributes:{class:["ck-button__label"],style:e.to("style"),id:e.to("id")}});}}class g_ extends h_{id;constructor(){super(),this.set("for",void 0);const e=this.bindTemplate;this.id=`ck-editor__label_${A()}`,this.extendTemplate({attributes:{class:["ck","ck-label"],id:this.id,for:e.to("for")}});}}class f_ extends Cs{constructor(){super(),this.set("isVisible",false);const e=this.bindTemplate;this.setTemplate({tag:"span",attributes:{class:["ck","ck-spinner-container",e.if("isVisible","ck-hidden",e=>!e)]},children:[{tag:"span",attributes:{class:["ck","ck-spinner"]}}]});}}const p_=Ri("px");class b_ extends Ms{toolbarView;focusTracker;_balloonConfig;_resizeObserver=null;_balloon;_fireSelectionChangeDebounced;static get pluginName(){return "BalloonToolbar"}static get isOfficialPlugin(){return  true}static get requires(){return [i_]}constructor(e){super(e),this._balloonConfig=dw(e.config.get("balloonToolbar")),this.toolbarView=this._createToolbarView(),this.focusTracker=new An,this._trackFocusableEditableElements(),this.focusTracker.add(this.toolbarView),e.ui.addToolbar(this.toolbarView,{beforeFocus:()=>this.show(true),afterBlur:()=>this.hide(),isContextual:true}),this._balloon=e.plugins.get(i_),this._fireSelectionChangeDebounced=st(()=>this.fire("_selectionChangeDebounced"),200),this.decorate("show");}init(){const e=this.editor,t=e.model.document.selection;this.listenTo(this.focusTracker,"change:isFocused",(e,t,i)=>{!i&&this._isToolbarVisible?this.hide():i&&this.show();}),this.listenTo(t,"change:range",(e,i)=>{(i.directChange||t.isCollapsed)&&this.hide(),this._fireSelectionChangeDebounced();}),this.listenTo(this,"_selectionChangeDebounced",()=>{this.editor.editing.view.document.isFocused&&this.show();}),this._balloonConfig.shouldNotGroupWhenFull||this.listenTo(e,"ready",()=>{const t=e.ui.view.editable.element;this._resizeObserver=new Pi(t,e=>{this.toolbarView.maxWidth=p_(.9*e.contentRect.width);});}),this.listenTo(this.toolbarView,"groupedItemsUpdate",()=>{this._updatePosition();}),e.ui.once("ready",()=>{this.toolbarView.fillFromConfig(this._balloonConfig,this.editor.ui.componentFactory);});}get _isToolbarVisible(){return this._balloon.visibleView===this.toolbarView}_createToolbarView(){const e=this.editor.locale.t,t=!this._balloonConfig.shouldNotGroupWhenFull,i=new mw(this.editor.locale,{shouldGroupWhenFull:t,isFloating:true});return i.ariaLabel=e("Editor contextual toolbar"),i.render(),i}show(e=false){const t=this.editor,i=t.model.document.selection,n=t.model.schema;this._balloon.hasView(this.toolbarView)||i.isCollapsed&&!e||function(e,t){if(1===e.rangeCount)return  false;return [...e.getRanges()].every(e=>{const i=e.getContainedElement();return i&&t.isSelectable(i)})}(i,n)||Array.from(this.toolbarView.items).every(e=>void 0!==e.isEnabled&&!e.isEnabled)||(this.listenTo(this.editor.ui,"update",()=>{this._updatePosition();}),this._balloon.add({view:this.toolbarView,position:this._getBalloonPositionData(),balloonClassName:"ck-toolbar-container"}));}hide(){this._balloon.hasView(this.toolbarView)&&(this.stopListening(this.editor.ui,"update"),this._balloon.remove(this.toolbarView));}_trackFocusableEditableElements(){const{editor:e,focusTracker:t}=this,{editing:i}=e;i.view.addObserver(class extends zr{observe(e){t.add(e);}stopObserving(e){t.remove(e);}});}_getBalloonPositionData(){const e=this.editor.editing.view,t=e.document,i=t.selection,n=t.selection.isBackward;return {target:()=>{const t=n?i.getFirstRange():i.getLastRange(),s=Ci.getDomRangeRects(e.domConverter.viewRangeToDom(t));return n?s[0]:(s.length>1&&0===s[s.length-1].width&&s.pop(),s[s.length-1])},positions:this._getBalloonPositions(n)}}_updatePosition(){this._isToolbarVisible&&this._balloon.updatePosition(this._getBalloonPositionData());}destroy(){super.destroy(),this.stopListening(),this._fireSelectionChangeDebounced.cancel(),this.toolbarView.destroy(),this.focusTracker.destroy(),this._resizeObserver&&this._resizeObserver.destroy();}_getBalloonPositions(t){const i=n.isSafari&&n.isiOS?eb.generatePositions({heightOffset:Math.max(eb.arrowHeightOffset,Math.round(20/exports.global.window.visualViewport.scale))}):eb.defaultPositions;return t?[i.northWestArrowSouth,i.northWestArrowSouthWest,i.northWestArrowSouthEast,i.northWestArrowSouthMiddleEast,i.northWestArrowSouthMiddleWest,i.southWestArrowNorth,i.southWestArrowNorthWest,i.southWestArrowNorthEast,i.southWestArrowNorthMiddleWest,i.southWestArrowNorthMiddleEast]:[i.southEastArrowNorth,i.southEastArrowNorthEast,i.southEastArrowNorthWest,i.southEastArrowNorthMiddleEast,i.southEastArrowNorthMiddleWest,i.northEastArrowSouth,i.northEastArrowSouthEast,i.northEastArrowSouthWest,i.northEastArrowSouthMiddleEast,i.northEastArrowSouthMiddleWest]}}const w_=Ri("px");class v_ extends Bp{constructor(e){super(e);const t=this.bindTemplate;this.isVisible=false,this.isToggleable=true,this.set("top",0),this.set("left",0),this.extendTemplate({attributes:{class:"ck-block-toolbar-button",style:{top:t.to("top",e=>w_(e)),left:t.to("left",e=>w_(e))}}});}}const __=Ri("px");class y_ extends Ms{toolbarView;panelView;buttonView;_resizeObserver=null;_blockToolbarConfig;static get pluginName(){return "BlockToolbar"}static get isOfficialPlugin(){return  true}constructor(e){super(e),this._blockToolbarConfig=dw(this.editor.config.get("blockToolbar")),this.toolbarView=this._createToolbarView(),this.panelView=this._createPanelView(),this.buttonView=this._createButtonView(),Ss({emitter:this.panelView,contextElements:[this.panelView.element,this.buttonView.element],activator:()=>this.panelView.isVisible,callback:()=>this._hidePanel()});}init(){const e=this.editor,t=e.t,i=t("Click to edit block"),n=t("Drag to move"),s=t("Edit block"),o=e.plugins.has("DragDropBlockToolbar"),r=o?`${i}\n${n}`:s;this.buttonView.label=r,o&&(this.buttonView.element.dataset.ckeTooltipClass="ck-tooltip_multi-line"),this.listenTo(e.model.document.selection,"change:range",(e,t)=>{t.directChange&&this._hidePanel();}),this.listenTo(e.ui,"update",()=>this._updateButton()),this.listenTo(e,"change:isReadOnly",()=>this._updateButton(),{priority:"low"}),this.listenTo(e.ui.focusTracker,"change:isFocused",()=>this._updateButton()),this.listenTo(this.buttonView,"change:isVisible",(e,t,i)=>{i?this.buttonView.listenTo(window,"resize",()=>this._updateButton()):(this.buttonView.stopListening(window,"resize"),this._hidePanel());}),this._repositionButtonOnScroll(),e.ui.addToolbar(this.toolbarView,{beforeFocus:()=>this._showPanel(),afterBlur:()=>this._hidePanel()}),e.ui.once("ready",()=>{this.toolbarView.fillFromConfig(this._blockToolbarConfig,this.editor.ui.componentFactory);for(const e of this.toolbarView.items)e.on("execute",()=>this._hidePanel(true),{priority:"high"});});}destroy(){super.destroy(),this.panelView.destroy(),this.buttonView.destroy(),this.toolbarView.destroy(),this._resizeObserver&&this._resizeObserver.destroy();}_createToolbarView(){const e=this.editor.locale.t,t=!this._blockToolbarConfig.shouldNotGroupWhenFull,i=new mw(this.editor.locale,{shouldGroupWhenFull:t,isFloating:true});return i.ariaLabel=e("Editor block content toolbar"),i}_createPanelView(){const e=this.editor,t=new eb(e.locale);return t.content.add(this.toolbarView),t.class="ck-toolbar-container",e.ui.view.body.add(t),this.toolbarView.keystrokes.set("Esc",(e,t)=>{this._hidePanel(true),t();}),t}_createButtonView(){const e=this.editor,t=e.t,i=new v_(e.locale),n=this._blockToolbarConfig.icon,s=hw[n]||n||hw.dragIndicator;return i.set({label:t("Edit block"),icon:s,withText:false}),i.bind("isOn").to(this.panelView,"isVisible"),i.bind("tooltip").to(this.panelView,"isVisible",e=>!e),this.listenTo(i,"execute",()=>{this.panelView.isVisible?this._hidePanel(true):this._showPanel();}),this.listenTo(i,"change:isEnabled",(e,t,i)=>{!i&&this.panelView.isVisible&&this._hidePanel(false);}),e.ui.view.body.add(i),i}_updateButton(){const e=this.editor,t=e.model,i=e.editing.view;if(!e.ui.focusTracker.isFocused)return void this._hideButton();if(!e.model.canEditAt(e.model.document.selection))return void this._hideButton();const n=Array.from(t.document.selection.getSelectedBlocks())[0];if(!n||Array.from(this.toolbarView.items).every(e=>!e.isEnabled))return void this._hideButton();const s=i.domConverter.mapViewToDom(e.editing.mapper.toViewElement(n));this.buttonView.isVisible=true,this._setupToolbarResize(),this._attachButtonToElement(s),this.panelView.isVisible&&this._showPanel();}_hideButton(){this.buttonView.isVisible=false;}_showPanel(){if(!this.buttonView.isVisible)return;const e=this.panelView.isVisible;this.panelView.show();const t=this._getSelectedEditableElement();this.toolbarView.maxWidth=this._getToolbarMaxWidth(t),this.panelView.pin({target:this.buttonView.element,limiter:t}),e||this.toolbarView.items.get(0).focus();}_getSelectedEditableElement(){const e=this.editor.model.document.selection.getFirstRange().root.rootName;return this.editor.ui.getEditableElement(e)}_hidePanel(e){this.panelView.isVisible=false,e&&this.editor.editing.view.focus();}_repositionButtonOnScroll(){const{buttonView:t}=this;let i=false;const n=(t,n)=>{if(i)return;const s=this._getSelectedEditableElement();(n.target===exports.global.document||mi(s).includes(n.target))&&(i=true,exports.global.window.requestAnimationFrame(()=>{this._updateButton(),i=false;}));};t.on("change:isVisible",(i,s,o)=>{o?t.listenTo(exports.global.document,"scroll",n,{useCapture:true,usePassive:true}):t.stopListening(exports.global.document,"scroll",n);});}_attachButtonToElement(e){const t=this.buttonView.element,i=this._getSelectedEditableElement(),n=window.getComputedStyle(e),s=new Ci(i),o=parseInt(n.paddingTop,10),r=parseInt(n.lineHeight,10)||1.2*parseInt(n.fontSize,10),a=new Ci(t),l=new Ci(e);let c;c="ltr"===this.editor.locale.uiLanguageDirection?s.left-a.width:s.right;const u=l.top+o+(r-a.height)/2;a.moveTo(c,u);const d=a.toAbsoluteRect();this.buttonView.top=d.top,this.buttonView.left=d.left,this._clipButtonToViewport(this.buttonView,i);}_clipButtonToViewport(e,t){const i=new Ci(e.element),n=new Ci(t).getVisible(),s=(...t)=>{e.element.style.clipPath=t.length?`polygon(${t.join(",")})`:"";},o=t=>{e.isEnabled=!t,e.element.style.pointerEvents=t?"none":"";};if(n&&n.bottom<i.bottom){const e=Math.min(i.height,i.bottom-n.bottom);o(e>=i.height),s("0 0","100% 0",`100% calc(100% - ${__(e)})`,`0 calc(100% - ${__(e)}`);}else if(n&&n.top>i.top){const e=Math.min(i.height,n.top-i.top);o(e>=i.height),s(`0 ${__(e)}`,`100% ${__(e)}`,"100% 100%","0 100%");}else o(false),s();}_setupToolbarResize(){const e=this._getSelectedEditableElement();this._blockToolbarConfig.shouldNotGroupWhenFull||(this._resizeObserver&&this._resizeObserver.element!==e&&(this._resizeObserver.destroy(),this._resizeObserver=null),this._resizeObserver||(this._resizeObserver=new Pi(e,()=>{this.toolbarView.maxWidth=this._getToolbarMaxWidth(e);})));}_getToolbarMaxWidth(e){const t=new Ci(e),i=new Ci(this.buttonView.element),n="rtl"===this.editor.locale.uiLanguageDirection?i.left-t.right+i.width:t.left-i.left;return __(t.width+n)}}class k_ extends Gp{arrowView;constructor(e){super(e);const t=this.bindTemplate;this.set({withText:true,role:"menuitem"}),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__button"],"aria-haspopup":true,"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 Rp;return e.content=Um,e.extendTemplate({attributes:{class:"ck-menu-bar__menu__button__arrow"}}),e}}class C_ extends Cs{children;constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",false),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 x_ extends Cs{buttonView;panelView;focusTracker;keystrokes;constructor(e){super(e);const t=this.bindTemplate;this.buttonView=new k_(e),this.buttonView.delegate("mouseenter").to(this),this.buttonView.bind("isOn","isEnabled").to(this,"isOpen","isEnabled"),this.panelView=new C_(e),this.panelView.bind("isVisible").to(this,"isOpen"),this.keystrokes=new In,this.focusTracker=new An,this.set("isOpen",false),this.set("isEnabled",true),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),Tv.closeOnEscKey(this),this._closeOnDisabled(),this._repositionPanelOnOpen();}_attachBehaviors(){this.parentMenuView?(Tv.openOnButtonClick(this),Tv.openOnArrowRightKey(this),Tv.closeOnArrowLeftKey(this),Tv.openAndFocusOnEnterKeyPress(this),Tv.closeOnParentClose(this)):(this._propagateArrowKeystrokeEvents(),Tv.openAndFocusPanelOnArrowDownKey(this),Tv.toggleOnButtonClick(this));}_propagateArrowKeystrokeEvents(){this.keystrokes.set("arrowright",(e,t)=>{this.fire("arrowright"),t();}),this.keystrokes.set("arrowleft",(e,t)=>{this.fire("arrowleft"),t();});}_closeOnDisabled(){this.on("change:isEnabled",(e,t,i)=>{i||(this.isOpen=false);});}_repositionPanelOnOpen(){this.on("change:isOpen",(e,t,i)=>{if(!i)return;const n=x_._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:true,positions:this._panelPositions});this.panelView.position=n?n.name:this._defaultMenuPositionName;});}focus(){this.buttonView.focus();}get _panelPositions(){const{southEast:e,southWest:t,northEast:i,northWest:n,westSouth:s,eastSouth:o,westNorth:r,eastNorth:a}=Sv;return "ltr"===this.locale.uiLanguageDirection?this.parentMenuView?[o,a,s,r]:[e,t,i,n]:this.parentMenuView?[s,r,o,a]:[t,e,n,i]}get _defaultMenuPositionName(){return "ltr"===this.locale.uiLanguageDirection?this.parentMenuView?"es":"se":this.parentMenuView?"ws":"sw"}static _getOptimalPosition=Ni}class A_ extends Xb{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=E_(e);return t&&t.isToggleable});this.items.forEach(t=>{const i=E_(t);i&&(i.hasCheckSpace=e);});}}function E_(e){return e instanceof Qb?e.children.map(e=>function(e){return "object"==typeof e&&"buttonView"in e&&e.buttonView instanceof Bp}(e)?e.buttonView:e).find(e=>e instanceof Gp):null}class T_ extends lb{constructor(e){super(e),this.set({withText:true,withKeystroke:true,tooltip:false,role:"menuitem"}),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item__button"]}});}}const S_=["mouseenter","arrowleft","arrowright","change:isOpen"];class I_ extends Cs{children;menus=[];constructor(e){super(e);const t=e.t,i=this.bindTemplate;this.set({isOpen:false,isFocusBorderEnabled:false}),this._setupIsOpenUpdater(),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-menu-bar",i.if("isFocusBorderEnabled","ck-menu-bar_focus-border-enabled")],"aria-label":t("Editor menu bar"),role:"menubar"},children:this.children});}fillFromConfig(e,t,i=[]){const n=Vv({normalizedConfig:e,locale:this.locale,componentFactory:t,extraItems:i}).items.map(e=>this._createMenu({componentFactory:t,menuDefinition:e}));this.children.addMany(n);}render(){super.render(),Ev.toggleMenusAndFocusItemsOnHover(this),Ev.closeMenusWhenTheBarCloses(this),Ev.closeMenuWhenAnotherOnTheSameLevelOpens(this),Ev.focusCycleMenusOnArrows(this),Ev.closeOnClickOutside(this),Ev.enableFocusHighlightOnInteraction(this);}focus(){this.children.first&&this.children.first.focus();}close(){for(const e of this.children)e.isOpen=false;}disable(){for(const e of this.children)e.isEnabled=false;}enable(){for(const e of this.children)e.isEnabled=true;}registerMenu(e,t=null){t?(e.delegate(...S_).to(t),e.parentMenuView=t):e.delegate(...S_).to(this,e=>"menu:"+e),e._attachBehaviors(),this.menus.push(e);}_createMenu({componentFactory:e,menuDefinition:t,parentMenuView:i}){const n=this.locale,s=new x_(n);return this.registerMenu(s,i),s.buttonView.set({label:t.label}),s.once("change:isOpen",()=>{const i=new A_(n);i.ariaLabel=t.label,s.panelView.children.add(i),i.items.addMany(this._createMenuItems({menuDefinition:t,parentMenuView:s,componentFactory:e}));}),s}_createMenuItems({menuDefinition:e,parentMenuView:t,componentFactory:i}){const n=this.locale,s=[];for(const o of e.groups){for(const e of o.items){const o=new Av(n,t);if(ne(e))o.children.add(this._createMenu({componentFactory:i,menuDefinition:e,parentMenuView:t}));else {const n=this._createMenuItemContentFromFactory({componentName:e,componentFactory:i,parentMenuView:t});if(!n)continue;o.children.add(n);}s.push(o);}o!==e.groups[e.groups.length-1]&&s.push(new Yb(n));}return s}_createMenuItemContentFromFactory({componentName:e,parentMenuView:t,componentFactory:i}){const n=i.create(e);return n instanceof x_||n instanceof Jp||n instanceof T_?(this._registerMenuTree(n,t),n.on("execute",()=>{this.close();}),n):(P("menu-bar-component-unsupported",{componentName:e,componentView:n}),null)}_registerMenuTree(e,t){if(!(e instanceof x_))return void e.delegate("mouseenter").to(t);this.registerMenu(e,t);const i=e.panelView.children.filter(e=>e instanceof A_)[0];if(!i)return void e.delegate("mouseenter").to(t);const n=i.items.filter(e=>e instanceof Qb);for(const t of n)this._registerMenuTree(t.children.get(0),e);}_setupIsOpenUpdater(){let e;this.on("menu:change:isOpen",(t,i,n)=>{clearTimeout(e),n?this.isOpen=true:e=setTimeout(()=>{this.isOpen=Array.from(this.children).some(e=>e.isOpen);},0);});}}class P_ extends($t()){total;_reader;_data;constructor(){super();const e=new window.FileReader;this._reader=e,this._data=void 0,this.set("loaded",0),e.onprogress=e=>{this.loaded=e.loaded;};}get error(){return this._reader.error}get data(){return this._data}read(e){const t=this._reader;return this.total=e.size,new Promise((i,n)=>{t.onload=()=>{const e=t.result;this._data=e,i(e);},t.onerror=()=>{n("error");},t.onabort=()=>{n("aborted");},this._reader.readAsDataURL(e);})}abort(){this._reader.abort();}}class V_ extends Ms{loaders=new kn;_loadersMap=new Map;_pendingAction=null;static get pluginName(){return "FileRepository"}static get isOfficialPlugin(){return  true}static get requires(){return [Oh]}init(){this.loaders.on("change",()=>this._updatePendingAction()),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(e,t)=>t?e/t*100:0);}getLoader(e){return this._loadersMap.get(e)||null}createLoader(e){if(!this.createUploadAdapter)return P("filerepository-no-upload-adapter"),null;const t=new R_(Promise.resolve(e),this.createUploadAdapter);return this.loaders.add(t),this._loadersMap.set(e,t),e instanceof Promise&&t.file.then(e=>{this._loadersMap.set(e,t);}).catch(()=>{}),t.on("change:uploaded",()=>{let e=0;for(const t of this.loaders)e+=t.uploaded;this.uploaded=e;}),t.on("change:uploadTotal",()=>{let e=0;for(const t of this.loaders)t.uploadTotal&&(e+=t.uploadTotal);this.uploadTotal=e;}),t}destroyLoader(e){const t=e instanceof R_?e:this.getLoader(e);t._destroy(),this.loaders.remove(t),this._loadersMap.forEach((e,i)=>{e===t&&this._loadersMap.delete(i);});}_updatePendingAction(){const e=this.editor.plugins.get(Oh);if(this.loaders.length){if(!this._pendingAction){const t=this.editor.t,i=e=>`${t("Upload in progress")} ${parseInt(e)}%.`;this._pendingAction=e.add(i(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",i);}}else e.remove(this._pendingAction),this._pendingAction=null;}}class R_ extends($t()){id;_filePromiseWrapper;_adapter;_reader;constructor(e,t){super(),this.id=A(),this._filePromiseWrapper=this._createFilePromiseWrapper(e),this._adapter=t(this),this._reader=new P_,this.set("status","idle"),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(e,t)=>t?e/t*100:0),this.set("uploadResponse",null);}get file(){return this._filePromiseWrapper?this._filePromiseWrapper.promise.then(e=>this._filePromiseWrapper?e:null):Promise.resolve(null)}get data(){return this._reader.data}read(){if("idle"!=this.status)throw new I("filerepository-read-wrong-status",this);return this.status="reading",this.file.then(e=>this._reader.read(e)).then(e=>{if("reading"!==this.status)throw this.status;return this.status="idle",e}).catch(e=>{if("aborted"===e)throw this.status="aborted","aborted";throw this.status="error",this._reader.error?this._reader.error:e})}upload(){if("idle"!=this.status)throw new I("filerepository-upload-wrong-status",this);return this.status="uploading",this.file.then(()=>this._adapter.upload()).then(e=>(this.uploadResponse=e,this.status="idle",e)).catch(e=>{if("aborted"===this.status)throw "aborted";throw this.status="error",e})}abort(){const e=this.status;this.status="aborted",this._filePromiseWrapper.isFulfilled?"reading"==e?this._reader.abort():"uploading"==e&&this._adapter.abort&&this._adapter.abort():(this._filePromiseWrapper.promise.catch(()=>{}),this._filePromiseWrapper.rejecter("aborted")),this._destroy();}_destroy(){this._filePromiseWrapper=void 0,this._reader=void 0,this._adapter=void 0,this.uploadResponse=void 0;}_createFilePromiseWrapper(e){const t={};return t.promise=new Promise((i,n)=>{t.rejecter=n,t.isFulfilled=false,e.then(e=>{t.isFulfilled=true,i(e);}).catch(e=>{t.isFulfilled=true,n(e);});}),t}}class O_ extends Ms{static get requires(){return [V_]}static get pluginName(){return "Base64UploadAdapter"}static get licenseFeatureCode(){return "B64A"}static get isOfficialPlugin(){return  true}static get isPremiumPlugin(){return  true}init(){this.editor.plugins.get(V_).createUploadAdapter=e=>new B_(e);}}let B_=class{loader;reader;constructor(e){this.loader=e;}upload(){return new Promise((e,t)=>{const i=this.reader=new window.FileReader;i.addEventListener("load",()=>{e({default:i.result});}),i.addEventListener("error",e=>{t(e);}),i.addEventListener("abort",()=>{t();}),this.loader.file.then(e=>{i.readAsDataURL(e);});})}abort(){this.reader.abort();}};class L_ extends Ms{static get requires(){return [V_]}static get pluginName(){return "SimpleUploadAdapter"}static get licenseFeatureCode(){return "SUA"}static get isOfficialPlugin(){return  true}static get isPremiumPlugin(){return  true}init(){const e=this.editor.config.get("simpleUpload");e&&(e.uploadUrl?this.editor.plugins.get(V_).createUploadAdapter=t=>new M_(t,e):P("simple-upload-adapter-missing-uploadurl"));}}let M_=class{loader;options;xhr;constructor(e,t){this.loader=e,this.options=t;}upload(){return this.loader.file.then(e=>new Promise((t,i)=>{this._initRequest(),this._initListeners(t,i,e),this._sendRequest(e);}))}abort(){this.xhr&&this.xhr.abort();}_initRequest(){const e=this.xhr=new XMLHttpRequest;e.open("POST",this.options.uploadUrl,true),e.responseType="json";}_initListeners(e,t,i){const n=this.xhr,s=this.loader,o=`Couldn't upload file: ${i.name}.`;n.addEventListener("error",()=>t(o)),n.addEventListener("abort",()=>t()),n.addEventListener("load",()=>{const i=n.response;if(!i||i.error)return t(i&&i.error&&i.error.message?i.error.message:o);const s=i.url?{default:i.url}:i.urls;e({...i,urls:s});}),n.upload&&n.upload.addEventListener("progress",e=>{e.lengthComputable&&(s.uploadTotal=e.total,s.uploaded=e.loaded);});}_sendRequest(e){let t=this.options.headers||{};"function"==typeof t&&(t=t(e));const i=this.options.withCredentials||false;for(const e of Object.keys(t))this.xhr.setRequestHeader(e,t[e]);this.xhr.withCredentials=i;const n=new FormData;n.append("upload",e),this.xhr.send(n);}};const F_="ckCsrfToken",N_="abcdefghijklmnopqrstuvwxyz0123456789";function D_(){let e=z_(F_);return e&&40==e.length||(e=function(e){let t="";const i=new Uint8Array(e);window.crypto.getRandomValues(i);for(let e=0;e<i.length;e++){const n=N_.charAt(i[e]%36);t+=Math.random()>.5?n.toUpperCase():n;}return t}(40),H_(F_,e)),e}function z_(e){e=e.toLowerCase();const t=document.cookie.split(";");for(const i of t){const t=i.split("=");if(decodeURIComponent(t[0].trim().toLowerCase())===e)return decodeURIComponent(t[1])}return null}function H_(e,t){document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(t)+";path=/";}class q_ extends Ms{static get requires(){return [V_]}static get pluginName(){return "CKFinderUploadAdapter"}static get isOfficialPlugin(){return  true}init(){const e=this.editor.config.get("ckfinder.uploadUrl");e&&(this.editor.plugins.get(V_).createUploadAdapter=t=>new U_(t,e,this.editor.t));}}class U_{loader;url;t;xhr;constructor(e,t,i){this.loader=e,this.url=t,this.t=i;}upload(){return this.loader.file.then(e=>new Promise((t,i)=>{this._initRequest(),this._initListeners(t,i,e),this._sendRequest(e);}))}abort(){this.xhr&&this.xhr.abort();}_initRequest(){const e=this.xhr=new XMLHttpRequest;e.open("POST",this.url,true),e.responseType="json";}_initListeners(e,t,i){const n=this.xhr,s=this.loader,o=(0, this.t)("Cannot upload file:")+` ${i.name}.`;n.addEventListener("error",()=>t(o)),n.addEventListener("abort",()=>t()),n.addEventListener("load",()=>{const i=n.response;if(!i||!i.uploaded)return t(i&&i.error&&i.error.message?i.error.message:o);e({default:i.url});}),n.upload&&n.upload.addEventListener("progress",e=>{e.lengthComputable&&(s.uploadTotal=e.total,s.uploaded=e.loaded);});}_sendRequest(e){const t=new FormData;t.append("upload",e),t.append("ckCsrfToken",D_()),this.xhr.send(t);}}const j_=["left","right","center","justify"];function $_(e){return j_.includes(e)}function W_(e,t){return "rtl"==t.contentLanguageDirection?"right"===e:"left"===e}function G_(e){const t=e.map(e=>{let t;return t="string"==typeof e?{name:e}:e,t}).filter(e=>{const t=j_.includes(e.name);return t||P("alignment-config-name-not-recognized",{option:e}),t}),i=t.filter(e=>Boolean(e.className)).length;if(i&&i<t.length)throw new I("alignment-config-classnames-are-missing",{configuredOptions:e});return t.forEach((t,i,n)=>{const s=n.slice(i+1);if(s.some(e=>e.name==t.name))throw new I("alignment-config-name-already-defined",{option:t,configuredOptions:e});if(t.className){if(s.some(e=>e.className==t.className))throw new I("alignment-config-classname-already-defined",{option:t,configuredOptions:e})}}),t}const K_="alignment";class J_ extends Ns{refresh(){const e=this.editor.locale,t=Cn(this.editor.model.document.selection.getSelectedBlocks());this.isEnabled=Boolean(t)&&this._canBeAligned(t),this.isEnabled&&t.hasAttribute("alignment")?this.value=t.getAttribute("alignment"):this.value="rtl"===e.contentLanguageDirection?"right":"left";}execute(e={}){const t=this.editor,i=t.locale,n=t.model,s=n.document,o=e.value;n.change(e=>{const t=Array.from(s.selection.getSelectedBlocks()).filter(e=>this._canBeAligned(e)),n=t[0].getAttribute("alignment");W_(o,i)||n===o||!o?function(e,t){for(const i of e)t.removeAttribute(K_,i);}(t,e):function(e,t,i){for(const n of e)t.setAttribute(K_,i,n);}(t,e,o);});}_canBeAligned(e){return this.editor.model.schema.checkAttribute(e,K_)}}class Q_ extends Ms{static get pluginName(){return "AlignmentEditing"}static get isOfficialPlugin(){return  true}constructor(e){super(e),e.config.define("alignment",{options:j_.map(e=>({name:e}))});}init(){const e=this.editor,t=e.locale,i=e.model.schema,n=G_(e.config.get("alignment.options")).filter(e=>$_(e.name)&&!W_(e.name,t)),s=n.some(e=>!!e.className);i.extend("$block",{allowAttributes:"alignment"}),e.model.schema.setAttributeProperties("alignment",{isFormatting:true}),s?e.conversion.attributeToAttribute(function(e){const t={};for(const i of e)t[i.name]={key:"class",value:i.className};const i={model:{key:"alignment",values:e.map(e=>e.name)},view:t};return i}(n)):e.conversion.for("downcast").attributeToAttribute(function(e){const t={};for(const{name:i}of e)t[i]={key:"style",value:{"text-align":i}};const i={model:{key:"alignment",values:e.map(e=>e.name)},view:t};return i}(n));const o=function(e){const t=[];for(const{name:i}of e)t.push({view:{key:"style",value:{"text-align":i}},model:{key:"alignment",value:i}});return t}(n);for(const t of o)e.conversion.for("upcast").attributeToAttribute(t);const r=function(e){const t=[];for(const{name:i}of e)t.push({view:{key:"align",value:i},model:{key:"alignment",value:i}});return t}(n);for(const t of r)e.conversion.for("upcast").attributeToAttribute(t);e.commands.add("alignment",new J_(e));}}const Y_=(()=>new Map([["left",Xh],["right",tm],["center",Yh],["justify",Zh]]))();class Z_ extends Ms{get localizedOptionTitles(){const e=this.editor.t;return {left:e("Align left"),right:e("Align right"),center:e("Align center"),justify:e("Justify")}}static get pluginName(){return "AlignmentUI"}static get isOfficialPlugin(){return  true}init(){const e=G_(this.editor.config.get("alignment.options"));e.map(e=>e.name).filter($_).forEach(e=>this._addButton(e)),this._addToolbarDropdown(e),this._addMenuBarMenu(e);}_addButton(e){this.editor.ui.componentFactory.add(`alignment:${e}`,t=>this._createButton(t,e));}_createButton(e,t,i={}){const n=this.editor,s=n.commands.get("alignment"),o=new Bp(e);return o.set({label:this.localizedOptionTitles[t],icon:Y_.get(t),tooltip:true,isToggleable:true,...i}),o.bind("isEnabled").to(s),o.bind("isOn").to(s,"value",e=>e===t),this.listenTo(o,"execute",()=>{n.execute("alignment",{value:t}),n.editing.view.focus();}),o}_addToolbarDropdown(e){const t=this.editor;t.ui.componentFactory.add("alignment",i=>{const n=ww(i),s="rtl"===i.uiLanguageDirection?"w":"e",o=i.t;yw(n,()=>e.map(e=>this._createButton(i,e.name,{tooltipPosition:s})),{enableActiveItemFocusOnDropdownOpen:true,isVertical:true,ariaLabel:o("Text alignment toolbar")}),n.buttonView.set({label:o("Text alignment"),tooltip:true}),n.extendTemplate({attributes:{class:"ck-alignment-dropdown"}});const r="rtl"===i.contentLanguageDirection?Y_.get("right"):Y_.get("left"),a=t.commands.get("alignment");return n.buttonView.bind("icon").to(a,"value",e=>Y_.get(e)||r),n.bind("isEnabled").to(a,"isEnabled"),this.listenTo(n,"execute",()=>{t.editing.view.focus();}),n});}_addMenuBarMenu(e){const t=this.editor;t.ui.componentFactory.add("menuBar:alignment",i=>{const n=t.commands.get("alignment"),s=i.t,o=new x_(i),r=new A_(i);o.bind("isEnabled").to(n),r.set({ariaLabel:s("Text alignment"),role:"menu"}),o.buttonView.set({label:s("Text alignment")});for(const s of e){const e=new Av(i,o),a=new Jp(i);a.delegate("execute").to(o),a.set({label:this.localizedOptionTitles[s.name],icon:Y_.get(s.name),role:"menuitemcheckbox",isToggleable:true}),a.on("execute",()=>{t.execute("alignment",{value:s.name}),t.editing.view.focus();}),a.bind("isOn").to(n,"value",e=>e===s.name),a.bind("isEnabled").to(n,"isEnabled"),e.children.add(a),r.items.add(e);}return o.panelView.children.add(r),o});}}class X_ extends Ms{static get requires(){return [Q_,Z_]}static get pluginName(){return "Alignment"}static get isOfficialPlugin(){return  true}}class ey{model;limit;_isLocked;_size;_batch=null;_changeCallback;_selectionChangeCallback;constructor(e,t=20){this.model=e,this._size=0,this.limit=t,this._isLocked=false,this._changeCallback=(e,t)=>{t.isLocal&&t.isUndoable&&t!==this._batch&&this._reset(true);},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:true})),this._batch}get size(){return this._size}input(e){this._size+=e,this._size>=this.limit&&this._reset(true);}get isLocked(){return this._isLocked}lock(){this._isLocked=true;}unlock(){this._isLocked=false;}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback);}_reset(e=false){this.isLocked&&!e||(this._batch=null,this._size=0);}}class ty extends Ns{_buffer;constructor(e,t){super(e),this._buffer=new ey(e.model,t),this._isEnabledBasedOnSelection=false;}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy();}execute(e={}){const t=this.editor.model,i=t.document,n=e.text||"",s=n.length;let o=i.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(i.selection.getAttributes());t.deleteContent(o),n&&t.insertContent(e.createText(n,a),o),r?e.setSelection(r):o.is("documentSelection")||e.setSelection(o),this._buffer.unlock(),this._buffer.input(s);});}}const iy=["insertText","insertReplacementText"],ny=[...iy,"insertCompositionText"];class sy extends zr{focusObserver;constructor(e){super(e),this.focusObserver=e.getObserver(Gr);const t=n.isAndroid?ny:iy,i=e.document;i.on("beforeinput",(n,s)=>{if(!this.isEnabled)return;const{data:o,targetRanges:r,inputType:a,domEvent:l,isComposing:c}=s;if(!t.includes(a))return;this.focusObserver.flush();const u=new C(i,"insertText");i.fire(u,new Hr(e,l,{text:o,selection:e.createSelection(r),isComposing:c})),u.stop.called&&n.stop();}),n.isAndroid||i.on("compositionend",(t,{data:n,domEvent:s})=>{this.isEnabled&&n&&i.fire("insertText",new Hr(e,s,{text:n,isComposing:true}));},{priority:"low"});}observe(){}stopObserving(){}}class oy extends Ms{_typingQueue;static get pluginName(){return "Input"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.model,i=e.editing.view,s=e.editing.mapper,o=t.document.selection;this._typingQueue=new ry(e),i.addObserver(sy);const r=new ty(e,e.config.get("typing.undoStep")||20);e.commands.add("insertText",r),e.commands.add("input",r),this.listenTo(i.document,"beforeinput",()=>{this._typingQueue.flush("next beforeinput");},{priority:"high"}),this.listenTo(i.document,"insertText",(e,a)=>{const{text:l,selection:c}=a;if(i.document.selection.isFake&&c&&i.document.selection.isSimilar(c)&&a.preventDefault(),c&&Array.from(c.getRanges()).some(e=>!e.isCollapsed)&&a.preventDefault(),!r.isEnabled)return void a.preventDefault();let u;c&&(u=Array.from(c.getRanges()).filter(e=>e.root.is("rootElement")).map(e=>s.toModelRange(e)).map(e=>Yc(e,t.schema)||e)),u&&u.length||(u=Array.from(o.getRanges()));let d=l;if(n.isAndroid){const e=Array.from(u[0].getItems()).reduce((e,t)=>e+(t.is("$textProxy")?t.data:""),"");if(e&&(e.length<=d.length?d.startsWith(e)&&(d=d.substring(e.length),u[0].start=u[0].start.getShiftedBy(e.length)):e.startsWith(d)&&(u[0].start=u[0].start.getShiftedBy(d.length),d="")),0==d.length&&u[0].isCollapsed)return}const h={text:d,selection:t.createSelection(u)};this._typingQueue.push(h,Boolean(a.isComposing)),a.domEvent.defaultPrevented&&this._typingQueue.flush("beforeinput default prevented");}),n.isAndroid?this.listenTo(i.document,"keydown",(e,n)=>{!o.isCollapsed&&229==n.keyCode&&i.document.isComposing&&ay(t,r);}):this.listenTo(i.document,"compositionstart",()=>{o.isCollapsed||ay(t,r);},{priority:"high"}),this.listenTo(i.document,"mutations",(e,{mutations:t})=>{if(this._typingQueue.hasAffectedElements())for(const{node:e}of t){const t=ly(e,s),i=s.toModelElement(t);if(this._typingQueue.isElementAffected(i))return void this._typingQueue.flush("mutations")}}),this.listenTo(i.document,"compositionend",()=>{this._typingQueue.flush("before composition end");},{priority:"high"}),this.listenTo(i.document,"compositionend",()=>{this._typingQueue.flush("after composition end");const e=[];if(this._typingQueue.hasAffectedElements())for(const t of this._typingQueue.flushAffectedElements()){const i=s.toViewElement(t);i&&e.push({type:"children",node:i});}!e.length&&n.isAndroid||i.document.fire("mutations",{mutations:e});},{priority:"lowest"});}destroy(){super.destroy(),this._typingQueue.destroy();}}class ry{editor;flushDebounced=st(()=>this.flush("timeout"),50);_queue=[];_isComposing=false;_affectedElements=new Set;constructor(e){this.editor=e;}destroy(){for(this.flushDebounced.cancel(),this._affectedElements.clear();this._queue.length;)this.shift();}get length(){return this._queue.length}push(e,t){const i={text:e.text};if(e.selection){i.selectionRanges=[];for(const t of e.selection.getRanges())i.selectionRanges.push(Sa.fromRange(t)),this._affectedElements.add(t.start.parent);}this._queue.push(i),this._isComposing||=t,this.flushDebounced();}shift(){const e=this._queue.shift(),t={text:e.text};if(e.selectionRanges){const i=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);i.length&&(t.selection=this.editor.model.createSelection(i));}return t}flush(e){const t=this.editor,i=t.model,n=t.editing.view;if(this.flushDebounced.cancel(),!this._queue.length)return;const s=t.commands.get("insertText").buffer;i.enqueueChange(s.batch,()=>{for(s.lock();this._queue.length;){const e=this.shift();t.execute("insertText",e);}s.unlock(),this._isComposing||this._affectedElements.clear(),this._isComposing=false;}),n.scrollToTheSelection();}isElementAffected(e){return this._affectedElements.has(e)}hasAffectedElements(){return this._affectedElements.size>0}flushAffectedElements(){const e=Array.from(this._affectedElements);return this._affectedElements.clear(),e}}function ay(e,t){if(!t.isEnabled)return;const i=t.buffer;i.lock(),e.enqueueChange(i.batch,()=>{e.deleteContent(e.document.selection);}),i.unlock();}function ly(e,t){let i=e.is("$text")?e.parent:e;for(;!t.toModelElement(i);)i=i.parent;return i}class cy extends Ns{direction;_buffer;constructor(e,t){super(e),this.direction=t,this._buffer=new ey(e.model,e.config.get("typing.undoStep")),this._isEnabledBasedOnSelection=false;}get buffer(){return this._buffer}execute(e={}){const t=this.editor.model,i=t.document;t.enqueueChange(this._buffer.batch,n=>{this._buffer.lock();const s=n.createSelection(e.selection||i.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:true}),this._shouldEntireContentBeReplacedWithParagraph(o))return void this._replaceEntireContentWithParagraph(n);if(this._shouldReplaceFirstBlockWithParagraph(s,o))return void this.editor.execute("paragraph",{selection:s});if(s.isCollapsed)return;let a=0;s.getFirstRange().getMinimalFlatRanges().forEach(e=>{a+=Xt(e.getWalker({singleCharacters:true,ignoreElementEnd:true,shallow:true}));}),t.deleteContent(s,{doNotResetEntireContent:r,direction:this.direction}),this._buffer.input(a),n.setSelection(s),this._buffer.unlock();});}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return  false;const t=this.editor.model,i=t.document.selection,n=t.schema.getLimitElement(i);if(!(i.isCollapsed&&i.containsEntireContent(n)))return  false;if(!t.schema.checkChild(n,"paragraph"))return  false;const s=n.getChild(0);return !s||!s.is("element","paragraph")}_replaceEntireContentWithParagraph(e){const t=this.editor.model,i=t.document.selection,n=t.schema.getLimitElement(i),s=e.createElement("paragraph");e.remove(e.createRangeIn(n)),e.insert(s,n),e.setSelection(s,0);}_shouldReplaceFirstBlockWithParagraph(e,t){const i=this.editor.model;if(t>1||"backward"!=this.direction)return  false;if(!e.isCollapsed)return  false;const n=e.getFirstPosition(),s=i.schema.getLimitElement(n),o=s.getChild(0);return n.parent==o&&(!!e.containsEntireContent(o)&&(!!i.schema.checkChild(s,"paragraph")&&"paragraph"!=o.name))}}const uy="word",dy="selection",hy="backward",my="forward",gy={deleteContent:{unit:dy,direction:hy},deleteContentBackward:{unit:"codePoint",direction:hy},deleteWordBackward:{unit:uy,direction:hy},deleteHardLineBackward:{unit:dy,direction:hy},deleteSoftLineBackward:{unit:dy,direction:hy},deleteContentForward:{unit:"character",direction:my},deleteWordForward:{unit:uy,direction:my},deleteHardLineForward:{unit:dy,direction:my},deleteSoftLineForward:{unit:dy,direction:my}};class fy extends zr{constructor(e){super(e);const t=e.document;let i=0;t.on("keydown",()=>{i++;}),t.on("keyup",()=>{i=0;}),t.on("beforeinput",(s,o)=>{if(!this.isEnabled)return;const{targetRanges:r,domEvent:a,inputType:l}=o,c=gy[l];if(!c)return;const u={direction:c.direction,unit:c.unit,sequence:i};u.unit==dy&&(u.selectionToRemove=e.createSelection(r[0])),"deleteContentBackward"===l&&(n.isAndroid&&(u.sequence=1),function(e){if(1!=e.length||e[0].isCollapsed)return  false;const t=e[0].getWalker({direction:"backward",singleCharacters:true,ignoreElementEnd:true});let i=0;for(const{nextPosition:e,item:n}of t){if(e.parent.is("$text")){const t=e.parent.data,n=e.offset;if(Wn(t,n)||Gn(t,n)||Jn(t,n))continue;i++;}else (n.is("containerElement")||n.is("emptyElement"))&&i++;if(i>1)return  true}return  false}(r)&&(u.unit=dy,u.selectionToRemove=e.createSelection(r)));const d=new Bo(t,"delete",r[0]);t.fire(d,new Hr(e,a,u)),d.stop.called&&s.stop();}),n.isBlink&&function(e){const t=e.view,i=t.document;let n=null,s=false;function o(e){return e==on.backspace||e==on.delete}function r(e){return e==on.backspace?hy:my}i.on("keydown",(e,{keyCode:t})=>{n=t,s=false;}),i.on("keyup",(a,{keyCode:l,domEvent:c})=>{const u=i.selection,d=e.isEnabled&&l==n&&o(l)&&!u.isCollapsed&&!s;if(n=null,d){const e=u.getFirstRange(),n=new Bo(i,"delete",e),s={unit:dy,direction:r(l),selectionToRemove:u};i.fire(n,new Hr(t,c,s));}}),i.on("beforeinput",(e,{inputType:t})=>{const i=gy[t];o(n)&&i&&i.direction==r(n)&&(s=true);},{priority:"high"}),i.on("beforeinput",(e,{inputType:t,data:i})=>{n==on.delete&&"insertText"==t&&""==i&&e.stop();},{priority:"high"});}(this);}observe(){}stopObserving(){}}class py extends Ms{_undoOnBackspace;static get pluginName(){return "Delete"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.editing.view,i=t.document,n=e.model.document;t.addObserver(fy),this._undoOnBackspace=false;const s=new cy(e,"forward");e.commands.add("deleteForward",s),e.commands.add("forwardDelete",s),e.commands.add("delete",new cy(e,"backward")),this.listenTo(i,"delete",(n,s)=>{i.isComposing||s.preventDefault();const{direction:o,sequence:r,selectionToRemove:a,unit:l}=s,c="forward"===o?"deleteForward":"delete",u={sequence:r};if("selection"==l){const t=Array.from(a.getRanges()).map(t=>e.editing.mapper.toModelRange(t)).map(t=>Yc(t,e.model.schema)||t);u.selection=e.model.createSelection(t);}else u.unit=l;e.execute(c,u),t.scrollToTheSelection();},{priority:"low"}),this.listenTo(i,"keydown",(s,o)=>{if(i.isComposing||o.keyCode!=on.backspace||!n.selection.isCollapsed)return;const r=e.model.schema.getLimitElement(n.selection),a=e.model.createPositionAt(r,0);if(a.isTouching(n.selection.getFirstPosition())){o.preventDefault();const n=e.model.schema.getNearestSelectionRange(a,"forward");if(!n)return;const s=t.createSelection(e.editing.mapper.toViewRange(n)),r=s.getFirstRange(),l=new Bo(document,"delete",r),c={unit:"selection",direction:"backward",selectionToRemove:s};i.fire(l,new Hr(t,o.domEvent,c));}}),this.editor.plugins.has("UndoEditing")&&(this.listenTo(i,"delete",(t,i)=>{this._undoOnBackspace&&"backward"==i.direction&&1==i.sequence&&"codePoint"==i.unit&&(this._undoOnBackspace=false,e.execute("undo"),i.preventDefault(),t.stop());},{context:"$capture"}),this.listenTo(n,"change",()=>{this._undoOnBackspace=false;}));}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=true);}}class by extends Ms{static get requires(){return [oy,py]}static get pluginName(){return "Typing"}static get isOfficialPlugin(){return  true}}function wy(e,t){let i=e.start;return {text:Array.from(e.getWalker({ignoreElementEnd:false})).reduce((e,{item:n})=>n.is("$text")||n.is("$textProxy")?e+n.data:(i=t.createPositionAfter(n),""),""),range:t.createRange(i,e.end)}}class vy extends($t()){model;testCallback;_hasMatch;constructor(e,t){super(),this.model=e,this.testCallback=t,this._hasMatch=false,this.set("isEnabled",true),this.on("change:isEnabled",()=>{this.isEnabled?this._startListening():(this.stopListening(e.document.selection),this.stopListening(e.document));}),this._startListening();}get hasMatch(){return this._hasMatch}_startListening(){const e=this.model.document;this.listenTo(e.selection,"change:range",(t,{directChange:i})=>{i&&(e.selection.isCollapsed?this._evaluateTextBeforeSelection("selection"):this.hasMatch&&(this.fire("unmatched"),this._hasMatch=false));}),this.listenTo(e,"change:data",(e,t)=>{!t.isUndo&&t.isLocal&&this._evaluateTextBeforeSelection("data",{batch:t});});}_evaluateTextBeforeSelection(e,t={}){const i=this.model,n=i.document.selection,s=i.createRange(i.createPositionAt(n.focus.parent,0),n.focus),{text:o,range:r}=wy(s,i),a=this.testCallback(o);if(!a&&this.hasMatch&&this.fire("unmatched"),this._hasMatch=!!a,a){const i=Object.assign(t,{text:o,range:r});"object"==typeof a&&Object.assign(i,a),this.fire(`matched:${e}`,i);}}}class _y extends Ms{attributes;_overrideUid;_isNextGravityRestorationSkipped=false;static get pluginName(){return "TwoStepCaretMovement"}static get isOfficialPlugin(){return  true}constructor(e){super(e),this.attributes=new Set,this._overrideUid=null;}init(){const e=this.editor,t=e.model,i=e.editing.view,n=e.locale,s=t.document.selection;this.listenTo(i.document,"arrowKey",(e,t)=>{if(!s.isCollapsed)return;if(t.shiftKey||t.altKey||t.ctrlKey)return;const i=t.keyCode==on.arrowright,o=t.keyCode==on.arrowleft;if(!i&&!o)return;const r=n.contentLanguageDirection;let a=false;a="ltr"===r&&i||"rtl"===r&&o?this._handleForwardMovement(t):this._handleBackwardMovement(t),true===a&&e.stop();},{context:"$text",priority:"highest"}),this.listenTo(s,"change:range",(e,t)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=false:this._isGravityOverridden&&(!t.directChange&&Ey(s.getFirstPosition(),this.attributes)||this._restoreGravity());}),this._enableClickingAfterNode(),this._enableInsertContentSelectionAttributesFixer(),this._handleDeleteContentAfterNode();}registerAttribute(e){this.attributes.add(e);}_handleForwardMovement(e){const t=this.attributes,i=this.editor.model,n=i.document.selection,s=n.getFirstPosition();return !this._isGravityOverridden&&((!s.isAtStart||!yy(n,t))&&(!!Ey(s,t)&&(e&&xy(e),yy(n,t)&&Ey(s,t,true)?Cy(i,t):this._overrideGravity(),true)))}_handleBackwardMovement(e){const t=this.attributes,i=this.editor.model,n=i.document.selection,s=n.getFirstPosition();return this._isGravityOverridden?(e&&xy(e),this._restoreGravity(),Ey(s,t,true)?Cy(i,t):ky(i,t,s),true):s.isAtStart?!!yy(n,t)&&(e&&xy(e),ky(i,t,s),true):!yy(n,t)&&Ey(s,t,true)?(e&&xy(e),ky(i,t,s),true):!!Ay(s,t)&&(s.isAtEnd&&!yy(n,t)&&Ey(s,t)?(e&&xy(e),ky(i,t,s),true):(this._isNextGravityRestorationSkipped=true,this._overrideGravity(),false))}_enableClickingAfterNode(){const e=this.editor,t=e.model,i=t.document.selection,n=e.editing.view.document;e.editing.view.addObserver(_u),e.editing.view.addObserver(yu);let s=false,o=false;this.listenTo(n,"touchstart",()=>{o=false,s=true;}),this.listenTo(n,"mousedown",()=>{o=true;}),this.listenTo(n,"selectionChange",()=>{const e=this.attributes;if(!o&&!s)return;if(o=false,s=false,!i.isCollapsed)return;if(!yy(i,e))return;const n=i.getFirstPosition();Ey(n,e)&&(n.isAtStart||Ey(n,e,true)?Cy(t,e):this._isGravityOverridden||this._overrideGravity());});}_enableInsertContentSelectionAttributesFixer(){const e=this.editor.model,t=e.document.selection,i=this.attributes;this.listenTo(e,"insertContent",()=>{const n=t.getFirstPosition();yy(t,i)&&Ey(n,i)&&Cy(e,i);},{priority:"low"});}_handleDeleteContentAfterNode(){const e=this.editor,t=e.model,i=t.document.selection,n=e.editing.view;let s=false,o=false;this.listenTo(n.document,"delete",(e,t)=>{s="backward"===t.direction;},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{if(!s)return;const e=i.getFirstPosition();o=yy(i,this.attributes)&&!Ay(e,this.attributes);},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{s&&(s=false,o||e.model.enqueueChange(()=>{const e=i.getFirstPosition();yy(i,this.attributes)&&Ey(e,this.attributes)&&(e.isAtStart||Ey(e,this.attributes,true)?Cy(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 yy(e,t){for(const i of t)if(e.hasAttribute(i))return  true;return  false}function ky(e,t,i){const n=i.nodeBefore;e.change(i=>{if(n){const t=[],s=e.schema.isObject(n)&&e.schema.isInline(n);for(const[i,o]of n.getAttributes())!e.schema.checkAttribute("$text",i)||s&&false===e.schema.getAttributeProperties(i).copyFromObject||t.push([i,o]);i.setSelectionAttribute(t);}else i.removeSelectionAttribute(t);});}function Cy(e,t){e.change(e=>{e.removeSelectionAttribute(t);});}function xy(e){e.preventDefault();}function Ay(e,t){return Ey(e.getShiftedBy(-1),t)}function Ey(e,t,i=false){const{nodeBefore:n,nodeAfter:s}=e;for(const e of t){const t=n?n.getAttribute(e):void 0,o=s?s.getAttribute(e):void 0;if((!i||void 0!==t&&void 0!==o)&&o!==t)return  true}return  false}const Ty={copyright:{from:"(c)",to:"©"},registeredTrademark:{from:"(r)",to:"®"},trademark:{from:"(tm)",to:"™"},oneHalf:{from:/(^|[^/a-z0-9])(1\/2)([^/a-z0-9])$/i,to:[null,"½",null]},oneThird:{from:/(^|[^/a-z0-9])(1\/3)([^/a-z0-9])$/i,to:[null,"⅓",null]},twoThirds:{from:/(^|[^/a-z0-9])(2\/3)([^/a-z0-9])$/i,to:[null,"⅔",null]},oneForth:{from:/(^|[^/a-z0-9])(1\/4)([^/a-z0-9])$/i,to:[null,"¼",null]},threeQuarters:{from:/(^|[^/a-z0-9])(3\/4)([^/a-z0-9])$/i,to:[null,"¾",null]},lessThanOrEqual:{from:"<=",to:"≤"},greaterThanOrEqual:{from:">=",to:"≥"},notEqual:{from:"!=",to:"≠"},arrowLeft:{from:"<-",to:"←"},arrowRight:{from:"->",to:"→"},horizontalEllipsis:{from:"...",to:"…"},enDash:{from:/(^| )(--)( )$/,to:[null,"–",null]},emDash:{from:/(^| )(---)( )$/,to:[null,"—",null]},quotesPrimary:{from:By('"'),to:[null,"“",null,"”"]},quotesSecondary:{from:By("'"),to:[null,"‘",null,"’"]},quotesPrimaryEnGb:{from:By("'"),to:[null,"‘",null,"’"]},quotesSecondaryEnGb:{from:By('"'),to:[null,"“",null,"”"]},quotesPrimaryPl:{from:By('"'),to:[null,"„",null,"”"]},quotesSecondaryPl:{from:By("'"),to:[null,"‚",null,"’"]}},Sy={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},Iy=["symbols","mathematical","typography","quotes"];class Py extends Ms{static get requires(){return [py,oy]}static get pluginName(){return "TextTransformation"}static get isOfficialPlugin(){return  true}constructor(e){super(e),e.config.define("typing",{transformations:{include:Iy}});}init(){const e=this.editor.model.document.selection;e.on("change:range",()=>{const t=e.anchor,i=!!t&&t.parent.is("element","codeBlock"),n=e.hasAttribute("code");this.isEnabled=!(i||n);}),this._enableTransformationWatchers();}_enableTransformationWatchers(){const e=this.editor,t=e.model,i=e.plugins.get("Delete"),n=function(e){const t=e.extra||[],i=e.remove||[],n=e=>!i.includes(e);return function(e){const t=new Set;for(const i of e)if("string"==typeof i&&Sy[i])for(const e of Sy[i])t.add(e);else t.add(i);return Array.from(t)}(e.include.concat(t).filter(n)).filter(n).map(e=>"string"==typeof e&&Ty[e]?Ty[e]:e).filter(e=>"object"==typeof e).map(e=>({from:Vy(e.from),to:Ry(e.to)}))}(e.config.get("typing.transformations")),s=new vy(e.model,e=>{for(const t of n){if(t.from.test(e))return {normalizedTransformation:t}}});s.on("matched:data",(e,n)=>{if(!n.batch.isTyping)return;const{from:s,to:o}=n.normalizedTransformation,r=s.exec(n.text),a=o(r.slice(1)),l=n.range;let c=r.index;t.enqueueChange(e=>{for(let i=1;i<r.length;i++){const n=r[i],s=a[i-1];if(null==s){c+=n.length;continue}const o=l.start.getShiftedBy(c),u=t.createRange(o,o.getShiftedBy(n.length)),d=Oy(o);t.insertContent(e.createText(s,d),u),c+=s.length;}t.enqueueChange(()=>{i.requestUndoOnBackspace();});});}),s.bind("isEnabled").to(this);}}function Vy(e){return "string"==typeof e?new RegExp(`(${Mt(e)})$`):e}function Ry(e){return "string"==typeof e?()=>[e]:e instanceof Array?()=>e:e}function Oy(e){return (e.textNode?e.textNode:e.nodeAfter).getAttributes()}function By(e){return new RegExp(`(^|\\s)(${e})([^${e}]*)(${e})$`)}function Ly(e,t,i,n){return n.createRange(My(e,t,i,true,n),My(e,t,i,false,n))}function My(e,t,i,n,s){let o=e.textNode||(n?e.nodeBefore:e.nodeAfter),r=null;for(;o&&o.getAttribute(t)==i;)r=o,o=n?o.previousSibling:o.nextSibling;return r?s.createPositionAt(r,n?"before":"after"):e}function Fy(e,t,i,n){const s=e.editing.view,o=new Set;s.document.registerPostFixer(s=>{const r=e.model.document.selection;let a=false;if(r.hasAttribute(t)){const l=Ly(r.getFirstPosition(),t,r.getAttribute(t),e.model),c=e.editing.mapper.toViewRange(l);for(const e of c.getItems())e.is("element",i)&&!e.hasClass(n)&&(s.addClass(n,e),o.add(e),a=true);}return a}),e.conversion.for("editingDowncast").add(e=>{function t(){s.change(e=>{for(const t of o.values())e.removeClass(n,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"});});}function Ny(e,t,i,n){let s,o=null;"function"==typeof n?s=n:(o=e.commands.get(n),s=()=>{e.execute(n);}),e.model.document.on("change:data",(r,a)=>{if(o&&!o.isEnabled||!t.isEnabled)return;const l=Cn(e.model.document.selection.getRanges());if(!l.isCollapsed)return;if(a.isUndo||!a.isLocal)return;const c=Array.from(e.model.document.differ.getChanges()),u=c[0];if(1!=c.length||"insert"!==u.type||"$text"!=u.name||1!=u.length)return;const d=u.position.parent;if(d.is("element","codeBlock"))return;if(d.is("element","listItem")&&"function"!=typeof n&&!["numberedList","bulletedList","todoList"].includes(n))return;if(o&&true===o.value)return;const h=d.getChild(0),m=e.model.createRangeOn(h);if(!m.containsRange(l)&&!l.end.isEqual(m.end))return;const g=i.exec(h.data.substr(0,l.end.offset));g&&e.model.enqueueChange(t=>{const i=e.model.document.selection,n=t.createPositionAt(d,0),o=t.createPositionAt(d,g[0].length),r=new Sa(n,o);if(false!==s({match:g})){const e=Array.from(i.getAttributes());t.remove(r);const n=i.getFirstRange(),s=t.createRangeIn(d);!d.isEmpty||s.isEqual(n)||s.containsRange(n,true)||t.remove(d),function(e,t,i){const n=e.model.schema,s=t.getFirstPosition();let o=new Al(s);n.checkChild(o,"$text")&&(o=o.push("$text"));for(const[t,s]of i)n.checkAttribute(o,t)&&e.setSelectionAttribute(t,s);}(t,i,e);}r.detach(),e.model.enqueueChange(()=>{e.plugins.get("Delete").requestUndoOnBackspace();});});});}function Dy(e,t,i,n){let s,o;i instanceof RegExp?s=i:o=i,o=o||(e=>{let t;const i=[],n=[];for(;null!==(t=s.exec(e))&&!(t&&t.length<4);){let{index:e,1:s,2:o,3:r}=t;const a=s+o+r;e+=t[0].length-a.length;const l=[e,e+s.length],c=[e+s.length+o.length,e+s.length+o.length+r.length];i.push(l),i.push(c),n.push([e+s.length,e+s.length+o.length]);}return {remove:i,format:n}}),e.model.document.on("change:data",(i,s)=>{if(s.isUndo||!s.isLocal||!t.isEnabled)return;const r=e.model,a=r.document.selection;if(!a.isCollapsed)return;const l=Array.from(r.document.differ.getChanges()),c=l[0];if(1!=l.length||"insert"!==c.type||"$text"!=c.name||1!=c.length)return;const u=a.focus,d=u.parent,{text:h,range:m}=function(e,t){let i=e.start;const n=Array.from(e.getItems()).reduce((e,n)=>!n.is("$text")&&!n.is("$textProxy")||n.getAttribute("code")?(i=t.createPositionAfter(n),""):e+n.data,"");return {text:n,range:t.createRange(i,e.end)}}(r.createRange(r.createPositionAt(d,0),u),r),g=o(h),f=zy(m.start,g.format,r),p=zy(m.start,g.remove,r);f.length&&p.length&&r.enqueueChange(t=>{if(false!==n(t,f)){for(const e of p.reverse())t.remove(e);r.enqueueChange(()=>{e.plugins.get("Delete").requestUndoOnBackspace();});}});});}function zy(e,t,i){return t.filter(e=>void 0!==e[0]&&void 0!==e[1]).map(t=>i.createRange(e.getShiftedBy(t[0]),e.getShiftedBy(t[1])))}class Hy extends Ms{static get requires(){return [py]}static get pluginName(){return "Autoformat"}static get isOfficialPlugin(){return  true}afterInit(){const e=this.editor,t=this.editor.t;this._addListAutoformats(),this._addBasicStylesAutoformats(),this._addHeadingAutoformats(),this._addBlockQuoteAutoformats(),this._addCodeBlockAutoformats(),this._addHorizontalLineAutoformats(),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Revert autoformatting action"),keystroke:"Backspace"}]});}_addListAutoformats(){const e=this.editor.commands;e.get("bulletedList")&&Ny(this.editor,this,/^[*-]\s$/,"bulletedList"),e.get("numberedList")&&Ny(this.editor,this,/^1[.|)]\s$/,"numberedList"),e.get("todoList")&&Ny(this.editor,this,/^\[\s?\]\s$/,"todoList"),e.get("checkTodoList")&&Ny(this.editor,this,/^\[\s?x\s?\]\s$/,()=>{this.editor.execute("todoList"),this.editor.execute("checkTodoList");});}_addBasicStylesAutoformats(){const e=this.editor.commands;if(e.get("bold")){const e=qy(this.editor,"bold");Dy(this.editor,this,/(?:^|\s)(\*\*)([^*]+)(\*\*)$/g,e),Dy(this.editor,this,/(?:^|\s)(__)([^_]+)(__)$/g,e);}if(e.get("italic")){const e=qy(this.editor,"italic");Dy(this.editor,this,/(?:^|\s)(\*)([^*_]+)(\*)$/g,e),Dy(this.editor,this,/(?:^|\s)(_)([^_]+)(_)$/g,e);}if(e.get("code")){const e=qy(this.editor,"code");Dy(this.editor,this,/(`)([^`]+)(`)$/g,e);}if(e.get("strikethrough")){const e=qy(this.editor,"strikethrough");Dy(this.editor,this,/(~~)([^~]+)(~~)$/g,e);}}_addHeadingAutoformats(){const e=this.editor.commands.get("heading");e&&e.modelElements.filter(e=>e.match(/^heading[1-6]$/)).forEach(t=>{const i=t[7],n=new RegExp(`^(#{${i}})\\s$`);Ny(this.editor,this,n,()=>{if(!e.isEnabled||e.value===t)return  false;this.editor.execute("heading",{value:t});});});}_addBlockQuoteAutoformats(){this.editor.commands.get("blockQuote")&&Ny(this.editor,this,/^>\s$/,"blockQuote");}_addCodeBlockAutoformats(){const e=this.editor,t=e.model.document.selection;e.commands.get("codeBlock")&&Ny(e,this,/^```$/,()=>{if(t.getFirstPosition().parent.is("element","listItem"))return  false;this.editor.execute("codeBlock",{usePreviousLanguageChoice:true});});}_addHorizontalLineAutoformats(){this.editor.commands.get("horizontalLine")&&Ny(this.editor,this,/^---$/,"horizontalLine");}}function qy(e,t){return (i,n)=>{if(!e.commands.get(t).isEnabled)return  false;const s=e.model.schema.getValidRanges(n,t);for(const e of s)i.setAttribute(t,true,e);i.removeSelectionAttribute(t);}}class Uy extends Ms{adapter;_debouncedSave;_lastDocumentVersion;_savePromise;_domEmitter;_config;_pendingActions;_makeImmediateSave;_action=null;static get pluginName(){return "Autosave"}static get isOfficialPlugin(){return  true}static get requires(){return [Oh]}constructor(e){super(e);const t=e.config.get("autosave")||{},i=t.waitingTime||1e3;this.set("state","synchronized"),this._debouncedSave=st(this._save.bind(this),i),this._lastDocumentVersion=e.model.document.version,this._savePromise=null,this._domEmitter=new(ci()),this._config=t,this._pendingActions=e.plugins.get(Oh),this._makeImmediateSave=false;}init(){const e=this.editor,t=e.model.document;this.listenTo(e,"ready",()=>{this.listenTo(t,"change:data",(e,t)=>{this._saveCallbacks.length&&t.isLocal&&("synchronized"===this.state&&(this.state="waiting",this._setPendingAction()),"waiting"===this.state&&this._debouncedSave());});}),this.listenTo(e,"destroy",()=>this._flush(),{priority:"highest"}),this._domEmitter.listenTo(window,"beforeunload",(e,t)=>{this._pendingActions.hasAny&&(t.returnValue=this._pendingActions.first.message);});}destroy(){this._domEmitter.stopListening(),super.destroy();}save(){return this._debouncedSave.cancel(),this._save()}_flush(){this._debouncedSave.flush();}_save(){return this._savePromise?(this._makeImmediateSave=this.editor.model.document.version>this._lastDocumentVersion,this._savePromise):(this._setPendingAction(),this.state="saving",this._lastDocumentVersion=this.editor.model.document.version,this._savePromise=Promise.resolve().then(()=>Promise.all(this._saveCallbacks.map(e=>e(this.editor)))).finally(()=>{this._savePromise=null;}).then(()=>{if(this._makeImmediateSave)return this._makeImmediateSave=false,this._save();this.editor.model.document.version>this._lastDocumentVersion?(this.state="waiting",this._debouncedSave()):(this.state="synchronized",this._pendingActions.remove(this._action),this._action=null);}).catch(e=>{throw this.state="error",this.state="saving",this._debouncedSave(),e}),this._savePromise)}_setPendingAction(){const e=this.editor.t;this._action||(this._action=this._pendingActions.add(e("Saving changes")));}get _saveCallbacks(){const e=[];return this.adapter&&this.adapter.save&&e.push(this.adapter.save),this._config.save&&e.push(this._config.save),e}}class jy extends Ns{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,i=t.document.selection,n=void 0===e.forceValue?!this.value:e.forceValue;t.change(e=>{if(i.isCollapsed)n?e.setSelectionAttribute(this.attributeKey,true):e.removeSelectionAttribute(this.attributeKey);else {const s=t.schema.getValidRanges(i.getRanges(),this.attributeKey,{includeEmptyRanges:true});for(const t of s){let i=t,s=this.attributeKey;t.isCollapsed&&(i=t.start.parent,s=Oa._getStoreAttributeKey(this.attributeKey)),n?e.setAttribute(s,n,i):e.removeAttribute(s,i);}}});}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,i=e.document.selection;if(i.isCollapsed)return i.hasAttribute(this.attributeKey);for(const e of i.getRanges())for(const i of e.getItems())if(t.checkAttribute(i,this.attributeKey))return i.hasAttribute(this.attributeKey);return  false}}const $y="bold";class Wy extends Ms{static get pluginName(){return "BoldEditing"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:$y}),e.model.schema.setAttributeProperties($y,{isFormatting:true,copyOnEnter:true}),e.conversion.attributeToElement({model:$y,view:"strong",upcastAlso:["b",e=>{const t=e.getStyle("font-weight");return t&&("bold"==t||Number(t)>=600)?{name:true,styles:["font-weight"]}:null}]}),e.commands.add($y,new jy(e,$y)),e.keystrokes.set("CTRL+B",$y),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Bold text"),keystroke:"CTRL+B"}]});}}function Gy({editor:e,commandName:t,plugin:i,icon:n,label:s,keystroke:o}){return r=>{const a=e.commands.get(t),l=new r(e.locale);return l.set({label:s,icon:n,keystroke:o,isToggleable:true}),l.bind("isEnabled").to(a,"isEnabled"),l.bind("isOn").to(a,"value"),l instanceof Jp?l.set({role:"menuitemcheckbox"}):l.set({tooltip:true}),i.listenTo(l,"execute",()=>{e.execute(t),e.editing.view.focus();}),l}}const Ky="bold";class Jy extends Ms{static get pluginName(){return "BoldUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.locale.t,i=Gy({editor:e,commandName:Ky,plugin:this,icon:om,label:t("Bold"),keystroke:"CTRL+B"});e.ui.componentFactory.add(Ky,()=>i(Bp)),e.ui.componentFactory.add("menuBar:"+Ky,()=>i(Jp));}}class Qy extends Ms{static get requires(){return [Wy,Jy]}static get pluginName(){return "Bold"}static get isOfficialPlugin(){return  true}}const Yy="code";class Zy extends Ms{static get pluginName(){return "CodeEditing"}static get isOfficialPlugin(){return  true}static get requires(){return [_y]}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:Yy}),e.model.schema.setAttributeProperties(Yy,{isFormatting:true,copyOnEnter:false}),e.conversion.attributeToElement({model:Yy,view:"code"}),e.commands.add(Yy,new jy(e,Yy)),e.plugins.get(_y).registerAttribute(Yy),Fy(e,Yy,"code","ck-code_selected"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Move out of an inline code style"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]});}}const Xy="code";class ek extends Ms{static get pluginName(){return "CodeUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.locale.t,i=Gy({editor:e,commandName:Xy,plugin:this,icon:Em,label:t("Code")});e.ui.componentFactory.add(Xy,()=>i(Bp)),e.ui.componentFactory.add("menuBar:"+Xy,()=>i(Jp));}}class tk extends Ms{static get requires(){return [Zy,ek]}static get pluginName(){return "Code"}static get isOfficialPlugin(){return  true}}const ik="italic";class nk extends Ms{static get pluginName(){return "ItalicEditing"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:ik}),e.model.schema.setAttributeProperties(ik,{isFormatting:true,copyOnEnter:true}),e.conversion.attributeToElement({model:ik,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),e.commands.add(ik,new jy(e,ik)),e.keystrokes.set("CTRL+I",ik),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Italic text"),keystroke:"CTRL+I"}]});}}const sk="italic";class ok extends Ms{static get pluginName(){return "ItalicUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.locale.t,i=Gy({editor:e,commandName:sk,plugin:this,icon:Sg,keystroke:"CTRL+I",label:t("Italic")});e.ui.componentFactory.add(sk,()=>i(Bp)),e.ui.componentFactory.add("menuBar:"+sk,()=>i(Jp));}}class rk extends Ms{static get requires(){return [nk,ok]}static get pluginName(){return "Italic"}static get isOfficialPlugin(){return  true}}const ak="strikethrough";class lk extends Ms{static get pluginName(){return "StrikethroughEditing"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:ak}),e.model.schema.setAttributeProperties(ak,{isFormatting:true,copyOnEnter:true}),e.conversion.attributeToElement({model:ak,view:"s",upcastAlso:["del","strike",{styles:{"text-decoration":"line-through"}}]}),e.commands.add(ak,new jy(e,ak)),e.keystrokes.set("CTRL+SHIFT+X","strikethrough"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Strikethrough text"),keystroke:"CTRL+SHIFT+X"}]});}}const ck="strikethrough";class uk extends Ms{static get pluginName(){return "StrikethroughUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.locale.t,i=Gy({editor:e,commandName:ck,plugin:this,icon:Yf,keystroke:"CTRL+SHIFT+X",label:t("Strikethrough")});e.ui.componentFactory.add(ck,()=>i(Bp)),e.ui.componentFactory.add("menuBar:"+ck,()=>i(Jp));}}class dk extends Ms{static get requires(){return [lk,uk]}static get pluginName(){return "Strikethrough"}static get isOfficialPlugin(){return  true}}const hk="subscript";class mk extends Ms{static get pluginName(){return "SubscriptEditing"}static get isOfficialPlugin(){return  true}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:hk}),e.model.schema.setAttributeProperties(hk,{isFormatting:true,copyOnEnter:true}),e.conversion.attributeToElement({model:hk,view:"sub",upcastAlso:[{styles:{"vertical-align":"sub"}}]}),e.commands.add(hk,new jy(e,hk));}}const gk="subscript";class fk extends Ms{static get pluginName(){return "SubscriptUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.locale.t,i=Gy({editor:e,commandName:gk,plugin:this,icon:Xf,label:t("Subscript")});e.ui.componentFactory.add(gk,()=>i(Bp)),e.ui.componentFactory.add("menuBar:"+gk,()=>i(Jp));}}class pk extends Ms{static get requires(){return [mk,fk]}static get pluginName(){return "Subscript"}static get isOfficialPlugin(){return  true}}const bk="superscript";class wk extends Ms{static get pluginName(){return "SuperscriptEditing"}static get isOfficialPlugin(){return  true}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:bk}),e.model.schema.setAttributeProperties(bk,{isFormatting:true,copyOnEnter:true}),e.conversion.attributeToElement({model:bk,view:"sup",upcastAlso:[{styles:{"vertical-align":"super"}}]}),e.commands.add(bk,new jy(e,bk));}}const vk="superscript";class _k extends Ms{static get pluginName(){return "SuperscriptUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.locale.t,i=Gy({editor:e,commandName:vk,plugin:this,icon:ep,label:t("Superscript")});e.ui.componentFactory.add(vk,()=>i(Bp)),e.ui.componentFactory.add("menuBar:"+vk,()=>i(Jp));}}class yk extends Ms{static get requires(){return [wk,_k]}static get pluginName(){return "Superscript"}static get isOfficialPlugin(){return  true}}const kk="underline";class Ck extends Ms{static get pluginName(){return "UnderlineEditing"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:kk}),e.model.schema.setAttributeProperties(kk,{isFormatting:true,copyOnEnter:true}),e.conversion.attributeToElement({model:kk,view:"u",upcastAlso:{styles:{"text-decoration":"underline"}}}),e.commands.add(kk,new jy(e,kk)),e.keystrokes.set("CTRL+U","underline"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Underline text"),keystroke:"CTRL+U"}]});}}const xk="underline";class Ak extends Ms{static get pluginName(){return "UnderlineUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.locale.t,i=Gy({editor:e,commandName:xk,plugin:this,icon:kp,label:t("Underline"),keystroke:"CTRL+U"});e.ui.componentFactory.add(xk,()=>i(Bp)),e.ui.componentFactory.add("menuBar:"+xk,()=>i(Jp));}}class Ek extends Ms{static get requires(){return [Ck,Ak]}static get pluginName(){return "Underline"}static get isOfficialPlugin(){return  true}}function*Tk(e,t){for(const i of t)i&&e.getAttributeProperties(i[0]).copyOnEnter&&(yield i);}class Sk extends Ns{execute(){this.editor.model.change(e=>{this.enterBlock(e),this.fire("afterExecute",{writer:e});});}enterBlock(e){const t=this.editor.model,i=t.document.selection,n=t.schema,s=i.isCollapsed,o=i.getFirstRange(),r=o.start.parent,a=o.end.parent;if(n.isLimit(r)||n.isLimit(a))return s||r!=a||t.deleteContent(i),false;if(s){const t=Tk(e.model.schema,i.getAttributes());return Ik(e,o.start),e.setSelectionAttribute(t),true}{const n=!(o.start.isAtStart&&o.end.isAtEnd),s=r==a;if(t.deleteContent(i,{leaveUnmerged:n}),n){if(s)return Ik(e,i.focus),true;e.setSelection(a,0);}}return  false}}function Ik(e,t){e.split(t),e.setSelection(t.parent.nextSibling,0);}const Pk={insertParagraph:{isSoft:false},insertLineBreak:{isSoft:true}};class Vk extends zr{constructor(e){super(e);const t=this.document;let i=false;t.on("keydown",(e,t)=>{i=t.shiftKey;}),t.on("beforeinput",(s,o)=>{if(!this.isEnabled)return;let r=o.inputType;n.isSafari&&i&&"insertParagraph"==r&&(r="insertLineBreak");const a=o.domEvent,l=Pk[r];if(!l)return;const c=new Bo(t,"enter",o.targetRanges[0]);t.fire(c,new Hr(e,a,{isSoft:l.isSoft})),c.stop.called&&s.stop();});}observe(){}stopObserving(){}}class Rk extends Ms{static get pluginName(){return "Enter"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.editing.view,i=t.document,n=this.editor.t;t.addObserver(Vk),e.commands.add("enter",new Sk(e)),this.listenTo(i,"enter",(n,s)=>{i.isComposing||s.preventDefault(),s.isSoft||(e.execute("enter"),t.scrollToTheSelection());},{priority:"low"}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:n("Insert a hard break (a new paragraph)"),keystroke:"Enter"}]});}}class Ok extends Ns{execute(){const e=this.editor.model,t=e.document;e.change(i=>{!function(e,t,i){const n=i.isCollapsed,s=i.getFirstRange(),o=s.start.parent,r=s.end.parent,a=o==r;if(n){const n=Tk(e.schema,i.getAttributes());Bk(e,t,s.end),t.removeSelectionAttribute(i.getAttributeKeys()),t.setSelectionAttribute(n);}else {const n=!(s.start.isAtStart&&s.end.isAtEnd);e.deleteContent(i,{leaveUnmerged:n}),a?Bk(e,t,i.focus):n&&t.setSelection(r,0);}}(e,i,t.selection),this.fire("afterExecute",{writer:i});});}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=function(e,t){if(t.rangeCount>1)return  false;const i=t.anchor;if(!i||!e.checkChild(i,"softBreak"))return  false;const n=t.getFirstRange(),s=n.start.parent,o=n.end.parent;if((Lk(s,e)||Lk(o,e))&&s!==o)return  false;return  true}(e.schema,t.selection);}}function Bk(e,t,i){const n=t.createElement("softBreak");e.insertContent(n,i),t.setSelection(n,"after");}function Lk(e,t){return !e.is("rootElement")&&(t.isLimit(e)||Lk(e.parent,t))}class Mk extends Ms{static get pluginName(){return "ShiftEnter"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.model.schema,i=e.conversion,n=e.editing.view,s=n.document,o=this.editor.t;t.register("softBreak",{allowWhere:"$text",isInline:true}),i.for("upcast").elementToElement({model:"softBreak",view:"br"}),i.for("downcast").elementToElement({model:"softBreak",view:(e,{writer:t})=>t.createEmptyElement("br")}),n.addObserver(Vk),e.commands.add("shiftEnter",new Ok(e)),this.listenTo(s,"enter",(t,i)=>{s.isComposing||i.preventDefault(),i.isSoft&&(e.execute("shiftEnter"),n.scrollToTheSelection());},{priority:"low"}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:o("Insert a soft break (a <code>&lt;br&gt;</code> element)"),keystroke:"Shift+Enter"}]});}}class Fk extends Ns{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled();}execute(e={}){const t=this.editor.model,i=t.schema,n=t.document.selection,s=Array.from(n.getSelectedBlocks()),o=void 0===e.forceValue?!this.value:e.forceValue;t.change(e=>{if(o){const t=s.filter(e=>Nk(e)||zk(i,e));this._applyQuote(e,t);}else this._removeQuote(e,s.filter(Nk));});}_getValue(){const e=Cn(this.editor.model.document.selection.getSelectedBlocks());return !(!e||!Nk(e))}_checkEnabled(){if(this.value)return  true;const e=this.editor.model.document.selection,t=this.editor.model.schema,i=Cn(e.getSelectedBlocks());return !!i&&zk(t,i)}_removeQuote(e,t){Dk(e,t).reverse().forEach(t=>{if(t.start.isAtStart&&t.end.isAtEnd)return void e.unwrap(t.start.parent);if(t.start.isAtStart){const i=e.createPositionBefore(t.start.parent);return void e.move(t,i)}t.end.isAtEnd||e.split(t.end);const i=e.createPositionAfter(t.end.parent);e.move(t,i);});}_applyQuote(e,t){const i=[];Dk(e,t).reverse().forEach(t=>{let n=Nk(t.start);n||(n=e.createElement("blockQuote"),e.wrap(t,n)),i.push(n);}),i.reverse().reduce((t,i)=>t.nextSibling==i?(e.merge(e.createPositionAfter(t)),t):i);}}function Nk(e){return "blockQuote"==e.parent.name?e.parent:null}function Dk(e,t){let i,n=0;const s=[];for(;n<t.length;){const o=t[n],r=t[n+1];i||(i=e.createPositionBefore(o)),r&&o.nextSibling==r||(s.push(e.createRange(i,e.createPositionAfter(o))),i=null),n++;}return s}function zk(e,t){const i=e.checkChild(t.parent,"blockQuote"),n=e.checkChild(["$root","blockQuote"],t);return i&&n}class Hk extends Ms{static get pluginName(){return "BlockQuoteEditing"}static get isOfficialPlugin(){return  true}static get requires(){return [Rk,py]}init(){const e=this.editor,t=e.model.schema;e.commands.add("blockQuote",new Fk(e)),t.register("blockQuote",{inheritAllFrom:"$container"}),e.conversion.elementToElement({model:"blockQuote",view:"blockquote"}),e.model.document.registerPostFixer(i=>{const n=e.model.document.differ.getChanges();for(const e of n)if("insert"==e.type){const n=e.position.nodeAfter;if(!n)continue;if(n.is("element","blockQuote")&&n.isEmpty)return i.remove(n),true;if(n.is("element","blockQuote")&&!t.checkChild(e.position,n))return i.unwrap(n),true;if(n.is("element")){const e=i.createRangeIn(n);for(const n of e.getItems())if(n.is("element","blockQuote")&&!t.checkChild(i.createPositionBefore(n),n))return i.unwrap(n),true}}else if("remove"==e.type){const t=e.position.parent;if(t.is("element","blockQuote")&&t.isEmpty)return i.remove(t),true}return  false});const i=this.editor.editing.view.document,n=e.model.document.selection,s=e.commands.get("blockQuote");this.listenTo(i,"enter",(t,i)=>{if(!n.isCollapsed||!s.value)return;n.getLastPosition().parent.isEmpty&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),i.preventDefault(),t.stop());},{context:"blockquote"}),this.listenTo(i,"delete",(t,i)=>{if("backward"!=i.direction||!n.isCollapsed||!s.value)return;const o=n.getLastPosition().parent;o.isEmpty&&!o.previousSibling&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),i.preventDefault(),t.stop());},{context:"blockquote"});}}class qk extends Ms{static get pluginName(){return "BlockQuoteUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor;e.ui.componentFactory.add("blockQuote",()=>{const e=this._createButton(Bp);return e.set({tooltip:true}),e}),e.ui.componentFactory.add("menuBar:blockQuote",()=>{const e=this._createButton(Jp);return e.set({role:"menuitemcheckbox"}),e});}_createButton(e){const t=this.editor,i=t.locale,n=t.commands.get("blockQuote"),s=new e(t.locale),o=i.t;return s.set({label:o("Block quote"),icon:Of,isToggleable:true}),s.bind("isEnabled").to(n,"isEnabled"),s.bind("isOn").to(n,"value"),this.listenTo(s,"execute",()=>{t.execute("blockQuote"),t.editing.view.focus();}),s}}class Uk extends Ms{static get requires(){return [Hk,qk]}static get pluginName(){return "BlockQuote"}static get isOfficialPlugin(){return  true}}class jk extends(z()){_stack=[];add(e,t){const i=this._stack,n=i[0];this._insertDescriptor(e);const s=i[0];n===s||$k(n,s)||this.fire("change:top",{oldDescriptor:n,newDescriptor:s,writer:t});}remove(e,t){const i=this._stack,n=i[0];this._removeDescriptor(e);const s=i[0];n===s||$k(n,s)||this.fire("change:top",{oldDescriptor:n,newDescriptor:s,writer:t});}_insertDescriptor(e){const t=this._stack,i=t.findIndex(t=>t.id===e.id);if($k(e,t[i]))return;i>-1&&t.splice(i,1);let n=0;for(;t[n]&&Wk(t[n],e);)n++;t.splice(n,0,e);}_removeDescriptor(e){const t=this._stack,i=t.findIndex(t=>t.id===e);i>-1&&t.splice(i,1);}}function $k(e,t){return e&&t&&e.priority==t.priority&&Gk(e.classes)==Gk(t.classes)}function Wk(e,t){return e.priority>t.priority||!(e.priority<t.priority)&&Gk(e.classes)>Gk(t.classes)}function Gk(e){return Array.isArray(e)?e.sort().join(","):e}const Kk="ck-widget",Jk="ck-widget_selected";function Qk(e){return !!e.is("element")&&!!e.getCustomProperty("widget")}function Yk(e,t,i={}){if(!e.is("containerElement"))throw new I("widget-to-widget-wrong-element-type",null,{element:e});return t.setAttribute("contenteditable","false",e),t.addClass(Kk,e),t.setCustomProperty("widget",true,e),e.getFillerOffset=rC,t.setCustomProperty("widgetLabel",[],e),i.label&&tC(e,i.label),i.hasSelectionHandle&&function(e,t){const i=t.createUIElement("div",{class:"ck ck-widget__selection-handle"},function(e){const t=this.toDomElement(e),i=new Rp;return i.set("content",zm),i.render(),t.appendChild(i.element),t});t.insert(t.createPositionAt(e,0),i),t.addClass(["ck-widget_with-selection-handle"],e);}(e,t),eC(e,t),e}function Zk(e,t,i){if(t.classes&&i.addClass(pn(t.classes),e),t.attributes)for(const n in t.attributes)i.setAttribute(n,t.attributes[n],e);}function Xk(e,t,i){if(t.classes&&i.removeClass(pn(t.classes),e),t.attributes)for(const n in t.attributes)i.removeAttribute(n,e);}function eC(e,t,i=Zk,n=Xk){const s=new jk;s.on("change:top",(t,s)=>{s.oldDescriptor&&n(e,s.oldDescriptor,s.writer),s.newDescriptor&&i(e,s.newDescriptor,s.writer);});t.setCustomProperty("addHighlight",(e,t,i)=>s.add(t,i),e),t.setCustomProperty("removeHighlight",(e,t,i)=>s.remove(t,i),e);}function tC(e,t){e.getCustomProperty("widgetLabel").push(t);}function iC(e){return e.getCustomProperty("widgetLabel").reduce((e,t)=>"function"==typeof t?e?e+". "+t():t():e?e+". "+t:t,"")}function nC(e,t,i={}){return t.addClass(["ck-editor__editable","ck-editor__nested-editable"],e),false!==i.withAriaRole&&t.setAttribute("role","textbox",e),e.isReadOnly||t.setAttribute("tabindex","-1",e),i.label&&t.setAttribute("aria-label",i.label,e),t.setAttribute("contenteditable",e.isReadOnly?"false":"true",e),e.on("change:isReadOnly",(i,n,s)=>{t.setAttribute("contenteditable",s?"false":"true",e),s?t.removeAttribute("tabindex",e):t.setAttribute("tabindex","-1",e);}),e.on("change:isFocused",(i,n,s)=>{s?t.addClass("ck-editor__nested-editable_focused",e):t.removeClass("ck-editor__nested-editable_focused",e);}),eC(e,t),e}function sC(e,t){const i=e.getSelectedElement();if(i){const n=gC(e);if(n)return t.createRange(t.createPositionAt(i,n))}return t.schema.findOptimalInsertionRange(e)}function oC(e,t){return (i,n)=>{const{mapper:s,viewPosition:o}=n,r=s.findMappedViewAncestor(o);if(!t(r))return;const a=s.toModelElement(r);n.modelPosition=e.createPositionAt(a,o.isAtStart?"before":"after");}}function rC(){return null}function aC(e){const t=e=>{const{width:t,paddingLeft:i,paddingRight:n}=e.ownerDocument.defaultView.getComputedStyle(e);return parseFloat(t)-(parseFloat(i)||0)-(parseFloat(n)||0)},i=e.parentElement;if(!i)return 0;let n=t(i);let s=0,o=i;for(;isNaN(n);){if(o=o.parentElement,++s>5)return 0;n=t(o);}return n}function lC(e,t=new Ci(e)){const i=aC(e);return i?t.width/i*100:0}const cC="widget-type-around";function uC(e,t,i){return !!e&&Qk(e)&&!i.isInline(t)}function dC(e){return e.closest(".ck-widget__type-around__button")}function hC(e){return e.classList.contains("ck-widget__type-around__button_before")?"before":"after"}function mC(e,t){const i=e.closest(".ck-widget");return t.mapDomToView(i)}function gC(e){return e.getAttribute(cC)}const fC=["before","after"],pC=(new DOMParser).parseFromString(Df,"image/svg+xml").firstChild,bC="ck-widget__type-around_disabled";class wC extends Ms{_currentFakeCaretModelElement=null;static get pluginName(){return "WidgetTypeAround"}static get isOfficialPlugin(){return  true}static get requires(){return [Rk,py]}init(){const e=this.editor,t=e.editing.view;this.on("change:isEnabled",(i,n,s)=>{t.change(e=>{for(const i of t.document.roots)s?e.removeClass(bC,i):e.addClass(bC,i);}),s||e.model.change(e=>{e.removeSelectionAttribute(cC);});}),this._enableTypeAroundUIInjection(),this._enableInsertingParagraphsOnButtonClick(),this._enableInsertingParagraphsOnEnterKeypress(),this._enableInsertingParagraphsOnTypingKeystroke(),this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(),this._enableDeleteIntegration(),this._enableInsertContentIntegration(),this._enableInsertObjectIntegration(),this._enableDeleteContentIntegration();}destroy(){super.destroy(),this._currentFakeCaretModelElement=null;}_insertParagraph(e,t){const i=this.editor,n=i.editing.view,s=i.model.schema.getAttributesWithProperty(e,"copyOnReplace",true);i.execute("insertParagraph",{position:i.model.createPositionAt(e,t),attributes:s}),n.focus(),n.scrollToTheSelection();}_listenToIfEnabled(e,t,i,n){this.listenTo(e,t,(...e)=>{this.isEnabled&&i(...e);},n);}_insertParagraphAccordingToFakeCaretPosition(){const e=this.editor.model.document.selection,t=gC(e);if(!t)return  false;const i=e.getSelectedElement();return this._insertParagraph(i,t),true}_enableTypeAroundUIInjection(){const e=this.editor,t=e.model.schema,i=e.locale.t,n={before:i("Insert paragraph before block"),after:i("Insert paragraph after block")};e.editing.downcastDispatcher.on("insert",(e,s,o)=>{const r=o.mapper.toViewElement(s.item);if(r&&uC(r,s.item,t)){!function(e,t,i){const n=e.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},function(e){const i=this.toDomElement(e);return function(e,t){for(const i of fC){const n=new es({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${i}`],title:t[i],"aria-hidden":"true"},children:[e.ownerDocument.importNode(pC,true)]});e.appendChild(n.render());}}(i,t),function(e){const t=new es({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});e.appendChild(t.render());}(i),i});e.insert(e.createPositionAt(i,"end"),n);}(o.writer,n,r);r.getCustomProperty("widgetLabel").push(()=>this.isEnabled?i("Press Enter to type after or press Shift + Enter to type before the widget"):"");}},{priority:"low"});}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const e=this.editor,t=e.model,i=t.document.selection,n=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:[Qk,"$text"],priority:"high"}),this._listenToIfEnabled(i,"change:range",(t,i)=>{i.directChange&&e.model.change(e=>{e.removeSelectionAttribute(cC);});}),this._listenToIfEnabled(t.document,"change:data",()=>{const t=i.getSelectedElement();if(t){if(uC(e.editing.mapper.toViewElement(t),t,n))return}e.model.change(e=>{e.removeSelectionAttribute(cC);});}),this._listenToIfEnabled(e.editing.downcastDispatcher,"selection",(e,t,i)=>{const s=i.writer;if(this._currentFakeCaretModelElement){const e=i.mapper.toViewElement(this._currentFakeCaretModelElement);e&&(s.removeClass(fC.map(o),e),this._currentFakeCaretModelElement=null);}const r=t.selection.getSelectedElement();if(!r)return;const a=i.mapper.toViewElement(r);if(!uC(a,r,n))return;const l=gC(t.selection);l&&(s.addClass(o(l),a),this._currentFakeCaretModelElement=r);}),this._listenToIfEnabled(e.ui.focusTracker,"change:isFocused",(t,i,n)=>{n||e.model.change(e=>{e.removeSelectionAttribute(cC);});});}_handleArrowKeyPress(e,t){const i=this.editor,n=i.model,s=n.document.selection,o=n.schema,r=i.editing.view;if(t.shiftKey)return;const a=hn(t.keyCode,i.locale.contentLanguageDirection),l=r.document.selection.getSelectedElement();let c;uC(l,i.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,i=gC(t.document.selection);return t.change(t=>{if(!i)return t.setSelectionAttribute(cC,e?"after":"before"),true;if(!(i===(e?"after":"before")))return t.removeSelectionAttribute(cC),true;return  false})}_handleArrowKeyPressWhenSelectionNextToAWidget(e){const t=this.editor,i=t.model,n=i.schema,s=t.plugins.get("Widget"),o=s._getObjectElementNextToSelection(e);return !!uC(t.editing.mapper.toViewElement(o),o,n)&&(i.change(t=>{s._setSelectionOverElement(o),t.setSelectionAttribute(cC,e?"before":"after");}),true)}_handleArrowKeyPressWhenNonCollapsedSelection(e){const t=this.editor,i=t.model,n=i.schema,s=t.editing.mapper,o=i.document.selection,r=e?o.getLastPosition().nodeBefore:o.getFirstPosition().nodeAfter;return !!uC(s.toViewElement(r),r,n)&&(i.change(t=>{t.setSelection(r,"on"),t.setSelectionAttribute(cC,e?"after":"before");}),true)}_enableInsertingParagraphsOnButtonClick(){const e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,"mousedown",(i,n)=>{const s=dC(n.domTarget);if(!s)return;const o=hC(s),r=mC(s,t.domConverter),a=e.editing.mapper.toModelElement(r);this._insertParagraph(a,o),n.preventDefault(),i.stop();});}_enableInsertingParagraphsOnEnterKeypress(){const e=this.editor,t=e.model.document.selection,i=e.editing.view;this._listenToIfEnabled(i.document,"enter",(i,n)=>{if("atTarget"!=i.eventPhase)return;const s=t.getSelectedElement(),o=e.editing.mapper.toViewElement(s),r=e.model.schema;let a;this._insertParagraphAccordingToFakeCaretPosition()?a=true:uC(o,s,r)&&(this._insertParagraph(s,n.isSoft?"before":"after"),a=true),a&&(n.preventDefault(),i.stop());},{context:Qk});}_enableInsertingParagraphsOnTypingKeystroke(){const e=this.editor.editing.view.document;this._listenToIfEnabled(e,"insertText",(t,i)=>{this._insertParagraphAccordingToFakeCaretPosition()&&(i.selection=e.selection);},{priority:"high"}),n.isAndroid?this._listenToIfEnabled(e,"keydown",(e,t)=>{229==t.keyCode&&this._insertParagraphAccordingToFakeCaretPosition();}):this._listenToIfEnabled(e,"compositionstart",()=>{this._insertParagraphAccordingToFakeCaretPosition();},{priority:"highest"});}_enableDeleteIntegration(){const e=this.editor,t=e.editing.view,i=e.model,n=i.schema;this._listenToIfEnabled(t.document,"delete",(t,s)=>{if("atTarget"!=t.eventPhase)return;const o=gC(i.document.selection);if(!o)return;const r=s.direction,a=i.document.selection.getSelectedElement(),l="forward"==r;if("before"===o===l)e.execute("delete",{selection:i.createSelection(a,"on")});else {const t=n.getNearestSelectionRange(i.createPositionAt(a,o),r);if(t)if(t.isCollapsed){const s=i.createSelection(t.start);if(i.modifySelection(s,{direction:r}),s.focus.isEqual(t.start)){const e=function(e,t){let i=t;for(const n of t.getAncestors({parentFirst:true})){if(n.childCount>1||e.isLimit(n))break;i=n;}return i}(n,t.start.parent);i.deleteContent(i.createSelection(e,"on"),{doNotAutoparagraph:true});}else i.change(i=>{i.setSelection(t),e.execute(l?"deleteForward":"delete");});}else i.change(i=>{i.setSelection(t),e.execute(l?"deleteForward":"delete");});}s.preventDefault(),t.stop();},{context:Qk});}_enableInsertContentIntegration(){const e=this.editor,t=this.editor.model,i=t.document.selection;this._listenToIfEnabled(e.model,"insertContent",(e,[n,s])=>{if(s&&!s.is("documentSelection"))return;const o=gC(i);return o?(e.stop(),t.change(e=>{const s=i.getSelectedElement(),r=t.createPositionAt(s,o),a=e.createSelection(r),l=t.insertContent(n,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,i)=>{const[,n,s={}]=i;if(n&&!n.is("documentSelection"))return;const o=gC(t);o&&(s.findOptimalPosition=o,i[3]=s);},{priority:"high"});}_enableDeleteContentIntegration(){const e=this.editor,t=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"deleteContent",(e,[i])=>{if(i&&!i.is("documentSelection"))return;gC(t)&&e.stop();},{priority:"high"});}}function vC(e){const t=e.model;return (i,n)=>{const s=n.keyCode==on.arrowup,o=n.keyCode==on.arrowdown,r=n.shiftKey,a=t.document.selection;if(!s&&!o)return;const l=o,c=function(e,t,i){const n=e.model;if(i){const e=t.focus,i=_C(n,e,"forward");if(!i)return;const s=n.createRange(e,i),o=yC(n.schema,s,"backward");if(o)return n.createRange(e,o)}else {const e=t.focus,i=_C(n,e,"backward");if(!i)return;const s=n.createRange(i,e),o=yC(n.schema,s,"forward");if(o)return n.createRange(o,e)}}(e,a,l);if(c){if(c.isCollapsed){if(a.isCollapsed)return;if(r)return}(c.isCollapsed||function(e,t,i){const n=e.model,s=e.view.domConverter;if(i){const e=n.createSelection(t.start);n.modifySelection(e),e.focus.isAtEnd||t.start.isEqual(e.focus)||(t=n.createRange(e.focus,t.end));}const o=e.mapper.toViewRange(t),r=s.viewRangeToDom(o),a=Ci.getDomRangeRects(r);let l;for(const e of a)if(void 0!==l){if(Math.round(e.top)>=l)return  false;l=Math.max(l,Math.round(e.bottom));}else l=Math.round(e.bottom);return  true}(e,c,l))&&(t.change(e=>{const i=l?c.end:c.start;if(r){const n=t.createSelection(a.anchor);n.setFocus(i),e.setSelection(n);}else e.setSelection(i);}),i.stop(),n.preventDefault(),n.stopPropagation());}}}function _C(e,t,i){const n=e.schema,s=e.createRangeIn(t.root),o="forward"==i?"elementStart":"elementEnd";for(const{previousPosition:e,item:r,type:a}of s.getWalker({startPosition:t,direction:i})){if(n.isLimit(r)&&!n.isInline(r))return e;if(a==o&&n.isBlock(r))return null}return null}function yC(e,t,i){const n="backward"==i?t.end:t.start;if(e.checkChild(n,"$text"))return n;for(const{nextPosition:n}of t.getWalker({direction:i}))if(e.checkChild(n,"$text"))return n}class kC extends Ms{_previouslySelected=new Set;static get pluginName(){return "Widget"}static get isOfficialPlugin(){return  true}static get requires(){return [wC,py]}init(){const e=this.editor,t=e.editing.view,i=t.document,n=e.t;this.editor.editing.downcastDispatcher.on("selection",(t,i,n)=>{const s=n.writer,o=i.selection;if(o.isCollapsed)return;const r=o.getSelectedElement();if(!r)return;const a=e.editing.mapper.toViewElement(r);Qk(a)&&n.consumable.consume(o,"selection")&&s.setSelection(s.createRangeOn(a),{fake:true,label:iC(a)});}),this.editor.editing.downcastDispatcher.on("selection",(e,t,i)=>{this._clearPreviouslySelectedWidgets(i.writer);const n=i.writer,s=n.document.selection;let o=null;for(const e of s.getRanges())for(const t of e){const e=t.item;Qk(e)&&!CC(e,o)&&(n.addClass(Jk,e),this._previouslySelected.add(e),o=e);}},{priority:"low"}),t.addObserver(_u),t.addObserver(ku),this.listenTo(i,"mousedown",(...e)=>this._onMousedown(...e)),this.listenTo(i,"pointerdown",(...e)=>this._onPointerdown(...e)),this.listenTo(i,"arrowKey",(...e)=>{this._handleSelectionChangeOnArrowKeyPress(...e);},{context:[Qk,"$text"]}),this.listenTo(i,"arrowKey",(...e)=>{this._preventDefaultOnArrowKeyPress(...e);},{context:"$root"}),this.listenTo(i,"arrowKey",vC(this.editor.editing),{context:"$text"}),this.listenTo(i,"delete",(e,t)=>{this._handleDelete("forward"==t.direction)&&(t.preventDefault(),e.stop());},{context:"$root"}),this.listenTo(i,"tab",(e,i)=>{this._selectNextEditable(i.shiftKey?"backward":"forward")&&(t.scrollToTheSelection(),i.preventDefault(),e.stop());},{context:e=>Qk(e)||e.is("editableElement"),priority:"low"}),this.listenTo(i,"keydown",(e,t)=>{t.keystroke==on.esc&&this._selectAncestorWidget()&&(t.preventDefault(),e.stop());},{context:e=>e.is("editableElement"),priority:"low"}),e.accessibility.addKeystrokeInfoGroup({id:"widget",label:n("Keystrokes that can be used when a widget is selected (for example: image, table, etc.)"),keystrokes:[{label:n("Move focus from an editable area back to the parent widget"),keystroke:"Esc"},{label:n("Insert a new paragraph directly after a widget"),keystroke:"Enter"},{label:n("Insert a new paragraph directly before a widget"),keystroke:"Shift+Enter"},{label:n("Move the caret to allow typing directly before a widget"),keystroke:[["arrowup"],["arrowleft"]]},{label:n("Move the caret to allow typing directly after a widget"),keystroke:[["arrowdown"],["arrowright"]]}]});}_onMousedown(e,t){const i=t.target;i&&t.domEvent.detail>=3&&this._selectBlockContent(i)&&t.preventDefault();}_onPointerdown(e,t){if(!t.domEvent.isPrimary)return;const i=this.editor,s=i.editing.view,o=s.document;let r=t.target;if(!r)return;if(!Qk(r)){const e=function(e){let t=e;for(;t;){if(t.is("editableElement")||Qk(t))return t;t=t.parent;}return null}(r);if(!e)return;if(Qk(e))r=e;else {const e=function(e,t){const i=pi(t.domEvent);let n=null;n=i?e.domConverter.domRangeToView(i):e.createRange(e.createPositionAt(t.target,0));if(!n)return null;const s=n.start;if(!s.parent)return null;let o=s.parent;s.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}(s,t);if(!e||!Qk(e))return;r=e;}}(n.isAndroid||n.isiOS)&&t.preventDefault(),o.isFocused||s.focus();const a=i.editing.mapper.toModelElement(r);this._setSelectionOverElement(a);}_selectBlockContent(e){const t=this.editor,i=t.model,n=t.editing.mapper,s=i.schema,o=n.findMappedViewAncestor(this.editor.editing.view.createPositionAt(e,0)),r=function(e,t){for(const i of e.getAncestors({includeSelf:true,parentFirst:true})){if(t.checkChild(i,"$text"))return i;if(t.isLimit(i)&&!t.isObject(i))break}return null}(n.toModelElement(o),i.schema);return !!r&&(i.change(e=>{const t=s.isLimit(r)?null:function(e,t){const i=new sa({startPosition:e});for(const{item:e}of i){if(t.isLimit(e)||!e.is("element"))return null;if(t.checkChild(e,"$text"))return e}return null}(e.createPositionAfter(r),s),i=e.createPositionAt(r,0),n=t?e.createPositionAt(t,0):e.createPositionAt(r,"end");e.setSelection(e.createRange(i,n));}),true)}_handleSelectionChangeOnArrowKeyPress(e,t){const i=t.keyCode,n=this.editor.model,s=n.schema,o=n.document.selection,r=o.getSelectedElement(),a=dn(i,this.editor.locale.contentLanguageDirection),l="down"==a||"right"==a,c="up"==a||"down"==a;if(!t.shiftKey&&!o.isCollapsed){if(function(e,t){const i=e.getFirstPosition(),n=e.getLastPosition(),s=i.nodeAfter,o=n.nodeBefore;return !!s&&t.isObject(s)||!!o&&t.isObject(o)}(o,s)){const i=l?o.getLastPosition():o.getFirstPosition(),r=s.getNearestSelectionRange(i,l?"forward":"backward");r&&(n.change(e=>{e.setSelection(r);}),t.preventDefault(),e.stop());}return}const u=function(e,t){const i=e.document.selection,n=i.getSelectedElement(),s=gC(i);if(n&&"before"==s)return e.createSelection(n,"before");if(n&&"after"==s)return e.createSelection(n,"after");return e.createSelection(i.getRanges(),{backward:n&&e.schema.isObject(n)?!t:i.isBackward})}(n,l),d=n.createSelection(u);if(n.modifySelection(d,{direction:l?"forward":"backward"}),d.isEqual(u))return;d.focus.isTouching(u.focus)&&s.checkChild(d.focus.parent,"$text")&&(l?!d.focus.isAtEnd:!d.focus.isAtStart)&&n.modifySelection(d,{direction:l?"forward":"backward"});const h=l?u.focus.nodeBefore:u.focus.nodeAfter,m=d.focus.nodeBefore,g=d.focus.nodeAfter,f=l?m:g;if(t.shiftKey)(r&&s.isObject(r)||f&&s.isObject(f)||h&&s.isObject(h))&&(n.change(e=>{e.setSelection(d);}),t.preventDefault(),e.stop());else if(f&&s.isObject(f)){if(s.isInline(f)&&c)return;n.change(e=>{e.setSelection(f,"on");}),t.preventDefault(),e.stop();}}_preventDefaultOnArrowKeyPress(e,t){const i=this.editor.model,n=i.schema,s=i.document.selection.getSelectedElement();s&&n.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 i=this._getObjectElementNextToSelection(e);return i?(this.editor.model.change(e=>{let n=t.anchor.parent;for(;n.isEmpty;){const t=n;n=t.parent,e.remove(t);}this._setSelectionOverElement(i);}),true):void 0}_setSelectionOverElement(e){this.editor.model.change(t=>{t.setSelection(t.createRangeOn(e));});}_getObjectElementNextToSelection(e){const t=this.editor.model,i=t.schema,n=t.document.selection,s=t.createSelection(n);if(t.modifySelection(s,{direction:e?"forward":"backward"}),s.isEqual(n))return null;const o=e?s.focus.nodeBefore:s.focus.nodeAfter;return o&&i.isObject(o)?o:null}_clearPreviouslySelectedWidgets(e){for(const t of this._previouslySelected)e.removeClass(Jk,t);this._previouslySelected.clear();}_selectNextEditable(e){const t=this.editor.editing,i=t.view,n=this.editor.model,s=i.document.selection,o=n.document.selection;let r;if(o.rangeCount>1){const i=o.isBackward?o.getFirstRange():o.getLastRange();r=t.mapper.toViewPosition("forward"==e?i.end:i.start);}else r="forward"==e?s.getFirstPosition():s.getLastPosition();const a=this._findNextFocusRange(r,e);return !!a&&(n.change(e=>{e.setSelection(a);}),true)}_findNextFocusRange(e,t){const i=this.editor.editing,n=i.view,s=this.editor.model,o=n.document.selection,r=o.editableElement,a=r.getPath();let l=o.getSelectedElement();l&&!Qk(l)&&(l=null);const c="forward"==t?n.createRange(e,n.createPositionAt(e.root,"end")):n.createRange(n.createPositionAt(e.root,0),e);for(const{nextPosition:e}of c.getWalker({direction:t})){const n=e.parent;if(Qk(n)&&n!=l){const e=i.mapper.toModelElement(n);if(!s.schema.isBlock(e))continue;if("extension"!=ei(a,n.getPath()))return s.createRangeOn(e)}else if(n.is("editableElement")){if(n==r&&!l)continue;const o=i.mapper.toModelPosition(e),c=s.schema.getNearestSelectionRange(o,t);if(!c)continue;return n==r&&l?c:"extension"!=ei(a,n.getPath())?s.createRangeIn(s.schema.getLimitElement(c)):c}}return null}_selectAncestorWidget(){const e=this.editor,t=e.editing.mapper,i=e.editing.view.document.selection.getFirstPosition().parent,n=(i.is("$text")?i.parent:i).findAncestor(Qk);if(!n)return  false;const s=t.toModelElement(n);return !!s&&(e.model.change(e=>{e.setSelection(s,"on");}),true)}}function CC(e,t){return !!t&&Array.from(e.getAncestors()).includes(t)}class xC extends Ms{_toolbarDefinitions=new Map;_balloon;static get requires(){return [i_]}static get pluginName(){return "WidgetToolbarRepository"}static get isOfficialPlugin(){return  true}init(){const e=this.editor;if(e.plugins.has("BalloonToolbar")){const t=e.plugins.get("BalloonToolbar");this.listenTo(t,"show",t=>{(function(e){const t=e.getSelectedElement();return !(!t||!Qk(t))})(e.editing.view.document.selection)&&t.stop();},{priority:"high"});}this._balloon=this.editor.plugins.get("ContextualBalloon"),this.on("change:isEnabled",()=>{this._updateToolbarsVisibility();}),this.listenTo(e.ui,"update",()=>{this._updateToolbarsVisibility();}),this.listenTo(e.ui.focusTracker,"change:isFocused",()=>{this._updateToolbarsVisibility();},{priority:"low"});}destroy(){super.destroy();for(const e of this._toolbarDefinitions.values())e.view.destroy();}register(e,{ariaLabel:t,items:i,getRelatedElement:n,balloonClassName:s="ck-toolbar-container",positions:o}){if(!i.length)return void P("widget-toolbar-no-items",{toolbarId:e});const r=this.editor,a=r.t,l=new mw(r.locale);if(l.ariaLabel=t||a("Widget toolbar"),this._toolbarDefinitions.has(e))throw new I("widget-toolbar-duplicated",this,{toolbarId:e});const c={view:l,getRelatedElement:n,balloonClassName:s,itemsConfig:i,positions:o,initialized:false};r.ui.addToolbar(l,{isContextual:true,beforeFocus:()=>{const e=n(r.editing.view.document.selection);e&&this._showToolbar(c,e);},afterBlur:()=>{this._hideToolbar(c);}}),this._toolbarDefinitions.set(e,c);}_updateToolbarsVisibility(){let e=0,t=null,i=null;for(const n of this._toolbarDefinitions.values()){const s=n.getRelatedElement(this.editor.editing.view.document.selection);if(this.isEnabled&&s)if(this.editor.ui.focusTracker.isFocused){const o=s.getAncestors().length;o>e&&(e=o,t=s,i=n);}else this._isToolbarVisible(n)&&this._hideToolbar(n);else this._isToolbarInBalloon(n)&&this._hideToolbar(n);}i&&this._showToolbar(i,t);}_hideToolbar(e){this._balloon.remove(e.view),this.stopListening(this._balloon,"change:visibleView");}_showToolbar(e,t){this._isToolbarVisible(e)?AC(this.editor,t,e.positions):this._isToolbarInBalloon(e)||(e.initialized||(e.initialized=true,e.view.fillFromConfig(e.itemsConfig,this.editor.ui.componentFactory)),this._balloon.add({view:e.view,position:EC(this.editor,t,e.positions),balloonClassName:e.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",()=>{for(const t of this._toolbarDefinitions.values())if(this._isToolbarVisible(t)){const i=t.getRelatedElement(this.editor.editing.view.document.selection);AC(this.editor,i,e.positions);}}));}_isToolbarVisible(e){return this._balloon.visibleView===e.view}_isToolbarInBalloon(e){return this._balloon.hasView(e.view)}}function AC(e,t,i){const n=e.plugins.get("ContextualBalloon"),s=EC(e,t,i);n.updatePosition(s);}function EC(e,t,i){const n=e.editing.view,s=eb.defaultPositions;return {target:n.domConverter.mapViewToDom(t),positions:i||[s.northArrowSouth,s.northArrowSouthWest,s.northArrowSouthEast,s.southArrowNorth,s.southArrowNorthWest,s.southArrowNorthEast,s.viewportStickyNorth]}}class TC extends($t()){_referenceCoordinates;_options;_originalWidth;_originalHeight;_originalWidthPercents;_aspectRatio;constructor(e){super(),this.set("activeHandlePosition",null),this.set("proposedWidthPercents",null),this.set("proposedWidth",null),this.set("proposedHeight",null),this.set("proposedHandleHostWidth",null),this.set("proposedHandleHostHeight",null),this._options=e,this._referenceCoordinates=null;}get originalWidth(){return this._originalWidth}get originalHeight(){return this._originalHeight}get originalWidthPercents(){return this._originalWidthPercents}get aspectRatio(){return this._aspectRatio}begin(e,t,i){const n=new Ci(t);this.activeHandlePosition=function(e){const t=["top-left","top-right","bottom-right","bottom-left"];for(const i of t)if(e.classList.contains(SC(i)))return i}(e),this._referenceCoordinates=function(e,t){const i=new Ci(e),n=t.split("-"),s={x:"right"==n[1]?i.right:i.left,y:"bottom"==n[0]?i.bottom:i.top};return s.x+=e.ownerDocument.defaultView.scrollX,s.y+=e.ownerDocument.defaultView.scrollY,s}(t,function(e){const t=e.split("-"),i={top:"bottom",bottom:"top",left:"right",right:"left"};return `${i[t[0]]}-${i[t[1]]}`}(this.activeHandlePosition)),this._originalWidth=n.width,this._originalHeight=n.height,this._aspectRatio=n.width/n.height;const s=i.style.width;s&&s.match(/^\d+(\.\d*)?%$/)?this._originalWidthPercents=parseFloat(s):this._originalWidthPercents=lC(i,n);}update(e){this.proposedWidth=e.width,this.proposedHeight=e.height,this.proposedWidthPercents=e.widthPercents,this.proposedHandleHostWidth=e.handleHostWidth,this.proposedHandleHostHeight=e.handleHostHeight;}}function SC(e){return `ck-widget__resizer__handle-${e}`}class IC extends Cs{constructor(){super();const e=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-size-view",e.to("_viewPosition",e=>e?`ck-orientation-${e}`:"")],style:{display:e.if("_isVisible","none",e=>!e)}},children:[{text:e.to("_label")}]});}_bindToState(e,t){this.bind("_isVisible").to(t,"proposedWidth",t,"proposedHeight",(e,t)=>null!==e&&null!==t),this.bind("_label").to(t,"proposedHandleHostWidth",t,"proposedHandleHostHeight",t,"proposedWidthPercents",(t,i,n)=>"px"===e.unit?`${t}×${i}`:`${n}%`),this.bind("_viewPosition").to(t,"activeHandlePosition",t,"proposedHandleHostWidth",t,"proposedHandleHostHeight",(e,t,i)=>t<50||i<50?"above-center":e);}_dismiss(){this.unbind(),this._isVisible=false;}}class PC extends($t()){_state;_sizeView;_options;_viewResizerWrapper=null;_initialViewWidth;constructor(e){super(),this._options=e,this.set("isEnabled",true),this.set("isSelected",false),this.bind("isVisible").to(this,"isEnabled",this,"isSelected",(e,t)=>e&&t),this.decorate("begin"),this.decorate("cancel"),this.decorate("commit"),this.decorate("updateSize"),this.on("commit",e=>{this.state.proposedWidth||this.state.proposedWidthPercents||(this._cleanup(),e.stop());},{priority:"high"});}get state(){return this._state}show(){this._options.editor.editing.view.change(e=>{e.removeClass("ck-hidden",this._viewResizerWrapper);});}hide(){this._options.editor.editing.view.change(e=>{e.addClass("ck-hidden",this._viewResizerWrapper);});}attach(){const e=this,t=this._options.viewElement;this._options.editor.editing.view.change(i=>{const n=i.createUIElement("div",{class:"ck ck-reset_all ck-widget__resizer"},function(t){const i=this.toDomElement(t);return e._appendHandles(i),e._appendSizeUI(i),i});i.insert(i.createPositionAt(t,"end"),n),i.addClass("ck-widget_with-resizer",t),this._viewResizerWrapper=n,this.isVisible||this.hide();}),this.on("change:isVisible",()=>{this.isVisible?(this.show(),this.redraw()):this.hide();});}begin(e){this._state=new TC(this._options),this._sizeView._bindToState(this._options,this.state),this._initialViewWidth=this._options.viewElement.getStyle("width"),this.state.begin(e,this._getHandleHost(),this._getResizeHost());}updateSize(e){const t=this._proposeNewSize(e);this._options.editor.editing.view.change(e=>{const i=this._options.unit||"%",n=("%"===i?t.widthPercents:t.width)+i;e.setStyle("width",n,this._options.viewElement);});const i=this._getHandleHost(),n=new Ci(i),s=Math.round(n.width),o=Math.round(n.height),r=new Ci(i);t.width=Math.round(r.width),t.height=Math.round(r.height),this.redraw(n),this.state.update({...t,handleHostWidth:s,handleHostHeight:o});}commit(){const e=this._options.unit||"%",t=("%"===e?this.state.proposedWidthPercents:this.state.proposedWidth)+e;this._options.editor.editing.view.change(()=>{this._cleanup(),this._options.onCommit(t);});}cancel(){this._cleanup();}destroy(){this.cancel();}redraw(e){const t=this._domResizerWrapper;if(!function(e){return e&&e.ownerDocument&&e.ownerDocument.contains(e)}(t))return;const i=t.parentElement,n=this._getHandleHost(),s=this._viewResizerWrapper,o=[s.getStyle("width"),s.getStyle("height"),s.getStyle("left"),s.getStyle("top")];let r;if(i.isSameNode(n)){const t=e||new Ci(n);r=[t.width+"px",t.height+"px",void 0,void 0];}else r=[n.offsetWidth+"px",n.offsetHeight+"px",n.offsetLeft+"px",n.offsetTop+"px"];"same"!==ei(o,r)&&this._options.editor.editing.view.change(e=>{e.setStyle({width:r[0],height:r[1],left:r[2],top:r[3]},s);});}containsHandle(e){return this._domResizerWrapper.contains(e)}static isResizeHandle(e){return e.classList.contains("ck-widget__resizer__handle")}_cleanup(){this._sizeView._dismiss();this._options.editor.editing.view.change(e=>{e.setStyle("width",this._initialViewWidth,this._options.viewElement);});}_proposeNewSize(e){const t=this.state,i={x:(n=e).pageX,y:n.pageY};var n;const s=!this._options.isCentered||this._options.isCentered(this),o={x:t._referenceCoordinates.x-(i.x+t.originalWidth),y:i.y-t.originalHeight-t._referenceCoordinates.y};s&&t.activeHandlePosition.endsWith("-right")&&(o.x=i.x-(t._referenceCoordinates.x+t.originalWidth)),s&&(o.x*=2);let r=Math.abs(t.originalWidth+o.x),a=Math.abs(t.originalHeight+o.y);return "width"==(r/t.aspectRatio>a?"width":"height")?a=r/t.aspectRatio:r=a*t.aspectRatio,{width:Math.round(r),height:Math.round(a),widthPercents:Math.min(Math.round(t.originalWidthPercents/t.originalWidth*r*100)/100,100)}}_getResizeHost(){const e=this._domResizerWrapper.parentElement;return this._options.getResizeHost(e)}_getHandleHost(){const e=this._domResizerWrapper.parentElement;return this._options.getHandleHost(e)}get _domResizerWrapper(){return this._options.editor.editing.view.domConverter.mapViewToDom(this._viewResizerWrapper)}_appendHandles(e){const t=["top-left","top-right","bottom-right","bottom-left"];for(const i of t)e.appendChild(new es({tag:"div",attributes:{class:`ck-widget__resizer__handle ${VC(i)}`}}).render());}_appendSizeUI(e){this._sizeView=new IC,this._sizeView.render(),e.appendChild(this._sizeView.element);}}function VC(e){return `ck-widget__resizer__handle-${e}`}class RC extends Ms{_resizers=new Map;_observer;_redrawSelectedResizerThrottled;static get pluginName(){return "WidgetResize"}static get isOfficialPlugin(){return  true}init(){const t=this.editor.editing,i=exports.global.window.document;this.set("selectedResizer",null),this.set("_activeResizer",null),t.view.addObserver(_u),this._observer=new(ci()),this.listenTo(t.view.document,"mousedown",this._mouseDownListener.bind(this),{priority:"high"}),this._observer.listenTo(i,"mousemove",this._mouseMoveListener.bind(this)),this._observer.listenTo(i,"mouseup",this._mouseUpListener.bind(this)),this._redrawSelectedResizerThrottled=ot(()=>this.redrawSelectedResizer(),200),this.editor.ui.on("update",this._redrawSelectedResizerThrottled),this.editor.model.document.on("change",()=>{for(const[e,t]of this._resizers)e.isAttached()||(this._resizers.delete(e),t.destroy());},{priority:"lowest"}),this._observer.listenTo(exports.global.window,"resize",this._redrawSelectedResizerThrottled);const n=this.editor.editing.view.document.selection;n.on("change",()=>{const e=n.getSelectedElement(),t=this.getResizerByViewElement(e)||null;t?this.select(t):this.deselect();});}redrawSelectedResizer(){this.selectedResizer&&this.selectedResizer.isVisible&&this.selectedResizer.redraw();}destroy(){super.destroy(),this._observer.stopListening();for(const e of this._resizers.values())e.destroy();this._redrawSelectedResizerThrottled.cancel();}select(e){this.deselect(),this.selectedResizer=e,this.selectedResizer.isSelected=true;}deselect(){this.selectedResizer&&(this.selectedResizer.isSelected=false),this.selectedResizer=null;}attachTo(e){const t=new PC(e),i=this.editor.plugins;if(t.attach(),i.has("WidgetToolbarRepository")){const e=i.get("WidgetToolbarRepository");t.on("begin",()=>{e.forceDisabled("resize");},{priority:"lowest"}),t.on("cancel",()=>{e.clearForceDisabled("resize");},{priority:"highest"}),t.on("commit",()=>{e.clearForceDisabled("resize");},{priority:"highest"});}this._resizers.set(e.viewElement,t);const n=this.editor.editing.view.document.selection.getSelectedElement();return this.getResizerByViewElement(n)==t&&this.select(t),t}getResizerByViewElement(e){return this._resizers.get(e)}_getResizerByHandle(e){for(const t of this._resizers.values())if(t.containsHandle(e))return t}_mouseDownListener(e,t){const i=t.domTarget;PC.isResizeHandle(i)&&(this._activeResizer=this._getResizerByHandle(i)||null,this._activeResizer&&(this._activeResizer.begin(i),e.stop(),t.preventDefault()));}_mouseMoveListener(e,t){this._activeResizer&&this._activeResizer.updateSize(t);}_mouseUpListener(){this._activeResizer&&(this._activeResizer.commit(),this._activeResizer=null);}}class OC extends Cs{focusTracker=new An;keystrokes=new In;idInputView;backButtonView;saveButtonView;children;_validators;_focusables=new Xn;_focusCycler;constructor(e,t){super(e),this._validators=t,this.backButtonView=this._createBackButton(),this.saveButtonView=this._createSaveButton(),this.idInputView=this._createIdInput(),this.children=this.createCollection([this._createHeaderView()]),this.children.add(new Jv(e,{children:[this.idInputView,this.saveButtonView],class:["ck-form__row_with-submit","ck-form__row_large-top-padding"]})),this.keystrokes.set("Esc",(e,t)=>{this.fire("cancel"),t();}),this._focusCycler=new Fp({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-bookmark-form","ck-responsive-form"],tabindex:"-1"},children:this.children});}render(){super.render(),Vs({view:this});[this.backButtonView,this.idInputView,this.saveButtonView].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.idInputView.focus();}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.idInputView.errorText=t,false}return  true}resetFormStatus(){this.idInputView.errorText=null;}_createBackButton(){const e=this.locale.t,t=new Bp(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:Pf,tooltip:true}),t.delegate("execute").to(this,"cancel"),t}_createSaveButton(){const e=this.locale.t,t=new Bp(this.locale);return t.set({label:e("Save"),withText:true,type:"submit",class:"ck-button-action ck-button-bold"}),t}_createHeaderView(){const e=this.locale.t,t=new Mp(this.locale,{label:e("Bookmark")});return t.children.add(this.backButtonView,0),t}_createIdInput(){const e=this.locale.t,t=new Nb(this.locale,Sw);return t.label=e("Bookmark name"),t.infoText=e("Enter the bookmark name without spaces."),t.class="ck-labeled-field-view_full-width",t}get id(){const{element:e}=this.idInputView.fieldView;return e?e.value.trim():null}}function BC(e){return !(!e||"string"!=typeof e)&&!/\s/.test(e)}class LC extends Ns{refresh(){const e=this.editor.model.document.selection,t=this._getPositionToInsertBookmark(e);this.isEnabled=!!t;}execute(e){if(!e)return;const{bookmarkId:t}=e;if(!BC(t))return void P("insert-bookmark-command-executed-with-invalid-name");const i=this.editor,n=i.model,s=n.document.selection;n.change(e=>{let o=this._getPositionToInsertBookmark(s);if(!n.schema.checkChild(o,"bookmark")){const e=i.execute("insertParagraph",{position:o});if(!e)return;o=e;}const r=e.createElement("bookmark",{...Object.fromEntries(s.getAttributes()),bookmarkId:t});n.insertObject(r,o,null,{setSelection:"on"});});}_getPositionToInsertBookmark(e){const t=this.editor.model,i=t.schema,n=e.getFirstRange(),s=n.start;if(MC(s,i))return s;for(const{previousPosition:e,item:s}of n){if(s.is("element")&&i.checkChild(s,"$text")&&MC(s,i))return t.createPositionAt(s,0);if(MC(e,i))return e}return null}}function MC(e,t){return !!t.checkChild(e,"bookmark")||!!t.checkChild(e,"paragraph")&&t.checkChild("paragraph","bookmark")}class FC extends Ns{refresh(){const e=NC(this.editor.model.document.selection);this.isEnabled=!!e,this.value=e?e.getAttribute("bookmarkId"):void 0;}execute(e){if(!e)return;const{bookmarkId:t}=e;if(!BC(t))return void P("update-bookmark-command-executed-with-invalid-name");const i=this.editor.model,n=NC(i.document.selection);n&&i.change(e=>{e.setAttribute("bookmarkId",t,n);});}}function NC(e){const t=e.getSelectedElement();return t&&t.is("element","bookmark")?t:null}class DC extends Ms{_bookmarkElements=new Map;static get pluginName(){return "BookmarkEditing"}static get licenseFeatureCode(){return "BKM"}static get isOfficialPlugin(){return  true}static get isPremiumPlugin(){return  true}constructor(e){super(e),e.config.define("bookmark",{toolbar:["bookmarkPreview","|","editBookmark","removeBookmark"]});}init(){const{editor:e}=this;this._defineSchema(),this._defineConverters(),e.commands.add("insertBookmark",new LC(e)),e.commands.add("updateBookmark",new FC(e)),this.listenTo(e.model.document,"change:data",()=>{this._trackBookmarkElements();});}getElementForBookmarkId(e){for(const[t,i]of this._bookmarkElements)if(i==e)return t;return null}getAllBookmarkNames(){return new Set(this._bookmarkElements.values())}_defineSchema(){this.editor.model.schema.register("bookmark",{inheritAllFrom:"$inlineObject",allowAttributes:"bookmarkId",disallowAttributes:["linkHref","htmlA"]});}_defineConverters(){const{editor:e}=this,{conversion:t,t:i}=e;e.data.htmlProcessor.domConverter.registerInlineObjectMatcher(e=>zC(e)),e.editing.view.domConverter.registerInlineObjectMatcher(e=>zC(e,false)),t.for("dataDowncast").elementToElement({model:{name:"bookmark",attributes:["bookmarkId"]},view:(e,{writer:t})=>t.createEmptyElement("a",{id:e.getAttribute("bookmarkId")})}),t.for("editingDowncast").elementToElement({model:{name:"bookmark",attributes:["bookmarkId"]},view:(e,{writer:t})=>{const n=e.getAttribute("bookmarkId"),s=t.createContainerElement("a",{id:n,class:"ck-bookmark"},[this._createBookmarkUIElement(t)]);t.setCustomProperty("bookmark",true,s),this._bookmarkElements.set(e,n);return Yk(s,t,{label:()=>`${n} ${i("bookmark widget")}`})}}),t.for("upcast").add(t=>t.on("element:a",function(e){return (t,i,n)=>{const s=i.viewItem,o=zC(s,false);if(!o||!n.consumable.test(s,o))return;const r=function(e){const t=e.config.get("bookmark.enableNonEmptyAnchorConversion");return void 0===t||t}(e);if(!r&&!s.isEmpty)return;const a=n.writer,l=s.getAttribute("id"),c=s.getAttribute("name"),u=l||c,d=a.createElement("bookmark",{bookmarkId:u});if(!n.safeInsert(d,i.modelCursor))return;n.consumable.consume(s,o),l===c&&n.consumable.consume(s,{attributes:["name"]}),n.updateConversionResult(d,i);const{modelCursor:h,modelRange:m}=n.convertChildren(s,i.modelCursor);i.modelCursor=h,i.modelRange=a.createRange(i.modelRange.start,m.end);}}(e)));}_createBookmarkUIElement(e){return e.createUIElement("span",{class:"ck-bookmark__icon"},function(e){const t=this.toDomElement(e),i=new Rp;return i.set({content:rm,isColorInherited:false}),i.render(),t.appendChild(i.element),t})}_trackBookmarkElements(){this._bookmarkElements.forEach((e,t)=>{"$graveyard"===t.root.rootName&&this._bookmarkElements.delete(t);});}}function zC(e,t=true){if(!("a"===e.name))return null;if(t&&!e.isEmpty)return null;const i=e.hasAttribute("id"),n=e.hasAttribute("name"),s=e.hasAttribute("href");return i&&!s?{name:true,attributes:["id"]}:n&&!s?{name:true,attributes:["name"]}:null}const HC="bookmark-ui";class qC extends Ms{formView=null;_balloon;static get requires(){return [DC,i_,xC]}static get pluginName(){return "BookmarkUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor;this._balloon=e.plugins.get(i_),e.plugins.has("LinkUI")&&this._registerLinkProvider(),this._registerComponents(),e.conversion.for("editingDowncast").markerToHighlight({model:HC,view:{classes:["ck-fake-bookmark-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:HC,view:(e,{writer:t})=>{if(!e.markerRange.isCollapsed)return null;const i=t.createUIElement("span");return t.addClass(["ck-fake-bookmark-selection","ck-fake-bookmark-selection_collapsed"],i),i}});}afterInit(){const e=this.editor,t=e.locale.t,i=this.editor.plugins.get(xC),n=eb.defaultPositions;i.register("bookmark",{ariaLabel:t("Bookmark toolbar"),items:e.config.get("bookmark.toolbar"),getRelatedElement:UC,balloonClassName:"ck-bookmark-balloon ck-toolbar-container",positions:[n.southArrowNorth,n.southArrowNorthMiddleWest,n.southArrowNorthMiddleEast,n.southArrowNorthWest,n.southArrowNorthEast,n.northArrowSouth,n.northArrowSouthMiddleWest,n.northArrowSouthMiddleEast,n.northArrowSouthWest,n.northArrowSouthEast,n.viewportStickyNorth]});}destroy(){super.destroy(),this.formView&&this.formView.destroy();}_createViews(){this.formView=this._createFormView(),this._enableUserBalloonInteractions();}_createFormView(){const e=this.editor,t=e.locale,i=t.t,n=e.commands.get("insertBookmark"),s=e.commands.get("updateBookmark"),o=[n,s],r=new(Is(OC))(t,function(e){const{t:t}=e,i=e.plugins.get(DC);return [e=>{if(!e.id)return t("Bookmark must not be empty.")},e=>{if(e.id&&/\s/.test(e.id))return t("Bookmark name cannot contain space characters.")},n=>{const s=e.model.document.selection.getSelectedElement(),o=i.getElementForBookmarkId(n.id);if(s!==o)return o?t("Bookmark name already exists."):void 0}]}(e));return r.idInputView.fieldView.bind("value").to(s,"value"),r.saveButtonView.bind("label").to(s,"value",e=>i(e?"Save":"Insert")),r.idInputView.bind("isEnabled").toMany(o,"isEnabled",(...e)=>e.some(e=>e)),r.saveButtonView.bind("isEnabled").toMany(o,"isEnabled",(...e)=>e.some(e=>e)),this.listenTo(r,"cancel",()=>{this._hideFormView();}),this.listenTo(r,"submit",()=>{if(r.isValid()){const t=r.id;this._getSelectedBookmarkElement()?e.execute("updateBookmark",{bookmarkId:t}):e.execute("insertBookmark",{bookmarkId:t}),this._hideFormView();}}),this.listenTo(r.idInputView,"change:errorText",()=>{e.ui.update();}),r}_registerLinkProvider(){const e=this.editor.locale.t,t=this.editor.plugins.get("LinkUI"),i=this.editor.plugins.get(DC);t.registerLinksListProvider({label:e("Bookmarks"),emptyListPlaceholder:e("No bookmarks available."),navigate:({href:e})=>this._scrollToBookmark(e),getListItems:()=>Array.from(i.getAllBookmarkNames()).sort((e,t)=>e.localeCompare(t)).map(e=>({id:e,href:`#${e}`,label:e,icon:lm})),getItem:t=>{const n=[...i.getAllBookmarkNames()].find(e=>`#${e}`===t);return n?{href:t,label:n,icon:cm,tooltip:e("Scroll to bookmark")}:null}});}_scrollToBookmark(e){const t=this.editor.plugins.get(DC).getElementForBookmarkId(e.slice(1));return !!t&&(this.editor.model.change(e=>{e.setSelection(t,"on");}),this.editor.editing.view.scrollToTheSelection({alignToTop:true,forceScroll:true}),true)}_registerComponents(){const e=this.editor;e.ui.componentFactory.add("bookmark",()=>{const e=this._createBookmarkButton(Bp);return e.set({tooltip:true}),e}),e.ui.componentFactory.add("menuBar:bookmark",()=>this._createBookmarkButton(Jp)),e.ui.componentFactory.add("bookmarkPreview",t=>{const i=e.commands.get("updateBookmark"),n=new Os(t);return n.extendTemplate({attributes:{class:["ck-bookmark-toolbar__preview"]}}),n.bind("text").to(i,"value"),n}),e.ui.componentFactory.add("editBookmark",t=>{const i=e.commands.get("updateBookmark"),n=new Bp(t),s=t.t;return n.set({label:s("Edit bookmark"),icon:xf,tooltip:true}),n.bind("isEnabled").to(i),this.listenTo(n,"execute",()=>{this._showFormView();}),n}),e.ui.componentFactory.add("removeBookmark",t=>{const i=e.commands.get("delete"),n=new Bp(t),s=t.t;return n.set({label:s("Remove bookmark"),icon:Nf,tooltip:true}),n.bind("isEnabled").to(i),this.listenTo(n,"execute",()=>{e.execute("delete"),e.editing.view.focus();}),n});}_createBookmarkButton(e){const t=this.editor,i=t.locale,n=new e(i),s=t.commands.get("insertBookmark"),o=t.commands.get("updateBookmark"),r=i.t;return n.set({label:r("Bookmark"),icon:am}),this.listenTo(n,"execute",()=>{t.editing.view.scrollToTheSelection(),this._showFormView();}),n.bind("isEnabled").toMany([s,o],"isEnabled",(...e)=>e.some(e=>e)),n.bind("isOn").to(o,"value",e=>!!e),n}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Esc",(e,t)=>{this._isFormVisible&&(this._hideFormView(),t());}),Ss({emitter:this.formView,activator:()=>this._isFormInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>{this._hideFormView(false);}});}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;const e=this.editor.commands.get("updateBookmark");this.formView.disableCssTransitions(),this.formView.resetFormStatus(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this.formView.backButtonView.isVisible=e.isEnabled,this.formView.idInputView.fieldView.value=e.value||"",this._balloon.visibleView===this.formView&&this.formView.idInputView.fieldView.select(),this.formView.enableCssTransitions();}_removeFormView(e=true){this.formView.saveButtonView.focus(),this.formView.idInputView.fieldView.reset(),this._balloon.remove(this.formView),e&&this.editor.editing.view.focus(),this._hideFakeVisualSelection();}_showFormView(){this.formView||this._createViews(),this._getSelectedBookmarkElement()||this._showFakeVisualSelection(),this._addFormView(),this._balloon.showStack("main"),this._startUpdatingUI();}_hideFormView(e=true){if(!this._isFormInPanel)return;const t=this.editor;this.stopListening(t.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e&&t.editing.view.focus(),this._removeFormView(e),this._hideFakeVisualSelection();}_startUpdatingUI(){const e=this.editor,t=e.editing.view.document;let i=this._getSelectedBookmarkElement(),n=o();const s=()=>{const e=this._getSelectedBookmarkElement(),t=o();i&&!e||!i&&t!==n?this._hideFormView():this._isFormVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),i=e,n=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 _isFormVisible(){return !!this.formView&&this._balloon.visibleView==this.formView}_getBalloonPositionData(){const e=this.editor.editing.view,t=this.editor.model;let i;const n=this._getSelectedBookmarkElement();if(t.markers.has(HC)){const t=Array.from(this.editor.editing.mapper.markerNameToElements(HC)),n=e.createRange(e.createPositionBefore(t[0]),e.createPositionAfter(t[t.length-1]));i=e.domConverter.viewRangeToDom(n);}else n&&(i=()=>{const t=this.editor.editing.mapper,i=e.domConverter,s=t.toViewElement(n);return i.mapViewToDom(s)});if(i)return {target:i}}_getSelectedBookmarkElement(){const e=this.editor.model.document.selection.getSelectedElement();return e&&e.is("element","bookmark")?e:null}_showFakeVisualSelection(){const e=this.editor.model;e.change(t=>{const i=e.document.selection.getFirstRange();if(e.markers.has(HC))t.updateMarker(HC,{range:i});else if(i.start.isAtEnd){const n=i.start.getLastMatchingPosition(({item:t})=>!e.schema.isContent(t),{boundaries:i});t.addMarker(HC,{usingOperation:false,affectsData:false,range:t.createRange(n,i.end)});}else t.addMarker(HC,{usingOperation:false,affectsData:false,range:i});});}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(HC)&&e.change(e=>{e.removeMarker(HC);});}}function UC(e){const t=e.getSelectedElement();return t&&Qk(t)&&t.getCustomProperty("bookmark")?t:null}class jC extends Ms{static get pluginName(){return "Bookmark"}static get requires(){return [DC,qC,kC]}static get isOfficialPlugin(){return  true}}class $C extends Ms{static get pluginName(){return "CKBoxUI"}static get isOfficialPlugin(){return  true}afterInit(){const e=this.editor;e.commands.get("ckbox")&&(e.ui.componentFactory.add("ckbox",()=>this._createFileToolbarButton()),e.ui.componentFactory.add("menuBar:ckbox",()=>this._createFileMenuBarButton()),e.plugins.has("ImageInsertUI")&&e.plugins.get("ImageInsertUI").registerIntegration({name:"assetManager",observable:()=>e.commands.get("ckbox"),buttonViewCreator:()=>this._createImageToolbarButton(),formViewCreator:()=>this._createImageDropdownButton(),menuBarButtonViewCreator:e=>this._createImageMenuBarButton(e?"insertOnly":"insertNested")}));}_createButton(e){const t=this.editor,i=new e(t.locale),n=t.commands.get("ckbox");return i.bind("isOn","isEnabled").to(n,"value","isEnabled"),i.on("execute",()=>{t.execute("ckbox");}),i}_createFileToolbarButton(){const e=this.editor.locale.t,t=this._createButton(Bp);return t.icon=mm,t.label=e("Open file manager"),t.tooltip=true,t}_createImageToolbarButton(){const e=this.editor.locale.t,t=this.editor.plugins.get("ImageInsertUI"),i=this._createButton(Bp);return i.icon=vg,i.bind("label").to(t,"isImageSelected",t=>e(t?"Replace image with file manager":"Insert image with file manager")),i.tooltip=true,i}_createImageDropdownButton(){const e=this.editor.locale.t,t=this.editor.plugins.get("ImageInsertUI"),i=this._createButton(Bp);return i.icon=vg,i.withText=true,i.bind("label").to(t,"isImageSelected",t=>e(t?"Replace with file manager":"Insert with file manager")),i.on("execute",()=>{t.dropdownView.isOpen=false;}),i}_createFileMenuBarButton(){const e=this.editor.locale.t,t=this._createButton(Jp);return t.icon=mm,t.withText=true,t.label=e("File"),t}_createImageMenuBarButton(e){const t=this.editor.locale.t,i=this.editor.locale.t,n=this._createButton(Jp);switch(n.icon=vg,n.withText=true,e){case "insertOnly":n.label=t("Image");break;case "insertNested":n.label=i("With file manager");}return n}}class WC extends qr{domEventType=["paste","copy","cut","drop","dragover","dragstart","dragend","dragenter","dragleave"];constructor(e){super(e);const t=this.document;function i(e){return (i,n)=>{n.preventDefault();const s=n.dropRange?[n.dropRange]:null,o=new C(t,e);t.fire(o,{dataTransfer:n.dataTransfer,method:i.name,targetRanges:s,target:n.target,domEvent:n.domEvent}),o.stop.called&&n.stopPropagation();}}this.listenTo(t,"paste",i("clipboardInput"),{priority:"low"}),this.listenTo(t,"drop",i("clipboardInput"),{priority:"low"}),this.listenTo(t,"dragover",i("dragging"),{priority:"low"});}onDomEvent(e){const t="clipboardData"in e?e.clipboardData:e.dataTransfer,i="drop"==e.type||"paste"==e.type,n={dataTransfer:new Qr(t,{cacheFiles:i})};if("drop"==e.type||"dragover"==e.type){const t=pi(e);n.dropRange=t&&this.view.domConverter.domRangeToView(t);}this.fire(e.type,e,n);}}function GC(e){return ((e=e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r?\n\r?\n/g,"</p><p>").replace(/\r?\n/g,"<br>").replace(/\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;").replace(/^\s/,"&nbsp;").replace(/\s$/,"&nbsp;").replace(/\s\s/g," &nbsp;")).includes("</p><p>")||e.includes("<br>"))&&(e=`<p>${e}</p>`),e}function KC(e){return e.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(e,t)=>1==t.length?" ":t).replace(/<!--[\s\S]*?-->/g,"")}const JC=["figcaption","li"],QC=["ol","ul"];function YC(e,t){if(t.is("$text")||t.is("$textProxy"))return t.data;if(t.is("element","img")&&t.hasAttribute("alt"))return t.getAttribute("alt");if(t.is("element","br"))return "\n";let i="",n=null;for(const s of t.getChildren())i+=XC(s,n)+YC(e,s),n=s;if(t.is("rawElement")){const n=document.implementation.createHTMLDocument("").createElement("div");t.render(n,e),i+=ZC(n);}return i}function ZC(e){let t="";if(e.nodeType===Node.TEXT_NODE)return e.textContent;if("BR"===e.tagName)return "\n";for(const i of e.childNodes)t+=ZC(i);return t}function XC(e,t){return t?e.is("element","li")&&!e.isEmpty&&e.getChild(0).is("containerElement")||QC.includes(e.name)&&QC.includes(t.name)?"\n\n":e.is("containerElement")||t.is("containerElement")?JC.includes(e.name)||JC.includes(t.name)?"\n":e.is("element")&&e.getCustomProperty("dataPipeline:transparentRendering")||t.is("element")&&t.getCustomProperty("dataPipeline:transparentRendering")?"":"\n\n":"":""}class ex extends Ms{_markersToCopy=new Map;static get pluginName(){return "ClipboardMarkersUtils"}static get isOfficialPlugin(){return  true}_registerMarkerToCopy(e,t){this._markersToCopy.set(e,t);}_copySelectedFragmentWithMarkers(e,t,i=e=>e.model.getSelectedContent(e.model.document.selection)){return this.editor.model.change(n=>{const s=n.model.document.selection;n.setSelection(t);const o=this._insertFakeMarkersIntoSelection(n,n.model.document.selection,e),r=i(n),a=this._removeFakeMarkersInsideElement(n,r);for(const[e,t]of Object.entries(o)){a[e]||=n.createRangeIn(r);for(const e of t)n.remove(e);}r.markers.clear();for(const[e,t]of Object.entries(a))r.markers.set(e,t);return n.setSelection(s),r})}_pasteMarkersIntoTransformedElement(e,t){const i=this._getPasteMarkersFromRangeMap(e);return this.editor.model.change(e=>{const n=this._insertFakeMarkersElements(e,i),s=t(e),o=this._removeFakeMarkersInsideElement(e,s);for(const t of Object.values(n).flat())e.remove(t);for(const[t,i]of Object.entries(o))e.model.markers.has(t)||e.addMarker(t,{usingOperation:true,affectsData:true,range:i});return s})}_pasteFragmentWithMarkers(e){const t=this._getPasteMarkersFromRangeMap(e.markers);e.markers.clear();for(const i of t)e.markers.set(i.name,i.range);return this.editor.model.insertContent(e)}_forceMarkersCopy(e,t,i={allowedActions:"all",copyPartiallySelected:true,duplicateOnPaste:true}){const n=this._markersToCopy.get(e);this._markersToCopy.set(e,i),t(),n?this._markersToCopy.set(e,n):this._markersToCopy.delete(e);}_isMarkerCopyable(e,t){const i=this._getMarkerClipboardConfig(e);if(!i)return  false;if(!t)return  true;const{allowedActions:n}=i;return "all"===n||n.includes(t)}_hasMarkerConfiguration(e){return !!this._getMarkerClipboardConfig(e)}_getMarkerClipboardConfig(e){const[t]=e.split(":");return this._markersToCopy.get(t)||null}_insertFakeMarkersIntoSelection(e,t,i){const n=this._getCopyableMarkersFromSelection(e,t,i);return this._insertFakeMarkersElements(e,n)}_getCopyableMarkersFromSelection(e,t,i){const n=Array.from(t.getRanges()),s=new Set(n.flatMap(t=>Array.from(e.model.markers.getMarkersIntersectingRange(t))));return Array.from(s).filter(e=>{if(!this._isMarkerCopyable(e.name,i))return  false;const{copyPartiallySelected:t}=this._getMarkerClipboardConfig(e.name);if(!t){const t=e.getRange();return n.some(e=>e.containsRange(t,true))}return  true}).map(e=>({name:"dragstart"===i?this._getUniqueMarkerName(e.name):e.name,range:e.getRange()}))}_getPasteMarkersFromRangeMap(e,t=null){const{model:i}=this.editor;return (e instanceof Map?Array.from(e.entries()):Object.entries(e)).flatMap(([e,n])=>{if(!this._hasMarkerConfiguration(e))return [{name:e,range:n}];if(this._isMarkerCopyable(e,t)){const t=this._getMarkerClipboardConfig(e),s=i.markers.has(e)&&"$graveyard"===i.markers.get(e).getRange().root.rootName;return (t.duplicateOnPaste||s)&&(e=this._getUniqueMarkerName(e)),[{name:e,range:n}]}return []})}_insertFakeMarkersElements(e,t){const i={},n=t.flatMap(e=>{const{start:t,end:i}=e.range;return [{position:t,marker:e,type:"start"},{position:i,marker:e,type:"end"}]}).sort(({position:e},{position:t})=>e.isBefore(t)?1:-1);for(const{position:t,marker:s,type:o}of n){const n=e.createElement("$marker",{"data-name":s.name,"data-type":o});i[s.name]||(i[s.name]=[]),i[s.name].push(n),e.insert(n,t);}return i}_removeFakeMarkersInsideElement(e,t){const i=this._getAllFakeMarkersFromElement(e,t).reduce((t,i)=>{const n=i.markerElement&&e.createPositionBefore(i.markerElement);let s=t[i.name],o=false;if(s?.start&&s?.end){this._getMarkerClipboardConfig(i.name).duplicateOnPaste?t[this._getUniqueMarkerName(i.name)]=t[i.name]:o=true,s=null;}return o||(t[i.name]={...s,[i.type]:n}),i.markerElement&&e.remove(i.markerElement),t},{});return kt(i,i=>new ha(i.start||e.createPositionFromPath(t,[0]),i.end||e.createPositionAt(t,"end")))}_getAllFakeMarkersFromElement(e,t){const i=Array.from(e.createRangeIn(t)).flatMap(({item:e})=>{if(!e.is("element","$marker"))return [];const t=e.getAttribute("data-name"),i=e.getAttribute("data-type");return [{markerElement:e,name:t,type:i}]}),n=[],s=[];for(const e of i){if("end"===e.type){i.some(t=>t.name===e.name&&"start"===t.type)||n.push({markerElement:null,name:e.name,type:"start"});}if("start"===e.type){i.some(t=>t.name===e.name&&"end"===t.type)||s.unshift({markerElement:null,name:e.name,type:"end"});}}return [...n,...i,...s]}_getUniqueMarkerName(e){const t=e.split(":"),i=A().substring(1,6);return 3===t.length?`${t.slice(0,2).join(":")}:${i}`:`${t.join(":")}:${i}`}}class tx extends Ms{static get pluginName(){return "ClipboardPipeline"}static get isOfficialPlugin(){return  true}static get requires(){return [ex]}init(){this.editor.editing.view.addObserver(WC),this._setupPasteDrop(),this._setupCopyCut();}_fireOutputTransformationEvent(e,t,i){const n=this.editor.plugins.get("ClipboardMarkersUtils");this.editor.model.enqueueChange({isUndoable:"cut"===i},()=>{const s=n._copySelectedFragmentWithMarkers(i,t);this.fire("outputTransformation",{dataTransfer:e,content:s,method:i});});}_setupPasteDrop(){const e=this.editor,t=e.model,i=e.editing.view,n=i.document,s=this.editor.plugins.get("ClipboardMarkersUtils");this.listenTo(n,"clipboardInput",(t,i)=>{"paste"!=i.method||e.model.canEditAt(e.model.document.selection)||t.stop();},{priority:"highest"}),this.listenTo(n,"clipboardInput",(e,t)=>{const n=t.dataTransfer;let s;if(t.content)s=t.content;else {let e="";n.getData("text/html")?e=KC(n.getData("text/html")):n.getData("text/plain")&&(e=GC(n.getData("text/plain"))),s=this.editor.data.htmlProcessor.toView(e);}const o=new C(this,"inputTransformation"),r=n.getData("application/ckeditor5-editor-id")||null;this.fire(o,{content:s,dataTransfer:n,sourceEditorId:r,targetRanges:t.targetRanges,method:t.method}),o.stop.called&&e.stop(),i.scrollToTheSelection();},{priority:"low"}),this.listenTo(this,"inputTransformation",(e,i)=>{if(i.content.isEmpty)return;const n=this.editor.data.toModel(i.content,"$clipboardHolder");0!=n.childCount&&(e.stop(),t.change(()=>{this.fire("contentInsertion",{content:n,method:i.method,sourceEditorId:i.sourceEditorId,dataTransfer:i.dataTransfer,targetRanges:i.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,i=e.editing.view.document,n=(e,i)=>{const n=i.dataTransfer;i.preventDefault(),this._fireOutputTransformationEvent(n,t.selection,e.name);};this.listenTo(i,"copy",n,{priority:"low"}),this.listenTo(i,"cut",(t,i)=>{e.model.canEditAt(e.model.document.selection)?n(t,i):i.preventDefault();},{priority:"low"}),this.listenTo(this,"outputTransformation",(t,n)=>{const s=e.data.toView(n.content,{isClipboardPipeline:true});i.fire("clipboardOutput",{dataTransfer:n.dataTransfer,content:s,method:n.method});},{priority:"low"}),this.listenTo(i,"clipboardOutput",(i,n)=>{n.content.isEmpty||(n.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(n.content)),n.dataTransfer.setData("text/plain",YC(e.data.htmlProcessor.domConverter,n.content)),n.dataTransfer.setData("application/ckeditor5-editor-id",this.editor.id)),"cut"==n.method&&e.model.deleteContent(t.selection);},{priority:"low"});}}const ix=Ri("px");class nx extends Cs{constructor(){super();const e=this.bindTemplate;this.set({isVisible:false,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=>ix(e)),top:e.to("top",e=>ix(e)),width:e.to("width",e=>ix(e))}}});}}class sx extends Ms{removeDropMarkerDelayed=Fn(()=>this.removeDropMarker(),40);_updateDropMarkerThrottled=ot(e=>this._updateDropMarker(e),40);_reconvertMarkerThrottled=ot(()=>{this.editor.model.markers.has("drop-target")&&this.editor.editing.reconvertMarker("drop-target");},0);_dropTargetLineView=new nx;_domEmitter=new(ci());_scrollables=new Map;static get pluginName(){return "DragDropTarget"}static get isOfficialPlugin(){return  true}init(){this._setupDropMarker();}destroy(){this._domEmitter.stopListening();for(const{resizeObserver:e}of this._scrollables.values())e.destroy();return this._updateDropMarkerThrottled.cancel(),this.removeDropMarkerDelayed.cancel(),this._reconvertMarkerThrottled.cancel(),super.destroy()}updateDropMarker(e,t,i,n,s,o){this.removeDropMarkerDelayed.cancel();const r=ox(this.editor,e,t,i,n,s,o);return r?o&&o.containsRange(r)||r&&!this.editor.model.canEditAt(r)?(this.removeDropMarker(),null):(this._updateDropMarkerThrottled(r),r):null}getFinalDropRange(e,t,i,n,s,o){const r=ox(this.editor,e,t,i,n,s,o);return this.removeDropMarker(),r}removeDropMarker(){const e=this.editor.model;this.removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),this._dropTargetLineView.isVisible=false,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:i})=>{if(e.model.schema.checkChild(t.markerRange.start,"$text"))return this._dropTargetLineView.isVisible=false,this._createDropTargetPosition(i);t.markerRange.isCollapsed?this._updateDropTargetLine(t.markerRange):this._dropTargetLineView.isVisible=false;}});}_updateDropMarker(e){const t=this.editor,i=t.model.markers;t.model.change(t=>{i.has("drop-target")?i.get("drop-target").getRange().isEqual(e)||t.updateMarker("drop-target",{range:e}):t.addMarker("drop-target",{range:e,usingOperation:false,affectsData:false});});}_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(t){const i=this.editor.editing,n=t.start.nodeBefore,s=t.start.nodeAfter,o=t.start.parent,r=n?i.mapper.toViewElement(n):null,a=r?i.view.domConverter.mapViewToDom(r):null,l=s?i.mapper.toViewElement(s):null,c=l?i.view.domConverter.mapViewToDom(l):null,u=i.mapper.toViewElement(o);if(!u)return;const d=i.view.domConverter.mapViewToDom(u),h=this._getScrollableRect(u),{scrollX:m,scrollY:g}=exports.global.window,f=a?new Ci(a):null,p=c?new Ci(c):null,b=new Ci(d).excludeScrollbarsAndBorders(),w=f?f.bottom:b.top,v=p?p.top:b.bottom,_=exports.global.window.getComputedStyle(d),y=w<=v?(w+v)/2:v;if(h.top<y&&y<h.bottom){const e=b.left+parseFloat(_.paddingLeft),t=b.right-parseFloat(_.paddingRight),i=Math.max(e+m,h.left),n=Math.min(t+m,h.right);this._dropTargetLineView.set({isVisible:true,left:i,top:y+g,width:n-i});}else this._dropTargetLineView.isVisible=false;}_getScrollableRect(t){const i=t.root.rootName;let n;if(this._scrollables.has(i))n=this._scrollables.get(i).domElement;else {n=function(t){let i=t;do{i=i.parentElement;const t=exports.global.window.getComputedStyle(i).overflowY;if("auto"==t||"scroll"==t)break}while("BODY"!=i.tagName);return i}(this.editor.editing.view.domConverter.mapViewToDom(t)),this._domEmitter.listenTo(n,"scroll",this._reconvertMarkerThrottled,{usePassive:true});const s=new Pi(n,this._reconvertMarkerThrottled);this._scrollables.set(i,{domElement:n,resizeObserver:s});}return new Ci(n).excludeScrollbarsAndBorders()}}function ox(e,t,i,n,s,o,r){const a=e.model,l=e.editing.mapper;let c=cx(e,t);for(;c;){if(!o)if(a.schema.checkChild(c,"$text")){if(i){const t=i[0].start,o=l.toModelPosition(t);if(!r||Array.from(r.getItems({shallow:true})).some(e=>a.schema.checkChild(o,e))){if(a.schema.checkChild(o,"$text"))return a.createRange(o);if(t)return ax(e,cx(e,t.parent),n,s)}}}else if(a.schema.isInline(c))return ax(e,c,n,s);if(a.schema.isBlock(c))return ax(e,c,n,s);if(a.schema.checkChild(c,"$block")){const t=Array.from(c.getChildren()).filter(t=>t.is("element")&&!rx(e,t));let i=0,o=t.length;if(0==o)return a.createRange(a.createPositionAt(c,"end"));for(;i<o-1;){const r=Math.floor((i+o)/2);"before"==lx(e,t[r],n,s)?o=r:i=r;}return ax(e,t[i],n,s)}c=c.parent;}return null}function rx(t,i){const n=t.editing.mapper,s=t.editing.view.domConverter,o=n.toViewElement(i);if(!o)return  true;const r=s.mapViewToDom(o);return "none"!=exports.global.window.getComputedStyle(r).float}function ax(e,t,i,n){const s=e.model;return s.createRange(s.createPositionAt(t,lx(e,t,i,n)))}function lx(e,t,i,n){const s=e.editing.mapper,o=e.editing.view.domConverter,r=s.toViewElement(t),a=o.mapViewToDom(r),l=new Ci(a);return e.model.schema.isInline(t)?i<(l.left+l.right)/2?"before":"after":n<(l.top+l.bottom)/2?"before":"after"}function cx(e,t){const i=e.editing.mapper,n=e.editing.view,s=i.toModelElement(t);if(s)return s;const o=n.createPositionBefore(t),r=i.findMappedViewAncestor(o);return i.toModelElement(r)}class ux extends Ms{_isBlockDragging=false;_domEmitter=new(ci());static get pluginName(){return "DragDropBlockToolbar"}static get isOfficialPlugin(){return  true}init(){const t=this.editor;if(this.listenTo(t,"change:isReadOnly",(e,t,i)=>{i?(this.forceDisabled("readOnlyMode"),this._isBlockDragging=false):this.clearForceDisabled("readOnlyMode");}),n.isAndroid&&this.forceDisabled("noAndroidSupport"),t.plugins.has("BlockToolbar")){const i=t.plugins.get("BlockToolbar").buttonView.element;this._domEmitter.listenTo(i,"dragstart",(e,t)=>this._handleBlockDragStart(t)),this._domEmitter.listenTo(exports.global.document,"dragover",(e,t)=>this._handleBlockDragging(t)),this._domEmitter.listenTo(exports.global.document,"drop",(e,t)=>this._handleBlockDragging(t)),this._domEmitter.listenTo(exports.global.document,"dragend",()=>this._handleBlockDragEnd(),{useCapture:true}),this.isEnabled&&i.setAttribute("draggable","true"),this.on("change:isEnabled",(e,t,n)=>{i.setAttribute("draggable",n?"true":"false");});}}destroy(){return this._domEmitter.stopListening(),super.destroy()}_handleBlockDragStart(e){if(!this.isEnabled)return;const t=this.editor.model,i=t.document.selection,n=this.editor.editing.view,s=Array.from(i.getSelectedBlocks()),o=t.createRange(t.createPositionBefore(s[0]),t.createPositionAfter(s[s.length-1]));t.change(e=>e.setSelection(o)),this._isBlockDragging=true,n.focus(),n.getObserver(WC).onDomEvent(e);}_handleBlockDragging(e){if(!this.isEnabled||!this._isBlockDragging)return;const t=e.clientX+("ltr"==this.editor.locale.contentLanguageDirection?100:-100),i=e.clientY,n=document.elementFromPoint(t,i),s=this.editor.editing.view;n&&n.closest(".ck-editor__editable")&&s.getObserver(WC).onDomEvent({...e,type:e.type,dataTransfer:e.dataTransfer,target:n,clientX:t,clientY:i,preventDefault:()=>e.preventDefault(),stopPropagation:()=>e.stopPropagation()});}_handleBlockDragEnd(){this._isBlockDragging=false;}}class dx extends Ms{_draggedRange;_draggingUid;_draggableElement;_clearDraggableAttributesDelayed=Fn(()=>this._clearDraggableAttributes(),40);_blockMode=false;_domEmitter=new(ci());_previewContainer;static get pluginName(){return "DragDrop"}static get isOfficialPlugin(){return  true}static get requires(){return [tx,kC,sx,ux]}init(){const e=this.editor,t=e.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,t.addObserver(WC),t.addObserver(ku),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDraggableAttributeHandling(),this.listenTo(e,"change:isReadOnly",(e,t,i)=>{i?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode");}),this.on("change:isEnabled",(e,t,i)=>{i||this._finalizeDragging(false);}),n.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 t=this.editor,i=t.model,s=t.editing.view,o=s.document,r=t.plugins.get(sx);this.listenTo(o,"dragstart",(e,n)=>{if(n.target?.is("editableElement"))return void n.preventDefault();if(this._prepareDraggedRange(n.target),!this._draggedRange)return void n.preventDefault();this._draggingUid=A();const s=this.isEnabled&&t.model.canEditAt(this._draggedRange);n.dataTransfer.effectAllowed=s?"copyMove":"copy",n.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const o=i.createSelection(this._draggedRange.toRange());this.editor.plugins.get("ClipboardPipeline")._fireOutputTransformationEvent(n.dataTransfer,o,"dragstart");const{dataTransfer:r,domTarget:a,domEvent:l}=n,{clientX:c}=l;this._updatePreview({dataTransfer:r,domTarget:a,clientX:c}),n.stopPropagation(),s||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="");},{priority:"low"}),this.listenTo(o,"dragend",(e,t)=>{this._finalizeDragging(!t.dataTransfer.isCanceled&&"move"==t.dataTransfer.dropEffect);},{priority:"low"}),this._domEmitter.listenTo(exports.global.document,"dragend",()=>{this._blockMode=false;},{useCapture:true}),this.listenTo(o,"dragenter",()=>{this.isEnabled&&s.focus();}),this.listenTo(o,"dragleave",()=>{r.removeDropMarkerDelayed();}),this.listenTo(o,"dragging",(e,t)=>{if(!this.isEnabled)return void(t.dataTransfer.dropEffect="none");const{clientX:i,clientY:s}=t.domEvent;r.updateDropMarker(t.target,t.targetRanges,i,s,this._blockMode,this._draggedRange)?(this._draggedRange||(t.dataTransfer.dropEffect="copy"),n.isGecko||("copy"==t.dataTransfer.effectAllowed?t.dataTransfer.dropEffect="copy":["all","copyMove"].includes(t.dataTransfer.effectAllowed)&&(t.dataTransfer.dropEffect="move")),e.stop()):t.dataTransfer.dropEffect="none";},{priority:"low"});}_setupClipboardInputIntegration(){const e=this.editor,t=e.editing.view.document,i=e.plugins.get(sx);this.listenTo(t,"clipboardInput",(t,n)=>{if("drop"!=n.method)return;const{clientX:s,clientY:o}=n.domEvent,r=i.getFinalDropRange(n.target,n.targetRanges,s,o,this._blockMode,this._draggedRange);if(!r)return this._finalizeDragging(false),void t.stop();this._draggedRange&&this._draggingUid!=n.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="");if("move"==hx(n.dataTransfer)&&this._draggedRange&&this._draggedRange.containsRange(r,true))return this._finalizeDragging(false),void t.stop();n.targetRanges=[e.editing.mapper.toViewRange(r)];},{priority:"high"});}_setupContentInsertionIntegration(){const e=this.editor.plugins.get(tx);e.on("contentInsertion",(e,t)=>{if(!this.isEnabled||"drop"!==t.method)return;const i=t.targetRanges.map(e=>this.editor.editing.mapper.toModelRange(e));this.editor.model.change(e=>e.setSelection(i));},{priority:"high"}),e.on("contentInsertion",(e,t)=>{if(!this.isEnabled||"drop"!==t.method)return;const i="move"==hx(t.dataTransfer),n=!t.resultRange||!t.resultRange.isCollapsed;this._finalizeDragging(n&&i);},{priority:"lowest"});}_setupDraggableAttributeHandling(){const e=this.editor,t=e.editing.view,i=t.document;this.listenTo(i,"pointerdown",(s,o)=>{if(n.isAndroid||!o)return;this._clearDraggableAttributesDelayed.cancel();let r=mx(o.target);if(n.isBlink&&!e.isReadOnly&&!r&&!i.selection.isCollapsed){const e=i.selection.getSelectedElement();e&&Qk(e)||(r=i.selection.editableElement);}r&&(t.change(e=>{e.setAttribute("draggable","true",r);}),this._draggableElement=e.editing.mapper.toModelElement(r));}),this.listenTo(i,"pointerup",()=>{n.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,i=t.model;if(t.plugins.get(sx).removeDropMarker(),this._clearDraggableAttributes(),t.plugins.has("WidgetToolbarRepository")){t.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop");}this._draggingUid="",this._previewContainer&&(this._previewContainer.remove(),this._previewContainer=void 0),this._draggedRange&&(e&&this.isEnabled&&i.change(e=>{const t=i.createSelection(this._draggedRange);i.deleteContent(t,{doNotAutoparagraph:true});const n=t.getFirstPosition().parent;n.isEmpty&&!i.schema.checkChild(n,"$text")&&i.schema.checkChild(n,"paragraph")&&e.insertElement("paragraph",n,0);}),this._draggedRange.detach(),this._draggedRange=null);}_prepareDraggedRange(e){const t=this.editor,i=t.model,n=i.document.selection,s=e?mx(e):null;if(s){const e=t.editing.mapper.toModelElement(s);if(this._draggedRange=Sa.fromRange(i.createRangeOn(e)),this._blockMode=i.schema.isBlock(e),t.plugins.has("WidgetToolbarRepository")){t.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop");}return}if(n.isCollapsed&&!n.getFirstPosition().parent.isEmpty)return;const o=Array.from(n.getSelectedBlocks()),r=n.getFirstRange();if(0==o.length)return void(this._draggedRange=Sa.fromRange(r));const a=gx(i,o);if(o.length>1)this._draggedRange=Sa.fromRange(a),this._blockMode=true;else if(1==o.length){const e=r.start.isTouching(a.start)&&r.end.isTouching(a.end);this._draggedRange=Sa.fromRange(e?a:r),this._blockMode=e;}i.change(e=>e.setSelection(this._draggedRange.toRange()));}_updatePreview({dataTransfer:t,domTarget:i,clientX:s}){const o=this.editor.editing.view,r=o.document.selection.editableElement,a=o.domConverter.mapViewToDom(r),l=exports.global.window.getComputedStyle(a);this._previewContainer?this._previewContainer.firstElementChild&&this._previewContainer.removeChild(this._previewContainer.firstElementChild):(this._previewContainer=ii(exports.global.document,"div",{style:"position: fixed; left: -999999px;"}),exports.global.document.body.appendChild(this._previewContainer));const c=ii(exports.global.document,"div");c.className="ck ck-content ck-clipboard-preview";const u=new Ci(a),d=parseFloat(l.paddingLeft),h=parseFloat(l.paddingRight),m=parseFloat(l.width)-d-h;if(a.contains(i)){if(!n.isiOS)return;c.style.maxWidth=`${m}px`,c.style.padding="10px",c.style.minWidth="200px",c.style.minHeight="20px",c.style.boxSizing="border-box",c.style.backgroundColor="var(--ck-color-base-background)";}else if(n.isiOS)c.style.width=`${m}px`,c.style.backgroundColor="var(--ck-color-base-background)";else {const e=u.left-s+d;c.style.width=`${m+e}px`,c.style.paddingLeft=`${e}px`;}o.domConverter.setContentOf(c,t.getData("text/html")),t.setDragImage(c,0,0),this._previewContainer.appendChild(c);}}function hx(e){return n.isGecko?e.dropEffect:["all","copyMove"].includes(e.effectAllowed)?"move":"copy"}function mx(e){if(e.is("editableElement"))return null;if(e.hasClass("ck-widget__selection-handle"))return e.findAncestor(Qk);if(Qk(e))return e;const t=e.findAncestor(e=>Qk(e)||e.is("editableElement"));return Qk(t)?t:null}function gx(e,t){const i=t[0],n=t[t.length-1],s=i.getCommonAncestor(n),o=e.createPositionBefore(i),r=e.createPositionAfter(n);if(s&&s.is("element")&&!e.schema.isLimit(s)){const t=e.createRangeOn(s),i=o.isTouching(t.start),n=r.isTouching(t.end);if(i&&n)return gx(e,[s])}return e.createRange(o,r)}class fx extends Ms{static get pluginName(){return "PastePlainText"}static get isOfficialPlugin(){return  true}static get requires(){return [tx]}init(){const e=this.editor,t=e.model,i=e.editing.view,n=t.document.selection;i.addObserver(WC),e.plugins.get(tx).on("contentInsertion",(e,i)=>{(function(e,t){let i=t.createRangeIn(e);if(1==e.childCount){const n=e.getChild(0);n.is("element")&&t.schema.isBlock(n)&&!t.schema.isObject(n)&&!t.schema.isLimit(n)&&(i=t.createRangeIn(n));}for(const e of i.getItems()){if(!t.schema.isInline(e))return  false;if(Array.from(e.getAttributeKeys()).find(e=>t.schema.getAttributeProperties(e).isFormatting))return  false}return  true})(i.content,t)&&t.change(e=>{const s=Array.from(n.getAttributes()).filter(([e])=>t.schema.getAttributeProperties(e).isFormatting);n.isCollapsed||t.deleteContent(n,{doNotAutoparagraph:true}),s.push(...n.getAttributes());const o=e.createRangeIn(i.content);for(const i of o.getItems())for(const n of s)t.schema.checkAttribute(i,n[0])&&e.setAttribute(n[0],n[1],i);});});}}class px extends Ms{static get pluginName(){return "Clipboard"}static get isOfficialPlugin(){return  true}static get requires(){return [ex,tx,dx,fx]}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 bx{_definitions=new Set;_conflictChecker;get length(){return this._definitions.size}setConflictChecker(e){this._conflictChecker=e;}add(e){Array.isArray(e)?e.forEach(e=>this._definitions.add(e)):this._definitions.add(e);}getDispatcher(){return e=>{const t=(e,t)=>{const i=t.createAttributeElement("a",e.attributes,{priority:5});e.classes&&t.addClass(e.classes,i);for(const n in e.styles)t.setStyle(n,e.styles[n],i);return t.setCustomProperty("link",true,i),i},i=e=>(i,n,s)=>{if(n.attributeKey.startsWith("link")&&("linkHref"!=n.attributeKey||s.consumable.test(n.item,"attribute:linkHref"))&&(n.item.is("selection")||s.schema.isInline(n.item)))for(const i of this._definitions)i.callback(n.item.getAttribute("linkHref"))&&!this._conflictChecker?.(i,n.item)&&e?n.item.is("selection")?s.writer.wrap(s.writer.document.selection.getFirstRange(),t(i,s.writer)):s.writer.wrap(s.mapper.toViewRange(n.range),t(i,s.writer)):s.writer.unwrap(s.mapper.toViewRange(n.range),t(i,s.writer));};e.on("attribute",i(false),{priority:E.high-1}),e.on("attribute",i(true),{priority:E.high-2});}}getDispatcherForLinkedImage(){return e=>{const t=e=>(t,i,{writer:n,mapper:s})=>{if(!i.item.is("element","imageBlock")||!i.attributeKey.startsWith("link"))return;const o=s.toViewElement(i.item),r=Array.from(o.getChildren()).find(e=>e.is("element","a"));if(r)for(const t of this._definitions){const s=Vn(t.attributes);if(t.callback(i.item.getAttribute("linkHref"))&&!this._conflictChecker?.(t,i.item)&&e){for(const[e,t]of s)"class"===e?n.addClass(t,r):n.setAttribute(e,t,false,r);t.classes&&n.addClass(t.classes,r);for(const e in t.styles)n.setStyle(e,t.styles[e],r);}else {for(const[e,t]of s)"class"===e?n.removeClass(t,r):n.removeAttribute(e,t,r);t.classes&&n.removeClass(t.classes,r);for(const e in t.styles)n.removeStyle(e,r);}}};e.on("attribute",t(false),{priority:E.high-1}),e.on("attribute",t(true),{priority:E.high-2});}}}const wx=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,vx=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,_x=/^((\w+:(\/{2,})?)|(\W))/i,yx=["https?","ftps?","mailto"],kx="Ctrl+K";function Cx(e){return e.is("attributeElement")&&!!e.getCustomProperty("link")}function xx(e,{writer:t}){const i=t.createAttributeElement("a",{href:e},{priority:5});return t.setCustomProperty("link",true,i),i}function Ax(e,t=yx){const i=String(e),n=t.join("|");return function(e,t){const i=e.replace(wx,"");return !!i.match(t)}(i,new RegExp(`${"^(?:(?:<protocols>):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))".replace("<protocols>",n)}`,"i"))?i:"#"}function Ex(e,t){const i={"Open in a new tab":e("Open in a new tab"),Downloadable:e("Downloadable")};return t.forEach(e=>("label"in e&&i[e.label]&&(e.label=i[e.label]),e)),t}function Tx(e){const t=[];if(e)for(const[i,n]of Object.entries(e)){const e=Object.assign({},n,{id:`link${Nt(i)}`});t.push(e);}return t}function Sx(e,t){return !!e&&t.checkAttribute(e.name,"linkHref")}function Ix(e){return vx.test(e)}function Px(e,t){const i=Ix(e)?"mailto:":t,n=!!i&&!Vx(e);return e&&n?i+e:e}function Vx(e){return _x.test(e)}function Rx(e){window.open(e,"_blank","noopener");}function Ox(e){let t="";for(const i of e.getItems()){if(!i.is("$text")&&!i.is("$textProxy"))return;t+=i.data;}return t}function Bx(e,t){if(e.attributes&&t.attributes){const i=Object.keys(e.attributes).some(e=>!function(e){return "class"===e||"style"===e||"rel"===e}(e)&&e in t.attributes);if(i)return  true}if(e.styles&&t.styles){const i=Object.keys(e.styles).some(e=>e in t.styles);if(i)return  true}return  false}function Lx(e,t){const i=t.find(t=>t.id===e);return i?t.filter(t=>t.id!==e&&Bx(i,t)).map(e=>e.id):[]}class Mx extends Ns{manualDecorators=new kn;automaticDecorators=new bx;restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id);}refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement()||Cn(t.getSelectedBlocks());Sx(i,e.schema)?(this.value=i.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(i,"linkHref")):(this.value=t.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref"));for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id);}execute(e,t={},i){const n=this.editor.model,s=n.document.selection,o=function({decoratorStates:e,allDecorators:t}){const i={...e};for(const s in e)if(e[s]&&n(s)){const e=Lx(s,t);for(const t of e)i[t]=false;}function n(e){return t.some(t=>t.id===e&&!t.value)}return i}({allDecorators:Array.from(this.manualDecorators),decoratorStates:t}),r=[],a=[];for(const e in o)o[e]?r.push(e):a.push(e);n.change(t=>{const o=i=>{t.setAttribute("linkHref",e,i),r.forEach(e=>t.setAttribute(e,true,i)),a.forEach(e=>t.removeAttribute(e,i));},l=(s,r)=>{const a=Ox(s);if(!a)return s;let l=i;if(l||(l=r&&r==a?e:a),l!=a){const e=t.createDocumentFragment();for(const i of s.getItems()){const n=i;t.append(t.createText(n.data,n.getAttributes()),e);}const i=t.createRangeIn(e),r=function(e,t){const i=b(e,t),n={equal:0,insert:0,delete:0},s=[];let o="",r="";for(const a of [...i,null])"insert"==a?r+=t[n.equal+n.insert]:"delete"==a?o+=e[n.equal+n.delete]:(o.length||r.length)&&(s.push({offset:n.equal,actual:o,expected:r}),o="",r=""),a&&n[a]++;return s}(a,l);let c=0;for(const{offset:e,actual:s,expected:a}of r){const r=e+c,l=t.createRange(i.start.getShiftedBy(r),i.start.getShiftedBy(r+s.length)),u=Fx(l,i).getAttributes(),d=Array.from(u).filter(([e])=>n.schema.getAttributeProperties(e).isFormatting),h=t.createText(a,d);o(h),t.remove(l),t.insert(h,l.start),c+=a.length;}return n.insertContent(e,s),t.createRange(s.start,s.start.getShiftedBy(l.length))}},c=e=>{const{plugins:i}=this.editor;if(t.setSelection(e.end),i.has("TwoStepCaretMovement"))i.get("TwoStepCaretMovement")._handleForwardMovement();else for(const e of ["linkHref",...r,...a])t.removeSelectionAttribute(e);};if(s.isCollapsed){const a=s.getFirstPosition();if(s.hasAttribute("linkHref")){const e=s.getAttribute("linkHref"),t=Ly(a,"linkHref",e,n),i=l(t,e);o(i||t),i&&c(i);}else if(""!==e){const o=Vn(s.getAttributes());o.set("linkHref",e),r.forEach(e=>{o.set(e,true);});c(n.insertContent(t.createText(i||e,o),a));}}else {const e=Array.from(s.getRanges()),i=n.schema.getValidRanges(e,"linkHref"),r=[];for(const e of s.getSelectedBlocks())n.schema.checkAttribute(e,"linkHref")&&r.push(t.createRangeOn(e));const a=r.slice();for(const e of i)this._isRangeToUpdate(e,r)&&a.push(e);const c=e.map(e=>({start:Ec.fromPosition(e.start,"toPrevious"),end:Ec.fromPosition(e.end,"toNext")}));for(let e of a){e=l(e,(e.start.textNode||e.start.nodeAfter).getAttribute("linkHref"))||e,o(e);}t.setSelection(c.map(e=>{const t=e.start.toPosition(),i=e.end.toPosition();return e.start.detach(),e.end.detach(),n.createRange(t,i)}));}}),this.restoreManualDecoratorStates();}_getDecoratorStateFromModel(e){const t=this.editor.model,i=t.document.selection,n=i.getSelectedElement();return Sx(n,t.schema)?n.getAttribute(e):i.getAttribute(e)}_isRangeToUpdate(e,t){for(const i of t)if(i.containsRange(e))return  false;return  true}}function Fx(e,t){if(!e.isCollapsed)return Cn(e.getItems());const i=e.start;return i.textNode?i.textNode:!i.nodeBefore||i.isEqual(t.start)?i.nodeAfter:i.nodeBefore}class Nx extends Ns{refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement();Sx(i,e.schema)?this.isEnabled=e.schema.checkAttribute(i,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref");}execute(){const e=this.editor,t=this.editor.model,i=t.document.selection,n=e.commands.get("link");t.change(e=>{const s=i.isCollapsed?[Ly(i.getFirstPosition(),"linkHref",i.getAttribute("linkHref"),t)]:t.schema.getValidRanges(i.getRanges(),"linkHref");for(const t of s)if(e.removeAttribute("linkHref",t),n)for(const i of n.manualDecorators)e.removeAttribute(i.id,t);});}}class Dx extends($t()){id;defaultValue;label;attributes;classes;styles;constructor({id:e,label:t,attributes:i,classes:n,styles:s,defaultValue:o}){super(),this.id=e,this.set("value",void 0),this.defaultValue=o,this.label=t,this.attributes=i,this.classes=n,this.styles=s;}_createPattern(){return {attributes:this.attributes,classes:this.classes,styles:this.styles}}}const zx="automatic",Hx=/^(https?:)?\/\//;class qx extends Ms{_linkOpeners=[];static get pluginName(){return "LinkEditing"}static get isOfficialPlugin(){return  true}static get requires(){return [_y,oy,tx]}constructor(e){super(e),e.config.define("link",{allowCreatingEmptyLinks:false,addTargetToExternalLinks:false,toolbar:["linkPreview","|","editLink","linkProperties","unlink"]});}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:xx}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(e,i)=>xx(Ax(e,t),i)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:true}},model:{key:"linkHref",value:e=>e.getAttribute("href")}}),e.commands.add("link",new Mx(e)),e.commands.add("unlink",new Nx(e));const i=Ex(e.t,Tx(e.config.get("link.decorators")));this._enableAutomaticDecorators(i.filter(e=>e.mode===zx)),this._enableManualDecorators(i.filter(e=>"manual"===e.mode));e.plugins.get(_y).registerAttribute("linkHref"),Fy(e,"linkHref","a","ck-link_selected"),this._enableLinkOpen(),this._enableSelectionAttributesFixer(),this._enableClipboardIntegration(),this._enableDecoratorConflictPostfixer();}_registerLinkOpener(e){this._linkOpeners.push(e);}_enableAutomaticDecorators(e){const t=this.editor,i=t.commands.get("link"),n=i.automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&n.add({id:"linkIsExternal",mode:zx,callback:e=>!!e&&Hx.test(e),attributes:{target:"_blank",rel:"noopener noreferrer"}}),n.add(e),n.setConflictChecker((e,t)=>{for(const n of i.manualDecorators)if(t.hasAttribute(n.id)&&Bx(e,n))return  true}),n.length&&t.conversion.for("downcast").add(n.getDispatcher());}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,i=t.commands.get("link").manualDecorators;e.forEach(e=>{t.model.schema.extend("$text",{allowAttributes:e.id});const n=new Dx(e);i.add(n),t.conversion.for("downcast").add(e=>{const t=e=>{const t=e.createAttributeElement("a",n.attributes,{priority:5});n.classes&&e.addClass(n.classes,t);for(const i in n.styles)e.setStyle(i,n.styles[i],t);return e.setCustomProperty("link",true,t),t},i=e=>(i,n,s)=>{if(n.item.is("selection")||s.schema.isInline(n.item)){if(!e&&n.attributeOldValue){if(!s.consumable.test(n.item,i.name))return;s.writer.unwrap(s.mapper.toViewRange(n.range),t(s.writer));}if(e&&n.attributeNewValue){if(!s.consumable.consume(n.item,i.name))return;n.item.is("selection")?s.writer.wrap(s.writer.document.selection.getFirstRange(),t(s.writer)):s.writer.wrap(s.mapper.toViewRange(n.range),t(s.writer));}}};e.on(`attribute:${n.id}`,i(false),{priority:E.high-1}),e.on(`attribute:${n.id}`,i(true),{priority:E.high-2});}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",...n._createPattern()},model:{key:n.id}});});}_enableLinkOpen(){const e=this.editor,t=e.editing.view.document,i=e=>{this._linkOpeners.some(t=>t(e))||Rx(e);};this.listenTo(t,"click",(e,t)=>{if(!(n.isMac?t.domEvent.metaKey:t.domEvent.ctrlKey))return;let s=t.domTarget;if("a"!=s.tagName.toLowerCase()&&(s=s.closest("a")),!s)return;const o=s.getAttribute("href");o&&(e.stop(),t.preventDefault(),i(o));},{context:"$capture"}),this.listenTo(t,"keydown",(t,n)=>{const s=e.commands.get("link").value;!!s&&n.keyCode===on.enter&&n.altKey&&(t.stop(),i(s));});}_enableSelectionAttributesFixer(){const e=this.editor.model,t=e.document.selection;this.listenTo(t,"change:attribute",(i,{attributeKeys:n})=>{n.includes("linkHref")&&!t.hasAttribute("linkHref")&&e.change(t=>{var i;!function(e,t){e.removeSelectionAttribute("linkHref");for(const i of t)e.removeSelectionAttribute(i);}(t,(i=e.schema,i.getDefinition("$text").allowAttributes.filter(e=>e.startsWith("link"))));});});}_enableClipboardIntegration(){const e=this.editor,t=e.model,i=this.editor.config.get("link.defaultProtocol");i&&this.listenTo(e.plugins.get("ClipboardPipeline"),"contentInsertion",(e,n)=>{t.change(e=>{const t=e.createRangeIn(n.content);for(const n of t.getItems())if(n.hasAttribute("linkHref")){const t=Px(n.getAttribute("linkHref"),i);e.setAttribute("linkHref",t,n);}});});}_enableDecoratorConflictPostfixer(){const e=this.editor,t=e.model,i=e.commands.get("link");t.document.registerPostFixer(e=>{let n=false;const s=t.document.differ.getChanges(),o=new Set,r=new Set(i.manualDecorators.map(e=>e.id));for(const e of s){if("attribute"===e.type){if("linkHref"!==e.attributeKey&&!r.has(e.attributeKey))continue;for(const t of e.range.getItems())t.hasAttribute("linkHref")&&o.add(t);}"insert"===e.type&&e.attributes.has("linkHref")&&e.position.nodeAfter&&o.add(e.position.nodeAfter);}for(const t of o){const s=[];for(const o of i.manualDecorators)if(t.hasAttribute(o.id)){for(let i=s.length-1;i>=0;i--){const r=s[i];Bx(r,o)&&(e.removeAttribute(r.id,t),s.splice(i,1),n=true);}s.push(o);}}return n});}}class Ux extends Bp{constructor(e){super(e);const t=this.bindTemplate;this.set({href:void 0,withText:true}),this.extendTemplate({attributes:{class:["ck-link-toolbar__preview"],href:t.to("href"),target:"_blank",rel:"noopener noreferrer"},on:{click:t.to(e=>{if(this.href){const t=()=>e.preventDefault();this.fire("navigate",this.href,t);}})}}),this.template.tag="a";}}class jx extends Cs{focusTracker=new An;keystrokes=new In;backButtonView;saveButtonView;displayedTextInputView;urlInputView;children;providersListChildren;_validators;_focusables=new Xn;_focusCycler;constructor(e,t){super(e),this._validators=t,this.backButtonView=this._createBackButton(),this.saveButtonView=this._createSaveButton(),this.displayedTextInputView=this._createDisplayedTextInput(),this.urlInputView=this._createUrlInput(),this.providersListChildren=this.createCollection(),this.children=this.createCollection([this._createHeaderView()]),this._createFormChildren(),this.listenTo(this.providersListChildren,"add",()=>{this.stopListening(this.providersListChildren,"add"),this.children.add(this._createProvidersListView());}),this._focusCycler=new Fp({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-link-form","ck-responsive-form"],tabindex:"-1"},children:this.children});}render(){super.render(),Vs({view:this});[this.urlInputView,this.saveButtonView,...this.providersListChildren,this.backButtonView,this.displayedTextInputView].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,false}return  true}resetFormStatus(){this.urlInputView.errorText=null;}_createBackButton(){const e=this.locale.t,t=new Bp(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:Pf,tooltip:true}),t.delegate("execute").to(this,"cancel"),t}_createSaveButton(){const e=this.locale.t,t=new Bp(this.locale);return t.set({label:e("Insert"),tooltip:false,withText:true,type:"submit",class:"ck-button-action ck-button-bold"}),t}_createHeaderView(){const e=this.locale.t,t=new Mp(this.locale,{label:e("Link")});return t.children.add(this.backButtonView,0),t}_createProvidersListView(){const e=new Xb(this.locale);return e.extendTemplate({attributes:{class:["ck-link-form__providers-list"]}}),e.items.bindTo(this.providersListChildren).using(e=>{const t=new Qb(this.locale);return t.children.add(e),t}),e}_createDisplayedTextInput(){const e=this.locale.t,t=new Nb(this.locale,Sw);return t.label=e("Displayed text"),t.class="ck-labeled-field-view_full-width",t}_createUrlInput(){const e=this.locale.t,t=new Nb(this.locale,Sw);return t.fieldView.inputMode="url",t.label=e("Link URL"),t.class="ck-labeled-field-view_full-width",t}_createFormChildren(){this.children.add(new Jv(this.locale,{children:[this.displayedTextInputView],class:["ck-form__row_large-top-padding"]})),this.children.add(new Jv(this.locale,{children:[this.urlInputView,this.saveButtonView],class:["ck-form__row_with-submit","ck-form__row_large-top-padding","ck-form__row_large-bottom-padding"]}));}get url(){const{element:e}=this.urlInputView.fieldView;return e?e.value.trim():null}}class $x extends Cs{focusTracker=new An;keystrokes=new In;backButtonView;listView;listChildren;emptyListInformation;children;_focusables=new Xn;_focusCycler;constructor(e){super(e),this.listChildren=this.createCollection(),this.backButtonView=this._createBackButton(),this.listView=this._createListView(),this.emptyListInformation=this._createEmptyLinksListItemView(),this.children=this.createCollection([this._createHeaderView(),this.emptyListInformation]),this.set("title",""),this.set("emptyListPlaceholder",""),this.set("hasItems",false),this.listenTo(this.listChildren,"change",()=>{this.hasItems=this.listChildren.length>0;}),this.on("change:hasItems",(e,t,i)=>{i?(this.children.remove(this.emptyListInformation),this.children.add(this.listView)):(this.children.remove(this.listView),this.children.add(this.emptyListInformation));}),this.keystrokes.set("Esc",(e,t)=>{this.fire("cancel"),t();}),this._focusCycler=new Fp({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-providers"],tabindex:"-1"},children:this.children});}render(){super.render();[this.listView,this.backButtonView].forEach(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();}_createListView(){const e=new Xb(this.locale);return e.extendTemplate({attributes:{class:["ck-link-providers__list"]}}),e.items.bindTo(this.listChildren).using(e=>{const t=new Qb(this.locale);return t.children.add(e),t}),e}_createBackButton(){const e=this.locale.t,t=new Bp(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:Pf,tooltip:true}),t.delegate("execute").to(this,"cancel"),t}_createHeaderView(){const e=new Mp(this.locale);return e.bind("label").to(this,"title"),e.children.add(this.backButtonView,0),e}_createEmptyLinksListItemView(){const e=new Cs(this.locale);return e.setTemplate({tag:"p",attributes:{class:["ck","ck-link__empty-list-info"]},children:[{text:this.bindTemplate.to("emptyListPlaceholder")}]}),e}}class Wx extends Cs{focusTracker=new An;keystrokes=new In;backButtonView;children;listChildren;_focusables=new Xn;_focusCycler;constructor(e){super(e),this.backButtonView=this._createBackButton(),this.listChildren=this.createCollection(),this.children=this.createCollection([this._createHeaderView(),this._createListView()]),this._focusCycler=new Fp({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-properties"],tabindex:"-1"},children:this.children}),this.keystrokes.set("Esc",(e,t)=>{this.fire("back"),t();});}render(){super.render();[...this.listChildren,this.backButtonView].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();}_createBackButton(){const e=this.locale.t,t=new Bp(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:Pf,tooltip:true}),t.delegate("execute").to(this,"back"),t}_createHeaderView(){const e=this.locale.t,t=new Mp(this.locale,{label:e("Link properties")});return t.children.add(this.backButtonView,0),t}_createListView(){const e=new Xb(this.locale);return e.extendTemplate({attributes:{class:["ck-link__list"]}}),e.items.bindTo(this.listChildren).using(e=>{const t=new Qb(this.locale);return t.children.add(e),t}),e}}class Gx extends Bp{arrowView;constructor(e){super(e),this.set({withText:true}),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{class:["ck-link__button"]}});}render(){super.render(),this.children.add(this.arrowView);}_createArrowView(){const e=new Rp;return e.content=Zg,e}}const Kx="link-ui";class Jx extends Ms{toolbarView=null;formView=null;linkProviderItemsView=null;propertiesView=null;_balloon;_linksProviders=new kn;static get requires(){return [i_,qx]}static get pluginName(){return "LinkUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=this.editor.t;this.set("selectedLinkableText",void 0),e.editing.view.addObserver(vu),this._balloon=e.plugins.get(i_),this._registerComponents(),this._registerEditingOpeners(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:Kx,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:Kx,view:(e,{writer:t})=>{if(!e.markerRange.isCollapsed)return null;const i=t.createUIElement("span");return t.addClass(["ck-fake-link-selection","ck-fake-link-selection_collapsed"],i),i}}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Create link"),keystroke:kx},{label:t("Move out of a link"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]});}destroy(){super.destroy(),this.propertiesView&&this.propertiesView.destroy(),this.formView&&this.formView.destroy(),this.toolbarView&&this.toolbarView.destroy(),this.linkProviderItemsView&&this.linkProviderItemsView.destroy();}registerLinksListProvider(e){const t=this._linksProviders.filter(t=>(t.order||0)<=(e.order||0)).length;this._linksProviders.add(e,t);}_createViews(){const e=this.editor.commands.get("link");this.toolbarView=this._createToolbarView(),this.formView=this._createFormView(),e.manualDecorators.length&&(this.propertiesView=this._createPropertiesView()),this._enableUserBalloonInteractions();}_createToolbarView(){const e=this.editor,t=new mw(e.locale),i=e.commands.get("link");t.class="ck-link-toolbar";let n=e.config.get("link.toolbar");return i.manualDecorators.length||(n=n.filter(e=>"linkProperties"!==e)),t.fillFromConfig(n,e.ui.componentFactory),t.keystrokes.set("Esc",(e,t)=>{this._hideUI(),t();}),t.keystrokes.set(kx,(e,t)=>{this._addFormView(),t();}),e.ui.addToolbar(t,{isContextual:true,beforeFocus:()=>{this._getSelectedLinkElement()&&!this._isToolbarVisible&&this._showUI(true);},afterBlur:()=>{this._hideUI(false);}}),t}_createFormView(){const e=this.editor,t=e.locale.t,i=e.commands.get("link"),n=e.config.get("link.defaultProtocol"),s=new(Is(jx))(e.locale,function(e){const t=e.t,i=e.config.get("link.allowCreatingEmptyLinks");return [e=>{if(!i&&!e.url.length)return t("Link URL must not be empty.")}]}(e));return s.displayedTextInputView.bind("isEnabled").to(this,"selectedLinkableText",e=>void 0!==e),s.urlInputView.bind("isEnabled").to(i,"isEnabled"),s.saveButtonView.bind("isEnabled").to(i,"isEnabled"),s.saveButtonView.bind("label").to(i,"value",e=>t(e?"Update":"Insert")),this.listenTo(s,"submit",()=>{if(s.isValid()){const t=Px(s.urlInputView.fieldView.element.value,n),i=s.displayedTextInputView.fieldView.element.value;e.execute("link",t,this._getDecoratorSwitchesState(),i!==this.selectedLinkableText?i:void 0),this._closeFormView();}}),this.listenTo(s.urlInputView,"change:errorText",()=>{e.ui.update();}),this.listenTo(s,"cancel",()=>{this._closeFormView();}),s.keystrokes.set("Esc",(e,t)=>{this._closeFormView(),t();}),s.providersListChildren.bindTo(this._linksProviders).using(e=>this._createLinksListProviderButton(e)),s}_createLinkProviderListView(e){return e.getListItems().map(({href:e,label:t,icon:i})=>{const n=new Bp;return n.set({label:t,icon:i,tooltip:false,withText:true}),n.on("execute",()=>{this.formView.resetFormStatus(),this.formView.urlInputView.fieldView.value=e,this.editor.editing.view.focus(),this._removeLinksProviderView(),this.formView.focus();}),n})}_createLinkProviderItemsView(e){const t=this.editor,i=t.locale.t,n=new $x(t.locale),{emptyListPlaceholder:s,label:o}=e;return n.emptyListPlaceholder=s||i("No links available"),n.title=o,this.listenTo(n,"cancel",()=>{t.editing.view.focus(),this._removeLinksProviderView(),this.formView.focus();}),n}_createPropertiesView(){const e=this.editor,t=this.editor.commands.get("link"),i=new(Is(Wx))(e.locale);return this.listenTo(i,"back",()=>{e.editing.view.focus(),this._removePropertiesView();}),i.listChildren.bindTo(t.manualDecorators).using(i=>{const n=new rb(e.locale);return n.set({label:i.label,withText:true}),n.bind("isOn").toMany([i,t],"value",(e,t)=>void 0===t&&void 0===e?!!i.defaultValue:!!e),n.on("execute",()=>{e.execute("link",t.value,{...this._getDecoratorSwitchesState(),[i.id]:!n.isOn});}),n}),i}_getDecoratorSwitchesState(){const e=this.editor.commands.get("link");return Array.from(e.manualDecorators).reduce((t,i)=>{const n=void 0===e.value&&void 0===i.value?i.defaultValue:i.value;return {...t,[i.id]:!!n}},{})}_registerEditingOpeners(){this.editor.plugins.get(qx)._registerLinkOpener(e=>{const t=this._getLinkProviderLinkByHref(e);if(!t)return  false;const{item:i,provider:n}=t;return !!n.navigate&&n.navigate(i)});}_registerComponents(){const e=this.editor;e.ui.componentFactory.add("link",()=>{const e=this._createButton(Bp);return e.set({tooltip:true}),e}),e.ui.componentFactory.add("menuBar:link",()=>{const e=this._createButton(Jp);return e.set({role:"menuitemcheckbox"}),e}),e.ui.componentFactory.add("linkPreview",t=>{const i=new Ux(t),n=e.config.get("link.allowedProtocols"),s=e.commands.get("link"),o=t.t;i.bind("isEnabled").to(s,"value",e=>!!e),i.bind("href").to(s,"value",e=>e&&Ax(e,n));const r=e=>{if(!e)return i.label=void 0,i.icon=void 0,void(i.tooltip=o("Open link in new tab"));const t=this._getLinkProviderLinkByHref(e);if(t){const{label:e,tooltip:n,icon:s}=t.item;i.label=e,i.tooltip=n||false,i.icon=s;}else i.label=e,i.icon=void 0,i.tooltip=o("Open link in new tab");};return r(s.value),this.listenTo(s,"change:value",(e,t,i)=>{r(i);}),this.listenTo(i,"navigate",(e,t,i)=>{const n=this._getLinkProviderLinkByHref(t);if(!n)return;const{provider:s,item:o}=n,{navigate:r}=s;r&&r(o)&&(e.stop(),i());}),i}),e.ui.componentFactory.add("unlink",t=>{const i=e.commands.get("unlink"),n=new Bp(t),s=t.t;return n.set({label:s("Unlink"),icon:xp,tooltip:true}),n.bind("isEnabled").to(i),this.listenTo(n,"execute",()=>{e.execute("unlink"),this._hideUI();}),n}),e.ui.componentFactory.add("editLink",t=>{const i=e.commands.get("link"),n=new Bp(t),s=t.t;return n.set({label:s("Edit link"),icon:xf,tooltip:true}),n.bind("isEnabled").to(i),this.listenTo(n,"execute",()=>{this._addFormView();}),n}),e.ui.componentFactory.add("linkProperties",t=>{const i=e.commands.get("link"),n=new Bp(t),s=t.t;return n.set({label:s("Link properties"),icon:jf,tooltip:true}),n.bind("isEnabled").to(i,"isEnabled",i,"value",i,"manualDecorators",(e,t,i)=>e&&!!t&&i.length>0),this.listenTo(n,"execute",()=>{this._addPropertiesView();}),n});}_createLinksListProviderButton(e){const t=this.editor.locale,i=new Gx(t);return i.set({label:e.label}),this.listenTo(i,"execute",()=>{this._showLinksProviderView(e);}),i}_createButton(e){const t=this.editor,i=t.locale,n=t.commands.get("link"),s=new e(t.locale),o=i.t;return s.set({label:o("Link"),icon:Vg,keystroke:kx,isToggleable:true}),s.bind("isEnabled").to(n,"isEnabled"),s.bind("isOn").to(n,"value",e=>!!e),this.listenTo(s,"execute",()=>{t.editing.view.scrollToTheSelection(),this._showUI(true),this._getSelectedLinkElement()&&this._addFormView();}),s}_enableBalloonActivators(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",()=>{this._getSelectedLinkElement()&&this._showUI();}),e.keystrokes.set(kx,(t,i)=>{i(),e.commands.get("link").isEnabled&&(e.editing.view.scrollToTheSelection(),this._showUI(true));});}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",(e,t)=>{this._isToolbarVisible&&!this.toolbarView.focusTracker.isFocused&&(this.toolbarView.focus(),t());},{priority:"high"}),this.editor.keystrokes.set("Esc",(e,t)=>{this._isUIVisible&&(this._hideUI(),t());}),Ss({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>{this._hideUI(false);}});}_addToolbarView(){this.toolbarView||this._createViews(),this._isToolbarInPanel||this._balloon.add({view:this.toolbarView,position:this._getBalloonPositionData(),balloonClassName:"ck-toolbar-container"});}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;const e=this.editor.commands.get("link");this.formView.disableCssTransitions(),this.formView.resetFormStatus(),this.formView.backButtonView.isVisible=e.isEnabled&&!!e.value,this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this.selectedLinkableText=this._getSelectedLinkableText(),this.formView.displayedTextInputView.fieldView.value=this.selectedLinkableText||"",this.formView.urlInputView.fieldView.value=e.value||"",this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions();}_addPropertiesView(){this.propertiesView||this._createViews(),this._arePropertiesInPanel||(this.propertiesView.disableCssTransitions(),this._balloon.add({view:this.propertiesView,position:this._getBalloonPositionData()}),this.propertiesView.enableCssTransitions(),this.propertiesView.focus());}_showLinksProviderView(e){this.linkProviderItemsView&&this._removeLinksProviderView(),this.linkProviderItemsView=this._createLinkProviderItemsView(e),this._addLinkProviderItemsView(e);}_addLinkProviderItemsView(e){this.linkProviderItemsView.listChildren.clear(),this.linkProviderItemsView.listChildren.addMany(this._createLinkProviderListView(e)),this._balloon.add({view:this.linkProviderItemsView,position:this._getBalloonPositionData()}),this.linkProviderItemsView.focus();}_closeFormView(){const e=this.editor.commands.get("link");this.selectedLinkableText=void 0,void 0!==e.value?this._removeFormView():this._hideUI();}_removePropertiesView(){this._arePropertiesInPanel&&this._balloon.remove(this.propertiesView);}_removeLinksProviderView(){this._isLinksListInPanel&&this._balloon.remove(this.linkProviderItemsView);}_removeFormView(e=true){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this.formView.displayedTextInputView.fieldView.reset(),this.formView.urlInputView.fieldView.reset(),this._balloon.remove(this.formView),e&&this.editor.editing.view.focus(),this._hideFakeVisualSelection());}_showUI(e=false){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._isToolbarVisible?this._addFormView():this._addToolbarView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addToolbarView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI();}_hideUI(e=true){const t=this.editor;this._isUIInPanel&&(this.stopListening(t.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e&&t.editing.view.focus(),this._removeLinksProviderView(),this._removePropertiesView(),this._removeFormView(e),this._isToolbarInPanel&&this._balloon.remove(this.toolbarView),this._hideFakeVisualSelection());}_startUpdatingUI(){const e=this.editor,t=e.editing.view.document;let i=this._getSelectedLinkElement(),n=o();const s=()=>{const e=this._getSelectedLinkElement(),t=o();i&&!e||!i&&t!==n?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),i=e,n=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 _arePropertiesInPanel(){return !!this.propertiesView&&this._balloon.hasView(this.propertiesView)}get _isLinksListInPanel(){return !!this.linkProviderItemsView&&this._balloon.hasView(this.linkProviderItemsView)}get _isFormInPanel(){return !!this.formView&&this._balloon.hasView(this.formView)}get _isToolbarInPanel(){return !!this.toolbarView&&this._balloon.hasView(this.toolbarView)}get _isPropertiesVisible(){return !!this.propertiesView&&this._balloon.visibleView===this.propertiesView}get _isFormVisible(){return !!this.formView&&this._balloon.visibleView==this.formView}get _isToolbarVisible(){return !!this.toolbarView&&this._balloon.visibleView===this.toolbarView}get _isUIInPanel(){return this._arePropertiesInPanel||this._isLinksListInPanel||this._isFormInPanel||this._isToolbarInPanel}get _isUIVisible(){return this._isPropertiesVisible||this._isLinksListInPanel||this._isFormVisible||this._isToolbarVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=e.document;if(this.editor.model.markers.has(Kx)){const t=this.editor.editing.mapper.markerNameToElements(Kx);if(t){const i=Array.from(t),n=e.createRange(e.createPositionBefore(i[0]),e.createPositionAfter(i[i.length-1]));return {target:e.domConverter.viewRangeToDom(n)}}}return {target:()=>{const i=this._getSelectedLinkElement();return i?e.domConverter.mapViewToDom(i):e.domConverter.viewRangeToDom(t.selection.getFirstRange())}}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection,i=t.getSelectedElement();if(t.isCollapsed||i&&Qk(i))return Qx(t.getFirstPosition());{const i=t.getFirstRange().getTrimmed(),n=Qx(i.start),s=Qx(i.end);return n&&n==s&&e.createRangeIn(n).getTrimmed().isEqual(i)?n:null}}_getSelectedLinkableText(){const e=this.editor.model,t=this.editor.editing,i=this._getSelectedLinkElement();if(!i)return Ox(e.document.selection.getFirstRange());const n=t.view.createRangeOn(i);return Ox(t.mapper.toModelRange(n))}_getLinkProviderLinkByHref(e){if(!e)return null;for(const t of this._linksProviders){const i=t.getItem?t.getItem(e):t.getListItems().find(t=>t.href===e);if(i)return {provider:t,item:i}}return null}_showFakeVisualSelection(){const e=this.editor.model;e.change(t=>{const i=e.document.selection.getFirstRange();if(e.markers.has(Kx))t.updateMarker(Kx,{range:i});else if(i.start.isAtEnd){const n=i.start.getLastMatchingPosition(({item:t})=>!e.schema.isContent(t),{boundaries:i});t.addMarker(Kx,{usingOperation:false,affectsData:false,range:t.createRange(n,i.end)});}else t.addMarker(Kx,{usingOperation:false,affectsData:false,range:i});});}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(Kx)&&e.change(e=>{e.removeMarker(Kx);});}}function Qx(e){return e.getAncestors().find(e=>Cx(e))||null}const Yx=new RegExp("(^|\\s)(((?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(((?!www\\.)|(www\\.))(?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.)+(?:[a-z\\u00a1-\\uffff]{2,63}))|localhost)(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i");class Zx extends Ms{static get requires(){return [py,qx]}static get pluginName(){return "AutoLink"}static get isOfficialPlugin(){return  true}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")?Ly(t,"linkHref",t.textNode.getAttribute("linkHref"),e):null}_selectEntireLinks(e,t){const i=this.editor.model,n=i.document.selection,s=n.getFirstPosition(),o=n.getLastPosition();let r=t.getJoined(this._expandLinkRange(i,s)||t);r&&(r=r.getJoined(this._expandLinkRange(i,o)||t)),r&&(r.start.isBefore(s)||r.end.isAfter(o))&&e.setSelection(r);}_enablePasteLinking(){const e=this.editor,t=e.model,i=t.document.selection,n=e.plugins.get("ClipboardPipeline"),s=e.commands.get("link");n.on("inputTransformation",(e,n)=>{if(!this.isEnabled||!s.isEnabled||i.isCollapsed||"paste"!==n.method)return;if(i.rangeCount>1)return;const o=i.getFirstRange(),r=n.dataTransfer.getData("text/plain");if(!r)return;const a=r.match(Yx);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 vy(e.model,e=>{let t=e;if(!function(e){return e.length>4&&" "===e[e.length-1]&&" "!==e[e.length-2]}(t))return;t=t.slice(0,-1),"!.:,;?".includes(t[t.length-1])&&(t=t.slice(0,-1));const i=Xx(t);return i?{url:i,removedTrailingCharacters:e.length-t.length}:void 0});t.on("matched:data",(t,i)=>{const{batch:n,range:s,url:o,removedTrailingCharacters:r}=i;if(!n.isTyping)return;const a=s.end.getShiftedBy(-r),l=a.getShiftedBy(-o.length),c=e.model.createRange(l,a);this._applyAutoLink(o,c);}),t.bind("isEnabled").to(this);}_enableEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("enter");i&&i.on("execute",()=>{const e=t.document.selection.getFirstPosition();let i;i=e.parent.previousSibling?.is("element")?t.createRangeIn(e.parent.previousSibling):t.createRange(t.createPositionAt(e.parent,0),e),this._checkAndApplyAutoLinkOnRange(i);});}_enableShiftEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("shiftEnter");i&&i.on("execute",()=>{const e=t.document.selection.getFirstPosition(),i=t.createRange(t.createPositionAt(e.parent,0),e.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(i);});}_checkAndApplyAutoLinkOnRange(e){const t=this.editor.model,{text:i,range:n}=wy(e,t),s=Xx(i);if(s){const e=t.createRange(n.end.getShiftedBy(-s.length),n.end);this._applyAutoLink(s,e);}}_applyAutoLink(e,t){const i=this.editor.model,n=Px(e,this.editor.config.get("link.defaultProtocol"));this.isEnabled&&function(e,t){return t.schema.checkAttributeInSelection(t.createSelection(e),"linkHref")}(t,i)&&Vx(n)&&!function(e){const t=e.start.nodeAfter;return !!t&&t.hasAttribute("linkHref")}(t)&&this._persistAutoLink(n,t);}_persistAutoLink(e,t){const i=this.editor.model,n=this.editor.plugins.get("Delete");i.enqueueChange(s=>{s.setAttribute("linkHref",e,t),i.enqueueChange(()=>{n.requestUndoOnBackspace();});});}}function Xx(e){const t=Yx.exec(e);return t?t[2]:null}class eA extends Ms{static get requires(){return [qx,Jx,Zx]}static get pluginName(){return "Link"}static get isOfficialPlugin(){return  true}}class tA extends Ns{_stack=[];_createdBatches=new WeakSet;constructor(e){super(e),this.refresh(),this._isEnabledBasedOnSelection=false,this.listenTo(e.data,"set",(e,t)=>{t[1]={...t[1]};const i=t[1];i.batchType||(i.batchType={isUndoable:false});},{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,i={ranges:t.hasOwnRange?Array.from(t.getRanges()):[],isBackward:t.isBackward};this._stack.push({batch:e,selection:i}),this.refresh();}clearStack(){this._stack=[],this.refresh();}_restoreSelection(e,t,i){const n=this.editor.model,s=n.document,o=[],r=e.map(e=>e.getTransformedByOperations(i)),a=r.flat();for(const e of r){const t=e.filter(e=>e.root!=s.graveyard).filter(e=>!nA(e,a));t.length&&(iA(t),o.push(t[0]));}o.length&&n.change(e=>{e.setSelection(o,{backward:t});});}_undo(e,t){const i=this.editor.model,n=i.document;this._createdBatches.add(t);const s=e.operations.slice().filter(e=>e.isDocumentOperation);s.reverse();for(const e of s){const s=e.baseVersion+1,o=Array.from(n.history.getOperations(s)),r=wc([e.getReversed()],o,{useRelations:true,document:this.editor.model.document,padWithNoOps:false,forceWeakRemove:true}).operationsA;for(let s of r){const o=s.affectedSelectable;o&&!i.canEditAt(o)&&(s=new lc(s.baseVersion)),t.addOperation(s),i.applyOperation(s),n.history.setOperationAsUndone(e,s);}}}}function iA(e){e.sort((e,t)=>e.start.isBefore(t.start)?-1:1);for(let t=1;t<e.length;t++){const i=e[t-1].getJoined(e[t],true);i&&(t--,e.splice(t,2,i));}}function nA(e,t){return t.some(t=>t!==e&&t.containsRange(e,true))}class sA extends tA{execute(e=null){const t=e?this._stack.findIndex(t=>t.batch==e):this._stack.length-1,i=this._stack.splice(t,1)[0],n=this.editor.model.createBatch({isUndo:true});this.editor.model.enqueueChange(n,()=>{this._undo(i.batch,n);const e=this.editor.model.document.history.getOperations(i.batch.baseVersion);this._restoreSelection(i.selection.ranges,i.selection.isBackward,e);}),this.fire("revert",i.batch,n),this.refresh();}}class oA extends tA{execute(){const e=this._stack.pop(),t=this.editor.model.createBatch({isUndo:true});this.editor.model.enqueueChange(t,()=>{const i=e.batch.operations[e.batch.operations.length-1].baseVersion+1,n=this.editor.model.document.history.getOperations(i);this._restoreSelection(e.selection.ranges,e.selection.isBackward,n),this._undo(e.batch,t);}),this.fire("revert",e.batch,t),this.refresh();}}class rA extends Ms{_undoCommand;_redoCommand;_batchRegistry=new WeakSet;static get pluginName(){return "UndoEditing"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.t;this._undoCommand=new sA(e),this._redoCommand=new oA(e),e.commands.add("undo",this._undoCommand),e.commands.add("redo",this._redoCommand),this.listenTo(e.model,"applyOperation",(e,t)=>{const i=t[0];if(!i.isDocumentOperation)return;const n=i.batch,s=this._redoCommand.createdBatches.has(n),o=this._undoCommand.createdBatches.has(n);this._batchRegistry.has(n)||(this._batchRegistry.add(n),n.isUndoable&&(s?this._undoCommand.addBatch(n):o||(this._undoCommand.addBatch(n),this._redoCommand.clearStack())));},{priority:"highest"}),this.listenTo(this._undoCommand,"revert",(e,t,i)=>{this._redoCommand.addBatch(i);}),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 aA extends Ms{static get pluginName(){return "UndoUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.locale,i=e.t,n="ltr"==t.uiLanguageDirection?Cp:Bf,s="ltr"==t.uiLanguageDirection?Bf:Cp;this._addButtonsToFactory("undo",i("Undo"),"CTRL+Z",n),this._addButtonsToFactory("redo",i("Redo"),"CTRL+Y",s);}_addButtonsToFactory(e,t,i,n){const s=this.editor;s.ui.componentFactory.add(e,()=>{const s=this._createButton(Bp,e,t,i,n);return s.set({tooltip:true}),s}),s.ui.componentFactory.add("menuBar:"+e,()=>this._createButton(Jp,e,t,i,n));}_createButton(e,t,i,n,s){const o=this.editor,r=o.locale,a=o.commands.get(t),l=new e(r);return l.set({label:i,icon:s,keystroke:n}),l.bind("isEnabled").to(a,"isEnabled"),this.listenTo(l,"execute",()=>{o.execute(t),o.editing.view.focus();}),l}}class lA extends Ms{static get requires(){return [rA,aA]}static get pluginName(){return "Undo"}static get isOfficialPlugin(){return  true}}function cA(e){return e.createContainerElement("span",{class:"image-inline"},e.createEmptyElement("img"))}function uA(e){return e.createContainerElement("figure",{class:"image"},[e.createEmptyElement("img"),e.createSlot("children")])}function dA(e,t){const i=e.plugins.get("ImageUtils"),n=e.plugins.has("ImageInlineEditing")&&e.plugins.has("ImageBlockEditing");return e=>{if(!i.isInlineImageView(e))return null;if(!n)return s(e);return ("block"==e.getStyle("display")||e.findAncestor(i.isBlockImageView)?"imageBlock":"imageInline")!==t?null:s(e)};function s(e){const t={name:true};return e.hasAttribute("src")&&(t.attributes=["src"]),t}}function hA(e,t){const i=Cn(t.getSelectedBlocks());return !i||e.isObject(i)||i.isEmpty&&"listItem"!=i.name?"imageBlock":"imageInline"}function mA(e){return e&&e.endsWith("px")?parseInt(e):null}function gA(e){const t=mA(e.getStyle("width")),i=mA(e.getStyle("height"));return !(!t||!i)}const fA=/^(image|image-inline)$/;class pA extends Ms{_domEmitter=new(ci());static get pluginName(){return "ImageUtils"}static get isOfficialPlugin(){return  true}isImage(e){return this.isInlineImage(e)||this.isBlockImage(e)}isInlineImageView(e){return !!e&&e.is("element","img")}isBlockImageView(e){return !!e&&e.is("element","figure")&&e.hasClass("image")}insertImage(e={},t=null,i=null,n={}){const s=this.editor,o=s.model,r=o.document.selection,a=bA(s,t||r,i);e={...Object.fromEntries(r.getAttributes()),...e};for(const t in e)o.schema.checkAttribute(a,t)||delete e[t];return o.change(i=>{const{setImageSizes:s=true}=n,r=i.createElement(a,e);return o.insertObject(r,t,null,{setSelection:"on",findOptimalPosition:t||"imageInline"==a?void 0:"auto"}),r.parent?(s&&this.setImageNaturalSizeAttributes(r),r):null})}setImageNaturalSizeAttributes(t){const i=t.getAttribute("src");i&&(t.getAttribute("width")||t.getAttribute("height")||this.editor.model.change(n=>{const s=new exports.global.window.Image;this._domEmitter.listenTo(s,"load",()=>{t.getAttribute("width")||t.getAttribute("height")||this.editor.model.enqueueChange(n.batch,e=>{e.setAttribute("width",s.naturalWidth,t),e.setAttribute("height",s.naturalHeight,t);}),this._domEmitter.stopListening(s,"load");}),s.src=i;}));}getClosestSelectedImageWidget(e){const t=e.getFirstPosition();if(!t)return null;const i=e.getSelectedElement();if(i&&this.isImageWidget(i))return i;let n=t.parent;for(;n;){if(n.is("element")&&this.isImageWidget(n))return n;n=n.parent;}return null}getClosestSelectedImageElement(e){const t=e.getSelectedElement();return this.isImage(t)?t:e.getFirstPosition().findAncestor("imageBlock")}getImageWidgetFromImageView(e){return e.findAncestor({classes:fA})}isImageAllowed(){const e=this.editor.model.document.selection;return function(e,t){const i=bA(e,t,null);if("imageBlock"==i){const i=function(e,t){const i=sC(e,t),n=i.start.parent;if(n.isEmpty&&!n.is("element","$root"))return n.parent;return n}(t,e.model);if(e.model.schema.checkChild(i,"imageBlock"))return  true}else if(e.model.schema.checkChild(t.focus,"imageInline"))return  true;return  false}(this.editor,e)&&function(e){return [...e.focus.getAncestors()].every(e=>!e.is("element","imageBlock"))}(e)}toImageWidget(e,t,i){t.setCustomProperty("image",true,e);return Yk(e,t,{label:()=>{const t=this.findViewImgElement(e).getAttribute("alt");return t?`${t} ${i}`:i}})}isImageWidget(e){return !!e.getCustomProperty("image")&&Qk(e)}isBlockImage(e){return !!e&&e.is("element","imageBlock")}isInlineImage(e){return !!e&&e.is("element","imageInline")}findViewImgElement(e){if(this.isInlineImageView(e))return e;const t=this.editor.editing.view;for(const{item:i}of t.createRangeIn(e))if(this.isInlineImageView(i))return i}destroy(){return this._domEmitter.stopListening(),super.destroy()}}function bA(e,t,i){const n=e.model.schema,s=e.config.get("image.insert.type");return e.plugins.has("ImageBlockEditing")?e.plugins.has("ImageInlineEditing")?i||("inline"===s?"imageInline":"auto"!==s?"imageBlock":t.is("selection")?hA(n,t):n.checkChild(t,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}const wA=new RegExp(String(/^(http(s)?:\/\/)?[\w-]+\.[\w.~:/[\]@!$&'()*+,;=%-]+/.source+/\.(jpg|jpeg|png|gif|ico|webp|JPG|JPEG|PNG|GIF|ICO|WEBP)/.source+/(\?[\w.~:/[\]@!$&'()*+,;=%-]*)?/.source+/(#[\w.~:/[\]@!$&'()*+,;=%-]*)?$/.source));class vA extends Ms{static get requires(){return [px,pA,lA,py]}static get pluginName(){return "AutoImage"}static get isOfficialPlugin(){return  true}_timeoutId;_positionToInsert;constructor(e){super(e),this._timeoutId=null,this._positionToInsert=null;}init(){const t=this.editor,i=t.model.document,n=t.plugins.get("ClipboardPipeline");this.listenTo(n,"inputTransformation",()=>{const e=i.selection.getFirstRange(),t=Ec.fromPosition(e.start);t.stickiness="toPrevious";const n=Ec.fromPosition(e.end);n.stickiness="toNext",i.once("change:data",()=>{this._embedImageBetweenPositions(t,n),t.detach(),n.detach();},{priority:"high"});}),t.commands.get("undo").on("execute",()=>{this._timeoutId&&(exports.global.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null);},{priority:"high"});}_embedImageBetweenPositions(e,t){const i=this.editor,n=new Sa(e,t),s=n.getWalker({ignoreElementEnd:true}),o=Object.fromEntries(i.model.document.selection.getAttributes()),r=this.editor.plugins.get("ImageUtils");let a="";for(const e of s)e.item.is("$textProxy")&&(a+=e.item.data);a=a.trim(),a.match(wA)?(this._positionToInsert=Ec.fromPosition(e),this._timeoutId=setTimeout(()=>{if(!i.commands.get("insertImage").isEnabled)return void n.detach();i.model.change(e=>{let t;this._timeoutId=null,e.remove(n),n.detach(),"$graveyard"!==this._positionToInsert.root.rootName&&(t=this._positionToInsert.toPosition()),r.insertImage({...o,src:a},t),this._positionToInsert.detach(),this._positionToInsert=null;});i.plugins.get("Delete").requestUndoOnBackspace();},100)):n.detach();}}class _A extends Ns{refresh(){const e=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!e,this.isEnabled&&e.hasAttribute("alt")?this.value=e.getAttribute("alt"):this.value=false;}execute(e){const t=this.editor,i=t.plugins.get("ImageUtils"),n=t.model,s=i.getClosestSelectedImageElement(n.document.selection);n.change(t=>{t.setAttribute("alt",e.newValue,s);});}}class yA extends Ms{static get requires(){return [pA]}static get pluginName(){return "ImageTextAlternativeEditing"}static get isOfficialPlugin(){return  true}init(){this.editor.commands.add("imageTextAlternative",new _A(this.editor));}}class kA extends Cs{focusTracker;keystrokes;labeledInput;backButtonView;saveButtonView;children;_focusables;_focusCycler;constructor(e){super(e),this.focusTracker=new An,this.keystrokes=new In,this.backButtonView=this._createBackButton(),this.saveButtonView=this._createSaveButton(),this.labeledInput=this._createLabeledInputView(),this.children=this.createCollection([this._createHeaderView()]),this.children.add(new Jv(e,{children:[this.labeledInput,this.saveButtonView],class:["ck-form__row_with-submit","ck-form__row_large-top-padding"]})),this._focusables=new Xn,this.keystrokes.set("Esc",(e,t)=>{this.fire("cancel"),t();}),this._focusCycler=new Fp({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-text-alternative-form","ck-responsive-form"],tabindex:"-1"},children:this.children});}render(){super.render(),Vs({view:this});[this.backButtonView,this.labeledInput,this.saveButtonView].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();}_createBackButton(){const e=this.locale.t,t=new Bp(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:Pf,tooltip:true}),t.delegate("execute").to(this,"cancel"),t}_createSaveButton(){const e=this.locale.t,t=new Bp(this.locale);return t.set({label:e("Save"),withText:true,type:"submit",class:"ck-button-action ck-button-bold"}),t}_createHeaderView(){const e=this.locale.t,t=new Mp(this.locale,{label:e("Text Alternative")});return t.children.add(this.backButtonView,0),t}_createLabeledInputView(){const e=this.locale.t,t=new Nb(this.locale,Sw);return t.label=e("Text alternative"),t.class="ck-labeled-field-view_full-width",t}}function CA(e){const t=e.plugins.get("ContextualBalloon");if(e.plugins.get("ImageUtils").getClosestSelectedImageWidget(e.editing.view.document.selection)){const i=xA(e);t.updatePosition(i);}}function xA(e){const t=e.editing.view,i=eb.defaultPositions,n=e.plugins.get("ImageUtils");return {target:t.domConverter.mapViewToDom(n.getClosestSelectedImageWidget(t.document.selection)),positions:[i.northArrowSouth,i.northArrowSouthWest,i.northArrowSouthEast,i.southArrowNorth,i.southArrowNorthWest,i.southArrowNorthEast,i.viewportStickyNorth]}}class AA extends Ms{_balloon;_form;static get requires(){return [i_]}static get pluginName(){return "ImageTextAlternativeUI"}static get isOfficialPlugin(){return  true}init(){this._createButton();}destroy(){super.destroy(),this._form&&this._form.destroy();}_createButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("imageTextAlternative",i=>{const n=e.commands.get("imageTextAlternative"),s=new Bp(i);return s.set({label:t("Change image text alternative"),icon:dp,tooltip:true}),s.bind("isEnabled").to(n,"isEnabled"),s.bind("isOn").to(n,"value",e=>!!e),this.listenTo(s,"execute",()=>{this._showForm();}),s});}_createForm(){const e=this.editor,t=e.editing.view.document,i=e.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(Is(kA))(e.locale),this._form.render(),this.listenTo(this._form,"submit",()=>{e.execute("imageTextAlternative",{newValue:this._form.labeledInput.fieldView.element.value}),this._hideForm(true);}),this.listenTo(this._form,"cancel",()=>{this._hideForm(true);}),this.listenTo(e.ui,"update",()=>{i.getClosestSelectedImageWidget(t.selection)?this._isVisible&&CA(e):this._hideForm(true);}),Ss({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()});}_showForm(){if(this._isVisible)return;this._form||this._createForm();const e=this.editor,t=e.commands.get("imageTextAlternative"),i=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:xA(e)}),i.fieldView.value=i.fieldView.element.value=t.value||"",this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions();}_hideForm(e=false){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),e&&this.editor.editing.view.focus());}get _isVisible(){return !!this._balloon&&this._balloon.visibleView===this._form}get _isInBalloon(){return !!this._balloon&&this._balloon.hasView(this._form)}}class EA extends Ms{static get requires(){return [yA,AA]}static get pluginName(){return "ImageTextAlternative"}static get isOfficialPlugin(){return  true}}function TA(e){const t=(t,i,n)=>{if(!n.consumable.test(i.viewItem,{name:true,classes:"image"}))return;const s=e.findViewImgElement(i.viewItem);if(!s||!n.consumable.test(s,{name:true}))return;n.consumable.consume(i.viewItem,{name:true,classes:"image"});const o=Cn(n.convertItem(s,i.modelCursor).modelRange.getItems());o?(n.convertChildren(i.viewItem,o),n.updateConversionResult(o,i)):n.consumable.revert(i.viewItem,{name:true,classes:"image"});};return e=>{e.on("element:figure",t);}}function SA(e){const t=["srcset","media","type","sizes"],i=(i,n,s)=>{const o=n.viewItem;if(!s.consumable.test(o,{name:true}))return;const r=new Map;for(const e of o.getChildren())if(e.is("element","source")){const i={};for(const n of t)e.hasAttribute(n)&&s.consumable.test(e,{attributes:n})&&(i[n]=e.getAttribute(n));Object.keys(i).length&&r.set(e,i);}const a=e.findViewImgElement(o);if(!a)return;let l=n.modelCursor.parent;if(!l.is("element","imageBlock")){const e=s.convertItem(a,n.modelCursor);n.modelRange=e.modelRange,n.modelCursor=e.modelCursor,l=Cn(e.modelRange.getItems());}s.consumable.consume(o,{name:true});for(const[e,t]of r)s.consumable.consume(e,{attributes:Object.keys(t)});r.size&&s.writer.setAttribute("sources",Array.from(r.values()),l),s.convertChildren(o,l);};return e=>{e.on("element:picture",i);}}function IA(e,t){const i=(t,i,n)=>{if(!n.consumable.consume(i.item,t.name))return;const s=n.writer,o=n.mapper.toViewElement(i.item),r=e.findViewImgElement(o);null===i.attributeNewValue?(s.removeAttribute("srcset",r),s.removeAttribute("sizes",r)):i.attributeNewValue&&(s.setAttribute("srcset",i.attributeNewValue,r),s.setAttribute("sizes","100vw",r));};return e=>{e.on(`attribute:srcset:${t}`,i);}}function PA(e){const t=(t,i,n)=>{if(!n.consumable.consume(i.item,t.name))return;const s=n.writer,o=n.mapper.toViewElement(i.item),r=e.findViewImgElement(o),a=i.attributeNewValue;if(a&&a.length){const e=[];let t=r.parent;for(;t&&t.is("attributeElement");){const i=t.parent;s.unwrap(s.createRangeOn(r),t),e.unshift(t),t=i;}const i=r.parent.is("element","picture"),n=i?r.parent:s.createContainerElement("picture",null);i||s.insert(s.createPositionBefore(r),n),s.remove(s.createRangeIn(n)),s.insert(s.createPositionAt(n,"end"),a.map(e=>s.createEmptyElement("source",e))),s.move(s.createRangeOn(r),s.createPositionAt(n,"end"));for(const t of e)s.wrap(s.createRangeOn(n),t);}else if(r.parent.is("element","picture")){const e=r.parent;s.move(s.createRangeOn(r),s.createPositionBefore(e)),s.remove(e);}};return e=>{e.on("attribute:sources:imageBlock",t),e.on("attribute:sources:imageInline",t);}}function VA(e,t,i){const n=(t,i,n)=>{if(!n.consumable.consume(i.item,t.name))return;const s=n.writer,o=n.mapper.toViewElement(i.item),r=e.findViewImgElement(o);s.setAttribute(i.attributeKey,i.attributeNewValue||"",r);};return e=>{e.on(`attribute:${i}:${t}`,n);}}class RA extends zr{observe(e){this.listenTo(e,"load",(e,t)=>{const i=t.target;this.checkShouldIgnoreEventFromTarget(i)||"IMG"==i.tagName&&this._fireEvents(t);},{useCapture:true});}stopObserving(e){this.stopListening(e);}_fireEvents(e){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",e));}}class OA extends Ns{constructor(e){super(e);const t=e.config.get("image.insert.type");e.plugins.has("ImageBlockEditing")||"block"===t&&P("image-block-plugin-required"),e.plugins.has("ImageInlineEditing")||"inline"===t&&P("image-inline-plugin-required");}refresh(){const e=this.editor.plugins.get("ImageUtils");this.isEnabled=e.isImageAllowed();}execute(e){const t=pn(e.source),i=this.editor.model.document.selection,n=this.editor.plugins.get("ImageUtils"),s=Object.fromEntries(i.getAttributes());t.forEach((t,o)=>{const r=i.getSelectedElement();if("string"==typeof t&&(t={src:t}),o&&r&&n.isImage(r)){const i=this.editor.model.createPositionAfter(r);n.insertImage({...t,...s},i,e.imageType);}else e.breakBlock?n.insertImage({...t,...s},i.getFirstPosition(),e.imageType):n.insertImage({...t,...s},null,e.imageType);});}}class BA extends Ns{constructor(e){super(e),this.decorate("cleanupImage");}refresh(){const e=this.editor.plugins.get("ImageUtils"),t=this.editor.model.document.selection.getSelectedElement();this.isEnabled=e.isImage(t),this.value=this.isEnabled?t.getAttribute("src"):null;}execute(e){const t=this.editor.model.document.selection.getSelectedElement(),i=this.editor.plugins.get("ImageUtils");this.editor.model.change(n=>{n.setAttribute("src",e.source,t),this.cleanupImage(n,t),i.setImageNaturalSizeAttributes(t);});}cleanupImage(e,t){e.removeAttribute("srcset",t),e.removeAttribute("sizes",t),e.removeAttribute("sources",t),e.removeAttribute("width",t),e.removeAttribute("height",t),e.removeAttribute("alt",t);}}class LA extends Ms{static get requires(){return [pA]}static get pluginName(){return "ImageEditing"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.conversion;e.editing.view.addObserver(RA),t.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:"srcset"});const i=new OA(e),n=new BA(e);e.commands.add("insertImage",i),e.commands.add("replaceImageSource",n),e.commands.add("imageInsert",i);}}class MA extends Ms{static get requires(){return [pA]}static get pluginName(){return "ImageSizeAttributes"}static get isOfficialPlugin(){return  true}afterInit(){this._registerSchema(),this._registerConverters("imageBlock"),this._registerConverters("imageInline");}_registerSchema(){const e=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&e.extend("imageBlock",{allowAttributes:["width","height"]}),this.editor.plugins.has("ImageInlineEditing")&&e.extend("imageInline",{allowAttributes:["width","height"]});}_registerConverters(e){const t=this.editor,i=t.plugins.get("ImageUtils"),n="imageBlock"===e?"figure":"img";function s(t,n,s,o,r=false){t.on(`attribute:${n}:${e}`,(t,n,a)=>{if(!a.consumable.consume(n.item,t.name))return;const l=a.writer,c=a.mapper.toViewElement(n.item),u=i.findViewImgElement(c);null!==n.attributeNewValue?l.setAttribute(s,n.attributeNewValue,u):l.removeAttribute(s,u);const d=n.item.getAttribute("width"),h=n.item.getAttribute("height"),m=d&&h;if(m&&r&&l.setAttribute("loading","lazy",u),n.item.hasAttribute("sources"))return;const g=n.item.hasAttribute("resizedWidth");("imageInline"!==e||g||o)&&m&&l.setStyle("aspect-ratio",`${d}/${h}`,u);});}t.conversion.for("upcast").attributeToAttribute({view:{name:n,styles:{width:/.+/}},model:{key:"width",value:e=>gA(e)?mA(e.getStyle("width")):null}}).attributeToAttribute({view:{name:n,key:"width"},model:"width"}).attributeToAttribute({view:{name:n,styles:{height:/.+/}},model:{key:"height",value:e=>gA(e)?mA(e.getStyle("height")):null}}).attributeToAttribute({view:{name:n,key:"height"},model:"height"}),t.conversion.for("editingDowncast").add(e=>{s(e,"width","width",true,true),s(e,"height","height",true,true);}),t.conversion.for("dataDowncast").add(e=>{s(e,"width","width",false),s(e,"height","height",false);}),t.conversion.for("upcast").add(e=>{e.on("element:img",(e,t,i)=>{const n=t.viewItem.getAttribute("width"),s=t.viewItem.getAttribute("height");n&&s&&i.consumable.consume(t.viewItem,{styles:["aspect-ratio"]});});});}}class FA extends Ns{_modelElementName;constructor(e,t){super(e),this._modelElementName=t;}refresh(){const e=this.editor.plugins.get("ImageUtils"),t=e.getClosestSelectedImageElement(this.editor.model.document.selection);"imageBlock"===this._modelElementName?this.isEnabled=e.isInlineImage(t):this.isEnabled=e.isBlockImage(t);}execute(e={}){const t=this.editor,i=this.editor.model,n=t.plugins.get("ImageUtils"),s=n.getClosestSelectedImageElement(i.document.selection),o=Object.fromEntries(s.getAttributes());return o.src||o.uploadId?i.change(t=>{const{setImageSizes:r=true}=e,a=Array.from(i.markers).filter(e=>e.getRange().containsItem(s)),l=n.insertImage(o,i.createSelection(s,"on"),this._modelElementName,{setImageSizes:r});if(!l)return null;const c=t.createRangeOn(l);for(const e of a){const i=e.getRange(),n="$graveyard"!=i.root.rootName?i.getJoined(c,true):c;t.updateMarker(e,{range:n});}return {oldElement:s,newElement:l}}):null}}class NA extends Ms{static get requires(){return [pA]}static get pluginName(){return "ImagePlaceholder"}static get isOfficialPlugin(){return  true}afterInit(){this._setupSchema(),this._setupConversion(),this._setupLoadListener();}_setupSchema(){const e=this.editor.model.schema;e.isRegistered("imageBlock")&&e.extend("imageBlock",{allowAttributes:["placeholder"]}),e.isRegistered("imageInline")&&e.extend("imageInline",{allowAttributes:["placeholder"]});}_setupConversion(){const e=this.editor,t=e.conversion,i=e.plugins.get("ImageUtils");t.for("editingDowncast").add(e=>{e.on("attribute:placeholder",(e,t,n)=>{if(!n.consumable.test(t.item,e.name))return;if(!t.item.is("element","imageBlock")&&!t.item.is("element","imageInline"))return;n.consumable.consume(t.item,e.name);const s=n.writer,o=n.mapper.toViewElement(t.item),r=i.findViewImgElement(o);t.attributeNewValue?(s.addClass("image_placeholder",r),s.setStyle("background-image",`url(${t.attributeNewValue})`,r),s.setCustomProperty("editingPipeline:doNotReuseOnce",true,r)):(s.removeClass("image_placeholder",r),s.removeStyle("background-image",r));});});}_setupLoadListener(){const e=this.editor,t=e.model,i=e.editing,n=i.view,s=e.plugins.get("ImageUtils");n.addObserver(RA),this.listenTo(n.document,"imageLoaded",(e,o)=>{const r=n.domConverter.mapDomToView(o.target);if(!r)return;const a=s.getImageWidgetFromImageView(r);if(!a)return;const l=i.mapper.toModelElement(a);l&&l.hasAttribute("placeholder")&&t.enqueueChange({isUndoable:false},e=>{e.removeAttribute("placeholder",l);});});}}class DA extends Ms{static get requires(){return [LA,MA,pA,NA,tx]}static get pluginName(){return "ImageBlockEditing"}static get isOfficialPlugin(){return  true}init(){const e=this.editor;e.model.schema.register("imageBlock",{inheritAllFrom:"$blockObject",allowAttributes:["alt","src","srcset"]}),this._setupConversion(),e.plugins.has("ImageInlineEditing")&&(e.commands.add("imageTypeBlock",new FA(this.editor,"imageBlock")),this._setupClipboardIntegration());}_setupConversion(){const e=this.editor,t=e.t,i=e.conversion,n=e.plugins.get("ImageUtils");i.for("dataDowncast").elementToStructure({model:"imageBlock",view:(e,{writer:t})=>uA(t)}),i.for("editingDowncast").elementToStructure({model:"imageBlock",view:(e,{writer:i})=>n.toImageWidget(uA(i),i,t("image widget"))}),i.for("downcast").add(VA(n,"imageBlock","src")).add(VA(n,"imageBlock","alt")).add(IA(n,"imageBlock")),i.for("upcast").elementToElement({view:dA(e,"imageBlock"),model:(e,{writer:t})=>t.createElement("imageBlock",e.hasAttribute("src")?{src:e.getAttribute("src")}:void 0)}).add(TA(n));}_setupClipboardIntegration(){const e=this.editor,t=e.model,i=e.editing.view,n=e.plugins.get("ImageUtils"),s=e.plugins.get("ClipboardPipeline");this.listenTo(s,"inputTransformation",(s,o)=>{const r=Array.from(o.content.getChildren());let a;if(!r.every(n.isInlineImageView))return;a=o.targetRanges?e.editing.mapper.toModelRange(o.targetRanges[0]):t.document.selection.getFirstRange();const l=t.createSelection(a);if("imageBlock"===hA(t.schema,l)){const e=new Cu(i.document),t=r.map(t=>e.createElement("figure",{class:"image"},t));o.content=e.createDocumentFragment(t);}}),this.listenTo(s,"contentInsertion",(e,i)=>{"paste"===i.method&&t.change(e=>{const t=e.createRangeIn(i.content);for(const e of t.getItems())e.is("element","imageBlock")&&n.setImageNaturalSizeAttributes(e);});});}}class zA extends Cs{focusTracker;keystrokes;_focusables;_focusCycler;children;constructor(e,t=[]){super(e),this.focusTracker=new An,this.keystrokes=new In,this._focusables=new Xn,this.children=this.createCollection(),this._focusCycler=new Fp({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});for(const e of t)this.children.add(e),this._focusables.add(e),e instanceof db&&this._focusables.addMany(e.children);this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-insert-form"],tabindex:-1},children:this.children});}render(){super.render(),Vs({view:this});for(const e of this._focusables)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element);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);}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy();}focus(){this._focusCycler.focusFirst();}}class HA extends Ms{static get pluginName(){return "ImageInsertUI"}static get isOfficialPlugin(){return  true}static get requires(){return [pA]}dropdownView;_integrations=new Map;constructor(e){super(e),e.config.define("image.insert.integrations",["upload","assetManager","url"]);}init(){const e=this.editor,t=e.model.document.selection,i=e.plugins.get("ImageUtils");this.set("isImageSelected",false),this.listenTo(e.model.document,"change",()=>{this.isImageSelected=i.isImage(t.getSelectedElement());});const n=e=>this._createToolbarComponent(e);e.ui.componentFactory.add("insertImage",n),e.ui.componentFactory.add("imageInsert",n),e.ui.componentFactory.add("menuBar:insertImage",e=>this._createMenuBarComponent(e));}registerIntegration({name:e,observable:t,buttonViewCreator:i,formViewCreator:n,menuBarButtonViewCreator:s,requiresForm:o=false,override:r=false}){this._integrations.has(e)&&!r&&P("image-insert-integration-exists",{name:e}),this._integrations.set(e,{observable:t,buttonViewCreator:i,menuBarButtonViewCreator:s,formViewCreator:n,requiresForm:o});}_createToolbarComponent(e){const t=this.editor,i=e.t,n=this._prepareIntegrations();if(!n.length)return null;let s;const o=n[0];if(1==n.length){if(!o.requiresForm)return o.buttonViewCreator(true);s=o.buttonViewCreator(true);}else {const t=o.buttonViewCreator(false);s=new bw(e,t),s.tooltip=true,s.bind("label").to(this,"isImageSelected",e=>i(e?"Replace image":"Insert image"));}const r=this.dropdownView=ww(e,s),a=n.map(({observable:e})=>"function"==typeof e?e():e);return r.bind("isEnabled").toMany(a,"isEnabled",(...e)=>e.some(e=>e)),r.once("change:isOpen",()=>{const e=n.flatMap(({formViewCreator:e})=>e(1==n.length)),i=new zA(t.locale,e);r.panelView.children.add(i);}),r}_createMenuBarComponent(e){const t=e.t,i=this._prepareIntegrations();if(!i.length)return null;const n=i.flatMap(({menuBarButtonViewCreator:e})=>e(1==i.length)),s=new x_(e),o=new A_(e);s.panelView.children.add(o),s.buttonView.set({icon:_g,label:t("Image")});for(const t of n){const i=new Av(e,s);i.children.add(t),o.items.add(i),t.delegate("execute").to(s);}return s}_prepareIntegrations(){const e=this.editor.config.get("image.insert.integrations"),t=[];if(!e.length)return P("image-insert-integrations-not-specified"),t;for(const i of e)this._integrations.has(i)?t.push(this._integrations.get(i)):["upload","assetManager","url"].includes(i)||P("image-insert-unknown-integration",{item:i});return t.length||P("image-insert-integrations-not-registered"),t}}class qA extends Ms{static get requires(){return [DA,kC,EA,HA]}static get pluginName(){return "ImageBlock"}static get isOfficialPlugin(){return  true}}class UA extends Ms{static get requires(){return [LA,MA,pA,NA,tx]}static get pluginName(){return "ImageInlineEditing"}static get isOfficialPlugin(){return  true}init(){const e=this.editor;e.model.schema.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"],disallowIn:["caption"]}),this._setupConversion(),e.plugins.has("ImageBlockEditing")&&(e.commands.add("imageTypeInline",new FA(this.editor,"imageInline")),this._setupClipboardIntegration());}_setupConversion(){const e=this.editor,t=e.t,i=e.conversion,n=e.plugins.get("ImageUtils");i.for("dataDowncast").elementToElement({model:"imageInline",view:(e,{writer:t})=>t.createEmptyElement("img")}),i.for("editingDowncast").elementToStructure({model:"imageInline",view:(e,{writer:i})=>n.toImageWidget(cA(i),i,t("image widget"))}),i.for("downcast").add(VA(n,"imageInline","src")).add(VA(n,"imageInline","alt")).add(IA(n,"imageInline")),i.for("upcast").elementToElement({view:dA(e,"imageInline"),model:(e,{writer:t})=>t.createElement("imageInline",e.hasAttribute("src")?{src:e.getAttribute("src")}:void 0)});}_setupClipboardIntegration(){const e=this.editor,t=e.model,i=e.editing.view,n=e.plugins.get("ImageUtils"),s=e.plugins.get("ClipboardPipeline");this.listenTo(s,"inputTransformation",(s,o)=>{const r=Array.from(o.content.getChildren());let a;if(!r.every(n.isBlockImageView))return;a=o.targetRanges?e.editing.mapper.toModelRange(o.targetRanges[0]):t.document.selection.getFirstRange();const l=t.createSelection(a);if("imageInline"===hA(t.schema,l)){const e=new Cu(i.document),t=r.map(t=>1===t.childCount?(Array.from(t.getAttributes()).forEach(i=>e.setAttribute(...i,n.findViewImgElement(t))),t.getChild(0)):t);o.content=e.createDocumentFragment(t);}}),this.listenTo(s,"contentInsertion",(e,i)=>{"paste"===i.method&&t.change(e=>{const t=e.createRangeIn(i.content);for(const e of t.getItems())e.is("element","imageInline")&&n.setImageNaturalSizeAttributes(e);});});}}class jA extends Ms{static get requires(){return [UA,kC,EA,HA]}static get pluginName(){return "ImageInline"}static get isOfficialPlugin(){return  true}}class $A extends Ms{static get requires(){return [qA,jA]}static get pluginName(){return "Image"}static get isOfficialPlugin(){return  true}}class WA extends Ms{static get pluginName(){return "ImageCaptionUtils"}static get isOfficialPlugin(){return  true}static get requires(){return [pA]}getCaptionFromImageModelElement(e){for(const t of e.getChildren())if(t&&t.is("element","caption"))return t;return null}getCaptionFromModelSelection(e){const t=this.editor.plugins.get("ImageUtils"),i=e.getFirstPosition().findAncestor("caption");return i&&t.isBlockImage(i.parent)?i:null}matchImageCaptionViewElement(e){const t=this.editor.plugins.get("ImageUtils");return "figcaption"==e.name&&t.isBlockImageView(e.parent)?{name:true}:null}}class GA extends Ns{refresh(){const e=this.editor,t=e.plugins.get("ImageCaptionUtils"),i=e.plugins.get("ImageUtils");if(!e.plugins.has(DA))return this.isEnabled=false,void(this.value=false);const n=e.model.document.selection,s=n.getSelectedElement();if(!s){const e=t.getCaptionFromModelSelection(n);return this.isEnabled=!!e,void(this.value=!!e)}this.isEnabled=i.isImage(s),this.isEnabled?this.value=!!t.getCaptionFromImageModelElement(s):this.value=false;}execute(e={}){const{focusCaptionOnShow:t}=e;this.editor.model.change(e=>{this.value?this._hideImageCaption(e):this._showImageCaption(e,t);});}_showImageCaption(e,t){const i=this.editor.model.document.selection,n=this.editor.plugins.get("ImageCaptionEditing"),s=this.editor.plugins.get("ImageUtils");let o=i.getSelectedElement();const r=n._getSavedCaption(o);s.isInlineImage(o)&&(this.editor.execute("imageTypeBlock"),o=i.getSelectedElement());const a=r||e.createElement("caption");e.append(a,o),t&&e.setSelection(a,"in");}_hideImageCaption(e){const t=this.editor,i=t.model.document.selection,n=t.plugins.get("ImageCaptionEditing"),s=t.plugins.get("ImageCaptionUtils");let o,r=i.getSelectedElement();r?o=s.getCaptionFromImageModelElement(r):(o=s.getCaptionFromModelSelection(i),r=o.parent),n._saveCaption(r,o),e.setSelection(r,"on"),e.remove(o);}}class KA extends Ms{static get requires(){return [pA,WA]}static get pluginName(){return "ImageCaptionEditing"}static get isOfficialPlugin(){return  true}_savedCaptionsMap;constructor(e){super(e),this._savedCaptionsMap=new WeakMap;}init(){const e=this.editor,t=e.model.schema;t.isRegistered("caption")?t.extend("caption",{allowIn:"imageBlock"}):t.register("caption",{allowIn:"imageBlock",allowContentOf:"$block",isLimit:true}),e.commands.add("toggleImageCaption",new GA(this.editor)),this._setupConversion(),this._setupImageTypeCommandsIntegration(),this._registerCaptionReconversion();}_setupConversion(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageUtils"),n=e.plugins.get("ImageCaptionUtils"),s=e.t;e.conversion.for("upcast").elementToElement({view:e=>n.matchImageCaptionViewElement(e),model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(e,{writer:t})=>i.isBlockImage(e.parent)?t.createContainerElement("figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(e,{writer:n})=>{if(!i.isBlockImage(e.parent))return null;const o=n.createEditableElement("figcaption");n.setCustomProperty("imageCaption",true,o),o.placeholder=s("Enter image caption"),Ks({view:t,element:o,keepOnFocus:true});const r=e.parent.getAttribute("alt");return nC(o,n,{label:r?s("Caption for image: %0",[r]):s("Caption for the image")})}});}_setupImageTypeCommandsIntegration(){const e=this.editor,t=e.plugins.get("ImageUtils"),i=e.plugins.get("ImageCaptionUtils"),n=e.commands.get("imageTypeInline"),s=e.commands.get("imageTypeBlock"),o=e=>{if(!e.return)return;const{oldElement:n,newElement:s}=e.return;if(!n)return;if(t.isBlockImage(n)){const e=i.getCaptionFromImageModelElement(n);if(e)return void this._saveCaption(s,e)}const o=this._getSavedCaption(n);o&&this._saveCaption(s,o);};n&&this.listenTo(n,"execute",o,{priority:"low"}),s&&this.listenTo(s,"execute",o,{priority:"low"});}_getSavedCaption(e){const t=this._savedCaptionsMap.get(e);return t?Fa.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON());}_registerCaptionReconversion(){const e=this.editor,t=e.model,i=e.plugins.get("ImageUtils"),n=e.plugins.get("ImageCaptionUtils");t.document.on("change:data",()=>{const s=t.document.differ.getChanges();for(const t of s){if("alt"!==t.attributeKey)continue;const s=t.range.start.nodeAfter;if(i.isBlockImage(s)){const t=n.getCaptionFromImageModelElement(s);if(!t)return;e.editing.reconvertItem(t);}}});}}class JA extends Ms{static get requires(){return [WA]}static get pluginName(){return "ImageCaptionUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageCaptionUtils"),n=e.t;e.ui.componentFactory.add("toggleImageCaption",s=>{const o=e.commands.get("toggleImageCaption"),r=new Bp(s);return r.set({icon:bm,tooltip:true,isToggleable:true}),r.bind("isOn","isEnabled").to(o,"value","isEnabled"),r.bind("label").to(o,"value",e=>n(e?"Toggle caption off":"Toggle caption on")),this.listenTo(r,"execute",()=>{e.execute("toggleImageCaption",{focusCaptionOnShow:true});const n=i.getCaptionFromModelSelection(e.model.document.selection);if(n){const i=e.editing.mapper.toViewElement(n);t.scrollToTheSelection(),t.change(e=>{e.addClass("image__caption_highlighted",i);});}e.editing.view.focus();}),r});}}class QA extends Ms{static get requires(){return [KA,JA]}static get pluginName(){return "ImageCaption"}static get isOfficialPlugin(){return  true}}function YA(e){const t=e.map(e=>e.replace("+","\\+"));return new RegExp(`^image\\/(${t.join("|")})$`)}function ZA(t){return new Promise((i,n)=>{const s=t.getAttribute("src");fetch(s).then(e=>e.blob()).then(e=>{const t=eE(e,s),n=t.replace("image/",""),o=new File([e],`image.${n}`,{type:t});i(o);}).catch(t=>t&&"TypeError"===t.name?function(t){return function(t){return new Promise((i,n)=>{const s=exports.global.document.createElement("img");s.addEventListener("load",()=>{const t=exports.global.document.createElement("canvas");t.width=s.width,t.height=s.height;t.getContext("2d").drawImage(s,0,0),t.toBlob(e=>e?i(e):n());}),s.addEventListener("error",()=>n()),s.src=t;})}(t).then(e=>{const i=eE(e,t),n=i.replace("image/","");return new File([e],`image.${n}`,{type:i})})}(s).then(i).catch(n):n(t));})}function XA(e,t){return !(!e.isInlineImageView(t)||!t.getAttribute("src"))&&(!!t.getAttribute("src").match(/^data:image\/\w+;base64,/g)||!!t.getAttribute("src").match(/^blob:/g))}function eE(e,t){return e.type?e.type:t.match(/data:(image\/\w+);base64/)?t.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}class tE extends Ms{static get pluginName(){return "ImageUploadUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor;e.ui.componentFactory.add("uploadImage",()=>this._createToolbarButton()),e.ui.componentFactory.add("imageUpload",()=>this._createToolbarButton()),e.ui.componentFactory.add("menuBar:uploadImage",()=>this._createMenuBarButton("standalone")),e.plugins.has("ImageInsertUI")&&e.plugins.get("ImageInsertUI").registerIntegration({name:"upload",observable:()=>e.commands.get("uploadImage"),buttonViewCreator:()=>this._createToolbarButton(),formViewCreator:()=>this._createDropdownButton(),menuBarButtonViewCreator:e=>this._createMenuBarButton(e?"insertOnly":"insertNested")});}_createButton(e){const t=this.editor,i=t.locale,n=t.commands.get("uploadImage"),s=t.config.get("image.upload.types"),o=YA(s),r=new e(t.locale),a=i.t;return r.set({acceptedType:s.map(e=>`image/${e}`).join(","),allowMultipleFiles:true,label:a("Upload from computer"),icon:yg}),r.bind("isEnabled").to(n),r.on("done",(e,i)=>{const n=Array.from(i).filter(e=>o.test(e.type));n.length&&(t.execute("uploadImage",{file:n}),t.editing.view.focus());}),r}_createToolbarButton(){const e=this.editor.locale.t,t=this.editor.plugins.get("ImageInsertUI"),i=this.editor.commands.get("uploadImage"),n=this._createButton(ab);return n.tooltip=true,n.bind("label").to(t,"isImageSelected",i,"isAccessAllowed",(t,i)=>e(i?t?"Replace image from computer":"Upload image from computer":"You have no image upload permissions.")),n}_createDropdownButton(){const e=this.editor.locale.t,t=this.editor.plugins.get("ImageInsertUI"),i=this._createButton(ab);return i.withText=true,i.bind("label").to(t,"isImageSelected",t=>e(t?"Replace from computer":"Upload from computer")),i.on("execute",()=>{t.dropdownView.isOpen=false;}),i}_createMenuBarButton(e){const t=this.editor.locale.t,i=this._createButton(T_);switch(i.withText=true,e){case "standalone":i.label=t("Image from computer");break;case "insertOnly":i.label=t("Image");break;case "insertNested":i.label=t("From computer");}return i}}class iE extends Ms{static get pluginName(){return "ImageUploadProgress"}static get isOfficialPlugin(){return  true}placeholder;constructor(e){super(e),this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";}init(){const e=this.editor;e.plugins.has("ImageBlockEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageBlock",this.uploadStatusChange),e.plugins.has("ImageInlineEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageInline",this.uploadStatusChange);}uploadStatusChange=(e,t,i)=>{const n=this.editor,s=t.item,o=s.getAttribute("uploadId");if(!i.consumable.consume(t.item,e.name))return;const r=n.plugins.get("ImageUtils"),a=n.plugins.get(V_),l=o?t.attributeNewValue:null,c=this.placeholder,u=n.editing.mapper.toViewElement(s),d=i.writer;if("reading"==l)return nE(u,d),void sE(r,c,u,d);if("uploading"==l){const e=a.loaders.get(o);return nE(u,d),void(e?(oE(u,d),function(e,t,i,n){const s=function(e){const t=e.createUIElement("div",{class:"ck-progress-bar"});return e.setCustomProperty("progressBar",true,t),t}(t);t.insert(t.createPositionAt(e,"end"),s),i.on("change:uploadedPercent",(e,t,i)=>{n.change(e=>{e.setStyle("width",i+"%",s);});});}(u,d,e,n.editing.view),function(e,t,i,n){if(n.data){const s=e.findViewImgElement(t);i.setAttribute("src",n.data,s);}}(r,u,d,e)):sE(r,c,u,d))}"complete"==l&&a.loaders.get(o)&&function(e,t,i){const n=t.createUIElement("div",{class:"ck-image-upload-complete-icon"});t.insert(t.createPositionAt(e,"end"),n),setTimeout(()=>{i.change(e=>e.remove(e.createRangeOn(n)));},3e3);}(u,d,n.editing.view),function(e,t){aE(e,t,"progressBar");}(u,d),oE(u,d),function(e,t){t.removeClass("ck-appear",e);}(u,d);}}function nE(e,t){e.hasClass("ck-appear")||t.addClass("ck-appear",e);}function sE(e,t,i,n){i.hasClass("ck-image-upload-placeholder")||n.addClass("ck-image-upload-placeholder",i);const s=e.findViewImgElement(i);s.getAttribute("src")!==t&&n.setAttribute("src",t,s),rE(i,"placeholder")||n.insert(n.createPositionAfter(s),function(e){const t=e.createUIElement("div",{class:"ck-upload-placeholder-loader"});return e.setCustomProperty("placeholder",true,t),t}(n));}function oE(e,t){e.hasClass("ck-image-upload-placeholder")&&t.removeClass("ck-image-upload-placeholder",e),aE(e,t,"placeholder");}function rE(e,t){for(const i of e.getChildren())if(i.getCustomProperty(t))return i}function aE(e,t,i){const n=rE(e,i);n&&t.remove(t.createRangeOn(n));}class lE extends Ns{constructor(e){super(e),this.set("isAccessAllowed",true);}refresh(){const e=this.editor,t=e.plugins.get("ImageUtils"),i=e.model.document.selection.getSelectedElement();this.isEnabled=t.isImageAllowed()||t.isImage(i);}execute(e){const t=pn(e.file),i=this.editor.model.document.selection,n=this.editor.plugins.get("ImageUtils"),s=Object.fromEntries(i.getAttributes());t.forEach((e,t)=>{const o=i.getSelectedElement();if(t&&o&&n.isImage(o)){const t=this.editor.model.createPositionAfter(o);this._uploadImage(e,s,t);}else this._uploadImage(e,s);});}_uploadImage(e,t,i){const n=this.editor,s=n.plugins.get(V_).createLoader(e),o=n.plugins.get("ImageUtils");s&&o.insertImage({...t,uploadId:s.id},i);}}class cE extends Ms{static get requires(){return [V_,Xv,tx,pA]}static get pluginName(){return "ImageUploadEditing"}static get isOfficialPlugin(){return  true}_uploadImageElements;_uploadedImages=new Map;constructor(e){super(e),e.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map;}init(){const e=this.editor,t=e.model.document,i=e.conversion,n=e.plugins.get(V_),s=e.plugins.get("ImageUtils"),o=e.plugins.get("ClipboardPipeline"),r=YA(e.config.get("image.upload.types")),a=new lE(e);e.commands.add("uploadImage",a),e.commands.add("imageUpload",a),i.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}).add(e=>e.on("element:img",(e,t,i)=>{if(!i.consumable.test(t.viewItem,{attributes:["data-ck-upload-id"]}))return;const s=t.viewItem.getAttribute("data-ck-upload-id");if(!s)return;const[o]=Array.from(t.modelRange.getItems({shallow:true})),r=n.loaders.get(s);o&&(i.writer.setAttribute("uploadId",s,o),i.consumable.consume(t.viewItem,{attributes:["data-ck-upload-id"]}),r&&r.data&&i.writer.setAttribute("uploadStatus",r.status,o));},{priority:"low"})),this.listenTo(e.editing.view.document,"clipboardInput",(t,i)=>{if(uE(i.dataTransfer))return;const n=Array.from(i.dataTransfer.files).filter(e=>!!e&&r.test(e.type));if(!n.length)return;t.stop(),e.model.change(t=>{i.targetRanges&&t.setSelection(i.targetRanges.map(t=>e.editing.mapper.toModelRange(t))),e.execute("uploadImage",{file:n});});if(!e.commands.get("uploadImage").isAccessAllowed){const t=e.plugins.get("Notification"),i=e.locale.t;t.showWarning(i("You have no image upload permissions."),{namespace:"image"});}}),this.listenTo(o,"inputTransformation",(t,i)=>{const o=Array.from(e.editing.view.createRangeIn(i.content)).map(e=>e.item).filter(e=>XA(s,e)&&!e.getAttribute("uploadProcessed")).map(e=>({promise:ZA(e),imageElement:e}));if(!o.length)return;const r=new Cu(e.editing.view.document);for(const e of o){r.setAttribute("uploadProcessed",true,e.imageElement);const t=n.createLoader(e.promise);t&&(r.setAttribute("src","",e.imageElement),r.setAttribute("uploadId",t.id,e.imageElement));}}),e.editing.view.document.on("dragover",(e,t)=>{t.preventDefault();}),t.on("change",()=>{const i=t.differ.getChanges({includeChangesInGraveyard:true}).reverse(),s=new Set;for(const t of i)if("insert"==t.type&&"$text"!=t.name){const i=t.position.nodeAfter,o="$graveyard"==t.position.root.rootName;for(const t of dE(e,i)){const i=t.getAttribute("uploadId"),r=t.getAttribute("uploadStatus");if(!i||"complete"==r)continue;const a=n.loaders.get(i);if(a)if(o){if(!s.has(i)){const e=Array.from(this._uploadImageElements.get(i)).every(e=>"$graveyard"==e.root.rootName);e&&a.abort();}}else s.add(i),this._uploadImageElements.has(i)?this._uploadImageElements.get(i).add(t):this._uploadImageElements.set(i,new Set([t])),"idle"==a.status&&this._readAndUpload(a);else !o&&this._uploadedImages.has(i)&&e.model.enqueueChange({isUndoable:false},e=>{e.setAttribute("uploadStatus","complete",t),this.fire("uploadComplete",{data:this._uploadedImages.get(i),imageElement:t});});}}}),this.on("uploadComplete",(e,{imageElement:t,data:i})=>{const n=i.urls?i.urls:i;this.editor.model.change(e=>{e.setAttribute("src",n.default,t),this._parseAndSetSrcsetAttributeOnImage(n,t,e),s.setImageNaturalSizeAttributes(t);});},{priority:"low"});}afterInit(){const e=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&(e.extend("imageBlock",{allowAttributes:["uploadId","uploadStatus"]}),this._registerConverters("imageBlock")),this.editor.plugins.has("ImageInlineEditing")&&(e.extend("imageInline",{allowAttributes:["uploadId","uploadStatus"]}),this._registerConverters("imageInline"));}_readAndUpload(e){const t=this.editor,i=t.model,s=t.locale.t,o=t.plugins.get(V_),r=t.plugins.get(Xv),a=t.plugins.get("ImageUtils"),l=this._uploadImageElements;return i.enqueueChange({isUndoable:false},t=>{const i=l.get(e.id);for(const e of i)t.setAttribute("uploadStatus","reading",e);}),e.read().then(()=>{const o=e.upload();t.ui&&t.ui.ariaLiveAnnouncer.announce(s("Uploading image"));for(const s of l.get(e.id)){if(n.isSafari){const e=t.editing.mapper.toViewElement(s),i=a.findViewImgElement(e);t.editing.view.once("render",()=>{if(!i.parent)return;const e=t.editing.view.domConverter.mapViewToDom(i.parent);if(!e)return;const n=e.style.display;e.style.display="none",e._ckHack=e.offsetHeight,e.style.display=n;});}i.enqueueChange({isUndoable:false},e=>{e.setAttribute("uploadStatus","uploading",s);});}return o}).then(n=>{i.enqueueChange({isUndoable:false},i=>{for(const t of l.get(e.id))i.setAttribute("uploadStatus","complete",t),this.fire("uploadComplete",{data:n,imageElement:t});t.ui&&t.ui.ariaLiveAnnouncer.announce(s("Image upload complete")),this._uploadedImages.set(e.id,n);}),c();}).catch(n=>{if(t.ui&&t.ui.ariaLiveAnnouncer.announce(s("Error during image upload")),"error"!==e.status&&"aborted"!==e.status)throw n;"error"==e.status&&n&&r.showWarning(n,{title:s("Upload failed"),namespace:"upload"}),i.enqueueChange({isUndoable:false},t=>{for(const i of l.get(e.id))"$graveyard"!==i.root.rootName&&t.remove(i);}),c();});function c(){i.enqueueChange({isUndoable:false},t=>{for(const i of l.get(e.id))t.removeAttribute("uploadId",i),t.removeAttribute("uploadStatus",i);l.delete(e.id);}),o.destroyLoader(e);}}_parseAndSetSrcsetAttributeOnImage(e,t,i){let n=0;const s=Object.keys(e).filter(e=>{const t=parseInt(e,10);if(!isNaN(t))return n=Math.max(n,t),true}).map(t=>`${e[t]} ${t}w`).join(", ");if(""!=s){const e={srcset:s};t.hasAttribute("width")||t.hasAttribute("height")||(e.width=n),i.setAttributes(e,t);}}_registerConverters(e){const{conversion:t,plugins:i}=this.editor,n=i.get(V_),s=i.get(pA);t.for("dataDowncast").add(t=>{t.on(`attribute:uploadId:${e}`,(e,t,i)=>{if(!i.consumable.test(t.item,e.name))return;const o=n.loaders.get(t.attributeNewValue);if(!o||!o.data)return null;const r=i.mapper.toViewElement(t.item),a=s.findViewImgElement(r);a&&(i.consumable.consume(t.item,e.name),i.writer.setAttribute("data-ck-upload-id",o.id,a));});});}}function uE(e){return Array.from(e.types).includes("text/html")&&""!==e.getData("text/html")}function dE(e,t){const i=e.plugins.get("ImageUtils");return Array.from(e.model.createRangeOn(t)).filter(e=>i.isImage(e.item)).map(e=>e.item)}class hE extends Ms{static get pluginName(){return "ImageUpload"}static get isOfficialPlugin(){return  true}static get requires(){return [cE,tE,iE]}}class mE extends Cs{urlInputView;keystrokes;constructor(e){super(e),this.set("imageURLInputValue",""),this.set("isImageSelected",false),this.set("isEnabled",true),this.keystrokes=new In,this.urlInputView=this._createUrlInputView(),this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-insert-url"],tabindex:"-1"},children:[this.urlInputView,{tag:"div",attributes:{class:["ck","ck-image-insert-url__action-row"]}}]});}render(){super.render(),Vs({view:this}),this.keystrokes.listenTo(this.element);}destroy(){super.destroy(),this.keystrokes.destroy();}_createUrlInputView(){const e=this.locale,t=e.t,i=new Nb(e,Sw);return i.bind("label").to(this,"isImageSelected",e=>t(e?"Update image URL":"Insert image via URL")),i.bind("isEnabled").to(this),i.fieldView.inputMode="url",i.fieldView.placeholder="https://example.com/image.png",i.fieldView.bind("value").to(this,"imageURLInputValue",e=>e||""),i.fieldView.on("input",()=>{this.imageURLInputValue=i.fieldView.element.value.trim();}),i}focus(){this.urlInputView.focus();}}class gE extends Ms{_imageInsertUI;_formView;static get pluginName(){return "ImageInsertViaUrlUI"}static get isOfficialPlugin(){return  true}static get requires(){return [HA,Wp]}init(){this.editor.ui.componentFactory.add("insertImageViaUrl",()=>this._createToolbarButton()),this.editor.ui.componentFactory.add("menuBar:insertImageViaUrl",()=>this._createMenuBarButton("standalone"));}afterInit(){this._imageInsertUI=this.editor.plugins.get("ImageInsertUI"),this._imageInsertUI.registerIntegration({name:"url",observable:()=>this.editor.commands.get("insertImage"),buttonViewCreator:()=>this._createToolbarButton(),formViewCreator:()=>this._createDropdownButton(),menuBarButtonViewCreator:e=>this._createMenuBarButton(e?"insertOnly":"insertNested")});}_createInsertUrlButton(e){const t=new e(this.editor.locale);return t.icon=kg,t.on("execute",()=>{this._showModal();}),t}_createToolbarButton(){const e=this.editor.locale.t,t=this._createInsertUrlButton(Bp);return t.tooltip=true,t.bind("label").to(this._imageInsertUI,"isImageSelected",t=>e(t?"Update image URL":"Insert image via URL")),t}_createDropdownButton(){const e=this.editor.locale.t,t=this._createInsertUrlButton(Bp);return t.withText=true,t.bind("label").to(this._imageInsertUI,"isImageSelected",t=>e(t?"Update image URL":"Insert via URL")),t}_createMenuBarButton(e){const t=this.editor.locale.t,i=this._createInsertUrlButton(Jp);switch(i.withText=true,e){case "standalone":i.label=t("Image via URL");break;case "insertOnly":i.label=t("Image");break;case "insertNested":i.label=t("Via URL");}return i}_createInsertUrlView(){const e=this.editor,t=e.locale,i=e.commands.get("replaceImageSource"),n=e.commands.get("insertImage"),s=new mE(t);return s.bind("isImageSelected").to(this._imageInsertUI),s.bind("isEnabled").toMany([n,i],"isEnabled",(...e)=>e.some(e=>e)),s}_showModal(){const e=this.editor,t=e.locale.t,i=e.plugins.get("Dialog");this._formView||(this._formView=this._createInsertUrlView(),this._formView.on("submit",()=>this._handleSave()));const n=e.commands.get("replaceImageSource");this._formView.imageURLInputValue=n.value||"",i.show({id:"insertImageViaUrl",title:t("Image via URL"),isModal:true,content:this._formView,actionButtons:[{label:t("Cancel"),withText:true,onExecute:()=>i.hide()},{label:this._imageInsertUI.isImageSelected?t("Save"):t("Insert"),class:"ck-button-action",withText:true,onExecute:()=>this._handleSave()}]});}_handleSave(){this.editor.commands.get("replaceImageSource").isEnabled?this.editor.execute("replaceImageSource",{source:this._formView.imageURLInputValue}):this.editor.execute("insertImage",{source:this._formView.imageURLInputValue}),this.editor.plugins.get("Dialog").hide();}}class fE extends Ms{static get pluginName(){return "ImageInsertViaUrl"}static get isOfficialPlugin(){return  true}static get requires(){return [gE,HA]}}class pE extends Ms{static get pluginName(){return "ImageInsert"}static get isOfficialPlugin(){return  true}static get requires(){return [hE,fE,HA]}}class bE extends Ns{refresh(){const e=this.editor,t=e.plugins.get("ImageUtils").getClosestSelectedImageElement(e.model.document.selection);this.isEnabled=!!t,t&&t.hasAttribute("resizedWidth")?this.value={width:t.getAttribute("resizedWidth"),height:null}:this.value=null;}execute(e){const t=this.editor,i=t.model,n=t.plugins.get("ImageUtils"),s=n.getClosestSelectedImageElement(i.document.selection);this.value={width:e.width,height:null},s&&i.change(t=>{t.setAttribute("resizedWidth",e.width,s),t.removeAttribute("resizedHeight",s),n.setImageNaturalSizeAttributes(s);});}}class wE extends Ms{static get requires(){return [pA]}static get pluginName(){return "ImageResizeEditing"}static get licenseFeatureCode(){return "IR"}static get isOfficialPlugin(){return  true}static get isPremiumPlugin(){return  true}constructor(e){super(e),e.config.define("image",{resizeUnit:"%",resizeOptions:[{name:"resizeImage:original",value:null,icon:"original"},{name:"resizeImage:custom",value:"custom",icon:"custom"},{name:"resizeImage:25",value:"25",icon:"small"},{name:"resizeImage:50",value:"50",icon:"medium"},{name:"resizeImage:75",value:"75",icon:"large"}]});}init(){const e=this.editor,t=new bE(e);this._registerConverters("imageBlock"),this._registerConverters("imageInline"),e.commands.add("resizeImage",t),e.commands.add("imageResize",t);}afterInit(){this._registerSchema();}_registerSchema(){const e=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&(e.extend("imageBlock",{allowAttributes:["resizedWidth","resizedHeight"]}),e.setAttributeProperties("resizedWidth",{isFormatting:true}),e.setAttributeProperties("resizedHeight",{isFormatting:true})),this.editor.plugins.has("ImageInlineEditing")&&(e.extend("imageInline",{allowAttributes:["resizedWidth","resizedHeight"]}),e.setAttributeProperties("resizedWidth",{isFormatting:true}),e.setAttributeProperties("resizedHeight",{isFormatting:true}));}_registerConverters(e){const t=this.editor,i=t.plugins.get("ImageUtils");t.conversion.for("downcast").add(t=>t.on(`attribute:resizedWidth:${e}`,(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const n=i.writer,s=i.mapper.toViewElement(t.item);null!==t.attributeNewValue?(n.setStyle("width",t.attributeNewValue,s),n.addClass("image_resized",s)):(n.removeStyle("width",s),n.removeClass("image_resized",s));})),t.conversion.for("dataDowncast").attributeToAttribute({model:{name:e,key:"resizedHeight"},view:e=>({key:"style",value:{height:e}})}),t.conversion.for("editingDowncast").add(t=>t.on(`attribute:resizedHeight:${e}`,(t,n,s)=>{if(!s.consumable.consume(n.item,t.name))return;const o=s.writer,r=s.mapper.toViewElement(n.item),a="imageInline"===e?i.findViewImgElement(r):r;null!==n.attributeNewValue?o.setStyle("height",n.attributeNewValue,a):o.removeStyle("height",a);})),t.conversion.for("upcast").attributeToAttribute({view:{name:"imageBlock"===e?"figure":"img",styles:{width:/.+/}},model:{key:"resizedWidth",value:e=>gA(e)?null:e.getStyle("width")}}),t.conversion.for("upcast").attributeToAttribute({view:{name:"imageBlock"===e?"figure":"img",styles:{height:/.+/}},model:{key:"resizedHeight",value:e=>gA(e)?null:e.getStyle("height")}}),t.conversion.for("upcast").add(t=>{t.on("element:"+("imageBlock"===e?"figure":"img"),(e,t,i)=>{i.consumable.consume(t.viewItem,{classes:["image_resized"]});});});}}const vE=(()=>({small:mf,medium:hf,large:df,custom:cf,original:uf}))();class _E extends Ms{static get requires(){return [wE]}static get pluginName(){return "ImageResizeButtons"}static get isOfficialPlugin(){return  true}_resizeUnit;constructor(e){super(e),this._resizeUnit=e.config.get("image.resizeUnit");}init(){const e=this.editor,t=e.config.get("image.resizeOptions"),i=e.commands.get("resizeImage");this.bind("isEnabled").to(i);for(const e of t)this._registerImageResizeButton(e);this._registerImageResizeDropdown(t);}_registerImageResizeButton(e){const t=this.editor,{name:i,value:n,icon:s}=e;t.ui.componentFactory.add(i,i=>{const o=new Bp(i),r=t.commands.get("resizeImage"),a=this._getOptionLabelValue(e,true);if(!vE[s])throw new I("imageresizebuttons-missing-icon",t,e);if(o.set({label:a,icon:vE[s],tooltip:a,isToggleable:true}),o.bind("isEnabled").to(this),t.plugins.has("ImageCustomResizeUI")&&yE(e)){const e=t.plugins.get("ImageCustomResizeUI");this.listenTo(o,"execute",()=>{e._showForm(this._resizeUnit);});}else {const e=n?n+this._resizeUnit:null;o.bind("isOn").to(r,"value",r,"isEnabled",kE(e)),this.listenTo(o,"execute",()=>{t.execute("resizeImage",{width:e});});}return o});}_registerImageResizeDropdown(e){const t=this.editor,i=t.t,n=e.find(e=>!e.value),s=s=>{const o=t.commands.get("resizeImage"),r=ww(s,Gb),a=r.buttonView,l=i("Resize image");return a.set({tooltip:l,commandValue:n.value,icon:vE.medium,isToggleable:true,label:this._getOptionLabelValue(n),withText:true,class:"ck-resize-image-button",ariaLabel:l,ariaLabelledBy:void 0}),a.bind("label").to(o,"value",e=>e&&e.width?e.width:this._getOptionLabelValue(n)),r.bind("isEnabled").to(this),Cw(r,()=>this._getResizeDropdownListItemDefinitions(e,o),{ariaLabel:i("Image resize list"),role:"menu"}),this.listenTo(r,"execute",e=>{"onClick"in e.source?e.source.onClick():(t.execute(e.source.commandName,{width:e.source.commandValue}),t.editing.view.focus());}),r};t.ui.componentFactory.add("resizeImage",s),t.ui.componentFactory.add("imageResize",s);}_getOptionLabelValue(e,t=false){const i=this.editor.t;return e.label?e.label:t?yE(e)?i("Custom image size"):e.value?i("Resize image to %0",e.value+this._resizeUnit):i("Resize image to the original size"):yE(e)?i("Custom"):e.value?e.value+this._resizeUnit:i("Original")}_getResizeDropdownListItemDefinitions(e,t){const{editor:i}=this,n=new kn,s=e.map(e=>yE(e)?{...e,valueWithUnits:"custom"}:e.value?{...e,valueWithUnits:`${e.value}${this._resizeUnit}`}:{...e,valueWithUnits:null});for(const e of s){let o=null;if(i.plugins.has("ImageCustomResizeUI")&&yE(e)){const n=i.plugins.get("ImageCustomResizeUI");o={type:"button",model:new e_({label:this._getOptionLabelValue(e),role:"menuitemradio",withText:true,icon:null,onClick:()=>{n._showForm(this._resizeUnit);}})};const r=Object.values(s).map(e=>e.valueWithUnits);o.model.bind("isOn").to(t,"value",t,"isEnabled",CE(r));}else o={type:"button",model:new e_({commandName:"resizeImage",commandValue:e.valueWithUnits,label:this._getOptionLabelValue(e),role:"menuitemradio",withText:true,icon:null})},o.model.bind("isOn").to(t,"value",t,"isEnabled",kE(e.valueWithUnits));o.model.bind("isEnabled").to(t,"isEnabled"),n.add(o);}return n}}function yE(e){return "custom"===e.value}function kE(e){return (t,i)=>!(void 0===t||!i)&&(null===e&&t===e||null!==t&&t.width===e)}function CE(e){return (t,i)=>!e.some(e=>kE(e)(t,i))}const xE="image_resized";class AE extends Ms{static get requires(){return [RC,pA]}static get pluginName(){return "ImageResizeHandles"}static get isOfficialPlugin(){return  true}init(){const e=this.editor.commands.get("resizeImage");this.bind("isEnabled").to(e),this._setupResizerCreator();}_setupResizerCreator(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageUtils");t.addObserver(RA),this.listenTo(t.document,"imageLoaded",(n,s)=>{if(!s.target.matches("figure.image.ck-widget > img,figure.image.ck-widget > picture > img,figure.image.ck-widget > a > img,figure.image.ck-widget > a > picture > img,span.image-inline.ck-widget > img,span.image-inline.ck-widget > picture > img"))return;const o=e.editing.view.domConverter,r=o.domToView(s.target),a=i.getImageWidgetFromImageView(r);let l=this.editor.plugins.get(RC).getResizerByViewElement(a);if(l)return void l.redraw();const c=e.editing.mapper,u=c.toModelElement(a);l=e.plugins.get(RC).attachTo({unit:e.config.get("image.resizeUnit"),modelElement:u,viewElement:a,editor:e,getHandleHost:e=>e.querySelector("img"),getResizeHost:()=>o.mapViewToDom(c.toViewElement(u)),isCentered:()=>"alignCenter"==u.getAttribute("imageStyle"),onCommit(i){t.change(e=>{e.removeClass(xE,a);}),e.execute("resizeImage",{width:i});}}),l.on("updateSize",()=>{a.hasClass(xE)||t.change(e=>{e.addClass(xE,a);});const e="imageInline"===u.name?r:a;e.getStyle("height")&&t.change(t=>{t.removeStyle("height",e);});}),l.bind("isEnabled").to(this);});}}function EE(e){if(!e)return null;const[,t,i]=e.trim().match(/([.,\d]+)(%|px)$/)||[],n=Number.parseFloat(t);return Number.isNaN(n)?null:{value:n,unit:i}}function TE(e,t,i){return "px"===i?{value:t.value,unit:"px"}:{value:t.value/e*100,unit:"%"}}function SE(e){const{editing:t}=e,i=e.plugins.get("ImageUtils").getClosestSelectedImageElement(e.model.document.selection);if(!i)return null;const n=t.mapper.toViewElement(i);return {model:i,view:n,dom:t.view.domConverter.mapViewToDom(n)}}function IE(e,t){const i=SE(e);if(!i)return null;const n=EE(i.model.getAttribute("resizedWidth")||null);if(!n)return null;if(n.unit===t)return n;return TE(aC(i.dom),{value:new Ci(i.dom).width},t)}class PE extends Cs{focusTracker;keystrokes;unit;backButtonView;saveButtonView;labeledInput;children;_focusables;_focusCycler;_validators;constructor(e,t,i){super(e),this.focusTracker=new An,this.keystrokes=new In,this.unit=t,this.backButtonView=this._createBackButton(),this.saveButtonView=this._createSaveButton(),this.labeledInput=this._createLabeledInputView(),this.children=this.createCollection([this._createHeaderView()]),this.children.add(new Jv(e,{children:[this.labeledInput,this.saveButtonView],class:["ck-form__row_with-submit","ck-form__row_large-top-padding"]})),this._focusables=new Xn,this._validators=i,this.keystrokes.set("Esc",(e,t)=>{this.fire("cancel"),t();}),this._focusCycler=new Fp({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-image-custom-resize-form","ck-responsive-form"],tabindex:"-1"},children:this.children});}render(){super.render(),Vs({view:this});[this.backButtonView,this.labeledInput,this.saveButtonView].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();}_createBackButton(){const e=this.locale.t,t=new Bp(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:Pf,tooltip:true}),t.delegate("execute").to(this,"cancel"),t}_createSaveButton(){const e=this.locale.t,t=new Bp(this.locale);return t.set({label:e("Save"),withText:true,type:"submit",class:"ck-button-action ck-button-bold"}),t}_createHeaderView(){const e=this.locale.t,t=new Mp(this.locale,{label:e("Image Resize")});return t.children.add(this.backButtonView,0),t}_createLabeledInputView(){const e=this.locale.t,t=new Nb(this.locale,Iw);return t.label=e("Resize image (in %0)",this.unit),t.class="ck-labeled-field-view_full-width",t.fieldView.set({step:.1}),t}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.labeledInput.errorText=t,false}return  true}resetFormStatus(){this.labeledInput.errorText=null;}get rawSize(){const{element:e}=this.labeledInput.fieldView;return e?e.value:null}get parsedSize(){const{rawSize:e}=this;if(null===e)return null;const t=Number.parseFloat(e);return Number.isNaN(t)?null:t}get sizeWithUnits(){const{parsedSize:e,unit:t}=this;return null===e?null:`${e}${t}`}}function VE(e,t){const i=SE(e);if(!i)return null;const n=aC(i.dom),s=EE(window.getComputedStyle(i.dom).minWidth)||{value:1};return {unit:t,lower:Math.max(.1,TE(n,s,t).value),upper:"px"===t?n:100}}class RE extends Ms{_balloon;_form;static get requires(){return [i_]}static get pluginName(){return "ImageCustomResizeUI"}static get isOfficialPlugin(){return  true}destroy(){super.destroy(),this._form&&this._form.destroy();}_createForm(e){const t=this.editor;this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(Is(PE))(t.locale,e,function(e){const t=e.t;return [e=>""===e.rawSize.trim()?t("The value must not be empty."):null===e.parsedSize?t("The value should be a plain number."):void 0]}(t)),this._form.render(),this.listenTo(this._form,"submit",()=>{this._form.isValid()&&(t.execute("resizeImage",{width:this._form.sizeWithUnits}),this._hideForm(true));}),this.listenTo(this._form.labeledInput,"change:errorText",()=>{t.ui.update();}),this.listenTo(this._form,"cancel",()=>{this._hideForm(true);}),Ss({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()});}_showForm(e){if(this._isVisible)return;this._form||this._createForm(e);const t=this.editor,i=this._form.labeledInput;this._form.disableCssTransitions(),this._form.resetFormStatus(),this._isInBalloon||this._balloon.add({view:this._form,position:xA(t)});const n=IE(t,e),s=n?n.value.toFixed(1):"",o=VE(t,e);i.fieldView.value=i.fieldView.element.value=s,o&&Object.assign(i.fieldView,{min:o.lower.toFixed(1),max:Math.ceil(o.upper).toFixed(1)}),this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions();}_hideForm(e=false){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),e&&this.editor.editing.view.focus());}get _isVisible(){return !!this._balloon&&this._balloon.visibleView===this._form}get _isInBalloon(){return !!this._balloon&&this._balloon.hasView(this._form)}}class OE extends Ms{static get requires(){return [wE,AE,RE,_E]}static get pluginName(){return "ImageResize"}static get isOfficialPlugin(){return  true}}class BE extends Ns{_defaultStyles;_styles;constructor(e,t){super(e),this._defaultStyles={imageBlock:false,imageInline:false},this._styles=new Map(t.map(e=>{if(e.isDefault)for(const t of e.modelElements)this._defaultStyles[t]=e.name;return [e.name,e]}));}refresh(){const e=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!e,this.isEnabled?e.hasAttribute("imageStyle")?this.value=e.getAttribute("imageStyle"):this.value=this._defaultStyles[e.name]:this.value=false;}execute(e={}){const t=this.editor,i=t.model,n=t.plugins.get("ImageUtils");i.change(t=>{const s=e.value,{setImageSizes:o=true}=e;let r=n.getClosestSelectedImageElement(i.document.selection);s&&this.shouldConvertImageType(s,r)&&(this.editor.execute(n.isBlockImage(r)?"imageTypeInline":"imageTypeBlock",{setImageSizes:o}),r=n.getClosestSelectedImageElement(i.document.selection)),!s||this._styles.get(s).isDefault?t.removeAttribute("imageStyle",r):t.setAttribute("imageStyle",s,r),o&&n.setImageNaturalSizeAttributes(r);});}shouldConvertImageType(e,t){return !this._styles.get(e).modelElements.includes(t.name)}}const LE={get inline(){return {name:"inline",title:"In line",icon:rf,modelElements:["imageInline"],isDefault:true}},get alignLeft(){return {name:"alignLeft",title:"Left aligned image",icon:sf,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return {name:"alignBlockLeft",title:"Left aligned image",icon:af,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return {name:"alignCenter",title:"Centered image",icon:tf,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return {name:"alignRight",title:"Right aligned image",icon:of,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return {name:"alignBlockRight",title:"Right aligned image",icon:lf,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return {name:"block",title:"Centered image",icon:tf,modelElements:["imageBlock"],isDefault:true}},get side(){return {name:"side",title:"Side image",icon:of,modelElements:["imageBlock"],className:"image-style-side"}}},ME=(()=>({full:nf,left:af,right:lf,center:tf,inlineLeft:sf,inlineRight:of,inline:rf}))(),FE=[{name:"imageStyle:wrapText",title:"Wrap text",defaultItem:"imageStyle:alignLeft",items:["imageStyle:alignLeft","imageStyle:alignRight"]},{name:"imageStyle:breakText",title:"Break text",defaultItem:"imageStyle:block",items:["imageStyle:alignBlockLeft","imageStyle:block","imageStyle:alignBlockRight"]}];function NE(e){P("image-style-configuration-definition-invalid",e);}const DE={normalizeStyles:function(e){const t=(e.configuredStyles.options||[]).map(e=>function(e){e="string"==typeof e?LE[e]?{...LE[e]}:{name:e}:function(e,t){const i={...t};for(const n in e)Object.prototype.hasOwnProperty.call(t,n)||(i[n]=e[n]);return i}(LE[e.name],e);"string"==typeof e.icon&&(e.icon=ME[e.icon]||e.icon);return e}(e)).filter(t=>function(e,{isBlockPluginLoaded:t,isInlinePluginLoaded:i}){const{modelElements:n,name:s}=e;if(!(n&&n.length&&s))return NE({style:e}),false;{const s=[t?"imageBlock":null,i?"imageInline":null];if(!n.some(e=>s.includes(e)))return P("image-style-missing-dependency",{style:e,missingPlugins:n.map(e=>"imageBlock"===e?"ImageBlockEditing":"ImageInlineEditing")}),false}return  true}(t,e));return t},getDefaultStylesConfiguration:function(e,t){return e&&t?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:e?{options:["block","side"]}:t?{options:["inline","alignLeft","alignRight"]}:{}},getDefaultDropdownDefinitions:function(e){return e.has("ImageBlockEditing")&&e.has("ImageInlineEditing")?[...FE]:[]},warnInvalidStyle:NE};function zE(e){return (t,i,n)=>{if(!n.consumable.consume(i.item,t.name))return;const s=qE(i.attributeNewValue,e),o=qE(i.attributeOldValue,e),r=n.mapper.toViewElement(i.item),a=n.writer;o&&a.removeClass(o.className,r),s&&a.addClass(s.className,r);}}function HE(e){const t={imageInline:e.filter(e=>!e.isDefault&&e.modelElements.includes("imageInline")),imageBlock:e.filter(e=>!e.isDefault&&e.modelElements.includes("imageBlock"))};return (i,n,s)=>{if(!n.modelRange)return;const o=n.viewItem,r=Cn(n.modelRange.getItems());if(r&&s.schema.checkAttribute(r,"imageStyle")){for(const e of t[r.name])s.consumable.consume(o,{classes:e.className})&&s.writer.setAttribute("imageStyle",e.name,r);!function(e,t,i,n){if(!e.consumable.test(t,{styles:["float"]}))return;let s=null;switch(t.getStyle("float")){case "left":s="alignLeft";break;case "right":s="alignRight";}if(!s)return;const o=qE(s,n);if(!o)return;const r=LE[o.name];if(!dt(o,r))return;e.writer.setAttribute("imageStyle",s,i),e.consumable.consume(t,{styles:["float"]});}(s,o,r,e);}}}function qE(e,t){for(const i of t)if(i.name===e)return i}class UE extends Ms{static get pluginName(){return "ImageStyleEditing"}static get isOfficialPlugin(){return  true}static get requires(){return [pA]}normalizedStyles;init(){const e=this.editor,t=e.plugins.has("ImageBlockEditing"),i=e.plugins.has("ImageInlineEditing");e.config.define("image.styles",DE.getDefaultStylesConfiguration(t,i)),this.normalizedStyles=DE.normalizeStyles({configuredStyles:e.config.get("image.styles"),isBlockPluginLoaded:t,isInlinePluginLoaded:i}),this._setupConversion(t,i),this._setupPostFixer(),e.commands.add("imageStyle",new BE(e,this.normalizedStyles));}_setupConversion(e,t){const i=this.editor,n=i.model.schema,s=zE(this.normalizedStyles),o=HE(this.normalizedStyles);i.editing.downcastDispatcher.on("attribute:imageStyle",s),i.data.downcastDispatcher.on("attribute:imageStyle",s),e&&(n.extend("imageBlock",{allowAttributes:"imageStyle"}),n.setAttributeProperties("imageStyle",{isFormatting:true}),i.data.upcastDispatcher.on("element:figure",o,{priority:"low"})),t&&(n.extend("imageInline",{allowAttributes:"imageStyle"}),n.setAttributeProperties("imageStyle",{isFormatting:true}),i.data.upcastDispatcher.on("element:img",o,{priority:"low"}));}_setupPostFixer(){const e=this.editor,t=e.model.document,i=e.plugins.get(pA),n=new Map(this.normalizedStyles.map(e=>[e.name,e]));t.registerPostFixer(e=>{let s=false;for(const o of t.differ.getChanges())if("insert"==o.type||"attribute"==o.type&&"imageStyle"==o.attributeKey){let t="insert"==o.type?o.position.nodeAfter:o.range.start.nodeAfter;if(t&&t.is("element","paragraph")&&t.childCount>0&&(t=t.getChild(0)),!i.isImage(t))continue;const r=t.getAttribute("imageStyle");if(!r)continue;const a=n.get(r);a&&a.modelElements.includes(t.name)||(e.removeAttribute("imageStyle",t),s=true);}return s});}}class jE extends Ms{static get requires(){return [UE]}static get pluginName(){return "ImageStyleUI"}static get isOfficialPlugin(){return  true}get localizedDefaultStylesTitles(){const e=this.editor.t;return {"Wrap text":e("Wrap text"),"Break text":e("Break text"),"In line":e("In line"),"Full size image":e("Full size image"),"Side image":e("Side image"),"Left aligned image":e("Left aligned image"),"Centered image":e("Centered image"),"Right aligned image":e("Right aligned image")}}init(){const e=this.editor.plugins,t=this.editor.config.get("image.toolbar")||[],i=$E(e.get("ImageStyleEditing").normalizedStyles,this.localizedDefaultStylesTitles);for(const e of i)this._createButton(e);const n=$E([...t.filter(ne),...DE.getDefaultDropdownDefinitions(e)],this.localizedDefaultStylesTitles);for(const e of n)this._createDropdown(e,i);}_createDropdown(e,t){const i=this.editor.ui.componentFactory;i.add(e.name,n=>{let s;const{defaultItem:o,items:r,title:a}=e,l=r.filter(e=>t.find(({name:t})=>WE(t)===e)).map(e=>{const t=i.create(e);return e===o&&(s=t),t});r.length!==l.length&&DE.warnInvalidStyle({dropdown:e});const c=ww(n,bw),u=c.buttonView,d=u.arrowView;return yw(c,l,{enableActiveItemFocusOnDropdownOpen:true}),u.set({label:GE(a,s.label),class:null,tooltip:true}),d.unbind("label"),d.set({label:a}),u.bind("icon").toMany(l,"isOn",(...e)=>{const t=e.findIndex(Qe);return t<0?s.icon:l[t].icon}),u.bind("label").toMany(l,"isOn",(...e)=>{const t=e.findIndex(Qe);return GE(a,t<0?s.label:l[t].label)}),u.bind("isOn").toMany(l,"isOn",(...e)=>e.some(Qe)),u.bind("class").toMany(l,"isOn",(...e)=>e.some(Qe)?"ck-splitbutton_flatten":void 0),u.on("execute",()=>{l.some(({isOn:e})=>e)?c.isOpen=!c.isOpen:s.fire("execute");}),c.bind("isEnabled").toMany(l,"isEnabled",(...e)=>e.some(Qe)),this.listenTo(c,"execute",()=>{this.editor.editing.view.focus();}),c});}_createButton(e){const t=e.name;this.editor.ui.componentFactory.add(WE(t),i=>{const n=this.editor.commands.get("imageStyle"),s=new Bp(i);return s.set({label:e.title,icon:e.icon,tooltip:true,isToggleable:true}),s.bind("isEnabled").to(n,"isEnabled"),s.bind("isOn").to(n,"value",e=>e===t),s.on("execute",this._executeCommand.bind(this,t)),s});}_executeCommand(e){this.editor.execute("imageStyle",{value:e}),this.editor.editing.view.focus();}}function $E(e,t){for(const i of e)t[i.title]&&(i.title=t[i.title]);return e}function WE(e){return `imageStyle:${e}`}function GE(e,t){return (e?e+": ":"")+t}class KE extends Ms{static get requires(){return [UE,jE]}static get pluginName(){return "ImageStyle"}static get isOfficialPlugin(){return  true}}class JE extends Ms{static get requires(){return [xC,pA]}static get pluginName(){return "ImageToolbar"}static get isOfficialPlugin(){return  true}afterInit(){const e=this.editor,t=e.t,i=e.plugins.get(xC),n=e.plugins.get("ImageUtils");var s;i.register("image",{ariaLabel:t("Image toolbar"),items:(s=e.config.get("image.toolbar")||[],s.map(e=>ne(e)?e.name:e)),getRelatedElement:e=>n.getClosestSelectedImageWidget(e)});}}class QE extends Ms{static get requires(){return [LA,pA]}static get pluginName(){return "PictureEditing"}static get isOfficialPlugin(){return  true}afterInit(){const e=this.editor;e.plugins.has("ImageBlockEditing")&&e.model.schema.extend("imageBlock",{allowAttributes:["sources"]}),e.plugins.has("ImageInlineEditing")&&e.model.schema.extend("imageInline",{allowAttributes:["sources"]}),this._setupConversion(),this._setupImageUploadEditingIntegration();}_setupConversion(){const e=this.editor,t=e.conversion,i=e.plugins.get("ImageUtils");t.for("upcast").add(SA(i)),t.for("downcast").add(PA(i));}_setupImageUploadEditingIntegration(){const e=this.editor;if(!e.plugins.has("ImageUploadEditing"))return;const t=e.plugins.get("ImageUploadEditing");this.listenTo(t,"uploadComplete",(t,{imageElement:i,data:n})=>{const s=n.sources;s&&e.model.change(e=>{e.setAttributes({sources:s},i);});});}}class YE extends Ms{static get requires(){return [LA,pA,qx]}static get pluginName(){return "LinkImageEditing"}static get isOfficialPlugin(){return  true}afterInit(){const e=this.editor,t=e.model.schema;e.plugins.has("ImageBlockEditing")&&t.extend("imageBlock",{allowAttributes:["linkHref"]}),e.conversion.for("upcast").add(function(e){const t=e.plugins.has("ImageInlineEditing"),i=e.plugins.get("ImageUtils");return e=>{e.on("element:a",(e,n,s)=>{const o=n.viewItem,r=i.findViewImgElement(o);if(!r)return;const a=r.findAncestor(e=>i.isBlockImageView(e));if(t&&!a)return;const l={attributes:["href"]};if(!s.consumable.test(o,l))return;const c=o.getAttribute("href"),u=n.modelCursor.parent;u.is("element","imageBlock")&&(s.writer.setAttribute("linkHref",c,u),s.consumable.consume(o,l));},{priority:"high"});}}(e)),e.conversion.for("downcast").add(function(e){const t=e.plugins.get("ImageUtils");return e=>{e.on("attribute:linkHref:imageBlock",(e,i,n)=>{if(!n.consumable.consume(i.item,e.name))return;const s=n.mapper.toViewElement(i.item),o=n.writer,r=Array.from(s.getChildren()).find(e=>e.is("element","a")),a=t.findViewImgElement(s),l=a.parent.is("element","picture")?a.parent:a;if(r)i.attributeNewValue?o.setAttribute("href",i.attributeNewValue,r):(o.move(o.createRangeOn(l),o.createPositionAt(s,0)),o.remove(r));else {const e=o.createContainerElement("a",{href:i.attributeNewValue});o.insert(o.createPositionAt(s,0),e),o.move(o.createRangeOn(l),o.createPositionAt(e,0));}},{priority:"high"});}}(e)),this._enableAutomaticDecorators(),this._enableManualDecorators();}_enableAutomaticDecorators(){const e=this.editor,t=e.commands.get("link").automaticDecorators;t.length&&e.conversion.for("downcast").add(t.getDispatcherForLinkedImage());}_enableManualDecorators(){const e=this.editor,t=e.commands.get("link");for(const i of t.manualDecorators)e.plugins.has("ImageBlockEditing")&&e.model.schema.extend("imageBlock",{allowAttributes:i.id}),e.plugins.has("ImageInlineEditing")&&e.model.schema.extend("imageInline",{allowAttributes:i.id}),e.conversion.for("downcast").add(ZE(i)),e.conversion.for("upcast").add(XE(e,i));}}function ZE(e){return t=>{const i=t=>(i,n,s)=>{const o=s.mapper.toViewElement(n.item),r=Array.from(o.getChildren()).find(e=>e.is("element","a"));if(r){if(!t&&n.attributeOldValue){for(const[t,i]of Vn(e.attributes))s.writer.removeAttribute(t,i,r);e.classes&&s.writer.removeClass(e.classes,r);for(const t in e.styles)s.writer.removeStyle(t,r);}if(t&&n.attributeNewValue){for(const[t,i]of Vn(e.attributes))s.writer.setAttribute(t,i,false,r);e.classes&&s.writer.addClass(e.classes,r);for(const t in e.styles)s.writer.setStyle(t,e.styles[t],r);}}};t.on(`attribute:${e.id}:imageBlock`,i(false),{priority:E.high-1}),t.on(`attribute:${e.id}:imageBlock`,i(true),{priority:E.high-2});}}function XE(e,t){const i=e.plugins.has("ImageInlineEditing"),n=e.plugins.get("ImageUtils");return e=>{e.on("element:a",(e,s,o)=>{const r=s.viewItem,a=n.findViewImgElement(r);if(!a)return;const l=a.findAncestor(e=>n.isBlockImageView(e));if(i&&!l)return;const c=new uo(t._createPattern()).match(r);if(!c)return;if(!o.consumable.test(r,c.match))return;const u=s.modelCursor.parent;u?.is("element","imageBlock")&&(o.writer.setAttribute(t.id,true,u),o.consumable.consume(r,c.match));},{priority:"high"});}}class eT extends Ms{static get requires(){return [qx,Jx,DA]}static get pluginName(){return "LinkImageUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",(t,i)=>{this._isSelectedLinkedImage(e.model.document.selection)&&(i.preventDefault(),t.stop());},{priority:"high"}),this._createToolbarLinkImageButton();}_createToolbarLinkImageButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("linkImage",i=>{const n=new Bp(i),s=e.plugins.get("LinkUI"),o=e.commands.get("link");return n.set({isEnabled:true,label:t("Link image"),icon:Vg,keystroke:kx,tooltip:true,isToggleable:true}),n.bind("isEnabled").to(o,"isEnabled"),n.bind("isOn").to(o,"value",e=>!!e),this.listenTo(n,"execute",()=>{this._isSelectedLinkedImage(e.model.document.selection)?s._addToolbarView():s._showUI(true);}),n});}_isSelectedLinkedImage(e){const t=e.getSelectedElement();return this.editor.plugins.get("ImageUtils").isImage(t)&&t.hasAttribute("linkHref")}}class tT extends Ms{static get requires(){return [YE,eT]}static get pluginName(){return "LinkImage"}static get isOfficialPlugin(){return  true}}var iT=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],nT=e=>{let t=0;for(let i=0;i<e.length;i++){let n=e[i];t=83*t+iT.indexOf(n);}return t},sT=e=>{let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},oT=e=>{let t=Math.max(0,Math.min(1,e));return t<=.0031308?Math.trunc(12.92*t*255+.5):Math.trunc(255*(1.055*Math.pow(t,.4166666666666667)-.055)+.5)},rT=(e,t)=>(e=>e<0?-1:1)(e)*Math.pow(Math.abs(e),t),aT=class extends Error{constructor(e){super(e),this.name="ValidationError",this.message=e;}},lT=e=>{let t=e>>8&255,i=255&e;return [sT(e>>16),sT(t),sT(i)]},cT=(e,t)=>{let i=Math.floor(e/361),n=Math.floor(e/19)%19,s=e%19;return [rT((i-9)/9,2)*t,rT((n-9)/9,2)*t,rT((s-9)/9,2)*t]},uT=(e,t,i,n)=>{(e=>{if(!e||e.length<6)throw new aT("The blurhash string must be at least 6 characters");let t=nT(e[0]),i=Math.floor(t/9)+1,n=t%9+1;if(e.length!==4+2*n*i)throw new aT(`blurhash length mismatch: length is ${e.length} but it should be ${4+2*n*i}`)})(e),n|=1;let s=nT(e[0]),o=Math.floor(s/9)+1,r=s%9+1,a=(nT(e[1])+1)/166,l=new Array(r*o);for(let t=0;t<l.length;t++)if(0===t){let i=nT(e.substring(2,6));l[t]=lT(i);}else {let i=nT(e.substring(4+2*t,6+2*t));l[t]=cT(i,a*n);}let c=4*t,u=new Uint8ClampedArray(c*i);for(let e=0;e<i;e++)for(let n=0;n<t;n++){let s=0,a=0,d=0;for(let c=0;c<o;c++)for(let o=0;o<r;o++){let u=Math.cos(Math.PI*n*o/t)*Math.cos(Math.PI*e*c/i),h=l[o+c*r];s+=h[0]*u,a+=h[1]*u,d+=h[2]*u;}let h=oT(s),m=oT(a),g=oT(d);u[4*n+0+e*c]=h,u[4*n+1+e*c]=m,u[4*n+2+e*c]=g,u[4*n+3+e*c]=255;}return u};function dT(e){const t=[];let i=0;for(const n in e){const s=parseInt(n,10);isNaN(s)||(s>i&&(i=s),t.push(`${e[n]} ${n}w`));}const n=[{srcset:t.join(","),sizes:`(max-width: ${i}px) 100vw, ${i}px`,type:"image/webp"}];return {imageFallbackUrl:e.default,imageSources:n}}function hT(e,t){const[,i]=e.value.split("."),n=JSON.parse(atob(i)),s=n.auth?.ckbox?.workspaces||[n.aud];return t?"superadmin"==n.auth?.ckbox?.role||s.includes(t)?t:null:s[0]}function mT(e){if(e)try{const t="32px",i=document.createElement("canvas");i.setAttribute("width",t),i.setAttribute("height",t);const n=i.getContext("2d");if(!n)return;const s=n.createImageData(32,32),o=uT(e,32,32);return s.data.set(o),n.putImageData(s,0,0),i.toDataURL()}catch{return}}function gT({url:e,method:t="GET",data:i,onUploadProgress:n,signal:s,authorization:o}){const r=new XMLHttpRequest;r.open(t,e.toString()),r.setRequestHeader("Authorization",o),r.setRequestHeader("CKBox-Version","CKEditor 5"),r.responseType="json";const a=()=>{r.abort();};return new Promise((e,t)=>{s.throwIfAborted(),s.addEventListener("abort",a),r.addEventListener("loadstart",()=>{s.addEventListener("abort",a);}),r.addEventListener("loadend",()=>{s.removeEventListener("abort",a);}),r.addEventListener("error",()=>{t();}),r.addEventListener("abort",()=>{t();}),r.addEventListener("load",()=>{const i=r.response;if(!i||i.statusCode>=400)return t(i&&i.message);e(i);}),n&&r.upload.addEventListener("progress",e=>{n(e);}),r.send(i);})}const fT={"image/gif":"gif","image/jpeg":"jpg","image/png":"png","image/webp":"webp","image/bmp":"bmp","image/tiff":"tiff"};function pT(e){return fT[e]}async function bT(e,t){try{const i=await fetch(e,{method:"HEAD",cache:"force-cache",...t});return i.ok&&i.headers.get("content-type")||""}catch{return ""}}function wT(e){return e.name.match(/\.(?<ext>[^.]+)$/).groups.ext.toLowerCase()}class vT extends Ns{_chosenAssets=new Set;_wrapper=null;constructor(e){super(e),this._initListeners();}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled();}execute(){this.fire("ckbox:open");}_getValue(){return null!==this._wrapper}_checkEnabled(){const e=this.editor.commands.get("insertImage"),t=this.editor.commands.get("link");return !(!e.isEnabled&&!t.isEnabled)}_prepareOptions(){const e=this.editor.config.get("ckbox"),t=e.dialog,i=e.categories,n=e.view,s=e.upload;return {theme:e.theme,language:e.language,tokenUrl:e.tokenUrl,serviceOrigin:e.serviceOrigin,forceDemoLabel:e.forceDemoLabel,choosableFileExtensions:e.choosableFileExtensions,assets:{onChoose:e=>this.fire("ckbox:choose",e)},dialog:{onClose:()=>this.fire("ckbox:close"),width:t&&t.width,height:t&&t.height},categories:i&&{icons:i.icons},view:n&&{openLastView:n.openLastView,startupFolderId:n.startupFolderId,startupCategoryId:n.startupCategoryId,hideMaximizeButton:n.hideMaximizeButton},upload:s&&{componentsHideTimeout:s.componentsHideTimeout,dialogMinimizeTimeout:s.dialogMinimizeTimeout}}}_initListeners(){const e=this.editor,t=e.model,i=!e.config.get("ckbox.ignoreDataId"),n=e.config.get("ckbox.downloadableFiles");this.on("ckbox",()=>{this.refresh();},{priority:"low"}),this.on("ckbox:open",()=>{this.isEnabled&&!this.value&&(this._wrapper=ii(document,"div",{class:"ck ckbox-wrapper"}),document.body.appendChild(this._wrapper),window.CKBox.mount(this._wrapper,this._prepareOptions()));}),this.on("ckbox:close",()=>{this.value&&(this._wrapper.remove(),this._wrapper=null,e.editing.view.focus());}),this.on("ckbox:choose",(s,o)=>{if(!this.isEnabled)return;const r=e.commands.get("insertImage"),a=e.commands.get("link"),l=function({downloadableFilesConfig:e,assets:t,isImageAllowed:i,isLinkAllowed:n}){return t.map(t=>function(e){const t=e.data.metadata;if(!t)return  false;return t.width&&t.height}(t)?{id:t.data.id,type:"image",attributes:_T(t)}:{id:t.data.id,type:"link",attributes:yT(t,e)}).filter(e=>"image"===e.type?i:n)}({assets:o,downloadableFilesConfig:n,isImageAllowed:r.isEnabled,isLinkAllowed:a.isEnabled}),c=l.length;0!==c&&(t.change(e=>{for(const t of l){const n=t===l[c-1],s=1===c;this._insertAsset(t,n,e,s),i&&(setTimeout(()=>this._chosenAssets.delete(t),1e3),this._chosenAssets.add(t));}}),e.editing.view.focus());}),this.listenTo(e,"destroy",()=>{this.fire("ckbox:close"),this._chosenAssets.clear();});}_insertAsset(e,t,i,n){const s=this.editor.model.document.selection;i.removeSelectionAttribute("linkHref"),"image"===e.type?this._insertImage(e):this._insertLink(e,i,n),t||i.setSelection(s.getLastPosition());}_insertImage(e){const t=this.editor,{imageFallbackUrl:i,imageSources:n,imageTextAlternative:s,imageWidth:o,imageHeight:r,imagePlaceholder:a}=e.attributes;t.execute("insertImage",{source:{src:i,sources:n,alt:s,width:o,height:r,...a?{placeholder:a}:null}});}_insertLink(e,t,i){const n=this.editor,s=n.model,o=s.document.selection,{linkName:r,linkHref:a}=e.attributes;if(o.isCollapsed){const e=Vn(o.getAttributes()),l=t.createText(r,e);if(!i){const e=o.getLastPosition(),i=e.parent;"paragraph"===i.name&&i.isEmpty||n.execute("insertParagraph",{position:e});const r=s.insertContent(l);return t.setSelection(r),void n.execute("link",a)}const c=s.insertContent(l);t.setSelection(c);}n.execute("link",a);}}function _T(e){const{imageFallbackUrl:t,imageSources:i}=dT(e.data.imageUrls),{description:n,width:s,height:o,blurHash:r}=e.data.metadata,a=mT(r);return {imageFallbackUrl:t,imageSources:i,imageTextAlternative:n||"",imageWidth:s,imageHeight:o,...a?{imagePlaceholder:a}:null}}function yT(e,t){return {linkName:e.data.name,linkHref:kT(e,t)}}function kT(e,t){const i=new URL(e.data.url);return function(e,t){if("function"==typeof t)return t(e);return  true}(e,t)&&i.searchParams.set("download","true"),i.toString()}const CT={autoRefresh:true},xT=36e5;class AT extends($t()){_refresh;_options;_tokenRefreshTimeout;_isDestroyed=false;constructor(e,t={}){if(super(),!e)throw new I("token-missing-token-url",this);t.initValue&&this._validateTokenValue(t.initValue),this.set("value",t.initValue),this._refresh="function"==typeof e?e:()=>{return t=e,new Promise((e,i)=>{const n=new XMLHttpRequest;n.open("GET",t),n.addEventListener("load",()=>{const t=n.status,s=n.response;return t<200||t>299?i(new I("token-cannot-download-new-token",null)):e(s)}),n.addEventListener("error",()=>i(new Error("Network Error"))),n.addEventListener("abort",()=>i(new Error("Abort"))),n.send();});var t;},this._options={...CT,...t};}init(){return new Promise((e,t)=>{this.value?(this._options.autoRefresh&&this._registerRefreshTokenTimeout(),e(this)):this.refreshToken().then(e).catch(t);})}refreshToken(){const e=this._options.autoRefresh;return this._refresh().then(t=>(this._validateTokenValue(t),this.set("value",t),e&&this._registerRefreshTokenTimeout(),this)).catch(t=>{throw P("token-refresh-failed",{autoRefresh:e}),e&&this._registerRefreshTokenTimeout(5e3),t})}destroy(){this._isDestroyed=true,clearTimeout(this._tokenRefreshTimeout);}_validateTokenValue(e){const t="string"==typeof e,i=!/^".*"$/.test(e),n=t&&3===e.split(".").length;if(!i||!n)throw new I("token-not-in-jwt-format",this)}_registerRefreshTokenTimeout(e){if(clearTimeout(this._tokenRefreshTimeout),this._isDestroyed)return;const t=e||this._getTokenRefreshTimeoutTime();this._tokenRefreshTimeout=setTimeout(()=>{this.refreshToken();},t);}_getTokenRefreshTimeoutTime(){try{const[,e]=this.value.split("."),{exp:t}=JSON.parse(atob(e));if(!t)return xT;t>2147483647&&console.warn("Token expiration time exceeds 32-bit integer range. This might cause unpredictable token refresh timing. Token expiration time should always be provided in seconds.",{tokenExpireTime:t});return Math.floor((1e3*t-Date.now())/2)}catch{return xT}}static create(e,t={}){return new AT(e,t).init()}}const ET=/^data:(\S*?);base64,/;class TT extends(z()){file;xhr;_token;_apiAddress;constructor(e,t,i){if(super(),!e)throw new I("fileuploader-missing-file",null);if(!t)throw new I("fileuploader-missing-token",null);if(!i)throw new I("fileuploader-missing-api-address",null);this.file=function(e){if("string"!=typeof e)return  false;return !!e.match(ET)?.length}(e)?function(e,t=512){try{const i=e.match(ET)[1],n=atob(e.replace(ET,"")),s=[];for(let e=0;e<n.length;e+=t){const i=n.slice(e,e+t),o=new Array(i.length);for(let e=0;e<i.length;e++)o[e]=i.charCodeAt(e);s.push(new Uint8Array(o));}return new Blob(s,{type:i})}catch{throw new I("fileuploader-decoding-image-data-error",null)}}(e):e,this._token=t,this._apiAddress=i;}onProgress(e){return this.on("progress",(t,i)=>e(i)),this}onError(e){return this.once("error",(t,i)=>e(i)),this}abort(){this.xhr.abort();}send(){return this._prepareRequest(),this._attachXHRListeners(),this._sendRequest()}_prepareRequest(){const e=new XMLHttpRequest;e.open("POST",this._apiAddress),e.setRequestHeader("Authorization",this._token.value),e.responseType="json",this.xhr=e;}_attachXHRListeners(){const e=this.xhr,t=e=>()=>this.fire("error",e);e.addEventListener("error",t("Network Error")),e.addEventListener("abort",t("Abort")),e.upload&&e.upload.addEventListener("progress",e=>{e.lengthComputable&&this.fire("progress",{total:e.total,uploaded:e.loaded});}),e.addEventListener("load",()=>{const t=e.status,i=e.response;if(t<200||t>299)return this.fire("error",i.message||i.error)});}_sendRequest(){const e=new FormData,t=this.xhr;return e.append("file",this.file),new Promise((i,n)=>{t.addEventListener("load",()=>{const e=t.status,s=t.response;return e<200||e>299?s.message?n(new I("fileuploader-uploading-data-failed",this,{message:s.message})):n(s.error):i(s)}),t.addEventListener("error",()=>n(new Error("Network Error"))),t.addEventListener("abort",()=>n(new Error("Abort"))),t.send(e);})}}class ST{_token;_apiAddress;constructor(e,t){if(!e)throw new I("uploadgateway-missing-token",null);if(!t)throw new I("uploadgateway-missing-api-address",null);this._token=e,this._apiAddress=t;}upload(e){return new TT(e,this._token,this._apiAddress)}}class IT extends js{static get pluginName(){return "CloudServicesCore"}static get isOfficialPlugin(){return  true}createToken(e,t){return new AT(e,t)}createUploadGateway(e,t){return new ST(e,t)}}class PT extends js{tokenUrl;uploadUrl;webSocketUrl;bundleVersion;autoRefresh=true;token=null;_tokens=new Map;static get pluginName(){return "CloudServices"}static get isOfficialPlugin(){return  true}static get requires(){return [IT]}async init(){const e=this.context.config.get("cloudServices")||{};for(const[t,i]of Object.entries(e))this[t]=i;if(!this.tokenUrl)return void(this.token=null);const t=this.context.plugins.get("CloudServicesCore").createToken(this.tokenUrl,{autoRefresh:this.autoRefresh});try{this.token=await t.init(),this._tokens.set(this.tokenUrl,this.token);}catch(e){throw t.destroy(),e}}async registerTokenUrl(e){if(this._tokens.has(e))return this.getTokenFor(e);const t=this.context.plugins.get("CloudServicesCore"),i=await t.createToken(e,{autoRefresh:this.autoRefresh}).init();return this._tokens.set(e,i),i}getTokenFor(e){const t=this._tokens.get(e);if(!t)throw new I("cloudservices-token-not-registered",this);return t}destroy(){super.destroy();for(const e of this._tokens.values())e.destroy();}}class VT extends Ms{_token;static get pluginName(){return "CKBoxUtils"}static get isOfficialPlugin(){return  true}static get requires(){return [PT]}init(){const e=this.editor,t=!!e.config.get("ckbox"),i=!!window.CKBox;if(!t&&!i)return;e.config.define("ckbox",{serviceOrigin:"https://api.ckbox.io",defaultUploadCategories:null,ignoreDataId:false,language:e.locale.uiLanguage,theme:"lark",tokenUrl:e.config.get("cloudServices.tokenUrl")});const n=e.plugins.get(PT),s=e.config.get("cloudServices.tokenUrl"),o=e.config.get("ckbox.tokenUrl");if(!o)throw new I("ckbox-plugin-missing-token-url",this);this._token=o==s?Promise.resolve(n.token):n.registerTokenUrl(o),this._token=this._token.then(async e=>(await this._authorizePrivateCategoriesAccess(e.value),e));}getToken(){return this._token}async getWorkspaceId(){const e=(0, this.editor.t)("Cannot access default workspace."),t=this.editor.config.get("ckbox.defaultUploadWorkspaceId"),i=hT(await this._token,t);if(null==i)throw V("ckbox-access-default-workspace-error"),e;return i}async getCategoryIdForFile(e,t){const i=(0, this.editor.t)("Cannot determine a category for the uploaded file."),n=this.editor.config.get("ckbox.defaultUploadCategories"),s=this._getAvailableCategories(t),o="string"==typeof e?pT(await bT(e,t)):wT(e),r=await s;if(!r)throw i;if(n){const e=Object.keys(n).find(e=>n[e].find(e=>e.toLowerCase()==o));if(e){const t=r.find(t=>t.id===e||t.name===e);if(!t)throw i;return t.id}}const a=r.find(e=>e.extensions.find(e=>e.toLowerCase()==o));if(!a)throw i;return a.id}async _getAvailableCategories(e){const t=this.editor,i=this._token,{signal:n}=e,s=t.config.get("ckbox.serviceOrigin"),o=await this.getWorkspaceId();try{const e=[];let t,i=0;do{const n=await r(i);e.push(...n.items),t=n.totalCount-(i+50),i+=50;}while(t>0);return e}catch{return n.throwIfAborted(),void V("ckbox-fetch-category-http-error")}async function r(e){const t=new URL("categories",s);return t.searchParams.set("limit",String(50)),t.searchParams.set("offset",String(e)),t.searchParams.set("workspaceId",o),gT({url:t,signal:n,authorization:(await i).value})}}async _authorizePrivateCategoriesAccess(e){const t=this.editor.config.get("ckbox.serviceOrigin"),i=new FormData;i.set("token",e),await fetch(`${t}/categories/authorizePrivateAccess`,{method:"POST",credentials:"include",mode:"no-cors",body:i});}}class RT extends Ms{static get requires(){return [cE,iE,V_,LT]}static get pluginName(){return "CKBoxUploadAdapter"}static get isOfficialPlugin(){return  true}async afterInit(){const e=this.editor,t=!!e.config.get("ckbox"),i=!!window.CKBox;if(!t&&!i)return;const n=e.plugins.get(V_),s=e.plugins.get(VT);n.createUploadAdapter=t=>new OT(t,e,s);const o=!e.config.get("ckbox.ignoreDataId"),r=e.plugins.get(cE);o&&r.on("uploadComplete",(t,{imageElement:i,data:n})=>{e.model.change(e=>{e.setAttribute("ckboxImageId",n.ckboxImageId,i);});});}}let OT=class{loader;token;editor;controller;serviceOrigin;ckboxUtils;constructor(e,t,i){this.loader=e,this.token=i.getToken(),this.ckboxUtils=i,this.editor=t,this.controller=new AbortController,this.serviceOrigin=t.config.get("ckbox.serviceOrigin");}async upload(){const e=this.ckboxUtils,t=this.editor.t,i=await this.loader.file,n=await e.getCategoryIdForFile(i,{signal:this.controller.signal}),s=new URL("assets",this.serviceOrigin),o=new FormData;s.searchParams.set("workspaceId",await e.getWorkspaceId()),o.append("categoryId",n),o.append("file",i);return gT({method:"POST",url:s,data:o,onUploadProgress:e=>{e.lengthComputable&&(this.loader.uploadTotal=e.total,this.loader.uploaded=e.loaded);},signal:this.controller.signal,authorization:(await this.token).value}).then(async e=>{const t=dT(e.imageUrls);return {ckboxImageId:e.id,default:t.imageFallbackUrl,sources:t.imageSources}}).catch(()=>{const e=t("Cannot upload file:")+` ${i.name}.`;return Promise.reject(e)})}abort(){this.controller.abort();}};const BT="NoPermission";class LT extends Ms{static get pluginName(){return "CKBoxEditing"}static get isOfficialPlugin(){return  true}static get requires(){return [qx,QE,RT,VT]}init(){const e=this.editor;this._shouldBeInitialised()&&(this._checkImagePlugins(),DT()&&e.commands.add("ckbox",new vT(e)),async function(e){const t=e.plugins.get(VT),i=e.config.get("ckbox.serviceOrigin"),n=new URL("permissions",i),{value:s}=await t.getToken(),o=await gT({url:n,authorization:s,signal:(new AbortController).signal});return Object.values(o).some(e=>e["asset:create"])}(e).then(e=>{e||this._blockImageCommands();}));}afterInit(){const e=this.editor;this._shouldBeInitialised()&&(e.config.get("ckbox.ignoreDataId")||(this._initSchema(),this._initConversion(),this._initFixers()));}_shouldBeInitialised(){return !!this.editor.config.get("ckbox")||DT()}_blockImageCommands(){const e=this.editor,t=e.commands.get("uploadImage"),i=e.commands.get("ckboxImageEdit");t&&(t.isAccessAllowed=false,t.forceDisabled(BT)),i&&i.forceDisabled(BT);}_checkImagePlugins(){const e=this.editor;e.plugins.has("ImageBlockEditing")||e.plugins.has("ImageInlineEditing")||V("ckbox-plugin-image-feature-missing",e);}_initSchema(){const e=this.editor.model.schema;e.extend("$text",{allowAttributes:"ckboxLinkId"}),e.isRegistered("imageBlock")&&e.extend("imageBlock",{allowAttributes:["ckboxImageId","ckboxLinkId"]}),e.isRegistered("imageInline")&&e.extend("imageInline",{allowAttributes:["ckboxImageId","ckboxLinkId"]}),e.addAttributeCheck(e=>{if(!e.last.getAttribute("linkHref"))return  false},"ckboxLinkId");}_initConversion(){const e=this.editor;e.conversion.for("downcast").add(e=>{e.on("attribute:ckboxLinkId:imageBlock",(e,t,i)=>{const{writer:n,mapper:s,consumable:o}=i;if(!o.consume(t.item,e.name))return;const r=[...s.toViewElement(t.item).getChildren()].find(e=>"a"===e.name);r&&(t.item.hasAttribute("ckboxLinkId")?n.setAttribute("data-ckbox-resource-id",t.item.getAttribute("ckboxLinkId"),r):n.removeAttribute("data-ckbox-resource-id",r));},{priority:"low"}),e.on("attribute:ckboxLinkId",(e,t,i)=>{const{writer:n,mapper:s,consumable:o}=i;if(o.consume(t.item,e.name)){if(t.attributeOldValue){const e=FT(n,t.attributeOldValue);n.unwrap(s.toViewRange(t.range),e);}if(t.attributeNewValue){const e=FT(n,t.attributeNewValue);if(t.item.is("selection")){const t=n.document.selection;n.wrap(t.getFirstRange(),e);}else n.wrap(s.toViewRange(t.range),e);}}},{priority:"low"});}),e.conversion.for("upcast").add(e=>{e.on("element:a",(e,t,i)=>{const{writer:n,consumable:s}=i;if(!t.viewItem.getAttribute("href"))return;if(!s.consume(t.viewItem,{attributes:["data-ckbox-resource-id"]}))return;const o=t.viewItem.getAttribute("data-ckbox-resource-id");if(o)if(t.modelRange)for(let e of t.modelRange.getItems())e.is("$textProxy")&&(e=e.textNode),NT(e)&&n.setAttribute("ckboxLinkId",o,e);else {const e=t.modelCursor.nodeBefore||t.modelCursor.parent;n.setAttribute("ckboxLinkId",o,e);}},{priority:"low"});}),e.conversion.for("downcast").attributeToAttribute({model:"ckboxImageId",view:"data-ckbox-resource-id"}),e.conversion.for("upcast").elementToAttribute({model:{key:"ckboxImageId",value:e=>e.getAttribute("data-ckbox-resource-id")},view:{attributes:{"data-ckbox-resource-id":/[\s\S]+/}}});const t=e.commands.get("replaceImageSource");t&&this.listenTo(t,"cleanupImage",(e,[t,i])=>{t.removeAttribute("ckboxImageId",i);});}_initFixers(){const e=this.editor,t=e.model,i=t.document.selection;t.document.registerPostFixer(function(e){return t=>{let i=false;const n=e.model,s=e.commands.get("ckbox");if(!s)return i;for(const e of n.document.differ.getChanges()){if("insert"!==e.type&&"attribute"!==e.type)continue;const n="insert"===e.type?new ha(e.position,e.position.getShiftedBy(e.length)):e.range,o="attribute"===e.type&&"linkHref"===e.attributeKey&&null===e.attributeNewValue;for(const e of n.getItems()){if(o&&e.hasAttribute("ckboxLinkId")){t.removeAttribute("ckboxLinkId",e),i=true;continue}const n=MT(e,s._chosenAssets);for(const s of n){const n="image"===s.type?"ckboxImageId":"ckboxLinkId";s.id!==e.getAttribute(n)&&(t.setAttribute(n,s.id,e),i=true);}}}return i}}(e)),t.document.registerPostFixer(function(e){return t=>!(e.hasAttribute("linkHref")||!e.hasAttribute("ckboxLinkId"))&&(t.removeSelectionAttribute("ckboxLinkId"),true)}(i));}}function MT(e,t){const i=e.is("element","imageInline")||e.is("element","imageBlock"),n=e.hasAttribute("linkHref");return [...t].filter(t=>"image"===t.type&&i?t.attributes.imageFallbackUrl===e.getAttribute("src"):"link"===t.type&&n?t.attributes.linkHref===e.getAttribute("linkHref"):void 0)}function FT(e,t){const i=e.createAttributeElement("a",{"data-ckbox-resource-id":t},{priority:5});return e.setCustomProperty("link",true,i),i}function NT(e){return !!e.is("$text")||!(!e.is("element","imageInline")&&!e.is("element","imageBlock"))}function DT(){return !!window.CKBox}class zT extends Ms{static get pluginName(){return "CKBox"}static get isOfficialPlugin(){return  true}static get requires(){return [LT,$C]}}function HT(e){const t=qT(e);return e=>!(!e.is("element","imageInline")&&!e.is("element","imageBlock"))&&(!!e.hasAttribute("ckboxImageId")||!!e.hasAttribute("src")&&t(e.getAttribute("src")))}function qT(t){if(Array.isArray(t)){const e=t.map(qT);return t=>e.some(e=>e(t))}if("origin"==t){const t=exports.global.window.location.origin;return i=>new URL(i,exports.global.document.baseURI).origin==t}return "function"==typeof t?t:t instanceof RegExp?e=>!(!e.match(t)&&!e.replace(/^https?:\/\//,"").match(t)):()=>false}class UT extends Ns{_wrapper=null;_processInProgress=new Set;_canEdit;_prepareOptions;_updateUiDelayed=Fn(()=>this.editor.ui.update(),0);constructor(e){super(e),this.value=false,this._canEdit=HT(e.config.get("ckbox.allowExternalImagesEditing")),this._prepareOptions=Zt((e,t)=>this._prepareOptionsAbortable(e,t)),this._prepareListeners();}refresh(){const e=this.editor;this.value=this._getValue();const t=e.model.document.selection.getSelectedElement();this.isEnabled=!!t&&this._canEdit(t)&&!this._checkIfElementIsBeingProcessed(t);}execute(){if(this._getValue())return;const e=ii(document,"div",{class:"ck ckbox-wrapper"});this._wrapper=e,this.value=true,document.body.appendChild(this._wrapper);const t={element:this.editor.model.document.selection.getSelectedElement(),controller:new AbortController};this._prepareOptions(t).then(t=>window.CKBox.mountImageEditor(e,t),e=>{const t=this.editor,i=t.t;t.plugins.get(Xv).showWarning(i("Failed to determine category of edited image."),{namespace:"ckbox"}),console.error(e),this._handleImageEditorClose();});}destroy(){this._handleImageEditorClose(),this._prepareOptions.abort(),this._updateUiDelayed.cancel();for(const e of this._processInProgress.values())e.controller.abort();super.destroy();}_getValue(){return null!==this._wrapper}async _prepareOptionsAbortable(e,t){const i=this.editor,n=i.config.get("ckbox"),s=i.plugins.get(VT),{element:o}=t;let r;const a=o.getAttribute("ckboxImageId");if(a)r={assetId:a};else {const t=new URL(o.getAttribute("src"),document.baseURI).href;r={imageUrl:t,uploadCategoryId:await s.getCategoryIdForFile(t,{signal:e})};}return {...r,imageEditing:{allowOverwrite:false},tokenUrl:n.tokenUrl,language:n.language,...n.serviceOrigin&&{serviceOrigin:n.serviceOrigin},onClose:()=>this._handleImageEditorClose(),onSave:e=>this._handleImageEditorSave(t,e)}}_prepareListeners(){this.listenTo(this.editor.model.document,"change:data",()=>{this._getProcessingStatesOfDeletedImages().forEach(e=>{e.controller.abort();});});}_getProcessingStatesOfDeletedImages(){const e=[];for(const t of this._processInProgress.values())"$graveyard"==t.element.root.rootName&&e.push(t);return e}_checkIfElementIsBeingProcessed(e){for(const{element:t}of this._processInProgress)if(dt(t,e))return  true;return  false}_handleImageEditorClose(){this._wrapper&&(this._wrapper.remove(),this._wrapper=null,this.editor.editing.view.focus(),this._updateUiDelayed(),this.refresh());}_handleImageEditorSave(e,t){const i=this.editor.locale.t,n=this.editor.plugins.get(Xv),s=this.editor.plugins.get(Oh),o=s.add(i("Processing the edited image."));this._processInProgress.add(e),this._showImageProcessingIndicator(e.element,t),this.refresh(),this._waitForAssetProcessed(t.data.id,e.controller.signal).then(t=>{this._replaceImage(e.element,t);},t=>{this.editor.editing.reconvertItem(e.element),e.controller.signal.aborted||(!t||t instanceof I?n.showWarning(i("Server failed to process the image."),{namespace:"ckbox"}):console.error(t));}).finally(()=>{this._processInProgress.delete(e),s.remove(o),this.refresh();});}async _getAssetStatusFromServer(e,t){const i=this.editor.plugins.get(VT),n=new URL("assets/"+e,this.editor.config.get("ckbox.serviceOrigin")),s=await gT({url:n,signal:t,authorization:(await i.getToken()).value}),o=s.metadata.metadataProcessingStatus;if(!o||"queued"==o)throw new I("ckbox-image-not-processed");return {data:{...s}}}async _waitForAssetProcessed(e,t){const i=await Bn(()=>this._getAssetStatusFromServer(e,t),{signal:t,maxAttempts:5});if("success"!=i.data.metadata.metadataProcessingStatus)throw new I("ckbox-image-processing-failed");return i}_showImageProcessingIndicator(e,t){const i=this.editor;i.editing.view.change(n=>{const s=i.editing.mapper.toViewElement(e),o=this.editor.plugins.get("ImageUtils").findViewImgElement(s);n.removeStyle("aspect-ratio",o),n.setAttribute("width",t.data.metadata.width,o),n.setAttribute("height",t.data.metadata.height,o),n.setStyle("width",`${t.data.metadata.width}px`,o),n.setStyle("height",`${t.data.metadata.height}px`,o),n.addClass("image-processing",s);});}_replaceImage(e,t){const i=this.editor,{imageFallbackUrl:n,imageSources:s,imageWidth:o,imageHeight:r,imagePlaceholder:a}=_T(t),l=Array.from(i.model.document.selection.getRanges());i.model.change(c=>{c.setSelection(e,"on"),i.execute("insertImage",{imageType:e.is("element","imageInline")?"imageInline":null,source:{src:n,sources:s,width:o,height:r,...a?{placeholder:a}:null,...e.hasAttribute("alt")?{alt:e.getAttribute("alt")}:null}});const u=e.getChildren();e=i.model.document.selection.getSelectedElement();for(const t of u)c.append(c.cloneElement(t),e);c.setAttribute("ckboxImageId",t.data.id,e),c.setSelection(l);});}}class jT extends Ms{static get pluginName(){return "CKBoxImageEditEditing"}static get isOfficialPlugin(){return  true}static get requires(){return [LT,VT,Oh,Xv,pA,LA]}init(){const{editor:e}=this;e.commands.add("ckboxImageEdit",new UT(e));}}class $T extends Ms{static get pluginName(){return "CKBoxImageEditUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor;e.ui.componentFactory.add("ckboxImageEdit",t=>{const i=e.commands.get("ckboxImageEdit"),n=e.commands.get("uploadImage"),s=new Bp(t),o=t.t;return s.set({icon:Cm,tooltip:true}),s.bind("label").to(n,"isAccessAllowed",e=>o(e?"Edit image":"You have no image editing permissions.")),s.bind("isOn").to(i,"value",i,"isEnabled",(e,t)=>e&&t),s.bind("isEnabled").to(i),this.listenTo(s,"execute",()=>{e.execute("ckboxImageEdit"),e.editing.view.focus();}),s});}}class WT extends Ms{static get pluginName(){return "CKBoxImageEdit"}static get isOfficialPlugin(){return  true}static get requires(){return [jT,$T]}}class GT extends Ms{static get pluginName(){return "CKFinderUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor;e.ui.componentFactory.add("ckfinder",()=>this._createFileToolbarButton()),e.ui.componentFactory.add("menuBar:ckfinder",()=>this._createFileMenuBarButton()),e.plugins.has("ImageInsertUI")&&e.plugins.get("ImageInsertUI").registerIntegration({name:"assetManager",observable:()=>e.commands.get("ckfinder"),buttonViewCreator:()=>this._createImageToolbarButton(),formViewCreator:()=>this._createImageDropdownButton(),menuBarButtonViewCreator:e=>this._createImageMenuBarButton(e?"insertOnly":"insertNested")});}_createButton(e){const t=this.editor,i=new e(t.locale),n=t.commands.get("ckfinder");return i.bind("isEnabled").to(n),i.on("execute",()=>{t.execute("ckfinder"),t.editing.view.focus();}),i}_createFileToolbarButton(){const e=this.editor.locale.t,t=this._createButton(Bp);return t.icon=mm,t.label=e("Insert image or file"),t.tooltip=true,t}_createImageToolbarButton(){const e=this.editor.locale.t,t=this.editor.plugins.get("ImageInsertUI"),i=this._createButton(Bp);return i.icon=vg,i.bind("label").to(t,"isImageSelected",t=>e(t?"Replace image with file manager":"Insert image with file manager")),i.tooltip=true,i}_createImageDropdownButton(){const e=this.editor.locale.t,t=this.editor.plugins.get("ImageInsertUI"),i=this._createButton(Bp);return i.icon=vg,i.withText=true,i.bind("label").to(t,"isImageSelected",t=>e(t?"Replace with file manager":"Insert with file manager")),i.on("execute",()=>{t.dropdownView.isOpen=false;}),i}_createFileMenuBarButton(){const e=this.editor.locale.t,t=this._createButton(Jp);return t.icon=mm,t.withText=true,t.label=e("File"),t}_createImageMenuBarButton(e){const t=this.editor.locale.t,i=this.editor.locale.t,n=this._createButton(Jp);switch(n.icon=vg,n.withText=true,e){case "insertOnly":n.label=t("Image");break;case "insertNested":n.label=i("With file manager");}return n}}class KT extends Ns{constructor(e){super(e),this.affectsData=false,this.stopListening(this.editor.model.document,"change"),this.listenTo(this.editor.model.document,"change",()=>this.refresh(),{priority:"low"});}refresh(){const e=this.editor.commands.get("insertImage"),t=this.editor.commands.get("link");this.isEnabled=e.isEnabled||t.isEnabled;}execute(){const e=this.editor,t=this.editor.config.get("ckfinder.openerMethod")||"modal";if("popup"!=t&&"modal"!=t)throw new I("ckfinder-unknown-openermethod",e);const i=this.editor.config.get("ckfinder.options")||{};i.chooseFiles=true;const n=i.onInit;i.language||(i.language=e.locale.uiLanguage),i.onInit=t=>{n&&n(t),t.on("files:choose",i=>{const n=i.data.files.toArray(),s=n.filter(e=>!e.isImage()),o=n.filter(e=>e.isImage());for(const t of s)e.execute("link",t.getUrl());const r=[];for(const e of o){const i=e.getUrl();r.push(i||t.request("file:getProxyUrl",{file:e}));}r.length&&JT(e,r);}),t.on("file:choose:resizedImage",t=>{const i=t.data.resizedUrl;if(!i){const t=e.plugins.get("Notification"),i=e.locale.t;return void t.showWarning(i("Could not obtain resized image URL."),{title:i("Selecting resized image failed"),namespace:"ckfinder"})}JT(e,[i]);});},window.CKFinder[t](i);}}function JT(e,t){if(!e.commands.get("insertImage").isEnabled){const t=e.plugins.get("Notification"),i=e.locale.t;return void t.showWarning(i("Could not insert image at the current position."),{title:i("Inserting image failed"),namespace:"ckfinder"})}e.execute("insertImage",{source:t});}class QT extends Ms{static get pluginName(){return "CKFinderEditing"}static get isOfficialPlugin(){return  true}static get requires(){return [Xv,qx]}init(){const e=this.editor;if(!e.plugins.has("ImageBlockEditing")&&!e.plugins.has("ImageInlineEditing"))throw new I("ckfinder-missing-image-plugin",e);e.commands.add("ckfinder",new KT(e));}}class YT extends Ms{static get pluginName(){return "CKFinder"}static get isOfficialPlugin(){return  true}static get requires(){return [eA,q_,QT,GT]}}function ZT(e){const t=e.t,i=e.config.get("codeBlock.languages");for(const e of i)"Plain text"===e.label&&(e.label=t("Plain text")),void 0===e.class&&(e.class=`language-${e.language}`);return i}function XT(e,t,i){const n={};for(const s of e)if("class"===t){n[s[t].split(" ").shift()]=s[i];}else n[s[t]]=s[i];return n}function eS(e){return e.data.match(/^(\s*)/)[0]}function tS(e,t){const i=e.createDocumentFragment(),n=t.split("\n"),s=n.reduce((t,i,s)=>(t.push(i),s<n.length-1&&t.push(e.createElement("br")),t),[]);return e.appendChild(s,i),i}function iS(e){const t=e.document.selection,i=[];if(t.isCollapsed)return [t.anchor];const n=t.getFirstRange().getWalker({ignoreElementEnd:true,direction:"backward"});for(const{item:t}of n){let n=t.is("$textProxy")?t.textNode:t;const s=n.parent;if(!s.is("element","codeBlock")||n.is("element","softBreak"))continue;for(;n.previousSibling&&!n.previousSibling.is("element","softBreak");)n=n.previousSibling;const o=n.is("$text")?n.startOffset+eS(n).length:n.startOffset,r=e.createPositionAt(s,o);i.every(e=>!e.isEqual(r))&&i.push(r);}return i}function nS(e){const t=Cn(e.getSelectedBlocks());return !!t&&t.is("element","codeBlock")}function sS(e,t){return !t.is("rootElement")&&!e.isLimit(t)&&e.checkChild(t.parent,"codeBlock")}function oS(e,t,i,n){const s=XT(t,"language","label"),o=i.getAttribute("language");if(o in s){const t=s[o];return e("enter"===n?"Entering %0 code snippet":"Leaving %0 code snippet",t)}return e("enter"===n?"Entering code snippet":"Leaving code snippet")}function rS(e,t){for(e.textNode&&(e=t.createPositionBefore(e.textNode));e.nodeBefore&&!e.nodeBefore.is("element","softBreak");)e=t.createPositionBefore(e.nodeBefore);const i=e.nodeAfter;return i&&i.is("$text")?i:null}class aS extends Ns{_lastLanguage;constructor(e){super(e),this._lastLanguage=null;}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled();}execute(e={}){const t=this.editor,i=t.model,n=i.document.selection,s=ZT(t)[0],o=Array.from(n.getSelectedBlocks()),r=null==e.forceValue?!this.value:e.forceValue,a=function(e,t,i){if(e.language)return e.language;if(e.usePreviousLanguageChoice&&t)return t;return i}(e,this._lastLanguage,s.language);i.change(e=>{r?this._applyCodeBlock(e,o,a):this._removeCodeBlock(e,o);});}_getValue(){const e=Cn(this.editor.model.document.selection.getSelectedBlocks());return !!!!e?.is("element","codeBlock")&&e.getAttribute("language")}_checkEnabled(){if(this.value)return  true;const e=this.editor.model.document.selection,t=this.editor.model.schema,i=Cn(e.getSelectedBlocks());return !!i&&sS(t,i)}_applyCodeBlock(e,t,i){this._lastLanguage=i;const n=this.editor.model.schema,s=t.filter(e=>sS(n,e));for(const t of s)e.rename(t,"codeBlock"),e.setAttribute("language",i,t),n.removeDisallowedAttributes([t],e),Array.from(t.getChildren()).filter(e=>!n.checkChild(t,e)).forEach(t=>e.remove(t));s.reverse().forEach((t,i)=>{const n=s[i+1];t.previousSibling===n&&(e.appendElement("softBreak",n),e.merge(e.createPositionBefore(t)));});}_removeCodeBlock(e,t){const i=t.filter(e=>e.is("element","codeBlock"));for(const t of i){const i=e.createRangeOn(t);for(const t of Array.from(i.getItems()).reverse())if(t.is("element","softBreak")&&t.parent.is("element","codeBlock")){const{position:i}=e.split(e.createPositionBefore(t)),n=i.nodeAfter;e.rename(n,"paragraph"),e.removeAttribute("language",n),e.remove(t);}e.rename(t,"paragraph"),e.removeAttribute("language",t);}}}class lS extends Ns{_indentSequence;constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence");}refresh(){this.isEnabled=this._checkEnabled();}execute(){const e=this.editor.model;e.change(t=>{const i=iS(e);for(const n of i){const i=t.createText(this._indentSequence);e.insertContent(i,n);}});}_checkEnabled(){return !!this._indentSequence&&nS(this.editor.model.document.selection)}}class cS extends Ns{_indentSequence;constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence");}refresh(){this.isEnabled=this._checkEnabled();}execute(){const e=this.editor.model;e.change(()=>{const t=iS(e);for(const i of t){const t=uS(e,i,this._indentSequence);t&&e.deleteContent(e.createSelection(t));}});}_checkEnabled(){if(!this._indentSequence)return  false;const e=this.editor.model;return !!nS(e.document.selection)&&iS(e).some(t=>uS(e,t,this._indentSequence))}}function uS(e,t,i){const n=rS(t,e);if(!n)return null;const s=eS(n),o=s.lastIndexOf(i);if(o+i.length!==s.length)return null;if(-1===o)return null;const{parent:r,startOffset:a}=n;return e.createRange(e.createPositionAt(r,a+o),e.createPositionAt(r,a+o+i.length))}function dS(e,t,i=false){const n=XT(t,"language","class"),s=XT(t,"language","label");return (t,o,r)=>{const{writer:a,mapper:l,consumable:c}=r;if(!c.consume(o.item,"insert"))return;const u=o.item.getAttribute("language"),d=l.toViewPosition(e.createPositionBefore(o.item)),h={};i&&(h["data-language"]=s[u],h.spellcheck="false");const m=n[u]?{class:n[u]}:void 0,g=a.createContainerElement("code",m),f=a.createContainerElement("pre",h,g);a.insert(d,f),l.bindElements(o.item,g);}}function hS(e){return (t,i,n)=>{if("codeBlock"!==i.item.parent.name)return;const{writer:s,mapper:o,consumable:r}=n;if(!r.consume(i.item,"insert"))return;const a=o.toViewPosition(e.createPositionBefore(i.item));s.insert(a,s.createText("\n"));}}function mS(e,t){const i=XT(t,"class","language"),n=t[0].language;return (e,t,s)=>{const o=t.viewItem,r=o.parent;if(!r||!r.is("element","pre"))return;if(t.modelCursor.findAncestor("codeBlock"))return;const{consumable:a,writer:l}=s;if(!a.test(o,{name:true}))return;const c=l.createElement("codeBlock"),u=[...o.getClassNames()];u.length||u.push("");for(const e of u){const t=i[e];if(t){a.consume(o,{classes:[e]}),l.setAttribute("language",t,c);break}}c.hasAttribute("language")||l.setAttribute("language",n,c),s.convertChildren(o,c),s.safeInsert(c,t.modelCursor)&&(a.consume(o,{name:true}),s.updateConversionResult(c,t));}}function gS(){return (e,t,{consumable:i,writer:n})=>{let s=t.modelCursor;if(!i.test(t.viewItem))return;if(!s.findAncestor("codeBlock"))return;i.consume(t.viewItem);const o=t.viewItem.data.split("\n").map(e=>n.createText(e)),r=o[o.length-1];for(const e of o)if(n.insert(e,s),s=s.getShiftedBy(e.offsetSize),e!==r){const e=n.createElement("softBreak");n.insert(e,s),s=n.createPositionAfter(e);}t.modelRange=n.createRange(t.modelCursor,s),t.modelCursor=s;}}function fS(){return (e,t,{consumable:i})=>{const n=t.viewItem;if(n.findAncestor("pre"))return;const s=Array.from(n.getChildren()),o=s.find(e=>e.is("element","code"));if(o)for(const e of s)e!==o&&e.is("$text")&&i.consume(e,{name:true});}}const pS="paragraph";class bS extends Ms{static get pluginName(){return "CodeBlockEditing"}static get isOfficialPlugin(){return  true}static get requires(){return [Mk]}constructor(e){super(e),e.config.define("codeBlock",{languages:[{language:"plaintext",label:"Plain text"},{language:"c",label:"C"},{language:"cs",label:"C#"},{language:"cpp",label:"C++"},{language:"css",label:"CSS"},{language:"diff",label:"Diff"},{language:"go",label:"Go"},{language:"html",label:"HTML"},{language:"java",label:"Java"},{language:"javascript",label:"JavaScript"},{language:"php",label:"PHP"},{language:"python",label:"Python"},{language:"ruby",label:"Ruby"},{language:"typescript",label:"TypeScript"},{language:"xml",label:"XML"}],indentSequence:"\t"});}init(){const e=this.editor,t=e.model.schema,i=e.model,n=e.editing.view,s=ZT(e);e.commands.add("codeBlock",new aS(e)),e.commands.add("indentCodeBlock",new lS(e)),e.commands.add("outdentCodeBlock",new cS(e)),this.listenTo(n.document,"tab",(t,i)=>{const n=i.shiftKey?"outdentCodeBlock":"indentCodeBlock";e.commands.get(n).isEnabled&&(e.execute(n),i.stopPropagation(),i.preventDefault(),t.stop());},{context:"pre"}),t.register("codeBlock",{allowWhere:"$block",allowChildren:"$text",disallowChildren:"$inlineObject",allowAttributes:["language"],allowAttributesOf:"$listItem",isBlock:true}),t.addAttributeCheck((e,i)=>{const n=e.getItem(e.length-2);if(t.getAttributeProperties(i).isFormatting&&n&&"codeBlock"==n.name)return  false}),e.editing.downcastDispatcher.on("insert:codeBlock",dS(i,s,true)),e.data.downcastDispatcher.on("insert:codeBlock",dS(i,s)),e.data.downcastDispatcher.on("insert:softBreak",hS(i),{priority:"high"}),e.data.upcastDispatcher.on("element:code",mS(0,s)),e.data.upcastDispatcher.on("text",(e,t,{consumable:i,writer:n})=>{let s=t.modelCursor;if(!i.test(t.viewItem))return;if(!s.findAncestor("codeBlock"))return;i.consume(t.viewItem);const o=t.viewItem.data.split("\n").map(e=>n.createText(e)),r=o[o.length-1];for(const e of o)if(n.insert(e,s),s=s.getShiftedBy(e.offsetSize),e!==r){const e=n.createElement("softBreak");n.insert(e,s),s=n.createPositionAfter(e);}t.modelRange=n.createRange(t.modelCursor,s),t.modelCursor=s;}),e.data.upcastDispatcher.on("element:pre",fS(),{priority:"high"}),this.listenTo(e.editing.view.document,"clipboardInput",(t,n)=>{let s=i.createRange(i.document.selection.anchor);if(n.targetRanges&&(s=e.editing.mapper.toModelRange(n.targetRanges[0])),!s.start.parent.is("element","codeBlock"))return;const o=n.dataTransfer.getData("text/plain"),r=new Cu(e.editing.view.document);n.content=tS(r,o);}),e.plugins.has("ClipboardPipeline")&&e.plugins.get(tx).on("contentInsertion",(i,n)=>{const s=e.model,o=s.document.selection;o.anchor.parent.is("element","codeBlock")&&s.change(e=>{const i=e.createRangeIn(n.content);for(const n of [...i.getItems()])n.is("node")&&!t.checkChild(o.anchor,n)&&e.remove(n);});}),this.listenTo(i,"getSelectedContent",(e,[n])=>{const s=n.anchor;!n.isCollapsed&&s.parent.is("element","codeBlock")&&s.hasSameParentAs(n.focus)&&i.change(i=>{const o=e.return;if(s.parent.is("element")&&(o.childCount>1||n.containsEntireContent(s.parent))){const t=i.createElement("codeBlock",s.parent.getAttributes());i.append(o,t);const n=i.createDocumentFragment();return i.append(t,n),void(e.return=n)}const r=o.getChild(0);t.checkAttribute(r,"code")&&i.setAttribute("code",true,r);});});}afterInit(){const e=this.editor,t=e.commands,i=t.get("indent"),n=t.get("outdent");i&&i.registerChildCommand(t.get("indentCodeBlock"),{priority:"highest"}),n&&n.registerChildCommand(t.get("outdentCodeBlock")),this.listenTo(e.editing.view.document,"enter",(t,i)=>{e.model.document.selection.getLastPosition().parent.is("element","codeBlock")&&(function(e,t){const i=e.model,n=i.document,s=e.editing.view,o=n.selection.getLastPosition(),r=o.nodeAfter;if(t||!n.selection.isCollapsed||!o.isAtStart)return  false;if(!vS(r))return  false;return e.model.change(t=>{e.execute("enter");const i=n.selection.anchor.parent.previousSibling;t.rename(i,pS),t.setSelection(i,"in"),e.model.schema.removeDisallowedAttributes([i],t),t.remove(r);}),s.scrollToTheSelection(),true}(e,i.isSoft)||function(e,t){const i=e.model,n=i.document,s=e.editing.view,o=n.selection.getLastPosition(),r=o.nodeBefore;let a;if(t||!n.selection.isCollapsed||!o.isAtEnd||!r||!r.previousSibling)return  false;if(vS(r)&&vS(r.previousSibling))a=i.createRange(i.createPositionBefore(r.previousSibling),i.createPositionAfter(r));else if(wS(r)&&vS(r.previousSibling)&&vS(r.previousSibling.previousSibling))a=i.createRange(i.createPositionBefore(r.previousSibling.previousSibling),i.createPositionAfter(r));else {if(!(wS(r)&&vS(r.previousSibling)&&wS(r.previousSibling.previousSibling)&&r.previousSibling.previousSibling&&vS(r.previousSibling.previousSibling.previousSibling)))return  false;a=i.createRange(i.createPositionBefore(r.previousSibling.previousSibling.previousSibling),i.createPositionAfter(r));}return e.model.change(t=>{t.remove(a),e.execute("enter");const i=n.selection.anchor.parent;t.rename(i,pS),e.model.schema.removeDisallowedAttributes([i],t);}),s.scrollToTheSelection(),true}(e,i.isSoft)||function(e){const t=e.model,i=t.document;let n;const s=rS(i.selection.getLastPosition(),t);s&&s.is("$text")&&(n=eS(s));e.model.change(t=>{e.execute("shiftEnter"),n&&t.insertText(n,i.selection.anchor);});}(e),i.preventDefault(),t.stop());},{context:"pre"}),this._initAriaAnnouncements();}_initAriaAnnouncements(){const{model:e,ui:t,t:i}=this.editor,n=ZT(this.editor);let s=null;e.document.selection.on("change:range",()=>{const o=e.document.selection.focus.parent;t&&s!==o&&o.is("element")&&(s&&s.is("element","codeBlock")&&t.ariaLiveAnnouncer.announce(oS(i,n,s,"leave")),o.is("element","codeBlock")&&t.ariaLiveAnnouncer.announce(oS(i,n,o,"enter")),s=o);});}}function wS(e){return e&&e.is("$text")&&!e.data.match(/\S/)}function vS(e){return e&&e.is("element","softBreak")}class _S extends Ms{static get pluginName(){return "CodeBlockUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.t,i=e.ui.componentFactory,n=ZT(e),s=this._getLanguageListItemDefinitions(n),o=e.commands.get("codeBlock");i.add("codeBlock",i=>{const n=ww(i,bw),r=n.buttonView,a=t("Insert code block");return r.set({label:a,tooltip:true,icon:Am,isToggleable:true}),r.bind("isOn").to(o,"value",e=>!!e),r.on("execute",()=>{e.execute("codeBlock",{usePreviousLanguageChoice:true}),e.editing.view.focus();}),n.on("execute",t=>{e.execute("codeBlock",{language:t.source._codeBlockLanguage,forceValue:true}),e.editing.view.focus();}),n.class="ck-code-block-dropdown",n.bind("isEnabled").to(o),Cw(n,s,{role:"menu",ariaLabel:a}),n}),i.add("menuBar:codeBlock",i=>{const n=new x_(i);n.buttonView.set({role:"menuitem",label:t("Code block"),icon:Am}),n.bind("isEnabled").to(o);const r=new A_(i);r.set({ariaLabel:t("Insert code block")});for(const t of s){const s=new Av(i,n),a=new Jp(i);a.bind(...Object.keys(t.model)).to(t.model),a.set({isToggleable:true,role:"menuitemcheckbox"}),a.delegate("execute").to(n),a.on("execute",()=>{e.execute("codeBlock",{language:t.model._codeBlockLanguage,forceValue:o.value!=t.model._codeBlockLanguage}),e.editing.view.focus();}),s.children.add(a),r.items.add(s);}return n.panelView.children.add(r),n});}_getLanguageListItemDefinitions(e){const t=this.editor.commands.get("codeBlock"),i=new kn;for(const n of e){const e={type:"button",model:new e_({_codeBlockLanguage:n.language,label:n.label,role:"menuitemradio",withText:true})};e.model.bind("isOn").to(t,"value",t=>t===e.model._codeBlockLanguage),i.add(e);}return i}}class yS extends Ms{static get requires(){return [bS,_S]}static get pluginName(){return "CodeBlock"}static get isOfficialPlugin(){return  true}}class kS extends Ms{_uploadGateway;static get pluginName(){return "CloudServicesUploadAdapter"}static get isOfficialPlugin(){return  true}static get requires(){return [PT,V_]}init(){const e=this.editor,t=e.plugins.get(PT),i=t.token,n=t.uploadUrl;if(!i)return;const s=e.plugins.get("CloudServicesCore");this._uploadGateway=s.createUploadGateway(i,n),e.plugins.get(V_).createUploadAdapter=e=>new CS(this._uploadGateway,e);}}class CS{uploadGateway;loader;fileUploader;constructor(e,t){this.uploadGateway=e,this.loader=t;}upload(){return this.loader.file.then(e=>(this.fileUploader=this.uploadGateway.upload(e),this.fileUploader.on("progress",(e,t)=>{this.loader.uploadTotal=t.total,this.loader.uploaded=t.uploaded;}),this.fileUploader.send()))}abort(){this.fileUploader.abort();}}class xS extends Ms{static get pluginName(){return "EasyImage"}static get isOfficialPlugin(){return  true}static get requires(){return [kS,hE]}init(){const e=this.editor;e.plugins.has("ImageBlockEditing")||e.plugins.has("ImageInlineEditing")||P("easy-image-image-feature-missing",e);}}class AS extends Uv{view;constructor(e,t){super(e),this.view=t;}get element(){return this.view.editable.element}init(){const e=this.editor,t=this.view,i=e.editing.view,n=t.editable,s=i.document.getRoot();n.name=s.rootName,t.render();const o=n.element;this.setEditableElement(n.name,o),n.bind("isFocused").to(this.focusTracker),i.attachDomRoot(o),this._initPlaceholder(),this.initMenuBar(this.view.menuBarView),this.fire("ready");}destroy(){super.destroy();const e=this.view,t=this.editor.editing.view;t.getDomRoot(e.editable.name)&&t.detachDomRoot(e.editable.name),e.destroy();}_initPlaceholder(){const e=this.editor,t=e.editing.view,i=t.document.getRoot(),n=e.config.get("roots")[i.rootName].placeholder;n&&(i.placeholder=n),Ks({view:t,element:i,isDirectHost:false,keepOnFocus:true});}}class ES extends $v{editable;menuBarView;constructor(e,t,i,n){super(e),this.editable=new Kv(e,t,i,{label:n}),this.menuBarView=new I_(e),this.menuBarView.extendTemplate({attributes:{class:["ck-reset_all","ck-rounded-corners"],dir:e.uiLanguageDirection}});}render(){super.render(),this.registerChild(this.editable),this.registerChild(this.menuBarView);}}class TS extends(Ah(kh)){static get editorName(){return "BalloonEditor"}ui;constructor(e,t={}){const{sourceElementOrData:i,editorConfig:n}=Sh(e,t);super(n),Th(i,this.config);const s=this.config.get("roots").main.element;if(St(s)){if("TEXTAREA"===s.tagName)throw new I("editor-wrong-element",null);this.sourceElement=s,Eh(this,s);}const o=this.config.get("plugins");o.push(b_),this.config.set("plugins",o),this.config.define("balloonToolbar",this.config.get("toolbar")),this.model.document.createRoot();const r=new ES(this.locale,this.editing.view,this.sourceElement,this.config.get("roots").main.label);this.ui=new AS(this,r),xh(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(i=>{const n=new this(e,t);i(n.initPlugins().then(()=>n.ui.init()).then(()=>n.data.init(n.config.get("roots").main.initialData)).then(()=>n.fire("ready")).then(()=>n));})}}class SS extends Uv{view;_toolbarConfig;_elementReplacer;constructor(e,t){super(e),this.view=t,this._toolbarConfig=dw(e.config.get("toolbar")),this._elementReplacer=new Yt,this.listenTo(e.editing.view,"scrollToTheSelection",this._handleScrollToTheSelectionWithStickyPanel.bind(this));}get element(){return this.view.element}init(e){const t=this.editor,i=this.view,n=t.editing.view,s=i.editable,o=n.document.getRoot();s.name=o.rootName,i.render();const r=s.element;this.setEditableElement(s.name,r),i.editable.bind("isFocused").to(this.focusTracker),n.attachDomRoot(r),e&&this._elementReplacer.replace(e,this.element),this._initPlaceholder(),this._initToolbar(),i.menuBarView&&this.initMenuBar(i.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",({visualTop:e})=>e||0),e.toolbar.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(e.toolbar);}_initPlaceholder(){const e=this.editor,t=e.editing.view,i=t.document.getRoot(),n=e.sourceElement;let s;const o=e.config.get("roots")[this.view.editable.name].placeholder;o&&(s=o),!s&&n&&"textarea"===n.tagName.toLowerCase()&&(s=n.getAttribute("placeholder")),s&&(i.placeholder=s),Ks({view:t,element:i,isDirectHost:false,keepOnFocus:true});}_initContextualBalloonIntegration(){if(!this.editor.plugins.has("ContextualBalloon"))return;const{stickyPanel:e}=this.view,t=this.editor.plugins.get("ContextualBalloon");t.on("getPositionOptions",t=>{const i=t.return;if(!i||!e.isSticky||!e.element)return;const n=new Ci(e.element).height,s="function"==typeof i.target?i.target():i.target,o="function"==typeof i.limiter?i.limiter():i.limiter;if(s&&o&&new Ci(s).height>=new Ci(o).height-n)return;const r={...i.viewportOffsetConfig},a=(r.top||0)+n;t.return={...i,viewportOffsetConfig:{...r,top:a}};},{priority:"low"});const i=()=>{t.visibleView&&t.updatePosition();};this.listenTo(e,"change:isSticky",i),this.listenTo(this.editor.ui,"change:viewportOffset",i);}_handleScrollToTheSelectionWithStickyPanel(e,t,i){const n=this.view.stickyPanel;if(n.isSticky){const e=new Ci(n.element).height;t.viewportOffset.top+=e;}else {const e=()=>{this.editor.editing.view.scrollToTheSelection(i);};this.listenTo(n,"change:isSticky",e),setTimeout(()=>{this.stopListening(n,"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 i=t.view;i.on("moveTo",(t,n)=>{if(!e.isSticky||i.wasMoved||i.isModal)return;const s=new Ci(e.contentPanelElement);n[1]<s.bottom+$p.defaultOffset&&(n[1]=s.bottom+$p.defaultOffset);},{priority:"high"});},{priority:"low"});}}class IS extends Wv{stickyPanel;toolbar;editable;constructor(e,t,i={}){super(e),this.stickyPanel=new r_(e),this.toolbar=new mw(e,{shouldGroupWhenFull:i.shouldToolbarGroupWhenFull}),i.useMenuBar&&(this.menuBarView=new I_(e)),this.editable=new Kv(e,t,void 0,{label:i.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 PS extends(Ah(kh)){static get editorName(){return "ClassicEditor"}ui;constructor(e,t={}){const{sourceElementOrData:i,editorConfig:n}=Sh(e,t);super(n),Th(i,this.config,"main",true);const s=this.config.get("attachTo");this.config.define("menuBar.isVisible",false),St(s)&&(this.sourceElement=s),this.model.document.createRoot();const o=!this.config.get("toolbar.shouldNotGroupWhenFull"),r=this.config.get("menuBar"),a=new IS(this.locale,this.editing.view,{shouldToolbarGroupWhenFull:o,useMenuBar:r.isVisible,label:this.config.get("roots").main.label});this.ui=new SS(this,a),xh(this);}destroy(){return this.sourceElement&&this.updateSourceElement(),this.ui.destroy(),super.destroy()}static create(e,t={}){return new Promise(i=>{const n=new this(e,t);i(n.initPlugins().then(()=>n.ui.init(n.config.get("attachTo")||null)).then(()=>n.data.init(n.config.get("roots").main.initialData)).then(()=>n.fire("ready")).then(()=>n));})}}class VS extends Uv{view;constructor(e,t){super(e),this.view=t;}init(){const e=this.editor,t=this.view,i=e.editing.view,n=t.editable,s=i.document.getRoot();n.name=s.rootName,t.render();const o=n.element;this.setEditableElement(n.name,o),t.editable.bind("isFocused").to(this.focusTracker),i.attachDomRoot(o),this._initPlaceholder(),this._initToolbar(),this.initMenuBar(this.view.menuBarView),this.fire("ready");}destroy(){super.destroy();const e=this.view,t=this.editor.editing.view;t.getDomRoot(e.editable.name)&&t.detachDomRoot(e.editable.name),e.destroy();}_initToolbar(){const e=this.editor,t=this.view;t.toolbar.fillFromConfig(e.config.get("toolbar"),this.componentFactory),this.addToolbar(t.toolbar);}_initPlaceholder(){const e=this.editor,t=e.editing.view,i=t.document.getRoot(),n=e.config.get("roots")[i.rootName].placeholder;n&&(i.placeholder=n),Ks({view:t,element:i,isDirectHost:false,keepOnFocus:true});}}class RS extends $v{toolbar;editable;menuBarView;constructor(e,t,i={}){super(e),this.toolbar=new mw(e,{shouldGroupWhenFull:i.shouldToolbarGroupWhenFull}),this.menuBarView=new I_(e),this.editable=new Kv(e,t,i.editableElement,{label:i.label}),this.toolbar.extendTemplate({attributes:{class:["ck-reset_all","ck-rounded-corners"],dir:e.uiLanguageDirection}}),this.menuBarView.extendTemplate({attributes:{class:["ck-reset_all","ck-rounded-corners"],dir:e.uiLanguageDirection}});}render(){super.render(),this.registerChild([this.menuBarView,this.toolbar,this.editable]);}}class OS extends(Ah(kh)){static get editorName(){return "DecoupledEditor"}ui;constructor(e,t={}){const{sourceElementOrData:i,editorConfig:n}=Sh(e,t);super(n),Th(i,this.config);const s=this.config.get("roots").main.element;if(St(s)){if("TEXTAREA"===s.tagName)throw new I("editor-wrong-element",null);this.sourceElement=s,Eh(this,s);}this.model.document.createRoot();const o=!this.config.get("toolbar.shouldNotGroupWhenFull"),r=new RS(this.locale,this.editing.view,{editableElement:this.sourceElement,shouldToolbarGroupWhenFull:o,label:this.config.get("roots").main.label});this.ui=new VS(this,r);}destroy(){const e=this.getData();return this.ui.destroy(),super.destroy().then(()=>{this.sourceElement&&this.updateSourceElement(e);})}static create(e,t={}){return new Promise(i=>{const n=new this(e,t);i(n.initPlugins().then(()=>n.ui.init()).then(()=>n.data.init(n.config.get("roots").main.initialData)).then(()=>n.fire("ready")).then(()=>n));})}}class BS extends Uv{view;_toolbarConfig;constructor(e,t){super(e),this.view=t,this._toolbarConfig=dw(e.config.get("toolbar"));}get element(){return this.view.editable.element}init(){const e=this.editor,t=this.view,i=e.editing.view,n=t.editable,s=i.document.getRoot();n.name=s.rootName,t.render();const o=n.element;this.setEditableElement(n.name,o),n.bind("isFocused").to(this.focusTracker),i.attachDomRoot(o),this._initPlaceholder(),this._initToolbar(),t.menuBarView&&this.initMenuBar(t.menuBarView),this.fire("ready");}destroy(){super.destroy();const e=this.view,t=this.editor.editing.view;t.getDomRoot(e.editable.name)&&t.detachDomRoot(e.editable.name),e.destroy();}_initToolbar(){const e=this.editor,t=this.view,i=t.editable.element,n=t.toolbar;t.panel.bind("isVisible").to(this.focusTracker,"isFocused"),t.bind("viewportTopOffset").to(this,"viewportOffset",({visualTop:e})=>e||0),t.listenTo(e.ui,"update",()=>{t.panel.isVisible&&t.panel.pin({target:i,positions:t.panelPositions});}),n.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(n);}_initPlaceholder(){const e=this.editor,t=e.editing.view,i=t.document.getRoot(),n=e.config.get("roots")[i.rootName].placeholder;n&&(i.placeholder=n),Ks({view:t,element:i,isDirectHost:false,keepOnFocus:true});}}const LS=Ri("px");class MS extends $v{toolbar;panel;panelPositions;editable;_resizeObserver;constructor(e,t,i,n={}){super(e),this.toolbar=new mw(e,{shouldGroupWhenFull:n.shouldToolbarGroupWhenFull,isFloating:true}),n.useMenuBar&&(this.menuBarView=new I_(e)),this.set("viewportTopOffset",0),this.panel=new eb(e),this.panelPositions=this._getPanelPositions(),this.panel.extendTemplate({attributes:{class:"ck-toolbar-container"}}),this.editable=new Kv(e,t,i,{label:n.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 Pi(e,()=>{this.toolbar.maxWidth=LS(new Ci(e).width);});}}destroy(){super.destroy(),this._resizeObserver&&this._resizeObserver.destroy();}_getPanelPositionTop(e,t){let i;return i=e.top>t.height+this.viewportTopOffset?e.top-t.height:e.bottom>t.height+this.viewportTopOffset+50?this.viewportTopOffset:e.bottom,i}_getPanelPositions(){const e=[(e,t)=>({top:this._getPanelPositionTop(e,t),left:e.left,name:"toolbar_west",config:{withArrow:false}}),(e,t)=>({top:this._getPanelPositionTop(e,t),left:e.left+e.width-t.width,name:"toolbar_east",config:{withArrow:false}})];return "ltr"===this.locale.uiLanguageDirection?e:e.reverse()}}class FS extends(Ah(kh)){static get editorName(){return "InlineEditor"}ui;constructor(e,t={}){const{sourceElementOrData:i,editorConfig:n}=Sh(e,t);super(n),Th(i,this.config);const s=this.config.get("roots").main.element;if(St(s)){if("TEXTAREA"===s.tagName)throw new I("editor-wrong-element",null);this.sourceElement=s,Eh(this,s);}this.config.define("menuBar.isVisible",false),this.model.document.createRoot();const o=!this.config.get("toolbar.shouldNotGroupWhenFull"),r=this.config.get("menuBar"),a=new MS(this.locale,this.editing.view,this.sourceElement,{shouldToolbarGroupWhenFull:o,useMenuBar:r.isVisible,label:this.config.get("roots").main.label});this.ui=new BS(this,a),xh(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(i=>{const n=new this(e,t);i(n.initPlugins().then(()=>n.ui.init()).then(()=>n.data.init(n.config.get("roots").main.initialData)).then(()=>n.fire("ready")).then(()=>n));})}}class NS extends Uv{view;_lastFocusedEditableElement;constructor(e,t){super(e),this.view=t,this._lastFocusedEditableElement=null;}init(){this.view.render(),this.focusTracker.on("change:focusedElement",(e,t,i)=>{for(const e of Object.values(this.view.editables))i===e.element&&(this._lastFocusedEditableElement=e.element);}),this.focusTracker.on("change:isFocused",(e,t,i)=>{i||(this._lastFocusedEditableElement=null);});for(const e of Object.values(this.view.editables))this.addEditable(e);this._initToolbar(),this.initMenuBar(this.view.menuBarView),this.fire("ready");}addEditable(e,t){const i=e.element;this.editor.editing.view.attachDomRoot(i,e.name),this.setEditableElement(e.name,i),e.bind("isFocused").to(this.focusTracker,"isFocused",this.focusTracker,"focusedElement",(e,t)=>!!e&&(t===i||this._lastFocusedEditableElement===i)),this._initPlaceholder(e,t);}removeEditable(e){const t=this.editor.editing.view;t.getDomRoot(e.name)&&t.detachDomRoot(e.name),e.unbind("isFocused"),this.removeEditableElement(e.name);}destroy(){super.destroy();for(const e of Object.values(this.view.editables))this.removeEditable(e);this.view.destroy();}_initToolbar(){const e=this.editor,t=this.view;t.toolbar.fillFromConfig(e.config.get("toolbar"),this.componentFactory),this.addToolbar(t.toolbar);}_initPlaceholder(e,t){t||(t=this.editor.config.get("roots")[e.name]?.placeholder);const i=this.editor.editing.view,n=i.document.getRoot(e.name);t&&(n.placeholder=t),Ks({view:i,element:n,isDirectHost:false,keepOnFocus:true});}}class DS extends $v{toolbar;editables;editable;menuBarView;_editingView;constructor(e,t,i,n={}){super(e),this._editingView=t,this.toolbar=new mw(e,{shouldGroupWhenFull:n.shouldToolbarGroupWhenFull}),this.menuBarView=new I_(e),this.editables={};for(const e of i){const t=n.editableElements?.[e];let{label:i}=n;"object"==typeof i&&(i=i[e]),this.createEditable(e,t,i);}this.editable=Object.values(this.editables)[0],this.toolbar.extendTemplate({attributes:{class:["ck-reset_all","ck-rounded-corners"],dir:e.uiLanguageDirection}}),this.menuBarView.extendTemplate({attributes:{class:["ck-reset_all","ck-rounded-corners"],dir:e.uiLanguageDirection}});}createEditable(e,t,i){const n=new Kv(this.locale,this._editingView,t,{label:i});return this.editables[e]=n,n.name=e,this.isRendered&&this.registerChild(n),n}removeEditable(e){const t=this.editables[e];this.isRendered&&this.deregisterChild(t),delete this.editables[e],t.destroy();}render(){super.render(),this.registerChild(Object.values(this.editables)),this.registerChild(this.toolbar),this.registerChild(this.menuBarView);}}class zS extends kh{static get editorName(){return "MultiRootEditor"}ui;sourceElements;_registeredRootsAttributesKeys=new Set;_readOnlyRootLocks=new Map;constructor(e,t={}){const{sourceElementsOrData:i,editorConfig:n}=Ih(e,t);if(super(n),Th(i,this.config,false),function(e){if(e.get("rootsAttributes")){const t=e.get("rootsAttributes"),i=e.get("roots");for(const[n,s]of Object.entries(t)){const t=i[n];if(!t)throw new I("multi-root-editor-root-attributes-no-root",null);if(Object.keys(t.modelAttributes||{}).length)throw new I("multi-root-editor-root-attributes-conflict",null);e.set(`roots.${n}.modelAttributes`,s);}}}(this.config),this.config.get("lazyRoots"))throw new I("multi-root-editor-root-deprecated-config-lazy-roots",null);const s=Object.entries(this.config.get("roots"));this.sourceElements={};for(const[e,{element:t}]of s)if(qS(t)){if("TEXTAREA"===t.tagName)throw new I("editor-wrong-element",null);this.sourceElements[e]=t,Eh(this,t);}this.editing.view.document.roots.on("add",(e,t)=>{t.unbind("isReadOnly"),t.bind("isReadOnly").to(this.editing.view.document,"isReadOnly",e=>e||this._readOnlyRootLocks.has(t.rootName)),t.on("change:isReadOnly",(e,i,n)=>{const s=this.editing.view.createRangeIn(t);for(const e of s.getItems())e.is("editableElement")&&(e.unbind("isReadOnly"),e.isReadOnly=n);});});for(const[e,t]of s){const i=this.model.document.createRoot("$root",e);t.lazyLoad&&(i._isLoaded=false);const n=t.modelAttributes;if(n)for(const e of Object.keys(n))this.registerRootAttribute(e);}this.editing.model.schema.extend("$root",{allowAttributes:"$rootEditableOptions"}),this.data.on("init",()=>{this.model.enqueueChange({isUndoable:false},e=>{for(const[t,i]of s){const n=this.model.document.getRoot(t);for(const[t,s]of Object.entries(i.modelAttributes||{}))null!==s&&e.setAttribute(t,s,n);const s={...i.placeholder&&{placeholder:i.placeholder},...i.label&&{label:i.label}};e.setAttribute("$rootEditableOptions",s,n);}});});const o={shouldToolbarGroupWhenFull:!this.config.get("toolbar.shouldNotGroupWhenFull"),editableElements:this.sourceElements,label:HS(this.config.get("roots"),"label")},r=new DS(this.locale,this.editing.view,function(e){return e.filter(([,{lazyLoad:e}])=>!e).map(([e])=>e)}(s),o);this.ui=new NS(this,r),this.model.document.on("change:data",()=>{const e=this.model.document.differ.getChangedRoots();for(const t of e){const e=this.model.document.getRoot(t.name);"detached"==t.state&&this.fire("detachRoot",e);}for(const t of e){const e=this.model.document.getRoot(t.name);"attached"==t.state&&this.fire("addRoot",e);}}),this.listenTo(this.model,"canEditAt",(e,[t])=>{if(!t)return;let i=false;for(const e of t.getRanges()){const t=e.root;if(this._readOnlyRootLocks.has(t.rootName)){i=true;break}}i&&(e.return=false,e.stop());},{priority:"high"}),this.decorate("loadRoot"),this.on("loadRoot",(e,[t])=>{const i=this.model.document.getRoot(t);if(!i)throw new I("multi-root-editor-load-root-no-root",this,{rootName:t});i._isLoaded&&(P("multi-root-editor-load-root-already-loaded"),e.stop());},{priority:"highest"}),function(e){const t=Yn(e.config.get("licenseKey"));if(!t)return;Zn(t,"MRE")&&(e.enableReadOnlyMode(Symbol("invalidLicense")),e._showLicenseError("featureNotAllowed","Multi-root editor"));}(this);}destroy(){const e=this.config.get("updateSourceElementOnDestroy"),t={};for(const i of Object.keys(this.sourceElements))t[i]=e?this.getData({rootName:i}):"";return this.ui.destroy(),super.destroy().then(()=>{for(const e of Object.keys(this.sourceElements))Vi(this.sourceElements[e],t[e]);})}addRoot(e,t={}){const i=t.initialData||t.data||"",n=t.modelAttributes||t.attributes||{},s=t.elementName||"$root";qS(t.element)&&P("multi-root-editor-add-root-element-option-ignored");const o=o=>{const r=o.addRoot(e,s);i&&o.insert(this.data.parse(i,r),r,0);for(const e of Object.keys(n))this.registerRootAttribute(e),o.setAttribute(e,n[e],r);const a={...t.placeholder&&{placeholder:t.placeholder},...t.label&&{label:t.label}};o.setAttribute("$rootEditableOptions",a,r);};t.isUndoable?this.model.change(o):this.model.enqueueChange({isUndoable:false},o);}detachRoot(e,t=false){t?this.model.change(t=>t.detachRoot(e)):this.model.enqueueChange({isUndoable:false},t=>t.detachRoot(e));}createEditable(e,t,i){let n;t&&"string"!=typeof t?(n=t?.placeholder,i=t?.label):n=t;const s=e.getAttribute("$rootEditableOptions")||{},o=this.ui.view.createEditable(e.rootName,void 0,i||s.label);return this.ui.addEditable(o,n||s.placeholder),this.editing.view.forceRender(),o.element}detachEditable(e){const t=e.rootName,i=this.ui.view.editables[t];return this.ui.removeEditable(i),this.ui.view.removeEditable(t),i.element}loadRoot(e,{data:t="",attributes:i={}}={}){const n=this.model.document.getRoot(e);this.model.enqueueChange({isUndoable:false},e=>{t&&e.insert(this.data.parse(t,n),n,0);for(const t of Object.keys(i))this.registerRootAttribute(t),e.setAttribute(t,i[t],n);n._isLoaded=true,this.model.document.differ._bufferRootLoad(n);});}getFullData(e){const t={};for(const i of this.model.document.getRootNames())t[i]=this.data.get({...e,rootName:i});return t}getRootsAttributes(){const e={};for(const t of this.model.document.getRootNames())e[t]=this.getRootAttributes(t);return e}getRootAttributes(e){const t={},i=this.model.document.getRoot(e);for(const e of this._registeredRootsAttributesKeys)t[e]=i.hasAttribute(e)?i.getAttribute(e):null;return t}registerRootAttribute(e){this._registeredRootsAttributesKeys.has(e)||(this._registeredRootsAttributesKeys.add(e),this.editing.model.schema.extend("$root",{allowAttributes:e}));}disableRoot(e,t){if("$graveyard"==e)throw new I("multi-root-editor-cannot-disable-graveyard-root",this);const i=this._readOnlyRootLocks.get(e);if(i)i.add(t);else {this._readOnlyRootLocks.set(e,new Set([t]));this.editing.view.document.getRoot(e).isReadOnly=true,Array.from(this.commands.commands()).forEach(e=>e.affectsData&&e.refresh());}}enableRoot(e,t){const i=this._readOnlyRootLocks.get(e);if(i&&i.has(t))if(1===i.size){this._readOnlyRootLocks.delete(e);this.editing.view.document.getRoot(e).isReadOnly=this.isReadOnly,Array.from(this.commands.commands()).forEach(e=>e.affectsData&&e.refresh());}else i.delete(t);}static create(e,t={}){return new Promise(i=>{const n=new this(e,t);i(n.initPlugins().then(()=>n.ui.init()).then(()=>{const e=HS(n.config.get("roots"),"initialData");return n._verifyRootsWithInitialData(e),n.data.init(e)}).then(()=>n.fire("ready")).then(()=>n));})}_verifyRootsWithInitialData(e){for(const t of this.model.document.getRootNames())if(!(t in e))throw new I("multi-root-editor-root-initial-data-mismatch",null);for(const t of Object.keys(e)){const e=this.model.document.getRoot(t);if(!e||!e.isAttached())throw new I("multi-root-editor-root-initial-data-mismatch",null)}}}function HS(e,t){return Object.fromEntries(Object.entries(e).filter(([,e])=>!e.lazyLoad).map(([e,i])=>[e,i[t]]).filter(([,e])=>void 0!==e))}function qS(e){return St(e)}const US={"(":")","[":"]","{":"}"};class jS extends Ns{constructor(e){super(e),this._isEnabledBasedOnSelection=false;}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"mention");}execute(e){const t=this.editor.model,i=t.document.selection,n="string"==typeof e.mention?{id:e.mention}:e.mention,s=n.id,o=e.range||i.getFirstRange();if(!t.canEditAt(o))return;const r=e.text||s,a=WS({_text:r,id:s},n);if(!s.startsWith(e.marker))throw new I("mentioncommand-incorrect-id",this);t.change(e=>{const n=Vn(i.getAttributes()),s=new Map(n.entries());s.set("mention",a);const l=t.insertContent(e.createText(r,s),o),c=l.start.nodeBefore,u=l.end.nodeAfter,d=u&&u.is("$text")&&u.data.startsWith(" ");let h=false;if(c&&u&&c.is("$text")&&u.is("$text")){const e=c.data.slice(-1),t=e in US,i=t&&u.data.startsWith(US[e]);h=t&&i;}h||d||t.insertContent(e.createText(" ",n),o.start.getShiftedBy(r.length));});}}class $S extends Ms{static get pluginName(){return "MentionEditing"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.model,i=t.document;t.schema.extend("$text",{allowAttributes:"mention"}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",attributes:"data-mention",classes:"mention"},model:{key:"mention",value:e=>GS(e)}}),e.conversion.for("downcast").attributeToElement({model:"mention",view:JS}),e.conversion.for("downcast").add(KS),i.registerPostFixer(e=>function(e,t,i){const n=t.differ.getChanges();let s=false;for(const t of n){if("attribute"==t.type)continue;const n=t.position;if("$text"==t.name){const t=n.textNode&&n.textNode.nextSibling;s=YS(n.textNode,e)||s,s=YS(t,e)||s,s=YS(n.nodeBefore,e)||s,s=YS(n.nodeAfter,e)||s;}if("$text"!=t.name&&"insert"==t.type){const t=n.nodeAfter;for(const i of e.createRangeIn(t).getItems())s=YS(i,e)||s;}if("insert"==t.type&&i.isInline(t.name)){const t=n.nodeAfter&&n.nodeAfter.nextSibling;s=YS(n.nodeBefore,e)||s,s=YS(t,e)||s;}}return s}(e,i,t.schema)),i.registerPostFixer(e=>function(e,t){const i=t.differ.getChanges();let n=false;for(const t of i)if("attribute"===t.type&&"mention"!=t.attributeKey){const i=t.range.start.nodeBefore,s=t.range.end.nodeAfter;for(const o of [i,s])QS(o)&&o.getAttribute(t.attributeKey)!=t.attributeNewValue&&(e.setAttribute(t.attributeKey,t.attributeNewValue,o),n=true);}return n}(e,i)),i.registerPostFixer(e=>function(e,t){const i=t.selection,n=i.focus;if(i.isCollapsed&&i.hasAttribute("mention")&&function(e){const t=e.isAtStart,i=e.nodeBefore&&e.nodeBefore.is("$text");return i||t}(n))return e.removeSelectionAttribute("mention"),true;return  false}(e,i)),e.commands.add("mention",new jS(e));}}function WS(e,t){return Object.assign({uid:A().slice(0,8)},e,t||{})}function GS(e,t){const i=e.getAttribute("data-mention"),n=e.getChild(0);if(!n)return;const s=e.getAttribute("data-mention-uid");return WS({id:i,_text:n.data},s?{uid:s,...t}:t)}function KS(e){e.on("attribute:mention",(e,t,i)=>{const n=t.attributeNewValue;if(!t.item.is("$textProxy")||!n)return;const s=t.range.start;(s.textNode||s.nodeAfter).data!=n._text&&i.consumable.consume(t.item,e.name);},{priority:"highest"});}function JS(e,{writer:t,options:i}){if(e)return t.createAttributeElement("span",{class:"mention","data-mention":e.id,...!i.isClipboardPipeline&&{"data-mention-uid":e.uid}},{id:e.uid,priority:20})}function QS(e){if(!e||!e.is("$text")&&!e.is("$textProxy")||!e.hasAttribute("mention"))return  false;return e.data!=e.getAttribute("mention")._text}function YS(e,t){return !!QS(e)&&(t.removeAttribute("mention",e),true)}class ZS extends Xb{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 i=this.items.get(t);this.selected!==i&&(this.selected&&this.selected.removeHighlight(),i.highlight(),this.selected=i,this._isItemVisibleInScrolledArea(i)||(this.element.scrollTop=i.element.offsetTop));}executeSelected(){this.selected.fire("execute");}_isItemVisibleInScrolledArea(e){return new Ci(this.element).contains(new Ci(e.element))}}class XS extends Cs{domElement;constructor(e,t){super(e),this.template=void 0,this.domElement=t,this.domElement.classList.add("ck-button"),this.set("isOn",false),this.on("change:isOn",(e,t,i)=>{i?(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 eI extends Qb{item;marker;highlight(){this.children.first.isOn=true;}removeHighlight(){this.children.first.isOn=false;}}const tI=[on.arrowup,on.arrowdown,on.esc],iI=[on.enter,on.tab];class nI extends Ms{_mentionsView;_mentionsConfigurations;_balloon;_items=new kn;_lastRequested;_requestFeedDebounced;static get pluginName(){return "MentionUI"}static get isOfficialPlugin(){return  true}static get requires(){return [i_]}constructor(e){super(e),this._mentionsView=this._createMentionView(),this._mentionsConfigurations=new Map,this._requestFeedDebounced=st(this._requestFeed,100),e.config.define("mention",{feeds:[]});}init(){const e=this.editor,t=e.config.get("mention.commitKeys")||iI,i=tI.concat(t);this._balloon=e.plugins.get(i_),e.editing.view.document.on("keydown",(e,n)=>{var s;s=n.keyCode,i.includes(s)&&this._isUIVisible&&(n.preventDefault(),e.stop(),n.keyCode==on.arrowdown&&this._mentionsView.selectNext(),n.keyCode==on.arrowup&&this._mentionsView.selectPrevious(),t.includes(n.keyCode)&&this._mentionsView.executeSelected(),n.keyCode==on.esc&&this._hideUIAndRemoveMarker());},{priority:"highest"}),Ss({emitter:this._mentionsView,activator:()=>this._isUIVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUIAndRemoveMarker()});const n=e.config.get("mention.feeds");for(const e of n){const{feed:t,marker:i,dropdownLimit:n}=e;if(!lI(i))throw new I("mentionconfig-incorrect-marker",null,{marker:i});const s={marker:i,feedCallback:"function"==typeof t?t.bind(this.editor):aI(t),itemRenderer:e.itemRenderer,dropdownLimit:n};this._mentionsConfigurations.set(i,s);}this._setupTextWatcher(n),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}_createMentionView(){const e=this.editor.locale,t=new ZS(e);return t.items.bindTo(this._items).using(i=>{const{item:n,marker:s}=i,{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 eI(e),l=this._renderItem(n,s);return l.delegate("execute").to(a),a.children.add(l),a.item=n,a.marker=s,a.on("execute",()=>{t.fire("execute",{item:n,marker:s});}),a}),t.on("execute",(e,t)=>{const i=this.editor,n=i.model,s=t.item,o=t.marker,r=i.model.markers.get("mention"),a=n.createPositionAt(n.document.selection.focus),l=n.createPositionAt(r.getStart()),c=n.createRange(l,a);this._hideUIAndRemoveMarker(),i.execute("mention",{mention:s,text:s.text,marker:o,range:c}),i.editing.view.focus();}),t}_getItemRenderer(e){const{itemRenderer:t}=this._mentionsConfigurations.get(e);return t}_requestFeed(e,t){this._lastRequested=t;const{feedCallback:i}=this._mentionsConfigurations.get(e),n=i(t);n instanceof Promise?n.then(i=>{this._lastRequested==t?this.fire("requestFeed:response",{feed:i,marker:e,feedText:t}):this.fire("requestFeed:discarded",{feed:i,marker:e,feedText:t});}).catch(t=>{this.fire("requestFeed:error",{error:t}),P("mention-feed-callback-error",{marker:e});}):this.fire("requestFeed:response",{feed:n,marker:e,feedText:t});}_setupTextWatcher(e){const t=this.editor,i=e.map(e=>({...e,pattern:rI(e.marker,e.minimumCharacters||0)})),n=new vy(t.model,function(e){const t=t=>{const i=oI(e,t);if(!i)return  false;let n=0;0!==i.position&&(n=i.position-1);const s=t.substring(n);return i.pattern.test(s)};return t}(i));n.on("matched",(e,n)=>{const s=oI(i,n.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"),i=e.nodeBefore;return t||i&&i.is("$text")&&i.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 i=0;0!==e.position&&(i=e.position-1);const n=rI(e.marker,0),s=t.substring(i);return s.match(n)[2]}(s,n.text),l=s.marker.length+a.length,c=o.getShiftedBy(-l),u=o.getShiftedBy(-a.length),d=t.model.createRange(c,u);if(cI(t)){const e=t.model.markers.get("mention");t.model.change(t=>{t.updateMarker(e,{range:d});});}else t.model.change(e=>{e.addMarker("mention",{range:d,usingOperation:false,affectsData:false});});this._requestFeedDebounced(s.marker,a);}),n.on("unmatched",()=>{this._hideUIAndRemoveMarker();});const s=t.commands.get("mention");return n.bind("isEnabled").to(s),n}_handleFeedResponse(e){const{feed:t,marker:i}=e;if(!cI(this.editor))return;this._items.clear();for(const e of t){const t="object"!=typeof e?{id:e,text:e}:e;this._items.add({item:t,marker:i});}const n=this.editor.model.markers.get("mention");this._items.length?this._showOrUpdateUI(n):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:true,balloonClassName:"ck-mention-balloon"}),this._mentionsView.position=this._balloon.view.position,this._mentionsView.selectFirst();}_hideUIAndRemoveMarker(){this._balloon.hasView(this._mentionsView)&&this._balloon.remove(this._mentionsView),cI(this.editor)&&this.editor.model.change(e=>e.removeMarker("mention")),this._mentionsView.position=void 0;}_renderItem(e,t){const i=this.editor;let n,s=e.id;const o=this._getItemRenderer(t);if(o){const t=o(e);"string"!=typeof t?n=new XS(i.locale,t):s=t;}if(!n){const e=new Bp(i.locale);e.label=s,e.withText=true,n=e;}return n}_getBalloonPanelPositionData(e,t){const i=this.editor,n=i.editing,s=n.view.domConverter,o=n.mapper;return {target:()=>{let t=e.getRange();"$graveyard"==t.start.root.rootName&&(t=i.model.document.selection.getFirstRange());const n=o.toViewRange(t);return Ci.getDomRangeRects(s.viewRangeToDom(n)).pop()},limiter:()=>{const e=this.editor.editing.view,t=e.document.selection.editableElement;return t?e.domConverter.mapViewToDom(t.root):null},positions:sI(t,i.locale.uiLanguageDirection)}}}function sI(e,t){const i={caret_se:e=>({top:e.bottom+3,left:e.right,name:"caret_se",config:{withArrow:false}}),caret_ne:(e,t)=>({top:e.top-t.height-3,left:e.right,name:"caret_ne",config:{withArrow:false}}),caret_sw:(e,t)=>({top:e.bottom+3,left:e.right-t.width,name:"caret_sw",config:{withArrow:false}}),caret_nw:(e,t)=>({top:e.top-t.height-3,left:e.right-t.width,name:"caret_nw",config:{withArrow:false}})};return Object.prototype.hasOwnProperty.call(i,e)?[i[e]]:"rtl"!==t?[i.caret_se,i.caret_sw,i.caret_ne,i.caret_nw]:[i.caret_sw,i.caret_se,i.caret_nw,i.caret_ne]}function oI(e,t){let i;for(const n of e){const e=t.lastIndexOf(n.marker);e>0&&!t.substring(e-1).match(n.pattern)||(!i||e>=i.position)&&(i={marker:n.marker,position:e,minimumCharacters:n.minimumCharacters,pattern:n.pattern});}return i}function rI(e,t){const i=0==t?"*":`{${t},}`,s=n.features.isRegExpUnicodePropertySupported?"\\p{Ps}\\p{Pi}\"'":"\\(\\[{\"'";e=e.replace(/[.*+?^${}()\-|[\]\\]/g,"\\$&");return new RegExp(`(?:^|[ ${s}])(${e})(.${i})$`,"u")}function aI(e){return t=>e.filter(e=>("string"==typeof e?e:String(e.id)).toLowerCase().includes(t.toLowerCase()))}function lI(e){return !!e}function cI(e){return e.model.markers.has("mention")}class uI extends Ms{toMentionAttribute(e,t){return GS(e,t)}static get pluginName(){return "Mention"}static get isOfficialPlugin(){return  true}static get requires(){return [$S,nI]}}var dI,hI={exports:{}};var mI,gI=(dI||(dI=1,mI=hI,((e,t)=>{mI.exports?mI.exports=t():e.fuzzysort=t();})(hI.exports,e=>{var t=e=>{"number"==typeof e?e=""+e:"string"!=typeof e&&(e="");var t=g(e);return s(e,{_targetLower:t._lower,_targetLowerCodes:t.lowerCodes,_bitflags:t.bitflags})};class i{get indexes(){return this._indexes.slice(0,this._indexes.len).sort((e,t)=>e-t)}set indexes(e){return this._indexes=e}highlight(e,t){return ((e,t="<b>",i="</b>")=>{for(var n="function"==typeof t?t:void 0,s=e.target,o=s.length,r=e.indexes,a="",l=0,c=0,u=false,d=[],h=0;h<o;++h){var m=s[h];if(r[c]===h){if(++c,u||(u=true,n?(d.push(a),a=""):a+=t),c===r.length){n?(a+=m,d.push(n(a,l++)),a="",d.push(s.substr(h+1))):a+=m+i+s.substr(h+1);break}}else u&&(u=false,n?(d.push(n(a,l++)),a=""):a+=i);a+=m;}return n?d:a})(this,e,t)}get score(){return o(this._score)}set score(e){this._score=r(e);}}class n extends Array{get score(){return o(this._score)}set score(e){this._score=r(e);}}var s=(e,t)=>{const n=new i;return n.target=e,n.obj=t.obj??P,n._score=t._score??S,n._indexes=t._indexes??[],n._targetLower=t._targetLower??"",n._targetLowerCodes=t._targetLowerCodes??P,n._nextBeginningIndexes=t._nextBeginningIndexes??P,n._bitflags=t._bitflags??0,n},o=e=>e===S?0:e>1?e:Math.E**(-2*((1-e)**.04307-1)),r=e=>0===e?S:e>1?e:1-Math.pow(Math.log(e)/-2+1,1/.04307),a=e=>{"number"==typeof e?e=""+e:"string"!=typeof e&&(e=""),e=e.trim();var t=g(e),i=[];if(t.containsSpace){var n=e.split(/\s+/);n=[...new Set(n)];for(var s=0;s<n.length;s++)if(""!==n[s]){var o=g(n[s]);i.push({lowerCodes:o.lowerCodes,_lower:n[s].toLowerCase(),containsSpace:false});}}return {lowerCodes:t.lowerCodes,_lower:t._lower,containsSpace:t.containsSpace,bitflags:t.bitflags,spaceSearches:i}},l=e=>{if(e.length>999)return t(e);var i=p.get(e);return void 0!==i||(i=t(e),p.set(e,i)),i},c=e=>{if(e.length>999)return a(e);var t=b.get(e);return void 0!==t||(t=a(e),b.set(e,t)),t},u=(e,t)=>{var i=[];i.total=e.length;var o=t?.limit||T;if(t?.key)for(var r=0;r<e.length;r++){var a=e[r];if((h=A(a,t.key))!=P){E(h)||(h=l(h));var c=s(h.target,{_score:h._score,obj:a});if(i.push(c),i.length>=o)return i}}else if(t?.keys)for(r=0;r<e.length;r++){a=e[r];for(var u=new n(t.keys.length),d=t.keys.length-1;d>=0;--d)(h=A(a,t.keys[d]))?(E(h)||(h=l(h)),h._score=S,h._indexes.len=0,u[d]=h):u[d]=V;if(u.obj=a,u._score=S,i.push(u),i.length>=o)return i}else for(r=0;r<e.length;r++){var h;if((h=e[r])!=P&&(E(h)||(h=l(h)),h._score=S,h._indexes.len=0,i.push(h),i.length>=o))return i}return i},d=(e,t,n=false,s=false)=>{if(false===n&&e.containsSpace)return h(e,t,s);for(var o=e._lower,r=e.lowerCodes,a=r[0],l=t._targetLowerCodes,c=r.length,u=l.length,d=0,m=0,g=0;;){if(a===l[m]){if(w[g++]=m,++d===c)break;a=r[d];}if(++m>=u)return P}d=0;var p=false,b=0,_=t._nextBeginningIndexes;_===P&&(_=t._nextBeginningIndexes=f(t.target));var y=0;if((m=0===w[0]?0:_[w[0]-1])!==u)for(;;)if(m>=u){if(d<=0)break;if(++y>200)break;--d;var k=v[--b];m=_[k];}else if(r[d]===l[m]){if(v[b++]=m,++d===c){p=true;break}++m;}else m=_[m];var C=c<=1?-1:t._targetLower.indexOf(o,w[0]),x=!!~C,A=!!x&&(0===C||t._nextBeginningIndexes[C-1]===C);if(x&&!A)for(var E=0;E<_.length;E=_[E])if(!(E<=C)){for(var T=0;T<c&&r[T]===t._targetLowerCodes[E+T];T++);if(T===c){C=E,A=true;break}}var S=e=>{for(var t=0,i=0,n=1;n<c;++n)e[n]-e[n-1]!==1&&(t-=e[n],++i);if(t-=(e[c-1]-e[0]-(c-1)+12)*i,0!==e[0]&&(t-=e[0]*e[0]*.2),p){var s=1;for(n=_[0];n<u;n=_[n])++s;s>24&&(t*=10*(s-24));}else t*=1e3;return t-=(u-c)/2,x&&(t/=1+c*c*1),A&&(t/=1+c*c*1),t-=(u-c)/2};if(p)if(A){for(E=0;E<c;++E)w[E]=C+E;I=w,V=S(w);}else I=v,V=S(v);else {if(x)for(var E=0;E<c;++E)w[E]=C+E;var I,V=S(I=w);}for(t._score=V,E=0;E<c;++E)t._indexes[E]=I[E];t._indexes.len=c;const R=new i;return R.target=t.target,R._score=t._score,R._indexes=t._indexes,R},h=(e,t,i)=>{for(var n=new Set,s=0,o=P,r=0,a=e.spaceSearches,l=a.length,c=0,u=()=>{for(let e=c-1;e>=0;e--)t._nextBeginningIndexes[_[2*e+0]]=_[2*e+1];},h=false,m=0;m<l;++m){k[m]=S;var g=a[m];if(o=d(g,t),i){if(o===P)continue;h=true;}else if(o===P)return u(),P;if(m!==l-1){var f=o._indexes,p=true;for(let e=0;e<f.len-1;e++)if(f[e+1]-f[e]!==1){p=false;break}if(p){var b=f[f.len-1]+1,w=t._nextBeginningIndexes[b-1];for(let e=b-1;e>=0&&w===t._nextBeginningIndexes[e];e--)t._nextBeginningIndexes[e]=b,_[2*c+0]=e,_[2*c+1]=w,c++;}}s+=o._score/l,k[m]=o._score/l,o._indexes[0]<r&&(s-=2*(r-o._indexes[0])),r=o._indexes[0];for(var v=0;v<o._indexes.len;++v)n.add(o._indexes[v]);}if(i&&!h)return P;u();var y=d(e,t,true);if(y!==P&&y._score>s){if(i)for(m=0;m<l;++m)k[m]=y._score/l;return y}i&&(o=t),o._score=s,m=0;for(let e of n)o._indexes[m++]=e;return o._indexes.len=m,o},m=e=>e.replace(/\p{Script=Latin}+/gu,e=>e.normalize("NFD")).replace(/[\u0300-\u036f]/g,""),g=e=>{for(var t=(e=m(e)).length,i=e.toLowerCase(),n=[],s=0,o=false,r=0;r<t;++r){var a=n[r]=i.charCodeAt(r);32!==a?s|=1<<(a>=97&&a<=122?a-97:a>=48&&a<=57?26:a<=127?30:31):o=true;}return {lowerCodes:n,bitflags:s,containsSpace:o,_lower:i}},f=e=>{for(var t=(e=m(e)).length,i=(e=>{for(var t=e.length,i=[],n=0,s=false,o=false,r=0;r<t;++r){var a=e.charCodeAt(r),l=a>=65&&a<=90,c=l||a>=97&&a<=122||a>=48&&a<=57,u=l&&!s||!o||!c;s=l,o=c,u&&(i[n++]=r);}return i})(e),n=[],s=i[0],o=0,r=0;r<t;++r)s>r?n[r]=s:(s=i[++o],n[r]=void 0===s?t:s);return n},p=new Map,b=new Map,w=[],v=[],_=[],y=[],k=[],C=[],x=[],A=(e,t)=>{var i=e[t];if(void 0!==i)return i;if("function"==typeof t)return t(e);var n=t;Array.isArray(t)||(n=t.split("."));for(var s=n.length,o=-1;e&&++o<s;)e=e[n[o]];return e},E=e=>"object"==typeof e&&"number"==typeof e._bitflags,T=1/0,S=-T,I=[];I.total=0;var P=null,V=t(""),R=(()=>{var e=[],t=0,i={},n=i=>{for(var n=0,s=e[n],o=1;o<t;){var r=o+1;n=o,r<t&&e[r]._score<e[o]._score&&(n=r),e[n-1>>1]=e[n],o=1+(n<<1);}for(var a=n-1>>1;n>0&&s._score<e[a]._score;a=(n=a)-1>>1)e[n]=e[a];e[n]=s;};return i.add=i=>{var n=t;e[t++]=i;for(var s=n-1>>1;n>0&&i._score<e[s]._score;s=(n=s)-1>>1)e[n]=e[s];e[n]=i;},i.poll=i=>{if(0!==t){var s=e[0];return e[0]=e[--t],n(),s}},i.peek=i=>{if(0!==t)return e[0]},i.replaceTop=t=>{e[0]=t,n();},i})();return {single:(e,t)=>{if(!e||!t)return P;var i=c(e);E(t)||(t=l(t));var n=i.bitflags;return (n&t._bitflags)!==n?P:d(i,t)},go:(e,t,i)=>{if(!e)return i?.all?u(t,i):I;var s=c(e),o=s.bitflags,a=s.containsSpace,h=r(i?.threshold||0),m=i?.limit||T,g=0,f=0,p=t.length;function b(e){g<m?(R.add(e),++g):(++f,e._score>R.peek()._score&&R.replaceTop(e));}if(i?.key)for(var w=i.key,v=0;v<p;++v){var _=t[v];(H=A(_,w))&&(E(H)||(H=l(H)),(o&H._bitflags)===o&&(q=d(s,H))!==P&&(q._score<h||(q.obj=_,b(q))));}else if(i?.keys){var O=i.keys,B=O.length;e:for(v=0;v<p;++v){_=t[v];for(var L=0,M=0;M<B;++M)w=O[M],(H=A(_,w))?(E(H)||(H=l(H)),C[M]=H,L|=H._bitflags):C[M]=V;if((o&L)===o){if(a)for(let e=0;e<s.spaceSearches.length;e++)y[e]=S;for(M=0;M<B;++M)if((H=C[M])!==V)if(x[M]=d(s,H,false,a),x[M]!==P){if(a)for(let e=0;e<s.spaceSearches.length;e++)k[e]>-1e3&&y[e]>S&&(z=(y[e]+k[e])/4)>y[e]&&(y[e]=z),k[e]>y[e]&&(y[e]=k[e]);}else x[M]=V;else x[M]=V;if(a){for(let e=0;e<s.spaceSearches.length;e++)if(y[e]===S)continue e}else {var F=false;for(let e=0;e<B;e++)if(x[e]._score!==S){F=true;break}if(!F)continue}var N=new n(B);for(let e=0;e<B;e++)N[e]=x[e];if(a){var D=0;for(let e=0;e<s.spaceSearches.length;e++)D+=y[e];}else {D=S;for(let e=0;e<B;e++){var z;(q=N[e])._score>-1e3&&D>S&&(z=(D+q._score)/4)>D&&(D=z),q._score>D&&(D=q._score);}}if(N.obj=_,N._score=D,i?.scoreFn){if(!(D=i.scoreFn(N)))continue;D=r(D),N._score=D;}D<h||b(N);}}}else for(v=0;v<p;++v){var H,q;(H=t[v])&&(E(H)||(H=l(H)),(o&H._bitflags)===o&&(q=d(s,H))!==P&&(q._score<h||b(q)));}if(0===g)return I;var U=new Array(g);for(v=g-1;v>=0;--v)U[v]=R.poll();return U.total=g+f,U},prepare:t,cleanup:()=>{p.clear(),b.clear();}}})),hI.exports);function fI(e){const t=function(){try{return document.createElement("canvas").getContext("2d",{willReadFrequently:!0})}catch{return null}}();if(!t)return  false;const i=20,n=Math.floor(12.5);t.font=n+"px Arial, Sans-Serif",t.textBaseline="top",t.canvas.width=40,t.canvas.height=25,t.clearRect(0,0,40,25),t.fillStyle="#FF0000",t.fillText(e,0,22),t.fillStyle="#0000FF",t.fillText(e,i,22);const s=t.getImageData(0,0,i,25).data,o=s.length;let r=0;for(;r<o&&!s[r+3];r+=4);if(r>=o)return  false;const a=i+r/4%i,l=Math.floor(r/4/i),c=t.getImageData(a,l,1,1).data;return s[r]===c[0]&&s[r+2]===c[2]&&!(t.measureText(e).width>=i)}const pI={0:"default",1:"light",2:"medium-light",3:"medium",4:"medium-dark",5:"dark"},bI={"🪎":17,"🫩":16,"🫨":15.1,"🫠":14,"😶‍🌫️":13.1,"🧑‍💻":12.1,"🥰":11,"🤪":5,"⚕️":4,"🤣":3,"👋🏽":2,"😀":1,"😐":.7,"😂":.6};class wI extends Ms{_emojiCanvas=null;static get pluginName(){return "EmojiUtils"}static get isOfficialPlugin(){return  true}init(){this._emojiCanvas=document.createElement("canvas").getContext("2d");}isEmojiSupported(e,t,i){return !!(e.version<=t)&&(!this.hasZwj(e.emoji)||this.isEmojiZwjSupported(e,i))}getEmojiSupportedVersionByOs(){for(const[e,t]of Object.entries(bI))if(wI._isEmojiSupported(e))return t;return 0}hasZwj(e){return e.includes("‍")}isEmojiZwjSupported(e,t){if(this.getNodeWidthUsingCanvas(t,e.emoji)<43.2)return  true;return this.getNodeWidth(t,e.emoji)<43.2}getNodeWidth(e,t){const i=document.createElement("span");i.textContent=t,e.appendChild(i);const n=i.offsetWidth;return e.removeChild(i),n}getNodeWidthUsingCanvas(e,t){const i=getComputedStyle(e);return this._emojiCanvas.font=[i.fontStyle,i.fontVariant,i.fontWeight,"24px",`"Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", ${i.fontFamily}`].join(" "),Math.ceil(this._emojiCanvas.measureText(t).width)}createEmojiWidthTestingContainer(){const e=document.createElement("div");return e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.left="-9999px",e.style.whiteSpace="nowrap",e.style.fontSize="24px",e}normalizeEmojiSkinTone(e){const t={...e,skins:{default:e.emoji}};return e.skins&&e.skins.forEach(e=>{const i=pI[e.tone];t.skins[i]=e.emoji;}),t}isEmojiCategoryAllowed(e){return 2!==e.group}static _isEmojiSupported=fI}class vI extends Ms{_items;_url;_repositoryPromise;static get requires(){return [wI]}static get pluginName(){return "EmojiRepository"}static get isOfficialPlugin(){return  true}constructor(e){super(e),e.config.define("emoji",{version:void 0,skinTone:"default",definitionsUrl:void 0,useCustomFont:false}),this._url=this._getUrl(),this._repositoryPromise=new Promise(e=>{this._repositoryPromiseResolveCallback=e;}),this._items=null;}async init(){return this._warnAboutCdnUse(),await this._loadAndCacheEmoji(),this._items=this._getItems(),this._items?this._repositoryPromiseResolveCallback(true):(P("emoji-repository-empty"),this._repositoryPromiseResolveCallback(false))}getEmojiByQuery(e){if(!this._items)return [];return e.split(/\s/).filter(Boolean).some(e=>e.length>=2)?gI.go(e,this._items,{threshold:.6,keys:["emoticon","annotation",t=>e.split(/\s/).filter(Boolean).flatMap(e=>t.tags?.filter(t=>t.startsWith(e))).join()]}).map(e=>e.obj):[]}getEmojiCategories(){const e=this._getItems();if(!e)return [];const{t:t}=this.editor.locale,i=[{title:t("Smileys & Expressions"),icon:"😄",groupId:0},{title:t("Gestures & People"),icon:"👋",groupId:1},{title:t("Animals & Nature"),icon:"🐻",groupId:3},{title:t("Food & Drinks"),icon:"🍎",groupId:4},{title:t("Travel & Places"),icon:"🚘",groupId:5},{title:t("Activities"),icon:"🏀",groupId:6},{title:t("Objects"),icon:"💡",groupId:7},{title:t("Symbols"),icon:"🔵",groupId:8},{title:t("Flags"),icon:"🏁",groupId:9}],n=Ye(e,e=>e.group);return i.map(e=>({...e,items:n[e.groupId]}))}getSkinTones(){const{t:e}=this.editor.locale;return [{id:"default",icon:"👋",tooltip:e("Default skin tone")},{id:"light",icon:"👋🏻",tooltip:e("Light skin tone")},{id:"medium-light",icon:"👋🏼",tooltip:e("Medium Light skin tone")},{id:"medium",icon:"👋🏽",tooltip:e("Medium skin tone")},{id:"medium-dark",icon:"👋🏾",tooltip:e("Medium Dark skin tone")},{id:"dark",icon:"👋🏿",tooltip:e("Dark skin tone")}]}isReady(){return this._repositoryPromise}_getUrl(){const{definitionsUrl:e,version:t}=this.editor.config.get("emoji");if(!e||"cdn"===e){const e=new URL("https://cdn.ckeditor.com/ckeditor5/data/emoji/{version}/en.json".replace("{version}",(t||16).toString()));return e.searchParams.set("editorVersion",B),e}return t&&P("emoji-repository-redundant-version"),new URL(e)}_warnAboutCdnUse(){const e=this.editor,t=e.config.get("emoji"),i=e.config.get("licenseKey"),n=window[Symbol.for("cke distribution")];"GPL"!==i&&"cloud"!==n&&(t&&t.definitionsUrl||P("emoji-repository-cdn-use"));}_getItems(){const e=vI._results[this._url.href];return e&&e.length?e:null}async _loadAndCacheEmoji(){if(vI._results[this._url.href])return;const e=await fetch(this._url,{cache:"force-cache"}).then(e=>e.ok?e.json():[]).catch(()=>[]);vI._results[this._url.href]=this._normalizeEmoji(e);}_normalizeEmoji(e){const t=this.editor,i=t.config.get("emoji.useCustomFont"),n=t.plugins.get("EmojiUtils"),s=e.filter(e=>n.isEmojiCategoryAllowed(e));if(i)return s.map(e=>n.normalizeEmojiSkinTone(e));const o=n.getEmojiSupportedVersionByOs(),r=n.createEmojiWidthTestingContainer();document.body.appendChild(r);const a=s.filter(e=>n.isEmojiSupported(e,o,r)).map(e=>n.normalizeEmojiSkinTone(e));return r.remove(),a}static _results={}}const _I=":",yI=":__EMOJI_SHOW_ALL:",kI=":__EMOJI_HINT:";class CI extends Ms{_emojiDropdownLimit;_skinTone;static get requires(){return [vI,by,uI]}static get pluginName(){return "EmojiMention"}static get isOfficialPlugin(){return  true}constructor(e){super(e),this.editor.config.define("emoji",{dropdownLimit:6}),this._emojiDropdownLimit=e.config.get("emoji.dropdownLimit"),this._skinTone=e.config.get("emoji.skinTone"),this._setupMentionConfiguration(e);}_setupMentionConfiguration(e){const t=e.config.get("mergeFields.prefix"),i=e.config.get("mention.feeds"),n=!!t&&t[0]===_I;if(i.filter(e=>!e._isEmojiMarker).some(e=>e.marker===_I)||n)return void P("emoji-config-marker-already-used",{marker:_I});if(i.some(e=>e._isEmojiMarker))return;const s={_isEmojiMarker:true,marker:_I,dropdownLimit:this._emojiDropdownLimit,itemRenderer:this._customItemRendererFactory(this.editor.t),feed:this._queryEmojiCallbackFactory()};this.editor.config.set("mention.feeds",[...i,s]);}async init(){const e=this.editor;this.emojiPickerPlugin=e.plugins.has("EmojiPicker")?e.plugins.get("EmojiPicker"):null,this.emojiRepositoryPlugin=e.plugins.get("EmojiRepository"),this._isEmojiRepositoryAvailable=await this.emojiRepositoryPlugin.isReady(),this._isEmojiRepositoryAvailable&&e.once("ready",this._overrideMentionExecuteListener.bind(this));}_customItemRendererFactory(e){return t=>{const i=document.createElement("button");i.classList.add("ck"),i.classList.add("ck-button"),i.classList.add("ck-button_with-text"),i.id=`mention-list-item-id${t.id.slice(0,-1)}`,i.type="button",i.tabIndex=-1;const n=document.createElement("span");return n.classList.add("ck"),n.classList.add("ck-button__label"),i.appendChild(n),t.id===kI?(i.classList.add("ck-list-item-button"),i.classList.add("ck-disabled"),n.textContent=e("Keep on typing to see the emoji.")):t.id===yI?n.textContent=e("Show all emoji..."):n.textContent=`${t.text} ${t.id}`,i}}_overrideMentionExecuteListener(){const e=this.editor;e.commands.get("mention").on("execute",(t,i)=>{const n=i[0];if(n.marker===_I&&(t.stop(),n.mention.id!==kI))if(n.mention.id===yI){const t=[...n.range.getItems()].filter(e=>e.is("$textProxy")).map(e=>e.data).reduce((e,t)=>e+t,"");e.model.change(t=>{e.model.deleteContent(t.createSelection(n.range));});const i=this.emojiPickerPlugin;i.showUI(t.slice(1)),setTimeout(()=>{i.emojiPickerView.focus();});}else e.execute("insertText",{text:n.mention.text,range:n.range});},{priority:"high"});}_queryEmojiCallbackFactory(){return e=>{if(e.startsWith(" "))return [];if(e.startsWith(_I))return [];if(!this._isEmojiRepositoryAvailable)return [];const t=this.emojiRepositoryPlugin.getEmojiByQuery(e).map(e=>{let t=e.skins[this._skinTone]||e.skins.default;return this.emojiPickerPlugin&&(t=e.skins[this.emojiPickerPlugin.skinTone]||e.skins.default),{id:`:${e.annotation}:`,text:t}});if(!this.emojiPickerPlugin)return t.slice(0,this._emojiDropdownLimit);const i={id:e.length>1?yI:kI};return [...t.slice(0,this._emojiDropdownLimit-1),i]}}}class xI extends Ns{refresh(){const e=this.editor.model,t=e.schema,i=e.document.selection;this.isEnabled=t.checkChild(i.getFirstPosition(),"$text");}execute(e=""){this.editor.plugins.get("EmojiPicker").showUI(e);}}class AI extends Cs{tiles;focusTracker;keystrokes;emojiCategories;cachedTiles;_getEmojiByQuery;constructor(t,{categoryName:i,emojiCategories:n,getEmojiByQuery:s,skinTone:o}){super(t),this.set("isEmpty",true),this.set("categoryName",i),this.set("skinTone",o),this.tiles=this.createCollection(),this.cachedTiles=this.createCollection(),this.focusTracker=new An,this.keystrokes=new In,this._getEmojiByQuery=s,this.emojiCategories=n;const r=this.bindTemplate;this.setTemplate({tag:"div",children:[{tag:"div",attributes:{role:"grid",class:["ck","ck-emoji__grid"]},children:this.tiles}],attributes:{role:"tabpanel",class:["ck","ck-emoji__tiles",r.if("isEmpty","ck-hidden",e=>e)]}}),Rs({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.tiles,numberOfColumns:()=>exports.global.window.getComputedStyle(this.element.firstChild).getPropertyValue("grid-template-columns").split(" ").length,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection});}render(){super.render(),this.keystrokes.listenTo(this.element);}destroy(){super.destroy(),this.keystrokes.destroy(),this.focusTracker.destroy();}focus(){const e=this.tiles.first;e&&e.focus();}filter(e){const{matchingItems:t,allItems:i}=e?this._getItemsByQuery(e.source):this._getItemsByCategory();return this._updateGrid(t),this.set("isEmpty",0===t.length),{resultsCount:t.length,totalItemsCount:i.length}}_getItemsByQuery(e){return {matchingItems:this._getEmojiByQuery(e),allItems:this.emojiCategories.flatMap(e=>e.items)}}_getItemsByCategory(){const e=this.emojiCategories.find(e=>e.title===this.categoryName),{items:t}=e;return {matchingItems:t,allItems:t}}_updateGrid(e){[...this.tiles].forEach(e=>{this.focusTracker.remove(e),this.tiles.remove(e);}),e.map(e=>{const t=e.skins[this.skinTone]||e.skins.default;return this.cachedTiles.get(t)||this._createTile(t,e.annotation)}).forEach(e=>{this.tiles.add(e),this.focusTracker.add(e);});}_createTile(e,t){const i=new Bp(this.locale);return i.viewUid=e,i.extendTemplate({attributes:{class:["ck-emoji__tile"]}}),i.set({label:e,tooltip:t,withText:true,ariaLabel:t,ariaLabelledBy:void 0}),i.on("execute",()=>{this.fire("execute",{name:t,emoji:e});}),this.cachedTiles.add(i),i}}class EI extends Cs{focusTracker;keystrokes;focusCycler;buttonViews;constructor(e,{emojiCategories:t,categoryName:i}){super(e),this.buttonViews=this.createCollection(t.map(e=>this._createCategoryButton(e))),this.focusTracker=new An,this.keystrokes=new In,this.focusCycler=new Fp({focusables:this.buttonViews,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowleft",focusNext:"arrowright"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-emoji__categories-list"],role:"tablist"},children:this.buttonViews}),this.on("change:categoryName",(e,t,i,n)=>{const s=this.buttonViews.find(e=>e.tooltip===n);s&&(s.isOn=false);this.buttonViews.find(e=>e.tooltip===i).isOn=true;}),this.set("categoryName",i);}render(){super.render(),this.buttonViews.forEach(e=>{this.focusTracker.add(e);}),this.keystrokes.listenTo(this.element);}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy(),this.buttonViews.destroy();}focus(){this.buttonViews.first.focus();}enableCategories(){this.buttonViews.forEach(e=>{e.isEnabled=true;});}disableCategories(){this.buttonViews.forEach(e=>{e.set({class:"",isEnabled:false,isOn:false});});}_createCategoryButton(e){const t=new Bp,i=t.bindTemplate;return t.extendTemplate({attributes:{"aria-selected":i.to("isOn",e=>e.toString()),class:["ck-emoji__category-item"]}}),t.set({ariaLabel:e.title,label:e.icon,role:"tab",tooltip:e.title,withText:true,ariaLabelledBy:void 0}),t.on("execute",()=>{this.categoryName=e.title;}),t.on("change:isEnabled",()=>{t.isEnabled&&t.tooltip===this.categoryName&&(t.isOn=true);}),t}}class TI extends Cs{inputView;gridView;constructor(e,{gridView:t,resultsView:i}){super(e),this.gridView=t;const n=e.t;this.inputView=new u_(this.locale,{queryView:{label:n("Find an emoji (min. 2 characters)"),creator:Sw},filteredView:this.gridView,infoView:{instance:i}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-search"],tabindex:"-1"},children:[this.inputView.queryView]}),this.inputView.delegate("search").to(this);}destroy(){super.destroy(),this.inputView.destroy();}search(e){const t=e?new RegExp(Mt(e),"ig"):null,i=this.gridView.filter(t);this.inputView.fire("search",{query:e,...i});}setInputValue(e){e?this.inputView.queryView.fieldView.value=e:this.inputView.queryView.fieldView.reset();}getInputValue(){return this.inputView.queryView.fieldView.element.value}focus(){this.inputView.focus();}}class SI extends Cs{dropdownView;_skinTones;constructor(e,{skinTone:t,skinTones:i}){super(e),this.set("skinTone",t),this._skinTones=i;const n=(0, e.t)("Select skin tone"),s=ww(e),o=new kn;for(const{id:e,icon:t,tooltip:i}of this._skinTones){const n={type:"button",model:new e_({value:e,label:t,ariaLabel:i,tooltip:i,tooltipPosition:"e",role:"menuitemradio",withText:true,ariaLabelledBy:void 0})};n.model.bind("isOn").to(this,"skinTone",t=>t===e),o.add(n);}Cw(s,o,{ariaLabel:n,role:"menu"}),s.buttonView.set({label:this._getSkinTone().icon,ariaLabel:n,ariaLabelledBy:void 0,isOn:false,withText:true,tooltip:n}),this.dropdownView=s,this.listenTo(s,"execute",e=>{this.skinTone=e.source.value;}),s.buttonView.bind("label").to(this,"skinTone",()=>this._getSkinTone().icon),s.buttonView.bind("ariaLabel").to(this,"skinTone",()=>`${this._getSkinTone().tooltip}, ${n}`),this.setTemplate({tag:"div",attributes:{class:["ck","ck-emoji__skin-tone"]},children:[s]});}focus(){this.dropdownView.buttonView.focus();}_getSkinTone(){return this._skinTones.find(e=>e.id===this.skinTone)}}class II extends Cs{items;focusTracker;keystrokes;focusCycler;searchView;toneView;categoriesView;gridView;infoView;constructor(e,{emojiCategories:t,getEmojiByQuery:i,skinTone:n,skinTones:s}){super(e);const o=t[0].title;this.gridView=new AI(e,{categoryName:o,emojiCategories:t,getEmojiByQuery:i,skinTone:n}),this.infoView=new l_,this.searchView=new TI(e,{gridView:this.gridView,resultsView:this.infoView}),this.categoriesView=new EI(e,{emojiCategories:t,categoryName:o}),this.toneView=new SI(e,{skinTone:n,skinTones:s}),this.items=this.createCollection([this.searchView,this.toneView,this.categoriesView,this.gridView,this.infoView]),this.focusTracker=new An,this.keystrokes=new In,this.focusCycler=new Fp({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",children:[{tag:"div",children:[this.searchView,this.toneView],attributes:{class:["ck","ck-emoji__search"]}},this.categoriesView,this.gridView,{tag:"div",children:[this.infoView],attributes:{class:["ck","ck-search__results"]}}],attributes:{tabindex:"-1",class:["ck","ck-emoji","ck-search"]}}),this._setupEventListeners();}render(){super.render(),this.focusTracker.add(this.searchView.element),this.focusTracker.add(this.toneView.element),this.focusTracker.add(this.categoriesView.element),this.focusTracker.add(this.gridView.element),this.focusTracker.add(this.infoView.element),this.keystrokes.listenTo(this.element);}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy();}focus(){this.searchView.focus();}_setupEventListeners(){const e=this.locale.t;this.searchView.on("search",(e,t)=>{t.query?this.categoriesView.disableCategories():this.categoriesView.enableCategories();}),this.searchView.on("search",(t,i)=>{1===i.query.length?this.infoView.set({primaryText:e("Keep on typing to see the emoji."),secondaryText:e("The query must contain at least two characters."),isVisible:true}):i.resultsCount?this.infoView.set({isVisible:false}):this.infoView.set({primaryText:e('No emojis were found matching "%0".',i.query),secondaryText:e("Please try a different phrase or check the spelling."),isVisible:true});}),this.searchView.on("search",()=>{this.fire("update"),this.gridView.element.scrollTo(0,0);}),this.categoriesView.on("change:categoryName",(e,t,i)=>{this.gridView.categoryName=i,this.searchView.search("");}),this.toneView.on("change:skinTone",(e,t,i)=>{this.gridView.skinTone=i,this.searchView.search(this.searchView.getInputValue());});}}class PI extends Cs{backButtonView;focusTracker=new An;keystrokes=new In;children;_focusables=new Xn;_focusCycler;constructor(e){super(e),this.backButtonView=this._createBackButton(),this.children=this.createCollection([this._createHeaderView()]),this._focusCycler=new Fp({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form","ck-emoji-picker-form","ck-responsive-form"],tabindex:"-1"},children:this.children});}render(){super.render();[...this.children.filter(Dp),this.backButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element),zp(e)&&this._focusCycler.chain(e.focusCycler);}),this.keystrokes.listenTo(this.element);}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy();}focus(){this._focusCycler.focusFirst();}_createBackButton(){const e=this.locale.t,t=new Bp(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:Pf,tooltip:true}),t.delegate("execute").to(this,"cancel"),t}_createHeaderView(){const e=this.locale.t,t=new Mp(this.locale,{label:e("Emoji picker")});return t.children.add(this.backButtonView,0),t}}const VI="emoji-picker";class RI extends Ms{static get requires(){return [vI,i_,Wp,by]}static get pluginName(){return "EmojiPicker"}static get isOfficialPlugin(){return  true}async init(){const e=this.editor;if(this.balloonPlugin=e.plugins.get("ContextualBalloon"),this.emojiRepositoryPlugin=e.plugins.get("EmojiRepository"),!await this.emojiRepositoryPlugin.isReady())return;const t=new xI(e);e.commands.add("emoji",t),e.ui.componentFactory.add("emoji",()=>{const e=this._createButton(Bp,t);return e.set({tooltip:true}),e}),e.ui.componentFactory.add("menuBar:emoji",()=>this._createButton(Jp,t)),this._setupConversion();}destroy(){super.destroy(),this.emojiPickerView&&this.emojiPickerView.destroy();}get skinTone(){return this.emojiPickerView?this.emojiPickerView.gridView.skinTone:this.editor.config.get("emoji.skinTone")}showUI(e=""){this._showFakeVisualSelection(),this.emojiPickerView||(this.emojiPickerView=this._createEmojiPickerView()),e&&this.emojiPickerView.searchView.setInputValue(e),this.emojiPickerView.searchView.search(e),this.emojiPickerFormView||(this.emojiPickerFormView=this._createEmojiPickerFormView()),this.balloonPlugin.hasView(this.emojiPickerFormView)||(this.emojiPickerFormView.backButtonView.isVisible=!!this.balloonPlugin.visibleView,this.balloonPlugin.add({view:this.emojiPickerFormView,position:this._getBalloonPositionData(),balloonClassName:"ck-emoji-picker-balloon"})),this.emojiPickerView.focus();}_createButton(e,t){const i=new e(this.editor.locale),n=this.editor.locale.t;return i.bind("isEnabled").to(t,"isEnabled"),i.set({label:n("Emoji"),icon:$m,isToggleable:true}),i.on("execute",()=>{this.editor.editing.view.scrollToTheSelection(),this.showUI();}),i}_createEmojiPickerView(){const e=new II(this.editor.locale,{emojiCategories:this.emojiRepositoryPlugin.getEmojiCategories(),skinTone:this.editor.config.get("emoji.skinTone"),skinTones:this.emojiRepositoryPlugin.getSkinTones(),getEmojiByQuery:e=>this.emojiRepositoryPlugin.getEmojiByQuery(e)});return this.listenTo(e.gridView,"execute",(e,t)=>{const i=this.editor,n=t.emoji;this._hideUI(),i.execute("insertText",{text:n});}),e}_createEmojiPickerFormView(){const e=new PI(this.editor.locale);return e.children.add(this.emojiPickerView),this.listenTo(this.emojiPickerView,"update",()=>{this.balloonPlugin.visibleView===e&&this.balloonPlugin.updatePosition();}),this.listenTo(e,"cancel",()=>{this._hideUI();}),e.keystrokes.set("Esc",(e,t)=>{this._hideUI(),t();}),Ss({emitter:e,contextElements:[this.balloonPlugin.view.element],callback:()=>{this._hideUI(false);},activator:()=>this.balloonPlugin.visibleView===e}),e}_hideUI(e=true){this.balloonPlugin.remove(this.emojiPickerFormView),this.emojiPickerView.searchView.setInputValue(""),e&&this.editor.editing.view.focus(),this._hideFakeVisualSelection();}_setupConversion(){const e=this.editor;e.conversion.for("editingDowncast").markerToHighlight({model:VI,view:{classes:["ck-fake-emoji-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:VI,view:(e,{writer:t})=>{if(!e.markerRange.isCollapsed)return null;const i=t.createUIElement("span");return t.addClass(["ck-fake-emoji-selection","ck-fake-emoji-selection_collapsed"],i),i}});}_getBalloonPositionData(){const e=this.editor.editing.view,t=e.document;return {target:()=>e.domConverter.viewRangeToDom(t.selection.getFirstRange())}}_showFakeVisualSelection(){const e=this.editor.model;e.change(t=>{const i=e.document.selection.getFirstRange();if(e.markers.has(VI))t.updateMarker(VI,{range:i});else if(i.start.isAtEnd){const n=i.start.getLastMatchingPosition(({item:t})=>!e.schema.isContent(t),{boundaries:i});t.addMarker(VI,{usingOperation:false,affectsData:false,range:t.createRange(n,i.end)});}else t.addMarker(VI,{usingOperation:false,affectsData:false,range:i});});}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(VI)&&e.change(e=>{e.removeMarker(VI);});}}class OI extends Ms{static get requires(){return [CI,RI]}static get pluginName(){return "Emoji"}static get isOfficialPlugin(){return  true}}class BI extends Ns{constructor(e){super(e),this.affectsData=false;}execute(){const e=this.editor.model,t=e.document.selection;let i=e.schema.getLimitElement(t);if(t.containsEntireContent(i)||!LI(e.schema,i))do{if(i=i.parent,!i)return}while(!LI(e.schema,i));e.change(e=>{e.setSelection(i,"in");});}}function LI(e,t){return e.isLimit(t)&&(e.checkChild(t,"$text")||e.checkChild(t,"paragraph"))}const MI=ln("Ctrl+A");class FI extends Ms{static get pluginName(){return "SelectAllEditing"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.t,i=e.editing.view.document;e.commands.add("selectAll",new BI(e)),this.listenTo(i,"keydown",(t,i)=>{an(i)===MI&&(e.execute("selectAll"),i.preventDefault());}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Select all"),keystroke:"CTRL+A"}]});}}class NI extends Ms{static get pluginName(){return "SelectAllUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor;e.ui.componentFactory.add("selectAll",()=>{const e=this._createButton(Bp);return e.set({tooltip:true}),e}),e.ui.componentFactory.add("menuBar:selectAll",()=>this._createButton(Jp));}_createButton(e){const t=this.editor,i=t.locale,n=t.commands.get("selectAll"),s=new e(t.locale),o=i.t;return s.set({label:o("Select all"),icon:qf,keystroke:"Ctrl+A"}),s.bind("isEnabled").to(n,"isEnabled"),this.listenTo(s,"execute",()=>{t.execute("selectAll"),t.editing.view.focus();}),s}}class DI extends Ms{static get requires(){return [FI,NI]}static get pluginName(){return "SelectAll"}static get isOfficialPlugin(){return  true}}class zI extends Ms{static get requires(){return [Qp,px,Rk,DI,Mk,by,lA]}static get pluginName(){return "Essentials"}static get isOfficialPlugin(){return  true}}class HI extends Cs{children;_findInputView;_replaceInputView;_findButtonView;_findPrevButtonView;_findNextButtonView;_advancedOptionsCollapsibleView;_matchCaseSwitchView;_wholeWordsOnlySwitchView;_replaceButtonView;_replaceAllButtonView;_inputsDivView;_actionButtonsDivView;_focusTracker;_keystrokes;_focusables;focusCycler;constructor(e){super(e);const t=e.t;this.children=this.createCollection(),this.set("matchCount",0),this.set("highlightOffset",0),this.set("isDirty",false),this.set("_areCommandsEnabled",{}),this.set("_resultsCounterText",""),this.set("_matchCase",false),this.set("_wholeWordsOnly",false),this.bind("_searchResultsFound").to(this,"matchCount",this,"isDirty",(e,t)=>e>0&&!t),this._findInputView=this._createInputField(t("Find in text…")),this._findPrevButtonView=this._createButton({label:t("Previous result"),class:"ck-button-prev",icon:Pf,keystroke:"Shift+F3",tooltip:true}),this._findNextButtonView=this._createButton({label:t("Next result"),class:"ck-button-next",icon:Pf,keystroke:"F3",tooltip:true}),this._replaceInputView=this._createInputField(t("Replace with…"),"ck-labeled-field-replace"),this._inputsDivView=this._createInputsDiv(),this._matchCaseSwitchView=this._createMatchCaseSwitch(),this._wholeWordsOnlySwitchView=this._createWholeWordsOnlySwitch(),this._advancedOptionsCollapsibleView=this._createAdvancedOptionsCollapsible(),this._replaceAllButtonView=this._createButton({label:t("Replace all"),class:"ck-button-replaceall",withText:true}),this._replaceButtonView=this._createButton({label:t("Replace"),class:"ck-button-replace",withText:true}),this._findButtonView=this._createButton({label:t("Find"),class:"ck-button-find ck-button-action",withText:true}),this._actionButtonsDivView=this._createActionButtonsDiv(),this._focusTracker=new An,this._keystrokes=new In,this._focusables=new Xn,this.focusCycler=new Fp({focusables:this._focusables,focusTracker:this._focusTracker,keystrokeHandler:this._keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.addMany([this._inputsDivView,this._advancedOptionsCollapsibleView,this._actionButtonsDivView]),this.setTemplate({tag:"form",attributes:{class:["ck","ck-find-and-replace-form"],tabindex:"-1"},children:this.children});}render(){super.render(),Vs({view:this}),this._initFocusCycling(),this._initKeystrokeHandling();}destroy(){super.destroy(),this._focusTracker.destroy(),this._keystrokes.destroy();}focus(e){ -1===e?this.focusCycler.focusLast():this.focusCycler.focusFirst();}reset(){this._findInputView.errorText=null,this.isDirty=true;}get _textToFind(){return this._findInputView.fieldView.element.value}get _textToReplace(){return this._replaceInputView.fieldView.element.value}_createInputsDiv(){const e=this.locale,t=e.t,i=new Cs(e);return this._findInputView.fieldView.on("input",()=>{this.isDirty=true;}),this._findPrevButtonView.delegate("execute").to(this,"findPrevious"),this._findNextButtonView.delegate("execute").to(this,"findNext"),this._findPrevButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",({findPrevious:e})=>e),this._findNextButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",({findNext:e})=>e),this._injectFindResultsCounter(),this._replaceInputView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",({replace:e},t)=>e&&t),this._replaceInputView.bind("infoText").to(this._replaceInputView,"isEnabled",this._replaceInputView,"isFocused",(e,i)=>e||!i?"":t("Tip: Find some text first in order to replace it.")),i.setTemplate({tag:"div",attributes:{class:["ck","ck-find-and-replace-form__inputs"]},children:[this._findInputView,this._findPrevButtonView,this._findNextButtonView,this._replaceInputView]}),i}_onFindButtonExecute(){if(!this._textToFind){const e=this.t;return void(this._findInputView.errorText=e("Text to find must not be empty."))}this.isDirty=false,this.fire("findNext",{searchText:this._textToFind,matchCase:this._matchCase,wholeWords:this._wholeWordsOnly});}_injectFindResultsCounter(){const e=this.locale,t=e.t,i=this.bindTemplate,n=new Cs(this.locale);this.bind("_resultsCounterText").to(this,"highlightOffset",this,"matchCount",(e,i)=>t("%0 of %1",[e,i])),n.setTemplate({tag:"span",attributes:{class:["ck","ck-results-counter",i.if("isDirty","ck-hidden")]},children:[{text:i.to("_resultsCounterText")}]});const s=()=>{const t=this._findInputView.fieldView.element;if(!t||!Fi(t))return;const i=new Ci(n.element).width,s="ltr"===e.uiLanguageDirection?"paddingRight":"paddingLeft";t.style[s]=i?`calc( 2 * var(--ck-spacing-standard) + ${i}px )`:"";};this.on("change:_resultsCounterText",s,{priority:"low"}),this.on("change:isDirty",s,{priority:"low"}),this._findInputView.template.children[0].children.push(n);}_createAdvancedOptionsCollapsible(){const e=this.locale.t,t=new db(this.locale,[this._matchCaseSwitchView,this._wholeWordsOnlySwitchView]);return t.set({label:e("Advanced options"),isCollapsed:true}),t}_createActionButtonsDiv(){const e=new Cs(this.locale);return this._replaceButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",({replace:e},t)=>e&&t),this._replaceAllButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",({replaceAll:e},t)=>e&&t),this._replaceButtonView.on("execute",()=>{this.fire("replace",{searchText:this._textToFind,replaceText:this._textToReplace});}),this._replaceAllButtonView.on("execute",()=>{this.fire("replaceAll",{searchText:this._textToFind,replaceText:this._textToReplace}),this.focus();}),this._findButtonView.on("execute",this._onFindButtonExecute.bind(this)),e.setTemplate({tag:"div",attributes:{class:["ck","ck-find-and-replace-form__actions"]},children:[this._replaceAllButtonView,this._replaceButtonView,this._findButtonView]}),e}_createMatchCaseSwitch(){const e=this.locale.t,t=new rb(this.locale);return t.set({label:e("Match case"),withText:true}),t.bind("isOn").to(this,"_matchCase"),t.on("execute",()=>{this._matchCase=!this._matchCase,this.isDirty=true;}),t}_createWholeWordsOnlySwitch(){const e=this.locale.t,t=new rb(this.locale);return t.set({label:e("Whole words only"),withText:true}),t.bind("isOn").to(this,"_wholeWordsOnly"),t.on("execute",()=>{this._wholeWordsOnly=!this._wholeWordsOnly,this.isDirty=true;}),t}_initFocusCycling(){[this._findInputView,this._findPrevButtonView,this._findNextButtonView,this._replaceInputView,this._advancedOptionsCollapsibleView.buttonView,this._matchCaseSwitchView,this._wholeWordsOnlySwitchView,this._replaceAllButtonView,this._replaceButtonView,this._findButtonView].forEach(e=>{this._focusables.add(e),this._focusTracker.add(e.element);});}_initKeystrokeHandling(){const e=e=>e.stopPropagation(),t=e=>{e.stopPropagation(),e.preventDefault();};this._keystrokes.listenTo(this.element),this._keystrokes.set("f3",e=>{t(e),this._findNextButtonView.fire("execute");}),this._keystrokes.set("shift+f3",e=>{t(e),this._findPrevButtonView.fire("execute");}),this._keystrokes.set("enter",e=>{const i=e.target;i===this._findInputView.fieldView.element?(this._areCommandsEnabled.findNext?this._findNextButtonView.fire("execute"):this._findButtonView.fire("execute"),t(e)):i!==this._replaceInputView.fieldView.element||this.isDirty||(this._replaceButtonView.fire("execute"),t(e));}),this._keystrokes.set("shift+enter",e=>{e.target===this._findInputView.fieldView.element&&(this._areCommandsEnabled.findPrevious?this._findPrevButtonView.fire("execute"):this._findButtonView.fire("execute"),t(e));}),this._keystrokes.set("arrowright",e),this._keystrokes.set("arrowleft",e),this._keystrokes.set("arrowup",e),this._keystrokes.set("arrowdown",e);}_createButton(e){const t=new Bp(this.locale);return t.set(e),t}_createInputField(e,t){const i=new Nb(this.locale,Sw);return i.label=e,i.class=t,i}}class qI extends Ms{static get requires(){return [Wp]}static get pluginName(){return "FindAndReplaceUI"}static get isOfficialPlugin(){return  true}formView;constructor(e){super(e),e.config.define("findAndReplace.uiType","dialog"),this.formView=null;}init(){const e=this.editor,t="dropdown"===e.config.get("findAndReplace.uiType"),i=e.commands.get("find"),n=this.editor.t;e.ui.componentFactory.add("findAndReplace",()=>{let n;return t?(n=this._createDropdown(),n.bind("isEnabled").to(i)):n=this._createDialogButtonForToolbar(),e.keystrokes.set("Ctrl+F",(t,s)=>{if(i.isEnabled){if(n instanceof Wb){const e=n.buttonView;e.isOn||e.fire("execute");}else n.isOn?e.plugins.get("Dialog").view.focus():n.fire("execute");s();}}),n}),t||e.ui.componentFactory.add("menuBar:findAndReplace",()=>this._createDialogButtonForMenuBar()),e.accessibility.addKeystrokeInfos({keystrokes:[{label:n("Find in the document"),keystroke:"CTRL+F"}]});}_createDropdown(){const e=this.editor,t=e.locale.t,i=ww(e.locale);return i.once("change:isOpen",()=>{this.formView=this._createFormView(),this.formView.children.add(new Mp(e.locale,{label:t("Find and replace")}),0),i.panelView.children.add(this.formView);}),i.on("change:isOpen",(e,t,i)=>{i?this._setupFormView():this.fire("searchReseted");},{priority:"low"}),i.buttonView.set({icon:eg,label:t("Find and replace"),keystroke:"CTRL+F",tooltip:true}),i}_createDialogButtonForToolbar(){const e=this.editor,t=this._createButton(Bp),i=e.plugins.get("Dialog");return t.set({tooltip:true}),t.bind("isOn").to(i,"id",e=>"findAndReplace"===e),t.on("execute",()=>{t.isOn?i.hide():this._showDialog();}),t}_createDialogButtonForMenuBar(){const e=this._createButton(Jp),t=this.editor.plugins.get("Dialog"),i=this.editor.plugins.get("Dialog");return e.set({role:"menuitemcheckbox",isToggleable:true}),e.bind("isOn").to(i,"id",e=>"findAndReplace"===e),e.on("execute",()=>{"findAndReplace"!==t.id?this._showDialog():t.hide();}),e}_createButton(e){const t=this.editor,i=t.commands.get("find"),n=new e(t.locale),s=t.locale.t;return n.bind("isEnabled").to(i),n.set({icon:eg,label:s("Find and replace"),keystroke:"CTRL+F"}),n}_showDialog(){const e=this.editor,t=e.plugins.get("Dialog"),i=e.locale.t;this.formView||(this.formView=this._createFormView()),t.show({id:"findAndReplace",title:i("Find and replace"),content:this.formView,position:Up.EDITOR_TOP_SIDE,onShow:()=>{this._setupFormView();},onHide:()=>{this.fire("searchReseted");}});}_createFormView(){const e=this.editor,t=new(Is(HI))(e.locale),i=e.commands,n=this.editor.plugins.get("FindAndReplaceEditing").state;t.bind("highlightOffset").to(n,"highlightedOffset"),t.listenTo(n.results,"change",()=>{t.matchCount=n.results.length;});const s=i.get("findNext"),o=i.get("findPrevious"),r=i.get("replace"),a=i.get("replaceAll");return t.bind("_areCommandsEnabled").to(s,"isEnabled",o,"isEnabled",r,"isEnabled",a,"isEnabled",(e,t,i,n)=>({findNext:e,findPrevious:t,replace:i,replaceAll:n})),t.delegate("findNext","findPrevious","replace","replaceAll").to(this),t.on("change:isDirty",(e,t,i)=>{i&&this.fire("searchReseted");}),t}_setupFormView(){this.formView.disableCssTransitions(),this.formView.reset(),this.formView._findInputView.fieldView.select(),this.formView.enableCssTransitions();}}class UI extends Ns{_state;constructor(e,t){super(e),this.isEnabled=true,this.affectsData=false,this._state=t;}execute(e,{matchCase:t,wholeWords:i}={}){const{editor:n}=this,{model:s}=n,o=n.plugins.get("FindAndReplaceUtils");let r,a="";r="string"==typeof e?(...n)=>({results:o.findByTextCallback(e,{matchCase:t,wholeWords:i})(...n),searchText:e}):e;const l=r;r=(...e)=>{const t=l(...e);return t&&"searchText"in t&&(a=t.searchText),t};const c=s.document.getRootNames().reduce((e,t)=>o.updateFindResultFromRange(s.createRangeIn(s.document.getRoot(t)),s,r,e),null);return this._state.clear(s),this._state.results.addMany(c),this._state.highlightedResult=c.get(0),this._state.searchText=a,r&&(this._state.lastSearchCallback=r),this._state.matchCase=!!t,this._state.matchWholeWords=!!i,{results:c,findCallback:r}}}class jI extends($t()){constructor(e){super(),this.set("results",new kn),this.set("highlightedResult",null),this.set("highlightedOffset",0),this.set("searchText",""),this.set("replaceText",""),this.set("lastSearchCallback",null),this.set("matchCase",false),this.set("matchWholeWords",false),this.results.on("change",(t,{removed:i,index:n})=>{if(Array.from(i).length){let t=false;if(e.change(n=>{for(const s of i)this.highlightedResult===s&&(t=true),e.markers.has(s.marker.name)&&n.removeMarker(s.marker);}),t){const e=n>=this.results.length?0:n;this.highlightedResult=this.results.get(e);}}}),this.on("change:highlightedResult",()=>{this.refreshHighlightOffset(e);});}clear(e){this.searchText="",e.change(t=>{if(this.highlightedResult){const i=this.highlightedResult.marker.name.split(":")[1],n=e.markers.get(`findResultHighlighted:${i}`);n&&t.removeMarker(n);}[...this.results].forEach(({marker:e})=>{t.removeMarker(e);});}),this.results.clear();}refreshHighlightOffset(e){const{highlightedResult:t,results:i}=this;this.highlightedOffset=t?$I(e,[...i]).indexOf(t)+1:0;}}function $I(e,t){const i={before:-1,same:0,after:1,different:1};return e.document.getRootNames().flatMap(e=>t.filter(t=>t.marker.getStart().root.rootName===e).sort((e,t)=>i[e.marker.getStart().compareWith(t.marker.getStart())]))}class WI extends Ns{_state;constructor(e,t){super(e),this.isEnabled=true,this._state=t,this._isEnabledBasedOnSelection=false;}_replace(e,t){const{model:i}=this.editor,n=t.marker.getRange();i.canEditAt(n)&&i.change(s=>{if("$graveyard"===n.root.rootName)return void this._state.results.remove(t);let o={};for(const e of n.getItems())if(e.is("$text")||e.is("$textProxy")){o=e.getAttributes();break}i.insertContent(s.createText(e,o),n),this._state.results.has(t)&&this._state.results.remove(t);});}}class GI extends WI{execute(e,t){const i=Math.max(this._state.highlightedOffset-1,0);if(this._replace(e,t),this._state.results.length){const e=$I(this.editor.model,[...this._state.results]);this._state.highlightedResult=e[i%e.length];}}}class KI extends WI{execute(e,t){const{editor:i}=this,{model:n}=i,s=i.plugins.get("FindAndReplaceUtils"),o=t instanceof kn?t:n.document.getRootNames().reduce((e,i)=>s.updateFindResultFromRange(n.createRangeIn(n.document.getRoot(i)),n,s.findByTextCallback(t,this._state),e),null);o.length&&n.change(()=>{[...o].forEach(t=>{this._replace(e,t);});});}}class JI extends Ns{_state;constructor(e,t){super(e),this.affectsData=false,this._state=t,this.isEnabled=false,this.listenTo(this._state.results,"change",()=>{this.isEnabled=this._state.results.length>1;});}refresh(){this.isEnabled=this._state.results.length>1;}execute(){const e=this._state.results,t=e.getIndex(this._state.highlightedResult),i=t+1>=e.length?0:t+1;this._state.highlightedResult=this._state.results.get(i);}}class QI extends JI{execute(){const e=this._state.results.getIndex(this._state.highlightedResult),t=e-1<0?this._state.results.length-1:e-1;this._state.highlightedResult=this._state.results.get(t);}}class YI extends Ms{static get pluginName(){return "FindAndReplaceUtils"}static get isOfficialPlugin(){return  true}updateFindResultFromRange(e,t,i,n){const s=n||new kn;return t.change(n=>{[...e].forEach(({type:e,item:o})=>{if("elementStart"===e&&t.schema.checkChild(o,"$text")){let e=i({item:o,text:this.rangeToText(t.createRangeIn(o))});if(!e)return;"results"in e&&(e=e.results),e.forEach(e=>{const t=`findResult:${A()}`,i=n.addMarker(t,{usingOperation:false,affectsData:false,range:n.createRange(n.createPositionAt(o,e.start),n.createPositionAt(o,e.end))}),r=function(e,t){const i=e.find(({marker:e})=>t.getStart().isBefore(e.getStart()));return i?e.getIndex(i):e.length}(s,i);(e=>s.find(t=>{const{marker:i}=t,n=i.getRange(),s=e.getRange();return n.isEqual(s)}))(i)||s.add({id:t,label:e.label,marker:i},r);});}});}),s}rangeToText(e){return Array.from(e.getItems({shallow:true})).reduce((e,t)=>t.is("$text")||t.is("$textProxy")?e+t.data:`${e}\n`,"")}findByTextCallback(e,t){let i="gu";t.matchCase||(i+="i");let n=`(${Mt(e)})`;if(t.wholeWords){const t="[^a-zA-ZÀ-ɏḀ-ỿ]";new RegExp("^"+t).test(e)||(n=`(^|${t}|_)${n}`),new RegExp(t+"$").test(e)||(n=`${n}(?=_|${t}|$)`);}const s=new RegExp(n,i);return function({text:e}){return [...e.matchAll(s)].map(ZI)}}}function ZI(e){const t=e.length-1;let i=e.index;return 3===e.length&&(i+=e[1].length),{label:e[t],start:i,end:i+e[t].length}}class XI extends Ms{static get requires(){return [YI]}static get pluginName(){return "FindAndReplaceEditing"}static get licenseFeatureCode(){return "FAR"}static get isPremiumPlugin(){return  true}static get isOfficialPlugin(){return  true}state;init(){this.state=new jI(this.editor.model),this.set("_isSearchActive",false),this._defineConverters(),this._defineCommands(),this.listenTo(this.state,"change:highlightedResult",(e,t,i,n)=>{const{model:s}=this.editor;s.change(e=>{if(n){const t=n.marker.name.split(":")[1],i=s.markers.get(`findResultHighlighted:${t}`);i&&e.removeMarker(i);}if(i){const t=i.marker.name.split(":")[1];e.addMarker(`findResultHighlighted:${t}`,{usingOperation:false,affectsData:false,range:i.marker.getRange()});}});});const e=st(((e,t,i)=>{if(i){const e=this.editor.editing.view.domConverter,t=this.editor.editing.mapper.toViewRange(i.marker.getRange());ji({target:e.viewRangeToDom(t),viewportOffset:40});}}).bind(this),32);this.listenTo(this.state,"change:highlightedResult",e,{priority:"low"}),this.listenTo(this.editor,"destroy",e.cancel),this.on("change:_isSearchActive",(e,t,i)=>{i?this.listenTo(this.editor.model.document,"change:data",this._onDocumentChange):this.stopListening(this.editor.model.document,"change:data",this._onDocumentChange);});}find(e,t){return this._isSearchActive=true,this.editor.execute("find",e,t),this.state.results}stop(){this.state.clear(this.editor.model),this._isSearchActive=false;}_defineCommands(){this.editor.commands.add("find",new UI(this.editor,this.state)),this.editor.commands.add("findNext",new JI(this.editor,this.state)),this.editor.commands.add("findPrevious",new QI(this.editor,this.state)),this.editor.commands.add("replace",new GI(this.editor,this.state)),this.editor.commands.add("replaceAll",new KI(this.editor,this.state));}_defineConverters(){const{editor:e}=this;e.conversion.for("editingDowncast").markerToHighlight({model:"findResult",view:({markerName:e})=>{const[,t]=e.split(":");return {name:"span",classes:["ck-find-result"],attributes:{"data-find-result":t}}}}),e.conversion.for("editingDowncast").markerToHighlight({model:"findResultHighlighted",view:({markerName:e})=>{const[,t]=e.split(":");return {name:"span",classes:["ck-find-result_selected"],attributes:{"data-find-result":t}}}});}_onDocumentChange=()=>{const e=new Set,t=new Set,i=this.editor.model,{results:n}=this.state,s=i.document.differ.getChanges(),o=i.document.differ.getChangedMarkers();s.forEach(n=>{n.position&&("$text"===n.name||n.position.nodeAfter&&i.schema.isInline(n.position.nodeAfter)?(e.add(n.position.parent),[...i.markers.getMarkersAtPosition(n.position)].forEach(e=>{t.add(e.name);})):"insert"===n.type&&n.position.nodeAfter&&e.add(n.position.nodeAfter));}),o.forEach(({name:e,data:{newRange:i}})=>{i&&"$graveyard"===i.start.root.rootName&&t.add(e);}),e.forEach(e=>{[...i.markers.getMarkersIntersectingRange(i.createRangeIn(e))].forEach(e=>t.add(e.name));}),t.forEach(e=>{n.has(e)&&(n.get(e)===this.state.highlightedResult&&(this.state.highlightedResult=null),n.remove(e));});const r=[],a=this.editor.plugins.get("FindAndReplaceUtils");e.forEach(e=>{const t=a.updateFindResultFromRange(i.createRangeOn(e),i,this.state.lastSearchCallback,n);r.push(...t);}),o.forEach(e=>{if(e.data.newRange){const t=a.updateFindResultFromRange(e.data.newRange,i,this.state.lastSearchCallback,n);r.push(...t);}}),!this.state.highlightedResult&&r.length?this.state.highlightedResult=r[0]:this.state.refreshHighlightOffset(i);}}class eP extends Ms{static get requires(){return [XI,qI]}static get pluginName(){return "FindAndReplace"}static get isOfficialPlugin(){return  true}init(){const e=this.editor.plugins.get("FindAndReplaceUI"),t=this.editor.plugins.get("FindAndReplaceEditing"),i=t.state;e.on("findNext",(e,n)=>{n?(i.searchText=n.searchText,t.find(n.searchText,n)):this.editor.execute("findNext");}),e.on("findPrevious",(e,n)=>{n&&i.searchText!==n.searchText?t.find(n.searchText):this.editor.execute("findPrevious");}),e.on("replace",(e,n)=>{i.searchText!==n.searchText&&t.find(n.searchText);const s=i.highlightedResult;s&&this.editor.execute("replace",n.replaceText,s);}),e.on("replaceAll",(e,n)=>{i.searchText!==n.searchText&&t.find(n.searchText),this.editor.execute("replaceAll",n.replaceText,i.results);}),e.on("searchReseted",()=>{i.clear(this.editor.model),t.stop();});}}class tP extends Ns{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,i=t.document.selection,n=e.value,s=e.batch,o=e=>{if(i.isCollapsed)n?e.setSelectionAttribute(this.attributeKey,n):e.removeSelectionAttribute(this.attributeKey);else {const s=t.schema.getValidRanges(i.getRanges(),this.attributeKey,{includeEmptyRanges:true});for(const t of s){let i=t,s=this.attributeKey;t.isCollapsed&&(i=t.start.parent,s=Oa._getStoreAttributeKey(this.attributeKey)),n?e.setAttribute(s,n,i):e.removeAttribute(s,i);}}};s?t.enqueueChange(s,e=>{o(e);}):t.change(e=>{o(e);});}}const iP="fontSize",nP="fontFamily",sP="fontColor",oP="fontBackgroundColor";function rP(e,t){const i={model:{key:e,values:[]},view:{},upcastAlso:{}};for(const e of t)i.model.values.push(e.model),i.view[e.model]=e.view,e.upcastAlso&&(i.upcastAlso[e.model]=e.upcastAlso);return i}function aP(e){return t=>t.getStyle(e).replace(/\s/g,"")}function lP(e){return (t,{writer:i})=>i.createAttributeElement("span",{style:`${e}:${t}`},{priority:7})}function cP({dropdownView:e,colors:t,columns:i,removeButtonLabel:n,colorPickerLabel:s,documentColorsLabel:o,documentColorsCount:r,colorPickerViewConfig:a}){const l=e.locale,c=new fv(l,{colors:t,columns:i,removeButtonLabel:n,colorPickerLabel:s,documentColorsLabel:o,documentColorsCount:r,colorPickerViewConfig:a});return e.colorSelectorView=c,e.panelView.children.add(c),c}class uP extends tP{constructor(e){super(e,nP);}}function dP(e){return e.map(mP).filter(e=>void 0!==e)}function hP(e){return e.replace(/["']/g,"").split(",").map(e=>e.trim())}function mP(e){return "object"==typeof e?e:"default"===e?{title:"Default",model:void 0}:"string"==typeof e?function(e){const t=hP(e),i=t[0],n=t.map(gP).join(", ");return {title:i,model:n,view:{name:"span",styles:{"font-family":n},priority:7}}}(e):void 0}function gP(e){return (e=e.trim()).indexOf(" ")>0&&(e=`'${e}'`),e}class fP extends Ms{static get pluginName(){return "FontFamilyEditing"}static get isOfficialPlugin(){return  true}constructor(e){super(e),e.config.define(nP,{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:false});}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:nP}),e.model.schema.setAttributeProperties(nP,{isFormatting:true,copyOnEnter:true});const t=dP(e.config.get("fontFamily.options")).filter(e=>e.model),i=rP(nP,t);e.config.get("fontFamily.supportAllValues")?(this._prepareAnyValueConverters(),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(i),e.commands.add(nP,new uP(e));}_prepareAnyValueConverters(){const e=this.editor;e.conversion.for("downcast").attributeToElement({model:nP,view:(e,{writer:t})=>t.createAttributeElement("span",{style:"font-family:"+e},{priority:7})}),e.conversion.for("upcast").elementToAttribute({model:{key:nP,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:nP,value:e=>e.getAttribute("face")}});}}class pP extends Ms{static get pluginName(){return "FontFamilyUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.t,i=this._getLocalizedOptions(),n=e.commands.get(nP),s=t("Font Family"),o=function(e,t){const i=new kn;for(const n of e){const e={type:"button",model:new e_({commandName:nP,commandParam:n.model,label:n.title,role:"menuitemradio",withText:true})};e.model.bind("isOn").to(t,"value",e=>{if(e===n.model)return  true;if(!e||!n.model)return  false;return hP(e)[0].toLowerCase()===hP(n.model)[0].toLowerCase()}),n.view&&"string"!=typeof n.view&&n.view.styles&&e.model.set("labelStyle",`font-family: ${n.view.styles["font-family"]}`),i.add(e);}return i}(i,n);e.ui.componentFactory.add(nP,t=>{const i=ww(t);return Cw(i,o,{role:"menu",ariaLabel:s}),i.buttonView.set({label:s,icon:ng,tooltip:true}),i.extendTemplate({attributes:{class:"ck-font-family-dropdown"}}),i.bind("isEnabled").to(n),this.listenTo(i,"execute",t=>{e.execute(t.source.commandName,{value:t.source.commandParam}),e.editing.view.focus();}),i}),e.ui.componentFactory.add(`menuBar:${nP}`,t=>{const i=new x_(t);i.buttonView.set({label:s,icon:ng}),i.bind("isEnabled").to(n);const r=new A_(t);for(const n of o){const s=new Av(t,i),o=new Jp(t);o.set({role:"menuitemradio",isToggleable:true}),o.bind(...Object.keys(n.model)).to(n.model),o.delegate("execute").to(i),o.on("execute",()=>{e.execute(n.model.commandName,{value:n.model.commandParam}),e.editing.view.focus();}),s.children.add(o),r.items.add(s);}return i.panelView.children.add(r),i});}_getLocalizedOptions(){const e=this.editor,t=e.t;return dP(e.config.get(nP).options).map(e=>("Default"===e.title&&(e.title=t("Default")),e))}}class bP extends Ms{static get requires(){return [fP,pP]}static get pluginName(){return "FontFamily"}static get isOfficialPlugin(){return  true}}class wP extends tP{constructor(e){super(e,iP);}}function vP(e){return e.map(e=>function(e){"number"==typeof e&&(e=String(e));if("object"==typeof e&&function(e){return e.title&&e.model&&e.view}(e))return yP(e);const t=function(e){return "string"==typeof e?_P[e]:_P[e.model]}(e);if(t)return yP(t);if("default"===e)return {model:void 0,title:"Default"};if(function(e){let t;if("object"==typeof e){if(!e.model)throw new I("font-size-invalid-definition",null,e);t=parseFloat(e.model);}else 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}},yP(e)}(e)}(e)).filter(e=>void 0!==e)}const _P={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 yP(e){return e.view&&"string"!=typeof e.view&&!e.view.priority&&(e.view.priority=7),e}const kP=["x-small","x-small","small","medium","large","x-large","xx-large","xxx-large"];class CP extends Ms{static get pluginName(){return "FontSizeEditing"}static get isOfficialPlugin(){return  true}constructor(e){super(e),e.config.define(iP,{options:["tiny","small","default","big","huge"],supportAllValues:false});}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:iP}),e.model.schema.setAttributeProperties(iP,{isFormatting:true,copyOnEnter:true});const t=e.config.get("fontSize.supportAllValues"),i=vP(this.editor.config.get("fontSize.options")).filter(e=>e.model),n=rP(iP,i);t?(this._prepareAnyValueConverters(n),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(n),e.commands.add(iP,new wP(e));}_prepareAnyValueConverters(e){const t=this.editor,i=e.model.values.filter(e=>!Lu(String(e))&&!Fu(String(e)));if(i.length)throw new I("font-size-invalid-use-of-named-presets",null,{presets:i});t.conversion.for("downcast").attributeToElement({model:iP,view:(e,{writer:t})=>{if(e)return t.createAttributeElement("span",{style:"font-size:"+e},{priority:7})}}),t.conversion.for("upcast").elementToAttribute({model:{key:iP,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:iP,value:e=>{const t=e.getAttribute("size"),i="-"===t[0]||"+"===t[0];let n=parseInt(t,10);i&&(n=3+n);const s=kP.length-1,o=Math.min(Math.max(n,0),s);return kP[o]}}});}}class xP extends Ms{static get pluginName(){return "FontSizeUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.t,i=this._getLocalizedOptions(),n=e.commands.get(iP),s=t("Font Size"),o=function(e,t){const i=new kn;for(const n of e){const e={type:"button",model:new e_({commandName:iP,commandParam:n.model,label:n.title,class:"ck-fontsize-option",role:"menuitemradio",withText:true})};n.view&&"string"!=typeof n.view&&(n.view.styles&&e.model.set("labelStyle",`font-size:${n.view.styles["font-size"]}`),n.view.classes&&e.model.set("class",`${e.model.class} ${n.view.classes}`)),e.model.bind("isOn").to(t,"value",e=>e===n.model),i.add(e);}return i}(i,n);e.ui.componentFactory.add(iP,t=>{const i=ww(t);return Cw(i,o,{role:"menu",ariaLabel:s}),i.buttonView.set({label:s,icon:sg,tooltip:true}),i.extendTemplate({attributes:{class:["ck-font-size-dropdown"]}}),i.bind("isEnabled").to(n),this.listenTo(i,"execute",t=>{e.execute(t.source.commandName,{value:t.source.commandParam}),e.editing.view.focus();}),i}),e.ui.componentFactory.add(`menuBar:${iP}`,t=>{const i=new x_(t);i.buttonView.set({label:s,icon:sg}),i.bind("isEnabled").to(n);const r=new A_(t);for(const n of o){const s=new Av(t,i),o=new Jp(t);o.set({role:"menuitemradio",isToggleable:true}),o.bind(...Object.keys(n.model)).to(n.model),o.delegate("execute").to(i),o.on("execute",()=>{e.execute(n.model.commandName,{value:n.model.commandParam}),e.editing.view.focus();}),s.children.add(o),r.items.add(s);}return i.panelView.children.add(r),i});}_getLocalizedOptions(){const e=this.editor,t=e.t,i={Default:t("Default"),Tiny:t("Tiny"),Small:t("Small"),Big:t("Big"),Huge:t("Huge")};return vP(e.config.get(iP).options).map(e=>{const t=i[e.title];return t&&t!=e.title&&(e=Object.assign({},e,{title:t})),e})}}class AP extends Ms{static get requires(){return [CP,xP]}static get pluginName(){return "FontSize"}static get isOfficialPlugin(){return  true}normalizeSizeOptions(e){return vP(e)}}class EP extends tP{constructor(e){super(e,sP);}}class TP extends Ms{static get pluginName(){return "FontColorEditing"}static get isOfficialPlugin(){return  true}constructor(e){super(e),e.config.define(sP,{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:true},{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:sP,value:aP("color")}}),e.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{color:/^#?\w+$/}},model:{key:sP,value:e=>e.getAttribute("color")}}),e.conversion.for("downcast").attributeToElement({model:sP,view:lP("color")}),e.commands.add(sP,new EP(e)),e.model.schema.extend("$text",{allowAttributes:sP}),e.model.schema.setAttributeProperties(sP,{isFormatting:true,copyOnEnter:true});}}class SP extends Ms{commandName;componentName;icon;dropdownLabel;columns;constructor(e,{commandName:t,componentName:i,icon:n,dropdownLabel:s}){super(e),this.commandName=t,this.componentName=i,this.icon=n,this.dropdownLabel=s,this.columns=e.config.get(`${this.componentName}.columns`);}init(){const e=this.editor,t=e.locale,i=t.t,n=e.commands.get(this.commandName),s=e.config.get(this.componentName),o=hb(t,mb(s.colors)),r=s.documentColors,a=false!==s.colorPicker;e.ui.componentFactory.add(this.componentName,t=>{const l=ww(t);let c=false;const u=cP({dropdownView:l,colors:o.map(e=>({label:e.label,color:e.model,options:{hasBorder:e.hasBorder}})),columns:this.columns,removeButtonLabel:i("Remove color"),colorPickerLabel:i("Color picker"),documentColorsLabel:0!==r?i("Document colors"):"",documentColorsCount:void 0===r?this.columns:r,colorPickerViewConfig:!!a&&(s.colorPicker||{})});return u.bind("selectedColor").to(n,"value"),l.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:true}),l.extendTemplate({attributes:{class:"ck-color-ui-dropdown"}}),l.bind("isEnabled").to(n),u.on("execute",(t,i)=>{l.isOpen&&e.execute(this.commandName,{value:i.value,batch:this._undoStepBatch}),"colorPicker"!==i.source&&e.editing.view.focus(),"colorPickerSaveButton"===i.source&&(l.isOpen=false);}),u.on("colorPicker:show",()=>{this._undoStepBatch=e.model.createBatch();}),u.on("colorPicker:cancel",()=>{this._undoStepBatch.operations.length&&(l.isOpen=false,e.execute("undo",this._undoStepBatch)),e.editing.view.focus();}),l.on("change:isOpen",(t,i,n)=>{c||(c=true,l.colorSelectorView.appendUI()),n&&(0!==r&&u.updateDocumentColors(e.model,this.componentName),u.updateSelectedColors(),u.showColorGridsFragment());}),Aw(l,()=>l.colorSelectorView.colorGridsFragmentView.staticColorsGrid.items.find(e=>e.isOn)),l}),e.ui.componentFactory.add(`menuBar:${this.componentName}`,t=>{const s=new x_(t);s.buttonView.set({label:this.dropdownLabel,icon:this.icon}),s.bind("isEnabled").to(n);let a=false;const l=new fv(t,{colors:o.map(e=>({label:e.label,color:e.model,options:{hasBorder:e.hasBorder}})),columns:this.columns,removeButtonLabel:i("Remove color"),colorPickerLabel:i("Color picker"),documentColorsLabel:0!==r?i("Document colors"):"",documentColorsCount:void 0===r?this.columns:r,colorPickerViewConfig:false});return l.bind("selectedColor").to(n,"value"),l.delegate("execute").to(s),l.on("execute",(t,i)=>{e.execute(this.commandName,{value:i.value,batch:this._undoStepBatch}),e.editing.view.focus();}),s.on("change:isOpen",(t,i,n)=>{a||(a=true,l.appendUI()),n&&(0!==r&&l.updateDocumentColors(e.model,this.componentName),l.updateSelectedColors(),l.showColorGridsFragment());}),s.panelView.children.add(l),s});}}class IP extends SP{constructor(e){const t=e.locale.t;super(e,{commandName:sP,componentName:sP,icon:ig,dropdownLabel:t("Font Color")});}static get pluginName(){return "FontColorUI"}}class PP extends Ms{static get requires(){return [TP,IP]}static get pluginName(){return "FontColor"}static get isOfficialPlugin(){return  true}}class VP extends tP{constructor(e){super(e,oP);}}class RP extends Ms{static get pluginName(){return "FontBackgroundColorEditing"}static get isOfficialPlugin(){return  true}constructor(e){super(e),e.config.define(oP,{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:true},{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(od),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{"background-color":/[\s\S]+/}},model:{key:oP,value:aP("background-color")}}),e.conversion.for("downcast").attributeToElement({model:oP,view:lP("background-color")}),e.commands.add(oP,new VP(e)),e.model.schema.extend("$text",{allowAttributes:oP}),e.model.schema.setAttributeProperties(oP,{isFormatting:true,copyOnEnter:true});}}class OP extends SP{constructor(e){const t=e.locale.t;super(e,{commandName:oP,componentName:oP,icon:tg,dropdownLabel:t("Font Background Color")});}static get pluginName(){return "FontBackgroundColorUI"}}class BP extends Ms{static get requires(){return [RP,OP]}static get pluginName(){return "FontBackgroundColor"}static get isOfficialPlugin(){return  true}}class LP extends Ms{static get requires(){return [bP,AP,PP,BP]}static get pluginName(){return "Font"}static get isOfficialPlugin(){return  true}}class MP{_placeholderMap;_wrapper=null;_document;_annotationsUIsData=null;_paginationBodyCollection=null;_hasLeftCollapseButton=false;_collapseLeftSidebarButton=null;_resizeObserver=null;_sidebarsWidths={left:0,right:0};_keepLeftSidebarHidden=false;_forceShowLeftSidebar=false;_sourceEditingCallback=(e,t,i)=>{this.getWrapper().querySelector(".ck-fullscreen__document-outline-header").style.display=i?"none":"";};_hiddenElements=new Map;_savedAncestorsScrollPositions=new Map;_showRevisionViewerCallback=null;_closeRevisionViewerCallback=null;_aiTabsData=null;constructor(t){this._placeholderMap=new Map,t.plugins.has("RevisionHistory")&&(this._showRevisionViewerCallback=t.config.get("revisionHistory").showRevisionViewerCallback,this._closeRevisionViewerCallback=t.config.get("revisionHistory").closeRevisionViewerCallback),this._editor=t,this._document=this._editor.sourceElement?this._editor.sourceElement.ownerDocument:exports.global.document,this._editor.config.define("fullscreen.container",this._document.body),t.on("destroy",()=>{this._wrapper&&this.destroy(),this._resizeObserver&&this._resizeObserver.destroy();});}moveToFullscreen(e,t){const i=ii(this._document,"div");i.setAttribute("data-ck-fullscreen-placeholder",t),e.replaceWith(i),this.getWrapper().querySelector(`[data-ck-fullscreen="${t}"]`).append(e),this._placeholderMap.set(t,{placeholderElement:i,movedElement:e});}restoreMovedElementLocation(e){if(!this._placeholderMap.has(e))return;const{placeholderElement:t,movedElement:i}=this._placeholderMap.get(e);t.replaceWith(i),t.remove(),this._placeholderMap.delete(e),0===this._placeholderMap.size&&this._destroyContainer();}getWrapper(){return this._wrapper||(this._wrapper=ii(this._document,"div",{class:"ck ck-fullscreen__main-wrapper"}),this._wrapper.innerHTML='\n\t\t\t\t<div class="ck ck-fullscreen__top-wrapper ck-reset_all">\n\t\t\t\t\t<div class="ck ck-fullscreen__menu-bar" data-ck-fullscreen="menu-bar"></div>\n\t\t\t\t\t<div class="ck ck-fullscreen__toolbar" data-ck-fullscreen="toolbar"></div>\n\t\t\t\t</div>\n\t\t\t\t<div class="ck ck-fullscreen__editable-wrapper">\n\t\t\t\t\t<div class="ck ck-fullscreen__sidebar ck-fullscreen__left-sidebar" data-ck-fullscreen="left-sidebar"></div>\n\t\t\t\t\t<div class="ck ck-fullscreen__editable" data-ck-fullscreen="editable">\n\t\t\t\t\t\t<div class="ck ck-fullscreen__pagination-view" data-ck-fullscreen="pagination-view"></div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class="ck ck-fullscreen__sidebar ck-fullscreen__right-sidebar" data-ck-fullscreen="right-sidebar"></div>\n\t\t\t\t\t<div class="ck ck-fullscreen__right-edge" data-ck-fullscreen="right-edge"></div>\n\t\t\t\t</div>\n\t\t\t\t<div class="ck ck-fullscreen__bottom-wrapper">\n\t\t\t\t\t<div class="ck ck-fullscreen__body-wrapper" data-ck-fullscreen="body-wrapper"></div>\n\t\t\t\t</div>\n\t\t\t',this._editor.config.get("fullscreen.container").appendChild(this._wrapper)),this._wrapper}enable(){if(this._saveAncestorsScrollPositions(this._editor.ui.getEditableElement()),this.defaultOnEnter(),this._editor.config.get("fullscreen.container")===this._document.body&&(this._document.body.classList.add("ck-fullscreen"),this._document.body.parentElement.classList.add("ck-fullscreen")),this._editor.plugins.has("PresenceListUI")&&this._generatePresenceListContainer(),this._editor.plugins.has("DocumentOutlineUI")&&this._generateDocumentOutlineContainer(),this._hasLeftCollapseButton&&this._generateCollapseButton(),this._editor.plugins.has("Pagination")&&this._editor.plugins.get("Pagination").isEnabled){const e=this._editor.plugins.get("PaginationRenderer");e.setupScrollableAncestor(),this._paginationBodyCollection=new Yp(this._editor.locale),this._paginationBodyCollection.attachToDom(),e.linesRepository.setViewCollection(this._paginationBodyCollection),this._editor.once("destroy",()=>{this._paginationBodyCollection.detachFromDom();}),this.moveToFullscreen(this._paginationBodyCollection.bodyCollectionContainer,"body-wrapper");}this._editor.plugins.has("AnnotationsUIs")&&this._overrideAnnotationsUIs(),this._editor.plugins.has("RevisionHistory")&&(this._editor.plugins.get("RevisionHistory").isRevisionViewerOpen&&this._editor.config.get("revisionHistory.closeRevisionViewerCallback")(),this._overrideRevisionHistoryCallbacks()),this._editor.plugins.has("AITabs")&&this._handleAITabsTransfer(),this._editor.plugins.has("SourceEditing")&&this._editor.plugins.has("DocumentOutlineUI")&&this._editor.plugins.get("SourceEditing").on("change:isSourceEditingMode",this._sourceEditingCallback),this._editor.plugins.has("Dialog")&&this._registerFullscreenDialogPositionAdjustments();for(const e of this._editor.config.get("fullscreen.container").children)e===this._wrapper||e.classList.contains("ck-body-wrapper")||e.classList.contains("ckbox-wrapper")||"none"===e.style.display||(this._hiddenElements.set(e,e.style.display),e.style.display="none");this._sidebarsWidths={left:this._wrapper.querySelector(".ck-fullscreen__left-sidebar").scrollWidth,right:this._wrapper.querySelector(".ck-fullscreen__right-sidebar").scrollWidth},this._adjustVisibleElements(),this._setupResizeObserver(),this._editor.config.get("fullscreen.onEnterCallback")&&this._editor.config.get("fullscreen.onEnterCallback")(this.getWrapper());}disable(){this._editor.config.get("fullscreen.onLeaveCallback")&&this._editor.config.get("fullscreen.onLeaveCallback")(this.getWrapper()),this._document.body.classList.remove("ck-fullscreen"),this._document.body.parentElement.classList.remove("ck-fullscreen"),this._editor.plugins.has("DocumentOutlineUI")&&this._restoreDocumentOutlineDefaultContainer(),this._annotationsUIsData&&this._restoreAnnotationsUIs(),this._editor.plugins.has("RevisionHistory")&&this._restoreRevisionHistoryCallbacks(),this._editor.plugins.has("AITabs")&&this._restoreAITabs(),this._editor.plugins.has("SourceEditing")&&this._editor.plugins.has("DocumentOutlineUI")&&this._editor.plugins.get("SourceEditing").off("change:isSourceEditingMode",this._sourceEditingCallback);for(const e of this._placeholderMap.keys())this.restoreMovedElementLocation(e);this._destroyContainer(),this._editor.ui.view.toolbar&&this._editor.ui.view.toolbar.switchBehavior(true===this._editor.config.get("toolbar.shouldNotGroupWhenFull")?"static":"dynamic");for(const[e,t]of this._savedAncestorsScrollPositions)e.scrollTo({left:t.scrollLeft,top:t.scrollTop,behavior:"instant"});if(this._savedAncestorsScrollPositions.clear(),this._editor.plugins.has("Pagination")&&this._editor.plugins.get("Pagination").isEnabled){const e=this._editor.plugins.get("PaginationRenderer");e.setupScrollableAncestor(),e.linesRepository.setViewCollection(this._editor.ui.view.body),this._paginationBodyCollection.detachFromDom(),this._paginationBodyCollection?.destroy();}this._editor.plugins.has("Dialog")&&this._unregisterFullscreenDialogPositionAdjustments(),this._keepLeftSidebarHidden=false,this._resizeObserver?.destroy();}destroy(){for(const{placeholderElement:e,movedElement:t}of this._placeholderMap.values())e.remove(),t.remove();this._destroyContainer(),this._document.body.classList.remove("ck-fullscreen"),this._document.body.parentElement.classList.remove("ck-fullscreen");}defaultOnEnter(){return this.getWrapper()}_destroyContainer(){if(this._wrapper){this._wrapper.remove(),this._wrapper=null;for(const[e,t]of this._hiddenElements)e.style.display=t;this._hiddenElements.clear();}}_generatePresenceListContainer(){const e=this._editor.t,t=ii(document,"div",{class:"ck ck-fullscreen__left-sidebar-item"});t.innerHTML='\n\t\t\t<div class="ck ck-fullscreen__left-sidebar-header"></div>\n\t\t\t<div class="ck ck-fullscreen__presence-list" data-ck-fullscreen="presence-list"></div>\n\t\t',t.firstElementChild.innerText=e("Connected users"),document.querySelector('[data-ck-fullscreen="left-sidebar-sticky"]')||document.querySelector('[data-ck-fullscreen="left-sidebar"]').appendChild(ii(document,"div",{class:"ck ck-fullscreen__left-sidebar-sticky","data-ck-fullscreen":"left-sidebar-sticky"})),document.querySelector('[data-ck-fullscreen="left-sidebar-sticky"]').appendChild(t);const i=this._editor.plugins.get("PresenceListUI");this.moveToFullscreen(i.view.element,"presence-list"),this._hasLeftCollapseButton=true;}_generateDocumentOutlineContainer(){const e=this._editor.t,t=ii(document,"div",{class:"ck-fullscreen__left-sidebar-item ck-fullscreen__left-sidebar-item--no-margin"});t.innerHTML='\n\t\t\t<div class="ck ck-fullscreen__left-sidebar-header ck-fullscreen__document-outline-header"></div>\n\t\t',t.firstElementChild.innerText=e("Document outline");const i=ii(document,"div",{class:"ck ck-fullscreen__left-sidebar-item ck-fullscreen__document-outline-wrapper"});i.innerHTML='\n\t\t\t<div class="ck ck-fullscreen__document-outline" data-ck-fullscreen="document-outline"></div>\n\t\t',document.querySelector('[data-ck-fullscreen="left-sidebar-sticky"]')||document.querySelector('[data-ck-fullscreen="left-sidebar"]').appendChild(ii(document,"div",{class:"ck ck-fullscreen__left-sidebar-sticky","data-ck-fullscreen":"left-sidebar-sticky"})),document.querySelector('[data-ck-fullscreen="left-sidebar"]').appendChild(i),document.querySelector('[data-ck-fullscreen="left-sidebar-sticky"]').appendChild(t);const n=this._editor.plugins.get("DocumentOutlineUI");n.view.documentOutlineContainer=document.querySelector('[data-ck-fullscreen="left-sidebar"]'),this.moveToFullscreen(n.view.element,"document-outline"),this._hasLeftCollapseButton=true;}_restoreDocumentOutlineDefaultContainer(){const e=this._editor.plugins.get("DocumentOutlineUI");e.view.documentOutlineContainer=e.view.element;}_generateCollapseButton(){const e=new Bp(this._editor.locale),t=document.querySelector(".ck-fullscreen__left-sidebar"),i=this._editor.t;e.set({label:i("Toggle sidebar"),class:"ck-fullscreen__left-sidebar-toggle-button",tooltip:i("Hide left sidebar"),tooltipPosition:"se",icon:Pf}),e.on("execute",()=>{t.classList.contains("ck-fullscreen__left-sidebar--collapsed")?(this._forceShowLeftSidebar=true,this._keepLeftSidebarHidden=false,this._showLeftSidebar()):(this._keepLeftSidebarHidden=true,this._hideLeftSidebar()),this._editor.editing.view.focus();}),e.render(),this._collapseLeftSidebarButton=e,t.prepend(e.element);}_overrideAnnotationsUIs(){const e=this._editor.plugins.get("AnnotationsUIs");this._annotationsUIsData=new Map(e.uisData),e.deactivateAll();const t=this._editor.plugins.get("Sidebar");t.container?(this._switchAnnotationsUI("wideSidebar"),this.moveToFullscreen(t.container.firstElementChild,"right-sidebar"),t.setContainer(this.getWrapper().querySelector('[data-ck-fullscreen="right-sidebar"]'))):(t.setContainer(this.getWrapper().querySelector('[data-ck-fullscreen="right-sidebar"]')),this._switchAnnotationsUI("wideSidebar"),this.moveToFullscreen(t.container.firstElementChild,"right-sidebar"));}_restoreAnnotationsUIs(){const e=this._editor.plugins.get("Sidebar"),t=e.context.config.get("sidebar.container");t&&e.setContainer(t);const i=this._editor.plugins.get("AnnotationsUIs");i.deactivateAll();for(const[e,t]of [...this._annotationsUIsData])i.activate(e,t.filter);this._annotationsUIsData=null;}_overrideRevisionHistoryCallbacks(){this._editor.config.set("revisionHistory.showRevisionViewerCallback",async()=>{const e=await this._showRevisionViewerCallback();return this._editor.plugins.has("DocumentOutlineUI")&&(this.getWrapper().querySelector(".ck-fullscreen__document-outline-header").style.display="none"),this.restoreMovedElementLocation("editable"),this.restoreMovedElementLocation("toolbar"),this.restoreMovedElementLocation("right-sidebar"),this._annotationsUIsData&&this._restoreAnnotationsUIs(),this._editor.ui.view.menuBarView&&this._editor.ui.view.menuBarView.disable(),this.moveToFullscreen(e.ui.getEditableElement(),"editable"),this.moveToFullscreen(e.ui.view.toolbar.element,"toolbar"),this.moveToFullscreen(this._editor.config.get("revisionHistory.viewerSidebarContainer"),"right-sidebar"),e}),this._editor.config.set("revisionHistory.closeRevisionViewerCallback",async()=>{this.restoreMovedElementLocation("toolbar"),this.restoreMovedElementLocation("editable"),this.restoreMovedElementLocation("right-sidebar"),this._editor.plugins.has("DocumentOutlineUI")&&(this.getWrapper().querySelector(".ck-fullscreen__document-outline-header").style.display=""),this.moveToFullscreen(this._editor.ui.getEditableElement(),"editable"),this.moveToFullscreen(this._editor.ui.view.toolbar.element,"toolbar"),await this._closeRevisionViewerCallback(),this._editor.plugins.has("AnnotationsUIs")&&this._overrideAnnotationsUIs(),this._editor.ui.view.menuBarView&&this._editor.ui.view.menuBarView.enable();});}_restoreRevisionHistoryCallbacks(){this._editor.config.set("revisionHistory.showRevisionViewerCallback",async()=>this._showRevisionViewerCallback()),this._editor.config.set("revisionHistory.closeRevisionViewerCallback",async()=>this._closeRevisionViewerCallback());}_registerFullscreenDialogPositionAdjustments(){const e=this._editor.plugins.get("Dialog");this._setNewDialogPosition(),e.on("change:isOpen",this.updateDialogPositionCallback,{priority:"highest"});}_unregisterFullscreenDialogPositionAdjustments(){const e=this._editor.plugins.get("Dialog"),t=e.view;t&&null===t.position&&(t.position=Up.EDITOR_TOP_SIDE),t&&t.updatePosition(),e.off("change:isOpen",this.updateDialogPositionCallback);}updateDialogPositionCallback=this._updateDialogPosition.bind(this);_updateDialogPosition(e,t,i){i&&this._setNewDialogPosition();}_setNewDialogPosition(){const e=this._editor.plugins.get("Dialog").view;if(!e||e.position!==Up.EDITOR_TOP_SIDE)return;const t=new Ci(this._wrapper.querySelector(".ck-fullscreen__right-edge")).getVisible(),i=t?this._wrapper.querySelector(".ck-fullscreen__right-edge"):this._wrapper,n=new Ci(i).getVisible(),s=new Ci(document.querySelector(".ck-fullscreen__editable")).getVisible(),o=new Ci(e.element.querySelector(".ck-dialog")).getVisible(),r=new Ci(document.querySelector(".ck-fullscreen__editable-wrapper")).excludeScrollbarsAndBorders().getVisible().width-new Ci(document.querySelector(".ck-fullscreen__editable-wrapper")).getVisible().width;if(n&&s&&o){e.position=null;const i=t?n.left-o.width-28:n.left+n.width-o.width-28+r;e.moveTo(i,s.top);}}_saveAncestorsScrollPositions(t){let i=t.parentElement;if(i)for(;i;){const t=i.style.overflowY||exports.global.window.getComputedStyle(i).overflowY,n=i.style.overflowX||exports.global.window.getComputedStyle(i).overflowX;("auto"===t||"scroll"===t||"auto"===n||"scroll"===n||"HTML"===i.tagName)&&this._savedAncestorsScrollPositions.set(i,{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}),i=i.parentElement;}}_handleAITabsTransfer(){const e=this._editor.plugins.get("AITabs");this._aiTabsData={side:e.side,type:e.type},this.moveToFullscreen(e.view.element,"right-edge"),e.side="right",e.type="sidebar",e.view.element.addEventListener("transitionend",e=>this._handleAISidebarTransitions(e));}_handleAISidebarTransitions(e){const t=this._editor.plugins.get("AITabs");e.target===t.view.element&&e.propertyName.includes("width")&&this._adjustVisibleElements();}_restoreAITabs(){const e=this._editor.plugins.get("AITabs");e.side=this._aiTabsData?.side,e.type=this._aiTabsData?.type,this._aiTabsData=null,e.view.element.removeEventListener("transitionend",this._handleAISidebarTransitions);}_adjustVisibleElements(){const e=this._wrapper.querySelector(".ck-fullscreen__editable-wrapper");if(this._forceShowLeftSidebar)this._forceShowLeftSidebar=false;else if(e.scrollWidth>e.clientWidth)this._hideLeftSidebar(),e.scrollWidth>e.clientWidth&&this._hideRightSidebar();else {let t=[...e.children].reduce((e,t)=>e+t.scrollWidth,0);t+this._sidebarsWidths.right<e.clientWidth&&(this._showRightSidebar(),t=[...e.children].reduce((e,t)=>e+t.scrollWidth,0)),t+this._sidebarsWidths.left<e.clientWidth&&!this._keepLeftSidebarHidden&&this._showLeftSidebar();}}_switchAnnotationsUI(e){const t=this._editor.plugins.get("AnnotationsUIs");t.deactivateAll();const i=new Map;for(const[e,n]of [...this._annotationsUIsData])n.filter!==t.defaultFilter&&i.set(e,n.filter);i.has(e)?t.activate(e,i.get(e)):i.size?t.activate(e,e=>[...i.values()].some(t=>t(e))):t.switchTo(e);}_setupResizeObserver(){const e=this._wrapper.querySelector(".ck-fullscreen__editable-wrapper");this._resizeObserver&&this._resizeObserver.destroy(),this._resizeObserver=new Pi(e,()=>{this._adjustVisibleElements();});}_hideLeftSidebar(){const e=this._editor.t;if(this._collapseLeftSidebarButton){this._wrapper.querySelector(".ck-fullscreen__left-sidebar").classList.add("ck-fullscreen__left-sidebar--collapsed"),this._collapseLeftSidebarButton.icon=Dm,this._collapseLeftSidebarButton.tooltip=e("Show left sidebar");}}_showLeftSidebar(){const e=this._editor.t;if(this._collapseLeftSidebarButton){this._wrapper.querySelector(".ck-fullscreen__left-sidebar").classList.remove("ck-fullscreen__left-sidebar--collapsed"),this._collapseLeftSidebarButton.icon=Pf,this._collapseLeftSidebarButton.tooltip=e("Hide left sidebar");}}_hideRightSidebar(){this._wrapper.querySelector(".ck-fullscreen__right-sidebar").firstChild&&(this._switchAnnotationsUI("narrowSidebar"),this._wrapper.querySelector(".ck-fullscreen__right-sidebar").classList.add("ck-fullscreen__right-sidebar--collapsed"));}_showRightSidebar(){this._wrapper.querySelector(".ck-fullscreen__right-sidebar").firstChild&&(this._switchAnnotationsUI("wideSidebar"),this._wrapper.querySelector(".ck-fullscreen__right-sidebar").classList.remove("ck-fullscreen__right-sidebar--collapsed"));}}class FP extends MP{_editor;constructor(e){super(e),this._editor=e;}defaultOnEnter(){const e=this._editor.ui,t=e.view;return this._editor.plugins.has("Pagination")&&this._editor.plugins.get("Pagination").isEnabled&&this.moveToFullscreen(e.getEditableElement().parentElement.querySelector(".ck-pagination-view"),"pagination-view"),this.moveToFullscreen(e.getEditableElement(),"editable"),this.moveToFullscreen(t.toolbar.element,"toolbar"),t.toolbar.switchBehavior(true===this._editor.config.get("fullscreen.toolbar.shouldNotGroupWhenFull")?"static":"dynamic"),this.getWrapper().setAttribute("dir",t.element.getAttribute("dir")),this.getWrapper().classList.add("ck-rounded-corners"),this._editor.config.get("fullscreen.menuBar.isVisible")&&(t.menuBarView||(t.menuBarView=new I_(this._editor.locale),t.menuBarView.render(),e.initMenuBar(t.menuBarView)),this.moveToFullscreen(t.menuBarView.element,"menu-bar")),this.getWrapper()}}class NP extends MP{_editor;constructor(e){super(e),this._editor=e;}defaultOnEnter(){return this._editor.plugins.has("Pagination")&&this._editor.plugins.get("Pagination").isEnabled&&this.moveToFullscreen(this._editor.ui.getEditableElement().parentElement.querySelector(".ck-pagination-view"),"pagination-view"),this.moveToFullscreen(this._editor.ui.getEditableElement(),"editable"),this.moveToFullscreen(this._editor.ui.view.toolbar.element,"toolbar"),this._editor.ui.view.toolbar.switchBehavior(true===this._editor.config.get("fullscreen.toolbar.shouldNotGroupWhenFull")?"static":"dynamic"),this._editor.config.get("fullscreen.menuBar.isVisible")&&this.moveToFullscreen(this._editor.ui.view.menuBarView.element,"menu-bar"),this.getWrapper()}}class DP extends Ns{fullscreenHandler;constructor(e){super(e),this.affectsData=false,this.isEnabled=true,this.value=false,!function(e){return "ClassicEditor"===e.constructor.editorName}(e)?!function(e){return "DecoupledEditor"===e.constructor.editorName}(e)?this.fullscreenHandler=new MP(e):this.fullscreenHandler=new NP(e):this.fullscreenHandler=new FP(e);}execute(){this.value?this._disableFullscreenMode():this._enableFullscreenMode();}_enableFullscreenMode(){this.fullscreenHandler.enable(),this.value=true;}_disableFullscreenMode(){this.fullscreenHandler.disable(),this.value=false;}}class zP extends Ms{static get pluginName(){return "FullscreenEditing"}static get isOfficialPlugin(){return  true}constructor(e){super(e),e.config.define("fullscreen.menuBar.isVisible",true),e.config.define("fullscreen.toolbar.shouldNotGroupWhenFull",true===e.config.get("toolbar.shouldNotGroupWhenFull"));}init(){this.editor.commands.add("toggleFullscreen",new DP(this.editor));const e=this.editor.locale.t;this.editor.keystrokes.set("Ctrl+Shift+F",(e,t)=>{this.editor.execute("toggleFullscreen"),n.isBlink||(this.editor.editing.view.document.isFocused=false,this.editor.ui.view.toolbar.focusTracker.focusedElement=null),this.editor.editing.view.scrollToTheSelection(),this.editor.editing.view.focus(),t();}),this.editor.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Toggle fullscreen mode"),keystroke:"CTRL+SHIFT+F"}],categoryId:"navigation"});}}const HP="toggleFullscreen";class qP extends Ms{static get requires(){return [zP]}static get pluginName(){return "FullscreenUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor;e.ui.componentFactory.add("fullscreen",()=>this._createButton(Bp)),e.ui.componentFactory.add("menuBar:fullscreen",()=>this._createButton(Jp));}_createButton(e){const t=this.editor,i=t.t,s=t.commands.get(HP),o=new e(t.locale);return o.set({isToggleable:true}),o.bind("isEnabled").to(s,"isEnabled"),o.bind("isOn").to(s,"value"),o instanceof Jp?o.set({role:"menuitemcheckbox",label:i("Fullscreen mode")}):(o.bind("icon").to(s,"value",e=>e?ag:rg),o.bind("label").to(s,"value",e=>i(e?"Leave fullscreen mode":"Enter fullscreen mode")),o.set({tooltip:true})),this.listenTo(o,"execute",()=>{t.execute(HP),n.isBlink||(this.editor.ui.view.toolbar.focusTracker.focusedElement=null),t.editing.view.scrollToTheSelection(),t.editing.view.focus();}),o}}class UP extends Ms{static get requires(){return [zP,qP]}static get pluginName(){return "Fullscreen"}static get isOfficialPlugin(){return  true}}class jP extends Ns{constructor(e){super(e),this._isEnabledBasedOnSelection=false;}refresh(){const e=this.editor.model,t=Cn(e.document.selection.getSelectedBlocks());this.value=!!t&&t.is("element","paragraph"),this.isEnabled=!!t&&$P(t,e.schema);}execute(e={}){const t=this.editor.model,i=t.document,n=e.selection||i.selection;t.canEditAt(n)&&t.change(e=>{const i=n.getSelectedBlocks();for(const n of i)!n.is("element","paragraph")&&$P(n,t.schema)&&e.rename(n,"paragraph");});}}function $P(e,t){return t.checkChild(e.parent,"paragraph")&&!t.isObject(e)}class WP extends Ns{constructor(e){super(e),this._isEnabledBasedOnSelection=false;}execute(e){const t=this.editor.model,i=e.attributes;let n=e.position;return t.canEditAt(n)?t.change(e=>{if(n=this._findPositionToInsertParagraph(n,e),!n)return null;const s=e.createElement("paragraph");return i&&t.schema.setAllowedAttributes(s,i,e),t.insertContent(s,n),e.setSelection(s,"in"),e.createPositionAt(s,0)}):null}_findPositionToInsertParagraph(e,t){const i=this.editor.model;if(i.schema.checkChild(e,"paragraph"))return e;const n=i.schema.findAllowedParent(e,"paragraph");if(!n)return null;const s=e.parent,o=i.schema.checkChild(s,"$text");return s.isEmpty||o&&e.isAtEnd?i.createPositionAfter(s):!s.isEmpty&&o&&e.isAtStart?i.createPositionBefore(s):t.split(e,n).position}}class GP extends Ms{static get pluginName(){return "Paragraph"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.model;e.commands.add("paragraph",new jP(e)),e.commands.add("insertParagraph",new WP(e)),t.schema.register("paragraph",{inheritAllFrom:"$block"}),e.conversion.elementToElement({model:"paragraph",view:"p"}),e.conversion.for("upcast").elementToElement({model:(e,{writer:t})=>GP.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 KP extends Ms{static get requires(){return [GP]}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("paragraph",i=>{const n=new Bp(i),s=e.commands.get("paragraph");return n.label=t("Paragraph"),n.icon=Cf,n.tooltip=true,n.isToggleable=true,n.bind("isEnabled").to(s),n.bind("isOn").to(s,"value"),n.on("execute",()=>{e.execute("paragraph");}),n});}}class JP extends Ns{modelElements;constructor(e,t){super(e),this.modelElements=t;}refresh(){const e=Cn(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some(t=>QP(e,t,this.editor.model.schema));}execute(e){const t=this.editor.model,i=t.document,n=e.value;t.change(e=>{const s=Array.from(i.selection.getSelectedBlocks()).filter(e=>QP(e,n,t.schema));for(const t of s)t.is("element",n)||e.rename(t,n);});}}function QP(e,t,i){return i.checkChild(e.parent,t)&&!i.isObject(e)}const YP="paragraph";class ZP extends Ms{static get pluginName(){return "HeadingEditing"}static get isOfficialPlugin(){return  true}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 [GP]}init(){const e=this.editor,t=e.config.get("heading.options"),i=[];for(const n of t)"paragraph"!==n.model&&(e.model.schema.register(n.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(n),i.push(n.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new JP(e,i));}afterInit(){const e=this.editor,t=e.commands.get("enter"),i=e.config.get("heading.options");t&&this.listenTo(t,"afterExecute",(t,n)=>{const s=e.model.document.selection.getFirstPosition().parent,o=i.some(e=>s.is("element",e.model));o&&!s.is("element",YP)&&0===s.childCount&&n.writer.rename(s,YP);});}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:E.low+1});}}function XP(e){const t=e.t,i={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=i[e.title];return t&&t!=e.title&&(e.title=t),e})}class eV extends Ms{static get pluginName(){return "HeadingUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.t,i=XP(e),n=t("Choose heading"),s=t("Heading");e.ui.componentFactory.add("heading",t=>{const o={},r=new kn,a=e.commands.get("heading"),l=e.commands.get("paragraph"),c=[a];for(const e of i){const t={type:"button",model:new e_({label:e.title,class:e.class,role:"menuitemradio",withText:true})};"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 u=ww(t);return Cw(u,r,{ariaLabel:s,role:"menu"}),u.buttonView.set({ariaLabel:s,ariaLabelledBy:void 0,isOn:false,withText:true,tooltip:s}),u.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),u.bind("isEnabled").toMany(c,"isEnabled",(...e)=>e.some(e=>e)),u.buttonView.bind("label").to(a,"value",l,"value",(e,t)=>{const i=t?"paragraph":e;return "boolean"==typeof i?n:o[i]?o[i]:n}),u.buttonView.bind("ariaLabel").to(a,"value",l,"value",(e,t)=>{const i=t?"paragraph":e;return "boolean"==typeof i?s:o[i]?`${o[i]}, ${s}`:s}),this.listenTo(u,"execute",t=>{const{commandName:i,commandValue:n}=t.source;e.execute(i,n?{value:n}:void 0),e.editing.view.focus();}),u}),e.ui.componentFactory.add("menuBar:heading",n=>{const s=new x_(n),o=e.commands.get("heading"),r=e.commands.get("paragraph"),a=[o],l=new A_(n);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 i){const i=new Av(n,s),c=new Jp(n);i.children.add(c),l.items.add(i),c.set({isToggleable:true,label:t.title,role:"menuitemradio",class:t.class}),c.delegate("execute").to(s),c.on("execute",()=>{const i="paragraph"===t.model?"paragraph":"heading";e.execute(i,{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 tV extends Ms{static get requires(){return [ZP,eV]}static get pluginName(){return "Heading"}static get isOfficialPlugin(){return  true}}const iV=(()=>({heading1:ug,heading2:dg,heading3:hg,heading4:mg,heading5:gg,heading6:fg}))();class nV extends Ms{init(){XP(this.editor).filter(e=>"paragraph"!==e.model).map(e=>this._createButton(e));}_createButton(e){const t=this.editor;t.ui.componentFactory.add(e.model,i=>{const n=new Bp(i),s=t.commands.get("heading");return n.label=e.title,n.icon=e.icon||iV[e.model],n.tooltip=true,n.isToggleable=true,n.bind("isEnabled").to(s),n.bind("isOn").to(s,"value",t=>t==e.model),n.on("execute",()=>{t.execute("heading",{value:e.model}),t.editing.view.focus();}),n});}}const sV=new Set(["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"]);class oV extends Ms{_bodyPlaceholder=new Map;static get pluginName(){return "Title"}static get isOfficialPlugin(){return  true}static get requires(){return [GP]}init(){const e=this.editor,t=e.model;t.schema.register("title",{isBlock:true,allowIn:"$root"}),t.schema.register("title-content",{isBlock:true,allowIn:"title",allowAttributes:["alignment"]}),t.schema.extend("$text",{allowIn:"title-content"}),t.schema.addAttributeCheck(e=>{if(e.endsWith("title-content $text"))return  false}),e.editing.mapper.on("modelToViewPosition",aV(e.editing.view)),e.data.mapper.on("modelToViewPosition",aV(e.editing.view)),e.conversion.for("downcast").elementToElement({model:"title-content",view:"h1"}),e.conversion.for("downcast").add(e=>e.on("insert:title",(e,t,i)=>{i.consumable.consume(t.item,e.name);})),e.data.upcastDispatcher.on("element:h1",rV,{priority:"high"}),e.data.upcastDispatcher.on("element:h2",rV,{priority:"high"}),e.data.upcastDispatcher.on("element:h3",rV,{priority:"high"}),t.document.registerPostFixer(e=>this._fixTitleContent(e)),t.document.registerPostFixer(e=>this._fixTitleElement(e)),t.document.registerPostFixer(e=>this._fixBodyElement(e)),t.document.registerPostFixer(e=>this._fixExtraParagraph(e)),this._attachPlaceholders(),this._attachTabPressHandling();}getTitle(e={}){const t=e.rootName?e.rootName:void 0,i=this._getTitleElement(t).getChild(0);return this.editor.data.stringify(i,e)}getBody(e={}){const t=this.editor,i=t.data,n=t.model,s=e.rootName?e.rootName:void 0,o=t.model.document.getRoot(s),r=t.editing.view,a=new ir(r.document),l=n.createRangeIn(o),c=a.createDocumentFragment(),u=n.createPositionAfter(o.getChild(0)),d=n.createRange(u,n.createPositionAt(o,"end")),h=new Map;for(const e of n.markers){const t=d.getIntersection(e.getRange());t&&h.set(e.name,t);}return i.mapper.clearBindings(),i.mapper.bindElements(o,c),i.downcastDispatcher.convert(l,h,a,e),a.remove(a.createRangeOn(c.getChild(0))),t.data.processor.toData(c)}_getTitleElement(e){const t=this.editor.model.document.getRoot(e);for(const e of t.getChildren())if(lV(e))return e}_fixTitleContent(e){let t=false;for(const i of this.editor.model.document.getRootNames()){const n=this._getTitleElement(i);if(!n||1===n.maxOffset)continue;const s=Array.from(n.getChildren());s.shift();for(const t of s)e.move(e.createRangeOn(t),n,"after"),e.rename(t,"paragraph");t=true;}return t}_fixTitleElement(e){let t=false;const i=this.editor.model;for(const n of this.editor.model.document.getRoots()){const s=Array.from(n.getChildren()).filter(lV),o=s[0],r=n.getChild(0);if(r.is("element","title"))s.length>1&&(uV(s,e,i),t=true);else {if(!o&&!sV.has(r.name)){const i=e.createElement("title");e.insert(i,n),e.insertElement("title-content",i),t=true;continue}sV.has(r.name)?cV(r,e,i):e.move(e.createRangeOn(o),n,0),uV(s,e,i),t=true;}}return t}_fixBodyElement(e){let t=false;for(const i of this.editor.model.document.getRootNames()){const n=this.editor.model.document.getRoot(i);if(n.childCount<2){const s=e.createElement("paragraph");e.insert(s,n,1),this._bodyPlaceholder.set(i,s),t=true;}}return t}_fixExtraParagraph(e){let t=false;for(const i of this.editor.model.document.getRootNames()){const n=this.editor.model.document.getRoot(i),s=this._bodyPlaceholder.get(i);hV(s,n)&&(this._bodyPlaceholder.delete(i),e.remove(s),t=true);}return t}_attachPlaceholders(){const e=this.editor,t=e.t,i=e.editing.view,n=e.sourceElement,s=e.config.get("title.placeholder")||t("Type your title");e.editing.downcastDispatcher.on("insert:title-content",(e,t,n)=>{const o=n.mapper.toViewElement(t.item);o.placeholder=s,Ks({view:i,element:o,keepOnFocus:true});});const o=new Map;i.document.registerPostFixer(s=>{let r=false;for(const a of i.document.roots){if(a.isEmpty)continue;const i=a.getChild(1),l=o.get(a.rootName);if(i!==l){l&&(Ys(s,l),s.removeAttribute("data-placeholder",l));const c=e.config.get("roots")[a.rootName]?.placeholder||mV(n)&&n.getAttribute("placeholder")||t("Type or paste your content here.");s.setAttribute("data-placeholder",c,i),o.set(a.rootName,i),r=true;}r=Zs(i,true)&&2===a.childCount&&"p"===i.name?!!Qs(s,i)||r:!!Ys(s,i)||r;}return r});}_attachTabPressHandling(){const e=this.editor,t=e.model;e.keystrokes.set("TAB",(e,i)=>{t.change(e=>{const n=t.document.selection,s=Array.from(n.getSelectedBlocks());if(1===s.length&&s[0].is("element","title-content")){const t=n.getFirstPosition().root.getChild(1);e.setSelection(t,0),i();}});}),e.keystrokes.set("SHIFT + TAB",(i,n)=>{t.change(i=>{const s=t.document.selection;if(!s.isCollapsed)return;const o=Cn(s.getSelectedBlocks()),r=s.getFirstPosition(),a=e.model.document.getRoot(r.root.rootName),l=a.getChild(0);o===a.getChild(1)&&r.isAtStart&&(i.setSelection(l.getChild(0),0),n());});});}}function rV(e,t,i){const n=t.modelCursor,s=t.viewItem;if(!n.isAtStart||!n.parent.is("element","$root"))return;if(!i.consumable.consume(s,{name:true}))return;const o=i.writer,r=o.createElement("title"),a=o.createElement("title-content");o.append(a,r),o.insert(r,n),i.convertChildren(s,a),i.updateConversionResult(r,t);}function aV(e){return (t,i)=>{const n=i.modelPosition.parent;if(!n.is("element","title"))return;const s=n.parent,o=i.mapper.toViewElement(s);i.viewPosition=e.createPositionAt(o,0),t.stop();}}function lV(e){return e.is("element","title")}function cV(e,t,i){const n=t.createElement("title");t.insert(n,e,"before"),t.insert(e,n,0),t.rename(e,"title-content"),i.schema.removeDisallowedAttributes([e],t);}function uV(e,t,i){let n=false;for(const s of e)0!==s.index&&(dV(s,t,i),n=true);return n}function dV(e,t,i){const n=e.getChild(0);n.isEmpty?t.remove(e):(t.move(t.createRangeOn(n),e,"before"),t.rename(n,"paragraph"),t.remove(e),i.schema.removeDisallowedAttributes([n],t));}function hV(e,t){return !(!e||!e.is("element","paragraph")||e.childCount)&&!(t.childCount<=2||t.getChild(t.childCount-1)!==e)}function mV(e){return !!e&&"textarea"===e.tagName.toLowerCase()}class gV extends Ns{refresh(){const e=this.editor.model,t=e.document;this.value=t.selection.getAttribute("highlight"),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"highlight");}execute(e={}){const t=this.editor.model,i=t.document.selection,n=e.value;t.change(e=>{if(i.isCollapsed){const t=i.getFirstPosition();if(i.hasAttribute("highlight")){const i=e=>e.item.hasAttribute("highlight")&&e.item.getAttribute("highlight")===this.value,s=t.getLastMatchingPosition(i,{direction:"backward"}),o=t.getLastMatchingPosition(i),r=e.createRange(s,o);n&&this.value!==n?(t.isEqual(o)||e.setAttribute("highlight",n,r),e.setSelectionAttribute("highlight",n)):(t.isEqual(o)||e.removeAttribute("highlight",r),e.removeSelectionAttribute("highlight"));}else n&&e.setSelectionAttribute("highlight",n);}else {const s=t.schema.getValidRanges(i.getRanges(),"highlight",{includeEmptyRanges:true});for(const t of s){let i=t,s="highlight";t.isCollapsed&&(i=t.start.parent,s=Oa._getStoreAttributeKey("highlight")),n?e.setAttribute(s,n,i):e.removeAttribute(s,i);}}});}}class fV extends Ms{static get pluginName(){return "HighlightEditing"}static get isOfficialPlugin(){return  true}constructor(e){super(e),e.config.define("highlight",{options:[{model:"yellowMarker",class:"marker-yellow",title:"Yellow marker",color:"var(--ck-content-highlight-marker-yellow)",type:"marker"},{model:"greenMarker",class:"marker-green",title:"Green marker",color:"var(--ck-content-highlight-marker-green)",type:"marker"},{model:"pinkMarker",class:"marker-pink",title:"Pink marker",color:"var(--ck-content-highlight-marker-pink)",type:"marker"},{model:"blueMarker",class:"marker-blue",title:"Blue marker",color:"var(--ck-content-highlight-marker-blue)",type:"marker"},{model:"redPen",class:"pen-red",title:"Red pen",color:"var(--ck-content-highlight-pen-red)",type:"pen"},{model:"greenPen",class:"pen-green",title:"Green pen",color:"var(--ck-content-highlight-pen-green)",type:"pen"}]});}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"highlight"});const t=e.config.get("highlight.options");e.conversion.attributeToElement(function(e){const t={model:{key:"highlight",values:[]},view:{}};for(const i of e)t.model.values.push(i.model),t.view[i.model]={name:"mark",classes:i.class};return t}(t)),e.commands.add("highlight",new gV(e));}}class pV extends Ms{get localizedOptionTitles(){const e=this.editor.t;return {"Yellow marker":e("Yellow marker"),"Green marker":e("Green marker"),"Pink marker":e("Pink marker"),"Blue marker":e("Blue marker"),"Red pen":e("Red pen"),"Green pen":e("Green pen")}}static get pluginName(){return "HighlightUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor.config.get("highlight.options");for(const t of e)this._addHighlighterButton(t);this._addRemoveHighlightButton(),this._addDropdown(e),this._addMenuBarButton(e);}_addRemoveHighlightButton(){const e=this.editor.t,t=this.editor.commands.get("highlight");this._addButton("removeHighlight",e("Remove highlight"),Wm,null,e=>{e.bind("isEnabled").to(t,"isEnabled");});}_addHighlighterButton(e){const t=this.editor.commands.get("highlight");this._addButton("highlight:"+e.model,e.title,bV(e.type),e.model,function(i){i.bind("isEnabled").to(t,"isEnabled"),i.bind("isOn").to(t,"value",t=>t===e.model),i.iconView.fillColor=e.color,i.isToggleable=true;});}_addButton(e,t,i,n,s){const o=this.editor;o.ui.componentFactory.add(e,e=>{const r=new Bp(e),a=this.localizedOptionTitles[t]?this.localizedOptionTitles[t]:t;return r.set({label:a,icon:i,tooltip:true}),r.on("execute",()=>{o.execute("highlight",{value:n}),o.editing.view.focus();}),s(r),r});}_addDropdown(e){const t=this.editor,i=t.t,n=t.ui.componentFactory,s=e[0],o=e.reduce((e,t)=>(e[t.model]=t,e),{});n.add("highlight",r=>{const a=t.commands.get("highlight"),l=ww(r,bw),c=l.buttonView;c.set({label:i("Highlight"),tooltip:true,lastExecuted:s.model,commandValue:s.model,isToggleable:true}),c.bind("icon").to(a,"value",e=>bV(u(e,"type"))),c.bind("color").to(a,"value",e=>u(e,"color")),c.bind("commandValue").to(a,"value",e=>u(e,"model")),c.bind("isOn").to(a,"value",e=>!!e),c.delegate("execute").to(l);function u(e,t){const i=e&&e!==c.lastExecuted?e:c.lastExecuted;return o[i][t]}return l.bind("isEnabled").to(a,"isEnabled"),yw(l,()=>{const t=e.map(e=>{const t=n.create("highlight:"+e.model);return this.listenTo(t,"execute",()=>{l.buttonView.set({lastExecuted:e.model});}),t});return t.push(new lw),t.push(n.create("removeHighlight")),t},{enableActiveItemFocusOnDropdownOpen:true,ariaLabel:i("Text highlight toolbar")}),function(e){const t=e.buttonView.actionView;t.iconView.bind("fillColor").to(e.buttonView,"color");}(l),c.on("execute",()=>{t.execute("highlight",{value:c.commandValue});}),this.listenTo(l,"execute",()=>{t.editing.view.focus();}),l});}_addMenuBarButton(e){const t=this.editor,i=t.t,n=t.commands.get("highlight");t.ui.componentFactory.add("menuBar:highlight",s=>{const o=new x_(s);o.buttonView.set({label:i("Highlight"),icon:bV("marker")}),o.bind("isEnabled").to(n),o.buttonView.iconView.fillColor="transparent";const r=new A_(s);for(const i of e){const e=new Av(s,o),a=new Jp(s);a.set({label:i.title,icon:bV(i.type),role:"menuitemradio",isToggleable:true}),a.iconView.fillColor=i.color,a.delegate("execute").to(o),a.bind("isOn").to(n,"value",e=>e===i.model),a.on("execute",()=>{t.execute("highlight",{value:i.model}),t.editing.view.focus();}),e.children.add(a),r.items.add(e);}r.items.add(new Yb(s));const a=new Av(s,o),l=new Jp(s);return l.set({label:i("Remove highlight"),icon:Wm}),l.delegate("execute").to(o),l.on("execute",()=>{t.execute("highlight",{value:null}),t.editing.view.focus();}),a.children.add(l),r.items.add(a),o.panelView.children.add(r),o});}}function bV(e){return "marker"===e?Wg:Af}class wV extends Ms{static get requires(){return [fV,pV]}static get pluginName(){return "Highlight"}static get isOfficialPlugin(){return  true}}class vV extends Ns{refresh(){const e=this.editor.model,t=e.schema,i=e.document.selection;this.isEnabled=function(e,t,i){const n=function(e,t){const i=sC(e,t),n=i.start.parent;if(n.isEmpty&&!n.is("element","$root"))return n.parent;return n}(e,i);return t.checkChild(n,"horizontalLine")}(i,t,e);}execute(){const e=this.editor.model;e.change(t=>{const i=t.createElement("horizontalLine");e.insertObject(i,null,null,{setSelection:"after"});});}}class _V extends Ms{static get pluginName(){return "HorizontalLineEditing"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.model.schema,i=e.t,n=e.conversion;t.register("horizontalLine",{inheritAllFrom:"$blockObject"}),n.for("dataDowncast").elementToElement({model:"horizontalLine",view:(e,{writer:t})=>t.createEmptyElement("hr")}),n.for("editingDowncast").elementToStructure({model:"horizontalLine",view:(e,{writer:t})=>{const n=i("Horizontal line"),s=t.createContainerElement("div",null,t.createEmptyElement("hr"));return t.addClass("ck-horizontal-line",s),t.setCustomProperty("hr",true,s),function(e,t,i){return t.setCustomProperty("horizontalLine",true,e),Yk(e,t,{label:i})}(s,t,n)}}),n.for("upcast").elementToElement({view:"hr",model:"horizontalLine"}),e.commands.add("horizontalLine",new vV(e));}}class yV extends Ms{static get pluginName(){return "HorizontalLineUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor;e.ui.componentFactory.add("horizontalLine",()=>{const e=this._createButton(Bp);return e.set({tooltip:true}),e}),e.ui.componentFactory.add("menuBar:horizontalLine",()=>this._createButton(Jp));}_createButton(e){const t=this.editor,i=t.locale,n=t.commands.get("horizontalLine"),s=new e(t.locale),o=i.t;return s.set({label:o("Horizontal line"),icon:bg}),s.bind("isEnabled").to(n,"isEnabled"),this.listenTo(s,"execute",()=>{t.execute("horizontalLine"),t.editing.view.focus();}),s}}class kV extends Ms{static get requires(){return [_V,yV,kC]}static get pluginName(){return "HorizontalLine"}static get isOfficialPlugin(){return  true}}class CV extends Ns{refresh(){const e=this.editor.model,t=e.schema,i=e.document.selection,n=xV(i);this.isEnabled=function(e,t,i){const n=function(e,t){const i=sC(e,t),n=i.start.parent;if(n.isEmpty&&!n.is("rootElement"))return n.parent;return n}(e,i);return t.checkChild(n,"rawHtml")}(i,t,e),this.value=n?n.getAttribute("value")||"":null;}execute(e){const t=this.editor.model,i=t.document.selection;t.change(n=>{let s;null!==this.value?s=xV(i):(s=n.createElement("rawHtml"),t.insertObject(s,null,null,{setSelection:"on"})),n.setAttribute("value",e,s);});}}function xV(e){const t=e.getSelectedElement();return t&&t.is("element","rawHtml")?t:null}class AV extends Ms{_widgetButtonViewReferences=new Set;static get pluginName(){return "HtmlEmbedEditing"}static get licenseFeatureCode(){return "HE"}static get isOfficialPlugin(){return  true}static get isPremiumPlugin(){return  true}constructor(e){super(e),e.config.define("htmlEmbed",{showPreviews:false,sanitizeHtml:e=>(P("html-embed-provide-sanitize-function"),{html:e,hasChanged:false})});}init(){const e=this.editor;e.model.schema.register("rawHtml",{inheritAllFrom:"$blockObject",allowAttributes:["value"]}),e.commands.add("htmlEmbed",new CV(e)),this._setupConversion();}_setupConversion(){const e=this.editor,t=e.t,i=e.editing.view,n=this._widgetButtonViewReferences,s=e.config.get("htmlEmbed");function o({editor:e,domElement:i,state:s,props:o}){i.textContent="";const a=i.ownerDocument;let l;if(s.isEditable){const e={isDisabled:false,placeholder:o.textareaPlaceholder};l=r({domDocument:a,state:s,props:e}),i.append(l);}else if(s.showPreviews){const n={sanitizeHtml:o.sanitizeHtml};i.append(function({editor:e,domDocument:i,state:n,props:s}){const o=s.sanitizeHtml(n.getRawHtmlValue()),r=n.getRawHtmlValue().length>0?t("No preview available"):t("Empty snippet content"),a=ii(i,"div",{class:"ck ck-reset_all raw-html-embed__preview-placeholder"},r),l=ii(i,"div",{class:"raw-html-embed__preview-content",dir:e.locale.contentLanguageDirection}),c=i.createRange(),u=c.createContextualFragment(o.html);l.appendChild(u);const d=ii(i,"div",{class:"raw-html-embed__preview"},[a,l]);return d}({domDocument:a,state:s,props:n,editor:e}));}else {const e={isDisabled:true,placeholder:o.textareaPlaceholder};i.append(r({domDocument:a,state:s,props:e}));}const c={onEditClick:o.onEditClick,onSaveClick:()=>{o.onSaveClick(l.value);},onCancelClick:o.onCancelClick};i.prepend(function({editor:e,domDocument:t,state:i,props:s}){const o=ii(t,"div",{class:"raw-html-embed__buttons-wrapper"});if(i.isEditable){const t=EV(e,"save",s.onSaveClick),i=EV(e,"cancel",s.onCancelClick);o.append(t.element,i.element),n.add(t).add(i);}else {const t=EV(e,"edit",s.onEditClick);o.append(t.element),n.add(t);}return o}({editor:e,domDocument:a,state:s,props:c}));}function r({domDocument:e,state:t,props:i}){const n=ii(e,"textarea",{placeholder:i.placeholder,class:"ck ck-reset ck-input ck-input-text raw-html-embed__source"});return n.disabled=i.isDisabled,n.value=t.getRawHtmlValue(),n}this.editor.editing.view.on("render",()=>{for(const e of n){if(e.element&&e.element.isConnected)return;e.destroy(),n.delete(e);}},{priority:"lowest"}),e.data.registerRawContentMatcher({name:"div",classes:"raw-html-embed"}),e.conversion.for("upcast").elementToElement({view:{name:"div",classes:"raw-html-embed"},model:(e,{writer:t})=>t.createElement("rawHtml",{value:e.getCustomProperty("$rawContent")})}),e.conversion.for("dataDowncast").elementToElement({model:"rawHtml",view:(e,{writer:t})=>t.createRawElement("div",{class:"raw-html-embed"},function(t){t.innerHTML=e.getAttribute("value")||"";})}),e.conversion.for("editingDowncast").elementToStructure({model:{name:"rawHtml",attributes:["value"]},view:(n,{writer:r})=>{let a,l,c;const u=r.createRawElement("div",{class:"raw-html-embed__content-wrapper"},function(t){a=t,o({editor:e,domElement:t,state:l,props:c}),a.addEventListener("mousedown",()=>{if(l.isEditable){const t=e.model;t.document.selection.getSelectedElement()!==n&&t.change(e=>e.setSelection(n,"on"));}},true);}),d={makeEditable(){l=Object.assign({},l,{isEditable:true}),o({domElement:a,editor:e,state:l,props:c}),i.change(e=>{e.setAttribute("data-cke-ignore-events","true",u);}),a.querySelector("textarea").focus();},save(t){t!==l.getRawHtmlValue()?(e.execute("htmlEmbed",t),e.editing.view.focus()):this.cancel();},cancel(){l=Object.assign({},l,{isEditable:false}),o({domElement:a,editor:e,state:l,props:c}),e.editing.view.focus(),i.change(e=>{e.removeAttribute("data-cke-ignore-events",u);});}};l={showPreviews:s.showPreviews,isEditable:false,getRawHtmlValue:()=>n.getAttribute("value")||""},c={sanitizeHtml:s.sanitizeHtml,textareaPlaceholder:t("Paste raw HTML here..."),onEditClick(){d.makeEditable();},onSaveClick(e){d.save(e);},onCancelClick(){d.cancel();}};const h=r.createContainerElement("div",{class:"raw-html-embed","data-html-embed-label":t("HTML snippet"),dir:e.locale.uiLanguageDirection},u);return r.setCustomProperty("rawHtmlApi",d,h),r.setCustomProperty("rawHtml",true,h),Yk(h,r,{label:t("HTML snippet"),hasSelectionHandle:true})}});}}function EV(e,t,i){const{t:n}=e.locale,s=new Bp(e.locale),o=e.commands.get("htmlEmbed");return s.set({class:`raw-html-embed__${t}-button`,icon:xf,tooltip:true,tooltipPosition:"rtl"===e.locale.uiLanguageDirection?"e":"w"}),s.render(),"edit"===t?(s.set({icon:xf,label:n("Edit source")}),s.bind("isEnabled").to(o)):"save"===t?(s.set({icon:vm,label:n("Save changes")}),s.bind("isEnabled").to(o)):s.set({icon:pm,label:n("Cancel")}),s.on("execute",i),s}class TV extends Ms{static get pluginName(){return "HtmlEmbedUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.locale.t;e.ui.componentFactory.add("htmlEmbed",()=>{const e=this._createButton(Bp);return e.set({tooltip:true,label:t("Insert HTML")}),e}),e.ui.componentFactory.add("menuBar:htmlEmbed",()=>{const e=this._createButton(Jp);return e.set({label:t("HTML snippet")}),e});}_createButton(e){const t=this.editor,i=t.commands.get("htmlEmbed"),n=new e(t.locale);return n.set({icon:wg}),n.bind("isEnabled").to(i,"isEnabled"),this.listenTo(n,"execute",()=>{t.execute("htmlEmbed"),t.editing.view.focus();t.editing.view.document.selection.getSelectedElement().getCustomProperty("rawHtmlApi").makeEditable();}),n}}class SV extends Ms{static get requires(){return [AV,TV,kC]}static get pluginName(){return "HtmlEmbed"}static get isOfficialPlugin(){return  true}}function IV(e,t,i,n){t&&VV(e,t,n),i&&PV(e,i,n);}function PV(e,t,i){if(t.attributes)for(const[n,s]of Object.entries(t.attributes))e.setAttribute(n,s,i);t.styles&&e.setStyle(t.styles,i),t.classes&&e.addClass(t.classes,i);}function VV(e,t,i){if(t.attributes)for(const[n]of Object.entries(t.attributes))e.removeAttribute(n,i);if(t.styles)for(const n of Object.keys(t.styles))e.removeStyle(n,i);t.classes&&e.removeClass(t.classes,i);}function RV(e,t){const i=De(e);let n="attributes";for(n in t)i[n]="classes"==n?Array.from(new Set([...e[n]||[],...t[n]])):{...e[n],...t[n]};return i}function OV(e,t,i,n,s){const o=t.getAttribute(i),r={};for(const e of ["attributes","styles","classes"]){if(e!=n){o&&o[e]&&(r[e]=o[e]);continue}if("classes"==n){const t=new Set(o&&o.classes||[]);s(t),t.size&&(r[e]=Array.from(t));continue}const t=new Map(Object.entries(o&&o[e]||{}));s(t),t.size&&(r[e]=Object.fromEntries(t));}Object.keys(r).length?t.is("documentSelection")?e.setSelectionAttribute(i,r):e.setAttribute(i,r,t):o&&(t.is("documentSelection")?e.removeSelectionAttribute(i):e.removeAttribute(i,t));}function BV(e,t,i){for(const n of t.getItems({shallow:true})){const t=n.getAttribute(e);t&&t.attributes&&Object.keys(t.attributes).length?Object.keys(t).length>1&&i.setAttribute(e,{attributes:t.attributes},n):i.removeAttribute(e,n);}}function LV(e){return Ft(e).replace(/ /g,"")}function MV(e){return `html${LV(e)}Attributes`}function FV({model:e}){return (t,i)=>i.writer.createElement(e,{htmlContent:t.getCustomProperty("$rawContent")})}function NV(e,{view:t,isInline:i}){const n=e.t;return (e,{writer:s})=>{const o=n("HTML object"),r=DV(t,e,s),a=e.getAttribute(MV(t));s.addClass("html-object-embed__content",r),a&&PV(s,a,r);return Yk(s.createContainerElement(i?"span":"div",{class:"html-object-embed","data-html-object-embed-label":o},r),s,{label:o})}}function DV(e,t,i){return i.createRawElement(e,null,(e,i)=>{i.setContentOf(e,t.getAttribute("htmlContent"));})}function zV({view:e,model:t,allowEmpty:i},n){return t=>{t.on(`element:${e}`,(e,t,o)=>{let r=n.processViewAttributes(t.viewItem,o);if(r||o.consumable.test(t.viewItem,{name:true})){if(r=r||{},o.consumable.consume(t.viewItem,{name:true}),t.modelRange||(t=Object.assign(t,o.convertChildren(t.viewItem,t.modelCursor))),i&&t.modelRange.isCollapsed&&Object.keys(r).length){const e=o.writer.createElement("htmlEmptyElement");if(!o.safeInsert(e,t.modelCursor))return;const i=o.getSplitParts(e);return t.modelRange=o.writer.createRange(t.modelRange.start,o.writer.createPositionAfter(i[i.length-1])),o.updateConversionResult(e,t),void s(e,r,o)}for(const e of t.modelRange.getItems())s(e,r,o);}},{priority:"low"});};function s(e,i,n){if(n.schema.checkAttribute(e,t)){const s=RV(i,e.getAttribute(t)||{});n.writer.setAttribute(t,s,e);}}}function HV({model:e,view:t},i){return (n,{writer:s,consumable:o})=>{if(!n.hasAttribute(e))return null;const r=s.createContainerElement(t),a=n.getAttribute(e);return o.consume(n,`attribute:${e}`),PV(s,a,r),r.getFillerOffset=()=>null,i?Yk(r,s):r}}function qV({priority:e,view:t}){return (i,n)=>{if(!i)return;const{writer:s}=n,o=s.createAttributeElement(t,null,{priority:e});return PV(s,i,o),o}}function UV({view:e},t){return i=>{i.on(`element:${e}`,(e,i,n)=>{if(!i.modelRange||i.modelRange.isCollapsed)return;const s=t.processViewAttributes(i.viewItem,n);s&&n.writer.setAttribute(MV(i.viewItem.name),s,i.modelRange);},{priority:"low"});}}function jV({view:e,model:t}){return i=>{i.on(`attribute:${MV(e)}:${t}`,(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const{attributeOldValue:n,attributeNewValue:s}=t;IV(i.writer,n,s,i.mapper.toViewElement(t.item));});}}const $V={block:[{model:"codeBlock",view:"pre"},{model:"paragraph",view:"p"},{model:"blockQuote",view:"blockquote"},{model:"listItem",view:"li"},{model:"pageBreak",view:"div"},{model:"rawHtml",view:"div"},{model:"table",view:"table"},{model:"tableRow",view:"tr"},{model:"tableCell",view:"td"},{model:"tableCell",view:"th"},{model:"tableColumnGroup",view:"colgroup"},{model:"tableColumn",view:"col"},{model:"caption",view:"caption"},{model:"caption",view:"figcaption"},{model:"imageBlock",view:"img"},{model:"imageInline",view:"img"},{model:"horizontalLine",view:"hr"},{model:"htmlP",view:"p",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlBlockquote",view:"blockquote",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlTable",view:"table",modelSchema:{allowWhere:"$block",isBlock:true}},{model:"htmlTbody",view:"tbody",modelSchema:{allowIn:"htmlTable",isBlock:false}},{model:"htmlThead",view:"thead",modelSchema:{allowIn:"htmlTable",isBlock:false}},{model:"htmlTfoot",view:"tfoot",modelSchema:{allowIn:"htmlTable",isBlock:false}},{model:"htmlCaption",view:"caption",modelSchema:{allowIn:"htmlTable",allowChildren:"$text",isBlock:false}},{model:"htmlColgroup",view:"colgroup",modelSchema:{allowIn:"htmlTable",allowChildren:"col",isBlock:false}},{model:"htmlCol",view:"col",modelSchema:{allowIn:"htmlColgroup",isBlock:false}},{model:"htmlTr",view:"tr",modelSchema:{allowIn:["htmlTable","htmlThead","htmlTbody","htmlTfoot"],isLimit:true}},{model:"htmlTd",view:"td",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:true,isBlock:false}},{model:"htmlTh",view:"th",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:true,isBlock:false}},{model:"htmlFigure",view:"figure",modelSchema:{inheritAllFrom:"$container",isBlock:false}},{model:"htmlFigcaption",view:"figcaption",modelSchema:{allowIn:"htmlFigure",allowChildren:"$text",isBlock:false}},{model:"htmlAddress",view:"address",modelSchema:{inheritAllFrom:"$container",isBlock:false}},{model:"htmlAside",view:"aside",modelSchema:{inheritAllFrom:"$container",isBlock:false}},{model:"htmlMain",view:"main",modelSchema:{inheritAllFrom:"$container",isBlock:false}},{model:"htmlDetails",view:"details",modelSchema:{inheritAllFrom:"$container",isBlock:false}},{model:"htmlSummary",view:"summary",modelSchema:{allowChildren:["htmlH1","htmlH2","htmlH3","htmlH4","htmlH5","htmlH6","$text"],allowIn:"htmlDetails",isBlock:false}},{model:"htmlDiv",view:"div",paragraphLikeModel:"htmlDivParagraph",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlFieldset",view:"fieldset",modelSchema:{inheritAllFrom:"$container",isBlock:false}},{model:"htmlLegend",view:"legend",modelSchema:{allowIn:"htmlFieldset",allowChildren:"$text"}},{model:"htmlHeader",view:"header",modelSchema:{inheritAllFrom:"$container",isBlock:false}},{model:"htmlFooter",view:"footer",modelSchema:{inheritAllFrom:"$container",isBlock:false}},{model:"htmlForm",view:"form",modelSchema:{inheritAllFrom:"$container",isBlock:true}},{model:"htmlHgroup",view:"hgroup",modelSchema:{allowIn:["$root","$container"],allowChildren:["paragraph","htmlP","htmlH1","htmlH2","htmlH3","htmlH4","htmlH5","htmlH6"],isBlock:false}},{model:"htmlH1",view:"h1",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH2",view:"h2",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH3",view:"h3",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH4",view:"h4",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH5",view:"h5",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH6",view:"h6",modelSchema:{inheritAllFrom:"$block"}},{model:"$htmlList",modelSchema:{allowWhere:"$container",allowChildren:["$htmlList","htmlLi"],isBlock:false}},{model:"htmlDir",view:"dir",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlMenu",view:"menu",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlUl",view:"ul",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlOl",view:"ol",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlLi",view:"li",modelSchema:{allowIn:"$htmlList",allowChildren:"$text",isBlock:false}},{model:"htmlPre",view:"pre",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlArticle",view:"article",modelSchema:{inheritAllFrom:"$container",isBlock:false}},{model:"htmlSection",view:"section",modelSchema:{inheritAllFrom:"$container",isBlock:false}},{model:"htmlNav",view:"nav",modelSchema:{inheritAllFrom:"$container",isBlock:false}},{model:"htmlDl",view:"dl",modelSchema:{allowWhere:"$container",allowChildren:["htmlDt","htmlDd","htmlDiv"],isBlock:false}},{model:"htmlDt",view:"dt",modelSchema:{allowChildren:"$block",allowIn:"htmlDiv",isBlock:false}},{model:"htmlDd",view:"dd",modelSchema:{allowChildren:"$block",allowIn:"htmlDiv",isBlock:false}},{model:"htmlCenter",view:"center",modelSchema:{inheritAllFrom:"$container",isBlock:false}},{model:"htmlHr",view:"hr",isEmpty:true,modelSchema:{inheritAllFrom:"$blockObject"}}],inline:[{model:"htmlLiAttributes",view:"li",appliesToBlock:true,coupledAttribute:"listItemId"},{model:"htmlOlAttributes",view:"ol",appliesToBlock:true,coupledAttribute:"listItemId"},{model:"htmlUlAttributes",view:"ul",appliesToBlock:true,coupledAttribute:"listItemId"},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"table"},{model:"htmlTheadAttributes",view:"thead",appliesToBlock:"table"},{model:"htmlTfootAttributes",view:"tfoot",appliesToBlock:"table"},{model:"htmlTbodyAttributes",view:"tbody",appliesToBlock:"table"},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"imageBlock"},{model:"htmlAcronym",view:"acronym",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlTt",view:"tt",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlFont",view:"font",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlTime",view:"time",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlVar",view:"var",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlBig",view:"big",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlSmall",view:"small",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlSamp",view:"samp",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlQ",view:"q",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlOutput",view:"output",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlKbd",view:"kbd",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlBdi",view:"bdi",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlBdo",view:"bdo",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlAbbr",view:"abbr",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlA",view:"a",priority:5,coupledAttribute:"linkHref",attributeProperties:{isFormatting:true}},{model:"htmlStrong",view:"strong",coupledAttribute:"bold",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlB",view:"b",coupledAttribute:"bold",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlI",view:"i",coupledAttribute:"italic",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlEm",view:"em",coupledAttribute:"italic",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlS",view:"s",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlDel",view:"del",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlIns",view:"ins",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlU",view:"u",coupledAttribute:"underline",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlSub",view:"sub",coupledAttribute:"subscript",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlSup",view:"sup",coupledAttribute:"superscript",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlCode",view:"code",coupledAttribute:"code",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlMark",view:"mark",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlSpan",view:"span",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlCite",view:"cite",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlLabel",view:"label",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlDfn",view:"dfn",attributeProperties:{copyOnEnter:true,isFormatting:true}},{model:"htmlObject",view:"object",isObject:true,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlIframe",view:"iframe",isObject:true,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlInput",view:"input",isObject:true,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlButton",view:"button",isObject:true,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlTextarea",view:"textarea",isObject:true,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlSelect",view:"select",isObject:true,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlVideo",view:"video",isObject:true,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlEmbed",view:"embed",isObject:true,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlOembed",view:"oembed",isObject:true,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlAudio",view:"audio",isObject:true,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlImg",view:"img",isObject:true,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlCanvas",view:"canvas",isObject:true,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlMeter",view:"meter",isObject:true,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlProgress",view:"progress",isObject:true,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlScript",view:"script",modelSchema:{allowWhere:["$text","$block"],isInline:true}},{model:"htmlStyle",view:"style",modelSchema:{allowWhere:["$text","$block"],isInline:true}},{model:"htmlCustomElement",view:"$customElement",modelSchema:{allowWhere:["$text","$block"],allowAttributesOf:"$inlineObject",isInline:true}}]};class WV extends Ms{_definitions=[];static get pluginName(){return "DataSchema"}static get isOfficialPlugin(){return  true}init(){for(const e of $V.block)this.registerBlockElement(e);for(const e of $V.inline)this.registerInlineElement(e);}registerBlockElement(e){this._definitions.push({...e,isBlock:true});}registerInlineElement(e){this._definitions.push({...e,isInline:true});}extendBlockElement(e){this._extendDefinition({...e,isBlock:true});}extendInlineElement(e){this._extendDefinition({...e,isInline:true});}getDefinitionsForView(e,t=false){const i=new Set;for(const n of this._getMatchingViewDefinitions(e)){if(t)for(const e of this._getReferences(n.model))i.add(e);i.add(n);}return i}getDefinitionsForModel(e){return this._definitions.filter(t=>t.model==e)}_getMatchingViewDefinitions(e){return this._definitions.filter(t=>t.view&&function(e,t){if("string"==typeof e)return e===t;if(e instanceof RegExp)return e.test(t);return  false}(e,t.view))}*_getReferences(e){const t=["inheritAllFrom","inheritTypesFrom","allowWhere","allowContentOf","allowAttributesOf"],i=this._definitions.filter(t=>t.model==e);for(const{modelSchema:n}of i)if(n)for(const i of t)for(const t of pn(n[i]||[])){const i=this._definitions.filter(e=>e.model==t);for(const n of i)t!==e&&(yield*this._getReferences(n.model),yield n);}}_extendDefinition(e){const t=Array.from(this._definitions.entries()).filter(([,t])=>t.model==e.model);if(0!=t.length)for(const[i,n]of t)this._definitions[i]=Ct({},n,e,(e,t)=>Array.isArray(e)?e.concat(t):void 0);else this._definitions.push(e);}}class GV extends Ms{_dataSchema;_allowedAttributes;_disallowedAttributes;_allowedElements;_disallowedElements;_dataInitialized;_coupledAttributes;constructor(e){super(e),this._dataSchema=e.plugins.get("DataSchema"),this._allowedAttributes=new uo,this._disallowedAttributes=new uo,this._allowedElements=new Set,this._disallowedElements=new Set,this._dataInitialized=false,this._coupledAttributes=null,this._registerElementsAfterInit(),this._registerElementHandlers(),this._registerCoupledAttributesPostFixer(),this._registerAssociatedHtmlAttributesPostFixer();}static get pluginName(){return "DataFilter"}static get isOfficialPlugin(){return  true}static get requires(){return [WV,kC]}loadAllowedConfig(e){for(const t of e){const e=t.name||/[\s\S]+/,i=ZV(t);this.allowElement(e),i.forEach(e=>this.allowAttributes(e));}}loadDisallowedConfig(e){for(const t of e){const e=t.name||/[\s\S]+/,i=ZV(t);0==i.length?this.disallowElement(e):i.forEach(e=>this.disallowAttributes(e));}}loadAllowedEmptyElementsConfig(e){for(const t of e)this.allowEmptyElement(t);}allowElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,true))this._addAllowedElement(t),this._coupledAttributes=null;}disallowElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,false))this._disallowedElements.add(t.view);}allowEmptyElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,true))t.isInline&&this._dataSchema.extendInlineElement({...t,allowEmpty:true});}allowAttributes(e){this._allowedAttributes.add(e);}disallowAttributes(e){this._disallowedAttributes.add(e);}processViewAttributes(e,t){const{consumable:i}=t;return KV(e,this._disallowedAttributes,i),function(e,{attributes:t,classes:i,styles:n}){if(!t.length&&!i.length&&!n.length)return null;return {...t.length&&{attributes:JV(e,t)},...n.length&&{styles:QV(e,n)},...i.length&&{classes:i}}}(e,KV(e,this._allowedAttributes,i))}_addAllowedElement(e){if(!this._allowedElements.has(e)){if(this._allowedElements.add(e),"appliesToBlock"in e&&"string"==typeof e.appliesToBlock)for(const t of this._dataSchema.getDefinitionsForModel(e.appliesToBlock))t.isBlock&&this._addAllowedElement(t);this._dataInitialized&&this.editor.data.once("set",()=>{this._fireRegisterEvent(e);},{priority:E.highest+1});}}_registerElementsAfterInit(){this.editor.data.on("init",()=>{this._dataInitialized=true;for(const e of this._allowedElements)this._fireRegisterEvent(e);},{priority:E.highest+1});}_registerElementHandlers(){this.on("register",(e,t)=>{const i=this.editor.model.schema;if(t.isObject&&!i.isRegistered(t.model))this._registerObjectElement(t);else if(t.isBlock)this._registerBlockElement(t);else {if(!t.isInline)throw new I("data-filter-invalid-definition",null,t);this._registerInlineElement(t);}e.stop();},{priority:"lowest"});}_registerCoupledAttributesPostFixer(){const e=this.editor.model,t=e.document.selection;e.document.registerPostFixer(t=>{const i=e.document.differ.getChanges();let n=false;const s=this._getCoupledAttributesMap();for(const e of i){if("attribute"!=e.type||null!==e.attributeNewValue)continue;const i=s.get(e.attributeKey);if(i)for(const{item:s}of e.range.getWalker())for(const e of i)s.hasAttribute(e)&&(t.removeAttribute(e,s),n=true);}return n}),this.listenTo(t,"change:attribute",(i,{attributeKeys:n})=>{const s=new Set,o=this._getCoupledAttributesMap();for(const e of n){if(t.hasAttribute(e))continue;const i=o.get(e);if(i)for(const e of i)t.hasAttribute(e)&&s.add(e);}0!=s.size&&e.change(e=>{for(const t of s)e.removeSelectionAttribute(t);});});}_registerAssociatedHtmlAttributesPostFixer(){const e=this.editor.model;e.document.registerPostFixer(t=>{const i=e.document.differ.getChanges();let n=false;for(const s of i)if("insert"===s.type&&"$text"!==s.name)for(const i of s.attributes.keys())i.startsWith("html")&&i.endsWith("Attributes")&&(e.schema.checkAttribute(s.name,i)||(t.removeAttribute(i,s.position.nodeAfter),n=true));return n});}_getCoupledAttributesMap(){if(this._coupledAttributes)return this._coupledAttributes;this._coupledAttributes=new Map;for(const e of this._allowedElements)if(e.coupledAttribute&&e.model){const t=this._coupledAttributes.get(e.coupledAttribute);t?t.push(e.model):this._coupledAttributes.set(e.coupledAttribute,[e.model]);}return this._coupledAttributes}_fireRegisterEvent(e){e.view&&this._disallowedElements.has(e.view)||this.fire(e.view?`register:${e.view}`:"register",e);}_registerObjectElement(e){const t=this.editor,i=t.model.schema,n=t.conversion,{view:s,model:o}=e;i.register(o,e.modelSchema),s&&(i.extend(e.model,{allowAttributes:[MV(s),"htmlContent"]}),t.data.registerRawContentMatcher({name:s}),n.for("upcast").elementToElement({view:s,model:FV(e),converterPriority:E.low+2}),n.for("upcast").add(UV(e,this)),n.for("editingDowncast").elementToStructure({model:{name:o,attributes:[MV(s)]},view:NV(t,e)}),n.for("dataDowncast").elementToElement({model:o,view:(e,{writer:t})=>DV(s,e,t)}),n.for("dataDowncast").add(jV(e)));}_registerBlockElement(e){const t=this.editor,i=t.model.schema,n=t.conversion,{view:s,model:o}=e;if(!i.isRegistered(e.model)){if(!e.modelSchema)return;if(i.register(e.model,e.modelSchema),!s)return;n.for("upcast").elementToElement({model:o,view:s,converterPriority:E.low+2}),n.for("downcast").elementToElement({model:o,view:(t,{writer:i})=>e.isEmpty?i.createEmptyElement(s):i.createContainerElement(s)});}s&&(i.extend(e.model,{allowAttributes:MV(s)}),n.for("upcast").add(UV(e,this)),n.for("downcast").add(jV(e)));}_registerInlineElement(e){const t=this.editor,i=t.model.schema,n=t.conversion,s=e.model;if(!e.appliesToBlock&&(i.extend("$text",{allowAttributes:s}),e.attributeProperties&&i.setAttributeProperties(s,e.attributeProperties),n.for("upcast").add(zV(e,this)),n.for("downcast").attributeToElement({model:s,view:qV(e)}),e.allowEmpty)){if(i.setAttributeProperties(s,{copyFromObject:false}),!i.isRegistered("htmlEmptyElement")){i.register("htmlEmptyElement",{inheritAllFrom:"$inlineObject"});const e=e=>Array.from(e.getAttributeKeys()).some(e=>e.startsWith("html"));t.model.document.registerPostFixer(i=>{const n=t.model.document.differ.getChanges(),s=new Set;for(const t of n)if("remove"!==t.type){if("attribute"===t.type&&null===t.attributeNewValue)for(const{item:i}of t.range)i.is("element","htmlEmptyElement")&&!e(i)&&s.add(i);if("insert"===t.type&&t.position.nodeAfter){const n=t.position.nodeAfter;for(const{item:t}of i.createRangeOn(n))t.is("element","htmlEmptyElement")&&!e(t)&&s.add(t);}}for(const e of s)i.remove(e);return s.size>0});}t.data.htmlProcessor.domConverter.registerInlineObjectMatcher(t=>t.name==e.view&&t.isEmpty&&Array.from(t.getAttributeKeys()).length?{name:true}:null),n.for("editingDowncast").elementToElement({model:"htmlEmptyElement",view:HV(e,true)}),n.for("dataDowncast").elementToElement({model:"htmlEmptyElement",view:HV(e)});}}}function KV(e,t,i){const n=t.matchAll(e)||[],s=e.document.stylesProcessor;return n.reduce((t,{match:n})=>{for(const[o,r]of n.attributes||[])if("style"==o){const n=r,o=s.getRelatedStyles(n).filter(e=>e.split("-").length>n.split("-").length).sort((e,t)=>t.split("-").length-e.split("-").length);for(const n of o)i.consume(e,{styles:[n]})&&t.styles.push(n);i.consume(e,{styles:[n]})&&t.styles.push(n);}else if("class"==o){const n=r;i.consume(e,{classes:[n]})&&t.classes.push(n);}else i.consume(e,{attributes:[o]})&&t.attributes.push(o);return t},{attributes:[],classes:[],styles:[]})}function JV(e,t){const i={};for(const n of t){const t=e.getAttribute(n);void 0!==t&&Mi(n)&&(i[n]=t);}return i}function QV(e,t){const i=new go(e.document.stylesProcessor);for(const n of t){const t=e.getStyle(n);void 0!==t&&i.set(n,t);}return Object.fromEntries(i.getStylesEntries())}function YV(e,t){const{name:i}=e,n=e[t];return yt(n)?Object.entries(n).map(([e,n])=>({name:i,[t]:{[e]:n}})):Array.isArray(n)?n.map(e=>({name:i,[t]:[e]})):[e]}function ZV(e){const{name:t,attributes:i,classes:n,styles:s}=e,o=[];return i&&o.push(...YV({name:t,attributes:i},"attributes")),n&&o.push(...YV({name:t,classes:n},"classes")),s&&o.push(...YV({name:t,styles:s},"styles")),o}class XV extends Ms{static get requires(){return [GV]}static get pluginName(){return "CodeBlockElementSupport"}static get isOfficialPlugin(){return  true}init(){if(!this.editor.plugins.has("CodeBlockEditing"))return;const e=this.editor.plugins.get(GV);e.on("register:pre",(t,i)=>{if("codeBlock"!==i.model)return;const n=this.editor,s=n.model.schema,o=n.conversion;s.extend("codeBlock",{allowAttributes:["htmlPreAttributes","htmlContentAttributes"]}),o.for("upcast").add(function(e){return t=>{t.on("element:code",(t,i,n)=>{const s=i.viewItem,o=s.parent;function r(t,s){const o=e.processViewAttributes(t,n);o&&n.writer.setAttribute(s,o,i.modelRange);}o&&o.is("element","pre")&&(r(o,"htmlPreAttributes"),r(s,"htmlContentAttributes"));},{priority:"low"});}}(e)),o.for("downcast").add(e=>{e.on("attribute:htmlPreAttributes:codeBlock",(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const{attributeOldValue:n,attributeNewValue:s}=t,o=i.mapper.toViewElement(t.item).parent;IV(i.writer,n,s,o);}),e.on("attribute:htmlContentAttributes:codeBlock",(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const{attributeOldValue:n,attributeNewValue:s}=t,o=i.mapper.toViewElement(t.item);IV(i.writer,n,s,o);});}),t.stop();});}}class eR extends Ms{static get requires(){return [GV]}static get pluginName(){return "DualContentModelElementSupport"}static get isOfficialPlugin(){return  true}init(){this.editor.plugins.get(GV).on("register",(e,t)=>{const i=t,n=this.editor,s=n.model.schema,o=n.conversion;if(!i.paragraphLikeModel)return;if(s.isRegistered(i.model)||s.isRegistered(i.paragraphLikeModel))return;const r={model:i.paragraphLikeModel,view:i.view};s.register(i.model,i.modelSchema),s.register(r.model,{inheritAllFrom:"$block"}),o.for("upcast").elementToElement({view:i.view,model:(e,{writer:t})=>this._hasBlockContent(e)?t.createElement(i.model):t.createElement(r.model),converterPriority:E.low+.5}),o.for("downcast").elementToElement({view:i.view,model:i.model}),this._addAttributeConversion(i),o.for("downcast").elementToElement({view:r.view,model:r.model}),this._addAttributeConversion(r),e.stop();});}_hasBlockContent(e){const t=this.editor.editing.view,i=t.domConverter.blockElements;for(const n of t.createRangeIn(e).getItems())if(n.is("element")&&i.includes(n.name))return  true;return  false}_addAttributeConversion(e){const t=this.editor,i=t.conversion,n=t.plugins.get(GV);t.model.schema.extend(e.model,{allowAttributes:MV(e.view)}),i.for("upcast").add(UV(e,n)),i.for("downcast").add(jV(e));}}class tR extends Ms{static get requires(){return [WV,Rk]}static get pluginName(){return "HeadingElementSupport"}static get isOfficialPlugin(){return  true}init(){const e=this.editor;if(!e.plugins.has("HeadingEditing"))return;const t=e.config.get("heading.options");this.registerHeadingElements(e,t);}registerHeadingElements(e,t){const i=e.plugins.get(WV),n=[];for(const e of t)"model"in e&&"view"in e&&(i.registerBlockElement({view:e.view,model:e.model}),n.push(e.model));i.extendBlockElement({model:"htmlHgroup",modelSchema:{allowChildren:n}}),i.extendBlockElement({model:"htmlSummary",modelSchema:{allowChildren:n}});}}function iR(e,t,i){const n=e.createRangeOn(t);for(const{item:e}of n.getWalker())if(e.is("element",i))return e}class nR extends Ms{static get requires(){return [GV]}static get pluginName(){return "ImageElementSupport"}static get isOfficialPlugin(){return  true}init(){const e=this.editor;if(!e.plugins.has("ImageInlineEditing")&&!e.plugins.has("ImageBlockEditing"))return;const t=e.model.schema,i=e.conversion,n=e.plugins.get(GV);n.on("register:figure",()=>{i.for("upcast").add(function(e){return t=>{t.on("element:figure",(t,i,n)=>{const s=i.viewItem;if(!i.modelRange||!s.hasClass("image"))return;const o=e.processViewAttributes(s,n);o&&n.writer.setAttribute("htmlFigureAttributes",o,i.modelRange);},{priority:"low"});}}(n));}),n.on("register:img",(s,o)=>{"imageBlock"!==o.model&&"imageInline"!==o.model||(t.isRegistered("imageBlock")&&t.extend("imageBlock",{allowAttributes:["htmlImgAttributes","htmlFigureAttributes","htmlLinkAttributes"]}),t.isRegistered("imageInline")&&t.extend("imageInline",{allowAttributes:["htmlA","htmlImgAttributes"]}),i.for("upcast").add(function(e){return t=>{t.on("element:img",(t,i,n)=>{if(!i.modelRange)return;const s=i.viewItem,o=e.processViewAttributes(s,n);o&&n.writer.setAttribute("htmlImgAttributes",o,i.modelRange);},{priority:"low"});}}(n)),i.for("downcast").add(e=>{function t(t){e.on(`attribute:${t}:imageInline`,(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const{attributeOldValue:n,attributeNewValue:s}=t,o=i.mapper.toViewElement(t.item);IV(i.writer,n,s,o);},{priority:"low"});}function i(t,i){e.on(`attribute:${i}:imageBlock`,(e,i,n)=>{if(!n.consumable.test(i.item,e.name))return;const{attributeOldValue:s,attributeNewValue:o}=i,r=n.mapper.toViewElement(i.item),a=iR(n.writer,r,t);a&&(IV(n.writer,s,o,a),n.consumable.consume(i.item,e.name));},{priority:"low"}),"a"===t&&e.on("attribute:linkHref:imageBlock",(e,t,i)=>{if(!i.consumable.consume(t.item,"attribute:htmlLinkAttributes:imageBlock"))return;const n=i.mapper.toViewElement(t.item),s=iR(i.writer,n,"a");PV(i.writer,t.item.getAttribute("htmlLinkAttributes"),s);},{priority:"low"});}t("htmlImgAttributes"),i("img","htmlImgAttributes"),i("figure","htmlFigureAttributes"),i("a","htmlLinkAttributes");}),e.plugins.has("LinkImage")&&i.for("upcast").add(function(e,t){const i=t.plugins.get("ImageUtils");return t=>{t.on("element:a",(t,n,s)=>{const o=n.viewItem;if(!i.findViewImgElement(o))return;const r=n.modelCursor.parent;if(!r.is("element","imageBlock"))return;const a=e.processViewAttributes(o,s);a&&s.writer.setAttribute("htmlLinkAttributes",a,r);},{priority:"low"});}}(n,e)),s.stop());});}}class sR extends Ms{static get requires(){return [GV]}static get pluginName(){return "MediaEmbedElementSupport"}static get isOfficialPlugin(){return  true}init(){const e=this.editor;if(!e.plugins.has("MediaEmbed")||e.config.get("mediaEmbed.previewsInData"))return;const t=e.model.schema,i=e.conversion,n=this.editor.plugins.get(GV),s=this.editor.plugins.get(WV),o=e.config.get("mediaEmbed.elementName");s.registerBlockElement({model:"media",view:o}),n.on("register:figure",()=>{i.for("upcast").add(function(e){return t=>{t.on("element:figure",(t,i,n)=>{const s=i.viewItem;if(!i.modelRange||!s.hasClass("media"))return;const o=e.processViewAttributes(s,n);o&&n.writer.setAttribute("htmlFigureAttributes",o,i.modelRange);},{priority:"low"});}}(n));}),n.on(`register:${o}`,(e,s)=>{"media"===s.model&&(t.extend("media",{allowAttributes:[MV(o),"htmlFigureAttributes"]}),i.for("upcast").add(function(e,t){const i=(i,n,s)=>{function o(t,i){const o=e.processViewAttributes(t,s);o&&s.writer.setAttribute(i,o,n.modelRange);}o(n.viewItem,MV(t));};return e=>{e.on(`element:${t}`,i,{priority:"low"});}}(n,o)),i.for("dataDowncast").add(function(e){return t=>{function i(e,i){t.on(`attribute:${i}:media`,(t,i,n)=>{if(!n.consumable.consume(i.item,t.name))return;const{attributeOldValue:s,attributeNewValue:o}=i,r=n.mapper.toViewElement(i.item),a=iR(n.writer,r,e);IV(n.writer,s,o,a);});}i(e,MV(e)),i("figure","htmlFigureAttributes");}}(o)),e.stop());});}}class oR extends Ms{static get requires(){return [GV]}static get pluginName(){return "ScriptElementSupport"}static get isOfficialPlugin(){return  true}init(){const e=this.editor.plugins.get(GV);e.on("register:script",(t,i)=>{const n=this.editor,s=n.model.schema,o=n.conversion;s.register("htmlScript",i.modelSchema),s.extend("htmlScript",{allowAttributes:["htmlScriptAttributes","htmlContent"],isContent:true}),n.data.registerRawContentMatcher({name:"script"}),o.for("upcast").elementToElement({view:"script",model:FV(i)}),o.for("upcast").add(UV(i,e)),o.for("downcast").elementToElement({model:"htmlScript",view:(e,{writer:t})=>DV("script",e,t)}),o.for("downcast").add(jV(i)),t.stop();});}}const rR=["width","max-width","min-width","height","min-height","max-height"];class aR extends Ms{static get requires(){return [GV]}static get pluginName(){return "TableElementSupport"}static get isOfficialPlugin(){return  true}init(){const e=this.editor;if(!e.plugins.has("TableEditing"))return;const t=e.model.schema,i=e.conversion,n=e.plugins.get(GV),s=e.plugins.get("TableUtils");n.on("register:figure",()=>{i.for("upcast").add(function(e){return t=>{t.on("element:figure",(t,i,n)=>{const s=i.viewItem;if(!i.modelRange||!s.hasClass("table"))return;const o=e.processViewAttributes(s,n);o&&n.writer.setAttribute("htmlFigureAttributes",o,i.modelRange);},{priority:"low"});}}(n));}),n.on("register:table",(o,r)=>{"table"===r.model&&(t.extend("table",{allowAttributes:["htmlTableAttributes","htmlFigureAttributes","htmlTheadAttributes","htmlTbodyAttributes","htmlTfootAttributes"]}),i.for("upcast").add(function(e){return t=>{t.on("element:table",(t,i,n)=>{if(!i.modelRange)return;const s=i.viewItem;n.consumable.consume(s,{classes:"table"}),o(s,"htmlTableAttributes");for(const e of s.getChildren())e.is("element","thead")&&o(e,"htmlTheadAttributes"),e.is("element","tfoot")&&o(e,"htmlTfootAttributes"),e.is("element","tbody")&&o(e,"htmlTbodyAttributes");function o(t,s){const o=e.processViewAttributes(t,n);o&&n.writer.setAttribute(s,o,i.modelRange);}},{priority:"low"});}}(n)),i.for("downcast").add(e=>{function t(t,i){e.on(`attribute:${i}:table`,(e,n,s)=>{if(!s.consumable.test(n.item,e.name))return;const o=s.mapper.toViewElement(n.item),r=iR(s.writer,o,t);if(r)if(s.consumable.consume(n.item,e.name),"htmlTableAttributes"===i&&o!==r){const e=lR(n.attributeOldValue),t=lR(n.attributeNewValue);IV(s.writer,e.tableAttributes,t.tableAttributes,r),IV(s.writer,e.figureAttributes,t.figureAttributes,o);}else IV(s.writer,n.attributeOldValue,n.attributeNewValue,r);});}t("table","htmlTableAttributes"),t("figure","htmlFigureAttributes"),t("thead","htmlTheadAttributes"),t("tbody","htmlTbodyAttributes"),t("tfoot","htmlTfootAttributes");}),e.model.document.registerPostFixer(function(e,t){return i=>{const n=e.document.differ.getChanges();let s=false;for(const e of n){if("attribute"!=e.type||"headingRows"!=e.attributeKey&&"footerRows"!=e.attributeKey)continue;const n=e.range.start.nodeAfter,o=n.getAttribute("htmlTheadAttributes"),r=n.getAttribute("htmlTbodyAttributes"),a=n.getAttribute("htmlTfootAttributes");if(o&&"headingRows"===e.attributeKey&&!e.attributeNewValue&&(i.removeAttribute("htmlTheadAttributes",n),s=true),a&&"footerRows"===e.attributeKey&&!e.attributeNewValue&&(i.removeAttribute("htmlTfootAttributes",n),s=true),r){(n.getAttribute("headingRows")||0)+(n.getAttribute("footerRows")||0)==t.getRows(n)&&(i.removeAttribute("htmlTbodyAttributes",n),s=true);}}return s}}(e.model,s)),o.stop());});}}function lR(e){const t={},i={...e};if(!e||!("styles"in e))return {figureAttributes:t,tableAttributes:i};i.styles={};for(const[n,s]of Object.entries(e.styles))rR.includes(n)?t.styles={...t.styles,[n]:s}:i.styles={...i.styles,[n]:s};return {figureAttributes:t,tableAttributes:i}}class cR extends Ms{static get requires(){return [GV]}static get pluginName(){return "StyleElementSupport"}static get isOfficialPlugin(){return  true}init(){const e=this.editor.plugins.get(GV);e.on("register:style",(t,i)=>{const n=this.editor,s=n.model.schema,o=n.conversion;s.register("htmlStyle",i.modelSchema),s.extend("htmlStyle",{allowAttributes:["htmlStyleAttributes","htmlContent"],isContent:true}),n.data.registerRawContentMatcher({name:"style"}),o.for("upcast").elementToElement({view:"style",model:FV(i)}),o.for("upcast").add(UV(i,e)),o.for("downcast").elementToElement({model:"htmlStyle",view:(e,{writer:t})=>DV("style",e,t)}),o.for("downcast").add(jV(i)),t.stop();});}}class uR extends Ms{static get requires(){return [GV]}static get pluginName(){return "ListElementSupport"}static get isOfficialPlugin(){return  true}init(){const e=this.editor;if(!e.plugins.has("ListEditing"))return;const t=e.model.schema,i=e.conversion,n=e.plugins.get(GV),s=e.plugins.get("ListEditing"),o=e.plugins.get("ListUtils"),r=["ul","ol","li"];s.registerDowncastStrategy({scope:"item",attributeName:"htmlLiAttributes",setAttributeOnDowncast:PV}),s.registerDowncastStrategy({scope:"list",attributeName:"htmlUlAttributes",setAttributeOnDowncast:PV}),s.registerDowncastStrategy({scope:"list",attributeName:"htmlOlAttributes",setAttributeOnDowncast:PV}),n.on("register",(e,s)=>{if(!r.includes(s.view))return;if(e.stop(),t.checkAttribute("$block","htmlLiAttributes"))return;const o=r.map(e=>MV(e));t.extend("$listItem",{allowAttributes:o}),i.for("upcast").add(e=>{e.on("element:ul",dR("htmlUlAttributes",n),{priority:"low"}),e.on("element:ol",dR("htmlOlAttributes",n),{priority:"low"}),e.on("element:li",dR("htmlLiAttributes",n),{priority:"low"});});}),s.on("postFixer",(e,{listNodes:t,writer:i})=>{for(const{node:n,previousNodeInList:s}of t)if(s){if(s.getAttribute("listType")==n.getAttribute("listType")){const t=hR(s.getAttribute("listType")),o=s.getAttribute(t);!dt(n.getAttribute(t),o)&&i.model.schema.checkAttribute(n,t)&&(i.setAttribute(t,o,n),e.return=true);}if(s.getAttribute("listItemId")==n.getAttribute("listItemId")){const t=s.getAttribute("htmlLiAttributes");!dt(n.getAttribute("htmlLiAttributes"),t)&&i.model.schema.checkAttribute(n,"htmlLiAttributes")&&(i.setAttribute("htmlLiAttributes",t,n),e.return=true);}}}),s.on("postFixer",(e,{listNodes:t,writer:i})=>{for(const{node:n}of t){const t=n.getAttribute("listType");!o.isNumberedListType(t)&&n.getAttribute("htmlOlAttributes")&&(i.removeAttribute("htmlOlAttributes",n),e.return=true),o.isNumberedListType(t)&&n.getAttribute("htmlUlAttributes")&&(i.removeAttribute("htmlUlAttributes",n),e.return=true);}});}afterInit(){const e=this.editor;if(!e.commands.get("indentList"))return;const t=e.commands.get("indentList");this.listenTo(t,"afterExecute",(t,i)=>{e.model.change(t=>{for(const n of i){const i=hR(n.getAttribute("listType"));e.model.schema.checkAttribute(n,i)&&t.setAttribute(i,{},n);}});});}}function dR(e,t){return (i,n,s)=>{const o=n.viewItem;n.modelRange||Object.assign(n,s.convertChildren(n.viewItem,n.modelCursor));const r=t.processViewAttributes(o,s);for(const t of n.modelRange.getItems({shallow:true}))t.hasAttribute("listItemId")&&(t.hasAttribute("htmlUlAttributes")||t.hasAttribute("htmlOlAttributes")||s.writer.model.schema.checkAttribute(t,e)&&s.writer.setAttribute(e,r||{},t));}}function hR(e){return "numbered"===e||"customNumbered"==e?"htmlOlAttributes":"htmlUlAttributes"}class mR extends Ms{static get requires(){return [GV]}static get pluginName(){return "HorizontalLineElementSupport"}static get isOfficialPlugin(){return  true}init(){const e=this.editor;if(!e.plugins.has("HorizontalLineEditing"))return;const t=e.model.schema,i=e.conversion,n=e.plugins.get(GV);n.on("register:hr",(e,s)=>{"horizontalLine"===s.model&&(t.extend("horizontalLine",{allowAttributes:["htmlHrAttributes"]}),i.for("upcast").add(UV(s,n)),i.for("downcast").add(e=>{e.on("attribute:htmlHrAttributes:horizontalLine",(e,t,i)=>{if(!i.consumable.test(t.item,e.name))return;const{attributeOldValue:n,attributeNewValue:s}=t,o=i.mapper.toViewElement(t.item),r=iR(i.writer,o,"hr");r&&(IV(i.writer,n,s,r),i.consumable.consume(t.item,e.name));},{priority:"low"});}),e.stop());});}}class gR extends Ms{static get requires(){return [GV]}static get pluginName(){return "IframeElementSupport"}static get isOfficialPlugin(){return  true}init(){this.editor.config.define("htmlSupport.htmlIframeSandbox",true),this._setupSandboxConversion();}_setupSandboxConversion(){const{plugins:e,config:t,conversion:i}=this.editor,n=e.get(GV),s=t.get("htmlSupport.htmlIframeSandbox");if(false===s)return;const o=Array.isArray(s)?Array.from(s):[];n.on("register:iframe",(e,t)=>{i.for("editingDowncast").add(e=>{e.on(`insert:${t.model}`,(e,t,i)=>{const{mapper:n,writer:s}=i,r=n.toViewElement(t.item);for(const{item:e}of s.createRangeOn(r))if(e.is("element","iframe"))if(e.hasAttribute("sandbox")){const t=new Set,i=e.getAttribute("sandbox");for(const e of i.trim().split(/\s+/))o.includes(e)&&t.add(e);s.setAttribute("sandbox",Array.from(t).join(" "),e);}else s.setAttribute("sandbox",o.join(" "),e);},{priority:"lowest"});});});}}class fR extends Ms{static get requires(){return [GV,WV]}static get pluginName(){return "CustomElementSupport"}static get isOfficialPlugin(){return  true}init(){const e=this.editor.plugins.get(GV),t=this.editor.plugins.get(WV);e.on("register:$customElement",(i,n)=>{i.stop();const s=this.editor,o=s.model.schema,r=s.conversion,a=s.editing.view.domConverter.unsafeElements,l=s.data.htmlProcessor.domConverter.preElements;o.register(n.model,n.modelSchema),o.extend(n.model,{allowAttributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"],isContent:true}),s.data.htmlProcessor.domConverter.registerRawContentMatcher({name:"template"}),r.for("upcast").elementToElement({view:/.*/,model:(i,o)=>{if("$comment"==i.name)return null;if(!function(e){try{document.createElement(e);}catch{return  false}return  true}(i.name))return null;if(t.getDefinitionsForView(i.name).size)return null;a.includes(i.name)||a.push(i.name),l.includes(i.name)||l.push(i.name);const r=o.writer.createElement(n.model,{htmlElementName:i.name}),c=e.processViewAttributes(i,o);let u;if(c&&o.writer.setAttribute("htmlCustomElementAttributes",c,r),i.is("element","template")&&i.getCustomProperty("$rawContent"))u=i.getCustomProperty("$rawContent");else {const e=new Cu(i.document).createDocumentFragment(i),t=s.data.htmlProcessor.domConverter.viewToDom(e),n=t.firstChild;for(;n.firstChild;)t.appendChild(n.firstChild);n.remove(),u=s.data.htmlProcessor.htmlWriter.getHtml(t);}o.writer.setAttribute("htmlContent",u,r);for(const{item:e}of s.editing.view.createRangeIn(i))o.consumable.consume(e,{name:true});return r},converterPriority:"low"}),r.for("editingDowncast").elementToElement({model:{name:n.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(e,{writer:t})=>{const i=e.getAttribute("htmlElementName"),n=t.createRawElement(i);return e.hasAttribute("htmlCustomElementAttributes")&&PV(t,e.getAttribute("htmlCustomElementAttributes"),n),n}}),r.for("dataDowncast").elementToElement({model:{name:n.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(e,{writer:t})=>{const i=e.getAttribute("htmlElementName"),n=e.getAttribute("htmlContent"),s=t.createRawElement(i,null,(e,t)=>{t.setContentOf(e,n);});return e.hasAttribute("htmlCustomElementAttributes")&&PV(t,e.getAttribute("htmlCustomElementAttributes"),s),s}});});}}class pR extends Ms{static get pluginName(){return "GeneralHtmlSupport"}static get isOfficialPlugin(){return  true}static get requires(){return [GV,XV,eR,tR,nR,sR,oR,aR,cR,uR,mR,gR,fR]}init(){const e=this.editor,t=e.plugins.get(GV);t.loadAllowedEmptyElementsConfig(e.config.get("htmlSupport.allowEmpty")||[]),t.loadAllowedConfig(e.config.get("htmlSupport.allow")||[]),t.loadDisallowedConfig(e.config.get("htmlSupport.disallow")||[]);}afterInit(){const e=this.editor.commands.get("removeFormat");e?.registerCustomAttribute(e=>e.startsWith("html")&&e.endsWith("Attributes"),BV);}getGhsAttributeNameForElement(e){const t=this.editor.plugins.get("DataSchema"),i=Array.from(t.getDefinitionsForView(e,false)),n=i.find(e=>e.isInline&&!i[0].isObject);return n?n.model:MV(e)}addModelHtmlClass(e,t,i){const n=this.editor.model,s=this.getGhsAttributeNameForElement(e);n.change(e=>{for(const o of bR(n,i,s))OV(e,o,s,"classes",e=>{for(const i of pn(t))e.add(i);});});}removeModelHtmlClass(e,t,i){const n=this.editor.model,s=this.getGhsAttributeNameForElement(e);n.change(e=>{for(const o of bR(n,i,s))OV(e,o,s,"classes",e=>{for(const i of pn(t))e.delete(i);});});}setModelHtmlAttributes(e,t,i){const n=this.editor.model,s=this.getGhsAttributeNameForElement(e);n.change(e=>{for(const o of bR(n,i,s))OV(e,o,s,"attributes",e=>{for(const[i,n]of Object.entries(t))e.set(i,n);});});}removeModelHtmlAttributes(e,t,i){const n=this.editor.model,s=this.getGhsAttributeNameForElement(e);n.change(e=>{for(const o of bR(n,i,s))OV(e,o,s,"attributes",e=>{for(const i of pn(t))e.delete(i);});});}setModelHtmlStyles(e,t,i){const n=this.editor.model,s=this.getGhsAttributeNameForElement(e);n.change(e=>{for(const o of bR(n,i,s))OV(e,o,s,"styles",e=>{for(const[i,n]of Object.entries(t))e.set(i,n);});});}removeModelHtmlStyles(e,t,i){const n=this.editor.model,s=this.getGhsAttributeNameForElement(e);n.change(e=>{for(const o of bR(n,i,s))OV(e,o,s,"styles",e=>{for(const i of pn(t))e.delete(i);});});}}function*bR(e,t,i){if(t)if(!(Symbol.iterator in t)&&t.is("documentSelection")&&t.isCollapsed)e.schema.checkAttributeInSelection(t,i)&&(yield t);else for(const n of function(e,t,i){return !(Symbol.iterator in t)&&(t.is("node")||t.is("$text")||t.is("$textProxy"))?e.schema.checkAttribute(t,i)?[e.createRangeOn(t)]:[]:e.schema.getValidRanges(e.createSelection(t).getRanges(),i)}(e,t,i))yield*n.getItems({shallow:true});}class wR extends Ms{static get pluginName(){return "HtmlComment"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=new Map;e.data.processor.skipComments=false,e.model.schema.addAttributeCheck((e,t)=>{if(e.endsWith("$root")&&t.startsWith("$comment"))return  true}),e.conversion.for("upcast").elementToMarker({view:"$comment",model:e=>{const i=`$comment:${A()}`,n=e.getCustomProperty("$rawContent");return t.set(i,n),i}}),e.conversion.for("dataDowncast").markerToElement({model:"$comment",view:(e,{writer:t})=>{let i;for(const t of this.editor.model.document.getRootNames())if(i=this.editor.model.document.getRoot(t),i.hasAttribute(e.markerName))break;const n=e.markerName,s=i.getAttribute(n),o=t.createUIElement("$comment");return t.setCustomProperty("$rawContent",s,o),o}}),e.model.document.registerPostFixer(i=>{let n=false;const s=e.model.document.differ.getChangedMarkers().filter(e=>e.name.startsWith("$comment:"));for(const e of s){const{oldRange:s,newRange:o}=e.data;if(!s||!o||s.root!=o.root){if(s){const t=s.root;t.hasAttribute(e.name)&&(i.removeAttribute(e.name,t),n=true);}if(o){const s=o.root;"$graveyard"==s.rootName?(i.removeMarker(e.name),n=true):s.hasAttribute(e.name)||(i.setAttribute(e.name,t.get(e.name)||"",s),n=true);}}}return n}),e.data.on("set",()=>{for(const t of e.model.markers.getMarkersGroup("$comment"))this.removeHtmlComment(t.name);},{priority:"high"}),e.model.on("deleteContent",(t,[i])=>{for(const t of i.getRanges()){const i=e.model.schema.getLimitElement(t),n=e.model.createPositionAt(i,0),s=e.model.createPositionAt(i,"end");let o;o=n.isTouching(t.start)&&s.isTouching(t.end)?this.getHtmlCommentsInRange(e.model.createRange(n,s)):this.getHtmlCommentsInRange(t,{skipBoundaries:true});for(const e of o)this.removeHtmlComment(e);}},{priority:"high"});}createHtmlComment(e,t){const i=A(),n=this.editor.model,s=n.document.getRoot(e.root.rootName),o=`$comment:${i}`;return n.change(i=>{const n=i.createRange(e);return i.addMarker(o,{usingOperation:true,affectsData:true,range:n}),i.setAttribute(o,t,s),o})}removeHtmlComment(e){const t=this.editor,i=t.model.markers.get(e);return !!i&&(t.model.change(e=>{e.removeMarker(i);}),true)}getHtmlCommentData(e){const t=this.editor.model.markers.get(e);if(!t)return null;let i="";for(const t of this.editor.model.document.getRoots())if(t.hasAttribute(e)){i=t.getAttribute(e);break}return {content:i,position:t.getStart()}}getHtmlCommentsInRange(e,{skipBoundaries:t=false}={}){const i=!t;return Array.from(this.editor.model.markers.getMarkersGroup("$comment")).filter(t=>function(e,t){const n=e.getRange().start;return (n.isAfter(t.start)||i&&n.isEqual(t.start))&&(n.isBefore(t.end)||i&&n.isEqual(t.end))}(t,e)).map(e=>e.name)}}class vR extends Hl{toView(e){if(!/<(?:html|body|head|meta)(?:\s[^>]*)?>/i.test(e.trim().slice(0,1e4)))return super.toView(e);let t="",i="";e=(e=e.trim().replace(/<\?xml\s[^?]*\?>/i,e=>(i=e,""))).trim().replace(/^<!DOCTYPE\s[^>]*?>/i,e=>(t=e,""));const n=this._toDom(e),s=this.domConverter.domToView(n,{skipComments:this.skipComments}),o=new Cu(s.document);o.setCustomProperty("$fullPageDocument",n.ownerDocument.documentElement.outerHTML,s);const r=Array.from(n.ownerDocument.querySelectorAll("head style"));return o.setCustomProperty("$fullPageHeadStyles",r,s),t&&o.setCustomProperty("$fullPageDocType",t,s),i&&o.setCustomProperty("$fullPageXmlDeclaration",i,s),s}toData(e){let t=super.toData(e);const i=e.getCustomProperty("$fullPageDocument"),n=e.getCustomProperty("$fullPageDocType"),s=e.getCustomProperty("$fullPageXmlDeclaration");return i&&(t=i.replace(/<\/body\s*>/,t+"$&"),n&&(t=n+"\n"+t),s&&(t=s+"\n"+t)),t}}class _R extends Ms{static get pluginName(){return "FullPage"}static get licenseFeatureCode(){return "FPH"}static get isOfficialPlugin(){return  true}static get isPremiumPlugin(){return  true}constructor(e){super(e),e.config.define("htmlSupport.fullPage",{allowRenderStylesFromHead:false,sanitizeCss:e=>(P("css-full-page-provide-sanitize-function"),{css:e,hasChanged:false})}),e.data.processor=new vR(e.data.viewDocument);}init(){const e=this.editor,t=["$fullPageDocument","$fullPageDocType","$fullPageXmlDeclaration","$fullPageHeadStyles"];e.model.schema.extend("$root",{allowAttributes:t}),e.data.on("toModel",(i,[n])=>{const s=e.model.document.getRoot();e.model.change(e=>{for(const i of t){const t=n.getCustomProperty(i);t&&e.setAttribute(i,t,s);}}),yR(e)&&this._renderStylesFromHead(s);},{priority:"low"}),e.data.on("toView",(e,[i])=>{if(!i.is("rootElement"))return;const n=i,s=e.return;if(!n.hasAttribute("$fullPageDocument"))return;const o=new Cu(s.document);for(const e of t){const t=n.getAttribute(e);t&&o.setCustomProperty(e,t,s);}},{priority:"low"}),e.data.on("set",()=>{const i=e.model.document.getRoot();e.model.change(e=>{for(const n of t)i.hasAttribute(n)&&e.removeAttribute(n,i);});},{priority:"high"}),e.data.on("get",(e,t)=>{t[0]||(t[0]={}),t[0].trim=false;},{priority:"high"});}destroy(){super.destroy(),yR(this.editor)&&this._removeStyleElementsFromDom();}_removeStyleElementsFromDom(){const t=Array.from(exports.global.document.querySelectorAll(`[data-full-page-style-id="${this.editor.id}"]`));for(const e of t)e.remove();}_renderStyleElementsInDom(t){const i=this.editor,n=t.getAttribute("$fullPageHeadStyles");if(!n)return;const s=i.config.get("htmlSupport.fullPage.sanitizeCss");for(const t of n){t.setAttribute("data-full-page-style-id",i.id);const n=s(t.innerText);n.hasChanged&&(t.innerText=n.css),exports.global.document.head.append(t);}}_renderStylesFromHead(e){this._removeStyleElementsFromDom(),this._renderStyleElementsInDom(e);}}function yR(e){return e.config.get("htmlSupport.fullPage.allowRenderStylesFromHead")}const kR="htmlEmptyBlock";class CR extends Ms{static get pluginName(){return "EmptyBlock"}static get isOfficialPlugin(){return  true}afterInit(){const{model:e,conversion:t,plugins:i,config:n}=this.editor,s=e.schema,o=n.get("htmlSupport.preserveEmptyBlocksInEditingView");s.extend("$block",{allowAttributes:[kR]}),s.extend("$container",{allowAttributes:[kR]}),s.isRegistered("tableCell")&&s.extend("tableCell",{allowAttributes:[kR]}),o?t.for("downcast").add(xR()):t.for("dataDowncast").add(xR()),t.for("upcast").add(function(e){return t=>{t.on("element",(t,i,n)=>{const{viewItem:s,modelRange:o}=i;if(!s.is("element")||!s.isEmpty||s.getCustomProperty("$hasBlockFiller"))return;const r=o&&o.start.nodeAfter;if(!r||!e.checkAttribute(r,kR))return;if(n.writer.setAttribute(kR,true,r),1!=r.childCount)return;const a=r.getChild(0);a.is("element","paragraph")&&e.checkAttribute(a,kR)&&n.writer.setAttribute(kR,true,a);},{priority:"lowest"});}}(s)),i.has("ClipboardPipeline")&&this._registerClipboardPastingHandler();}_registerClipboardPastingHandler(){const e=this.editor.plugins.get("ClipboardPipeline");this.listenTo(e,"contentInsertion",(e,t)=>{t.sourceEditorId!==this.editor.id&&this.editor.model.change(e=>{for(const{item:i}of e.createRangeIn(t.content))i.is("element")&&i.hasAttribute(kR)&&e.removeAttribute(kR,i);});});}}function xR(){return e=>{e.on(`attribute:${kR}`,(e,t,i)=>{const{mapper:n,consumable:s}=i,{item:o}=t;if(!s.consume(o,e.name))return;const r=n.toViewElement(o);r&&t.attributeNewValue&&(r.getFillerOffset=()=>null);});}}class AR extends Ms{static get pluginName(){return "IndentEditing"}static get isOfficialPlugin(){return  true}init(){const e=this.editor;e.commands.add("indent",new zs(e)),e.commands.add("outdent",new zs(e));}}class ER extends Ms{static get pluginName(){return "IndentUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.locale,i=e.t,n="ltr"==t.uiLanguageDirection?Ag:pf,s="ltr"==t.uiLanguageDirection?pf:Ag;this._defineButton("indent",i("Increase indent"),n),this._defineButton("outdent",i("Decrease indent"),s);}_defineButton(e,t,i){const n=this.editor;n.ui.componentFactory.add(e,()=>{const n=this._createButton(Bp,e,t,i);return n.set({tooltip:true}),n}),n.ui.componentFactory.add("menuBar:"+e,()=>this._createButton(Jp,e,t,i));}_createButton(e,t,i,n){const s=this.editor,o=s.commands.get(t),r=new e(s.locale);return r.set({label:i,icon:n}),r.bind("isEnabled").to(o,"isEnabled"),this.listenTo(r,"execute",()=>{s.execute(t),s.editing.view.focus();}),r}}class TR extends Ms{static get pluginName(){return "Indent"}static get isOfficialPlugin(){return  true}static get requires(){return [AR,ER]}}class SR extends Ns{_indentBehavior;constructor(e,t){super(e),this._indentBehavior=t;}refresh(){const e=Cn(this.editor.model.document.selection.getSelectedBlocks());e&&this._isIndentationChangeAllowed(e)?this.isEnabled=this._indentBehavior.checkEnabled(e.getAttribute("blockIndent")):this.isEnabled=false;}execute(){const e=this.editor.model,t=this._getBlocksToChange();e.change(e=>{for(const i of t){const t=i.getAttribute("blockIndent"),n=this._indentBehavior.getNextIndent(t);n?e.setAttribute("blockIndent",n,i):e.removeAttribute("blockIndent",i);}});}_getBlocksToChange(){const e=this.editor.model.document.selection;return Array.from(e.getSelectedBlocks()).filter(e=>this._isIndentationChangeAllowed(e))}_isIndentationChangeAllowed(e){const t=this.editor;if(!t.model.schema.checkAttribute(e,"blockIndent"))return  false;if(!t.plugins.has("ListUtils"))return  true;if(!this._indentBehavior.isForward)return  true;return !t.plugins.get("ListUtils").isListItemBlock(e)}}class IR{isForward;offset;unit;constructor(e){this.isForward="forward"===e.direction,this.offset=e.offset,this.unit=e.unit;}checkEnabled(e){const t=parseFloat(e||"0");return this.isForward||t>0}getNextIndent(e){const t=parseFloat(e||"0"),i=!e||e.endsWith(this.unit);if(t<0)return;if(!i)return this.isForward?this.offset+this.unit:void 0;const n=t+(this.isForward?this.offset:-this.offset);return n>0?n+this.unit:void 0}}class PR{isForward;classes;constructor(e){this.isForward="forward"===e.direction,this.classes=e.classes;}checkEnabled(e){const t=this.classes.indexOf(e);return this.isForward?t<this.classes.length-1:t>=0}getNextIndent(e){const t=this.classes.indexOf(e)+(this.isForward?1:-1),i=Math.min(t,this.classes.length-1);return this.classes[i]}}class VR{_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=pn(t.sameAttributes||[]),this._sameIndent=!!t.sameIndent,this._lowerIndent=!!t.lowerIndent,this._higherIndent=!!t.higherIndent;}static first(e,t){return Cn(new this(e,t)[Symbol.iterator]())}*[Symbol.iterator](){const e=[];for(const{node:t}of new RR(this._getStartNode(),this._isForward?"forward":"backward")){const i=t.getAttribute("listIndent");if(i<this._referenceIndent){if(!this._lowerIndent)break;this._referenceIndent=i;}else if(i>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}}class RR{_node;_isForward;_previousNodesByIndent=[];_previous=null;_previousNodeIndent=null;constructor(e,t="forward"){this._node=e,this._isForward="forward"===t;}[Symbol.iterator](){return this}next(){if(!LR(this._node))return {done:true,value:void 0};const e=this._node.getAttribute("listIndent");let t=null;if(this._previous){const i=this._previousNodeIndent;e>i?this._previousNodesByIndent[i]=this._previous:e<i?(t=this._previousNodesByIndent[e]||null,this._previousNodesByIndent.length=e):t=this._previous;}const i={node:this._node,previous:this._previous,previousNodeInList:t};return this._previous=this._node,this._previousNodeIndent=e,this._node=this._isForward?this._node.nextSibling:this._node.previousSibling,{value:i,done:false}}}class OR{_listHead;constructor(e){this._listHead=e;}[Symbol.iterator](){return new RR(this._listHead)}}class BR{static next(){return A()}}function LR(e){return !!e&&e.is("element")&&e.hasAttribute("listItemId")}function MR(e,t={}){return [...FR(e,{...t,direction:"backward"}),...FR(e,{...t,direction:"forward"})]}function FR(e,t={}){const i="forward"==t.direction,n=Array.from(new VR(e,{...t,includeSelf:i,sameIndent:true,sameAttributes:"listItemId"}));return i?n:n.reverse()}function NR(e){return Array.from(new VR(e,{direction:"forward",higherIndent:true}))}function DR(e,t){const i=new VR(e,{sameIndent:true,sameAttributes:"listType",...t}),n=new VR(e,{sameIndent:true,sameAttributes:"listType",includeSelf:true,direction:"forward",...t});return [...Array.from(i).reverse(),...n]}function zR(e){return !VR.first(e,{sameIndent:true,sameAttributes:"listItemId"})}function HR(e){return !VR.first(e,{direction:"forward",sameIndent:true,sameAttributes:"listItemId"})}function qR(e,t={}){e=pn(e);const i=false!==t.withNested,n=new Set;for(const t of e)for(const e of MR(t,{higherIndent:i}))n.add(e);return YR(n)}function UR(e){e=pn(e);const t=new Set;for(const i of e)for(const e of DR(i))t.add(e);return YR(t)}function jR(e,t){const i=FR(e,{direction:"forward"}),n=BR.next();for(const e of i)t.setAttribute("listItemId",n,e);return i}function $R(e,t,i){const n={};for(const[e,i]of t.getAttributes())e.startsWith("list")&&(n[e]=i);const s=FR(e,{direction:"forward"});for(const e of s)i.setAttributes(n,e);return s}function WR(e,t,{expand:i,indentBy:n=1,attributeNames:s}){e=pn(e);const o=i?qR(e):e;for(const e of o){const i=e.getAttribute("listIndent")+n;i<0?KR(e,t,s):t.setAttribute("listIndent",i,e);}return o}function GR(e,t,{attributeNames:i}){const n=qR(e=pn(e)),s=new Set,o=Math.min(...n.map(e=>e.getAttribute("listIndent"))),r=new Map;for(const e of n)r.set(e,VR.first(e,{lowerIndent:true}));for(const e of n){if(s.has(e))continue;s.add(e);const n=e.getAttribute("listIndent")-1;if(n<0)KR(e,t,i);else {if(e.getAttribute("listIndent")==o){const i=tO(e,r.get(e),t);for(const e of i)s.add(e);if(i.length)continue}t.setAttribute("listIndent",n,e);}}return YR(s)}function KR(e,t,i){e=pn(e);for(const i of e)i.is("element","listItem")&&t.rename(i,"paragraph");for(const n of e)for(const e of n.getAttributeKeys())i.includes(e)&&t.removeAttribute(e,n);return e}function JR(e){if(!e.length)return  false;const t=e[0].getAttribute("listItemId");return !!t&&!e.some(e=>e.getAttribute("listItemId")!=t)}function QR(e,t){const i=[];let n=Number.POSITIVE_INFINITY;for(const{node:s}of new RR(e.nextSibling)){const e=s.getAttribute("listIndent");if(0==e)break;e<n&&(n=e);const o=e-n;t.setAttribute("listIndent",o,s),i.push(s);}return i}function YR(e){return Array.from(e).filter(e=>"$graveyard"!==e.root.rootName).sort((e,t)=>e.index-t.index)}function ZR(e){const t=e.document.selection.getSelectedElement();return t&&e.schema.isObject(t)&&e.schema.isBlock(t)?t:null}function XR(e,t){return t.checkChild(e.parent,"listItem")&&t.checkChild(e,"$text")&&!t.isObject(e)}function eO(e){return "numbered"==e||"customNumbered"==e}function tO(e,t,i){return FR(t,{direction:"forward"}).pop().index>e.index?$R(e,t,i):[]}class iO extends Ns{_direction;constructor(e,t){super(e),this._direction=t;}refresh(){this.isEnabled=this._checkEnabled();}execute(){const e=this.editor,t=e.model,i=nO(t.document.selection),n=e.plugins.get("ListEditing").getListAttributeNames();t.change(e=>{const t=[];JR(i)&&!zR(i[0])?("forward"==this._direction&&t.push(...WR(i,e,{attributeNames:n})),t.push(...jR(i[0],e))):"forward"==this._direction?t.push(...WR(i,e,{expand:true,attributeNames:n})):t.push(...GR(i,e,{attributeNames:n}));for(const i of t){if(!i.hasAttribute("listType"))continue;const t=VR.first(i,{sameIndent:true});t&&e.setAttribute("listType",t.getAttribute("listType"),i);}this._fireAfterExecute(t);});}_fireAfterExecute(e){this.fire("afterExecute",YR(new Set(e)));}_checkEnabled(){let e=nO(this.editor.model.document.selection),t=e[0];if(!t)return  false;if("backward"==this._direction)return  true;if(JR(e)&&!zR(e[0]))return  true;e=qR(e),t=e[0];const i=VR.first(t,{sameIndent:true});return !!i&&i.getAttribute("listType")==t.getAttribute("listType")}}function nO(e){const t=Array.from(e.getSelectedBlocks()),i=t.findIndex(e=>!LR(e));return  -1!=i&&(t.length=i),t}class sO extends Ns{type;_listWalkerOptions;constructor(e,t,i={}){super(e),this.type=t,this._listWalkerOptions=i.multiLevel?{higherIndent:true,lowerIndent:true,sameAttributes:[]}:void 0;}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled();}execute(e={}){const t=this.editor.model,i=t.document,n=ZR(t),s=Array.from(i.selection.getSelectedBlocks()).filter(e=>t.schema.checkAttribute(e,"listType")||XR(e,t.schema)),o=void 0!==e.forceValue?!e.forceValue:this.value;t.change(r=>{if(o){const e=s[s.length-1],t=this.editor.plugins.get("ListEditing").getListAttributeNames(),i=FR(e,{direction:"forward"}),n=[];i.length>1&&n.push(...jR(i[1],r)),n.push(...KR(s,r,t)),n.push(...QR(e,r)),this._fireAfterExecute(n);}else if((n||i.selection.isCollapsed)&&LR(s[0])){const t=DR(n||s[0],this._listWalkerOptions);for(const i of t)r.setAttributes({...e.additionalAttributes,listType:this.type},i);this._fireAfterExecute(t);}else {const i=[];for(const n of s)if(n.hasAttribute("listType"))for(const t of qR(n,{withNested:false}))t.getAttribute("listType")!=this.type&&(r.setAttributes({...e.additionalAttributes,listType:this.type},t),i.push(t));else !n.is("element","listItem")&&XR(n,t.schema)&&r.rename(n,"listItem"),r.setAttributes({...e.additionalAttributes,listIndent:0,listItemId:BR.next(),listType:this.type},n),i.push(n);this._fireAfterExecute(i);}});}_fireAfterExecute(e){this.fire("afterExecute",YR(new Set(e)));}_getValue(){const e=this.editor.model.document.selection,t=Array.from(e.getSelectedBlocks());if(!t.length)return  false;for(const e of t)if(e.getAttribute("listType")!=this.type)return  false;return  true}_checkEnabled(){const e=this.editor.model,t=e.schema,i=e.document.selection,n=Array.from(i.getSelectedBlocks());if(!n.length)return  false;if(this.value)return  true;for(const e of n)if(t.checkAttribute(e,"listType")||XR(e,t))return  true;return  false}}class oO extends Ns{_direction;constructor(e,t){super(e),this._direction=t;}refresh(){this.isEnabled=this._checkEnabled();}execute({shouldMergeOnBlocksContentLevel:e=false}={}){const t=this.editor,i=t.model,n=i.document.selection,s=[],o=t.plugins.get("ListEditing").getListAttributeNames();i.change(t=>{const{firstElement:r,lastElement:a}=this._getMergeSubjectElements(n,e),l=r.getAttribute("listIndent")||0,c=a.getAttribute("listIndent"),u=a.getAttribute("listItemId");if(l!=c){const e=NR(a);s.push(...WR([a,...e],t,{indentBy:l-c,expand:l<c,attributeNames:o}));}if(e){let e=n;n.isCollapsed&&(e=t.createSelection(t.createRange(t.createPositionAt(r,"end"),t.createPositionAt(a,0)))),i.deleteContent(e,{doNotResetEntireContent:n.isCollapsed});const o=e.getLastPosition().parent,l=o.nextSibling;s.push(o),l&&l!==a&&l.getAttribute("listItemId")==u&&s.push(...$R(l,o,t));}else s.push(...$R(a,r,t));this._fireAfterExecute(s);});}_fireAfterExecute(e){this.fire("afterExecute",YR(new Set(e)));}_checkEnabled(){const e=this.editor.model,t=e.document.selection,i=ZR(e);if(t.isCollapsed||i){const e=i||t.getFirstPosition().parent;if(!LR(e))return  false;const n="backward"==this._direction?e.previousSibling:e.nextSibling;if(!n)return  false;if(JR([e,n]))return  false}else {const e=t.getLastPosition(),i=t.getFirstPosition();if(e.parent===i.parent)return  false;if(!LR(e.parent))return  false}return  true}_getMergeSubjectElements(e,t){const i=ZR(this.editor.model);let n,s;if(e.isCollapsed||i){const o=i||e.getFirstPosition().parent,r=zR(o);"backward"==this._direction?(s=o,n=r&&!t?VR.first(o,{sameIndent:true,lowerIndent:true}):o.previousSibling):(n=o,s=o.nextSibling);}else n=e.getFirstPosition().parent,s=e.getLastPosition().parent;return {firstElement:n,lastElement:s}}}class rO extends Ns{_direction;constructor(e,t){super(e),this._direction=t;}refresh(){this.isEnabled=this._checkEnabled();}execute(){this.editor.model.change(e=>{const t=jR(this._getStartBlock(),e);this._fireAfterExecute(t);});}_fireAfterExecute(e){this.fire("afterExecute",YR(new Set(e)));}_checkEnabled(){const e=this.editor.model.document.selection,t=this._getStartBlock();return e.isCollapsed&&LR(t)&&!zR(t)}_getStartBlock(){const e=this.editor.model.document.selection.getFirstPosition().parent;return "before"==this._direction?e:e.nextSibling}}class aO extends Ms{static get pluginName(){return "ListItemBoldIntegration"}static get isOfficialPlugin(){return  true}static get requires(){return [NO]}init(){const e=this.editor,t=e.plugins.get("ListFormatting"),i=e.plugins.get(NO);e.plugins.has("BoldEditing")&&this.editor.config.get("list.enableListItemMarkerFormatting")&&(t.registerFormatAttribute("bold","listItemBold"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemBold",setAttributeOnDowncast(e,t,i,s){t&&(e.addClass("ck-list-marker-bold",i),!n.isSafari||s&&s.dataPipeline||e.setStyle("--ck-content-list-marker-dummy-bold","0",i));}}));}afterInit(){const e=this.editor,t=e.model;e.plugins.has("BoldEditing")&&this.editor.config.get("list.enableListItemMarkerFormatting")&&(t.schema.extend("$listItem",{allowAttributes:"listItemBold"}),t.schema.setAttributeProperties("listItemBold",{isFormatting:true}),t.schema.addAttributeCheck(e=>{if(!e.last.getAttribute("listItemId"))return  false},"listItemBold"),e.conversion.for("upcast").attributeToAttribute({model:"listItemBold",view:{name:"li",classes:"ck-list-marker-bold"}}));}}class lO extends Ms{static get pluginName(){return "ListItemItalicIntegration"}static get isOfficialPlugin(){return  true}static get requires(){return [NO]}init(){const e=this.editor,t=e.plugins.get("ListFormatting"),i=e.plugins.get(NO);e.plugins.has("ItalicEditing")&&this.editor.config.get("list.enableListItemMarkerFormatting")&&(t.registerFormatAttribute("italic","listItemItalic"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemItalic",setAttributeOnDowncast(e,t,i,s){t&&(e.addClass("ck-list-marker-italic",i),!n.isSafari||s&&s.dataPipeline||e.setStyle("--ck-content-list-marker-dummy-italic","0",i));}}));}afterInit(){const e=this.editor,t=e.model;e.plugins.has("ItalicEditing")&&this.editor.config.get("list.enableListItemMarkerFormatting")&&(t.schema.extend("$listItem",{allowAttributes:"listItemItalic"}),t.schema.setAttributeProperties("listItemItalic",{isFormatting:true}),t.schema.addAttributeCheck(e=>{if(!e.last.getAttribute("listItemId"))return  false},"listItemItalic"),e.conversion.for("upcast").attributeToAttribute({model:"listItemItalic",view:{name:"li",classes:"ck-list-marker-italic"}}));}}class cO extends Ms{static get pluginName(){return "ListItemFontSizeIntegration"}static get isOfficialPlugin(){return  true}static get requires(){return [NO]}init(){const e=this.editor,t=e.plugins.get("ListFormatting"),i=e.plugins.get(NO);if(!e.plugins.has("FontSizeEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting"))return;const s=vP(e.config.get("fontSize.options"));t.registerFormatAttribute("fontSize","listItemFontSize"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemFontSize",setAttributeOnDowncast(e,t,i,o){if(t){const r=s.find(e=>e.model==t);r&&r.view&&"string"!=typeof r.view?r.view.styles?(e.addClass("ck-list-marker-font-size",i),e.setStyle("--ck-content-list-marker-font-size",r.view.styles["font-size"],i)):r.view.classes&&(e.addClass(`ck-list-marker-font-size-${t}`,i),!n.isSafari||o&&o.dataPipeline||e.setStyle("--ck-content-list-marker-dummy-font-size","0",i)):(e.addClass("ck-list-marker-font-size",i),e.setStyle("--ck-content-list-marker-font-size",t,i));}}});}afterInit(){const e=this.editor,t=e.model;if(!e.plugins.has("FontSizeEditing")||!this.editor.config.get("list.enableListItemMarkerFormatting"))return;t.schema.extend("$listItem",{allowAttributes:"listItemFontSize"}),t.schema.setAttributeProperties("listItemFontSize",{isFormatting:true}),t.schema.addAttributeCheck(e=>{if(!e.last.getAttribute("listItemId"))return  false},"listItemFontSize"),e.conversion.for("upcast").elementToAttribute({model:{key:"listItemFontSize",value:e=>e.getStyle("--ck-content-list-marker-font-size")},view:{name:"li",classes:"ck-list-marker-font-size",styles:{"--ck-content-list-marker-font-size":/.*/}}});const i=vP(e.config.get("fontSize.options"));for(const t of i)t.model&&t.view&&e.conversion.for("upcast").elementToAttribute({model:{key:"listItemFontSize",value:t.model},view:{name:"li",classes:`ck-list-marker-font-size-${t.model}`}});}}class uO extends Ms{static get pluginName(){return "ListItemFontColorIntegration"}static get isOfficialPlugin(){return  true}static get requires(){return [NO]}init(){const e=this.editor,t=e.plugins.get("ListFormatting"),i=e.plugins.get(NO);e.plugins.has("FontColorEditing")&&this.editor.config.get("list.enableListItemMarkerFormatting")&&(t.registerFormatAttribute("fontColor","listItemFontColor"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemFontColor",setAttributeOnDowncast(e,t,i){t&&(e.addClass("ck-list-marker-color",i),e.setStyle("--ck-content-list-marker-color",t,i));}}));}afterInit(){const e=this.editor,t=e.model;e.plugins.has("FontColorEditing")&&this.editor.config.get("list.enableListItemMarkerFormatting")&&(t.schema.extend("$listItem",{allowAttributes:"listItemFontColor"}),t.schema.setAttributeProperties("listItemFontColor",{isFormatting:true}),t.schema.addAttributeCheck(e=>{if(!e.last.getAttribute("listItemId"))return  false},"listItemFontColor"),e.conversion.for("upcast").attributeToAttribute({model:{key:"listItemFontColor",value:e=>e.getStyle("--ck-content-list-marker-color")},view:{name:"li",classes:"ck-list-marker-color",styles:{"--ck-content-list-marker-color":/.*/}}}));}}class dO extends Ms{static get pluginName(){return "ListItemFontFamilyIntegration"}static get isOfficialPlugin(){return  true}static get requires(){return [NO]}init(){const e=this.editor,t=e.plugins.get("ListFormatting"),i=e.plugins.get(NO);e.plugins.has("FontFamilyEditing")&&this.editor.config.get("list.enableListItemMarkerFormatting")&&(t.registerFormatAttribute("fontFamily","listItemFontFamily"),i.registerDowncastStrategy({scope:"item",attributeName:"listItemFontFamily",setAttributeOnDowncast(e,t,i){t&&(e.addClass("ck-list-marker-font-family",i),e.setStyle("--ck-content-list-marker-font-family",t,i));}}));}afterInit(){const e=this.editor,t=e.model;e.plugins.has("FontFamilyEditing")&&this.editor.config.get("list.enableListItemMarkerFormatting")&&(t.schema.extend("$listItem",{allowAttributes:"listItemFontFamily"}),t.schema.setAttributeProperties("listItemFontFamily",{isFormatting:true}),t.schema.addAttributeCheck(e=>{if(!e.last.getAttribute("listItemId"))return  false},"listItemFontFamily"),e.conversion.for("upcast").attributeToAttribute({model:{key:"listItemFontFamily",value:e=>e.getStyle("--ck-content-list-marker-font-family")},view:{name:"li",classes:"ck-list-marker-font-family",styles:{"--ck-content-list-marker-font-family":/.*/}}}));}}class hO extends Ms{_loadedFormatting={};static get pluginName(){return "ListFormatting"}static get isOfficialPlugin(){return  true}static get requires(){return [aO,lO,cO,uO,dO]}constructor(e){super(e),e.config.define("list.enableListItemMarkerFormatting",true);}afterInit(){this.editor.config.get("list.enableListItemMarkerFormatting")&&this._registerPostfixerForListItemFormatting();}_registerPostfixerForListItemFormatting(){const e=this.editor.model;e.document.registerPostFixer(t=>{const i=e.document.differ.getChanges(),n=new Set;let s=false;for(const e of i)if("attribute"===e.type)("listItemId"==e.attributeKey||"listType"==e.attributeKey||this._isInlineOrSelectionFormatting(e.attributeKey)||Object.values(this._loadedFormatting).includes(e.attributeKey))&&(LR(e.range.start.nodeAfter)?n.add(e.range.start.nodeAfter):LR(e.range.start.parent)&&n.add(e.range.start.parent));else if(LR(e.position.nodeAfter)&&n.add(e.position.nodeAfter),LR(e.position.nodeBefore)&&n.add(e.position.nodeBefore),LR(e.position.parent)&&n.add(e.position.parent),"insert"==e.type&&"$text"!=e.name){const i=t.createRangeIn(e.position.nodeAfter);for(const e of i.getItems())LR(e)&&n.add(e);}for(const i of n){const n=mO(e,i,Object.keys(this._loadedFormatting));for(const[e,o]of Object.entries(n)){const n=this._loadedFormatting[e];(o&&fO(t,i,n,o)||!o&&pO(t,i,n))&&(s=true);}}return s});}registerFormatAttribute(e,t){this._loadedFormatting[e]=t;}_isInlineOrSelectionFormatting(e){return e.replace(/^selection:/,"")in this._loadedFormatting}}function mO(e,t,i){if(zR(t))return gO(e,t,i);return gO(e,MR(t)[0],i)}function gO(e,t,i){if(!function(e){return ["numbered","bulleted","customNumbered","customBulleted"].includes(e.getAttribute("listType"))}(t)||e.schema.isLimit(t))return Object.fromEntries(i.map(e=>[e]));if(t.isEmpty)return Object.fromEntries(i.map(e=>[e,t.getAttribute(`selection:${e}`)]));const n=new Set(i),s={},o=e.createRangeIn(t).getWalker({ignoreElementEnd:true});for(const{item:t}of o){for(const i of n)if(e.schema.checkAttribute(t,i)){const e=t.getAttribute(i);void 0===e?(n.delete(i),s[i]=void 0):void 0===s[i]?s[i]=e:s[i]!==e&&(n.delete(i),s[i]=void 0);}else i in s||(s[i]=void 0);if(!n.size)break;e.schema.isLimit(t)&&o.jumpTo(e.createPositionAfter(t));}return s}function fO(e,t,i,n){const s=MR(t);let o=false;for(const t of s)t.hasAttribute(i)&&t.getAttribute(i)===n||(e.setAttribute(i,n,t),o=true);return o}function pO(e,t,i){const n=MR(t);let s=false;for(const t of n)t.hasAttribute(i)&&(e.removeAttribute(i,t),s=true);return s}class bO extends Ms{static get pluginName(){return "ListUtils"}static get isOfficialPlugin(){return  true}expandListBlocksToCompleteList(e){return UR(e)}isFirstBlockOfListItem(e){return zR(e)}isListItemBlock(e){return LR(e)}expandListBlocksToCompleteItems(e,t={}){return qR(e,t)}isNumberedListType(e){return eO(e)}isFirstListItemInList(e){return function(e){return !VR.first(e,{sameIndent:true,sameAttributes:"listType"})}(e)}}function wO(e){return e.is("element","ol")||e.is("element","ul")}function vO(e){return e.is("element","li")}function _O(e){let t=0,i=e.parent;for(;i;){if(vO(i))t++;else {const e=i.previousSibling;e&&vO(e)&&t++;}i=i.parent;}return t}function yO(e,t,i,n=xO(i,t)){return e.createAttributeElement(CO(i),null,{priority:2*t/100-100,id:n})}function kO(e,t,i){return e.createAttributeElement("li",null,{priority:(2*t+1)/100-100,id:i})}function CO(e){return "numbered"==e||"customNumbered"==e?"ol":"ul"}function xO(e,t){return `list-${e}-${t}`}function AO(e,t,i){const n=e.nodeBefore;if(LR(n)){let e=n;for(const{node:s}of new RR(e,"backward")){if(e=s,i.has(e))return;if(i.add(e),t.has(n))return}t.add(e);}else {const i=e.nodeAfter;LR(i)&&t.add(i);}}function EO(e,t){let i=0,n=-1,s=null,o=false;for(const{node:r}of e){const e=r.getAttribute("listIndent");if(e>i){let a;null===s?(s=e-i,a=i):(s>e&&(s=e),a=e-s),a>n+1&&(a=n+1),t.setAttribute("listIndent",a,r),o=true,n=a;}else s=null,i=e+1,n=e;}return o}function TO(e,t,i){const n=new Set;let s=false;for(const{node:o}of e){if(n.has(o))continue;let e=o.getAttribute("listType"),r=o.getAttribute("listItemId");if(t.has(r)&&(r=BR.next()),t.add(r),o.is("element","listItem"))o.getAttribute("listItemId")!=r&&(i.setAttribute("listItemId",r,o),s=true);else for(const t of FR(o,{direction:"forward"}))n.add(t),t.getAttribute("listType")!=e&&(r=BR.next(),e=t.getAttribute("listType")),t.getAttribute("listItemId")!=r&&(i.setAttribute("listItemId",r,t),s=true);}return s}function SO(){return (e,t,i)=>{const{writer:n,schema:s}=i;if(!t.modelRange)return;const o=Array.from(t.modelRange.getItems({shallow:true})).filter(e=>s.checkAttribute(e,"listItemId"));if(!o.length)return;const r=t.viewItem.getAttribute("data-list-item-id")||BR.next();i.consumable.consume(t.viewItem,{attributes:"data-list-item-id"});const a=_O(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 u={listItemId:r,listIndent:a,listType:l};for(const e of o)e.hasAttribute("listItemId")||n.setAttributes(u,e);o.length>1&&o[1].getAttribute("listItemId")!=u.listItemId&&i.keepEmptyElement(o[0]);}}function IO(e,t,i,n){return ()=>{const n=e.document.differ.getChanges(),r=[],a=new Set,l=new Set,c=new Set;for(const e of n)if("insert"==e.type&&"$text"!=e.name)AO(e.position,a,c),e.attributes.has("listItemId")?l.add(e.position.nodeAfter):AO(e.position.getShiftedBy(e.length),a,c);else if("remove"==e.type&&e.attributes.has("listItemId"))AO(e.position,a,c);else if("attribute"==e.type){const t=e.range.start.nodeAfter;i.includes(e.attributeKey)?(AO(e.range.start,a,c),null===e.attributeNewValue?(AO(e.range.start.getShiftedBy(1),a,c),o(t)&&r.push(t)):l.add(t)):LR(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 n=[],s=new Set,a=[];for(const{node:l,previous:c}of new RR(e)){if(s.has(l))continue;const e=l.getAttribute("listIndent");c&&e<c.getAttribute("listIndent")&&(a.length=e+1),a[e]={modelAttributes:Object.fromEntries(Array.from(l.getAttributes()).filter(([e])=>i.includes(e))),modelElement:l};const u=FR(l,{direction:"forward"});for(const e of u)s.add(e),(o(e,u)||r(e,a,t))&&n.push(e);}return n}function o(e,s){const o=t.mapper.toViewElement(e);if(!o)return  false;if(function(e){e=e.parent;for(;e.is("attributeElement")&&["ol","ul","li"].includes(e.name);)e=e.parent;if(e.getCustomProperty("$structureSlotParent")&&!t.mapper.toModelElement(e))return  true;return  false}(o))return  true;if(n.fire("checkElement",{modelElement:e,viewElement:o}))return  true;if(!e.is("element","paragraph")&&!e.is("element","listItem"))return  false;const r=MO(e,i,s);return !(!r||!o.is("element","p"))||!(r||!o.is("element","span"))}function r(e,i,s){if(s.has(e))return  false;const o=t.mapper.toViewElement(e);let r=i.length-1;for(let e=o.parent;!e.is("editableElement");e=e.parent){const t=vO(e),s=wO(e);if(!s&&!t)continue;const o="checkAttributes:"+(t?"item":"list");if(n.fire(o,{viewElement:e,modelAttributes:i[r].modelAttributes,modelReferenceElement:i[r].modelElement}))break;if(s&&(r--,r<0))return  false}return  true}}function PO(e,t,i,{dataPipeline:n}={}){const s=function(e,t){const i=t.filter(e=>false===e.consume).map(e=>e.attributeName);return (t,n)=>{const s=[];for(const n of e)t.hasAttribute(n)&&!i.includes(n)&&s.push(`attribute:${n}`);return !!s.every(e=>false!==n.test(t,e))&&(s.forEach(e=>n.consume(t,e)),true)}}(e,t);return (o,r,a)=>{const{writer:l,mapper:c,consumable:u}=a,d=r.item;if(!e.includes(r.attributeKey))return;if(!s(d,u))return;const h={...a.options,dataPipeline:n},m=OO(d,c,i,l);LO(m,l,c),function(e,t){let i=e.parent;for(;i.is("attributeElement")&&["ul","ol","li"].includes(i.name);){const n=i.parent;t.unwrap(t.createRangeOn(e),i),i=n;}}(m,l);const g=function(e,t,i,n,{dataPipeline:s}){let o=n.createRangeOn(t);if(!zR(e))return o;for(const r of i){if("itemMarker"!=r.scope)continue;const i=r.createElement(n,e,{dataPipeline:s});if(!i)continue;if(n.setCustomProperty("listItemMarker",true,i),r.canInjectMarkerIntoElement&&r.canInjectMarkerIntoElement(e)?n.insert(n.createPositionAt(t,0),i):(n.insert(o.start,i),o=n.createRange(n.createPositionBefore(i),n.createPositionAfter(t))),!r.createWrapperElement||!r.canWrapElement)continue;const a=r.createWrapperElement(n,e,{dataPipeline:s});n.setCustomProperty("listItemWrapper",true,a),r.canWrapElement(e)?o=n.wrap(o,a):(o=n.wrap(n.createRangeOn(i),a),o=n.createRange(o.start,n.createPositionAfter(t)));}return o}(d,m,t,l,h);!function(e,t,i,n,s){if(!e.hasAttribute("listIndent"))return;const o=e.getAttribute("listIndent");let r=e;for(let e=o;e>=0;e--){const o=kO(n,e,r.getAttribute("listItemId")),a=yO(n,e,r.getAttribute("listType"));for(const e of i)"list"!=e.scope&&"item"!=e.scope||!r.hasAttribute(e.attributeName)||e.setAttributeOnDowncast(n,r.getAttribute(e.attributeName),"list"==e.scope?a:o,s,r);if(t=n.wrap(t,o),t=n.wrap(t,a),0==e)break;if(r=VR.first(r,{lowerIndent:true}),!r)break}}(d,g,t,l,h);}}function VO(e){return (t,i,n)=>{const{writer:s,mapper:o}=n,r=t.name.split(":")[1];if(!e.checkAttribute(r,"listItemId"))return;const a=o.toViewPosition(i.position),l=i.position.getShiftedBy(i.length),c=o.toViewPosition(l,{isPhantom:true}),u=s.createRange(a,c).getTrimmed().end.nodeBefore;u&&LO(u,s,o);}}function RO(e,{dataPipeline:t}={}){return (i,{writer:n})=>{if(!MO(i,e))return null;if(!t)return n.createContainerElement("span",{class:"ck-list-bogus-paragraph"});const s=n.createContainerElement("p");return n.setCustomProperty("dataPipeline:transparentRendering",true,s),s}}function OO(e,t,i,n){const s=i.createRangeOn(e),o=t.toViewRange(s).getTrimmed().getWalker();for(const{item:e}of o)if(e.is("element")&&e.getCustomProperty("listItemMarker"))o.jumpTo(n.createPositionAfter(e));else if(e.is("element")&&!e.getCustomProperty("listItemWrapper"))return e}function BO(e,t){return (i,n)=>{if(n.modelPosition.offset>0)return;const s=n.modelPosition.parent;if(!LR(s))return;if(!e.some(e=>"itemMarker"==e.scope&&e.canInjectMarkerIntoElement&&e.canInjectMarkerIntoElement(s)))return;const o=n.mapper.toViewElement(s),r=t.createRangeIn(o),a=r.getWalker();let l=r.start;for(const{item:e}of a){if(e.is("element")&&n.mapper.toModelElement(e)||e.is("$textProxy"))break;e.is("element")&&e.getCustomProperty("listItemMarker")&&(l=t.createPositionAfter(e),a.skip(({previousPosition:e})=>!e.isEqual(l)));}n.viewPosition=l;}}function LO(e,t,i){for(;e.parent.is("attributeElement")&&e.parent.getCustomProperty("listItemWrapper");)t.unwrap(t.createRangeOn(e),e.parent);const n=[];s(t.createPositionBefore(e).getWalker({direction:"backward"})),s(t.createRangeIn(e).getWalker());for(const e of n)t.remove(e);function s(e){for(const{item:t}of e){if(t.is("element")&&i.toModelElement(t))break;t.is("element")&&t.getCustomProperty("listItemMarker")&&n.push(t);}}}function MO(e,t,i=MR(e)){if(!LR(e))return  false;for(const i of e.getAttributeKeys())if(!i.startsWith("selection:")&&"htmlEmptyBlock"!=i&&!t.includes(i))return  false;return i.length<2}const FO=["listType","listIndent","listItemId"];class NO extends Ms{_downcastStrategies=[];static get pluginName(){return "ListEditing"}static get isOfficialPlugin(){return  true}static get requires(){return [Rk,py,bO,tx,hO]}constructor(e){super(e),e.config.define("list.multiBlock",true);}init(){const e=this.editor,t=e.model,i=e.config.get("list.multiBlock");if(e.plugins.has("LegacyListEditing"))throw new I("list-feature-conflict",this,{conflictPlugin:"LegacyListEditing"});t.schema.register("$listItem",{allowAttributes:FO}),i?(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 e of FO)t.schema.setAttributeProperties(e,{copyOnReplace:true});e.commands.add("numberedList",new sO(e,"numbered")),e.commands.add("bulletedList",new sO(e,"bulleted")),e.commands.add("customNumberedList",new sO(e,"customNumbered",{multiLevel:true})),e.commands.add("customBulletedList",new sO(e,"customBulleted",{multiLevel:true})),e.commands.add("indentList",new iO(e,"forward")),e.commands.add("outdentList",new iO(e,"backward")),e.commands.add("splitListItemBefore",new rO(e,"before")),e.commands.add("splitListItemAfter",new rO(e,"after")),i&&(e.commands.add("mergeListItemBackward",new oO(e,"backward")),e.commands.add("mergeListItemForward",new oO(e,"forward"))),this._setupDeleteIntegration(),this._setupEnterIntegration(),this._setupTabIntegration(),this._setupClipboardIntegration(),this._setupAccessibilityIntegration(),this._setupListItemIdConversionStrategy();}afterInit(){const e=this.editor.commands,t=e.get("indent"),i=e.get("outdent");t&&t.registerChildCommand(e.get("indentList"),{priority:"high"}),i&&i.registerChildCommand(e.get("outdentList"),{priority:"lowest"}),this._setupModelPostFixing(),this._setupConversion();}registerDowncastStrategy(e){this._downcastStrategies.push(e);}getListAttributeNames(){return [...FO,...this._downcastStrategies.map(e=>e.attributeName)]}_setupDeleteIntegration(){const e=this.editor,t=e.commands.get("mergeListItemBackward"),i=e.commands.get("mergeListItemForward");this.listenTo(e.editing.view.document,"delete",(n,s)=>{const o=e.model.document.selection;ZR(e.model)||e.model.change(()=>{const r=o.getFirstPosition();if(o.isCollapsed&&"backward"==s.direction){if(!r.isAtStart)return;const i=r.parent;if(!LR(i))return;if(VR.first(i,{sameAttributes:"listType",sameIndent:true})||0!==i.getAttribute("listIndent")){if(!t||!t.isEnabled)return;t.execute({shouldMergeOnBlocksContentLevel:DO(e.model,"backward")});}else HR(i)||e.execute("splitListItemAfter"),e.execute("outdentList");s.preventDefault(),n.stop();}else {if(o.isCollapsed&&!o.getLastPosition().isAtEnd)return;if(!i||!i.isEnabled)return;i.execute({shouldMergeOnBlocksContentLevel:DO(e.model,"forward")}),s.preventDefault(),n.stop();}});},{context:"li"});}_setupEnterIntegration(){const e=this.editor,t=e.model,i=e.commands,n=i.get("enter");this.listenTo(e.editing.view.document,"enter",(i,n)=>{const s=t.document,o=s.selection.getFirstPosition().parent;if(s.selection.isCollapsed&&LR(o)&&o.isEmpty&&!n.isSoft){const t=zR(o),s=HR(o);t&&s?(e.execute("outdentList"),n.preventDefault(),i.stop()):t&&!s?(e.execute("splitListItemAfter"),n.preventDefault(),i.stop()):s&&(e.execute("splitListItemBefore"),n.preventDefault(),i.stop());}},{context:"li"}),this.listenTo(n,"afterExecute",()=>{const t=i.get("splitListItemBefore");if(t.refresh(),!t.isEnabled)return;2===MR(e.model.document.selection.getLastPosition().parent).length&&t.execute();});}_setupTabIntegration(){const e=this.editor;this.listenTo(e.editing.view.document,"tab",(t,i)=>{const n=i.shiftKey?"outdentList":"indentList";this.editor.commands.get(n).isEnabled&&(e.execute(n),i.stopPropagation(),i.preventDefault(),t.stop());},{context:"li"});}_setupConversion(){const e=this.editor,t=e.model,i=this.getListAttributeNames(),n=e.config.get("list.multiBlock"),s=n?"paragraph":"listItem";e.conversion.for("upcast").elementToElement({view:"li",model:(e,{writer: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",SO());}),n||e.conversion.for("downcast").elementToElement({model:"listItem",view:"p"}),e.conversion.for("editingDowncast").elementToElement({model:s,view:RO(i),converterPriority:"high"}).add(e=>{e.on("attribute",PO(i,this._downcastStrategies,t)),e.on("remove",VO(t.schema));}),e.conversion.for("dataDowncast").elementToElement({model:s,view:RO(i,{dataPipeline:true}),converterPriority:"high"}).add(e=>{e.on("attribute",PO(i,this._downcastStrategies,t,{dataPipeline:true}));});const o=BO(this._downcastStrategies,e.editing.view);e.editing.mapper.on("modelToViewPosition",o),e.data.mapper.on("modelToViewPosition",o),this.listenTo(t.document,"change:data",IO(t,e.editing,i,this),{priority:"high"}),this.on("checkAttributes:item",(e,{viewElement:t,modelAttributes:i})=>{t.id!=i.listItemId&&(e.return=true,e.stop());}),this.on("checkAttributes:list",(e,{viewElement:t,modelAttributes:i})=>{t.name==CO(i.listType)&&t.id==xO(i.listType,i.listIndent)||(e.return=true,e.stop());});}_setupModelPostFixing(){const e=this.editor.model,t=this.getListAttributeNames();e.document.registerPostFixer(i=>function(e,t,i,n){const s=e.document.differ.getChanges(),o=new Set,r=new Set,a=n.editor.config.get("list.multiBlock");let l=false;for(const n of s){if("insert"==n.type&&"$text"!=n.name){const s=n.position.nodeAfter;if(!e.schema.checkAttribute(s,"listItemId"))for(const e of Array.from(s.getAttributeKeys()))i.includes(e)&&(t.removeAttribute(e,s),l=true);AO(n.position,r,o),n.attributes.has("listItemId")||AO(n.position.getShiftedBy(n.length),r,o);for(const{item:t,previousPosition:i}of e.createRangeIn(s))LR(t)&&AO(i,r,o);}else "remove"==n.type?AO(n.position,r,o):"attribute"==n.type&&i.includes(n.attributeKey)&&(AO(n.range.start,r,o),null===n.attributeNewValue&&AO(n.range.start.getShiftedBy(1),r,o));if(!a&&"attribute"==n.type&&FO.includes(n.attributeKey)){const e=n.range.start.nodeAfter;null===n.attributeNewValue&&e&&e.is("element","listItem")?(t.rename(e,"paragraph"),l=true):null===n.attributeOldValue&&e&&e.is("element")&&"listItem"!=e.name&&(t.rename(e,"listItem"),l=true);}}const c=new Set;for(const e of r.values())l=n.fire("postFixer",{listNodes:new OR(e),listHead:e,writer:t,seenIds:c})||l;return l}(e,i,t,this)),this.on("postFixer",(e,{listNodes:t,writer:i})=>{e.return=EO(t,i)||e.return;},{priority:"high"}),this.on("postFixer",(e,{listNodes:t,writer:i,seenIds:n})=>{e.return=TO(t,n,i)||e.return;},{priority:"high"});}_setupClipboardIntegration(){const e=this.editor.model,t=this.editor.plugins.get("ClipboardPipeline");this.listenTo(e,"insertContent",function(e){return (t,[i,n])=>{const s=i.is("documentFragment")?Array.from(i.getChildren()):[i];if(!s.length)return;const o=(n?e.createSelection(n):e.document.selection).getFirstPosition();let r;if(LR(o.parent))r=o.parent;else {if(!LR(o.nodeBefore)||!LR(o.nodeAfter))return;r=o.nodeBefore;}e.change(e=>{const t=r.getAttribute("listType"),i=r.getAttribute("listIndent"),n=s[0].getAttribute("listIndent")||0,o=Math.max(i-n,0);for(const i of s){const n=LR(i);r.is("element","listItem")&&i.is("element","paragraph")&&e.rename(i,"listItem"),e.setAttributes({listIndent:(n?i.getAttribute("listIndent"):0)+o,listItemId:n?i.getAttribute("listItemId"):BR.next(),listType:t},i);}});}}(e),{priority:"high"}),this.listenTo(t,"outputTransformation",(t,i)=>{e.change(e=>{const t=Array.from(i.content.getChildren()),n=t[t.length-1];if(t.length>1&&n.is("element")&&n.isEmpty){t.slice(0,-1).every(LR)&&e.remove(n);}if("copy"==i.method||"cut"==i.method){const t=Array.from(i.content.getChildren());JR(t)&&KR(t,e,this.getListAttributeNames());}});});}_setupAccessibilityIntegration(){const e=this.editor,t=e.t;e.accessibility.addKeystrokeInfoGroup({id:"list",label:t("Keystrokes that can be used in a list"),keystrokes:[{label:t("Increase list item indent"),keystroke:"Tab"},{label:t("Decrease list item indent"),keystroke:"Shift+Tab"}]});}_setupListItemIdConversionStrategy(){this.registerDowncastStrategy({scope:"item",attributeName:"listItemId",setAttributeOnDowncast(e,t,i,n){n&&(n.skipListItemIds||n.isClipboardPipeline)||e.setAttribute("data-list-item-id",t,i);}});}}function DO(e,t){const i=e.document.selection;if(!i.isCollapsed)return !ZR(e);if("forward"===t)return  true;const n=i.getFirstPosition().parent,s=n.previousSibling;return !e.schema.isObject(s)&&(!!s.isEmpty||JR([n,s]))}function zO(e,t,i,n){e.ui.componentFactory.add(t,()=>{const s=HO(Bp,e,t,i,n);return s.set({tooltip:true,isToggleable:true}),s}),e.ui.componentFactory.add(`menuBar:${t}`,()=>{const s=HO(Jp,e,t,i,n);return s.set({role:"menuitemcheckbox",isToggleable:true}),s});}function HO(e,t,i,n,s){const o=t.commands.get(i),r=new e(t.locale);return r.set({label:n,icon:s}),r.bind("isOn","isEnabled").to(o,"value","isEnabled"),r.on("execute",()=>{t.execute(i),t.editing.view.focus();}),r}class qO extends Ms{static get pluginName(){return "ListUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor.t;this.editor.ui.componentFactory.has("numberedList")||zO(this.editor,"numberedList",e("Numbered List"),ef),this.editor.ui.componentFactory.has("bulletedList")||zO(this.editor,"bulletedList",e("Bulleted List"),fm);}}class UO extends Ms{static get requires(){return [NO,qO]}static get pluginName(){return "List"}static get isOfficialPlugin(){return  true}}class jO extends Ns{refresh(){const e=this._getValue();this.value=e,this.isEnabled=null!=e;}execute({startIndex:e=1}={}){const t=this.editor.model,i=t.document;let n=Array.from(i.selection.getSelectedBlocks()).filter(e=>LR(e)&&eO(e.getAttribute("listType")));n=UR(n),t.change(t=>{for(const i of n)t.setAttribute("listStart",e>=0?e:1,i);});}_getValue(){const e=Cn(this.editor.model.document.selection.getSelectedBlocks());return e&&LR(e)&&eO(e.getAttribute("listType"))?e.getAttribute("listStart"):null}}const $O={},WO={},GO={},KO=[{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"},{listStyle:"arabic-indic",typeAttribute:null,listType:"numbered"}];for(const{listStyle:e,typeAttribute:t,listType:i}of KO)$O[e]=i,WO[e]=t,t&&(GO[t]=e);function JO(){return KO.map(e=>e.listStyle)}function QO(e){return $O[e]||null}function YO(e){return GO[e]||null}function ZO(e){return WO[e]||null}function XO(e){switch(e){case "lower-alpha":return "lower-latin";case "upper-alpha":return "upper-latin";default:return e}}class eB extends Ns{defaultType;_supportedTypes;constructor(e,t,i){super(e),this.defaultType=t,this._supportedTypes=i;}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled();}execute(e={}){const t=this.editor.model,i=t.document;t.change(t=>{this._tryToConvertItemsToList(e);let n=Array.from(i.selection.getSelectedBlocks()).filter(e=>e.hasAttribute("listType"));if(n.length){n=UR(n);for(const i of n)t.setAttribute("listStyle",e.type||this.defaultType,i);}});}isStyleTypeSupported(e){return !this._supportedTypes||this._supportedTypes.includes(e)}_getValue(){const e=Cn(this.editor.model.document.selection.getSelectedBlocks());return LR(e)?e.getAttribute("listStyle"):null}_checkEnabled(){const e=this.editor,t=e.commands.get("numberedList"),i=e.commands.get("bulletedList");return t.isEnabled||i.isEnabled}_tryToConvertItemsToList(e){if(!e.type)return;const t=QO(e.type);if(!t)return;const i=this.editor,n=`${t}List`;i.commands.get(n).value||i.execute(n);}}class tB extends Ns{refresh(){const e=this._getValue();this.value=e,this.isEnabled=null!=e;}execute(e={}){const t=this.editor.model,i=t.document;let n=Array.from(i.selection.getSelectedBlocks()).filter(e=>LR(e)&&"numbered"==e.getAttribute("listType"));n=UR(n),t.change(t=>{for(const i of n)t.setAttribute("listReversed",!!e.reversed,i);});}_getValue(){const e=Cn(this.editor.model.document.selection.getSelectedBlocks());return LR(e)&&"numbered"==e.getAttribute("listType")?e.getAttribute("listReversed"):null}}function iB(e){return (t,i,n)=>{const{writer:s,schema:o,consumable:r}=n;if(false===r.test(i.viewItem,e.viewConsumables))return;i.modelRange||Object.assign(i,n.convertChildren(i.viewItem,i.modelCursor));let a=false;for(const t of i.modelRange.getItems({shallow:true}))o.checkAttribute(t,e.attributeName)&&e.appliesToListItem(t)&&(t.hasAttribute(e.attributeName)||(s.setAttribute(e.attributeName,e.getAttributeOnUpcast(i.viewItem),t),a=true));a&&r.consume(i.viewItem,e.viewConsumables);}}class nB extends Ms{static get pluginName(){return "ListPropertiesUtils"}static get isOfficialPlugin(){return  true}getAllSupportedStyleTypes(){return JO()}getListTypeFromListStyleType(e){return QO(e)}getListStyleTypeFromTypeAttribute(e){return YO(e)}getTypeAttributeFromListStyleType(e){return ZO(e)}}function sB(e){const{startIndex:t,reversed:i,styles:n}=e;return {styles:oB(n),startIndex:t||false,reversed:i||false}}function oB(e){const t={listTypes:["bulleted","numbered"],useAttribute:false,listStyleTypes:{numbered:["decimal","decimal-leading-zero","lower-roman","upper-roman","lower-latin","upper-latin"],bulleted:["disc","circle","square"]}};return  true===e||(e?Array.isArray(e)||"string"==typeof e?(t.listTypes=pn(e),t.listStyleTypes=Et(t.listStyleTypes,t.listTypes)):(t.listTypes=e.listTypes?pn(e.listTypes):t.listTypes,t.useAttribute=!!e.useAttribute,e.listStyleTypes?t.listStyleTypes=e.listStyleTypes:t.listStyleTypes=Et(t.listStyleTypes,t.listTypes)):(t.listTypes=[],t.listStyleTypes={})),t}const rB="default";class aB extends Ms{static get requires(){return [NO,nB]}static get pluginName(){return "ListPropertiesEditing"}static get licenseFeatureCode(){return "LP"}static get isOfficialPlugin(){return  true}static get isPremiumPlugin(){return  true}constructor(e){super(e),e.config.define("list.properties",{styles:true,startIndex:false,reversed:false});}init(){const e=this.editor,t=e.model,i=e.plugins.get(NO),n=function(e){const t=[],i=sB(e);if(e.styles){const e=i.styles.useAttribute;t.push({attributeName:"listStyle",defaultValue:rB,viewConsumables:{styles:"list-style-type"},addCommand(t){let i=JO();e&&(i=i.filter(e=>!!ZO(e))),t.commands.add("listStyle",new eB(t,rB,i));},appliesToListItem:e=>"numbered"==e.getAttribute("listType")||"bulleted"==e.getAttribute("listType"),hasValidAttribute(e){if(!this.appliesToListItem(e))return !e.hasAttribute("listStyle");if(!e.hasAttribute("listStyle"))return  false;const t=e.getAttribute("listStyle");return t==rB||QO(t)==e.getAttribute("listType")},setAttributeOnDowncast(t,i,n){if(i&&i!==rB){if(!e)return void t.setStyle("list-style-type",i,n);{const e=ZO(i);if(e)return void t.setAttribute("type",e,n)}}t.removeStyle("list-style-type",n),t.removeAttribute("type",n);},getAttributeOnUpcast(e){const t=e.getStyle("list-style-type");if(t)return XO(t);const i=e.getAttribute("type");return i?YO(i):rB}});}e.reversed&&t.push({attributeName:"listReversed",defaultValue:false,viewConsumables:{attributes:"reversed"},addCommand(e){e.commands.add("listReversed",new tB(e));},appliesToListItem:e=>"numbered"==e.getAttribute("listType"),hasValidAttribute(e){return this.appliesToListItem(e)==e.hasAttribute("listReversed")},setAttributeOnDowncast(e,t,i){t?e.setAttribute("reversed","reversed",i):e.removeAttribute("reversed",i);},getAttributeOnUpcast:e=>e.hasAttribute("reversed")});e.startIndex&&t.push({attributeName:"listStart",defaultValue:1,viewConsumables:{attributes:"start"},addCommand(e){e.commands.add("listStart",new jO(e));},appliesToListItem:e=>eO(e.getAttribute("listType")),hasValidAttribute(e){return this.appliesToListItem(e)==e.hasAttribute("listStart")},setAttributeOnDowncast(e,t,i){0==t||t>1?e.setAttribute("start",t,i):e.removeAttribute("start",i);},getAttributeOnUpcast(e){const t=e.getAttribute("start");return t>=0?t:1}});return t}(e.config.get("list.properties"));for(const s of n)s.addCommand(e),t.schema.extend("$listItem",{allowAttributes:s.attributeName}),i.registerDowncastStrategy({scope:"list",attributeName:s.attributeName,setAttributeOnDowncast(e,t,i){s.setAttributeOnDowncast(e,t,i);}});e.conversion.for("upcast").add(e=>{for(const t of n)e.on("element:ol",iB(t)),e.on("element:ul",iB(t));}),i.on("checkAttributes:list",(e,{viewElement:t,modelAttributes:i,modelReferenceElement:s})=>{for(const o of n)o.appliesToListItem(s)&&o.getAttributeOnUpcast(t)!=i[o.attributeName]&&(e.return=true,e.stop());}),this.listenTo(e.commands.get("indentList"),"afterExecute",(e,i)=>{t.change(e=>{for(const t of i)for(const i of n)i.appliesToListItem(t)&&e.setAttribute(i.attributeName,i.defaultValue,t);});}),i.on("postFixer",(e,{listNodes:t,writer:i})=>{for(const{node:s}of t)for(const t of n)t.hasValidAttribute(s)||(t.appliesToListItem(s)?i.setAttribute(t.attributeName,t.defaultValue,s):i.removeAttribute(t.attributeName,s),e.return=true);}),i.on("postFixer",(e,{listNodes:t,writer:i})=>{for(const{node:s,previousNodeInList:o}of t)if(o&&o.getAttribute("listType")==s.getAttribute("listType"))for(const t of n){const{attributeName:n}=t;if(!t.appliesToListItem(s))continue;const r=o.getAttribute(n);s.getAttribute(n)!=r&&(i.setAttribute(n,r,s),e.return=true);}});}}class lB extends Cs{children;stylesView=null;additionalPropertiesCollapsibleView=null;startIndexFieldView=null;reversedSwitchButtonView=null;focusTracker=new An;keystrokes=new In;focusables=new Xn;focusCycler;constructor(e,{enabledProperties:t,styleButtonViews:i,styleGridAriaLabel:n}){super(e);const s=["ck","ck-list-properties"];this.children=this.createCollection(),this.focusCycler=new Fp({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),i&&i.length?(this.stylesView=this._createStylesView(i,n),this.children.add(this.stylesView)):s.push("ck-list-properties_without-styles"),(t.startIndex||t.reversed)&&(this._addNumberedListPropertyViews(t),s.push("ck-list-properties_with-numbered-properties")),this.setTemplate({tag:"div",attributes:{class:s},children:this.children});}render(){if(super.render(),this.stylesView){this.focusables.add(this.stylesView),this.focusTracker.add(this.stylesView.element),(this.startIndexFieldView||this.reversedSwitchButtonView)&&(this.focusables.add(this.children.last.buttonView),this.focusTracker.add(this.children.last.buttonView.element));for(const e of this.stylesView.children)this.stylesView.focusTracker.add(e.element);Rs({keystrokeHandler:this.stylesView.keystrokes,focusTracker:this.stylesView.focusTracker,gridItems:this.stylesView.children,numberOfColumns:()=>exports.global.window.getComputedStyle(this.stylesView.element).getPropertyValue("grid-template-columns").split(" ").length,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection});}if(this.startIndexFieldView){this.focusables.add(this.startIndexFieldView),this.focusTracker.add(this.startIndexFieldView.element);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);}this.reversedSwitchButtonView&&(this.focusables.add(this.reversedSwitchButtonView),this.focusTracker.add(this.reversedSwitchButtonView.element)),this.keystrokes.listenTo(this.element);}focus(){this.focusCycler.focusFirst();}focusLast(){this.focusCycler.focusLast();}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy();}_createStylesView(e,t){const i=new Cs(this.locale);return i.children=i.createCollection(),i.children.addMany(e),i.setTemplate({tag:"div",attributes:{"aria-label":t,class:["ck","ck-list-styles-list"]},children:i.children}),i.children.delegate("execute").to(this),i.focus=function(){for(const e of this.children)if(e instanceof Bp&&e.isOn)return void e.focus();this.children.first.focus();},i.focusTracker=new An,i.keystrokes=new In,i.render(),i.keystrokes.listenTo(i.element),i}_addNumberedListPropertyViews(e){const t=this.locale.t,i=[];e.startIndex&&(this.startIndexFieldView=this._createStartIndexField(),i.push(this.startIndexFieldView)),e.reversed&&(this.reversedSwitchButtonView=this._createReversedSwitchButton(),i.push(this.reversedSwitchButtonView)),this.stylesView?(this.additionalPropertiesCollapsibleView=new db(this.locale,i),this.additionalPropertiesCollapsibleView.set({label:t("List properties"),isCollapsed:true}),this.additionalPropertiesCollapsibleView.buttonView.bind("isEnabled").toMany(i,"isEnabled",(...e)=>e.some(e=>e)),this.additionalPropertiesCollapsibleView.buttonView.on("change:isEnabled",(e,t,i)=>{i||(this.additionalPropertiesCollapsibleView.isCollapsed=true);}),this.children.add(this.additionalPropertiesCollapsibleView)):this.children.addMany(i);}_createStartIndexField(){const e=this.locale.t,t=new Nb(this.locale,Iw);return t.set({label:e("Start at"),class:"ck-numbered-list-properties__start-index"}),t.fieldView.set({min:0,step:1,value:1,inputMode:"numeric"}),t.fieldView.on("input",()=>{const i=t.fieldView.element,n=i.valueAsNumber;Number.isNaN(n)?t.errorText=e("Invalid start index value."):i.checkValidity()?this.fire("listStart",{startIndex:n}):t.errorText=e("Start index must be greater than 0.");}),t}_createReversedSwitchButton(){const e=this.locale.t,t=new rb(this.locale);return t.set({withText:true,label:e("Reversed order"),class:"ck-numbered-list-properties__reversed-order"}),t.delegate("execute").to(this,"listReversed"),t}}class cB extends Ms{static get pluginName(){return "ListPropertiesUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.locale.t,i=e.config.get("list.properties"),n=sB(i),s=n.styles.listTypes;if(s.includes("bulleted")){const i=[{label:t("Toggle the disc list style"),tooltip:t("Disc"),type:"disc",icon:Lg},{label:t("Toggle the circle list style"),tooltip:t("Circle"),type:"circle",icon:Rg},{label:t("Toggle the square list style"),tooltip:t("Square"),type:"square",icon:Ng}],s=t("Bulleted List"),o=t("Bulleted list styles toolbar"),r="bulletedList";e.ui.componentFactory.add(r,uB({editor:e,normalizedConfig:n,parentCommandName:r,buttonLabel:s,buttonIcon:fm,styleGridAriaLabel:o,styleDefinitions:i})),e.ui.componentFactory.add(`menuBar:${r}`,hB({editor:e,normalizedConfig:n,parentCommandName:r,buttonLabel:s,styleGridAriaLabel:o,styleDefinitions:i}));}if(s.includes("numbered")||i.startIndex||i.reversed){const i=[{label:t("Toggle the decimal list style"),tooltip:t("Decimal"),type:"decimal",icon:Bg},{label:t("Toggle the decimal with leading zero list style"),tooltip:t("Decimal with leading zero"),type:"decimal-leading-zero",icon:Og},{label:t("Toggle the lower–roman list style"),tooltip:t("Lower–roman"),type:"lower-roman",icon:Fg},{label:t("Toggle the upper–roman list style"),tooltip:t("Upper-roman"),type:"upper-roman",icon:zg},{label:t("Toggle the lower–latin list style"),tooltip:t("Lower-latin"),type:"lower-latin",icon:Mg},{label:t("Toggle the upper–latin list style"),tooltip:t("Upper-latin"),type:"upper-latin",icon:Dg},{label:t("Toggle the arabic-indic list style"),tooltip:t("Arabic-indic"),type:"arabic-indic",icon:Hg}],o=t("Numbered List"),r=t("Numbered list styles toolbar"),a="numberedList";e.ui.componentFactory.add(a,uB({editor:e,normalizedConfig:n,parentCommandName:a,buttonLabel:o,buttonIcon:ef,styleGridAriaLabel:r,styleDefinitions:i})),s.includes("numbered")&&e.ui.componentFactory.add(`menuBar:${a}`,hB({editor:e,normalizedConfig:n,parentCommandName:a,buttonLabel:o,styleGridAriaLabel:r,styleDefinitions:i}));}}}function uB({editor:e,normalizedConfig:t,parentCommandName:i,buttonLabel:n,buttonIcon:s,styleGridAriaLabel:o,styleDefinitions:r}){const a=e.commands.get(i);return l=>{const c=ww(l,bw),u=c.buttonView;return c.bind("isEnabled").to(a),c.class="ck-list-styles-dropdown",u.on("execute",()=>{e.execute(i),e.editing.view.focus();}),u.set({label:n,icon:s,tooltip:true,isToggleable:true}),u.bind("isOn").to(a,"value",e=>!!e),c.once("change:isOpen",()=>{const n=function({editor:e,normalizedConfig:t,dropdownView:i,parentCommandName:n,styleDefinitions:s,styleGridAriaLabel:o}){const r=e.locale,a={...t,..."numberedList"!=n?{startIndex:false,reversed:false}:null},l=n.replace("List","");let c=null;if(t.styles.listTypes.includes(l)){const i=e.commands.get("listStyle"),o=dB({editor:e,parentCommandName:n,listStyleCommand:i}),r=t.styles.listStyleTypes;let a=s;if(r){const e=r[l];e&&(a=s.filter(t=>e.includes(t.type)));}const u=mB(i);c=a.filter(u).map(o);}const u=new lB(r,{styleGridAriaLabel:o,enabledProperties:a,styleButtonViews:c});t.styles.listTypes.includes(l)&&Aw(i,()=>u.stylesView.children.find(e=>e.isOn));if(a.startIndex){const t=e.commands.get("listStart");u.startIndexFieldView.bind("isEnabled").to(t),u.startIndexFieldView.fieldView.bind("value").to(t),u.on("listStart",(t,i)=>e.execute("listStart",i));}if(a.reversed){const t=e.commands.get("listReversed");u.reversedSwitchButtonView.bind("isEnabled").to(t),u.reversedSwitchButtonView.bind("isOn").to(t,"value",e=>!!e),u.on("listReversed",()=>{const i=t.value;e.execute("listReversed",{reversed:!i});});}return u.delegate("execute").to(i),u}({editor:e,normalizedConfig:t,dropdownView:c,parentCommandName:i,styleGridAriaLabel:o,styleDefinitions:r});c.panelView.children.add(n);}),c.on("execute",()=>{e.editing.view.focus();}),c}}function dB({editor:e,listStyleCommand:t,parentCommandName:i}){const n=e.locale,s=e.commands.get(i);return ({label:o,type:r,icon:a,tooltip:l})=>{const c=new Bp(n);return c.set({label:o,icon:a,tooltip:l}),c.bind("isOn").to(t,"value",e=>e===r),c.on("execute",()=>{s.value?t.value===r?e.execute(i):t.value!==r&&e.execute("listStyle",{type:r}):e.model.change(()=>{e.execute("listStyle",{type:r});});}),c}}function hB({editor:e,normalizedConfig:t,parentCommandName:i,buttonLabel:n,styleGridAriaLabel:s,styleDefinitions:o}){return r=>{const a=new x_(r),l=e.commands.get(i),c=e.commands.get("listStyle"),u=mB(c),d=dB({editor:e,parentCommandName:i,listStyleCommand:c}),h=t.styles.listStyleTypes;let m=o;if(h){const e=h[l.type];e&&(m=o.filter(t=>e.includes(t.type)));}const g=m.filter(u).map(d),f=new lB(r,{styleGridAriaLabel:s,enabledProperties:{...t,startIndex:false,reversed:false},styleButtonViews:g});return f.delegate("execute").to(a),a.buttonView.set({label:n,icon:"bulletedList"===i?fm:ef}),a.panelView.children.add(f),a.bind("isEnabled").to(l,"isEnabled"),a.on("execute",()=>{e.editing.view.focus();}),a}}function mB(e){return "function"==typeof e.isStyleTypeSupported?t=>e.isStyleTypeSupported(t.type):()=>true}class gB extends Ms{static get requires(){return [aB,cB]}static get pluginName(){return "ListProperties"}static get isOfficialPlugin(){return  true}}class fB extends Ns{constructor(e){super(e),this.on("execute",()=>{this.refresh();},{priority:"highest"});}refresh(){const e=this._getSelectedItems();this.value=this._getValue(e),this.isEnabled=!!e.length;}execute(e={}){this.editor.model.change(t=>{const i=this._getSelectedItems(),n=void 0===e.forceValue?!this._getValue(i):e.forceValue;for(const e of i)n?t.setAttribute("todoListChecked",true,e):t.removeAttribute("todoListChecked",e);});}_getValue(e){return e.every(e=>e.getAttribute("todoListChecked"))}_getSelectedItems(){const e=this.editor.model,t=e.schema,i=e.document.selection.getFirstRange(),n=i.start.parent,s=[];t.checkAttribute(n,"todoListChecked")&&s.push(...MR(n));for(const e of i.getItems({shallow:true}))t.checkAttribute(e,"todoListChecked")&&!s.includes(e)&&s.push(...MR(e));return s}}class pB extends qr{domEventType=["change"];onDomEvent(e){if(e.target){const t=this.view.domConverter.mapDomToView(e.target);t&&t.is("element","input")&&"checkbox"==t.getAttribute("type")&&t.findAncestor({classes:"todo-list__label"})&&this.fire("todoCheckboxChange",e);}}}const bB=ln("Ctrl+Enter");class wB extends Ms{static get pluginName(){return "TodoListEditing"}static get isOfficialPlugin(){return  true}static get requires(){return [NO]}init(){const e=this.editor,t=e.model,i=e.editing,n=e.plugins.get(NO),s=e.config.get("list.multiBlock")?"paragraph":"listItem";e.commands.add("todoList",new sO(e,"todo")),e.commands.add("checkTodoList",new fB(e)),i.view.addObserver(pB),t.schema.extend("$listItem",{allowAttributes:"todoListChecked"}),t.schema.addAttributeCheck(e=>{const t=e.last;if(!t.getAttribute("listItemId")||"todo"!=t.getAttribute("listType"))return  false},"todoListChecked"),e.conversion.for("upcast").add(e=>{e.on("element:input",(e,t,i)=>{const n=t.modelCursor,s=n.parent,o=t.viewItem;if(!i.consumable.test(o,{name:true}))return;if("checkbox"!=o.getAttribute("type")||!n.isAtStart||!s.hasAttribute("listType"))return;i.consumable.consume(o,{name:true});const r=i.writer;r.setAttribute("listType","todo",s),t.viewItem.hasAttribute("checked")&&r.setAttribute("todoListChecked",true,s),t.modelRange=r.createRange(n);}),e.on("element:li",(e,t,i)=>{const{writer:n,schema:s}=i;if(!t.modelRange)return;const o=Array.from(t.modelRange.getItems({shallow:true})).filter(e=>"todo"===e.getAttribute("listType")&&s.checkAttribute(e,"listItemId")).reduce((e,t)=>{const i=t.getAttribute("listItemId");return e.has(i)||e.set(i,MR(t)),e},new Map);for(const[,e]of o.entries())if(e.some(e=>e.getAttribute("todoListChecked")))for(const t of e)n.setAttribute("todoListChecked",true,t);},{priority:"low"}),e.on("element:label",vB({name:"label",classes:"todo-list__label"})),e.on("element:label",vB({name:"label",classes:["todo-list__label","todo-list__label_without-description"]})),e.on("element:span",vB({name:"span",classes:"todo-list__label__description"})),e.on("element:ul",function(e){const t=new uo(e);return (e,i,n)=>{const s=t.match(i.viewItem);if(!s)return;const o=s.match;o.name=false,n.consumable.consume(i.viewItem,o);}}({name:"ul",classes:"todo-list"}));}),e.conversion.for("downcast").elementToElement({model:s,view:(e,{writer:t})=>{if(_B(e,n.getListAttributeNames()))return t.createContainerElement("span",{class:"todo-list__label__description"})},converterPriority:"highest"}),n.registerDowncastStrategy({scope:"list",attributeName:"listType",setAttributeOnDowncast(e,t,i){"todo"==t?e.addClass("todo-list",i):e.removeClass("todo-list",i);}}),n.registerDowncastStrategy({scope:"itemMarker",attributeName:"todoListChecked",createElement(e,t,{dataPipeline:i}){if("todo"!=t.getAttribute("listType"))return null;const n=e.createUIElement("input",{type:"checkbox",...t.getAttribute("todoListChecked")?{checked:"checked"}:null,...i?{disabled:"disabled"}:{tabindex:"-1"}});if(i)return n;const s=e.createContainerElement("span",{contenteditable:"false"},n);return s.getFillerOffset=()=>null,s},canWrapElement:e=>_B(e,n.getListAttributeNames()),createWrapperElement(e,t,{dataPipeline:i}){const s=["todo-list__label"];return _B(t,n.getListAttributeNames())||s.push("todo-list__label_without-description"),e.createAttributeElement(i?"label":"span",{class:s.join(" ")})}}),n.on("checkElement",(e,{modelElement:t,viewElement:i})=>{const s=_B(t,n.getListAttributeNames());i.hasClass("todo-list__label__description")!=s&&(e.return=true,e.stop());}),n.on("checkElement",(t,{modelElement:i,viewElement:n})=>{const s="todo"==i.getAttribute("listType")&&zR(i);let o=false;const r=e.editing.view.createPositionBefore(n).getWalker({direction:"backward"});for(const{item:t}of r){if(t.is("element")&&e.editing.mapper.toModelElement(t))break;t.is("element","input")&&"checkbox"==t.getAttribute("type")&&(o=true);}o!=s&&(t.return=true,t.stop());}),n.on("postFixer",(e,{listNodes:t,writer:i})=>{for(const{node:n,previousNodeInList:s}of t){if(!s)continue;if(s.getAttribute("listItemId")!=n.getAttribute("listItemId"))continue;const t=s.hasAttribute("todoListChecked"),o=n.hasAttribute("todoListChecked");o&&!t?(i.removeAttribute("todoListChecked",n),e.return=true):!o&&t&&(i.setAttribute("todoListChecked",true,n),e.return=true);}}),t.document.registerPostFixer(e=>{const i=t.document.differ.getChanges();let n=false;for(const t of i)if("attribute"==t.type&&"listType"==t.attributeKey){const i=t.range.start.nodeAfter;"todo"==t.attributeOldValue&&i.hasAttribute("todoListChecked")&&(e.removeAttribute("todoListChecked",i),n=true);}else if("insert"==t.type&&"$text"!=t.name)for(const{item:i}of e.createRangeOn(t.position.nodeAfter))i.is("element")&&"todo"!=i.getAttribute("listType")&&i.hasAttribute("todoListChecked")&&(e.removeAttribute("todoListChecked",i),n=true);return n}),this.listenTo(i.view.document,"keydown",(t,i)=>{an(i)===bB&&(e.execute("checkTodoList"),t.stop());},{priority:"high"}),this.listenTo(i.view.document,"todoCheckboxChange",(e,t)=>{const n=t.target;if(!n||!n.is("element","input"))return;const s=i.view.createPositionAfter(n),o=i.mapper.toModelPosition(s).parent;o&&LR(o)&&"todo"==o.getAttribute("listType")&&this._handleCheckmarkChange(o);}),this.listenTo(i.view.document,"arrowKey",function(e,t){return (i,n)=>{const s=dn(n.keyCode,t.contentLanguageDirection),o=e.schema,r=e.document.selection;if(!r.isCollapsed)return;const a=r.getFirstPosition(),l=a.parent;if("right"==s&&a.isAtEnd){const t=o.getNearestSelectionRange(e.createPositionAfter(l),"forward");if(!t)return;const s=t.start.parent;s&&LR(s)&&"todo"==s.getAttribute("listType")&&(e.change(e=>e.setSelection(t)),n.preventDefault(),n.stopPropagation(),i.stop());}else if("left"==s&&a.isAtStart&&LR(l)&&"todo"==l.getAttribute("listType")){const t=o.getNearestSelectionRange(e.createPositionBefore(l),"backward");if(!t)return;e.change(e=>e.setSelection(t)),n.preventDefault(),n.stopPropagation(),i.stop();}}}(t,e.locale),{context:"$text"}),this.listenTo(i.mapper,"viewToModelPosition",(e,i)=>{const n=i.viewPosition.parent,s=n.is("attributeElement","li")&&0==i.viewPosition.offset,o=yB(n)&&i.viewPosition.offset<=1,r=n.is("element","span")&&"false"==n.getAttribute("contenteditable")&&yB(n.parent);if(!s&&!o&&!r)return;const a=i.modelPosition.nodeAfter;a&&"todo"==a.getAttribute("listType")&&(i.modelPosition=t.createPositionAt(a,0));},{priority:"low"}),this._initAriaAnnouncements();}_handleCheckmarkChange(e){const t=this.editor,i=t.model,n=Array.from(i.document.selection.getRanges());i.change(i=>{i.setSelection(e,"end"),t.execute("checkTodoList"),i.setSelection(n);});}_initAriaAnnouncements(){const{model:e,ui:t,t:i}=this.editor;let n=null;t&&e.document.selection.on("change:range",()=>{const s=e.document.selection.focus.parent,o=kB(n),r=kB(s);o&&!r?t.ariaLiveAnnouncer.announce(i("Leaving a to-do list")):!o&&r&&t.ariaLiveAnnouncer.announce(i("Entering a to-do list")),n=s;});}}function vB(e){const t=new uo(e);return (e,i,n)=>{const s=t.match(i.viewItem);s&&n.consumable.consume(i.viewItem,s.match)&&Object.assign(i,n.convertChildren(i.viewItem,i.modelCursor));}}function _B(e,t){return (e.is("element","paragraph")||e.is("element","listItem"))&&"todo"==e.getAttribute("listType")&&zR(e)&&function(e,t){for(const i of e.getAttributeKeys())if(!i.startsWith("selection:")&&!t.includes(i))return  false;return  true}(e,t)}function yB(e){return !!e&&e.is("attributeElement")&&e.hasClass("todo-list__label")}function kB(e){return !!e&&(!(!e.is("element","paragraph")&&!e.is("element","listItem"))&&"todo"==e.getAttribute("listType"))}class CB extends Ms{static get pluginName(){return "TodoListUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor.t;zO(this.editor,"todoList",e("To-do List"),wp);}}class xB extends Ms{static get requires(){return [wB,CB]}static get pluginName(){return "TodoList"}static get isOfficialPlugin(){return  true}}class AB extends Ns{type;constructor(e,t){super(e),this.type=t;}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled();}execute(e={}){const t=this.editor.model,i=t.document,n=Array.from(i.selection.getSelectedBlocks()).filter(e=>TB(e,t.schema)),s=void 0!==e.forceValue?!e.forceValue:this.value;t.change(e=>{if(s){let t=n[n.length-1].nextSibling,i=Number.POSITIVE_INFINITY,s=[];for(;t&&"listItem"==t.name&&0!==t.getAttribute("listIndent");){const e=t.getAttribute("listIndent");e<i&&(i=e);const n=e-i;s.push({element:t,listIndent:n}),t=t.nextSibling;}s=s.reverse();for(const t of s)e.setAttribute("listIndent",t.listIndent,t.element);}if(!s){let e=Number.POSITIVE_INFINITY;for(const t of n)t.is("element","listItem")&&t.getAttribute("listIndent")<e&&(e=t.getAttribute("listIndent"));e=0===e?1:e,EB(n,true,e),EB(n,false,e);}for(const t of n.reverse())s&&"listItem"==t.name?e.rename(t,"paragraph"):s||"listItem"==t.name?s||"listItem"!=t.name||t.getAttribute("listType")==this.type||e.setAttribute("listType",this.type,t):(e.setAttributes({listType:this.type,listIndent:0},t),e.rename(t,"listItem"));this.fire("_executeCleanup",n);});}_getValue(){const e=Cn(this.editor.model.document.selection.getSelectedBlocks());return !!e&&e.is("element","listItem")&&e.getAttribute("listType")==this.type}_checkEnabled(){if(this.value)return  true;const e=this.editor.model.document.selection,t=this.editor.model.schema,i=Cn(e.getSelectedBlocks());return !!i&&TB(i,t)}}function EB(e,t,i){const n=t?e[0]:e[e.length-1];if(n.is("element","listItem")){let s=n[t?"previousSibling":"nextSibling"],o=n.getAttribute("listIndent");for(;s&&s.is("element","listItem")&&s.getAttribute("listIndent")>=i;)o>s.getAttribute("listIndent")&&(o=s.getAttribute("listIndent")),s.getAttribute("listIndent")==o&&e[t?"unshift":"push"](s),s=s[t?"previousSibling":"nextSibling"];}}function TB(e,t){return t.checkChild(e.parent,"listItem")&&!t.isObject(e)}class SB extends Ns{_indentBy;constructor(e,t){super(e),this._indentBy="forward"==t?1:-1;}refresh(){this.isEnabled=this._checkEnabled();}execute(){const e=this.editor.model,t=e.document;let i=Array.from(t.selection.getSelectedBlocks());e.change(e=>{const t=i[i.length-1];let n=t.nextSibling;for(;n&&"listItem"==n.name&&n.getAttribute("listIndent")>t.getAttribute("listIndent");)i.push(n),n=n.nextSibling;this._indentBy<0&&(i=i.reverse());for(const t of i){const i=t.getAttribute("listIndent")+this._indentBy;i<0?e.rename(t,"paragraph"):e.setAttribute("listIndent",i,t);}this.fire("_executeCleanup",i);});}_checkEnabled(){const e=Cn(this.editor.model.document.selection.getSelectedBlocks());if(!e||!e.is("element","listItem"))return  false;if(this._indentBy>0){const t=e.getAttribute("listIndent"),i=e.getAttribute("listType");let n=e.previousSibling;for(;n&&n.is("element","listItem")&&n.getAttribute("listIndent")>=t;){if(n.getAttribute("listIndent")==t)return n.getAttribute("listType")==i;n=n.previousSibling;}return  false}return  true}}function IB(e,t){const i=t.mapper,n=t.writer,s="numbered"==e.getAttribute("listType")?"ol":"ul",o=function(e){const t=e.createContainerElement("li");return t.getFillerOffset=zB,t}(n),r=n.createContainerElement(s,null);return n.insert(n.createPositionAt(r,0),o),i.bindElements(e,o),o}function PB(e,t,i,n){const s=t.parent,o=i.mapper,r=i.writer;let a=o.toViewPosition(n.createPositionBefore(e));const l=OB(e.previousSibling,{sameIndent:true,smallerIndent:true,listIndent:e.getAttribute("listIndent")}),c=e.previousSibling;if(l&&l.getAttribute("listIndent")==e.getAttribute("listIndent")){const e=o.toViewElement(l);a=r.breakContainer(r.createPositionAfter(e));}else if(c&&"listItem"==c.name){a=o.toViewPosition(n.createPositionAt(c,"end"));const e=o.findMappedViewAncestor(a),t=BB(e);a=t?r.createPositionBefore(t):r.createPositionAt(e,"end");}else a=o.toViewPosition(n.createPositionBefore(e));if(a=RB(a),r.insert(a,s),c&&"listItem"==c.name){const e=o.toViewElement(c),i=r.createRange(r.createPositionAt(e,0),a).getWalker({ignoreElementEnd:true});for(const e of i)if(e.item.is("element","li")){const n=r.breakContainer(r.createPositionBefore(e.item)),s=e.item.parent,o=r.createPositionAt(t,"end");VB(r,o.nodeBefore,o.nodeAfter),r.move(r.createRangeOn(s),o),i._position=n;}}else {const i=s.nextSibling;if(i&&(i.is("element","ul")||i.is("element","ol"))){let n=null;for(const t of i.getChildren()){const i=o.toModelElement(t);if(!(i&&i.getAttribute("listIndent")>e.getAttribute("listIndent")))break;n=t;}n&&(r.breakContainer(r.createPositionAfter(n)),r.move(r.createRangeOn(n.parent),r.createPositionAt(t,"end")));}}VB(r,s,s.nextSibling),VB(r,s.previousSibling,s);}function VB(e,t,i){return !t||!i||"ul"!=t.name&&"ol"!=t.name||t.name!=i.name||t.getAttribute("class")!==i.getAttribute("class")?null:e.mergeContainers(e.createPositionAfter(t))}function RB(e){return e.getLastMatchingPosition(e=>e.item.is("uiElement"))}function OB(e,t){const i=!!t.sameIndent,n=!!t.smallerIndent,s=t.listIndent;let o=e;for(;o&&"listItem"==o.name;){const e=o.getAttribute("listIndent");if(i&&s==e||n&&s>e)return o;o="forward"===t.direction?o.nextSibling:o.previousSibling;}return null}function BB(e){for(const t of e.getChildren())if("ul"==t.name||"ol"==t.name)return t;return null}function LB(e,t){const i=[],n=e.parent,s={ignoreElementEnd:false,startPosition:e,shallow:true,direction:t},o=n.getAttribute("listIndent"),r=[...new sa(s)].filter(e=>e.item.is("element")).map(e=>e.item);for(const e of r){if(!e.is("element","listItem"))break;if(e.getAttribute("listIndent")<o)break;if(!(e.getAttribute("listIndent")>o)){if(e.getAttribute("listType")!==n.getAttribute("listType"))break;if(e.getAttribute("listStyle")!==n.getAttribute("listStyle"))break;if(e.getAttribute("listReversed")!==n.getAttribute("listReversed"))break;if(e.getAttribute("listStart")!==n.getAttribute("listStart"))break;"backward"===t?i.unshift(e):i.push(e);}}return i}function MB(e){let t=[...e.document.selection.getSelectedBlocks()].filter(e=>e.is("element","listItem")).map(t=>{const i=e.change(e=>e.createPositionAt(t,0));return [...LB(i,"backward"),...LB(i,"forward")]}).flat();return t=[...new Set(t)],t}const FB=["disc","circle","square"],NB=["decimal","decimal-leading-zero","lower-roman","upper-roman","lower-latin","upper-latin"];function DB(e){return FB.includes(e)?"bulleted":NB.includes(e)?"numbered":null}function zB(){const e=!this.isEmpty&&("ul"==this.getChild(0).name||"ol"==this.getChild(0).name);return this.isEmpty||e?0:xo.call(this)}class HB extends Ms{static get pluginName(){return "LegacyListUtils"}static get isOfficialPlugin(){return  true}getListTypeFromListStyleType(e){return DB(e)}getSelectedListItems(e){return MB(e)}getSiblingNodes(e,t){return LB(e,t)}}function qB(e){return (t,i,n)=>{const s=n.consumable;if(!s.test(i.item,"insert")||!s.test(i.item,"attribute:listType")||!s.test(i.item,"attribute:listIndent"))return;s.consume(i.item,"insert"),s.consume(i.item,"attribute:listType"),s.consume(i.item,"attribute:listIndent");const o=i.item;PB(o,IB(o,n),n,e);}}const UB=(e,t,i)=>{if(!i.consumable.test(t.item,e.name))return;const n=i.mapper.toViewElement(t.item),s=i.writer;s.breakContainer(s.createPositionBefore(n)),s.breakContainer(s.createPositionAfter(n));const o=n.parent,r="numbered"==t.attributeNewValue?"ol":"ul";s.rename(r,o);},jB=(e,t,i)=>{i.consumable.consume(t.item,e.name);const n=i.mapper.toViewElement(t.item).parent,s=i.writer;VB(s,n,n.nextSibling),VB(s,n.previousSibling,n);};const $B=(e,t,i)=>{if(i.consumable.test(t.item,e.name)&&"listItem"!=t.item.name){let e=i.mapper.toViewPosition(t.range.start);const n=i.writer,s=[];for(;("ul"==e.parent.name||"ol"==e.parent.name)&&(e=n.breakContainer(e),"li"==e.parent.name);){const t=e,i=n.createPositionAt(e.parent,"end");if(!t.isEqual(i)){const e=n.remove(n.createRange(t,i));s.push(e);}e=n.createPositionAfter(e.parent);}if(s.length>0){for(let t=0;t<s.length;t++){const i=e.nodeBefore;if(e=n.insert(e,s[t]).end,t>0){const t=VB(n,i,i.nextSibling);t&&t.parent==i&&e.offset--;}}VB(n,e.nodeBefore,e.nodeAfter);}}},WB=(e,t,i)=>{const n=i.mapper.toViewPosition(t.position),s=n.nodeBefore,o=n.nodeAfter;VB(i.writer,s,o);},GB=(e,t,i)=>{if(i.consumable.consume(t.viewItem,{name:true})){const e=i.writer,n=e.createElement("listItem"),s=function(e){let t=0,i=e.parent;for(;i;){if(i.is("element","li"))t++;else {const e=i.previousSibling;e&&e.is("element","li")&&t++;}i=i.parent;}return t}(t.viewItem);e.setAttribute("listIndent",s,n);const o=t.viewItem.parent&&"ol"==t.viewItem.parent.name?"numbered":"bulleted";if(e.setAttribute("listType",o,n),!i.safeInsert(n,t.modelCursor))return;const r=function(e,t,i){const{writer:n,schema:s}=i;let o=n.createPositionAfter(e);for(const r of t)if("ul"==r.name||"ol"==r.name)o=i.convertItem(r,o).modelCursor;else {const t=i.convertItem(r,n.createPositionAt(e,"end")),a=t.modelRange.start.nodeAfter;a&&a.is("element")&&!s.checkChild(e,a.name)&&(e=t.modelCursor.parent.is("element","listItem")?t.modelCursor.parent:ZB(t.modelCursor),o=n.createPositionAfter(e));}return o}(n,t.viewItem.getChildren(),i);t.modelRange=e.createRange(t.modelCursor,r),i.updateConversionResult(n,t);}},KB=(e,t,i)=>{if(i.consumable.test(t.viewItem,{name:true})){const e=Array.from(t.viewItem.getChildren());for(const t of e){!(t.is("element","li")||eL(t))&&t._remove();}}},JB=(e,t,i)=>{if(i.consumable.test(t.viewItem,{name:true})){if(0===t.viewItem.childCount)return;const e=[...t.viewItem.getChildren()];let i=false;for(const t of e)i&&!eL(t)&&t._remove(),eL(t)&&(i=true);}};function QB(e){return (t,i)=>{if(i.isPhantom)return;const n=i.modelPosition.nodeBefore;if(n&&n.is("element","listItem")){const t=i.mapper.toViewElement(n),s=t.getAncestors().find(eL),o=e.createPositionAt(t,0).getWalker();for(const e of o){if("elementStart"==e.type&&e.item.is("element","li")){i.viewPosition=e.previousPosition;break}if("elementEnd"==e.type&&e.item==s){i.viewPosition=e.nextPosition;break}}}}}const YB=function(e,[t,i]){const n=this;let s,o=t.is("documentFragment")?t.getChild(0):t;if(s=i?n.createSelection(i):n.document.selection,o&&o.is("element","listItem")){const e=s.getFirstPosition();let t=null;if(e.parent.is("element","listItem")?t=e.parent:e.nodeBefore&&e.nodeBefore.is("element","listItem")&&(t=e.nodeBefore),t){const e=t.getAttribute("listIndent");if(e>0)for(;o&&o.is("element","listItem");)o._setAttribute("listIndent",o.getAttribute("listIndent")+e),o=o.nextSibling;}}};function ZB(e){const t=new sa({startPosition:e});let i;do{i=t.next();}while(!i.value.item.is("element","listItem"));return i.value.item}function XB(e,t,i,n,s,o){const r=OB(t.nodeBefore,{sameIndent:true,smallerIndent:true,listIndent:e}),a=s.mapper,l=s.writer,c=r?r.getAttribute("listIndent"):null;let u;if(r)if(c==e){const e=a.toViewElement(r).parent;u=l.createPositionAfter(e);}else {const e=o.createPositionAt(r,"end");u=a.toViewPosition(e);}else u=i;u=RB(u);for(const e of [...n.getChildren()])eL(e)&&(u=l.move(l.createRangeOn(e),u).end,VB(l,e,e.nextSibling),VB(l,e.previousSibling,e));}function eL(e){return e.is("element","ol")||e.is("element","ul")}class tL extends Ms{static get pluginName(){return "LegacyListEditing"}static get isOfficialPlugin(){return  true}static get requires(){return [Rk,py,HB]}init(){const e=this.editor;e.model.schema.register("listItem",{inheritAllFrom:"$block",allowAttributes:["listType","listIndent"]});const t=e.data,i=e.editing;var n;e.model.document.registerPostFixer(t=>function(e,t){const i=e.document.differ.getChanges(),n=new Map;let s=false;for(const n of i)if("insert"==n.type&&"listItem"==n.name)o(n.position);else if("insert"==n.type&&"listItem"!=n.name){if("$text"!=n.name){const i=n.position.nodeAfter;i.hasAttribute("listIndent")&&(t.removeAttribute("listIndent",i),s=true),i.hasAttribute("listType")&&(t.removeAttribute("listType",i),s=true),i.hasAttribute("listStyle")&&(t.removeAttribute("listStyle",i),s=true),i.hasAttribute("listReversed")&&(t.removeAttribute("listReversed",i),s=true),i.hasAttribute("listStart")&&(t.removeAttribute("listStart",i),s=true);for(const t of Array.from(e.createRangeIn(i)).filter(e=>e.item.is("element","listItem")))o(t.previousPosition);}o(n.position.getShiftedBy(n.length));}else "remove"==n.type&&"listItem"==n.name?o(n.position):("attribute"==n.type&&"listIndent"==n.attributeKey||"attribute"==n.type&&"listType"==n.attributeKey)&&o(n.range.start);for(const e of n.values())r(e),a(e);return s;function o(e){const t=e.nodeBefore;if(t&&t.is("element","listItem")){let e=t;if(n.has(e))return;for(let t=e.previousSibling;t&&t.is("element","listItem");t=e.previousSibling)if(e=t,n.has(e))return;n.set(t,e);}else {const t=e.nodeAfter;t&&t.is("element","listItem")&&n.set(t,t);}}function r(e){let i=0,n=null;for(;e&&e.is("element","listItem");){const o=e.getAttribute("listIndent");if(o>i){let r;null===n?(n=o-i,r=i):(n>o&&(n=o),r=o-n),t.setAttribute("listIndent",r,e),s=true;}else n=null,i=e.getAttribute("listIndent")+1;e=e.nextSibling;}}function a(e){let i=[],n=null;for(;e&&e.is("element","listItem");){const o=e.getAttribute("listIndent");if(n&&n.getAttribute("listIndent")>o&&(i=i.slice(0,o+1)),0!=o)if(i[o]){const n=i[o];e.getAttribute("listType")!=n&&(t.setAttribute("listType",n,e),s=true);}else i[o]=e.getAttribute("listType");n=e,e=e.nextSibling;}}}(e.model,t)),i.mapper.registerViewToModelLength("li",iL),t.mapper.registerViewToModelLength("li",iL),i.mapper.on("modelToViewPosition",QB(i.view)),i.mapper.on("viewToModelPosition",(n=e.model,(e,t)=>{const i=t.viewPosition,s=i.parent,o=t.mapper;if("ul"==s.name||"ol"==s.name){if(i.isAtEnd){const e=o.toModelElement(i.nodeBefore),s=o.getModelLength(i.nodeBefore);t.modelPosition=n.createPositionBefore(e).getShiftedBy(s);}else {const e=o.toModelElement(i.nodeAfter);t.modelPosition=n.createPositionBefore(e);}e.stop();}else if("li"==s.name&&i.nodeBefore&&("ul"==i.nodeBefore.name||"ol"==i.nodeBefore.name)){const r=o.toModelElement(s);let a=1,l=i.nodeBefore;for(;l&&eL(l);)a+=o.getModelLength(l),l=l.previousSibling;t.modelPosition=n.createPositionBefore(r).getShiftedBy(a),e.stop();}})),t.mapper.on("modelToViewPosition",QB(i.view)),e.conversion.for("editingDowncast").add(t=>{t.on("insert",$B,{priority:"high"}),t.on("insert:listItem",qB(e.model)),t.on("attribute:listType:listItem",UB,{priority:"high"}),t.on("attribute:listType:listItem",jB,{priority:"low"}),t.on("attribute:listIndent:listItem",function(e){return (t,i,n)=>{if(!n.consumable.consume(i.item,"attribute:listIndent"))return;const s=n.mapper.toViewElement(i.item),o=n.writer;o.breakContainer(o.createPositionBefore(s)),o.breakContainer(o.createPositionAfter(s));const r=s.parent,a=r.previousSibling,l=o.createRangeOn(r);o.remove(l),a&&a.nextSibling&&VB(o,a,a.nextSibling),XB(i.attributeOldValue+1,i.range.start,l.start,s,n,e),PB(i.item,s,n,e);for(const e of i.item.getChildren())n.consumable.consume(e,"insert");}}(e.model)),t.on("remove:listItem",function(e){return (t,i,n)=>{const s=n.mapper.toViewPosition(i.position).getLastMatchingPosition(e=>!e.item.is("element","li")).nodeAfter,o=n.writer;o.breakContainer(o.createPositionBefore(s)),o.breakContainer(o.createPositionAfter(s));const r=s.parent,a=r.previousSibling,l=o.createRangeOn(r),c=o.remove(l);a&&a.nextSibling&&VB(o,a,a.nextSibling),XB(n.mapper.toModelElement(s).getAttribute("listIndent")+1,i.position,l.start,s,n,e);for(const e of o.createRangeIn(c).getItems())n.mapper.unbindViewElement(e);t.stop();}}(e.model)),t.on("remove",WB,{priority:"low"});}),e.conversion.for("dataDowncast").add(t=>{t.on("insert",$B,{priority:"high"}),t.on("insert:listItem",qB(e.model));}),e.conversion.for("upcast").add(e=>{e.on("element:ul",KB,{priority:"high"}),e.on("element:ol",KB,{priority:"high"}),e.on("element:li",JB,{priority:"high"}),e.on("element:li",GB);}),e.model.on("insertContent",YB,{priority:"high"}),e.commands.add("numberedList",new AB(e,"numbered")),e.commands.add("bulletedList",new AB(e,"bulleted")),e.commands.add("indentList",new SB(e,"forward")),e.commands.add("outdentList",new SB(e,"backward"));const s=i.view.document;this.listenTo(s,"enter",(e,t)=>{const i=this.editor.model.document,n=i.selection.getLastPosition().parent;i.selection.isCollapsed&&"listItem"==n.name&&n.isEmpty&&(this.editor.execute("outdentList"),t.preventDefault(),e.stop());},{context:"li"}),this.listenTo(s,"delete",(e,t)=>{if("backward"!==t.direction)return;const i=this.editor.model.document.selection;if(!i.isCollapsed)return;const n=i.getFirstPosition();if(!n.isAtStart)return;const s=n.parent;if("listItem"!==s.name)return;s.previousSibling&&"listItem"===s.previousSibling.name||(this.editor.execute("outdentList"),t.preventDefault(),e.stop());},{context:"li"}),this.listenTo(e.editing.view.document,"tab",(t,i)=>{const n=i.shiftKey?"outdentList":"indentList";this.editor.commands.get(n).isEnabled&&(e.execute(n),i.stopPropagation(),i.preventDefault(),t.stop());},{context:"li"});}afterInit(){const e=this.editor.commands,t=e.get("indent"),i=e.get("outdent");t&&t.registerChildCommand(e.get("indentList")),i&&i.registerChildCommand(e.get("outdentList"));}}function iL(e){let t=1;for(const i of e.getChildren())if("ul"==i.name||"ol"==i.name)for(const e of i.getChildren())t+=iL(e);return t}class nL extends Ms{static get requires(){return [tL,qO]}static get pluginName(){return "LegacyList"}static get isOfficialPlugin(){return  true}}class sL extends Ns{defaultType;constructor(e,t){super(e),this.defaultType=t;}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled();}execute(e={}){this._tryToConvertItemsToList(e);const t=this.editor.model,i=MB(t);i.length&&t.change(t=>{for(const n of i)t.setAttribute("listStyle",e.type||this.defaultType,n);});}_getValue(){const e=this.editor.model.document.selection.getFirstPosition().parent;return e&&e.is("element","listItem")?e.getAttribute("listStyle"):null}_checkEnabled(){const e=this.editor,t=e.commands.get("numberedList"),i=e.commands.get("bulletedList");return t.isEnabled||i.isEnabled}_tryToConvertItemsToList(e){if(!e.type)return;const t=DB(e.type);if(!t)return;const i=this.editor,n=`${t}List`;i.commands.get(n).value||i.execute(n);}}class oL extends Ns{refresh(){const e=this._getValue();this.value=e,this.isEnabled=null!=e;}execute(e={}){const t=this.editor.model,i=MB(t).filter(e=>"numbered"==e.getAttribute("listType"));t.change(t=>{for(const n of i)t.setAttribute("listReversed",!!e.reversed,n);});}_getValue(){const e=this.editor.model.document.selection.getFirstPosition().parent;return e&&e.is("element","listItem")&&"numbered"==e.getAttribute("listType")?e.getAttribute("listReversed"):null}}class rL extends Ns{refresh(){const e=this._getValue();this.value=e,this.isEnabled=null!=e;}execute({startIndex:e=1}={}){const t=this.editor.model,i=MB(t).filter(e=>"numbered"==e.getAttribute("listType"));t.change(t=>{for(const n of i)t.setAttribute("listStart",e>=0?e:1,n);});}_getValue(){const e=this.editor.model.document.selection.getFirstPosition().parent;return e&&e.is("element","listItem")&&"numbered"==e.getAttribute("listType")?e.getAttribute("listStart"):null}}const aL="default";class lL extends Ms{static get requires(){return [tL]}static get pluginName(){return "LegacyListPropertiesEditing"}static get isOfficialPlugin(){return  true}constructor(e){super(e),e.config.define("list",{properties:{styles:true,startIndex:false,reversed:false}});}init(){const e=this.editor,t=e.model,i=function(e){const t=[];e.styles&&t.push({attributeName:"listStyle",defaultValue:aL,addCommand(e){e.commands.add("listStyle",new sL(e,aL));},appliesToListItem:()=>true,setAttributeOnDowncast(e,t,i){t&&t!==aL?e.setStyle("list-style-type",t,i):e.removeStyle("list-style-type",i);},getAttributeOnUpcast:e=>XO(e.getStyle("list-style-type"))||aL});e.reversed&&t.push({attributeName:"listReversed",defaultValue:false,addCommand(e){e.commands.add("listReversed",new oL(e));},appliesToListItem:e=>"numbered"==e.getAttribute("listType"),setAttributeOnDowncast(e,t,i){t?e.setAttribute("reversed","reversed",i):e.removeAttribute("reversed",i);},getAttributeOnUpcast:e=>e.hasAttribute("reversed")});e.startIndex&&t.push({attributeName:"listStart",defaultValue:1,addCommand(e){e.commands.add("listStart",new rL(e));},appliesToListItem:e=>"numbered"==e.getAttribute("listType"),setAttributeOnDowncast(e,t,i){0==t||t>1?e.setAttribute("start",t,i):e.removeAttribute("start",i);},getAttributeOnUpcast(e){const t=e.getAttribute("start");return t>=0?t:1}});return t}(e.config.get("list.properties"));t.schema.extend("listItem",{allowAttributes:i.map(e=>e.attributeName)});for(const t of i)t.addCommand(e);var n;this.listenTo(e.commands.get("indentList"),"_executeCleanup",function(e,t){return (i,n)=>{const s=n[0],o=s.getAttribute("listIndent"),r=n.filter(e=>e.getAttribute("listIndent")===o);let a=null;s.previousSibling.getAttribute("listIndent")+1!==o&&(a=OB(s.previousSibling,{sameIndent:true,direction:"backward",listIndent:o})),e.model.change(e=>{for(const i of r)for(const n of t)if(n.appliesToListItem(i)){const t=null==a?n.defaultValue:a.getAttribute(n.attributeName);e.setAttribute(n.attributeName,t,i);}});}}(e,i)),this.listenTo(e.commands.get("outdentList"),"_executeCleanup",function(e,t){return (i,n)=>{if(!(n=n.reverse().filter(e=>e.is("element","listItem"))).length)return;const s=n[0].getAttribute("listIndent"),o=n[0].getAttribute("listType");let r=n[0].previousSibling;if(r.is("element","listItem"))for(;r.getAttribute("listIndent")!==s;)r=r.previousSibling;else r=null;r||(r=n[n.length-1].nextSibling),r&&r.is("element","listItem")&&r.getAttribute("listType")===o&&e.model.change(e=>{const i=n.filter(e=>e.getAttribute("listIndent")===s);for(const n of i)for(const i of t)if(i.appliesToListItem(n)){const t=i.attributeName,s=r.getAttribute(t);e.setAttribute(t,s,n);}});}}(e,i)),this.listenTo(e.commands.get("bulletedList"),"_executeCleanup",dL(e)),this.listenTo(e.commands.get("numberedList"),"_executeCleanup",dL(e)),t.document.registerPostFixer(function(e,t){return i=>{let n=false;const s=hL(e.model.document.differ.getChanges()).filter(e=>"todo"!==e.getAttribute("listType"));if(!s.length)return n;let o=s[s.length-1].nextSibling;if((!o||!o.is("element","listItem"))&&(o=s[0].previousSibling,o)){const e=s[0].getAttribute("listIndent");for(;o.is("element","listItem")&&o.getAttribute("listIndent")!==e&&(o=o.previousSibling,o););}for(const e of t){const t=e.attributeName;for(const r of s)if(e.appliesToListItem(r))if(r.hasAttribute(t)){const s=r.previousSibling;uL(s,r,e.attributeName)&&(i.setAttribute(t,s.getAttribute(t),r),n=true);}else cL(o,r,e)?i.setAttribute(t,o.getAttribute(t),r):i.setAttribute(t,e.defaultValue,r),n=true;else i.removeAttribute(t,r);}return n}}(e,i)),e.conversion.for("upcast").add((n=i,e=>{e.on("element:li",(e,t,i)=>{if(!t.modelRange)return;const s=t.viewItem.parent,o=t.modelRange.start.nodeAfter||t.modelRange.end.nodeBefore;for(const e of n)if(e.appliesToListItem(o)){const t=e.getAttributeOnUpcast(s);i.writer.setAttribute(e.attributeName,t,o);}},{priority:"low"});})),e.conversion.for("downcast").add(function(e){return i=>{for(const n of e)i.on(`attribute:${n.attributeName}:listItem`,(e,i,s)=>{const o=s.writer,r=i.item,a=OB(r.previousSibling,{sameIndent:true,listIndent:r.getAttribute("listIndent"),direction:"backward"}),l=s.mapper.toViewElement(r);t(r,a)||o.breakContainer(o.createPositionBefore(l)),n.setAttributeOnDowncast(o,i.attributeNewValue,l.parent);},{priority:"low"});};function t(e,t){return t&&e.getAttribute("listType")===t.getAttribute("listType")&&e.getAttribute("listIndent")===t.getAttribute("listIndent")&&e.getAttribute("listStyle")===t.getAttribute("listStyle")&&e.getAttribute("listReversed")===t.getAttribute("listReversed")&&e.getAttribute("listStart")===t.getAttribute("listStart")}}(i)),this._mergeListAttributesWhileMergingLists(i);}afterInit(){const e=this.editor;e.commands.get("todoList")&&e.model.document.registerPostFixer(function(e){return t=>{const i=hL(e.model.document.differ.getChanges()).filter(e=>"todo"===e.getAttribute("listType")&&(e.hasAttribute("listStyle")||e.hasAttribute("listReversed")||e.hasAttribute("listStart")));if(!i.length)return  false;for(const e of i)t.removeAttribute("listStyle",e),t.removeAttribute("listReversed",e),t.removeAttribute("listStart",e);return  true}}(e));}_mergeListAttributesWhileMergingLists(e){const t=this.editor.model;let i;this.listenTo(t,"deleteContent",(e,[t])=>{const n=t.getFirstPosition(),s=t.getLastPosition();if(n.parent===s.parent)return;if(!n.parent.is("element","listItem"))return;const o=s.parent.nextSibling;if(!o||!o.is("element","listItem"))return;const r=OB(n.parent,{sameIndent:true,listIndent:o.getAttribute("listIndent")});r&&r.getAttribute("listType")===o.getAttribute("listType")&&(i=r);},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{i&&(t.change(t=>{const n=OB(i.nextSibling,{sameIndent:true,listIndent:i.getAttribute("listIndent"),direction:"forward"});if(!n)return void(i=null);const s=[n,...LB(t.createPositionAt(n,0),"forward")];for(const n of s)for(const s of e)if(s.appliesToListItem(n)){const e=s.attributeName,o=i.getAttribute(e);t.setAttribute(e,o,n);}}),i=null);},{priority:"low"});}}function cL(e,t,i){if(!e)return  false;const n=e.getAttribute(i.attributeName);return !!n&&(n!=i.defaultValue&&e.getAttribute("listType")===t.getAttribute("listType"))}function uL(e,t,i){if(!e||!e.is("element","listItem"))return  false;if(t.getAttribute("listType")!==e.getAttribute("listType"))return  false;const n=e.getAttribute("listIndent");if(n<1||n!==t.getAttribute("listIndent"))return  false;const s=e.getAttribute(i);return !(!s||s===t.getAttribute(i))}function dL(e){return (t,i)=>{i=i.filter(e=>e.is("element","listItem")),e.model.change(e=>{for(const t of i)e.removeAttribute("listStyle",t);});}}function hL(e){const t=[];for(const i of e){const e=mL(i);e&&e.is("element","listItem")&&t.push(e);}return t}function mL(e){return "attribute"===e.type?e.range.start.nodeAfter:"insert"===e.type?e.position.nodeAfter:null}class gL extends Ms{static get requires(){return [lL,cB]}static get pluginName(){return "LegacyListProperties"}static get isOfficialPlugin(){return  true}}const fL="todoListChecked";class pL extends Ns{_selectedElements;constructor(e){super(e),this._selectedElements=[],this.on("execute",()=>{this.refresh();},{priority:"highest"});}refresh(){this._selectedElements=this._getSelectedItems(),this.value=this._selectedElements.every(e=>!!e.getAttribute(fL)),this.isEnabled=!!this._selectedElements.length;}_getSelectedItems(){const e=this.editor.model,t=e.schema,i=e.document.selection.getFirstRange(),n=i.start.parent,s=[];t.checkAttribute(n,fL)&&s.push(n);for(const e of i.getItems())t.checkAttribute(e,fL)&&!s.includes(e)&&s.push(e);return s}execute(e={}){this.editor.model.change(t=>{for(const i of this._selectedElements){(void 0===e.forceValue?!this.value:e.forceValue)?t.setAttribute(fL,true,i):t.removeAttribute(fL,i);}});}}const bL=(e,t,i)=>{const n=t.modelCursor,s=n.parent,o=t.viewItem;if("checkbox"!=o.getAttribute("type")||"listItem"!=s.name||!n.isAtStart)return;if(!i.consumable.consume(o,{name:true}))return;const r=i.writer;r.setAttribute("listType","todo",s),t.viewItem.hasAttribute("checked")&&r.setAttribute("todoListChecked",true,s),t.modelRange=r.createRange(n);};function wL(e){return (t,i)=>{const n=i.modelPosition,s=n.parent;if(!s.is("element","listItem")||"todo"!=s.getAttribute("listType"))return;const o=_L(i.mapper.toViewElement(s),e);o&&(i.viewPosition=i.mapper.findPositionIn(o,n.offset));}}function vL(e,t,i,n){return t.createUIElement("label",{class:"todo-list__label",contenteditable:false},function(t){const s=ii(document,"input",{type:"checkbox",tabindex:"-1"});i&&s.setAttribute("checked","checked"),s.addEventListener("change",()=>n(e));const o=this.toDomElement(t);return o.appendChild(s),o})}function _L(e,t){const i=t.createRangeIn(e);for(const e of i)if(e.item.is("containerElement","span")&&e.item.hasClass("todo-list__label__description"))return e.item}const yL=ln("Ctrl+Enter");class kL extends Ms{static get pluginName(){return "LegacyTodoListEditing"}static get isOfficialPlugin(){return  true}static get requires(){return [tL]}init(){const e=this.editor,{editing:t,data:i,model:n}=e;n.schema.extend("listItem",{allowAttributes:["todoListChecked"]}),n.schema.addAttributeCheck((e,t)=>{const i=e.last;if("todoListChecked"==t&&"listItem"==i.name&&"todo"!=i.getAttribute("listType"))return  false}),e.commands.add("todoList",new AB(e,"todo"));const s=new pL(e);var o,r;e.commands.add("checkTodoList",s),e.commands.add("todoListCheck",s),i.downcastDispatcher.on("insert:listItem",function(e){return (t,i,n)=>{const s=n.consumable;if(!s.test(i.item,"insert")||!s.test(i.item,"attribute:listType")||!s.test(i.item,"attribute:listIndent"))return;if("todo"!=i.item.getAttribute("listType"))return;const o=i.item;s.consume(o,"insert"),s.consume(o,"attribute:listType"),s.consume(o,"attribute:listIndent"),s.consume(o,"attribute:todoListChecked");const r=n.writer,a=IB(o,n);r.addClass("todo-list",a.parent);const l=r.createContainerElement("label",{class:"todo-list__label"}),c=r.createEmptyElement("input",{type:"checkbox",disabled:"disabled"}),u=r.createContainerElement("span",{class:"todo-list__label__description"});o.getAttribute("todoListChecked")&&r.setAttribute("checked","checked",c),r.insert(r.createPositionAt(a,0),l),r.insert(r.createPositionAt(l,0),c),r.insert(r.createPositionAfter(c),u),PB(o,a,n,e);}}(n),{priority:"high"}),i.upcastDispatcher.on("element:input",bL,{priority:"high"}),t.downcastDispatcher.on("insert:listItem",function(e,t){return (i,n,s)=>{const o=s.consumable;if(!o.test(n.item,"insert")||!o.test(n.item,"attribute:listType")||!o.test(n.item,"attribute:listIndent"))return;if("todo"!=n.item.getAttribute("listType"))return;const r=n.item;o.consume(r,"insert"),o.consume(r,"attribute:listType"),o.consume(r,"attribute:listIndent"),o.consume(r,"attribute:todoListChecked");const a=s.writer,l=IB(r,s),c=!!r.getAttribute("todoListChecked"),u=vL(r,a,c,t),d=a.createContainerElement("span",{class:"todo-list__label__description"});a.addClass("todo-list",l.parent),a.insert(a.createPositionAt(l,0),u),a.insert(a.createPositionAfter(u),d),PB(r,l,s,e);}}(n,e=>this._handleCheckmarkChange(e)),{priority:"high"}),t.downcastDispatcher.on("attribute:listType:listItem",(o=e=>this._handleCheckmarkChange(e),r=t.view,(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const n=i.mapper.toViewElement(t.item),s=i.writer,a=function(e,t){const i=t.createRangeIn(e);for(const e of i)if(e.item.is("uiElement","label"))return e.item}(n,r);if("todo"==t.attributeNewValue){const e=!!t.item.getAttribute("todoListChecked"),i=vL(t.item,s,e,o),r=s.createContainerElement("span",{class:"todo-list__label__description"}),a=s.createRangeIn(n),l=BB(n),c=RB(a.start),u=l?s.createPositionBefore(l):a.end,d=s.createRange(c,u);s.addClass("todo-list",n.parent),s.move(d,s.createPositionAt(r,0)),s.insert(s.createPositionAt(n,0),i),s.insert(s.createPositionAfter(i),r);}else if("todo"==t.attributeOldValue){const e=_L(n,r);s.removeClass("todo-list",n.parent),s.remove(a),s.move(s.createRangeIn(e),s.createPositionBefore(e)),s.remove(e);}})),t.downcastDispatcher.on("attribute:todoListChecked:listItem",function(e){return (t,i,n)=>{if("todo"!=i.item.getAttribute("listType"))return;if(!n.consumable.consume(i.item,"attribute:todoListChecked"))return;const{mapper:s,writer:o}=n,r=!!i.item.getAttribute("todoListChecked"),a=s.toViewElement(i.item).getChild(0),l=vL(i.item,o,r,e);o.insert(o.createPositionAfter(a),l),o.remove(a);}}(e=>this._handleCheckmarkChange(e))),t.mapper.on("modelToViewPosition",wL(t.view)),i.mapper.on("modelToViewPosition",wL(t.view)),this.listenTo(t.view.document,"arrowKey",function(e,t){return (i,n)=>{if("left"!=dn(n.keyCode,t.contentLanguageDirection))return;const s=e.schema,o=e.document.selection;if(!o.isCollapsed)return;const r=o.getFirstPosition(),a=r.parent;if("listItem"===a.name&&"todo"==a.getAttribute("listType")&&r.isAtStart){const t=s.getNearestSelectionRange(e.createPositionBefore(a),"backward");t&&e.change(e=>e.setSelection(t)),n.preventDefault(),n.stopPropagation(),i.stop();}}}(n,e.locale),{context:"li"}),this.listenTo(t.view.document,"keydown",(t,i)=>{an(i)===yL&&(e.execute("checkTodoList"),t.stop());},{priority:"high"});const a=new Set;this.listenTo(n,"applyOperation",(e,t)=>{const i=t[0];if("rename"==i.type&&"listItem"==i.oldName){const e=i.position.nodeAfter;e.hasAttribute("todoListChecked")&&a.add(e);}else if("changeAttribute"==i.type&&"listType"==i.key&&"todo"===i.oldValue)for(const e of i.range.getItems())e.hasAttribute("todoListChecked")&&"todo"!==e.getAttribute("listType")&&a.add(e);}),n.document.registerPostFixer(e=>{let t=false;for(const i of a)e.removeAttribute("todoListChecked",i),t=true;return a.clear(),t}),this._initAriaAnnouncements();}_handleCheckmarkChange(e){const t=this.editor,i=t.model,n=Array.from(i.document.selection.getRanges());i.change(i=>{i.setSelection(e,"end"),t.execute("checkTodoList"),i.setSelection(n);});}_initAriaAnnouncements(){const{model:e,ui:t,t:i}=this.editor;let n=null;t&&e.document.selection.on("change:range",()=>{const s=e.document.selection.focus.parent,o=CL(n),r=CL(s);o&&!r?t.ariaLiveAnnouncer.announce(i("Leaving a to-do list")):!o&&r&&t.ariaLiveAnnouncer.announce(i("Entering a to-do list")),n=s;});}}function CL(e){return !!e&&e.is("element","listItem")&&"todo"===e.getAttribute("listType")}class xL extends Ms{static get requires(){return [kL,CB]}static get pluginName(){return "LegacyTodoList"}static get isOfficialPlugin(){return  true}}class AL extends Ms{static get pluginName(){return "AdjacentListsSupport"}static get isOfficialPlugin(){return  true}init(){const e=this.editor;e.model.schema.register("listSeparator",{allowWhere:"$block",isBlock:true}),e.conversion.for("upcast").add(e=>{e.on("element:ol",EL()),e.on("element:ul",EL());}).elementToElement({model:"listSeparator",view:"ck-list-separator"}),e.conversion.for("editingDowncast").elementToElement({model:"listSeparator",view:{name:"div",classes:["ck-list-separator","ck-hidden"]}}),e.conversion.for("dataDowncast").elementToElement({model:"listSeparator",view:(e,t)=>{const i=t.writer.createContainerElement("ck-list-separator");return t.writer.setCustomProperty("dataPipeline:transparentRendering",true,i),i.getFillerOffset=()=>null,i}});}}function EL(){return (e,t,i)=>{const n=t.viewItem,s=n.nextSibling;if(!s)return;if(n.name!==s.name)return;t.modelRange||Object.assign(t,i.convertChildren(t.viewItem,t.modelCursor));const o=i.writer,r=o.createElement("listSeparator");if(!i.safeInsert(r,t.modelCursor))return;const a=i.getSplitParts(r);t.modelRange=o.createRange(t.modelRange.start,o.createPositionAfter(a[a.length-1])),i.updateConversionResult(r,t);}}class TL extends Ns{_indentBehavior;constructor(e,t){super(e),this._indentBehavior=t;}refresh(){const e=this._getFirstListItemIfSelectionIsAtListStart(this.editor.model.document.selection);this.isEnabled=!!e&&this._indentBehavior.checkEnabled(e.getAttribute("blockIndentList"));}execute(e={}){const t=this.editor,i=t.model,n=i.document.selection,s=t.plugins.get("ListUtils");i.change(t=>{const o=this._getFirstListItemIfSelectionIsAtListStart(n),r=[];if(e.firstListOnly)r.push(o);else {const e=Array.from(n.getSelectedBlocks());for(const t of e)LR(t)&&0===t.getAttribute("listIndent")&&i.schema.checkAttribute(t,"blockIndentList")&&r.push(t);}const a=s.expandListBlocksToCompleteList(r);for(const e of a){const i=e.getAttribute("blockIndentList"),n=this._indentBehavior.getNextIndent(i);n?t.setAttribute("blockIndentList",n,e):t.removeAttribute("blockIndentList",e);}});}_getFirstListItemIfSelectionIsAtListStart(e){const t=e.getFirstPosition(),i=this.editor.plugins.get("ListUtils"),n=t.parent,s=this.editor.model.schema;return t.isAtStart&&LR(n)&&0==n.getAttribute("listIndent")&&s.checkAttribute(n,"blockIndentList")&&i.isFirstListItemInList(n)?n:null}}class SL extends Ns{_indentBehavior;constructor(e,t){super(e),this._indentBehavior=t;}refresh(){this.isEnabled=this._getAffectedListItems().length>0;}execute(){this.editor.model.change(e=>{for(const t of this._getAffectedListItems())e.removeAttribute("blockIndentListItem",t);});}_getAffectedListItems(){const e=this.editor.model.document.selection,t=this.editor.plugins.get("ListUtils"),i=Array.from(e.getSelectedBlocks());return t.expandListBlocksToCompleteItems(i).filter(e=>this._isIndentationChangeAllowed(e))}_isIndentationChangeAllowed(e){return !!e.hasAttribute("blockIndentListItem")&&this._indentBehavior.checkEnabled(e.getAttribute("blockIndentListItem"))}}class IL extends IR{checkEnabled(e){const t=parseFloat(e);return this.isForward&&t<0||!this.isForward&&t>0}}class PL extends PR{checkEnabled(e){return !this.isForward&&!!e}}class VL extends Ms{static get pluginName(){return "IndentBlockListIntegration"}static get isOfficialPlugin(){return  true}init(){const e=this.editor;if(!this.editor.plugins.has("ListEditing"))return;const t=e.config.get("indentBlock");t.classes&&t.classes.length?(this._setupConversionUsingClasses(t.classes,"ol","blockIndentList","list"),this._setupConversionUsingClasses(t.classes,"ul","blockIndentList","list"),this._setupConversionUsingClasses(t.classes,"li","blockIndentListItem","item"),e.commands.add("indentBlockList",new TL(e,new PR({direction:"forward",classes:t.classes}))),e.commands.add("outdentBlockList",new TL(e,new PR({direction:"backward",classes:t.classes}))),e.commands.add("indentBlockListItem",new SL(e,new PL({direction:"forward",classes:t.classes}))),e.commands.add("outdentBlockListItem",new SL(e,new PL({direction:"backward",classes:t.classes})))):(e.data.addStyleProcessorRules(yd),this._setupConversionUsingOffset("ol","blockIndentList","list"),this._setupConversionUsingOffset("ul","blockIndentList","list"),this._setupConversionUsingOffset("li","blockIndentListItem","item"),e.commands.add("indentBlockList",new TL(e,new IR({direction:"forward",offset:t.offset,unit:t.unit}))),e.commands.add("outdentBlockList",new TL(e,new IR({direction:"backward",offset:t.offset,unit:t.unit}))),e.commands.add("indentBlockListItem",new SL(e,new IL({direction:"forward",offset:t.offset,unit:t.unit}))),e.commands.add("outdentBlockListItem",new SL(e,new IL({direction:"backward",offset:t.offset,unit:t.unit}))));e.plugins.get("ListEditing").on("postFixer",(e,{listNodes:t,writer:i})=>{for(const{node:n,previousNodeInList:s}of t)s&&s.getAttribute("listType")==n.getAttribute("listType")&&(OL("blockIndentList",n,s,i)&&(e.return=true),s.getAttribute("listItemId")==n.getAttribute("listItemId")&&OL("blockIndentListItem",n,s,i)&&(e.return=true));}),this.listenTo(e.editing.view.document,"tab",(t,i)=>{const n=i.shiftKey?"outdentBlockList":"indentBlockList";this.editor.commands.get(n).isEnabled&&(e.execute(n,{firstListOnly:true}),i.stopPropagation(),i.preventDefault(),t.stop());},{context:"li",priority:"high"});}afterInit(){const e=this.editor,t=e.model,i=t.schema;if(!e.plugins.has("ListEditing"))return;i.extend("$listItem",{allowAttributes:["blockIndentList","blockIndentListItem"]}),i.setAttributeProperties("blockIndentList",{isFormatting:true}),i.setAttributeProperties("blockIndentListItem",{isFormatting:true}),t.schema.addAttributeCheck(e=>{if(!e.last.getAttribute("listItemId"))return  false},"blockIndentList"),t.schema.addAttributeCheck(e=>{if(!e.last.getAttribute("listItemId"))return  false},"blockIndentListItem");const n=(t,i)=>{e.model.change(e=>{for(const t of i)t.hasAttribute("listItemId")&&(t.hasAttribute("blockIndentList")&&e.removeAttribute("blockIndentList",t),t.hasAttribute("blockIndentListItem")&&e.removeAttribute("blockIndentListItem",t));});},s=e.commands.get("indentList"),o=e.commands.get("outdentList");s&&this.listenTo(s,"afterExecute",n),o&&this.listenTo(o,"afterExecute",n);const r=e.commands.get("indent"),a=e.commands.get("outdent");r.registerChildCommand(e.commands.get("indentBlockList")),a.registerChildCommand(e.commands.get("outdentBlockList")),r.registerChildCommand(e.commands.get("indentBlockListItem")),a.registerChildCommand(e.commands.get("outdentBlockListItem"));}_setupConversionUsingOffset(e,t,i){const n=this.editor,s=n.locale,o=n.conversion,r="rtl"===s.contentLanguageDirection?"margin-right":"margin-left",a=n.plugins.get("ListEditing");o.for("upcast").add(i=>{i.on(`element:${e}`,RL(t,e=>e.getStyle(r),(e,t)=>e.consume(t,{styles:r})),{priority:"low"});}),a.registerDowncastStrategy({scope:i,attributeName:t,setAttributeOnDowncast(e,t,i){t&&e.setStyle(r,t,i);}});}_setupConversionUsingClasses(e,t,i,n){const s=this.editor,o=s.conversion,r=s.plugins.get("ListEditing");o.for("upcast").add(n=>{n.on(`element:${t}`,RL(i,t=>e.find(e=>t.hasClass(e)),(e,t,i)=>e.consume(t,{classes:i})),{priority:"low"});}),r.registerDowncastStrategy({scope:n,attributeName:i,setAttributeOnDowncast(e,t,i){t&&e.addClass(t,i);}});}}function RL(e,t,i){return (n,s,o)=>{const{writer:r,consumable:a}=o;s.modelRange||Object.assign(s,o.convertChildren(s.viewItem,s.modelCursor));const l=t(s.viewItem);if(void 0===l)return;let c,u=false;for(const t of s.modelRange.getItems({shallow:true})) void 0===c&&(c=t.getAttribute("listIndent")),t.hasAttribute(e)||t.getAttribute("listIndent")===c&&(r.setAttribute(e,l,t),u=true);u&&i(a,s.viewItem,l);}}function OL(e,t,i,n){const s=i.getAttribute(e);return t.getAttribute(e)!==s&&(s?n.setAttribute(e,s,t):n.removeAttribute(e,t),true)}const BL=["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"];class LL extends Ms{constructor(e){super(e),e.config.define("indentBlock",{offset:40,unit:"px"});}static get pluginName(){return "IndentBlock"}static get isOfficialPlugin(){return  true}static get requires(){return [VL]}init(){const e=this.editor,t=e.config.get("indentBlock");t.classes&&t.classes.length?(this._setupConversionUsingClasses(t.classes),e.commands.add("indentBlock",new SR(e,new PR({direction:"forward",classes:t.classes}))),e.commands.add("outdentBlock",new SR(e,new PR({direction:"backward",classes:t.classes})))):(e.data.addStyleProcessorRules(yd),this._setupConversionUsingOffset(),e.commands.add("indentBlock",new SR(e,new IR({direction:"forward",offset:t.offset,unit:t.unit}))),e.commands.add("outdentBlock",new SR(e,new IR({direction:"backward",offset:t.offset,unit:t.unit}))));}afterInit(){const e=this.editor,t=e.model.schema,i=e.commands.get("indent"),n=e.commands.get("outdent"),s=e.config.get("heading.options"),o=s&&s.map(e=>e.model);(o||BL).forEach(e=>{t.isRegistered(e)&&t.extend(e,{allowAttributes:"blockIndent"});}),t.setAttributeProperties("blockIndent",{isFormatting:true}),i.registerChildCommand(e.commands.get("indentBlock")),n.registerChildCommand(e.commands.get("outdentBlock"));}_setupConversionUsingOffset(){const e=this.editor.conversion,t="rtl"===this.editor.locale.contentLanguageDirection?"margin-right":"margin-left";e.for("upcast").attributeToAttribute({view:{styles:{[t]:/[\s\S]+/}},model:{key:"blockIndent",value:e=>{if(!e.is("element","li"))return e.getStyle(t)}}}),e.for("downcast").attributeToAttribute({model:"blockIndent",view:e=>({key:"style",value:{[t]:e}})});}_setupConversionUsingClasses(e){const t={model:{key:"blockIndent",values:[]},view:{}};for(const i of e)t.model.values.push(i),t.view[i]={key:"class",value:[i]};this.editor.conversion.attributeToAttribute(t);}}function ML(e,t){return `${e}:${t=t||fn(e)}`}function FL(e){const[t,i]=e.split(":");return {languageCode:t,textDirection:i}}class NL extends Ns{refresh(){const e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"language");}execute({languageCode:e,textDirection:t}={}){const i=this.editor.model,n=i.document.selection,s=!!e&&ML(e,t);i.change(e=>{if(n.isCollapsed)s?e.setSelectionAttribute("language",s):e.removeSelectionAttribute("language");else {const t=i.schema.getValidRanges(n.getRanges(),"language",{includeEmptyRanges:true});for(const i of t){let t=i,n="language";i.isCollapsed&&(t=i.start.parent,n=Oa._getStoreAttributeKey("language")),s?e.setAttribute(n,s,t):e.removeAttribute(n,t);}}});}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,i=e.document.selection;if(i.isCollapsed)return i.getAttribute("language")||false;for(const e of i.getRanges())for(const i of e.getItems())if(t.checkAttribute(i,"language"))return i.getAttribute("language")||false;return  false}}class DL extends Ms{static get pluginName(){return "TextPartLanguageEditing"}static get isOfficialPlugin(){return  true}constructor(e){super(e),e.config.define("language",{textPartLanguage:[{title:"Arabic",languageCode:"ar"},{title:"French",languageCode:"fr"},{title:"Spanish",languageCode:"es"}]});}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"language"}),e.model.schema.setAttributeProperties("language",{copyOnEnter:true}),this._defineConverters(),e.commands.add("textPartLanguage",new NL(e));}_defineConverters(){const e=this.editor.conversion;e.for("upcast").elementToAttribute({model:{key:"language",value:e=>ML(e.getAttribute("lang"),e.getAttribute("dir"))},view:{name:"span",attributes:{lang:/[\s\S]+/}}}),e.for("downcast").attributeToElement({model:"language",view:(e,{writer:t},i)=>{if(!e)return;if(!i.item.is("$textProxy")&&!i.item.is("documentSelection"))return;const{languageCode:n,textDirection:s}=FL(e);return t.createAttributeElement("span",{lang:n,dir:s})}});}}class zL extends Ms{static get pluginName(){return "TextPartLanguageUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.t,i=t("Choose language"),n=t("Language");e.ui.componentFactory.add("textPartLanguage",t=>{const{definitions:s,titles:o}=this._getItemMetadata(),r=e.commands.get("textPartLanguage"),a=ww(t);return Cw(a,s,{ariaLabel:n,role:"menu"}),a.buttonView.set({ariaLabel:n,ariaLabelledBy:void 0,isOn:false,withText:true,tooltip:n}),a.extendTemplate({attributes:{class:["ck-text-fragment-language-dropdown"]}}),a.bind("isEnabled").to(r,"isEnabled"),a.buttonView.bind("label").to(r,"value",e=>e&&o[e]||i),a.buttonView.bind("ariaLabel").to(r,"value",e=>{const t=e&&o[e];return t?`${t}, ${n}`:n}),this.listenTo(a,"execute",t=>{r.execute({languageCode:t.source.languageCode,textDirection:t.source.textDirection}),e.editing.view.focus();}),a}),e.ui.componentFactory.add("menuBar:textPartLanguage",i=>{const{definitions:s}=this._getItemMetadata(),o=e.commands.get("textPartLanguage"),r=new x_(i);r.buttonView.set({label:n});const a=new A_(i);a.set({ariaLabel:t("Language"),role:"menu"});for(const e of s){if("button"!=e.type){a.items.add(new Yb(i));continue}const t=new Av(i,r),n=new Jp(i);n.set({role:"menuitemradio",isToggleable:true}),n.bind(...Object.keys(e.model)).to(e.model),n.delegate("execute").to(r),t.children.add(n),a.items.add(t);}return r.bind("isEnabled").to(o,"isEnabled"),r.panelView.children.add(a),r.on("execute",t=>{o.execute({languageCode:t.source.languageCode,textDirection:t.source.textDirection}),e.editing.view.focus();}),r});}_getItemMetadata(){const e=this.editor,t=new kn,i={},n=e.commands.get("textPartLanguage"),s=e.config.get("language.textPartLanguage"),o=(0, e.locale.t)("Remove language");t.add({type:"button",model:new e_({label:o,languageCode:false,withText:true})}),t.add({type:"separator"});for(const e of s){const s={type:"button",model:new e_({label:e.title,languageCode:e.languageCode,role:"menuitemradio",textDirection:e.textDirection,withText:true})},o=ML(e.languageCode,e.textDirection);s.model.bind("isOn").to(n,"value",e=>e===o),t.add(s),i[o]=e.title;}return {definitions:t,titles:i}}}class HL extends Ms{static get requires(){return [DL,zL]}static get pluginName(){return "TextPartLanguage"}static get isOfficialPlugin(){return  true}}function qL(e){if(e)throw e}var UL,jL;var $L=function(){if(jL)return UL;jL=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,i=Object.defineProperty,n=Object.getOwnPropertyDescriptor,s=function(e){return "function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===t.call(e)},o=function(i){if(!i||"[object Object]"!==t.call(i))return  false;var n,s=e.call(i,"constructor"),o=i.constructor&&i.constructor.prototype&&e.call(i.constructor.prototype,"isPrototypeOf");if(i.constructor&&!s&&!o)return  false;for(n in i);return void 0===n||e.call(i,n)},r=function(e,t){i&&"__proto__"===t.name?i(e,t.name,{enumerable:true,configurable:true,value:t.newValue,writable:true}):e[t.name]=t.newValue;},a=function(t,i){if("__proto__"===i){if(!e.call(t,i))return;if(n)return n(t,i).value}return t[i]};return UL=function e(){var t,i,n,l,c,u,d=arguments[0],h=1,m=arguments.length,g=false;for("boolean"==typeof d&&(g=d,d=arguments[1]||{},h=2),(null==d||"object"!=typeof d&&"function"!=typeof d)&&(d={});h<m;++h)if(null!=(t=arguments[h]))for(i in t)n=a(d,i),d!==(l=a(t,i))&&(g&&l&&(o(l)||(c=s(l)))?(c?(c=false,u=n&&s(n)?n:[]):u=n&&o(n)?n:{},r(d,{name:i,newValue:e(g,u,l)})):void 0!==l&&r(d,{name:i,newValue:l}));return d},UL}();function WL(e){if("object"!=typeof e||null===e)return  false;const t=Object.getPrototypeOf(e);return !(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)}function GL(){const e=[],t={run:function(...t){let i=-1;const n=t.pop();if("function"!=typeof n)throw new TypeError("Expected function as last argument, not "+n);!function s(o,...r){const a=e[++i];let l=-1;if(o)n(o);else {for(;++l<t.length;)null!==r[l]&&void 0!==r[l]||(r[l]=t[l]);t=r,a?function(e,t){let i;return n;function n(...t){const n=e.length>t.length;let r;n&&t.push(s);try{r=e.apply(this,t);}catch(e){if(n&&i)throw e;return s(e)}n||(r&&r.then&&"function"==typeof r.then?r.then(o,s):r instanceof Error?s(r):o(r));}function s(e,...n){i||(i=true,t(e,...n));}function o(e){s(null,e);}}(a,s)(...r):n(null,...r);}}(null,...t);},use:function(i){if("function"!=typeof i)throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}};return t}function KL(e){return e&&"object"==typeof e?"position"in e||"type"in e?QL(e.position):"start"in e||"end"in e?QL(e):"line"in e||"column"in e?JL(e):"":""}function JL(e){return YL(e&&e.line)+":"+YL(e&&e.column)}function QL(e){return JL(e&&e.start)+"-"+JL(e&&e.end)}function YL(e){return e&&"number"==typeof e?e:1}class ZL extends Error{constructor(e,t,i){super(),"string"==typeof t&&(i=t,t=void 0);let n="",s={},o=false;if(t&&(s="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?n=e:!s.cause&&e&&(o=true,n=e.message,s.cause=e),!s.ruleId&&!s.source&&"string"==typeof i){const e=i.indexOf(":");-1===e?s.ruleId=i:(s.source=i.slice(0,e),s.ruleId=i.slice(e+1));}if(!s.place&&s.ancestors&&s.ancestors){const e=s.ancestors[s.ancestors.length-1];e&&(s.place=e.position);}const r=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=r?r.column:void 0,this.fatal=void 0,this.file="",this.message=n,this.line=r?r.line:void 0,this.name=KL(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&"string"==typeof s.cause.stack?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0;}}ZL.prototype.file="",ZL.prototype.name="",ZL.prototype.reason="",ZL.prototype.message="",ZL.prototype.stack="",ZL.prototype.column=void 0,ZL.prototype.line=void 0,ZL.prototype.ancestors=void 0,ZL.prototype.cause=void 0,ZL.prototype.fatal=void 0,ZL.prototype.place=void 0,ZL.prototype.ruleId=void 0,ZL.prototype.source=void 0;const XL={basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');eM(e);let i,n=0,s=-1,o=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;o--;)if(47===e.codePointAt(o)){if(i){n=o+1;break}}else s<0&&(i=true,s=o+1);return s<0?"":e.slice(n,s)}if(t===e)return "";let r=-1,a=t.length-1;for(;o--;)if(47===e.codePointAt(o)){if(i){n=o+1;break}}else r<0&&(i=true,r=o+1),a>-1&&(e.codePointAt(o)===t.codePointAt(a--)?a<0&&(s=o):(a=-1,s=r));n===s?s=r:s<0&&(s=e.length);return e.slice(n,s)},dirname:function(e){if(eM(e),0===e.length)return ".";let t,i=-1,n=e.length;for(;--n;)if(47===e.codePointAt(n)){if(t){i=n;break}}else t||(t=true);return i<0?47===e.codePointAt(0)?"/":".":1===i&&47===e.codePointAt(0)?"//":e.slice(0,i)},extname:function(e){eM(e);let t,i=e.length,n=-1,s=0,o=-1,r=0;for(;i--;){const a=e.codePointAt(i);if(47!==a)n<0&&(t=true,n=i+1),46===a?o<0?o=i:1!==r&&(r=1):o>-1&&(r=-1);else if(t){s=i+1;break}}if(o<0||n<0||0===r||1===r&&o===n-1&&o===s+1)return "";return e.slice(o,n)},join:function(...e){let t,i=-1;for(;++i<e.length;)eM(e[i]),e[i]&&(t=void 0===t?e[i]:t+"/"+e[i]);return void 0===t?".":function(e){eM(e);const t=47===e.codePointAt(0);let i=function(e,t){let i,n,s="",o=0,r=-1,a=0,l=-1;for(;++l<=e.length;){if(l<e.length)i=e.codePointAt(l);else {if(47===i)break;i=47;}if(47===i){if(r===l-1||1===a);else if(r!==l-1&&2===a){if(s.length<2||2!==o||46!==s.codePointAt(s.length-1)||46!==s.codePointAt(s.length-2))if(s.length>2){if(n=s.lastIndexOf("/"),n!==s.length-1){n<0?(s="",o=0):(s=s.slice(0,n),o=s.length-1-s.lastIndexOf("/")),r=l,a=0;continue}}else if(s.length>0){s="",o=0,r=l,a=0;continue}t&&(s=s.length>0?s+"/..":"..",o=2);}else s.length>0?s+="/"+e.slice(r+1,l):s=e.slice(r+1,l),o=l-r-1;r=l,a=0;}else 46===i&&a>-1?a++:a=-1;}return s}(e,!t);0!==i.length||t||(i=".");i.length>0&&47===e.codePointAt(e.length-1)&&(i+="/");return t?"/"+i:i}(t)},sep:"/"};function eM(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const tM={cwd:function(){return "/"}};function iM(e){return Boolean(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}function nM(e){if("string"==typeof e)e=new URL(e);else if(!iM(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){const e=new TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}const t=e.pathname;let i=-1;for(;++i<t.length;)if(37===t.codePointAt(i)&&50===t.codePointAt(i+1)){const e=t.codePointAt(i+2);if(70===e||102===e){const e=new TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}const sM=["history","path","basename","stem","extname","dirname"];class oM{constructor(e){let t;t=e?iM(e)?{path:e}:"string"==typeof e||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":tM.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i,n=-1;for(;++n<sM.length;){const e=sM[n];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e]);}for(i in t)sM.includes(i)||(this[i]=t[i]);}get basename(){return "string"==typeof this.path?XL.basename(this.path):void 0}set basename(e){aM(e,"basename"),rM(e,"basename"),this.path=XL.join(this.dirname||"",e);}get dirname(){return "string"==typeof this.path?XL.dirname(this.path):void 0}set dirname(e){lM(this.basename,"dirname"),this.path=XL.join(e||"",this.basename);}get extname(){return "string"==typeof this.path?XL.extname(this.path):void 0}set extname(e){if(rM(e,"extname"),lM(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=XL.join(this.dirname,this.stem+(e||""));}get path(){return this.history[this.history.length-1]}set path(e){iM(e)&&(e=nM(e)),aM(e,"path"),this.path!==e&&this.history.push(e);}get stem(){return "string"==typeof this.path?XL.basename(this.path,this.extname):void 0}set stem(e){aM(e,"stem"),rM(e,"stem"),this.path=XL.join(this.dirname||"",e+(this.extname||""));}fail(e,t,i){const n=this.message(e,t,i);throw n.fatal=true,n}info(e,t,i){const n=this.message(e,t,i);return n.fatal=void 0,n}message(e,t,i){const n=new ZL(e,t,i);return this.path&&(n.name=this.path+":"+n.name,n.file=this.path),n.fatal=false,this.messages.push(n),n}toString(e){if(void 0===this.value)return "";if("string"==typeof this.value)return this.value;return new TextDecoder(e||void 0).decode(this.value)}}function rM(e,t){if(e&&e.includes(XL.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+XL.sep+"`")}function aM(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function lM(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}const cM=function(e){const t=this.constructor.prototype,i=t[e],n=function(){return i.apply(n,arguments)};return Object.setPrototypeOf(n,t),n},uM={}.hasOwnProperty;class dM extends cM{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=GL();}copy(){const e=new dM;let t=-1;for(;++t<this.attachers.length;){const i=this.attachers[t];e.use(...i);}return e.data($L(true,{},this.namespace)),e}data(e,t){return "string"==typeof e?2===arguments.length?(fM("data",this.frozen),this.namespace[e]=t,this):uM.call(this.namespace,e)&&this.namespace[e]||void 0:e?(fM("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[t,...i]=this.attachers[this.freezeIndex];if(false===i[0])continue;true===i[0]&&(i[0]=void 0);const n=t.call(e,...i);"function"==typeof n&&this.transformers.use(n);}return this.frozen=true,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const t=wM(e),i=this.parser||this.Parser;return mM("parse",i),i(String(t),t)}process(e,t){const i=this;return this.freeze(),mM("process",this.parser||this.Parser),gM("process",this.compiler||this.Compiler),t?n(void 0,t):new Promise(n);function n(n,s){const o=wM(e),r=i.parse(o);function a(e,i){e||!i?s(e):n?n(i):t(void 0,i);}i.run(r,o,function(e,t,n){if(e||!t||!n)return a(e);const s=t,o=i.stringify(s,n);var r;"string"==typeof(r=o)||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(r)?n.value=o:n.result=o,a(e,n);});}}processSync(e){let t,i=false;return this.freeze(),mM("processSync",this.parser||this.Parser),gM("processSync",this.compiler||this.Compiler),this.process(e,function(e,n){i=true,qL(e),t=n;}),bM("processSync","process",i),t}run(e,t,i){pM(e),this.freeze();const n=this.transformers;return i||"function"!=typeof t||(i=t,t=void 0),i?s(void 0,i):new Promise(s);function s(s,o){const r=wM(t);n.run(e,r,function(t,n,r){const a=n||e;t?o(t):s?s(a):i(void 0,a,r);});}}runSync(e,t){let i,n=false;return this.run(e,t,function(e,t){qL(e),i=t,n=true;}),bM("runSync","run",n),i}stringify(e,t){this.freeze();const i=wM(t),n=this.compiler||this.Compiler;return gM("stringify",n),pM(e),n(e,i)}use(e,...t){const i=this.attachers,n=this.namespace;if(fM("use",this.frozen),null==e);else if("function"==typeof e)a(e,t);else {if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");Array.isArray(e)?r(e):o(e);}return this;function s(e){if("function"==typeof e)a(e,[]);else {if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");if(Array.isArray(e)){const[t,...i]=e;a(t,i);}else o(e);}}function o(e){if(!("plugins"in e)&&!("settings"in e))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");r(e.plugins),e.settings&&(n.settings=$L(true,n.settings,e.settings));}function r(e){let t=-1;if(null==e);else {if(!Array.isArray(e))throw new TypeError("Expected a list of plugins, not `"+e+"`");for(;++t<e.length;){s(e[t]);}}}function a(e,t){let n=-1,s=-1;for(;++n<i.length;)if(i[n][0]===e){s=n;break}if(-1===s)i.push([e,...t]);else if(t.length>0){let[n,...o]=t;const r=i[s][1];WL(r)&&WL(n)&&(n=$L(true,r,n)),i[s]=[e,n,...o];}}}}const hM=(new dM).freeze();function mM(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `parser`")}function gM(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `compiler`")}function fM(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function pM(e){if(!WL(e)||"string"!=typeof e.type)throw new TypeError("Expected node, got `"+e+"`")}function bM(e,t,i){if(!i)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function wM(e){return function(e){return Boolean(e&&"object"==typeof e&&"message"in e&&"messages"in e)}(e)?e:new oM(e)}function vM(e,t){const i=String(e);if("string"!=typeof t)throw new TypeError("Expected character");let n=0,s=i.indexOf(t);for(;-1!==s;)n++,s=i.indexOf(t,s+t.length);return n}const _M=RM(/[A-Za-z]/),yM=RM(/[\dA-Za-z]/),kM=RM(/[#-'*+\--9=?A-Z^-~]/);function CM(e){return null!==e&&(e<32||127===e)}const xM=RM(/\d/),AM=RM(/[\dA-Fa-f]/),EM=RM(/[!-/:-@[-`{-~]/);function TM(e){return null!==e&&e<-2}function SM(e){return null!==e&&(e<0||32===e)}function IM(e){return  -2===e||-1===e||32===e}const PM=RM(/\p{P}|\p{S}/u),VM=RM(/\s/);function RM(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}const OM=function(e){if(null==e)return LM;if("function"==typeof e)return BM(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let i=-1;for(;++i<e.length;)t[i]=OM(e[i]);return BM(n);function n(...e){let i=-1;for(;++i<t.length;)if(t[i].apply(this,e))return  true;return  false}}(e):function(e){const t=e;return BM(i);function i(i){const n=i;let s;for(s in e)if(n[s]!==t[s])return  false;return  true}}(e);if("string"==typeof e)return function(e){return BM(t);function t(t){return t&&t.type===e}}(e);throw new Error("Expected function, string, or object as test")};function BM(e){return function(t,i,n){return Boolean(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof i?i:void 0,n||void 0))}}function LM(){return  true}const MM=[],FM=true,NM=false,DM="skip";function zM(e,t,i,n){let s;"function"==typeof t&&"function"!=typeof i?(n=i,i=t):s=t;const o=OM(s),r=n?-1:1;!function e(s,a,l){const c=s&&"object"==typeof s?s:{};if("string"==typeof c.type){const e="string"==typeof c.tagName?c.tagName:"string"==typeof c.name?c.name:void 0;Object.defineProperty(u,"name",{value:"node ("+s.type+(e?"<"+e+">":"")+")"});}return u;function u(){let c,u,d,h=MM;if((!t||o(s,a,l[l.length-1]||void 0))&&(h=function(e){if(Array.isArray(e))return e;if("number"==typeof e)return [FM,e];return null==e?MM:[e]}(i(s,l)),h[0]===NM))return h;if("children"in s&&s.children){const t=s;if(t.children&&h[0]!==DM)for(u=(n?t.children.length:-1)+r,d=l.concat(t);u>-1&&u<t.children.length;){const i=t.children[u];if(c=e(i,u,d)(),c[0]===NM)return c;u="number"==typeof c[1]?c[1]:u+r;}}return h}}(e,void 0,[])();}function HM(e,t,i){const n=OM((i||{}).ignore||[]),s=function(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const i=!e[0]||Array.isArray(e[0])?e:[e];let n=-1;for(;++n<i.length;){const e=i[n];t.push([qM(e[0]),UM(e[1])]);}return t}(t);let o=-1;for(;++o<s.length;)zM(e,"text",r);function r(e,t){let i,r=-1;for(;++r<t.length;){const e=t[r],s=i?i.children:void 0;if(n(e,s?s.indexOf(e):void 0,i))return;i=e;}if(i)return function(e,t){const i=t[t.length-1],n=s[o][0],r=s[o][1];let a=0;const l=i.children,c=l.indexOf(e);let u=false,d=[];n.lastIndex=0;let h=n.exec(e.value);for(;h;){const i=h.index,s={index:h.index,input:h.input,stack:[...t,e]};let o=r(...h,s);if("string"==typeof o&&(o=o.length>0?{type:"text",value:o}:void 0),false===o?n.lastIndex=i+1:(a!==i&&d.push({type:"text",value:e.value.slice(a,i)}),Array.isArray(o)?d.push(...o):o&&d.push(o),a=i+h[0].length,u=true),!n.global)break;h=n.exec(e.value);}u?(a<e.value.length&&d.push({type:"text",value:e.value.slice(a)}),i.children.splice(c,1,...d)):d=[e];return c+d.length}(e,t)}}function qM(e){return "string"==typeof e?new RegExp(function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(e),"g"):e}function UM(e){return "function"==typeof e?e:function(){return e}}const jM="phrasing",$M=["autolink","link","image","label"];function WM(e){this.enter({type:"link",title:null,url:"",children:[]},e);}function GM(e){this.config.enter.autolinkProtocol.call(this,e);}function KM(e){this.config.exit.autolinkProtocol.call(this,e);}function JM(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e);}function QM(e){this.config.exit.autolinkEmail.call(this,e);}function YM(e){this.exit(e);}function ZM(e){HM(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,XM],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,eF]],{ignore:["link","linkReference"]});}function XM(e,t,i,n,s){let o="";if(!tF(s))return  false;if(/^w/i.test(t)&&(i=t+i,t="",o="http://"),!function(e){const t=e.split(".");if(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))return  false;return  true}(i))return  false;const r=function(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return [e,void 0];e=e.slice(0,t.index);let i=t[0],n=i.indexOf(")");const s=vM(e,"(");let o=vM(e,")");for(;-1!==n&&s>o;)e+=i.slice(0,n+1),i=i.slice(n+1),n=i.indexOf(")"),o++;return [e,i]}(i+n);if(!r[0])return  false;const a={type:"link",title:null,url:o+t+r[0],children:[{type:"text",value:t+r[0]}]};return r[1]?[a,{type:"text",value:r[1]}]:a}function eF(e,t,i,n){return !(!tF(n,true)||/[-\d_]$/.test(i))&&{type:"link",title:null,url:"mailto:"+t+"@"+i,children:[{type:"text",value:t+"@"+i}]}}function tF(e,t){const i=e.input.charCodeAt(e.index-1);return (0===e.index||VM(i)||PM(i))&&(!t||47!==i)}function iF(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}function nF(){this.buffer();}function sF(e){this.enter({type:"footnoteReference",identifier:"",label:""},e);}function oF(){this.buffer();}function rF(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e);}function aF(e){const t=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=iF(this.sliceSerialize(e)).toLowerCase(),i.label=t;}function lF(e){this.exit(e);}function cF(e){const t=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=iF(this.sliceSerialize(e)).toLowerCase(),i.label=t;}function uF(e){this.exit(e);}function dF(e,t,i,n){const s=i.createTracker(n);let o=s.move("[^");const r=i.enter("footnoteReference"),a=i.enter("reference");return o+=s.move(i.safe(i.associationId(e),{after:"]",before:o})),a(),r(),o+=s.move("]"),o}function hF(e){let t=false;return e&&e.firstLineBlank&&(t=true),{handlers:{footnoteDefinition:function(e,i,n,s){const o=n.createTracker(s);let r=o.move("[^");const a=n.enter("footnoteDefinition"),l=n.enter("label");r+=o.move(n.safe(n.associationId(e),{before:r,after:"]"})),l(),r+=o.move("]:"),e.children&&e.children.length>0&&(o.shift(4),r+=o.move((t?"\n":" ")+n.indentLines(n.containerFlow(e,o.current()),t?gF:mF)));return a(),r},footnoteReference:dF},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}}function mF(e,t,i){return 0===t?e:gF(e,t,i)}function gF(e,t,i){return (i?"":"    ")+e}dF.peek=function(){return "["};const fF=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function pF(e){this.enter({type:"delete",children:[]},e);}function bF(e){this.exit(e);}function wF(e,t,i,n){const s=i.createTracker(n),o=i.enter("strikethrough");let r=s.move("~~");return r+=i.containerPhrasing(e,{...s.current(),before:r,after:"~"}),r+=s.move("~~"),o(),r}function vF(e){return e.length}function _F(e){return null==e?"":String(e)}function yF(e){const t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:82===t||114===t?114:0}wF.peek=function(){return "~"};const kF={}.hasOwnProperty;function CF(e,t){const i=t||{};function n(t,...i){let s=n.invalid;const o=n.handlers;if(t&&kF.call(t,e)){const i=String(t[e]);s=kF.call(o,i)?o[i]:n.unknown;}if(s)return s.call(this,t,...i)}return n.handlers=i.handlers||{},n.invalid=i.invalid,n.unknown=i.unknown,n}const xF={}.hasOwnProperty;function AF(e,t){let i,n=-1;if(t.extensions)for(;++n<t.extensions.length;)AF(e,t.extensions[n]);for(i in t)if(xF.call(t,i))switch(i){case "extensions":break;case "unsafe":case "join":EF(e[i],t[i]);break;case "handlers":TF(e[i],t[i]);break;default:e.options[i]=t[i];}return e}function EF(e,t){t&&e.push(...t);}function TF(e,t){t&&Object.assign(e,t);}function SF(e,t,i){return ">"+(i?"":" ")+e}function IF(e,t){return PF(e,t.inConstruct,true)&&!PF(e,t.notInConstruct,false)}function PF(e,t,i){if("string"==typeof t&&(t=[t]),!t||0===t.length)return i;let n=-1;for(;++n<t.length;)if(e.includes(t[n]))return  true;return  false}function VF(e,t,i,n){let s=-1;for(;++s<i.unsafe.length;)if("\n"===i.unsafe[s].character&&IF(i.stack,i.unsafe[s]))return /[ \t]/.test(n.before)?"":" ";return "\\\n"}function RF(e,t){return Boolean(false===t.options.fences&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function OF(e,t,i){return (i?"":"    ")+e}function BF(e){const t=e.options.quote||'"';if('"'!==t&&"'"!==t)throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function LF(e){return "&#x"+e.toString(16).toUpperCase()+";"}function MF(e){return null===e||SM(e)||VM(e)?1:PM(e)?2:void 0}function FF(e,t,i){const n=MF(e),s=MF(t);return void 0===n?void 0===s?"_"===i?{inside:true,outside:true}:{inside:false,outside:false}:1===s?{inside:true,outside:true}:{inside:false,outside:true}:1===n?void 0===s?{inside:false,outside:false}:1===s?{inside:true,outside:true}:{inside:false,outside:false}:void 0===s?{inside:false,outside:false}:1===s?{inside:true,outside:false}:{inside:false,outside:false}}function NF(e,t,i,n){const s=function(e){const t=e.options.emphasis||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}(i),o=i.enter("emphasis"),r=i.createTracker(n),a=r.move(s);let l=r.move(i.containerPhrasing(e,{after:s,before:a,...r.current()}));const c=l.charCodeAt(0),u=FF(n.before.charCodeAt(n.before.length-1),c,s);u.inside&&(l=LF(c)+l.slice(1));const d=l.charCodeAt(l.length-1),h=FF(n.after.charCodeAt(0),d,s);h.inside&&(l=l.slice(0,-1)+LF(d));const m=r.move(s);return o(),i.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},a+l+m}function DF(e,t,i,n){let s,o,r;"function"==typeof t&&"function"!=typeof i?(o=void 0,r=t,s=i):(o=t,r=i,s=n),zM(e,o,function(e,t){const i=t[t.length-1],n=i?i.children.indexOf(e):void 0;return r(e,n,i)},s);}NF.peek=function(e,t,i){return i.options.emphasis||"*"};const zF={};function HF(e,t){return qF(e,"boolean"!=typeof zF.includeImageAlt||zF.includeImageAlt,"boolean"!=typeof zF.includeHtml||zF.includeHtml)}function qF(e,t,i){if(function(e){return Boolean(e&&"object"==typeof e)}(e)){if("value"in e)return "html"!==e.type||i?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return UF(e.children,t,i)}return Array.isArray(e)?UF(e,t,i):""}function UF(e,t,i){const n=[];let s=-1;for(;++s<e.length;)n[s]=qF(e[s],t,i);return n.join("")}function jF(e,t){let i=false;return DF(e,function(e){if("value"in e&&/\r?\n|\r/.test(e.value)||"break"===e.type)return i=true,NM}),Boolean((!e.depth||e.depth<3)&&HF(e)&&(t.options.setext||i))}function $F(e){return e.value||""}function WF(e,t,i,n){const s=BF(i),o='"'===s?"Quote":"Apostrophe",r=i.enter("image");let a=i.enter("label");const l=i.createTracker(n);let c=l.move("![");return c+=l.move(i.safe(e.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=i.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(i.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=i.enter("destinationRaw"),c+=l.move(i.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=i.enter(`title${o}`),c+=l.move(" "+s),c+=l.move(i.safe(e.title,{before:c,after:s,...l.current()})),c+=l.move(s),a()),c+=l.move(")"),r(),c}function GF(e,t,i,n){const s=e.referenceType,o=i.enter("imageReference");let r=i.enter("label");const a=i.createTracker(n);let l=a.move("![");const c=i.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),r();const u=i.stack;i.stack=[],r=i.enter("reference");const d=i.safe(i.associationId(e),{before:l,after:"]",...a.current()});return r(),i.stack=u,o(),"full"!==s&&c&&c===d?"shortcut"===s?l=l.slice(0,-1):l+=a.move("]"):l+=a.move(d+"]"),l}function KF(e,t,i){let n=e.value||"",s="`",o=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(n);)s+="`";for(/[^ \r\n]/.test(n)&&(/^[ \r\n]/.test(n)&&/[ \r\n]$/.test(n)||/^`|`$/.test(n))&&(n=" "+n+" ");++o<i.unsafe.length;){const e=i.unsafe[o],t=i.compilePattern(e);let s;if(e.atBreak)for(;s=t.exec(n);){let e=s.index;10===n.charCodeAt(e)&&13===n.charCodeAt(e-1)&&e--,n=n.slice(0,e)+" "+n.slice(s.index+1);}}return s+n+s}function JF(e,t){const i=HF(e);return Boolean(!t.options.resourceLink&&e.url&&!e.title&&e.children&&1===e.children.length&&"text"===e.children[0].type&&(i===e.url||"mailto:"+i===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}function QF(e,t,i,n){const s=BF(i),o='"'===s?"Quote":"Apostrophe",r=i.createTracker(n);let a,l;if(JF(e,i)){const t=i.stack;i.stack=[],a=i.enter("autolink");let n=r.move("<");return n+=r.move(i.containerPhrasing(e,{before:n,after:">",...r.current()})),n+=r.move(">"),a(),i.stack=t,n}a=i.enter("link"),l=i.enter("label");let c=r.move("[");return c+=r.move(i.containerPhrasing(e,{before:c,after:"](",...r.current()})),c+=r.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=i.enter("destinationLiteral"),c+=r.move("<"),c+=r.move(i.safe(e.url,{before:c,after:">",...r.current()})),c+=r.move(">")):(l=i.enter("destinationRaw"),c+=r.move(i.safe(e.url,{before:c,after:e.title?" ":")",...r.current()}))),l(),e.title&&(l=i.enter(`title${o}`),c+=r.move(" "+s),c+=r.move(i.safe(e.title,{before:c,after:s,...r.current()})),c+=r.move(s),l()),c+=r.move(")"),a(),c}function YF(e,t,i,n){const s=e.referenceType,o=i.enter("linkReference");let r=i.enter("label");const a=i.createTracker(n);let l=a.move("[");const c=i.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),r();const u=i.stack;i.stack=[],r=i.enter("reference");const d=i.safe(i.associationId(e),{before:l,after:"]",...a.current()});return r(),i.stack=u,o(),"full"!==s&&c&&c===d?"shortcut"===s?l=l.slice(0,-1):l+=a.move("]"):l+=a.move(d+"]"),l}function ZF(e){const t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function XF(e){const t=e.options.rule||"*";if("*"!==t&&"-"!==t&&"_"!==t)throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}$F.peek=function(){return "<"},WF.peek=function(){return "!"},GF.peek=function(){return "!"},KF.peek=function(){return "`"},QF.peek=function(e,t,i){return JF(e,i)?"<":"["},YF.peek=function(){return "["};const eN=OM(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function tN(e,t,i,n){const s=function(e){const t=e.options.strong||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}(i),o=i.enter("strong"),r=i.createTracker(n),a=r.move(s+s);let l=r.move(i.containerPhrasing(e,{after:s,before:a,...r.current()}));const c=l.charCodeAt(0),u=FF(n.before.charCodeAt(n.before.length-1),c,s);u.inside&&(l=LF(c)+l.slice(1));const d=l.charCodeAt(l.length-1),h=FF(n.after.charCodeAt(0),d,s);h.inside&&(l=l.slice(0,-1)+LF(d));const m=r.move(s+s);return o(),i.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},a+l+m}tN.peek=function(e,t,i){return i.options.strong||"*"};const iN={blockquote:function(e,t,i,n){const s=i.enter("blockquote"),o=i.createTracker(n);o.move("> "),o.shift(2);const r=i.indentLines(i.containerFlow(e,o.current()),SF);return s(),r},break:VF,code:function(e,t,i,n){const s=function(e){const t=e.options.fence||"`";if("`"!==t&&"~"!==t)throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}(i),o=e.value||"",r="`"===s?"GraveAccent":"Tilde";if(RF(e,i)){const e=i.enter("codeIndented"),t=i.indentLines(o,OF);return e(),t}const a=i.createTracker(n),l=s.repeat(Math.max(function(e,t){const i=String(e);let n=i.indexOf(t),s=n,o=0,r=0;if("string"!=typeof t)throw new TypeError("Expected substring");for(;-1!==n;)n===s?++o>r&&(r=o):o=1,s=n+t.length,n=i.indexOf(t,s);return r}(o,s)+1,3)),c=i.enter("codeFenced");let u=a.move(l);if(e.lang){const t=i.enter(`codeFencedLang${r}`);u+=a.move(i.safe(e.lang,{before:u,after:" ",encode:["`"],...a.current()})),t();}if(e.lang&&e.meta){const t=i.enter(`codeFencedMeta${r}`);u+=a.move(" "),u+=a.move(i.safe(e.meta,{before:u,after:"\n",encode:["`"],...a.current()})),t();}return u+=a.move("\n"),o&&(u+=a.move(o+"\n")),u+=a.move(l),c(),u},definition:function(e,t,i,n){const s=BF(i),o='"'===s?"Quote":"Apostrophe",r=i.enter("definition");let a=i.enter("label");const l=i.createTracker(n);let c=l.move("[");return c+=l.move(i.safe(i.associationId(e),{before:c,after:"]",...l.current()})),c+=l.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=i.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(i.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=i.enter("destinationRaw"),c+=l.move(i.safe(e.url,{before:c,after:e.title?" ":"\n",...l.current()}))),a(),e.title&&(a=i.enter(`title${o}`),c+=l.move(" "+s),c+=l.move(i.safe(e.title,{before:c,after:s,...l.current()})),c+=l.move(s),a()),r(),c},emphasis:NF,hardBreak:VF,heading:function(e,t,i,n){const s=Math.max(Math.min(6,e.depth||1),1),o=i.createTracker(n);if(jF(e,i)){const t=i.enter("headingSetext"),n=i.enter("phrasing"),r=i.containerPhrasing(e,{...o.current(),before:"\n",after:"\n"});return n(),t(),r+"\n"+(1===s?"=":"-").repeat(r.length-(Math.max(r.lastIndexOf("\r"),r.lastIndexOf("\n"))+1))}const r="#".repeat(s),a=i.enter("headingAtx"),l=i.enter("phrasing");o.move(r+" ");let c=i.containerPhrasing(e,{before:"# ",after:"\n",...o.current()});return /^[\t ]/.test(c)&&(c=LF(c.charCodeAt(0))+c.slice(1)),c=c?r+" "+c:r,i.options.closeAtx&&(c+=" "+r),l(),a(),c},html:$F,image:WF,imageReference:GF,inlineCode:KF,link:QF,linkReference:YF,list:function(e,t,i,n){const s=i.enter("list"),o=i.bulletCurrent;let r=e.ordered?function(e){const t=e.options.bulletOrdered||".";if("."!==t&&")"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}(i):ZF(i);const a=e.ordered?"."===r?")":".":function(e){const t=ZF(e),i=e.options.bulletOther;if(!i)return "*"===t?"-":"*";if("*"!==i&&"+"!==i&&"-"!==i)throw new Error("Cannot serialize items with `"+i+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(i===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+i+"`) to be different");return i}(i);let l=!(!t||!i.bulletLastUsed)&&r===i.bulletLastUsed;if(!e.ordered){const t=e.children?e.children[0]:void 0;if("*"!==r&&"-"!==r||!t||t.children&&t.children[0]||"list"!==i.stack[i.stack.length-1]||"listItem"!==i.stack[i.stack.length-2]||"list"!==i.stack[i.stack.length-3]||"listItem"!==i.stack[i.stack.length-4]||0!==i.indexStack[i.indexStack.length-1]||0!==i.indexStack[i.indexStack.length-2]||0!==i.indexStack[i.indexStack.length-3]||(l=true),XF(i)===r&&t){let t=-1;for(;++t<e.children.length;){const i=e.children[t];if(i&&"listItem"===i.type&&i.children&&i.children[0]&&"thematicBreak"===i.children[0].type){l=true;break}}}}l&&(r=a),i.bulletCurrent=r;const c=i.containerFlow(e,n);return i.bulletLastUsed=r,i.bulletCurrent=o,s(),c},listItem:function(e,t,i,n){const s=function(e){const t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(i);let o=i.bulletCurrent||ZF(i);t&&"list"===t.type&&t.ordered&&(o=("number"==typeof t.start&&t.start>-1?t.start:1)+(false===i.options.incrementListMarker?0:t.children.indexOf(e))+o);let r=o.length+1;("tab"===s||"mixed"===s&&(t&&"list"===t.type&&t.spread||e.spread))&&(r=4*Math.ceil(r/4));const a=i.createTracker(n);a.move(o+" ".repeat(r-o.length)),a.shift(r);const l=i.enter("listItem"),c=i.indentLines(i.containerFlow(e,a.current()),function(e,t,i){if(t)return (i?"":" ".repeat(r))+e;return (i?o:o+" ".repeat(r-o.length))+e});return l(),c},paragraph:function(e,t,i,n){const s=i.enter("paragraph"),o=i.enter("phrasing"),r=i.containerPhrasing(e,n);return o(),s(),r},root:function(e,t,i,n){const s=e.children.some(function(e){return eN(e)});return (s?i.containerPhrasing:i.containerFlow).call(i,e,n)},strong:tN,text:function(e,t,i,n){return i.safe(e.value,n)},thematicBreak:function(e,t,i){const n=(XF(i)+(i.options.ruleSpaces?" ":"")).repeat(function(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}(i));return i.options.ruleSpaces?n.slice(0,-1):n}},nN=[function(e,t,i,n){if("code"===t.type&&RF(t,n)&&("list"===e.type||e.type===t.type&&RF(e,n)))return  false;if("spread"in i&&"boolean"==typeof i.spread){if("paragraph"===e.type&&(e.type===t.type||"definition"===t.type||"heading"===t.type&&jF(t,n)))return;return i.spread?1:0}}];const sN=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],oN=[{character:"\t",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",before:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:"\n",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:sN},{character:'"',inConstruct:"titleQuote"},{atBreak:true,character:"#"},{character:"#",inConstruct:"headingAtx",after:"(?:[\r\n]|$)"},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:sN},{atBreak:true,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:true,character:"*",after:"(?:[ \t\r\n*])"},{character:"*",inConstruct:"phrasing",notInConstruct:sN},{atBreak:true,character:"+",after:"(?:[ \t\r\n])"},{atBreak:true,character:"-",after:"(?:[ \t\r\n-])"},{atBreak:true,before:"\\d+",character:".",after:"(?:[ \t\r\n]|$)"},{atBreak:true,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:sN},{character:"<",inConstruct:"destinationLiteral"},{atBreak:true,character:"="},{atBreak:true,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:true,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:sN},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:true,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:sN},{atBreak:true,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:sN},{atBreak:true,character:"~"}],rN=document.createElement("i");function aN(e){const t="&"+e+";";rN.innerHTML=t;const i=rN.textContent;return (59!==i.charCodeAt(i.length-1)||"semi"===e)&&(i!==t&&i)}function lN(e,t){const i=Number.parseInt(e,t);return i<9||11===i||i>13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||!(65535&~i)||65534==(65535&i)||i>1114111?"�":String.fromCodePoint(i)}const cN=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function uN(e){return e.replace(cN,dN)}function dN(e,t,i){if(t)return t;if(35===i.charCodeAt(0)){const e=i.charCodeAt(1),t=120===e||88===e;return lN(i.slice(t?2:1),t?16:10)}return aN(i)||e}function hN(e){return e.label||!e.identifier?e.label||"":uN(e.identifier)}function mN(e){if(!e._compiled){const t=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=new RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g");}return e._compiled}function gN(e,t,i,n){let s=n.join.length;for(;s--;){const o=n.join[s](e,t,i,n);if(true===o||1===o)break;if("number"==typeof o)return "\n".repeat(1+o);if(false===o)return "\n\n\x3c!----\x3e\n\n"}return "\n\n"}const fN=/\r?\n|\r/g;function pN(e,t){const i=[];let n,s=0,o=0;for(;n=fN.exec(e);)r(e.slice(s,n.index)),i.push(n[0]),s=n.index+n[0].length,o++;return r(e.slice(s)),i.join("");function r(e){i.push(t(e,o,!e));}}function bN(e,t){return e-t}function wN(e,t){const i=/\\(?=[!-/:-@[-`{-~])/g,n=[],s=[],o=e+t;let r,a=-1,l=0;for(;r=i.exec(o);)n.push(r.index);for(;++a<n.length;)l!==n[a]&&s.push(e.slice(l,n[a])),s.push("\\"),l=n[a];return s.push(e.slice(l)),s.join("")}function vN(e){const t=e||{},i=t.now||{};let n=t.lineShift||0,s=i.line||1,o=i.column||1;return {move:function(e){const t=e||"",i=t.split(/\r?\n|\r/g),r=i[i.length-1];return s+=i.length-1,o=1===i.length?o+r.length:1+r.length+n,t},current:function(){return {now:{line:s,column:o},lineShift:n}},shift:function(e){n+=e;}}}function _N(e,t){const i=t||{},n={associationId:hN,containerPhrasing:xN,containerFlow:AN,createTracker:vN,compilePattern:mN,enter:function(e){return n.stack.push(e),function(){n.stack.pop();}},handlers:{...iN},handle:void 0,indentLines:pN,indexStack:[],join:[...nN],options:{},safe:EN,stack:[],unsafe:[...oN]};AF(n,i),n.options.tightDefinitions&&n.join.push(CN),n.handle=CF("type",{invalid:yN,unknown:kN,handlers:n.handlers});let s=n.handle(e,void 0,n,{before:"\n",after:"\n",now:{line:1,column:1},lineShift:0});return s&&10!==s.charCodeAt(s.length-1)&&13!==s.charCodeAt(s.length-1)&&(s+="\n"),s}function yN(e){throw new Error("Cannot handle value `"+e+"`, expected node")}function kN(e){throw new Error("Cannot handle unknown node `"+e.type+"`")}function CN(e,t){if("definition"===e.type&&e.type===t.type)return 0}function xN(e,t){return function(e,t,i){const n=t.indexStack,s=e.children||[],o=[];let r,a=-1,l=i.before;n.push(-1);let c=t.createTracker(i);for(;++a<s.length;){const u=s[a];let d;if(n[n.length-1]=a,a+1<s.length){let i=t.handle.handlers[s[a+1].type];i&&i.peek&&(i=i.peek),d=i?i(s[a+1],e,t,{before:"",after:"",...c.current()}).charAt(0):"";}else d=i.after;o.length>0&&("\r"===l||"\n"===l)&&"html"===u.type&&(o[o.length-1]=o[o.length-1].replace(/(\r?\n|\r)$/," "),l=" ",c=t.createTracker(i),c.move(o.join("")));let h=t.handle(u,e,t,{...c.current(),after:d,before:l});r&&r===h.slice(0,1)&&(h=LF(r.charCodeAt(0))+h.slice(1));const m=t.attentionEncodeSurroundingInfo;t.attentionEncodeSurroundingInfo=void 0,r=void 0,m&&(o.length>0&&m.before&&l===o[o.length-1].slice(-1)&&(o[o.length-1]=o[o.length-1].slice(0,-1)+LF(l.charCodeAt(0))),m.after&&(r=d)),c.move(h),o.push(h),l=h.slice(-1);}return n.pop(),o.join("")}(e,this,t)}function AN(e,t){return function(e,t,i){const n=t.indexStack,s=e.children||[],o=t.createTracker(i),r=[];let a=-1;for(n.push(-1);++a<s.length;){const i=s[a];n[n.length-1]=a,r.push(o.move(t.handle(i,e,t,{before:"\n",after:"\n",...o.current()}))),"list"!==i.type&&(t.bulletLastUsed=void 0),a<s.length-1&&r.push(o.move(gN(i,s[a+1],e,t)));}return n.pop(),r.join("")}(e,this,t)}function EN(e,t){return function(e,t,i){const n=(i.before||"")+(t||"")+(i.after||""),s=[],o=[],r={};let a=-1;for(;++a<e.unsafe.length;){const t=e.unsafe[a];if(!IF(e.stack,t))continue;const i=e.compilePattern(t);let o;for(;o=i.exec(n);){const e="before"in t||Boolean(t.atBreak),i="after"in t,n=o.index+(e?o[1].length:0);s.includes(n)?(r[n].before&&!e&&(r[n].before=false),r[n].after&&!i&&(r[n].after=false)):(s.push(n),r[n]={before:e,after:i});}}s.sort(bN);let l=i.before?i.before.length:0;const c=n.length-(i.after?i.after.length:0);for(a=-1;++a<s.length;){const e=s[a];e<l||e>=c||e+1<c&&s[a+1]===e+1&&r[e].after&&!r[e+1].before&&!r[e+1].after||s[a-1]===e-1&&r[e].before&&!r[e-1].before&&!r[e-1].after||(l!==e&&o.push(wN(n.slice(l,e),"\\")),l=e,!/[!-/:-@[-`{-~]/.test(n.charAt(e))||i.encode&&i.encode.includes(n.charAt(e))?(o.push(LF(n.charCodeAt(e))),l++):o.push("\\"));}return o.push(wN(n.slice(l,c),i.after)),o.join("")}(this,e,t)}function TN(e){const t=e._align;this.enter({type:"table",align:t.map(function(e){return "none"===e?null:e}),children:[]},e),this.data.inTable=true;}function SN(e){this.exit(e),this.data.inTable=void 0;}function IN(e){this.enter({type:"tableRow",children:[]},e);}function PN(e){this.exit(e);}function VN(e){this.enter({type:"tableCell",children:[]},e);}function RN(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,ON));const i=this.stack[this.stack.length-1];i.type,i.value=t,this.exit(e);}function ON(e,t){return "|"===t?t:e}function BN(e){const t=e||{},i=t.tableCellPadding,n=t.tablePipeAlign,s=t.stringLength,o=i?" ":"|";return {unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:true,character:"|",after:"[\t :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:true,character:":",after:"-"},{atBreak:true,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,i){let n=iN.inlineCode(e,t,i);i.stack.includes("tableCell")&&(n=n.replace(/\|/g,"\\$&"));return n},table:function(e,t,i,n){return a(function(e,t,i){const n=e.children;let s=-1;const o=[],r=t.enter("table");for(;++s<n.length;)o[s]=l(n[s],t,i);return r(),o}(e,i,n),e.align)},tableCell:r,tableRow:function(e,t,i,n){const s=l(e,i,n),o=a([s]);return o.slice(0,o.indexOf("\n"))}}};function r(e,t,i,n){const s=i.enter("tableCell"),r=i.enter("phrasing"),a=i.containerPhrasing(e,{...n,before:o,after:o});return r(),s(),a}function a(e,t){return function(e,t){const i=t||{},n=(i.align||[]).concat(),s=i.stringLength||vF,o=[],r=[],a=[],l=[];let c=0,u=-1;for(;++u<e.length;){const t=[],n=[];let o=-1;for(e[u].length>c&&(c=e[u].length);++o<e[u].length;){const r=_F(e[u][o]);if(false!==i.alignDelimiters){const e=s(r);n[o]=e,(void 0===l[o]||e>l[o])&&(l[o]=e);}t.push(r);}r[u]=t,a[u]=n;}let d=-1;if("object"==typeof n&&"length"in n)for(;++d<c;)o[d]=yF(n[d]);else {const e=yF(n);for(;++d<c;)o[d]=e;}d=-1;const h=[],m=[];for(;++d<c;){const e=o[d];let t="",n="";99===e?(t=":",n=":"):108===e?t=":":114===e&&(n=":");let s=false===i.alignDelimiters?1:Math.max(1,l[d]-t.length-n.length);const r=t+"-".repeat(s)+n;false!==i.alignDelimiters&&(s=t.length+s+n.length,s>l[d]&&(l[d]=s),m[d]=s),h[d]=r;}r.splice(1,0,h),a.splice(1,0,m),u=-1;const g=[];for(;++u<r.length;){const e=r[u],t=a[u];d=-1;const n=[];for(;++d<c;){const s=e[d]||"";let r="",a="";if(false!==i.alignDelimiters){const e=l[d]-(t[d]||0),i=o[d];114===i?r=" ".repeat(e):99===i?e%2?(r=" ".repeat(e/2+.5),a=" ".repeat(e/2-.5)):(r=" ".repeat(e/2),a=r):a=" ".repeat(e);} false===i.delimiterStart||d||n.push("|"),false===i.padding||false===i.alignDelimiters&&""===s||false===i.delimiterStart&&!d||n.push(" "),false!==i.alignDelimiters&&n.push(r),n.push(s),false!==i.alignDelimiters&&n.push(a),false!==i.padding&&n.push(" "),false===i.delimiterEnd&&d===c-1||n.push("|");}g.push(false===i.delimiterEnd?n.join("").replace(/ +$/,""):n.join(""));}return g.join("\n")}(e,{align:t,alignDelimiters:n,padding:i,stringLength:s})}function l(e,t,i){const n=e.children;let s=-1;const o=[],a=t.enter("tableRow");for(;++s<n.length;)o[s]=r(n[s],0,t,i);return a(),o}}function LN(e){const t=this.stack[this.stack.length-2];t.type,t.checked="taskListCheckValueChecked"===e.type;}function MN(e){const t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){const e=this.stack[this.stack.length-1];e.type;const i=e.children[0];if(i&&"text"===i.type){const n=t.children;let s,o=-1;for(;++o<n.length;){const e=n[o];if("paragraph"===e.type){s=e;break}}s===e&&(i.value=i.value.slice(1),0===i.value.length?e.children.shift():e.position&&i.position&&"number"==typeof i.position.start.offset&&(i.position.start.column++,i.position.start.offset++,e.position.start=Object.assign({},i.position.start)));}}this.exit(e);}function FN(e,t,i,n){const s=e.children[0],o="boolean"==typeof e.checked&&s&&"paragraph"===s.type,r="["+(e.checked?"x":" ")+"] ",a=i.createTracker(n);o&&a.move(r);let l=iN.listItem(e,t,i,{...n,...a.current()});return o&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+r})),l}function NN(e,t,i,n){const s=e.length;let o,r=0;if(t=t<0?-t>s?0:s+t:t>s?s:t,i=i>0?i:0,n.length<1e4)o=Array.from(n),o.unshift(t,i),e.splice(...o);else for(i&&e.splice(t,i);r<n.length;)o=n.slice(r,r+1e4),o.unshift(t,0),e.splice(...o),r+=1e4,t+=1e4;}function DN(e,t){return e.length>0?(NN(e,e.length,0,t),e):t}const zN={}.hasOwnProperty;function HN(e){const t={};let i=-1;for(;++i<e.length;)qN(t,e[i]);return t}function qN(e,t){let i;for(i in t){const n=(zN.call(e,i)?e[i]:void 0)||(e[i]={}),s=t[i];let o;if(s)for(o in s){zN.call(n,o)||(n[o]=[]);const e=s[o];UN(n[o],Array.isArray(e)?e:e?[e]:[]);}}}function UN(e,t){let i=-1;const n=[];for(;++i<t.length;)("after"===t[i].add?e:n).push(t[i]);NN(e,0,0,n);}const jN={tokenize:function(e,t,i){let n=0;return function t(o){if((87===o||119===o)&&n<3)return n++,e.consume(o),t;if(46===o&&3===n)return e.consume(o),s;return i(o)};function s(e){return null===e?i(e):t(e)}},partial:true},$N={tokenize:function(e,t,i){let n,s,o;return r;function r(t){return 46===t||95===t?e.check(GN,l,a)(t):null===t||SM(t)||VM(t)||45!==t&&PM(t)?l(t):(o=true,e.consume(t),r)}function a(t){return 95===t?n=true:(s=n,n=void 0),e.consume(t),r}function l(e){return s||n||!o?i(e):t(e)}},partial:true},WN={tokenize:function(e,t){let i=0,n=0;return s;function s(r){return 40===r?(i++,e.consume(r),s):41===r&&n<i?o(r):33===r||34===r||38===r||39===r||41===r||42===r||44===r||46===r||58===r||59===r||60===r||63===r||93===r||95===r||126===r?e.check(GN,t,o)(r):null===r||SM(r)||VM(r)?t(r):(e.consume(r),s)}function o(t){return 41===t&&n++,e.consume(t),s}},partial:true},GN={tokenize:function(e,t,i){return n;function n(r){return 33===r||34===r||39===r||41===r||42===r||44===r||46===r||58===r||59===r||63===r||95===r||126===r?(e.consume(r),n):38===r?(e.consume(r),o):93===r?(e.consume(r),s):60===r||null===r||SM(r)||VM(r)?t(r):i(r)}function s(e){return null===e||40===e||91===e||SM(e)||VM(e)?t(e):n(e)}function o(e){return _M(e)?r(e):i(e)}function r(t){return 59===t?(e.consume(t),n):_M(t)?(e.consume(t),r):i(t)}},partial:true},KN={tokenize:function(e,t,i){return function(t){return e.consume(t),n};function n(e){return yM(e)?i(e):t(e)}},partial:true},JN={name:"wwwAutolink",tokenize:function(e,t,i){const n=this;return function(t){if(87!==t&&119!==t||!eD.call(n,n.previous)||sD(n.events))return i(t);return e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(jN,e.attempt($N,e.attempt(WN,s),i),i)(t)};function s(i){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(i)}},previous:eD},QN={name:"protocolAutolink",tokenize:function(e,t,i){const n=this;let s="",o=false;return function(t){if((72===t||104===t)&&tD.call(n,n.previous)&&!sD(n.events))return e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(t),e.consume(t),r;return i(t)};function r(t){if(_M(t)&&s.length<5)return s+=String.fromCodePoint(t),e.consume(t),r;if(58===t){const i=s.toLowerCase();if("http"===i||"https"===i)return e.consume(t),a}return i(t)}function a(t){return 47===t?(e.consume(t),o?l:(o=true,a)):i(t)}function l(t){return null===t||CM(t)||SM(t)||VM(t)||PM(t)?i(t):e.attempt($N,e.attempt(WN,c),i)(t)}function c(i){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(i)}},previous:tD},YN={name:"emailAutolink",tokenize:function(e,t,i){const n=this;let s,o;return function(t){if(!nD(t)||!iD.call(n,n.previous)||sD(n.events))return i(t);return e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),r(t)};function r(t){return nD(t)?(e.consume(t),r):64===t?(e.consume(t),a):i(t)}function a(t){return 46===t?e.check(KN,c,l)(t):45===t||95===t||yM(t)?(o=true,e.consume(t),a):c(t)}function l(t){return e.consume(t),s=true,a}function c(r){return o&&s&&_M(n.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(r)):i(r)}},previous:iD},ZN={};let XN=48;for(;XN<123;)ZN[XN]=YN,XN++,58===XN?XN=65:91===XN&&(XN=97);function eD(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||SM(e)}function tD(e){return !_M(e)}function iD(e){return !(47===e||nD(e))}function nD(e){return 43===e||45===e||46===e||95===e||yM(e)}function sD(e){let t=e.length,i=false;for(;t--;){const n=e[t][1];if(("labelLink"===n.type||"labelImage"===n.type)&&!n._balanced){i=true;break}if(n._gfmAutolinkLiteralWalkedInto){i=false;break}}return e.length>0&&!i&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=true),i}function oD(e){const t=[];let i=-1,n=0,s=0;for(;++i<e.length;){const o=e.charCodeAt(i);let r="";if(37===o&&yM(e.charCodeAt(i+1))&&yM(e.charCodeAt(i+2)))s=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(r=String.fromCharCode(o));else if(o>55295&&o<57344){const t=e.charCodeAt(i+1);o<56320&&t>56319&&t<57344?(r=String.fromCharCode(o,t),s=1):r="�";}else r=String.fromCharCode(o);r&&(t.push(e.slice(n,i),encodeURIComponent(r)),n=i+s+1,r=""),s&&(i+=s,s=0);}return t.join("")+e.slice(n)}function rD(e,t,i){const n=[];let s=-1;for(;++s<e.length;){const o=e[s].resolveAll;o&&!n.includes(o)&&(t=o(t,i),n.push(o));}return t}ZN[43]=YN,ZN[45]=YN,ZN[46]=YN,ZN[95]=YN,ZN[72]=[YN,QN],ZN[104]=[YN,QN],ZN[87]=[YN,JN],ZN[119]=[YN,JN];const aD={name:"attention",resolveAll:function(e,t){let i,n,s,o,r,a,l,c,u=-1;for(;++u<e.length;)if("enter"===e[u][0]&&"attentionSequence"===e[u][1].type&&e[u][1]._close)for(i=u;i--;)if("exit"===e[i][0]&&"attentionSequence"===e[i][1].type&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[u][1]).charCodeAt(0)){if((e[i][1]._close||e[u][1]._open)&&(e[u][1].end.offset-e[u][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[u][1].end.offset-e[u][1].start.offset)%3))continue;a=e[i][1].end.offset-e[i][1].start.offset>1&&e[u][1].end.offset-e[u][1].start.offset>1?2:1;const d={...e[i][1].end},h={...e[u][1].start};lD(d,-a),lD(h,a),o={type:a>1?"strongSequence":"emphasisSequence",start:d,end:{...e[i][1].end}},r={type:a>1?"strongSequence":"emphasisSequence",start:{...e[u][1].start},end:h},s={type:a>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[u][1].start}},n={type:a>1?"strong":"emphasis",start:{...o.start},end:{...r.end}},e[i][1].end={...o.start},e[u][1].start={...r.end},l=[],e[i][1].end.offset-e[i][1].start.offset&&(l=DN(l,[["enter",e[i][1],t],["exit",e[i][1],t]])),l=DN(l,[["enter",n,t],["enter",o,t],["exit",o,t],["enter",s,t]]),l=DN(l,rD(t.parser.constructs.insideSpan.null,e.slice(i+1,u),t)),l=DN(l,[["exit",s,t],["enter",r,t],["exit",r,t],["exit",n,t]]),e[u][1].end.offset-e[u][1].start.offset?(c=2,l=DN(l,[["enter",e[u][1],t],["exit",e[u][1],t]])):c=0,NN(e,i-1,u-i+3,l),u=i+l.length-c-2;break}u=-1;for(;++u<e.length;)"attentionSequence"===e[u][1].type&&(e[u][1].type="data");return e},tokenize:function(e,t){const i=this.parser.constructs.attentionMarkers.null,n=this.previous,s=MF(n);let o;return function(t){return o=t,e.enter("attentionSequence"),r(t)};function r(a){if(a===o)return e.consume(a),r;const l=e.exit("attentionSequence"),c=MF(a),u=!c||2===c&&s||i.includes(a),d=!s||2===s&&c||i.includes(n);return l._open=Boolean(42===o?u:u&&(s||!d)),l._close=Boolean(42===o?d:d&&(c||!u)),t(a)}}};function lD(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t;}const cD={name:"autolink",tokenize:function(e,t,i){let n=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s};function s(t){return _M(t)?(e.consume(t),o):64===t?i(t):l(t)}function o(e){return 43===e||45===e||46===e||yM(e)?(n=1,r(e)):l(e)}function r(t){return 58===t?(e.consume(t),n=0,a):(43===t||45===t||46===t||yM(t))&&n++<32?(e.consume(t),r):(n=0,l(t))}function a(n){return 62===n?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(n),e.exit("autolinkMarker"),e.exit("autolink"),t):null===n||32===n||60===n||CM(n)?i(n):(e.consume(n),a)}function l(t){return 64===t?(e.consume(t),c):kM(t)?(e.consume(t),l):i(t)}function c(e){return yM(e)?u(e):i(e)}function u(i){return 46===i?(e.consume(i),n=0,c):62===i?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(i),e.exit("autolinkMarker"),e.exit("autolink"),t):d(i)}function d(t){if((45===t||yM(t))&&n++<63){const i=45===t?d:u;return e.consume(t),i}return i(t)}}};function uD(e,t,i,n){const s=n?n-1:Number.POSITIVE_INFINITY;let o=0;return function(n){if(IM(n))return e.enter(i),r(n);return t(n)};function r(n){return IM(n)&&o++<s?(e.consume(n),r):(e.exit(i),t(n))}}const dD={partial:true,tokenize:function(e,t,i){return function(t){return IM(t)?uD(e,n,"linePrefix")(t):n(t)};function n(e){return null===e||TM(e)?t(e):i(e)}}};const hD={continuation:{tokenize:function(e,t,i){const n=this;return function(t){if(IM(t))return uD(e,s,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t);return s(t)};function s(n){return e.attempt(hD,t,i)(n)}}},exit:function(e){e.exit("blockQuote");},name:"blockQuote",tokenize:function(e,t,i){const n=this;return function(t){if(62===t){const i=n.containerState;return i.open||(e.enter("blockQuote",{_container:true}),i.open=true),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),s}return i(t)};function s(i){return IM(i)?(e.enter("blockQuotePrefixWhitespace"),e.consume(i),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(i))}}};const mD={name:"characterEscape",tokenize:function(e,t,i){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),n};function n(n){return EM(n)?(e.enter("characterEscapeValue"),e.consume(n),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):i(n)}}};const gD={name:"characterReference",tokenize:function(e,t,i){const n=this;let s,o,r=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),a};function a(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),s=31,o=yM,c(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,o=AM,c):(e.enter("characterReferenceValue"),s=7,o=xM,c(t))}function c(a){if(59===a&&r){const s=e.exit("characterReferenceValue");return o!==yM||aN(n.sliceSerialize(s))?(e.enter("characterReferenceMarker"),e.consume(a),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):i(a)}return o(a)&&r++<s?(e.consume(a),c):i(a)}}};const fD={partial:true,tokenize:function(e,t,i){const n=this;return function(t){if(null===t)return i(t);return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),s};function s(e){return n.parser.lazy[n.now().line]?i(e):t(e)}}},pD={concrete:true,name:"codeFenced",tokenize:function(e,t,i){const n=this,s={partial:true,tokenize:function(e,t,i){let s=0;return r;function r(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),l}function l(t){return e.enter("codeFencedFence"),IM(t)?uD(e,c,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):c(t)}function c(t){return t===o?(e.enter("codeFencedFenceSequence"),u(t)):i(t)}function u(t){return t===o?(s++,e.consume(t),u):s>=a?(e.exit("codeFencedFenceSequence"),IM(t)?uD(e,d,"whitespace")(t):d(t)):i(t)}function d(n){return null===n||TM(n)?(e.exit("codeFencedFence"),t(n)):i(n)}}};let o,r=0,a=0;return function(t){return function(t){const i=n.events[n.events.length-1];return r=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],true).length:0,o=t,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),l(t)}(t)};function l(t){return t===o?(a++,e.consume(t),l):a<3?i(t):(e.exit("codeFencedFenceSequence"),IM(t)?uD(e,c,"whitespace")(t):c(t))}function c(i){return null===i||TM(i)?(e.exit("codeFencedFence"),n.interrupt?t(i):e.check(fD,m,w)(i)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),u(i))}function u(t){return null===t||TM(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(t)):IM(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),uD(e,d,"whitespace")(t)):96===t&&t===o?i(t):(e.consume(t),u)}function d(t){return null===t||TM(t)?c(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),h(t))}function h(t){return null===t||TM(t)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(t)):96===t&&t===o?i(t):(e.consume(t),h)}function m(t){return e.attempt(s,w,g)(t)}function g(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),f}function f(t){return r>0&&IM(t)?uD(e,p,"linePrefix",r+1)(t):p(t)}function p(t){return null===t||TM(t)?e.check(fD,m,w)(t):(e.enter("codeFlowValue"),b(t))}function b(t){return null===t||TM(t)?(e.exit("codeFlowValue"),p(t)):(e.consume(t),b)}function w(i){return e.exit("codeFenced"),t(i)}}};const bD={name:"codeIndented",tokenize:function(e,t,i){const n=this;return function(t){return e.enter("codeIndented"),uD(e,s,"linePrefix",5)(t)};function s(e){const t=n.events[n.events.length-1];return t&&"linePrefix"===t[1].type&&t[2].sliceSerialize(t[1],true).length>=4?o(e):i(e)}function o(t){return null===t?a(t):TM(t)?e.attempt(wD,o,a)(t):(e.enter("codeFlowValue"),r(t))}function r(t){return null===t||TM(t)?(e.exit("codeFlowValue"),o(t)):(e.consume(t),r)}function a(i){return e.exit("codeIndented"),t(i)}}},wD={partial:true,tokenize:function(e,t,i){const n=this;return s;function s(t){return n.parser.lazy[n.now().line]?i(t):TM(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),s):uD(e,o,"linePrefix",5)(t)}function o(e){const o=n.events[n.events.length-1];return o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],true).length>=4?t(e):TM(e)?s(e):i(e)}}};const vD={name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,i,n=e.length-4,s=3;if(!("lineEnding"!==e[s][1].type&&"space"!==e[s][1].type||"lineEnding"!==e[n][1].type&&"space"!==e[n][1].type))for(t=s;++t<n;)if("codeTextData"===e[t][1].type){e[s][1].type="codeTextPadding",e[n][1].type="codeTextPadding",s+=2,n-=2;break}t=s-1,n++;for(;++t<=n;) void 0===i?t!==n&&"lineEnding"!==e[t][1].type&&(i=t):t!==n&&"lineEnding"!==e[t][1].type||(e[i][1].type="codeTextData",t!==i+2&&(e[i][1].end=e[t-1][1].end,e.splice(i+2,t-i-2),n-=t-i-2,t=i+2),i=void 0);return e},tokenize:function(e,t,i){let n,s,o=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),r(t)};function r(t){return 96===t?(e.consume(t),o++,r):(e.exit("codeTextSequence"),a(t))}function a(t){return null===t?i(t):32===t?(e.enter("space"),e.consume(t),e.exit("space"),a):96===t?(s=e.enter("codeTextSequence"),n=0,c(t)):TM(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a):(e.enter("codeTextData"),l(t))}function l(t){return null===t||32===t||96===t||TM(t)?(e.exit("codeTextData"),a(t)):(e.consume(t),l)}function c(i){return 96===i?(e.consume(i),n++,c):n===o?(e.exit("codeTextSequence"),e.exit("codeText"),t(i)):(s.type="codeTextData",l(i))}}};class _D{constructor(e){this.left=e?[...e]:[],this.right=[];}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){const i=null==t?Number.POSITIVE_INFINITY:t;return i<this.left.length?this.left.slice(e,i):e>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(e,t,i){const n=t||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-n,Number.POSITIVE_INFINITY);return i&&yD(this.left,i),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e);}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),yD(this.left,e);}unshift(e){this.setCursor(0),this.right.push(e);}unshiftMany(e){this.setCursor(0),yD(this.right,e.reverse());}setCursor(e){if(!(e===this.left.length||e>this.left.length&&0===this.right.length||e<0&&0===this.left.length))if(e<this.left.length){const t=this.left.splice(e,Number.POSITIVE_INFINITY);yD(this.right,t.reverse());}else {const t=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);yD(this.left,t.reverse());}}}function yD(e,t){let i=0;if(t.length<1e4)e.push(...t);else for(;i<t.length;)e.push(...t.slice(i,i+1e4)),i+=1e4;}function kD(e){const t={};let i,n,s,o,r,a,l,c=-1;const u=new _D(e);for(;++c<u.length;){for(;c in t;)c=t[c];if(i=u.get(c),c&&"chunkFlow"===i[1].type&&"listItemPrefix"===u.get(c-1)[1].type&&(a=i[1]._tokenizer.events,s=0,s<a.length&&"lineEndingBlank"===a[s][1].type&&(s+=2),s<a.length&&"content"===a[s][1].type))for(;++s<a.length&&"content"!==a[s][1].type;)"chunkText"===a[s][1].type&&(a[s][1]._isInFirstContentOfListItem=true,s++);if("enter"===i[0])i[1].contentType&&(Object.assign(t,CD(u,c)),c=t[c],l=true);else if(i[1]._container){for(s=c,n=void 0;s--;)if(o=u.get(s),"lineEnding"===o[1].type||"lineEndingBlank"===o[1].type)"enter"===o[0]&&(n&&(u.get(n)[1].type="lineEndingBlank"),o[1].type="lineEnding",n=s);else if("linePrefix"!==o[1].type&&"listItemIndent"!==o[1].type)break;n&&(i[1].end={...u.get(n)[1].start},r=u.slice(n,c),r.unshift(i),u.splice(n,c-n+1,r));}}return NN(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!l}function CD(e,t){const i=e.get(t)[1],n=e.get(t)[2];let s=t-1;const o=[];let r=i._tokenizer;r||(r=n.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(r._contentTypeTextTrailing=true));const a=r.events,l=[],c={};let u,d,h=-1,m=i,g=0,f=0;const p=[f];for(;m;){for(;e.get(++s)[1]!==m;);o.push(s),m._tokenizer||(u=n.sliceStream(m),m.next||u.push(null),d&&r.defineSkip(m.start),m._isInFirstContentOfListItem&&(r._gfmTasklistFirstContentOfListItem=true),r.write(u),m._isInFirstContentOfListItem&&(r._gfmTasklistFirstContentOfListItem=void 0)),d=m,m=m.next;}for(m=i;++h<a.length;)"exit"===a[h][0]&&"enter"===a[h-1][0]&&a[h][1].type===a[h-1][1].type&&a[h][1].start.line!==a[h][1].end.line&&(f=h+1,p.push(f),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(r.events=[],m?(m._tokenizer=void 0,m.previous=void 0):p.pop(),h=p.length;h--;){const t=a.slice(p[h],p[h+1]),i=o.pop();l.push([i,i+t.length-1]),e.splice(i,2,t);}for(l.reverse(),h=-1;++h<l.length;)c[g+l[h][0]]=g+l[h][1],g+=l[h][1]-l[h][0]-1;return c}const xD={resolve:function(e){return kD(e),e},tokenize:function(e,t){let i;return function(t){return e.enter("content"),i=e.enter("chunkContent",{contentType:"content"}),n(t)};function n(t){return null===t?s(t):TM(t)?e.check(AD,o,s)(t):(e.consume(t),n)}function s(i){return e.exit("chunkContent"),e.exit("content"),t(i)}function o(t){return e.consume(t),e.exit("chunkContent"),i.next=e.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,n}}},AD={partial:true,tokenize:function(e,t,i){const n=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),uD(e,s,"linePrefix")};function s(s){if(null===s||TM(s))return i(s);const o=n.events[n.events.length-1];return !n.parser.constructs.disable.null.includes("codeIndented")&&o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],true).length>=4?t(s):e.interrupt(n.parser.constructs.flow,i,t)(s)}}};function ED(e,t,i,n,s,o,r,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return function(t){if(60===t)return e.enter(n),e.enter(s),e.enter(o),e.consume(t),e.exit(o),d;if(null===t||32===t||41===t||CM(t))return i(t);return e.enter(n),e.enter(r),e.enter(a),e.enter("chunkString",{contentType:"string"}),g(t)};function d(i){return 62===i?(e.enter(o),e.consume(i),e.exit(o),e.exit(s),e.exit(n),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),h(i))}function h(t){return 62===t?(e.exit("chunkString"),e.exit(a),d(t)):null===t||60===t||TM(t)?i(t):(e.consume(t),92===t?m:h)}function m(t){return 60===t||62===t||92===t?(e.consume(t),h):h(t)}function g(s){return u||null!==s&&41!==s&&!SM(s)?u<c&&40===s?(e.consume(s),u++,g):41===s?(e.consume(s),u--,g):null===s||32===s||40===s||CM(s)?i(s):(e.consume(s),92===s?f:g):(e.exit("chunkString"),e.exit(a),e.exit(r),e.exit(n),t(s))}function f(t){return 40===t||41===t||92===t?(e.consume(t),g):g(t)}}function TD(e,t,i,n,s,o){const r=this;let a,l=0;return function(t){return e.enter(n),e.enter(s),e.consume(t),e.exit(s),e.enter(o),c};function c(d){return l>999||null===d||91===d||93===d&&!a||94===d&&!l&&"_hiddenFootnoteSupport"in r.parser.constructs?i(d):93===d?(e.exit(o),e.enter(s),e.consume(d),e.exit(s),e.exit(n),t):TM(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),u(d))}function u(t){return null===t||91===t||93===t||TM(t)||l++>999?(e.exit("chunkString"),c(t)):(e.consume(t),a||(a=!IM(t)),92===t?d:u)}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,u):u(t)}}function SD(e,t,i,n,s,o){let r;return function(t){if(34===t||39===t||40===t)return e.enter(n),e.enter(s),e.consume(t),e.exit(s),r=40===t?41:t,a;return i(t)};function a(i){return i===r?(e.enter(s),e.consume(i),e.exit(s),e.exit(n),t):(e.enter(o),l(i))}function l(t){return t===r?(e.exit(o),a(r)):null===t?i(t):TM(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),uD(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(t))}function c(t){return t===r||null===t||TM(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return t===r||92===t?(e.consume(t),c):c(t)}}function ID(e,t){let i;return function n(s){if(TM(s))return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i=true,n;if(IM(s))return uD(e,n,i?"linePrefix":"lineSuffix")(s);return t(s)}}const PD={name:"definition",tokenize:function(e,t,i){const n=this;let s;return function(t){return e.enter("definition"),function(t){return TD.call(n,e,o,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(t)}(t)};function o(t){return s=iF(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),r):i(t)}function r(t){return SM(t)?ID(e,a)(t):a(t)}function a(t){return ED(e,l,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(VD,c,c)(t)}function c(t){return IM(t)?uD(e,u,"whitespace")(t):u(t)}function u(o){return null===o||TM(o)?(e.exit("definition"),n.parser.defined.push(s),t(o)):i(o)}}},VD={partial:true,tokenize:function(e,t,i){return function(t){return SM(t)?ID(e,n)(t):i(t)};function n(t){return SD(e,s,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function s(t){return IM(t)?uD(e,o,"whitespace")(t):o(t)}function o(e){return null===e||TM(e)?t(e):i(e)}}};const RD={name:"hardBreakEscape",tokenize:function(e,t,i){return function(t){return e.enter("hardBreakEscape"),e.consume(t),n};function n(n){return TM(n)?(e.exit("hardBreakEscape"),t(n)):i(n)}}};const OD={name:"headingAtx",resolve:function(e,t){let i,n,s=e.length-2,o=3;"whitespace"===e[o][1].type&&(o+=2);s-2>o&&"whitespace"===e[s][1].type&&(s-=2);"atxHeadingSequence"===e[s][1].type&&(o===s-1||s-4>o&&"whitespace"===e[s-2][1].type)&&(s-=o+1===s?2:4);s>o&&(i={type:"atxHeadingText",start:e[o][1].start,end:e[s][1].end},n={type:"chunkText",start:e[o][1].start,end:e[s][1].end,contentType:"text"},NN(e,o,s-o+1,[["enter",i,t],["enter",n,t],["exit",n,t],["exit",i,t]]));return e},tokenize:function(e,t,i){let n=0;return function(t){return e.enter("atxHeading"),function(t){return e.enter("atxHeadingSequence"),s(t)}(t)};function s(t){return 35===t&&n++<6?(e.consume(t),s):null===t||SM(t)?(e.exit("atxHeadingSequence"),o(t)):i(t)}function o(i){return 35===i?(e.enter("atxHeadingSequence"),r(i)):null===i||TM(i)?(e.exit("atxHeading"),t(i)):IM(i)?uD(e,o,"whitespace")(i):(e.enter("atxHeadingText"),a(i))}function r(t){return 35===t?(e.consume(t),r):(e.exit("atxHeadingSequence"),o(t))}function a(t){return null===t||35===t||SM(t)?(e.exit("atxHeadingText"),o(t)):(e.consume(t),a)}}};const BD=["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","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],LD=["pre","script","style","textarea"],MD={concrete:true,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2));return e},tokenize:function(e,t,i){const n=this;let s,o,r,a,l;return function(t){return function(t){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(t),c}(t)};function c(a){return 33===a?(e.consume(a),u):47===a?(e.consume(a),o=true,m):63===a?(e.consume(a),s=3,n.interrupt?t:B):_M(a)?(e.consume(a),r=String.fromCharCode(a),g):i(a)}function u(o){return 45===o?(e.consume(o),s=2,d):91===o?(e.consume(o),s=5,a=0,h):_M(o)?(e.consume(o),s=4,n.interrupt?t:B):i(o)}function d(s){return 45===s?(e.consume(s),n.interrupt?t:B):i(s)}function h(s){const o="CDATA[";return s===o.charCodeAt(a++)?(e.consume(s),6===a?n.interrupt?t:E:h):i(s)}function m(t){return _M(t)?(e.consume(t),r=String.fromCharCode(t),g):i(t)}function g(a){if(null===a||47===a||62===a||SM(a)){const l=47===a,c=r.toLowerCase();return l||o||!LD.includes(c)?BD.includes(r.toLowerCase())?(s=6,l?(e.consume(a),f):n.interrupt?t(a):E(a)):(s=7,n.interrupt&&!n.parser.lazy[n.now().line]?i(a):o?p(a):b(a)):(s=1,n.interrupt?t(a):E(a))}return 45===a||yM(a)?(e.consume(a),r+=String.fromCharCode(a),g):i(a)}function f(s){return 62===s?(e.consume(s),n.interrupt?t:E):i(s)}function p(t){return IM(t)?(e.consume(t),p):x(t)}function b(t){return 47===t?(e.consume(t),x):58===t||95===t||_M(t)?(e.consume(t),w):IM(t)?(e.consume(t),b):x(t)}function w(t){return 45===t||46===t||58===t||95===t||yM(t)?(e.consume(t),w):v(t)}function v(t){return 61===t?(e.consume(t),_):IM(t)?(e.consume(t),v):b(t)}function _(t){return null===t||60===t||61===t||62===t||96===t?i(t):34===t||39===t?(e.consume(t),l=t,y):IM(t)?(e.consume(t),_):k(t)}function y(t){return t===l?(e.consume(t),l=null,C):null===t||TM(t)?i(t):(e.consume(t),y)}function k(t){return null===t||34===t||39===t||47===t||60===t||61===t||62===t||96===t||SM(t)?v(t):(e.consume(t),k)}function C(e){return 47===e||62===e||IM(e)?b(e):i(e)}function x(t){return 62===t?(e.consume(t),A):i(t)}function A(t){return null===t||TM(t)?E(t):IM(t)?(e.consume(t),A):i(t)}function E(t){return 45===t&&2===s?(e.consume(t),P):60===t&&1===s?(e.consume(t),V):62===t&&4===s?(e.consume(t),L):63===t&&3===s?(e.consume(t),B):93===t&&5===s?(e.consume(t),O):!TM(t)||6!==s&&7!==s?null===t||TM(t)?(e.exit("htmlFlowData"),T(t)):(e.consume(t),E):(e.exit("htmlFlowData"),e.check(FD,M,T)(t))}function T(t){return e.check(ND,S,M)(t)}function S(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),I}function I(t){return null===t||TM(t)?T(t):(e.enter("htmlFlowData"),E(t))}function P(t){return 45===t?(e.consume(t),B):E(t)}function V(t){return 47===t?(e.consume(t),r="",R):E(t)}function R(t){if(62===t){const i=r.toLowerCase();return LD.includes(i)?(e.consume(t),L):E(t)}return _M(t)&&r.length<8?(e.consume(t),r+=String.fromCharCode(t),R):E(t)}function O(t){return 93===t?(e.consume(t),B):E(t)}function B(t){return 62===t?(e.consume(t),L):45===t&&2===s?(e.consume(t),B):E(t)}function L(t){return null===t||TM(t)?(e.exit("htmlFlowData"),M(t)):(e.consume(t),L)}function M(i){return e.exit("htmlFlow"),t(i)}}},FD={partial:true,tokenize:function(e,t,i){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),e.attempt(dD,t,i)}}},ND={partial:true,tokenize:function(e,t,i){const n=this;return function(t){if(TM(t))return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),s;return i(t)};function s(e){return n.parser.lazy[n.now().line]?i(e):t(e)}}};const DD={name:"htmlText",tokenize:function(e,t,i){const n=this;let s,o,r;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),a};function a(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),_):63===t?(e.consume(t),w):_M(t)?(e.consume(t),C):i(t)}function l(t){return 45===t?(e.consume(t),c):91===t?(e.consume(t),o=0,m):_M(t)?(e.consume(t),b):i(t)}function c(t){return 45===t?(e.consume(t),h):i(t)}function u(t){return null===t?i(t):45===t?(e.consume(t),d):TM(t)?(r=u,R(t)):(e.consume(t),u)}function d(t){return 45===t?(e.consume(t),h):u(t)}function h(e){return 62===e?V(e):45===e?d(e):u(e)}function m(t){const n="CDATA[";return t===n.charCodeAt(o++)?(e.consume(t),6===o?g:m):i(t)}function g(t){return null===t?i(t):93===t?(e.consume(t),f):TM(t)?(r=g,R(t)):(e.consume(t),g)}function f(t){return 93===t?(e.consume(t),p):g(t)}function p(t){return 62===t?V(t):93===t?(e.consume(t),p):g(t)}function b(t){return null===t||62===t?V(t):TM(t)?(r=b,R(t)):(e.consume(t),b)}function w(t){return null===t?i(t):63===t?(e.consume(t),v):TM(t)?(r=w,R(t)):(e.consume(t),w)}function v(e){return 62===e?V(e):w(e)}function _(t){return _M(t)?(e.consume(t),y):i(t)}function y(t){return 45===t||yM(t)?(e.consume(t),y):k(t)}function k(t){return TM(t)?(r=k,R(t)):IM(t)?(e.consume(t),k):V(t)}function C(t){return 45===t||yM(t)?(e.consume(t),C):47===t||62===t||SM(t)?x(t):i(t)}function x(t){return 47===t?(e.consume(t),V):58===t||95===t||_M(t)?(e.consume(t),A):TM(t)?(r=x,R(t)):IM(t)?(e.consume(t),x):V(t)}function A(t){return 45===t||46===t||58===t||95===t||yM(t)?(e.consume(t),A):E(t)}function E(t){return 61===t?(e.consume(t),T):TM(t)?(r=E,R(t)):IM(t)?(e.consume(t),E):x(t)}function T(t){return null===t||60===t||61===t||62===t||96===t?i(t):34===t||39===t?(e.consume(t),s=t,S):TM(t)?(r=T,R(t)):IM(t)?(e.consume(t),T):(e.consume(t),I)}function S(t){return t===s?(e.consume(t),s=void 0,P):null===t?i(t):TM(t)?(r=S,R(t)):(e.consume(t),S)}function I(t){return null===t||34===t||39===t||60===t||61===t||96===t?i(t):47===t||62===t||SM(t)?x(t):(e.consume(t),I)}function P(e){return 47===e||62===e||SM(e)?x(e):i(e)}function V(n){return 62===n?(e.consume(n),e.exit("htmlTextData"),e.exit("htmlText"),t):i(n)}function R(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),O}function O(t){return IM(t)?uD(e,B,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):B(t)}function B(t){return e.enter("htmlTextData"),r(t)}}};const zD={name:"labelEnd",resolveAll:function(e){let t=-1;const i=[];for(;++t<e.length;){const n=e[t][1];if(i.push(e[t]),"labelImage"===n.type||"labelLink"===n.type||"labelEnd"===n.type){const e="labelImage"===n.type?4:2;n.type="data",t+=e;}}e.length!==i.length&&NN(e,0,e.length,i);return e},resolveTo:function(e,t){let i,n,s,o,r=e.length,a=0;for(;r--;)if(i=e[r][1],n){if("link"===i.type||"labelLink"===i.type&&i._inactive)break;"enter"===e[r][0]&&"labelLink"===i.type&&(i._inactive=true);}else if(s){if("enter"===e[r][0]&&("labelImage"===i.type||"labelLink"===i.type)&&!i._balanced&&(n=r,"labelLink"!==i.type)){a=2;break}}else "labelEnd"===i.type&&(s=r);const l={type:"labelLink"===e[n][1].type?"link":"image",start:{...e[n][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[n][1].start},end:{...e[s][1].end}},u={type:"labelText",start:{...e[n+a+2][1].end},end:{...e[s-2][1].start}};return o=[["enter",l,t],["enter",c,t]],o=DN(o,e.slice(n+1,n+a+3)),o=DN(o,[["enter",u,t]]),o=DN(o,rD(t.parser.constructs.insideSpan.null,e.slice(n+a+4,s-3),t)),o=DN(o,[["exit",u,t],e[s-2],e[s-1],["exit",c,t]]),o=DN(o,e.slice(s+1)),o=DN(o,[["exit",l,t]]),NN(e,n,e.length,o),e},tokenize:function(e,t,i){const n=this;let s,o,r=n.events.length;for(;r--;)if(("labelImage"===n.events[r][1].type||"labelLink"===n.events[r][1].type)&&!n.events[r][1]._balanced){s=n.events[r][1];break}return function(t){if(!s)return i(t);if(s._inactive)return u(t);return o=n.parser.defined.includes(iF(n.sliceSerialize({start:s.end,end:n.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),a};function a(t){return 40===t?e.attempt(HD,c,o?c:u)(t):91===t?e.attempt(qD,c,o?l:u)(t):o?c(t):u(t)}function l(t){return e.attempt(UD,c,u)(t)}function c(e){return t(e)}function u(e){return s._balanced=true,i(e)}}},HD={tokenize:function(e,t,i){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),n};function n(t){return SM(t)?ID(e,s)(t):s(t)}function s(t){return 41===t?c(t):ED(e,o,r,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function o(t){return SM(t)?ID(e,a)(t):c(t)}function r(e){return i(e)}function a(t){return 34===t||39===t||40===t?SD(e,l,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):c(t)}function l(t){return SM(t)?ID(e,c)(t):c(t)}function c(n){return 41===n?(e.enter("resourceMarker"),e.consume(n),e.exit("resourceMarker"),e.exit("resource"),t):i(n)}}},qD={tokenize:function(e,t,i){const n=this;return function(t){return TD.call(n,e,s,o,"reference","referenceMarker","referenceString")(t)};function s(e){return n.parser.defined.includes(iF(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)))?t(e):i(e)}function o(e){return i(e)}}},UD={tokenize:function(e,t,i){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),n};function n(n){return 93===n?(e.enter("referenceMarker"),e.consume(n),e.exit("referenceMarker"),e.exit("reference"),t):i(n)}}};const jD={name:"labelStartImage",resolveAll:zD.resolveAll,tokenize:function(e,t,i){const n=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),s};function s(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),o):i(t)}function o(e){return 94===e&&"_hiddenFootnoteSupport"in n.parser.constructs?i(e):t(e)}}};const $D={name:"labelStartLink",resolveAll:zD.resolveAll,tokenize:function(e,t,i){const n=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),s};function s(e){return 94===e&&"_hiddenFootnoteSupport"in n.parser.constructs?i(e):t(e)}}};const WD={name:"lineEnding",tokenize:function(e,t){return function(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),uD(e,t,"linePrefix")}}};const GD={name:"thematicBreak",tokenize:function(e,t,i){let n,s=0;return function(t){return e.enter("thematicBreak"),function(e){return n=e,o(e)}(t)};function o(o){return o===n?(e.enter("thematicBreakSequence"),r(o)):s>=3&&(null===o||TM(o))?(e.exit("thematicBreak"),t(o)):i(o)}function r(t){return t===n?(e.consume(t),s++,r):(e.exit("thematicBreakSequence"),IM(t)?uD(e,o,"whitespace")(t):o(t))}}};const KD={continuation:{tokenize:function(e,t,i){const n=this;return n.containerState._closeFlow=void 0,e.check(dD,s,o);function s(i){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,uD(e,t,"listItemIndent",n.containerState.size+1)(i)}function o(i){return n.containerState.furtherBlankLines||!IM(i)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,r(i)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,e.attempt(QD,t,r)(i))}function r(s){return n.containerState._closeFlow=true,n.interrupt=void 0,uD(e,e.attempt(KD,t,i),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}},exit:function(e){e.exit(this.containerState.type);},name:"list",tokenize:function(e,t,i){const n=this,s=n.events[n.events.length-1];let o=s&&"linePrefix"===s[1].type?s[2].sliceSerialize(s[1],true).length:0,r=0;return function(t){const s=n.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===s?!n.containerState.marker||t===n.containerState.marker:xM(t)){if(n.containerState.type||(n.containerState.type=s,e.enter(s,{_container:true})),"listUnordered"===s)return e.enter("listItemPrefix"),42===t||45===t?e.check(GD,i,l)(t):l(t);if(!n.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),a(t)}return i(t)};function a(t){return xM(t)&&++r<10?(e.consume(t),a):(!n.interrupt||r<2)&&(n.containerState.marker?t===n.containerState.marker:41===t||46===t)?(e.exit("listItemValue"),l(t)):i(t)}function l(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||t,e.check(dD,n.interrupt?i:c,e.attempt(JD,d,u))}function c(e){return n.containerState.initialBlankLine=true,o++,d(e)}function u(t){return IM(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),d):i(t)}function d(i){return n.containerState.size=o+n.sliceSerialize(e.exit("listItemPrefix"),true).length,t(i)}}},JD={partial:true,tokenize:function(e,t,i){const n=this;return uD(e,function(e){const s=n.events[n.events.length-1];return !IM(e)&&s&&"listItemPrefixWhitespace"===s[1].type?t(e):i(e)},"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},QD={partial:true,tokenize:function(e,t,i){const n=this;return uD(e,function(e){const s=n.events[n.events.length-1];return s&&"listItemIndent"===s[1].type&&s[2].sliceSerialize(s[1],true).length===n.containerState.size?t(e):i(e)},"listItemIndent",n.containerState.size+1)}};const YD={name:"setextUnderline",resolveTo:function(e,t){let i,n,s,o=e.length;for(;o--;)if("enter"===e[o][0]){if("content"===e[o][1].type){i=o;break}"paragraph"===e[o][1].type&&(n=o);}else "content"===e[o][1].type&&e.splice(o,1),s||"definition"!==e[o][1].type||(s=o);const r={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};e[n][1].type="setextHeadingText",s?(e.splice(n,0,["enter",r,t]),e.splice(s+1,0,["exit",e[i][1],t]),e[i][1].end={...e[s][1].end}):e[i][1]=r;return e.push(["exit",r,t]),e},tokenize:function(e,t,i){const n=this;let s;return function(t){let r,a=n.events.length;for(;a--;)if("lineEnding"!==n.events[a][1].type&&"linePrefix"!==n.events[a][1].type&&"content"!==n.events[a][1].type){r="paragraph"===n.events[a][1].type;break}if(!n.parser.lazy[n.now().line]&&(n.interrupt||r))return e.enter("setextHeadingLine"),s=t,function(t){return e.enter("setextHeadingLineSequence"),o(t)}(t);return i(t)};function o(t){return t===s?(e.consume(t),o):(e.exit("setextHeadingLineSequence"),IM(t)?uD(e,r,"lineSuffix")(t):r(t))}function r(n){return null===n||TM(n)?(e.exit("setextHeadingLine"),t(n)):i(n)}}};const ZD={tokenize:function(e,t,i){const n=this;return uD(e,function(e){const s=n.events[n.events.length-1];return s&&"gfmFootnoteDefinitionIndent"===s[1].type&&4===s[2].sliceSerialize(s[1],true).length?t(e):i(e)},"gfmFootnoteDefinitionIndent",5)},partial:true};function XD(e,t,i){const n=this;let s=n.events.length;const o=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let r;for(;s--;){const e=n.events[s][1];if("labelImage"===e.type){r=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(s){if(!r||!r._balanced)return i(s);const a=iF(n.sliceSerialize({start:r.end,end:n.now()}));if(94!==a.codePointAt(0)||!o.includes(a.slice(1)))return i(s);return e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),t(s)}}function ez(e,t){let i=e.length;for(;i--;)if("labelImage"===e[i][1].type&&"enter"===e[i][0]){e[i][1];break}e[i+1][1].type="data",e[i+3][1].type="gfmFootnoteCallLabelMarker";const n={type:"gfmFootnoteCall",start:Object.assign({},e[i+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[i+3][1].end),end:Object.assign({},e[i+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},r={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},a=[e[i+1],e[i+2],["enter",n,t],e[i+3],e[i+4],["enter",s,t],["exit",s,t],["enter",o,t],["enter",r,t],["exit",r,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",n,t]];return e.splice(i,e.length-i+1,...a),e}function tz(e,t,i){const n=this,s=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let o,r=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),a};function a(t){return 94!==t?i(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",l)}function l(a){if(r>999||93===a&&!o||null===a||91===a||SM(a))return i(a);if(93===a){e.exit("chunkString");const o=e.exit("gfmFootnoteCallString");return s.includes(iF(n.sliceSerialize(o)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):i(a)}return SM(a)||(o=true),r++,e.consume(a),92===a?c:l}function c(t){return 91===t||92===t||93===t?(e.consume(t),r++,l):l(t)}}function iz(e,t,i){const n=this,s=n.parser.gfmFootnotes||(n.parser.gfmFootnotes=[]);let o,r,a=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=true,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):i(t)}function c(t){if(a>999||93===t&&!r||null===t||91===t||SM(t))return i(t);if(93===t){e.exit("chunkString");const i=e.exit("gfmFootnoteDefinitionLabelString");return o=iF(n.sliceSerialize(i)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return SM(t)||(r=true),a++,e.consume(t),92===t?u:c}function u(t){return 91===t||92===t||93===t?(e.consume(t),a++,c):c(t)}function d(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),s.includes(o)||s.push(o),uD(e,h,"gfmFootnoteDefinitionWhitespace")):i(t)}function h(e){return t(e)}}function nz(e,t,i){return e.check(dD,t,e.attempt(ZD,t,i))}function sz(e){e.exit("gfmFootnoteDefinition");}function oz(e){let t=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:function(e,i,n){const s=this.previous,o=this.events;let r=0;return function(t){if(126===s&&"characterEscape"!==o[o.length-1][1].type)return n(t);return e.enter("strikethroughSequenceTemporary"),a(t)};function a(o){const l=MF(s);if(126===o)return r>1?n(o):(e.consume(o),r++,a);if(r<2&&!t)return n(o);const c=e.exit("strikethroughSequenceTemporary"),u=MF(o);return c._open=!u||2===u&&Boolean(l),c._close=!l||2===l&&Boolean(u),i(o)}},resolveAll:function(e,t){let i=-1;for(;++i<e.length;)if("enter"===e[i][0]&&"strikethroughSequenceTemporary"===e[i][1].type&&e[i][1]._close){let n=i;for(;n--;)if("exit"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._open&&e[i][1].end.offset-e[i][1].start.offset===e[n][1].end.offset-e[n][1].start.offset){e[i][1].type="strikethroughSequence",e[n][1].type="strikethroughSequence";const s={type:"strikethrough",start:Object.assign({},e[n][1].start),end:Object.assign({},e[i][1].end)},o={type:"strikethroughText",start:Object.assign({},e[n][1].end),end:Object.assign({},e[i][1].start)},r=[["enter",s,t],["enter",e[n][1],t],["exit",e[n][1],t],["enter",o,t]],a=t.parser.constructs.insideSpan.null;a&&NN(r,r.length,0,rD(a,e.slice(n+1,i),t)),NN(r,r.length,0,[["exit",o,t],["enter",e[i][1],t],["exit",e[i][1],t],["exit",s,t]]),NN(e,n-1,i-n+3,r),i=n+r.length-2;break}}i=-1;for(;++i<e.length;)"strikethroughSequenceTemporary"===e[i][1].type&&(e[i][1].type="data");return e}};return null==t&&(t=true),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}}}class rz{constructor(){this.map=[];}add(e,t,i){!function(e,t,i,n){let s=0;if(0===i&&0===n.length)return;for(;s<e.map.length;){if(e.map[s][0]===t)return e.map[s][1]+=i,void e.map[s][2].push(...n);s+=1;}e.map.push([t,i,n]);}(this,e,t,i);}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length;const i=[];for(;t>0;)t-=1,i.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];i.push(e.slice()),e.length=0;let n=i.pop();for(;n;){for(const t of n)e.push(t);n=i.pop();}this.map.length=0;}}function az(e,t){let i=false;const n=[];for(;t<e.length;){const s=e[t];if(i){if("enter"===s[0])"tableContent"===s[1].type&&n.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===s[1].type){if("tableDelimiterMarker"===e[t-1][1].type){const e=n.length-1;n[e]="left"===n[e]?"center":"right";}}else if("tableDelimiterRow"===s[1].type)break}else "enter"===s[0]&&"tableDelimiterRow"===s[1].type&&(i=true);t+=1;}return n}function lz(e,t,i){const n=this;let s,o=0,r=0;return function(e){let t=n.events.length-1;for(;t>-1;){const e=n.events[t][1].type;if("lineEnding"!==e&&"linePrefix"!==e)break;t--;}const s=t>-1?n.events[t][1].type:null,o="tableHead"===s||"tableRow"===s?_:a;if(o===_&&n.parser.lazy[n.now().line])return i(e);return o(e)};function a(t){return e.enter("tableHead"),e.enter("tableRow"),function(e){if(124===e)return l(e);return s=true,r+=1,l(e)}(t)}function l(t){return null===t?i(t):TM(t)?r>1?(r=0,n.interrupt=true,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),d):i(t):IM(t)?uD(e,l,"whitespace")(t):(r+=1,s&&(s=false,o+=1),124===t?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),s=true,l):(e.enter("data"),c(t)))}function c(t){return null===t||124===t||SM(t)?(e.exit("data"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return 92===t||124===t?(e.consume(t),c):c(t)}function d(t){return n.interrupt=false,n.parser.lazy[n.now().line]?i(t):(e.enter("tableDelimiterRow"),s=false,IM(t)?uD(e,h,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):h(t))}function h(t){return 45===t||58===t?g(t):124===t?(s=true,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),m):v(t)}function m(t){return IM(t)?uD(e,g,"whitespace")(t):g(t)}function g(t){return 58===t?(r+=1,s=true,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),f):45===t?(r+=1,f(t)):null===t||TM(t)?w(t):v(t)}function f(t){return 45===t?(e.enter("tableDelimiterFiller"),p(t)):v(t)}function p(t){return 45===t?(e.consume(t),p):58===t?(s=true,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),b):(e.exit("tableDelimiterFiller"),b(t))}function b(t){return IM(t)?uD(e,w,"whitespace")(t):w(t)}function w(i){return 124===i?h(i):(null===i||TM(i))&&s&&o===r?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(i)):v(i)}function v(e){return i(e)}function _(t){return e.enter("tableRow"),y(t)}function y(i){return 124===i?(e.enter("tableCellDivider"),e.consume(i),e.exit("tableCellDivider"),y):null===i||TM(i)?(e.exit("tableRow"),t(i)):IM(i)?uD(e,y,"whitespace")(i):(e.enter("data"),k(i))}function k(t){return null===t||124===t||SM(t)?(e.exit("data"),y(t)):(e.consume(t),92===t?C:k)}function C(t){return 92===t||124===t?(e.consume(t),k):k(t)}}function cz(e,t){let i,n,s,o=-1,r=true,a=0,l=[0,0,0,0],c=[0,0,0,0],u=false,d=0;const h=new rz;for(;++o<e.length;){const m=e[o],g=m[1];"enter"===m[0]?"tableHead"===g.type?(u=false,0!==d&&(dz(h,t,d,i,n),n=void 0,d=0),i={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},h.add(o,0,[["enter",i,t]])):"tableRow"===g.type||"tableDelimiterRow"===g.type?(r=true,s=void 0,l=[0,0,0,0],c=[0,o+1,0,0],u&&(u=false,n={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},h.add(o,0,[["enter",n,t]])),a="tableDelimiterRow"===g.type?2:n?3:1):!a||"data"!==g.type&&"tableDelimiterMarker"!==g.type&&"tableDelimiterFiller"!==g.type?"tableCellDivider"===g.type&&(r?r=false:(0!==l[1]&&(c[0]=c[1],s=uz(h,t,l,a,void 0,s)),l=c,c=[l[1],o,0,0])):(r=false,0===c[2]&&(0!==l[1]&&(c[0]=c[1],s=uz(h,t,l,a,void 0,s),l=[0,0,0,0]),c[2]=o)):"tableHead"===g.type?(u=true,d=o):"tableRow"===g.type||"tableDelimiterRow"===g.type?(d=o,0!==l[1]?(c[0]=c[1],s=uz(h,t,l,a,o,s)):0!==c[1]&&(s=uz(h,t,c,a,o,s)),a=0):!a||"data"!==g.type&&"tableDelimiterMarker"!==g.type&&"tableDelimiterFiller"!==g.type||(c[3]=o);}for(0!==d&&dz(h,t,d,i,n),h.consume(t.events),o=-1;++o<t.events.length;){const e=t.events[o];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=az(t.events,o));}return e}function uz(e,t,i,n,s,o){const r=1===n?"tableHeader":2===n?"tableDelimiter":"tableData";0!==i[0]&&(o.end=Object.assign({},hz(t.events,i[0])),e.add(i[0],0,[["exit",o,t]]));const a=hz(t.events,i[1]);if(o={type:r,start:Object.assign({},a),end:Object.assign({},a)},e.add(i[1],0,[["enter",o,t]]),0!==i[2]){const s=hz(t.events,i[2]),o=hz(t.events,i[3]),r={type:"tableContent",start:Object.assign({},s),end:Object.assign({},o)};if(e.add(i[2],0,[["enter",r,t]]),2!==n){const n=t.events[i[2]],s=t.events[i[3]];if(n[1].end=Object.assign({},s[1].end),n[1].type="chunkText",n[1].contentType="text",i[3]>i[2]+1){const t=i[2]+1,n=i[3]-i[2]-1;e.add(t,n,[]);}}e.add(i[3]+1,0,[["exit",r,t]]);}return void 0!==s&&(o.end=Object.assign({},hz(t.events,s)),e.add(s,0,[["exit",o,t]]),o=void 0),o}function dz(e,t,i,n,s){const o=[],r=hz(t.events,i);s&&(s.end=Object.assign({},r),o.push(["exit",s,t])),n.end=Object.assign({},r),o.push(["exit",n,t]),e.add(i+1,0,o);}function hz(e,t){const i=e[t],n="enter"===i[0]?"start":"end";return i[1][n]}const mz={name:"tasklistCheck",tokenize:function(e,t,i){const n=this;return function(t){if(null!==n.previous||!n._gfmTasklistFirstContentOfListItem)return i(t);return e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),s};function s(t){return SM(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),o):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),o):i(t)}function o(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),r):i(t)}function r(n){return TM(n)?t(n):IM(n)?e.check({tokenize:gz},t,i)(n):i(n)}}};function gz(e,t,i){return uD(e,function(e){return null===e?i(e):t(e)},"whitespace")}const fz={};function pz(e){const t=e||fz,i=this.data(),n=i.micromarkExtensions||(i.micromarkExtensions=[]),s=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),o=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);n.push(function(e){return HN([{text:ZN},{document:{91:{name:"gfmFootnoteDefinition",tokenize:iz,continuation:{tokenize:nz},exit:sz}},text:{91:{name:"gfmFootnoteCall",tokenize:tz},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:XD,resolveTo:ez}}},oz(e),{flow:{null:{name:"table",tokenize:lz,resolveAll:cz}}},{text:{91:mz}}])}(t)),s.push([{transforms:[ZM],enter:{literalAutolink:WM,literalAutolinkEmail:GM,literalAutolinkHttp:GM,literalAutolinkWww:GM},exit:{literalAutolink:YM,literalAutolinkEmail:QM,literalAutolinkHttp:KM,literalAutolinkWww:JM}},{enter:{gfmFootnoteCallString:nF,gfmFootnoteCall:sF,gfmFootnoteDefinitionLabelString:oF,gfmFootnoteDefinition:rF},exit:{gfmFootnoteCallString:aF,gfmFootnoteCall:lF,gfmFootnoteDefinitionLabelString:cF,gfmFootnoteDefinition:uF}},{canContainEols:["delete"],enter:{strikethrough:pF},exit:{strikethrough:bF}},{enter:{table:TN,tableData:VN,tableHeader:VN,tableRow:IN},exit:{codeText:RN,table:SN,tableData:PN,tableHeader:PN,tableRow:PN}},{exit:{taskListCheckValueChecked:LN,taskListCheckValueUnchecked:LN,paragraph:MN}}]),o.push(function(e){return {extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:jM,notInConstruct:$M},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:jM,notInConstruct:$M},{character:":",before:"[ps]",after:"\\/",inConstruct:jM,notInConstruct:$M}]},hF(e),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:fF}],handlers:{delete:wF}},BN(e),{unsafe:[{atBreak:true,character:"-",after:"[:|-]"}],handlers:{listItem:FN}}]}}(t));}const bz={tokenize:function(e){const t=e.attempt(this.parser.constructs.contentInitial,function(i){if(null===i)return void e.consume(i);return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),uD(e,t,"linePrefix")},function(t){return e.enter("paragraph"),n(t)});let i;return t;function n(t){const n=e.enter("chunkText",{contentType:"text",previous:i});return i&&(i.next=n),i=n,s(t)}function s(t){return null===t?(e.exit("chunkText"),e.exit("paragraph"),void e.consume(t)):TM(t)?(e.consume(t),e.exit("chunkText"),n):(e.consume(t),s)}}};const wz={tokenize:function(e){const t=this,i=[];let n,s,o,r=0;return a;function a(n){if(r<i.length){const s=i[r];return t.containerState=s[1],e.attempt(s[0].continuation,l,c)(n)}return c(n)}function l(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,n&&w();const i=t.events.length;let s,o=i;for(;o--;)if("exit"===t.events[o][0]&&"chunkFlow"===t.events[o][1].type){s=t.events[o][1].end;break}b(r);let a=i;for(;a<t.events.length;)t.events[a][1].end={...s},a++;return NN(t.events,o+1,0,t.events.slice(i)),t.events.length=a,c(e)}return a(e)}function c(s){if(r===i.length){if(!n)return h(s);if(n.currentConstruct&&n.currentConstruct.concrete)return g(s);t.interrupt=Boolean(n.currentConstruct&&!n._gfmTableDynamicInterruptHack);}return t.containerState={},e.check(vz,u,d)(s)}function u(e){return n&&w(),b(r),h(e)}function d(e){return t.parser.lazy[t.now().line]=r!==i.length,o=t.now().offset,g(e)}function h(i){return t.containerState={},e.attempt(vz,m,g)(i)}function m(e){return r++,i.push([t.currentConstruct,t.containerState]),h(e)}function g(i){return null===i?(n&&w(),b(0),void e.consume(i)):(n=n||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:n,contentType:"flow",previous:s}),f(i))}function f(i){return null===i?(p(e.exit("chunkFlow"),true),b(0),void e.consume(i)):TM(i)?(e.consume(i),p(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(i),f)}function p(e,i){const a=t.sliceStream(e);if(i&&a.push(null),e.previous=s,s&&(s.next=e),s=e,n.defineSkip(e.start),n.write(a),t.parser.lazy[e.start.line]){let e=n.events.length;for(;e--;)if(n.events[e][1].start.offset<o&&(!n.events[e][1].end||n.events[e][1].end.offset>o))return;const i=t.events.length;let s,a,l=i;for(;l--;)if("exit"===t.events[l][0]&&"chunkFlow"===t.events[l][1].type){if(s){a=t.events[l][1].end;break}s=true;}for(b(r),e=i;e<t.events.length;)t.events[e][1].end={...a},e++;NN(t.events,l+1,0,t.events.slice(i)),t.events.length=e;}}function b(n){let s=i.length;for(;s-- >n;){const n=i[s];t.containerState=n[1],n[0].exit.call(t,e);}i.length=n;}function w(){n.write([null]),s=void 0,n=void 0,t.containerState._closeFlow=void 0;}}},vz={tokenize:function(e,t,i){return uD(e,e.attempt(this.parser.constructs.document,t,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};const _z={tokenize:function(e){const t=this,i=e.attempt(dD,function(n){if(null===n)return void e.consume(n);return e.enter("lineEndingBlank"),e.consume(n),e.exit("lineEndingBlank"),t.currentConstruct=void 0,i},e.attempt(this.parser.constructs.flowInitial,n,uD(e,e.attempt(this.parser.constructs.flow,n,e.attempt(xD,n)),"linePrefix")));return i;function n(n){if(null!==n)return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),t.currentConstruct=void 0,i;e.consume(n);}}};const yz={resolveAll:Az()},kz=xz("string"),Cz=xz("text");function xz(e){return {resolveAll:Az("text"===e?Ez:void 0),tokenize:function(t){const i=this,n=this.parser.constructs[e],s=t.attempt(n,o,r);return o;function o(e){return l(e)?s(e):r(e)}function r(e){if(null!==e)return t.enter("data"),t.consume(e),a;t.consume(e);}function a(e){return l(e)?(t.exit("data"),s(e)):(t.consume(e),a)}function l(e){if(null===e)return  true;const t=n[e];let s=-1;if(t)for(;++s<t.length;){const e=t[s];if(!e.previous||e.previous.call(i,i.previous))return  true}return  false}}}}function Az(e){return function(t,i){let n,s=-1;for(;++s<=t.length;) void 0===n?t[s]&&"data"===t[s][1].type&&(n=s,s++):t[s]&&"data"===t[s][1].type||(s!==n+2&&(t[n][1].end=t[s-1][1].end,t.splice(n+2,s-n-2),s=n+2),n=void 0);return e?e(t,i):t}}function Ez(e,t){let i=0;for(;++i<=e.length;)if((i===e.length||"lineEnding"===e[i][1].type)&&"data"===e[i-1][1].type){const n=e[i-1][1],s=t.sliceStream(n);let o,r=s.length,a=-1,l=0;for(;r--;){const e=s[r];if("string"==typeof e){for(a=e.length;32===e.charCodeAt(a-1);)l++,a--;if(a)break;a=-1;}else if(-2===e)o=true,l++;else if(-1!==e){r++;break}}if(t._contentTypeTextTrailing&&i===e.length&&(l=0),l){const s={type:i===e.length||o||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:r?a:n.start._bufferIndex+a,_index:n.start._index+r,line:n.end.line,column:n.end.column-l,offset:n.end.offset-l},end:{...n.end}};n.end={...s.start},n.start.offset===n.end.offset?Object.assign(n,s):(e.splice(i,0,["enter",s,t],["exit",s,t]),i+=2);}i++;}return e}const Tz={42:KD,43:KD,45:KD,48:KD,49:KD,50:KD,51:KD,52:KD,53:KD,54:KD,55:KD,56:KD,57:KD,62:hD},Sz={91:PD},Iz={[-2]:bD,[-1]:bD,32:bD},Pz={35:OD,42:GD,45:[YD,GD],60:MD,61:YD,95:GD,96:pD,126:pD},Vz={38:gD,92:mD},Rz={[-5]:WD,[-4]:WD,[-3]:WD,33:jD,38:gD,42:aD,60:[cD,DD],91:$D,92:[RD,mD],93:zD,95:aD,96:vD},Oz={null:[aD,yz]};var Bz=Object.freeze({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:Sz,disable:{null:[]},document:Tz,flow:Pz,flowInitial:Iz,insideSpan:Oz,string:Vz,text:Rz});function Lz(e,t,i){let n={_bufferIndex:-1,_index:0,line:i&&i.line||1,column:i&&i.column||1,offset:i&&i.offset||0};const s={},o=[];let r=[],a=[];const l={attempt:p(function(e,t){b(e,t.from);}),check:p(f),consume:function(e){TM(e)?(n.line++,n.column=1,n.offset+=-3===e?2:1,w()):-1!==e&&(n.column++,n.offset++);n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===r[n._index].length&&(n._bufferIndex=-1,n._index++));c.previous=e;},enter:function(e,t){const i=t||{};return i.type=e,i.start=h(),c.events.push(["enter",i,c]),a.push(i),i},exit:function(e){const t=a.pop();return t.end=h(),c.events.push(["exit",t,c]),t},interrupt:p(f,{interrupt:true})},c={code:null,containerState:{},defineSkip:function(e){s[e.line]=e.column,w();},events:[],now:h,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let i=-1;const n=[];let s;for(;++i<e.length;){const o=e[i];let r;if("string"==typeof o)r=o;else switch(o){case  -5:r="\r";break;case  -4:r="\n";break;case  -3:r="\r\n";break;case  -2:r=t?" ":"\t";break;case  -1:if(!t&&s)continue;r=" ";break;default:r=String.fromCharCode(o);}s=-2===o,n.push(r);}return n.join("")}(d(e),t)},sliceStream:d,write:function(e){if(r=DN(r,e),m(),null!==r[r.length-1])return [];return b(t,0),c.events=rD(o,c.events,c),c.events}};let u=t.tokenize.call(c,l);return t.resolveAll&&o.push(t),c;function d(e){return function(e,t){const i=t.start._index,n=t.start._bufferIndex,s=t.end._index,o=t.end._bufferIndex;let r;if(i===s)r=[e[i].slice(n,o)];else {if(r=e.slice(i,s),n>-1){const e=r[0];"string"==typeof e?r[0]=e.slice(n):r.shift();}o>0&&r.push(e[s].slice(0,o));}return r}(r,e)}function h(){const{_bufferIndex:e,_index:t,line:i,column:s,offset:o}=n;return {_bufferIndex:e,_index:t,line:i,column:s,offset:o}}function m(){let e;for(;n._index<r.length;){const t=r[n._index];if("string"==typeof t)for(e=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===e&&n._bufferIndex<t.length;)g(t.charCodeAt(n._bufferIndex));else g(t);}}function g(e){u=u(e);}function f(e,t){t.restore();}function p(e,t){return function(i,s,o){let r,u,d,m;return Array.isArray(i)?g(i):"tokenize"in i?g([i]):function(e){return t;function t(t){const i=null!==t&&e[t],n=null!==t&&e.null;return g([...Array.isArray(i)?i:i?[i]:[],...Array.isArray(n)?n:n?[n]:[]])(t)}}(i);function g(e){return r=e,u=0,0===e.length?o:f(e[u])}function f(e){return function(i){m=function(){const e=h(),t=c.previous,i=c.currentConstruct,s=c.events.length,o=Array.from(a);return {from:s,restore:r};function r(){n=e,c.previous=t,c.currentConstruct=i,c.events.length=s,a=o,w();}}(),d=e,e.partial||(c.currentConstruct=e);if(e.name&&c.parser.constructs.disable.null.includes(e.name))return b();return e.tokenize.call(t?Object.assign(Object.create(c),t):c,l,p,b)(i)}}function p(t){return e(d,m),s}function b(e){return m.restore(),++u<r.length?f(r[u]):o}}}function b(e,t){e.resolveAll&&!o.includes(e)&&o.push(e),e.resolve&&NN(c.events,t,c.events.length-t,e.resolve(c.events.slice(t),c)),e.resolveTo&&(c.events=e.resolveTo(c.events,c));}function w(){n.line in s&&n.column<2&&(n.column=s[n.line],n.offset+=s[n.line]-1);}}const Mz=/[\0\t\n\r]/g;const Fz={}.hasOwnProperty;function Nz(e,t,i){return "string"!=typeof t&&(i=t,t=void 0),function(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(te),autolinkProtocol:A,autolinkEmail:A,atxHeading:o(Y),blockQuote:o(W),characterEscape:A,characterReference:A,codeFenced:o(G),codeFencedFenceInfo:r,codeFencedFenceMeta:r,codeIndented:o(G,r),codeText:o(K,r),codeTextData:A,data:A,codeFlowValue:A,definition:o(J),definitionDestinationString:r,definitionLabelString:r,definitionTitleString:r,emphasis:o(Q),hardBreakEscape:o(Z),hardBreakTrailing:o(Z),htmlFlow:o(X,r),htmlFlowData:A,htmlText:o(X,r),htmlTextData:A,image:o(ee),label:r,link:o(te),listItem:o(ne),listItemValue:h,listOrdered:o(ie,d),listUnordered:o(ie),paragraph:o(se),reference:D,referenceString:r,resourceDestinationString:r,resourceTitleString:r,setextHeading:o(Y),strong:o(oe),thematicBreak:o(ae)},exit:{atxHeading:l(),atxHeadingSequence:y,autolink:l(),autolinkEmail:$,autolinkProtocol:j,blockQuote:l(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:H,characterReferenceMarkerNumeric:H,characterReferenceValue:q,characterReference:U,codeFenced:l(p),codeFencedFence:f,codeFencedFenceInfo:m,codeFencedFenceMeta:g,codeFlowValue:E,codeIndented:l(b),codeText:l(V),codeTextData:E,data:E,definition:l(),definitionDestinationString:_,definitionLabelString:w,definitionTitleString:v,emphasis:l(),hardBreakEscape:l(S),hardBreakTrailing:l(S),htmlFlow:l(I),htmlFlowData:E,htmlText:l(P),htmlTextData:E,image:l(O),label:L,labelText:B,lineEnding:T,link:l(R),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:z,resourceDestinationString:M,resourceTitleString:F,resource:N,setextHeading:l(x),setextHeadingLineSequence:C,setextHeadingText:k,strong:l(),thematicBreak:l()}};zz(t,(e||{}).mdastExtensions||[]);const i={};return n;function n(e){let n={type:"root",children:[]};const o={stack:[n],tokenStack:[],config:t,enter:a,exit:c,buffer:r,resume:u,data:i},l=[];let d=-1;for(;++d<e.length;)if("listOrdered"===e[d][1].type||"listUnordered"===e[d][1].type)if("enter"===e[d][0])l.push(d);else {d=s(e,l.pop(),d);}for(d=-1;++d<e.length;){const i=t[e[d][0]];Fz.call(i,e[d][1].type)&&i[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},o),e[d][1]);}if(o.tokenStack.length>0){const e=o.tokenStack[o.tokenStack.length-1];(e[1]||qz).call(o,void 0,e[0]);}for(n.position={start:Dz(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Dz(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)n=t.transforms[d](n)||n;return n}function s(e,t,i){let n,s,o,r,a=t-1,l=-1,c=false;for(;++a<=i;){const t=e[a];switch(t[1].type){case "listUnordered":case "listOrdered":case "blockQuote":"enter"===t[0]?l++:l--,r=void 0;break;case "lineEndingBlank":"enter"===t[0]&&(!n||r||l||o||(o=a),r=void 0);break;case "linePrefix":case "listItemValue":case "listItemMarker":case "listItemPrefix":case "listItemPrefixWhitespace":break;default:r=void 0;}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(n){let r=a;for(s=void 0;r--;){const t=e[r];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;s&&(e[s][1].type="lineEndingBlank",c=true),t[1].type="lineEnding",s=r;}else if("linePrefix"!==t[1].type&&"blockQuotePrefix"!==t[1].type&&"blockQuotePrefixWhitespace"!==t[1].type&&"blockQuoteMarker"!==t[1].type&&"listItemIndent"!==t[1].type)break}o&&(!s||o<s)&&(n._spread=true),n.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||a,0,["exit",n,t[2]]),a++,i++;}if("listItemPrefix"===t[1].type){const s={type:"listItem",_spread:false,start:Object.assign({},t[1].start),end:void 0};n=s,e.splice(a,0,["enter",s,t[2]]),a++,i++,o=void 0,r=true;}}}return e[t][1]._spread=c,i}function o(e,t){return i;function i(i){a.call(this,e(i),i),t&&t.call(this,i);}}function r(){this.stack.push({type:"fragment",children:[]});}function a(e,t,i){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,i||void 0]),e.position={start:Dz(t.start),end:void 0};}function l(e){return t;function t(t){e&&e.call(this,t),c.call(this,t);}}function c(e,t){const i=this.stack.pop(),n=this.tokenStack.pop();if(!n)throw new Error("Cannot close `"+e.type+"` ("+KL({start:e.start,end:e.end})+"): it’s not open");if(n[0].type!==e.type)if(t)t.call(this,e,n[0]);else {(n[1]||qz).call(this,e,n[0]);}i.position.end=Dz(e.end);}function u(){return HF(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=true;}function h(e){if(this.data.expectingFirstListItemValue){this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0;}}function m(){const e=this.resume();this.stack[this.stack.length-1].lang=e;}function g(){const e=this.resume();this.stack[this.stack.length-1].meta=e;}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=true);}function p(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0;}function b(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"");}function w(e){const t=this.resume(),i=this.stack[this.stack.length-1];i.label=t,i.identifier=iF(this.sliceSerialize(e)).toLowerCase();}function v(){const e=this.resume();this.stack[this.stack.length-1].title=e;}function _(){const e=this.resume();this.stack[this.stack.length-1].url=e;}function y(e){const t=this.stack[this.stack.length-1];if(!t.depth){const i=this.sliceSerialize(e).length;t.depth=i;}}function k(){this.data.setextHeadingSlurpLineEnding=true;}function C(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2;}function x(){this.data.setextHeadingSlurpLineEnding=void 0;}function A(e){const t=this.stack[this.stack.length-1].children;let i=t[t.length-1];i&&"text"===i.type||(i=re(),i.position={start:Dz(e.start),end:void 0},t.push(i)),this.stack.push(i);}function E(e){const t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=Dz(e.end);}function T(e){const i=this.stack[this.stack.length-1];if(this.data.atHardBreak){return i.children[i.children.length-1].position.end=Dz(e.end),void(this.data.atHardBreak=void 0)}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(i.type)&&(A.call(this,e),E.call(this,e));}function S(){this.data.atHardBreak=true;}function I(){const e=this.resume();this.stack[this.stack.length-1].value=e;}function P(){const e=this.resume();this.stack[this.stack.length-1].value=e;}function V(){const e=this.resume();this.stack[this.stack.length-1].value=e;}function R(){const e=this.stack[this.stack.length-1];if(this.data.inReference){const t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title;}else delete e.identifier,delete e.label;this.data.referenceType=void 0;}function O(){const e=this.stack[this.stack.length-1];if(this.data.inReference){const t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title;}else delete e.identifier,delete e.label;this.data.referenceType=void 0;}function B(e){const t=this.sliceSerialize(e),i=this.stack[this.stack.length-2];i.label=uN(t),i.identifier=iF(t).toLowerCase();}function L(){const e=this.stack[this.stack.length-1],t=this.resume(),i=this.stack[this.stack.length-1];if(this.data.inReference=true,"link"===i.type){const t=e.children;i.children=t;}else i.alt=t;}function M(){const e=this.resume();this.stack[this.stack.length-1].url=e;}function F(){const e=this.resume();this.stack[this.stack.length-1].title=e;}function N(){this.data.inReference=void 0;}function D(){this.data.referenceType="collapsed";}function z(e){const t=this.resume(),i=this.stack[this.stack.length-1];i.label=t,i.identifier=iF(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full";}function H(e){this.data.characterReferenceType=e.type;}function q(e){const t=this.sliceSerialize(e),i=this.data.characterReferenceType;let n;if(i)n=lN(t,"characterReferenceMarkerNumeric"===i?10:16),this.data.characterReferenceType=void 0;else {n=aN(t);}this.stack[this.stack.length-1].value+=n;}function U(e){this.stack.pop().position.end=Dz(e.end);}function j(e){E.call(this,e);this.stack[this.stack.length-1].url=this.sliceSerialize(e);}function $(e){E.call(this,e);this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e);}function W(){return {type:"blockquote",children:[]}}function G(){return {type:"code",lang:null,meta:null,value:""}}function K(){return {type:"inlineCode",value:""}}function J(){return {type:"definition",identifier:"",label:null,title:null,url:""}}function Q(){return {type:"emphasis",children:[]}}function Y(){return {type:"heading",depth:0,children:[]}}function Z(){return {type:"break"}}function X(){return {type:"html",value:""}}function ee(){return {type:"image",title:null,url:"",alt:null}}function te(){return {type:"link",title:null,url:"",children:[]}}function ie(e){return {type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}function ne(e){return {type:"listItem",spread:e._spread,checked:null,children:[]}}function se(){return {type:"paragraph",children:[]}}function oe(){return {type:"strong",children:[]}}function re(){return {type:"text",value:""}}function ae(){return {type:"thematicBreak"}}}(i)(function(e){for(;!kD(e););return e}(function(e){const t={constructs:HN([Bz,...(e||{}).extensions||[]]),content:i(bz),defined:[],document:i(wz),flow:i(_z),lazy:{},string:i(kz),text:i(Cz)};return t;function i(e){return function(i){return Lz(t,e,i)}}}(i).document().write(function(){let e,t=1,i="",n=true;return function(s,o,r){const a=[];let l,c,u,d,h;for(s=i+("string"==typeof s?s.toString():new TextDecoder(o||void 0).decode(s)),u=0,i="",n&&(65279===s.charCodeAt(0)&&u++,n=void 0);u<s.length;){if(Mz.lastIndex=u,l=Mz.exec(s),d=l&&void 0!==l.index?l.index:s.length,h=s.charCodeAt(d),!l){i=s.slice(u);break}if(10===h&&u===d&&e)a.push(-3),e=void 0;else switch(e&&(a.push(-5),e=void 0),u<d&&(a.push(s.slice(u,d)),t+=d-u),h){case 0:a.push(65533),t++;break;case 9:for(c=4*Math.ceil(t/4),a.push(-2);t++<c;)a.push(-1);break;case 10:a.push(-4),t=1;break;default:e=true,t=1;}u=d+1;}return r&&(e&&a.push(-5),i&&a.push(i),a.push(null)),a}}()(e,t,true))))}function Dz(e){return {line:e.line,column:e.column,offset:e.offset}}function zz(e,t){let i=-1;for(;++i<t.length;){const n=t[i];Array.isArray(n)?zz(e,n):Hz(e,n);}}function Hz(e,t){let i;for(i in t)if(Fz.call(t,i))switch(i){case "canContainEols":{const n=t[i];n&&e[i].push(...n);break}case "transforms":{const n=t[i];n&&e[i].push(...n);break}case "enter":case "exit":{const n=t[i];n&&Object.assign(e[i],n);break}}}function qz(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+KL({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+KL({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+KL({start:t.start,end:t.end})+") is still open")}function Uz(e,t){const i=t.referenceType;let n="]";if("collapsed"===i?n+="[]":"full"===i&&(n+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return [{type:"text",value:"!["+t.alt+n}];const s=e.all(t),o=s[0];o&&"text"===o.type?o.value="["+o.value:s.unshift({type:"text",value:"["});const r=s[s.length-1];return r&&"text"===r.type?r.value+=n:s.push({type:"text",value:n}),s}function jz(e){const t=e.spread;return null==t?e.children.length>1:t}const $z=Gz("end"),Wz=Gz("start");function Gz(e){return function(t){const i=t&&t.position&&t.position[e]||{};if("number"==typeof i.line&&i.line>0&&"number"==typeof i.column&&i.column>0)return {line:i.line,column:i.column,offset:"number"==typeof i.offset&&i.offset>-1?i.offset:void 0}}}function Kz(e){const t=Wz(e),i=$z(e);if(t&&i)return {start:t,end:i}}function Jz(e){const t=String(e),i=/\r?\n|\r/g;let n=i.exec(t),s=0;const o=[];for(;n;)o.push(Qz(t.slice(s,n.index),s>0,true),n[0]),s=n.index+n[0].length,n=i.exec(t);return o.push(Qz(t.slice(s),s>0,false)),o.join("")}function Qz(e,t,i){let n=0,s=e.length;if(t){let t=e.codePointAt(n);for(;9===t||32===t;)n++,t=e.codePointAt(n);}if(i){let t=e.codePointAt(s-1);for(;9===t||32===t;)s--,t=e.codePointAt(s-1);}return s>n?e.slice(n,s):""}const Yz={blockquote:function(e,t){const i={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),true)};return e.patch(t,i),e.applyData(t,i)},break:function(e,t){const i={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,i),[e.applyData(t,i),{type:"text",value:"\n"}]},code:function(e,t){const i=t.value?t.value+"\n":"",n={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(n.className=["language-"+s[0]]);let o={type:"element",tagName:"code",properties:n,children:[{type:"text",value:i}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o},delete:function(e,t){const i={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)},emphasis:function(e,t){const i={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)},footnoteReference:function(e,t){const i="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=String(t.identifier).toUpperCase(),s=oD(n.toLowerCase()),o=e.footnoteOrder.indexOf(n);let r,a=e.footnoteCounts.get(n);void 0===a?(a=0,e.footnoteOrder.push(n),r=e.footnoteOrder.length):r=o+1,a+=1,e.footnoteCounts.set(n,a);const l={type:"element",tagName:"a",properties:{href:"#"+i+"fn-"+s,id:i+"fnref-"+s+(a>1?"-"+a:""),dataFootnoteRef:true,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(r)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)},heading:function(e,t){const i={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)},html:function(e,t){if(e.options.allowDangerousHtml){const i={type:"raw",value:t.value};return e.patch(t,i),e.applyData(t,i)}},imageReference:function(e,t){const i=String(t.identifier).toUpperCase(),n=e.definitionById.get(i);if(!n)return Uz(e,t);const s={src:oD(n.url||""),alt:t.alt};null!==n.title&&void 0!==n.title&&(s.title=n.title);const o={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,o),e.applyData(t,o)},image:function(e,t){const i={src:oD(t.url)};null!==t.alt&&void 0!==t.alt&&(i.alt=t.alt),null!==t.title&&void 0!==t.title&&(i.title=t.title);const n={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,n),e.applyData(t,n)},inlineCode:function(e,t){const i={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,i);const n={type:"element",tagName:"code",properties:{},children:[i]};return e.patch(t,n),e.applyData(t,n)},linkReference:function(e,t){const i=String(t.identifier).toUpperCase(),n=e.definitionById.get(i);if(!n)return Uz(e,t);const s={href:oD(n.url||"")};null!==n.title&&void 0!==n.title&&(s.title=n.title);const o={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)},link:function(e,t){const i={href:oD(t.url)};null!==t.title&&void 0!==t.title&&(i.title=t.title);const n={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},listItem:function(e,t,i){const n=e.all(t),s=i?function(e){let t=false;if("list"===e.type){t=e.spread||false;const i=e.children;let n=-1;for(;!t&&++n<i.length;)t=jz(i[n]);}return t}(i):jz(t),o={},r=[];if("boolean"==typeof t.checked){const e=n[0];let i;e&&"element"===e.type&&"p"===e.tagName?i=e:(i={type:"element",tagName:"p",properties:{},children:[]},n.unshift(i)),i.children.length>0&&i.children.unshift({type:"text",value:" "}),i.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:true},children:[]}),o.className=["task-list-item"];}let a=-1;for(;++a<n.length;){const e=n[a];(s||0!==a||"element"!==e.type||"p"!==e.tagName)&&r.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||s?r.push(e):r.push(...e.children);}const l=n[n.length-1];l&&(s||"element"!==l.type||"p"!==l.tagName)&&r.push({type:"text",value:"\n"});const c={type:"element",tagName:"li",properties:o,children:r};return e.patch(t,c),e.applyData(t,c)},list:function(e,t){const i={},n=e.all(t);let s=-1;for("number"==typeof t.start&&1!==t.start&&(i.start=t.start);++s<n.length;){const e=n[s];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){i.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:i,children:e.wrap(n,true)};return e.patch(t,o),e.applyData(t,o)},paragraph:function(e,t){const i={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)},root:function(e,t){const i={type:"root",children:e.wrap(e.all(t))};return e.patch(t,i),e.applyData(t,i)},strong:function(e,t){const i={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)},table:function(e,t){const i=e.all(t),n=i.shift(),s=[];if(n){const i={type:"element",tagName:"thead",properties:{},children:e.wrap([n],true)};e.patch(t.children[0],i),s.push(i);}if(i.length>0){const n={type:"element",tagName:"tbody",properties:{},children:e.wrap(i,true)},o=Wz(t.children[1]),r=$z(t.children[t.children.length-1]);o&&r&&(n.position={start:o,end:r}),s.push(n);}const o={type:"element",tagName:"table",properties:{},children:e.wrap(s,true)};return e.patch(t,o),e.applyData(t,o)},tableCell:function(e,t){const i={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)},tableRow:function(e,t,i){const n=i?i.children:void 0,s=0===(n?n.indexOf(t):1)?"th":"td",o=i&&"table"===i.type?i.align:void 0,r=o?o.length:t.children.length;let a=-1;const l=[];for(;++a<r;){const i=t.children[a],n={},r=o?o[a]:void 0;r&&(n.align=r);let c={type:"element",tagName:s,properties:n,children:[]};i&&(c.children=e.all(i),e.patch(i,c),c=e.applyData(i,c)),l.push(c);}const c={type:"element",tagName:"tr",properties:{},children:e.wrap(l,true)};return e.patch(t,c),e.applyData(t,c)},text:function(e,t){const i={type:"text",value:Jz(String(t.value))};return e.patch(t,i),e.applyData(t,i)},thematicBreak:function(e,t){const i={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,i),e.applyData(t,i)},toml:Zz,yaml:Zz,definition:Zz,footnoteDefinition:Zz};function Zz(){}const Xz="object"==typeof self?self:globalThis,eH=e=>((e,t)=>{const i=(t,i)=>(e.set(i,t),t),n=s=>{if(e.has(s))return e.get(s);const[o,r]=t[s];switch(o){case 0:case  -1:return i(r,s);case 1:{const e=i([],s);for(const t of r)e.push(n(t));return e}case 2:{const e=i({},s);for(const[t,i]of r)e[n(t)]=n(i);return e}case 3:return i(new Date(r),s);case 4:{const{source:e,flags:t}=r;return i(new RegExp(e,t),s)}case 5:{const e=i(new Map,s);for(const[t,i]of r)e.set(n(t),n(i));return e}case 6:{const e=i(new Set,s);for(const t of r)e.add(n(t));return e}case 7:{const{name:e,message:t}=r;return i(new Xz[e](t),s)}case 8:return i(BigInt(r),s);case "BigInt":return i(Object(BigInt(r)),s);case "ArrayBuffer":return i(new Uint8Array(r).buffer,r);case "DataView":{const{buffer:e}=new Uint8Array(r);return i(new DataView(e),r)}}return i(new Xz[o](r),s)};return n})(new Map,e)(0),tH="",{toString:iH}={},{keys:nH}=Object,sH=e=>{const t=typeof e;if("object"!==t||!e)return [0,t];const i=iH.call(e).slice(8,-1);switch(i){case "Array":return [1,tH];case "Object":return [2,tH];case "Date":return [3,tH];case "RegExp":return [4,tH];case "Map":return [5,tH];case "Set":return [6,tH];case "DataView":return [1,i]}return i.includes("Array")?[1,i]:i.includes("Error")?[7,i]:[2,i]},oH=([e,t])=>0===e&&("function"===t||"symbol"===t),rH=(e,{json:t,lossy:i}={})=>{const n=[];return ((e,t,i,n)=>{const s=(e,t)=>{const s=n.push(e)-1;return i.set(t,s),s},o=n=>{if(i.has(n))return i.get(n);let[r,a]=sH(n);switch(r){case 0:{let t=n;switch(a){case "bigint":r=8,t=n.toString();break;case "function":case "symbol":if(e)throw new TypeError("unable to serialize "+a);t=null;break;case "undefined":return s([-1],n)}return s([r,t],n)}case 1:{if(a){let e=n;return "DataView"===a?e=new Uint8Array(n.buffer):"ArrayBuffer"===a&&(e=new Uint8Array(n)),s([a,[...e]],n)}const e=[],t=s([r,e],n);for(const t of n)e.push(o(t));return t}case 2:{if(a)switch(a){case "BigInt":return s([a,n.toString()],n);case "Boolean":case "Number":case "String":return s([a,n.valueOf()],n)}if(t&&"toJSON"in n)return o(n.toJSON());const i=[],l=s([r,i],n);for(const t of nH(n))!e&&oH(sH(n[t]))||i.push([o(t),o(n[t])]);return l}case 3:return s([r,n.toISOString()],n);case 4:{const{source:e,flags:t}=n;return s([r,{source:e,flags:t}],n)}case 5:{const t=[],i=s([r,t],n);for(const[i,s]of n)(e||!oH(sH(i))&&!oH(sH(s)))&&t.push([o(i),o(s)]);return i}case 6:{const t=[],i=s([r,t],n);for(const i of n)!e&&oH(sH(i))||t.push(o(i));return i}}const{message:l}=n;return s([r,{name:a,message:l}],n)};return o})(!(t||i),!!t,new Map,n)(e),n};var aH="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?eH(rH(e,t)):structuredClone(e):(e,t)=>eH(rH(e,t));function lH(e,t){const i=[{type:"text",value:"↩"}];return t>1&&i.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),i}function cH(e,t){return "Back to reference "+(e+1)+(t>1?"-"+t:"")}const uH={}.hasOwnProperty,dH={};function hH(e,t){e.position&&(t.position=Kz(e));}function mH(e,t){let i=t;if(e&&e.data){const t=e.data.hName,n=e.data.hChildren,s=e.data.hProperties;if("string"==typeof t)if("element"===i.type)i.tagName=t;else {i={type:"element",tagName:t,properties:{},children:"children"in i?i.children:[i]};}"element"===i.type&&s&&Object.assign(i.properties,aH(s)),"children"in i&&i.children&&null!=n&&(i.children=n);}return i}function gH(e,t){const i=t.data||{},n=!("value"in t)||uH.call(i,"hProperties")||uH.call(i,"hChildren")?{type:"element",tagName:"div",properties:{},children:e.all(t)}:{type:"text",value:t.value};return e.patch(t,n),e.applyData(t,n)}function fH(e,t){const i=[];let n=-1;for(t&&i.push({type:"text",value:"\n"});++n<e.length;)n&&i.push({type:"text",value:"\n"}),i.push(e[n]);return t&&e.length>0&&i.push({type:"text",value:"\n"}),i}function pH(e){let t=0,i=e.charCodeAt(t);for(;9===i||32===i;)t++,i=e.charCodeAt(t);return e.slice(t)}function bH(e,t){const i=function(e,t){const i=t||dH,n=new Map,s=new Map,o=new Map,r={...Yz,...i.handlers},a={all:function(e){const t=[];if("children"in e){const i=e.children;let n=-1;for(;++n<i.length;){const s=a.one(i[n],e);if(s){if(n&&"break"===i[n-1].type&&(Array.isArray(s)||"text"!==s.type||(s.value=pH(s.value)),!Array.isArray(s)&&"element"===s.type)){const e=s.children[0];e&&"text"===e.type&&(e.value=pH(e.value));}Array.isArray(s)?t.push(...s):t.push(s);}}}return t},applyData:mH,definitionById:n,footnoteById:s,footnoteCounts:o,footnoteOrder:[],handlers:r,one:function(e,t){const i=e.type,n=a.handlers[i];if(uH.call(a.handlers,i)&&n)return n(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(i)){if("children"in e){const{children:t,...i}=e,n=aH(i);return n.children=a.all(e),n}return aH(e)}return (a.options.unknownHandler||gH)(a,e,t)},options:i,patch:hH,wrap:fH};return DF(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){const t="definition"===e.type?n:s,i=String(e.identifier).toUpperCase();t.has(i)||t.set(i,e);}}),a}(e,t),n=i.one(e,void 0),s=function(e){const t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",i=e.options.footnoteBackContent||lH,n=e.options.footnoteBackLabel||cH,s=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",r=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<e.footnoteOrder.length;){const s=e.footnoteById.get(e.footnoteOrder[l]);if(!s)continue;const o=e.all(s),r=String(s.identifier).toUpperCase(),c=oD(r.toLowerCase());let u=0;const d=[],h=e.footnoteCounts.get(r);for(;void 0!==h&&++u<=h;){d.length>0&&d.push({type:"text",value:" "});let e="string"==typeof i?i:i(l,u);"string"==typeof e&&(e={type:"text",value:e}),d.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+c+(u>1?"-"+u:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof n?n:n(l,u),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]});}const m=o[o.length-1];if(m&&"element"===m.type&&"p"===m.tagName){const e=m.children[m.children.length-1];e&&"text"===e.type?e.value+=" ":m.children.push({type:"text",value:" "}),m.children.push(...d);}else o.push(...d);const g={type:"element",tagName:"li",properties:{id:t+"fn-"+c},children:e.wrap(o,true)};e.patch(s,g),a.push(g);}if(0!==a.length)return {type:"element",tagName:"section",properties:{dataFootnotes:true,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...aH(r),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,true)},{type:"text",value:"\n"}]}}(i),o=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return s&&o.children.push({type:"text",value:"\n"},s),o}function wH(){return {type:"break"}}function vH(){return function(e){!function(e){HM(e,[/\r?\n|\r/g,wH]);}(e);}}class _H{constructor(e,t,i){this.normal=t,this.property=e,i&&(this.space=i);}}function yH(e,t){const i={},n={};for(const t of e)Object.assign(i,t.property),Object.assign(n,t.normal);return new _H(i,n,t)}function kH(e){return e.toLowerCase()}_H.prototype.normal={},_H.prototype.property={},_H.prototype.space=void 0;class CH{constructor(e,t){this.attribute=t,this.property=e;}}CH.prototype.attribute="",CH.prototype.booleanish=false,CH.prototype.boolean=false,CH.prototype.commaOrSpaceSeparated=false,CH.prototype.commaSeparated=false,CH.prototype.defined=false,CH.prototype.mustUseProperty=false,CH.prototype.number=false,CH.prototype.overloadedBoolean=false,CH.prototype.property="",CH.prototype.spaceSeparated=false,CH.prototype.space=void 0;let xH=0;const AH=RH(),EH=RH(),TH=RH(),SH=RH(),IH=RH(),PH=RH(),VH=RH();function RH(){return 2**++xH}var OH=Object.freeze({__proto__:null,boolean:AH,booleanish:EH,commaOrSpaceSeparated:VH,commaSeparated:PH,number:SH,overloadedBoolean:TH,spaceSeparated:IH});const BH=Object.keys(OH);class LH extends CH{constructor(e,t,i,n){let s=-1;if(super(e,t),MH(this,"space",n),"number"==typeof i)for(;++s<BH.length;){const e=BH[s];MH(this,BH[s],(i&OH[e])===OH[e]);}}}function MH(e,t,i){i&&(e[t]=i);}function FH(e){const t={},i={};for(const[n,s]of Object.entries(e.properties)){const o=new LH(n,e.transform(e.attributes||{},n),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(o.mustUseProperty=true),t[n]=o,i[kH(n)]=n,i[kH(o.attribute)]=n;}return new _H(t,i,e.space)}LH.prototype.defined=true;const NH=FH({properties:{ariaActiveDescendant:null,ariaAtomic:EH,ariaAutoComplete:null,ariaBusy:EH,ariaChecked:EH,ariaColCount:SH,ariaColIndex:SH,ariaColSpan:SH,ariaControls:IH,ariaCurrent:null,ariaDescribedBy:IH,ariaDetails:null,ariaDisabled:EH,ariaDropEffect:IH,ariaErrorMessage:null,ariaExpanded:EH,ariaFlowTo:IH,ariaGrabbed:EH,ariaHasPopup:null,ariaHidden:EH,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:IH,ariaLevel:SH,ariaLive:null,ariaModal:EH,ariaMultiLine:EH,ariaMultiSelectable:EH,ariaOrientation:null,ariaOwns:IH,ariaPlaceholder:null,ariaPosInSet:SH,ariaPressed:EH,ariaReadOnly:EH,ariaRelevant:null,ariaRequired:EH,ariaRoleDescription:IH,ariaRowCount:SH,ariaRowIndex:SH,ariaRowSpan:SH,ariaSelected:EH,ariaSetSize:SH,ariaSort:null,ariaValueMax:SH,ariaValueMin:SH,ariaValueNow:SH,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function DH(e,t){return t in e?e[t]:t}function zH(e,t){return DH(e,t.toLowerCase())}const HH=FH({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:PH,acceptCharset:IH,accessKey:IH,action:null,allow:null,allowFullScreen:AH,allowPaymentRequest:AH,allowUserMedia:AH,alt:null,as:null,async:AH,autoCapitalize:null,autoComplete:IH,autoFocus:AH,autoPlay:AH,blocking:IH,capture:null,charSet:null,checked:AH,cite:null,className:IH,cols:SH,colSpan:null,content:null,contentEditable:EH,controls:AH,controlsList:IH,coords:SH|PH,crossOrigin:null,data:null,dateTime:null,decoding:null,default:AH,defer:AH,dir:null,dirName:null,disabled:AH,download:TH,draggable:EH,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:AH,formTarget:null,headers:IH,height:SH,hidden:TH,high:SH,href:null,hrefLang:null,htmlFor:IH,httpEquiv:IH,id:null,imageSizes:null,imageSrcSet:null,inert:AH,inputMode:null,integrity:null,is:null,isMap:AH,itemId:null,itemProp:IH,itemRef:IH,itemScope:AH,itemType:IH,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:AH,low:SH,manifest:null,max:null,maxLength:SH,media:null,method:null,min:null,minLength:SH,multiple:AH,muted:AH,name:null,nonce:null,noModule:AH,noValidate:AH,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:AH,optimum:SH,pattern:null,ping:IH,placeholder:null,playsInline:AH,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:AH,referrerPolicy:null,rel:IH,required:AH,reversed:AH,rows:SH,rowSpan:SH,sandbox:IH,scope:null,scoped:AH,seamless:AH,selected:AH,shadowRootClonable:AH,shadowRootDelegatesFocus:AH,shadowRootMode:null,shape:null,size:SH,sizes:null,slot:null,span:SH,spellCheck:EH,src:null,srcDoc:null,srcLang:null,srcSet:null,start:SH,step:null,style:null,tabIndex:SH,target:null,title:null,translate:null,type:null,typeMustMatch:AH,useMap:null,value:EH,width:SH,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:IH,axis:null,background:null,bgColor:null,border:SH,borderColor:null,bottomMargin:SH,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:AH,declare:AH,event:null,face:null,frame:null,frameBorder:null,hSpace:SH,leftMargin:SH,link:null,longDesc:null,lowSrc:null,marginHeight:SH,marginWidth:SH,noResize:AH,noHref:AH,noShade:AH,noWrap:AH,object:null,profile:null,prompt:null,rev:null,rightMargin:SH,rules:null,scheme:null,scrolling:EH,standby:null,summary:null,text:null,topMargin:SH,valueType:null,version:null,vAlign:null,vLink:null,vSpace:SH,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:AH,disableRemotePlayback:AH,prefix:null,property:null,results:SH,security:null,unselectable:null},space:"html",transform:zH}),qH=FH({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:VH,accentHeight:SH,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:SH,amplitude:SH,arabicForm:null,ascent:SH,attributeName:null,attributeType:null,azimuth:SH,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:SH,by:null,calcMode:null,capHeight:SH,className:IH,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:SH,diffuseConstant:SH,direction:null,display:null,dur:null,divisor:SH,dominantBaseline:null,download:AH,dx:null,dy:null,edgeMode:null,editable:null,elevation:SH,enableBackground:null,end:null,event:null,exponent:SH,externalResourcesRequired:null,fill:null,fillOpacity:SH,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:PH,g2:PH,glyphName:PH,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:SH,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:SH,horizOriginX:SH,horizOriginY:SH,id:null,ideographic:SH,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:SH,k:SH,k1:SH,k2:SH,k3:SH,k4:SH,kernelMatrix:VH,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:SH,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:SH,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:SH,overlineThickness:SH,paintOrder:null,panose1:null,path:null,pathLength:SH,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:IH,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:SH,pointsAtY:SH,pointsAtZ:SH,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:VH,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:VH,rev:VH,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:VH,requiredFeatures:VH,requiredFonts:VH,requiredFormats:VH,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:SH,specularExponent:SH,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:SH,strikethroughThickness:SH,string:null,stroke:null,strokeDashArray:VH,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:SH,strokeOpacity:SH,strokeWidth:null,style:null,surfaceScale:SH,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:VH,tabIndex:SH,tableValues:null,target:null,targetX:SH,targetY:SH,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:VH,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:SH,underlineThickness:SH,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:SH,values:null,vAlphabetic:SH,vMathematical:SH,vectorEffect:null,vHanging:SH,vIdeographic:SH,version:null,vertAdvY:SH,vertOriginX:SH,vertOriginY:SH,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:SH,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:DH}),UH=FH({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),jH=FH({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:zH}),$H=FH({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),WH=/[A-Z]/g,GH=/-[a-z]/g,KH=/^data[-\w.:]+$/i;function JH(e,t){const i=kH(t);let n=t,s=CH;if(i in e.normal)return e.property[e.normal[i]];if(i.length>4&&"data"===i.slice(0,4)&&KH.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(GH,YH);n="data"+e.charAt(0).toUpperCase()+e.slice(1);}else {const e=t.slice(4);if(!GH.test(e)){let i=e.replace(WH,QH);"-"!==i.charAt(0)&&(i="-"+i),t="data"+i;}}s=LH;}return new s(n,t)}function QH(e){return "-"+e.toLowerCase()}function YH(e){return e.charAt(1).toUpperCase()}const ZH=yH([NH,HH,UH,jH,$H],"html"),XH=yH([NH,qH,UH,jH,$H],"svg"),eq="http://www.w3.org/1999/xhtml",tq="http://www.w3.org/2000/svg",iq={}.hasOwnProperty;function nq(e,t){const i=function(e,t){switch(e.type){case "root":return function(e,t){const i=e.children||[];let n,s=0===i.length,o=-1;for(;++o<i.length;){const e=i[o];if("element"===e.type&&"html"===e.tagName){s=true,n=String(e.properties&&e.properties.xmlns||"")||eq;break}}const r=t.namespace||n;let a;a=s?t.doc.implementation.createDocument(r||null,""):t.fragment?t.doc.createDocumentFragment():t.doc.createElement("html");return sq(a,i,{...t,namespace:r,impliedNamespace:r}),a}(e,t);case "text":return function(e,t){return t.doc.createTextNode(e.value)}(e,t);case "doctype":return function(e,t){return t.doc.implementation.createDocumentType("html","","")}(0,t);case "comment":return function(e,t){return t.doc.createComment(e.value)}(e,t);default:return function(e,t){let i=t.impliedNamespace||t.namespace;const n=e.tagName||(i===tq?"g":"div"),s=e.properties||{},o=e.children||[];void 0!==i&&i!==eq||"svg"!==n||(i=tq);const r=i?t.doc.createElementNS(i,n):t.doc.createElement(n);!function(e,t,i){let n;for(n in t)if(iq.call(t,n)){const s=JH(i,n);let o=t[n];Array.isArray(o)&&(o=o.join(s.commaSeparated?", ":" ")),s.mustUseProperty&&(e[s.property]=o),s.boolean||s.overloadedBoolean&&"boolean"==typeof o?o&&e.setAttribute(s.attribute,""):s.booleanish?e.setAttribute(s.attribute,String(o)):true===o?e.setAttribute(s.attribute,""):(o||0===o||""===o)&&e.setAttribute(s.attribute,String(o));}}(r,s,i===tq?XH:ZH);const a=t.impliedNamespace;return t.impliedNamespace=i,sq(r,o,t),t.impliedNamespace=a,r}(e,t)}}(e,t);return t.afterTransform&&t.afterTransform(e,i),i}function sq(e,t,i){let n=-1;for(;++n<t.length;)e.append(nq(t[n],i));}function oq(e){if("doctype"in e){return (e.doctype?oq(e.doctype):"")+(e.documentElement?oq(e.documentElement):"")}if("publicId"in e)return "<DOCTYPE html>";const t=document.createElement("template");return t.content.append(e),t.innerHTML}const rq=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],aq=/["&'<>`]/g,lq=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,cq=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,uq=/[|\\{}()[\]^$+*?.]/g,dq=new WeakMap;function hq(e,t){return e=e.replace(t.subset?function(e){let t=dq.get(e);t||(t=function(e){const t=[];let i=-1;for(;++i<e.length;)t.push(e[i].replace(uq,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}(e),dq.set(e,t));return t}(t.subset):aq,i),t.subset||t.escapeOnly?e:e.replace(lq,function(e,i,n){return t.format(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)-56320+65536,n.charCodeAt(i+2),t)}).replace(cq,i);function i(e,i,n){return t.format(e.charCodeAt(0),n.charCodeAt(i+1),t)}}const mq=/[\dA-Fa-f]/;const gq=/\d/;const fq=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],pq={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},bq=["cent","copy","divide","gt","lt","not","para","times"],wq={}.hasOwnProperty,vq={};let _q;for(_q in pq)wq.call(pq,_q)&&(vq[pq[_q]]=_q);const yq=/[^\dA-Za-z]/;function kq(e,t,i){let n,s=function(e,t,i){const n="&#x"+e.toString(16).toUpperCase();return i&&t&&!mq.test(String.fromCharCode(t))?n:n+";"}(e,t,i.omitOptionalSemicolons);if((i.useNamedReferences||i.useShortestReferences)&&(n=function(e,t,i,n){const s=String.fromCharCode(e);if(wq.call(vq,s)){const e=vq[s],o="&"+e;return i&&fq.includes(e)&&!bq.includes(e)&&(!n||t&&61!==t&&yq.test(String.fromCharCode(t)))?o:o+";"}return ""}(e,t,i.omitOptionalSemicolons,i.attribute)),(i.useShortestReferences||!n)&&i.useShortestReferences){const n=function(e,t,i){const n="&#"+String(e);return i&&t&&!gq.test(String.fromCharCode(t))?n:n+";"}(e,t,i.omitOptionalSemicolons);n.length<s.length&&(s=n);}return n&&(!i.useShortestReferences||n.length<s.length)?n:s}function Cq(e,t){return hq(e,Object.assign({format:kq},t))}const xq=/^>|^->|<!--|-->|--!>|<!-$/g,Aq=[">"],Eq=["<",">"];function Tq(e){const t=[],i=String(e||"");let n=i.indexOf(","),s=0,o=false;for(;!o;){ -1===n&&(n=i.length,o=true);const e=i.slice(s,n).trim();!e&&o||t.push(e),s=n+1,n=i.indexOf(",",s);}return t}function Sq(e,t){const i=t||{};return (""===e[e.length-1]?[...e,""]:e).join((i.padRight?" ":"")+","+(false===i.padLeft?"":" ")).trim()}function Iq(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function Pq(e){return e.join(" ").trim()}const Vq=/[ \t\n\f\r]/g;function Rq(e){return "object"==typeof e?"text"===e.type&&Oq(e.value):Oq(e)}function Oq(e){return ""===e.replace(Vq,"")}const Bq=Fq(1),Lq=Fq(-1),Mq=[];function Fq(e){return function(t,i,n){const s=t?t.children:Mq;let o=(i||0)+e,r=s[o];if(!n)for(;r&&Rq(r);)o+=e,r=s[o];return r}}const Nq={}.hasOwnProperty;function Dq(e){return function(t,i,n){return Nq.call(e,t.tagName)&&e[t.tagName](t,i,n)}}const zq=Dq({body:function(e,t,i){const n=Bq(i,t);return !n||"comment"!==n.type},caption:Hq,colgroup:Hq,dd:function(e,t,i){const n=Bq(i,t);return !n||"element"===n.type&&("dt"===n.tagName||"dd"===n.tagName)},dt:function(e,t,i){const n=Bq(i,t);return Boolean(n&&"element"===n.type&&("dt"===n.tagName||"dd"===n.tagName))},head:Hq,html:function(e,t,i){const n=Bq(i,t);return !n||"comment"!==n.type},li:function(e,t,i){const n=Bq(i,t);return !n||"element"===n.type&&"li"===n.tagName},optgroup:function(e,t,i){const n=Bq(i,t);return !n||"element"===n.type&&"optgroup"===n.tagName},option:function(e,t,i){const n=Bq(i,t);return !n||"element"===n.type&&("option"===n.tagName||"optgroup"===n.tagName)},p:function(e,t,i){const n=Bq(i,t);return n?"element"===n.type&&("address"===n.tagName||"article"===n.tagName||"aside"===n.tagName||"blockquote"===n.tagName||"details"===n.tagName||"div"===n.tagName||"dl"===n.tagName||"fieldset"===n.tagName||"figcaption"===n.tagName||"figure"===n.tagName||"footer"===n.tagName||"form"===n.tagName||"h1"===n.tagName||"h2"===n.tagName||"h3"===n.tagName||"h4"===n.tagName||"h5"===n.tagName||"h6"===n.tagName||"header"===n.tagName||"hgroup"===n.tagName||"hr"===n.tagName||"main"===n.tagName||"menu"===n.tagName||"nav"===n.tagName||"ol"===n.tagName||"p"===n.tagName||"pre"===n.tagName||"section"===n.tagName||"table"===n.tagName||"ul"===n.tagName):!i||!("element"===i.type&&("a"===i.tagName||"audio"===i.tagName||"del"===i.tagName||"ins"===i.tagName||"map"===i.tagName||"noscript"===i.tagName||"video"===i.tagName))},rp:qq,rt:qq,tbody:function(e,t,i){const n=Bq(i,t);return !n||"element"===n.type&&("tbody"===n.tagName||"tfoot"===n.tagName)},td:Uq,tfoot:function(e,t,i){return !Bq(i,t)},th:Uq,thead:function(e,t,i){const n=Bq(i,t);return Boolean(n&&"element"===n.type&&("tbody"===n.tagName||"tfoot"===n.tagName))},tr:function(e,t,i){const n=Bq(i,t);return !n||"element"===n.type&&"tr"===n.tagName}});function Hq(e,t,i){const n=Bq(i,t,true);return !n||"comment"!==n.type&&!("text"===n.type&&Rq(n.value.charAt(0)))}function qq(e,t,i){const n=Bq(i,t);return !n||"element"===n.type&&("rp"===n.tagName||"rt"===n.tagName)}function Uq(e,t,i){const n=Bq(i,t);return !n||"element"===n.type&&("td"===n.tagName||"th"===n.tagName)}const jq=Dq({body:function(e){const t=Bq(e,-1,true);return !(t&&("comment"===t.type||"text"===t.type&&Rq(t.value.charAt(0))||"element"===t.type&&("meta"===t.tagName||"link"===t.tagName||"script"===t.tagName||"style"===t.tagName||"template"===t.tagName)))},colgroup:function(e,t,i){const n=Lq(i,t),s=Bq(e,-1,true);if(i&&n&&"element"===n.type&&"colgroup"===n.tagName&&zq(n,i.children.indexOf(n),i))return  false;return Boolean(s&&"element"===s.type&&"col"===s.tagName)},head:function(e){const t=new Set;for(const i of e.children)if("element"===i.type&&("base"===i.tagName||"title"===i.tagName)){if(t.has(i.tagName))return  false;t.add(i.tagName);}const i=e.children[0];return !i||"element"===i.type},html:function(e){const t=Bq(e,-1);return !t||"comment"!==t.type},tbody:function(e,t,i){const n=Lq(i,t),s=Bq(e,-1);if(i&&n&&"element"===n.type&&("thead"===n.tagName||"tbody"===n.tagName)&&zq(n,i.children.indexOf(n),i))return  false;return Boolean(s&&"element"===s.type&&"tr"===s.tagName)}});const $q={name:[["\t\n\f\r &/=>".split(""),"\t\n\f\r \"&'/=>`".split("")],["\0\t\n\f\r \"&'/<=>".split(""),"\0\t\n\f\r \"&'/<=>`".split("")]],unquoted:[["\t\n\f\r &>".split(""),"\0\t\n\f\r \"&'<=>`".split("")],["\0\t\n\f\r \"&'<=>`".split(""),"\0\t\n\f\r \"&'<=>`".split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function Wq(e,t,i){const n=JH(e.schema,t),s=e.settings.allowParseErrors&&"html"===e.schema.space?0:1,o=e.settings.allowDangerousCharacters?0:1;let r,a=e.quote;if(!n.overloadedBoolean||i!==n.attribute&&""!==i?!n.boolean&&!n.overloadedBoolean||"string"==typeof i&&i!==n.attribute&&""!==i||(i=Boolean(i)):i=true,null==i||false===i||"number"==typeof i&&Number.isNaN(i))return "";const l=Cq(n.attribute,Object.assign({},e.settings.characterReferences,{subset:$q.name[s][o]}));return  true===i?l:(i=Array.isArray(i)?(n.commaSeparated?Sq:Pq)(i,{padLeft:!e.settings.tightCommaSeparatedLists}):String(i),e.settings.collapseEmptyAttributes&&!i?l:(e.settings.preferUnquoted&&(r=Cq(i,Object.assign({},e.settings.characterReferences,{attribute:true,subset:$q.unquoted[s][o]}))),r!==i&&(e.settings.quoteSmart&&vM(i,a)>vM(i,e.alternative)&&(a=e.alternative),r=a+Cq(i,Object.assign({},e.settings.characterReferences,{subset:("'"===a?$q.single:$q.double)[s][o],attribute:true}))+a),l+(r?"="+r:r)))}const Gq=["<","&"];function Kq(e,t,i,n){return !i||"element"!==i.type||"script"!==i.tagName&&"style"!==i.tagName?Cq(e.value,Object.assign({},n.settings.characterReferences,{subset:Gq})):e.value}const Jq=CF("type",{invalid:function(e){throw new Error("Expected node, not `"+e+"`")},unknown:function(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")},handlers:{comment:function(e,t,i,n){return n.settings.bogusComments?"<?"+Cq(e.value,Object.assign({},n.settings.characterReferences,{subset:Aq}))+">":"\x3c!--"+e.value.replace(xq,function(e){return Cq(e,Object.assign({},n.settings.characterReferences,{subset:Eq}))})+"--\x3e"},doctype:function(e,t,i,n){return "<!"+(n.settings.upperDoctype?"DOCTYPE":"doctype")+(n.settings.tightDoctype?"":" ")+"html>"},element:function(e,t,i,n){const s=n.schema,o="svg"!==s.space&&n.settings.omitOptionalTags;let r="svg"===s.space?n.settings.closeEmptyElements:n.settings.voids.includes(e.tagName.toLowerCase());const a=[];let l;"html"===s.space&&"svg"===e.tagName&&(n.schema=XH);const c=function(e,t){const i=[];let n,s=-1;if(t)for(n in t)if(null!==t[n]&&void 0!==t[n]){const s=Wq(e,n,t[n]);s&&i.push(s);}for(;++s<i.length;){const t=e.settings.tightAttributes?i[s].charAt(i[s].length-1):void 0;s!==i.length-1&&'"'!==t&&"'"!==t&&(i[s]+=" ");}return i.join("")}(n,e.properties),u=n.all("html"===s.space&&"template"===e.tagName?e.content:e);return n.schema=s,u&&(r=false),!c&&o&&jq(e,t,i)||(a.push("<",e.tagName,c?" "+c:""),r&&("svg"===s.space||n.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!n.settings.tightSelfClosing||"/"===l||l&&'"'!==l&&"'"!==l)&&a.push(" "),a.push("/")),a.push(">")),a.push(u),r||o&&zq(e,t,i)||a.push("</"+e.tagName+">"),a.join("")},raw:function(e,t,i,n){return n.settings.allowDangerousHtml?e.value:Kq(e,0,i,n)},root:function(e,t,i,n){return n.all(e)},text:Kq}});const Qq={},Yq={},Zq=[];function Xq(e,t){const i=t||Qq,n=i.quote||'"',s='"'===n?"'":'"';if('"'!==n&&"'"!==n)throw new Error("Invalid quote `"+n+"`, expected `'` or `\"`");return {one:eU,all:tU,settings:{omitOptionalTags:i.omitOptionalTags||false,allowParseErrors:i.allowParseErrors||false,allowDangerousCharacters:i.allowDangerousCharacters||false,quoteSmart:i.quoteSmart||false,preferUnquoted:i.preferUnquoted||false,tightAttributes:i.tightAttributes||false,upperDoctype:i.upperDoctype||false,tightDoctype:i.tightDoctype||false,bogusComments:i.bogusComments||false,tightCommaSeparatedLists:i.tightCommaSeparatedLists||false,tightSelfClosing:i.tightSelfClosing||false,collapseEmptyAttributes:i.collapseEmptyAttributes||false,allowDangerousHtml:i.allowDangerousHtml||false,voids:i.voids||rq,characterReferences:i.characterReferences||Yq,closeSelfClosing:i.closeSelfClosing||false,closeEmptyElements:i.closeEmptyElements||false},schema:"svg"===i.space?XH:ZH,quote:n,alternative:s}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function eU(e,t,i){return Jq(e,t,i,this)}function tU(e){const t=[],i=e&&e.children||Zq;let n=-1;for(;++n<i.length;)t[n]=this.one(i[n],n,e);return t.join("")}const iU=/[#.]/g;function nU(e,t,i){const n=i?function(e){const t=new Map;for(const i of e)t.set(i.toLowerCase(),i);return t}(i):void 0;return function(i,s,...o){let r;if(null==i){r={type:"root",children:[]};const e=s;o.unshift(e);}else {r=function(e,t){const i=e||"",n={};let s,o,r=0;for(;r<i.length;){iU.lastIndex=r;const e=iU.exec(i),t=i.slice(r,e?e.index:i.length);t&&(s?"#"===s?n.id=t:Array.isArray(n.className)?n.className.push(t):n.className=[t]:o=t,r+=t.length),e&&(s=e[0],r++);}return {type:"element",tagName:o||t||"div",properties:n,children:[]}}(i,t);const a=r.tagName.toLowerCase(),l=n?n.get(a):void 0;if(r.tagName=l||a,function(e){if(null===e||"object"!=typeof e||Array.isArray(e))return  true;if("string"!=typeof e.type)return  false;const t=e,i=Object.keys(e);for(const e of i){const i=t[e];if(i&&"object"==typeof i){if(!Array.isArray(i))return  true;const e=i;for(const t of e)if("number"!=typeof t&&"string"!=typeof t)return  true}}if("children"in e&&Array.isArray(e.children))return  true;return  false}(s))o.unshift(s);else for(const[t,i]of Object.entries(s))sU(e,r.properties,t,i);}for(const e of o)oU(r.children,e);return "element"===r.type&&"template"===r.tagName&&(r.content={type:"root",children:r.children},r.children=[]),r}}function sU(e,t,i,n){const s=JH(e,i);let o;if(null!=n){if("number"==typeof n){if(Number.isNaN(n))return;o=n;}else o="boolean"==typeof n?n:"string"==typeof n?s.spaceSeparated?Iq(n):s.commaSeparated?Tq(n):s.commaOrSpaceSeparated?Iq(Tq(n).join(" ")):rU(s,s.property,n):Array.isArray(n)?[...n]:"style"===s.property?function(e){const t=[];for(const[i,n]of Object.entries(e))t.push([i,n].join(": "));return t.join("; ")}(n):String(n);if(Array.isArray(o)){const e=[];for(const t of o)e.push(rU(s,s.property,t));o=e;}"className"===s.property&&Array.isArray(t.className)&&(o=t.className.concat(o)),t[s.property]=o;}}function oU(e,t){if(null==t);else if("number"==typeof t||"string"==typeof t)e.push({type:"text",value:String(t)});else if(Array.isArray(t))for(const i of t)oU(e,i);else {if("object"!=typeof t||!("type"in t))throw new Error("Expected node, nodes, or string, got `"+t+"`");"root"===t.type?oU(e,t.children):e.push(t);}}function rU(e,t,i){if("string"==typeof i){if(e.number&&i&&!Number.isNaN(Number(i)))return Number(i);if((e.boolean||e.overloadedBoolean)&&(""===i||kH(i)===kH(t)))return  true}return i}const aU=nU(ZH,"div"),lU=nU(XH,"g",["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"]);function cU(e,t){return uU(e,{})||{type:"root",children:[]}}function uU(e,t){const i=function(e,t){switch(e.nodeType){case 1:return function(e,t){const i=e.namespaceURI,n=i===tq?lU:aU,s=i===eq?e.tagName.toLowerCase():e.tagName,o=i===eq&&"template"===s?e.content:e,r=e.getAttributeNames(),a={};let l=-1;for(;++l<r.length;)a[r[l]]=e.getAttribute(r[l])||"";return n(s,a,hU(o,t))}(e,t);case 3:return function(e){return {type:"text",value:e.nodeValue||""}}(e);case 8:return function(e){return {type:"comment",value:e.nodeValue||""}}(e);case 9:return dU(e,t);case 10:return {type:"doctype"};case 11:return dU(e,t);default:return}}(e,t);return i&&t.afterTransform&&t.afterTransform(e,i),i}function dU(e,t){return {type:"root",children:hU(e,t)}}function hU(e,t){const i=e.childNodes,n=[];let s=-1;for(;++s<i.length;){const e=uU(i[s],t);void 0!==e&&n.push(e);}return n}const mU=Object.freeze({remarkParse:function(e){const t=this;t.parser=function(i){return Nz(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})};},remarkGfm:[pz,{singleTilde:true}],remarkBreaks:vH,remarkRehype:[function(e,t){return e&&"run"in e?async function(i,n){const s=bH(i,{file:n,...t});await e.run(s,n);}:function(i,n){return bH(i,{file:n,...e||t})}},{allowDangerousHtml:true}],rehypeDomRaw:function(){return e=>{DF(e,["root","element"],e=>{if(!function(e){return ("root"===e.type||"element"===e.type)&&e.children}(e))return;if(!e.children.some(e=>"raw"===e.type))return;const t=document.createElement("template");t.innerHTML=Xq({type:"root",children:e.children},{allowDangerousHtml:true}),e.children=Array.from(t.content.childNodes).map(e=>cU(e));});}},deleteClassesFromToDoLists:function(){return e=>{DF(e,"element",e=>{"ul"!==e.tagName&&"ol"!==e.tagName&&"li"!==e.tagName||(e.children=e.children.filter(e=>"text"!==e.type||!!e.value.trim()),delete e.properties.className);});}},rehypeStringify:function(e){const t={...this.data("settings"),...e};false!==t.fragment&&(t.fragment=true),this.compiler=function(e){return oq(function(e,t){const i=t||{};return nq(e,{doc:i.document||document,fragment:i.fragment||false,namespace:i.namespace||void 0,impliedNamespace:void 0,afterTransform:i.afterTransform||void 0})}(e,t))};}});class gU{_processor;constructor({plugins:e=mU}={}){this._processor=hM().use({plugins:Object.values(e)});}parse(e){return this._processor.processSync(e).toString().replaceAll("\n</code>","</code>")}}function fU(e){const t={...this.data("settings"),...e};this.parser=function(e){const i=false===t.fragment?pU:bU;return cU(i(e))};}function pU(e){return (new DOMParser).parseFromString(e,"text/html")}function bU(e){const t=document.createElement("template");return t.innerHTML=e,t.content}const wU=function(e,t,i,n,s){const o=vU(t);return !!kU(e)&&o.call(s,e,i,n)},vU=function(e){if(null==e)return yU;if("string"==typeof e)return function(e){return _U(t);function t(t){return t.tagName===e}}(e);if("object"==typeof e)return function(e){const t=[];let i=-1;for(;++i<e.length;)t[i]=vU(e[i]);return _U(n);function n(...e){let i=-1;for(;++i<t.length;)if(t[i].apply(this,e))return  true;return  false}}(e);if("function"==typeof e)return _U(e);throw new Error("Expected function, string, or array as `test`")};function _U(e){return function(t,i,n){return Boolean(kU(t)&&e.call(this,t,"number"==typeof i?i:void 0,n||void 0))}}function yU(e){return Boolean(e&&"object"==typeof e&&"type"in e&&"element"===e.type&&"tagName"in e&&"string"==typeof e.tagName)}function kU(e){return null!==e&&"object"==typeof e&&"type"in e&&"tagName"in e}const CU=vU(function(e){return "audio"===e.tagName||"canvas"===e.tagName||"embed"===e.tagName||"iframe"===e.tagName||"img"===e.tagName||"math"===e.tagName||"object"===e.tagName||"picture"===e.tagName||"svg"===e.tagName||"video"===e.tagName}),xU=["address","article","aside","blockquote","body","br","caption","center","col","colgroup","dd","dialog","dir","div","dl","dt","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","li","listing","main","menu","nav","ol","optgroup","option","p","plaintext","pre","section","summary","table","tbody","td","td","tfoot","th","th","thead","tr","ul","wbr","xmp"],AU=["button","input","select","textarea"],EU=["area","base","basefont","dialog","datalist","head","link","meta","noembed","noframes","param","rp","script","source","style","template","track","title"],TU={},SU=OM(["comment","doctype"]);function IU(e,t){if("children"in e){const i={...t};return ("root"===e.type||OU(e))&&(i.before=true,i.after=true),i.whitespace=function(e,t){if("tagName"in e&&e.properties)switch(e.tagName){case "listing":case "plaintext":case "script":case "style":case "xmp":return "pre";case "nobr":return "nowrap";case "pre":return e.properties.wrap?"pre-wrap":"pre";case "td":case "th":return e.properties.noWrap?"nowrap":t.whitespace;case "textarea":return "pre-wrap"}return t.whitespace}(e,t),function(e,t){let i=t.before;const n=t.after,s=e.children;let o=s.length,r=-1;for(;++r<o;){const e=IU(s[r],{...t,after:PU(s,r,n),before:i});e.remove?(s.splice(r,1),r--,o--):e.ignore||(i=e.stripAtStart),RU(s[r])&&(i=false);}return {ignore:false,stripAtStart:Boolean(i||n),remove:false}}(e,i)}if("text"===e.type){if("normal"===t.whitespace)return function(e,t){const i=t.collapse(e.value),n={ignore:false,stripAtStart:false,remove:false};let s=0,o=i.length;t.before&&LU(i.charAt(0))&&s++;s!==o&&LU(i.charAt(o-1))&&(t.after?o--:n.stripAtStart=true);s===o?n.remove=true:e.value=i.slice(s,o);return n}(e,t);"nowrap"===t.whitespace&&(e.value=t.collapse(e.value));}return {ignore:SU(e),stripAtStart:false,remove:false}}function PU(e,t,i){for(;++t<e.length;){const i=e[t];let n=VU(i);if(void 0===n&&"children"in i&&!BU(i)&&(n=PU(i.children,-1)),"boolean"==typeof n)return n}return i}function VU(e){if("element"===e.type){if(RU(e))return  false;if(OU(e))return  true}else if("text"===e.type){if(!Rq(e))return  false}else if(!SU(e))return  false}function RU(e){return CU(e)||wU(e,AU)}function OU(e){return wU(e,xU)}function BU(e){return Boolean("element"===e.type&&e.properties.hidden)||SU(e)||wU(e,EU)}function LU(e){return " "===e||"\n"===e}function MU(e){const t=/\r?\n|\r/.exec(e);return t?t[0]:" "}function FU(){return " "}function NU(e){return function(t){return String(t).replace(/[\t\n\v\f\r ]+/g,e)}}function DU(e){return function(t){!function(e,t){IU(e,{collapse:NU((t||TU).newlines?MU:FU),whitespace:"normal"});}(t,e);}}const zU=function(e,t,i){const n=OM(i);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if("number"==typeof t){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if((t=e.children.indexOf(t))<0)throw new Error("Expected child node or index");for(;++t<e.children.length;)if(n(e.children[t],t,e))return e.children[t]},HU=/\n/g,qU=/[\t ]+/g,UU=vU("br"),jU=vU(function(e){return "td"===e.tagName||"th"===e.tagName}),$U=vU("p"),WU=vU("tr"),GU=vU(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",function(e){return Boolean((e.properties||{}).hidden)},function(e){return "dialog"===e.tagName&&!(e.properties||{}).open}]),KU=vU(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function JU(e,t){const i="children"in e?e.children:[],n=KU(e),s=XU(e,{whitespace:{}.whitespace||"normal"}),o=[];"text"!==e.type&&"comment"!==e.type||o.push(...YU(e,{breakBefore:true,breakAfter:true}));let r=-1;for(;++r<i.length;)o.push(...QU(i[r],e,{whitespace:s,breakBefore:r?void 0:n,breakAfter:r<i.length-1?UU(i[r+1]):n}));const a=[];let l;for(r=-1;++r<o.length;){const e=o[r];"number"==typeof e?void 0!==l&&e>l&&(l=e):e&&(void 0!==l&&l>-1&&a.push("\n".repeat(l)||" "),l=-1,a.push(e));}return a.join("")}function QU(e,t,i){return "element"===e.type?function(e,t,i){const n=XU(e,i),s=e.children||[];let o,r,a=-1,l=[];if(GU(e))return l;UU(e)||WU(e)&&zU(t,e,WU)?r="\n":$U(e)?(o=2,r=2):KU(e)&&(o=1,r=1);for(;++a<s.length;)l=l.concat(QU(s[a],e,{whitespace:n,breakBefore:a?void 0:o,breakAfter:a<s.length-1?UU(s[a+1]):r}));jU(e)&&zU(t,e,jU)&&l.push("\t");o&&l.unshift(o);r&&l.push(r);return l}(e,t,i):"text"===e.type?"normal"===i.whitespace?YU(e,i):function(e){return [String(e.value)]}(e):[]}function YU(e,t){const i=String(e.value),n=[],s=[];let o=0;for(;o<=i.length;){HU.lastIndex=o;const e=HU.exec(i),s=e&&"index"in e?e.index:i.length;n.push(ZU(i.slice(o,s).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),0!==o||t.breakBefore,s!==i.length||t.breakAfter)),o=s+1;}let r,a=-1;for(;++a<n.length;)8203===n[a].charCodeAt(n[a].length-1)||a<n.length-1&&8203===n[a+1].charCodeAt(0)?(s.push(n[a]),r=void 0):n[a]?("number"==typeof r&&s.push(r),s.push(n[a]),r=0):0!==a&&a!==n.length-1||s.push(0);return s}function ZU(e,t,i){const n=[];let s,o=0;for(;o<e.length;){qU.lastIndex=o;const i=qU.exec(e);s=i?i.index:e.length,o||s||!i||t||n.push(""),o!==s&&n.push(e.slice(o,s)),o=i?s+i[0].length:s;}return o===s||i||n.push(""),n.join(" ")}function XU(e,t){if("element"===e.type){const i=e.properties||{};switch(e.tagName){case "listing":case "plaintext":case "xmp":return "pre";case "nobr":return "nowrap";case "pre":return i.wrap?"pre-wrap":"pre";case "td":case "th":return i.noWrap?"nowrap":t.whitespace;case "textarea":return "pre-wrap"}}return t.whitespace}function ej(e){const t=String(e);let i=t.length;for(;i>0;){const e=t.codePointAt(i-1);if(void 0===e||10!==e&&13!==e)break;i--;}return t.slice(0,i)}const tj="language-";function ij(e,t){const i=t.children;let n,s,o=-1;if("pre"===t.tagName)for(;++o<i.length;){const e=i[o];if("element"===e.type&&"code"===e.tagName&&e.properties&&e.properties.className&&Array.isArray(e.properties.className)){n=e.properties.className;break}}if(n)for(o=-1;++o<n.length;)if(String(n[o]).slice(0,9)===tj){s=String(n[o]).slice(9);break}const r={type:"code",lang:s||null,meta:null,value:ej(JU(t))};return e.patch(t,r),r}function nj(e,t){const i={type:"delete",children:e.all(t)};return e.patch(t,i),i}function sj(e){let t=-1;if(e.length>1)for(;++t<e.length;)if(e[t].spread)return  true;return  false}function oj(e,t){const i=e.all({type:"root",children:t}),n=e.toSpecificContent(i,rj);return 0===n.length?[]:1===n.length?n[0].children:[{type:"list",ordered:false,start:null,spread:sj(n),children:n}]}function rj(){return {type:"listItem",spread:false,checked:null,children:[]}}function aj(e,t){const i={type:"emphasis",children:e.all(t)};return e.patch(t,i),i}function lj(e){let t=0,i=e.length;for(;t<i&&"break"===e[t].type;)t++;for(;i>t&&"break"===e[i-1].type;)i--;return 0===t&&i===e.length?e:e.slice(t,i)}function cj(e,t){const i={type:"heading",depth:Number(t.tagName.charAt(1))||1,children:lj(e.all(t))};return e.patch(t,i),i}function uj(e,t){const i=t.properties||{},n={type:"image",url:e.resolve(String(i.src||"")||null),title:i.title?String(i.title):null,alt:i.alt?String(i.alt):""};return e.patch(t,n),n}function dj(e,t){const i={type:"inlineCode",value:JU(t)};return e.patch(t,i),i}function hj(e,t){const i=[],n=[],s=t||e.properties||{},o=mj(e),r=Math.min(Number.parseInt(String(s.size),10),0)||(s.multiple?4:1);let a=-1;for(;++a<o.length;){const e=o[a];e&&e.properties&&e.properties.selected&&i.push(e);}const l=i.length>0?i:o,c=Math.min(l.length,r);for(a=-1;++a<c;){const e=l[a],t=e.properties||{},i=JU(e),s=i||String(t.label||""),o=String(t.value||"")||i;n.push([o,s===o?void 0:s]);}return n}function mj(e){const t=[];let i=-1;for(;++i<e.children.length;){const n=e.children[i];"children"in n&&Array.isArray(n.children)&&t.push(...mj(n)),"element"!==n.type||"option"!==n.tagName||n.properties&&n.properties.disabled||t.push(n);}return t}const gj={}.hasOwnProperty;const fj=new Set(["pingback","prefetch","stylesheet"]);const pj=vU(["a","abbr","area","b","bdi","bdo","br","button","cite","code","data","datalist","del","dfn","em","i","input","ins","kbd","keygen","label","map","mark","meter","noscript","output","progress","q","ruby","s","samp","script","select","small","span","strong","sub","sup","template","textarea","time","u","var","wbr"]),bj=vU("meta");function wj(e){return Boolean("text"===e.type||pj(e)||CU(e)||function(e){if("element"!==e.type||"link"!==e.tagName)return  false;if(e.properties.itemProp)return  true;const t=e.properties.rel;let i=-1;if(!Array.isArray(t)||0===t.length)return  false;for(;++i<t.length;)if(!fj.has(String(t[i])))return  false;return  true}(e)||bj(e)&&function(e,t){const i="element"===e.type&&gj.call(e.properties,t)&&e.properties[t];return null!=i&&false!==i}(e,"itemProp"))}function vj(e,t){const{rest:i,checkbox:n}=yj(t),s=n?Boolean(n.properties.checked):null,o={type:"listItem",spread:_j(i),checked:s,children:e.toFlow(e.all(i))};return e.patch(t,o),o}function _j(e){let t=-1,i=false;for(;++t<e.children.length;){const n=e.children[t];if("element"===n.type){if(wj(n))continue;if("p"===n.tagName||i||_j(n))return  true;i=true;}}return  false}function yj(e){const t=e.children[0];if(t&&"element"===t.type&&"input"===t.tagName&&t.properties&&("checkbox"===t.properties.type||"radio"===t.properties.type)){return {checkbox:t,rest:{...e,children:e.children.slice(1)}}}if(t&&"element"===t.type&&"p"===t.tagName){const{checkbox:i,rest:n}=yj(t);if(i){return {checkbox:i,rest:{...e,children:[n,...e.children.slice(1)]}}}}return {checkbox:void 0,rest:e}}function kj(e,t){const i="ol"===t.tagName,n=e.toSpecificContent(e.all(t),Cj);let s=null;i&&(s=t.properties&&t.properties.start?Number.parseInt(String(t.properties.start),10):1);const o={type:"list",ordered:i,start:s,spread:sj(n),children:n};return e.patch(t,o),o}function Cj(){return {type:"listItem",spread:false,checked:null,children:[]}}function xj(e){let t=-1;for(;++t<e.length;){const i=e[t];if(!Sj(i)||"children"in i&&xj(i.children))return  true}return  false}function Aj(e){return Tj(e,function(e){return e.every(function(e){return "text"===e.type&&Rq(e.value)})?[]:[{type:"paragraph",children:lj(e)}]},function(e){return e})}function Ej(e){return Tj(e.children,function(t){const i=Ij(e);return i.children=t,[i]},function(t){if("children"in t&&"children"in e){const i=Ij(e),n=Ij(t);return i.children=t.children,n.children.push(i),n}return {...t}})}function Tj(e,t,i){const n=function(e){const t=[];let i=-1;for(;++i<e.length;){const n=e[i];"delete"!==n.type&&"link"!==n.type||!xj(n.children)?t.push(n):t.push(...Ej(n));}return t}(e),s=[];let o=[],r=-1;for(;++r<n.length;){const e=n[r];Sj(e)?o.push(e):(o.length>0&&(s.push(...t(o)),o=[]),s.push(i(e)));}return o.length>0&&(s.push(...t(o)),o=[]),s}function Sj(e){const t=e.data&&e.data.hName;return t?wj({type:"element",tagName:t,properties:{},children:[]}):eN(e)}function Ij(e){return aH({...e,children:[]})}function Pj(e,t){const i=t.properties||{},n="video"===t.tagName?String(i.poster||""):"";let s=String(i.src||""),o=-1,r=false,a=e.all(t);if(DF({type:"root",children:a},function(e){if("link"===e.type)return r=true,NM}),r||xj(a))return a;for(;!s&&++o<t.children.length;){const e=t.children[o];"element"===e.type&&"source"===e.tagName&&e.properties&&(s=String(e.properties.src||""));}if(n){const i={type:"image",title:null,url:e.resolve(n),alt:HF(a)};e.patch(t,i),a=[i];}const l=a,c={type:"link",title:i.title?String(i.title):null,url:e.resolve(s),children:l};return e.patch(t,c),c}function Vj(e,t){const i=lj(e.all(t));if(i.length>0){const n={type:"paragraph",children:i};return e.patch(t,n),n}}const Rj=['"'];function Oj(e,t){const i={type:"strong",children:e.all(t)};return e.patch(t,i),i}function Bj(e,t){const i={type:"tableCell",children:e.all(t)};if(e.patch(t,i),t.properties){const e=t.properties.rowSpan,n=t.properties.colSpan;if(e||n){const t=i.data||(i.data={});e&&(t.hastUtilToMdastTemporaryRowSpan=e),n&&(t.hastUtilToMdastTemporaryColSpan=n);}}return i}function Lj(){return {type:"tableCell",children:[]}}function Mj(){return {type:"tableCell",children:[]}}function Fj(){return {type:"tableRow",children:[]}}const Nj={comment:function(e,t){const i={type:"html",value:"\x3c!--"+t.value+"--\x3e"};return e.patch(t,i),i},doctype:qj,root:function(e,t){let i=e.all(t);(e.options.document||xj(i))&&(i=Aj(i));const n={type:"root",children:i};return e.patch(t,n),n},text:function(e,t){const i={type:"text",value:t.value};return e.patch(t,i),i}},Dj={applet:qj,area:qj,basefont:qj,bgsound:qj,caption:qj,col:qj,colgroup:qj,command:qj,content:qj,datalist:qj,dialog:qj,element:qj,embed:qj,frame:qj,frameset:qj,isindex:qj,keygen:qj,link:qj,math:qj,menu:qj,menuitem:qj,meta:qj,nextid:qj,noembed:qj,noframes:qj,optgroup:qj,option:qj,param:qj,script:qj,shadow:qj,source:qj,spacer:qj,style:qj,svg:qj,template:qj,title:qj,track:qj,abbr:zj,acronym:zj,bdi:zj,bdo:zj,big:zj,blink:zj,button:zj,canvas:zj,cite:zj,data:zj,details:zj,dfn:zj,font:zj,ins:zj,label:zj,map:zj,marquee:zj,meter:zj,nobr:zj,noscript:zj,object:zj,output:zj,progress:zj,rb:zj,rbc:zj,rp:zj,rt:zj,rtc:zj,ruby:zj,slot:zj,small:zj,span:zj,sup:zj,sub:zj,tbody:zj,tfoot:zj,thead:zj,time:zj,address:Hj,article:Hj,aside:Hj,body:Hj,center:Hj,div:Hj,fieldset:Hj,figcaption:Hj,figure:Hj,form:Hj,footer:Hj,header:Hj,hgroup:Hj,html:Hj,legend:Hj,main:Hj,multicol:Hj,nav:Hj,picture:Hj,section:Hj,a:function(e,t){const i=t.properties||{},n=e.all(t),s={type:"link",url:e.resolve(String(i.href||"")||null),title:i.title?String(i.title):null,children:n};return e.patch(t,s),s},audio:Pj,b:Oj,base:function(e,t){e.baseFound||(e.frozenBaseUrl=String(t.properties&&t.properties.href||"")||void 0,e.baseFound=true);},blockquote:function(e,t){const i={type:"blockquote",children:e.toFlow(e.all(t))};return e.patch(t,i),i},br:function(e,t){const i={type:"break"};return e.patch(t,i),i},code:dj,dir:kj,dl:function(e,t){const i=[],n=[];let s=-1;for(;++s<t.children.length;){const e=t.children[s];"element"===e.type&&"div"===e.tagName?i.push(...e.children):i.push(e);}let o={definitions:[],titles:[]};for(s=-1;++s<i.length;){const e=i[s];if("element"===e.type&&"dt"===e.tagName){const t=i[s-1];t&&"element"===t.type&&"dd"===t.tagName&&(n.push(o),o={definitions:[],titles:[]}),o.titles.push(e);}else o.definitions.push(e);}n.push(o),s=-1;const r=[];for(;++s<n.length;){const t=[...oj(e,n[s].titles),...oj(e,n[s].definitions)];t.length>0&&r.push({type:"listItem",spread:t.length>1,checked:null,children:t});}if(r.length>0){const i={type:"list",ordered:false,start:null,spread:sj(r),children:r};return e.patch(t,i),i}},dt:vj,dd:vj,del:nj,em:aj,h1:cj,h2:cj,h3:cj,h4:cj,h5:cj,h6:cj,hr:function(e,t){const i={type:"thematicBreak"};return e.patch(t,i),i},i:aj,iframe:function(e,t){const i=t.properties||{},n=String(i.src||""),s=String(i.title||"");if(n&&s){const i={type:"link",title:null,url:e.resolve(n),children:[{type:"text",value:s}]};return e.patch(t,i),i}},img:uj,image:uj,input:function(e,t){const i=t.properties||{},n=String(i.value||i.placeholder||"");if(i.disabled||"hidden"===i.type||"file"===i.type)return;if("checkbox"===i.type||"radio"===i.type){const n={type:"text",value:i.checked?e.options.checked||"[x]":e.options.unchecked||"[ ]"};return e.patch(t,n),n}if("image"===i.type){const s=i.alt||n;if(s){const n={type:"image",url:e.resolve(String(i.src||"")||null),title:String(i.title||"")||null,alt:String(s)};return e.patch(t,n),n}return}let s=[];if(n)s=[[n,void 0]];else if("button"!==i.type&&"file"!==i.type&&"password"!==i.type&&"reset"!==i.type&&"submit"!==i.type&&i.list){const t=String(i.list),n=e.elementById.get(t);n&&"datalist"===n.tagName&&(s=hj(n,i));}if(0===s.length)return;if("password"===i.type&&(s[0]=["•".repeat(s[0][0].length),void 0]),"email"===i.type||"url"===i.type){const t=[];let n=-1;for(;++n<s.length;){const o=e.resolve(s[n][0]),r={type:"link",title:null,url:"email"===i.type?"mailto:"+o:o,children:[{type:"text",value:s[n][1]||o}]};t.push(r),n!==s.length-1&&t.push({type:"text",value:", "});}return t}const o=[];let r=-1;for(;++r<s.length;)o.push(s[r][1]?s[r][1]+" ("+s[r][0]+")":s[r][0]);const a={type:"text",value:o.join(", ")};return e.patch(t,a),a},kbd:dj,li:vj,listing:ij,mark:aj,ol:kj,p:Vj,plaintext:ij,pre:ij,q:function(e,t){const i=e.options.quotes||Rj;e.qNesting++;const n=e.all(t);e.qNesting--;const s=i[e.qNesting%i.length],o=n[0],r=n[n.length-1],a=s.charAt(0),l=s.length>1?s.charAt(1):s;return o&&"text"===o.type?o.value=a+o.value:n.unshift({type:"text",value:a}),r&&"text"===r.type?r.value+=l:n.push({type:"text",value:l}),n},s:nj,samp:dj,select:function(e,t){const i=hj(t);let n=-1;const s=[];for(;++n<i.length;){const e=i[n];s.push(e[1]?e[1]+" ("+e[0]+")":e[0]);}if(s.length>0){const i={type:"text",value:s.join(", ")};return e.patch(t,i),i}},strike:nj,strong:Oj,summary:Vj,table:function(e,t){if(e.inTable){const i={type:"text",value:JU(t)};return e.patch(t,i),i}e.inTable=true;const{align:i,headless:n}=function(e){const t={align:[null],headless:true};let i=0,n=0;return DF(e,function(s){if("element"===s.type){if("table"===s.tagName&&e!==s)return DM;if("th"!==s.tagName&&"td"!==s.tagName||!s.properties)"thead"===s.tagName?t.headless=false:"tr"===s.tagName&&(i++,n=0);else {if(!t.align[n]){const e=String(s.properties.align||"")||null;"center"!==e&&"left"!==e&&"right"!==e&&null!==e||(t.align[n]=e);}t.headless&&i<2&&"th"===s.tagName&&(t.headless=false),n++;}}}),t}(t),s=e.toSpecificContent(e.all(t),Fj);n&&s.unshift({type:"tableRow",children:[]});let o=-1;for(;++o<s.length;){const t=s[o],i=e.toSpecificContent(t.children,Mj);t.children=i;}let r=1;for(o=-1;++o<s.length;){const e=s[o].children;let t=-1;for(;++t<e.length;){const i=e[t];if(i.data){const e=i.data,n=Number.parseInt(String(e.hastUtilToMdastTemporaryColSpan),10)||1,r=Number.parseInt(String(e.hastUtilToMdastTemporaryRowSpan),10)||1;if(n>1||r>1){let e=o-1;for(;++e<o+r;){let i=t-1;for(;++i<t+n&&s[e];){const n=[];e===o&&i===t||n.push({type:"tableCell",children:[]}),s[e].children.splice(i,0,...n);}}}"hastUtilToMdastTemporaryColSpan"in i.data&&delete i.data.hastUtilToMdastTemporaryColSpan,"hastUtilToMdastTemporaryRowSpan"in i.data&&delete i.data.hastUtilToMdastTemporaryRowSpan,0===Object.keys(i.data).length&&delete i.data;}}e.length>r&&(r=e.length);}for(o=-1;++o<s.length;){const e=s[o].children;let t=e.length-1;for(;++t<r;)e.push({type:"tableCell",children:[]});}let a=i.length-1;for(;++a<r;)i.push(null);e.inTable=false;const l={type:"table",align:i,children:s};return e.patch(t,l),l},td:Bj,textarea:function(e,t){const i={type:"text",value:JU(t)};return e.patch(t,i),i},th:Bj,tr:function(e,t){const i={type:"tableRow",children:e.toSpecificContent(e.all(t),Lj)};return e.patch(t,i),i},tt:dj,u:aj,ul:kj,var:dj,video:Pj,wbr:function(e,t){const i={type:"text",value:"​"};return e.patch(t,i),i},xmp:ij};function zj(e,t){return e.all(t)}function Hj(e,t){return e.toFlow(e.all(t))}function qj(){}const Uj={}.hasOwnProperty;function jj(e){const t=e.children||[],i=[];let n=-1;for(;++n<t.length;){const s=t[n],o=this.one(s,e);Array.isArray(o)?i.push(...o):o&&i.push(o);}return i}function $j(e,t){if("element"===e.type){if(e.properties&&"ignore"===e.properties.dataMdast)return;if(Uj.call(this.handlers,e.tagName))return this.handlers[e.tagName](this,e,t)||void 0}else if(Uj.call(this.nodeHandlers,e.type))return this.nodeHandlers[e.type](this,e,t)||void 0;if("value"in e&&"string"==typeof e.value){const t={type:"text",value:e.value};return this.patch(e,t),t}if("children"in e)return this.all(e)}function Wj(e,t){e.position&&(t.position=Kz(e));}function Gj(e){const t=this.frozenBaseUrl;return null==e?"":t?String(new URL(e,t)):e}function Kj(e){return Aj(e)}function Jj(e,t){const i=t(),n=[];let s=[],o=-1;for(;++o<e.length;){const t=e[o];if(r(t))s.length>0&&(t.children.unshift(...s),s=[]),n.push(t);else {const e=t;s.push(e);}}if(s.length>0){let e=n[n.length-1];e||(e=t(),n.push(e)),e.children.push(...s),s=[];}return n;function r(e){return e.type===i.type}}const Qj={};function Yj(e,t){const i=aH(e),n=t||Qj,s=DU({newlines:true===n.newlines}),o=function(e){return {all:jj,baseFound:false,elementById:new Map,frozenBaseUrl:void 0,handlers:{...Dj,...e.handlers},inTable:false,nodeHandlers:{...Nj,...e.nodeHandlers},one:$j,options:e,patch:Wj,qNesting:0,resolve:Gj,toFlow:Kj,toSpecificContent:Jj}}(n);let r;s(i),DF(i,function(e){if(e&&"element"===e.type&&e.properties){const t=String(e.properties.id||"")||void 0;t&&!o.elementById.has(t)&&o.elementById.set(t,e);}});const a=o.one(i,void 0);if(a)if(Array.isArray(a)){r={type:"root",children:a};}else r=a;else r={type:"root",children:[]};return DF(r,function(e,t,i){if("text"===e.type&&void 0!==t&&i){const n=i.children[t-1];if(n&&n.type===e.type)return n.value+=e.value,i.children.splice(t,1),n.position&&e.position&&(n.position.end=e.position.end),t-1;if(e.value=e.value.replace(/[\t ]*(\r?\n|\r)[\t ]*/,"$1"),!i||"heading"!==i.type&&"paragraph"!==i.type&&"root"!==i.type||(t||(e.value=e.value.replace(/^[\t ]+/,"")),t===i.children.length-1&&(e.value=e.value.replace(/[\t ]+$/,""))),!e.value)return i.children.splice(t,1),t}}),r}const Zj={document:true};function Xj(e,t){return e&&"run"in e?async function(i,n){const s=Yj(i,{...Zj,...t});await e.run(s,n);}:function(t){return Yj(t,{...Zj,...e})}}function e$(e){const t=this;t.compiler=function(i){return _N(i,{...t.data("settings"),...e,extensions:t.data("toMarkdownExtensions")||[]})};}class t${_processor;_keepRawTags=[];constructor(){this._buildProcessor();}keep(e){this._keepRawTags.push(e.toLowerCase()),this._buildProcessor();}parse(e){return this._processor.processSync(e).toString().trim()}_getRawTagsHandlers(){return this._keepRawTags.reduce((e,t)=>(e[t]=(e,t)=>{const i=Xq(aU(t.tagName,t.properties),{allowDangerousHtml:true,closeSelfClosing:true}),n=i.indexOf(">"),s=i.slice(0,n+1),o=i.slice(n+1);return [{type:"html",value:s},...e.all(t),{type:"html",value:o}]},e),{})}_buildProcessor(){this._processor=hM().use(fU).use(i$).use(Xj,{handlers:this._getRawTagsHandlers()}).use(pz,{singleTilde:true}).use(vH).use(e$,{resourceLink:true,emphasis:"_",rule:"-",handlers:{break:()=>"\n"},unsafe:[{character:"<"}]});}}function i$(){return function(e){DF(e,"element",(e,t,i)=>{null!==t&&"label"===e.tagName&&"element"===i.type&&"li"===i.tagName&&i.children.splice(t,1,...e.children);});}}class n${_htmlDP;_markdown2html;_html2markdown;constructor(e){this._htmlDP=new Hl(e),this._markdown2html=new gU,this._html2markdown=new t$;}keepHtml(e){this._html2markdown.keep(e);}toView(e){const t=this._markdown2html.parse(e);return this._htmlDP.toView(t)}toData(e){const t=this._htmlDP.toData(e);return this._html2markdown.parse(t)}registerRawContentMatcher(e){this._htmlDP.registerRawContentMatcher(e);}useFillerType(){}}class s$ extends Ms{constructor(e){super(e),e.data.processor=new n$(e.data.viewDocument);}static get pluginName(){return "Markdown"}static get isOfficialPlugin(){return  true}}const o$=["SPAN","BR","PRE","CODE"];class r$ extends Ms{_gfmDataProcessor;constructor(e){super(e),this._gfmDataProcessor=new n$(e.data.viewDocument);}static get pluginName(){return "PasteFromMarkdownExperimental"}static get isOfficialPlugin(){return  true}static get requires(){return [tx]}init(){const e=this.editor,t=e.editing.view.document,i=e.plugins.get("ClipboardPipeline");let n=false;this.listenTo(t,"keydown",(e,t)=>{n=t.shiftKey;}),this.listenTo(i,"inputTransformation",(e,t)=>{if(n)return;const i=t.dataTransfer.getData("text/html");if(!i){const e=t.dataTransfer.getData("text/plain");return void(t.content=this._gfmDataProcessor.toView(e))}const s=this._parseMarkdownFromHtml(i);s&&(t.content=this._gfmDataProcessor.toView(s));});}_parseMarkdownFromHtml(e){const t=this._removeOsSpecificTags(e);if(!this._containsOnlyAllowedFirstLevelTags(t))return null;const i=this._removeFirstLevelWrapperTagsAndBrs(t);return this._containsAnyRemainingHtmlTags(i)?null:this._replaceHtmlReservedEntitiesWithCharacters(i)}_removeOsSpecificTags(e){return e.replace(/^<meta\b[^>]*>/,"").trim().replace(/^<html>/,"").replace(/<\/html>$/,"").trim().replace(/^<body>/,"").replace(/<\/body>$/,"").trim().replace(/^<!--StartFragment-->/,"").replace(/<!--EndFragment-->$/,"").trim()}_containsOnlyAllowedFirstLevelTags(e){const t=new DOMParser,{body:i}=t.parseFromString(e,"text/html");return Array.from(i.children).map(e=>e.tagName).every(e=>o$.includes(e))}_removeFirstLevelWrapperTagsAndBrs(e){const t=new DOMParser,{body:i}=t.parseFromString(e,"text/html"),n=i.querySelectorAll("br");for(const e of n)e.replaceWith("\n");const s=i.querySelectorAll(":scope > *");for(const e of s){const t=e.cloneNode(true);e.replaceWith(...t.childNodes);}return i.innerHTML}_containsAnyRemainingHtmlTags(e){return e.includes("<")}_replaceHtmlReservedEntitiesWithCharacters(e){return e.replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&nbsp;/g," ")}}function a$(e,t){const i=(i,n,s)=>{if(!s.consumable.consume(n.item,i.name))return;const o=n.attributeNewValue,r=s.writer,a=s.mapper.toViewElement(n.item),l=[...a.getChildren()].find(e=>e.getCustomProperty("media-content"));r.remove(l);const c=e.getMediaViewElement(r,o,t);r.insert(r.createPositionAt(a,0),c);};return e=>{e.on("attribute:url:media",i);}}function l$(e,t,i){return t.setCustomProperty("media",true,e),Yk(e,t,{label:i})}function c$(e){const t=e.getSelectedElement();return t&&u$(t)?t:null}function u$(e){return !!e.getCustomProperty("media")&&Qk(e)}function d$(e,t,i,n){return e.createContainerElement("figure",{class:"media"},[t.getMediaViewElement(e,i,n),e.createSlot()])}function h$(e){const t=e.getSelectedElement();return t&&t.is("element","media")?t:null}function m$(e,t,i,n){e.change(s=>{const o=s.createElement("media",{url:t});e.insertObject(o,i,null,{setSelection:"on",findOptimalPosition:n?"auto":void 0});});}class g$ extends Ns{refresh(){const e=this.editor.model,t=e.document.selection,i=h$(t);this.value=i?i.getAttribute("url"):void 0,this.isEnabled=function(e){const t=e.getSelectedElement();return !!t&&"media"===t.name}(t)||function(e,t){const i=sC(e,t);let n=i.start.parent;n.isEmpty&&!t.schema.isLimit(n)&&(n=n.parent);return t.schema.checkChild(n,"media")}(t,e);}execute(e){const t=this.editor.model,i=t.document.selection,n=h$(i);n?t.change(t=>{t.setAttribute("url",e,n);}):m$(t,e,i,true);}}class f${locale;providerDefinitions;constructor(e,t){const i=t.providers,n=t.extraProviders||[],s=new Set(t.removeProviders),o=i.concat(n).filter(e=>{const t=e.name;return t?!s.has(t):(P("media-embed-no-provider-name",{provider:e}),false)});this.locale=e,this.providerDefinitions=o;}hasMedia(e){return !!this._getMedia(e)}getMediaViewElement(e,t,i){return this._getMedia(t).getViewElement(e,i)}_getMedia(e){if(!e)return new p$(this.locale);e=e.trim();for(const t of this.providerDefinitions){const i=t.html,n=pn(t.url);for(const t of n){const n=this._getUrlMatches(e,t);if(n)return new p$(this.locale,e,n,i)}}return null}_getUrlMatches(e,t){let i=e.match(t);if(i)return i;let n=e.replace(/^https?:\/\//,"");return i=n.match(t),i||(n=n.replace(/^www\./,""),i=n.match(t),i||null)}}class p${url;_locale;_match;_previewRenderer;constructor(e,t,i,n){this.url=this._getValidUrl(t),this._locale=e,this._match=i,this._previewRenderer=n;}getViewElement(e,t){const i={};let n;if(t.renderForEditingView||t.renderMediaPreview&&this.url&&this._previewRenderer){this.url&&(i["data-oembed-url"]=this.url),t.renderForEditingView&&(i.class="ck-media__wrapper");const s=this._getPreviewHtml(t);n=e.createRawElement("div",i,(e,t)=>{t.setContentOf(e,s);});}else this.url&&(i.url=this.url),n=e.createEmptyElement(t.elementName,i);return e.setCustomProperty("media-content",true,n),n}_getPreviewHtml(e){return this._previewRenderer?this._previewRenderer(this._match):this.url&&e.renderForEditingView?this._getPlaceholderHtml():""}_getPlaceholderHtml(){const e=new Rp,t=this._locale.t;e.content=Kg,e.viewBox="0 0 64 42";return new es({tag:"div",attributes:{class:"ck ck-reset_all ck-media__placeholder"},children:[{tag:"div",attributes:{class:"ck-media__placeholder__icon"},children:[e]},{tag:"a",attributes:{class:"ck-media__placeholder__url",target:"_blank",rel:"noopener noreferrer",href:this.url,"data-cke-tooltip-text":t("Open media in new tab")},children:[{tag:"span",attributes:{class:"ck-media__placeholder__url__text"},children:[this.url]}]}]}).render().outerHTML}_getValidUrl(e){return e?e.match(/^https?/)?e:"https://"+e:null}}class b$ extends Ms{static get pluginName(){return "MediaEmbedEditing"}static get isOfficialPlugin(){return  true}registry;constructor(e){super(e),e.config.define("mediaEmbed",{elementName:"oembed",providers:[{name:"dailymotion",url:[/^dailymotion\.com\/video\/(\w+)/,/^dai.ly\/(\w+)/],html:e=>`<div style="position: relative; padding-bottom: 100%; height: 0; "><iframe src="https://www.dailymotion.com/embed/video/${e[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" width="480" height="270" allowfullscreen allow="autoplay"></iframe></div>`},{name:"spotify",url:[/^open\.spotify\.com\/(artist\/\w+)/,/^open\.spotify\.com\/(album\/\w+)/,/^open\.spotify\.com\/(track\/\w+)/],html:e=>`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 126%;"><iframe src="https://open.spotify.com/embed/${e[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe></div>`},{name:"youtube",url:[/^(?:m\.)?youtube\.com\/watch\?v=([\w-]+)(?:&t=(\d+))?/,/^(?:m\.)?youtube\.com\/shorts\/([\w-]+)(?:\?t=(\d+))?/,/^(?:m\.)?youtube\.com\/v\/([\w-]+)(?:\?t=(\d+))?/,/^youtube\.com\/embed\/([\w-]+)(?:\?start=(\d+))?/,/^youtu\.be\/([\w-]+)(?:\?t=(\d+))?/],html:e=>{const t=e[1],i=e[2];return `<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;"><iframe src="https://www.youtube.com/embed/${t}${i?`?start=${i}`:""}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" allow="autoplay; encrypted-media" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></div>`}},{name:"vimeo",url:[/^vimeo\.com\/(\d+)/,/^vimeo\.com\/[^/]+\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/album\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/channels\/[^/]+\/(\d+)/,/^vimeo\.com\/groups\/[^/]+\/videos\/(\d+)/,/^vimeo\.com\/ondemand\/[^/]+\/(\d+)/,/^player\.vimeo\.com\/video\/(\d+)/],html:e=>`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;"><iframe src="https://player.vimeo.com/video/${e[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>`},{name:"instagram",url:[/^instagram\.com\/p\/(\w+)/,/^instagram\.com\/reel\/(\w+)/]},{name:"twitter",url:[/^twitter\.com/,/^x\.com/]},{name:"googleMaps",url:[/^google\.com\/maps/,/^goo\.gl\/maps/,/^maps\.google\.com/,/^maps\.app\.goo\.gl/]},{name:"flickr",url:/^flickr\.com/},{name:"facebook",url:/^facebook\.com/}]}),this.registry=new f$(e.locale,e.config.get("mediaEmbed"));}init(){const e=this.editor,t=e.model.schema,i=e.t,n=e.conversion,s=e.config.get("mediaEmbed.previewsInData"),o=e.config.get("mediaEmbed.elementName"),r=this.registry;e.commands.add("mediaEmbed",new g$(e)),t.register("media",{inheritAllFrom:"$blockObject",allowAttributes:["url"]}),n.for("dataDowncast").elementToStructure({model:"media",view:(e,{writer:t})=>{const i=e.getAttribute("url");return d$(t,r,i,{elementName:o,renderMediaPreview:!!i&&s})}}),n.for("dataDowncast").add(a$(r,{elementName:o,renderMediaPreview:s})),n.for("editingDowncast").elementToStructure({model:"media",view:(e,{writer:t})=>{const n=e.getAttribute("url");return l$(d$(t,r,n,{elementName:o,renderForEditingView:true}),t,i("media widget"))}}),n.for("editingDowncast").add(a$(r,{elementName:o,renderForEditingView:true})),n.for("upcast").elementToElement({view:e=>["oembed",o].includes(e.name)&&e.getAttribute("url")?{name:true}:null,model:(e,{writer:t})=>{const i=e.getAttribute("url");return r.hasMedia(i)?t.createElement("media",{url:i}):null}}).elementToElement({view:{name:"div",attributes:{"data-oembed-url":true}},model:(e,{writer:t})=>{const i=e.getAttribute("data-oembed-url");return r.hasMedia(i)?t.createElement("media",{url:i}):null}}).add(e=>{e.on("element:figure",(e,t,i)=>{if(!i.consumable.consume(t.viewItem,{name:true,classes:"media"}))return;const{modelRange:n,modelCursor:s}=i.convertChildren(t.viewItem,t.modelCursor);t.modelRange=n,t.modelCursor=s;Cn(n.getItems())||i.consumable.revert(t.viewItem,{name:true,classes:"media"});});});}}const w$=/^(?:http(s)?:\/\/)?[\w-]+\.[\w-.~:/?#[\]@!$&'()*+,;=%]+$/;class v$ extends Ms{static get requires(){return [px,py,lA]}static get pluginName(){return "AutoMediaEmbed"}static get isOfficialPlugin(){return  true}_timeoutId;_positionToInsert;constructor(e){super(e),this._timeoutId=null,this._positionToInsert=null;}init(){const t=this.editor,i=t.model.document,n=t.plugins.get("ClipboardPipeline");this.listenTo(n,"inputTransformation",()=>{const e=i.selection.getFirstRange(),t=Ec.fromPosition(e.start);t.stickiness="toPrevious";const n=Ec.fromPosition(e.end);n.stickiness="toNext",i.once("change:data",()=>{this._embedMediaBetweenPositions(t,n),t.detach(),n.detach();},{priority:"high"});});t.commands.get("undo").on("execute",()=>{this._timeoutId&&(exports.global.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null);},{priority:"high"});}_embedMediaBetweenPositions(t,i){const n=this.editor,s=n.plugins.get(b$).registry,o=new Sa(t,i),r=o.getWalker({ignoreElementEnd:true});let a="";for(const e of r)e.item.is("$textProxy")&&(a+=e.item.data);if(a=a.trim(),!a.match(w$))return void o.detach();if(!s.hasMedia(a))return void o.detach();n.commands.get("mediaEmbed").isEnabled?(this._positionToInsert=Ec.fromPosition(t),this._timeoutId=exports.global.window.setTimeout(()=>{n.model.change(e=>{this._timeoutId=null,e.remove(o),o.detach();let t=null;"$graveyard"!==this._positionToInsert.root.rootName&&(t=this._positionToInsert),m$(n.model,a,t,false),this._positionToInsert.detach(),this._positionToInsert=null;}),n.plugins.get(py).requestUndoOnBackspace();},100)):o.detach();}}class _$ extends Cs{focusTracker;keystrokes;urlInputView;_validators;_urlInputViewInfoDefault;_urlInputViewInfoTip;constructor(e,t){super(t),this.focusTracker=new An,this.keystrokes=new In,this.set("mediaURLInputValue",""),this.urlInputView=this._createUrlInput(),this._validators=e,this.setTemplate({tag:"form",attributes:{class:["ck","ck-media-form","ck-responsive-form"],tabindex:"-1"},children:[this.urlInputView]});}render(){super.render(),Vs({view:this}),this.focusTracker.add(this.urlInputView.element),this.keystrokes.listenTo(this.element);}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy();}focus(){this.urlInputView.focus();}get url(){return this.urlInputView.fieldView.element.value.trim()}set url(e){this.urlInputView.fieldView.value=e.trim();}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.urlInputView.errorText=t,false}return  true}resetFormStatus(){this.urlInputView.errorText=null,this.urlInputView.infoText=this._urlInputViewInfoDefault;}_createUrlInput(){const e=this.locale.t,t=new Nb(this.locale,Sw),i=t.fieldView;return this._urlInputViewInfoDefault=e("Paste the media URL in the input."),this._urlInputViewInfoTip=e("Tip: Paste the URL into the content to embed faster."),t.label=e("Media URL"),t.infoText=this._urlInputViewInfoDefault,i.inputMode="url",i.on("input",()=>{t.infoText=i.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault,this.mediaURLInputValue=i.element.value.trim();}),t}}class y$ extends Ms{static get requires(){return [b$,Wp]}static get pluginName(){return "MediaEmbedUI"}static get isOfficialPlugin(){return  true}_formView;init(){const e=this.editor;e.ui.componentFactory.add("mediaEmbed",()=>{const e=this.editor.locale.t,t=this._createDialogButton(Bp);return t.tooltip=true,t.label=e("Insert media"),t}),e.ui.componentFactory.add("menuBar:mediaEmbed",()=>{const e=this.editor.locale.t,t=this._createDialogButton(Jp);return t.label=e("Media"),t});}_createDialogButton(e){const t=this.editor,i=new e(t.locale),n=t.commands.get("mediaEmbed"),s=this.editor.plugins.get("Dialog");return i.icon=Jg,i.bind("isEnabled").to(n,"isEnabled"),i.on("execute",()=>{"mediaEmbed"===s.id?s.hide():this._showDialog();}),i}_showDialog(){const e=this.editor,t=e.plugins.get("Dialog"),i=e.commands.get("mediaEmbed"),n=e.locale.t,s=void 0!==i.value;if(!this._formView){const t=e.plugins.get(b$).registry;this._formView=new(Is(_$))(function(e,t){return [t=>{if(!t.url.length)return e("The URL must not be empty.")},i=>{if(!t.hasMedia(i.url))return e("This media URL is not supported.")}]}(e.t,t),e.locale),this._formView.on("submit",()=>this._handleSubmitForm());}t.show({id:"mediaEmbed",title:n("Media embed"),content:this._formView,isModal:true,onShow:()=>{this._formView.url=i.value||"",this._formView.resetFormStatus(),this._formView.urlInputView.fieldView.select();},actionButtons:[{label:n("Cancel"),withText:true,onExecute:()=>t.hide()},{label:n(s?"Save":"Insert"),class:"ck-button-action",withText:true,onExecute:()=>this._handleSubmitForm()}]});}_handleSubmitForm(){const e=this.editor,t=e.plugins.get("Dialog");this._formView.isValid()&&(e.execute("mediaEmbed",this._formView.url),t.hide(),e.editing.view.focus());}}class k$ extends Ms{static get requires(){return [b$,y$,v$,kC]}static get pluginName(){return "MediaEmbed"}static get isOfficialPlugin(){return  true}}class C$ extends Ms{static get requires(){return [xC]}static get pluginName(){return "MediaEmbedToolbar"}static get isOfficialPlugin(){return  true}afterInit(){const e=this.editor,t=e.t;e.plugins.get(xC).register("mediaEmbed",{ariaLabel:t("Media toolbar"),items:e.config.get("mediaEmbed.toolbar")||[],getRelatedElement:c$});}}const x$=Ri("px");class A$ extends Qv{_options;constructor(e,t){super(e);const i=this.bindTemplate;this.set("top",0),this.set("height",0),this._options=t,this.extendTemplate({attributes:{tabindex:-1,"aria-hidden":"true",class:["ck-minimap__iframe"],style:{top:i.to("top",e=>x$(e)),height:i.to("height",e=>x$(e))}}});}render(){return super.render().then(()=>{this._prepareDocument();})}setHeight(e){this.height=e;}setTopOffset(e){this.top=e;}_prepareDocument(){const e=this.element.contentWindow.document,t=e.adoptNode(this._options.domRootClone),i=this._options.useSimplePreview?"\n\t\t\t.ck.ck-editor__editable_inline img {\n\t\t\t\tfilter: contrast( 0 );\n\t\t\t}\n\n\t\t\tp, li, a, figcaption, span {\n\t\t\t\tbackground: hsl(0, 0%, 80%) !important;\n\t\t\t\tcolor: hsl(0, 0%, 80%) !important;\n\t\t\t}\n\n\t\t\th1, h2, h3, h4 {\n\t\t\t\tbackground: hsl(0, 0%, 60%) !important;\n\t\t\t\tcolor: hsl(0, 0%, 60%) !important;\n\t\t\t}\n\t\t":"",n=this._options.pageStyles.map(e=>"string"==typeof e?`<style>${e}</style>`:`<link rel="stylesheet" type="text/css" href="${e.href}">`).join("\n"),s=`<!DOCTYPE html><html lang="en">\n\t\t\t<head>\n\t\t\t\t<meta charset="utf-8">\n\t\t\t\t<meta name="viewport" content="width=device-width, initial-scale=1">\n\t\t\t\t${n}\n\t\t\t\t<style>\n\t\t\t\t\thtml, body {\n\t\t\t\t\t\tmargin: 0 !important;\n\t\t\t\t\t\tpadding: 0 !important;\n\t\t\t\t\t}\n\n\t\t\t\t\thtml {\n\t\t\t\t\t\toverflow: hidden;\n\t\t\t\t\t}\n\n\t\t\t\t\tbody {\n\t\t\t\t\t\ttransform: scale( ${this._options.scaleRatio} );\n\t\t\t\t\t\ttransform-origin: 0 0;\n\t\t\t\t\t\toverflow: visible;\n\t\t\t\t\t}\n\n\t\t\t\t\t.ck.ck-editor__editable_inline {\n\t\t\t\t\t\tmargin: 0 !important;\n\t\t\t\t\t\tborder-color: transparent !important;\n\t\t\t\t\t\toutline-color: transparent !important;\n\t\t\t\t\t\tbox-shadow: none !important;\n\t\t\t\t\t}\n\n\t\t\t\t\t.ck.ck-content {\n\t\t\t\t\t\tbackground: white;\n\t\t\t\t\t}\n\n\t\t\t\t\t${i}\n\t\t\t\t</style>\n\t\t\t</head>\n\t\t\t<body class="${this._options.extraClasses||""}"></body>\n\t\t</html>`;e.open(),e.write(s),e.close(),e.body.appendChild(t);}}const E$=Ri("px");class T$ extends Cs{constructor(e){super(e);const t=this.bindTemplate;this.set("height",0),this.set("top",0),this.set("scrollProgress",0),this.set("_isDragging",false),this.setTemplate({tag:"div",attributes:{class:["ck","ck-minimap__position-tracker",t.if("_isDragging","ck-minimap__position-tracker_dragging")],style:{top:t.to("top",e=>E$(e)),height:t.to("height",e=>E$(e))},"data-progress":t.to("scrollProgress")},on:{mousedown:t.to(()=>{this._isDragging=true;})}});}render(){super.render(),this.listenTo(exports.global.document,"mousemove",(e,t)=>{this._isDragging&&this.fire("drag",t.movementY);},{useCapture:true}),this.listenTo(exports.global.document,"mouseup",()=>{this._isDragging=false;},{useCapture:true});}setHeight(e){this.height=e;}setTopOffset(e){this.top=e;}setScrollProgress(e){this.scrollProgress=e;}}class S$ extends Cs{_positionTrackerView;_scaleRatio;_minimapIframeView;constructor({locale:e,scaleRatio:t,pageStyles:i,extraClasses:n,useSimplePreview:s,domRootClone:o}){super(e);const r=this.bindTemplate;this._positionTrackerView=new T$(e),this._positionTrackerView.delegate("drag").to(this),this._scaleRatio=t,this._minimapIframeView=new A$(e,{useSimplePreview:s,pageStyles:i,extraClasses:n,scaleRatio:t,domRootClone:o}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-minimap"]},children:[this._positionTrackerView],on:{click:r.to(this._handleMinimapClick.bind(this)),wheel:r.to(this._handleMinimapMouseWheel.bind(this))}});}destroy(){this._minimapIframeView.destroy(),super.destroy();}get height(){return new Ci(this.element).height}get scrollHeight(){return Math.max(0,Math.min(this.height,this._minimapIframeView.height)-this._positionTrackerView.height)}render(){super.render(),this._minimapIframeView.render(),this.element.appendChild(this._minimapIframeView.element);}setContentHeight(e){this._minimapIframeView.setHeight(e*this._scaleRatio);}setScrollProgress(e){const t=this._minimapIframeView,i=this._positionTrackerView;if(t.height<this.height)t.setTopOffset(0),i.setTopOffset((t.height-i.height)*e);else {const n=t.height-this.height;t.setTopOffset(-n*e),i.setTopOffset((this.height-i.height)*e);}i.setScrollProgress(Math.round(100*e));}setPositionTrackerHeight(e){this._positionTrackerView.setHeight(e*this._scaleRatio);}_handleMinimapClick(e){const t=this._positionTrackerView;if(e.target===t.element)return;const i=new Ci(t.element),n=(e.clientY-i.top-i.height/2)/this._minimapIframeView.height;this.fire("click",n);}_handleMinimapMouseWheel(e){this.fire("drag",e.deltaY*this._scaleRatio);}}function I$(e,t){const i=e.editing.view.document,n=i.getRoot(t),s=new Rr(i),o=new kr(s,i.selection),r=e.editing.view.getDomRoot().cloneNode();return s.bindElements(r,n),o.markToSync("children",n),o.markToSync("attributes",n),n.on("change:children",(e,t)=>o.markToSync("children",t)),n.on("change:attributes",(e,t)=>o.markToSync("attributes",t)),n.on("change:text",(e,t)=>o.markToSync("text",t)),o.render(),e.editing.view.on("render",()=>o.render()),e.on("destroy",()=>{s.unbindDomElement(r);}),r}function P$(){return Array.from(exports.global.document.styleSheets).map(t=>t.href&&!t.href.startsWith(exports.global.window.location.origin)?{href:t.href}:Array.from(t.cssRules).filter(e=>!(e instanceof CSSMediaRule)).map(e=>e.cssText).join(" \n"))}function V$(t){return new Ci(t===exports.global.document.body?exports.global.window:t)}function R$(t){return t===exports.global.document.body?exports.global.window.innerHeight:t.clientHeight}function O$(t){return t===exports.global.document.body?exports.global.window:t}class B$ extends Ms{static get pluginName(){return "Minimap"}static get isOfficialPlugin(){return  true}_minimapView;_scrollableRootAncestor;_editingRootElement;init(){const e=this.editor;this._minimapView=null,this._scrollableRootAncestor=null,this.listenTo(e.ui,"ready",this._onUiReady.bind(this));}destroy(){super.destroy(),this._minimapView.destroy(),this._minimapView.element.remove();}_onUiReady(){const e=this.editor,t=this._editingRootElement=e.ui.getEditableElement();this._scrollableRootAncestor=hi(t),t.ownerDocument.body.contains(t)?(this._initializeMinimapView(),this.listenTo(e.editing.view,"render",()=>{"ready"===e.state&&this._syncMinimapToEditingRootScrollPosition();}),this._syncMinimapToEditingRootScrollPosition()):e.ui.once("update",this._onUiReady.bind(this));}_initializeMinimapView(){const t=this.editor,i=t.locale,n=t.config.get("minimap.useSimplePreview"),s=t.config.get("minimap.container"),o=this._scrollableRootAncestor,r=V$(this._editingRootElement).width,a=V$(s).width/r,l=this._minimapView=new S$({locale:i,scaleRatio:a,pageStyles:P$(),extraClasses:t.config.get("minimap.extraClasses"),useSimplePreview:n,domRootClone:I$(t)});l.render(),l.listenTo(exports.global.document,"scroll",(t,i)=>{if(o===exports.global.document.body){if(i.target!==exports.global.document)return}else if(i.target!==o)return;this._syncMinimapToEditingRootScrollPosition();},{useCapture:true,usePassive:true}),l.listenTo(exports.global.window,"resize",()=>{this._syncMinimapToEditingRootScrollPosition();}),l.on("drag",(e,t)=>{let i;i=0===l.scrollHeight?0:t/l.scrollHeight;const n=i*(o.scrollHeight-R$(o));O$(o).scrollBy(0,Math.round(n));}),l.on("click",(e,t)=>{const i=t*o.scrollHeight;O$(o).scrollBy(0,Math.round(i));}),s.appendChild(l.element);}_syncMinimapToEditingRootScrollPosition(){const e=this._editingRootElement,t=this._minimapView;t.setContentHeight(e.offsetHeight);const i=V$(e),n=V$(this._scrollableRootAncestor);let s;n.getIntersection(i)&&(n.contains(i)||i.top>n.top?s=0:(s=(i.top-n.top)/(n.height-i.height),s=Math.max(0,Math.min(s,1))),t.setPositionTrackerHeight(n.getIntersection(i).height),t.setScrollProgress(s));}}class L$ extends Ns{refresh(){const e=this.editor.model,t=e.schema,i=e.document.selection;this.isEnabled=function(e,t,i){const n=function(e,t){const i=sC(e,t),n=i.start.parent;if(n.isEmpty&&!n.is("element","$root"))return n.parent;return n}(e,i);return t.checkChild(n,"pageBreak")}(i,t,e);}execute(){const e=this.editor.model;e.change(t=>{const i=t.createElement("pageBreak");e.insertObject(i,null,null,{setSelection:"after"});});}}class M$ extends Ms{static get pluginName(){return "PageBreakEditing"}static get licenseFeatureCode(){return "PB"}static get isOfficialPlugin(){return  true}static get isPremiumPlugin(){return  true}init(){const e=this.editor,t=e.model.schema,i=e.t,n=e.conversion;t.register("pageBreak",{inheritAllFrom:"$blockObject"}),n.for("dataDowncast").elementToStructure({model:"pageBreak",view:(e,{writer:t})=>t.createContainerElement("div",{class:"page-break",style:"page-break-after: always"},t.createContainerElement("span",{style:"display: none"}))}),n.for("editingDowncast").elementToStructure({model:"pageBreak",view:(e,{writer:t})=>{const n=i("Page break"),s=t.createContainerElement("div"),o=t.createRawElement("span",{class:"page-break__label"},function(e){e.innerText=i("Page break");});return t.addClass("page-break",s),t.insert(t.createPositionAt(s,0),o),function(e,t,i){return t.setCustomProperty("pageBreak",true,e),Yk(e,t,{label:i})}(s,t,n)}}),n.for("upcast").elementToElement({view:e=>{const t="always"==e.getStyle("page-break-before"),i="always"==e.getStyle("page-break-after");if(!t&&!i)return null;if(1==e.childCount){const t=e.getChild(0);if(!t.is("element","span")||"none"!=t.getStyle("display"))return null}else if(e.childCount>1)return null;return {name:true,styles:[...t?["page-break-before"]:[],...i?["page-break-after"]:[]],...e.hasClass("page-break")&&{classes:["page-break"]}}},model:"pageBreak",converterPriority:"high"}),e.commands.add("pageBreak",new L$(e));}}class F$ extends Ms{static get pluginName(){return "PageBreakUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor;e.ui.componentFactory.add("pageBreak",()=>{const e=this._createButton(Bp);return e.set({tooltip:true}),e}),e.ui.componentFactory.add("menuBar:pageBreak",()=>this._createButton(Jp));}_createButton(e){const t=this.editor,i=t.locale,n=t.commands.get("pageBreak"),s=new e(t.locale),o=i.t;return s.set({label:o("Page break"),icon:bf}),s.bind("isEnabled").to(n,"isEnabled"),this.listenTo(s,"execute",()=>{t.execute("pageBreak"),t.editing.view.focus();}),s}}class N$ extends Ms{static get requires(){return [M$,F$,kC]}static get pluginName(){return "PageBreak"}static get isOfficialPlugin(){return  true}}function D$(e,t){const i=[];for(const n of t.createRangeIn(e)){const e=n.item;e.is("element","a")&&!e.hasAttribute("href")&&(e.hasAttribute("id")||e.hasAttribute("name"))&&i.push(e);}for(const e of i){const i=e.parent.getChildIndex(e)+1,n=e.getChildren();t.insertChild(i,n,e.parent);}}function z$(e){const t=parseFloat(e);return e.endsWith("pt")?q$(96*t/72):e.endsWith("pc")?q$(12*t*96/72):e.endsWith("in")?q$(96*t):e.endsWith("cm")?q$(96*t/2.54):e.endsWith("mm")?q$(t/10*96/2.54):e}function H$(e){return void 0!==e&&e.endsWith("px")}function q$(e){return Math.round(e)+"px"}function U$(e,t,i){if(!e.childCount)return;const n=new Cu(e.document),s=function(e,t){const i=t.createRangeIn(e),n=[],s=new Set;for(const e of i.getItems()){if(!e.is("element")||!e.name.match(/^(p|h\d+|li|div)$/))continue;let t=tW(e);if(void 0===t||0!=parseFloat(t)||Array.from(e.getClassNames()).find(e=>e.startsWith("MsoList"))||(t=void 0),e.hasStyle("mso-list")&&"none"!==e.getStyle("mso-list")||void 0!==t&&s.has(t)){const i=X$(e);n.push({element:e,id:i.id,order:i.order,indent:i.indent,marginLeft:t}),void 0!==t&&s.add(t);}else s.clear();}return n}(e,n);if(!s.length)return;const o={},r=[];let a=$$();for(const e of s)if(void 0!==e.indent){K$(e)||(W$(n,r,a),a=$$(),r.length=0);const s=`${e.id}:${e.indent}`,l=Math.min(e.indent-1,r.length);if(l<r.length&&r[l].id!==e.id&&(r.length=l),l<r.length-1)r.length=l+1;else {const a=Q$(e,t);if(l>r.length-1||r[l].listElement.name!=a.type){0==l&&"ol"==a.type&&void 0!==e.id&&o[s]&&(a.startIndex=o[s]);const t=Z$(a,n,i);if(0==r.length){const i=e.element.parent,s=i.getChildIndex(e.element)+1;n.insertChild(s,t,i);}else {const e=r[l-1].listItemElements;n.appendChild(t,e[e.length-1]);}r[l]={...e,listElement:t,listItemElements:[]},0==l&&void 0!==e.id&&(o[s]=a.startIndex||1);}}const c="li"==e.element.name?e.element:n.createElement("li");j$(n,r,a,e,c,l),n.appendChild(c,r[l].listElement),r[l].listItemElements.push(c),0==l&&void 0!==e.id&&o[s]++,e.element!=c&&n.appendChild(e.element,c),eW(e.element,n),n.removeStyle("text-indent",e.element),n.removeStyle("margin-left",e.element);}else {const t=r.find(t=>t.marginLeft==e.marginLeft);if(t){const i=t.listItemElements;n.appendChild(e.element,i[i.length-1]),n.removeStyle("margin-left",e.element);}else r.length=0;}W$(n,r,a);}function j$(e,t,i,n,s,o){if(void 0===n.marginLeft)return void(0==o&&(i.canApplyMarginOnList=false));const r=parseFloat(n.marginLeft);let a=0;if(t.length>1){const e=t[t.length-2].listItemElements;if(e.length>0){const t=e[e.length-1].getStyle("margin-left");void 0!==t&&(a+=parseFloat(t));}}a+=40*t.length;const l=r-a,c=0!==l?q$(l):void 0;c&&(e.setStyle("margin-left",c,s),0==o&&i.canApplyMarginOnList&&(void 0===i.marginLeft&&(i.marginLeft=c),c!==i.marginLeft&&(i.canApplyMarginOnList=false),i.topLevelListItemElements.push(s)));}function $$(){return {marginLeft:void 0,canApplyMarginOnList:true,topLevelListItemElements:[]}}function W$(e,t,i){if(i.canApplyMarginOnList&&i.marginLeft&&i.topLevelListItemElements.length>0){e.setStyle("margin-left",i.marginLeft,t[0].listElement);for(const t of i.topLevelListItemElements)e.removeStyle("margin-left",t);}}function G$(e,t){for(const i of t.createRangeIn(e)){const e=i.item;if(e.is("element","li")){const i=e.getChild(0);i&&i.is("element","p")&&t.unwrapElement(i);}}}function K$(e){const t=e.element.previousSibling;if(!t){const t=e.element.parent;return J$(t)&&(!t.previousSibling||J$(t.previousSibling))}return J$(t)}function J$(e){return e.is("element","ol")||e.is("element","ul")}function Q$(e,t){const i=new RegExp(`@list l${e.id}:level${e.indent}\\s*({[^}]*)`,"gi"),n=/mso-level-number-format:([^;]{0,100});/gi,s=/mso-level-start-at:\s{0,100}([0-9]{0,10})\s{0,100};/gi,o=new RegExp(`@list\\s+l${e.id}:level\\d\\s*{[^{]*mso-level-text:"%\\d\\\\.`,"gi"),r=new RegExp(`@list l${e.id}:level\\d\\s*{[^{]*mso-level-number-format:`,"gi"),a=o.exec(t),l=r.exec(t),c=a&&!l,u=i.exec(t);let d="decimal",h="ol",m=null;if(u&&u[1]){const t=n.exec(u[1]);if(t&&t[1]&&(d=t[1].trim(),h="bullet"!==d&&"image"!==d?"ol":"ul"),"bullet"===d){const t=function(e){if("li"==e.name&&"ul"==e.parent.name&&e.parent.hasAttribute("type"))return e.parent.getAttribute("type");const t=function(e){if(e.getChild(0).is("$text"))return null;for(const t of e.getChildren()){if(!t.is("element","span"))continue;const e=t.getChild(0);if(e)return e.is("$text")?e:e.getChild(0)}return null}(e);if(!t)return null;const i=t._data;if("o"===i)return "circle";if("·"===i)return "disc";if("§"===i)return "square";return null}(e.element);t&&(d=t);}else {const e=s.exec(u[1]);e&&e[1]&&(m=parseInt(e[1]));}c&&(h="ol");}return {type:h,startIndex:m,style:Y$(d),isLegalStyleList:c}}function Y$(e){if(e.startsWith("arabic-leading-zero"))return "decimal-leading-zero";switch(e){case "alpha-upper":return "upper-alpha";case "alpha-lower":return "lower-alpha";case "roman-upper":return "upper-roman";case "roman-lower":return "lower-roman";case "circle":case "disc":case "square":return e;default:return null}}function Z$(e,t,i){const n=t.createElement(e.type);return e.style&&t.setStyle("list-style-type",e.style,n),e.startIndex&&e.startIndex>1&&t.setAttribute("start",e.startIndex,n),e.isLegalStyleList&&i&&t.addClass("legal-list",n),n}function X$(e){const t=e.getStyle("mso-list");if(void 0===t)return {};const i=t.match(/(^|\s{1,100})l(\d+)/i),n=t.match(/\s{0,100}lfo(\d+)/i),s=t.match(/\s{0,100}level(\d+)/i);return i&&n&&s?{id:i[2],order:n[1],indent:parseInt(s[1])}:{indent:1}}function eW(e,t){const i=new uo({name:"span",styles:{"mso-list":"Ignore"}}),n=t.createRangeIn(e);for(const e of n)"elementStart"===e.type&&i.match(e.item)&&t.remove(e.item);}function tW(e){const t=e.getStyle("margin-left");return void 0===t||t.endsWith("px")?t:z$(t)}function iW(e,t){if(!e.childCount)return;const i=new Cu(e.document),n=function(e,t){const i=t.createRangeIn(e),n=new uo({name:/v:(.+)/}),s=[];for(const e of i){if("elementStart"!=e.type)continue;const t=e.item,i=t.previousSibling,o=i&&i.is("element")?i.name:null,r=["Chart"],a=n.match(t),l=t.getAttribute("o:gfxdata"),c="v:shapetype"===o,u=l&&r.some(e=>t.getAttribute("id").includes(e));a&&l&&!c&&!u&&s.push(e.item.getAttribute("id"));}return s}(e,i);!function(e,t,i){const n=i.createRangeIn(t),s=new uo({name:"img"}),o=[];for(const t of n)if(t.item.is("element")&&s.match(t.item)){const i=t.item,n=i.getAttribute("v:shapes")?i.getAttribute("v:shapes").split(" "):[];n.length&&n.every(t=>e.indexOf(t)>-1)?o.push(i):i.getAttribute("src")||o.push(i);}for(const e of o)i.remove(e);}(n,e,i),function(e,t,i){const n=i.createRangeIn(t),s=[];for(const t of n)if("elementStart"==t.type&&t.item.is("element","v:shape")){const i=t.item.getAttribute("id");if(e.includes(i))continue;o(t.item.parent.getChildren(),i)||s.push(t.item);}for(const e of s){const t={src:r(e)};e.hasAttribute("alt")&&(t.alt=e.getAttribute("alt"));const n=i.createElement("img",t);i.insertChild(e.index+1,n,e.parent);}function o(e,t){for(const i of e)if(i.is("element")){if("img"==i.name&&i.getAttribute("v:shapes")==t)return  true;if(o(i.getChildren(),t))return  true}return  false}function r(e){for(const t of e.getChildren())if(t.is("element")&&t.getAttribute("src"))return t.getAttribute("src")}}(n,e,i),function(e,t){const i=t.createRangeIn(e),n=new uo({name:/v:(.+)/}),s=[];for(const e of i)"elementStart"==e.type&&n.match(e.item)&&s.push(e.item);for(const e of s)t.remove(e);}(e,i);const s=function(e,t){const i=t.createRangeIn(e),n=new uo({name:"img"}),s=[];let o=0;for(const e of i)e.item.is("element")&&n.match(e.item)&&(e.item.getAttribute("src").startsWith("file://")&&s.push({element:e.item,imageIndex:o}),o++);return s}(e,i);s.length&&function(e,t,i){for(let n=0;n<e.length;n++){const{element:s,imageIndex:o}=e[n],r=t[o];if(r){const e=`data:${r.type};base64,${nW(r.hex)}`;i.setAttribute("src",e,s);}}}(s,function(e){if(!e)return [];const t=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,i=new RegExp("(?:("+t.source+"))([\\da-fA-F\\s]+)\\}","g"),n=e.match(i),s=[];if(n)for(const e of n){let i=false;e.includes("\\pngblip")?i="image/png":e.includes("\\jpegblip")&&(i="image/jpeg"),i&&s.push({hex:e.replace(t,"").replace(/[^\da-fA-F]/g,""),type:i});}return s}(t),i);}function nW(e){return btoa(e.match(/\w{2}/g).map(e=>String.fromCharCode(parseInt(e,16))).join(""))}function sW(e){const t=[],i=new Cu(e.document);for(const{item:n}of i.createRangeIn(e))if(n.is("element")){for(const e of n.getClassNames())/\bmso/gi.exec(e)&&i.removeClass(e,n);for(const e of n.getStyleNames())/\bmso/gi.exec(e)&&i.removeStyle(e,n);(n.is("element","w:sdt")||n.is("element","w:sdtpr")&&n.isEmpty||n.is("element","o:p")&&n.isEmpty)&&t.push(n);}for(const e of t){const t=e.parent,n=t.getChildIndex(e);i.insertChild(n,e.getChildren(),t),i.remove(e);}}function oW(e,t,i=false){for(const n of t.createRangeIn(e).getItems()){if(!n.is("element","table")&&!n.is("element","td")&&!n.is("element","th"))continue;if(i&&n.is("element","table")){const e=n.parent?.is("element","div")?n.parent:null,i=n.parent?.parent?.is("element","div")?n.parent.parent:null,s=e??i;s&&"center"===s.getAttribute("align")&&!n.getAttribute("align")?(t.setStyle("margin-left","auto",n),t.setStyle("margin-right","auto",n)):s&&"right"===s.getAttribute("align")&&!n.getAttribute("align")?(t.setStyle("margin-left","auto",n),t.setStyle("margin-right","0",n)):s||n.getAttribute("align")||(t.setStyle("margin-left","0",n),t.setStyle("margin-right","auto",n));}const e=["left","top","right","bottom"];if(e.every(e=>!n.hasStyle(`border-${e}-style`)))t.setStyle("border-style","none",n);else for(const i of e)n.hasStyle(`border-${i}-style`)||t.setStyle(`border-${i}-style`,"none",n);const s=["width","height",...e.map(e=>`border-${e}-width`),...e.map(e=>`padding-${e}`)];for(const e of s)n.hasStyle(e)&&t.setStyle(e,z$(n.getStyle(e)),n);}}function rW(e,t){for(const i of t.createRangeIn(e).getItems())i.is("element","table")&&("0px"===i.getStyle("width")&&t.removeStyle("width",i),"0"===i.getAttribute("width")&&t.removeAttribute("width",i));}function aW(e,t){const i=[],n=[];for(const{item:s}of e.createRangeIn(t))if(s.is("element")&&s.getStyle("mso-footnote-id")){i.unshift(s);const{nextSibling:e}=s;e?.is("$text")&&e.data.startsWith(" ")&&n.unshift(e);}for(const t of i)e.remove(t);for(const t of n){const i=t.data.substring(1);if(i.length>0){const n=t.parent,s=n.getChildIndex(t),o=e.createText(i);e.remove(t),e.insertChild(s,o,n);}else e.remove(t);}return t}function lW(e,t){const i=e.createElement("sup",{class:"footnote"}),n=e.createElement("a",{id:`ref-${t}`,href:`#${t}`});return e.appendChild(n,i),i}function cW(e,t){const i=e.createElement("li",{id:t,class:"footnote-definition"}),n=e.createElement("a",{href:`#ref-${t}`,class:"footnote-backlink"}),s=e.createElement("div",{class:"footnote-content"});return e.appendChild(e.createText("^"),n),e.appendChild(n,i),e.appendChild(s,i),{listItem:i,content:s}}const uW=/<meta\s*name="?generator"?\s*content="?microsoft\s*word\s*\d+"?\/?>/i,dW=/xmlns:o="urn:schemas-microsoft-com/i;class hW{document;hasMultiLevelListPlugin;hasTablePropertiesPlugin;constructor(e,t=false,i=false){this.document=e,this.hasMultiLevelListPlugin=t,this.hasTablePropertiesPlugin=i;}isActive(e){return uW.test(e)||dW.test(e)}execute(e){const t=new Cu(this.document),{body:i,stylesString:n}=e._parsedData;D$(i,t),U$(i,n,this.hasMultiLevelListPlugin),iW(i,e.dataTransfer.getData("text/rtf")),oW(i,t,this.hasTablePropertiesPlugin),rW(i,t),function(e,t){const i=new Map,n=new Map;let s=null;for(const{item:o}of t.createRangeIn(e))if(o.is("element"))if("footnote-list"!==o.getStyle("mso-element")){if(o.hasStyle("mso-footnote-id")){const e=o.findAncestor("element",e=>"footnote"===e.getStyle("mso-element"));if(e){const t=e.getAttribute("id");n.set(t,e);}else {const e=o.getStyle("mso-footnote-id");i.set(e,o);}continue}}else s=o;if(!i.size||!s)return;const o=function(e){return e.createElement("ol",{class:"footnotes"})}(t);t.replace(s,o);for(const[e,s]of i){const i=n.get(e);if(!i)continue;t.replace(s,lW(t,e));const r=cW(t,e);aW(t,i);for(const e of i.getChildren()){let i=e;e.is("element")&&(i=t.clone(e,true)),t.appendChild(i,r.content);}t.appendChild(r.listItem,o);}}(i,t),sW(i),e.content=i;}}function mW(e,t){for(const i of e.getChildren())if(i.is("element","b")&&"normal"===i.getStyle("font-weight")){const n=e.getChildIndex(i);t.remove(i),t.insertChild(n,i.getChildren(),e);}}function gW(e,t){const i=new jo(t.document.stylesProcessor),n=new Rr(i,{renderingMode:"data"}),s=n.blockElements,o=n.inlineObjectElements,r=[];for(const i of t.createRangeIn(e)){const e=i.item;if(e.is("element","br")){const i=fW(e,"forward",t,{blockElements:s,inlineObjectElements:o}),n=fW(e,"backward",t,{blockElements:s,inlineObjectElements:o}),a=pW(i,s);(pW(n,s)||a)&&r.push(e);}}for(const e of r)e.hasClass("Apple-interchange-newline")?t.remove(e):t.replace(e,t.createElement("p"));}function fW(e,t,i,{blockElements:n,inlineObjectElements:s}){let o=i.createPositionAt(e,"forward"==t?"after":"before");return o=o.getLastMatchingPosition(({item:e})=>e.is("element")&&!n.includes(e.name)&&!s.includes(e.name),{direction:t}),"forward"==t?o.nodeAfter:o.nodeBefore}function pW(e,t){return !!e&&e.is("element")&&t.includes(e.name)}function bW(e){let t=e;for(;t;){if(t.is("element")){const e=t.getStyle?.("white-space");if("pre-wrap"===e)return  true}t=t.parent;}return  false}function wW(e,t,i){const{parent:n,data:s}=e,o=s.replaceAll("\t"," ".repeat(i)),r=n.getChildIndex(e);t.remove(e),t.insertChild(r,t.createText(o),n);}const vW=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class _W{document;constructor(e){this.document=e;}isActive(e){return vW.test(e)}execute(e){const t=new Cu(this.document),{body:i}=e._parsedData;mW(i,t),G$(i,t),gW(i,t),function(e,t,i){const n=new Set;for(const i of t.createRangeIn(e).getItems())i.is("view:$textProxy")&&i.data.includes("\t")&&bW(i.parent)&&n.add(i.textNode);for(const e of n)wW(e,t,i);}(i,t,8),e.content=i;}}function yW(e,t){for(const i of e.getChildren())i.is("element","table")&&i.hasAttribute("xmlns")&&t.removeAttribute("xmlns",i);}function kW(e,t){for(const i of e.getChildren())if(i.is("element","google-sheets-html-origin")){const n=e.getChildIndex(i);t.remove(i),t.insertChild(n,i.getChildren(),e);}}function CW(e,t){for(const i of Array.from(e.getChildren()))i.is("element","style")&&t.remove(i);}const xW=/<google-sheets-html-origin/i;class AW{document;constructor(e){this.document=e;}isActive(e){return xW.test(e)}execute(e){const t=new Cu(this.document),{body:i}=e._parsedData;kW(i,t),yW(i,t),rW(i,t),CW(i,t),e.content=i;}}function EW(e){return SW(SW(e)).replace(/(<span\s+style=['"]mso-spacerun:yes['"]>[^\S\r\n]*?)[\r\n]+([^\S\r\n]*<\/span>)/g,"$1$2").replace(/<span\s+style=['"]mso-spacerun:yes['"]><\/span>/g,"").replace(/(<span\s+style=['"]letter-spacing:[^'"]+?['"]>)[\r\n]+(<\/span>)/g,"$1 $2").replace(/ <\//g," </").replace(/ <o:p><\/o:p>/g," <o:p></o:p>").replace(/<o:p>(&nbsp;|\u00A0)<\/o:p>/g,"").replace(/>([^\S\r\n]*[\r\n]\s*)</g,"><")}function TW(e){e.querySelectorAll("span[style*=spacerun]").forEach(e=>{const t=e,i=t.innerText.length||0;t.innerText=Array(i+1).join("  ").substr(0,i);});}function SW(e){return e.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(e,t)=>1===t.length?" ":Array(t.length+1).join("  ").substr(0,t.length))}function IW(e,t){const i=new DOMParser,n=EW(function(e){const t="</body>",i="</html>",n=e.indexOf(t);if(n<0)return e;const s=e.indexOf(i,n+t.length);return e.substring(0,n+t.length)+(s>=0?e.substring(s):"")}(e=(e=e.replace(/<!--\[if gte vml 1]>/g,"")).replace(/<o:SmartTagType(?:\s+[^\s>=]+(?:="[^"]*")?)*\s*\/?>/gi,""))),s=i.parseFromString(n,"text/html");TW(s);const o=s.body.innerHTML,r=function(e,t){const i=new jo(t),n=new Rr(i,{renderingMode:"data"}),s=e.createDocumentFragment(),o=e.body.childNodes;for(;o.length>0;)s.appendChild(o[0]);return n.domToView(s,{skipComments:true})}(s,t),a=function(e){const t=[],i=[],n=Array.from(e.getElementsByTagName("style"));for(const e of n)e.sheet&&e.sheet.cssRules&&e.sheet.cssRules.length&&(t.push(e.sheet),i.push(e.innerHTML));return {styles:t,stylesString:i.join(" ")}}(s);return {body:r,bodyString:o,styles:a.styles,stylesString:a.stylesString}}class PW extends Ms{static get pluginName(){return "PasteFromOffice"}static get licenseFeatureCode(){return "PFO"}static get isOfficialPlugin(){return  true}static get isPremiumPlugin(){return  true}static get requires(){return [tx]}init(){const e=this.editor,t=e.plugins.get("ClipboardPipeline"),i=e.editing.view.document,n=[],s=this.editor.plugins.has("MultiLevelListEditing"),o=this.editor.plugins.has("TablePropertiesEditing");n.push(new hW(i,s,o)),n.push(new _W(i)),n.push(new AW(i)),t.on("inputTransformation",(t,s)=>{if(s._isTransformedWithPasteFromOffice)return;if(e.model.document.selection.getFirstPosition().parent.is("element","codeBlock"))return;const o=s.dataTransfer.getData("text/html"),r=n.find(e=>e.isActive(o));r&&(s._parsedData||(s._parsedData=IW(o,i.stylesProcessor)),r.execute(s),s._isTransformedWithPasteFromOffice=true);},{priority:"high"});}}const VW="removeFormat";class RW extends Ms{static get pluginName(){return "RemoveFormatUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor;e.ui.componentFactory.add(VW,()=>{const e=this._createButton(Bp);return e.set({tooltip:true}),e}),e.ui.componentFactory.add(`menuBar:${VW}`,()=>this._createButton(Jp));}_createButton(e){const t=this.editor,i=t.locale,n=t.commands.get(VW),s=new e(t.locale),o=i.t;return s.set({label:o("Remove Format"),icon:Ff}),s.bind("isEnabled").to(n,"isEnabled"),this.listenTo(s,"execute",()=>{t.execute(VW),t.editing.view.focus();}),s}}class OW extends Ns{_customAttributesHandlers=[];refresh(){const e=this.editor.model;this.isEnabled=!!Cn(this._getFormattingItems(e.document.selection));}execute(){const e=this.editor.model;e.change(t=>{for(const i of this._getFormattingItems(e.document.selection))if(i.is("selection"))for(const e of this._getFormattingAttributes(i))t.removeSelectionAttribute(e);else {const e=t.createRangeOn(i);for(const n of this._getFormattingAttributes(i))this._removeFormatting(n,i,e,t);}});}registerCustomAttribute(e,t){this._customAttributesHandlers.push({isFormatting:e,removeFormatting:t});}_removeFormatting(e,t,i,n){let s=false;const o=BW(e);for(const{isFormatting:r,removeFormatting:a}of this._customAttributesHandlers)r(o,t)&&(a(e,i,n),s=true);s||n.removeAttribute(e,i);}*_getFormattingItems(e){const t=this.editor.model,i=t.schema,n=e=>!!Cn(this._getFormattingAttributes(e));for(const s of e.getRanges())for(const e of s.getItems())i.isBlock(e)&&s.end.isTouching(t.createPositionAt(e,0))||n(e)&&(yield e);for(const t of e.getSelectedBlocks())n(t)&&(yield t);n(e)&&(yield e);}*_getFormattingAttributes(e){const{schema:t}=this.editor.model;for(const[i]of e.getAttributes()){const n=BW(i);for(const{isFormatting:t}of this._customAttributesHandlers)t(n,e)&&(yield i);const s=t.getAttributeProperties(n);s&&s.isFormatting&&(yield i);}}}function BW(e){return e.replace(/^selection:/,"")}class LW extends Ms{static get pluginName(){return "RemoveFormatEditing"}static get licenseFeatureCode(){return "RF"}static get isOfficialPlugin(){return  true}static get isPremiumPlugin(){return  true}init(){const e=this.editor;e.commands.add("removeFormat",new OW(e));}}class MW extends Ms{static get requires(){return [LW,RW]}static get pluginName(){return "RemoveFormat"}static get isOfficialPlugin(){return  true}}function FW(e,t){for(const i of e.model.markers){if(NW(zW(i,e.model),t)&&i.name.startsWith("restrictedEditingException:"))return i}}function NW(e,t){return e.containsPosition(t)||e.end.isEqual(t)||e.start.isEqual(t)}function DW(e,t,i){if(!i)return  false;const n=zW(i,t);return e.isCollapsed?NW(n,e.focus):n.containsRange(e.getFirstRange(),true)}function zW(e,t){const i=e.getRange(),n=i.getContainedElement();return n&&n.is("element","restrictedEditingException")?t.createRangeIn(n):i}class HW extends Ns{_direction;constructor(e,t){super(e),this.affectsData=false,this._direction=t;}refresh(){this.isEnabled=this._checkEnabled();}execute(){const e=qW(this.editor.model,this._direction);e&&this.editor.model.change(t=>{t.setSelection(e);});}_checkEnabled(){return !!qW(this.editor.model,this._direction)}}function qW(e,t){const i=e.document.selection.getFirstPosition(),n=[];for(const s of e.markers.getMarkersGroup("restrictedEditingException")){const o=zW(s,e),r=i.isTouching(o.start)&&i.hasSameParentAs(o.start)||i.isTouching(o.end)&&i.hasSameParentAs(o.end);o.containsPosition(i)||r||("forward"===t&&o.start.isAfter(i)||"backward"===t&&o.end.isBefore(i))&&n.push(o);}if(n.length)return n.sort((e,i)=>"forward"===t?e.start.isAfter(i.start)?1:-1:e.start.isBefore(i.start)?1:-1).shift()}const UW="restricted-editing-exception_selected";function jW(e){const t=e.editing.view,i=e.model,n=new Set;t.document.registerPostFixer(t=>{const s=i.document.selection,o=FW(e,s.anchor);if(!o)return  false;const r=o.getRange().getContainedElement();if(r&&r.is("element","restrictedEditingException")){const i=e.editing.mapper.toViewElement(r);t.addClass(UW,i),n.add(i);}else for(const i of e.editing.mapper.markerNameToElements(o.name))t.addClass(UW,i),n.add(i);return  false}),e.conversion.for("editingDowncast").add(e=>{function i(){t.change(e=>{for(const t of n.values())e.removeClass(UW,t),n.delete(t);});}e.on("insert",i,{priority:"highest"}),e.on("remove",i,{priority:"highest"}),e.on("attribute",i,{priority:"highest"}),e.on("cleanSelection",i);});}function $W(e){return t=>{let i=false;for(const{name:n,data:s}of e.model.document.differ.getChangedMarkers())n.startsWith("restrictedEditingException")&&s.newRange&&"$graveyard"==s.newRange.root.rootName&&(t.updateMarker(n,{range:t.createRange(t.createPositionAt(s.oldRange.start))}),i=true);return i}}function WW(e){return t=>{let i=false;const n=e.model.schema;for(const s of e.model.document.differ.getChanges())"insert"==s.type&&n.checkChild("$block",s.name)&&(i=KW(e,s.position,s.length,t)||i,i=JW(e,s.position,s.length,t)||i);return i}}function GW(e){return t=>t.on("element",(t,i,n)=>{const{writer:s}=n,o=new uo(e.view).match(i.viewItem);if(!o)return;const r=o.match;if(r.name=true,!n.consumable.test(i.viewItem,r))return;let a=i.modelCursor,l=null;if(e.useWrapperElement){if(!n.schema.checkChild(a,"restrictedEditingException"))return;l=s.createElement("restrictedEditingException"),s.insert(l,a),a=s.createPositionAt(l,0);}const{modelRange:c}=n.convertChildren(i.viewItem,a);n.consumable.consume(i.viewItem,r);const u=e.model(),d=s.createElement("$marker",{"data-name":u}),h=s.createElement("$marker",{"data-name":u});l?(s.insert(d,s.createPositionBefore(l)),s.insert(h,s.createPositionAfter(l))):(s.insert(h,c.end),s.insert(d,c.start)),i.modelRange=s.createRange(s.createPositionBefore(d),s.createPositionAfter(h)),i.modelCursor=i.modelRange.end;})}function KW(e,t,i,n){const s=FW(e,t.getShiftedBy(i));return !(!s||!s.getStart().isEqual(t.getShiftedBy(i)))&&(n.updateMarker(s,{range:n.createRange(s.getStart().getShiftedBy(-i),s.getEnd())}),true)}function JW(e,t,i,n){const s=FW(e,t);return !(!s||!s.getEnd().isEqual(t))&&(n.updateMarker(s,{range:n.createRange(s.getStart(),s.getEnd().getShiftedBy(i))}),true)}const QW="RestrictedEditingMode";class YW extends Ms{_alwaysEnabled;_allowedInException;static get pluginName(){return "RestrictedEditingModeEditing"}static get licenseFeatureCode(){return "RED"}static get isOfficialPlugin(){return  true}static get isPremiumPlugin(){return  true}constructor(e){super(e),e.config.define("restrictedEditing",{allowedCommands:["bold","italic","link","unlink"],allowedAttributes:["bold","italic","linkHref"]}),this._alwaysEnabled=new Set(["undo","redo"]),this._allowedInException=new Set(["input","insertText","delete","deleteForward"]);}init(){const e=this.editor,t=e.editing.view;e.config.get("restrictedEditing.allowedCommands").forEach(e=>this._allowedInException.add(e)),this._setupSchema(),this._setupConversion(),this._setupCommandsToggling(),this._setupRestrictions(),e.commands.add("goToPreviousRestrictedEditingException",new HW(e,"backward")),e.commands.add("goToNextRestrictedEditingException",new HW(e,"forward")),this.listenTo(t.document,"tab",(t,i)=>{const n=i.shiftKey?"goToPreviousRestrictedEditingException":"goToNextRestrictedEditingException";e.commands.get(n).isEnabled&&(e.execute(n),i.preventDefault(),i.stopPropagation()),t.stop();},{context:"$capture"}),this.listenTo(t.document,"keydown",function(e){return (t,i)=>{if(an(i)!=ln("Ctrl+A"))return;const n=e.model,s=e.model.document.selection,o=FW(e,s.focus);if(!o)return;const r=s.getFirstRange(),a=zW(o,e.model);(a.containsRange(r,true)||s.isCollapsed)&&(t.stop(),i.preventDefault(),i.stopPropagation(),n.change(e=>{e.setSelection(a);}));}}(e),{priority:"high"}),t.change(e=>{for(const i of t.document.roots)e.addClass("ck-restricted-editing_mode_restricted",i);}),e.data.on("set",()=>{e.model.change(t=>{for(const i of e.model.markers.getMarkersGroup("restrictedEditingException"))t.removeMarker(i.name);});},{priority:"high"});}enableCommand(e){this.editor.commands.get(e).clearForceDisabled(QW),this._alwaysEnabled.add(e);}_setupSchema(){this.editor.model.schema.register("restrictedEditingException",{allowWhere:"$block",allowContentOf:"$container",isLimit:true});}_setupConversion(){const e=this.editor,t=e.model.document;let i=0;e.conversion.for("upcast").add(GW({view:{name:"span",classes:"restricted-editing-exception"},model:()=>(i++,`restrictedEditingException:inline:${i}`)})),e.conversion.for("upcast").add(GW({view:{name:"div",classes:"restricted-editing-exception"},model:()=>(i++,`restrictedEditingException:block:${i}`),useWrapperElement:true})),e.conversion.for("downcast").elementToElement({model:"restrictedEditingException",view:{name:"div",classes:"restricted-editing-exception"}}),e.conversion.for("downcast").add(e=>{e.on("addMarker:restrictedEditingException:inline",(e,t,i)=>{if(!t.item)return;if(t.item.is("selection")||!i.schema.isInline(t.item))return;if(!i.consumable.consume(t.item,e.name))return;const n=i.writer,s=n.createAttributeElement("span",{class:"restricted-editing-exception"},{id:t.markerName,priority:-10}),o=i.mapper.toViewRange(t.range),r=n.wrap(o,s);for(const e of r.getItems())if(e.is("attributeElement")&&e.isSimilar(s)){i.mapper.bindElementToMarker(e,t.markerName);break}});}),e.conversion.for("downcast").markerToHighlight({model:"restrictedEditingException:inline",view:()=>({name:"span",classes:"restricted-editing-exception",priority:-10})}),e.conversion.for("editingDowncast").markerToElement({model:"restrictedEditingException:inline",view:(e,{writer:t})=>t.createUIElement("span",{class:"restricted-editing-exception restricted-editing-exception_collapsed"})}),e.conversion.for("dataDowncast").markerToElement({model:"restrictedEditingException:inline",view:(e,{writer:t})=>t.createEmptyElement("span",{class:"restricted-editing-exception"})}),t.registerPostFixer(WW(e)),t.registerPostFixer($W(e)),t.registerPostFixer(function(e){return t=>{let i=false;const n=e.model.document.differ.getChangedMarkers();for(const{data:e,name:s}of n){if(!s.startsWith("restrictedEditingException"))continue;const n=e.newRange;if(!e.oldRange&&!n.isFlat){const e=n.start,o=n.end,r=e.path.length>o.path.length,a=r?n.start:t.createPositionAt(o.parent,0),l=r?t.createPositionAt(e.parent,"end"):n.end;t.updateMarker(s,{range:t.createRange(a,l)}),i=true;}}return i}}(e)),jW(e);}_setupRestrictions(){const e=this.editor,t=e.model,i=t.document.selection,n=e.editing.view.document,s=e.plugins.get("ClipboardPipeline");this.listenTo(t,"deleteContent",function(e){return (t,i)=>{const[n]=i,s=FW(e,n.focus)||FW(e,n.anchor);if(!s)return void t.stop();if(n.isCollapsed)return;const o=zW(s,e.model).getIntersection(n.getFirstRange());n.is("documentSelection")?e.model.change(e=>{e.setSelection(o);}):n.setTo(o);}}(e),{priority:"high"});const o=e.commands.get("insertText");o&&this.listenTo(o,"execute",function(e){return (t,i)=>{const[n]=i,{range:s}=n;s&&(XW(e,s)||t.stop());}}(e),{priority:"high"}),this.listenTo(s,"contentInsertion",(n,s)=>{XW(e,i.getFirstRange())||n.stop();const o=FW(e,i.focus);if(o&&o.name.startsWith("restrictedEditingException:inline:")){const i=e.config.get("restrictedEditing.allowedAttributes");t.change(e=>{const t=e.createDocumentFragment(),n=Array.from(e.createRangeIn(s.content).getItems()).filter(e=>e.is("$textProxy"));for(const s of n){for(const t of s.getAttributeKeys())i.includes(t)||e.removeAttribute(t,s);e.append(s,t);}s.content=t;});}}),this.listenTo(n,"clipboardOutput",(t,n)=>{"cut"!=n.method||XW(e,i.getFirstRange())||t.stop();},{priority:"high"}),t.schema.addChildCheck(e=>{if(e.startsWith("$clipboardHolder"))return  false},"restrictedEditingException");}_setupCommandsToggling(){const e=this.editor.model.document;this._disableCommands(),this.listenTo(e.selection,"change",this._checkCommands.bind(this)),this.listenTo(e,"change:data",this._checkCommands.bind(this));}_checkCommands(){const e=this.editor,t=e.model.document.selection;if(t.rangeCount>1)return void this._disableCommands();const i=FW(e,t.focus);this._disableCommands(),DW(t,e.model,i)&&this._enableCommands(i);}_enableCommands(e){const t=this.editor,i=t.model.document.selection;for(const[n,s]of t.commands)s.affectsData&&!this._alwaysEnabled.has(n)&&(e.name.startsWith("restrictedEditingException:block:")||this._allowedInException.has(n))&&(ZW(n,i,zW(e,t.model))||s.clearForceDisabled(QW));}_disableCommands(){const e=this.editor;for(const[t,i]of e.commands)i.affectsData&&!this._alwaysEnabled.has(t)&&i.forceDisabled(QW);}}function ZW(e,t,i){return !("delete"!=e||!t.isCollapsed||!i.start.isTouching(t.focus))||!("deleteForward"!=e||!t.isCollapsed||!i.end.isTouching(t.focus))}function XW(e,t){const i=FW(e,t.start),n=FW(e,t.end);return i&&n&&n===i}class eG extends Ms{static get pluginName(){return "RestrictedEditingModeUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("restrictedEditing",i=>{const n=ww(i),s=new kn;return this._getButtonDefinitions().forEach(({commandName:e,label:t,keystroke:i})=>{s.add(this._getButtonDefinition(e,t,i));}),Cw(n,s,{role:"menu"}),n.buttonView.set({label:t("Navigate editable regions"),icon:Vm,tooltip:true,isEnabled:true,isOn:false}),this.listenTo(n,"execute",t=>{const{_commandName:i}=t.source;e.execute(i),e.editing.view.focus();}),n}),e.ui.componentFactory.add("menuBar:restrictedEditing",e=>{const i=new x_(e),n=new A_(e);return n.set({ariaLabel:t("Navigate editable regions"),role:"menu"}),i.buttonView.set({label:t("Navigate editable regions"),icon:Vm}),i.panelView.children.add(n),this._getButtonDefinitions().forEach(({commandName:t,label:s,keystroke:o})=>{const r=new Av(e,i),a=this._createMenuBarButton(s,t,o);a.delegate("execute").to(i),r.children.add(a),n.items.add(r);}),i});}_createMenuBarButton(e,t,i){const n=this.editor,s=n.commands.get(t),o=new Jp(n.locale);return o.set({label:e,keystroke:i,isEnabled:true,isOn:false}),o.bind("isEnabled").to(s),this.listenTo(o,"execute",()=>{n.execute(t),n.editing.view.focus();}),o}_getButtonDefinition(e,t,i){const n=this.editor.commands.get(e),s={type:"button",model:new e_({label:t,withText:true,keystroke:i,withKeystroke:true,role:"menuitem",_commandName:e})};return s.model.bind("isEnabled").to(n,"isEnabled"),s}_getButtonDefinitions(){const e=this.editor.locale.t;return [{commandName:"goToPreviousRestrictedEditingException",label:e("Previous editable region"),keystroke:"Shift+Tab"},{commandName:"goToNextRestrictedEditingException",label:e("Next editable region"),keystroke:"Tab"}]}}class tG extends Ms{static get pluginName(){return "RestrictedEditingMode"}static get isOfficialPlugin(){return  true}static get requires(){return [YW,eG]}}class iG extends Ns{refresh(){const e=this.editor.model,t=e.document;this.value=!!t.selection.getAttribute("restrictedEditingException"),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"restrictedEditingException");}execute(e={}){const t=this.editor.model,i=t.document.selection,n=void 0===e.forceValue?!this.value:e.forceValue;t.change(e=>{const s=t.schema.getValidRanges(i.getRanges(),"restrictedEditingException");if(i.isCollapsed)if(n)e.setSelectionAttribute("restrictedEditingException",n);else {const t=e=>e.item.getAttribute("restrictedEditingException")===this.value,n=i.focus,s=n.getLastMatchingPosition(t,{direction:"backward"}),o=n.getLastMatchingPosition(t);e.removeSelectionAttribute("restrictedEditingException"),n.isEqual(s)||n.isEqual(o)||e.removeAttribute("restrictedEditingException",e.createRange(s,o));}else for(const t of s)n?e.setAttribute("restrictedEditingException",n,t):e.removeAttribute("restrictedEditingException",t);});}}class nG extends Ns{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled();}execute(e={}){const t=this.editor.model,i=t.schema,n=t.document.selection,s=Array.from(n.getSelectedBlocks()),o=void 0===e.forceValue?!this.value:e.forceValue;t.change(e=>{if(o){const t=s.filter(e=>sG(e)||rG(i,e));this._applyException(e,t);}else {const t=s.map(e=>function(e){let t=e;for(;t.parent;){if("restrictedEditingException"==t.parent.name)return t;t=t.parent;}return null}(e)).filter(e=>!!e);this._removeException(e,t);}});}_getValue(){const e=Cn(this.editor.model.document.selection.getSelectedBlocks());return !(!e||!sG(e))}_checkEnabled(){if(this.value)return  true;const e=this.editor.model.document.selection,t=this.editor.model.schema,i=Cn(e.getSelectedBlocks());return !!i&&rG(t,i)}_removeException(e,t){oG(e,t).reverse().forEach(t=>{if(t.start.isAtStart&&t.end.isAtEnd)return void e.unwrap(t.start.parent);if(t.start.isAtStart){const i=e.createPositionBefore(t.start.parent);return void e.move(t,i)}t.end.isAtEnd||e.split(t.end);const i=e.createPositionAfter(t.end.parent);e.move(t,i);});}_applyException(e,t){const i=this.editor.model.schema,n=[];if(oG(e,t).reverse().forEach(t=>{let i=sG(t.start);i||(i=e.createElement("restrictedEditingException"),e.wrap(t,i)),n.push(i);}),n.reverse(),n.length){const e=n.at(0).previousSibling,t=n.at(-1).nextSibling;e?.is("element","restrictedEditingException")&&n.unshift(e),t?.is("element","restrictedEditingException")&&n.push(t);}n.reduce((t,i)=>t.nextSibling==i?(e.merge(e.createPositionAfter(t)),t):i),i.removeDisallowedAttributes(t,e);}}function sG(e){return e.findAncestor("restrictedEditingException",{includeSelf:true})}function oG(e,t){let i,n=0;const s=[];for(;n<t.length;){const o=t[n],r=t[n+1];i||(i=e.createPositionBefore(o)),r&&o.nextSibling==r||(s.push(e.createRange(i,e.createPositionAfter(o))),i=null),n++;}return s}function rG(e,t){const i=e.createContext(t.parent);return !!e.checkChild(i,"restrictedEditingException")&&!!e.checkChild(i.push("restrictedEditingException"),t)}class aG extends Ns{_inlineCommand;_blockCommand;constructor(e){super(e),this._inlineCommand=e.commands.get("restrictedEditingException"),this._blockCommand=e.commands.get("restrictedEditingExceptionBlock");}refresh(){this.value=this._inlineCommand.value||this._blockCommand.value,this.isEnabled=this._inlineCommand.isEnabled||this._blockCommand.isEnabled;}execute(){const e=this.editor;if(this._inlineCommand.value)e.execute("restrictedEditingException");else if(this._blockCommand.value)e.execute("restrictedEditingExceptionBlock");else if(this._inlineCommand.isEnabled&&!this._blockCommand.isEnabled)e.execute("restrictedEditingException");else if(this._blockCommand.isEnabled&&!this._inlineCommand.isEnabled)e.execute("restrictedEditingExceptionBlock");else {const t=e.model.schema,i=e.model.document.selection,n=i.getSelectedElement();i.isCollapsed||n&&t.isObject(n)&&t.isBlock(n)||Xt(i.getSelectedBlocks())>1?e.execute("restrictedEditingExceptionBlock"):e.execute("restrictedEditingException");}}}class lG extends Ms{static get pluginName(){return "StandardEditingModeEditing"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.model.schema;t.extend("$text",{allowAttributes:["restrictedEditingException"]}),t.register("restrictedEditingException",{allowWhere:"$container",allowContentOf:"$container"}),t.addChildCheck(e=>{for(const t of e)if("restrictedEditingException"==t.name)return  false},"restrictedEditingException"),t.addAttributeCheck(e=>{for(const t of e)if("restrictedEditingException"==t.name)return  false},"restrictedEditingException"),e.model.document.registerPostFixer(i=>{const n=e.model.document.differ.getChanges(),s=new Set,o=new Set,r=new Set;let a=false;for(const e of n)if("insert"==e.type){const n=i.createRange(e.position,e.position.getShiftedBy(e.length));for(const e of n.getItems())e.is("element","restrictedEditingException")?t.checkChild(i.createPositionBefore(e),e)?e.isEmpty?o.add(e):r.add(e):s.add(e):e.is("$textProxy")&&e.hasAttribute("restrictedEditingException")&&!t.checkAttribute(e,"restrictedEditingException")&&(i.removeAttribute("restrictedEditingException",e),a=true);}else if("remove"==e.type){const t=e.position.parent;t.is("element","restrictedEditingException")&&t.isEmpty&&o.add(t);for(const e of t.getChildren())e.is("element","restrictedEditingException")&&r.add(e);}for(const e of s)i.unwrap(e),a=true;for(const e of o)i.remove(e),a=true;for(const e of r){if("$graveyard"==e.root.rootName)continue;const t=e.previousSibling,n=e.nextSibling;t&&t.is("element","restrictedEditingException")&&i.merge(i.createPositionBefore(e)),n&&n.is("element","restrictedEditingException")&&i.merge(i.createPositionAfter(e));}return a}),e.conversion.for("upcast").elementToAttribute({model:"restrictedEditingException",view:{name:"span",classes:"restricted-editing-exception"}}).elementToElement({model:"restrictedEditingException",view:{name:"div",classes:"restricted-editing-exception"}}),function(e){const t=new uo({name:"span",classes:"restricted-editing-exception"});e.conversion.for("upcast").add(e=>e.on("element:span",(e,i,n)=>{const s=t.match(i.viewItem);if(!s)return;const o=s.match;if(!n.consumable.test(i.viewItem,o))return;const r=n.writer.createText(" ",{restrictedEditingException:true});n.safeInsert(r,i.modelCursor)&&(n.consumable.consume(i.viewItem,o),i.modelRange=n.writer.createRange(i.modelCursor,i.modelCursor.getShiftedBy(r.offsetSize)),i.modelCursor=i.modelRange.end);},{priority:"low"}));}(e),e.conversion.for("downcast").attributeToElement({model:"restrictedEditingException",view:(e,{writer:t})=>{if(e)return t.createAttributeElement("span",{class:"restricted-editing-exception"},{priority:-10})}}).elementToElement({model:"restrictedEditingException",view:{name:"div",classes:"restricted-editing-exception"}}),e.commands.add("restrictedEditingException",new iG(e)),e.commands.add("restrictedEditingExceptionBlock",new nG(e)),e.commands.add("restrictedEditingExceptionAuto",new aG(e)),e.editing.view.change(t=>{for(const i of e.editing.view.document.roots)t.addClass("ck-restricted-editing_mode_standard",i);});}}class cG extends Ms{static get pluginName(){return "StandardEditingModeUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.ui.componentFactory;t.add("restrictedEditingException:dropdown",i=>{const n=ww(i),s=i.t,o=[t.create("restrictedEditingException:inline"),t.create("restrictedEditingException:block")];for(const e of o)e.set({withText:true,tooltip:false});return yw(n,o,{enableActiveItemFocusOnDropdownOpen:true,isVertical:true,ariaLabel:s("Enable editing")}),n.buttonView.set({label:s("Enable editing"),icon:Rm,tooltip:true}),n.extendTemplate({attributes:{class:"ck-restricted-editing-dropdown"}}),n.bind("isEnabled").toMany(o,"isEnabled",(...e)=>e.some(e=>e)),this.listenTo(n,"execute",()=>{e.editing.view.focus();}),n}),t.add("restrictedEditingException:inline",()=>{const e=this._createButton("restrictedEditingException",Bp);return e.set({tooltip:true}),e}),t.add("restrictedEditingException:block",()=>{const e=this._createButton("restrictedEditingExceptionBlock",Bp);return e.set({tooltip:true}),e}),t.add("menuBar:restrictedEditingException:inline",()=>this._createButton("restrictedEditingException",Jp)),t.add("menuBar:restrictedEditingException:block",()=>this._createButton("restrictedEditingExceptionBlock",Jp)),t.add("restrictedEditingException:auto",()=>{const e=this._createButton("restrictedEditingExceptionAuto",Bp);return e.set({tooltip:true}),e}),t.add("menuBar:restrictedEditingException:auto",()=>this._createButton("restrictedEditingExceptionAuto",Jp)),t.add("restrictedEditingException",()=>t.create("restrictedEditingException:inline")),t.add("menuBar:restrictedEditingException",()=>t.create("menuBar:restrictedEditingException:inline"));}_createButton(e,t){const i=this.editor,n=i.locale,s=this.editor.commands.get(e),o=new t(n),r=n.t;return o.icon=Rm,o.isToggleable=true,o.bind("isOn","isEnabled").to(s,"value","isEnabled"),"restrictedEditingExceptionAuto"==e?o.bind("label").to(s,"value",e=>r(e?"Disable editing":"Enable editing")):"restrictedEditingExceptionBlock"==e?o.bind("label").to(s,"value",e=>r(e?"Disable block editing":"Enable block editing")):o.bind("label").to(s,"value",e=>r(e?"Disable inline editing":"Enable inline editing")),this.listenTo(o,"execute",()=>{i.execute(e),i.editing.view.focus();}),o}}class uG extends Ms{static get pluginName(){return "StandardEditingMode"}static get isOfficialPlugin(){return  true}static get requires(){return [lG,cG]}}const dG="ck-show-blocks",hG="__TEXT__",mG=(()=>[["address","ADDRESS"],["aside","ASIDE"],["blockquote","BLOCKQUOTE"],["details","DETAILS"],["div","DIV"],["footer","FOOTER"],["h1","H1"],["h2","H2"],["h3","H3"],["h4","H4"],["h5","H5"],["h6","H6"],["header","HEADER"],["main","MAIN"],["nav","NAV"],["pre","PRE"],["ol","OL"],["ul","UL"],["p","P"],["section","SECTION"],["figcaption","FIGCAPTION"]])(),gG=(()=>({ltr:`<svg width='120' height='12' xmlns='http://www.w3.org/2000/svg' ><text style='paint-order:stroke fill; clip-path: inset(-3px)' stroke='%23EAEAEA' stroke-width='13' dominant-baseline='middle' fill='black' x='3' y='7' font-size='9px' font-family='Consolas, %22Lucida Console%22, %22Lucida Sans Typewriter%22, %22DejaVu Sans Mono%22, %22Bitstream Vera Sans Mono%22, %22Liberation Mono%22, Monaco, %22Courier New%22, Courier, monospace'>${hG}</text></svg>`,rtl:`<svg width='120' height='12' xmlns='http://www.w3.org/2000/svg' ><text style='paint-order:stroke fill; clip-path: inset(-3px); transform:translate(-2px, 0)' stroke='%23EAEAEA' stroke-width='13' dominant-baseline='middle' fill='black' x='100%' text-anchor='end' y='7' font-size='9px' font-family='Consolas, %22Lucida Console%22, %22Lucida Sans Typewriter%22, %22DejaVu Sans Mono%22, %22Bitstream Vera Sans Mono%22, %22Liberation Mono%22, Monaco, %22Courier New%22, Courier, monospace'>${hG}</text></svg>`}))();class fG extends Ns{constructor(e){super(e),this.affectsData=false,this.value=false;}execute(){const e=this.editor.editing.view;e.change(t=>{for(const i of e.document.roots)i.hasClass(dG)?(t.removeClass(dG,i),this.value=false):(pG(t,i),t.addClass(dG,i),this.value=true);});}}function pG(e,t){if(!t.getStyle("--ck-show-blocks-label-address-ltr"))for(const[i,n]of mG)e.setStyle(`--ck-show-blocks-label-${i}-ltr`,bG(n,"ltr"),t),e.setStyle(`--ck-show-blocks-label-${i}-rtl`,bG(n,"rtl"),t);}function bG(e,t){return `url("data:image/svg+xml;utf8,${gG[t].replace(hG,e)}")`}class wG extends Ms{static get pluginName(){return "ShowBlocksEditing"}static get isOfficialPlugin(){return  true}init(){const{editor:e}=this;e.commands.add("showBlocks",new fG(e));}}class vG extends Ms{static get pluginName(){return "ShowBlocksUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor;e.ui.componentFactory.add("showBlocks",()=>{const e=this._createButton(Bp);return e.set({tooltip:true,icon:$f}),e}),e.ui.componentFactory.add("menuBar:showBlocks",()=>this._createButton(Jp));}_createButton(e){const t=this.editor,i=t.locale,n=t.commands.get("showBlocks"),s=new e(i),o=i.t;return s.set({label:o("Show blocks"),isToggleable:true,role:"menuitemcheckbox"}),s.bind("isEnabled").to(n),s.bind("isOn").to(n,"value",n,"isEnabled",(e,t)=>e&&t),this.listenTo(s,"execute",()=>{t.execute("showBlocks"),t.editing.view.focus();}),s}}class _G extends Ms{static get pluginName(){return "ShowBlocks"}static get isOfficialPlugin(){return  true}static get requires(){return [wG,vG]}}const yG="SourceEditingMode";class kG extends Ms{static get pluginName(){return "SourceEditing"}static get isOfficialPlugin(){return  true}static get requires(){return [Oh]}_elementReplacer;_replacedRoots;_dataFromRoots;constructor(e){super(e),this.set("isSourceEditingMode",false),this._elementReplacer=new Yt,this._replacedRoots=new Map,this._dataFromRoots=new Map,e.config.define("sourceEditing.allowCollaborationFeatures",false);}init(){this._checkCompatibility();const e=this.editor,t=e.locale.t;e.ui.componentFactory.add("sourceEditing",()=>{const e=this._createButton(Bp);return e.set({label:t("Source"),icon:Kf,tooltip:true,class:"ck-source-editing-button"}),e}),e.ui.componentFactory.add("menuBar:sourceEditing",()=>{const e=this._createButton(Jp);return e.set({label:t("Show source"),role:"menuitemcheckbox"}),e}),this._isAllowedToHandleSourceEditingMode()&&(this.on("change:isSourceEditingMode",(e,t,i)=>{i?(this._hideVisibleDialog(),this._showSourceEditing(),this._disableCommands()):(this._hideSourceEditing(),this._enableCommands());}),this.on("change:isEnabled",(e,t,i)=>this._handleReadOnlyMode(!i)),this.listenTo(e,"change:isReadOnly",(e,t,i)=>this._handleReadOnlyMode(i))),e.data.on("get",()=>{this.isSourceEditingMode&&this.updateEditorData();},{priority:"high"});}updateEditorData(){const e=this.editor,t={};for(const[e,i]of this._replacedRoots){const n=this._dataFromRoots.get(e),s=i.dataset.value;n!==s&&(t[e]=s,this._dataFromRoots.set(e,s));}Object.keys(t).length&&e.data.set(t,{batchType:{isUndoable:true},suppressErrorInCollaboration:true});}_checkCompatibility(){const e=this.editor,t=e.config.get("sourceEditing.allowCollaborationFeatures");if(!t&&e.plugins.has("RealTimeCollaborativeEditing"))throw new I("source-editing-incompatible-with-real-time-collaboration",null);!t&&["CommentsEditing","TrackChangesEditing","RevisionHistory"].some(t=>e.plugins.has(t))&&console.warn("You initialized the editor with the source editing feature and at least one of the collaboration features. Please be advised that the source editing feature may not work, and be careful when editing document source that contains markers created by the collaboration features."),e.plugins.has("RestrictedEditingModeEditing")&&console.warn("You initialized the editor with the source editing feature and restricted editing feature. Please be advised that the source editing feature may not work, and be careful when editing document source that contains markers created by the restricted editing feature.");}_showSourceEditing(){const e=this.editor,t=e.editing.view,i=e.model;i.change(e=>{e.setSelection(null),e.removeSelectionAttribute(i.document.selection.getAttributeKeys());});for(const[i,n]of t.domRoots){const s=CG(e.data.get({rootName:i})),o=ii(n.ownerDocument,"textarea",{rows:"1","aria-label":"Source code editing area"}),r=ii(n.ownerDocument,"div",{class:"ck-source-editing-area","data-value":s},[o]);o.value=s,o.setSelectionRange(0,0),o.addEventListener("input",()=>{r.dataset.value=o.value,e.ui.update();}),t.change(e=>{const n=t.document.getRoot(i);e.addClass("ck-hidden",n);}),e.ui.setEditableElement("sourceEditing:"+i,o),this._replacedRoots.set(i,r),this._elementReplacer.replace(n,r),this._dataFromRoots.set(i,s);}this._hideDocumentOutline(),this._refreshAnnotationsVisibility(),this._focusSourceEditing();}_hideSourceEditing(){const e=this.editor.editing.view;this.updateEditorData(),e.change(t=>{for(const[i]of this._replacedRoots)t.removeClass("ck-hidden",e.document.getRoot(i));}),this._elementReplacer.restore(),this._replacedRoots.clear(),this._dataFromRoots.clear(),this._showDocumentOutline(),this._refreshAnnotationsVisibility(),e.focus();}_hideDocumentOutline(){this.editor.plugins.has("DocumentOutlineUI")&&(this.editor.plugins.get("DocumentOutlineUI").view.element.style.display="none");}_showDocumentOutline(){this.editor.plugins.has("DocumentOutlineUI")&&(this.editor.plugins.get("DocumentOutlineUI").view.element.style.display="");}_refreshAnnotationsVisibility(){this.editor.plugins.has("Annotations")&&this.editor.plugins.get("Annotations").refreshVisibility();}_focusSourceEditing(){const e=this.editor,[t]=this._replacedRoots.values(),i=t.querySelector("textarea");e.editing.view.document.isFocused=false,i.focus();}_disableCommands(){const e=this.editor;for(const t of e.commands.commands())t.forceDisabled(yG);e.plugins.has("CommentsArchiveUI")&&e.plugins.get("CommentsArchiveUI").forceDisabled(yG);}_enableCommands(){const e=this.editor;for(const t of e.commands.commands())t.clearForceDisabled(yG);e.plugins.has("CommentsArchiveUI")&&e.plugins.get("CommentsArchiveUI").clearForceDisabled(yG);}_handleReadOnlyMode(e){if(this.isSourceEditingMode)for(const[,t]of this._replacedRoots)t.querySelector("textarea").readOnly=e;}_isAllowedToHandleSourceEditingMode(){const e=this.editor.ui.view.editable;return e&&!e.hasExternalElement}_hideVisibleDialog(){if(this.editor.plugins.has("Dialog")){const e=this.editor.plugins.get("Dialog");e.isOpen&&e.hide();}}_createButton(e){const t=this.editor,i=new e(t.locale);return i.set({withText:true,isToggleable:true}),i.bind("isOn").to(this,"isSourceEditingMode"),i.bind("isEnabled").to(this,"isEnabled",t,"isReadOnly",t.plugins.get(Oh),"hasAny",(e,t,i)=>!!e&&(!t&&!i)),this.listenTo(i,"execute",()=>{this.isSourceEditingMode=!this.isSourceEditingMode;}),i}}function CG(e){return function(e){return e.startsWith("<")}(e)?Hn(e):e}class xG extends Cs{tiles;focusTracker;keystrokes;constructor(t){super(t),this.tiles=this.createCollection(),this.setTemplate({tag:"div",children:[{tag:"div",attributes:{class:["ck","ck-character-grid__tiles"]},children:this.tiles}],attributes:{class:["ck","ck-character-grid"]}}),this.focusTracker=new An,this.keystrokes=new In,Rs({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.tiles,numberOfColumns:()=>exports.global.window.getComputedStyle(this.element.firstChild).getPropertyValue("grid-template-columns").split(" ").length,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection});}createTile(e,t){const i=new Bp(this.locale);return i.set({label:e,withText:true,class:"ck-character-grid__tile"}),i.extendTemplate({attributes:{title:t},on:{mouseover:i.bindTemplate.to("mouseover"),focus:i.bindTemplate.to("focus")}}),i.on("mouseover",()=>{this.fire("tileHover",{name:t,character:e});}),i.on("focus",()=>{this.fire("tileFocus",{name:t,character:e});}),i.on("execute",()=>{this.fire("execute",{name:t,character:e});}),i}render(){super.render();for(const e of this.tiles)this.focusTracker.add(e.element);this.tiles.on("change",(e,{added:t,removed:i})=>{if(t.length>0)for(const e of t)this.focusTracker.add(e.element);if(i.length>0)for(const e of i)this.focusTracker.remove(e.element);}),this.keystrokes.listenTo(this.element);}destroy(){super.destroy(),this.keystrokes.destroy();}focus(){this.tiles.first.focus();}}class AG extends Cs{constructor(e){super(e);const t=this.bindTemplate;this.set("character",null),this.set("name",null),this.bind("code").to(this,"character",EG),this.setTemplate({tag:"div",children:[{tag:"span",attributes:{class:["ck-character-info__name"]},children:[{text:t.to("name",e=>e||"​")}]},{tag:"span",attributes:{class:["ck-character-info__code"]},children:[{text:t.to("code")}]}],attributes:{class:["ck","ck-character-info"]}});}}function EG(e){if(null===e)return "";return "U+"+("0000"+e.codePointAt(0).toString(16)).slice(-4)}class TG extends Cs{items;focusTracker;keystrokes;_focusCycler;categoriesView;gridView;infoView;constructor(e,t,i,n){super(e),this.categoriesView=t,this.gridView=i,this.infoView=n,this.items=this.createCollection(),this.focusTracker=new An,this.keystrokes=new In,this._focusCycler=new Fp({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",children:[this.categoriesView,this.gridView,this.infoView],attributes:{tabindex:"-1"}}),this.items.add(this.categoriesView),this.items.add(this.gridView);}render(){super.render(),this.focusTracker.add(this.categoriesView.element),this.focusTracker.add(this.gridView.element),this.keystrokes.listenTo(this.element);}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy();}focus(){this._focusCycler.focusFirst();}}class SG extends Cs{_groupNames;_dropdownView;constructor(e,t){super(e),this.set("currentGroupName",Array.from(t.entries())[0][0]),this._groupNames=t,this._dropdownView=new Nb(e,Vw),this.setTemplate({tag:"div",attributes:{class:["ck","ck-character-categories"]},children:[this._dropdownView]});}render(){super.render(),this._setupDropdown();}focus(){this._dropdownView.focus();}_setupDropdown(){const e=new kn;for(const[t,i]of this._groupNames){const n={type:"button",model:new e_({name:t,label:i,role:"menuitemradio",withText:true})};n.model.bind("isOn").to(this,"currentGroupName",e=>e===t),e.add(n);}const t=(0, this.locale.t)("Category");this._dropdownView.set({label:t,isEmpty:false}),this._dropdownView.fieldView.panelPosition="rtl"===this.locale.uiLanguageDirection?"se":"sw",this._dropdownView.fieldView.buttonView.set({withText:true,tooltip:t,ariaLabel:t,ariaLabelledBy:void 0,isOn:false}),this._dropdownView.fieldView.buttonView.bind("label").to(this,"currentGroupName",e=>this._groupNames.get(e)),this._dropdownView.fieldView.on("execute",({source:e})=>{this.currentGroupName=e.name;}),Cw(this._dropdownView.fieldView,e,{ariaLabel:t,role:"menu"});}}const IG="All";class PG extends Ms{_characters;_groups;_allSpecialCharactersGroupLabel;static get requires(){return [by,Wp]}static get pluginName(){return "SpecialCharacters"}static get licenseFeatureCode(){return "SCH"}static get isOfficialPlugin(){return  true}static get isPremiumPlugin(){return  true}constructor(e){super(e);const t=e.t;this._characters=new Map,this._groups=new Map,this._allSpecialCharactersGroupLabel=t("All");}init(){const e=this.editor;e.ui.componentFactory.add("specialCharacters",()=>{const e=this._createDialogButton(Bp);return e.set({tooltip:true}),e}),e.ui.componentFactory.add("menuBar:specialCharacters",()=>this._createDialogButton(Jp));}addItems(e,t,i={label:e}){if(e===IG)throw new I("special-character-invalid-group-name",null);const n=this._getGroup(e,i.label);for(const e of t)n.items.add(e.title),this._characters.set(e.title,e.character);}getGroups(){const e=Array.from(this._groups.keys()),t=this.editor.config.get("specialCharacters.order")||[],i=t.find(t=>!e.includes(t));if(i)throw new I("special-character-invalid-order-group-name",null,{invalidGroup:i});return new Set([...t,...e])}getCharactersForGroup(e){if(e===IG)return new Set(this._characters.keys());const t=this._groups.get(e);return t?t.items:void 0}getCharacter(e){return this._characters.get(e)}_getGroup(e,t){return this._groups.has(e)||this._groups.set(e,{items:new Set,label:t}),this._groups.get(e)}_updateGrid(e,t){t.tiles.clear();const i=this.getCharactersForGroup(e);for(const e of i){const i=this.getCharacter(e);t.tiles.add(t.createTile(i,e));}}_createDropdownPanelContent(e){const t=Array.from(this.getGroups()).map(e=>[e,this._groups.get(e).label]),i=new Map([[IG,this._allSpecialCharactersGroupLabel],...t]),n=new SG(e,i),s=new xG(e),o=new AG(e);return s.on("tileHover",(e,t)=>{o.set(t);}),s.on("tileFocus",(e,t)=>{o.set(t);}),n.on("change:currentGroupName",(e,t,i)=>{this._updateGrid(i,s);}),this._updateGrid(n.currentGroupName,s),{categoriesView:n,gridView:s,infoView:o}}_createDialogButton(e){const t=this.editor,i=t.locale,n=new e(t.locale),s=t.commands.get("insertText"),o=i.t,r=this.editor.plugins.get("Dialog");return n.set({label:o("Special characters"),icon:Jf,isToggleable:true}),n.bind("isOn").to(r,"id",e=>"specialCharacters"===e),n.bind("isEnabled").to(s,"isEnabled"),n.on("execute",()=>{"specialCharacters"!==r.id?this._showDialog():r.hide();}),n}_showDialog(){const e=this.editor,t=e.plugins.get("Dialog"),i=e.locale,n=i.t,{categoriesView:s,gridView:o,infoView:r}=this._createDropdownPanelContent(i),a=new TG(i,s,o,r);o.on("execute",(t,i)=>{e.execute("insertText",{text:i.character});}),t.show({id:"specialCharacters",title:n("Special characters"),className:"ck-special-characters",content:a,position:Up.EDITOR_TOP_SIDE});}}class VG extends Ms{static get pluginName(){return "SpecialCharactersArrows"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Arrows",[{title:t("leftwards simple arrow"),character:"←"},{title:t("rightwards simple arrow"),character:"→"},{title:t("upwards simple arrow"),character:"↑"},{title:t("downwards simple arrow"),character:"↓"},{title:t("leftwards double arrow"),character:"⇐"},{title:t("rightwards double arrow"),character:"⇒"},{title:t("upwards double arrow"),character:"⇑"},{title:t("downwards double arrow"),character:"⇓"},{title:t("leftwards dashed arrow"),character:"⇠"},{title:t("rightwards dashed arrow"),character:"⇢"},{title:t("upwards dashed arrow"),character:"⇡"},{title:t("downwards dashed arrow"),character:"⇣"},{title:t("leftwards arrow to bar"),character:"⇤"},{title:t("rightwards arrow to bar"),character:"⇥"},{title:t("upwards arrow to bar"),character:"⤒"},{title:t("downwards arrow to bar"),character:"⤓"},{title:t("up down arrow with base"),character:"↨"},{title:t("back with leftwards arrow above"),character:"🔙"},{title:t("end with leftwards arrow above"),character:"🔚"},{title:t("on with exclamation mark with left right arrow above"),character:"🔛"},{title:t("soon with rightwards arrow above"),character:"🔜"},{title:t("top with upwards arrow above"),character:"🔝"}],{label:t("Arrows")});}}class RG extends Ms{static get pluginName(){return "SpecialCharactersText"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Text",[{character:"‹",title:t("Single left-pointing angle quotation mark")},{character:"›",title:t("Single right-pointing angle quotation mark")},{character:"«",title:t("Left-pointing double angle quotation mark")},{character:"»",title:t("Right-pointing double angle quotation mark")},{character:"‘",title:t("Left single quotation mark")},{character:"’",title:t("Right single quotation mark")},{character:"“",title:t("Left double quotation mark")},{character:"”",title:t("Right double quotation mark")},{character:"‚",title:t("Single low-9 quotation mark")},{character:"„",title:t("Double low-9 quotation mark")},{character:"¡",title:t("Inverted exclamation mark")},{character:"¿",title:t("Inverted question mark")},{character:"‥",title:t("Two dot leader")},{character:"…",title:t("Horizontal ellipsis")},{character:"‡",title:t("Double dagger")},{character:"‰",title:t("Per mille sign")},{character:"‱",title:t("Per ten thousand sign")},{character:"‼",title:t("Double exclamation mark")},{character:"⁈",title:t("Question exclamation mark")},{character:"⁉",title:t("Exclamation question mark")},{character:"⁇",title:t("Double question mark")},{character:"©",title:t("Copyright sign")},{character:"®",title:t("Registered sign")},{character:"™",title:t("Trade mark sign")},{character:"§",title:t("Section sign")},{character:"¶",title:t("Paragraph sign")},{character:"⁋",title:t("Reversed paragraph sign")}],{label:t("Text")});}}class OG extends Ms{static get pluginName(){return "SpecialCharactersMathematical"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Mathematical",[{character:"<",title:t("Less-than sign")},{character:">",title:t("Greater-than sign")},{character:"≤",title:t("Less-than or equal to")},{character:"≥",title:t("Greater-than or equal to")},{character:"–",title:t("En dash")},{character:"—",title:t("Em dash")},{character:"¯",title:t("Macron")},{character:"‾",title:t("Overline")},{character:"°",title:t("Degree sign")},{character:"−",title:t("Minus sign")},{character:"±",title:t("Plus-minus sign")},{character:"÷",title:t("Division sign")},{character:"⁄",title:t("Fraction slash")},{character:"×",title:t("Multiplication sign")},{character:"ƒ",title:t("Latin small letter f with hook")},{character:"∫",title:t("Integral")},{character:"∑",title:t("N-ary summation")},{character:"∞",title:t("Infinity")},{character:"√",title:t("Square root")},{character:"∼",title:t("Tilde operator")},{character:"≅",title:t("Approximately equal to")},{character:"≈",title:t("Almost equal to")},{character:"≠",title:t("Not equal to")},{character:"≡",title:t("Identical to")},{character:"∈",title:t("Element of")},{character:"∉",title:t("Not an element of")},{character:"∋",title:t("Contains as member")},{character:"∏",title:t("N-ary product")},{character:"∧",title:t("Logical and")},{character:"∨",title:t("Logical or")},{character:"¬",title:t("Not sign")},{character:"∩",title:t("Intersection")},{character:"∪",title:t("Union")},{character:"∂",title:t("Partial differential")},{character:"∀",title:t("For all")},{character:"∃",title:t("There exists")},{character:"∅",title:t("Empty set")},{character:"∇",title:t("Nabla")},{character:"∗",title:t("Asterisk operator")},{character:"∝",title:t("Proportional to")},{character:"∠",title:t("Angle")},{character:"¼",title:t("Vulgar fraction one quarter")},{character:"½",title:t("Vulgar fraction one half")},{character:"¾",title:t("Vulgar fraction three quarters")}],{label:t("Mathematical")});}}class BG extends Ms{static get pluginName(){return "SpecialCharactersLatin"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Latin",[{character:"Ā",title:t("Latin capital letter a with macron")},{character:"ā",title:t("Latin small letter a with macron")},{character:"Ă",title:t("Latin capital letter a with breve")},{character:"ă",title:t("Latin small letter a with breve")},{character:"Ą",title:t("Latin capital letter a with ogonek")},{character:"ą",title:t("Latin small letter a with ogonek")},{character:"Ć",title:t("Latin capital letter c with acute")},{character:"ć",title:t("Latin small letter c with acute")},{character:"Ĉ",title:t("Latin capital letter c with circumflex")},{character:"ĉ",title:t("Latin small letter c with circumflex")},{character:"Ċ",title:t("Latin capital letter c with dot above")},{character:"ċ",title:t("Latin small letter c with dot above")},{character:"Č",title:t("Latin capital letter c with caron")},{character:"č",title:t("Latin small letter c with caron")},{character:"Ď",title:t("Latin capital letter d with caron")},{character:"ď",title:t("Latin small letter d with caron")},{character:"Đ",title:t("Latin capital letter d with stroke")},{character:"đ",title:t("Latin small letter d with stroke")},{character:"Ē",title:t("Latin capital letter e with macron")},{character:"ē",title:t("Latin small letter e with macron")},{character:"Ĕ",title:t("Latin capital letter e with breve")},{character:"ĕ",title:t("Latin small letter e with breve")},{character:"Ė",title:t("Latin capital letter e with dot above")},{character:"ė",title:t("Latin small letter e with dot above")},{character:"Ę",title:t("Latin capital letter e with ogonek")},{character:"ę",title:t("Latin small letter e with ogonek")},{character:"Ě",title:t("Latin capital letter e with caron")},{character:"ě",title:t("Latin small letter e with caron")},{character:"Ĝ",title:t("Latin capital letter g with circumflex")},{character:"ĝ",title:t("Latin small letter g with circumflex")},{character:"Ğ",title:t("Latin capital letter g with breve")},{character:"ğ",title:t("Latin small letter g with breve")},{character:"Ġ",title:t("Latin capital letter g with dot above")},{character:"ġ",title:t("Latin small letter g with dot above")},{character:"Ģ",title:t("Latin capital letter g with cedilla")},{character:"ģ",title:t("Latin small letter g with cedilla")},{character:"Ĥ",title:t("Latin capital letter h with circumflex")},{character:"ĥ",title:t("Latin small letter h with circumflex")},{character:"Ħ",title:t("Latin capital letter h with stroke")},{character:"ħ",title:t("Latin small letter h with stroke")},{character:"Ĩ",title:t("Latin capital letter i with tilde")},{character:"ĩ",title:t("Latin small letter i with tilde")},{character:"Ī",title:t("Latin capital letter i with macron")},{character:"ī",title:t("Latin small letter i with macron")},{character:"Ĭ",title:t("Latin capital letter i with breve")},{character:"ĭ",title:t("Latin small letter i with breve")},{character:"Į",title:t("Latin capital letter i with ogonek")},{character:"į",title:t("Latin small letter i with ogonek")},{character:"İ",title:t("Latin capital letter i with dot above")},{character:"ı",title:t("Latin small letter dotless i")},{character:"Ĳ",title:t("Latin capital ligature ij")},{character:"ĳ",title:t("Latin small ligature ij")},{character:"Ĵ",title:t("Latin capital letter j with circumflex")},{character:"ĵ",title:t("Latin small letter j with circumflex")},{character:"Ķ",title:t("Latin capital letter k with cedilla")},{character:"ķ",title:t("Latin small letter k with cedilla")},{character:"ĸ",title:t("Latin small letter kra")},{character:"Ĺ",title:t("Latin capital letter l with acute")},{character:"ĺ",title:t("Latin small letter l with acute")},{character:"Ļ",title:t("Latin capital letter l with cedilla")},{character:"ļ",title:t("Latin small letter l with cedilla")},{character:"Ľ",title:t("Latin capital letter l with caron")},{character:"ľ",title:t("Latin small letter l with caron")},{character:"Ŀ",title:t("Latin capital letter l with middle dot")},{character:"ŀ",title:t("Latin small letter l with middle dot")},{character:"Ł",title:t("Latin capital letter l with stroke")},{character:"ł",title:t("Latin small letter l with stroke")},{character:"Ń",title:t("Latin capital letter n with acute")},{character:"ń",title:t("Latin small letter n with acute")},{character:"Ņ",title:t("Latin capital letter n with cedilla")},{character:"ņ",title:t("Latin small letter n with cedilla")},{character:"Ň",title:t("Latin capital letter n with caron")},{character:"ň",title:t("Latin small letter n with caron")},{character:"ŉ",title:t("Latin small letter n preceded by apostrophe")},{character:"Ŋ",title:t("Latin capital letter eng")},{character:"ŋ",title:t("Latin small letter eng")},{character:"Ō",title:t("Latin capital letter o with macron")},{character:"ō",title:t("Latin small letter o with macron")},{character:"Ŏ",title:t("Latin capital letter o with breve")},{character:"ŏ",title:t("Latin small letter o with breve")},{character:"Ő",title:t("Latin capital letter o with double acute")},{character:"ő",title:t("Latin small letter o with double acute")},{character:"Œ",title:t("Latin capital ligature oe")},{character:"œ",title:t("Latin small ligature oe")},{character:"Ŕ",title:t("Latin capital letter r with acute")},{character:"ŕ",title:t("Latin small letter r with acute")},{character:"Ŗ",title:t("Latin capital letter r with cedilla")},{character:"ŗ",title:t("Latin small letter r with cedilla")},{character:"Ř",title:t("Latin capital letter r with caron")},{character:"ř",title:t("Latin small letter r with caron")},{character:"Ś",title:t("Latin capital letter s with acute")},{character:"ś",title:t("Latin small letter s with acute")},{character:"Ŝ",title:t("Latin capital letter s with circumflex")},{character:"ŝ",title:t("Latin small letter s with circumflex")},{character:"Ş",title:t("Latin capital letter s with cedilla")},{character:"ş",title:t("Latin small letter s with cedilla")},{character:"Š",title:t("Latin capital letter s with caron")},{character:"š",title:t("Latin small letter s with caron")},{character:"Ţ",title:t("Latin capital letter t with cedilla")},{character:"ţ",title:t("Latin small letter t with cedilla")},{character:"Ť",title:t("Latin capital letter t with caron")},{character:"ť",title:t("Latin small letter t with caron")},{character:"Ŧ",title:t("Latin capital letter t with stroke")},{character:"ŧ",title:t("Latin small letter t with stroke")},{character:"Ũ",title:t("Latin capital letter u with tilde")},{character:"ũ",title:t("Latin small letter u with tilde")},{character:"Ū",title:t("Latin capital letter u with macron")},{character:"ū",title:t("Latin small letter u with macron")},{character:"Ŭ",title:t("Latin capital letter u with breve")},{character:"ŭ",title:t("Latin small letter u with breve")},{character:"Ů",title:t("Latin capital letter u with ring above")},{character:"ů",title:t("Latin small letter u with ring above")},{character:"Ű",title:t("Latin capital letter u with double acute")},{character:"ű",title:t("Latin small letter u with double acute")},{character:"Ų",title:t("Latin capital letter u with ogonek")},{character:"ų",title:t("Latin small letter u with ogonek")},{character:"Ŵ",title:t("Latin capital letter w with circumflex")},{character:"ŵ",title:t("Latin small letter w with circumflex")},{character:"Ŷ",title:t("Latin capital letter y with circumflex")},{character:"ŷ",title:t("Latin small letter y with circumflex")},{character:"Ÿ",title:t("Latin capital letter y with diaeresis")},{character:"Ź",title:t("Latin capital letter z with acute")},{character:"ź",title:t("Latin small letter z with acute")},{character:"Ż",title:t("Latin capital letter z with dot above")},{character:"ż",title:t("Latin small letter z with dot above")},{character:"Ž",title:t("Latin capital letter z with caron")},{character:"ž",title:t("Latin small letter z with caron")},{character:"ſ",title:t("Latin small letter long s")}],{label:t("Latin")});}}class LG extends Ms{static get pluginName(){return "SpecialCharactersCurrency"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Currency",[{character:"$",title:t("Dollar sign")},{character:"€",title:t("Euro sign")},{character:"¥",title:t("Yen sign")},{character:"£",title:t("Pound sign")},{character:"¢",title:t("Cent sign")},{character:"₠",title:t("Euro-currency sign")},{character:"₡",title:t("Colon sign")},{character:"₢",title:t("Cruzeiro sign")},{character:"₣",title:t("French franc sign")},{character:"₤",title:t("Lira sign")},{character:"¤",title:t("Currency sign")},{character:"₿",title:t("Bitcoin sign")},{character:"₥",title:t("Mill sign")},{character:"₦",title:t("Naira sign")},{character:"₧",title:t("Peseta sign")},{character:"₨",title:t("Rupee sign")},{character:"₩",title:t("Won sign")},{character:"₪",title:t("New sheqel sign")},{character:"₫",title:t("Dong sign")},{character:"₭",title:t("Kip sign")},{character:"₮",title:t("Tugrik sign")},{character:"₯",title:t("Drachma sign")},{character:"₰",title:t("German penny sign")},{character:"₱",title:t("Peso sign")},{character:"₲",title:t("Guarani sign")},{character:"₳",title:t("Austral sign")},{character:"₴",title:t("Hryvnia sign")},{character:"₵",title:t("Cedi sign")},{character:"₶",title:t("Livre tournois sign")},{character:"₷",title:t("Spesmilo sign")},{character:"₸",title:t("Tenge sign")},{character:"₹",title:t("Indian rupee sign")},{character:"₺",title:t("Turkish lira sign")},{character:"₻",title:t("Nordic mark sign")},{character:"₼",title:t("Manat sign")},{character:"₽",title:t("Ruble sign")}],{label:t("Currency")});}}class MG extends Ms{static get pluginName(){return "SpecialCharactersEssentials"}static get isOfficialPlugin(){return  true}static get requires(){return [LG,RG,OG,VG,BG]}}class FG extends Bp{styleDefinition;previewView;constructor(e,t){super(e),this.styleDefinition=t,this.previewView=this._createPreview(),this.set({label:t.name,class:"ck-style-grid__button",withText:true}),this.extendTemplate({attributes:{role:"option"}}),this.children.add(this.previewView,0);}_createPreview(){const e=new Cs(this.locale);return e.setTemplate({tag:"div",attributes:{class:["ck","ck-reset_all-excluded","ck-style-grid__button__preview","ck-content"],"aria-hidden":"true"},children:[this.styleDefinition.previewTemplate]}),e}}class NG extends Cs{focusTracker;keystrokes;children;constructor(e,t){super(e),this.focusTracker=new An,this.keystrokes=new In,this.set("activeStyles",[]),this.set("enabledStyles",[]),this.children=this.createCollection(),this.children.delegate("execute").to(this);for(const i of t){const t=new FG(e,i);this.children.add(t);}this.on("change:activeStyles",()=>{for(const e of this.children)e.isOn=this.activeStyles.includes(e.styleDefinition.name);}),this.on("change:enabledStyles",()=>{for(const e of this.children)e.isEnabled=this.enabledStyles.includes(e.styleDefinition.name);}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-grid"],role:"listbox"},children:this.children});}render(){super.render();for(const e of this.children)this.focusTracker.add(e.element);Rs({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.children,numberOfColumns:3,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection}),this.keystrokes.listenTo(this.element);}focus(){this.children.first.focus();}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy();}}class DG extends Cs{gridView;labelView;constructor(e,t,i){super(e),this.labelView=new Os(e),this.labelView.text=t,this.gridView=new NG(e,i),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-panel__style-group"],role:"group","aria-labelledby":this.labelView.id},children:[this.labelView,this.gridView]});}}class zG extends Cs{focusTracker;keystrokes;children;blockStylesGroupView;inlineStylesGroupView;_focusables;_focusCycler;constructor(e,t){super(e);const i=e.t;this.focusTracker=new An,this.keystrokes=new In,this.children=this.createCollection(),this.blockStylesGroupView=new DG(e,i("Block styles"),t.block),this.inlineStylesGroupView=new DG(e,i("Text styles"),t.inline),this.set("activeStyles",[]),this.set("enabledStyles",[]),this._focusables=new Xn,this._focusCycler=new Fp({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:["shift + tab"],focusNext:["tab"]}}),t.block.length&&this.children.add(this.blockStylesGroupView),t.inline.length&&this.children.add(this.inlineStylesGroupView),this.blockStylesGroupView.gridView.delegate("execute").to(this),this.inlineStylesGroupView.gridView.delegate("execute").to(this),this.blockStylesGroupView.gridView.bind("activeStyles","enabledStyles").to(this,"activeStyles","enabledStyles"),this.inlineStylesGroupView.gridView.bind("activeStyles","enabledStyles").to(this,"activeStyles","enabledStyles"),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-panel"]},children:this.children});}render(){super.render(),this._focusables.add(this.blockStylesGroupView.gridView),this._focusables.add(this.inlineStylesGroupView.gridView),this.focusTracker.add(this.blockStylesGroupView.gridView.element),this.focusTracker.add(this.inlineStylesGroupView.gridView.element),this.keystrokes.listenTo(this.element);}focus(){this._focusCycler.focusFirst();}focusLast(){this._focusCycler.focusLast();}}const HG=["caption","colgroup","dd","dt","figcaption","legend","li","optgroup","option","rp","rt","summary","tbody","td","tfoot","th","thead","tr"];class qG extends Ms{_htmlSupport;static get pluginName(){return "StyleUtils"}static get isOfficialPlugin(){return  true}constructor(e){super(e),this.decorate("isStyleEnabledForBlock"),this.decorate("isStyleActiveForBlock"),this.decorate("getAffectedBlocks"),this.decorate("isStyleEnabledForInlineSelection"),this.decorate("isStyleActiveForInlineSelection"),this.decorate("getAffectedInlineSelectable"),this.decorate("getStylePreview"),this.decorate("configureGHSDataFilter");}init(){this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport");}normalizeConfig(e,t=[]){const i={block:[],inline:[]};for(const n of t){const t=[],s=[];for(const i of e.getDefinitionsForView(n.element)){const e="appliesToBlock"in i&&i.appliesToBlock;if(i.isBlock||e){if("string"==typeof e)t.push(e);else if(i.isBlock){const e=i;t.push(i.model),e.paragraphLikeModel&&t.push(e.paragraphLikeModel);}}else s.push(i.model);}const o=this.getStylePreview(n,[{text:"AaBbCcDdEeFfGgHhIiJj"}]);t.length?i.block.push({...n,previewTemplate:o,modelElements:t,isBlock:true}):i.inline.push({...n,previewTemplate:o,ghsAttributes:s});}return i}isStyleEnabledForBlock(e,t){const i=this.editor.model,n=this._htmlSupport.getGhsAttributeNameForElement(e.element);return !!i.schema.checkAttribute(t,n)&&e.modelElements.includes(t.name)}isStyleActiveForBlock(e,t){const i=this._htmlSupport.getGhsAttributeNameForElement(e.element),n=t.getAttribute(i);return this.hasAllClasses(n,e.classes)}getAffectedBlocks(e,t){return e.modelElements.includes(t.name)?[t]:null}isStyleEnabledForInlineSelection(e,t){const i=this.editor.model;for(const n of e.ghsAttributes)if(i.schema.checkAttributeInSelection(t,n))return  true;return  false}isStyleActiveForInlineSelection(e,t){for(const i of e.ghsAttributes){const n=this._getValueFromFirstAllowedNode(t,i);if(this.hasAllClasses(n,e.classes))return  true}return  false}getAffectedInlineSelectable(e,t){return t}getStylePreview(e,t){const{element:i,classes:n}=e;return {tag:(s=i,HG.includes(s)?"div":i),attributes:{class:n},children:t};var s;}hasAllClasses(e,t){return ne(e)&&(i=e,Boolean(i.classes)&&Array.isArray(i.classes))&&t.every(t=>e.classes.includes(t));var i;}configureGHSDataFilter({block:e,inline:t}){const i=this.editor.plugins.get("DataFilter");i.loadAllowedConfig(e.map(UG)),i.loadAllowedConfig(t.map(UG));}_getValueFromFirstAllowedNode(e,t){const i=this.editor.model.schema;if(e.isCollapsed)return e.getAttribute(t);for(const n of e.getRanges())for(const e of n.getItems())if(i.checkAttribute(e,t))return e.getAttribute(t);return null}}function UG({element:e,classes:t}){return {name:e,classes:t}}class jG extends Ms{static get pluginName(){return "StyleUI"}static get isOfficialPlugin(){return  true}static get requires(){return [qG]}init(){const e=this.editor,t=e.plugins.get("DataSchema"),i=e.plugins.get("StyleUtils"),n=e.config.get("style.definitions"),s=i.normalizeConfig(t,n);e.ui.componentFactory.add("style",t=>{const i=t.t,n=ww(t),o=e.commands.get("style");return n.once("change:isOpen",()=>{const e=new zG(t,s);n.panelView.children.add(e),e.delegate("execute").to(n),e.bind("activeStyles").to(o,"value"),e.bind("enabledStyles").to(o,"enabledStyles");}),n.bind("isEnabled").to(o),n.buttonView.withText=true,n.buttonView.bind("label").to(o,"value",e=>e.length>1?i("Multiple styles"):1===e.length?e[0]:i("Styles")),n.bind("class").to(o,"value",e=>{const t=["ck-style-dropdown"];return e.length>1&&t.push("ck-style-dropdown_multiple-active"),t.join(" ")}),n.on("execute",t=>{e.execute("style",{styleName:t.source.styleDefinition.name}),e.editing.view.focus();}),n});}}class $G extends Ns{_styleDefinitions;_styleUtils;constructor(e,t){super(e),this.set("value",[]),this.set("enabledStyles",[]),this._styleDefinitions=t,this._styleUtils=this.editor.plugins.get(qG);}refresh(){const e=this.editor.model,t=e.document.selection,i=new Set,n=new Set;for(const e of this._styleDefinitions.inline)this._styleUtils.isStyleEnabledForInlineSelection(e,t)&&n.add(e.name),this._styleUtils.isStyleActiveForInlineSelection(e,t)&&i.add(e.name);const s=Cn(t.getSelectedBlocks())||t.getFirstPosition().parent;if(s){const t=s.getAncestors({includeSelf:true,parentFirst:true});for(const s of t){if(s.is("rootElement"))break;for(const e of this._styleDefinitions.block)this._styleUtils.isStyleEnabledForBlock(e,s)&&(n.add(e.name),this._styleUtils.isStyleActiveForBlock(e,s)&&i.add(e.name));if(e.schema.isObject(s))break}}this.enabledStyles=Array.from(n).sort(),this.isEnabled=this.enabledStyles.length>0,this.value=this.isEnabled?Array.from(i).sort():[];}execute({styleName:e,forceValue:t}){if(!this.enabledStyles.includes(e))return void P("style-command-executed-with-incorrect-style-name");const i=this.editor.model,n=i.document.selection,s=this.editor.plugins.get("GeneralHtmlSupport"),o=[...this._styleDefinitions.inline,...this._styleDefinitions.block],r=o.filter(({name:e})=>this.value.includes(e)),a=o.find(({name:t})=>t==e),l=void 0===t?!this.value.includes(a.name):t;i.change(()=>{let e;e=function(e){return "isBlock"in e}(a)?this._findAffectedBlocks(function(e){const t=Array.from(e.getSelectedBlocks());if(t.length)return t;return [e.getFirstPosition().parent]}(n),a):[this._styleUtils.getAffectedInlineSelectable(a,n)];for(const t of e)l?s.addModelHtmlClass(a.element,a.classes,t):s.removeModelHtmlClass(a.element,WG(r,a),t);});}_findAffectedBlocks(e,t){const i=new Set;for(const n of e){const e=n.getAncestors({includeSelf:true,parentFirst:true});for(const n of e){if(n.is("rootElement"))break;const e=this._styleUtils.getAffectedBlocks(t,n);if(e){for(const t of e)i.add(t);break}}}return i}}function WG(e,t){return e.reduce((e,i)=>i.name===t.name?e:e.filter(e=>!i.classes.includes(e)),t.classes)}class GG extends Ms{_listUtils;_styleUtils;_htmlSupport;static get pluginName(){return "ListStyleSupport"}static get isOfficialPlugin(){return  true}static get requires(){return [qG,pR]}init(){const e=this.editor;e.plugins.has("ListEditing")&&(this._styleUtils=e.plugins.get(qG),this._listUtils=this.editor.plugins.get("ListUtils"),this._htmlSupport=this.editor.plugins.get(pR),this.listenTo(this._styleUtils,"isStyleEnabledForBlock",(e,[t,i])=>{this._isStyleEnabledForBlock(t,i)&&(e.return=true,e.stop());},{priority:"high"}),this.listenTo(this._styleUtils,"isStyleActiveForBlock",(e,[t,i])=>{this._isStyleActiveForBlock(t,i)&&(e.return=true,e.stop());},{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedBlocks",(e,[t,i])=>{const n=this._getAffectedBlocks(t,i);n&&(e.return=n,e.stop());},{priority:"high"}),this.listenTo(this._styleUtils,"getStylePreview",(e,[t,i])=>{const n=this._getStylePreview(t,i);n&&(e.return=n,e.stop());},{priority:"high"}));}_isStyleEnabledForBlock(e,t){const i=this.editor.model;if(!["ol","ul","li"].includes(e.element))return  false;if(!this._listUtils.isListItemBlock(t))return  false;const n=this._htmlSupport.getGhsAttributeNameForElement(e.element);if("ol"==e.element||"ul"==e.element){if(!i.schema.checkAttribute(t,n))return  false;const s=this._listUtils.isNumberedListType(t.getAttribute("listType"))?"ol":"ul";return e.element==s}return i.schema.checkAttribute(t,n)}_isStyleActiveForBlock(e,t){const i=this._htmlSupport.getGhsAttributeNameForElement(e.element),n=t.getAttribute(i);return this._styleUtils.hasAllClasses(n,e.classes)}_getAffectedBlocks(e,t){return this._isStyleEnabledForBlock(e,t)?"li"==e.element?this._listUtils.expandListBlocksToCompleteItems(t,{withNested:false}):this._listUtils.expandListBlocksToCompleteList(t):null}_getStylePreview(e,t){const{element:i,classes:n}=e;return "ol"==i||"ul"==i?{tag:i,attributes:{class:n},children:[{tag:"li",children:t}]}:"li"==i?{tag:"ol",children:[{tag:i,attributes:{class:n},children:t}]}:null}}class KG extends Ms{_tableUtils;_styleUtils;static get pluginName(){return "TableStyleSupport"}static get isOfficialPlugin(){return  true}static get requires(){return [qG]}init(){const e=this.editor;e.plugins.has("TableEditing")&&(this._styleUtils=e.plugins.get(qG),this._tableUtils=this.editor.plugins.get("TableUtils"),this.listenTo(this._styleUtils,"isStyleEnabledForBlock",(e,[t,i])=>{this._isApplicable(t,i)&&(e.return=this._isStyleEnabledForBlock(t,i),e.stop());},{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedBlocks",(e,[t,i])=>{this._isApplicable(t,i)&&(e.return=this._getAffectedBlocks(t,i),e.stop());},{priority:"high"}),this.listenTo(this._styleUtils,"configureGHSDataFilter",(e,[{block:t}])=>{this.editor.plugins.get("DataFilter").loadAllowedConfig(t.filter(e=>"figcaption"==e.element).map(e=>({name:"caption",classes:e.classes})));}));}_isApplicable(e,t){return ["td","th"].includes(e.element)?"tableCell"==t.name:!!["thead","tbody","tfoot"].includes(e.element)&&"table"==t.name}_isStyleEnabledForBlock(e,t){if(["td","th"].includes(e.element)){const i=this._tableUtils.getCellLocation(t),n=t.parent.parent,s=n.getAttribute("headingRows")||0,o=n.getAttribute("headingColumns")||0,r=i.row<s||i.column<o;return "th"==e.element?r:!r}if(["thead","tbody","tfoot"].includes(e.element)){const i=t.getAttribute("headingRows")||0,n=t.getAttribute("footerRows")||0;return "thead"==e.element?i>0:"tfoot"==e.element?n>0:i+n<this._tableUtils.getRows(t)}return  false}_getAffectedBlocks(e,t){return this._isStyleEnabledForBlock(e,t)?[t]:null}}class JG extends Ms{_styleUtils;_htmlSupport;static get pluginName(){return "LinkStyleSupport"}static get isOfficialPlugin(){return  true}static get requires(){return [qG,pR]}init(){const e=this.editor;e.plugins.has("LinkEditing")&&(this._styleUtils=e.plugins.get(qG),this._htmlSupport=this.editor.plugins.get(pR),this.listenTo(this._styleUtils,"isStyleEnabledForInlineSelection",(e,[t,i])=>{"a"==t.element&&(e.return=this._isStyleEnabled(t,i),e.stop());},{priority:"high"}),this.listenTo(this._styleUtils,"isStyleActiveForInlineSelection",(e,[t,i])=>{"a"==t.element&&(e.return=this._isStyleActive(t,i),e.stop());},{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedInlineSelectable",(e,[t,i])=>{if("a"!=t.element)return;const n=this._getAffectedSelectable(t,i);n&&(e.return=n,e.stop());},{priority:"high"}));}_isStyleEnabled(e,t){const i=this.editor.model;if(t.isCollapsed)return t.hasAttribute("linkHref");for(const e of t.getRanges())for(const t of e.getItems())if((t.is("$textProxy")||i.schema.isInline(t))&&t.hasAttribute("linkHref"))return  true;return  false}_isStyleActive(e,t){const i=this.editor.model,n=this._htmlSupport.getGhsAttributeNameForElement(e.element);if(t.isCollapsed){if(t.hasAttribute("linkHref")){const i=t.getAttribute(n);if(this._styleUtils.hasAllClasses(i,e.classes))return  true}return  false}for(const s of t.getRanges())for(const t of s.getItems())if((t.is("$textProxy")||i.schema.isInline(t))&&t.hasAttribute("linkHref")){const i=t.getAttribute(n);return this._styleUtils.hasAllClasses(i,e.classes)}return  false}_getAffectedSelectable(e,t){const i=this.editor.model;if(t.isCollapsed){const e=t.getAttribute("linkHref");return Ly(t.getFirstPosition(),"linkHref",e,i)}const n=[];for(const e of t.getRanges()){const t=i.createRange(QG(e.start,"linkHref",true,i),QG(e.end,"linkHref",false,i));for(const e of t.getItems())(e.is("$textProxy")||i.schema.isInline(e))&&e.hasAttribute("linkHref")&&n.push(this.editor.model.createRangeOn(e));}return function(e){for(let t=1;t<e.length;t++){const i=e[t-1].getJoined(e[t]);i&&e.splice(--t,2,i);}return e}(n)}}function QG(e,t,i,n){const s=e.textNode||(i?e.nodeAfter:e.nodeBefore);if(!s||!s.hasAttribute(t))return e;return My(e,t,s.getAttribute(t),i,n)}class YG extends Ms{static get pluginName(){return "StyleEditing"}static get isOfficialPlugin(){return  true}static get requires(){return [pR,qG,GG,KG,JG]}init(){const e=this.editor,t=e.plugins.get("DataSchema"),i=e.plugins.get("StyleUtils"),n=e.config.get("style.definitions"),s=i.normalizeConfig(t,n);e.commands.add("style",new $G(e,s)),i.configureGHSDataFilter(s);}}class ZG extends Ms{static get pluginName(){return "Style"}static get isOfficialPlugin(){return  true}static get requires(){return [YG,jG]}}function XG(e,t){const{modelAttribute:i,styleName:n,attributeName:s,attributeType:o,viewElement:r,defaultValue:a,shouldUpcast:l=()=>true,reduceBoxSides:c=false}=t;e.for("upcast").attributeToAttribute({view:{name:r,styles:{[n]:/[\s\S]+/}},model:{key:i,value:(e,t,i)=>{if(!l(e))return;const s=nK(a,"",i),o=e.getNormalizedStyle(n),r=c?sK(o):o;if(s!==r)return r;t.consumable.consume(e,{styles:n});}}}),s&&e.for("upcast").attributeToAttribute({view:{name:r,attributes:{[s]:/.+/}},model:{key:i,value:(e,t,i)=>{if("figure"==e.name||e.hasStyle(n)||"table"==e.name&&"figure"==e.parent.name&&e.parent.hasStyle(n))return;const r=nK(a,"",i);let l=e.getAttribute(s);if(l&&"length"==o){const e=parseFloat(l);l=isNaN(e)?r:e+(l.includes("%")?"%":"px");}if(r!==l)return l;t.consumable.consume(e,{attributes:s});}}});}function eK(e,t,i,n){const{conversion:s}=e;s.for("upcast").add(e=>{e.on(`element:${t}`,(e,t,s)=>{const{modelRange:o,viewItem:r}=t;if(!o)return;const a=["border-top-width","border-top-color","border-top-style","border-bottom-width","border-bottom-color","border-bottom-style","border-right-width","border-right-color","border-right-style","border-left-width","border-left-color","border-left-style"].filter(e=>r.hasStyle(e)),l=r.is("element","table")?r:r.findAncestor("table"),c=l.hasAttribute("border");if(!a.length&&!c)return;const u={styles:a};if(!s.consumable.test(r,u))return;const d=Cn(o.getItems({shallow:true})),h=d.findAncestor("table",{includeSelf:true});let m=n;h&&"layout"==h.getAttribute("tableType")&&(m={style:"none",color:"",width:""}),s.consumable.consume(r,u);const g={style:r.getNormalizedStyle("border-style"),color:r.getNormalizedStyle("border-color"),width:r.getNormalizedStyle("border-width")};if(c&&s.consumable.test(l,{attributes:"border"})){const e=parseFloat(l.getAttribute("border")||"1"),t=Number.isNaN(e)||!Number.isFinite(e)||e<0||"table"!=r.name&&e>1?"1px":`${e}px`;g.width={top:t,bottom:t,right:t,left:t,...g.width||{}},r.is("element","table")&&s.consumable.consume(l,{attributes:"border"});}const f={style:sK(g.style),color:sK(g.color),width:sK(g.width)};f.style!==m.style&&s.writer.setAttribute(i.style,f.style,d),f.color!==m.color&&s.writer.setAttribute(i.color,f.color,d),f.width!==m.width&&s.writer.setAttribute(i.width,f.width,d);});});}function tK(e,t){const{modelElement:i,modelAttribute:n,styleName:s}=t;e.for("downcast").attributeToAttribute({model:{name:i,key:n},view:e=>({key:"style",value:{[s]:e}})});}function iK(e,t){const{modelAttribute:i,styleName:n}=t;e.for("downcast").add(e=>{e.on(`attribute:${i}:table`,(e,t,i)=>{const{item:s,attributeNewValue:o}=t,{mapper:r,writer:a}=i;if(!i.consumable.consume(t.item,e.name))return;const l=Array.from(r.toViewElement(s).getChildren()).find(e=>e.is("element","table"));o?a.setStyle(n,o,l):a.removeStyle(n,l);});});}function nK(e,t,i){const n=i.modelRange&&Cn(i.modelRange.getItems({shallow:true})),s=n&&n.is("element")&&n.findAncestor("table",{includeSelf:true});return s&&"layout"===s.getAttribute("tableType")?t:e}function sK(e){if(!e)return;const t=["top","right","bottom","left"];if(!t.every(t=>e[t]))return e;const i=e.top;return t.every(t=>e[t]===i)?i:e}function oK(e,t,i){const{conversion:n}=e;n.for("upcast").add(e=>{e.on(`element:${t}`,(e,t,n)=>{const{modelRange:s,viewItem:o}=t;if(!s)return;if(o.is("element","table"))return void n.consumable.consume(o,{attributes:"cellpadding"});const r=o.findAncestor("table");if(!r.hasAttribute("cellpadding")||!n.consumable.test(r,{attributes:"cellpadding"}))return;const a=s?.start?.nodeAfter,l=parseFloat(r.getAttribute("cellpadding")||"1"),c=Number.isNaN(l)||!Number.isFinite(l)||l<0?"0px":`${l}px`,u=a.getAttribute("tableCellPadding");if(u){if("object"==typeof u){const e={...i!==c&&{top:c},...i!==c&&{right:c},...i!==c&&{bottom:c},...i!==c&&{left:c},...u};n.writer.setAttribute("tableCellPadding",e,a);}}else i!==c&&n.writer.setAttribute("tableCellPadding",c,a);},{priority:"low"});});}const rK={className:"table-style-align-left"},aK={className:"table-style-align-center"},lK={className:"table-style-align-right"},cK={className:"table-style-block-align-left"},uK={className:"table-style-block-align-right"},dK=[{view:{name:/^(table|figure)$/,styles:{float:/^(left|none|right)$/}},getAlign:e=>{let t=e.getStyle("float");return "none"===t&&(t="center"),t},getConsumables(e){const t=e.getStyle("float"),i=["float"];return "left"===t&&e.hasStyle("margin-right")?i.push("margin-right"):"right"===t&&e.hasStyle("margin-left")&&i.push("margin-left"),{styles:i}}},{view:{name:/^(table|figure)$/,styles:{"margin-left":"auto","margin-right":"auto"}},getAlign:()=>"center",getConsumables:()=>({styles:["margin-left","margin-right"]})},{view:{name:/^(table|figure)$/,key:"class",value:"table-style-align-left"},getAlign:()=>"left",getConsumables:()=>({classes:rK.className})},{view:{name:/^(table|figure)$/,key:"class",value:lK.className},getAlign:()=>"right",getConsumables:()=>({classes:lK.className})},{view:{name:/^(table|figure)$/,key:"class",value:aK.className},getAlign:()=>"center",getConsumables:()=>({classes:aK.className})},{view:{name:/^(table|figure)$/,key:"class",value:cK.className},getAlign:()=>"blockLeft",getConsumables:()=>({classes:cK.className})},{view:{name:/^(table|figure)$/,key:"class",value:uK.className},getAlign:()=>"blockRight",getConsumables:()=>({classes:uK.className})},{view:{name:/^(table|figure)$/,styles:{"margin-left":"0","margin-right":"auto"}},getAlign:()=>"blockLeft",getConsumables:()=>({styles:["margin-left","margin-right"]})},{view:{name:/^(table|figure)$/,styles:{"margin-left":"auto","margin-right":"0"}},getAlign:()=>"blockRight",getConsumables:()=>({styles:["margin-left","margin-right"]})},{view:{name:"table",attributes:{align:/^(left|center|right)$/}},getAlign:e=>e.getAttribute("align"),getConsumables:()=>({attributes:"align"})}],hK={center:{align:"center",style:"margin-left: auto; margin-right: auto;",className:"table-style-align-center"},left:{align:"left",style:"float: left;",className:"table-style-align-left"},right:{align:"right",style:"float: right;",className:"table-style-align-right"},blockLeft:{align:void 0,style:"margin-left: 0; margin-right: auto;",className:cK.className},blockRight:{align:void 0,style:"margin-left: auto; margin-right: 0;",className:uK.className}};class mK{_table;_startRow;_endRow;_startColumn;_endColumn;_includeAllSlots;_skipRows;_row;_rowIndex;_column;_cellIndex;_spannedCells;_nextCellAtColumn;_jumpedToStartRow=false;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:true,value:void 0};if(!e.is("element","tableRow"))return this._rowIndex++,this.next();if(this._isOverEndColumn())return this._advanceToNextRow();let t=null;const i=this._getSpanned();if(i)this._includeAllSlots&&!this._shouldSkipSlot()&&(t=this._formatOutValue(i.cell,i.row,i.column));else {const i=e.getChild(this._cellIndex);if(!i)return this._advanceToNextRow();const n=parseInt(i.getAttribute("colspan")||"1"),s=parseInt(i.getAttribute("rowspan")||"1");(n>1||s>1)&&this._recordSpans(i,s,n),this._shouldSkipSlot()||(t=this._formatOutValue(i)),this._nextCellAtColumn=this._column+n;}return this._column++,this._column==this._nextCellAtColumn&&this._cellIndex++,t||this.next()}skipRow(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,i=this._column){return {done:false,value:new gK(this,e,t,i)}}_shouldSkipSlot(){const e=this._skipRows.has(this._row),t=this._row<this._startRow,i=this._column<this._startColumn,n=void 0!==this._endColumn&&this._column>this._endColumn;return e||t||i||n}_getSpanned(){const e=this._spannedCells.get(this._row);return e&&e.get(this._column)||null}_recordSpans(e,t,i){const n={cell:e,row:this._row,column:this._column};for(let e=this._row;e<this._row+t;e++)for(let t=this._column;t<this._column+i;t++)e==this._row&&t==this._column||this._markSpannedCell(e,t,n);}_markSpannedCell(e,t,i){this._spannedCells.has(e)||this._spannedCells.set(e,new Map);this._spannedCells.get(e).set(t,i);}_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=true);}_getRowLength(e){return [...this._table.getChild(e).getChildren()].reduce((e,t)=>e+parseInt(t.getAttribute("colspan")||"1"),0)}}class gK{cell;row;column;cellAnchorRow;cellAnchorColumn;_cellIndex;_rowIndex;_table;constructor(e,t,i,n){this.cell=t,this.row=e._row,this.column=e._column,this.cellAnchorRow=i,this.cellAnchorColumn=n,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 fK(e){return "header"===e||"header-row"===e||"header-column"===e}function pK(e,t,i,n,s=1){null!=t&&null!=s&&t>s?n.setAttribute(e,t,i):n.removeAttribute(e,i);}function bK(e,t,i={}){const n=e.createElement("tableCell",i);return e.insertElement("paragraph",n),e.insert(n,t),n}function wK(e,t){const i=t.parent.parent,n=parseInt(i.getAttribute("headingColumns")||"0"),{column:s}=e.getCellLocation(t);return !!n&&s<n}function vK(e,t,i){const{modelAttribute:n}=i;e.extend("tableCell",{allowAttributes:[n]}),e.setAttributeProperties(n,{isFormatting:true}),XG(t,{viewElement:/^(td|th)$/,...i}),tK(t,{modelElement:"tableCell",...i});}function _K(e){const t=e.getSelectedElement();return t&&t.is("element","table")?t:e.getFirstPosition().findAncestor("table")}function yK({table:e,row:t,column:i}){const n=new mK(e,{row:t,column:i});for(const{cell:e}of n){if(!fK(e.getAttribute("tableCellType")))return  false}return  true}function kK(e){return e.model.schema.checkAttribute("tableCell","tableCellType")}function CK(e,t,i){const{startRow:n,startColumn:s,endRow:o,endColumn:r}=t,a=i.createElement("table"),l=e.getAttribute("tableType");l&&i.setAttribute("tableType",l,a);const c=o-n+1;for(let e=0;e<c;e++)i.insertElement("tableRow",a,"end");const u=[...new mK(e,{startRow:n,endRow:o,startColumn:s,endColumn:r,includeAllSlots:true})];for(const{row:e,column:t,cell:l,isAnchor:c,cellAnchorRow:d,cellAnchorColumn:h}of u){const u=e-n,m=a.getChild(u);if(c){const n=i.cloneElement(l);i.append(n,m),SK(n,e,t,o,r,i);}else (d<n||h<s)&&bK(i,i.createPositionAt(m,"end"));}return function(e,t,i,n,s){const o=parseInt(t.getAttribute("headingRows")||"0");if(o>0){pK("headingRows",o-i,e,s,0);}const r=parseInt(t.getAttribute("headingColumns")||"0");if(r>0){pK("headingColumns",r-n,e,s,0);}}(a,e,n,s,i),function(e,t,i,n,s){const o=Array.from(t.getChildren()).reduce((e,t)=>t.is("element","tableRow")?e+1:e,0),r=parseInt(t.getAttribute("footerRows")||"0"),a=o-r;if(r<1)return;let l=0;n>=a&&(l=n-Math.max(a,i)+1);pK("footerRows",l,e,s,0);}(a,e,n,o,i),a}function xK(e,t,i=0){const n=[],s=new mK(e,{startRow:i,endRow:t-1});for(const e of s){const{row:i,cellHeight:s}=e;i<t&&t<=i+s-1&&n.push(e);}return n}function AK(e,t,i){const n=e.parent,s=n.parent,o=n.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 u=o+r,d=[...new mK(s,{startRow:o,endRow:u,includeAllSlots:true})];let h,m=null;for(const t of d){const{row:n,column:s,cell:o}=t;o===e&&void 0===h&&(h=s),void 0!==h&&h===s&&n===u&&(m=bK(i,t.getPositionBefore(),a));}return pK("rowspan",r,e,i),m}function EK(e,t){const i=[],n=new mK(e);for(const e of n){const{column:n,cellWidth:s}=e;n<t&&t<=n+s-1&&i.push(e);}return i}function TK(e,t,i,n){const s=i-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=bK(n,n.createPositionAfter(e),o);return pK("colspan",s,e,n),l}function SK(e,t,i,n,s,o){const r=parseInt(e.getAttribute("colspan")||"1"),a=parseInt(e.getAttribute("rowspan")||"1");if(i+r-1>s){pK("colspan",s-i+1,e,o,1);}if(t+a-1>n){pK("rowspan",n-t+1,e,o,1);}}function IK(e,t){const i=t.getColumns(e),n=new Array(i).fill(0);for(const{column:t}of new mK(e))n[t]++;const s=n.reduce((e,t,i)=>t?e:[...e,i],[]);if(s.length>0){const i=s[s.length-1];return t.removeColumns(e,{at:i}),true}return  false}function PK(e,t){const i=[],n=t.getRows(e);for(let t=0;t<n;t++){e.getChild(t).isEmpty&&i.push(t);}if(i.length>0){const n=i[i.length-1];return t.removeRows(e,{at:n}),true}return  false}function VK(e,t){IK(e,t)||PK(e,t);}function RK(e,t){const i=Array.from(new mK(e,{startColumn:t.firstColumn,endColumn:t.lastColumn,row:t.lastRow}));if(i.every(({cellHeight:e})=>1===e))return t.lastRow;const n=i[0].cellHeight-1;return t.lastRow+n}function OK(e,t){const i=Array.from(new mK(e,{startRow:t.firstRow,endRow:t.lastRow,column:t.lastColumn}));if(i.every(({cellWidth:e})=>1===e))return t.lastColumn;const n=i[0].cellWidth-1;return t.lastColumn+n}function BK(e){for(const t of e.getChildren())if(t.is("element","table"))return t}function LK(){return e=>{e.on("element:figure",(e,t,i)=>{if(!i.consumable.test(t.viewItem,{name:true,classes:"table"}))return;const n=BK(t.viewItem);if(!n||!i.consumable.test(n,{name:true}))return;i.consumable.consume(t.viewItem,{name:true,classes:"table"});const s=i.convertItem(n,t.modelCursor),o=Cn(s.modelRange.getItems());if(!o||!o.is("element","table"))return i.consumable.revert(t.viewItem,{name:true,classes:"table"}),void(s.modelRange&&!s.modelRange.isCollapsed&&(t.modelRange=s.modelRange,t.modelCursor=s.modelCursor));i.convertChildren(t.viewItem,i.writer.createPositionAt(o,"end")),i.updateConversionResult(o,t);});}}function MK(e){return t=>{t.on("element:table",(t,i,n)=>{const s=i.viewItem;if(!n.consumable.test(s,{name:true}))return;const{rows:o,headingRows:r,headingColumns:a,footerRows:l}=function(e){let t,i=true;const n=[],s=[],o=[];let r=null,a=null;const l=Array.from(e.getChildren());for(let e=0;e<l.length;e++){const t=l[e];if("tbody"!==t.name&&"thead"!==t.name&&"tfoot"!==t.name)continue;"thead"!==t.name||r||(i=true,r=t);const c=Array.from(t.getChildren()).filter(e=>e.is("element","tr"));let u=null,d=null;for(const h of c){const m=Array.from(h.getChildren()).filter(e=>e.is("element","td")||e.is("element","th"));if("tfoot"===t.name){a||={element:t,rows:c},i=false;const n=a.element===t;if(!n&&null===d)for(let t=e;t<l.length&&(d="tfoot"===l[t].name,d);t++);if(n){o.push(h);continue}if(false!==d){o.splice(o.length-a.rows.length,0,h);continue}}r&&t===r||"tbody"===t.name&&m.length>0&&(null===u||m.length===u)&&m.every(e=>e.is("element","th"))&&i?(n.push(h),i=true):(s.push(h),i=false),u=Math.max(u||0,m.length);}}const c=function(e){let t=new Map,i=0;const n=e.map(e=>{const n=[],s=Array.from(e.getChildren()).filter(e=>"th"===e.name||"td"===e.name),o=new Map;for(;s.length||n.length<i;){const e=t.get(n.length);if(e&&e.remaining>0)n.push(e.cell);else {const e=s.shift();if(!e){n.push(null);continue}{const t=parseInt(e.getAttribute("colspan")||"1"),i=parseInt(e.getAttribute("rowspan")||"1");for(let s=0;s<t;s++)i>1&&o.set(n.length,{cell:e,remaining:i-1}),n.push(e);}}}for(const[e,i]of t.entries())i.remaining-=1,i.remaining>0&&!o.has(e)&&o.set(e,i);return t=o,i=Math.max(i,n.length),n});for(const e of n)for(;e.length<i;)e.push(null);return n}(s);for(const e of c){let i=0;for(;i<e.length&&"th"===e[i]?.name;)i+=1;(void 0===t||i<t)&&(t=i);}return {headingRows:n.length,headingColumns:t||0,footerRows:o.length,rows:[...n,...s,...o]}}(s),c={};a&&(c.headingColumns=a),r&&(c.headingRows=r),e.enableFooters&&l&&(c.footerRows=l);const u=n.writer.createElement("table",c);if(n.safeInsert(u,i.modelCursor)){if(n.consumable.consume(s,{name:true}),o.forEach(e=>n.convertItem(e,n.writer.createPositionAt(u,"end"))),n.convertChildren(s,n.writer.createPositionAt(u,"end")),u.isEmpty){const e=n.writer.createElement("tableRow");n.writer.insert(e,n.writer.createPositionAt(u,"end")),bK(n.writer,n.writer.createPositionAt(e,"end"));}n.updateConversionResult(u,i);}});}}function FK(){return e=>{e.on("element:tr",(e,t)=>{t.viewItem.isEmpty&&0==t.modelCursor.index&&e.stop();},{priority:"high"});}}function NK(e){return t=>{t.on(`element:${e}`,(e,t,{writer:i})=>{if(!t.modelRange)return;const n=t.modelRange.start.nodeAfter,s=i.createPositionAt(n,0);if(t.viewItem.isEmpty)return void i.insertElement("paragraph",s);const o=Array.from(n.getChildren());if(o.every(e=>e.is("element","$marker"))){const e=i.createElement("paragraph");i.insert(e,i.createPositionAt(n,0));for(const t of o)i.move(i.createRangeOn(t),i.createPositionAt(e,"end"));}},{priority:"low"});}}const DK=5,zK=40,HK=2,qK=3;function UK(e){const t=new Set;for(const i of e.document.differ.getChanges()){let n=null;switch(i.type){case "insert":n=["table","tableRow","tableCell"].includes(i.name)?i.position:null;break;case "remove":n=["tableRow","tableCell"].includes(i.name)?i.position:null;break;case "attribute":i.range.start.nodeAfter&&(n=["table","tableRow","tableCell"].includes(i.range.start.nodeAfter.name)?i.range.start:null);}if(!n)continue;const s=n.nodeAfter&&n.nodeAfter.is("element","table")?n.nodeAfter:n.findAncestor("table");for(const i of e.createRangeOn(s).getItems())i.is("element","table")&&iJ(i)&&t.add(i);}return t}function jK(e,t){return 4e3/$K(e,t)}function $K(e,t){const i=WK(e,"tbody",t)||WK(e,"thead",t)||WK(e,"tfoot",t);return GK(t.editing.view.domConverter.mapViewToDom(i))}function WK(e,t,i){const n=[...i.editing.mapper.toViewElement(e).getChildren()].find(e=>e.is("element","table"));return [...n.getChildren()].find(e=>e.is("element",t))}function GK(t){const i=exports.global.window.getComputedStyle(t);return "border-box"===i.boxSizing?parseFloat(i.width)-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight)-parseFloat(i.borderLeftWidth)-parseFloat(i.borderRightWidth):parseFloat(i.width)}function KK(e,t){const i=t.getCellLocation(e).column;return {leftEdge:i,rightEdge:i+(e.getAttribute("colspan")||1)-1}}function JK(e){const t=Math.pow(10,2),i="number"==typeof e?e:parseFloat(e);return Math.round(i*t)/t}function QK(e,t,i){return JK(e<=t?t:e>=i?i:e)}function YK(e,t){return Array(e).fill(t)}function ZK(e){return e.map(e=>"number"==typeof e?e:parseFloat(e)).filter(e=>!Number.isNaN(e)).reduce((e,t)=>e+t,0)}function XK(e){let t=function(e){const t=e.filter(e=>"auto"===e).length;if(0===t)return e.map(e=>JK(e));const i=ZK(e),n=Math.max((100-i)/t,5);return e.map(e=>"auto"===e?n:e).map(e=>JK(e))}(e.map(e=>"auto"===e||void 0===e?"auto":parseFloat(e.replace("%",""))));const i=ZK(t);return 100!==i&&(t=t.map(e=>JK(100*e/i)).map((e,t,i)=>{if(!(t===i.length-1))return e;return JK(e+100-ZK(i))})),t.map(e=>e+"%")}function eJ(t){const i=exports.global.window.getComputedStyle(t);return "border-box"===i.boxSizing?parseInt(i.width):parseFloat(i.width)+parseFloat(i.paddingLeft)+parseFloat(i.paddingRight)+parseFloat(i.borderWidth)}function tJ(e,t,i,n){for(let s=0;s<Math.max(i.length,e.length);s++){const o=e[s],r=i[s];r?o?n.setAttribute("columnWidth",r,o):n.appendElement("tableColumn",{columnWidth:r},t):n.remove(o);}}function iJ(e){if(e.is("element","tableColumnGroup"))return e;const t=e.getChildren();return Array.from(t).find(e=>e.is("element","tableColumnGroup"))}function nJ(e){const t=iJ(e);return t?Array.from(t.getChildren()):[]}function sJ(e){return nJ(e).map(e=>e.getAttribute("columnWidth"))}function oJ(e,t){return nJ(e).reduce((e,i)=>{const n=i.getAttribute("columnWidth"),s=i.getAttribute("colSpan");if(!s)return e.push(n),e;for(let t=0;t<s;t++)e.push(n);return t.removeAttribute("colSpan",i),e},[])}class rJ extends Ms{static get pluginName(){return "TableUtils"}static get isOfficialPlugin(){return  true}init(){this.decorate("insertColumns"),this.decorate("insertRows");}getCellLocation(e){const t=e.parent,i=t.parent,n=i.getChildIndex(t),s=new mK(i,{row:n});for(const{cell:t,row:i,column:n}of s)if(t===e)return {row:i,column:n}}createTable(e,t){const i=e.createElement("table");return aJ(e,i,0,t.rows||2,t.columns||2),t.footerRows&&this.setFooterRowsCount(e,i,t.footerRows),t.headingRows&&this.setHeadingRowsCount(e,i,t.headingRows),t.headingColumns&&this.setHeadingColumnsCount(e,i,t.headingColumns),i}insertRows(e,t={}){const i=this.editor.model,n=t.at||0,s=t.rows||1,o=void 0!==t.copyStructureFromAbove,r=t.copyStructureFromAbove?n-1:n,a=kK(this.editor),l=!!this.editor.config.get("table.tableCellProperties.scopedHeaders"),c=this.getRows(e),u=this.getColumns(e);if(n>c)throw new I("tableutils-insertrows-insert-out-of-range",this,{options:t});i.change(t=>{let i=e.getAttribute("headingRows")||0,d=e.getAttribute("footerRows")||0;if(i>n&&(i+=s),d&&n>c-d&&(d+=s),o||0!==n&&n!==c){const i=o?Math.max(n,r):n,c=new mK(e,{endRow:i}),d=new Array(u).fill(1);for(const{row:e,column:i,cellHeight:a,cellWidth:l,cell:u}of c){const c=e+a-1,h=e<=r&&r<=c;e<n&&n<=c?(t.setAttribute("rowspan",a+s,u),d[i]=-l):o&&h&&(d[i]=l);}for(let i=0;i<s;i++){const s=t.createElement("tableRow");t.insert(s,e,n);for(let o=0;o<d.length;o++){const r=d[o],c=t.createPositionAt(s,"end");if(r>0){const s=bK(t,c,r>1?{colspan:r}:void 0);a&&dJ({table:e,writer:t,cell:s,row:n+i,column:o,scopedHeaders:l});}o+=Math.abs(r)-1;}}}else {const i=aJ(t,e,n,s,u);if(a)for(let s=0;s<i.length;s++){const o=i[s];for(let i=0;i<u;i++)dJ({table:e,writer:t,cell:o[i],row:n+s,column:i,scopedHeaders:l});}}this.setFooterRowsCount(t,e,d),this.setHeadingRowsCount(t,e,i,{updateCellType:false});});}insertColumns(e,t={}){const i=this.editor.model,n=t.at||0,s=t.columns||1,o=kK(this.editor),r=!!this.editor.config.get("table.tableCellProperties.scopedHeaders");i.change(t=>{let i=e.getAttribute("headingColumns");n<i&&(i+=s);const a=this.getColumns(e);if(0===n||a===n){let i=0;for(const a of e.getChildren()){if(!a.is("element","tableRow"))continue;const l=lJ(s,t,t.createPositionAt(a,n?"end":0));if(o)for(let s=0;s<l.length;s++)dJ({table:e,writer:t,cell:l[s],row:i,column:n+s,scopedHeaders:r});i++;}}else {const i=new mK(e,{column:n,includeAllSlots:true});for(const a of i){const{row:l,cell:c,cellAnchorColumn:u,cellAnchorRow:d,cellWidth:h,cellHeight:m}=a;if(u<n){t.setAttribute("colspan",h+s,c);const e=d+m-1;for(let t=l;t<=e;t++)i.skipRow(t);}else {const i=lJ(s,t,a.getPositionBefore());if(o)for(let s=0;s<i.length;s++)dJ({table:e,writer:t,cell:i[s],row:l,column:n+s,scopedHeaders:r});}}}this.setHeadingColumnsCount(t,e,i,{updateCellType:false});});}removeRows(e,t){const i=this.editor.model,n=t.rows||1,s=this.getRows(e),o=t.at,r=o+n-1;if(r>s-1)throw new I("tableutils-removerows-row-index-out-of-range",this,{table:e,options:t});i.change(t=>{const i={first:o,last:r},{cellsToMove:n,cellsToTrim:a}=function(e,{first:t,last:i}){const n=new Map,s=[];for(const{row:o,column:r,cellHeight:a,cell:l}of new mK(e,{endRow:i})){const e=o+a-1;if(o>=t&&o<=i&&e>i){const e=a-(i-o+1);n.set(r,{cell:l,rowspan:e});}if(o<t&&e>=t){let n;n=e>=i?i-t+1:e-t+1,s.push({cell:l,rowspan:a-n});}}return {cellsToMove:n,cellsToTrim:s}}(e,i);if(n.size){!function(e,t,i,n){const s=new mK(e,{includeAllSlots:true,row:t}),o=[...s],r=e.getChild(t);let a;for(const{column:e,cell:t,isAnchor:s}of o)if(i.has(e)){const{cell:t,rowspan:s}=i.get(e),o=a?n.createPositionAfter(a):n.createPositionAt(r,0);n.move(n.createRangeOn(t),o),pK("rowspan",s,t,n),a=t;}else s&&(a=t);}(e,r+1,n,t);}for(let i=r;i>=o;i--)t.remove(e.getChild(i));for(const{rowspan:e,cell:i}of a)pK("rowspan",e,i,t);if(function(e,{first:t,last:i},n){const s=e.getAttribute("headingRows")||0;if(t<s){pK("headingRows",i<s?s-(i-t+1):t,e,n,0);}}(e,i,t),function(e,t,{first:i,last:n},s){if(!e.hasAttribute("footerRows"))return;const o=e.getAttribute("footerRows"),r=t-o;if(n>=r){pK("footerRows",i>=r?o-(n-i+1):t-1-n,e,s,0);}}(e,s,i,t),IK(e,this)||PK(e,this),kK(this.editor)){let i=e.getAttribute("headingRows")||0;const n=this.getRows(e);for(;i<n&&yK({table:e,row:i});)i++;this.setHeadingRowsCount(t,e,i,{updateCellType:false});}});}removeColumns(e,t){const i=this.editor.model,n=t.at,s=t.columns||1,o=t.at+s-1;i.change(t=>{!function(e,t,i){const n=e.getAttribute("headingColumns")||0;if(n&&t.first<n){const s=Math.min(n-1,t.last)-t.first+1;i.setAttribute("headingColumns",n-s,e);}}(e,{first:n,last:o},t);const i=nJ(e);for(let s=o;s>=n;s--){for(const{cell:i,column:n,cellWidth:o}of [...new mK(e)])n<=s&&o>1&&n+o>s?pK("colspan",o-1,i,t):n===s&&t.remove(i);if(i[s]){const e=0===s?i[1]:i[s-1],n=parseFloat(i[s].getAttribute("columnWidth")),o=parseFloat(e.getAttribute("columnWidth"));t.remove(i[s]),t.setAttribute("columnWidth",n+o+"%",e);}}if(PK(e,this)||IK(e,this),kK(this.editor)){let i=e.getAttribute("headingColumns")||0;const n=this.getColumns(e);for(;i<n&&yK({table:e,column:i});)i++;this.setHeadingColumnsCount(t,e,i,{updateCellType:false});}});}splitCellVertically(e,t=2){const i=this.editor.model,n=e.parent.parent,s=parseInt(e.getAttribute("rowspan")||"1"),o=parseInt(e.getAttribute("colspan")||"1");i.change(i=>{if(o>1){const{newCellsSpan:n,updatedSpan:r}=cJ(o,t);pK("colspan",r,e,i);const a={};n>1&&(a.colspan=n),s>1&&(a.rowspan=s);lJ(o>t?t-1:o-1,i,i.createPositionAfter(e),a);}if(o<t){const r=t-o,a=[...new mK(n)],{column:l}=a.find(({cell:t})=>t===e),c=a.filter(({cell:t,cellWidth:i,column:n})=>t!==e&&n===l||n<l&&n+i>l);for(const{cell:e,cellWidth:t}of c)i.setAttribute("colspan",t+r,e);const u={};s>1&&(u.rowspan=s),lJ(r,i,i.createPositionAfter(e),u);const d=n.getAttribute("headingColumns")||0;d>l&&pK("headingColumns",d+r,n,i);}});}splitCellHorizontally(e,t=2){const i=this.editor.model,n=e.parent,s=n.parent,o=s.getChildIndex(n),r=parseInt(e.getAttribute("rowspan")||"1"),a=parseInt(e.getAttribute("colspan")||"1");i.change(i=>{if(r>1){const n=[...new mK(s,{startRow:o,endRow:o+r-1,includeAllSlots:true})],{newCellsSpan:l,updatedSpan:c}=cJ(r,t);pK("rowspan",c,e,i);const{column:u}=n.find(({cell:t})=>t===e),d={};l>1&&(d.rowspan=l),a>1&&(d.colspan=a);let h=0;for(const e of n){const{column:t,row:n}=e,s=t===u;h>=l&&s&&(h=0),n>=o+c&&s&&(h||lJ(1,i,e.getPositionBefore(),d),h++);}}if(r<t){const n=t-r,l=this.getRows(s),c=[...new mK(s,{startRow:0,endRow:o})];for(const{cell:t,cellHeight:s,row:r}of c)if(t!==e&&r+s>o){const e=s+n;i.setAttribute("rowspan",e,t);}const u={};a>1&&(u.colspan=a),aJ(i,s,o+1,n,1,u);const d=s.getAttribute("headingRows")||0;d>o&&pK("headingRows",d+n,s,i);const h=s.getAttribute("footerRows")||0;l-h<=o&&pK("footerRows",h+n,s,i);}});}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)=>t.is("element","tableRow")?e+1:e,0)}createTableWalker(e,t={}){return new mK(e,t)}getSelectedTableCells(e){const t=[];for(const i of this.sortRanges(e.getRanges())){const e=i.getContainedElement();e&&e.is("element","tableCell")&&t.push(e);}return t}setFooterRowsCount(e,t,i){if(!this.editor.config.get("table.enableFooters"))return;const n=t.getAttribute("headingRows")||0,s=this.getRows(t),o=Math.min(i,s);if(pK("footerRows",o,t,e,0),n+o>s){const i=s-o;this.setHeadingRowsCount(e,t,i);}}setHeadingRowsCount(e,t,i,n={}){const{updateCellType:s=true,resetFormerHeadingCells:o=true,autoExpand:r=true}=n,a=this.getRows(t),l=!!this.editor.config.get("table.tableCellProperties.scopedHeaders"),c=t.getAttribute("headingRows")||0;let u=Math.min(i,a);if(u===c)return;pK("headingRows",u,t,e,0);if(u+(t.getAttribute("footerRows")||0)>a){const i=a-u;this.setFooterRowsCount(e,t,i);}if(kK(this.editor)){if(s){for(const{cell:i,row:n,column:s}of new mK(t,{endRow:u-1}))dJ({table:t,writer:e,cell:i,row:n,column:s,scopedHeaders:l});if(o&&u<c)for(let i=u;i<c&&yK({table:t,row:i});i++)for(const{cell:n,row:s,column:o}of new mK(t,{row:i}))dJ({table:t,writer:e,cell:n,row:s,column:o,scopedHeaders:l});}if(r&&u>c){for(;u<a&&yK({table:t,row:u});)u++;pK("headingRows",u,t,e,0);}}}setHeadingColumnsCount(e,t,i,n={}){const{updateCellType:s=true,resetFormerHeadingCells:o=true,autoExpand:r=true}=n,a=this.getColumns(t),l=t.getAttribute("headingColumns")||0,c=!!this.editor.config.get("table.tableCellProperties.scopedHeaders");let u=Math.min(i,a);if(u!==l&&(pK("headingColumns",u,t,e,0),kK(this.editor))){if(s){for(const{cell:i,row:n,column:s}of new mK(t,{endColumn:u-1}))dJ({table:t,writer:e,cell:i,row:n,column:s,scopedHeaders:c});if(o&&u<l)for(let i=u;i<l&&yK({table:t,column:i});i++)for(const{cell:n,row:s,column:o}of new mK(t,{column:i}))dJ({table:t,writer:e,cell:n,row:s,column:o,scopedHeaders:c});}if(r&&u>l){for(;u<a&&yK({table:t,column:u});)u++;pK("headingColumns",u,t,e,0);}}}getTableCellsContainingSelection(e){const t=[];for(const i of e.getRanges()){const e=i.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"),i=[...new mK(t)].filter(t=>e.includes(t.cell)).map(e=>e.column);return this._getFirstLastIndexesObject(i)}isSelectionRectangular(e){if(e.length<2||!this._areCellInTheSameTableSection(e))return  false;const t=new Set,i=new Set;let n=0;for(const s of e){const{row:e,column:o}=this.getCellLocation(s),r=parseInt(s.getAttribute("rowspan"))||1,a=parseInt(s.getAttribute("colspan"))||1;t.add(e),i.add(o),r>1&&t.add(e+r-1),a>1&&i.add(o+a-1),n+=r*a;}const s=function(e,t){const i=Array.from(e.values()),n=Array.from(t.values()),s=Math.max(...i),o=Math.min(...i),r=Math.max(...n),a=Math.min(...n);return (s-o+1)*(r-a+1)}(t,i);return s==n}sortRanges(e){return Array.from(e).sort(uJ)}_getFirstLastIndexesObject(e){const t=e.sort((e,t)=>e-t);return {first:t[0],last:t[t.length-1]}}_areCellInTheSameTableSection(e){const t=e[0].findAncestor("table"),i=this.getRows(t),n=this.getRowIndexes(e),s=parseInt(t.getAttribute("headingRows"))||0,o=parseInt(t.getAttribute("footerRows"))||0;if(!this._areIndexesInSameHeadingSection(n,s)||!this._areIndexesInSameFooterSection(n,i,o))return  false;const r=this.getColumnIndexes(e),a=parseInt(t.getAttribute("headingColumns"))||0;return this._areIndexesInSameHeadingSection(r,a)}_areIndexesInSameHeadingSection({first:e,last:t},i){return e<i===t<i}_areIndexesInSameFooterSection({first:e,last:t},i,n){const s=i-n;return e>=s===t>=s}}function aJ(e,t,i,n,s,o={}){const r=[];for(let a=0;a<n;a++){const n=e.createElement("tableRow");e.insert(n,t,i),r.push(lJ(s,e,e.createPositionAt(n,"end"),o));}return r}function lJ(e,t,i,n={}){const s=[];let o=i;for(let i=0;i<e;i++){const e=bK(t,o,n);s.push(e),o=t.createPositionAfter(e);}return s}function cJ(e,t){if(e<t)return {newCellsSpan:1,updatedSpan:1};const i=Math.floor(e/t);return {newCellsSpan:i,updatedSpan:e-i*t+i}}function uJ(e,t){const i=e.start,n=t.start;return i.isBefore(n)?-1:1}function dJ({writer:e,table:t,row:i,column:n,cell:s,scopedHeaders:o}){const r=t.getAttribute("headingRows")||0,a=t.getAttribute("headingColumns")||0;if(i>=r&&n>=a)return void e.removeAttribute("tableCellType",s);let l="header";o&&(l=i<r?"header-column":"header-row"),e.setAttribute("tableCellType",l,s);}function hJ(e){if(!e||!ne(e))return e;const{top:t,right:i,bottom:n,left:s}=e;return t==i&&i==n&&n==s?t:void 0}function mJ(e,t){const i=parseFloat(e);return Number.isNaN(i)||String(i)!==String(e)?e:`${i}${t}`}function gJ(e,t={}){const i={borderStyle:"none",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",...e};return t.includeAlignmentProperty&&!i.alignment&&(i.alignment="center"),t.includePaddingProperty&&!i.padding&&(i.padding=""),t.includeVerticalAlignmentProperty&&!i.verticalAlignment&&(i.verticalAlignment="middle"),t.includeHorizontalAlignmentProperty&&!i.horizontalAlignment&&(i.horizontalAlignment=t.isRightToLeftContent?"right":"left"),i}function fJ(e,t){return gJ({borderStyle:"double",borderColor:"hsl(0, 0%, 70%)",borderWidth:"1px",...e},t)}function pJ(e,t){return gJ({borderStyle:"solid",borderColor:"hsl(0, 0%, 75%)",borderWidth:"1px",...e},t)}function bJ(e,t){return (i,{writer:n})=>{const s=i.getAttribute("headingRows")||0,o=i.getAttribute("footerRows")||0,r=n.createContainerElement("table",null,[]),a=n.createContainerElement("figure",{class:"table"},r),l=e.getRows(i);s>0&&n.insert(n.createPositionAt(r,"end"),n.createContainerElement("thead",null,n.createSlot(e=>e.is("element","tableRow")&&e.index<s))),s+o<l&&n.insert(n.createPositionAt(r,"end"),n.createContainerElement("tbody",null,n.createSlot(e=>e.is("element","tableRow")&&e.index>=s&&e.index<l-o))),o>0&&n.insert(n.createPositionAt(r,"end"),n.createContainerElement("tfoot",null,n.createSlot(e=>e.is("element","tableRow")&&e.index>=l-o)));for(const{positionOffset:e,filter:i}of t.additionalSlots)n.insert(n.createPositionAt(r,e),n.createSlot(i));return n.insert(n.createPositionAt(r,"after"),n.createSlot(e=>!e.is("element","tableRow")&&!t.additionalSlots.some(({filter:t})=>t(e)))),t.asWidget?function(e,t){return t.setCustomProperty("table",true,e),Yk(e,t,{hasSelectionHandle:true})}(a,n):a}}function wJ(){return (e,{writer:t})=>e.isEmpty?t.createEmptyElement("tr"):t.createContainerElement("tr")}function vJ(e){return (i,{writer:n})=>{if(e.cellTypeEnabled?.()){return t(n,fK(i.getAttribute("tableCellType"))?"th":"td")}const s=i.parent,o=s.parent,r=o.getChildIndex(s),a=new mK(o,{row:r}),l=o.getAttribute("headingRows")||0,c=o.getAttribute("headingColumns")||0;let u=null;for(const e of a)if(e.cell==i){u=t(n,e.row<l||e.column<c?"th":"td");break}return u};function t(t,i){return e.asWidget?nC(t.createEditableElement(i),t,{withAriaRole:false}):t.createContainerElement(i)}}function _J(e={}){return (t,{writer:i})=>{if(!t.parent.is("element","tableCell"))return null;if(!yJ(t))return null;if(e.asWidget)return i.createContainerElement("span",{class:"ck-table-bogus-paragraph"});{const e=i.createContainerElement("p");return i.setCustomProperty("dataPipeline:transparentRendering",true,e),e}}}function yJ(e){return 1==e.parent.childCount&&!function(e){for(const t of e.getAttributeKeys())if(!t.startsWith("selection:")&&"htmlEmptyBlock"!=t)return  true;return  false}(e)}function kJ(e){return (t,i)=>{const n=e.plugins.has("PlainTableOutput"),s=i.options.isClipboardPipeline,o=xJ(e,t);return n||o||s?function(e,t,i){const n=i.plugins.get(rJ),s=t.writer,o=n.getRows(e),r=e.getAttribute("headingRows")||0,a=e.getAttribute("footerRows")||0,l=o-a,c=s.createSlot(e=>e.is("element","tableRow")&&e.index<r),u=s.createSlot(e=>e.is("element","tableRow")&&e.index>=r&&e.index<l),d=s.createSlot(e=>e.is("element","tableRow")&&e.index>=l),h=s.createSlot(e=>!e.is("element","tableRow")),m=s.createContainerElement("thead",null,c),g=s.createContainerElement("tbody",null,u),f=s.createContainerElement("tfoot",null,d),p=[];r&&p.push(m);r+a<o&&p.push(g);a&&p.push(f);const b={class:"table"};if(i.plugins.has("TablePropertiesEditing")&&t.options.isClipboardPipeline){const t=fJ(i.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:true}),n=e.getAttribute("tableAlignment");let s=t.alignment;"layout"===e.getAttribute("tableType")&&(s="");const o=n||s;o&&(b.class+=" "+hK[o].className,b.style=hK[o].style,void 0!==hK[o].align&&(b.align=hK[o].align));}return s.createContainerElement("table",b,[h,...p])}(t,i,e):null}}function CJ(e){return (t,{writer:i,options:n})=>{const s=e.plugins.has("PlainTableOutput"),o=n.isClipboardPipeline,r=xJ(e,t);return (s||r||o)&&"table"===t.parent.name?i.createContainerElement("caption"):null}}function xJ(e,t){const i=e.plugins.has("TableLayoutEditing"),n=e.config.get("table.tableLayout.stripFigureFromContentTable")??false,s=t.findAncestor("table",{includeSelf:true}),o=s?.getAttribute("tableType");return i&&(n||"layout"===o)}class AJ extends Ns{refresh(){const e=this.editor.model,t=e.document.selection,i=e.schema;this.isEnabled=function(e,t){const i=e.getFirstPosition().parent,n=i===i.root?i:i.parent;return t.checkChild(n,"table")}(t,i);}execute(e={}){const t=this.editor,i=t.model,n=t.plugins.get("TableUtils"),s=!!t.config.get("table.enableFooters"),o=t.config.get("table.defaultHeadings.rows"),r=t.config.get("table.defaultHeadings.columns"),a=t.config.get("table.defaultFooters");void 0===e.headingRows&&o&&(e.headingRows=o),void 0===e.headingColumns&&r&&(e.headingColumns=r),s&&void 0===e.footerRows&&a&&(e.footerRows=a),!s&&"footerRows"in e&&delete e.footerRows,i.change(t=>{const s=n.createTable(t,e);i.insertObject(s,null,null,{findOptimalPosition:"auto"}),t.setSelection(t.createPositionAt(s.getNodeByPath([0,0,0]),0));});}}class EJ extends Ns{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,i=e.plugins.get("TableUtils"),n="above"===this.order,s=i.getSelectionAffectedTableCells(t),o=i.getRowIndexes(s),r=n?o.first:o.last,a=s[0].findAncestor("table");i.insertRows(a,{at:n?r:r+1,copyStructureFromAbove:!n});}}class TJ extends Ns{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,i=e.plugins.get("TableUtils"),n="left"===this.order,s=i.getSelectionAffectedTableCells(t),o=i.getColumnIndexes(s),r=n?o.first:o.last,a=s[0].findAncestor("table");i.insertColumns(a,{columns:1,at:n?r:r+1});}}class SJ extends Ns{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);}}class IJ extends Ns{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,i=this.editor.plugins.get("TableUtils").getTableCellsContainingSelection(t.selection)[0],n=this.value,s=this.direction;e.change(e=>{const t="right"==s||"down"==s,o=t?i:n,r=t?n:i,a=r.parent;!function(e,t,i){PJ(e)||(PJ(t)&&i.remove(i.createRangeIn(t)),i.move(i.createRangeIn(e),i.createPositionAt(t,"end")));i.remove(e);}(r,o,e);const l=this.isHorizontal?"colspan":"rowspan",c=parseInt(i.getAttribute(l)||"1"),u=parseInt(n.getAttribute(l)||"1");e.setAttribute(l,c+u,o),e.setSelection(e.createRangeIn(o));const d=this.editor.plugins.get("TableUtils");VK(a.findAncestor("table"),d);});}_getMergeableCell(){const e=this.editor.model.document,t=this.editor.plugins.get("TableUtils"),i=t.getTableCellsContainingSelection(e.selection)[0];if(!i)return;const n=this.isHorizontal?function(e,t,i){const n=e.parent,s=n.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}=i.getCellLocation(a),{column:u}=i.getCellLocation(l),d=parseInt(a.getAttribute("colspan")||"1"),h=wK(i,a),m=wK(i,l);if(r&&h!=m)return;return c+d===u?o:void 0}(i,this.direction,t):function(e,t,i){const n=e.parent,s=n.parent,o=s.getChildIndex(n),r=i.getRows(s);if("down"==t&&o===r-1||"up"==t&&0===o)return null;const a=parseInt(e.getAttribute("rowspan")||"1"),l=s.getAttribute("headingRows")||0,c=s.getAttribute("footerRows")||0,u=r-c,d="up"==t&&o===u,h="up"==t&&o===l,m="down"==t&&o+a===l,g="down"==t&&o+a===u;if(l&&(m||h))return null;if(c&&(d||g))return null;const f=parseInt(e.getAttribute("rowspan")||"1"),p="down"==t?o+f:o,b=[...new mK(s,{endRow:p})],w=b.find(t=>t.cell===e),v=w.column,_=b.find(({row:e,cellHeight:i,column:n})=>n===v&&("down"==t?e===p:p===e+i));return _&&_.cell?_.cell:null}(i,this.direction,t);if(!n)return;const s=this.isHorizontal?"rowspan":"colspan",o=parseInt(i.getAttribute(s)||"1");return parseInt(n.getAttribute(s)||"1")===o?n:void 0}}function PJ(e){const t=e.getChild(0);return 1==e.childCount&&t.is("element","paragraph")&&t.isEmpty}class VJ extends Ns{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),i=t[0];if(i){const n=i.findAncestor("table"),s=e.getRows(n)-1,o=e.getRowIndexes(t),r=0===o.first&&o.last===s;this.isEnabled=!r;}else this.isEnabled=false;}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),i=t.getSelectionAffectedTableCells(e.document.selection),n=t.getRowIndexes(i),s=i[0],o=s.findAncestor("table"),r=t.getCellLocation(s).column;e.change(e=>{const i=n.last-n.first+1;t.removeRows(o,{at:n.first,rows:i});const s=function(e,t,i,n){const s=e.getChild(Math.min(t,n-1));let o=s.getChild(0),r=0;for(const e of s.getChildren()){if(r>i)return o;o=e,r+=parseInt(e.getAttribute("colspan")||"1");}return o}(o,n.first,r,t.getRows(o));e.setSelection(e.createPositionAt(s,0));});}}class RJ extends Ns{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),i=t[0];if(i){const n=i.findAncestor("table"),s=e.getColumns(n),{first:o,last:r}=e.getColumnIndexes(t);this.isEnabled=r-o<s-1;}else this.isEnabled=false;}execute(){const e=this.editor.plugins.get("TableUtils"),[t,i]=function(e,t){const i=t.getSelectionAffectedTableCells(e),n=i[0],s=i.pop(),o=[n,s];return n.isBefore(s)?o:o.reverse()}(this.editor.model.document.selection,e),n=t.parent.parent,s=[...new mK(n)],o={first:s.find(e=>e.cell===t).column,last:s.find(e=>e.cell===i).column},r=function(e,t,i,n){const s=parseInt(i.getAttribute("colspan")||"1");return s>1?i:t.previousSibling||i.nextSibling?i.nextSibling||t.previousSibling:n.first?e.reverse().find(({column:e})=>e<n.first).cell:e.reverse().find(({column:e})=>e>n.last).cell}(s,t,i,o);this.editor.model.change(t=>{const i=o.last-o.first+1;e.removeColumns(n,{at:o.first,columns:i}),t.setSelection(t.createPositionAt(r,0));});}}class OJ extends Ns{refresh(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,i=e.getSelectionAffectedTableCells(t.document.selection);if(0===i.length)return this.isEnabled=false,void(this.value=false);const n=i[0].findAncestor("table");this.isEnabled=t.schema.checkAttribute(n,"headingRows"),this.value=i.every(e=>this._isInHeading(e,e.parent.parent));}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),i=this.editor.model,n=t.getSelectionAffectedTableCells(i.document.selection),s=n[0].findAncestor("table"),{first:o,last:r}=t.getRowIndexes(n),a=this.value?o:r+1,l=s.getAttribute("headingRows")||0;i.change(e=>{if(a){const t=xK(s,a,a>l?l:0);for(const{cell:i}of t)AK(i,a,e);}t.setHeadingRowsCount(e,s,a);});}_isInHeading(e,t){const i=parseInt(t.getAttribute("headingRows")||"0");return !!i&&e.parent.index<i}}class BJ extends Ns{refresh(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,i=e.getSelectionAffectedTableCells(t.document.selection);if(0===i.length)return this.isEnabled=false,void(this.value=false);const n=i[0].findAncestor("table");this.isEnabled=t.schema.checkAttribute(n,"footerRows"),this.value=i.every(e=>this._isInFooter(e,n));}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),i=this.editor.model,n=t.getSelectionAffectedTableCells(i.document.selection),s=n[0].findAncestor("table"),{first:o,last:r}=t.getRowIndexes(n),a=t.getRows(s),l=this.value?a-(r+1):a-o,c=s.getAttribute("footerRows")||0;i.change(e=>{if(l){const t=a-l,i=a-c,n=xK(s,t,t>i?i:0);for(const{cell:i}of n)AK(i,t,e);}t.setFooterRowsCount(e,s,l);});}_isInFooter(e,t){const i=parseInt(t.getAttribute("footerRows")||"0"),n=this.editor.plugins.get("TableUtils").getRows(t),s=e.parent.index;return !!i&&s>=n-i}}class LJ extends Ns{refresh(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,i=e.getSelectionAffectedTableCells(t.document.selection);if(0===i.length)return this.isEnabled=false,void(this.value=false);const n=i[0].findAncestor("table");this.isEnabled=t.schema.checkAttribute(n,"headingColumns"),this.value=i.every(t=>wK(e,t));}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),i=this.editor.model,n=t.getSelectionAffectedTableCells(i.document.selection),s=n[0].findAncestor("table"),{first:o,last:r}=t.getColumnIndexes(n),a=this.value?o:r+1;i.change(e=>{if(a){const t=EK(s,a);for(const{cell:i,column:n}of t)TK(i,n,a,e);}t.setHeadingColumnsCount(e,s,a);});}}class MJ extends Ns{refresh(){const e=this.editor.plugins.get(rJ),t=e.getSelectedTableCells(this.editor.model.document.selection);this.isEnabled=e.isSelectionRectangular(t);}execute(){const e=this.editor.model,t=this.editor.plugins.get(rJ);e.change(i=>{const n=t.getSelectedTableCells(e.document.selection),s=n.shift(),{mergeWidth:o,mergeHeight:r}=function(e,t,i){let n=0,s=0;for(const e of t){const{row:t,column:o}=i.getCellLocation(e);n=DJ(e,o,n,"colspan"),s=DJ(e,t,s,"rowspan");}const{row:o,column:r}=i.getCellLocation(e),a=n-r,l=s-o;return {mergeWidth:a,mergeHeight:l}}(s,n,t);pK("colspan",o,s,i),pK("rowspan",r,s,i);for(const e of n)FJ(e,s,i);VK(s.findAncestor("table"),t),i.setSelection(s,"in");});}}function FJ(e,t,i){NJ(e)||(NJ(t)&&i.remove(i.createRangeIn(t)),i.move(i.createRangeIn(e),i.createPositionAt(t,"end"))),i.remove(e);}function NJ(e){const t=e.getChild(0);return 1==e.childCount&&t.is("element","paragraph")&&t.isEmpty}function DJ(e,t,i,n){const s=parseInt(e.getAttribute(n)||"1");return Math.max(i,t+s)}class zJ extends Ns{constructor(e){super(e),this.affectsData=false;}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"),i=t.getSelectionAffectedTableCells(e.document.selection),n=t.getRowIndexes(i),s=i[0].findAncestor("table"),o=[];for(let t=n.first;t<=n.last;t++)for(const i of s.getChild(t).getChildren())o.push(e.createRangeOn(i));e.change(e=>{e.setSelection(o);});}}class HJ extends Ns{constructor(e){super(e),this.affectsData=false;}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,i=e.getSelectionAffectedTableCells(t.document.selection),n=i[0],s=i.pop(),o=n.findAncestor("table"),r=e.getCellLocation(n),a=e.getCellLocation(s),l=Math.min(r.column,a.column),c=Math.max(r.column,a.column),u=[];for(const e of new mK(o,{startColumn:l,endColumn:c}))u.push(t.createRangeOn(e.cell));t.change(e=>{e.setSelection(u);});}}function qJ(e){e.document.registerPostFixer(t=>function(e,t){const i=t.document.differ.getChanges();let n=false;const s=new Set;for(const t of i){let i=null;"insert"==t.type&&"table"==t.name&&(i=t.position.nodeAfter),"insert"!=t.type&&"remove"!=t.type||"tableRow"!=t.name&&"tableCell"!=t.name||(i=t.position.findAncestor("table")),$J(t)&&(i=t.range.start.findAncestor("table")),i&&!s.has(i)&&(n=UJ(i,e)||n,n=jJ(i,e)||n,s.add(i));}return n}(t,e));}function UJ(e,t){let i=false;const n=function(e){const t=parseInt(e.getAttribute("headingRows")||"0"),i=parseInt(e.getAttribute("footerRows")||"0"),n=Array.from(e.getChildren()).reduce((e,t)=>t.is("element","tableRow")?e+1:e,0),s=n-i,o=[];for(const{row:i,cell:r,cellHeight:a}of new mK(e)){if(a<2)continue;let e;if(e=i<t?t:i>=s?n:s,i+a>e){const t=e-i;o.push({cell:r,rowspan:t});}}return o}(e);if(n.length){i=true;for(const e of n)pK("rowspan",e.rowspan,e.cell,t,1);}return i}function jJ(e,t){let i=false;const n=function(e){const t=new Array(e.childCount).fill(0);for(const{rowIndex:i}of new mK(e,{includeAllSlots:true}))t[i]++;return t}(e),s=[];for(const[t,i]of n.entries())!i&&e.getChild(t).is("element","tableRow")&&s.push(t);if(s.length){i=true;for(const i of s.reverse())t.remove(e.getChild(i)),n.splice(i,1);}const o=n.filter((t,i)=>e.getChild(i).is("element","tableRow")),r=o[0];if(!o.every(e=>e===r)){const n=o.reduce((e,t)=>t>e?t:e,0);for(const[s,r]of o.entries()){const o=n-r;if(o){for(let i=0;i<o;i++)bK(t,t.createPositionAt(e.getChild(s),"end"));i=true;}}}return i}function $J(e){if("attribute"!==e.type)return  false;const t=e.attributeKey;return "headingRows"===t||"colspan"===t||"rowspan"===t}function WJ(e){e.document.registerPostFixer(t=>function(e,t){const i=t.document.differ.getChanges();let n=false;for(const t of i)"insert"==t.type&&"table"==t.name&&(n=GJ(t.position.nodeAfter,e)||n),"insert"==t.type&&"tableRow"==t.name&&(n=KJ(t.position.nodeAfter,e)||n),"insert"==t.type&&"tableCell"==t.name&&(n=JJ(t.position.nodeAfter,e)||n),"remove"!=t.type&&"insert"!=t.type||!QJ(t)||(n=JJ(t.position.parent,e)||n);return n}(t,e));}function GJ(e,t){let i=false;for(const n of e.getChildren())n.is("element","tableRow")&&(i=KJ(n,t)||i);return i}function KJ(e,t){let i=false;for(const n of e.getChildren())i=JJ(n,t)||i;return i}function JJ(e,t){if(0==e.childCount)return t.insertElement("paragraph",e),true;const i=Array.from(e.getChildren()).filter(e=>e.is("$text"));for(const e of i)t.wrap(t.createRangeOn(e),"paragraph");return !!i.length}function QJ(e){return !!e.position.parent.is("element","tableCell")&&("insert"==e.type&&"$text"==e.name||"remove"==e.type)}function YJ(e,t,i){const n=i.getAttribute("headingRows")||0,s=i.getAttribute("footerRows")||0,o=e.getRows(i);if(n+s>o){return pK("footerRows",Math.max(0,o-n),i,t,0),true}return  false}function ZJ(e,t){const i=e.document.differ,n=new Set,s=new Set,o=new Set;for(const e of i.getChanges()){let i;if("attribute"==e.type){const t=e.range.start.nodeAfter;if(!t||!t.is("element","table"))continue;if("headingRows"!=e.attributeKey&&"headingColumns"!=e.attributeKey&&"footerRows"!=e.attributeKey)continue;i=t;}else "tableRow"!=e.name&&"tableCell"!=e.name||(i=e.position.findAncestor("table"));if(!i)continue;"insert"==e.type&&"tableRow"==e.name&&t.mapper.toViewElement(e.position.nodeAfter)&&n.add(e.position.nodeAfter);const r=i.getAttribute("headingRows")||0,a=i.getAttribute("headingColumns")||0,l=new mK(i);for(const e of l){const i=t.mapper.toViewElement(e.cell);if(!i||!i.is("element"))continue;const l=e.row<r||e.column<a?"th":"td";i.name!=l&&(o.add(e.cell),n.has(e.cell.parent)&&s.add(e.cell.parent));}}for(const e of s)t.reconvertItem(e);for(const e of o)t.reconvertItem(e);}function XJ(e,t){const i=e.document.differ,n=new Set;for(const e of i.getChanges()){const t="attribute"==e.type?e.range.start.parent:e.position.parent;t.is("element","tableCell")&&n.add(t);}for(const e of n.values()){const i=Array.from(e.getChildren()).filter(e=>eQ(e,t.mapper));for(const e of i)t.reconvertItem(e);}}function eQ(e,t){if(!e.is("element","paragraph"))return  false;const i=t.toViewElement(e);return !!i&&yJ(e)!==i.is("element","span")}class tQ extends Ms{_additionalSlots;static get pluginName(){return "TableEditing"}static get isOfficialPlugin(){return  true}static get requires(){return [rJ]}constructor(e){super(e),this._additionalSlots=[];}init(){const e=this.editor,t=e.model,i=t.schema,n=e.conversion,s=e.plugins.get(rJ);e.config.define("table.enableFooters",false);const o=!!e.config.get("table.enableFooters");i.register("table",{inheritAllFrom:"$blockObject",allowAttributes:["headingRows","headingColumns",...o?["footerRows"]:[]]}),i.register("tableRow",{allowIn:"table",isLimit:true}),i.register("tableCell",{allowContentOf:"$container",allowIn:"tableRow",allowAttributes:["colspan","rowspan"],isLimit:true,isSelectable:true}),n.for("upcast").add(LK()),n.for("upcast").add(MK({enableFooters:o})),n.for("editingDowncast").elementToStructure({model:{name:"table",attributes:["headingRows",...o?["footerRows"]:[]]},view:bJ(s,{asWidget:true,additionalSlots:this._additionalSlots})}),n.for("dataDowncast").elementToStructure({model:{name:"table",attributes:["headingRows",...o?["footerRows"]:[]]},view:bJ(s,{additionalSlots:this._additionalSlots})}),n.for("upcast").elementToElement({model:"tableRow",view:"tr"}),n.for("upcast").add(e=>{e.on("element:tr",(e,t)=>{t.viewItem.isEmpty&&0==t.modelCursor.index&&e.stop();},{priority:"high"});}),n.for("downcast").elementToElement({model:"tableRow",view:(e,{writer:t})=>e.isEmpty?t.createEmptyElement("tr"):t.createContainerElement("tr")}),n.for("upcast").elementToElement({model:"tableCell",view:"td"}),n.for("upcast").elementToElement({model:"tableCell",view:"th"}),n.for("upcast").add(NK("td")),n.for("upcast").add(NK("th")),n.for("editingDowncast").elementToElement({model:"tableCell",view:vJ({asWidget:true,cellTypeEnabled:()=>kK(this.editor)})}),n.for("dataDowncast").elementToElement({model:"tableCell",view:vJ({cellTypeEnabled:()=>kK(this.editor)})}),n.for("editingDowncast").elementToElement({model:"paragraph",view:_J({asWidget:true}),converterPriority:"high"}),n.for("dataDowncast").elementToElement({model:"paragraph",view:_J(),converterPriority:"high"}),n.for("downcast").attributeToAttribute({model:"colspan",view:"colspan"}),n.for("upcast").attributeToAttribute({model:{key:"colspan",value:iQ("colspan")},view:"colspan"}),n.for("downcast").attributeToAttribute({model:"rowspan",view:"rowspan"}),n.for("upcast").attributeToAttribute({model:{key:"rowspan",value:iQ("rowspan")},view:"rowspan"}),this._addPlainTableOutputConverters(),e.config.define("table.defaultHeadings.rows",0),e.config.define("table.defaultHeadings.columns",0),e.config.define("table.defaultFooters",0),e.config.define("table.showHiddenBorders",true),e.config.get("table.showHiddenBorders")&&e.editing.view.change(t=>{for(const i of e.editing.view.document.roots)t.addClass("ck-table-show-hidden-borders",i);}),e.commands.add("insertTable",new AJ(e)),e.commands.add("insertTableRowAbove",new EJ(e,{order:"above"})),e.commands.add("insertTableRowBelow",new EJ(e,{order:"below"})),e.commands.add("insertTableColumnLeft",new TJ(e,{order:"left"})),e.commands.add("insertTableColumnRight",new TJ(e,{order:"right"})),e.commands.add("removeTableRow",new VJ(e)),e.commands.add("removeTableColumn",new RJ(e)),e.commands.add("splitTableCellVertically",new SJ(e,{direction:"vertically"})),e.commands.add("splitTableCellHorizontally",new SJ(e,{direction:"horizontally"})),e.commands.add("mergeTableCells",new MJ(e)),e.commands.add("mergeTableCellRight",new IJ(e,{direction:"right"})),e.commands.add("mergeTableCellLeft",new IJ(e,{direction:"left"})),e.commands.add("mergeTableCellDown",new IJ(e,{direction:"down"})),e.commands.add("mergeTableCellUp",new IJ(e,{direction:"up"})),e.commands.add("setTableColumnHeader",new LJ(e)),e.commands.add("setTableRowHeader",new OJ(e)),o&&e.commands.add("setTableFooterRow",new BJ(e)),e.commands.add("selectTableRow",new zJ(e)),e.commands.add("selectTableColumn",new HJ(e)),qJ(t),WJ(t),o&&function(e){const{model:t}=e,i=e.plugins.get(rJ);t.document.registerPostFixer(e=>{let n=false;const s=t.document.differ.getChanges(),o=new Set;for(const e of s){let t=null;"attribute"!=e.type||"headingRows"!=e.attributeKey&&"footerRows"!=e.attributeKey?("insert"==e.type&&"tableRow"==e.name||"remove"==e.type&&"tableRow"==e.name)&&(t=e.position.parent):t=e.range.start.nodeAfter,t&&t.is("element","table")&&o.add(t);}for(const t of o)YJ(i,e,t)&&(n=true);return n});}(e),this.listenTo(t.document,"change:data",()=>{kK(e)||ZJ(t,e.editing),XJ(t,e.editing);});}registerAdditionalSlot(e){this._additionalSlots.push(e);}_addPlainTableOutputConverters(){const e=this.editor;e.conversion.for("dataDowncast").elementToStructure({model:"table",view:kJ(e),converterPriority:"high"}),e.plugins.has("TableCaptionEditing")&&e.conversion.for("dataDowncast").elementToElement({model:"caption",view:CJ(e),converterPriority:"high"}),e.plugins.has("TablePropertiesEditing")&&function(e){const t={"border-width":"tableBorderWidth","border-color":"tableBorderColor","border-style":"tableBorderStyle","background-color":"tableBackgroundColor"};for(const[i,n]of Object.entries(t))e.conversion.for("dataDowncast").add(t=>t.on(`attribute:${n}:table`,(t,n,s)=>{const{item:o,attributeNewValue:r}=n,{mapper:a,writer:l}=s,c=e.plugins.has("PlainTableOutput"),u=s.options.isClipboardPipeline,d=xJ(e,o);if(!(c||d||u))return;if(!s.consumable.consume(o,t.name))return;const h=a.toViewElement(o);r?l.setStyle(i,r,h):l.removeStyle(i,h);},{priority:"high"}));}(e);}}function iQ(e){return t=>{const i=parseInt(t.getAttribute(e));return Number.isNaN(i)||i<=0?null:i}}class nQ extends Cs{items;keystrokes;focusTracker;constructor(e){super(e);const t=this.bindTemplate;this.items=this._createGridCollection(),this.keystrokes=new In,this.focusTracker=new An,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:{"mouseover@.ck-insert-table-dropdown-grid-box":t.to("boxover")},children:this.items},{tag:"div",attributes:{class:["ck","ck-insert-table-dropdown__label"],"aria-hidden":true},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:i,column:n}=t.target.dataset;this.items.get(10*(parseInt(i,10)-1)+(parseInt(n,10)-1)).focus();}),this.focusTracker.on("change:focusedElement",(e,t,i)=>{if(!i)return;const{row:n,column:s}=i.dataset;this.set({rows:parseInt(n),columns:parseInt(s)});}),this.on("change:columns",()=>this._highlightGridBoxes()),this.on("change:rows",()=>this._highlightGridBoxes());}render(){super.render(),Rs({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((i,n)=>{const s=Math.floor(n/10)<e&&n%10<t;i.set("isOn",s);});}_createGridButton(e,t,i,n){const s=new Bp(e);return s.set({label:n,class:"ck-insert-table-dropdown-grid-box"}),s.extendTemplate({attributes:{"data-row":t,"data-column":i}}),s}_createGridCollection(){const e=[];for(let t=0;t<100;t++){const i=Math.floor(t/10),n=t%10,s=`${i+1} × ${n+1}`;e.push(this._createGridButton(this.locale,i+1,n+1,s));}return this.createCollection(e)}}class sQ extends Ms{static get pluginName(){return "TableUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=this.editor.t,i="ltr"===e.locale.contentLanguageDirection,n=!!e.config.get("table.enableFooters");e.ui.componentFactory.add("insertTable",i=>{const n=e.commands.get("insertTable"),s=ww(i);let o;return s.bind("isEnabled").to(n),s.buttonView.set({icon:ap,label:t("Insert table"),tooltip:true}),s.on("change:isOpen",()=>{o||(o=new nQ(i),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",i=>{const n=e.commands.get("insertTable"),s=new x_(i),o=new nQ(i);return o.delegate("execute").to(s),s.on("change:isOpen",(e,t,i)=>{i||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:ap}),s.panelView.children.add(o),s.bind("isEnabled").to(n),s}),e.ui.componentFactory.add("tableColumn",e=>{const n=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:t("Header column"),bindIsOn:true}},{type:"separator"},{type:"button",model:{commandName:i?"insertTableColumnLeft":"insertTableColumnRight",label:t("Insert column left")}},{type:"button",model:{commandName:i?"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"),ip,n,e)}),e.ui.componentFactory.add("tableRow",e=>{const i=[{type:"switchbutton",model:{commandName:"setTableRowHeader",label:t("Header row"),bindIsOn:true}},n&&{type:"switchbutton",model:{commandName:"setTableFooterRow",label:t("Footer row"),bindIsOn:true}},{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")}}].filter(Boolean);return this._prepareDropdown(t("Row"),rp,i,e)}),e.ui.componentFactory.add("mergeTableCells",e=>{const n=[{type:"button",model:{commandName:"mergeTableCellUp",label:t("Merge cell up")}},{type:"button",model:{commandName:i?"mergeTableCellRight":"mergeTableCellLeft",label:t("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:t("Merge cell down")}},{type:"button",model:{commandName:i?"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"),np,n,e)});}_prepareDropdown(e,t,i,n){const s=this.editor,o=ww(n),r=this._fillDropdownWithListOptions(o,i);return o.buttonView.set({label:e,icon:t,tooltip:true}),o.bind("isEnabled").toMany(r,"isEnabled",(...e)=>e.some(e=>e)),this.listenTo(o,"execute",e=>{s.execute(e.source.commandName),e.source instanceof rb||s.editing.view.focus();}),o}_prepareMergeSplitButtonDropdown(e,t,i,n){const s=this.editor,o=ww(n,bw),r="mergeTableCells",a=s.commands.get(r),l=this._fillDropdownWithListOptions(o,i);return o.buttonView.set({label:e,icon:t,tooltip:true,isEnabled:true}),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 i=this.editor,n=[],s=new kn;for(const e of t)oQ(e,i,n,s);return Cw(e,s),n}}function oQ(e,t,i,n){if("button"===e.type||"switchbutton"===e.type){const n=e.model=new e_(e.model),{commandName:s,bindIsOn:o}=e.model,r=t.commands.get(s);i.push(r),n.set({commandName:s}),n.bind("isEnabled").to(r),o&&n.bind("isOn").to(r,"value"),n.set({withText:true});}n.add(e);}class rQ extends Ms{static get pluginName(){return "TableSelection"}static get isOfficialPlugin(){return  true}static get requires(){return [rJ,rJ]}init(){const e=this.editor,t=e.model,i=e.editing.view;this.listenTo(t,"deleteContent",(e,t)=>this._handleDeleteContent(e,t),{priority:"high"}),this.listenTo(i.document,"insertText",(e,t)=>this._handleInsertTextEvent(e,t),{priority:"high"}),this._defineSelectionConverter(),this._enablePluginDisabling();}getSelectedTableCells(){const e=this.editor.plugins.get(rJ),t=this.editor.model.document.selection,i=e.getSelectedTableCells(t);return 0==i.length?null:i}getSelectionAsFragment(){const e=this.editor.plugins.get(rJ),t=this.getSelectedTableCells();return t?this.editor.model.change(i=>{const n=i.createDocumentFragment(),{first:s,last:o}=e.getColumnIndexes(t),{first:r,last:a}=e.getRowIndexes(t),l=t[0].findAncestor("table");let c=a,u=o;if(e.isSelectionRectangular(t)){const e={firstColumn:s,lastColumn:o,firstRow:r,lastRow:a};c=RK(l,e),u=OK(l,e);}const d=CK(l,{startRow:r,startColumn:s,endRow:c,endColumn:u},i);return i.insert(d,n,0),n}):null}setCellSelection(e,t){const i=this._getCellsToSelect(e,t);this.editor.model.change(e=>{e.setSelection(i.cells.map(t=>e.createRangeOn(t)),{backward:i.backward});});}getFocusCell(){const e=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return e&&e.is("element","tableCell")?e:null}getAnchorCell(){const e=Cn(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,i,n)=>{const s=n.writer;!function(e){for(const i of t)e.removeClass("ck-editor__editable_selected",i);t.clear();}(s);const o=this.getSelectedTableCells();if(!o)return;for(const e of o){const i=n.mapper.toViewElement(e);s.addClass("ck-editor__editable_selected",i),t.add(i);}const r=n.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(i=>{const n=i.createPositionAt(t[0],0),s=e.model.schema.getNearestSelectionRange(n);i.setSelection(s);});}});}_handleDeleteContent(e,t){const i=this.editor.plugins.get(rJ),n=t[0],s=t[1],o=this.editor.model,r=!s||"backward"==s.direction,a=i.getSelectedTableCells(n);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 i=o.schema.getNearestSelectionRange(e.createPositionAt(t,0));n.is("documentSelection")?e.setSelection(i):n.setTo(i);}));}_handleInsertTextEvent(e,t){const i=this.editor,n=this.getSelectedTableCells();if(!n)return;const s=i.editing.view,o=i.editing.mapper,r=n.map(e=>s.createRangeOn(o.toViewElement(e)));t.selection=s.createSelection(r),t.preventDefault();}_getCellsToSelect(e,t){const i=this.editor.plugins.get("TableUtils"),n=i.getCellLocation(e),s=i.getCellLocation(t),o=Math.min(n.row,s.row),r=Math.max(n.row,s.row),a=Math.min(n.column,s.column),l=parseInt(t.getAttribute("colspan")||"1")-1,c=Math.max(n.column,s.column+l),u=new Array(r-o+1).fill(null).map(()=>[]),d={startRow:o,endRow:r,startColumn:a,endColumn:c};for(const{row:t,cell:i}of new mK(e.findAncestor("table"),d))u[t-o].push(i);const h=s.row<n.row,m=s.column<n.column;return h&&u.reverse(),m&&u.forEach(e=>e.reverse()),{cells:u.flat(),backward:h||m}}}class aQ extends Ms{static get pluginName(){return "TableClipboard"}static get isOfficialPlugin(){return  true}static get requires(){return [ex,tx,rQ,rJ]}init(){const e=this.editor.editing.view.document;this.listenTo(e,"copy",(e,t)=>this._onCopyCut(e,t)),this.listenTo(e,"cut",(e,t)=>this._onCopyCut(e,t)),this._listenToContentInsertion(),this.decorate("_replaceTableSlotCell");}_listenToContentInsertion(){const{editor:e}=this,t=e.plugins.get(tx),i=e.plugins.get(rQ);let n=false;t.on("contentInsertion",(e,t)=>{n="paste"===t.method;}),this.listenTo(e.model,"insertContent",(e,[t,s])=>{(n||null!==i.getSelectedTableCells())&&this._onInsertContent(e,t,s);},{priority:"high"}),t.on("contentInsertion",()=>{n=false;},{priority:"lowest"});}_onCopyCut(e,t){const i=this.editor.editing.view,n=this.editor.plugins.get(rQ),s=this.editor.plugins.get(ex);n.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,()=>n.getSelectionAsFragment());i.document.fire("clipboardOutput",{dataTransfer:t.dataTransfer,content:this.editor.data.toView(o),method:e.name});}));}_onInsertContent(e,t,i){if(i&&!i.is("documentSelection"))return;const n=this.editor.model,s=this.editor.plugins.get(rJ),o=this.editor.plugins.get(ex),r=this.getTableIfOnlyTableInContent(t,n);if(!r)return;const a=s.getSelectionAffectedTableCells(n.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);})):VK(r,s);}_replaceSelectedCells(e,t,i){const n=this.editor.plugins.get(rJ),s={width:n.getColumns(e),height:n.getRows(e)},o=function(e,t,i,n){const s=e[0].findAncestor("table"),o=n.getColumnIndexes(e),r=n.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,i,n){const s=n.getColumns(e),o=n.getRows(e);i>s&&n.insertColumns(e,{at:s,columns:i-s});t>o&&n.insertRows(e,{at:o,rows:t-o});}(s,a.lastRow+1,a.lastColumn+1,n));l||!n.isSelectionRectangular(e)?function(e,t,i){const{firstRow:n,lastRow:s,firstColumn:o,lastColumn:r}=t,a={first:n,last:s},l={first:o,last:r};cQ(e,o,a,i),cQ(e,r+1,a,i),lQ(e,n,l,i),lQ(e,s+1,l,i,n);}(s,a,i):(a.lastRow=RK(s,a),a.lastColumn=OK(s,a));return a}(t,s,i,n),r=o.lastRow-o.firstRow+1,a=o.lastColumn-o.firstColumn+1;e=CK(e,{startRow:0,startColumn:0,endRow:Math.min(r,s.height)-1,endColumn:Math.min(a,s.width)-1},i);const l=t[0].findAncestor("table"),c=this._replaceSelectedCellsWithPasted(e,s,l,o,i,n);if(this.editor.plugins.get("TableSelection").isEnabled){const e=n.sortRanges(c.map(e=>i.createRangeOn(e)));i.setSelection(e);}else i.setSelection(c[0],0);return l}_replaceSelectedCellsWithPasted(e,t,i,n,s,o){const{width:r,height:a}=t,l=function(e,t,i){const n=new Array(i).fill(null).map(()=>new Array(t).fill(null));for(const{column:t,row:i,cell:s}of new mK(e))n[i][t]=s;return n}(e,r,a),c=[...new mK(i,{startRow:n.firstRow,endRow:n.lastRow,startColumn:n.firstColumn,endColumn:n.lastColumn,includeAllSlots:true})],u=[];let d;for(const e of c){const{row:t,column:i}=e;i===n.firstColumn&&(d=e.getPositionBefore());const o=t-n.firstRow,c=i-n.firstColumn,h=l[o%a][c%r],m=h?s.cloneElement(h):null,g=this._replaceTableSlotCell(e,m,d,s);g&&(SK(g,t,i,n.lastRow,n.lastColumn,s),u.push(g),d=s.createPositionAfter(g));}const h=parseInt(i.getAttribute("headingRows")||"0"),m=parseInt(i.getAttribute("headingColumns")||"0"),g=parseInt(i.getAttribute("footerRows")||"0"),f=o.getRows(i)-g,p=n.firstRow<h&&h<=n.lastRow,b=n.firstColumn<m&&m<=n.lastColumn,w=n.firstRow<f&&f<=n.lastRow;if(p){const e=lQ(i,h,{first:n.firstColumn,last:n.lastColumn},s,n.firstRow);u.push(...e);}if(b){const e=cQ(i,m,{first:n.firstRow,last:n.lastRow},s);u.push(...e);}if(w){const e=lQ(i,f,{first:n.firstColumn,last:n.lastColumn},s,n.firstRow);u.push(...e);}return u}_replaceTableSlotCell(e,t,i,n){const{cell:s,isAnchor:o}=e;return o&&n.remove(s),t?(n.insert(t,i),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 i=t.createRangeIn(e);for(const e of i.getItems())if(e.is("element","table")){const n=t.createRange(i.start,t.createPositionBefore(e));if(t.hasContent(n,{ignoreWhitespaces:true}))return null;const s=t.createRange(t.createPositionAfter(e),i.end);return t.hasContent(s,{ignoreWhitespaces:true})?null:e}return null}}function lQ(e,t,i,n,s=0){if(t<1)return;return xK(e,t,s).filter(({column:e,cellWidth:t})=>uQ(e,t,i)).map(({cell:e})=>AK(e,t,n))}function cQ(e,t,i,n){if(t<1)return;const s=EK(e,t).filter(({row:e,cellHeight:t})=>uQ(e,t,i));return s.map(({cell:e,column:i})=>TK(e,i,t,n))}function uQ(e,t,i){const n=e+t-1,{first:s,last:o}=i;return e>=s&&e<=o||e<s&&n>=s}class dQ extends Ms{static get pluginName(){return "TableKeyboard"}static get isOfficialPlugin(){return  true}static get requires(){return [rQ,rJ]}init(){const e=this.editor,t=e.editing.view.document,i=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:i("Keystrokes that can be used in a table cell"),keystrokes:[{label:i("Move the selection to the next cell"),keystroke:"Tab"},{label:i("Move the selection to the previous cell"),keystroke:"Shift+Tab"},{label:i("Insert a new table row (when in the last cell of a table)"),keystroke:"Tab"},{label:i("Navigate through the table"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]}]});}_handleTabOnSelectedTable(e,t){const i=this.editor.model.document.selection.getSelectedElement();i&&i.is("element","table")&&t.stopPropagation();}_handleTab(e,t){const i=this.editor,n=this.editor.plugins.get(rJ),s=this.editor.plugins.get("TableSelection"),o=i.model.document.selection,r=!t.shiftKey;let a=n.getTableCellsContainingSelection(o)[0];if(a||(a=s.getFocusCell()),!a)return;t.stopPropagation();const l=a.parent,c=l.parent,u=c.getChildIndex(l),d=l.getChildIndex(a)===l.childCount-1,h=u===n.getRows(c)-1;r&&h&&d&&i.execute("insertTableRowBelow");}_onArrowKey(e,t){const i=this.editor,n=dn(t.keyCode,i.locale.contentLanguageDirection);this._handleArrowKeys(n,t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),e.stop());}_handleArrowKeys(e,t){const i=this.editor.plugins.get(rJ),n=this.editor.plugins.get("TableSelection"),s=this.editor.model,o=s.document.selection,r=["right","down"].includes(e),a=i.getSelectedTableCells(o);if(a.length){let i;return i=t?n.getFocusCell():r?a[a.length-1]:a[0],this._navigateFromCellInDirection(i,e,t),true}const l=o.focus.findAncestor("tableCell");if(!l)return  false;if(!o.isCollapsed)if(t){if(o.isBackward==r&&!o.containsEntireContent(l))return  false}else {const e=o.getSelectedElement();if(!e||!s.schema.isObject(e))return  false}return !!this._isSelectionAtCellEdge(o,l,r)&&(this._navigateFromCellInDirection(l,e,t),true)}_isSelectionAtCellEdge(e,t,i){const n=this.editor.model,s=this.editor.model.schema,o=i?e.getLastPosition():e.getFirstPosition();if(!s.getLimitElement(o).is("element","tableCell")){return n.createPositionAt(t,i?"end":0).isTouching(o)}const r=n.createSelection(o);return n.modifySelection(r,{direction:i?"forward":"backward"}),o.isEqual(r.focus)}_navigateFromCellInDirection(e,t,i=false){const n=this.editor.model,s=e.findAncestor("table"),o=[...new mK(s,{includeAllSlots:true})],{row:r,column:a}=o[o.length-1],l=o.find(({cell:t})=>t==e);let{row:c,column:u}=l;switch(t){case "left":u--;break;case "up":c--;break;case "right":u+=l.cellWidth;break;case "down":c+=l.cellHeight;}if(c<0||c>r||u<0&&c<=0||u>a&&c>=r)return void n.change(e=>{e.setSelection(e.createRangeOn(s));});u<0?(u=i?0:a,c--):u>a&&(u=i?a:0,c++);const d=o.find(e=>e.row==c&&e.column==u).cell,h=["right","down"].includes(t),m=this.editor.plugins.get("TableSelection");if(i&&m.isEnabled){const t=m.getAnchorCell()||e;m.setCellSelection(t,d);}else {const e=n.createPositionAt(d,h?0:"end");n.change(t=>{t.setSelection(e);});}}}class hQ extends qr{domEventType=["mousemove","mouseleave"];onDomEvent(e){this.fire(e.type,e);}}class mQ extends Ms{static get pluginName(){return "TableMouse"}static get isOfficialPlugin(){return  true}static get requires(){return [rQ,rJ]}init(){this.editor.editing.view.addObserver(hQ),this._enableShiftClickSelection(),this._enableMouseDragSelection();}_enableShiftClickSelection(){const e=this.editor,t=e.plugins.get(rJ);let i=false;const n=e.plugins.get(rQ);this.listenTo(e.editing.view.document,"mousedown",(s,o)=>{const r=e.model.document.selection;if(!this.isEnabled||!n.isEnabled)return;if(!o.domEvent.shiftKey)return;const a=n.getAnchorCell()||t.getTableCellsContainingSelection(r)[0];if(!a)return;const l=this._getModelTableCellFromDomEvent(o);l&&gQ(a,l)&&(i=true,n.setCellSelection(a,l),o.preventDefault());}),this.listenTo(e.editing.view.document,"mouseup",()=>{i=false;}),this.listenTo(e.editing.view.document,"selectionChange",e=>{i&&e.stop();},{priority:"highest"});}_enableMouseDragSelection(){const e=this.editor;let t,i,n=false,s=false;const o=e.plugins.get(rQ);this.listenTo(e.editing.view.document,"mousedown",(e,i)=>{this.isEnabled&&o.isEnabled&&(i.domEvent.shiftKey||i.domEvent.ctrlKey||i.domEvent.altKey||(t=this._getModelTableCellFromDomEvent(i)));}),this.listenTo(e.editing.view.document,"mousemove",(e,r)=>{if(!r.domEvent.buttons)return;if(!t)return;const a=this._getModelTableCellFromDomEvent(r);a&&gQ(t,a)&&(i=a,n||i==t||(n=true)),n&&(s=true,o.setCellSelection(t,i),r.preventDefault());}),this.listenTo(e.editing.view.document,"mouseup",()=>{n=false,s=false,t=null,i=null;}),this.listenTo(e.editing.view.document,"selectionChange",e=>{s&&e.stop();},{priority:"highest"});}_getModelTableCellFromDomEvent(e){const t=e.target,i=this.editor.editing.view.createPositionAt(t,0);return this.editor.editing.mapper.toModelPosition(i).parent.findAncestor("tableCell",{includeSelf:true})}}function gQ(e,t){return e.parent.parent==t.parent.parent}class fQ extends Ms{static get requires(){return [tQ,sQ,rQ,mQ,dQ,aQ,kC]}static get pluginName(){return "Table"}static get isOfficialPlugin(){return  true}}class pQ extends Ms{static get pluginName(){return "PlainTableOutput"}static get isOfficialPlugin(){return  true}static get requires(){return [fQ]}init(){this.editor.conversion.for("upcast").add(e=>{e.on("element:table",(e,t,i)=>{i.consumable.consume(t.viewItem,{classes:"table"});});});}}function bQ(e){const t=wQ(e);return t||vQ(e)}function wQ(e){const t=e.getSelectedElement();return t&&_Q(t)?t:null}function vQ(e){const t=e.getFirstPosition();if(!t)return null;let i=t.parent;for(;i;){if(i.is("element")&&_Q(i))return i;i=i.parent;}return null}function _Q(e){return e.is("element")&&!!e.getCustomProperty("table")&&Qk(e)}class yQ extends Ms{static get requires(){return [xC]}static get pluginName(){return "TableToolbar"}static get isOfficialPlugin(){return  true}afterInit(){const e=this.editor,t=e.t,i=e.plugins.get(xC),n=e.config.get("table.contentToolbar"),s=e.config.get("table.tableToolbar");n&&i.register("tableContent",{ariaLabel:t("Table toolbar"),items:n,getRelatedElement:vQ}),s&&i.register("table",{ariaLabel:t("Table toolbar"),items:s,getRelatedElement:wQ});}}class kQ extends Cs{options;focusTracker;focusCycler;_focusables;dropdownView;inputView;keystrokes;_stillTyping;constructor(e,t){super(e),this.set("value",""),this.set("isReadOnly",false),this.set("isFocused",false),this.set("isEmpty",true),this.options=t,this.focusTracker=new An,this._focusables=new Xn,this.dropdownView=this._createDropdownView(),this.inputView=this._createInputTextView(),this.keystrokes=new In,this._stillTyping=false,this.focusCycler=new Fp({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-input-color"]},children:[this.dropdownView,this.inputView]}),this.on("change:value",(e,t,i)=>this._setInputValue(i));}render(){super.render(),[this.inputView,this.dropdownView.buttonView].forEach(e=>{this.focusTracker.add(e.element),this._focusables.add(e);}),this.keystrokes.listenTo(this.element);}focus(e){ -1===e?this.focusCycler.focusLast():this.focusCycler.focusFirst();}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy();}_createDropdownView(){const e=this.locale,t=e.t,i=this.bindTemplate,n=this._createColorSelector(e),s=ww(e),o=new Cs;return o.setTemplate({tag:"span",attributes:{class:["ck","ck-input-color__button__preview"],style:{backgroundColor:i.to("value")}},children:[{tag:"span",attributes:{class:["ck","ck-input-color__button__preview__no-color-indicator",i.if("value","ck-hidden",e=>""!=e)]}}]}),s.buttonView.extendTemplate({attributes:{class:"ck-input-color__button"}}),s.buttonView.children.add(o),s.buttonView.label=t("Color picker"),s.buttonView.tooltip=true,s.panelPosition="rtl"===e.uiLanguageDirection?"se":"sw",s.panelView.children.add(n),s.bind("isEnabled").to(this,"isReadOnly",e=>!e),s.on("change:isOpen",(e,t,i)=>{i&&(n.updateSelectedColors(),n.showColorGridsFragment());}),s}_createInputTextView(){const e=this.locale,t=new Hb(e);return t.extendTemplate({on:{blur:t.bindTemplate.to("blur")}}),t.value=this.value,t.bind("isReadOnly","hasError").to(this),this.bind("isFocused","isEmpty").to(t),t.on("input",()=>{const e=t.element.value,i=this.options.colorDefinitions.find(t=>e===t.label);this._stillTyping=true,this.value=i&&i.color||e;}),t.on("blur",()=>{this._stillTyping=false,this._setInputValue(t.element.value);}),t.delegate("input").to(this),t}_createColorSelector(e){const t=e.t,i=this.options.defaultColorValue||"",n=t(i?"Restore default":"Remove color"),s=new fv(e,{colors:this.options.colorDefinitions,columns:this.options.columns,removeButtonLabel:n,colorPickerLabel:t("Color picker"),colorPickerViewConfig:false!==this.options.colorPickerConfig&&{...this.options.colorPickerConfig,hideInput:true}});s.appendUI(),s.on("execute",(e,t)=>{"colorPickerSaveButton"!==t.source?(this.value=t.value||i,this.fire("input"),"colorPicker"!==t.source&&(this.dropdownView.isOpen=false)):this.dropdownView.isOpen=false;});let o=this.value;return s.on("colorPicker:cancel",()=>{this.value=o,this.fire("input"),this.dropdownView.isOpen=false;}),s.colorGridsFragmentView.colorPickerButtonView.on("execute",()=>{o=this.value;}),s.bind("selectedColor").to(this,"value"),s}_setInputValue(e){if(!this._stillTyping){const t=CQ(e),i=this.options.colorDefinitions.find(e=>t===CQ(e.color));this.inputView.value=i?i.label:e||"";}}}function CQ(e){return e.replace(/([(,])\s+/g,"$1").replace(/^\s+|\s+(?=[),\s]|$)/g,"").replace(/,|\s/g," ")}const xQ=e=>""===e;function AQ(e){return {none:e("None"),solid:e("Solid"),dotted:e("Dotted"),dashed:e("Dashed"),double:e("Double"),groove:e("Groove"),ridge:e("Ridge"),inset:e("Inset"),outset:e("Outset")}}function EQ(e){return e('The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".')}function TQ(e){return e('The value is invalid. Try "10px" or "2em" or simply "2".')}function SQ(e){return e=e.trim().toLowerCase(),xQ(e)||Vu(e)}function IQ(e){return e=e.trim(),xQ(e)||LQ(e)||Lu(e)||Fu(e)}function PQ(e){return e=e.trim(),xQ(e)||LQ(e)||Lu(e)}function VQ(e,t){const i=new kn,n=AQ(e.t);for(const s in n){const o={type:"button",model:new e_({_borderStyleValue:s,label:n[s],role:"menuitemradio",withText:true})};"none"===s?o.model.bind("isOn").to(e,"borderStyle",e=>"none"===t?!e:e===s):o.model.bind("isOn").to(e,"borderStyle",e=>e===s),i.add(o);}return i}function RQ(e){const{view:t,icons:i,toolbar:n,labels:s,propertyName:o,nameToValue:r,defaultValue:a}=e;for(const e in s){const l=new Bp(t.locale);l.set({role:"radio",isToggleable:true,label:s[e],icon:i[e],tooltip:s[e]});const c=r?r(e):e;l.bind("isOn").to(t,o,e=>{let t=e;return ""===e&&a&&(t=a),c===t}),l.on("execute",()=>{!a&&c&&t[o]===c?t[o]=void 0:t[o]=c;}),n.items.add(l);}}const OQ=[{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:true},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}];function BQ(e){return (t,i,n)=>{const s=new kQ(t.locale,{colorDefinitions:(o=e.colorConfig,o.map(e=>({color:e.model,label:e.label,options:{hasBorder:e.hasBorder}}))),columns:e.columns,defaultColorValue:e.defaultColorValue,colorPickerConfig:e.colorPickerConfig});var o;return s.inputView.set({id:i,ariaDescribedById:n}),s.bind("isReadOnly").to(t,"isEnabled",e=>!e),s.bind("hasError").to(t,"errorText",e=>!!e),s.on("input",()=>{t.errorText=null;}),t.bind("isEmpty","isFocused").to(s),s}}function LQ(e){const t=parseFloat(e);return !Number.isNaN(t)&&e===String(t)}class MQ extends Cs{options;focusTracker;keystrokes;children;borderStyleDropdown;borderWidthInput;borderColorInput;backgroundInput;cellTypeDropdown;paddingInput;widthInput;heightInput;horizontalAlignmentToolbar;verticalAlignmentToolbar;saveButtonView;cancelButtonView;backButtonView;_focusables;_focusCycler;constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",padding:"",backgroundColor:"",width:"",height:"",horizontalAlignment:"",verticalAlignment:"",cellType:""}),this.options=t;const{borderStyleDropdown:i,borderWidthInput:n,borderColorInput:s,borderRowLabel:o}=this._createBorderFields(),{backgroundRowLabel:r,backgroundInput:a}=this._createBackgroundFields(),{cellTypeRowLabel:l,cellTypeDropdown:c}=this._createCellTypeField(),{widthInput:u,operatorLabel:d,heightInput:h,dimensionsLabel:m}=this._createDimensionFields(),{horizontalAlignmentToolbar:g,verticalAlignmentToolbar:f,alignmentLabel:p}=this._createAlignmentFields();this.focusTracker=new An,this.keystrokes=new In,this.children=this.createCollection(),this.borderStyleDropdown=i,this.borderWidthInput=n,this.borderColorInput=s,this.backgroundInput=a,this.cellTypeDropdown=c,this.paddingInput=this._createPaddingField(),this.widthInput=u,this.heightInput=h,this.horizontalAlignmentToolbar=g,this.verticalAlignmentToolbar=f;const{saveButtonView:b,cancelButtonView:w}=this._createActionButtons();this.saveButtonView=b,this.cancelButtonView=w,this.backButtonView=this._createBackButton(),this._focusables=new Xn,this._focusCycler=new Fp({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const v=new Mp(e,{label:this.t("Cell properties")});v.children.add(this.backButtonView,0),this.children.add(v),this.children.add(new Jv(e,{labelView:o,children:[o,i,n,s],class:"ck-table-form__border-row"})),this.children.add(new Jv(e,{children:[new Jv(e,{labelView:l,children:[l,c],class:"ck-table-form__cell-type-row"}),new Jv(e,{labelView:r,children:[r,a],class:"ck-table-form__background-row"})]})),this.children.add(new Jv(e,{children:[new Jv(e,{labelView:m,children:[m,u,d,h],class:"ck-table-form__dimensions-row"}),new Jv(e,{children:[this.paddingInput],class:"ck-table-cell-properties-form__padding-row"})]})),this.children.add(new Jv(e,{labelView:p,children:[p,g,f],class:"ck-table-cell-properties-form__alignment-row"})),this.children.add(new Jv(e,{children:[this.cancelButtonView,this.saveButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-cell-properties-form"],tabindex:"-1"},children:this.children});}render(){super.render(),Vs({view:this}),[this.borderColorInput,this.backgroundInput].forEach(e=>{this._focusCycler.chain(e.fieldView.focusCycler);}),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.cellTypeDropdown,this.backgroundInput,this.widthInput,this.heightInput,this.paddingInput,this.horizontalAlignmentToolbar,this.verticalAlignmentToolbar,this.cancelButtonView,this.saveButtonView,this.backButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element);}),this.keystrokes.listenTo(this.element);}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy();}focus(){this._focusCycler.focusFirst();}_createBorderFields(){const e=this.options.defaultTableCellProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},i=BQ({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),n=this.locale,s=this.t,o=s("Style"),r=new Os(n);r.text=s("Border");const a=AQ(s),l=new Nb(n,Vw);l.set({label:o,class:"ck-table-form__border-style"}),l.fieldView.buttonView.set({ariaLabel:o,ariaLabelledBy:void 0,isOn:false,withText:true,tooltip:o}),l.fieldView.buttonView.bind("label").to(this,"borderStyle",e=>a[e||"none"]),l.fieldView.on("execute",e=>{this.borderStyle=e.source._borderStyleValue;}),l.bind("isEmpty").to(this,"borderStyle",e=>!e),Cw(l.fieldView,VQ(this,t.style),{role:"menu",ariaLabel:o});const c=new Nb(n,Sw);c.set({label:s("Width"),class:"ck-table-form__border-width"}),c.fieldView.bind("value").to(this,"borderWidth"),c.bind("isEnabled").to(this,"borderStyle",FQ),c.fieldView.on("input",()=>{this.borderWidth=c.fieldView.element.value;});const u=new Nb(n,i);return u.set({label:s("Color"),class:"ck-table-form__border-color"}),u.fieldView.bind("value").to(this,"borderColor"),u.bind("isEnabled").to(this,"borderStyle",FQ),u.fieldView.on("input",()=>{this.borderColor=u.fieldView.value;}),this.on("change:borderStyle",(e,i,n,s)=>{FQ(n)||(this.borderColor="",this.borderWidth=""),FQ(s)||(this.borderColor=t.color,this.borderWidth=t.width);}),{borderRowLabel:r,borderStyleDropdown:l,borderColorInput:u,borderWidthInput:c}}_createBackgroundFields(){const e=this.locale,t=this.t,i=new Os(e);i.text=t("Background");const n=BQ({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableCellProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),s=new Nb(e,n);return s.set({label:t("Color"),class:"ck-table-cell-properties-form__background"}),s.fieldView.bind("value").to(this,"backgroundColor"),s.fieldView.on("input",()=>{this.backgroundColor=s.fieldView.value;}),{backgroundRowLabel:i,backgroundInput:s}}_createCellTypeField(){const e=this.locale,t=this.t,i=new Os(e);i.text=t("Cell type");const n=this._cellTypeLabels,s=new Nb(e,Vw);return s.set({label:t("Cell type"),class:"ck-table-cell-properties-form__cell-type"}),s.fieldView.buttonView.set({ariaLabel:t("Cell type"),ariaLabelledBy:void 0,isOn:false,withText:true,tooltip:t("Cell type")}),s.fieldView.buttonView.bind("label").to(this,"cellType",e=>n[e||"data"]),s.fieldView.on("execute",e=>{this.cellType=e.source._cellTypeValue;}),s.bind("isEmpty").to(this,"cellType",e=>!e),Cw(s.fieldView,this._getCellTypeDefinitions(),{role:"menu",ariaLabel:t("Cell type")}),{cellTypeRowLabel:i,cellTypeDropdown:s}}_createDimensionFields(){const e=this.locale,t=this.t,i=new Os(e);i.text=t("Dimensions");const n=new Nb(e,Sw);n.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),n.fieldView.bind("value").to(this,"width"),n.fieldView.on("input",()=>{this.width=n.fieldView.element.value;});const s=new Cs(e);s.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const o=new Nb(e,Sw);return o.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),o.fieldView.bind("value").to(this,"height"),o.fieldView.on("input",()=>{this.height=o.fieldView.element.value;}),{dimensionsLabel:i,widthInput:n,operatorLabel:s,heightInput:o}}_createPaddingField(){const e=this.locale,t=this.t,i=new Nb(e,Sw);return i.set({label:t("Padding"),class:"ck-table-cell-properties-form__padding"}),i.fieldView.bind("value").to(this,"padding"),i.fieldView.on("input",()=>{this.padding=i.fieldView.element.value;}),i}_createAlignmentFields(){const e=this.locale,t=this.t,i=new Os(e),n={left:Xh,center:Yh,right:tm,justify:Zh,top:im,middle:em,bottom:Qh};i.text=t("Table cell text alignment");const s=new mw(e),o="rtl"===e.contentLanguageDirection;s.set({isCompact:true,role:"radiogroup",ariaLabel:t("Horizontal text alignment toolbar"),class:"ck-table-cell-properties-form__horizontal-alignment-toolbar"}),RQ({view:this,icons:n,toolbar:s,labels:this._horizontalAlignmentLabels,propertyName:"horizontalAlignment",nameToValue:e=>{if(o){if("left"===e)return "right";if("right"===e)return "left"}return e},defaultValue:this.options.defaultTableCellProperties.horizontalAlignment});const r=new mw(e);return r.set({isCompact:true,role:"radiogroup",ariaLabel:t("Vertical text alignment toolbar"),class:"ck-table-cell-properties-form__vertical-alignment-toolbar"}),RQ({view:this,icons:n,toolbar:r,labels:this._verticalAlignmentLabels,propertyName:"verticalAlignment",defaultValue:this.options.defaultTableCellProperties.verticalAlignment}),{horizontalAlignmentToolbar:s,verticalAlignmentToolbar:r,alignmentLabel:i}}_createActionButtons(){const e=this.locale,t=this.t,i=new Bp(e),n=new Bp(e),s=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return i.set({label:t("Save"),class:"ck-button-action",type:"submit",withText:true}),i.bind("isEnabled").toMany(s,"errorText",(...e)=>e.every(e=>!e)),n.set({label:t("Cancel"),withText:true}),n.delegate("execute").to(this,"cancel"),{saveButtonView:i,cancelButtonView:n}}_createBackButton(){const e=this.locale.t,t=new Bp(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:Pf,tooltip:true}),t.delegate("execute").to(this,"cancel"),t}_getCellTypeDefinitions(){const e=new kn,t=this._cellTypeLabels,i=["data","header"];this.options.showScopedHeaderOptions&&i.push("header-column","header-row");for(const n of i){const i={type:"button",model:new e_({_cellTypeValue:n,label:t[n],role:"menuitemradio",withText:true})};i.model.bind("isOn").to(this,"cellType",e=>e===n),e.add(i);}return e}get _horizontalAlignmentLabels(){const e=this.locale,t=this.t,i=t("Align cell text to the left"),n=t("Align cell text to the center"),s=t("Align cell text to the right"),o=t("Justify cell text");return "rtl"===e.uiLanguageDirection?{right:s,center:n,left:i,justify:o}:{left:i,center:n,right:s,justify:o}}get _verticalAlignmentLabels(){const e=this.t;return {top:e("Align cell text to the top"),middle:e("Align cell text to the middle"),bottom:e("Align cell text to the bottom")}}get _cellTypeLabels(){const e=this.t;return {data:e("Data cell"),header:e("Header cell"),"header-column":e("Column header"),"header-row":e("Row header")}}}function FQ(e){return "none"!==e}const NQ=(()=>[eb.defaultPositions.northArrowSouth,eb.defaultPositions.northArrowSouthWest,eb.defaultPositions.northArrowSouthEast,eb.defaultPositions.southArrowNorth,eb.defaultPositions.southArrowNorthWest,eb.defaultPositions.southArrowNorthEast,eb.defaultPositions.viewportStickyNorth])();function DQ(e,t){const i=e.plugins.get("ContextualBalloon"),n=e.editing.view.document.selection;let s;"cell"===t?vQ(n)&&(s=HQ(e)):bQ(n)&&(s=zQ(e)),s&&i.updatePosition(s);}function zQ(e){const t=_K(e.model.document.selection),i=e.editing.mapper.toViewElement(t);return {target:e.editing.view.domConverter.mapViewToDom(i),positions:NQ}}function HQ(e){const t=e.editing.mapper,i=e.editing.view.domConverter,n=e.model.document.selection;if(n.rangeCount>1)return {target:()=>function(e,t){const i=t.editing.mapper,n=t.editing.view.domConverter,s=Array.from(e).map(e=>{const t=qQ(e.start),s=i.toViewElement(t);return new Ci(n.mapViewToDom(s))});return Ci.getBoundingRect(s)}(n.getRanges(),e),positions:NQ};const s=qQ(n.getFirstPosition()),o=t.toViewElement(s);return {target:i.mapViewToDom(o),positions:NQ}}function qQ(e){return e.nodeAfter&&e.nodeAfter.is("element","tableCell")?e.nodeAfter:e.findAncestor("tableCell")}const UQ={borderStyle:"tableCellBorderStyle",borderColor:"tableCellBorderColor",borderWidth:"tableCellBorderWidth",height:"tableCellHeight",width:"tableCellWidth",padding:"tableCellPadding",backgroundColor:"tableCellBackgroundColor",horizontalAlignment:"tableCellHorizontalAlignment",verticalAlignment:"tableCellVerticalAlignment",cellType:"tableCellType"};class jQ extends Ms{_defaultContentTableCellProperties;_defaultLayoutTableCellProperties;_balloon;view;_viewWithContentTableDefaults;_viewWithLayoutTableDefaults;_undoStepBatch;_isReady;static get requires(){return [i_]}static get pluginName(){return "TableCellPropertiesUI"}static get isOfficialPlugin(){return  true}constructor(e){super(e),e.config.define("table.tableCellProperties",{borderColors:OQ,backgroundColors:OQ});}init(){const e=this.editor,t=e.t;this._defaultContentTableCellProperties=pJ(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:true,includeHorizontalAlignmentProperty:true,includePaddingProperty:true,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection}),this._defaultLayoutTableCellProperties=gJ(void 0,{includeVerticalAlignmentProperty:true,includeHorizontalAlignmentProperty:true,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection}),this._balloon=e.plugins.get(i_),this.view=null,this._isReady=false,e.ui.componentFactory.add("tableCellProperties",i=>{const n=new Bp(i);n.set({label:t("Cell properties"),icon:tp,tooltip:true}),this.listenTo(n,"execute",()=>this._showView());const s=Object.values(UQ).map(t=>e.commands.get(t)).filter(e=>!!e);return n.bind("isEnabled").toMany(s,"isEnabled",(...e)=>e.some(e=>e)),n});}destroy(){super.destroy(),this.view&&this.view.destroy();}_createPropertiesView(e){const t=this.editor,i=t.config.get("table.tableCellProperties"),n=!!t.config.get("table.tableCellProperties.scopedHeaders"),s=mb(i.borderColors),o=hb(t.locale,s),r=mb(i.backgroundColors),a=hb(t.locale,r),l=false!==i.colorPicker,c=new MQ(t.locale,{borderColors:o,backgroundColors:a,defaultTableCellProperties:e,colorPickerConfig:!!l&&(i.colorPicker||{}),showScopedHeaderOptions:n}),u=t.t;c.render(),this.listenTo(c,"submit",()=>{this._hideView();}),this.listenTo(c,"cancel",()=>{this._undoStepBatch.operations.length&&t.execute("undo",this._undoStepBatch),this._hideView();}),c.keystrokes.set("Esc",(e,t)=>{this._hideView(),t();}),Ss({emitter:c,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const d=EQ(u),h=TQ(u);c.on("change:borderStyle",this._getPropertyChangeCallback("tableCellBorderStyle")),c.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:c.borderColorInput,commandName:"tableCellBorderColor",errorText:d,validator:SQ})),c.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:c.borderWidthInput,commandName:"tableCellBorderWidth",errorText:h,validator:PQ})),c.on("change:padding",this._getValidatedPropertyChangeCallback({viewField:c.paddingInput,commandName:"tableCellPadding",errorText:h,validator:IQ})),c.on("change:width",this._getValidatedPropertyChangeCallback({viewField:c.widthInput,commandName:"tableCellWidth",errorText:h,validator:IQ})),c.on("change:height",this._getValidatedPropertyChangeCallback({viewField:c.heightInput,commandName:"tableCellHeight",errorText:h,validator:IQ})),c.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:c.backgroundInput,commandName:"tableCellBackgroundColor",errorText:d,validator:SQ})),c.on("change:horizontalAlignment",this._getPropertyChangeCallback("tableCellHorizontalAlignment")),c.on("change:verticalAlignment",this._getPropertyChangeCallback("tableCellVerticalAlignment"));const m=t.commands.get("tableCellType");return m&&(c.cellTypeDropdown.bind("isEnabled").to(m,"isEnabled"),c.on("change:cellType",this._getPropertyChangeCallback("tableCellType"))),c}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableCellBorderStyle");Object.entries(UQ).flatMap(([t,i])=>{const n=e.get(i);if(!n)return [];const s=t;let o;o="cellType"===s?"":this.view===this._viewWithContentTableDefaults?this._defaultContentTableCellProperties[s]||"":this._defaultLayoutTableCellProperties[s]||"";return [[t,n.value||o]]}).forEach(([e,i])=>{("borderColor"!==e&&"borderWidth"!==e||"none"!==t.value)&&this.view.set(e,i);}),this._isReady=true;}_showView(){const e=this.editor,t=bQ(e.editing.view.document.selection),i=t&&e.editing.mapper.toModelElement(t),n=!i||"layout"!==i.getAttribute("tableType");n&&!this._viewWithContentTableDefaults?this._viewWithContentTableDefaults=this._createPropertiesView(this._defaultContentTableCellProperties):n||this._viewWithLayoutTableDefaults||(this._viewWithLayoutTableDefaults=this._createPropertiesView(this._defaultLayoutTableCellProperties)),this.view=n?this._viewWithContentTableDefaults:this._viewWithLayoutTableDefaults,this.listenTo(e.ui,"update",()=>{this._updateView();}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:HQ(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus();}_hideView(){const e=this.editor;this.stopListening(e.ui,"update"),this._isReady=false,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus();}_updateView(){const e=this.editor;vQ(e.editing.view.document.selection)?this._isViewVisible&&DQ(e,"cell"):this._hideView();}get _isViewVisible(){return !!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return !!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return (t,i,n)=>{this._isReady&&this.editor.execute(e,{value:n,batch:this._undoStepBatch});}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:i,validator:n,errorText:s}=e,o=st(()=>{i.errorText=s;},500);return (e,s,r)=>{o.cancel(),this._isReady&&(n(r)?(this.editor.execute(t,{value:r,batch:this._undoStepBatch}),i.errorText=null):o());}}}class $Q extends Ns{attributeName;_defaultValue;_defaultContentTableValue;_defaultLayoutTableValue;constructor(e,t,i){switch(super(e),this.attributeName=t,this._defaultContentTableValue=i,t){case "tableCellType":this._defaultLayoutTableValue="data";break;case "tableCellBorderStyle":this._defaultLayoutTableValue="none";break;case "tableCellHorizontalAlignment":this._defaultLayoutTableValue="left";break;case "tableCellVerticalAlignment":this._defaultLayoutTableValue="middle";break;default:this._defaultLayoutTableValue=void 0;}}refresh(){const e=this.editor.model.document.selection,t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e),i=_K(e);this._defaultValue=i&&"layout"===i.getAttribute("tableType")?this._defaultLayoutTableValue:this._defaultContentTableValue,this.isEnabled=!!t.length,this.value=this._getSingleValue(t);}execute(e={}){const{value:t,batch:i}=e,n=this.editor.model,s=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(n.document.selection),o=this._getValueToSet(t);n.enqueueChange(i,e=>{o?s.forEach(t=>e.setAttribute(this.attributeName,o,t)):s.forEach(t=>e.removeAttribute(this.attributeName,t)),this.fire("afterExecute",{writer:e,tableCells:s,valueToSet:o});});}_getAttribute(e){if(!e)return;const t=e.getAttribute(this.attributeName);return t!==this._defaultValue?t:void 0}_getValueToSet(e){if(e!==this._defaultValue)return e}_getSingleValue(e){const t=this._getAttribute(e[0]);return e.every(e=>this._getAttribute(e)===t)?t:void 0}}class WQ extends $Q{constructor(e,t){super(e,"tableCellWidth",t);}_getValueToSet(e){if((e=mJ(e,"px"))!==this._defaultValue)return e}}class GQ extends Ms{static get pluginName(){return "TableCellWidthEditing"}static get isOfficialPlugin(){return  true}static get requires(){return [tQ]}init(){const e=this.editor,t=pJ(e.config.get("table.tableCellProperties.defaultProperties"));vK(e.model.schema,e.conversion,{modelAttribute:"tableCellWidth",styleName:"width",attributeName:"width",attributeType:"length",defaultValue:t.width}),e.commands.add("tableCellWidth",new WQ(e,t.width));}}class KQ extends $Q{constructor(e,t){super(e,"tableCellPadding",t);}_getAttribute(e){if(!e)return;const t=hJ(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){const t=mJ(e,"px");if(t!==this._defaultValue)return t}}class JQ extends $Q{constructor(e,t){super(e,"tableCellHeight",t);}_getValueToSet(e){const t=mJ(e,"px");if(t!==this._defaultValue)return t}}class QQ extends $Q{constructor(e,t){super(e,"tableCellBackgroundColor",t);}}class YQ extends $Q{constructor(e,t){super(e,"tableCellVerticalAlignment",t);}}class ZQ extends $Q{constructor(e,t){super(e,"tableCellHorizontalAlignment",t);}}class XQ extends $Q{constructor(e,t){super(e,"tableCellBorderStyle",t);}_getAttribute(e){if(!e)return;const t=hJ(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class eY extends $Q{constructor(e,t){super(e,"tableCellBorderColor",t);}_getAttribute(e){if(!e)return;const t=hJ(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class tY extends $Q{constructor(e,t){super(e,"tableCellBorderWidth",t);}_getAttribute(e){if(!e)return;const t=hJ(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){const t=mJ(e,"px");if(t!==this._defaultValue)return t}}class iY extends $Q{constructor(e){super(e,"tableCellType","data"),this.on("afterExecute",(e,t)=>{const{writer:i,tableCells:n}=t,s=this.editor.plugins.get(rJ),o=function(e){const t=new Map;for(const i of e){const e=i.findAncestor("table");t.has(e)||t.set(e,[]),t.get(e).push(i);}return t}(n);nY(s,i,o.keys());});}refresh(){super.refresh();const e=_K(this.editor.model.document.selection);this.isEnabled&&e&&"layout"===e.getAttribute("tableType")&&(this.isEnabled=false);}_getAttribute(e){return e?.getAttribute(this.attributeName)||"data"}}function nY(e,t,i){let n=false;for(const s of i){let i=s.getAttribute("headingRows")||0,o=s.getAttribute("headingColumns")||0;const r=s.getAttribute("footerRows")||0,a=e.getRows(s)-r,l=o>i;if(l){const r=sY(e,s,"column",o,i);r!==o&&(e.setHeadingColumnsCount(t,s,r,{updateCellType:false}),o=r,n=true);}let c=sY(e,s,"row",i,o);if(r>0&&(c=Math.min(c,a)),c!==i&&(e.setHeadingRowsCount(t,s,c,{updateCellType:false}),i=c,n=true),!l){const r=sY(e,s,"column",o,i);r!==o&&(e.setHeadingColumnsCount(t,s,r,{updateCellType:false}),n=true);}}return n}function sY(e,t,i,n,s){const o="row"===i?e.getRows(t):e.getColumns(t);let r=n;for(let e=0;e<o;e++){const n=new mK(t,{[i]:e});let o=true,a=false;for(const{cell:e,row:t,column:r}of n){if(!fK(e.getAttribute("tableCellType"))){o=false;break}("row"===i?r:t)>=s&&(a=true);}if(!o)return Math.min(r,e);a&&(r=Math.max(r,e+1));}return Math.min(r,o)}const oY=/^(top|middle|bottom)$/,rY=/^(left|center|right|justify)$/;class aY extends Ms{static get pluginName(){return "TableCellPropertiesEditing"}static get licenseFeatureCode(){return "TCP"}static get isOfficialPlugin(){return  true}static get isPremiumPlugin(){return  true}static get requires(){return [tQ,GQ]}init(){const e=this.editor,t=e.model.schema,i=e.conversion;e.config.define("table.tableCellProperties.defaultProperties",{});const n=pJ(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:true,includeHorizontalAlignmentProperty:true,includePaddingProperty:true,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection});e.data.addStyleProcessorRules(dd),function(e,t){const{conversion:i}=e,{schema:n}=e.model,s={width:"tableCellBorderWidth",color:"tableCellBorderColor",style:"tableCellBorderStyle"};n.extend("tableCell",{allowAttributes:Object.values(s)});for(const e of Object.values(s))n.setAttributeProperties(e,{isFormatting:true});eK(e,"td",s,t),eK(e,"th",s,t),tK(i,{modelElement:"tableCell",modelAttribute:s.style,styleName:"border-style"}),tK(i,{modelElement:"tableCell",modelAttribute:s.color,styleName:"border-color"}),tK(i,{modelElement:"tableCell",modelAttribute:s.width,styleName:"border-width"});}(e,{color:n.borderColor,style:n.borderStyle,width:n.borderWidth}),e.commands.add("tableCellBorderStyle",new XQ(e,n.borderStyle)),e.commands.add("tableCellBorderColor",new eY(e,n.borderColor)),e.commands.add("tableCellBorderWidth",new tY(e,n.borderWidth)),vK(t,i,{modelAttribute:"tableCellHeight",styleName:"height",attributeName:"height",attributeType:"length",defaultValue:n.height}),e.commands.add("tableCellHeight",new JQ(e,n.height)),e.data.addStyleProcessorRules(kd),vK(t,i,{modelAttribute:"tableCellPadding",styleName:"padding",reduceBoxSides:true,defaultValue:n.padding}),function(e,t){oK(e,"td",t),oK(e,"th",t);}(e,n.padding),e.commands.add("tableCellPadding",new KQ(e,n.padding)),e.data.addStyleProcessorRules(od),vK(t,i,{modelAttribute:"tableCellBackgroundColor",styleName:"background-color",attributeName:"bgcolor",attributeType:"color",defaultValue:n.backgroundColor}),e.commands.add("tableCellBackgroundColor",new QQ(e,n.backgroundColor)),function(e,t,i){e.extend("tableCell",{allowAttributes:["tableCellHorizontalAlignment"]}),e.setAttributeProperties("tableCellHorizontalAlignment",{isFormatting:true}),t.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellHorizontalAlignment"},view:e=>({key:"style",value:{"text-align":e}})}),t.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"text-align":rY}},model:{key:"tableCellHorizontalAlignment",value:(e,t,n)=>{const s=nK(i,"left",n),o=e.getStyle("text-align");if(o!==s)return o;t.consumable.consume(e,{styles:"text-align"});}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{align:rY}},model:{key:"tableCellHorizontalAlignment",value:(e,t,n)=>{const s=nK(i,"left",n),o=e.getAttribute("align");if(o!==s)return o;t.consumable.consume(e,{attributes:"align"});}}});}(t,i,n.horizontalAlignment),e.commands.add("tableCellHorizontalAlignment",new ZQ(e,n.horizontalAlignment)),function(e,t,i){e.extend("tableCell",{allowAttributes:["tableCellVerticalAlignment"]}),e.setAttributeProperties("tableCellVerticalAlignment",{isFormatting:true}),t.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellVerticalAlignment"},view:e=>({key:"style",value:{"vertical-align":e}})}),t.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"vertical-align":oY}},model:{key:"tableCellVerticalAlignment",value:(e,t,n)=>{const s=nK(i,"middle",n),o=e.getStyle("vertical-align");if(o!==s)return o;t.consumable.consume(e,{styles:"vertical-align"});}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{valign:oY}},model:{key:"tableCellVerticalAlignment",value:(e,t,n)=>{const s=nK(i,"middle",n),o=e.getAttribute("valign");if(o!==s)return o;t.consumable.consume(e,{attributes:"valign"});}}});}(t,i,n.verticalAlignment),e.commands.add("tableCellVerticalAlignment",new YQ(e,n.verticalAlignment)),function(e){const{model:t,conversion:i,editing:n,config:s}=e,{schema:o}=t;s.define("table.tableCellProperties.scopedHeaders",true);const r=!!s.get("table.tableCellProperties.scopedHeaders"),a=e.plugins.get(rJ);o.extend("tableCell",{allowAttributes:["tableCellType"]}),o.setAttributeProperties("tableCellType",{isFormatting:true}),o.addAttributeCheck(e=>{const t=Array.from(e).reverse().find(e=>"table"===e.name);if("layout"===t?.getAttribute("tableType"))return  false},"tableCellType"),i.for("upcast").add(e=>{e.on("element:th",(e,t,i)=>{const{writer:n}=i,{modelRange:s}=t,o=s?.start.nodeAfter;o?.is("element","tableCell")&&!o.hasAttribute("tableCellType")&&n.setAttribute("tableCellType","header",o);}),e.on("element:table",(e,t,i)=>{const{writer:n}=i,{modelRange:s}=t,o=s?.start.nodeAfter;if(o?.is("element","table")&&"layout"===o.getAttribute("tableType"))for(const{cell:e}of new mK(o)){if(fK(e.getAttribute("tableCellType"))){n.setAttribute("tableType","content",o);break}}},{priority:E.low-1});}),r&&(i.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellType"},view:e=>{switch(e){case "header-row":return {key:"scope",value:"row"};case "header-column":return {key:"scope",value:"col"}}}}),i.for("upcast").add(e=>{e.on("element:th",(e,t,i)=>{const{writer:n,consumable:s}=i,{viewItem:o,modelRange:r}=t,a=r.start.nodeAfter,l=a?.getAttribute("tableCellType");if("header"===l&&s.consume(o,{attributes:["scope"]})){switch(o.getAttribute("scope")){case "row":n.setAttribute("tableCellType","header-row",a);break;case "col":n.setAttribute("tableCellType","header-column",a);}}});}));t.document.registerPostFixer(e=>{const i=t.document.differ.getChanges(),n=new Set;for(const e of i){if("attribute"===e.type&&("headingRows"===e.attributeKey||"headingColumns"===e.attributeKey)){const t=e.range.start.nodeAfter;t?.is("element","table")&&"$graveyard"!==t.root.rootName&&n.add(t);}if("attribute"===e.type&&"tableCellType"===e.attributeKey){const t=e.range.start.nodeAfter;if(t?.is("element","tableCell")&&"$graveyard"!==t.root.rootName){const e=t.findAncestor("table");e&&n.add(e);}}if("insert"===e.type&&e.position.nodeAfter)for(const{item:i}of t.createRangeOn(e.position.nodeAfter))if(i.is("element","tableCell")&&i.getAttribute("tableCellType")&&"$graveyard"!==i.root.rootName){const e=i.findAncestor("table");e&&n.add(e);}}return nY(a,e,n)}),t.document.on("change:data",()=>{const{differ:e}=t.document,i=new Set;for(const t of e.getChanges())if("attribute"===t.type&&"tableCellType"===t.attributeKey){const e=t.range.start.nodeAfter;e.is("element","tableCell")&&i.add(e);}for(const e of i){const t=n.mapper.toViewElement(e),i=fK(e.getAttribute("tableCellType"))?"th":"td";t?.name!==i&&n.reconvertItem(e);}});}(e),e.commands.add("tableCellType",new iY(e));}}class lY extends Ms{static get pluginName(){return "TableCellProperties"}static get isOfficialPlugin(){return  true}static get requires(){return [aY,jQ]}}class cY extends Ms{static get pluginName(){return "TableLayoutUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=this.editor.t;e.ui.componentFactory.add("insertTableLayout",i=>{const n=e.commands.get("insertTableLayout"),s=ww(i);let o;return s.bind("isEnabled").to(n),s.buttonView.set({icon:lp,label:t("Insert table layout"),tooltip:true}),s.on("change:isOpen",()=>{o||(o=new nQ(i),s.panelView.children.add(o),o.delegate("execute").to(s),s.on("execute",()=>{e.execute("insertTableLayout",{rows:o.rows,columns:o.columns}),e.editing.view.focus();}));}),s}),e.ui.componentFactory.add("menuBar:insertTableLayout",i=>{const n=e.commands.get("insertTableLayout"),s=new x_(i),o=new nQ(i);return o.delegate("execute").to(s),s.on("change:isOpen",(e,t,i)=>{i||o.reset();}),o.on("execute",()=>{e.execute("insertTableLayout",{rows:o.rows,columns:o.columns}),e.editing.view.focus();}),s.buttonView.set({label:t("Table layout"),icon:lp}),s.panelView.children.add(o),s.bind("isEnabled").to(n),s}),e.ui.componentFactory.add("tableType",()=>{const e=this.editor,t=e.t,i=new Gb(e.locale);return i.set({label:t("Table type"),icon:op,tooltip:true}),uY(e,i)});}afterInit(){const{editor:e}=this,{ui:t,plugins:i}=e;if(!e.plugins.has("TablePropertiesUI"))return;const n=i.get("TablePropertiesUI");t.componentFactory.add("tableProperties",t=>{const i=n._createTablePropertiesButton(),s=new bw(t,i);return uY(e,s)});}}function uY(e,t){const i=e.t,n=e.locale,s=e.commands.get("tableType"),o=ww(n,t),r=function(e){const t=e.t,i=e.commands.get("tableType"),n=new kn;return n.add(dY(i,"layout",t("Layout table"))),n.add(dY(i,"content",t("Content table"))),n}(e);return Cw(o,r,{ariaLabel:i("Table type options"),role:"menu"}),t.tooltip=i("Choose table type"),o.on("execute",e=>{const t=e.source.tableType;t&&s.execute(t);}),o}function dY(e,t,i){const n=new e_({label:i,role:"menuitemradio",withText:true,tableType:t});return n.bind("isEnabled").to(e,"isEnabled"),n.bind("isOn").to(e,"value",e=>e===t),{type:"button",model:n}}class hY extends Ns{refresh(){const e=this.editor.model,t=e.document.selection,i=e.schema;this.isEnabled=function(e,t){const i=e.getFirstPosition().parent,n=i===i.root?i:i.parent;return t.checkChild(n,"table")}(t,i);}execute(e={}){const t=this.editor,i=t.model,n=t.plugins.get("TableUtils");i.change(s=>{const o={rows:e.rows||2,columns:e.columns||2},r=n.createTable(s,o);s.setAttribute("tableType","layout",r),i.insertObject(r,null,null,{findOptimalPosition:"auto"});const a=100/o.columns+"%",l=Array(o.columns).fill(a);t.commands.get("resizeColumnWidths").execute({tableWidth:"100%",columnWidths:l,table:r}),s.setSelection(s.createPositionAt(r.getNodeByPath([0,0,0]),0));});}}class mY extends Ns{refresh(){this.isEnabled=true;}execute(e={}){const{model:t,plugins:i}=this.editor;let{table:n=t.document.selection.getSelectedElement(),columnWidths:s,tableWidth:o}=e;s&&(s=Array.isArray(s)?s:s.split(",")),t.change(e=>{o?e.setAttribute("tableWidth",o,n):e.removeAttribute("tableWidth",n);const t=i.get("TableColumnResizeEditing").getColumnGroupElement(n);if(!s&&!t)return;if(!s)return e.remove(t);const r=XK(s);if(t)Array.from(t.getChildren()).forEach((t,i)=>e.setAttribute("columnWidth",r[i],t));else {const t=e.createElement("tableColumnGroup");r.forEach(i=>e.appendElement("tableColumn",{columnWidth:i},t)),e.append(t,n);}});}}function gY(e){return t=>t.on("element:colgroup",(t,i,n)=>{const s=i.modelCursor.findAncestor("table"),o=iJ(s);if(!o)return;const r=nJ(o),a=e.getColumns(s);let l=oJ(o,n.writer);l=Array.from({length:a},(e,t)=>l[t]||"auto"),(l.length!=r.length||l.includes("auto"))&&tJ(r,o,XK(l),n.writer);},{priority:"low"})}function fY(){return e=>e.on("insert:table",(e,t,i)=>{const n=i.writer,s=t.item,o=i.mapper.toViewElement(s),r=o.is("element","table")?o:Array.from(o.getChildren()).find(e=>e.is("element","table"));iJ(s)?n.addClass("ck-table-resized",r):n.removeClass("ck-table-resized",r);},{priority:"low"})}const pY=Ri("px");class bY extends Ms{_isResizingActive;_resizingData;_domEmitter;_tableUtilsPlugin;_initialMouseEventData=null;static get requires(){return [tQ,rJ]}static get pluginName(){return "TableColumnResizeEditing"}static get licenseFeatureCode(){return "TCR"}static get isOfficialPlugin(){return  true}static get isPremiumPlugin(){return  true}constructor(e){super(e),this._isResizingActive=false,this.set("_isResizingAllowed",true),this._resizingData=null,this._domEmitter=new(ci()),this._tableUtilsPlugin=e.plugins.get("TableUtils"),this.on("change:_isResizingAllowed",(t,i,n)=>{const s=n?"removeClass":"addClass";e.editing.view.change(t=>{for(const i of e.editing.view.document.roots)t[s]("ck-column-resize_disabled",e.editing.view.document.getRoot(i.rootName));});});}init(){this._extendSchema(),this._registerPostFixer(),this._registerConverters(),this._registerResizingListeners(),this._registerResizerInserter();const e=this.editor,t=e.plugins.get("TableColumnResize");e.plugins.get("TableEditing").registerAdditionalSlot({filter:e=>e.is("element","tableColumnGroup"),positionOffset:0});const i=new mY(e);e.commands.add("resizeTableWidth",i),e.commands.add("resizeColumnWidths",i),this.bind("_isResizingAllowed").to(e,"isReadOnly",t,"isEnabled",i,"isEnabled",(e,t,i)=>!e&&t&&i);}destroy(){this._domEmitter.stopListening(),super.destroy();}getColumnGroupElement(e){return iJ(e)}getTableColumnElements(e){return nJ(e)}getTableColumnsWidths(e){return sJ(e)}_extendSchema(){const e=this.editor.model.schema;e.extend("table",{allowAttributes:["tableWidth"]}),e.register("tableColumnGroup",{allowIn:"table",isLimit:true}),e.register("tableColumn",{allowIn:"tableColumnGroup",allowAttributes:["columnWidth","colSpan"],isLimit:true}),e.setAttributeProperties("columnWidth",{isFormatting:true});}_registerPostFixer(){const e=this.editor.model;function t(e,t,i){const n=i._tableUtilsPlugin.getColumns(t);if(0===n-e.length)return e;const s=e.map(e=>Number(e.replace("%",""))),o=function(e,t){const i=new Set;for(const n of e.getChanges())if("insert"==n.type&&n.position.nodeAfter&&"tableCell"==n.position.nodeAfter.name&&n.position.nodeAfter.getAncestors().includes(t))i.add(n.position.nodeAfter);else if("remove"==n.type){const e=n.position.nodeBefore||n.position.nodeAfter;"tableCell"==e.name&&e.getAncestors().includes(t)&&i.add(e);}return i}(i.editor.model.document.differ,t);for(const e of o){const o=n-s.length;if(0===o)continue;const r=o>0,a=i._tableUtilsPlugin.getCellLocation(e).column;if(r){const e=YK(o,jK(t,i.editor));s.splice(a,0,...e);}else {const e=s.splice(a,Math.abs(o));s[a]+=ZK(e);}}return s.map(e=>e+"%")}e.document.registerPostFixer(i=>{let n=false;for(const s of UK(e)){const e=this.getColumnGroupElement(s),o=this.getTableColumnElements(e),r=this.getTableColumnsWidths(e);let a=XK(r);a=t(a,s,this),dt(r,a)||(tJ(o,e,a,i),n=true);}return n});}_registerConverters(){const e=this.editor.conversion;e.for("upcast").attributeToAttribute({view:{name:/^(figure|table)$/,styles:{width:/[\s\S]+/}},model:{key:"tableWidth",value:e=>{if(!e.parent.is("element","figure"))return e.getStyle("width")}}}),e.for("downcast").attributeToAttribute({model:{name:"table",key:"tableWidth"},view:e=>({name:"figure",key:"style",value:{width:e}})}),e.elementToElement({model:"tableColumnGroup",view:"colgroup"}),e.elementToElement({model:"tableColumn",view:"col"}),e.for("downcast").add(fY()),e.for("upcast").add(e=>{e.on("element:table",(e,t,i)=>{i.consumable.consume(t.viewItem,{classes:"ck-table-resized"});});}),e.for("upcast").add(gY(this._tableUtilsPlugin)),e.for("upcast").attributeToAttribute({view:{name:"col",styles:{width:/.*/}},model:{key:"columnWidth",value:e=>{const t=e.getStyle("width");return t&&(t.endsWith("%")||t.endsWith("pt"))?t:"auto"}}}),e.for("upcast").attributeToAttribute({view:{name:"col",key:"span"},model:"colSpan"}),e.for("downcast").attributeToAttribute({model:{name:"tableColumn",key:"columnWidth"},view:e=>({key:"style",value:{width:e}})});}_registerResizingListeners(){const t=this.editor.editing.view;t.addObserver(hQ),t.document.on("mouseover",this._onMouseOverHandler.bind(this),{priority:"high"}),t.document.on("mousedown",this._onMouseDownHandler.bind(this),{priority:"high"}),t.document.on("mouseout",this._onMouseOutHandler.bind(this),{priority:"high"}),this._domEmitter.listenTo(exports.global.window.document,"mousemove",ot(this._onMouseMoveHandler.bind(this),50)),this._domEmitter.listenTo(exports.global.window.document,"mouseup",this._onMouseUpHandler.bind(this));}_recalculateResizerElement(e){const t=this.editor,i=t.editing.view.domConverter,n=i.mapViewToDom(e.findAncestor("table")),s=i.mapViewToDom(e.findAncestor(e=>["td","th"].includes(e.name))),o=new Ci(n),r=new Ci(s),a=pY(Number((o.top-r.top).toFixed(4))),l=pY(Number((r.bottom-o.bottom).toFixed(4)));t.editing.view.change(t=>{t.setStyle("top",a,e),t.setStyle("bottom",l,e);});}_resetResizerStyles(e){this.editor.editing.view.change(t=>{t.removeStyle("top",e),t.removeStyle("bottom",e);});}_onMouseOverHandler(e,t){const i=t.target;i.hasClass("ck-table-column-resizer")&&this._isResizingAllowed&&this._recalculateResizerElement(i);}_onMouseOutHandler(e,t){const i=t.target;i.hasClass("ck-table-column-resizer")&&this._isResizingAllowed&&(this._isResizingActive||this._resetResizerStyles(i));}_onMouseDownHandler(e,t){const i=t.target;if(!i.hasClass("ck-table-column-resizer"))return;if(!this._isResizingAllowed)return;const n=this.editor,s=n.editing.mapper.toModelElement(i.findAncestor("figure"));n.model.canEditAt(s)&&(t.preventDefault(),e.stop(),this._initialMouseEventData=t);}_startResizingAfterThreshold(){const e=this._initialMouseEventData,{target:t}=e,i=this.editor.editing.mapper.toModelElement(t.findAncestor("figure")),n=t.findAncestor("table"),s=function(e,t,i){const n=Array(t.getColumns(e)),s=new mK(e);for(const e of s){const t=i.editing.mapper.toViewElement(e.cell),s=eJ(i.editing.view.domConverter.mapViewToDom(t));(!n[e.column]||s<n[e.column])&&(n[e.column]=JK(s));}return n}(i,this._tableUtilsPlugin,this.editor);Array.from(n.getChildren()).find(e=>e.is("element","colgroup"))||this.editor.editing.view.change(e=>{!function(e,t,i){const n=e.createContainerElement("colgroup");for(let i=0;i<t.length;i++){const s=e.createEmptyElement("col"),o=`${JK(t[i]/ZK(t)*100)}%`;e.setStyle("width",o,s),e.insert(e.createPositionAt(n,"end"),s);}e.insert(e.createPositionAt(i,0),n);}(e,s,n);}),this._isResizingActive=true,this._resizingData=this._getResizingData(e,s),this.editor.editing.view.change(e=>function(e,t,i){const n=i.widths.viewFigureWidth/i.widths.viewFigureParentWidth;e.addClass("ck-table-resized",t),e.addClass("ck-table-column-resizer__active",i.elements.viewResizer),e.setStyle("width",`${JK(100*n)}%`,t.findAncestor("figure"));}(e,n,this._resizingData));}_onMouseMoveHandler(e,t){if(this._initialMouseEventData){const e=this._initialMouseEventData.domEvent;if(!(Math.abs(t.clientX-e.clientX)>=3))return;this._startResizingAfterThreshold(),this._initialMouseEventData=null;}if(!this._isResizingActive)return;if(!this._isResizingAllowed)return void this._onMouseUpHandler();const{columnPosition:i,flags:{isRightEdge:n,isTableCentered:s,isLtrContent:o},elements:{viewFigure:r,viewLeftColumn:a,viewRightColumn:l,viewResizer:c},widths:{viewFigureParentWidth:u,tableWidth:d,leftColumnWidth:h,rightColumnWidth:m}}=this._resizingData,g=40-h,f=n?u-d:m-40,p=(o?1:-1)*(n&&s?2:1),b=QK((t.clientX-i)*p,Math.min(g,0),Math.max(f,0));0!==b&&(this.editor.editing.view.change(e=>{const t=JK(100*(h+b)/d);if(e.setStyle("width",`${t}%`,a),n){const t=JK(100*(d+b)/u);e.setStyle("width",`${t}%`,r);}else {const t=JK(100*(m-b)/d);e.setStyle("width",`${t}%`,l);}}),this._recalculateResizerElement(c));}_onMouseUpHandler(){if(this._initialMouseEventData=null,!this._isResizingActive)return;const{viewResizer:e,modelTable:t,viewFigure:i,viewColgroup:n}=this._resizingData.elements,s=this.editor,o=s.editing.view,r=this.getColumnGroupElement(t),a=Array.from(n.getChildren()).filter(e=>e.is("view:element")),l=r?this.getTableColumnsWidths(r):null,c=a.map(e=>e.getStyle("width")),u=!dt(l,c),d=t.getAttribute("tableWidth"),h=i.getStyle("width"),m=d!==h;(u||m)&&(this._isResizingAllowed?s.execute("resizeTableWidth",{table:t,tableWidth:`${JK(h)}%`,columnWidths:c}):o.change(e=>{if(l)for(const t of a)e.setStyle("width",l.shift(),t);else e.remove(n);m&&(d?e.setStyle("width",d,i):e.removeStyle("width",i)),l||d||e.removeClass("ck-table-resized",[...i.getChildren()].find(e=>"table"===e.name));})),o.change(t=>{t.removeClass("ck-table-column-resizer__active",e);});o.domConverter.mapViewToDom(e).matches(":hover")||this._resetResizerStyles(e),this._isResizingActive=false,this._resizingData=null;}_getResizingData(e,t){const i=this.editor,n=e.domEvent.clientX,s=e.target,o=s.findAncestor("td")||s.findAncestor("th"),r=i.editing.mapper.toModelElement(o),a=r.findAncestor("table"),l=KK(r,this._tableUtilsPlugin).rightEdge,c=this._tableUtilsPlugin.getColumns(a)-1;let u=a.getAttribute("tableAlignment");"layout"!==a.getAttribute("tableType")&&(u||=i.config.get("table.tableProperties.defaultProperties.alignment"),u||="center");const d=l===c,h="rtl"!==i.locale.contentLanguageDirection,m="center"===u,g=o.findAncestor("table"),f=g.findAncestor("figure"),p=[...g.getChildren()].find(e=>e.is("element","colgroup")),b=p.getChild(l),w=d?void 0:p.getChild(l+1);return {columnPosition:n,flags:{isRightEdge:d,isTableCentered:m,isLtrContent:h},elements:{viewResizer:s,modelTable:a,viewFigure:f,viewColgroup:p,viewLeftColumn:b,viewRightColumn:w},widths:{viewFigureParentWidth:GK(i.editing.view.domConverter.mapViewToDom(f.parent)),viewFigureWidth:GK(i.editing.view.domConverter.mapViewToDom(f)),tableWidth:$K(a,i),leftColumnWidth:t[l],rightColumnWidth:d?void 0:t[l+1]}}}_registerResizerInserter(){this.editor.conversion.for("editingDowncast").add(e=>{e.on("insert:tableCell",(e,t,i)=>{const n=t.item,s=i.mapper.toViewElement(n),o=i.writer;o.insert(o.createPositionAt(s,"end"),o.createUIElement("div",{class:"ck-table-column-resizer"}));},{priority:"lowest"});});}}class wY extends Ms{static get requires(){return [bY,GQ]}static get pluginName(){return "TableColumnResize"}static get isOfficialPlugin(){return  true}}class vY extends Ns{refresh(){const e=_K(this.editor.model.document.selection);e?(this.isEnabled=true,this.value=e.getAttribute("tableType")):(this.isEnabled=false,this.value=null);}execute(e){const t=this.editor.model,i=_K(t.document.selection);i.getAttribute("tableType")!==e&&t.change(n=>{n.setAttribute("tableType",e,i),t.schema.removeDisallowedAttributes([i],n);const s=i.getChildren();for(const e of s)t.schema.checkChild(i,e)||n.remove(e);});}}const _Y=["content","layout"];class yY extends Ms{static get pluginName(){return "TableLayoutEditing"}static get licenseFeatureCode(){return "TL"}static get requires(){return [wY]}static get isOfficialPlugin(){return  true}static get isPremiumPlugin(){return  true}init(){this._defineSchema(),this._defineConverters(),this._defineClipboardPasteHandlers(),this._registerTableTypeAttributePostfixer(),this.editor.commands.add("insertTableLayout",new hY(this.editor)),this.editor.commands.add("tableType",new vY(this.editor));}_defineSchema(){const{schema:e}=this.editor.model;e.extend("table",{allowAttributes:"tableType"}),e.addChildCheck(CY,"caption"),e.addAttributeCheck(CY,"headingRows"),e.addAttributeCheck(CY,"headingColumns"),e.addAttributeCheck(CY,"footerRows");}_defineConverters(){const{editor:e}=this,{conversion:t}=e,i=e.config.get("table.tableLayout.preferredExternalTableType");t.for("upcast").add(function(e,t){return e=>{e.on("element:table",(e,i,n)=>{const s=i.viewItem;if(!n.consumable.test(s,{name:true}))return;if("content"==kY(s,t))return;const o=n.writer.createElement("table",{tableType:"layout"});if(n.safeInsert(o,i.modelCursor)){n.consumable.consume(s,{name:true}),n.consumable.consume(s,{attributes:["role"]}),n.consumable.consume(s,{classes:["layout-table"]}),"0"===s.getAttribute("border")&&n.consumable.consume(s,{attributes:["border"]});for(const e of s.getChildren())if(e.is("element"))for(const t of e.getChildren())t.is("element","tr")&&n.convertItem(t,n.writer.createPositionAt(o,"end"));if(n.convertChildren(s,n.writer.createPositionAt(o,"end")),o.isEmpty){const e=n.writer.createElement("tableRow");n.writer.insert(e,n.writer.createPositionAt(o,"end")),bK(n.writer,n.writer.createPositionAt(e,"end"));}n.updateConversionResult(o,i);}},{priority:"high"}),e.on("element:table",(e,i,n)=>{const{viewItem:s,modelRange:o}=i;o&&(n.writer.setAttribute("tableType",kY(s,t),o),n.consumable.consume(s,{classes:["layout-table"]}),n.consumable.consume(s,{classes:["content-table"]}));},{priority:"low"});}}(0,i)),t.for("dataDowncast").add(e=>e.on("attribute:tableType:table",(e,t,i)=>{const{item:n,attributeNewValue:s}=t,{mapper:o,writer:r}=i;if(!i.consumable.test(n,e.name))return;const a=o.toViewElement(n);r.addClass(`${s}-table`,a),"layout"==s&&r.setAttribute("role","presentation",a),i.consumable.consume(n,e.name);})),t.for("editingDowncast").attributeToAttribute({model:{key:"tableType",values:["layout","content"]},view:{layout:{key:"class",value:["layout-table"]},content:{key:"class",value:["content-table"]}}});}_defineClipboardPasteHandlers(){const{plugins:e}=this.editor;if(!e.has("ClipboardPipeline"))return;const t=e.get("ClipboardPipeline");this.listenTo(t,"contentInsertion",(e,t)=>{t.sourceEditorId||this.editor.model.change(e=>{for(const{item:i}of e.createRangeIn(t.content))i.is("element","table")&&e.setAttribute("tableType","content",i);});});}_registerTableTypeAttributePostfixer(){const e=this.editor;e.model.document.registerPostFixer(t=>{const i=e.model.document.differ.getChanges();let n=false;for(const s of i){if("insert"==s.type&&"$text"!=s.name){const e=s.position.nodeAfter,i=t.createRangeOn(e);for(const e of i.getItems())e.is("element","table")&&!e.hasAttribute("tableType")&&(t.setAttribute("tableType","content",e),n=true);}if("attribute"==s.type&&"tableType"==s.attributeKey)for(const i of s.range.getItems())if(i.is("element","table")){e.model.schema.removeDisallowedAttributes([i],t);const s=i.getChildren();for(const o of s)e.model.schema.checkChild(i,o)||(t.remove(o),n=true);}}return n});}}function kY(e,t){if(e.hasClass("content-table"))return "content";if(e.hasClass("layout-table"))return "layout";if(t&&_Y.includes(t))return t;return e.parent.is("element","figure")||Array.from(e.getChildren()).some(e=>e.is("element","caption"))?"content":"layout"}function CY(e){if(e.endsWith("table")&&"layout"==e.last.getAttribute("tableType"))return  false}class xY extends Ms{static get pluginName(){return "TableLayout"}static get isOfficialPlugin(){return  true}static get requires(){return [wY,yY,cY]}}class AY extends Ns{attributeName;_defaultValue;_defaultContentTableValue;_defaultLayoutTableValue;constructor(e,t,i){super(e),this.attributeName=t,this._defaultContentTableValue=i,this._defaultLayoutTableValue="tableBorderStyle"===t?"none":void 0;}refresh(){const e=_K(this.editor.model.document.selection);this._defaultValue=e&&"layout"===e.getAttribute("tableType")?this._defaultLayoutTableValue:this._defaultContentTableValue,this.isEnabled=!!e,this.value=this._getValue(e);}execute(e={}){const t=this.editor.model,i=t.document.selection,{value:n,batch:s}=e,o=_K(i),r=this._getValueToSet(n);t.enqueueChange(s,e=>{r?e.setAttribute(this.attributeName,r,o):e.removeAttribute(this.attributeName,o);});}_getValue(e){if(!e)return;const t=e.getAttribute(this.attributeName);return t!==this._defaultValue?t:void 0}_getValueToSet(e){if(e!==this._defaultValue)return e}}class EY extends AY{constructor(e,t){super(e,"tableBackgroundColor",t);}}class TY extends AY{constructor(e,t){super(e,"tableBorderColor",t);}_getValue(e){if(!e)return;const t=hJ(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class SY extends AY{constructor(e,t){super(e,"tableBorderStyle",t);}_getValue(e){if(!e)return;const t=hJ(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class IY extends AY{constructor(e,t){super(e,"tableBorderWidth",t);}_getValue(e){if(!e)return;const t=hJ(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){const t=mJ(e,"px");if(t!==this._defaultValue)return t}}class PY extends AY{constructor(e,t){super(e,"tableWidth",t);}_getValueToSet(e){if((e=mJ(e,"px"))!==this._defaultValue)return e}}class VY extends AY{constructor(e,t){super(e,"tableHeight",t);}_getValueToSet(e){if((e=mJ(e,"px"))!==this._defaultValue)return e}}class RY extends AY{constructor(e,t){super(e,"tableAlignment",t);}}class OY extends Ms{static get pluginName(){return "TablePropertiesEditing"}static get licenseFeatureCode(){return "TCP"}static get isOfficialPlugin(){return  true}static get isPremiumPlugin(){return  true}static get requires(){return [tQ]}init(){const e=this.editor,t=e.model.schema,i=e.conversion;e.config.define("table.tableProperties.defaultProperties",{});const n=fJ(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:true}),s=true===e.config.get("table.tableProperties.alignment.useInlineStyles");e.data.addStyleProcessorRules(yd),e.data.addStyleProcessorRules(dd),function(e,t){const{conversion:i}=e,{schema:n}=e.model,s={width:"tableBorderWidth",color:"tableBorderColor",style:"tableBorderStyle"};n.extend("table",{allowAttributes:Object.values(s)});for(const e of Object.values(s))n.setAttributeProperties(e,{isFormatting:true});eK(e,"table",s,t),iK(i,{modelAttribute:s.color,styleName:"border-color"}),iK(i,{modelAttribute:s.style,styleName:"border-style"}),iK(i,{modelAttribute:s.width,styleName:"border-width"});}(e,{color:n.borderColor,style:n.borderStyle,width:n.borderWidth}),e.commands.add("tableBorderColor",new TY(e,n.borderColor)),e.commands.add("tableBorderStyle",new SY(e,n.borderStyle)),e.commands.add("tableBorderWidth",new IY(e,n.borderWidth)),function(e,t,i,n){e.extend("table",{allowAttributes:["tableAlignment"]}),e.setAttributeProperties("tableAlignment",{isFormatting:true}),t.for("downcast").attributeToAttribute({model:{name:"table",key:"tableAlignment",values:["left","center","right","blockLeft","blockRight"]},view:{left:n?{key:"style",value:{float:"left","margin-right":"var(--ck-content-table-style-spacing, 1.5em)"}}:{key:"class",value:rK.className},right:n?{key:"style",value:{float:"right","margin-left":"var(--ck-content-table-style-spacing, 1.5em)"}}:{key:"class",value:lK.className},center:n?{key:"style",value:{"margin-left":"auto","margin-right":"auto"}}:{key:"class",value:aK.className},blockLeft:n?{key:"style",value:{"margin-left":"0","margin-right":"auto"}}:{key:"class",value:cK.className},blockRight:n?{key:"style",value:{"margin-left":"auto","margin-right":"0"}}:{key:"class",value:uK.className}},converterPriority:"high"}),dK.forEach(e=>{t.for("upcast").attributeToAttribute({view:e.view,model:{key:"tableAlignment",value:(t,n,s)=>{if(function(e){return "figure"==e.name&&!e.hasClass("table")}(t))return;const o=nK(i,"",s),r=e.getAlign(t),a=e.getConsumables(t);return n.consumable.consume(t,a),r!==o?r:void 0}}});}),t.for("upcast").add(function(e){return t=>{t.on("element:div",(t,i,n)=>{if(!n.consumable.test(i.viewItem,{name:true,attributes:"align"}))return;const s=BK(i.viewItem);if(!s||!n.consumable.test(s,{name:true}))return;n.consumable.consume(i.viewItem,{name:true,attributes:"align"});const o=n.convertItem(s,i.modelCursor),r=Cn(o.modelRange.getItems());if(!r||!r.is("element","table"))return n.consumable.revert(i.viewItem,{name:true,attributes:"align"}),void(o.modelRange&&!o.modelRange.isCollapsed&&(i.modelRange=o.modelRange,i.modelCursor=o.modelCursor));const a=function(e,t,i){if(e)switch(e){case "right":return "right"===t?"right":"left"===t?"left":"blockRight";case "center":return "center";case "left":return void 0===t?"blockLeft":"left";default:return i}return}(i.viewItem.getAttribute("align"),s.getAttribute("align"),nK(e,"",i));a&&n.writer.setAttribute("tableAlignment",a,r),n.convertChildren(i.viewItem,n.writer.createPositionAt(r,"end")),n.updateConversionResult(r,i);});}}(i));}(t,i,n.alignment,s),e.commands.add("tableAlignment",new RY(e,n.alignment)),MY(t,i,{modelAttribute:"tableWidth",styleName:"width",attributeName:"width",attributeType:"length",defaultValue:n.width}),e.commands.add("tableWidth",new PY(e,n.width)),MY(t,i,{modelAttribute:"tableHeight",styleName:"height",attributeName:"height",attributeType:"length",defaultValue:n.height}),e.commands.add("tableHeight",new VY(e,n.height)),e.data.addStyleProcessorRules(od),function(e,t,i){const{modelAttribute:n}=i;e.extend("table",{allowAttributes:[n]}),e.setAttributeProperties(n,{isFormatting:true}),XG(t,{viewElement:"table",...i}),iK(t,i);}(t,i,{modelAttribute:"tableBackgroundColor",styleName:"background-color",attributeName:"bgcolor",attributeType:"color",defaultValue:n.backgroundColor}),e.commands.add("tableBackgroundColor",new EY(e,n.backgroundColor)),oK(e,"table");const o=e.editing.view.document;this.listenTo(o,"clipboardOutput",(t,i)=>{e.editing.view.change(e=>{for(const{item:t}of e.createRangeIn(i.content))BY(t,e);i.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(i.content));});},{priority:"lowest"});}}function BY(e,t){if(!e.is("element","table"))return;const i=e.getAttribute("align"),n=e.getStyle("float"),s=e.getStyle("margin-left"),o=e.getStyle("margin-right");i&&"center"===i||n&&"right"===n&&i&&"right"===i?LY(t,i,e):void 0===n&&"auto"===s&&"0"===o&&LY(t,"right",e);}function LY(e,t,i){const n=e.createPositionBefore(i),s=e.createContainerElement("div",{align:t},i);e.insert(n,s);}function MY(e,t,i){const{modelAttribute:n}=i;e.extend("table",{allowAttributes:[n]}),e.setAttributeProperties(n,{isFormatting:true}),XG(t,{viewElement:/^(table|figure)$/,shouldUpcast:e=>!("table"==e.name&&"figure"==e.parent.name||"figure"==e.name&&!e.hasClass("table")),...i}),tK(t,{modelElement:"table",...i});}class FY extends Cs{options;focusTracker;keystrokes;children;borderStyleDropdown;borderWidthInput;borderColorInput;backgroundInput;widthInput;heightInput;alignmentToolbar;saveButtonView;cancelButtonView;backButtonView;_focusables;_focusCycler;constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",alignment:""}),this.options=t;const{borderStyleDropdown:i,borderWidthInput:n,borderColorInput:s,borderRowLabel:o}=this._createBorderFields(),{backgroundRowLabel:r,backgroundInput:a}=this._createBackgroundFields(),{widthInput:l,operatorLabel:c,heightInput:u,dimensionsLabel:d}=this._createDimensionFields(),{alignmentToolbar:h,alignmentLabel:m}=this._createAlignmentFields();this.focusTracker=new An,this.keystrokes=new In,this.children=this.createCollection(),this.borderStyleDropdown=i,this.borderWidthInput=n,this.borderColorInput=s,this.backgroundInput=a,this.widthInput=l,this.heightInput=u,this.alignmentToolbar=h;const{saveButtonView:g,cancelButtonView:f}=this._createActionButtons();this.saveButtonView=g,this.cancelButtonView=f,this.backButtonView=this._createBackButton(),this._focusables=new Xn,this._focusCycler=new Fp({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const p=new Mp(e,{label:this.t("Table properties")});p.children.add(this.backButtonView,0),this.children.add(p),this.children.add(new Jv(e,{labelView:o,children:[o,i,n,s],class:"ck-table-form__border-row"})),this.children.add(new Jv(e,{children:[new Jv(e,{labelView:d,children:[d,l,c,u],class:"ck-table-form__dimensions-row"}),new Jv(e,{labelView:r,children:[r,a],class:"ck-table-form__background-row"})]})),this.children.add(new Jv(e,{labelView:m,children:[m,h],class:"ck-table-properties-form__alignment-row"})),this.children.add(new Jv(e,{children:[this.cancelButtonView,this.saveButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-properties-form"],tabindex:"-1"},children:this.children});}render(){super.render(),Vs({view:this}),[this.borderColorInput,this.backgroundInput].forEach(e=>{this._focusCycler.chain(e.fieldView.focusCycler);}),[this.borderStyleDropdown,this.borderWidthInput,this.borderColorInput,this.widthInput,this.heightInput,this.backgroundInput,this.alignmentToolbar,this.cancelButtonView,this.saveButtonView,this.backButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element);}),this.keystrokes.listenTo(this.element);}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy();}focus(){this._focusCycler.focusFirst();}_createBorderFields(){const e=this.options.defaultTableProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},i=BQ({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),n=this.locale,s=this.t,o=s("Style"),r=new Os(n);r.text=s("Border");const a=AQ(s),l=new Nb(n,Vw);l.set({label:o,class:"ck-table-form__border-style"}),l.fieldView.buttonView.set({ariaLabel:o,ariaLabelledBy:void 0,isOn:false,withText:true,tooltip:o}),l.fieldView.buttonView.bind("label").to(this,"borderStyle",e=>a[e||"none"]),l.fieldView.on("execute",e=>{this.borderStyle=e.source._borderStyleValue;}),l.bind("isEmpty").to(this,"borderStyle",e=>!e),Cw(l.fieldView,VQ(this,t.style),{role:"menu",ariaLabel:o});const c=new Nb(n,Sw);c.set({label:s("Width"),class:"ck-table-form__border-width"}),c.fieldView.bind("value").to(this,"borderWidth"),c.bind("isEnabled").to(this,"borderStyle",NY),c.fieldView.on("input",()=>{this.borderWidth=c.fieldView.element.value;});const u=new Nb(n,i);return u.set({label:s("Color"),class:"ck-table-form__border-color"}),u.fieldView.bind("value").to(this,"borderColor"),u.bind("isEnabled").to(this,"borderStyle",NY),u.fieldView.on("input",()=>{this.borderColor=u.fieldView.value;}),this.on("change:borderStyle",(e,i,n,s)=>{NY(n)||(this.borderColor="",this.borderWidth=""),NY(s)||(this.borderColor=t.color,this.borderWidth=t.width);}),{borderRowLabel:r,borderStyleDropdown:l,borderColorInput:u,borderWidthInput:c}}_createBackgroundFields(){const e=this.locale,t=this.t,i=new Os(e);i.text=t("Background");const n=BQ({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),s=new Nb(e,n);return s.set({label:t("Color"),class:"ck-table-properties-form__background"}),s.fieldView.bind("value").to(this,"backgroundColor"),s.fieldView.on("input",()=>{this.backgroundColor=s.fieldView.value;}),{backgroundRowLabel:i,backgroundInput:s}}_createDimensionFields(){const e=this.locale,t=this.t,i=new Os(e);i.text=t("Dimensions");const n=new Nb(e,Sw);n.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),n.fieldView.bind("value").to(this,"width"),n.fieldView.on("input",()=>{this.width=n.fieldView.element.value;});const s=new Cs(e);s.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const o=new Nb(e,Sw);return o.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),o.fieldView.bind("value").to(this,"height"),o.fieldView.on("input",()=>{this.height=o.fieldView.element.value;}),{dimensionsLabel:i,widthInput:n,operatorLabel:s,heightInput:o}}_createAlignmentFields(){const e=this.locale,t=this.t,i=new Os(e);i.text=t("Table Alignment");const n=new mw(e);return n.set({role:"radiogroup",isCompact:true,ariaLabel:t("Table alignment toolbar")}),RQ({view:this,icons:{left:sf,center:tf,right:of,blockLeft:af,blockRight:lf},toolbar:n,labels:this._alignmentLabels,propertyName:"alignment",defaultValue:this.options.defaultTableProperties.alignment}),{alignmentLabel:i,alignmentToolbar:n}}_createActionButtons(){const e=this.locale,t=this.t,i=new Bp(e),n=new Bp(e),s=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return i.set({label:t("Save"),class:"ck-button-action",type:"submit",withText:true}),i.bind("isEnabled").toMany(s,"errorText",(...e)=>e.every(e=>!e)),n.set({label:t("Cancel"),withText:true}),n.delegate("execute").to(this,"cancel"),{saveButtonView:i,cancelButtonView:n}}_createBackButton(){const e=this.locale.t,t=new Bp(this.locale);return t.set({class:"ck-button-back",label:e("Back"),icon:Pf,tooltip:true}),t.delegate("execute").to(this,"cancel"),t}get _alignmentLabels(){const e=this.locale,t=this.t,i=t("Align table to the left with no text wrapping"),n=t("Align table to the right with no text wrapping"),s=t("Align table to the left with text wrapping"),o=t("Center table with no text wrapping"),r=t("Align table to the right with text wrapping");return "rtl"===e.uiLanguageDirection?{right:r,left:s,blockRight:n,center:o,blockLeft:i}:{blockLeft:i,center:o,blockRight:n,left:s,right:r}}}function NY(e){return "none"!==e}const DY={borderStyle:"tableBorderStyle",borderColor:"tableBorderColor",borderWidth:"tableBorderWidth",backgroundColor:"tableBackgroundColor",width:"tableWidth",height:"tableHeight",alignment:"tableAlignment"};class zY extends Ms{_defaultContentTableProperties;_defaultLayoutTableProperties;_balloon;view=null;_viewWithContentTableDefaults=null;_viewWithLayoutTableDefaults=null;_undoStepBatch;_isReady;static get requires(){return [i_]}static get pluginName(){return "TablePropertiesUI"}static get isOfficialPlugin(){return  true}constructor(e){super(e),e.config.define("table.tableProperties",{borderColors:OQ,backgroundColors:OQ});}init(){const e=this.editor;this._defaultContentTableProperties=fJ(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:true}),this._defaultLayoutTableProperties=gJ(),this._balloon=e.plugins.get(i_),e.ui.componentFactory.add("tableProperties",()=>this._createTablePropertiesButton());}_createTablePropertiesButton(){const e=this.editor,t=e.t,i=new Bp(e.locale);i.set({label:t("Table properties"),icon:op,tooltip:true}),this.listenTo(i,"execute",()=>this._showView());const n=Object.values(DY).map(t=>e.commands.get(t));return i.bind("isEnabled").toMany(n,"isEnabled",(...e)=>e.some(e=>e)),i}destroy(){super.destroy(),this.view&&this.view.destroy();}_createPropertiesView(e){const t=this.editor,i=t.config.get("table.tableProperties"),n=mb(i.borderColors),s=hb(t.locale,n),o=mb(i.backgroundColors),r=hb(t.locale,o),a=false!==i.colorPicker,l=new FY(t.locale,{borderColors:s,backgroundColors:r,defaultTableProperties:e,colorPickerConfig:!!a&&(i.colorPicker||{})}),c=t.t;l.render(),this.listenTo(l,"submit",()=>{this._hideView();}),this.listenTo(l,"cancel",()=>{this._undoStepBatch.operations.length&&t.execute("undo",this._undoStepBatch),this._hideView();}),l.keystrokes.set("Esc",(e,t)=>{this._hideView(),t();}),Ss({emitter:l,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const u=EQ(c),d=TQ(c);return l.on("change:borderStyle",this._getPropertyChangeCallback("tableBorderStyle")),l.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:l.borderColorInput,commandName:"tableBorderColor",errorText:u,validator:SQ})),l.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:l.borderWidthInput,commandName:"tableBorderWidth",errorText:d,validator:PQ})),l.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:l.backgroundInput,commandName:"tableBackgroundColor",errorText:u,validator:SQ})),l.on("change:width",this._getValidatedPropertyChangeCallback({viewField:l.widthInput,commandName:"tableWidth",errorText:d,validator:IQ})),l.on("change:height",this._getValidatedPropertyChangeCallback({viewField:l.heightInput,commandName:"tableHeight",errorText:d,validator:IQ})),l.on("change:alignment",this._getPropertyChangeCallback("tableAlignment")),l}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableBorderStyle");Object.entries(DY).map(([t,i])=>{const n=t,s=this.view===this._viewWithContentTableDefaults?this._defaultContentTableProperties[n]||"":this._defaultLayoutTableProperties[n]||"";return [n,e.get(i).value||s]}).forEach(([e,i])=>{("borderColor"!==e&&"borderWidth"!==e||"none"!==t.value)&&this.view.set(e,i);}),this._isReady=true;}_showView(){const e=this.editor,t=bQ(e.editing.view.document.selection),i=t&&e.editing.mapper.toModelElement(t),n=!i||"layout"!==i.getAttribute("tableType");n&&!this._viewWithContentTableDefaults?this._viewWithContentTableDefaults=this._createPropertiesView(this._defaultContentTableProperties):n||this._viewWithLayoutTableDefaults||(this._viewWithLayoutTableDefaults=this._createPropertiesView(this._defaultLayoutTableProperties)),this.view=n?this._viewWithContentTableDefaults:this._viewWithLayoutTableDefaults,this.listenTo(e.ui,"update",()=>{this._updateView();}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:zQ(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus();}_hideView(){const e=this.editor;this.stopListening(e.ui,"update"),this._isReady=false,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus();}_updateView(){const e=this.editor;bQ(e.editing.view.document.selection)?this._isViewVisible&&DQ(e,"table"):this._hideView();}get _isViewVisible(){return !!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return !!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return (t,i,n)=>{this._isReady&&this.editor.execute(e,{value:n,batch:this._undoStepBatch});}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:i,validator:n,errorText:s}=e,o=st(()=>{i.errorText=s;},500);return (e,s,r)=>{o.cancel(),this._isReady&&(n(r)?(this.editor.execute(t,{value:r,batch:this._undoStepBatch}),i.errorText=null):o());}}}class HY extends Ms{static get pluginName(){return "TableProperties"}static get isOfficialPlugin(){return  true}static get requires(){return [OY,zY]}}function qY(e){e.document.registerPostFixer(t=>function(e,t){const i=t.document.differ.getChanges();let n=false;for(const t of i){if("insert"!=t.type)continue;const i=t.position.parent;if(i.is("element","table")||"table"==t.name){const s="table"==t.name?t.position.nodeAfter:i,o=Array.from(s.getChildren()).filter(e=>e.is("element","caption")),r=o.shift();if(!r)continue;for(const t of o)e.move(e.createRangeIn(t),r,"end"),e.remove(t);r.nextSibling&&(e.move(e.createRangeOn(r),s,"end"),n=true),n=!!o.length||n;}}return n}(t,e));}function UY(e){return !!e&&e.is("element","table")}function jY(e){for(const t of e.getChildren())if(t.is("element","caption"))return t;return null}function $Y(e){const t=_K(e);return t?jY(t):null}function WY(e){const t=e.parent;return "figcaption"==e.name&&t&&t.is("element","figure")&&t.hasClass("table")||"caption"==e.name&&t&&t.is("element","table")?{name:true}:null}class GY extends Ns{refresh(){const e=this.editor,t=_K(e.model.document.selection);this.isEnabled=!!t&&e.model.schema.checkChild(t,"caption"),this.isEnabled?this.value=!!jY(t):this.value=false;}execute({focusCaptionOnShow:e=false}={}){this.editor.model.change(t=>{this.value?this._hideTableCaption(t):this._showTableCaption(t,e);});}_showTableCaption(e,t){const i=this.editor.model,n=_K(i.document.selection),s=this.editor.plugins.get("TableCaptionEditing")._getSavedCaption(n)||e.createElement("caption");i.insertContent(s,n,"end"),t&&e.setSelection(s,"in");}_hideTableCaption(e){const t=this.editor.model,i=_K(t.document.selection),n=this.editor.plugins.get("TableCaptionEditing"),s=jY(i);n._saveCaption(i,s),t.deleteContent(e.createSelection(s,"on"));}}class KY extends Ms{_savedCaptionsMap=new WeakMap;_captionIdsMapping=new WeakMap;static get pluginName(){return "TableCaptionEditing"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.model.schema,i=e.editing.view,n=e.t,s=e.config.get("table.tableCaption.useCaptionElement");if(t.isRegistered("caption")?t.extend("caption",{allowIn:"table"}):t.register("caption",{allowIn:"table",allowContentOf:"$block",isLimit:true}),e.commands.add("toggleTableCaption",new GY(this.editor)),s){e.plugins.get("TableEditing").registerAdditionalSlot({filter:e=>e.is("element","caption"),positionOffset:"end"});}e.conversion.for("upcast").elementToElement({view:WY,model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(e,{writer:t})=>UY(e.parent)?t.createContainerElement(s?"caption":"figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(e,{writer:t})=>{if(!UY(e.parent))return null;const o=t.createEditableElement(s?"caption":"figcaption");return t.setCustomProperty("tableCaption",true,o),o.placeholder=n("Enter table caption"),Ks({view:i,element:o,keepOnFocus:true}),nC(o,t)}}),e.conversion.for("editingDowncast").add(e=>{e.on("insert:table",(e,t,{writer:i,mapper:n})=>{const s=t.item,o=n.toViewElement(s);if(!o)return;const r=Array.from(o.getChildren()).find(e=>e.is("element","table"));if(!r)return;const a=jY(s);if(!a)return void i.removeAttribute("aria-labelledby",r);const l=n.toViewElement(a);if(!l)return;let c;c=l.hasAttribute("id")?l.getAttribute("id"):this._captionIdsMapping.get(a)??`ck-editor__caption_${A()}`,this._captionIdsMapping.set(a,c),i.setAttribute("id",c,l),i.setAttribute("aria-labelledby",c,r);},{priority:"low"});}),qY(e.model);}_getSavedCaption(e){const t=this._savedCaptionsMap.get(e);return t?Fa.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON());}}class JY extends Ms{static get pluginName(){return "TableCaptionUI"}static get isOfficialPlugin(){return  true}init(){const e=this.editor,t=e.editing.view,i=e.t;e.ui.componentFactory.add("toggleTableCaption",n=>{const s=e.commands.get("toggleTableCaption"),o=new Bp(n);return o.set({icon:bm,tooltip:true,isToggleable:true}),o.bind("isOn","isEnabled").to(s,"value","isEnabled"),o.bind("label").to(s,"value",e=>i(e?"Toggle caption off":"Toggle caption on")),this.listenTo(o,"execute",()=>{if(e.execute("toggleTableCaption",{focusCaptionOnShow:true}),s.value){const i=$Y(e.model.document.selection),n=e.editing.mapper.toViewElement(i);if(!n)return;t.scrollToTheSelection(),t.change(e=>{e.addClass("table__caption_highlighted",n);});}e.editing.view.focus();}),o});}}class QY extends Ms{static get pluginName(){return "TableCaption"}static get isOfficialPlugin(){return  true}static get requires(){return [KY,JY]}}function YY(e){if(e.is("$text")||e.is("$textProxy"))return e.data;const t=e;let i="",n=null;for(const e of t.getChildren()){const t=YY(e);n&&n.is("element")&&(i+="\n"),i+=t,n=e;}return i}class ZY extends Ms{_config;_outputView;_wordsMatchRegExp;constructor(e){super(e),this.set("characters",0),this.set("words",0),Object.defineProperties(this,{characters:{get(){return this.characters=this._getCharacters(this._getText())}},words:{get(){return this.words=this._getWords(this._getText())}}}),this.set("_wordsLabel",void 0),this.set("_charactersLabel",void 0),this._config=e.config.get("wordCount")||{},this._outputView=void 0,this._wordsMatchRegExp=n.features.isRegExpUnicodePropertySupported?new RegExp("([\\p{L}\\p{N}]+\\S?)+","gu"):/([a-zA-Z0-9À-ž]+\S?)+/gu;}static get pluginName(){return "WordCount"}static get licenseFeatureCode(){return "WC"}static get isOfficialPlugin(){return  true}static get isPremiumPlugin(){return  true}init(){this.editor.model.document.on("change:data",ot(this._refreshStats.bind(this),250)),"function"==typeof this._config.onUpdate&&this.on("update",(e,t)=>{this._config.onUpdate(t);}),St(this._config.container)&&this._config.container.appendChild(this.wordCountContainer);}destroy(){this._outputView&&(this._outputView.element.remove(),this._outputView.destroy()),super.destroy();}get wordCountContainer(){const e=this.editor,t=e.t,i=e.config.get("wordCount.displayWords"),n=e.config.get("wordCount.displayCharacters"),s=es.bind(this,this),o=[];return this._outputView||(this._outputView=new Cs,(i||void 0===i)&&(this.bind("_wordsLabel").to(this,"words",e=>t("Words: %0",e)),o.push({tag:"div",children:[{text:[s.to("_wordsLabel")]}],attributes:{class:"ck-word-count__words"}})),(n||void 0===n)&&(this.bind("_charactersLabel").to(this,"characters",e=>t("Characters: %0",e)),o.push({tag:"div",children:[{text:[s.to("_charactersLabel")]}],attributes:{class:"ck-word-count__characters"}})),this._outputView.setTemplate({tag:"div",attributes:{class:["ck","ck-word-count"]},children:o}),this._outputView.render()),this._outputView.element}_getText(){let e="";for(const t of this.editor.model.document.getRoots())""!==e&&(e+="\n"),e+=YY(t);return e}_getCharacters(e){return e.replace(/\n/g,"").length}_getWords(e){return (e.match(this._wordsMatchRegExp)||[]).length}_refreshStats(){const e=this._getText(),t=this.words=this._getWords(e),i=this.characters=this._getCharacters(e);this.fire("update",{words:t,characters:i});}}

	exports.Accessibility = fh;
	exports.AccessibilityHelp = Qp;
	exports.AccessibilityHelpContentView = Bs;
	exports.ActionsRecorder = uh;
	exports.AdjacentListsSupport = AL;
	exports.Alignment = X_;
	exports.AlignmentCommand = J_;
	exports.AlignmentEditing = Q_;
	exports.AlignmentUI = Z_;
	exports.AriaLiveAnnouncer = As;
	exports.AriaLiveAnnouncerPoliteness = xs;
	exports.AriaLiveAnnouncerRegionView = Ts;
	exports.AriaLiveAnnouncerView = Es;
	exports.AttributeCommand = jy;
	exports.AttributeOperation = ac;
	exports.AutoImage = vA;
	exports.AutoLink = Zx;
	exports.AutoMediaEmbed = v$;
	exports.AutocompleteView = d_;
	exports.Autoformat = Hy;
	exports.AutomaticLinkDecorators = bx;
	exports.Autosave = Uy;
	exports.Badge = ib;
	exports.BalloonEditor = TS;
	exports.BalloonEditorUI = AS;
	exports.BalloonEditorUIView = ES;
	exports.BalloonPanelView = eb;
	exports.BalloonToolbar = b_;
	exports.Base64UploadAdapter = O_;
	exports.Batch = Ic;
	exports.BlockButtonView = v_;
	exports.BlockQuote = Uk;
	exports.BlockQuoteCommand = Fk;
	exports.BlockQuoteEditing = Hk;
	exports.BlockQuoteUI = qk;
	exports.BlockToolbar = y_;
	exports.BodyCollection = Yp;
	exports.Bold = Qy;
	exports.BoldEditing = Wy;
	exports.BoldUI = Jy;
	exports.Bookmark = jC;
	exports.BookmarkEditing = DC;
	exports.BookmarkFormView = OC;
	exports.BookmarkUI = qC;
	exports.BoxedEditorUIView = Wv;
	exports.BubblingEmitterMixin = No;
	exports.BubblingEventInfo = Bo;
	exports.ButtonLabelView = Op;
	exports.ButtonLabelWithHighlightView = m_;
	exports.ButtonView = Bp;
	exports.CKBox = zT;
	exports.CKBoxCommand = vT;
	exports.CKBoxEditing = LT;
	exports.CKBoxImageEdit = WT;
	exports.CKBoxImageEditCommand = UT;
	exports.CKBoxImageEditEditing = jT;
	exports.CKBoxImageEditUI = $T;
	exports.CKBoxUI = $C;
	exports.CKBoxUploadAdapter = RT;
	exports.CKBoxUtils = VT;
	exports.CKEditorError = I;
	exports.CKFinder = YT;
	exports.CKFinderCommand = KT;
	exports.CKFinderEditing = QT;
	exports.CKFinderUI = GT;
	exports.CKFinderUploadAdapter = q_;
	exports.CheckTodoListCommand = fB;
	exports.ClassicEditor = PS;
	exports.ClassicEditorUI = SS;
	exports.ClassicEditorUIView = IS;
	exports.ClickObserver = vu;
	exports.Clipboard = px;
	exports.ClipboardMarkersUtils = ex;
	exports.ClipboardObserver = WC;
	exports.ClipboardPipeline = tx;
	exports.CloudServices = PT;
	exports.CloudServicesCore = IT;
	exports.CloudServicesUploadAdapter = kS;
	exports.Code = tk;
	exports.CodeBlock = yS;
	exports.CodeBlockCommand = aS;
	exports.CodeBlockEditing = bS;
	exports.CodeBlockElementSupport = XV;
	exports.CodeBlockUI = _S;
	exports.CodeEditing = Zy;
	exports.CodeUI = ek;
	exports.CollapsibleView = db;
	exports.Collection = kn;
	exports.ColorGridView = pb;
	exports.ColorGridsFragmentView = mv;
	exports.ColorPickerFragmentView = gv;
	exports.ColorPickerInputRowView = uv;
	exports.ColorPickerView = rv;
	exports.ColorSelectorView = fv;
	exports.ColorTileView = fb;
	exports.Command = Ns;
	exports.CommandCollection = Hs;
	exports.ComponentFactory = pv;
	exports.CompositionObserver = Jr;
	exports.Config = ni;
	exports.Context = Us;
	exports.ContextPlugin = js;
	exports.ContextWatchdog = ah;
	exports.ContextualBalloon = i_;
	exports.Conversion = Ul;
	exports.ConversionHelpers = Na;
	exports.CssTransitionDisablerMixin = Is;
	exports.CustomElementSupport = fR;
	exports.DOCUMENTATION_URL = S;
	exports.DataController = ql;
	exports.DataFilter = GV;
	exports.DataSchema = WV;
	exports.DecoupledEditor = OS;
	exports.DecoupledEditorUI = VS;
	exports.DecoupledEditorUIView = RS;
	exports.DefaultMenuBarItems = Iv;
	exports.Delete = py;
	exports.DeleteCommand = cy;
	exports.Dialog = Wp;
	exports.DialogActionsView = Hp;
	exports.DialogContentView = qp;
	exports.DialogView = $p;
	exports.DialogViewPosition = Up;
	exports.Differ = Pc;
	exports.DocumentColorCollection = hv;
	exports.DomEmitterMixin = ci;
	exports.DomEventObserver = qr;
	exports.DowncastHelpers = Da;
	exports.DragDrop = dx;
	exports.DragDropBlockToolbar = ux;
	exports.DragDropTarget = sx;
	exports.DraggableViewMixin = Ps;
	exports.DropdownButtonView = Gb;
	exports.DropdownMenuButtonView = Jb;
	exports.DropdownMenuListItemButtonView = Kb;
	exports.DropdownMenuListItemView = iw;
	exports.DropdownMenuListView = ew;
	exports.DropdownMenuNestedMenuPanelView = ow;
	exports.DropdownMenuNestedMenuView = rw;
	exports.DropdownMenuPanelPositioningFunctions = tw;
	exports.DropdownMenuRootListView = aw;
	exports.DropdownPanelView = $b;
	exports.DropdownView = Wb;
	exports.DualContentModelElementSupport = eR;
	exports.EasyImage = xS;
	exports.EditableUIView = Gv;
	exports.EditingController = Cl;
	exports.EditingKeystrokeHandler = $s;
	exports.EditingView = ta;
	exports.Editor = kh;
	exports.EditorUI = Uv;
	exports.EditorUIView = $v;
	exports.EditorWatchdog = nh;
	exports.ElementApiMixin = Ah;
	exports.ElementReplacer = Yt;
	exports.EmitterMixin = z;
	exports.Emoji = OI;
	exports.EmojiCategoriesView = EI;
	exports.EmojiCommand = xI;
	exports.EmojiGridView = AI;
	exports.EmojiMention = CI;
	exports.EmojiPicker = RI;
	exports.EmojiPickerFormView = PI;
	exports.EmojiPickerView = II;
	exports.EmojiRepository = vI;
	exports.EmojiSearchView = TI;
	exports.EmojiToneView = SI;
	exports.EmojiUtils = wI;
	exports.EmptyBlock = CR;
	exports.Enter = Rk;
	exports.EnterCommand = Sk;
	exports.EnterObserver = Vk;
	exports.Essentials = zI;
	exports.EvaluationBadge = kv;
	exports.EventInfo = C;
	exports.FakeSelectionObserver = jr;
	exports.FileDialogButtonView = ab;
	exports.FileDialogListItemButtonView = lb;
	exports.FileDialogViewMixin = cb;
	exports.FileReader = P_;
	exports.FileRepository = V_;
	exports.FindAndReplace = eP;
	exports.FindAndReplaceEditing = XI;
	exports.FindAndReplaceFormView = HI;
	exports.FindAndReplaceState = jI;
	exports.FindAndReplaceUI = qI;
	exports.FindAndReplaceUtils = YI;
	exports.FindCommand = UI;
	exports.FindNextCommand = JI;
	exports.FindPreviousCommand = QI;
	exports.FindReplaceCommandBase = WI;
	exports.FocusCycler = Fp;
	exports.FocusObserver = Gr;
	exports.FocusTracker = An;
	exports.Font = LP;
	exports.FontBackgroundColor = BP;
	exports.FontBackgroundColorCommand = VP;
	exports.FontBackgroundColorEditing = RP;
	exports.FontBackgroundColorUI = OP;
	exports.FontColor = PP;
	exports.FontColorCommand = EP;
	exports.FontColorEditing = TP;
	exports.FontColorUI = IP;
	exports.FontColorUIBase = SP;
	exports.FontCommand = tP;
	exports.FontFamily = bP;
	exports.FontFamilyCommand = uP;
	exports.FontFamilyEditing = fP;
	exports.FontFamilyUI = pP;
	exports.FontSize = AP;
	exports.FontSizeCommand = wP;
	exports.FontSizeEditing = CP;
	exports.FontSizeUI = xP;
	exports.FormHeaderView = Mp;
	exports.FormRowView = Jv;
	exports.FullPage = _R;
	exports.Fullscreen = UP;
	exports.FullscreenAbstractEditorHandler = MP;
	exports.FullscreenClassicEditorHandler = FP;
	exports.FullscreenCommand = DP;
	exports.FullscreenDecoupledEditorHandler = NP;
	exports.FullscreenEditing = zP;
	exports.FullscreenUI = qP;
	exports.GeneralHtmlSupport = pR;
	exports.Heading = tV;
	exports.HeadingButtonsUI = nV;
	exports.HeadingCommand = JP;
	exports.HeadingEditing = ZP;
	exports.HeadingElementSupport = tR;
	exports.HeadingUI = eV;
	exports.Highlight = wV;
	exports.HighlightCommand = gV;
	exports.HighlightEditing = fV;
	exports.HighlightUI = pV;
	exports.HighlightedTextView = h_;
	exports.History = Lc;
	exports.HorizontalLine = kV;
	exports.HorizontalLineCommand = vV;
	exports.HorizontalLineEditing = _V;
	exports.HorizontalLineElementSupport = mR;
	exports.HorizontalLineUI = yV;
	exports.HtmlComment = wR;
	exports.HtmlDataProcessor = Hl;
	exports.HtmlEmbed = SV;
	exports.HtmlEmbedCommand = CV;
	exports.HtmlEmbedEditing = AV;
	exports.HtmlEmbedUI = TV;
	exports.HtmlPageDataProcessor = vR;
	exports.IconAI = Mh;
	exports.IconAIAdjustLength = Fh;
	exports.IconAIAskAI = Nh;
	exports.IconAIChangeTone = Dh;
	exports.IconAIChat = Kh;
	exports.IconAIChatCommands = zh;
	exports.IconAIContinueWriting = Hh;
	exports.IconAIGrammarCheck = qh;
	exports.IconAIHistory = Jh;
	exports.IconAIImproveWriting = Uh;
	exports.IconAIOther = jh;
	exports.IconAIQuickActions = $h;
	exports.IconAIReview = Wh;
	exports.IconAITranslate = Gh;
	exports.IconAccessibility = Bh;
	exports.IconAddComment = Lh;
	exports.IconAlignBottom = Qh;
	exports.IconAlignCenter = Yh;
	exports.IconAlignJustify = Zh;
	exports.IconAlignLeft = Xh;
	exports.IconAlignMiddle = em;
	exports.IconAlignRight = tm;
	exports.IconAlignTop = im;
	exports.IconArrowDown = nm;
	exports.IconArrowUp = sm;
	exports.IconBold = om;
	exports.IconBookmark = am;
	exports.IconBookmarkInline = rm;
	exports.IconBookmarkMedium = lm;
	exports.IconBookmarkSmall = cm;
	exports.IconBoxWithCheck = um;
	exports.IconBoxWithCross = dm;
	exports.IconBoxWithMarker = hm;
	exports.IconBrowseFiles = mm;
	exports.IconBulb = gm;
	exports.IconBulletedList = fm;
	exports.IconCancel = pm;
	exports.IconCaption = bm;
	exports.IconCaseChange = wm;
	exports.IconCheck = vm;
	exports.IconChevronDown = _m;
	exports.IconChevronRight = km;
	exports.IconChevronUp = ym;
	exports.IconCkboxImageEdit = Cm;
	exports.IconClose = xm;
	exports.IconCode = Em;
	exports.IconCodeBlock = Am;
	exports.IconCog = Tm;
	exports.IconColorPalette = Sm;
	exports.IconColorTileCheck = Im;
	exports.IconCommentsArchive = Pm;
	exports.IconContentLock = Vm;
	exports.IconContentUnlock = Rm;
	exports.IconCopy = Om;
	exports.IconDocument = Bm;
	exports.IconDocumentOutline = Nm;
	exports.IconDocumentOutlineToggle = Dm;
	exports.IconDocumentWithCheckmark = Lm;
	exports.IconDocumentWithCross = Mm;
	exports.IconDocumentWithLoupe = Fm;
	exports.IconDragHandle = zm;
	exports.IconDragIndicator = Hm;
	exports.IconDropbox = qm;
	exports.IconDropdownArrow = Um;
	exports.IconEditComment = jm;
	exports.IconEmoji = $m;
	exports.IconEraser = Wm;
	exports.IconError = Gm;
	exports.IconExportPdf = Km;
	exports.IconExportWord = Jm;
	exports.IconEye = Qm;
	exports.IconEyeCrossedOut = Ym;
	exports.IconFacebook = Zm;
	exports.IconFileUpload = Xm;
	exports.IconFindReplace = eg;
	exports.IconFontBackground = tg;
	exports.IconFontColor = ig;
	exports.IconFontFamily = ng;
	exports.IconFontSize = sg;
	exports.IconFootnote = og;
	exports.IconFullscreenEnter = rg;
	exports.IconFullscreenLeave = ag;
	exports.IconGoogleDrive = lg;
	exports.IconGooglePhotos = cg;
	exports.IconHeading1 = ug;
	exports.IconHeading2 = dg;
	exports.IconHeading3 = hg;
	exports.IconHeading4 = mg;
	exports.IconHeading5 = gg;
	exports.IconHeading6 = fg;
	exports.IconHistory = pg;
	exports.IconHorizontalLine = bg;
	exports.IconHtml = wg;
	exports.IconImage = _g;
	exports.IconImageAssetManager = vg;
	exports.IconImageUpload = yg;
	exports.IconImageUrl = kg;
	exports.IconImportExport = Cg;
	exports.IconImportWord = xg;
	exports.IconIndent = Ag;
	exports.IconInfo = Eg;
	exports.IconInsertMergeField = Tg;
	exports.IconItalic = Sg;
	exports.IconLegalStyleList = Ig;
	exports.IconLineHeight = Pg;
	exports.IconLink = Vg;
	exports.IconListStyleArabicIndic = Hg;
	exports.IconListStyleCircle = Rg;
	exports.IconListStyleDecimal = Bg;
	exports.IconListStyleDecimalLeadingZero = Og;
	exports.IconListStyleDisc = Lg;
	exports.IconListStyleLowerLatin = Mg;
	exports.IconListStyleLowerRoman = Fg;
	exports.IconListStyleSquare = Ng;
	exports.IconListStyleUpperLatin = Dg;
	exports.IconListStyleUpperRoman = zg;
	exports.IconLocal = qg;
	exports.IconLoupe = Ug;
	exports.IconLowVision = jg;
	exports.IconMagicWand = $g;
	exports.IconMarker = Wg;
	exports.IconMaximize = Gg;
	exports.IconMedia = Jg;
	exports.IconMediaPlaceholder = Kg;
	exports.IconMinimize = Qg;
	exports.IconMultiLevelList = Yg;
	exports.IconNextArrow = Zg;
	exports.IconNotification = Xg;
	exports.IconNumberedList = ef;
	exports.IconObjectCenter = tf;
	exports.IconObjectFullWidth = nf;
	exports.IconObjectInline = rf;
	exports.IconObjectInlineLeft = sf;
	exports.IconObjectInlineRight = of;
	exports.IconObjectLeft = af;
	exports.IconObjectRight = lf;
	exports.IconObjectSizeCustom = cf;
	exports.IconObjectSizeFull = uf;
	exports.IconObjectSizeLarge = df;
	exports.IconObjectSizeMedium = hf;
	exports.IconObjectSizeSmall = mf;
	exports.IconOneDrive = gf;
	exports.IconOutdated = ff;
	exports.IconOutdent = pf;
	exports.IconPageBreak = bf;
	exports.IconPaginationExample = wf;
	exports.IconPaintRoller = yf;
	exports.IconPaintRollerCursorDefault = vf;
	exports.IconPaintRollerCursorText = _f;
	exports.IconPaperClip = kf;
	exports.IconParagraph = Cf;
	exports.IconPen = Af;
	exports.IconPencil = xf;
	exports.IconPilcrow = Ef;
	exports.IconPin = Ip;
	exports.IconPlay = Tf;
	exports.IconPlus = Sf;
	exports.IconPreviewMergeFields = If;
	exports.IconPreviousArrow = Pf;
	exports.IconPrint = Vf;
	exports.IconProjectLogo = Rf;
	exports.IconQuote = Of;
	exports.IconRedo = Bf;
	exports.IconRefresh = Lf;
	exports.IconRemove = Nf;
	exports.IconRemoveComment = Mf;
	exports.IconRemoveFormat = Ff;
	exports.IconReturnArrow = Df;
	exports.IconRevisionHistory = zf;
	exports.IconRobotPencil = Hf;
	exports.IconSelectAll = qf;
	exports.IconSelection = Uf;
	exports.IconSettings = jf;
	exports.IconShowBlocks = $f;
	exports.IconShowChangesOff = Wf;
	exports.IconShowChangesOn = Gf;
	exports.IconSource = Kf;
	exports.IconSpecialCharacters = Jf;
	exports.IconStop = Qf;
	exports.IconStrikethrough = Yf;
	exports.IconSubmit = Zf;
	exports.IconSubscript = Xf;
	exports.IconSuperscript = ep;
	exports.IconTable = ap;
	exports.IconTableCellProperties = tp;
	exports.IconTableColumn = ip;
	exports.IconTableLayout = lp;
	exports.IconTableMergeCell = np;
	exports.IconTableOfContents = sp;
	exports.IconTableProperties = op;
	exports.IconTableRow = rp;
	exports.IconTemplate = up;
	exports.IconTemplateGeneric = cp;
	exports.IconText = hp;
	exports.IconTextAlternative = dp;
	exports.IconThreeHorizontalDots = mp;
	exports.IconThreeStars = gp;
	exports.IconThreeVerticalDots = fp;
	exports.IconThumbDown = bp;
	exports.IconThumbUp = pp;
	exports.IconTodoList = wp;
	exports.IconTrackChanges = yp;
	exports.IconTrackChangesAccept = vp;
	exports.IconTrackChangesDiscard = _p;
	exports.IconUnderline = kp;
	exports.IconUndo = Cp;
	exports.IconUnlink = xp;
	exports.IconUploadcareImageEdit = Ap;
	exports.IconUploadcareImageUpload = Ep;
	exports.IconUploadcareLink = Tp;
	exports.IconUser = Sp;
	exports.IconView = Rp;
	exports.IconWarning = Pp;
	exports.IconWeb = Vp;
	exports.IframeElementSupport = gR;
	exports.IframeView = Qv;
	exports.Image = $A;
	exports.ImageBlock = qA;
	exports.ImageBlockEditing = DA;
	exports.ImageCaption = QA;
	exports.ImageCaptionEditing = KA;
	exports.ImageCaptionUI = JA;
	exports.ImageCaptionUtils = WA;
	exports.ImageCustomResizeUI = RE;
	exports.ImageEditing = LA;
	exports.ImageElementSupport = nR;
	exports.ImageInline = jA;
	exports.ImageInlineEditing = UA;
	exports.ImageInsert = pE;
	exports.ImageInsertUI = HA;
	exports.ImageInsertViaUrl = fE;
	exports.ImageInsertViaUrlUI = gE;
	exports.ImageLoadObserver = RA;
	exports.ImagePlaceholder = NA;
	exports.ImageResize = OE;
	exports.ImageResizeButtons = _E;
	exports.ImageResizeEditing = wE;
	exports.ImageResizeHandles = AE;
	exports.ImageSizeAttributes = MA;
	exports.ImageStyle = KE;
	exports.ImageStyleCommand = BE;
	exports.ImageStyleEditing = UE;
	exports.ImageStyleUI = jE;
	exports.ImageTextAlternative = EA;
	exports.ImageTextAlternativeCommand = _A;
	exports.ImageTextAlternativeEditing = yA;
	exports.ImageTextAlternativeUI = AA;
	exports.ImageToolbar = JE;
	exports.ImageTypeCommand = FA;
	exports.ImageUpload = hE;
	exports.ImageUploadEditing = cE;
	exports.ImageUploadProgress = iE;
	exports.ImageUploadUI = tE;
	exports.ImageUtils = pA;
	exports.Indent = TR;
	exports.IndentBlock = LL;
	exports.IndentBlockCommand = SR;
	exports.IndentBlockListCommand = TL;
	exports.IndentBlockListIntegration = VL;
	exports.IndentBlockListItemCommand = SL;
	exports.IndentCodeBlockCommand = lS;
	exports.IndentEditing = AR;
	exports.IndentUI = ER;
	exports.InlineEditableUIView = Kv;
	exports.InlineEditor = FS;
	exports.InlineEditorUI = BS;
	exports.InlineEditorUIView = MS;
	exports.Input = oy;
	exports.InputBase = Db;
	exports.InputNumberView = qb;
	exports.InputObserver = Zr;
	exports.InputTextView = Hb;
	exports.InputView = zb;
	exports.InsertBookmarkCommand = LC;
	exports.InsertColumnCommand = TJ;
	exports.InsertImageCommand = OA;
	exports.InsertOperation = nc;
	exports.InsertParagraphCommand = WP;
	exports.InsertRowCommand = EJ;
	exports.InsertTableCommand = AJ;
	exports.InsertTableLayoutCommand = hY;
	exports.InsertTextCommand = ty;
	exports.Italic = rk;
	exports.ItalicEditing = nk;
	exports.ItalicUI = ok;
	exports.ItemsView = gw;
	exports.KeyObserver = Ur;
	exports.KeystrokeHandler = In;
	exports.LabelView = Os;
	exports.LabelWithHighlightView = g_;
	exports.LabeledFieldView = Nb;
	exports.LabeledInputView = Yv;
	exports.LegacyCheckTodoListCommand = pL;
	exports.LegacyIndentCommand = SB;
	exports.LegacyList = nL;
	exports.LegacyListCommand = AB;
	exports.LegacyListEditing = tL;
	exports.LegacyListProperties = gL;
	exports.LegacyListPropertiesEditing = lL;
	exports.LegacyListReversedCommand = oL;
	exports.LegacyListStartCommand = rL;
	exports.LegacyListStyleCommand = sL;
	exports.LegacyListUtils = HB;
	exports.LegacyTodoList = xL;
	exports.LegacyTodoListEditing = kL;
	exports.Link = eA;
	exports.LinkCommand = Mx;
	exports.LinkEditing = qx;
	exports.LinkFormView = jx;
	exports.LinkImage = tT;
	exports.LinkImageEditing = YE;
	exports.LinkImageUI = eT;
	exports.LinkManualDecorator = Dx;
	exports.LinkPropertiesView = Wx;
	exports.LinkProviderItemsView = $x;
	exports.LinkStyleSupport = JG;
	exports.LinkUI = Jx;
	exports.List = UO;
	exports.ListCommand = sO;
	exports.ListEditing = NO;
	exports.ListElementSupport = uR;
	exports.ListFormatting = hO;
	exports.ListIndentCommand = iO;
	exports.ListItemBoldIntegration = aO;
	exports.ListItemButtonView = Gp;
	exports.ListItemFontColorIntegration = uO;
	exports.ListItemFontFamilyIntegration = dO;
	exports.ListItemFontSizeIntegration = cO;
	exports.ListItemGroupView = Zb;
	exports.ListItemItalicIntegration = lO;
	exports.ListItemView = Qb;
	exports.ListMergeCommand = oO;
	exports.ListProperties = gB;
	exports.ListPropertiesEditing = aB;
	exports.ListPropertiesUI = cB;
	exports.ListPropertiesUtils = nB;
	exports.ListReversedCommand = tB;
	exports.ListSeparatorView = Yb;
	exports.ListSplitCommand = rO;
	exports.ListStartCommand = jO;
	exports.ListStyleCommand = eB;
	exports.ListStyleSupport = GG;
	exports.ListUI = qO;
	exports.ListUtils = bO;
	exports.ListView = Xb;
	exports.Locale = yn;
	exports.Mapper = ma;
	exports.Markdown = s$;
	exports.MarkdownGfmDataProcessor = n$;
	exports.MarkdownGfmHtmlToMd = t$;
	exports.MarkdownGfmMdToHtml = gU;
	exports.MarkdownGfmMdToHtmlDefaultPlugins = mU;
	exports.MarkerCollection = zc;
	exports.MarkerOperation = rc;
	exports.Matcher = uo;
	exports.MediaEmbed = k$;
	exports.MediaEmbedCommand = g$;
	exports.MediaEmbedEditing = b$;
	exports.MediaEmbedElementSupport = sR;
	exports.MediaEmbedToolbar = C$;
	exports.MediaEmbedUI = y$;
	exports.MediaRegistry = f$;
	exports.Mention = uI;
	exports.MentionCommand = jS;
	exports.MentionDomWrapperView = XS;
	exports.MentionEditing = $S;
	exports.MentionListItemView = eI;
	exports.MentionUI = nI;
	exports.MentionsView = ZS;
	exports.MenuBarMenuButtonView = k_;
	exports.MenuBarMenuListItemButtonView = Jp;
	exports.MenuBarMenuListItemFileDialogButtonView = T_;
	exports.MenuBarMenuListItemView = Av;
	exports.MenuBarMenuListView = A_;
	exports.MenuBarMenuPanelView = C_;
	exports.MenuBarMenuView = x_;
	exports.MenuBarView = I_;
	exports.MergeCellCommand = IJ;
	exports.MergeCellsCommand = MJ;
	exports.MergeOperation = oc;
	exports.Minimap = B$;
	exports.Model = bu;
	exports.ModelDocument = Nc;
	exports.ModelDocumentFragment = Uc;
	exports.ModelDocumentSelection = Oa;
	exports.ModelElement = Fa;
	exports.ModelLivePosition = Ec;
	exports.ModelLiveRange = Sa;
	exports.ModelNode = _a;
	exports.ModelNodeList = Ma;
	exports.ModelPosition = ra;
	exports.ModelRange = ha;
	exports.ModelRootElement = Mc;
	exports.ModelSchema = xl;
	exports.ModelSchemaContext = Al;
	exports.ModelSelection = ya;
	exports.ModelText = Va;
	exports.ModelTextProxy = na;
	exports.ModelTreeWalker = sa;
	exports.ModelTypeCheckable = ia;
	exports.ModelWriter = jc;
	exports.MouseObserver = _u;
	exports.MoveOperation = ic;
	exports.MultiCommand = zs;
	exports.MultiRootEditor = zS;
	exports.MultiRootEditorUI = NS;
	exports.MultiRootEditorUIView = DS;
	exports.MutationObserver = $r;
	exports.NESTED_TOOLBAR_ICONS = hw;
	exports.NoOperation = lc;
	exports.Notification = Xv;
	exports.ObservableMixin = $t;
	exports.Observer = zr;
	exports.OperationFactory = mc;
	exports.OutdentCodeBlockCommand = cS;
	exports.PageBreak = N$;
	exports.PageBreakCommand = L$;
	exports.PageBreakEditing = M$;
	exports.PageBreakUI = F$;
	exports.Paragraph = GP;
	exports.ParagraphButtonUI = KP;
	exports.ParagraphCommand = jP;
	exports.PasteFromMarkdownExperimental = r$;
	exports.PasteFromOffice = PW;
	exports.PasteFromOfficeGoogleDocsNormalizer = _W;
	exports.PasteFromOfficeGoogleSheetsNormalizer = AW;
	exports.PasteFromOfficeMSWordNormalizer = hW;
	exports.PastePlainText = fx;
	exports.PendingActions = Oh;
	exports.PictureEditing = QE;
	exports.PlainTableOutput = pQ;
	exports.Plugin = Ms;
	exports.PointerObserver = ku;
	exports.PoweredBy = sb;
	exports.Rect = Ci;
	exports.RedoCommand = oA;
	exports.RemoveColumnCommand = RJ;
	exports.RemoveFormat = MW;
	exports.RemoveFormatCommand = OW;
	exports.RemoveFormatEditing = LW;
	exports.RemoveFormatUI = RW;
	exports.RemoveRowCommand = VJ;
	exports.RenameOperation = cc;
	exports.ReplaceAllCommand = KI;
	exports.ReplaceCommand = GI;
	exports.ReplaceImageSourceCommand = BA;
	exports.ResizeImageCommand = bE;
	exports.ResizeObserver = Pi;
	exports.RestrictedEditingExceptionAutoCommand = aG;
	exports.RestrictedEditingExceptionBlockCommand = nG;
	exports.RestrictedEditingExceptionCommand = iG;
	exports.RestrictedEditingMode = tG;
	exports.RestrictedEditingModeEditing = YW;
	exports.RestrictedEditingModeNavigationCommand = HW;
	exports.RestrictedEditingModeUI = eG;
	exports.RootAttributeOperation = uc;
	exports.RootOperation = dc;
	exports.ScriptElementSupport = oR;
	exports.SearchInfoView = l_;
	exports.SearchResultsView = c_;
	exports.SearchTextView = u_;
	exports.SelectAll = DI;
	exports.SelectAllCommand = BI;
	exports.SelectAllEditing = FI;
	exports.SelectAllUI = NI;
	exports.SelectColumnCommand = HJ;
	exports.SelectRowCommand = zJ;
	exports.SelectionObserver = Kr;
	exports.SetFooterRowCommand = BJ;
	exports.SetHeaderColumnCommand = LJ;
	exports.SetHeaderRowCommand = OJ;
	exports.ShiftEnter = Mk;
	exports.ShiftEnterCommand = Ok;
	exports.ShowBlocks = _G;
	exports.ShowBlocksCommand = fG;
	exports.ShowBlocksEditing = wG;
	exports.ShowBlocksUI = vG;
	exports.SimpleUploadAdapter = L_;
	exports.SliderView = lv;
	exports.SourceEditing = kG;
	exports.SpecialCharacters = PG;
	exports.SpecialCharactersArrows = VG;
	exports.SpecialCharactersCurrency = LG;
	exports.SpecialCharactersEssentials = MG;
	exports.SpecialCharactersLatin = BG;
	exports.SpecialCharactersMathematical = OG;
	exports.SpecialCharactersText = RG;
	exports.SpinnerView = f_;
	exports.SplitButtonView = bw;
	exports.SplitCellCommand = SJ;
	exports.SplitOperation = sc;
	exports.StandardEditingMode = uG;
	exports.StandardEditingModeEditing = lG;
	exports.StandardEditingModeUI = cG;
	exports.StickyPanelView = r_;
	exports.Strikethrough = dk;
	exports.StrikethroughEditing = lk;
	exports.StrikethroughUI = uk;
	exports.Style = ZG;
	exports.StyleCommand = $G;
	exports.StyleEditing = YG;
	exports.StyleElementSupport = cR;
	exports.StyleUI = jG;
	exports.StyleUtils = qG;
	exports.StylesMap = go;
	exports.StylesProcessor = fo;
	exports.Subscript = pk;
	exports.SubscriptEditing = mk;
	exports.SubscriptUI = fk;
	exports.Superscript = yk;
	exports.SuperscriptEditing = wk;
	exports.SuperscriptUI = _k;
	exports.SwitchButtonView = rb;
	exports.TabObserver = ea;
	exports.Table = fQ;
	exports.TableAlignmentCommand = RY;
	exports.TableBackgroundColorCommand = EY;
	exports.TableBorderColorCommand = TY;
	exports.TableBorderStyleCommand = SY;
	exports.TableBorderWidthCommand = IY;
	exports.TableCaption = QY;
	exports.TableCaptionEditing = KY;
	exports.TableCaptionUI = JY;
	exports.TableCellBackgroundColorCommand = QQ;
	exports.TableCellBorderColorCommand = eY;
	exports.TableCellBorderStyleCommand = XQ;
	exports.TableCellBorderWidthCommand = tY;
	exports.TableCellHeightCommand = JQ;
	exports.TableCellHorizontalAlignmentCommand = ZQ;
	exports.TableCellPaddingCommand = KQ;
	exports.TableCellProperties = lY;
	exports.TableCellPropertiesEditing = aY;
	exports.TableCellPropertiesUI = jQ;
	exports.TableCellPropertiesView = MQ;
	exports.TableCellPropertyCommand = $Q;
	exports.TableCellTypeCommand = iY;
	exports.TableCellVerticalAlignmentCommand = YQ;
	exports.TableCellWidthCommand = WQ;
	exports.TableCellWidthEditing = GQ;
	exports.TableClipboard = aQ;
	exports.TableColumnResize = wY;
	exports.TableColumnResizeEditing = bY;
	exports.TableEditing = tQ;
	exports.TableElementSupport = aR;
	exports.TableHeightCommand = VY;
	exports.TableKeyboard = dQ;
	exports.TableLayout = xY;
	exports.TableLayoutEditing = yY;
	exports.TableLayoutUI = cY;
	exports.TableMouse = mQ;
	exports.TableProperties = HY;
	exports.TablePropertiesEditing = OY;
	exports.TablePropertiesUI = zY;
	exports.TablePropertiesView = FY;
	exports.TablePropertyCommand = AY;
	exports.TableSelection = rQ;
	exports.TableStyleSupport = KG;
	exports.TableToolbar = yQ;
	exports.TableTypeCommand = vY;
	exports.TableUI = sQ;
	exports.TableUtils = rJ;
	exports.TableWalker = mK;
	exports.TableWidthCommand = PY;
	exports.TableWidthsCommand = mY;
	exports.Template = es;
	exports.TextPartLanguage = HL;
	exports.TextPartLanguageCommand = NL;
	exports.TextPartLanguageEditing = DL;
	exports.TextPartLanguageUI = zL;
	exports.TextTransformation = Py;
	exports.TextWatcher = vy;
	exports.TextareaView = Ub;
	exports.Title = oV;
	exports.TodoList = xB;
	exports.TodoListEditing = wB;
	exports.TodoListUI = CB;
	exports.ToggleImageCaptionCommand = GA;
	exports.ToggleTableCaptionCommand = GY;
	exports.Token = AT;
	exports.ToolbarLineBreakView = cw;
	exports.ToolbarSeparatorView = lw;
	exports.ToolbarView = mw;
	exports.TooltipManager = vv;
	exports.TouchObserver = yu;
	exports.TwoStepCaretMovement = _y;
	exports.Typing = by;
	exports.TypingChangeBuffer = ey;
	exports.UIModel = e_;
	exports.Underline = Ek;
	exports.UnderlineEditing = Ck;
	exports.UnderlineUI = Ak;
	exports.Undo = lA;
	exports.UndoCommand = sA;
	exports.UndoEditing = rA;
	exports.UndoRedoBaseCommand = tA;
	exports.UndoUI = aA;
	exports.UnlinkCommand = Nx;
	exports.UpcastHelpers = ml;
	exports.UpcastWriter = Cu;
	exports.UpdateBookmarkCommand = FC;
	exports.UploadImageCommand = lE;
	exports.View = Cs;
	exports.ViewAttributeElement = $o;
	exports.ViewCollection = Xn;
	exports.ViewContainerElement = Co;
	exports.ViewDataTransfer = Qr;
	exports.ViewDocument = jo;
	exports.ViewDocumentDomEventData = Hr;
	exports.ViewDocumentFragment = tr;
	exports.ViewDocumentSelection = Oo;
	exports.ViewDomConverter = Rr;
	exports.ViewDowncastWriter = ir;
	exports.ViewEditableElement = Ao;
	exports.ViewElement = _o;
	exports.ViewEmptyElement = Ko;
	exports.ViewModel = e_;
	exports.ViewNode = no;
	exports.ViewPosition = Io;
	exports.ViewRange = Po;
	exports.ViewRawElement = Xo;
	exports.ViewRenderer = kr;
	exports.ViewRootEditableElement = To;
	exports.ViewSelection = Ro;
	exports.ViewText = so;
	exports.ViewTextProxy = oo;
	exports.ViewTokenList = vo;
	exports.ViewTreeWalker = So;
	exports.ViewTypeCheckable = io;
	exports.ViewUIElement = Qo;
	exports.ViewUpcastWriter = Cu;
	exports.WIDGET_CLASS_NAME = Kk;
	exports.WIDGET_SELECTED_CLASS_NAME = Jk;
	exports.Watchdog = Yd;
	exports.Widget = kC;
	exports.WidgetHighlightStack = jk;
	exports.WidgetResize = RC;
	exports.WidgetResizeState = TC;
	exports.WidgetResizer = PC;
	exports.WidgetToolbarRepository = xC;
	exports.WidgetTypeAround = wC;
	exports.WordCount = ZY;
	exports.XmlDataProcessor = Wl;
	exports._ALIGNMENT_SUPPORTED_OPTIONS = j_;
	exports._CheckIconHolderView = Kp;
	exports._ClipboardLineView = nx;
	exports._CollapsibleView = db;
	exports._ContextualBalloonRotatorView = n_;
	exports._DEFAULT_ACCESSIBILITY_GROUP_ID = gh;
	exports._DataProcessorBasicHtmlWriter = zl;
	exports._DeleteObserver = fy;
	exports._DetachOperation = qc;
	exports._DragDrop = dx;
	exports._DragDropBlockToolbar = ux;
	exports._DragDropTarget = sx;
	exports._DropdownMenuBehaviors = sw;
	exports._DropdownRootMenuBehaviors = nw;
	exports._HTML_SUPPORT_SCHEMA_DEFINITIONS = $V;
	exports._IMAGE_DEFAULT_DROPDOWN_DEFINITIONS = FE;
	exports._IMAGE_DEFAULT_ICONS = ME;
	exports._IMAGE_DEFAULT_OPTIONS = LE;
	exports._ImageCustomResizeFormView = PE;
	exports._ImageInsertFormView = zA;
	exports._ImageInsertUrlView = mE;
	exports._ImageStyleUtils = DE;
	exports._ImageTextAlternativeFormView = kA;
	exports._IndentUsingClasses = PR;
	exports._IndentUsingOffset = IR;
	exports._InsertTableView = nQ;
	exports._LINK_KEYSTROKE = kx;
	exports._LinkButtonView = Gx;
	exports._LinkPreviewButtonView = Ux;
	exports._ListBlocksIterable = OR;
	exports._ListPropertiesView = lB;
	exports._ListWalker = VR;
	exports._MapperCache = ga;
	exports._MediaFormView = _$;
	exports._MenuBarBehaviors = Ev;
	exports._MenuBarMenuBehaviors = Tv;
	exports._MenuBarMenuViewPanelPositioningFunctions = Sv;
	exports._MinimapIframeView = A$;
	exports._MinimapPositionTrackerView = T$;
	exports._MinimapView = S$;
	exports._OperationReplayer = Qd;
	exports._SearchInfoView = l_;
	exports._SearchTextQueryView = a_;
	exports._SiblingListBlocksIterator = RR;
	exports._SpecialCharactersCategoriesView = SG;
	exports._SpecialCharactersGridView = xG;
	exports._SpecialCharactersInfoView = AG;
	exports._SpecialCharactersView = TG;
	exports._StyleGridButtonView = FG;
	exports._StyleGridView = NG;
	exports._StyleGroupView = DG;
	exports._StylePanelView = zG;
	exports._TABLE_COLUMN_MIN_WIDTH_AS_PERCENTAGE = DK;
	exports._TABLE_COLUMN_MIN_WIDTH_IN_PIXELS = zK;
	exports._TABLE_COLUMN_RESIZE_DISTANCE_THRESHOLD = qK;
	exports._TABLE_COLUMN_WIDTH_PRECISION = HK;
	exports._TABLE_DEFAULT_COLORS = OQ;
	exports._TableColorInputView = kQ;
	exports._TableMouseEventsObserver = hQ;
	exports._TemplateBinding = ts;
	exports._TemplateIfBinding = ns;
	exports._TemplateToBinding = is;
	exports._TodoCheckboxChangeObserver = pB;
	exports._VIEW_BR_FILLER = gr;
	exports._VIEW_INLINE_FILLER = pr;
	exports._VIEW_INLINE_FILLER_LENGTH = fr;
	exports._VIEW_MARKED_NBSP_FILLER = mr;
	exports._VIEW_NBSP_FILLER = hr;
	exports._ViewElementConversionConsumables = ao;
	exports._WIDGET_TYPE_AROUND_SELECTION_ATTRIBUTE = cC;
	exports._WidgetSizeView = IC;
	exports._addDefaultUnitToNumericValue = mJ;
	exports._addFontColorSelectorToDropdown = cP;
	exports._addMentionAttributes = WS;
	exports._adjustLastTableColumnIndex = OK;
	exports._adjustLastTableRowIndex = RK;
	exports._attributeToInlineHtmlSupportConverter = qV;
	exports._autoParagraphEmptyModelRoots = ul;
	exports._buildFontDefinition = rP;
	exports._canBeCodeBlock = sS;
	exports._canBecomeSimpleListItem = XR;
	exports._checkIfImageWidthAndHeightStylesAreBothSet = gA;
	exports._ckBoxConvertMimeTypeToExtension = pT;
	exports._ckboxBlurHashToDataUrl = mT;
	exports._clamp = QK;
	exports._clearTranslations = vn;
	exports._cloneMinimapEditingViewDomRoot = I$;
	exports._colorTableFieldValidator = SQ;
	exports._convertColor = Bb;
	exports._convertColorToHex = Lb;
	exports._convertHexToBase64 = nW;
	exports._convertMapToStringifiedObject = $d;
	exports._convertMapToTags = jd;
	exports._convertParagraphInTableCell = _J;
	exports._convertPasteOfficeCssLengthToPx = z$;
	exports._createBlockImageViewElement = uA;
	exports._createCKBoxEditabilityChecker = HT;
	exports._createEmptyTableCell = bK;
	exports._createFilledArray = YK;
	exports._createInlineImageViewElement = cA;
	exports._createLinkElement = xx;
	exports._createListElement = yO;
	exports._createListItemElement = kO;
	exports._createListUIComponents = zO;
	exports._createMediaFigureElement = d$;
	exports._createMentionMarkerRegExp = rI;
	exports._createModelToViewListPositionMapper = BO;
	exports._createObjectHtmlSupportView = DV;
	exports._cropTableToDimensions = CK;
	exports._dataViewToModelCodeBlockInsertion = mS;
	exports._dataViewToModelCodeBlockOrphanNodeConsumer = fS;
	exports._dataViewToModelCodeBlockTextNewlinesInsertion = gS;
	exports._deleteModelContent = tu;
	exports._determineImageTypeForInsertionAtSelection = hA;
	exports._downcastCleanSelection = Wa;
	exports._downcastConvertCollapsedSelection = $a;
	exports._downcastConvertRangeSelection = ja;
	exports._downcastCreateViewElementFromDowncastHighlightDescriptor = Ua;
	exports._downcastImageAttribute = VA;
	exports._downcastImageSourcesAttribute = PA;
	exports._downcastImageSrcsetAttribute = IA;
	exports._downcastInsertAttributesAndChildren = Ha;
	exports._downcastInsertElement = Ka;
	exports._downcastInsertStructure = Ja;
	exports._downcastInsertText = za;
	exports._downcastInsertUIElement = Qa;
	exports._downcastRemove = qa;
	exports._downcastTable = bJ;
	exports._downcastTableAttribute = iK;
	exports._downcastTableAttributeToStyle = tK;
	exports._downcastTableCell = vJ;
	exports._downcastTableResizedClass = fY;
	exports._downcastTableRow = wJ;
	exports._downcastWrap = Ga;
	exports._dumpTrees = Gd;
	exports._emptyInlineModelElementToViewHtmlSupportConverter = HV;
	exports._enableTableCellProperty = vK;
	exports._ensureParagraphInTableCell = NK;
	exports._ensureSafeLinkUrl = Ax;
	exports._expandListBlocksToCompleteItems = qR;
	exports._expandListBlocksToCompleteList = UR;
	exports._extendRestrictedEditingMarkerOnTypingPostFixer = WW;
	exports._extractTextFromLinkRange = Ox;
	exports._fetchLocalImage = ZA;
	exports._fillTableOrCellToolbar = RQ;
	exports._findAndAddListHeadToMap = AO;
	exports._findMappedListItemViewElement = OO;
	exports._fixListIndents = EO;
	exports._fixListItemIds = TO;
	exports._getAllListItemBlocks = MR;
	exports._getAllSupportedListStyleTypes = JO;
	exports._getBalloonTableCellPositionData = HQ;
	exports._getBalloonTablePositionData = zQ;
	exports._getBasicStylesButtonCreator = Gy;
	exports._getBorderTableStyleLabels = AQ;
	exports._getCKBoxContentTypeOfUrl = bT;
	exports._getCKBoxFileExtension = wT;
	exports._getCKBoxImageUrls = dT;
	exports._getCKBoxWorkspaceId = hT;
	exports._getCKFinderCookie = z_;
	exports._getCKFinderCsrfToken = D_;
	exports._getChangedResizedTables = UK;
	exports._getClosestWidgetTypeAroundDomButton = dC;
	exports._getClosestWidgetViewElement = mC;
	exports._getCodeBlockAriaAnnouncement = oS;
	exports._getCodeBlockIndentOutdentPositions = iS;
	exports._getCodeBlockLeadingWhiteSpaces = eS;
	exports._getCodeBlockPropertyAssociation = XT;
	exports._getCodeBlockTextNodeAtLineStart = rS;
	exports._getCopyOnEnterAttributes = Tk;
	exports._getDataWithoutViewFiller = vr;
	exports._getDefaultTableValueAdjusted = nK;
	exports._getDomTableCellOuterWidth = eJ;
	exports._getEditorUsageData = ph;
	exports._getElementWidthInPixels = GK;
	exports._getEmitterId = U;
	exports._getEmitterListenedTo = H;
	exports._getHorizontallyOverlappingTableCells = EK;
	exports._getHtmlSupportAttributeName = MV;
	exports._getHtmlSupportDescendantElement = iR;
	exports._getImageBalloonPositionData = xA;
	exports._getImageSizeValueIfInPx = mA;
	exports._getImageViewElementMatcher = dA;
	exports._getLabeledTableColorInputCreator = BQ;
	exports._getListIndent = _O;
	exports._getListItemBlocks = FR;
	exports._getListItems = DR;
	exports._getListStyleTypeFromTypeAttribute = YO;
	exports._getListTypeFromListStyleType = QO;
	exports._getLocalizedHeadingOptions = XP;
	exports._getLocalizedLinkDecorators = Ex;
	exports._getLocalizedTableColorErrorText = EQ;
	exports._getLocalizedTableLengthErrorText = TQ;
	exports._getMinimapClientHeight = R$;
	exports._getMinimapDomElementRect = V$;
	exports._getMinimapPageStyles = P$;
	exports._getMinimapScrollable = O$;
	exports._getModelData = Md;
	exports._getModelNodeAfterPosition = la;
	exports._getModelNodeBeforePosition = ca;
	exports._getModelTextNodeAtPosition = aa;
	exports._getNestedListBlocks = NR;
	exports._getNormalizedAndLocalizedCodeBlockLanguageDefinitions = ZT;
	exports._getNormalizedDefaultTableBaseProperties = gJ;
	exports._getNormalizedDefaultTableCellProperties = pJ;
	exports._getNormalizedDefaultTableProperties = fJ;
	exports._getNormalizedListConfig = sB;
	exports._getRestrictedEditingMarkerAtPosition = FW;
	exports._getSelectedBlockObject = ZR;
	exports._getSelectedImageEditorNodes = SE;
	exports._getSelectedImagePossibleResizeRange = VE;
	exports._getSelectedImageWidthInUnits = IE;
	exports._getSelectedMediaModelWidget = h$;
	exports._getSelectedMediaViewWidget = c$;
	exports._getSelectedModelContent = au;
	exports._getSelectedTableWidget = wQ;
	exports._getSelectionAffectedTable = _K;
	exports._getSelectionAffectedTableWidget = bQ;
	exports._getTableBorderBoxSingleValue = hJ;
	exports._getTableCaptionFromModelElement = jY;
	exports._getTableCaptionFromModelSelection = $Y;
	exports._getTableColumnEdgesIndexes = KK;
	exports._getTableColumnElements = nJ;
	exports._getTableColumnGroupElement = iJ;
	exports._getTableColumnMinWidthAsPercentage = jK;
	exports._getTableColumnsWidths = sJ;
	exports._getTableOrCellBorderStyleDefinitions = VQ;
	exports._getTableWidgetAncestor = vQ;
	exports._getTableWidthInPixels = $K;
	exports._getTypeAttributeFromListStyleType = ZO;
	exports._getUserAgent = t;
	exports._getVerticallyOverlappingTableCells = xK;
	exports._getViewData = Id;
	exports._getViewElementIdForListType = xO;
	exports._getViewElementNameForListType = CO;
	exports._getWidgetTypeAroundButtonPosition = hC;
	exports._getWidgetTypeAroundFakeCaretPosition = gC;
	exports._hasLinkProtocol = Vx;
	exports._indentListBlocks = WR;
	exports._initDocumentDumping = Kd;
	exports._injectModelSelectionPostFixer = Qc;
	exports._injectTableCaptionPostFixer = qY;
	exports._injectTableCellParagraphPostFixer = WJ;
	exports._injectTableLayoutPostFixer = qJ;
	exports._injectViewQuirksHandling = _r;
	exports._injectViewUIElementHandling = Yo;
	exports._insertIntoModelNodeList = Kl;
	exports._insertMedia = m$;
	exports._insertModelContent = cu;
	exports._insertModelObject = du;
	exports._isAlignmentSupported = $_;
	exports._isAndroid = c;
	exports._isBlink = u;
	exports._isBookmarkIdValid = BC;
	exports._isDefaultAlignment = W_;
	exports._isEmailLink = Ix;
	exports._isEmojiSupported = fI;
	exports._isFirstBlockOfListItem = zR;
	exports._isGecko = r;
	exports._isInlineViewFiller = wr;
	exports._isLastBlockOfListItem = HR;
	exports._isListItemBlock = LR;
	exports._isListItemView = vO;
	exports._isListView = wO;
	exports._isLocalImage = XA;
	exports._isMac = s;
	exports._isMediaForcedColors = h;
	exports._isMediaWidget = u$;
	exports._isModelSelectionInCodeBlock = nS;
	exports._isMotionReduced = m;
	exports._isNumberedListType = eO;
	exports._isParagraphableModelNode = dl;
	exports._isPasteOfficePxValue = H$;
	exports._isRegExpUnicodePropertySupported = d;
	exports._isRestrictedEditingPositionInRangeBoundaries = NW;
	exports._isRestrictedEditingSelectionInMarker = DW;
	exports._isSafari = a;
	exports._isSingleListItem = JR;
	exports._isSingleTableParagraphWithoutAttributes = yJ;
	exports._isTableHeadingColumnCell = wK;
	exports._isTableModelElement = UY;
	exports._isViewPatternMatched = ho;
	exports._isWindows = o;
	exports._isiOS = l;
	exports._lengthTableFieldValidator = IQ;
	exports._lineWidthTableFieldValidator = PQ;
	exports._listItemBogusParagraphCreator = RO;
	exports._listItemDowncastConverter = PO;
	exports._listItemDowncastRemoveConverter = VO;
	exports._listItemUpcastConverter = SO;
	exports._listPropertiesUpcastConverter = iB;
	exports._logDocument = Jd;
	exports._matchTableCaptionViewElement = WY;
	exports._mergeHtmlSupportViewElementAttributes = RV;
	exports._mergeIntersectingModelRanges = Xc;
	exports._mergeListItemBefore = $R;
	exports._modelElementToPlainText = YY;
	exports._modelToDataViewCodeBlockSoftBreakInsertion = hS;
	exports._modelToViewBlockAttributeHtmlSupportConverter = jV;
	exports._modelToViewCodeBlockInsertion = dS;
	exports._modelToViewImageStyleAttribute = zE;
	exports._modelToViewUrlAttributeMediaConverter = a$;
	exports._modifyHtmlSupportGhsAttribute = OV;
	exports._modifyModelSelection = hu;
	exports._moveInModelNodeList = Ql;
	exports._normalizeAlignmentOptions = G_;
	exports._normalizeClipboardData = KC;
	exports._normalizeConversionConsumables = lo;
	exports._normalizeFontFamilyOptions = dP;
	exports._normalizeFontSizeOptions = vP;
	exports._normalizeInModelNodeList = Zl;
	exports._normalizeLinkDecorators = Tx;
	exports._normalizeListStyle = XO;
	exports._normalizePasteOfficeSpaceRunSpans = TW;
	exports._normalizePasteOfficeSpacing = EW;
	exports._normalizeTableColumnWidths = XK;
	exports._openLink = Rx;
	exports._operationTransform = bc;
	exports._outdentFollowingListItems = QR;
	exports._outdentListBlocksWithMerge = GR;
	exports._parseLanguageAttribute = FL;
	exports._parseModel = Dd;
	exports._parseView = Rd;
	exports._prepareCKBoxImageAssetAttributes = _T;
	exports._preventUiViewDefault = uw;
	exports._processMenuBarConfig = Vv;
	exports._rawCodeBlockSnippetTextToViewDocumentFragment = tS;
	exports._reconvertListItemsOnDataChange = IO;
	exports._registerCustomElement = Mb;
	exports._removeEmptyTableColumns = IK;
	exports._removeEmptyTableRows = PK;
	exports._removeEmptyTableRowsColumns = VK;
	exports._removeFromModelNodeList = Jl;
	exports._removeHtmlSupportViewAttributes = VV;
	exports._removeListAttributes = KR;
	exports._removePasteGoogleOfficeSheetsTag = kW;
	exports._removePasteMSOfficeAttributes = sW;
	exports._removePasteOfficeBoldWrapper = mW;
	exports._removePasteOfficeInvalidTableWidths = rW;
	exports._removePasteOfficeStyleBlock = CW;
	exports._removePasteOfficeXmlnsAttributes = yW;
	exports._renderDowncastFontElement = lP;
	exports._renderUpcastFontColorAttribute = aP;
	exports._replacePasteOfficeImagesSourceWithBase64 = iW;
	exports._repositionImageContextualBalloon = CA;
	exports._repositionTableContextualBalloon = DQ;
	exports._resurrectRestrictedEditingCollapsedMarkerPostFixer = $W;
	exports._sendCKBoxHttpRequest = gT;
	exports._setAttributeInModelNodeList = Yl;
	exports._setCKFinderCookie = H_;
	exports._setEmitterId = q;
	exports._setHtmlSupportViewAttributes = PV;
	exports._setModelData = Fd;
	exports._setViewData = Pd;
	exports._setupRestrictedEditingExceptionHighlighting = jW;
	exports._skipEmptyTableRow = FK;
	exports._sortFindResultsByMarkerPositions = $I;
	exports._sortListBlocks = YR;
	exports._splitListItemBefore = jR;
	exports._splitTableCellHorizontally = AK;
	exports._splitTableCellVertically = TK;
	exports._startsWithViewFiller = br;
	exports._stringifyLanguageAttribute = ML;
	exports._stringifyModel = Nd;
	exports._stringifyView = Vd;
	exports._sumArray = ZK;
	exports._tableCellRefreshHandler = XJ;
	exports._tableStructureRefreshHandler = ZJ;
	exports._toHtmlSupportPascalCase = LV;
	exports._toMediaWidget = l$;
	exports._toMentionAttribute = GS;
	exports._toObjectWidgetHtmlSupportConverter = NV;
	exports._toPasteOfficePxValue = q$;
	exports._toPrecision = JK;
	exports._transformPasteOfficeBlockBrsToParagraphs = gW;
	exports._transformPasteOfficeBookmarks = D$;
	exports._transformPasteOfficeListItemLikeElementsIntoLists = U$;
	exports._transformPasteOfficeTables = oW;
	exports._translate = wn;
	exports._translateTableColspanAttribute = oJ;
	exports._trimTableCellIfNeeded = SK;
	exports._tryCastImageDimensionsToUnit = TE;
	exports._tryFixingModelRange = Yc;
	exports._tryNormalizeHexColor = dv;
	exports._tryParseImageDimensionWithUnit = EE;
	exports._unifyTranslations = _n;
	exports._unwrapPasteOfficeParagraphInListItem = G$;
	exports._upcastConvertSelectionChange = pl;
	exports._upcastConvertText = fl;
	exports._upcastConvertToModelFragment = gl;
	exports._upcastImageFigure = TA;
	exports._upcastImagePicture = SA;
	exports._upcastNormalizedTableStyleToAttribute = XG;
	exports._upcastRestrictedEditingHighlightToMarker = GW;
	exports._upcastTable = MK;
	exports._upcastTableBorderStyles = eK;
	exports._upcastTableColgroupElement = gY;
	exports._upcastTableFigure = LK;
	exports._updateHtmlSupportViewAttributes = IV;
	exports._updateTableColumnElements = tJ;
	exports._updateTableNumericAttribute = pK;
	exports._viewToAttributeInlineHtmlSupportConverter = zV;
	exports._viewToModelBlockAttributeHtmlSupportConverter = UV;
	exports._viewToModelImageStyleAttribute = HE;
	exports._viewToModelObjectContentHtmlSupportConverter = FV;
	exports._wrapInModelParagraph = hl;
	exports.abortableDebounce = Zt;
	exports.add = bn;
	exports.addBackgroundStylesRules = od;
	exports.addBorderStylesRules = dd;
	exports.addKeyboardHandlingForGrid = Rs;
	exports.addLinkProtocolIfApplicable = Px;
	exports.addListToDropdown = Cw;
	exports.addMarginStylesRules = yd;
	exports.addMenuToDropdown = vw;
	exports.addPaddingStylesRules = kd;
	exports.addToolbarToDropdown = yw;
	exports.areConnectedThroughProperties = v;
	exports.attachToForm = xh;
	exports.blockAutoformatEditing = Ny;
	exports.calculateResizeHostAncestorWidth = aC;
	exports.calculateResizeHostPercentageWidth = lC;
	exports.clickOutsideHandler = Ss;
	exports.collectStylesheets = zn;
	exports.compareArrays = ei;
	exports.count = Xt;
	exports.crc32 = Dn;
	exports.createDropdown = ww;
	exports.createElement = ii;
	exports.createImageTypeRegExp = YA;
	exports.createLabeledDropdown = Vw;
	exports.createLabeledInputNumber = Iw;
	exports.createLabeledInputText = Sw;
	exports.createLabeledTextarea = Pw;
	exports.decodeLicenseKey = Yn;
	exports.delay = Fn;
	exports.diff = b;
	exports.diffToChanges = w;
	exports.disableViewPlaceholder = Js;
	exports.enableViewPlaceholder = Ks;
	exports.env = n;
	exports.exponentialDelay = Ln;
	exports.fastDiff = g;
	exports.filterGroupAndItemNames = Zv;
	exports.findAttributeRange = Ly;
	exports.findAttributeRangeBound = My;
	exports.findClosestScrollableAncestor = hi;
	exports.findOptimalInsertionRange = sC;
	exports.first = Cn;
	exports.focusChildOnDropdownOpen = Aw;
	exports.formatHtml = Hn;
	exports.getAncestors = mi;
	exports.getBorderWidths = fi;
	exports.getBoxSidesStyleShorthandValue = ed;
	exports.getBoxSidesStyleValueReducer = Xu;
	exports.getBoxSidesStyleValues = Zu;
	exports.getCode = an;
	exports.getCommonAncestor = bi;
	exports.getConstrainedViewportRect = zi;
	exports.getDataFromElement = gi;
	exports.getEnvKeystrokeText = cn;
	exports.getLabel = iC;
	exports.getLanguageDirection = fn;
	exports.getLastTextLine = wy;
	exports.getLocalizedArrowKeyCodeDirection = dn;
	exports.getLocalizedColorOptions = hb;
	exports.getOptimalPosition = Ni;
	exports.getPositionStyleShorthandNormalizer = td;
	exports.getPositionedAncestor = wi;
	exports.getRangeFromMouseEvent = pi;
	exports.getShorthandStylesValues = id;
	exports.getViewFillerOffset = xo;
	exports.getVisualViewportOffset = Ui;
	exports.hideViewPlaceholder = Ys;
	exports.indexOf = Oi;
	exports.inlineAutoformatEditing = Dy;
	exports.inlineHighlight = Fy;
	exports.insertAt = Bi;
	exports.insertToPriorityArray = T;
	exports.isArrowKeyCode = un;
	exports.isAttachmentStyleValue = $u;
	exports.isColorStyleValue = Vu;
	exports.isCombiningMark = Un;
	exports.isComment = Li;
	exports.isFeatureBlockedByLicenseKey = Zn;
	exports.isFocusable = Dp;
	exports.isForwardArrowKeyCode = hn;
	exports.isHighSurrogateHalf = jn;
	exports.isHtmlInDataTransfer = uE;
	exports.isInsideCombinedSymbol = Gn;
	exports.isInsideEmojiSequence = Jn;
	exports.isInsideSurrogatePair = Wn;
	exports.isIterable = ti;
	exports.isLengthStyleValue = Lu;
	exports.isLineStyleValue = Ou;
	exports.isLinkElement = Cx;
	exports.isLinkableElement = Sx;
	exports.isLowSurrogateHalf = $n;
	exports.isNode = ri;
	exports.isPercentageStyleValue = Fu;
	exports.isPositionStyleValue = Uu;
	exports.isRange = _i;
	exports.isRepeatStyleValue = Hu;
	exports.isTableHeaderCellType = fK;
	exports.isText = vi;
	exports.isTypeAroundWidget = uC;
	exports.isURLStyleValue = Yu;
	exports.isValidAttributeName = Mi;
	exports.isViewWithFocusCycler = zp;
	exports.isViewWithFocusTracker = En;
	exports.isVisible = Fi;
	exports.isWidget = Qk;
	exports.isWindow = ai;
	exports.keyCodes = on;
	exports.logError = V;
	exports.logWarning = P;
	exports.mapsEqual = Rn;
	exports.needsViewPlaceholder = Zs;
	exports.normalizeColorOptions = mb;
	exports.normalizeMenuBarConfig = Pv;
	exports.normalizeMultiRootEditorConstructorParams = Ih;
	exports.normalizeRootsConfig = Th;
	exports.normalizeSingleColorDefinition = gb;
	exports.normalizeSingleRootEditorConstructorParams = Sh;
	exports.normalizeToolbarConfig = dw;
	exports.nth = xn;
	exports.objectToMap = Pn;
	exports.parseBase64EncodedObject = Nn;
	exports.parseKeystroke = ln;
	exports.parsePasteOfficeHtml = IW;
	exports.plainTextToHtml = GC;
	exports.priorities = E;
	exports.releaseDate = L;
	exports.remove = qi;
	exports.retry = Bn;
	exports.scrollAncestorsToShowTarget = $i;
	exports.scrollViewportToShowTarget = ji;
	exports.secureSourceElement = Eh;
	exports.setDataInElement = Vi;
	exports.setHighlightHandling = eC;
	exports.setLabel = tC;
	exports.showViewPlaceholder = Qs;
	exports.spliceArray = Mn;
	exports.spy = k;
	exports.submitHandler = Vs;
	exports.toArray = pn;
	exports.toMap = Vn;
	exports.toUnit = Ri;
	exports.toWidget = Yk;
	exports.toWidgetEditable = nC;
	exports.transformOperationSets = wc;
	exports.uid = A;
	exports.version = B;
	exports.verticalWidgetNavigationHandler = vC;
	exports.viewToModelPositionOutsideModelElement = oC;
	exports.viewToPlainText = YC;
	exports.wait = On;

}));
//# sourceMappingURL=ckeditor5.umd.js.map
