Files
EIS-dotnet/src/Eis.Web/wwwroot/vendor/ckeditor5/ckeditor5.js
T
biss e3c04dad8a 本轮迁移已完成,生产运行链路现已切换为纯 ASP.NET Core 10。
主要完成:
补齐招生学校计划、投档审核、报到、扫码、补录等原生接口。
新增 SQLite/MySQL 空库初始化及默认审批流、号码规则。
删除 Node 兼容代理,未知 API 直接返回原生 404。
Docker、Compose、Gitea CI 全部切换到 Eis.Web.dll。
CKEditor 已固化到 Web 发布资源,不再依赖 node_modules。
新增纯 .NET 冒烟脚本:[smoke-dotnet-native.ps1 (line 1)](C:/Users/BI/Documents/EIS-dotnet/scripts/smoke-dotnet-native.ps1:1)。
迁移状态已更新:[MIGRATION.md (line 14)](C:/Users/BI/Documents/EIS-dotnet/MIGRATION.md:14)。
容器入口见 [Dockerfile (line 31)](C:/Users/BI/Documents/EIS-dotnet/Dockerfile:31)。
2026-07-23 15:14:42 +08:00

188 lines
1.8 MiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* @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
*/
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let u;try{u={window,document}}catch{u={window:{},document:{}}}function d(){try{return navigator.userAgent.toLowerCase()}catch{return``}}const f=d(),p={isMac:m(f),isWindows:h(f),isGecko:g(f),isSafari:_(f),isiOS:v(f),isAndroid:y(f),isBlink:ee(f),get isMediaForcedColors(){return x()},get isMotionReduced(){return te()},features:{isRegExpUnicodePropertySupported:b()}};function m(e){return e.indexOf(`macintosh`)>-1}function h(e){return e.indexOf(`windows`)>-1}function g(e){return!!e.match(/gecko\/\d+/)}function _(e){return e.indexOf(` applewebkit/`)>-1&&e.indexOf(`chrome`)===-1}function v(e){return!!e.match(/iphone|ipad/i)||m(e)&&navigator.maxTouchPoints>0}function y(e){return e.indexOf(`android`)>-1}function ee(e){return e.indexOf(`chrome/`)>-1&&e.indexOf(`edge/`)<0}function b(){let e=!1;try{e=`ć`.search(RegExp(`[\\p{L}]`,`u`))===0}catch{}return e}function x(){return u.window.matchMedia?u.window.matchMedia(`(forced-colors: active)`).matches:!1}function te(){return u.window.matchMedia?u.window.matchMedia(`(prefers-reduced-motion)`).matches:!1}function ne(e,t,n,r){n||=function(e,t){return e===t};let i=Array.isArray(e)?e:Array.prototype.slice.call(e),a=Array.isArray(t)?t:Array.prototype.slice.call(t),o=re(i,a,n);return r?ae(o,a.length):ie(a,o)}function re(e,t,n){let r=S(e,t,n);if(r===-1)return{firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};let i=S(C(e,r),C(t,r),n);return{firstIndex:r,lastIndexOld:e.length-i,lastIndexNew:t.length-i}}function S(e,t,n){for(let r=0;r<Math.max(e.length,t.length);r++)if(e[r]===void 0||t[r]===void 0||!n(e[r],t[r]))return r;return-1}function C(e,t){return e.slice(t).reverse()}function ie(e,t){let n=[],{firstIndex:r,lastIndexOld:i,lastIndexNew:a}=t;return a-r>0&&n.push({index:r,type:`insert`,values:e.slice(r,a)}),i-r>0&&n.push({index:r+(a-r),type:`delete`,howMany:i-r}),n}function ae(e,t){let{firstIndex:n,lastIndexOld:r,lastIndexNew:i}=e;if(n===-1)return Array(t).fill(`equal`);let a=[];return n>0&&(a=a.concat(Array(n).fill(`equal`))),i-n>0&&(a=a.concat(Array(i-n).fill(`insert`))),r-n>0&&(a=a.concat(Array(r-n).fill(`delete`))),i<t&&(a=a.concat(Array(t-i).fill(`equal`))),a}const oe=function(e,t,n){n||=function(e,t){return e===t};let r=e.length,i=t.length;if(r>200||i>200||r+i>300)return oe.fastDiff(e,t,n,!0);let a,o;if(i<r){let n=e;e=t,t=n,a=`delete`,o=`insert`}else a=`insert`,o=`delete`;let s=e.length,c=t.length,l=c-s,u={},d={};function f(r){let i=(d[r-1]===void 0?-1:d[r-1])+1,l=d[r+1]===void 0?-1:d[r+1],f=i>l?-1:1;u[r+f]&&(u[r]=u[r+f].slice(0)),u[r]||(u[r]=[]),u[r].push(i>l?a:o);let p=Math.max(i,l),m=p-r;for(;m<s&&p<c&&n(e[m],t[p]);)m++,p++,u[r].push(`equal`);return p}let p=0,m;do{for(m=-p;m<l;m++)d[m]=f(m);for(m=l+p;m>l;m--)d[m]=f(m);d[l]=f(l),p++}while(d[l]!==c);return u[l].slice(1)};oe.fastDiff=ne;function se(e,t){let n=[],r=0,i=null;return e.forEach(e=>{e==`equal`?(a(),r++):e==`insert`?(i&&i.type==`insert`?i.values.push(t[r]):(a(),i={type:`insert`,index:r,values:[t[r]]}),r++):i&&i.type==`delete`?i.howMany++:(a(),i={type:`delete`,index:r,howMany:1})}),a(),n;function a(){i&&=(n.push(i),null)}}function ce(e,t){if(e===t&&de(e))return!0;let n=le(e),r=le(t);for(let e of n)if(r.has(e))return!0;return!1}function le(e){let t=[e],n=new Set;for(;t.length>0;){let e=t.shift();if(!(n.has(e)||ue(e)))if(n.add(e),e[Symbol.iterator])try{t.push(...e)}catch{}else t.push(...Object.values(e))}return n}function ue(e){let t=Object.prototype.toString.call(e);return t===`[object Number]`||t===`[object Boolean]`||t===`[object String]`||t===`[object Symbol]`||t===`[object Function]`||t===`[object Date]`||t===`[object RegExp]`||e==null||e instanceof EventTarget||e instanceof Event}function de(e){return typeof e==`object`&&!!e}function fe(){return function e(){e.called=!0}}var pe=class{source;name;path;stop;off;return;constructor(e,t){this.source=e,this.name=t,this.path=[],this.stop=fe(),this.off=fe()}};const me=Array(256).fill(``).map((e,t)=>(`0`+t.toString(16)).slice(-2));function he(){let[e,t,n,r]=crypto.getRandomValues(new Uint32Array(4));return`e`+me[e>>0&255]+me[e>>8&255]+me[e>>16&255]+me[e>>24&255]+me[t>>0&255]+me[t>>8&255]+me[t>>16&255]+me[t>>24&255]+me[n>>0&255]+me[n>>8&255]+me[n>>16&255]+me[n>>24&255]+me[r>>0&255]+me[r>>8&255]+me[r>>16&255]+me[r>>24&255]}const ge={get(e=`normal`){return typeof e==`number`?e:this[e]||this.normal},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5};function _e(e,t){let n=ge.get(t.priority),r=0,i=e.length;for(;r<i;){let t=r+i>>1;ge.get(e[t].priority)<n?i=t:r=t+1}e.splice(r,0,t)}const ve=`https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html`;var w=class e extends Error{context;data;constructor(e,t,n,r){super(xe(e,n,r)),this.name=`CKEditorError`,this.context=t,this.data=n,r&&(this.stack=r.stack)}is(e){return e===`CKEditorError`}static rethrowUnexpectedError(t,n){throw t.is&&t.is(`CKEditorError`)?t:new e(`unexpected-error`,n,void 0,t)}};function T(e,t){console.warn(...Se(e,t))}function ye(e,t){console.error(...Se(e,t))}function be(e){return`\nRead more: ${ve}#error-${e}`}function xe(e,t,n){let r=new WeakSet,i=t?` ${JSON.stringify(t,(e,t)=>{if(typeof t==`object`&&t){if(r.has(t))return`[object ${t.constructor.name}]`;r.add(t)}return t})}`:``,a=be(e),o=n?`\nOriginal error: ${n.name}: ${n.message}`:``;return e+i+a+o}function Se(e,t){let n=be(e);return t?[e,t,n]:[e,n]}const Ce=`48.3.1`,we=new Date(2026,5,2);if(globalThis.CKEDITOR_VERSION)throw new w(`ckeditor-duplicated-modules`,null);globalThis.CKEDITOR_VERSION=Ce;const Te=Symbol(`listeningTo`),Ee=Symbol(`emitterId`),De=Symbol(`delegations`),Oe=E(Object);function E(e){if(!e)return Oe;class t extends e{on(e,t,n){this.listenTo(this,e,t,n)}once(e,t,n){let r=!1;this.listenTo(this,e,(e,...n)=>{r||(r=!0,e.off(),t.call(this,e,...n))},n)}off(e,t){this.stopListening(this,e,t)}listenTo(e,t,n,r={}){let i,a;this[Te]||(this[Te]={});let o=this[Te];je(e)||Ae(e);let s=je(e);(i=o[s])||(i=o[s]={emitter:e,callbacks:{}}),(a=i.callbacks[t])||(a=i.callbacks[t]=[]),a.push(n),Re(this,e,t,n,r)}stopListening(e,t,n){let r=this[Te],i=e&&je(e),a=r&&i?r[i]:void 0,o=a&&t?a.callbacks[t]:void 0;if(!(!r||e&&!a||t&&!o))if(n)ze(this,e,t,n),o.indexOf(n)!==-1&&(o.length===1?delete a.callbacks[t]:ze(this,e,t,n));else if(o){for(;n=o.pop();)ze(this,e,t,n);delete a.callbacks[t]}else if(a){for(t in a.callbacks)this.stopListening(e,t);delete r[i]}else{for(i in r)this.stopListening(r[i].emitter);delete this[Te]}}fire(e,...t){try{let n=e instanceof pe?e:new pe(this,e),r=n.name,i=Ie(this,r);if(n.path.push(this),i){i=i.slice();for(let e=0;e<i.length;e++){let a=i[e].callback;if(a.call(this,n,...t),n.off.called&&(delete n.off.called,this._removeEventListener(r,a)),n.stop.called)break}}let a=this[De];if(a){let e=a.get(r),i=a.get(`*`);e&&Le(e,n,t),i&&Le(i,n,t)}return n.return}catch(e){w.rethrowUnexpectedError(e,this)}}delegate(...e){return{to:(t,n)=>{this[De]||(this[De]=new Map),e.forEach(e=>{let r=this[De].get(e);r?r.set(t,n):this[De].set(e,new Map([[t,n]]))})}}}stopDelegating(e,t){if(this[De])if(!e)this[De].clear();else if(!t)this[De].delete(e);else{let n=this[De].get(e);n&&n.delete(t)}}_addEventListener(e,t,n){Pe(this,e);let r=Fe(this,e),i={callback:t,priority:ge.get(n.priority)};for(let e of r)_e(e,i)}_removeEventListener(e,t){let n=Fe(this,e);for(let e of n)for(let n=0;n<e.length;n++)e[n].callback==t&&(e.splice(n,1),n--)}}return t}function ke(e,t){let n=e[Te];return n&&n[t]?n[t].emitter:null}function Ae(e,t){e[Ee]||(e[Ee]=t||he())}function je(e){return e[Ee]}function Me(e){return e._events||Object.defineProperty(e,"_events",{value:{}}),e._events}function Ne(){return{callbacks:[],childEvents:[]}}function Pe(e,t){let n=Me(e);if(n[t])return;let r=t,i=null,a=[];for(;r!==``&&!n[r];)n[r]=Ne(),a.push(n[r]),i&&n[r].childEvents.push(i),i=r,r=r.substr(0,r.lastIndexOf(`:`));if(r!==``){for(let e of a)e.callbacks=n[r].callbacks.slice();n[r].childEvents.push(i)}}function Fe(e,t){let n=Me(e)[t];if(!n)return[];let r=[n.callbacks];for(let t=0;t<n.childEvents.length;t++){let i=Fe(e,n.childEvents[t]);r=r.concat(i)}return r}function Ie(e,t){if(!e._events)return null;let n=t;do{let t=e._events[n];if(t&&t.callbacks&&t.callbacks.length)return t.callbacks;let r=n.lastIndexOf(`:`);n=r>-1?n.substring(0,r):``}while(n);return null}function Le(e,t,n){for(let[r,i]of e){i?typeof i==`function`&&(i=i(t.name)):i=t.name;let e=new pe(t.source,i);e.path=[...t.path],r.fire(e,...n)}}function Re(e,t,n,r,i){t._addEventListener?t._addEventListener(n,r,i):e._addEventListener.call(t,n,r,i)}function ze(e,t,n,r){t._removeEventListener?t._removeEventListener(n,r):e._removeEventListener.call(t,n,r)}function Be(e,t){let n={};for(let r=0;r<e.length;r++){let i=e[r],a=t(i,r,e);Object.hasOwn(n,a)||(n[a]=[]),n[a].push(i)}return n}function Ve(e){return e}function eee(e){return Number.isSafeInteger(e)&&e>=0}function He(e){return e!=null&&typeof e!=`function`&&eee(e.length)}function Ue(e){return e===`__proto__`}function We(e){switch(typeof e){case`number`:case`symbol`:return!1;case`string`:return e.includes(`.`)||e.includes(`[`)||e.includes(`]`)}}function Ge(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}function Ke(e){if(e==null)return``;if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(Ke).join(`,`);let t=String(e);return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function qe(e){if(Array.isArray(e))return e.map(Ge);if(typeof e==`symbol`)return[e];e=Ke(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1;for(e.charCodeAt(0)===46&&(t.push(``),r++);r<n;){let s=e[r];a?s===`\\`&&r+1<n?(r++,i+=e[r]):s===a?a=``:i+=s:o?s===`"`||s===`'`?a=s:s===`]`?(o=!1,t.push(i),i=``):i+=s:s===`[`?(o=!0,i&&=(t.push(i),``)):s===`.`?i&&=(t.push(i),``):i+=s,r++}return i&&t.push(i),t}function Je(e,t,n){if(e==null)return n;switch(typeof t){case`string`:{if(Ue(t))return n;let r=e[t];return r===void 0?We(t)?Je(e,qe(t),n):n:r}case`number`:case`symbol`:{typeof t==`number`&&(t=Ge(t));let r=e[t];return r===void 0?n:r}default:{if(Array.isArray(t))return Ye(e,t,n);if(t=Object.is(t?.valueOf(),-0)?`-0`:String(t),Ue(t))return n;let r=e[t];return r===void 0?n:r}}}function Ye(e,t,n){if(t.length===0)return n;let r=e;for(let e=0;e<t.length;e++){if(r==null||Ue(t[e]))return n;r=r[t[e]]}return r===void 0?n:r}function tee(e){return function(t){return Je(t,e)}}function Xe(e){return e!==null&&(typeof e==`object`||typeof e==`function`)}function Ze(e){return e==null||typeof e!=`object`&&typeof e!=`function`}function Qe(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function $e(e,t,n){return typeof n==`function`?et(e,t,function e(t,r,i,a,o,s){let c=n(t,r,i,a,o,s);return c===void 0?et(t,r,e,s):!!c},new Map):$e(e,t,()=>void 0)}function et(e,t,n,r){if(t===e)return!0;switch(typeof t){case`object`:return tt(e,t,n,r);case`function`:return Object.keys(t).length>0?et(e,{...t},n,r):Qe(e,t);default:return Xe(e)?typeof t==`string`?t===``:!0:Qe(e,t)}}function tt(e,t,n,r){if(t==null)return!0;if(Array.isArray(t))return rt(e,t,n,r);if(t instanceof Map)return nt(e,t,n,r);if(t instanceof Set)return it(e,t,n,r);let i=Object.keys(t);if(e==null||Ze(e))return i.length===0;if(i.length===0)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let a=0;a<i.length;a++){let o=i[a];if(!Ze(e)&&!(o in e)||t[o]===void 0&&e[o]!==void 0||t[o]===null&&e[o]!==null||!n(e[o],t[o],o,e,t,r))return!1}return!0}finally{r?.delete(t)}}function nt(e,t,n,r){if(t.size===0)return!0;if(!(e instanceof Map))return!1;for(let[i,a]of t.entries())if(n(e.get(i),a,i,e,t,r)===!1)return!1;return!0}function rt(e,t,n,r){if(t.length===0)return!0;if(!Array.isArray(e))return!1;let i=new Set;for(let a=0;a<t.length;a++){let o=t[a],s=!1;for(let c=0;c<e.length;c++){if(i.has(c))continue;let l=e[c],u=!1;if(n(l,o,a,e,t,r)&&(u=!0),u){i.add(c),s=!0;break}}if(!s)return!1}return!0}function it(e,t,n,r){return t.size===0?!0:e instanceof Set?rt([...e],[...t],n,r):!1}function at(e,t){return $e(e,t,()=>void 0)}function ot(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function st(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}const ct=`[object RegExp]`,lt=`[object String]`,ut=`[object Number]`,dt=`[object Boolean]`,ft=`[object Arguments]`,pt=`[object Symbol]`,mt=`[object Date]`,ht=`[object Map]`,gt=`[object Set]`,_t=`[object Array]`,vt=`[object ArrayBuffer]`,yt=`[object Object]`,bt=`[object DataView]`,xt=`[object Uint8Array]`,St=`[object Uint8ClampedArray]`,Ct=`[object Uint16Array]`,wt=`[object Uint32Array]`,Tt=`[object Int8Array]`,Et=`[object Int16Array]`,Dt=`[object Int32Array]`,Ot=`[object Float32Array]`,kt=`[object Float64Array]`;function At(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function jt(e,t){return Mt(e,void 0,e,new Map,t)}function Mt(e,t,n,r=new Map,i=void 0){let a=i?.(e,t,n,r);if(a!==void 0)return a;if(Ze(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){let t=Array(e.length);r.set(e,t);for(let a=0;a<e.length;a++)t[a]=Mt(e[a],a,n,r,i);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){let t=new RegExp(e.source,e.flags);return t.lastIndex=e.lastIndex,t}if(e instanceof Map){let t=new Map;r.set(e,t);for(let[a,o]of e)t.set(a,Mt(o,a,n,r,i));return t}if(e instanceof Set){let t=new Set;r.set(e,t);for(let a of e)t.add(Mt(a,void 0,n,r,i));return t}if(typeof Buffer<`u`&&Buffer.isBuffer(e))return e.subarray();if(At(e)){let t=new(Object.getPrototypeOf(e)).constructor(e.length);r.set(e,t);for(let a=0;a<e.length;a++)t[a]=Mt(e[a],a,n,r,i);return t}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){let t=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return r.set(e,t),Nt(t,e,n,r,i),t}if(typeof File<`u`&&e instanceof File){let t=new File([e],e.name,{type:e.type});return r.set(e,t),Nt(t,e,n,r,i),t}if(typeof Blob<`u`&&e instanceof Blob){let t=new Blob([e],{type:e.type});return r.set(e,t),Nt(t,e,n,r,i),t}if(e instanceof Error){let t=structuredClone(e);return r.set(e,t),t.message=e.message,t.name=e.name,t.stack=e.stack,t.cause=e.cause,t.constructor=e.constructor,Nt(t,e,n,r,i),t}if(e instanceof Boolean){let t=new Boolean(e.valueOf());return r.set(e,t),Nt(t,e,n,r,i),t}if(e instanceof Number){let t=new Number(e.valueOf());return r.set(e,t),Nt(t,e,n,r,i),t}if(e instanceof String){let t=new String(e.valueOf());return r.set(e,t),Nt(t,e,n,r,i),t}if(typeof e==`object`&&Pt(e)){let t=Object.create(Object.getPrototypeOf(e));return r.set(e,t),Nt(t,e,n,r,i),t}return e}function Nt(e,t,n=e,r,i){let a=[...Object.keys(t),...ot(t)];for(let o=0;o<a.length;o++){let s=a[o],c=Object.getOwnPropertyDescriptor(e,s);(c==null||c.writable)&&(e[s]=Mt(t[s],s,n,r,i))}}function Pt(e){switch(st(e)){case ft:case _t:case vt:case bt:case dt:case mt:case Ot:case kt:case Tt:case Et:case Dt:case ht:case ut:case yt:case ct:case gt:case lt:case pt:case xt:case St:case Ct:case wt:return!0;default:return!1}}function Ft(e){return Mt(e,void 0,e,new Map,void 0)}function It(e){return e=Ft(e),t=>at(t,e)}function Lt(e,t){return jt(e,(n,r,i,a)=>{let o=t?.(n,r,i,a);if(o!==void 0)return o;if(typeof e==`object`){if(st(e)===`[object Object]`&&typeof e.constructor!=`function`){let t={};return a.set(e,t),Nt(t,e,i,a),t}switch(Object.prototype.toString.call(e)){case ut:case lt:case dt:{let t=new e.constructor(e?.valueOf());return Nt(t,e),t}case ft:{let t={};return Nt(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}}})}function Rt(e){return Lt(e)}const zt=/^(?:0|[1-9]\d*)$/;function Bt(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e<t;case`symbol`:return!1;case`string`:return zt.test(e)}}function Vt(e){return typeof e==`object`&&!!e&&st(e)===`[object Arguments]`}function Ht(e,t){let n;if(n=Array.isArray(t)?t:typeof t==`string`&&We(t)&&e?.[t]==null?qe(t):[t],n.length===0)return!1;let r=e;for(let e=0;e<n.length;e++){let t=n[e];if((r==null||!Object.hasOwn(r,t))&&!((Array.isArray(r)||Vt(r))&&Bt(t)&&t<r.length))return!1;r=r[t]}return!0}function nee(e,t){switch(typeof e){case`object`:Object.is(e?.valueOf(),-0)&&(e=`-0`);break;case`number`:e=Ge(e);break}return t=Rt(t),function(n){let r=Je(n,e);return r===void 0?Ht(n,e):t===void 0?r===void 0:at(r,t)}}function Ut(e){if(e==null)return Ve;switch(typeof e){case`function`:return e;case`object`:return Array.isArray(e)&&e.length===2?nee(e[0],e[1]):It(e);case`string`:case`symbol`:case`number`:return tee(e)}}function Wt(e,t){return e==null?{}:Be(He(e)?Array.from(e):Object.values(e),Ut(t??Ve))}function Gt(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function Kt(e,t=0,n={}){typeof n!=`object`&&(n={});let{leading:r=!1,trailing:i=!0,maxWait:a}=n,o=[,,];r&&(o[0]=`leading`),i&&(o[1]=`trailing`);let s,c=null,l=Gt(function(...t){s=e.apply(this,t),c=null},t,{edges:o}),u=function(...t){return a!=null&&(c===null&&(c=Date.now()),Date.now()-c>=a)?(s=e.apply(this,t),c=Date.now(),l.cancel(),l.schedule(),s):(l.apply(this,t),s)};return u.cancel=l.cancel,u.flush=()=>(l.flush(),s),u}function qt(e,t=0,n={}){let{leading:r=!0,trailing:i=!0}=n;return Kt(e,t,{leading:r,maxWait:t,trailing:i})}function Jt(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(e)===`[object Object]`:!1}function Yt(e,t,n){return Xt(e,t,void 0,void 0,void 0,void 0,n)}function Xt(e,t,n,r,i,a,o){let s=o(e,t,n,r,i,a);if(s!==void 0)return s;if(typeof e==typeof t)switch(typeof e){case`bigint`:case`string`:case`boolean`:case`symbol`:case`undefined`:return e===t;case`number`:return e===t||Object.is(e,t);case`function`:return e===t;case`object`:return Zt(e,t,a,o)}return Zt(e,t,a,o)}function Zt(e,t,n,r){if(Object.is(e,t))return!0;let i=st(e),a=st(t);if(i===`[object Arguments]`&&(i=yt),a===`[object Arguments]`&&(a=yt),i!==a)return!1;switch(i){case lt:return e.toString()===t.toString();case ut:return Qe(e.valueOf(),t.valueOf());case dt:case mt:case pt:return Object.is(e.valueOf(),t.valueOf());case ct:return e.source===t.source&&e.flags===t.flags;case`[object Function]`:return e===t}n??=new Map;let o=n.get(e),s=n.get(t);if(o!=null&&s!=null)return o===t;n.set(e,t),n.set(t,e);try{switch(i){case ht:if(e.size!==t.size)return!1;for(let[i,a]of e.entries())if(!t.has(i)||!Xt(a,t.get(i),i,e,t,n,r))return!1;return!0;case gt:{if(e.size!==t.size)return!1;let i=Array.from(e.values()),a=Array.from(t.values());for(let o=0;o<i.length;o++){let s=i[o],c=a.findIndex(i=>Xt(s,i,void 0,e,t,n,r));if(c===-1)return!1;a.splice(c,1)}return!0}case _t:case xt:case St:case Ct:case wt:case`[object BigUint64Array]`:case Tt:case Et:case Dt:case`[object BigInt64Array]`:case Ot:case kt:if(typeof Buffer<`u`&&Buffer.isBuffer(e)!==Buffer.isBuffer(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!Xt(e[i],t[i],i,e,t,n,r))return!1;return!0;case vt:return e.byteLength===t.byteLength?Zt(new Uint8Array(e),new Uint8Array(t),n,r):!1;case bt:return e.byteLength!==t.byteLength||e.byteOffset!==t.byteOffset?!1:Zt(new Uint8Array(e),new Uint8Array(t),n,r);case`[object Error]`:return e.name===t.name&&e.message===t.message;case yt:{if(!(Zt(e.constructor,t.constructor,n,r)||Jt(e)&&Jt(t)))return!1;let i=[...Object.keys(e),...ot(e)],a=[...Object.keys(t),...ot(t)];if(i.length!==a.length)return!1;for(let a=0;a<i.length;a++){let o=i[a],s=e[o];if(!Object.hasOwn(t,o))return!1;let c=t[o];if(!Xt(s,c,o,e,t,n,r))return!1}return!0}default:return!1}}finally{n.delete(e),n.delete(t)}}function Qt(){}function $t(e,t){return Yt(e,t,Qt)}function en(e){return e}function tn(e){return typeof Buffer<`u`&&Buffer.isBuffer(e)}function nn(e){let t=e?.constructor;return e===(typeof t==`function`?t.prototype:Object.prototype)}function rn(e){return At(e)}function an(e){return typeof e==`symbol`||e instanceof Symbol}function on(e){return an(e)?NaN:Number(e)}function sn(e){return e?(e=on(e),e===1/0||e===-1/0?(e<0?-1:1)*Number.MAX_VALUE:e===e?e:0):e===0?e:0}function cn(e){let t=sn(e),n=t%1;return n?t-n:t}function ln(e,t){if(e=cn(e),e<1||!Number.isSafeInteger(e))return[];let n=Array(e);for(let r=0;r<e;r++)n[r]=typeof t==`function`?t(r):r;return n}function un(e){if(e==null)return[];switch(typeof e){case`object`:case`function`:return He(e)?iee(e):nn(e)?ree(e):dn(e);default:return dn(Object(e))}}function dn(e){let t=[];for(let n in e)t.push(n);return t}function ree(e){return dn(e).filter(e=>e!==`constructor`)}function iee(e){let t=ln(e.length,e=>`${e}`),n=new Set(t);tn(e)&&(n.add(`offset`),n.add(`parent`)),rn(e)&&(n.add(`buffer`),n.add(`byteLength`),n.add(`byteOffset`));let r=dn(e).filter(e=>!n.has(e));return Array.isArray(e)?[...t,...r]:[...t.filter(t=>Object.hasOwn(e,t)),...r]}function fn(e,...t){for(let n=0;n<t.length;n++)aee(e,t[n]);return e}function aee(e,t){let n=un(t);for(let r=0;r<n.length;r++){let i=n[r];(!(i in e)||!Qe(e[i],t[i]))&&(e[i]=t[i])}}function oee(e){return Array.isArray(e)}function see(e){if(Ze(e))return e;let t=st(e);if(!cee(e))return{};if(oee(e)){let t=Array.from(e);return e.length>0&&typeof e[0]==`string`&&Object.hasOwn(e,`index`)&&(t.index=e.index,t.input=e.input),t}if(rn(e)){let t=e,n=t.constructor;return new n(t.buffer,t.byteOffset,t.length)}if(t===`[object ArrayBuffer]`)return new ArrayBuffer(e.byteLength);if(t===`[object DataView]`){let t=e,n=t.buffer,r=t.byteOffset,i=t.byteLength,a=new ArrayBuffer(i),o=new Uint8Array(n,r,i);return new Uint8Array(a).set(o),new DataView(a)}if(t===`[object Boolean]`||t===`[object Number]`||t===`[object String]`){let n=e.constructor,r=new n(e.valueOf());return t===`[object String]`?hn(r,e):pn(r,e),r}if(t===`[object Date]`)return new Date(Number(e));if(t===`[object RegExp]`){let t=e,n=new RegExp(t.source,t.flags);return n.lastIndex=t.lastIndex,n}if(t===`[object Symbol]`)return Object(Symbol.prototype.valueOf.call(e));if(t===`[object Map]`){let t=e,n=new Map;return t.forEach((e,t)=>{n.set(t,e)}),n}if(t===`[object Set]`){let t=e,n=new Set;return t.forEach(e=>{n.add(e)}),n}if(t===`[object Arguments]`){let t=e,n={};return pn(n,t),n.length=t.length,n[Symbol.iterator]=t[Symbol.iterator],n}let n={};return gn(n,e),pn(n,e),mn(n,e),n}function cee(e){switch(st(e)){case ft:case _t:case vt:case bt:case dt:case mt:case Ot:case kt:case Tt:case Et:case Dt:case ht:case ut:case yt:case ct:case gt:case lt:case pt:case xt:case St:case Ct:case wt:return!0;default:return!1}}function pn(e,t){for(let n in t)Object.hasOwn(t,n)&&(e[n]=t[n])}function mn(e,t){let n=Object.getOwnPropertySymbols(t);for(let r=0;r<n.length;r++){let i=n[r];Object.prototype.propertyIsEnumerable.call(t,i)&&(e[i]=t[i])}}function hn(e,t){let n=t.valueOf().length;for(let r in t)Object.hasOwn(t,r)&&(Number.isNaN(Number(r))||Number(r)>=n)&&(e[r]=t[r])}function gn(e,t){let n=Object.getPrototypeOf(t);n!==null&&typeof t.constructor==`function`&&Object.setPrototypeOf(e,n)}function _n(e,t){let n={},r=Object.keys(e);for(let i=0;i<r.length;i++){let a=r[i],o=e[a];n[a]=t(o,a,e)}return n}function vn(e,t=Ve){return e==null?{}:_n(e,Ut(t))}function yn(e){if(Ze(e))return e;if(Array.isArray(e)||At(e)||e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer)return e.slice(0);let t=Object.getPrototypeOf(e);if(t==null)return Object.assign(Object.create(t),e);let n=t.constructor;if(e instanceof Date||e instanceof Map||e instanceof Set)return new n(e);if(e instanceof RegExp){let t=new n(e);return t.lastIndex=e.lastIndex,t}if(e instanceof DataView)return new n(e.buffer.slice(0));if(e instanceof Error){let t;return t=e instanceof AggregateError?new n(e.errors,e.message,{cause:e.cause}):new n(e.message,{cause:e.cause}),t.stack=e.stack,Object.assign(t,e),t}return typeof File<`u`&&e instanceof File?new n([e],e.name,{type:e.type,lastModified:e.lastModified}):typeof e==`object`?Object.assign(Object.create(t),e):e}function bn(e){return typeof e==`object`&&!!e}function lee(e){return bn(e)&&He(e)}function xn(e){if(typeof e!=`object`||!e)return!1;if(Object.getPrototypeOf(e)===null)return!0;if(Object.prototype.toString.call(e)!==`[object Object]`){let t=e[Symbol.toStringTag];return t==null||!Object.getOwnPropertyDescriptor(e,Symbol.toStringTag)?.writable?!1:e.toString()===`[object ${t}]`}let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Sn(e,...t){let n=t.slice(0,-1),r=t[t.length-1],i=e;for(let e=0;e<n.length;e++){let t=n[e];i=Cn(i,t,r,new Map)}return i}function Cn(e,t,n,r){if(Ze(e)&&(e=Object(e)),typeof t!=`object`||!t)return e;if(r.has(t))return yn(r.get(t));if(r.set(t,e),Array.isArray(t)){t=t.slice();for(let e=0;e<t.length;e++)t[e]=t[e]??void 0}let i=[...Object.keys(t),...ot(t)];for(let a=0;a<i.length;a++){let o=i[a];if(Ue(o))continue;let s=t[o],c=e[o];if(Vt(s)&&(s={...s}),Vt(c)&&(c={...c}),typeof Buffer<`u`&&Buffer.isBuffer(s)&&(s=Rt(s)),Array.isArray(s))if(Array.isArray(c)){let e=[],t=Reflect.ownKeys(c);for(let n=0;n<t.length;n++){let r=t[n];e[r]=c[r]}c=e}else if(lee(c)){let e=[];for(let t=0;t<c.length;t++)e[t]=c[t];c=e}else c=[];let l=n(c,s,o,e,t,r);l===void 0?Array.isArray(s)||bn(c)&&bn(s)&&(xn(c)||xn(s)||rn(c)||rn(s))?e[o]=Cn(c,s,n,r):c==null&&xn(s)?e[o]=Cn({},s,n,r):c==null&&rn(s)?e[o]=Rt(s):(c===void 0||s!==void 0)&&(e[o]=s):e[o]=l}return e}function wn(e,...t){return Sn(e,...t,Qt)}const Tn=(e,t,n)=>{let r=e[t];(!(Object.hasOwn(e,t)&&Qe(r,n))||n===void 0&&!(t in e))&&(e[t]=n)},En=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Dn=/^\w*$/;function uee(e,t){return Array.isArray(e)?!1:typeof e==`number`||typeof e==`boolean`||e==null||an(e)?!0:typeof e==`string`&&(Dn.test(e)||!En.test(e))||t!=null&&Object.hasOwn(t,e)}function dee(e,t,n,r){if(e==null&&!Xe(e))return e;let i;i=uee(t,e)?[t]:Array.isArray(t)?t:qe(t);let a=n(Je(e,i)),o=e;for(let t=0;t<i.length&&o!=null;t++){let n=Ge(i[t]);if(Ue(n))continue;let s;if(t===i.length-1)s=a;else{let a=o[n],c=r?.(a,n,e);s=c===void 0?Xe(a)?a:Bt(i[t+1])?[]:{}:c}Tn(o,n,s),o=o[n]}return e}function On(e,t,n){return dee(e,t,()=>n,()=>void 0)}function fee(e){return e==null}function kn(e,...t){if(fee(e))return{};let n={};for(let r=0;r<t.length;r++){let i=t[r];switch(typeof i){case`object`:Array.isArray(i)||(i=He(i)?Array.from(i):[i]);break;case`string`:case`symbol`:case`number`:i=[i];break}for(let t of i){let r=Je(e,t);r===void 0&&!Ht(e,t)||(typeof t==`string`&&Object.hasOwn(e,t)?n[t]=r:On(n,t,r))}}return n}function An(e){return typeof e==`function`}function jn(e){return bn(e)&&e.nodeType===1&&!xn(e)}function Mn(e){if(e==null)return!0;if(He(e))return typeof e.splice!=`function`&&typeof e!=`string`&&(typeof Buffer>`u`||!Buffer.isBuffer(e))&&!rn(e)&&!Vt(e)?!1:e.length===0;if(typeof e==`object`){if(e instanceof Map||e instanceof Set)return e.size===0;let t=Object.keys(e);return nn(e)?t.filter(e=>e!==`constructor`).length===0:t.length===0}return!0}function Nn(e,t){if(!Number.isInteger(e)||e<0)throw Error(`n must be a non-negative integer.`);let n=0;return(...r)=>{if(++n>=e)return t(...r)}}function Pn(e,t,n){return typeof n!=`function`&&(n=()=>void 0),Yt(e,t,(...r)=>{let i=n(...r);if(i!==void 0)return!!i;if(e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set)return Pn(Array.from(e),Array.from(t),Nn(2,n))})}function Fn(e){return typeof e==`string`||e instanceof String}const In={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`};function Ln(e){return e.replace(/[&<>"']/g,e=>In[e])}function Rn(e){return Ln(Ke(e))}function zn(e){return e.replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`)}function Bn(e){return zn(Ke(e))}const Vn=new Map([[`Æ`,`Ae`],[`Ð`,`D`],[`Ø`,`O`],[`Þ`,`Th`],[`ß`,`ss`],[`æ`,`ae`],[`ð`,`d`],[`ø`,`o`],[`þ`,`th`],[`Đ`,`D`],[`đ`,`d`],[`Ħ`,`H`],[`ħ`,`h`],[`ı`,`i`],[`IJ`,`IJ`],[`ij`,`ij`],[`ĸ`,`k`],[`Ŀ`,`L`],[`ŀ`,`l`],[`Ł`,`L`],[`ł`,`l`],[`ʼn`,`'n`],[`Ŋ`,`N`],[`ŋ`,`n`],[`Œ`,`Oe`],[`œ`,`oe`],[`Ŧ`,`T`],[`ŧ`,`t`],[`ſ`,`s`]]);function Hn(e){e=e.normalize(`NFD`);let t=``;for(let n=0;n<e.length;n++){let r=e[n];r>=`̀`&&r<=`ͯ`||r>=`︠`&&r<=`︣`||(t+=Vn.get(r)??r)}return t}function Un(e){return Hn(Ke(e))}const Wn=/\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;function Gn(e){return Array.from(e.match(Wn)??[])}function Kn(e){return typeof e!=`string`&&(e=Ke(e)),e.replace(/['\u2019]/g,``)}function qn(e){let t=Gn(Kn(Un(e)).trim()),n=``;for(let e=0;e<t.length;e++){let r=t[e];n&&(n+=` `),r===r.toUpperCase()?n+=r:n+=r[0].toUpperCase()+r.slice(1).toLowerCase()}return n}function Jn(e){return e.substring(0,1).toUpperCase()+e.substring(1)}function Yn(e){return Jn(Ke(e))}const Xn=Symbol(`observableProperties`),Zn=Symbol(`boundObservables`),Qn=Symbol(`boundProperties`),$n=Symbol(`decoratedMethods`),er=Symbol(`decoratedOriginal`),tr=D(E());function D(e){if(!e)return tr;class t extends e{set(e,t){if(Xe(e)){Object.keys(e).forEach(t=>{this.set(t,e[t])},this);return}nr(this);let n=this[Xn];if(e in this&&!n.has(e))throw new w(`observable-set-cannot-override`,this);Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get(){return n.get(e)},set(t){let r=n.get(e),i=this.fire(`set:${e}`,e,t,r);i===void 0&&(i=t),(r!==i||!n.has(e))&&(n.set(e,i),this.fire(`change:${e}`,e,i,r))}}),this[e]=t}bind(...e){if(!e.length||!or(e))throw new w(`observable-bind-wrong-properties`,this);if(new Set(e).size!==e.length)throw new w(`observable-bind-duplicate-properties`,this);nr(this);let t=this[Qn];e.forEach(e=>{if(t.has(e))throw new w(`observable-bind-rebind`,this)});let n=new Map;return e.forEach(e=>{let r={property:e,to:[]};t.set(e,r),n.set(e,r)}),{to:rr,toMany:ir,_observable:this,_bindProperties:e,_to:[],_bindings:n}}unbind(...e){if(!this[Xn])return;let t=this[Qn],n=this[Zn];if(e.length){if(!or(e))throw new w(`observable-unbind-wrong-properties`,this);e.forEach(e=>{let r=t.get(e);r&&(r.to.forEach(([e,t])=>{let i=n.get(e),a=i[t];a.delete(r),a.size||delete i[t],Object.keys(i).length||(n.delete(e),this.stopListening(e,`change`))}),t.delete(e))})}else n.forEach((e,t)=>{this.stopListening(t,`change`)}),n.clear(),t.clear()}decorate(e){nr(this);let t=this[e];if(!t)throw new w(`observablemixin-cannot-decorate-undefined`,this,{object:this,methodName:e});this.on(e,(e,n)=>{e.return=t.apply(this,n)}),this[e]=function(...t){return this.fire(e,t)},this[e][er]=t,this[$n]||(this[$n]=[]),this[$n].push(e)}stopListening(e,t,n){if(!e&&this[$n]){for(let e of this[$n])this[e]=this[e][er];delete this[$n]}super.stopListening(e,t,n)}[Xn];[$n];[Qn];[Zn]}return t}function nr(e){e[Xn]||(Object.defineProperty(e,Xn,{value:new Map}),Object.defineProperty(e,Zn,{value:new Map}),Object.defineProperty(e,Qn,{value:new Map}))}function rr(...e){let t=sr(...e),n=Array.from(this._bindings.keys()),r=n.length;if(!t.callback&&t.to.length>1)throw new w(`observable-bind-to-no-callback`,this);if(r>1&&t.callback)throw new w(`observable-bind-to-extra-callback`,this);t.to.forEach(e=>{if(e.properties.length&&e.properties.length!==r)throw new w(`observable-bind-to-properties-length`,this);e.properties.length||(e.properties=this._bindProperties)}),this._to=t.to,t.callback&&(this._bindings.get(n[0]).callback=t.callback),hee(this._observable,this._to),mee(this),this._bindProperties.forEach(e=>{cr(this._observable,e)})}function ir(e,t,n){if(this._bindings.size>1)throw new w(`observable-bind-to-many-not-one-binding`,this);this.to(...ar(e,t),n)}function ar(e,t){let n=e.map(e=>[e,t]);return Array.prototype.concat.apply([],n)}function or(e){return e.every(e=>typeof e==`string`)}function sr(...e){if(!e.length)throw new w(`observable-bind-to-parse-error`,null);let t={to:[]},n;return typeof e[e.length-1]==`function`&&(t.callback=e.pop()),e.forEach(e=>{if(typeof e==`string`)n.properties.push(e);else if(typeof e==`object`)n={observable:e,properties:[]},t.to.push(n);else throw new w(`observable-bind-to-parse-error`,null)}),t}function pee(e,t,n,r){let i=e[Zn],a=i.get(n),o=a||{};o[r]||(o[r]=new Set),o[r].add(t),a||i.set(n,o)}function mee(e){let t;e._bindings.forEach((n,r)=>{e._to.forEach(i=>{t=i.properties[n.callback?0:e._bindProperties.indexOf(r)],n.to.push([i.observable,t]),pee(e._observable,n,i.observable,t)})})}function cr(e,t){let n=e[Qn].get(t),r;n.callback?r=n.callback.apply(e,n.to.map(e=>e[0][e[1]])):(r=n.to[0],r=r[0][r[1]]),Object.prototype.hasOwnProperty.call(e,t)?e[t]=r:e.set(t,r)}function hee(e,t){t.forEach(t=>{let n=e[Zn],r;n.get(t.observable)||e.listenTo(t.observable,`change`,(i,a)=>{r=n.get(t.observable)[a],r&&r.forEach(t=>{cr(e,t.property)})})})}var lr=class{_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 ur(e){let t=new AbortController;function n(...n){return t.abort(),t=new AbortController,e(t.signal,...n)}return n.abort=()=>t.abort(),n}function dr(e){let t=0;for(let n of e)t++;return t}function fr(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!=t[r])return r;return e.length==t.length?`same`:e.length<t.length?`prefix`:`extension`}function pr(e){return!!(e&&e[Symbol.iterator])}function mr(e,t,n={},r=[]){let i=n&&n.xmlns,a=i?e.createElementNS(i,t):e.createElement(t);for(let e in n)a.setAttribute(e,n[e]);(Fn(r)||!pr(r))&&(r=[r]);for(let t of r)Fn(t)&&(t=e.createTextNode(t)),a.appendChild(t);return a}var hr=class{_config;constructor(e,t){this._config=Object.create(null),t&&this.define(gr(t)),e&&this._setObjectToTarget(this._config,e)}set(e,t){this._setToTarget(this._config,e,t)}define(e,t){this._setToTarget(this._config,e,t,!0)}get(e){return this._getFromSource(this._config,e)}*names(){for(let e of Object.keys(this._config))yield e}_setToTarget(e,t,n,r=!1){if(xn(t)){this._setObjectToTarget(e,t,r);return}let i=t.split(`.`);t=i.pop();for(let t of i)xn(e[t])||(e[t]=Object.create(null)),e=e[t];if(xn(n)){xn(e[t])||(e[t]=Object.create(null)),e=e[t],this._setObjectToTarget(e,n,r);return}r&&e[t]!==void 0||(e[t]=n)}_getFromSource(e,t){let n=t.split(`.`);t=n.pop();for(let t of n){if(!xn(e[t])){e=null;break}e=e[t]}return e?gr(e[t]):void 0}_setObjectToTarget(e,t,n){Object.keys(t).forEach(r=>{this._setToTarget(e,r,t[r],n)})}};function gr(e){return Lt(e,_r)}function _r(e){return jn(e)||typeof e==`function`?e:void 0}function vr(e){if(e){if(e.defaultView)return e instanceof e.defaultView.Document;if(e.ownerDocument&&e.ownerDocument.defaultView)return e instanceof e.ownerDocument.defaultView.Node}return!1}function yr(e){let t=Object.prototype.toString.apply(e);return t==`[object Window]`||t==`[object global]`}const gee=br(E()),_ee=E();function br(e){if(!e)return gee;class t extends e{listenTo(e,t,n,r={}){if(vr(e)||yr(e)||e instanceof u.window.EventTarget){let i={capture:!!r.useCapture,passive:!!r.usePassive},a=this._getProxyEmitter(e,i)||new xr(e,i);this.listenTo(a,t,n,r)}else super.listenTo(e,t,n,r)}stopListening(e,t,n){if(vr(e)||yr(e)||e instanceof u.window.EventTarget){let r=this._getAllProxyEmitters(e);for(let e of r)this.stopListening(e,t,n)}else super.stopListening(e,t,n)}_getProxyEmitter(e,t){return ke(this,Cr(e,t))}_getAllProxyEmitters(e){return[{capture:!1,passive:!1},{capture:!1,passive:!0},{capture:!0,passive:!1},{capture:!0,passive:!0}].map(t=>this._getProxyEmitter(e,t)).filter(e=>!!e)}}return t}var xr=class extends _ee{_domNode;_options;constructor(e,t){super(),Ae(this,Cr(e,t)),this._domNode=e,this._options=t}_domListeners;attach(e){if(this._domListeners&&this._domListeners[e])return;let t=this._createDomListener(e);this._domNode.addEventListener(e,t,this._options),this._domListeners||={},this._domListeners[e]=t}detach(e){let t;this._domListeners[e]&&(!(t=this._events[e])||!t.callbacks.length)&&this._domListeners[e].removeListener()}_addEventListener(e,t,n){this.attach(e),E().prototype._addEventListener.call(this,e,t,n)}_removeEventListener(e,t){E().prototype._removeEventListener.call(this,e,t),this.detach(e)}_createDomListener(e){let t=t=>{this.fire(e,t)};return t.removeListener=()=>{this._domNode.removeEventListener(e,t,this._options),delete this._domListeners[e]},t}};function Sr(e){return e[`data-ck-expando`]||=he()}function Cr(e,t){let n=Sr(e);for(let e of Object.keys(t).sort())t[e]&&(n+=`-`+e);return n}function wr(e){let t=e.parentElement;if(!t)return null;for(;t.tagName!=`BODY`;){let e=t.style.overflowY||u.window.getComputedStyle(t).overflowY;if(e===`auto`||e===`scroll`)break;if(t=t.parentElement,!t)return null}return t}function Tr(e){let t=[],n=e;for(;n&&n.nodeType!=Node.DOCUMENT_NODE;)t.unshift(n),n=n.parentNode;return t}function Er(e){return e instanceof HTMLTextAreaElement?e.value:e.innerHTML}function Dr(e){let 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 Or(e){if(!e.target)return null;let t=e.target.ownerDocument,n=e.clientX,r=e.clientY,i=null;return t.caretRangeFromPoint&&t.caretRangeFromPoint(n,r)?i=t.caretRangeFromPoint(n,r):e.rangeParent&&(i=t.createRange(),i.setStart(e.rangeParent,e.rangeOffset),i.collapse(!0)),i}function kr(e,t){let n=Tr(e),r=Tr(t),i=0;for(;n[i]==r[i]&&n[i];)i++;return i===0?null:n[i-1]}function Ar(e){return!e||!e.parentNode||e.offsetParent===u.document.body?null:e.offsetParent}function jr(e){return Object.prototype.toString.call(e)==`[object Text]`}function Mr(e){return Object.prototype.toString.apply(e)==`[object Range]`}const Nr=[`top`,`right`,`bottom`,`left`,`width`,`height`],Pr=new Set([`relative`,`absolute`,`fixed`,`sticky`]);var O=class e{top;right;bottom;left;width;height;_source;constructor(t){let n=Mr(t);if(Object.defineProperty(this,"_source",{value:t._source||t,writable:!0,enumerable:!1}),Lr(t)||n)if(n){let n=e.getDomRangeRects(t);Fr(this,e.getBoundingRect(n))}else Fr(this,t.getBoundingClientRect());else if(yr(t)){let{innerWidth:e,innerHeight:n}=t;Fr(this,{top:0,right:e,bottom:n,left:0,width:e,height:n})}else Fr(this,t)}clone(){return new e(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(t){let n={top:Math.max(this.top,t.top),right:Math.min(this.right,t.right),bottom:Math.min(this.bottom,t.bottom),left:Math.max(this.left,t.left),width:0,height:0};if(n.width=n.right-n.left,n.height=n.bottom-n.top,n.width<0||n.height<0)return null;{let t=new e(n);return t._source=this._source,t}}getIntersectionArea(e){let t=this.getIntersection(e);return t?t.getArea():0}getArea(){return this.width*this.height}getVisible(){let t=this._source,n=this.clone();if(Ir(t))return n;let r=t,i=t.parentNode||t.commonAncestorContainer,a;for(;i&&!Ir(i);){let t=zr(i)===`visible`;if(Br(r)&&(a=r),t||a&&Rr(a)===`absolute`&&!Br(i)){r=i,i=i.parentNode;continue}let o=new e(i),s=n.getIntersection(o);if(s)s.getArea()<n.getArea()&&(n=s);else return null;r=i,i=i.parentNode}return n}isEqual(e){for(let t of Nr)if(this[t]!==e[t])return!1;return!0}contains(e){let t=this.getIntersection(e);return!!(t&&t.isEqual(e))}toAbsoluteRect(){let{scrollX:e,scrollY:t}=u.window,n=this.clone().moveBy(e,t);if(Lr(n._source)){let e=Ar(n._source);e&&Vr(n,e)}return n}excludeScrollbarsAndBorders(){let e=this._source,t,n,r;if(yr(e))t=e.innerWidth-e.document.documentElement.clientWidth,n=e.innerHeight-e.document.documentElement.clientHeight,r=e.getComputedStyle(e.document.documentElement).direction;else{let i=Dr(e);t=e.offsetWidth-e.clientWidth-i.left-i.right,n=e.offsetHeight-e.clientHeight-i.top-i.bottom,r=e.ownerDocument.defaultView.getComputedStyle(e).direction,this.left+=i.left,this.top+=i.top,this.right-=i.right,this.bottom-=i.bottom,this.width=this.right-this.left,this.height=this.bottom-this.top}return this.width-=t,r===`ltr`?this.right-=t:this.left+=t,this.height-=n,this.bottom-=n,this}static getDomRangeRects(t){let n=[],r=Array.from(t.getClientRects());if(r.length)for(let i of r){let r=new e(i);r._source=t,n.push(r)}else{let r=t.startContainer;jr(r)&&(r=r.parentNode);let i=new e(r.getBoundingClientRect());i.right=i.left,i.width=0,n.push(i)}return n}static getDomElementRects(t){return Array.from(t.getClientRects()).map(n=>{let r=new e(n);return r._source=t,r})}static getBoundingRect(t){let n={left:1/0,top:1/0,right:-1/0,bottom:-1/0,width:0,height:0},r=0;for(let e of t)r++,n.left=Math.min(n.left,e.left),n.top=Math.min(n.top,e.top),n.right=Math.max(n.right,e.right),n.bottom=Math.max(n.bottom,e.bottom);return r==0?null:(n.width=n.right-n.left,n.height=n.bottom-n.top,new e(n))}};function Fr(e,t){for(let n of Nr)e[n]=t[n]}function Ir(e){return Lr(e)?e===e.ownerDocument.body:!1}function Lr(e){return typeof e==`object`&&!!e&&e.nodeType===1&&typeof e.getBoundingClientRect==`function`}function Rr(e){return e.ownerDocument.defaultView.getComputedStyle(e).position}function zr(e){return e instanceof HTMLElement?e.ownerDocument.defaultView.getComputedStyle(e).overflow:`visible`}function Br(e){return e instanceof HTMLElement&&Pr.has(Rr(e))}function Vr(e,t){let n=new O(t),r=Dr(t),i=0,a=0;i-=n.left,a-=n.top,i+=t.scrollLeft,a+=t.scrollTop,i-=r.left,a-=r.top,e.moveBy(i,a)}var Hr=class e{_element;_callback;static _observerInstance=null;static _elementCallbacks=null;constructor(t,n){e._observerInstance||e._createObserver(),this._element=t,this._callback=n,e._addElementCallback(t,n),e._observerInstance.observe(t)}get element(){return this._element}destroy(){e._deleteElementCallback(this._element,this._callback)}static _addElementCallback(t,n){e._elementCallbacks||=new Map;let r=e._elementCallbacks.get(t);r||(r=new Set,e._elementCallbacks.set(t,r)),r.add(n)}static _deleteElementCallback(t,n){let r=e._getElementCallbacks(t);r&&(r.delete(n),r.size||(e._elementCallbacks.delete(t),e._observerInstance.unobserve(t))),e._elementCallbacks&&!e._elementCallbacks.size&&(e._observerInstance=null,e._elementCallbacks=null)}static _getElementCallbacks(t){return e._elementCallbacks?e._elementCallbacks.get(t):null}static _createObserver(){e._observerInstance=new u.window.ResizeObserver(t=>{for(let n of t){let t=e._getElementCallbacks(n.target);if(t)for(let e of t)e(n)}})}};function Ur(e,t){e instanceof HTMLTextAreaElement&&(e.value=t),e.innerHTML=t}function Wr(e){return t=>t+e}function Gr(e){let t=0;for(;e.previousSibling;)e=e.previousSibling,t++;return t}function Kr(e,t,n){e.insertBefore(n,e.childNodes[t]||null)}function qr(e){return e&&e.nodeType===Node.COMMENT_NODE}function Jr(e){try{u.document.createAttribute(e)}catch{return!1}return!0}function Yr(e){return e?jr(e)?Yr(e.parentElement):e.getClientRects?!!e.getClientRects().length:!1:!1}function Xr({element:e,target:t,positions:n,limiter:r,fitInViewport:i,viewportOffsetConfig:a}){An(t)&&(t=t()),An(r)&&(r=r());let o=Ar(e),s=Qr(a),c=new O(e),l=Zr(t,s),u;if(!l||!s.getIntersection(l))return null;let d={targetRect:l,elementRect:c,positionedElementAncestor:o,viewportRect:s};if(!r&&!i)u=new $r(n[0],d);else{if(r){let e=Zr(r,s);e&&(d.limiterRect=e)}u=vee(n,d)}return u}function Zr(e,t){let n=new O(e).getVisible();return n?n.getIntersection(t):null}function Qr(e){e=Object.assign({top:0,bottom:0,left:0,right:0},e);let t=new O(u.window);return t.top+=e.top,t.height-=e.top,t.bottom-=e.bottom,t.height-=e.bottom,t.left+=e.left,t.right-=e.right,t.width-=e.left+e.right,t}function vee(e,t){let{elementRect:n}=t,r=n.getArea(),i=e.map(e=>new $r(e,t)).filter(e=>!!e.name),a=0,o=null;for(let e of i){let{limiterIntersectionArea:t,viewportIntersectionArea:n}=e;if(t===r)return e;let i=n**2+t**2;i>a&&(a=i,o=e)}return o}var $r=class{name;config;_positioningFunctionCoordinates;_options;_cachedRect;_cachedAbsoluteRect;constructor(e,t){let n=e(t.targetRect,t.elementRect,t.viewportRect,t.limiterRect);if(!n)return;let{left:r,top:i,name:a,config:o}=n;this.name=a,this.config=o,this._positioningFunctionCoordinates={left:r,top:i},this._options=t}get left(){return this._absoluteRect.left}get top(){return this._absoluteRect.top}get limiterIntersectionArea(){let 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._options.elementRect.clone().moveTo(this._positioningFunctionCoordinates.left,this._positioningFunctionCoordinates.top),this._cachedRect}get _absoluteRect(){return this._cachedAbsoluteRect||=this._rect.toAbsoluteRect(),this._cachedAbsoluteRect}};function ei(e){let t=e.parentNode;t&&t.removeChild(e)}function ti(){let e=u.window.visualViewport;return!e||!(p.isiOS||p.isSafari)?{left:0,top:0}:{left:Math.max(Math.round(e.offsetLeft),0),top:Math.max(Math.round(e.offsetTop),0)}}function ni({target:e,viewportOffset:t=0,ancestorOffset:n=0,alignToTop:r,forceScroll:i}){let a=ui(e),o=a,s=null;for(t=pi(t);o;){let c;c=di(o==a?e:s),ai({parent:c,getRect:()=>fi(e,o),alignToTop:r,ancestorOffset:n,forceScroll:i});let l=fi(e,o),u=fi(c,o);if(l.height>u.height){let e=l.getIntersection(u);e&&(l=e)}if(ii({window:o,rect:l,viewportOffset:t,alignToTop:r,forceScroll:i}),o.parent!=o){if(s=o.frameElement,o=o.parent,!s)return}else o=null}}function ri(e,t,n,r,i){ai({parent:di(e),getRect:()=>new O(e),ancestorOffset:t,limiterElement:n,alignToTop:r,forceScroll:i})}function ii({window:e,rect:t,alignToTop:n,forceScroll:r,viewportOffset:i}){let a=t.clone().moveBy(0,i.bottom),o=t.clone().moveBy(0,-i.top),s=new O(e).excludeScrollbarsAndBorders(),c=[o,a],l=n&&r,u=c.every(e=>s.contains(e)),{scrollX:d,scrollY:f}=e,p=d,m=f;l?f-=s.top-t.top+i.top:u||(si(o,s)?f-=s.top-t.top+i.top:oi(a,s)&&(n?f+=t.top-s.top-i.top:f+=t.bottom-s.bottom+i.bottom)),u||(ci(t,s)?d-=s.left-t.left+i.left:li(t,s)&&(d+=t.right-s.right+i.right)),(d!=p||f!==m)&&e.scrollTo(d,f)}function ai({parent:e,getRect:t,alignToTop:n,forceScroll:r,ancestorOffset:i=0,limiterElement:a}){let o=ui(e),s=n&&r,c,l,u,d=a||o.document.body;for(;e!=d;)l=t(),c=new O(e).excludeScrollbarsAndBorders(),u=c.contains(l),s?e.scrollTop-=c.top-l.top+i:u||(si(l,c)?e.scrollTop-=c.top-l.top+i:oi(l,c)&&(n?e.scrollTop+=l.top-c.top-i:e.scrollTop+=l.bottom-c.bottom+i)),u||(ci(l,c)?e.scrollLeft-=c.left-l.left+i:li(l,c)&&(e.scrollLeft+=l.right-c.right+i)),e=e.parentNode}function oi(e,t){return e.bottom>t.bottom}function si(e,t){return e.top<t.top}function ci(e,t){return e.left<t.left}function li(e,t){return e.right>t.right}function ui(e){return Mr(e)?e.startContainer.ownerDocument.defaultView:e.ownerDocument.defaultView}function di(e){if(Mr(e)){let t=e.commonAncestorContainer;return jr(t)&&(t=t.parentNode),t}else return e.parentNode}function fi(e,t){let n=ui(e),r=new O(e);if(n===t)return r;{let e=n;for(;e!=t;){let t=e.frameElement,n=new O(t).excludeScrollbarsAndBorders();r.moveBy(n.left,n.top),e=e.parent}}return r}function pi(e){return typeof e==`number`?{top:e,bottom:e,left:e,right:e}:e}const mi={ctrl:`⌃`,cmd:`⌘`,alt:`⌥`,shift:`⇧`},hi={ctrl:`Ctrl+`,alt:`Alt+`,shift:`Shift+`},gi={37:`←`,38:`↑`,39:`→`,40:`↓`,9:`⇥`,33:`Page Up`,34:`Page Down`},k=yee(),_i=Object.fromEntries(Object.entries(k).map(([e,t])=>{let n;return n=t in gi?gi[t]:e.charAt(0).toUpperCase()+e.slice(1),[t,n]}));function vi(e){let t;if(typeof e==`string`){if(t=k[e.toLowerCase()],!t)throw new w(`keyboard-unknown-key`,null,{key:e})}else t=e.keyCode+(e.altKey?k.alt:0)+(e.ctrlKey?k.ctrl:0)+(e.shiftKey?k.shift:0)+(e.metaKey?k.cmd:0);return t}function yi(e){return typeof e==`string`&&(e=bee(e)),e.map(e=>typeof e==`string`?Ci(e):e).reduce((e,t)=>t+e,0)}function bi(e,t){let n=yi(e),r=t?t===`Mac`:p.isMac||p.isiOS;return Object.entries(r?mi:hi).reduce((e,[t,r])=>((n&k[t])!=0&&(n&=~k[t],e+=r),e),``)+(n?_i[n]:``)}function xi(e){return e==k.arrowright||e==k.arrowleft||e==k.arrowup||e==k.arrowdown}function Si(e,t){let n=t===`ltr`;switch(e){case k.arrowleft:return n?`left`:`right`;case k.arrowright:return n?`right`:`left`;case k.arrowup:return`up`;case k.arrowdown:return`down`}}function Ci(e){if(e.endsWith(`!`))return vi(e.slice(0,-1));let t=vi(e);return(p.isMac||p.isiOS)&&t==k.ctrl?k.cmd:t}function wi(e,t){let n=Si(e,t);return n===`down`||n===`right`}function yee(){let 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++){let n=String.fromCharCode(t);e[n.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}function bee(e){return e.split(`+`).map(e=>e.trim())}const xee=[`ar`,`ara`,`dv`,`div`,`fa`,`per`,`fas`,`he`,`heb`,`ku`,`kur`,`ug`,`uig`,`ur`,`urd`];function Ti(e){return xee.includes(e)?`rtl`:`ltr`}function A(e){return Array.isArray(e)?e:[e]}u.window.CKEDITOR_TRANSLATIONS||(u.window.CKEDITOR_TRANSLATIONS={});function Ei(e,t,n){u.window.CKEDITOR_TRANSLATIONS[e]||(u.window.CKEDITOR_TRANSLATIONS[e]={});let r=u.window.CKEDITOR_TRANSLATIONS[e];r.dictionary=r.dictionary||{},r.getPluralForm=n||r.getPluralForm,Object.assign(r.dictionary,t)}function Di(e,t,n=1,r){if(typeof n!=`number`)throw new w(`translation-service-quantity-not-a-number`,null,{quantity:n});let i=r||u.window.CKEDITOR_TRANSLATIONS,a=ji(i);a===1&&(e=Object.keys(i)[0]);let o=t.id||t.string;if(a===0||!Ai(e,o,i))return n===1?t.string:t.plural;let s=i[e].dictionary,c=i[e].getPluralForm||(e=>e===1?0:1),l=s[o];return typeof l==`string`?l:l[Number(c(n))]}function Oi(){u.window.CKEDITOR_TRANSLATIONS&&(u.window.CKEDITOR_TRANSLATIONS={})}function ki(e){return Array.isArray(e)?e.reduce((e,t)=>wn(e,t)):e}function Ai(e,t,n){return!!n[e]&&!!n[e].dictionary[t]}function ji(e){return Object.keys(e).length}var Mi=class{uiLanguage;uiLanguageDirection;contentLanguage;contentLanguageDirection;t;translations;constructor({uiLanguage:e=`en`,contentLanguage:t,translations:n}={}){this.uiLanguage=e,this.contentLanguage=t||this.uiLanguage,this.uiLanguageDirection=Ti(this.uiLanguage),this.contentLanguageDirection=Ti(this.contentLanguage),this.translations=ki(n),this.t=(e,t)=>this._t(e,t)}_t(e,t=[]){t=A(t),typeof e==`string`&&(e={string:e});let n=e.plural?t[0]:1;return Ni(Di(this.uiLanguage,e,n,this.translations),t)}};function Ni(e,t){return e.replace(/%(\d+)/g,(e,n)=>n<t.length?t[n]:e)}const Pi=E();var Fi=class extends Pi{_items;_itemMap;_idProperty;_bindToCollection;_bindToExternalToInternalMap;_bindToInternalToExternalMap;_skippedIndexesFromExternal;constructor(e={},t={}){super();let n=pr(e);if(n||(t=e),this._items=[],this._itemMap=new Map,this._idProperty=t.idProperty||`id`,this._bindToExternalToInternalMap=new WeakMap,this._bindToInternalToExternalMap=new WeakMap,this._skippedIndexesFromExternal=[],n)for(let 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(t===void 0)t=this._items.length;else if(t>this._items.length||t<0)throw new w(`collection-add-item-invalid-index`,this);let n=0;for(let r of e){let e=this._getItemIdBeforeAdding(r),i=t+n;this._items.splice(i,0,r),this._itemMap.set(e,r),this.fire(`add`,r,i),n++}return this.fire(`change`,{added:e,removed:[],index:t}),this}get(e){let t;if(typeof e==`string`)t=this._itemMap.get(e);else if(typeof e==`number`)t=this._items[e];else throw new w(`collection-get-invalid-arg`,this);return t||null}has(e){if(typeof e==`string`)return this._itemMap.has(e);{let t=e[this._idProperty];return t&&this._itemMap.has(t)}}getIndex(e){let t;return t=typeof e==`string`?this._itemMap.get(e):e,t?this._items.indexOf(t):-1}remove(e){let[t,n]=this._remove(e);return this.fire(`change`,{added:[],removed:[t],index:n}),t}map(e,t){return this._items.map(e,t)}forEach(e,t){this._items.forEach(e,t)}find(e,t){return this._items.find(e,t)}filter(e,t){return this._items.filter(e,t)}clear(){this._bindToCollection&&=(this.stopListening(this._bindToCollection),null);let 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 w(`collection-bind-to-rebind`,this);return this._bindToCollection=e,{as:e=>{this._setUpBindToBinding(t=>new e(t))},using:e=>{typeof e==`function`?this._setUpBindToBinding(e):this._setUpBindToBinding(t=>t[e])}}}_setUpBindToBinding(e){let t=this._bindToCollection,n=(n,r,i)=>{let a=t._bindToCollection==this,o=t._bindToInternalToExternalMap.get(r);if(a&&o)this._bindToExternalToInternalMap.set(r,o),this._bindToInternalToExternalMap.set(o,r);else{let n=e(r);if(!n){this._skippedIndexesFromExternal.push(i);return}let a=i;for(let e of this._skippedIndexesFromExternal)i>e&&a--;for(let e of t._skippedIndexesFromExternal)a>=e&&a++;this._bindToExternalToInternalMap.set(r,n),this._bindToInternalToExternalMap.set(n,r),this.add(n,a);for(let e=0;e<t._skippedIndexesFromExternal.length;e++)a<=t._skippedIndexesFromExternal[e]&&t._skippedIndexesFromExternal[e]++}};for(let e of t)n(null,e,t.getIndex(e));this.listenTo(t,`add`,n),this.listenTo(t,`remove`,(e,t,n)=>{let r=this._bindToExternalToInternalMap.get(t);r&&this.remove(r),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce((e,t)=>(n<t&&e.push(t-1),n>t&&e.push(t),e),[])})}_getItemIdBeforeAdding(e){let t=this._idProperty,n;if(t in e){if(n=e[t],typeof n!=`string`)throw new w(`collection-add-invalid-id`,this);if(this.get(n))throw new w(`collection-add-item-already-exists`,this)}else e[t]=n=he();return n}_remove(e){let t,n,r,i=!1,a=this._idProperty;if(typeof e==`string`?(n=e,r=this._itemMap.get(n),i=!r,r&&(t=this._items.indexOf(r))):typeof e==`number`?(t=e,r=this._items[t],i=!r,r&&(n=r[a])):(r=e,n=r[a],t=this._items.indexOf(r),i=t==-1||!this._itemMap.get(n)),i)throw new w(`collection-remove-404`,this);this._items.splice(t,1),this._itemMap.delete(n);let o=this._bindToInternalToExternalMap.get(r);return this._bindToInternalToExternalMap.delete(r),this._bindToExternalToInternalMap.delete(o),this.fire(`remove`,r,t),[r,t]}[Symbol.iterator](){return this._items[Symbol.iterator]()}};function j(e){let t=e.next();return t.done?null:t.value}function Ii(e,t){for(let n of t){if(e===0)return n;--e}return null}const Li=br(D());var M=class extends Li{_elements=new Set;_externalViews=new Set;_blurTimeout=null;constructor(){super(),this.set(`isFocused`,!1),this.set(`focusedElement`,null)}get elements(){return Array.from(this._elements.values())}get externalViews(){return Array.from(this._externalViews.values())}add(e){if(zi(e))this._addElement(e);else if(Ri(e))this._addView(e);else{if(!e.element)throw new w(`focustracker-add-view-missing-element`,{focusTracker:this,view:e});this._addElement(e.element)}}remove(e){zi(e)?this._removeElement(e):Ri(e)?this._removeView(e):this._removeElement(e.element)}_addElement(e){if(this._elements.has(e))throw new w(`focustracker-add-element-already-exist`,this);this.listenTo(e,`focus`,()=>{let t=this.externalViews.find(t=>Bi(e,t));t?this._focus(t.element):this._focus(e)},{useCapture:!0}),this.listenTo(e,`blur`,()=>{this._blur()},{useCapture:!0}),this._elements.add(e)}_removeElement(e){this._elements.has(e)&&(this.stopListening(e),this._elements.delete(e)),e===this.focusedElement&&this._blur()}_addView(e){e.element&&this._addElement(e.element),this.listenTo(e.focusTracker,`change:focusedElement`,()=>{e.focusTracker.focusedElement?e.element&&this._focus(e.element):this._blur()}),this._externalViews.add(e)}_removeView(e){e.element&&this._removeElement(e.element),this.stopListening(e.focusTracker),this._externalViews.delete(e)}destroy(){this.stopListening(),this._elements.clear(),this._externalViews.clear(),this.isFocused=!1,this.focusedElement=null}_focus(e){this._clearBlurTimeout(),this.focusedElement=e,this.isFocused=!0}_blur(){this.elements.find(e=>e.contains(document.activeElement))||this.externalViews.find(e=>e.focusTracker.isFocused&&!e.focusTracker._blurTimeout)||(this._clearBlurTimeout(),this._blurTimeout=setTimeout(()=>{this.focusedElement=null,this.isFocused=!1},0))}_clearBlurTimeout(){clearTimeout(this._blurTimeout),this._blurTimeout=null}};function Ri(e){return`focusTracker`in e&&e.focusTracker instanceof M}function zi(e){return jn(e)}function Bi(e,t){return Vi(e,t)?!0:!!t.focusTracker.externalViews.find(t=>Vi(e,t))}function Vi(e,t){return!!t.element&&t.element.contains(document.activeElement)&&e.contains(t.element)}var N=class{_listener;constructor(){this._listener=new(br())}listenTo(e){this._listener.listenTo(e,`keydown`,(e,t)=>{this._listener.fire(`_keydown:`+vi(t),t)})}set(e,t,n={}){let r=yi(e),i=n.priority;this._listener.listenTo(this._listener,`_keydown:`+r,(e,r)=>{n.filter&&!n.filter(r)||(t(r,()=>{r.preventDefault(),r.stopPropagation(),e.stop()}),e.return=!0)},{priority:i})}press(e){return!!this._listener.fire(`_keydown:`+vi(e),e)}stopListening(e){this._listener.stopListening(e)}destroy(){this.stopListening()}};function Hi(e){let t=new Map;for(let n in e)t.set(n,e[n]);return t}function Ui(e){return pr(e)?new Map(e):Hi(e)}function Wi(e,t){if(e.size!=t.size)return!1;for(let n of e.entries())if(JSON.stringify(n[1])!==JSON.stringify(t.get(n[0])))return!1;return!0}function Gi(e,t={}){return new Promise((n,r)=>{let i=t.signal||new AbortController().signal;i.throwIfAborted();let a=setTimeout(o,e);i.addEventListener(`abort`,s,{once:!0});function o(){i.removeEventListener(`abort`,s),n()}function s(){clearTimeout(a),r(i.reason)}})}async function Ki(e,t={}){let{maxAttempts:n=4,retryDelay:r=qi(),signal:i=new AbortController().signal}=t;i.throwIfAborted();for(let t=0;;t++){try{return await e()}catch(e){if(t+1>=n)throw e}await Gi(r(t),{signal:i})}}function qi(e={}){let{delay:t=1e3,factor:n=2,maxDelay:r=1e4}=e;return e=>Math.min(n**e*t,r)}function Ji(e,t,n){let r=e.length,i=t.length;for(let t=r-1;t>=n;t--)e[t+i]=e[t];for(let r=0;r<i;r++)e[n+r]=t[r]}function Yi(e,t){let n;function r(...i){r.cancel(),n=setTimeout(()=>e(...i),t)}return r.cancel=()=>{clearTimeout(n)},r}function Xi(e){try{if(!e.startsWith(`ey`))return null;let t=atob(e.replace(/-/g,`+`).replace(/_/g,`/`));return JSON.parse(t)}catch{return null}}function See(){let e=[];for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)n&1?n=3988292384^n>>>1:n>>>=1;e[t]=n}return e}function Zi(e){let t=Array.isArray(e)?e:[e],n=See(),r=-1,i=t.map(e=>Array.isArray(e)?e.join(``):String(e)).join(``);for(let e=0;e<i.length;e++){let t=i.charCodeAt(e);r=r>>>8^n[(r^t)&255]}return r=(r^-1)>>>0,r.toString(16).padStart(8,`0`)}async function Cee(e){return e?(await Promise.all(e.map(async e=>e===`EDITOR_STYLES`?wee():(await window.fetch(e)).text()))).join(` `).trim():``}function wee(){let e=[],t=[];for(let n of Array.from(document.styleSheets))if(n.ownerNode.hasAttribute(`data-cke`))for(let r of Array.from(n.cssRules))r.cssText.indexOf(`.ck-content`)===-1?r.cssText.indexOf(`:root`)!==-1&&t.push(r.cssText):e.push(r.cssText);return 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.`),[...t,...e].join(` `).trim()}function Qi(e){let t=[{name:`address`,isVoid:!1},{name:`article`,isVoid:!1},{name:`aside`,isVoid:!1},{name:`blockquote`,isVoid:!1},{name:`details`,isVoid:!1},{name:`dialog`,isVoid:!1},{name:`dd`,isVoid:!1},{name:`div`,isVoid:!1},{name:`dl`,isVoid:!1},{name:`dt`,isVoid:!1},{name:`fieldset`,isVoid:!1},{name:`figcaption`,isVoid:!1},{name:`figure`,isVoid:!1},{name:`footer`,isVoid:!1},{name:`form`,isVoid:!1},{name:`h1`,isVoid:!1},{name:`h2`,isVoid:!1},{name:`h3`,isVoid:!1},{name:`h4`,isVoid:!1},{name:`h5`,isVoid:!1},{name:`h6`,isVoid:!1},{name:`header`,isVoid:!1},{name:`hgroup`,isVoid:!1},{name:`hr`,isVoid:!0},{name:`li`,isVoid:!1},{name:`main`,isVoid:!1},{name:`nav`,isVoid:!1},{name:`ol`,isVoid:!1},{name:`p`,isVoid:!1},{name:`section`,isVoid:!1},{name:`table`,isVoid:!1},{name:`tbody`,isVoid:!1},{name:`td`,isVoid:!1},{name:`th`,isVoid:!1},{name:`thead`,isVoid:!1},{name:`tfoot`,isVoid:!1},{name:`tr`,isVoid:!1},{name:`ul`,isVoid:!1}],n=t.map(e=>e.name).join(`|`),r=e.replace(RegExp(`</?(${n})( .*?)?>`,`g`),`
$&
`).replace(/<br[^>]*>/g,`$&
`).split(`
`),i=0,a=!1;return r.map(e=>(a=Dee(e,a),!e.length&&!a?``:Tee(e,t)?$i(e,i++):Eee(e,t)?$i(e,--i):a===`middle`||a===`last`?$i(e,0):$i(e,i))).join(``).trimEnd()}function Tee(e,t){return t.some(t=>!(t.isVoid||!RegExp(`<${t.name}( .*?)?>`).test(e)))}function Eee(e,t){return t.some(t=>RegExp(`</${t.name}>`).test(e))}function $i(e,t,n=` `){return`${n.repeat(Math.max(0,t))}${e}\n`}function Dee(e,t){let n=/<pre( .*?)?>/.test(e),r=/<\/pre>/.test(e);return n&&r?!1:n?`first`:r?`last`:t===`first`||t===`middle`?`middle`:!1}function ea(e){return!!e&&e.length==1&&/[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/.test(e)}function ta(e){return!!e&&e.length==1&&/[\ud800-\udbff]/.test(e)}function na(e){return!!e&&e.length==1&&/[\udc00-\udfff]/.test(e)}function ra(e,t){return ta(e.charAt(t-1))&&na(e.charAt(t))}function ia(e,t){return ea(e.charAt(t))}const aa=sa();function oa(e,t){let n=String(e).matchAll(aa);return Array.from(n).some(e=>e.index<t&&t<e.index+e[0].length)}function sa(){let e=[/\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],t=/\p{Regional_Indicator}{2}/u.source,n=`(?:`+e.map(e=>e.source).join(`|`)+`)`,r=`${t}|${n}(?:\u{200D}${n})*`;return new RegExp(r,`ug`)}function ca(e){if(!e)return null;let t=la(e);return t?Xi(t):null}function la(e){let t=e.split(`.`);return t.length==3?t[1]:null}function ua(e,t){return(e.removeFeatures||[]).includes(t)}function da(e){if(!e)return null;let[,t,n]=e.trim().match(/([.,\d]+)(%|px)$/)||[],r=Number.parseFloat(t);return Number.isNaN(r)?null:{value:r,unit:n}}function fa(e,t,n){return n===`px`?{value:t.value,unit:`px`}:{value:t.value/e*100,unit:`%`}}var pa=class extends Fi{_parentElement;constructor(e=[]){super(e,{idProperty:`viewUid`}),this.on(`add`,(e,t,n)=>{this._renderViewIntoCollectionParent(t,n)}),this.on(`remove`,(e,t)=>{t.element&&this._parentElement&&t.element.remove()}),this._parentElement=null}destroy(){this.map(e=>e.destroy())}setParent(e){this._parentElement=e;for(let e of this)this._renderViewIntoCollectionParent(e)}delegate(...e){if(!e.length||!ma(e))throw new w(`ui-viewcollection-delegate-wrong-events`,this);return{to:t=>{for(let n of this)for(let r of e)n.delegate(r).to(t);this.on(`add`,(n,r)=>{for(let n of e)r.delegate(n).to(t)}),this.on(`remove`,(n,r)=>{for(let n of e)r.stopDelegating(n,t)})}}}_renderViewIntoCollectionParent(e,t){e.isRendered||e.render(),e.element&&this._parentElement&&this._parentElement.insertBefore(e.element,this._parentElement.children[t])}remove(e){return super.remove(e)}};function ma(e){return e.every(e=>typeof e==`string`)}const ha=E();var ga=class extends ha{ns;tag;text;attributes;children;eventListeners;_isRendered;_revertData;constructor(e){super(),Object.assign(this,Oa(Da(e))),this._isRendered=!1,this._revertData=null}render(){let e=this._renderNode({intoFragment:!0});return this._isRendered=!0,e}apply(e){return this._revertData=Ha(),this._renderNode({node:e,intoFragment:!1,isApplying:!0,revertData:this._revertData}),e}revert(e){if(!this._revertData)throw new w(`ui-template-revert-not-applied`,[this,e]);this._revertTemplateFromNode(e,this._revertData)}*getViews(){function*e(t){if(t.children)for(let n of t.children)Ra(n)?yield n:za(n)&&(yield*e(n))}yield*e(this)}static bind(e,t){return{to(n,r){return new va({eventNameOrFunction:n,attribute:n,observable:e,emitter:t,callback:r})},if(n,r,i){return new ya({observable:e,emitter:t,attribute:n,valueIfTrue:r,callback:i})}}}static extend(e,t){if(e._isRendered)throw new w(`template-extend-render`,[this,e]);Ia(e,Oa(Da(t)))}_renderNode(e){let t;if(t=e.node?this.tag&&this.text:this.tag?this.text:!this.text,t)throw new w(`ui-template-wrong-syntax`,this);return this.text?this._renderText(e):this._renderElement(e)}_renderElement(e){let t=e.node;return 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(``),ba(this.text)?this._bindToObservable({schema:this.text,updater:wa(t),data:e}):t.textContent=this.text.join(``),t}_renderAttributes(e){if(!this.attributes)return;let t=e.node,n=e.revertData;for(let r in this.attributes){let i=t.getAttribute(r),a=this.attributes[r];n&&(n.attributes[r]=i);let o=Va(a)?a[0].ns:null;if(ba(a)){let s=Va(a)?a[0].value:a;n&&Ua(r)&&s.unshift(i),this._bindToObservable({schema:s,updater:Ta(t,r,o),data:e})}else if(r==`style`&&typeof a[0]!=`string`)this._renderStyleAttribute(a[0],e);else{n&&i&&Ua(r)&&a.unshift(i);let e=a.map(e=>e&&(e.value||e)).reduce((e,t)=>e.concat(t),[]).reduce(Pa,``);La(e)||t.setAttributeNS(o,r,e)}}}_renderStyleAttribute(e,t){let n=t.node;for(let r in e){let i=e[r];ba(i)?this._bindToObservable({schema:[i],updater:Ea(n,r),data:t}):xa(r)?n.style.setProperty(r,i):n.style[r]=i}}_renderElementChildren(e){let t=e.node,n=e.intoFragment?document.createDocumentFragment():t,r=e.isApplying,i=0;for(let a of this.children)if(Ba(a)){if(!r){a.setParent(t);for(let e of a)n.appendChild(e.element)}}else if(Ra(a))r||(a.isRendered||a.render(),n.appendChild(a.element));else if(vr(a))n.appendChild(a);else if(r){let t=e.revertData,r=Ha();t.children.push(r),a._renderNode({intoFragment:!1,node:n.childNodes[i++],isApplying:!0,revertData:r})}else n.appendChild(a.render());e.intoFragment&&t.appendChild(n)}_setUpListeners(e){if(this.eventListeners)for(let t in this.eventListeners){let n=this.eventListeners[t].map(n=>{let[r,i]=t.split(`@`);return n.activateDomEventListener(r,i,e)});e.revertData&&e.revertData.bindings.push(n)}}_bindToObservable({schema:e,updater:t,data:n}){let r=n.revertData;Ca(e,t,n);let i=e.filter(e=>!La(e)).filter(e=>e.observable).map(r=>r.activateAttributeListener(e,t,n));r&&r.bindings.push(i)}_revertTemplateFromNode(e,t){for(let e of t.bindings)for(let t of e)t();if(t.text){e.textContent=t.text;return}let n=e;for(let e in t.attributes){let r=t.attributes[e];r===null?n.removeAttribute(e):n.setAttribute(e,r)}for(let e=0;e<t.children.length;++e)this._revertTemplateFromNode(n.childNodes[e],t.children[e])}},_a=class{attribute;observable;emitter;callback;constructor(e){this.attribute=e.attribute,this.observable=e.observable,this.emitter=e.emitter,this.callback=e.callback}getValue(e){let t=this.observable[this.attribute];return this.callback?this.callback(t,e):t}activateAttributeListener(e,t,n){let r=()=>Ca(e,t,n);return this.emitter.listenTo(this.observable,`change:${this.attribute}`,r),()=>{this.emitter.stopListening(this.observable,`change:${this.attribute}`,r)}}},va=class extends _a{eventNameOrFunction;constructor(e){super(e),this.eventNameOrFunction=e.eventNameOrFunction}activateDomEventListener(e,t,n){let r=(e,n)=>{(!t||n.target.matches(t))&&(typeof this.eventNameOrFunction==`function`?this.eventNameOrFunction(n):this.observable.fire(this.eventNameOrFunction,n))};return this.emitter.listenTo(n.node,e,r),()=>{this.emitter.stopListening(n.node,e,r)}}},ya=class extends _a{valueIfTrue;constructor(e){super(e),this.valueIfTrue=e.valueIfTrue}getValue(e){return La(super.getValue(e))?!1:this.valueIfTrue||!0}};function ba(e){return e?(e.value&&(e=e.value),Array.isArray(e)?e.some(ba):e instanceof _a):!1}function xa(e){return/^--[a-zA-Z_-][\w-]*$/.test(e)}function Sa(e,t){return e.map(e=>e instanceof _a?e.getValue(t):e)}function Ca(e,t,{node:n}){let r=Sa(e,n),i;i=e.length==1&&e[0]instanceof ya?r[0]:r.reduce(Pa,``),La(i)?t.remove():t.set(i)}function wa(e){return{set(t){e.textContent=t},remove(){e.textContent=``}}}function Ta(e,t,n){return{set(r){e.setAttributeNS(n,t,r)},remove(){e.removeAttributeNS(n,t)}}}function Ea(e,t){return{set(n){xa(t)?e.style.setProperty(t,n):e.style[t]=n},remove(){xa(t)?e.style.removeProperty(t):e.style[t]=null}}}function Da(e){return Lt(e,e=>{if(e&&(e instanceof _a||za(e)||Ra(e)||Ba(e)))return e})}function Oa(e){if(typeof e==`string`?e=ja(e):e.text&&Ma(e),e.on&&(e.eventListeners=Aa(e.on),delete e.on),!e.text){e.attributes&&ka(e.attributes);let t=[];if(e.children)if(Ba(e.children))t.push(e.children);else for(let n of e.children)za(n)||Ra(n)||vr(n)?t.push(n):t.push(new ga(n));e.children=t}return e}function ka(e){for(let t in e)e[t].value&&(e[t].value=A(e[t].value)),Na(e,t)}function Aa(e){for(let t in e)Na(e,t);return e}function ja(e){return{text:[e]}}function Ma(e){e.text=A(e.text)}function Na(e,t){e[t]=A(e[t])}function Pa(e,t){return La(t)?e:La(e)?t:`${e} ${t}`}function Fa(e,t){for(let n in t)e[n]?e[n].push(...t[n]):e[n]=t[n]}function Ia(e,t){if(t.attributes&&(e.attributes||={},Fa(e.attributes,t.attributes)),t.eventListeners&&(e.eventListeners||={},Fa(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 w(`ui-template-extend-children-mismatch`,e);let n=0;for(let r of t.children)Ia(e.children[n++],r)}}function La(e){return!e&&e!==0}function Ra(e){return e instanceof P}function za(e){return e instanceof ga}function Ba(e){return e instanceof pa}function Va(e){return Xe(e[0])&&e[0].ns}function Ha(){return{children:[],bindings:[],attributes:{}}}function Ua(e){return e==`class`||e==`style`}const Wa=br(D());var P=class extends Wa{element;isRendered;locale;t;template;_viewCollections;_unboundChildren;_bindTemplate;constructor(e){super(),this.element=null,this.isRendered=!1,this.locale=e,this.t=e&&e.t,this._viewCollections=new Fi,this._unboundChildren=this.createCollection(),this._viewCollections.on(`add`,(t,n)=>{n.locale=e,n.t=e&&e.t}),this.decorate(`render`)}get bindTemplate(){return this._bindTemplate?this._bindTemplate:this._bindTemplate=ga.bind(this,this)}createCollection(e){let t=new pa(e);return this._viewCollections.add(t),t}registerChild(e){pr(e)||(e=[e]);for(let t of e)this._unboundChildren.add(t)}deregisterChild(e){pr(e)||(e=[e]);for(let t of e)this._unboundChildren.remove(t)}setTemplate(e){this.template=new ga(e)}extendTemplate(e){ga.extend(this.template,e)}render(){if(this.isRendered)throw new w(`ui-view-render-already-rendered`,this);this.template&&(this.element=this.template.render(),this.registerChild(this.template.getViews())),this.isRendered=!0}destroy(){this.stopListening(),this._viewCollections.map(e=>e.destroy()),this.template&&this.template._revertData&&this.template.revert(this.element)}};const Ga={POLITE:`polite`,ASSERTIVE:`assertive`};var Ka=class{editor;view;constructor(e){this.editor=e,e.once(`ready`,()=>{for(let e of Object.values(Ga))this.announce(``,e)})}announce(e,t=Ga.POLITE){let n=this.editor;if(!n.ui.view)return;this.view||(this.view=new qa(n.locale),n.ui.view.body.add(this.view));let{politeness:r,isUnsafeHTML:i}=typeof t==`string`?{politeness:t}:t,a=this.view.regionViews.find(e=>e.politeness===r);a||(a=new Ja(n,r),this.view.regionViews.add(a)),a.announce({announcement:e,isUnsafeHTML:i})}},qa=class extends P{regionViews;constructor(e){super(e),this.regionViews=this.createCollection(),this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-aria-live-announcer`]},children:this.regionViews})}},Ja=class extends P{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`,()=>{this._pruneAnnouncementsInterval!==null&&(clearInterval(this._pruneAnnouncementsInterval),this._pruneAnnouncementsInterval=null)}),this.politeness=t,this._domConverter=e.data.htmlProcessor.domConverter,this._pruneAnnouncementsInterval=setInterval(()=>{this.element&&this._listElement.firstChild&&this._listElement.firstChild.remove()},5e3)}announce({announcement:e,isUnsafeHTML:t}){if(!e.trim().length)return;let n=document.createElement(`li`);t?this._domConverter.setContentOf(n,e):n.innerText=e,this._listElement.appendChild(n)}get _listElement(){return this.element.querySelector(`ul`)}};function Ya({emitter:e,activator:t,callback:n,contextElements:r,listenerOptions:i}){e.listenTo(document,`mousedown`,(e,i)=>{if(!t())return;let a=typeof i.composedPath==`function`?i.composedPath():[],o=typeof r==`function`?r():r;for(let e of o)if(e.contains(i.target)||a.includes(e))return;n()},i)}function Xa(e){class t extends e{disableCssTransitions(){this._isCssTransitionsDisabled=!0}enableCssTransitions(){this._isCssTransitionsDisabled=!1}constructor(...e){super(...e),this.set(`_isCssTransitionsDisabled`,!1),this.initializeCssTransitionDisablerMixin()}initializeCssTransitionDisablerMixin(){this.template&&this.extendTemplate({attributes:{class:[this.bindTemplate.if(`_isCssTransitionsDisabled`,`ck-transitions-disabled`)]}})}}return t}function Za(e){class t extends e{_onDragBound=this._onDrag.bind(this);_onDragEndBound=this._onDragEnd.bind(this);_lastDraggingCoordinates={x:0,y:0};constructor(...e){super(...e),this.on(`render`,()=>{this._attachListeners()}),this.set(`isDragging`,!1)}_attachListeners(){this.listenTo(this.element,`mousedown`,this._onDragStart.bind(this)),this.listenTo(this.element,`touchstart`,this._onDragStart.bind(this))}_attachDragListeners(){this.listenTo(u.document,`mouseup`,this._onDragEndBound),this.listenTo(u.document,`touchend`,this._onDragEndBound),this.listenTo(u.document,`mousemove`,this._onDragBound),this.listenTo(u.document,`touchmove`,this._onDragBound)}_detachDragListeners(){this.stopListening(u.document,`mouseup`,this._onDragEndBound),this.stopListening(u.document,`touchend`,this._onDragEndBound),this.stopListening(u.document,`mousemove`,this._onDragBound),this.stopListening(u.document,`touchmove`,this._onDragBound)}_onDragStart(e,t){if(!this._isHandleElementPressed(t))return;this._attachDragListeners();let n=0,r=0;t instanceof MouseEvent?(n=t.clientX,r=t.clientY):(n=t.touches[0].clientX,r=t.touches[0].clientY),this._lastDraggingCoordinates={x:n,y:r},this.isDragging=!0}_onDrag(e,t){if(!this.isDragging){this._detachDragListeners();return}let n=0,r=0;t instanceof MouseEvent?(n=t.clientX,r=t.clientY):(n=t.touches[0].clientX,r=t.touches[0].clientY),t.preventDefault(),this.fire(`drag`,{deltaX:Math.round(n-this._lastDraggingCoordinates.x),deltaY:Math.round(r-this._lastDraggingCoordinates.y)}),this._lastDraggingCoordinates={x:n,y:r}}_onDragEnd(){this._detachDragListeners(),this.isDragging=!1}_isHandleElementPressed(e){return this.dragHandleElement?this.dragHandleElement===e.target||e.target instanceof HTMLElement&&this.dragHandleElement.contains(e.target):!1}}return t}function Qa({view:e}){e.listenTo(e.element,`submit`,(t,n)=>{n.preventDefault(),e.fire(`submit`)},{useCapture:!0})}function $a({keystrokeHandler:e,focusTracker:t,gridItems:n,numberOfColumns:r,uiLanguageDirection:i}){let a=typeof r==`number`?()=>r:r;e.set(`arrowright`,o((e,t)=>i===`rtl`?c(e,t.length):s(e,t.length))),e.set(`arrowleft`,o((e,t)=>i===`rtl`?s(e,t.length):c(e,t.length))),e.set(`arrowup`,o((e,t)=>{let n=e-a();return n<0&&(n=e+a()*Math.floor(t.length/a()),n>t.length-1&&(n-=a())),n})),e.set(`arrowdown`,o((e,t)=>{let n=e+a();return n>t.length-1&&(n=e%a()),n}));function o(e){return r=>{let i=n.find(e=>e.element===t.focusedElement),a=e(n.getIndex(i),n);n.get(a).focus(),r.stopPropagation(),r.preventDefault()}}function s(e,t){return e===t-1?0:e+1}function c(e,t){return e===0?t-1:e-1}}var eo=class extends P{id;constructor(e){super(e),this.set(`text`,void 0),this.set(`for`,void 0),this.id=`ck-editor__label_${he()}`;let t=this.bindTemplate;this.setTemplate({tag:`label`,attributes:{class:[`ck`,`ck-label`],id:this.id,for:t.to(`for`)},children:[{text:t.to(`text`)}]})}},to=class extends P{constructor(e,t){super(e);let n=e.t,r=new eo;r.text=n(`Help Contents. To close this dialog press ESC.`),this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-accessibility-help-dialog__content`],"aria-labelledby":r.id,role:`document`,tabindex:-1},children:[mr(document,`p`,{},n(`Below, you can find a list of keyboard shortcuts that can be used in the editor.`)),...this._createCategories(Array.from(t.values())),r]})}focus(){this.element.focus()}_createCategories(e){return e.map(e=>{let t=[mr(document,`h3`,{},e.label),...Array.from(e.groups.values()).map(e=>this._createGroup(e)).flat()];return e.description&&t.splice(1,0,mr(document,`p`,{},e.description)),mr(document,`section`,{},t)})}_createGroup(e){let t=e.keystrokes.sort((e,t)=>e.label.localeCompare(t.label)).map(e=>this._createGroupRow(e)).flat(),n=[mr(document,`dl`,{},t)];return e.label&&n.unshift(mr(document,`h4`,{},e.label)),n}_createGroupRow(e){let t=this.locale.t,n=mr(document,`dt`),r=mr(document,`dd`),i=ro(e.keystroke),a=[];for(let e of i)a.push(e.map(no).join(``));return n.innerHTML=e.label,r.innerHTML=a.join(`, `)+(e.mayRequireFn&&p.isMac?` ${t(`(may require <kbd>Fn</kbd>)`)}`:``),[n,r]}};function no(e){return bi(e).split(`+`).map(e=>`<kbd>${e}</kbd>`).join(`+`)}function ro(e){return typeof e==`string`?[[e]]:typeof e[0]==`string`?[e]:e}const io=D();var F=class extends io{editor;_disableStack=new Set;constructor(e){super(),this.editor=e,this.set(`isEnabled`,!0)}forceDisabled(e){this._disableStack.add(e),this._disableStack.size==1&&(this.on(`set:isEnabled`,ao,{priority:`highest`}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),this._disableStack.size==0&&(this.off(`set:isEnabled`,ao),this.isEnabled=!0)}destroy(){this.stopListening()}static get isContextPlugin(){return!1}static get isOfficialPlugin(){return!1}static get isPremiumPlugin(){return!1}};function ao(e){e.return=!1,e.stop()}const oo=D();var I=class extends oo{editor;_isEnabledBasedOnSelection;_affectsData;_disableStack;static get _throwErrorWhenUsedAsAPlugin(){return!0}constructor(e){super(),this.editor=e,this.set(`value`,void 0),this.set(`isEnabled`,!1),this._affectsData=!0,this._isEnabledBasedOnSelection=!0,this._disableStack=new Set,this.decorate(`execute`),this.listenTo(this.editor.model.document,`change`,()=>{this.refresh()}),this.listenTo(e,`change:isReadOnly`,()=>{this.refresh()}),this.on(`set:isEnabled`,t=>{if(!this.affectsData)return;let n=e.model.document.selection,r=n.getFirstPosition().root.rootName!=`$graveyard`&&e.model.canEditAt(n);(e.isReadOnly||this._isEnabledBasedOnSelection&&!r)&&(t.return=!1,t.stop())},{priority:`highest`}),this.on(`execute`,e=>{this.isEnabled||e.stop()},{priority:`high`})}get affectsData(){return this._affectsData}set affectsData(e){this._affectsData=e}refresh(){this.isEnabled=!0}forceDisabled(e){this._disableStack.add(e),this._disableStack.size==1&&(this.on(`set:isEnabled`,so,{priority:`highest`}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),this._disableStack.size==0&&(this.off(`set:isEnabled`,so),this.refresh())}execute(...e){}destroy(){this.stopListening()}};function so(e){e.return=!1,e.stop()}var co=class extends I{_childCommandsDefinitions=[];refresh(){}execute(...e){let t=this._getFirstEnabledCommand();return!!t&&t.execute(e)}registerChildCommand(e,t={}){_e(this._childCommandsDefinitions,{command:e,priority:t.priority||`normal`}),e.on(`change:isEnabled`,()=>this._checkEnabled()),this._checkEnabled()}_checkEnabled(){this.isEnabled=!!this._getFirstEnabledCommand()}_getFirstEnabledCommand(){let e=this._childCommandsDefinitions.find(({command:e})=>e.isEnabled);return e&&e.command}},lo=class{_commands;constructor(){this._commands=new Map}add(e,t){this._commands.set(e,t)}get(e){return this._commands.get(e)}execute(e,...t){let n=this.get(e);if(!n)throw new w(`commandcollection-command-not-found`,this,{commandName:e});return n.execute(...t)}*names(){yield*this._commands.keys()}*commands(){yield*this._commands.values()}[Symbol.iterator](){return this._commands[Symbol.iterator]()}destroy(){for(let e of this.commands())e.destroy()}};const uo=E();var fo=class extends uo{_context;_plugins=new Map;_availablePlugins;_contextPlugins;constructor(e,t=[],n=[]){super(),this._context=e,this._availablePlugins=new Map;for(let e of t)e.pluginName&&this._availablePlugins.set(e.pluginName,e);this._contextPlugins=new Map;for(let[e,t]of n)this._contextPlugins.set(e,t),this._contextPlugins.set(t,e),e.pluginName&&this._availablePlugins.set(e.pluginName,e)}*[Symbol.iterator](){for(let e of this._plugins)typeof e[0]==`function`&&(yield e)}get(e){let t=this._plugins.get(e);if(!t){let t=e;throw typeof e==`function`&&(t=e.pluginName||e.name),new w(`plugincollection-plugin-not-loaded`,this._context,{plugin:t})}return t}has(e){return this._plugins.has(e)}async init(e,t=[],n=[]){let r=this,i=this._context;d(e),p(e);let a=[...f(e.filter(e=>!l(e,t)))];ee(a,n);let o=v(a);return await y(o,`init`),await y(o,`afterInit`),o;function s(e){return typeof e==`function`}function c(e){return s(e)&&!!e.isContextPlugin}function l(e,t){return t.some(t=>t===e||u(e)===t||u(t)===e)}function u(e){return s(e)?e.pluginName||e.name:e}function d(e,t=new Set){e.forEach(e=>{s(e)&&(t.has(e)||(t.add(e),e.pluginName&&!r._availablePlugins.has(e.pluginName)&&r._availablePlugins.set(e.pluginName,e),e.requires&&d(e.requires,t)))})}function f(e,t=new Set){return e.map(e=>s(e)?e:r._availablePlugins.get(e)).reduce((e,n)=>t.has(n)?e:(t.add(n),n.requires&&(p(n.requires,n),f(n.requires,t).forEach(t=>e.add(t))),e.add(n)),new Set)}function p(e,t=null){e.map(e=>s(e)?e:r._availablePlugins.get(e)||e).forEach(e=>{m(e),h(e,t),g(e,t),_(e,t)})}function m(e){if(typeof e==`function`&&e._throwErrorWhenUsedAsAPlugin)throw new w(`plugincollection-plugin-invalid-constructor`,i,{name:e.name})}function h(e,t){if(!s(e))throw t?new w(`plugincollection-soft-required`,i,{missingPlugin:e,requiredBy:u(t)}):new w(`plugincollection-plugin-not-found`,i,{plugin:e})}function g(e,t){if(c(t)&&!c(e))throw new w(`plugincollection-context-required`,i,{plugin:u(e),requiredBy:u(t)})}function _(e,n){if(n&&l(e,t))throw new w(`plugincollection-required`,i,{plugin:u(e),requiredBy:u(n)})}function v(e){return e.map(e=>{let t=r._contextPlugins.get(e);return t||=new e(i),r._add(e,t),t})}function y(e,t){return e.reduce((e,n)=>!n[t]||r._contextPlugins.has(n)?e:e.then(n[t].bind(n)),Promise.resolve())}function ee(e,t){for(let n of t){if(typeof n!=`function`)throw new w(`plugincollection-replace-plugin-invalid-type`,null,{pluginItem:n});let t=n.pluginName;if(!t)throw new w(`plugincollection-replace-plugin-missing-name`,null,{pluginItem:n});if(n.requires&&n.requires.length)throw new w(`plugincollection-plugin-for-replacing-cannot-have-dependencies`,null,{pluginName:t});let i=r._availablePlugins.get(t);if(!i)throw new w(`plugincollection-plugin-for-replacing-not-exist`,null,{pluginName:t});let a=e.indexOf(i);if(a===-1){if(r._contextPlugins.has(i))return;throw new w(`plugincollection-plugin-for-replacing-not-loaded`,null,{pluginName:t})}if(i.requires&&i.requires.length)throw new w(`plugincollection-replaced-plugin-cannot-have-dependencies`,null,{pluginName:t});e.splice(a,1,n),r._availablePlugins.set(t,n)}}}destroy(){let e=[];for(let[,t]of this)typeof t.destroy==`function`&&!this._contextPlugins.has(t)&&e.push(t.destroy());return Promise.all(e)}_add(e,t){this._plugins.set(e,t);let n=e.pluginName;if(n){if(this._plugins.has(n))throw new w(`plugincollection-plugin-name-conflict`,null,{pluginName:n,plugin1:this._plugins.get(n).constructor,plugin2:e});this._plugins.set(n,t)}}},po=class{config;plugins;locale;t;editors;static defaultConfig;static builtinPlugins;_contextOwner=null;constructor(e){let{translations:t,...n}=e||{};this.config=new hr(n,this.constructor.defaultConfig);let r=this.constructor.builtinPlugins;this.config.define(`plugins`,r),this.plugins=new fo(this,r);let i=this.config.get(`language`)||{};this.locale=new Mi({uiLanguage:typeof i==`string`?i:i.ui,contentLanguage:this.config.get(`language.content`),translations:t}),this.t=this.locale.t,this.editors=new Fi}initPlugins(){let e=this.config.get(`plugins`)||[],t=this.config.get(`substitutePlugins`)||[];for(let n of e.concat(t)){if(typeof n!=`function`)throw new w(`context-initplugins-constructor-only`,null,{Plugin:n});if(n.isContextPlugin!==!0)throw new w(`context-initplugins-invalid-plugin`,null,{Plugin:n})}return this.plugins.init(e,[],t)}destroy(){return Promise.all(Array.from(this.editors,e=>e.destroy())).then(()=>this.plugins.destroy())}_addEditor(e,t){if(this._contextOwner)throw new w(`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(){let e={};for(let 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=>{let n=new this(e);t(n.initPlugins().then(()=>n))})}static get _throwErrorWhenUsedAsAPlugin(){return!0}};const mo=D();var ho=class extends mo{context;constructor(e){super(),this.context=e}destroy(){this.stopListening()}static get isContextPlugin(){return!0}static get isOfficialPlugin(){return!1}static get isPremiumPlugin(){return!1}},go=class extends N{editor;constructor(e){super(),this.editor=e}set(e,t,n={}){if(typeof t==`string`){let e=t;t=(t,n)=>{this.editor.execute(e),n()}}super.set(e,t,n)}};const _o=new WeakMap;let vo=!1;function yo({view:e,element:t,text:n,isDirectHost:r=!0,keepOnFocus:i=!1}){let a=e.document;_o.has(a)||(_o.set(a,new Map),a.registerPostFixer(e=>wo(_o.get(a),e)),a.on(`change:isComposing`,()=>{e.change(e=>wo(_o.get(a),e))},{priority:`high`})),t.is(`editableElement`)&&t.on(`change:placeholder`,(e,t,n)=>o(n)),t.placeholder?o(t.placeholder):n&&o(n),n&&Aee();function o(n){let o={text:n,isDirectHost:r,keepOnFocus:i,hostElement:r?t:null};_o.get(a).set(t,o),e.change(e=>wo([[t,o]],e))}}function bo(e,t){let n=t.document;_o.has(n)&&e.change(e=>{let r=_o.get(n),i=r.get(t);e.removeAttribute(`data-placeholder`,i.hostElement),So(e,i.hostElement),r.delete(t)})}function xo(e,t){return t.hasClass(`ck-placeholder`)?!1:(e.addClass(`ck-placeholder`,t),!0)}function So(e,t){return t.hasClass(`ck-placeholder`)?(e.removeClass(`ck-placeholder`,t),!0):!1}function Co(e,t){if(!e.isAttached()||Oee(e))return!1;let n=e.document,r=n.selection.anchor;return n.isComposing&&r&&r.parent===e?!1:t||!n.isFocused?!0:!!r&&r.parent!==e}function Oee(e){for(let t of e.getChildren())if(!t.is(`uiElement`))return!0;return!1}function wo(e,t){let n=[],r=!1;for(let[i,a]of e)a.isDirectHost&&(n.push(i),To(t,i,a)&&(r=!0));for(let[i,a]of e){if(a.isDirectHost)continue;let e=kee(i);e!==a.hostElement&&a.hostElement&&(t.removeAttribute(`data-placeholder`,a.hostElement),So(t,a.hostElement),a.hostElement=null,r=!0),e&&(n.includes(e)||(a.hostElement=e,To(t,i,a)&&(r=!0)))}return r}function To(e,t,n){let{text:r,isDirectHost:i,hostElement:a}=n,o=!1;return a.getAttribute(`data-placeholder`)!==r&&(e.setAttribute(`data-placeholder`,r,a),o=!0),(i||t.childCount==1)&&Co(a,n.keepOnFocus)?xo(e,a)&&(o=!0):So(e,a)&&(o=!0),o}function kee(e){if(e.childCount){let t=e.getChild(0);if(t.is(`element`)&&!t.is(`uiElement`)&&!t.is(`attributeElement`))return t}return null}function Aee(){vo||T(`enableViewPlaceholder-deprecated-text-option`),vo=!0}var Eo=class{is(){throw Error(`is() method is abstract`)}};const jee=E(Eo);var Do=class extends jee{document;parent;constructor(e){super(),this.document=e,this.parent=null}get index(){let e;if(!this.parent)return null;if((e=this.parent.getChildIndex(this))==-1)throw new w(`view-node-not-found-in-parent`,this);return e}get nextSibling(){let e=this.index;return e!==null&&this.parent.getChild(e+1)||null}get previousSibling(){let e=this.index;return e!==null&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.root.is(`rootElement`)}getPath(){let e=[],t=this;for(;t.parent;)e.unshift(t.index),t=t.parent;return e}getAncestors(e={}){let t=[],n=e.includeSelf?this:this.parent;for(;n;)t[e.parentFirst?`push`:`unshift`](n),n=n.parent;return t}getCommonAncestor(e,t={}){let n=this.getAncestors(t),r=e.getAncestors(t),i=0;for(;n[i]==r[i]&&n[i];)i++;return i===0?null:n[i-1]}isBefore(e){if(this==e||this.root!==e.root)return!1;let t=this.getPath(),n=e.getPath(),r=fr(t,n);switch(r){case`prefix`:return!0;case`extension`:return!1;default:return t[r]<n[r]}}isAfter(e){return this==e||this.root!==e.root?!1:!this.isBefore(e)}_remove(){this.parent._removeChildren(this.index)}_fireChange(e,t,n){this.fire(`change:${e}`,t,n),this.parent&&this.parent._fireChange(e,t,n)}toJSON(){let e={path:this.getPath(),type:`Node`};return this!==this.root&&this.root.is(`rootElement`)&&(e.root=this.root.toJSON()),e}};Do.prototype.is=function(e){return e===`node`||e===`view:node`};var Oo=class e extends Do{_textData;constructor(e,t){super(e),this._textData=t}get data(){return this._textData}get _data(){return this.data}set _data(e){this._fireChange(`text`,this),this._textData=e}isSimilar(t){return t instanceof e?this===t||this.data===t.data:!1}toJSON(){let e=super.toJSON();return e.type=`Text`,e.data=this.data,e}_clone(){return new e(this.document,this.data)}};Oo.prototype.is=function(e){return e===`$text`||e===`view:$text`||e===`text`||e===`view:text`||e===`node`||e===`view:node`};var ko=class extends Eo{textNode;data;offsetInText;constructor(e,t,n){if(super(),this.textNode=e,t<0||t>e.data.length)throw new w(`view-textproxy-wrong-offsetintext`,this);if(n<0||t+n>e.data.length)throw new w(`view-textproxy-wrong-length`,this);this.data=e.data.substring(t,t+n),this.offsetInText=t}get offsetSize(){return this.data.length}get isPartial(){return this.data.length!==this.textNode.data.length}get parent(){return this.textNode.parent}get root(){return this.textNode.root}get document(){return this.textNode.document}getAncestors(e={}){let t=[],n=e.includeSelf?this.textNode:this.parent;for(;n!==null;)t[e.parentFirst?`push`:`unshift`](n),n=n.parent;return t}};ko.prototype.is=function(e){return e===`$textProxy`||e===`view:$textProxy`||e===`textProxy`||e===`view:textProxy`};var Ao=class e{_consumables=new Map;add(e,t){let n;if(e.is(`$text`)||e.is(`documentFragment`)){this._consumables.set(e,!0);return}this._consumables.has(e)?n=this._consumables.get(e):(n=new jo(e),this._consumables.set(e,n)),n.add(t?Mo(t):e._getConsumables())}test(e,t){let n=this._consumables.get(e);return n===void 0?null:e.is(`$text`)||e.is(`documentFragment`)?n:n.test(Mo(t))}consume(e,t){if(e.is(`$text`)||e.is(`documentFragment`))return this.test(e,t)?(this._consumables.set(e,!1),!0):!1;let n=this._consumables.get(e);return n===void 0?!1:n.consume(Mo(t))}revert(e,t){let n=this._consumables.get(e);n!==void 0&&(e.is(`$text`)||e.is(`documentFragment`)?this._consumables.set(e,!0):n.revert(Mo(t)))}static createFrom(t,n){if(n||=new e,t.is(`$text`))n.add(t);else if(t.is(`element`)||t.is(`documentFragment`)){n.add(t);for(let r of t.getChildren())e.createFrom(r,n)}return n}},jo=class{element;_canConsumeName=null;_attributes=new Map;constructor(e){this.element=e}add(e){e.name&&(this._canConsumeName=!0);for(let[t,n]of e.attributes)if(n){let e=this._attributes.get(t);(!e||typeof e==`boolean`)&&(e=new Map,this._attributes.set(t,e)),e.set(n,!0)}else if(t==`style`||t==`class`)throw new w(`viewconsumable-invalid-attribute`,this);else this._attributes.set(t,!0)}test(e){if(e.name&&!this._canConsumeName)return this._canConsumeName;for(let[t,n]of e.attributes){let e=this._attributes.get(t);if(e===void 0)return null;if(e===!1)return!1;if(e!==!0){if(n){let t=e.get(n);if(t===void 0)return null;if(!t)return!1}else for(let t of e.values())if(!t)return!1}}return!0}consume(e){if(!this.test(e))return!1;e.name&&(this._canConsumeName=!1);for(let[t,n]of e.attributes){let e=this._attributes.get(t);if(typeof e==`boolean`)for(let[e]of this.element._getConsumables(t,n).attributes)this._attributes.set(e,!1);else if(n)for(let[,r]of this.element._getConsumables(t,n).attributes)e.set(r,!1);else for(let t of e.keys())e.set(t,!1)}return!0}revert(e){e.name&&(this._canConsumeName=!0);for(let[t,n]of e.attributes){let e=this._attributes.get(t);if(e===!1){this._attributes.set(t,!0);continue}if(!(e===void 0||e===!0))if(n)e.get(n)===!1&&e.set(n,!0);else for(let t of e.keys())e.set(t,!0)}}};function Mo(e){let t=[];return`attributes`in e&&e.attributes&&No(t,e.attributes),`classes`in e&&e.classes&&No(t,e.classes,`class`),`styles`in e&&e.styles&&No(t,e.styles,`style`),{name:e.name||!1,attributes:t}}function No(e,t,n){if(typeof t==`string`){e.push(n?[n,t]:[t]);return}for(let r of t)Array.isArray(r)?e.push(r):e.push(n?[n,r]:[r])}var Po=class{_patterns=[];constructor(...e){this.add(...e)}add(...e){for(let t of e)(typeof t==`string`||t instanceof RegExp)&&(t={name:t}),this._patterns.push(t)}match(...e){for(let t of e)for(let e of this._patterns){let n=this._isElementMatching(t,e);if(n)return{element:t,pattern:e,match:n}}return null}matchAll(...e){let t=[];for(let n of e)for(let e of this._patterns){let r=this._isElementMatching(n,e);r&&t.push({element:n,pattern:e,match:r})}return t.length>0?t:null}getElementName(){if(this._patterns.length!==1)return null;let e=this._patterns[0],t=e.name;return typeof e!=`function`&&t&&!(t instanceof RegExp)?t:null}_isElementMatching(e,t){if(typeof t==`function`){let n=t(e);return!n||typeof n!=`object`?n:Mo(n)}let n={};if(t.name&&(n.name=Io(t.name,e.name),!n.name))return null;let r=[];return t.attributes&&!Ro(t.attributes,e,r)||t.classes&&!zo(t.classes,e,r)||t.styles&&!Bo(t.styles,e,r)?null:(r.length&&(n.attributes=r),n)}};function Fo(e,t){return e===!0||e===t||e instanceof RegExp&&!!String(t).match(e)}function Io(e,t){return e instanceof RegExp?!!t.match(e):e===t}function Lo(e,t){if(Array.isArray(e))return e.map(e=>typeof e!=`object`||e instanceof RegExp?t?[t,e,!0]:[e,!0]:((e.key===void 0||e.value===void 0)&&T(`matcher-pattern-missing-key-or-value`,e),t?[t,e.key,e.value]:[e.key,e.value]));if(typeof e!=`object`||e instanceof RegExp)return[t?[t,e,!0]:[e,!0]];let n=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.push(t?[t,r,e[r]]:[r,e[r]]);return n}function Ro(e,t,n){let r;return typeof e==`object`&&!(e instanceof RegExp)&&!Array.isArray(e)?(e.style!==void 0&&T(`matcher-pattern-deprecated-attributes-style-key`,e),e.class!==void 0&&T(`matcher-pattern-deprecated-attributes-class-key`,e)):r=[`class`,`style`],t._collectAttributesMatch(Lo(e),n,r)}function zo(e,t,n){return t._collectAttributesMatch(Lo(e,`class`),n)}function Bo(e,t,n){return t._collectAttributesMatch(Lo(e,`style`),n)}var Vo=class{_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();let t=Uo(e);for(let[e,n]of t)this._styleProcessor.toNormalizedForm(e,n,this._styles);return this}has(e){if(this.isEmpty)return!1;let 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,Xe(e))for(let[t,n]of Object.entries(e))this._styleProcessor.toNormalizedForm(t,n,this._styles);else this._styleProcessor.toNormalizedForm(e,t,this._styles)}remove(e){let t={};for(let n of A(e)){let e=Wo(n),r=Je(this._styles,e);if(r)Go(t,e,r);else{let e=this.getAsString(n);e!==void 0&&this._styleProcessor.toNormalizedForm(n,e,t)}}Object.keys(t).length&&(Ko(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]&&!Xe(this._styles[e]))return this._styles[e];let t=this._styleProcessor.getReducedForm(e,this._styles).find(([t])=>t===e);if(Array.isArray(t))return t[1]}getStyleNames(e=!1){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!1;for(let t of this.getStyleNames())if(!e.has(t)||e.getAsString(t)!==this.getAsString(t))return!1;return!0}getStylesEntries(){let e=[],t=Object.keys(this._styles);for(let n of t)e.push(...this._styleProcessor.getReducedForm(n,this._styles));return e}_clone(){let e=new this.constructor(this._styleProcessor);return e.set(this.getNormalized()),e}_getTokensMatch(e,t){let n=[];for(let r of this.getStyleNames(!0))if(Fo(e,r)){if(t===!0){n.push(r);continue}Fo(t,this.getAsString(r))&&n.push(r)}return n.length?n:void 0}_getConsumables(e){let t=[];if(e){t.push(e);for(let n of this._styleProcessor.getRelatedStyles(e))t.push(n)}else for(let e of this.getStyleNames()){for(let n of this._styleProcessor.getRelatedStyles(e))t.push(n);t.push(e)}return t}_canMergeFrom(e){for(let t of e.getStyleNames())if(this.has(t)&&this.getAsString(t)!==e.getAsString(t))return!1;return!0}_mergeFrom(e){for(let t of e.getStyleNames())this.has(t)||this.set(t,e.getAsString(t))}_isMatching(e){for(let t of e.getStyleNames())if(!this.has(t)||this.getAsString(t)!==e.getAsString(t))return!1;return!0}},Ho=class{_normalizers;_extractors;_reducers;_consumables;constructor(){this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(e,t,n){if(Xe(t)){Go(n,Wo(e),t);return}if(this._normalizers.has(e)){let{path:r,value:i}=this._normalizers.get(e)(t);Go(n,r,i)}else Go(n,e,t)}getNormalized(e,t){if(!e)return wn({},t);if(t[e]!==void 0)return t[e];if(this._extractors.has(e)){let n=this._extractors.get(e);if(typeof n==`string`)return Je(t,n);let r=n(e,t);if(r)return r}return Je(t,Wo(e))}getReducedForm(e,t){let n=this.getNormalized(e,t);return n===void 0?[]:this._reducers.has(e)?this._reducers.get(e)(n):[[e,n]]}getStyleNames(e){let t=new Set;for(let n of this._consumables.keys()){let r=this.getNormalized(n,e);r&&(typeof r!=`object`||Object.keys(r).length)&&t.add(n)}for(let n of Object.keys(e))t.add(n);return Array.from(t)}getRelatedStyles(e){return this._consumables.get(e)||[]}setNormalizer(e,t){this._normalizers.set(e,t)}setExtractor(e,t){this._extractors.set(e,t)}setReducer(e,t){this._reducers.set(e,t)}setStyleRelation(e,t){this._mapStyleNames(e,t);for(let n of t)this._mapStyleNames(n,[e])}_mapStyleNames(e,t){this._consumables.has(e)||this._consumables.set(e,[]),this._consumables.get(e).push(...t)}};function Uo(e){let t=null,n=0,r=0,i=null,a=new Map;if(e===``)return a;e.charAt(e.length-1)!=`;`&&(e+=`;`);for(let o=0;o<e.length;o++){let s=e.charAt(o);if(t===null)switch(s){case`:`:i||(i=e.substr(n,o-n),r=o+1);break;case`"`:case`'`:t=s;break;case`;`:{let t=e.substr(r,o-r);i&&a.set(i.trim(),t.trim()),i=null,n=o+1;break}}else s===t&&(t=null)}return a}function Wo(e){return e.replace(`-`,`.`)}function Go(e,t,n){let r=n;Xe(n)&&!Array.isArray(n)&&(r=wn({},Je(e,t),n)),On(e,t,r)}function Ko(e,t){for(let n of Object.keys(t))e[n]!==null&&!Array.isArray(e[n])&&typeof e[n]==`object`&&typeof t[n]==`object`?(Ko(e[n],t[n]),Object.keys(e[n]).length||delete e[n]):delete e[n]}var qo=class{_set=new Set;get isEmpty(){return this._set.size==0}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(let t of e.split(/\s+/))t&&this._set.add(t);return this}set(e){for(let t of A(e))t&&this._set.add(t)}remove(e){for(let t of A(e))this._set.delete(t)}clear(){this._set.clear()}toString(){return Array.from(this._set).join(` `)}isSimilar(e){if(this.size!==e.size)return!1;for(let t of this.keys())if(!e.has(t))return!1;return!0}_clone(){let e=new this.constructor;return e._set=new Set(this._set),e}_getTokensMatch(e){let t=[];if(e===!0){for(let e of this._set.keys())t.push(e);return t}if(typeof e==`string`){for(let n of e.split(/\s+/))if(this._set.has(n))t.push(n);else return;return t}for(let n of this._set.keys())n.match(e)&&t.push(n);return t.length?t:void 0}_getConsumables(e){return e?[e]:this.keys()}_canMergeFrom(){return!0}_mergeFrom(e){for(let t of e._set.keys())this._set.has(t)||this._set.add(t)}_isMatching(e){for(let t of e._set.keys())if(!this._set.has(t))return!1;return!0}},Jo=class e extends Do{name;_unsafeAttributesToRender=[];_attrs;_children;_customProperties=new Map;get _classes(){return this._attrs.get(`class`)}get _styles(){return this._attrs.get(`style`)}constructor(e,t,n,r){super(e),this.name=t,this._attrs=this._parseAttributes(n),this._children=[],r&&this._insertChild(0,r)}get childCount(){return this._children.length}get isEmpty(){return this._children.length===0}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}*getAttributeKeys(){this._classes&&(yield`class`),this._styles&&(yield`style`);for(let e of this._attrs.keys())e!=`class`&&e!=`style`&&(yield e)}*getAttributes(){for(let[e,t]of this._attrs.entries())yield[e,String(t)]}getAttribute(e){return this._attrs.has(e)?String(this._attrs.get(e)):void 0}hasAttribute(e,t){return this._attrs.has(e)?t===void 0?!0:Zo(this.name,e)||Xo(this.name,e)?this._attrs.get(e).has(t):this._attrs.get(e)===t:!1}isSimilar(t){if(!(t instanceof e))return!1;if(this===t)return!0;if(this.name!=t.name||this._attrs.size!==t._attrs.size)return!1;for(let[e,n]of this._attrs){let r=t._attrs.get(e);if(r===void 0)return!1;if(typeof n==`string`||typeof r==`string`){if(r!==n)return!1}else if(!n.isSimilar(r))return!1}return!0}hasClass(...e){for(let t of e)if(!this._classes||!this._classes.has(t))return!1;return!0}getClassNames(){let 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(let t of e)if(!this._styles||!this._styles.has(t))return!1;return!0}findAncestor(...e){let t=new Po(...e),n=this.parent;for(;n&&!n.is(`documentFragment`);){if(t.match(n))return n;n=n.parent}return null}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}getIdentity(){let e=this._classes?this._classes.keys().sort().join(`,`):``,t=this._styles&&String(this._styles),n=Array.from(this._attrs).filter(([e])=>e!=`style`&&e!=`class`).map(e=>`${e[0]}="${e[1]}"`).sort().join(` `);return this.name+(e==``?``:` class="${e}"`)+(t?` style="${t}"`:``)+(n==``?``:` ${n}`)}shouldRenderUnsafeAttribute(e){return this._unsafeAttributesToRender.includes(e)}toJSON(){let 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(let t of this._children)e.children.push(t.toJSON())}return e}_clone(e=!1){let t=[];if(e)for(let n of this.getChildren())t.push(n._clone(e));let n=new this.constructor(this.document,this.name,this._attrs,t);return n._customProperties=new Map(this._customProperties),n.getFillerOffset=this.getFillerOffset,n._unsafeAttributesToRender=this._unsafeAttributesToRender,n}_appendChild(e){return this._insertChild(this.childCount,e)}_insertChild(e,t){this._fireChange(`children`,this,{index:e});let n=0,r=Yo(this.document,t);for(let t of r)t.parent!==null&&t._remove(),t.parent=this,t.document=this.document,this._children.splice(e,0,t),e++,n++;return n}_removeChildren(e,t=1){this._fireChange(`children`,this,{index:e});for(let n=e;n<e+t;n++)this._children[n].parent=null;return this._children.splice(e,t)}_setAttribute(e,t,n=!0){if(this._fireChange(`attributes`,this),Zo(this.name,e)||Xo(this.name,e)){let r=this._attrs.get(e);r||(r=Zo(this.name,e)?new Vo(this.document.stylesProcessor):new qo,this._attrs.set(e,r)),n?r.setTo(String(t)):Zo(this.name,e)?Array.isArray(t)?r.set(t[0],t[1]):r.set(t):r.set(typeof t==`string`?t.split(/\s+/):t)}else this._attrs.set(e,String(t))}_removeAttribute(e,t){if(this._fireChange(`attributes`,this),t!==void 0&&(Zo(this.name,e)||Xo(this.name,e))){let n=this._attrs.get(e);return n?(Xo(this.name,e)&&typeof t==`string`&&(t=t.split(/\s+/)),n.remove(t),n.isEmpty?this._attrs.delete(e):!1):!1}return this._attrs.delete(e)}_addClass(e){this._setAttribute(`class`,e,!1)}_removeClass(e){this._removeAttribute(`class`,e)}_setStyle(e,t){typeof e==`string`?this._setAttribute(`style`,[e,t],!1):this._setAttribute(`style`,e,!1)}_removeStyle(e){this._removeAttribute(`style`,e)}_collectAttributesMatch(e,t,n){for(let[r,i,a]of e){let e=!1,o=!1;for(let[s,c]of this._attrs)if(!(n&&n.includes(s)||!Fo(r,s)))if(e=!0,typeof c==`string`){if(Fo(i,c))t.push([s]),o=!0;else if(!(r instanceof RegExp))return!1}else{let e=c._getTokensMatch(i,a||!0);if(e){o=!0;for(let n of e)t.push([s,n])}else if(!(r instanceof RegExp))return!1}if(!e||!o)return!1}return!0}_getConsumables(e,t){let n=[];if(e){let r=this._attrs.get(e);if(r!==void 0)if(typeof r==`string`)n.push([e]);else for(let i of r._getConsumables(t))n.push([e,i])}else for(let[e,t]of this._attrs)if(typeof t==`string`)n.push([e]);else for(let r of t._getConsumables())n.push([e,r]);return{name:!e,attributes:n}}_canMergeAttributesFrom(e){if(this.name!=e.name)return!1;for(let[t,n]of e._attrs){let e=this._attrs.get(t);if(e!==void 0){if(typeof e==`string`||typeof n==`string`){if(e!==n)return!1}else if(!e._canMergeFrom(n))return!1}}return!0}_mergeAttributesFrom(e){this._fireChange(`attributes`,this);for(let[t,n]of e._attrs){let e=this._attrs.get(t);e===void 0||typeof e==`string`||typeof n==`string`?this._setAttribute(t,n):e._mergeFrom(n)}}_canSubtractAttributesOf(e){if(this.name!=e.name)return!1;for(let[t,n]of e._attrs){let e=this._attrs.get(t);if(e===void 0)return!1;if(typeof e==`string`||typeof n==`string`){if(e!==n)return!1}else if(!e._isMatching(n))return!1}return!0}_subtractAttributesOf(e){this._fireChange(`attributes`,this);for(let[t,n]of e._attrs){let e=this._attrs.get(t);typeof e==`string`||typeof n==`string`?this._attrs.delete(t):(e.remove(n.keys()),e.isEmpty&&this._attrs.delete(t))}}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}_parseAttributes(e){let t=Ui(e);for(let[e,n]of t)if(n===null)t.delete(e);else if(Zo(this.name,e)){let r=n instanceof Vo?n._clone():new Vo(this.document.stylesProcessor).setTo(String(n));t.set(e,r)}else if(Xo(this.name,e)){let r=n instanceof qo?n._clone():new qo().setTo(String(n));t.set(e,r)}else typeof n!=`string`&&t.set(e,String(n));return t}};Jo.prototype.is=function(e,t){return t?t===this.name&&(e===`element`||e===`view:element`):e===`element`||e===`view:element`||e===`node`||e===`view:node`};function Yo(e,t){if(typeof t==`string`)return[new Oo(e,t)];pr(t)||(t=[t]);let n=[];for(let r of t)typeof r==`string`?n.push(new Oo(e,r)):r instanceof ko?n.push(new Oo(e,r.data)):n.push(r);return n}function Xo(e,t){return t==`class`||e==`a`&&t==`rel`}function Zo(e,t){return t==`style`}var Qo=class extends Jo{constructor(e,t,n,r){super(e,t,n,r),this.getFillerOffset=$o}toJSON(){let e=super.toJSON();return e.type=`ContainerElement`,e}};Qo.prototype.is=function(e,t){return t?t===this.name&&(e===`containerElement`||e===`view:containerElement`||e===`element`||e===`view:element`):e===`containerElement`||e===`view:containerElement`||e===`element`||e===`view:element`||e===`node`||e===`view:node`};function $o(){let e=[...this.getChildren()],t=e[this.childCount-1];if(t&&t.is(`element`,`br`))return this.childCount;for(;t&&t.is(`attributeElement`);)if(t=t.getChild(t.childCount-1),t&&t.is(`element`,`br`))return this.childCount;for(let t of e)if(!t.is(`uiElement`))return null;return this.childCount}const Mee=D(Qo);var es=class extends Mee{constructor(e,t,n,r){super(e,t,n,r),this.set(`isReadOnly`,!1),this.set(`isFocused`,!1),this.set(`placeholder`,void 0),this.bind(`isReadOnly`).to(e),this.bind(`isFocused`).to(e,`isFocused`,t=>t&&e.selection.editableElement==this),this.listenTo(e.selection,`change`,()=>{this.isFocused=e.isFocused&&e.selection.editableElement==this})}destroy(){this.stopListening()}toJSON(){let e=super.toJSON();return e.type=`EditableElement`,e.isReadOnly=this.isReadOnly,e.isFocused=this.isFocused,e}};es.prototype.is=function(e,t){return t?t===this.name&&(e===`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`};const ts=Symbol(`rootName`);var ns=class extends es{constructor(e,t){super(e,t),this.rootName=`main`}get rootName(){return this.getCustomProperty(ts)}set rootName(e){this._setCustomProperty(ts,e)}toJSON(){return this.rootName}set _name(e){this.name=e}};ns.prototype.is=function(e,t){return t?t===this.name&&(e===`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`};var rs=class{direction;boundaries;singleCharacters;shallow;ignoreElementEnd;_position;_boundaryStartParent;_boundaryEndParent;constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new w(`view-tree-walker-no-start-position`,null);if(e.direction&&e.direction!=`forward`&&e.direction!=`backward`)throw new w(`view-tree-walker-unknown-direction`,e.startPosition,{direction:e.direction});this.boundaries=e.boundaries||null,e.startPosition?this._position=L._createAt(e.startPosition):this._position=L._createAt(e.boundaries[e.direction==`backward`?`end`:`start`]),this.direction=e.direction||`forward`,this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null}[Symbol.iterator](){return this}get position(){return this._position}skip(e){let t,n;do n=this.position,t=this.next();while(!t.done&&e(t.value));t.done||(this._position=n)}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 this.direction==`forward`?this._next():this._previous()}_next(){let e=this.position.clone(),t=this.position,n=e.parent;if(n.parent===null&&e.offset===n.childCount||n===this._boundaryEndParent&&e.offset==this.boundaries.end.offset)return{done:!0,value:void 0};let r;if(n&&n.is(`view:$text`)){if(e.isAtEnd)return this._position=L._createAfter(n),this._next();r=n.data[e.offset]}else r=n.getChild(e.offset);if(typeof r==`string`){let r;r=this.singleCharacters?1:(n===this._boundaryEndParent?this.boundaries.end.offset:n.data.length)-e.offset;let i=new ko(n,e.offset,r);return e.offset+=r,this._position=e,this._formatReturnValue(`text`,i,t,e,r)}if(r&&r.is(`view:element`)){if(!this.shallow)e=new L(r,0);else{if(this.boundaries&&this.boundaries.end.isBefore(e))return{done:!0,value:void 0};e.offset++}return this._position=e,this._formatReturnValue(`elementStart`,r,t,e,1)}if(r&&r.is(`view:$text`)){if(this.singleCharacters)return e=new L(r,0),this._position=e,this._next();let n=r.data.length,i;return r==this._boundaryEndParent?(n=this.boundaries.end.offset,i=new ko(r,0,n),e=L._createAfter(i)):(i=new ko(r,0,r.data.length),e.offset++),this._position=e,this._formatReturnValue(`text`,i,t,e,n)}return e=L._createAfter(n),this._position=e,this.ignoreElementEnd?this._next():this._formatReturnValue(`elementEnd`,n,t,e)}_previous(){let e=this.position.clone(),t=this.position,n=e.parent;if(n.parent===null&&e.offset===0||n==this._boundaryStartParent&&e.offset==this.boundaries.start.offset)return{done:!0,value:void 0};let r;if(n.is(`view:$text`)){if(e.isAtStart)return this._position=L._createBefore(n),this._previous();r=n.data[e.offset-1]}else r=n.getChild(e.offset-1);if(typeof r==`string`){let r;if(this.singleCharacters)r=1;else{let t=n===this._boundaryStartParent?this.boundaries.start.offset:0;r=e.offset-t}e.offset-=r;let i=new ko(n,e.offset,r);return this._position=e,this._formatReturnValue(`text`,i,t,e,r)}if(r&&r.is(`view:element`))return this.shallow?(e.offset--,this._position=e,this._formatReturnValue(`elementStart`,r,t,e,1)):(e=new L(r,r.childCount),this._position=e,this.ignoreElementEnd?this._previous():this._formatReturnValue(`elementEnd`,r,t,e));if(r&&r.is(`view:$text`)){if(this.singleCharacters)return e=new L(r,r.data.length),this._position=e,this._previous();let n=r.data.length,i;if(r==this._boundaryStartParent){let t=this.boundaries.start.offset;i=new ko(r,t,r.data.length-t),n=i.data.length,e=L._createBefore(i)}else i=new ko(r,0,r.data.length),e.offset--;return this._position=e,this._formatReturnValue(`text`,i,t,e,n)}return e=L._createBefore(n),this._position=e,this._formatReturnValue(`elementStart`,n,t,e,1)}_formatReturnValue(e,t,n,r,i){return t.is(`view:$textProxy`)&&(t.offsetInText+t.data.length==t.textNode.data.length&&(this.direction==`forward`&&!(this.boundaries&&this.boundaries.end.isEqual(this.position))?(r=L._createAfter(t.textNode),this._position=r):n=L._createAfter(t.textNode)),t.offsetInText===0&&(this.direction==`backward`&&!(this.boundaries&&this.boundaries.start.isEqual(this.position))?(r=L._createBefore(t.textNode),this._position=r):n=L._createBefore(t.textNode))),{done:!1,value:{type:e,item:t,previousPosition:n,nextPosition:r,length:i}}}},L=class e extends Eo{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 this.offset===0}get isAtEnd(){let 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 es);)if(e.parent)e=e.parent;else return null;return e}getShiftedBy(t){let n=e._createAt(this),r=n.offset+t;return n.offset=r<0?0:r,n}getLastMatchingPosition(e,t={}){t.startPosition=this;let n=new rs(t);return n.skip(e),n.position}getAncestors(){return this.parent.is(`documentFragment`)?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(e){let t=this.getAncestors(),n=e.getAncestors(),r=0;for(;t[r]==n[r]&&t[r];)r++;return r===0?null:t[r-1]}isEqual(e){return this.parent==e.parent&&this.offset==e.offset}isBefore(e){return this.compareWith(e)==`before`}isAfter(e){return this.compareWith(e)==`after`}compareWith(e){if(this.root!==e.root)return`different`;if(this.isEqual(e))return`same`;let t=this.parent.is(`node`)?this.parent.getPath():[],n=e.parent.is(`node`)?e.parent.getPath():[];t.push(this.offset),n.push(e.offset);let r=fr(t,n);switch(r){case`prefix`:return`before`;case`extension`:return`after`;default:return t[r]<n[r]?`before`:`after`}}getWalker(e={}){return e.startPosition=this,new rs(e)}clone(){return new e(this.parent,this.offset)}toJSON(){return{parent:this.parent.toJSON(),offset:this.offset}}static _createAt(t,n){if(t instanceof e)return new this(t.parent,t.offset);{let r=t;if(n==`end`)n=r.is(`$text`)?r.data.length:r.childCount;else if(n==`before`)return this._createBefore(r);else if(n==`after`)return this._createAfter(r);else if(n!==0&&!n)throw new w(`view-createpositionat-offset-required`,r);return new e(r,n)}}static _createAfter(t){if(t.is(`$textProxy`))return new e(t.textNode,t.offsetInText+t.data.length);if(!t.parent)throw new w(`view-position-after-root`,t,{root:t});return new e(t.parent,t.index+1)}static _createBefore(t){if(t.is(`$textProxy`))return new e(t.textNode,t.offsetInText);if(!t.parent)throw new w(`view-position-before-root`,t,{root:t});return new e(t.parent,t.index)}};L.prototype.is=function(e){return e===`position`||e===`view:position`};var R=class e extends Eo{start;end;constructor(e,t=null){super(),this.start=e.clone(),this.end=t?t.clone():e.clone()}*[Symbol.iterator](){yield*new rs({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return this.start.parent===this.end.parent}get root(){return this.start.root}getEnlarged(){let t=this.start.getLastMatchingPosition(is,{direction:`backward`}),n=this.end.getLastMatchingPosition(is);return t.parent.is(`$text`)&&t.isAtStart&&(t=L._createBefore(t.parent)),n.parent.is(`$text`)&&n.isAtEnd&&(n=L._createAfter(n.parent)),new e(t,n)}getTrimmed(){let t=this.start.getLastMatchingPosition(is);if(t.isAfter(this.end)||t.isEqual(this.end))return new e(t,t);let n=this.end.getLastMatchingPosition(is,{direction:`backward`}),r=t.nodeAfter,i=n.nodeBefore;return r&&r.is(`$text`)&&(t=new L(r,0)),i&&i.is(`$text`)&&(n=new L(i,i.data.length)),new e(t,n)}isEqual(e){return this==e||this.start.isEqual(e.start)&&this.end.isEqual(e.end)}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);let n=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),r=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return n&&r}getDifference(t){let n=[];return this.isIntersecting(t)?(this.containsPosition(t.start)&&n.push(new e(this.start,t.start)),this.containsPosition(t.end)&&n.push(new e(t.end,this.end))):n.push(this.clone()),n}getIntersection(t){if(this.isIntersecting(t)){let n=this.start,r=this.end;return this.containsPosition(t.start)&&(n=t.start),this.containsPosition(t.end)&&(r=t.end),new e(n,r)}return null}getWalker(e={}){return e.boundaries=this,new rs(e)}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;let e=this.start.nodeAfter,t=this.end.nodeBefore;return this.start.parent.is(`$text`)&&this.start.isAtEnd&&this.start.parent.nextSibling&&(e=this.start.parent.nextSibling),this.end.parent.is(`$text`)&&this.end.isAtStart&&this.end.parent.previousSibling&&(t=this.end.parent.previousSibling),e&&e.is(`element`)&&e===t?e:null}clone(){return new e(this.start,this.end)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;let t=new rs(e);for(let e of t)yield e.item}*getPositions(e={}){e.boundaries=this;let t=new rs(e);yield t.position;for(let 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,n,r){return new this(new L(e,t),new L(n,r))}static _createFromPositionAndShift(e,t){let n=e,r=e.getShiftedBy(t);return t>0?new this(n,r):new this(r,n)}static _createIn(e){return this._createFromParentsAndOffsets(e,0,e,e.childCount)}static _createOn(e){let t=e.is(`$textProxy`)?e.offsetSize:1;return this._createFromPositionAndShift(L._createBefore(e),t)}};R.prototype.is=function(e){return e===`range`||e===`view:range`};function is(e){return!!(e.item.is(`attributeElement`)||e.item.is(`uiElement`))}const as=E(Eo);var os=class e extends as{_ranges;_lastRangeBackward;_isFake;_fakeSelectionLabel;constructor(...e){super(),this._ranges=[],this._lastRangeBackward=!1,this._isFake=!1,this._fakeSelectionLabel=``,e.length&&this.setTo(...e)}get isFake(){return this._isFake}get fakeSelectionLabel(){return this._fakeSelectionLabel}get anchor(){if(!this._ranges.length)return null;let e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.end:e.start).clone()}get focus(){if(!this._ranges.length)return null;let e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.start:e.end).clone()}get isCollapsed(){return this.rangeCount===1&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}get editableElement(){return this.anchor?this.anchor.editableElement:null}*getRanges(){for(let e of this._ranges)yield e.clone()}getFirstRange(){let e=null;for(let t of this._ranges)(!e||t.start.isBefore(e.start))&&(e=t);return e?e.clone():null}getLastRange(){let e=null;for(let t of this._ranges)(!e||t.end.isAfter(e.end))&&(e=t);return e?e.clone():null}getFirstPosition(){let e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){let e=this.getLastRange();return e?e.end.clone():null}isEqual(e){if(this.isFake!=e.isFake||this.isFake&&this.fakeSelectionLabel!=e.fakeSelectionLabel||this.rangeCount!=e.rangeCount)return!1;if(this.rangeCount===0)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(let t of this._ranges){let n=!1;for(let r of e._ranges)if(t.isEqual(r)){n=!0;break}if(!n)return!1}return!0}isSimilar(e){if(this.isBackward!=e.isBackward)return!1;let t=dr(this.getRanges());if(t!=dr(e.getRanges()))return!1;if(t==0)return!0;for(let t of this.getRanges()){t=t.getTrimmed();let n=!1;for(let r of e.getRanges())if(r=r.getTrimmed(),t.start.isEqual(r.start)&&t.end.isEqual(r.end)){n=!0;break}if(!n)return!1}return!0}getSelectedElement(){return this.rangeCount===1?this.getFirstRange().getContainedElement():null}setTo(...t){let[n,r,i]=t;if(typeof r==`object`&&(i=r,r=void 0),n===null)this._setRanges([]),this._setFakeOptions(i);else if(n instanceof e||n instanceof cs)this._setRanges(n.getRanges(),n.isBackward),this._setFakeOptions({fake:n.isFake,label:n.fakeSelectionLabel});else if(n instanceof R)this._setRanges([n],i&&i.backward),this._setFakeOptions(i);else if(n instanceof L)this._setRanges([new R(n)]),this._setFakeOptions(i);else if(n instanceof Do){let e=!!i&&!!i.backward,t;if(r===void 0)throw new w(`view-selection-setto-required-second-parameter`,this);t=r==`in`?R._createIn(n):r==`on`?R._createOn(n):new R(L._createAt(n,r)),this._setRanges([t],e),this._setFakeOptions(i)}else if(pr(n))this._setRanges(n,i&&i.backward),this._setFakeOptions(i);else throw new w(`view-selection-setto-not-selectable`,this);this.fire(`change`)}setFocus(e,t){if(this.anchor===null)throw new w(`view-selection-setfocus-no-ranges`,this);let n=L._createAt(e,t);if(n.compareWith(this.focus)==`same`)return;let r=this.anchor;this._ranges.pop(),n.compareWith(r)==`before`?this._addRange(new R(n,r),!0):this._addRange(new R(r,n)),this.fire(`change`)}toJSON(){let e={ranges:Array.from(this.getRanges()).map(e=>e.toJSON())};return this.isBackward&&(e.isBackward=!0),this.isFake&&(e.isFake=!0),e}_setRanges(e,t=!1){e=Array.from(e),this._ranges=[];for(let t of e)this._addRange(t);this._lastRangeBackward=!!t}_setFakeOptions(e={}){this._isFake=!!e.fake,this._fakeSelectionLabel=e.fake&&e.label||``}_addRange(e,t=!1){if(!(e instanceof R))throw new w(`view-selection-add-range-not-range`,this);this._pushRange(e),this._lastRangeBackward=!!t}_pushRange(e){for(let t of this._ranges)if(e.isIntersecting(t))throw new w(`view-selection-range-intersects`,this,{addedRange:e,intersectingRange:t});this._ranges.push(new R(e.start,e.end))}};os.prototype.is=function(e){return e===`selection`||e===`view:selection`};const ss=E(Eo);var cs=class extends ss{_selection;constructor(...e){super(),this._selection=new os,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)}};cs.prototype.is=function(e){return e===`selection`||e==`documentSelection`||e==`view:selection`||e==`view:documentSelection`};var ls=class extends pe{startRange;_eventPhase;_currentTarget;constructor(e,t,n){super(e,t),this.startRange=n,this._eventPhase=`none`,this._currentTarget=null}get eventPhase(){return this._eventPhase}get currentTarget(){return this._currentTarget}};const us=Symbol(`bubblingEmitter`),ds=Symbol(`bubblingCallbacks`),fs=Symbol(`bubblingContexts`);function ps(e){class t extends e{fire(e,...t){try{let n=e instanceof pe?e:new pe(this,e),r=_s(this),i=ys(this);if(ms(n,`capturing`,this),hs(r,`$capture`,n,...t))return n.return;let a=n.startRange||this.selection.getFirstRange(),o=a?a.getContainedElement():null,s=o?bs(i,o):!1,c=o||xs(a);if(ms(n,`atTarget`,c),!s){if(hs(r,`$text`,n,...t))return n.return;ms(n,`bubbling`,c)}for(;c;){if(c.is(`element`)&&hs(r,c,n,...t))return n.return;c=c.parent,ms(n,`bubbling`,c)}return ms(n,`bubbling`,this),hs(r,`$document`,n,...t),n.return}catch(e){w.rethrowUnexpectedError(e,this)}}_addEventListener(e,t,n){let r=A(n.context||`$document`),i=_s(this),a=vs(this);for(let e of r)typeof e==`function`&&ys(this).add(e);let o=gs(this,r,t);a.set(t,o),this.listenTo(i,e,o,n)}_removeEventListener(e,t){let n=_s(this),r=vs(this),i=r.get(t);i&&(r.delete(t),this.stopListening(n,e,i))}}return t}function ms(e,t,n){e instanceof ls&&(e._eventPhase=t,e._currentTarget=n)}function hs(e,t,n,...r){return e.fire(n,{currentTarget:t,eventArgs:r}),!!n.stop.called}function gs(e,t,n){return function(r,i){let{currentTarget:a,eventArgs:o}=i;if(typeof a==`string`){t.includes(a)&&n.call(e,r,...o);return}if(a.is(`rootElement`)&&t.includes(`$root`)){n.call(e,r,...o);return}if(t.includes(a.name)){n.call(e,r,...o);return}for(let i of t)if(typeof i==`function`&&i(a)){n.call(e,r,...o);return}}}function _s(e){return e[us]||(e[us]=new(E())),e[us]}function vs(e){return e[ds]||(e[ds]=new Map),e[ds]}function ys(e){return e[fs]||(e[fs]=new Set),e[fs]}function bs(e,t){for(let n of e)if(n(t))return!0;return!1}function xs(e){if(!e)return null;let t=e.start.parent,n=e.end.parent,r=t.getPath(),i=n.getPath();return r.length>i.length?t:n}const Ss=ps(D());var Cs=class extends Ss{selection;roots;stylesProcessor;_postFixers=new Set;constructor(e){super(),this.selection=new cs,this.roots=new Fi({idProperty:`rootName`}),this.stylesProcessor=e,this.set(`isReadOnly`,!1),this.set(`isFocused`,!1),this.set(`isSelecting`,!1),this.set(`isComposing`,!1)}getRoot(e=`main`){return this.roots.get(e)}getRoots(){return Array.from(this.roots)}registerPostFixer(e){this._postFixers.add(e)}destroy(){this.roots.forEach(e=>e.destroy()),this.stopListening()}_callPostFixers(e){let t=!1;do for(let n of this._postFixers)if(t=n(e),t)break;while(t)}},ws=class extends Jo{static DEFAULT_PRIORITY=10;_priority=10;_id=null;_clonesGroup=null;constructor(e,t,n,r){super(e,t,n,r),this.getFillerOffset=Ts}get priority(){return this._priority}get id(){return this._id}getElementsWithSameId(){if(this.id===null)throw new w(`attribute-element-get-elements-with-same-id-no-id`,this);return new Set(this._clonesGroup)}isSimilar(e){return this.id!==null||e.id!==null?this.id===e.id:super.isSimilar(e)&&this.priority==e.priority}toJSON(){let e=super.toJSON();return e.type=`AttributeElement`,e}_clone(e=!1){let t=super._clone(e);return t._priority=this._priority,t._id=this._id,t}_canMergeAttributesFrom(e){return this.id!==null||e.id!==null||this.priority!==e.priority?!1:super._canMergeAttributesFrom(e)}_canSubtractAttributesOf(e){return this.id!==null||e.id!==null||this.priority!==e.priority?!1:super._canSubtractAttributesOf(e)}};ws.prototype.is=function(e,t){return t?t===this.name&&(e===`attributeElement`||e===`view:attributeElement`||e===`element`||e===`view:element`):e===`attributeElement`||e===`view:attributeElement`||e===`element`||e===`view:element`||e===`node`||e===`view:node`};function Ts(){if(Es(this))return null;let e=this.parent;for(;e&&e.is(`attributeElement`);){if(Es(e)>1)return null;e=e.parent}return!e||Es(e)>1?null:this.childCount}function Es(e){return Array.from(e.getChildren()).filter(e=>!e.is(`uiElement`)).length}var Ds=class extends Jo{constructor(e,t,n,r){super(e,t,n,r),this.getFillerOffset=Os}toJSON(){let e=super.toJSON();return e.type=`EmptyElement`,e}_insertChild(e,t){if(t&&(t instanceof Do||Array.from(t).length>0))throw new w(`view-emptyelement-cannot-add`,[this,t]);return 0}};Ds.prototype.is=function(e,t){return t?t===this.name&&(e===`emptyElement`||e===`view:emptyElement`||e===`element`||e===`view:element`):e===`emptyElement`||e===`view:emptyElement`||e===`element`||e===`view:element`||e===`node`||e===`view:node`};function Os(){return null}var ks=class extends Jo{constructor(e,t,n,r){super(e,t,n,r),this.getFillerOffset=js}_insertChild(e,t){if(t&&(t instanceof Do||Array.from(t).length>0))throw new w(`view-uielement-cannot-add`,[this,t]);return 0}render(e,t){return this.toDomElement(e)}toDomElement(e){let t=e.createElement(this.name);for(let e of this.getAttributeKeys())t.setAttribute(e,this.getAttribute(e));return t}toJSON(){let e=super.toJSON();return e.type=`UIElement`,e}};ks.prototype.is=function(e,t){return t?t===this.name&&(e===`uiElement`||e===`view:uiElement`||e===`element`||e===`view:element`):e===`uiElement`||e===`view:uiElement`||e===`element`||e===`view:element`||e===`node`||e===`view:node`};function As(e){e.document.on(`arrowKey`,(t,n)=>Ms(t,n,e.domConverter),{priority:`low`})}function js(){return null}function Ms(e,t,n){if(t.keyCode==k.arrowright){let e=t.domTarget.ownerDocument.defaultView.getSelection(),r=e.rangeCount==1&&e.getRangeAt(0).collapsed;if(r||t.shiftKey){let t=e.focusNode,i=e.focusOffset,a=n.domPositionToView(t,i);if(a===null)return;let o=!1,s=a.getLastMatchingPosition(e=>(e.item.is(`uiElement`)&&(o=!0),!!(e.item.is(`uiElement`)||e.item.is(`attributeElement`))));if(o){let t=n.viewPositionToDom(s);r?e.collapse(t.parent,t.offset):e.extend(t.parent,t.offset)}}}}var Ns=class extends Jo{constructor(e,t,n,r){super(e,t,n,r),this.getFillerOffset=Ps}toJSON(){let e=super.toJSON();return e.type=`RawElement`,e}_insertChild(e,t){if(t&&(t instanceof Do||Array.from(t).length>0))throw new w(`view-rawelement-cannot-add`,[this,t]);return 0}render(e,t){}};Ns.prototype.is=function(e,t){return t?t===this.name&&(e===`rawElement`||e===`view:rawElement`||e===`element`||e===`view:element`):e===`rawElement`||e===`view:rawElement`||e===this.name||e===`view:`+this.name||e===`element`||e===`view:element`||e===`node`||e===`view:node`};function Ps(){return null}const Fs=E(Eo);var Is=class extends Fs{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 this.childCount===0}get root(){return this}get parent(){return null}get name(){}get getFillerOffset(){}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}toJSON(){let e=[];for(let 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 n=0,r=Ls(this.document,t);for(let t of r)t.parent!==null&&t._remove(),t.parent=this,this._children.splice(e,0,t),e++,n++;return n}_removeChildren(e,t=1){this._fireChange(`children`,this,{index:e});for(let n=e;n<e+t;n++)this._children[n].parent=null;return this._children.splice(e,t)}_fireChange(e,t,n){this.fire(`change:${e}`,t,n)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}};Is.prototype.is=function(e){return e===`documentFragment`||e===`view:documentFragment`};function Ls(e,t){return typeof t==`string`?[new Oo(e,t)]:(pr(t)||(t=[t]),Array.from(t).map(t=>typeof t==`string`?new Oo(e,t):t instanceof ko?new Oo(e,t.data):t))}var Rs=class{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 Is(this.document,e)}createText(e){return new Oo(this.document,e)}createAttributeElement(e,t,n={}){let r=new ws(this.document,e,t);return typeof n.priority==`number`&&(r._priority=n.priority),n.id&&(r._id=n.id),n.renderUnsafeAttributes&&r._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),r}createContainerElement(e,t,n={},r={}){let i;Fee(n)?r=n:i=n;let a=new Qo(this.document,e,t,i);return r.renderUnsafeAttributes&&a._unsafeAttributesToRender.push(...r.renderUnsafeAttributes),a}createEditableElement(e,t,n={}){let r=new es(this.document,e,t);return n.renderUnsafeAttributes&&r._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),r}createEmptyElement(e,t,n={}){let r=new Ds(this.document,e,t);return n.renderUnsafeAttributes&&r._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),r}createUIElement(e,t,n){let r=new ks(this.document,e,t);return n&&(r.render=n),r}createRawElement(e,t,n,r={}){let i=new Ns(this.document,e,t);return n&&(i.render=n),r.renderUnsafeAttributes&&i._unsafeAttributesToRender.push(...r.renderUnsafeAttributes),i}setAttribute(e,t,n,r){r===void 0?n._setAttribute(e,t):r._setAttribute(e,t,n)}removeAttribute(e,t,n){n===void 0?t._removeAttribute(e):n._removeAttribute(e,t)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,n){xn(e)&&n===void 0?t._setStyle(e):n._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,n){n._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}breakAttributes(e){return e instanceof L?this._breakAttributes(e):this._breakAttributesRange(e)}breakContainer(e){let t=e.parent;if(!t.is(`containerElement`))throw new w(`view-writer-break-non-container-element`,this.document);if(!t.parent)throw new w(`view-writer-break-root`,this.document);if(e.isAtStart)return L._createBefore(t);if(!e.isAtEnd){let n=t._clone(!1);this.insert(L._createAfter(t),n);let r=new R(e,L._createAt(t,`end`)),i=new L(n,0);this.move(r,i)}return L._createAfter(t)}mergeAttributes(e){let t=e.offset,n=e.parent;if(n.is(`$text`))return e;if(n.is(`attributeElement`)&&n.childCount===0){let e=n.parent,t=n.index;return n._remove(),this._removeFromClonedElementsGroup(n),this.mergeAttributes(new L(e,t))}let r=n.getChild(t-1),i=n.getChild(t);if(!r||!i)return e;if(r.is(`$text`)&&i.is(`$text`))return Us(r,i);if(r.is(`attributeElement`)&&i.is(`attributeElement`)&&r.isSimilar(i)){let e=r.childCount;return r._appendChild(i.getChildren()),i._remove(),this._removeFromClonedElementsGroup(i),this.mergeAttributes(new L(r,e))}return e}mergeContainers(e){let t=e.nodeBefore,n=e.nodeAfter;if(!t||!n||!t.is(`containerElement`)||!n.is(`containerElement`))throw new w(`view-writer-merge-containers-invalid-position`,this.document);let r=t.getChild(t.childCount-1),i=r instanceof Oo?L._createAt(r,`end`):L._createAt(t,`end`);return this.move(R._createIn(n),L._createAt(t,`end`)),this.remove(R._createOn(n)),i}insert(e,t){t=pr(t)?[...t]:[t],Ws(t,this.document);let n=t.reduce((e,t)=>{let n=e[e.length-1],r=!t.is(`uiElement`);return!n||n.breakAttributes!=r?e.push({breakAttributes:r,nodes:[t]}):n.nodes.push(t),e},[]),r=null,i=e;for(let{nodes:e,breakAttributes:t}of n){let n=this._insertNodes(i,e,t);r||=n.start,i=n.end}return r?new R(r,i):new R(e)}remove(e){let t=e instanceof R?e:R._createOn(e);if(Ks(t,this.document),t.isCollapsed)return new Is(this.document);let{start:n,end:r}=this._breakAttributesRange(t,!0),i=n.parent,a=r.offset-n.offset,o=i._removeChildren(n.offset,a);for(let e of o)this._removeFromClonedElementsGroup(e);let s=this.mergeAttributes(n);return t.start=s,t.end=s.clone(),new Is(this.document,o)}clear(e,t){Ks(e,this.document);let n=e.getWalker({direction:`backward`,ignoreElementEnd:!0});for(let r of n){let n=r.item,i;if(n.is(`element`)&&t.isSimilar(n))i=R._createOn(n);else if(!r.nextPosition.isAfter(e.start)&&n.is(`$textProxy`)){let e=n.getAncestors().find(e=>e.is(`element`)&&t.isSimilar(e));e&&(i=R._createIn(e))}i&&(i.end.isAfter(e.end)&&(i.end=e.end),i.start.isBefore(e.start)&&(i.start=e.start),this.remove(i))}}move(e,t){let n;if(t.isAfter(e.end)){t=this._breakAttributes(t,!0);let r=t.parent,i=r.childCount;e=this._breakAttributesRange(e,!0),n=this.remove(e),t.offset+=r.childCount-i}else n=this.remove(e);return this.insert(t,n)}wrap(e,t){if(!(t instanceof ws))throw new w(`view-writer-wrap-invalid-attribute`,this.document);if(Ks(e,this.document),e.isCollapsed){let n=e.start;n.parent.is(`element`)&&!zs(n.parent)&&(n=n.getLastMatchingPosition(e=>e.item.is(`uiElement`))),n=this._wrapPosition(n,t);let r=this.document.selection;return r.isCollapsed&&r.getFirstPosition().isEqual(e.start)&&this.setSelection(n),new R(n)}else return this._wrapRange(e,t)}unwrap(e,t){if(!(t instanceof ws))throw new w(`view-writer-unwrap-invalid-attribute`,this.document);if(Ks(e,this.document),e.isCollapsed)return e;let{start:n,end:r}=this._breakAttributesRange(e,!0),i=n.parent,a=this._unwrapChildren(i,n.offset,r.offset,t),o=this.mergeAttributes(a.start);return o.isEqual(a.start)||a.end.offset--,new R(o,this.mergeAttributes(a.end))}rename(e,t){let n=new Qo(this.document,e,t.getAttributes());return this.insert(L._createAfter(t),n),this.move(R._createIn(t),L._createAt(n,0)),this.remove(R._createOn(t)),n}clearClonedElementsGroup(e){this._cloneGroups.delete(e)}createPositionAt(e,t){return L._createAt(e,t)}createPositionAfter(e){return L._createAfter(e)}createPositionBefore(e){return L._createBefore(e)}createRange(e,t){return new R(e,t)}createRangeOn(e){return R._createOn(e)}createRangeIn(e){return R._createIn(e)}createSelection(...e){return new os(...e)}createSlot(e=`children`){if(!this._slotFactory)throw new w(`view-writer-invalid-create-slot-context`,this.document);return this._slotFactory(this,e)}_registerSlotFactory(e){this._slotFactory=e}_clearSlotFactory(){this._slotFactory=null}_insertNodes(e,t,n){let r;if(r=n?Bs(e):e.parent.is(`$text`)?e.parent.parent:e.parent,!r)throw new w(`view-writer-invalid-position-container`,this.document);let i;i=n?this._breakAttributes(e,!0):e.parent.is(`$text`)?Hs(e):e;let a=r._insertChild(i.offset,t);for(let e of t)this._addToClonedElementsGroup(e);let o=i.getShiftedBy(a),s=this.mergeAttributes(i);return s.isEqual(i)||o.offset--,new R(s,this.mergeAttributes(o))}_wrapChildren(e,t,n,r){let i=t,a=[];for(;i<n;){let t=e.getChild(i),n=t.is(`$text`),o=t.is(`attributeElement`);if(o&&t._canMergeAttributesFrom(r))t._mergeAttributesFrom(r),a.push(new L(e,i));else if(n||!o||Nee(r,t)){let n=r._clone();t._remove(),n._appendChild(t),e._insertChild(i,n),this._addToClonedElementsGroup(n),a.push(new L(e,i))}else this._wrapChildren(t,0,t.childCount,r);i++}let o=0;for(let e of a)e.offset-=o,e.offset!=t&&(this.mergeAttributes(e).isEqual(e)||(o++,n--));return R._createFromParentsAndOffsets(e,t,e,n)}_unwrapChildren(e,t,n,r){let i=t,a=[];for(;i<n;){let t=e.getChild(i);if(!t.is(`attributeElement`)){i++;continue}if(t.isSimilar(r)){let r=t.getChildren(),o=t.childCount;t._remove(),e._insertChild(i,r),this._removeFromClonedElementsGroup(t),a.push(new L(e,i),new L(e,i+o)),i+=o,n+=o-1;continue}if(t._canSubtractAttributesOf(r)){t._subtractAttributesOf(r),a.push(new L(e,i),new L(e,i+1)),i++;continue}this._unwrapChildren(t,0,t.childCount,r),i++}let o=0;for(let e of a)e.offset-=o,!(e.offset==t||e.offset==n)&&(this.mergeAttributes(e).isEqual(e)||(o++,n--));return R._createFromParentsAndOffsets(e,t,e,n)}_wrapRange(e,t){let{start:n,end:r}=this._breakAttributesRange(e,!0),i=n.parent,a=this._wrapChildren(i,n.offset,r.offset,t),o=this.mergeAttributes(a.start);return o.isEqual(a.start)||a.end.offset--,new R(o,this.mergeAttributes(a.end))}_wrapPosition(e,t){if(t.isSimilar(e.parent))return Vs(e.clone());e.parent.is(`$text`)&&(e=Hs(e));let n=this.createAttributeElement(`_wrapPosition-fake-element`);n._priority=1/0,n.isSimilar=()=>!1,e.parent._insertChild(e.offset,n);let r=new R(e,e.getShiftedBy(1));this.wrap(r,t);let i=new L(n.parent,n.index);n._remove();let a=i.nodeBefore,o=i.nodeAfter;return a&&a.is(`view:$text`)&&o&&o.is(`view:$text`)?Us(a,o):Vs(i)}_breakAttributesRange(e,t=!1){let n=e.start,r=e.end;if(Ks(e,this.document),e.isCollapsed){let n=this._breakAttributes(e.start,t);return new R(n,n)}let i=this._breakAttributes(r,t),a=i.parent.childCount,o=this._breakAttributes(n,t);return i.offset+=i.parent.childCount-a,new R(o,i)}_breakAttributes(e,t=!1){let n=e.offset,r=e.parent;if(e.parent.is(`emptyElement`))throw new w(`view-writer-cannot-break-empty-element`,this.document);if(e.parent.is(`uiElement`))throw new w(`view-writer-cannot-break-ui-element`,this.document);if(e.parent.is(`rawElement`))throw new w(`view-writer-cannot-break-raw-element`,this.document);if(!t&&r.is(`$text`)&&Gs(r.parent)||Gs(r))return e.clone();if(r.is(`$text`))return this._breakAttributes(Hs(e),t);if(n==r.childCount){let e=new L(r.parent,r.index+1);return this._breakAttributes(e,t)}else if(n===0){let e=new L(r.parent,r.index);return this._breakAttributes(e,t)}else{let e=r.index+1,i=r._clone();r.parent._insertChild(e,i),this._addToClonedElementsGroup(i);let a=r.childCount-n,o=r._removeChildren(n,a);i._appendChild(o);let s=new L(r.parent,e);return this._breakAttributes(s,t)}}_addToClonedElementsGroup(e){if(!e.root.is(`rootElement`))return;if(e.is(`element`))for(let t of e.getChildren())this._addToClonedElementsGroup(t);let t=e.id;if(!t)return;let n=this._cloneGroups.get(t);n||(n=new Set,this._cloneGroups.set(t,n)),n.add(e),e._clonesGroup=n}_removeFromClonedElementsGroup(e){if(e.is(`element`))for(let t of e.getChildren())this._removeFromClonedElementsGroup(t);let t=e.id;if(!t)return;let n=this._cloneGroups.get(t);n&&n.delete(e)}};function zs(e){return Array.from(e.getChildren()).some(e=>!e.is(`uiElement`))}function Bs(e){let t=e.parent;for(;!Gs(t);){if(!t)return;t=t.parent}return t}function Nee(e,t){return e.priority<t.priority?!0:e.priority>t.priority?!1:e.getIdentity()<t.getIdentity()}function Vs(e){let t=e.nodeBefore;if(t&&t.is(`$text`))return new L(t,t.data.length);let n=e.nodeAfter;return n&&n.is(`$text`)?new L(n,0):e}function Hs(e){if(e.offset==e.parent.data.length)return new L(e.parent.parent,e.parent.index+1);if(e.offset===0)return new L(e.parent.parent,e.parent.index);let 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 Oo(e.root.document,t)),new L(e.parent.parent,e.parent.index+1)}function Us(e,t){let n=e.data.length;return e._data+=t.data,t._remove(),new L(e,n)}const Pee=[Oo,ws,Qo,Ds,Ns,ks];function Ws(e,t){for(let n of e){if(!Pee.some(e=>n instanceof e))throw new w(`view-writer-insert-invalid-node-type`,t);n.is(`$text`)||Ws(n.getChildren(),t)}}function Gs(e){return e&&(e.is(`containerElement`)||e.is(`documentFragment`))}function Ks(e,t){let n=Bs(e.start),r=Bs(e.end);if(!n||!r||n!==r)throw new w(`view-writer-invalid-range-container`,t)}function Fee(e){return xn(e)}const qs=e=>e.createTextNode(`\xA0`),Js=e=>{let t=e.createElement(`span`);return t.dataset.ckeFiller=`true`,t.innerText=`\xA0`,t},Ys=e=>{let t=e.createElement(`br`);return t.dataset.ckeFiller=`true`,t},Iee=7,Xs=``.repeat(7);function Zs(e){return typeof e==`string`?e.substr(0,7)===Xs:jr(e)&&e.data.substr(0,7)===Xs}function Qs(e){return e.data.length==7&&Zs(e)}function $s(e){let t=typeof e==`string`?e:e.data;return Zs(e)?t.slice(7):t}function ec(e){e.document.on(`arrowKey`,tc,{priority:`low`})}function tc(e,t){if(t.keyCode==k.arrowleft){let e=t.domTarget.ownerDocument.defaultView.getSelection();if(e.rangeCount==1&&e.getRangeAt(0).collapsed){let t=e.getRangeAt(0).startContainer,n=e.getRangeAt(0).startOffset;Zs(t)&&n<=7&&e.collapse(t,0)}}}const nc=D();var rc=class extends nc{domDocuments=new Set;domConverter;markedAttributes=new Set;markedChildren=new Set;markedTexts=new Set;selection;_inlineFiller=null;_fakeSelectionContainer=null;constructor(e,t){super(),this.domConverter=e,this.selection=t,this.set(`isFocused`,!1),this.set(`isSelecting`,!1),this.set(`isComposing`,!1),p.isBlink&&!p.isAndroid&&this.on(`change:isSelecting`,()=>{this.isSelecting||this.render()})}markToSync(e,t){if(e===`text`)this.domConverter.mapViewToDom(t.parent)&&this.markedTexts.add(t);else{if(!this.domConverter.mapViewToDom(t))return;if(e===`attributes`)this.markedAttributes.add(t);else if(e===`children`)this.markedChildren.add(t);else throw new w(`view-renderer-unknown-type`,this)}}render(){if(this.isComposing&&!p.isAndroid)return;let e=null,t=p.isBlink&&!p.isAndroid?!this.isSelecting:!0;for(let 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=L._createBefore(e.parent)));for(let e of this.markedAttributes)this._updateAttrs(e);for(let t of this.markedChildren)this._updateChildren(t,{inlineFillerPosition:e});for(let t of this.markedTexts)!this.markedChildren.has(t.parent)&&this.domConverter.mapViewToDom(t.parent)&&this._updateText(t,{inlineFillerPosition:e});if(t)if(e){let t=this.domConverter.viewPositionToDom(e),n=t.parent.ownerDocument;Zs(t.parent)?this._inlineFiller=t.parent:this._inlineFiller=ac(n,t.parent,t.offset)}else this._inlineFiller=null;this._updateFocus(),this._updateSelection(),this.domConverter._clearTemporaryCustomProperties(),this.markedTexts.clear(),this.markedAttributes.clear(),this.markedChildren.clear()}_updateChildrenMappings(e){let t=this.domConverter.mapViewToDom(e);if(!t)return;let n=Array.from(t.childNodes),r=Array.from(this.domConverter.viewChildrenToDom(e,{withChildren:!1})),i=this._diffNodeLists(n,r),a=this._findUpdateActions(i,n,r,oc);if(a.indexOf(`update`)!==-1){let t={equal:0,insert:0,delete:0};for(let i of a)if(i===`update`){let i=t.equal+t.insert,a=t.equal+t.delete,o=e.getChild(i);o&&!o.is(`uiElement`)&&!o.is(`rawElement`)&&this._updateElementMappings(o,n[a]),ei(r[i]),t.equal++}else t[i]++}}_updateElementMappings(e,t){this.domConverter.unbindDomElement(t),this.domConverter.bindElements(t,e),this.markedChildren.add(e),this.markedAttributes.add(e)}_getInlineFillerPosition(){let e=this.selection.getFirstPosition();return e.parent.is(`$text`)?L._createBefore(e.parent):e}_isSelectionInInlineFiller(){if(this.selection.rangeCount!=1||!this.selection.isCollapsed)return!1;let e=this.selection.getFirstPosition(),t=this.domConverter.viewPositionToDom(e);return!!(t&&jr(t.parent)&&Zs(t.parent))}_removeInlineFiller(){let e=this._inlineFiller;if(!Zs(e))throw new w(`view-renderer-filler-was-lost`,this);Qs(e)?e.remove():e.data=e.data.substr(7),this._inlineFiller=null}_needsInlineFillerAtSelection(){if(this.selection.rangeCount!=1||!this.selection.isCollapsed)return!1;let e=this.selection.getFirstPosition(),t=e.parent,n=e.offset;if(!this.domConverter.mapViewToDom(t.root)||!t.is(`element`)||!ic(t))return!1;let r=e.nodeBefore,i=e.nodeAfter;return!(r instanceof Oo||i instanceof Oo||n===t.getFillerOffset()&&(!r||!r.is(`element`,`br`))||p.isAndroid&&(r||i))}_updateText(e,t){let n=this.domConverter.findCorrespondingDomText(e),r=this.domConverter.viewToDom(e).data,i=t.inlineFillerPosition;i&&i.parent==e.parent&&i.offset==e.index&&(r=Xs+r),this._updateTextNode(n,r)}_updateAttrs(e){let t=this.domConverter.mapViewToDom(e);if(t){for(let n of Array.from(t.attributes)){let r=n.name;e.hasAttribute(r)||this.domConverter.removeDomElementAttribute(t,r)}for(let n of e.getAttributeKeys())this.domConverter.setDomElementAttribute(t,n,e.getAttribute(n),e)}}_updateChildren(e,t){let n=this.domConverter.mapViewToDom(e);if(!n)return;if(p.isAndroid){let e=null;for(let t of Array.from(n.childNodes)){if(e&&jr(e)&&jr(t)){n.normalize();break}e=t}}let r=t.inlineFillerPosition,i=n.childNodes,a=Array.from(this.domConverter.viewChildrenToDom(e,{bind:!0}));r&&r.parent===e&&ac(n.ownerDocument,a,r.offset);let o=this._diffNodeLists(i,a),s=this._findUpdateActions(o,i,a,sc),c=0,l=new Set;for(let e of s)e===`delete`?(l.add(i[c]),ei(i[c])):(e===`equal`||e===`update`)&&c++;c=0;for(let e of s)e===`insert`?(Kr(n,c,a[c]),c++):e===`update`?(this._updateTextNode(i[c],a[c].data),c++):e===`equal`&&(this._markDescendantTextToSync(this.domConverter.domToView(a[c])),c++);for(let e of l)e.parentNode||this.domConverter.unbindDomElement(e)}_diffNodeLists(e,t){return e=uc(e,this._fakeSelectionContainer),oe(e,t,cc.bind(null,this.domConverter))}_findUpdateActions(e,t,n,r){if(e.indexOf(`insert`)===-1||e.indexOf(`delete`)===-1)return e;let i=[],a=[],o=[],s={equal:0,insert:0,delete:0};for(let c of e)c===`insert`?o.push(n[s.equal+s.insert]):c===`delete`?a.push(t[s.equal+s.delete]):(i=i.concat(oe(a,o,r).map(e=>e===`equal`?`update`:e)),i.push(`equal`),a=[],o=[]),s[c]++;return i.concat(oe(a,o,r).map(e=>e===`equal`?`update`:e))}_updateTextNode(e,t){let n=e.data;n!=t&&(p.isAndroid&&this.isComposing&&n.replace(/\u00A0/g,` `)==t.replace(/\u00A0/g,` `)||this._updateTextNodeInternal(e,t))}_updateTextNodeInternal(e,t){let n=ne(e.data,t);for(let t of n)t.type===`insert`?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(let t of e.getChildren())this._markDescendantTextToSync(t)}}_updateSelection(){if(p.isBlink&&!p.isAndroid&&this.isSelecting&&!this.markedChildren.size)return;if(this.selection.rangeCount===0){this._removeDomSelection(),this._removeFakeSelection();return}let e=this.domConverter.mapViewToDom(this.selection.editableElement);if(!this.isFocused||!e){!this.selection.isFake&&this._fakeSelectionContainer&&this._fakeSelectionContainer.isConnected&&this._removeFakeSelection();return}this.selection.isFake?this._updateFakeSelection(e):this._fakeSelectionContainer&&this._fakeSelectionContainer.isConnected?(this._removeFakeSelection(),this._updateDomSelection(e)):this.isComposing&&p.isAndroid||this._updateDomSelection(e)}_updateFakeSelection(e){let t=e.ownerDocument;this._fakeSelectionContainer||=dc(t);let n=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(n,this.selection),!this._fakeSelectionNeedsUpdate(e))return;(!n.parentElement||n.parentElement!=e)&&e.appendChild(n),n.textContent=this.selection.fakeSelectionLabel||`\xA0`;let r=t.getSelection(),i=t.createRange();r.removeAllRanges(),i.selectNodeContents(n),r.addRange(i)}_updateDomSelection(e){let t=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(t))return;let n=this.domConverter.viewPositionToDom(this.selection.anchor),r=this.domConverter.viewPositionToDom(this.selection.focus);t.setBaseAndExtent(n.parent,n.offset,r.parent,r.offset),p.isGecko&&lc(r,t)}_domSelectionNeedsUpdate(e){if(!this.domConverter.isDomSelectionCorrect(e))return!0;let t=e&&this.domConverter.domSelectionToView(e);return!(t&&this.selection.isEqual(t)||!this.selection.isCollapsed&&this.selection.isSimilar(t))}_fakeSelectionNeedsUpdate(e){let t=this._fakeSelectionContainer,n=e.ownerDocument.getSelection();return!t||t.parentElement!==e||n.anchorNode!==t&&!t.contains(n.anchorNode)?!0:t.textContent!==this.selection.fakeSelectionLabel}_removeDomSelection(){for(let e of this.domDocuments){let t=e.getSelection();if(t.rangeCount){let n=e.activeElement,r=this.domConverter.mapDomToView(n);n&&r&&t.removeAllRanges()}}}_removeFakeSelection(){let e=this._fakeSelectionContainer;e&&e.remove()}_updateFocus(){if(this.isFocused){let e=this.selection.editableElement;e&&this.domConverter.focus(e)}}};function ic(e){if(e.getAttribute(`contenteditable`)==`false`)return!1;let t=e.findAncestor(e=>e.hasAttribute(`contenteditable`));return!t||t.getAttribute(`contenteditable`)==`true`}function ac(e,t,n){let r=t instanceof Array?t:t.childNodes,i=r[n];if(jr(i))return i.data=Xs+i.data,i;{let i=e.createTextNode(Xs);return Array.isArray(t)?r.splice(n,0,i):Kr(t,n,i),i}}function oc(e,t){return vr(e)&&vr(t)&&!jr(e)&&!jr(t)&&!qr(e)&&!qr(t)&&e.tagName.toLowerCase()===t.tagName.toLowerCase()}function sc(e,t){return vr(e)&&vr(t)&&jr(e)&&jr(t)}function cc(e,t,n){return t===n?!0:jr(t)&&jr(n)?t.data===n.data:!!(e.isBlockFiller(t)&&e.isBlockFiller(n))}function lc(e,t){let n=e.parent,r=e.offset;if(jr(n)&&Qs(n)&&(r=Gr(n)+1,n=n.parentNode),n.nodeType!=Node.ELEMENT_NODE||r!=n.childNodes.length-1)return;let i=n.childNodes[r];i&&i.tagName==`BR`&&t.addRange(t.getRangeAt(0))}function uc(e,t){let n=Array.from(e);return n.length==0||!t||n[n.length-1]==t&&n.pop(),n}function dc(e){let 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=`\xA0`,t}const fc=Ys(u.document),pc=qs(u.document),mc=Js(u.document),hc=`data-ck-unsafe-attribute-`,gc=`data-ck-unsafe-element`;var _c=class{document;renderingMode;blockFillerMode;preElements;blockElements;inlineObjectElements;unsafeElements;_domDocument;_domToViewMapping=new WeakMap;_viewToDomMapping=new WeakMap;_fakeSelectionMapping=new WeakMap;_rawContentElementMatcher=new Po;_inlineObjectElementMatcher=new Po;_elementsWithTemporaryCustomProperties=new Set;constructor(e,{blockFillerMode:t,renderingMode:n=`editing`}={}){this.document=e,this.renderingMode=n,this.blockFillerMode=t||(n===`editing`?`br`:`nbsp`),this.preElements=[`pre`,`textarea`],this.blockElements=`address.article.aside.blockquote.caption.center.dd.details.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.legend.li.main.menu.nav.ol.p.pre.section.summary.table.tbody.td.tfoot.th.thead.tr.ul`.split(`.`),this.inlineObjectElements=[`object`,`iframe`,`input`,`button`,`textarea`,`select`,`option`,`video`,`embed`,`audio`,`img`,`canvas`],this.unsafeElements=[`script`,`style`],this._domDocument=this.renderingMode===`editing`?u.document:u.document.implementation.createHTMLDocument(``)}get domDocument(){return this._domDocument}bindFakeSelection(e,t){this._fakeSelectionMapping.set(e,new os(t))}fakeSelectionToView(e){return this._fakeSelectionMapping.get(e)}bindElements(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}unbindDomElement(e){let t=this._domToViewMapping.get(e);if(t){this._domToViewMapping.delete(e),this._viewToDomMapping.delete(t);for(let t of e.children)this.unbindDomElement(t)}}bindDocumentFragments(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}shouldRenderAttribute(e,t,n){return this.renderingMode===`data`?!0:(e=e.toLowerCase(),e.startsWith(`on`)||e===`srcdoc`?!1:n===`img`&&(e===`src`||e===`srcset`)||n===`source`&&e===`srcset`?!0:!t.replace(/\s+/g,``).match(/^(javascript:|data:(image\/svg|text\/x?html))/i))}setContentOf(e,t){if(this.renderingMode===`data`){e.innerHTML=t;return}let n=new DOMParser().parseFromString(t,`text/html`),r=n.createDocumentFragment(),i=n.body.childNodes;for(;i.length>0;)r.appendChild(i[0]);let a=n.createTreeWalker(r,NodeFilter.SHOW_ELEMENT),o=[],s;for(;s=a.nextNode();)o.push(s);for(let e of o){for(let t of e.getAttributeNames())this.setDomElementAttribute(e,t,e.getAttribute(t));let t=e.tagName.toLowerCase();this._shouldRenameElement(t)&&(Ec(t),e.replaceWith(this._createReplacementDomElement(t,e)))}for(;e.firstChild;)e.firstChild.remove();e.append(r)}viewToDom(e,t={}){if(e.is(`$text`)){let t=this._processDataFromViewText(e);return this._domDocument.createTextNode(t)}else{let n=e;if(this.mapViewToDom(n))if(n.getCustomProperty(`editingPipeline:doNotReuseOnce`))this._elementsWithTemporaryCustomProperties.add(n);else return this.mapViewToDom(n);let r;if(n.is(`documentFragment`))r=this._domDocument.createDocumentFragment(),t.bind&&this.bindDocumentFragments(r,n);else if(n.is(`uiElement`))return r=n.name===`$comment`?this._domDocument.createComment(n.getCustomProperty(`$rawContent`)):n.render(this._domDocument,this),t.bind&&this.bindElements(r,n),r;else{this._shouldRenameElement(n.name)?(Ec(n.name),r=this._createReplacementDomElement(n.name)):r=n.hasAttribute(`xmlns`)?this._domDocument.createElementNS(n.getAttribute(`xmlns`),n.name):this._domDocument.createElement(n.name),n.is(`rawElement`)&&n.render(r,this),t.bind&&this.bindElements(r,n);for(let e of n.getAttributeKeys())this.setDomElementAttribute(r,e,n.getAttribute(e),n)}if(t.withChildren!==!1)for(let e of this.viewChildrenToDom(n,t))r instanceof HTMLTemplateElement?r.content.appendChild(e):r.appendChild(e);return r}}setDomElementAttribute(e,t,n,r){let i=this.shouldRenderAttribute(t,n,e.tagName.toLowerCase())||r&&r.shouldRenderUnsafeAttribute(t);if(i||T(`domconverter-unsafe-attribute-detected`,{domElement:e,key:t,value:n}),!Jr(t)){T(`domconverter-invalid-attribute-detected`,{domElement:e,key:t,value:n});return}e.hasAttribute(t)&&!i?e.removeAttribute(t):e.hasAttribute(hc+t)&&i&&e.removeAttribute(hc+t),e.setAttribute(i?t:hc+t,n)}removeDomElementAttribute(e,t){t!=gc&&(e.removeAttribute(t),e.removeAttribute(hc+t))}*viewChildrenToDom(e,t={}){let n=e.getFillerOffset&&e.getFillerOffset(),r=0;for(let i of e.getChildren()){n===r&&(yield this._getBlockFiller());let e=i.is(`element`)&&!!i.getCustomProperty(`dataPipeline:transparentRendering`)&&!j(i.getAttributes());if(e&&this.renderingMode==`data`)if(i.is(`rawElement`)){let e=this._domDocument.createElement(i.name);i.render(e,this),yield*[...e.childNodes]}else yield*this.viewChildrenToDom(i,t);else e&&T(`domconverter-transparent-rendering-unsupported-in-editing-pipeline`,{viewElement:i}),yield this.viewToDom(i,t);r++}n===r&&(yield this._getBlockFiller())}viewRangeToDom(e){let t=this.viewPositionToDom(e.start),n=this.viewPositionToDom(e.end),r=this._domDocument.createRange();return r.setStart(t.parent,t.offset),r.setEnd(n.parent,n.offset),r}viewPositionToDom(e){let t=e.parent;if(t.is(`$text`)){let n=this.findCorrespondingDomText(t);if(!n)return null;let r=e.offset;return Zs(n)&&(r+=7),n.data&&r>n.data.length&&(r=n.data.length),{parent:n,offset:r}}else{let n,r,i;if(e.offset===0){if(n=this.mapViewToDom(t),!n)return null;i=n.childNodes[0]}else{let t=e.nodeBefore;if(r=t.is(`$text`)?this.findCorrespondingDomText(t):this.mapViewToDom(t),!r)return null;n=r.parentNode,i=r.nextSibling}if(jr(i)&&Zs(i))return{parent:i,offset:7};let a=r?Gr(r)+1:0;return{parent:n,offset:a}}}domToView(e,t={}){let n=[],r=this._domToView(e,t,n),i=r.next().value;return!i||(r.next(),this._processDomInlineNodes(null,n,t),this.blockFillerMode==`br`&&wc(i))||i.is(`$text`)&&i.data.length==0?null:i}*domChildrenToView(e,t={},n=[]){let r=[];r=e instanceof HTMLTemplateElement?[...e.content.childNodes]:[...e.childNodes];for(let i=0;i<r.length;i++){let a=r[i],o=this._domToView(a,t,n),s=o.next().value;s!==null&&(this._isBlockViewElement(s)&&this._processDomInlineNodes(e,n,t),this.blockFillerMode==`br`&&wc(s)||(yield s),o.next())}this._processDomInlineNodes(e,n,t)}domSelectionToView(e){if(Dc(e))return new os([]);if(e.rangeCount===1){let t=e.getRangeAt(0).startContainer;jr(t)&&(t=t.parentNode);let n=this.fakeSelectionToView(t);if(n)return n}let t=this.isDomSelectionBackward(e),n=[];for(let t=0;t<e.rangeCount;t++){let r=e.getRangeAt(t),i=this.domRangeToView(r);i&&n.push(i)}return new os(n,{backward:t})}domRangeToView(e){let t=this.domPositionToView(e.startContainer,e.startOffset),n=this.domPositionToView(e.endContainer,e.endOffset);return t&&n?new R(t,n):null}domPositionToView(e,t=0){if(this.isBlockFiller(e))return this.domPositionToView(e.parentNode,Gr(e));let n=this.mapDomToView(e);if(n&&(n.is(`uiElement`)||n.is(`rawElement`)))return L._createBefore(n);if(jr(e)){if(Qs(e))return this.domPositionToView(e.parentNode,Gr(e));let n=this.findCorrespondingViewText(e),r=t;return n?(Zs(e)&&(r-=7,r=r<0?0:r),new L(n,r)):null}else{if(t===0){let t=this.mapDomToView(e);if(t)return new L(t,0)}else{let n=e.childNodes[t-1];if(jr(n)&&Qs(n)||n&&this.isBlockFiller(n))return this.domPositionToView(n.parentNode,Gr(n));let r=jr(n)?this.findCorrespondingViewText(n):this.mapDomToView(n);if(r&&r.parent)return new L(r.parent,r.index+1)}return null}}mapDomToView(e){return this.getHostViewElement(e)||this._domToViewMapping.get(e)}findCorrespondingViewText(e){if(Qs(e))return null;let t=this.getHostViewElement(e);if(t)return t;let n=e.previousSibling;if(n){if(!this.isElement(n))return null;let e=this.mapDomToView(n);if(e){let t=e.nextSibling;return t instanceof Oo?t:null}}else{let t=this.mapDomToView(e.parentNode);if(t){let e=t.getChild(0);return e instanceof Oo?e:null}}return null}mapViewToDom(e){return this._viewToDomMapping.get(e)}findCorrespondingDomText(e){let t=e.previousSibling;return t&&this.mapViewToDom(t)?this.mapViewToDom(t).nextSibling:!t&&e.parent&&this.mapViewToDom(e.parent)?this.mapViewToDom(e.parent).childNodes[0]:null}focus(e){let t=this.mapViewToDom(e);if(!t||t.ownerDocument.activeElement===t)return;let{scrollX:n,scrollY:r}=u.window,i=[];yc(t,e=>{let{scrollLeft:t,scrollTop:n}=e;i.push([t,n])}),t.focus({preventScroll:!0}),yc(t,e=>{let[t,n]=i.shift();e.scrollLeft=t,e.scrollTop=n}),u.window.scrollTo(n,r)}_clearDomSelection(){let e=this.mapViewToDom(this.document.selection.editableElement);if(!e)return;let t=e.ownerDocument.defaultView.getSelection(),n=this.domSelectionToView(t);n&&n.rangeCount>0&&t.removeAllRanges()}isElement(e){return e&&e.nodeType==Node.ELEMENT_NODE}isDocumentFragment(e){return e&&e.nodeType==Node.DOCUMENT_FRAGMENT_NODE}isBlockFiller(e){return this.blockFillerMode==`br`?e.isEqualNode(fc):Tc(e,this.blockElements)?!0:e.isEqualNode(mc)||bc(e,this.blockElements)}isDomSelectionBackward(e){if(e.isCollapsed)return!1;let t=this._domDocument.createRange();try{t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset)}catch{return!1}let n=t.collapsed;return t.detach(),n}getHostViewElement(e){let t=Tr(e);for(t.pop();t.length;){let e=t.pop(),n=this._domToViewMapping.get(e);if(n&&(n.is(`uiElement`)||n.is(`rawElement`)))return n}return null}isDomSelectionCorrect(e){return this._isDomSelectionPositionCorrect(e.anchorNode,e.anchorOffset)&&this._isDomSelectionPositionCorrect(e.focusNode,e.focusOffset)}registerRawContentMatcher(e){this._rawContentElementMatcher.add(e)}registerInlineObjectMatcher(e){this._inlineObjectElementMatcher.add(e)}_clearTemporaryCustomProperties(){for(let e of this._elementsWithTemporaryCustomProperties)e._removeCustomProperty(`editingPipeline:doNotReuseOnce`);this._elementsWithTemporaryCustomProperties.clear()}_getBlockFiller(){switch(this.blockFillerMode){case`nbsp`:return qs(this._domDocument);case`markedNbsp`:return Js(this._domDocument);case`br`:return Ys(this._domDocument)}}_isDomSelectionPositionCorrect(e,t){if(jr(e)&&Zs(e)&&t<7||this.isElement(e)&&Zs(e.childNodes[t]))return!1;let n=this.mapDomToView(e);return!(n&&(n.is(`uiElement`)||n.is(`rawElement`)))}*_domToView(e,t,n){if(this.blockFillerMode!=`br`&&Tc(e,this.blockElements))return null;let r=this.getHostViewElement(e);if(r)return r;if(qr(e)&&t.skipComments)return null;if(jr(e)){if(Qs(e))return null;{let t=e.data;if(t===``)return null;let r=new Oo(this.document,t);return n.push(r),r}}else{let r=this.mapDomToView(e);if(r)return this._isInlineObjectElement(r)&&n.push(r),r;if(this.isDocumentFragment(e))r=new Is(this.document),t.bind&&this.bindDocumentFragments(e,r);else{r=this._createViewElement(e,t),t.bind&&this.bindElements(e,r);let i=e.attributes;if(i)for(let e=i.length,t=0;t<e;t++)r._setAttribute(i[t].name,i[t].value);if(this._isViewElementWithRawContent(r,t))return r._setCustomProperty(`$rawContent`,e.innerHTML),this._isBlockViewElement(r)||n.push(r),r;if(qr(e))return r._setCustomProperty(`$rawContent`,e.data),r}yield r;let i=[];if(t.withChildren!==!1)for(let n of this.domChildrenToView(e,t,i))r._appendChild(n);if(this._isInlineObjectElement(r))n.push(r),this._processDomInlineNodes(null,i,t);else for(let e of i)n.push(e)}}_processDomInlineNodes(e,t,n){if(!t.length||e&&!this.isDocumentFragment(e)&&!this._isBlockDomElement(e))return;let r=!1;for(let e=0;e<t.length;e++){let i=t[e];if(!i.is(`$text`)){r=!1;continue}let a,o=!1;if(this._isPreFormatted(i))a=$s(i.data);else{a=i.data.replace(/[ \n\t\r]{1,}/g,` `),o=/[^\S\u00A0]/.test(a.charAt(a.length-1));let s=e>0?t[e-1]:null,c=e+1<t.length?t[e+1]:null,l=!s||s.is(`element`)&&s.name==`br`||r,u=c?!1:!Zs(i.data);n.withChildren!==!1&&(l&&(a=a.replace(/^ /,``)),u&&(a=a.replace(/ $/,``))),a=$s(a),this.blockFillerMode!=`br`&&i.parent&&(Cc(i.parent,a)?(a=``,i.parent.parent&&(i.parent.parent._setCustomProperty(`$hasBlockFiller`,!0),i.parent._remove())):Sc(i.parent,a,this.blockElements)&&(a=``,i.parent._setCustomProperty(`$hasBlockFiller`,!0))),a=a.replace(/ \u00A0/g,` `);let d=c&&c.is(`element`)&&c.name!=`br`,f=c&&c.is(`$text`)&&c.data.charAt(0)==` `;(/[ \u00A0]\u00A0$/.test(a)||!c||d||f)&&(a=a.replace(/\u00A0$/,` `)),(l||s&&s.is(`element`)&&s.name!=`br`)&&(a=a.replace(/^\u00A0/,` `))}a.length==0&&i.parent?(i._remove(),t.splice(e,1),e--):(i._data=a,r=o)}t.length=0}_processDataFromViewText(e){let t=e.data;if(this._isPreFormatted(e))return t;if(t.charAt(0)==` `){let n=this._getTouchingInlineViewNode(e,!1);(n&&n.is(`$textProxy`)&&this._nodeEndsWithSpace(n)||!n)&&(t=`\xA0`+t.substr(1))}if(t.charAt(t.length-1)==` `){let n=this._getTouchingInlineViewNode(e,!0),r=n&&n.is(`$textProxy`)&&n.data.charAt(0)==` `;(t.charAt(t.length-2)==` `||!n||r)&&(t=t.substr(0,t.length-1)+`\xA0`)}return t.replace(/ {2}/g,` \xA0`)}_nodeEndsWithSpace(e){if(this._isPreFormatted(e))return!1;let t=this._processDataFromViewText(e);return t.charAt(t.length-1)==` `}_isPreFormatted(e){if(vc(e,this.preElements))return!0;for(let t of e.getAncestors({parentFirst:!0}))if(!(!t.is(`element`)||!t.hasStyle(`white-space`)||t.getStyle(`white-space`)===`inherit`))return[`pre`,`pre-wrap`,`break-spaces`].includes(t.getStyle(`white-space`));return!1}_getTouchingInlineViewNode(e,t){let n=new rs({startPosition:t?L._createAfter(e):L._createBefore(e),direction:t?`forward`:`backward`});for(let{item:e}of n)if(e.is(`$textProxy`))return e;else if(e.is(`element`)&&e.getCustomProperty(`dataPipeline:transparentRendering`))continue;else if(e.is(`element`,`br`))return null;else if(this._isInlineObjectElement(e))return e;else 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`)?e.name==`br`||this.inlineObjectElements.includes(e.name)||!!this._inlineObjectElementMatcher.match(e):!1}_createViewElement(e,t){if(qr(e))return new ks(this.document,`$comment`);let n=t.keepOriginalCase?e.tagName:e.tagName.toLowerCase();return new Jo(this.document,n)}_isViewElementWithRawContent(e,t){return t.withChildren!==!1&&e.is(`element`)&&!!this._rawContentElementMatcher.match(e)}_shouldRenameElement(e){let t=e.toLowerCase();return this.renderingMode===`editing`&&this.unsafeElements.includes(t)}_createReplacementDomElement(e,t){let n=this._domDocument.createElement(`span`);if(n.setAttribute(gc,e),t){for(;t.firstChild;)n.appendChild(t.firstChild);for(let e of t.getAttributeNames())n.setAttribute(e,t.getAttribute(e))}return n}};function vc(e,t){return e.getAncestors().some(e=>e.is(`element`)&&t.includes(e.name))}function yc(e,t){let n=e;for(;n;)t(n),n=n.parentElement}function bc(e,t){return e.isEqualNode(pc)&&xc(e,t)&&e.parentNode.childNodes.length===1}function xc(e,t){let n=e.parentNode;return!!n&&!!n.tagName&&t.includes(n.tagName.toLowerCase())}function Sc(e,t,n){return t==`\xA0`&&e&&e.is(`element`)&&e.childCount==1&&n.includes(e.name)}function Cc(e,t){return t==`\xA0`&&e&&e.is(`element`,`span`)&&e.childCount==1&&e.hasAttribute(`data-cke-filler`)}function wc(e){return e.is(`element`,`br`)&&e.hasAttribute(`data-cke-filler`)}function Tc(e,t){return e.tagName===`BR`&&xc(e,t)&&e.parentNode.childNodes.length===1}function Ec(e){e===`script`&&T(`domconverter-unsafe-script-element-detected`),e===`style`&&T(`domconverter-unsafe-style-element-detected`)}function Dc(e){if(!p.isGecko||!e.rangeCount)return!1;let t=e.getRangeAt(0).startContainer;try{Object.prototype.toString.call(t)}catch{return!0}return!1}const Oc=br();var kc=class extends Oc{view;document;_isEnabled=!1;constructor(e){super(),this.view=e,this.document=e.document}get isEnabled(){return this._isEnabled}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}destroy(){this.disable(),this.stopListening()}checkShouldIgnoreEventFromTarget(e){return e&&e.nodeType===3&&(e=e.parentNode),!e||e.nodeType!==1?!1:e.matches(`[data-cke-ignore-events], [data-cke-ignore-events] *`)}},Ac=class{view;document;domEvent;domTarget;constructor(e,t,n){this.view=e,this.document=e.document,this.domEvent=t,this.domTarget=t.target,fn(this,n)}get target(){return this.view.domConverter.mapDomToView(this.domTarget)}preventDefault(){this.domEvent.preventDefault()}stopPropagation(){this.domEvent.stopPropagation()}},jc=class extends kc{useCapture=!1;usePassive=!1;observe(e){(typeof this.domEventType==`string`?[this.domEventType]:this.domEventType).forEach(t=>{this.listenTo(e,t,(e,t)=>{this.isEnabled&&!this.checkShouldIgnoreEventFromTarget(t.target)&&this.onDomEvent(t)},{useCapture:this.useCapture,usePassive:this.usePassive})})}stopObserving(e){this.stopListening(e)}fire(e,t,n){this.isEnabled&&this.document.fire(e,new Ac(this.view,t,n))}},Mc=class extends jc{domEventType=[`keydown`,`keyup`];onDomEvent(e){let t={keyCode:e.keyCode,altKey:e.altKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,metaKey:e.metaKey,get keystroke(){return vi(this)}};this.fire(e.type,e,t)}},Nc=class extends kc{_fireSelectionChangeDoneDebounced;constructor(e){super(e),this._fireSelectionChangeDoneDebounced=Kt(e=>{this.document.fire(`selectionChangeDone`,e)},200)}observe(){let e=this.document;e.on(`arrowKey`,(t,n)=>{e.selection.isFake&&this.isEnabled&&n.preventDefault()},{context:`$capture`}),e.on(`arrowKey`,(t,n)=>{e.selection.isFake&&this.isEnabled&&this._handleSelectionMove(n.keyCode)},{priority:`lowest`})}stopObserving(){}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(e){let t=this.document.selection,n=new os(t.getRanges(),{backward:t.isBackward,fake:!1});(e==k.arrowleft||e==k.arrowup)&&n.setTo(n.getFirstPosition()),(e==k.arrowright||e==k.arrowdown)&&n.setTo(n.getLastPosition());let r={oldSelection:t,newSelection:n,domSelection:null};this.document.fire(`selectionChange`,r),this._fireSelectionChangeDoneDebounced(r)}},Pc=class extends kc{domConverter;_config;_domElements;_mutationObserver;constructor(e){super(e),this._config={childList:!0,characterData:!0,subtree:!0},this.domConverter=e.domConverter,this._domElements=new Set,this._mutationObserver=new window.MutationObserver(this._onMutations.bind(this))}flush(){this._onMutations(this._mutationObserver.takeRecords())}observe(e){this._domElements.add(e),this.isEnabled&&this._mutationObserver.observe(e,this._config)}stopObserving(e){if(this._domElements.delete(e),this.isEnabled){this._mutationObserver.disconnect();for(let e of this._domElements)this._mutationObserver.observe(e,this._config)}}enable(){super.enable();for(let e of this._domElements)this._mutationObserver.observe(e,this._config)}disable(){super.disable(),this._mutationObserver.disconnect()}destroy(){super.destroy(),this._mutationObserver.disconnect()}_onMutations(e){if(e.length===0)return;let t=this.domConverter,n=new Set,r=new Set;for(let n of e){let e=t.mapDomToView(n.target);e&&(e.is(`uiElement`)||e.is(`rawElement`)||n.type===`childList`&&!this._isBogusBrMutation(n)&&r.add(e))}for(let i of e){let e=t.mapDomToView(i.target);if(!(e&&(e.is(`uiElement`)||e.is(`rawElement`)))&&i.type===`characterData`){let e=t.findCorrespondingViewText(i.target);e&&!r.has(e.parent)?n.add(e):!e&&Zs(i.target)&&r.add(t.mapDomToView(i.target.parentNode))}}let i=[];for(let e of n)i.push({type:`text`,node:e});for(let e of r){let n=t.mapViewToDom(e);Pn(Array.from(e.getChildren()),Array.from(t.domChildrenToView(n,{withChildren:!1})),Fc)||i.push({type:`children`,node:e})}i.length&&this.document.fire(`mutations`,{mutations:i})}_isBogusBrMutation(e){let t=null;return e.nextSibling===null&&e.removedNodes.length===0&&e.addedNodes.length==1&&(t=this.domConverter.domToView(e.addedNodes[0],{withChildren:!1})),t&&t.is(`element`,`br`)}};function Fc(e,t){if(!Array.isArray(e))return e===t?!0:e.is(`$text`)&&t.is(`$text`)?e.data===t.data:!1}var Ic=class extends jc{_renderTimeoutId=null;_isFocusChanging=!1;domEventType=[`focus`,`blur`];constructor(e){super(e),this.useCapture=!0;let t=this.document;t.on(`focus`,()=>this._handleFocus()),t.on(`blur`,(e,t)=>this._handleBlur(t)),t.on(`beforeinput`,()=>{t.isFocused||this._handleFocus()},{priority:`highest`})}flush(){this._isFocusChanging&&(this._isFocusChanging=!1,this.document.isFocused=!0)}onDomEvent(e){this.fire(e.type,e)}destroy(){this._clearTimeout(),super.destroy()}_handleFocus(){this._clearTimeout(),this._isFocusChanging=!0,this._renderTimeoutId=setTimeout(()=>{this._renderTimeoutId=null,this.flush(),this.view.change(()=>{})},50)}_handleBlur(e){let t=this.document.selection.editableElement;(t===null||t===e.target)&&(this.document.isFocused=!1,this._isFocusChanging=!1,this.view.change(()=>{}))}_clearTimeout(){this._renderTimeoutId&&=(clearTimeout(this._renderTimeoutId),null)}},Lc=class extends kc{mutationObserver;focusObserver;selection;domConverter;_documents=new WeakSet;_fireSelectionChangeDoneDebounced;_clearInfiniteLoopInterval;_documentIsSelectingInactivityTimeoutDebounced;_loopbackCounter=0;_pendingSelectionChange=new Set;constructor(e){super(e),this.mutationObserver=e.getObserver(Pc),this.focusObserver=e.getObserver(Ic),this.selection=this.document.selection,this.domConverter=e.domConverter,this._fireSelectionChangeDoneDebounced=Kt(e=>{this.document.fire(`selectionChangeDone`,e)},200),this._clearInfiniteLoopInterval=setInterval(()=>this._clearInfiniteLoop(),1e3),this._documentIsSelectingInactivityTimeoutDebounced=Kt(()=>this.document.isSelecting=!1,5e3),this.view.document.on(`change:isFocused`,(e,t,n)=>{if(n&&this._pendingSelectionChange.size){for(let e of Array.from(this._pendingSelectionChange))this._handleSelectionChange(e);this._pendingSelectionChange.clear()}})}observe(e){let t=e.ownerDocument,n=()=>{this.document.isSelecting=!0,this._documentIsSelectingInactivityTimeoutDebounced()},r=()=>{this.document.isSelecting&&(this._handleSelectionChange(t),this.document.isSelecting=!1,this._documentIsSelectingInactivityTimeoutDebounced.cancel())};this.listenTo(e,`selectstart`,n,{priority:`highest`}),this.listenTo(e,`keydown`,r,{priority:`highest`,useCapture:!0}),this.listenTo(e,`keyup`,r,{priority:`highest`,useCapture:!0}),!this._documents.has(t)&&(this.listenTo(t,`mouseup`,r,{priority:`highest`,useCapture:!0}),this.listenTo(t,`selectionchange`,()=>{this.document.isComposing&&!p.isAndroid||(this._handleSelectionChange(t),this._documentIsSelectingInactivityTimeoutDebounced())}),this.listenTo(this.view.document,`compositionstart`,()=>{this._handleSelectionChange(t)},{priority:`lowest`}),this._documents.add(t))}stopObserving(e){this.stopListening(e)}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel(),this._documentIsSelectingInactivityTimeoutDebounced.cancel()}_reportInfiniteLoop(){}_handleSelectionChange(e){if(!this.isEnabled)return;let t=e.defaultView.getSelection();if(this.checkShouldIgnoreEventFromTarget(t.anchorNode))return;this.mutationObserver.flush();let n=this.domConverter.domSelectionToView(t);if(n.rangeCount==0){this.view.hasDomSelection=!1;return}if(this.view.hasDomSelection=!0,this.focusObserver.flush(),!this.view.document.isFocused&&!this.view.document.isReadOnly){this._pendingSelectionChange.add(e);return}if(this._pendingSelectionChange.delete(e),!(this.selection.isEqual(n)&&this.domConverter.isDomSelectionCorrect(t))){if(++this._loopbackCounter>60){this._reportInfiniteLoop();return}if(!Rc(n))this.view.forceRender();else if(this.selection.isSimilar(n))this.view.forceRender();else{let e={oldSelection:this.selection,newSelection:n,domSelection:t};this.document.fire(`selectionChange`,e),this._fireSelectionChangeDoneDebounced(e)}}}_clearInfiniteLoop(){this._loopbackCounter=0}};function Rc(e){return Array.from(e.getRanges()).flatMap(e=>[e.start.root,e.end.root]).every(e=>e&&e.is(`rootElement`))}var zc=class extends jc{domEventType=[`compositionstart`,`compositionupdate`,`compositionend`];constructor(e){super(e);let t=this.document;t.on(`compositionstart`,()=>{t.isComposing=!0}),t.on(`compositionend`,()=>{t.isComposing=!1})}onDomEvent(e){this.fire(e.type,e,{data:e.data})}},Bc=class{_files;_native;constructor(e,t={}){this._files=t.cacheFiles?Vc(e):null,this._native=e}get files(){return this._files||=Vc(this._native),this._files}get types(){return this._native.types}getData(e){return this._native.getData(e)}setData(e,t){this._native.setData(e,t)}set effectAllowed(e){this._native.effectAllowed=e}get effectAllowed(){return this._native.effectAllowed}set dropEffect(e){this._native.dropEffect=e}get dropEffect(){return this._native.dropEffect}setDragImage(e,t,n){this._native.setDragImage(e,t,n)}get isCanceled(){return this._native.dropEffect==`none`||!!this._native.mozUserCancelled}};function Vc(e){let t=Array.from(e.files||[]),n=Array.from(e.items||[]);return t.length?t:n.filter(e=>e.kind===`file`).map(e=>e.getAsFile())}var Hc=class extends jc{domEventType=`beforeinput`;onDomEvent(e){let t=e.getTargetRanges(),n=this.view,r=n.document,i=null,a=null,o=[];if(e.dataTransfer&&(i=new Bc(e.dataTransfer)),e.data===null?i&&(a=i.getData(`text/plain`)):a=e.data,r.selection.isFake)o=Array.from(r.selection.getRanges()),e.preventDefault();else if(t.length)o=t.map(t=>{let r=n.domConverter.domPositionToView(t.startContainer,t.startOffset),i=n.domConverter.domPositionToView(t.endContainer,t.endOffset);if(r&&Zs(t.startContainer)&&t.startOffset<7){e.preventDefault();let n=7-t.startOffset;r=r.getLastMatchingPosition(e=>!!(e.item.is(`attributeElement`)||e.item.is(`uiElement`)||e.item.is(`$textProxy`)&&n--),{direction:`backward`,singleCharacters:!0})}if(Uc(t.endContainer,t.endOffset)&&e.preventDefault(),r)return n.createRange(r,i);if(i)return n.createRange(i)}).filter(e=>!!e);else if(p.isAndroid){let t=e.target.ownerDocument.defaultView.getSelection();o=Array.from(n.domConverter.domSelectionToView(t).getRanges())}if(p.isAndroid&&e.inputType==`insertCompositionText`&&a&&a.endsWith(`
`)){this.fire(e.type,e,{inputType:`insertParagraph`,targetRanges:[n.createRange(o[0].end)]});return}if([`insertText`,`insertReplacementText`].includes(e.inputType)&&a&&a.includes(`
`)){let t=a.split(/\n{1,2}/g),n=o;e.preventDefault();for(let a=0;a<t.length;a++){let o=t[a];o!=``&&(this.fire(e.type,e,{data:o,dataTransfer:i,targetRanges:n,inputType:e.inputType,isComposing:e.isComposing}),n=[r.selection.getFirstRange()]),a+1<t.length&&(this.fire(e.type,e,{inputType:`insertParagraph`,targetRanges:n}),n=[r.selection.getFirstRange()])}return}this.fire(e.type,e,{data:a,dataTransfer:i,targetRanges:o,inputType:e.inputType,isComposing:e.isComposing})}};function Uc(e,t){for(;e.parentNode;){if(jr(e)){if(t!=e.data.length)return!1}else if(t!=e.childNodes.length)return!1;if(t=Gr(e)+1,e=e.parentNode,t<e.childNodes.length&&Zs(e.childNodes[t]))return!0}return!1}var Wc=class extends kc{constructor(e){super(e),this.document.on(`keydown`,(e,t)=>{if(this.isEnabled&&xi(t.keyCode)){let n=new ls(this.document,`arrowKey`,this.document.selection.getFirstRange());this.document.fire(n,t),n.stop.called&&e.stop()}})}observe(){}stopObserving(){}},Gc=class extends kc{constructor(e){super(e);let t=this.document;t.on(`keydown`,(e,n)=>{if(!this.isEnabled||n.keyCode!=k.tab||n.ctrlKey)return;let r=new ls(t,`tab`,t.selection.getFirstRange());t.fire(r,n),r.stop.called&&e.stop()})}observe(){}stopObserving(){}};const Kc=D();var qc=class extends Kc{document;domConverter;domRoots=new Map;_renderer;_initialDomRootAttributes=new WeakMap;_observers=new Map;_writer;_ongoingChange=!1;_postFixersInProgress=!1;_renderingDisabled=!1;_hasChangedSinceTheLastRendering=!1;constructor(e){super(),this.document=new Cs(e),this.domConverter=new _c(this.document),this.set(`isRenderingInProgress`,!1),this.set(`hasDomSelection`,!1),this._renderer=new rc(this.domConverter,this.document.selection),this._renderer.bind(`isFocused`,`isSelecting`,`isComposing`).to(this.document,`isFocused`,`isSelecting`,`isComposing`),this._writer=new Rs(this.document),this.addObserver(Pc),this.addObserver(Ic),this.addObserver(Lc),this.addObserver(Mc),this.addObserver(Nc),this.addObserver(zc),this.addObserver(Wc),this.addObserver(Hc),this.addObserver(Gc),ec(this),As(this),this.on(`render`,()=>{this._render(),this.document.fire(`layoutChanged`),this._hasChangedSinceTheLastRendering=!1}),this.listenTo(this.document.selection,`change`,()=>{this._hasChangedSinceTheLastRendering=!0}),this.listenTo(this.document,`change:isFocused`,()=>{this._hasChangedSinceTheLastRendering=!0}),p.isiOS&&this.listenTo(this.document,`blur`,(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`){let n=this.document.getRoot(t);n._name=e.tagName.toLowerCase();let r={};for(let{name:t,value:i}of Array.from(e.attributes))r[t]=i,t===`class`?this._writer.addClass(i.split(` `),n):n.hasAttribute(t)||this._writer.setAttribute(t,i,n);this._initialDomRootAttributes.set(e,r);let i=()=>{this._writer.setAttribute(`contenteditable`,(!n.isReadOnly).toString(),n),n.isReadOnly?this._writer.addClass(`ck-read-only`,n):this._writer.removeClass(`ck-read-only`,n)};i(),this.domRoots.set(t,e),this.domConverter.bindElements(e,n),this._renderer.markToSync(`children`,n),this._renderer.markToSync(`attributes`,n),this._renderer.domDocuments.add(e.ownerDocument),n.on(`change:children`,(e,t)=>this._renderer.markToSync(`children`,t)),n.on(`change:attributes`,(e,t)=>this._renderer.markToSync(`attributes`,t)),n.on(`change:text`,(e,t)=>this._renderer.markToSync(`text`,t)),n.on(`change:isReadOnly`,()=>this.change(i)),n.on(`change`,()=>{this._hasChangedSinceTheLastRendering=!0});for(let n of this._observers.values())n.observe(e,t)}detachDomRoot(e){let t=this.domRoots.get(e);Array.from(t.attributes).forEach(({name:e})=>t.removeAttribute(e));let n=this._initialDomRootAttributes.get(t);for(let e in n)t.setAttribute(e,n[e]);this.domRoots.delete(e),this.domConverter.unbindDomElement(t);for(let 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(let[e,n]of this.domRoots)t.observe(n,e);return t.enable(),t}getObserver(e){return this._observers.get(e)}disableObservers(){for(let e of this._observers.values())e.disable()}enableObservers(){for(let e of this._observers.values())e.enable()}scrollToTheSelection({alignToTop:e,forceScroll:t,viewportOffset:n=20,ancestorOffset:r=20}={}){let i=this.document.selection.getFirstRange();if(!i)return;let a=Rt({alignToTop:e,forceScroll:t,viewportOffset:n,ancestorOffset:r});typeof n==`number`&&(n={top:n,bottom:n,left:n,right:n});let o={target:this.domConverter.viewRangeToDom(i),viewportOffset:n,ancestorOffset:r,alignToTop:e,forceScroll:t};this.fire(`scrollToTheSelection`,o,a),ni(o)}focus(){if(!this.document.isFocused){let e=this.document.selection.editableElement;e&&(this.domConverter.focus(e),this.forceRender())}}change(e){if(this.isRenderingInProgress||this._postFixersInProgress)throw new w(`cannot-change-view-tree`,this);try{if(this._ongoingChange)return e(this._writer);this._ongoingChange=!0;let 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){w.rethrowUnexpectedError(e,this)}}forceRender(){this._hasChangedSinceTheLastRendering=!0,this.getObserver(Ic).flush(),this.change(()=>{})}destroy(){for(let e of this._observers.values())e.destroy();this.document.destroy(),this.stopListening()}createPositionAt(e,t){return L._createAt(e,t)}createPositionAfter(e){return L._createAfter(e)}createPositionBefore(e){return L._createBefore(e)}createRange(e,t){return new R(e,t)}createRangeOn(e){return R._createOn(e)}createRangeIn(e){return R._createIn(e)}createSelection(...e){return new os(...e)}_disableRendering(e){this._renderingDisabled=e,e==0&&this.change(()=>{})}_render(){this.isRenderingInProgress=!0,this.disableObservers(),this._renderer.render(),this.enableObservers(),this.isRenderingInProgress=!1}},Jc=class{is(){throw Error(`is() method is abstract`)}},Yc=class extends Jc{textNode;data;offsetInText;constructor(e,t,n){if(super(),this.textNode=e,t<0||t>e.offsetSize)throw new w(`model-textproxy-wrong-offsetintext`,this);if(n<0||t+n>e.offsetSize)throw new w(`model-textproxy-wrong-length`,this);this.data=e.data.substring(t,t+n),this.offsetInText=t}get startOffset(){return this.textNode.startOffset===null?null:this.textNode.startOffset+this.offsetInText}get offsetSize(){return this.data.length}get endOffset(){return this.startOffset===null?null:this.startOffset+this.offsetSize}get isPartial(){return this.offsetSize!==this.textNode.offsetSize}get parent(){return this.textNode.parent}get root(){return this.textNode.root}getPath(){let e=this.textNode.getPath();return e.length>0&&(e[e.length-1]+=this.offsetInText),e}getAncestors(e={}){let t=[],n=e.includeSelf?this:this.parent;for(;n;)t[e.parentFirst?`push`:`unshift`](n),n=n.parent;return t}hasAttribute(e){return this.textNode.hasAttribute(e)}getAttribute(e){return this.textNode.getAttribute(e)}getAttributes(){return this.textNode.getAttributes()}getAttributeKeys(){return this.textNode.getAttributeKeys()}};Yc.prototype.is=function(e){return e===`$textProxy`||e===`model:$textProxy`||e===`textProxy`||e===`model:textProxy`};var Xc=class{direction;boundaries;singleCharacters;shallow;ignoreElementEnd;_position;_boundaryStartParent;_boundaryEndParent;_visitedParent;constructor(e){if(!e||!e.boundaries&&!e.startPosition)throw new w(`model-tree-walker-no-start-position`,null);let t=e.direction||`forward`;if(t!=`forward`&&t!=`backward`)throw new w(`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=z._createAt(this.boundaries[this.direction==`backward`?`end`:`start`]),this.position.stickiness=`toNone`,this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null,this._visitedParent=this.position.parent}[Symbol.iterator](){return this}get position(){return this._position}skip(e){let t,n,r,i;do r=this.position,i=this._visitedParent,{done:t,value:n}=this.next();while(!t&&e(n));t||(this._position=r,this._visitedParent=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(),this._visitedParent=e.parent}next(){return this.direction==`forward`?this._next():this._previous()}_next(){let e=this.position,t=this.position.clone(),n=this._visitedParent;if(n.parent===null&&t.offset===n.maxOffset||n===this._boundaryEndParent&&t.offset==this.boundaries.end.offset)return{done:!0,value:void 0};let r=Qc(t,n),i=r||$c(t,n,r);if(i&&i.is(`model:element`)){if(!this.shallow)t.path.push(0),this._visitedParent=i;else{if(this.boundaries&&this.boundaries.end.isBefore(t))return{done:!0,value:void 0};t.offset++}return this._position=t,Zc(`elementStart`,i,e,t,1)}if(i&&i.is(`model:$text`)){let r;if(this.singleCharacters)r=1;else{let e=i.endOffset;this._boundaryEndParent==n&&this.boundaries.end.offset<e&&(e=this.boundaries.end.offset),r=e-t.offset}let a=new Yc(i,t.offset-i.startOffset,r);return t.offset+=r,this._position=t,Zc(`text`,a,e,t,r)}return t.path.pop(),t.offset++,this._position=t,this._visitedParent=n.parent,this.ignoreElementEnd?this._next():Zc(`elementEnd`,n,e,t)}_previous(){let e=this.position,t=this.position.clone(),n=this._visitedParent;if(n.parent===null&&t.offset===0||n==this._boundaryStartParent&&t.offset==this.boundaries.start.offset)return{done:!0,value:void 0};let r=t.parent,i=Qc(t,r),a=i||el(t,r,i);if(a&&a.is(`model:element`))return t.offset--,this.shallow?(this._position=t,Zc(`elementStart`,a,e,t,1)):(t.path.push(a.maxOffset),this._position=t,this._visitedParent=a,this.ignoreElementEnd?this._previous():Zc(`elementEnd`,a,e,t));if(a&&a.is(`model:$text`)){let r;if(this.singleCharacters)r=1;else{let e=a.startOffset;this._boundaryStartParent==n&&this.boundaries.start.offset>e&&(e=this.boundaries.start.offset),r=t.offset-e}let i=new Yc(a,t.offset-a.startOffset-r,r);return t.offset-=r,this._position=t,Zc(`text`,i,e,t,r)}return t.path.pop(),this._position=t,this._visitedParent=n.parent,Zc(`elementStart`,n,e,t,1)}};function Zc(e,t,n,r,i){return{done:!1,value:{type:e,item:t,previousPosition:n,nextPosition:r,length:i}}}var z=class e extends Jc{root;path;stickiness;constructor(e,t,n=`toNone`){if(super(),!e.is(`element`)&&!e.is(`documentFragment`))throw new w(`model-position-root-invalid`,e);if(!Array.isArray(t)||t.length===0)throw new w(`model-position-path-incorrect-format`,e,{path:t});e.is(`rootElement`)?t=t.slice():(t=[...e.getPath(),...t],e=e.root),this.root=e,this.path=t,this.stickiness=n}get offset(){return this.path[this.path.length-1]}set offset(e){this.path[this.path.length-1]=e}get parent(){let e=this.root;for(let t=0;t<this.path.length-1;t++)if(e=e.getChildAtOffset(this.path[t]),!e)throw new w(`model-position-path-incorrect`,this,{position:this});if(e.is(`$text`))throw new w(`model-position-path-incorrect`,this,{position:this});return e}get index(){return this.parent.offsetToIndex(this.offset)}get textNode(){return Qc(this,this.parent)}get nodeAfter(){let e=this.parent;return $c(this,e,Qc(this,e))}get nodeBefore(){let e=this.parent;return el(this,e,Qc(this,e))}get isAtStart(){return this.offset===0}get isAtEnd(){return this.offset==this.parent.maxOffset}isValid(){if(this.offset<0)return!1;let e=this.root;for(let t=0;t<this.path.length-1;t++)if(e=e.getChildAtOffset(this.path[t]),!e)return!1;return this.offset<=e.maxOffset}compareWith(e){if(this.root!=e.root)return`different`;let t=fr(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;let n=new Xc(t);return n.skip(e),n.position}getParentPath(){return this.path.slice(0,-1)}getAncestors(){let e=this.parent;return e.is(`documentFragment`)?[e]:e.getAncestors({includeSelf:!0})}findAncestor(e){let t=this.parent;return t.is(`element`)?t.findAncestor(e,{includeSelf:!0}):null}getCommonPath(e){if(this.root!=e.root)return[];let t=fr(this.path,e.path),n=typeof t==`string`?Math.min(this.path.length,e.path.length):t;return this.path.slice(0,n)}getCommonAncestor(e){let t=this.getAncestors(),n=e.getAncestors(),r=0;for(;t[r]==n[r]&&t[r];)r++;return r===0?null:t[r-1]}getShiftedBy(e){let t=this.clone(),n=t.offset+e;return t.offset=n<0?0:n,t}isAfter(e){return this.compareWith(e)==`after`}isBefore(e){return this.compareWith(e)==`before`}isEqual(e){return this.compareWith(e)==`same`}isTouching(e){if(this.root!==e.root)return!1;let t=Math.min(this.path.length,e.path.length);for(let n=0;n<t;n++){let t=this.path[n]-e.path[n];if(t<-1||t>1)return!1;if(t===1)return tl(e,this,n);if(t===-1)return tl(this,e,n)}return this.path.length===e.path.length?!0:this.path.length>e.path.length?nl(this.path,t):nl(e.path,t)}hasSameParentAs(e){return this.root===e.root?fr(this.getParentPath(),e.getParentPath())==`same`:!1}getTransformedByOperation(t){let n;switch(t.type){case`insert`:n=this._getTransformedByInsertOperation(t);break;case`move`:case`remove`:case`reinsert`:n=this._getTransformedByMoveOperation(t);break;case`split`:n=this._getTransformedBySplitOperation(t);break;case`merge`:n=this._getTransformedByMergeOperation(t);break;default:n=e._createAt(this);break}return n}_getTransformedByInsertOperation(e){return this._getTransformedByInsertion(e.position,e.howMany)}_getTransformedByMoveOperation(e){return this._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany)}_getTransformedBySplitOperation(e){let t=e.movedRange;return t.containsPosition(this)||t.start.isEqual(this)&&this.stickiness==`toNext`?this._getCombined(e.splitPosition,e.moveTargetPosition):e.graveyardPosition?this._getTransformedByMove(e.graveyardPosition,e.insertionPosition,1):this._getTransformedByInsertion(e.insertionPosition,1)}_getTransformedByMergeOperation(t){let n=t.movedRange,r=n.containsPosition(this)||n.start.isEqual(this),i;return r?(i=this._getCombined(t.sourcePosition,t.targetPosition),t.sourcePosition.isBefore(t.targetPosition)&&(i=i._getTransformedByDeletion(t.deletionPosition,1))):i=this.isEqual(t.deletionPosition)?e._createAt(t.deletionPosition):this._getTransformedByMove(t.deletionPosition,t.graveyardPosition,1),i}_getTransformedByDeletion(t,n){let r=e._createAt(this);if(this.root!=t.root)return r;if(fr(t.getParentPath(),this.getParentPath())==`same`){if(t.offset<this.offset){if(t.offset+n>this.offset)return null;r.offset-=n}}else if(fr(t.getParentPath(),this.getParentPath())==`prefix`){let e=t.path.length-1;if(t.offset<=this.path[e]){if(t.offset+n>this.path[e])return null;r.path[e]-=n}}return r}_getTransformedByInsertion(t,n){let r=e._createAt(this);if(this.root!=t.root)return r;if(fr(t.getParentPath(),this.getParentPath())==`same`)(t.offset<this.offset||t.offset==this.offset&&this.stickiness!=`toPrevious`)&&(r.offset+=n);else if(fr(t.getParentPath(),this.getParentPath())==`prefix`){let e=t.path.length-1;t.offset<=this.path[e]&&(r.path[e]+=n)}return r}_getTransformedByMove(t,n,r){if(n=n._getTransformedByDeletion(t,r),t.isEqual(n))return e._createAt(this);let i=this._getTransformedByDeletion(t,r);return i===null||t.isEqual(this)&&this.stickiness==`toNext`||t.getShiftedBy(r).isEqual(this)&&this.stickiness==`toPrevious`?this._getCombined(t,n):i._getTransformedByInsertion(n,r)}_getCombined(t,n){let r=t.path.length-1,i=e._createAt(n);return i.stickiness=this.stickiness,i.offset=i.offset+this.path[r]-t.offset,i.path=[...i.path,...this.path.slice(r+1)],i}toJSON(){return{root:this.root.toJSON(),path:Array.from(this.path),stickiness:this.stickiness}}clone(){return new this.constructor(this.root,this.path,this.stickiness)}static _createAt(t,n,r=`toNone`){if(t.is(`model:position`))return new e(t.root,t.path,t.stickiness);{let e=t;if(n==`end`)n=e.maxOffset;else if(n==`before`)return this._createBefore(e,r);else if(n==`after`)return this._createAfter(e,r);else if(n!==0&&!n)throw new w(`model-createpositionat-offset-required`,[this,t]);if(!e.is(`element`)&&!e.is(`documentFragment`))throw new w(`model-position-parent-incorrect`,[this,t]);let i=e.getPath();return i.push(n),new this(e.root,i,r)}}static _createAfter(e,t){if(!e.parent)throw new w(`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 w(`model-position-before-root`,e,{root:e});return this._createAt(e.parent,e.startOffset,t)}static fromJSON(t,n){if(t.root===`$graveyard`){let r=new e(n.graveyard,t.path);return r.stickiness=t.stickiness,r}if(!n.getRoot(t.root))throw new w(`model-position-fromjson-no-root`,n,{rootName:t.root});return new e(n.getRoot(t.root),t.path,t.stickiness)}};z.prototype.is=function(e){return e===`position`||e===`model:position`};function Qc(e,t){let n=t.getChildAtOffset(e.offset);return n&&n.is(`$text`)&&n.startOffset<e.offset?n:null}function $c(e,t,n){return n===null?t.getChildAtOffset(e.offset):null}function el(e,t,n){return n===null?t.getChild(t.offsetToIndex(e.offset)-1):null}function tl(e,t,n){return!(n+1===e.path.length||!nl(t.path,n+1)||!rl(e,n+1))}function nl(e,t){for(;t<e.length;){if(e[t]!==0)return!1;t++}return!0}function rl(e,t){let n=e.parent,r=e.path.length-1,i=0;for(;r>=t;){if(e.path[r]+i!==n.maxOffset)return!1;i=1,r--,n=n.parent}return!0}var B=class e extends Jc{start;end;constructor(e,t){super(),this.start=z._createAt(e),this.end=t?z._createAt(t):z._createAt(e),this.start.stickiness=this.isCollapsed?`toNone`:`toNext`,this.end.stickiness=this.isCollapsed?`toNone`:`toPrevious`}*[Symbol.iterator](){yield*new Xc({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return fr(this.start.getParentPath(),this.end.getParentPath())==`same`}get root(){return this.start.root}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);let n=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),r=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return n&&r}containsItem(e){let t=z._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(t){let n=[];return this.isIntersecting(t)?(this.containsPosition(t.start)&&n.push(new e(this.start,t.start)),this.containsPosition(t.end)&&n.push(new e(t.end,this.end))):n.push(new e(this.start,this.end)),n}getIntersection(t){if(this.isIntersecting(t)){let n=this.start,r=this.end;return this.containsPosition(t.start)&&(n=t.start),this.containsPosition(t.end)&&(r=t.end),new e(n,r)}return null}getJoined(t,n=!1){let r=this.isIntersecting(t);if(r||=this.start.isBefore(t.start)?n?this.end.isTouching(t.start):this.end.isEqual(t.start):n?t.end.isTouching(this.start):t.end.isEqual(this.start),!r)return null;let i=this.start,a=this.end;return t.start.isBefore(i)&&(i=t.start),t.end.isAfter(a)&&(a=t.end),new e(i,a)}getMinimalFlatRanges(){let t=[],n=this.start.getCommonPath(this.end).length,r=z._createAt(this.start),i=r.parent;for(;r.path.length>n+1;){let n=i.maxOffset-r.offset;n!==0&&t.push(new e(r,r.getShiftedBy(n))),r.path=r.path.slice(0,-1),r.offset++,i=i.parent}for(;r.path.length<=this.end.path.length;){let n=this.end.path[r.path.length-1],i=n-r.offset;i!==0&&t.push(new e(r,r.getShiftedBy(i))),r.offset=n,r.path.push(0)}return t}getWalker(e={}){return e.boundaries=this,new Xc(e)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;let t=new Xc(e);for(let e of t)yield e.item}*getPositions(e={}){e.boundaries=this;let t=new Xc(e);yield t.position;for(let e of t)yield e.nextPosition}getTransformedByOperation(t){switch(t.type){case`insert`:return this._getTransformedByInsertOperation(t);case`move`:case`remove`:case`reinsert`:return this._getTransformedByMoveOperation(t);case`split`:return[this._getTransformedBySplitOperation(t)];case`merge`:return[this._getTransformedByMergeOperation(t)]}return[new e(this.start,this.end)]}getTransformedByOperations(t){let n=[new e(this.start,this.end)];for(let e of t)for(let t=0;t<n.length;t++){let r=n[t].getTransformedByOperation(e);n.splice(t,1,...r),t+=r.length-1}for(let e=0;e<n.length;e++){let t=n[e];for(let r=e+1;r<n.length;r++){let e=n[r];(t.containsRange(e)||e.containsRange(t)||t.isEqual(e))&&n.splice(r,1)}}return n}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;let e=this.start.nodeAfter,t=this.end.nodeBefore;return e&&e.is(`element`)&&e===t?e:null}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}clone(){return new this.constructor(this.start,this.end)}_getTransformedByInsertOperation(e,t=!1){return this._getTransformedByInsertion(e.position,e.howMany,t)}_getTransformedByMoveOperation(e,t=!1){let n=e.sourcePosition,r=e.howMany,i=e.targetPosition;return this._getTransformedByMove(n,i,r,t)}_getTransformedBySplitOperation(t){let n=this.start._getTransformedBySplitOperation(t),r=this.end._getTransformedBySplitOperation(t);return this.end.isEqual(t.insertionPosition)&&(r=this.end.getShiftedBy(1)),n.root!=r.root&&(r=this.end.getShiftedBy(-1)),new e(n,r)}_getTransformedByMergeOperation(t){if(this.start.isEqual(t.targetPosition)&&this.end.isEqual(t.deletionPosition))return new e(this.start);let n=this.start._getTransformedByMergeOperation(t),r=this.end._getTransformedByMergeOperation(t);return n.root!=r.root&&(r=this.end.getShiftedBy(-1)),n.isAfter(r)&&(t.sourcePosition.isBefore(t.targetPosition)?(n=z._createAt(r),n.offset=0):(t.deletionPosition.isEqual(n)||(r=t.deletionPosition),n=t.targetPosition)),new e(n,r)}_getTransformedByInsertion(t,n,r=!1){if(r&&this.containsPosition(t))return[new e(this.start,t),new e(t.getShiftedBy(n),this.end._getTransformedByInsertion(t,n))];{let r=new e(this.start,this.end);return r.start=r.start._getTransformedByInsertion(t,n),r.end=r.end._getTransformedByInsertion(t,n),[r]}}_getTransformedByMove(t,n,r,i=!1){if(this.isCollapsed)return[new e(this.start._getTransformedByMove(t,n,r))];let a=e._createFromPositionAndShift(t,r),o=n._getTransformedByDeletion(t,r);if(this.containsPosition(n)&&!i&&(a.containsPosition(this.start)||a.containsPosition(this.end)))return[new e(this.start._getTransformedByMove(t,n,r),this.end._getTransformedByMove(t,n,r))];let s,c=this.getDifference(a),l=null,u=this.getIntersection(a);if(c.length==1?l=new e(c[0].start._getTransformedByDeletion(t,r),c[0].end._getTransformedByDeletion(t,r)):c.length==2&&(l=new e(this.start,this.end._getTransformedByDeletion(t,r))),s=l?l._getTransformedByInsertion(o,r,u!==null||i):[],u){let t=new e(u.start._getCombined(a.start,o),u.end._getCombined(a.start,o));s.length==2?s.splice(1,0,t):s.push(t)}return s}_getTransformedByDeletion(t,n){let r=this.start._getTransformedByDeletion(t,n),i=this.end._getTransformedByDeletion(t,n);return r==null&&i==null?null:(r??=t,i??=t,new e(r,i))}static _createFromPositionAndShift(e,t){let n=e,r=e.getShiftedBy(t);return t>0?new this(n,r):new this(r,n)}static _createIn(e){return new this(z._createAt(e,0),z._createAt(e,e.maxOffset))}static _createOn(e){return this._createFromPositionAndShift(z._createBefore(e),e.offsetSize)}static _createFromRanges(e){if(e.length===0)throw new w(`range-create-from-ranges-empty-array`,null);if(e.length==1)return e[0].clone();let t=e[0];e.sort((e,t)=>e.start.isAfter(t.start)?1:-1);let n=e.indexOf(t),r=new this(t.start,t.end);for(let t=n-1;t>=0&&e[t].end.isEqual(r.start);t--)r.start=z._createAt(e[t].start);for(let t=n+1;t<e.length&&e[t].start.isEqual(r.end);t++)r.end=z._createAt(e[t].end);return r}static fromJSON(e,t){return new this(z.fromJSON(e.start,t),z.fromJSON(e.end,t))}};B.prototype.is=function(e){return e===`range`||e===`model:range`};const il=E(),al=E();var ol=class extends il{_modelToViewMapping=new WeakMap;_viewToModelMapping=new WeakMap;_viewToModelLengthCallbacks=new Map;_markerNameToElements=new Map;_elementToMarkerNames=new Map;_deferredBindingRemovals=new Map;_unboundMarkerNames=new Set;_cache=new sl;constructor(){super(),this.on(`modelToViewPosition`,(e,t)=>{if(t.viewPosition)return;let n=this._modelToViewMapping.get(t.modelPosition.parent);if(!n)throw new w(`mapping-model-position-view-parent-not-found`,this,{modelPosition:t.modelPosition});t.viewPosition=this.findPositionIn(n,t.modelPosition.offset)},{priority:`low`}),this.on(`viewToModelPosition`,(e,t)=>{if(t.modelPosition)return;let n=this.findMappedViewAncestor(t.viewPosition),r=this._viewToModelMapping.get(n),i=this._toModelOffset(t.viewPosition.parent,t.viewPosition.offset,n);t.modelPosition=z._createAt(r,i)},{priority:`low`})}bindElements(e,t){this._modelToViewMapping.set(e,t),this._viewToModelMapping.set(t,e)}unbindViewElement(e,t={}){let n=this.toModelElement(e);if(this._elementToMarkerNames.has(e))for(let t of this._elementToMarkerNames.get(e))this._unboundMarkerNames.add(t);t.defer?this._deferredBindingRemovals.set(e,e.root):(this._viewToModelMapping.delete(e)&&this._cache.stopTracking(e),this._modelToViewMapping.get(n)==e&&this._modelToViewMapping.delete(n))}unbindModelElement(e){let t=this.toViewElement(e);this._modelToViewMapping.delete(e),this._viewToModelMapping.get(t)==e&&this._viewToModelMapping.delete(t)&&this._cache.stopTracking(t)}bindElementToMarker(e,t){let n=this._markerNameToElements.get(t)||new Set;n.add(e);let r=this._elementToMarkerNames.get(e)||new Set;r.add(t),this._markerNameToElements.set(t,n),this._elementToMarkerNames.set(e,r)}unbindElementFromMarkerName(e,t){let n=this._markerNameToElements.get(t);n&&(n.delete(e),n.size==0&&this._markerNameToElements.delete(t));let r=this._elementToMarkerNames.get(e);r&&(r.delete(t),r.size==0&&this._elementToMarkerNames.delete(e))}flushUnboundMarkerNames(){let e=Array.from(this._unboundMarkerNames);return this._unboundMarkerNames.clear(),e}flushDeferredBindings(){for(let[e,t]of this._deferredBindingRemovals)e.root==t&&this.unbindViewElement(e);this._deferredBindingRemovals=new Map}clearBindings(){this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._unboundMarkerNames=new Set,this._deferredBindingRemovals=new Map}toModelElement(e){return this._viewToModelMapping.get(e)}toViewElement(e){return this._modelToViewMapping.get(e)}toModelRange(e){return new B(this.toModelPosition(e.start),this.toModelPosition(e.end))}toViewRange(e){return new R(this.toViewPosition(e.start),this.toViewPosition(e.end))}toModelPosition(e){let t={viewPosition:e,mapper:this};return this.fire(`viewToModelPosition`,t),t.modelPosition}toViewPosition(e,t={}){let n={modelPosition:e,mapper:this,isPhantom:t.isPhantom};return this.fire(`modelToViewPosition`,n),n.viewPosition}markerNameToElements(e){let t=this._markerNameToElements.get(e);if(!t)return null;let n=new Set;for(let e of t)if(e.is(`attributeElement`))for(let t of e.getElementsWithSameId())n.add(t);else n.add(e);return n}registerViewToModelLength(e,t){this._viewToModelLengthCallbacks.set(e,t)}findMappedViewAncestor(e){let t=e.parent;for(;!this._viewToModelMapping.has(t);)t=t.parent;return t}_toModelOffset(e,t,n){if(n!=e)return this._toModelOffset(e.parent,e.index,n)+this._toModelOffset(e,t,e);if(e.is(`$text`))return t;let r=0;for(let n=0;n<t;n++)r+=this.getModelLength(e.getChild(n));return r}getModelLength(e){let t=[e],n=0;for(;t.length>0;){let e=t.pop(),r=e.name&&this._viewToModelLengthCallbacks.size>0&&this._viewToModelLengthCallbacks.get(e.name);if(r)n+=r(e);else if(this._viewToModelMapping.has(e))n+=1;else if(e.is(`$text`))n+=e.data.length;else if(e.is(`uiElement`))continue;else for(let n of e.getChildren())t.push(n)}return n}findPositionIn(e,t){if(t===0)return this._moveViewPositionToTextNode(new L(e,0));if(this._viewToModelLengthCallbacks.size==0&&this._viewToModelMapping.has(e)){let n=this._cache.getClosest(e,t);return this._findPositionStartingFrom(n.viewPosition,n.modelOffset,t,e,!0)}else return this._findPositionStartingFrom(new L(e,0),0,t,e,!1)}_findPositionStartingFrom(e,t,n,r,i){let a=e.parent,o=e.offset;if(a.is(`$text`))return new L(a,n-t);let s,c=t,l=0;for(;c<n;){if(s=a.getChild(o),!s){if(a==r)throw new w(`mapping-model-offset-not-found`,this,{modelOffset:n,viewContainer:r});o=a.parent.getChildIndex(a)+1,a=a.parent,i&&this._cache.save(a,o,r,c);continue}l=i?this._getModelLengthAndCache(s,r,c):this.getModelLength(s),c+=l,o++}let u=new L(a,o);if(i)for(;u.isAtEnd&&u.parent!==r&&u.parent.parent;){let e=u.parent.parent,t=e.getChildIndex(u.parent)+1;this._cache.save(e,t,r,c),u=new L(e,t)}return c==n?this._moveViewPositionToTextNode(u):this._findPositionStartingFrom(new L(s,0),c-l,n,r,i)}_getModelLengthAndCache(e,t,n){let r=0;if(this._viewToModelMapping.has(e))r=1;else if(e.is(`$text`))r=e.data.length;else if(!e.is(`uiElement`))for(let i of e.getChildren())r+=this._getModelLengthAndCache(i,t,n+r);return this._cache.save(e.parent,e.index+1,t,n+r),r}_moveViewPositionToTextNode(e){let t=e.nodeBefore,n=e.nodeAfter;return t&&t.is(`view:$text`)?new L(t,t.data.length):n&&n.is(`view:$text`)?new L(n,0):e}},sl=class extends al{_cachedMapping=new WeakMap;_nodeToCacheListIndex=new WeakMap;_invalidateOnChildrenChangeCallback=(e,t,n)=>{this._clearCacheInsideParent(t,n.index)};_invalidateOnTextChangeCallback=(e,t)=>{this._clearCacheAfter(t)};save(e,t,n,r){let i=this._cachedMapping.get(n),a=i.cacheMap.get(r);if(a){let n=e.getChild(t-1),r=a.viewPosition.nodeBefore?this._nodeToCacheListIndex.get(a.viewPosition.nodeBefore):0;this._nodeToCacheListIndex.set(n,r);return}let o={viewPosition:new L(e,t),modelOffset:r};i.maxModelOffset=r>i.maxModelOffset?r:i.maxModelOffset,i.cacheMap.set(r,o);let s=i.cacheList.length-1;for(;s>=0&&i.cacheList[s].modelOffset>r;)s--;if(i.cacheList.splice(s+1,0,o),t>0){let n=e.getChild(t-1);this._nodeToCacheListIndex.set(n,s+1)}}getClosest(e,t){let n=this._cachedMapping.get(e),r;return r=n?t>n.maxModelOffset?n.cacheList[n.cacheList.length-1]:n.cacheMap.get(t)||this._findInCacheList(n.cacheList,t):this.startTracking(e),{modelOffset:r.modelOffset,viewPosition:r.viewPosition.clone()}}startTracking(e){let t={viewPosition:new L(e,0),modelOffset:0},n={maxModelOffset:0,cacheList:[t],cacheMap:new Map([[0,t]])};return this._cachedMapping.set(e,n),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(t==0)this._cachedMapping.has(e)?this._clearCacheAll(e):this._clearCacheInsideParent(e.parent,e.index);else{let n=e.getChild(t-1);this._clearCacheAfter(n)}}_clearCacheAll(e){let 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){let t=this._nodeToCacheListIndex.get(e);if(t===void 0){let t=e.parent;this._cachedMapping.has(t)||this._clearCacheInsideParent(t.parent,t.index);return}let n=e.parent;for(;!this._cachedMapping.has(n);)n=n.parent;this._clearCacheFromCacheIndex(n,t)}_clearCacheFromCacheIndex(e,t){t===0&&(t=1);let n=this._cachedMapping.get(e),r=n.cacheList[t-1];if(!r)return;n.maxModelOffset=r.modelOffset;let i=n.cacheList.splice(t);for(let e of i){n.cacheMap.delete(e.modelOffset);let t=e.viewPosition.nodeBefore;this._nodeToCacheListIndex.delete(t)}}_findInCacheList(e,t){let n=0,r=e.length-1,i=r-n>>1,a=e[i];for(;n<r;)a.modelOffset<t?n=i+1:r=i-1,i=n+(r-n>>1),a=e[i];return a.modelOffset<=t?a:e[i-1]}},cl=class{_consumable=new Map;_textProxyRegistry=new Map;add(e,t){t=ll(t),e instanceof Yc&&(e=this._getSymbolForTextProxy(e)),this._consumable.has(e)||this._consumable.set(e,new Map),this._consumable.get(e).set(t,!0)}consume(e,t){return t=ll(t),e instanceof Yc&&(e=this._getSymbolForTextProxy(e)),this.test(e,t)?(this._consumable.get(e).set(t,!1),!0):!1}test(e,t){t=ll(t),e instanceof Yc&&(e=this._getSymbolForTextProxy(e));let n=this._consumable.get(e);if(n===void 0)return null;let r=n.get(t);return r===void 0?null:r}revert(e,t){t=ll(t),e instanceof Yc&&(e=this._getSymbolForTextProxy(e));let n=this.test(e,t);return n===!1?(this._consumable.get(e).set(t,!0),!0):n===!0?!1:null}verifyAllConsumed(e){let t=[];for(let[n,r]of this._consumable)for(let[i,a]of r){let r=i.split(`:`)[0];a&&e==r&&t.push({event:i,item:n.name||n.description})}if(t.length)throw new w(`conversion-model-consumable-not-consumed`,null,{items:t})}_getSymbolForTextProxy(e){let t=null,n=this._textProxyRegistry.get(e.startOffset);if(n){let r=n.get(e.endOffset);r&&(t=r.get(e.parent))}return t||=this._addSymbolForTextProxy(e),t}_addSymbolForTextProxy(e){let t=e.startOffset,n=e.endOffset,r=e.parent,i=Symbol(`$textProxy:`+e.data),a,o;return a=this._textProxyRegistry.get(t),a||(a=new Map,this._textProxyRegistry.set(t,a)),o=a.get(n),o||(o=new Map,a.set(n,o)),o.set(r,i),i}};function ll(e){let t=e.split(`:`);return t[0]==`insert`?t[0]:t[0]==`addMarker`||t[0]==`removeMarker`?e:t.length>1?t[0]+`:`+t[1]:t[0]}function ul([e,t],[n,r]){if(t.end.compareWith(r.start)!==`after`)return 1;if(t.start.compareWith(r.end)!==`before`)return-1;switch(t.start.compareWith(r.start)){case`before`:return 1;case`after`:return-1;default:switch(t.end.compareWith(r.end)){case`before`:return-1;case`after`:return 1;default:return n.localeCompare(e)}}}const dl=E();var fl=class extends dl{_conversionApi;_firedEventsMap;constructor(e){super(),this._conversionApi={dispatcher:this,...e},this._firedEventsMap=new WeakMap}convertChanges(e,t,n){let r=e.getRefreshedItems(),i=this._createConversionApi(n,r);for(let t of e.getMarkersToRemove())this._convertMarkerRemove(t.name,t.range,i);let a=this._reduceChanges(e.getChanges(),r);for(let e of a)e.type===`insert`?this._convertInsert(B._createFromPositionAndShift(e.position,e.length),i):e.type===`reinsert`?this._convertReinsert(B._createFromPositionAndShift(e.position,e.length),i):e.type===`remove`?this._convertRemove(e.position,e.length,e.name,i):this._convertAttribute(e.range,e.attributeKey,e.attributeOldValue,e.attributeNewValue,i);i.mapper.flushDeferredBindings();for(let e of i.mapper.flushUnboundMarkerNames()){let n=t.get(e).getRange();this._convertMarkerRemove(e,n,i),this._convertMarkerAdd(e,n,i)}let o=e.getMarkersToAdd().sort((e,t)=>ul([e.name,e.range],[t.name,t.range]));for(let e of o)this._convertMarkerAdd(e.name,e.range,i);i.consumable.verifyAllConsumed(`insert`)}convert(e,t,n,r={}){let i=this._createConversionApi(n,void 0,r);this._convertInsert(e,i);for(let[e,n]of Array.from(t).sort(ul))this._convertMarkerAdd(e,n,i);i.consumable.verifyAllConsumed(`insert`)}convertSelection(e,t,n){let r=this._createConversionApi(n);this.fire(`cleanSelection`,{selection:e},r);let i=e.getFirstPosition().root;if(!r.mapper.toViewElement(i))return;let a=Array.from(t.getMarkersAtPosition(e.getFirstPosition()));if(this._addConsumablesForSelection(r.consumable,e,a),this.fire(`selection`,{selection:e},r),e.isCollapsed){for(let t of a)if(r.consumable.test(e,`addMarker:`+t.name)){let n=t.getRange();if(!pl(e.getFirstPosition(),t,r.mapper))continue;let i={item:e,markerName:t.name,markerRange:n};this.fire(`addMarker:${t.name}`,i,r)}for(let t of e.getAttributeKeys())if(r.consumable.test(e,`attribute:`+t)){let n={item:e,range:e.getFirstRange(),attributeKey:t,attributeOldValue:null,attributeNewValue:e.getAttribute(t)};this.fire(`attribute:${t}:$text`,n,r)}}}_convertInsert(e,t,n={}){n.doNotAddConsumables||this._addConsumablesForInsert(t.consumable,e);for(let n of e.getWalker({shallow:!0}))this._testAndFire(`insert`,hl(n),t)}_convertRemove(e,t,n,r){this.fire(`remove:${n}`,{position:e,length:t},r)}_convertAttribute(e,t,n,r,i){this._addConsumablesForRange(i.consumable,e,`attribute:${t}`);for(let a of e){let e={item:a.item,range:B._createFromPositionAndShift(a.previousPosition,a.length),attributeKey:t,attributeOldValue:n,attributeNewValue:r};this._testAndFire(`attribute:${t}`,e,i)}}_convertReinsert(e,t){let n=Array.from(e.getWalker({shallow:!0}));this._addConsumablesForInsert(t.consumable,n);for(let e of n.map(hl))this.fire(`remove:${e.item.is(`element`)?e.item.name:`$text`}`,{position:e.range.start,length:e.item.offsetSize,reconversion:!0},t),this._testAndFire(`insert`,{...e,reconversion:!0},t)}_convertMarkerAdd(e,t,n){if(t.root.rootName==`$graveyard`)return;let r=`addMarker:${e}`;if(n.consumable.add(t,r),this.fire(r,{markerName:e,markerRange:t},n),n.consumable.consume(t,r)){this._addConsumablesForRange(n.consumable,t,r);for(let i of t.getItems()){if(!n.consumable.test(i,r))continue;let a={item:i,range:B._createOn(i),markerName:e,markerRange:t};this.fire(r,a,n)}}}_convertMarkerRemove(e,t,n){t.root.rootName!=`$graveyard`&&this.fire(`removeMarker:${e}`,{markerName:e,markerRange:t},n)}_reduceChanges(e,t){let n={changes:e,refreshedItems:t};return this.fire(`reduceChanges`,n),n.changes}_addConsumablesForInsert(e,t){for(let n of t){let t=n.item;if(e.test(t,`insert`)===null){e.add(t,`insert`);for(let n of t.getAttributeKeys())e.add(t,`attribute:`+n)}}return e}_addConsumablesForRange(e,t,n){for(let r of t.getItems())e.add(r,n);return e}_addConsumablesForSelection(e,t,n){e.add(t,`selection`);for(let r of n)e.add(t,`addMarker:`+r.name);for(let n of t.getAttributeKeys())e.add(t,`attribute:`+n);return e}_testAndFire(e,t,n){let r=ml(e,t),i=t.item.is(`$textProxy`)?n.consumable._getSymbolForTextProxy(t.item):t.item,a=this._firedEventsMap.get(n),o=a.get(i);if(!o)a.set(i,new Set([r]));else if(!o.has(r))o.add(r);else return;this.fire(r,t,n)}_testAndFireAddAttributes(e,t){let n={item:e,range:B._createOn(e)};for(let e of n.item.getAttributeKeys())n.attributeKey=e,n.attributeOldValue=null,n.attributeNewValue=n.item.getAttribute(e),this._testAndFire(`attribute:${e}`,n,t)}_createConversionApi(e,t=new Set,n={}){let r={...this._conversionApi,consumable:new cl,writer:e,options:n,convertItem:e=>this._convertInsert(B._createOn(e),r),convertChildren:e=>this._convertInsert(B._createIn(e),r,{doNotAddConsumables:!0}),convertAttributes:e=>this._testAndFireAddAttributes(e,r),canReuseView:e=>!t.has(r.mapper.toModelElement(e))};return this._firedEventsMap.set(r,new Map),r}};function pl(e,t,n){let r=t.getRange(),i=Array.from(e.getAncestors());return i.shift(),i.reverse(),!i.some(e=>{if(r.containsItem(e))return!!n.toViewElement(e).getCustomProperty(`addHighlight`)})}function ml(e,t){return`${e}:${t.item.is(`element`)?t.item.name:`$text`}`}function hl(e){return{item:e.item,range:B._createFromPositionAndShift(e.previousPosition,e.length)}}var gl=class extends Jc{parent=null;_attrs;_index=null;_startOffset=null;constructor(e){super(),this._attrs=Ui(e)}get document(){return null}get index(){return this._index}get startOffset(){return this._startOffset}get offsetSize(){return 1}get endOffset(){return this.startOffset===null?null:this.startOffset+this.offsetSize}get nextSibling(){let e=this.index;return e!==null&&this.parent.getChild(e+1)||null}get previousSibling(){let e=this.index;return e!==null&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.parent===null?!1:this.root.isAttached()}getPath(){let e=[],t=this;for(;t.parent;)e.unshift(t.startOffset),t=t.parent;return e}getAncestors(e={}){let t=[],n=e.includeSelf?this:this.parent;for(;n;)t[e.parentFirst?`push`:`unshift`](n),n=n.parent;return t}getCommonAncestor(e,t={}){let n=this.getAncestors(t),r=e.getAncestors(t),i=0;for(;n[i]==r[i]&&n[i];)i++;return i===0?null:n[i-1]}isBefore(e){if(this==e||this.root!==e.root)return!1;let t=this.getPath(),n=e.getPath(),r=fr(t,n);switch(r){case`prefix`:return!0;case`extension`:return!1;default:return t[r]<n[r]}}isAfter(e){return this==e||this.root!==e.root?!1:!this.isBefore(e)}hasAttribute(e){return this._attrs.has(e)}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}toJSON(){let 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=Ui(e)}_removeAttribute(e){return this._attrs.delete(e)}_clearAttributes(){this._attrs.clear()}};gl.prototype.is=function(e){return e===`node`||e===`model:node`};const Lee=E(Jc);var _l=class e extends Lee{_lastRangeBackward=!1;_attrs=new Map;_ranges=[];constructor(...e){super(),e.length&&this.setTo(...e)}get anchor(){if(this._ranges.length>0){let e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.end:e.start}return null}get focus(){if(this._ranges.length>0){let e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.start:e.end}return null}get isCollapsed(){return this._ranges.length===1?this._ranges[0].isCollapsed:!1}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}isEqual(e){if(this.rangeCount!=e.rangeCount)return!1;if(this.rangeCount===0)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(let t of this._ranges){let n=!1;for(let r of e._ranges)if(t.isEqual(r)){n=!0;break}if(!n)return!1}return!0}*getRanges(){for(let e of this._ranges)yield new B(e.start,e.end)}getFirstRange(){let e=null;for(let t of this._ranges)(!e||t.start.isBefore(e.start))&&(e=t);return e?new B(e.start,e.end):null}getLastRange(){let e=null;for(let t of this._ranges)(!e||t.end.isAfter(e.end))&&(e=t);return e?new B(e.start,e.end):null}getFirstPosition(){let e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){let e=this.getLastRange();return e?e.end.clone():null}setTo(...t){let[n,r,i]=t;if(typeof r==`object`&&(i=r,r=void 0),n===null)this._setRanges([]);else if(n instanceof e)this._setRanges(n.getRanges(),n.isBackward);else if(n&&typeof n.getRanges==`function`)this._setRanges(n.getRanges(),n.isBackward);else if(n instanceof B)this._setRanges([n],!!i&&!!i.backward);else if(n instanceof z)this._setRanges([new B(n)]);else if(n instanceof gl){let e=!!i&&!!i.backward,t;if(r==`in`)t=B._createIn(n);else if(r==`on`)t=B._createOn(n);else if(r!==void 0)t=new B(z._createAt(n,r));else throw new w(`model-selection-setto-required-second-parameter`,[this,n]);this._setRanges([t],e)}else if(pr(n))this._setRanges(n,i&&!!i.backward);else throw new w(`model-selection-setto-not-selectable`,[this,n])}_setRanges(e,t=!1){let n=Array.from(e),r=n.some(t=>{if(!(t instanceof B))throw new w(`model-selection-set-ranges-not-range`,[this,e]);return this._ranges.every(e=>!e.isEqual(t))});n.length===this._ranges.length&&!r||(this._replaceAllRanges(n),this._lastRangeBackward=!!t,this.fire(`change:range`,{directChange:!0}))}setFocus(e,t){if(this.anchor===null)throw new w(`model-selection-setfocus-no-ranges`,[this,e]);let n=z._createAt(e,t);if(n.compareWith(this.focus)==`same`)return;let r=this.anchor;this._ranges.length&&this._popRange(),n.compareWith(r)==`before`?(this._pushRange(new B(n,r)),this._lastRangeBackward=!0):(this._pushRange(new B(r,n)),this._lastRangeBackward=!1),this.fire(`change:range`,{directChange:!0})}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}hasAttribute(e){return this._attrs.has(e)}removeAttribute(e){this.hasAttribute(e)&&(this._attrs.delete(e),this.fire(`change:attribute`,{attributeKeys:[e],directChange:!0}))}setAttribute(e,t){this.getAttribute(e)!==t&&(this._attrs.set(e,t),this.fire(`change:attribute`,{attributeKeys:[e],directChange:!0}))}getSelectedElement(){return this.rangeCount===1?this.getFirstRange().getContainedElement():null}*getSelectedBlocks(){let e=new WeakSet;for(let t of this.getRanges()){let n=yl(t.start,e);zee(n,t)&&(yield n);let r=t.getWalker();for(let n of r){let i=n.item;n.type==`elementEnd`&&Ree(i,e,t)?yield i:n.type==`elementStart`&&i.is(`model:element`)&&i.root.document.model.schema.isBlock(i)&&r.jumpTo(z._createAt(i,`end`))}let i=yl(t.end,e);Bee(i,t)&&(yield i)}}containsEntireContent(e=this.anchor.root){let t=z._createAt(e,0),n=z._createAt(e,`end`);return t.isTouching(this.getFirstPosition())&&n.isTouching(this.getLastPosition())}toJSON(){let 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=!0),e}_pushRange(e){this._checkRange(e),this._ranges.push(new B(e.start,e.end))}_checkRange(e){for(let t=0;t<this._ranges.length;t++)if(e.isIntersecting(this._ranges[t]))throw new w(`model-selection-range-intersects`,[this,e],{addedRange:e,intersectingRange:this._ranges[t]})}_replaceAllRanges(e){this._removeAllRanges();for(let t of e)this._pushRange(t)}_removeAllRanges(){for(;this._ranges.length>0;)this._popRange()}_popRange(){this._ranges.pop()}};_l.prototype.is=function(e){return e===`selection`||e===`model:selection`};function vl(e,t){return t.has(e)?!1:(t.add(e),e.root.document.model.schema.isBlock(e)&&!!e.parent)}function Ree(e,t,n){return vl(e,t)&&bl(e,n)}function yl(e,t){let n=e.parent.root.document.model.schema,r=e.parent.getAncestors({parentFirst:!0,includeSelf:!0}),i=!1,a=r.find(e=>i?!1:(i=n.isLimit(e),!i&&vl(e,t)));return r.forEach(e=>t.add(e)),a}function bl(e,t){let n=Vee(e);return n?!t.containsRange(B._createOn(n),!0):!0}function zee(e,t){return e?t.isCollapsed||e.isEmpty?!0:t.start.isTouching(z._createAt(e,e.maxOffset))?!1:bl(e,t):!1}function Bee(e,t){return e?t.isCollapsed||e.isEmpty?!0:t.end.isTouching(z._createAt(e,0))?!1:bl(e,t):!1}function Vee(e){let t=e.root.document.model.schema,n=e.parent;for(;n;){if(t.isBlock(n))return n;n=n.parent}}const Hee=E(B);var xl=class e extends Hee{constructor(e,t){super(e,t),Uee.call(this)}detach(){this.stopListening()}toRange(){return new B(this.start,this.end)}static fromRange(t){return new e(t.start,t.end)}};xl.prototype.is=function(e){return e===`liveRange`||e===`model:liveRange`||e==`range`||e===`model:range`};function Uee(){this.listenTo(this.root.document.model,`applyOperation`,(e,t)=>{let n=t[0];n.isDocumentOperation&&Wee.call(this,n)},{priority:`low`})}function Wee(e){let t=this.getTransformedByOperation(e),n=B._createFromRanges(t),r=!n.isEqual(this),i=Gee(this,e),a=null;if(r){n.root.rootName==`$graveyard`&&(a=e.type==`remove`?e.sourcePosition:e.deletionPosition);let t=this.toRange();this.start=n.start,this.end=n.end,this.fire(`change:range`,t,{deletionPosition:a})}else i&&this.fire(`change:content`,this.toRange(),{deletionPosition:a})}function Gee(e,t){switch(t.type){case`insert`:return e.containsPosition(t.position);case`move`:case`remove`:case`reinsert`:case`merge`:return e.containsPosition(t.sourcePosition)||e.start.isEqual(t.sourcePosition)||e.containsPosition(t.targetPosition);case`split`:return e.containsPosition(t.splitPosition)||e.containsPosition(t.insertionPosition)}return!1}var Sl=class e extends gl{_data;constructor(e,t){super(t),this._data=e||``}get offsetSize(){return this.data.length}get data(){return this._data}toJSON(){let e=super.toJSON();return e.data=this.data,e}_clone(){return new e(this.data,this.getAttributes())}static fromJSON(t){return new e(t.data,t.attributes)}};Sl.prototype.is=function(e){return e===`$text`||e===`model:$text`||e===`text`||e===`model:text`||e===`node`||e===`model:node`};const Cl=`selection:`,wl=E(Jc);var Tl=class extends wl{_selection;constructor(e){super(),this._selection=new El(e),this._selection.delegate(`change:range`).to(this),this._selection.delegate(`change:attribute`).to(this),this._selection.delegate(`change:marker`).to(this)}get isCollapsed(){return this._selection.isCollapsed}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get rangeCount(){return this._selection.rangeCount}get hasOwnRange(){return this._selection.hasOwnRange}get isBackward(){return this._selection.isBackward}get isGravityOverridden(){return this._selection.isGravityOverridden}get markers(){return this._selection.markers}get _ranges(){return this._selection._ranges}getRanges(){return this._selection.getRanges()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getSelectedBlocks(){return this._selection.getSelectedBlocks()}getSelectedElement(){return this._selection.getSelectedElement()}containsEntireContent(e){return this._selection.containsEntireContent(e)}destroy(){this._selection.destroy()}getAttributeKeys(){return this._selection.getAttributeKeys()}getAttributes(){return this._selection.getAttributes()}getAttribute(e){return this._selection.getAttribute(e)}hasAttribute(e){return this._selection.hasAttribute(e)}refresh(){this._selection.updateMarkers(),this._selection._updateAttributes(!1)}observeMarkers(e){this._selection.observeMarkers(e)}toJSON(){return this._selection.toJSON()}_setFocus(e,t){this._selection.setFocus(e,t)}_setTo(...e){this._selection.setTo(...e)}_setAttribute(e,t){this._selection.setAttribute(e,t)}_removeAttribute(e){this._selection.removeAttribute(e)}_getStoredAttributes(){return this._selection.getStoredAttributes()}_overrideGravity(){return this._selection.overrideGravity()}_restoreGravity(e){this._selection.restoreGravity(e)}static _getStoreAttributeKey(e){return Cl+e}static _isStoreAttributeKey(e){return e.startsWith(Cl)}};Tl.prototype.is=function(e){return e===`selection`||e==`model:selection`||e==`documentSelection`||e==`model:documentSelection`};var El=class extends _l{markers=new Fi({idProperty:`name`});_model;_document;_attributePriority=new Map;_selectionRestorePosition=null;_hasChangedRange=!1;_overriddenGravityRegister=new Set;_observedMarkers=new Set;constructor(e){super(),this._model=e.model,this._document=e,this.listenTo(this._model,`applyOperation`,(e,t)=>{let n=t[0];!n.isDocumentOperation||n.type==`marker`||n.type==`rename`||n.type==`noop`||(this._ranges.length==0&&this._selectionRestorePosition&&this._fixGraveyardSelection(this._selectionRestorePosition),this._selectionRestorePosition=null,this._hasChangedRange&&(this._hasChangedRange=!1,this.fire(`change:range`,{directChange:!1})))},{priority:`lowest`}),this.on(`change:range`,()=>{this._validateSelectionRanges(this.getRanges())}),this.listenTo(this._model.markers,`update`,(e,t,n,r)=>{this._updateMarker(t,r)}),this.listenTo(this._document,`change`,(e,t)=>{kl(this._model,t)})}get isCollapsed(){return this._ranges.length===0?this._document._getDefaultRange().isCollapsed:super.isCollapsed}get anchor(){return super.anchor||this._document._getDefaultRange().start}get focus(){return super.focus||this._document._getDefaultRange().end}get rangeCount(){return this._ranges.length?this._ranges.length:1}get hasOwnRange(){return this._ranges.length>0}get isGravityOverridden(){return!!this._overriddenGravityRegister.size}destroy(){for(let e=0;e<this._ranges.length;e++)this._ranges[e].detach();this.stopListening()}*getRanges(){this._ranges.length?yield*super.getRanges():yield this._document._getDefaultRange()}getFirstRange(){return super.getFirstRange()||this._document._getDefaultRange()}getLastRange(){return super.getLastRange()||this._document._getDefaultRange()}setTo(...e){super.setTo(...e),this._updateAttributes(!0),this.updateMarkers()}setFocus(e,t){super.setFocus(e,t),this._updateAttributes(!0),this.updateMarkers()}setAttribute(e,t){if(this._setAttribute(e,t)){let t=[e];this.fire(`change:attribute`,{attributeKeys:t,directChange:!0})}}removeAttribute(e){if(this._removeAttribute(e)){let t=[e];this.fire(`change:attribute`,{attributeKeys:t,directChange:!0})}}overrideGravity(){let e=he();return this._overriddenGravityRegister.add(e),this._overriddenGravityRegister.size===1&&this._updateAttributes(!0),e}restoreGravity(e){if(!this._overriddenGravityRegister.has(e))throw new w(`document-selection-gravity-wrong-restore`,this,{uid:e});this._overriddenGravityRegister.delete(e),this.isGravityOverridden||this._updateAttributes(!0)}observeMarkers(e){this._observedMarkers.add(e),this.updateMarkers()}_replaceAllRanges(e){this._validateSelectionRanges(e),super._replaceAllRanges(e)}_popRange(){this._ranges.pop().detach()}_pushRange(e){let t=this._prepareRange(e);t&&this._ranges.push(t)}toJSON(){let e=super.toJSON();return this.markers.length&&(e.markers=this.markers.map(e=>e.toJSON())),e}_validateSelectionRanges(e){for(let t of e)if(!this._document._validateSelectionRange(t))throw new w(`document-selection-wrong-position`,this,{range:t})}_prepareRange(e){if(this._checkRange(e),e.root==this._document.graveyard)return;let t=xl.fromRange(e);return t.on(`change:range`,(e,n,r)=>{if(this._hasChangedRange=!0,t.root==this._document.graveyard){this._selectionRestorePosition=r.deletionPosition;let e=this._ranges.indexOf(t);this._ranges.splice(e,1),t.detach()}}),t}updateMarkers(){if(!this._observedMarkers.size)return;let e=[],t=!1;for(let t of this._model.markers){let n=t.name.split(`:`,1)[0];if(!this._observedMarkers.has(n))continue;let r=t.getRange();for(let n of this.getRanges())r.containsRange(n,!n.isCollapsed)&&e.push(t)}let n=Array.from(this.markers);for(let n of e)this.markers.has(n)||(this.markers.add(n),t=!0);for(let n of Array.from(this.markers))e.includes(n)||(this.markers.remove(n),t=!0);t&&this.fire(`change:marker`,{oldMarkers:n,directChange:!1})}_updateMarker(e,t){let n=e.name.split(`:`,1)[0];if(!this._observedMarkers.has(n))return;let r=!1,i=Array.from(this.markers),a=this.markers.has(e);if(!t)a&&(this.markers.remove(e),r=!0);else{let n=!1;for(let e of this.getRanges())if(t.containsRange(e,!e.isCollapsed)){n=!0;break}n&&!a?(this.markers.add(e),r=!0):!n&&a&&(this.markers.remove(e),r=!0)}r&&this.fire(`change:marker`,{oldMarkers:i,directChange:!1})}_updateAttributes(e){let t=Ui(this._getSurroundingAttributes()),n=Ui(this.getAttributes());if(e)this._attributePriority=new Map,this._attrs=new Map;else for(let[e,t]of this._attributePriority)t==`low`&&(this._attrs.delete(e),this._attributePriority.delete(e));this._setAttributesTo(t);let r=[];for(let[e,t]of this.getAttributes())(!n.has(e)||n.get(e)!==t)&&r.push(e);for(let[e]of n)this.hasAttribute(e)||r.push(e);r.length>0&&this.fire(`change:attribute`,{attributeKeys:r,directChange:!1})}_setAttribute(e,t,n=!0){let r=n?`normal`:`low`;return r==`low`&&this._attributePriority.get(e)==`normal`||super.getAttribute(e)===t?!1:(this._attrs.set(e,t),this._attributePriority.set(e,r),!0)}_removeAttribute(e,t=!0){let n=t?`normal`:`low`;return n==`low`&&this._attributePriority.get(e)==`normal`||(this._attributePriority.set(e,n),!super.hasAttribute(e))?!1:(this._attrs.delete(e),!0)}_setAttributesTo(e){let t=new Set;for(let[t,n]of this.getAttributes())e.get(t)!==n&&this._removeAttribute(t,!1);for(let[n,r]of e)this._setAttribute(n,r,!1)&&t.add(n);return t}*getStoredAttributes(){let e=this.getFirstPosition().parent;if(this.isCollapsed&&e.isEmpty)for(let t of e.getAttributeKeys())t.startsWith(Cl)&&(yield[t.substr(10),e.getAttribute(t)])}_getSurroundingAttributes(){let e=this.getFirstPosition(),t=this._model.schema;if(e.root.rootName==`$graveyard`)return null;let n=null;if(this.isCollapsed){let r=e.textNode?e.textNode:e.nodeBefore,i=e.textNode?e.textNode:e.nodeAfter;this.isGravityOverridden||(n=Dl(r,t)),n||=Dl(i,t),!this.isGravityOverridden&&!n&&(n=Dl(r,t,`backward`)),n||=Dl(i,t,`forward`),n||=this.getStoredAttributes()}else{let e=this.getFirstRange();for(let r of e){if(r.item.is(`element`)&&t.isObject(r.item)){n=Dl(r.item,t);break}if(r.type==`text`){n=r.item.getAttributes();break}}}return n}_fixGraveyardSelection(e){let t=this._model.schema.getNearestSelectionRange(e);t&&this._pushRange(t)}};function Dl(e,t,n=`self`){if(!e)return null;for(let r of Ol(e,n)){if(!r)return null;if(r instanceof Sl)return r.getAttributes();if(!t.isInline(r))continue;let e=t.isObject(r),n=[];for(let[i,a]of r.getAttributes())t.checkAttribute(`$text`,i)&&(!e||t.getAttributeProperties(i).copyFromObject!==!1)&&n.push([i,a]);return n}return null}function*Ol(e,t){if(t==`self`)yield e;else{let n=e;for(;n;)n=t==`backward`?n.previousSibling:n.nextSibling,yield n}return null}function kl(e,t){let n=e.document.differ;for(let r of n.getChanges()){if(r.type!=`insert`)continue;let n=r.position.parent;r.length===n.maxOffset&&e.enqueueChange(t,e=>{let t=Array.from(n.getAttributeKeys()).filter(e=>e.startsWith(Cl));for(let r of t)e.removeAttribute(r,n)})}}var Al=class{_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;let t=this._nodes[e];if(!t)throw new w(`model-nodelist-index-out-of-bounds`,this);return this.getNodeStartOffset(t)}offsetToIndex(e){if(e==this._offsetToNode.length)return this._nodes.length;let t=this._offsetToNode[e];if(!t)throw new w(`model-nodelist-offset-out-of-bounds`,this,{offset:e,nodeList:this});return this.getNodeIndex(t)}_insertNodes(e,t){let n=[];for(let e of t){if(!(e instanceof gl))throw new w(`model-nodelist-insertnodes-not-node`,this);n.push(e)}let r=this.indexToOffset(e);Ji(this._nodes,n,e),Ji(this._offsetToNode,jl(n),r);for(let t=e;t<this._nodes.length;t++)this._nodes[t]._index=t,this._nodes[t]._startOffset=r,r+=this._nodes[t].offsetSize}_removeNodes(e,t=1){if(t==0)return[];let n=this.indexToOffset(e),r=this._nodes.splice(e,t),i=r[r.length-1],a=i.startOffset+i.offsetSize-n;this._offsetToNode.splice(n,a);for(let e of r)e._index=null,e._startOffset=null;for(let t=e;t<this._nodes.length;t++)this._nodes[t]._index=t,this._nodes[t]._startOffset=n,n+=this._nodes[t].offsetSize;return r}_removeNodesArray(e){if(e.length==0)return;for(let t of e)t._index=null,t._startOffset=null;this._nodes=this._nodes.filter(e=>e.index!==null),this._offsetToNode=this._offsetToNode.filter(e=>e.index!==null);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())}};function jl(e){let t=[],n=0;for(let r of e)for(let e=0;e<r.offsetSize;e++)t[n++]=r;return t}var Ml=class e extends gl{name;_children=new Al;constructor(e,t,n){super(t),this.name=e,n&&this._insertChild(0,n)}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return this.childCount===0}getChild(e){return this._children.getNode(e)}getChildAtOffset(e){return this._children.getNodeAtOffset(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}offsetToIndex(e){return this._children.offsetToIndex(e)}getNodeByPath(e){let t=this;for(let n of e)t=t.getChildAtOffset(n);return t}findAncestor(e,t={}){let n=t.includeSelf?this:this.parent;for(;n;){if(n.name===e)return n;n=n.parent}return null}toJSON(){let e=super.toJSON();if(e.name=this.name,this._children.length>0){e.children=[];for(let t of this._children)e.children.push(t.toJSON())}return e}_clone(t=!1){let n=t?Pl(this._children):void 0;return new e(this.name,this.getAttributes(),n)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){let n=Nl(t);for(let e of n)e.parent!==null&&e._remove(),e.parent=this;this._children._insertNodes(e,n)}_removeChildren(e,t=1){let n=this._children._removeNodes(e,t);for(let e of n)e.parent=null;return n}_removeChildrenArray(e){this._children._removeNodesArray(e);for(let t of e)t.parent=null}static fromJSON(t){let n;if(t.children){n=[];for(let r of t.children)r.name?n.push(e.fromJSON(r)):n.push(Sl.fromJSON(r))}return new e(t.name,t.attributes,n)}};Ml.prototype.is=function(e,t){return t?t===this.name&&(e===`element`||e===`model:element`):e===`element`||e===`model:element`||e===`node`||e===`model:node`};function Nl(e){if(typeof e==`string`)return[new Sl(e)];pr(e)||(e=[e]);let t=[];for(let n of e)typeof n==`string`?t.push(new Sl(n)):n instanceof Yc?t.push(new Sl(n.data,n.getAttributes())):t.push(n);return t}function Pl(e){let t=[];for(let n of e)t.push(n._clone(!0));return t}var Fl=class{_dispatchers;constructor(e){this._dispatchers=e}add(e){for(let t of this._dispatchers)e(t);return this}},Il=class extends Fl{elementToElement(e){return this.add(ou(e))}elementToStructure(e){return this.add(su(e))}attributeToElement(e){return this.add(cu(e))}attributeToAttribute(e){return this.add(lu(e))}markerToElement(e){return this.add(uu(e))}markerToHighlight(e){return this.add(fu(e))}markerToData(e){return this.add(du(e))}};function Ll(){return(e,t,n)=>{if(!n.consumable.consume(t.item,e.name))return;let r=n.writer,i=n.mapper.toViewPosition(t.range.start),a=r.createText(t.item.data);r.insert(i,a)}}function Rl(){return(e,t,n)=>{n.convertAttributes(t.item),!t.reconversion&&t.item.is(`element`)&&!t.item.isEmpty&&n.convertChildren(t.item)}}function zl(){return(e,t,n)=>{if(t.reconversion)return;let r=n.mapper.toViewPosition(t.position),i=t.position.getShiftedBy(t.length),a=n.mapper.toViewPosition(i,{isPhantom:!0});Jl(n.writer.createRange(r,a).getTrimmed(),n)}}function Bl(e,t){let n=e.createAttributeElement(`span`,t.attributes);return t.classes&&n._addClass(t.classes),typeof t.priority==`number`&&(n._priority=t.priority),n._id=t.id,n}function Vl(){return(e,t,n)=>{let r=t.selection;if(r.isCollapsed||!n.consumable.consume(r,`selection`))return;let i=[];for(let e of r.getRanges())i.push(n.mapper.toViewRange(e));n.writer.setSelection(i,{backward:r.isBackward})}}function Hl(){return(e,t,n)=>{let r=t.selection;if(!r.isCollapsed||!n.consumable.consume(r,`selection`))return;let i=n.writer,a=r.getFirstPosition(),o=n.mapper.toViewPosition(a),s=i.breakAttributes(o);i.setSelection(s)}}function Ul(){return(e,t,n)=>{let r=n.writer,i=r.document.selection;for(let e of i.getRanges())e.isCollapsed&&e.end.parent.isAttached()&&n.writer.mergeAttributes(e.start);r.setSelection(null)}}function Wl(e){return(t,n,r)=>{if(!r.consumable.test(n.item,t.name))return;let i=e(n.attributeOldValue,r,n),a=e(n.attributeNewValue,r,n);if(!i&&!a)return;r.consumable.consume(n.item,t.name);let o=r.writer,s=o.document.selection;if(n.item instanceof _l||n.item instanceof Tl)o.wrap(s.getFirstRange(),a);else{let e=r.mapper.toViewRange(n.range);n.attributeOldValue!==null&&i&&(e=o.unwrap(e,i)),n.attributeNewValue!==null&&a&&o.wrap(e,a)}}}function Gl(e,t=Du){return(n,r,i)=>{if(!t(r.item,i.consumable,{preflight:!0}))return;let a=e(r.item,i,r);if(!a)return;t(r.item,i.consumable);let o=r.reconversion&&Yl(r.item,i)||i.mapper.toViewPosition(r.range.start);i.mapper.bindElements(r.item,a),i.writer.insert(o,a),i.convertAttributes(r.item),Tu(a,r.item.getChildren(),i,{reconversion:r.reconversion})}}function Kl(e,t){return(n,r,i)=>{if(!t(r.item,i.consumable,{preflight:!0}))return;let a=new Map;i.writer._registerSlotFactory(Su(r.item,a,i));let o=e(r.item,i,r);if(i.writer._clearSlotFactory(),!o)return;Cu(r.item,a,i),t(r.item,i.consumable);let s=r.reconversion&&Yl(r.item,i)||i.mapper.toViewPosition(r.range.start);i.mapper.bindElements(r.item,o),i.writer.insert(s,o),i.convertAttributes(r.item),wu(o,a,i,{reconversion:r.reconversion})}}function ql(e){return(t,n,r)=>{n.isOpening=!0;let i=e(n,r);n.isOpening=!1;let a=e(n,r);if(!i||!a)return;let{markerRange:o,markerName:s}=n;if(o.isCollapsed&&!r.consumable.consume(o,t.name))return;for(let e of o)if(!r.consumable.consume(e.item,t.name))return;let c=r.mapper,l=r.writer;l.setCustomProperty(`markerBoundaryType`,`start`,i),l.setCustomProperty(`markerBoundaryName`,s,i),l.setCustomProperty(`markerBoundaryType`,`end`,a),l.setCustomProperty(`markerBoundaryName`,s,a);let u=(e,t)=>{let n=c.markerNameToElements(e);if(n){for(let e of n)if(e.getCustomProperty(`markerBoundaryType`)===t)return c.toModelPosition(l.createPositionBefore(e))}return null};if(!o.isCollapsed){let e=c.toViewPosition(o.end).getLastMatchingPosition(({item:e})=>{if(!e.is(`uiElement`)||e.getCustomProperty(`markerBoundaryType`)!==`end`)return!1;let t=e.getCustomProperty(`markerBoundaryName`),n=u(t,`start`);if(!n)return!1;let r=n.compareWith(o.start);return r===`same`?t.localeCompare(s)>0:r===`after`});l.insert(e,a),c.bindElementToMarker(a,s)}let d=c.toViewPosition(o.start).getLastMatchingPosition(({item:e})=>{if(!e.is(`uiElement`))return!1;let t=e.getCustomProperty(`markerBoundaryType`);if(!t)return!1;if(t===`end`)return!0;let n=e.getCustomProperty(`markerBoundaryName`),r=u(n,`end`);if(!r)return o.isCollapsed;if(o.isCollapsed)return!0;let i=r.compareWith(o.end);return i===`same`?n.localeCompare(s)<0:i===`after`});l.insert(d,i),c.bindElementToMarker(i,s),t.stop()}}function Jl(e,t){let n=t.writer.remove(e);for(let e of t.writer.createRangeIn(n).getItems())t.mapper.unbindViewElement(e,{defer:!0});return e.start}function Yl(e,t){let n=t.mapper.toViewElement(e);return n&&Jl(t.writer.createRangeOn(n),t)}function Xl(){return(e,t,n)=>{let r=n.mapper.markerNameToElements(t.markerName);if(r){for(let e of r)n.mapper.unbindElementFromMarkerName(e,t.markerName),n.writer.clear(n.writer.createRangeOn(e),e);n.writer.clearClonedElementsGroup(t.markerName),e.stop()}}}function Zl(e){return(t,n,r)=>{let i=e(n.markerName,r);if(!i)return;let a=n.markerRange;r.consumable.consume(a,t.name)&&(Ql(a,!1,r,n,i),Ql(a,!0,r,n,i),t.stop())}}function Ql(e,t,n,r,i){let a=t?e.start:e.end,o=a.nodeAfter&&a.nodeAfter.is(`element`)?a.nodeAfter:null,s=a.nodeBefore&&a.nodeBefore.is(`element`)?a.nodeBefore:null;if(o||s){let e,a;t&&o||!t&&!s?(e=o,a=!0):(e=s,a=!1);let c=n.mapper.toViewElement(e);if(c){$l(c,t,a,n,r,i);return}}eu(n.mapper.toViewPosition(a),t,n,r,i)}function $l(e,t,n,r,i,a){let o=`data-${a.group}-${t?`start`:`end`}-${n?`before`:`after`}`,s=e.hasAttribute(o)?e.getAttribute(o).split(`,`):[];s.unshift(a.name),r.writer.setAttribute(o,s.join(`,`),e),r.mapper.bindElementToMarker(e,i.markerName)}function eu(e,t,n,r,i){let a=`${i.group}-${t?`start`:`end`}`,o=i.name?{name:i.name}:null,s=n.writer.createUIElement(a,o);n.writer.insert(e,s),n.mapper.bindElementToMarker(s,r.markerName)}function tu(e){return(t,n,r)=>{let i=e(n.markerName,r);if(!i)return;let a=r.mapper.markerNameToElements(n.markerName);if(!a)return;for(let e of a)r.mapper.unbindElementFromMarkerName(e,n.markerName),e.is(`containerElement`)?(o(`data-${i.group}-start-before`,e),o(`data-${i.group}-start-after`,e),o(`data-${i.group}-end-before`,e),o(`data-${i.group}-end-after`,e)):r.writer.clear(r.writer.createRangeOn(e),e);r.writer.clearClonedElementsGroup(n.markerName),t.stop();function o(e,t){if(t.hasAttribute(e)){let n=new Set(t.getAttribute(e).split(`,`));n.delete(i.name),n.size==0?r.writer.removeAttribute(e,t):r.writer.setAttribute(e,Array.from(n).join(`,`),t)}}}}function nu(e){return(t,n,r)=>{if(!r.consumable.test(n.item,t.name))return;let i=e(n.attributeOldValue,r,n),a=e(n.attributeNewValue,r,n);if(!i&&!a)return;r.consumable.consume(n.item,t.name);let o=r.mapper.toViewElement(n.item),s=r.writer;if(!o)throw new w(`conversion-attribute-to-attribute-on-text`,r.dispatcher,n);if(n.attributeOldValue!==null&&i){let e=i.value;i.key==`style`&&(e=typeof i.value==`string`?new Vo(s.document.stylesProcessor).setTo(i.value).getStylesEntries().map(([e])=>e):Object.keys(i.value)),s.removeAttribute(i.key,e,o)}if(n.attributeNewValue!==null&&a){let e=a.value;a.key==`style`&&typeof a.value==`string`&&(e=Object.fromEntries(new Vo(s.document.stylesProcessor).setTo(a.value).getStylesEntries())),s.setAttribute(a.key,e,!1,o)}}}function ru(e){return(t,n,r)=>{if(!n.item||!(n.item instanceof _l||n.item instanceof Tl)&&!n.item.is(`$textProxy`))return;let i=vu(e,n,r);if(!i||!r.consumable.consume(n.item,t.name))return;let a=r.writer,o=Bl(a,i),s=a.document.selection;if(n.item instanceof _l||n.item instanceof Tl)a.wrap(s.getFirstRange(),o);else{let e=r.mapper.toViewRange(n.range),t=a.wrap(e,o);for(let e of t.getItems())if(e.is(`attributeElement`)&&e.isSimilar(o)){r.mapper.bindElementToMarker(e,n.markerName);break}}}}function iu(e){return(t,n,r)=>{if(!n.item||!(n.item instanceof Ml))return;let i=vu(e,n,r);if(!i||!r.consumable.test(n.item,t.name))return;let a=r.mapper.toViewElement(n.item);if(a&&a.getCustomProperty(`addHighlight`)){r.consumable.consume(n.item,t.name);for(let e of B._createIn(n.item))r.consumable.consume(e.item,t.name);a.getCustomProperty(`addHighlight`)(a,i,r.writer),r.mapper.bindElementToMarker(a,n.markerName)}}}function au(e){return(t,n,r)=>{if(n.markerRange.isCollapsed)return;let i=vu(e,n,r);if(!i)return;let a=Bl(r.writer,i),o=r.mapper.markerNameToElements(n.markerName);if(o){for(let e of o)r.mapper.unbindElementFromMarkerName(e,n.markerName),e.is(`attributeElement`)?r.writer.unwrap(r.writer.createRangeOn(e),a):e.getCustomProperty(`removeHighlight`)(e,i.id,r.writer);r.writer.clearClonedElementsGroup(n.markerName),t.stop()}}}function ou(e){let t=pu(e.model),n=mu(e.view,`container`);return t.attributes.length&&(t.children=!0),r=>{r.on(`insert:${t.name}`,Gl(n,xu(t)),{priority:e.converterPriority||`normal`}),(t.children||t.attributes.length)&&r.on(`reduceChanges`,bu(t),{priority:`low`})}}function su(e){let t=pu(e.model),n=mu(e.view,`container`);return t.children=!0,r=>{if(r._conversionApi.schema.checkChild(t.name,`$text`))throw new w(`conversion-element-to-structure-disallowed-text`,r,{elementName:t.name});r.on(`insert:${t.name}`,Kl(n,xu(t)),{priority:e.converterPriority||`normal`}),r.on(`reduceChanges`,bu(t),{priority:`low`})}}function cu(e){e=Rt(e);let t=e.model;typeof t==`string`&&(t={key:t});let n=`attribute:${t.key}`;if(t.name&&(n+=`:`+t.name),t.values)for(let n of t.values)e.view[n]=mu(e.view[n],`attribute`);else e.view=mu(e.view,`attribute`);let r=gu(e);return t=>{t.on(n,Wl(r),{priority:e.converterPriority||`normal`})}}function lu(e){e=Rt(e);let t=e.model;typeof t==`string`&&(t={key:t});let n=`attribute:${t.key}`;if(t.name&&(n+=`:`+t.name),t.values)for(let n of t.values)e.view[n]=_u(e.view[n]);else e.view=_u(e.view);let r=gu(e);return t=>{t.on(n,nu(r),{priority:e.converterPriority||`normal`})}}function uu(e){let t=mu(e.view,`ui`);return n=>{n.on(`addMarker:${e.model}`,ql(t),{priority:e.converterPriority||`normal`}),n.on(`removeMarker:${e.model}`,Xl(),{priority:e.converterPriority||`normal`})}}function du(e){e=Rt(e);let t=e.model,n=e.view;return n||=n=>({group:t,name:n.substr(e.model.length+1)}),r=>{r.on(`addMarker:${t}`,Zl(n),{priority:e.converterPriority||`normal`}),r.on(`removeMarker:${t}`,tu(n),{priority:e.converterPriority||`normal`})}}function fu(e){return t=>{t.on(`addMarker:${e.model}`,ru(e.view),{priority:e.converterPriority||`normal`}),t.on(`addMarker:${e.model}`,iu(e.view),{priority:e.converterPriority||`normal`}),t.on(`removeMarker:${e.model}`,au(e.view),{priority:e.converterPriority||`normal`})}}function pu(e){return typeof e==`string`&&(e={name:e}),{name:e.name,attributes:e.attributes?A(e.attributes):[],children:!!e.children}}function mu(e,t){return typeof e==`function`?e:((n,r)=>hu(e,r,t))}function hu(e,t,n){typeof e==`string`&&(e={name:e});let r,i=t.writer,a=Object.assign({},e.attributes);if(n==`container`)r=i.createContainerElement(e.name,a);else if(n==`attribute`){let t={priority:e.priority||ws.DEFAULT_PRIORITY};r=i.createAttributeElement(e.name,a,t)}else r=i.createUIElement(e.name,a);if(e.styles){let t=Object.keys(e.styles);for(let n of t)i.setStyle(n,e.styles[n],r)}if(e.classes){let t=e.classes;if(typeof t==`string`)i.addClass(t,r);else for(let e of t)i.addClass(e,r)}return r}function gu(e){return e.model.values?((t,n,r)=>{let i=e.view[t];return i?i(t,n,r):null}):e.view}function _u(e){return typeof e==`string`?t=>({key:e,value:t}):typeof e==`object`?e.value?()=>e:t=>({key:e.key,value:t}):e}function vu(e,t,n){let r=typeof e==`function`?e(t,n):{...e};return r?(r.priority||=10,r.id||=t.markerName,r):null}function yu(e){return(t,n)=>{if(!t.is(`element`,e.name))return!1;if(n.type==`attribute`){if(e.attributes.includes(n.attributeKey))return!0}else if(e.children)return!0;return!1}}function bu(e){let t=yu(e);return(e,n)=>{let r=[];n.reconvertedElements||=new Set;for(let e of n.changes){let i=e.type==`attribute`?e.range.start.nodeAfter:e.position.parent;if(!i||!t(i,e)||e.type==`reinsert`){r.push(e);continue}if(e.type==`insert`&&e.action==`rename`&&n.refreshedItems.add(e.position.nodeAfter),!n.reconvertedElements.has(i)){n.reconvertedElements.add(i);let e=z._createBefore(i),t=r.length;for(let n=r.length-1;n>=0;n--){let i=r[n],a=(i.type==`attribute`?i.range.start:i.position).compareWith(e);if(a==`before`||i.type==`remove`&&a==`same`)break;t=n}r.splice(t,0,{type:`reinsert`,name:i.name,position:e,length:1})}}n.changes=r}}function xu(e){return(t,n,r={})=>{let i=[`insert`];for(let n of e.attributes)t.hasAttribute(n)&&i.push(`attribute:${n}`);return i.every(e=>n.test(t,e))?(r.preflight||i.forEach(e=>n.consume(t,e)),!0):!1}}function Su(e,t,n){return(r,i)=>{let a=r.createContainerElement(`$slot`),o=null;if(i===`children`)o=Array.from(e.getChildren());else if(typeof i==`function`)o=Array.from(e.getChildren()).filter(e=>i(e));else throw new w(`conversion-slot-mode-unknown`,n.dispatcher,{modeOrFilter:i});return t.set(a,o),a}}function Cu(e,t,n){let r=Array.from(t.values()).flat(),i=new Set(r);if(i.size!=r.length)throw new w(`conversion-slot-filter-overlap`,n.dispatcher,{element:e});if(i.size!=e.childCount)throw new w(`conversion-slot-filter-incomplete`,n.dispatcher,{element:e})}function wu(e,t,n,r){n.mapper.on(`modelToViewPosition`,o,{priority:`highest`});let i=null,a=null;for([i,a]of t)Tu(e,a,n,r),n.writer.setCustomProperty(`$structureSlotParent`,!0,i.parent),n.writer.move(n.writer.createRangeIn(i),n.writer.createPositionBefore(i)),n.writer.remove(i);n.mapper.off(`modelToViewPosition`,o);function o(e,t){let n=t.modelPosition.nodeAfter,r=a.indexOf(n);r<0||(t.viewPosition=t.mapper.findPositionIn(i,r))}}function Tu(e,t,n,r){for(let i of t)Eu(e.root,i,n,r)||n.convertItem(i)}function Eu(e,t,n,r){let{writer:i,mapper:a}=n;if(!r.reconversion)return!1;let o=a.toViewElement(t);return!o||o.root==e||!n.canReuseView(o)?!1:(i.move(i.createRangeOn(o),a.toViewPosition(z._createBefore(t))),!0)}function Du(e,t,{preflight:n}={}){return n?t.test(e,`insert`):t.consume(e,`insert`)}function Ou(e){let{schema:t,document:n}=e.model;for(let r of n.getRoots())if(r.isEmpty&&!t.checkChild(r,`$text`)&&t.checkChild(r,`paragraph`))return e.insertElement(`paragraph`,r),!0;return!1}function ku(e,t,n){let r=n.createContext(e);return!(!n.checkChild(r,`paragraph`)||!n.checkChild(r.push(`paragraph`),t))}function Au(e,t){let n=t.createElement(`paragraph`);return t.insert(n,e),t.createPositionAt(n,0)}var ju=class extends Fl{elementToElement(e){return this.add(Fu(e))}elementToAttribute(e){return this.add(Iu(e))}attributeToAttribute(e){return this.add(Lu(e))}elementToMarker(e){return this.add(Ru(e))}dataToMarker(e){return this.add(zu(e))}};function Mu(){return(e,t,n)=>{if(!t.modelRange&&n.consumable.consume(t.viewItem,{name:!0})){let{modelRange:e,modelCursor:r}=n.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=r}}}function Nu(){return(e,t,{schema:n,consumable:r,writer:i})=>{let a=t.modelCursor;if(!r.test(t.viewItem))return;if(!n.checkChild(a,`$text`)){if(!ku(a,`$text`,n)||t.viewItem.data.trim().length==0)return;a=Au(a,i)}r.consume(t.viewItem);let o=i.createText(t.viewItem.data);i.insert(o,a),t.modelRange=i.createRange(a,a.getShiftedBy(o.offsetSize)),t.modelCursor=t.modelRange.end}}function Pu(e,t){return(n,r)=>{let i=r.newSelection,a=[];for(let e of i.getRanges())a.push(t.toModelRange(e));let o=e.createSelection(a,{backward:i.isBackward});o.isEqual(e.document.selection)||e.change(e=>{e.setSelection(o)})}}function Fu(e){e=Rt(e);let t=Hu(e),n=Vu(e.view),r=n?`element:${n}`:`element`;return n=>{n.on(r,t,{priority:e.converterPriority||`normal`})}}function Iu(e){e=Rt(e),Gu(e);let t=Ku(e,!1),n=Vu(e.view),r=n?`element:${n}`:`element`;return n=>{n.on(r,t,{priority:e.converterPriority||`low`})}}function Lu(e){e=Rt(e);let t=null;(typeof e.view==`string`||e.view.key)&&(t=Wu(e)),Gu(e,t);let n=Ku(e,!0);return t=>{t.on(`element`,n,{priority:e.converterPriority||`low`})}}function Ru(e){let t=Yu(e.model);return Fu({...e,model:t})}function zu(e){e=Rt(e),e.model||=t=>t?e.view+`:`+t:e.view;let t={view:e.view,model:e.model},n=Hu(Xu(t,`start`)),r=Hu(Xu(t,`end`));return i=>{i.on(`element:${e.view}-start`,n,{priority:e.converterPriority||`normal`}),i.on(`element:${e.view}-end`,r,{priority:e.converterPriority||`normal`});let a=ge.low,o=ge.highest,s=ge.get(e.converterPriority)/o;i.on(`element`,Bu(t),{priority:a+s})}}function Bu(e){return(t,n,r)=>{let i=`data-${e.view}`;if(!r.consumable.test(n.viewItem,{attributes:i+`-end-after`})&&!r.consumable.test(n.viewItem,{attributes:i+`-start-after`})&&!r.consumable.test(n.viewItem,{attributes:i+`-end-before`})&&!r.consumable.test(n.viewItem,{attributes:i+`-start-before`}))return;n.modelRange||Object.assign(n,r.convertChildren(n.viewItem,n.modelCursor)),r.consumable.consume(n.viewItem,{attributes:i+`-end-after`})&&a(n.modelRange.end,n.viewItem.getAttribute(i+`-end-after`).split(`,`)),r.consumable.consume(n.viewItem,{attributes:i+`-start-after`})&&a(n.modelRange.end,n.viewItem.getAttribute(i+`-start-after`).split(`,`)),r.consumable.consume(n.viewItem,{attributes:i+`-end-before`})&&a(n.modelRange.start,n.viewItem.getAttribute(i+`-end-before`).split(`,`)),r.consumable.consume(n.viewItem,{attributes:i+`-start-before`})&&a(n.modelRange.start,n.viewItem.getAttribute(i+`-start-before`).split(`,`));function a(t,i){for(let a of i){let i=e.model(a,r),o=r.writer.createElement(`$marker`,{"data-name":i});r.writer.insert(o,t),n.modelCursor.isEqual(t)?n.modelCursor=n.modelCursor.getShiftedBy(1):n.modelCursor=n.modelCursor._getTransformedByInsertion(t,1),n.modelRange=n.modelRange._getTransformedByInsertion(t,1)[0]}}}}function Vu(e){return typeof e==`string`?e:typeof e==`object`&&typeof e.name==`string`?e.name:null}function Hu(e){let t=new Po(e.view);return(n,r,i)=>{let a=t.match(r.viewItem);if(!a)return;let o=a.match;if(o.name=!0,!i.consumable.test(r.viewItem,o))return;let s=Uu(e.model,r.viewItem,i);s&&i.safeInsert(s,r.modelCursor)&&(i.consumable.consume(r.viewItem,o),i.convertChildren(r.viewItem,s),i.updateConversionResult(s,r))}}function Uu(e,t,n){return e instanceof Function?e(t,n):n.writer.createElement(e)}function Wu(e){typeof e.view==`string`&&(e.view={key:e.view});let t=e.view.key,n=e.view.value===void 0?/[\s\S]*/:e.view.value,r;return r=t==`class`||t==`style`?{[t==`class`?`classes`:`styles`]:n}:{attributes:{[t]:n}},e.view.name&&(r.name=e.view.name),e.view=r,t}function Gu(e,t=null){let n=t===null?!0:e=>e.getAttribute(t);e.model={key:typeof e.model==`object`?e.model.key:e.model,value:typeof e.model!=`object`||e.model.value===void 0?n:e.model.value}}function Ku(e,t){let n=new Po(e.view);return(r,i,a)=>{if(!i.modelRange&&t)return;let o=n.match(i.viewItem);if(!o||(qu(e.view,i.viewItem)?o.match.name=!0:delete o.match.name,!a.consumable.test(i.viewItem,o.match)))return;let s=e.model.key,c=typeof e.model.value==`function`?e.model.value(i.viewItem,a,i):e.model.value;c!=null&&(i.modelRange||Object.assign(i,a.convertChildren(i.viewItem,i.modelCursor)),Ju(i.modelRange,{key:s,value:c},t,a)&&(a.consumable.test(i.viewItem,{name:!0})&&(o.match.name=!0),a.consumable.consume(i.viewItem,o.match)))}}function qu(e,t){let n=typeof e==`function`?e(t):e;return typeof n==`object`&&!Vu(n)?!1:!n.classes&&!n.attributes&&!n.styles}function Ju(e,t,n,r){let i=!1;for(let a of Array.from(e.getItems({shallow:n})))r.schema.checkAttribute(a,t.key)&&(i=!0,!a.hasAttribute(t.key)&&r.writer.setAttribute(t.key,t.value,a));return i}function Yu(e){return(t,n)=>{let r=typeof e==`string`?e:e(t,n);return n.writer.createElement(`$marker`,{"data-name":r})}}function Xu(e,t){return{view:`${e.view}-${t}`,model:(t,n)=>{let r=t.getAttribute(`name`),i=e.model(r,n);return n.writer.createElement(`$marker`,{"data-name":i})}}}const Zu=D();var Qu=class extends Zu{model;view;mapper;downcastDispatcher;constructor(e,t){super(),this.model=e,this.view=new qc(t),this.mapper=new ol,this.downcastDispatcher=new fl({mapper:this.mapper,schema:e.schema});let n=this.model.document,r=n.selection,i=this.model.markers;this.listenTo(this.model,`_beforeChanges`,()=>{this.view._disableRendering(!0)},{priority:`highest`}),this.listenTo(this.model,`_afterChanges`,()=>{this.view._disableRendering(!1)},{priority:`lowest`}),this.listenTo(n,`change`,()=>{this.view.change(e=>{this.downcastDispatcher.convertChanges(n.differ,i,e),this.downcastDispatcher.convertSelection(r,i,e)})},{priority:`low`}),this.listenTo(this.view.document,`selectionChange`,Pu(this.model,this.mapper)),this.downcastDispatcher.on(`insert:$text`,Ll(),{priority:`lowest`}),this.downcastDispatcher.on(`insert`,Rl(),{priority:`lowest`}),this.downcastDispatcher.on(`remove`,zl(),{priority:`low`}),this.downcastDispatcher.on(`cleanSelection`,Ul()),this.downcastDispatcher.on(`selection`,Vl(),{priority:`low`}),this.downcastDispatcher.on(`selection`,Hl(),{priority:`low`}),this.view.document.roots.bindTo(this.model.document.roots).using(e=>{if(e.rootName==`$graveyard`)return null;let t=new ns(this.view.document,e.name);return t.rootName=e.rootName,this.mapper.bindElements(e,t),t})}destroy(){this.view.destroy(),this.stopListening()}reconvertMarker(e){let t=typeof e==`string`?e:e.name,n=this.model.markers.get(t);if(!n)throw new w(`editingcontroller-reconvertmarker-marker-not-exist`,this,{markerName:t});this.model.change(()=>{this.model.markers._refresh(n)})}reconvertItem(e){this.model.change(()=>{this.model.document.differ._refreshItem(e)})}};const $u=D();var ed=class extends $u{_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 td(t[0])},{priority:`highest`}),this.on(`checkChild`,(e,t)=>{t[0]=new td(t[0]),t[1]=this.getDefinition(t[1])},{priority:`highest`})}register(e,t){if(this._sourceDefinitions[e])throw new w(`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 w(`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=typeof e==`string`?e:`is`in e&&(e.is(`$text`)||e.is(`$textProxy`))?`$text`:e.name,this.getDefinitions()[t]}isRegistered(e){return!!this.getDefinition(e)}isBlock(e){let t=this.getDefinition(e);return!!(t&&t.isBlock)}isLimit(e){let t=this.getDefinition(e);return t?!!(t.isLimit||t.isObject):!1}isObject(e){let t=this.getDefinition(e);return t?!!(t.isObject||t.isLimit&&t.isSelectable&&t.isContent):!1}isInline(e){let t=this.getDefinition(e);return!!(t&&t.isInline)}isSelectable(e){let t=this.getDefinition(e);return t?!!(t.isSelectable||t.isObject):!1}isContent(e){let t=this.getDefinition(e);return t?!!(t.isContent||t.isObject):!1}checkChild(e,t){return t?this._checkContextMatch(e,t):!1}checkAttribute(e,t){let n=this.getDefinition(e.last);if(!n)return!1;let r=this._evaluateAttributeChecks(e,t);return r===void 0?n.allowAttributes.includes(t):r}checkMerge(e,t){if(e instanceof z){let t=e.nodeBefore,n=e.nodeAfter;if(!(t instanceof Ml))throw new w(`schema-check-merge-no-element-before`,this);if(!(n instanceof Ml))throw new w(`schema-check-merge-no-element-after`,this);return this.checkMerge(t,n)}if(this.isLimit(e)||this.isLimit(t))return!1;for(let n of t.getChildren())if(!this.checkChild(e,n))return!1;return!0}addChildCheck(e,t){let n=t===void 0?this._genericCheckSymbol:t,r=this._customChildChecks.get(n)||[];r.push(e),this._customChildChecks.set(n,r)}addAttributeCheck(e,t){let n=t===void 0?this._genericCheckSymbol:t,r=this._customAttributeChecks.get(n)||[];r.push(e),this._customAttributeChecks.set(n,r)}setAttributeProperties(e,t){this._attributeProperties[e]=Object.assign(this.getAttributeProperties(e),t)}getAttributeProperties(e){return this._attributeProperties[e]||Object.create(null)}getLimitElement(e){let t;for(t=e instanceof z?e.parent:(e instanceof B?[e]:Array.from(e.getRanges())).reduce((e,t)=>{let n=t.getCommonAncestor();return e?e.getCommonAncestor(n,{includeSelf:!0}):n},null);!this.isLimit(t)&&t.parent;)t=t.parent;return t}checkAttributeInSelection(e,t){if(e.isCollapsed){let n=[...e.getFirstPosition().getAncestors(),new Sl(``,e.getAttributes())];return this.checkAttribute(n,t)}else{let n=e.getRanges();for(let e of n)for(let n of e)if(this.checkAttribute(n.item,t))return!0}return!1}*getValidRanges(e,t,n={}){e=vd(e);for(let r of e)yield*this._getValidRangesForRange(r,t,n)}getNearestSelectionRange(e,t=`both`){if(e.root.rootName==`$graveyard`)return null;if(this.checkChild(e,`$text`))return new B(e);let n,r,i=e.getAncestors().reverse().find(e=>this.isLimit(e))||e.root;(t==`both`||t==`backward`)&&(n=new Xc({boundaries:B._createIn(i),startPosition:e,direction:`backward`})),(t==`both`||t==`forward`)&&(r=new Xc({boundaries:B._createIn(i),startPosition:e}));for(let e of _d(n,r)){let t=e.walker==n?`elementEnd`:`elementStart`,r=e.value;if(r.type==t&&this.isObject(r.item))return B._createOn(r.item);if(this.checkChild(r.nextPosition,`$text`))return new B(r.nextPosition)}return null}findAllowedParent(e,t){let n=e.parent;for(;n;){if(this.checkChild(n,t))return n;if(this.isLimit(n))return null;n=n.parent}return null}setAllowedAttributes(e,t,n){let r=n.model;for(let[i,a]of Object.entries(t))r.schema.checkAttribute(e,i)&&n.setAttribute(i,a,e)}removeDisallowedAttributes(e,t){for(let n of e)if(n.is(`$text`))yd(this,n,t);else{let e=B._createIn(n).getPositions();for(let n of e){let e=n.nodeBefore||n.parent;yd(this,e,t)}}}getAttributesWithProperty(e,t,n){let r={};for(let[i,a]of e.getAttributes()){let e=this.getAttributeProperties(i);e[t]!==void 0&&(n===void 0||n===e[t])&&(r[i]=a)}return r}createContext(e){return new td(e)}_clearCache(){this._compiledDefinitions=null}_compile(){let e={},t=this._sourceDefinitions,n=Object.keys(t);for(let r of n)e[r]=nd(t[r],r);let r=Object.values(e);for(let t of r)rd(e,t),id(e,t),ad(e,t),od(e,t);for(let t of r)sd(e,t);for(let t of r)cd(e,t);for(let t of r)ld(e,t);for(let t of r)dd(e,t);for(let t of r)fd(e,t);this._compiledDefinitions=ud(e)}_checkContextMatch(e,t){let n=e.last,r=this._evaluateChildChecks(e,t);if(r=r===void 0?t.allowIn.includes(n.name):r,!r)return!1;let i=this.getDefinition(n),a=e.trimLast();return i?a.length==0?!0:this._checkContextMatch(a,i):!1}_evaluateChildChecks(e,t){let n=this._customChildChecks.get(this._genericCheckSymbol)||[],r=this._customChildChecks.get(t.name)||[];for(let i of[...n,...r]){let n=i(e,t);if(n!==void 0)return n}}_evaluateAttributeChecks(e,t){let n=this._customAttributeChecks.get(this._genericCheckSymbol)||[],r=this._customAttributeChecks.get(t)||[];for(let i of[...n,...r]){let n=i(e,t);if(n!==void 0)return n}}*_getValidRangesForRange(e,t,n){let r=e.start,i=e.start;for(let a of e.getItems({shallow:!0})){if(a.is(`element`))if(n.includeEmptyRanges&&a.isEmpty){let e=this.createContext(a);this.checkChild(e,`$text`)&&this.checkAttribute(e.push(`$text`),t)&&(yield B._createIn(a))}else yield*this._getValidRangesForRange(B._createIn(a),t,n);this.checkAttribute(a,t)||(r.isEqual(i)||(yield new B(r,i)),r=z._createAfter(a)),i=z._createAfter(a)}r.isEqual(i)||(yield new B(r,i))}findOptimalInsertionRange(e,t){let n=e.getSelectedElement();if(n&&this.isObject(n)&&!this.isInline(n))return t==`before`||t==`after`?new B(z._createAt(n,t)):B._createOn(n);let r=j(e.getSelectedBlocks());if(!r)return new B(e.focus);if(r.isEmpty)return new B(z._createAt(r,0));let i=z._createAfter(r);return e.focus.isTouching(i)?new B(i):new B(z._createBefore(r))}},td=class e{_items;constructor(t){if(t instanceof e)return t;let n;n=typeof t==`string`?[t]:Array.isArray(t)?t:t.getAncestors({includeSelf:!0}),this._items=n.map(gd)}get length(){return this._items.length}get last(){return this._items[this._items.length-1]}[Symbol.iterator](){return this._items[Symbol.iterator]()}push(t){let n=new e([t]);return n._items=[...this._items,...n._items],n}trimLast(){let t=new e([]);return t._items=this._items.slice(0,-1),t}getItem(e){return this._items[e]}*getNames(){yield*this._items.map(e=>e.name)}endsWith(e){return Array.from(this.getNames()).join(` `).endsWith(e)}startsWith(e){return Array.from(this.getNames()).join(` `).startsWith(e)}};function nd(e,t){let n={name:t,allowIn:new Set,allowChildren:new Set,disallowIn:new Set,disallowChildren:new Set,allowContentOf:new Set,allowWhere:new Set,allowAttributes:new Set,disallowAttributes:new Set,allowAttributesOf:new Set,inheritTypesFrom:new Set};return pd(e,n),md(e,n,`allowIn`),md(e,n,`allowChildren`),md(e,n,`disallowIn`),md(e,n,`disallowChildren`),md(e,n,`allowContentOf`),md(e,n,`allowWhere`),md(e,n,`allowAttributes`),md(e,n,`disallowAttributes`),md(e,n,`allowAttributesOf`),md(e,n,`inheritTypesFrom`),hd(e,n),n}function rd(e,t){for(let n of t.allowIn){let r=e[n];r?r.allowChildren.add(t.name):t.allowIn.delete(n)}}function id(e,t){for(let n of t.allowChildren){let r=e[n];r?r.allowIn.add(t.name):t.allowChildren.delete(n)}}function ad(e,t){for(let n of t.disallowIn){let r=e[n];r?r.disallowChildren.add(t.name):t.disallowIn.delete(n)}}function od(e,t){for(let n of t.disallowChildren){let r=e[n];r?r.disallowIn.add(t.name):t.disallowChildren.delete(n)}}function sd(e,t){for(let e of t.disallowChildren)t.allowChildren.delete(e);for(let e of t.disallowIn)t.allowIn.delete(e);for(let e of t.disallowAttributes)t.allowAttributes.delete(e)}function cd(e,t){for(let n of t.allowContentOf){let r=e[n];r&&(r.disallowChildren.forEach(n=>{t.allowChildren.has(n)||(t.disallowChildren.add(n),e[n].disallowIn.add(t.name))}),r.allowChildren.forEach(n=>{t.disallowChildren.has(n)||(t.allowChildren.add(n),e[n].allowIn.add(t.name))}))}}function ld(e,t){for(let n of t.allowWhere){let r=e[n];r&&(r.disallowIn.forEach(n=>{t.allowIn.has(n)||(t.disallowIn.add(n),e[n].disallowChildren.add(t.name))}),r.allowIn.forEach(n=>{t.disallowIn.has(n)||(t.allowIn.add(n),e[n].allowChildren.add(t.name))}))}}function ud(e){let t={};for(let n of Object.values(e))t[n.name]={name:n.name,isBlock:!!n.isBlock,isContent:!!n.isContent,isInline:!!n.isInline,isLimit:!!n.isLimit,isObject:!!n.isObject,isSelectable:!!n.isSelectable,allowIn:Array.from(n.allowIn).filter(t=>!!e[t]),allowChildren:Array.from(n.allowChildren).filter(t=>!!e[t]),allowAttributes:Array.from(n.allowAttributes)};return t}function dd(e,t){for(let n of t.allowAttributesOf){let r=e[n];if(!r)return;r.allowAttributes.forEach(e=>{t.disallowAttributes.has(e)||t.allowAttributes.add(e)})}}function fd(e,t){for(let n of t.inheritTypesFrom){let r=e[n];if(r){let e=Object.keys(r).filter(e=>e.startsWith(`is`));for(let n of e)n in t||(t[n]=r[n])}}}function pd(e,t){for(let n of e){let e=Object.keys(n).filter(e=>e.startsWith(`is`));for(let r of e)t[r]=!!n[r]}}function md(e,t,n){for(let r of e){let e=r[n];typeof e==`string`&&(e=[e]),Array.isArray(e)&&e.forEach(e=>t[n].add(e))}}function hd(e,t){for(let n of e){let e=n.inheritAllFrom;e&&(t.allowContentOf.add(e),t.allowWhere.add(e),t.allowAttributesOf.add(e),t.inheritTypesFrom.add(e))}}function gd(e){return typeof e==`string`||e.is(`documentFragment`)?{name:typeof e==`string`?e:`$documentFragment`,*getAttributeKeys(){},getAttribute(){}}:{name:e.is(`element`)?e.name:`$text`,*getAttributeKeys(){yield*e.getAttributeKeys()},getAttribute(t){return e.getAttribute(t)}}}function*_d(e,t){let n=!1;for(;!n;){if(n=!0,e){let t=e.next();t.done||(n=!1,yield{walker:e,value:t.value})}if(t){let e=t.next();e.done||(n=!1,yield{walker:t,value:e.value})}}}function*vd(e){for(let t of e)yield*t.getMinimalFlatRanges()}function yd(e,t,n){for(let r of t.getAttributeKeys())e.checkAttribute(t,r)||n.removeAttribute(r,t)}const bd=E();var xd=class extends bd{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,n=[`$root`]){this.fire(`viewCleanup`,e),this._modelCursor=Cd(n,t),this.conversionApi.writer=t,this.conversionApi.consumable=Ao.createFrom(e),this.conversionApi.store={};let{modelRange:r}=this._convertItem(e,this._modelCursor),i=t.createDocumentFragment();if(r){this._removeEmptyElements();let e=this._modelCursor.parent,n=e._removeChildren(0,e.childCount);i._insertChild(0,n),i.markers=Sd(i,t)}return this._modelCursor=null,this._splitParts.clear(),this._cursorParents.clear(),this._emptyElementsToKeep.clear(),this.conversionApi.writer=null,this.conversionApi.store=null,i}_convertItem(e,t){let n={viewItem:e,modelCursor:t,modelRange:null};if(e.is(`element`)?this.fire(`element:${e.name}`,n,this.conversionApi):e.is(`$text`)?this.fire(`text`,n,this.conversionApi):this.fire(`documentFragment`,n,this.conversionApi),n.modelRange&&!(n.modelRange instanceof B))throw new w(`view-conversion-dispatcher-incorrect-result`,this);return{modelRange:n.modelRange,modelCursor:n.modelCursor}}_convertChildren(e,t){let n=t.is(`position`)?t:z._createAt(t,0),r=new B(n);for(let t of Array.from(e.getChildren())){let e=this._convertItem(t,n);e.modelRange instanceof B&&(r.end=e.modelRange.end,n=e.modelCursor)}return{modelRange:r,modelCursor:n}}_safeInsert(e,t){let n=this._splitToAllowedParent(e,t);return n?(this.conversionApi.writer.insert(e,n.position),!0):!1}_updateConversionResult(e,t){let n=this._getSplitParts(e),r=this.conversionApi.writer;t.modelRange||=r.createRange(r.createPositionBefore(e),r.createPositionAfter(n[n.length-1]));let i=this._cursorParents.get(e);i?t.modelCursor=r.createPositionAt(i,0):t.modelCursor=t.modelRange.end}_splitToAllowedParent(e,t){let{schema:n,writer:r}=this.conversionApi,i=n.findAllowedParent(t,e);if(i){if(i===t.parent)return{position:t};this._modelCursor.parent.getAncestors().includes(i)&&(i=null)}if(!i)return ku(t,e,n)?{position:Au(t,r)}:null;let a=this.conversionApi.writer.split(t,i),o=[];for(let e of a.range.getWalker())if(e.type==`elementEnd`)o.push(e.item);else{let t=o.pop(),n=e.item;this._registerSplitPair(t,n)}let s=a.range.end.parent;return this._cursorParents.set(e,s),{position:a.position,cursorParent:s}}_registerSplitPair(e,t){this._splitParts.has(e)||this._splitParts.set(e,[e]);let n=this._splitParts.get(e);this._splitParts.set(t,n),n.push(t)}_getSplitParts(e){let t;return t=this._splitParts.has(e)?this._splitParts.get(e):[e],t}_keepEmptyElement(e){this._emptyElementsToKeep.add(e)}_removeEmptyElements(){let e=new Map;for(let t of this._splitParts.keys())if(t.isEmpty&&!this._emptyElementsToKeep.has(t)){let n=e.get(t.parent)||[];n.push(t),this._splitParts.delete(t),e.set(t.parent,n)}for(let[t,n]of e)t._removeChildrenArray(n);e.size&&this._removeEmptyElements()}};function Sd(e,t){let n=new Set,r=new Map,i=B._createIn(e).getItems();for(let e of i)e.is(`element`,`$marker`)&&n.add(e);for(let e of n){let n=e.getAttribute(`data-name`),i=t.createPositionBefore(e);r.has(n)?r.get(n).end=i.clone():r.set(n,new B(i.clone())),t.remove(e)}return r}function Cd(e,t){let n;for(let r of new td(e)){let e={};for(let t of r.getAttributeKeys())e[t]=r.getAttribute(t);let i=t.createElement(r.name,e);n&&t.insert(i,n),n=z._createAt(i,0)}return n}var wd=class{getHtml(e){let t=u.document.implementation.createHTMLDocument(``).createElement(`div`);return t.appendChild(e),t.innerHTML}},Td=class{domParser;domConverter;htmlWriter;skipComments=!0;constructor(e){this.domParser=new DOMParser,this.domConverter=new _c(e,{renderingMode:`data`}),this.htmlWriter=new wd}toData(e){let t=this.domConverter.viewToDom(e);return this.htmlWriter.getHtml(t)}toView(e){let t=this._toDom(e);return this.domConverter.domToView(t,{skipComments:this.skipComments})}registerRawContentMatcher(e){this.domConverter.registerRawContentMatcher(e)}useFillerType(e){this.domConverter.blockFillerMode=e==`marked`?`markedNbsp`:`nbsp`}_toDom(e){/<(?:html|body|head|meta)(?:\s[^>]*)?>/i.test(e.trim().slice(0,1e4))||(e=`<body>${e}</body>`);let t=this.domParser.parseFromString(e,`text/html`),n=t.createDocumentFragment(),r=t.body.childNodes;for(;r.length>0;)n.appendChild(r[0]);return n}};const Kee=E();var Ed=class extends Kee{model;mapper;downcastDispatcher;upcastDispatcher;viewDocument;stylesProcessor;htmlProcessor;processor;_viewWriter;constructor(e,t){super(),this.model=e,this.mapper=new ol,this.downcastDispatcher=new fl({mapper:this.mapper,schema:e.schema}),this.downcastDispatcher.on(`insert:$text`,Ll(),{priority:`lowest`}),this.downcastDispatcher.on(`insert`,Rl(),{priority:`lowest`}),this.upcastDispatcher=new xd({schema:e.schema}),this.viewDocument=new Cs(t),this.stylesProcessor=t,this.htmlProcessor=new Td(this.viewDocument),this.processor=this.htmlProcessor,this._viewWriter=new Rs(this.viewDocument),this.upcastDispatcher.on(`text`,Nu(),{priority:`lowest`}),this.upcastDispatcher.on(`element`,Mu(),{priority:`lowest`}),this.upcastDispatcher.on(`documentFragment`,Mu(),{priority:`lowest`}),D().prototype.decorate.call(this,`init`),D().prototype.decorate.call(this,`set`),D().prototype.decorate.call(this,`get`),D().prototype.decorate.call(this,`toView`),D().prototype.decorate.call(this,`toModel`),this.on(`init`,()=>{this.fire(`ready`)},{priority:`lowest`}),this.on(`ready`,()=>{this.model.enqueueChange({isUndoable:!1},Ou)},{priority:`lowest`})}get(e={}){let{rootName:t=`main`,trim:n=`empty`}=e;if(!this._checkIfRootsExists([t]))throw new w(`datacontroller-get-non-existent-root`,this);let r=this.model.document.getRoot(t);return r.isAttached()||T(`datacontroller-get-detached-root`,this),n===`empty`&&!this.model.hasContent(r,{ignoreWhitespaces:!0})?``:this.stringify(r,e)}stringify(e,t={}){let n=this.toView(e,t);return this.processor.toData(n)}toView(e,t={}){let n=this.viewDocument,r=this._viewWriter;this.mapper.clearBindings();let i=B._createIn(e),a=new Is(n);this.mapper.bindElements(e,a);let o=e.is(`documentFragment`)?e.markers:qee(e);return this.downcastDispatcher.convert(i,o,r,t),a}init(e){if(this.model.document.version)throw new w(`datacontroller-init-document-not-empty`,this);let t={};if(typeof e==`string`?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new w(`datacontroller-init-non-existent-root`,this);return this.model.enqueueChange({isUndoable:!1},e=>{for(let n of Object.keys(t)){let r=this.model.document.getRoot(n);e.insert(this.parse(t[n],r),r,0)}}),Promise.resolve()}set(e,t={}){let n={};if(typeof e==`string`?n.main=e:n=e,!this._checkIfRootsExists(Object.keys(n)))throw new w(`datacontroller-set-non-existent-root`,this);this.model.enqueueChange(t.batchType||{},e=>{e.setSelection(null),e.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());for(let t of Object.keys(n)){let r=this.model.document.getRoot(t);e.remove(e.createRangeIn(r)),e.insert(this.parse(n[t],r),r,0)}})}parse(e,t=`$root`){let n=this.processor.toView(e);return this.toModel(n,t)}toModel(e,t=`$root`){return this.model.change(n=>this.upcastDispatcher.convert(e,n,t))}addStyleProcessorRules(e){e(this.stylesProcessor)}registerRawContentMatcher(e){this.processor&&this.processor!==this.htmlProcessor&&this.processor.registerRawContentMatcher(e),this.htmlProcessor.registerRawContentMatcher(e)}destroy(){this.stopListening()}_checkIfRootsExists(e){for(let t of e)if(!this.model.document.getRoot(t))return!1;return!0}};function qee(e){let t=[],n=e.root.document;if(!n)return new Map;let r=B._createIn(e);for(let e of n.model.markers){let n=e.getRange(),i=n.isCollapsed,a=n.start.isEqual(r.start)||n.end.isEqual(r.end);if(i&&a)t.push([e.name,n]);else{let i=r.getIntersection(n);i&&t.push([e.name,i])}}return new Map(t)}var Dd=class{_helpers=new Map;_downcast;_upcast;constructor(e,t){this._downcast=A(e),this._createConversionHelpers({name:`downcast`,dispatchers:this._downcast,isDowncast:!0}),this._upcast=A(t),this._createConversionHelpers({name:`upcast`,dispatchers:this._upcast,isDowncast:!1})}addAlias(e,t){let n=this._downcast.includes(t);if(!this._upcast.includes(t)&&!n)throw new w(`conversion-add-alias-dispatcher-not-registered`,this);this._createConversionHelpers({name:e,dispatchers:[t],isDowncast:n})}for(e){if(!this._helpers.has(e))throw new w(`conversion-for-unknown-group`,this);return this._helpers.get(e)}elementToElement(e){this.for(`downcast`).elementToElement(e);for(let{model:t,view:n}of Od(e))this.for(`upcast`).elementToElement({model:t,view:n,converterPriority:e.converterPriority})}attributeToElement(e){this.for(`downcast`).attributeToElement(e);for(let{model:t,view:n}of Od(e))this.for(`upcast`).elementToAttribute({view:n,model:t,converterPriority:e.converterPriority})}attributeToAttribute(e){this.for(`downcast`).attributeToAttribute(e);for(let{model:t,view:n}of Od(e))this.for(`upcast`).attributeToAttribute({view:n,model:t})}_createConversionHelpers({name:e,dispatchers:t,isDowncast:n}){if(this._helpers.has(e))throw new w(`conversion-group-exists`,this);let r=n?new Il(t):new ju(t);this._helpers.set(e,r)}};function*Od(e){if(e.model.values)for(let t of e.model.values){let n={key:e.model.key,value:t},r=e.view[t];yield*kd(n,r,e.upcastAlso?e.upcastAlso[t]:void 0)}else yield*kd(e.model,e.view,e.upcastAlso)}function*kd(e,t,n){if(yield{model:e,view:t},n)for(let t of A(n))yield{model:e,view:t}}var Ad=class{namespaces;domParser;domConverter;htmlWriter;skipComments=!0;constructor(e,t={}){this.namespaces=t.namespaces||[],this.domParser=new DOMParser,this.domConverter=new _c(e,{renderingMode:`data`}),this.htmlWriter=new wd}toData(e){let t=this.domConverter.viewToDom(e);return this.htmlWriter.getHtml(t)}toView(e){let t=this._toDom(e);return this.domConverter.domToView(t,{keepOriginalCase:!0,skipComments:this.skipComments})}registerRawContentMatcher(e){this.domConverter.registerRawContentMatcher(e)}useFillerType(e){this.domConverter.blockFillerMode=e==`marked`?`markedNbsp`:`nbsp`}_toDom(e){e=`<xml ${this.namespaces.map(e=>`xmlns:${e}="nsp"`).join(` `)}>${e}</xml>`;let t=this.domParser.parseFromString(e,`text/xml`),n=t.querySelector(`parsererror`);if(n)throw Error(`Parse error - `+n.textContent);let r=t.createDocumentFragment(),i=t.documentElement.childNodes;for(;i.length>0;)r.appendChild(i[0]);return r}},jd=class{baseVersion;isDocumentOperation;batch;constructor(e){this.baseVersion=e,this.isDocumentOperation=this.baseVersion!==null,this.batch=null}_validate(){}toJSON(){let 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 Md(e,t){let n=Id(t),r=n.reduce((e,t)=>e+t.offsetSize,0),i=e.parent;Rd(e);let a=e.index;return i._insertChild(a,n),Ld(i,a+n.length),Ld(i,a),new B(e,e.getShiftedBy(r))}function Nd(e){if(!e.isFlat)throw new w(`operation-utils-remove-range-not-flat`,this);let t=e.start.parent;Rd(e.start),Rd(e.end);let n=t._removeChildren(e.start.index,e.end.index-e.start.index);return Ld(t,e.start.index),n}function Pd(e,t){if(!e.isFlat)throw new w(`operation-utils-move-range-not-flat`,this);let n=Nd(e);return t=t._getTransformedByDeletion(e.start,e.end.offset-e.start.offset),Md(t,n)}function Fd(e,t,n){Rd(e.start),Rd(e.end);for(let r of e.getItems({shallow:!0})){let e=r.is(`$textProxy`)?r.textNode:r;n===null?e._removeAttribute(t):e._setAttribute(t,n),Ld(e.parent,e.index)}Ld(e.end.parent,e.end.index)}function Id(e){let t=[];function n(e){if(typeof e==`string`)t.push(new Sl(e));else if(e instanceof Yc)t.push(new Sl(e.data,e.getAttributes()));else if(e instanceof gl)t.push(e);else if(pr(e))for(let t of e)n(t)}n(e);for(let e=1;e<t.length;e++){let n=t[e],r=t[e-1];n instanceof Sl&&r instanceof Sl&&zd(n,r)&&(t.splice(e-1,2,new Sl(r.data+n.data,r.getAttributes())),e--)}return t}function Ld(e,t){let n=e.getChild(t-1),r=e.getChild(t);if(n&&r&&n.is(`$text`)&&r.is(`$text`)&&zd(n,r)){let i=new Sl(n.data+r.data,n.getAttributes());e._removeChildren(t-1,2),e._insertChild(t-1,i)}}function Rd(e){let t=e.textNode,n=e.parent;if(t){let r=e.offset-t.startOffset,i=t.index;n._removeChildren(i,1);let a=new Sl(t.data.substr(0,r),t.getAttributes()),o=new Sl(t.data.substr(r),t.getAttributes());n._insertChild(i,[a,o])}}function zd(e,t){let n=e.getAttributes(),r=t.getAttributes();for(let e of n){if(e[1]!==t.getAttribute(e[0]))return!1;r.next()}return r.next().done}var Bd=class e extends jd{sourcePosition;howMany;targetPosition;constructor(e,t,n,r){super(r),this.sourcePosition=e.clone(),this.sourcePosition.stickiness=`toNext`,this.howMany=t,this.targetPosition=n.clone(),this.targetPosition.stickiness=`toNone`}get type(){return this.targetPosition.root.rootName==this.sourcePosition.root.rootName?`move`:this.targetPosition.root.rootName==`$graveyard`?`remove`:this.sourcePosition.root.rootName==`$graveyard`?`reinsert`:`move`}get affectedSelectable(){return[this.sourceRange,B._createFromPositionAndShift(this.targetPosition,0)]}get sourceRange(){return B._createFromPositionAndShift(this.sourcePosition,this.howMany)}clone(){return new e(this.sourcePosition,this.howMany,this.targetPosition,this.baseVersion)}getMovedRangeStart(){return this.targetPosition._getTransformedByDeletion(this.sourcePosition,this.howMany)}getReversed(){let t=this.sourcePosition._getTransformedByInsertion(this.targetPosition,this.howMany);return new e(this.getMovedRangeStart(),this.howMany,t,this.baseVersion+1)}_validate(){let e=this.sourcePosition.parent,t=this.targetPosition.parent,n=this.sourcePosition.offset,r=this.targetPosition.offset;if(n+this.howMany>e.maxOffset)throw new w(`move-operation-nodes-do-not-exist`,this);if(e===t&&n<r&&r<n+this.howMany)throw new w(`move-operation-range-into-itself`,this);if(this.sourcePosition.root==this.targetPosition.root&&fr(this.sourcePosition.getParentPath(),this.targetPosition.getParentPath())==`prefix`){let e=this.sourcePosition.path.length-1;if(this.targetPosition.path[e]>=n&&this.targetPosition.path[e]<n+this.howMany)throw new w(`move-operation-node-into-itself`,this)}}_execute(){Pd(this.sourceRange,this.targetPosition)}toJSON(){let e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e.targetPosition=this.targetPosition.toJSON(),e}static get className(){return`MoveOperation`}static fromJSON(e,t){let n=z.fromJSON(e.sourcePosition,t),r=z.fromJSON(e.targetPosition,t);return new this(n,e.howMany,r,e.baseVersion)}},Vd=class e extends jd{position;nodes;shouldReceiveAttributes;constructor(e,t,n){super(n),this.position=e.clone(),this.position.stickiness=`toNone`,this.nodes=new Al(Id(t)),this.shouldReceiveAttributes=!1}get type(){return`insert`}get howMany(){return this.nodes.maxOffset}get affectedSelectable(){return this.position.clone()}clone(){let t=new Al([...this.nodes].map(e=>e._clone(!0))),n=new e(this.position,t,this.baseVersion);return n.shouldReceiveAttributes=this.shouldReceiveAttributes,n}getReversed(){let e=this.position.root.document.graveyard,t=new z(e,[0]);return new Bd(this.position,this.nodes.maxOffset,t,this.baseVersion+1)}_validate(){let e=this.position.parent;if(!e||e.maxOffset<this.position.offset)throw new w(`insert-operation-position-invalid`,this)}_execute(){let e=this.nodes;this.nodes=new Al([...e].map(e=>e._clone(!0))),Md(this.position,e)}toJSON(){let e=super.toJSON();return e.position=this.position.toJSON(),e.nodes=this.nodes.toJSON(),e}static get className(){return`InsertOperation`}static fromJSON(t,n){let r=[];for(let e of t.nodes)e.name?r.push(Ml.fromJSON(e)):r.push(Sl.fromJSON(e));let i=new e(z.fromJSON(t.position,n),r,t.baseVersion);return i.shouldReceiveAttributes=t.shouldReceiveAttributes,i}},Hd=class e extends jd{splitPosition;howMany;insertionPosition;graveyardPosition;constructor(e,t,n,r,i){super(i),this.splitPosition=e.clone(),this.splitPosition.stickiness=`toNext`,this.howMany=t,this.insertionPosition=n,this.graveyardPosition=r?r.clone():null,this.graveyardPosition&&(this.graveyardPosition.stickiness=`toNext`)}get type(){return`split`}get moveTargetPosition(){let e=this.insertionPosition.path.slice();return e.push(0),new z(this.insertionPosition.root,e)}get movedRange(){let e=this.splitPosition.getShiftedBy(1/0);return new B(this.splitPosition,e)}get affectedSelectable(){let e=[B._createFromPositionAndShift(this.splitPosition,0),B._createFromPositionAndShift(this.insertionPosition,0)];return this.graveyardPosition&&e.push(B._createFromPositionAndShift(this.graveyardPosition,0)),e}clone(){return new e(this.splitPosition,this.howMany,this.insertionPosition,this.graveyardPosition,this.baseVersion)}getReversed(){let e=this.splitPosition.root.document.graveyard,t=new z(e,[0]);return new Ud(this.moveTargetPosition,this.howMany,this.splitPosition,t,this.baseVersion+1)}_validate(){let e=this.splitPosition.parent,t=this.splitPosition.offset;if(!e||e.maxOffset<t)throw new w(`split-operation-position-invalid`,this);if(!e.parent)throw new w(`split-operation-split-in-root`,this);if(this.howMany!==-1/0&&this.howMany!=e.maxOffset-this.splitPosition.offset)throw new w(`split-operation-how-many-invalid`,this);if(this.graveyardPosition&&!this.graveyardPosition.nodeAfter)throw new w(`split-operation-graveyard-position-invalid`,this);this.howMany=this.splitPosition.parent.maxOffset-this.splitPosition.offset}_execute(){let e=this.splitPosition.parent;if(this.graveyardPosition)Pd(B._createFromPositionAndShift(this.graveyardPosition,1),this.insertionPosition);else{let t=e._clone();Md(this.insertionPosition,t)}Pd(new B(z._createAt(e,this.splitPosition.offset),z._createAt(e,e.maxOffset)),this.moveTargetPosition)}toJSON(){let 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){let t=e.path.slice(0,-1);return t[t.length-1]++,new z(e.root,t,`toPrevious`)}static fromJSON(e,t){let n=z.fromJSON(e.splitPosition,t),r=z.fromJSON(e.insertionPosition,t),i=e.graveyardPosition?z.fromJSON(e.graveyardPosition,t):null;return new this(n,e.howMany,r,i,e.baseVersion)}},Ud=class e extends jd{sourcePosition;howMany;targetPosition;graveyardPosition;constructor(e,t,n,r,i){super(i),this.sourcePosition=e.clone(),this.sourcePosition.stickiness=`toPrevious`,this.howMany=t,this.targetPosition=n.clone(),this.targetPosition.stickiness=`toNext`,this.graveyardPosition=r.clone()}get type(){return`merge`}get deletionPosition(){return new z(this.sourcePosition.root,this.sourcePosition.path.slice(0,-1))}get movedRange(){let e=this.sourcePosition.getShiftedBy(1/0);return new B(this.sourcePosition,e)}get affectedSelectable(){let e=this.sourcePosition.parent;return[B._createOn(e),B._createFromPositionAndShift(this.targetPosition,0),B._createFromPositionAndShift(this.graveyardPosition,0)]}clone(){return new e(this.sourcePosition,this.howMany,this.targetPosition,this.graveyardPosition,this.baseVersion)}getReversed(){let e=this.targetPosition._getTransformedByMergeOperation(this),t=this.sourcePosition.path.slice(0,-1),n=new z(this.sourcePosition.root,t)._getTransformedByMergeOperation(this);return new Hd(e,this.howMany,n,this.graveyardPosition,this.baseVersion+1)}_validate(){let e=this.sourcePosition.parent,t=this.targetPosition.parent;if(!e.parent)throw new w(`merge-operation-source-position-invalid`,this);if(!t.parent)throw new w(`merge-operation-target-position-invalid`,this);if(this.howMany!==-1/0&&this.howMany!=e.maxOffset)throw new w(`merge-operation-how-many-invalid`,this);this.howMany=this.sourcePosition.parent.maxOffset}_execute(){let e=this.sourcePosition.parent;Pd(B._createIn(e),this.targetPosition),Pd(B._createOn(e),this.graveyardPosition)}toJSON(){let 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){let n=z.fromJSON(e.sourcePosition,t),r=z.fromJSON(e.targetPosition,t),i=z.fromJSON(e.graveyardPosition,t);return new this(n,e.howMany,r,i,e.baseVersion)}},Wd=class e extends jd{name;oldRange;newRange;affectsData;_markers;constructor(e,t,n,r,i,a){super(a),this.name=e,this.oldRange=t?t.clone():null,this.newRange=n?n.clone():null,this.affectsData=i,this._markers=r}get type(){return`marker`}get affectedSelectable(){let 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 e(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new e(this.name,this.newRange,this.oldRange,this._markers,this.affectsData,this.baseVersion+1)}_execute(){this.newRange?this._markers._set(this.name,this.newRange,!0,this.affectsData):this._markers._remove(this.name)}toJSON(){let 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(t,n){return new e(t.name,t.oldRange?B.fromJSON(t.oldRange,n):null,t.newRange?B.fromJSON(t.newRange,n):null,n.model.markers,t.affectsData,t.baseVersion)}},Gd=class e extends jd{range;key;oldValue;newValue;constructor(e,t,n,r,i){super(i),this.range=e.clone(),this.key=t,this.oldValue=n===void 0?null:n,this.newValue=r===void 0?null:r}get type(){return this.oldValue===null?`addAttribute`:this.newValue===null?`removeAttribute`:`changeAttribute`}get affectedSelectable(){return this.range.clone()}clone(){return new e(this.range,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new e(this.range,this.key,this.newValue,this.oldValue,this.baseVersion+1)}toJSON(){let e=super.toJSON();return e.range=this.range.toJSON(),e}_validate(){if(!this.range.isFlat)throw new w(`attribute-operation-range-not-flat`,this);for(let e of this.range.getItems({shallow:!0})){if(this.oldValue!==null&&!$t(e.getAttribute(this.key),this.oldValue))throw new w(`attribute-operation-wrong-old-value`,this,{item:e,key:this.key,value:this.oldValue});if(this.oldValue===null&&this.newValue!==null&&e.hasAttribute(this.key))throw new w(`attribute-operation-attribute-exists`,this,{node:e,key:this.key})}}_execute(){$t(this.oldValue,this.newValue)||Fd(this.range,this.key,this.newValue)}static get className(){return`AttributeOperation`}static fromJSON(t,n){return new e(B.fromJSON(t.range,n),t.key,t.oldValue,t.newValue,t.baseVersion)}},Kd=class e extends jd{get type(){return`noop`}get affectedSelectable(){return null}clone(){return new e(this.baseVersion)}getReversed(){return new e(this.baseVersion+1)}_execute(){}static get className(){return`NoOperation`}},qd=class e extends jd{position;oldName;newName;constructor(e,t,n,r){super(r),this.position=e,this.position.stickiness=`toNext`,this.oldName=t,this.newName=n}get type(){return`rename`}get affectedSelectable(){return this.position.nodeAfter}clone(){return new e(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new e(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){let e=this.position.nodeAfter;if(!(e instanceof Ml))throw new w(`rename-operation-wrong-position`,this);if(this.oldName!==``&&e.name!==this.oldName)throw new w(`rename-operation-wrong-name`,this);this.oldName=e.name}_execute(){let e=this.position.nodeAfter;e.name=this.newName}toJSON(){let e=super.toJSON();return e.position=this.position.toJSON(),e}static get className(){return`RenameOperation`}static fromJSON(t,n){return new e(z.fromJSON(t.position,n),t.oldName,t.newName,t.baseVersion)}},Jd=class e extends jd{root;key;oldValue;newValue;constructor(e,t,n,r,i){super(i),this.root=e,this.key=t,this.oldValue=n===void 0?null:n,this.newValue=r===void 0?null:r}get type(){return this.oldValue===null?`addRootAttribute`:this.newValue===null?`removeRootAttribute`:`changeRootAttribute`}get affectedSelectable(){return this.root}clone(){return new e(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new e(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is(`documentFragment`))throw new w(`rootattribute-operation-not-a-root`,this,{root:this.root,key:this.key});if(this.oldValue!==null&&!$t(this.root.getAttribute(this.key),this.oldValue))throw new w(`rootattribute-operation-wrong-old-value`,this,{root:this.root,key:this.key});if(this.oldValue===null&&this.newValue!==null&&this.root.hasAttribute(this.key))throw new w(`rootattribute-operation-attribute-exists`,this,{root:this.root,key:this.key})}_execute(){this.newValue===null?this.root._removeAttribute(this.key):this.root._setAttribute(this.key,this.newValue)}toJSON(){let e=super.toJSON();return e.root=this.root.toJSON(),e}static get className(){return`RootAttributeOperation`}static fromJSON(t,n){if(!n.getRoot(t.root))throw new w(`rootattribute-operation-fromjson-no-root`,this,{rootName:t.root});return new e(n.getRoot(t.root),t.key,t.oldValue,t.newValue,t.baseVersion)}},Yd=class e extends jd{rootName;elementName;isAdd;_document;constructor(e,t,n,r,i){if(super(i),this.rootName=e,this.elementName=t,this.isAdd=n,this._document=r,!this._document.getRoot(this.rootName)){let e=this._document.createRoot(this.elementName,this.rootName);e._isAttached=!1}}get type(){return this.isAdd?`addRoot`:`detachRoot`}get affectedSelectable(){return this._document.getRoot(this.rootName)}clone(){return new e(this.rootName,this.elementName,this.isAdd,this._document,this.baseVersion)}getReversed(){return new e(this.rootName,this.elementName,!this.isAdd,this._document,this.baseVersion+1)}_execute(){this._document.getRoot(this.rootName)._isAttached=this.isAdd}toJSON(){let e=super.toJSON();return delete e._document,e}static get className(){return`RootOperation`}static fromJSON(t,n){return new e(t.rootName,t.elementName,t.isAdd,n,t.baseVersion)}};const Xd={};Xd[Gd.className]=Gd,Xd[Vd.className]=Vd,Xd[Wd.className]=Wd,Xd[Bd.className]=Bd,Xd[Kd.className]=Kd,Xd[jd.className]=jd,Xd[qd.className]=qd,Xd[Jd.className]=Jd,Xd[Yd.className]=Yd,Xd[Hd.className]=Hd,Xd[Ud.className]=Ud;var Zd=class{static fromJSON(e,t){return Xd[e.__className].fromJSON(e,t)}};const Qd=new Map;function V(e,t,n){let r=Qd.get(e);r||(r=new Map,Qd.set(e,r)),r.set(t,n)}function $d(e,t){let n=Qd.get(e);return n&&n.has(t)?n.get(t):ef}function ef(e){return[e]}function tf(e,t,n={}){let r=$d(e.constructor,t.constructor);try{return e=e.clone(),r(e,t,n)}catch(e){throw e}}function nf(e,t,n){e=e.slice(),t=t.slice();let r=new rf(n.document,n.useRelations,n.forceWeakRemove);r.setOriginalOperations(e),r.setOriginalOperations(t);let i=r.originalOperations;if(e.length==0||t.length==0)return{operationsA:e,operationsB:t,originalOperations:i};let a=new WeakMap;for(let t of e)a.set(t,0);let o={nextBaseVersionA:e[e.length-1].baseVersion+1,nextBaseVersionB:t[t.length-1].baseVersion+1,originalOperationsACount:e.length,originalOperationsBCount:t.length},s=0;for(;s<e.length;){let n=e[s],i=a.get(n);if(i==t.length){s++;continue}let o=t[i],c=tf(n,o,r.getContext(n,o,!0)),l=tf(o,n,r.getContext(o,n,!1));r.updateRelation(n,o),r.setOriginalOperations(c,n),r.setOriginalOperations(l,o);for(let e of c)a.set(e,i+l.length);e.splice(s,1,...c),t.splice(i,1,...l)}if(sf(e),sf(t),n.padWithNoOps){let n=e.length-o.originalOperationsACount,r=t.length-o.originalOperationsBCount;of(e,r-n),of(t,n-r)}return af(e,o.nextBaseVersionB),af(t,o.nextBaseVersionA),{operationsA:e,operationsB:t,originalOperations:i}}var rf=class{originalOperations;_history;_useRelations;_forceWeakRemove;_relations;constructor(e,t,n=!1){this.originalOperations=new Map,this._history=e.history,this._useRelations=t,this._forceWeakRemove=!!n,this._relations=new Map}setOriginalOperations(e,t=null){let n=t?this.originalOperations.get(t):null;for(let t of e)this.originalOperations.set(t,n||t)}updateRelation(e,t){if(e instanceof Bd)t instanceof Ud?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 Bd&&(e.targetPosition.isEqual(t.sourcePosition)||e.targetPosition.isBefore(t.sourcePosition)?this._setRelation(e,t,`insertBefore`):this._setRelation(e,t,`insertAfter`));else if(e instanceof Hd){if(t instanceof Ud)e.splitPosition.isBefore(t.sourcePosition)&&this._setRelation(e,t,`splitBefore`);else if(t instanceof Bd)if(e.splitPosition.isEqual(t.sourcePosition)||e.splitPosition.isBefore(t.sourcePosition))this._setRelation(e,t,`splitBefore`);else{let n=B._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&n.containsPosition(e.splitPosition)){let r=n.end.offset-e.splitPosition.offset,i=e.splitPosition.offset-n.start.offset;this._setRelation(e,t,{howMany:r,offset:i})}}}else if(e instanceof Ud)t instanceof Ud?(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 Hd?e.sourcePosition.isEqual(t.splitPosition)&&this._setRelation(e,t,`splitAtSource`):t instanceof Bd&&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 Wd){let n=e.newRange;if(!n)return;if(t instanceof Ud){let r=n.start.isEqual(t.targetPosition),i=n.start.isEqual(t.deletionPosition),a=n.end.isEqual(t.deletionPosition),o=n.end.isEqual(t.sourcePosition);(r||i||a||o)&&this._setRelation(e,t,{wasInLeftElement:r,wasStartBeforeMergedElement:i,wasEndBeforeMergedElement:a,wasInRightElement:o})}}}getContext(e,t,n){return{aIsStrong:n,aWasUndone:this._wasUndone(e),bWasUndone:this._wasUndone(t),abRelation:this._useRelations?this._getRelation(e,t):null,baRelation:this._useRelations?this._getRelation(t,e):null,forceWeakRemove:this._forceWeakRemove}}_wasUndone(e){let t=this.originalOperations.get(e);return t.wasUndone||this._history.isUndoneOperation(t)}_getRelation(e,t){let n=this.originalOperations.get(t),r=this._history.getUndoneOperation(n);if(!r)return null;let i=this.originalOperations.get(e),a=this._relations.get(i);return a&&a.get(r)||null}_setRelation(e,t,n){let r=this.originalOperations.get(e),i=this.originalOperations.get(t),a=this._relations.get(r);a||(a=new Map,this._relations.set(r,a)),a.set(i,n)}};function af(e,t){for(let n of e)n.baseVersion=t++}function of(e,t){for(let n=0;n<t;n++)e.push(new Kd(0))}function sf(e){let t=new Map;for(let n=0;n<e.length;n++){let r=e[n];if(r instanceof Wd)if(r.baseVersion!==-1)t.set(r.name,{op:r,ranges:r.newRange?[r.newRange]:[]});else{if(r.newRange){let e=t.get(r.name).ranges;e[0].containsRange(r.newRange,!0)||e.push(r.newRange)}e.splice(n,1),n--}}for(let{op:e,ranges:n}of t.values())n.length?e.newRange=B._createFromRanges(n):e.newRange=null}V(Gd,Gd,(e,t,n)=>{if(e.key===t.key&&e.range.start.hasSameParentAs(t.range.start)){let r=e.range.getDifference(t.range).map(t=>new Gd(t,e.key,e.oldValue,e.newValue,0)),i=e.range.getIntersection(t.range);return i&&n.aIsStrong&&r.push(new Gd(i,t.key,t.newValue,e.newValue,0)),r.length==0?[new Kd(0)]:r}else return[e]}),V(Gd,Vd,(e,t)=>{if(e.range.start.hasSameParentAs(t.position)&&e.range.containsPosition(t.position)){let n=e.range._getTransformedByInsertion(t.position,t.howMany,!t.shouldReceiveAttributes).map(t=>new Gd(t,e.key,e.oldValue,e.newValue,e.baseVersion));if(t.shouldReceiveAttributes){let r=cf(t,e.key,e.oldValue);r&&n.unshift(r)}return n}return e.range=e.range._getTransformedByInsertion(t.position,t.howMany,!1)[0],[e]});function cf(e,t,n){let r=e.nodes.getNode(0).getAttribute(t);return r==n?null:new Gd(new B(e.position,e.position.getShiftedBy(e.howMany)),t,r,n,0)}V(Gd,Ud,(e,t)=>{let n=[];e.range.start.hasSameParentAs(t.deletionPosition)&&(e.range.containsPosition(t.deletionPosition)||e.range.start.isEqual(t.deletionPosition))&&n.push(B._createFromPositionAndShift(t.graveyardPosition,1));let r=e.range._getTransformedByMergeOperation(t);return r.isCollapsed||n.push(r),n.map(t=>new Gd(t,e.key,e.oldValue,e.newValue,e.baseVersion))}),V(Gd,Bd,(e,t)=>lf(e.range,t).map(t=>new Gd(t,e.key,e.oldValue,e.newValue,e.baseVersion)));function lf(e,t){let n=B._createFromPositionAndShift(t.sourcePosition,t.howMany),r=null,i=[];n.containsRange(e,!0)?r=e:e.start.hasSameParentAs(n.start)?(i=e.getDifference(n),r=e.getIntersection(n)):i=[e];let a=[];for(let e of i){e=e._getTransformedByDeletion(t.sourcePosition,t.howMany);let n=t.getMovedRangeStart(),r=e.start.hasSameParentAs(n),i=e._getTransformedByInsertion(n,t.howMany,r);a.push(...i)}return r&&a.push(r._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany,!1)[0]),a}V(Gd,Hd,(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)){let n=e.clone();return n.range=new B(t.moveTargetPosition.clone(),e.range.end._getCombined(t.splitPosition,t.moveTargetPosition)),e.range.end=t.splitPosition.clone(),e.range.end.stickiness=`toPrevious`,[e,n]}return e.range=e.range._getTransformedBySplitOperation(t),[e]}),V(Vd,Gd,(e,t)=>{let n=[e];if(e.shouldReceiveAttributes&&e.position.hasSameParentAs(t.range.start)&&t.range.containsPosition(e.position)){let r=cf(e,t.key,t.newValue);r&&n.push(r)}return n}),V(Vd,Vd,(e,t,n)=>(e.position.isEqual(t.position)&&n.aIsStrong||(e.position=e.position._getTransformedByInsertOperation(t)),[e])),V(Vd,Bd,(e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e])),V(Vd,Hd,(e,t)=>(e.position=e.position._getTransformedBySplitOperation(t),[e])),V(Vd,Ud,(e,t)=>(e.position=e.position._getTransformedByMergeOperation(t),[e])),V(Wd,Vd,(e,t)=>(e.oldRange&&=e.oldRange._getTransformedByInsertOperation(t)[0],e.newRange&&=e.newRange._getTransformedByInsertOperation(t)[0],[e])),V(Wd,Wd,(e,t,n)=>{if(e.name==t.name)if(n.aIsStrong)e.oldRange=t.newRange?t.newRange.clone():null;else return[new Kd(0)];return[e]}),V(Wd,Ud,(e,t)=>(e.oldRange&&=e.oldRange._getTransformedByMergeOperation(t),e.newRange&&=e.newRange._getTransformedByMergeOperation(t),[e])),V(Wd,Bd,(e,t)=>{let n=[e];if(e.oldRange&&=B._createFromRanges(e.oldRange._getTransformedByMoveOperation(t)),e.newRange){let r=e.newRange._getTransformedByMoveOperation(t);e.newRange=r[0];for(let t=1;t<r.length;t++){let i=e.clone();i.oldRange=null,i.newRange=r[t],i.baseVersion=-1,n.push(i)}}return n}),V(Wd,Hd,(e,t,n)=>{if(e.oldRange&&=e.oldRange._getTransformedBySplitOperation(t),e.newRange){if(n.abRelation){let r=e.newRange._getTransformedBySplitOperation(t);return e.newRange.start.isEqual(t.splitPosition)?n.abRelation.wasStartBeforeMergedElement?e.newRange.start=z._createAt(t.insertionPosition):n.abRelation.wasInLeftElement?e.newRange.start=z._createAt(e.newRange.start):e.newRange.start=z._createAt(t.moveTargetPosition):e.newRange.start=r.start,e.newRange.end.isEqual(t.splitPosition)?e.newRange.end.isEqual(t.splitPosition)&&n.abRelation.wasEndBeforeMergedElement?e.newRange.end=z._createAt(t.insertionPosition):n.abRelation.wasInRightElement?e.newRange.end=z._createAt(t.moveTargetPosition):e.newRange.end=z._createAt(e.newRange.end):e.newRange.end=r.end,[e]}e.newRange=e.newRange._getTransformedBySplitOperation(t)}return[e]}),V(Ud,Vd,(e,t)=>(e.sourcePosition.hasSameParentAs(t.position)&&(e.howMany+=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByInsertOperation(t),e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t),[e])),V(Ud,Ud,(e,t,n)=>{if(e.sourcePosition.isEqual(t.sourcePosition)&&e.targetPosition.isEqual(t.targetPosition))if(n.bWasUndone){let n=t.graveyardPosition.path.slice();return n.push(0),e.sourcePosition=new z(t.graveyardPosition.root,n),e.howMany=0,[e]}else return[new Kd(0)];if(e.sourcePosition.isEqual(t.sourcePosition)&&!e.targetPosition.isEqual(t.targetPosition)&&!n.bWasUndone&&n.abRelation!=`splitAtSource`){let r=e.targetPosition.root.rootName==`$graveyard`,i=t.targetPosition.root.rootName==`$graveyard`;if(i&&!r||!(r&&!i)&&n.aIsStrong){let n=t.targetPosition._getTransformedByMergeOperation(t),r=e.targetPosition._getTransformedByMergeOperation(t);return[new Bd(n,e.howMany,r,0)]}else return[new Kd(0)]}return e.sourcePosition.hasSameParentAs(t.targetPosition)&&(e.howMany+=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByMergeOperation(t),e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),(!e.graveyardPosition.isEqual(t.graveyardPosition)||!n.aIsStrong)&&(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]}),V(Ud,Bd,(e,t,n)=>{let r=B._createFromPositionAndShift(t.sourcePosition,t.howMany);return t.type==`remove`&&!n.bWasUndone&&e.deletionPosition.hasSameParentAs(t.sourcePosition)&&r.containsPosition(e.sourcePosition)?[new Kd(0)]:(t.sourcePosition.getShiftedBy(t.howMany).isEqual(e.sourcePosition)?e.sourcePosition.stickiness=`toNone`:t.targetPosition.isEqual(e.sourcePosition)&&n.abRelation==`mergeSourceAffected`?e.sourcePosition.stickiness=`toNext`:t.sourcePosition.isEqual(e.targetPosition)?(e.targetPosition.stickiness=`toNone`,e.howMany-=t.howMany):t.targetPosition.isEqual(e.targetPosition)&&n.abRelation==`mergeTargetWasBefore`?(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])}),V(Ud,Hd,(e,t,n)=>{if(t.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedByDeletion(t.graveyardPosition,1),e.deletionPosition.isEqual(t.graveyardPosition)&&(e.howMany=t.howMany)),e.targetPosition.isEqual(t.splitPosition)&&(t.graveyardPosition&&e.deletionPosition.isEqual(t.graveyardPosition)||n.abRelation==`mergeTargetNotMoved`))return e.sourcePosition=e.sourcePosition._getTransformedBySplitOperation(t),[e];if(e.sourcePosition.isEqual(t.splitPosition)){if(n.abRelation==`mergeSourceNotMoved`)return e.howMany=0,e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e];if(n.abRelation==`mergeSameElement`||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]}),V(Bd,Vd,(e,t)=>{let n=B._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByInsertOperation(t,!1)[0];return e.sourcePosition=n.start,e.howMany=n.end.offset-n.start.offset,e.targetPosition.isEqual(t.position)||(e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t)),[e]}),V(Bd,Bd,(e,t,n)=>{let r=B._createFromPositionAndShift(e.sourcePosition,e.howMany),i=B._createFromPositionAndShift(t.sourcePosition,t.howMany),a=n.aIsStrong,o=!n.aIsStrong;n.abRelation==`insertBefore`||n.baRelation==`insertAfter`?o=!0:(n.abRelation==`insertAfter`||n.baRelation==`insertBefore`)&&(o=!1);let s;if(s=e.targetPosition.isEqual(t.targetPosition)&&o?e.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany):e.targetPosition._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),uf(e,t)&&uf(t,e))return[t.getReversed()];if(r.containsPosition(t.targetPosition)&&r.containsRange(i,!0))return r.start=r.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),r.end=r.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),df([r],s);if(i.containsPosition(e.targetPosition)&&i.containsRange(r,!0))return r.start=r.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),r.end=r.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),df([r],s);let c=fr(e.sourcePosition.getParentPath(),t.sourcePosition.getParentPath());if(c==`prefix`||c==`extension`)return r.start=r.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),r.end=r.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),df([r],s);e.type==`remove`&&t.type!=`remove`&&!n.aWasUndone&&!n.forceWeakRemove?a=!0:e.type!=`remove`&&t.type==`remove`&&!n.bWasUndone&&!n.forceWeakRemove&&(a=!1);let l=[],u=r.getDifference(i);for(let e of u){e.start=e.start._getTransformedByDeletion(t.sourcePosition,t.howMany),e.end=e.end._getTransformedByDeletion(t.sourcePosition,t.howMany);let n=fr(e.start.getParentPath(),t.getMovedRangeStart().getParentPath())==`same`,r=e._getTransformedByInsertion(t.getMovedRangeStart(),t.howMany,n);l.push(...r)}let d=r.getIntersection(i);return d!==null&&a&&(d.start=d.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),d.end=d.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),l.length===0?l.push(d):l.length==1?i.start.isBefore(r.start)||i.start.isEqual(r.start)?l.unshift(d):l.push(d):l.splice(1,0,d)),l.length===0?[new Kd(e.baseVersion)]:df(l,s)}),V(Bd,Hd,(e,t,n)=>{let r=e.targetPosition.clone();if((!e.targetPosition.isEqual(t.insertionPosition)||!t.graveyardPosition||n.abRelation==`moveTargetAfter`)&&(r=e.targetPosition._getTransformedBySplitOperation(t)),e.sourcePosition.isEqual(t.insertionPosition)&&n.abRelation==`firstToMoveMerged`)return e.howMany++,e.targetPosition=r,[e];let i=B._createFromPositionAndShift(e.sourcePosition,e.howMany);if(i.end.isEqual(t.insertionPosition))return(!t.graveyardPosition||n.abRelation==`lastToMoveMerged`)&&e.howMany++,e.targetPosition=r,[e];if(i.start.hasSameParentAs(t.splitPosition)&&i.containsPosition(t.splitPosition)){let e=new B(t.splitPosition,i.end);return e=e._getTransformedBySplitOperation(t),df([new B(i.start,t.splitPosition),e],r)}e.targetPosition.isEqual(t.splitPosition)&&n.abRelation==`insertAtSource`&&(r=t.moveTargetPosition),e.targetPosition.isEqual(t.insertionPosition)&&n.abRelation==`insertBetween`&&(r=e.targetPosition);let a=[i._getTransformedBySplitOperation(t)];if(t.graveyardPosition){let r=i.start.isEqual(t.graveyardPosition)||i.containsPosition(t.graveyardPosition);e.howMany>1&&r&&!n.aWasUndone&&a.push(B._createFromPositionAndShift(t.insertionPosition,1))}return df(a,r)}),V(Bd,Ud,(e,t,n)=>{let r=B._createFromPositionAndShift(e.sourcePosition,e.howMany);if(t.deletionPosition.hasSameParentAs(e.sourcePosition)&&r.containsPosition(t.sourcePosition)){if(e.type==`remove`&&!n.forceWeakRemove){if(!n.aWasUndone){let n=[],r=t.graveyardPosition.clone(),i=t.targetPosition._getTransformedByMergeOperation(t),a=e.targetPosition.getTransformedByOperation(t);e.howMany>1&&(n.push(new Bd(e.sourcePosition,e.howMany-1,a,0)),r=r._getTransformedByMove(e.sourcePosition,a,e.howMany-1),i=i._getTransformedByMove(e.sourcePosition,a,e.howMany-1));let o=t.deletionPosition._getCombined(e.sourcePosition,a),s=new Bd(r,1,o,0),c=s.getMovedRangeStart().path.slice();c.push(0);let l=new z(s.targetPosition.root,c);i=i._getTransformedByMove(r,o,1);let u=new Bd(i,t.howMany,l,0);return n.push(s),n.push(u),n}}else if(e.howMany==1)return n.bWasUndone?(e.sourcePosition=t.graveyardPosition.clone(),e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),[e]):[new Kd(0)]}let i=B._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByMergeOperation(t);return e.sourcePosition=i.start,e.howMany=i.end.offset-i.start.offset,e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),[e]}),V(qd,Vd,(e,t)=>(e.position=e.position._getTransformedByInsertOperation(t),[e])),V(qd,Ud,(e,t)=>e.position.isEqual(t.deletionPosition)?(e.position=t.graveyardPosition.clone(),e.position.stickiness=`toNext`,[e]):(e.position=e.position._getTransformedByMergeOperation(t),[e])),V(qd,Bd,(e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e])),V(qd,qd,(e,t,n)=>{if(e.position.isEqual(t.position))if(n.aIsStrong)e.oldName=t.newName;else return[new Kd(0)];return[e]}),V(qd,Hd,(e,t)=>{let n=e.position.path;return fr(n,t.splitPosition.getParentPath())==`same`&&!t.graveyardPosition?[e,new qd(e.position.getShiftedBy(1),e.oldName,e.newName,0)]:(e.position=e.position._getTransformedBySplitOperation(t),[e])}),V(Jd,Jd,(e,t,n)=>{if(e.root===t.root&&e.key===t.key)if(n.aIsStrong)e.oldValue=t.newValue;else return[new Kd(0)];return[e]}),V(Yd,Yd,(e,t)=>e.rootName===t.rootName&&e.isAdd===t.isAdd?[new Kd(0)]:[e]),V(Hd,Vd,(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])),V(Hd,Ud,(e,t,n)=>{if(!e.graveyardPosition&&!n.bWasUndone&&e.splitPosition.hasSameParentAs(t.sourcePosition)){let n=t.graveyardPosition.path.slice();n.push(0);let r=new Hd(new z(t.graveyardPosition.root,n),0,Hd.getInsertionPosition(new z(t.graveyardPosition.root,n)),null,0);return e.splitPosition=e.splitPosition._getTransformedByMergeOperation(t),e.insertionPosition=Hd.getInsertionPosition(e.splitPosition),e.graveyardPosition=r.insertionPosition.clone(),e.graveyardPosition.stickiness=`toNext`,[r,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=Hd.getInsertionPosition(e.splitPosition),e.graveyardPosition&&=e.graveyardPosition._getTransformedByMergeOperation(t),[e]}),V(Hd,Bd,(e,t,n)=>{let r=B._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.graveyardPosition){let i=r.start.isEqual(e.graveyardPosition)||r.containsPosition(e.graveyardPosition);if(!n.bWasUndone&&i){let n=e.splitPosition._getTransformedByMoveOperation(t),r=e.graveyardPosition._getTransformedByMoveOperation(t),i=r.path.slice();i.push(0);let a=new z(r.root,i);return[new Bd(n,e.howMany,a,0)]}e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(t)}let i=e.splitPosition.isEqual(t.targetPosition);if(i&&(n.baRelation==`insertAtSource`||n.abRelation==`splitBefore`))return e.howMany+=t.howMany,e.splitPosition=e.splitPosition._getTransformedByDeletion(t.sourcePosition,t.howMany),e.insertionPosition=Hd.getInsertionPosition(e.splitPosition),[e];if(i&&n.abRelation&&n.abRelation.howMany){let{howMany:t,offset:r}=n.abRelation;return e.howMany+=t,e.splitPosition=e.splitPosition.getShiftedBy(r),[e]}if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&r.containsPosition(e.splitPosition)){let n=t.howMany-(e.splitPosition.offset-t.sourcePosition.offset);return e.howMany-=n,e.splitPosition.hasSameParentAs(t.targetPosition)&&e.splitPosition.offset<t.targetPosition.offset&&(e.howMany+=t.howMany),e.splitPosition=t.sourcePosition.clone(),e.insertionPosition=Hd.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=Hd.getInsertionPosition(e.splitPosition),[e]}),V(Hd,Hd,(e,t,n)=>{if(e.splitPosition.isEqual(t.splitPosition)){if(!e.graveyardPosition&&!t.graveyardPosition||e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition))return[new Kd(0)];if(n.abRelation==`splitBefore`)return e.howMany=0,e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t),[e]}if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition)){let r=e.splitPosition.root.rootName==`$graveyard`,i=t.splitPosition.root.rootName==`$graveyard`;if(i&&!r||!(r&&!i)&&n.aIsStrong){let n=[];return t.howMany&&n.push(new Bd(t.moveTargetPosition,t.howMany,t.splitPosition,0)),e.howMany&&n.push(new Bd(e.splitPosition,e.howMany,e.moveTargetPosition,0)),n}else return[new Kd(0)]}if(e.graveyardPosition&&=e.graveyardPosition._getTransformedBySplitOperation(t),e.splitPosition.isEqual(t.insertionPosition)&&n.abRelation==`splitBefore`)return e.howMany++,[e];if(t.splitPosition.isEqual(e.insertionPosition)&&n.baRelation==`splitBefore`){let n=t.insertionPosition.path.slice();n.push(0);let r=new z(t.insertionPosition.root,n);return[e,new Bd(e.insertionPosition,1,r,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=Hd.getInsertionPosition(e.splitPosition),[e]});function uf(e,t){return e.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany)===null}function df(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=new Bd(i.start,i.end.offset-i.start.offset,t,0);n.push(a);for(let t=r+1;t<e.length;t++)e[t]=e[t]._getTransformedByMove(a.sourcePosition,a.targetPosition,a.howMany)[0];t=t._getTransformedByMove(a.sourcePosition,a.targetPosition,a.howMany)}return n}const ff=E(z);var pf=class extends ff{constructor(e,t,n=`toNone`){if(super(e,t,n),!this.root.is(`rootElement`))throw new w(`model-liveposition-root-not-rootelement`,e);mf.call(this)}detach(){this.stopListening()}toPosition(){return new z(this.root,this.path.slice(),this.stickiness)}static fromPosition(e,t){return new this(e.root,e.path.slice(),t||e.stickiness)}};pf.prototype.is=function(e){return e===`livePosition`||e===`model:livePosition`||e==`position`||e===`model:position`};function mf(){this.listenTo(this.root.document.model,`applyOperation`,(e,t)=>{let n=t[0];n.isDocumentOperation&&hf.call(this,n)},{priority:`low`})}function hf(e){let t=this.getTransformedByOperation(e);if(!this.isEqual(t)){let e=this.toPosition();this.path=t.path,this.root=t.root,this.fire(`change`,e)}}var gf=class{operations;isUndoable;isLocal;isUndo;isTyping;constructor(e={}){typeof e==`string`&&(e=e===`transparent`?{isUndoable:!1}:{},T(`batch-constructor-deprecated-string-type`));let{isUndoable:t=!0,isLocal:n=!0,isUndo:r=!1,isTyping:i=!1}=e;this.operations=[],this.isUndoable=t,this.isLocal=n,this.isUndo=r,this.isTyping=i}get baseVersion(){for(let e of this.operations)if(e.baseVersion!==null)return e.baseVersion;return null}addOperation(e){return e.isDocumentOperation&&(e.batch=this,this.operations.push(e)),e}},_f=class e{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 this._changesInElement.size==0&&this._changedMarkers.size==0&&this._changedRoots.size==0}bufferOperation(e){let 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(let e of t.range.getItems({shallow:!0}))this._isInInsertedElement(e.parent)||this._markAttribute(e);break;case`remove`:case`move`:case`reinsert`:{if(t.sourcePosition.isEqual(t.targetPosition)||t.sourcePosition.getShiftedBy(t.howMany).isEqual(t.targetPosition))return;let e=this._isInInsertedElement(t.sourcePosition.parent),n=this._isInInsertedElement(t.targetPosition.parent);e||this._markRemove(t.sourcePosition.parent,t.sourcePosition.offset,t.howMany),n||this._markInsert(t.targetPosition.parent,t.getMovedRangeStart().offset,t.howMany);let r=B._createFromPositionAndShift(t.sourcePosition,t.howMany);for(let e of r.getItems({shallow:!0}))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);let e=B._createFromPositionAndShift(t.position,1);for(let t of this._markerCollection.getMarkersIntersectingRange(e)){let e=t.getData();this.bufferMarkerChange(t.name,e,e)}this._setElementState(t.position.nodeAfter,`rename`);break}case`split`:{let e=t.splitPosition.parent;if(!this._isInInsertedElement(e)){this._markRemove(e,t.splitPosition.offset,t.howMany);let n=B._createFromPositionAndShift(t.splitPosition,t.howMany);for(let e of n.getItems({shallow:!0}))this._setElementState(e,`move`)}this._isInInsertedElement(t.insertionPosition.parent)||this._markInsert(t.insertionPosition.parent,t.insertionPosition.offset,1),t.graveyardPosition&&(this._markRemove(t.graveyardPosition.parent,t.graveyardPosition.offset,1),this._setElementState(t.graveyardPosition.nodeAfter,`move`));break}case`merge`:{let e=t.sourcePosition.parent;this._isInInsertedElement(e.parent)||this._markRemove(e.parent,e.startOffset,1);let n=t.graveyardPosition.parent;this._markInsert(n,t.graveyardPosition.offset,1),this._setElementState(e,`move`);let r=t.targetPosition.parent;if(!this._isInInsertedElement(r)){this._markInsert(r,t.targetPosition.offset,e.maxOffset);let n=B._createFromPositionAndShift(t.sourcePosition,t.howMany);for(let e of n.getItems({shallow:!0}))this._setElementState(e,`move`)}break}case`detachRoot`:case`addRoot`:{let e=t.affectedSelectable;if(!e._isLoaded||e.isAttached()==t.isAdd)return;this._bufferRootStateChange(t.rootName,t.isAdd);break}case`addRootAttribute`:case`removeRootAttribute`:case`changeRootAttribute`:{if(!t.root._isLoaded)return;let e=t.root.rootName;this._bufferRootAttributeChange(e,t.key,t.oldValue,t.newValue);break}}this._cachedChanges=null}bufferMarkerChange(e,t,n){t.range&&t.range.root.is(`rootElement`)&&!t.range.root._isLoaded&&(t.range=null),n.range&&n.range.root.is(`rootElement`)&&!n.range.root._isLoaded&&(n.range=null);let r=this._changedMarkers.get(e);r?r.newMarkerData=n:(r={newMarkerData:n,oldMarkerData:t},this._changedMarkers.set(e,r)),r.oldMarkerData.range==null&&n.range==null&&this._changedMarkers.delete(e)}getMarkersToRemove(){let e=[];for(let[t,n]of this._changedMarkers)n.oldMarkerData.range!=null&&e.push({name:t,range:n.oldMarkerData.range});return e}getMarkersToAdd(){let e=[];for(let[t,n]of this._changedMarkers)n.newMarkerData.range!=null&&e.push({name:t,range:n.newMarkerData.range});return e}getChangedMarkers(){return Array.from(this._changedMarkers).map(([e,t])=>({name:e,data:{oldRange:t.oldMarkerData.range,newRange:t.newMarkerData.range}}))}hasDataChanges(){if(this.getChanges().length||this._changedRoots.size>0)return!0;for(let{newMarkerData:e,oldMarkerData:t}of this._changedMarkers.values()){if(e.affectsData!==t.affectsData)return!0;if(e.affectsData){let n=e.range&&!t.range,r=!e.range&&t.range,i=e.range&&t.range&&!e.range.isEqual(t.range);if(n||r||i)return!0}}return!1}getChanges(e={}){if(this._cachedChanges)return e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice();let t=[];for(let e of this._changesInElement.keys()){let n=this._changesInElement.get(e).sort((e,t)=>e.offset===t.offset?e.type==t.type?0:e.type==`remove`?-1:1:e.offset<t.offset?-1:1),r=this._elementChildrenSnapshots.get(e),i=yf(e.getChildren()),a=bf(r.length,n),o=0,s=0;for(let n of a)if(n===`i`){let n=this._getDiffActionForNode(i[o].node,`insert`),r=this._elementsSnapshots.get(i[o].node),a=this._getInsertDiff(e,o,n,i[o],r);t.push(a),o++}else if(n===`r`){let n=this._getDiffActionForNode(r[s].node,`remove`),i=this._getRemoveDiff(e,o,n,r[s]);t.push(i),s++}else if(n===`a`){let n=r[s].attributes,a=i[o].attributes,c;if(i[o].name==`$text`)c=new B(z._createAt(e,o),z._createAt(e,o+1));else{let t=e.offsetToIndex(o);c=new B(z._createAt(e,o),z._createAt(e.getChild(t),0))}let l=this._getAttributesDiff(c,n,a);t.push(...l),o++,s++}else o++,s++}t.sort((e,t)=>e.position.root==t.position.root?e.position.isEqual(t.position)?e.changeCount-t.changeCount:e.position.isBefore(t.position)?-1:1:e.position.root.rootName<t.position.root.rootName?-1:1);for(let e=1,n=0;e<t.length;e++){let r=t[n],i=t[e],a=r.type==`remove`&&i.type==`remove`&&r.name==`$text`&&i.name==`$text`&&r.position.isEqual(i.position),o=r.type==`insert`&&i.type==`insert`&&r.name==`$text`&&i.name==`$text`&&r.position.parent==i.position.parent&&r.position.offset+r.length==i.position.offset,s=r.type==`attribute`&&i.type==`attribute`&&r.position.parent==i.position.parent&&r.range.isFlat&&i.range.isFlat&&r.position.offset+r.length==i.position.offset&&r.attributeKey==i.attributeKey&&r.attributeOldValue==i.attributeOldValue&&r.attributeNewValue==i.attributeNewValue;a||o||s?(r.length++,s&&(r.range.end=r.range.end.getShiftedBy(1)),t[e]=null):n=e}t=t.filter(e=>e);for(let e of t)delete e.changeCount,e.type==`attribute`&&(delete e.position,delete e.length);return this._changeCount=0,this._cachedChangesWithGraveyard=t,this._cachedChanges=t.filter(xf),e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice()}getChangedRoots(){return Array.from(this._changedRoots.values()).map(e=>{let t={...e};return t.state!==void 0&&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`);let t=B._createOn(e);for(let e of this._markerCollection.getMarkersIntersectingRange(t)){let t=e.getData();this.bufferMarkerChange(e.name,t,t)}this._cachedChanges=null}_bufferRootLoad(e){if(e.isAttached()){this._bufferRootStateChange(e.rootName,!0),this._markInsert(e,0,e.maxOffset);for(let t of e.getAttributeKeys())this._bufferRootAttributeChange(e.rootName,t,null,e.getAttribute(t));for(let t of this._markerCollection)if(t.getRange().root==e){let e=t.getData();this.bufferMarkerChange(t.name,{...e,range:null},e)}}}_bufferRootStateChange(e,t){if(!this._changedRoots.has(e)){this._changedRoots.set(e,{name:e,state:t?`attached`:`detached`});return}let n=this._changedRoots.get(e);n.state===void 0?n.state=t?`attached`:`detached`:(delete n.state,n.attributes===void 0&&this._changedRoots.delete(e))}_bufferRootAttributeChange(e,t,n,r){let i=this._changedRoots.get(e)||{name:e},a=i.attributes||{};if(a[t]){let e=a[t];r===e.oldValue?delete a[t]:e.newValue=r}else a[t]={oldValue:n,newValue:r};Object.entries(a).length===0?(delete i.attributes,i.state===void 0&&this._changedRoots.delete(e)):(i.attributes=a,this._changedRoots.set(e,i))}_markInsert(e,t,n){if(e.root.is(`rootElement`)&&!e.root._isLoaded)return;let r={type:`insert`,offset:t,howMany:n,count:this._changeCount++};this._markChange(e,r)}_markRemove(e,t,n){if(e.root.is(`rootElement`)&&!e.root._isLoaded)return;let r={type:`remove`,offset:t,howMany:n,count:this._changeCount++};this._markChange(e,r),this._removeAllNestedChanges(e,t,n)}_markAttribute(e){if(e.root.is(`rootElement`)&&!e.root._isLoaded)return;let t={type:`attribute`,offset:e.startOffset,howMany:e.offsetSize,count:this._changeCount++};this._markChange(e.parent,t)}_markChange(e,t){this._makeSnapshots(e);let n=this._getChangesForElement(e);this._handleChange(t,n),n.push(t);for(let e=0;e<n.length;e++)n[e].howMany<1&&(n.splice(e,1),e--)}_setElementState(t,n){if(!t.is(`element`))return;let r=e._statesPriority.indexOf(this._elementState.get(t));e._statesPriority.indexOf(n)>r&&this._elementState.set(t,n)}_getDiffActionForNode(e,t){if(!e.is(`element`)||!this._elementsSnapshots.has(e))return t;let n=this._elementState.get(e);return!n||n==`move`?t:n}_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;let t=yf(e.getChildren());this._elementChildrenSnapshots.set(e,t);for(let e of t)this._elementsSnapshots.set(e.node,e)}_handleChange(e,t){e.nodesToHandle=e.howMany;for(let n of t){let r=e.offset+e.howMany,i=n.offset+n.howMany;if(e.type==`insert`&&(n.type==`insert`&&(e.offset<=n.offset?n.offset+=e.howMany:e.offset<i&&(n.howMany+=e.nodesToHandle,e.nodesToHandle=0)),n.type==`remove`&&e.offset<n.offset&&(n.offset+=e.howMany),n.type==`attribute`)){if(e.offset<=n.offset)n.offset+=e.howMany;else if(e.offset<i){let i=n.howMany;n.howMany=e.offset-n.offset,t.unshift({type:`attribute`,offset:r,howMany:i-n.howMany,count:this._changeCount++})}}if(e.type==`remove`){if(n.type==`insert`){if(r<=n.offset)n.offset-=e.howMany;else if(r<=i)if(e.offset<n.offset){let t=r-n.offset;n.offset=e.offset,n.howMany-=t,e.nodesToHandle-=t}else n.howMany-=e.nodesToHandle,e.nodesToHandle=0;else if(e.offset<=n.offset)e.nodesToHandle-=n.howMany,n.howMany=0;else if(e.offset<i){let t=i-e.offset;n.howMany-=t,e.nodesToHandle-=t}}if(n.type==`remove`&&(r<=n.offset?n.offset-=e.howMany:e.offset<n.offset&&(e.nodesToHandle+=n.howMany,n.howMany=0)),n.type==`attribute`){if(r<=n.offset)n.offset-=e.howMany;else if(e.offset<n.offset){let t=r-n.offset;n.offset=e.offset,n.howMany-=t}else if(e.offset<i)if(r<=i){let r=n.howMany;n.howMany=e.offset-n.offset;let i=r-n.howMany-e.nodesToHandle;t.unshift({type:`attribute`,offset:e.offset,howMany:i,count:this._changeCount++})}else n.howMany-=i-e.offset}}if(e.type==`attribute`){if(n.type==`insert`)if(e.offset<n.offset&&r>n.offset){if(r>i){let e={type:`attribute`,offset:i,howMany:r-i,count:this._changeCount++};this._handleChange(e,t),t.push(e)}e.nodesToHandle=n.offset-e.offset,e.howMany=e.nodesToHandle}else e.offset>=n.offset&&e.offset<i&&(r>i?(e.nodesToHandle=r-i,e.offset=i):e.nodesToHandle=0);if(n.type==`remove`&&e.offset<n.offset&&r>n.offset){let i={type:`attribute`,offset:n.offset,howMany:r-n.offset,count:this._changeCount++};this._handleChange(i,t),t.push(i),e.nodesToHandle=n.offset-e.offset,e.howMany=e.nodesToHandle}n.type==`attribute`&&(e.offset>=n.offset&&r<=i?(e.nodesToHandle=0,e.howMany=0,e.offset=0):e.offset<=n.offset&&r>=i&&(n.howMany=0))}}e.howMany=e.nodesToHandle,delete e.nodesToHandle}_getInsertDiff(e,t,n,r,i){let a={type:`insert`,position:z._createAt(e,t),name:r.name,attributes:new Map(r.attributes),length:1,changeCount:this._changeCount++,action:n};return n!=`insert`&&i&&(a.before={name:i.name,attributes:new Map(i.attributes)}),a}_getRemoveDiff(e,t,n,r){return{type:`remove`,action:n,position:z._createAt(e,t),name:r.name,attributes:new Map(r.attributes),length:1,changeCount:this._changeCount++}}_getAttributesDiff(e,t,n){let r=[];n=new Map(n);for(let[i,a]of t){let t=n.has(i)?n.get(i):null;t!==a&&r.push({type:`attribute`,position:e.start,range:e.clone(),length:1,attributeKey:i,attributeOldValue:a,attributeNewValue:t,changeCount:this._changeCount++}),n.delete(i)}for(let[t,i]of n)r.push({type:`attribute`,position:e.start,range:e.clone(),length:1,attributeKey:t,attributeOldValue:null,attributeNewValue:i,changeCount:this._changeCount++});return r}_isInInsertedElement(e){let t=e.parent;if(!t)return!1;let n=this._changesInElement.get(t),r=e.startOffset;if(n){for(let e of n)if(e.type==`insert`&&r>=e.offset&&r<e.offset+e.howMany)return!0}return this._isInInsertedElement(t)}_removeAllNestedChanges(e,t,n){let r=new B(z._createAt(e,t),z._createAt(e,t+n));for(let e of r.getItems({shallow:!0}))e.is(`element`)&&(this._changesInElement.delete(e),this._removeAllNestedChanges(e,0,e.maxOffset))}};function vf(e){return{node:e,name:e.is(`$text`)?`$text`:e.name,attributes:new Map(e.getAttributes())}}function yf(e){let t=[];for(let n of e)if(n.is(`$text`))for(let e=0;e<n.data.length;++e)t.push(vf(n));else t.push(vf(n));return t}function bf(e,t){let n=[],r=0,i=0;for(let e of t){if(e.offset>r){for(let t=0;t<e.offset-r;t++)n.push(`e`);i+=e.offset-r}if(e.type==`insert`){for(let t=0;t<e.howMany;t++)n.push(`i`);r=e.offset+e.howMany}else if(e.type==`remove`){for(let t=0;t<e.howMany;t++)n.push(`r`);r=e.offset,i+=e.howMany}else{if(e.howMany>1500)for(let t=0;t<e.howMany;t++)n.push(`a`);else n.push(...`a`.repeat(e.howMany).split(``));r=e.offset+e.howMany,i+=e.howMany}}if(i<e)for(let t=0;t<e-i-r;t++)n.push(`e`);return n}function xf(e){let t=`position`in e&&e.position.root.rootName==`$graveyard`,n=`range`in e&&e.range.root.rootName==`$graveyard`;return!t&&!n}var Sf=class{_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 w(`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[];let n=this._operations[0];e===void 0&&(e=n.baseVersion);let r=t-1;for(let[t,n]of this._gaps)e>t&&e<n&&(e=n),r>t&&r<n&&(r=t-1);if(r<n.baseVersion||e>this.lastOperation.baseVersion)return[];let i=this._baseVersionToOperationIndex.get(e);i===void 0&&(i=0);let a=this._baseVersionToOperationIndex.get(r);return a===void 0&&(a=this._operations.length-1),this._operations.slice(i,a+1)}getOperation(e){let t=this._baseVersionToOperationIndex.get(e);if(t!==void 0)return this._operations[t]}setOperationAsUndone(e,t){this._undoPairs.set(t,e),this._undoneOperations.add(e)}isUndoingOperation(e){return this._undoPairs.has(e)}isUndoneOperation(e){return this._undoneOperations.has(e)}getUndoneOperation(e){return this._undoPairs.get(e)}reset(){this._version=0,this._undoPairs=new Map,this._operations=[],this._undoneOperations=new Set,this._gaps=new Map,this._baseVersionToOperationIndex=new Map}},Cf=class extends Ml{rootName;_document;_isAttached=!0;_isLoaded=!0;constructor(e,t,n=`main`){super(t),this._document=e,this.rootName=n}get document(){return this._document}isAttached(){return this._isAttached}toJSON(){return this.rootName}};Cf.prototype.is=function(e,t){return t?t===this.name&&(e===`rootElement`||e===`model:rootElement`||e===`element`||e===`model:element`):e===`rootElement`||e===`model:rootElement`||e===`element`||e===`model:element`||e===`node`||e===`model:node`};const wf=`$graveyard`,Tf=E();var Ef=class extends Tf{model;history;selection;roots;differ;isReadOnly;_postFixers;_hasSelectionChangedFromTheLastChangeBlock;constructor(e){super(),this.model=e,this.history=new Sf,this.selection=new Tl(this),this.roots=new Fi({idProperty:`rootName`}),this.differ=new _f(e.markers),this.isReadOnly=!1,this._postFixers=new Set,this._hasSelectionChangedFromTheLastChangeBlock=!1,this.createRoot(`$root`,wf),this.listenTo(e,`applyOperation`,(e,t)=>{let n=t[0];n.isDocumentOperation&&this.differ.bufferOperation(n)},{priority:`high`}),this.listenTo(e,`applyOperation`,(e,t)=>{let n=t[0];n.isDocumentOperation&&this.history.addOperation(n)},{priority:`low`}),this.listenTo(this.selection,`change`,()=>{this._hasSelectionChangedFromTheLastChangeBlock=!0}),this.listenTo(e.markers,`update`,(e,t,n,r,i)=>{let a={...t.getData(),range:r};this.differ.bufferMarkerChange(t.name,i,a),n===null&&t.on(`change`,(e,n)=>{let r=t.getData();this.differ.bufferMarkerChange(t.name,{...r,range:n},r)})}),this.registerPostFixer(e=>{let t=!1;for(let n of this.roots)!n.isAttached()&&!n.isEmpty&&(e.remove(e.createRangeIn(n)),t=!0);for(let n of this.model.markers)n.getRange().root.isAttached()||(e.removeMarker(n),t=!0);return t})}get version(){return this.history.version}set version(e){this.history.version=e}get graveyard(){return this.getRoot(wf)}createRoot(e=`$root`,t=`main`){if(this.roots.get(t))throw new w(`model-document-createroot-name-exists`,this,{name:t});let n=new Cf(this,e,t);return this.roots.add(n),n}destroy(){this.selection.destroy(),this.stopListening()}getRoot(e=`main`){return this.roots.get(e)}getRootNames(e=!1){return this.getRoots(e).map(e=>e.rootName)}getRoots(e=!1){return this.roots.filter(t=>t!=this.graveyard&&(e||t.isAttached())&&t._isLoaded)}registerPostFixer(e){this._postFixers.add(e)}toJSON(){let e=see(this);return e.selection=`[engine.model.DocumentSelection]`,e.model=`[engine.model.Model]`,e}_handleChangeBlock(e){this._hasDocumentChangedFromTheLastChangeBlock()&&(this._callPostFixers(e),this.selection.refresh(),this.differ.hasDataChanges()?this.fire(`change:data`,e.batch):this.fire(`change`,e.batch),this.selection.refresh(),this.differ.reset()),this._hasSelectionChangedFromTheLastChangeBlock=!1}_hasDocumentChangedFromTheLastChangeBlock(){return!this.differ.isEmpty||this._hasSelectionChangedFromTheLastChangeBlock}_getDefaultRoot(){let e=this.getRoots();return e.length?e[0]:this.graveyard}_getDefaultRange(){let e=this._getDefaultRoot(),t=this.model,n=t.schema,r=t.createPositionFromPath(e,[0]);return n.getNearestSelectionRange(r)||t.createRange(r)}_validateSelectionRange(e){return e.start.isValid()&&e.end.isValid()&&Df(e.start)&&Df(e.end)}_callPostFixers(e){let t=!1;do for(let n of this._postFixers)if(this.selection.refresh(),t=n(e),t)break;while(t)}};function Df(e){let t=e.textNode;if(t){let n=t.data,r=e.offset-t.startOffset;return!ra(n,r)&&!ia(n,r)}return!0}const Of=E(),kf=E(Jc);var Af=class extends Of{_markers=new Map;[Symbol.iterator](){return this._markers.values()}has(e){let t=e instanceof jf?e.name:e;return this._markers.has(t)}get(e){return this._markers.get(e)||null}_set(e,t,n=!1,r=!1){let i=e instanceof jf?e.name:e;if(i.includes(`,`))throw new w(`markercollection-incorrect-marker-name`,this);let a=this._markers.get(i);if(a){let e=a.getData(),o=a.getRange(),s=!1;return o.isEqual(t)||(a._attachLiveRange(xl.fromRange(t)),s=!0),n!=a.managedUsingOperations&&(a._managedUsingOperations=n,s=!0),typeof r==`boolean`&&r!=a.affectsData&&(a._affectsData=r,s=!0),s&&this.fire(`update:${i}`,a,o,t,e),a}let o=new jf(i,xl.fromRange(t),n,r);return this._markers.set(i,o),this.fire(`update:${i}`,o,null,t,{...o.getData(),range:null}),o}_remove(e){let t=e instanceof jf?e.name:e,n=this._markers.get(t);return n?(this._markers.delete(t),this.fire(`update:${t}`,n,n.getRange(),null,n.getData()),this._destroyMarker(n),!0):!1}_refresh(e){let t=e instanceof jf?e.name:e,n=this._markers.get(t);if(!n)throw new w(`markercollection-refresh-marker-not-exists`,this);let r=n.getRange();this.fire(`update:${t}`,n,r,r,n.getData())}*getMarkersAtPosition(e){for(let t of this)t.getRange().containsPosition(e)&&(yield t)}*getMarkersIntersectingRange(e){for(let t of this)t.getRange().getIntersection(e)!==null&&(yield t)}destroy(){for(let e of this._markers.values())this._destroyMarker(e);this._markers=null,this.stopListening()}*getMarkersGroup(e){for(let t of this._markers.values())t.name.startsWith(e+`:`)&&(yield t)}_destroyMarker(e){e.stopListening(),e._detachLiveRange()}},jf=class extends kf{name;_managedUsingOperations;_affectsData;_liveRange;constructor(e,t,n,r){super(),this.name=e,this._liveRange=this._attachLiveRange(t),this._managedUsingOperations=n,this._affectsData=r}get managedUsingOperations(){if(!this._liveRange)throw new w(`marker-destroyed`,this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new w(`marker-destroyed`,this);return this._affectsData}getData(){return{range:this.getRange(),affectsData:this.affectsData,managedUsingOperations:this.managedUsingOperations}}getStart(){if(!this._liveRange)throw new w(`marker-destroyed`,this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new w(`marker-destroyed`,this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new w(`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}};jf.prototype.is=function(e){return e===`marker`||e===`model:marker`};var Mf=class extends jd{sourcePosition;howMany;constructor(e,t){super(null),this.sourcePosition=e.clone(),this.howMany=t}get type(){return`detach`}get affectedSelectable(){return null}toJSON(){let e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e}_validate(){if(this.sourcePosition.root.document)throw new w(`detach-operation-on-document-node`,this)}_execute(){Nd(B._createFromPositionAndShift(this.sourcePosition,this.howMany))}static get className(){return`DetachOperation`}},Nf=class e extends Jc{markers=new Map;_children=new Al;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 this.childCount===0}get nextSibling(){return null}get previousSibling(){return null}get root(){return this}get parent(){return null}get document(){return null}isAttached(){return!1}getAncestors(){return[]}getChild(e){return this._children.getNode(e)}getChildAtOffset(e){return this._children.getNodeAtOffset(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}getPath(){return[]}getNodeByPath(e){let t=this;for(let n of e)t=t.getChildAtOffset(n);return t}offsetToIndex(e){return this._children.offsetToIndex(e)}toJSON(){let e=[];for(let t of this._children)e.push(t.toJSON());return e}static fromJSON(t){let n=[];for(let e of t)e.name?n.push(Ml.fromJSON(e)):n.push(Sl.fromJSON(e));return new e(n)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){let n=Pf(t);for(let e of n)e.parent!==null&&e._remove(),e.parent=this;this._children._insertNodes(e,n)}_removeChildren(e,t=1){let n=this._children._removeNodes(e,t);for(let e of n)e.parent=null;return n}_removeChildrenArray(e){this._children._removeNodesArray(e);for(let t of e)t.parent=null}};Nf.prototype.is=function(e){return e===`documentFragment`||e===`model:documentFragment`};function Pf(e){return typeof e==`string`?[new Sl(e)]:(pr(e)||(e=[e]),Array.from(e).map(e=>typeof e==`string`?new Sl(e):e instanceof Yc?new Sl(e.data,e.getAttributes()):e))}var Ff=class{model;batch;constructor(e,t){this.model=e,this.batch=t}createText(e,t){return new Sl(e,t)}createElement(e,t){return new Ml(e,t)}createDocumentFragment(){return new Nf}cloneElement(e,t=!0){return e._clone(t)}insert(e,t,n=0){if(this._assertWriterUsedCorrectly(),e instanceof Sl&&e.data==``)return;let r=z._createAt(t,n);if(e.parent)if(Bf(e.root,r.root)){this.move(B._createOn(e),r);return}else if(e.root.document)throw new w(`model-writer-insert-forbidden-move`,this);else this.remove(e);let i=r.root.document?r.root.document.version:null,a=new Vd(r,e instanceof Nf?e._removeChildren(0,e.childCount):e,i);if(e instanceof Sl&&(a.shouldReceiveAttributes=!0),this.batch.addOperation(a),this.model.applyOperation(a),e instanceof Nf)for(let[t,n]of e.markers){let e=z._createAt(n.root,0),i={range:new B(n.start._getCombined(e,r),n.end._getCombined(e,r)),usingOperation:!0,affectsData:!0};this.model.markers.has(t)?this.updateMarker(t,i):this.addMarker(t,i)}}insertText(e,t,n,r){t instanceof Nf||t instanceof Ml||t instanceof z?this.insert(this.createText(e),t,n):this.insert(this.createText(e,t),n,r)}insertElement(e,t,n,r){t instanceof Nf||t instanceof Ml||t instanceof z?this.insert(this.createElement(e),t,n):this.insert(this.createElement(e,t),n,r)}append(e,t){this.insert(e,t,`end`)}appendText(e,t,n){t instanceof Nf||t instanceof Ml?this.insert(this.createText(e),t,`end`):this.insert(this.createText(e,t),n,`end`)}appendElement(e,t,n){t instanceof Nf||t instanceof Ml?this.insert(this.createElement(e),t,`end`):this.insert(this.createElement(e,t),n,`end`)}setAttribute(e,t,n){if(this._assertWriterUsedCorrectly(),n instanceof B){let r=n.getMinimalFlatRanges();for(let n of r)If(this,e,t,n)}else Lf(this,e,t,n)}setAttributes(e,t){for(let[n,r]of Ui(e))this.setAttribute(n,r,t)}removeAttribute(e,t){if(this._assertWriterUsedCorrectly(),t instanceof B){let n=t.getMinimalFlatRanges();for(let t of n)If(this,e,null,t)}else Lf(this,e,null,t)}clearAttributes(e){this._assertWriterUsedCorrectly();let t=e=>{for(let t of e.getAttributeKeys())this.removeAttribute(t,e)};if(!(e instanceof B))t(e);else for(let n of e.getItems())t(n)}move(e,t,n){if(this._assertWriterUsedCorrectly(),!(e instanceof B))throw new w(`writer-move-invalid-range`,this);if(!e.isFlat)throw new w(`writer-move-range-not-flat`,this);let r=z._createAt(t,n);if(r.isEqual(e.start))return;if(this._addOperationForAffectedMarkers(`move`,e),!Bf(e.root,r.root))throw new w(`writer-move-different-document`,this);let i=e.root.document?e.root.document.version:null,a=new Bd(e.start,e.end.offset-e.start.offset,r,i);this.batch.addOperation(a),this.model.applyOperation(a)}remove(e){this._assertWriterUsedCorrectly();let t=(e instanceof B?e:B._createOn(e)).getMinimalFlatRanges().reverse();for(let e of t)this._addOperationForAffectedMarkers(`move`,e),zf(e.start,e.end.offset-e.start.offset,this.batch,this.model)}merge(e){this._assertWriterUsedCorrectly();let t=e.nodeBefore,n=e.nodeAfter;if(this._addOperationForAffectedMarkers(`merge`,e),!(t instanceof Ml))throw new w(`writer-merge-no-element-before`,this);if(!(n instanceof Ml))throw new w(`writer-merge-no-element-after`,this);e.root.document?this._merge(e):this._mergeDetached(e)}createPositionFromPath(e,t,n){return this.model.createPositionFromPath(e,t,n)}createPositionAt(e,t){return this.model.createPositionAt(e,t)}createPositionAfter(e){return this.model.createPositionAfter(e)}createPositionBefore(e){return this.model.createPositionBefore(e)}createRange(e,t){return this.model.createRange(e,t)}createRangeIn(e){return this.model.createRangeIn(e)}createRangeOn(e){return this.model.createRangeOn(e)}createSelection(...e){return this.model.createSelection(...e)}_mergeDetached(e){let t=e.nodeBefore,n=e.nodeAfter;this.move(B._createIn(n),z._createAt(t,`end`)),this.remove(n)}_merge(e){let t=z._createAt(e.nodeBefore,`end`),n=z._createAt(e.nodeAfter,0),r=e.root.document.graveyard,i=new z(r,[0]),a=e.root.document.version,o=new Ud(n,e.nodeAfter.maxOffset,t,i,a);this.batch.addOperation(o),this.model.applyOperation(o)}rename(e,t){if(this._assertWriterUsedCorrectly(),!(e instanceof Ml))throw new w(`writer-rename-not-element-instance`,this);let n=e.root.document?e.root.document.version:null,r=new qd(z._createBefore(e),e.name,t,n);this.batch.addOperation(r),this.model.applyOperation(r)}split(e,t){this._assertWriterUsedCorrectly();let n=e.parent;if(!n.parent)throw new w(`writer-split-element-no-parent`,this);if(t||=n.parent,!e.parent.getAncestors({includeSelf:!0}).includes(t))throw new w(`writer-split-invalid-limit-element`,this);let r,i;do{let t=n.root.document?n.root.document.version:null,a=n.maxOffset-e.offset,o=Hd.getInsertionPosition(e),s=new Hd(e,a,o,null,t);this.batch.addOperation(s),this.model.applyOperation(s),!r&&!i&&(r=n,i=e.parent.nextSibling),e=this.createPositionAfter(e.parent),n=e.parent}while(n!==t);return{position:e,range:new B(z._createAt(r,`end`),z._createAt(i,0))}}wrap(e,t){if(this._assertWriterUsedCorrectly(),!e.isFlat)throw new w(`writer-wrap-range-not-flat`,this);let n=t instanceof Ml?t:new Ml(t);if(n.childCount>0)throw new w(`writer-wrap-element-not-empty`,this);if(n.parent!==null)throw new w(`writer-wrap-element-attached`,this);this.insert(n,e.start);let r=new B(e.start.getShiftedBy(1),e.end.getShiftedBy(1));this.move(r,z._createAt(n,0))}unwrap(e){if(this._assertWriterUsedCorrectly(),e.parent===null)throw new w(`writer-unwrap-element-no-parent`,this);this.move(B._createIn(e),this.createPositionAfter(e)),this.remove(e)}addMarker(e,t){if(this._assertWriterUsedCorrectly(),!t||typeof t.usingOperation!=`boolean`)throw new w(`writer-addmarker-no-usingoperation`,this);let n=t.usingOperation,r=t.range,i=t.affectsData===void 0?!1:t.affectsData;if(this.model.markers.has(e))throw new w(`writer-addmarker-marker-exists`,this);if(!r)throw new w(`writer-addmarker-no-range`,this);return n?(Rf(this,e,null,r,i),this.model.markers.get(e)):this.model.markers._set(e,r,n,i)}updateMarker(e,t){this._assertWriterUsedCorrectly();let n=typeof e==`string`?e:e.name,r=this.model.markers.get(n);if(!r)throw new w(`writer-updatemarker-marker-not-exists`,this);if(!t){T(`writer-updatemarker-reconvert-using-editingcontroller`,{markerName:n}),this.model.markers._refresh(r);return}let i=typeof t.usingOperation==`boolean`,a=typeof t.affectsData==`boolean`,o=a?t.affectsData:r.affectsData;if(!i&&!t.range&&!a)throw new w(`writer-updatemarker-wrong-options`,this);let s=r.getRange(),c=t.range?t.range:s;if(i&&t.usingOperation!==r.managedUsingOperations){t.usingOperation?Rf(this,n,null,c,o):(Rf(this,n,s,null,o),this.model.markers._set(n,c,void 0,o));return}r.managedUsingOperations?Rf(this,n,s,c,o):this.model.markers._set(n,c,void 0,o)}removeMarker(e){this._assertWriterUsedCorrectly();let t=typeof e==`string`?e:e.name;if(!this.model.markers.has(t))throw new w(`writer-removemarker-no-marker`,this);let n=this.model.markers.get(t);if(!n.managedUsingOperations){this.model.markers._remove(t);return}let r=n.getRange();Rf(this,t,r,null,n.affectsData)}addRoot(e,t=`$root`){this._assertWriterUsedCorrectly();let n=this.model.document.getRoot(e);if(n&&n.isAttached())throw new w(`writer-addroot-root-exists`,this);let r=this.model.document,i=new Yd(e,t,!0,r,r.version);return this.batch.addOperation(i),this.model.applyOperation(i),this.model.document.getRoot(e)}detachRoot(e){this._assertWriterUsedCorrectly();let t=typeof e==`string`?this.model.document.getRoot(e):e;if(!t||!t.isAttached())throw new w(`writer-detachroot-no-root`,this);for(let e of this.model.markers)e.getRange().root===t&&this.removeMarker(e);for(let e of t.getAttributeKeys())this.removeAttribute(e,t);this.remove(this.createRangeIn(t));let n=this.model.document,r=new Yd(t.rootName,t.name,!1,n,n.version);this.batch.addOperation(r),this.model.applyOperation(r)}setSelection(...e){this._assertWriterUsedCorrectly(),this.model.document.selection._setTo(...e)}setSelectionFocus(e,t){this._assertWriterUsedCorrectly(),this.model.document.selection._setFocus(e,t)}setSelectionAttribute(e,t){if(this._assertWriterUsedCorrectly(),typeof e==`string`)this._setSelectionAttribute(e,t);else for(let[t,n]of Ui(e))this._setSelectionAttribute(t,n)}removeSelectionAttribute(e){if(this._assertWriterUsedCorrectly(),typeof e==`string`)this._removeSelectionAttribute(e);else for(let t of e)this._removeSelectionAttribute(t)}overrideSelectionGravity(){return this.model.document.selection._overrideGravity()}restoreSelectionGravity(e){this.model.document.selection._restoreGravity(e)}_setSelectionAttribute(e,t){let n=this.model.document.selection;if(n.isCollapsed&&n.anchor.parent.isEmpty){let r=Tl._getStoreAttributeKey(e);this.setAttribute(r,t,n.anchor.parent)}n._setAttribute(e,t)}_removeSelectionAttribute(e){let t=this.model.document.selection;if(t.isCollapsed&&t.anchor.parent.isEmpty){let n=Tl._getStoreAttributeKey(e);this.removeAttribute(n,t.anchor.parent)}t._removeAttribute(e)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new w(`writer-incorrect-use`,this)}_addOperationForAffectedMarkers(e,t){for(let n of this.model.markers){if(!n.managedUsingOperations)continue;let r=n.getRange(),i=!1;if(e===`move`){let e=t;i=e.containsPosition(r.start)||e.start.isEqual(r.start)||e.containsPosition(r.end)||e.end.isEqual(r.end)}else{let e=t,n=e.nodeBefore,a=e.nodeAfter,o=r.start.parent==n&&r.start.isAtEnd,s=r.end.parent==a&&r.end.offset==0,c=r.end.nodeAfter==a,l=r.start.nodeAfter==a;i=o||s||c||l}i&&this.updateMarker(n.name,{range:r})}}};function If(e,t,n,r){let i=e.model,a=i.document,o=r.start,s,c,l;for(let e of r.getWalker({shallow:!0}))l=e.item.getAttribute(t),s&&c!=l&&(c!=n&&u(),o=s),s=e.nextPosition,c=l;s instanceof z&&s!=o&&c!=n&&u();function u(){let r=new B(o,s),l=r.root.document?a.version:null,u=new Gd(r,t,c,n,l);e.batch.addOperation(u),i.applyOperation(u)}}function Lf(e,t,n,r){let i=e.model,a=i.document,o=r.getAttribute(t),s,c;if(o!=n){if(r.root===r)c=new Jd(r,t,o,n,r.document?a.version:null);else{s=new B(z._createBefore(r),e.createPositionAfter(r));let i=s.root.document?a.version:null;c=new Gd(s,t,o,n,i)}e.batch.addOperation(c),i.applyOperation(c)}}function Rf(e,t,n,r,i){let a=e.model,o=a.document,s=new Wd(t,n,r,a.markers,!!i,o.version);e.batch.addOperation(s),a.applyOperation(s)}function zf(e,t,n,r){let i;if(e.root.document){let n=r.document;i=new Bd(e,t,new z(n.graveyard,[0]),n.version)}else i=new Mf(e,t);n.addOperation(i),r.applyOperation(i)}function Bf(e,t){return e===t||e instanceof Cf&&t instanceof Cf}function Vf(e){e.document.registerPostFixer(t=>Hf(t,e))}function Hf(e,t){let n=t.document.selection,r=t.schema,i=[],a=!1;for(let e of n.getRanges()){let t=Uf(e,r);t&&!t.isEqual(e)?(i.push(t),a=!0):i.push(e)}return a&&e.setSelection(Jf(i),{backward:n.isBackward}),!1}function Uf(e,t){return e.isCollapsed?Wf(e,t):Gf(e,t)}function Wf(e,t){let n=e.start,r=t.getNearestSelectionRange(n);if(!r){let e=n.getAncestors().reverse().find(e=>t.isObject(e));return e?B._createOn(e):null}if(!r.isCollapsed)return r;let i=r.start;return n.isEqual(i)?null:new B(i)}function Gf(e,t){let{start:n,end:r}=e,i=t.checkChild(n,`$text`),a=t.checkChild(r,`$text`),o=t.getLimitElement(n),s=t.getLimitElement(r);if(o===s){if(i&&a)return null;if(qf(n,r,t)){let e=n.nodeAfter&&t.isSelectable(n.nodeAfter)?null:t.getNearestSelectionRange(n,`forward`),i=r.nodeBefore&&t.isSelectable(r.nodeBefore)?null:t.getNearestSelectionRange(r,`backward`);return new B(e?e.start:n,i?i.end:r)}}let c=o&&!o.is(`rootElement`),l=s&&!s.is(`rootElement`);if(c||l){let e=n.nodeAfter&&r.nodeBefore&&n.nodeAfter.parent===r.nodeBefore.parent,i=c&&(!e||!Yf(n.nodeAfter,t)),a=l&&(!e||!Yf(r.nodeBefore,t)),u=n,d=r;return i&&(u=z._createBefore(Kf(o,t))),a&&(d=z._createAfter(Kf(s,t))),new B(u,d)}return null}function Kf(e,t){let n=e,r=n;for(;t.isLimit(r)&&r.parent;)n=r,r=r.parent;return n}function qf(e,t,n){let r=e.nodeAfter&&!n.isLimit(e.nodeAfter)||n.checkChild(e,`$text`),i=t.nodeBefore&&!n.isLimit(t.nodeBefore)||n.checkChild(t,`$text`);return r||i}function Jf(e){let t=[...e],n=new Set,r=1;for(;r<t.length;){let e=t[r],i=t.slice(0,r);for(let[a,o]of i.entries())if(!n.has(a)){if(e.isEqual(o))n.add(a);else if(e.isIntersecting(o)){n.add(a),n.add(r);let i=e.getJoined(o);t.push(i)}}r++}return t.filter((e,t)=>!n.has(t))}function Yf(e,t){return e&&t.isSelectable(e)}function Xf(e,t,n={}){if(t.isCollapsed)return;let r=t.getFirstRange();if(r.root.rootName==`$graveyard`)return;let i=e.schema,a=e.document.selection,o=fp(t,a,r),s=Array.from(a.getAttributes()),c=!!a.getFirstRange()?.start.parent.isEmpty;e.change(e=>{if(!n.doNotResetEntireContent&&lp(i,t)){cp(e,t);return}let a={};if(!n.doNotAutoparagraph){let e=t.getSelectedElement();e&&Object.assign(a,i.getAttributesWithProperty(e,`copyOnReplace`,!0))}let l,u;n.doNotFixSelection?(l=pf.fromPosition(r.start,`toPrevious`),u=pf.fromPosition(r.end,`toNext`)):[l,u]=Zf(r),l.isTouching(u)||e.remove(e.createRange(l,u)),n.leaveUnmerged||($f(e,l,u),i.removeDisallowedAttributes(l.parent.getChildren(),e)),up(e,t,l),!n.doNotAutoparagraph&&ap(i,l)&&sp(e,l,t,a),o&&dp(e,s,c),l.detach(),u.detach()})}function Zf(e){let t=e.root.document.model,n=e.start,r=e.end;if(t.hasContent(e,{ignoreMarkers:!0})){let n=Qf(r);if(n&&r.isTouching(t.createPositionAt(n,0))){let n=t.createSelection(e);t.modifySelection(n,{direction:`backward`});let i=n.getLastPosition(),a=t.createRange(i,r);t.hasContent(a,{ignoreMarkers:!0})||(r=i)}}return[pf.fromPosition(n,`toPrevious`),pf.fromPosition(r,`toNext`)]}function Qf(e){let t=e.parent,n=t.root.document.model.schema,r=t.getAncestors({parentFirst:!0,includeSelf:!0});for(let e of r){if(n.isLimit(e))return null;if(n.isBlock(e))return e}}function $f(e,t,n){let r=e.model;if(!rp(e.model.schema,t,n))return;let[i,a]=ip(t,n);!i||!a||(!r.hasContent(i,{ignoreMarkers:!0})&&r.hasContent(a,{ignoreMarkers:!0})?tp(e,t,n,i.parent):ep(e,t,n,i.parent))}function ep(e,t,n,r){let i=t.parent,a=n.parent;if(!(i==r||a==r)){for(t=e.createPositionAfter(i),n=e.createPositionBefore(a),n.isEqual(t)||e.insert(a,t),e.merge(t);n.parent.isEmpty;){let t=n.parent;n=e.createPositionBefore(t),e.remove(t)}rp(e.model.schema,t,n)&&ep(e,t,n,r)}}function tp(e,t,n,r){let i=t.parent,a=n.parent;if(!(i==r||a==r)){for(t=e.createPositionAfter(i),n=e.createPositionBefore(a),n.isEqual(t)||e.insert(i,n);t.parent.isEmpty;){let n=t.parent;t=e.createPositionBefore(n),e.remove(n)}n=e.createPositionBefore(a),np(e,n),rp(e.model.schema,t,n)&&tp(e,t,n,r)}}function np(e,t){let n=t.nodeBefore,r=t.nodeAfter;n.name!=r.name&&e.rename(n,r.name),e.clearAttributes(n),e.setAttributes(Object.fromEntries(r.getAttributes()),n),e.merge(t)}function rp(e,t,n){let r=t.parent,i=n.parent;return r==i||e.isLimit(r)||e.isLimit(i)?!1:op(t,n,e)}function ip(e,t){let n=e.getAncestors(),r=t.getAncestors(),i=0;for(;n[i]&&n[i]==r[i];)i++;return[n[i],r[i]]}function ap(e,t){let n=e.checkChild(t,`$text`),r=e.checkChild(t,`paragraph`);return!n&&r}function op(e,t,n){let r=new B(e,t);for(let e of r.getWalker())if(n.isLimit(e.item))return!1;return!0}function sp(e,t,n,r={}){let i=e.createElement(`paragraph`);e.model.schema.setAllowedAttributes(i,r,e),e.insert(i,t),up(e,n,e.createPositionAt(i,0))}function cp(e,t){let n=e.model.schema.getLimitElement(t);e.remove(e.createRangeIn(n)),sp(e,e.createPositionAt(n,0),t)}function lp(e,t){let n=e.getLimitElement(t);if(!t.containsEntireContent(n))return!1;let r=t.getFirstRange();return r.start.parent==r.end.parent?!1:e.checkChild(n,`paragraph`)}function up(e,t,n){t instanceof Tl?e.setSelection(n):t.setTo(n)}function dp(e,t,n){if(!t.length)return;let r=e.model.document.selection;if(r.anchor.parent.isEmpty&&!n)for(let[n,i]of t)e.model.schema.getAttributeProperties(n).isFormatting&&e.model.schema.checkAttributeInSelection(r,n)&&e.setSelectionAttribute(n,i)}function fp(e,t,n){if(e instanceof Tl)return!0;if(t.isCollapsed){let e=t.getFirstPosition();return e.isEqual(n.start)||e.isEqual(n.end)}return!!t.getFirstRange()?.isIntersecting(n)}function pp(e,t){return e.change(e=>{let n=e.createDocumentFragment(),r=t.getFirstRange();if(!r||r.isCollapsed)return n;let i=r.start.root,a=r.start.getCommonPath(r.end),o=i.getNodeByPath(a),s;s=r.start.parent==r.end.parent?r:e.createRange(e.createPositionAt(o,r.start.path[a.length]),e.createPositionAt(o,r.end.path[a.length]+1));let c=s.end.offset-s.start.offset;for(let t of s.getItems({shallow:!0}))t.is(`$textProxy`)?e.appendText(t.data,t.getAttributes(),n):e.append(e.cloneElement(t,!0),n);if(s!=r){let t=r._getTransformedByMove(s.start,e.createPositionAt(n,0),c)[0],i=e.createRange(e.createPositionAt(n,0),t.start);mp(e.createRange(t.end,e.createPositionAt(n,`end`)),e),mp(i,e)}return n})}function mp(e,t){let n=[];Array.from(e.getItems({direction:`backward`})).map(e=>t.createRangeOn(e)).filter(t=>(t.start.isAfter(e.start)||t.start.isEqual(e.start))&&(t.end.isBefore(e.end)||t.end.isEqual(e.end))).forEach(e=>{n.push(e.start.parent),t.remove(e)}),n.forEach(e=>{let n=e;for(;n.parent&&n.isEmpty;){let e=t.createRangeOn(n);n=n.parent,t.remove(e)}})}function hp(e,t,n){return e.change(r=>{let i=n||e.document.selection;i.isCollapsed||e.deleteContent(i,{doNotAutoparagraph:!0});let a=new gp(e,r,i.anchor),o=[],s;if(t.is(`documentFragment`)){if(t.markers.size){let e=[];for(let[n,r]of t.markers){let{start:t,end:i}=r,a=t.isEqual(i);e.push({position:t,name:n,isCollapsed:a},{position:i,name:n,isCollapsed:a})}e.sort(({position:e},{position:t})=>e.isBefore(t)?1:-1);for(let{position:n,name:i,isCollapsed:a}of e){let e=null,s=null,c=n.parent===t&&n.isAtStart,l=n.parent===t&&n.isAtEnd;!c&&!l?(e=r.createElement(`$marker`),r.insert(e,n)):a&&(s=c?`start`:`end`),o.push({name:i,element:e,collapsed:s})}}s=t.getChildren()}else s=[t];a.handleNodes(s);let c=a.getSelectionRange();if(t.is(`documentFragment`)&&o.length){let e=c?xl.fromRange(c):null,t={};for(let e=o.length-1;e>=0;e--){let{name:n,element:i,collapsed:s}=o[e],c=!t[n];if(c&&(t[n]=[]),i){let e=r.createPositionAt(i,`before`);t[n].push(e),r.remove(i)}else{let e=a.getAffectedRange();if(!e){s&&t[n].push(a.position);continue}s?t[n].push(e[s]):t[n].push(c?e.start:e.end)}}for(let[e,[n,i]]of Object.entries(t))n&&i&&n.root===i.root&&n.root.document&&!r.model.markers.has(e)&&r.addMarker(e,{usingOperation:!0,affectsData:!0,range:new B(n,i)});e&&(c=e.toRange(),e.detach())}c&&(i instanceof Tl?r.setSelection(c):i.setTo(c));let l=a.getAffectedRange()||e.createRange(i.anchor);return a.destroy(),l})}var gp=class{model;writer;position;canMergeWith;schema;_documentFragment;_documentFragmentPosition;_firstNode=null;_lastNode=null;_lastAutoParagraph=null;_filterAttributesAndChildrenOf=[];_affectedStart=null;_affectedEnd=null;_nodeToSelect=null;constructor(e,t,n){this.model=e,this.writer=t,this.position=n,this.canMergeWith=new Set([this.position.parent]),this.schema=e.schema,this._documentFragment=t.createDocumentFragment(),this._documentFragmentPosition=t.createPositionAt(this._documentFragment,0)}handleNodes(e){for(let 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),this.model._config?.get(`experimentalFlags.modelInsertContentDeepSchemaVerification`)!==!1&&this._removeDisallowedChildren(this._filterAttributesAndChildrenOf),this._filterAttributesAndChildrenOf=[]}_removeDisallowedChildren(e){let t=Array.from(e);for(let e of t){if(!e.is(`element`))continue;let n=[],r=[],i=this.writer.createRangeIn(e).getWalker({ignoreElementEnd:!0});for(let{item:e}of i){let a=e.parent;this.schema.checkChild(a,e)||(e.is(`element`)&&!this.schema.isObject(e)?(r.push(e),t.push(a)):n.push(e),i.jumpTo(this.writer.createPositionAfter(e)))}for(let e of r)this.writer.unwrap(e);for(let e of n)this.writer.remove(e)}}_updateLastNodeFromAutoParagraph(e){let t=this.writer.createPositionAfter(this._lastNode),n=this.writer.createPositionAfter(e);if(n.isAfter(t)){if(this._lastNode=e,this.position.parent!=e||!this.position.isAtEnd)throw new w(`insertcontent-invalid-insertion-position`,this);this.position=n,this._setAffectedBoundaries(this.position)}}getSelectionRange(){return this._nodeToSelect?B._createOn(this._nodeToSelect):this.model.schema.getNearestSelectionRange(this.position)}getAffectedRange(){return this._affectedStart?new B(this._affectedStart,this._affectedEnd):null}destroy(){this._affectedStart&&this._affectedStart.detach(),this._affectedEnd&&this._affectedEnd.detach()}_handleNode(e){if(!this._checkAndSplitToAllowedPosition(e)){this.schema.isObject(e)||this._handleDisallowedNode(e);return}e=this._appendToFragment(e),this._firstNode||=e,this._lastNode=e}_insertPartialFragment(){if(this._documentFragment.isEmpty)return;let e=pf.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 w(`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||=pf.fromPosition(e,`toPrevious`),(!this._affectedEnd||this._affectedEnd.isBefore(e))&&(this._affectedEnd&&this._affectedEnd.detach(),this._affectedEnd=pf.fromPosition(e,`toNext`))}_mergeOnLeft(){let e=this._firstNode;if(!(e instanceof Ml)||!this._canMergeLeft(e))return;let t=pf._createBefore(e);t.stickiness=`toNext`;let n=pf.fromPosition(this.position,`toNext`);this._affectedStart.isEqual(t)&&(this._affectedStart.detach(),this._affectedStart=pf._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=pf._createAt(t.nodeBefore,`end`,`toNext`)),this.position=n.toPosition(),n.detach(),this._filterAttributesAndChildrenOf.push(this.position.parent),t.detach()}_mergeOnRight(){let e=this._lastNode;if(!(e instanceof Ml)||!this._canMergeRight(e))return;let t=pf._createAfter(e);if(t.stickiness=`toNext`,!this.position.isEqual(t))throw new w(`insertcontent-invalid-insertion-position`,this);this.position=z._createAt(t.nodeBefore,`end`);let n=pf.fromPosition(this.position,`toPrevious`);this._affectedEnd.isEqual(t)&&(this._affectedEnd.detach(),this._affectedEnd=pf._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=pf._createAt(t.nodeBefore,0,`toPrevious`)),this.position=n.toPosition(),n.detach(),this._filterAttributesAndChildrenOf.push(this.position.parent),t.detach()}_canMergeLeft(e){let t=e.previousSibling;return t instanceof Ml&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(t,e)}_canMergeRight(e){let t=e.nextSibling;return t instanceof Ml&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(e,t)}_insertAutoParagraph(){this._insertPartialFragment();let 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){let t=this._getAllowedIn(this.position.parent,e);if(!t)return!1;for(t!=this.position.parent&&this._insertPartialFragment();t!=this.position.parent;)if(this.position.isAtStart){let 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{let e=this.writer.createPositionAfter(this.position.parent);this._setAffectedBoundaries(this.position),this.writer.split(this.position),this.position=e,this.canMergeWith.add(this.position.nodeAfter)}return this.schema.checkChild(this.position.parent,e)||this._insertAutoParagraph(),!0}_getAllowedIn(e,t){let n=this.schema.createContext(e);return this.schema.checkChild(n,t)||this.schema.checkChild(n,`paragraph`)&&this.schema.checkChild(n.push(`paragraph`),t)?e:this.schema.isLimit(e)?null:this._getAllowedIn(e.parent,t)}};function _p(e,t,n,r={}){if(!e.schema.isObject(t))throw new w(`insertobject-element-not-an-object`,e,{object:t});let i=n||e.document.selection,a=i;r.findOptimalPosition&&e.schema.isBlock(t)&&(a=e.createSelection(e.schema.findOptimalInsertionRange(i,r.findOptimalPosition)));let o=j(i.getSelectedBlocks()),s={};return o&&Object.assign(s,e.schema.getAttributesWithProperty(o,`copyOnReplace`,!0)),e.change(n=>{a.isCollapsed||e.deleteContent(a,{doNotAutoparagraph:!0});let i=t,o=a.anchor.parent,c=e.schema.createContext(o);!e.schema.checkChild(c,t)&&e.schema.checkChild(c,`paragraph`)&&e.schema.checkChild(c.push(`paragraph`),t)&&(i=n.createElement(`paragraph`),n.insert(t,i)),e.schema.setAllowedAttributes(i,s,n);let l=e.insertContent(i,a);return l.isCollapsed||r.setSelection&&vp(n,t,r.setSelection,s),l})}function vp(e,t,n,r){let i=e.model;if(n==`on`){e.setSelection(t,`on`);return}if(n!=`after`)throw new w(`insertobject-invalid-place-parameter-value`,i);let a=t.nextSibling;if(i.schema.isInline(t)){e.setSelection(t,`after`);return}!(a&&i.schema.checkChild(a,`$text`))&&i.schema.checkChild(t.parent,`paragraph`)&&(a=e.createElement(`paragraph`),i.schema.setAllowedAttributes(a,r,e),i.insertContent(a,e.createPositionAfter(t))),a&&e.setSelection(a,0)}function yp(e,t,n={}){let r=e.schema,i=n.direction!=`backward`,a=n.unit?n.unit:`character`,o=!!n.treatEmojiAsSingleUnit,s=t.focus,c=new Xc({boundaries:Cp(s,i),singleCharacters:!0,direction:i?`forward`:`backward`}),l={walker:c,schema:r,isForward:i,unit:a,treatEmojiAsSingleUnit:o},u;for(;u=c.next();){if(u.done)return;let n=bp(l,u.value);if(n){t instanceof Tl?e.change(e=>{e.setSelectionFocus(n)}):t.setFocus(n);return}}}function bp(e,t){let{isForward:n,walker:r,unit:i,schema:a,treatEmojiAsSingleUnit:o}=e,{type:s,item:c,nextPosition:l}=t;if(s==`text`)return e.unit===`word`?Sp(r,n):xp(r,i,o);if(s==(n?`elementStart`:`elementEnd`)){if(a.isSelectable(c))return z._createAt(c,n?`after`:`before`);if(a.checkChild(l,`$text`))return l}else{if(a.isLimit(c)){r.skip(()=>!0);return}if(a.checkChild(l,`$text`))return l}}function xp(e,t,n){let r=e.position.textNode;if(r){let i=r.data,a=e.position.offset-r.startOffset;for(;ra(i,a)||t==`character`&&ia(i,a)||n&&oa(i,a);)e.next(),a=e.position.offset-r.startOffset}return e.position}function Sp(e,t){let n=e.position.textNode;for(n||=t?e.position.nodeAfter:e.position.nodeBefore;n&&n.is(`$text`);){let r=e.position.offset-n.startOffset;if(Tp(n,r,t))n=t?e.position.nodeAfter:e.position.nodeBefore;else if(wp(n.data,r,t))break;else e.next()}return e.position}function Cp(e,t){let n=e.root,r=z._createAt(n,t?`end`:0);return t?new B(e,r):new B(r,e)}function wp(e,t,n){let r=t+(n?0:-1);return` ,.?!:;"-()`.includes(e.charAt(r))}function Tp(e,t,n){return t===(n?e.offsetSize:0)}const Ep=D();var Dp=class extends Ep{markers;document;schema;_config;_pendingChanges;_currentWriter;constructor(e){super(),this.markers=new Af,this.document=new Ef(this),this.schema=new ed,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:!0}),this.schema.register(`$inlineRoot`,{allowContentOf:`$block`,allowAttributesOf:`$root`,isLimit:!0}),this.schema.register(`$container`,{allowIn:[`$root`,`$container`]}),this.schema.register(`$block`,{allowIn:[`$root`,`$container`],isBlock:!0}),this.schema.register(`$blockObject`,{allowWhere:`$block`,isBlock:!0,isObject:!0}),this.schema.register(`$inlineObject`,{allowWhere:`$text`,allowAttributesOf:`$text`,isInline:!0,isObject:!0}),this.schema.register(`$text`,{allowIn:`$block`,isInline:!0,isContent:!0}),this.schema.register(`$clipboardHolder`,{allowContentOf:[`$root`,`$inlineRoot`],allowChildren:`$text`,isLimit:!0}),this.schema.register(`$documentFragment`,{allowContentOf:[`$root`,`$inlineRoot`],allowChildren:`$text`,isLimit:!0}),this.schema.register(`$marker`),this.schema.addChildCheck(()=>!0,`$marker`),Vf(this),this.document.registerPostFixer(Ou),this.on(`insertContent`,(e,[t,n])=>{e.return=hp(this,t,n)}),this.on(`insertObject`,(e,[t,n,r])=>{e.return=_p(this,t,n,r)}),this.on(`canEditAt`,e=>{let t=!this.document.isReadOnly;e.return=t,t||e.stop()})}change(e){try{return this._pendingChanges.length===0?(this._pendingChanges.push({batch:new gf,callback:e}),this._runPendingChanges()[0]):e(this._currentWriter)}catch(e){w.rethrowUnexpectedError(e,this)}}enqueueChange(e,t){try{e?typeof e==`function`?(t=e,e=new gf):e instanceof gf||(e=new gf(e)):e=new gf,this._pendingChanges.push({batch:e,callback:t}),this._pendingChanges.length==1&&this._runPendingChanges()}catch(e){w.rethrowUnexpectedError(e,this)}}applyOperation(e){e._execute()}insertContent(e,t,n,...r){let i=Op(t,n);return this.fire(`insertContent`,[e,i,n,...r])}insertObject(e,t,n,r,...i){let a=Op(t,n);return this.fire(`insertObject`,[e,a,r,r,...i])}deleteContent(e,t){Xf(this,e,t)}modifySelection(e,t){yp(this,e,t)}getSelectedContent(e){return pp(this,e)}hasContent(e,t={}){let n;n=e.is(`selection`)?Array.from(e.getRanges()):e.is(`range`)?[e]:[B._createIn(e)];for(let e of n)if(this._rangeHasContent(e,t))return!0;return!1}_rangeHasContent(e,t){if(e.isCollapsed)return!1;let{ignoreWhitespaces:n=!1,ignoreMarkers:r=!1}=t;if(!r){for(let t of this.markers.getMarkersIntersectingRange(e))if(t.affectsData)return!0}for(let t of e.getItems())if(this.schema.isContent(t))if(t.is(`$textProxy`)){if(!n||t.data.search(/\S/)!==-1)return!0}else return!0;return!1}canEditAt(e){let t=Op(e);return this.fire(`canEditAt`,[t])}createPositionFromPath(e,t,n){return new z(e,t,n)}createPositionAt(e,t){return z._createAt(e,t)}createPositionAfter(e){return z._createAfter(e)}createPositionBefore(e){return z._createBefore(e)}createRange(e,t){return new B(e,t)}createRangeIn(e){return B._createIn(e)}createRangeOn(e){return B._createOn(e)}createSelection(...e){return new _l(...e)}createBatch(e){return new gf(e)}createOperationFromJSON(e){return Zd.fromJSON(e,this.document)}destroy(){this.document.destroy(),this.stopListening()}_runPendingChanges(){let e=[];this.fire(`_beforeChanges`);try{for(;this._pendingChanges.length;){let t=this._pendingChanges[0].batch;this._currentWriter=new Ff(this,t);let n=this._pendingChanges[0].callback(this._currentWriter);e.push(n),this.document._handleChangeBlock(this._currentWriter),this._pendingChanges.shift(),this._currentWriter=null}}finally{this._pendingChanges.length=0,this._currentWriter=null,this.fire(`_afterChanges`)}return e}};function Op(e,t){if(e)return e instanceof _l||e instanceof Tl?e:e instanceof gl?t||t===0?new _l(e,t):e.is(`rootElement`)?new _l(e,`in`):new _l(e,`on`):new _l(e)}var kp=class extends jc{domEventType=`click`;onDomEvent(e){this.fire(e.type,e)}},Ap=class extends jc{domEventType=[`mousedown`,`mouseup`,`mouseover`,`mouseout`];onDomEvent(e){this.fire(e.type,e)}},jp=class extends jc{domEventType=[`touchstart`,`touchend`,`touchmove`];onDomEvent(e){this.fire(e.type,e)}},Mp=class extends jc{domEventType=[`pointerdown`,`pointerup`,`pointermove`];onDomEvent(e){this.fire(e.type,e)}},Np=class{document;constructor(e){this.document=e}createDocumentFragment(e){return new Is(this.document,e)}createElement(e,t,n){return new Jo(this.document,e,t,n)}createText(e){return new Oo(this.document,e)}clone(e,t=!1){return e._clone(t)}appendChild(e,t){return t._appendChild(e)}insertChild(e,t,n){return n._insertChild(e,t)}removeChildren(e,t,n){return n._removeChildren(e,t)}remove(e){let t=e.parent;return t?this.removeChildren(t.getChildIndex(e),1,t):[]}replace(e,t){let n=e.parent;if(n){let r=n.getChildIndex(e);return this.removeChildren(r,1,n),this.insertChild(r,t,n),!0}return!1}unwrapElement(e){let t=e.parent;if(t){let n=t.getChildIndex(e);this.remove(e),this.insertChild(n,e.getChildren(),t)}}rename(e,t){let n=new Jo(this.document,e,t.getAttributes(),t.getChildren());return this.replace(t,n)?n:null}setAttribute(e,t,n){n._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,n){xn(e)&&n===void 0?t._setStyle(e):n._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,n){n._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}createPositionAt(e,t){return L._createAt(e,t)}createPositionAfter(e){return L._createAfter(e)}createPositionBefore(e){return L._createBefore(e)}createRange(e,t){return new R(e,t)}createRangeOn(e){return R._createOn(e)}createRangeIn(e){return R._createIn(e)}createSelection(...e){return new os(...e)}};const Pp=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,Fp=/^rgb\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}[0-9]{1,3}[ %]?\)$/i,Ip=/^rgba\([ ]?([0-9]{1,3}[ %]?,[ ]?){3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,Lp=/^hsl\([ ]?([0-9]{1,3}[ %]?[,]?[ ]*){3}(1|[0-9]+%|[0]?\.?[0-9]+)?\)$/i,Rp=/^hsla\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,zp=/\w+\((?:[^()]|\([^()]*\))*\)|\S+/gi,Bp=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`.split(`.`));function Vp(e){return e.startsWith(`#`)?Pp.test(e):e.startsWith(`rgb`)?Fp.test(e)||Ip.test(e):e.startsWith(`hsl`)?Lp.test(e)||Rp.test(e):Bp.has(e.toLowerCase())}const Hp=[`none`,`hidden`,`dotted`,`dashed`,`solid`,`double`,`groove`,`ridge`,`inset`,`outset`];function Up(e){return Hp.includes(e)}const Wp=/^([+-]?[0-9]*([.][0-9]+)?(px|cm|mm|in|pc|pt|ch|em|ex|rem|vh|vw|vmin|vmax)|0)$/;function Gp(e){return Wp.test(e)}const Kp=/^[+-]?[0-9]*([.][0-9]+)?%$/;function qp(e){return Kp.test(e)}const Jp=[`auto`,`cover`,`contain`];function Yp(e){return Jp.includes(e)||Gp(e)||qp(e)}const Xp=[`repeat-x`,`repeat-y`,`repeat`,`space`,`round`,`no-repeat`];function Zp(e){return Xp.includes(e)}const Qp=[`center`,`top`,`bottom`,`left`,`right`];function $p(e){return Qp.includes(e)}const em=[`fixed`,`scroll`,`local`];function tm(e){return em.includes(e)}const nm=[`border-box`,`padding-box`,`content-box`];function rm(e){return nm.includes(e)}const im=[`border-box`,`padding-box`,`content-box`,`text`];function am(e){return im.includes(e)}const om=/^url\(/;function sm(e){return om.test(e)}function cm(e=``){if(e===``)return{top:void 0,right:void 0,bottom:void 0,left:void 0};let t=fm(e),n=t[0],r=t[2]||n,i=t[1]||n;return{top:n,bottom:r,right:i,left:t[3]||i}}function lm(e){return t=>{let{top:n,right:r,bottom:i,left:a}=t,o=[];return[n,r,a,i].every(e=>!!e)?o.push([e,um(t)]):(n&&o.push([e+`-top`,n]),r&&o.push([e+`-right`,r]),i&&o.push([e+`-bottom`,i]),a&&o.push([e+`-left`,a])),o}}function um({top:e,right:t,bottom:n,left:r}){let i=[];return r===t?n===e?t===e?i.push(e):i.push(e,t):i.push(e,t,n):i.push(e,t,n,r),i.join(` `)}function dm(e){return t=>({path:e,value:cm(t)})}function fm(e){let t=e.trim().slice(0,1500).matchAll(zp);return Array.from(t).map(e=>e[0])}const pm={image:`none`,repeat:`repeat`,position:`0% 0%`,size:`auto`,origin:`padding-box`,clip:`border-box`,attachment:`scroll`},mm=[`linear-gradient`,`repeating-linear-gradient`,`radial-gradient`,`repeating-radial-gradient`,`conic-gradient`,`repeating-conic-gradient`,`url`];function hm(e){e.setNormalizer(`background-color`,_m());for(let t in pm)e.setNormalizer(`background-${t}`,vm(`background.${t}`)),e.setReducer(`background-${t}`,ym(`background-${t}`));e.setNormalizer(`background`,gm()),e.setReducer(`background`,bm()),e.setStyleRelation(`background`,[`background-color`,`background-image`,`background-repeat`,`background-position`,`background-size`,`background-attachment`,`background-origin`,`background-clip`])}function gm(){return e=>{let t=Dm(e);return t.length||t.push({...km(),color:e}),{path:`background`,value:Em(t)}}}function _m(){return e=>({path:`background.color`,value:e})}function vm(e){return t=>({path:e,value:jm(t)})}function ym(e){return t=>[[e,t.join(`, `)]]}function bm(){return e=>{let t=e;return Object.keys(pm).every(e=>{let n=t[e];return n!==void 0&&(!Array.isArray(n)||n.length>0)})?xm(t):Sm(t)}}function xm(e){let t=[],n=wm(e).map(e=>Cm(e).trim()).filter(Boolean).join(`, `);return n&&t.push([`background`,n]),t}function Sm(e){let t=[];for(let n in pm){let r=e[n];Array.isArray(r)&&t.push([`background-${n}`,r.join(`, `)])}return e.color!==void 0&&t.push([`background-color`,e.color]),t}function Cm(e){let t=[];e.image&&e.image!==pm.image&&t.push(e.image);let n=e.position.join(` `),r=!n||n===pm.position;r||t.push(n);let i=e.size.join(` `);!i||i===pm.size||(r&&t.push(`0% 0%`),t.push(`/`,i));let a=e.repeat.join(` `);a&&a!==pm.repeat&&t.push(a),e.attachment&&e.attachment!==pm.attachment&&t.push(e.attachment);let o=e.origin===pm.origin,s=e.clip===pm.clip;return(!o||!s)&&(t.push(e.origin),e.clip!==e.origin&&t.push(e.clip)),e.color&&t.push(e.color),t.join(` `)}function wm(e){let t=Tm(e),n=Array.from({length:t},(t,n)=>{let r=km();return e.image?.[n]&&(r.image=e.image[n]),e.position?.[n]&&(r.position=e.position[n].split(` `)),e.size?.[n]&&(r.size=e.size[n].split(` `)),e.repeat?.[n]&&(r.repeat=e.repeat[n].split(` `)),e.attachment?.[n]&&(r.attachment=e.attachment[n]),e.origin?.[n]&&(r.origin=e.origin[n]),e.clip?.[n]&&(r.clip=e.clip[n]),r});return e.color&&(n.at(-1).color=e.color),n}function Tm(e){let t=0;for(let n of Object.values(e))Array.isArray(n)&&n.length>t&&(t=n.length);return t}function Em(e){let t={image:[],position:[],size:[],repeat:[],attachment:[],origin:[],clip:[]};for(let n of e)t.position.push(n.position.join(` `)),t.size.push(n.size.join(` `)),t.repeat.push(n.repeat.join(` `)),t.image.push(n.image),t.attachment.push(n.attachment),t.origin.push(n.origin),t.clip.push(n.clip);return e.at(-1)?.color&&(t.color=e.at(-1).color),t}function Dm(e){return jm(e).map(Om).filter(e=>e!==null)}function Om(e){let t={},{value:n,image:r}=Am(e),i=fm(n);r&&(t.image=r);for(let e=0;e<i.length;e++){let n=i[e];if(n===`/`)for(t.size=[];e+1<i.length&&Yp(i[e+1]);)t.size.push(i[++e]);else Zp(n)?(t.repeat||=[],t.repeat.push(n)):$p(n)||qp(n)?(t.position||=[],t.position.push(n),e+1<i.length&&qp(n)&&qp(i[e+1])&&t.position.push(i[++e])):tm(n)?t.attachment=n:am(n)?(rm(n)&&!t.origin&&(t.origin=n),t.clip=n):Vp(n)&&(t.color=n)}return Mn(t)?null:{...km(),...t}}function km(){return{attachment:pm.attachment,image:pm.image,origin:pm.origin,clip:pm.clip,position:pm.position.split(` `),repeat:pm.repeat.split(` `),size:pm.size.split(` `)}}function Am(e){for(let t of mm){let n=t+`(`,r=e.indexOf(n);if(r<0)continue;let i=t,a=0;for(let n=r+t.length;n<e.length;n++){let t=e[n];if(t===`(`?a++:t===`)`&&a--,i+=t,a===0)return{value:e.slice(0,r)+e.slice(n+1),image:i}}}return e.includes(`none`)?{value:e.replace(`none`,``),image:`none`}:{value:e,image:null}}function jm(e){let t=[],n=``,r=0;for(let i of e){if(i===`(`)r++;else if(i===`)`)r--;else if(i===`,`&&r===0){t.push(n.trim()),n=``;continue}n+=i}return n.trim()&&t.push(n.trim()),t}function Mm(e){e.setNormalizer(`border`,Nm()),e.setNormalizer(`border-top`,Pm(`top`)),e.setNormalizer(`border-right`,Pm(`right`)),e.setNormalizer(`border-bottom`,Pm(`bottom`)),e.setNormalizer(`border-left`,Pm(`left`)),e.setNormalizer(`border-color`,Fm(`color`)),e.setNormalizer(`border-width`,Fm(`width`)),e.setNormalizer(`border-style`,Fm(`style`)),e.setNormalizer(`border-top-color`,Lm(`color`,`top`)),e.setNormalizer(`border-top-style`,Lm(`style`,`top`)),e.setNormalizer(`border-top-width`,Lm(`width`,`top`)),e.setNormalizer(`border-right-color`,Lm(`color`,`right`)),e.setNormalizer(`border-right-style`,Lm(`style`,`right`)),e.setNormalizer(`border-right-width`,Lm(`width`,`right`)),e.setNormalizer(`border-bottom-color`,Lm(`color`,`bottom`)),e.setNormalizer(`border-bottom-style`,Lm(`style`,`bottom`)),e.setNormalizer(`border-bottom-width`,Lm(`width`,`bottom`)),e.setNormalizer(`border-left-color`,Lm(`color`,`left`)),e.setNormalizer(`border-left-style`,Lm(`style`,`left`)),e.setNormalizer(`border-left-width`,Lm(`width`,`left`)),e.setExtractor(`border-top`,Rm(`top`)),e.setExtractor(`border-right`,Rm(`right`)),e.setExtractor(`border-bottom`,Rm(`bottom`)),e.setExtractor(`border-left`,Rm(`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`,lm(`border-color`)),e.setReducer(`border-style`,lm(`border-style`)),e.setReducer(`border-width`,lm(`border-width`)),e.setReducer(`border-top`,Hm(`top`)),e.setReducer(`border-right`,Hm(`right`)),e.setReducer(`border-bottom`,Hm(`bottom`)),e.setReducer(`border-left`,Hm(`left`)),e.setReducer(`border`,Vm()),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 Nm(){return e=>{let{color:t,style:n,width:r}=Bm(e);return{path:`border`,value:{color:cm(t),style:cm(n),width:cm(r)}}}}function Pm(e){return t=>{let{color:n,style:r,width:i}=Bm(t),a={};return n!==void 0&&(a.color={[e]:n}),r!==void 0&&(a.style={[e]:r}),i!==void 0&&(a.width={[e]:i}),{path:`border`,value:a}}}function Fm(e){return t=>({path:`border`,value:Im(t,e)})}function Im(e,t){return{[t]:cm(e)}}function Lm(e,t){return n=>({path:`border`,value:{[e]:{[t]:n}}})}function Rm(e){return(t,n)=>{if(n.border)return zm(n.border,e)}}function zm(e,t){let n={};return e.width&&e.width[t]&&(n.width=e.width[t]),e.style&&e.style[t]&&(n.style=e.style[t]),e.color&&e.color[t]&&(n.color=e.color[t]),n}function Bm(e){let t={},n=fm(e);for(let e of n)Gp(e)||/thin|medium|thick/.test(e)?t.width=e:Up(e)?t.style=e:t.color=e;return t}function Vm(){return t=>{let n=zm(t,`top`),r=zm(t,`right`),i=zm(t,`bottom`),a=zm(t,`left`),o=[n,r,i,a],s={width:e(o,`width`),style:e(o,`style`),color:e(o,`color`)},c=Um(s,`all`);return c.length?c:[...Object.entries(s).reduce((e,[t,n])=>(n&&(e.push([`border-${t}`,n]),o.forEach(e=>delete e[t])),e),[]),...Um(n,`top`),...Um(r,`right`),...Um(i,`bottom`),...Um(a,`left`)]};function e(e,t){return e.map(e=>e[t]).reduce((e,t)=>e==t?e:null)}}function Hm(e){return t=>Um(t,e)}function Um(e,t){let n=[];if(e&&e.width&&n.push(`width`),e&&e.style&&n.push(`style`),e&&e.color&&n.push(`color`),n.length==3){let r=n.map(t=>e[t]).join(` `);return[t==`all`?[`border`,r]:[`border-${t}`,r]]}return t==`all`?[]:n.map(n=>[`border-${t}-${n}`,e[n]])}function Wm(e){e.setNormalizer(`margin`,dm(`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`,lm(`margin`)),e.setStyleRelation(`margin`,[`margin-top`,`margin-right`,`margin-bottom`,`margin-left`])}function Gm(e){e.setNormalizer(`padding`,dm(`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`,lm(`padding`)),e.setStyleRelation(`padding`,[`padding-top`,`padding-right`,`padding-bottom`,`padding-left`])}const Km={container:Qo,attribute:ws,empty:Ds,ui:ks,raw:Ns},qm={setContentOf:(e,t)=>{e.innerHTML=t}},Jm=(()=>{let e=function(t,n={}){if(!(t instanceof qc))throw TypeError(`View needs to be an instance of module:engine/view/view~EditingView.`);let r=t.document,i=!!n.withoutSelection,a=n.rootName||`main`,o=r.getRoot(a),s={showType:n.showType,showPriority:n.showPriority,renderUIElements:n.renderUIElements,renderRawElements:n.renderRawElements,ignoreRoot:!0,domConverter:n.domConverter,skipListItemIds:n.skipListItemIds};return i?e._stringify(o,null,s):e._stringify(o,r.selection,s)};return e._stringify=Xm,e})(),Ym=(()=>{let e=function(t,n,r={}){if(!(t instanceof qc))throw TypeError(`View needs to be an instance of module:engine/view/view~EditingView.`);let i=t.document,a=r.rootName||`main`,o=i.getRoot(a);t.change(t=>{let r=e._parse(n,{rootElement:o});r.view&&r.selection&&t.setSelection(r.selection)})};return e._parse=Zm,e})();function Xm(e,t=null,n={}){let r;return r=t instanceof L||t instanceof R?new cs(t):t,new $m(e,r,n).stringify()}function Zm(e,t={}){let n=new Cs(new Ho);t.order=t.order||[];let r=new Qm({sameSelectionCharacters:t.sameSelectionCharacters}),i=new Ad(n,{namespaces:Object.keys(Km)});t.inlineObjectElements&&i.domConverter.inlineObjectElements.push(...t.inlineObjectElements);let a=i.toView(e);if(a=eh(a),t.rootElement){let e=t.rootElement,n=a._removeChildren(0,a.childCount);e._removeChildren(0,e.childCount),e._appendChild(n),a=e}let o=r._parseView(a,t.order);if(a.is(`documentFragment`)&&a.childCount===1&&(a=a.getChild(0)),o.length){let e=new cs(o,{backward:!!t.lastRangeBackward});return{view:a,selection:e}}return a.parent&&a._remove(),a}var Qm=class{sameSelectionCharacters;_positions;constructor(e){this.sameSelectionCharacters=!!e.sameSelectionCharacters}_parseView(e,t){this._positions=[],this._getPositions(e);let n=this._createRanges();if(t.length){if(t.length!=n.length)throw Error(`Parse error - there are ${n.length} ranges found, but ranges order array contains ${t.length} elements.`);n=this._sortRanges(n,t)}return n}_getPositions(e){if(e.is(`documentFragment`)||e.is(`element`)){let t=[...e.getChildren()];for(let e of t)this._getPositions(e)}if(e.is(`$text`)){let t=RegExp(`[{}\\]\\[]`,`g`),n=e.data,r,i=0,a=[];for(;r=t.exec(n);){let e=r.index,t=r[0];a.push({bracket:t,textOffset:e-i}),i++}n=n.replace(t,``),e._data=n;let o=e.index,s=e.parent;n||e._remove();for(let t of a)if(n)if(this.sameSelectionCharacters||!this.sameSelectionCharacters&&(t.bracket==`{`||t.bracket==`}`))this._positions.push({bracket:t.bracket,position:new L(e,t.textOffset)});else{if(!this.sameSelectionCharacters&&t.textOffset!==0&&t.textOffset!==n.length)throw Error(`Parse error - range delimiter '${t.bracket}' is placed inside text node.`);let e=t.textOffset===0?o:o+1;this._positions.push({bracket:t.bracket,position:new L(s,e)})}else{if(!this.sameSelectionCharacters&&t.bracket==`{`||t.bracket==`}`)throw Error(`Parse error - text range delimiter '${t.bracket}' is placed inside empty text node. `);this._positions.push({bracket:t.bracket,position:new L(s,o)})}}}_sortRanges(e,t){let n=[],r=0;for(let i of t){if(e[i-1]===void 0)throw Error(`Parse error - provided ranges order is invalid.`);n[i-1]=e[r],r++}return n}_createRanges(){let e=[],t=null;for(let n of this._positions){if(!t&&(n.bracket==`]`||n.bracket==`}`))throw Error(`Parse error - end of range was found '${n.bracket}' but range was not started before.`);if(t&&(n.bracket==`[`||n.bracket==`{`))throw Error(`Parse error - start of range was found '${n.bracket}' but one range is already started.`);n.bracket==`[`||n.bracket==`{`?t=new R(n.position,n.position):(t.end=n.position,e.push(t),t=null)}if(t!==null)throw Error(`Parse error - range was started but no end delimiter was found.`);return e}},$m=class{root;selection;ranges;showType;showPriority;showAttributeElementId;ignoreRoot;sameSelectionCharacters;renderUIElements;renderRawElements;domConverter;skipListItemIds;constructor(e,t,n){this.root=e,this.selection=t,this.ranges=[],t&&(this.ranges=[...t.getRanges()]),this.showType=!!n.showType,this.showPriority=!!n.showPriority,this.showAttributeElementId=!!n.showAttributeElementId,this.ignoreRoot=!!n.ignoreRoot,this.sameSelectionCharacters=!!n.sameSelectionCharacters,this.renderUIElements=!!n.renderUIElements,this.renderRawElements=!!n.renderRawElements,this.domConverter=n.domConverter||qm,this.skipListItemIds=n.skipListItemIds===void 0?!0:!!n.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){let n=this.ignoreRoot&&this.root===e;if(e.is(`element`)||e.is(`documentFragment`)){if(e.is(`element`)&&!n&&t(this._stringifyElementOpen(e)),this.renderUIElements&&e.is(`uiElement`))t(e.render(document,this.domConverter).innerHTML);else if(this.renderRawElements&&e.is(`rawElement`)){let n=document.createElement(`div`);e.render(n,this.domConverter),t(n.innerHTML)}else{let n=0;t(this._stringifyElementRanges(e,n));for(let r of e.getChildren())this._walkView(r,t),n++,t(this._stringifyElementRanges(e,n))}e.is(`element`)&&!n&&t(this._stringifyElementClose(e))}e.is(`$text`)&&t(this._stringifyTextRanges(e))}_stringifyElementRanges(e,t){let n=``,r=``,i=``;for(let a of this.ranges)a.start.parent==e&&a.start.offset===t&&(a.isCollapsed?i+=`[]`:n+=`[`),a.end.parent===e&&a.end.offset===t&&!a.isCollapsed&&(r+=`]`);return r+i+n}_stringifyTextRanges(e){let t=e.data.length,n=e.data.split(``),r,i;this.sameSelectionCharacters?(r=`[`,i=`]`):(r=`{`,i=`}`),n[t]=``;let a=n.map(e=>({letter:e,start:``,end:``,collapsed:``}));for(let n of this.ranges){let o=n.start,s=n.end;o.parent==e&&o.offset>=0&&o.offset<=t&&(n.isCollapsed?a[s.offset].collapsed+=r+i:a[o.offset].start+=r),s.parent==e&&s.offset>=0&&s.offset<=t&&!n.isCollapsed&&(a[s.offset].end+=i)}return a.map(e=>e.end+e.collapsed+e.start+e.letter).join(``)}_stringifyElementOpen(e){let t=this._stringifyElementPriority(e),n=this._stringifyElementId(e);return`<${[[this._stringifyElementType(e),e.name].filter(e=>e!==``).join(`:`),t,n,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(let t in Km)if(e instanceof Km[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){let t=[],n=[...e.getAttributeKeys()].sort();for(let r of n){let n;n=r===`class`?[...e.getClassNames()].sort().join(` `):r===`style`?[...e.getStyleNames()].sort().map(t=>`${t}:${e.getStyle(t).replace(/"/g,`&quot;`)}`).join(`;`):e.getAttribute(r),t.push(`${r}="${n}"`)}return t.join(` `)}};function eh(e){if(e.is(`element`)||e.is(`documentFragment`)){let t=e.is(`documentFragment`)?new Is(e.document):th(e.document,e);for(let n of[...e.getChildren()]){if(t.is(`emptyElement`))throw Error(`Parse error - cannot parse inside ViewEmptyElement.`);if(t.is(`uiElement`))throw Error(`Parse error - cannot parse inside UIElement.`);if(t.is(`rawElement`))throw Error(`Parse error - cannot parse inside RawElement.`);t._appendChild(eh(n))}return t}return e}function th(e,t){let n=nh(t),r=Km[n.type],i=r?new r(e,n.name):new Jo(e,n.name);i.is(`attributeElement`)&&(n.priority!==null&&(i._priority=n.priority),n.id!==null&&(i._id=n.id));for(let e of t.getAttributeKeys())i._setAttribute(e,t.getAttribute(e));return i}function nh(e){let t=e.name.split(`:`),n=ih(e.getAttribute(`view-priority`)),r=e.hasAttribute(`view-id`)?e.getAttribute(`view-id`):null;if(e._removeAttribute(`view-priority`),e._removeAttribute(`view-id`),t.length==1)return{name:t[0],type:n===null?null:`attribute`,priority:n,id:r};let i=rh(t[0]);if(i)return{name:t[1],type:i,priority:n,id:r};throw Error(`Parse error - cannot parse element's name: ${e.name}.`)}function rh(e){return e in Km?e:null}function ih(e){let t=parseInt(e,10);return isNaN(t)?null:t}const ah=(()=>{let e=function(t,n={}){if(!(t instanceof Dp))throw TypeError(`Model needs to be an instance of module:engine/model/model~Model.`);let r=n.rootName||`main`,i=t.document.getRoot(r);return e._stringify(i,n.withoutSelection?null:t.document.selection,n.convertMarkers?t.markers:null)};return e._stringify=sh,e})(),oh=(()=>{let e=function(t,n,r={}){if(!(t instanceof Dp))throw TypeError(`Model needs to be an instance of module:engine/model/model~Model.`);let i,a=null,o=t.document.getRoot(r.rootName||`main`),s=e._parse(n,t.schema,{lastRangeBackward:r.lastRangeBackward,selectionAttributes:r.selectionAttributes,context:[o.name],inlineObjectElements:r.inlineObjectElements});`model`in s?(i=s.model,a=s.selection):i=s,r.batchType===void 0?t.change(c):t.enqueueChange(r.batchType,c);function c(e){if(e.remove(e.createRangeIn(o)),e.insert(i,o),e.setSelection(null),e.removeSelectionAttribute(t.document.selection.getAttributeKeys()),a){let t=[];for(let e of a.getRanges()){let n=new z(o,e.start.path),r=new z(o,e.end.path);t.push(new B(n,r))}e.setSelection(t,{backward:a.isBackward}),r.selectionAttributes&&e.setSelectionAttribute(a.getAttributes())}}};return e._parse=ch,e})();function sh(e,t=null,n=null){let r=new Dp,i=new ol,a=null,o;if(e instanceof Cf||e instanceof Nf)o=r.createRangeIn(e);else if(e.parent)o=new B(r.createPositionBefore(e),r.createPositionAfter(e));else{let t=new Nf(e);o=r.createRangeIn(t)}t instanceof _l||t instanceof Tl?a=t:(t instanceof B||t instanceof z)&&(a=new _l(t));let s=new qc(new Ho),c=s.document,l=new ns(c,`div`);l.rootName=`main`,c.roots.add(l);let u=new fl({mapper:i,schema:r.schema});i.bindElements(e.root,l),u.on(`insert:$text`,Ll()),u.on(`insert`,Rl(),{priority:`lowest`}),u.on(`attribute`,(e,t,n)=>{(t.item instanceof _l||t.item instanceof Tl||t.item.is(`$textProxy`))&&Wl((e,{writer:n})=>n.createAttributeElement(`model-text-with-attributes`,{[t.attributeKey]:ph(e)}))(e,t,n)}),u.on(`insert`,Gl(e=>{let t=mh(e.getAttributes(),ph);return new Qo(c,e.name,t)})),u.on(`selection`,Vl()),u.on(`selection`,Hl()),u.on(`addMarker`,ql((e,{writer:t})=>{let n=e.markerName+`:`+(e.isOpening?`start`:`end`);return t.createUIElement(n)}));let d=new Map;if(n)for(let e of Array.from(n).sort((e,t)=>e.name<t.name?1:-1))d.set(e.name,e.getRange());let f=s._writer;u.convert(o,d,f),a&&u.convertSelection(a,n||r.markers,f);let p=Xm(l,c.selection,{sameSelectionCharacters:!0});return p=p.substr(5,p.length-11),s.destroy(),p.replace(RegExp(`model-text-with-attributes`,`g`),`$text`)}function ch(e,t,n={}){let r=new ol;e=e.replace(RegExp(`\\$text`,`g`),`model-text-with-attributes`);let i=Zm(e,{sameSelectionCharacters:!0,lastRangeBackward:!!n.lastRangeBackward,inlineObjectElements:n.inlineObjectElements}),a,o=null,s=null;`view`in i&&`selection`in i?(a=i.view,o=i.selection):a=i;let c=new Dp,l=new xd({schema:t});l.on(`documentFragment`,lh(r)),l.on(`element:model-text-with-attributes`,dh()),l.on(`element`,uh(r)),l.on(`text`,dh());let u=c.change(e=>l.convert(a.root,e,n.context||`$root`));if(r.bindElements(u,a.root),u.childCount==1&&(u=u.getChild(0)),o){let e=[];for(let t of o.getRanges())e.push(r.toModelRange(t));s=new _l(e,{backward:o.isBackward});for(let[e,t]of Ui(n.selectionAttributes||[]))s.setAttribute(e,t)}return s?{model:u,selection:s}:u}function lh(e){return(t,n,r)=>{let i=r.convertChildren(n.viewItem,n.modelCursor);e.bindElements(n.modelCursor.parent,n.viewItem),n=Object.assign(n,i),t.stop()}}function uh(e){return(t,n,r)=>{let i=n.viewItem.name;if(!r.schema.checkChild(n.modelCursor,i))throw Error(`Element '${i}' was not allowed in given position.`);let a=mh(n.viewItem.getAttributes(),fh),o=r.writer.createElement(n.viewItem.name,a);r.writer.insert(o,n.modelCursor),e.bindElements(o,n.viewItem),r.convertChildren(n.viewItem,o),n.modelRange=B._createOn(o),n.modelCursor=n.modelRange.end,t.stop()}}function dh(){return(e,t,n)=>{if(!n.schema.checkChild(t.modelCursor,`$text`))throw Error(`Text was not allowed in given position.`);let r;if(t.viewItem.is(`element`)){let e=mh(t.viewItem.getAttributes(),fh),i=t.viewItem.getChild(0);r=n.writer.createText(i.data,e)}else r=n.writer.createText(t.viewItem.data);n.writer.insert(r,t.modelCursor),t.modelRange=B._createFromPositionAndShift(t.modelCursor,r.offsetSize),t.modelCursor=t.modelRange.end,e.stop()}}function fh(e){try{return JSON.parse(e)}catch{return e}}function ph(e){return xn(e)?JSON.stringify(e):e}function*mh(e,t){for(let[n,r]of e)yield[n,t(r)]}function hh(e){let t=``;for(let n of e)t+=` ${n[0]}=${JSON.stringify(n[1])}`;return t}function gh(e){let t={};for(let n of e)t[n[0]]=n[1];return JSON.stringify(t)}const _h=Symbol(`_treeDump`);function vh(e,t){console.log(e,t);let n=``;for(let t of e.roots)n+=t.printTree()+`
`;e[_h][t]=n.substr(0,n.length-1);let r=e[_h].length-20;r>0&&(e[_h][r-1]=null)}function yh(e){e[_h]=[]}function bh(e,t){console.log(`--------------------`),e[_h][t]?console.log(e[_h][t]):console.log(`Tree log unavailable for given version: `+t)}var xh=class{_model;_logSeparator;_operationsToReplay;constructor(e,t,n){this._model=e,this._logSeparator=t,this.setStringifiedOperations(n)}setStringifiedOperations(e){if(e===``){this._operationsToReplay=[];return}this._operationsToReplay=e.split(this._logSeparator).map(e=>JSON.parse(e))}getOperationsToReplay(){return this._operationsToReplay}play(e=1e3){let t=this;return new Promise((n,r)=>{i();function i(){t.applyNextOperation().then(t=>{if(t)return n();setTimeout(i,e)}).catch(e=>{r(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(){let e=this._model;return new Promise(t=>{e.enqueueChange(n=>{let r=this._operationsToReplay.shift();if(!r)return t(!0);let i=Zd.fromJSON(r,e.document);n.batch.addOperation(i),e.applyOperation(i),t(!1)})})}},Sh=class{crashes=[];state=`initializing`;_crashNumberLimit;_now=Date.now;_minimumNonErrorTimePeriod;_boundErrorHandler;_listeners;constructor(e){if(this.crashes=[],this._crashNumberLimit=typeof e.crashNumberLimit==`number`?e.crashNumberLimit:3,this._minimumNonErrorTimePeriod=typeof e.minimumNonErrorTimePeriod==`number`?e.minimumNonErrorTimePeriod:5e3,this._boundErrorHandler=e=>{let t=`error`in e?e.error:e.reason;t instanceof Error&&this._handleError(t,e)},this._listeners={},!this._restart)throw 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){let n=this._listeners[e]||[];for(let e of n)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()});let n=this._shouldRestart();this.state=`crashed`,this._fire(`stateChange`),this._fire(`error`,{error:e,causesRestart:n}),n?this._restart():(this.state=`crashedPermanently`,this._fire(`stateChange`))}}_shouldReactToError(e){return e.is&&e.is(`CKEditorError`)&&e.context!==void 0&&e.context!==null&&this.state===`ready`&&this._isErrorComingFromThisItem(e)}_shouldRestart(){return this.crashes.length<=this._crashNumberLimit?!0:(this.crashes[this.crashes.length-1].date-this.crashes[this.crashes.length-1-this._crashNumberLimit].date)/this._crashNumberLimit>this._minimumNonErrorTimePeriod}};function Ch(e,t=new Set){let n=[e],r=new Set,i=0;for(;n.length>i;){let e=n[i++];if(!(r.has(e)||!wh(e)||t.has(e)))if(r.add(e),Symbol.iterator in e)try{for(let t of e)n.push(t)}catch{}else for(let t in e)t!==`defaultValue`&&n.push(e[t])}return r}function wh(e){let t=Object.prototype.toString.call(e),n=typeof e;return!(n===`number`||n===`boolean`||n===`string`||n===`symbol`||n===`function`||t===`[object Date]`||t===`[object RegExp]`||t===`[object Module]`||e==null||e._watchdogExcluded||e instanceof EventTarget||e instanceof Event)}function Th(e,t,n=new Set){if(e===t&&Eh(e))return!0;let r=Ch(e,n),i=Ch(t,n);for(let e of r)if(i.has(e))return!0;return!1}function Eh(e){return typeof e==`object`&&!!e}function Dh(e,t,n){let r=t.root,i=t.roots||Object.create(null);n&&!i[n]&&(i[n]=r||Object.create(null));let a=Oh(e),o=kh(t,a,n),s=Array.from(new Set([...a?Object.keys(e):[],...Object.keys(i),...Object.keys(o)]));for(let e of s){let n=i[e]||Object.create(null);n.initialData=``,n.placeholder??=Ah(t,`placeholder`,e),n.label??=Ah(t,`label`,e),i[e]=n}t.roots=i}function Oh(e){return!!e&&typeof e==`object`&&!Array.isArray(e)&&!jh(e)}function kh(e,t,n){return t||!n?e.initialData||Object.create(null):{[n]:e.initialData}}function Ah(e,t,n){let r=e[t];if(r)return typeof r==`string`?r:r[n]}function jh(e){return jn(e)}var Mh=class extends Sh{_editor=null;_lifecyclePromise=null;_throttledSave;_data;_lastDocumentVersion;_elementOrData;_editorAttachTo=null;_isSingleRootEditor=!0;_isUsingConfigBasedCreator=!1;_editables={};_config;_excludedProps;constructor(e,t={}){super(t),this._throttledSave=qt(this._save.bind(this),typeof t.saveInterval==`number`?t.saveInterval:5e3),e&&(this._creator=((t,n)=>n===void 0?e.create(t):e.create(t,n))),this._destructor=e=>e.destroy()}get editor(){return this._editor}get _item(){return this._editor}setCreator(e){this._creator=e}setDestructor(e){this._destructor=e}_restart(){return Promise.resolve().then(()=>(this.state=`initializing`,this._fire(`stateChange`),this._destroy())).catch(e=>{console.error(`An error happened during the editor destroying.`,e)}).then(()=>{this._isUsingConfigBasedCreator?Dh(this._isSingleRootEditor?``:{},this._config,this._isSingleRootEditor?`main`:!1):Dh(this._isSingleRootEditor?this._editorAttachTo||``:this._editables,this._config,this._isSingleRootEditor?`main`:!1);let e={...this._config,extraPlugins:this._config.extraPlugins||[],_watchdogInitialData:this._data};e.extraPlugins.push(Nh);let t={};for(let[n,r]of Object.entries(this._data.roots)){let i=e.roots[n]||Object.create(null);i.initialData=``,i.modelElement=r.modelElement,this._isUsingConfigBasedCreator&&(this._editables[n]?.isConnected?i.element=this._editables[n]:r.isLoaded&&!i.element&&Object.assign(i,Fh(r.attributes))),r.isLoaded?i.lazyLoad=!1:delete i.modelAttributes,t[n]=i}if(e.roots=t,delete e.initialData,delete e.root,this._isUsingConfigBasedCreator)return this.create(e,e.context);let n=this._isSingleRootEditor?this._editorAttachTo||``:this._editables;return this.create(n,e,e.context)}).then(()=>{this._fire(`restart`)})}create(e=this._isUsingConfigBasedCreator?this._config:this._elementOrData,t=this._isUsingConfigBasedCreator?void 0:this._config,n){let r=this._detectConfigBasedCreator(e,t),i=r?void 0:e,a=r?e:t,o=r?t:n;return this._lifecyclePromise=Promise.resolve(this._lifecyclePromise).then(()=>{if(super._startErrorHandling(),this._isUsingConfigBasedCreator=r,this._elementOrData=i,this._config=this._cloneEditorConfiguration(a||{}),this._config.context=o,r){this._editorAttachTo=null;let e=this._config.roots?Object.keys(this._config.roots).length:0,t=this._config.initialData,n=t&&typeof t==`object`;this._isSingleRootEditor=!n&&e<=1}else this._editorAttachTo=Ph(i)?i:null,this._isSingleRootEditor=Ph(i)||typeof i==`string`;return r?this._creator(this._config):this._creator(i,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();let e=this._editor;return this._editor=null,e.model.document.off(`change:data`,this._throttledSave),this._destructor(e)})}_save(){let 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(){let e=this._editor,t=e.model.document.roots.filter(e=>e.isAttached()&&e.rootName!=`$graveyard`),{plugins:n}=e,r=n.has(`CommentsRepository`)&&n.get(`CommentsRepository`),i=n.has(`TrackChanges`)&&n.get(`TrackChanges`),a={roots:{},markers:{},commentThreads:JSON.stringify([]),suggestions:JSON.stringify([])};t.forEach(e=>{a.roots[e.rootName]={content:JSON.stringify(Array.from(e.getChildren())),attributes:JSON.stringify(Array.from(e.getAttributes())),modelElement:e.name,isLoaded:e._isLoaded}});for(let t of e.model.markers)t._affectsData&&(a.markers[t.name]={rangeJSON:t.getRange().toJSON(),usingOperation:t._managedUsingOperations,affectsData:t._affectsData});return r&&(a.commentThreads=JSON.stringify(r.getCommentThreads({toJSON:!0,skipNotAttached:!0}))),i&&(a.suggestions=JSON.stringify(i.getSuggestions({toJSON:!0,skipNotAttached:!0}))),a}_getEditables(){let e={};for(let t of this.editor.model.document.getRootNames()){let n=this.editor.ui.getEditableElement(t);n&&(e[t]=n)}return e}_isErrorComingFromThisItem(e){return Th(this._editor,e.context,this._excludedProps)}_detectConfigBasedCreator(e,t){if(typeof e==`string`||Ph(e)||t&&typeof t==`object`&&!(`destroy`in t)&&Object.keys(t).length>0)return!1;if(e&&typeof e==`object`){let t=Object.values(e);if(t.length>0&&t.every(e=>typeof e==`string`||Ph(e)))return!1}return!0}_cloneEditorConfiguration(e){return Lt(e,(e,t)=>{if(Ph(e)||t===`context`)return e})}},Nh=class{editor;_data;constructor(e){this.editor=e,this._data=e.config.get(`_watchdogInitialData`)}init(){this.editor.data.on(`init`,e=>{e.stop(),this.editor.model.enqueueChange({isUndoable:!1},e=>{this._restoreCollaborationData(),this._restoreEditorData(e)}),this.editor.data.fire(`ready`)},{priority:999})}_createNode(e,t){if(`name`in t){let n=e.createElement(t.name,t.attributes);if(t.children)for(let r of t.children)n._appendChild(this._createNode(e,r));return n}else return e.createText(t.data,t.attributes)}_restoreEditorData(e){let t=this.editor;Object.entries(this._data.roots).forEach(([n,{content:r,attributes:i}])=>{let a=JSON.parse(r),o=JSON.parse(i),s=t.model.document.getRoot(n);for(let[t,n]of o)e.setAttribute(t,n,s);for(let t of a){let n=this._createNode(e,t);e.insert(n,s,`end`)}}),Object.entries(this._data.markers).forEach(([n,r])=>{let{document:i}=t.model,{rangeJSON:{start:a,end:o},...s}=r,c=i.getRoot(a.root),l=e.createPositionFromPath(c,a.path,a.stickiness),u=e.createPositionFromPath(c,o.path,o.stickiness),d=e.createRange(l,u);e.addMarker(n,{range:d,...s})})}_restoreCollaborationData(){let e=JSON.parse(this._data.commentThreads),t=JSON.parse(this._data.suggestions);if(this.editor.plugins.has(`CommentsRepository`)){let t=this.editor.plugins.get(`CommentsRepository`);for(let e of t.getCommentThreads())t._removeCommentThread({threadId:e.id});e.forEach(e=>{let t=this.editor.config.get(`collaboration.channelId`);this.editor.plugins.get(`CommentsRepository`).addCommentThread({channelId:t,...e})})}if(this.editor.plugins.has(`TrackChangesEditing`)){let e=this.editor.plugins.get(`TrackChangesEditing`);for(let t of e.getSuggestions())e._removeSuggestion(t);t.forEach(t=>{e.addSuggestionData(t)})}}};function Ph(e){return jn(e)}function Fh(e){let{$rootEditableOptions:t}=Object.fromEntries(JSON.parse(e));return!t||typeof t!=`object`?{}:{...t.placeholder&&{placeholder:t.placeholder},...t.label&&{label:t.label},...t.element&&{element:t.element}}}const Ih=Symbol(`MainQueueId`);var Lh=class extends Sh{_watchdogs=new Map;_watchdogConfig;_context=null;_contextProps=new Set;_actionQueues=new Rh;_contextConfig;_item;constructor(e,t={}){super(t),this._watchdogConfig=t,this._creator=t=>e.create(t),this._destructor=e=>e.destroy(),this._actionQueues.onEmpty(()=>{this.state===`initializing`&&(this.state=`ready`,this._fire(`stateChange`))})}setCreator(e){this._creator=e}setDestructor(e){this._destructor=e}get context(){return this._context}create(e={}){return this._actionQueues.enqueue(Ih,()=>(this._contextConfig=e,this._create()))}getItem(e){return this._getWatchdog(e)._item}getItemState(e){return this._getWatchdog(e).state}add(e){let t=zh(e);return Promise.all(t.map(e=>this._actionQueues.enqueue(e.id,()=>{if(this.state===`destroyed`)throw Error(`Cannot add items to destroyed watchdog.`);if(!this._context)throw Error("Context was not created yet. You should call the `ContextWatchdog#create()` method first.");let t;if(this._watchdogs.has(e.id))throw Error(`Item with the given id is already added: '${e.id}'.`);if(e.type===`editor`)return t=new Mh(null,this._watchdogConfig),t.setCreator(e.creator),t._setExcludedProperties(this._contextProps),e.destructor&&t.setDestructor(e.destructor),this._watchdogs.set(e.id,t),t.on(`error`,(n,{error:r,causesRestart:i})=>{this._fire(`itemError`,{itemId:e.id,error:r}),i&&this._actionQueues.enqueue(e.id,()=>new Promise(n=>{let r=()=>{t.off(`restart`,r),this._fire(`itemRestart`,{itemId:e.id}),n()};t.on(`restart`,r)}))}),e.sourceElementOrData===void 0?t.create(e.config,this._context):t.create(e.sourceElementOrData,e.config,this._context);throw Error(`Not supported item type: '${e.type}'.`)})))}remove(e){let t=zh(e);return Promise.all(t.map(e=>this._actionQueues.enqueue(e,()=>{let t=this._getWatchdog(e);return this._watchdogs.delete(e),t.destroy()})))}destroy(){return this._actionQueues.enqueue(Ih,()=>(this.state=`destroyed`,this._fire(`stateChange`),super.destroy(),this._destroy()))}_restart(){return this._actionQueues.enqueue(Ih,()=>(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=Ch(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();let 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){let t=this._watchdogs.get(e);if(!t)throw Error(`Item with the given id was not registered: ${e}.`);return t}_isErrorComingFromThisItem(e){for(let t of this._watchdogs.values())if(t._isErrorComingFromThisItem(e))return!1;return Th(this._context,e.context)}},Rh=class{_onEmptyCallbacks=[];_queues=new Map;_activeActions=0;onEmpty(e){this._onEmptyCallbacks.push(e)}enqueue(e,t){let n=e===Ih;this._activeActions++,this._queues.get(e)||this._queues.set(e,Promise.resolve());let r=(n?Promise.all(this._queues.values()):Promise.all([this._queues.get(Ih),this._queues.get(e)])).then(t),i=r.catch(()=>{});return this._queues.set(e,i),r.finally(()=>{this._activeActions--,this._queues.get(e)===i&&this._activeActions===0&&this._onEmptyCallbacks.forEach(e=>e())})}};function zh(e){return Array.isArray(e)?e:[e]}var Bh=class{editor;_entries=[];_frameStack=[];_errors=new Set;_maxEntries;_errorCallback;_filterCallback;_maxEntriesCallback;static get pluginName(){return`ActionsRecorder`}static get isOfficialPlugin(){return!0}constructor(e){this.editor=e,e.config.define(`actionsRecorder.maxEntries`,1e3);let 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){let n={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(n,this._entries))&&this._entries.push(n),this._frameStack.push(n),n}_leaveFrame(e,t,n){let r=this._frameStack.pop();!r||r!==e||(t!==void 0&&(r.result=Hh(t)),n&&(r.error=Hh(n)),r.after=this._buildStateSnapshot(),n&&this._callErrorCallback(n),this._frameStack.length==0&&this._errors.clear(),this._entries.length>=this._maxEntries&&this._maxEntriesCallback())}_buildStateSnapshot(){let{model:e,isReadOnly:t,editing:n}=this.editor;return{documentVersion:e.document.version,editorReadOnly:t,editorFocused:n.view.document.isFocused,modelSelection:Hh(e.document.selection)}}_tapCommands(){for(let[e,t]of this.editor.commands)this._tapCommand(e,t);Vh(this.editor.commands,`add`,{before:(e,[t,n])=>(this._tapCommand(t,n),!1)})}_tapOperationApply(){Vh(this.editor.model,`applyOperation`,{before:(e,[t])=>t.baseVersion===null?!1:(e.callFrame=this._enterFrame(`model.applyOperation`,[t]),!0),after:e=>{this._leaveFrame(e.callFrame)},error:(e,t)=>{this._leaveFrame(e.callFrame,void 0,t)}})}_tapModelMethods(){for(let e of[`insertContent`,`insertObject`,`deleteContent`])Vh(this.editor.model,e,{before:(t,...n)=>(t.callFrame=this._enterFrame(`model.${e}`,n),!0),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){Vh(t,`execute`,{before:(t,n)=>(t.callFrame=this._enterFrame(`commands.${e}:execute`,n),!0),after:(e,t)=>{this._leaveFrame(e.callFrame,t)},error:(e,t)=>{this._leaveFrame(e.callFrame,void 0,t)}})}_tapComponentFactory(){Vh(this.editor.ui.componentFactory,`create`,{before:(e,[t])=>(e.componentName=t,e.callFrame=this._enterFrame(`component-factory.create:${t}`),!0),after:(e,t)=>{let n={...e,eventSource:`component.${e.componentName}`};typeof t.fire==`function`&&this._tapFireMethod(t,[`execute`],n),typeof t.panelView?.fire==`function`&&this._tapFireMethod(t.panelView,[`execute`],n),typeof t.buttonView?.actionView?.fire==`function`&&this._tapFireMethod(t.buttonView.actionView,[`execute`],n),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,n={}){Vh(e,`fire`,{before:(e,[n,...r])=>{let i=typeof n==`string`?n:n.name;return t.includes(i)?(e.callFrame=this._enterFrame(`${e.eventSource}:${i}`,r),!0):!1},after:(e,t)=>{this._leaveFrame(e.callFrame,t)},error:(e,t)=>{this._leaveFrame(e.callFrame,void 0,t)}},n)}_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 Vh(e,t,n,r={}){let i=e[t];i[Symbol.for(`Tapped method`)]||(e[t]=(...t)=>{let a=Object.assign({},r),o;try{o=n.before?.(a,t);let r=i.apply(e,t);return o&&n.after?.(a,r),r}catch(e){throw o&&n.error?.(a,e),e}},e[t][Symbol.for(`Tapped method`)]=i)}function Hh(e,t=new WeakSet){if(!e||[`boolean`,`number`,`string`].includes(typeof e))return e;if(typeof e.toJSON==`function`){let n=e.toJSON();if(xn(n)||Array.isArray(n)||[`string`,`number`,`boolean`].includes(typeof n))return Hh(n,t)}if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(Wh(e)||typeof e!=`object`)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;let n={},r=[];e.domEvent&&(r.push(`domEvent`,`domTarget`,`view`,`document`),n.domEvent=Uh(e.domEvent),n.target=Hh(e.target),e.dataTransfer&&(n.dataTransfer={types:e.dataTransfer.types,htmlData:e.dataTransfer.getData(`text/html`),files:Hh(e.dataTransfer.files)}));for(let[i,a]of Object.entries(e)){if(i.startsWith(`_`)||r.includes(i)||typeof a==`function`)continue;let e=Hh(a,t);e!==void 0&&(n[i]=e)}if(Symbol.iterator in e){let r=Array.from(e[Symbol.iterator]()).map(e=>Hh(e,t));r.length&&(n._items=r)}return Object.keys(n).length?n:void 0}function Uh(e){let t={type:e.type,target:n(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 n(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}function Wh(e){return e&&typeof e.is==`function`}const Gh=`contentEditing`,Kh=`common`;var qh=class{keystrokeInfos=new Map;_editor;constructor(e){this._editor=e;let t=e.config.get(`menuBar.isVisible`),n=e.locale.t;this.addKeystrokeInfoCategory({id:Gh,label:n(`Content editing keystrokes`),description:n(`These keyboard shortcuts allow for quick access to content editing features.`)});let r=[{label:n(`Close contextual balloons, dropdowns, and dialogs`),keystroke:`Esc`},{label:n(`Open the accessibility help dialog`),keystroke:`Alt+0`},{label:n(`Move focus between form fields (inputs, buttons, etc.)`),keystroke:[[`Tab`],[`Shift+Tab`]]},{label:n(`Move focus to the toolbar, navigate between toolbars`),keystroke:`Alt+F10`,mayRequireFn:!0},{label:n(`Navigate through the toolbar or menu bar`),keystroke:[[`arrowup`],[`arrowright`],[`arrowdown`],[`arrowleft`]]},{label:n(`Execute the currently focused button. Executing buttons that interact with the editor content moves the focus back to the content.`),keystroke:[[`Enter`],[`Space`]]}];t&&r.push({label:n(`Move focus to the menu bar, navigate between menu bars`),keystroke:`Alt+F9`,mayRequireFn:!0}),this.addKeystrokeInfoCategory({id:`navigation`,label:n(`User interface and content navigation keystrokes`),description:n(`Use the following keystrokes for more efficient navigation in the CKEditor 5 user interface.`),groups:[{id:`common`,keystrokes:r}]})}addKeystrokeInfoCategory({id:e,label:t,description:n,groups:r}){this.keystrokeInfos.set(e,{id:e,label:t,description:n,groups:new Map}),this.addKeystrokeInfoGroup({categoryId:e,id:Kh}),r&&r.forEach(t=>{this.addKeystrokeInfoGroup({categoryId:e,...t})})}addKeystrokeInfoGroup({categoryId:e=Gh,id:t,label:n,keystrokes:r}){let i=this.keystrokeInfos.get(e);if(!i)throw new w(`accessibility-unknown-keystroke-info-category`,this._editor,{groupId:t,categoryId:e});i.groups.set(t,{id:t,label:n,keystrokes:r||[]})}addKeystrokeInfos({categoryId:e=Gh,groupId:t=Kh,keystrokes:n}){if(!this.keystrokeInfos.has(e))throw new w(`accessibility-unknown-keystroke-info-category`,this._editor,{categoryId:e,keystrokes:n});let r=this.keystrokeInfos.get(e);if(!r.groups.has(t))throw new w(`accessibility-unknown-keystroke-info-group`,this._editor,{groupId:t,categoryId:e,keystrokes:n});r.groups.get(t).keystrokes.push(...n)}};function Jh(e){return{sessionId:eg(),pageSessionId:tg(),hostname:window.location.hostname,version:globalThis.CKEDITOR_VERSION,type:Yh(e),plugins:Xh(e.plugins),distribution:Qh(),env:$h(),integration:Object.create(null),menuBar:{isVisible:!!e.config.get(`menuBar.isVisible`)},language:{ui:e.locale.uiLanguage,content:e.locale.contentLanguage},toolbar:{main:Zh(e.config.get(`toolbar`)),block:Zh(e.config.get(`blockToolbar`)),balloon:Zh(e.config.get(`balloonToolbar`))}}}function Yh(e){return Object.getPrototypeOf(e).constructor.editorName}function Xh(e){return Array.from(e).filter(([e])=>!!e.pluginName).map(([e])=>{let{pluginName:t,isContextPlugin:n,isOfficialPlugin:r,isPremiumPlugin:i}=e;return{isContext:!!n,isOfficial:!!r,isPremium:!!i,name:t}})}function Zh(e){if(!e)return;let t=Array.isArray(e)?{items:e}:e,n=i(t.items||[]);return{isMultiline:n.includes(`-`),shouldNotGroupWhenFull:!!t.shouldNotGroupWhenFull,items:r(n)};function r(e){return e.filter(e=>e!==`|`&&e!==`-`)}function i(e){return e.flatMap(e=>typeof e==`string`?[e]:i(e.items))}}function Qh(){return{channel:window[Symbol.for(`cke distribution`)]||`sh`}}function $h(){let e=`unknown`,t=`unknown`;return p.isMac?e=`mac`:p.isWindows?e=`windows`:p.isiOS?e=`ios`:p.isAndroid&&(e=`android`),p.isGecko?t=`gecko`:p.isBlink?t=`blink`:p.isSafari&&(t=`safari`),{os:e,browser:t}}function eg(){return localStorage.getItem(`__ckeditor-session-id`)||localStorage.setItem(`__ckeditor-session-id`,he()),localStorage.getItem(`__ckeditor-session-id`)}function tg(){return u.window.CKEDITOR_PAGE_SESSION_ID=u.window.CKEDITOR_PAGE_SESSION_ID||he(),u.window.CKEDITOR_PAGE_SESSION_ID}const ng=D();var rg=class extends ng{static get editorName(){return`Editor`}accessibility;commands;config;conversion;data;editing;locale;model;plugins;keystrokes;t;static defaultConfig;static builtinPlugins;_context;_readOnlyLocks;_registeredRootsAttributesKeys=new Set;static get _throwErrorWhenUsedAsAPlugin(){return!0}constructor(e={}){if(super(),typeof e!=`object`||Array.isArray(e))throw new w(`editor-config-invalid-type`);if(`sanitizeHtml`in e)throw new w(`editor-config-sanitizehtml-not-supported`);let t=this.constructor,{translations:n,...r}=t.defaultConfig||{},{translations:i=n,...a}=e,o=e.language||r.language;this._context=e.context||new po({language:o,translations:i}),this._context._addEditor(this,!e.context);let s=Array.from(t.builtinPlugins||[]);this.config=new hr(a,r),this.config.define(`plugins`,s),this.config.define(this._context._getEditorConfig()),l(this.config),this.plugins=new fo(this,s,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this._readOnlyLocks=new Set,this.commands=new lo,this.set(`state`,`initializing`),this.once(`ready`,()=>this.state=`ready`,{priority:`high`}),this.once(`destroy`,()=>this.state=`destroyed`,{priority:`high`}),this.model=new Dp(this.config),this.on(`change:isReadOnly`,()=>{this.model.document.isReadOnly=this.isReadOnly});let c=new Ho;this.data=new Ed(this.model,c),this.editing=new Qu(this.model,c),this.editing.view.document.bind(`isReadOnly`).to(this),this.conversion=new Dd([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 go(this),this.keystrokes.listenTo(this.editing.view.document),this.accessibility=new qh(this),u(this);function l(e){let t=e.get(`licenseKey`);if(!t&&window.CKEDITOR_GLOBAL_LICENSE_KEY&&(t=window.CKEDITOR_GLOBAL_LICENSE_KEY,e.set(`licenseKey`,t)),!t)throw new w(`license-key-missing`)}function u(e){let t=e.config.get(`licenseKey`),n=window[Symbol.for(`cke distribution`)]||`sh`;function r(t,n){e.enableReadOnlyMode(Symbol(`invalidLicense`)),e._showLicenseError(t,n)}function i(e){return[`exp`,`jti`,`vc`].every(t=>t in e)}function a(e){return Object.getOwnPropertyNames(e).sort().filter(t=>t!=`vc`&&e[t]!=null).map(t=>e[t])}function o(e){let{hostname:t}=new URL(window.location.href);if(e.includes(t))return!0;let n=t.split(`.`);return e.filter(e=>e.includes(`*`)).map(e=>e.split(`.`)).filter(e=>e.length<=n.length).map(e=>Array(n.length-e.length).fill(e[0]===`*`?`*`:``).concat(e)).some(e=>n.every((t,n)=>e[n]===t||e[n]===`*`))}function s(e){let t=e[0].toUpperCase()+e.slice(1),n=e===`evaluation`?`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 ${n} ${e} license of CKEditor 5${e===`trial`?` which is for evaluation purposes only`:``}. For production usage, please obtain a production license at https://portal.ckeditor.com/`)}if(t==`GPL`){n==`cloud`&&r(`distributionChannel`);return}let c=ca(t);if(!c){r(`invalid`);return}if(!i(c)){r(`invalid`);return}if(c.distributionChannel&&!A(c.distributionChannel).includes(n)){r(`distributionChannel`);return}if(Zi(a(c))!=c.vc.toLowerCase()){r(`invalid`);return}if(new Date(c.exp*1e3)<we){r(`expired`);return}let l=c.licensedHosts;if(l&&l.length>0&&!o(l)){r(`domainLimit`);return}if([`evaluation`,`trial`].includes(c.licenseType)&&c.exp*1e3<Date.now()){r(`expired`);return}if([`development`,`evaluation`,`trial`].includes(c.licenseType)){let{licenseType:e}=c;window.CKEDITOR_WARNING_SUPPRESSIONS=window.CKEDITOR_WARNING_SUPPRESSIONS||{},window.CKEDITOR_WARNING_SUPPRESSIONS[e]||(s(e),window.CKEDITOR_WARNING_SUPPRESSIONS[e]=!0)}if(c.licenseType===`evaluation`){let t=setTimeout(()=>{r(`evaluationLimit`)},6e5);e.on(`destroy`,()=>{clearTimeout(t)})}c.usageEndpoint&&e.once(`ready`,()=>{let n={requestId:he(),requestTime:Math.round(Date.now()/1e3),license:t,editor:ig(e)};e._sendUsageRequest(c.usageEndpoint,n).then(e=>{let{status:t,message:n}=e;n&&console.warn(n),t!=`ok`&&r(`usageLimit`)},()=>{ye(`license-key-validation-endpoint-not-reachable`,{url:c.usageEndpoint})})},{priority:`high`})}}get isReadOnly(){return this._readOnlyLocks.size>0}set isReadOnly(e){throw new w(`editor-isreadonly-has-no-setter`)}enableReadOnlyMode(e){if(typeof e!=`string`&&typeof e!=`symbol`)throw new w(`editor-read-only-lock-id-invalid`,null,{lockId:e});this._readOnlyLocks.has(e)||(this._readOnlyLocks.add(e),this._readOnlyLocks.size===1&&this.fire(`change:isReadOnly`,`isReadOnly`,!0,!1))}disableReadOnlyMode(e){if(typeof e!=`string`&&typeof e!=`symbol`)throw new w(`editor-read-only-lock-id-invalid`,null,{lockId:e});this._readOnlyLocks.has(e)&&(this._readOnlyLocks.delete(e),this._readOnlyLocks.size===0&&this.fire(`change:isReadOnly`,`isReadOnly`,!1,!0))}setData(e){this.data.set(e)}getData(e){return this.data.get(e)}async initPlugins(){let e=this.config,t=e.get(`plugins`),n=e.get(`removePlugins`)||[],r=e.get(`extraPlugins`)||[],i=e.get(`substitutePlugins`)||[],a=await this.plugins.init(t.concat(r),n,i);return o(this),a;function o(e){let t=e.config.get(`licenseKey`);if(t===`GPL`)return;let n=ca(t);if(!n)return;let r=[...e.plugins].map(([e])=>e).find(e=>!e.pluginName||!e.licenseFeatureCode?!1:ua(n,e.licenseFeatureCode));r&&(e.enableReadOnlyMode(Symbol(`invalidLicense`)),e._showLicenseError(`pluginNotAllowed`,r.pluginName))}}async destroy(){this.state==`initializing`&&await new Promise(e=>this.once(`ready`,e)),this.fire(`destroy`),this.stopListening(),this.commands.destroy(),await this.plugins.destroy(),this.model.destroy(),this.data.destroy(),this.editing.destroy(),this.keystrokes.destroy(),await this._context._removeEditor(this)}execute(e,...t){try{return this.commands.execute(e,...t)}catch(e){w.rethrowUnexpectedError(e,this)}}focus(){this.editing.view.focus()}registerRootAttribute(e){this._registeredRootsAttributesKeys.has(e)||(this._registeredRootsAttributesKeys.add(e),this.editing.model.schema.extend(`$root`,{allowAttributes:e}))}getRootAttributes(e=`main`){let t=this.model.document.getRoot(e);if(!t)throw new w(`get-root-attributes-missing-root`,this,{rootName:e});let n={};for(let e of this._registeredRootsAttributesKeys)n[e]=t.hasAttribute(e)?t.getAttribute(e):null;return n}static create(...e){throw Error(`This is an abstract method.`)}static Context=po;static EditorWatchdog=Mh;static ContextWatchdog=Lh;_showLicenseError(e,t){setTimeout(()=>{if(e==`invalid`)throw new w(`invalid-license-key`);if(e==`expired`)throw new w(`license-key-expired`);if(e==`domainLimit`)throw new w(`license-key-domain-limit`);if(e==`pluginNotAllowed`){let e=t.replace(/(Editing|UI)$/,``);throw new w(`license-key-plugin-not-allowed`,null,{pluginName:this.plugins.has(e)?e:t})}if(e==`featureNotAllowed`)throw new w(`license-key-feature-not-allowed`,null,{featureName:t});if(e==`evaluationLimit`)throw new w(`license-key-evaluation-limit`);if(e==`trialLimit`)throw new w(`license-key-trial-limit`);if(e==`developmentLimit`)throw new w(`license-key-development-limit`);if(e==`usageLimit`)throw new w(`license-key-usage-limit`);if(e==`distributionChannel`)throw new w(`license-key-invalid-distribution-channel`)},0),this._showLicenseError=()=>{}}async _sendUsageRequest(e,t){let n=new Headers({"Content-Type":`application/json`}),r=await fetch(new URL(e),{method:`POST`,headers:n,body:JSON.stringify(t)});if(!r.ok)throw Error(`HTTP Response: ${r.status}`);return r.json()}};function ig(e){let t=Jh(e);function n(e,n){if(Je(t,e)!==void 0)throw new w(`editor-usage-data-path-already-set`,{path:e});On(t,e,n)}return e.fire(`collectUsageData`,{setUsageData:n}),t}function ag(e){if(!An(e.updateSourceElement))throw new w(`attachtoform-missing-elementapi-interface`,e);let t=e.sourceElement;if(og(t)&&t.form){let n,r=t.form,i=()=>e.updateSourceElement();An(r.submit)&&(n=r.submit,r.submit=()=>{i(),n.apply(r)}),r.addEventListener(`submit`,i),e.on(`destroy`,()=>{r.removeEventListener(`submit`,i),n&&(r.submit=n)})}}function og(e){return!!e&&e.tagName.toLowerCase()===`textarea`}function sg(e){class t extends e{sourceElement;updateSourceElement(e){if(!this.sourceElement)throw new w(`editor-missing-sourceelement`,this);let t=this.config.get(`updateSourceElementOnDestroy`),n=this.sourceElement instanceof HTMLTextAreaElement;if(!t&&!n){Ur(this.sourceElement,``);return}let r=typeof e==`string`?e:this.data.get();Ur(this.sourceElement,r)}}return t}function cg(e,t){if(t.ckeditorInstance)throw new w(`editor-source-element-already-used`,e);t.ckeditorInstance=e,e.once(`destroy`,()=>{delete t.ckeditorInstance})}const lg=[[`description`,`$description`],[`title`,`$title`]];function ug(e){let t=e.config.get(`roots`);for(let[n,r]of Object.entries(t)){let t=null;for(let[e,n]of lg)r[e]==null||r.modelAttributes&&n in r.modelAttributes||(t||={...r.modelAttributes},t[n]=r[e]);t&&e.config.set(`roots.${n}.modelAttributes`,t)}let n=e.config.get(`roots`),r=!1;for(let t of Object.values(n))for(let n of Object.keys(t.modelAttributes||{}))e.registerRootAttribute(n),r=!0;r&&e.data.once(`init`,()=>{e.model.enqueueChange({isUndoable:!1},t=>{for(let[r,i]of Object.entries(n)){let n=e.model.document.getRoot(r);if(n)for(let[e,r]of Object.entries(i.modelAttributes||{}))r!==null&&t.setAttribute(e,r,n)}})})}function dg(e,t,n=`main`,r=!1){let i=t.get(`root`),a=t.get(`roots`)||Object.create(null);if(!xn(a))throw new w(`editor-create-roots-not-plain-object`,null);if(i){if(!n)throw new w(`editor-create-multi-root-with-main`,null);if(n in a)throw new w(`editor-create-roots-with-main`,null)}n&&!a[n]&&(a[n]=i||Object.create(null));let o=mg(e),s=gg(t,o,n),c=Array.from(new Set([...o?Object.keys(e):[],...Object.keys(a),...Object.keys(s)]));for(let n of c){let i=a[n]||Object.create(null),c=o?e[n]:e;if(!r&&xg(c)){if(i.element)throw new w(`editor-create-root-element-overspecified`,null);i.element=c}if(r&&xg(i.element)&&(T(`editor-create-root-element-not-supported`),i.element=void 0),i.initialData===void 0)if(s[n]===void 0){let e=xg(i.element)?i.element:void 0;i.initialData=hg(c||e||r&&t.get(`attachTo`)||``)}else if(c&&!xg(c))throw new w(`editor-create-initial-data-overspecified`,null);else i.initialData=s[n];else if(c&&!xg(c))throw new w(`editor-create-root-initial-data-overspecified`,null);else if(s[n]!==void 0)throw new w(`editor-create-legacy-initial-data-overspecified`,null);i.placeholder??=_g(t,`placeholder`,n),i.label??=_g(t,`label`,n),i.modelElement||=`$root`,i.element=vg(i.element),a[n]=i}if(r&&xg(e)){if(t.get(`attachTo`))throw new w(`editor-create-attachto-overspecified`,null);t.set(`attachTo`,e)}if(!r&&t.get(`attachTo`))throw new w(`editor-create-attachto-ignored`,null);t.set(`roots`,a)}function fg(e,t){return typeof e==`string`||xg(e)||t&&Object.keys(t).length?{sourceElementOrData:e,editorConfig:t}:{sourceElementOrData:``,editorConfig:e}}function pg(e,t){return t&&Object.keys(t).length||Object.keys(e).length==0||Object.values(e).every(e=>typeof e==`string`||xg(e))?{sourceElementsOrData:e,editorConfig:t}:{sourceElementsOrData:{},editorConfig:e}}function mg(e){return!!e&&typeof e==`object`&&!Array.isArray(e)&&!xg(e)}function hg(e){return xg(e)?Er(e):e}function gg(e,t,n){return t||!n?e.get(`initialData`)||Object.create(null):{[n]:e.get(`initialData`)}}function _g(e,t,n){let r=e.get(t);if(r)return typeof r==`string`?r:r[n]}function vg(e){if(e==null)return;if(xg(e))return bg(e.tagName),e;if(typeof e==`string`)return bg(e),{name:e};let{name:t,classes:n,styles:r,attributes:i}=e;t!==void 0&&bg(t);let{class:a,style:o,...s}=i||{},c=!!i&&`class`in i,l=!!r&&Object.keys(r).length>0,u=l&&!!o;u&&T(`editor-root-element-styles-overspecified`);let d=[...yg(n),...yg(a)],f={...s};return c&&(f.class=``),u?f.style=``:o&&(f.style=o),{...t!==void 0&&{name:t},...d.length&&{classes:d},...l&&{styles:r},...Object.keys(f).length&&{attributes:f}}}function yg(e){return e?A(e).flatMap(e=>e.split(/\s+/)).filter(Boolean):[]}function bg(e){if(typeof e!=`string`||!/^[A-Za-z][A-Za-z0-9_-]*$/.test(e))throw new w(`editor-wrong-element-name`,null,{name:e});if([`textarea`,`input`].includes(e.toLowerCase()))throw new w(`editor-wrong-element`,null)}function xg(e){return jn(e)}function Sg(e){let t=e.model.schema,n=e.model.document;for(let e of n.roots)if(!(e===n.graveyard||!e.isAttached())&&!t.isLimit(e))throw new w(`editor-root-element-is-not-limit`,null,{rootName:e.rootName,elementName:e.name})}function Cg(e,t){let n=e.model.document.getRoot(t);return e.model.schema.checkChild(n,`$block`)}var wg=class extends ho{_actions;static get pluginName(){return`PendingActions`}static get isOfficialPlugin(){return!0}init(){this.set(`hasAny`,!1),this._actions=new Fi({idProperty:`_id`}),this._actions.delegate(`add`,`remove`).to(this)}add(e){if(typeof e!=`string`)throw new w(`pendingactions-add-invalid-message`,this);let t=new(D());return t.set(`message`,e),this._actions.add(t),this.hasAny=!0,t}remove(e){this._actions.remove(e),this.hasAny=!!this._actions.length}get first(){return this._actions.get(0)}[Symbol.iterator](){return this._actions[Symbol.iterator]()}},Tg=`<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>`,Eg=`<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>`,Dg=`<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>`,Og=`<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>`,kg=`<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>`,Ag=`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="none" viewBox="0 0 18 18"><path fill="currentColor" d="M.471 10.832a.675.675 0 0 1 .85.448l.017.047q.022.065.07.189c.066.165.168.402.309.678.284.557.718 1.257 1.325 1.864a9.8 9.8 0 0 0 1.692 1.356 7 7 0 0 0 .671.375l.033.014.005.003a.675.675 0 0 1-.47 1.264l-.065-.025-.008-.004-.017-.007-.052-.024-.184-.09c-.155-.08-.372-.2-.631-.364a11 11 0 0 1-1.929-1.543C1.35 14.274.84 13.443.514 12.807a9 9 0 0 1-.449-1.03l-.024-.068-.006-.02-.002-.005v-.003H.032l.643-.206-.643.205a.676.676 0 0 1 .44-.848M11.758.408a.676.676 0 0 1 .822-.377l.065.025.007.003.017.007.053.025q.066.03.184.09c.154.08.371.2.63.363.52.326 1.214.829 1.929 1.544.739.738 1.249 1.57 1.573 2.206a9 9 0 0 1 .45 1.03l.023.067.006.02.003.006v.003l-.643.205.644-.205a.676.676 0 0 1-1.287.41l-.004-.01-.015-.046-.072-.19a8 8 0 0 0-.307-.678c-.284-.557-.719-1.257-1.326-1.864a9.8 9.8 0 0 0-1.691-1.355 7 7 0 0 0-.672-.375l-.033-.015-.005-.002a.675.675 0 0 1-.351-.887M9.937 5.706a3.38 3.38 0 0 0 1.996 1.997l3.142 1.162-3.142 1.162a3.38 3.38 0 0 0-1.996 1.998l-1.162 3.14-1.162-3.14a3.38 3.38 0 0 0-1.998-1.998l-3.14-1.162 3.14-1.162a3.38 3.38 0 0 0 1.998-1.997l1.162-3.141zm5.407 7.794a.675.675 0 1 1 1.35 0 .675.675 0 0 1-1.35 0m-2.249 2.25a.675.675 0 1 1 1.35 0 .675.675 0 0 1-1.35 0M3.194 1.35a.675.675 0 1 1 1.35 0 .675.675 0 0 1-1.35 0M.944 3.601a.675.675 0 1 1 1.35 0 .675.675 0 0 1-1.35 0"/></svg>`,jg=`<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>`,Mg=`<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>`,Ng=`<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>`,Pg=`<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>`,Fg=`<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>`,Ig=`<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>`,Lg=`<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>`,Rg=`<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>`,zg=`<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>`,Bg=`<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>`,Vg=`<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>`,Hg=`<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>`,Ug=`<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>`,Wg=`<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>`,Gg=`<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>`,Kg=`<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>`,qg=`<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>`,Jg=`<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>`,Yg=`<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>`,Xg=`<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>`,Zg=`<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>`,Qg=`<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>`,$g=`<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>`,e_=`<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>`,t_=`<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>`,n_=`<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>`,r_=`<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>`,i_=`<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>`,a_=`<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>`,Jee=`<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>`,o_=`<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>`,s_=`<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>`,c_=`<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>`,Yee=`<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>`,l_=`<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>`,Xee=`<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>`,Zee=`<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>`,Qee=`<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>`,u_=`<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>`,$ee=`<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>`,d_=`<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>`,f_=`<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>`,ete=`<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>`,p_=`<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>`,m_=`<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>`,tte=`<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>`,h_=`<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>`,g_=`<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>`,nte=`<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>`,rte=`<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>`,ite=`<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>`,ate=`<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>`,ote=`<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>`,ste=`<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>`,__=`<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>`,v_=`<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>`,y_=`<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>`,cte=`<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>`,b_=`<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>`,lte=`<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>`,x_=`<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>`,S_=`<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>`,ute=`<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>`,dte=`<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>`,fte=`<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>`,pte=`<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>`,mte=`<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>`,hte=`<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>`,gte=`<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>`,C_=`<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>`,w_=`<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>`,T_=`<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>`,E_=`<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>`,D_=`<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>`,_te=`<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>`,O_=`<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>`,k_=`<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>`,vte=`<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>`,yte=`<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>`,A_=`<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>`,j_=`<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>`,M_=`<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>`,N_=`<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>`,P_=`<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>`,F_=`<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>`,I_=`<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>`,L_=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2 9h16v2H2z"/></svg>`,R_=`<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>`,z_=`<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>`,B_=`<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>`,V_=`<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>`,H_=`<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>`,U_=`<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>`,W_=`<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>`,G_=`<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>`,K_=`<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>`,q_=`<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>`,J_=`<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>`,Y_=`<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>`,X_=`<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>`,Z_=`<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>`,Q_=`<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>`,$_=`<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>`,ev=`<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>`,tv=`<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>`,nv=`<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>`,rv=`<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>`,iv=`<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>`,av=`<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>`,ov=`<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>`,sv=`<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>`,cv=`<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>`,lv=`<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>`,bte=`<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>`,xte=`<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>`,uv=`<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>`,dv=`<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>`,fv=`<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>`,pv=`<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>`,mv=`<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>`,hv=`<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>`,gv=`<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>`,_v=`<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>`,vv=`<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>`,yv=`<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>`,bv=`<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>`,xv=`<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>`,Sv=`<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>`,Cv=`<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>`,wv=`<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>`,Tv=`<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>`,Ev=`<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>`,Dv=`<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>`,Ov=`<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>`,kv=`<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>`,Av=`<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>`,Ste=`<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>`,Cte=`<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>`,jv=`<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>`,Mv=`<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>`,wte=`<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>`,Nv=`<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>`,Pv=`<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 31 20" width="30" height="20">
<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"/>
<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"/>
<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"/>
<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"/>
<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"/>
</svg>
`,Fv=`<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>`,Iv=`<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>`,Lv=`<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>`,Rv=`<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>`,zv=`<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>`,Bv=`<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>`,Vv=`<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>`,Hv=`<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>`,Uv=`<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<circle cx="9.00037" cy="9.79993" r="1.5"/>
<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"/>
<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"/>
<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"/>
<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"/>
<circle cx="14.8253" cy="16.1749" r="1.125" fill="white"/>
</svg>
`,Wv=`<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>`,Gv=`<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>`,Kv=`<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>
`,qv=`<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>`,Jv=`<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>`,Yv=`<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>`,Xv=`<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>`,Zv=`<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>`,Qv=`<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>`,$v=`<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>`,ey=`<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>`,ty=`<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>`,ny=`<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>`,ry=`<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>`,iy=`<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>
`,ay=`<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>`,oy=`<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>`,sy=`<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>`,cy=`<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>`,ly=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M9.288 1.496c.244-.661 1.18-.661 1.424 0l1.513 4.09a3.7 3.7 0 0 0 2.188 2.188l4.091 1.514c.661.244.66 1.18 0 1.424l-4.09 1.513a3.7 3.7 0 0 0-2.189 2.19l-1.513 4.09c-.244.66-1.18.66-1.424 0l-1.513-4.09a3.7 3.7 0 0 0-2.19-2.19l-4.09-1.513c-.66-.244-.66-1.18 0-1.424l4.09-1.514a3.7 3.7 0 0 0 2.189-2.188zM9.168 6.1A5.2 5.2 0 0 1 6.1 9.167L3.851 10l2.25.832a5.2 5.2 0 0 1 3.066 3.067L10 16.148l.832-2.25a5.2 5.2 0 0 1 3.066-3.066L16.147 10l-2.25-.833a5.2 5.2 0 0 1-3.065-3.066L10 3.852z"/></svg>`,uy=`<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>`,dy=`<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>`,fy=`<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>`,py=`<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>`,my=`<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>`,hy=`<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>`,gy=`<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>`,_y=`<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>`,vy=`<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>`,Tte=`<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>`,yy=`<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>`,by=`<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>`,xy=`<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>`,Sy=`<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>`,Ete=`<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 45 45">
<path fill="#F0F0F0" d="M2 0h41s2 0 2 2v41s0 2 -2 2h-41s-2 0 -2 -2v-41s0 -2 2 -2" />
<path fill="#D5D5D5" d="M11 10h10s1 0 1 1v24s0 1 -1 1h-10s-1 0 -1 -1v-24s0 -1 1 -1" />
<path fill="#D5D5D5" d="M25 10h10s1 0 1 1v10s0 1 -1 1h-10s-1 0 -1 -1v-10s0 -1 1 -1" />
<path fill="#D5D5D5" d="M25 24h10s1 0 1 1v10s0 1 -1 1h-10s-1 0 -1 -1v-10s0 -1 1 -1" />
</svg>
`,Dte=`<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>`,Cy=`<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>`,wy=`<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>`,Ote=`<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>`,kte=`<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>`,Ty=`<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>`,Ate=`<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>`,jte=`<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>`,Ey=`<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>`,Mte=`<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>`,Nte=`<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>`,Pte=`<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>`,Dy=`<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>`,Oy=`<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>`,ky=`<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>`,Ay=`<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>`,jy=`<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>`,My=`<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>`,Ny=`<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>`,Py=`<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>`,Fy=`<svg width="12" height="12" viewBox="0 0 13 13" xmlns="http://www.w3.org/2000/svg">
<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"/>
</svg>
`,Iy=`<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>`,Ly=class e extends P{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`.split(`.`);constructor(){super();let e=this.bindTemplate;this.set(`content`,``),this.set(`viewBox`,`0 0 20 20`),this.set(`fillColor`,``),this.set(`isColorInherited`,!0),this.set(`isVisible`,!0),this.setTemplate({tag:`svg`,ns:`http://www.w3.org/2000/svg`,attributes:{class:[`ck`,`ck-icon`,e.if(`isVisible`,`ck-hidden`,e=>!e),`ck-reset_all-excluded`,e.if(`isColorInherited`,`ck-icon_inherit-color`)],viewBox:e.to(`viewBox`),"aria-hidden":!0}})}render(){super.render(),this._updateXMLContent(),this._colorFillPaths(),this.on(`change:content`,()=>{this._updateXMLContent(),this._colorFillPaths()}),this.on(`change:fillColor`,()=>{this._colorFillPaths()})}_updateXMLContent(){if(this.content){let t=new DOMParser().parseFromString(this.content.trim(),`image/svg+xml`).querySelector(`svg`);if(!t)throw new w(`ui-iconview-invalid-svg`,this);let n=t.getAttribute(`viewBox`);n&&(this.viewBox=n);for(let{name:n,value:r}of Array.from(t.attributes))e.presentationalAttributeNames.includes(n)&&this.element.setAttribute(n,r);for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);for(;t.childNodes.length>0;)this.element.appendChild(t.childNodes[0])}}_colorFillPaths(){this.fillColor&&this.element.querySelectorAll(`.ck-icon__fill`).forEach(e=>{e.style.fill=this.fillColor})}},Ry=class extends P{constructor(){super(),this.set({style:void 0,text:void 0,id:void 0});let 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`)}]})}},H=class extends P{children;labelView;iconView;keystrokeView;_focusDelayed=null;constructor(e,t=new Ry){super(e);let n=this.bindTemplate,r=he();this.set(`_ariaPressed`,!1),this.set(`_ariaChecked`,!1),this.set(`ariaLabel`,void 0),this.set(`ariaLabelledBy`,`ck-editor__aria-label_${r}`),this.set(`class`,void 0),this.set(`labelStyle`,void 0),this.set(`icon`,void 0),this.set(`isEnabled`,!0),this.set(`isOn`,!1),this.set(`isVisible`,!0),this.set(`isToggleable`,!1),this.set(`keystroke`,void 0),this.set(`label`,void 0),this.set(`role`,void 0),this.set(`tabindex`,-1),this.set(`tooltip`,!1),this.set(`tooltipPosition`,`s`),this.set(`type`,`button`),this.set(`withText`,!1),this.set(`withKeystroke`,!1),this.children=this.createCollection(),this.labelView=this._setupLabelView(t),this.iconView=new Ly,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));let i={tag:`button`,attributes:{class:[`ck`,`ck-button`,n.to(`class`),n.if(`isEnabled`,`ck-disabled`,e=>!e),n.if(`isVisible`,`ck-hidden`,e=>!e),n.to(`isOn`,e=>e?`ck-on`:`ck-off`),n.if(`withText`,`ck-button_with-text`),n.if(`withKeystroke`,`ck-button_with-keystroke`)],role:n.to(`role`),type:n.to(`type`,e=>e||`button`),tabindex:n.to(`tabindex`),"aria-checked":n.to(`_ariaChecked`),"aria-pressed":n.to(`_ariaPressed`),"aria-label":n.to(`ariaLabel`),"aria-labelledby":n.to(`ariaLabelledBy`),"aria-disabled":n.if(`isEnabled`,!0,e=>!e),"data-cke-tooltip-text":n.to(`_tooltipString`),"data-cke-tooltip-position":n.to(`tooltipPosition`)},children:this.children,on:{click:n.to(e=>{this.isEnabled?this.fire(`execute`):e.preventDefault()})}};this.bind(`_ariaPressed`).to(this,`isOn`,this,`isToggleable`,this,`role`,(e,t,n)=>!t||zy(n)?!1:String(!!e)),this.bind(`_ariaChecked`).to(this,`isOn`,this,`isToggleable`,this,`role`,(e,t,n)=>!t||!zy(n)?!1:String(!!e)),p.isSafari&&(this._focusDelayed||=Yi(()=>this.focus(),0),i.on.mousedown=n.to(()=>{this._focusDelayed()}),i.on.mouseup=n.to(()=>{this._focusDelayed.cancel()})),this.setTemplate(i)}render(){super.render(),this.icon&&this.children.add(this.iconView),this.on(`change:icon`,(e,t,n,r)=>{n&&!r?this.children.add(this.iconView,0):!n&&r&&this.children.remove(this.iconView)}),this.children.add(this.labelView),this.withKeystroke&&this.keystroke&&this.children.add(this.keystrokeView)}focus(){this.element.focus()}destroy(){this._focusDelayed&&this._focusDelayed.cancel(),super.destroy()}_setupLabelView(e){return e.bind(`text`,`style`,`id`).to(this,`label`,`labelStyle`,`ariaLabelledBy`),e}_createKeystrokeView(){let e=new P;return e.setTemplate({tag:`span`,attributes:{class:[`ck`,`ck-button__keystroke`]},children:[{text:this.bindTemplate.to(`keystroke`,e=>bi(e))}]}),e}_getTooltipString(e,t,n){return e?typeof e==`string`?e:(n&&=bi(n),e instanceof Function?e(t,n):`${t}${n?` (${n})`:``}`):``}};function zy(e){switch(e){case`radio`:case`checkbox`:case`option`:case`switch`:case`menuitemcheckbox`:case`menuitemradio`:return!0;default:return!1}}var By=class extends P{children;iconView;constructor(e,t={}){super(e);let n=this.bindTemplate;this.set(`label`,t.label||``),this.set(`class`,t.class||null),this.children=this.createCollection(),this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-form__header`,n.to(`class`)]},children:this.children}),t.icon&&(this.iconView=new Ly,this.iconView.content=t.icon,this.children.add(this.iconView));let r=new P(e);r.setTemplate({tag:`h2`,attributes:{class:[`ck`,`ck-form__header__label`],role:`presentation`},children:[{text:n.to(`label`)}]}),this.children.add(r)}};const Vy=E();var Hy=class extends Vy{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(let t in e.actions){let n=e.actions[t];typeof n==`string`&&(n=[n]);for(let r of n)e.keystrokeHandler.set(r,(e,n)=>{this[t](),n()},e.keystrokeHandlerOptions)}this.on(`forwardCycle`,()=>this.focusFirst(),{priority:`low`}),this.on(`backwardCycle`,()=>this.focusLast(),{priority:`low`})}get first(){return this.focusables.find(Uy)||null}get last(){return this.focusables.filter(Uy).slice(-1)[0]||null}get next(){return this._getDomFocusableItem(1)}get previous(){return this._getDomFocusableItem(-1)}get current(){let e=null;return this.focusTracker.focusedElement===null?null:(this.focusables.find((t,n)=>{let r=t.element===this.focusTracker.focusedElement;return r&&(e=n),r}),e)}focusFirst(){this._focus(this.first,1)}focusLast(){this._focus(this.last,-1)}focusNext(){let e=this.next;if(e&&this.focusables.getIndex(e)===this.current){this.fire(`forwardCycle`);return}e===this.first?this.fire(`forwardCycle`):this._focus(e,1)}focusPrevious(){let e=this.previous;if(e&&this.focusables.getIndex(e)===this.current){this.fire(`backwardCycle`);return}e===this.last?this.fire(`backwardCycle`):this._focus(e,-1)}chain(e){let t=()=>this.current===null?null:this.focusables.get(this.current);this.listenTo(e,`forwardCycle`,e=>{let n=t();this.focusNext(),n!==t()&&e.stop()},{priority:`low`}),this.listenTo(e,`backwardCycle`,e=>{let n=t();this.focusPrevious(),n!==t()&&e.stop()},{priority:`low`})}unchain(e){this.stopListening(e)}_focus(e,t){e&&this.focusTracker.focusedElement!==e.element&&e.focus(t)}_getDomFocusableItem(e){let t=this.focusables.length;if(!t)return null;let n=this.current;if(n===null)return this[e===1?`first`:`last`];let r=this.focusables.get(n),i=(n+t+e)%t;do{let n=this.focusables.get(i);if(Uy(n)){r=n;break}i=(i+t+e)%t}while(i!==n);return r}};function Uy(e){return Wy(e)&&Yr(e.element)}function Wy(e){return`focus`in e&&typeof e.focus==`function`}function Gy(e){return Wy(e)&&`focusCycler`in e&&e.focusCycler instanceof Hy}var Ky=class extends P{children;keystrokes;focusCycler;_focusTracker;_focusables;constructor(e){super(e),this.children=this.createCollection(),this.keystrokes=new N,this._focusTracker=new M,this._focusables=new pa,this.focusCycler=new Hy({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(let t of e){let e=new H(this.locale),n;for(n in e.on(`execute`,()=>t.onExecute()),t.onCreate&&t.onCreate(e),t)n!=`onExecute`&&n!=`onCreate`&&e.set(n,t[n]);this.children.add(e)}this._updateFocusCyclableItems()}focus(e){e===-1?this.focusCycler.focusLast():this.focusCycler.focusFirst()}_updateFocusCyclableItems(){Array.from(this.children).forEach(e=>{this._focusables.add(e),this._focusTracker.add(e.element)})}},qy=class extends P{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 Jy={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`},Yy=Wr(`px`),Xy=Za(P);var Zy=class e extends Xy{parts;headerView;closeButtonView;actionsView;static defaultOffset=15;contentView;keystrokes;focusTracker;wasMoved=!1;_getDomRootElement;_getViewportOffset;_focusables;_focusCycler;constructor(e,{getDomRootElement:t,getViewportOffset:n,keystrokeHandlerOptions:r}){super(e);let i=this.bindTemplate,a=e.t;this.set(`className`,``),this.set(`ariaLabel`,a(`Editor dialog`)),this.set(`isModal`,!1),this.set(`position`,Jy.SCREEN_CENTER),this.set(`_isVisible`,!1),this.set(`_isTransparent`,!1),this.set(`_top`,0),this.set(`_left`,0),this._getDomRootElement=t,this._getViewportOffset=n,this.decorate(`moveTo`),this.parts=this.createCollection(),this.keystrokes=new N,this.focusTracker=new M,this._focusables=new pa,this._focusCycler=new Hy({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:`shift + tab`,focusNext:`tab`},keystrokeHandlerOptions:r}),this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-dialog-overlay`,i.if(`isModal`,`ck-dialog-overlay__transparent`,e=>!e),i.if(`_isVisible`,`ck-hidden`,e=>!e)],tabindex:`-1`},children:[{tag:`div`,attributes:{tabindex:`-1`,class:[`ck`,`ck-dialog`,i.if(`isModal`,`ck-dialog_modal`),i.to(`className`)],role:`dialog`,"aria-label":i.to(`ariaLabel`),style:{top:i.to(`_top`,e=>Yy(e)),left:i.to(`_left`,e=>Yy(e)),visibility:i.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:n})=>{this.wasMoved=!0,this.moveBy(t,n)}),this.listenTo(u.window,`resize`,()=>{this._isVisible&&!this.wasMoved&&this.updatePosition()}),this.listenTo(u.document,`scroll`,()=>{this._isVisible&&!this.wasMoved&&this.updatePosition()}),this.on(`change:_isVisible`,(e,t,n)=>{n&&(this._isTransparent=!0,setTimeout(()=>{this.updatePosition(),this._isTransparent=!1,this.focus()},10))}),this.keystrokes.listenTo(this.element)}get dragHandleElement(){return this.headerView&&!this.isModal?this.headerView.element:null}setupParts({icon:e,title:t,hasCloseButton:n=!0,content:r,actionButtons:i}){t&&(this.headerView=new By(this.locale,{icon:e}),n&&(this.closeButtonView=this._createCloseButton(),this.headerView.children.add(this.closeButtonView)),this.headerView.label=t,this.ariaLabel=t,this.parts.add(this.headerView,0)),r&&(r instanceof P&&(r=[r]),this.contentView=new qy(this.locale),this.contentView.children.addMany(r),this.parts.add(this.contentView)),i&&(this.actionsView=new Ky(this.locale),this.actionsView.setButtons(i),this.parts.add(this.actionsView)),this._updateFocusCyclableItems()}focus(){this._focusCycler.focusFirst()}moveTo(e,t){let n=this._getViewportRect(),r=this._getDialogRect();e+r.width>n.right&&(e=n.right-r.width),e<n.left&&(e=n.left),t<n.top&&(t=n.top),this._moveTo(e,t)}_moveTo(e,t){this._left=e,this._top=t}moveBy(e,t){this.moveTo(this._left+e,this._top+t)}_moveOffScreen(){this._moveTo(-9999,-9999)}updatePosition(){if(!this.element||!this.element.parentNode)return;let t=this._getViewportRect(),n=this.position,r=null,i=null;this._getDomRootElement()?{domRootRect:r,visibleDomRootRect:i}=this._getDomRootRects(t):n=Jy.SCREEN_CENTER;let a=e.defaultOffset,o=this._getDialogRect();if(this.position!=null){if(typeof this.position==`function`){let e=this.position(o,i,r);if(e==null){this._moveOffScreen();return}this._moveTo(e.left,e.top);return}switch(n){case Jy.EDITOR_TOP_SIDE:if(i){let e=this.locale.contentLanguageDirection===`ltr`?i.right-o.width-a:i.left+a;this.moveTo(e,i.top+a)}else this._moveOffScreen();break;case Jy.EDITOR_CENTER:i?this.moveTo(Math.round(i.left+i.width/2-o.width/2),Math.round(i.top+i.height/2-o.height/2)):this._moveOffScreen();break;case Jy.SCREEN_CENTER:this.moveTo(Math.round((t.width-o.width)/2),Math.round((t.height-o.height)/2));break;case Jy.EDITOR_TOP_CENTER:i?this.moveTo(Math.round(i.left+i.width/2-o.width/2),i.top+a):this._moveOffScreen();break;case Jy.EDITOR_BOTTOM_CENTER:i?this.moveTo(Math.round(i.left+i.width/2-o.width/2),i.bottom-o.height-a):this._moveOffScreen();break;case Jy.EDITOR_ABOVE_CENTER:i?this.moveTo(Math.round(i.left+i.width/2-o.width/2),i.top-o.height-a):this._moveOffScreen();break;case Jy.EDITOR_BELOW_CENTER:i?this.moveTo(Math.round(i.left+i.width/2-o.width/2),i.bottom+a):this._moveOffScreen();break}}}_getDomRootRects(e){let t=new O(this._getDomRootElement()),n=t.getVisible();return n&&=e.getIntersection(n),{visibleDomRootRect:n,domRootRect:t}}_getDialogRect(){return new O(this.element.firstElementChild)}_getViewportRect(){let e=new O(u.window);return this.isModal?e:Qr(this._getViewportOffset())}_updateFocusCyclableItems(){let e=[];if(this.contentView)for(let t of this.contentView.children)Wy(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),Gy(e)&&this._focusCycler.chain(e.focusCycler)})}_createCloseButton(){let e=new H(this.locale),t=this.locale.t;return e.set({label:t(`Close`),tooltip:!0,icon:s_}),e.on(`execute`,()=>this.fire(`close`,{source:`closeButton`})),e}},Qy=class e extends F{view;static _visibleDialogPlugin;_onHide;static get pluginName(){return`Dialog`}static get isOfficialPlugin(){return!0}constructor(e){super(e);let t=e.t;this._initShowHideListeners(),this._initFocusToggler(),this._initMultiRootIntegration(),this.set({id:null,isOpen:!1}),e.accessibility.addKeystrokeInfos({categoryId:`navigation`,keystrokes:[{label:t(`Move focus in and out of an active dialog window`),keystroke:`Ctrl+F6`,mayRequireFn:!0}]})}destroy(){super.destroy(),e._visibleDialogPlugin===this&&this._unlockBodyScroll()}_initShowHideListeners(){this.on(`show`,(e,t)=>{this._show(t)}),this.on(`show`,(e,t)=>{t.onShow&&t.onShow(this)},{priority:`low`}),this.on(`hide`,()=>{e._visibleDialogPlugin&&e._visibleDialogPlugin._hide()}),this.on(`hide`,()=>{this._onHide&&=(this._onHide(this),void 0)},{priority:`low`})}_initFocusToggler(){let e=this.editor;e.keystrokes.set(`Ctrl+F6`,(t,n)=>{!this.isOpen||this.view.isModal||(this.view.focusTracker.isFocused?e.editing.view.focus():this.view.focus(),n())})}_initMultiRootIntegration(){let e=this.editor.model;e.document.on(`change:data`,()=>{if(!this.view)return;let t=e.document.differ.getChangedRoots();for(let e of t)e.state&&this.view.updatePosition()})}show(e){this.hide(),this.fire(`show:${e.id}`,e)}_show({id:t,icon:n,title:r,hasCloseButton:i=!0,content:a,actionButtons:o,className:s,isModal:c,position:l,onHide:u,getRootName:d,keystrokeHandlerOptions:f}){let p=this.editor;this.view=new Zy(p.locale,{getDomRootElement:()=>{let e=d?.()??this.editor.model.document.selection.anchor.root.rootName;return!e||!p.editing.view.domRoots.has(e)?null:p.editing.view.getDomRoot(e)??null},getViewportOffset:()=>p.ui.viewportOffset,keystrokeHandlerOptions:f});let m=this.view;m.on(`close`,()=>{this.hide()}),p.ui.view.body.add(m),p.keystrokes.listenTo(m.element),l||=c?Jy.SCREEN_CENTER:Jy.EDITOR_CENTER,c&&this._lockBodyScroll(),m.set({position:l,_isVisible:!0,className:s,isModal:c}),m.setupParts({icon:n,title:r,hasCloseButton:i,content:a,actionButtons:o}),this.id=t,u&&(this._onHide=u),this.isOpen=!0,e._visibleDialogPlugin=this}hide(){e._visibleDialogPlugin&&e._visibleDialogPlugin.fire(`hide:${e._visibleDialogPlugin.id}`)}_hide(){if(!this.view)return;let t=this.editor,n=this.view;n.isModal&&this._unlockBodyScroll(),n.contentView&&n.contentView.reset(),t.ui.view.body.remove(n),t.ui.focusTracker.remove(n.element),t.keystrokes.stopListening(n.element),n.destroy(),t.editing.view.focus(),this.id=null,this.isOpen=!1,e._visibleDialogPlugin=null}_lockBodyScroll(){document.documentElement.classList.add(`ck-dialog-scroll-locked`)}_unlockBodyScroll(){document.documentElement.classList.remove(`ck-dialog-scroll-locked`)}},$y=class extends H{_checkIconHolderView=new eb;constructor(e,t=new Ry){super(e,t),this.set({hasCheckSpace:!1,_hasCheck:this.isToggleable});let n=this.bindTemplate;this.extendTemplate({attributes:{class:[`ck-list-item-button`,n.if(`isToggleable`,`ck-list-item-button_toggleable`)]}}),this.bind(`_hasCheck`).to(this,`hasCheckSpace`,this,`isToggleable`,(e,t)=>e||t)}render(){super.render(),this._hasCheck&&this.children.add(this._checkIconHolderView,0),this._watchCheckIconHolderMount()}_watchCheckIconHolderMount(){this._checkIconHolderView.bind(`isOn`).to(this,`isOn`,e=>this.isToggleable&&e),this.on(`change:_hasCheck`,(e,t,n)=>{let{children:r,_checkIconHolderView:i}=this;n?r.add(i,0):r.remove(i)})}},eb=class extends P{children;_checkIconView=this._createCheckIconView();constructor(){super();let e=this.bindTemplate;this.children=this.createCollection(),this.set(`isOn`,!1),this.setTemplate({tag:`span`,children:this.children,attributes:{class:[`ck`,`ck-list-item-button__check-holder`,e.to(`isOn`,e=>e?`ck-on`:`ck-off`)]}})}render(){super.render(),this.isOn&&this.children.add(this._checkIconView,0),this._watchCheckIconMount()}_watchCheckIconMount(){this.on(`change:isOn`,(e,t,n)=>{let{children:r,_checkIconView:i}=this;n&&!r.has(i)?r.add(i):!n&&r.has(i)&&r.remove(i)})}_createCheckIconView(){let e=new Ly;return e.content=l_,e.extendTemplate({attributes:{class:`ck-list-item-button__check-icon`}}),e}},U=class extends $y{constructor(e){super(e),this.set({withText:!0,withKeystroke:!0,tooltip:!1,role:`menuitem`}),this.extendTemplate({attributes:{class:[`ck-menu-bar__menu__item__button`]}})}},tb=class extends F{contentView=null;static get requires(){return[Qy]}static get pluginName(){return`AccessibilityHelp`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale.t;e.ui.componentFactory.add(`accessibilityHelp`,()=>{let e=this._createButton(H);return e.set({tooltip:!0,withText:!1,label:t(`Accessibility help`)}),e}),e.ui.componentFactory.add(`menuBar:accessibilityHelp`,()=>{let e=this._createButton(U);return e.label=t(`Accessibility`),e}),e.keystrokes.set(`Alt+0`,(e,t)=>{this._toggleDialog(),t()}),this._setupRootLabels()}_createButton(e){let t=this.editor,n=t.plugins.get(`Dialog`),r=t.locale,i=new e(r);return i.set({keystroke:`Alt+0`,icon:Tg,isToggleable:!0}),i.on(`execute`,()=>this._toggleDialog()),i.bind(`isOn`).to(n,`id`,e=>e===`accessibilityHelp`),i}_setupRootLabels(){let e=this.editor,t=e.editing.view,n=e.t;e.ui.on(`ready`,()=>{t.change(e=>{for(let n of t.document.roots)r(e,n)}),e.on(`addRoot`,(n,i)=>{let a=e.editing.view.document.getRoot(i.rootName);t.change(e=>r(e,a))},{priority:`low`})});function r(e,t){let r=[t.getAttribute(`aria-label`),n(`Press %0 for help.`,[bi(`Alt+0`)])].filter(e=>e).join(`. `);e.setAttribute(`aria-label`,r,t)}}_toggleDialog(){let e=this.editor,t=e.plugins.get(`Dialog`),n=e.locale.t;this.contentView||=new to(e.locale,e.accessibility.keystrokeInfos),t.id===`accessibilityHelp`?t.hide():t.show({id:`accessibilityHelp`,className:`ck-accessibility-help-dialog`,title:n(`Accessibility help`),icon:Tg,hasCloseButton:!0,content:this.contentView})}},nb=class e extends pa{locale;_bodyCollectionContainer;static _bodyWrapper;constructor(e,t=[]){super(t),this.locale=e}get bodyCollectionContainer(){return this._bodyCollectionContainer}attachToDom(){this._bodyCollectionContainer=new ga({tag:`div`,attributes:{class:[`ck`,`ck-reset_all`,`ck-body`,`ck-rounded-corners`],dir:this.locale.uiLanguageDirection,role:`application`},children:this}).render(),(!e._bodyWrapper||!e._bodyWrapper.isConnected)&&(e._bodyWrapper=mr(document,`div`,{class:`ck-body-wrapper`}),document.body.appendChild(e._bodyWrapper)),e._bodyWrapper.appendChild(this._bodyCollectionContainer)}detachFromDom(){super.destroy(),this._bodyCollectionContainer&&this._bodyCollectionContainer.remove(),e._bodyWrapper&&!e._bodyWrapper.childElementCount&&(e._bodyWrapper.remove(),delete e._bodyWrapper)}};const rb=Wr(`px`),ib={top:-99999,left:-99999,name:`arrowless`,config:{withArrow:!1}};var ab=class e extends P{content;_pinWhenIsVisibleCallback;_resizeObserver;constructor(e){super(e);let t=this.bindTemplate;this.set(`top`,0),this.set(`left`,0),this.set(`position`,`arrow_nw`),this.set(`isVisible`,!1),this.set(`withArrow`,!0),this.set(`class`,void 0),this._pinWhenIsVisibleCallback=null,this._resizeObserver=null,this.content=this.createCollection(),this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-balloon-panel`,t.to(`position`,e=>`ck-balloon-panel_${e}`),t.if(`isVisible`,`ck-balloon-panel_visible`),t.if(`withArrow`,`ck-balloon-panel_with-arrow`),t.to(`class`)],style:{top:t.to(`top`,rb),left:t.to(`left`,rb)}},children:this.content})}destroy(){this.hide(),super.destroy()}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(t){let n=ob(t.target);if(n&&!Yr(n))return!1;this.show();let r=e.defaultPositions,i=Object.assign({},{element:this.element,positions:[r.southArrowNorth,r.southArrowNorthMiddleWest,r.southArrowNorthMiddleEast,r.southArrowNorthWest,r.southArrowNorthEast,r.northArrowSouth,r.northArrowSouthMiddleWest,r.northArrowSouthMiddleEast,r.northArrowSouthWest,r.northArrowSouthEast,r.viewportStickyNorth],limiter:u.document.body,fitInViewport:!0},t),a=e._getOptimalPosition(i)||ib,o=parseInt(a.left),s=parseInt(a.top),c=a.name,{withArrow:l=!0}=a.config||{};return this.top=s,this.left=o,this.position=c,this.withArrow=l,!0}pin(e){this.unpin(),this._startPinning(e)&&(this._pinWhenIsVisibleCallback=()=>{this.isVisible?this._startPinning(e):this._stopPinning()},this.listenTo(this,`change:isVisible`,this._pinWhenIsVisibleCallback))}unpin(){this._pinWhenIsVisibleCallback&&(this._stopPinning(),this.stopListening(this,`change:isVisible`,this._pinWhenIsVisibleCallback),this._pinWhenIsVisibleCallback=null,this.hide())}_startPinning(e){if(!this.attachTo(e))return!1;let t=ob(e.target),n=e.limiter?ob(e.limiter):u.document.body;if(this.listenTo(u.document,`scroll`,(r,i)=>{let a=i.target,o=t&&a.contains(t),s=n&&a.contains(n);(o||s||!t||!n)&&this.attachTo(e)},{useCapture:!0}),this.listenTo(u.window,`resize`,()=>{this.attachTo(e)}),!this._resizeObserver&&(t&&jr(t)&&(t=t.parentElement),t)){let e=()=>{Yr(t)||this.unpin()};this._resizeObserver=new Hr(t,e)}return!0}_stopPinning(){this.stopListening(u.document,`scroll`),this.stopListening(u.window,`resize`),this._resizeObserver&&=(this._resizeObserver.destroy(),null)}static generatePositions(t={}){let{sideOffset:n=e.arrowSideOffset,heightOffset:r=e.arrowHeightOffset,stickyVerticalOffset:i=e.stickyVerticalOffset,config:a}=t;return{northWestArrowSouthWest:(e,t)=>({top:o(e,t),left:e.left-n,name:`arrow_sw`,...a&&{config:a}}),northWestArrowSouthMiddleWest:(e,t)=>({top:o(e,t),left:e.left-t.width*.25-n,name:`arrow_smw`,...a&&{config:a}}),northWestArrowSouth:(e,t)=>({top:o(e,t),left:e.left-t.width/2,name:`arrow_s`,...a&&{config:a}}),northWestArrowSouthMiddleEast:(e,t)=>({top:o(e,t),left:e.left-t.width*.75+n,name:`arrow_sme`,...a&&{config:a}}),northWestArrowSouthEast:(e,t)=>({top:o(e,t),left:e.left-t.width+n,name:`arrow_se`,...a&&{config:a}}),northArrowSouthWest:(e,t)=>({top:o(e,t),left:e.left+e.width/2-n,name:`arrow_sw`,...a&&{config:a}}),northArrowSouthMiddleWest:(e,t)=>({top:o(e,t),left:e.left+e.width/2-t.width*.25-n,name:`arrow_smw`,...a&&{config:a}}),northArrowSouth:(e,t)=>({top:o(e,t),left:e.left+e.width/2-t.width/2,name:`arrow_s`,...a&&{config:a}}),northArrowSouthMiddleEast:(e,t)=>({top:o(e,t),left:e.left+e.width/2-t.width*.75+n,name:`arrow_sme`,...a&&{config:a}}),northArrowSouthEast:(e,t)=>({top:o(e,t),left:e.left+e.width/2-t.width+n,name:`arrow_se`,...a&&{config:a}}),northEastArrowSouthWest:(e,t)=>({top:o(e,t),left:e.right-n,name:`arrow_sw`,...a&&{config:a}}),northEastArrowSouthMiddleWest:(e,t)=>({top:o(e,t),left:e.right-t.width*.25-n,name:`arrow_smw`,...a&&{config:a}}),northEastArrowSouth:(e,t)=>({top:o(e,t),left:e.right-t.width/2,name:`arrow_s`,...a&&{config:a}}),northEastArrowSouthMiddleEast:(e,t)=>({top:o(e,t),left:e.right-t.width*.75+n,name:`arrow_sme`,...a&&{config:a}}),northEastArrowSouthEast:(e,t)=>({top:o(e,t),left:e.right-t.width+n,name:`arrow_se`,...a&&{config:a}}),southWestArrowNorthWest:e=>({top:s(e),left:e.left-n,name:`arrow_nw`,...a&&{config:a}}),southWestArrowNorthMiddleWest:(e,t)=>({top:s(e),left:e.left-t.width*.25-n,name:`arrow_nmw`,...a&&{config:a}}),southWestArrowNorth:(e,t)=>({top:s(e),left:e.left-t.width/2,name:`arrow_n`,...a&&{config:a}}),southWestArrowNorthMiddleEast:(e,t)=>({top:s(e),left:e.left-t.width*.75+n,name:`arrow_nme`,...a&&{config:a}}),southWestArrowNorthEast:(e,t)=>({top:s(e),left:e.left-t.width+n,name:`arrow_ne`,...a&&{config:a}}),southArrowNorthWest:e=>({top:s(e),left:e.left+e.width/2-n,name:`arrow_nw`,...a&&{config:a}}),southArrowNorthMiddleWest:(e,t)=>({top:s(e),left:e.left+e.width/2-t.width*.25-n,name:`arrow_nmw`,...a&&{config:a}}),southArrowNorth:(e,t)=>({top:s(e),left:e.left+e.width/2-t.width/2,name:`arrow_n`,...a&&{config:a}}),southArrowNorthMiddleEast:(e,t)=>({top:s(e),left:e.left+e.width/2-t.width*.75+n,name:`arrow_nme`,...a&&{config:a}}),southArrowNorthEast:(e,t)=>({top:s(e),left:e.left+e.width/2-t.width+n,name:`arrow_ne`,...a&&{config:a}}),southEastArrowNorthWest:e=>({top:s(e),left:e.right-n,name:`arrow_nw`,...a&&{config:a}}),southEastArrowNorthMiddleWest:(e,t)=>({top:s(e),left:e.right-t.width*.25-n,name:`arrow_nmw`,...a&&{config:a}}),southEastArrowNorth:(e,t)=>({top:s(e),left:e.right-t.width/2,name:`arrow_n`,...a&&{config:a}}),southEastArrowNorthMiddleEast:(e,t)=>({top:s(e),left:e.right-t.width*.75+n,name:`arrow_nme`,...a&&{config:a}}),southEastArrowNorthEast:(e,t)=>({top:s(e),left:e.right-t.width+n,name:`arrow_ne`,...a&&{config:a}}),westArrowEast:(e,t)=>({top:e.top+e.height/2-t.height/2,left:e.left-t.width-r,name:`arrow_e`,...a&&{config:a}}),eastArrowWest:(e,t)=>({top:e.top+e.height/2-t.height/2,left:e.right+r,name:`arrow_w`,...a&&{config:a}}),viewportStickyNorth:(e,t,n)=>{let r=new O(u.document.body).getIntersection(n.getVisible());if(!r)return null;let o=r.getVisible();return!e.getIntersection(o)||!(o.top-e.top-i<t.height&&o.bottom-e.bottom<t.height)?null:{top:o.top+i,left:e.left+e.width/2-t.width/2,name:`arrowless`,config:{withArrow:!1,...a}}}};function o(e,t){return e.top-t.height-r}function s(e){return e.bottom+r}}static arrowSideOffset=25;static arrowHeightOffset=10;static stickyVerticalOffset=20;static _getOptimalPosition=Xr;static defaultPositions=e.generatePositions()};function ob(e){return jn(e)?e:Mr(e)?e.commonAncestorContainer:typeof e==`function`?ob(e()):null}const sb=br();var cb=class extends sb{editor;_balloonView=null;_showBalloonThrottled=qt(()=>this._showBalloon(),50,{leading:!0});_lastFocusedEditableElement=null;_balloonClass;constructor(e,t={}){super(),this.editor=e,this._balloonClass=t.balloonClass,e.on(`ready`,()=>this._handleEditorReady())}destroy(){let e=this._balloonView;e&&(e.unpin(),this._balloonView=null),this._showBalloonThrottled.cancel(),this.stopListening()}_handleEditorReady(){let e=this.editor;this._isEnabled()&&e.ui.view&&(e.ui.focusTracker.on(`change:isFocused`,(e,t,n)=>{this._updateLastFocusedEditableElement(),n?this._showBalloon():this._hideBalloon()}),e.ui.focusTracker.on(`change:focusedElement`,(e,t,n)=>{this._updateLastFocusedEditableElement(),n&&this._showBalloon()}),e.ui.on(`update`,()=>{this._showBalloonThrottled()}))}_getNormalizedConfig(){return{side:this.editor.locale.contentLanguageDirection===`ltr`?`right`:`left`,position:`border`,verticalOffset:0,horizontalOffset:5}}_showBalloon(){let e=this._getBalloonAttachOptions();e&&(this._balloonView||=this._createBalloonView(),this._balloonView.pin(e))}_hideBalloon(){this._balloonView&&this._balloonView.unpin()}_createBalloonView(){let e=this.editor,t=new ab,n=this._createBadgeContent();return t.content.add(n),this._balloonClass&&(t.class=this._balloonClass),e.ui.view.body.add(t),t}_getBalloonAttachOptions(){if(!this._lastFocusedEditableElement)return null;let e=this._getNormalizedConfig(),t=e.side===`right`?lb(this._lastFocusedEditableElement,e):ub(this._lastFocusedEditableElement,e);return{target:this._lastFocusedEditableElement,positions:[t]}}_updateLastFocusedEditableElement(){let e=this.editor,t=e.ui.focusTracker.isFocused,n=e.ui.focusTracker.focusedElement;if(!t||!n){this._lastFocusedEditableElement=null;return}let r=Array.from(e.ui.getEditableElementsNames()).map(t=>e.ui.getEditableElement(t));r.includes(n)?this._lastFocusedEditableElement=n:this._lastFocusedEditableElement=r[0]}};function lb(e,t){return db(e,t,(e,n)=>e.left+e.width-n.width-t.horizontalOffset)}function ub(e,t){return db(e,t,e=>e.left+t.horizontalOffset)}function db(e,t,n){return(r,i)=>{let a=new O(e);if(a.width<350||a.height<50)return null;let o;o=t.position===`inside`?a.bottom-i.height:a.bottom-i.height/2,o-=t.verticalOffset;let s=n(a,i),c=r.clone().moveTo(s,o).getIntersection(i.clone().moveTo(s,o)).getVisible();return!c||c.getArea()<i.getArea()?null:{top:o,left:s,name:`position_${t.position}-side_${t.side}`,config:{withArrow:!1}}}}var fb=class extends cb{constructor(e){super(e,{balloonClass:`ck-powered-by-balloon`})}_isEnabled(){let e=this.editor;if(e.config.get(`ui.poweredBy.forceVisible`))return!0;let t=e.config.get(`licenseKey`);if(t==`GPL`)return!0;let n=Xi(t.split(`.`)[1]);return n?!n.whiteLabel:!0}_createBadgeContent(){return new pb(this.editor.locale,this._getNormalizedConfig().label)}_getNormalizedConfig(){let e=super._getNormalizedConfig(),t=this.editor.config.get(`ui.poweredBy`)||{},n=t.position||e.position,r=n===`inside`?5:e.verticalOffset;return{position:n,side:t.side||e.side,label:t.label===void 0?`Powered by`:t.label,verticalOffset:t.verticalOffset===void 0?r:t.verticalOffset,horizontalOffset:t.horizontalOffset===void 0?e.horizontalOffset:t.horizontalOffset,forceVisible:!!t.forceVisible}}},pb=class extends P{constructor(e,t){super(e);let n=new Ly,r=this.bindTemplate;n.set({content:Kv,isColorInherited:!1}),this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-powered-by`],"aria-hidden":!0},children:[{tag:`a`,attributes:{href:`https://ckeditor.com/powered-by-ckeditor/?utm_source=ckeditor&utm_medium=referral&utm_campaign=701Dn000000hVgmIAE_powered_by_ckeditor_logo`,target:`_blank`,tabindex:`-1`},children:[...t?[{tag:`span`,attributes:{class:[`ck`,`ck-powered-by__label`]},children:[t]}]:[],n],on:{dragstart:r.to(e=>e.preventDefault())}}]})}},mb=class extends H{toggleSwitchView;constructor(e){super(e),this.isToggleable=!0,this.toggleSwitchView=this._createToggleView(),this.extendTemplate({attributes:{class:`ck-switchbutton`}})}render(){super.render(),this.children.add(this.toggleSwitchView)}_createToggleView(){let e=new P;return e.setTemplate({tag:`span`,attributes:{class:[`ck`,`ck-button__toggle`]},children:[{tag:`span`,attributes:{class:[`ck`,`ck-button__toggle__inner`]}}]}),e}};const hb=yb(H),gb=yb($y);var _b=class extends hb{},vb=class extends gb{};function yb(e){class t extends e{_fileInputView;constructor(...e){super(...e),this._fileInputView=new bb(this.locale),this._fileInputView.bind(`acceptedType`).to(this),this._fileInputView.bind(`allowMultipleFiles`).to(this),this._fileInputView.delegate(`done`).to(this),this.on(`execute`,()=>{this._fileInputView.open()}),this.extendTemplate({attributes:{class:`ck-file-dialog-button`}})}render(){super.render(),this.children.add(this._fileInputView)}}return t}var bb=class extends P{constructor(e){super(e),this.set(`acceptedType`,void 0),this.set(`allowMultipleFiles`,!1);let 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()}},xb=class extends P{buttonView;children;constructor(e,t){super(e);let n=this.bindTemplate;this.set(`isCollapsed`,!1),this.set(`label`,``),this.buttonView=this._createButtonView(),this.children=this.createCollection(),this.set(`_collapsibleAriaLabelUid`,void 0),t&&this.children.addMany(t),this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-collapsible`,n.if(`isCollapsed`,`ck-collapsible_collapsed`)]},children:[this.buttonView,{tag:`div`,attributes:{class:[`ck`,`ck-collapsible__children`],role:`region`,hidden:n.if(`isCollapsed`,`hidden`),"aria-labelledby":n.to(`_collapsibleAriaLabelUid`)},children:this.children}]})}render(){super.render(),this._collapsibleAriaLabelUid=this.buttonView.labelView.element.id}focus(){this.buttonView.focus()}_createButtonView(){let e=new H(this.locale),t=e.bindTemplate;return e.set({withText:!0,icon:b_}),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 Sb(e,t){let n=e.t,r={Black:n(`Black`),"Dim grey":n(`Dim grey`),Grey:n(`Grey`),"Light grey":n(`Light grey`),White:n(`White`),Red:n(`Red`),Orange:n(`Orange`),Yellow:n(`Yellow`),"Light green":n(`Light green`),Green:n(`Green`),Aquamarine:n(`Aquamarine`),Turquoise:n(`Turquoise`),"Light blue":n(`Light blue`),Blue:n(`Blue`),Purple:n(`Purple`)};return t.map(e=>{let t=r[e.label];return t&&t!=e.label&&(e.label=t),e})}function Cb(e){return e.map(wb).filter(e=>!!e)}function wb(e){return typeof e==`string`?{model:e,label:e,hasBorder:!1,view:{name:`span`,styles:{color:e}}}:{model:e.color,label:e.label||e.color,hasBorder:e.hasBorder===void 0?!1:e.hasBorder,view:{name:`span`,styles:{color:`${e.color}`}}}}var Tb=class extends H{constructor(e){super(e);let t=this.bindTemplate;this.set(`color`,void 0),this.set(`hasBorder`,!1),this.icon=m_,this.extendTemplate({attributes:{style:{backgroundColor:t.to(`color`,e=>p.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%)`}},Eb=class extends P{columns;items;focusTracker;keystrokes;constructor(e,t){super(e);let n=t&&t.colorDefinitions?t.colorDefinitions:[];this.columns=t?.columns||5;let r={gridTemplateColumns:`repeat( ${this.columns}, 1fr)`};this.set(`selectedColor`,void 0),this.items=this.createCollection(),this.focusTracker=new M,this.keystrokes=new N,this.items.on(`add`,(e,t)=>{t.isOn=t.color===this.selectedColor}),n.forEach(e=>{let t=new Tb;t.set({color:e.color,label:e.label,tooltip:!0,hasBorder:e.options.hasBorder}),t.on(`execute`,()=>{this.fire(`execute`,{value:e.color,hasBorder:e.options.hasBorder,label:e.label})}),this.items.add(t)}),this.setTemplate({tag:`div`,children:this.items,attributes:{class:[`ck`,`ck-color-grid`],style:r}}),this.on(`change:selectedColor`,(e,t,n)=>{for(let e of this.items)e.isOn=e.color===n})}focus(){this.items.length&&this.items.first.focus()}focusLast(){this.items.length&&this.items.last.focus()}render(){super.render();for(let 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),$a({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()}};const Db={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]};for(let e in Db)Object.freeze(Db[e]);var Ob=Object.freeze(Db),kb=jb,Ab={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function jb(e){var t,n=[],r=1,i;if(typeof e==`number`||typeof e==`number`)return{space:`rgb`,values:[e>>>16,(e&65280)>>>8,e&255],alpha:1};if(e=String(e).toLowerCase(),Ob[e])n=Ob[e].slice(),i=`rgb`;else if(e===`transparent`)r=0,i=`rgb`,n=[0,0,0];else if(e[0]===`#`){var a=e.slice(1),o=a.length,s=o<=4;r=1,s?(n=[parseInt(a[0]+a[0],16),parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16)],o===4&&(r=parseInt(a[3]+a[3],16)/255)):(n=[parseInt(a[0]+a[1],16),parseInt(a[2]+a[3],16),parseInt(a[4]+a[5],16)],o===8&&(r=parseInt(a[6]+a[7],16)/255)),n[0]||=0,n[1]||=0,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)){i=t[1].replace(/a$/,``);var c=i===`cmyk`?4:i===`gray`?1:3;n=t[2].trim().split(/\s*[,\/]\s*|\s+/),i===`color`&&(i=n.shift()),n=n.map(function(e,t){if(e[e.length-1]===`%`)return e=parseFloat(e)/100,t===3?e:i===`rgb`?e*255:i[0]===`h`||i[0]===`l`&&!t?e*100:i===`lab`?e*125:i===`lch`?t<2?e*150:e*360:i[0]===`o`&&!t?e:i===`oklab`?e*.4:i===`oklch`?t<2?e*.4:e*360:e;if(i[t]===`h`||t===2&&i[i.length-1]===`h`){if(Ab[e]!==void 0)return Ab[e];if(e.endsWith(`deg`))return parseFloat(e);if(e.endsWith(`turn`))return parseFloat(e)*360;if(e.endsWith(`grad`))return parseFloat(e)*360/400;if(e.endsWith(`rad`))return parseFloat(e)*180/Math.PI}return e===`none`?0:parseFloat(e)}),r=n.length>c?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:r}}const Mb={};for(let e of Object.keys(Ob))Mb[Ob[e]]=e;const W={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`]}},Nb=(6/29)**3;function Pb(e){let t=e>.0031308?1.055*e**(1/2.4)-.055:e*12.92;return Math.min(Math.max(0,t),1)}function Fb(e){return e>.04045?((e+.055)/1.055)**2.4:e/12.92}for(let e of Object.keys(W)){if(!(`channels`in W[e]))throw Error(`missing channels property: `+e);if(!(`labels`in W[e]))throw Error(`missing channel labels property: `+e);if(W[e].labels.length!==W[e].channels)throw Error(`channel and label counts mismatch: `+e);let{channels:t,labels:n}=W[e];delete W[e].channels,delete W[e].labels,Object.defineProperty(W[e],"channels",{value:t}),Object.defineProperty(W[e],"labels",{value:n})}W.rgb.hsl=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=a-i,s,c;switch(a){case i:s=0;break;case t:s=(n-r)/o;break;case n:s=2+(r-t)/o;break;case r:s=4+(t-n)/o;break}s=Math.min(s*60,360),s<0&&(s+=360);let l=(i+a)/2;return c=a===i?0:l<=.5?o/(a+i):o/(2-a-i),[s,c*100,l*100]},W.rgb.hsv=function(e){let t,n,r,i,a,o=e[0]/255,s=e[1]/255,c=e[2]/255,l=Math.max(o,s,c),u=l-Math.min(o,s,c),d=function(e){return(l-e)/6/u+1/2};if(u===0)i=0,a=0;else{switch(a=u/l,t=d(o),n=d(s),r=d(c),l){case o:i=r-n;break;case s:i=1/3+t-r;break;case c:i=2/3+n-t;break}i<0?i+=1:i>1&&--i}return[i*360,a*100,l*100]},W.rgb.hwb=function(e){let t=e[0],n=e[1],r=e[2],i=W.rgb.hsl(e)[0],a=1/255*Math.min(t,Math.min(n,r));return r=1-1/255*Math.max(t,Math.max(n,r)),[i,a*100,r*100]},W.rgb.oklab=function(e){let t=Fb(e[0]/255),n=Fb(e[1]/255),r=Fb(e[2]/255),i=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),a=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),o=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r),s=.2104542553*i+.793617785*a-.0040720468*o,c=1.9779984951*i-2.428592205*a+.4505937099*o,l=.0259040371*i+.7827717662*a-.808675766*o;return[s*100,c*100,l*100]},W.rgb.cmyk=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(1-t,1-n,1-r),a=(1-t-i)/(1-i)||0,o=(1-n-i)/(1-i)||0,s=(1-r-i)/(1-i)||0;return[a*100,o*100,s*100,i*100]};function Ib(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}W.rgb.keyword=function(e){let t=Mb[e];if(t)return t;let n=1/0,r;for(let t of Object.keys(Ob)){let i=Ob[t],a=Ib(e,i);a<n&&(n=a,r=t)}return r},W.keyword.rgb=function(e){return Ob[e]},W.rgb.xyz=function(e){let t=Fb(e[0]/255),n=Fb(e[1]/255),r=Fb(e[2]/255),i=t*.4124564+n*.3575761+r*.1804375,a=t*.2126729+n*.7151522+r*.072175,o=t*.0193339+n*.119192+r*.9503041;return[i*100,a*100,o*100]},W.rgb.lab=function(e){let t=W.rgb.xyz(e),n=t[0],r=t[1],i=t[2];return n/=95.047,r/=100,i/=108.883,n=n>Nb?n**(1/3):7.787*n+16/116,r=r>Nb?r**(1/3):7.787*r+16/116,i=i>Nb?i**(1/3):7.787*i+16/116,[116*r-16,500*(n-r),200*(r-i)]},W.hsl.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100,i,a;if(n===0)return a=r*255,[a,a,a];let o=r<.5?r*(1+n):r+n-r*n,s=2*r-o,c=[0,0,0];for(let e=0;e<3;e++)i=t+1/3*-(e-1),i<0&&i++,i>1&&i--,a=6*i<1?s+(o-s)*6*i:2*i<1?o:3*i<2?s+(o-s)*(2/3-i)*6:s,c[e]=a*255;return c},W.hsl.hsv=function(e){let t=e[0],n=e[1]/100,r=e[2]/100,i=n,a=Math.max(r,.01);r*=2,n*=r<=1?r:2-r,i*=a<=1?a:2-a;let o=(r+n)/2;return[t,(r===0?2*i/(a+i):2*n/(r+n))*100,o*100]},W.hsv.rgb=function(e){let t=e[0]/60,n=e[1]/100,r=e[2]/100,i=Math.floor(t)%6,a=t-Math.floor(t),o=255*r*(1-n),s=255*r*(1-n*a),c=255*r*(1-n*(1-a));switch(r*=255,i){case 0:return[r,c,o];case 1:return[s,r,o];case 2:return[o,r,c];case 3:return[o,s,r];case 4:return[c,o,r];case 5:return[r,o,s]}},W.hsv.hsl=function(e){let t=e[0],n=e[1]/100,r=e[2]/100,i=Math.max(r,.01),a,o;o=(2-n)*r;let s=(2-n)*i;return a=n*i,a/=s<=1?s:2-s,a||=0,o/=2,[t,a*100,o*100]},W.hwb.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100,i=n+r,a;i>1&&(n/=i,r/=i);let o=Math.floor(6*t),s=1-r;a=6*t-o,o&1&&(a=1-a);let c=n+a*(s-n),l,u,d;switch(o){default:case 6:case 0:l=s,u=c,d=n;break;case 1:l=c,u=s,d=n;break;case 2:l=n,u=s,d=c;break;case 3:l=n,u=c,d=s;break;case 4:l=c,u=n,d=s;break;case 5:l=s,u=n,d=c;break}return[l*255,u*255,d*255]},W.cmyk.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=e[3]/100,a=1-Math.min(1,t*(1-i)+i),o=1-Math.min(1,n*(1-i)+i),s=1-Math.min(1,r*(1-i)+i);return[a*255,o*255,s*255]},W.xyz.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i,a,o;return i=t*3.2404542+n*-1.5371385+r*-.4985314,a=t*-.969266+n*1.8760108+r*.041556,o=t*.0556434+n*-.2040259+r*1.0572252,i=Pb(i),a=Pb(a),o=Pb(o),[i*255,a*255,o*255]},W.xyz.lab=function(e){let t=e[0],n=e[1],r=e[2];return t/=95.047,n/=100,r/=108.883,t=t>Nb?t**(1/3):7.787*t+16/116,n=n>Nb?n**(1/3):7.787*n+16/116,r=r>Nb?r**(1/3):7.787*r+16/116,[116*n-16,500*(t-n),200*(n-r)]},W.xyz.oklab=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=Math.cbrt(.8189330101*t+.3618667424*n-.1288597137*r),a=Math.cbrt(.0329845436*t+.9293118715*n+.0361456387*r),o=Math.cbrt(.0482003018*t+.2643662691*n+.633851707*r),s=.2104542553*i+.793617785*a-.0040720468*o,c=1.9779984951*i-2.428592205*a+.4505937099*o,l=.0259040371*i+.7827717662*a-.808675766*o;return[s*100,c*100,l*100]},W.oklab.oklch=function(e){return W.lab.lch(e)},W.oklab.xyz=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=(.999999998*t+.396337792*n+.215803758*r)**3,a=(1.000000008*t-.105561342*n-.063854175*r)**3,o=(1.000000055*t-.089484182*n-1.291485538*r)**3,s=1.227013851*i-.55779998*a+.281256149*o,c=-.040580178*i+1.11225687*a-.071676679*o,l=-.076381285*i-.421481978*a+1.58616322*o;return[s*100,c*100,l*100]},W.oklab.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=(t+.3963377774*n+.2158037573*r)**3,a=(t-.1055613458*n-.0638541728*r)**3,o=(t-.0894841775*n-1.291485548*r)**3,s=Pb(4.0767416621*i-3.3077115913*a+.2309699292*o),c=Pb(-1.2684380046*i+2.6097574011*a-.3413193965*o),l=Pb(-.0041960863*i-.7034186147*a+1.707614701*o);return[s*255,c*255,l*255]},W.oklch.oklab=function(e){return W.lch.lab(e)},W.lab.xyz=function(e){let t=e[0],n=e[1],r=e[2],i,a,o;a=(t+16)/116,i=n/500+a,o=a-r/200;let s=a**3,c=i**3,l=o**3;return a=s>Nb?s:(a-16/116)/7.787,i=c>Nb?c:(i-16/116)/7.787,o=l>Nb?l:(o-16/116)/7.787,i*=95.047,a*=100,o*=108.883,[i,a,o]},W.lab.lch=function(e){let t=e[0],n=e[1],r=e[2],i;return i=Math.atan2(r,n)*360/2/Math.PI,i<0&&(i+=360),[t,Math.sqrt(n*n+r*r),i]},W.lch.lab=function(e){let t=e[0],n=e[1],r=e[2]/360*2*Math.PI;return[t,n*Math.cos(r),n*Math.sin(r)]},W.rgb.ansi16=function(e,t=null){let[n,r,i]=e,a=t===null?W.rgb.hsv(e)[2]:t;if(a=Math.round(a/50),a===0)return 30;let o=30+(Math.round(i/255)<<2|Math.round(r/255)<<1|Math.round(n/255));return a===2&&(o+=60),o},W.hsv.ansi16=function(e){return W.rgb.ansi16(W.hsv.rgb(e),e[2])},W.rgb.ansi256=function(e){let t=e[0],n=e[1],r=e[2];return t>>4==n>>4&&n>>4==r>>4?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)},W.ansi16.rgb=function(e){e=e[0];let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];let n=(Math.trunc(e>50)+1)*.5;return[(t&1)*n*255,(t>>1&1)*n*255,(t>>2&1)*n*255]},W.ansi256.rgb=function(e){if(e=e[0],e>=232){let t=(e-232)*10+8;return[t,t,t]}e-=16;let t;return[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},W.rgb.hex=function(e){let t=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return`000000`.slice(t.length)+t},W.hex.rgb=function(e){let t=e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!t)return[0,0,0];let n=t[0];t[0].length===3&&(n=[...n].map(e=>e+e).join(``));let r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},W.rgb.hcg=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.max(Math.max(t,n),r),a=Math.min(Math.min(t,n),r),o=i-a,s,c=o<1?a/(1-o):0;return s=o<=0?0:i===t?(n-r)/o%6:i===n?2+(r-t)/o:4+(t-n)/o,s/=6,s%=1,[s*360,o*100,c*100]},W.hsl.hcg=function(e){let t=e[1]/100,n=e[2]/100,r=n<.5?2*t*n:2*t*(1-n),i=0;return r<1&&(i=(n-.5*r)/(1-r)),[e[0],r*100,i*100]},W.hsv.hcg=function(e){let t=e[1]/100,n=e[2]/100,r=t*n,i=0;return r<1&&(i=(n-r)/(1-r)),[e[0],r*100,i*100]},W.hcg.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100;if(n===0)return[r*255,r*255,r*255];let i=[0,0,0],a=t%1*6,o=a%1,s=1-o,c=0;switch(Math.floor(a)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=s,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=s,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=s}return c=(1-n)*r,[(n*i[0]+c)*255,(n*i[1]+c)*255,(n*i[2]+c)*255]},W.hcg.hsv=function(e){let t=e[1]/100,n=t+e[2]/100*(1-t),r=0;return n>0&&(r=t/n),[e[0],r*100,n*100]},W.hcg.hsl=function(e){let t=e[1]/100,n=e[2]/100*(1-t)+.5*t,r=0;return n>0&&n<.5?r=t/(2*n):n>=.5&&n<1&&(r=t/(2*(1-n))),[e[0],r*100,n*100]},W.hcg.hwb=function(e){let t=e[1]/100,n=t+e[2]/100*(1-t);return[e[0],(n-t)*100,(1-n)*100]},W.hwb.hcg=function(e){let t=e[1]/100,n=1-e[2]/100,r=n-t,i=0;return r<1&&(i=(n-r)/(1-r)),[e[0],r*100,i*100]},W.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},W.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},W.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},W.gray.hsl=function(e){return[0,0,e[0]]},W.gray.hsv=W.gray.hsl,W.gray.hwb=function(e){return[0,100,e[0]]},W.gray.cmyk=function(e){return[0,0,0,e[0]]},W.gray.lab=function(e){return[e[0],0,0]},W.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return`000000`.slice(n.length)+n},W.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function Lb(){let e={},t=Object.keys(W);for(let{length:n}=t,r=0;r<n;r++)e[t[r]]={distance:-1,parent:null};return e}function Rb(e){let t=Lb(),n=[e];for(t[e].distance=0;n.length>0;){let e=n.pop(),r=Object.keys(W[e]);for(let{length:i}=r,a=0;a<i;a++){let i=r[a],o=t[i];o.distance===-1&&(o.distance=t[e].distance+1,o.parent=e,n.unshift(i))}}return t}function zb(e,t){return function(n){return t(e(n))}}function Bb(e,t){let n=[t[e].parent,e],r=W[t[e].parent][e],i=t[e].parent;for(;t[i].parent;)n.unshift(t[i].parent),r=zb(W[t[i].parent][i],r),i=t[i].parent;return r.conversion=n,r}function Vb(e){let t=Rb(e),n={},r=Object.keys(t);for(let{length:e}=r,i=0;i<e;i++){let e=r[i];t[e].parent!==null&&(n[e]=Bb(e,t))}return n}const Hb={},Ub=Object.keys(W);function Wb(e){let t=function(...t){let n=t[0];return n==null?n:(n.length>1&&(t=n),e(t))};return`conversion`in e&&(t.conversion=e.conversion),t}function Gb(e){let t=function(...t){let n=t[0];if(n==null)return n;n.length>1&&(t=n);let r=e(t);if(typeof r==`object`)for(let{length:e}=r,t=0;t<e;t++)r[t]=Math.round(r[t]);return r};return`conversion`in e&&(t.conversion=e.conversion),t}for(let e of Ub){Hb[e]={},Object.defineProperty(Hb[e],"channels",{value:W[e].channels}),Object.defineProperty(Hb[e],"labels",{value:W[e].labels});let t=Vb(e),n=Object.keys(t);for(let r of n){let n=t[r];Hb[e][r]=Gb(n),Hb[e][r].raw=Wb(n)}}function Kb(e,t){if(!e)return``;let n=Xb(e);if(!n)return``;if(n.space===t)return e;if(!Zb(n))return``;let r=Hb[n.space][t];return r?Yb(r(n.space===`hex`?n.hexValue:n.values),t):``}function qb(e){if(!e)return``;let t=Xb(e);return t?t.space===`hex`?t.hexValue:Kb(e,`hex`):`#000`}function Jb(e,t){customElements.get(e)===void 0&&customElements.define(e,t)}function Yb(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``}}function Xb(e){if(e.startsWith(`#`)){let t=kb(e);return{space:`hex`,values:t.values,hexValue:e,alpha:t.alpha}}let t=kb(e);return t.space?t:null}function Zb(e){return Object.keys(Hb).includes(e.space)}var Qb=class extends P{fieldView;labelView;statusView;fieldWrapperChildren;constructor(e,t){super(e);let n=`ck-labeled-field-view-${he()}`,r=`ck-labeled-field-view-status-${he()}`;this.fieldView=t(this,n,r),this.set(`label`,void 0),this.set(`isEnabled`,!0),this.set(`isEmpty`,!0),this.set(`isFocused`,!1),this.set(`errorText`,null),this.set(`infoText`,null),this.set(`class`,void 0),this.set(`placeholder`,void 0),this.labelView=this._createLabelView(n),this.statusView=this._createStatusView(r),this.fieldWrapperChildren=this.createCollection([this.fieldView,this.labelView]),this.bind(`_statusText`).to(this,`errorText`,this,`infoText`,(e,t)=>e||t);let i=this.bindTemplate;this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-labeled-field-view`,i.to(`class`),i.if(`isEnabled`,`ck-disabled`,e=>!e),i.if(`isEmpty`,`ck-labeled-field-view_empty`),i.if(`isFocused`,`ck-labeled-field-view_focused`),i.if(`placeholder`,`ck-labeled-field-view_placeholder`),i.if(`errorText`,`ck-error`)]},children:[{tag:`div`,attributes:{class:[`ck`,`ck-labeled-field-view__input-wrapper`]},children:this.fieldWrapperChildren},this.statusView]})}_createLabelView(e){let t=new eo(this.locale);return t.for=e,t.bind(`text`).to(this,`label`),t}_createStatusView(e){let t=new P(this.locale),n=this.bindTemplate;return t.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-labeled-field-view__status`,n.if(`errorText`,`ck-labeled-field-view__status_error`),n.if(`_statusText`,`ck-hidden`,e=>!e)],id:e,role:n.if(`errorText`,`alert`)},children:[{text:n.to(`_statusText`)}]}),t}focus(e){this.fieldView.focus(e)}},$b=class extends P{focusTracker;constructor(e){super(e),this.set(`value`,void 0),this.set(`id`,void 0),this.set(`placeholder`,void 0),this.set(`tabIndex`,void 0),this.set(`isReadOnly`,!1),this.set(`hasError`,!1),this.set(`ariaDescribedById`,void 0),this.set(`ariaLabel`,void 0),this.focusTracker=new M,this.bind(`isFocused`).to(this.focusTracker),this.set(`isEmpty`,!0);let t=this.bindTemplate;this.setTemplate({tag:`input`,attributes:{class:[`ck`,`ck-input`,t.if(`isFocused`,`ck-input_focused`),t.if(`isEmpty`,`ck-input-text_empty`),t.if(`hasError`,`ck-error`)],id:t.to(`id`),placeholder:t.to(`placeholder`),tabindex:t.to(`tabIndex`),readonly:t.to(`isReadOnly`),"aria-invalid":t.if(`hasError`,!0),"aria-describedby":t.to(`ariaDescribedById`),"aria-label":t.to(`ariaLabel`)},on:{input:t.to((...e)=>{this.fire(`input`,...e),this._updateIsEmpty()}),change:t.to(this._updateIsEmpty.bind(this))}})}render(){super.render(),this.focusTracker.add(this.element),this._setDomElementValue(this.value),this._updateIsEmpty(),this.on(`change:value`,(e,t,n)=>{this._setDomElementValue(n),this._updateIsEmpty()})}destroy(){super.destroy(),this.focusTracker.destroy()}select(){this.element.select()}focus(){this.element.focus()}reset(){this.value=this.element.value=``,this._updateIsEmpty()}_updateIsEmpty(){this.isEmpty=ex(this.element)}_setDomElementValue(e){this.element.value=!e&&e!==0?``:e}};function ex(e){return!e.value}var tx=class extends $b{constructor(e){super(e),this.set(`inputMode`,`text`);let t=this.bindTemplate;this.extendTemplate({attributes:{inputmode:t.to(`inputMode`)}})}},nx=class extends tx{constructor(e){super(e),this.extendTemplate({attributes:{type:`text`,class:[`ck-input-text`]}})}},rx=class extends tx{constructor(e,{min:t,max:n,step:r}={}){super(e);let i=this.bindTemplate;this.set(`min`,t),this.set(`max`,n),this.set(`step`,r),this.extendTemplate({attributes:{type:`number`,class:[`ck-input-number`],min:i.to(`min`),max:i.to(`max`),step:i.to(`step`)}})}},ix=class extends $b{_resizeObserver;_isUpdateAutoGrowHeightPending=!1;constructor(e){super(e);let t=Wr(`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));let n=this.bindTemplate;this.template.tag=`textarea`,this.extendTemplate({attributes:{class:[`ck-textarea`],style:{height:n.to(`_height`,e=>e?t(e):null),resize:n.to(`resize`)},rows:n.to(`minRows`)}})}render(){super.render();let e=!1;this.on(`input`,()=>{this._updateAutoGrowHeight(!0),this.fire(`update`)}),this.on(`change:value`,()=>{u.window.requestAnimationFrame(()=>{if(!Yr(this.element)){this._isUpdateAutoGrowHeightPending=!0;return}this._updateAutoGrowHeight(),this.fire(`update`)})}),this._resizeObserver=new Hr(this.element,t=>{let n=!!t.contentRect.width&&!!t.contentRect.height;!e&&n&&this._isUpdateAutoGrowHeightPending&&u.window.requestAnimationFrame(()=>{this._updateAutoGrowHeight(),this.fire(`update`)}),e=n})}destroy(){this._resizeObserver&&this._resizeObserver.destroy()}reset(){super.reset(),this._updateAutoGrowHeight(),this.fire(`update`)}_updateAutoGrowHeight(e){let t=this.element;if(!t.offsetParent){this._isUpdateAutoGrowHeightPending=!0;return}this._isUpdateAutoGrowHeightPending=!1;let n=ax(t,`1`),r=ax(t,t.value),i=n.ownerDocument.defaultView.getComputedStyle(n),a=parseFloat(i.paddingTop)+parseFloat(i.paddingBottom),o=Dr(n),s=parseFloat(i.lineHeight),c=o.top+o.bottom,l=new O(n).height,u=Math.round((r.scrollHeight-a)/s),d=this.maxRows*s+a+c,f=u===1?l:this.minRows*s+a+c;this._height=Math.min(Math.max(Math.max(u,this.minRows)*s+a+c,f),d),e&&(t.scrollTop=t.scrollHeight),n.remove(),r.remove()}_validateMinMaxRows(){if(this.minRows>this.maxRows)throw new w(`ui-textarea-view-min-rows-greater-than-max-rows`,{textareaView:this,minRows:this.minRows,maxRows:this.maxRows})}};function ax(e,t){let n=e.cloneNode();return n.style.position=`absolute`,n.style.top=`-99999px`,n.style.left=`-99999px`,n.style.height=`auto`,n.style.overflow=`hidden`,n.style.width=e.ownerDocument.defaultView.getComputedStyle(e).width,n.tabIndex=-1,n.rows=1,n.value=t,e.parentNode.insertBefore(n,e),n}var ox=class extends P{children;constructor(e){super(e);let t=this.bindTemplate;this.set(`isVisible`,!1),this.set(`position`,`se`),this.children=this.createCollection(),this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-reset`,`ck-dropdown__panel`,t.to(`position`,e=>`ck-dropdown__panel_${e}`),t.if(`isVisible`,`ck-dropdown__panel-visible`)],tabindex:`-1`},children:this.children,on:{selectstart:t.to(e=>{let t=e.target;t instanceof Element&&t.tagName.toLocaleLowerCase()===`input`||e.preventDefault()})}})}focus(){if(this.children.length){let e=this.children.first;typeof e.focus==`function`?e.focus():T(`ui-dropdown-panel-focus-child-missing-focus`,{childView:this.children.first,dropdownPanel:this})}}focusLast(){if(this.children.length){let e=this.children.last;typeof e.focusLast==`function`?e.focusLast():e.focus()}}},sx=class e extends P{buttonView;panelView;focusTracker;keystrokes;listView;toolbarView;menuView;constructor(e,t,n){super(e);let r=this.bindTemplate;this.buttonView=t,this.panelView=n,this.set(`isOpen`,!1),this.set(`isEnabled`,!0),this.set(`class`,void 0),this.set(`id`,void 0),this.set(`panelPosition`,`auto`),this.panelView.bind(`isVisible`).to(this,`isOpen`),this.keystrokes=new N,this.focusTracker=new M,this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-dropdown`,r.to(`class`),r.if(`isEnabled`,`ck-disabled`,e=>!e)],id:r.to(`id`),"aria-describedby":r.to(`ariaDescribedById`)},children:[t,n]}),t.extendTemplate({attributes:{class:[`ck-dropdown__button`],"data-cke-tooltip-disabled":r.to(`isOpen`)}})}render(){super.render(),this.focusTracker.add(this.buttonView.element),this.focusTracker.add(this.panelView.element),this.listenTo(this.buttonView,`open`,()=>{this.isOpen=!this.isOpen}),this.on(`change:isOpen`,(t,n,r)=>{if(r)if(this.panelPosition===`auto`){let t=e._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions});this.panelView.position=t?t.name:this._defaultPanelPositionName}else this.panelView.position=this.panelPosition}),this.keystrokes.listenTo(this.element);let t=(e,t)=>{this.isOpen&&(this.isOpen=!1,t())};this.keystrokes.set(`arrowdown`,(e,t)=>{this.buttonView.isEnabled&&!this.isOpen&&(this.isOpen=!0,t())}),this.keystrokes.set(`arrowright`,(e,t)=>{this.isOpen&&t()}),this.keystrokes.set(`arrowleft`,t),this.keystrokes.set(`esc`,t)}focus(){this.buttonView.focus()}get _panelPositions(){let{south:t,north:n,southEast:r,southWest:i,northEast:a,northWest:o,southMiddleEast:s,southMiddleWest:c,northMiddleEast:l,northMiddleWest:u}=e.defaultPanelPositions;return this.locale.uiLanguageDirection===`rtl`?[i,r,c,s,t,o,a,u,l,n]:[r,i,s,c,t,a,o,l,u,n]}get _defaultPanelPositionName(){return this.locale.uiLanguageDirection===`rtl`?`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-(t.width-e.width)*3/4,name:`smw`}),north:(e,t)=>({top:e.top-t.height,left:e.left-(t.width-e.width)/2,name:`n`}),northEast:(e,t)=>({top:e.top-t.height,left:e.left,name:`ne`}),northWest:(e,t)=>({top:e.top-t.height,left:e.left-t.width+e.width,name:`nw`}),northMiddleEast:(e,t)=>({top:e.top-t.height,left:e.left-(t.width-e.width)/4,name:`nme`}),northMiddleWest:(e,t)=>({top:e.top-t.height,left:e.left-(t.width-e.width)*3/4,name:`nmw`})};static _getOptimalPosition=Xr},cx=class extends H{arrowView;constructor(e){super(e),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{"aria-haspopup":!0,"aria-expanded":this.bindTemplate.to(`isOn`,e=>String(e))}}),this.delegate(`execute`).to(this,`open`)}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){let e=new Ly;return e.content=b_,e.extendTemplate({attributes:{class:`ck-dropdown__arrow`}}),e}},lx=class extends H{id;constructor(e,t,n){super(e),this.id=t,this.set({withText:!0,withKeystroke:!0,tooltip:!1,role:`menuitem`,label:n}),this.extendTemplate({attributes:{class:[`ck-dropdown-menu-list__nested-menu__item__button`]}})}},ux=class extends $y{arrowView;constructor(e){super(e);let t=this.bindTemplate;this.set({withText:!0,role:`menuitem`}),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{class:[`ck-dropdown-menu-list__nested-menu__button`],"aria-haspopup":!0,"aria-expanded":this.bindTemplate.to(`isOn`,e=>String(e)),"data-cke-tooltip-disabled":t.to(`isOn`)},on:{mouseenter:t.to(`mouseenter`)}})}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){let e=new Ly;return e.content=b_,e.extendTemplate({attributes:{class:`ck-dropdown-menu-list__nested-menu__button__arrow`}}),e}},dx=class extends P{children;constructor(e){super(e);let t=this.bindTemplate;this.set(`isVisible`,!0),this.children=this.createCollection(),this.setTemplate({tag:`li`,attributes:{class:[`ck`,`ck-list__item`,t.if(`isVisible`,`ck-hidden`,e=>!e)],role:`presentation`},children:this.children})}focus(){this.children.first&&this.children.first.focus()}},fx=class extends P{constructor(e){super(e),this.setTemplate({tag:`li`,attributes:{class:[`ck`,`ck-list__separator`]}})}},px=class extends P{labelView;items;children;constructor(e,t=new eo){super(e);let n=this.bindTemplate,r=new mx(e);this.set({label:``,isVisible:!0}),this.labelView=t,this.labelView.bind(`text`).to(this,`label`),this.children=this.createCollection(),this.children.addMany([this.labelView,r]),r.set({role:`group`,ariaLabelledBy:t.id}),r.focusTracker.destroy(),r.keystrokes.destroy(),this.items=r.items,this.setTemplate({tag:`li`,attributes:{role:`presentation`,class:[`ck`,`ck-list__group`,n.if(`isVisible`,`ck-hidden`,e=>!e)]},children:this.children})}focus(){if(this.items){let e=this.items.find(e=>!(e instanceof fx));e&&e.focus()}}},mx=class extends P{focusables;items;focusTracker;keystrokes;_focusCycler;_listItemGroupToChangeListeners=new WeakMap;constructor(e){super(e);let t=this.bindTemplate;this.focusables=new pa,this.items=this.createCollection(),this.focusTracker=new M,this.keystrokes=new N,this._focusCycler=new Hy({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(let e of this.items)e instanceof px?this._registerFocusableItemsGroup(e):e instanceof dx&&this._registerFocusableListItem(e);this.items.on(`change`,(e,t)=>{for(let e of t.removed)e instanceof px?this._deregisterFocusableItemsGroup(e):e instanceof dx&&this._deregisterFocusableListItem(e);for(let e of Array.from(t.added).reverse())e instanceof px?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,n)=>{for(let e of n.removed)this._deregisterFocusableListItem(e);for(let t of Array.from(n.added).reverse())this._registerFocusableListItem(t,this.items.getIndex(e)+n.index)}}_registerFocusableItemsGroup(e,t){Array.from(e.items).forEach((e,n)=>{let r=t===void 0?void 0:t+n;this._registerFocusableListItem(e,r)});let n=this._getOnGroupItemsChangeCallback(e);this._listItemGroupToChangeListeners.set(e,n),e.items.on(`change`,n)}_deregisterFocusableItemsGroup(e){for(let t of e.items)this._deregisterFocusableListItem(t);e.items.off(`change`,this._listItemGroupToChangeListeners.get(e)),this._listItemGroupToChangeListeners.delete(e)}},hx=class extends mx{constructor(e){super(e);let t=this.bindTemplate;this.role=`menu`,this.set(`isVisible`,!0),this.extendTemplate({attributes:{class:[`ck-dropdown-menu-list`,t.if(`isVisible`,`ck-hidden`,e=>!e)]}})}};const gx={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`})};var _x=class extends dx{childView;constructor(e,t,n){super(e);let r=this.bindTemplate;this.childView=n,this.children.add(n),this.extendTemplate({attributes:{class:[`ck-dropdown-menu-list__nested-menu__item`]},on:{mouseenter:r.to(`mouseenter`)}}),t&&(this.delegate(`mouseenter`).to(t),n instanceof lx&&n.delegate(`execute`).to(t))}};const vx={toggleMenusAndFocusItemsOnHover(e){e.on(`menu:mouseenter`,t=>{let[n]=t.path;t.source.focus();for(let r of e.menus){let e=n instanceof _x&&n.childView===r;r.isOpen=(t.path.includes(r)||e)&&r.isEnabled}})},closeMenuWhenAnotherOnTheSameLevelOpens(e){e.on(`menu:change:isOpen`,(t,n,r)=>{if(!r)return;let i=t.source;for(let t of e.menus)i.parentMenuView===t.parentMenuView&&i!==t&&(t.isOpen=!1)})}},yx={openOnArrowRightKey(e){let t=e.locale.uiLanguageDirection===`rtl`?`arrowleft`:`arrowright`;e.keystrokes.set(t,(t,n)=>{e.focusTracker.focusedElement!==e.buttonView.element||!e.isEnabled||(e.isOpen||=!0,e.panelView.focus(),n())})},openOnButtonClick(e){e.buttonView.on(`execute`,()=>{e.isEnabled&&(e.isOpen=!0)})},openAndFocusOnEnterKeyPress(e){e.keystrokes.set(`enter`,(t,n)=>{e.focusTracker.focusedElement===e.buttonView.element&&(e.isOpen=!0,e.panelView.focus(),n())})},closeOnArrowLeftKey(e){let t=e.locale.uiLanguageDirection===`rtl`?`arrowright`:`arrowleft`;e.keystrokes.set(t,(t,n)=>{e.isOpen&&(e.focus(),e.isOpen=!1,n())})},closeOnEscKey(e){e.keystrokes.set(`esc`,(t,n)=>{e.isOpen&&(e.focus(),e.isOpen=!1,n())})},closeOnParentClose(e,t){t.on(`change:isOpen`,(n,r,i)=>{!i&&n.source===t&&(e.isOpen=!1)})}};var bx=class extends ab{constructor(e){super(e);let t=this.bindTemplate;this.set({isVisible:!1,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=>{e.target.tagName.toLocaleLowerCase()!==`input`&&e.preventDefault()})}})}focus(e=1){let{content:t}=this;t.length&&(e===1?t.first.focus():t.last.focus())}},xx=class e extends P{static DELEGATED_EVENTS=[`mouseenter`,`execute`,`change:isOpen`];id;buttonView;panelView;listView;focusTracker;keystrokes;_bodyCollection;constructor(e,t,n,r,i){super(e),this._bodyCollection=t,this.id=n,this.set({isOpen:!1,isEnabled:!0,panelPosition:`w`,class:void 0,parentMenuView:null}),this.keystrokes=new N,this.focusTracker=new M,this.buttonView=new ux(e),this.buttonView.delegate(`mouseenter`).to(this),this.buttonView.bind(`isOn`,`isEnabled`).to(this,`isOpen`,`isEnabled`),this.buttonView.label=r,this.panelView=new bx(e),this.panelView.isVisible=!0,this.listView=new hx(e),this.listView.bind(`ariaLabel`).to(this.buttonView,`label`),this.panelView.content.add(this.listView);let a=this.bindTemplate;this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-dropdown-menu-list__nested-menu`,a.to(`class`),a.if(`isEnabled`,`ck-disabled`,e=>!e)],role:`presentation`},children:[this.buttonView]}),this.parentMenuView=i,this.parentMenuView&&this._handleParentMenuView(),this._attachBehaviors()}get _panelPositions(){let{westSouth:e,eastSouth:t,westNorth:n,eastNorth:r}=gx;return this.locale.uiLanguageDirection===`ltr`?[t,r,e,n]:[e,n,t,r]}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(...e.DELEGATED_EVENTS).to(this.parentMenuView),yx.closeOnParentClose(this,this.parentMenuView)}_attachBehaviors(){yx.openOnButtonClick(this),yx.openAndFocusOnEnterKeyPress(this),yx.openOnArrowRightKey(this),yx.closeOnEscKey(this),yx.closeOnArrowLeftKey(this)}_mountPanelOnOpen(){let{panelView:e}=this;this.on(`change:isOpen`,(t,n,r)=>{if(t.source===this){if(!r&&this._bodyCollection.has(e)){this._removePanelFromBody();return}r&&!this._bodyCollection.has(e)&&this._addPanelToBody()}})}_removePanelFromBody(){let{panelView:e,keystrokes:t}=this;this._bodyCollection.has(e)&&(this._bodyCollection.remove(e),t.stopListening(e.element))}_addPanelToBody(){let{panelView:e,buttonView:t,keystrokes:n}=this;this._bodyCollection.has(e)||(this._bodyCollection.add(e),n.listenTo(e.element),e.pin({positions:this._panelPositions,limiter:u.document.body,element:e.element,target:t.element,fitInViewport:!0}))}},Sx=class extends hx{_definition;_cachedMenus=[];_cachedButtons=[];_bodyCollection;constructor(e,t,n){super(e),this._bodyCollection=t,this._definition=n,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(),vx.toggleMenusAndFocusItemsOnHover(this),vx.closeMenuWhenAnotherOnTheSameLevelOpens(this)}closeMenus(){this.menus.forEach(e=>{e.isOpen=!1})}_createStructure(e,t){let n=[];for(let r of e){let e;`menu`in r?(e=new xx(this.locale,this._bodyCollection,r.id,r.menu,t),e.panelView.bind(`class`).to(this,`menuPanelClass`),t||e.delegate(...xx.DELEGATED_EVENTS).to(this,e=>`menu:${e}`),this._cachedMenus.push(e),this._createStructure(r.children,e)):(e=new lx(this.locale,r.id,r.label),t||e.delegate(`execute`).to(this,`menu:execute`),this._cachedButtons.push(e));let i=new _x(this.locale,t,e);t||i.delegate(`mouseenter`).to(this,`menu:mouseenter`),n.push(i)}(t?t.listView:this).items.addMany(n)}},Cx=class extends P{constructor(e){super(e),this.setTemplate({tag:`span`,attributes:{class:[`ck`,`ck-toolbar__separator`]}})}},wx=class extends P{constructor(e){super(e),this.setTemplate({tag:`span`,attributes:{class:[`ck`,`ck-toolbar__line-break`]}})}};function Tx(e){return e.bindTemplate.to(t=>{t.target===e.element&&t.preventDefault()})}function Ex(e){if(Array.isArray(e))return{items:e,removeItems:[]};let t={items:[],removeItems:[]};return e?{...t,...e}:t}const Dx={alignLeft:Gg,bold:Zg,importExport:U_,paragraph:Lv,plus:Hv,text:wy,threeVerticalDots:Ty,pilcrow:Bv,dragIndicator:y_};var Ox=class extends P{options;items;focusTracker;keystrokes;itemsView;children;focusables;_focusCycler;_behavior;constructor(e,t){super(e);let n=this.bindTemplate,r=this.t;this.options=t||{},this.set(`ariaLabel`,r(`Editor toolbar`)),this.set(`maxWidth`,`auto`),this.set(`role`,`toolbar`),this.set(`isGrouping`,!!this.options.shouldGroupWhenFull),this.items=this.createCollection(),this.focusTracker=new M,this.keystrokes=new N,this.set(`class`,void 0),this.set(`isCompact`,!1),this.set(`isVertical`,!1),this.itemsView=new kx(e),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection();let i=e.uiLanguageDirection===`rtl`;this._focusCycler=new Hy({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:[i?`arrowright`:`arrowleft`,`arrowup`],focusNext:[i?`arrowleft`:`arrowright`,`arrowdown`]}});let a=[`ck`,`ck-toolbar`,n.to(`class`),n.if(`isCompact`,`ck-toolbar_compact`),n.if(`isGrouping`,`ck-toolbar_grouping`),n.if(`isVertical`,`ck-toolbar_vertical`)];this.options.shouldGroupWhenFull&&this.options.isFloating&&a.push(`ck-toolbar_floating`),this.setTemplate({tag:`div`,attributes:{class:a,role:n.to(`role`),"aria-label":n.to(`ariaLabel`),style:{maxWidth:n.to(`maxWidth`)},tabindex:-1},children:this.children,on:{mousedown:Tx(this)}}),this._behavior=this.options.shouldGroupWhenFull?new jx(this):new Ax(this)}render(){super.render(),this.focusTracker.add(this.element);for(let e of this.items)this.focusTracker.add(e);this.items.on(`add`,(e,t)=>{this.focusTracker.add(t)}),this.items.on(`remove`,(e,t)=>{this.focusTracker.remove(t)}),this.keystrokes.listenTo(this.element),this._behavior.render(this)}destroy(){return this._behavior.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy(),super.destroy()}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}fillFromConfig(e,t,n){this.items.addMany(this._buildItemsFromConfig(e,t,n))}switchBehavior(e){this._behavior.type!==e&&(this._behavior.destroy(),this.itemsView.children.clear(),this.focusables.clear(),e===`dynamic`?(this._behavior=new jx(this),this._behavior.render(this),this._behavior.refreshItems()):(this._behavior=new Ax(this),this._behavior.render(this)))}_buildItemsFromConfig(e,t,n){let r=Ex(e),i=n||r.removeItems;return this._cleanItemsConfiguration(r.items,t,i).map(e=>Xe(e)?this._createNestedToolbarDropdown(e,t,i):e===`|`?new Cx:e===`-`?new wx:t.create(e)).filter(e=>!!e)}_cleanItemsConfiguration(e,t,n){let r=e.filter((e,r,i)=>e===`|`?!0:n.indexOf(e)===-1?e===`-`?this.options.shouldGroupWhenFull?(T(`toolbarview-line-break-ignored-when-grouping-items`,i),!1):!0:!Xe(e)&&!t.has(e)?(T(`toolbarview-item-unavailable`,{item:e}),!1):!0:!1);return this._cleanSeparatorsAndLineBreaks(r)}_cleanSeparatorsAndLineBreaks(e){let t=e=>e!==`-`&&e!==`|`,n=e.length,r=e.findIndex(t);if(r===-1)return[];let i=n-e.slice().reverse().findIndex(t);return e.slice(r,i).filter((e,n,r)=>t(e)?!0:!(n>0&&r[n-1]===e))}_createNestedToolbarDropdown(e,t,n){let{label:r,icon:i,items:a,tooltip:o=!0,withText:s=!1}=e;if(a=this._cleanItemsConfiguration(a,t,n),!a.length)return null;let c=this.locale,l=Nx(c);return r||T(`toolbarview-nested-toolbar-dropdown-missing-label`,e),l.class=`ck-toolbar__nested-toolbar-dropdown`,l.buttonView.set({label:r,tooltip:o,withText:!!s}),i===!1?l.buttonView.withText=!0:l.buttonView.icon=Dx[i]||i||Ty,Fx(l,()=>l.toolbarView._buildItemsFromConfig(a,t,n)),l}},kx=class extends P{children;constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-toolbar__items`]},children:this.children})}},Ax=class{type=`static`;constructor(e){e.isGrouping=!1,e.itemsView.children.bindTo(e.items).using(e=>e),e.focusables.bindTo(e.items).using(e=>Wy(e)?e:null)}render(){}destroy(){}},jx=class{type=`dynamic`;view;viewChildren;viewFocusables;viewItemsView;viewFocusTracker;viewLocale;ungroupedItems;groupedItems;groupedItemsDropdown;resizeObserver=null;cachedPadding=null;shouldUpdateGroupingOnNextResize=!1;viewElement;constructor(e){this.view=e,this.viewChildren=e.children,this.viewFocusables=e.focusables,this.viewItemsView=e.itemsView,this.viewFocusTracker=e.focusTracker,this.viewLocale=e.locale,this.view.isGrouping=!0,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)=>{let n=t.index,r=Array.from(t.added);for(let e of t.removed)n>=this.ungroupedItems.length?this.groupedItems.remove(e):this.ungroupedItems.remove(e);for(let e=n;e<n+r.length;e++){let t=r[e-n];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(){let e=this.view;if(e.items.length){for(let t=0;t<e.items.length;t++){let n=[...e.items][t];this.ungroupedItems.add(n,t)}this._updateGrouping()}}_updateGrouping(){if(!this.viewElement.ownerDocument.body.contains(this.viewElement))return;if(!Yr(this.viewElement)){this.shouldUpdateGroupingOnNextResize=!0;return}let e=this.groupedItems.length,t;for(;this._areItemsOverflowing;)this._groupLastItem(),t=!0;if(!t&&this.groupedItems.length){for(;this.groupedItems.length&&!this._areItemsOverflowing;)this._ungroupFirstItem();this._areItemsOverflowing&&this._groupLastItem()}this.groupedItems.length!==e&&this.view.fire(`groupedItemsUpdate`)}get _areItemsOverflowing(){if(!this.ungroupedItems.length)return!1;let e=this.viewElement,t=this.viewLocale.uiLanguageDirection,n=new O(e.lastChild),r=new O(e);if(!this.cachedPadding){let n=u.window.getComputedStyle(e),r=t===`ltr`?`paddingRight`:`paddingLeft`;this.cachedPadding=Number.parseInt(n[r])}return t===`ltr`?n.right>r.right-this.cachedPadding:n.left<r.left+this.cachedPadding}_enableGroupingOnResize(){let e;this.resizeObserver=new Hr(this.viewElement,t=>{(!e||e!==t.contentRect.width||this.shouldUpdateGroupingOnNextResize)&&(this.shouldUpdateGroupingOnNextResize=!1,this._updateGrouping(),e=t.contentRect.width)}),this._updateGrouping()}_enableGroupingOnMaxWidthChange(e){e.on(`change:maxWidth`,()=>{this._updateGrouping()})}_groupLastItem(){this.groupedItems.length||(this.viewChildren.add(new Cx),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(){let e=this.viewLocale,t=e.t,n=Nx(e);return n.class=`ck-toolbar__grouped-dropdown`,n.panelPosition=e.uiLanguageDirection===`ltr`?`sw`:`se`,Fx(n,this.groupedItems),n.buttonView.set({label:t(`Show more items`),tooltip:!0,tooltipPosition:e.uiLanguageDirection===`rtl`?`se`:`sw`,icon:Ty}),n}_updateFocusCyclableItems(){this.viewFocusables.clear(),this.ungroupedItems.map(e=>{Wy(e)&&this.viewFocusables.add(e)}),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}},Mx=class extends P{children;actionView;arrowView;keystrokes;focusTracker;constructor(e,t){super(e);let n=this.bindTemplate;this.set(`class`,void 0),this.set(`labelStyle`,void 0),this.set(`icon`,void 0),this.set(`isEnabled`,!0),this.set(`isOn`,!1),this.set(`isToggleable`,!1),this.set(`isVisible`,!0),this.set(`keystroke`,void 0),this.set(`withKeystroke`,!1),this.set(`label`,void 0),this.set(`tabindex`,-1),this.set(`tooltip`,!1),this.set(`tooltipPosition`,`s`),this.set(`type`,`button`),this.set(`withText`,!1),this.children=this.createCollection(),this.actionView=this._createActionView(t),this.arrowView=this._createArrowView(),this.keystrokes=new N,this.focusTracker=new M,this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-splitbutton`,n.to(`class`),n.if(`isVisible`,`ck-hidden`,e=>!e),this.arrowView.bindTemplate.if(`isOn`,`ck-splitbutton_open`)]},children:this.children})}render(){super.render(),this.children.add(this.actionView),this.children.add(this.arrowView),this.focusTracker.add(this.actionView.element),this.focusTracker.add(this.arrowView.element),this.keystrokes.listenTo(this.element),this.keystrokes.set(`arrowright`,(e,t)=>{this.focusTracker.focusedElement===this.actionView.element&&(this.arrowView.focus(),t())}),this.keystrokes.set(`arrowleft`,(e,t)=>{this.focusTracker.focusedElement===this.arrowView.element&&(this.actionView.focus(),t())})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.actionView.focus()}_createActionView(e){let t=e||new H;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(){let e=new H,t=e.bindTemplate;return e.icon=b_,e.extendTemplate({attributes:{class:[`ck-splitbutton__arrow`],"data-cke-tooltip-disabled":t.to(`isOn`),"aria-haspopup":!0,"aria-expanded":t.to(`isOn`,e=>String(e))}}),e.bind(`isEnabled`).to(this),e.bind(`label`).to(this),e.bind(`tooltip`).to(this),e.delegate(`execute`).to(this,`open`),e}};function Nx(e,t=cx){let n=typeof t==`function`?new t(e):t,r=new sx(e,n,new ox(e));return n.bind(`isEnabled`).to(r),n instanceof Mx?n.arrowView.bind(`isOn`).to(r,`isOpen`):n.bind(`isOn`).to(r,`isOpen`),Ite(r),r}function Fte(e,t,n,r={}){e.menuView=new Sx(e.locale,t,n),e.focusTracker.add(e.menuView),e.isOpen?Px(e,r):e.once(`change:isOpen`,()=>{Px(e,r)},{priority:`highest`})}function Px(e,t){let n=e.menuView,r=e.locale.t;n.delegate(`menu:execute`).to(e,`execute`),n.listenTo(e,`change:isOpen`,(e,t,r)=>{r||n.closeMenus()},{priority:`low`}),e.panelView.children.add(n);for(let t of n.menus)e.focusTracker.add(t);n.ariaLabel=t.ariaLabel||r(`Dropdown menu`)}function Fx(e,t,n={}){e.extendTemplate({attributes:{class:[`ck-toolbar-dropdown`]}}),e.isOpen?Ix(e,t,n):e.once(`change:isOpen`,()=>Ix(e,t,n),{priority:`highest`}),n.enableActiveItemFocusOnDropdownOpen&&zx(e,()=>e.toolbarView.items.find(e=>e.isOn))}function Ix(e,t,n){let r=e.locale,i=r.t,a=e.toolbarView=new Ox(r),o=typeof t==`function`?t():t;a.ariaLabel=n.ariaLabel||i(`Dropdown toolbar`),n.maxWidth&&(a.maxWidth=n.maxWidth),n.class&&(a.class=n.class),n.isCompact&&(a.isCompact=n.isCompact),n.isVertical&&(a.isVertical=!0),o instanceof pa?a.items.bindTo(o).using(e=>e):a.items.addMany(o),e.panelView.children.add(a),e.focusTracker.add(a),a.items.delegate(`execute`).to(e)}function Lx(e,t,n={}){e.isOpen?Rx(e,t,n):e.once(`change:isOpen`,()=>Rx(e,t,n),{priority:`highest`}),zx(e,()=>e.listView.items.find(e=>e instanceof dx?e.children.first.isOn:!1))}function Rx(e,t,n){let r=e.locale,i=e.listView=new mx(r),a=typeof t==`function`?t():t;i.ariaLabel=n.ariaLabel,i.role=n.role,Kx(e,i.items,a,r),e.panelView.children.add(i),i.items.delegate(`execute`).to(e)}function zx(e,t){e.on(`change:isOpen`,()=>{if(!e.isOpen)return;let n=t();n&&(typeof n.focus==`function`?n.focus():T(`ui-dropdown-focus-child-on-open-child-missing-focus`,{view:n}))},{priority:ge.low-10})}function Ite(e){Lte(e),Vx(e),Hx(e),Ux(e),Wx(e),Gx(e)}function Lte(e){Ya({emitter:e,activator:()=>e.isRendered&&e.isOpen,callback:()=>{e.isOpen=!1},contextElements:()=>[e.element,...Bx(e.focusTracker).filter(t=>!e.element.contains(t))]})}function Bx(e){return[...e.elements,...e.externalViews.flatMap(e=>Bx(e.focusTracker))]}function Vx(e){e.on(`execute`,t=>{t.source instanceof mb||(e.isOpen=!1)})}function Hx(e){e.focusTracker.on(`change:isFocused`,(t,n,r)=>{r||!e.isOpen||(e.isOpen=!1)})}function Ux(e){e.keystrokes.set(`arrowdown`,(t,n)=>{e.isOpen&&(e.panelView.focus(),n())}),e.keystrokes.set(`arrowup`,(t,n)=>{e.isOpen&&(e.panelView.focusLast(),n())})}function Wx(e){e.on(`change:isOpen`,(t,n,r)=>{r||e.focusTracker.elements.some(e=>e.contains(u.document.activeElement))&&e.buttonView.focus()})}function Gx(e){e.on(`change:isOpen`,(t,n,r)=>{r&&e.panelView.focus()},{priority:`low`})}function Kx(e,t,n,r){qx(t),t.bindTo(n).using(t=>{if(t.type===`separator`)return new fx(r);if(t.type===`group`){let n=new px(r);return n.set({label:t.label}),Kx(e,n.items,t.items,r),n.items.delegate(`execute`).to(e),n}else if(t.type===`button`||t.type===`switchbutton`){let e=t.model.role===`menuitemcheckbox`||t.model.role===`menuitemradio`,n=new dx(r),i;return t.type===`button`?(i=new $y(r,t.labelView),i.set({isToggleable:e})):i=new mb(r),i.bind(...Object.keys(t.model)).to(t.model),i.delegate(`execute`).to(n),n.children.add(i),n}return null})}function qx(e){let t=0,n=e=>!(e instanceof dx)||!(e.children.first instanceof $y)?null:e.children.first,r=e=>{let t=n(e);return!t||!t.isToggleable?null:t},i=t=>{for(let r of e){let e=n(r);e&&(e.hasCheckSpace=t)}};e.on(`change`,(e,a)=>{let o=t>0;for(let e of a.removed)r(e)&&t--;for(let e of a.added){let r=n(e);r&&(r.isToggleable&&t++,r.hasCheckSpace=t>0)}let s=t>0;o!==s&&i(s)})}const Jx=(e,t,n)=>{let r=new nx(e.locale);return r.set({id:t,ariaDescribedById:n}),r.bind(`isReadOnly`).to(e,`isEnabled`,e=>!e),r.bind(`hasError`).to(e,`errorText`,e=>!!e),r.on(`input`,()=>{e.errorText=null}),e.bind(`isEmpty`,`isFocused`,`placeholder`).to(r),r},Yx=(e,t,n)=>{let r=new rx(e.locale);return r.set({id:t,ariaDescribedById:n,inputMode:`numeric`}),r.bind(`isReadOnly`).to(e,`isEnabled`,e=>!e),r.bind(`hasError`).to(e,`errorText`,e=>!!e),r.on(`input`,()=>{e.errorText=null}),e.bind(`isEmpty`,`isFocused`,`placeholder`).to(r),r},Xx=(e,t,n)=>{let r=new ix(e.locale);return r.set({id:t,ariaDescribedById:n}),r.bind(`isReadOnly`).to(e,`isEnabled`,e=>!e),r.bind(`hasError`).to(e,`errorText`,e=>!!e),r.on(`input`,()=>{e.errorText=null}),e.bind(`isEmpty`,`isFocused`,`placeholder`).to(r),r},Zx=(e,t,n)=>{let r=Nx(e.locale);return r.set({id:t,ariaDescribedById:n}),r.bind(`isEnabled`).to(e),r},Qx=(e,t=0,n=1)=>e>n?n:e<t?t:e,$x=(e,t=0,n=10**t)=>Math.round(n*e)/n;360/(Math.PI*2);const eS=e=>cS(tS(e)),tS=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:e.length===4?$x(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:e.length===8?$x(parseInt(e.substring(6,8),16)/255,2):1}),nS=e=>sS(aS(e)),rS=({h:e,s:t,v:n,a:r})=>{let i=(200-t)*n/100;return{h:$x(e),s:$x(i>0&&i<200?t*n/100/(i<=100?i:200-i)*100:0),l:$x(i/2),a:$x(r,2)}},iS=e=>{let{h:t,s:n,l:r}=rS(e);return`hsl(${t}, ${n}%, ${r}%)`},aS=({h:e,s:t,v:n,a:r})=>{e=e/360*6,t/=100,n/=100;let i=Math.floor(e),a=n*(1-t),o=n*(1-(e-i)*t),s=n*(1-(1-e+i)*t),c=i%6;return{r:$x([n,o,a,a,s,n][c]*255),g:$x([s,n,n,o,a,a][c]*255),b:$x([a,a,s,n,n,o][c]*255),a:$x(r,2)}},oS=e=>{let t=e.toString(16);return t.length<2?`0`+t:t},sS=({r:e,g:t,b:n,a:r})=>{let i=r<1?oS($x(r*255)):``;return`#`+oS(e)+oS(t)+oS(n)+i},cS=({r:e,g:t,b:n,a:r})=>{let i=Math.max(e,t,n),a=i-Math.min(e,t,n),o=a?i===e?(t-n)/a:i===t?2+(n-e)/a:4+(e-t)/a:0;return{h:$x(60*(o<0?o+6:o)),s:$x(i?a/i*100:0),v:$x(i/255*100),a:r}},lS=(e,t)=>{if(e===t)return!0;for(let n in e)if(e[n]!==t[n])return!1;return!0},uS=(e,t)=>e.toLowerCase()===t.toLowerCase()?!0:lS(tS(e),tS(t)),dS={},fS=e=>{let t=dS[e];return t||(t=document.createElement(`template`),t.innerHTML=e,dS[e]=t),t},pS=(e,t,n)=>{e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n}))};let mS=!1;const hS=e=>`touches`in e,gS=e=>mS&&!hS(e)?!1:(mS||=hS(e),!0),_S=(e,t)=>{let n=hS(t)?t.touches[0]:t,r=e.el.getBoundingClientRect();pS(e.el,`move`,e.getMove({x:Qx((n.pageX-(r.left+window.pageXOffset))/r.width),y:Qx((n.pageY-(r.top+window.pageYOffset))/r.height)}))},vS=(e,t)=>{let n=t.keyCode;n>40||e.xy&&n<37||n<33||(t.preventDefault(),pS(e.el,`move`,e.getMove({x:n===39?.01:n===37?-.01:n===34?.05:n===33?-.05:n===35?1:n===36?-1:0,y:n===40?.01:n===38?-.01:0},!0)))};var yS=class{constructor(e,t,n,r){let i=fS(`<div role="slider" tabindex="0" part="${t}" ${n}><div part="${t}-pointer"></div></div>`);e.appendChild(i.content.cloneNode(!0));let a=e.querySelector(`[part=${t}]`);a.addEventListener(`mousedown`,this),a.addEventListener(`touchstart`,this),a.addEventListener(`keydown`,this),this.el=a,this.xy=r,this.nodes=[a.firstChild,a]}set dragging(e){let t=e?document.addEventListener:document.removeEventListener;t(mS?`touchmove`:`mousemove`,this),t(mS?`touchend`:`mouseup`,this)}handleEvent(e){switch(e.type){case`mousedown`:case`touchstart`:if(e.preventDefault(),!gS(e)||!mS&&e.button!=0)return;this.el.focus(),_S(this,e),this.dragging=!0;break;case`mousemove`:case`touchmove`:e.preventDefault(),_S(this,e);break;case`mouseup`:case`touchend`:this.dragging=!1;break;case`keydown`:vS(this,e);break}}style(e){e.forEach((e,t)=>{for(let n in e)this.nodes[t].style.setProperty(n,e[n])})}},bS=class extends yS{constructor(e){super(e,`hue`,`aria-label="Hue" aria-valuemin="0" aria-valuemax="360"`,!1)}update({h:e}){this.h=e,this.style([{left:`${e/360*100}%`,color:iS({h:e,s:100,v:100,a:1})}]),this.el.setAttribute(`aria-valuenow`,`${$x(e)}`)}getMove(e,t){return{h:t?Qx(this.h+e.x*360,0,360):360*e.x}}},xS=class extends yS{constructor(e){super(e,`saturation`,`aria-label="Color"`,!0)}update(e){this.hsva=e,this.style([{top:`${100-e.v}%`,left:`${e.s}%`,color:iS(e)},{"background-color":iS({h:e.h,s:100,v:100,a:1})}]),this.el.setAttribute(`aria-valuetext`,`Saturation ${$x(e.s)}%, Brightness ${$x(e.v)}%`)}getMove(e,t){return{s:t?Qx(this.hsva.s+e.x*100,0,100):e.x*100,v:t?Qx(this.hsva.v-e.y*100,0,100):Math.round(100-e.y*100)}}},SS=`: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)}`,CS=`[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}`,wS=`[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}`;const TS=Symbol(`same`),ES=Symbol(`color`),DS=Symbol(`hsva`),OS=Symbol(`update`),kS=Symbol(`parts`),AS=Symbol(`css`),jS=Symbol(`sliders`);var MS=class extends HTMLElement{static get observedAttributes(){return[`color`]}get[AS](){return[SS,CS,wS]}get[jS](){return[xS,bS]}get color(){return this[ES]}set color(e){if(!this[TS](e)){let t=this.colorModel.toHsva(e);this[OS](t),this[ES]=e}}constructor(){super();let e=fS(`<style>${this[AS].join(``)}</style>`),t=this.attachShadow({mode:`open`});t.appendChild(e.content.cloneNode(!0)),t.addEventListener(`move`,this),this[kS]=this[jS].map(e=>new e(t))}connectedCallback(){if(this.hasOwnProperty(`color`)){let e=this.color;delete this.color,this.color=e}else this.color||=this.colorModel.defaultColor}attributeChangedCallback(e,t,n){let r=this.colorModel.fromAttr(n);this[TS](r)||(this.color=r)}handleEvent(e){let t=this[DS],n={...t,...e.detail};this[OS](n);let r;!lS(n,t)&&!this[TS](r=this.colorModel.fromHsva(n))&&(this[ES]=r,pS(this,`color-changed`,{value:r}))}[TS](e){return this.color&&this.colorModel.equal(e,this.color)}[OS](e){this[DS]=e,this[kS].forEach(t=>t.update(e))}};const NS={defaultColor:`#000`,toHsva:eS,fromHsva:({h:e,s:t,v:n})=>nS({h:e,s:t,v:n,a:1}),equal:uS,fromAttr:e=>e};var PS=class extends MS{get colorModel(){return NS}},FS=class extends P{hexInputRow;_debounceColorPickerEvent;_config;constructor(e,t={}){super(e),this.set({color:``,_hexColor:``}),this.hexInputRow=this._createInputRow();let n=this.createCollection();t.hideInput||n.add(this.hexInputRow),this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-color-picker`],tabindex:-1},children:n}),this._config=t,this._debounceColorPickerEvent=Kt(e=>{this.set(`color`,e),this.fire(`colorSelected`,{color:this.color})},150,{leading:!0}),this.on(`set:color`,(e,t,n)=>{e.return=Kb(n,this._config.format||`hsl`)}),this.on(`change:color`,()=>{this._hexColor=IS(this.color)}),this.on(`change:_hexColor`,()=>{document.activeElement!==this.picker&&this.picker.setAttribute(`color`,this._hexColor),IS(this.color)!=IS(this._hexColor)&&(this.color=this._hexColor)})}render(){if(super.render(),Jb(`hex-color-picker`,PS),this.picker=u.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);let 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=>{let t=e.detail.value;this._debounceColorPickerEvent(t)})}focus(){!this._config.hideInput&&(p.isGecko||p.isiOS||p.isSafari||p.isBlink)&&this.hexInputRow.children.get(1).focus(),this.slidersView.first.focus()}_createSlidersView(){let e=[...this.picker.shadowRoot.children].filter(e=>e.getAttribute(`role`)===`slider`).map(e=>new LS(e));this.slidersView=this.createCollection(),e.forEach(e=>{this.slidersView.add(e)})}_createInputRow(){let e=this._createColorInput();return new zS(this.locale,e)}_createColorInput(){let e=new Qb(this.locale,Jx),{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`,()=>{let t=e.fieldView.element.value;if(t){let e=BS(t);e&&this._debounceColorPickerEvent(e)}}),e}isValid(){let{t:e}=this.locale;return this._config.hideInput?!0:(this.resetValidationStatus(),this.hexInputRow.getParsedColor()?!0:(this.hexInputRow.inputView.errorText=e(`Please enter a valid color (e.g. "ff0000").`),!1))}resetValidationStatus(){this.hexInputRow.inputView.errorText=null}};function IS(e){let t=qb(e);return t||=`#000`,t.length===4&&(t=`#`+[t[1],t[1],t[2],t[2],t[3],t[3]].join(``)),t.toLowerCase()}var LS=class extends P{constructor(e){super(),this.element=e}focus(){this.element.focus()}},RS=class extends P{constructor(e){super(e),this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-color-picker__hash-view`]},children:`#`})}},zS=class extends P{children;inputView;constructor(e,t){super(e),this.inputView=t,this.children=this.createCollection([new RS,this.inputView]),this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-color-picker__row`]},children:this.children})}getParsedColor(){return BS(this.inputView.fieldView.element.value)}};function BS(e){if(!e)return null;let 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)?null:`#${t}`}const VS=D(Fi);var HS=class extends VS{constructor(e){super(e),this.set(`isEmpty`,!0),this.on(`change`,()=>{this.set(`isEmpty`,this.length===0)})}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)}},US=class extends P{items;colorDefinitions;focusTracker;columns;documentColors;documentColorsCount;staticColorsGrid;documentColorsGrid;colorPickerButtonView;removeColorButtonView;_focusables;_documentColorsLabel;_removeButtonLabel;_colorPickerLabel;constructor(e,{colors:t,columns:n,removeButtonLabel:r,documentColorsLabel:i,documentColorsCount:a,colorPickerLabel:o,focusTracker:s,focusables:c}){super(e);let l=this.bindTemplate;this.set(`isVisible`,!0),this.focusTracker=s,this.items=this.createCollection(),this.colorDefinitions=t,this.columns=n,this.documentColors=new HS,this.documentColorsCount=a,this._focusables=c,this._removeButtonLabel=r,this._colorPickerLabel=o,this._documentColorsLabel=i,this.setTemplate({tag:`div`,attributes:{class:[`ck-color-grids-fragment`,l.if(`isVisible`,`ck-hidden`,e=>!e)]},children:this.items}),this.removeColorButtonView=this._createRemoveColorButton(),this.items.add(this.removeColorButtonView)}updateDocumentColors(e,t){let n=e.document,r=this.documentColorsCount;this.documentColors.clear();for(let i of n.getRoots()){let n=e.createRangeIn(i);for(let e of n.getItems())if(e.is(`$textProxy`)&&e.hasAttribute(t)&&(this._addColorToDocumentColors(e.getAttribute(t)),this.documentColors.length>=r))return}}updateSelectedColors(){let e=this.documentColorsGrid,t=this.staticColorsGrid,n=this.selectedColor;t.selectedColor=n,e&&(e.selectedColor=n)}render(){if(super.render(),this.staticColorsGrid=this._createStaticColorsGrid(),this.items.add(this.staticColorsGrid),this.documentColorsCount){let e=ga.bind(this.documentColors,this.documentColors),t=new P(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 H,this.colorPickerButtonView.set({label:this._colorPickerLabel,withText:!0,icon:p_,class:`ck-color-selector__color-picker`}),this.colorPickerButtonView.on(`execute`,()=>{this.fire(`colorPicker:show`)})}_createRemoveColorButton(){let e=new H;return e.set({withText:!0,icon:S_,label:this._removeButtonLabel}),e.class=`ck-color-selector__remove-color`,e.on(`execute`,()=>{this.fire(`execute`,{value:null,source:`removeColorButton`})}),e.render(),e}_createStaticColorsGrid(){let e=new Eb(this.locale,{colorDefinitions:this.colorDefinitions,columns:this.columns});return e.on(`execute`,(e,t)=>{this.fire(`execute`,{value:t.value,source:`staticColorsGrid`})}),e}_createDocumentColorsGrid(){let e=ga.bind(this.documentColors,this.documentColors),t=new Eb(this.locale,{columns:this.columns});return t.extendTemplate({attributes:{class:e.if(`isEmpty`,`ck-hidden`)}}),t.items.bindTo(this.documentColors).using(e=>{let t=new Tb;return t.set({color:e.color,hasBorder:e.options?.hasBorder}),e.label&&t.set({label:e.label,tooltip:!0}),t.on(`execute`,()=>{this.fire(`execute`,{value:e.color,source:`documentColorsGrid`})}),t}),this.documentColors.on(`change:isEmpty`,(e,n,r)=>{r&&(t.selectedColor=null)}),t}_addColorToDocumentColors(e){let t=this.colorDefinitions.find(t=>t.color===e);t?this.documentColors.add(Object.assign({},t)):this.documentColors.add({color:e,label:e,options:{hasBorder:!1}})}},WS=class extends P{items;colorPickerView;saveButtonView;cancelButtonView;actionBarView;focusTracker;keystrokes;_focusables;_colorPickerViewConfig;constructor(e,{focusTracker:t,focusables:n,keystrokes:r,colorPickerViewConfig:i}){super(e),this.items=this.createCollection(),this.focusTracker=t,this.keystrokes=r,this.set(`isVisible`,!1),this.set(`selectedColor`,void 0),this._focusables=n,this._colorPickerViewConfig=i;let a=this.bindTemplate,{saveButtonView:o,cancelButtonView:s}=this._createActionButtons();this.saveButtonView=o,this.cancelButtonView=s,this.actionBarView=this._createActionBarView({saveButtonView:o,cancelButtonView:s}),this.setTemplate({tag:`div`,attributes:{class:[`ck-color-picker-fragment`,a.if(`isVisible`,`ck-hidden`,e=>!e)]},children:this.items})}render(){super.render();let e=new FS(this.locale,{...this._colorPickerViewConfig});this.colorPickerView=e,this.colorPickerView.render(),this.selectedColor&&(e.color=this.selectedColor),this.listenTo(this,`change:selectedColor`,(t,n,r)=>{e.color=r}),this.items.add(this.colorPickerView),this.items.add(this.actionBarView),this._addColorPickersElementsToFocusTracker(),this._stopPropagationOnArrowsKeys(),this._executeOnEnterPress(),this._executeUponColorChange()}destroy(){super.destroy()}focus(){this.colorPickerView.focus()}resetValidationStatus(){this.colorPickerView.resetValidationStatus()}_executeOnEnterPress(){this.keystrokes.set(`enter`,e=>{this.isVisible&&this.focusTracker.focusedElement!==this.cancelButtonView.element&&this.colorPickerView.isValid()&&(this.fire(`execute`,{value:this.selectedColor}),e.stopPropagation(),e.preventDefault())})}_stopPropagationOnArrowsKeys(){let 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(let e of this.colorPickerView.slidersView)this.focusTracker.add(e.element),this._focusables.add(e);let 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}){let n=new P,r=this.createCollection();return r.add(e),r.add(t),n.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-color-selector_action-bar`]},children:r}),n}_createActionButtons(){let e=this.locale,t=e.t,n=new H(e),r=new H(e);return n.set({icon:l_,class:`ck-button-save`,type:`button`,withText:!1,label:t(`Accept`)}),r.set({icon:s_,class:`ck-button-cancel`,type:`button`,withText:!1,label:t(`Cancel`)}),n.on(`execute`,()=>{this.colorPickerView.isValid()&&this.fire(`execute`,{source:`colorPickerSaveButton`,value:this.selectedColor})}),r.on(`execute`,()=>{this.fire(`colorPicker:cancel`)}),{saveButtonView:n,cancelButtonView:r}}_executeUponColorChange(){this.colorPickerView.on(`colorSelected`,(e,t)=>{this.fire(`execute`,{value:t.color,source:`colorPicker`}),this.set(`selectedColor`,t.color)})}},GS=class extends P{focusTracker;keystrokes;items;colorGridsFragmentView;colorPickerFragmentView;_focusCycler;_focusables;_colorPickerViewConfig;constructor(e,{colors:t,columns:n,removeButtonLabel:r,documentColorsLabel:i,documentColorsCount:a,colorPickerLabel:o,colorPickerViewConfig:s}){super(e),this.items=this.createCollection(),this.focusTracker=new M,this.keystrokes=new N,this._focusables=new pa,this._colorPickerViewConfig=s,this._focusCycler=new Hy({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:`shift + tab`,focusNext:`tab`}}),this.colorGridsFragmentView=new US(e,{colors:t,columns:n,removeButtonLabel:r,documentColorsLabel:i,documentColorsCount:a,colorPickerLabel:o,focusTracker:this.focusTracker,focusables:this._focusables}),this.colorPickerFragmentView=new WS(e,{focusables:this._focusables,focusTracker:this.focusTracker,keystrokes:this.keystrokes,colorPickerViewConfig:s}),this.set(`_isColorGridsFragmentVisible`,!0),this.set(`_isColorPickerFragmentVisible`,!1),this.set(`selectedColor`,void 0),this.colorGridsFragmentView.bind(`isVisible`).to(this,`_isColorGridsFragmentVisible`),this.colorPickerFragmentView.bind(`isVisible`).to(this,`_isColorPickerFragmentVisible`),this.on(`change:selectedColor`,(e,t,n)=>{this.colorGridsFragmentView.set(`selectedColor`,n),this.colorPickerFragmentView.set(`selectedColor`,n)}),this.colorGridsFragmentView.on(`change:selectedColor`,(e,t,n)=>{this.set(`selectedColor`,n)}),this.colorPickerFragmentView.on(`change:selectedColor`,(e,t,n)=>{this.set(`selectedColor`,n)}),this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-color-selector`]},children:this.items})}render(){super.render(),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}appendUI(){this._appendColorGridsFragment(),this._colorPickerViewConfig&&this._appendColorPickerFragment()}showColorPickerFragment(){!this.colorPickerFragmentView.colorPickerView||this._isColorPickerFragmentVisible||(this._isColorPickerFragmentVisible=!0,this.colorPickerFragmentView.focus(),this.colorPickerFragmentView.resetValidationStatus(),this._isColorGridsFragmentVisible=!1)}showColorGridsFragment(){this._isColorGridsFragmentVisible||(this._isColorGridsFragmentVisible=!0,this.colorGridsFragmentView.focus(),this._isColorPickerFragmentVisible=!1)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}updateDocumentColors(e,t){this.colorGridsFragmentView.updateDocumentColors(e,t)}updateSelectedColors(){this.colorGridsFragmentView.updateSelectedColors()}_appendColorGridsFragment(){this.items.length||(this.items.add(this.colorGridsFragmentView),this.colorGridsFragmentView.delegate(`execute`).to(this),this.colorGridsFragmentView.delegate(`colorPicker:show`).to(this))}_appendColorPickerFragment(){this.items.length!==2&&(this.items.add(this.colorPickerFragmentView),this.colorGridsFragmentView.colorPickerButtonView&&this.colorGridsFragmentView.colorPickerButtonView.on(`execute`,()=>{this.showColorPickerFragment()}),this.colorGridsFragmentView.addColorPickerButton(),this.colorPickerFragmentView.delegate(`execute`).to(this),this.colorPickerFragmentView.delegate(`colorPicker:cancel`).to(this))}},KS=class{editor;_components=new Map;constructor(e){this.editor=e}*names(){for(let e of this._components.values())yield e.originalName}add(e,t){this._components.set(qS(e),{callback:t,originalName:e})}create(e){if(!this.has(e))throw new w(`componentfactory-item-missing`,this,{name:e});return this._components.get(qS(e)).callback(this.editor.locale)}has(e){return this._components.has(qS(e))}};function qS(e){return String(e).toLowerCase()}const JS=`ck-tooltip`,YS=br();var XS=class e extends YS{tooltipTextView;balloonPanelView;static defaultBalloonPositions=ab.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(),e._editors.add(t),e._instance)return e._instance;e._instance=this,this.tooltipTextView=new P(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 ab(t.locale),this.balloonPanelView.class=JS,this.balloonPanelView.content.add(this.tooltipTextView),this._mutationObserver=$S(()=>{this._updateTooltipPosition()}),this._pinTooltipDebounced=Kt(this._pinTooltip,600),this._unpinTooltipDebounced=Kt(this._unpinTooltip,400),this.listenTo(u.document,`keydown`,this._onKeyDown.bind(this),{useCapture:!0}),this.listenTo(u.document,`mouseenter`,this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(u.document,`mouseleave`,this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(u.document,`focus`,this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(u.document,`blur`,this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(u.document,`scroll`,this._onScroll.bind(this),{useCapture:!0}),this._watchdogExcluded=!0}destroy(t){let n=t.ui.view&&t.ui.view.body;e._editors.delete(t),this.stopListening(t.ui),n&&n.has(this.balloonPanelView)&&n.remove(this.balloonPanelView),e._editors.size||(this._unpinTooltip(),this.balloonPanelView.destroy(),this.stopListening(),e._instance=null)}static getPositioningFunctions(t){let n=e.defaultBalloonPositions;return{s:[n.southArrowNorth,n.southArrowNorthEast,n.southArrowNorthWest],n:[n.northArrowSouth],e:[n.eastArrowWest],w:[n.westArrowEast],sw:[n.southArrowNorthEast],se:[n.southArrowNorthWest]}[t]}_onKeyDown(e,t){t.key===`Escape`&&this._currentElementWithTooltip&&(this._unpinTooltip(),t.stopPropagation())}_onEnterOrFocus(e,{target:t}){let n=ZS(t);if(!n){e.name===`focus`&&this._unpinTooltip();return}if(n===this._currentElementWithTooltip){this._unpinTooltipDebounced.cancel();return}this._unpinTooltip(),e.name===`focus`&&!n.matches(`:hover`)||n.matches(`[data-cke-tooltip-instant]`)?this._pinTooltip(n,QS(n)):this._pinTooltipDebounced(n,QS(n))}_onLeaveOrBlur(e,{target:t,relatedTarget:n}){if(e.name===`mouseleave`){if(!jn(t))return;let e=this.balloonPanelView.element,r=e&&(e===n||e.contains(n)),i=!r&&t===e;if(r){this._unpinTooltipDebounced.cancel();return}if(!i&&this._currentElementWithTooltip&&t!==this._currentElementWithTooltip)return;let a=ZS(t),o=ZS(n);(i||a&&a!==o)&&(this._pinTooltipDebounced.cancel(),this._currentElementWithTooltip&&this._currentElementWithTooltip.matches(`[data-cke-tooltip-instant]`)||a&&a.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(t,{text:n,position:r,cssClass:i}){this._unpinTooltip();let a=j(e._editors.values()).ui.view.body;a.has(this.balloonPanelView)||a.add(this.balloonPanelView),this.tooltipTextView.text=n,this.balloonPanelView.class=[JS,i].filter(e=>e).join(` `),this.balloonPanelView.pin({target:t,positions:e.getPositioningFunctions(r)}),this._mutationObserver.attach(t);for(let t of e._editors)this.listenTo(t.ui,`update`,this._updateTooltipPosition.bind(this),{priority:`low`});this._currentElementWithTooltip=t,this._currentTooltipPosition=r}_unpinTooltip(){this._unpinTooltipDebounced.cancel(),this._pinTooltipDebounced.cancel(),this.balloonPanelView.unpin();for(let t of e._editors)this.stopListening(t.ui,`update`);this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this.tooltipTextView.text=``,this._mutationObserver.detach()}_updateTooltipPosition(){if(!this._currentElementWithTooltip)return;let t=QS(this._currentElementWithTooltip);if(!Yr(this._currentElementWithTooltip)||!t.text){this._unpinTooltip();return}this.balloonPanelView.pin({target:this._currentElementWithTooltip,positions:e.getPositioningFunctions(t.position)})}};function ZS(e){return jn(e)?e.closest(`[data-cke-tooltip-text]:not([data-cke-tooltip-disabled])`):null}function QS(e){return{text:e.dataset.ckeTooltipText,position:e.dataset.ckeTooltipPosition||`s`,cssClass:e.dataset.ckeTooltipClass||``}}function $S(e){let t=new MutationObserver(()=>{e()});return{attach(e){t.observe(e,{attributes:!0,attributeFilter:[`data-cke-tooltip-text`,`data-cke-tooltip-position`]})},detach(){t.disconnect()}}}var eC=class extends cb{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(){let e=nC(this.editor.config.get(`licenseKey`));return!!(e&&this.licenseTypeMessage[e])}_createBadgeContent(){let e=nC(this.editor.config.get(`licenseKey`));return new tC(this.editor.locale,this.licenseTypeMessage[e])}_getNormalizedConfig(){let e=super._getNormalizedConfig(),t=this.editor.config.get(`ui.poweredBy`)||{};return{position:t.position||e.position,side:(t.side||e.side)===`left`?`right`:`left`,verticalOffset:e.verticalOffset,horizontalOffset:e.horizontalOffset}}},tC=class extends P{constructor(e,t){super(e),this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-evaluation-badge`],"aria-hidden":!0},children:[{tag:`span`,attributes:{class:[`ck`,`ck-evaluation-badge__label`]},children:[t]}]})}};function nC(e){if(e==`GPL`)return`GPL`;let t=Xi(e.split(`.`)[1]);return t?t.licenseType||`production`:null}var rC=class extends dx{constructor(e,t){super(e);let n=this.bindTemplate;this.extendTemplate({attributes:{class:[`ck-menu-bar__menu__item`]},on:{mouseenter:n.to(`mouseenter`)}}),this.delegate(`mouseenter`).to(t)}};const iC={toggleMenusAndFocusItemsOnHover(e){e.on(`menu:mouseenter`,t=>{if(!(!e.isFocusBorderEnabled&&!e.isOpen)){if(e.isOpen)for(let n of e.menus){let e=t.path[0],r=e instanceof rC&&e.children.first===n;n.isOpen=(t.path.includes(n)||r)&&n.isEnabled}t.source.focus()}})},focusCycleMenusOnArrows(e){let t=e.locale.uiLanguageDirection===`rtl`;e.on(`menu:arrowright`,e=>{n(e.source,t?-1:1)}),e.on(`menu:arrowleft`,e=>{n(e.source,t?1:-1)});function n(t,n){let r=e.children.getIndex(t),i=t.isOpen,a=e.children.length,o=e.children.get((r+a+n)%a);t.isOpen=!1,i&&(o.isOpen=!0),o.buttonView.focus()}},closeMenusWhenTheBarCloses(e){e.on(`change:isOpen`,()=>{e.isOpen||e.menus.forEach(e=>{e.isOpen=!1})})},closeMenuWhenAnotherOnTheSameLevelOpens(e){e.on(`menu:change:isOpen`,(t,n,r)=>{r&&e.menus.filter(e=>t.source.parentMenuView===e.parentMenuView&&t.source!==e&&e.isOpen).forEach(e=>{e.isOpen=!1})})},closeOnClickOutside(e){Ya({emitter:e,activator:()=>e.isOpen,callback:()=>e.close(),contextElements:()=>e.children.map(e=>e.element)})},enableFocusHighlightOnInteraction(e){let t=!1;e.on(`change:isOpen`,(n,r,i)=>{i||(t||(e.isFocusBorderEnabled=!1),t=!1)}),e.listenTo(e.element,`keydown`,()=>{t=!0},{useCapture:!0}),e.listenTo(e.element,`keyup`,()=>{t=!1},{useCapture:!0}),e.listenTo(e.element,`focus`,()=>{t&&(e.isFocusBorderEnabled=!0)},{useCapture:!0})}},aC={openAndFocusPanelOnArrowDownKey(e){e.keystrokes.set(`arrowdown`,(t,n)=>{e.isEnabled&&e.focusTracker.focusedElement===e.buttonView.element&&(e.isOpen||=!0,e.panelView.focus(),n())})},openOnArrowRightKey(e){let t=e.locale.uiLanguageDirection===`rtl`?`arrowleft`:`arrowright`;e.keystrokes.set(t,(t,n)=>{e.focusTracker.focusedElement!==e.buttonView.element||!e.isEnabled||(e.isOpen||=!0,e.panelView.focus(),n())})},openOnButtonClick(e){e.buttonView.on(`execute`,()=>{e.isOpen=!0})},toggleOnButtonClick(e){e.buttonView.on(`execute`,()=>{e.isOpen=!e.isOpen})},openAndFocusOnEnterKeyPress(e){e.keystrokes.set(`enter`,(t,n)=>{e.focusTracker.focusedElement===e.buttonView.element&&(e.isOpen=!0,e.panelView.focus(),n())})},closeOnArrowLeftKey(e){let t=e.locale.uiLanguageDirection===`rtl`?`arrowright`:`arrowleft`;e.keystrokes.set(t,(t,n)=>{e.isOpen&&(e.isOpen=!1,e.focus(),n())})},closeOnEscKey(e){e.keystrokes.set(`esc`,(t,n)=>{e.isOpen&&(e.isOpen=!1,e.focus(),n())})},closeOnParentClose(e){e.parentMenuView.on(`change:isOpen`,(t,n,r)=>{!r&&t.source===e.parentMenuView&&(e.isOpen=!1)})}},oC={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`})},sC=[{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 cC(e){let t;return t=!(`items`in e)||!e.items?{items:Rt(sC),addItems:[],removeItems:[],isVisible:!0,isUsingDefaultConfig:!0,...e}:{items:e.items,removeItems:[],addItems:[],isVisible:!0,isUsingDefaultConfig:!1,...e},t}function lC({normalizedConfig:e,locale:t,componentFactory:n,extraItems:r}){let i=Rt(e);return dC(e,i,r),uC(e,i),dC(e,i,i.addItems),pC(e,i,n),mC(e,i),gC(i,t),i}function uC(e,t){let n=t.removeItems,r=[];t.items=t.items.filter(({menuId:e})=>n.includes(e)?(r.push(e),!1):!0),_C(t.items,e=>{e.groups=e.groups.filter(({groupId:e})=>n.includes(e)?(r.push(e),!1):!0);for(let t of e.groups)t.items=t.items.filter(e=>{let t=SC(e);return n.includes(t)?(r.push(t),!1):!0})});for(let t of n)r.includes(t)||T(`menu-bar-item-could-not-be-removed`,{menuBarConfig:e,itemName:t})}function dC(e,t,n){let r=[];if(n.length!=0){for(let e of n){let n=bC(e.position),i=xC(e.position);if(vC(e))if(!i)n===`start`?(t.items.unshift(e.menu),r.push(e)):n===`end`&&(t.items.push(e.menu),r.push(e));else{let a=t.items.findIndex(e=>e.menuId===i);a==-1?fC(t,e.menu,i,n)&&r.push(e):n===`before`?(t.items.splice(a,0,e.menu),r.push(e)):n===`after`&&(t.items.splice(a+1,0,e.menu),r.push(e))}else yC(e)?_C(t.items,t=>{if(t.menuId===i)n===`start`?(t.groups.unshift(e.group),r.push(e)):n===`end`&&(t.groups.push(e.group),r.push(e));else{let a=t.groups.findIndex(e=>e.groupId===i);a!==-1&&(n===`before`?(t.groups.splice(a,0,e.group),r.push(e)):n===`after`&&(t.groups.splice(a+1,0,e.group),r.push(e)))}}):fC(t,e.item,i,n)&&r.push(e)}for(let t of n)r.includes(t)||T(`menu-bar-item-could-not-be-added`,{menuBarConfig:e,addedItemConfig:t})}}function fC(e,t,n,r){let i=!1;return _C(e.items,e=>{for(let{groupId:a,items:o}of e.groups){if(i)return;if(a===n)r===`start`?(o.unshift(t),i=!0):r===`end`&&(o.push(t),i=!0);else{let e=o.findIndex(e=>SC(e)===n);e!==-1&&(r===`before`?(o.splice(e,0,t),i=!0):r===`after`&&(o.splice(e+1,0,t),i=!0))}}}),i}function pC(e,t,n){_C(t.items,r=>{for(let i of r.groups)i.items=i.items.filter(i=>{let a=typeof i==`string`&&!n.has(i);return a&&!t.isUsingDefaultConfig&&T(`menu-bar-item-unavailable`,{menuBarConfig:e,parentMenuConfig:Rt(r),componentName:i}),!a})})}function mC(e,t){let n=t.isUsingDefaultConfig,r=!1;if(t.items=t.items.filter(t=>t.groups.length?!0:(hC(e,t,n),!1)),!t.items.length){hC(e,e,n);return}_C(t.items,t=>{t.groups=t.groups.filter(e=>e.items.length?!0:(r=!0,!1));for(let i of t.groups)i.items=i.items.filter(t=>CC(t)&&!t.groups.length?(hC(e,t,n),r=!0,!1):!0)}),r&&mC(e,t)}function hC(e,t,n){n||T(`menu-bar-menu-empty`,{menuBarConfig:e,emptyMenuConfig:t})}function gC(e,t){let n=t.t,r={File:n({string:`File`,id:`MENU_BAR_MENU_FILE`}),Edit:n({string:`Edit`,id:`MENU_BAR_MENU_EDIT`}),View:n({string:`View`,id:`MENU_BAR_MENU_VIEW`}),Insert:n({string:`Insert`,id:`MENU_BAR_MENU_INSERT`}),Format:n({string:`Format`,id:`MENU_BAR_MENU_FORMAT`}),Tools:n({string:`Tools`,id:`MENU_BAR_MENU_TOOLS`}),Help:n({string:`Help`,id:`MENU_BAR_MENU_HELP`}),Text:n({string:`Text`,id:`MENU_BAR_MENU_TEXT`}),Font:n({string:`Font`,id:`MENU_BAR_MENU_FONT`})};_C(e.items,e=>{e.label in r&&(e.label=r[e.label])})}function _C(e,t){if(Array.isArray(e))for(let t of e)n(t);function n(e){t(e);for(let t of e.groups)for(let e of t.items)CC(e)&&n(e)}}function vC(e){return typeof e==`object`&&`menu`in e}function yC(e){return typeof e==`object`&&`group`in e}function bC(e){return e.startsWith(`start`)?`start`:e.startsWith(`end`)?`end`:e.startsWith(`after`)?`after`:`before`}function xC(e){let t=e.match(/^[^:]+:(.+)/);return t?t[1]:null}function SC(e){return typeof e==`string`?e:e.menuId}function CC(e){return typeof e==`object`&&`menuId`in e}const wC=D();var TC=class extends wC{editor;componentFactory;focusTracker;tooltipManager;poweredBy;evaluationBadge;ariaLiveAnnouncer;isReady=!1;_editableElementsMap=new Map;_focusableToolbarDefinitions=[];_extraMenuBarElements=[];_lastFocusedForeignElement=null;_domEmitter;constructor(e){super();let t=e.editing.view;this.editor=e,this.componentFactory=new KS(e),this.focusTracker=new M,this.tooltipManager=new XS(e),this.poweredBy=new fb(e),this.evaluationBadge=new eC(e),this.ariaLiveAnnouncer=new Ka(e),this._initViewportOffset(this._readViewportOffsetFromConfig()),this.once(`ready`,()=>{this._bindBodyCollectionWithFocusTracker(),this.isReady=!0}),this.listenTo(t.document,`layoutChanged`,this.update.bind(this)),this.listenTo(t,`scrollToTheSelection`,this._handleScrollToTheSelection.bind(this)),this._initFocusTracking(),this._initVisualViewportSupport()}get element(){return null}update(){this.fire(`update`)}destroy(){this.stopListening(),this.focusTracker.destroy(),this.tooltipManager.destroy(this.editor),this.poweredBy.destroy(),this.evaluationBadge.destroy();for(let 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||=this.editor,this.focusTracker.add(t);let n=()=>{this.editor.editing.view.getDomRoot(e)||this.editor.keystrokes.listenTo(t)};this.isReady?n():this.once(`ready`,n)}removeEditableElement(e){let 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){let t=e.element;this.focusTracker.add(t),this.editor.keystrokes.listenTo(t);let n=cC(this.editor.config.get(`menuBar`)||{});e.fillFromConfig(n,this.componentFactory,this._extraMenuBarElements),this.editor.keystrokes.set(`Esc`,(e,n)=>{t.contains(this.editor.ui.focusTracker.focusedElement)&&(this._lastFocusedForeignElement?(this._lastFocusedForeignElement.focus(),this._lastFocusedForeignElement=null):this.editor.editing.view.focus(),n())}),this.editor.keystrokes.set(`Alt+F9`,(n,r)=>{t.contains(this.editor.ui.focusTracker.focusedElement)||(this._saveLastFocusedForeignElement(),e.isFocusBorderEnabled=!0,e.focus(),r())})}_readViewportOffsetFromConfig(){let e=this.editor,t=e.config.get(`ui.viewportOffset`);if(t)return t;let n=e.config.get(`toolbar.viewportTopOffset`);return n?(console.warn("editor-ui-deprecated-viewport-offset-config: The `toolbar.vieportTopOffset` configuration option is deprecated. It will be removed from future CKEditor versions. Use `ui.viewportOffset.top` instead."),{top:n}):{top:0}}_initFocusTracking(){let e=this.editor,t;e.keystrokes.set(`Alt+F10`,(e,n)=>{this._saveLastFocusedForeignElement();let r=this._getCurrentFocusedToolbarDefinition();(!r||!t)&&(t=this._getFocusableCandidateToolbarDefinitions());for(let e=0;e<t.length;e++){let e=t.shift();if(t.push(e),e!==r&&this._focusFocusableCandidateToolbar(e)){r&&r.options.afterBlur&&r.options.afterBlur();break}}n()}),e.keystrokes.set(`Esc`,(t,n)=>{let r=this._getCurrentFocusedToolbarDefinition();r&&(this._lastFocusedForeignElement?(this._lastFocusedForeignElement.focus(),this._lastFocusedForeignElement=null):e.editing.view.focus(),r.options.afterBlur&&r.options.afterBlur(),n())})}_saveLastFocusedForeignElement(){let 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(){let e=[];for(let t of this._focusableToolbarDefinitions){let{toolbarView:n,options:r}=t;(Yr(n.element)||r.beforeFocus)&&e.push(t)}return e.sort((e,t)=>EC(e)-EC(t)),e}_getCurrentFocusedToolbarDefinition(){for(let e of this._focusableToolbarDefinitions)if(e.toolbarView.element&&e.toolbarView.element.contains(this.focusTracker.focusedElement))return e;return null}_focusFocusableCandidateToolbar(e){let{toolbarView:t,options:{beforeFocus:n}}=e;return n&&n(),Yr(t.element)?(t.focus(),!0):!1}_handleScrollToTheSelection(e,t){let n={top:0,bottom:0,left:0,right:0,...this.viewportOffset};t.viewportOffset.top+=n.top,t.viewportOffset.bottom+=n.bottom,t.viewportOffset.left+=n.left,t.viewportOffset.right+=n.right}_bindBodyCollectionWithFocusTracker(){let e=this.view.body;for(let 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,n)=>{let r=this._getVisualViewportTopOffset(n);n.visualTop!==r&&(e.return={...n,visualTop:r})}),this.set(`viewportOffset`,e)}_initVisualViewportSupport(){if(!u.window.visualViewport)return;let e=()=>{let e=this._getVisualViewportTopOffset(this.viewportOffset);this.viewportOffset.visualTop!==e&&(this.viewportOffset={...this.viewportOffset,visualTop:e})};this._domEmitter=new(br()),this._domEmitter.listenTo(u.window.visualViewport,`scroll`,e),this._domEmitter.listenTo(u.window.visualViewport,`resize`,e)}_getVisualViewportTopOffset(e){let t=ti().top,n=e.top||0;return t>n?0:n-t}};function EC(e){let{toolbarView:t,options:n}=e,r=10;return Yr(t.element)&&r--,n.isContextual&&(r-=2),r}var DC=class extends P{body;menuBarView;toolbar;constructor(e){super(e),this.body=new nb(e)}render(){super.render(),this.body.attachToDom()}destroy(){return this.body.detachFromDom(),super.destroy()}},OC=class extends DC{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(){let e=this.t,t=new eo;return t.text=e(`Rich Text Editor`),t.extendTemplate({attributes:{class:`ck-voice-label`}}),t}},kC=class extends P{name=null;_editingView;_editableElement;_hasExternalElement;constructor(e,t,n){super(e);let{name:r,classes:i,styles:a,attributes:o}=(AC(n)?void 0:n)||{};this.set(`isFocused`,!1),this.set(`isInlineRoot`,!1),this.setTemplate({tag:r||`div`,attributes:{...o,class:[`ck`,`ck-content`,`ck-editor__editable`,`ck-rounded-corners`,this.bindTemplate.if(`isInlineRoot`,`ck-editor__editable_inline-root`),...i?A(i):[]],...a&&{style:a},lang:e.contentLanguage,dir:e.contentLanguageDirection}}),this._editableElement=AC(n)?n:void 0,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(){let e=this._editingView;e.isRenderingInProgress?n(this):t(this);function t(t){e.change(n=>{let r=e.document.getRoot(t.name);n.addClass(t.isFocused?`ck-focused`:`ck-blurred`,r),n.removeClass(t.isFocused?`ck-blurred`:`ck-focused`,r)})}function n(r){e.once(`change:isRenderingInProgress`,(e,i,a)=>{a?n(r):t(r)})}}};function AC(e){return jn(e)}var jC=class extends kC{_options;constructor(e,t,n,r={}){super(e,t,n),this._options=r,this.extendTemplate({attributes:{role:`textbox`,class:`ck-editor__editable_inline`}})}render(){super.render();let e=this._editingView;e.change(t=>{let n=e.document.getRoot(this.name);t.setAttribute(`aria-label`,this.getEditableAriaLabel(),n)})}getEditableAriaLabel(){let e=this.locale.t,t=this._options.label,n=this._editableElement,r=this.name;if(typeof t==`string`)return t;if(typeof t==`object`)return t[r];if(typeof t==`function`)return t(this);if(n){let e=n.getAttribute(`aria-label`);if(e)return e}return e(`Rich Text Editor. Editing area: %0`,r)}},MC=class extends P{children;constructor(e,t={}){super(e);let n=this.bindTemplate;this.set(`class`,[`ck`,`ck-form__row`,...A(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:n.to(`class`,e=>e.join(` `)),role:n.to(`_role`),"aria-labelledby":n.to(`_ariaLabelledBy`)},children:this.children})}},NC=class extends P{constructor(e){super(e);let 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()))}},PC=class extends P{labelView;inputView;statusView;constructor(e,t){super(e);let n=`ck-input-${he()}`,r=`ck-status-${he()}`;this.set(`label`,void 0),this.set(`value`,void 0),this.set(`isReadOnly`,!1),this.set(`errorText`,null),this.set(`infoText`,null),this.labelView=this._createLabelView(n),this.inputView=this._createInputView(t,n,r),this.statusView=this._createStatusView(r),this.bind(`_statusText`).to(this,`errorText`,this,`infoText`,(e,t)=>e||t);let i=this.bindTemplate;this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-labeled-input`,i.if(`isReadOnly`,`ck-disabled`)]},children:[this.labelView,this.inputView,this.statusView]})}_createLabelView(e){let t=new eo(this.locale);return t.for=e,t.bind(`text`).to(this,`label`),t}_createInputView(e,t,n){let r=new e(this.locale,n);return r.id=t,r.ariaDescribedById=n,r.bind(`value`).to(this),r.bind(`isReadOnly`).to(this),r.bind(`hasError`).to(this,`errorText`,e=>!!e),r.on(`input`,()=>{this.errorText=null}),r}_createStatusView(e){let t=new P(this.locale),n=this.bindTemplate;return t.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-labeled-input__status`,n.if(`errorText`,`ck-labeled-input__status_error`),n.if(`_statusText`,`ck-hidden`,e=>!e)],id:e,role:n.if(`errorText`,`alert`)},children:[{text:n.to(`_statusText`)}]}),t}select(){this.inputView.select()}focus(){this.inputView.focus()}};function FC(e,t){let n=0,r=0;for(let i of t){let t=i,a=t.items,o=e&&!!t.label.match(e);t.labelView.highlightText(o?e:null);for(let t of a){let n=t.children.first,r=n.labelView;if(!e)t.isVisible=!0,r.highlightText(null);else{let i=!!n.label.match(e);r.highlightText(i?e:null),t.isVisible=o||i}}let s=a.filter(e=>e.isVisible).length;n+=t.items.length,r+=o?t.items.length:s,t.isVisible=o||!!s}return{resultsCount:r,totalItemsCount:n}}var IC=class extends ho{static get pluginName(){return`Notification`}static get isOfficialPlugin(){return!0}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){let t=e.namespace?`show:${e.type}:${e.namespace}`:`show:${e.type}`;this.fire(t,{message:e.message,type:e.type,title:e.title||``})}};const LC=D();var RC=class extends LC{constructor(e,t){super(),t&&fn(this,t),e&&this.set(e)}};const zC=Wr(`px`);var BC=class extends F{positionLimiter;visibleStack;_viewToStack=new Map;_idToStack=new Map;_view=null;_rotatorView=null;_fakePanelsView=null;static get pluginName(){return`ContextualBalloon`}static get isOfficialPlugin(){return!0}constructor(e){super(e),this.positionLimiter=()=>{let e=this.editor.editing.view,t=e.document.selection.editableElement;return t?e.domConverter.mapViewToDom(t.root):null},this.decorate(`getPositionOptions`),this.set(`visibleView`,null),this.set(`_numberOfStacks`,0),this.set(`_singleViewMode`,!1)}destroy(){super.destroy(),this._view&&this._view.destroy(),this._rotatorView&&this._rotatorView.destroy(),this._fakePanelsView&&this._fakePanelsView.destroy()}get view(){return this._view||this._createPanelView(),this._view}hasView(e){return Array.from(this._viewToStack.keys()).includes(e)}add(e){if(this._view||this._createPanelView(),this.hasView(e.view))throw new w(`contextualballoon-add-view-exist`,[this,e]);let t=e.stackId||`main`;if(!this._idToStack.has(t)){this._idToStack.set(t,new Map([[e.view,e]])),this._viewToStack.set(e.view,this._idToStack.get(t)),this._numberOfStacks=this._idToStack.size,(!this._visibleStack||e.singleViewMode)&&this.showStack(t);return}let n=this._idToStack.get(t);e.singleViewMode&&this.showStack(t),n.set(e.view,e),this._viewToStack.set(e.view,n),n===this._visibleStack&&this._showView(e)}remove(e){if(!this.hasView(e))throw new w(`contextualballoon-remove-view-not-exist`,[this,e]);let t=this._viewToStack.get(e);this._singleViewMode&&this.visibleView===e&&(this._singleViewMode=!1),this.visibleView===e&&(t.size===1?this._idToStack.size>1?this._showNextStack():(this.view.hide(),this.visibleView=null,this._rotatorView.hideView()):this._showView(Array.from(t.values())[t.size-2])),t.size===1?(this._idToStack.delete(this._getStackId(t)),this._numberOfStacks=this._idToStack.size):t.delete(e),this._viewToStack.delete(e)}updatePosition(e){e&&(this._visibleStack.get(this.visibleView).position=e),this.view.pin(this.getPositionOptions()),this._fakePanelsView.updatePosition()}getPositionOptions(){let e=Array.from(this._visibleStack.values()).pop().position;return e&&=(e.limiter||(e=Object.assign({},e,{limiter:this.positionLimiter})),Object.assign({},e,{viewportOffsetConfig:{...this.editor.ui.viewportOffset,top:this.editor.ui.viewportOffset.visualTop}})),e}showStack(e){this.visibleStack=e;let t=this._idToStack.get(e);if(!t)throw new w(`contextualballoon-showstack-stack-not-exist`,this);this._visibleStack!==t&&this._showView(Array.from(t.values()).pop())}_createPanelView(){this._view=new ab(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(){let e=Array.from(this._idToStack.values()),t=e.indexOf(this._visibleStack)+1;e[t]||(t=0),this.showStack(this._getStackId(e[t]))}_showPrevStack(){let e=Array.from(this._idToStack.values()),t=e.indexOf(this._visibleStack)-1;e[t]||(t=e.length-1),this.showStack(this._getStackId(e[t]))}_createRotatorView(){let e=new VC(this.editor.locale),t=this.editor.locale.t;return this.view.content.add(e),e.bind(`isNavigationVisible`).to(this,`_numberOfStacks`,this,`_singleViewMode`,(e,t)=>!t&&e>1),e.on(`change:isNavigationVisible`,()=>this.updatePosition(),{priority:`low`}),e.bind(`counter`).to(this,`visibleView`,this,`_numberOfStacks`,(e,n)=>n<2?``:t(`%0 of %1`,[Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1,n])),e.buttonNextView.on(`execute`,()=>{e.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showNextStack()}),e.buttonPrevView.on(`execute`,()=>{e.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showPrevStack()}),e}_createFakePanelsView(){let e=new HC(this.editor.locale,this.view);return e.bind(`numberOfPanels`).to(this,`_numberOfStacks`,this,`_singleViewMode`,(e,t)=>!t&&e>=2?Math.min(e-1,2):0),e.listenTo(this.view,`change:top`,()=>e.updatePosition()),e.listenTo(this.view,`change:left`,()=>e.updatePosition()),this.editor.ui.view.body.add(e),e}_showView({view:e,balloonClassName:t=``,withArrow:n=!0,singleViewMode:r=!1}){this.view.class=t,this.view.withArrow=n,this._rotatorView.showView(e),this.visibleView=e,this.view.pin(this.getPositionOptions()),this._fakePanelsView.updatePosition(),r&&(this._singleViewMode=!0)}},VC=class extends P{focusTracker;buttonPrevView;buttonNextView;content;constructor(e){super(e);let t=e.t,n=this.bindTemplate;this.set(`isNavigationVisible`,!0),this.focusTracker=new M,this.buttonPrevView=this._createButtonView(t(`Previous`),Wv),this.buttonNextView=this._createButtonView(t(`Next`),gv),this.content=this.createCollection(),this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-balloon-rotator`],"z-index":`-1`},children:[{tag:`div`,attributes:{class:[`ck-balloon-rotator__navigation`,n.to(`isNavigationVisible`,e=>e?``:`ck-hidden`)]},children:[this.buttonPrevView,{tag:`span`,attributes:{class:[`ck-balloon-rotator__counter`]},children:[{text:n.to(`counter`)}]},this.buttonNextView]},{tag:`div`,attributes:{class:`ck-balloon-rotator__content`},children:this.content}]})}render(){super.render(),this.focusTracker.add(this.element)}destroy(){super.destroy(),this.focusTracker.destroy()}showView(e){this.hideView(),this.content.add(e)}hideView(){this.content.clear()}_createButtonView(e,t){let n=new H(this.locale);return n.set({label:e,icon:t,tooltip:!0}),n}},HC=class extends P{content;_balloonPanelView;constructor(e,t){super(e);let n=this.bindTemplate;this.set(`top`,0),this.set(`left`,0),this.set(`height`,0),this.set(`width`,0),this.set(`numberOfPanels`,0),this.content=this.createCollection(),this._balloonPanelView=t,this.setTemplate({tag:`div`,attributes:{class:[`ck-fake-panel`,n.to(`numberOfPanels`,e=>e?``:`ck-hidden`)],style:{top:n.to(`top`,zC),left:n.to(`left`,zC),width:n.to(`width`,zC),height:n.to(`height`,zC)}},children:this.content}),this.on(`change:numberOfPanels`,(e,t,n,r)=>{n>r?this._addPanels(n-r):this._removePanels(r-n),this.updatePosition()})}_addPanels(e){for(;e--;){let e=new P;e.setTemplate({tag:`div`}),this.content.add(e),this.registerChild(e)}}_removePanels(e){for(;e--;){let e=this.content.last;this.content.remove(e),this.deregisterChild(e),e.destroy()}}updatePosition(){if(this.numberOfPanels){let{top:e,left:t}=this._balloonPanelView,{width:n,height:r}=new O(this._balloonPanelView.element);Object.assign(this,{top:e,left:t,width:n,height:r})}}};const UC=Wr(`px`);var WC=class extends P{content;contentPanelElement;_contentPanelPlaceholder;constructor(e){super(e);let t=this.bindTemplate;this.set(`isActive`,!1),this.set(`isSticky`,!1),this.set(`limiterElement`,null),this.set(`limiterBottomOffset`,50),this.set(`viewportTopOffset`,0),this.set(`_marginLeft`,null),this.set(`_isStickyToTheBottomOfLimiter`,!1),this.set(`_stickyTopOffset`,null),this.set(`_stickyBottomOffset`,null),this.content=this.createCollection(),this._contentPanelPlaceholder=new ga({tag:`div`,attributes:{class:[`ck`,`ck-sticky-panel__placeholder`],style:{display:t.to(`isSticky`,e=>e?`block`:`none`),height:t.to(`isSticky`,e=>e?UC(this._contentPanelRect.height):null)}}}).render(),this.contentPanelElement=new ga({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?UC(this._contentPanelPlaceholder.getBoundingClientRect().width):null),top:t.to(`_stickyTopOffset`,e=>e&&UC(e)),bottom:t.to(`_stickyBottomOffset`,e=>e&&UC(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(u.document,`scroll`,()=>{this.checkIfShouldBeSticky()},{useCapture:!0}),this.listenTo(this,`change:isActive`,()=>{this.checkIfShouldBeSticky()}),u.window.visualViewport&&(this.listenTo(u.window.visualViewport,`scroll`,()=>{this.checkIfShouldBeSticky()}),this.listenTo(u.window.visualViewport,`resize`,()=>{this.checkIfShouldBeSticky()}))}checkIfShouldBeSticky(){if(!this.limiterElement||!this.isActive){this._unstick();return}let e=new O(this.limiterElement),t=e.getVisible();if(t){let e=new O(u.window);e.top+=this.viewportTopOffset,e.height-=this.viewportTopOffset,t=t.getIntersection(e)}let{left:n,top:r}=ti();if(e.moveBy(n,r),t&&t.moveBy(n,r),t&&e.top<t.top)if(this._contentPanelRect.height+this.limiterBottomOffset>t.height){let n=Math.max(e.bottom-t.bottom,0)+this.limiterBottomOffset;this._contentPanelRect.height+n+1<e.height?this._stickToBottomOfLimiter(n):this._unstick()}else this._contentPanelRect.height+this.limiterBottomOffset<e.height?this._stickToTopOfAncestors(t.top):this._unstick();else this._unstick()}_stickToTopOfAncestors(e){this.isSticky=!0,this._isStickyToTheBottomOfLimiter=!1,this._stickyTopOffset=e,this._stickyBottomOffset=null,this._marginLeft=UC(-u.window.scrollX+ti().left)}_stickToBottomOfLimiter(e){this.isSticky=!0,this._isStickyToTheBottomOfLimiter=!0,this._stickyTopOffset=null,this._stickyBottomOffset=e,this._marginLeft=UC(-u.window.scrollX+ti().left)}_unstick(){this.isSticky=!1,this._isStickyToTheBottomOfLimiter=!1,this._stickyTopOffset=null,this._stickyBottomOffset=null,this._marginLeft=null}get _contentPanelRect(){return new O(this.contentPanelElement)}},GC=class extends Qb{iconView;resetButtonView;_viewConfig;constructor(e,t){let n=e.t,r=Object.assign({},{showResetButton:!0,showIcon:!0,creator:Jx},t);super(e,r.creator),this.label=t.label,this._viewConfig=r,this._viewConfig.showIcon&&(this.iconView=new Ly,this.iconView.content=lv,this.fieldWrapperChildren.add(this.iconView,0),this.extendTemplate({attributes:{class:`ck-search__query_with-icon`}})),this._viewConfig.showResetButton&&(this.resetButtonView=new H(e),this.resetButtonView.set({label:n(`Clear`),icon:s_,class:`ck-search__reset`,isVisible:!1,tooltip:!0}),this.resetButtonView.on(`execute`,()=>{this.reset(),this.focus(),this.fire(`reset`)}),this.resetButtonView.bind(`isVisible`).to(this.fieldView,`isEmpty`,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=!1)}},KC=class extends P{constructor(){super();let e=this.bindTemplate;this.set({isVisible:!1,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()}},qC=class extends P{focusTracker;children;_focusCycler;constructor(e){super(e),this.children=this.createCollection(),this.focusTracker=new M,this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-search__results`],tabindex:-1},children:this.children}),this._focusCycler=new Hy({focusables:this.children,focusTracker:this.focusTracker})}render(){super.render();for(let e of this.children)this.focusTracker.add(e.element)}focus(){this._focusCycler.focusFirst()}focusFirst(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}},JC=class extends P{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 M,this.keystrokes=new N,this.resultsView=new qC(e),this.children=this.createCollection(),this.focusableChildren=this.createCollection([this.queryView,this.resultsView]),this.set(`isEnabled`,!0),this.set(`resultsCount`,0),this.set(`totalItemsCount`,0),t.infoView&&t.infoView.instance?this.infoView=t.infoView.instance:(this.infoView=new KC,this._enableDefaultInfoViewBehavior(),this.on(`render`,()=>{this.search(``)})),this.resultsView.children.addMany([this.infoView,this.filteredView]),this.focusCycler=new Hy({focusables:this.focusableChildren,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:`shift + tab`,focusNext:`tab`}}),this.on(`search`,(e,{resultsCount:t,totalItemsCount:n})=>{this.resultsCount=t,this.totalItemsCount=n}),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]);let e=e=>e.stopPropagation();for(let 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){let t=e?new RegExp(Bn(e),`ig`):null,n=this.filteredView.filter(t);this.fire(`search`,{query:e,...n})}_createSearchTextQueryView(){let e=new GC(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(){let e=this.locale.t,t=this.infoView;this.on(`search`,(r,i)=>{if(i.resultsCount)t.set({isVisible:!1});else{let r=this._config.infoView&&this._config.infoView.text,a,o;i.totalItemsCount?r?.notFound?(a=r.notFound.primary,o=r.notFound.secondary):(a=e(`No results found`),o=``):r?.noSearchableItems?(a=r.noSearchableItems.primary,o=r.noSearchableItems.secondary):(a=e(`No searchable items`),o=``),t.set({primaryText:n(a,i),secondaryText:n(o,i),isVisible:!0})}});function n(e,{query:t,resultsCount:n,totalItemsCount:r}){return typeof e==`function`?e(t,n,r):e}}},YC=class e extends JC{_config;constructor(e,t){super(e,t),this._config=t;let n=Wr(`px`);this.extendTemplate({attributes:{class:[`ck-autocomplete`]}});let r=this.resultsView.bindTemplate;this.resultsView.set(`isVisible`,!1),this.resultsView.set(`_position`,`s`),this.resultsView.set(`_width`,0),this.resultsView.extendTemplate({attributes:{class:[r.if(`isVisible`,`ck-hidden`,e=>!e),r.to(`_position`,e=>`ck-search__results_${e}`)],style:{width:r.to(`_width`,n)}}}),this.focusTracker.on(`change:isFocused`,(e,n,r)=>{this._updateResultsVisibility(),r?this.resultsView.element.scrollTop=0:t.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=!1,t())}),this.listenTo(u.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=!1}),this.resultsView.on(`change:isVisible`,()=>{this._updateResultsViewWidthAndPosition()})}_updateResultsViewWidthAndPosition(){if(!this.resultsView.isVisible)return;this.resultsView._width=new O(this.queryView.fieldView.element).width;let t=e._getOptimalPosition({element:this.resultsView.element,target:this.queryView.element,fitInViewport:!0,positions:e.defaultResultsPositions});this.resultsView._position=t?t.name:`s`}_updateResultsVisibility(){let e=this._config.queryMinChars===void 0?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=Xr},XC=class extends P{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(Rn(this.text||``))}),this._updateInnerHTML(Rn(this.text||``))})}highlightText(e){this._updateInnerHTML(ZC(this.text||``,e))}_updateInnerHTML(e){this.element.innerHTML=e||``}};function ZC(e,t){if(!t)return Rn(e);let n=[],r=0,i=t.exec(e);for(;i!==null;){let a=i.index;a!==r&&n.push({text:e.substring(r,a),isMatch:!1}),n.push({text:i[0],isMatch:!0}),r=t.lastIndex,i=t.exec(e)}return r!==e.length&&n.push({text:e.substring(r),isMatch:!1}),n.map(e=>(e.text=Rn(e.text),e)).map(e=>e.isMatch?`<mark>${e.text}</mark>`:e.text).join(``)}var QC=class extends XC{constructor(){super(),this.set({style:void 0,text:void 0,id:void 0});let e=this.bindTemplate;this.extendTemplate({attributes:{class:[`ck-button__label`],style:e.to(`style`),id:e.to(`id`)}})}},$C=class extends XC{id;constructor(){super(),this.set(`for`,void 0);let e=this.bindTemplate;this.id=`ck-editor__label_${he()}`,this.extendTemplate({attributes:{class:[`ck`,`ck-label`],id:this.id,for:e.to(`for`)}})}},ew=class extends P{constructor(){super(),this.set(`isVisible`,!1);let 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 tw=Wr(`px`);var nw=class extends F{toolbarView;focusTracker;_balloonConfig;_resizeObserver=null;_balloon;_fireSelectionChangeDebounced;static get pluginName(){return`BalloonToolbar`}static get isOfficialPlugin(){return!0}static get requires(){return[BC]}constructor(e){super(e),this._balloonConfig=Ex(e.config.get(`balloonToolbar`)),this.toolbarView=this._createToolbarView(),this.focusTracker=new M,this._trackFocusableEditableElements(),this.focusTracker.add(this.toolbarView),e.ui.addToolbar(this.toolbarView,{beforeFocus:()=>this.show(!0),afterBlur:()=>this.hide(),isContextual:!0}),this._balloon=e.plugins.get(BC),this._fireSelectionChangeDebounced=Kt(()=>this.fire(`_selectionChangeDebounced`),200),this.decorate(`show`)}init(){let e=this.editor,t=e.model.document.selection;this.listenTo(this.focusTracker,`change:isFocused`,(e,t,n)=>{!n&&this._isToolbarVisible?this.hide():n&&this.show()}),this.listenTo(t,`change:range`,(e,n)=>{(n.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`,()=>{let t=e.ui.view.editable.element;this._resizeObserver=new Hr(t,e=>{this.toolbarView.maxWidth=tw(e.contentRect.width*.9)})}),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(){let e=this.editor.locale.t,t=!this._balloonConfig.shouldNotGroupWhenFull,n=new Ox(this.editor.locale,{shouldGroupWhenFull:t,isFloating:!0});return n.ariaLabel=e(`Editor contextual toolbar`),n.render(),n}show(e=!1){let t=this.editor,n=t.model.document.selection,r=t.model.schema;this._balloon.hasView(this.toolbarView)||n.isCollapsed&&!e||rw(n,r)||Array.from(this.toolbarView.items).every(e=>e.isEnabled!==void 0&&!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(){let{editor:e,focusTracker:t}=this,{editing:n}=e;n.view.addObserver(class extends kc{observe(e){t.add(e)}stopObserving(e){t.remove(e)}})}_getBalloonPositionData(){let e=this.editor.editing.view,t=e.document,n=t.selection,r=t.selection.isBackward;return{target:()=>{let t=r?n.getFirstRange():n.getLastRange(),i=O.getDomRangeRects(e.domConverter.viewRangeToDom(t));return r?i[0]:(i.length>1&&i[i.length-1].width===0&&i.pop(),i[i.length-1])},positions:this._getBalloonPositions(r)}}_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(e){let t=p.isSafari&&p.isiOS?ab.generatePositions({heightOffset:Math.max(ab.arrowHeightOffset,Math.round(20/u.window.visualViewport.scale))}):ab.defaultPositions;return e?[t.northWestArrowSouth,t.northWestArrowSouthWest,t.northWestArrowSouthEast,t.northWestArrowSouthMiddleEast,t.northWestArrowSouthMiddleWest,t.southWestArrowNorth,t.southWestArrowNorthWest,t.southWestArrowNorthEast,t.southWestArrowNorthMiddleWest,t.southWestArrowNorthMiddleEast]:[t.southEastArrowNorth,t.southEastArrowNorthEast,t.southEastArrowNorthWest,t.southEastArrowNorthMiddleEast,t.southEastArrowNorthMiddleWest,t.northEastArrowSouth,t.northEastArrowSouthEast,t.northEastArrowSouthWest,t.northEastArrowSouthMiddleEast,t.northEastArrowSouthMiddleWest]}};function rw(e,t){return e.rangeCount===1?!1:[...e.getRanges()].every(e=>{let n=e.getContainedElement();return n&&t.isSelectable(n)})}const iw=Wr(`px`);var aw=class extends H{constructor(e){super(e);let t=this.bindTemplate;this.isVisible=!1,this.isToggleable=!0,this.set(`top`,0),this.set(`left`,0),this.extendTemplate({attributes:{class:`ck-block-toolbar-button`,style:{top:t.to(`top`,e=>iw(e)),left:t.to(`left`,e=>iw(e))}}})}};const ow=Wr(`px`);var sw=class extends F{toolbarView;panelView;buttonView;_resizeObserver=null;_blockToolbarConfig;static get pluginName(){return`BlockToolbar`}static get isOfficialPlugin(){return!0}constructor(e){super(e),this._blockToolbarConfig=Ex(this.editor.config.get(`blockToolbar`)),this.toolbarView=this._createToolbarView(),this.panelView=this._createPanelView(),this.buttonView=this._createButtonView(),Ya({emitter:this.panelView,contextElements:[this.panelView.element,this.buttonView.element],activator:()=>this.panelView.isVisible,callback:()=>this._hidePanel()})}init(){let e=this.editor,t=e.t,n=t(`Click to edit block`),r=t(`Drag to move`),i=t(`Edit block`),a=e.plugins.has(`DragDropBlockToolbar`),o=a?`${n}\n${r}`:i;this.buttonView.label=o,a&&(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,n)=>{n?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(let e of this.toolbarView.items)e.on(`execute`,()=>this._hidePanel(!0),{priority:`high`})})}destroy(){super.destroy(),this.panelView.destroy(),this.buttonView.destroy(),this.toolbarView.destroy(),this._resizeObserver&&this._resizeObserver.destroy()}_createToolbarView(){let e=this.editor.locale.t,t=!this._blockToolbarConfig.shouldNotGroupWhenFull,n=new Ox(this.editor.locale,{shouldGroupWhenFull:t,isFloating:!0});return n.ariaLabel=e(`Editor block content toolbar`),n}_createPanelView(){let e=this.editor,t=new ab(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(!0),t()}),t}_createButtonView(){let e=this.editor,t=e.t,n=new aw(e.locale),r=this._blockToolbarConfig.icon,i=Dx[r]||r||Dx.dragIndicator;return n.set({label:t(`Edit block`),icon:i,withText:!1}),n.bind(`isOn`).to(this.panelView,`isVisible`),n.bind(`tooltip`).to(this.panelView,`isVisible`,e=>!e),this.listenTo(n,`execute`,()=>{this.panelView.isVisible?this._hidePanel(!0):this._showPanel()}),this.listenTo(n,`change:isEnabled`,(e,t,n)=>{!n&&this.panelView.isVisible&&this._hidePanel(!1)}),e.ui.view.body.add(n),n}_updateButton(){let e=this.editor,t=e.model,n=e.editing.view;if(!e.ui.focusTracker.isFocused){this._hideButton();return}if(!e.model.canEditAt(e.model.document.selection)){this._hideButton();return}let r=Array.from(t.document.selection.getSelectedBlocks())[0];if(!r||Array.from(this.toolbarView.items).every(e=>!e.isEnabled)){this._hideButton();return}let i=n.domConverter.mapViewToDom(e.editing.mapper.toViewElement(r));this.buttonView.isVisible=!0,this._setupToolbarResize(),this._attachButtonToElement(i),this.panelView.isVisible&&this._showPanel()}_hideButton(){this.buttonView.isVisible=!1}_showPanel(){if(!this.buttonView.isVisible)return;let e=this.panelView.isVisible;this.panelView.show();let 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(){let e=this.editor.model.document.selection.getFirstRange().root.rootName;return this.editor.ui.getEditableElement(e)}_hidePanel(e){this.panelView.isVisible=!1,e&&this.editor.editing.view.focus()}_repositionButtonOnScroll(){let{buttonView:e}=this,t=!1,n=(e,n)=>{if(t)return;let r=this._getSelectedEditableElement();n.target!==u.document&&!Tr(r).includes(n.target)||(t=!0,u.window.requestAnimationFrame(()=>{this._updateButton(),t=!1}))};e.on(`change:isVisible`,(t,r,i)=>{i?e.listenTo(u.document,`scroll`,n,{useCapture:!0,usePassive:!0}):e.stopListening(u.document,`scroll`,n)})}_attachButtonToElement(e){let t=this.buttonView.element,n=this._getSelectedEditableElement(),r=window.getComputedStyle(e),i=new O(n),a=parseInt(r.paddingTop,10),o=parseInt(r.lineHeight,10)||parseInt(r.fontSize,10)*1.2,s=new O(t),c=new O(e),l;l=this.editor.locale.uiLanguageDirection===`ltr`?i.left-s.width:i.right;let u=c.top+a+(o-s.height)/2;s.moveTo(l,u);let d=s.toAbsoluteRect();this.buttonView.top=d.top,this.buttonView.left=d.left,this._clipButtonToViewport(this.buttonView,n)}_clipButtonToViewport(e,t){let n=new O(e.element),r=new O(t).getVisible(),i=(...t)=>{e.element.style.clipPath=t.length?`polygon(${t.join(`,`)})`:``},a=t=>{e.isEnabled=!t,e.element.style.pointerEvents=t?`none`:``};if(r&&r.bottom<n.bottom){let e=Math.min(n.height,n.bottom-r.bottom);a(e>=n.height),i(`0 0`,`100% 0`,`100% calc(100% - ${ow(e)})`,`0 calc(100% - ${ow(e)}`)}else if(r&&r.top>n.top){let e=Math.min(n.height,r.top-n.top);a(e>=n.height),i(`0 ${ow(e)}`,`100% ${ow(e)}`,`100% 100%`,`0 100%`)}else a(!1),i()}_setupToolbarResize(){let e=this._getSelectedEditableElement();this._blockToolbarConfig.shouldNotGroupWhenFull||(this._resizeObserver&&this._resizeObserver.element!==e&&(this._resizeObserver.destroy(),this._resizeObserver=null),this._resizeObserver||=new Hr(e,()=>{this.toolbarView.maxWidth=this._getToolbarMaxWidth(e)}))}_getToolbarMaxWidth(e){let t=new O(e),n=new O(this.buttonView.element),r=this.editor.locale.uiLanguageDirection===`rtl`?n.left-t.right+n.width:t.left-n.left;return ow(t.width+r)}},cw=class extends $y{arrowView;constructor(e){super(e);let t=this.bindTemplate;this.set({withText:!0,role:`menuitem`}),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{class:[`ck-menu-bar__menu__button`],"aria-haspopup":!0,"aria-expanded":this.bindTemplate.to(`isOn`,e=>String(e)),"data-cke-tooltip-disabled":t.to(`isOn`)},on:{mouseenter:t.to(`mouseenter`)}})}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){let e=new Ly;return e.content=b_,e.extendTemplate({attributes:{class:`ck-menu-bar__menu__button__arrow`}}),e}},lw=class extends P{children;constructor(e){super(e);let t=this.bindTemplate;this.set(`isVisible`,!1),this.set(`position`,`se`),this.children=this.createCollection(),this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-reset`,`ck-menu-bar__menu__panel`,t.to(`position`,e=>`ck-menu-bar__menu__panel_position_${e}`),t.if(`isVisible`,`ck-hidden`,e=>!e)],tabindex:`-1`},children:this.children,on:{selectstart:t.to(e=>{e.target.tagName.toLocaleLowerCase()!==`input`&&e.preventDefault()})}})}focus(e=1){this.children.length&&(e===1?this.children.first.focus():this.children.last.focus())}},uw=class e extends P{buttonView;panelView;focusTracker;keystrokes;constructor(e){super(e);let t=this.bindTemplate;this.buttonView=new cw(e),this.buttonView.delegate(`mouseenter`).to(this),this.buttonView.bind(`isOn`,`isEnabled`).to(this,`isOpen`,`isEnabled`),this.panelView=new lw(e),this.panelView.bind(`isVisible`).to(this,`isOpen`),this.keystrokes=new N,this.focusTracker=new M,this.set(`isOpen`,!1),this.set(`isEnabled`,!0),this.set(`panelPosition`,`w`),this.set(`class`,void 0),this.set(`parentMenuView`,null),this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-menu-bar__menu`,t.to(`class`),t.if(`isEnabled`,`ck-disabled`,e=>!e),t.if(`parentMenuView`,`ck-menu-bar__menu_top-level`,e=>!e)]},children:[this.buttonView,this.panelView]})}render(){super.render(),this.focusTracker.add(this.buttonView.element),this.focusTracker.add(this.panelView.element),this.keystrokes.listenTo(this.element),aC.closeOnEscKey(this),this._closeOnDisabled(),this._repositionPanelOnOpen()}_attachBehaviors(){this.parentMenuView?(aC.openOnButtonClick(this),aC.openOnArrowRightKey(this),aC.closeOnArrowLeftKey(this),aC.openAndFocusOnEnterKeyPress(this),aC.closeOnParentClose(this)):(this._propagateArrowKeystrokeEvents(),aC.openAndFocusPanelOnArrowDownKey(this),aC.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,n)=>{n||(this.isOpen=!1)})}_repositionPanelOnOpen(){this.on(`change:isOpen`,(t,n,r)=>{if(!r)return;let i=e._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions});this.panelView.position=i?i.name:this._defaultMenuPositionName})}focus(){this.buttonView.focus()}get _panelPositions(){let{southEast:e,southWest:t,northEast:n,northWest:r,westSouth:i,eastSouth:a,westNorth:o,eastNorth:s}=oC;return this.locale.uiLanguageDirection===`ltr`?this.parentMenuView?[a,s,i,o]:[e,t,n,r]:this.parentMenuView?[i,o,a,s]:[t,e,r,n]}get _defaultMenuPositionName(){return this.locale.uiLanguageDirection===`ltr`?this.parentMenuView?`es`:`se`:this.parentMenuView?`ws`:`sw`}static _getOptimalPosition=Xr},dw=class extends mx{constructor(e){super(e),this.role=`menu`,this.items.on(`change`,this._setItemsCheckSpace.bind(this))}_setItemsCheckSpace(){let e=Array.from(this.items).some(e=>{let t=fw(e);return t&&t.isToggleable});this.items.forEach(t=>{let n=fw(t);n&&(n.hasCheckSpace=e)})}};function fw(e){return e instanceof dx?e.children.map(e=>pw(e)?e.buttonView:e).find(e=>e instanceof $y):null}function pw(e){return typeof e==`object`&&`buttonView`in e&&e.buttonView instanceof H}var mw=class extends vb{constructor(e){super(e),this.set({withText:!0,withKeystroke:!0,tooltip:!1,role:`menuitem`}),this.extendTemplate({attributes:{class:[`ck-menu-bar__menu__item__button`]}})}};const hw=[`mouseenter`,`arrowleft`,`arrowright`,`change:isOpen`];var gw=class extends P{children;menus=[];constructor(e){super(e);let t=e.t,n=this.bindTemplate;this.set({isOpen:!1,isFocusBorderEnabled:!1}),this._setupIsOpenUpdater(),this.children=this.createCollection(),this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-menu-bar`,n.if(`isFocusBorderEnabled`,`ck-menu-bar_focus-border-enabled`)],"aria-label":t(`Editor menu bar`),role:`menubar`},children:this.children})}fillFromConfig(e,t,n=[]){let r=this.locale,i=lC({normalizedConfig:e,locale:r,componentFactory:t,extraItems:n}).items.map(e=>this._createMenu({componentFactory:t,menuDefinition:e}));this.children.addMany(i)}render(){super.render(),iC.toggleMenusAndFocusItemsOnHover(this),iC.closeMenusWhenTheBarCloses(this),iC.closeMenuWhenAnotherOnTheSameLevelOpens(this),iC.focusCycleMenusOnArrows(this),iC.closeOnClickOutside(this),iC.enableFocusHighlightOnInteraction(this)}focus(){this.children.first&&this.children.first.focus()}close(){for(let e of this.children)e.isOpen=!1;this.isOpen=!1}disable(){for(let e of this.children)e.isEnabled=!1}enable(){for(let e of this.children)e.isEnabled=!0}registerMenu(e,t=null){t?(e.delegate(...hw).to(t),e.parentMenuView=t):e.delegate(...hw).to(this,e=>`menu:`+e),e._attachBehaviors(),this.menus.push(e)}_createMenu({componentFactory:e,menuDefinition:t,parentMenuView:n}){let r=this.locale,i=new uw(r);return this.registerMenu(i,n),i.buttonView.set({label:t.label}),i.once(`change:isOpen`,()=>{let n=new dw(r);n.ariaLabel=t.label,i.panelView.children.add(n),n.items.addMany(this._createMenuItems({menuDefinition:t,parentMenuView:i,componentFactory:e}))}),i}_createMenuItems({menuDefinition:e,parentMenuView:t,componentFactory:n}){let r=this.locale,i=[];for(let a of e.groups){for(let e of a.items){let a=new rC(r,t);if(Xe(e))a.children.add(this._createMenu({componentFactory:n,menuDefinition:e,parentMenuView:t}));else{let r=this._createMenuItemContentFromFactory({componentName:e,componentFactory:n,parentMenuView:t});if(!r)continue;a.children.add(r)}i.push(a)}a!==e.groups[e.groups.length-1]&&i.push(new fx(r))}return i}_createMenuItemContentFromFactory({componentName:e,parentMenuView:t,componentFactory:n}){let r=n.create(e);return r instanceof uw||r instanceof U||r instanceof mw?(this._registerMenuTree(r,t),r.on(`execute`,()=>{this.close()}),r):(T(`menu-bar-component-unsupported`,{componentName:e,componentView:r}),null)}_registerMenuTree(e,t){if(!(e instanceof uw)){e.delegate(`mouseenter`).to(t);return}this.registerMenu(e,t);let n=e.panelView.children.filter(e=>e instanceof dw)[0];if(!n){e.delegate(`mouseenter`).to(t);return}let r=n.items.filter(e=>e instanceof dx);for(let t of r)this._registerMenuTree(t.children.get(0),e)}_setupIsOpenUpdater(){let e;this.on(`menu:change:isOpen`,(t,n,r)=>{clearTimeout(e),r?this.isOpen=!0:e=setTimeout(()=>{this.isOpen=Array.from(this.children).some(e=>e.isOpen)},0)})}};const _w=D();var vw=class extends _w{total;_reader;_data;constructor(){super();let 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){let t=this._reader;return this.total=e.size,new Promise((n,r)=>{t.onload=()=>{let e=t.result;this._data=e,n(e)},t.onerror=()=>{r(`error`)},t.onabort=()=>{r(`aborted`)},this._reader.readAsDataURL(e)})}abort(){this._reader.abort()}};const yw=D();var bw=class extends F{loaders=new Fi;_loadersMap=new Map;_pendingAction=null;static get pluginName(){return`FileRepository`}static get isOfficialPlugin(){return!0}static get requires(){return[wg]}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 T(`filerepository-no-upload-adapter`),null;let t=new xw(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(let t of this.loaders)e+=t.uploaded;this.uploaded=e}),t.on(`change:uploadTotal`,()=>{let e=0;for(let t of this.loaders)t.uploadTotal&&(e+=t.uploadTotal);this.uploadTotal=e}),t}destroyLoader(e){let t=e instanceof xw?e:this.getLoader(e);t._destroy(),this.loaders.remove(t),this._loadersMap.forEach((e,n)=>{e===t&&this._loadersMap.delete(n)})}_updatePendingAction(){let e=this.editor.plugins.get(wg);if(this.loaders.length){if(!this._pendingAction){let t=this.editor.t,n=e=>`${t(`Upload in progress`)} ${parseInt(e)}%.`;this._pendingAction=e.add(n(this.uploadedPercent)),this._pendingAction.bind(`message`).to(this,`uploadedPercent`,n)}}else e.remove(this._pendingAction),this._pendingAction=null}},xw=class extends yw{id;_filePromiseWrapper;_adapter;_reader;constructor(e,t){super(),this.id=he(),this._filePromiseWrapper=this._createFilePromiseWrapper(e),this._adapter=t(this),this._reader=new vw,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(this.status!=`idle`)throw new w(`filerepository-read-wrong-status`,this);return this.status=`reading`,this.file.then(e=>this._reader.read(e)).then(e=>{if(this.status!==`reading`)throw this.status;return this.status=`idle`,e}).catch(e=>{throw e===`aborted`?(this.status=`aborted`,`aborted`):(this.status=`error`,this._reader.error?this._reader.error:e)})}upload(){if(this.status!=`idle`)throw new w(`filerepository-upload-wrong-status`,this);return this.status=`uploading`,this.file.then(()=>this._adapter.upload()).then(e=>(this.uploadResponse=e,this.status=`idle`,e)).catch(e=>{throw this.status===`aborted`?`aborted`:(this.status=`error`,e)})}abort(){let e=this.status;this.status=`aborted`,this._filePromiseWrapper.isFulfilled?e==`reading`?this._reader.abort():e==`uploading`&&this._adapter.abort&&this._adapter.abort():(this._filePromiseWrapper.promise.catch(()=>{}),this._filePromiseWrapper.rejecter(`aborted`)),this._destroy()}_destroy(){this._filePromiseWrapper=void 0,this._reader=void 0,this._adapter=void 0,this.uploadResponse=void 0}_createFilePromiseWrapper(e){let t={};return t.promise=new Promise((n,r)=>{t.rejecter=r,t.isFulfilled=!1,e.then(e=>{t.isFulfilled=!0,n(e)}).catch(e=>{t.isFulfilled=!0,r(e)})}),t}},Sw=class extends F{static get requires(){return[bw]}static get pluginName(){return`Base64UploadAdapter`}static get licenseFeatureCode(){return`B64A`}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}init(){this.editor.plugins.get(bw).createUploadAdapter=e=>new Cw(e)}},Cw=class{loader;reader;constructor(e){this.loader=e}upload(){return new Promise((e,t)=>{let n=this.reader=new window.FileReader;n.addEventListener(`load`,()=>{e({default:n.result})}),n.addEventListener(`error`,e=>{t(e)}),n.addEventListener(`abort`,()=>{t()}),this.loader.file.then(e=>{n.readAsDataURL(e)})})}abort(){this.reader.abort()}},ww=class extends F{static get requires(){return[bw]}static get pluginName(){return`SimpleUploadAdapter`}static get licenseFeatureCode(){return`SUA`}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}init(){let e=this.editor.config.get(`simpleUpload`);if(e){if(!e.uploadUrl){T(`simple-upload-adapter-missing-uploadurl`);return}this.editor.plugins.get(bw).createUploadAdapter=t=>new Tw(t,e)}}},Tw=class{loader;options;xhr;constructor(e,t){this.loader=e,this.options=t}upload(){return this.loader.file.then(e=>new Promise((t,n)=>{this._initRequest(),this._initListeners(t,n,e),this._sendRequest(e)}))}abort(){this.xhr&&this.xhr.abort()}_initRequest(){let e=this.xhr=new XMLHttpRequest;e.open(`POST`,this.options.uploadUrl,!0),e.responseType=`json`}_initListeners(e,t,n){let r=this.xhr,i=this.loader,a=`Couldn't upload file: ${n.name}.`;r.addEventListener(`error`,()=>t(a)),r.addEventListener(`abort`,()=>t()),r.addEventListener(`load`,()=>{let n=r.response;if(!n||n.error)return t(n&&n.error&&n.error.message?n.error.message:a);let i=n.url?{default:n.url}:n.urls;e({...n,urls:i})}),r.upload&&r.upload.addEventListener(`progress`,e=>{e.lengthComputable&&(i.uploadTotal=e.total,i.uploaded=e.loaded)})}_sendRequest(e){let t=this.options.headers||{};typeof t==`function`&&(t=t(e));let n=this.options.withCredentials||!1;for(let e of Object.keys(t))this.xhr.setRequestHeader(e,t[e]);this.xhr.withCredentials=n;let r=new FormData;r.append(`upload`,e),this.xhr.send(r)}};const Ew=`ckCsrfToken`;function Dw(){let e=Ow(Ew);return(!e||e.length!=40)&&(e=Aw(40),kw(Ew,e)),e}function Ow(e){e=e.toLowerCase();let t=document.cookie.split(`;`);for(let n of t){let t=n.split(`=`);if(decodeURIComponent(t[0].trim().toLowerCase())===e)return decodeURIComponent(t[1])}return null}function kw(e,t){document.cookie=encodeURIComponent(e)+`=`+encodeURIComponent(t)+`;path=/`}function Aw(e){let t=``,n=new Uint8Array(e);window.crypto.getRandomValues(n);for(let e=0;e<n.length;e++){let r=`abcdefghijklmnopqrstuvwxyz0123456789`.charAt(n[e]%36);t+=Math.random()>.5?r.toUpperCase():r}return t}var jw=class extends F{static get requires(){return[bw]}static get pluginName(){return`CKFinderUploadAdapter`}static get isOfficialPlugin(){return!0}init(){let e=this.editor.config.get(`ckfinder.uploadUrl`);e&&(this.editor.plugins.get(bw).createUploadAdapter=t=>new Mw(t,e,this.editor.t))}},Mw=class{loader;url;t;xhr;constructor(e,t,n){this.loader=e,this.url=t,this.t=n}upload(){return this.loader.file.then(e=>new Promise((t,n)=>{this._initRequest(),this._initListeners(t,n,e),this._sendRequest(e)}))}abort(){this.xhr&&this.xhr.abort()}_initRequest(){let e=this.xhr=new XMLHttpRequest;e.open(`POST`,this.url,!0),e.responseType=`json`}_initListeners(e,t,n){let r=this.xhr,i=this.loader,a=this.t,o=a(`Cannot upload file:`)+` ${n.name}.`;r.addEventListener(`error`,()=>t(o)),r.addEventListener(`abort`,()=>t()),r.addEventListener(`load`,()=>{let n=r.response;if(!n||!n.uploaded)return t(n&&n.error&&n.error.message?n.error.message:o);e({default:n.url})}),r.upload&&r.upload.addEventListener(`progress`,e=>{e.lengthComputable&&(i.uploadTotal=e.total,i.uploaded=e.loaded)})}_sendRequest(e){let t=new FormData;t.append(`upload`,e),t.append(`ckCsrfToken`,Dw()),this.xhr.send(t)}};const Nw=[`left`,`right`,`center`,`justify`];function Pw(e){return Nw.includes(e)}function Fw(e,t){return t.contentLanguageDirection==`rtl`?e===`right`:e===`left`}function Iw(e){let t=e.map(e=>{let t;return t=typeof e==`string`?{name:e}:e,t}).filter(e=>{let t=Nw.includes(e.name);return t||T(`alignment-config-name-not-recognized`,{option:e}),t}),n=t.filter(e=>!!e.className).length;if(n&&n<t.length)throw new w(`alignment-config-classnames-are-missing`,{configuredOptions:e});return t.forEach((t,n,r)=>{let i=r.slice(n+1);if(i.some(e=>e.name==t.name))throw new w(`alignment-config-name-already-defined`,{option:t,configuredOptions:e});if(t.className&&i.some(e=>e.className==t.className))throw new w(`alignment-config-classname-already-defined`,{option:t,configuredOptions:e})}),t}const Lw=`alignment`;var Rw=class extends I{refresh(){let e=this.editor.locale,t=j(this.editor.model.document.selection.getSelectedBlocks());this.isEnabled=!!t&&this._canBeAligned(t),this.isEnabled&&t.hasAttribute(`alignment`)?this.value=t.getAttribute(`alignment`):this.value=e.contentLanguageDirection===`rtl`?`right`:`left`}execute(e={}){let t=this.editor,n=t.locale,r=t.model,i=r.document,a=e.value;r.change(e=>{let t=Array.from(i.selection.getSelectedBlocks()).filter(e=>this._canBeAligned(e)),r=t[0].getAttribute(`alignment`);Fw(a,n)||r===a||!a?zw(t,e):Bw(t,e,a)})}_canBeAligned(e){return this.editor.model.schema.checkAttribute(e,Lw)}};function zw(e,t){for(let n of e)t.removeAttribute(Lw,n)}function Bw(e,t,n){for(let r of e)t.setAttribute(Lw,n,r)}var Vw=class extends F{static get pluginName(){return`AlignmentEditing`}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(`alignment`,{options:Nw.map(e=>({name:e}))})}init(){let e=this.editor,t=e.locale,n=e.model.schema,r=Iw(e.config.get(`alignment.options`)).filter(e=>Pw(e.name)&&!Fw(e.name,t)),i=r.some(e=>!!e.className);n.extend(`$block`,{allowAttributes:`alignment`}),e.model.schema.setAttributeProperties(`alignment`,{isFormatting:!0,blockAlignment:Hw(t)}),i?e.conversion.attributeToAttribute(Kw(r)):e.conversion.for(`downcast`).attributeToAttribute(Uw(r));let a=Ww(r);for(let t of a)e.conversion.for(`upcast`).attributeToAttribute(t);let o=Gw(r);for(let t of o)e.conversion.for(`upcast`).attributeToAttribute(t);e.commands.add(`alignment`,new Rw(e))}};function Hw(e){let t={left:{value:`left`},right:{value:`right`},center:{value:`center`},justify:{value:`justify`}},n=e.contentLanguageDirection==`rtl`?`right`:`left`;return t[n].isDefault=!0,t}function Uw(e){let t={};for(let{name:n}of e)t[n]={key:`style`,value:{"text-align":n}};return{model:{key:`alignment`,values:e.map(e=>e.name)},view:t}}function Ww(e){let t=[];for(let{name:n}of e)t.push({view:{key:`style`,value:{"text-align":n}},model:{key:`alignment`,value:n}});return t}function Gw(e){let t=[];for(let{name:n}of e)t.push({view:{key:`align`,value:n},model:{key:`alignment`,value:n}});return t}function Kw(e){let t={};for(let n of e)t[n.name]={key:`class`,value:n.className};return{model:{key:`alignment`,values:e.map(e=>e.name)},view:t}}const qw=new Map([[`left`,Gg],[`right`,qg],[`center`,Ug],[`justify`,Wg]]);var Jw=class extends F{get localizedOptionTitles(){let 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!0}init(){let e=this.editor,t=Iw(e.config.get(`alignment.options`));t.map(e=>e.name).filter(Pw).forEach(e=>this._addButton(e)),this._addToolbarDropdown(t),this._addMenuBarMenu(t)}_addButton(e){this.editor.ui.componentFactory.add(`alignment:${e}`,t=>this._createButton(t,e))}_createButton(e,t,n={}){let r=this.editor,i=r.commands.get(`alignment`),a=new H(e);return a.set({label:this.localizedOptionTitles[t],icon:qw.get(t),tooltip:!0,isToggleable:!0,...n}),a.bind(`isEnabled`).to(i),a.bind(`isOn`).to(i,`value`,e=>e===t),this.listenTo(a,`execute`,()=>{r.execute(`alignment`,{value:t}),r.editing.view.focus()}),a}_addToolbarDropdown(e){let t=this.editor;t.ui.componentFactory.add(`alignment`,n=>{let r=Nx(n),i=n.uiLanguageDirection===`rtl`?`w`:`e`,a=n.t;Fx(r,()=>e.map(e=>this._createButton(n,e.name,{tooltipPosition:i})),{enableActiveItemFocusOnDropdownOpen:!0,isVertical:!0,ariaLabel:a(`Text alignment toolbar`)}),r.buttonView.set({label:a(`Text alignment`),tooltip:!0}),r.extendTemplate({attributes:{class:`ck-alignment-dropdown`}});let o=n.contentLanguageDirection===`rtl`?qw.get(`right`):qw.get(`left`),s=t.commands.get(`alignment`);return r.buttonView.bind(`icon`).to(s,`value`,e=>qw.get(e)||o),r.bind(`isEnabled`).to(s,`isEnabled`),this.listenTo(r,`execute`,()=>{t.editing.view.focus()}),r})}_addMenuBarMenu(e){let t=this.editor;t.ui.componentFactory.add(`menuBar:alignment`,n=>{let r=t.commands.get(`alignment`),i=n.t,a=new uw(n),o=new dw(n);a.bind(`isEnabled`).to(r),o.set({ariaLabel:i(`Text alignment`),role:`menu`}),a.buttonView.set({label:i(`Text alignment`)});for(let i of e){let e=new rC(n,a),s=new U(n);s.delegate(`execute`).to(a),s.set({label:this.localizedOptionTitles[i.name],icon:qw.get(i.name),role:`menuitemcheckbox`,isToggleable:!0}),s.on(`execute`,()=>{t.execute(`alignment`,{value:i.name}),t.editing.view.focus()}),s.bind(`isOn`).to(r,`value`,e=>e===i.name),s.bind(`isEnabled`).to(r,`isEnabled`),e.children.add(s),o.items.add(e)}return a.panelView.children.add(o),a})}},Yw=class extends F{static get requires(){return[Vw,Jw]}static get pluginName(){return`Alignment`}static get isOfficialPlugin(){return!0}},Xw=class{model;limit;_isLocked;_size;_batch=null;_changeCallback;_selectionChangeCallback;constructor(e,t=20){this.model=e,this._size=0,this.limit=t,this._isLocked=!1,this._changeCallback=(e,t)=>{t.isLocal&&t.isUndoable&&t!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on(`change`,this._changeCallback),this.model.document.selection.on(`change:range`,this._selectionChangeCallback),this.model.document.selection.on(`change:attribute`,this._selectionChangeCallback)}get batch(){return this._batch||=this.model.createBatch({isTyping:!0}),this._batch}get size(){return this._size}input(e){this._size+=e,this._size>=this.limit&&this._reset(!0)}get isLocked(){return this._isLocked}lock(){this._isLocked=!0}unlock(){this._isLocked=!1}destroy(){this.model.document.off(`change`,this._changeCallback),this.model.document.selection.off(`change:range`,this._selectionChangeCallback),this.model.document.selection.off(`change:attribute`,this._selectionChangeCallback)}_reset(e=!1){(!this.isLocked||e)&&(this._batch=null,this._size=0)}},Zw=class extends I{_buffer;constructor(e,t){super(e),this._buffer=new Xw(e.model,t),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){let t=this.editor.model,n=t.document,r=e.text||``,i=r.length,a=n.selection;if(e.selection?a=e.selection:e.range&&(a=t.createSelection(e.range)),!t.canEditAt(a))return;let o=e.resultRange;t.enqueueChange(this._buffer.batch,e=>{this._buffer.lock();let s=Array.from(n.selection.getAttributes());t.deleteContent(a),r&&t.insertContent(e.createText(r,s),a),o?e.setSelection(o):a.is(`documentSelection`)||e.setSelection(a),this._buffer.unlock(),this._buffer.input(i)})}};const Qw=[`insertText`,`insertReplacementText`],$w=[...Qw,`insertCompositionText`];var eT=class extends kc{focusObserver;constructor(e){super(e),this.focusObserver=e.getObserver(Ic);let t=p.isAndroid?$w:Qw,n=e.document;n.on(`beforeinput`,(r,i)=>{if(!this.isEnabled)return;let{data:a,targetRanges:o,inputType:s,domEvent:c,isComposing:l}=i;if(!t.includes(s))return;this.focusObserver.flush();let u=new pe(n,`insertText`);n.fire(u,new Ac(e,c,{text:a,selection:e.createSelection(o),isComposing:l})),u.stop.called&&r.stop()}),p.isAndroid||n.on(`compositionend`,(t,{data:r,domEvent:i})=>{this.isEnabled&&r&&n.fire(`insertText`,new Ac(e,i,{text:r,isComposing:!0}))},{priority:`low`})}observe(){}stopObserving(){}},tT=class extends F{_typingQueue;static get pluginName(){return`Input`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.model,n=e.editing.view,r=e.editing.mapper,i=t.document.selection;this._typingQueue=new nT(e),n.addObserver(eT);let a=new Zw(e,e.config.get(`typing.undoStep`)||20);e.commands.add(`insertText`,a),e.commands.add(`input`,a),this.listenTo(n.document,`beforeinput`,()=>{this._typingQueue.flush(`next beforeinput`)},{priority:`high`}),this.listenTo(n.document,`insertText`,(e,o)=>{let{text:s,selection:c}=o;if(n.document.selection.isFake&&c&&n.document.selection.isSimilar(c)&&o.preventDefault(),c&&Array.from(c.getRanges()).some(e=>!e.isCollapsed)&&o.preventDefault(),!a.isEnabled){o.preventDefault();return}let l;c&&(l=Array.from(c.getRanges()).filter(e=>e.root.is(`rootElement`)).map(e=>r.toModelRange(e)).map(e=>Uf(e,t.schema)||e)),(!l||!l.length)&&(l=Array.from(i.getRanges()));let u=s;if(p.isAndroid){let e=Array.from(l[0].getItems()).reduce((e,t)=>e+(t.is(`$textProxy`)?t.data:``),``);if(e&&(e.length<=u.length?u.startsWith(e)&&(u=u.substring(e.length),l[0].start=l[0].start.getShiftedBy(e.length)):e.startsWith(u)&&(l[0].start=l[0].start.getShiftedBy(u.length),u=``)),u.length==0&&l[0].isCollapsed)return}let d={text:u,selection:t.createSelection(l)};this._typingQueue.push(d,!!o.isComposing),o.domEvent.defaultPrevented&&this._typingQueue.flush(`beforeinput default prevented`)}),p.isAndroid?this.listenTo(n.document,`keydown`,(e,r)=>{i.isCollapsed||r.keyCode!=229||!n.document.isComposing||rT(t,a)}):this.listenTo(n.document,`compositionstart`,()=>{i.isCollapsed||rT(t,a)},{priority:`high`}),this.listenTo(n.document,`mutations`,(e,{mutations:t})=>{if(this._typingQueue.hasAffectedElements())for(let{node:e}of t){let t=aT(e,r),n=r.toModelElement(t);if(this._typingQueue.isElementAffected(n)){this._typingQueue.flush(`mutations`);return}}}),this.listenTo(n.document,`compositionend`,()=>{this._typingQueue.flush(`before composition end`)},{priority:`high`}),this.listenTo(n.document,`compositionend`,()=>{this._typingQueue.flush(`after composition end`);let e=[];if(this._typingQueue.hasAffectedElements())for(let t of this._typingQueue.flushAffectedElements()){let n=r.toViewElement(t);n&&e.push({type:`children`,node:n})}(e.length||!p.isAndroid)&&n.document.fire(`mutations`,{mutations:e})},{priority:`lowest`})}destroy(){super.destroy(),this._typingQueue.destroy()}},nT=class{editor;flushDebounced=Kt(()=>this.flush(`timeout`),50);_queue=[];_isComposing=!1;_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){let n={text:e.text};if(e.selection){n.selectionRanges=[];for(let t of e.selection.getRanges())n.selectionRanges.push(xl.fromRange(t)),this._affectedElements.add(t.start.parent)}this._queue.push(n),this._isComposing||=t,this.flushDebounced()}shift(){let e=this._queue.shift(),t={text:e.text};if(e.selectionRanges){let n=e.selectionRanges.map(e=>iT(e)).filter(e=>!!e);n.length&&(t.selection=this.editor.model.createSelection(n))}return t}flush(e){let t=this.editor,n=t.model,r=t.editing.view;if(this.flushDebounced.cancel(),!this._queue.length)return;let i=t.commands.get(`insertText`).buffer;n.enqueueChange(i.batch,()=>{for(i.lock();this._queue.length;){let e=this.shift();t.execute(`insertText`,e)}i.unlock(),this._isComposing||this._affectedElements.clear(),this._isComposing=!1}),r.scrollToTheSelection()}isElementAffected(e){return this._affectedElements.has(e)}hasAffectedElements(){return this._affectedElements.size>0}flushAffectedElements(){let e=Array.from(this._affectedElements);return this._affectedElements.clear(),e}};function rT(e,t){if(!t.isEnabled)return;let n=t.buffer;n.lock(),e.enqueueChange(n.batch,()=>{e.deleteContent(e.document.selection)}),n.unlock()}function iT(e){let t=e.toRange();return e.detach(),t.root.rootName==`$graveyard`?null:t}function aT(e,t){let n=e.is(`$text`)?e.parent:e;for(;!t.toModelElement(n);)n=n.parent;return n}var oT=class extends I{direction;_buffer;constructor(e,t){super(e),this.direction=t,this._buffer=new Xw(e.model,e.config.get(`typing.undoStep`)),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}execute(e={}){let t=this.editor.model,n=t.document;t.enqueueChange(this._buffer.batch,r=>{this._buffer.lock();let i=r.createSelection(e.selection||n.selection);if(!t.canEditAt(i))return;let a=e.sequence||1,o=i.isCollapsed;if(i.isCollapsed&&t.modifySelection(i,{direction:this.direction,unit:e.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(a)){this._replaceEntireContentWithParagraph(r);return}if(this._shouldReplaceFirstBlockWithParagraph(i,a)){this.editor.execute(`paragraph`,{selection:i});return}if(i.isCollapsed)return;let s=0;i.getFirstRange().getMinimalFlatRanges().forEach(e=>{s+=dr(e.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))}),t.deleteContent(i,{doNotResetEntireContent:o,direction:this.direction}),this._buffer.input(s),r.setSelection(i),this._buffer.unlock()})}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;let t=this.editor.model,n=t.document.selection,r=t.schema.getLimitElement(n);if(!(n.isCollapsed&&n.containsEntireContent(r))||!t.schema.checkChild(r,`paragraph`))return!1;let i=r.getChild(0);return!(i&&i.is(`element`,`paragraph`))}_replaceEntireContentWithParagraph(e){let t=this.editor.model,n=t.document.selection,r=t.schema.getLimitElement(n),i=e.createElement(`paragraph`);e.remove(e.createRangeIn(r)),e.insert(i,r),e.setSelection(i,0)}_shouldReplaceFirstBlockWithParagraph(e,t){let n=this.editor.model;if(t>1||this.direction!=`backward`||!e.isCollapsed)return!1;let r=e.getFirstPosition(),i=n.schema.getLimitElement(r),a=i.getChild(0);return!(r.parent!=a||!e.containsEntireContent(a)||!n.schema.checkChild(i,`paragraph`)||a.name==`paragraph`)}};const sT=`word`,cT=`selection`,lT=`backward`,uT=`forward`,dT={deleteContent:{unit:cT,direction:lT},deleteContentBackward:{unit:`codePoint`,direction:lT},deleteWordBackward:{unit:sT,direction:lT},deleteHardLineBackward:{unit:cT,direction:lT},deleteSoftLineBackward:{unit:cT,direction:lT},deleteContentForward:{unit:`character`,direction:uT},deleteWordForward:{unit:sT,direction:uT},deleteHardLineForward:{unit:cT,direction:uT},deleteSoftLineForward:{unit:cT,direction:uT}};var fT=class extends kc{constructor(e){super(e);let t=e.document,n=0;t.on(`keydown`,()=>{n++}),t.on(`keyup`,()=>{n=0}),t.on(`beforeinput`,(r,i)=>{if(!this.isEnabled)return;let{targetRanges:a,domEvent:o,inputType:s}=i,c=dT[s];if(!c)return;let l={direction:c.direction,unit:c.unit,sequence:n};l.unit==cT&&(l.selectionToRemove=e.createSelection(a[0])),s===`deleteContentBackward`&&(p.isAndroid&&(l.sequence=1),mT(a)&&(l.unit=cT,l.selectionToRemove=e.createSelection(a)));let u=new ls(t,`delete`,a[0]);t.fire(u,new Ac(e,o,l)),u.stop.called&&r.stop()}),p.isBlink&&pT(this)}observe(){}stopObserving(){}};function pT(e){let t=e.view,n=t.document,r=null,i=!1;n.on(`keydown`,(e,{keyCode:t})=>{r=t,i=!1}),n.on(`keyup`,(s,{keyCode:c,domEvent:l})=>{let u=n.selection,d=e.isEnabled&&c==r&&a(c)&&!u.isCollapsed&&!i;if(r=null,d){let e=new ls(n,`delete`,u.getFirstRange()),r={unit:cT,direction:o(c),selectionToRemove:u};n.fire(e,new Ac(t,l,r))}}),n.on(`beforeinput`,(e,{inputType:t})=>{let n=dT[t];a(r)&&n&&n.direction==o(r)&&(i=!0)},{priority:`high`}),n.on(`beforeinput`,(e,{inputType:t,data:n})=>{r==k.delete&&t==`insertText`&&n==``&&e.stop()},{priority:`high`});function a(e){return e==k.backspace||e==k.delete}function o(e){return e==k.backspace?lT:uT}}function mT(e){if(e.length!=1||e[0].isCollapsed)return!1;let t=e[0].getWalker({direction:`backward`,singleCharacters:!0,ignoreElementEnd:!0}),n=0;for(let{nextPosition:e,item:r}of t){if(e.parent.is(`$text`)){let t=e.parent.data,r=e.offset;if(ra(t,r)||ia(t,r)||oa(t,r))continue;n++}else(r.is(`containerElement`)||r.is(`emptyElement`))&&n++;if(n>1)return!0}return!1}var hT=class extends F{_undoOnBackspace;static get pluginName(){return`Delete`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.editing.view,n=t.document,r=e.model.document;t.addObserver(fT),this._undoOnBackspace=!1;let i=new oT(e,`forward`);e.commands.add(`deleteForward`,i),e.commands.add(`forwardDelete`,i),e.commands.add(`delete`,new oT(e,`backward`)),this.listenTo(n,`delete`,(r,i)=>{n.isComposing||i.preventDefault();let{direction:a,sequence:o,selectionToRemove:s,unit:c}=i,l=a===`forward`?`deleteForward`:`delete`,u={sequence:o};if(c==`selection`){let t=Array.from(s.getRanges()).map(t=>e.editing.mapper.toModelRange(t)).map(t=>Uf(t,e.model.schema)||t);u.selection=e.model.createSelection(t)}else u.unit=c;e.execute(l,u),t.scrollToTheSelection()},{priority:`low`}),this.listenTo(n,`keydown`,(i,a)=>{if(n.isComposing||a.keyCode!=k.backspace||!r.selection.isCollapsed)return;let o=e.model.schema.getLimitElement(r.selection),s=e.model.createPositionAt(o,0);if(s.isTouching(r.selection.getFirstPosition())){a.preventDefault();let r=e.model.schema.getNearestSelectionRange(s,`forward`);if(!r)return;let i=t.createSelection(e.editing.mapper.toViewRange(r)),o=i.getFirstRange(),c=new ls(document,`delete`,o),l={unit:`selection`,direction:`backward`,selectionToRemove:i};n.fire(c,new Ac(t,a.domEvent,l))}}),this.editor.plugins.has(`UndoEditing`)&&(this.listenTo(n,`delete`,(t,n)=>{this._undoOnBackspace&&n.direction==`backward`&&n.sequence==1&&n.unit==`codePoint`&&(this._undoOnBackspace=!1,e.execute(`undo`),n.preventDefault(),t.stop())},{context:`$capture`}),this.listenTo(r,`change`,()=>{this._undoOnBackspace=!1}))}requestUndoOnBackspace(){this.editor.plugins.has(`UndoEditing`)&&(this._undoOnBackspace=!0)}},gT=class extends F{static get requires(){return[tT,hT]}static get pluginName(){return`Typing`}static get isOfficialPlugin(){return!0}};function _T(e,t){let n=e.start;return{text:Array.from(e.getWalker({ignoreElementEnd:!1})).reduce((e,{item:r})=>r.is(`$text`)||r.is(`$textProxy`)?e+r.data:(n=t.createPositionAfter(r),``),``),range:t.createRange(n,e.end)}}const vT=D();var yT=class extends vT{model;testCallback;_hasMatch;constructor(e,t){super(),this.model=e,this.testCallback=t,this._hasMatch=!1,this.set(`isEnabled`,!0),this.on(`change:isEnabled`,()=>{this.isEnabled?this._startListening():(this.stopListening(e.document.selection),this.stopListening(e.document))}),this._startListening()}get hasMatch(){return this._hasMatch}_startListening(){let e=this.model.document;this.listenTo(e.selection,`change:range`,(t,{directChange:n})=>{if(n){if(!e.selection.isCollapsed){this.hasMatch&&(this.fire(`unmatched`),this._hasMatch=!1);return}this._evaluateTextBeforeSelection(`selection`)}}),this.listenTo(e,`change:data`,(e,t)=>{t.isUndo||!t.isLocal||this._evaluateTextBeforeSelection(`data`,{batch:t})})}_evaluateTextBeforeSelection(e,t={}){let n=this.model,r=n.document.selection,{text:i,range:a}=_T(n.createRange(n.createPositionAt(r.focus.parent,0),r.focus),n),o=this.testCallback(i);if(!o&&this.hasMatch&&this.fire(`unmatched`),this._hasMatch=!!o,o){let n=Object.assign(t,{text:i,range:a});typeof o==`object`&&Object.assign(n,o),this.fire(`matched:${e}`,n)}}},bT=class extends F{attributes;_overrideUid;_isNextGravityRestorationSkipped=!1;static get pluginName(){return`TwoStepCaretMovement`}static get isOfficialPlugin(){return!0}constructor(e){super(e),this.attributes=new Set,this._overrideUid=null}init(){let e=this.editor,t=e.model,n=e.editing.view,r=e.locale,i=t.document.selection;this.listenTo(n.document,`arrowKey`,(e,t)=>{if(!i.isCollapsed||t.shiftKey||t.altKey||t.ctrlKey)return;let n=t.keyCode==k.arrowright,a=t.keyCode==k.arrowleft;if(!n&&!a)return;let o=r.contentLanguageDirection,s=!1;s=o===`ltr`&&n||o===`rtl`&&a?this._handleForwardMovement(t):this._handleBackwardMovement(t),s===!0&&e.stop()},{context:`$text`,priority:`highest`}),this.listenTo(i,`change:range`,(e,t)=>{if(this._isNextGravityRestorationSkipped){this._isNextGravityRestorationSkipped=!1;return}this._isGravityOverridden&&(!t.directChange&&ET(i.getFirstPosition(),this.attributes)||this._restoreGravity())}),this._enableClickingAfterNode(),this._enableInsertContentSelectionAttributesFixer(),this._handleDeleteContentAfterNode()}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){let t=this.attributes,n=this.editor.model,r=n.document.selection,i=r.getFirstPosition();return this._isGravityOverridden||i.isAtStart&&xT(r,t)?!1:ET(i,t)?(e&&wT(e),xT(r,t)&&ET(i,t,!0)?CT(n,t):this._overrideGravity(),!0):!1}_handleBackwardMovement(e){let t=this.attributes,n=this.editor.model,r=n.document.selection,i=r.getFirstPosition();return this._isGravityOverridden?(e&&wT(e),this._restoreGravity(),ET(i,t,!0)?CT(n,t):ST(n,t,i),!0):i.isAtStart?xT(r,t)?(e&&wT(e),ST(n,t,i),!0):!1:!xT(r,t)&&ET(i,t,!0)?(e&&wT(e),ST(n,t,i),!0):TT(i,t)?i.isAtEnd&&!xT(r,t)&&ET(i,t)?(e&&wT(e),ST(n,t,i),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1):!1}_enableClickingAfterNode(){let e=this.editor,t=e.model,n=t.document.selection,r=e.editing.view.document;e.editing.view.addObserver(Ap),e.editing.view.addObserver(jp);let i=!1,a=!1;this.listenTo(r,`touchstart`,()=>{a=!1,i=!0}),this.listenTo(r,`mousedown`,()=>{a=!0}),this.listenTo(r,`selectionChange`,()=>{let e=this.attributes;if(!a&&!i||(a=!1,i=!1,!n.isCollapsed)||!xT(n,e))return;let r=n.getFirstPosition();ET(r,e)&&(r.isAtStart||ET(r,e,!0)?CT(t,e):this._isGravityOverridden||this._overrideGravity())})}_enableInsertContentSelectionAttributesFixer(){let e=this.editor.model,t=e.document.selection,n=this.attributes;this.listenTo(e,`insertContent`,()=>{let r=t.getFirstPosition();xT(t,n)&&ET(r,n)&&CT(e,n)},{priority:`low`})}_handleDeleteContentAfterNode(){let e=this.editor,t=e.model,n=t.document.selection,r=e.editing.view,i=!1,a=!1;this.listenTo(r.document,`delete`,(e,t)=>{i=t.direction===`backward`},{priority:`high`}),this.listenTo(t,`deleteContent`,()=>{if(!i)return;let e=n.getFirstPosition();a=xT(n,this.attributes)&&!TT(e,this.attributes)},{priority:`high`}),this.listenTo(t,`deleteContent`,()=>{i&&(i=!1,!a&&e.model.enqueueChange(()=>{let e=n.getFirstPosition();xT(n,this.attributes)&&ET(e,this.attributes)&&(e.isAtStart||ET(e,this.attributes,!0)?CT(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 xT(e,t){for(let n of t)if(e.hasAttribute(n))return!0;return!1}function ST(e,t,n){let r=n.nodeBefore;e.change(n=>{if(r){let t=[],i=e.schema.isObject(r)&&e.schema.isInline(r);for(let[n,a]of r.getAttributes())e.schema.checkAttribute(`$text`,n)&&(!i||e.schema.getAttributeProperties(n).copyFromObject!==!1)&&t.push([n,a]);n.setSelectionAttribute(t)}else n.removeSelectionAttribute(t)})}function CT(e,t){e.change(e=>{e.removeSelectionAttribute(t)})}function wT(e){e.preventDefault()}function TT(e,t){return ET(e.getShiftedBy(-1),t)}function ET(e,t,n=!1){let{nodeBefore:r,nodeAfter:i}=e;for(let e of t){let t=r?r.getAttribute(e):void 0,a=i?i.getAttribute(e):void 0;if(!(n&&(t===void 0||a===void 0))&&a!==t)return!0}return!1}const DT={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:PT(`"`),to:[null,`“`,null,`”`]},quotesSecondary:{from:PT(`'`),to:[null,``,null,``]},quotesPrimaryEnGb:{from:PT(`'`),to:[null,``,null,``]},quotesSecondaryEnGb:{from:PT(`"`),to:[null,`“`,null,`”`]},quotesPrimaryPl:{from:PT(`"`),to:[null,`„`,null,`”`]},quotesSecondaryPl:{from:PT(`'`),to:[null,``,null,``]}},OT={symbols:[`copyright`,`registeredTrademark`,`trademark`],mathematical:[`oneHalf`,`oneThird`,`twoThirds`,`oneForth`,`threeQuarters`,`lessThanOrEqual`,`greaterThanOrEqual`,`notEqual`,`arrowLeft`,`arrowRight`],typography:[`horizontalEllipsis`,`enDash`,`emDash`],quotes:[`quotesPrimary`,`quotesSecondary`]},kT=[`symbols`,`mathematical`,`typography`,`quotes`];var AT=class extends F{static get requires(){return[hT,tT]}static get pluginName(){return`TextTransformation`}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(`typing`,{transformations:{include:kT}})}init(){let e=this.editor.model.document.selection;e.on(`change:range`,()=>{let t=e.anchor,n=!!t&&t.parent.is(`element`,`codeBlock`),r=e.hasAttribute(`code`);this.isEnabled=!(n||r)}),this._enableTransformationWatchers()}_enableTransformationWatchers(){let e=this.editor,t=e.model,n=e.plugins.get(`Delete`),r=FT(e.config.get(`typing.transformations`)),i=new yT(e.model,e=>{for(let t of r)if(t.from.test(e))return{normalizedTransformation:t}});i.on(`matched:data`,(e,r)=>{if(!r.batch.isTyping)return;let{from:i,to:a}=r.normalizedTransformation,o=i.exec(r.text),s=a(o.slice(1)),c=r.range,l=o.index;t.enqueueChange(e=>{for(let n=1;n<o.length;n++){let r=o[n],i=s[n-1];if(i==null){l+=r.length;continue}let a=c.start.getShiftedBy(l),u=t.createRange(a,a.getShiftedBy(r.length)),d=NT(a);t.insertContent(e.createText(i,d),u),l+=i.length}t.enqueueChange(()=>{n.requestUndoOnBackspace()})})}),i.bind(`isEnabled`).to(this)}};function jT(e){return typeof e==`string`?RegExp(`(${Bn(e)})$`):e}function MT(e){return typeof e==`string`?()=>[e]:e instanceof Array?()=>e:e}function NT(e){return(e.textNode?e.textNode:e.nodeAfter).getAttributes()}function PT(e){return RegExp(`(^|\\s)(${e})([^${e}]*)(${e})$`)}function FT(e){let t=e.extra||[],n=e.remove||[],r=e=>!n.includes(e);return IT(e.include.concat(t).filter(r)).filter(r).map(e=>typeof e==`string`&&DT[e]?DT[e]:e).filter(e=>typeof e==`object`).map(e=>({from:jT(e.from),to:MT(e.to)}))}function IT(e){let t=new Set;for(let n of e)if(typeof n==`string`&&OT[n])for(let e of OT[n])t.add(e);else t.add(n);return Array.from(t)}function LT(e,t,n,r){return r.createRange(RT(e,t,n,!0,r),RT(e,t,n,!1,r))}function RT(e,t,n,r,i){let a=e.textNode||(r?e.nodeBefore:e.nodeAfter),o=null;for(;a&&a.getAttribute(t)==n;)o=a,a=r?a.previousSibling:a.nextSibling;return o?i.createPositionAt(o,r?`before`:`after`):e}function zT(e,t,n,r){let i=e.editing.view,a=new Set;i.document.registerPostFixer(i=>{let o=e.model.document.selection,s=!1;if(o.hasAttribute(t)){let c=LT(o.getFirstPosition(),t,o.getAttribute(t),e.model),l=e.editing.mapper.toViewRange(c);for(let e of l.getItems())e.is(`element`,n)&&!e.hasClass(r)&&(i.addClass(r,e),a.add(e),s=!0)}return s}),e.conversion.for(`editingDowncast`).add(e=>{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 t(){i.change(e=>{for(let t of a.values())e.removeClass(r,t),a.delete(t)})}})}function BT(e,t,n,r){let i,a=null;typeof r==`function`?i=r:(a=e.commands.get(r),i=()=>{e.execute(r)}),e.model.document.on(`change:data`,(o,s)=>{if(a&&!a.isEnabled||!t.isEnabled)return;let c=j(e.model.document.selection.getRanges());if(!c.isCollapsed||s.isUndo||!s.isLocal)return;let l=Array.from(e.model.document.differ.getChanges()),u=l[0];if(l.length!=1||u.type!==`insert`||u.name!=`$text`||u.length!=1)return;let d=u.position.parent;if(d.is(`element`,`codeBlock`)||d.is(`element`,`listItem`)&&typeof r!=`function`&&![`numberedList`,`bulletedList`,`todoList`].includes(r)||a&&a.value===!0)return;let f=d.getChild(0),p=e.model.createRangeOn(f);if(!p.containsRange(c)&&!c.end.isEqual(p.end))return;let m=n.exec(f.data.substr(0,c.end.offset));m&&e.model.enqueueChange(t=>{let n=e.model.document.selection,r=new xl(t.createPositionAt(d,0),t.createPositionAt(d,m[0].length));if(i({match:m})!==!1){let e=Array.from(n.getAttributes());t.remove(r);let i=n.getFirstRange(),a=t.createRangeIn(d);d.isEmpty&&!a.isEqual(i)&&!a.containsRange(i,!0)&&t.remove(d),VT(t,n,e)}r.detach(),e.model.enqueueChange(()=>{e.plugins.get(`Delete`).requestUndoOnBackspace()})})})}function VT(e,t,n){let r=e.model.schema,i=new td(t.getFirstPosition());r.checkChild(i,`$text`)&&(i=i.push(`$text`));for(let[t,a]of n)r.checkAttribute(i,t)&&e.setSelectionAttribute(t,a)}function HT(e,t,n,r){let i,a;n instanceof RegExp?i=n:a=n,a||=(e=>{let t,n=[],r=[];for(;(t=i.exec(e))!==null&&!(t&&t.length<4);){let{index:e,1:i,2:a,3:o}=t,s=i+a+o;e+=t[0].length-s.length;let c=[e,e+i.length],l=[e+i.length+a.length,e+i.length+a.length+o.length];n.push(c),n.push(l),r.push([e+i.length,e+i.length+a.length])}return{remove:n,format:r}}),e.model.document.on(`change:data`,(n,i)=>{if(i.isUndo||!i.isLocal||!t.isEnabled)return;let o=e.model,s=o.document.selection;if(!s.isCollapsed)return;let c=Array.from(o.document.differ.getChanges()),l=c[0];if(c.length!=1||l.type!==`insert`||l.name!=`$text`||l.length!=1)return;let u=s.focus,d=u.parent,{text:f,range:p}=Rte(o.createRange(o.createPositionAt(d,0),u),o),m=a(f),h=UT(p.start,m.format,o),g=UT(p.start,m.remove,o);h.length&&g.length&&o.enqueueChange(t=>{if(r(t,h)!==!1){for(let e of g.reverse())t.remove(e);o.enqueueChange(()=>{e.plugins.get(`Delete`).requestUndoOnBackspace()})}})})}function UT(e,t,n){return t.filter(e=>e[0]!==void 0&&e[1]!==void 0).map(t=>n.createRange(e.getShiftedBy(t[0]),e.getShiftedBy(t[1])))}function Rte(e,t){let n=e.start;return{text:Array.from(e.getItems()).reduce((e,r)=>!(r.is(`$text`)||r.is(`$textProxy`))||r.getAttribute(`code`)?(n=t.createPositionAfter(r),``):e+r.data,``),range:t.createRange(n,e.end)}}var zte=class extends F{static get requires(){return[hT]}static get pluginName(){return`Autoformat`}static get isOfficialPlugin(){return!0}afterInit(){let 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(){let e=this.editor.commands;if(e.get(`bulletedList`)&&BT(this.editor,this,/^[*-]\s$/,`bulletedList`),e.get(`numberedList`)){let t=e.get(`numberedList`),n=!!e.get(`listStart`);BT(this.editor,this,/^(\d+)[.|)]\s$/,({match:e})=>{if(!t.isEnabled||t.value===!0)return!1;this.editor.execute(`numberedList`,n?{additionalAttributes:{listStart:parseInt(e[1])}}:void 0)})}e.get(`todoList`)&&BT(this.editor,this,/^\[\s?\]\s$/,`todoList`),e.get(`checkTodoList`)&&BT(this.editor,this,/^\[\s?x\s?\]\s$/,()=>{this.editor.execute(`todoList`),this.editor.execute(`checkTodoList`)})}_addBasicStylesAutoformats(){let e=this.editor.commands;if(e.get(`bold`)){let e=WT(this.editor,`bold`);HT(this.editor,this,/(?:^|\s)(\*\*)([^*]+)(\*\*)$/g,e),HT(this.editor,this,/(?:^|\s)(__)([^_]+)(__)$/g,e)}if(e.get(`italic`)){let e=WT(this.editor,`italic`);HT(this.editor,this,/(?:^|\s)(\*)([^*_]+)(\*)$/g,e),HT(this.editor,this,/(?:^|\s)(_)([^_]+)(_)$/g,e)}if(e.get(`code`)){let e=WT(this.editor,`code`);HT(this.editor,this,/(`)([^`]+)(`)$/g,e)}if(e.get(`strikethrough`)){let e=WT(this.editor,`strikethrough`);HT(this.editor,this,/(~~)([^~]+)(~~)$/g,e)}}_addHeadingAutoformats(){let e=this.editor.commands.get(`heading`);e&&e.modelElements.filter(e=>e.match(/^heading[1-6]$/)).forEach(t=>{let n=t[7],r=RegExp(`^(#{${n}})\\s$`);BT(this.editor,this,r,()=>{if(!e.isEnabled||e.value===t)return!1;this.editor.execute(`heading`,{value:t})})})}_addBlockQuoteAutoformats(){this.editor.commands.get(`blockQuote`)&&BT(this.editor,this,/^>\s$/,`blockQuote`)}_addCodeBlockAutoformats(){let e=this.editor,t=e.model.document.selection;e.commands.get(`codeBlock`)&&BT(e,this,/^```$/,()=>{if(t.getFirstPosition().parent.is(`element`,`listItem`))return!1;this.editor.execute(`codeBlock`,{usePreviousLanguageChoice:!0})})}_addHorizontalLineAutoformats(){this.editor.commands.get(`horizontalLine`)&&BT(this.editor,this,/^---$/,`horizontalLine`)}};function WT(e,t){return(n,r)=>{if(!e.commands.get(t).isEnabled)return!1;let i=e.model.schema.getValidRanges(r,t);for(let e of i)n.setAttribute(t,!0,e);n.removeSelectionAttribute(t)}}var Bte=class extends F{adapter;_debouncedSave;_lastDocumentVersion;_savePromise;_domEmitter;_config;_pendingActions;_makeImmediateSave;_action=null;static get pluginName(){return`Autosave`}static get isOfficialPlugin(){return!0}static get requires(){return[wg]}constructor(e){super(e);let t=e.config.get(`autosave`)||{},n=t.waitingTime||1e3;this.set(`state`,`synchronized`),this._debouncedSave=Kt(this._save.bind(this),n),this._lastDocumentVersion=e.model.document.version,this._savePromise=null,this._domEmitter=new(br()),this._config=t,this._pendingActions=e.plugins.get(wg),this._makeImmediateSave=!1}init(){let e=this.editor,t=e.model.document;this.listenTo(e,`ready`,()=>{this.listenTo(t,`change:data`,(e,t)=>{this._saveCallbacks.length&&t.isLocal&&(this.state===`synchronized`&&(this.state=`waiting`,this._setPendingAction()),this.state===`waiting`&&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=!1,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(){let e=this.editor.t;this._action||=this._pendingActions.add(e(`Saving changes`))}get _saveCallbacks(){let e=[];return this.adapter&&this.adapter.save&&e.push(this.adapter.save),this._config.save&&e.push(this._config.save),e}},GT=class extends I{attributeKey;constructor(e,t){super(e),this.attributeKey=t}refresh(){let e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){let t=this.editor.model,n=t.document.selection,r=e.forceValue===void 0?!this.value:e.forceValue;t.change(e=>{if(n.isCollapsed)r?e.setSelectionAttribute(this.attributeKey,!0):e.removeSelectionAttribute(this.attributeKey);else{let i=t.schema.getValidRanges(n.getRanges(),this.attributeKey,{includeEmptyRanges:!0});for(let t of i){let n=t,i=this.attributeKey;t.isCollapsed&&(n=t.start.parent,i=Tl._getStoreAttributeKey(this.attributeKey)),r?e.setAttribute(i,r,n):e.removeAttribute(i,n)}}})}_getValueFromFirstAllowedNode(){let e=this.editor.model,t=e.schema,n=e.document.selection;if(n.isCollapsed)return n.hasAttribute(this.attributeKey);for(let e of n.getRanges())for(let n of e.getItems())if(t.checkAttribute(n,this.attributeKey))return n.hasAttribute(this.attributeKey);return!1}};const KT=`bold`;var qT=class extends F{static get pluginName(){return`BoldEditing`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=this.editor.t;e.model.schema.extend(`$text`,{allowAttributes:KT}),e.model.schema.setAttributeProperties(KT,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:KT,view:`strong`,upcastAlso:[`b`,e=>{let t=e.getStyle(`font-weight`);return t&&(t==`bold`||Number(t)>=600)?{name:!0,styles:[`font-weight`]}:null}]}),e.commands.add(KT,new GT(e,KT)),e.keystrokes.set(`CTRL+B`,KT),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t(`Bold text`),keystroke:`CTRL+B`}]})}};function JT({editor:e,commandName:t,plugin:n,icon:r,label:i,keystroke:a}){return o=>{let s=e.commands.get(t),c=new o(e.locale);return c.set({label:i,icon:r,keystroke:a,isToggleable:!0}),c.bind(`isEnabled`).to(s,`isEnabled`),c.bind(`isOn`).to(s,`value`),c instanceof U?c.set({role:`menuitemcheckbox`}):c.set({tooltip:!0}),n.listenTo(c,`execute`,()=>{e.execute(t),e.editing.view.focus()}),c}}const YT=`bold`;var XT=class extends F{static get pluginName(){return`BoldUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale.t,n=JT({editor:e,commandName:YT,plugin:this,icon:Zg,label:t(`Bold`),keystroke:`CTRL+B`});e.ui.componentFactory.add(YT,()=>n(H)),e.ui.componentFactory.add(`menuBar:bold`,()=>n(U))}},Vte=class extends F{static get requires(){return[qT,XT]}static get pluginName(){return`Bold`}static get isOfficialPlugin(){return!0}};const ZT=`code`;var QT=class extends F{static get pluginName(){return`CodeEditing`}static get isOfficialPlugin(){return!0}static get requires(){return[bT]}init(){let e=this.editor,t=this.editor.t;e.model.schema.extend(`$text`,{allowAttributes:ZT}),e.model.schema.setAttributeProperties(ZT,{isFormatting:!0,copyOnEnter:!1}),e.conversion.attributeToElement({model:ZT,view:`code`}),e.commands.add(ZT,new GT(e,ZT)),e.plugins.get(bT).registerAttribute(ZT),zT(e,ZT,`code`,`ck-code_selected`),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t(`Move out of an inline code style`),keystroke:[[`arrowleft`,`arrowleft`],[`arrowright`,`arrowright`]]}]})}};const $T=`code`;var eE=class extends F{static get pluginName(){return`CodeUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale.t,n=JT({editor:e,commandName:$T,plugin:this,icon:f_,label:t(`Code`)});e.ui.componentFactory.add($T,()=>n(H)),e.ui.componentFactory.add(`menuBar:code`,()=>n(U))}},Hte=class extends F{static get requires(){return[QT,eE]}static get pluginName(){return`Code`}static get isOfficialPlugin(){return!0}};const tE=`italic`;var nE=class extends F{static get pluginName(){return`ItalicEditing`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=this.editor.t;e.model.schema.extend(`$text`,{allowAttributes:tE}),e.model.schema.setAttributeProperties(tE,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:tE,view:`i`,upcastAlso:[`em`,{styles:{"font-style":`italic`}}]}),e.commands.add(tE,new GT(e,tE)),e.keystrokes.set(`CTRL+I`,tE),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t(`Italic text`),keystroke:`CTRL+I`}]})}};const rE=`italic`;var iE=class extends F{static get pluginName(){return`ItalicUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale.t,n=JT({editor:e,commandName:rE,plugin:this,icon:J_,keystroke:`CTRL+I`,label:t(`Italic`)});e.ui.componentFactory.add(rE,()=>n(H)),e.ui.componentFactory.add(`menuBar:italic`,()=>n(U))}},Ute=class extends F{static get requires(){return[nE,iE]}static get pluginName(){return`Italic`}static get isOfficialPlugin(){return!0}};const aE=`strikethrough`;var oE=class extends F{static get pluginName(){return`StrikethroughEditing`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=this.editor.t;e.model.schema.extend(`$text`,{allowAttributes:aE}),e.model.schema.setAttributeProperties(aE,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:aE,view:`s`,upcastAlso:[`del`,`strike`,{styles:{"text-decoration":`line-through`}}]}),e.commands.add(aE,new GT(e,aE)),e.keystrokes.set(`CTRL+SHIFT+X`,`strikethrough`),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t(`Strikethrough text`),keystroke:`CTRL+SHIFT+X`}]})}};const sE=`strikethrough`;var cE=class extends F{static get pluginName(){return`StrikethroughUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale.t,n=JT({editor:e,commandName:sE,plugin:this,icon:fy,keystroke:`CTRL+SHIFT+X`,label:t(`Strikethrough`)});e.ui.componentFactory.add(sE,()=>n(H)),e.ui.componentFactory.add(`menuBar:strikethrough`,()=>n(U))}},Wte=class extends F{static get requires(){return[oE,cE]}static get pluginName(){return`Strikethrough`}static get isOfficialPlugin(){return!0}};const lE=`subscript`;var uE=class extends F{static get pluginName(){return`SubscriptEditing`}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.model.schema.extend(`$text`,{allowAttributes:lE}),e.model.schema.setAttributeProperties(lE,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:lE,view:`sub`,upcastAlso:[{styles:{"vertical-align":`sub`}}]}),e.commands.add(lE,new GT(e,lE))}};const dE=`subscript`;var fE=class extends F{static get pluginName(){return`SubscriptUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale.t,n=JT({editor:e,commandName:dE,plugin:this,icon:my,label:t(`Subscript`)});e.ui.componentFactory.add(dE,()=>n(H)),e.ui.componentFactory.add(`menuBar:subscript`,()=>n(U))}},Gte=class extends F{static get requires(){return[uE,fE]}static get pluginName(){return`Subscript`}static get isOfficialPlugin(){return!0}};const pE=`superscript`;var mE=class extends F{static get pluginName(){return`SuperscriptEditing`}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.model.schema.extend(`$text`,{allowAttributes:pE}),e.model.schema.setAttributeProperties(pE,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:pE,view:`sup`,upcastAlso:[{styles:{"vertical-align":`super`}}]}),e.commands.add(pE,new GT(e,pE))}};const hE=`superscript`;var gE=class extends F{static get pluginName(){return`SuperscriptUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale.t,n=JT({editor:e,commandName:hE,plugin:this,icon:hy,label:t(`Superscript`)});e.ui.componentFactory.add(hE,()=>n(H)),e.ui.componentFactory.add(`menuBar:superscript`,()=>n(U))}},Kte=class extends F{static get requires(){return[mE,gE]}static get pluginName(){return`Superscript`}static get isOfficialPlugin(){return!0}};const _E=`underline`;var vE=class extends F{static get pluginName(){return`UnderlineEditing`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=this.editor.t;e.model.schema.extend(`$text`,{allowAttributes:_E}),e.model.schema.setAttributeProperties(_E,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:_E,view:`u`,upcastAlso:{styles:{"text-decoration":`underline`}}}),e.commands.add(_E,new GT(e,_E)),e.keystrokes.set(`CTRL+U`,`underline`),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t(`Underline text`),keystroke:`CTRL+U`}]})}};const yE=`underline`;var bE=class extends F{static get pluginName(){return`UnderlineUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale.t,n=JT({editor:e,commandName:yE,plugin:this,icon:Dy,label:t(`Underline`),keystroke:`CTRL+U`});e.ui.componentFactory.add(yE,()=>n(H)),e.ui.componentFactory.add(`menuBar:underline`,()=>n(U))}},qte=class extends F{static get requires(){return[vE,bE]}static get pluginName(){return`Underline`}static get isOfficialPlugin(){return!0}};function*xE(e,t){for(let n of t)n&&e.getAttributeProperties(n[0]).copyOnEnter&&(yield n)}var SE=class extends I{execute(){this.editor.model.change(e=>{this.enterBlock(e),this.fire(`afterExecute`,{writer:e})})}enterBlock(e){let t=this.editor.model,n=t.document.selection,r=t.schema,i=n.isCollapsed,a=n.getFirstRange(),o=a.start.parent,s=a.end.parent;if(r.isLimit(o)||r.isLimit(s))return!i&&o==s&&t.deleteContent(n),!1;if(i){let t=xE(e.model.schema,n.getAttributes());return CE(e,a.start),e.setSelectionAttribute(t),!0}else{let r=!(a.start.isAtStart&&a.end.isAtEnd),i=o==s;if(t.deleteContent(n,{leaveUnmerged:r}),r){if(i)return CE(e,n.focus),!0;e.setSelection(s,0)}}return!1}};function CE(e,t){e.split(t),e.setSelection(t.parent.nextSibling,0)}const Jte={insertParagraph:{isSoft:!1},insertLineBreak:{isSoft:!0}};var wE=class extends kc{constructor(e){super(e);let t=this.document,n=!1;t.on(`keydown`,(e,t)=>{n=t.shiftKey}),t.on(`beforeinput`,(r,i)=>{if(!this.isEnabled)return;let a=i.inputType;p.isSafari&&n&&a==`insertParagraph`&&(a=`insertLineBreak`);let o=i.domEvent,s=Jte[a];if(!s)return;let c=new ls(t,`enter`,i.targetRanges[0]);t.fire(c,new Ac(e,o,{isSoft:s.isSoft})),c.stop.called&&r.stop()})}observe(){}stopObserving(){}},TE=class extends F{static get pluginName(){return`Enter`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.editing.view,n=t.document,r=this.editor.t;t.addObserver(wE),e.commands.add(`enter`,new SE(e)),this.listenTo(n,`enter`,(r,i)=>{n.isComposing||i.preventDefault(),!i.isSoft&&(e.execute(`enter`),t.scrollToTheSelection())},{priority:`low`}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:r(`Insert a hard break (a new paragraph)`),keystroke:`Enter`}]})}},EE=class extends I{execute(){let e=this.editor.model,t=e.document;e.change(n=>{Xte(e,n,t.selection),this.fire(`afterExecute`,{writer:n})})}refresh(){let e=this.editor.model,t=e.document;this.isEnabled=Yte(e.schema,t.selection)}};function Yte(e,t){if(t.rangeCount>1)return!1;let n=t.anchor;if(!n||!e.checkChild(n,`softBreak`))return!1;let r=t.getFirstRange(),i=r.start.parent,a=r.end.parent;return!((OE(i,e)||OE(a,e))&&i!==a)}function Xte(e,t,n){let r=n.isCollapsed,i=n.getFirstRange(),a=i.start.parent,o=i.end.parent,s=a==o;if(r)DE(e,t,i.end,n.getAttributes());else{let r=!(i.start.isAtStart&&i.end.isAtEnd);e.deleteContent(n,{leaveUnmerged:r}),s?DE(e,t,n.focus,n.getAttributes()):r&&t.setSelection(o,0)}}function DE(e,t,n,r){let i=Array.from(xE(e.schema,r)),a=t.createElement(`softBreak`,i);e.insertContent(a,n),t.setSelection(a,`after`)}function OE(e,t){return e.is(`rootElement`)?!1:t.isLimit(e)||OE(e.parent,t)}var kE=class extends F{static get pluginName(){return`ShiftEnter`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.model.schema,n=e.conversion,r=e.editing.view,i=r.document,a=this.editor.t;t.register(`softBreak`,{allowWhere:`$text`,allowAttributesOf:`$text`,isInline:!0}),n.for(`upcast`).elementToElement({model:`softBreak`,view:`br`}),n.for(`downcast`).elementToElement({model:`softBreak`,view:(e,{writer:t})=>t.createEmptyElement(`br`)}),r.addObserver(wE),e.commands.add(`shiftEnter`,new EE(e)),e.model.document.registerPostFixer(e=>Zte(e)),this.listenTo(i,`enter`,(t,n)=>{i.isComposing||n.preventDefault(),n.isSoft&&(e.execute(`shiftEnter`),r.scrollToTheSelection())},{priority:`low`}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:a(`Insert a soft break (a <code>&lt;br&gt;</code> element)`),keystroke:`Shift+Enter`}]})}};function Zte(e){let t=new Set;for(let n of e.model.document.differ.getChanges())n.type==`insert`||n.type==`remove`?n.position.parent.is(`element`)&&t.add(n.position.parent):n.type==`attribute`&&n.range.start.parent.is(`element`)&&t.add(n.range.start.parent);let n=!1;for(let r of t)for(let t of r.getChildren()){if(!t.is(`element`,`softBreak`))continue;let r=t.nextSibling;if(!r||r.is(`element`))continue;let i=Array.from(t.getAttributes()).filter(([e,t])=>!Qte(r,e,t));for(let[r]of i)e.removeAttribute(r,t),n=!0}return n}function Qte(e,t,n){return e?.getAttribute(t)===n}var AE=class extends I{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){let t=this.editor.model,n=t.schema,r=t.document.selection,i=Array.from(r.getSelectedBlocks()),a=e.forceValue===void 0?!this.value:e.forceValue;t.change(e=>{if(!a)this._removeQuote(e,i.filter(jE));else{let t=i.filter(e=>jE(e)||NE(n,e));this._applyQuote(e,t)}})}_getValue(){let e=this.editor.model.document.selection,t=j(e.getSelectedBlocks());return!!(t&&jE(t))}_checkEnabled(){if(this.value)return!0;let e=this.editor.model.document.selection,t=this.editor.model.schema,n=j(e.getSelectedBlocks());return n?NE(t,n):!1}_removeQuote(e,t){ME(e,t).reverse().forEach(t=>{if(t.start.isAtStart&&t.end.isAtEnd){e.unwrap(t.start.parent);return}if(t.start.isAtStart){let n=e.createPositionBefore(t.start.parent);e.move(t,n);return}t.end.isAtEnd||e.split(t.end);let n=e.createPositionAfter(t.end.parent);e.move(t,n)})}_applyQuote(e,t){let n=[];ME(e,t).reverse().forEach(t=>{let r=jE(t.start);r||(r=e.createElement(`blockQuote`),e.wrap(t,r)),n.push(r)}),n.reverse().reduce((t,n)=>t.nextSibling==n?(e.merge(e.createPositionAfter(t)),t):n)}};function jE(e){return e.parent.name==`blockQuote`?e.parent:null}function ME(e,t){let n,r=0,i=[];for(;r<t.length;){let a=t[r],o=t[r+1];n||=e.createPositionBefore(a),(!o||a.nextSibling!=o)&&(i.push(e.createRange(n,e.createPositionAfter(a))),n=null),r++}return i}function NE(e,t){let n=e.createContext(t.parent);return!(!e.checkChild(n,`blockQuote`)||!e.checkChild(n.push(`blockQuote`),t))}var PE=class extends F{static get pluginName(){return`BlockQuoteEditing`}static get isOfficialPlugin(){return!0}static get requires(){return[TE,hT]}init(){let e=this.editor,t=e.model.schema;e.commands.add(`blockQuote`,new AE(e)),t.register(`blockQuote`,{inheritAllFrom:`$container`}),e.conversion.elementToElement({model:`blockQuote`,view:`blockquote`}),e.model.document.registerPostFixer(n=>{let r=e.model.document.differ.getChanges();for(let e of r)if(e.type==`insert`){let r=e.position.nodeAfter;if(!r)continue;if(r.is(`element`,`blockQuote`)&&r.isEmpty)return n.remove(r),!0;if(r.is(`element`,`blockQuote`)&&!t.checkChild(e.position,r))return n.unwrap(r),!0;if(r.is(`element`)){let e=n.createRangeIn(r);for(let r of e.getItems())if(r.is(`element`,`blockQuote`)&&!t.checkChild(n.createPositionBefore(r),r))return n.unwrap(r),!0}}else if(e.type==`remove`){let t=e.position.parent;if(t.is(`element`,`blockQuote`)&&t.isEmpty)return n.remove(t),!0}return!1});let n=this.editor.editing.view.document,r=e.model.document.selection,i=e.commands.get(`blockQuote`);this.listenTo(n,`enter`,(t,n)=>{!r.isCollapsed||!i.value||r.getLastPosition().parent.isEmpty&&(e.execute(`blockQuote`),e.editing.view.scrollToTheSelection(),n.preventDefault(),t.stop())},{context:`blockquote`}),this.listenTo(n,`delete`,(t,n)=>{if(n.direction!=`backward`||!r.isCollapsed||!i.value)return;let a=r.getLastPosition().parent;a.isEmpty&&!a.previousSibling&&(e.execute(`blockQuote`),e.editing.view.scrollToTheSelection(),n.preventDefault(),t.stop())},{context:`blockquote`})}},FE=class extends F{static get pluginName(){return`BlockQuoteUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.ui.componentFactory.add(`blockQuote`,()=>{let e=this._createButton(H);return e.set({tooltip:!0}),e}),e.ui.componentFactory.add(`menuBar:blockQuote`,()=>{let e=this._createButton(U);return e.set({role:`menuitemcheckbox`}),e})}_createButton(e){let t=this.editor,n=t.locale,r=t.commands.get(`blockQuote`),i=new e(t.locale),a=n.t;return i.set({label:a(`Block quote`),icon:qv,isToggleable:!0}),i.bind(`isEnabled`).to(r,`isEnabled`),i.bind(`isOn`).to(r,`value`),this.listenTo(i,`execute`,()=>{t.execute(`blockQuote`),t.editing.view.focus()}),i}},$te=class extends F{static get requires(){return[PE,FE]}static get pluginName(){return`BlockQuote`}static get isOfficialPlugin(){return!0}};const ene=E();var IE=class extends ene{_stack=[];add(e,t){let n=this._stack,r=n[0];this._insertDescriptor(e);let i=n[0];r!==i&&!LE(r,i)&&this.fire(`change:top`,{oldDescriptor:r,newDescriptor:i,writer:t})}remove(e,t){let n=this._stack,r=n[0];this._removeDescriptor(e);let i=n[0];r!==i&&!LE(r,i)&&this.fire(`change:top`,{oldDescriptor:r,newDescriptor:i,writer:t})}_insertDescriptor(e){let t=this._stack,n=t.findIndex(t=>t.id===e.id);if(LE(e,t[n]))return;n>-1&&t.splice(n,1);let r=0;for(;t[r]&&RE(t[r],e);)r++;t.splice(r,0,e)}_removeDescriptor(e){let t=this._stack,n=t.findIndex(t=>t.id===e);n>-1&&t.splice(n,1)}};function LE(e,t){return e&&t&&e.priority==t.priority&&zE(e.classes)==zE(t.classes)}function RE(e,t){return e.priority>t.priority?!0:e.priority<t.priority?!1:zE(e.classes)>zE(t.classes)}function zE(e){return Array.isArray(e)?e.sort().join(`,`):e}const BE=`ck-widget`,VE=`ck-widget_selected`;function HE(e){return e.is(`element`)?!!e.getCustomProperty(`widget`):!1}function UE(e,t,n={}){if(!e.is(`containerElement`))throw new w(`widget-to-widget-wrong-element-type`,null,{element:e});return t.setAttribute(`contenteditable`,`false`,e),t.addClass(BE,e),t.setCustomProperty(`widget`,!0,e),e.getFillerOffset=QE,t.setCustomProperty(`widgetLabel`,[],e),n.label&&qE(e,n.label),n.hasSelectionHandle&&$E(e,t),KE(e,t),e}function WE(e,t,n){if(t.classes&&n.addClass(A(t.classes),e),t.attributes)for(let r in t.attributes)n.setAttribute(r,t.attributes[r],e)}function GE(e,t,n){if(t.classes&&n.removeClass(A(t.classes),e),t.attributes)for(let r in t.attributes)n.removeAttribute(r,e)}function KE(e,t,n=WE,r=GE){let i=new IE;i.on(`change:top`,(t,i)=>{i.oldDescriptor&&r(e,i.oldDescriptor,i.writer),i.newDescriptor&&n(e,i.newDescriptor,i.writer)}),t.setCustomProperty(`addHighlight`,(e,t,n)=>i.add(t,n),e),t.setCustomProperty(`removeHighlight`,(e,t,n)=>i.remove(t,n),e)}function qE(e,t){e.getCustomProperty(`widgetLabel`).push(t)}function JE(e){return e.getCustomProperty(`widgetLabel`).reduce((e,t)=>typeof t==`function`?e?e+`. `+t():t():e?e+`. `+t:t,``)}function YE(e,t,n={}){return t.addClass([`ck-editor__editable`,`ck-editor__nested-editable`],e),n.withAriaRole!==!1&&t.setAttribute(`role`,`textbox`,e),e.isReadOnly||t.setAttribute(`tabindex`,`-1`,e),n.label&&t.setAttribute(`aria-label`,n.label,e),t.setAttribute(`contenteditable`,e.isReadOnly?`false`:`true`,e),e.on(`change:isReadOnly`,(n,r,i)=>{t.setAttribute(`contenteditable`,i?`false`:`true`,e),i?t.removeAttribute(`tabindex`,e):t.setAttribute(`tabindex`,`-1`,e)}),e.on(`change:isFocused`,(n,r,i)=>{i?t.addClass(`ck-editor__nested-editable_focused`,e):t.removeClass(`ck-editor__nested-editable_focused`,e)}),KE(e,t),e}function XE(e,t){let n=e.getSelectedElement();if(n){let r=sD(e);if(r)return t.createRange(t.createPositionAt(n,r))}return t.schema.findOptimalInsertionRange(e)}function ZE(e,t){return(n,r)=>{let{mapper:i,viewPosition:a}=r,o=i.findMappedViewAncestor(a);if(!t(o))return;let s=i.toModelElement(o);r.modelPosition=e.createPositionAt(s,a.isAtStart?`before`:`after`)}}function QE(){return null}function $E(e,t){let n=t.createUIElement(`div`,{class:`ck ck-widget__selection-handle`},function(e){let t=this.toDomElement(e),n=new Ly;return n.set(`content`,v_),n.render(),t.appendChild(n.element),t});t.insert(t.createPositionAt(e,0),n),t.addClass([`ck-widget_with-selection-handle`],e)}function eD(e){let t=e=>{let{width:t,paddingLeft:n,paddingRight:r}=e.ownerDocument.defaultView.getComputedStyle(e);return parseFloat(t)-(parseFloat(n)||0)-(parseFloat(r)||0)},n=e.parentElement;if(!n)return 0;let r=t(n),i=0,a=n;for(;isNaN(r);){if(a=a.parentElement,++i>5)return 0;r=t(a)}return r}function tD(e,t=new O(e)){let n=eD(e);return n?t.width/n*100:0}const nD=`widget-type-around`;function rD(e,t,n){return!!e&&HE(e)&&!n.isInline(t)}function iD(e){return e.closest(`.ck-widget__type-around__button`)}function aD(e){return e.classList.contains(`ck-widget__type-around__button_before`)?`before`:`after`}function oD(e,t){let n=e.closest(`.ck-widget`);return t.mapDomToView(n)}function sD(e){return e.getAttribute(nD)}const cD=[`before`,`after`],lD=new DOMParser().parseFromString($v,`image/svg+xml`).firstChild,uD=`ck-widget__type-around_disabled`;var dD=class extends F{_currentFakeCaretModelElement=null;static get pluginName(){return`WidgetTypeAround`}static get isOfficialPlugin(){return!0}static get requires(){return[TE,hT]}init(){let e=this.editor,t=e.editing.view;this.on(`change:isEnabled`,(n,r,i)=>{t.change(e=>{for(let n of t.document.roots)i?e.removeClass(uD,n):e.addClass(uD,n)}),i||e.model.change(e=>{e.removeSelectionAttribute(nD)})}),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){let n=this.editor,r=n.editing.view,i=n.model.schema.getAttributesWithProperty(e,`copyOnReplace`,!0);n.execute(`insertParagraph`,{position:n.model.createPositionAt(e,t),attributes:i}),r.focus(),r.scrollToTheSelection()}_listenToIfEnabled(e,t,n,r){this.listenTo(e,t,(...e)=>{this.isEnabled&&n(...e)},r)}_insertParagraphAccordingToFakeCaretPosition(){let e=this.editor.model.document.selection,t=sD(e);if(!t)return!1;let n=e.getSelectedElement();return this._insertParagraph(n,t),!0}_enableTypeAroundUIInjection(){let e=this.editor,t=e.model.schema,n=e.locale.t,r={before:n(`Insert paragraph before block`),after:n(`Insert paragraph after block`)};e.editing.downcastDispatcher.on(`insert`,(e,i,a)=>{let o=a.mapper.toViewElement(i.item);o&&rD(o,i.item,t)&&(fD(a.writer,r,o),o.getCustomProperty(`widgetLabel`).push(()=>this.isEnabled?n(`Press Enter to type after or press Shift + Enter to type before the widget`):``))},{priority:`low`})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){let e=this.editor,t=e.model,n=t.document.selection,r=t.schema,i=e.editing.view;this._listenToIfEnabled(i.document,`arrowKey`,(e,t)=>{this._handleArrowKeyPress(e,t)},{context:[HE,`$text`],priority:`high`}),this._listenToIfEnabled(n,`change:range`,(t,n)=>{n.directChange&&e.model.change(e=>{e.removeSelectionAttribute(nD)})}),this._listenToIfEnabled(t.document,`change:data`,()=>{let t=n.getSelectedElement();t&&rD(e.editing.mapper.toViewElement(t),t,r)||e.model.change(e=>{e.removeSelectionAttribute(nD)})}),this._listenToIfEnabled(e.editing.downcastDispatcher,`selection`,(e,t,n)=>{let i=n.writer;if(this._currentFakeCaretModelElement){let e=n.mapper.toViewElement(this._currentFakeCaretModelElement);e&&(i.removeClass(cD.map(a),e),this._currentFakeCaretModelElement=null)}let o=t.selection.getSelectedElement();if(!o)return;let s=n.mapper.toViewElement(o);if(!rD(s,o,r))return;let c=sD(t.selection);c&&(i.addClass(a(c),s),this._currentFakeCaretModelElement=o)}),this._listenToIfEnabled(e.ui.focusTracker,`change:isFocused`,(t,n,r)=>{r||e.model.change(e=>{e.removeSelectionAttribute(nD)})});function a(e){return`ck-widget_type-around_show-fake-caret_${e}`}}_handleArrowKeyPress(e,t){let n=this.editor,r=n.model,i=r.document.selection,a=r.schema,o=n.editing.view;if(t.shiftKey)return;let s=t.keyCode,c=wi(s,n.locale.contentLanguageDirection),l=o.document.selection.getSelectedElement(),u=n.editing.mapper.toModelElement(l),d;rD(l,u,a)?d=this._handleArrowKeyPressOnSelectedWidget(c):i.isCollapsed?d=this._handleArrowKeyPressWhenSelectionNextToAWidget(c):t.shiftKey||(d=this._handleArrowKeyPressWhenNonCollapsedSelection(c)),d&&(t.preventDefault(),e.stop())}_handleArrowKeyPressOnSelectedWidget(e){let t=this.editor.model,n=t.document.selection,r=sD(n);return t.change(t=>{if(r){if(r!==(e?`after`:`before`))return t.removeSelectionAttribute(nD),!0}else return t.setSelectionAttribute(nD,e?`after`:`before`),!0;return!1})}_handleArrowKeyPressWhenSelectionNextToAWidget(e){let t=this.editor,n=t.model,r=n.schema,i=t.plugins.get(`Widget`),a=i._getObjectElementNextToSelection(e);return rD(t.editing.mapper.toViewElement(a),a,r)?(n.change(t=>{i._setSelectionOverElement(a),t.setSelectionAttribute(nD,e?`before`:`after`)}),!0):!1}_handleArrowKeyPressWhenNonCollapsedSelection(e){let t=this.editor,n=t.model,r=n.schema,i=t.editing.mapper,a=n.document.selection,o=e?a.getLastPosition().nodeBefore:a.getFirstPosition().nodeAfter;return rD(i.toViewElement(o),o,r)?(n.change(t=>{t.setSelection(o,`on`),t.setSelectionAttribute(nD,e?`after`:`before`)}),!0):!1}_enableInsertingParagraphsOnButtonClick(){let e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,`mousedown`,(n,r)=>{let i=iD(r.domTarget);if(!i)return;let a=aD(i),o=oD(i,t.domConverter),s=e.editing.mapper.toModelElement(o);this._insertParagraph(s,a),r.preventDefault(),n.stop()})}_enableInsertingParagraphsOnEnterKeypress(){let e=this.editor,t=e.model.document.selection,n=e.editing.view;this._listenToIfEnabled(n.document,`enter`,(n,r)=>{if(n.eventPhase!=`atTarget`)return;let i=t.getSelectedElement(),a=e.editing.mapper.toViewElement(i),o=e.model.schema,s;this._insertParagraphAccordingToFakeCaretPosition()?s=!0:rD(a,i,o)&&(this._insertParagraph(i,r.isSoft?`before`:`after`),s=!0),s&&(r.preventDefault(),n.stop())},{context:HE})}_enableInsertingParagraphsOnTypingKeystroke(){let e=this.editor.editing.view.document;this._listenToIfEnabled(e,`insertText`,(t,n)=>{this._insertParagraphAccordingToFakeCaretPosition()&&(n.selection=e.selection)},{priority:`high`}),p.isAndroid?this._listenToIfEnabled(e,`keydown`,(e,t)=>{t.keyCode==229&&this._insertParagraphAccordingToFakeCaretPosition()}):this._listenToIfEnabled(e,`compositionstart`,()=>{this._insertParagraphAccordingToFakeCaretPosition()},{priority:`highest`})}_enableDeleteIntegration(){let e=this.editor,t=e.editing.view,n=e.model,r=n.schema;this._listenToIfEnabled(t.document,`delete`,(t,i)=>{if(t.eventPhase!=`atTarget`)return;let a=sD(n.document.selection);if(!a)return;let o=i.direction,s=n.document.selection.getSelectedElement(),c=a===`before`,l=o==`forward`;if(c===l)e.execute(`delete`,{selection:n.createSelection(s,`on`)});else{let t=r.getNearestSelectionRange(n.createPositionAt(s,a),o);if(t)if(!t.isCollapsed)n.change(n=>{n.setSelection(t),e.execute(l?`deleteForward`:`delete`)});else{let i=n.createSelection(t.start);if(n.modifySelection(i,{direction:o}),!i.focus.isEqual(t.start))n.change(n=>{n.setSelection(t),e.execute(l?`deleteForward`:`delete`)});else{let e=hD(r,t.start.parent);n.deleteContent(n.createSelection(e,`on`),{doNotAutoparagraph:!0})}}}i.preventDefault(),t.stop()},{context:HE})}_enableInsertContentIntegration(){let e=this.editor,t=this.editor.model,n=t.document.selection;this._listenToIfEnabled(e.model,`insertContent`,(e,[r,i])=>{if(i&&!i.is(`documentSelection`))return;let a=sD(n);if(a)return e.stop(),t.change(e=>{let i=n.getSelectedElement(),o=t.createPositionAt(i,a),s=e.createSelection(o),c=t.insertContent(r,s);return e.setSelection(s),c})},{priority:`high`})}_enableInsertObjectIntegration(){let e=this.editor,t=this.editor.model.document.selection;this._listenToIfEnabled(e.model,`insertObject`,(e,n)=>{let[,r,i={}]=n;if(r&&!r.is(`documentSelection`))return;let a=sD(t);a&&(i.findOptimalPosition=a,n[3]=i)},{priority:`high`})}_enableDeleteContentIntegration(){let e=this.editor,t=this.editor.model.document.selection;this._listenToIfEnabled(e.model,`deleteContent`,(e,[n])=>{n&&!n.is(`documentSelection`)||sD(t)&&e.stop()},{priority:`high`})}};function fD(e,t,n){let r=e.createUIElement(`div`,{class:`ck ck-reset_all ck-widget__type-around`},function(e){let n=this.toDomElement(e);return pD(n,t),mD(n),n});e.insert(e.createPositionAt(n,`end`),r)}function pD(e,t){for(let n of cD){let r=new ga({tag:`div`,attributes:{class:[`ck`,`ck-widget__type-around__button`,`ck-widget__type-around__button_${n}`],title:t[n],"aria-hidden":`true`},children:[e.ownerDocument.importNode(lD,!0)]});e.appendChild(r.render())}}function mD(e){let t=new ga({tag:`div`,attributes:{class:[`ck`,`ck-widget__type-around__fake-caret`]}});e.appendChild(t.render())}function hD(e,t){let n=t;for(let r of t.getAncestors({parentFirst:!0})){if(r.childCount>1||e.isLimit(r))break;n=r}return n}function gD(e){let t=e.model;return(n,r)=>{let i=r.keyCode==k.arrowup,a=r.keyCode==k.arrowdown,o=r.shiftKey,s=t.document.selection;if(!i&&!a)return;let c=a,l=_D(e,s,c);if(l){if(l.isCollapsed&&(s.isCollapsed||o))return;(l.isCollapsed||bD(e,l,c))&&(t.change(e=>{let n=c?l.end:l.start;if(o){let r=t.createSelection(s.anchor);r.setFocus(n),e.setSelection(r)}else e.setSelection(n)}),n.stop(),r.preventDefault(),r.stopPropagation())}}}function _D(e,t,n){let r=e.model;if(n){let e=t.focus,n=vD(r,e,`forward`);if(!n)return;let i=r.createRange(e,n),a=yD(r.schema,i,`backward`);if(a)return r.createRange(e,a)}else{let e=t.focus,n=vD(r,e,`backward`);if(!n)return;let i=r.createRange(n,e),a=yD(r.schema,i,`forward`);if(a)return r.createRange(a,e)}}function vD(e,t,n){let r=e.schema,i=e.createRangeIn(t.root),a=n==`forward`?`elementStart`:`elementEnd`;for(let{previousPosition:e,item:o,type:s}of i.getWalker({startPosition:t,direction:n})){if(r.isLimit(o)&&!r.isInline(o))return e;if(s==a&&r.isBlock(o))return null}return null}function yD(e,t,n){let r=n==`backward`?t.end:t.start;if(e.checkChild(r,`$text`))return r;for(let{nextPosition:r}of t.getWalker({direction:n}))if(e.checkChild(r,`$text`))return r}function bD(e,t,n){let r=e.model,i=e.view.domConverter;if(n){let e=r.createSelection(t.start);r.modifySelection(e),!e.focus.isAtEnd&&!t.start.isEqual(e.focus)&&(t=r.createRange(e.focus,t.end))}let a=e.mapper.toViewRange(t),o=i.viewRangeToDom(a),s=O.getDomRangeRects(o),c;for(let e of s){if(c===void 0){c=Math.round(e.bottom);continue}if(Math.round(e.top)>=c)return!1;c=Math.max(c,Math.round(e.bottom))}return!0}var xD=class extends F{_previouslySelected=new Set;static get pluginName(){return`Widget`}static get isOfficialPlugin(){return!0}static get requires(){return[dD,hT]}init(){let e=this.editor,t=e.editing.view,n=t.document,r=e.t;this.editor.editing.downcastDispatcher.on(`selection`,(t,n,r)=>{let i=r.writer,a=n.selection;if(a.isCollapsed)return;let o=a.getSelectedElement();if(!o)return;let s=e.editing.mapper.toViewElement(o);HE(s)&&r.consumable.consume(a,`selection`)&&i.setSelection(i.createRangeOn(s),{fake:!0,label:JE(s)})}),this.editor.editing.downcastDispatcher.on(`selection`,(e,t,n)=>{this._clearPreviouslySelectedWidgets(n.writer);let r=n.writer,i=r.document.selection,a=null;for(let e of i.getRanges())for(let t of e){let e=t.item;HE(e)&&!ED(e,a)&&(r.addClass(VE,e),this._previouslySelected.add(e),a=e)}},{priority:`low`}),t.addObserver(Ap),t.addObserver(Mp),this.listenTo(n,`mousedown`,(...e)=>this._onMousedown(...e)),this.listenTo(n,`pointerdown`,(...e)=>this._onPointerdown(...e)),this.listenTo(n,`arrowKey`,(...e)=>{this._handleSelectionChangeOnArrowKeyPress(...e)},{context:[HE,`$text`]}),this.listenTo(n,`arrowKey`,(...e)=>{this._preventDefaultOnArrowKeyPress(...e)},{context:`$root`}),this.listenTo(n,`arrowKey`,gD(this.editor.editing),{context:`$text`}),this.listenTo(n,`delete`,(e,t)=>{this._handleDelete(t.direction==`forward`)&&(t.preventDefault(),e.stop())},{context:`$root`}),this.listenTo(n,`tab`,(e,n)=>{this._selectNextEditable(n.shiftKey?`backward`:`forward`)&&(t.scrollToTheSelection(),n.preventDefault(),e.stop())},{context:e=>HE(e)||e.is(`editableElement`),priority:`low`}),this.listenTo(n,`keydown`,(e,t)=>{t.keystroke==k.esc&&this._selectAncestorWidget()&&(t.preventDefault(),e.stop())},{context:e=>e.is(`editableElement`),priority:`low`}),e.accessibility.addKeystrokeInfoGroup({id:`widget`,label:r(`Keystrokes that can be used when a widget is selected (for example: image, table, etc.)`),keystrokes:[{label:r(`Move focus from an editable area back to the parent widget`),keystroke:`Esc`},{label:r(`Insert a new paragraph directly after a widget`),keystroke:`Enter`},{label:r(`Insert a new paragraph directly before a widget`),keystroke:`Shift+Enter`},{label:r(`Move the caret to allow typing directly before a widget`),keystroke:[[`arrowup`],[`arrowleft`]]},{label:r(`Move the caret to allow typing directly after a widget`),keystroke:[[`arrowdown`],[`arrowright`]]}]})}_onMousedown(e,t){let n=t.target;n&&t.domEvent.detail>=3&&this._selectBlockContent(n)&&t.preventDefault()}_onPointerdown(e,t){if(!t.domEvent.isPrimary||iD(t.domTarget))return;let n=this.editor,r=n.editing.view,i=r.document,a=t.target;if(!a)return;if(!HE(a)){let e=wD(a);if(!e)return;if(HE(e))a=e;else{let e=TD(r,t);if(e&&HE(e))a=e;else return}}(p.isAndroid||p.isiOS)&&t.preventDefault(),i.isFocused||r.focus();let o=n.editing.mapper.toModelElement(a);this._setSelectionOverElement(o)}_selectBlockContent(e){let t=this.editor,n=t.model,r=t.editing.mapper,i=n.schema,a=r.findMappedViewAncestor(this.editor.editing.view.createPositionAt(e,0)),o=DD(r.toModelElement(a),n.schema);return o?(n.change(e=>{let t=i.isLimit(o)?null:OD(e.createPositionAfter(o),i),n=e.createPositionAt(o,0),r=t?e.createPositionAt(t,0):e.createPositionAt(o,`end`);e.setSelection(e.createRange(n,r))}),!0):!1}_handleSelectionChangeOnArrowKeyPress(e,t){let n=t.keyCode,r=this.editor.model,i=r.schema,a=r.document.selection,o=a.getSelectedElement(),s=Si(n,this.editor.locale.contentLanguageDirection),c=s==`down`||s==`right`,l=s==`up`||s==`down`;if(!t.shiftKey&&!a.isCollapsed){if(SD(a,i)){let n=c?a.getLastPosition():a.getFirstPosition(),o=i.getNearestSelectionRange(n,c?`forward`:`backward`);o&&(r.change(e=>{e.setSelection(o)}),t.preventDefault(),e.stop())}return}let u=CD(r,c),d=r.createSelection(u);if(r.modifySelection(d,{direction:c?`forward`:`backward`}),d.isEqual(u))return;d.focus.isTouching(u.focus)&&i.checkChild(d.focus.parent,`$text`)&&(c?!d.focus.isAtEnd:!d.focus.isAtStart)&&r.modifySelection(d,{direction:c?`forward`:`backward`});let f=c?u.focus.nodeBefore:u.focus.nodeAfter,p=d.focus.nodeBefore,m=d.focus.nodeAfter,h=c?p:m;if(t.shiftKey)(o&&i.isObject(o)||h&&i.isObject(h)||f&&i.isObject(f))&&(r.change(e=>{e.setSelection(d)}),t.preventDefault(),e.stop());else if(h&&i.isObject(h)){if(i.isInline(h)&&l)return;r.change(e=>{e.setSelection(h,`on`)}),t.preventDefault(),e.stop()}}_preventDefaultOnArrowKeyPress(e,t){let n=this.editor.model,r=n.schema,i=n.document.selection.getSelectedElement();i&&r.isObject(i)&&(t.preventDefault(),e.stop())}_handleDelete(e){let t=this.editor.model.document.selection;if(!this.editor.model.canEditAt(t)||!t.isCollapsed)return;let n=this._getObjectElementNextToSelection(e);if(n)return this.editor.model.change(e=>{let r=t.anchor.parent;for(;r.isEmpty;){let t=r;r=t.parent,e.remove(t)}this._setSelectionOverElement(n)}),!0}_setSelectionOverElement(e){this.editor.model.change(t=>{t.setSelection(t.createRangeOn(e))})}_getObjectElementNextToSelection(e){let t=this.editor.model,n=t.schema,r=t.document.selection,i=t.createSelection(r);if(t.modifySelection(i,{direction:e?`forward`:`backward`}),i.isEqual(r))return null;let a=e?i.focus.nodeBefore:i.focus.nodeAfter;return a&&n.isObject(a)?a:null}_clearPreviouslySelectedWidgets(e){for(let t of this._previouslySelected)e.removeClass(VE,t);this._previouslySelected.clear()}_selectNextEditable(e){let t=this.editor.editing,n=t.view,r=this.editor.model,i=n.document.selection,a=r.document.selection,o;if(a.rangeCount>1){let n=a.isBackward?a.getFirstRange():a.getLastRange();o=t.mapper.toViewPosition(e==`forward`?n.end:n.start)}else o=e==`forward`?i.getFirstPosition():i.getLastPosition();let s=this._findNextFocusRange(o,e);return s?(r.change(e=>{e.setSelection(s)}),!0):!1}_findNextFocusRange(e,t){let n=this.editor.editing,r=n.view,i=this.editor.model,a=r.document.selection,o=a.editableElement,s=o.getPath(),c=a.getSelectedElement();c&&!HE(c)&&(c=null);let l=t==`forward`?r.createRange(e,r.createPositionAt(e.root,`end`)):r.createRange(r.createPositionAt(e.root,0),e);for(let{nextPosition:e}of l.getWalker({direction:t})){let r=e.parent;if(HE(r)&&r!=c){let e=n.mapper.toModelElement(r);if(!i.schema.isBlock(e))continue;if(fr(s,r.getPath())!=`extension`)return i.createRangeOn(e)}else if(r.is(`editableElement`)){if(r==o&&!c)continue;let a=n.mapper.toModelPosition(e),l=i.schema.getNearestSelectionRange(a,t);if(!l)continue;return r==o&&c||fr(s,r.getPath())==`extension`?l:i.createRangeIn(i.schema.getLimitElement(l))}}return null}_selectAncestorWidget(){let e=this.editor,t=e.editing.mapper,n=e.editing.view.document.selection.getFirstPosition().parent,r=(n.is(`$text`)?n.parent:n).findAncestor(HE);if(!r)return!1;let i=t.toModelElement(r);return i?(e.model.change(e=>{e.setSelection(i,`on`)}),!0):!1}};function SD(e,t){let n=e.getFirstPosition(),r=e.getLastPosition(),i=n.nodeAfter,a=r.nodeBefore;return!!i&&t.isObject(i)||!!a&&t.isObject(a)}function CD(e,t){let n=e.document.selection,r=n.getSelectedElement(),i=sD(n);return r&&i==`before`?e.createSelection(r,`before`):r&&i==`after`?e.createSelection(r,`after`):e.createSelection(n.getRanges(),{backward:r&&e.schema.isObject(r)?!t:n.isBackward})}function wD(e){let t=e;for(;t;){if(t.is(`editableElement`)||HE(t))return t;t=t.parent}return null}function TD(e,t){let n=Or(t.domEvent),r=null;if(r=n?e.domConverter.domRangeToView(n):e.createRange(e.createPositionAt(t.target,0)),!r)return null;let i=r.start;if(!i.parent)return null;let a=i.parent;return i.parent.is(`editableElement`)&&(i.isAtEnd&&i.nodeBefore?a=i.nodeBefore:i.isAtStart&&i.nodeAfter&&(a=i.nodeAfter)),a.is(`$text`)?a.parent:a}function ED(e,t){return t?Array.from(e.getAncestors()).includes(t):!1}function DD(e,t){for(let n of e.getAncestors({includeSelf:!0,parentFirst:!0})){if(t.checkChild(n,`$text`))return n;if(t.isLimit(n)&&!t.isObject(n))break}return null}function OD(e,t){let n=new Xc({startPosition:e});for(let{item:e}of n){if(t.isLimit(e)||!e.is(`element`))return null;if(t.checkChild(e,`$text`))return e}return null}var kD=class extends F{_toolbarDefinitions=new Map;_balloon;static get requires(){return[BC]}static get pluginName(){return`WidgetToolbarRepository`}static get isOfficialPlugin(){return!0}init(){let e=this.editor;if(e.plugins.has(`BalloonToolbar`)){let t=e.plugins.get(`BalloonToolbar`);this.listenTo(t,`show`,t=>{MD(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(let e of this._toolbarDefinitions.values())e.view.destroy()}register(e,{ariaLabel:t,items:n,getRelatedElement:r,balloonClassName:i=`ck-toolbar-container`,positions:a}){if(!n.length){T(`widget-toolbar-no-items`,{toolbarId:e});return}let o=this.editor,s=o.t,c=new Ox(o.locale);if(c.ariaLabel=t||s(`Widget toolbar`),this._toolbarDefinitions.has(e))throw new w(`widget-toolbar-duplicated`,this,{toolbarId:e});let l={view:c,getRelatedElement:r,balloonClassName:i,itemsConfig:n,positions:a,initialized:!1};o.ui.addToolbar(c,{isContextual:!0,beforeFocus:()=>{let e=r(o.editing.view.document.selection);e&&this._showToolbar(l,e)},afterBlur:()=>{this._hideToolbar(l)}}),this._toolbarDefinitions.set(e,l)}_updateToolbarsVisibility(){let e=0,t=null,n=null;for(let r of this._toolbarDefinitions.values()){let i=r.getRelatedElement(this.editor.editing.view.document.selection);if(!this.isEnabled||!i)this._isToolbarInBalloon(r)&&this._hideToolbar(r);else if(!this.editor.ui.focusTracker.isFocused)this._isToolbarVisible(r)&&this._hideToolbar(r);else{let a=i.getAncestors().length;a>e&&(e=a,t=i,n=r)}}n&&this._showToolbar(n,t)}_hideToolbar(e){this._balloon.remove(e.view),this.stopListening(this._balloon,`change:visibleView`)}_showToolbar(e,t){this._isToolbarVisible(e)?AD(this.editor,t,e.positions):this._isToolbarInBalloon(e)||(e.initialized||(e.initialized=!0,e.view.fillFromConfig(e.itemsConfig,this.editor.ui.componentFactory)),this._balloon.add({view:e.view,position:jD(this.editor,t,e.positions),balloonClassName:e.balloonClassName}),this.listenTo(this._balloon,`change:visibleView`,()=>{for(let t of this._toolbarDefinitions.values())if(this._isToolbarVisible(t)){let n=t.getRelatedElement(this.editor.editing.view.document.selection);AD(this.editor,n,e.positions)}}))}_isToolbarVisible(e){return this._balloon.visibleView===e.view}_isToolbarInBalloon(e){return this._balloon.hasView(e.view)}};function AD(e,t,n){let r=e.plugins.get(`ContextualBalloon`),i=jD(e,t,n);r.updatePosition(i)}function jD(e,t,n){let r=e.editing.view,i=ab.defaultPositions;return{target:r.domConverter.mapViewToDom(t),positions:n||[i.northArrowSouth,i.northArrowSouthWest,i.northArrowSouthEast,i.southArrowNorth,i.southArrowNorthWest,i.southArrowNorthEast,i.viewportStickyNorth]}}function MD(e){let t=e.getSelectedElement();return!!(t&&HE(t))}const ND=D();var PD=class extends ND{_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,n){let r=new O(t);this.activeHandlePosition=LD(e),this._referenceCoordinates=FD(t,RD(this.activeHandlePosition)),this._originalWidth=r.width,this._originalHeight=r.height,this._aspectRatio=r.width/r.height;let i=n.style.width;i&&i.match(/^\d+(\.\d*)?%$/)?this._originalWidthPercents=parseFloat(i):this._originalWidthPercents=tD(n,r)}update(e){this.proposedWidth=e.width,this.proposedHeight=e.height,this.proposedWidthPercents=e.widthPercents,this.proposedHandleHostWidth=e.handleHostWidth,this.proposedHandleHostHeight=e.handleHostHeight}};function FD(e,t){let n=new O(e),r=t.split(`-`),i={x:r[1]==`right`?n.right:n.left,y:r[0]==`bottom`?n.bottom:n.top};return i.x+=e.ownerDocument.defaultView.scrollX,i.y+=e.ownerDocument.defaultView.scrollY,i}function ID(e){return`ck-widget__resizer__handle-${e}`}function LD(e){for(let t of[`top-left`,`top-right`,`bottom-right`,`bottom-left`])if(e.classList.contains(ID(t)))return t}function RD(e){let t=e.split(`-`),n={top:`bottom`,bottom:`top`,left:`right`,right:`left`};return`${n[t[0]]}-${n[t[1]]}`}var zD=class extends P{constructor(){super();let 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)=>e!==null&&t!==null),this.bind(`_label`).to(t,`proposedHandleHostWidth`,t,`proposedHandleHostHeight`,t,`proposedWidthPercents`,(t,n,r)=>e.unit===`px`?`${t}×${n}`:`${r}%`),this.bind(`_viewPosition`).to(t,`activeHandlePosition`,t,`proposedHandleHostWidth`,t,`proposedHandleHostHeight`,(e,t,n)=>t<50||n<50?`above-center`:e)}_dismiss(){this.unbind(),this._isVisible=!1}};const BD=D();var VD=class extends BD{_state;_sizeView;_options;_viewResizerWrapper=null;_initialViewWidth;constructor(e){super(),this._options=e,this.set(`isEnabled`,!0),this.set(`isSelected`,!1),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(){let e=this,t=this._options.viewElement;this._options.editor.editing.view.change(n=>{let r=n.createUIElement(`div`,{class:`ck ck-reset_all ck-widget__resizer`},function(t){let n=this.toDomElement(t);return e._appendHandles(n),e._appendSizeUI(n),n});n.insert(n.createPositionAt(t,`end`),r),n.addClass(`ck-widget_with-resizer`,t),this._viewResizerWrapper=r,this.isVisible||this.hide()}),this.on(`change:isVisible`,()=>{this.isVisible?(this.show(),this.redraw()):this.hide()})}begin(e){this._state=new PD(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){let t=this._proposeNewSize(e);this._options.editor.editing.view.change(e=>{let n=this._options.unit||`%`,r=(n===`%`?t.widthPercents:t.width)+n;e.setStyle(`width`,r,this._options.viewElement)});let n=this._getHandleHost(),r=new O(n),i=Math.round(r.width),a=Math.round(r.height),o=new O(n);t.width=Math.round(o.width),t.height=Math.round(o.height),this.redraw(r),this.state.update({...t,handleHostWidth:i,handleHostHeight:a})}commit(){let 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){let t=this._domResizerWrapper;if(!WD(t))return;let n=t.parentElement,r=this._getHandleHost(),i=this._viewResizerWrapper,a=[i.getStyle(`width`),i.getStyle(`height`),i.getStyle(`left`),i.getStyle(`top`)],o;if(n.isSameNode(r)){let t=e||new O(r);o=[t.width+`px`,t.height+`px`,void 0,void 0]}else o=[r.offsetWidth+`px`,r.offsetHeight+`px`,r.offsetLeft+`px`,r.offsetTop+`px`];fr(a,o)!==`same`&&this._options.editor.editing.view.change(e=>{e.setStyle({width:o[0],height:o[1],left:o[2],top:o[3]},i)})}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){let t=this.state,n=UD(e),r=this._options.isCentered?this._options.isCentered(this):!0,i={x:t._referenceCoordinates.x-(n.x+t.originalWidth),y:n.y-t.originalHeight-t._referenceCoordinates.y};r&&t.activeHandlePosition.endsWith(`-right`)&&(i.x=n.x-(t._referenceCoordinates.x+t.originalWidth)),r&&(i.x*=2);let a=Math.abs(t.originalWidth+i.x),o=Math.abs(t.originalHeight+i.y);return(a/t.aspectRatio>o?`width`:`height`)==`width`?o=a/t.aspectRatio:a=o*t.aspectRatio,{width:Math.round(a),height:Math.round(o),widthPercents:Math.min(Math.round(t.originalWidthPercents/t.originalWidth*a*100)/100,100)}}_getResizeHost(){let e=this._domResizerWrapper.parentElement;return this._options.getResizeHost(e)}_getHandleHost(){let e=this._domResizerWrapper.parentElement;return this._options.getHandleHost(e)}get _domResizerWrapper(){return this._options.editor.editing.view.domConverter.mapViewToDom(this._viewResizerWrapper)}_appendHandles(e){for(let t of[`top-left`,`top-right`,`bottom-right`,`bottom-left`])e.appendChild(new ga({tag:`div`,attributes:{class:`ck-widget__resizer__handle ${HD(t)}`}}).render())}_appendSizeUI(e){this._sizeView=new zD,this._sizeView.render(),e.appendChild(this._sizeView.element)}};function HD(e){return`ck-widget__resizer__handle-${e}`}function UD(e){return{x:e.pageX,y:e.pageY}}function WD(e){return e&&e.ownerDocument&&e.ownerDocument.contains(e)}var GD=class extends F{_resizers=new Map;_observer;_redrawSelectedResizerThrottled;static get pluginName(){return`WidgetResize`}static get isOfficialPlugin(){return!0}init(){let e=this.editor.editing,t=u.window.document;this.set(`selectedResizer`,null),this.set(`_activeResizer`,null),e.view.addObserver(Ap),this._observer=new(br()),this.listenTo(e.view.document,`mousedown`,this._mouseDownListener.bind(this),{priority:`high`}),this._observer.listenTo(t,`mousemove`,this._mouseMoveListener.bind(this)),this._observer.listenTo(t,`mouseup`,this._mouseUpListener.bind(this)),this._redrawSelectedResizerThrottled=qt(()=>this.redrawSelectedResizer(),200),this.editor.ui.on(`update`,this._redrawSelectedResizerThrottled),this.editor.model.document.on(`change`,()=>{for(let[e,t]of this._resizers)e.isAttached()||(this._resizers.delete(e),t.destroy())},{priority:`lowest`}),this._observer.listenTo(u.window,`resize`,this._redrawSelectedResizerThrottled);let n=this.editor.editing.view.document.selection;n.on(`change`,()=>{let 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(let e of this._resizers.values())e.destroy();this._redrawSelectedResizerThrottled.cancel()}select(e){this.deselect(),this.selectedResizer=e,this.selectedResizer.isSelected=!0}deselect(){this.selectedResizer&&(this.selectedResizer.isSelected=!1),this.selectedResizer=null}attachTo(e){let t=new VD(e),n=this.editor.plugins;if(t.attach(),n.has(`WidgetToolbarRepository`)){let e=n.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);let r=this.editor.editing.view.document.selection.getSelectedElement();return this.getResizerByViewElement(r)==t&&this.select(t),t}getResizerByViewElement(e){return this._resizers.get(e)}_getResizerByHandle(e){for(let t of this._resizers.values())if(t.containsHandle(e))return t}_mouseDownListener(e,t){let n=t.domTarget;VD.isResizeHandle(n)&&(this._activeResizer=this._getResizerByHandle(n)||null,this._activeResizer&&(this._activeResizer.begin(n),e.stop(),t.preventDefault()))}_mouseMoveListener(e,t){this._activeResizer&&this._activeResizer.updateSize(t)}_mouseUpListener(){this._activeResizer&&=(this._activeResizer.commit(),null)}},KD=class extends P{focusTracker=new M;keystrokes=new N;idInputView;backButtonView;saveButtonView;children;_validators;_focusables=new pa;_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 MC(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 Hy({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(),Qa({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(let e of this._validators){let t=e(this);if(t)return this.idInputView.errorText=t,!1}return!0}resetFormStatus(){this.idInputView.errorText=null}_createBackButton(){let e=this.locale.t,t=new H(this.locale);return t.set({class:`ck-button-back`,label:e(`Back`),icon:Wv,tooltip:!0}),t.delegate(`execute`).to(this,`cancel`),t}_createSaveButton(){let e=this.locale.t,t=new H(this.locale);return t.set({label:e(`Save`),withText:!0,type:`submit`,class:`ck-button-action ck-button-bold`}),t}_createHeaderView(){let e=this.locale.t,t=new By(this.locale,{label:e(`Bookmark`)});return t.children.add(this.backButtonView,0),t}_createIdInput(){let e=this.locale.t,t=new Qb(this.locale,Jx);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(){let{element:e}=this.idInputView.fieldView;return e?e.value.trim():null}};function qD(e){return!(!e||typeof e!=`string`||/\s/.test(e))}var JD=class extends I{refresh(){let e=this.editor.model.document.selection,t=this._getPositionToInsertBookmark(e);this.isEnabled=!!t}execute(e){if(!e)return;let{bookmarkId:t}=e;if(!qD(t)){T(`insert-bookmark-command-executed-with-invalid-name`);return}let n=this.editor,r=n.model,i=r.document.selection;r.change(e=>{let a=this._getPositionToInsertBookmark(i);if(!r.schema.checkChild(a,`bookmark`)){let e=n.execute(`insertParagraph`,{position:a});if(!e)return;a=e}let o=e.createElement(`bookmark`,{...Object.fromEntries(i.getAttributes()),bookmarkId:t});r.insertObject(o,a,null,{setSelection:`on`})})}_getPositionToInsertBookmark(e){let t=this.editor.model,n=t.schema,r=e.getFirstRange(),i=r.start;if(YD(i,n))return i;for(let{previousPosition:e,item:i}of r){if(i.is(`element`)&&n.checkChild(i,`$text`)&&YD(i,n))return t.createPositionAt(i,0);if(YD(e,n))return e}return null}};function YD(e,t){return t.checkChild(e,`bookmark`)?!0:t.checkChild(e,`paragraph`)?t.checkChild(`paragraph`,`bookmark`):!1}var XD=class extends I{refresh(){let e=this.editor.model.document.selection,t=ZD(e);this.isEnabled=!!t,this.value=t?t.getAttribute(`bookmarkId`):void 0}execute(e){if(!e)return;let{bookmarkId:t}=e;if(!qD(t)){T(`update-bookmark-command-executed-with-invalid-name`);return}let n=this.editor.model,r=n.document.selection,i=ZD(r);i&&n.change(e=>{e.setAttribute(`bookmarkId`,t,i)})}};function ZD(e){let t=e.getSelectedElement();return t&&t.is(`element`,`bookmark`)?t:null}var QD=class extends F{_bookmarkElements=new Map;static get pluginName(){return`BookmarkEditing`}static get licenseFeatureCode(){return`BKM`}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}constructor(e){super(e),e.config.define(`bookmark`,{toolbar:[`bookmarkPreview`,`|`,`editBookmark`,`removeBookmark`]})}init(){let{editor:e}=this;this._defineSchema(),this._defineConverters(),e.commands.add(`insertBookmark`,new JD(e)),e.commands.add(`updateBookmark`,new XD(e)),this.listenTo(e.model.document,`change:data`,()=>{this._trackBookmarkElements()})}getElementForBookmarkId(e){for(let[t,n]of this._bookmarkElements)if(n==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(){let{editor:e}=this,{conversion:t,t:n}=e;e.data.htmlProcessor.domConverter.registerInlineObjectMatcher(e=>$D(e)),e.editing.view.domConverter.registerInlineObjectMatcher(e=>$D(e,!1)),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})=>{let r=e.getAttribute(`bookmarkId`),i=t.createContainerElement(`a`,{id:r,class:`ck-bookmark`},[this._createBookmarkUIElement(t)]);return t.setCustomProperty(`bookmark`,!0,i),this._bookmarkElements.set(e,r),UE(i,t,{label:()=>`${r} ${n(`bookmark widget`)}`})}}),t.for(`upcast`).add(t=>t.on(`element:a`,eO(e)))}_createBookmarkUIElement(e){return e.createUIElement(`span`,{class:`ck-bookmark__icon`},function(e){let t=this.toDomElement(e),n=new Ly;return n.set({content:Qg,isColorInherited:!1}),n.render(),t.appendChild(n.element),t})}_trackBookmarkElements(){this._bookmarkElements.forEach((e,t)=>{t.root.rootName===`$graveyard`&&this._bookmarkElements.delete(t)})}};function $D(e,t=!0){if(e.name!==`a`||t&&!e.isEmpty)return null;let n=e.hasAttribute(`id`),r=e.hasAttribute(`name`),i=e.hasAttribute(`href`);return n&&!i?{name:!0,attributes:[`id`]}:r&&!i?{name:!0,attributes:[`name`]}:null}function eO(e){return(t,n,r)=>{let i=n.viewItem,a=$D(i,!1);if(!a||!r.consumable.test(i,a)||!tO(e)&&!i.isEmpty)return;let o=r.writer,s=i.getAttribute(`id`),c=i.getAttribute(`name`),l=s||c,u=o.createElement(`bookmark`,{bookmarkId:l});if(!r.safeInsert(u,n.modelCursor))return;r.consumable.consume(i,a),s===c&&r.consumable.consume(i,{attributes:[`name`]}),r.updateConversionResult(u,n);let{modelCursor:d,modelRange:f}=r.convertChildren(i,n.modelCursor);n.modelCursor=d,n.modelRange=o.createRange(n.modelRange.start,f.end)}}function tO(e){let t=e.config.get(`bookmark.enableNonEmptyAnchorConversion`);return t===void 0?!0:t}const nO=`bookmark-ui`;var rO=class extends F{formView=null;_balloon;static get requires(){return[QD,BC,kD]}static get pluginName(){return`BookmarkUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor;this._balloon=e.plugins.get(BC),e.plugins.has(`LinkUI`)&&this._registerLinkProvider(),this._registerComponents(),e.conversion.for(`editingDowncast`).markerToHighlight({model:nO,view:{classes:[`ck-fake-bookmark-selection`]}}),e.conversion.for(`editingDowncast`).markerToElement({model:nO,view:(e,{writer:t})=>{if(!e.markerRange.isCollapsed)return null;let n=t.createUIElement(`span`);return t.addClass([`ck-fake-bookmark-selection`,`ck-fake-bookmark-selection_collapsed`],n),n}})}afterInit(){let e=this.editor,t=e.locale.t,n=this.editor.plugins.get(kD),r=ab.defaultPositions;n.register(`bookmark`,{ariaLabel:t(`Bookmark toolbar`),items:e.config.get(`bookmark.toolbar`),getRelatedElement:aO,balloonClassName:`ck-bookmark-balloon ck-toolbar-container`,positions:[r.southArrowNorth,r.southArrowNorthMiddleWest,r.southArrowNorthMiddleEast,r.southArrowNorthWest,r.southArrowNorthEast,r.northArrowSouth,r.northArrowSouthMiddleWest,r.northArrowSouthMiddleEast,r.northArrowSouthWest,r.northArrowSouthEast,r.viewportStickyNorth]})}destroy(){super.destroy(),this.formView&&this.formView.destroy()}_createViews(){this.formView=this._createFormView(),this._enableUserBalloonInteractions()}_createFormView(){let e=this.editor,t=e.locale,n=t.t,r=e.commands.get(`insertBookmark`),i=e.commands.get(`updateBookmark`),a=[r,i],o=new(Xa(KD))(t,iO(e));return o.idInputView.fieldView.bind(`value`).to(i,`value`),o.saveButtonView.bind(`label`).to(i,`value`,e=>n(e?`Save`:`Insert`)),o.idInputView.bind(`isEnabled`).toMany(a,`isEnabled`,(...e)=>e.some(e=>e)),o.saveButtonView.bind(`isEnabled`).toMany(a,`isEnabled`,(...e)=>e.some(e=>e)),this.listenTo(o,`cancel`,()=>{this._hideFormView()}),this.listenTo(o,`submit`,()=>{if(o.isValid()){let t=o.id;this._getSelectedBookmarkElement()?e.execute(`updateBookmark`,{bookmarkId:t}):e.execute(`insertBookmark`,{bookmarkId:t}),this._hideFormView()}}),this.listenTo(o.idInputView,`change:errorText`,()=>{e.ui.update()}),o}_registerLinkProvider(){let e=this.editor.locale.t,t=this.editor.plugins.get(`LinkUI`),n=this.editor.plugins.get(QD);t.registerLinksListProvider({label:e(`Bookmarks`),emptyListPlaceholder:e(`No bookmarks available.`),navigate:({href:e})=>this._scrollToBookmark(e),getListItems:()=>Array.from(n.getAllBookmarkNames()).sort((e,t)=>e.localeCompare(t)).map(e=>({id:e,href:`#${e}`,label:e,icon:e_})),getItem:t=>{let r=[...n.getAllBookmarkNames()].find(e=>`#${e}`===t);return r?{href:t,label:r,icon:t_,tooltip:e(`Scroll to bookmark`)}:null}})}_scrollToBookmark(e){let t=this.editor.plugins.get(QD).getElementForBookmarkId(e.slice(1));return t?(this.editor.model.change(e=>{e.setSelection(t,`on`)}),this.editor.editing.view.scrollToTheSelection({alignToTop:!0,forceScroll:!0}),!0):!1}_registerComponents(){let e=this.editor;e.ui.componentFactory.add(`bookmark`,()=>{let e=this._createBookmarkButton(H);return e.set({tooltip:!0}),e}),e.ui.componentFactory.add(`menuBar:bookmark`,()=>this._createBookmarkButton(U)),e.ui.componentFactory.add(`bookmarkPreview`,t=>{let n=e.commands.get(`updateBookmark`),r=new eo(t);return r.extendTemplate({attributes:{class:[`ck-bookmark-toolbar__preview`]}}),r.bind(`text`).to(n,`value`),r}),e.ui.componentFactory.add(`editBookmark`,t=>{let n=e.commands.get(`updateBookmark`),r=new H(t),i=t.t;return r.set({label:i(`Edit bookmark`),icon:Rv,tooltip:!0}),r.bind(`isEnabled`).to(n),this.listenTo(r,`execute`,()=>{this._showFormView()}),r}),e.ui.componentFactory.add(`removeBookmark`,t=>{let n=e.commands.get(`delete`),r=new H(t),i=t.t;return r.set({label:i(`Remove bookmark`),icon:Qv,tooltip:!0}),r.bind(`isEnabled`).to(n),this.listenTo(r,`execute`,()=>{e.execute(`delete`),e.editing.view.focus()}),r})}_createBookmarkButton(e){let t=this.editor,n=t.locale,r=new e(n),i=t.commands.get(`insertBookmark`),a=t.commands.get(`updateBookmark`),o=n.t;return r.set({label:o(`Bookmark`),icon:$g}),this.listenTo(r,`execute`,()=>{t.editing.view.scrollToTheSelection(),this._showFormView()}),r.bind(`isEnabled`).toMany([i,a],`isEnabled`,(...e)=>e.some(e=>e)),r.bind(`isOn`).to(a,`value`,e=>!!e),r}_enableUserBalloonInteractions(){this.editor.keystrokes.set(`Esc`,(e,t)=>{this._isFormVisible&&(this._hideFormView(),t())}),Ya({emitter:this.formView,activator:()=>this._isFormInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>{this._hideFormView(!1)}})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;let 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=!0){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=!0){if(!this._isFormInPanel)return;let 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(){let e=this.editor,t=e.editing.view.document,n=this._getSelectedBookmarkElement(),r=a(),i=()=>{let e=this._getSelectedBookmarkElement(),t=a();n&&!e||!n&&t!==r?this._hideFormView():this._isFormVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),n=e,r=t};function a(){return t.selection.focus.getAncestors().reverse().find(e=>e.is(`element`))}this.listenTo(e.ui,`update`,i),this.listenTo(this._balloon,`change:visibleView`,i)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _isFormVisible(){return!!this.formView&&this._balloon.visibleView==this.formView}_getBalloonPositionData(){let e=this.editor.editing.view,t=this.editor.model,n,r=this._getSelectedBookmarkElement();if(t.markers.has(nO)){let t=Array.from(this.editor.editing.mapper.markerNameToElements(nO)),r=e.createRange(e.createPositionBefore(t[0]),e.createPositionAfter(t[t.length-1]));n=e.domConverter.viewRangeToDom(r)}else r&&(n=()=>{let t=this.editor.editing.mapper,n=e.domConverter,i=t.toViewElement(r);return n.mapViewToDom(i)});if(n)return{target:n}}_getSelectedBookmarkElement(){let e=this.editor.model.document.selection.getSelectedElement();return e&&e.is(`element`,`bookmark`)?e:null}_showFakeVisualSelection(){let e=this.editor.model;e.change(t=>{let n=e.document.selection.getFirstRange();if(e.markers.has(nO))t.updateMarker(nO,{range:n});else if(n.start.isAtEnd){let r=n.start.getLastMatchingPosition(({item:t})=>!e.schema.isContent(t),{boundaries:n});t.addMarker(nO,{usingOperation:!1,affectsData:!1,range:t.createRange(r,n.end)})}else t.addMarker(nO,{usingOperation:!1,affectsData:!1,range:n})})}_hideFakeVisualSelection(){let e=this.editor.model;e.markers.has(nO)&&e.change(e=>{e.removeMarker(nO)})}};function iO(e){let{t}=e,n=e.plugins.get(QD);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.`)},r=>{let i=e.model.document.selection.getSelectedElement(),a=n.getElementForBookmarkId(r.id);if(i!==a&&a)return t(`Bookmark name already exists.`)}]}function aO(e){let t=e.getSelectedElement();return!t||!HE(t)||!t.getCustomProperty(`bookmark`)?null:t}var oO=class extends F{static get pluginName(){return`Bookmark`}static get requires(){return[QD,rO,xD]}static get isOfficialPlugin(){return!0}},sO=class extends F{static get pluginName(){return`CKBoxUI`}static get isOfficialPlugin(){return!0}afterInit(){let 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){let t=this.editor,n=t.locale,r=new e(n),i=t.commands.get(`ckbox`);return r.bind(`isOn`,`isEnabled`).to(i,`value`,`isEnabled`),r.on(`execute`,()=>{t.execute(`ckbox`)}),r}_createFileToolbarButton(){let e=this.editor.locale.t,t=this._createButton(H);return t.icon=a_,t.label=e(`Open file manager`),t.tooltip=!0,t}_createImageToolbarButton(){let e=this.editor.locale.t,t=this.editor.plugins.get(`ImageInsertUI`),n=this._createButton(H);return n.icon=z_,n.bind(`label`).to(t,`isImageSelected`,t=>e(t?`Replace image with file manager`:`Insert image with file manager`)),n.tooltip=!0,n}_createImageDropdownButton(){let e=this.editor.locale.t,t=this.editor.plugins.get(`ImageInsertUI`),n=this._createButton(H);return n.icon=z_,n.withText=!0,n.bind(`label`).to(t,`isImageSelected`,t=>e(t?`Replace with file manager`:`Insert with file manager`)),n.on(`execute`,()=>{t.dropdownView.isOpen=!1}),n}_createFileMenuBarButton(){let e=this.editor.locale.t,t=this._createButton(U);return t.icon=a_,t.withText=!0,t.label=e(`File`),t}_createImageMenuBarButton(e){let t=this.editor.locale.t,n=this.editor.locale.t,r=this._createButton(U);switch(r.icon=z_,r.withText=!0,e){case`insertOnly`:r.label=t(`Image`);break;case`insertNested`:r.label=n(`With file manager`);break}return r}};function cO(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;`),(e.includes(`</p><p>`)||e.includes(`<br>`))&&(e=`<p>${e}</p>`),e}var lO=class extends jc{domEventType=[`paste`,`copy`,`cut`,`drop`,`dragover`,`dragstart`,`dragend`,`dragenter`,`dragleave`];constructor(e){super(e);let t=this.document;this.listenTo(t,`paste`,n(`clipboardInput`),{priority:`low`}),this.listenTo(t,`drop`,n(`clipboardInput`),{priority:`low`}),this.listenTo(t,`dragover`,n(`dragging`),{priority:`low`});function n(e){return(n,r)=>{r.preventDefault();let i=r.dropRange?[r.dropRange]:null,a=r.dataTransfer,o=new pe(t,e),s=``;a.getData(`text/html`)?s=a.getData(`text/html`):a.getData(`text/plain`)&&(s=cO(a.getData(`text/plain`))),t.fire(o,{dataTransfer:a,content:s,method:n.name,targetRanges:i,target:r.target,domEvent:r.domEvent}),o.stop.called&&r.stopPropagation()}}}onDomEvent(e){let t={dataTransfer:new Bc(`clipboardData`in e?e.clipboardData:e.dataTransfer,{cacheFiles:e.type==`drop`||e.type==`paste`})};if(e.type==`drop`||e.type==`dragover`){let n=Or(e);t.dropRange=n&&this.view.domConverter.domRangeToView(n)}this.fire(e.type,e,t)}};function uO(e){return e.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(e,t)=>t.length==1?` `:t).replace(/<!--[\s\S]*?-->/g,``)}const dO=[`figcaption`,`li`],fO=[`ol`,`ul`];function pO(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`
`;let n=``,r=null;for(let i of t.getChildren())n+=hO(i,r)+pO(e,i),r=i;if(t.is(`rawElement`)){let r=document.implementation.createHTMLDocument(``).createElement(`div`);t.render(r,e),n+=mO(r)}return n}function mO(e){let t=``;if(e.nodeType===Node.TEXT_NODE)return e.textContent;if(e.tagName===`BR`)return`
`;for(let n of e.childNodes)t+=mO(n);return t}function hO(e,t){return t?e.is(`element`,`li`)&&!e.isEmpty&&e.getChild(0).is(`containerElement`)||fO.includes(e.name)&&fO.includes(t.name)?`
`:!e.is(`containerElement`)&&!t.is(`containerElement`)?``:dO.includes(e.name)||dO.includes(t.name)?`
`:e.is(`element`)&&e.getCustomProperty(`dataPipeline:transparentRendering`)||t.is(`element`)&&t.getCustomProperty(`dataPipeline:transparentRendering`)?``:`
`:``}var gO=class extends F{_markersToCopy=new Map;static get pluginName(){return`ClipboardMarkersUtils`}static get isOfficialPlugin(){return!0}_registerMarkerToCopy(e,t){this._markersToCopy.set(e,t)}_copySelectedFragmentWithMarkers(e,t,n=e=>e.model.getSelectedContent(e.model.document.selection)){return this.editor.model.change(r=>{let i=r.model.document.selection;r.setSelection(t);let a=this._insertFakeMarkersIntoSelection(r,r.model.document.selection,e),o=n(r),s=this._removeFakeMarkersInsideElement(r,o);for(let[e,t]of Object.entries(a)){s[e]||=r.createRangeIn(o);for(let e of t)r.remove(e)}o.markers.clear();for(let[e,t]of Object.entries(s))o.markers.set(e,t);return r.setSelection(i),o})}_pasteMarkersIntoTransformedElement(e,t){let n=this._getPasteMarkersFromRangeMap(e);return this.editor.model.change(e=>{let r=this._insertFakeMarkersElements(e,n),i=t(e),a=this._removeFakeMarkersInsideElement(e,i);for(let t of Object.values(r).flat())e.remove(t);for(let[t,n]of Object.entries(a))e.model.markers.has(t)||e.addMarker(t,{usingOperation:!0,affectsData:!0,range:n});return i})}_pasteFragmentWithMarkers(e){let t=this._getPasteMarkersFromRangeMap(e.markers);e.markers.clear();for(let n of t)e.markers.set(n.name,n.range);return this.editor.model.insertContent(e)}_forceMarkersCopy(e,t,n={allowedActions:`all`,copyPartiallySelected:!0,duplicateOnPaste:!0}){let r=this._markersToCopy.get(e);this._markersToCopy.set(e,n),t(),r?this._markersToCopy.set(e,r):this._markersToCopy.delete(e)}_isMarkerCopyable(e,t){let n=this._getMarkerClipboardConfig(e);if(!n)return!1;if(!t)return!0;let{allowedActions:r}=n;return r===`all`||r.includes(t)}_hasMarkerConfiguration(e){return!!this._getMarkerClipboardConfig(e)}_getMarkerClipboardConfig(e){let[t]=e.split(`:`);return this._markersToCopy.get(t)||null}_insertFakeMarkersIntoSelection(e,t,n){let r=this._getCopyableMarkersFromSelection(e,t,n);return this._insertFakeMarkersElements(e,r)}_getCopyableMarkersFromSelection(e,t,n){let r=Array.from(t.getRanges()),i=new Set(r.flatMap(t=>Array.from(e.model.markers.getMarkersIntersectingRange(t))));return Array.from(i).filter(e=>{if(!this._isMarkerCopyable(e.name,n))return!1;let{copyPartiallySelected:t}=this._getMarkerClipboardConfig(e.name);if(!t){let t=e.getRange();return r.some(e=>e.containsRange(t,!0))}return!0}).map(e=>({name:n===`dragstart`?this._getUniqueMarkerName(e.name):e.name,range:e.getRange()}))}_getPasteMarkersFromRangeMap(e,t=null){let{model:n}=this.editor;return(e instanceof Map?Array.from(e.entries()):Object.entries(e)).flatMap(([e,r])=>{if(!this._hasMarkerConfiguration(e))return[{name:e,range:r}];if(this._isMarkerCopyable(e,t)){let t=this._getMarkerClipboardConfig(e),i=n.markers.has(e)&&n.markers.get(e).getRange().root.rootName===`$graveyard`;return(t.duplicateOnPaste||i)&&(e=this._getUniqueMarkerName(e)),[{name:e,range:r}]}return[]})}_insertFakeMarkersElements(e,t){let n={},r=t.flatMap(e=>{let{start:t,end:n}=e.range;return[{position:t,marker:e,type:`start`},{position:n,marker:e,type:`end`}]}).sort(({position:e},{position:t})=>e.isBefore(t)?1:-1);for(let{position:t,marker:i,type:a}of r){let r=e.createElement(`$marker`,{"data-name":i.name,"data-type":a});n[i.name]||(n[i.name]=[]),n[i.name].push(r),e.insert(r,t)}return n}_removeFakeMarkersInsideElement(e,t){return vn(this._getAllFakeMarkersFromElement(e,t).reduce((t,n)=>{let r=n.markerElement&&e.createPositionBefore(n.markerElement),i=t[n.name],a=!1;return i?.start&&i?.end&&(this._getMarkerClipboardConfig(n.name).duplicateOnPaste?t[this._getUniqueMarkerName(n.name)]=t[n.name]:a=!0,i=null),a||(t[n.name]={...i,[n.type]:r}),n.markerElement&&e.remove(n.markerElement),t},{}),n=>new B(n.start||e.createPositionFromPath(t,[0]),n.end||e.createPositionAt(t,`end`)))}_getAllFakeMarkersFromElement(e,t){let n=Array.from(e.createRangeIn(t)).flatMap(({item:e})=>e.is(`element`,`$marker`)?[{markerElement:e,name:e.getAttribute(`data-name`),type:e.getAttribute(`data-type`)}]:[]),r=[],i=[];for(let e of n)e.type===`end`&&(n.some(t=>t.name===e.name&&t.type===`start`)||r.push({markerElement:null,name:e.name,type:`start`})),e.type===`start`&&(n.some(t=>t.name===e.name&&t.type===`end`)||i.unshift({markerElement:null,name:e.name,type:`end`}));return[...r,...n,...i]}_getUniqueMarkerName(e){let t=e.split(`:`),n=he().substring(1,6);return t.length===3?`${t.slice(0,2).join(`:`)}:${n}`:`${t.join(`:`)}:${n}`}},_O=class extends F{static get pluginName(){return`ClipboardPipeline`}static get isOfficialPlugin(){return!0}static get requires(){return[gO]}init(){this.editor.editing.view.addObserver(lO),this._setupPasteDrop(),this._setupCopyCut()}_fireOutputTransformationEvent(e,t,n){let r=this.editor.plugins.get(`ClipboardMarkersUtils`);this.editor.model.enqueueChange({isUndoable:n===`cut`},()=>{let i=r._copySelectedFragmentWithMarkers(n,t);this.fire(`outputTransformation`,{dataTransfer:e,content:i,method:n})})}_setupPasteDrop(){let e=this.editor,t=e.model,n=e.editing.view,r=n.document,i=this.editor.plugins.get(`ClipboardMarkersUtils`);this.listenTo(r,`clipboardInput`,(t,n)=>{n.method==`paste`&&!e.model.canEditAt(e.model.document.selection)&&t.stop()},{priority:`highest`}),this.listenTo(r,`clipboardInput`,(e,t)=>{let r=t.dataTransfer,i=new pe(this,`inputTransformation`),a=r.getData(`application/ckeditor5-editor-id`)||null,o=typeof t.content==`string`?this.editor.data.htmlProcessor.toView(uO(t.content)):t.content;this.fire(i,{content:o,dataTransfer:r,sourceEditorId:a,extraContent:t.extraContent,targetRanges:t.targetRanges,method:t.method}),i.stop.called&&e.stop(),n.scrollToTheSelection()},{priority:`low`}),this.listenTo(this,`inputTransformation`,(e,n)=>{if(n.content.isEmpty)return;let r=this.editor.data.toModel(n.content,`$clipboardHolder`);r.childCount!=0&&(e.stop(),t.change(()=>{this.fire(`contentInsertion`,{content:r,method:n.method,sourceEditorId:n.sourceEditorId,dataTransfer:n.dataTransfer,targetRanges:n.targetRanges})}))},{priority:`low`}),this.listenTo(this,`contentInsertion`,(e,t)=>{t.resultRange=i._pasteFragmentWithMarkers(t.content)},{priority:`low`})}_setupCopyCut(){let e=this.editor,t=e.model.document,n=e.editing.view.document,r=(e,n)=>{let r=n.dataTransfer;n.preventDefault(),this._fireOutputTransformationEvent(r,t.selection,e.name)};this.listenTo(n,`copy`,r,{priority:`low`}),this.listenTo(n,`cut`,(t,n)=>{e.model.canEditAt(e.model.document.selection)?r(t,n):n.preventDefault()},{priority:`low`}),this.listenTo(this,`outputTransformation`,(t,r)=>{let i=e.data.toView(r.content,{isClipboardPipeline:!0});n.fire(`clipboardOutput`,{dataTransfer:r.dataTransfer,content:i,method:r.method})},{priority:`low`}),this.listenTo(n,`clipboardOutput`,(n,r)=>{r.content.isEmpty||(r.dataTransfer.setData(`text/html`,this.editor.data.htmlProcessor.toData(r.content)),r.dataTransfer.setData(`text/plain`,pO(e.data.htmlProcessor.domConverter,r.content)),r.dataTransfer.setData(`application/ckeditor5-editor-id`,this.editor.id)),r.method==`cut`&&e.model.deleteContent(t.selection)},{priority:`low`})}};const vO=Wr(`px`);var yO=class extends P{constructor(){super();let e=this.bindTemplate;this.set({isVisible:!1,left:null,top:null,width:null}),this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-clipboard-drop-target-line`,e.if(`isVisible`,`ck-hidden`,e=>!e)],style:{left:e.to(`left`,e=>vO(e)),top:e.to(`top`,e=>vO(e)),width:e.to(`width`,e=>vO(e))}}})}},bO=class extends F{removeDropMarkerDelayed=Yi(()=>this.removeDropMarker(),40);_updateDropMarkerThrottled=qt(e=>this._updateDropMarker(e),40);_reconvertMarkerThrottled=qt(()=>{this.editor.model.markers.has(`drop-target`)&&this.editor.editing.reconvertMarker(`drop-target`)},0);_dropTargetLineView=new yO;_domEmitter=new(br());_scrollables=new Map;static get pluginName(){return`DragDropTarget`}static get isOfficialPlugin(){return!0}init(){this._setupDropMarker()}destroy(){this._domEmitter.stopListening();for(let{resizeObserver:e}of this._scrollables.values())e.destroy();return this._updateDropMarkerThrottled.cancel(),this.removeDropMarkerDelayed.cancel(),this._reconvertMarkerThrottled.cancel(),super.destroy()}updateDropMarker(e,t,n,r,i,a){this.removeDropMarkerDelayed.cancel();let o=xO(this.editor,e,t,n,r,i,a);return o?a&&a.containsRange(o)||o&&!this.editor.model.canEditAt(o)?(this.removeDropMarker(),null):(this._updateDropMarkerThrottled(o),o):null}getFinalDropRange(e,t,n,r,i,a){let o=xO(this.editor,e,t,n,r,i,a);return this.removeDropMarker(),o}removeDropMarker(){let e=this.editor.model;this.removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),this._dropTargetLineView.isVisible=!1,e.markers.has(`drop-target`)&&e.change(e=>{e.removeMarker(`drop-target`)})}_setupDropMarker(){let 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:n})=>{if(e.model.schema.checkChild(t.markerRange.start,`$text`))return this._dropTargetLineView.isVisible=!1,this._createDropTargetPosition(n);t.markerRange.isCollapsed?this._updateDropTargetLine(t.markerRange):this._dropTargetLineView.isVisible=!1}})}_updateDropMarker(e){let t=this.editor,n=t.model.markers;t.model.change(t=>{n.has(`drop-target`)?n.get(`drop-target`).getRange().isEqual(e)||t.updateMarker(`drop-target`,{range:e}):t.addMarker(`drop-target`,{range:e,usingOperation:!1,affectsData:!1})})}_createDropTargetPosition(e){return e.createUIElement(`span`,{class:`ck ck-clipboard-drop-target-position`},function(e){let t=this.toDomElement(e);return t.append(``,e.createElement(`span`),``),t})}_updateDropTargetLine(e){let t=this.editor.editing,n=e.start.nodeBefore,r=e.start.nodeAfter,i=e.start.parent,a=n?t.mapper.toViewElement(n):null,o=a?t.view.domConverter.mapViewToDom(a):null,s=r?t.mapper.toViewElement(r):null,c=s?t.view.domConverter.mapViewToDom(s):null,l=t.mapper.toViewElement(i);if(!l)return;let d=t.view.domConverter.mapViewToDom(l),f=this._getScrollableRect(l),{scrollX:p,scrollY:m}=u.window,h=o?new O(o):null,g=c?new O(c):null,_=new O(d).excludeScrollbarsAndBorders(),v=h?h.bottom:_.top,y=g?g.top:_.bottom,ee=u.window.getComputedStyle(d),b=v<=y?(v+y)/2:y;if(f.top<b&&b<f.bottom){let e=_.left+parseFloat(ee.paddingLeft),t=_.right-parseFloat(ee.paddingRight),n=Math.max(e+p,f.left),r=Math.min(t+p,f.right);this._dropTargetLineView.set({isVisible:!0,left:n,top:b+m,width:r-n})}else this._dropTargetLineView.isVisible=!1}_getScrollableRect(e){let t=e.root.rootName,n;if(this._scrollables.has(t))n=this._scrollables.get(t).domElement;else{n=EO(this.editor.editing.view.domConverter.mapViewToDom(e)),this._domEmitter.listenTo(n,`scroll`,this._reconvertMarkerThrottled,{usePassive:!0});let r=new Hr(n,this._reconvertMarkerThrottled);this._scrollables.set(t,{domElement:n,resizeObserver:r})}return new O(n).excludeScrollbarsAndBorders()}};function xO(e,t,n,r,i,a,o){let s=e.model,c=e.editing.mapper,l=TO(e,t);for(;l;){if(!a){if(s.schema.checkChild(l,`$text`)){if(n){let t=n[0].start,a=c.toModelPosition(t);if(!o||Array.from(o.getItems({shallow:!0})).some(e=>s.schema.checkChild(a,e))){if(s.schema.checkChild(a,`$text`))return s.createRange(a);if(t)return CO(e,TO(e,t.parent),r,i)}}}else if(s.schema.isInline(l))return CO(e,l,r,i)}if(s.schema.isBlock(l))return CO(e,l,r,i);if(s.schema.checkChild(l,`$block`)){let t=Array.from(l.getChildren()).filter(t=>t.is(`element`)&&!SO(e,t)),n=0,a=t.length;if(a==0)return s.createRange(s.createPositionAt(l,`end`));for(;n<a-1;){let o=Math.floor((n+a)/2);wO(e,t[o],r,i)==`before`?a=o:n=o}return CO(e,t[n],r,i)}l=l.parent}return null}function SO(e,t){let n=e.editing.mapper,r=e.editing.view.domConverter,i=n.toViewElement(t);if(!i)return!0;let a=r.mapViewToDom(i);return u.window.getComputedStyle(a).float!=`none`}function CO(e,t,n,r){let i=e.model;return i.createRange(i.createPositionAt(t,wO(e,t,n,r)))}function wO(e,t,n,r){let i=e.editing.mapper,a=e.editing.view.domConverter,o=i.toViewElement(t),s=new O(a.mapViewToDom(o));return e.model.schema.isInline(t)?n<(s.left+s.right)/2?`before`:`after`:r<(s.top+s.bottom)/2?`before`:`after`}function TO(e,t){let n=e.editing.mapper,r=e.editing.view,i=n.toModelElement(t);if(i)return i;let a=r.createPositionBefore(t),o=n.findMappedViewAncestor(a);return n.toModelElement(o)}function EO(e){let t=e;do{t=t.parentElement;let e=u.window.getComputedStyle(t).overflowY;if(e==`auto`||e==`scroll`)break}while(t.tagName!=`BODY`);return t}var DO=class extends F{_isBlockDragging=!1;_domEmitter=new(br());static get pluginName(){return`DragDropBlockToolbar`}static get isOfficialPlugin(){return!0}init(){let e=this.editor;if(this.listenTo(e,`change:isReadOnly`,(e,t,n)=>{n?(this.forceDisabled(`readOnlyMode`),this._isBlockDragging=!1):this.clearForceDisabled(`readOnlyMode`)}),p.isAndroid&&this.forceDisabled(`noAndroidSupport`),e.plugins.has(`BlockToolbar`)){let t=e.plugins.get(`BlockToolbar`).buttonView.element;this._domEmitter.listenTo(t,`dragstart`,(e,t)=>this._handleBlockDragStart(t)),this._domEmitter.listenTo(u.document,`dragover`,(e,t)=>this._handleBlockDragging(t)),this._domEmitter.listenTo(u.document,`drop`,(e,t)=>this._handleBlockDragging(t)),this._domEmitter.listenTo(u.document,`dragend`,()=>this._handleBlockDragEnd(),{useCapture:!0}),this.isEnabled&&t.setAttribute(`draggable`,`true`),this.on(`change:isEnabled`,(e,n,r)=>{t.setAttribute(`draggable`,r?`true`:`false`)})}}destroy(){return this._domEmitter.stopListening(),super.destroy()}_handleBlockDragStart(e){if(!this.isEnabled)return;let t=this.editor.model,n=t.document.selection,r=this.editor.editing.view,i=Array.from(n.getSelectedBlocks()),a=t.createRange(t.createPositionBefore(i[0]),t.createPositionAfter(i[i.length-1]));t.change(e=>e.setSelection(a)),this._isBlockDragging=!0,r.focus(),r.getObserver(lO).onDomEvent(e)}_handleBlockDragging(e){if(!this.isEnabled||!this._isBlockDragging)return;let t=e.clientX+(this.editor.locale.contentLanguageDirection==`ltr`?100:-100),n=e.clientY,r=document.elementFromPoint(t,n),i=this.editor.editing.view;!r||!r.closest(`.ck-editor__editable`)||i.getObserver(lO).onDomEvent({...e,type:e.type,dataTransfer:e.dataTransfer,target:r,clientX:t,clientY:n,preventDefault:()=>e.preventDefault(),stopPropagation:()=>e.stopPropagation()})}_handleBlockDragEnd(){this._isBlockDragging=!1}},OO=class extends F{_draggedRange;_draggingUid;_draggableElement;_clearDraggableAttributesDelayed=Yi(()=>this._clearDraggableAttributes(),40);_blockMode=!1;_domEmitter=new(br());_previewContainer;static get pluginName(){return`DragDrop`}static get isOfficialPlugin(){return!0}static get requires(){return[_O,xD,bO,DO]}init(){let e=this.editor,t=e.editing.view;this._draggedRange=null,this._draggingUid=``,this._draggableElement=null,t.addObserver(lO),t.addObserver(Mp),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDraggableAttributeHandling(),this.listenTo(e,`change:isReadOnly`,(e,t,n)=>{n?this.forceDisabled(`readOnlyMode`):this.clearForceDisabled(`readOnlyMode`)}),this.on(`change:isEnabled`,(e,t,n)=>{n||this._finalizeDragging(!1)}),p.isAndroid&&this.forceDisabled(`noAndroidSupport`)}destroy(){return this._draggedRange&&=(this._draggedRange.detach(),null),this._previewContainer&&this._previewContainer.remove(),this._domEmitter.stopListening(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){let e=this.editor,t=e.model,n=e.editing.view,r=n.document,i=e.plugins.get(bO);this.listenTo(r,`dragstart`,(n,r)=>{if(r.target?.is(`editableElement`)){r.preventDefault();return}if(this._prepareDraggedRange(r.target),!this._draggedRange){r.preventDefault();return}this._draggingUid=he();let i=this.isEnabled&&e.model.canEditAt(this._draggedRange);r.dataTransfer.effectAllowed=i?`copyMove`:`copy`,r.dataTransfer.setData(`application/ckeditor5-dragging-uid`,this._draggingUid);let a=t.createSelection(this._draggedRange.toRange());this.editor.plugins.get(`ClipboardPipeline`)._fireOutputTransformationEvent(r.dataTransfer,a,`dragstart`);let{dataTransfer:o,domTarget:s,domEvent:c}=r,{clientX:l}=c;this._updatePreview({dataTransfer:o,domTarget:s,clientX:l}),r.stopPropagation(),i||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid=``)},{priority:`low`}),this.listenTo(r,`dragend`,(e,t)=>{this._finalizeDragging(!t.dataTransfer.isCanceled&&t.dataTransfer.dropEffect==`move`)},{priority:`low`}),this._domEmitter.listenTo(u.document,`dragend`,()=>{this._blockMode=!1},{useCapture:!0}),this.listenTo(r,`dragenter`,()=>{this.isEnabled&&n.focus()}),this.listenTo(r,`dragleave`,()=>{i.removeDropMarkerDelayed()}),this.listenTo(r,`dragging`,(e,t)=>{if(!this.isEnabled){t.dataTransfer.dropEffect=`none`;return}let{clientX:n,clientY:r}=t.domEvent;if(!i.updateDropMarker(t.target,t.targetRanges,n,r,this._blockMode,this._draggedRange)){t.dataTransfer.dropEffect=`none`;return}this._draggedRange||(t.dataTransfer.dropEffect=`copy`),p.isGecko||(t.dataTransfer.effectAllowed==`copy`?t.dataTransfer.dropEffect=`copy`:[`all`,`copyMove`].includes(t.dataTransfer.effectAllowed)&&(t.dataTransfer.dropEffect=`move`)),e.stop()},{priority:`low`})}_setupClipboardInputIntegration(){let e=this.editor,t=e.editing.view.document,n=e.plugins.get(bO);this.listenTo(t,`clipboardInput`,(t,r)=>{if(r.method!=`drop`)return;let{clientX:i,clientY:a}=r.domEvent,o=n.getFinalDropRange(r.target,r.targetRanges,i,a,this._blockMode,this._draggedRange);if(!o){this._finalizeDragging(!1),t.stop();return}if(this._draggedRange&&this._draggingUid!=r.dataTransfer.getData(`application/ckeditor5-dragging-uid`)&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid=``),kO(r.dataTransfer)==`move`&&this._draggedRange&&this._draggedRange.containsRange(o,!0)){this._finalizeDragging(!1),t.stop();return}r.targetRanges=[e.editing.mapper.toViewRange(o)]},{priority:`high`})}_setupContentInsertionIntegration(){let e=this.editor.plugins.get(_O);e.on(`contentInsertion`,(e,t)=>{if(!this.isEnabled||t.method!==`drop`)return;let n=t.targetRanges.map(e=>this.editor.editing.mapper.toModelRange(e));this.editor.model.change(e=>e.setSelection(n))},{priority:`high`}),e.on(`contentInsertion`,(e,t)=>{if(!this.isEnabled||t.method!==`drop`)return;let n=kO(t.dataTransfer)==`move`,r=!t.resultRange||!t.resultRange.isCollapsed;this._finalizeDragging(r&&n)},{priority:`lowest`})}_setupDraggableAttributeHandling(){let e=this.editor,t=e.editing.view,n=t.document;this.listenTo(n,`pointerdown`,(r,i)=>{if(p.isAndroid||!i)return;this._clearDraggableAttributesDelayed.cancel();let a=AO(i.target);if(p.isBlink&&!e.isReadOnly&&!a&&!n.selection.isCollapsed){let e=n.selection.getSelectedElement();(!e||!HE(e))&&(a=n.selection.editableElement)}a&&(t.change(e=>{e.setAttribute(`draggable`,`true`,a)}),this._draggableElement=e.editing.mapper.toModelElement(a))}),this.listenTo(n,`pointerup`,()=>{p.isAndroid||this._clearDraggableAttributesDelayed()})}_clearDraggableAttributes(){let e=this.editor.editing;e.view.change(t=>{this._draggableElement&&this._draggableElement.root.rootName!=`$graveyard`&&t.removeAttribute(`draggable`,e.mapper.toViewElement(this._draggableElement)),this._draggableElement=null})}_finalizeDragging(e){let t=this.editor,n=t.model;t.plugins.get(bO).removeDropMarker(),this._clearDraggableAttributes(),t.plugins.has(`WidgetToolbarRepository`)&&t.plugins.get(`WidgetToolbarRepository`).clearForceDisabled(`dragDrop`),this._draggingUid=``,this._previewContainer&&=(this._previewContainer.remove(),void 0),this._draggedRange&&=(e&&this.isEnabled&&n.change(e=>{let t=n.createSelection(this._draggedRange);n.deleteContent(t,{doNotAutoparagraph:!0});let r=t.getFirstPosition().parent;r.isEmpty&&!n.schema.checkChild(r,`$text`)&&n.schema.checkChild(r,`paragraph`)&&e.insertElement(`paragraph`,r,0)}),this._draggedRange.detach(),null)}_prepareDraggedRange(e){let t=this.editor,n=t.model,r=n.document.selection,i=e?AO(e):null;if(i){let e=t.editing.mapper.toModelElement(i);this._draggedRange=xl.fromRange(n.createRangeOn(e)),this._blockMode=n.schema.isBlock(e),t.plugins.has(`WidgetToolbarRepository`)&&t.plugins.get(`WidgetToolbarRepository`).forceDisabled(`dragDrop`);return}if(r.isCollapsed&&!r.getFirstPosition().parent.isEmpty)return;let a=Array.from(r.getSelectedBlocks()),o=r.getFirstRange();if(a.length==0){this._draggedRange=xl.fromRange(o);return}let s=jO(n,a);if(a.length>1)this._draggedRange=xl.fromRange(s),this._blockMode=!0;else if(a.length==1){let e=o.start.isTouching(s.start)&&o.end.isTouching(s.end);this._draggedRange=xl.fromRange(e?s:o),this._blockMode=e}n.change(e=>e.setSelection(this._draggedRange.toRange()))}_updatePreview({dataTransfer:e,domTarget:t,clientX:n}){let r=this.editor.editing.view,i=r.document.selection.editableElement,a=r.domConverter.mapViewToDom(i),o=u.window.getComputedStyle(a);this._previewContainer?this._previewContainer.firstElementChild&&this._previewContainer.removeChild(this._previewContainer.firstElementChild):(this._previewContainer=mr(u.document,`div`,{style:`position: fixed; left: -999999px;`}),u.document.body.appendChild(this._previewContainer));let s=mr(u.document,`div`);s.className=`ck ck-content ck-clipboard-preview`;let c=new O(a),l=parseFloat(o.paddingLeft),d=parseFloat(o.paddingRight),f=parseFloat(o.width)-l-d;if(!a.contains(t))if(p.isiOS)s.style.width=`${f}px`,s.style.backgroundColor=`var(--ck-color-base-background)`;else{let e=c.left-n+l;s.style.width=`${f+e}px`,s.style.paddingLeft=`${e}px`}else if(p.isiOS)s.style.maxWidth=`${f}px`,s.style.padding=`10px`,s.style.minWidth=`200px`,s.style.minHeight=`20px`,s.style.boxSizing=`border-box`,s.style.backgroundColor=`var(--ck-color-base-background)`;else return;r.domConverter.setContentOf(s,e.getData(`text/html`)),e.setDragImage(s,0,0),this._previewContainer.appendChild(s)}};function kO(e){return p.isGecko?e.dropEffect:[`all`,`copyMove`].includes(e.effectAllowed)?`move`:`copy`}function AO(e){if(e.is(`editableElement`))return null;if(e.hasClass(`ck-widget__selection-handle`))return e.findAncestor(HE);if(HE(e))return e;let t=e.findAncestor(e=>HE(e)||e.is(`editableElement`));return HE(t)?t:null}function jO(e,t){let n=t[0],r=t[t.length-1],i=n.getCommonAncestor(r),a=e.createPositionBefore(n),o=e.createPositionAfter(r);if(i&&i.is(`element`)&&!e.schema.isLimit(i)){let t=e.createRangeOn(i),n=a.isTouching(t.start),r=o.isTouching(t.end);if(n&&r)return jO(e,[i])}return e.createRange(a,o)}var MO=class extends F{static get pluginName(){return`PastePlainText`}static get isOfficialPlugin(){return!0}static get requires(){return[_O]}init(){let e=this.editor,t=e.model,n=e.editing.view,r=t.document.selection;n.addObserver(lO),e.plugins.get(_O).on(`contentInsertion`,(e,n)=>{NO(n.content,t)&&t.change(e=>{let i=Array.from(r.getAttributes()).filter(([e])=>t.schema.getAttributeProperties(e).isFormatting);r.isCollapsed||t.deleteContent(r,{doNotAutoparagraph:!0}),i.push(...r.getAttributes());let a=e.createRangeIn(n.content);for(let n of a.getItems())for(let r of i)t.schema.checkAttribute(n,r[0])&&e.setAttribute(r[0],r[1],n)})})}};function NO(e,t){let n=t.createRangeIn(e);if(e.childCount==1){let r=e.getChild(0);r.is(`element`)&&t.schema.isBlock(r)&&!t.schema.isObject(r)&&!t.schema.isLimit(r)&&(n=t.createRangeIn(r))}for(let e of n.getItems())if(!t.schema.isInline(e)||Array.from(e.getAttributeKeys()).find(e=>t.schema.getAttributeProperties(e).isFormatting))return!1;return!0}var PO=class extends F{static get pluginName(){return`Clipboard`}static get isOfficialPlugin(){return!0}static get requires(){return[gO,_O,OO,MO]}init(){let 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`}]})}},FO=class{_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=>{let t=(e,t)=>{let n=t.createAttributeElement(`a`,e.attributes,{priority:5});e.classes&&t.addClass(e.classes,n);for(let r in e.styles)t.setStyle(r,e.styles[r],n);return t.setCustomProperty(`link`,!0,n),n},n=e=>(n,r,i)=>{if(r.attributeKey.startsWith(`link`)&&!(r.attributeKey==`linkHref`&&!i.consumable.test(r.item,`attribute:linkHref`))&&!(!r.item.is(`selection`)&&!i.schema.isInline(r.item)))for(let n of this._definitions)n.callback(r.item.getAttribute(`linkHref`))&&!this._conflictChecker?.(n,r.item)&&e?r.item.is(`selection`)?i.writer.wrap(i.writer.document.selection.getFirstRange(),t(n,i.writer)):i.writer.wrap(i.mapper.toViewRange(r.range),t(n,i.writer)):i.writer.unwrap(i.mapper.toViewRange(r.range),t(n,i.writer))};e.on(`attribute`,n(!1),{priority:ge.high-1}),e.on(`attribute`,n(!0),{priority:ge.high-2})}}getDispatcherForLinkedImage(){return e=>{let t=e=>(t,n,{writer:r,mapper:i})=>{if(!n.item.is(`element`,`imageBlock`)||!n.attributeKey.startsWith(`link`))return;let a=i.toViewElement(n.item),o=Array.from(a.getChildren()).find(e=>e.is(`element`,`a`));if(o)for(let t of this._definitions){let i=Ui(t.attributes);if(t.callback(n.item.getAttribute(`linkHref`))&&!this._conflictChecker?.(t,n.item)&&e){for(let[e,t]of i)e===`class`?r.addClass(t,o):r.setAttribute(e,t,!1,o);t.classes&&r.addClass(t.classes,o);for(let e in t.styles)r.setStyle(e,t.styles[e],o)}else{for(let[e,t]of i)e===`class`?r.removeClass(t,o):r.removeAttribute(e,t,o);t.classes&&r.removeClass(t.classes,o);for(let e in t.styles)r.removeStyle(e,o)}}};e.on(`attribute`,t(!1),{priority:ge.high-1}),e.on(`attribute`,t(!0),{priority:ge.high-2})}}};const IO=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,LO=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,RO=/^((\w+:(\/{2,})?)|(\W))/i,zO=[`https?`,`ftps?`,`mailto`],BO=`Ctrl+K`;function VO(e){return e.is(`attributeElement`)&&!!e.getCustomProperty(`link`)}function HO(e,{writer:t}){let n=t.createAttributeElement(`a`,{href:e},{priority:5});return t.setCustomProperty(`link`,!0,n),n}function UO(e,t=zO){let n=String(e),r=t.join(`|`);return WO(n,RegExp(`${`^(?:(?:<protocols>):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))`.replace(`<protocols>`,r)}`,`i`))?n:`#`}function WO(e,t){return!!e.replace(IO,``).match(t)}function GO(e,t){let n={"Open in a new tab":e(`Open in a new tab`),Downloadable:e(`Downloadable`)};return t.forEach(e=>(`label`in e&&n[e.label]&&(e.label=n[e.label]),e)),t}function KO(e){let t=[];if(e)for(let[n,r]of Object.entries(e)){let e=Object.assign({},r,{id:`link${Yn(n)}`});t.push(e)}return t}function qO(e,t){return e?t.checkAttribute(e.name,`linkHref`):!1}function JO(e){return LO.test(e)}function YO(e,t){let n=JO(e)?`mailto:`:t,r=!!n&&!XO(e);return e&&r?n+e:e}function XO(e){return RO.test(e)}function ZO(e){window.open(e,`_blank`,`noopener`)}function QO(e){let t=``;for(let n of e.getItems()){if(!n.is(`$text`)&&!n.is(`$textProxy`))return;t+=n.data}return t}function $O(e,t){if(e.attributes&&t.attributes&&Object.keys(e.attributes).some(e=>!n(e)&&e in t.attributes)||e.styles&&t.styles&&Object.keys(e.styles).some(e=>e in t.styles))return!0;return!1;function n(e){return e===`class`||e===`style`||e===`rel`}}function ek({decoratorStates:e,allDecorators:t}){let n={...e};for(let i in e)if(e[i]&&r(i)){let e=tk(i,t);for(let t of e)n[t]=!1}function r(e){return t.some(t=>t.id===e&&!t.value)}return n}function tk(e,t){let n=t.find(t=>t.id===e);return n?t.filter(t=>t.id!==e&&$O(n,t)).map(e=>e.id):[]}var nk=class extends I{manualDecorators=new Fi;automaticDecorators=new FO;restoreManualDecoratorStates(){for(let e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){let e=this.editor.model,t=e.document.selection,n=t.getSelectedElement()||j(t.getSelectedBlocks());qO(n,e.schema)?(this.value=n.getAttribute(`linkHref`),this.isEnabled=e.schema.checkAttribute(n,`linkHref`)):(this.value=t.getAttribute(`linkHref`),this.isEnabled=e.schema.checkAttributeInSelection(t,`linkHref`));for(let e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}execute(e,t={},n){let r=this.editor.model,i=r.document.selection,a=ek({allDecorators:Array.from(this.manualDecorators),decoratorStates:t}),o=[],s=[];for(let e in a)a[e]?o.push(e):s.push(e);r.change(t=>{let a=n=>{t.setAttribute(`linkHref`,e,n),o.forEach(e=>t.setAttribute(e,!0,n)),s.forEach(e=>t.removeAttribute(e,n))},c=(i,o)=>{let s=QO(i);if(!s)return i;let c=n;if(c||=o&&o==s?e:s,c!=s){let e=t.createDocumentFragment();for(let n of i.getItems()){let r=n;t.append(t.createText(r.data,r.getAttributes()),e)}let n=t.createRangeIn(e),o=rk(s,c),l=0;for(let{offset:e,actual:i,expected:s}of o){let o=e+l,c=t.createRange(n.start.getShiftedBy(o),n.start.getShiftedBy(o+i.length)),u=ik(c,n).getAttributes(),d=Array.from(u).filter(([e])=>r.schema.getAttributeProperties(e).isFormatting),f=t.createText(s,d);a(f),t.remove(c),t.insert(f,c.start),l+=s.length}return r.insertContent(e,i),t.createRange(i.start,i.start.getShiftedBy(c.length))}},l=e=>{let{plugins:n}=this.editor;if(t.setSelection(e.end),n.has(`TwoStepCaretMovement`))n.get(`TwoStepCaretMovement`)._handleForwardMovement();else for(let e of[`linkHref`,...o,...s])t.removeSelectionAttribute(e)};if(i.isCollapsed){let s=i.getFirstPosition();if(i.hasAttribute(`linkHref`)){let e=i.getAttribute(`linkHref`),t=LT(s,`linkHref`,e,r),n=c(t,e);a(n||t),n&&l(n)}else if(e!==``){let a=Ui(i.getAttributes());a.set(`linkHref`,e),o.forEach(e=>{a.set(e,!0)}),l(r.insertContent(t.createText(n||e,a),s))}}else{let e=Array.from(i.getRanges()),n=r.schema.getValidRanges(e,`linkHref`),o=[];for(let e of i.getSelectedBlocks())r.schema.checkAttribute(e,`linkHref`)&&o.push(t.createRangeOn(e));let s=o.slice();for(let e of n)this._isRangeToUpdate(e,o)&&s.push(e);let l=e.map(e=>({start:pf.fromPosition(e.start,`toPrevious`),end:pf.fromPosition(e.end,`toNext`)}));for(let e of s){let t=(e.start.textNode||e.start.nodeAfter).getAttribute(`linkHref`);e=c(e,t)||e,a(e)}t.setSelection(l.map(e=>{let t=e.start.toPosition(),n=e.end.toPosition();return e.start.detach(),e.end.detach(),r.createRange(t,n)}))}}),this.restoreManualDecoratorStates()}_getDecoratorStateFromModel(e){let t=this.editor.model,n=t.document.selection,r=n.getSelectedElement();return qO(r,t.schema)?r.getAttribute(e):n.getAttribute(e)}_isRangeToUpdate(e,t){for(let n of t)if(n.containsRange(e))return!1;return!0}};function rk(e,t){let n=oe(e,t),r={equal:0,insert:0,delete:0},i=[],a=``,o=``;for(let s of[...n,null])s==`insert`?o+=t[r.equal+r.insert]:s==`delete`?a+=e[r.equal+r.delete]:(a.length||o.length)&&(i.push({offset:r.equal,actual:a,expected:o}),a=``,o=``),s&&r[s]++;return i}function ik(e,t){if(!e.isCollapsed)return j(e.getItems());let n=e.start;return n.textNode?n.textNode:!n.nodeBefore||n.isEqual(t.start)?n.nodeAfter:n.nodeBefore}var ak=class extends I{refresh(){let e=this.editor.model,t=e.document.selection,n=t.getSelectedElement();qO(n,e.schema)?this.isEnabled=e.schema.checkAttribute(n,`linkHref`):this.isEnabled=e.schema.checkAttributeInSelection(t,`linkHref`)}execute(){let e=this.editor,t=this.editor.model,n=t.document.selection,r=e.commands.get(`link`);t.change(e=>{let i=n.isCollapsed?[LT(n.getFirstPosition(),`linkHref`,n.getAttribute(`linkHref`),t)]:t.schema.getValidRanges(n.getRanges(),`linkHref`);for(let t of i)if(e.removeAttribute(`linkHref`,t),r)for(let n of r.manualDecorators)e.removeAttribute(n.id,t)})}};const ok=D();var sk=class extends ok{id;defaultValue;label;attributes;classes;styles;constructor({id:e,label:t,attributes:n,classes:r,styles:i,defaultValue:a}){super(),this.id=e,this.set(`value`,void 0),this.defaultValue=a,this.label=t,this.attributes=n,this.classes=r,this.styles=i}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}};const ck=`automatic`,lk=/^(https?:)?\/\//;var uk=class extends F{_linkOpeners=[];static get pluginName(){return`LinkEditing`}static get isOfficialPlugin(){return!0}static get requires(){return[bT,tT,_O]}constructor(e){super(e),e.config.define(`link`,{allowCreatingEmptyLinks:!1,addTargetToExternalLinks:!1,toolbar:[`linkPreview`,`|`,`editLink`,`linkProperties`,`unlink`]})}init(){let 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:HO}),e.conversion.for(`editingDowncast`).attributeToElement({model:`linkHref`,view:(e,n)=>HO(UO(e,t),n)}),e.conversion.for(`upcast`).elementToAttribute({view:{name:`a`,attributes:{href:!0}},model:{key:`linkHref`,value:e=>e.getAttribute(`href`)}}),e.commands.add(`link`,new nk(e)),e.commands.add(`unlink`,new ak(e));let n=GO(e.t,KO(e.config.get(`link.decorators`)));this._enableAutomaticDecorators(n.filter(e=>e.mode===ck)),this._enableManualDecorators(n.filter(e=>e.mode===`manual`)),e.plugins.get(bT).registerAttribute(`linkHref`),zT(e,`linkHref`,`a`,`ck-link_selected`),this._enableLinkOpen(),this._enableSelectionAttributesFixer(),this._enableClipboardIntegration(),this._enableDecoratorConflictPostfixer()}_registerLinkOpener(e){this._linkOpeners.push(e)}_enableAutomaticDecorators(e){let t=this.editor,n=t.commands.get(`link`),r=n.automaticDecorators;t.config.get(`link.addTargetToExternalLinks`)&&r.add({id:`linkIsExternal`,mode:ck,callback:e=>!!e&&lk.test(e),attributes:{target:`_blank`,rel:`noopener noreferrer`}}),r.add(e),r.setConflictChecker((e,t)=>{for(let r of n.manualDecorators)if(t.hasAttribute(r.id)&&$O(e,r))return!0}),r.length&&t.conversion.for(`downcast`).add(r.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;let t=this.editor,n=t.commands.get(`link`).manualDecorators;e.forEach(e=>{t.model.schema.extend(`$text`,{allowAttributes:e.id});let r=new sk(e);n.add(r),t.conversion.for(`downcast`).add(e=>{let t=e=>{let t=e.createAttributeElement(`a`,r.attributes,{priority:5});r.classes&&e.addClass(r.classes,t);for(let n in r.styles)e.setStyle(n,r.styles[n],t);return e.setCustomProperty(`link`,!0,t),t},n=e=>(n,r,i)=>{if(!(!r.item.is(`selection`)&&!i.schema.isInline(r.item))){if(!e&&r.attributeOldValue){if(!i.consumable.test(r.item,n.name))return;i.writer.unwrap(i.mapper.toViewRange(r.range),t(i.writer))}if(e&&r.attributeNewValue){if(!i.consumable.consume(r.item,n.name))return;r.item.is(`selection`)?i.writer.wrap(i.writer.document.selection.getFirstRange(),t(i.writer)):i.writer.wrap(i.mapper.toViewRange(r.range),t(i.writer))}}};e.on(`attribute:${r.id}`,n(!1),{priority:ge.high-1}),e.on(`attribute:${r.id}`,n(!0),{priority:ge.high-2})}),t.conversion.for(`upcast`).elementToAttribute({view:{name:`a`,...r._createPattern()},model:{key:r.id}})})}_enableLinkOpen(){let e=this.editor,t=e.editing.view.document,n=e=>{this._linkOpeners.some(t=>t(e))||ZO(e)};this.listenTo(t,`click`,(e,t)=>{if(!(p.isMac?t.domEvent.metaKey:t.domEvent.ctrlKey))return;let r=t.domTarget;if(r.tagName.toLowerCase()!=`a`&&(r=r.closest(`a`)),!r)return;let i=r.getAttribute(`href`);i&&(e.stop(),t.preventDefault(),n(i))},{context:`$capture`}),this.listenTo(t,`keydown`,(t,r)=>{let i=e.commands.get(`link`).value;i&&r.keyCode===k.enter&&r.altKey&&(t.stop(),n(i))})}_enableSelectionAttributesFixer(){let e=this.editor.model,t=e.document.selection;this.listenTo(t,`change:attribute`,(n,{attributeKeys:r})=>{!r.includes(`linkHref`)||t.hasAttribute(`linkHref`)||e.change(t=>{dk(t,fk(e.schema))})})}_enableClipboardIntegration(){let e=this.editor,t=e.model,n=this.editor.config.get(`link.defaultProtocol`);n&&this.listenTo(e.plugins.get(`ClipboardPipeline`),`contentInsertion`,(e,r)=>{t.change(e=>{let t=e.createRangeIn(r.content);for(let r of t.getItems())if(r.hasAttribute(`linkHref`)){let t=YO(r.getAttribute(`linkHref`),n);e.setAttribute(`linkHref`,t,r)}})})}_enableDecoratorConflictPostfixer(){let e=this.editor,t=e.model,n=e.commands.get(`link`);t.document.registerPostFixer(e=>{let r=!1,i=t.document.differ.getChanges(),a=new Set,o=new Set(n.manualDecorators.map(e=>e.id));for(let e of i){if(e.type===`attribute`){if(e.attributeKey!==`linkHref`&&!o.has(e.attributeKey))continue;for(let t of e.range.getItems())t.hasAttribute(`linkHref`)&&a.add(t)}e.type===`insert`&&e.attributes.has(`linkHref`)&&e.position.nodeAfter&&a.add(e.position.nodeAfter)}for(let t of a){let i=[];for(let a of n.manualDecorators)if(t.hasAttribute(a.id)){for(let n=i.length-1;n>=0;n--){let o=i[n];$O(o,a)&&(e.removeAttribute(o.id,t),i.splice(n,1),r=!0)}i.push(a)}}return r})}};function dk(e,t){e.removeSelectionAttribute(`linkHref`);for(let n of t)e.removeSelectionAttribute(n)}function fk(e){return e.getDefinition(`$text`).allowAttributes.filter(e=>e.startsWith(`link`))}var pk=class extends H{constructor(e){super(e);let t=this.bindTemplate;this.set({href:void 0,withText:!0}),this.extendTemplate({attributes:{class:[`ck-link-toolbar__preview`],href:t.to(`href`),target:`_blank`,rel:`noopener noreferrer`},on:{click:t.to(e=>{this.href&&this.fire(`navigate`,this.href,()=>e.preventDefault())})}}),this.template.tag=`a`}},mk=class extends P{focusTracker=new M;keystrokes=new N;backButtonView;saveButtonView;displayedTextInputView;urlInputView;children;providersListChildren;_validators;_focusables=new pa;_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 Hy({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(),Qa({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(let e of this._validators){let t=e(this);if(t)return this.urlInputView.errorText=t,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null}_createBackButton(){let e=this.locale.t,t=new H(this.locale);return t.set({class:`ck-button-back`,label:e(`Back`),icon:Wv,tooltip:!0}),t.delegate(`execute`).to(this,`cancel`),t}_createSaveButton(){let e=this.locale.t,t=new H(this.locale);return t.set({label:e(`Insert`),tooltip:!1,withText:!0,type:`submit`,class:`ck-button-action ck-button-bold`}),t}_createHeaderView(){let e=this.locale.t,t=new By(this.locale,{label:e(`Link`)});return t.children.add(this.backButtonView,0),t}_createProvidersListView(){let e=new mx(this.locale);return e.extendTemplate({attributes:{class:[`ck-link-form__providers-list`]}}),e.items.bindTo(this.providersListChildren).using(e=>{let t=new dx(this.locale);return t.children.add(e),t}),e}_createDisplayedTextInput(){let e=this.locale.t,t=new Qb(this.locale,Jx);return t.label=e(`Displayed text`),t.class=`ck-labeled-field-view_full-width`,t}_createUrlInput(){let e=this.locale.t,t=new Qb(this.locale,Jx);return t.fieldView.inputMode=`url`,t.label=e(`Link URL`),t.class=`ck-labeled-field-view_full-width`,t}_createFormChildren(){this.children.add(new MC(this.locale,{children:[this.displayedTextInputView],class:[`ck-form__row_large-top-padding`]})),this.children.add(new MC(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(){let{element:e}=this.urlInputView.fieldView;return e?e.value.trim():null}},hk=class extends P{focusTracker=new M;keystrokes=new N;backButtonView;listView;listChildren;emptyListInformation;children;_focusables=new pa;_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`,!1),this.listenTo(this.listChildren,`change`,()=>{this.hasItems=this.listChildren.length>0}),this.on(`change:hasItems`,(e,t,n)=>{n?(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 Hy({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(){let e=new mx(this.locale);return e.extendTemplate({attributes:{class:[`ck-link-providers__list`]}}),e.items.bindTo(this.listChildren).using(e=>{let t=new dx(this.locale);return t.children.add(e),t}),e}_createBackButton(){let e=this.locale.t,t=new H(this.locale);return t.set({class:`ck-button-back`,label:e(`Back`),icon:Wv,tooltip:!0}),t.delegate(`execute`).to(this,`cancel`),t}_createHeaderView(){let e=new By(this.locale);return e.bind(`label`).to(this,`title`),e.children.add(this.backButtonView,0),e}_createEmptyLinksListItemView(){let e=new P(this.locale);return e.setTemplate({tag:`p`,attributes:{class:[`ck`,`ck-link__empty-list-info`]},children:[{text:this.bindTemplate.to(`emptyListPlaceholder`)}]}),e}},gk=class extends P{focusTracker=new M;keystrokes=new N;backButtonView;children;listChildren;_focusables=new pa;_focusCycler;constructor(e){super(e),this.backButtonView=this._createBackButton(),this.listChildren=this.createCollection(),this.children=this.createCollection([this._createHeaderView(),this._createListView()]),this._focusCycler=new Hy({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(){let e=this.locale.t,t=new H(this.locale);return t.set({class:`ck-button-back`,label:e(`Back`),icon:Wv,tooltip:!0}),t.delegate(`execute`).to(this,`back`),t}_createHeaderView(){let e=this.locale.t,t=new By(this.locale,{label:e(`Link properties`)});return t.children.add(this.backButtonView,0),t}_createListView(){let e=new mx(this.locale);return e.extendTemplate({attributes:{class:[`ck-link__list`]}}),e.items.bindTo(this.listChildren).using(e=>{let t=new dx(this.locale);return t.children.add(e),t}),e}},_k=class extends H{arrowView;constructor(e){super(e),this.set({withText:!0}),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{class:[`ck-link__button`]}})}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){let e=new Ly;return e.content=gv,e}};const vk=`link-ui`;var yk=class extends F{toolbarView=null;formView=null;linkProviderItemsView=null;propertiesView=null;_balloon;_linksProviders=new Fi;static get requires(){return[BC,uk]}static get pluginName(){return`LinkUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=this.editor.t;this.set(`selectedLinkableText`,void 0),e.editing.view.addObserver(kp),this._balloon=e.plugins.get(BC),this._registerComponents(),this._registerEditingOpeners(),this._enableBalloonActivators(),e.conversion.for(`editingDowncast`).markerToHighlight({model:vk,view:{classes:[`ck-fake-link-selection`]}}),e.conversion.for(`editingDowncast`).markerToElement({model:vk,view:(e,{writer:t})=>{if(!e.markerRange.isCollapsed)return null;let n=t.createUIElement(`span`);return t.addClass([`ck-fake-link-selection`,`ck-fake-link-selection_collapsed`],n),n}}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t(`Create link`),keystroke:BO},{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){let t=this._linksProviders.filter(t=>(t.order||0)<=(e.order||0)).length;this._linksProviders.add(e,t)}_createViews(){let e=this.editor.commands.get(`link`);this.toolbarView=this._createToolbarView(),this.formView=this._createFormView(),e.manualDecorators.length&&(this.propertiesView=this._createPropertiesView()),this._enableUserBalloonInteractions()}_createToolbarView(){let e=this.editor,t=new Ox(e.locale),n=e.commands.get(`link`);t.class=`ck-link-toolbar`;let r=e.config.get(`link.toolbar`);return n.manualDecorators.length||(r=r.filter(e=>e!==`linkProperties`)),t.fillFromConfig(r,e.ui.componentFactory),t.keystrokes.set(`Esc`,(e,t)=>{this._hideUI(),t()}),t.keystrokes.set(BO,(e,t)=>{this._addFormView(),t()}),e.ui.addToolbar(t,{isContextual:!0,beforeFocus:()=>{this._getSelectedLinkElement()&&!this._isToolbarVisible&&this._showUI(!0)},afterBlur:()=>{this._hideUI(!1)}}),t}_createFormView(){let e=this.editor,t=e.locale.t,n=e.commands.get(`link`),r=e.config.get(`link.defaultProtocol`),i=new(Xa(mk))(e.locale,xk(e));return i.displayedTextInputView.bind(`isEnabled`).to(this,`selectedLinkableText`,e=>e!==void 0),i.urlInputView.bind(`isEnabled`).to(n,`isEnabled`),i.saveButtonView.bind(`isEnabled`).to(n,`isEnabled`),i.saveButtonView.bind(`label`).to(n,`value`,e=>t(e?`Update`:`Insert`)),this.listenTo(i,`submit`,()=>{if(i.isValid()){let t=i.urlInputView.fieldView.element.value,n=YO(t,r),a=i.displayedTextInputView.fieldView.element.value;e.execute(`link`,n,this._getDecoratorSwitchesState(),a===this.selectedLinkableText?void 0:a),this._closeFormView()}}),this.listenTo(i.urlInputView,`change:errorText`,()=>{e.ui.update()}),this.listenTo(i,`cancel`,()=>{this._closeFormView()}),i.keystrokes.set(`Esc`,(e,t)=>{this._closeFormView(),t()}),i.providersListChildren.bindTo(this._linksProviders).using(e=>this._createLinksListProviderButton(e)),i}_createLinkProviderListView(e){return e.getListItems().map(({href:e,label:t,icon:n})=>{let r=new H;return r.set({label:t,icon:n,tooltip:!1,withText:!0}),r.on(`execute`,()=>{this.formView.resetFormStatus(),this.formView.urlInputView.fieldView.value=e,this.editor.editing.view.focus(),this._removeLinksProviderView(),this.formView.focus()}),r})}_createLinkProviderItemsView(e){let t=this.editor,n=t.locale.t,r=new hk(t.locale),{emptyListPlaceholder:i,label:a}=e;return r.emptyListPlaceholder=i||n(`No links available`),r.title=a,this.listenTo(r,`cancel`,()=>{t.editing.view.focus(),this._removeLinksProviderView(),this.formView.focus()}),r}_createPropertiesView(){let e=this.editor,t=this.editor.commands.get(`link`),n=new(Xa(gk))(e.locale);return this.listenTo(n,`back`,()=>{e.editing.view.focus(),this._removePropertiesView()}),n.listChildren.bindTo(t.manualDecorators).using(n=>{let r=new mb(e.locale);return r.set({label:n.label,withText:!0}),r.bind(`isOn`).toMany([n,t],`value`,(e,t)=>t===void 0&&e===void 0?!!n.defaultValue:!!e),r.on(`execute`,()=>{e.execute(`link`,t.value,{...this._getDecoratorSwitchesState(),[n.id]:!r.isOn})}),r}),n}_getDecoratorSwitchesState(){let e=this.editor.commands.get(`link`);return Array.from(e.manualDecorators).reduce((t,n)=>{let r=e.value===void 0&&n.value===void 0?n.defaultValue:n.value;return{...t,[n.id]:!!r}},{})}_registerEditingOpeners(){this.editor.plugins.get(uk)._registerLinkOpener(e=>{let t=this._getLinkProviderLinkByHref(e);if(!t)return!1;let{item:n,provider:r}=t;return r.navigate?r.navigate(n):!1})}_registerComponents(){let e=this.editor;e.ui.componentFactory.add(`link`,()=>{let e=this._createButton(H);return e.set({tooltip:!0}),e}),e.ui.componentFactory.add(`menuBar:link`,()=>{let e=this._createButton(U);return e.set({role:`menuitemcheckbox`}),e}),e.ui.componentFactory.add(`linkPreview`,t=>{let n=new pk(t),r=e.config.get(`link.allowedProtocols`),i=e.commands.get(`link`),a=t.t;n.bind(`isEnabled`).to(i,`value`,e=>!!e),n.bind(`href`).to(i,`value`,e=>e&&UO(e,r));let o=e=>{if(e===``){n.label=a(`This link has no URL`),n.icon=void 0,n.tooltip=!1;return}if(!e){n.label=void 0,n.icon=void 0,n.tooltip=a(`Open link in new tab`);return}let t=this._getLinkProviderLinkByHref(e);if(t){let{label:e,tooltip:r,icon:i}=t.item;n.label=e,n.tooltip=r||!1,n.icon=i}else n.label=e,n.icon=void 0,n.tooltip=a(`Open link in new tab`)};return o(i.value),this.listenTo(i,`change:value`,(e,t,n)=>{o(n)}),this.listenTo(n,`navigate`,(e,t,n)=>{let r=this._getLinkProviderLinkByHref(t);if(!r)return;let{provider:i,item:a}=r,{navigate:o}=i;o&&o(a)&&(e.stop(),n())}),n}),e.ui.componentFactory.add(`unlink`,t=>{let n=e.commands.get(`unlink`),r=new H(t),i=t.t;return r.set({label:i(`Unlink`),icon:ky,tooltip:!0}),r.bind(`isEnabled`).to(n),this.listenTo(r,`execute`,()=>{e.execute(`unlink`),this._hideUI()}),r}),e.ui.componentFactory.add(`editLink`,t=>{let n=e.commands.get(`link`),r=new H(t),i=t.t;return r.set({label:i(`Edit link`),icon:Rv,tooltip:!0}),r.bind(`isEnabled`).to(n),this.listenTo(r,`execute`,()=>{this._addFormView()}),r}),e.ui.componentFactory.add(`linkProperties`,t=>{let n=e.commands.get(`link`),r=new H(t),i=t.t;return r.set({label:i(`Link properties`),icon:iy,tooltip:!0}),r.bind(`isEnabled`).to(n,`isEnabled`,n,`value`,n,`manualDecorators`,(e,t,n)=>e&&!!t&&n.length>0),this.listenTo(r,`execute`,()=>{this._addPropertiesView()}),r})}_createLinksListProviderButton(e){let t=this.editor.locale,n=new _k(t);return n.set({label:e.label}),this.listenTo(n,`execute`,()=>{this._showLinksProviderView(e)}),n}_createButton(e){let t=this.editor,n=t.locale,r=t.commands.get(`link`),i=new e(t.locale),a=n.t;return i.set({label:a(`Link`),icon:Z_,keystroke:BO,isToggleable:!0}),i.bind(`isEnabled`).to(r,`isEnabled`),i.bind(`isOn`).to(r,`value`,e=>!!e),this.listenTo(i,`execute`,()=>{t.editing.view.scrollToTheSelection(),this._showUI(!0),this._getSelectedLinkElement()&&this._addFormView()}),i}_enableBalloonActivators(){let e=this.editor,t=e.editing.view.document;this.listenTo(t,`click`,()=>{this._getSelectedLinkElement()&&this._showUI()}),e.keystrokes.set(BO,(t,n)=>{n(),e.commands.get(`link`).isEnabled&&(e.editing.view.scrollToTheSelection(),this._showUI(!0))})}_enableUserBalloonInteractions(){this.editor.keystrokes.set(`Tab`,(e,t)=>{this._isToolbarVisible&&!this.toolbarView.focusTracker.isFocused&&(this.toolbarView.focus(),t())},{priority:`high`}),this.editor.keystrokes.set(`Esc`,(e,t)=>{this._isUIVisible&&(this._hideUI(),t())}),Ya({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>{this._hideUI(!1)}})}_addToolbarView(){this.toolbarView||this._createViews(),!this._isToolbarInPanel&&this._balloon.add({view:this.toolbarView,position:this._getBalloonPositionData(),balloonClassName:`ck-toolbar-container`})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;let e=this.editor.commands.get(`link`);this.formView.disableCssTransitions(),this.formView.resetFormStatus(),this.formView.backButtonView.isVisible=e.isEnabled&&e.value!==void 0,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(){let e=this.editor.commands.get(`link`);this.selectedLinkableText=void 0,e.value===void 0?this._hideUI():this._removeFormView()}_removePropertiesView(){this._arePropertiesInPanel&&this._balloon.remove(this.propertiesView)}_removeLinksProviderView(){this._isLinksListInPanel&&this._balloon.remove(this.linkProviderItemsView)}_removeFormView(e=!0){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this.formView.displayedTextInputView.fieldView.reset(),this.formView.urlInputView.fieldView.reset(),this._balloon.remove(this.formView),e&&this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(e=!1){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._isToolbarVisible?this._addFormView():this._addToolbarView(),e&&this._balloon.showStack(`main`)):(this._showFakeVisualSelection(),this._addToolbarView(),e&&this._balloon.showStack(`main`),this._addFormView()),this._startUpdatingUI()}_hideUI(e=!0){let 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(){let e=this.editor,t=e.editing.view.document,n=this._getSelectedLinkElement(),r=a(),i=()=>{let e=this._getSelectedLinkElement(),t=a();n&&!e||!n&&t!==r?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),n=e,r=t};function a(){return t.selection.focus.getAncestors().reverse().find(e=>e.is(`element`))}this.listenTo(e.ui,`update`,i),this.listenTo(this._balloon,`change:visibleView`,i)}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(){let e=this.editor.editing.view,t=e.document;if(this.editor.model.markers.has(vk)){let t=this.editor.editing.mapper.markerNameToElements(vk);if(t){let n=Array.from(t),r=e.createRange(e.createPositionBefore(n[0]),e.createPositionAfter(n[n.length-1]));return{target:e.domConverter.viewRangeToDom(r)}}}return{target:()=>{let n=this._getSelectedLinkElement();return n?e.domConverter.mapViewToDom(n):e.domConverter.viewRangeToDom(t.selection.getFirstRange())}}}_getSelectedLinkElement(){let e=this.editor.editing.view,t=e.document.selection,n=t.getSelectedElement();if(t.isCollapsed||n&&HE(n))return bk(t.getFirstPosition());{let n=t.getFirstRange().getTrimmed(),r=bk(n.start),i=bk(n.end);return!r||r!=i?null:e.createRangeIn(r).getTrimmed().isEqual(n)?r:null}}_getSelectedLinkableText(){let e=this.editor.model,t=this.editor.editing,n=this._getSelectedLinkElement();if(!n)return QO(e.document.selection.getFirstRange());let r=t.view.createRangeOn(n);return QO(t.mapper.toModelRange(r))}_getLinkProviderLinkByHref(e){if(!e)return null;for(let t of this._linksProviders){let n=t.getItem?t.getItem(e):t.getListItems().find(t=>t.href===e);if(n)return{provider:t,item:n}}return null}_showFakeVisualSelection(){let e=this.editor.model;e.change(t=>{let n=e.document.selection.getFirstRange();if(e.markers.has(vk))t.updateMarker(vk,{range:n});else if(n.start.isAtEnd){let r=n.start.getLastMatchingPosition(({item:t})=>!e.schema.isContent(t),{boundaries:n});t.addMarker(vk,{usingOperation:!1,affectsData:!1,range:t.createRange(r,n.end)})}else t.addMarker(vk,{usingOperation:!1,affectsData:!1,range:n})})}_hideFakeVisualSelection(){let e=this.editor.model;e.markers.has(vk)&&e.change(e=>{e.removeMarker(vk)})}};function bk(e){return e.getAncestors().find(e=>VO(e))||null}function xk(e){let t=e.t,n=e.config.get(`link.allowCreatingEmptyLinks`);return[e=>{if(!n&&!e.url.length)return t(`Link URL must not be empty.`)}]}const Sk=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`);var Ck=class extends F{static get requires(){return[hT,uk]}static get pluginName(){return`AutoLink`}static get isOfficialPlugin(){return!0}init(){let 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`)?LT(t,`linkHref`,t.textNode.getAttribute(`linkHref`),e):null}_selectEntireLinks(e,t){let n=this.editor.model,r=n.document.selection,i=r.getFirstPosition(),a=r.getLastPosition(),o=t.getJoined(this._expandLinkRange(n,i)||t);o&&=o.getJoined(this._expandLinkRange(n,a)||t),o&&(o.start.isBefore(i)||o.end.isAfter(a))&&e.setSelection(o)}_enablePasteLinking(){let e=this.editor,t=e.model,n=t.document.selection,r=e.plugins.get(`ClipboardPipeline`),i=e.commands.get(`link`);r.on(`inputTransformation`,(e,r)=>{if(!this.isEnabled||!i.isEnabled||n.isCollapsed||r.method!==`paste`||n.rangeCount>1)return;let a=n.getFirstRange(),o=r.dataTransfer.getData(`text/plain`);if(!o)return;let s=o.match(Sk);s&&s[2]===o&&(t.change(e=>{this._selectEntireLinks(e,a),i.execute(o)}),e.stop())},{priority:`high`})}_enableTypingHandling(){let e=this.editor,t=new yT(e.model,e=>{let t=e;if(!wk(t))return;t=t.slice(0,-1),`!.:,;?`.includes(t[t.length-1])&&(t=t.slice(0,-1));let n=Tk(t);if(n)return{url:n,removedTrailingCharacters:e.length-t.length}});t.on(`matched:data`,(t,n)=>{let{batch:r,range:i,url:a,removedTrailingCharacters:o}=n;if(!r.isTyping)return;let s=i.end.getShiftedBy(-o),c=s.getShiftedBy(-a.length),l=e.model.createRange(c,s);this._applyAutoLink(a,l)}),t.bind(`isEnabled`).to(this)}_enableEnterHandling(){let e=this.editor,t=e.model,n=e.commands.get(`enter`);n&&n.on(`execute`,()=>{let e=t.document.selection.getFirstPosition(),n;n=e.parent.previousSibling?.is(`element`)?t.createRangeIn(e.parent.previousSibling):t.createRange(t.createPositionAt(e.parent,0),e),this._checkAndApplyAutoLinkOnRange(n)})}_enableShiftEnterHandling(){let e=this.editor,t=e.model,n=e.commands.get(`shiftEnter`);n&&n.on(`execute`,()=>{let e=t.document.selection.getFirstPosition(),n=t.createRange(t.createPositionAt(e.parent,0),e.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(n)})}_checkAndApplyAutoLinkOnRange(e){let t=this.editor.model,{text:n,range:r}=_T(e,t),i=Tk(n);if(i){let e=t.createRange(r.end.getShiftedBy(-i.length),r.end);this._applyAutoLink(i,e)}}_applyAutoLink(e,t){let n=this.editor.model,r=YO(e,this.editor.config.get(`link.defaultProtocol`));!this.isEnabled||!Ek(t,n)||!XO(r)||Dk(t)||this._persistAutoLink(r,t)}_persistAutoLink(e,t){let n=this.editor.model,r=this.editor.plugins.get(`Delete`);n.enqueueChange(i=>{i.setAttribute(`linkHref`,e,t),n.enqueueChange(()=>{r.requestUndoOnBackspace()})})}};function wk(e){return e.length>4&&e[e.length-1]===` `&&e[e.length-2]!==` `}function Tk(e){let t=Sk.exec(e);return t?t[2]:null}function Ek(e,t){return t.schema.checkAttributeInSelection(t.createSelection(e),`linkHref`)}function Dk(e){let t=e.start.nodeAfter;return!!t&&t.hasAttribute(`linkHref`)}var Ok=class extends F{static get requires(){return[uk,yk,Ck]}static get pluginName(){return`Link`}static get isOfficialPlugin(){return!0}},kk=class extends I{_stack=[];_createdBatches=new WeakSet;constructor(e){super(e),this.refresh(),this._isEnabledBasedOnSelection=!1,this.listenTo(e.data,`set`,(e,t)=>{t[1]={...t[1]};let n=t[1];n.batchType||={isUndoable:!1}},{priority:`high`}),this.listenTo(e.data,`set`,(e,t)=>{t[1].batchType.isUndoable||this.clearStack()})}refresh(){this.isEnabled=this._stack.length>0}get createdBatches(){return this._createdBatches}addBatch(e){let t=this.editor.model.document.selection,n={ranges:t.hasOwnRange?Array.from(t.getRanges()):[],isBackward:t.isBackward};this._stack.push({batch:e,selection:n}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(e,t,n){let r=this.editor.model,i=r.document,a=[],o=e.map(e=>e.getTransformedByOperations(n)),s=o.flat();for(let e of o){let t=e.filter(e=>e.root!=i.graveyard).filter(e=>!jk(e,s));t.length&&(Ak(t),a.push(t[0]))}a.length&&r.change(e=>{e.setSelection(a,{backward:t})})}_undo(e,t){let n=this.editor.model,r=n.document;this._createdBatches.add(t);let i=e.operations.slice().filter(e=>e.isDocumentOperation);i.reverse();for(let e of i){let i=e.baseVersion+1,a=Array.from(r.history.getOperations(i)),o=nf([e.getReversed()],a,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(let i of o){let a=i.affectedSelectable;a&&!n.canEditAt(a)&&(i=new Kd(i.baseVersion)),t.addOperation(i),n.applyOperation(i),r.history.setOperationAsUndone(e,i)}}}};function Ak(e){e.sort((e,t)=>e.start.isBefore(t.start)?-1:1);for(let t=1;t<e.length;t++){let n=e[t-1].getJoined(e[t],!0);n&&(t--,e.splice(t,2,n))}}function jk(e,t){return t.some(t=>t!==e&&t.containsRange(e,!0))}var Mk=class extends kk{execute(e=null){let t=e?this._stack.findIndex(t=>t.batch==e):this._stack.length-1,n=this._stack.splice(t,1)[0],r=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(r,()=>{this._undo(n.batch,r);let e=this.editor.model.document.history.getOperations(n.batch.baseVersion);this._restoreSelection(n.selection.ranges,n.selection.isBackward,e)}),this.fire(`revert`,n.batch,r),this.refresh()}},Nk=class extends kk{execute(){let e=this._stack.pop(),t=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(t,()=>{let n=e.batch.operations[e.batch.operations.length-1].baseVersion+1,r=this.editor.model.document.history.getOperations(n);this._restoreSelection(e.selection.ranges,e.selection.isBackward,r),this._undo(e.batch,t)}),this.fire(`revert`,e.batch,t),this.refresh()}},Pk=class extends F{_undoCommand;_redoCommand;_batchRegistry=new WeakSet;static get pluginName(){return`UndoEditing`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.t;this._undoCommand=new Mk(e),this._redoCommand=new Nk(e),e.commands.add(`undo`,this._undoCommand),e.commands.add(`redo`,this._redoCommand),this.listenTo(e.model,`applyOperation`,(e,t)=>{let n=t[0];if(!n.isDocumentOperation)return;let r=n.batch,i=this._redoCommand.createdBatches.has(r),a=this._undoCommand.createdBatches.has(r);this._batchRegistry.has(r)||(this._batchRegistry.add(r),r.isUndoable&&(i?this._undoCommand.addBatch(r):a||(this._undoCommand.addBatch(r),this._redoCommand.clearStack())))},{priority:`highest`}),this.listenTo(this._undoCommand,`revert`,(e,t,n)=>{this._redoCommand.addBatch(n)}),e.keystrokes.set(`CTRL+Z`,`undo`),e.keystrokes.set(`CTRL+Y`,`redo`),e.keystrokes.set(`CTRL+SHIFT+Z`,`redo`),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t(`Undo`),keystroke:`CTRL+Z`},{label:t(`Redo`),keystroke:[[`CTRL+Y`],[`CTRL+SHIFT+Z`]]}]})}},Fk=class extends F{static get pluginName(){return`UndoUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale,n=e.t,r=t.uiLanguageDirection==`ltr`?Oy:Jv,i=t.uiLanguageDirection==`ltr`?Jv:Oy;this._addButtonsToFactory(`undo`,n(`Undo`),`CTRL+Z`,r),this._addButtonsToFactory(`redo`,n(`Redo`),`CTRL+Y`,i)}_addButtonsToFactory(e,t,n,r){let i=this.editor;i.ui.componentFactory.add(e,()=>{let i=this._createButton(H,e,t,n,r);return i.set({tooltip:!0}),i}),i.ui.componentFactory.add(`menuBar:`+e,()=>this._createButton(U,e,t,n,r))}_createButton(e,t,n,r,i){let a=this.editor,o=a.locale,s=a.commands.get(t),c=new e(o);return c.set({label:n,icon:i,keystroke:r}),c.bind(`isEnabled`).to(s,`isEnabled`),this.listenTo(c,`execute`,()=>{a.execute(t),a.editing.view.focus()}),c}},Ik=class extends F{static get requires(){return[Pk,Fk]}static get pluginName(){return`Undo`}static get isOfficialPlugin(){return!0}};function Lk(e){return e.createContainerElement(`span`,{class:`image-inline`},e.createEmptyElement(`img`))}function Rk(e){return e.createContainerElement(`figure`,{class:`image`},[e.createEmptyElement(`img`),e.createSlot(`children`)])}function zk(e,t){let n=e.plugins.get(`ImageUtils`),r=e.plugins.has(`ImageInlineEditing`)&&e.plugins.has(`ImageBlockEditing`);return e=>n.isInlineImageView(e)?r?Bk(e,n)===t?i(e):null:i(e):null;function i(e){let t={name:!0};return e.hasAttribute(`src`)&&(t.attributes=[`src`]),t}}function Bk(e,t){return e.getStyle(`display`)==`block`||e.findAncestor(t.isBlockImageView)?`imageBlock`:`imageInline`}function Vk(e,t,n){return!!e.findAllowedParent(t,n)||ku(t,n,e)}function Hk(e,t){let n=j(t.getSelectedBlocks());return!n||e.isObject(n)||n.isEmpty&&n.name!=`listItem`?`imageBlock`:`imageInline`}function Uk(e){return e&&e.endsWith(`px`)?parseInt(e):null}function Wk(e){let t=Uk(e.getStyle(`width`)),n=Uk(e.getStyle(`height`));return!!(t&&n)}const Gk=/^(image|image-inline)$/;var Kk=class extends F{_domEmitter=new(br());static get pluginName(){return`ImageUtils`}static get isOfficialPlugin(){return!0}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,n=null,r={}){let i=this.editor,a=i.model,o=a.document.selection,s=Zk(i,t||o,n);e={...Object.fromEntries(o.getAttributes()),...e};for(let t in e)a.schema.checkAttribute(s,t)||delete e[t];return a.change(n=>{let{setImageSizes:i=!0}=r,o=n.createElement(s,e);return a.insertObject(o,t,null,{setSelection:`on`,findOptimalPosition:!t&&s!=`imageInline`?`auto`:void 0}),o.parent?(i&&this.setImageNaturalSizeAttributes(o),o):null})}setImageNaturalSizeAttributes(e){let t=e.getAttribute(`src`);t&&(e.getAttribute(`width`)||e.getAttribute(`height`)||this.editor.model.change(n=>{let r=new u.window.Image;this._domEmitter.listenTo(r,`load`,()=>{!e.getAttribute(`width`)&&!e.getAttribute(`height`)&&this.editor.model.enqueueChange(n.batch,t=>{t.setAttribute(`width`,r.naturalWidth,e),t.setAttribute(`height`,r.naturalHeight,e)}),this._domEmitter.stopListening(r,`load`)}),r.src=t}))}getClosestSelectedImageWidget(e){let t=e.getFirstPosition();if(!t)return null;let n=e.getSelectedElement();if(n&&this.isImageWidget(n))return n;let r=t.parent;for(;r;){if(r.is(`element`)&&this.isImageWidget(r))return r;r=r.parent}return null}getClosestSelectedImageElement(e){let t=e.getSelectedElement();return this.isImage(t)?t:e.getFirstPosition().findAncestor(`imageBlock`)}getImageWidgetFromImageView(e){return e.findAncestor({classes:Gk})}isImageAllowed(){let e=this.editor.model.document.selection;return qk(this.editor,e)&&Jk(e)}toImageWidget(e,t,n){return t.setCustomProperty(`image`,!0,e),UE(e,t,{label:()=>{let t=this.findViewImgElement(e).getAttribute(`alt`);return t?`${t} ${n}`:n}})}isImageWidget(e){return!!e.getCustomProperty(`image`)&&HE(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;let t=this.editor.editing.view;for(let{item:n}of t.createRangeIn(e))if(this.isInlineImageView(n))return n}destroy(){return this._domEmitter.stopListening(),super.destroy()}};function qk(e,t){return Zk(e,t,null)==`imageBlock`?Xk(e.model,t):e.model.schema.checkChild(t.focus,`imageInline`)}function Jk(e){return[...e.focus.getAncestors()].every(e=>!e.is(`element`,`imageBlock`))}function Yk(e,t){let n=XE(e,t).start.parent;return n.isEmpty&&!n.is(`rootElement`)?n.parent:n}function Xk(e,t){let n=Yk(t.is(`position`)?e.createSelection(t):t,e);return e.schema.checkChild(n,`imageBlock`)}function Zk(e,t,n){let r=e.model.schema,i=e.config.get(`image.insert.type`);return e.plugins.has(`ImageBlockEditing`)?e.plugins.has(`ImageInlineEditing`)?n||(!Xk(e.model,t)||i===`inline`?`imageInline`:i===`auto`?t.is(`selection`)?Hk(r,t):r.checkChild(t,`imageInline`)?`imageInline`:`imageBlock`:`imageBlock`):`imageBlock`:`imageInline`}const Qk=RegExp(`^(http(s)?:\\/\\/)?[\\w-]+\\.[\\w.~:/[\\]@!$&'()*+,;=%-]+\\.(jpg|jpeg|png|gif|ico|webp|JPG|JPEG|PNG|GIF|ICO|WEBP)(\\?[\\w.~:/[\\]@!$&'()*+,;=%-]*)?(#[\\w.~:/[\\]@!$&'()*+,;=%-]*)?$`);var $k=class extends F{static get requires(){return[PO,Kk,Ik,hT]}static get pluginName(){return`AutoImage`}static get isOfficialPlugin(){return!0}_timeoutId;_positionToInsert;constructor(e){super(e),this._timeoutId=null,this._positionToInsert=null}init(){let e=this.editor,t=e.model.document,n=e.plugins.get(`ClipboardPipeline`);this.listenTo(n,`inputTransformation`,()=>{let e=t.selection.getFirstRange(),n=pf.fromPosition(e.start);n.stickiness=`toPrevious`;let r=pf.fromPosition(e.end);r.stickiness=`toNext`,t.once(`change:data`,()=>{this._embedImageBetweenPositions(n,r),n.detach(),r.detach()},{priority:`high`})}),e.commands.get(`undo`).on(`execute`,()=>{this._timeoutId&&(u.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)},{priority:`high`})}_embedImageBetweenPositions(e,t){let n=this.editor,r=new xl(e,t),i=r.getWalker({ignoreElementEnd:!0}),a=Object.fromEntries(n.model.document.selection.getAttributes()),o=this.editor.plugins.get(`ImageUtils`),s=``;for(let e of i)e.item.is(`$textProxy`)&&(s+=e.item.data);if(s=s.trim(),!s.match(Qk)){r.detach();return}this._positionToInsert=pf.fromPosition(e),this._timeoutId=setTimeout(()=>{if(!n.commands.get(`insertImage`).isEnabled){r.detach();return}n.model.change(e=>{this._timeoutId=null,e.remove(r),r.detach();let t;this._positionToInsert.root.rootName!==`$graveyard`&&(t=this._positionToInsert.toPosition()),o.insertImage({...a,src:s},t),this._positionToInsert.detach(),this._positionToInsert=null}),n.plugins.get(`Delete`).requestUndoOnBackspace()},100)}},eA=class extends I{refresh(){let e=this.editor.plugins.get(`ImageUtils`).getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!e,this.isEnabled&&e.hasAttribute(`alt`)?this.value=e.getAttribute(`alt`):this.value=!1}execute(e){let t=this.editor,n=t.plugins.get(`ImageUtils`),r=t.model,i=n.getClosestSelectedImageElement(r.document.selection);r.change(t=>{t.setAttribute(`alt`,e.newValue,i)})}},tA=class extends F{static get requires(){return[Kk]}static get pluginName(){return`ImageTextAlternativeEditing`}static get isOfficialPlugin(){return!0}init(){this.editor.commands.add(`imageTextAlternative`,new eA(this.editor))}},nA=class extends P{focusTracker;keystrokes;labeledInput;backButtonView;saveButtonView;children;_focusables;_focusCycler;constructor(e){super(e),this.focusTracker=new M,this.keystrokes=new N,this.backButtonView=this._createBackButton(),this.saveButtonView=this._createSaveButton(),this.labeledInput=this._createLabeledInputView(),this.children=this.createCollection([this._createHeaderView()]),this.children.add(new MC(e,{children:[this.labeledInput,this.saveButtonView],class:[`ck-form__row_with-submit`,`ck-form__row_large-top-padding`]})),this._focusables=new pa,this.keystrokes.set(`Esc`,(e,t)=>{this.fire(`cancel`),t()}),this._focusCycler=new Hy({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(),Qa({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(){let e=this.locale.t,t=new H(this.locale);return t.set({class:`ck-button-back`,label:e(`Back`),icon:Wv,tooltip:!0}),t.delegate(`execute`).to(this,`cancel`),t}_createSaveButton(){let e=this.locale.t,t=new H(this.locale);return t.set({label:e(`Save`),withText:!0,type:`submit`,class:`ck-button-action ck-button-bold`}),t}_createHeaderView(){let e=this.locale.t,t=new By(this.locale,{label:e(`Text Alternative`)});return t.children.add(this.backButtonView,0),t}_createLabeledInputView(){let e=this.locale.t,t=new Qb(this.locale,Jx);return t.label=e(`Text alternative`),t.class=`ck-labeled-field-view_full-width`,t}};function rA(e){let t=e.plugins.get(`ContextualBalloon`);if(e.plugins.get(`ImageUtils`).getClosestSelectedImageWidget(e.editing.view.document.selection)){let n=iA(e);t.updatePosition(n)}}function iA(e){let t=e.editing.view,n=ab.defaultPositions,r=e.plugins.get(`ImageUtils`);return{target:t.domConverter.mapViewToDom(r.getClosestSelectedImageWidget(t.document.selection)),positions:[n.northArrowSouth,n.northArrowSouthWest,n.northArrowSouthEast,n.southArrowNorth,n.southArrowNorthWest,n.southArrowNorthEast,n.viewportStickyNorth]}}var aA=class extends F{_balloon;_form;static get requires(){return[BC]}static get pluginName(){return`ImageTextAlternativeUI`}static get isOfficialPlugin(){return!0}init(){this._createButton()}destroy(){super.destroy(),this._form&&this._form.destroy()}_createButton(){let e=this.editor,t=e.t;e.ui.componentFactory.add(`imageTextAlternative`,n=>{let r=e.commands.get(`imageTextAlternative`),i=new H(n);return i.set({label:t(`Change image text alternative`),icon:Cy,tooltip:!0}),i.bind(`isEnabled`).to(r,`isEnabled`),i.bind(`isOn`).to(r,`value`,e=>!!e),this.listenTo(i,`execute`,()=>{this._showForm()}),i})}_createForm(){let e=this.editor,t=e.editing.view.document,n=e.plugins.get(`ImageUtils`);this._balloon=this.editor.plugins.get(`ContextualBalloon`),this._form=new(Xa(nA))(e.locale),this._form.render(),this.listenTo(this._form,`submit`,()=>{e.execute(`imageTextAlternative`,{newValue:this._form.labeledInput.fieldView.element.value}),this._hideForm(!0)}),this.listenTo(this._form,`cancel`,()=>{this._hideForm(!0)}),this.listenTo(e.ui,`update`,()=>{n.getClosestSelectedImageWidget(t.selection)?this._isVisible&&rA(e):this._hideForm(!0)}),Ya({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;this._form||this._createForm();let e=this.editor,t=e.commands.get(`imageTextAlternative`),n=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:iA(e)}),n.fieldView.value=n.fieldView.element.value=t.value||``,this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(e=!1){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),e&&this.editor.editing.view.focus())}get _isVisible(){return!!this._balloon&&this._balloon.visibleView===this._form}get _isInBalloon(){return!!this._balloon&&this._balloon.hasView(this._form)}},oA=class extends F{static get requires(){return[tA,aA]}static get pluginName(){return`ImageTextAlternative`}static get isOfficialPlugin(){return!0}};function sA(e){let t=(t,n,r)=>{if(!r.consumable.test(n.viewItem,{name:!0,classes:`image`}))return;let i=e.findViewImgElement(n.viewItem);if(!i||!r.consumable.test(i,{name:!0})||!Vk(r.schema,n.modelCursor,`imageBlock`))return;r.consumable.consume(n.viewItem,{name:!0,classes:`image`});let a=r.convertItem(i,n.modelCursor);if(!a.modelRange){r.consumable.revert(n.viewItem,{name:!0,classes:`image`});return}let o=j(a.modelRange.getItems());if(!o){r.consumable.revert(n.viewItem,{name:!0,classes:`image`});return}r.convertChildren(n.viewItem,o),r.updateConversionResult(o,n)};return e=>{e.on(`element:figure`,t)}}function cA(e,t){let n=(n,r,i)=>{let a=Bk(r.viewItem,t),o=r.viewItem.hasAttribute(`src`)?{src:r.viewItem.getAttribute(`src`)}:void 0,s={name:!0,attributes:Object.keys(o||{})};if(!i.consumable.test(r.viewItem,s))return;a!=e&&!Vk(i.schema,r.modelCursor,a)&&(a=e);let c=i.writer.createElement(a,o);i.safeInsert(c,r.modelCursor)&&(i.consumable.consume(r.viewItem,s),i.convertChildren(r.viewItem,c),i.updateConversionResult(c,r))};return e=>{e.on(`element:img`,n)}}function lA(e){let t=[`srcset`,`media`,`type`,`sizes`],n=(n,r,i)=>{let a=r.viewItem;if(!i.consumable.test(a,{name:!0}))return;let o=new Map;for(let e of a.getChildren())if(e.is(`element`,`source`)){let n={};for(let r of t)e.hasAttribute(r)&&i.consumable.test(e,{attributes:r})&&(n[r]=e.getAttribute(r));Object.keys(n).length&&o.set(e,n)}let s=e.findViewImgElement(a);if(!s)return;let c=r.modelCursor.parent;if(!c.is(`element`,`imageBlock`)){let e=i.convertItem(s,r.modelCursor);if(r.modelRange=e.modelRange,r.modelCursor=e.modelCursor,!e.modelRange||(c=j(e.modelRange.getItems()),!c))return}i.consumable.consume(a,{name:!0});for(let[e,t]of o)i.consumable.consume(e,{attributes:Object.keys(t)});o.size&&i.writer.setAttribute(`sources`,Array.from(o.values()),c),i.convertChildren(a,c)};return e=>{e.on(`element:picture`,n)}}function uA(e,t){let n=(t,n,r)=>{if(!r.consumable.consume(n.item,t.name))return;let i=r.writer,a=r.mapper.toViewElement(n.item),o=e.findViewImgElement(a);n.attributeNewValue===null?(i.removeAttribute(`srcset`,o),i.removeAttribute(`sizes`,o)):n.attributeNewValue&&(i.setAttribute(`srcset`,n.attributeNewValue,o),i.setAttribute(`sizes`,`100vw`,o))};return e=>{e.on(`attribute:srcset:${t}`,n)}}function dA(e){let t=(t,n,r)=>{if(!r.consumable.consume(n.item,t.name))return;let i=r.writer,a=r.mapper.toViewElement(n.item),o=e.findViewImgElement(a),s=n.attributeNewValue;if(s&&s.length){let e=[],t=o.parent;for(;t&&t.is(`attributeElement`);){let n=t.parent;i.unwrap(i.createRangeOn(o),t),e.unshift(t),t=n}let n=o.parent.is(`element`,`picture`),r=n?o.parent:i.createContainerElement(`picture`,null);n||i.insert(i.createPositionBefore(o),r),i.remove(i.createRangeIn(r)),i.insert(i.createPositionAt(r,`end`),s.map(e=>i.createEmptyElement(`source`,e))),i.move(i.createRangeOn(o),i.createPositionAt(r,`end`));for(let t of e)i.wrap(i.createRangeOn(r),t)}else if(o.parent.is(`element`,`picture`)){let e=o.parent;i.move(i.createRangeOn(o),i.createPositionBefore(e)),i.remove(e)}};return e=>{e.on(`attribute:sources:imageBlock`,t),e.on(`attribute:sources:imageInline`,t)}}function fA(e,t,n){let r=(t,n,r)=>{if(!r.consumable.consume(n.item,t.name))return;let i=r.writer,a=r.mapper.toViewElement(n.item),o=e.findViewImgElement(a);i.setAttribute(n.attributeKey,n.attributeNewValue||``,o)};return e=>{e.on(`attribute:${n}:${t}`,r)}}var pA=class extends kc{observe(e){this.listenTo(e,`load`,(e,t)=>{let n=t.target;this.checkShouldIgnoreEventFromTarget(n)||n.tagName==`IMG`&&this._fireEvents(t)},{useCapture:!0})}stopObserving(e){this.stopListening(e)}_fireEvents(e){this.isEnabled&&(this.document.fire(`layoutChanged`),this.document.fire(`imageLoaded`,e))}},mA=class extends I{constructor(e){super(e);let t=e.config.get(`image.insert.type`);e.plugins.has(`ImageBlockEditing`)||t===`block`&&T(`image-block-plugin-required`),e.plugins.has(`ImageInlineEditing`)||t===`inline`&&T(`image-inline-plugin-required`)}refresh(){let e=this.editor.plugins.get(`ImageUtils`);this.isEnabled=e.isImageAllowed()}execute(e){let t=A(e.source),n=this.editor.model.document.selection,r=this.editor.plugins.get(`ImageUtils`),i=Object.fromEntries(n.getAttributes());t.forEach((t,a)=>{let o=n.getSelectedElement();if(typeof t==`string`&&(t={src:t}),a&&o&&r.isImage(o)){let n=this.editor.model.createPositionAfter(o);r.insertImage({...t,...i},n,e.imageType)}else e.breakBlock?r.insertImage({...t,...i},n.getFirstPosition(),e.imageType):r.insertImage({...t,...i},null,e.imageType)})}},hA=class extends I{constructor(e){super(e),this.decorate(`cleanupImage`)}refresh(){let 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){let t=this.editor.model.document.selection.getSelectedElement(),n=this.editor.plugins.get(`ImageUtils`);this.editor.model.change(r=>{r.setAttribute(`src`,e.source,t),this.cleanupImage(r,t),n.setImageNaturalSizeAttributes(t)})}cleanupImage(e,t){e.removeAttribute(`srcset`,t),e.removeAttribute(`sizes`,t),e.removeAttribute(`sources`,t),e.removeAttribute(`width`,t),e.removeAttribute(`height`,t),e.removeAttribute(`alt`,t)}},gA=class extends F{static get requires(){return[Kk]}static get pluginName(){return`ImageEditing`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.conversion;e.editing.view.addObserver(pA),t.for(`upcast`).attributeToAttribute({view:{name:`img`,key:`alt`},model:`alt`}).attributeToAttribute({view:{name:`img`,key:`srcset`},model:`srcset`});let n=new mA(e),r=new hA(e);e.commands.add(`insertImage`,n),e.commands.add(`replaceImageSource`,r),e.commands.add(`imageInsert`,n)}},_A=class extends F{static get requires(){return[Kk]}static get pluginName(){return`ImageSizeAttributes`}static get isOfficialPlugin(){return!0}afterInit(){this._registerSchema(),this._registerConverters(`imageBlock`),this._registerConverters(`imageInline`)}_registerSchema(){let 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){let t=this.editor,n=t.plugins.get(`ImageUtils`),r=e===`imageBlock`?`figure`:`img`;t.conversion.for(`upcast`).attributeToAttribute({view:{name:r,styles:{width:/.+/}},model:{key:`width`,value:e=>Wk(e)?Uk(e.getStyle(`width`)):null}}).attributeToAttribute({view:{name:r,key:`width`},model:`width`}).attributeToAttribute({view:{name:r,styles:{height:/.+/}},model:{key:`height`,value:e=>Wk(e)?Uk(e.getStyle(`height`)):null}}).attributeToAttribute({view:{name:r,key:`height`},model:`height`}),t.conversion.for(`editingDowncast`).add(e=>{i(e,`width`,`width`,!0,!0),i(e,`height`,`height`,!0,!0)}),t.conversion.for(`dataDowncast`).add(e=>{i(e,`width`,`width`,!1),i(e,`height`,`height`,!1)}),t.conversion.for(`upcast`).add(e=>{e.on(`element:img`,(e,t,n)=>{let r=t.viewItem.getAttribute(`width`),i=t.viewItem.getAttribute(`height`);r&&i&&n.consumable.consume(t.viewItem,{styles:[`aspect-ratio`]})})});function i(t,r,i,a,o=!1){t.on(`attribute:${r}:${e}`,(t,r,s)=>{if(!s.consumable.consume(r.item,t.name))return;let c=s.writer,l=s.mapper.toViewElement(r.item),u=n.findViewImgElement(l);r.attributeNewValue===null?c.removeAttribute(i,u):c.setAttribute(i,r.attributeNewValue,u);let d=r.item.getAttribute(`width`),f=r.item.getAttribute(`height`),p=d&&f;if(p&&o&&c.setAttribute(`loading`,`lazy`,u),r.item.hasAttribute(`sources`))return;let m=r.item.hasAttribute(`resizedWidth`);e===`imageInline`&&!m&&!a||p&&c.setStyle(`aspect-ratio`,`${d}/${f}`,u)})}}},vA=class extends I{_modelElementName;constructor(e,t){super(e),this._modelElementName=t}refresh(){let e=this.editor,t=e.model,n=t.schema,r=e.plugins.get(`ImageUtils`),i=r.getClosestSelectedImageElement(t.document.selection);if(!(this._modelElementName===`imageBlock`?r.isInlineImage(i):r.isBlockImage(i))){this.isEnabled=!1;return}let a=t.createPositionBefore(i);this.isEnabled=Vk(n,a,this._modelElementName)}execute(e={}){let t=this.editor,n=this.editor.model,r=t.plugins.get(`ImageUtils`),i=r.getClosestSelectedImageElement(n.document.selection),a=Object.fromEntries(i.getAttributes());return!a.src&&!a.uploadId?null:n.change(t=>{let{setImageSizes:o=!0}=e,s=Array.from(n.markers).filter(e=>e.getRange().containsItem(i)),c=r.insertImage(a,n.createSelection(i,`on`),this._modelElementName,{setImageSizes:o});if(!c)return null;let l=t.createRangeOn(c);for(let e of s){let n=e.getRange(),r=n.root.rootName==`$graveyard`?l:n.getJoined(l,!0);t.updateMarker(e,{range:r})}return{oldElement:i,newElement:c}})}},yA=class extends F{static get requires(){return[Kk]}static get pluginName(){return`ImagePlaceholder`}static get isOfficialPlugin(){return!0}afterInit(){this._setupSchema(),this._setupConversion(),this._setupLoadListener()}_setupSchema(){let e=this.editor.model.schema;e.isRegistered(`imageBlock`)&&e.extend(`imageBlock`,{allowAttributes:[`placeholder`]}),e.isRegistered(`imageInline`)&&e.extend(`imageInline`,{allowAttributes:[`placeholder`]})}_setupConversion(){let e=this.editor,t=e.conversion,n=e.plugins.get(`ImageUtils`);t.for(`editingDowncast`).add(e=>{e.on(`attribute:placeholder`,(e,t,r)=>{if(!r.consumable.test(t.item,e.name)||!t.item.is(`element`,`imageBlock`)&&!t.item.is(`element`,`imageInline`))return;r.consumable.consume(t.item,e.name);let i=r.writer,a=r.mapper.toViewElement(t.item),o=n.findViewImgElement(a);t.attributeNewValue?(i.addClass(`image_placeholder`,o),i.setStyle(`background-image`,`url(${t.attributeNewValue})`,o),i.setCustomProperty(`editingPipeline:doNotReuseOnce`,!0,o)):(i.removeClass(`image_placeholder`,o),i.removeStyle(`background-image`,o))})})}_setupLoadListener(){let e=this.editor,t=e.model,n=e.editing,r=n.view,i=e.plugins.get(`ImageUtils`);r.addObserver(pA),this.listenTo(r.document,`imageLoaded`,(e,a)=>{let o=r.domConverter.mapDomToView(a.target);if(!o)return;let s=i.getImageWidgetFromImageView(o);if(!s)return;let c=n.mapper.toModelElement(s);!c||!c.hasAttribute(`placeholder`)||t.enqueueChange({isUndoable:!1},e=>{e.removeAttribute(`placeholder`,c)})})}},bA=class extends F{static get requires(){return[gA,_A,Kk,yA,_O]}static get pluginName(){return`ImageBlockEditing`}static get isOfficialPlugin(){return!0}init(){let 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 vA(this.editor,`imageBlock`)),this._setupClipboardIntegration())}_setupConversion(){let e=this.editor,t=e.t,n=e.conversion,r=e.plugins.get(`ImageUtils`);n.for(`dataDowncast`).elementToStructure({model:`imageBlock`,view:(e,{writer:t})=>Rk(t)}),n.for(`editingDowncast`).elementToStructure({model:`imageBlock`,view:(e,{writer:n})=>r.toImageWidget(Rk(n),n,t(`image widget`))}),n.for(`downcast`).add(fA(r,`imageBlock`,`src`)).add(fA(r,`imageBlock`,`alt`)).add(uA(r,`imageBlock`)),n.for(`upcast`).add(cA(`imageBlock`,r)).add(sA(r))}_setupClipboardIntegration(){let e=this.editor,t=e.model,n=e.editing.view,r=e.plugins.get(`ImageUtils`),i=e.plugins.get(`ClipboardPipeline`);this.listenTo(i,`inputTransformation`,(i,a)=>{let o=Array.from(a.content.getChildren()),s;if(!o.every(r.isInlineImageView))return;s=a.targetRanges?e.editing.mapper.toModelRange(a.targetRanges[0]):t.document.selection.getFirstRange();let c=t.createSelection(s),l=c.getFirstPosition();if(l&&Vk(t.schema,l,`imageBlock`)&&Hk(t.schema,c)===`imageBlock`){let e=new Np(n.document),t=o.map(t=>e.createElement(`figure`,{class:`image`},t));a.content=e.createDocumentFragment(t)}}),this.listenTo(i,`contentInsertion`,(e,n)=>{n.method===`paste`&&t.change(e=>{let t=e.createRangeIn(n.content);for(let e of t.getItems())e.is(`element`,`imageBlock`)&&r.setImageNaturalSizeAttributes(e)})})}},xA=class extends P{focusTracker;keystrokes;_focusables;_focusCycler;children;constructor(e,t=[]){super(e),this.focusTracker=new M,this.keystrokes=new N,this._focusables=new pa,this.children=this.createCollection(),this._focusCycler=new Hy({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:`shift + tab`,focusNext:`tab`}});for(let e of t)this.children.add(e),this._focusables.add(e),e instanceof xb&&this._focusables.addMany(e.children);this.setTemplate({tag:`form`,attributes:{class:[`ck`,`ck-image-insert-form`],tabindex:-1},children:this.children})}render(){super.render(),Qa({view:this});for(let e of this._focusables)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element);let 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()}},SA=class extends F{static get pluginName(){return`ImageInsertUI`}static get isOfficialPlugin(){return!0}static get requires(){return[Kk]}dropdownView;_integrations=new Map;constructor(e){super(e),e.config.define(`image.insert.integrations`,[`upload`,`assetManager`,`url`])}init(){let e=this.editor,t=e.model.document.selection,n=e.plugins.get(`ImageUtils`);this.set(`isImageSelected`,!1),this.listenTo(e.model.document,`change`,()=>{this.isImageSelected=n.isImage(t.getSelectedElement())});let r=e=>this._createToolbarComponent(e);e.ui.componentFactory.add(`insertImage`,r),e.ui.componentFactory.add(`imageInsert`,r),e.ui.componentFactory.add(`menuBar:insertImage`,e=>this._createMenuBarComponent(e))}registerIntegration({name:e,observable:t,buttonViewCreator:n,formViewCreator:r,menuBarButtonViewCreator:i,requiresForm:a=!1,override:o=!1}){this._integrations.has(e)&&!o&&T(`image-insert-integration-exists`,{name:e}),this._integrations.set(e,{observable:t,buttonViewCreator:n,menuBarButtonViewCreator:i,formViewCreator:r,requiresForm:a})}_createToolbarComponent(e){let t=this.editor,n=e.t,r=this._prepareIntegrations();if(!r.length)return null;let i,a=r[0];if(r.length==1){if(!a.requiresForm)return a.buttonViewCreator(!0);i=a.buttonViewCreator(!0)}else i=new Mx(e,a.buttonViewCreator(!1)),i.tooltip=!0,i.bind(`label`).to(this,`isImageSelected`,e=>n(e?`Replace image`:`Insert image`));let o=this.dropdownView=Nx(e,i),s=r.map(({observable:e})=>typeof e==`function`?e():e);return o.bind(`isEnabled`).toMany(s,`isEnabled`,(...e)=>e.some(e=>e)),o.once(`change:isOpen`,()=>{let e=r.flatMap(({formViewCreator:e})=>e(r.length==1)),n=new xA(t.locale,e);o.panelView.children.add(n)}),o}_createMenuBarComponent(e){let t=e.t,n=this._prepareIntegrations();if(!n.length)return null;let r=n.flatMap(({menuBarButtonViewCreator:e})=>e(n.length==1)),i=new uw(e),a=new dw(e);i.panelView.children.add(a),i.buttonView.set({icon:B_,label:t(`Image`)});for(let t of r){let n=new rC(e,i);n.children.add(t),a.items.add(n),t.delegate(`execute`).to(i)}return i}_prepareIntegrations(){let e=this.editor.config.get(`image.insert.integrations`),t=[];if(!e.length)return T(`image-insert-integrations-not-specified`),t;for(let n of e){if(!this._integrations.has(n)){[`upload`,`assetManager`,`url`].includes(n)||T(`image-insert-unknown-integration`,{item:n});continue}t.push(this._integrations.get(n))}return t.length||T(`image-insert-integrations-not-registered`),t}},CA=class extends F{static get requires(){return[bA,xD,oA,SA]}static get pluginName(){return`ImageBlock`}static get isOfficialPlugin(){return!0}},wA=class extends F{static get requires(){return[gA,_A,Kk,yA,_O]}static get pluginName(){return`ImageInlineEditing`}static get isOfficialPlugin(){return!0}init(){let 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 vA(this.editor,`imageInline`)),this._setupClipboardIntegration())}_setupConversion(){let e=this.editor,t=e.t,n=e.conversion,r=e.plugins.get(`ImageUtils`);n.for(`dataDowncast`).elementToElement({model:`imageInline`,view:(e,{writer:t})=>t.createEmptyElement(`img`)}),n.for(`editingDowncast`).elementToStructure({model:`imageInline`,view:(e,{writer:n})=>r.toImageWidget(Lk(n),n,t(`image widget`))}),n.for(`downcast`).add(fA(r,`imageInline`,`src`)).add(fA(r,`imageInline`,`alt`)).add(uA(r,`imageInline`)),n.for(`upcast`).add(cA(`imageInline`,r))}_setupClipboardIntegration(){let e=this.editor,t=e.model,n=e.editing.view,r=e.plugins.get(`ImageUtils`),i=e.plugins.get(`ClipboardPipeline`);this.listenTo(i,`inputTransformation`,(i,a)=>{let o=Array.from(a.content.getChildren()),s;if(!o.every(r.isBlockImageView))return;s=a.targetRanges?e.editing.mapper.toModelRange(a.targetRanges[0]):t.document.selection.getFirstRange();let c=t.createSelection(s),l=c.getFirstPosition();if(!(l&&Vk(t.schema,l,`imageBlock`))||Hk(t.schema,c)===`imageInline`){let e=new Np(n.document),t=o.map(t=>t.childCount===1?(Array.from(t.getAttributes()).forEach(n=>e.setAttribute(...n,r.findViewImgElement(t))),t.getChild(0)):t);a.content=e.createDocumentFragment(t)}}),this.listenTo(i,`contentInsertion`,(e,n)=>{n.method===`paste`&&t.change(e=>{let t=e.createRangeIn(n.content);for(let e of t.getItems())e.is(`element`,`imageInline`)&&r.setImageNaturalSizeAttributes(e)})})}},TA=class extends F{static get requires(){return[wA,xD,oA,SA]}static get pluginName(){return`ImageInline`}static get isOfficialPlugin(){return!0}},EA=class extends F{static get requires(){return[CA,TA]}static get pluginName(){return`Image`}static get isOfficialPlugin(){return!0}},DA=class extends F{static get pluginName(){return`ImageCaptionUtils`}static get isOfficialPlugin(){return!0}static get requires(){return[Kk]}getCaptionFromImageModelElement(e){for(let t of e.getChildren())if(t&&t.is(`element`,`caption`))return t;return null}getCaptionFromModelSelection(e){let t=this.editor.plugins.get(`ImageUtils`),n=e.getFirstPosition().findAncestor(`caption`);return n&&t.isBlockImage(n.parent)?n:null}matchImageCaptionViewElement(e){let t=this.editor.plugins.get(`ImageUtils`);return e.name==`figcaption`&&t.isBlockImageView(e.parent)?{name:!0}:null}},OA=class extends I{refresh(){let e=this.editor,t=e.plugins.get(`ImageCaptionUtils`),n=e.plugins.get(`ImageUtils`);if(!e.plugins.has(bA)){this.isEnabled=!1,this.value=!1;return}let r=e.model.document.selection,i=r.getSelectedElement();if(!i){let e=t.getCaptionFromModelSelection(r);this.isEnabled=!!e,this.value=!!e;return}if(this.isEnabled=n.isImage(i),this.isEnabled&&n.isInlineImage(i)){let t=e.model.createPositionBefore(i);this.isEnabled=Vk(e.model.schema,t,`imageBlock`)}this.isEnabled?this.value=!!t.getCaptionFromImageModelElement(i):this.value=!1}execute(e={}){let{focusCaptionOnShow:t}=e;this.editor.model.change(e=>{this.value?this._hideImageCaption(e):this._showImageCaption(e,t)})}_showImageCaption(e,t){let n=this.editor.model.document.selection,r=this.editor.plugins.get(`ImageCaptionEditing`),i=this.editor.plugins.get(`ImageUtils`),a=n.getSelectedElement(),o=r._getSavedCaption(a);i.isInlineImage(a)&&(this.editor.execute(`imageTypeBlock`),a=n.getSelectedElement());let s=o||e.createElement(`caption`);e.append(s,a),t&&e.setSelection(s,`in`)}_hideImageCaption(e){let t=this.editor,n=t.model.document.selection,r=t.plugins.get(`ImageCaptionEditing`),i=t.plugins.get(`ImageCaptionUtils`),a=n.getSelectedElement(),o;a?o=i.getCaptionFromImageModelElement(a):(o=i.getCaptionFromModelSelection(n),a=o.parent),r._saveCaption(a,o),e.setSelection(a,`on`),e.remove(o)}},kA=class extends F{static get requires(){return[Kk,DA]}static get pluginName(){return`ImageCaptionEditing`}static get isOfficialPlugin(){return!0}_savedCaptionsMap;constructor(e){super(e),this._savedCaptionsMap=new WeakMap}init(){let e=this.editor,t=e.model.schema;t.isRegistered(`caption`)?t.extend(`caption`,{allowIn:`imageBlock`}):t.register(`caption`,{allowIn:`imageBlock`,allowContentOf:`$block`,isLimit:!0}),e.commands.add(`toggleImageCaption`,new OA(this.editor)),this._setupConversion(),this._setupImageTypeCommandsIntegration(),this._registerCaptionReconversion()}_setupConversion(){let e=this.editor,t=e.editing.view,n=e.plugins.get(`ImageUtils`),r=e.plugins.get(`ImageCaptionUtils`),i=e.t;e.conversion.for(`upcast`).elementToElement({view:e=>r.matchImageCaptionViewElement(e),model:`caption`}),e.conversion.for(`dataDowncast`).elementToElement({model:`caption`,view:(e,{writer:t})=>n.isBlockImage(e.parent)?t.createContainerElement(`figcaption`):null}),e.conversion.for(`editingDowncast`).elementToElement({model:`caption`,view:(e,{writer:r})=>{if(!n.isBlockImage(e.parent))return null;let a=r.createEditableElement(`figcaption`);r.setCustomProperty(`imageCaption`,!0,a),a.placeholder=i(`Enter image caption`),yo({view:t,element:a,keepOnFocus:!0});let o=e.parent.getAttribute(`alt`);return YE(a,r,{label:o?i(`Caption for image: %0`,[o]):i(`Caption for the image`)})}})}_setupImageTypeCommandsIntegration(){let e=this.editor,t=e.plugins.get(`ImageUtils`),n=e.plugins.get(`ImageCaptionUtils`),r=e.commands.get(`imageTypeInline`),i=e.commands.get(`imageTypeBlock`),a=e=>{if(!e.return)return;let{oldElement:r,newElement:i}=e.return;if(!r)return;if(t.isBlockImage(r)){let e=n.getCaptionFromImageModelElement(r);if(e){this._saveCaption(i,e);return}}let a=this._getSavedCaption(r);a&&this._saveCaption(i,a)};r&&this.listenTo(r,`execute`,a,{priority:`low`}),i&&this.listenTo(i,`execute`,a,{priority:`low`})}_getSavedCaption(e){let t=this._savedCaptionsMap.get(e);return t?Ml.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON())}_registerCaptionReconversion(){let e=this.editor,t=e.model,n=e.plugins.get(`ImageUtils`),r=e.plugins.get(`ImageCaptionUtils`);t.document.on(`change:data`,()=>{let i=t.document.differ.getChanges();for(let t of i){if(t.attributeKey!==`alt`)continue;let i=t.range.start.nodeAfter;if(n.isBlockImage(i)){let t=r.getCaptionFromImageModelElement(i);if(!t)return;e.editing.reconvertItem(t)}}})}},AA=class extends F{static get requires(){return[DA]}static get pluginName(){return`ImageCaptionUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.editing.view,n=e.plugins.get(`ImageCaptionUtils`),r=e.t;e.ui.componentFactory.add(`toggleImageCaption`,i=>{let a=e.commands.get(`toggleImageCaption`),o=new H(i);return o.set({icon:c_,tooltip:!0,isToggleable:!0}),o.bind(`isOn`,`isEnabled`).to(a,`value`,`isEnabled`),o.bind(`label`).to(a,`value`,e=>r(e?`Toggle caption off`:`Toggle caption on`)),this.listenTo(o,`execute`,()=>{e.execute(`toggleImageCaption`,{focusCaptionOnShow:!0});let r=n.getCaptionFromModelSelection(e.model.document.selection);if(r){let n=e.editing.mapper.toViewElement(r);t.scrollToTheSelection(),t.change(e=>{e.addClass(`image__caption_highlighted`,n)})}e.editing.view.focus()}),o})}},jA=class extends F{static get requires(){return[kA,AA]}static get pluginName(){return`ImageCaption`}static get isOfficialPlugin(){return!0}};function MA(e){let t=e.map(e=>e.replace(`+`,`\\+`));return RegExp(`^image\\/(${t.join(`|`)})$`)}function NA(e){return new Promise((t,n)=>{let r=e.getAttribute(`src`);fetch(r).then(e=>e.blob()).then(e=>{let n=FA(e,r),i=`image.${n.replace(`image/`,``)}`;t(new File([e],i,{type:n}))}).catch(e=>e&&e.name===`TypeError`?IA(r).then(t).catch(n):n(e))})}function PA(e,t){return!e.isInlineImageView(t)||!t.getAttribute(`src`)?!1:!!t.getAttribute(`src`).match(/^data:image\/\w+;base64,/g)||!!t.getAttribute(`src`).match(/^blob:/g)}function FA(e,t){return e.type?e.type:t.match(/data:(image\/\w+);base64/)?t.match(/data:(image\/\w+);base64/)[1].toLowerCase():`image/jpeg`}function IA(e){return LA(e).then(t=>{let n=FA(t,e),r=`image.${n.replace(`image/`,``)}`;return new File([t],r,{type:n})})}function LA(e){return new Promise((t,n)=>{let r=u.document.createElement(`img`);r.addEventListener(`load`,()=>{let e=u.document.createElement(`canvas`);e.width=r.width,e.height=r.height,e.getContext(`2d`).drawImage(r,0,0),e.toBlob(e=>e?t(e):n())}),r.addEventListener(`error`,()=>n()),r.src=e})}var RA=class extends F{static get pluginName(){return`ImageUploadUI`}static get isOfficialPlugin(){return!0}init(){let 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){let t=this.editor,n=t.locale,r=t.commands.get(`uploadImage`),i=t.config.get(`image.upload.types`),a=MA(i),o=new e(t.locale),s=n.t;return o.set({acceptedType:i.map(e=>`image/${e}`).join(`,`),allowMultipleFiles:!0,label:s(`Upload from computer`),icon:V_}),o.bind(`isEnabled`).to(r),o.on(`done`,(e,n)=>{let r=Array.from(n).filter(e=>a.test(e.type));r.length&&(t.execute(`uploadImage`,{file:r}),t.editing.view.focus())}),o}_createToolbarButton(){let e=this.editor.locale.t,t=this.editor.plugins.get(`ImageInsertUI`),n=this.editor.commands.get(`uploadImage`),r=this._createButton(_b);return r.tooltip=!0,r.bind(`label`).to(t,`isImageSelected`,n,`isAccessAllowed`,(t,n)=>e(n?t?`Replace image from computer`:`Upload image from computer`:`You have no image upload permissions.`)),r}_createDropdownButton(){let e=this.editor.locale.t,t=this.editor.plugins.get(`ImageInsertUI`),n=this._createButton(_b);return n.withText=!0,n.bind(`label`).to(t,`isImageSelected`,t=>e(t?`Replace from computer`:`Upload from computer`)),n.on(`execute`,()=>{t.dropdownView.isOpen=!1}),n}_createMenuBarButton(e){let t=this.editor.locale.t,n=this._createButton(mw);switch(n.withText=!0,e){case`standalone`:n.label=t(`Image from computer`);break;case`insertOnly`:n.label=t(`Image`);break;case`insertNested`:n.label=t(`From computer`);break}return n}},zA=class extends F{static get pluginName(){return`ImageUploadProgress`}static get isOfficialPlugin(){return!0}placeholder;constructor(e){super(e),this.placeholder=`data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==`}init(){let 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,n)=>{let r=this.editor,i=t.item,a=i.getAttribute(`uploadId`);if(!n.consumable.consume(t.item,e.name))return;let o=r.plugins.get(`ImageUtils`),s=r.plugins.get(bw),c=a?t.attributeNewValue:null,l=this.placeholder,u=r.editing.mapper.toViewElement(i),d=n.writer;if(c==`reading`){BA(u,d),HA(o,l,u,d);return}if(c==`uploading`){let e=s.loaders.get(a);BA(u,d),e?(UA(u,d),WA(u,d,e,r.editing.view),ZA(o,u,d,e)):HA(o,l,u,d);return}c==`complete`&&s.loaders.get(a)&&KA(u,d,r.editing.view),GA(u,d),UA(u,d),VA(u,d)}};function BA(e,t){e.hasClass(`ck-appear`)||t.addClass(`ck-appear`,e)}function VA(e,t){t.removeClass(`ck-appear`,e)}function HA(e,t,n,r){n.hasClass(`ck-image-upload-placeholder`)||r.addClass(`ck-image-upload-placeholder`,n);let i=e.findViewImgElement(n);i.getAttribute(`src`)!==t&&r.setAttribute(`src`,t,i),YA(n,`placeholder`)||r.insert(r.createPositionAfter(i),JA(r))}function UA(e,t){e.hasClass(`ck-image-upload-placeholder`)&&t.removeClass(`ck-image-upload-placeholder`,e),XA(e,t,`placeholder`)}function WA(e,t,n,r){let i=qA(t);t.insert(t.createPositionAt(e,`end`),i),n.on(`change:uploadedPercent`,(e,t,n)=>{r.change(e=>{e.setStyle(`width`,n+`%`,i)})})}function GA(e,t){XA(e,t,`progressBar`)}function KA(e,t,n){let r=t.createUIElement(`div`,{class:`ck-image-upload-complete-icon`});t.insert(t.createPositionAt(e,`end`),r),setTimeout(()=>{n.change(e=>e.remove(e.createRangeOn(r)))},3e3)}function qA(e){let t=e.createUIElement(`div`,{class:`ck-progress-bar`});return e.setCustomProperty(`progressBar`,!0,t),t}function JA(e){let t=e.createUIElement(`div`,{class:`ck-upload-placeholder-loader`});return e.setCustomProperty(`placeholder`,!0,t),t}function YA(e,t){for(let n of e.getChildren())if(n.getCustomProperty(t))return n}function XA(e,t,n){let r=YA(e,n);r&&t.remove(t.createRangeOn(r))}function ZA(e,t,n,r){if(r.data){let i=e.findViewImgElement(t);n.setAttribute(`src`,r.data,i)}}var QA=class extends I{constructor(e){super(e),this.set(`isAccessAllowed`,!0)}refresh(){let e=this.editor,t=e.plugins.get(`ImageUtils`),n=e.model.document.selection.getSelectedElement();this.isEnabled=t.isImageAllowed()||t.isImage(n)}execute(e){let t=A(e.file),n=this.editor.model.document.selection,r=this.editor.plugins.get(`ImageUtils`),i=Object.fromEntries(n.getAttributes());t.forEach((e,t)=>{let a=n.getSelectedElement();if(t&&a&&r.isImage(a)){let t=this.editor.model.createPositionAfter(a);this._uploadImage(e,i,t)}else this._uploadImage(e,i)})}_uploadImage(e,t,n){let r=this.editor,i=r.plugins.get(bw).createLoader(e),a=r.plugins.get(`ImageUtils`);i&&a.insertImage({...t,uploadId:i.id},n)}},$A=class extends F{static get requires(){return[bw,IC,_O,Kk]}static get pluginName(){return`ImageUploadEditing`}static get isOfficialPlugin(){return!0}_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(){let e=this.editor,t=e.model.document,n=e.conversion,r=e.plugins.get(bw),i=e.plugins.get(`ImageUtils`),a=e.plugins.get(`ClipboardPipeline`),o=MA(e.config.get(`image.upload.types`)),s=new QA(e);e.commands.add(`uploadImage`,s),e.commands.add(`imageUpload`,s),n.for(`upcast`).attributeToAttribute({view:{name:`img`,key:`uploadId`},model:`uploadId`}).add(e=>e.on(`element:img`,(e,t,n)=>{if(!n.consumable.test(t.viewItem,{attributes:[`data-ck-upload-id`]}))return;let i=t.viewItem.getAttribute(`data-ck-upload-id`);if(!i||!t.modelRange)return;let[a]=Array.from(t.modelRange.getItems({shallow:!0})),o=r.loaders.get(i);a&&(n.writer.setAttribute(`uploadId`,i,a),n.consumable.consume(t.viewItem,{attributes:[`data-ck-upload-id`]}),o&&o.data&&n.writer.setAttribute(`uploadStatus`,o.status,a))},{priority:`low`})),this.listenTo(e.editing.view.document,`clipboardInput`,(t,n)=>{if(ej(n.dataTransfer))return;let r=Array.from(n.dataTransfer.files).filter(e=>e?o.test(e.type):!1);if(r.length&&(t.stop(),e.model.change(t=>{n.targetRanges&&t.setSelection(n.targetRanges.map(t=>e.editing.mapper.toModelRange(t))),e.execute(`uploadImage`,{file:r})}),!e.commands.get(`uploadImage`).isAccessAllowed)){let t=e.plugins.get(`Notification`),n=e.locale.t;t.showWarning(n(`You have no image upload permissions.`),{namespace:`image`})}}),this.listenTo(a,`inputTransformation`,(t,n)=>{let a=Array.from(e.editing.view.createRangeIn(n.content)).map(e=>e.item).filter(e=>PA(i,e)&&!e.getAttribute(`uploadProcessed`)).map(e=>({promise:NA(e),imageElement:e}));if(!a.length)return;let o=new Np(e.editing.view.document);for(let e of a){o.setAttribute(`uploadProcessed`,!0,e.imageElement);let t=r.createLoader(e.promise);t&&(o.setAttribute(`src`,``,e.imageElement),o.setAttribute(`uploadId`,t.id,e.imageElement))}}),e.editing.view.document.on(`dragover`,(e,t)=>{t.preventDefault()}),t.on(`change`,()=>{let n=t.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),i=new Set;for(let t of n)if(t.type==`insert`&&t.name!=`$text`){let n=t.position.nodeAfter,a=t.position.root.rootName==`$graveyard`;for(let t of tj(e,n)){let n=t.getAttribute(`uploadId`),o=t.getAttribute(`uploadStatus`);if(!n||o==`complete`)continue;let s=r.loaders.get(n);if(!s){!a&&this._uploadedImages.has(n)&&e.model.enqueueChange({isUndoable:!1},e=>{e.setAttribute(`uploadStatus`,`complete`,t),this.fire(`uploadComplete`,{data:this._uploadedImages.get(n),imageElement:t})});continue}a?i.has(n)||Array.from(this._uploadImageElements.get(n)).every(e=>e.root.rootName==`$graveyard`)&&s.abort():(i.add(n),this._uploadImageElements.has(n)?this._uploadImageElements.get(n).add(t):this._uploadImageElements.set(n,new Set([t])),s.status==`idle`&&this._readAndUpload(s))}}}),this.on(`uploadComplete`,(e,{imageElement:t,data:n})=>{let r=n.urls?n.urls:n;this.editor.model.change(e=>{e.setAttribute(`src`,r.default,t),this._parseAndSetSrcsetAttributeOnImage(r,t,e),i.setImageNaturalSizeAttributes(t)})},{priority:`low`})}afterInit(){let 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){let t=this.editor,n=t.model,r=t.locale.t,i=t.plugins.get(bw),a=t.plugins.get(IC),o=t.plugins.get(`ImageUtils`),s=this._uploadImageElements;return n.enqueueChange({isUndoable:!1},t=>{let n=s.get(e.id);for(let e of n)t.setAttribute(`uploadStatus`,`reading`,e)}),e.read().then(()=>{let i=e.upload();t.ui&&t.ui.ariaLiveAnnouncer.announce(r(`Uploading image`));for(let r of s.get(e.id)){if(p.isSafari){let e=t.editing.mapper.toViewElement(r),n=o.findViewImgElement(e);t.editing.view.once(`render`,()=>{if(!n.parent)return;let e=t.editing.view.domConverter.mapViewToDom(n.parent);if(!e)return;let r=e.style.display;e.style.display=`none`,e._ckHack=e.offsetHeight,e.style.display=r})}n.enqueueChange({isUndoable:!1},e=>{e.setAttribute(`uploadStatus`,`uploading`,r)})}return i}).then(i=>{n.enqueueChange({isUndoable:!1},n=>{for(let t of s.get(e.id))n.setAttribute(`uploadStatus`,`complete`,t),this.fire(`uploadComplete`,{data:i,imageElement:t});t.ui&&t.ui.ariaLiveAnnouncer.announce(r(`Image upload complete`)),this._uploadedImages.set(e.id,i)}),c()}).catch(i=>{if(t.ui&&t.ui.ariaLiveAnnouncer.announce(r(`Error during image upload`)),e.status!==`error`&&e.status!==`aborted`)throw i;e.status==`error`&&i&&a.showWarning(i,{title:r(`Upload failed`),namespace:`upload`}),n.enqueueChange({isUndoable:!1},t=>{for(let n of s.get(e.id))n.root.rootName!==`$graveyard`&&t.remove(n)}),c()});function c(){n.enqueueChange({isUndoable:!1},t=>{for(let n of s.get(e.id))t.removeAttribute(`uploadId`,n),t.removeAttribute(`uploadStatus`,n);s.delete(e.id)}),i.destroyLoader(e)}}_parseAndSetSrcsetAttributeOnImage(e,t,n){let r=0,i=Object.keys(e).filter(e=>{let t=parseInt(e,10);if(!isNaN(t))return r=Math.max(r,t),!0}).map(t=>`${e[t]} ${t}w`).join(`, `);if(i!=``){let e={srcset:i};!t.hasAttribute(`width`)&&!t.hasAttribute(`height`)&&(e.width=r),n.setAttributes(e,t)}}_registerConverters(e){let{conversion:t,plugins:n}=this.editor,r=n.get(bw),i=n.get(Kk);t.for(`dataDowncast`).add(t=>{t.on(`attribute:uploadId:${e}`,(e,t,n)=>{if(!n.consumable.test(t.item,e.name))return;let a=r.loaders.get(t.attributeNewValue);if(!a||!a.data)return null;let o=n.mapper.toViewElement(t.item),s=i.findViewImgElement(o);s&&(n.consumable.consume(t.item,e.name),n.writer.setAttribute(`data-ck-upload-id`,a.id,s))})})}};function ej(e){return Array.from(e.types).includes(`text/html`)&&e.getData(`text/html`)!==``}function tj(e,t){let n=e.plugins.get(`ImageUtils`);return Array.from(e.model.createRangeOn(t)).filter(e=>n.isImage(e.item)).map(e=>e.item)}var nj=class extends F{static get pluginName(){return`ImageUpload`}static get isOfficialPlugin(){return!0}static get requires(){return[$A,RA,zA]}},rj=class extends P{urlInputView;keystrokes;constructor(e){super(e),this.set(`imageURLInputValue`,``),this.set(`isImageSelected`,!1),this.set(`isEnabled`,!0),this.keystrokes=new N,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(),Qa({view:this}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.keystrokes.destroy()}_createUrlInputView(){let e=this.locale,t=e.t,n=new Qb(e,Jx);return n.bind(`label`).to(this,`isImageSelected`,e=>t(e?`Update image URL`:`Insert image via URL`)),n.bind(`isEnabled`).to(this),n.fieldView.inputMode=`url`,n.fieldView.placeholder=`https://example.com/image.png`,n.fieldView.bind(`value`).to(this,`imageURLInputValue`,e=>e||``),n.fieldView.on(`input`,()=>{this.imageURLInputValue=n.fieldView.element.value.trim()}),n}focus(){this.urlInputView.focus()}},ij=class extends F{_imageInsertUI;_formView;static get pluginName(){return`ImageInsertViaUrlUI`}static get isOfficialPlugin(){return!0}static get requires(){return[SA,Qy]}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){let t=new e(this.editor.locale);return t.icon=H_,t.on(`execute`,()=>{this._showModal()}),t}_createToolbarButton(){let e=this.editor.locale.t,t=this._createInsertUrlButton(H);return t.tooltip=!0,t.bind(`label`).to(this._imageInsertUI,`isImageSelected`,t=>e(t?`Update image URL`:`Insert image via URL`)),t}_createDropdownButton(){let e=this.editor.locale.t,t=this._createInsertUrlButton(H);return t.withText=!0,t.bind(`label`).to(this._imageInsertUI,`isImageSelected`,t=>e(t?`Update image URL`:`Insert via URL`)),t}_createMenuBarButton(e){let t=this.editor.locale.t,n=this._createInsertUrlButton(U);switch(n.withText=!0,e){case`standalone`:n.label=t(`Image via URL`);break;case`insertOnly`:n.label=t(`Image`);break;case`insertNested`:n.label=t(`Via URL`);break}return n}_createInsertUrlView(){let e=this.editor,t=e.locale,n=e.commands.get(`replaceImageSource`),r=e.commands.get(`insertImage`),i=new rj(t);return i.bind(`isImageSelected`).to(this._imageInsertUI),i.bind(`isEnabled`).toMany([r,n],`isEnabled`,(...e)=>e.some(e=>e)),i}_showModal(){let e=this.editor,t=e.locale.t,n=e.plugins.get(`Dialog`);this._formView||(this._formView=this._createInsertUrlView(),this._formView.on(`submit`,()=>this._handleSave()));let r=e.commands.get(`replaceImageSource`);this._formView.imageURLInputValue=r.value||``,n.show({id:`insertImageViaUrl`,title:t(`Image via URL`),isModal:!0,content:this._formView,actionButtons:[{label:t(`Cancel`),withText:!0,onExecute:()=>n.hide()},{label:this._imageInsertUI.isImageSelected?t(`Save`):t(`Insert`),class:`ck-button-action`,withText:!0,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()}},aj=class extends F{static get pluginName(){return`ImageInsertViaUrl`}static get isOfficialPlugin(){return!0}static get requires(){return[ij,SA]}},oj=class extends F{static get pluginName(){return`ImageInsert`}static get isOfficialPlugin(){return!0}static get requires(){return[nj,aj,SA]}},sj=class extends I{refresh(){let e=this.editor,t=e.plugins.get(`ImageUtils`).getClosestSelectedImageElement(e.model.document.selection);this.isEnabled=!!t,!t||!t.hasAttribute(`resizedWidth`)?this.value=null:this.value={width:t.getAttribute(`resizedWidth`),height:null}}execute(e){let t=this.editor,n=t.model,r=t.plugins.get(`ImageUtils`),i=r.getClosestSelectedImageElement(n.document.selection);this.value={width:e.width,height:null},i&&n.change(t=>{t.setAttribute(`resizedWidth`,e.width,i),t.removeAttribute(`resizedHeight`,i),r.setImageNaturalSizeAttributes(i)})}},cj=class extends F{static get requires(){return[Kk]}static get pluginName(){return`ImageResizeEditing`}static get licenseFeatureCode(){return`IR`}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}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(){let e=this.editor,t=new sj(e);this._registerConverters(`imageBlock`),this._registerConverters(`imageInline`),e.commands.add(`resizeImage`,t),e.commands.add(`imageResize`,t)}afterInit(){this._registerSchema()}_registerSchema(){let e=this.editor.model.schema;this.editor.plugins.has(`ImageBlockEditing`)&&(e.extend(`imageBlock`,{allowAttributes:[`resizedWidth`,`resizedHeight`]}),e.setAttributeProperties(`resizedWidth`,{isFormatting:!0}),e.setAttributeProperties(`resizedHeight`,{isFormatting:!0})),this.editor.plugins.has(`ImageInlineEditing`)&&(e.extend(`imageInline`,{allowAttributes:[`resizedWidth`,`resizedHeight`]}),e.setAttributeProperties(`resizedWidth`,{isFormatting:!0}),e.setAttributeProperties(`resizedHeight`,{isFormatting:!0}))}_registerConverters(e){let t=this.editor,n=t.plugins.get(`ImageUtils`);t.conversion.for(`downcast`).add(t=>t.on(`attribute:resizedWidth:${e}`,(e,t,n)=>{if(!n.consumable.consume(t.item,e.name))return;let r=n.writer,i=n.mapper.toViewElement(t.item);t.attributeNewValue===null?(r.removeStyle(`width`,i),r.removeClass(`image_resized`,i)):(r.setStyle(`width`,t.attributeNewValue,i),r.addClass(`image_resized`,i))})),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,r,i)=>{if(!i.consumable.consume(r.item,t.name))return;let a=i.writer,o=i.mapper.toViewElement(r.item),s=e===`imageInline`?n.findViewImgElement(o):o;r.attributeNewValue===null?a.removeStyle(`height`,s):a.setStyle(`height`,r.attributeNewValue,s)})),t.conversion.for(`upcast`).attributeToAttribute({view:{name:e===`imageBlock`?`figure`:`img`,styles:{width:/.+/}},model:{key:`resizedWidth`,value:e=>Wk(e)?null:e.getStyle(`width`)}}),t.conversion.for(`upcast`).attributeToAttribute({view:{name:e===`imageBlock`?`figure`:`img`,styles:{height:/.+/}},model:{key:`resizedHeight`,value:e=>Wk(e)?null:e.getStyle(`height`)}}),t.conversion.for(`upcast`).add(t=>{t.on(`element:${e===`imageBlock`?`figure`:`img`}`,(e,t,n)=>{n.consumable.consume(t.viewItem,{classes:[`image_resized`]})})})}};const lj={small:Av,medium:kv,large:Ov,custom:Ev,original:Dv};var uj=class extends F{static get requires(){return[cj]}static get pluginName(){return`ImageResizeButtons`}static get isOfficialPlugin(){return!0}_resizeUnit;constructor(e){super(e),this._resizeUnit=e.config.get(`image.resizeUnit`)}init(){let e=this.editor,t=e.config.get(`image.resizeOptions`),n=e.commands.get(`resizeImage`);this.bind(`isEnabled`).to(n);for(let e of t)this._registerImageResizeButton(e);this._registerImageResizeDropdown(t)}_registerImageResizeButton(e){let t=this.editor,{name:n,value:r,icon:i}=e;t.ui.componentFactory.add(n,n=>{let a=new H(n),o=t.commands.get(`resizeImage`),s=this._getOptionLabelValue(e,!0);if(!lj[i])throw new w(`imageresizebuttons-missing-icon`,t,e);if(a.set({label:s,icon:lj[i],tooltip:s,isToggleable:!0}),a.bind(`isEnabled`).to(this),t.plugins.has(`ImageCustomResizeUI`)&&dj(e)){let e=t.plugins.get(`ImageCustomResizeUI`);this.listenTo(a,`execute`,()=>{e._showForm(this._resizeUnit)})}else{let e=r?r+this._resizeUnit:null;a.bind(`isOn`).to(o,`value`,o,`isEnabled`,fj(e)),this.listenTo(a,`execute`,()=>{t.execute(`resizeImage`,{width:e})})}return a})}_registerImageResizeDropdown(e){let t=this.editor,n=t.t,r=e.find(e=>!e.value),i=i=>{let a=t.commands.get(`resizeImage`),o=Nx(i,cx),s=o.buttonView,c=n(`Resize image`);return s.set({tooltip:c,commandValue:r.value,icon:lj.medium,isToggleable:!0,label:this._getOptionLabelValue(r),withText:!0,class:`ck-resize-image-button`,ariaLabel:c,ariaLabelledBy:void 0}),s.bind(`label`).to(a,`value`,e=>e&&e.width?e.width:this._getOptionLabelValue(r)),o.bind(`isEnabled`).to(this),Lx(o,()=>this._getResizeDropdownListItemDefinitions(e,a),{ariaLabel:n(`Image resize list`),role:`menu`}),this.listenTo(o,`execute`,e=>{`onClick`in e.source?e.source.onClick():(t.execute(e.source.commandName,{width:e.source.commandValue}),t.editing.view.focus())}),o};t.ui.componentFactory.add(`resizeImage`,i),t.ui.componentFactory.add(`imageResize`,i)}_getOptionLabelValue(e,t=!1){let n=this.editor.t;return e.label?e.label:t?dj(e)?n(`Custom image size`):e.value?n(`Resize image to %0`,e.value+this._resizeUnit):n(`Resize image to the original size`):dj(e)?n(`Custom`):e.value?e.value+this._resizeUnit:n(`Original`)}_getResizeDropdownListItemDefinitions(e,t){let{editor:n}=this,r=new Fi,i=e.map(e=>dj(e)?{...e,valueWithUnits:`custom`}:e.value?{...e,valueWithUnits:`${e.value}${this._resizeUnit}`}:{...e,valueWithUnits:null});for(let e of i){let a=null;if(n.plugins.has(`ImageCustomResizeUI`)&&dj(e)){let r=n.plugins.get(`ImageCustomResizeUI`);a={type:`button`,model:new RC({label:this._getOptionLabelValue(e),role:`menuitemradio`,withText:!0,icon:null,onClick:()=>{r._showForm(this._resizeUnit)}})};let o=Object.values(i).map(e=>e.valueWithUnits);a.model.bind(`isOn`).to(t,`value`,t,`isEnabled`,pj(o))}else a={type:`button`,model:new RC({commandName:`resizeImage`,commandValue:e.valueWithUnits,label:this._getOptionLabelValue(e),role:`menuitemradio`,withText:!0,icon:null})},a.model.bind(`isOn`).to(t,`value`,t,`isEnabled`,fj(e.valueWithUnits));a.model.bind(`isEnabled`).to(t,`isEnabled`),r.add(a)}return r}};function dj(e){return e.value===`custom`}function fj(e){return(t,n)=>{let r=t;return r===void 0||!n?!1:e===null&&r===e?!0:r!==null&&r.width===e}}function pj(e){return(t,n)=>!e.some(e=>fj(e)(t,n))}const mj=`image_resized`;var hj=class extends F{static get requires(){return[GD,Kk]}static get pluginName(){return`ImageResizeHandles`}static get isOfficialPlugin(){return!0}init(){let e=this.editor.commands.get(`resizeImage`);this.bind(`isEnabled`).to(e),this._setupResizerCreator()}_setupResizerCreator(){let e=this.editor,t=e.editing.view,n=e.plugins.get(`ImageUtils`);t.addObserver(pA),this.listenTo(t.document,`imageLoaded`,(r,i)=>{if(!i.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;let a=e.editing.view.domConverter,o=a.domToView(i.target),s=n.getImageWidgetFromImageView(o),c=this.editor.plugins.get(GD).getResizerByViewElement(s);if(c){c.redraw();return}let l=e.editing.mapper,u=l.toModelElement(s);c=e.plugins.get(GD).attachTo({unit:e.config.get(`image.resizeUnit`),modelElement:u,viewElement:s,editor:e,getHandleHost(e){return e.querySelector(`img`)},getResizeHost(){return a.mapViewToDom(l.toViewElement(u))},isCentered(){return u.getAttribute(`imageStyle`)==`alignCenter`},onCommit(n){t.change(e=>{e.removeClass(mj,s)}),e.execute(`resizeImage`,{width:n})}}),c.on(`updateSize`,()=>{s.hasClass(mj)||t.change(e=>{e.addClass(mj,s)});let e=u.name===`imageInline`?o:s;e.getStyle(`height`)&&t.change(t=>{t.removeStyle(`height`,e)})}),c.bind(`isEnabled`).to(this)})}};function gj(e){let{editing:t}=e,n=e.plugins.get(`ImageUtils`).getClosestSelectedImageElement(e.model.document.selection);if(!n)return null;let r=t.mapper.toViewElement(n);return{model:n,view:r,dom:t.view.domConverter.mapViewToDom(r)}}function _j(e,t){let n=gj(e);if(!n)return null;let r=da(n.model.getAttribute(`resizedWidth`)||null);return r?r.unit===t?r:fa(eD(n.dom),{unit:`px`,value:new O(n.dom).width},t):null}var vj=class extends P{focusTracker;keystrokes;unit;backButtonView;saveButtonView;labeledInput;children;_focusables;_focusCycler;_validators;constructor(e,t,n){super(e),this.focusTracker=new M,this.keystrokes=new N,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 MC(e,{children:[this.labeledInput,this.saveButtonView],class:[`ck-form__row_with-submit`,`ck-form__row_large-top-padding`]})),this._focusables=new pa,this._validators=n,this.keystrokes.set(`Esc`,(e,t)=>{this.fire(`cancel`),t()}),this._focusCycler=new Hy({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(),Qa({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(){let e=this.locale.t,t=new H(this.locale);return t.set({class:`ck-button-back`,label:e(`Back`),icon:Wv,tooltip:!0}),t.delegate(`execute`).to(this,`cancel`),t}_createSaveButton(){let e=this.locale.t,t=new H(this.locale);return t.set({label:e(`Save`),withText:!0,type:`submit`,class:`ck-button-action ck-button-bold`}),t}_createHeaderView(){let e=this.locale.t,t=new By(this.locale,{label:e(`Image Resize`)});return t.children.add(this.backButtonView,0),t}_createLabeledInputView(){let e=this.locale.t,t=new Qb(this.locale,Yx);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(let e of this._validators){let t=e(this);if(t)return this.labeledInput.errorText=t,!1}return!0}resetFormStatus(){this.labeledInput.errorText=null}get rawSize(){let{element:e}=this.labeledInput.fieldView;return e?e.value:null}get parsedSize(){let{rawSize:e}=this;if(e===null)return null;let t=Number.parseFloat(e);return Number.isNaN(t)?null:t}get sizeWithUnits(){let{parsedSize:e,unit:t}=this;return e===null?null:`${e}${t}`}};function yj(e,t){let n=gj(e);if(!n)return null;let r=eD(n.dom),i=da(window.getComputedStyle(n.dom).minWidth)||{value:1,unit:`px`};return{unit:t,lower:Math.max(.1,fa(r,i,t).value),upper:t===`px`?r:100}}var bj=class extends F{_balloon;_form;static get requires(){return[BC]}static get pluginName(){return`ImageCustomResizeUI`}static get isOfficialPlugin(){return!0}destroy(){super.destroy(),this._form&&this._form.destroy()}_createForm(e){let t=this.editor;this._balloon=this.editor.plugins.get(`ContextualBalloon`),this._form=new(Xa(vj))(t.locale,e,xj(t)),this._form.render(),this.listenTo(this._form,`submit`,()=>{this._form.isValid()&&(t.execute(`resizeImage`,{width:this._form.sizeWithUnits}),this._hideForm(!0))}),this.listenTo(this._form.labeledInput,`change:errorText`,()=>{t.ui.update()}),this.listenTo(this._form,`cancel`,()=>{this._hideForm(!0)}),Ya({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);let t=this.editor,n=this._form.labeledInput;this._form.disableCssTransitions(),this._form.resetFormStatus(),this._isInBalloon||this._balloon.add({view:this._form,position:iA(t)});let r=_j(t,e),i=r?r.value.toFixed(1):``,a=yj(t,e);n.fieldView.value=n.fieldView.element.value=i,a&&Object.assign(n.fieldView,{min:a.lower.toFixed(1),max:Math.ceil(a.upper).toFixed(1)}),this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(e=!1){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),e&&this.editor.editing.view.focus())}get _isVisible(){return!!this._balloon&&this._balloon.visibleView===this._form}get _isInBalloon(){return!!this._balloon&&this._balloon.hasView(this._form)}};function xj(e){let t=e.t;return[e=>{if(e.rawSize.trim()===``)return t(`The value must not be empty.`);if(e.parsedSize===null)return t(`The value should be a plain number.`)}]}var Sj=class extends F{static get requires(){return[cj,hj,bj,uj]}static get pluginName(){return`ImageResize`}static get isOfficialPlugin(){return!0}},Cj=class extends I{_defaultStyles;_styles;constructor(e,t){super(e),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(t.map(e=>{if(e.isDefault)for(let t of e.modelElements)this._defaultStyles[t]=e.name;return[e.name,e]}))}refresh(){let e=this.editor.plugins.get(`ImageUtils`).getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!e,this.isEnabled?e.hasAttribute(`imageStyle`)?this.value=e.getAttribute(`imageStyle`):this.value=this._defaultStyles[e.name]:this.value=!1}isStyleEnabled(e){if(!this.isEnabled)return!1;let t=this.editor.plugins.get(`ImageUtils`),n=t.getClosestSelectedImageElement(this.editor.model.document.selection);if(!n||!this._styles.has(e))return!1;if(!this.shouldConvertImageType(e,n))return!0;let r=t.isBlockImage(n)?`imageTypeInline`:`imageTypeBlock`,i=this.editor.commands.get(r);return!!i&&i.isEnabled}execute(e={}){let t=this.editor,n=t.model,r=t.plugins.get(`ImageUtils`);e.value&&!this.isStyleEnabled(e.value)||n.change(t=>{let i=e.value,{setImageSizes:a=!0}=e,o=r.getClosestSelectedImageElement(n.document.selection);i&&this.shouldConvertImageType(i,o)&&(this.editor.execute(r.isBlockImage(o)?`imageTypeInline`:`imageTypeBlock`,{setImageSizes:a}),o=r.getClosestSelectedImageElement(n.document.selection)),!i||this._styles.get(i).isDefault?t.removeAttribute(`imageStyle`,o):t.setAttribute(`imageStyle`,i,o),a&&r.setImageNaturalSizeAttributes(o)})}shouldConvertImageType(e,t){return!this._styles.get(e).modelElements.includes(t.name)}};const wj={get inline(){return{name:`inline`,title:`In line`,icon:Cv,modelElements:[`imageInline`],isDefault:!0}},get alignLeft(){return{name:`alignLeft`,title:`Left aligned image`,icon:xv,modelElements:[`imageBlock`,`imageInline`],className:`image-style-align-left`}},get alignBlockLeft(){return{name:`alignBlockLeft`,title:`Left aligned image`,icon:wv,modelElements:[`imageBlock`],className:`image-style-block-align-left`}},get alignCenter(){return{name:`alignCenter`,title:`Centered image`,icon:yv,modelElements:[`imageBlock`],className:`image-style-align-center`}},get alignRight(){return{name:`alignRight`,title:`Right aligned image`,icon:Sv,modelElements:[`imageBlock`,`imageInline`],className:`image-style-align-right`}},get alignBlockRight(){return{name:`alignBlockRight`,title:`Right aligned image`,icon:Tv,modelElements:[`imageBlock`],className:`image-style-block-align-right`}},get block(){return{name:`block`,title:`Centered image`,icon:yv,modelElements:[`imageBlock`],isDefault:!0}},get side(){return{name:`side`,title:`Side image`,icon:Sv,modelElements:[`imageBlock`],className:`image-style-side`}}},Tj={full:bv,left:wv,right:Tv,center:yv,inlineLeft:xv,inlineRight:Sv,inline:Cv},Ej=[{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 Dj(e,t){for(let n of t)if(n.name===e)return n}function Oj(e){return(e.configuredStyles.options||[]).map(e=>jj(e)).filter(t=>Mj(t,e))}function kj(e,t){return e&&t?{options:[`inline`,`alignLeft`,`alignRight`,`alignCenter`,`alignBlockLeft`,`alignBlockRight`,`block`,`side`]}:e?{options:[`block`,`side`]}:t?{options:[`inline`,`alignLeft`,`alignRight`]}:{}}function Aj(e){return e.has(`ImageBlockEditing`)&&e.has(`ImageInlineEditing`)?[...Ej]:[]}function jj(e){return e=typeof e==`string`?wj[e]?{...wj[e]}:{name:e}:Nj(wj[e.name],e),typeof e.icon==`string`&&(e.icon=Tj[e.icon]||e.icon),e}function Mj(e,{isBlockPluginLoaded:t,isInlinePluginLoaded:n}){let{modelElements:r,name:i}=e;if(!r||!r.length||!i)return Pj({style:e}),!1;{let i=[t?`imageBlock`:null,n?`imageInline`:null];if(!r.some(e=>i.includes(e)))return T(`image-style-missing-dependency`,{style:e,missingPlugins:r.map(e=>e===`imageBlock`?`ImageBlockEditing`:`ImageInlineEditing`)}),!1}return!0}function Nj(e,t){let n={...t};for(let r in e)Object.prototype.hasOwnProperty.call(t,r)||(n[r]=e[r]);return n}function Pj(e){T(`image-style-configuration-definition-invalid`,e)}const Fj={normalizeStyles:Oj,getDefaultStylesConfiguration:kj,getDefaultDropdownDefinitions:Aj,warnInvalidStyle:Pj};function Ij(e){return(t,n,r)=>{if(!r.consumable.consume(n.item,t.name))return;let i=Dj(n.attributeNewValue,e),a=Dj(n.attributeOldValue,e),o=r.mapper.toViewElement(n.item),s=r.writer;a&&s.removeClass(a.className,o),i&&s.addClass(i.className,o)}}function Lj(e){let t={imageInline:e.filter(e=>!e.isDefault&&e.modelElements.includes(`imageInline`)),imageBlock:e.filter(e=>!e.isDefault&&e.modelElements.includes(`imageBlock`))};return(n,r,i)=>{if(!r.modelRange)return;let a=r.viewItem,o=j(r.modelRange.getItems());if(o&&i.schema.checkAttribute(o,`imageStyle`)){for(let e of t[o.name])i.consumable.consume(a,{classes:e.className})&&i.writer.setAttribute(`imageStyle`,e.name,o);Rj(i,a,o,e)}}}function Rj(e,t,n,r){if(!e.consumable.test(t,{styles:[`float`]}))return;let i=null;switch(t.getStyle(`float`)){case`left`:i=`alignLeft`;break;case`right`:i=`alignRight`;break}if(!i)return;let a=Dj(i,r);if(!a)return;let o=wj[a.name];$t(a,o)&&(e.writer.setAttribute(`imageStyle`,i,n),e.consumable.consume(t,{styles:[`float`]}))}var zj=class extends F{static get pluginName(){return`ImageStyleEditing`}static get isOfficialPlugin(){return!0}static get requires(){return[Kk]}normalizedStyles;init(){let e=this.editor,t=e.plugins.has(`ImageBlockEditing`),n=e.plugins.has(`ImageInlineEditing`);e.config.define(`image.styles`,Fj.getDefaultStylesConfiguration(t,n)),this.normalizedStyles=Fj.normalizeStyles({configuredStyles:e.config.get(`image.styles`),isBlockPluginLoaded:t,isInlinePluginLoaded:n}),this._setupConversion(t,n),this._setupPostFixer(),e.commands.add(`imageStyle`,new Cj(e,this.normalizedStyles))}_setupConversion(e,t){let n=this.editor,r=n.model.schema,i=Ij(this.normalizedStyles),a=Lj(this.normalizedStyles);n.editing.downcastDispatcher.on(`attribute:imageStyle`,i),n.data.downcastDispatcher.on(`attribute:imageStyle`,i),e&&(r.extend(`imageBlock`,{allowAttributes:`imageStyle`}),r.setAttributeProperties(`imageStyle`,{isFormatting:!0,blockAlignment:Bj(this.normalizedStyles)}),n.data.upcastDispatcher.on(`element:figure`,a,{priority:`low`})),t&&(r.extend(`imageInline`,{allowAttributes:`imageStyle`}),r.setAttributeProperties(`imageStyle`,{isFormatting:!0}),n.data.upcastDispatcher.on(`element:img`,a,{priority:`low`}))}_setupPostFixer(){let e=this.editor,t=e.model.document,n=e.plugins.get(Kk),r=new Map(this.normalizedStyles.map(e=>[e.name,e]));t.registerPostFixer(e=>{let i=!1;for(let a of t.differ.getChanges())if(a.type==`insert`||a.type==`attribute`&&a.attributeKey==`imageStyle`){let t=a.type==`insert`?a.position.nodeAfter:a.range.start.nodeAfter;if(t&&t.is(`element`,`paragraph`)&&t.childCount>0&&(t=t.getChild(0)),!n.isImage(t))continue;let o=t.getAttribute(`imageStyle`);if(!o)continue;let s=r.get(o);(!s||!s.modelElements.includes(t.name))&&(e.removeAttribute(`imageStyle`,t),i=!0)}return i})}};function Bj(e){let t=(...t)=>{let n=t.map(t=>Dj(t,e)).find(e=>e?.modelElements.includes(`imageBlock`));if(n)return{isDefault:!!n.isDefault,value:n.name}};return Object.fromEntries(Object.entries({left:[`alignBlockLeft`,`alignLeft`],right:[`alignBlockRight`,`alignRight`],center:[`block`,`alignCenter`]}).map(([e,n])=>[e,t(...n)]).filter(([,e])=>e!==void 0))}var Vj=class extends F{static get requires(){return[zj]}static get pluginName(){return`ImageStyleUI`}static get isOfficialPlugin(){return!0}get localizedDefaultStylesTitles(){let 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(){let e=this.editor.plugins,t=this.editor.config.get(`image.toolbar`)||[],n=Hj(e.get(`ImageStyleEditing`).normalizedStyles,this.localizedDefaultStylesTitles);for(let e of n)this._createButton(e);let r=Hj([...t.filter(Xe),...Fj.getDefaultDropdownDefinitions(e)],this.localizedDefaultStylesTitles);for(let e of r)this._createDropdown(e,n)}_createDropdown(e,t){let n=this.editor.ui.componentFactory;n.add(e.name,r=>{let i,{defaultItem:a,items:o,title:s}=e,c=o.filter(e=>t.find(({name:t})=>Uj(t)===e)).map(e=>{let t=n.create(e);return e===a&&(i=t),t});o.length!==c.length&&Fj.warnInvalidStyle({dropdown:e});let l=Nx(r,Mx),u=l.buttonView,d=u.arrowView;return Fx(l,c,{enableActiveItemFocusOnDropdownOpen:!0}),u.set({label:Wj(s,i.label),class:null,tooltip:!0}),d.unbind(`label`),d.set({label:s}),u.bind(`icon`).toMany(c,`isOn`,(...e)=>{let t=e.findIndex(en);return t<0?i.icon:c[t].icon}),u.bind(`label`).toMany(c,`isOn`,(...e)=>{let t=e.findIndex(en);return Wj(s,t<0?i.label:c[t].label)}),u.bind(`isOn`).toMany(c,`isOn`,(...e)=>e.some(en)),u.bind(`class`).toMany(c,`isOn`,(...e)=>e.some(en)?`ck-splitbutton_flatten`:void 0),u.on(`execute`,()=>{c.some(({isOn:e})=>e)?l.isOpen=!l.isOpen:i.fire(`execute`)}),l.bind(`isEnabled`).toMany(c,`isEnabled`,(...e)=>e.some(en)),this.listenTo(l,`execute`,()=>{this.editor.editing.view.focus()}),l})}_createButton(e){let t=e.name;this.editor.ui.componentFactory.add(Uj(t),n=>{let r=this.editor,i=r.commands.get(`imageStyle`),a=new H(n);a.set({label:e.title,icon:e.icon,tooltip:!0,isToggleable:!0});let o=[i],s=r.commands.get(`imageTypeBlock`),c=r.commands.get(`imageTypeInline`);return s&&o.push(s),c&&o.push(c),a.bind(`isEnabled`).toMany(o,`isEnabled`,()=>i.isStyleEnabled(t)),a.bind(`isOn`).to(i,`value`,e=>e===t),a.on(`execute`,this._executeCommand.bind(this,t)),a})}_executeCommand(e){this.editor.execute(`imageStyle`,{value:e}),this.editor.editing.view.focus()}};function Hj(e,t){for(let n of e)t[n.title]&&(n.title=t[n.title]);return e}function Uj(e){return`imageStyle:${e}`}function Wj(e,t){return(e?e+`: `:``)+t}var Gj=class extends F{static get requires(){return[zj,Vj]}static get pluginName(){return`ImageStyle`}static get isOfficialPlugin(){return!0}},Kj=class extends F{static get requires(){return[kD,Kk]}static get pluginName(){return`ImageToolbar`}static get isOfficialPlugin(){return!0}afterInit(){let e=this.editor,t=e.t,n=e.plugins.get(kD),r=e.plugins.get(`ImageUtils`);n.register(`image`,{ariaLabel:t(`Image toolbar`),items:qj(e.config.get(`image.toolbar`)||[]),getRelatedElement:e=>r.getClosestSelectedImageWidget(e)})}};function qj(e){return e.map(e=>Xe(e)?e.name:e)}var Jj=class extends F{static get requires(){return[gA,Kk]}static get pluginName(){return`PictureEditing`}static get isOfficialPlugin(){return!0}afterInit(){let 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(){let e=this.editor,t=e.conversion,n=e.plugins.get(`ImageUtils`);t.for(`upcast`).add(lA(n)),t.for(`downcast`).add(dA(n))}_setupImageUploadEditingIntegration(){let e=this.editor;if(!e.plugins.has(`ImageUploadEditing`))return;let t=e.plugins.get(`ImageUploadEditing`);this.listenTo(t,`uploadComplete`,(t,{imageElement:n,data:r})=>{let i=r.sources;i&&e.model.change(e=>{e.setAttributes({sources:i},n)})})}},Yj=class extends F{static get requires(){return[gA,Kk,uk]}static get pluginName(){return`LinkImageEditing`}static get isOfficialPlugin(){return!0}afterInit(){let e=this.editor,t=e.model.schema;e.plugins.has(`ImageBlockEditing`)&&t.extend(`imageBlock`,{allowAttributes:[`linkHref`]}),e.conversion.for(`upcast`).add(Xj(e)),e.conversion.for(`downcast`).add(Zj(e)),this._enableAutomaticDecorators(),this._enableManualDecorators()}_enableAutomaticDecorators(){let e=this.editor,t=e.commands.get(`link`).automaticDecorators;t.length&&e.conversion.for(`downcast`).add(t.getDispatcherForLinkedImage())}_enableManualDecorators(){let e=this.editor,t=e.commands.get(`link`);for(let n of t.manualDecorators)e.plugins.has(`ImageBlockEditing`)&&e.model.schema.extend(`imageBlock`,{allowAttributes:n.id}),e.plugins.has(`ImageInlineEditing`)&&e.model.schema.extend(`imageInline`,{allowAttributes:n.id}),e.conversion.for(`downcast`).add(Qj(n)),e.conversion.for(`upcast`).add($j(e,n))}};function Xj(e){let t=e.plugins.has(`ImageInlineEditing`),n=e.plugins.get(`ImageUtils`);return e=>{e.on(`element:a`,(e,r,i)=>{let a=r.viewItem,o=n.findViewImgElement(a);if(!o)return;let s=o.findAncestor(e=>n.isBlockImageView(e));if(t&&!s)return;let c={attributes:[`href`]};if(!i.consumable.test(a,c))return;let l=a.getAttribute(`href`),u=r.modelCursor.parent;u.is(`element`,`imageBlock`)&&(i.writer.setAttribute(`linkHref`,l,u),i.consumable.consume(a,c))},{priority:`high`})}}function Zj(e){let t=e.plugins.get(`ImageUtils`);return e=>{e.on(`attribute:linkHref:imageBlock`,(e,n,r)=>{if(!r.consumable.consume(n.item,e.name))return;let i=r.mapper.toViewElement(n.item),a=r.writer,o=Array.from(i.getChildren()).find(e=>e.is(`element`,`a`)),s=t.findViewImgElement(i),c=s.parent.is(`element`,`picture`)?s.parent:s;if(o)n.attributeNewValue?a.setAttribute(`href`,n.attributeNewValue,o):(a.move(a.createRangeOn(c),a.createPositionAt(i,0)),a.remove(o));else{let e=a.createContainerElement(`a`,{href:n.attributeNewValue});a.insert(a.createPositionAt(i,0),e),a.move(a.createRangeOn(c),a.createPositionAt(e,0))}},{priority:`high`})}}function Qj(e){return t=>{let n=t=>(n,r,i)=>{let a=i.mapper.toViewElement(r.item),o=Array.from(a.getChildren()).find(e=>e.is(`element`,`a`));if(o){if(!t&&r.attributeOldValue){for(let[t,n]of Ui(e.attributes))i.writer.removeAttribute(t,n,o);e.classes&&i.writer.removeClass(e.classes,o);for(let t in e.styles)i.writer.removeStyle(t,o)}if(t&&r.attributeNewValue){for(let[t,n]of Ui(e.attributes))i.writer.setAttribute(t,n,!1,o);e.classes&&i.writer.addClass(e.classes,o);for(let t in e.styles)i.writer.setStyle(t,e.styles[t],o)}}};t.on(`attribute:${e.id}:imageBlock`,n(!1),{priority:ge.high-1}),t.on(`attribute:${e.id}:imageBlock`,n(!0),{priority:ge.high-2})}}function $j(e,t){let n=e.plugins.has(`ImageInlineEditing`),r=e.plugins.get(`ImageUtils`);return e=>{e.on(`element:a`,(e,i,a)=>{let o=i.viewItem,s=r.findViewImgElement(o);if(!s)return;let c=s.findAncestor(e=>r.isBlockImageView(e));if(n&&!c)return;let l=new Po(t._createPattern()).match(o);if(!l||!a.consumable.test(o,l.match))return;let u=i.modelCursor.parent;u?.is(`element`,`imageBlock`)&&(a.writer.setAttribute(t.id,!0,u),a.consumable.consume(o,l.match))},{priority:`high`})}}var eM=class extends F{static get requires(){return[uk,yk,bA]}static get pluginName(){return`LinkImageUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.editing.view.document;this.listenTo(t,`click`,(t,n)=>{this._isSelectedLinkedImage(e.model.document.selection)&&(n.preventDefault(),t.stop())},{priority:`high`}),this._createToolbarLinkImageButton()}_createToolbarLinkImageButton(){let e=this.editor,t=e.t;e.ui.componentFactory.add(`linkImage`,n=>{let r=new H(n),i=e.plugins.get(`LinkUI`),a=e.commands.get(`link`);return r.set({isEnabled:!0,label:t(`Link image`),icon:Z_,keystroke:BO,tooltip:!0,isToggleable:!0}),r.bind(`isEnabled`).to(a,`isEnabled`),r.bind(`isOn`).to(a,`value`,e=>!!e),this.listenTo(r,`execute`,()=>{this._isSelectedLinkedImage(e.model.document.selection)?i._addToolbarView():i._showUI(!0)}),r})}_isSelectedLinkedImage(e){let t=e.getSelectedElement();return this.editor.plugins.get(`ImageUtils`).isImage(t)&&t.hasAttribute(`linkHref`)}},tM=class extends F{static get requires(){return[Yj,eM]}static get pluginName(){return`LinkImage`}static get isOfficialPlugin(){return!0}},nM=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,-.:;=?@[]^_{|}~`.split(``),rM=e=>{let t=0;for(let n=0;n<e.length;n++){let r=e[n],i=nM.indexOf(r);t=t*83+i}return t},iM=e=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4},aM=e=>{let t=Math.max(0,Math.min(1,e));return Math.trunc(t<=.0031308?t*12.92*255+.5:(1.055*t**.4166666666666667-.055)*255+.5)},oM=e=>e<0?-1:1,sM=(e,t)=>oM(e)*Math.abs(e)**+t,cM=class extends Error{constructor(e){super(e),this.name=`ValidationError`,this.message=e}},lM=e=>{if(!e||e.length<6)throw new cM(`The blurhash string must be at least 6 characters`);let t=rM(e[0]),n=Math.floor(t/9)+1,r=t%9+1;if(e.length!==4+2*r*n)throw new cM(`blurhash length mismatch: length is ${e.length} but it should be ${4+2*r*n}`)},uM=e=>{let t=e>>16,n=e>>8&255,r=e&255;return[iM(t),iM(n),iM(r)]},dM=(e,t)=>{let n=Math.floor(e/361),r=Math.floor(e/19)%19,i=e%19;return[sM((n-9)/9,2)*t,sM((r-9)/9,2)*t,sM((i-9)/9,2)*t]},fM=(e,t,n,r)=>{lM(e),r|=1;let i=rM(e[0]),a=Math.floor(i/9)+1,o=i%9+1,s=(rM(e[1])+1)/166,c=Array(o*a);for(let t=0;t<c.length;t++)t===0?c[t]=uM(rM(e.substring(2,6))):c[t]=dM(rM(e.substring(4+t*2,6+t*2)),s*r);let l=t*4,u=new Uint8ClampedArray(l*n);for(let e=0;e<n;e++)for(let r=0;r<t;r++){let i=0,s=0,d=0;for(let l=0;l<a;l++)for(let a=0;a<o;a++){let u=Math.cos(Math.PI*r*a/t)*Math.cos(Math.PI*e*l/n),f=c[a+l*o];i+=f[0]*u,s+=f[1]*u,d+=f[2]*u}let f=aM(i),p=aM(s),m=aM(d);u[4*r+0+e*l]=f,u[4*r+1+e*l]=p,u[4*r+2+e*l]=m,u[4*r+3+e*l]=255}return u};function pM(e){let t=[],n=0;for(let r in e){let i=parseInt(r,10);isNaN(i)||(i>n&&(n=i),t.push(`${e[r]} ${r}w`))}let r=[{srcset:t.join(`,`),sizes:`(max-width: ${n}px) 100vw, ${n}px`,type:`image/webp`}];return{imageFallbackUrl:e.default,imageSources:r}}function mM(e,t){let[,n]=e.value.split(`.`),r=JSON.parse(atob(n)),i=r.auth?.ckbox?.workspaces||[r.aud];return t?r.auth?.ckbox?.role==`superadmin`||i.includes(t)?t:null:i[0]}function hM(e){if(e)try{let t=`32px`,n=document.createElement(`canvas`);n.setAttribute(`width`,t),n.setAttribute(`height`,t);let r=n.getContext(`2d`);if(!r)return;let i=r.createImageData(32,32),a=fM(e,32,32);return i.data.set(a),r.putImageData(i,0,0),n.toDataURL()}catch{return}}function gM({url:e,method:t=`GET`,data:n,onUploadProgress:r,signal:i,authorization:a}){let o=new XMLHttpRequest;o.open(t,e.toString()),o.setRequestHeader(`Authorization`,a),o.setRequestHeader(`CKBox-Version`,`CKEditor 5`),o.responseType=`json`;let s=()=>{o.abort()};return new Promise((e,t)=>{i.throwIfAborted(),i.addEventListener(`abort`,s),o.addEventListener(`loadstart`,()=>{i.addEventListener(`abort`,s)}),o.addEventListener(`loadend`,()=>{i.removeEventListener(`abort`,s)}),o.addEventListener(`error`,()=>{t()}),o.addEventListener(`abort`,()=>{t()}),o.addEventListener(`load`,()=>{let n=o.response;if(!n||n.statusCode>=400)return t(n&&n.message);e(n)}),r&&o.upload.addEventListener(`progress`,e=>{r(e)}),o.send(n)})}const _M={"image/gif":`gif`,"image/jpeg":`jpg`,"image/png":`png`,"image/webp":`webp`,"image/bmp":`bmp`,"image/tiff":`tiff`};function vM(e){return _M[e]}async function yM(e,t){try{let n=await fetch(e,{method:`HEAD`,cache:`force-cache`,...t});return n.ok&&n.headers.get(`content-type`)||``}catch{return``}}function bM(e){return e.name.match(/\.(?<ext>[^.]+)$/).groups.ext.toLowerCase()}var xM=class extends I{_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 this._wrapper!==null}_checkEnabled(){let e=this.editor.commands.get(`insertImage`),t=this.editor.commands.get(`link`);return!(!e.isEnabled&&!t.isEnabled)}_prepareOptions(){let e=this.editor.config.get(`ckbox`),t=e.dialog,n=e.categories,r=e.view,i=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:n&&{icons:n.icons},view:r&&{openLastView:r.openLastView,startupFolderId:r.startupFolderId,startupCategoryId:r.startupCategoryId,hideMaximizeButton:r.hideMaximizeButton},upload:i&&{componentsHideTimeout:i.componentsHideTimeout,dialogMinimizeTimeout:i.dialogMinimizeTimeout}}}_initListeners(){let e=this.editor,t=e.model,n=!e.config.get(`ckbox.ignoreDataId`),r=e.config.get(`ckbox.downloadableFiles`);this.on(`ckbox`,()=>{this.refresh()},{priority:`low`}),this.on(`ckbox:open`,()=>{!this.isEnabled||this.value||(this._wrapper=mr(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`,(i,a)=>{if(!this.isEnabled)return;let o=e.commands.get(`insertImage`),s=e.commands.get(`link`),c=SM({assets:a,downloadableFilesConfig:r,isImageAllowed:o.isEnabled,isLinkAllowed:s.isEnabled}),l=c.length;l!==0&&(t.change(e=>{for(let t of c){let r=t===c[l-1],i=l===1;this._insertAsset(t,r,e,i),n&&(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,n,r){let i=this.editor.model.document.selection;n.removeSelectionAttribute(`linkHref`),e.type===`image`?this._insertImage(e):this._insertLink(e,n,r),t||n.setSelection(i.getLastPosition())}_insertImage(e){let t=this.editor,{imageFallbackUrl:n,imageSources:r,imageTextAlternative:i,imageWidth:a,imageHeight:o,imagePlaceholder:s}=e.attributes;t.execute(`insertImage`,{source:{src:n,sources:r,alt:i,width:a,height:o,...s?{placeholder:s}:null}})}_insertLink(e,t,n){let r=this.editor,i=r.model,a=i.document.selection,{linkName:o,linkHref:s}=e.attributes;if(a.isCollapsed){let e=Ui(a.getAttributes()),c=t.createText(o,e);if(!n){let e=a.getLastPosition(),n=e.parent;n.name===`paragraph`&&n.isEmpty||r.execute(`insertParagraph`,{position:e});let o=i.insertContent(c);t.setSelection(o),r.execute(`link`,s);return}let l=i.insertContent(c);t.setSelection(l)}r.execute(`link`,s)}};function SM({downloadableFilesConfig:e,assets:t,isImageAllowed:n,isLinkAllowed:r}){return t.map(t=>TM(t)?{id:t.data.id,type:`image`,attributes:CM(t)}:{id:t.data.id,type:`link`,attributes:wM(t,e)}).filter(e=>e.type===`image`?n:r)}function CM(e){let{imageFallbackUrl:t,imageSources:n}=pM(e.data.imageUrls),{description:r,width:i,height:a,blurHash:o}=e.data.metadata,s=hM(o);return{imageFallbackUrl:t,imageSources:n,imageTextAlternative:r||``,imageWidth:i,imageHeight:a,...s?{imagePlaceholder:s}:null}}function wM(e,t){return{linkName:e.data.name,linkHref:EM(e,t)}}function TM(e){let t=e.data.metadata;return t?t.width&&t.height:!1}function EM(e,t){let n=new URL(e.data.url);return DM(e,t)&&n.searchParams.set(`download`,`true`),n.toString()}function DM(e,t){return typeof t==`function`?t(e):!0}const OM={autoRefresh:!0},kM=36e5,AM=D();var jM=class e extends AM{_refresh;_options;_tokenRefreshTimeout;_isDestroyed=!1;constructor(e,t={}){if(super(),!e)throw new w(`token-missing-token-url`,this);t.initValue&&this._validateTokenValue(t.initValue),this.set(`value`,t.initValue),typeof e==`function`?this._refresh=e:this._refresh=()=>MM(e),this._options={...OM,...t}}init(){return new Promise((e,t)=>{if(!this.value){this.refreshToken().then(e).catch(t);return}this._options.autoRefresh&&this._registerRefreshTokenTimeout(),e(this)})}refreshToken(){let e=this._options.autoRefresh;return this._refresh().then(t=>(this._validateTokenValue(t),this.set(`value`,t),e&&this._registerRefreshTokenTimeout(),this)).catch(t=>{throw T(`token-refresh-failed`,{autoRefresh:e}),e&&this._registerRefreshTokenTimeout(5e3),t})}destroy(){this._isDestroyed=!0,clearTimeout(this._tokenRefreshTimeout)}_validateTokenValue(e){let t=typeof e==`string`,n=!/^".*"$/.test(e),r=t&&e.split(`.`).length===3;if(!(n&&r))throw new w(`token-not-in-jwt-format`,this)}_registerRefreshTokenTimeout(e){if(clearTimeout(this._tokenRefreshTimeout),this._isDestroyed)return;let t=e||this._getTokenRefreshTimeoutTime();this._tokenRefreshTimeout=setTimeout(()=>{this.refreshToken()},t)}_getTokenRefreshTimeoutTime(){try{let[,e]=this.value.split(`.`),{exp:t}=JSON.parse(atob(e));return t?(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}),Math.floor((t*1e3-Date.now())/2)):kM}catch{return kM}}static create(t,n={}){return new e(t,n).init()}};function MM(e){return new Promise((t,n)=>{let r=new XMLHttpRequest;r.open(`GET`,e),r.addEventListener(`load`,()=>{let e=r.status,i=r.response;return e<200||e>299?n(new w(`token-cannot-download-new-token`,null)):t(i)}),r.addEventListener(`error`,()=>n(Error(`Network Error`))),r.addEventListener(`abort`,()=>n(Error(`Abort`))),r.send()})}const NM=/^data:(\S*?);base64,/,PM=E();var FM=class extends PM{file;xhr;_token;_apiAddress;constructor(e,t,n){if(super(),!e)throw new w(`fileuploader-missing-file`,null);if(!t)throw new w(`fileuploader-missing-token`,null);if(!n)throw new w(`fileuploader-missing-api-address`,null);this.file=LM(e)?IM(e):e,this._token=t,this._apiAddress=n}onProgress(e){return this.on(`progress`,(t,n)=>e(n)),this}onError(e){return this.once(`error`,(t,n)=>e(n)),this}abort(){this.xhr.abort()}send(){return this._prepareRequest(),this._attachXHRListeners(),this._sendRequest()}_prepareRequest(){let e=new XMLHttpRequest;e.open(`POST`,this._apiAddress),e.setRequestHeader(`Authorization`,this._token.value),e.responseType=`json`,this.xhr=e}_attachXHRListeners(){let 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`,()=>{let t=e.status,n=e.response;if(t<200||t>299)return this.fire(`error`,n.message||n.error)})}_sendRequest(){let e=new FormData,t=this.xhr;return e.append(`file`,this.file),new Promise((n,r)=>{t.addEventListener(`load`,()=>{let e=t.status,i=t.response;return e<200||e>299?i.message?r(new w(`fileuploader-uploading-data-failed`,this,{message:i.message})):r(i.error):n(i)}),t.addEventListener(`error`,()=>r(Error(`Network Error`))),t.addEventListener(`abort`,()=>r(Error(`Abort`))),t.send(e)})}};function IM(e,t=512){try{let n=e.match(NM)[1],r=atob(e.replace(NM,``)),i=[];for(let e=0;e<r.length;e+=t){let n=r.slice(e,e+t),a=Array(n.length);for(let e=0;e<n.length;e++)a[e]=n.charCodeAt(e);i.push(new Uint8Array(a))}return new Blob(i,{type:n})}catch{throw new w(`fileuploader-decoding-image-data-error`,null)}}function LM(e){return typeof e==`string`?!!e.match(NM)?.length:!1}var RM=class{_token;_apiAddress;constructor(e,t){if(!e)throw new w(`uploadgateway-missing-token`,null);if(!t)throw new w(`uploadgateway-missing-api-address`,null);this._token=e,this._apiAddress=t}upload(e){return new FM(e,this._token,this._apiAddress)}},zM=class extends ho{static get pluginName(){return`CloudServicesCore`}static get isOfficialPlugin(){return!0}createToken(e,t){return new jM(e,t)}createUploadGateway(e,t){return new RM(e,t)}},BM=class extends ho{tokenUrl;uploadUrl;webSocketUrl;bundleVersion;autoRefresh=!0;token=null;_tokens=new Map;static get pluginName(){return`CloudServices`}static get isOfficialPlugin(){return!0}static get requires(){return[zM]}async init(){let e=this.context.config.get(`cloudServices`)||{};for(let[t,n]of Object.entries(e))this[t]=n;if(!this.tokenUrl){this.token=null;return}let 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);let t=await this.context.plugins.get(`CloudServicesCore`).createToken(e,{autoRefresh:this.autoRefresh}).init();return this._tokens.set(e,t),t}getTokenFor(e){let t=this._tokens.get(e);if(!t)throw new w(`cloudservices-token-not-registered`,this);return t}destroy(){super.destroy();for(let e of this._tokens.values())e.destroy()}},VM=class extends F{_token;static get pluginName(){return`CKBoxUtils`}static get isOfficialPlugin(){return!0}static get requires(){return[BM]}init(){let e=this.editor,t=!!e.config.get(`ckbox`),n=!!window.CKBox;if(!t&&!n)return;e.config.define(`ckbox`,{serviceOrigin:`https://api.ckbox.io`,defaultUploadCategories:null,ignoreDataId:!1,language:e.locale.uiLanguage,theme:`lark`,tokenUrl:e.config.get(`cloudServices.tokenUrl`)});let r=e.plugins.get(BM),i=e.config.get(`cloudServices.tokenUrl`),a=e.config.get(`ckbox.tokenUrl`);if(!a)throw new w(`ckbox-plugin-missing-token-url`,this);a==i?this._token=Promise.resolve(r.token):this._token=r.registerTokenUrl(a),this._token=this._token.then(async e=>(await this._authorizePrivateCategoriesAccess(e.value),e))}getToken(){return this._token}async getWorkspaceId(){let e=this.editor.t,t=e(`Cannot access default workspace.`),n=this.editor.config.get(`ckbox.defaultUploadWorkspaceId`),r=mM(await this._token,n);if(r==null)throw ye(`ckbox-access-default-workspace-error`),t;return r}async getCategoryIdForFile(e,t){let n=this.editor.t,r=n(`Cannot determine a category for the uploaded file.`),i=this.editor.config.get(`ckbox.defaultUploadCategories`),a=this._getAvailableCategories(t),o=typeof e==`string`?vM(await yM(e,t)):bM(e),s=await a;if(!s)throw r;if(i){let e=Object.keys(i).find(e=>i[e].find(e=>e.toLowerCase()==o));if(e){let t=s.find(t=>t.id===e||t.name===e);if(!t)throw r;return t.id}}let c=s.find(e=>e.extensions.find(e=>e.toLowerCase()==o));if(!c)throw r;return c.id}async _getAvailableCategories(e){let t=this.editor,n=this._token,{signal:r}=e,i=t.config.get(`ckbox.serviceOrigin`),a=await this.getWorkspaceId();try{let e=[],t=0,n;do{let r=await o(t);e.push(...r.items),n=r.totalCount-(t+50),t+=50}while(n>0);return e}catch{r.throwIfAborted(),ye(`ckbox-fetch-category-http-error`);return}async function o(e){let t=new URL(`categories`,i);return t.searchParams.set(`limit`,`50`),t.searchParams.set(`offset`,String(e)),t.searchParams.set(`workspaceId`,a),gM({url:t,signal:r,authorization:(await n).value})}}async _authorizePrivateCategoriesAccess(e){let t=this.editor.config.get(`ckbox.serviceOrigin`),n=new FormData;n.set(`token`,e),await fetch(`${t}/categories/authorizePrivateAccess`,{method:`POST`,credentials:`include`,mode:`no-cors`,body:n})}},HM=class extends F{static get requires(){return[$A,zA,bw,GM]}static get pluginName(){return`CKBoxUploadAdapter`}static get isOfficialPlugin(){return!0}async afterInit(){let e=this.editor,t=!!e.config.get(`ckbox`),n=!!window.CKBox;if(!t&&!n)return;let r=e.plugins.get(bw),i=e.plugins.get(VM);r.createUploadAdapter=t=>new UM(t,e,i);let a=!e.config.get(`ckbox.ignoreDataId`),o=e.plugins.get($A);a&&o.on(`uploadComplete`,(t,{imageElement:n,data:r})=>{e.model.change(e=>{e.setAttribute(`ckboxImageId`,r.ckboxImageId,n)})})}},UM=class{loader;token;editor;controller;serviceOrigin;ckboxUtils;constructor(e,t,n){this.loader=e,this.token=n.getToken(),this.ckboxUtils=n,this.editor=t,this.controller=new AbortController,this.serviceOrigin=t.config.get(`ckbox.serviceOrigin`)}async upload(){let e=this.ckboxUtils,t=this.editor.t,n=await this.loader.file,r=await e.getCategoryIdForFile(n,{signal:this.controller.signal}),i=new URL(`assets`,this.serviceOrigin),a=new FormData;return i.searchParams.set(`workspaceId`,await e.getWorkspaceId()),a.append(`categoryId`,r),a.append(`file`,n),gM({method:`POST`,url:i,data:a,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=>{let t=pM(e.imageUrls);return{ckboxImageId:e.id,default:t.imageFallbackUrl,sources:t.imageSources}}).catch(()=>{let e=t(`Cannot upload file:`)+` ${n.name}.`;return Promise.reject(e)})}abort(){this.controller.abort()}};const WM=`NoPermission`;var GM=class extends F{static get pluginName(){return`CKBoxEditing`}static get isOfficialPlugin(){return!0}static get requires(){return[uk,Jj,HM,VM]}init(){let e=this.editor;this._shouldBeInitialised()&&(this._checkImagePlugins(),ZM()&&e.commands.add(`ckbox`,new xM(e)),QM(e).then(e=>{e||this._blockImageCommands()}))}afterInit(){let e=this.editor;this._shouldBeInitialised()&&(e.config.get(`ckbox.ignoreDataId`)||(this._initSchema(),this._initConversion(),this._initFixers()))}_shouldBeInitialised(){return!!this.editor.config.get(`ckbox`)||ZM()}_blockImageCommands(){let e=this.editor,t=e.commands.get(`uploadImage`),n=e.commands.get(`ckboxImageEdit`);t&&(t.isAccessAllowed=!1,t.forceDisabled(WM)),n&&n.forceDisabled(WM)}_checkImagePlugins(){let e=this.editor;!e.plugins.has(`ImageBlockEditing`)&&!e.plugins.has(`ImageInlineEditing`)&&ye(`ckbox-plugin-image-feature-missing`,e)}_initSchema(){let 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!1},`ckboxLinkId`)}_initConversion(){let e=this.editor;e.conversion.for(`downcast`).add(e=>{e.on(`attribute:ckboxLinkId:imageBlock`,(e,t,n)=>{let{writer:r,mapper:i,consumable:a}=n;if(!a.consume(t.item,e.name))return;let o=[...i.toViewElement(t.item).getChildren()].find(e=>e.name===`a`);o&&(t.item.hasAttribute(`ckboxLinkId`)?r.setAttribute(`data-ckbox-resource-id`,t.item.getAttribute(`ckboxLinkId`),o):r.removeAttribute(`data-ckbox-resource-id`,o))},{priority:`low`}),e.on(`attribute:ckboxLinkId`,(e,t,n)=>{let{writer:r,mapper:i,consumable:a}=n;if(a.consume(t.item,e.name)){if(t.attributeOldValue){let e=YM(r,t.attributeOldValue);r.unwrap(i.toViewRange(t.range),e)}if(t.attributeNewValue){let e=YM(r,t.attributeNewValue);if(t.item.is(`selection`)){let t=r.document.selection;r.wrap(t.getFirstRange(),e)}else r.wrap(i.toViewRange(t.range),e)}}},{priority:`low`})}),e.conversion.for(`upcast`).add(e=>{e.on(`element:a`,(e,t,n)=>{let{writer:r,consumable:i}=n;if(!t.viewItem.getAttribute(`href`)||!i.consume(t.viewItem,{attributes:[`data-ckbox-resource-id`]}))return;let a=t.viewItem.getAttribute(`data-ckbox-resource-id`);if(a)if(t.modelRange)for(let e of t.modelRange.getItems())e.is(`$textProxy`)&&(e=e.textNode),XM(e)&&r.setAttribute(`ckboxLinkId`,a,e);else{let e=t.modelCursor.nodeBefore||t.modelCursor.parent;r.setAttribute(`ckboxLinkId`,a,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]+/}}});let t=e.commands.get(`replaceImageSource`);t&&this.listenTo(t,`cleanupImage`,(e,[t,n])=>{t.removeAttribute(`ckboxImageId`,n)})}_initFixers(){let e=this.editor,t=e.model,n=t.document.selection;t.document.registerPostFixer(KM(e)),t.document.registerPostFixer(qM(n))}};function KM(e){return t=>{let n=!1,r=e.model,i=e.commands.get(`ckbox`);if(!i)return n;for(let e of r.document.differ.getChanges()){if(e.type!==`insert`&&e.type!==`attribute`)continue;let r=e.type===`insert`?new B(e.position,e.position.getShiftedBy(e.length)):e.range,a=e.type===`attribute`&&e.attributeKey===`linkHref`&&e.attributeNewValue===null;for(let e of r.getItems()){if(a&&e.hasAttribute(`ckboxLinkId`)){t.removeAttribute(`ckboxLinkId`,e),n=!0;continue}let r=JM(e,i._chosenAssets);for(let i of r){let r=i.type===`image`?`ckboxImageId`:`ckboxLinkId`;i.id!==e.getAttribute(r)&&(t.setAttribute(r,i.id,e),n=!0)}}}return n}}function qM(e){return t=>!e.hasAttribute(`linkHref`)&&e.hasAttribute(`ckboxLinkId`)?(t.removeSelectionAttribute(`ckboxLinkId`),!0):!1}function JM(e,t){let n=e.is(`element`,`imageInline`)||e.is(`element`,`imageBlock`),r=e.hasAttribute(`linkHref`);return[...t].filter(t=>{if(t.type===`image`&&n)return t.attributes.imageFallbackUrl===e.getAttribute(`src`);if(t.type===`link`&&r)return t.attributes.linkHref===e.getAttribute(`linkHref`)})}function YM(e,t){let n=e.createAttributeElement(`a`,{"data-ckbox-resource-id":t},{priority:5});return e.setCustomProperty(`link`,!0,n),n}function XM(e){return!!(e.is(`$text`)||e.is(`element`,`imageInline`)||e.is(`element`,`imageBlock`))}function ZM(){return!!window.CKBox}async function QM(e){let t=e.plugins.get(VM),n=e.config.get(`ckbox.serviceOrigin`),r=new URL(`permissions`,n),{value:i}=await t.getToken(),a=await gM({url:r,authorization:i,signal:new AbortController().signal});return Object.values(a).some(e=>e[`asset:create`])}var $M=class extends F{static get pluginName(){return`CKBox`}static get isOfficialPlugin(){return!0}static get requires(){return[GM,sO]}};function eN(e){let t=tN(e);return e=>e.is(`element`,`imageInline`)||e.is(`element`,`imageBlock`)?e.hasAttribute(`ckboxImageId`)?!0:e.hasAttribute(`src`)?t(e.getAttribute(`src`)):!1:!1}function tN(e){if(Array.isArray(e)){let t=e.map(tN);return e=>t.some(t=>t(e))}if(e==`origin`){let e=u.window.location.origin;return t=>new URL(t,u.document.baseURI).origin==e}return typeof e==`function`?e:e instanceof RegExp?t=>!!(t.match(e)||t.replace(/^https?:\/\//,``).match(e)):()=>!1}var nN=class extends I{_wrapper=null;_processInProgress=new Set;_canEdit;_prepareOptions;_updateUiDelayed=Yi(()=>this.editor.ui.update(),0);constructor(e){super(e),this.value=!1,this._canEdit=eN(e.config.get(`ckbox.allowExternalImagesEditing`)),this._prepareOptions=ur((e,t)=>this._prepareOptionsAbortable(e,t)),this._prepareListeners()}refresh(){let e=this.editor;this.value=this._getValue();let t=e.model.document.selection.getSelectedElement();this.isEnabled=!!t&&this._canEdit(t)&&!this._checkIfElementIsBeingProcessed(t)}execute(){if(this._getValue())return;let e=mr(document,`div`,{class:`ck ckbox-wrapper`});this._wrapper=e,this.value=!0,document.body.appendChild(this._wrapper);let t={element:this.editor.model.document.selection.getSelectedElement(),controller:new AbortController};this._prepareOptions(t).then(t=>window.CKBox.mountImageEditor(e,t),e=>{let t=this.editor,n=t.t;t.plugins.get(IC).showWarning(n(`Failed to determine category of edited image.`),{namespace:`ckbox`}),console.error(e),this._handleImageEditorClose()})}destroy(){this._handleImageEditorClose(),this._prepareOptions.abort(),this._updateUiDelayed.cancel();for(let e of this._processInProgress.values())e.controller.abort();super.destroy()}_getValue(){return this._wrapper!==null}async _prepareOptionsAbortable(e,t){let n=this.editor,r=n.config.get(`ckbox`),i=n.plugins.get(VM),{element:a}=t,o,s=a.getAttribute(`ckboxImageId`);if(s)o={assetId:s};else{let t=new URL(a.getAttribute(`src`),document.baseURI).href;o={imageUrl:t,uploadCategoryId:await i.getCategoryIdForFile(t,{signal:e})}}return{...o,imageEditing:{allowOverwrite:!1},tokenUrl:r.tokenUrl,language:r.language,...r.serviceOrigin&&{serviceOrigin:r.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(){let e=[];for(let t of this._processInProgress.values())t.element.root.rootName==`$graveyard`&&e.push(t);return e}_checkIfElementIsBeingProcessed(e){for(let{element:t}of this._processInProgress)if($t(t,e))return!0;return!1}_handleImageEditorClose(){this._wrapper&&(this._wrapper.remove(),this._wrapper=null,this.editor.editing.view.focus(),this._updateUiDelayed(),this.refresh())}_handleImageEditorSave(e,t){let n=this.editor.locale.t,r=this.editor.plugins.get(IC),i=this.editor.plugins.get(wg),a=i.add(n(`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 w?r.showWarning(n(`Server failed to process the image.`),{namespace:`ckbox`}):console.error(t))}).finally(()=>{this._processInProgress.delete(e),i.remove(a),this.refresh()})}async _getAssetStatusFromServer(e,t){let n=this.editor.plugins.get(VM),r=await gM({url:new URL(`assets/`+e,this.editor.config.get(`ckbox.serviceOrigin`)),signal:t,authorization:(await n.getToken()).value}),i=r.metadata.metadataProcessingStatus;if(!i||i==`queued`)throw new w(`ckbox-image-not-processed`);return{data:{...r}}}async _waitForAssetProcessed(e,t){let n=await Ki(()=>this._getAssetStatusFromServer(e,t),{signal:t,maxAttempts:5});if(n.data.metadata.metadataProcessingStatus!=`success`)throw new w(`ckbox-image-processing-failed`);return n}_showImageProcessingIndicator(e,t){let n=this.editor;n.editing.view.change(r=>{let i=n.editing.mapper.toViewElement(e),a=this.editor.plugins.get(`ImageUtils`).findViewImgElement(i);r.removeStyle(`aspect-ratio`,a),r.setAttribute(`width`,t.data.metadata.width,a),r.setAttribute(`height`,t.data.metadata.height,a),r.setStyle(`width`,`${t.data.metadata.width}px`,a),r.setStyle(`height`,`${t.data.metadata.height}px`,a),r.addClass(`image-processing`,i)})}_replaceImage(e,t){let n=this.editor,{imageFallbackUrl:r,imageSources:i,imageWidth:a,imageHeight:o,imagePlaceholder:s}=CM(t),c=Array.from(n.model.document.selection.getRanges());n.model.change(l=>{l.setSelection(e,`on`),n.execute(`insertImage`,{imageType:e.is(`element`,`imageInline`)?`imageInline`:null,source:{src:r,sources:i,width:a,height:o,...s?{placeholder:s}:null,...e.hasAttribute(`alt`)?{alt:e.getAttribute(`alt`)}:null}});let u=e.getChildren();e=n.model.document.selection.getSelectedElement();for(let t of u)l.append(l.cloneElement(t),e);l.setAttribute(`ckboxImageId`,t.data.id,e),l.setSelection(c)})}},rN=class extends F{static get pluginName(){return`CKBoxImageEditEditing`}static get isOfficialPlugin(){return!0}static get requires(){return[GM,VM,wg,IC,Kk,gA]}init(){let{editor:e}=this;e.commands.add(`ckboxImageEdit`,new nN(e))}},iN=class extends F{static get pluginName(){return`CKBoxImageEditUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.ui.componentFactory.add(`ckboxImageEdit`,t=>{let n=e.commands.get(`ckboxImageEdit`),r=e.commands.get(`uploadImage`),i=new H(t),a=t.t;return i.set({icon:u_,tooltip:!0}),i.bind(`label`).to(r,`isAccessAllowed`,e=>a(e?`Edit image`:`You have no image editing permissions.`)),i.bind(`isOn`).to(n,`value`,n,`isEnabled`,(e,t)=>e&&t),i.bind(`isEnabled`).to(n),this.listenTo(i,`execute`,()=>{e.execute(`ckboxImageEdit`),e.editing.view.focus()}),i})}},aN=class extends F{static get pluginName(){return`CKBoxImageEdit`}static get isOfficialPlugin(){return!0}static get requires(){return[rN,iN]}},oN=class extends F{static get pluginName(){return`CKFinderUI`}static get isOfficialPlugin(){return!0}init(){let 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){let t=this.editor,n=t.locale,r=new e(n),i=t.commands.get(`ckfinder`);return r.bind(`isEnabled`).to(i),r.on(`execute`,()=>{t.execute(`ckfinder`),t.editing.view.focus()}),r}_createFileToolbarButton(){let e=this.editor.locale.t,t=this._createButton(H);return t.icon=a_,t.label=e(`Insert image or file`),t.tooltip=!0,t}_createImageToolbarButton(){let e=this.editor.locale.t,t=this.editor.plugins.get(`ImageInsertUI`),n=this._createButton(H);return n.icon=z_,n.bind(`label`).to(t,`isImageSelected`,t=>e(t?`Replace image with file manager`:`Insert image with file manager`)),n.tooltip=!0,n}_createImageDropdownButton(){let e=this.editor.locale.t,t=this.editor.plugins.get(`ImageInsertUI`),n=this._createButton(H);return n.icon=z_,n.withText=!0,n.bind(`label`).to(t,`isImageSelected`,t=>e(t?`Replace with file manager`:`Insert with file manager`)),n.on(`execute`,()=>{t.dropdownView.isOpen=!1}),n}_createFileMenuBarButton(){let e=this.editor.locale.t,t=this._createButton(U);return t.icon=a_,t.withText=!0,t.label=e(`File`),t}_createImageMenuBarButton(e){let t=this.editor.locale.t,n=this.editor.locale.t,r=this._createButton(U);switch(r.icon=z_,r.withText=!0,e){case`insertOnly`:r.label=t(`Image`);break;case`insertNested`:r.label=n(`With file manager`);break}return r}},sN=class extends I{constructor(e){super(e),this.affectsData=!1,this.stopListening(this.editor.model.document,`change`),this.listenTo(this.editor.model.document,`change`,()=>this.refresh(),{priority:`low`})}refresh(){let e=this.editor.commands.get(`insertImage`),t=this.editor.commands.get(`link`);this.isEnabled=e.isEnabled||t.isEnabled}execute(){let e=this.editor,t=this.editor.config.get(`ckfinder.openerMethod`)||`modal`;if(t!=`popup`&&t!=`modal`)throw new w(`ckfinder-unknown-openermethod`,e);let n=this.editor.config.get(`ckfinder.options`)||{};n.chooseFiles=!0;let r=n.onInit;n.language||=e.locale.uiLanguage,n.onInit=t=>{r&&r(t),t.on(`files:choose`,n=>{let r=n.data.files.toArray(),i=r.filter(e=>!e.isImage()),a=r.filter(e=>e.isImage());for(let t of i)e.execute(`link`,t.getUrl());let o=[];for(let e of a){let n=e.getUrl();o.push(n||t.request(`file:getProxyUrl`,{file:e}))}o.length&&cN(e,o)}),t.on(`file:choose:resizedImage`,t=>{let n=t.data.resizedUrl;if(!n){let t=e.plugins.get(`Notification`),n=e.locale.t;t.showWarning(n(`Could not obtain resized image URL.`),{title:n(`Selecting resized image failed`),namespace:`ckfinder`});return}cN(e,[n])})},window.CKFinder[t](n)}};function cN(e,t){if(!e.commands.get(`insertImage`).isEnabled){let t=e.plugins.get(`Notification`),n=e.locale.t;t.showWarning(n(`Could not insert image at the current position.`),{title:n(`Inserting image failed`),namespace:`ckfinder`});return}e.execute(`insertImage`,{source:t})}var lN=class extends F{static get pluginName(){return`CKFinderEditing`}static get isOfficialPlugin(){return!0}static get requires(){return[IC,uk]}init(){let e=this.editor;if(!e.plugins.has(`ImageBlockEditing`)&&!e.plugins.has(`ImageInlineEditing`))throw new w(`ckfinder-missing-image-plugin`,e);e.commands.add(`ckfinder`,new sN(e))}},uN=class extends F{static get pluginName(){return`CKFinder`}static get isOfficialPlugin(){return!0}static get requires(){return[Ok,jw,lN,oN]}};function dN(e){let t=e.t,n=e.config.get(`codeBlock.languages`);for(let e of n)e.label===`Plain text`&&(e.label=t(`Plain text`)),e.class===void 0&&(e.class=`language-${e.language}`);return n}function fN(e,t,n){let r={};for(let i of e)if(t===`class`){let e=i[t].split(` `).shift();r[e]=i[n]}else r[i[t]]=i[n];return r}function pN(e){return e.data.match(/^(\s*)/)[0]}function mN(e,t){let n=e.createDocumentFragment(),r=t.split(`
`),i=r.reduce((t,n,i)=>(t.push(n),i<r.length-1&&t.push(e.createElement(`br`)),t),[]);return e.appendChild(i,n),n}function hN(e){let t=e.document.selection,n=[];if(t.isCollapsed)return[t.anchor];let r=t.getFirstRange().getWalker({ignoreElementEnd:!0,direction:`backward`});for(let{item:t}of r){let r=t.is(`$textProxy`)?t.textNode:t,i=r.parent;if(!i.is(`element`,`codeBlock`)||r.is(`element`,`softBreak`))continue;for(;r.previousSibling&&!r.previousSibling.is(`element`,`softBreak`);)r=r.previousSibling;let a=r.is(`$text`)?r.startOffset+pN(r).length:r.startOffset,o=e.createPositionAt(i,a);n.every(e=>!e.isEqual(o))&&n.push(o)}return n}function gN(e){let t=j(e.getSelectedBlocks());return!!t&&t.is(`element`,`codeBlock`)}function _N(e,t){return t.is(`rootElement`)||e.isLimit(t)?!1:e.checkChild(t.parent,`codeBlock`)}function vN(e,t,n,r){let i=fN(t,`language`,`label`),a=n.getAttribute(`language`);if(a in i){let t=i[a];return e(r===`enter`?`Entering %0 code snippet`:`Leaving %0 code snippet`,t)}return e(r===`enter`?`Entering code snippet`:`Leaving code snippet`)}function yN(e,t){for(e.textNode&&(e=t.createPositionBefore(e.textNode));e.nodeBefore&&!e.nodeBefore.is(`element`,`softBreak`);)e=t.createPositionBefore(e.nodeBefore);let n=e.nodeAfter;return n&&n.is(`$text`)?n:null}var bN=class extends I{_lastLanguage;constructor(e){super(e),this._lastLanguage=null}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){let t=this.editor,n=t.model,r=n.document.selection,i=dN(t)[0],a=Array.from(r.getSelectedBlocks()),o=e.forceValue==null?!this.value:e.forceValue,s=xN(e,this._lastLanguage,i.language);n.change(e=>{o?this._applyCodeBlock(e,a,s):this._removeCodeBlock(e,a)})}_getValue(){let e=this.editor.model.document.selection,t=j(e.getSelectedBlocks());return t?.is(`element`,`codeBlock`)?t.getAttribute(`language`):!1}_checkEnabled(){if(this.value)return!0;let e=this.editor.model.document.selection,t=this.editor.model.schema,n=j(e.getSelectedBlocks());return n?_N(t,n):!1}_applyCodeBlock(e,t,n){this._lastLanguage=n;let r=this.editor.model.schema,i=t.filter(e=>_N(r,e));for(let t of i)e.rename(t,`codeBlock`),e.setAttribute(`language`,n,t),r.removeDisallowedAttributes([t],e),Array.from(t.getChildren()).filter(e=>!r.checkChild(t,e)).forEach(t=>e.remove(t));i.reverse().forEach((t,n)=>{let r=i[n+1];t.previousSibling===r&&(e.appendElement(`softBreak`,r),e.merge(e.createPositionBefore(t)))})}_removeCodeBlock(e,t){let n=t.filter(e=>e.is(`element`,`codeBlock`));for(let t of n){let n=e.createRangeOn(t);for(let t of Array.from(n.getItems()).reverse())if(t.is(`element`,`softBreak`)&&t.parent.is(`element`,`codeBlock`)){let{position:n}=e.split(e.createPositionBefore(t)),r=n.nodeAfter;e.rename(r,`paragraph`),e.removeAttribute(`language`,r),e.remove(t)}e.rename(t,`paragraph`),e.removeAttribute(`language`,t)}}};function xN(e,t,n){return e.language?e.language:e.usePreviousLanguageChoice&&t?t:n}var SN=class extends I{_indentSequence;constructor(e){super(e),this._indentSequence=e.config.get(`codeBlock.indentSequence`)}refresh(){this.isEnabled=this._checkEnabled()}execute(){let e=this.editor.model;e.change(t=>{let n=hN(e);for(let r of n){let n=t.createText(this._indentSequence);e.insertContent(n,r)}})}_checkEnabled(){return this._indentSequence?gN(this.editor.model.document.selection):!1}},CN=class extends I{_indentSequence;constructor(e){super(e),this._indentSequence=e.config.get(`codeBlock.indentSequence`)}refresh(){this.isEnabled=this._checkEnabled()}execute(){let e=this.editor.model;e.change(()=>{let t=hN(e);for(let n of t){let t=wN(e,n,this._indentSequence);t&&e.deleteContent(e.createSelection(t))}})}_checkEnabled(){if(!this._indentSequence)return!1;let e=this.editor.model;return gN(e.document.selection)?hN(e).some(t=>wN(e,t,this._indentSequence)):!1}};function wN(e,t,n){let r=yN(t,e);if(!r)return null;let i=pN(r),a=i.lastIndexOf(n);if(a+n.length!==i.length||a===-1)return null;let{parent:o,startOffset:s}=r;return e.createRange(e.createPositionAt(o,s+a),e.createPositionAt(o,s+a+n.length))}function TN(e,t,n=!1){let r=fN(t,`language`,`class`),i=fN(t,`language`,`label`);return(t,a,o)=>{let{writer:s,mapper:c,consumable:l}=o;if(!l.consume(a.item,`insert`))return;let u=a.item.getAttribute(`language`),d=c.toViewPosition(e.createPositionBefore(a.item)),f={};n&&(f[`data-language`]=i[u],f.spellcheck=`false`);let p=r[u]?{class:r[u]}:void 0,m=s.createContainerElement(`code`,p),h=s.createContainerElement(`pre`,f,m);s.insert(d,h),c.bindElements(a.item,m)}}function EN(e){return(t,n,r)=>{if(n.item.parent.name!==`codeBlock`)return;let{writer:i,mapper:a,consumable:o}=r;if(!o.consume(n.item,`insert`))return;let s=a.toViewPosition(e.createPositionBefore(n.item));i.insert(s,i.createText(`
`))}}function DN(e,t){let n=fN(t,`class`,`language`),r=t[0].language;return(e,t,i)=>{let a=t.viewItem,o=a.parent;if(!o||!o.is(`element`,`pre`)||t.modelCursor.findAncestor(`codeBlock`))return;let{consumable:s,writer:c}=i;if(!s.test(a,{name:!0}))return;let l=c.createElement(`codeBlock`),u=[...a.getClassNames()];u.length||u.push(``);for(let e of u){let t=n[e];if(t){s.consume(a,{classes:[e]}),c.setAttribute(`language`,t,l);break}}l.hasAttribute(`language`)||c.setAttribute(`language`,r,l),i.convertChildren(a,l),i.safeInsert(l,t.modelCursor)&&(s.consume(a,{name:!0}),i.updateConversionResult(l,t))}}function ON(){return(e,t,{consumable:n,writer:r})=>{let i=t.modelCursor;if(!n.test(t.viewItem)||!i.findAncestor(`codeBlock`))return;n.consume(t.viewItem);let a=t.viewItem.data.split(`
`).map(e=>r.createText(e)),o=a[a.length-1];for(let e of a)if(r.insert(e,i),i=i.getShiftedBy(e.offsetSize),e!==o){let e=r.createElement(`softBreak`);r.insert(e,i),i=r.createPositionAfter(e)}t.modelRange=r.createRange(t.modelCursor,i),t.modelCursor=i}}function kN(){return(e,t,{consumable:n})=>{let r=t.viewItem;if(r.findAncestor(`pre`))return;let i=Array.from(r.getChildren()),a=i.find(e=>e.is(`element`,`code`));if(a)for(let e of i)e===a||!e.is(`$text`)||n.consume(e,{name:!0})}}const AN=`paragraph`;var jN=class extends F{static get pluginName(){return`CodeBlockEditing`}static get isOfficialPlugin(){return!0}static get requires(){return[kE]}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:` `})}init(){let e=this.editor,t=e.model.schema,n=e.model,r=e.editing.view,i=dN(e);e.commands.add(`codeBlock`,new bN(e)),e.commands.add(`indentCodeBlock`,new SN(e)),e.commands.add(`outdentCodeBlock`,new CN(e)),this.listenTo(r.document,`tab`,(t,n)=>{let r=n.shiftKey?`outdentCodeBlock`:`indentCodeBlock`;e.commands.get(r).isEnabled&&(e.execute(r),n.stopPropagation(),n.preventDefault(),t.stop())},{context:`pre`}),t.register(`codeBlock`,{allowWhere:`$block`,allowChildren:`$text`,disallowChildren:`$inlineObject`,allowAttributes:[`language`],allowAttributesOf:`$listItem`,isBlock:!0}),t.addAttributeCheck((e,n)=>{let r=e.getItem(e.length-2);if(t.getAttributeProperties(n).isFormatting&&r&&r.name==`codeBlock`)return!1}),e.editing.downcastDispatcher.on(`insert:codeBlock`,TN(n,i,!0)),e.data.downcastDispatcher.on(`insert:codeBlock`,TN(n,i)),e.data.downcastDispatcher.on(`insert:softBreak`,EN(n),{priority:`high`}),e.data.upcastDispatcher.on(`element:code`,DN(r,i)),e.data.upcastDispatcher.on(`text`,ON()),e.data.upcastDispatcher.on(`element:pre`,kN(),{priority:`high`}),this.listenTo(e.editing.view.document,`clipboardInput`,(t,r)=>{let i=n.createRange(n.document.selection.anchor);if(r.targetRanges&&(i=e.editing.mapper.toModelRange(r.targetRanges[0])),!i.start.parent.is(`element`,`codeBlock`))return;let a=r.dataTransfer.getData(`text/plain`);r.content=mN(new Np(e.editing.view.document),a)}),e.plugins.has(`ClipboardPipeline`)&&e.plugins.get(_O).on(`contentInsertion`,(n,r)=>{let i=e.model,a=i.document.selection;a.anchor.parent.is(`element`,`codeBlock`)&&i.change(e=>{let n=e.createRangeIn(r.content);for(let r of[...n.getItems()])r.is(`node`)&&!t.checkChild(a.anchor,r)&&e.remove(r)})}),this.listenTo(n,`getSelectedContent`,(e,[r])=>{let i=r.anchor;r.isCollapsed||!i.parent.is(`element`,`codeBlock`)||!i.hasSameParentAs(r.focus)||n.change(n=>{let a=e.return;if(i.parent.is(`element`)&&(a.childCount>1||r.containsEntireContent(i.parent))){let t=n.createElement(`codeBlock`,i.parent.getAttributes());n.append(a,t);let r=n.createDocumentFragment();n.append(t,r),e.return=r;return}let o=a.getChild(0);t.checkAttribute(o,`code`)&&n.setAttribute(`code`,!0,o)})})}afterInit(){let e=this.editor,t=e.commands,n=t.get(`indent`),r=t.get(`outdent`);n&&n.registerChildCommand(t.get(`indentCodeBlock`),{priority:`highest`}),r&&r.registerChildCommand(t.get(`outdentCodeBlock`)),this.listenTo(e.editing.view.document,`enter`,(t,n)=>{e.model.document.selection.getLastPosition().parent.is(`element`,`codeBlock`)&&(!NN(e,n.isSoft)&&!PN(e,n.isSoft)&&MN(e),n.preventDefault(),t.stop())},{context:`pre`}),this._initAriaAnnouncements()}_initAriaAnnouncements(){let{model:e,ui:t,t:n}=this.editor,r=dN(this.editor),i=null;e.document.selection.on(`change:range`,()=>{let a=e.document.selection.focus.parent;!t||i===a||!a.is(`element`)||(i&&i.is(`element`,`codeBlock`)&&t.ariaLiveAnnouncer.announce(vN(n,r,i,`leave`)),a.is(`element`,`codeBlock`)&&t.ariaLiveAnnouncer.announce(vN(n,r,a,`enter`)),i=a)})}};function MN(e){let t=e.model,n=t.document,r=n.selection.getLastPosition(),i,a=yN(r,t);a&&a.is(`$text`)&&(i=pN(a)),e.model.change(t=>{e.execute(`shiftEnter`),i&&t.insertText(i,n.selection.anchor)})}function NN(e,t){let n=e.model.document,r=e.editing.view,i=n.selection.getLastPosition(),a=i.nodeAfter;return t||!n.selection.isCollapsed||!i.isAtStart||!IN(a)?!1:(e.model.change(t=>{e.execute(`enter`);let r=n.selection.anchor.parent.previousSibling;t.rename(r,AN),t.setSelection(r,`in`),e.model.schema.removeDisallowedAttributes([r],t),t.remove(a)}),r.scrollToTheSelection(),!0)}function PN(e,t){let n=e.model,r=n.document,i=e.editing.view,a=r.selection.getLastPosition(),o=a.nodeBefore,s;if(t||!r.selection.isCollapsed||!a.isAtEnd||!o||!o.previousSibling)return!1;if(IN(o)&&IN(o.previousSibling))s=n.createRange(n.createPositionBefore(o.previousSibling),n.createPositionAfter(o));else if(FN(o)&&IN(o.previousSibling)&&IN(o.previousSibling.previousSibling))s=n.createRange(n.createPositionBefore(o.previousSibling.previousSibling),n.createPositionAfter(o));else if(FN(o)&&IN(o.previousSibling)&&FN(o.previousSibling.previousSibling)&&o.previousSibling.previousSibling&&IN(o.previousSibling.previousSibling.previousSibling))s=n.createRange(n.createPositionBefore(o.previousSibling.previousSibling.previousSibling),n.createPositionAfter(o));else return!1;return e.model.change(t=>{t.remove(s),e.execute(`enter`);let n=r.selection.anchor.parent;t.rename(n,AN),e.model.schema.removeDisallowedAttributes([n],t)}),i.scrollToTheSelection(),!0}function FN(e){return e&&e.is(`$text`)&&!e.data.match(/\S/)}function IN(e){return e&&e.is(`element`,`softBreak`)}var LN=class extends F{static get pluginName(){return`CodeBlockUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.t,n=e.ui.componentFactory,r=dN(e),i=this._getLanguageListItemDefinitions(r),a=e.commands.get(`codeBlock`);n.add(`codeBlock`,n=>{let r=Nx(n,Mx),o=r.buttonView,s=t(`Insert code block`);return o.set({label:s,tooltip:!0,icon:d_,isToggleable:!0}),o.bind(`isOn`).to(a,`value`,e=>!!e),o.on(`execute`,()=>{e.execute(`codeBlock`,{usePreviousLanguageChoice:!0}),e.editing.view.focus()}),r.on(`execute`,t=>{e.execute(`codeBlock`,{language:t.source._codeBlockLanguage,forceValue:!0}),e.editing.view.focus()}),r.class=`ck-code-block-dropdown`,r.bind(`isEnabled`).to(a),Lx(r,i,{role:`menu`,ariaLabel:s}),r}),n.add(`menuBar:codeBlock`,n=>{let r=new uw(n);r.buttonView.set({role:`menuitem`,label:t(`Code block`),icon:d_}),r.bind(`isEnabled`).to(a);let o=new dw(n);o.set({ariaLabel:t(`Insert code block`)});for(let t of i){let i=new rC(n,r),s=new U(n);s.bind(...Object.keys(t.model)).to(t.model),s.set({isToggleable:!0,role:`menuitemcheckbox`}),s.delegate(`execute`).to(r),s.on(`execute`,()=>{e.execute(`codeBlock`,{language:t.model._codeBlockLanguage,forceValue:a.value!=t.model._codeBlockLanguage}),e.editing.view.focus()}),i.children.add(s),o.items.add(i)}return r.panelView.children.add(o),r})}_getLanguageListItemDefinitions(e){let t=this.editor.commands.get(`codeBlock`),n=new Fi;for(let r of e){let e={type:`button`,model:new RC({_codeBlockLanguage:r.language,label:r.label,role:`menuitemradio`,withText:!0})};e.model.bind(`isOn`).to(t,`value`,t=>t===e.model._codeBlockLanguage),n.add(e)}return n}},RN=class extends F{static get requires(){return[jN,LN]}static get pluginName(){return`CodeBlock`}static get isOfficialPlugin(){return!0}},zN=class extends F{_uploadGateway;static get pluginName(){return`CloudServicesUploadAdapter`}static get isOfficialPlugin(){return!0}static get requires(){return[BM,bw]}init(){let e=this.editor,t=e.plugins.get(BM),n=t.token,r=t.uploadUrl;if(!n)return;let i=e.plugins.get(`CloudServicesCore`);this._uploadGateway=i.createUploadGateway(n,r),e.plugins.get(bw).createUploadAdapter=e=>new BN(this._uploadGateway,e)}},BN=class{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()}},VN=class extends F{static get pluginName(){return`EasyImage`}static get isOfficialPlugin(){return!0}static get requires(){return[zN,nj]}init(){let e=this.editor;!e.plugins.has(`ImageBlockEditing`)&&!e.plugins.has(`ImageInlineEditing`)&&T(`easy-image-image-feature-missing`,e)}},HN=class extends TC{view;constructor(e,t){super(e),this.view=t}get element(){return this.view.editable.element}init(){let e=this.editor,t=this.view,n=e.editing.view,r=t.editable,i=n.document.getRoot();r.name=i.rootName,r.isInlineRoot=!Cg(e,i.rootName),t.render();let a=r.element;this.setEditableElement(r.name,a),r.bind(`isFocused`).to(this.focusTracker),n.attachDomRoot(a),this._initPlaceholder(),this.initMenuBar(this.view.menuBarView),this.fire(`ready`)}destroy(){super.destroy();let e=this.view,t=this.editor.editing.view;t.getDomRoot(e.editable.name)&&t.detachDomRoot(e.editable.name),e.destroy()}_initPlaceholder(){let e=this.editor,t=e.editing.view,n=t.document.getRoot(),r=e.config.get(`roots`)[n.rootName].placeholder;r&&(n.placeholder=r),yo({view:t,element:n,isDirectHost:this.view.editable.isInlineRoot,keepOnFocus:!0})}},UN=class extends DC{editable;menuBarView;constructor(e,t,n,r){super(e),this.editable=new jC(e,t,n,{label:r}),this.menuBarView=new gw(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)}};const WN=sg(rg);var GN=class extends WN{static get editorName(){return`BalloonEditor`}ui;constructor(e,t={}){let{sourceElementOrData:n,editorConfig:r}=fg(e,t);super(r),dg(n,this.config);let i=this.config.get(`roots`).main.element;KN(i)&&(this.sourceElement=i,cg(this,i));let a=this.config.get(`plugins`);a.push(nw),this.config.set(`plugins`,a),this.config.define(`balloonToolbar`,this.config.get(`toolbar`)),this.model.document.createRoot(this.config.get(`roots`).main.modelElement),ug(this);let o=new UN(this.locale,this.editing.view,i,this.config.get(`roots`).main.label);this.ui=new HN(this,o),ag(this)}async destroy(){let e=this.getData();this.ui.destroy(),await super.destroy(),this.sourceElement&&this.updateSourceElement(e)}static async create(e,t={}){let n=new this(e,t);return await n.initPlugins(),Sg(n),await n.ui.init(),await n.data.init(n.config.get(`roots`).main.initialData),n.fire(`ready`),n}};function KN(e){return jn(e)}var qN=class extends TC{view;_toolbarConfig;_elementReplacer;constructor(e,t){super(e),this.view=t,this._toolbarConfig=Ex(e.config.get(`toolbar`)),this._elementReplacer=new lr,this.listenTo(e.editing.view,`scrollToTheSelection`,this._handleScrollToTheSelectionWithStickyPanel.bind(this))}get element(){return this.view.element}init(e){let t=this.editor,n=this.view,r=t.editing.view,i=n.editable,a=r.document.getRoot();i.name=a.rootName,i.isInlineRoot=!Cg(t,a.rootName),n.render();let o=i.element;this.setEditableElement(i.name,o),n.editable.bind(`isFocused`).to(this.focusTracker),r.attachDomRoot(o),e&&this._elementReplacer.replace(e,this.element),this._initPlaceholder(),this._initToolbar(),n.menuBarView&&this.initMenuBar(n.menuBarView),this._initDialogPluginIntegration(),this._initContextualBalloonIntegration(),this.fire(`ready`)}destroy(){super.destroy();let e=this.view,t=this.editor.editing.view;this._elementReplacer.restore(),t.getDomRoot(e.editable.name)&&t.detachDomRoot(e.editable.name),e.destroy()}_initToolbar(){let 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(){let e=this.editor,t=e.editing.view,n=t.document.getRoot(),r=e.sourceElement,i,a=e.config.get(`roots`)[this.view.editable.name].placeholder;a&&(i=a),!i&&r&&r.tagName.toLowerCase()===`textarea`&&(i=r.getAttribute(`placeholder`)),i&&(n.placeholder=i),yo({view:t,element:n,isDirectHost:this.view.editable.isInlineRoot,keepOnFocus:!0})}_initContextualBalloonIntegration(){if(!this.editor.plugins.has(`ContextualBalloon`))return;let{stickyPanel:e}=this.view,t=this.editor.plugins.get(`ContextualBalloon`);t.on(`getPositionOptions`,t=>{let n=t.return;if(!n||!e.isSticky||!e.element)return;let r=new O(e.element).height,i=typeof n.target==`function`?n.target():n.target,a=typeof n.limiter==`function`?n.limiter():n.limiter;if(i&&a&&new O(i).height>=new O(a).height-r)return;let o={...n.viewportOffsetConfig},s=(o.top||0)+r;t.return={...n,viewportOffsetConfig:{...o,top:s}}},{priority:`low`});let n=()=>{t.visibleView&&t.updatePosition()};this.listenTo(e,`change:isSticky`,n),this.listenTo(this.editor.ui,`change:viewportOffset`,n)}_handleScrollToTheSelectionWithStickyPanel(e,t,n){let r=this.view.stickyPanel;if(r.isSticky){let e=new O(r.element).height;t.viewportOffset.top+=e}else{let e=()=>{this.editor.editing.view.scrollToTheSelection(n)};this.listenTo(r,`change:isSticky`,e),setTimeout(()=>{this.stopListening(r,`change:isSticky`,e)},20)}}_initDialogPluginIntegration(){if(!this.editor.plugins.has(`Dialog`))return;let e=this.view.stickyPanel,t=this.editor.plugins.get(`Dialog`);t.on(`show`,()=>{let n=t.view;n.on(`moveTo`,(t,r)=>{if(!e.isSticky||n.wasMoved||n.isModal)return;let i=new O(e.contentPanelElement);r[1]<i.bottom+Zy.defaultOffset&&(r[1]=i.bottom+Zy.defaultOffset)},{priority:`high`})},{priority:`low`})}},JN=class extends OC{stickyPanel;toolbar;editable;constructor(e,t,n={}){super(e),this.stickyPanel=new WC(e),this.toolbar=new Ox(e,{shouldGroupWhenFull:n.shouldToolbarGroupWhenFull}),n.useMenuBar&&(this.menuBarView=new gw(e)),this.editable=new jC(e,t,n.editableElement,{label:n.label})}render(){super.render(),this.menuBarView?this.stickyPanel.content.addMany([this.menuBarView,this.toolbar]):this.stickyPanel.content.add(this.toolbar),this.top.add(this.stickyPanel),this.main.add(this.editable)}};const YN=sg(rg);var XN=class extends YN{static get editorName(){return`ClassicEditor`}ui;constructor(e,t={}){let{sourceElementOrData:n,editorConfig:r}=fg(e,t);super(r),dg(n,this.config,`main`,!0);let i=this.config.get(`attachTo`);if(this.config.define(`menuBar.isVisible`,!1),ZN(i)){if(!i.isConnected)throw new w(`editor-source-element-not-attached`,null);this.sourceElement=i}this.model.document.createRoot(this.config.get(`roots`).main.modelElement),ug(this);let a=!this.config.get(`toolbar.shouldNotGroupWhenFull`),o=this.config.get(`menuBar`),s=this.config.get(`roots`).main.element,c=new JN(this.locale,this.editing.view,{shouldToolbarGroupWhenFull:a,useMenuBar:o.isVisible,label:this.config.get(`roots`).main.label,editableElement:s});this.ui=new qN(this,c),ag(this)}async destroy(){this.sourceElement&&this.updateSourceElement(),this.ui.destroy(),await super.destroy()}static async create(e,t={}){let n=new this(e,t);return await n.initPlugins(),Sg(n),await n.ui.init(n.config.get(`attachTo`)||null),await n.data.init(n.config.get(`roots`).main.initialData),n.fire(`ready`),n}};function ZN(e){return jn(e)}var QN=class extends TC{view;constructor(e,t){super(e),this.view=t}init(){let e=this.editor,t=this.view,n=e.editing.view,r=t.editable,i=n.document.getRoot();r.name=i.rootName,r.isInlineRoot=!Cg(e,i.rootName),t.render();let a=r.element;this.setEditableElement(r.name,a),t.editable.bind(`isFocused`).to(this.focusTracker),n.attachDomRoot(a),this._initPlaceholder(),this._initToolbar(),this.initMenuBar(this.view.menuBarView),this.fire(`ready`)}destroy(){super.destroy();let e=this.view,t=this.editor.editing.view;t.getDomRoot(e.editable.name)&&t.detachDomRoot(e.editable.name),e.destroy()}_initToolbar(){let e=this.editor,t=this.view;t.toolbar.fillFromConfig(e.config.get(`toolbar`),this.componentFactory),this.addToolbar(t.toolbar)}_initPlaceholder(){let e=this.editor,t=e.editing.view,n=t.document.getRoot(),r=e.config.get(`roots`)[n.rootName].placeholder;r&&(n.placeholder=r),yo({view:t,element:n,isDirectHost:this.view.editable.isInlineRoot,keepOnFocus:!0})}},$N=class extends DC{toolbar;editable;menuBarView;constructor(e,t,n={}){super(e),this.toolbar=new Ox(e,{shouldGroupWhenFull:n.shouldToolbarGroupWhenFull}),this.menuBarView=new gw(e),this.editable=new jC(e,t,n.editableElement,{label:n.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])}};const eP=sg(rg);var tP=class extends eP{static get editorName(){return`DecoupledEditor`}ui;constructor(e,t={}){let{sourceElementOrData:n,editorConfig:r}=fg(e,t);super(r),dg(n,this.config);let i=this.config.get(`roots`).main.element;nP(i)&&(this.sourceElement=i,cg(this,i)),this.model.document.createRoot(this.config.get(`roots`).main.modelElement),ug(this);let a=!this.config.get(`toolbar.shouldNotGroupWhenFull`),o=new $N(this.locale,this.editing.view,{editableElement:i,shouldToolbarGroupWhenFull:a,label:this.config.get(`roots`).main.label});this.ui=new QN(this,o)}async destroy(){let e=this.getData();this.ui.destroy(),await super.destroy(),this.sourceElement&&this.updateSourceElement(e)}static async create(e,t={}){let n=new this(e,t);return await n.initPlugins(),Sg(n),await n.ui.init(),await n.data.init(n.config.get(`roots`).main.initialData),n.fire(`ready`),n}};function nP(e){return jn(e)}var rP=class extends TC{view;_toolbarConfig;constructor(e,t){super(e),this.view=t,this._toolbarConfig=Ex(e.config.get(`toolbar`))}get element(){return this.view.editable.element}init(){let e=this.editor,t=this.view,n=e.editing.view,r=t.editable,i=n.document.getRoot();r.name=i.rootName,r.isInlineRoot=!Cg(e,i.rootName),t.render();let a=r.element;this.setEditableElement(r.name,a),r.bind(`isFocused`).to(this.focusTracker),n.attachDomRoot(a),this._initPlaceholder(),this._initToolbar(),t.menuBarView&&this.initMenuBar(t.menuBarView),this.fire(`ready`)}destroy(){super.destroy();let e=this.view,t=this.editor.editing.view;t.getDomRoot(e.editable.name)&&t.detachDomRoot(e.editable.name),e.destroy()}_initToolbar(){let e=this.editor,t=this.view,n=t.editable.element,r=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:n,positions:t.panelPositions})}),r.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(r)}_initPlaceholder(){let e=this.editor,t=e.editing.view,n=t.document.getRoot(),r=e.config.get(`roots`)[n.rootName].placeholder;r&&(n.placeholder=r),yo({view:t,element:n,isDirectHost:this.view.editable.isInlineRoot,keepOnFocus:!0})}};const iP=Wr(`px`);var aP=class extends DC{toolbar;panel;panelPositions;editable;_resizeObserver;constructor(e,t,n,r={}){super(e),this.toolbar=new Ox(e,{shouldGroupWhenFull:r.shouldToolbarGroupWhenFull,isFloating:!0}),r.useMenuBar&&(this.menuBarView=new gw(e)),this.set(`viewportTopOffset`,0),this.panel=new ab(e),this.panelPositions=this._getPanelPositions(),this.panel.extendTemplate({attributes:{class:`ck-toolbar-container`}}),this.editable=new jC(e,t,n,{label:r.label}),this._resizeObserver=null}render(){if(super.render(),this.body.add(this.panel),this.registerChild(this.editable),this.menuBarView?this.panel.content.addMany([this.menuBarView,this.toolbar]):this.panel.content.add(this.toolbar),this.toolbar.options.shouldGroupWhenFull){let e=this.editable.element;this._resizeObserver=new Hr(e,()=>{this.toolbar.maxWidth=iP(new O(e).width)})}}destroy(){super.destroy(),this._resizeObserver&&this._resizeObserver.destroy()}_getPanelPositionTop(e,t){let n;return n=e.top>t.height+this.viewportTopOffset?e.top-t.height:e.bottom>t.height+this.viewportTopOffset+50?this.viewportTopOffset:e.bottom,n}_getPanelPositions(){let e=[(e,t)=>({top:this._getPanelPositionTop(e,t),left:e.left,name:`toolbar_west`,config:{withArrow:!1}}),(e,t)=>({top:this._getPanelPositionTop(e,t),left:e.left+e.width-t.width,name:`toolbar_east`,config:{withArrow:!1}})];return this.locale.uiLanguageDirection===`ltr`?e:e.reverse()}};const oP=sg(rg);var sP=class extends oP{static get editorName(){return`InlineEditor`}ui;constructor(e,t={}){let{sourceElementOrData:n,editorConfig:r}=fg(e,t);super(r),dg(n,this.config);let i=this.config.get(`roots`).main.element;cP(i)&&(this.sourceElement=i,cg(this,i)),this.config.define(`menuBar.isVisible`,!1),this.model.document.createRoot(this.config.get(`roots`).main.modelElement),ug(this);let a=!this.config.get(`toolbar.shouldNotGroupWhenFull`),o=this.config.get(`menuBar`),s=new aP(this.locale,this.editing.view,i,{shouldToolbarGroupWhenFull:a,useMenuBar:o.isVisible,label:this.config.get(`roots`).main.label});this.ui=new rP(this,s),ag(this)}async destroy(){let e=this.getData();this.ui.destroy(),await super.destroy(),this.sourceElement&&this.updateSourceElement(e)}static async create(e,t={}){let n=new this(e,t);return await n.initPlugins(),Sg(n),await n.ui.init(),await n.data.init(n.config.get(`roots`).main.initialData),n.fire(`ready`),n}};function cP(e){return jn(e)}var lP=class extends TC{view;_lastFocusedEditableElement;constructor(e,t){super(e),this.view=t,this._lastFocusedEditableElement=null}init(){let e=this.view,t=this.editor;for(let e of Object.values(this.view.editables))e.isInlineRoot=!Cg(t,e.name);e.render(),this.focusTracker.on(`change:focusedElement`,(e,t,n)=>{for(let e of Object.values(this.view.editables))n===e.element&&(this._lastFocusedEditableElement=e.element)}),this.focusTracker.on(`change:isFocused`,(e,t,n)=>{n||(this._lastFocusedEditableElement=null)});for(let e of Object.values(this.view.editables))this.addEditable(e);this._initToolbar(),this.initMenuBar(this.view.menuBarView),this.fire(`ready`)}addEditable(e,t){let n=e.element;this.editor.editing.view.attachDomRoot(n,e.name),this.setEditableElement(e.name,n),e.bind(`isFocused`).to(this.focusTracker,`isFocused`,this.focusTracker,`focusedElement`,(e,t)=>e?t===n?!0:this._lastFocusedEditableElement===n:!1),this._initPlaceholder(e,t)}removeEditable(e){let t=this.editor.editing.view;t.getDomRoot(e.name)&&t.detachDomRoot(e.name),e.unbind(`isFocused`),this.removeEditableElement(e.name)}destroy(){super.destroy();for(let e of Object.values(this.view.editables))this.removeEditable(e);this.view.destroy()}_initToolbar(){let e=this.editor,t=this.view;t.toolbar.fillFromConfig(e.config.get(`toolbar`),this.componentFactory),this.addToolbar(t.toolbar)}_initPlaceholder(e,t){t||=this.editor.config.get(`roots`)[e.name]?.placeholder;let n=this.editor.editing.view,r=n.document.getRoot(e.name);t&&(r.placeholder=t),yo({view:n,element:r,isDirectHost:e.isInlineRoot,keepOnFocus:!0})}},uP=class extends DC{toolbar;editables;editable;menuBarView;_editingView;constructor(e,t,n,r={}){super(e),this._editingView=t,this.toolbar=new Ox(e,{shouldGroupWhenFull:r.shouldToolbarGroupWhenFull}),this.menuBarView=new gw(e),this.editables={};for(let e of n){let t=r.editableElements?.[e],{label:n}=r;typeof n==`object`&&(n=n[e]),this.createEditable(e,t,n)}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,n){let r=new jC(this.locale,this._editingView,t,{label:n});return this.editables[e]=r,r.name=e,this.isRendered&&this.registerChild(r),r}removeEditable(e){let 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)}},dP=class extends rg{static get editorName(){return`MultiRootEditor`}ui;sourceElements;_readOnlyRootLocks=new Map;constructor(e,t={}){let{sourceElementsOrData:n,editorConfig:r}=pg(e,t);if(super(r),dg(n,this.config,!1),mP(this.config),hP(this.config),this.config.get(`lazyRoots`))throw new w(`multi-root-editor-root-deprecated-config-lazy-roots`,null);let i=Object.entries(this.config.get(`roots`));this.sourceElements={};let a={};for(let[e,t]of i){let n=vP(t);n&&(_P(n)&&(this.sourceElements[e]=n,cg(this,n)),a[e]=n)}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,n,r)=>{let i=this.editing.view.createRangeIn(t);for(let e of i.getItems())e.is(`editableElement`)&&(e.unbind(`isReadOnly`),e.isReadOnly=r)})});for(let[e,t]of i){let n=this.model.document.createRoot(t.modelElement,e);t.lazyLoad&&(n._isLoaded=!1)}this.registerRootAttribute(`$rootEditableOptions`),ug(this);let o={shouldToolbarGroupWhenFull:!this.config.get(`toolbar.shouldNotGroupWhenFull`),editableElements:a,label:pP(this.config.get(`roots`),`label`)},s=new uP(this.locale,this.editing.view,fP(i),o);this.ui=new lP(this,s),this.model.document.on(`change:data`,()=>{let e=this.model.document.differ.getChangedRoots();for(let t of e){let e=this.model.document.getRoot(t.name);t.state==`detached`&&this.fire(`detachRoot`,e)}for(let t of e){let e=this.model.document.getRoot(t.name);t.state==`attached`&&this.fire(`addRoot`,e)}}),this.listenTo(this.model,`canEditAt`,(e,[t])=>{if(!t)return;let n=!1;for(let e of t.getRanges()){let t=e.root;if(this._readOnlyRootLocks.has(t.rootName)){n=!0;break}}n&&(e.return=!1,e.stop())},{priority:`high`}),this.decorate(`loadRoot`),this.on(`loadRoot`,(e,[t])=>{let n=this.model.document.getRoot(t);if(!n)throw new w(`multi-root-editor-load-root-no-root`,this,{rootName:t});n._isLoaded&&(T(`multi-root-editor-load-root-already-loaded`),e.stop())},{priority:`highest`}),c(this);function c(e){let t=ca(e.config.get(`licenseKey`));t&&ua(t,`MRE`)&&(e.enableReadOnlyMode(Symbol(`invalidLicense`)),e._showLicenseError(`featureNotAllowed`,`Multi-root editor`))}}async destroy(){let e=this.config.get(`updateSourceElementOnDestroy`),t={};for(let n of Object.keys(this.sourceElements))t[n]=e?this.getData({rootName:n}):``;this.ui.destroy(),await super.destroy();for(let e of Object.keys(this.sourceElements))Ur(this.sourceElements[e],t[e])}addRoot(e,t={}){let n=t.initialData||t.data||``,r={...t.modelAttributes||t.attributes},i=t.modelElement||t.elementName||`$root`;if(!this.model.schema.isLimit(i))throw new w(`multi-root-editor-add-root-element-is-not-limit`,this,{rootName:e,elementName:i});_P(t.element)&&T(`multi-root-editor-add-root-element-option-ignored`),gP(r,t),t.description!=null&&!(`$description`in r)&&(r.$description=t.description),t.title!=null&&!(`$title`in r)&&(r.$title=t.title);let a=t=>{let a=t.addRoot(e,i);n&&t.insert(this.data.parse(n,a),a,0);for(let e of Object.keys(r))this.registerRootAttribute(e),t.setAttribute(e,r[e],a)};t.isUndoable?this.model.change(a):this.model.enqueueChange({isUndoable:!1},a)}detachRoot(e,t=!1){t?this.model.change(t=>t.detachRoot(e)):this.model.enqueueChange({isUndoable:!1},t=>t.detachRoot(e))}createEditable(e,t,n){let r,i;!t||typeof t==`string`?r=t:(r=t?.placeholder,n=t?.label,i=t?.element);let a=e.getAttribute(`$rootEditableOptions`)||{},o=vg(i||a.element),s=this.ui.view.createEditable(e.rootName,o,n||a.label);return s.isInlineRoot=!Cg(this,e.rootName),this.ui.addEditable(s,r||a.placeholder),this.editing.view.forceRender(),s.element}detachEditable(e){let t=e.rootName,n=this.ui.view.editables[t];return this.ui.removeEditable(n),this.ui.view.removeEditable(t),n.element}loadRoot(e,{data:t=``,attributes:n={}}={}){let r=this.model.document.getRoot(e);this.model.enqueueChange({isUndoable:!1},e=>{t&&e.insert(this.data.parse(t,r),r,0);for(let t of Object.keys(n))this.registerRootAttribute(t),e.setAttribute(t,n[t],r);r._isLoaded=!0,this.model.document.differ._bufferRootLoad(r)})}getFullData(e){let t={};for(let n of this.model.document.getRootNames())t[n]=this.data.get({...e,rootName:n});return t}getRootsAttributes(){let e={};for(let t of this.model.document.getRootNames())e[t]=this.getRootAttributes(t);return e}disableRoot(e,t){if(e==`$graveyard`)throw new w(`multi-root-editor-cannot-disable-graveyard-root`,this);let n=this._readOnlyRootLocks.get(e);if(n)n.add(t);else{this._readOnlyRootLocks.set(e,new Set([t]));let n=this.editing.view.document.getRoot(e);n.isReadOnly=!0,Array.from(this.commands.commands()).forEach(e=>e.affectsData&&e.refresh())}}enableRoot(e,t){let n=this._readOnlyRootLocks.get(e);if(!(!n||!n.has(t)))if(n.size===1){this._readOnlyRootLocks.delete(e);let t=this.editing.view.document.getRoot(e);t.isReadOnly=this.isReadOnly,Array.from(this.commands.commands()).forEach(e=>e.affectsData&&e.refresh())}else n.delete(t)}static async create(e,t={}){let n=new this(e,t);await n.initPlugins(),Sg(n),await n.ui.init();let r=pP(n.config.get(`roots`),`initialData`);return n._verifyRootsWithInitialData(r),await n.data.init(r),n.fire(`ready`),n}_verifyRootsWithInitialData(e){for(let t of this.model.document.getRootNames())if(!(t in e))throw new w(`multi-root-editor-root-initial-data-mismatch`,null);for(let t of Object.keys(e)){let e=this.model.document.getRoot(t);if(!e||!e.isAttached())throw new w(`multi-root-editor-root-initial-data-mismatch`,null)}}};function fP(e){return e.filter(([,{lazyLoad:e}])=>!e).map(([e])=>e)}function pP(e,t){return Object.fromEntries(Object.entries(e).filter(([,e])=>!e.lazyLoad).map(([e,n])=>[e,n[t]]).filter(([,e])=>e!==void 0))}function mP(e){if(e.get(`rootsAttributes`)){let t=e.get(`rootsAttributes`),n=e.get(`roots`);for(let[r,i]of Object.entries(t)){let t=n[r];if(!t)throw new w(`multi-root-editor-root-attributes-no-root`,null);if(Object.keys(t.modelAttributes||{}).length)throw new w(`multi-root-editor-root-attributes-conflict`,null);e.set(`roots.${r}.modelAttributes`,i)}}}function hP(e){let t=e.get(`roots`);for(let[n,r]of Object.entries(t)){if(r.modelAttributes?.$rootEditableOptions)continue;let t={...r.modelAttributes};gP(t,r),e.set(`roots.${n}.modelAttributes`,t)}}function gP(e,{placeholder:t,label:n,element:r}){if(`$rootEditableOptions`in e)return;let i=_P(r)?void 0:vg(r);e.$rootEditableOptions={...t&&{placeholder:t},...n&&{label:n},...i&&{element:i}}}function _P(e){return jn(e)}function vP(e){let t=e.modelAttributes?.$rootEditableOptions;return vg(e.element||t?.element)}const yP={"(":`)`,"[":`]`,"{":`}`};var bP=class extends I{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}refresh(){let e=this.editor.model,t=e.document;this.isEnabled=e.schema.checkAttributeInSelection(t.selection,`mention`)}execute(e){let t=this.editor.model,n=t.document.selection,r=typeof e.mention==`string`?{id:e.mention}:e.mention,i=r.id,a=e.range||n.getFirstRange();if(!t.canEditAt(a))return;let o=e.text||i,s=SP({_text:o,id:i},r);if(!i.startsWith(e.marker))throw new w(`mentioncommand-incorrect-id`,this);t.change(e=>{let r=Ui(n.getAttributes()),i=new Map(r.entries());i.set(`mention`,s);let c=t.insertContent(e.createText(o,i),a),l=c.start.nodeBefore,u=c.end.nodeAfter,d=u&&u.is(`$text`)&&u.data.startsWith(` `),f=!1;if(l&&u&&l.is(`$text`)&&u.is(`$text`)){let e=l.data.slice(-1),t=e in yP,n=t&&u.data.startsWith(yP[e]);f=t&&n}!f&&!d&&t.insertContent(e.createText(` `,r),a.start.getShiftedBy(o.length))})}},xP=class extends F{static get pluginName(){return`MentionEditing`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.model,n=t.document;t.schema.extend(`$text`,{allowAttributes:`mention`}),t.schema.addAttributeCheck(e=>{if(e.endsWith(`codeBlock $text`))return!1},`mention`),e.conversion.for(`upcast`).elementToAttribute({view:{name:`span`,attributes:`data-mention`,classes:`mention`},model:{key:`mention`,value:e=>CP(e)}}),e.conversion.for(`downcast`).attributeToElement({model:`mention`,view:TP}),e.conversion.for(`downcast`).add(wP),n.registerPostFixer(e=>OP(e,n,t.schema)),n.registerPostFixer(e=>kP(e,n)),n.registerPostFixer(e=>EP(e,n)),e.commands.add(`mention`,new bP(e))}};function SP(e,t){return Object.assign({uid:he().slice(0,8)},e,t||{})}function CP(e,t){let n=e.getAttribute(`data-mention`),r=e.getChild(0);if(!r)return;let i=e.getAttribute(`data-mention-uid`);return SP({id:n,_text:r.data},i?{uid:i,...t}:t)}function wP(e){e.on(`attribute:mention`,(e,t,n)=>{let r=t.attributeNewValue;if(!t.item.is(`$textProxy`)||!r)return;let i=t.range.start;(i.textNode||i.nodeAfter).data!=r._text&&n.consumable.consume(t.item,e.name)},{priority:`highest`})}function TP(e,{writer:t,options:n}){if(e)return t.createAttributeElement(`span`,{class:`mention`,"data-mention":e.id,...!n.isClipboardPipeline&&{"data-mention-uid":e.uid}},{id:e.uid,priority:20})}function EP(e,t){let n=t.selection,r=n.focus;return n.isCollapsed&&n.hasAttribute(`mention`)&&DP(r)?(e.removeSelectionAttribute(`mention`),!0):!1}function DP(e){let t=e.isAtStart;return e.nodeBefore&&e.nodeBefore.is(`$text`)||t}function OP(e,t,n){let r=t.differ.getChanges(),i=!1;for(let t of r){if(t.type==`attribute`)continue;let r=t.position;if(t.name==`$text`){let t=r.textNode&&r.textNode.nextSibling;i=jP(r.textNode,e)||i,i=jP(t,e)||i,i=jP(r.nodeBefore,e)||i,i=jP(r.nodeAfter,e)||i}if(t.name!=`$text`&&t.type==`insert`){let t=r.nodeAfter;for(let n of e.createRangeIn(t).getItems())i=jP(n,e)||i}if(t.type==`insert`&&n.isInline(t.name)){let t=r.nodeAfter&&r.nodeAfter.nextSibling;i=jP(r.nodeBefore,e)||i,i=jP(t,e)||i}}return i}function kP(e,t){let n=t.differ.getChanges(),r=!1;for(let t of n)if(t.type===`attribute`&&t.attributeKey!=`mention`){let n=t.range.start.nodeBefore,i=t.range.end.nodeAfter;for(let a of[n,i])AP(a)&&a.getAttribute(t.attributeKey)!=t.attributeNewValue&&(e.setAttribute(t.attributeKey,t.attributeNewValue,a),r=!0)}return r}function AP(e){return!e||!(e.is(`$text`)||e.is(`$textProxy`))||!e.hasAttribute(`mention`)?!1:e.data!=e.getAttribute(`mention`)._text}function jP(e,t){return AP(e)?(t.removeAttribute(`mention`,e),!0):!1}var MP=class extends mx{selected;position;constructor(e){super(e),this.extendTemplate({attributes:{class:[`ck-mentions`],tabindex:`-1`}})}selectFirst(){this.select(0)}selectNext(){let e=this.selected,t=this.items.getIndex(e);this.select(t+1)}selectPrevious(){let 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);let n=this.items.get(t);this.selected!==n&&(this.selected&&this.selected.removeHighlight(),n.highlight(),this.selected=n,this._isItemVisibleInScrolledArea(n)||(this.element.scrollTop=n.element.offsetTop))}executeSelected(){this.selected.fire(`execute`)}_isItemVisibleInScrolledArea(e){return new O(this.element).contains(new O(e.element))}},NP=class extends P{domElement;constructor(e,t){super(e),this.template=void 0,this.domElement=t,this.domElement.classList.add(`ck-button`),this.set(`isOn`,!1),this.on(`change:isOn`,(e,t,n)=>{n?(this.domElement.classList.add(`ck-on`),this.domElement.classList.remove(`ck-off`)):(this.domElement.classList.add(`ck-off`),this.domElement.classList.remove(`ck-on`))}),this.listenTo(this.domElement,`click`,()=>{this.fire(`execute`)})}render(){super.render(),this.element=this.domElement}focus(){this.domElement.focus()}},PP=class extends dx{item;marker;highlight(){let e=this.children.first;e.isOn=!0}removeHighlight(){let e=this.children.first;e.isOn=!1}};const FP=[k.arrowup,k.arrowdown,k.esc],IP=[k.enter,k.tab];var LP=class extends F{_mentionsView;_mentionsConfigurations;_balloon;_items=new Fi;_lastRequested;_requestFeedDebounced;static get pluginName(){return`MentionUI`}static get isOfficialPlugin(){return!0}static get requires(){return[BC]}constructor(e){super(e),this._mentionsView=this._createMentionView(),this._mentionsConfigurations=new Map,this._requestFeedDebounced=Kt(this._requestFeed,100),e.config.define(`mention`,{feeds:[]})}init(){let e=this.editor,t=e.config.get(`mention.commitKeys`)||IP,n=FP.concat(t);this._balloon=e.plugins.get(BC),e.editing.view.document.on(`keydown`,(e,n)=>{i(n.keyCode)&&this._isUIVisible&&(n.preventDefault(),e.stop(),n.keyCode==k.arrowdown&&this._mentionsView.selectNext(),n.keyCode==k.arrowup&&this._mentionsView.selectPrevious(),t.includes(n.keyCode)&&this._mentionsView.executeSelected(),n.keyCode==k.esc&&this._hideUIAndRemoveMarker())},{priority:`highest`}),Ya({emitter:this._mentionsView,activator:()=>this._isUIVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUIAndRemoveMarker()});let r=e.config.get(`mention.feeds`);for(let e of r){let{feed:t,marker:n,dropdownLimit:r}=e;if(!KP(n))throw new w(`mentionconfig-incorrect-marker`,null,{marker:n});let i={marker:n,feedCallback:typeof t==`function`?t.bind(this.editor):UP(t),itemRenderer:e.itemRenderer,dropdownLimit:r};this._mentionsConfigurations.set(n,i)}this._setupTextWatcher(r),this.listenTo(e,`change:isReadOnly`,()=>{this._hideUIAndRemoveMarker()}),this.on(`requestFeed:response`,(e,t)=>this._handleFeedResponse(t)),this.on(`requestFeed:error`,()=>this._hideUIAndRemoveMarker());function i(e){return n.includes(e)}}destroy(){super.destroy(),this._mentionsView.destroy()}get _isUIVisible(){return this._balloon.visibleView===this._mentionsView}_createMentionView(){let e=this.editor.locale,t=new MP(e);return t.items.bindTo(this._items).using(n=>{let{item:r,marker:i}=n,{dropdownLimit:a}=this._mentionsConfigurations.get(i),o=a||this.editor.config.get(`mention.dropdownLimit`)||10;if(t.items.length>=o)return null;let s=new PP(e),c=this._renderItem(r,i);return c.delegate(`execute`).to(s),s.children.add(c),s.item=r,s.marker=i,s.on(`execute`,()=>{t.fire(`execute`,{item:r,marker:i})}),s}),t.on(`execute`,(e,t)=>{let n=this.editor,r=n.model,i=t.item,a=t.marker,o=n.model.markers.get(`mention`),s=r.createPositionAt(r.document.selection.focus),c=r.createPositionAt(o.getStart()),l=r.createRange(c,s);this._hideUIAndRemoveMarker(),n.execute(`mention`,{mention:i,text:i.text,marker:a,range:l}),n.editing.view.focus()}),t}_getItemRenderer(e){let{itemRenderer:t}=this._mentionsConfigurations.get(e);return t}_requestFeed(e,t){this._lastRequested=t;let{feedCallback:n}=this._mentionsConfigurations.get(e),r=n(t);if(!(r instanceof Promise)){this.fire(`requestFeed:response`,{feed:r,marker:e,feedText:t});return}r.then(n=>{this._lastRequested==t?this.fire(`requestFeed:response`,{feed:n,marker:e,feedText:t}):this.fire(`requestFeed:discarded`,{feed:n,marker:e,feedText:t})}).catch(t=>{this.fire(`requestFeed:error`,{error:t}),T(`mention-feed-callback-error`,{marker:e})})}_setupTextWatcher(e){let t=this.editor,n=e.map(e=>({...e,pattern:BP(e.marker,e.minimumCharacters||0)})),r=new yT(t.model,VP(n));r.on(`matched`,(e,r)=>{let i=zP(n,r.text),a=t.model.document.selection.focus,o=t.model.createPositionAt(a.parent,i.position);if(WP(a)||GP(o)){this._hideUIAndRemoveMarker();return}let s=HP(i,r.text),c=i.marker.length+s.length,l=a.getShiftedBy(-c),u=a.getShiftedBy(-s.length),d=t.model.createRange(l,u);if(qP(t)){let 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:!1,affectsData:!1})});this._requestFeedDebounced(i.marker,s)}),r.on(`unmatched`,()=>{this._hideUIAndRemoveMarker()});let i=t.commands.get(`mention`);return r.bind(`isEnabled`).to(i),r}_handleFeedResponse(e){let{feed:t,marker:n}=e;if(!qP(this.editor))return;if(!this.editor.commands.get(`mention`).isEnabled){this._hideUIAndRemoveMarker();return}this._items.clear();for(let e of t){let t=typeof e==`object`?e:{id:e,text:e};this._items.add({item:t,marker:n})}let r=this.editor.model.markers.get(`mention`);this._items.length?this._showOrUpdateUI(r):this._hideUIAndRemoveMarker()}_showOrUpdateUI(e){this._isUIVisible?this._balloon.updatePosition(this._getBalloonPanelPositionData(e,this._mentionsView.position)):this._balloon.add({view:this._mentionsView,position:this._getBalloonPanelPositionData(e,this._mentionsView.position),singleViewMode:!0,balloonClassName:`ck-mention-balloon`}),this._mentionsView.position=this._balloon.view.position,this._mentionsView.selectFirst()}_hideUIAndRemoveMarker(){this._balloon.hasView(this._mentionsView)&&this._balloon.remove(this._mentionsView),qP(this.editor)&&this.editor.model.change(e=>e.removeMarker(`mention`)),this._mentionsView.position=void 0}_renderItem(e,t){let n=this.editor,r,i=e.id,a=this._getItemRenderer(t);if(a){let t=a(e);typeof t==`string`?i=t:r=new NP(n.locale,t)}if(!r){let e=new H(n.locale);e.label=i,e.withText=!0,r=e}return r}_getBalloonPanelPositionData(e,t){let n=this.editor,r=n.editing,i=r.view.domConverter,a=r.mapper,o=n.locale.uiLanguageDirection;return{target:()=>{let t=e.getRange();t.start.root.rootName==`$graveyard`&&(t=n.model.document.selection.getFirstRange());let r=a.toViewRange(t);return O.getDomRangeRects(i.viewRangeToDom(r)).pop()},limiter:()=>{let e=this.editor.editing.view,t=e.document.selection.editableElement;return t?e.domConverter.mapViewToDom(t.root):null},positions:RP(t,o)}}};function RP(e,t){let n={caret_se:e=>({top:e.bottom+3,left:e.right,name:`caret_se`,config:{withArrow:!1}}),caret_ne:(e,t)=>({top:e.top-t.height-3,left:e.right,name:`caret_ne`,config:{withArrow:!1}}),caret_sw:(e,t)=>({top:e.bottom+3,left:e.right-t.width,name:`caret_sw`,config:{withArrow:!1}}),caret_nw:(e,t)=>({top:e.top-t.height-3,left:e.right-t.width,name:`caret_nw`,config:{withArrow:!1}})};return Object.prototype.hasOwnProperty.call(n,e)?[n[e]]:t===`rtl`?[n.caret_sw,n.caret_se,n.caret_nw,n.caret_ne]:[n.caret_se,n.caret_sw,n.caret_ne,n.caret_nw]}function zP(e,t){let n;for(let r of e){let e=t.lastIndexOf(r.marker);e>0&&!t.substring(e-1).match(r.pattern)||(!n||e>=n.position)&&(n={marker:r.marker,position:e,minimumCharacters:r.minimumCharacters,pattern:r.pattern})}return n}function BP(e,t){let n=t==0?`*`:`{${t},}`,r=p.features.isRegExpUnicodePropertySupported?`\\p{Ps}\\p{Pi}"'`:`\\(\\[{"'`;e=e.replace(/[.*+?^${}()\-|[\]\\]/g,`\\$&`);let i=`(?:^|[ ${r}])(${e})(.${n})$`;return new RegExp(i,`u`)}function VP(e){return t=>{let n=zP(e,t);if(!n)return!1;let r=0;n.position!==0&&(r=n.position-1);let i=t.substring(r);return n.pattern.test(i)}}function HP(e,t){let n=0;e.position!==0&&(n=e.position-1);let r=BP(e.marker,0);return t.substring(n).match(r)[2]}function UP(e){return t=>e.filter(e=>(typeof e==`string`?e:String(e.id)).toLowerCase().includes(t.toLowerCase()))}function WP(e){let t=e.textNode&&e.textNode.hasAttribute(`mention`),n=e.nodeBefore;return t||n&&n.is(`$text`)&&n.hasAttribute(`mention`)}function GP(e){let t=e.nodeAfter;return t&&t.is(`$text`)&&t.hasAttribute(`mention`)}function KP(e){return!!e}function qP(e){return e.model.markers.has(`mention`)}var JP=class extends F{toMentionAttribute(e,t){return CP(e,t)}static get pluginName(){return`Mention`}static get isOfficialPlugin(){return!0}static get requires(){return[xP,LP]}},YP=o(((e,t)=>{((e,n)=>{typeof define==`function`&&define.amd?define([],n):typeof t==`object`&&t.exports?t.exports=n():e.fuzzysort=n()})(e,e=>{var t=(e,t)=>{if(!e||!t)return de;var n=p(e);se(t)||(t=f(t));var r=n.bitflags;return(r&t._bitflags)===r?h(n,t):de},n=(e,t,n)=>{if(!e)return n?.all?m(t,n):ue;var r=p(e),i=r.bitflags,a=r.containsSpace,o=u(n?.threshold||0),c=n?.limit||ce,l=0,d=0,g=t.length;function _(e){l<c?(pe.add(e),++l):(++d,e._score>pe.peek()._score&&pe.replaceTop(e))}if(n?.key)for(var v=n.key,y=0;y<g;++y){var ee=t[y],b=oe(ee,v);if(b&&(se(b)||(b=f(b)),(i&b._bitflags)===i)){var x=h(r,b);x!==de&&(x._score<o||(x.obj=ee,_(x)))}}else if(n?.keys){var te=n.keys,ne=te.length;outer:for(var y=0;y<g;++y){for(var ee=t[y],re=0,me=0;me<ne;++me){var v=te[me],b=oe(ee,v);if(!b){ie[me]=fe;continue}se(b)||(b=f(b)),ie[me]=b,re|=b._bitflags}if((i&re)===i){if(a)for(let e=0;e<r.spaceSearches.length;e++)S[e]=le;for(var me=0;me<ne;++me){if(b=ie[me],b===fe){ae[me]=fe;continue}if(ae[me]=h(r,b,!1,a),ae[me]===de){ae[me]=fe;continue}if(a)for(let e=0;e<r.spaceSearches.length;e++){if(C[e]>-1e3&&S[e]>le){var he=(S[e]+C[e])/4;he>S[e]&&(S[e]=he)}C[e]>S[e]&&(S[e]=C[e])}}if(a){for(let e=0;e<r.spaceSearches.length;e++)if(S[e]===le)continue outer}else{var ge=!1;for(let e=0;e<ne;e++)if(ae[e]._score!==le){ge=!0;break}if(!ge)continue}var _e=new s(ne);for(let e=0;e<ne;e++)_e[e]=ae[e];if(a){var ve=0;for(let e=0;e<r.spaceSearches.length;e++)ve+=S[e]}else{var ve=le;for(let e=0;e<ne;e++){var x=_e[e];if(x._score>-1e3&&ve>le){var he=(ve+x._score)/4;he>ve&&(ve=he)}x._score>ve&&(ve=x._score)}}if(_e.obj=ee,_e._score=ve,n?.scoreFn){if(ve=n.scoreFn(_e),!ve)continue;ve=u(ve),_e._score=ve}ve<o||_(_e)}}}else for(var y=0;y<g;++y){var b=t[y];if(b&&(se(b)||(b=f(b)),(i&b._bitflags)===i)){var x=h(r,b);x!==de&&(x._score<o||_(x))}}if(l===0)return ue;for(var w=Array(l),y=l-1;y>=0;--y)w[y]=pe.poll();return w.total=l+d,w},r=(e,t=`<b>`,n=`</b>`)=>{for(var r=typeof t==`function`?t:void 0,i=e.target,a=i.length,o=e.indexes,s=``,c=0,l=0,u=!1,d=[],f=0;f<a;++f){var p=i[f];if(o[l]===f){if(++l,u||(u=!0,r?(d.push(s),s=``):s+=t),l===o.length){r?(s+=p,d.push(r(s,c++)),s=``,d.push(i.substr(f+1))):s+=p+n+i.substr(f+1);break}}else u&&(u=!1,r?(d.push(r(s,c++)),s=``):s+=n);s+=p}return r?d:s},i=e=>{typeof e==`number`?e=``+e:typeof e!=`string`&&(e=``);var t=v(e);return c(e,{_targetLower:t._lower,_targetLowerCodes:t.lowerCodes,_bitflags:t.bitflags})},a=()=>{b.clear(),x.clear()};class o{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 r(this,e,t)}get score(){return l(this._score)}set score(e){this._score=u(e)}}class s extends Array{get score(){return l(this._score)}set score(e){this._score=u(e)}}var c=(e,t)=>{let n=new o;return n.target=e,n.obj=t.obj??de,n._score=t._score??le,n._indexes=t._indexes??[],n._targetLower=t._targetLower??``,n._targetLowerCodes=t._targetLowerCodes??de,n._nextBeginningIndexes=t._nextBeginningIndexes??de,n._bitflags=t._bitflags??0,n},l=e=>e===le?0:e>1?e:Math.E**(((-e+1)**.04307-1)*-2),u=e=>e===0?le:e>1?e:1-(Math.log(e)/-2+1)**(1/.04307),d=e=>{typeof e==`number`?e=``+e:typeof e!=`string`&&(e=``),e=e.trim();var t=v(e),n=[];if(t.containsSpace){var r=e.split(/\s+/);r=[...new Set(r)];for(var i=0;i<r.length;i++)if(r[i]!==``){var a=v(r[i]);n.push({lowerCodes:a.lowerCodes,_lower:r[i].toLowerCase(),containsSpace:!1})}}return{lowerCodes:t.lowerCodes,_lower:t._lower,containsSpace:t.containsSpace,bitflags:t.bitflags,spaceSearches:n}},f=e=>{if(e.length>999)return i(e);var t=b.get(e);return t===void 0?(t=i(e),b.set(e,t),t):t},p=e=>{if(e.length>999)return d(e);var t=x.get(e);return t===void 0?(t=d(e),x.set(e,t),t):t},m=(e,t)=>{var n=[];n.total=e.length;var r=t?.limit||ce;if(t?.key)for(var i=0;i<e.length;i++){var a=e[i],o=oe(a,t.key);if(o!=de){se(o)||(o=f(o));var l=c(o.target,{_score:o._score,obj:a});if(n.push(l),n.length>=r)return n}}else if(t?.keys)for(var i=0;i<e.length;i++){for(var a=e[i],u=new s(t.keys.length),d=t.keys.length-1;d>=0;--d){var o=oe(a,t.keys[d]);if(!o){u[d]=fe;continue}se(o)||(o=f(o)),o._score=le,o._indexes.len=0,u[d]=o}if(u.obj=a,u._score=le,n.push(u),n.length>=r)return n}else for(var i=0;i<e.length;i++){var o=e[i];if(o!=de&&(se(o)||(o=f(o)),o._score=le,o._indexes.len=0,n.push(o),n.length>=r))return n}return n},h=(e,t,n=!1,r=!1)=>{if(n===!1&&e.containsSpace)return g(e,t,r);for(var i=e._lower,a=e.lowerCodes,s=a[0],c=t._targetLowerCodes,l=a.length,u=c.length,d=0,f=0,p=0;;){var m=s===c[f];if(m){if(te[p++]=f,++d,d===l)break;s=a[d]}if(++f,f>=u)return de}var d=0,h=!1,_=0,v=t._nextBeginningIndexes;v===de&&(v=t._nextBeginningIndexes=ee(t.target)),f=te[0]===0?0:v[te[0]-1];var y=0;if(f!==u)for(;;)if(f>=u){if(d<=0||(++y,y>200))break;--d;var b=ne[--_];f=v[b]}else{var m=a[d]===c[f];if(m){if(ne[_++]=f,++d,d===l){h=!0;break}++f}else f=v[f]}var x=l<=1?-1:t._targetLower.indexOf(i,te[0]),re=!!~x,S=re?x===0||t._nextBeginningIndexes[x-1]===x:!1;if(re&&!S){for(var C=0;C<v.length;C=v[C])if(!(C<=x)){for(var ie=0;ie<l&&a[ie]===t._targetLowerCodes[C+ie];ie++);if(ie===l){x=C,S=!0;break}}}var ae=e=>{for(var t=0,n=0,r=1;r<l;++r)e[r]-e[r-1]!==1&&(t-=e[r],++n);var i=e[l-1]-e[0]-(l-1);if(t-=(12+i)*n,e[0]!==0&&(t-=e[0]*e[0]*.2),!h)t*=1e3;else{for(var a=1,r=v[0];r<u;r=v[r])++a;a>24&&(t*=(a-24)*10)}return t-=(u-l)/2,re&&(t/=1+l*l*1),S&&(t/=1+l*l*1),t-=(u-l)/2,t};if(!h){if(re)for(var C=0;C<l;++C)te[C]=x+C;var oe=te,se=ae(oe)}else if(S){for(var C=0;C<l;++C)te[C]=x+C;var oe=te,se=ae(te)}else var oe=ne,se=ae(ne);t._score=se;for(var C=0;C<l;++C)t._indexes[C]=oe[C];t._indexes.len=l;let ce=new o;return ce.target=t.target,ce._score=t._score,ce._indexes=t._indexes,ce},g=(e,t,n)=>{for(var r=new Set,i=0,a=de,o=0,s=e.spaceSearches,c=s.length,l=0,u=()=>{for(let e=l-1;e>=0;e--)t._nextBeginningIndexes[re[e*2+0]]=re[e*2+1]},d=!1,f=0;f<c;++f){C[f]=le;var p=s[f];if(a=h(p,t),n){if(a===de)continue;d=!0}else if(a===de)return u(),de;if(f!==c-1){var m=a._indexes,g=!0;for(let e=0;e<m.len-1;e++)if(m[e+1]-m[e]!==1){g=!1;break}if(g){var _=m[m.len-1]+1,v=t._nextBeginningIndexes[_-1];for(let e=_-1;e>=0&&v===t._nextBeginningIndexes[e];e--)t._nextBeginningIndexes[e]=_,re[l*2+0]=e,re[l*2+1]=v,l++}}i+=a._score/c,C[f]=a._score/c,a._indexes[0]<o&&(i-=(o-a._indexes[0])*2),o=a._indexes[0];for(var y=0;y<a._indexes.len;++y)r.add(a._indexes[y])}if(n&&!d)return de;u();var ee=h(e,t,!0);if(ee!==de&&ee._score>i){if(n)for(var f=0;f<c;++f)C[f]=ee._score/c;return ee}n&&(a=t),a._score=i;var f=0;for(let e of r)a._indexes[f++]=e;return a._indexes.len=f,a},_=e=>e.replace(/\p{Script=Latin}+/gu,e=>e.normalize(`NFD`)).replace(/[\u0300-\u036f]/g,``),v=e=>{e=_(e);for(var t=e.length,n=e.toLowerCase(),r=[],i=0,a=!1,o=0;o<t;++o){var s=r[o]=n.charCodeAt(o);if(s===32){a=!0;continue}var c=s>=97&&s<=122?s-97:s>=48&&s<=57?26:s<=127?30:31;i|=1<<c}return{lowerCodes:r,bitflags:i,containsSpace:a,_lower:n}},y=e=>{for(var t=e.length,n=[],r=0,i=!1,a=!1,o=0;o<t;++o){var s=e.charCodeAt(o),c=s>=65&&s<=90,l=c||s>=97&&s<=122||s>=48&&s<=57,u=c&&!i||!a||!l;i=c,a=l,u&&(n[r++]=o)}return n},ee=e=>{e=_(e);for(var t=e.length,n=y(e),r=[],i=n[0],a=0,o=0;o<t;++o)i>o?r[o]=i:(i=n[++a],r[o]=i===void 0?t:i);return r},b=new Map,x=new Map,te=[],ne=[],re=[],S=[],C=[],ie=[],ae=[],oe=(e,t)=>{var n=e[t];if(n!==void 0)return n;if(typeof t==`function`)return t(e);var r=t;Array.isArray(t)||(r=t.split(`.`));for(var i=r.length,a=-1;e&&++a<i;)e=e[r[a]];return e},se=e=>typeof e==`object`&&typeof e._bitflags==`number`,ce=1/0,le=-ce,ue=[];ue.total=0;var de=null,fe=i(``),pe=(e=>{var t=[],n=0,r={},i=e=>{for(var r=0,i=t[r],a=1;a<n;){var o=a+1;r=a,o<n&&t[o]._score<t[a]._score&&(r=o),t[r-1>>1]=t[r],a=1+(r<<1)}for(var s=r-1>>1;r>0&&i._score<t[s]._score;s=(r=s)-1>>1)t[r]=t[s];t[r]=i};return r.add=(e=>{var r=n;t[n++]=e;for(var i=r-1>>1;r>0&&e._score<t[i]._score;i=(r=i)-1>>1)t[r]=t[i];t[r]=e}),r.poll=(e=>{if(n!==0){var r=t[0];return t[0]=t[--n],i(),r}}),r.peek=(e=>{if(n!==0)return t[0]}),r.replaceTop=(e=>{t[0]=e,i()}),r})();return{single:t,go:n,prepare:i,cleanup:a}})}));function XP(e){let t=ZP();if(!t)return!1;t.font=`12px 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,20,22);let n=t.getImageData(0,0,20,25).data,r=n.length,i=0;for(;i<r&&!n[i+3];i+=4);if(i>=r)return!1;let a=20+i/4%20,o=Math.floor(i/4/20),s=t.getImageData(a,o,1,1).data;return!(n[i]!==s[0]||n[i+2]!==s[2]||t.measureText(e).width>=20)}function ZP(){try{return document.createElement(`canvas`).getContext(`2d`,{willReadFrequently:!0})}catch{return null}}const QP={0:`default`,1:`light`,2:`medium-light`,3:`medium`,4:`medium-dark`,5:`dark`},$P={"🪎":17,"🫩":16,"🫨":15.1,"🫠":14,"😶‍🌫️":13.1,"🧑‍💻":12.1,"🥰":11,"🤪":5,"⚕️":4,"🤣":3,"👋🏽":2,"😀":1,"😐":.7,"😂":.6};var eF=class e extends F{_emojiCanvas=null;static get pluginName(){return`EmojiUtils`}static get isOfficialPlugin(){return!0}init(){this._emojiCanvas=document.createElement(`canvas`).getContext(`2d`)}isEmojiSupported(e,t,n){return e.version<=t?this.hasZwj(e.emoji)?this.isEmojiZwjSupported(e,n):!0:!1}getEmojiSupportedVersionByOs(){for(let[t,n]of Object.entries($P))if(e._isEmojiSupported(t))return n;return 0}hasZwj(e){return e.includes(``)}isEmojiZwjSupported(e,t){return this.getNodeWidthUsingCanvas(t,e.emoji)<24*1.8?!0:this.getNodeWidth(t,e.emoji)<24*1.8}getNodeWidth(e,t){let n=document.createElement(`span`);n.textContent=t,e.appendChild(n);let r=n.offsetWidth;return e.removeChild(n),r}getNodeWidthUsingCanvas(e,t){let n=getComputedStyle(e);return this._emojiCanvas.font=[n.fontStyle,n.fontVariant,n.fontWeight,`24px`,`"Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", ${n.fontFamily}`].join(` `),Math.ceil(this._emojiCanvas.measureText(t).width)}createEmojiWidthTestingContainer(){let 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){let t={...e,skins:{default:e.emoji}};return e.skins&&e.skins.forEach(e=>{let n=QP[e.tone];t.skins[n]=e.emoji}),t}isEmojiCategoryAllowed(e){return e.group!==2}static _isEmojiSupported=XP},tF=class{_cache=new Map;async fetch({url:e,cacheKeys:t,transform:n}){let r=nF(e,t);if(this._cache.has(r))return this._cache.get(r).promise;let i=fetch(e,{cache:`force-cache`}).then(e=>e.ok?e.json():Promise.resolve([])).then(e=>n(e)).catch(()=>(this._cache.delete(r),[]));return this._cache.set(r,rF(i)),i}getSync({url:e,cacheKeys:t}){let n=this._cache.get(nF(e,t));return!n||n.status!==`fulfilled`?null:n.value}clear(){this._cache.clear()}};function nF(e,t){return[e,...t].join(`|`)}function rF(e){let t={promise:e,status:`pending`,value:void 0};return e.then(e=>{Object.assign(t,{status:`fulfilled`,value:e})}),t}var iF=l(YP(),1),aF=class e extends F{_url;static get requires(){return[eF]}static get pluginName(){return`EmojiRepository`}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(`emoji`,{version:void 0,skinTone:`default`,definitionsUrl:void 0,useCustomFont:!1}),this.set(`isRepositoryReady`,null),this._url=this._getUrl()}init(){this._warnAboutCdnUse(),e._cache.fetch({url:this._url.toString(),cacheKeys:this._cacheKeys,transform:e=>this._normalizeEmoji(e)}).then(()=>{if(this.editor.state===`destroyed`)return;let e=!!this._getItems();e||T(`emoji-repository-empty`),this.isRepositoryReady=e})}onReady(e){if(this.editor.state!==`destroyed`){if(this.isRepositoryReady!==null){e(this.isRepositoryReady);return}this.once(`change:isRepositoryReady`,(t,n,r)=>{e(!!r)})}}getEmojiByQuery(e){let t=this._getItems();return!t||!e.split(/\s/).filter(Boolean).some(e=>e.length>=2)?[]:iF.default.go(e,t,{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(){let e=this._getItems();if(!e)return[];let{t}=this.editor.locale,n=[{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}],r=Wt(e,e=>e.group);return n.map(e=>({...e,items:r[e.groupId]}))}getSkinTones(){let{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 new Promise((e,t)=>{let n=()=>t(Error(`The editor was destroyed before the emoji repository finished loading.`));this.editor.state===`destroyed`?n():(this.onReady(e),this.editor.once(`destroy`,n))})}_getUrl(){let{definitionsUrl:e,version:t}=this.editor.config.get(`emoji`);if(!e||e===`cdn`){let e=t||16,n=new URL(`https://cdn.ckeditor.com/ckeditor5/data/emoji/{version}/en.json`.replace(`{version}`,e.toString()));return n.searchParams.set(`editorVersion`,Ce),n}return t&&T(`emoji-repository-redundant-version`),new URL(e)}_warnAboutCdnUse(){let e=this.editor,t=e.config.get(`emoji`),n=e.config.get(`licenseKey`),r=window[Symbol.for(`cke distribution`)];n!==`GPL`&&r!==`cloud`&&(t&&t.definitionsUrl||T(`emoji-repository-cdn-use`))}_getItems(){let t=e._cache.getSync({url:this._url.toString(),cacheKeys:this._cacheKeys});return t&&t.length?t:null}_normalizeEmoji(e){let t=this.editor,n=t.config.get(`emoji.useCustomFont`),r=t.plugins.get(`EmojiUtils`),i=e.filter(e=>r.isEmojiCategoryAllowed(e));if(n)return i.map(e=>r.normalizeEmojiSkinTone(e));let a=r.getEmojiSupportedVersionByOs(),o=r.createEmojiWidthTestingContainer();document.body.appendChild(o);let s=i.filter(e=>r.isEmojiSupported(e,a,o)).map(e=>r.normalizeEmojiSkinTone(e));return o.remove(),s}get _cacheKeys(){return[`useCustomFont:${!!this.editor.config.get(`emoji.useCustomFont`)}`]}static _cache=new tF};const oF=`:__EMOJI_SHOW_ALL:`,sF=`:__EMOJI_HINT:`;var cF=class extends F{_emojiDropdownLimit;_skinTone;static get requires(){return[aF,gT,JP]}static get pluginName(){return`EmojiMention`}static get isOfficialPlugin(){return!0}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){let t=e.config.get(`mergeFields.prefix`),n=e.config.get(`mention.feeds`),r=t?t[0]===`:`:!1;if(n.filter(e=>!e._isEmojiMarker).some(e=>e.marker===`:`)||r){T(`emoji-config-marker-already-used`,{marker:`:`});return}if(n.some(e=>e._isEmojiMarker))return;let i={_isEmojiMarker:!0,marker:`:`,dropdownLimit:this._emojiDropdownLimit,itemRenderer:this._customItemRendererFactory(this.editor.t),feed:this._queryEmojiCallbackFactory()};this.editor.config.set(`mention.feeds`,[...n,i])}init(){let{editor:e}=this;this.emojiPickerPlugin=e.plugins.has(`EmojiPicker`)?e.plugins.get(`EmojiPicker`):null,this.emojiRepositoryPlugin=e.plugins.get(`EmojiRepository`),this._overrideMentionExecuteListener()}_customItemRendererFactory(e){return t=>{let n=document.createElement(`button`);n.classList.add(`ck`),n.classList.add(`ck-button`),n.classList.add(`ck-button_with-text`),n.id=`mention-list-item-id${t.id.slice(0,-1)}`,n.type=`button`,n.tabIndex=-1;let r=document.createElement(`span`);return r.classList.add(`ck`),r.classList.add(`ck-button__label`),n.appendChild(r),t.id===sF?(n.classList.add(`ck-list-item-button`),n.classList.add(`ck-disabled`),r.textContent=e(`Keep on typing to see the emoji.`)):t.id===oF?r.textContent=e(`Show all emoji...`):r.textContent=`${t.text} ${t.id}`,n}}_overrideMentionExecuteListener(){let{editor:e}=this;e.commands.get(`mention`).on(`execute`,(t,n)=>{if(!this.emojiRepositoryPlugin.isRepositoryReady)return;let r=n[0];if(r.marker===`:`&&(t.stop(),r.mention.id!==sF))if(r.mention.id===oF){let t=[...r.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(r.range))});let n=this.emojiPickerPlugin;n.showUI(t.slice(1)),setTimeout(()=>{n.emojiPickerView.focus()})}else e.execute(`insertText`,{text:r.mention.text,range:r.range})},{priority:`high`})}_queryEmojiCallbackFactory(){return e=>{if(e.startsWith(` `)||e.startsWith(`:`)||!this.emojiRepositoryPlugin.isRepositoryReady)return[];let 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);let n={id:e.length>1?oF:sF};return[...t.slice(0,this._emojiDropdownLimit-1),n]}}},lF=class extends I{constructor(e){super(e);let t=e.plugins.get(`EmojiRepository`);this.listenTo(t,`change:isRepositoryReady`,()=>this.refresh())}refresh(){let e=this.editor,t=e.plugins.get(`EmojiRepository`),n=e.model,r=n.schema,i=n.document.selection;this.isEnabled=!!t.isRepositoryReady&&r.checkChild(i.getFirstPosition(),`$text`)}execute(e=``){this.editor.plugins.get(`EmojiPicker`).showUI(e)}},uF=class extends P{tiles;focusTracker;keystrokes;emojiCategories;cachedTiles;_getEmojiByQuery;constructor(e,{categoryName:t,emojiCategories:n,getEmojiByQuery:r,skinTone:i}){super(e),this.set(`isEmpty`,!0),this.set(`categoryName`,t),this.set(`skinTone`,i),this.tiles=this.createCollection(),this.cachedTiles=this.createCollection(),this.focusTracker=new M,this.keystrokes=new N,this._getEmojiByQuery=r,this.emojiCategories=n;let a=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`,a.if(`isEmpty`,`ck-hidden`,e=>e)]}}),$a({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.tiles,numberOfColumns:()=>u.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(){let e=this.tiles.first;e&&e.focus()}filter(e){let{matchingItems:t,allItems:n}=e?this._getItemsByQuery(e.source):this._getItemsByCategory();return this._updateGrid(t),this.set(`isEmpty`,t.length===0),{resultsCount:t.length,totalItemsCount:n.length}}_getItemsByQuery(e){return{matchingItems:this._getEmojiByQuery(e),allItems:this.emojiCategories.flatMap(e=>e.items)}}_getItemsByCategory(){let e=this.emojiCategories.find(e=>e.title===this.categoryName);if(!e)return{matchingItems:[],allItems:[]};let{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=>{let 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){let n=new H(this.locale);return n.viewUid=e,n.extendTemplate({attributes:{class:[`ck-emoji__tile`]}}),n.set({label:e,tooltip:t,withText:!0,ariaLabel:t,ariaLabelledBy:void 0}),n.on(`execute`,()=>{this.fire(`execute`,{name:t,emoji:e})}),this.cachedTiles.add(n),n}},dF=class extends P{focusTracker;keystrokes;focusCycler;buttonViews;constructor(e,{emojiCategories:t,categoryName:n}){super(e),this.buttonViews=this.createCollection(t.map(e=>this._createCategoryButton(e))),this.focusTracker=new M,this.keystrokes=new N,this.focusCycler=new Hy({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,n,r)=>{let i=this.buttonViews.find(e=>e.tooltip===r);i&&(i.isOn=!1);let a=this.buttonViews.find(e=>e.tooltip===n);a&&(a.isOn=!0)}),this.set(`categoryName`,n)}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()}setCategories(e){for(let e of this.buttonViews)this.focusTracker.remove(e),e.destroy();this.buttonViews.clear();for(let t of e){let e=this._createCategoryButton(t);this.buttonViews.add(e),this.isRendered&&this.focusTracker.add(e)}}enableCategories(){this.buttonViews.forEach(e=>{e.isEnabled=!0})}disableCategories(){this.buttonViews.forEach(e=>{e.set({class:``,isEnabled:!1,isOn:!1})})}_createCategoryButton(e){let t=new H,n=t.bindTemplate;return t.extendTemplate({attributes:{"aria-selected":n.to(`isOn`,e=>e.toString()),class:[`ck-emoji__category-item`]}}),t.set({ariaLabel:e.title,label:e.icon,role:`tab`,tooltip:e.title,withText:!0,ariaLabelledBy:void 0}),t.on(`execute`,()=>{this.categoryName=e.title}),t.on(`change:isEnabled`,()=>{t.isEnabled&&t.tooltip===this.categoryName&&(t.isOn=!0)}),t}},fF=class extends P{inputView;gridView;constructor(e,{gridView:t,resultsView:n}){super(e),this.gridView=t;let r=e.t;this.inputView=new JC(this.locale,{queryView:{label:r(`Find an emoji (min. 2 characters)`),creator:Jx},filteredView:this.gridView,infoView:{instance:n}}),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){let t=e?new RegExp(Bn(e),`ig`):null,n=this.gridView.filter(t);this.inputView.fire(`search`,{query:e,...n})}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()}},pF=class extends P{dropdownView;_skinTones;constructor(e,{skinTone:t,skinTones:n}){super(e),this.set(`skinTone`,t),this._skinTones=n;let r=e.t,i=r(`Select skin tone`),a=Nx(e),o=new Fi;for(let{id:e,icon:t,tooltip:n}of this._skinTones){let r={type:`button`,model:new RC({value:e,label:t,ariaLabel:n,tooltip:n,tooltipPosition:`e`,role:`menuitemradio`,withText:!0,ariaLabelledBy:void 0})};r.model.bind(`isOn`).to(this,`skinTone`,t=>t===e),o.add(r)}Lx(a,o,{ariaLabel:i,role:`menu`}),a.buttonView.set({label:this._getSkinTone().icon,ariaLabel:i,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:i}),this.dropdownView=a,this.listenTo(a,`execute`,e=>{this.skinTone=e.source.value}),a.buttonView.bind(`label`).to(this,`skinTone`,()=>this._getSkinTone().icon),a.buttonView.bind(`ariaLabel`).to(this,`skinTone`,()=>`${this._getSkinTone().tooltip}, ${i}`),this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-emoji__skin-tone`]},children:[a]})}focus(){this.dropdownView.buttonView.focus()}_getSkinTone(){return this._skinTones.find(e=>e.id===this.skinTone)}},mF=class extends P{items;focusTracker;keystrokes;focusCycler;searchView;toneView;categoriesView;gridView;infoView;constructor(e,{emojiCategories:t,getEmojiByQuery:n,skinTone:r,skinTones:i}){super(e);let a=t[0]?.title??``;this.gridView=new uF(e,{categoryName:a,emojiCategories:t,getEmojiByQuery:n,skinTone:r}),this.infoView=new KC,this.searchView=new fF(e,{gridView:this.gridView,resultsView:this.infoView}),this.categoriesView=new dF(e,{emojiCategories:t,categoryName:a}),this.toneView=new pF(e,{skinTone:r,skinTones:i}),this.items=this.createCollection([this.searchView,this.toneView,this.categoriesView,this.gridView,this.infoView]),this.focusTracker=new M,this.keystrokes=new N,this.focusCycler=new Hy({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()}setCategories(e){let{emojiCategories:t}=this.gridView,n=e[0].title;t.splice(0,t.length,...e),this.categoriesView.setCategories(e),this.categoriesView.categoryName=n,this.gridView.categoryName=n,this.searchView.search(this.searchView.getInputValue())}_setupEventListeners(){let e=this.locale.t;this.searchView.on(`search`,(e,t)=>{t.query?this.categoriesView.disableCategories():this.categoriesView.enableCategories()}),this.searchView.on(`search`,(t,n)=>{this.categoriesView.buttonViews.length&&(n.query.length===1?this.infoView.set({primaryText:e(`Keep on typing to see the emoji.`),secondaryText:e(`The query must contain at least two characters.`),isVisible:!0}):n.resultsCount?this.infoView.set({isVisible:!1}):this.infoView.set({primaryText:e(`No emojis were found matching "%0".`,n.query),secondaryText:e(`Please try a different phrase or check the spelling.`),isVisible:!0}))}),this.searchView.on(`search`,()=>{this.fire(`update`),this.gridView.element.scrollTo(0,0)}),this.categoriesView.on(`change:categoryName`,(e,t,n)=>{this.gridView.categoryName=n,this.searchView.search(``)}),this.toneView.on(`change:skinTone`,(e,t,n)=>{this.gridView.skinTone=n,this.searchView.search(this.searchView.getInputValue())})}},hF=class extends P{backButtonView;focusTracker=new M;keystrokes=new N;children;_focusables=new pa;_focusCycler;constructor(e){super(e),this.backButtonView=this._createBackButton(),this.children=this.createCollection([this._createHeaderView()]),this._focusCycler=new Hy({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`],tabindex:`-1`},children:this.children})}render(){super.render(),[...this.children.filter(Wy),this.backButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element),Gy(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(){let e=this.locale.t,t=new H(this.locale);return t.set({class:`ck-button-back`,label:e(`Back`),icon:Wv,tooltip:!0}),t.delegate(`execute`).to(this,`cancel`),t}_createHeaderView(){let e=this.locale.t,t=new By(this.locale,{label:e(`Emoji picker`)});return t.children.add(this.backButtonView,0),t}};const gF=`emoji-picker`;var _F=class extends F{static get requires(){return[aF,BC,Qy,gT]}static get pluginName(){return`EmojiPicker`}static get isOfficialPlugin(){return!0}init(){let{editor:e}=this;this.balloonPlugin=e.plugins.get(`ContextualBalloon`),this.emojiRepositoryPlugin=e.plugins.get(`EmojiRepository`);let t=new lF(e);e.commands.add(`emoji`,t),e.ui.componentFactory.add(`emoji`,()=>{let e=this._createButton(H,t);return e.set({tooltip:!0}),e}),e.ui.componentFactory.add(`menuBar:emoji`,()=>this._createButton(U,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._createEmojiPickerView(),e&&this.emojiPickerView.searchView.setInputValue(e),this.emojiPickerView.searchView.search(e),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){let n=new e(this.editor.locale),r=this.editor.locale.t;return n.bind(`isEnabled`).to(t,`isEnabled`),n.set({label:r(`Emoji`),icon:x_,isToggleable:!0}),n.on(`execute`,()=>{this.editor.editing.view.scrollToTheSelection(),this.showUI()}),n}_createEmojiPickerView(){let e=[...this.emojiRepositoryPlugin.getEmojiCategories()],t=new mF(this.editor.locale,{emojiCategories:e,skinTone:this.editor.config.get(`emoji.skinTone`),skinTones:this.emojiRepositoryPlugin.getSkinTones(),getEmojiByQuery:e=>this.emojiRepositoryPlugin.getEmojiByQuery(e)});return this.emojiRepositoryPlugin.isRepositoryReady||this.emojiRepositoryPlugin.onReady(e=>{if(!e)return;let n=this.emojiRepositoryPlugin.getEmojiCategories();n.length&&t.setCategories(n)}),this.listenTo(t.gridView,`execute`,(e,t)=>{let n=this.editor,r=t.emoji;this._hideUI(),n.execute(`insertText`,{text:r})}),t}_createEmojiPickerFormView(){let e=new hF(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()}),Ya({emitter:e,contextElements:[this.balloonPlugin.view.element],callback:()=>{this._hideUI(!1)},activator:()=>this.balloonPlugin.visibleView===e}),e}_hideUI(e=!0){this.balloonPlugin.remove(this.emojiPickerFormView),this.emojiPickerView.searchView.setInputValue(``),e&&this.editor.editing.view.focus(),this._hideFakeVisualSelection()}_setupConversion(){let e=this.editor;e.conversion.for(`editingDowncast`).markerToHighlight({model:gF,view:{classes:[`ck-fake-emoji-selection`]}}),e.conversion.for(`editingDowncast`).markerToElement({model:gF,view:(e,{writer:t})=>{if(!e.markerRange.isCollapsed)return null;let n=t.createUIElement(`span`);return t.addClass([`ck-fake-emoji-selection`,`ck-fake-emoji-selection_collapsed`],n),n}})}_getBalloonPositionData(){let e=this.editor.editing.view,t=e.document;return{target:()=>e.domConverter.viewRangeToDom(t.selection.getFirstRange())}}_showFakeVisualSelection(){let e=this.editor.model;e.change(t=>{let n=e.document.selection.getFirstRange();if(e.markers.has(gF))t.updateMarker(gF,{range:n});else if(n.start.isAtEnd){let r=n.start.getLastMatchingPosition(({item:t})=>!e.schema.isContent(t),{boundaries:n});t.addMarker(gF,{usingOperation:!1,affectsData:!1,range:t.createRange(r,n.end)})}else t.addMarker(gF,{usingOperation:!1,affectsData:!1,range:n})})}_hideFakeVisualSelection(){let e=this.editor.model;e.markers.has(gF)&&e.change(e=>{e.removeMarker(gF)})}},tne=class extends F{static get requires(){return[cF,_F]}static get pluginName(){return`Emoji`}static get isOfficialPlugin(){return!0}},vF=class extends I{constructor(e){super(e),this.affectsData=!1}execute(){let e=this.editor.model,t=e.document.selection,n=e.schema.getLimitElement(t);if(t.containsEntireContent(n)||!yF(e.schema,n))do if(n=n.parent,!n)return;while(!yF(e.schema,n));e.change(e=>{e.setSelection(n,`in`)})}};function yF(e,t){return e.isLimit(t)&&(e.checkChild(t,`$text`)||e.checkChild(t,`paragraph`))}const nne=yi(`Ctrl+A`);var bF=class extends F{static get pluginName(){return`SelectAllEditing`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.t,n=e.editing.view.document;e.commands.add(`selectAll`,new vF(e)),this.listenTo(n,`keydown`,(t,n)=>{vi(n)===nne&&(e.execute(`selectAll`),n.preventDefault())}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t(`Select all`),keystroke:`CTRL+A`}]})}},xF=class extends F{static get pluginName(){return`SelectAllUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.ui.componentFactory.add(`selectAll`,()=>{let e=this._createButton(H);return e.set({tooltip:!0}),e}),e.ui.componentFactory.add(`menuBar:selectAll`,()=>this._createButton(U))}_createButton(e){let t=this.editor,n=t.locale,r=t.commands.get(`selectAll`),i=new e(t.locale),a=n.t;return i.set({label:a(`Select all`),icon:ny,keystroke:`Ctrl+A`}),i.bind(`isEnabled`).to(r,`isEnabled`),this.listenTo(i,`execute`,()=>{t.execute(`selectAll`),t.editing.view.focus()}),i}},SF=class extends F{static get requires(){return[bF,xF]}static get pluginName(){return`SelectAll`}static get isOfficialPlugin(){return!0}},rne=class extends F{static get requires(){return[tb,PO,TE,SF,kE,gT,Ik]}static get pluginName(){return`Essentials`}static get isOfficialPlugin(){return!0}},CF=class extends P{children;_findInputView;_replaceInputView;_findButtonView;_findPrevButtonView;_findNextButtonView;_advancedOptionsCollapsibleView;_matchCaseSwitchView;_wholeWordsOnlySwitchView;_replaceButtonView;_replaceAllButtonView;_inputsDivView;_actionButtonsDivView;_focusTracker;_keystrokes;_focusables;focusCycler;constructor(e){super(e);let t=e.t;this.children=this.createCollection(),this.set(`matchCount`,0),this.set(`highlightOffset`,0),this.set(`isDirty`,!1),this.set(`_areCommandsEnabled`,{}),this.set(`_resultsCounterText`,``),this.set(`_matchCase`,!1),this.set(`_wholeWordsOnly`,!1),this.bind(`_searchResultsFound`).to(this,`matchCount`,this,`isDirty`,(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:Wv,keystroke:`Shift+F3`,tooltip:!0}),this._findNextButtonView=this._createButton({label:t(`Next result`),class:`ck-button-next`,icon:Wv,keystroke:`F3`,tooltip:!0}),this._replaceInputView=this._createInputField(t(`Replace with…`),`ck-labeled-field-replace`),this._inputsDivView=this._createInputsDiv(),this._matchCaseSwitchView=this._createMatchCaseSwitch(),this._wholeWordsOnlySwitchView=this._createWholeWordsOnlySwitch(),this._advancedOptionsCollapsibleView=this._createAdvancedOptionsCollapsible(),this._replaceAllButtonView=this._createButton({label:t(`Replace all`),class:`ck-button-replaceall`,withText:!0}),this._replaceButtonView=this._createButton({label:t(`Replace`),class:`ck-button-replace`,withText:!0}),this._findButtonView=this._createButton({label:t(`Find`),class:`ck-button-find ck-button-action`,withText:!0}),this._actionButtonsDivView=this._createActionButtonsDiv(),this._focusTracker=new M,this._keystrokes=new N,this._focusables=new pa,this.focusCycler=new Hy({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(),Qa({view:this}),this._initFocusCycling(),this._initKeystrokeHandling()}destroy(){super.destroy(),this._focusTracker.destroy(),this._keystrokes.destroy()}focus(e){e===-1?this.focusCycler.focusLast():this.focusCycler.focusFirst()}reset(){this._findInputView.errorText=null,this.isDirty=!0}get _textToFind(){return this._findInputView.fieldView.element.value}get _textToReplace(){return this._replaceInputView.fieldView.element.value}_createInputsDiv(){let e=this.locale,t=e.t,n=new P(e);return this._findInputView.fieldView.on(`input`,()=>{this.isDirty=!0}),this._findPrevButtonView.delegate(`execute`).to(this,`findPrevious`),this._findNextButtonView.delegate(`execute`).to(this,`findNext`),this._findPrevButtonView.bind(`isEnabled`).to(this,`_areCommandsEnabled`,({findPrevious: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,n)=>e||!n?``:t(`Tip: Find some text first in order to replace it.`)),n.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-find-and-replace-form__inputs`]},children:[this._findInputView,this._findPrevButtonView,this._findNextButtonView,this._replaceInputView]}),n}_onFindButtonExecute(){if(!this._textToFind){let e=this.t;this._findInputView.errorText=e(`Text to find must not be empty.`);return}this.isDirty=!1,this.fire(`findNext`,{searchText:this._textToFind,matchCase:this._matchCase,wholeWords:this._wholeWordsOnly})}_injectFindResultsCounter(){let e=this.locale,t=e.t,n=this.bindTemplate,r=new P(this.locale);this.bind(`_resultsCounterText`).to(this,`highlightOffset`,this,`matchCount`,(e,n)=>t(`%0 of %1`,[e,n])),r.setTemplate({tag:`span`,attributes:{class:[`ck`,`ck-results-counter`,n.if(`isDirty`,`ck-hidden`)]},children:[{text:n.to(`_resultsCounterText`)}]});let i=()=>{let t=this._findInputView.fieldView.element;if(!t||!Yr(t))return;let n=new O(r.element).width,i=e.uiLanguageDirection===`ltr`?`paddingRight`:`paddingLeft`;n?t.style[i]=`calc( 2 * var(--ck-spacing-standard) + ${n}px )`:t.style[i]=``};this.on(`change:_resultsCounterText`,i,{priority:`low`}),this.on(`change:isDirty`,i,{priority:`low`}),this._findInputView.template.children[0].children.push(r)}_createAdvancedOptionsCollapsible(){let e=this.locale.t,t=new xb(this.locale,[this._matchCaseSwitchView,this._wholeWordsOnlySwitchView]);return t.set({label:e(`Advanced options`),isCollapsed:!0}),t}_createActionButtonsDiv(){let e=new P(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(){let e=this.locale.t,t=new mb(this.locale);return t.set({label:e(`Match case`),withText:!0}),t.bind(`isOn`).to(this,`_matchCase`),t.on(`execute`,()=>{this._matchCase=!this._matchCase,this.isDirty=!0}),t}_createWholeWordsOnlySwitch(){let e=this.locale.t,t=new mb(this.locale);return t.set({label:e(`Whole words only`),withText:!0}),t.bind(`isOn`).to(this,`_wholeWordsOnly`),t.on(`execute`,()=>{this._wholeWordsOnly=!this._wholeWordsOnly,this.isDirty=!0}),t}_initFocusCycling(){[this._findInputView,this._findPrevButtonView,this._findNextButtonView,this._replaceInputView,this._advancedOptionsCollapsibleView.buttonView,this._matchCaseSwitchView,this._wholeWordsOnlySwitchView,this._replaceAllButtonView,this._replaceButtonView,this._findButtonView].forEach(e=>{this._focusables.add(e),this._focusTracker.add(e.element)})}_initKeystrokeHandling(){let 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=>{let n=e.target;n===this._findInputView.fieldView.element?(this._areCommandsEnabled.findNext?this._findNextButtonView.fire(`execute`):this._findButtonView.fire(`execute`),t(e)):n===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){let t=new H(this.locale);return t.set(e),t}_createInputField(e,t){let n=new Qb(this.locale,Jx);return n.label=e,n.class=t,n}},wF=class extends F{static get requires(){return[Qy]}static get pluginName(){return`FindAndReplaceUI`}static get isOfficialPlugin(){return!0}formView;constructor(e){super(e),e.config.define(`findAndReplace.uiType`,`dialog`),this.formView=null}init(){let e=this.editor,t=e.config.get(`findAndReplace.uiType`)===`dropdown`,n=e.commands.get(`find`),r=this.editor.t;e.ui.componentFactory.add(`findAndReplace`,()=>{let r;return t?(r=this._createDropdown(),r.bind(`isEnabled`).to(n)):r=this._createDialogButtonForToolbar(),e.keystrokes.set(`Ctrl+F`,(t,i)=>{if(n.isEnabled){if(r instanceof sx){let e=r.buttonView;e.isOn||e.fire(`execute`)}else r.isOn?e.plugins.get(`Dialog`).view.focus():r.fire(`execute`);i()}}),r}),t||e.ui.componentFactory.add(`menuBar:findAndReplace`,()=>this._createDialogButtonForMenuBar()),e.accessibility.addKeystrokeInfos({keystrokes:[{label:r(`Find in the document`),keystroke:`CTRL+F`}]})}_createDropdown(){let e=this.editor,t=e.locale.t,n=Nx(e.locale);return n.once(`change:isOpen`,()=>{this.formView=this._createFormView(),this.formView.children.add(new By(e.locale,{label:t(`Find and replace`)}),0),n.panelView.children.add(this.formView)}),n.on(`change:isOpen`,(e,t,n)=>{n?this._setupFormView():this.fire(`searchReseted`)},{priority:`low`}),n.buttonView.set({icon:C_,label:t(`Find and replace`),keystroke:`CTRL+F`,tooltip:!0}),n}_createDialogButtonForToolbar(){let e=this.editor,t=this._createButton(H),n=e.plugins.get(`Dialog`);return t.set({tooltip:!0}),t.bind(`isOn`).to(n,`id`,e=>e===`findAndReplace`),t.on(`execute`,()=>{t.isOn?n.hide():this._showDialog()}),t}_createDialogButtonForMenuBar(){let e=this._createButton(U),t=this.editor.plugins.get(`Dialog`),n=this.editor.plugins.get(`Dialog`);return e.set({role:`menuitemcheckbox`,isToggleable:!0}),e.bind(`isOn`).to(n,`id`,e=>e===`findAndReplace`),e.on(`execute`,()=>{if(t.id===`findAndReplace`){t.hide();return}this._showDialog()}),e}_createButton(e){let t=this.editor,n=t.commands.get(`find`),r=new e(t.locale),i=t.locale.t;return r.bind(`isEnabled`).to(n),r.set({icon:C_,label:i(`Find and replace`),keystroke:`CTRL+F`}),r}_showDialog(){let e=this.editor,t=e.plugins.get(`Dialog`),n=e.locale.t;this.formView||=this._createFormView(),t.show({id:`findAndReplace`,title:n(`Find and replace`),content:this.formView,position:Jy.EDITOR_TOP_SIDE,onShow:()=>{this._setupFormView()},onHide:()=>{this.fire(`searchReseted`)}})}_createFormView(){let e=this.editor,t=new(Xa(CF))(e.locale),n=e.commands,r=this.editor.plugins.get(`FindAndReplaceEditing`).state;t.bind(`highlightOffset`).to(r,`highlightedOffset`),t.listenTo(r.results,`change`,()=>{t.matchCount=r.results.length});let i=n.get(`findNext`),a=n.get(`findPrevious`),o=n.get(`replace`),s=n.get(`replaceAll`);return t.bind(`_areCommandsEnabled`).to(i,`isEnabled`,a,`isEnabled`,o,`isEnabled`,s,`isEnabled`,(e,t,n,r)=>({findNext:e,findPrevious:t,replace:n,replaceAll:r})),t.delegate(`findNext`,`findPrevious`,`replace`,`replaceAll`).to(this),t.on(`change:isDirty`,(e,t,n)=>{n&&this.fire(`searchReseted`)}),t}_setupFormView(){this.formView.disableCssTransitions(),this.formView.reset(),this.formView._findInputView.fieldView.select(),this.formView.enableCssTransitions()}},TF=class extends I{_state;constructor(e,t){super(e),this.isEnabled=!0,this.affectsData=!1,this._state=t}execute(e,{matchCase:t,wholeWords:n}={}){let{editor:r}=this,{model:i}=r,a=r.plugins.get(`FindAndReplaceUtils`),o,s=``;o=typeof e==`string`?(...r)=>({results:a.findByTextCallback(e,{matchCase:t,wholeWords:n})(...r),searchText:e}):e;let c=o;o=(...e)=>{let t=c(...e);return t&&`searchText`in t&&(s=t.searchText),t};let l=i.document.getRootNames().reduce(((e,t)=>a.updateFindResultFromRange(i.createRangeIn(i.document.getRoot(t)),i,o,e)),null);return this._state.clear(i),this._state.results.addMany(l),this._state.highlightedResult=l.get(0),this._state.searchText=s,o&&(this._state.lastSearchCallback=o),this._state.matchCase=!!t,this._state.matchWholeWords=!!n,{results:l,findCallback:o}}};const ine=D();var EF=class extends ine{constructor(e){super(),this.set(`results`,new Fi),this.set(`highlightedResult`,null),this.set(`highlightedOffset`,0),this.set(`searchText`,``),this.set(`replaceText`,``),this.set(`lastSearchCallback`,null),this.set(`matchCase`,!1),this.set(`matchWholeWords`,!1),this.results.on(`change`,(t,{removed:n,index:r})=>{if(Array.from(n).length){let t=!1;if(e.change(r=>{for(let i of n)this.highlightedResult===i&&(t=!0),e.markers.has(i.marker.name)&&r.removeMarker(i.marker)}),t){let e=r>=this.results.length?0:r;this.highlightedResult=this.results.get(e)}}}),this.on(`change:highlightedResult`,()=>{this.refreshHighlightOffset(e)})}clear(e){this.searchText=``,e.change(t=>{if(this.highlightedResult){let n=this.highlightedResult.marker.name.split(`:`)[1],r=e.markers.get(`findResultHighlighted:${n}`);r&&t.removeMarker(r)}[...this.results].forEach(({marker:e})=>{t.removeMarker(e)})}),this.results.clear()}refreshHighlightOffset(e){let{highlightedResult:t,results:n}=this;t?this.highlightedOffset=DF(e,[...n]).indexOf(t)+1:this.highlightedOffset=0}};function DF(e,t){let n={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)=>n[e.marker.getStart().compareWith(t.marker.getStart())]))}var OF=class extends I{_state;constructor(e,t){super(e),this.isEnabled=!0,this._state=t,this._isEnabledBasedOnSelection=!1}_replace(e,t){let{model:n}=this.editor,r=t.marker.getRange();n.canEditAt(r)&&n.change(i=>{if(r.root.rootName===`$graveyard`){this._state.results.remove(t);return}let a={};for(let e of r.getItems())if(e.is(`$text`)||e.is(`$textProxy`)){a=e.getAttributes();break}n.insertContent(i.createText(e,a),r),this._state.results.has(t)&&this._state.results.remove(t)})}},kF=class extends OF{execute(e,t){let n=Math.max(this._state.highlightedOffset-1,0);if(this._replace(e,t),this._state.results.length){let e=DF(this.editor.model,[...this._state.results]);this._state.highlightedResult=e[n%e.length]}}},AF=class extends OF{execute(e,t){let{editor:n}=this,{model:r}=n,i=n.plugins.get(`FindAndReplaceUtils`),a=t instanceof Fi?t:r.document.getRootNames().reduce(((e,n)=>i.updateFindResultFromRange(r.createRangeIn(r.document.getRoot(n)),r,i.findByTextCallback(t,this._state),e)),null);a.length&&r.change(()=>{[...a].forEach(t=>{this._replace(e,t)})})}},jF=class extends I{_state;constructor(e,t){super(e),this.affectsData=!1,this._state=t,this.isEnabled=!1,this.listenTo(this._state.results,`change`,()=>{this.isEnabled=this._state.results.length>1})}refresh(){this.isEnabled=this._state.results.length>1}execute(){let e=this._state.results,t=e.getIndex(this._state.highlightedResult),n=t+1>=e.length?0:t+1;this._state.highlightedResult=this._state.results.get(n)}},MF=class extends jF{execute(){let 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)}},NF=class extends F{static get pluginName(){return`FindAndReplaceUtils`}static get isOfficialPlugin(){return!0}updateFindResultFromRange(e,t,n,r){let i=r||new Fi,a=e=>i.find(t=>{let{marker:n}=t,r=n.getRange(),i=e.getRange();return r.isEqual(i)});return t.change(r=>{[...e].forEach(({type:e,item:o})=>{if(e===`elementStart`&&t.schema.checkChild(o,`$text`)){let e=n({item:o,text:this.rangeToText(t.createRangeIn(o))});if(!e)return;`results`in e&&(e=e.results),e.forEach(e=>{let t=`findResult:${he()}`,n=r.addMarker(t,{usingOperation:!1,affectsData:!1,range:r.createRange(r.createPositionAt(o,e.start),r.createPositionAt(o,e.end))}),s=ane(i,n);a(n)||i.add({id:t,label:e.label,marker:n},s)})}})}),i}rangeToText(e){return Array.from(e.getItems({shallow:!0})).reduce((e,t)=>t.is(`$text`)||t.is(`$textProxy`)?e+t.data:`${e}\n`,``)}findByTextCallback(e,t){let n=`gu`;t.matchCase||(n+=`i`);let r=`(${Bn(e)})`;if(t.wholeWords){let t=`[^a-zA-ZÀ-ɏḀ-ỿ]`;RegExp(`^[^a-zA-ZÀ-ɏḀ-ỿ]`).test(e)||(r=`(^|${t}|_)${r}`),RegExp(`[^a-zA-ZÀ-ɏḀ-ỿ]$`).test(e)||(r=`${r}(?=_|${t}|$)`)}let i=new RegExp(r,n);function a({text:e}){return[...e.matchAll(i)].map(one)}return a}};function ane(e,t){let n=e.find(({marker:e})=>t.getStart().isBefore(e.getStart()));return n?e.getIndex(n):e.length}function one(e){let t=e.length-1,n=e.index;return e.length===3&&(n+=e[1].length),{label:e[t],start:n,end:n+e[t].length}}var PF=class extends F{static get requires(){return[NF]}static get pluginName(){return`FindAndReplaceEditing`}static get licenseFeatureCode(){return`FAR`}static get isPremiumPlugin(){return!0}static get isOfficialPlugin(){return!0}state;init(){this.state=new EF(this.editor.model),this.set(`_isSearchActive`,!1),this._defineConverters(),this._defineCommands(),this.listenTo(this.state,`change:highlightedResult`,(e,t,n,r)=>{let{model:i}=this.editor;i.change(e=>{if(r){let t=r.marker.name.split(`:`)[1],n=i.markers.get(`findResultHighlighted:${t}`);n&&e.removeMarker(n)}if(n){let t=n.marker.name.split(`:`)[1];e.addMarker(`findResultHighlighted:${t}`,{usingOperation:!1,affectsData:!1,range:n.marker.getRange()})}})});let e=Kt(((e,t,n)=>{if(n){let e=this.editor.editing.view.domConverter,t=this.editor.editing.mapper.toViewRange(n.marker.getRange());ni({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,n)=>{n?this.listenTo(this.editor.model.document,`change:data`,this._onDocumentChange):this.stopListening(this.editor.model.document,`change:data`,this._onDocumentChange)})}find(e,t){return this._isSearchActive=!0,this.editor.execute(`find`,e,t),this.state.results}stop(){this.state.clear(this.editor.model),this._isSearchActive=!1}_defineCommands(){this.editor.commands.add(`find`,new TF(this.editor,this.state)),this.editor.commands.add(`findNext`,new jF(this.editor,this.state)),this.editor.commands.add(`findPrevious`,new MF(this.editor,this.state)),this.editor.commands.add(`replace`,new kF(this.editor,this.state)),this.editor.commands.add(`replaceAll`,new AF(this.editor,this.state))}_defineConverters(){let{editor:e}=this;e.conversion.for(`editingDowncast`).markerToHighlight({model:`findResult`,view:({markerName:e})=>{let[,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})=>{let[,t]=e.split(`:`);return{name:`span`,classes:[`ck-find-result_selected`],attributes:{"data-find-result":t}}}})}_onDocumentChange=()=>{let e=new Set,t=new Set,n=this.editor.model,{results:r}=this.state,i=n.document.differ.getChanges(),a=n.document.differ.getChangedMarkers();i.forEach(r=>{r.position&&(r.name===`$text`||r.position.nodeAfter&&n.schema.isInline(r.position.nodeAfter)?(e.add(r.position.parent),[...n.markers.getMarkersAtPosition(r.position)].forEach(e=>{t.add(e.name)})):r.type===`insert`&&r.position.nodeAfter&&e.add(r.position.nodeAfter))}),a.forEach(({name:e,data:{newRange:n}})=>{n&&n.start.root.rootName===`$graveyard`&&t.add(e)}),e.forEach(e=>{[...n.markers.getMarkersIntersectingRange(n.createRangeIn(e))].forEach(e=>t.add(e.name))}),t.forEach(e=>{r.has(e)&&(r.get(e)===this.state.highlightedResult&&(this.state.highlightedResult=null),r.remove(e))});let o=[],s=this.editor.plugins.get(`FindAndReplaceUtils`);e.forEach(e=>{let t=s.updateFindResultFromRange(n.createRangeOn(e),n,this.state.lastSearchCallback,r);o.push(...t)}),a.forEach(e=>{if(e.data.newRange){let t=s.updateFindResultFromRange(e.data.newRange,n,this.state.lastSearchCallback,r);o.push(...t)}}),!this.state.highlightedResult&&o.length?this.state.highlightedResult=o[0]:this.state.refreshHighlightOffset(n)}},sne=class extends F{static get requires(){return[PF,wF]}static get pluginName(){return`FindAndReplace`}static get isOfficialPlugin(){return!0}init(){let e=this.editor.plugins.get(`FindAndReplaceUI`),t=this.editor.plugins.get(`FindAndReplaceEditing`),n=t.state;e.on(`findNext`,(e,r)=>{r?(n.searchText=r.searchText,t.find(r.searchText,r)):this.editor.execute(`findNext`)}),e.on(`findPrevious`,(e,r)=>{r&&n.searchText!==r.searchText?t.find(r.searchText):this.editor.execute(`findPrevious`)}),e.on(`replace`,(e,r)=>{n.searchText!==r.searchText&&t.find(r.searchText);let i=n.highlightedResult;i&&this.editor.execute(`replace`,r.replaceText,i)}),e.on(`replaceAll`,(e,r)=>{n.searchText!==r.searchText&&t.find(r.searchText),this.editor.execute(`replaceAll`,r.replaceText,n.results)}),e.on(`searchReseted`,()=>{n.clear(this.editor.model),t.stop()})}},FF=class extends I{attributeKey;constructor(e,t){super(e),this.attributeKey=t}refresh(){let 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={}){let t=this.editor.model,n=t.document.selection,r=e.value,i=e.batch,a=e=>{if(n.isCollapsed)r?e.setSelectionAttribute(this.attributeKey,r):e.removeSelectionAttribute(this.attributeKey);else{let i=t.schema.getValidRanges(n.getRanges(),this.attributeKey,{includeEmptyRanges:!0});for(let t of i){let n=t,i=this.attributeKey;t.isCollapsed&&(n=t.start.parent,i=Tl._getStoreAttributeKey(this.attributeKey)),r?e.setAttribute(i,r,n):e.removeAttribute(i,n)}}};i?t.enqueueChange(i,e=>{a(e)}):t.change(e=>{a(e)})}};const IF=`fontSize`,LF=`fontFamily`,RF=`fontColor`,zF=`fontBackgroundColor`;function BF(e,t){let n={model:{key:e,values:[]},view:{},upcastAlso:{}};for(let e of t)n.model.values.push(e.model),n.view[e.model]=e.view,e.upcastAlso&&(n.upcastAlso[e.model]=e.upcastAlso);return n}function VF(e){return t=>cne(t.getStyle(e))}function HF(e){return(t,{writer:n})=>n.createAttributeElement(`span`,{style:`${e}:${t}`},{priority:7})}function UF({dropdownView:e,colors:t,columns:n,removeButtonLabel:r,colorPickerLabel:i,documentColorsLabel:a,documentColorsCount:o,colorPickerViewConfig:s}){let c=e.locale,l=new GS(c,{colors:t,columns:n,removeButtonLabel:r,colorPickerLabel:i,documentColorsLabel:a,documentColorsCount:o,colorPickerViewConfig:s});return e.colorSelectorView=l,e.panelView.children.add(l),l}function cne(e){return e.replace(/\s/g,``)}var WF=class extends FF{constructor(e){super(e,LF)}};function GF(e){return e.map(lne).filter(e=>e!==void 0)}function KF(e){return e.replace(/["']/g,``).split(`,`).map(e=>e.trim())}function lne(e){if(typeof e==`object`)return e;if(e==="default")return{title:`Default`,model:void 0};if(typeof e==`string`)return une(e)}function une(e){let t=KF(e),n=t[0],r=t.map(dne).join(`, `);return{title:n,model:r,view:{name:`span`,styles:{"font-family":r},priority:7}}}function dne(e){return e=e.trim(),e.indexOf(` `)>0&&(e=`'${e}'`),e}var qF=class extends F{static get pluginName(){return`FontFamilyEditing`}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(LF,{options:[`default`,`Arial, Helvetica, sans-serif`,`Courier New, Courier, monospace`,`Georgia, serif`,`Lucida Sans Unicode, Lucida Grande, sans-serif`,`Tahoma, Geneva, sans-serif`,`Times New Roman, Times, serif`,`Trebuchet MS, Helvetica, sans-serif`,`Verdana, Geneva, sans-serif`],supportAllValues:!1})}init(){let e=this.editor;e.model.schema.extend(`$text`,{allowAttributes:LF}),e.model.schema.setAttributeProperties(LF,{isFormatting:!0,copyOnEnter:!0});let t=BF(LF,GF(e.config.get(`fontFamily.options`)).filter(e=>e.model));e.config.get(`fontFamily.supportAllValues`)?(this._prepareAnyValueConverters(),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(t),e.commands.add(LF,new WF(e))}_prepareAnyValueConverters(){let e=this.editor;e.conversion.for(`downcast`).attributeToElement({model:LF,view:(e,{writer:t})=>t.createAttributeElement(`span`,{style:`font-family:`+e},{priority:7})}),e.conversion.for(`upcast`).elementToAttribute({model:{key:LF,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:LF,value:e=>e.getAttribute(`face`)}})}},JF=class extends F{static get pluginName(){return`FontFamilyUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.t,n=this._getLocalizedOptions(),r=e.commands.get(LF),i=t(`Font Family`),a=fne(n,r);e.ui.componentFactory.add(LF,t=>{let n=Nx(t);return Lx(n,a,{role:`menu`,ariaLabel:i}),n.buttonView.set({label:i,icon:E_,tooltip:!0}),n.extendTemplate({attributes:{class:`ck-font-family-dropdown`}}),n.bind(`isEnabled`).to(r),this.listenTo(n,`execute`,t=>{e.execute(t.source.commandName,{value:t.source.commandParam}),e.editing.view.focus()}),n}),e.ui.componentFactory.add(`menuBar:${LF}`,t=>{let n=new uw(t);n.buttonView.set({label:i,icon:E_}),n.bind(`isEnabled`).to(r);let o=new dw(t);for(let r of a){let i=new rC(t,n),a=new U(t);a.set({role:`menuitemradio`,isToggleable:!0}),a.bind(...Object.keys(r.model)).to(r.model),a.delegate(`execute`).to(n),a.on(`execute`,()=>{e.execute(r.model.commandName,{value:r.model.commandParam}),e.editing.view.focus()}),i.children.add(a),o.items.add(i)}return n.panelView.children.add(o),n})}_getLocalizedOptions(){let e=this.editor,t=e.t;return GF(e.config.get(LF).options).map(e=>(e.title===`Default`&&(e.title=t(`Default`)),e))}};function fne(e,t){let n=new Fi;for(let r of e){let e={type:`button`,model:new RC({commandName:LF,commandParam:r.model,label:r.title,role:`menuitemradio`,withText:!0})};e.model.bind(`isOn`).to(t,`value`,e=>e===r.model?!0:!e||!r.model?!1:KF(e)[0].toLowerCase()===KF(r.model)[0].toLowerCase()),r.view&&typeof r.view!=`string`&&r.view.styles&&e.model.set(`labelStyle`,`font-family: ${r.view.styles[`font-family`]}`),n.add(e)}return n}var YF=class extends F{static get requires(){return[qF,JF]}static get pluginName(){return`FontFamily`}static get isOfficialPlugin(){return!0}},XF=class extends FF{constructor(e){super(e,IF)}};function ZF(e){return e.map(e=>pne(e)).filter(e=>e!==void 0)}const QF={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 pne(e){if(typeof e==`number`&&(e=String(e)),typeof e==`object`&&gne(e))return $F(e);let t=hne(e);if(t)return $F(t);if(e==="default")return{model:void 0,title:`Default`};if(!_ne(e))return mne(e)}function mne(e){return typeof e==`string`&&(e={title:e,model:`${parseFloat(e)}px`}),e.view={name:`span`,styles:{"font-size":e.model}},$F(e)}function $F(e){return e.view&&typeof e.view!=`string`&&!e.view.priority&&(e.view.priority=7),e}function hne(e){return typeof e==`string`?QF[e]:QF[e.model]}function gne(e){return e.title&&e.model&&e.view}function _ne(e){let t;if(typeof e==`object`)if(e.model)t=parseFloat(e.model);else throw new w(`font-size-invalid-definition`,null,e);else t=parseFloat(e);return isNaN(t)}const eI=[`x-small`,`x-small`,`small`,`medium`,`large`,`x-large`,`xx-large`,`xxx-large`];var tI=class extends F{static get pluginName(){return`FontSizeEditing`}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(IF,{options:[`tiny`,`small`,`default`,`big`,`huge`],supportAllValues:!1})}init(){let e=this.editor;e.model.schema.extend(`$text`,{allowAttributes:IF}),e.model.schema.setAttributeProperties(IF,{isFormatting:!0,copyOnEnter:!0});let t=e.config.get(`fontSize.supportAllValues`),n=BF(IF,ZF(this.editor.config.get(`fontSize.options`)).filter(e=>e.model));t?(this._prepareAnyValueConverters(n),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(n),e.commands.add(IF,new XF(e))}_prepareAnyValueConverters(e){let t=this.editor,n=e.model.values.filter(e=>!Gp(String(e))&&!qp(String(e)));if(n.length)throw new w(`font-size-invalid-use-of-named-presets`,null,{presets:n});t.conversion.for(`downcast`).attributeToElement({model:IF,view:(e,{writer:t})=>{if(e)return t.createAttributeElement(`span`,{style:`font-size:`+e},{priority:7})}}),t.conversion.for(`upcast`).elementToAttribute({model:{key:IF,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:IF,value:e=>{let t=e.getAttribute(`size`),n=t[0]===`-`||t[0]===`+`,r=parseInt(t,10);n&&(r=3+r);let i=eI.length-1;return eI[Math.min(Math.max(r,0),i)]}}})}},nI=class extends F{static get pluginName(){return`FontSizeUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.t,n=this._getLocalizedOptions(),r=e.commands.get(IF),i=t(`Font Size`),a=vne(n,r);e.ui.componentFactory.add(IF,t=>{let n=Nx(t);return Lx(n,a,{role:`menu`,ariaLabel:i}),n.buttonView.set({label:i,icon:D_,tooltip:!0}),n.extendTemplate({attributes:{class:[`ck-font-size-dropdown`]}}),n.bind(`isEnabled`).to(r),this.listenTo(n,`execute`,t=>{e.execute(t.source.commandName,{value:t.source.commandParam}),e.editing.view.focus()}),n}),e.ui.componentFactory.add(`menuBar:${IF}`,t=>{let n=new uw(t);n.buttonView.set({label:i,icon:D_}),n.bind(`isEnabled`).to(r);let o=new dw(t);for(let r of a){let i=new rC(t,n),a=new U(t);a.set({role:`menuitemradio`,isToggleable:!0}),a.bind(...Object.keys(r.model)).to(r.model),a.delegate(`execute`).to(n),a.on(`execute`,()=>{e.execute(r.model.commandName,{value:r.model.commandParam}),e.editing.view.focus()}),i.children.add(a),o.items.add(i)}return n.panelView.children.add(o),n})}_getLocalizedOptions(){let e=this.editor,t=e.t,n={Default:t(`Default`),Tiny:t(`Tiny`),Small:t(`Small`),Big:t(`Big`),Huge:t(`Huge`)};return ZF(e.config.get(IF).options).map(e=>{let t=n[e.title];return t&&t!=e.title&&(e=Object.assign({},e,{title:t})),e})}};function vne(e,t){let n=new Fi;for(let r of e){let e={type:`button`,model:new RC({commandName:IF,commandParam:r.model,label:r.title,class:`ck-fontsize-option`,role:`menuitemradio`,withText:!0})};r.view&&typeof r.view!=`string`&&(r.view.styles&&e.model.set(`labelStyle`,`font-size:${r.view.styles[`font-size`]}`),r.view.classes&&e.model.set(`class`,`${e.model.class} ${r.view.classes}`)),e.model.bind(`isOn`).to(t,`value`,e=>e===r.model),n.add(e)}return n}var rI=class extends F{static get requires(){return[tI,nI]}static get pluginName(){return`FontSize`}static get isOfficialPlugin(){return!0}normalizeSizeOptions(e){return ZF(e)}},iI=class extends FF{constructor(e){super(e,RF)}},aI=class extends F{static get pluginName(){return`FontColorEditing`}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(RF,{colors:[{color:`hsl(0, 0%, 0%)`,label:`Black`},{color:`hsl(0, 0%, 30%)`,label:`Dim grey`},{color:`hsl(0, 0%, 60%)`,label:`Grey`},{color:`hsl(0, 0%, 90%)`,label:`Light grey`},{color:`hsl(0, 0%, 100%)`,label:`White`,hasBorder:!0},{color:`hsl(0, 75%, 60%)`,label:`Red`},{color:`hsl(30, 75%, 60%)`,label:`Orange`},{color:`hsl(60, 75%, 60%)`,label:`Yellow`},{color:`hsl(90, 75%, 60%)`,label:`Light green`},{color:`hsl(120, 75%, 60%)`,label:`Green`},{color:`hsl(150, 75%, 60%)`,label:`Aquamarine`},{color:`hsl(180, 75%, 60%)`,label:`Turquoise`},{color:`hsl(210, 75%, 60%)`,label:`Light blue`},{color:`hsl(240, 75%, 60%)`,label:`Blue`},{color:`hsl(270, 75%, 60%)`,label:`Purple`}],columns:5}),e.conversion.for(`upcast`).elementToAttribute({view:{name:`span`,styles:{color:/[\s\S]+/}},model:{key:RF,value:VF(`color`)}}),e.conversion.for(`upcast`).elementToAttribute({view:{name:`font`,attributes:{color:/^#?\w+$/}},model:{key:RF,value:e=>e.getAttribute(`color`)}}),e.conversion.for(`downcast`).attributeToElement({model:RF,view:HF(`color`)}),e.commands.add(RF,new iI(e)),e.model.schema.extend(`$text`,{allowAttributes:RF}),e.model.schema.setAttributeProperties(RF,{isFormatting:!0,copyOnEnter:!0})}},oI=class extends F{commandName;componentName;icon;dropdownLabel;columns;constructor(e,{commandName:t,componentName:n,icon:r,dropdownLabel:i}){super(e),this.commandName=t,this.componentName=n,this.icon=r,this.dropdownLabel=i,this.columns=e.config.get(`${this.componentName}.columns`)}init(){let e=this.editor,t=e.locale,n=t.t,r=e.commands.get(this.commandName),i=e.config.get(this.componentName),a=Sb(t,Cb(i.colors)),o=i.documentColors,s=i.colorPicker!==!1;e.ui.componentFactory.add(this.componentName,t=>{let c=Nx(t),l=!1,u=UF({dropdownView:c,colors:a.map(e=>({label:e.label,color:e.model,options:{hasBorder:e.hasBorder}})),columns:this.columns,removeButtonLabel:n(`Remove color`),colorPickerLabel:n(`Color picker`),documentColorsLabel:o===0?``:n(`Document colors`),documentColorsCount:o===void 0?this.columns:o,colorPickerViewConfig:s?i.colorPicker||{}:!1});return u.bind(`selectedColor`).to(r,`value`),c.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:!0}),c.extendTemplate({attributes:{class:`ck-color-ui-dropdown`}}),c.bind(`isEnabled`).to(r),u.on(`execute`,(t,n)=>{c.isOpen&&e.execute(this.commandName,{value:n.value,batch:this._undoStepBatch}),n.source!==`colorPicker`&&e.editing.view.focus(),n.source===`colorPickerSaveButton`&&(c.isOpen=!1)}),u.on(`colorPicker:show`,()=>{this._undoStepBatch=e.model.createBatch()}),u.on(`colorPicker:cancel`,()=>{this._undoStepBatch.operations.length&&(c.isOpen=!1,e.execute(`undo`,this._undoStepBatch)),e.editing.view.focus()}),c.on(`change:isOpen`,(t,n,r)=>{l||(l=!0,c.colorSelectorView.appendUI()),r&&(o!==0&&u.updateDocumentColors(e.model,this.componentName),u.updateSelectedColors(),u.showColorGridsFragment())}),zx(c,()=>c.colorSelectorView.colorGridsFragmentView.staticColorsGrid.items.find(e=>e.isOn)),c}),e.ui.componentFactory.add(`menuBar:${this.componentName}`,t=>{let i=new uw(t);i.buttonView.set({label:this.dropdownLabel,icon:this.icon}),i.bind(`isEnabled`).to(r);let s=!1,c=new GS(t,{colors:a.map(e=>({label:e.label,color:e.model,options:{hasBorder:e.hasBorder}})),columns:this.columns,removeButtonLabel:n(`Remove color`),colorPickerLabel:n(`Color picker`),documentColorsLabel:o===0?``:n(`Document colors`),documentColorsCount:o===void 0?this.columns:o,colorPickerViewConfig:!1});return c.bind(`selectedColor`).to(r,`value`),c.delegate(`execute`).to(i),c.on(`execute`,(t,n)=>{e.execute(this.commandName,{value:n.value,batch:this._undoStepBatch}),e.editing.view.focus()}),i.on(`change:isOpen`,(t,n,r)=>{s||(s=!0,c.appendUI()),r&&(o!==0&&c.updateDocumentColors(e.model,this.componentName),c.updateSelectedColors(),c.showColorGridsFragment())}),i.panelView.children.add(c),i})}},sI=class extends oI{constructor(e){let t=e.locale.t;super(e,{commandName:RF,componentName:RF,icon:T_,dropdownLabel:t(`Font Color`)})}static get pluginName(){return`FontColorUI`}},cI=class extends F{static get requires(){return[aI,sI]}static get pluginName(){return`FontColor`}static get isOfficialPlugin(){return!0}},lI=class extends FF{constructor(e){super(e,zF)}},uI=class extends F{static get pluginName(){return`FontBackgroundColorEditing`}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(zF,{colors:[{color:`hsl(0, 0%, 0%)`,label:`Black`},{color:`hsl(0, 0%, 30%)`,label:`Dim grey`},{color:`hsl(0, 0%, 60%)`,label:`Grey`},{color:`hsl(0, 0%, 90%)`,label:`Light grey`},{color:`hsl(0, 0%, 100%)`,label:`White`,hasBorder:!0},{color:`hsl(0, 75%, 60%)`,label:`Red`},{color:`hsl(30, 75%, 60%)`,label:`Orange`},{color:`hsl(60, 75%, 60%)`,label:`Yellow`},{color:`hsl(90, 75%, 60%)`,label:`Light green`},{color:`hsl(120, 75%, 60%)`,label:`Green`},{color:`hsl(150, 75%, 60%)`,label:`Aquamarine`},{color:`hsl(180, 75%, 60%)`,label:`Turquoise`},{color:`hsl(210, 75%, 60%)`,label:`Light blue`},{color:`hsl(240, 75%, 60%)`,label:`Blue`},{color:`hsl(270, 75%, 60%)`,label:`Purple`}],columns:5}),e.data.addStyleProcessorRules(hm),e.conversion.for(`upcast`).elementToAttribute({view:{name:`span`,styles:{"background-color":/[\s\S]+/}},model:{key:zF,value:VF(`background-color`)}}),e.conversion.for(`downcast`).attributeToElement({model:zF,view:HF(`background-color`)}),e.commands.add(zF,new lI(e)),e.model.schema.extend(`$text`,{allowAttributes:zF}),e.model.schema.setAttributeProperties(zF,{isFormatting:!0,copyOnEnter:!0})}},dI=class extends oI{constructor(e){let t=e.locale.t;super(e,{commandName:zF,componentName:zF,icon:w_,dropdownLabel:t(`Font Background Color`)})}static get pluginName(){return`FontBackgroundColorUI`}},fI=class extends F{static get requires(){return[uI,dI]}static get pluginName(){return`FontBackgroundColor`}static get isOfficialPlugin(){return!0}},yne=class extends F{static get requires(){return[YF,rI,cI,fI]}static get pluginName(){return`Font`}static get isOfficialPlugin(){return!0}},pI=class{_placeholderMap;_wrapper=null;_document;_annotationsUIsData=null;_paginationBodyCollection=null;_hasLeftCollapseButton=!1;_collapseLeftSidebarButton=null;_resizeObserver=null;_sidebarsWidths={left:0,right:0};_keepLeftSidebarHidden=!1;_forceShowLeftSidebar=!1;_sourceEditingCallback=(e,t,n)=>{this.getWrapper().querySelector(`.ck-fullscreen__document-outline-header`).style.display=n?`none`:``};_hiddenElements=new Map;_savedAncestorsScrollPositions=new Map;_showRevisionViewerCallback=null;_closeRevisionViewerCallback=null;_aiTabsData=null;constructor(e){this._placeholderMap=new Map,e.plugins.has(`RevisionHistory`)&&(this._showRevisionViewerCallback=e.config.get(`revisionHistory`).showRevisionViewerCallback,this._closeRevisionViewerCallback=e.config.get(`revisionHistory`).closeRevisionViewerCallback),this._editor=e,this._document=this._editor.sourceElement?this._editor.sourceElement.ownerDocument:u.document,this._editor.config.define(`fullscreen.container`,this._document.body),e.on(`destroy`,()=>{this._wrapper&&this.destroy(),this._resizeObserver&&this._resizeObserver.destroy()})}moveToFullscreen(e,t){let n=mr(this._document,`div`);n.setAttribute(`data-ck-fullscreen-placeholder`,t),e.replaceWith(n),this.getWrapper().querySelector(`[data-ck-fullscreen="${t}"]`).append(e),this._placeholderMap.set(t,{placeholderElement:n,movedElement:e})}restoreMovedElementLocation(e){if(!this._placeholderMap.has(e))return;let{placeholderElement:t,movedElement:n}=this._placeholderMap.get(e);t.replaceWith(n),t.remove(),this._placeholderMap.delete(e),this._placeholderMap.size===0&&this._destroyContainer()}getWrapper(){return this._wrapper||(this._wrapper=mr(this._document,`div`,{class:`ck ck-fullscreen__main-wrapper`}),this._wrapper.innerHTML=`
<div class="ck ck-fullscreen__top-wrapper ck-reset_all">
<div class="ck ck-fullscreen__menu-bar" data-ck-fullscreen="menu-bar"></div>
<div class="ck ck-fullscreen__toolbar" data-ck-fullscreen="toolbar"></div>
</div>
<div class="ck ck-fullscreen__editable-wrapper">
<div class="ck ck-fullscreen__sidebar ck-fullscreen__left-sidebar" data-ck-fullscreen="left-sidebar"></div>
<div class="ck ck-fullscreen__editable" data-ck-fullscreen="editable">
<div class="ck ck-fullscreen__pagination-view" data-ck-fullscreen="pagination-view"></div>
</div>
<div class="ck ck-fullscreen__sidebar ck-fullscreen__right-sidebar" data-ck-fullscreen="right-sidebar"></div>
<div class="ck ck-fullscreen__right-edge" data-ck-fullscreen="right-edge"></div>
</div>
<div class="ck ck-fullscreen__bottom-wrapper">
<div class="ck ck-fullscreen__body-wrapper" data-ck-fullscreen="body-wrapper"></div>
</div>
`,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){let e=this._editor.plugins.get(`PaginationRenderer`);e.setupScrollableAncestor(),this._paginationBodyCollection=new nb(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(let e of this._editor.config.get(`fullscreen.container`).children)e!==this._wrapper&&!e.classList.contains(`ck-body-wrapper`)&&!e.classList.contains(`ckbox-wrapper`)&&e.style.display!==`none`&&(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(let e of this._placeholderMap.keys())this.restoreMovedElementLocation(e);this._destroyContainer(),this._editor.ui.view.toolbar&&this._editor.ui.view.toolbar.switchBehavior(this._editor.config.get(`toolbar.shouldNotGroupWhenFull`)===!0?`static`:`dynamic`);for(let[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){let 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=!1,this._resizeObserver?.destroy()}destroy(){for(let{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(let[e,t]of this._hiddenElements)e.style.display=t;this._hiddenElements.clear()}}_generatePresenceListContainer(){let e=this._editor.t,t=mr(document,`div`,{class:`ck ck-fullscreen__left-sidebar-item`});t.innerHTML=`
<div class="ck ck-fullscreen__left-sidebar-header"></div>
<div class="ck ck-fullscreen__presence-list" data-ck-fullscreen="presence-list"></div>
`,t.firstElementChild.innerText=e(`Connected users`),document.querySelector(`[data-ck-fullscreen="left-sidebar-sticky"]`)||document.querySelector(`[data-ck-fullscreen="left-sidebar"]`).appendChild(mr(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);let n=this._editor.plugins.get(`PresenceListUI`);this.moveToFullscreen(n.view.element,`presence-list`),this._hasLeftCollapseButton=!0}_generateDocumentOutlineContainer(){let e=this._editor.t,t=mr(document,`div`,{class:`ck-fullscreen__left-sidebar-item ck-fullscreen__left-sidebar-item--no-margin`});t.innerHTML=`
<div class="ck ck-fullscreen__left-sidebar-header ck-fullscreen__document-outline-header"></div>
`,t.firstElementChild.innerText=e(`Document outline`);let n=mr(document,`div`,{class:`ck ck-fullscreen__left-sidebar-item ck-fullscreen__document-outline-wrapper`});n.innerHTML=`
<div class="ck ck-fullscreen__document-outline" data-ck-fullscreen="document-outline"></div>
`,document.querySelector(`[data-ck-fullscreen="left-sidebar-sticky"]`)||document.querySelector(`[data-ck-fullscreen="left-sidebar"]`).appendChild(mr(document,`div`,{class:`ck ck-fullscreen__left-sidebar-sticky`,"data-ck-fullscreen":`left-sidebar-sticky`})),document.querySelector(`[data-ck-fullscreen="left-sidebar"]`).appendChild(n),document.querySelector(`[data-ck-fullscreen="left-sidebar-sticky"]`).appendChild(t);let r=this._editor.plugins.get(`DocumentOutlineUI`);r.view.documentOutlineContainer=document.querySelector(`[data-ck-fullscreen="left-sidebar"]`),this.moveToFullscreen(r.view.element,`document-outline`),this._hasLeftCollapseButton=!0}_restoreDocumentOutlineDefaultContainer(){let e=this._editor.plugins.get(`DocumentOutlineUI`);e.view.documentOutlineContainer=e.view.element}_generateCollapseButton(){let e=new H(this._editor.locale),t=document.querySelector(`.ck-fullscreen__left-sidebar`),n=this._editor.t;e.set({label:n(`Toggle sidebar`),class:`ck-fullscreen__left-sidebar-toggle-button`,tooltip:n(`Hide left sidebar`),tooltipPosition:`se`,icon:Wv}),e.on(`execute`,()=>{t.classList.contains(`ck-fullscreen__left-sidebar--collapsed`)?(this._forceShowLeftSidebar=!0,this._keepLeftSidebarHidden=!1,this._showLeftSidebar()):(this._keepLeftSidebarHidden=!0,this._hideLeftSidebar()),this._editor.editing.view.focus()}),e.render(),this._collapseLeftSidebarButton=e,t.prepend(e.element)}_overrideAnnotationsUIs(){let e=this._editor.plugins.get(`AnnotationsUIs`);this._annotationsUIsData=new Map(e.uisData),e.deactivateAll();let 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(){let e=this._editor.plugins.get(`Sidebar`),t=e.context.config.get(`sidebar.container`);t&&e.setContainer(t);let n=this._editor.plugins.get(`AnnotationsUIs`);n.deactivateAll();for(let[e,t]of[...this._annotationsUIsData])n.activate(e,t.filter);this._annotationsUIsData=null}_overrideRevisionHistoryCallbacks(){this._editor.config.set(`revisionHistory.showRevisionViewerCallback`,async()=>{let 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(){let e=this._editor.plugins.get(`Dialog`);this._setNewDialogPosition(),e.on(`change:isOpen`,this.updateDialogPositionCallback,{priority:`highest`})}_unregisterFullscreenDialogPositionAdjustments(){let e=this._editor.plugins.get(`Dialog`),t=e.view;t&&t.position===null&&(t.position=Jy.EDITOR_TOP_SIDE),t&&t.updatePosition(),e.off(`change:isOpen`,this.updateDialogPositionCallback)}updateDialogPositionCallback=this._updateDialogPosition.bind(this);_updateDialogPosition(e,t,n){n&&this._setNewDialogPosition()}_setNewDialogPosition(){let e=this._editor.plugins.get(`Dialog`).view;if(!e||e.position!==Jy.EDITOR_TOP_SIDE)return;let t=new O(this._wrapper.querySelector(`.ck-fullscreen__right-edge`)).getVisible(),n=new O(t?this._wrapper.querySelector(`.ck-fullscreen__right-edge`):this._wrapper).getVisible(),r=new O(document.querySelector(`.ck-fullscreen__editable`)).getVisible(),i=new O(e.element.querySelector(`.ck-dialog`)).getVisible(),a=new O(document.querySelector(`.ck-fullscreen__editable-wrapper`)).excludeScrollbarsAndBorders().getVisible().width-new O(document.querySelector(`.ck-fullscreen__editable-wrapper`)).getVisible().width;if(n&&r&&i){e.position=null;let o=t?n.left-i.width-28:n.left+n.width-i.width-28+a;e.moveTo(o,r.top)}}_saveAncestorsScrollPositions(e){let t=e.parentElement;if(t)for(;t;){let e=t.style.overflowY||u.window.getComputedStyle(t).overflowY,n=t.style.overflowX||u.window.getComputedStyle(t).overflowX;(e===`auto`||e===`scroll`||n===`auto`||n===`scroll`||t.tagName===`HTML`)&&this._savedAncestorsScrollPositions.set(t,{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}),t=t.parentElement}}_handleAITabsTransfer(){let 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`,this._aiTabsTransitionEndCallback)}_handleAISidebarTransitions(e){let t=this._editor.plugins.get(`AITabs`);e.target===t.view.element&&e.propertyName.includes(`width`)&&this._adjustVisibleElements()}_restoreAITabs(){let 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._aiTabsTransitionEndCallback)}_adjustVisibleElements(){let e=this._wrapper.querySelector(`.ck-fullscreen__editable-wrapper`);if(this._forceShowLeftSidebar){this._forceShowLeftSidebar=!1;return}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){let t=this._editor.plugins.get(`AnnotationsUIs`);t.deactivateAll();let n=new Map;for(let[e,r]of[...this._annotationsUIsData])r.filter!==t.defaultFilter&&n.set(e,r.filter);n.has(e)?t.activate(e,n.get(e)):n.size?t.activate(e,e=>[...n.values()].some(t=>t(e))):t.switchTo(e)}_setupResizeObserver(){let e=this._wrapper.querySelector(`.ck-fullscreen__editable-wrapper`);this._resizeObserver&&this._resizeObserver.destroy(),this._resizeObserver=new Hr(e,()=>{this._adjustVisibleElements()})}_hideLeftSidebar(){let e=this._editor.t;this._collapseLeftSidebarButton&&(this._wrapper.querySelector(`.ck-fullscreen__left-sidebar`).classList.add(`ck-fullscreen__left-sidebar--collapsed`),this._collapseLeftSidebarButton.icon=__,this._collapseLeftSidebarButton.tooltip=e(`Show left sidebar`))}_showLeftSidebar(){let e=this._editor.t;this._collapseLeftSidebarButton&&(this._wrapper.querySelector(`.ck-fullscreen__left-sidebar`).classList.remove(`ck-fullscreen__left-sidebar--collapsed`),this._collapseLeftSidebarButton.icon=Wv,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`))}_aiTabsTransitionEndCallback=e=>{this._handleAISidebarTransitions(e)}},mI=class extends pI{_editor;constructor(e){super(e),this._editor=e}defaultOnEnter(){let 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(this._editor.config.get(`fullscreen.toolbar.shouldNotGroupWhenFull`)===!0?`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 gw(this._editor.locale),t.menuBarView.render(),e.initMenuBar(t.menuBarView)),this.moveToFullscreen(t.menuBarView.element,`menu-bar`)),this.getWrapper()}},hI=class extends pI{_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(this._editor.config.get(`fullscreen.toolbar.shouldNotGroupWhenFull`)===!0?`static`:`dynamic`),this._editor.config.get(`fullscreen.menuBar.isVisible`)&&this.moveToFullscreen(this._editor.ui.view.menuBarView.element,`menu-bar`),this.getWrapper()}},gI=class extends I{fullscreenHandler;constructor(e){super(e),this.affectsData=!1,this.isEnabled=!0,this.value=!1,bne(e)?this.fullscreenHandler=new mI(e):xne(e)?this.fullscreenHandler=new hI(e):this.fullscreenHandler=new pI(e)}execute(){this.value?this._disableFullscreenMode():this._enableFullscreenMode()}_enableFullscreenMode(){this.fullscreenHandler.enable(),this.value=!0}_disableFullscreenMode(){this.fullscreenHandler.disable(),this.value=!1}};function bne(e){return e.constructor.editorName===`ClassicEditor`}function xne(e){return e.constructor.editorName===`DecoupledEditor`}var _I=class extends F{static get pluginName(){return`FullscreenEditing`}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(`fullscreen.menuBar.isVisible`,!0),e.config.define(`fullscreen.toolbar.shouldNotGroupWhenFull`,e.config.get(`toolbar.shouldNotGroupWhenFull`)===!0)}init(){this.editor.commands.add(`toggleFullscreen`,new gI(this.editor));let e=this.editor.locale.t;this.editor.keystrokes.set(`Ctrl+Shift+F`,(e,t)=>{this.editor.execute(`toggleFullscreen`),p.isBlink||(this.editor.editing.view.document.isFocused=!1,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 vI=`toggleFullscreen`;var yI=class extends F{static get requires(){return[_I]}static get pluginName(){return`FullscreenUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.ui.componentFactory.add(`fullscreen`,()=>this._createButton(H)),e.ui.componentFactory.add(`menuBar:fullscreen`,()=>this._createButton(U))}_createButton(e){let t=this.editor,n=t.t,r=t.commands.get(vI),i=new e(t.locale);return i.set({isToggleable:!0}),i.bind(`isEnabled`).to(r,`isEnabled`),i.bind(`isOn`).to(r,`value`),i instanceof U?i.set({role:`menuitemcheckbox`,label:n(`Fullscreen mode`)}):(i.bind(`icon`).to(r,`value`,e=>e?k_:O_),i.bind(`label`).to(r,`value`,e=>n(e?`Leave fullscreen mode`:`Enter fullscreen mode`)),i.set({tooltip:!0})),this.listenTo(i,`execute`,()=>{t.execute(vI),p.isBlink||(this.editor.ui.view.toolbar.focusTracker.focusedElement=null),t.editing.view.scrollToTheSelection(),t.editing.view.focus()}),i}},Sne=class extends F{static get requires(){return[_I,yI]}static get pluginName(){return`Fullscreen`}static get isOfficialPlugin(){return!0}},bI=class extends I{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}refresh(){let e=this.editor.model,t=e.document,n=j(t.selection.getSelectedBlocks());this.value=!!n&&n.is(`element`,`paragraph`),this.isEnabled=!!n&&xI(n,e.schema)}execute(e={}){let t=this.editor.model,n=t.document,r=e.selection||n.selection;t.canEditAt(r)&&t.change(e=>{let n=r.getSelectedBlocks();for(let r of n)!r.is(`element`,`paragraph`)&&xI(r,t.schema)&&e.rename(r,`paragraph`)})}};function xI(e,t){return t.checkChild(e.parent,`paragraph`)&&!t.isObject(e)}var SI=class extends I{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}execute(e){let t=this.editor.model,n=e.attributes,r=e.position;return t.canEditAt(r)?t.change(e=>{if(r=this._findPositionToInsertParagraph(r,e),!r)return null;let i=e.createElement(`paragraph`);return n&&t.schema.setAllowedAttributes(i,n,e),t.insertContent(i,r),e.setSelection(i,`in`),e.createPositionAt(i,0)}):null}_findPositionToInsertParagraph(e,t){let n=this.editor.model;if(n.schema.checkChild(e,`paragraph`))return e;let r=n.schema.findAllowedParent(e,`paragraph`);if(!r)return null;let i=e.parent,a=n.schema.checkChild(i,`$text`);return i.isEmpty||a&&e.isAtEnd?n.createPositionAfter(i):!i.isEmpty&&a&&e.isAtStart?n.createPositionBefore(i):t.split(e,r).position}},CI=class e extends F{static get pluginName(){return`Paragraph`}static get isOfficialPlugin(){return!0}init(){let t=this.editor,n=t.model;t.commands.add(`paragraph`,new bI(t)),t.commands.add(`insertParagraph`,new SI(t)),n.schema.register(`paragraph`,{inheritAllFrom:`$block`}),t.conversion.elementToElement({model:`paragraph`,view:`p`}),t.conversion.for(`upcast`).elementToElement({model:(t,{writer:n})=>!e.paragraphLikeElements.has(t.name)||t.isEmpty?null:n.createElement(`paragraph`),view:/.+/,converterPriority:`low`})}static paragraphLikeElements=new Set([`blockquote`,`dd`,`div`,`dt`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`li`,`p`,`td`,`th`])},Cne=class extends F{static get requires(){return[CI]}init(){let e=this.editor,t=e.t;e.ui.componentFactory.add(`paragraph`,n=>{let r=new H(n),i=e.commands.get(`paragraph`);return r.label=t(`Paragraph`),r.icon=Lv,r.tooltip=!0,r.isToggleable=!0,r.bind(`isEnabled`).to(i),r.bind(`isOn`).to(i,`value`),r.on(`execute`,()=>{e.execute(`paragraph`)}),r})}},wI=class extends I{modelElements;constructor(e,t){super(e),this.modelElements=t}refresh(){let e=j(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some(t=>TI(e,t,this.editor.model.schema))}execute(e){let t=this.editor.model,n=t.document,r=e.value;t.change(e=>{let i=Array.from(n.selection.getSelectedBlocks()).filter(e=>TI(e,r,t.schema));for(let t of i)t.is(`element`,r)||e.rename(t,r)})}};function TI(e,t,n){return n.checkChild(e.parent,t)&&!n.isObject(e)}const EI=`paragraph`;var DI=class extends F{static get pluginName(){return`HeadingEditing`}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(`heading`,{options:[{model:`paragraph`,title:`Paragraph`,class:`ck-heading_paragraph`},{model:`heading1`,view:`h2`,title:`Heading 1`,class:`ck-heading_heading1`},{model:`heading2`,view:`h3`,title:`Heading 2`,class:`ck-heading_heading2`},{model:`heading3`,view:`h4`,title:`Heading 3`,class:`ck-heading_heading3`}]})}static get requires(){return[CI]}init(){let e=this.editor,t=e.config.get(`heading.options`),n=[];for(let r of t)r.model!==`paragraph`&&(e.model.schema.register(r.model,{inheritAllFrom:`$block`}),e.conversion.elementToElement(r),n.push(r.model));this._addDefaultH1Conversion(e),e.commands.add(`heading`,new wI(e,n))}afterInit(){let e=this.editor,t=e.commands.get(`enter`),n=e.config.get(`heading.options`);t&&this.listenTo(t,`afterExecute`,(t,r)=>{let i=e.model.document.selection.getFirstPosition().parent;n.some(e=>i.is(`element`,e.model))&&!i.is(`element`,EI)&&i.childCount===0&&r.writer.rename(i,EI)})}_addDefaultH1Conversion(e){e.conversion.for(`upcast`).elementToElement({model:`heading1`,view:`h1`,converterPriority:ge.low+1})}};function OI(e){let t=e.t,n={Paragraph:t(`Paragraph`),"Heading 1":t(`Heading 1`),"Heading 2":t(`Heading 2`),"Heading 3":t(`Heading 3`),"Heading 4":t(`Heading 4`),"Heading 5":t(`Heading 5`),"Heading 6":t(`Heading 6`)};return e.config.get(`heading.options`).map(e=>{let t=n[e.title];return t&&t!=e.title&&(e.title=t),e})}var kI=class extends F{static get pluginName(){return`HeadingUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.t,n=OI(e),r=t(`Choose heading`),i=t(`Heading`);e.ui.componentFactory.add(`heading`,t=>{let a={},o=new Fi,s=e.commands.get(`heading`),c=e.commands.get(`paragraph`),l=[s];for(let e of n){let t={type:`button`,model:new RC({label:e.title,class:e.class,role:`menuitemradio`,withText:!0})};e.model===`paragraph`?(t.model.bind(`isOn`).to(c,`value`),t.model.set(`commandName`,`paragraph`),l.push(c)):(t.model.bind(`isOn`).to(s,`value`,t=>t===e.model),t.model.set({commandName:`heading`,commandValue:e.model})),o.add(t),a[e.model]=e.title}let u=Nx(t);return Lx(u,o,{ariaLabel:i,role:`menu`}),u.buttonView.set({ariaLabel:i,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:i}),u.extendTemplate({attributes:{class:[`ck-heading-dropdown`]}}),u.bind(`isEnabled`).toMany(l,`isEnabled`,(...e)=>e.some(e=>e)),u.buttonView.bind(`label`).to(s,`value`,c,`value`,(e,t)=>{let n=t?`paragraph`:e;return typeof n==`boolean`||!a[n]?r:a[n]}),u.buttonView.bind(`ariaLabel`).to(s,`value`,c,`value`,(e,t)=>{let n=t?`paragraph`:e;return typeof n==`boolean`||!a[n]?i:`${a[n]}, ${i}`}),this.listenTo(u,`execute`,t=>{let{commandName:n,commandValue:r}=t.source;e.execute(n,r?{value:r}:void 0),e.editing.view.focus()}),u}),e.ui.componentFactory.add(`menuBar:heading`,r=>{let i=new uw(r),a=e.commands.get(`heading`),o=e.commands.get(`paragraph`),s=[a],c=new dw(r);i.set({class:`ck-heading-dropdown`}),c.set({ariaLabel:t(`Heading`),role:`menu`}),i.buttonView.set({label:t(`Heading`)}),i.panelView.children.add(c);for(let t of n){let n=new rC(r,i),l=new U(r);n.children.add(l),c.items.add(n),l.set({isToggleable:!0,label:t.title,role:`menuitemradio`,class:t.class}),l.delegate(`execute`).to(i),l.on(`execute`,()=>{let n=t.model===`paragraph`?`paragraph`:`heading`;e.execute(n,{value:t.model}),e.editing.view.focus()}),t.model===`paragraph`?(l.bind(`isOn`).to(o,`value`),s.push(o)):l.bind(`isOn`).to(a,`value`,e=>e===t.model)}return i.bind(`isEnabled`).toMany(s,`isEnabled`,(...e)=>e.some(e=>e)),i})}},wne=class extends F{static get requires(){return[DI,kI]}static get pluginName(){return`Heading`}static get isOfficialPlugin(){return!0}};const Tne={heading1:A_,heading2:j_,heading3:M_,heading4:N_,heading5:P_,heading6:F_};var Ene=class extends F{init(){OI(this.editor).filter(e=>e.model!==`paragraph`).map(e=>this._createButton(e))}_createButton(e){let t=this.editor;t.ui.componentFactory.add(e.model,n=>{let r=new H(n),i=t.commands.get(`heading`);return r.label=e.title,r.icon=e.icon||Tne[e.model],r.tooltip=!0,r.isToggleable=!0,r.bind(`isEnabled`).to(i),r.bind(`isOn`).to(i,`value`,t=>t==e.model),r.on(`execute`,()=>{t.execute(`heading`,{value:e.model}),t.editing.view.focus()}),r})}};const AI=new Set([`paragraph`,`heading1`,`heading2`,`heading3`,`heading4`,`heading5`,`heading6`]);var Dne=class extends F{_bodyPlaceholder=new Map;static get pluginName(){return`Title`}static get isOfficialPlugin(){return!0}static get requires(){return[CI]}init(){let e=this.editor,t=e.model;t.schema.register(`title`,{isBlock:!0,allowIn:`$root`}),t.schema.register(`title-content`,{isBlock:!0,allowIn:`title`,allowAttributes:[`alignment`]}),t.schema.extend(`$text`,{allowIn:`title-content`}),t.schema.addAttributeCheck(e=>{if(e.endsWith(`title-content $text`))return!1}),e.editing.mapper.on(`modelToViewPosition`,MI(e.editing.view)),e.data.mapper.on(`modelToViewPosition`,MI(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,n)=>{n.consumable.consume(t.item,e.name)})),e.data.upcastDispatcher.on(`element:h1`,jI,{priority:`high`}),e.data.upcastDispatcher.on(`element:h2`,jI,{priority:`high`}),e.data.upcastDispatcher.on(`element:h3`,jI,{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(),this._warnIfNoSupportedRoot()}_warnIfNoSupportedRoot(){let e=this.editor.model;for(let t of e.document.getRoots())if(e.schema.checkChild(t,`title`))return;T(`title-no-supported-root`)}getTitle(e={}){let t=e.rootName?e.rootName:void 0,n=this._getTitleElement(t);if(!n)return``;let r=n.getChild(0);return this.editor.data.stringify(r,e)}getBody(e={}){let t=this.editor,n=t.data,r=t.model,i=e.rootName?e.rootName:void 0,a=t.model.document.getRoot(i);if(!r.schema.checkChild(a,`title`))return n.get({...e,rootName:a.rootName});let o=a.getChild(0);if(!o||!o.is(`element`,`title`))return``;let s=t.editing.view,c=new Rs(s.document),l=r.createRangeIn(a),u=c.createDocumentFragment(),d=r.createPositionAfter(o),f=r.createRange(d,r.createPositionAt(a,`end`)),p=new Map;for(let e of r.markers){let t=f.getIntersection(e.getRange());t&&p.set(e.name,t)}return n.mapper.clearBindings(),n.mapper.bindElements(a,u),n.downcastDispatcher.convert(l,p,c,e),c.remove(c.createRangeOn(u.getChild(0))),t.data.processor.toData(u)}_getTitleElement(e){let t=this.editor.model,n=t.document.getRoot(e);if(t.schema.checkChild(n,`title`)){for(let e of n.getChildren())if(NI(e))return e}}_fixTitleContent(e){let t=!1;for(let n of this.editor.model.document.getRootNames()){let r=this._getTitleElement(n);if(!r||r.maxOffset===1)continue;let i=Array.from(r.getChildren());i.shift();for(let t of i)e.move(e.createRangeOn(t),r,`after`),e.rename(t,`paragraph`);t=!0}return t}_fixTitleElement(e){let t=!1,n=this.editor.model;for(let r of this.editor.model.document.getRoots()){if(!n.schema.checkChild(r,`title`))continue;let i=Array.from(r.getChildren()).filter(NI),a=i[0],o=r.getChild(0);if(o.is(`element`,`title`)){i.length>1&&(PI(i,e,n),t=!0);continue}if(!a&&!AI.has(o.name)){let n=e.createElement(`title`);e.insert(n,r),e.insertElement(`title-content`,n),t=!0;continue}AI.has(o.name)?One(o,e,n):e.move(e.createRangeOn(a),r,0),PI(i,e,n),t=!0}return t}_fixBodyElement(e){let t=this.editor.model.schema,n=!1;for(let r of this.editor.model.document.getRootNames()){let i=this.editor.model.document.getRoot(r);if(i.childCount<2&&t.checkChild(i,`title`)){let t=e.createElement(`paragraph`);e.insert(t,i,1),this._bodyPlaceholder.set(r,t),n=!0}}return n}_fixExtraParagraph(e){let t=!1;for(let n of this.editor.model.document.getRootNames()){let r=this.editor.model.document.getRoot(n),i=this._bodyPlaceholder.get(n);i&&Ane(i,r)&&(this._bodyPlaceholder.delete(n),e.remove(i),t=!0)}return t}_attachPlaceholders(){let e=this.editor,t=e.t,n=e.editing.view,r=e.sourceElement,i=e.config.get(`title.placeholder`)||t(`Type your title`);e.editing.downcastDispatcher.on(`insert:title-content`,(e,t,r)=>{let a=r.mapper.toViewElement(t.item);a.placeholder=i,yo({view:n,element:a,keepOnFocus:!0})});let a=new Map;n.document.registerPostFixer(i=>{let o=!1;for(let s of n.document.roots){if(s.isEmpty)continue;let n=e.editing.mapper.toModelElement(s);if(!e.model.schema.checkChild(n,`title`))continue;let c=s.getChild(1),l=a.get(s.rootName);if(c!==l){l&&(So(i,l),i.removeAttribute(`data-placeholder`,l));let n=e.config.get(`roots`)[s.rootName]?.placeholder||jne(r)&&r.getAttribute(`placeholder`)||t(`Type or paste your content here.`);i.setAttribute(`data-placeholder`,n,c),a.set(s.rootName,c),o=!0}o=Co(c,!0)&&s.childCount===2&&c.name===`p`?xo(i,c)?!0:o:So(i,c)?!0:o}return o})}_attachTabPressHandling(){let e=this.editor,t=e.model;e.keystrokes.set(`TAB`,(e,n)=>{t.change(e=>{let r=t.document.selection,i=Array.from(r.getSelectedBlocks());if(i.length===1&&i[0].is(`element`,`title-content`)){let t=r.getFirstPosition().root.getChild(1);e.setSelection(t,0),n()}})}),e.keystrokes.set(`SHIFT + TAB`,(n,r)=>{t.change(n=>{let i=t.document.selection;if(!i.isCollapsed)return;let a=j(i.getSelectedBlocks()),o=i.getFirstPosition(),s=e.model.document.getRoot(o.root.rootName);if(!t.schema.checkChild(s,`title`))return;let c=s.getChild(0);a===s.getChild(1)&&o.isAtStart&&(n.setSelection(c.getChild(0),0),r())})})}};function jI(e,t,n){let r=t.modelCursor,i=t.viewItem;if(!r.isAtStart||!r.parent.is(`element`,`$root`)||!n.consumable.consume(i,{name:!0}))return;let a=n.writer,o=a.createElement(`title`),s=a.createElement(`title-content`);a.append(s,o),a.insert(o,r),n.convertChildren(i,s),n.updateConversionResult(o,t)}function MI(e){return(t,n)=>{let r=n.modelPosition.parent;if(!r.is(`element`,`title`))return;let i=r.parent,a=n.mapper.toViewElement(i);n.viewPosition=e.createPositionAt(a,0),t.stop()}}function NI(e){return e.is(`element`,`title`)}function One(e,t,n){let r=t.createElement(`title`);t.insert(r,e,`before`),t.insert(e,r,0),t.rename(e,`title-content`),n.schema.removeDisallowedAttributes([e],t)}function PI(e,t,n){let r=!1;for(let i of e)i.index!==0&&(kne(i,t,n),r=!0);return r}function kne(e,t,n){let r=e.getChild(0);if(r.isEmpty){t.remove(e);return}t.move(t.createRangeOn(r),e,`before`),t.rename(r,`paragraph`),t.remove(e),n.schema.removeDisallowedAttributes([r],t)}function Ane(e,t){return!(!e.is(`element`,`paragraph`)||e.childCount||t.childCount<=2||t.getChild(t.childCount-1)!==e)}function jne(e){return!!e&&e.tagName.toLowerCase()===`textarea`}var FI=class extends I{refresh(){let e=this.editor.model,t=e.document;this.value=t.selection.getAttribute(`highlight`),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,`highlight`)}execute(e={}){let t=this.editor.model,n=t.document.selection,r=e.value;t.change(e=>{if(n.isCollapsed){let t=n.getFirstPosition();if(n.hasAttribute(`highlight`)){let n=e=>e.item.hasAttribute(`highlight`)&&e.item.getAttribute(`highlight`)===this.value,i=t.getLastMatchingPosition(n,{direction:`backward`}),a=t.getLastMatchingPosition(n),o=e.createRange(i,a);!r||this.value===r?(t.isEqual(a)||e.removeAttribute(`highlight`,o),e.removeSelectionAttribute(`highlight`)):(t.isEqual(a)||e.setAttribute(`highlight`,r,o),e.setSelectionAttribute(`highlight`,r))}else r&&e.setSelectionAttribute(`highlight`,r)}else{let i=t.schema.getValidRanges(n.getRanges(),`highlight`,{includeEmptyRanges:!0});for(let t of i){let n=t,i=`highlight`;t.isCollapsed&&(n=t.start.parent,i=Tl._getStoreAttributeKey(`highlight`)),r?e.setAttribute(i,r,n):e.removeAttribute(i,n)}}})}},II=class extends F{static get pluginName(){return`HighlightEditing`}static get isOfficialPlugin(){return!0}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(){let e=this.editor;e.model.schema.extend(`$text`,{allowAttributes:`highlight`});let t=e.config.get(`highlight.options`);e.conversion.attributeToElement(LI(t)),e.commands.add(`highlight`,new FI(e))}};function LI(e){let t={model:{key:`highlight`,values:[]},view:{}};for(let n of e)t.model.values.push(n.model),t.view[n.model]={name:`mark`,classes:n.class};return t}var RI=class extends F{get localizedOptionTitles(){let 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!0}init(){let e=this.editor.config.get(`highlight.options`);for(let t of e)this._addHighlighterButton(t);this._addRemoveHighlightButton(),this._addDropdown(e),this._addMenuBarButton(e)}_addRemoveHighlightButton(){let e=this.editor.t,t=this.editor.commands.get(`highlight`);this._addButton(`removeHighlight`,e(`Remove highlight`),S_,null,e=>{e.bind(`isEnabled`).to(t,`isEnabled`)})}_addHighlighterButton(e){let t=this.editor.commands.get(`highlight`);this._addButton(`highlight:`+e.model,e.title,BI(e.type),e.model,n);function n(n){n.bind(`isEnabled`).to(t,`isEnabled`),n.bind(`isOn`).to(t,`value`,t=>t===e.model),n.iconView.fillColor=e.color,n.isToggleable=!0}}_addButton(e,t,n,r,i){let a=this.editor;a.ui.componentFactory.add(e,e=>{let o=new H(e),s=this.localizedOptionTitles[t]?this.localizedOptionTitles[t]:t;return o.set({label:s,icon:n,tooltip:!0}),o.on(`execute`,()=>{a.execute(`highlight`,{value:r}),a.editing.view.focus()}),i(o),o})}_addDropdown(e){let t=this.editor,n=t.t,r=t.ui.componentFactory,i=e[0],a=e.reduce((e,t)=>(e[t.model]=t,e),{});r.add(`highlight`,o=>{let s=t.commands.get(`highlight`),c=Nx(o,Mx),l=c.buttonView;l.set({label:n(`Highlight`),tooltip:!0,lastExecuted:i.model,commandValue:i.model,isToggleable:!0}),l.bind(`icon`).to(s,`value`,e=>BI(u(e,`type`))),l.bind(`color`).to(s,`value`,e=>u(e,`color`)),l.bind(`commandValue`).to(s,`value`,e=>u(e,`model`)),l.bind(`isOn`).to(s,`value`,e=>!!e),l.delegate(`execute`).to(c),c.bind(`isEnabled`).to(s,`isEnabled`),Fx(c,()=>{let t=e.map(e=>{let t=r.create(`highlight:`+e.model);return this.listenTo(t,`execute`,()=>{c.buttonView.set({lastExecuted:e.model})}),t});return t.push(new Cx),t.push(r.create(`removeHighlight`)),t},{enableActiveItemFocusOnDropdownOpen:!0,ariaLabel:n(`Text highlight toolbar`)}),zI(c),l.on(`execute`,()=>{t.execute(`highlight`,{value:l.commandValue})}),this.listenTo(c,`execute`,()=>{t.editing.view.focus()});function u(e,t){return a[!e||e===l.lastExecuted?l.lastExecuted:e][t]}return c})}_addMenuBarButton(e){let t=this.editor,n=t.t,r=t.commands.get(`highlight`);t.ui.componentFactory.add(`menuBar:highlight`,i=>{let a=new uw(i);a.buttonView.set({label:n(`Highlight`),icon:BI(`marker`)}),a.bind(`isEnabled`).to(r),a.buttonView.iconView.fillColor=`transparent`;let o=new dw(i);for(let n of e){let e=new rC(i,a),s=new U(i);s.set({label:n.title,icon:BI(n.type),role:`menuitemradio`,isToggleable:!0}),s.iconView.fillColor=n.color,s.delegate(`execute`).to(a),s.bind(`isOn`).to(r,`value`,e=>e===n.model),s.on(`execute`,()=>{t.execute(`highlight`,{value:n.model}),t.editing.view.focus()}),e.children.add(s),o.items.add(e)}o.items.add(new fx(i));let s=new rC(i,a),c=new U(i);return c.set({label:n(`Remove highlight`),icon:S_}),c.delegate(`execute`).to(a),c.on(`execute`,()=>{t.execute(`highlight`,{value:null}),t.editing.view.focus()}),s.children.add(c),o.items.add(s),a.panelView.children.add(o),a})}};function zI(e){e.buttonView.actionView.iconView.bind(`fillColor`).to(e.buttonView,`color`)}function BI(e){return e===`marker`?uv:zv}var VI=class extends F{static get requires(){return[II,RI]}static get pluginName(){return`Highlight`}static get isOfficialPlugin(){return!0}},HI=class extends I{refresh(){let e=this.editor.model,t=e.schema,n=e.document.selection;this.isEnabled=UI(n,t,e)}execute(){let e=this.editor.model;e.change(t=>{let n=t.createElement(`horizontalLine`);e.insertObject(n,null,null,{setSelection:`after`})})}};function UI(e,t,n){let r=WI(e,n);return t.checkChild(r,`horizontalLine`)}function WI(e,t){let n=XE(e,t).start.parent;return n.isEmpty&&!n.is(`rootElement`)?n.parent:n}var GI=class extends F{static get pluginName(){return`HorizontalLineEditing`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.model.schema,n=e.t,r=e.conversion;t.register(`horizontalLine`,{inheritAllFrom:`$blockObject`}),r.for(`dataDowncast`).elementToElement({model:`horizontalLine`,view:(e,{writer:t})=>t.createEmptyElement(`hr`)}),r.for(`editingDowncast`).elementToStructure({model:`horizontalLine`,view:(e,{writer:t})=>{let r=n(`Horizontal line`),i=t.createContainerElement(`div`,null,t.createEmptyElement(`hr`));return t.addClass(`ck-horizontal-line`,i),t.setCustomProperty(`hr`,!0,i),KI(i,t,r)}}),r.for(`upcast`).elementToElement({view:`hr`,model:`horizontalLine`}),e.commands.add(`horizontalLine`,new HI(e))}};function KI(e,t,n){return t.setCustomProperty(`horizontalLine`,!0,e),UE(e,t,{label:n})}var qI=class extends F{static get pluginName(){return`HorizontalLineUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.ui.componentFactory.add(`horizontalLine`,()=>{let e=this._createButton(H);return e.set({tooltip:!0}),e}),e.ui.componentFactory.add(`menuBar:horizontalLine`,()=>this._createButton(U))}_createButton(e){let t=this.editor,n=t.locale,r=t.commands.get(`horizontalLine`),i=new e(t.locale),a=n.t;return i.set({label:a(`Horizontal line`),icon:L_}),i.bind(`isEnabled`).to(r,`isEnabled`),this.listenTo(i,`execute`,()=>{t.execute(`horizontalLine`),t.editing.view.focus()}),i}},JI=class extends F{static get requires(){return[GI,qI,xD]}static get pluginName(){return`HorizontalLine`}static get isOfficialPlugin(){return!0}},YI=class extends I{refresh(){let e=this.editor.model,t=e.schema,n=e.document.selection,r=QI(n);this.isEnabled=XI(n,t,e),this.value=r?r.getAttribute(`value`)||``:null}execute(e){let t=this.editor.model,n=t.document.selection;t.change(r=>{let i;this.value===null?(i=r.createElement(`rawHtml`),t.insertObject(i,null,null,{setSelection:`on`})):i=QI(n),r.setAttribute(`value`,e,i)})}};function XI(e,t,n){let r=ZI(e,n);return t.checkChild(r,`rawHtml`)}function ZI(e,t){let n=XE(e,t).start.parent;return n.isEmpty&&!n.is(`rootElement`)?n.parent:n}function QI(e){let t=e.getSelectedElement();return t&&t.is(`element`,`rawHtml`)?t:null}var $I=class extends F{_widgetButtonViewReferences=new Set;static get pluginName(){return`HtmlEmbedEditing`}static get licenseFeatureCode(){return`HE`}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}constructor(e){super(e),e.config.define(`htmlEmbed`,{showPreviews:!1,sanitizeHtml:e=>(T(`html-embed-provide-sanitize-function`),{html:e,hasChanged:!1})})}init(){let e=this.editor;e.model.schema.register(`rawHtml`,{inheritAllFrom:`$blockObject`,allowAttributes:[`value`]}),e.commands.add(`htmlEmbed`,new YI(e)),this._setupConversion()}_setupConversion(){let e=this.editor,t=e.t,n=e.editing.view,r=this._widgetButtonViewReferences,i=e.config.get(`htmlEmbed`);this.editor.editing.view.on(`render`,()=>{for(let e of r){if(e.element&&e.element.isConnected)return;e.destroy(),r.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:(r,{writer:o})=>{let s,c,l,u=o.createRawElement(`div`,{class:`raw-html-embed__content-wrapper`},function(t){s=t,a({editor:e,domElement:t,state:c,props:l}),s.addEventListener(`mousedown`,()=>{if(c.isEditable){let t=e.model;t.document.selection.getSelectedElement()!==r&&t.change(e=>e.setSelection(r,`on`))}},!0)}),d={makeEditable(){c=Object.assign({},c,{isEditable:!0}),a({domElement:s,editor:e,state:c,props:l}),n.change(e=>{e.setAttribute(`data-cke-ignore-events`,`true`,u)}),s.querySelector(`textarea`).focus()},save(t){t===c.getRawHtmlValue()?this.cancel():(e.execute(`htmlEmbed`,t),e.editing.view.focus())},cancel(){c=Object.assign({},c,{isEditable:!1}),a({domElement:s,editor:e,state:c,props:l}),e.editing.view.focus(),n.change(e=>{e.removeAttribute(`data-cke-ignore-events`,u)})}};c={showPreviews:i.showPreviews,isEditable:!1,getRawHtmlValue:()=>r.getAttribute(`value`)||``},l={sanitizeHtml:i.sanitizeHtml,textareaPlaceholder:t(`Paste raw HTML here...`),onEditClick(){d.makeEditable()},onSaveClick(e){d.save(e)},onCancelClick(){d.cancel()}};let f=o.createContainerElement(`div`,{class:`raw-html-embed`,"data-html-embed-label":t(`HTML snippet`),dir:e.locale.uiLanguageDirection},u);return o.setCustomProperty(`rawHtmlApi`,d,f),o.setCustomProperty(`rawHtml`,!0,f),UE(f,o,{label:t(`HTML snippet`),hasSelectionHandle:!0})}});function a({editor:e,domElement:t,state:n,props:r}){t.textContent=``;let i=t.ownerDocument,a;if(n.isEditable)a=s({domDocument:i,state:n,props:{isDisabled:!1,placeholder:r.textareaPlaceholder}}),t.append(a);else if(n.showPreviews){let a={sanitizeHtml:r.sanitizeHtml};t.append(c({domDocument:i,state:n,props:a,editor:e}))}else{let e={isDisabled:!0,placeholder:r.textareaPlaceholder};t.append(s({domDocument:i,state:n,props:e}))}let l={onEditClick:r.onEditClick,onSaveClick:()=>{r.onSaveClick(a.value)},onCancelClick:r.onCancelClick};t.prepend(o({editor:e,domDocument:i,state:n,props:l}))}function o({editor:e,domDocument:t,state:n,props:i}){let a=mr(t,`div`,{class:`raw-html-embed__buttons-wrapper`});if(n.isEditable){let t=eL(e,`save`,i.onSaveClick),n=eL(e,`cancel`,i.onCancelClick);a.append(t.element,n.element),r.add(t).add(n)}else{let t=eL(e,`edit`,i.onEditClick);a.append(t.element),r.add(t)}return a}function s({domDocument:e,state:t,props:n}){let r=mr(e,`textarea`,{placeholder:n.placeholder,class:`ck ck-reset ck-input ck-input-text raw-html-embed__source`});return r.disabled=n.isDisabled,r.value=t.getRawHtmlValue(),r}function c({editor:e,domDocument:n,state:r,props:i}){let a=i.sanitizeHtml(r.getRawHtmlValue()),o=mr(n,`div`,{class:`ck ck-reset_all raw-html-embed__preview-placeholder`},r.getRawHtmlValue().length>0?t(`No preview available`):t(`Empty snippet content`)),s=mr(n,`div`,{class:`raw-html-embed__preview-content`,dir:e.locale.contentLanguageDirection}),c=n.createRange().createContextualFragment(a.html);return s.appendChild(c),mr(n,`div`,{class:`raw-html-embed__preview`},[o,s])}}};function eL(e,t,n){let{t:r}=e.locale,i=new H(e.locale),a=e.commands.get(`htmlEmbed`);return i.set({class:`raw-html-embed__${t}-button`,icon:Rv,tooltip:!0,tooltipPosition:e.locale.uiLanguageDirection===`rtl`?`e`:`w`}),i.render(),t===`edit`?(i.set({icon:Rv,label:r(`Edit source`)}),i.bind(`isEnabled`).to(a)):t===`save`?(i.set({icon:l_,label:r(`Save changes`)}),i.bind(`isEnabled`).to(a)):i.set({icon:s_,label:r(`Cancel`)}),i.on(`execute`,n),i}var tL=class extends F{static get pluginName(){return`HtmlEmbedUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale.t;e.ui.componentFactory.add(`htmlEmbed`,()=>{let e=this._createButton(H);return e.set({tooltip:!0,label:t(`Insert HTML`)}),e}),e.ui.componentFactory.add(`menuBar:htmlEmbed`,()=>{let e=this._createButton(U);return e.set({label:t(`HTML snippet`)}),e})}_createButton(e){let t=this.editor,n=t.commands.get(`htmlEmbed`),r=new e(t.locale);return r.set({icon:R_}),r.bind(`isEnabled`).to(n,`isEnabled`),this.listenTo(r,`execute`,()=>{t.execute(`htmlEmbed`),t.editing.view.focus(),t.editing.view.document.selection.getSelectedElement().getCustomProperty(`rawHtmlApi`).makeEditable()}),r}},nL=class extends F{static get requires(){return[$I,tL,xD]}static get pluginName(){return`HtmlEmbed`}static get isOfficialPlugin(){return!0}};function rL(e,t,n,r){t&&aL(e,t,r),n&&iL(e,n,r)}function iL(e,t,n){if(t.attributes)for(let[r,i]of Object.entries(t.attributes))e.setAttribute(r,i,n);t.styles&&e.setStyle(t.styles,n),t.classes&&e.addClass(t.classes,n)}function aL(e,t,n){if(t.attributes)for(let[r]of Object.entries(t.attributes))e.removeAttribute(r,n);if(t.styles)for(let r of Object.keys(t.styles))e.removeStyle(r,n);t.classes&&e.removeClass(t.classes,n)}function oL(e,t){let n=Rt(e),r=`attributes`;for(r in t)r==`classes`?n[r]=Array.from(new Set([...e[r]||[],...t[r]])):n[r]={...e[r],...t[r]};return n}function sL(e,t,n,r,i){let a=t.getAttribute(n),o={};for(let e of[`attributes`,`styles`,`classes`]){if(e!=r){a&&a[e]&&(o[e]=a[e]);continue}if(r==`classes`){let t=new Set(a&&a.classes||[]);i(t),t.size&&(o[e]=Array.from(t));continue}let t=new Map(Object.entries(a&&a[e]||{}));i(t),t.size&&(o[e]=Object.fromEntries(t))}Object.keys(o).length?t.is(`documentSelection`)?e.setSelectionAttribute(n,o):e.setAttribute(n,o,t):a&&(t.is(`documentSelection`)?e.removeSelectionAttribute(n):e.removeAttribute(n,t))}function cL(e,t,n){for(let r of t.getItems({shallow:!0})){let t=r.getAttribute(e);t&&t.attributes&&Object.keys(t.attributes).length?Object.keys(t).length>1&&n.setAttribute(e,{attributes:t.attributes},r):n.removeAttribute(e,r)}}function lL(e){return qn(e).replace(/ /g,``)}function uL(e){return`html${lL(e)}Attributes`}function dL({model:e}){return(t,n)=>n.writer.createElement(e,{htmlContent:t.getCustomProperty(`$rawContent`)})}function fL(e,{view:t,isInline:n}){let r=e.t;return(e,{writer:i})=>{let a=r(`HTML object`),o=pL(t,e,i),s=e.getAttribute(uL(t));return i.addClass(`html-object-embed__content`,o),s&&iL(i,s,o),UE(i.createContainerElement(n?`span`:`div`,{class:`html-object-embed`,"data-html-object-embed-label":a},o),i,{label:a})}}function pL(e,t,n){return n.createRawElement(e,null,(e,n)=>{n.setContentOf(e,t.getAttribute(`htmlContent`))})}function mL({view:e,model:t,allowEmpty:n},r){return t=>{t.on(`element:${e}`,(e,t,a)=>{let o=r.processViewAttributes(t.viewItem,a);if(!(!o&&!a.consumable.test(t.viewItem,{name:!0}))){if(o||={},a.consumable.consume(t.viewItem,{name:!0}),t.modelRange||(t=Object.assign(t,a.convertChildren(t.viewItem,t.modelCursor))),n&&t.modelRange.isCollapsed&&Object.keys(o).length){let e=a.writer.createElement(`htmlEmptyElement`);if(!a.safeInsert(e,t.modelCursor))return;let n=a.getSplitParts(e);t.modelRange=a.writer.createRange(t.modelRange.start,a.writer.createPositionAfter(n[n.length-1])),a.updateConversionResult(e,t),i(e,o,a);return}for(let e of t.modelRange.getItems())i(e,o,a)}},{priority:`low`})};function i(e,n,r){if(r.schema.checkAttribute(e,t)){let i=oL(n,e.getAttribute(t)||{});r.writer.setAttribute(t,i,e)}}}function hL({model:e,view:t},n){return(r,{writer:i,consumable:a})=>{if(!r.hasAttribute(e))return null;let o=i.createContainerElement(t),s=r.getAttribute(e);return a.consume(r,`attribute:${e}`),iL(i,s,o),o.getFillerOffset=()=>null,n?UE(o,i):o}}function gL({priority:e,view:t}){return(n,r)=>{if(!n)return;let{writer:i}=r,a=i.createAttributeElement(t,null,{priority:e});return iL(i,n,a),a}}function _L({view:e},t){return n=>{n.on(`element:${e}`,(e,n,r)=>{if(!n.modelRange||n.modelRange.isCollapsed)return;let i=t.processViewAttributes(n.viewItem,r);i&&r.writer.setAttribute(uL(n.viewItem.name),i,n.modelRange)},{priority:`low`})}}function vL({view:e,model:t}){return n=>{n.on(`attribute:${uL(e)}:${t}`,(e,t,n)=>{if(!n.consumable.consume(t.item,e.name))return;let{attributeOldValue:r,attributeNewValue:i}=t,a=n.writer;rL(a,r,i,n.mapper.toViewElement(t.item))})}}const yL={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:!0}},{model:`htmlTbody`,view:`tbody`,modelSchema:{allowIn:`htmlTable`,isBlock:!1}},{model:`htmlThead`,view:`thead`,modelSchema:{allowIn:`htmlTable`,isBlock:!1}},{model:`htmlTfoot`,view:`tfoot`,modelSchema:{allowIn:`htmlTable`,isBlock:!1}},{model:`htmlCaption`,view:`caption`,modelSchema:{allowIn:`htmlTable`,allowChildren:`$text`,isBlock:!1}},{model:`htmlColgroup`,view:`colgroup`,modelSchema:{allowIn:`htmlTable`,allowChildren:`col`,isBlock:!1}},{model:`htmlCol`,view:`col`,modelSchema:{allowIn:`htmlColgroup`,isBlock:!1}},{model:`htmlTr`,view:`tr`,modelSchema:{allowIn:[`htmlTable`,`htmlThead`,`htmlTbody`,`htmlTfoot`],isLimit:!0}},{model:`htmlTd`,view:`td`,modelSchema:{allowIn:`htmlTr`,allowContentOf:`$container`,isLimit:!0,isBlock:!1}},{model:`htmlTh`,view:`th`,modelSchema:{allowIn:`htmlTr`,allowContentOf:`$container`,isLimit:!0,isBlock:!1}},{model:`htmlFigure`,view:`figure`,modelSchema:{inheritAllFrom:`$container`,isBlock:!1}},{model:`htmlFigcaption`,view:`figcaption`,modelSchema:{allowIn:`htmlFigure`,allowChildren:`$text`,isBlock:!1}},{model:`htmlAddress`,view:`address`,modelSchema:{inheritAllFrom:`$container`,isBlock:!1}},{model:`htmlAside`,view:`aside`,modelSchema:{inheritAllFrom:`$container`,isBlock:!1}},{model:`htmlMain`,view:`main`,modelSchema:{inheritAllFrom:`$container`,isBlock:!1}},{model:`htmlDetails`,view:`details`,modelSchema:{inheritAllFrom:`$container`,isBlock:!1}},{model:`htmlSummary`,view:`summary`,modelSchema:{allowChildren:[`htmlH1`,`htmlH2`,`htmlH3`,`htmlH4`,`htmlH5`,`htmlH6`,`$text`],allowIn:`htmlDetails`,isBlock:!1}},{model:`htmlDiv`,view:`div`,paragraphLikeModel:`htmlDivParagraph`,modelSchema:{inheritAllFrom:`$container`}},{model:`htmlFieldset`,view:`fieldset`,modelSchema:{inheritAllFrom:`$container`,isBlock:!1}},{model:`htmlLegend`,view:`legend`,modelSchema:{allowIn:`htmlFieldset`,allowChildren:`$text`}},{model:`htmlHeader`,view:`header`,modelSchema:{inheritAllFrom:`$container`,isBlock:!1}},{model:`htmlFooter`,view:`footer`,modelSchema:{inheritAllFrom:`$container`,isBlock:!1}},{model:`htmlForm`,view:`form`,modelSchema:{inheritAllFrom:`$container`,isBlock:!1}},{model:`htmlHgroup`,view:`hgroup`,modelSchema:{allowWhere:`$container`,allowChildren:[`paragraph`,`htmlP`,`htmlH1`,`htmlH2`,`htmlH3`,`htmlH4`,`htmlH5`,`htmlH6`],isBlock:!1}},{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:!1}},{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:!1}},{model:`htmlPre`,view:`pre`,modelSchema:{inheritAllFrom:`$block`}},{model:`htmlArticle`,view:`article`,modelSchema:{inheritAllFrom:`$container`,isBlock:!1}},{model:`htmlSection`,view:`section`,modelSchema:{inheritAllFrom:`$container`,isBlock:!1}},{model:`htmlNav`,view:`nav`,modelSchema:{inheritAllFrom:`$container`,isBlock:!1}},{model:`htmlDl`,view:`dl`,modelSchema:{allowWhere:`$container`,allowChildren:[`htmlDt`,`htmlDd`,`htmlDiv`],allowAttributesOf:[`$container`],isBlock:!1}},{model:`htmlDt`,view:`dt`,modelSchema:{allowChildren:`$block`,allowIn:`htmlDiv`,isBlock:!1}},{model:`htmlDd`,view:`dd`,modelSchema:{allowChildren:`$block`,allowIn:`htmlDiv`,isBlock:!1}},{model:`htmlCenter`,view:`center`,modelSchema:{inheritAllFrom:`$container`,isBlock:!1}},{model:`htmlHr`,view:`hr`,isEmpty:!0,modelSchema:{inheritAllFrom:`$blockObject`}}],inline:[{model:`htmlLiAttributes`,view:`li`,appliesToBlock:!0,coupledAttribute:`listItemId`},{model:`htmlOlAttributes`,view:`ol`,appliesToBlock:!0,coupledAttribute:`listItemId`},{model:`htmlUlAttributes`,view:`ul`,appliesToBlock:!0,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:!0,isFormatting:!0}},{model:`htmlTt`,view:`tt`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlFont`,view:`font`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlTime`,view:`time`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlVar`,view:`var`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlBig`,view:`big`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlSmall`,view:`small`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlSamp`,view:`samp`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlQ`,view:`q`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlOutput`,view:`output`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlKbd`,view:`kbd`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlBdi`,view:`bdi`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlBdo`,view:`bdo`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlAbbr`,view:`abbr`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlA`,view:`a`,priority:5,coupledAttribute:`linkHref`,attributeProperties:{isFormatting:!0}},{model:`htmlStrong`,view:`strong`,coupledAttribute:`bold`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlB`,view:`b`,coupledAttribute:`bold`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlI`,view:`i`,coupledAttribute:`italic`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlEm`,view:`em`,coupledAttribute:`italic`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlS`,view:`s`,coupledAttribute:`strikethrough`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlDel`,view:`del`,coupledAttribute:`strikethrough`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlIns`,view:`ins`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlU`,view:`u`,coupledAttribute:`underline`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlSub`,view:`sub`,coupledAttribute:`subscript`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlSup`,view:`sup`,coupledAttribute:`superscript`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlCode`,view:`code`,coupledAttribute:`code`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlMark`,view:`mark`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlSpan`,view:`span`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlCite`,view:`cite`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlLabel`,view:`label`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlDfn`,view:`dfn`,attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:`htmlObject`,view:`object`,isObject:!0,modelSchema:{inheritAllFrom:`$inlineObject`}},{model:`htmlIframe`,view:`iframe`,isObject:!0,modelSchema:{inheritAllFrom:`$inlineObject`}},{model:`htmlInput`,view:`input`,isObject:!0,modelSchema:{inheritAllFrom:`$inlineObject`}},{model:`htmlButton`,view:`button`,isObject:!0,modelSchema:{inheritAllFrom:`$inlineObject`}},{model:`htmlTextarea`,view:`textarea`,isObject:!0,modelSchema:{inheritAllFrom:`$inlineObject`}},{model:`htmlSelect`,view:`select`,isObject:!0,modelSchema:{inheritAllFrom:`$inlineObject`}},{model:`htmlVideo`,view:`video`,isObject:!0,modelSchema:{inheritAllFrom:`$inlineObject`}},{model:`htmlEmbed`,view:`embed`,isObject:!0,modelSchema:{inheritAllFrom:`$inlineObject`}},{model:`htmlOembed`,view:`oembed`,isObject:!0,modelSchema:{inheritAllFrom:`$inlineObject`}},{model:`htmlAudio`,view:`audio`,isObject:!0,modelSchema:{inheritAllFrom:`$inlineObject`}},{model:`htmlImg`,view:`img`,isObject:!0,modelSchema:{inheritAllFrom:`$inlineObject`}},{model:`htmlCanvas`,view:`canvas`,isObject:!0,modelSchema:{inheritAllFrom:`$inlineObject`}},{model:`htmlMeter`,view:`meter`,isObject:!0,modelSchema:{inheritAllFrom:`$inlineObject`}},{model:`htmlProgress`,view:`progress`,isObject:!0,modelSchema:{inheritAllFrom:`$inlineObject`}},{model:`htmlScript`,view:`script`,modelSchema:{allowWhere:[`$text`,`$block`],isInline:!0}},{model:`htmlStyle`,view:`style`,modelSchema:{allowWhere:[`$text`,`$block`],isInline:!0}},{model:`htmlCustomElement`,view:`$customElement`,modelSchema:{allowWhere:[`$text`,`$block`],allowAttributesOf:`$inlineObject`,isInline:!0}}]};var bL=class extends F{_definitions=[];static get pluginName(){return`DataSchema`}static get isOfficialPlugin(){return!0}init(){for(let e of yL.block)this.registerBlockElement(e);for(let e of yL.inline)this.registerInlineElement(e)}registerBlockElement(e){this._definitions.push({...e,isBlock:!0})}registerInlineElement(e){this._definitions.push({...e,isInline:!0})}extendBlockElement(e){this._extendDefinition({...e,isBlock:!0})}extendInlineElement(e){this._extendDefinition({...e,isInline:!0})}getDefinitionsForView(e,t=!1){let n=new Set;for(let r of this._getMatchingViewDefinitions(e)){if(t)for(let e of this._getReferences(r.model))n.add(e);n.add(r)}return n}getDefinitionsForModel(e){return this._definitions.filter(t=>t.model==e)}_getMatchingViewDefinitions(e){return this._definitions.filter(t=>t.view&&xL(e,t.view))}*_getReferences(e){let t=[`inheritAllFrom`,`inheritTypesFrom`,`allowWhere`,`allowContentOf`,`allowAttributesOf`],n=this._definitions.filter(t=>t.model==e);for(let{modelSchema:r}of n)if(r)for(let n of t)for(let t of A(r[n]||[])){let n=this._definitions.filter(e=>e.model==t);for(let r of n)t!==e&&(yield*this._getReferences(r.model),yield r)}}_extendDefinition(e){let t=Array.from(this._definitions.entries()).filter(([,t])=>t.model==e.model);if(t.length==0){this._definitions.push(e);return}for(let[n,r]of t)this._definitions[n]=Sn({},r,e,(e,t)=>Array.isArray(e)?e.concat(t):void 0)}};function xL(e,t){return typeof e==`string`?e===t:e instanceof RegExp?e.test(t):!1}var SL=class extends F{_dataSchema;_allowedAttributes;_disallowedAttributes;_allowedElements;_disallowedElements;_dataInitialized;_coupledAttributes;constructor(e){super(e),this._dataSchema=e.plugins.get(`DataSchema`),this._allowedAttributes=new Po,this._disallowedAttributes=new Po,this._allowedElements=new Set,this._disallowedElements=new Set,this._dataInitialized=!1,this._coupledAttributes=null,this._registerElementsAfterInit(),this._registerElementHandlers(),this._registerCoupledAttributesPostFixer(),this._registerAssociatedHtmlAttributesPostFixer()}static get pluginName(){return`DataFilter`}static get isOfficialPlugin(){return!0}static get requires(){return[bL,xD]}loadAllowedConfig(e){for(let t of e){let e=t.name||/[\s\S]+/,n=OL(t);this.allowElement(e),n.forEach(e=>this.allowAttributes(e))}}loadDisallowedConfig(e){for(let t of e){let e=t.name||/[\s\S]+/,n=OL(t);n.length==0?this.disallowElement(e):n.forEach(e=>this.disallowAttributes(e))}}loadAllowedEmptyElementsConfig(e){for(let t of e)this.allowEmptyElement(t)}allowElement(e){for(let t of this._dataSchema.getDefinitionsForView(e,!0))this._addAllowedElement(t),this._coupledAttributes=null}disallowElement(e){for(let t of this._dataSchema.getDefinitionsForView(e,!1))this._disallowedElements.add(t.view)}allowEmptyElement(e){for(let t of this._dataSchema.getDefinitionsForView(e,!0))t.isInline&&this._dataSchema.extendInlineElement({...t,allowEmpty:!0})}allowAttributes(e){this._allowedAttributes.add(e)}disallowAttributes(e){this._disallowedAttributes.add(e)}processViewAttributes(e,t){let{consumable:n}=t;return CL(e,this._disallowedAttributes,n),wL(e,CL(e,this._allowedAttributes,n))}_addAllowedElement(e){if(!this._allowedElements.has(e)){if(this._allowedElements.add(e),`appliesToBlock`in e&&typeof e.appliesToBlock==`string`)for(let t of this._dataSchema.getDefinitionsForModel(e.appliesToBlock))t.isBlock&&this._addAllowedElement(t);this._dataInitialized&&this.editor.data.once(`set`,()=>{this._fireRegisterEvent(e)},{priority:ge.highest+1})}}_registerElementsAfterInit(){this.editor.data.on(`init`,()=>{this._dataInitialized=!0;for(let e of this._allowedElements)this._fireRegisterEvent(e)},{priority:ge.highest+1})}_registerElementHandlers(){this.on(`register`,(e,t)=>{let n=this.editor.model.schema;if(t.isObject&&!n.isRegistered(t.model))this._registerObjectElement(t);else if(t.isBlock)this._registerBlockElement(t);else if(t.isInline)this._registerInlineElement(t);else throw new w(`data-filter-invalid-definition`,null,t);e.stop()},{priority:`lowest`})}_registerCoupledAttributesPostFixer(){let e=this.editor.model,t=e.document.selection;e.document.registerPostFixer(t=>{let n=e.document.differ.getChanges(),r=!1,i=this._getCoupledAttributesMap();for(let e of n){if(e.type!=`attribute`||e.attributeNewValue!==null)continue;let n=i.get(e.attributeKey);if(n)for(let{item:i}of e.range.getWalker())for(let e of n)i.hasAttribute(e)&&(t.removeAttribute(e,i),r=!0)}return r}),this.listenTo(t,`change:attribute`,(n,{attributeKeys:r})=>{let i=new Set,a=this._getCoupledAttributesMap();for(let e of r){if(t.hasAttribute(e))continue;let n=a.get(e);if(n)for(let e of n)t.hasAttribute(e)&&i.add(e)}i.size!=0&&e.change(e=>{for(let t of i)e.removeSelectionAttribute(t)})})}_registerAssociatedHtmlAttributesPostFixer(){let e=this.editor.model;e.document.registerPostFixer(t=>{let n=e.document.differ.getChanges(),r=!1;for(let i of n)if(!(i.type!==`insert`||i.name===`$text`))for(let n of i.attributes.keys())!n.startsWith(`html`)||!n.endsWith(`Attributes`)||e.schema.checkAttribute(i.name,n)||(t.removeAttribute(n,i.position.nodeAfter),r=!0);return r})}_getCoupledAttributesMap(){if(this._coupledAttributes)return this._coupledAttributes;this._coupledAttributes=new Map;for(let e of this._allowedElements)if(e.coupledAttribute&&e.model){let 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){let t=this.editor,n=t.model.schema,r=t.conversion,{view:i,model:a}=e;n.register(a,e.modelSchema),i&&(n.extend(e.model,{allowAttributes:[uL(i),`htmlContent`]}),t.data.registerRawContentMatcher({name:i}),r.for(`upcast`).elementToElement({view:i,model:dL(e),converterPriority:ge.low+2}),r.for(`upcast`).add(_L(e,this)),r.for(`editingDowncast`).elementToStructure({model:{name:a,attributes:[uL(i)]},view:fL(t,e)}),r.for(`dataDowncast`).elementToElement({model:a,view:(e,{writer:t})=>pL(i,e,t)}),r.for(`dataDowncast`).add(vL(e)))}_registerBlockElement(e){let t=this.editor,n=t.model.schema,r=t.conversion,{view:i,model:a}=e;if(!n.isRegistered(e.model)){if(!e.modelSchema||(n.register(e.model,e.modelSchema),!i))return;r.for(`upcast`).elementToElement({model:a,view:i,converterPriority:ge.low+2}),r.for(`downcast`).elementToElement({model:a,view:(t,{writer:n})=>e.isEmpty?n.createEmptyElement(i):n.createContainerElement(i)})}i&&(n.extend(e.model,{allowAttributes:uL(i)}),r.for(`upcast`).add(_L(e,this)),r.for(`downcast`).add(vL(e)))}_registerInlineElement(e){let t=this.editor,n=t.model.schema,r=t.conversion,i=e.model;if(!e.appliesToBlock&&(n.extend(`$text`,{allowAttributes:i}),e.attributeProperties&&n.setAttributeProperties(i,e.attributeProperties),r.for(`upcast`).add(mL(e,this)),r.for(`downcast`).attributeToElement({model:i,view:gL(e)}),e.allowEmpty)){if(n.setAttributeProperties(i,{copyFromObject:!1}),!n.isRegistered(`htmlEmptyElement`)){n.register(`htmlEmptyElement`,{inheritAllFrom:`$inlineObject`});let e=e=>Array.from(e.getAttributeKeys()).some(e=>e.startsWith(`html`));t.model.document.registerPostFixer(n=>{let r=t.model.document.differ.getChanges(),i=new Set;for(let t of r)if(t.type!==`remove`){if(t.type===`attribute`&&t.attributeNewValue===null)for(let{item:n}of t.range)n.is(`element`,`htmlEmptyElement`)&&!e(n)&&i.add(n);if(t.type===`insert`&&t.position.nodeAfter){let r=t.position.nodeAfter;for(let{item:t}of n.createRangeOn(r))t.is(`element`,`htmlEmptyElement`)&&!e(t)&&i.add(t)}}for(let e of i)n.remove(e);return i.size>0})}t.data.htmlProcessor.domConverter.registerInlineObjectMatcher(t=>t.name==e.view&&t.isEmpty&&Array.from(t.getAttributeKeys()).length?{name:!0}:null),r.for(`editingDowncast`).elementToElement({model:`htmlEmptyElement`,view:hL(e,!0)}),r.for(`dataDowncast`).elementToElement({model:`htmlEmptyElement`,view:hL(e)})}}};function CL(e,t,n){let r=t.matchAll(e)||[],i=e.document.stylesProcessor;return r.reduce((t,{match:r})=>{for(let[a,o]of r.attributes||[])if(a==`style`){let r=o,a=i.getRelatedStyles(r).filter(e=>e.split(`-`).length>r.split(`-`).length).sort((e,t)=>t.split(`-`).length-e.split(`-`).length);for(let r of a)n.consume(e,{styles:[r]})&&t.styles.push(r);n.consume(e,{styles:[r]})&&t.styles.push(r)}else if(a==`class`){let r=o;n.consume(e,{classes:[r]})&&t.classes.push(r)}else n.consume(e,{attributes:[a]})&&t.attributes.push(a);return t},{attributes:[],classes:[],styles:[]})}function wL(e,{attributes:t,classes:n,styles:r}){return!t.length&&!n.length&&!r.length?null:{...t.length&&{attributes:TL(e,t)},...r.length&&{styles:EL(e,r)},...n.length&&{classes:n}}}function TL(e,t){let n={};for(let r of t){let t=e.getAttribute(r);t!==void 0&&Jr(r)&&(n[r]=t)}return n}function EL(e,t){let n=new Vo(e.document.stylesProcessor);for(let r of t){let t=e.getStyle(r);t!==void 0&&n.set(r,t)}return Object.fromEntries(n.getStylesEntries())}function DL(e,t){let{name:n}=e,r=e[t];return xn(r)?Object.entries(r).map(([e,r])=>({name:n,[t]:{[e]:r}})):Array.isArray(r)?r.map(e=>({name:n,[t]:[e]})):[e]}function OL(e){let{name:t,attributes:n,classes:r,styles:i}=e,a=[];return n&&a.push(...DL({name:t,attributes:n},`attributes`)),r&&a.push(...DL({name:t,classes:r},`classes`)),i&&a.push(...DL({name:t,styles:i},`styles`)),a}var kL=class extends F{static get requires(){return[SL]}static get pluginName(){return`CodeBlockElementSupport`}static get isOfficialPlugin(){return!0}init(){if(!this.editor.plugins.has(`CodeBlockEditing`))return;let e=this.editor.plugins.get(SL);e.on(`register:pre`,(t,n)=>{if(n.model!==`codeBlock`)return;let r=this.editor,i=r.model.schema,a=r.conversion;i.extend(`codeBlock`,{allowAttributes:[`htmlPreAttributes`,`htmlContentAttributes`]}),a.for(`upcast`).add(AL(e)),a.for(`downcast`).add(jL()),t.stop()})}};function AL(e){return t=>{t.on(`element:code`,(t,n,r)=>{let i=n.viewItem,a=i.parent;if(!a||!a.is(`element`,`pre`)||!n.modelRange)return;o(a,`htmlPreAttributes`),o(i,`htmlContentAttributes`);function o(t,i){let a=e.processViewAttributes(t,r);a&&r.writer.setAttribute(i,a,n.modelRange)}},{priority:`low`})}}function jL(){return e=>{e.on(`attribute:htmlPreAttributes:codeBlock`,(e,t,n)=>{if(!n.consumable.consume(t.item,e.name))return;let{attributeOldValue:r,attributeNewValue:i}=t,a=n.mapper.toViewElement(t.item).parent;rL(n.writer,r,i,a)}),e.on(`attribute:htmlContentAttributes:codeBlock`,(e,t,n)=>{if(!n.consumable.consume(t.item,e.name))return;let{attributeOldValue:r,attributeNewValue:i}=t,a=n.mapper.toViewElement(t.item);rL(n.writer,r,i,a)})}}var ML=class extends F{static get requires(){return[SL]}static get pluginName(){return`DualContentModelElementSupport`}static get isOfficialPlugin(){return!0}init(){this.editor.plugins.get(SL).on(`register`,(e,t)=>{let n=t,r=this.editor,i=r.model.schema,a=r.conversion;if(!n.paragraphLikeModel||i.isRegistered(n.model)||i.isRegistered(n.paragraphLikeModel))return;let o={model:n.paragraphLikeModel,view:n.view};i.register(n.model,n.modelSchema),i.register(o.model,{inheritAllFrom:`$block`}),a.for(`upcast`).elementToElement({view:n.view,model:(e,{writer:t})=>this._hasBlockContent(e)?t.createElement(n.model):t.createElement(o.model),converterPriority:ge.low+.5}),a.for(`downcast`).elementToElement({view:n.view,model:n.model}),this._addAttributeConversion(n),a.for(`downcast`).elementToElement({view:o.view,model:o.model}),this._addAttributeConversion(o),e.stop()})}_hasBlockContent(e){let t=this.editor.editing.view,n=t.domConverter.blockElements;for(let r of t.createRangeIn(e).getItems())if(r.is(`element`)&&n.includes(r.name))return!0;return!1}_addAttributeConversion(e){let t=this.editor,n=t.conversion,r=t.plugins.get(SL);t.model.schema.extend(e.model,{allowAttributes:uL(e.view)}),n.for(`upcast`).add(_L(e,r)),n.for(`downcast`).add(vL(e))}},NL=class extends F{static get requires(){return[bL,TE]}static get pluginName(){return`HeadingElementSupport`}static get isOfficialPlugin(){return!0}init(){let e=this.editor;if(!e.plugins.has(`HeadingEditing`))return;let t=e.config.get(`heading.options`);this.registerHeadingElements(e,t)}registerHeadingElements(e,t){let n=e.plugins.get(bL),r=[];for(let e of t)`model`in e&&`view`in e&&(n.registerBlockElement({view:e.view,model:e.model}),r.push(e.model));n.extendBlockElement({model:`htmlHgroup`,modelSchema:{allowChildren:r}}),n.extendBlockElement({model:`htmlSummary`,modelSchema:{allowChildren:r}})}};function PL(e,t,n){let r=e.createRangeOn(t);for(let{item:e}of r.getWalker())if(e.is(`element`,n))return e}var FL=class extends F{static get requires(){return[SL]}static get pluginName(){return`ImageElementSupport`}static get isOfficialPlugin(){return!0}init(){let e=this.editor;if(!e.plugins.has(`ImageInlineEditing`)&&!e.plugins.has(`ImageBlockEditing`))return;let t=e.model.schema,n=e.conversion,r=e.plugins.get(SL);r.on(`register:figure`,()=>{n.for(`upcast`).add(RL(r))}),r.on(`register:img`,(i,a)=>{a.model!==`imageBlock`&&a.model!==`imageInline`||(t.isRegistered(`imageBlock`)&&t.extend(`imageBlock`,{allowAttributes:[`htmlImgAttributes`,`htmlFigureAttributes`,`htmlLinkAttributes`]}),t.isRegistered(`imageInline`)&&t.extend(`imageInline`,{allowAttributes:[`htmlA`,`htmlImgAttributes`]}),n.for(`upcast`).add(IL(r)),n.for(`downcast`).add(zL()),e.plugins.has(`LinkImage`)&&n.for(`upcast`).add(LL(r,e)),i.stop())})}};function IL(e){return t=>{t.on(`element:img`,(t,n,r)=>{if(!n.modelRange)return;let i=n.viewItem,a=e.processViewAttributes(i,r);a&&r.writer.setAttribute(`htmlImgAttributes`,a,n.modelRange)},{priority:`low`})}}function LL(e,t){let n=t.plugins.get(`ImageUtils`);return t=>{t.on(`element:a`,(t,r,i)=>{let a=r.viewItem;if(!n.findViewImgElement(a))return;let o=r.modelCursor.parent;if(!o.is(`element`,`imageBlock`))return;let s=e.processViewAttributes(a,i);s&&i.writer.setAttribute(`htmlLinkAttributes`,s,o)},{priority:`low`})}}function RL(e){return t=>{t.on(`element:figure`,(t,n,r)=>{let i=n.viewItem;if(!n.modelRange||!i.hasClass(`image`))return;let a=e.processViewAttributes(i,r);a&&r.writer.setAttribute(`htmlFigureAttributes`,a,n.modelRange)},{priority:`low`})}}function zL(){return e=>{t(`htmlImgAttributes`),n(`img`,`htmlImgAttributes`),n(`figure`,`htmlFigureAttributes`),n(`a`,`htmlLinkAttributes`);function t(t){e.on(`attribute:${t}:imageInline`,(e,t,n)=>{if(!n.consumable.consume(t.item,e.name))return;let{attributeOldValue:r,attributeNewValue:i}=t,a=n.mapper.toViewElement(t.item);rL(n.writer,r,i,a)},{priority:`low`})}function n(t,n){e.on(`attribute:${n}:imageBlock`,(e,n,r)=>{if(!r.consumable.test(n.item,e.name))return;let{attributeOldValue:i,attributeNewValue:a}=n,o=r.mapper.toViewElement(n.item),s=PL(r.writer,o,t);s&&(rL(r.writer,i,a,s),r.consumable.consume(n.item,e.name))},{priority:`low`}),t===`a`&&e.on(`attribute:linkHref:imageBlock`,(e,t,n)=>{if(!n.consumable.consume(t.item,`attribute:htmlLinkAttributes:imageBlock`))return;let r=n.mapper.toViewElement(t.item),i=PL(n.writer,r,`a`);iL(n.writer,t.item.getAttribute(`htmlLinkAttributes`),i)},{priority:`low`})}}}var BL=class extends F{static get requires(){return[SL]}static get pluginName(){return`MediaEmbedElementSupport`}static get isOfficialPlugin(){return!0}init(){let e=this.editor;if(!e.plugins.has(`MediaEmbed`)||e.config.get(`mediaEmbed.previewsInData`))return;let t=e.model.schema,n=e.conversion,r=this.editor.plugins.get(SL),i=this.editor.plugins.get(bL),a=e.config.get(`mediaEmbed.elementName`);i.registerBlockElement({model:`media`,view:a}),r.on(`register:figure`,()=>{n.for(`upcast`).add(HL(r))}),r.on(`register:${a}`,(e,i)=>{i.model===`media`&&(t.extend(`media`,{allowAttributes:[uL(a),`htmlFigureAttributes`]}),n.for(`upcast`).add(VL(r,a)),n.for(`dataDowncast`).add(UL(a)),e.stop())})}};function VL(e,t){let n=(n,r,i)=>{let a=r.viewItem;o(a,uL(t));function o(t,n){let a=e.processViewAttributes(t,i);a&&i.writer.setAttribute(n,a,r.modelRange)}};return e=>{e.on(`element:${t}`,n,{priority:`low`})}}function HL(e){return t=>{t.on(`element:figure`,(t,n,r)=>{let i=n.viewItem;if(!n.modelRange||!i.hasClass(`media`))return;let a=e.processViewAttributes(i,r);a&&r.writer.setAttribute(`htmlFigureAttributes`,a,n.modelRange)},{priority:`low`})}}function UL(e){return t=>{n(e,uL(e)),n(`figure`,`htmlFigureAttributes`);function n(e,n){t.on(`attribute:${n}:media`,(t,n,r)=>{if(!r.consumable.consume(n.item,t.name))return;let{attributeOldValue:i,attributeNewValue:a}=n,o=r.mapper.toViewElement(n.item),s=PL(r.writer,o,e);rL(r.writer,i,a,s)})}}}var WL=class extends F{static get requires(){return[SL]}static get pluginName(){return`ScriptElementSupport`}static get isOfficialPlugin(){return!0}init(){let e=this.editor.plugins.get(SL);e.on(`register:script`,(t,n)=>{let r=this.editor,i=r.model.schema,a=r.conversion;i.register(`htmlScript`,n.modelSchema),i.extend(`htmlScript`,{allowAttributes:[`htmlScriptAttributes`,`htmlContent`],isContent:!0}),r.data.registerRawContentMatcher({name:`script`}),a.for(`upcast`).elementToElement({view:`script`,model:dL(n)}),a.for(`upcast`).add(_L(n,e)),a.for(`downcast`).elementToElement({model:`htmlScript`,view:(e,{writer:t})=>pL(`script`,e,t)}),a.for(`downcast`).add(vL(n)),t.stop()})}};const GL=[`width`,`max-width`,`min-width`,`height`,`min-height`,`max-height`];var KL=class extends F{static get requires(){return[SL]}static get pluginName(){return`TableElementSupport`}static get isOfficialPlugin(){return!0}init(){let e=this.editor;if(!e.plugins.has(`TableEditing`))return;let t=e.model.schema,n=e.conversion,r=e.plugins.get(SL),i=e.plugins.get(`TableUtils`);r.on(`register:figure`,()=>{n.for(`upcast`).add(YL(r))}),r.on(`register:table`,(a,o)=>{o.model===`table`&&(t.extend(`table`,{allowAttributes:[`htmlTableAttributes`,`htmlFigureAttributes`,`htmlTheadAttributes`,`htmlTbodyAttributes`,`htmlTfootAttributes`]}),n.for(`upcast`).add(JL(r)),n.for(`downcast`).add(XL()),e.model.document.registerPostFixer(qL(e.model,i)),a.stop())})}};function qL(e,t){return n=>{let r=e.document.differ.getChanges(),i=!1;for(let e of r){if(e.type!=`attribute`||e.attributeKey!=`headingRows`&&e.attributeKey!=`footerRows`)continue;let r=e.range.start.nodeAfter,a=r.getAttribute(`htmlTheadAttributes`),o=r.getAttribute(`htmlTbodyAttributes`),s=r.getAttribute(`htmlTfootAttributes`);a&&e.attributeKey===`headingRows`&&!e.attributeNewValue&&(n.removeAttribute(`htmlTheadAttributes`,r),i=!0),s&&e.attributeKey===`footerRows`&&!e.attributeNewValue&&(n.removeAttribute(`htmlTfootAttributes`,r),i=!0),o&&(r.getAttribute(`headingRows`)||0)+(r.getAttribute(`footerRows`)||0)==t.getRows(r)&&(n.removeAttribute(`htmlTbodyAttributes`,r),i=!0)}return i}}function JL(e){return t=>{t.on(`element:table`,(t,n,r)=>{if(!n.modelRange)return;let i=n.viewItem;r.consumable.consume(i,{classes:`table`}),a(i,`htmlTableAttributes`);for(let e of i.getChildren())e.is(`element`,`thead`)&&a(e,`htmlTheadAttributes`),e.is(`element`,`tfoot`)&&a(e,`htmlTfootAttributes`),e.is(`element`,`tbody`)&&a(e,`htmlTbodyAttributes`);function a(t,i){let a=e.processViewAttributes(t,r);a&&r.writer.setAttribute(i,a,n.modelRange)}},{priority:`low`})}}function YL(e){return t=>{t.on(`element:figure`,(t,n,r)=>{let i=n.viewItem;if(!n.modelRange||!i.hasClass(`table`))return;let a=e.processViewAttributes(i,r);a&&r.writer.setAttribute(`htmlFigureAttributes`,a,n.modelRange)},{priority:`low`})}}function XL(){return e=>{t(`table`,`htmlTableAttributes`),t(`figure`,`htmlFigureAttributes`),t(`thead`,`htmlTheadAttributes`),t(`tbody`,`htmlTbodyAttributes`),t(`tfoot`,`htmlTfootAttributes`);function t(t,n){e.on(`attribute:${n}:table`,(e,r,i)=>{if(!i.consumable.test(r.item,e.name))return;let a=i.mapper.toViewElement(r.item),o=PL(i.writer,a,t);if(o)if(i.consumable.consume(r.item,e.name),n===`htmlTableAttributes`&&a!==o){let e=ZL(r.attributeOldValue),t=ZL(r.attributeNewValue);rL(i.writer,e.tableAttributes,t.tableAttributes,o),rL(i.writer,e.figureAttributes,t.figureAttributes,a)}else rL(i.writer,r.attributeOldValue,r.attributeNewValue,o)})}}}function ZL(e){let t={},n={...e};if(!e||!(`styles`in e))return{figureAttributes:t,tableAttributes:n};n.styles={};for(let[r,i]of Object.entries(e.styles))GL.includes(r)?t.styles={...t.styles,[r]:i}:n.styles={...n.styles,[r]:i};return{figureAttributes:t,tableAttributes:n}}var QL=class extends F{static get requires(){return[SL]}static get pluginName(){return`StyleElementSupport`}static get isOfficialPlugin(){return!0}init(){let e=this.editor.plugins.get(SL);e.on(`register:style`,(t,n)=>{let r=this.editor,i=r.model.schema,a=r.conversion;i.register(`htmlStyle`,n.modelSchema),i.extend(`htmlStyle`,{allowAttributes:[`htmlStyleAttributes`,`htmlContent`],isContent:!0}),r.data.registerRawContentMatcher({name:`style`}),a.for(`upcast`).elementToElement({view:`style`,model:dL(n)}),a.for(`upcast`).add(_L(n,e)),a.for(`downcast`).elementToElement({model:`htmlStyle`,view:(e,{writer:t})=>pL(`style`,e,t)}),a.for(`downcast`).add(vL(n)),t.stop()})}},$L=class extends F{static get requires(){return[SL]}static get pluginName(){return`ListElementSupport`}static get isOfficialPlugin(){return!0}init(){let e=this.editor;if(!e.plugins.has(`ListEditing`))return;let t=e.model.schema,n=e.conversion,r=e.plugins.get(SL),i=e.plugins.get(`ListEditing`),a=e.plugins.get(`ListUtils`),o=[`ul`,`ol`,`li`];i.registerDowncastStrategy({scope:`item`,attributeName:`htmlLiAttributes`,setAttributeOnDowncast:iL}),i.registerDowncastStrategy({scope:`list`,attributeName:`htmlUlAttributes`,setAttributeOnDowncast:iL}),i.registerDowncastStrategy({scope:`list`,attributeName:`htmlOlAttributes`,setAttributeOnDowncast:iL}),r.on(`register`,(e,i)=>{if(!o.includes(i.view)||(e.stop(),t.checkAttribute(`$block`,`htmlLiAttributes`)))return;let a=o.map(e=>uL(e));t.extend(`$listItem`,{allowAttributes:a}),n.for(`upcast`).add(e=>{e.on(`element:ul`,eR(`htmlUlAttributes`,`list`,r),{priority:`low`}),e.on(`element:ol`,eR(`htmlOlAttributes`,`list`,r),{priority:`low`}),e.on(`element:li`,eR(`htmlLiAttributes`,`item`,r),{priority:`low`})})}),i.on(`postFixer`,(e,{listNodes:t,writer:n})=>{for(let{node:r,previousNodeInList:i}of t)if(i){if(i.getAttribute(`listType`)==r.getAttribute(`listType`)){let t=nR(i.getAttribute(`listType`)),a=i.getAttribute(t);!$t(r.getAttribute(t),a)&&n.model.schema.checkAttribute(r,t)&&(a===void 0?n.removeAttribute(t,r):n.setAttribute(t,a,r),e.return=!0)}if(i.getAttribute(`listItemId`)==r.getAttribute(`listItemId`)){let t=i.getAttribute(`htmlLiAttributes`);!$t(r.getAttribute(`htmlLiAttributes`),t)&&n.model.schema.checkAttribute(r,`htmlLiAttributes`)&&(t===void 0?n.removeAttribute(`htmlLiAttributes`,r):n.setAttribute(`htmlLiAttributes`,t,r),e.return=!0)}}}),i.on(`postFixer`,(e,{listNodes:t,writer:n})=>{for(let{node:r}of t){let t=r.getAttribute(`listType`);!a.isNumberedListType(t)&&r.getAttribute(`htmlOlAttributes`)&&(n.removeAttribute(`htmlOlAttributes`,r),e.return=!0),a.isNumberedListType(t)&&r.getAttribute(`htmlUlAttributes`)&&(n.removeAttribute(`htmlUlAttributes`,r),e.return=!0)}})}afterInit(){let e=this.editor;if(!e.commands.get(`indentList`))return;let t=e.commands.get(`indentList`);this.listenTo(t,`afterExecute`,(t,n)=>{e.model.change(t=>{for(let r of n){let n=nR(r.getAttribute(`listType`));e.model.schema.checkAttribute(r,n)&&t.removeAttribute(n,r)}})})}};function eR(e,t,n){return(r,i,a)=>{let o=i.viewItem;i.modelRange||Object.assign(i,a.convertChildren(i.viewItem,i.modelCursor));let s=n.processViewAttributes(o,a);if(t===`list`&&!s)return;let c=a.store;c.htmlSupportItemToClosestList??=new Map;let l=c.htmlSupportItemToClosestList,u=t===`item`?tR(o):null;for(let n of i.modelRange.getItems({shallow:!0}))if(n.hasAttribute(`listItemId`)){if(t===`item`){if(l.has(n))continue;l.set(n,u)}else if(l.get(n)!==o)continue;s&&a.writer.model.schema.checkAttribute(n,e)&&a.writer.setAttribute(e,s,n)}}}function tR(e){let t=e.parent;for(;t;){if(t.is(`element`,`ul`)||t.is(`element`,`ol`))return t;t=t.parent}return null}function nR(e){return e===`numbered`||e==`customNumbered`?`htmlOlAttributes`:`htmlUlAttributes`}var rR=class extends F{static get requires(){return[SL]}static get pluginName(){return`HorizontalLineElementSupport`}static get isOfficialPlugin(){return!0}init(){let e=this.editor;if(!e.plugins.has(`HorizontalLineEditing`))return;let t=e.model.schema,n=e.conversion,r=e.plugins.get(SL);r.on(`register:hr`,(e,i)=>{i.model===`horizontalLine`&&(t.extend(`horizontalLine`,{allowAttributes:[`htmlHrAttributes`]}),n.for(`upcast`).add(_L(i,r)),n.for(`downcast`).add(iR()),e.stop())})}};function iR(){return e=>{e.on(`attribute:htmlHrAttributes:horizontalLine`,(e,t,n)=>{if(!n.consumable.test(t.item,e.name))return;let{attributeOldValue:r,attributeNewValue:i}=t,a=n.mapper.toViewElement(t.item),o=PL(n.writer,a,`hr`);o&&(rL(n.writer,r,i,o),n.consumable.consume(t.item,e.name))},{priority:`low`})}}var aR=class extends F{static get requires(){return[SL]}static get pluginName(){return`IframeElementSupport`}static get isOfficialPlugin(){return!0}init(){this.editor.config.define(`htmlSupport.htmlIframeSandbox`,!0),this._setupSandboxConversion()}_setupSandboxConversion(){let{plugins:e,config:t,conversion:n}=this.editor,r=e.get(SL),i=t.get(`htmlSupport.htmlIframeSandbox`);if(i===!1)return;let a=Array.isArray(i)?Array.from(i):[];r.on(`register:iframe`,(e,t)=>{n.for(`editingDowncast`).add(e=>{e.on(`insert:${t.model}`,(e,t,n)=>{let{mapper:r,writer:i}=n,o=r.toViewElement(t.item);for(let{item:e}of i.createRangeOn(o))if(e.is(`element`,`iframe`))if(e.hasAttribute(`sandbox`)){let t=new Set,n=e.getAttribute(`sandbox`);for(let e of n.trim().split(/\s+/))a.includes(e)&&t.add(e);i.setAttribute(`sandbox`,Array.from(t).join(` `),e)}else i.setAttribute(`sandbox`,a.join(` `),e)},{priority:`lowest`})})})}},oR=class extends F{static get requires(){return[SL,bL]}static get pluginName(){return`CustomElementSupport`}static get isOfficialPlugin(){return!0}init(){let e=this.editor.plugins.get(SL),t=this.editor.plugins.get(bL);e.on(`register:$customElement`,(n,r)=>{n.stop();let i=this.editor,a=i.model.schema,o=i.conversion,s=i.editing.view.domConverter.unsafeElements,c=i.data.htmlProcessor.domConverter.preElements;a.register(r.model,r.modelSchema),a.extend(r.model,{allowAttributes:[`htmlElementName`,`htmlCustomElementAttributes`,`htmlContent`],isContent:!0}),i.data.htmlProcessor.domConverter.registerRawContentMatcher({name:`template`}),o.for(`upcast`).elementToElement({view:/.*/,model:(n,a)=>{if(n.name==`$comment`||!sR(n.name)||t.getDefinitionsForView(n.name).size)return null;s.includes(n.name)||s.push(n.name),c.includes(n.name)||c.push(n.name);let o=a.writer.createElement(r.model,{htmlElementName:n.name}),l=e.processViewAttributes(n,a);l&&a.writer.setAttribute(`htmlCustomElementAttributes`,l,o);let u;if(n.is(`element`,`template`)&&n.getCustomProperty(`$rawContent`))u=n.getCustomProperty(`$rawContent`);else{let e=new Np(n.document).createDocumentFragment(n),t=i.data.htmlProcessor.domConverter.viewToDom(e),r=t.firstChild;for(;r.firstChild;)t.appendChild(r.firstChild);r.remove(),u=i.data.htmlProcessor.htmlWriter.getHtml(t)}a.writer.setAttribute(`htmlContent`,u,o);for(let{item:e}of i.editing.view.createRangeIn(n))a.consumable.consume(e,{name:!0});return o},converterPriority:`low`}),o.for(`editingDowncast`).elementToElement({model:{name:r.model,attributes:[`htmlElementName`,`htmlCustomElementAttributes`,`htmlContent`]},view:(e,{writer:t})=>{let n=e.getAttribute(`htmlElementName`),r=t.createRawElement(n);return e.hasAttribute(`htmlCustomElementAttributes`)&&iL(t,e.getAttribute(`htmlCustomElementAttributes`),r),r}}),o.for(`dataDowncast`).elementToElement({model:{name:r.model,attributes:[`htmlElementName`,`htmlCustomElementAttributes`,`htmlContent`]},view:(e,{writer:t})=>{let n=e.getAttribute(`htmlElementName`),r=e.getAttribute(`htmlContent`),i=t.createRawElement(n,null,(e,t)=>{t.setContentOf(e,r)});return e.hasAttribute(`htmlCustomElementAttributes`)&&iL(t,e.getAttribute(`htmlCustomElementAttributes`),i),i}})})}};function sR(e){try{document.createElement(e)}catch{return!1}return!0}var cR=class extends F{static get pluginName(){return`GeneralHtmlSupport`}static get isOfficialPlugin(){return!0}static get requires(){return[SL,kL,ML,NL,FL,BL,WL,KL,QL,$L,rR,aR,oR]}init(){let e=this.editor,t=e.plugins.get(SL);t.loadAllowedEmptyElementsConfig(e.config.get(`htmlSupport.allowEmpty`)||[]),t.loadAllowedConfig(e.config.get(`htmlSupport.allow`)||[]),t.loadDisallowedConfig(e.config.get(`htmlSupport.disallow`)||[])}afterInit(){this.editor.commands.get(`removeFormat`)?.registerCustomAttribute(e=>e.startsWith(`html`)&&e.endsWith(`Attributes`),cL)}getGhsAttributeNameForElement(e){let t=this.editor.plugins.get(`DataSchema`),n=Array.from(t.getDefinitionsForView(e,!1)),r=n.find(e=>e.isInline&&!n[0].isObject);return r?r.model:uL(e)}addModelHtmlClass(e,t,n){let r=this.editor.model,i=this.getGhsAttributeNameForElement(e);r.change(e=>{for(let a of lR(r,n,i))sL(e,a,i,`classes`,e=>{for(let n of A(t))e.add(n)})})}removeModelHtmlClass(e,t,n){let r=this.editor.model,i=this.getGhsAttributeNameForElement(e);r.change(e=>{for(let a of lR(r,n,i))sL(e,a,i,`classes`,e=>{for(let n of A(t))e.delete(n)})})}setModelHtmlAttributes(e,t,n){let r=this.editor.model,i=this.getGhsAttributeNameForElement(e);r.change(e=>{for(let a of lR(r,n,i))sL(e,a,i,`attributes`,e=>{for(let[n,r]of Object.entries(t))e.set(n,r)})})}removeModelHtmlAttributes(e,t,n){let r=this.editor.model,i=this.getGhsAttributeNameForElement(e);r.change(e=>{for(let a of lR(r,n,i))sL(e,a,i,`attributes`,e=>{for(let n of A(t))e.delete(n)})})}setModelHtmlStyles(e,t,n){let r=this.editor.model,i=this.getGhsAttributeNameForElement(e);r.change(e=>{for(let a of lR(r,n,i))sL(e,a,i,`styles`,e=>{for(let[n,r]of Object.entries(t))e.set(n,r)})})}removeModelHtmlStyles(e,t,n){let r=this.editor.model,i=this.getGhsAttributeNameForElement(e);r.change(e=>{for(let a of lR(r,n,i))sL(e,a,i,`styles`,e=>{for(let n of A(t))e.delete(n)})})}};function*lR(e,t,n){if(t)if(!(Symbol.iterator in t)&&t.is(`documentSelection`)&&t.isCollapsed)e.schema.checkAttributeInSelection(t,n)&&(yield t);else for(let r of uR(e,t,n))yield*r.getItems({shallow:!0})}function uR(e,t,n){return!(Symbol.iterator in t)&&(t.is(`node`)||t.is(`$text`)||t.is(`$textProxy`))?e.schema.checkAttribute(t,n)?[e.createRangeOn(t)]:[]:e.schema.getValidRanges(e.createSelection(t).getRanges(),n)}var dR=class extends F{static get pluginName(){return`HtmlComment`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=new Map;e.data.processor.skipComments=!1,e.model.schema.extend(`$root`,{allowAttributes:`$comment`}),e.model.schema.addAttributeCheck((t,n)=>{if(n.startsWith(`$comment:`)&&e.model.schema.checkAttribute(t,`$comment`))return!0}),e.conversion.for(`upcast`).elementToMarker({view:`$comment`,model:e=>{let n=`$comment:${he()}`,r=e.getCustomProperty(`$rawContent`);return t.set(n,r),n}}),e.conversion.for(`dataDowncast`).markerToElement({model:`$comment`,view:(e,{writer:t})=>{let n;for(let t of this.editor.model.document.getRootNames())if(n=this.editor.model.document.getRoot(t),n.hasAttribute(e.markerName))break;let r=e.markerName,i=n.getAttribute(r),a=t.createUIElement(`$comment`);return t.setCustomProperty(`$rawContent`,i,a),a}}),e.model.document.registerPostFixer(n=>{let r=!1,i=e.model.document.differ.getChangedMarkers().filter(e=>e.name.startsWith(`$comment:`));for(let e of i){let{oldRange:i,newRange:a}=e.data;if(!(i&&a&&i.root==a.root)){if(i){let t=i.root;t.hasAttribute(e.name)&&(n.removeAttribute(e.name,t),r=!0)}if(a){let i=a.root;i.rootName==`$graveyard`?(n.removeMarker(e.name),r=!0):i.hasAttribute(e.name)||(n.setAttribute(e.name,t.get(e.name)||``,i),r=!0)}}}return r}),e.data.on(`set`,()=>{for(let t of e.model.markers.getMarkersGroup(`$comment`))this.removeHtmlComment(t.name)},{priority:`high`}),e.model.on(`deleteContent`,(t,[n])=>{for(let t of n.getRanges()){let n=e.model.schema.getLimitElement(t),r=e.model.createPositionAt(n,0),i=e.model.createPositionAt(n,`end`),a;a=r.isTouching(t.start)&&i.isTouching(t.end)?this.getHtmlCommentsInRange(e.model.createRange(r,i)):this.getHtmlCommentsInRange(t,{skipBoundaries:!0});for(let e of a)this.removeHtmlComment(e)}},{priority:`high`})}createHtmlComment(e,t){let n=he(),r=this.editor.model,i=r.document.getRoot(e.root.rootName),a=`$comment:${n}`;return r.change(n=>{let r=n.createRange(e);return n.addMarker(a,{usingOperation:!0,affectsData:!0,range:r}),n.setAttribute(a,t,i),a})}removeHtmlComment(e){let t=this.editor,n=t.model.markers.get(e);return n?(t.model.change(e=>{e.removeMarker(n)}),!0):!1}getHtmlCommentData(e){let t=this.editor.model.markers.get(e);if(!t)return null;let n=``;for(let t of this.editor.model.document.getRoots())if(t.hasAttribute(e)){n=t.getAttribute(e);break}return{content:n,position:t.getStart()}}getHtmlCommentsInRange(e,{skipBoundaries:t=!1}={}){let n=!t;return Array.from(this.editor.model.markers.getMarkersGroup(`$comment`)).filter(t=>r(t,e)).map(e=>e.name);function r(e,t){let r=e.getRange().start;return(r.isAfter(t.start)||n&&r.isEqual(t.start))&&(r.isBefore(t.end)||n&&r.isEqual(t.end))}}},fR=class extends Td{toView(e){if(!/<(?:html|body|head|meta)(?:\s[^>]*)?>/i.test(e.trim().slice(0,1e4)))return super.toView(e);let t=``,n=``;e=e.trim().replace(/<\?xml\s[^?]*\?>/i,e=>(n=e,``)),e=e.trim().replace(/^<!DOCTYPE\s[^>]*?>/i,e=>(t=e,``));let r=this._toDom(e),i=this.domConverter.domToView(r,{skipComments:this.skipComments}),a=new Np(i.document);a.setCustomProperty(`$fullPageDocument`,r.ownerDocument.documentElement.outerHTML,i);let o=Array.from(r.ownerDocument.querySelectorAll(`head style`));return a.setCustomProperty(`$fullPageHeadStyles`,o,i),t&&a.setCustomProperty(`$fullPageDocType`,t,i),n&&a.setCustomProperty(`$fullPageXmlDeclaration`,n,i),i}toData(e){let t=super.toData(e),n=e.getCustomProperty(`$fullPageDocument`),r=e.getCustomProperty(`$fullPageDocType`),i=e.getCustomProperty(`$fullPageXmlDeclaration`);return n&&(t=n.replace(/<\/body\s*>/,t+`$&`),r&&(t=r+`
`+t),i&&(t=i+`
`+t)),t}},pR=class extends F{static get pluginName(){return`FullPage`}static get licenseFeatureCode(){return`FPH`}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}constructor(e){super(e),e.config.define(`htmlSupport.fullPage`,{allowRenderStylesFromHead:!1,sanitizeCss:e=>(T(`css-full-page-provide-sanitize-function`),{css:e,hasChanged:!1})}),e.data.processor=new fR(e.data.viewDocument)}init(){let e=this.editor,t=[`$fullPageDocument`,`$fullPageDocType`,`$fullPageXmlDeclaration`,`$fullPageHeadStyles`];e.model.schema.extend(`$root`,{allowAttributes:t}),e.data.on(`toModel`,(n,[r])=>{let i=e.model.document.getRoot();e.model.change(e=>{for(let n of t){let t=r.getCustomProperty(n);t&&e.setAttribute(n,t,i)}}),mR(e)&&this._renderStylesFromHead(i)},{priority:`low`}),e.data.on(`toView`,(e,[n])=>{if(!n.is(`rootElement`))return;let r=n,i=e.return;if(!r.hasAttribute(`$fullPageDocument`))return;let a=new Np(i.document);for(let e of t){let t=r.getAttribute(e);t&&a.setCustomProperty(e,t,i)}},{priority:`low`}),e.data.on(`set`,()=>{let n=e.model.document.getRoot();e.model.change(e=>{for(let r of t)n.hasAttribute(r)&&e.removeAttribute(r,n)})},{priority:`high`}),e.data.on(`get`,(e,t)=>{t[0]||={},t[0].trim=!1},{priority:`high`})}destroy(){super.destroy(),mR(this.editor)&&this._removeStyleElementsFromDom()}_removeStyleElementsFromDom(){let e=Array.from(u.document.querySelectorAll(`[data-full-page-style-id="${this.editor.id}"]`));for(let t of e)t.remove()}_renderStyleElementsInDom(e){let t=this.editor,n=e.getAttribute(`$fullPageHeadStyles`);if(!n)return;let r=t.config.get(`htmlSupport.fullPage.sanitizeCss`);for(let e of n){e.setAttribute(`data-full-page-style-id`,t.id);let n=r(e.innerText);n.hasChanged&&(e.innerText=n.css),u.document.head.append(e)}}_renderStylesFromHead(e){this._removeStyleElementsFromDom(),this._renderStyleElementsInDom(e)}};function mR(e){return e.config.get(`htmlSupport.fullPage.allowRenderStylesFromHead`)}const hR=`htmlEmptyBlock`;var gR=class extends F{static get pluginName(){return`EmptyBlock`}static get isOfficialPlugin(){return!0}afterInit(){let{model:e,conversion:t,plugins:n,config:r}=this.editor,i=e.schema,a=r.get(`htmlSupport.preserveEmptyBlocksInEditingView`);i.extend(`$block`,{allowAttributes:[hR]}),i.extend(`$container`,{allowAttributes:[hR]}),i.isRegistered(`tableCell`)&&i.extend(`tableCell`,{allowAttributes:[hR]}),a?t.for(`downcast`).add(_R()):t.for(`dataDowncast`).add(_R()),t.for(`upcast`).add(vR(i)),n.has(`ClipboardPipeline`)&&this._registerClipboardPastingHandler()}_registerClipboardPastingHandler(){let e=this.editor.plugins.get(`ClipboardPipeline`);this.listenTo(e,`contentInsertion`,(e,t)=>{t.sourceEditorId!==this.editor.id&&this.editor.model.change(e=>{for(let{item:n}of e.createRangeIn(t.content))n.is(`element`)&&n.hasAttribute(hR)&&e.removeAttribute(hR,n)})})}};function _R(){return e=>{e.on(`attribute:${hR}`,(e,t,n)=>{let{mapper:r,consumable:i}=n,{item:a}=t;if(!i.consume(a,e.name))return;let o=r.toViewElement(a);o&&t.attributeNewValue&&(o.getFillerOffset=()=>null)})}}function vR(e){return t=>{t.on(`element`,(t,n,r)=>{let{viewItem:i,modelRange:a}=n;if(!i.is(`element`)||!i.isEmpty||i.getCustomProperty(`$hasBlockFiller`))return;let o=a&&a.start.nodeAfter;if(!o||!e.checkAttribute(o,hR)||(r.writer.setAttribute(hR,!0,o),o.childCount!=1))return;let s=o.getChild(0);s.is(`element`,`paragraph`)&&e.checkAttribute(s,hR)&&r.writer.setAttribute(hR,!0,s)},{priority:`lowest`})}}var yR=class extends F{static get pluginName(){return`IndentEditing`}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.commands.add(`indent`,new co(e)),e.commands.add(`outdent`,new co(e))}},bR=class extends F{static get pluginName(){return`IndentUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale,n=e.t,r=t.uiLanguageDirection==`ltr`?G_:jv,i=t.uiLanguageDirection==`ltr`?jv:G_;this._defineButton(`indent`,n(`Increase indent`),r),this._defineButton(`outdent`,n(`Decrease indent`),i)}_defineButton(e,t,n){let r=this.editor;r.ui.componentFactory.add(e,()=>{let r=this._createButton(H,e,t,n);return r.set({tooltip:!0}),r}),r.ui.componentFactory.add(`menuBar:`+e,()=>this._createButton(U,e,t,n))}_createButton(e,t,n,r){let i=this.editor,a=i.commands.get(t),o=new e(i.locale);return o.set({label:n,icon:r}),o.bind(`isEnabled`).to(a,`isEnabled`),this.listenTo(o,`execute`,()=>{i.execute(t),i.editing.view.focus()}),o}},xR=class extends F{static get pluginName(){return`Indent`}static get isOfficialPlugin(){return!0}static get requires(){return[yR,bR]}},SR=class extends I{_indentBehavior;constructor(e,t){super(e),this._indentBehavior=t}refresh(){let e=this.editor.model,t=j(e.document.selection.getSelectedBlocks());if(!t||!this._isIndentationChangeAllowed(t)){this.isEnabled=!1;return}this.isEnabled=this._indentBehavior.checkEnabled(t.getAttribute(`blockIndent`))}execute(){let e=this.editor.model,t=this._getBlocksToChange();e.change(e=>{for(let n of t){let t=n.getAttribute(`blockIndent`),r=this._indentBehavior.getNextIndent(t);r?e.setAttribute(`blockIndent`,r,n):e.removeAttribute(`blockIndent`,n)}})}_getBlocksToChange(){let e=this.editor.model.document.selection;return Array.from(e.getSelectedBlocks()).filter(e=>this._isIndentationChangeAllowed(e))}_isIndentationChangeAllowed(e){let t=this.editor;return t.model.schema.checkAttribute(e,`blockIndent`)?!t.plugins.has(`ListUtils`)||!this._indentBehavior.isForward?!0:!t.plugins.get(`ListUtils`).isListItemBlock(e):!1}},CR=class{isForward;offset;unit;constructor(e){this.isForward=e.direction===`forward`,this.offset=e.offset,this.unit=e.unit}checkEnabled(e){let t=parseFloat(e||`0`);return this.isForward||t>0}getNextIndent(e){let t=parseFloat(e||`0`),n=!e||e.endsWith(this.unit);if(t<0)return;if(!n)return this.isForward?this.offset+this.unit:void 0;let r=t+(this.isForward?this.offset:-this.offset);return r>0?r+this.unit:void 0}},wR=class{isForward;classes;constructor(e){this.isForward=e.direction===`forward`,this.classes=e.classes}checkEnabled(e){let t=this.classes.indexOf(e);return this.isForward?t<this.classes.length-1:t>=0}getNextIndent(e){let t=this.classes.indexOf(e)+(this.isForward?1:-1),n=Math.min(t,this.classes.length-1);return this.classes[n]}},TR=class{_startElement;_referenceIndent;_isForward;_includeSelf;_sameAttributes;_sameIndent;_lowerIndent;_higherIndent;constructor(e,t){this._startElement=e,this._referenceIndent=e.getAttribute(`listIndent`),this._isForward=t.direction==`forward`,this._includeSelf=!!t.includeSelf,this._sameAttributes=A(t.sameAttributes||[]),this._sameIndent=!!t.sameIndent,this._lowerIndent=!!t.lowerIndent,this._higherIndent=!!t.higherIndent}static first(e,t){return j(new this(e,t)[Symbol.iterator]())}*[Symbol.iterator](){let e=[];for(let{node:t}of new ER(this._getStartNode(),this._isForward?`forward`:`backward`)){let n=t.getAttribute(`listIndent`);if(n<this._referenceIndent){if(!this._lowerIndent)break;this._referenceIndent=n}else if(n>this._referenceIndent){if(!this._higherIndent)continue;if(!this._isForward){e.push(t);continue}}else{if(!this._sameIndent){if(this._higherIndent){e.length&&=(yield*e,0);break}continue}if(this._sameAttributes.some(e=>t.getAttribute(e)!==this._startElement.getAttribute(e)))break}e.length&&=(yield*e,0),yield t}}_getStartNode(){return this._includeSelf?this._startElement:this._isForward?this._startElement.nextSibling:this._startElement.previousSibling}},ER=class{_node;_isForward;_previousNodesByIndent=[];_previous=null;_previousNodeIndent=null;constructor(e,t=`forward`){this._node=e,this._isForward=t===`forward`}[Symbol.iterator](){return this}next(){if(!G(this._node))return{done:!0,value:void 0};let e=this._node.getAttribute(`listIndent`),t=null;if(this._previous){let n=this._previousNodeIndent;e>n?this._previousNodesByIndent[n]=this._previous:e<n?(t=this._previousNodesByIndent[e]||null,this._previousNodesByIndent.length=e):t=this._previous}let n={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:n,done:!1}}},DR=class{_listHead;constructor(e){this._listHead=e}[Symbol.iterator](){return new ER(this._listHead)}},OR=class{static next(){return he()}};function G(e){return!!e&&e.is(`element`)&&e.hasAttribute(`listItemId`)}function kR(e,t={}){return[...AR(e,{...t,direction:`backward`}),...AR(e,{...t,direction:`forward`})]}function AR(e,t={}){let n=t.direction==`forward`,r=Array.from(new TR(e,{...t,includeSelf:n,sameIndent:!0,sameAttributes:`listItemId`}));return n?r:r.reverse()}function jR(e){return Array.from(new TR(e,{direction:`forward`,higherIndent:!0}))}function MR(e,t){let n=new TR(e,{sameIndent:!0,sameAttributes:`listType`,...t}),r=new TR(e,{sameIndent:!0,sameAttributes:`listType`,includeSelf:!0,direction:`forward`,...t});return[...Array.from(n).reverse(),...r]}function NR(e){return!TR.first(e,{sameIndent:!0,sameAttributes:`listItemId`})}function PR(e){return!TR.first(e,{direction:`forward`,sameIndent:!0,sameAttributes:`listItemId`})}function FR(e,t={}){e=A(e);let n=t.withNested!==!1,r=new Set;for(let t of e)for(let e of kR(t,{higherIndent:n}))r.add(e);return WR(r)}function IR(e){e=A(e);let t=new Set;for(let n of e)for(let e of MR(n))t.add(e);return WR(t)}function LR(e,t){let n=AR(e,{direction:`forward`}),r=OR.next();for(let e of n)t.setAttribute(`listItemId`,r,e);return n}function RR(e,t,n){let r={};for(let[e,n]of t.getAttributes())e.startsWith(`list`)&&(r[e]=n);let i=AR(e,{direction:`forward`});for(let e of i)n.setAttributes(r,e);return i}function zR(e,t,{expand:n,indentBy:r=1,attributeNames:i}){e=A(e);let a=n?FR(e):e;for(let e of a){let n=e.getAttribute(`listIndent`)+r;n<0?VR(e,t,i):t.setAttribute(`listIndent`,n,e)}return a}function BR(e,t,{attributeNames:n}){e=A(e);let r=FR(e),i=new Set,a=Math.min(...r.map(e=>e.getAttribute(`listIndent`))),o=new Map;for(let e of r)o.set(e,TR.first(e,{lowerIndent:!0}));for(let e of r){if(i.has(e))continue;i.add(e);let r=e.getAttribute(`listIndent`)-1;if(r<0){VR(e,t,n);continue}if(e.getAttribute(`listIndent`)==a&&o.get(e)){let n=YR(e,o.get(e),t);for(let e of n)i.add(e);if(n.length)continue}t.setAttribute(`listIndent`,r,e)}return WR(i)}function VR(e,t,n){e=A(e);for(let n of e)n.is(`element`,`listItem`)&&t.rename(n,`paragraph`);for(let r of e)for(let e of r.getAttributeKeys())n.includes(e)&&t.removeAttribute(e,r);return e}function HR(e){if(!e.length)return!1;let t=e[0].getAttribute(`listItemId`);return t?!e.some(e=>e.getAttribute(`listItemId`)!=t):!1}function UR(e,t){let n=[],r=1/0;for(let{node:i}of new ER(e.nextSibling)){let e=i.getAttribute(`listIndent`);if(e==0)break;e<r&&(r=e);let a=e-r;t.setAttribute(`listIndent`,a,i),n.push(i)}return n}function WR(e){return Array.from(e).filter(e=>e.root.rootName!==`$graveyard`).sort((e,t)=>e.index-t.index)}function GR(e){let t=e.document.selection.getSelectedElement();return t&&e.schema.isObject(t)&&e.schema.isBlock(t)?t:null}function KR(e,t){return t.checkChild(e.parent,`listItem`)&&t.checkChild(e,`$text`)&&!t.isObject(e)}function qR(e){return e==`numbered`||e==`customNumbered`}function JR(e){let t=e.getAttribute(`listIndent`),n=e.getAttribute(`listType`),r=e.getAttribute(`listItemId`),i=e.previousSibling,a=!1;for(;G(i);){let e=i.getAttribute(`listIndent`);if(e<t)return!0;if(e===t)return i.getAttribute(`listItemId`)===r?!1:i.getAttribute(`listType`)!==n;a=!0,i=i.previousSibling}return!a}function YR(e,t,n){return AR(t,{direction:`forward`}).pop().index>e.index?RR(e,t,n):[]}var XR=class extends I{_direction;constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute(){let e=this.editor,t=e.model,n=ZR(t.document.selection),r=e.plugins.get(`ListEditing`).getListAttributeNames();t.change(e=>{let t=[];HR(n)&&!NR(n[0])?(this._direction==`forward`&&t.push(...zR(n,e,{attributeNames:r})),t.push(...LR(n[0],e))):this._direction==`forward`?t.push(...zR(n,e,{expand:!0,attributeNames:r})):t.push(...BR(n,e,{attributeNames:r}));for(let n of t){if(!n.hasAttribute(`listType`))continue;let t=TR.first(n,{sameIndent:!0});t&&e.setAttribute(`listType`,t.getAttribute(`listType`),n)}this._fireAfterExecute(t)})}_fireAfterExecute(e){this.fire(`afterExecute`,WR(new Set(e)))}_checkEnabled(){let e=ZR(this.editor.model.document.selection),t=e[0];if(!t)return!1;if(this._direction==`backward`||HR(e)&&!NR(e[0])||this.editor.config.get(`list.enableSkipLevelLists`))return!0;e=FR(e),t=e[0];let n=TR.first(t,{sameIndent:!0});return n?n.getAttribute(`listType`)==t.getAttribute(`listType`):!1}};function ZR(e){let t=Array.from(e.getSelectedBlocks()),n=t.findIndex(e=>!G(e));return n!=-1&&(t.length=n),t}var QR=class extends I{type;_listWalkerOptions;constructor(e,t,n={}){super(e),this.type=t,this._listWalkerOptions=n.multiLevel?{higherIndent:!0,lowerIndent:!0,sameAttributes:[]}:void 0}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){let t=this.editor.model,n=t.document,r=GR(t),i=Array.from(n.selection.getSelectedBlocks()).filter(e=>t.schema.checkAttribute(e,`listType`)||KR(e,t.schema)),a=e.forceValue===void 0?this.value:!e.forceValue;t.change(o=>{if(a){let e=i[i.length-1],t=this.editor.plugins.get(`ListEditing`).getListAttributeNames(),n=AR(e,{direction:`forward`}),r=[];n.length>1&&r.push(...LR(n[1],o)),r.push(...VR(i,o,t)),r.push(...UR(e,o)),this._fireAfterExecute(r)}else if((r||n.selection.isCollapsed)&&G(i[0])){let t=MR(r||i[0],this._listWalkerOptions);for(let n of t)o.setAttributes({...e.additionalAttributes,listType:this.type},n);this._fireAfterExecute(t)}else{let n=[];for(let r of i)if(!r.hasAttribute(`listType`))!r.is(`element`,`listItem`)&&KR(r,t.schema)&&o.rename(r,`listItem`),o.setAttributes({...e.additionalAttributes,listIndent:0,listItemId:OR.next(),listType:this.type},r),n.push(r);else for(let t of FR(r,{withNested:!1}))t.getAttribute(`listType`)!=this.type&&(o.setAttributes({...e.additionalAttributes,listType:this.type},t),n.push(t));this._fireAfterExecute(n)}})}_fireAfterExecute(e){this.fire(`afterExecute`,WR(new Set(e)))}_getValue(){let e=this.editor.model.document.selection,t=Array.from(e.getSelectedBlocks());if(!t.length)return!1;for(let e of t)if(e.getAttribute(`listType`)!=this.type)return!1;return!0}_checkEnabled(){let e=this.editor.model,t=e.schema,n=e.document.selection,r=Array.from(n.getSelectedBlocks());if(!r.length)return!1;if(this.value)return!0;for(let e of r)if(t.checkAttribute(e,`listType`)||KR(e,t))return!0;return!1}},$R=class extends I{_direction;constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute({shouldMergeOnBlocksContentLevel:e=!1}={}){let t=this.editor,n=t.model,r=n.document.selection,i=[],a=t.plugins.get(`ListEditing`).getListAttributeNames();n.change(t=>{let{firstElement:o,lastElement:s}=this._getMergeSubjectElements(r,e);if(!o||!s)return;let c=o.getAttribute(`listIndent`)||0,l=s.getAttribute(`listIndent`),u=s.getAttribute(`listItemId`);if(c!=l){let e=jR(s);i.push(...zR([s,...e],t,{indentBy:c-l,expand:c<l,attributeNames:a}))}if(e){let e=r;r.isCollapsed&&(e=t.createSelection(t.createRange(t.createPositionAt(o,`end`),t.createPositionAt(s,0)))),n.deleteContent(e,{doNotResetEntireContent:r.isCollapsed});let a=e.getLastPosition().parent,c=a.nextSibling;i.push(a),c&&c!==s&&c.getAttribute(`listItemId`)==u&&i.push(...RR(c,a,t))}else i.push(...RR(s,o,t));this._fireAfterExecute(i)})}_fireAfterExecute(e){this.fire(`afterExecute`,WR(new Set(e)))}_checkEnabled(){let e=this.editor.model,t=e.document.selection,n=GR(e);if(t.isCollapsed||n){let e=n||t.getFirstPosition().parent;if(!G(e))return!1;let r=this._direction==`backward`?e.previousSibling:e.nextSibling;if(!r||HR([e,r]))return!1}else{let e=t.getLastPosition(),n=t.getFirstPosition();if(e.parent===n.parent||!G(e.parent))return!1}return!0}_getMergeSubjectElements(e,t){let n=this.editor.model,r=GR(n),i,a;if(e.isCollapsed||r){let n=r||e.getFirstPosition().parent,o=NR(n);this._direction==`backward`?(a=n,o&&!t?(i=TR.first(n,{sameIndent:!0,lowerIndent:!0}),!i&&G(n.previousSibling)&&(i=n.previousSibling)):i=n.previousSibling):(i=n,a=n.nextSibling)}else i=e.getFirstPosition().parent,a=e.getLastPosition().parent;return{firstElement:i,lastElement:a}}},ez=class extends I{_direction;constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute(){this.editor.model.change(e=>{let t=LR(this._getStartBlock(),e);this._fireAfterExecute(t)})}_fireAfterExecute(e){this.fire(`afterExecute`,WR(new Set(e)))}_checkEnabled(){let e=this.editor.model.document.selection,t=this._getStartBlock();return e.isCollapsed&&G(t)&&!NR(t)}_getStartBlock(){let e=this.editor.model.document.selection.getFirstPosition().parent;return this._direction==`before`?e:e.nextSibling}},tz=class extends F{static get pluginName(){return`ListItemBoldIntegration`}static get isOfficialPlugin(){return!0}static get requires(){return[Bz]}init(){let e=this.editor,t=e.plugins.get(`ListFormatting`),n=e.plugins.get(Bz);!e.plugins.has(`BoldEditing`)||!this.editor.config.get(`list.enableListItemMarkerFormatting`)||(t.registerFormatAttribute(`bold`,`listItemBold`),n.registerDowncastStrategy({scope:`item`,attributeName:`listItemBold`,setAttributeOnDowncast(e,t,n,r){t&&(e.addClass(`ck-list-marker-bold`,n),p.isSafari&&!(r&&r.dataPipeline)&&e.setStyle(`--ck-content-list-marker-dummy-bold`,`0`,n))}}))}afterInit(){let 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:!0}),t.schema.addAttributeCheck(e=>{if(!e.last.getAttribute(`listItemId`))return!1},`listItemBold`),e.conversion.for(`upcast`).attributeToAttribute({model:`listItemBold`,view:{name:`li`,classes:`ck-list-marker-bold`}}))}},nz=class extends F{static get pluginName(){return`ListItemItalicIntegration`}static get isOfficialPlugin(){return!0}static get requires(){return[Bz]}init(){let e=this.editor,t=e.plugins.get(`ListFormatting`),n=e.plugins.get(Bz);!e.plugins.has(`ItalicEditing`)||!this.editor.config.get(`list.enableListItemMarkerFormatting`)||(t.registerFormatAttribute(`italic`,`listItemItalic`),n.registerDowncastStrategy({scope:`item`,attributeName:`listItemItalic`,setAttributeOnDowncast(e,t,n,r){t&&(e.addClass(`ck-list-marker-italic`,n),p.isSafari&&!(r&&r.dataPipeline)&&e.setStyle(`--ck-content-list-marker-dummy-italic`,`0`,n))}}))}afterInit(){let 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:!0}),t.schema.addAttributeCheck(e=>{if(!e.last.getAttribute(`listItemId`))return!1},`listItemItalic`),e.conversion.for(`upcast`).attributeToAttribute({model:`listItemItalic`,view:{name:`li`,classes:`ck-list-marker-italic`}}))}},rz=class extends F{static get pluginName(){return`ListItemFontSizeIntegration`}static get isOfficialPlugin(){return!0}static get requires(){return[Bz]}init(){let e=this.editor,t=e.plugins.get(`ListFormatting`),n=e.plugins.get(Bz);if(!e.plugins.has(`FontSizeEditing`)||!this.editor.config.get(`list.enableListItemMarkerFormatting`))return;let r=ZF(e.config.get(`fontSize.options`));t.registerFormatAttribute(`fontSize`,`listItemFontSize`),n.registerDowncastStrategy({scope:`item`,attributeName:`listItemFontSize`,setAttributeOnDowncast(e,t,n,i){if(t){let a=r.find(e=>e.model==t);a&&a.view&&typeof a.view!=`string`?a.view.styles?(e.addClass(`ck-list-marker-font-size`,n),e.setStyle(`--ck-content-list-marker-font-size`,a.view.styles[`font-size`],n)):a.view.classes&&(e.addClass(`ck-list-marker-font-size-${t}`,n),p.isSafari&&!(i&&i.dataPipeline)&&e.setStyle(`--ck-content-list-marker-dummy-font-size`,`0`,n)):(e.addClass(`ck-list-marker-font-size`,n),e.setStyle(`--ck-content-list-marker-font-size`,t,n))}}})}afterInit(){let 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:!0}),t.schema.addAttributeCheck(e=>{if(!e.last.getAttribute(`listItemId`))return!1},`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":/.*/}}});let n=ZF(e.config.get(`fontSize.options`));for(let t of n)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}`}})}},iz=class extends F{static get pluginName(){return`ListItemFontColorIntegration`}static get isOfficialPlugin(){return!0}static get requires(){return[Bz]}init(){let e=this.editor,t=e.plugins.get(`ListFormatting`),n=e.plugins.get(Bz);!e.plugins.has(`FontColorEditing`)||!this.editor.config.get(`list.enableListItemMarkerFormatting`)||(t.registerFormatAttribute(`fontColor`,`listItemFontColor`),n.registerDowncastStrategy({scope:`item`,attributeName:`listItemFontColor`,setAttributeOnDowncast(e,t,n){t&&(e.addClass(`ck-list-marker-color`,n),e.setStyle(`--ck-content-list-marker-color`,t,n))}}))}afterInit(){let 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:!0}),t.schema.addAttributeCheck(e=>{if(!e.last.getAttribute(`listItemId`))return!1},`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":/.*/}}}))}},az=class extends F{static get pluginName(){return`ListItemFontFamilyIntegration`}static get isOfficialPlugin(){return!0}static get requires(){return[Bz]}init(){let e=this.editor,t=e.plugins.get(`ListFormatting`),n=e.plugins.get(Bz);!e.plugins.has(`FontFamilyEditing`)||!this.editor.config.get(`list.enableListItemMarkerFormatting`)||(t.registerFormatAttribute(`fontFamily`,`listItemFontFamily`),n.registerDowncastStrategy({scope:`item`,attributeName:`listItemFontFamily`,setAttributeOnDowncast(e,t,n){t&&(e.addClass(`ck-list-marker-font-family`,n),e.setStyle(`--ck-content-list-marker-font-family`,t,n))}}))}afterInit(){let 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:!0}),t.schema.addAttributeCheck(e=>{if(!e.last.getAttribute(`listItemId`))return!1},`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":/.*/}}}))}},oz=class extends F{_loadedFormatting={};static get pluginName(){return`ListFormatting`}static get isOfficialPlugin(){return!0}static get requires(){return[tz,nz,rz,iz,az]}constructor(e){super(e),e.config.define(`list.enableListItemMarkerFormatting`,!0)}afterInit(){this.editor.config.get(`list.enableListItemMarkerFormatting`)&&this._registerPostfixerForListItemFormatting()}_registerPostfixerForListItemFormatting(){let e=this.editor.model;e.document.registerPostFixer(t=>{let n=e.document.differ.getChanges(),r=new Set,i=!1;for(let e of n)if(e.type===`attribute`)(e.attributeKey==`listItemId`||e.attributeKey==`listType`||this._isInlineOrSelectionFormatting(e.attributeKey)||Object.values(this._loadedFormatting).includes(e.attributeKey))&&(G(e.range.start.nodeAfter)?r.add(e.range.start.nodeAfter):G(e.range.start.parent)&&r.add(e.range.start.parent));else if(G(e.position.nodeAfter)&&r.add(e.position.nodeAfter),G(e.position.nodeBefore)&&r.add(e.position.nodeBefore),G(e.position.parent)&&r.add(e.position.parent),e.type==`insert`&&e.name!=`$text`){let n=t.createRangeIn(e.position.nodeAfter);for(let e of n.getItems())G(e)&&r.add(e)}for(let n of r){let r=sz(e,n,Object.keys(this._loadedFormatting));for(let[e,a]of Object.entries(r)){let r=this._loadedFormatting[e];(a&&lz(t,n,r,a)||!a&&uz(t,n,r))&&(i=!0)}}return i})}registerFormatAttribute(e,t){this._loadedFormatting[e]=t}_isInlineOrSelectionFormatting(e){return e.replace(/^selection:/,``)in this._loadedFormatting}};function sz(e,t,n){return NR(t)?cz(e,t,n):cz(e,kR(t)[0],n)}function cz(e,t,n){if(!dz(t)||e.schema.isLimit(t))return Object.fromEntries(n.map(e=>[e]));if(t.isEmpty)return Object.fromEntries(n.map(e=>[e,t.getAttribute(`selection:${e}`)]));let r=new Set(n),i={},a=e.createRangeIn(t).getWalker({ignoreElementEnd:!0});for(let{item:t}of a){for(let n of r)if(e.schema.checkAttribute(t,n)){let e=t.getAttribute(n);e===void 0?(r.delete(n),i[n]=void 0):i[n]===void 0?i[n]=e:i[n]!==e&&(r.delete(n),i[n]=void 0)}else n in i||(i[n]=void 0);if(!r.size)break;e.schema.isLimit(t)&&a.jumpTo(e.createPositionAfter(t))}return i}function lz(e,t,n,r){let i=kR(t),a=!1;for(let t of i)(!t.hasAttribute(n)||t.getAttribute(n)!==r)&&(e.setAttribute(n,r,t),a=!0);return a}function uz(e,t,n){let r=kR(t),i=!1;for(let t of r)t.hasAttribute(n)&&(e.removeAttribute(n,t),i=!0);return i}function dz(e){return[`numbered`,`bulleted`,`customNumbered`,`customBulleted`].includes(e.getAttribute(`listType`))}var fz=class extends F{static get pluginName(){return`ListUtils`}static get isOfficialPlugin(){return!0}expandListBlocksToCompleteList(e){return IR(e)}isFirstBlockOfListItem(e){return NR(e)}isListItemBlock(e){return G(e)}expandListBlocksToCompleteItems(e,t={}){return FR(e,t)}isNumberedListType(e){return qR(e)}isFirstListItemInList(e){return JR(e)}};function pz(e){return e.is(`element`,`ol`)||e.is(`element`,`ul`)}function mz(e){return e.is(`element`,`li`)}function hz(e){let t=0,n=e.parent;for(;n;){if(mz(n))t++;else{let e=n.previousSibling;e&&mz(e)&&t++}n=n.parent}return t}function gz(e,t,n,r=yz(n,t)){return e.createAttributeElement(vz(n),null,{priority:2*t/100-100,id:r})}function _z(e,t,n){return e.createAttributeElement(`li`,null,{priority:(2*t+1)/100-100,id:n})}function vz(e){return e==`numbered`||e==`customNumbered`?`ol`:`ul`}function yz(e,t){return`list-${e}-${t}`}function bz(e,t,n){let r=e.nodeBefore;if(G(r)){let e=r;for(let{node:i}of new ER(e,`backward`))if(e=i,n.has(e)||(n.add(e),t.has(r)))return;t.add(e)}else{let n=e.nodeAfter;G(n)&&t.add(n)}}function xz(e,t){let n=0,r=-1,i=null,a=!1;for(let{node:o}of e){let e=o.getAttribute(`listIndent`);if(e>n){let s;i===null?(i=e-n,s=n):(i>e&&(i=e),s=e-i),s>r+1&&(s=r+1),t.setAttribute(`listIndent`,s,o),a=!0,r=s}else i=null,n=e+1,r=e}return a}function Sz(e,t,n){let r=new Set,i=!1;for(let{node:a}of e){if(r.has(a))continue;let e=a.getAttribute(`listType`),o=a.getAttribute(`listItemId`);if(t.has(o)&&(o=OR.next()),t.add(o),a.is(`element`,`listItem`)){a.getAttribute(`listItemId`)!=o&&(n.setAttribute(`listItemId`,o,a),i=!0);continue}for(let t of AR(a,{direction:`forward`}))r.add(t),t.getAttribute(`listType`)!=e&&(o=OR.next(),e=t.getAttribute(`listType`)),t.getAttribute(`listItemId`)!=o&&(n.setAttribute(`listItemId`,o,t),i=!0)}return i}function Cz(){return(e,t,n)=>{let r=t.viewItem;if(r.getStyle(`list-style-type`)!==`none`||!wz(r)||!n.consumable.consume(r,{name:!0}))return;let{modelRange:i,modelCursor:a}=n.convertChildren(r,t.modelCursor);t.modelRange=i,t.modelCursor=a}}function wz(e){let t=!1;for(let n of e.getChildren()){if(n.is(`element`,`ul`)||n.is(`element`,`ol`)){t=!0;continue}return!1}return t}function Tz(){return(e,t,n)=>{let{writer:r,schema:i}=n;if(!t.modelRange)return;let a=Array.from(t.modelRange.getItems({shallow:!0})).filter(e=>i.checkAttribute(e,`listItemId`));if(!a.length||a.every(e=>e.hasAttribute(`listItemId`)))return;let o=t.viewItem.getAttribute(`data-list-item-id`)||OR.next();n.consumable.consume(t.viewItem,{attributes:`data-list-item-id`});let s=hz(t.viewItem),c=t.viewItem.parent&&t.viewItem.parent.is(`element`,`ol`)?`numbered`:`bulleted`,l=a[0].getAttribute(`listType`);l&&(c=l);let u={listItemId:o,listIndent:s,listType:c};for(let e of a)e.hasAttribute(`listItemId`)||r.setAttributes(u,e);a.length>1&&a[1].getAttribute(`listItemId`)!=u.listItemId&&n.keepEmptyElement(a[0])}}function Ez(e,t,n,r){return()=>{let r=e.document.differ.getChanges(),a=[],o=new Set,c=new Set,l=new Set;for(let e of r)if(e.type==`insert`&&e.name!=`$text`)bz(e.position,o,l),e.attributes.has(`listItemId`)?c.add(e.position.nodeAfter):bz(e.position.getShiftedBy(e.length),o,l);else if(e.type==`remove`&&e.attributes.has(`listItemId`))bz(e.position,o,l);else if(e.type==`attribute`){let t=e.range.start.nodeAfter;n.includes(e.attributeKey)?(bz(e.range.start,o,l),e.attributeNewValue===null?(bz(e.range.start.getShiftedBy(1),o,l),s(t)&&a.push(t)):c.add(t)):G(t)&&s(t)&&a.push(t)}for(let e of o.values())a.push(...i(e,c));for(let e of new Set(a))t.reconvertItem(e)};function i(e,t){let n=[],r=new Set,i=[];for(let{node:c,previous:u}of new ER(e)){if(r.has(c))continue;let e=c.getAttribute(`listIndent`);u&&e<u.getAttribute(`listIndent`)&&(i.length=e+1),i[e]={modelAttributes:a(c),modelElement:c},o(c,e,i);let d=AR(c,{direction:`forward`});for(let e of d)r.add(e),(s(e,d)||l(e,i,t))&&n.push(e)}return n}function a(e){return Object.fromEntries(Array.from(e.getAttributes()).filter(([e])=>n.includes(e)))}function o(e,t,n){for(let r=t-1;r>=0&&!n[r];r--){let t=Iz(e,r),i=null;if(!t){for(let e=r-1;e>=0;e--)if(n[e]){i=n[e].modelElement;break}}let o=t||i||e;n[r]={modelAttributes:{...a(o),listItemId:`list-item-skip-${r}`,listIndent:r},modelElement:o}}}function s(e,i){let a=t.mapper.toViewElement(e);if(!a)return!1;if(c(a)||r.fire(`checkElement`,{modelElement:e,viewElement:a}))return!0;if(!e.is(`element`,`paragraph`)&&!e.is(`element`,`listItem`))return!1;let o=Rz(e,n,i);return o&&a.is(`element`,`p`)?!0:!!(!o&&a.is(`element`,`span`))}function c(e){for(e=e.parent;e.is(`attributeElement`)&&[`ol`,`ul`,`li`].includes(e.name);)e=e.parent;return!!(e.getCustomProperty(`$structureSlotParent`)&&!t.mapper.toModelElement(e))}function l(e,n,i){if(i.has(e))return!1;let a=t.mapper.toViewElement(e),o=n.length-1;for(let e=a.parent;!e.is(`editableElement`);e=e.parent){let t=mz(e),i=pz(e);if(!(!i&&!t)){if(n[o]){let i=`checkAttributes:${t?`item`:`list`}`;if(r.fire(i,{viewElement:e,modelAttributes:n[o].modelAttributes,modelReferenceElement:n[o].modelElement}))break}if(i&&(o--,o<0))return!1}}return!0}}function Dz(e,t,n,{dataPipeline:r,enableSkipLevelLists:i}){let a=Lz(e,t);return(o,s,c)=>{let{writer:l,mapper:u,consumable:d}=c,f=s.item;if(!e.includes(s.attributeKey)||!a(f,d))return;let p={...c.options,dataPipeline:r,enableSkipLevelLists:i},m=Az(f,u,n,l);Mz(m,l,u),Pz(m,l),Fz(f,Nz(f,m,t,l,p),t,l,p)}}function Oz(e){return(t,n,r)=>{let{writer:i,mapper:a}=r,o=t.name.split(`:`)[1];if(!e.checkAttribute(o,`listItemId`))return;let s=a.toViewPosition(n.position),c=n.position.getShiftedBy(n.length),l=a.toViewPosition(c,{isPhantom:!0}),u=i.createRange(s,l).getTrimmed().end.nodeBefore;u&&Mz(u,i,a)}}function kz(e,{dataPipeline:t}={}){return(n,{writer:r})=>{if(!Rz(n,e))return null;if(!t)return r.createContainerElement(`span`,{class:`ck-list-bogus-paragraph`});let i=r.createContainerElement(`p`);return r.setCustomProperty(`dataPipeline:transparentRendering`,!0,i),i}}function Az(e,t,n,r){let i=n.createRangeOn(e),a=t.toViewRange(i).getTrimmed().getWalker();for(let{item:e}of a)if(e.is(`element`)&&e.getCustomProperty(`listItemMarker`))a.jumpTo(r.createPositionAfter(e));else if(e.is(`element`)&&!e.getCustomProperty(`listItemWrapper`))return e}function jz(e,t){return(n,r)=>{if(r.modelPosition.offset>0)return;let i=r.modelPosition.parent;if(!G(i)||!e.some(e=>e.scope==`itemMarker`&&e.canInjectMarkerIntoElement&&e.canInjectMarkerIntoElement(i)))return;let a=r.mapper.toViewElement(i),o=t.createRangeIn(a),s=o.getWalker(),c=o.start;for(let{item:e}of s){if(e.is(`element`)&&r.mapper.toModelElement(e)||e.is(`$textProxy`))break;e.is(`element`)&&e.getCustomProperty(`listItemMarker`)&&(c=t.createPositionAfter(e),s.skip(({previousPosition:e})=>!e.isEqual(c)))}r.viewPosition=c}}function Mz(e,t,n){for(;e.parent.is(`attributeElement`)&&e.parent.getCustomProperty(`listItemWrapper`);)t.unwrap(t.createRangeOn(e),e.parent);let r=[];i(t.createPositionBefore(e).getWalker({direction:`backward`})),i(t.createRangeIn(e).getWalker());for(let e of r)t.remove(e);function i(e){for(let{item:t}of e){if(t.is(`element`)&&n.toModelElement(t))break;t.is(`element`)&&t.getCustomProperty(`listItemMarker`)&&r.push(t)}}}function Nz(e,t,n,r,{dataPipeline:i}){let a=r.createRangeOn(t);if(!NR(e))return a;for(let o of n){if(o.scope!=`itemMarker`)continue;let n=o.createElement(r,e,{dataPipeline:i});if(!n||(r.setCustomProperty(`listItemMarker`,!0,n),o.canInjectMarkerIntoElement&&o.canInjectMarkerIntoElement(e)?r.insert(r.createPositionAt(t,0),n):(r.insert(a.start,n),a=r.createRange(r.createPositionBefore(n),r.createPositionAfter(t))),!o.createWrapperElement||!o.canWrapElement))continue;let s=o.createWrapperElement(r,e,{dataPipeline:i});r.setCustomProperty(`listItemWrapper`,!0,s),o.canWrapElement(e)?a=r.wrap(a,s):(a=r.wrap(r.createRangeOn(n),s),a=r.createRange(a.start,r.createPositionAfter(t)))}return a}function Pz(e,t){let n=e.parent;for(;n.is(`attributeElement`)&&[`ul`,`ol`,`li`].includes(n.name);){let r=n.parent;t.unwrap(t.createRangeOn(e),n),n=r}}function Fz(e,t,n,r,i){if(!e.hasAttribute(`listIndent`))return;let a=e.getAttribute(`listIndent`),o=i.enableSkipLevelLists,s=e;for(let c=a;c>=0;c--){let a=s.getAttribute(`listIndent`)!==c;if(a){let a=Iz(e,c)||s,o=a.getAttribute(`listType`),l=_z(r,c,`list-item-skip-${c}`),u=gz(r,c,o);r.setStyle(`list-style-type`,`none`,l);for(let e of n)e.scope==`list`&&a.hasAttribute(e.attributeName)&&e.setAttributeOnDowncast(r,a.getAttribute(e.attributeName),u,i,a);t=r.wrap(t,l),t=r.wrap(t,u)}else{let e=_z(r,c,s.getAttribute(`listItemId`)),a=gz(r,c,s.getAttribute(`listType`));for(let t of n)(t.scope==`list`||t.scope==`item`)&&s.hasAttribute(t.attributeName)&&t.setAttributeOnDowncast(r,s.getAttribute(t.attributeName),t.scope==`list`?a:e,i,s);t=r.wrap(t,e),t=r.wrap(t,a)}if(c==0)break;if(!a){let e=TR.first(s,{lowerIndent:!0});if(e)s=e;else if(!o)break}}}function Iz(e,t){let n=e.nextSibling;for(;n&&G(n);){let e=n.getAttribute(`listIndent`);if(e<t)return null;if(e===t)return n;n=n.nextSibling}return null}function Lz(e,t){let n=t.filter(e=>e.consume===!1).map(e=>e.attributeName);return(t,r)=>{let i=[];for(let r of e)t.hasAttribute(r)&&!n.includes(r)&&i.push(`attribute:${r}`);return i.every(e=>r.test(t,e)!==!1)?(i.forEach(e=>r.consume(t,e)),!0):!1}}function Rz(e,t,n=kR(e)){if(!G(e))return!1;for(let n of e.getAttributeKeys())if(!(n.startsWith(`selection:`)||n==`htmlEmptyBlock`)&&!t.includes(n))return!1;return n.length<2}const zz=[`listType`,`listIndent`,`listItemId`];var Bz=class extends F{_downcastStrategies=[];static get pluginName(){return`ListEditing`}static get isOfficialPlugin(){return!0}static get requires(){return[TE,hT,fz,_O,oz]}constructor(e){super(e),e.config.define(`list.multiBlock`,!0)}init(){let e=this.editor,t=e.model,n=e.config.get(`list.multiBlock`);if(e.plugins.has(`LegacyListEditing`))throw new w(`list-feature-conflict`,this,{conflictPlugin:`LegacyListEditing`});t.schema.register(`$listItem`,{allowAttributes:zz}),n?(t.schema.extend(`$container`,{allowAttributesOf:`$listItem`}),t.schema.extend(`$block`,{allowAttributesOf:`$listItem`}),t.schema.extend(`$blockObject`,{allowAttributesOf:`$listItem`})):t.schema.register(`listItem`,{inheritAllFrom:`$block`,allowAttributesOf:`$listItem`});for(let e of zz)t.schema.setAttributeProperties(e,{copyOnReplace:!0});e.commands.add(`numberedList`,new QR(e,`numbered`)),e.commands.add(`bulletedList`,new QR(e,`bulleted`)),e.commands.add(`customNumberedList`,new QR(e,`customNumbered`,{multiLevel:!0})),e.commands.add(`customBulletedList`,new QR(e,`customBulleted`,{multiLevel:!0})),e.commands.add(`indentList`,new XR(e,`forward`)),e.commands.add(`outdentList`,new XR(e,`backward`)),e.commands.add(`splitListItemBefore`,new ez(e,`before`)),e.commands.add(`splitListItemAfter`,new ez(e,`after`)),n&&(e.commands.add(`mergeListItemBackward`,new $R(e,`backward`)),e.commands.add(`mergeListItemForward`,new $R(e,`forward`))),this._setupDeleteIntegration(),this._setupEnterIntegration(),this._setupTabIntegration(),this._setupClipboardIntegration(),this._setupAccessibilityIntegration(),this._setupListItemIdConversionStrategy()}afterInit(){let e=this.editor.commands,t=e.get(`indent`),n=e.get(`outdent`);t&&t.registerChildCommand(e.get(`indentList`),{priority:`high`}),n&&n.registerChildCommand(e.get(`outdentList`),{priority:`lowest`}),this._setupModelPostFixing(),this._setupConversion()}registerDowncastStrategy(e){this._downcastStrategies.push(e)}getListAttributeNames(){return[...zz,...this._downcastStrategies.map(e=>e.attributeName)]}_setupDeleteIntegration(){let e=this.editor,t=e.commands.get(`mergeListItemBackward`),n=e.commands.get(`mergeListItemForward`);this.listenTo(e.editing.view.document,`delete`,(r,i)=>{let a=e.model.document.selection;GR(e.model)||e.model.change(()=>{let o=a.getFirstPosition();if(a.isCollapsed&&i.direction==`backward`){if(!o.isAtStart)return;let n=o.parent;if(!G(n))return;let a=TR.first(n,{sameAttributes:`listType`,sameIndent:!0}),s=n.getAttribute(`listIndent`)===0||!G(n.previousSibling);if(!a&&s)PR(n)||e.execute(`splitListItemAfter`),e.execute(`outdentList`);else{if(!t||!t.isEnabled)return;t.execute({shouldMergeOnBlocksContentLevel:Uz(e.model,`backward`)})}i.preventDefault(),r.stop()}else{if(a.isCollapsed&&!a.getLastPosition().isAtEnd||!n||!n.isEnabled)return;n.execute({shouldMergeOnBlocksContentLevel:Uz(e.model,`forward`)}),i.preventDefault(),r.stop()}})},{context:`li`})}_setupEnterIntegration(){let e=this.editor,t=e.model,n=e.commands,r=n.get(`enter`);this.listenTo(e.editing.view.document,`enter`,(n,r)=>{let i=t.document,a=i.selection.getFirstPosition().parent;if(i.selection.isCollapsed&&G(a)&&a.isEmpty&&!r.isSoft){let t=NR(a),i=PR(a);t&&i?(e.execute(`outdentList`),r.preventDefault(),n.stop()):t&&!i?(e.execute(`splitListItemAfter`),r.preventDefault(),n.stop()):i&&(e.execute(`splitListItemBefore`),r.preventDefault(),n.stop())}},{context:`li`}),this.listenTo(r,`afterExecute`,()=>{let t=n.get(`splitListItemBefore`);if(t.refresh(),!t.isEnabled)return;let r=e.model.document.selection.getLastPosition().parent;kR(r).length===2&&t.execute()})}_setupTabIntegration(){let e=this.editor;this.listenTo(e.editing.view.document,`tab`,(t,n)=>{let r=n.shiftKey?`outdentList`:`indentList`;this.editor.commands.get(r).isEnabled&&(e.execute(r),n.stopPropagation(),n.preventDefault(),t.stop())},{context:`li`})}_setupConversion(){let e=this.editor,t=e.model,n=this.getListAttributeNames(),r=e.config.get(`list.multiBlock`),i=r?`paragraph`:`listItem`,a=!!e.config.get(`list.enableSkipLevelLists`);e.conversion.for(`upcast`).elementToElement({view:`li`,model:(e,{writer:t})=>t.createElement(i,{listType:``})}).elementToElement({view:`p`,model:(e,{writer:t})=>e.parent&&e.parent.is(`element`,`li`)?t.createElement(i,{listType:``}):null,converterPriority:`high`}).add(e=>{e.on(`element:p`,(e,t,n)=>{let r=t.viewItem;if(!r.parent||!r.parent.is(`element`,`li`)||r.isEmpty||!r.getAttributeKeys().next().done)return;for(let e of r.parent.getChildren())if(e!==r&&!(e.is(`element`,`ol`)||e.is(`element`,`ul`)))return;n.consumable.consume(r,{name:!0});let{modelRange:i,modelCursor:a}=n.convertChildren(r,t.modelCursor);t.modelRange=i,t.modelCursor=a},{priority:`highest`}),a&&e.on(`element:li`,Cz(),{priority:`high`}),e.on(`element:li`,Tz())}),r||e.conversion.for(`downcast`).elementToElement({model:`listItem`,view:`p`}),e.conversion.for(`editingDowncast`).elementToElement({model:i,view:kz(n),converterPriority:`high`}).add(e=>{e.on(`attribute`,Dz(n,this._downcastStrategies,t,{enableSkipLevelLists:a})),e.on(`remove`,Oz(t.schema))}),e.conversion.for(`dataDowncast`).elementToElement({model:i,view:kz(n,{dataPipeline:!0}),converterPriority:`high`}).add(e=>{e.on(`attribute`,Dz(n,this._downcastStrategies,t,{dataPipeline:!0,enableSkipLevelLists:a}))});let o=jz(this._downcastStrategies,e.editing.view);e.editing.mapper.on(`modelToViewPosition`,o),e.data.mapper.on(`modelToViewPosition`,o),this.listenTo(t.document,`change:data`,Ez(t,e.editing,n,this),{priority:`high`}),this.on(`checkAttributes:item`,(e,{viewElement:t,modelAttributes:n})=>{t.id!=n.listItemId&&(e.return=!0,e.stop())}),this.on(`checkAttributes:list`,(e,{viewElement:t,modelAttributes:n})=>{(t.name!=vz(n.listType)||t.id!=yz(n.listType,n.listIndent))&&(e.return=!0,e.stop())})}_setupModelPostFixing(){let e=this.editor.model,t=this.getListAttributeNames();e.document.registerPostFixer(n=>Vz(e,n,t,this)),this.editor.config.get(`list.enableSkipLevelLists`)||this.on(`postFixer`,(e,{listNodes:t,writer:n})=>{e.return=xz(t,n)||e.return},{priority:`high`}),this.on(`postFixer`,(e,{listNodes:t,writer:n,seenIds:r})=>{e.return=Sz(t,r,n)||e.return},{priority:`high`})}_setupClipboardIntegration(){let e=this.editor.model,t=this.editor.plugins.get(`ClipboardPipeline`);this.listenTo(e,`insertContent`,Hz(e),{priority:`high`}),this.listenTo(t,`outputTransformation`,(t,n)=>{e.change(e=>{let t=Array.from(n.content.getChildren()),r=t[t.length-1];if(t.length>1&&r.is(`element`)&&r.isEmpty&&t.slice(0,-1).every(G)&&e.remove(r),n.method==`copy`||n.method==`cut`){let t=Array.from(n.content.getChildren());HR(t)&&VR(t,e,this.getListAttributeNames())}})})}_setupAccessibilityIntegration(){let 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,n,r){r&&(r.skipListItemIds||r.isClipboardPipeline)||e.setAttribute(`data-list-item-id`,t,n)}})}};function Vz(e,t,n,r){let i=e.document.differ.getChanges(),a=new Set,o=new Set,s=r.editor.config.get(`list.multiBlock`),c=!1;for(let r of i){if(r.type==`insert`&&r.name!=`$text`){let i=r.position.nodeAfter;if(!e.schema.checkAttribute(i,`listItemId`))for(let e of Array.from(i.getAttributeKeys()))n.includes(e)&&(t.removeAttribute(e,i),c=!0);bz(r.position,o,a),r.attributes.has(`listItemId`)||bz(r.position.getShiftedBy(r.length),o,a);for(let{item:t,previousPosition:n}of e.createRangeIn(i))G(t)&&bz(n,o,a)}else r.type==`remove`?bz(r.position,o,a):r.type==`attribute`&&n.includes(r.attributeKey)&&(bz(r.range.start,o,a),r.attributeNewValue===null&&bz(r.range.start.getShiftedBy(1),o,a));if(!s&&r.type==`attribute`&&zz.includes(r.attributeKey)){let e=r.range.start.nodeAfter;r.attributeNewValue===null&&e&&e.is(`element`,`listItem`)?(t.rename(e,`paragraph`),c=!0):r.attributeOldValue===null&&e&&e.is(`element`)&&e.name!=`listItem`&&(t.rename(e,`listItem`),c=!0)}}let l=new Set;for(let e of o.values())c=r.fire(`postFixer`,{listNodes:new DR(e),listHead:e,writer:t,seenIds:l})||c;return c}function Hz(e){return(t,[n,r])=>{let i=(n.is(`documentFragment`)?Array.from(n.getChildren()):[n]).filter(t=>!e.schema.isInline(t));if(!i.length)return;let a=(r?e.createSelection(r):e.document.selection).getFirstPosition(),o;if(G(a.parent))o=a.parent;else if(G(a.nodeBefore)&&G(a.nodeAfter))o=a.nodeBefore;else return;e.change(e=>{let t=o.getAttribute(`listType`),n=o.getAttribute(`listIndent`),r=i[0].getAttribute(`listIndent`)||0,a=Math.max(n-r,0);for(let n of i){let r=G(n);o.is(`element`,`listItem`)&&n.is(`element`,`paragraph`)&&e.rename(n,`listItem`),e.setAttributes({listIndent:(r?n.getAttribute(`listIndent`):0)+a,listItemId:r?n.getAttribute(`listItemId`):OR.next(),listType:t},n)}})}}function Uz(e,t){let n=e.document.selection;if(!n.isCollapsed)return!GR(e);if(t===`forward`)return!0;let r=n.getFirstPosition().parent,i=r.previousSibling;return e.schema.isObject(i)?!1:i.isEmpty?!0:HR([r,i])}function Wz(e,t,n,r){e.ui.componentFactory.add(t,()=>{let i=Gz(H,e,t,n,r);return i.set({tooltip:!0,isToggleable:!0}),i}),e.ui.componentFactory.add(`menuBar:${t}`,()=>{let i=Gz(U,e,t,n,r);return i.set({role:`menuitemcheckbox`,isToggleable:!0}),i})}function Gz(e,t,n,r,i){let a=t.commands.get(n),o=new e(t.locale);return o.set({label:r,icon:i}),o.bind(`isOn`,`isEnabled`).to(a,`value`,`isEnabled`),o.on(`execute`,()=>{t.execute(n),t.editing.view.focus()}),o}var Kz=class extends F{static get pluginName(){return`ListUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor.t;this.editor.ui.componentFactory.has(`numberedList`)||Wz(this.editor,`numberedList`,e(`Numbered List`),vv),this.editor.ui.componentFactory.has(`bulletedList`)||Wz(this.editor,`bulletedList`,e(`Bulleted List`),o_)}},qz=class extends F{static get requires(){return[Bz,Kz]}static get pluginName(){return`List`}static get isOfficialPlugin(){return!0}},Jz=class extends I{refresh(){let e=this._getValue();this.value=e,this.isEnabled=e!=null}execute({startIndex:e=1}={}){let t=this.editor.model,n=t.document,r=Array.from(n.selection.getSelectedBlocks()).filter(e=>G(e)&&qR(e.getAttribute(`listType`)));r=IR(r),t.change(t=>{for(let n of r)t.setAttribute(`listStart`,e>=0?e:1,n)})}_getValue(){let e=this.editor.model.document,t=j(e.selection.getSelectedBlocks());return t&&G(t)&&qR(t.getAttribute(`listType`))?t.getAttribute(`listStart`):null}};const Yz={},Xz={},Zz={},Qz=[{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(let{listStyle:e,typeAttribute:t,listType:n}of Qz)Yz[e]=n,Xz[e]=t,t&&(Zz[t]=e);function $z(){return Qz.map(e=>e.listStyle)}function eB(e){return Yz[e]||null}function tB(e){return Zz[e]||null}function nB(e){return Xz[e]||null}function rB(e){switch(e){case`lower-alpha`:return`lower-latin`;case`upper-alpha`:return`upper-latin`;default:return e}}var iB=class extends I{defaultType;_supportedTypes;constructor(e,t,n){super(e),this.defaultType=t,this._supportedTypes=n}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){let t=this.editor.model,n=t.document;t.change(t=>{this._tryToConvertItemsToList(e);let r=Array.from(n.selection.getSelectedBlocks()).filter(e=>e.hasAttribute(`listType`));if(r.length){r=IR(r);for(let n of r)t.setAttribute(`listStyle`,e.type||this.defaultType,n)}})}isStyleTypeSupported(e){return this._supportedTypes?this._supportedTypes.includes(e):!0}_getValue(){let e=j(this.editor.model.document.selection.getSelectedBlocks());return G(e)?e.getAttribute(`listStyle`):null}_checkEnabled(){let e=this.editor,t=e.commands.get(`numberedList`),n=e.commands.get(`bulletedList`);return t.isEnabled||n.isEnabled}_tryToConvertItemsToList(e){if(!e.type)return;let t=eB(e.type);if(!t)return;let n=this.editor,r=`${t}List`;n.commands.get(r).value||n.execute(r)}},aB=class extends I{refresh(){let e=this._getValue();this.value=e,this.isEnabled=e!=null}execute(e={}){let t=this.editor.model,n=t.document,r=Array.from(n.selection.getSelectedBlocks()).filter(e=>G(e)&&e.getAttribute(`listType`)==`numbered`);r=IR(r),t.change(t=>{for(let n of r)t.setAttribute(`listReversed`,!!e.reversed,n)})}_getValue(){let e=this.editor.model.document,t=j(e.selection.getSelectedBlocks());return G(t)&&t.getAttribute(`listType`)==`numbered`?t.getAttribute(`listReversed`):null}};function oB(e){return(t,n,r)=>{let{writer:i,schema:a,consumable:o}=r;if(o.test(n.viewItem,e.viewConsumables)===!1)return;n.modelRange||Object.assign(n,r.convertChildren(n.viewItem,n.modelCursor));let s=!1;for(let t of n.modelRange.getItems({shallow:!0}))a.checkAttribute(t,e.attributeName)&&e.appliesToListItem(t)&&(t.hasAttribute(e.attributeName)||(i.setAttribute(e.attributeName,e.getAttributeOnUpcast(n.viewItem),t),s=!0));s&&o.consume(n.viewItem,e.viewConsumables)}}var sB=class extends F{static get pluginName(){return`ListPropertiesUtils`}static get isOfficialPlugin(){return!0}getAllSupportedStyleTypes(){return $z()}getListTypeFromListStyleType(e){return eB(e)}getListStyleTypeFromTypeAttribute(e){return tB(e)}getTypeAttributeFromListStyleType(e){return nB(e)}};function cB(e){let{startIndex:t,reversed:n,styles:r}=e;return{styles:lB(r),startIndex:t||!1,reversed:n||!1}}function lB(e){let t={listTypes:[`bulleted`,`numbered`],useAttribute:!1,listStyleTypes:{numbered:[`decimal`,`decimal-leading-zero`,`lower-roman`,`upper-roman`,`lower-latin`,`upper-latin`],bulleted:[`disc`,`circle`,`square`]}};return e===!0||(e?Array.isArray(e)||typeof e==`string`?(t.listTypes=A(e),t.listStyleTypes=kn(t.listStyleTypes,t.listTypes)):(t.listTypes=e.listTypes?A(e.listTypes):t.listTypes,t.useAttribute=!!e.useAttribute,e.listStyleTypes?t.listStyleTypes=e.listStyleTypes:t.listStyleTypes=kn(t.listStyleTypes,t.listTypes)):(t.listTypes=[],t.listStyleTypes={})),t}const uB=`default`;var dB=class extends F{static get requires(){return[Bz,sB]}static get pluginName(){return`ListPropertiesEditing`}static get licenseFeatureCode(){return`LP`}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}constructor(e){super(e),e.config.define(`list.properties`,{styles:!0,startIndex:!1,reversed:!1})}init(){let e=this.editor,t=e.model,n=e.plugins.get(Bz),r=fB(e.config.get(`list.properties`));for(let i of r)i.addCommand(e),t.schema.extend(`$listItem`,{allowAttributes:i.attributeName}),n.registerDowncastStrategy({scope:`list`,attributeName:i.attributeName,setAttributeOnDowncast(e,t,n){i.setAttributeOnDowncast(e,t,n)}});e.conversion.for(`upcast`).add(e=>{for(let t of r)e.on(`element:ol`,oB(t)),e.on(`element:ul`,oB(t))}),n.on(`checkAttributes:list`,(e,{viewElement:t,modelAttributes:n,modelReferenceElement:i})=>{for(let a of r)a.appliesToListItem(i)&&a.getAttributeOnUpcast(t)!=n[a.attributeName]&&(e.return=!0,e.stop())}),this.listenTo(e.commands.get(`indentList`),`afterExecute`,(e,n)=>{t.change(e=>{for(let t of n)for(let n of r)n.appliesToListItem(t)&&e.setAttribute(n.attributeName,n.defaultValue,t)})}),n.on(`postFixer`,(e,{listNodes:t,writer:n})=>{for(let{node:i}of t)for(let t of r)t.hasValidAttribute(i)||(t.appliesToListItem(i)?n.setAttribute(t.attributeName,t.defaultValue,i):n.removeAttribute(t.attributeName,i),e.return=!0)}),n.on(`postFixer`,(e,{listNodes:t,writer:n})=>{for(let{node:i,previousNodeInList:a}of t)if(a&&a.getAttribute(`listType`)==i.getAttribute(`listType`))for(let t of r){let{attributeName:r}=t;if(!t.appliesToListItem(i))continue;let o=a.getAttribute(r);i.getAttribute(r)!=o&&(n.setAttribute(r,o,i),e.return=!0)}})}};function fB(e){let t=[],n=cB(e);if(e.styles){let e=n.styles.useAttribute;t.push({attributeName:`listStyle`,defaultValue:uB,viewConsumables:{styles:`list-style-type`},addCommand(t){let n=$z();e&&(n=n.filter(e=>!!nB(e))),t.commands.add(`listStyle`,new iB(t,uB,n))},appliesToListItem(e){return e.getAttribute(`listType`)==`numbered`||e.getAttribute(`listType`)==`bulleted`},hasValidAttribute(e){if(!this.appliesToListItem(e))return!e.hasAttribute(`listStyle`);if(!e.hasAttribute(`listStyle`))return!1;let t=e.getAttribute(`listStyle`);return t==uB?!0:eB(t)==e.getAttribute(`listType`)},setAttributeOnDowncast(t,n,r){if(n&&n!==uB)if(e){let e=nB(n);if(e){t.setAttribute(`type`,e,r);return}}else{t.setStyle(`list-style-type`,n,r);return}t.removeStyle(`list-style-type`,r),t.removeAttribute(`type`,r)},getAttributeOnUpcast(e){let t=e.getStyle(`list-style-type`);if(t)return rB(t);let n=e.getAttribute(`type`);return n?tB(n):uB}})}return e.reversed&&t.push({attributeName:`listReversed`,defaultValue:!1,viewConsumables:{attributes:`reversed`},addCommand(e){e.commands.add(`listReversed`,new aB(e))},appliesToListItem(e){return e.getAttribute(`listType`)==`numbered`},hasValidAttribute(e){return this.appliesToListItem(e)==e.hasAttribute(`listReversed`)},setAttributeOnDowncast(e,t,n){t?e.setAttribute(`reversed`,`reversed`,n):e.removeAttribute(`reversed`,n)},getAttributeOnUpcast(e){return e.hasAttribute(`reversed`)}}),e.startIndex&&t.push({attributeName:`listStart`,defaultValue:1,viewConsumables:{attributes:`start`},addCommand(e){e.commands.add(`listStart`,new Jz(e))},appliesToListItem(e){return qR(e.getAttribute(`listType`))},hasValidAttribute(e){return this.appliesToListItem(e)==e.hasAttribute(`listStart`)},setAttributeOnDowncast(e,t,n){t==0||t>1?e.setAttribute(`start`,t,n):e.removeAttribute(`start`,n)},getAttributeOnUpcast(e){let t=e.getAttribute(`start`);return t>=0?t:1}}),t}var pB=class extends P{children;stylesView=null;additionalPropertiesCollapsibleView=null;startIndexFieldView=null;reversedSwitchButtonView=null;focusTracker=new M;keystrokes=new N;focusables=new pa;focusCycler;constructor(e,{enabledProperties:t,styleButtonViews:n,styleGridAriaLabel:r}){super(e);let i=[`ck`,`ck-list-properties`];this.children=this.createCollection(),this.focusCycler=new Hy({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:`shift + tab`,focusNext:`tab`}}),n&&n.length?(this.stylesView=this._createStylesView(n,r),this.children.add(this.stylesView)):i.push(`ck-list-properties_without-styles`),(t.startIndex||t.reversed)&&(this._addNumberedListPropertyViews(t),i.push(`ck-list-properties_with-numbered-properties`)),this.setTemplate({tag:`div`,attributes:{class:i},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(let e of this.stylesView.children)this.stylesView.focusTracker.add(e.element);$a({keystrokeHandler:this.stylesView.keystrokes,focusTracker:this.stylesView.focusTracker,gridItems:this.stylesView.children,numberOfColumns:()=>u.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);let 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){let n=new P(this.locale);return n.children=n.createCollection(),n.children.addMany(e),n.setTemplate({tag:`div`,attributes:{"aria-label":t,class:[`ck`,`ck-list-styles-list`]},children:n.children}),n.children.delegate(`execute`).to(this),n.focus=function(){for(let e of this.children)if(e instanceof H&&e.isOn){e.focus();return}this.children.first.focus()},n.focusTracker=new M,n.keystrokes=new N,n.render(),n.keystrokes.listenTo(n.element),n}_addNumberedListPropertyViews(e){let t=this.locale.t,n=[];e.startIndex&&(this.startIndexFieldView=this._createStartIndexField(),n.push(this.startIndexFieldView)),e.reversed&&(this.reversedSwitchButtonView=this._createReversedSwitchButton(),n.push(this.reversedSwitchButtonView)),this.stylesView?(this.additionalPropertiesCollapsibleView=new xb(this.locale,n),this.additionalPropertiesCollapsibleView.set({label:t(`List properties`),isCollapsed:!0}),this.additionalPropertiesCollapsibleView.buttonView.bind(`isEnabled`).toMany(n,`isEnabled`,(...e)=>e.some(e=>e)),this.additionalPropertiesCollapsibleView.buttonView.on(`change:isEnabled`,(e,t,n)=>{n||(this.additionalPropertiesCollapsibleView.isCollapsed=!0)}),this.children.add(this.additionalPropertiesCollapsibleView)):this.children.addMany(n)}_createStartIndexField(){let e=this.locale.t,t=new Qb(this.locale,Yx);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`,()=>{let n=t.fieldView.element,r=n.valueAsNumber;if(Number.isNaN(r)){t.errorText=e(`Invalid start index value.`);return}n.checkValidity()?this.fire(`listStart`,{startIndex:r}):t.errorText=e(`Start index must be greater than 0.`)}),t}_createReversedSwitchButton(){let e=this.locale.t,t=new mb(this.locale);return t.set({withText:!0,label:e(`Reversed order`),class:`ck-numbered-list-properties__reversed-order`}),t.delegate(`execute`).to(this,`listReversed`),t}},mB=class extends F{static get pluginName(){return`ListPropertiesUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.locale.t,n=e.config.get(`list.properties`),r=cB(n),i=r.styles.listTypes;if(i.includes(`bulleted`)){let n=[{label:t(`Toggle the disc list style`),tooltip:t(`Disc`),type:`disc`,icon:tv},{label:t(`Toggle the circle list style`),tooltip:t(`Circle`),type:`circle`,icon:Q_},{label:t(`Toggle the square list style`),tooltip:t(`Square`),type:`square`,icon:iv}],i=t(`Bulleted List`),a=t(`Bulleted list styles toolbar`),o=`bulletedList`;e.ui.componentFactory.add(o,hB({editor:e,normalizedConfig:r,parentCommandName:o,buttonLabel:i,buttonIcon:o_,styleGridAriaLabel:a,styleDefinitions:n})),e.ui.componentFactory.add(`menuBar:${o}`,vB({editor:e,normalizedConfig:r,parentCommandName:o,buttonLabel:i,styleGridAriaLabel:a,styleDefinitions:n}))}if(i.includes(`numbered`)||n.startIndex||n.reversed){let n=[{label:t(`Toggle the decimal list style`),tooltip:t(`Decimal`),type:`decimal`,icon:ev},{label:t(`Toggle the decimal with leading zero list style`),tooltip:t(`Decimal with leading zero`),type:`decimal-leading-zero`,icon:$_},{label:t(`Toggle the lowerroman list style`),tooltip:t(`Lowerroman`),type:`lower-roman`,icon:rv},{label:t(`Toggle the upperroman list style`),tooltip:t(`Upper-roman`),type:`upper-roman`,icon:ov},{label:t(`Toggle the lowerlatin list style`),tooltip:t(`Lower-latin`),type:`lower-latin`,icon:nv},{label:t(`Toggle the upperlatin list style`),tooltip:t(`Upper-latin`),type:`upper-latin`,icon:av},{label:t(`Toggle the arabic-indic list style`),tooltip:t(`Arabic-indic`),type:`arabic-indic`,icon:sv}],a=t(`Numbered List`),o=t(`Numbered list styles toolbar`),s=`numberedList`;e.ui.componentFactory.add(s,hB({editor:e,normalizedConfig:r,parentCommandName:s,buttonLabel:a,buttonIcon:vv,styleGridAriaLabel:o,styleDefinitions:n})),i.includes(`numbered`)&&e.ui.componentFactory.add(`menuBar:${s}`,vB({editor:e,normalizedConfig:r,parentCommandName:s,buttonLabel:a,styleGridAriaLabel:o,styleDefinitions:n}))}}};function hB({editor:e,normalizedConfig:t,parentCommandName:n,buttonLabel:r,buttonIcon:i,styleGridAriaLabel:a,styleDefinitions:o}){let s=e.commands.get(n);return c=>{let l=Nx(c,Mx),u=l.buttonView;return l.bind(`isEnabled`).to(s),l.class=`ck-list-styles-dropdown`,u.on(`execute`,()=>{e.execute(n),e.editing.view.focus()}),u.set({label:r,icon:i,tooltip:!0,isToggleable:!0}),u.bind(`isOn`).to(s,`value`,e=>!!e),l.once(`change:isOpen`,()=>{let r=_B({editor:e,normalizedConfig:t,dropdownView:l,parentCommandName:n,styleGridAriaLabel:a,styleDefinitions:o});l.panelView.children.add(r)}),l.on(`execute`,()=>{e.editing.view.focus()}),l}}function gB({editor:e,listStyleCommand:t,parentCommandName:n}){let r=e.locale,i=e.commands.get(n);return({label:a,type:o,icon:s,tooltip:c})=>{let l=new H(r);return l.set({label:a,icon:s,tooltip:c}),l.bind(`isOn`).to(t,`value`,e=>e===o),l.on(`execute`,()=>{i.value?t.value===o?e.execute(n):t.value!==o&&e.execute(`listStyle`,{type:o}):e.model.change(()=>{e.execute(`listStyle`,{type:o})})}),l}}function _B({editor:e,normalizedConfig:t,dropdownView:n,parentCommandName:r,styleDefinitions:i,styleGridAriaLabel:a}){let o=e.locale,s={...t,...r==`numberedList`?null:{startIndex:!1,reversed:!1}},c=r.replace(`List`,``),l=null;if(t.styles.listTypes.includes(c)){let n=e.commands.get(`listStyle`),a=gB({editor:e,parentCommandName:r,listStyleCommand:n}),o=t.styles.listStyleTypes,s=i;if(o){let e=o[c];e&&(s=i.filter(t=>e.includes(t.type)))}let u=yB(n);l=s.filter(u).map(a)}let u=new pB(o,{styleGridAriaLabel:a,enabledProperties:s,styleButtonViews:l});if(t.styles.listTypes.includes(c)&&zx(n,()=>u.stylesView.children.find(e=>e.isOn)),s.startIndex){let t=e.commands.get(`listStart`);u.startIndexFieldView.bind(`isEnabled`).to(t),u.startIndexFieldView.fieldView.bind(`value`).to(t),u.on(`listStart`,(t,n)=>e.execute(`listStart`,n))}if(s.reversed){let t=e.commands.get(`listReversed`);u.reversedSwitchButtonView.bind(`isEnabled`).to(t),u.reversedSwitchButtonView.bind(`isOn`).to(t,`value`,e=>!!e),u.on(`listReversed`,()=>{let n=t.value;e.execute(`listReversed`,{reversed:!n})})}return u.delegate(`execute`).to(n),u}function vB({editor:e,normalizedConfig:t,parentCommandName:n,buttonLabel:r,styleGridAriaLabel:i,styleDefinitions:a}){return o=>{let s=new uw(o),c=e.commands.get(n),l=e.commands.get(`listStyle`),u=yB(l),d=gB({editor:e,parentCommandName:n,listStyleCommand:l}),f=t.styles.listStyleTypes,p=a;if(f){let e=f[c.type];e&&(p=a.filter(t=>e.includes(t.type)))}let m=p.filter(u).map(d),h=new pB(o,{styleGridAriaLabel:i,enabledProperties:{...t,startIndex:!1,reversed:!1},styleButtonViews:m});return h.delegate(`execute`).to(s),s.buttonView.set({label:r,icon:n===`bulletedList`?o_:vv}),s.panelView.children.add(h),s.bind(`isEnabled`).to(c,`isEnabled`),s.on(`execute`,()=>{e.editing.view.focus()}),s}}function yB(e){return typeof e.isStyleTypeSupported==`function`?t=>e.isStyleTypeSupported(t.type):()=>!0}var bB=class extends F{static get requires(){return[dB,mB]}static get pluginName(){return`ListProperties`}static get isOfficialPlugin(){return!0}},xB=class extends I{constructor(e){super(e),this.on(`execute`,()=>{this.refresh()},{priority:`highest`})}refresh(){let e=this._getSelectedItems();this.value=this._getValue(e),this.isEnabled=!!e.length}execute(e={}){this.editor.model.change(t=>{let n=this._getSelectedItems(),r=e.forceValue===void 0?!this._getValue(n):e.forceValue;for(let e of n)r?t.setAttribute(`todoListChecked`,!0,e):t.removeAttribute(`todoListChecked`,e)})}_getValue(e){return e.every(e=>e.getAttribute(`todoListChecked`))}_getSelectedItems(){let e=this.editor.model,t=e.schema,n=e.document.selection.getFirstRange(),r=n.start.parent,i=[];t.checkAttribute(r,`todoListChecked`)&&i.push(...kR(r));for(let e of n.getItems({shallow:!0}))t.checkAttribute(e,`todoListChecked`)&&!i.includes(e)&&i.push(...kR(e));return i}},SB=class extends jc{domEventType=[`change`];onDomEvent(e){if(e.target){let t=this.view.domConverter.mapDomToView(e.target);t&&t.is(`element`,`input`)&&t.getAttribute(`type`)==`checkbox`&&t.findAncestor({classes:`todo-list__label`})&&this.fire(`todoCheckboxChange`,e)}}};const CB=yi(`Ctrl+Enter`);var wB=class extends F{static get pluginName(){return`TodoListEditing`}static get isOfficialPlugin(){return!0}static get requires(){return[Bz]}init(){let e=this.editor,t=e.model,n=e.editing,r=e.plugins.get(Bz),i=e.config.get(`list.multiBlock`)?`paragraph`:`listItem`;e.commands.add(`todoList`,new QR(e,`todo`)),e.commands.add(`checkTodoList`,new xB(e)),n.view.addObserver(SB),t.schema.extend(`$listItem`,{allowAttributes:`todoListChecked`}),t.schema.addAttributeCheck(e=>{let t=e.last;if(!t.getAttribute(`listItemId`)||t.getAttribute(`listType`)!=`todo`)return!1},`todoListChecked`),e.conversion.for(`upcast`).add(e=>{e.on(`element:input`,EB()),e.on(`element:li`,TB(),{priority:`low`}),e.on(`element:label`,DB({name:`label`,classes:`todo-list__label`})),e.on(`element:label`,DB({name:`label`,classes:[`todo-list__label`,`todo-list__label_without-description`]})),e.on(`element:span`,DB({name:`span`,classes:`todo-list__label__description`})),e.on(`element:ul`,OB({name:`ul`,classes:`todo-list`}))}),e.conversion.for(`downcast`).elementToElement({model:i,view:(e,{writer:t})=>{if(kB(e,r.getListAttributeNames()))return t.createContainerElement(`span`,{class:`todo-list__label__description`})},converterPriority:`highest`}),r.registerDowncastStrategy({scope:`list`,attributeName:`listType`,setAttributeOnDowncast(e,t,n){t==`todo`?e.addClass(`todo-list`,n):e.removeClass(`todo-list`,n)}}),r.registerDowncastStrategy({scope:`itemMarker`,attributeName:`todoListChecked`,createElement(e,t,{dataPipeline:n}){if(t.getAttribute(`listType`)!=`todo`)return null;let r=e.createUIElement(`input`,{type:`checkbox`,...t.getAttribute(`todoListChecked`)?{checked:`checked`}:null,...n?{disabled:`disabled`}:{tabindex:`-1`}});if(n)return r;let i=e.createContainerElement(`span`,{contenteditable:`false`},r);return i.getFillerOffset=()=>null,i},canWrapElement(e){return kB(e,r.getListAttributeNames())},createWrapperElement(e,t,{dataPipeline:n}){let i=[`todo-list__label`];return kB(t,r.getListAttributeNames())||i.push(`todo-list__label_without-description`),e.createAttributeElement(n?`label`:`span`,{class:i.join(` `)})}}),r.on(`checkElement`,(e,{modelElement:t,viewElement:n})=>{let i=kB(t,r.getListAttributeNames());n.hasClass(`todo-list__label__description`)!=i&&(e.return=!0,e.stop())}),r.on(`checkElement`,(t,{modelElement:n,viewElement:r})=>{let i=n.getAttribute(`listType`)==`todo`&&NR(n),a=!1,o=e.editing.view.createPositionBefore(r).getWalker({direction:`backward`});for(let{item:t}of o){if(t.is(`element`)&&e.editing.mapper.toModelElement(t))break;t.is(`element`,`input`)&&t.getAttribute(`type`)==`checkbox`&&(a=!0)}a!=i&&(t.return=!0,t.stop())}),r.on(`postFixer`,(e,{listNodes:t,writer:n})=>{for(let{node:r,previousNodeInList:i}of t){if(!i||i.getAttribute(`listItemId`)!=r.getAttribute(`listItemId`))continue;let t=i.hasAttribute(`todoListChecked`),a=r.hasAttribute(`todoListChecked`);a&&!t?(n.removeAttribute(`todoListChecked`,r),e.return=!0):!a&&t&&(n.setAttribute(`todoListChecked`,!0,r),e.return=!0)}}),t.document.registerPostFixer(e=>{let n=t.document.differ.getChanges(),r=!1;for(let t of n)if(t.type==`attribute`&&t.attributeKey==`listType`){let n=t.range.start.nodeAfter;t.attributeOldValue==`todo`&&n.hasAttribute(`todoListChecked`)&&(e.removeAttribute(`todoListChecked`,n),r=!0)}else if(t.type==`insert`&&t.name!=`$text`)for(let{item:n}of e.createRangeOn(t.position.nodeAfter))n.is(`element`)&&n.getAttribute(`listType`)!=`todo`&&n.hasAttribute(`todoListChecked`)&&(e.removeAttribute(`todoListChecked`,n),r=!0);return r}),this.listenTo(n.view.document,`keydown`,(t,n)=>{vi(n)===CB&&(e.execute(`checkTodoList`),t.stop())},{priority:`high`}),this.listenTo(n.view.document,`todoCheckboxChange`,(e,t)=>{let r=t.target;if(!r||!r.is(`element`,`input`))return;let i=n.view.createPositionAfter(r),a=n.mapper.toModelPosition(i).parent;a&&G(a)&&a.getAttribute(`listType`)==`todo`&&this._handleCheckmarkChange(a)}),this.listenTo(n.view.document,`arrowKey`,jB(t,e.locale),{context:`$text`}),this.listenTo(n.mapper,`viewToModelPosition`,(e,n)=>{let r=n.viewPosition.parent,i=r.is(`attributeElement`,`li`)&&n.viewPosition.offset==0,a=MB(r)&&n.viewPosition.offset<=1,o=r.is(`element`,`span`)&&r.getAttribute(`contenteditable`)==`false`&&MB(r.parent);if(!i&&!a&&!o)return;let s=n.modelPosition.nodeAfter;s&&s.getAttribute(`listType`)==`todo`&&(n.modelPosition=t.createPositionAt(s,0))},{priority:`low`}),this._initAriaAnnouncements()}_handleCheckmarkChange(e){let t=this.editor,n=t.model,r=Array.from(n.document.selection.getRanges());n.change(n=>{n.setSelection(e,`end`),t.execute(`checkTodoList`),n.setSelection(r)})}_initAriaAnnouncements(){let{model:e,ui:t,t:n}=this.editor,r=null;t&&e.document.selection.on(`change:range`,()=>{let i=e.document.selection.focus.parent,a=NB(r),o=NB(i);a&&!o?t.ariaLiveAnnouncer.announce(n(`Leaving a to-do list`)):!a&&o&&t.ariaLiveAnnouncer.announce(n(`Entering a to-do list`)),r=i})}};function TB(){return(e,t,n)=>{let{writer:r,schema:i}=n;if(!t.modelRange)return;let a=Array.from(t.modelRange.getItems({shallow:!0})).filter(e=>e.getAttribute(`listType`)===`todo`&&i.checkAttribute(e,`listItemId`)).reduce((e,t)=>{let n=t.getAttribute(`listItemId`);return e.has(n)||e.set(n,kR(t)),e},new Map);for(let[,e]of a.entries())if(e.some(e=>e.getAttribute(`todoListChecked`)))for(let t of e)r.setAttribute(`todoListChecked`,!0,t)}}function EB(){return(e,t,n)=>{let r=t.modelCursor,i=r.parent,a=t.viewItem;if(!n.consumable.test(a,{name:!0})||a.getAttribute(`type`)!=`checkbox`||!r.isAtStart||!i.hasAttribute(`listType`))return;n.consumable.consume(a,{name:!0});let o=n.writer;o.setAttribute(`listType`,`todo`,i),t.viewItem.hasAttribute(`checked`)&&o.setAttribute(`todoListChecked`,!0,i),t.modelRange=o.createRange(r)}}function DB(e){let t=new Po(e);return(e,n,r)=>{let i=t.match(n.viewItem);i&&r.consumable.consume(n.viewItem,i.match)&&Object.assign(n,r.convertChildren(n.viewItem,n.modelCursor))}}function OB(e){let t=new Po(e);return(e,n,r)=>{let i=t.match(n.viewItem);if(!i)return;let a=i.match;a.name=!1,r.consumable.consume(n.viewItem,a)}}function kB(e,t){return(e.is(`element`,`paragraph`)||e.is(`element`,`listItem`))&&e.getAttribute(`listType`)==`todo`&&NR(e)&&AB(e,t)}function AB(e,t){for(let n of e.getAttributeKeys())if(!n.startsWith(`selection:`)&&!t.includes(n))return!1;return!0}function jB(e,t){return(n,r)=>{let i=Si(r.keyCode,t.contentLanguageDirection),a=e.schema,o=e.document.selection;if(!o.isCollapsed)return;let s=o.getFirstPosition(),c=s.parent;if(i==`right`&&s.isAtEnd){let t=a.getNearestSelectionRange(e.createPositionAfter(c),`forward`);if(!t)return;let i=t.start.parent;i&&G(i)&&i.getAttribute(`listType`)==`todo`&&(e.change(e=>e.setSelection(t)),r.preventDefault(),r.stopPropagation(),n.stop())}else if(i==`left`&&s.isAtStart&&G(c)&&c.getAttribute(`listType`)==`todo`){let t=a.getNearestSelectionRange(e.createPositionBefore(c),`backward`);if(!t)return;e.change(e=>e.setSelection(t)),r.preventDefault(),r.stopPropagation(),n.stop()}}}function MB(e){return!!e&&e.is(`attributeElement`)&&e.hasClass(`todo-list__label`)}function NB(e){return!e||!e.is(`element`,`paragraph`)&&!e.is(`element`,`listItem`)?!1:e.getAttribute(`listType`)==`todo`}var PB=class extends F{static get pluginName(){return`TodoListUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor.t;Wz(this.editor,`todoList`,e(`To-do List`),Ey)}},FB=class extends F{static get requires(){return[wB,PB]}static get pluginName(){return`TodoList`}static get isOfficialPlugin(){return!0}},IB=class extends I{type;constructor(e,t){super(e),this.type=t}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){let t=this.editor.model,n=t.document,r=Array.from(n.selection.getSelectedBlocks()).filter(e=>RB(e,t.schema)),i=e.forceValue===void 0?this.value:!e.forceValue;t.change(e=>{if(i){let t=r[r.length-1].nextSibling,n=1/0,i=[];for(;t&&t.name==`listItem`&&t.getAttribute(`listIndent`)!==0;){let e=t.getAttribute(`listIndent`);e<n&&(n=e);let r=e-n;i.push({element:t,listIndent:r}),t=t.nextSibling}i=i.reverse();for(let t of i)e.setAttribute(`listIndent`,t.listIndent,t.element)}if(!i){let e=1/0;for(let t of r)t.is(`element`,`listItem`)&&t.getAttribute(`listIndent`)<e&&(e=t.getAttribute(`listIndent`));e=e===0?1:e,LB(r,!0,e),LB(r,!1,e)}for(let t of r.reverse())i&&t.name==`listItem`?e.rename(t,`paragraph`):!i&&t.name!=`listItem`?(e.setAttributes({listType:this.type,listIndent:0},t),e.rename(t,`listItem`)):!i&&t.name==`listItem`&&t.getAttribute(`listType`)!=this.type&&e.setAttribute(`listType`,this.type,t);this.fire(`_executeCleanup`,r)})}_getValue(){let e=j(this.editor.model.document.selection.getSelectedBlocks());return!!e&&e.is(`element`,`listItem`)&&e.getAttribute(`listType`)==this.type}_checkEnabled(){if(this.value)return!0;let e=this.editor.model.document.selection,t=this.editor.model.schema,n=j(e.getSelectedBlocks());return n?RB(n,t):!1}};function LB(e,t,n){let r=t?e[0]:e[e.length-1];if(r.is(`element`,`listItem`)){let i=r[t?`previousSibling`:`nextSibling`],a=r.getAttribute(`listIndent`);for(;i&&i.is(`element`,`listItem`)&&i.getAttribute(`listIndent`)>=n;)a>i.getAttribute(`listIndent`)&&(a=i.getAttribute(`listIndent`)),i.getAttribute(`listIndent`)==a&&e[t?`unshift`:`push`](i),i=i[t?`previousSibling`:`nextSibling`]}}function RB(e,t){return t.checkChild(e.parent,`listItem`)&&!t.isObject(e)}var zB=class extends I{_indentBy;constructor(e,t){super(e),this._indentBy=t==`forward`?1:-1}refresh(){this.isEnabled=this._checkEnabled()}execute(){let e=this.editor.model,t=e.document,n=Array.from(t.selection.getSelectedBlocks());e.change(e=>{let t=n[n.length-1],r=t.nextSibling;for(;r&&r.name==`listItem`&&r.getAttribute(`listIndent`)>t.getAttribute(`listIndent`);)n.push(r),r=r.nextSibling;this._indentBy<0&&(n=n.reverse());for(let t of n){let n=t.getAttribute(`listIndent`)+this._indentBy;n<0?e.rename(t,`paragraph`):e.setAttribute(`listIndent`,n,t)}this.fire(`_executeCleanup`,n)})}_checkEnabled(){let e=j(this.editor.model.document.selection.getSelectedBlocks());if(!e||!e.is(`element`,`listItem`))return!1;if(this._indentBy>0){let t=e.getAttribute(`listIndent`),n=e.getAttribute(`listType`),r=e.previousSibling;for(;r&&r.is(`element`,`listItem`)&&r.getAttribute(`listIndent`)>=t;){if(r.getAttribute(`listIndent`)==t)return r.getAttribute(`listType`)==n;r=r.previousSibling}return!1}return!0}};function BB(e){let t=e.createContainerElement(`li`);return t.getFillerOffset=QB,t}function VB(e,t){let n=t.mapper,r=t.writer,i=e.getAttribute(`listType`)==`numbered`?`ol`:`ul`,a=BB(r),o=r.createContainerElement(i,null);return r.insert(r.createPositionAt(o,0),a),n.bindElements(e,a),a}function HB(e,t,n,r){let i=t.parent,a=n.mapper,o=n.writer,s=a.toViewPosition(r.createPositionBefore(e)),c=GB(e.previousSibling,{sameIndent:!0,smallerIndent:!0,listIndent:e.getAttribute(`listIndent`)}),l=e.previousSibling;if(c&&c.getAttribute(`listIndent`)==e.getAttribute(`listIndent`)){let e=a.toViewElement(c);s=o.breakContainer(o.createPositionAfter(e))}else if(l&&l.name==`listItem`){s=a.toViewPosition(r.createPositionAt(l,`end`));let e=a.findMappedViewAncestor(s),t=KB(e);s=t?o.createPositionBefore(t):o.createPositionAt(e,`end`)}else s=a.toViewPosition(r.createPositionBefore(e));if(s=WB(s),o.insert(s,i),l&&l.name==`listItem`){let e=a.toViewElement(l),n=o.createRange(o.createPositionAt(e,0),s).getWalker({ignoreElementEnd:!0});for(let e of n)if(e.item.is(`element`,`li`)){let r=o.breakContainer(o.createPositionBefore(e.item)),i=e.item.parent,a=o.createPositionAt(t,`end`);UB(o,a.nodeBefore,a.nodeAfter),o.move(o.createRangeOn(i),a),n._position=r}}else{let n=i.nextSibling;if(n&&(n.is(`element`,`ul`)||n.is(`element`,`ol`))){let r=null;for(let t of n.getChildren()){let n=a.toModelElement(t);if(n&&n.getAttribute(`listIndent`)>e.getAttribute(`listIndent`))r=t;else break}r&&(o.breakContainer(o.createPositionAfter(r)),o.move(o.createRangeOn(r.parent),o.createPositionAt(t,`end`)))}}UB(o,i,i.nextSibling),UB(o,i.previousSibling,i)}function UB(e,t,n){return!t||!n||t.name!=`ul`&&t.name!=`ol`||t.name!=n.name||t.getAttribute(`class`)!==n.getAttribute(`class`)?null:e.mergeContainers(e.createPositionAfter(t))}function WB(e){return e.getLastMatchingPosition(e=>e.item.is(`uiElement`))}function GB(e,t){let n=!!t.sameIndent,r=!!t.smallerIndent,i=t.listIndent,a=e;for(;a&&a.name==`listItem`;){let e=a.getAttribute(`listIndent`);if(n&&i==e||r&&i>e)return a;a=t.direction===`forward`?a.nextSibling:a.previousSibling}return null}function KB(e){for(let t of e.getChildren())if(t.name==`ul`||t.name==`ol`)return t;return null}function qB(e,t){let n=[],r=e.parent,i={ignoreElementEnd:!1,startPosition:e,shallow:!0,direction:t},a=r.getAttribute(`listIndent`),o=[...new Xc(i)].filter(e=>e.item.is(`element`)).map(e=>e.item);for(let e of o){if(!e.is(`element`,`listItem`)||e.getAttribute(`listIndent`)<a)break;if(!(e.getAttribute(`listIndent`)>a)){if(e.getAttribute(`listType`)!==r.getAttribute(`listType`)||e.getAttribute(`listStyle`)!==r.getAttribute(`listStyle`)||e.getAttribute(`listReversed`)!==r.getAttribute(`listReversed`)||e.getAttribute(`listStart`)!==r.getAttribute(`listStart`))break;t===`backward`?n.unshift(e):n.push(e)}}return n}function JB(e){let t=[...e.document.selection.getSelectedBlocks()].filter(e=>e.is(`element`,`listItem`)).map(t=>{let n=e.change(e=>e.createPositionAt(t,0));return[...qB(n,`backward`),...qB(n,`forward`)]}).flat();return t=[...new Set(t)],t}const YB=[`disc`,`circle`,`square`],XB=[`decimal`,`decimal-leading-zero`,`lower-roman`,`upper-roman`,`lower-latin`,`upper-latin`];function ZB(e){return YB.includes(e)?`bulleted`:XB.includes(e)?`numbered`:null}function QB(){let e=!this.isEmpty&&(this.getChild(0).name==`ul`||this.getChild(0).name==`ol`);return this.isEmpty||e?0:$o.call(this)}var $B=class extends F{static get pluginName(){return`LegacyListUtils`}static get isOfficialPlugin(){return!0}getListTypeFromListStyleType(e){return ZB(e)}getSelectedListItems(e){return JB(e)}getSiblingNodes(e,t){return qB(e,t)}};function eV(e){return(t,n,r)=>{let i=r.consumable;if(!i.test(n.item,`insert`)||!i.test(n.item,`attribute:listType`)||!i.test(n.item,`attribute:listIndent`))return;i.consume(n.item,`insert`),i.consume(n.item,`attribute:listType`),i.consume(n.item,`attribute:listIndent`);let a=n.item;HB(a,VB(a,r),r,e)}}function tV(e){return(t,n,r)=>{let i=r.mapper.toViewPosition(n.position).getLastMatchingPosition(e=>!e.item.is(`element`,`li`)).nodeAfter,a=r.writer;a.breakContainer(a.createPositionBefore(i)),a.breakContainer(a.createPositionAfter(i));let o=i.parent,s=o.previousSibling,c=a.createRangeOn(o),l=a.remove(c);s&&s.nextSibling&&UB(a,s,s.nextSibling),gV(r.mapper.toModelElement(i).getAttribute(`listIndent`)+1,n.position,c.start,i,r,e);for(let e of a.createRangeIn(l).getItems())r.mapper.unbindViewElement(e);t.stop()}}const nV=(e,t,n)=>{if(!n.consumable.test(t.item,e.name))return;let r=n.mapper.toViewElement(t.item),i=n.writer;i.breakContainer(i.createPositionBefore(r)),i.breakContainer(i.createPositionAfter(r));let a=r.parent,o=t.attributeNewValue==`numbered`?`ol`:`ul`;i.rename(o,a)},rV=(e,t,n)=>{n.consumable.consume(t.item,e.name);let r=n.mapper.toViewElement(t.item).parent,i=n.writer;UB(i,r,r.nextSibling),UB(i,r.previousSibling,r)};function iV(e){return(t,n,r)=>{if(!r.consumable.consume(n.item,`attribute:listIndent`))return;let i=r.mapper.toViewElement(n.item),a=r.writer;a.breakContainer(a.createPositionBefore(i)),a.breakContainer(a.createPositionAfter(i));let o=i.parent,s=o.previousSibling,c=a.createRangeOn(o);a.remove(c),s&&s.nextSibling&&UB(a,s,s.nextSibling),gV(n.attributeOldValue+1,n.range.start,c.start,i,r,e),HB(n.item,i,r,e);for(let e of n.item.getChildren())r.consumable.consume(e,`insert`)}}const aV=(e,t,n)=>{if(n.consumable.test(t.item,e.name)&&t.item.name!=`listItem`){let e=n.mapper.toViewPosition(t.range.start),r=n.writer,i=[];for(;(e.parent.name==`ul`||e.parent.name==`ol`)&&(e=r.breakContainer(e),e.parent.name==`li`);){let t=e,n=r.createPositionAt(e.parent,`end`);if(!t.isEqual(n)){let e=r.remove(r.createRange(t,n));i.push(e)}e=r.createPositionAfter(e.parent)}if(i.length>0){for(let t=0;t<i.length;t++){let n=e.nodeBefore;if(e=r.insert(e,i[t]).end,t>0){let t=UB(r,n,n.nextSibling);t&&t.parent==n&&e.offset--}}UB(r,e.nodeBefore,e.nodeAfter)}}},oV=(e,t,n)=>{let r=n.mapper.toViewPosition(t.position),i=r.nodeBefore,a=r.nodeAfter;UB(n.writer,i,a)},sV=(e,t,n)=>{if(n.consumable.consume(t.viewItem,{name:!0})){let e=n.writer,r=e.createElement(`listItem`),i=vV(t.viewItem);e.setAttribute(`listIndent`,i,r);let a=t.viewItem.parent&&t.viewItem.parent.name==`ol`?`numbered`:`bulleted`;if(e.setAttribute(`listType`,a,r),!n.safeInsert(r,t.modelCursor))return;let o=mV(r,t.viewItem.getChildren(),n);t.modelRange=e.createRange(t.modelCursor,o),n.updateConversionResult(r,t)}},cV=(e,t,n)=>{if(n.consumable.test(t.viewItem,{name:!0})){let e=Array.from(t.viewItem.getChildren());for(let t of e)t.is(`element`,`li`)||_V(t)||t._remove()}},lV=(e,t,n)=>{if(n.consumable.test(t.viewItem,{name:!0})){if(t.viewItem.childCount===0)return;let e=[...t.viewItem.getChildren()],n=!1;for(let t of e)n&&!_V(t)&&t._remove(),_V(t)&&(n=!0)}};function uV(e){return(t,n)=>{if(n.isPhantom)return;let r=n.modelPosition.nodeBefore;if(r&&r.is(`element`,`listItem`)){let t=n.mapper.toViewElement(r),i=t.getAncestors().find(_V),a=e.createPositionAt(t,0).getWalker();for(let e of a)if(e.type==`elementStart`&&e.item.is(`element`,`li`)){n.viewPosition=e.previousPosition;break}else if(e.type==`elementEnd`&&e.item==i){n.viewPosition=e.nextPosition;break}}}}function dV(e){return(t,n)=>{let r=n.viewPosition,i=r.parent,a=n.mapper;if(i.name==`ul`||i.name==`ol`){if(r.isAtEnd){let t=a.toModelElement(r.nodeBefore),i=a.getModelLength(r.nodeBefore);n.modelPosition=e.createPositionBefore(t).getShiftedBy(i)}else{let t=a.toModelElement(r.nodeAfter);n.modelPosition=e.createPositionBefore(t)}t.stop()}else if(i.name==`li`&&r.nodeBefore&&(r.nodeBefore.name==`ul`||r.nodeBefore.name==`ol`)){let o=a.toModelElement(i),s=1,c=r.nodeBefore;for(;c&&_V(c);)s+=a.getModelLength(c),c=c.previousSibling;n.modelPosition=e.createPositionBefore(o).getShiftedBy(s),t.stop()}}}function fV(e,t){let n=e.document.differ.getChanges(),r=new Map,i=!1;for(let r of n)if(r.type==`insert`&&r.name==`listItem`)a(r.position);else if(r.type==`insert`&&r.name!=`listItem`){if(r.name!=`$text`){let n=r.position.nodeAfter;n.hasAttribute(`listIndent`)&&(t.removeAttribute(`listIndent`,n),i=!0),n.hasAttribute(`listType`)&&(t.removeAttribute(`listType`,n),i=!0),n.hasAttribute(`listStyle`)&&(t.removeAttribute(`listStyle`,n),i=!0),n.hasAttribute(`listReversed`)&&(t.removeAttribute(`listReversed`,n),i=!0),n.hasAttribute(`listStart`)&&(t.removeAttribute(`listStart`,n),i=!0);for(let t of Array.from(e.createRangeIn(n)).filter(e=>e.item.is(`element`,`listItem`)))a(t.previousPosition)}a(r.position.getShiftedBy(r.length))}else r.type==`remove`&&r.name==`listItem`?a(r.position):(r.type==`attribute`&&r.attributeKey==`listIndent`||r.type==`attribute`&&r.attributeKey==`listType`)&&a(r.range.start);for(let e of r.values())o(e),s(e);return i;function a(e){let t=e.nodeBefore;if(!t||!t.is(`element`,`listItem`)){let t=e.nodeAfter;t&&t.is(`element`,`listItem`)&&r.set(t,t)}else{let e=t;if(r.has(e))return;for(let t=e.previousSibling;t&&t.is(`element`,`listItem`);t=e.previousSibling)if(e=t,r.has(e))return;r.set(t,e)}}function o(e){let n=0,r=null;for(;e&&e.is(`element`,`listItem`);){let a=e.getAttribute(`listIndent`);if(a>n){let o;r===null?(r=a-n,o=n):(r>a&&(r=a),o=a-r),t.setAttribute(`listIndent`,o,e),i=!0}else r=null,n=e.getAttribute(`listIndent`)+1;e=e.nextSibling}}function s(e){let n=[],r=null;for(;e&&e.is(`element`,`listItem`);){let a=e.getAttribute(`listIndent`);if(r&&r.getAttribute(`listIndent`)>a&&(n=n.slice(0,a+1)),a!=0)if(n[a]){let r=n[a];e.getAttribute(`listType`)!=r&&(t.setAttribute(`listType`,r,e),i=!0)}else n[a]=e.getAttribute(`listType`);r=e,e=e.nextSibling}}}const pV=function(e,[t,n]){let r=this,i=t.is(`documentFragment`)?t.getChild(0):t,a;if(a=n?r.createSelection(n):r.document.selection,i&&i.is(`element`,`listItem`)){let e=a.getFirstPosition(),t=null;if(e.parent.is(`element`,`listItem`)?t=e.parent:e.nodeBefore&&e.nodeBefore.is(`element`,`listItem`)&&(t=e.nodeBefore),t){let e=t.getAttribute(`listIndent`);if(e>0)for(;i&&i.is(`element`,`listItem`);)i._setAttribute(`listIndent`,i.getAttribute(`listIndent`)+e),i=i.nextSibling}}};function mV(e,t,n){let{writer:r,schema:i}=n,a=r.createPositionAfter(e);for(let o of t)if(o.name==`ul`||o.name==`ol`)a=n.convertItem(o,a).modelCursor;else{let t=n.convertItem(o,r.createPositionAt(e,`end`)),s=t.modelRange.start.nodeAfter;s&&s.is(`element`)&&!i.checkChild(e,s.name)&&(e=t.modelCursor.parent.is(`element`,`listItem`)?t.modelCursor.parent:hV(t.modelCursor),a=r.createPositionAfter(e))}return a}function hV(e){let t=new Xc({startPosition:e}),n;do n=t.next();while(!n.value.item.is(`element`,`listItem`));return n.value.item}function gV(e,t,n,r,i,a){let o=GB(t.nodeBefore,{sameIndent:!0,smallerIndent:!0,listIndent:e}),s=i.mapper,c=i.writer,l=o?o.getAttribute(`listIndent`):null,u;if(!o)u=n;else if(l==e){let e=s.toViewElement(o).parent;u=c.createPositionAfter(e)}else{let e=a.createPositionAt(o,`end`);u=s.toViewPosition(e)}u=WB(u);for(let e of[...r.getChildren()])_V(e)&&(u=c.move(c.createRangeOn(e),u).end,UB(c,e,e.nextSibling),UB(c,e.previousSibling,e))}function _V(e){return e.is(`element`,`ol`)||e.is(`element`,`ul`)}function vV(e){let t=0,n=e.parent;for(;n;){if(n.is(`element`,`li`))t++;else{let e=n.previousSibling;e&&e.is(`element`,`li`)&&t++}n=n.parent}return t}var yV=class extends F{static get pluginName(){return`LegacyListEditing`}static get isOfficialPlugin(){return!0}static get requires(){return[TE,hT,$B]}init(){let e=this.editor;e.model.schema.register(`listItem`,{inheritAllFrom:`$block`,allowAttributes:[`listType`,`listIndent`]});let t=e.data,n=e.editing;e.model.document.registerPostFixer(t=>fV(e.model,t)),n.mapper.registerViewToModelLength(`li`,bV),t.mapper.registerViewToModelLength(`li`,bV),n.mapper.on(`modelToViewPosition`,uV(n.view)),n.mapper.on(`viewToModelPosition`,dV(e.model)),t.mapper.on(`modelToViewPosition`,uV(n.view)),e.conversion.for(`editingDowncast`).add(t=>{t.on(`insert`,aV,{priority:`high`}),t.on(`insert:listItem`,eV(e.model)),t.on(`attribute:listType:listItem`,nV,{priority:`high`}),t.on(`attribute:listType:listItem`,rV,{priority:`low`}),t.on(`attribute:listIndent:listItem`,iV(e.model)),t.on(`remove:listItem`,tV(e.model)),t.on(`remove`,oV,{priority:`low`})}),e.conversion.for(`dataDowncast`).add(t=>{t.on(`insert`,aV,{priority:`high`}),t.on(`insert:listItem`,eV(e.model))}),e.conversion.for(`upcast`).add(e=>{e.on(`element:ul`,cV,{priority:`high`}),e.on(`element:ol`,cV,{priority:`high`}),e.on(`element:li`,lV,{priority:`high`}),e.on(`element:li`,sV)}),e.model.on(`insertContent`,pV,{priority:`high`}),e.commands.add(`numberedList`,new IB(e,`numbered`)),e.commands.add(`bulletedList`,new IB(e,`bulleted`)),e.commands.add(`indentList`,new zB(e,`forward`)),e.commands.add(`outdentList`,new zB(e,`backward`));let r=n.view.document;this.listenTo(r,`enter`,(e,t)=>{let n=this.editor.model.document,r=n.selection.getLastPosition().parent;n.selection.isCollapsed&&r.name==`listItem`&&r.isEmpty&&(this.editor.execute(`outdentList`),t.preventDefault(),e.stop())},{context:`li`}),this.listenTo(r,`delete`,(e,t)=>{if(t.direction!==`backward`)return;let n=this.editor.model.document.selection;if(!n.isCollapsed)return;let r=n.getFirstPosition();if(!r.isAtStart)return;let i=r.parent;i.name===`listItem`&&(i.previousSibling&&i.previousSibling.name===`listItem`||(this.editor.execute(`outdentList`),t.preventDefault(),e.stop()))},{context:`li`}),this.listenTo(e.editing.view.document,`tab`,(t,n)=>{let r=n.shiftKey?`outdentList`:`indentList`;this.editor.commands.get(r).isEnabled&&(e.execute(r),n.stopPropagation(),n.preventDefault(),t.stop())},{context:`li`})}afterInit(){let e=this.editor.commands,t=e.get(`indent`),n=e.get(`outdent`);t&&t.registerChildCommand(e.get(`indentList`)),n&&n.registerChildCommand(e.get(`outdentList`))}};function bV(e){let t=1;for(let n of e.getChildren())if(n.name==`ul`||n.name==`ol`)for(let e of n.getChildren())t+=bV(e);return t}var xV=class extends F{static get requires(){return[yV,Kz]}static get pluginName(){return`LegacyList`}static get isOfficialPlugin(){return!0}},SV=class extends I{defaultType;constructor(e,t){super(e),this.defaultType=t}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){this._tryToConvertItemsToList(e);let t=this.editor.model,n=JB(t);n.length&&t.change(t=>{for(let r of n)t.setAttribute(`listStyle`,e.type||this.defaultType,r)})}_getValue(){let e=this.editor.model.document.selection.getFirstPosition().parent;return e&&e.is(`element`,`listItem`)?e.getAttribute(`listStyle`):null}_checkEnabled(){let e=this.editor,t=e.commands.get(`numberedList`),n=e.commands.get(`bulletedList`);return t.isEnabled||n.isEnabled}_tryToConvertItemsToList(e){if(!e.type)return;let t=ZB(e.type);if(!t)return;let n=this.editor,r=`${t}List`;n.commands.get(r).value||n.execute(r)}},CV=class extends I{refresh(){let e=this._getValue();this.value=e,this.isEnabled=e!=null}execute(e={}){let t=this.editor.model,n=JB(t).filter(e=>e.getAttribute(`listType`)==`numbered`);t.change(t=>{for(let r of n)t.setAttribute(`listReversed`,!!e.reversed,r)})}_getValue(){let e=this.editor.model.document.selection.getFirstPosition().parent;return e&&e.is(`element`,`listItem`)&&e.getAttribute(`listType`)==`numbered`?e.getAttribute(`listReversed`):null}},wV=class extends I{refresh(){let e=this._getValue();this.value=e,this.isEnabled=e!=null}execute({startIndex:e=1}={}){let t=this.editor.model,n=JB(t).filter(e=>e.getAttribute(`listType`)==`numbered`);t.change(t=>{for(let r of n)t.setAttribute(`listStart`,e>=0?e:1,r)})}_getValue(){let e=this.editor.model.document.selection.getFirstPosition().parent;return e&&e.is(`element`,`listItem`)&&e.getAttribute(`listType`)==`numbered`?e.getAttribute(`listStart`):null}};const TV=`default`;var EV=class extends F{static get requires(){return[yV]}static get pluginName(){return`LegacyListPropertiesEditing`}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(`list`,{properties:{styles:!0,startIndex:!1,reversed:!1}})}init(){let e=this.editor,t=e.model,n=DV(e.config.get(`list.properties`));t.schema.extend(`listItem`,{allowAttributes:n.map(e=>e.attributeName)});for(let t of n)t.addCommand(e);this.listenTo(e.commands.get(`indentList`),`_executeCleanup`,AV(e,n)),this.listenTo(e.commands.get(`outdentList`),`_executeCleanup`,jV(e,n)),this.listenTo(e.commands.get(`bulletedList`),`_executeCleanup`,IV(e)),this.listenTo(e.commands.get(`numberedList`),`_executeCleanup`,IV(e)),t.document.registerPostFixer(MV(e,n)),e.conversion.for(`upcast`).add(OV(n)),e.conversion.for(`downcast`).add(kV(n)),this._mergeListAttributesWhileMergingLists(n)}afterInit(){let e=this.editor;e.commands.get(`todoList`)&&e.model.document.registerPostFixer(FV(e))}_mergeListAttributesWhileMergingLists(e){let t=this.editor.model,n;this.listenTo(t,`deleteContent`,(e,[t])=>{let r=t.getFirstPosition(),i=t.getLastPosition();if(r.parent===i.parent||!r.parent.is(`element`,`listItem`))return;let a=i.parent.nextSibling;if(!a||!a.is(`element`,`listItem`))return;let o=GB(r.parent,{sameIndent:!0,listIndent:a.getAttribute(`listIndent`)});o&&o.getAttribute(`listType`)===a.getAttribute(`listType`)&&(n=o)},{priority:`high`}),this.listenTo(t,`deleteContent`,()=>{n&&=(t.change(t=>{let r=GB(n.nextSibling,{sameIndent:!0,listIndent:n.getAttribute(`listIndent`),direction:`forward`});if(!r){n=null;return}let i=[r,...qB(t.createPositionAt(r,0),`forward`)];for(let r of i)for(let i of e)if(i.appliesToListItem(r)){let e=i.attributeName,a=n.getAttribute(e);t.setAttribute(e,a,r)}}),null)},{priority:`low`})}};function DV(e){let t=[];return e.styles&&t.push({attributeName:`listStyle`,defaultValue:TV,addCommand(e){e.commands.add(`listStyle`,new SV(e,TV))},appliesToListItem(){return!0},setAttributeOnDowncast(e,t,n){t&&t!==TV?e.setStyle(`list-style-type`,t,n):e.removeStyle(`list-style-type`,n)},getAttributeOnUpcast(e){return rB(e.getStyle(`list-style-type`))||TV}}),e.reversed&&t.push({attributeName:`listReversed`,defaultValue:!1,addCommand(e){e.commands.add(`listReversed`,new CV(e))},appliesToListItem(e){return e.getAttribute(`listType`)==`numbered`},setAttributeOnDowncast(e,t,n){t?e.setAttribute(`reversed`,`reversed`,n):e.removeAttribute(`reversed`,n)},getAttributeOnUpcast(e){return e.hasAttribute(`reversed`)}}),e.startIndex&&t.push({attributeName:`listStart`,defaultValue:1,addCommand(e){e.commands.add(`listStart`,new wV(e))},appliesToListItem(e){return e.getAttribute(`listType`)==`numbered`},setAttributeOnDowncast(e,t,n){t==0||t>1?e.setAttribute(`start`,t,n):e.removeAttribute(`start`,n)},getAttributeOnUpcast(e){let t=e.getAttribute(`start`);return t>=0?t:1}}),t}function OV(e){return t=>{t.on(`element:li`,(t,n,r)=>{if(!n.modelRange)return;let i=n.viewItem.parent,a=n.modelRange.start.nodeAfter||n.modelRange.end.nodeBefore;for(let t of e)if(t.appliesToListItem(a)){let e=t.getAttributeOnUpcast(i);r.writer.setAttribute(t.attributeName,e,a)}},{priority:`low`})}}function kV(e){return n=>{for(let r of e)n.on(`attribute:${r.attributeName}:listItem`,(e,n,i)=>{let a=i.writer,o=n.item,s=GB(o.previousSibling,{sameIndent:!0,listIndent:o.getAttribute(`listIndent`),direction:`backward`}),c=i.mapper.toViewElement(o);t(o,s)||a.breakContainer(a.createPositionBefore(c)),r.setAttributeOnDowncast(a,n.attributeNewValue,c.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`)}}function AV(e,t){return(n,r)=>{let i=r[0],a=i.getAttribute(`listIndent`),o=r.filter(e=>e.getAttribute(`listIndent`)===a),s=null;i.previousSibling.getAttribute(`listIndent`)+1!==a&&(s=GB(i.previousSibling,{sameIndent:!0,direction:`backward`,listIndent:a})),e.model.change(e=>{for(let n of o)for(let r of t)if(r.appliesToListItem(n)){let t=s==null?r.defaultValue:s.getAttribute(r.attributeName);e.setAttribute(r.attributeName,t,n)}})}}function jV(e,t){return(n,r)=>{if(r=r.reverse().filter(e=>e.is(`element`,`listItem`)),!r.length)return;let i=r[0].getAttribute(`listIndent`),a=r[0].getAttribute(`listType`),o=r[0].previousSibling;if(o.is(`element`,`listItem`))for(;o.getAttribute(`listIndent`)!==i;)o=o.previousSibling;else o=null;o||=r[r.length-1].nextSibling,!(!o||!o.is(`element`,`listItem`))&&o.getAttribute(`listType`)===a&&e.model.change(e=>{let n=r.filter(e=>e.getAttribute(`listIndent`)===i);for(let r of n)for(let n of t)if(n.appliesToListItem(r)){let t=n.attributeName,i=o.getAttribute(t);e.setAttribute(t,i,r)}})}}function MV(e,t){return n=>{let r=!1,i=LV(e.model.document.differ.getChanges()).filter(e=>e.getAttribute(`listType`)!==`todo`);if(!i.length)return r;let a=i[i.length-1].nextSibling;if((!a||!a.is(`element`,`listItem`))&&(a=i[0].previousSibling,a)){let e=i[0].getAttribute(`listIndent`);for(;a.is(`element`,`listItem`)&&a.getAttribute(`listIndent`)!==e&&(a=a.previousSibling,a););}for(let e of t){let t=e.attributeName;for(let o of i){if(!e.appliesToListItem(o)){n.removeAttribute(t,o);continue}if(!o.hasAttribute(t))NV(a,o,e)?n.setAttribute(t,a.getAttribute(t),o):n.setAttribute(t,e.defaultValue,o),r=!0;else{let i=o.previousSibling;PV(i,o,e.attributeName)&&(n.setAttribute(t,i.getAttribute(t),o),r=!0)}}}return r}}function NV(e,t,n){if(!e)return!1;let r=e.getAttribute(n.attributeName);return!(!r||r==n.defaultValue||e.getAttribute(`listType`)!==t.getAttribute(`listType`))}function PV(e,t,n){if(!e||!e.is(`element`,`listItem`)||t.getAttribute(`listType`)!==e.getAttribute(`listType`))return!1;let r=e.getAttribute(`listIndent`);if(r<1||r!==t.getAttribute(`listIndent`))return!1;let i=e.getAttribute(n);return!(!i||i===t.getAttribute(n))}function FV(e){return t=>{let n=LV(e.model.document.differ.getChanges()).filter(e=>e.getAttribute(`listType`)===`todo`&&(e.hasAttribute(`listStyle`)||e.hasAttribute(`listReversed`)||e.hasAttribute(`listStart`)));if(!n.length)return!1;for(let e of n)t.removeAttribute(`listStyle`,e),t.removeAttribute(`listReversed`,e),t.removeAttribute(`listStart`,e);return!0}}function IV(e){return(t,n)=>{n=n.filter(e=>e.is(`element`,`listItem`)),e.model.change(e=>{for(let t of n)e.removeAttribute(`listStyle`,t)})}}function LV(e){let t=[];for(let n of e){let e=RV(n);e&&e.is(`element`,`listItem`)&&t.push(e)}return t}function RV(e){return e.type===`attribute`?e.range.start.nodeAfter:e.type===`insert`?e.position.nodeAfter:null}var zV=class extends F{static get requires(){return[EV,mB]}static get pluginName(){return`LegacyListProperties`}static get isOfficialPlugin(){return!0}};const BV=`todoListChecked`;var VV=class extends I{_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(BV)),this.isEnabled=!!this._selectedElements.length}_getSelectedItems(){let e=this.editor.model,t=e.schema,n=e.document.selection.getFirstRange(),r=n.start.parent,i=[];t.checkAttribute(r,BV)&&i.push(r);for(let e of n.getItems())t.checkAttribute(e,BV)&&!i.includes(e)&&i.push(e);return i}execute(e={}){this.editor.model.change(t=>{for(let n of this._selectedElements)(e.forceValue===void 0?!this.value:e.forceValue)?t.setAttribute(BV,!0,n):t.removeAttribute(BV,n)})}};function HV(e,t){return(n,r,i)=>{let a=i.consumable;if(!a.test(r.item,`insert`)||!a.test(r.item,`attribute:listType`)||!a.test(r.item,`attribute:listIndent`)||r.item.getAttribute(`listType`)!=`todo`)return;let o=r.item;a.consume(o,`insert`),a.consume(o,`attribute:listType`),a.consume(o,`attribute:listIndent`),a.consume(o,`attribute:todoListChecked`);let s=i.writer,c=VB(o,i),l=JV(o,s,!!o.getAttribute(`todoListChecked`),t),u=s.createContainerElement(`span`,{class:`todo-list__label__description`});s.addClass(`todo-list`,c.parent),s.insert(s.createPositionAt(c,0),l),s.insert(s.createPositionAfter(l),u),HB(o,c,i,e)}}function UV(e){return(t,n,r)=>{let i=r.consumable;if(!i.test(n.item,`insert`)||!i.test(n.item,`attribute:listType`)||!i.test(n.item,`attribute:listIndent`)||n.item.getAttribute(`listType`)!=`todo`)return;let a=n.item;i.consume(a,`insert`),i.consume(a,`attribute:listType`),i.consume(a,`attribute:listIndent`),i.consume(a,`attribute:todoListChecked`);let o=r.writer,s=VB(a,r);o.addClass(`todo-list`,s.parent);let c=o.createContainerElement(`label`,{class:`todo-list__label`}),l=o.createEmptyElement(`input`,{type:`checkbox`,disabled:`disabled`}),u=o.createContainerElement(`span`,{class:`todo-list__label__description`});a.getAttribute(`todoListChecked`)&&o.setAttribute(`checked`,`checked`,l),o.insert(o.createPositionAt(s,0),c),o.insert(o.createPositionAt(c,0),l),o.insert(o.createPositionAfter(l),u),HB(a,s,r,e)}}const WV=(e,t,n)=>{let r=t.modelCursor,i=r.parent,a=t.viewItem;if(a.getAttribute(`type`)!=`checkbox`||i.name!=`listItem`||!r.isAtStart||!n.consumable.consume(a,{name:!0}))return;let o=n.writer;o.setAttribute(`listType`,`todo`,i),t.viewItem.hasAttribute(`checked`)&&o.setAttribute(`todoListChecked`,!0,i),t.modelRange=o.createRange(r)};function GV(e,t){return(n,r,i)=>{if(!i.consumable.consume(r.item,n.name))return;let a=i.mapper.toViewElement(r.item),o=i.writer,s=YV(a,t);if(r.attributeNewValue==`todo`){let t=!!r.item.getAttribute(`todoListChecked`),n=JV(r.item,o,t,e),i=o.createContainerElement(`span`,{class:`todo-list__label__description`}),s=o.createRangeIn(a),c=KB(a),l=WB(s.start),u=c?o.createPositionBefore(c):s.end,d=o.createRange(l,u);o.addClass(`todo-list`,a.parent),o.move(d,o.createPositionAt(i,0)),o.insert(o.createPositionAt(a,0),n),o.insert(o.createPositionAfter(n),i)}else if(r.attributeOldValue==`todo`){let e=XV(a,t);o.removeClass(`todo-list`,a.parent),o.remove(s),o.move(o.createRangeIn(e),o.createPositionBefore(e)),o.remove(e)}}}function KV(e){return(t,n,r)=>{if(n.item.getAttribute(`listType`)!=`todo`||!r.consumable.consume(n.item,`attribute:todoListChecked`))return;let{mapper:i,writer:a}=r,o=!!n.item.getAttribute(`todoListChecked`),s=i.toViewElement(n.item).getChild(0),c=JV(n.item,a,o,e);a.insert(a.createPositionAfter(s),c),a.remove(s)}}function qV(e){return(t,n)=>{let r=n.modelPosition,i=r.parent;if(!i.is(`element`,`listItem`)||i.getAttribute(`listType`)!=`todo`)return;let a=XV(n.mapper.toViewElement(i),e);a&&(n.viewPosition=n.mapper.findPositionIn(a,r.offset))}}function JV(e,t,n,r){return t.createUIElement(`label`,{class:`todo-list__label`,contenteditable:!1},function(t){let i=mr(document,`input`,{type:`checkbox`,tabindex:`-1`});n&&i.setAttribute(`checked`,`checked`),i.addEventListener(`change`,()=>r(e));let a=this.toDomElement(t);return a.appendChild(i),a})}function YV(e,t){let n=t.createRangeIn(e);for(let e of n)if(e.item.is(`uiElement`,`label`))return e.item}function XV(e,t){let n=t.createRangeIn(e);for(let e of n)if(e.item.is(`containerElement`,`span`)&&e.item.hasClass(`todo-list__label__description`))return e.item}const ZV=yi(`Ctrl+Enter`);var QV=class extends F{static get pluginName(){return`LegacyTodoListEditing`}static get isOfficialPlugin(){return!0}static get requires(){return[yV]}init(){let e=this.editor,{editing:t,data:n,model:r}=e;r.schema.extend(`listItem`,{allowAttributes:[`todoListChecked`]}),r.schema.addAttributeCheck((e,t)=>{let n=e.last;if(t==`todoListChecked`&&n.name==`listItem`&&n.getAttribute(`listType`)!=`todo`)return!1}),e.commands.add(`todoList`,new IB(e,`todo`));let i=new VV(e);e.commands.add(`checkTodoList`,i),e.commands.add(`todoListCheck`,i),n.downcastDispatcher.on(`insert:listItem`,UV(r),{priority:`high`}),n.upcastDispatcher.on(`element:input`,WV,{priority:`high`}),t.downcastDispatcher.on(`insert:listItem`,HV(r,e=>this._handleCheckmarkChange(e)),{priority:`high`}),t.downcastDispatcher.on(`attribute:listType:listItem`,GV(e=>this._handleCheckmarkChange(e),t.view)),t.downcastDispatcher.on(`attribute:todoListChecked:listItem`,KV(e=>this._handleCheckmarkChange(e))),t.mapper.on(`modelToViewPosition`,qV(t.view)),n.mapper.on(`modelToViewPosition`,qV(t.view)),this.listenTo(t.view.document,`arrowKey`,$V(r,e.locale),{context:`li`}),this.listenTo(t.view.document,`keydown`,(t,n)=>{vi(n)===ZV&&(e.execute(`checkTodoList`),t.stop())},{priority:`high`});let a=new Set;this.listenTo(r,`applyOperation`,(e,t)=>{let n=t[0];if(n.type==`rename`&&n.oldName==`listItem`){let e=n.position.nodeAfter;e.hasAttribute(`todoListChecked`)&&a.add(e)}else if(n.type==`changeAttribute`&&n.key==`listType`&&n.oldValue===`todo`)for(let e of n.range.getItems())e.hasAttribute(`todoListChecked`)&&e.getAttribute(`listType`)!==`todo`&&a.add(e)}),r.document.registerPostFixer(e=>{let t=!1;for(let n of a)e.removeAttribute(`todoListChecked`,n),t=!0;return a.clear(),t}),this._initAriaAnnouncements()}_handleCheckmarkChange(e){let t=this.editor,n=t.model,r=Array.from(n.document.selection.getRanges());n.change(n=>{n.setSelection(e,`end`),t.execute(`checkTodoList`),n.setSelection(r)})}_initAriaAnnouncements(){let{model:e,ui:t,t:n}=this.editor,r=null;t&&e.document.selection.on(`change:range`,()=>{let i=e.document.selection.focus.parent,a=eH(r),o=eH(i);a&&!o?t.ariaLiveAnnouncer.announce(n(`Leaving a to-do list`)):!a&&o&&t.ariaLiveAnnouncer.announce(n(`Entering a to-do list`)),r=i})}};function $V(e,t){return(n,r)=>{if(Si(r.keyCode,t.contentLanguageDirection)!=`left`)return;let i=e.schema,a=e.document.selection;if(!a.isCollapsed)return;let o=a.getFirstPosition(),s=o.parent;if(s.name===`listItem`&&s.getAttribute(`listType`)==`todo`&&o.isAtStart){let t=i.getNearestSelectionRange(e.createPositionBefore(s),`backward`);t&&e.change(e=>e.setSelection(t)),r.preventDefault(),r.stopPropagation(),n.stop()}}}function eH(e){return!!e&&e.is(`element`,`listItem`)&&e.getAttribute(`listType`)===`todo`}var tH=class extends F{static get requires(){return[QV,PB]}static get pluginName(){return`LegacyTodoList`}static get isOfficialPlugin(){return!0}},nH=class extends F{static get pluginName(){return`AdjacentListsSupport`}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.model.schema.register(`listSeparator`,{allowWhere:`$block`,isBlock:!0}),e.conversion.for(`upcast`).add(e=>{e.on(`element:ol`,rH()),e.on(`element:ul`,rH())}).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)=>{let n=t.writer.createContainerElement(`ck-list-separator`);return t.writer.setCustomProperty(`dataPipeline:transparentRendering`,!0,n),n.getFillerOffset=()=>null,n}})}};function rH(){return(e,t,n)=>{let r=t.viewItem,i=r.nextSibling;if(!i||r.name!==i.name)return;t.modelRange||Object.assign(t,n.convertChildren(t.viewItem,t.modelCursor));let a=n.writer,o=a.createElement(`listSeparator`);if(!n.safeInsert(o,t.modelCursor))return;let s=n.getSplitParts(o);t.modelRange=a.createRange(t.modelRange.start,a.createPositionAfter(s[s.length-1])),n.updateConversionResult(o,t)}}var iH=class extends I{_indentBehavior;constructor(e,t){super(e),this._indentBehavior=t}refresh(){let e=this._getFirstListItemIfSelectionIsAtListStart(this.editor.model.document.selection);this.isEnabled=!!e&&this._indentBehavior.checkEnabled(e.getAttribute(`blockIndentList`))}execute(e={}){let t=this.editor,n=t.model,r=n.document.selection,i=t.plugins.get(`ListUtils`);n.change(t=>{let a=this._getFirstListItemIfSelectionIsAtListStart(r),o=[];if(e.firstListOnly)o.push(a);else{let e=Array.from(r.getSelectedBlocks());for(let t of e)G(t)&&t.getAttribute(`listIndent`)===0&&n.schema.checkAttribute(t,`blockIndentList`)&&o.push(t)}let s=i.expandListBlocksToCompleteList(o);for(let e of s){let n=e.getAttribute(`blockIndentList`),r=this._indentBehavior.getNextIndent(n);r?t.setAttribute(`blockIndentList`,r,e):t.removeAttribute(`blockIndentList`,e)}})}_getFirstListItemIfSelectionIsAtListStart(e){let t=e.getFirstPosition(),n=this.editor.plugins.get(`ListUtils`),r=t.parent,i=this.editor.model.schema;return t.isAtStart&&G(r)&&r.getAttribute(`listIndent`)==0&&i.checkAttribute(r,`blockIndentList`)&&n.isFirstListItemInList(r)?r:null}},aH=class extends I{_indentBehavior;constructor(e,t){super(e),this._indentBehavior=t}refresh(){this.isEnabled=this._getAffectedListItems().length>0}execute(){this.editor.model.change(e=>{for(let t of this._getAffectedListItems())e.removeAttribute(`blockIndentListItem`,t)})}_getAffectedListItems(){let e=this.editor.model.document.selection,t=this.editor.plugins.get(`ListUtils`),n=Array.from(e.getSelectedBlocks());return t.expandListBlocksToCompleteItems(n).filter(e=>this._isIndentationChangeAllowed(e))}_isIndentationChangeAllowed(e){return e.hasAttribute(`blockIndentListItem`)?this._indentBehavior.checkEnabled(e.getAttribute(`blockIndentListItem`)):!1}},oH=class extends CR{checkEnabled(e){let t=parseFloat(e);return this.isForward&&t<0||!this.isForward&&t>0}},sH=class extends wR{checkEnabled(e){return!this.isForward&&!!e}},cH=class extends F{static get pluginName(){return`IndentBlockListIntegration`}static get isOfficialPlugin(){return!0}init(){let e=this.editor;if(!this.editor.plugins.has(`ListEditing`))return;let 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 iH(e,new wR({direction:`forward`,classes:t.classes}))),e.commands.add(`outdentBlockList`,new iH(e,new wR({direction:`backward`,classes:t.classes}))),e.commands.add(`indentBlockListItem`,new aH(e,new sH({direction:`forward`,classes:t.classes}))),e.commands.add(`outdentBlockListItem`,new aH(e,new sH({direction:`backward`,classes:t.classes})))):(e.data.addStyleProcessorRules(Wm),this._setupConversionUsingOffset(`ol`,`blockIndentList`,`list`),this._setupConversionUsingOffset(`ul`,`blockIndentList`,`list`),this._setupConversionUsingOffset(`li`,`blockIndentListItem`,`item`),e.commands.add(`indentBlockList`,new iH(e,new CR({direction:`forward`,offset:t.offset,unit:t.unit}))),e.commands.add(`outdentBlockList`,new iH(e,new CR({direction:`backward`,offset:t.offset,unit:t.unit}))),e.commands.add(`indentBlockListItem`,new aH(e,new oH({direction:`forward`,offset:t.offset,unit:t.unit}))),e.commands.add(`outdentBlockListItem`,new aH(e,new oH({direction:`backward`,offset:t.offset,unit:t.unit})))),e.plugins.get(`ListEditing`).on(`postFixer`,(e,{listNodes:t,writer:n})=>{for(let{node:r,previousNodeInList:i}of t)i&&i.getAttribute(`listType`)==r.getAttribute(`listType`)&&(uH(`blockIndentList`,r,i,n)&&(e.return=!0),i.getAttribute(`listItemId`)==r.getAttribute(`listItemId`)&&uH(`blockIndentListItem`,r,i,n)&&(e.return=!0))}),this.listenTo(e.editing.view.document,`tab`,(t,n)=>{let r=n.shiftKey?`outdentBlockList`:`indentBlockList`;this.editor.commands.get(r).isEnabled&&(e.execute(r,{firstListOnly:!0}),n.stopPropagation(),n.preventDefault(),t.stop())},{context:`li`,priority:`high`})}afterInit(){let e=this.editor,t=e.model,n=t.schema;if(!e.plugins.has(`ListEditing`))return;n.extend(`$listItem`,{allowAttributes:[`blockIndentList`,`blockIndentListItem`]}),n.setAttributeProperties(`blockIndentList`,{isFormatting:!0}),n.setAttributeProperties(`blockIndentListItem`,{isFormatting:!0}),t.schema.addAttributeCheck(e=>{if(!e.last.getAttribute(`listItemId`))return!1},`blockIndentList`),t.schema.addAttributeCheck(e=>{if(!e.last.getAttribute(`listItemId`))return!1},`blockIndentListItem`);let r=(t,n)=>{e.model.change(e=>{for(let t of n)t.hasAttribute(`listItemId`)&&(t.hasAttribute(`blockIndentList`)&&e.removeAttribute(`blockIndentList`,t),t.hasAttribute(`blockIndentListItem`)&&e.removeAttribute(`blockIndentListItem`,t))})},i=e.commands.get(`indentList`),a=e.commands.get(`outdentList`);i&&this.listenTo(i,`afterExecute`,r),a&&this.listenTo(a,`afterExecute`,r);let o=e.commands.get(`indent`),s=e.commands.get(`outdent`);o.registerChildCommand(e.commands.get(`indentBlockList`),{priority:`highest`}),s.registerChildCommand(e.commands.get(`outdentBlockList`)),o.registerChildCommand(e.commands.get(`indentBlockListItem`)),s.registerChildCommand(e.commands.get(`outdentBlockListItem`))}_setupConversionUsingOffset(e,t,n){let r=this.editor,i=r.locale,a=r.conversion,o=i.contentLanguageDirection===`rtl`?`margin-right`:`margin-left`,s=r.plugins.get(`ListEditing`);a.for(`upcast`).add(n=>{n.on(`element:${e}`,lH(t,e=>e.getStyle(o),(e,t)=>e.consume(t,{styles:o})),{priority:`low`})}),s.registerDowncastStrategy({scope:n,attributeName:t,setAttributeOnDowncast(e,t,n){t&&e.setStyle(o,t,n)}})}_setupConversionUsingClasses(e,t,n,r){let i=this.editor,a=i.conversion,o=i.plugins.get(`ListEditing`);a.for(`upcast`).add(r=>{r.on(`element:${t}`,lH(n,t=>e.find(e=>t.hasClass(e)),(e,t,n)=>e.consume(t,{classes:n})),{priority:`low`})}),o.registerDowncastStrategy({scope:r,attributeName:n,setAttributeOnDowncast(e,t,n){t&&e.addClass(t,n)}})}};function lH(e,t,n){return(r,i,a)=>{let{writer:o,consumable:s}=a;i.modelRange||Object.assign(i,a.convertChildren(i.viewItem,i.modelCursor));let c=t(i.viewItem);if(c===void 0)return;let l=!1,u;for(let t of i.modelRange.getItems({shallow:!0}))u===void 0&&(u=t.getAttribute(`listIndent`)),!t.hasAttribute(e)&&t.getAttribute(`listIndent`)===u&&(o.setAttribute(e,c,t),l=!0);l&&n(s,i.viewItem,c)}}function uH(e,t,n,r){let i=n.getAttribute(e);return t.getAttribute(e)===i?!1:(i?r.setAttribute(e,i,t):r.removeAttribute(e,t),!0)}const dH=[`paragraph`,`heading1`,`heading2`,`heading3`,`heading4`,`heading5`,`heading6`];var fH=class extends F{constructor(e){super(e),e.config.define(`indentBlock`,{offset:40,unit:`px`})}static get pluginName(){return`IndentBlock`}static get isOfficialPlugin(){return!0}static get requires(){return[cH]}init(){let 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 wR({direction:`forward`,classes:t.classes}))),e.commands.add(`outdentBlock`,new SR(e,new wR({direction:`backward`,classes:t.classes})))):(e.data.addStyleProcessorRules(Wm),this._setupConversionUsingOffset(),e.commands.add(`indentBlock`,new SR(e,new CR({direction:`forward`,offset:t.offset,unit:t.unit}))),e.commands.add(`outdentBlock`,new SR(e,new CR({direction:`backward`,offset:t.offset,unit:t.unit}))))}afterInit(){let e=this.editor,t=e.model.schema,n=e.commands.get(`indent`),r=e.commands.get(`outdent`),i=e.config.get(`heading.options`);(i&&i.map(e=>e.model)||dH).forEach(e=>{t.isRegistered(e)&&t.extend(e,{allowAttributes:`blockIndent`})}),t.setAttributeProperties(`blockIndent`,{isFormatting:!0}),n.registerChildCommand(e.commands.get(`indentBlock`)),r.registerChildCommand(e.commands.get(`outdentBlock`))}_setupConversionUsingOffset(){let e=this.editor.conversion,t=this.editor.locale.contentLanguageDirection===`rtl`?`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){let t={model:{key:`blockIndent`,values:[]},view:{}};for(let n of e)t.model.values.push(n),t.view[n]={key:`class`,value:[n]};this.editor.conversion.attributeToAttribute(t)}};function pH(e,t){return t||=Ti(e),`${e}:${t}`}function mH(e){let[t,n]=e.split(`:`);return{languageCode:t,textDirection:n}}var hH=class extends I{refresh(){let e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,`language`)}execute({languageCode:e,textDirection:t}={}){let n=this.editor.model,r=n.document.selection,i=e?pH(e,t):!1;n.change(e=>{if(r.isCollapsed)i?e.setSelectionAttribute(`language`,i):e.removeSelectionAttribute(`language`);else{let t=n.schema.getValidRanges(r.getRanges(),`language`,{includeEmptyRanges:!0});for(let n of t){let t=n,r=`language`;n.isCollapsed&&(t=n.start.parent,r=Tl._getStoreAttributeKey(`language`)),i?e.setAttribute(r,i,t):e.removeAttribute(r,t)}}})}_getValueFromFirstAllowedNode(){let e=this.editor.model,t=e.schema,n=e.document.selection;if(n.isCollapsed)return n.getAttribute(`language`)||!1;for(let e of n.getRanges())for(let n of e.getItems())if(t.checkAttribute(n,`language`))return n.getAttribute(`language`)||!1;return!1}},gH=class extends F{static get pluginName(){return`TextPartLanguageEditing`}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(`language`,{textPartLanguage:[{title:`Arabic`,languageCode:`ar`},{title:`French`,languageCode:`fr`},{title:`Spanish`,languageCode:`es`}]})}init(){let e=this.editor;e.model.schema.extend(`$text`,{allowAttributes:`language`}),e.model.schema.setAttributeProperties(`language`,{copyOnEnter:!0}),this._defineConverters(),e.commands.add(`textPartLanguage`,new hH(e))}_defineConverters(){let e=this.editor.conversion;e.for(`upcast`).elementToAttribute({model:{key:`language`,value:e=>pH(e.getAttribute(`lang`),e.getAttribute(`dir`))},view:{name:`span`,attributes:{lang:/[\s\S]+/}}}),e.for(`downcast`).attributeToElement({model:`language`,view:(e,{writer:t},n)=>{if(!e||!n.item.is(`$textProxy`)&&!n.item.is(`documentSelection`))return;let{languageCode:r,textDirection:i}=mH(e);return t.createAttributeElement(`span`,{lang:r,dir:i})}})}},_H=class extends F{static get pluginName(){return`TextPartLanguageUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.t,n=t(`Choose language`),r=t(`Language`);e.ui.componentFactory.add(`textPartLanguage`,t=>{let{definitions:i,titles:a}=this._getItemMetadata(),o=e.commands.get(`textPartLanguage`),s=Nx(t);return Lx(s,i,{ariaLabel:r,role:`menu`}),s.buttonView.set({ariaLabel:r,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:r}),s.extendTemplate({attributes:{class:[`ck-text-fragment-language-dropdown`]}}),s.bind(`isEnabled`).to(o,`isEnabled`),s.buttonView.bind(`label`).to(o,`value`,e=>e&&a[e]||n),s.buttonView.bind(`ariaLabel`).to(o,`value`,e=>{let t=e&&a[e];return t?`${t}, ${r}`:r}),this.listenTo(s,`execute`,t=>{o.execute({languageCode:t.source.languageCode,textDirection:t.source.textDirection}),e.editing.view.focus()}),s}),e.ui.componentFactory.add(`menuBar:textPartLanguage`,n=>{let{definitions:i}=this._getItemMetadata(),a=e.commands.get(`textPartLanguage`),o=new uw(n);o.buttonView.set({label:r});let s=new dw(n);s.set({ariaLabel:t(`Language`),role:`menu`});for(let e of i){if(e.type!=`button`){s.items.add(new fx(n));continue}let t=new rC(n,o),r=new U(n);r.set({role:`menuitemradio`,isToggleable:!0}),r.bind(...Object.keys(e.model)).to(e.model),r.delegate(`execute`).to(o),t.children.add(r),s.items.add(t)}return o.bind(`isEnabled`).to(a,`isEnabled`),o.panelView.children.add(s),o.on(`execute`,t=>{a.execute({languageCode:t.source.languageCode,textDirection:t.source.textDirection}),e.editing.view.focus()}),o})}_getItemMetadata(){let e=this.editor,t=new Fi,n={},r=e.commands.get(`textPartLanguage`),i=e.config.get(`language.textPartLanguage`),a=e.locale.t,o=a(`Remove language`);t.add({type:`button`,model:new RC({label:o,languageCode:!1,withText:!0})}),t.add({type:`separator`});for(let e of i){let i={type:`button`,model:new RC({label:e.title,languageCode:e.languageCode,role:`menuitemradio`,textDirection:e.textDirection,withText:!0})},a=pH(e.languageCode,e.textDirection);i.model.bind(`isOn`).to(r,`value`,e=>e===a),t.add(i),n[a]=e.title}return{definitions:t,titles:n}}},vH=class extends F{static get requires(){return[gH,_H]}static get pluginName(){return`TextPartLanguage`}static get isOfficialPlugin(){return!0}};function yH(e){if(e)throw e}var bH=o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function xH(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function SH(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?CH(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function CH(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}function wH(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?EH(e.position):`start`in e||`end`in e?EH(e):`line`in e||`column`in e?TH(e):``}function TH(e){return DH(e&&e.line)+`:`+DH(e&&e.column)}function EH(e){return TH(e&&e.start)+`-`+TH(e&&e.end)}function DH(e){return e&&typeof e==`number`?e:1}var OH=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=wH(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};OH.prototype.file=``,OH.prototype.name=``,OH.prototype.reason=``,OH.prototype.message=``,OH.prototype.stack=``,OH.prototype.column=void 0,OH.prototype.line=void 0,OH.prototype.ancestors=void 0,OH.prototype.cause=void 0,OH.prototype.fatal=void 0,OH.prototype.place=void 0,OH.prototype.ruleId=void 0,OH.prototype.source=void 0;const kH={basename:AH,dirname:jH,extname:MH,join:NH,sep:`/`};function AH(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);IH(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function jH(e){if(IH(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function MH(e){IH(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function NH(...e){let t=-1,n;for(;++t<e.length;)IH(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:PH(n)}function PH(e){IH(e);let t=e.codePointAt(0)===47,n=FH(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function FH(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function IH(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}const LH={cwd:RH};function RH(){return`/`}function zH(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function BH(e){if(typeof e==`string`)e=new URL(e);else if(!zH(e)){let t=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(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return VH(e)}function VH(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}const HH=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`];var UH=class{constructor(e){let t;t=e?zH(e)?{path:e}:typeof e==`string`||qH(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:LH.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<HH.length;){let e=HH[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)HH.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?kH.basename(this.path):void 0}set basename(e){GH(e,`basename`),WH(e,`basename`),this.path=kH.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?kH.dirname(this.path):void 0}set dirname(e){KH(this.basename,`dirname`),this.path=kH.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?kH.extname(this.path):void 0}set extname(e){if(WH(e,`extname`),KH(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=kH.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){zH(e)&&(e=BH(e)),GH(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?kH.basename(this.path,this.extname):void 0}set stem(e){GH(e,`stem`),WH(e,`stem`),this.path=kH.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new OH(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function WH(e,t){if(e&&e.includes(kH.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+kH.sep+"`")}function GH(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function KH(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function qH(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}const JH=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r});var YH=l(bH(),1);const XH={}.hasOwnProperty,ZH=new class e extends JH{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=SH()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,YH.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(eU(`data`,this.frozen),this.namespace[e]=t,this):XH.call(this.namespace,e)&&this.namespace[e]||void 0:e?(eU(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=rU(e),n=this.parser||this.Parser;return QH(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),QH(`process`,this.parser||this.Parser),$H(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=rU(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);aU(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),QH(`processSync`,this.parser||this.Parser),$H(`processSync`,this.compiler||this.Compiler),this.process(e,r),nU(`processSync`,`process`,t),n;function r(e,r){t=!0,yH(e),n=r}}run(e,t,n){tU(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=rU(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),nU(`runSync`,`run`,n),r;function i(e,t){yH(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=rU(t),r=this.compiler||this.Compiler;return $H(`stringify`,r),tU(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(eU(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw 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");o(e.plugins),e.settings&&(r.settings=(0,YH.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];xH(o)&&xH(r)&&(r=(0,YH.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function QH(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function $H(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function eU(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function tU(e){if(!xH(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function nU(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function rU(e){return iU(e)?e:new UH(e)}function iU(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function aU(e){return typeof e==`string`||oU(e)}function oU(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}function sU(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}const cU=vU(/[A-Za-z]/),lU=vU(/[\dA-Za-z]/),uU=vU(/[#-'*+\--9=?A-Z^-~]/);function dU(e){return e!==null&&(e<32||e===127)}const fU=vU(/\d/),pU=vU(/[\dA-Fa-f]/),mU=vU(/[!-/:-@[-`{-~]/);function K(e){return e!==null&&e<-2}function hU(e){return e!==null&&(e<0||e===32)}function q(e){return e===-2||e===-1||e===32}const gU=vU(/\p{P}|\p{S}/u),_U=vU(/\s/);function vU(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function yU(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}const bU=(function(e){if(e==null)return TU;if(typeof e==`function`)return wU(e);if(typeof e==`object`)return Array.isArray(e)?xU(e):SU(e);if(typeof e==`string`)return CU(e);throw Error(`Expected function, string, or object as test`)});function xU(e){let t=[],n=-1;for(;++n<e.length;)t[n]=bU(e[n]);return wU(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function SU(e){let t=e;return wU(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function CU(e){return wU(t);function t(t){return t&&t.type===e}}function wU(e){return t;function t(t,n,r){return!!(EU(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function TU(){return!0}function EU(e){return typeof e==`object`&&!!e&&`type`in e}function DU(e){return e}const OU=[];function kU(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=bU(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+DU(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=OU,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=AU(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function AU(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?OU:[e]}function jU(e,t,n){let r=bU((n||{}).ignore||[]),i=MU(t),a=-1;for(;++a<i.length;)kU(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function MU(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([NU(e[0]),PU(e[1])])}return t}function NU(e){return typeof e==`string`?new RegExp(yU(e),`g`):e}function PU(e){return typeof e==`function`?e:function(){return e}}const FU=`phrasing`,IU=[`autolink`,`link`,`image`,`label`];function LU(){return{transforms:[GU],enter:{literalAutolink:zU,literalAutolinkEmail:BU,literalAutolinkHttp:BU,literalAutolinkWww:BU},exit:{literalAutolink:WU,literalAutolinkEmail:UU,literalAutolinkHttp:VU,literalAutolinkWww:HU}}}function RU(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:FU,notInConstruct:IU},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:FU,notInConstruct:IU},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:FU,notInConstruct:IU}]}}function zU(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function BU(e){this.config.enter.autolinkProtocol.call(this,e)}function VU(e){this.config.exit.autolinkProtocol.call(this,e)}function HU(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function UU(e){this.config.exit.autolinkEmail.call(this,e)}function WU(e){this.exit(e)}function GU(e){jU(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,KU],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,qU]],{ignore:[`link`,`linkReference`]})}function KU(e,t,n,r,i){let a=``;if(!XU(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!JU(n)))return!1;let o=YU(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function qU(e,t,n,r){return!XU(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function JU(e){let t=e.split(`.`);return!(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])))}function YU(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=sU(e,`(`),a=sU(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function XU(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||_U(n)||gU(n))&&(!t||n!==47)}function ZU(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}sW.peek=oW;function QU(){this.buffer()}function $U(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function eW(){this.buffer()}function tW(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function nW(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ZU(this.sliceSerialize(e)).toLowerCase(),n.label=t}function rW(e){this.exit(e)}function iW(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ZU(this.sliceSerialize(e)).toLowerCase(),n.label=t}function aW(e){this.exit(e)}function oW(){return`[`}function sW(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function cW(){return{enter:{gfmFootnoteCallString:QU,gfmFootnoteCall:$U,gfmFootnoteDefinitionLabelString:eW,gfmFootnoteDefinition:tW},exit:{gfmFootnoteCallString:nW,gfmFootnoteCall:rW,gfmFootnoteDefinitionLabelString:iW,gfmFootnoteDefinition:aW}}}function lW(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:sW},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?dW:uW))),s(),o}}function uW(e,t,n){return t===0?e:dW(e,t,n)}function dW(e,t,n){return(n?``:` `)+e}const fW=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];_W.peek=vW;function pW(){return{canContainEols:[`delete`],enter:{strikethrough:hW},exit:{strikethrough:gW}}}function mW(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:fW}],handlers:{delete:_W}}}function hW(e){this.enter({type:`delete`,children:[]},e)}function gW(e){this.exit(e)}function _W(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function vW(){return`~`}function yW(e){return e.length}function bW(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||yW,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=xW(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=SW(r[d]);else{let e=SW(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&!(n.alignDelimiters===!1&&i===``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
`)}function xW(e){return e==null?``:String(e)}function SW(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}const CW={}.hasOwnProperty;function wW(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&CW.call(t,e)){let n=String(t[e]);i=CW.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const TW={}.hasOwnProperty;function EW(e,t){let n=-1,r;if(t.extensions)for(;++n<t.extensions.length;)EW(e,t.extensions[n]);for(r in t)if(TW.call(t,r))switch(r){case`extensions`:break;case`unsafe`:DW(e[r],t[r]);break;case`join`:DW(e[r],t[r]);break;case`handlers`:OW(e[r],t[r]);break;default:e.options[r]=t[r]}return e}function DW(e,t){t&&e.push(...t)}function OW(e,t){t&&Object.assign(e,t)}function kW(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),AW);return i(),o}function AW(e,t,n){return`>`+(n?``:` `)+e}function jW(e,t){return MW(e,t.inConstruct,!0)&&!MW(e,t.notInConstruct,!1)}function MW(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function NW(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
`&&jW(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
`}function PW(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function FW(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function IW(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function LW(e,t,n,r){let i=IW(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(FW(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,RW);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(PW(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
`,encode:["`"],...s.current()})),t()}return u+=s.move(`
`),a&&(u+=s.move(a+`
`)),u+=s.move(c),l(),u}function RW(e,t,n){return(n?``:` `)+e}function zW(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function BW(e,t,n,r){let i=zW(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function VW(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function HW(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function UW(e){if(e===null||hU(e)||_U(e))return 1;if(gU(e))return 2}function WW(e,t,n){let r=UW(e),i=UW(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}GW.peek=KW;function GW(e,t,n,r){let i=VW(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=WW(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=HW(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=WW(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+HW(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function KW(e,t,n){return n.options.emphasis||`*`}function qW(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),kU(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}const JW={};function YW(e,t){let n=t||JW;return XW(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function XW(e,t,n){if(QW(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return ZW(e.children,t,n)}return Array.isArray(e)?ZW(e,t,n):``}function ZW(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=XW(e[i],t,n);return r.join(``)}function QW(e){return!!(e&&typeof e==`object`)}function $W(e,t){let n=!1;return qW(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&YW(e)&&(t.options.setext||n))}function eG(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if($W(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
`,after:`
`});return r(),t(),o+`
`+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
`))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
`,...a.current()});return/^[\t ]/.test(l)&&(l=HW(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}tG.peek=nG;function tG(e){return e.value||``}function nG(){return`<`}rG.peek=iG;function rG(e,t,n,r){let i=zW(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function iG(){return`!`}aG.peek=oG;function aG(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function oG(){return`!`}sG.peek=cG;function sG(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function cG(){return"`"}function lG(e,t){let n=YW(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type===`text`&&(n===e.url||`mailto:`+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}uG.peek=dG;function uG(e,t,n,r){let i=zW(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(lG(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function dG(e,t,n){return lG(e,n)?`<`:`[`}fG.peek=pG;function fG(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function pG(){return`[`}function mG(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function hG(e){let t=mG(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function gG(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function _G(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function vG(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?gG(n):mG(n),s=e.ordered?o===`.`?`)`:`.`:hG(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),_G(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function yG(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function bG(e,t,n,r){let i=yG(n),a=n.bulletCurrent||mG(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function xG(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}const SG=bU([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function CG(e,t,n,r){return(e.children.some(function(e){return SG(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function wG(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}TG.peek=EG;function TG(e,t,n,r){let i=wG(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=WW(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=HW(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=WW(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+HW(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function EG(e,t,n){return n.options.strong||`*`}function DG(e,t,n,r){return n.safe(e.value,r)}function OG(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function kG(e,t,n){let r=(_G(n)+(n.options.ruleSpaces?` `:``)).repeat(OG(n));return n.options.ruleSpaces?r.slice(0,-1):r}const AG={blockquote:kW,break:NW,code:LW,definition:BW,emphasis:GW,hardBreak:NW,heading:eG,html:tG,image:rG,imageReference:aG,inlineCode:sG,link:uG,linkReference:fG,list:vG,listItem:bG,paragraph:xG,root:CG,strong:TG,text:DG,thematicBreak:kG},jG=[MG];function MG(e,t,n,r){if(t.type===`code`&&FW(t,r)&&(e.type===`list`||e.type===t.type&&FW(e,r)))return!1;if(`spread`in n&&typeof n.spread==`boolean`)return e.type===`paragraph`&&(e.type===t.type||t.type===`definition`||t.type===`heading`&&$W(t,r))?void 0:+!!n.spread}const NG=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`],PG=[{character:` `,after:`[\\r\\n]`,inConstruct:`phrasing`},{character:` `,before:`[\\r\\n]`,inConstruct:`phrasing`},{character:` `,inConstruct:[`codeFencedLangGraveAccent`,`codeFencedLangTilde`]},{character:`\r`,inConstruct:[`codeFencedLangGraveAccent`,`codeFencedLangTilde`,`codeFencedMetaGraveAccent`,`codeFencedMetaTilde`,`destinationLiteral`,`headingAtx`]},{character:`
`,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:NG},{character:`"`,inConstruct:`titleQuote`},{atBreak:!0,character:`#`},{character:`#`,inConstruct:`headingAtx`,after:`(?:[\r
]|$)`},{character:`&`,after:`[#A-Za-z]`,inConstruct:`phrasing`},{character:`'`,inConstruct:`titleApostrophe`},{character:`(`,inConstruct:`destinationRaw`},{before:`\\]`,character:`(`,inConstruct:`phrasing`,notInConstruct:NG},{atBreak:!0,before:`\\d+`,character:`)`},{character:`)`,inConstruct:`destinationRaw`},{atBreak:!0,character:`*`,after:`(?:[ \r
*])`},{character:`*`,inConstruct:`phrasing`,notInConstruct:NG},{atBreak:!0,character:`+`,after:`(?:[ \r
])`},{atBreak:!0,character:`-`,after:`(?:[ \r
-])`},{atBreak:!0,before:`\\d+`,character:`.`,after:`(?:[ \r
]|$)`},{atBreak:!0,character:`<`,after:`[!/?A-Za-z]`},{character:`<`,after:`[!/?A-Za-z]`,inConstruct:`phrasing`,notInConstruct:NG},{character:`<`,inConstruct:`destinationLiteral`},{atBreak:!0,character:`=`},{atBreak:!0,character:`>`},{character:`>`,inConstruct:`destinationLiteral`},{atBreak:!0,character:`[`},{character:`[`,inConstruct:`phrasing`,notInConstruct:NG},{character:`[`,inConstruct:[`label`,`reference`]},{character:`\\`,after:`[\\r\\n]`,inConstruct:`phrasing`},{character:`]`,inConstruct:[`label`,`reference`]},{atBreak:!0,character:`_`},{character:`_`,inConstruct:`phrasing`,notInConstruct:NG},{atBreak:!0,character:"`"},{character:"`",inConstruct:[`codeFencedLangGraveAccent`,`codeFencedMetaGraveAccent`]},{character:"`",inConstruct:`phrasing`,notInConstruct:NG},{atBreak:!0,character:`~`}],FG=document.createElement(`i`);function IG(e){let t=`&`+e+`;`;FG.innerHTML=t;let n=FG.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function LG(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?``:String.fromCodePoint(n)}const RG=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function zG(e){return e.replace(RG,BG)}function BG(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return LG(n.slice(t?2:1),t?16:10)}return IG(n)||e}function VG(e){return e.label||!e.identifier?e.label||``:zG(e.identifier)}function HG(e){if(!e._compiled){let t=(e.atBreak?`[\\r\\n][\\t ]*`:``)+(e.before?`(?:`+e.before+`)`:``);e._compiled=RegExp((t?`(`+t+`)`:``)+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?`\\`:``)+e.character+(e.after?`(?:`+e.after+`)`:``),`g`)}return e._compiled}function UG(e,t,n){let r=t.indexStack,i=e.children||[],a=[],o=-1,s=n.before,c;r.push(-1);let l=t.createTracker(n);for(;++o<i.length;){let u=i[o],d;if(r[r.length-1]=o,o+1<i.length){let n=t.handle.handlers[i[o+1].type];n&&n.peek&&(n=n.peek),d=n?n(i[o+1],e,t,{before:``,after:``,...l.current()}).charAt(0):``}else d=n.after;a.length>0&&(s===`\r`||s===`
`)&&u.type===`html`&&(a[a.length-1]=a[a.length-1].replace(/(\r?\n|\r)$/,` `),s=` `,l=t.createTracker(n),l.move(a.join(``)));let f=t.handle(u,e,t,{...l.current(),after:d,before:s});c&&c===f.slice(0,1)&&(f=HW(c.charCodeAt(0))+f.slice(1));let p=t.attentionEncodeSurroundingInfo;t.attentionEncodeSurroundingInfo=void 0,c=void 0,p&&(a.length>0&&p.before&&s===a[a.length-1].slice(-1)&&(a[a.length-1]=a[a.length-1].slice(0,-1)+HW(s.charCodeAt(0))),p.after&&(c=d)),l.move(f),a.push(f),s=f.slice(-1)}return r.pop(),a.join(``)}function WG(e,t,n){let r=t.indexStack,i=e.children||[],a=t.createTracker(n),o=[],s=-1;for(r.push(-1);++s<i.length;){let n=i[s];r[r.length-1]=s,o.push(a.move(t.handle(n,e,t,{before:`
`,after:`
`,...a.current()}))),n.type!==`list`&&(t.bulletLastUsed=void 0),s<i.length-1&&o.push(a.move(GG(n,i[s+1],e,t)))}return r.pop(),o.join(``)}function GG(e,t,n,r){let i=r.join.length;for(;i--;){let a=r.join[i](e,t,n,r);if(a===!0||a===1)break;if(typeof a==`number`)return`
`.repeat(1+a);if(a===!1)return`
<!---->
`}return`
`}const KG=/\r?\n|\r/g;function qG(e,t){let n=[],r=0,i=0,a;for(;a=KG.exec(e);)o(e.slice(r,a.index)),n.push(a[0]),r=a.index+a[0].length,i++;return o(e.slice(r)),n.join(``);function o(e){n.push(t(e,i,!e))}}function JG(e,t,n){let r=(n.before||``)+(t||``)+(n.after||``),i=[],a=[],o={},s=-1;for(;++s<e.unsafe.length;){let t=e.unsafe[s];if(!jW(e.stack,t))continue;let n=e.compilePattern(t),a;for(;a=n.exec(r);){let e=`before`in t||!!t.atBreak,n=`after`in t,r=a.index+(e?a[1].length:0);i.includes(r)?(o[r].before&&!e&&(o[r].before=!1),o[r].after&&!n&&(o[r].after=!1)):(i.push(r),o[r]={before:e,after:n})}}i.sort(YG);let c=n.before?n.before.length:0,l=r.length-(n.after?n.after.length:0);for(s=-1;++s<i.length;){let e=i[s];e<c||e>=l||e+1<l&&i[s+1]===e+1&&o[e].after&&!o[e+1].before&&!o[e+1].after||i[s-1]===e-1&&o[e].before&&!o[e-1].before&&!o[e-1].after||(c!==e&&a.push(XG(r.slice(c,e),`\\`)),c=e,/[!-/:-@[-`{-~]/.test(r.charAt(e))&&(!n.encode||!n.encode.includes(r.charAt(e)))?a.push(`\\`):(a.push(HW(r.charCodeAt(e))),c++))}return a.push(XG(r.slice(c,l),n.after)),a.join(``)}function YG(e,t){return e-t}function XG(e,t){let n=/\\(?=[!-/:-@[-`{-~])/g,r=[],i=[],a=e+t,o=-1,s=0,c;for(;c=n.exec(a);)r.push(c.index);for(;++o<r.length;)s!==r[o]&&i.push(e.slice(s,r[o])),i.push(`\\`),s=r[o];return i.push(e.slice(s)),i.join(``)}function ZG(e){let t=e||{},n=t.now||{},r=t.lineShift||0,i=n.line||1,a=n.column||1;return{move:c,current:o,shift:s};function o(){return{now:{line:i,column:a},lineShift:r}}function s(e){r+=e}function c(e){let t=e||``,n=t.split(/\r?\n|\r/g),o=n[n.length-1];return i+=n.length-1,a=n.length===1?a+o.length:1+o.length+r,t}}function QG(e,t){let n=t||{},r={associationId:VG,containerPhrasing:nK,containerFlow:rK,createTracker:ZG,compilePattern:HG,enter:a,handlers:{...AG},handle:void 0,indentLines:qG,indexStack:[],join:[...jG],options:{},safe:iK,stack:[],unsafe:[...PG]};EW(r,n),r.options.tightDefinitions&&r.join.push(tK),r.handle=wW(`type`,{invalid:$G,unknown:eK,handlers:r.handlers});let i=r.handle(e,void 0,r,{before:`
`,after:`
`,now:{line:1,column:1},lineShift:0});return i&&i.charCodeAt(i.length-1)!==10&&i.charCodeAt(i.length-1)!==13&&(i+=`
`),i;function a(e){return r.stack.push(e),t;function t(){r.stack.pop()}}}function $G(e){throw Error("Cannot handle value `"+e+"`, expected node")}function eK(e){throw Error("Cannot handle unknown node `"+e.type+"`")}function tK(e,t){if(e.type===`definition`&&e.type===t.type)return 0}function nK(e,t){return UG(e,this,t)}function rK(e,t){return WG(e,this,t)}function iK(e,t){return JG(this,e,t)}function aK(){return{enter:{table:oK,tableData:uK,tableHeader:uK,tableRow:cK},exit:{codeText:dK,table:sK,tableData:lK,tableHeader:lK,tableRow:lK}}}function oK(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function sK(e){this.exit(e),this.data.inTable=void 0}function cK(e){this.enter({type:`tableRow`,children:[]},e)}function lK(e){this.exit(e)}function uK(e){this.enter({type:`tableCell`,children:[]},e)}function dK(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,fK));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function fK(e,t){return t===`|`?t:e}function pK(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
`,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return bW(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=AG.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function mK(){return{exit:{taskListCheckValueChecked:gK,taskListCheckValueUnchecked:gK,paragraph:_K}}}function hK(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:vK}}}function gK(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function _K(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function vK(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=AG.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function yK(){return[LU(),cW(),pW(),aK(),mK()]}function bK(e){return{extensions:[RU(),lW(e),mW(),pK(e),hK()]}}function xK(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function SK(e,t){return e.length>0?(xK(e,e.length,0,t),e):t}const CK={}.hasOwnProperty;function wK(e){let t={},n=-1;for(;++n<e.length;)TK(t,e[n]);return t}function TK(e,t){let n;for(n in t){let r=(CK.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){CK.call(r,a)||(r[a]=[]);let e=i[a];EK(r[a],Array.isArray(e)?e:e?[e]:[])}}}function EK(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);xK(e,0,0,r)}const DK={tokenize:VK,partial:!0},OK={tokenize:HK,partial:!0},kK={tokenize:UK,partial:!0},AK={tokenize:WK,partial:!0},jK={tokenize:GK,partial:!0},MK={name:`wwwAutolink`,tokenize:zK,previous:KK},NK={name:`protocolAutolink`,tokenize:BK,previous:qK},PK={name:`emailAutolink`,tokenize:RK,previous:JK},FK={};function IK(){return{text:FK}}let LK=48;for(;LK<123;)FK[LK]=PK,LK++,LK===58?LK=65:LK===91&&(LK=97);FK[43]=PK,FK[45]=PK,FK[46]=PK,FK[95]=PK,FK[72]=[PK,NK],FK[104]=[PK,NK],FK[87]=[PK,MK],FK[119]=[PK,MK];function RK(e,t,n){let r=this,i,a;return o;function o(t){return!YK(t)||!JK.call(r,r.previous)||XK(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return YK(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(jK,u,l)(t):t===45||t===95||lU(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&cU(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function zK(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!KK.call(r,r.previous)||XK(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(DK,e.attempt(OK,e.attempt(kK,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function BK(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&qK.call(r,r.previous)&&!XK(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(cU(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||dU(t)||hU(t)||_U(t)||gU(t)?n(t):e.attempt(OK,e.attempt(kK,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function VK(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function HK(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(AK,c,s)(t):t===null||hU(t)||_U(t)||t!==45&&gU(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function UK(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(AK,t,a)(o):o===null||hU(o)||_U(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function WK(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||hU(o)||_U(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||hU(e)||_U(e)?t(e):r(e)}function a(e){return cU(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):cU(t)?(e.consume(t),o):n(t)}}function GK(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return lU(e)?n(e):t(e)}}function KK(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||hU(e)}function qK(e){return!cU(e)}function JK(e){return!(e===47||YK(e))}function YK(e){return e===43||e===45||e===46||e===95||lU(e)}function XK(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function ZK(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&lU(e.charCodeAt(n+1))&&lU(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=``}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function QK(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const $K={name:`attention`,resolveAll:eq,tokenize:tq};function eq(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};nq(d,-c),nq(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=SK(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=SK(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=SK(l,QK(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=SK(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=SK(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,xK(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function tq(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=UW(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=UW(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function nq(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const rq={name:`autolink`,tokenize:iq};function iq(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return cU(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||lU(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||lU(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||dU(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):uU(t)?(e.consume(t),l):n(t)}function u(e){return lU(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||lU(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}function J(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return q(r)?(e.enter(n),s(r)):t(r)}function s(r){return q(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}const aq={partial:!0,tokenize:oq};function oq(e,t,n){return r;function r(t){return q(t)?J(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||K(e)?t(e):n(e)}}const sq={continuation:{tokenize:lq},exit:uq,name:`blockQuote`,tokenize:cq};function cq(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return q(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function lq(e,t,n){let r=this;return i;function i(t){return q(t)?J(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(sq,t,n)(r)}}function uq(e){e.exit(`blockQuote`)}const dq={name:`characterEscape`,tokenize:fq};function fq(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return mU(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}const pq={name:`characterReference`,tokenize:mq};function mq(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=lU,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=pU,u):(e.enter(`characterReferenceValue`),a=7,o=fU,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===lU&&!IG(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}const hq={partial:!0,tokenize:vq},gq={concrete:!0,name:`codeFenced`,tokenize:_q};function _q(e,t,n){let r=this,i={partial:!0,tokenize:b},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),q(t)?J(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||K(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(hq,h,ee)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||K(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):q(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),J(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||K(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||K(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,ee,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&q(t)?J(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||K(t)?e.check(hq,h,ee)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||K(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function ee(n){return e.exit(`codeFenced`),t(n)}function b(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),q(t)?J(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),q(t)?J(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||K(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function vq(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}const yq={name:`codeIndented`,tokenize:xq},bq={partial:!0,tokenize:Sq};function xq(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),J(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):K(t)?e.attempt(bq,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||K(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Sq(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):K(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):J(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):K(e)?i(e):n(e)}}const Cq={name:`codeText`,previous:Tq,resolve:wq,tokenize:Eq};function wq(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Tq(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Eq(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):K(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||K(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var Dq=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw 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){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&Oq(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),Oq(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Oq(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);Oq(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);Oq(this.left,t.reverse())}}};function Oq(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function kq(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Dq(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,Aq(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return xK(e,0,1/0,u.slice(0)),!l}function Aq(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}const jq={resolve:Nq,tokenize:Pq},Mq={partial:!0,tokenize:Fq};function Nq(e){return kq(e),e}function Pq(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):K(t)?e.check(Mq,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function Fq(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),J(e,a,`linePrefix`)}function a(i){if(i===null||K(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Iq(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||dU(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||K(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||hU(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||dU(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Lq(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):K(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||K(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!q(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Rq(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):K(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),J(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||K(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function zq(e,t){let n;return r;function r(i){return K(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):q(i)?J(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}const Bq={name:`definition`,tokenize:Hq},Vq={partial:!0,tokenize:Uq};function Hq(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Lq.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=ZU(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return hU(t)?zq(e,l)(t):l(t)}function l(t){return Iq(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Vq,d,d)(t)}function d(t){return q(t)?J(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||K(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Uq(e,t,n){return r;function r(t){return hU(t)?zq(e,i)(t):n(t)}function i(t){return Rq(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return q(t)?J(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||K(e)?t(e):n(e)}}const Wq={name:`hardBreakEscape`,tokenize:Gq};function Gq(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return K(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}const Kq={name:`headingAtx`,resolve:qq,tokenize:Jq};function qq(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},xK(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Jq(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||hU(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||K(n)?(e.exit(`atxHeading`),t(n)):q(n)?J(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||hU(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}const Yq=`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`.split(`.`),Xq=[`pre`,`script`,`style`,`textarea`],Zq={concrete:!0,name:`htmlFlow`,resolveTo:eJ,tokenize:tJ},Qq={partial:!0,tokenize:rJ},$q={partial:!0,tokenize:nJ};function eJ(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function tJ(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:fe):cU(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):cU(a)?(e.consume(a),i=4,r.interrupt?t:fe):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:fe):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:ie:m):n(i)}function h(t){return cU(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||hU(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Xq.includes(l)?(i=1,r.interrupt?t(s):ie(s)):Yq.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):ie(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||lU(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:ie):n(i)}function v(t){return q(t)?(e.consume(t),v):S(t)}function y(t){return t===47?(e.consume(t),S):t===58||t===95||cU(t)?(e.consume(t),ee):q(t)?(e.consume(t),y):S(t)}function ee(t){return t===45||t===46||t===58||t===95||lU(t)?(e.consume(t),ee):b(t)}function b(t){return t===61?(e.consume(t),x):q(t)?(e.consume(t),b):y(t)}function x(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,te):q(t)?(e.consume(t),x):ne(t)}function te(t){return t===c?(e.consume(t),c=null,re):t===null||K(t)?n(t):(e.consume(t),te)}function ne(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||hU(t)?b(t):(e.consume(t),ne)}function re(e){return e===47||e===62||q(e)?y(e):n(e)}function S(t){return t===62?(e.consume(t),C):n(t)}function C(t){return t===null||K(t)?ie(t):q(t)?(e.consume(t),C):n(t)}function ie(t){return t===45&&i===2?(e.consume(t),ce):t===60&&i===1?(e.consume(t),le):t===62&&i===4?(e.consume(t),pe):t===63&&i===3?(e.consume(t),fe):t===93&&i===5?(e.consume(t),de):K(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Qq,me,ae)(t)):t===null||K(t)?(e.exit(`htmlFlowData`),ae(t)):(e.consume(t),ie)}function ae(t){return e.check($q,oe,me)(t)}function oe(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),se}function se(t){return t===null||K(t)?ae(t):(e.enter(`htmlFlowData`),ie(t))}function ce(t){return t===45?(e.consume(t),fe):ie(t)}function le(t){return t===47?(e.consume(t),o=``,ue):ie(t)}function ue(t){if(t===62){let n=o.toLowerCase();return Xq.includes(n)?(e.consume(t),pe):ie(t)}return cU(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ue):ie(t)}function de(t){return t===93?(e.consume(t),fe):ie(t)}function fe(t){return t===62?(e.consume(t),pe):t===45&&i===2?(e.consume(t),fe):ie(t)}function pe(t){return t===null||K(t)?(e.exit(`htmlFlowData`),me(t)):(e.consume(t),pe)}function me(n){return e.exit(`htmlFlow`),t(n)}}function nJ(e,t,n){let r=this;return i;function i(t){return K(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function rJ(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(aq,t,n)}}const iJ={name:`htmlText`,tokenize:aJ};function aJ(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),b):t===63?(e.consume(t),y):cU(t)?(e.consume(t),ne):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):cU(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):K(t)?(o=d,le(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?ce(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):K(t)?(o=h,le(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?ce(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?ce(t):K(t)?(o=v,le(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),ee):K(t)?(o=y,le(t)):(e.consume(t),y)}function ee(e){return e===62?ce(e):y(e)}function b(t){return cU(t)?(e.consume(t),x):n(t)}function x(t){return t===45||lU(t)?(e.consume(t),x):te(t)}function te(t){return K(t)?(o=te,le(t)):q(t)?(e.consume(t),te):ce(t)}function ne(t){return t===45||lU(t)?(e.consume(t),ne):t===47||t===62||hU(t)?re(t):n(t)}function re(t){return t===47?(e.consume(t),ce):t===58||t===95||cU(t)?(e.consume(t),S):K(t)?(o=re,le(t)):q(t)?(e.consume(t),re):ce(t)}function S(t){return t===45||t===46||t===58||t===95||lU(t)?(e.consume(t),S):C(t)}function C(t){return t===61?(e.consume(t),ie):K(t)?(o=C,le(t)):q(t)?(e.consume(t),C):re(t)}function ie(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,ae):K(t)?(o=ie,le(t)):q(t)?(e.consume(t),ie):(e.consume(t),oe)}function ae(t){return t===i?(e.consume(t),i=void 0,se):t===null?n(t):K(t)?(o=ae,le(t)):(e.consume(t),ae)}function oe(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||hU(t)?re(t):(e.consume(t),oe)}function se(e){return e===47||e===62||hU(e)?re(e):n(e)}function ce(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function le(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ue}function ue(t){return q(t)?J(e,de,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):de(t)}function de(t){return e.enter(`htmlTextData`),o(t)}}const oJ={name:`labelEnd`,resolveAll:uJ,resolveTo:dJ,tokenize:fJ},sJ={tokenize:pJ},cJ={tokenize:mJ},lJ={tokenize:hJ};function uJ(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&xK(e,0,e.length,n),e}function dJ(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=SK(s,e.slice(a+1,a+r+3)),s=SK(s,[[`enter`,u,t]]),s=SK(s,QK(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=SK(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=SK(s,e.slice(o+1)),s=SK(s,[[`exit`,c,t]]),xK(e,a,e.length,s),e}function fJ(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(ZU(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(sJ,u,o?u:d)(t):t===91?e.attempt(cJ,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(lJ,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function pJ(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return hU(t)?zq(e,a)(t):a(t)}function a(t){return t===41?u(t):Iq(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return hU(t)?zq(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Rq(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return hU(t)?zq(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function mJ(e,t,n){let r=this;return i;function i(t){return Lq.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(ZU(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function hJ(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}const gJ={name:`labelStartImage`,resolveAll:oJ.resolveAll,tokenize:_J};function _J(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}const vJ={name:`labelStartLink`,resolveAll:oJ.resolveAll,tokenize:yJ};function yJ(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}const bJ={name:`lineEnding`,tokenize:xJ};function xJ(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),J(e,t,`linePrefix`)}}const SJ={name:`thematicBreak`,tokenize:CJ};function CJ(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||K(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),q(t)?J(e,s,`whitespace`)(t):s(t))}}const wJ={continuation:{tokenize:OJ},exit:AJ,name:`list`,tokenize:DJ},TJ={partial:!0,tokenize:jJ},EJ={partial:!0,tokenize:kJ};function DJ(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:fU(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(SJ,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return fU(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(aq,r.interrupt?n:u,e.attempt(TJ,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return q(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function OJ(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(aq,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,J(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!q(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(EJ,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,J(e,e.attempt(wJ,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function kJ(e,t,n){let r=this;return J(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function AJ(e){e.exit(this.containerState.type)}function jJ(e,t,n){let r=this;return J(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!q(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}const MJ={name:`setextUnderline`,resolveTo:NJ,tokenize:PJ};function NJ(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function PJ(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),q(t)?J(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||K(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}const FJ={tokenize:UJ,partial:!0};function IJ(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:BJ,continuation:{tokenize:VJ},exit:HJ}},text:{91:{name:`gfmFootnoteCall`,tokenize:zJ},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:LJ,resolveTo:RJ}}}}function LJ(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=ZU(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function RJ(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function zJ(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||hU(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(ZU(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return hU(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function BJ(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||hU(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=ZU(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return hU(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),J(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function VJ(e,t,n){return e.check(aq,t,e.attempt(FJ,t,n))}function HJ(e){e.exit(`gfmFootnoteDefinition`)}function UJ(e,t,n){let r=this;return J(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function WJ(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&xK(o,o.length,0,QK(s,e.slice(r+1,n),t)),xK(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),xK(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=UW(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=UW(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var GJ=class{constructor(){this.map=[]}add(e,t,n){KJ(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function KJ(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function qJ(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function JJ(){return{flow:{null:{name:`table`,tokenize:YJ,resolveAll:XJ}}}}function YJ(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?x:c;return a===x&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):K(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):q(t)?J(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||hU(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,q(t)?J(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):b(t)}function h(t){return q(t)?J(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||K(t)?ee(t):b(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):b(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return q(t)?J(e,ee,`whitespace`)(t):ee(t)}function ee(n){return n===124?m(n):n===null||K(n)?!o||i!==a?b(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):b(n)}function b(e){return n(e)}function x(t){return e.enter(`tableRow`),te(t)}function te(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),te):n===null||K(n)?(e.exit(`tableRow`),t(n)):q(n)?J(e,te,`whitespace`)(n):(e.enter(`data`),ne(n))}function ne(t){return t===null||t===124||hU(t)?(e.exit(`data`),te(t)):(e.consume(t),t===92?re:ne)}function re(t){return t===92||t===124?(e.consume(t),ne):ne(t)}}function XJ(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new GJ;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(QJ(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=ZJ(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=ZJ(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=ZJ(f,t,o,i,n,d)):(o[0]=o[1],d=ZJ(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&QJ(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=qJ(t.events,n))}return e}function ZJ(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},$J(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=$J(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=$J(t.events,n[2]),a=$J(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},$J(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function QJ(e,t,n,r,i){let a=[],o=$J(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function $J(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}const eY={name:`tasklistCheck`,tokenize:nY};function tY(){return{text:{91:eY}}}function nY(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return hU(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return K(r)?t(r):q(r)?e.check({tokenize:rY},t,n)(r):n(r)}}function rY(e,t,n){return J(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function iY(e){return wK([IK(),IJ(),WJ(e),JJ(),tY()])}const aY={};function oY(e){let t=this,n=e||aY,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(iY(n)),a.push(yK()),o.push(bK(n))}const sY={tokenize:cY};function cY(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),J(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return K(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}const lY={tokenize:dY},uY={tokenize:fY};function dY(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return xK(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(uY,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(uY,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return K(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;xK(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function fY(e,t,n){return J(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}const pY={tokenize:mY};function mY(e){let t=this,n=e.attempt(aq,r,e.attempt(this.parser.constructs.flowInitial,i,J(e,e.attempt(this.parser.constructs.flow,i,e.attempt(jq,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}const hY={resolveAll:yY()},gY=vY(`string`),_Y=vY(`text`);function vY(e){return{resolveAll:yY(e===`text`?bY:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function yY(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function bY(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var xY=s({attentionMarkers:()=>kY,contentInitial:()=>CY,disable:()=>AY,document:()=>SY,flow:()=>TY,flowInitial:()=>wY,insideSpan:()=>OY,string:()=>EY,text:()=>DY});const SY={42:wJ,43:wJ,45:wJ,48:wJ,49:wJ,50:wJ,51:wJ,52:wJ,53:wJ,54:wJ,55:wJ,56:wJ,57:wJ,62:sq},CY={91:Bq},wY={[-2]:yq,[-1]:yq,32:yq},TY={35:Kq,42:SJ,45:[MJ,SJ],60:Zq,61:MJ,95:SJ,96:gq,126:gq},EY={38:pq,92:dq},DY={[-5]:bJ,[-4]:bJ,[-3]:bJ,33:gJ,38:pq,42:$K,60:[rq,iJ],91:vJ,92:[Wq,dq],93:oJ,95:$K,96:Cq},OY={null:[$K,hY]},kY={null:[42,95]},AY={null:[]};function jY(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:te(b),check:te(x),consume:v,enter:y,exit:ee,interrupt:te(x,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=SK(o,e),g(),o[o.length-1]===null?(ne(t,0),l.events=QK(a,l.events,l),l.events):[]}function f(e,t){return NY(p(e),t)}function p(e){return MY(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,S()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){K(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,S()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function ee(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function b(e,t){ne(e,t.from)}function x(e,t){t.restore()}function te(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=re(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function ne(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&xK(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function re(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,S()}}function S(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function MY(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function NY(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
`;break;case-3:o=`\r
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function PY(e){let t={constructs:wK([xY,...(e||{}).extensions||[]]),content:n(sY),defined:[],document:n(lY),flow:n(pY),lazy:{},string:n(gY),text:n(_Y)};return t;function n(e){return n;function n(n){return jY(t,e,n)}}}function FY(e){for(;!kq(e););return e}const IY=/[\0\t\n\r]/g;function LY(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(IY.lastIndex=u,c=IY.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}const RY={}.hasOwnProperty;function zY(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),BY(n)(FY(PY(n).document().write(LY()(e,t,!0))))}function BY(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(E),autolinkProtocol:re,autolinkEmail:re,atxHeading:a(Te),blockQuote:a(be),characterEscape:re,characterReference:re,codeFenced:a(xe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(xe,o),codeText:a(Se,o),codeTextData:re,data:re,codeFlowValue:re,definition:a(Ce),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(we),hardBreakEscape:a(Ee),hardBreakTrailing:a(Ee),htmlFlow:a(De,o),htmlFlowData:re,htmlText:a(De,o),htmlTextData:re,image:a(Oe),label:o,link:a(E),listItem:a(Ae),listItemValue:f,listOrdered:a(ke,d),listUnordered:a(ke),paragraph:a(je),reference:he,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(Te),strong:a(Me),thematicBreak:a(Pe)},exit:{atxHeading:c(),atxHeadingSequence:b,autolink:c(),autolinkEmail:ye,autolinkProtocol:T,blockQuote:c(),characterEscapeValue:S,characterReferenceMarkerHexadecimal:_e,characterReferenceMarkerNumeric:_e,characterReferenceValue:ve,characterReference:w,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:S,codeIndented:c(_),codeText:c(se),codeTextData:S,data:S,definition:c(),definitionDestinationString:ee,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(ie),hardBreakTrailing:c(ie),htmlFlow:c(ae),htmlFlowData:S,htmlText:c(oe),htmlTextData:S,image:c(le),label:de,labelText:ue,lineEnding:C,link:c(ce),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ge,resourceDestinationString:fe,resourceTitleString:pe,resource:me,setextHeading:c(ne),setextHeadingLineSequence:te,setextHeadingText:x,strong:c(),thematicBreak:c()}};HY(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];RY.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||WY).call(a,void 0,e[0])}for(r.position={start:VY(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:VY(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:VY(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||WY).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+wH({start:e.start,end:e.end})+`): its not open`);n.position.end=VY(e.end)}function u(){return YW(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=ZU(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function b(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function x(){this.data.setextHeadingSlurpLineEnding=!0}function te(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function ne(){this.data.setextHeadingSlurpLineEnding=void 0}function re(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=Ne(),n.position={start:VY(e.start),end:void 0},t.push(n)),this.stack.push(n)}function S(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=VY(e.end)}function C(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=VY(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(re.call(this,e),S.call(this,e))}function ie(){this.data.atHardBreak=!0}function ae(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function oe(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function se(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ce(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let 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 le(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let 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 ue(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=zG(t),n.identifier=ZU(t).toLowerCase()}function de(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function fe(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function pe(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function me(){this.data.inReference=void 0}function he(){this.data.referenceType=`collapsed`}function ge(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=ZU(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function _e(e){this.data.characterReferenceType=e.type}function ve(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=LG(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=IG(t);let i=this.stack[this.stack.length-1];i.value+=r}function w(e){let t=this.stack.pop();t.position.end=VY(e.end)}function T(e){S.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function ye(e){S.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function be(){return{type:`blockquote`,children:[]}}function xe(){return{type:`code`,lang:null,meta:null,value:``}}function Se(){return{type:`inlineCode`,value:``}}function Ce(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function we(){return{type:`emphasis`,children:[]}}function Te(){return{type:`heading`,depth:0,children:[]}}function Ee(){return{type:`break`}}function De(){return{type:`html`,value:``}}function Oe(){return{type:`image`,title:null,url:``,alt:null}}function E(){return{type:`link`,title:null,url:``,children:[]}}function ke(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function Ae(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function je(){return{type:`paragraph`,children:[]}}function Me(){return{type:`strong`,children:[]}}function Ne(){return{type:`text`,value:``}}function Pe(){return{type:`thematicBreak`}}}function VY(e){return{line:e.line,column:e.column,offset:e.offset}}function HY(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?HY(e,r):UY(e,r)}}function UY(e,t){let n;for(n in t)if(RY.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function WY(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+wH({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+wH({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+wH({start:t.start,end:t.end})+`) is still open`)}function GY(e){let t=this;t.parser=n;function n(n){return zY(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}const KY=typeof self==`object`?self:globalThis,qY=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new KY[e](t)},JY=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(qY(e,t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(qY(a,o),i)};return r},YY=e=>JY(new Map,e)(0),{toString:XY}={},{keys:ZY}=Object,QY=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=XY.call(e).slice(8,-1);switch(n){case`Array`:return[1,``];case`Object`:return[2,``];case`Date`:return[3,``];case`RegExp`:return[4,``];case`Map`:return[5,``];case`Set`:return[6,``];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},$Y=([e,t])=>e===0&&(t===`function`||t===`symbol`),eX=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=QY(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of ZY(r))(e||!$Y(QY(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!($Y(QY(n))||$Y(QY(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!$Y(QY(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},tX=(e,{json:t,lossy:n}={})=>{let r=[];return eX(!(t||n),!!t,new Map,r)(e),r};var nX=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?YY(tX(e,t)):structuredClone(e):(e,t)=>YY(tX(e,t));function rX(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function iX(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function aX(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||rX,r=e.options.footnoteBackLabel||iX,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=ZK(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...nX(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
`}]}}const oX=cX(`end`),sX=cX(`start`);function cX(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function lX(e){let t=sX(e),n=oX(e);if(t&&n)return{start:t,end:n}}function uX(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function dX(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
`}]}function fX(e,t){let n=t.value?t.value+`
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function pX(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function mX(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function hX(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=ZK(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function gX(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _X(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function vX(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function yX(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return vX(e,t);let i={src:ZK(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function bX(e,t){let n={src:ZK(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function xX(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function SX(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return vX(e,t);let i={href:ZK(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function CX(e,t){let n={href:ZK(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function wX(e,t,n){let r=e.all(t),i=n?TX(n):EX(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
`}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function TX(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=EX(n[r])}return t}function EX(e){return e.spread??e.children.length>1}function DX(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function OX(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function kX(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function AX(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function jX(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=sX(t.children[1]),o=oX(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function MX(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function NX(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function PX(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(FX(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(FX(t.slice(i),i>0,!1)),a.join(``)}function FX(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===9||t===32;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===9||t===32;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function IX(e,t){let n={type:`text`,value:PX(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function LX(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const RX={blockquote:uX,break:dX,code:fX,delete:pX,emphasis:mX,footnoteReference:hX,heading:gX,html:_X,imageReference:yX,image:bX,inlineCode:xX,linkReference:SX,link:CX,listItem:wX,list:DX,paragraph:OX,root:kX,strong:AX,table:jX,tableCell:NX,tableRow:MX,text:IX,thematicBreak:LX,toml:zX,yaml:zX,definition:zX,footnoteDefinition:zX};function zX(){}const BX={}.hasOwnProperty,VX={};function HX(e,t){let n=t||VX,r=new Map,i=new Map,a={all:s,applyData:WX,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...RX,...n.handlers},one:o,options:n,patch:UX,wrap:KX};return qW(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(BX.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=nX(n);return r.children=a.all(e),r}return nX(e)}return(a.options.unknownHandler||GX)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=qX(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=qX(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function UX(e,t){e.position&&(t.position=lX(e))}function WX(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,nX(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function GX(e,t){let n=t.data||{},r=`value`in t&&!(BX.call(n,`hProperties`)||BX.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function KX(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
`});++r<e.length;)r&&n.push({type:`text`,value:`
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
`}),n}function qX(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function JX(e,t){let n=HX(e,t),r=n.one(e,void 0),i=aX(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
`},i)),a}function YX(e,t){return e&&`run`in e?async function(n,r){let i=JX(n,{file:r,...t});await e.run(i,r)}:function(n,r){return JX(n,{file:r,...e||t})}}function XX(e){jU(e,[/\r?\n|\r/g,ZX])}function ZX(){return{type:`break`}}function QX(){return function(e){XX(e)}}var $X=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};$X.prototype.normal={},$X.prototype.property={},$X.prototype.space=void 0;function eZ(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new $X(n,r,t)}function tZ(e){return e.toLowerCase()}var nZ=class{constructor(e,t){this.attribute=t,this.property=e}};nZ.prototype.attribute=``,nZ.prototype.booleanish=!1,nZ.prototype.boolean=!1,nZ.prototype.commaOrSpaceSeparated=!1,nZ.prototype.commaSeparated=!1,nZ.prototype.defined=!1,nZ.prototype.mustUseProperty=!1,nZ.prototype.number=!1,nZ.prototype.overloadedBoolean=!1,nZ.prototype.property=``,nZ.prototype.spaceSeparated=!1,nZ.prototype.space=void 0;var rZ=s({boolean:()=>Y,booleanish:()=>aZ,commaOrSpaceSeparated:()=>lZ,commaSeparated:()=>cZ,number:()=>X,overloadedBoolean:()=>oZ,spaceSeparated:()=>sZ});let iZ=0;const Y=uZ(),aZ=uZ(),oZ=uZ(),X=uZ(),sZ=uZ(),cZ=uZ(),lZ=uZ();function uZ(){return 2**++iZ}const dZ=Object.keys(rZ);var fZ=class extends nZ{constructor(e,t,n,r){let i=-1;if(super(e,t),pZ(this,`space`,r),typeof n==`number`)for(;++i<dZ.length;){let e=dZ[i];pZ(this,dZ[i],(n&rZ[e])===rZ[e])}}};fZ.prototype.defined=!0;function pZ(e,t,n){n&&(e[t]=n)}function mZ(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new fZ(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[tZ(r)]=r,n[tZ(a.attribute)]=r}return new $X(t,n,e.space)}const hZ=mZ({properties:{ariaActiveDescendant:null,ariaAtomic:aZ,ariaAutoComplete:null,ariaBusy:aZ,ariaChecked:aZ,ariaColCount:X,ariaColIndex:X,ariaColSpan:X,ariaControls:sZ,ariaCurrent:null,ariaDescribedBy:sZ,ariaDetails:null,ariaDisabled:aZ,ariaDropEffect:sZ,ariaErrorMessage:null,ariaExpanded:aZ,ariaFlowTo:sZ,ariaGrabbed:aZ,ariaHasPopup:null,ariaHidden:aZ,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:sZ,ariaLevel:X,ariaLive:null,ariaModal:aZ,ariaMultiLine:aZ,ariaMultiSelectable:aZ,ariaOrientation:null,ariaOwns:sZ,ariaPlaceholder:null,ariaPosInSet:X,ariaPressed:aZ,ariaReadOnly:aZ,ariaRelevant:null,ariaRequired:aZ,ariaRoleDescription:sZ,ariaRowCount:X,ariaRowIndex:X,ariaRowSpan:X,ariaSelected:aZ,ariaSetSize:X,ariaSort:null,ariaValueMax:X,ariaValueMin:X,ariaValueNow:X,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function gZ(e,t){return t in e?e[t]:t}function _Z(e,t){return gZ(e,t.toLowerCase())}const vZ=mZ({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:cZ,acceptCharset:sZ,accessKey:sZ,action:null,allow:null,allowFullScreen:Y,allowPaymentRequest:Y,allowUserMedia:Y,alpha:Y,alt:null,as:null,async:Y,autoCapitalize:null,autoComplete:sZ,autoFocus:Y,autoPlay:Y,blocking:sZ,capture:null,charSet:null,checked:Y,cite:null,className:sZ,closedBy:null,colorSpace:null,cols:X,colSpan:X,command:null,commandFor:null,content:null,contentEditable:aZ,controls:Y,controlsList:sZ,coords:X|cZ,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Y,defer:Y,dir:null,dirName:null,disabled:Y,download:oZ,draggable:aZ,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Y,formTarget:null,headers:sZ,height:X,hidden:oZ,high:X,href:null,hrefLang:null,htmlFor:sZ,httpEquiv:sZ,id:null,imageSizes:null,imageSrcSet:null,inert:Y,inputMode:null,integrity:null,is:null,isMap:Y,itemId:null,itemProp:sZ,itemRef:sZ,itemScope:Y,itemType:sZ,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Y,low:X,manifest:null,max:null,maxLength:X,media:null,method:null,min:null,minLength:X,multiple:Y,muted:Y,name:null,nonce:null,noModule:Y,noValidate:Y,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:Y,optimum:X,pattern:null,ping:sZ,placeholder:null,playsInline:Y,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Y,referrerPolicy:null,rel:sZ,required:Y,reversed:Y,rows:X,rowSpan:X,sandbox:sZ,scope:null,scoped:Y,seamless:Y,selected:Y,shadowRootClonable:Y,shadowRootCustomElementRegistry:Y,shadowRootDelegatesFocus:Y,shadowRootMode:null,shadowRootSerializable:Y,shape:null,size:X,sizes:null,slot:null,span:X,spellCheck:aZ,src:null,srcDoc:null,srcLang:null,srcSet:null,start:X,step:null,style:null,tabIndex:X,target:null,title:null,translate:null,type:null,typeMustMatch:Y,useMap:null,value:aZ,width:X,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:sZ,axis:null,background:null,bgColor:null,border:X,borderColor:null,bottomMargin:X,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Y,declare:Y,event:null,face:null,frame:null,frameBorder:null,hSpace:X,leftMargin:X,link:null,longDesc:null,lowSrc:null,marginHeight:X,marginWidth:X,noResize:Y,noHref:Y,noShade:Y,noWrap:Y,object:null,profile:null,prompt:null,rev:null,rightMargin:X,rules:null,scheme:null,scrolling:aZ,standby:null,summary:null,text:null,topMargin:X,valueType:null,version:null,vAlign:null,vLink:null,vSpace:X,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Y,disablePictureInPicture:Y,disableRemotePlayback:Y,exportParts:cZ,part:sZ,prefix:null,property:null,results:X,security:null,unselectable:null},space:`html`,transform:_Z}),yZ=mZ({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`,maskType:`mask-type`,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:lZ,accentHeight:X,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:X,amplitude:X,arabicForm:null,ascent:X,attributeName:null,attributeType:null,azimuth:X,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:X,by:null,calcMode:null,capHeight:X,className:sZ,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:X,diffuseConstant:X,direction:null,display:null,dur:null,divisor:X,dominantBaseline:null,download:Y,dx:null,dy:null,edgeMode:null,editable:null,elevation:X,enableBackground:null,end:null,event:null,exponent:X,externalResourcesRequired:null,fill:null,fillOpacity:X,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:cZ,g2:cZ,glyphName:cZ,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:X,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:X,horizOriginX:X,horizOriginY:X,id:null,ideographic:X,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:X,k:X,k1:X,k2:X,k3:X,k4:X,kernelMatrix:lZ,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:X,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:X,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:X,overlineThickness:X,paintOrder:null,panose1:null,path:null,pathLength:X,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:sZ,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:X,pointsAtY:X,pointsAtZ:X,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:lZ,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:lZ,rev:lZ,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:lZ,requiredFeatures:lZ,requiredFonts:lZ,requiredFormats:lZ,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:X,specularExponent:X,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:X,strikethroughThickness:X,string:null,stroke:null,strokeDashArray:lZ,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:X,strokeOpacity:X,strokeWidth:null,style:null,surfaceScale:X,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:lZ,tabIndex:X,tableValues:null,target:null,targetX:X,targetY:X,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:lZ,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:X,underlineThickness:X,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:X,values:null,vAlphabetic:X,vMathematical:X,vectorEffect:null,vHanging:X,vIdeographic:X,version:null,vertAdvY:X,vertOriginX:X,vertOriginY:X,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:X,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:gZ}),bZ=mZ({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),xZ=mZ({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:_Z}),SZ=mZ({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),CZ=/[A-Z]/g,wZ=/-[a-z]/g,TZ=/^data[-\w.:]+$/i;function EZ(e,t){let n=tZ(t),r=t,i=nZ;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&TZ.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(wZ,OZ);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!wZ.test(e)){let n=e.replace(CZ,DZ);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=fZ}return new i(r,t)}function DZ(e){return`-`+e.toLowerCase()}function OZ(e){return e.charAt(1).toUpperCase()}const kZ=eZ([hZ,vZ,bZ,xZ,SZ],`html`),AZ=eZ([hZ,yZ,bZ,xZ,SZ],`svg`),jZ={html:`http://www.w3.org/1999/xhtml`,mathml:`http://www.w3.org/1998/Math/MathML`,svg:`http://www.w3.org/2000/svg`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`},MZ={}.hasOwnProperty;function NZ(e,t){let n=t||{};return PZ(e,{doc:n.document||document,fragment:n.fragment||!1,namespace:n.namespace||void 0,impliedNamespace:void 0,afterTransform:n.afterTransform||void 0})}function PZ(e,t){let n=FZ(e,t);return t.afterTransform&&t.afterTransform(e,n),n}function FZ(e,t){switch(e.type){case`root`:return IZ(e,t);case`text`:return RZ(e,t);case`doctype`:return LZ(e,t);case`comment`:return zZ(e,t);default:return BZ(e,t)}}function IZ(e,t){let n=e.children||[],r=n.length===0,i=-1,a;for(;++i<n.length;){let e=n[i];if(e.type===`element`&&e.tagName===`html`){r=!0,a=String(e.properties&&e.properties.xmlns||``)||jZ.html;break}}let o=t.namespace||a,s;return s=r?t.doc.implementation.createDocument(o||null,``):t.fragment?t.doc.createDocumentFragment():t.doc.createElement(`html`),HZ(s,n,{...t,namespace:o,impliedNamespace:o}),s}function LZ(e,t){return t.doc.implementation.createDocumentType(`html`,``,``)}function RZ(e,t){return t.doc.createTextNode(e.value)}function zZ(e,t){return t.doc.createComment(e.value)}function BZ(e,t){let n=t.impliedNamespace||t.namespace,r=e.tagName||(n===jZ.svg?`g`:`div`),i=e.properties||{},a=e.children||[];(n===void 0||n===jZ.html)&&r===`svg`&&(n=jZ.svg);let o=n?t.doc.createElementNS(n,r):t.doc.createElement(r);VZ(o,i,n===jZ.svg?AZ:kZ);let s=t.impliedNamespace;return t.impliedNamespace=n,HZ(o,a,t),t.impliedNamespace=s,o}function VZ(e,t,n){let r;for(r in t)if(MZ.call(t,r)){let i=EZ(n,r),a=t[r];Array.isArray(a)&&(a=a.join(i.commaSeparated?`, `:` `)),i.mustUseProperty&&(e[i.property]=a),i.boolean||i.overloadedBoolean&&typeof a==`boolean`?a&&e.setAttribute(i.attribute,``):i.booleanish?e.setAttribute(i.attribute,String(a)):a===!0?e.setAttribute(i.attribute,``):(a||a===0||a===``)&&e.setAttribute(i.attribute,String(a))}}function HZ(e,t,n){let r=-1;for(;++r<t.length;)e.append(PZ(t[r],n))}function UZ(e){let t=this,n={...t.data(`settings`),...e};n.fragment!==!1&&(n.fragment=!0),t.compiler=r;function r(e){return WZ(NZ(e,n))}}function WZ(e){if(`doctype`in e)return(e.doctype?WZ(e.doctype):``)+(e.documentElement?WZ(e.documentElement):``);if(`publicId`in e)return`<DOCTYPE html>`;let t=document.createElement(`template`);return t.content.append(e),t.innerHTML}const GZ=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],KZ=/["&'<>`]/g,qZ=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,JZ=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,YZ=/[|\\{}()[\]^$+*?.]/g,XZ=new WeakMap;function ZZ(e,t){if(e=e.replace(t.subset?QZ(t.subset):KZ,r),t.subset||t.escapeOnly)return e;return e.replace(qZ,n).replace(JZ,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function QZ(e){let t=XZ.get(e);return t||(t=$Z(e),XZ.set(e,t)),t}function $Z(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(YZ,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}const eQ=/[\dA-Fa-f]/;function tQ(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!eQ.test(String.fromCharCode(t))?r:r+`;`}const nQ=/\d/;function rQ(e,t,n){let r=`&#`+String(e);return n&&t&&!nQ.test(String.fromCharCode(t))?r:r+`;`}const iQ=`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`.split(`.`),aQ={nbsp:`\xA0`,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:`€`},oQ=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],sQ={}.hasOwnProperty,cQ={};let lQ;for(lQ in aQ)sQ.call(aQ,lQ)&&(cQ[aQ[lQ]]=lQ);const uQ=/[^\dA-Za-z]/;function dQ(e,t,n,r){let i=String.fromCharCode(e);if(sQ.call(cQ,i)){let e=cQ[i],a=`&`+e;return n&&iQ.includes(e)&&!oQ.includes(e)&&(!r||t&&t!==61&&uQ.test(String.fromCharCode(t)))?a:a+`;`}return``}function fQ(e,t,n){let r=tQ(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=dQ(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=rQ(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function pQ(e,t){return ZZ(e,Object.assign({format:fQ},t))}const mQ=/^>|^->|<!--|-->|--!>|<!-$/g,hQ=[`>`],gQ=[`<`,`>`];function _Q(e,t,n,r){return r.settings.bogusComments?`<?`+pQ(e.value,Object.assign({},r.settings.characterReferences,{subset:hQ}))+`>`:`<!--`+e.value.replace(mQ,i)+`-->`;function i(e){return pQ(e,Object.assign({},r.settings.characterReferences,{subset:gQ}))}}function vQ(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function yQ(e){let t=[],n=String(e||``),r=n.indexOf(`,`),i=0,a=!1;for(;!a;){r===-1&&(r=n.length,a=!0);let e=n.slice(i,r).trim();(e||!a)&&t.push(e),i=r+1,r=n.indexOf(`,`,i)}return t}function bQ(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}function xQ(e){let t=String(e||``).trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function SQ(e){return e.join(` `).trim()}const CQ=/[ \t\n\f\r]/g;function wQ(e){return typeof e==`object`?e.type===`text`?TQ(e.value):!1:TQ(e)}function TQ(e){return e.replace(CQ,``)===``}const EQ=kQ(1),DQ=kQ(-1),OQ=[];function kQ(e){return t;function t(t,n,r){let i=t?t.children:OQ,a=(n||0)+e,o=i[a];if(!r)for(;o&&wQ(o);)a+=e,o=i[a];return o}}const AQ={}.hasOwnProperty;function jQ(e){return t;function t(t,n,r){return AQ.call(e,t.tagName)&&e[t.tagName](t,n,r)}}const MQ=jQ({body:FQ,caption:NQ,colgroup:NQ,dd:zQ,dt:RQ,head:NQ,html:PQ,li:LQ,optgroup:VQ,option:HQ,p:IQ,rp:BQ,rt:BQ,tbody:WQ,td:qQ,tfoot:GQ,th:qQ,thead:UQ,tr:KQ});function NQ(e,t,n){let r=EQ(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&wQ(r.value.charAt(0)))}function PQ(e,t,n){let r=EQ(n,t);return!r||r.type!==`comment`}function FQ(e,t,n){let r=EQ(n,t);return!r||r.type!==`comment`}function IQ(e,t,n){let r=EQ(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||!(n.type===`element`&&(n.tagName===`a`||n.tagName===`audio`||n.tagName===`del`||n.tagName===`ins`||n.tagName===`map`||n.tagName===`noscript`||n.tagName===`video`))}function LQ(e,t,n){let r=EQ(n,t);return!r||r.type===`element`&&r.tagName===`li`}function RQ(e,t,n){let r=EQ(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function zQ(e,t,n){let r=EQ(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function BQ(e,t,n){let r=EQ(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function VQ(e,t,n){let r=EQ(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function HQ(e,t,n){let r=EQ(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function UQ(e,t,n){let r=EQ(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function WQ(e,t,n){let r=EQ(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function GQ(e,t,n){return!EQ(n,t)}function KQ(e,t,n){let r=EQ(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function qQ(e,t,n){let r=EQ(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}const JQ=jQ({body:Mne,colgroup:ZQ,head:XQ,html:YQ,tbody:QQ});function YQ(e){let t=EQ(e,-1);return!t||t.type!==`comment`}function XQ(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function Mne(e){let t=EQ(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&wQ(t.value.charAt(0)))&&!(t.type===`element`&&(t.tagName===`meta`||t.tagName===`link`||t.tagName===`script`||t.tagName===`style`||t.tagName===`template`))}function ZQ(e,t,n){let r=DQ(n,t),i=EQ(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&MQ(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function QQ(e,t,n){let r=DQ(n,t),i=EQ(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&MQ(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}const $Q={name:[[`
\f\r &/=>`.split(``),`
\f\r "&'/=>\``.split(``)],[`\0
\f\r "&'/<=>`.split(``),`\0
\f\r "&'/<=>\``.split(``)]],unquoted:[[`
\f\r &>`.split(``),`\0
\f\r "&'<=>\``.split(``)],[`\0
\f\r "&'<=>\``.split(``),`\0
\f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function e$(e,t,n,r){let i=r.schema,a=i.space===`svg`?!1:r.settings.omitOptionalTags,o=i.space===`svg`?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),s=[],c;i.space===`html`&&e.tagName===`svg`&&(r.schema=AZ);let l=t$(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!JQ(e,t,n))&&(s.push(`<`,e.tagName,l?` `+l:``),o&&(i.space===`svg`||r.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!r.settings.tightSelfClosing||c===`/`||c&&c!==`"`&&c!==`'`)&&s.push(` `),s.push(`/`)),s.push(`>`)),s.push(u),!o&&(!a||!MQ(e,t,n))&&s.push(`</`+e.tagName+`>`),s.join(``)}function t$(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=n$(e,i,t[i]);r&&n.push(r)}}for(;++r<n.length;){let t=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&t!==`"`&&t!==`'`&&(n[r]+=` `)}return n.join(``)}function n$(e,t,n){let r=EZ(e.schema,t),i=e.settings.allowParseErrors&&e.schema.space===`html`?0:1,a=+!e.settings.allowDangerousCharacters,o=e.quote,s;if(r.overloadedBoolean&&(n===r.attribute||n===``)?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!=`string`||n===r.attribute||n===``)&&(n=!!n),n==null||n===!1||typeof n==`number`&&Number.isNaN(n))return``;let c=pQ(r.attribute,Object.assign({},e.settings.characterReferences,{subset:$Q.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?bQ:SQ)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=pQ(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:$Q.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&sU(n,o)>sU(n,e.alternative)&&(o=e.alternative),s=o+pQ(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?$Q.single:$Q.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}const r$=[`<`,`&`];function i$(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:pQ(e.value,Object.assign({},r.settings.characterReferences,{subset:r$}))}function a$(e,t,n,r){return r.settings.allowDangerousHtml?e.value:i$(e,t,n,r)}function o$(e,t,n,r){return r.all(e)}const s$=wW(`type`,{invalid:c$,unknown:l$,handlers:{comment:_Q,doctype:vQ,element:e$,raw:a$,root:o$,text:i$}});function c$(e){throw Error("Expected node, not `"+e+"`")}function l$(e){throw Error("Cannot compile unknown node `"+e.type+"`")}const u$={},d$={},f$=[];function p$(e,t){let n=t||u$,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:m$,all:h$,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||GZ,characterReferences:n.characterReferences||d$,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?AZ:kZ,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function m$(e,t,n){return s$(e,t,n,this)}function h$(e){let t=[],n=e&&e.children||f$,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}const g$=/[#.]/g;function _$(e,t){let n=e||``,r={},i=0,a,o;for(;i<n.length;){g$.lastIndex=i;let e=g$.exec(n),t=n.slice(i,e?e.index:n.length);t&&(a?a===`#`?r.id=t:Array.isArray(r.className)?r.className.push(t):r.className=[t]:o=t,i+=t.length),e&&(a=e[0],i++)}return{type:`element`,tagName:o||t||`div`,properties:r,children:[]}}function v$(e,t,n){let r=n?w$(n):void 0;function i(n,i,...a){let o;if(n==null){o={type:`root`,children:[]};let e=i;a.unshift(e)}else{o=_$(n,t);let s=o.tagName.toLowerCase(),c=r?r.get(s):void 0;if(o.tagName=c||s,y$(i))a.unshift(i);else for(let[t,n]of Object.entries(i))b$(e,o.properties,t,n)}for(let e of a)x$(o.children,e);return o.type===`element`&&o.tagName===`template`&&(o.content={type:`root`,children:o.children},o.children=[]),o}return i}function y$(e){if(typeof e!=`object`||!e||Array.isArray(e))return!0;if(typeof e.type!=`string`)return!1;let t=e,n=Object.keys(e);for(let e of n){let n=t[e];if(n&&typeof n==`object`){if(!Array.isArray(n))return!0;let e=n;for(let t of e)if(typeof t!=`number`&&typeof t!=`string`)return!0}}return!!(`children`in e&&Array.isArray(e.children))}function b$(e,t,n,r){let i=EZ(e,n),a;if(r!=null){if(typeof r==`number`){if(Number.isNaN(r))return;a=r}else a=typeof r==`boolean`?r:typeof r==`string`?i.spaceSeparated?xQ(r):i.commaSeparated?yQ(r):i.commaOrSpaceSeparated?xQ(yQ(r).join(` `)):S$(i,i.property,r):Array.isArray(r)?[...r]:i.property===`style`?C$(r):String(r);if(Array.isArray(a)){let e=[];for(let t of a)e.push(S$(i,i.property,t));a=e}i.property===`className`&&Array.isArray(t.className)&&(a=t.className.concat(a)),t[i.property]=a}}function x$(e,t){if(t!=null)if(typeof t==`number`||typeof t==`string`)e.push({type:`text`,value:String(t)});else if(Array.isArray(t))for(let n of t)x$(e,n);else if(typeof t==`object`&&`type`in t)t.type===`root`?x$(e,t.children):e.push(t);else throw Error("Expected node, nodes, or string, got `"+t+"`")}function S$(e,t,n){if(typeof n==`string`){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===``||tZ(n)===tZ(t)))return!0}return n}function C$(e){let t=[];for(let[n,r]of Object.entries(e))t.push([n,r].join(`: `));return t.join(`; `)}function w$(e){let t=new Map;for(let n of e)t.set(n.toLowerCase(),n);return t}const T$=`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`.split(`.`),E$=v$(kZ,`div`),D$=v$(AZ,`g`,T$);function O$(e,t){return k$(e,t||{})||{type:`root`,children:[]}}function k$(e,t){let n=A$(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function A$(e,t){switch(e.nodeType){case 1:return F$(e,t);case 3:return N$(e);case 8:return P$(e);case 9:return j$(e,t);case 10:return M$();case 11:return j$(e,t);default:return}}function j$(e,t){return{type:`root`,children:I$(e,t)}}function M$(){return{type:`doctype`}}function N$(e){return{type:`text`,value:e.nodeValue||``}}function P$(e){return{type:`comment`,value:e.nodeValue||``}}function F$(e,t){let n=e.namespaceURI,r=n===jZ.svg?D$:E$,i=n===jZ.html?e.tagName.toLowerCase():e.tagName,a=n===jZ.html&&i===`template`?e.content:e,o=e.getAttributeNames(),s={},c=-1;for(;++c<o.length;)s[o[c]]=e.getAttribute(o[c])||``;return r(i,s,I$(a,t))}function I$(e,t){let n=e.childNodes,r=[],i=-1;for(;++i<n.length;){let e=k$(n[i],t);e!==void 0&&r.push(e)}return r}const L$=Object.freeze({remarkParse:GY,remarkGfm:[oY,{singleTilde:!0}],remarkBreaks:QX,remarkRehype:[YX,{allowDangerousHtml:!0}],rehypeDomRaw:B$,deleteClassesFromToDoLists:z$,rehypeStringify:UZ});var R$=class{_processor;constructor({plugins:e=L$}={}){this._processor=ZH().use({plugins:Object.values(e)})}parse(e){return this._processor.processSync(e).toString().replaceAll(`
</code>`,`</code>`)}};function z$(){return e=>{qW(e,`element`,e=>{(e.tagName===`ul`||e.tagName===`ol`||e.tagName===`li`)&&(e.children=e.children.filter(e=>e.type!==`text`||!!e.value.trim()),delete e.properties.className)})}}function B$(){return e=>{qW(e,[`root`,`element`],e=>{if(!V$(e)||!e.children.some(e=>e.type===`raw`))return;let t=document.createElement(`template`);t.innerHTML=p$({type:`root`,children:e.children},{allowDangerousHtml:!0}),e.children=Array.from(t.content.childNodes).map(e=>O$(e))})}}function V$(e){return(e.type===`root`||e.type===`element`)&&e.children}function H$(e){let t=this,n={...t.data(`settings`),...e};t.parser=r;function r(e){return O$((n.fragment===!1?U$:W$)(e))}}function U$(e){return new DOMParser().parseFromString(e,`text/html`)}function W$(e){let t=document.createElement(`template`);return t.innerHTML=e,t.content}const G$=(function(e,t,n,r,i){let a=K$(t);if(n!=null&&(typeof n!=`number`||n<0||n===1/0))throw Error("Expected positive finite `index`");if(r!=null&&(!r.type||!r.children))throw Error("Expected valid `parent`");if(n==null!=(r==null))throw Error("Expected both `index` and `parent`");return Z$(e)?a.call(i,e,n,r):!1}),K$=(function(e){if(e==null)return X$;if(typeof e==`string`)return J$(e);if(typeof e==`object`)return q$(e);if(typeof e==`function`)return Y$(e);throw Error("Expected function, string, or array as `test`")});function q$(e){let t=[],n=-1;for(;++n<e.length;)t[n]=K$(e[n]);return Y$(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function J$(e){return Y$(t);function t(t){return t.tagName===e}}function Y$(e){return t;function t(t,n,r){return!!(Z$(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function X$(e){return!!(e&&typeof e==`object`&&`type`in e&&e.type===`element`&&`tagName`in e&&typeof e.tagName==`string`)}function Z$(e){return typeof e==`object`&&!!e&&`type`in e&&`tagName`in e}const Q$=K$(function(e){return e.tagName===`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`}),$$=`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`.split(`.`),e1=[`button`,`input`,`select`,`textarea`],t1=[`area`,`base`,`basefont`,`dialog`,`datalist`,`head`,`link`,`meta`,`noembed`,`noframes`,`param`,`rp`,`script`,`source`,`style`,`template`,`track`,`title`],n1={},r1=bU([`comment`,`doctype`]);function i1(e,t){a1(e,{collapse:g1((t||n1).newlines?m1:h1),whitespace:`normal`})}function a1(e,t){if(`children`in e){let n={...t};return(e.type===`root`||d1(e))&&(n.before=!0,n.after=!0),n.whitespace=_1(e,t),s1(e,n)}if(e.type===`text`){if(t.whitespace===`normal`)return o1(e,t);t.whitespace===`nowrap`&&(e.value=t.collapse(e.value))}return{ignore:r1(e),stripAtStart:!1,remove:!1}}function o1(e,t){let n=t.collapse(e.value),r={ignore:!1,stripAtStart:!1,remove:!1},i=0,a=n.length;return t.before&&p1(n.charAt(0))&&i++,i!==a&&p1(n.charAt(a-1))&&(t.after?a--:r.stripAtStart=!0),i===a?r.remove=!0:e.value=n.slice(i,a),r}function s1(e,t){let n=t.before,r=t.after,i=e.children,a=i.length,o=-1;for(;++o<a;){let e=a1(i[o],{...t,after:c1(i,o,r),before:n});e.remove?(i.splice(o,1),o--,a--):e.ignore||(n=e.stripAtStart),u1(i[o])&&(n=!1)}return{ignore:!1,stripAtStart:!!(n||r),remove:!1}}function c1(e,t,n){for(;++t<e.length;){let n=e[t],r=l1(n);if(r===void 0&&`children`in n&&!f1(n)&&(r=c1(n.children,-1)),typeof r==`boolean`)return r}return n}function l1(e){if(e.type===`element`){if(u1(e))return!1;if(d1(e))return!0}else if(e.type===`text`){if(!wQ(e))return!1}else if(!r1(e))return!1}function u1(e){return Q$(e)||G$(e,e1)}function d1(e){return G$(e,$$)}function f1(e){return!!(e.type===`element`&&e.properties.hidden)||r1(e)||G$(e,t1)}function p1(e){return e===` `||e===`
`}function m1(e){let t=/\r?\n|\r/.exec(e);return t?t[0]:` `}function h1(){return` `}function g1(e){return t;function t(t){return String(t).replace(/[\t\n\v\f\r ]+/g,e)}}function _1(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`;default:}return t.whitespace}function v1(e){return function(t){i1(t,e)}}function y1(e,t){let n=t.properties||{},r=e.all(t),i={type:`link`,url:e.resolve(String(n.href||``)||null),title:n.title?String(n.title):null,children:r};return e.patch(t,i),i}function b1(e,t){e.baseFound||=(e.frozenBaseUrl=String(t.properties&&t.properties.href||``)||void 0,!0)}function x1(e,t){let n={type:`blockquote`,children:e.toFlow(e.all(t))};return e.patch(t,n),n}function S1(e,t){let n={type:`break`};return e.patch(t,n),n}const C1=(function(e,t,n){let r=bU(n);if(!e||!e.type||!e.children)throw Error(`Expected parent node`);if(typeof t==`number`){if(t<0||t===1/0)throw Error(`Expected positive finite number as index`)}else if(t=e.children.indexOf(t),t<0)throw Error(`Expected child node or index`);for(;++t<e.children.length;)if(r(e.children[t],t,e))return e.children[t]}),w1=/\n/g,T1=/[\t ]+/g,E1=K$(`br`),D1=K$(B1),O1=K$(`p`),k1=K$(`tr`),A1=K$([`datalist`,`head`,`noembed`,`noframes`,`noscript`,`rp`,`script`,`style`,`template`,`title`,z1,V1]),j1=K$(`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`.split(`.`));function M1(e,t){let n=t||{},r=`children`in e?e.children:[],i=j1(e),a=R1(e,{whitespace:n.whitespace||`normal`,breakBefore:!1,breakAfter:!1}),o=[];(e.type===`text`||e.type===`comment`)&&o.push(...F1(e,{whitespace:a,breakBefore:!0,breakAfter:!0}));let s=-1;for(;++s<r.length;)o.push(...N1(r[s],e,{whitespace:a,breakBefore:s?void 0:i,breakAfter:s<r.length-1?E1(r[s+1]):i}));let c=[],l;for(s=-1;++s<o.length;){let e=o[s];typeof e==`number`?l!==void 0&&e>l&&(l=e):e&&(l!==void 0&&l>-1&&c.push(`
`.repeat(l)||` `),l=-1,c.push(e))}return c.join(``)}function N1(e,t,n){return e.type===`element`?P1(e,t,n):e.type===`text`?n.whitespace===`normal`?F1(e,n):I1(e):[]}function P1(e,t,n){let r=R1(e,n),i=e.children||[],a=-1,o=[];if(A1(e))return o;let s,c;for(E1(e)||k1(e)&&C1(t,e,k1)?c=`
`:O1(e)?(s=2,c=2):j1(e)&&(s=1,c=1);++a<i.length;)o=o.concat(N1(i[a],e,{whitespace:r,breakBefore:a?void 0:s,breakAfter:a<i.length-1?E1(i[a+1]):c}));return D1(e)&&C1(t,e,D1)&&o.push(` `),s&&o.unshift(s),c&&o.push(c),o}function F1(e,t){let n=String(e.value),r=[],i=[],a=0;for(;a<=n.length;){w1.lastIndex=a;let e=w1.exec(n),i=e&&`index`in e?e.index:n.length;r.push(L1(n.slice(a,i).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,``),a===0?t.breakBefore:!0,i===n.length?t.breakAfter:!0)),a=i+1}let o=-1,s;for(;++o<r.length;)r[o].charCodeAt(r[o].length-1)===8203||o<r.length-1&&r[o+1].charCodeAt(0)===8203?(i.push(r[o]),s=void 0):r[o]?(typeof s==`number`&&i.push(s),i.push(r[o]),s=0):(o===0||o===r.length-1)&&i.push(0);return i}function I1(e){return[String(e.value)]}function L1(e,t,n){let r=[],i=0,a;for(;i<e.length;){T1.lastIndex=i;let n=T1.exec(e);a=n?n.index:e.length,!i&&!a&&n&&!t&&r.push(``),i!==a&&r.push(e.slice(i,a)),i=n?a+n[0].length:a}return i!==a&&!n&&r.push(``),r.join(` `)}function R1(e,t){if(e.type===`element`){let n=e.properties||{};switch(e.tagName){case`listing`:case`plaintext`:case`xmp`:return`pre`;case`nobr`:return`nowrap`;case`pre`:return n.wrap?`pre-wrap`:`pre`;case`td`:case`th`:return n.noWrap?`nowrap`:t.whitespace;case`textarea`:return`pre-wrap`;default:}}return t.whitespace}function z1(e){return!!(e.properties||{}).hidden}function B1(e){return e.tagName===`td`||e.tagName===`th`}function V1(e){return e.tagName===`dialog`&&!(e.properties||{}).open}function H1(e){let t=String(e),n=t.length;for(;n>0;){let e=t.codePointAt(n-1);if(e!==void 0&&(e===10||e===13))n--;else break}return t.slice(0,n)}function U1(e,t){let n=t.children,r=-1,i,a;if(t.tagName===`pre`)for(;++r<n.length;){let e=n[r];if(e.type===`element`&&e.tagName===`code`&&e.properties&&e.properties.className&&Array.isArray(e.properties.className)){i=e.properties.className;break}}if(i){for(r=-1;++r<i.length;)if(String(i[r]).slice(0,9)===`language-`){a=String(i[r]).slice(9);break}}let o={type:`code`,lang:a||null,meta:null,value:H1(M1(t))};return e.patch(t,o),o}function W1(e,t){let n={type:`html`,value:`<!--`+t.value+`-->`};return e.patch(t,n),n}function G1(e,t){let n={type:`delete`,children:e.all(t)};return e.patch(t,n),n}function K1(e){let t=-1;if(e.length>1){for(;++t<e.length;)if(e[t].spread)return!0}return!1}function q1(e,t){let n=[],r=[],i=-1;for(;++i<t.children.length;){let e=t.children[i];e.type===`element`&&e.tagName===`div`?n.push(...e.children):n.push(e)}let a={definitions:[],titles:[]};for(i=-1;++i<n.length;){let e=n[i];if(e.type===`element`&&e.tagName===`dt`){let t=n[i-1];t&&t.type===`element`&&t.tagName===`dd`&&(r.push(a),a={definitions:[],titles:[]}),a.titles.push(e)}else a.definitions.push(e)}r.push(a),i=-1;let o=[];for(;++i<r.length;){let t=[...J1(e,r[i].titles),...J1(e,r[i].definitions)];t.length>0&&o.push({type:`listItem`,spread:t.length>1,checked:null,children:t})}if(o.length>0){let n={type:`list`,ordered:!1,start:null,spread:K1(o),children:o};return e.patch(t,n),n}}function J1(e,t){let n=e.all({type:`root`,children:t}),r=e.toSpecificContent(n,Y1);return r.length===0?[]:r.length===1?r[0].children:[{type:`list`,ordered:!1,start:null,spread:K1(r),children:r}]}function Y1(){return{type:`listItem`,spread:!1,checked:null,children:[]}}function X1(e,t){let n={type:`emphasis`,children:e.all(t)};return e.patch(t,n),n}function Z1(e){let t=0,n=e.length;for(;t<n&&e[t].type===`break`;)t++;for(;n>t&&e[n-1].type===`break`;)n--;return t===0&&n===e.length?e:e.slice(t,n)}function Q1(e,t){let n={type:`heading`,depth:Number(t.tagName.charAt(1))||1,children:Z1(e.all(t))};return e.patch(t,n),n}function $1(e,t){let n={type:`thematicBreak`};return e.patch(t,n),n}function e0(e,t){let n=t.properties||{},r=String(n.src||``),i=String(n.title||``);if(r&&i){let n={type:`link`,title:null,url:e.resolve(r),children:[{type:`text`,value:i}]};return e.patch(t,n),n}}function t0(e,t){let n=t.properties||{},r={type:`image`,url:e.resolve(String(n.src||``)||null),title:n.title?String(n.title):null,alt:n.alt?String(n.alt):``};return e.patch(t,r),r}function n0(e,t){let n={type:`inlineCode`,value:M1(t)};return e.patch(t,n),n}function r0(e,t){let n=[],r=[],i=t||e.properties||{},a=i0(e),o=Math.min(Number.parseInt(String(i.size),10),0)||(i.multiple?4:1),s=-1;for(;++s<a.length;){let e=a[s];e&&e.properties&&e.properties.selected&&n.push(e)}let c=n.length>0?n:a,l=Math.min(c.length,o);for(s=-1;++s<l;){let e=c[s],t=e.properties||{},n=M1(e),i=n||String(t.label||``),a=String(t.value||``)||n;r.push([a,i===a?void 0:i])}return r}function i0(e){let t=[],n=-1;for(;++n<e.children.length;){let r=e.children[n];`children`in r&&Array.isArray(r.children)&&t.push(...i0(r)),r.type===`element`&&r.tagName===`option`&&(!r.properties||!r.properties.disabled)&&t.push(r)}return t}function a0(e,t){let n=t.properties||{},r=String(n.value||n.placeholder||``);if(n.disabled||n.type===`hidden`||n.type===`file`)return;if(n.type===`checkbox`||n.type===`radio`){let r={type:`text`,value:n.checked?e.options.checked||`[x]`:e.options.unchecked||`[ ]`};return e.patch(t,r),r}if(n.type===`image`){let i=n.alt||r;if(i){let r={type:`image`,url:e.resolve(String(n.src||``)||null),title:String(n.title||``)||null,alt:String(i)};return e.patch(t,r),r}return}let i=[];if(r)i=[[r,void 0]];else if(n.type!==`button`&&n.type!==`file`&&n.type!==`password`&&n.type!==`reset`&&n.type!==`submit`&&n.list){let t=String(n.list),r=e.elementById.get(t);r&&r.tagName===`datalist`&&(i=r0(r,n))}if(i.length===0)return;if(n.type===`password`&&(i[0]=[`•`.repeat(i[0][0].length),void 0]),n.type===`email`||n.type===`url`){let t=[],r=-1;for(;++r<i.length;){let a=e.resolve(i[r][0]),o={type:`link`,title:null,url:n.type===`email`?`mailto:`+a:a,children:[{type:`text`,value:i[r][1]||a}]};t.push(o),r!==i.length-1&&t.push({type:`text`,value:`, `})}return t}let a=[],o=-1;for(;++o<i.length;)a.push(i[o][1]?i[o][1]+` (`+i[o][0]+`)`:i[o][0]);let s={type:`text`,value:a.join(`, `)};return e.patch(t,s),s}const o0={}.hasOwnProperty;function s0(e,t){let n=e.type===`element`&&o0.call(e.properties,t)&&e.properties[t];return n!=null&&n!==!1}const c0=new Set([`pingback`,`prefetch`,`stylesheet`]);function l0(e){if(e.type!==`element`||e.tagName!==`link`)return!1;if(e.properties.itemProp)return!0;let t=e.properties.rel,n=-1;if(!Array.isArray(t)||t.length===0)return!1;for(;++n<t.length;)if(!c0.has(String(t[n])))return!1;return!0}const u0=K$(`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`.split(`.`)),d0=K$(`meta`);function f0(e){return!!(e.type===`text`||u0(e)||Q$(e)||l0(e)||d0(e)&&s0(e,`itemProp`))}function p0(e,t){let{rest:n,checkbox:r}=h0(t),i=r?!!r.properties.checked:null,a={type:`listItem`,spread:m0(n),checked:i,children:e.toFlow(e.all(n))};return e.patch(t,a),a}function m0(e){let t=-1,n=!1;for(;++t<e.children.length;){let r=e.children[t];if(r.type===`element`){if(f0(r))continue;if(r.tagName===`p`||n||m0(r))return!0;n=!0}}return!1}function h0(e){let t=e.children[0];if(t&&t.type===`element`&&t.tagName===`input`&&t.properties&&(t.properties.type===`checkbox`||t.properties.type===`radio`))return{checkbox:t,rest:{...e,children:e.children.slice(1)}};if(t&&t.type===`element`&&t.tagName===`p`){let{checkbox:n,rest:r}=h0(t);if(n)return{checkbox:n,rest:{...e,children:[r,...e.children.slice(1)]}}}return{checkbox:void 0,rest:e}}function g0(e,t){let n=t.tagName===`ol`,r=e.toSpecificContent(e.all(t),_0),i=null;n&&(i=t.properties&&t.properties.start?Number.parseInt(String(t.properties.start),10):1);let a={type:`list`,ordered:n,start:i,spread:K1(r),children:r};return e.patch(t,a),a}function _0(){return{type:`listItem`,spread:!1,checked:null,children:[]}}function v0(e){let t=-1;for(;++t<e.length;){let n=e[t];if(!C0(n)||`children`in n&&v0(n.children))return!0}return!1}function y0(e){return x0(e,t,function(e){return e});function t(e){return e.every(function(e){return e.type===`text`?wQ(e.value):!1})?[]:[{type:`paragraph`,children:Z1(e)}]}}function b0(e){return x0(e.children,t,n);function t(t){let n=w0(e);return n.children=t,[n]}function n(t){if(`children`in t&&`children`in e){let n=w0(e),r=w0(t);return n.children=t.children,r.children.push(n),r}return{...t}}}function x0(e,t,n){let r=S0(e),i=[],a=[],o=-1;for(;++o<r.length;){let e=r[o];C0(e)?a.push(e):(a.length>0&&(i.push(...t(a)),a=[]),i.push(n(e)))}return a.length>0&&(i.push(...t(a)),a=[]),i}function S0(e){let t=[],n=-1;for(;++n<e.length;){let r=e[n];(r.type===`delete`||r.type===`link`)&&v0(r.children)?t.push(...b0(r)):t.push(r)}return t}function C0(e){let t=e.data&&e.data.hName;return t?f0({type:`element`,tagName:t,properties:{},children:[]}):SG(e)}function w0(e){return nX({...e,children:[]})}function T0(e,t){let n=t.properties||{},r=t.tagName===`video`?String(n.poster||``):``,i=String(n.src||``),a=-1,o=!1,s=e.all(t);if(qW({type:`root`,children:s},function(e){if(e.type===`link`)return o=!0,!1}),o||v0(s))return s;for(;!i&&++a<t.children.length;){let e=t.children[a];e.type===`element`&&e.tagName===`source`&&e.properties&&(i=String(e.properties.src||``))}if(r){let n={type:`image`,title:null,url:e.resolve(r),alt:YW(s)};e.patch(t,n),s=[n]}let c=s,l={type:`link`,title:n.title?String(n.title):null,url:e.resolve(i),children:c};return e.patch(t,l),l}function E0(e,t){let n=Z1(e.all(t));if(n.length>0){let r={type:`paragraph`,children:n};return e.patch(t,r),r}}const D0=[`"`];function O0(e,t){let n=e.options.quotes||D0;e.qNesting++;let r=e.all(t);e.qNesting--;let i=n[e.qNesting%n.length],a=r[0],o=r[r.length-1],s=i.charAt(0),c=i.length>1?i.charAt(1):i;return a&&a.type===`text`?a.value=s+a.value:r.unshift({type:`text`,value:s}),o&&o.type===`text`?o.value+=c:r.push({type:`text`,value:c}),r}function k0(e,t){let n=e.all(t);(e.options.document||v0(n))&&(n=y0(n));let r={type:`root`,children:n};return e.patch(t,r),r}function A0(e,t){let n=r0(t),r=-1,i=[];for(;++r<n.length;){let e=n[r];i.push(e[1]?e[1]+` (`+e[0]+`)`:e[0])}if(i.length>0){let n={type:`text`,value:i.join(`, `)};return e.patch(t,n),n}}function j0(e,t){let n={type:`strong`,children:e.all(t)};return e.patch(t,n),n}function M0(e,t){let n={type:`tableCell`,children:e.all(t)};if(e.patch(t,n),t.properties){let e=t.properties.rowSpan,r=t.properties.colSpan;if(e||r){let t=n.data||={};e&&(t.hastUtilToMdastTemporaryRowSpan=e),r&&(t.hastUtilToMdastTemporaryColSpan=r)}}return n}function N0(e,t){let n={type:`tableRow`,children:e.toSpecificContent(e.all(t),P0)};return e.patch(t,n),n}function P0(){return{type:`tableCell`,children:[]}}function F0(e,t){if(e.inTable){let n={type:`text`,value:M1(t)};return e.patch(t,n),n}e.inTable=!0;let{align:n,headless:r}=I0(t),i=e.toSpecificContent(e.all(t),R0);r&&i.unshift(R0());let a=-1;for(;++a<i.length;){let t=i[a];t.children=e.toSpecificContent(t.children,L0)}let o=1;for(a=-1;++a<i.length;){let e=i[a].children,t=-1;for(;++t<e.length;){let n=e[t];if(n.data){let e=n.data,r=Number.parseInt(String(e.hastUtilToMdastTemporaryColSpan),10)||1,o=Number.parseInt(String(e.hastUtilToMdastTemporaryRowSpan),10)||1;if(r>1||o>1){let e=a-1;for(;++e<a+o;){let n=t-1;for(;++n<t+r&&i[e];){let r=[];(e!==a||n!==t)&&r.push({type:`tableCell`,children:[]}),i[e].children.splice(n,0,...r)}}}`hastUtilToMdastTemporaryColSpan`in n.data&&delete n.data.hastUtilToMdastTemporaryColSpan,`hastUtilToMdastTemporaryRowSpan`in n.data&&delete n.data.hastUtilToMdastTemporaryRowSpan,Object.keys(n.data).length===0&&delete n.data}}e.length>o&&(o=e.length)}for(a=-1;++a<i.length;){let e=i[a].children,t=e.length-1;for(;++t<o;)e.push({type:`tableCell`,children:[]})}let s=n.length-1;for(;++s<o;)n.push(null);e.inTable=!1;let c={type:`table`,align:n,children:i};return e.patch(t,c),c}function I0(e){let t={align:[null],headless:!0},n=0,r=0;return qW(e,function(i){if(i.type===`element`){if(i.tagName===`table`&&e!==i)return`skip`;if((i.tagName===`th`||i.tagName===`td`)&&i.properties){if(!t.align[r]){let e=String(i.properties.align||``)||null;(e===`center`||e===`left`||e===`right`||e===null)&&(t.align[r]=e)}t.headless&&n<2&&i.tagName===`th`&&(t.headless=!1),r++}else i.tagName===`thead`?t.headless=!1:i.tagName===`tr`&&(n++,r=0)}}),t}function L0(){return{type:`tableCell`,children:[]}}function R0(){return{type:`tableRow`,children:[]}}function z0(e,t){let n={type:`text`,value:t.value};return e.patch(t,n),n}function B0(e,t){let n={type:`text`,value:M1(t)};return e.patch(t,n),n}function V0(e,t){let n={type:`text`,value:``};return e.patch(t,n),n}const H0={comment:W1,doctype:Q,root:k0,text:z0},U0={applet:Q,area:Q,basefont:Q,bgsound:Q,caption:Q,col:Q,colgroup:Q,command:Q,content:Q,datalist:Q,dialog:Q,element:Q,embed:Q,frame:Q,frameset:Q,isindex:Q,keygen:Q,link:Q,math:Q,menu:Q,menuitem:Q,meta:Q,nextid:Q,noembed:Q,noframes:Q,optgroup:Q,option:Q,param:Q,script:Q,shadow:Q,source:Q,spacer:Q,style:Q,svg:Q,template:Q,title:Q,track:Q,abbr:Z,acronym:Z,bdi:Z,bdo:Z,big:Z,blink:Z,button:Z,canvas:Z,cite:Z,data:Z,details:Z,dfn:Z,font:Z,ins:Z,label:Z,map:Z,marquee:Z,meter:Z,nobr:Z,noscript:Z,object:Z,output:Z,progress:Z,rb:Z,rbc:Z,rp:Z,rt:Z,rtc:Z,ruby:Z,slot:Z,small:Z,span:Z,sup:Z,sub:Z,tbody:Z,tfoot:Z,thead:Z,time:Z,address:W0,article:W0,aside:W0,body:W0,center:W0,div:W0,fieldset:W0,figcaption:W0,figure:W0,form:W0,footer:W0,header:W0,hgroup:W0,html:W0,legend:W0,main:W0,multicol:W0,nav:W0,picture:W0,section:W0,a:y1,audio:T0,b:j0,base:b1,blockquote:x1,br:S1,code:n0,dir:g0,dl:q1,dt:p0,dd:p0,del:G1,em:X1,h1:Q1,h2:Q1,h3:Q1,h4:Q1,h5:Q1,h6:Q1,hr:$1,i:X1,iframe:e0,img:t0,image:t0,input:a0,kbd:n0,li:p0,listing:U1,mark:X1,ol:g0,p:E0,plaintext:U1,pre:U1,q:O0,s:G1,samp:n0,select:A0,strike:G1,strong:j0,summary:E0,table:F0,td:M0,textarea:B0,th:M0,tr:N0,tt:n0,u:X1,ul:g0,var:n0,video:T0,wbr:V0,xmp:U1};function Z(e,t){return e.all(t)}function W0(e,t){return e.toFlow(e.all(t))}function Q(){}const G0={}.hasOwnProperty;function K0(e){return{all:q0,baseFound:!1,elementById:new Map,frozenBaseUrl:void 0,handlers:{...U0,...e.handlers},inTable:!1,nodeHandlers:{...H0,...e.nodeHandlers},one:J0,options:e,patch:Y0,qNesting:0,resolve:X0,toFlow:Z0,toSpecificContent:Q0}}function q0(e){let t=e.children||[],n=[],r=-1;for(;++r<t.length;){let i=t[r],a=this.one(i,e);Array.isArray(a)?n.push(...a):a&&n.push(a)}return n}function J0(e,t){if(e.type===`element`){if(e.properties&&e.properties.dataMdast===`ignore`)return;if(G0.call(this.handlers,e.tagName))return this.handlers[e.tagName](this,e,t)||void 0}else if(G0.call(this.nodeHandlers,e.type))return this.nodeHandlers[e.type](this,e,t)||void 0;if(`value`in e&&typeof e.value==`string`){let t={type:`text`,value:e.value};return this.patch(e,t),t}if(`children`in e)return this.all(e)}function Y0(e,t){e.position&&(t.position=lX(e))}function X0(e){let t=this.frozenBaseUrl;return e==null?``:t?String(new URL(e,t)):e}function Z0(e){return y0(e)}function Q0(e,t){let n=t(),r=[],i=[],a=-1;for(;++a<e.length;){let t=e[a];if(o(t))i.length>0&&(t.children.unshift(...i),i=[]),r.push(t);else{let e=t;i.push(e)}}if(i.length>0){let e=r[r.length-1];e||(e=t(),r.push(e)),e.children.push(...i),i=[]}return r;function o(e){return e.type===n.type}}const $0={};function e2(e,t){let n=nX(e),r=t||$0,i=v1({newlines:r.newlines===!0}),a=K0(r),o;i(n),qW(n,function(e){if(e&&e.type===`element`&&e.properties){let t=String(e.properties.id||``)||void 0;t&&!a.elementById.has(t)&&a.elementById.set(t,e)}});let s=a.one(n,void 0);return o=s?Array.isArray(s)?{type:`root`,children:s}:s:{type:`root`,children:[]},qW(o,function(e,t,n){if(e.type===`text`&&t!==void 0&&n){let r=n.children[t-1];if(r&&r.type===e.type)return r.value+=e.value,n.children.splice(t,1),r.position&&e.position&&(r.position.end=e.position.end),t-1;if(e.value=e.value.replace(/[\t ]*(\r?\n|\r)[\t ]*/,`$1`),n&&(n.type===`heading`||n.type===`paragraph`||n.type===`root`)&&(t||(e.value=e.value.replace(/^[\t ]+/,``)),t===n.children.length-1&&(e.value=e.value.replace(/[\t ]+$/,``))),!e.value)return n.children.splice(t,1),t}}),o}const t2={document:!0};function n2(e,t){return e&&`run`in e?async function(n,r){let i=e2(n,{...t2,...t});await e.run(i,r)}:function(t){return e2(t,{...t2,...e})}}function r2(e){let t=this;t.compiler=n;function n(n){return QG(n,{...t.data(`settings`),...e,extensions:t.data(`toMarkdownExtensions`)||[]})}}var i2=class{_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)=>{let n=p$(E$(t.tagName,t.properties),{allowDangerousHtml:!0,closeSelfClosing:!0}),r=n.indexOf(`>`),i=n.slice(0,r+1),a=n.slice(r+1);return[{type:`html`,value:i},...e.all(t),{type:`html`,value:a}]},e),{})}_buildProcessor(){this._processor=ZH().use(H$).use(a2).use(n2,{handlers:this._getRawTagsHandlers()}).use(oY,{singleTilde:!0}).use(QX).use(r2,{resourceLink:!0,emphasis:`_`,rule:`-`,handlers:{break:()=>`
`},unsafe:[{character:`<`}]})}};function a2(){return function(e){qW(e,`element`,(e,t,n)=>{t!==null&&e.tagName===`label`&&n.type===`element`&&n.tagName===`li`&&n.children.splice(t,1,...e.children)})}}var o2=class{_htmlDP;_markdown2html;_html2markdown;constructor(e){this._htmlDP=new Td(e),this._markdown2html=new R$,this._html2markdown=new i2}keepHtml(e){this._html2markdown.keep(e)}toView(e){let t=this._markdown2html.parse(e);return this._htmlDP.toView(t)}toData(e){let t=this._htmlDP.toData(e);return this._html2markdown.parse(t)}registerRawContentMatcher(e){this._htmlDP.registerRawContentMatcher(e)}useFillerType(){}},s2=class extends F{constructor(e){super(e),e.data.processor=new o2(e.data.viewDocument)}static get pluginName(){return`Markdown`}static get isOfficialPlugin(){return!0}};const c2=[`SPAN`,`BR`,`PRE`,`CODE`];var l2=class extends F{_gfmDataProcessor;constructor(e){super(e),this._gfmDataProcessor=new o2(e.data.viewDocument)}static get pluginName(){return`PasteFromMarkdownExperimental`}static get isOfficialPlugin(){return!0}static get requires(){return[_O]}init(){let e=this.editor,t=e.editing.view.document,n=e.plugins.get(`ClipboardPipeline`),r=!1;this.listenTo(t,`keydown`,(e,t)=>{r=t.shiftKey}),this.listenTo(n,`inputTransformation`,(e,t)=>{if(r)return;let n=t.dataTransfer.getData(`text/html`);if(!n){let e=t.dataTransfer.getData(`text/plain`);t.content=this._gfmDataProcessor.toView(e);return}let i=this._parseMarkdownFromHtml(n);i&&(t.content=this._gfmDataProcessor.toView(i))})}_parseMarkdownFromHtml(e){let t=this._removeOsSpecificTags(e);if(!this._containsOnlyAllowedFirstLevelTags(t))return null;let n=this._removeFirstLevelWrapperTagsAndBrs(t);return this._containsAnyRemainingHtmlTags(n)?null:this._replaceHtmlReservedEntitiesWithCharacters(n)}_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){let{body:t}=new DOMParser().parseFromString(e,`text/html`);return Array.from(t.children).map(e=>e.tagName).every(e=>c2.includes(e))}_removeFirstLevelWrapperTagsAndBrs(e){let{body:t}=new DOMParser().parseFromString(e,`text/html`),n=t.querySelectorAll(`br`);for(let e of n)e.replaceWith(`
`);let r=t.querySelectorAll(`:scope > *`);for(let e of r){let t=e.cloneNode(!0);e.replaceWith(...t.childNodes)}return t.innerHTML}_containsAnyRemainingHtmlTags(e){return e.includes(`<`)}_replaceHtmlReservedEntitiesWithCharacters(e){return e.replace(/&gt;/g,`>`).replace(/&lt;/g,`<`).replace(/&nbsp;/g,` `)}};function u2(e,t){let n=(n,r,i)=>{if(!i.consumable.consume(r.item,n.name))return;let a=r.attributeNewValue,o=i.writer,s=i.mapper.toViewElement(r.item),c=[...s.getChildren()].find(e=>e.getCustomProperty(`media-content`));o.remove(c);let l=e.getMediaViewElement(o,a,t);o.insert(o.createPositionAt(s,0),l)};return e=>{e.on(`attribute:url:media`,n)}}function d2(e,t,n){return t.setCustomProperty(`media`,!0,e),UE(e,t,{label:n})}function f2(e){let t=e.getSelectedElement();return t&&p2(t)?t:null}function p2(e){return!!e.getCustomProperty(`media`)&&HE(e)}function m2(e,t,n,r){return e.createContainerElement(`figure`,{class:`media`},[t.getMediaViewElement(e,n,r),e.createSlot()])}function h2(e){let t=e.getSelectedElement();return t&&t.is(`element`,`media`)?t:null}function g2(e,t,n,r){e.change(i=>{let a=i.createElement(`media`,{url:t});e.insertObject(a,n,null,{setSelection:`on`,findOptimalPosition:r?`auto`:void 0})})}var _2=class extends I{refresh(){let e=this.editor.model,t=e.document.selection,n=h2(t);this.value=n?n.getAttribute(`url`):void 0,this.isEnabled=y2(t)||v2(t,e)}execute(e){let t=this.editor.model,n=t.document.selection,r=h2(n);r?t.change(t=>{t.setAttribute(`url`,e,r)}):g2(t,e,n,!0)}};function v2(e,t){let n=XE(e,t).start.parent;return n.isEmpty&&!t.schema.isLimit(n)&&(n=n.parent),t.schema.checkChild(n,`media`)}function y2(e){let t=e.getSelectedElement();return!!t&&t.name===`media`}var b2=class{locale;providerDefinitions;constructor(e,t){let n=t.providers,r=t.extraProviders||[],i=new Set(t.removeProviders),a=n.concat(r).filter(e=>{let t=e.name;return t?!i.has(t):(T(`media-embed-no-provider-name`,{provider:e}),!1)});this.locale=e,this.providerDefinitions=a}hasMedia(e){return!!this._getMedia(e)}getMediaViewElement(e,t,n){return this._getMedia(t).getViewElement(e,n)}_getMedia(e){if(!e)return new x2(this.locale);e=e.trim();for(let t of this.providerDefinitions){let n=t.html,r=A(t.url);for(let t of r){let r=this._getUrlMatches(e,t);if(r)return new x2(this.locale,e,r,n)}}return null}_getUrlMatches(e,t){let n=e.match(t);if(n)return n;let r=e.replace(/^https?:\/\//,``);return n=r.match(t),n||(r=r.replace(/^www\./,``),n=r.match(t),n)?n:null}},x2=class{url;_locale;_match;_previewRenderer;constructor(e,t,n,r){this.url=this._getValidUrl(t),this._locale=e,this._match=n,this._previewRenderer=r}getViewElement(e,t){let n={},r;if(t.renderForEditingView||t.renderMediaPreview&&this.url&&this._previewRenderer){this.url&&(n[`data-oembed-url`]=this.url),t.renderForEditingView&&(n.class=`ck-media__wrapper`);let i=this._getPreviewHtml(t);r=e.createRawElement(`div`,n,(e,t)=>{t.setContentOf(e,i)})}else this.url&&(n.url=this.url),r=e.createEmptyElement(t.elementName,n);return e.setCustomProperty(`media-content`,!0,r),r}_getPreviewHtml(e){return this._previewRenderer?this._previewRenderer(this._match):this.url&&e.renderForEditingView?this._getPlaceholderHtml():``}_getPlaceholderHtml(){let e=new Ly,t=this._locale.t;return e.content=fv,e.viewBox=`0 0 64 42`,new ga({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}},S2=class extends F{static get pluginName(){return`MediaEmbedEditing`}static get isOfficialPlugin(){return!0}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><iframe src="https://www.dailymotion.com/embed/video/${e[1]}" width="1280" height="720" style="width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0; display: block;" frameborder="0" 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=>{let t=e[1],n=t.startsWith(`track/`);return`<div><iframe src="https://open.spotify.com/embed/${t}" width="300" height="${n?`80`:`378`}" style="${n?`width: 100%; height: 80px; border: 0; display: block;`:`width: 100%; height: auto; aspect-ratio: 100 / 126; border: 0; display: block;`}" 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=>{let t=e[1],n=e[2];return`<div><iframe src="https://www.youtube.com/embed/${t}${n?`?start=${n}`:``}" width="1280" height="720" style="width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0; display: block;" 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><iframe src="https://player.vimeo.com/video/${e[1]}" width="1280" height="720" style="width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0; display: block;" 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 b2(e.locale,e.config.get(`mediaEmbed`))}init(){let e=this.editor,t=e.model.schema,n=e.t,r=e.conversion,i=e.config.get(`mediaEmbed.previewsInData`),a=e.config.get(`mediaEmbed.elementName`),o=this.registry;e.commands.add(`mediaEmbed`,new _2(e)),t.register(`media`,{inheritAllFrom:`$blockObject`,allowAttributes:[`url`]}),r.for(`dataDowncast`).elementToStructure({model:`media`,view:(e,{writer:t})=>{let n=e.getAttribute(`url`);return m2(t,o,n,{elementName:a,renderMediaPreview:!!n&&i})}}),r.for(`dataDowncast`).add(u2(o,{elementName:a,renderMediaPreview:i})),r.for(`editingDowncast`).elementToStructure({model:`media`,view:(e,{writer:t})=>d2(m2(t,o,e.getAttribute(`url`),{elementName:a,renderForEditingView:!0}),t,n(`media widget`))}),r.for(`editingDowncast`).add(u2(o,{elementName:a,renderForEditingView:!0})),r.for(`upcast`).elementToElement({view:e=>[`oembed`,a].includes(e.name)&&e.getAttribute(`url`)?{name:!0}:null,model:(e,{writer:t})=>{let n=e.getAttribute(`url`);return o.hasMedia(n)?t.createElement(`media`,{url:n}):null}}).elementToElement({view:{name:`div`,attributes:{"data-oembed-url":!0}},model:(e,{writer:t})=>{let n=e.getAttribute(`data-oembed-url`);return o.hasMedia(n)?t.createElement(`media`,{url:n}):null}}).add(e=>{e.on(`element:figure`,(e,t,n)=>{if(!n.consumable.consume(t.viewItem,{name:!0,classes:`media`}))return;let{modelRange:r,modelCursor:i}=n.convertChildren(t.viewItem,t.modelCursor);t.modelRange=r,t.modelCursor=i,j(r.getItems())||n.consumable.revert(t.viewItem,{name:!0,classes:`media`})})})}};const C2=/^(?:http(s)?:\/\/)?[\w-]+\.[\w-.~:/?#[\]@!$&'()*+,;=%]+$/;var w2=class extends F{static get requires(){return[PO,hT,Ik]}static get pluginName(){return`AutoMediaEmbed`}static get isOfficialPlugin(){return!0}_timeoutId;_positionToInsert;constructor(e){super(e),this._timeoutId=null,this._positionToInsert=null}init(){let e=this.editor,t=e.model.document,n=e.plugins.get(`ClipboardPipeline`);this.listenTo(n,`inputTransformation`,()=>{let e=t.selection.getFirstRange(),n=pf.fromPosition(e.start);n.stickiness=`toPrevious`;let r=pf.fromPosition(e.end);r.stickiness=`toNext`,t.once(`change:data`,()=>{this._embedMediaBetweenPositions(n,r),n.detach(),r.detach()},{priority:`high`})}),e.commands.get(`undo`).on(`execute`,()=>{this._timeoutId&&(u.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)},{priority:`high`})}_embedMediaBetweenPositions(e,t){let n=this.editor,r=n.plugins.get(S2).registry,i=new xl(e,t),a=i.getWalker({ignoreElementEnd:!0}),o=``;for(let e of a)e.item.is(`$textProxy`)&&(o+=e.item.data);if(o=o.trim(),!o.match(C2)){i.detach();return}if(!r.hasMedia(o)){i.detach();return}if(!n.commands.get(`mediaEmbed`).isEnabled){i.detach();return}this._positionToInsert=pf.fromPosition(e),this._timeoutId=u.window.setTimeout(()=>{n.model.change(e=>{this._timeoutId=null,e.remove(i),i.detach();let t=null;this._positionToInsert.root.rootName!==`$graveyard`&&(t=this._positionToInsert),g2(n.model,o,t,!1),this._positionToInsert.detach(),this._positionToInsert=null}),n.plugins.get(hT).requestUndoOnBackspace()},100)}},T2=class extends P{focusTracker;keystrokes;urlInputView;_validators;_urlInputViewInfoDefault;_urlInputViewInfoTip;constructor(e,t){super(t),this.focusTracker=new M,this.keystrokes=new N,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(),Qa({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(let e of this._validators){let t=e(this);if(t)return this.urlInputView.errorText=t,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null,this.urlInputView.infoText=this._urlInputViewInfoDefault}_createUrlInput(){let e=this.locale.t,t=new Qb(this.locale,Jx),n=t.fieldView;return this._urlInputViewInfoDefault=e(`Paste the media URL in the input.`),this._urlInputViewInfoTip=e(`Tip: Paste the URL into the content to embed faster.`),t.label=e(`Media URL`),t.infoText=this._urlInputViewInfoDefault,n.inputMode=`url`,n.on(`input`,()=>{t.infoText=n.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault,this.mediaURLInputValue=n.element.value.trim()}),t}},E2=class extends F{static get requires(){return[S2,Qy]}static get pluginName(){return`MediaEmbedUI`}static get isOfficialPlugin(){return!0}_formView;init(){let e=this.editor;e.ui.componentFactory.add(`mediaEmbed`,()=>{let e=this.editor.locale.t,t=this._createDialogButton(H);return t.tooltip=!0,t.label=e(`Insert media`),t}),e.ui.componentFactory.add(`menuBar:mediaEmbed`,()=>{let e=this.editor.locale.t,t=this._createDialogButton(U);return t.label=e(`Media`),t})}_createDialogButton(e){let t=this.editor,n=new e(t.locale),r=t.commands.get(`mediaEmbed`),i=this.editor.plugins.get(`Dialog`);return n.icon=pv,n.bind(`isEnabled`).to(r,`isEnabled`),n.on(`execute`,()=>{i.id===`mediaEmbed`?i.hide():this._showDialog()}),n}_showDialog(){let e=this.editor,t=e.plugins.get(`Dialog`),n=e.commands.get(`mediaEmbed`),r=e.locale.t,i=n.value!==void 0;if(!this._formView){let t=e.plugins.get(S2).registry;this._formView=new(Xa(T2))(D2(e.t,t),e.locale),this._formView.on(`submit`,()=>this._handleSubmitForm())}t.show({id:`mediaEmbed`,title:r(`Media embed`),content:this._formView,isModal:!0,onShow:()=>{this._formView.url=n.value||``,this._formView.resetFormStatus(),this._formView.urlInputView.fieldView.select()},actionButtons:[{label:r(`Cancel`),withText:!0,onExecute:()=>t.hide()},{label:r(i?`Save`:`Insert`),class:`ck-button-action`,withText:!0,onExecute:()=>this._handleSubmitForm()}]})}_handleSubmitForm(){let e=this.editor,t=e.plugins.get(`Dialog`);this._formView.isValid()&&(e.execute(`mediaEmbed`,this._formView.url),t.hide(),e.editing.view.focus())}};function D2(e,t){return[t=>{if(!t.url.length)return e(`The URL must not be empty.`)},n=>{if(!t.hasMedia(n.url))return e(`This media URL is not supported.`)}]}var O2=class extends F{static get requires(){return[S2,E2,w2,xD]}static get pluginName(){return`MediaEmbed`}static get isOfficialPlugin(){return!0}};const k2={alignLeft:{name:`alignLeft`,title:`Left aligned media`,icon:xv,className:`media-style-align-left`},alignBlockLeft:{name:`alignBlockLeft`,title:`Left aligned media`,icon:wv,className:`media-style-block-align-left`},alignCenter:{name:`alignCenter`,title:`Centered media`,icon:yv,isDefault:!0},alignBlockRight:{name:`alignBlockRight`,title:`Right aligned media`,icon:Tv,className:`media-style-block-align-right`},alignRight:{name:`alignRight`,title:`Right aligned media`,icon:Sv,className:`media-style-align-right`}},A2={inlineLeft:xv,left:wv,center:yv,right:Tv,inlineRight:Sv},j2=[{name:`mediaEmbed:wrapText`,title:`Wrap text`,items:[`mediaEmbed:alignLeft`,`mediaEmbed:alignRight`],defaultItem:`mediaEmbed:alignLeft`},{name:`mediaEmbed:breakText`,title:`Break text`,items:[`mediaEmbed:alignBlockLeft`,`mediaEmbed:alignCenter`,`mediaEmbed:alignBlockRight`],defaultItem:`mediaEmbed:alignCenter`}];function M2(e){return(e.options||[]).map(e=>N2(e)).filter(e=>P2(e))}function N2(e){let t=typeof e==`string`?{name:e}:e,n={...k2[t.name],...t};return typeof n.icon==`string`&&A2[n.icon]&&(n.icon=A2[n.icon]),n}function P2(e){return!e.name||!e.title||!e.icon||!e.isDefault&&!e.className?(F2({style:e}),!1):!0}function F2(e){T(`media-style-configuration-definition-invalid`,e)}function I2(e){return typeof e==`object`&&!!e&&typeof e.defaultItem==`string`}var L2=class extends F{static get requires(){return[kD]}static get pluginName(){return`MediaEmbedToolbar`}static get isOfficialPlugin(){return!0}afterInit(){let e=this.editor,t=e.t;e.plugins.get(kD).register(`mediaEmbed`,{ariaLabel:t(`Media toolbar`),items:R2(e.ui.componentFactory,e.config.get(`mediaEmbed.toolbar`)||[]),getRelatedElement:f2})}};function R2(e,t){return t.map(e=>I2(e)?e.name:e).filter(t=>typeof t!=`string`||!t.startsWith(`mediaEmbed:`)||e.has(t))}var z2=class extends I{refresh(){let e=h2(this.editor.model.document.selection);this.isEnabled=!!e,!e||!e.hasAttribute(`resizedWidth`)?this.value=null:this.value=e.getAttribute(`resizedWidth`)}execute(e){let t=this.editor.model,n=h2(t.document.selection);n&&t.change(t=>{t.setAttribute(`resizedWidth`,e.width,n)})}};const B2=`media_resized`;var V2=class extends F{static get requires(){return[S2]}static get pluginName(){return`MediaEmbedResizeEditing`}static get licenseFeatureCode(){return`MER`}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}constructor(e){super(e),e.config.define(`mediaEmbed`,{resizeUnit:`%`,resizeOptions:[{name:`resizeMediaEmbed:original`,value:null,icon:`original`},{name:`resizeMediaEmbed:custom`,value:`custom`,icon:`custom`},{name:`resizeMediaEmbed:25`,value:`25`,icon:`small`},{name:`resizeMediaEmbed:50`,value:`50`,icon:`medium`},{name:`resizeMediaEmbed:75`,value:`75`,icon:`large`}]})}init(){let e=this.editor;e.commands.add(`resizeMediaEmbed`,new z2(e)),this._registerConverters()}afterInit(){this._registerSchema()}_registerSchema(){let e=this.editor.model.schema;e.extend(`media`,{allowAttributes:[`resizedWidth`]}),e.setAttributeProperties(`resizedWidth`,{isFormatting:!0})}_registerConverters(){let e=this.editor;e.conversion.for(`downcast`).add(e=>e.on(`attribute:resizedWidth:media`,(e,t,n)=>{if(!n.consumable.consume(t.item,e.name))return;let r=n.writer,i=n.mapper.toViewElement(t.item);t.attributeNewValue===null?(r.removeStyle(`width`,i),r.removeClass(B2,i)):(r.setStyle(`width`,t.attributeNewValue,i),r.addClass(B2,i))})),e.conversion.for(`upcast`).attributeToAttribute({view:{name:`figure`,styles:{width:/.+/}},model:{key:`resizedWidth`,value:e=>e.hasClass(`media`)?e.getStyle(`width`):null}}),e.conversion.for(`upcast`).add(e=>{e.on(`element:figure`,(e,t,n)=>{n.consumable.consume(t.viewItem,{classes:[B2]})})})}},H2=class extends F{static get requires(){return[GD]}static get pluginName(){return`MediaEmbedResizeHandles`}static get isOfficialPlugin(){return!0}init(){let e=this.editor.commands.get(`resizeMediaEmbed`);this.bind(`isEnabled`).to(e),this._setupResizerCreator()}_setupResizerCreator(){let e=this.editor,t=e.model,n=e.plugins.get(GD);this.listenTo(t.document,`change:data`,()=>{for(let r of t.document.differ.getChanges()){if(r.type!==`insert`||r.name===`$text`)continue;let i=t.createRange(r.position,r.position.getShiftedBy(r.length));for(let t of i.getItems()){if(!t.is(`element`,`media`))continue;let r=e.editing.mapper.toViewElement(t);r&&(n.getResizerByViewElement(r)||this._attachResizer(t,r))}}},{priority:`low`})}_attachResizer(e,t){let n=this.editor,r=n.editing.view,i=n.plugins.get(GD).attachTo({unit:n.config.get(`mediaEmbed.resizeUnit`),modelElement:e,viewElement:t,editor:n,getHandleHost:e=>e.querySelector(`.ck-media__wrapper`),getResizeHost:e=>e,onCommit:e=>{r.change(e=>e.removeClass(B2,t)),n.execute(`resizeMediaEmbed`,{width:e})}});i.bind(`isEnabled`).to(this),i.on(`updateSize`,()=>{t.hasClass(`media_resized`)||r.change(e=>e.addClass(B2,t))}),r.once(`render`,()=>i.redraw())}};const U2={small:Av,medium:kv,large:Ov,custom:Ev,original:Dv};var W2=class extends F{static get requires(){return[V2]}static get pluginName(){return`MediaEmbedResizeButtons`}static get isOfficialPlugin(){return!0}_resizeUnit;constructor(e){super(e),this._resizeUnit=e.config.get(`mediaEmbed.resizeUnit`)}init(){let e=this.editor,t=e.config.get(`mediaEmbed.resizeOptions`),n=e.commands.get(`resizeMediaEmbed`);this.bind(`isEnabled`).to(n);for(let e of t)this._registerMediaEmbedResizeButton(e);this._registerMediaEmbedResizeDropdown(t)}_registerMediaEmbedResizeButton(e){let t=this.editor,{name:n,value:r,icon:i}=e;t.ui.componentFactory.add(n,n=>{let a=new H(n),o=t.commands.get(`resizeMediaEmbed`),s=this._getOptionLabelValue(e,!0);if(!U2[i])throw new w(`mediaembedresizebuttons-missing-icon`,t,e);if(a.set({label:s,icon:U2[i],tooltip:s,isToggleable:!0}),a.bind(`isEnabled`).to(this),t.plugins.has(`MediaEmbedCustomResizeUI`)&&G2(e)){let e=t.plugins.get(`MediaEmbedCustomResizeUI`);this.listenTo(a,`execute`,()=>{e._showForm(this._resizeUnit)})}else{let e=r?r+this._resizeUnit:null;a.bind(`isOn`).to(o,`value`,o,`isEnabled`,K2(e)),this.listenTo(a,`execute`,()=>{t.execute(`resizeMediaEmbed`,{width:e})})}return a})}_registerMediaEmbedResizeDropdown(e){let t=this.editor,n=t.t,r=e.find(e=>!e.value);t.ui.componentFactory.add(`resizeMediaEmbed`,i=>{let a=t.commands.get(`resizeMediaEmbed`),o=Nx(i,cx),s=o.buttonView,c=n(`Resize media`);return s.set({tooltip:c,commandValue:r?r.value:null,icon:U2.medium,isToggleable:!0,label:r?this._getOptionLabelValue(r):``,withText:!0,class:`ck-resize-media-embed-button`,ariaLabel:c,ariaLabelledBy:void 0}),s.bind(`label`).to(a,`value`,e=>e||(r?this._getOptionLabelValue(r):``)),o.bind(`isEnabled`).to(this),Lx(o,()=>this._getResizeDropdownListItemDefinitions(e,a),{ariaLabel:n(`Media resize list`),role:`menu`}),this.listenTo(o,`execute`,e=>{`onClick`in e.source?e.source.onClick():(t.execute(e.source.commandName,{width:e.source.commandValue}),t.editing.view.focus())}),o})}_getOptionLabelValue(e,t=!1){let n=this.editor.t;if(e.label)return e.label;let r=G2(e);return t?r?n(`Custom media size`):e.value?n(`Resize media to %0`,e.value+this._resizeUnit):n(`Resize media to the original size`):r?n(`Custom`):e.value?e.value+this._resizeUnit:n(`Original`)}_getResizeDropdownListItemDefinitions(e,t){let{editor:n}=this,r=new Fi,i=e.map(e=>G2(e)?{...e,valueWithUnits:`custom`}:e.value?{...e,valueWithUnits:`${e.value}${this._resizeUnit}`}:{...e,valueWithUnits:null});for(let e of i){let a=null;if(n.plugins.has(`MediaEmbedCustomResizeUI`)&&G2(e)){let r=n.plugins.get(`MediaEmbedCustomResizeUI`);a={type:`button`,model:new RC({label:this._getOptionLabelValue(e),role:`menuitemradio`,withText:!0,icon:null,onClick:()=>{r._showForm(this._resizeUnit)}})};let o=Object.values(i).map(e=>e.valueWithUnits);a.model.bind(`isOn`).to(t,`value`,t,`isEnabled`,q2(o))}else a={type:`button`,model:new RC({commandName:`resizeMediaEmbed`,commandValue:e.valueWithUnits,label:this._getOptionLabelValue(e),role:`menuitemradio`,withText:!0,icon:null})},a.model.bind(`isOn`).to(t,`value`,t,`isEnabled`,K2(e.valueWithUnits));a.model.bind(`isEnabled`).to(t,`isEnabled`),r.add(a)}return r}};function G2(e){return e.value===`custom`}function K2(e){return(t,n)=>t===void 0||!n?!1:t===e}function q2(e){return(t,n)=>!e.some(e=>K2(e)(t,n))}function J2(e){let{editing:t}=e,n=h2(e.model.document.selection);if(!n)return null;let r=t.mapper.toViewElement(n);return{model:n,view:r,dom:t.view.domConverter.mapViewToDom(r)}}function Y2(e,t){let n=J2(e);if(!n)return null;let r=da(n.model.getAttribute(`resizedWidth`)||null);return r?r.unit===t?r:fa(eD(n.dom),{unit:`px`,value:new O(n.dom).width},t):null}function X2(e,t){let n=J2(e);if(!n)return null;let r=eD(n.dom),i=da(window.getComputedStyle(n.dom).minWidth)||{value:1,unit:`px`};return{unit:t,lower:Math.max(.1,fa(r,i,t).value),upper:t===`px`?r:100}}var Z2=class extends P{focusTracker;keystrokes;unit;backButtonView;saveButtonView;labeledInput;children;_focusables;_focusCycler;_validators;constructor(e,t,n){super(e),this.focusTracker=new M,this.keystrokes=new N,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 MC(e,{children:[this.labeledInput,this.saveButtonView],class:[`ck-form__row_with-submit`,`ck-form__row_large-top-padding`]})),this._focusables=new pa,this._validators=n,this.keystrokes.set(`Esc`,(e,t)=>{this.fire(`cancel`),t()}),this._focusCycler=new Hy({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-media-embed-custom-resize-form`,`ck-responsive-form`],tabindex:`-1`},children:this.children})}render(){super.render(),Qa({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(){let e=this.locale.t,t=new H(this.locale);return t.set({class:`ck-button-back`,label:e(`Back`),icon:Wv,tooltip:!0}),t.delegate(`execute`).to(this,`cancel`),t}_createSaveButton(){let e=this.locale.t,t=new H(this.locale);return t.set({label:e(`Save`),withText:!0,type:`submit`,class:`ck-button-action ck-button-bold`}),t}_createHeaderView(){let e=this.locale.t,t=new By(this.locale,{label:e(`Media Resize`)});return t.children.add(this.backButtonView,0),t}_createLabeledInputView(){let e=this.locale.t,t=new Qb(this.locale,Yx);return t.label=e(`Resize media (in %0)`,this.unit),t.class=`ck-labeled-field-view_full-width`,t.fieldView.set({min:.1,step:.1}),t}isValid(){this.resetFormStatus();for(let e of this._validators){let t=e(this);if(t)return this.labeledInput.errorText=t,!1}return!0}resetFormStatus(){this.labeledInput.errorText=null}get rawSize(){let{element:e}=this.labeledInput.fieldView;return e?e.value:null}get parsedSize(){let{rawSize:e}=this;if(e===null)return null;let t=Number.parseFloat(e);return Number.isNaN(t)?null:t}get sizeWithUnits(){let{parsedSize:e,unit:t}=this;return e===null?null:`${e}${t}`}},Q2=class extends F{_balloon;_form;static get requires(){return[BC]}static get pluginName(){return`MediaEmbedCustomResizeUI`}static get isOfficialPlugin(){return!0}destroy(){super.destroy(),this._form&&this._form.destroy()}_createForm(e){let t=this.editor;this._balloon=this.editor.plugins.get(`ContextualBalloon`);let n=Xa(Z2);this._form=new n(t.locale,e,e4(t)),this._form.render(),this.listenTo(this._form,`submit`,()=>{this._form.isValid()&&(t.execute(`resizeMediaEmbed`,{width:this._form.sizeWithUnits}),this._hideForm(!0))}),this.listenTo(this._form.labeledInput,`change:errorText`,()=>{t.ui.update()}),this.listenTo(this._form,`cancel`,()=>{this._hideForm(!0)}),Ya({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);let t=this.editor,n=this._form.labeledInput;this._form.disableCssTransitions(),this._form.resetFormStatus(),this._isInBalloon||this._balloon.add({view:this._form,position:$2(t)});let r=Y2(t,e),i=r?r.value.toFixed(1):``,a=X2(t,e);n.fieldView.value=n.fieldView.element.value=i,a&&Object.assign(n.fieldView,{min:a.lower.toFixed(1),max:Math.ceil(a.upper).toFixed(1)}),this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(e=!1){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),e&&this.editor.editing.view.focus())}get _isVisible(){return!!this._balloon&&this._balloon.visibleView===this._form}get _isInBalloon(){return!!this._balloon&&this._balloon.hasView(this._form)}};function $2(e){let t=e.editing.view,n=ab.defaultPositions;return{target:t.domConverter.mapViewToDom(f2(t.document.selection)),positions:[n.northArrowSouth,n.northArrowSouthWest,n.northArrowSouthEast,n.southArrowNorth,n.southArrowNorthWest,n.southArrowNorthEast,n.viewportStickyNorth]}}function e4(e){let t=e.t;return[e=>{if(e.rawSize.trim()===``)return t(`The value must not be empty.`);if(e.parsedSize===null)return t(`The value should be a plain number.`)}]}var t4=class extends F{static get requires(){return[V2,H2,Q2,W2]}static get pluginName(){return`MediaEmbedResize`}static get isOfficialPlugin(){return!0}},n4=class extends I{_styles;_defaultStyleName;constructor(e,t){super(e),this._styles=new Map(t.map(e=>[e.name,e]));let n=t.find(e=>e.isDefault);this._defaultStyleName=n?n.name:null}refresh(){let e=h2(this.editor.model.document.selection);if(this.isEnabled=!!e,!e)this.value=!1;else if(e.hasAttribute(`mediaStyle`)){let t=e.getAttribute(`mediaStyle`);this.value=this._styles.has(t)?t:this._defaultStyleName??!1}else this.value=this._defaultStyleName??!1}execute(e){let t=this.editor.model,n=h2(t.document.selection),r=e.value;if(!r||this._styles.get(r)?.isDefault){t.change(e=>{e.removeAttribute(`mediaStyle`,n)});return}this._styles.has(r)&&t.change(e=>{e.setAttribute(`mediaStyle`,r,n)})}},r4=class extends F{normalizedStyles;static get requires(){return[S2]}static get pluginName(){return`MediaEmbedStyleEditing`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.model.schema;e.config.define(`mediaEmbed.styles`,{options:Object.keys(k2)}),this.normalizedStyles=M2(e.config.get(`mediaEmbed.styles`)),t.extend(`media`,{allowAttributes:[`mediaStyle`]}),t.setAttributeProperties(`mediaStyle`,{isFormatting:!0}),e.commands.add(`mediaStyle`,new n4(e,this.normalizedStyles)),this._registerConverters()}_registerConverters(){let e=this.editor,t=new Map(this.normalizedStyles.filter(e=>!e.isDefault&&e.className).map(e=>[e.name,e.className]));e.conversion.for(`downcast`).add(e=>e.on(`attribute:mediaStyle:media`,(e,n,r)=>{if(!r.consumable.consume(n.item,e.name))return;let i=r.mapper.toViewElement(n.item),a=r.writer,o=t.get(n.attributeOldValue),s=t.get(n.attributeNewValue);o&&a.removeClass(o,i),s&&a.addClass(s,i)})),e.conversion.for(`upcast`).add(e=>{e.on(`element:figure`,(e,n,r)=>{if(!n.modelRange)return;let i=j(n.modelRange.getItems());if(!(!i||!i.is(`element`,`media`)))for(let[e,a]of t)r.consumable.consume(n.viewItem,{classes:a})&&r.writer.setAttribute(`mediaStyle`,e,i)},{priority:`low`})})}},i4=class extends F{static get requires(){return[r4]}static get pluginName(){return`MediaEmbedStyleUI`}static get isOfficialPlugin(){return!0}init(){let e=this._getLocalizedTitles();for(let t of this._getButtonDefinitions(e))this._createButton(t);for(let t of this._getDropdownDefinitions(e))this._createDropdown(t)}_getButtonDefinitions(e){return this.editor.plugins.get(r4).normalizedStyles.map(t=>({name:t.name,label:e[t.title]||t.title,icon:t.icon}))}_getLocalizedTitles(){let e=this.editor.t;return{"Left aligned media":e(`Left aligned media`),"Centered media":e(`Centered media`),"Right aligned media":e(`Right aligned media`),"Wrap text":e(`Wrap text`),"Break text":e(`Break text`)}}_getDropdownDefinitions(e){let t=this.editor.plugins.get(r4),n=new Set(t.normalizedStyles.map(({name:e})=>`mediaEmbed:${e}`)),r=[],i=(t,i)=>{let a=t.items.filter(e=>n.has(e));if(i&&a.length!==t.items.length&&s4({dropdown:t}),a.length<2)return;let o=n.has(t.defaultItem)?t.defaultItem:a[0];r.push({name:t.name,title:e[t.title]||t.title,items:a,defaultItem:o})};for(let e of j2)i(e,!1);for(let e of this._collectCustomDropdowns())i(e,!0);return r}_collectCustomDropdowns(){return(this.editor.config.get(`mediaEmbed.toolbar`)||[]).filter(e=>I2(e)&&o4(e))}_createButton(e){let t=this.editor,n=`mediaEmbed:${e.name}`;t.ui.componentFactory.add(n,n=>{let r=t.commands.get(`mediaStyle`),i=new H(n);return i.set({label:e.label,icon:e.icon,tooltip:!0,isToggleable:!0}),i.bind(`isEnabled`).to(r,`isEnabled`),i.bind(`isOn`).to(r,`value`,t=>t===e.name),i.on(`execute`,()=>{t.execute(`mediaStyle`,{value:e.name}),t.editing.view.focus()}),i})}_createDropdown(e){let t=this.editor,n=t.ui.componentFactory;n.add(e.name,r=>{let i=e.items.map(e=>n.create(e)),a=i[e.items.indexOf(e.defaultItem)],o=(...e)=>{let t=e.findIndex(Boolean);return t<0?a:i[t]},s=Nx(r,Mx),c=s.buttonView;return Fx(s,i,{enableActiveItemFocusOnDropdownOpen:!0}),c.set({label:a4(e.title,a.label),class:null,tooltip:!0}),c.arrowView.unbind(`label`),c.arrowView.set({label:e.title}),c.bind(`icon`).toMany(i,`isOn`,(...e)=>o(...e).icon),c.bind(`label`).toMany(i,`isOn`,(...t)=>a4(e.title,o(...t).label)),c.bind(`isOn`).toMany(i,`isOn`,(...e)=>e.some(Boolean)),c.bind(`class`).toMany(i,`isOn`,(...e)=>e.some(Boolean)?`ck-splitbutton_flatten`:void 0),this.listenTo(c,`execute`,()=>{i.some(({isOn:e})=>e)?s.isOpen=!s.isOpen:a.fire(`execute`)}),s.bind(`isEnabled`).toMany(i,`isEnabled`,(...e)=>e.some(Boolean)),this.listenTo(s,`execute`,()=>{t.editing.view.focus()}),s})}};function a4(e,t){return`${e}: ${t}`}function o4(e){let t=e.name.startsWith(`mediaEmbed:`)&&typeof e.title==`string`&&e.title.length>0&&e.items.length>0&&e.items.every(e=>typeof e==`string`&&e.startsWith(`mediaEmbed:`))&&e.items.includes(e.defaultItem);return t||s4({dropdown:e}),t}function s4(e){T(`media-style-configuration-definition-invalid`,e)}var c4=class extends F{static get requires(){return[r4,i4]}static get pluginName(){return`MediaEmbedStyle`}static get isOfficialPlugin(){return!0}};const l4=Wr(`px`);var u4=class extends NC{_options;constructor(e,t){super(e);let n=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:n.to(`top`,e=>l4(e)),height:n.to(`height`,e=>l4(e))}}})}render(){return super.render().then(()=>{this._prepareDocument()})}setHeight(e){this.height=e}setTopOffset(e){this.top=e}_prepareDocument(){let e=this.element.contentWindow.document,t=e.adoptNode(this._options.domRootClone),n=this._options.useSimplePreview?`
.ck.ck-editor__editable_inline img {
filter: contrast( 0 );
}
p, li, a, figcaption, span {
background: hsl(0, 0%, 80%) !important;
color: hsl(0, 0%, 80%) !important;
}
h1, h2, h3, h4 {
background: hsl(0, 0%, 60%) !important;
color: hsl(0, 0%, 60%) !important;
}
`:``,r=`<!DOCTYPE html><html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
${this._options.pageStyles.map(e=>typeof e==`string`?`<style>${e}</style>`:`<link rel="stylesheet" type="text/css" href="${e.href}">`).join(`
`)}
<style>
html, body {
margin: 0 !important;
padding: 0 !important;
}
html {
overflow: hidden;
}
body {
transform: scale( ${this._options.scaleRatio} );
transform-origin: 0 0;
overflow: visible;
}
.ck.ck-editor__editable_inline {
margin: 0 !important;
border-color: transparent !important;
outline-color: transparent !important;
box-shadow: none !important;
}
.ck.ck-content {
background: white;
}
${n}
</style>
</head>
<body class="${this._options.extraClasses||``}"></body>
</html>`;e.open(),e.write(r),e.close(),e.body.appendChild(t)}};const d4=Wr(`px`);var f4=class extends P{constructor(e){super(e);let t=this.bindTemplate;this.set(`height`,0),this.set(`top`,0),this.set(`scrollProgress`,0),this.set(`_isDragging`,!1),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=>d4(e)),height:t.to(`height`,e=>d4(e))},"data-progress":t.to(`scrollProgress`)},on:{mousedown:t.to(()=>{this._isDragging=!0})}})}render(){super.render(),this.listenTo(u.document,`mousemove`,(e,t)=>{this._isDragging&&this.fire(`drag`,t.movementY)},{useCapture:!0}),this.listenTo(u.document,`mouseup`,()=>{this._isDragging=!1},{useCapture:!0})}setHeight(e){this.height=e}setTopOffset(e){this.top=e}setScrollProgress(e){this.scrollProgress=e}},p4=class extends P{_positionTrackerView;_scaleRatio;_minimapIframeView;constructor({locale:e,scaleRatio:t,pageStyles:n,extraClasses:r,useSimplePreview:i,domRootClone:a}){super(e);let o=this.bindTemplate;this._positionTrackerView=new f4(e),this._positionTrackerView.delegate(`drag`).to(this),this._scaleRatio=t,this._minimapIframeView=new u4(e,{useSimplePreview:i,pageStyles:n,extraClasses:r,scaleRatio:t,domRootClone:a}),this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-minimap`]},children:[this._positionTrackerView],on:{click:o.to(this._handleMinimapClick.bind(this)),wheel:o.to(this._handleMinimapMouseWheel.bind(this))}})}destroy(){this._minimapIframeView.destroy(),super.destroy()}get height(){return new O(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){let t=this._minimapIframeView,n=this._positionTrackerView;if(t.height<this.height)t.setTopOffset(0),n.setTopOffset((t.height-n.height)*e);else{let r=t.height-this.height;t.setTopOffset(-r*e),n.setTopOffset((this.height-n.height)*e)}n.setScrollProgress(Math.round(e*100))}setPositionTrackerHeight(e){this._positionTrackerView.setHeight(e*this._scaleRatio)}_handleMinimapClick(e){let t=this._positionTrackerView;if(e.target===t.element)return;let n=new O(t.element),r=(e.clientY-n.top-n.height/2)/this._minimapIframeView.height;this.fire(`click`,r)}_handleMinimapMouseWheel(e){this.fire(`drag`,e.deltaY*this._scaleRatio)}};function m4(e,t){let n=e.editing.view.document,r=n.getRoot(t),i=new _c(n),a=new rc(i,n.selection),o=e.editing.view.getDomRoot().cloneNode();return i.bindElements(o,r),a.markToSync(`children`,r),a.markToSync(`attributes`,r),r.on(`change:children`,(e,t)=>a.markToSync(`children`,t)),r.on(`change:attributes`,(e,t)=>a.markToSync(`attributes`,t)),r.on(`change:text`,(e,t)=>a.markToSync(`text`,t)),a.render(),e.editing.view.on(`render`,()=>a.render()),e.on(`destroy`,()=>{i.unbindDomElement(o)}),o}function h4(){return Array.from(u.document.styleSheets).map(e=>e.href&&!e.href.startsWith(u.window.location.origin)?{href:e.href}:Array.from(e.cssRules).filter(e=>!(e instanceof CSSMediaRule)).map(e=>e.cssText).join(`
`))}function g4(e){return new O(e===u.document.body?u.window:e)}function _4(e){return e===u.document.body?u.window.innerHeight:e.clientHeight}function v4(e){return e===u.document.body?u.window:e}var y4=class extends F{static get pluginName(){return`Minimap`}static get isOfficialPlugin(){return!0}_minimapView;_scrollableRootAncestor;_editingRootElement;init(){let 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(){let e=this.editor,t=this._editingRootElement=e.ui.getEditableElement();if(this._scrollableRootAncestor=wr(t),!t.ownerDocument.body.contains(t)){e.ui.once(`update`,this._onUiReady.bind(this));return}this._initializeMinimapView(),this.listenTo(e.editing.view,`render`,()=>{e.state===`ready`&&this._syncMinimapToEditingRootScrollPosition()}),this._syncMinimapToEditingRootScrollPosition()}_initializeMinimapView(){let e=this.editor,t=e.locale,n=e.config.get(`minimap.useSimplePreview`),r=e.config.get(`minimap.container`),i=this._scrollableRootAncestor,a=g4(this._editingRootElement).width,o=g4(r).width/a,s=this._minimapView=new p4({locale:t,scaleRatio:o,pageStyles:h4(),extraClasses:e.config.get(`minimap.extraClasses`),useSimplePreview:n,domRootClone:m4(e)});s.render(),s.listenTo(u.document,`scroll`,(e,t)=>{if(i===u.document.body){if(t.target!==u.document)return}else if(t.target!==i)return;this._syncMinimapToEditingRootScrollPosition()},{useCapture:!0,usePassive:!0}),s.listenTo(u.window,`resize`,()=>{this._syncMinimapToEditingRootScrollPosition()}),s.on(`drag`,(e,t)=>{let n;n=s.scrollHeight===0?0:t/s.scrollHeight;let r=n*(i.scrollHeight-_4(i));v4(i).scrollBy(0,Math.round(r))}),s.on(`click`,(e,t)=>{let n=t*i.scrollHeight;v4(i).scrollBy(0,Math.round(n))}),r.appendChild(s.element)}_syncMinimapToEditingRootScrollPosition(){let e=this._editingRootElement,t=this._minimapView;t.setContentHeight(e.offsetHeight);let n=g4(e),r=g4(this._scrollableRootAncestor),i;r.getIntersection(n)&&(r.contains(n)||n.top>r.top?i=0:(i=(n.top-r.top)/(r.height-n.height),i=Math.max(0,Math.min(i,1))),t.setPositionTrackerHeight(r.getIntersection(n).height),t.setScrollProgress(i))}},b4=class extends I{refresh(){let e=this.editor.model,t=e.schema,n=e.document.selection;this.isEnabled=x4(n,t,e)}execute(){let e=this.editor.model;e.change(t=>{let n=t.createElement(`pageBreak`);e.insertObject(n,null,null,{setSelection:`after`})})}};function x4(e,t,n){let r=S4(e,n);return t.checkChild(r,`pageBreak`)}function S4(e,t){let n=XE(e,t).start.parent;return n.isEmpty&&!n.is(`rootElement`)?n.parent:n}var C4=class extends F{static get pluginName(){return`PageBreakEditing`}static get licenseFeatureCode(){return`PB`}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}init(){let e=this.editor,t=e.model.schema,n=e.t,r=e.conversion;t.register(`pageBreak`,{inheritAllFrom:`$blockObject`}),r.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`}))}),r.for(`editingDowncast`).elementToStructure({model:`pageBreak`,view:(e,{writer:t})=>{let r=n(`Page break`),i=t.createContainerElement(`div`),a=t.createRawElement(`span`,{class:`page-break__label`},function(e){e.innerText=n(`Page break`)});return t.addClass(`page-break`,i),t.insert(t.createPositionAt(i,0),a),w4(i,t,r)}}),r.for(`upcast`).elementToElement({view:e=>{let t=e.getStyle(`page-break-before`)==`always`,n=e.getStyle(`page-break-after`)==`always`;if(!t&&!n)return null;if(e.childCount==1){let t=e.getChild(0);if(!t.is(`element`,`span`)||t.getStyle(`display`)!=`none`)return null}else if(e.childCount>1)return null;return{name:!0,styles:[...t?[`page-break-before`]:[],...n?[`page-break-after`]:[]],...e.hasClass(`page-break`)&&{classes:[`page-break`]}}},model:`pageBreak`,converterPriority:`high`}),e.commands.add(`pageBreak`,new b4(e))}};function w4(e,t,n){return t.setCustomProperty(`pageBreak`,!0,e),UE(e,t,{label:n})}var T4=class extends F{static get pluginName(){return`PageBreakUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.ui.componentFactory.add(`pageBreak`,()=>{let e=this._createButton(H);return e.set({tooltip:!0}),e}),e.ui.componentFactory.add(`menuBar:pageBreak`,()=>this._createButton(U))}_createButton(e){let t=this.editor,n=t.locale,r=t.commands.get(`pageBreak`),i=new e(t.locale),a=n.t;return i.set({label:a(`Page break`),icon:Mv}),i.bind(`isEnabled`).to(r,`isEnabled`),this.listenTo(i,`execute`,()=>{t.execute(`pageBreak`),t.editing.view.focus()}),i}},E4=class extends F{static get requires(){return[C4,T4,xD]}static get pluginName(){return`PageBreak`}static get isOfficialPlugin(){return!0}};function D4(e,t){let n=[];for(let r of t.createRangeIn(e)){let e=r.item;e.is(`element`,`a`)&&!e.hasAttribute(`href`)&&(e.hasAttribute(`id`)||e.hasAttribute(`name`))&&n.push(e)}for(let e of n){let n=e.parent.getChildIndex(e)+1,r=e.getChildren();t.insertChild(n,r,e.parent),O4(e)&&t.remove(e)}}function O4(e){let t=e.getAttribute(`name`);return!!t&&t.startsWith(`_`)}function k4(e){let t=parseFloat(e);return e.endsWith(`pt`)?j4(t*96/72):e.endsWith(`pc`)?j4(t*12*96/72):e.endsWith(`in`)?j4(t*96):e.endsWith(`cm`)?j4(t*96/2.54):e.endsWith(`mm`)?j4(t/10*96/2.54):e}function A4(e){return e!==void 0&&e.endsWith(`px`)}function j4(e){return Math.round(e)+`px`}function M4(e,t,n,r=!1){if(!e.childCount)return;let i=new Np(e.document),a=L4(e,i);if(!a.length)return;let o=[],s=[],c=P4();for(let e of a)if(e.indent!==void 0){R4(e)||(F4(i,s,c),c=P4(),o.length=1,s.length=0);let a=`${e.id}:${e.indent}`,l=r?e.indent-1:Math.min(e.indent-1,s.length);l<s.length&&s[l].id!==e.id&&(l==0&&c.canApplyMarginOnList&&c.topLevelListItemElements.length>0&&(F4(i,s,c),c=P4()),o.length=l,s.length=l),l<s.length-1&&(o.length=l+1,s.length=l+1);let u=V4(e,t);for(;s.length<l;){let t=i.createElement(u.type),n=i.createElement(`li`);if(i.setStyle(`list-style-type`,`none`,n),s.length==0){let n=e.element.parent,r=n.getChildIndex(e.element)+1;i.insertChild(r,t,n)}else{let e=s[s.length-1].listItemElements;i.appendChild(t,e[e.length-1])}i.appendChild(n,t),s.push({...e,listElement:t,listItemElements:[n],isIntermediate:!0,marginLeft:void 0})}if(l>s.length-1||s[l].listElement.name!=u.type){u.type==`ol`&&e.id!==void 0&&o[l]&&o[l][a]&&(u.startIndex=o[l][a]);let t=G4(u,i,n);if(s.length==0){let n=e.element.parent,r=n.getChildIndex(e.element)+1;i.insertChild(r,t,n)}else if(l==0){let e=s[0].listElement,n=e.parent,r=n.getChildIndex(e)+1;i.insertChild(r,t,n)}else{let e=s[l-1].listItemElements;i.appendChild(t,e[e.length-1])}s[l]={...e,listElement:t,listItemElements:[]},e.id!==void 0&&(o[l]||(o[l]={}),o[l][a]=u.startIndex||1)}else s[l].isIntermediate&&(K4(s[l].listElement,u,i,n),s[l]={...e,listElement:s[l].listElement,listItemElements:s[l].listItemElements},e.id!==void 0&&(o[l]||(o[l]={}),o[l][a]=u.startIndex||1));let d=e.element.name==`li`?e.element:i.createElement(`li`);N4(i,s,c,e,d,l),i.appendChild(d,s[l].listElement),s[l].listItemElements.push(d),e.id!==void 0&&o[l]&&o[l][a]++,e.element!=d&&i.appendChild(e.element,d),J4(e.element,i),i.removeStyle(`text-indent`,e.element),i.removeStyle(`margin-left`,e.element)}else{let t=s.find(t=>t.marginLeft==e.marginLeft);if(t){let n=t.listItemElements;i.appendChild(e.element,n[n.length-1]),i.removeStyle(`margin-left`,e.element),s.length=s.indexOf(t)+1,o.length=s.length+1}else F4(i,s,c),c=P4(),s.length=0}F4(i,s,c)}function N4(e,t,n,r,i,a){if(r.marginLeft===void 0){a==0&&(n.canApplyMarginOnList=!1);return}let o=parseFloat(r.marginLeft),s=0;for(let e=0;e<t.length-1;e++){let n=t[e].listItemElements,r=n[n.length-1].getStyle(`margin-left`);r!==void 0&&(s+=parseFloat(r))}s+=t.length*40;let c=o-s,l=c===0?void 0:j4(c);l&&(e.setStyle(`margin-left`,l,i),a==0&&n.canApplyMarginOnList&&(n.marginLeft===void 0&&(n.marginLeft=l),l!==n.marginLeft&&(n.canApplyMarginOnList=!1),n.topLevelListItemElements.push(i)))}function P4(){return{marginLeft:void 0,canApplyMarginOnList:!0,topLevelListItemElements:[]}}function F4(e,t,n){if(n.canApplyMarginOnList&&n.marginLeft&&n.topLevelListItemElements.length>0){e.setStyle(`margin-left`,n.marginLeft,t[0].listElement);for(let t of n.topLevelListItemElements)e.removeStyle(`margin-left`,t)}}function I4(e,t){for(let n of t.createRangeIn(e)){let e=n.item;if(e.is(`element`,`li`)){let n=e.getChild(0);n&&n.is(`element`,`p`)&&t.unwrapElement(n)}}}function L4(e,t){let n=t.createRangeIn(e),r=[],i=new Set;for(let e of n.getItems()){if(!e.is(`element`)||!e.name.match(/^(p|h\d+|li|div)$/))continue;let t=Y4(e);if(t!==void 0&&parseFloat(t)==0&&!Array.from(e.getClassNames()).find(e=>e.startsWith(`MsoList`))&&(t=void 0),e.hasStyle(`mso-list`)&&e.getStyle(`mso-list`)!==`none`||t!==void 0&&i.has(t)){let n=q4(e);r.push({element:e,id:n.id,order:n.order,indent:n.indent,marginLeft:t}),t!==void 0&&i.add(t)}else i.clear()}return r}function R4(e){let t=e.element.previousSibling;for(;t&&z4(t);)t=t.previousSibling;if(!t){let t=e.element.parent;return B4(t)&&(!t.previousSibling||B4(t.previousSibling))}return B4(t)}function z4(e){return e.is(`element`)&&e.childCount===0&&/^(?:span|a|o:p)$/.test(e.name)}function B4(e){return e.is(`element`,`ol`)||e.is(`element`,`ul`)}function V4(e,t){let n=RegExp(`@list l${e.id}:level${e.indent}\\s*({[^}]*)`,`gi`),r=/mso-level-number-format:([^;]{0,100});/gi,i=/mso-level-start-at:\s{0,100}([0-9]{0,10})\s{0,100};/gi,a=RegExp(`@list\\s+l${e.id}:level\\d\\s*{[^{]*mso-level-text:"%\\d\\\\.`,`gi`),o=RegExp(`@list l${e.id}:level\\d\\s*{[^{]*mso-level-number-format:`,`gi`),s=a.exec(t),c=o.exec(t),l=s&&!c,u=n.exec(t),d=`decimal`,f=`ol`,p=null;if(u&&u[1]){let t=r.exec(u[1]);if(t&&t[1]&&(d=t[1].trim(),f=d!==`bullet`&&d!==`image`?`ol`:`ul`),d===`bullet`){let t=H4(e.element);t&&(d=t)}else{let e=i.exec(u[1]);e&&e[1]&&(p=parseInt(e[1]))}l&&(f=`ol`)}return{type:f,startIndex:p,style:W4(d),isLegalStyleList:l}}function H4(e){if(e.name==`li`&&e.parent.name==`ul`&&e.parent.hasAttribute(`type`))return e.parent.getAttribute(`type`);let t=U4(e);if(!t)return null;let n=t._data;return n===`o`?`circle`:n===`·`?`disc`:n===`§`?`square`:null}function U4(e){if(e.getChild(0).is(`$text`))return null;for(let t of e.getChildren()){if(!t.is(`element`,`span`))continue;let e=t.getChild(0);if(e)return e.is(`$text`)?e:e.getChild(0)}return null}function W4(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 G4(e,t,n){let r=t.createElement(e.type);return K4(r,e,t,n),r}function K4(e,t,n,r){t.style&&n.setStyle(`list-style-type`,t.style,e),t.startIndex&&t.startIndex>1&&n.setAttribute(`start`,t.startIndex,e),t.isLegalStyleList&&r&&n.addClass(`legal-list`,e)}function q4(e){let t=e.getStyle(`mso-list`);if(t===void 0)return{};let n=t.match(/(^|\s{1,100})l(\d+)/i),r=t.match(/\s{0,100}lfo(\d+)/i),i=t.match(/\s{0,100}level(\d+)/i);return n&&r&&i?{id:n[2],order:r[1],indent:parseInt(i[1])}:{indent:1}}function J4(e,t){let n=new Po({name:`span`,styles:{"mso-list":`Ignore`}}),r=t.createRangeIn(e);for(let e of r)e.type===`elementStart`&&n.match(e.item)&&t.remove(e.item)}function Y4(e){let t=e.getStyle(`margin-left`);return t===void 0||t.endsWith(`px`)?t:k4(t)}function X4(e,t){if(!e.childCount)return;let n=new Np(e.document),r=Q4(e,n);$4(r,e,n),t3(r,e,n),e3(e,n);let i=n3(e,n);i.length&&i3(i,r3(t),n)}function Z4(e){return btoa(e.match(/\w{2}/g).map(e=>String.fromCharCode(parseInt(e,16))).join(``))}function Q4(e,t){let n=t.createRangeIn(e),r=new Po({name:/v:(.+)/}),i=[];for(let e of n){if(e.type!=`elementStart`)continue;let t=e.item,n=t.previousSibling,a=n&&n.is(`element`)?n.name:null,o=[`Chart`],s=r.match(t),c=t.getAttribute(`o:gfxdata`),l=a===`v:shapetype`,u=c&&o.some(e=>t.getAttribute(`id`).includes(e));s&&c&&!l&&!u&&i.push(e.item.getAttribute(`id`))}return i}function $4(e,t,n){let r=n.createRangeIn(t),i=new Po({name:`img`}),a=[];for(let t of r)if(t.item.is(`element`)&&i.match(t.item)){let n=t.item,r=n.getAttribute(`v:shapes`)?n.getAttribute(`v:shapes`).split(` `):[];r.length&&r.every(t=>e.indexOf(t)>-1)?a.push(n):n.getAttribute(`src`)||a.push(n)}for(let e of a)n.remove(e)}function e3(e,t){let n=t.createRangeIn(e),r=new Po({name:/v:(.+)/}),i=[];for(let e of n)e.type==`elementStart`&&r.match(e.item)&&i.push(e.item);for(let e of i)t.remove(e)}function t3(e,t,n){let r=n.createRangeIn(t),i=[];for(let t of r)if(t.type==`elementStart`&&t.item.is(`element`,`v:shape`)){let n=t.item.getAttribute(`id`);if(e.includes(n))continue;a(t.item.parent.getChildren(),n)||i.push(t.item)}for(let e of i){let t={src:o(e)};e.hasAttribute(`alt`)&&(t.alt=e.getAttribute(`alt`));let r=n.createElement(`img`,t);n.insertChild(e.index+1,r,e.parent)}function a(e,t){for(let n of e)if(n.is(`element`)&&(n.name==`img`&&n.getAttribute(`v:shapes`)==t||a(n.getChildren(),t)))return!0;return!1}function o(e){for(let t of e.getChildren())if(t.is(`element`)&&t.getAttribute(`src`))return t.getAttribute(`src`)}}function n3(e,t){let n=t.createRangeIn(e),r=new Po({name:`img`}),i=[],a=0;for(let e of n)e.item.is(`element`)&&r.match(e.item)&&(e.item.getAttribute(`src`).startsWith(`file://`)&&i.push({element:e.item,imageIndex:a}),a++);return i}function r3(e){if(!e)return[];let t=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,n=RegExp(`(?:(`+t.source+`))([\\da-fA-F\\s]+)\\}`,`g`),r=e.match(n),i=[];if(r)for(let e of r){let n=!1;e.includes(`\\pngblip`)?n=`image/png`:e.includes(`\\jpegblip`)&&(n=`image/jpeg`),n&&i.push({hex:e.replace(t,``).replace(/[^\da-fA-F]/g,``),type:n})}return i}function i3(e,t,n){for(let r=0;r<e.length;r++){let{element:i,imageIndex:a}=e[r],o=t[a];if(o){let e=`data:${o.type};base64,${Z4(o.hex)}`;n.setAttribute(`src`,e,i)}}}function a3(e){let t=[],n=new Np(e.document);for(let{item:r}of n.createRangeIn(e))if(r.is(`element`)){for(let e of r.getClassNames())/\bmso/gi.exec(e)&&n.removeClass(e,r);for(let e of r.getStyleNames())/\bmso/gi.exec(e)&&n.removeStyle(e,r);(r.is(`element`,`w:sdt`)||r.is(`element`,`w:sdtpr`)&&r.isEmpty||r.is(`element`,`o:p`)&&r.isEmpty)&&t.push(r)}for(let e of t){let t=e.parent,r=t.getChildIndex(e);n.insertChild(r,e.getChildren(),t),n.remove(e)}}function o3(e,t,n=!1){for(let r of t.createRangeIn(e).getItems()){if(!r.is(`element`,`table`)&&!r.is(`element`,`td`)&&!r.is(`element`,`th`))continue;if(n&&r.is(`element`,`table`)){let e=r.parent?.is(`element`,`div`)?r.parent:null,n=r.parent?.parent?.is(`element`,`div`)?r.parent.parent:null,i=e??n;i&&i.getAttribute(`align`)===`center`&&!r.getAttribute(`align`)?(t.setStyle(`margin-left`,`auto`,r),t.setStyle(`margin-right`,`auto`,r)):i&&i.getAttribute(`align`)===`right`&&!r.getAttribute(`align`)?(t.setStyle(`margin-left`,`auto`,r),t.setStyle(`margin-right`,`0`,r)):!i&&!r.getAttribute(`align`)&&(t.setStyle(`margin-left`,`0`,r),t.setStyle(`margin-right`,`auto`,r))}let e=[`left`,`top`,`right`,`bottom`];if(e.every(e=>!r.hasStyle(`border-${e}-style`)))t.setStyle(`border-style`,`none`,r);else for(let n of e)r.hasStyle(`border-${n}-style`)||t.setStyle(`border-${n}-style`,`none`,r);let i=[`width`,`height`,...e.map(e=>`border-${e}-width`),...e.map(e=>`padding-${e}`)];for(let e of i)r.hasStyle(e)&&t.setStyle(e,k4(r.getStyle(e)),r)}}function s3(e,t){for(let n of t.createRangeIn(e).getItems())n.is(`element`,`table`)&&(n.getStyle(`width`)===`0px`&&t.removeStyle(`width`,n),n.getAttribute(`width`)===`0`&&t.removeAttribute(`width`,n))}function c3(e,t){let n=new Map,r=new Map,i=null;for(let{item:a}of t.createRangeIn(e))if(a.is(`element`)){if(a.getStyle(`mso-element`)===`footnote-list`){i=a;continue}if(a.hasStyle(`mso-footnote-id`)){let e=a.findAncestor(`element`,e=>e.getStyle(`mso-element`)===`footnote`);if(e){let t=e.getAttribute(`id`);r.set(t,e)}else{let e=a.getStyle(`mso-footnote-id`);n.set(e,a)}continue}}if(!n.size||!i)return;let a=u3(t);t.replace(i,a.wrapper);for(let[e,i]of n){let n=r.get(e);if(!n)continue;t.replace(i,d3(t,e));let o=f3(t,e);l3(t,n);for(let e of n.getChildren()){let n=e;e.is(`element`)&&(n=t.clone(e,!0)),t.appendChild(n,o.content)}t.appendChild(o.listItem,a.list)}}function l3(e,t){let n=[],r=[];for(let{item:i}of e.createRangeIn(t))if(i.is(`element`)&&i.getStyle(`mso-footnote-id`)){n.unshift(i);let{nextSibling:e}=i;e?.is(`$text`)&&e.data.startsWith(` `)&&r.unshift(e)}for(let t of n)e.remove(t);for(let t of r){let n=t.data.substring(1);if(n.length>0){let r=t.parent,i=r.getChildIndex(t),a=e.createText(n);e.remove(t),e.insertChild(i,a,r)}else e.remove(t)}return t}function u3(e){let t=e.createElement(`hr`,{class:`footnotes-divider`}),n=e.createElement(`ol`,{class:`footnotes-list`});return{list:n,wrapper:e.createElement(`div`,{class:`footnotes`},[t,n])}}function d3(e,t){let n=e.createElement(`sup`,{class:`footnote`}),r=e.createElement(`a`,{id:`ref-${t}`,href:`#${t}`});return e.appendChild(r,n),n}function f3(e,t){let n=e.createElement(`li`,{id:t,class:`footnote-definition`}),r=e.createElement(`a`,{href:`#ref-${t}`,class:`footnote-backlink`}),i=e.createElement(`div`,{class:`footnote-content`});return e.appendChild(e.createText(`^`),r),e.appendChild(r,n),e.appendChild(i,n),{listItem:n,content:i}}const p3=/<meta\s*name="?generator"?\s*content="?microsoft\s*word\s*\d+"?\/?>/i,m3=/xmlns:o="urn:schemas-microsoft-com/i,h3=/<meta\s*name="?generator"?\s*content="?microsoft\s*excel\s*\d+"?\/?>/i;var g3=class{document;hasMultiLevelListPlugin;hasTablePropertiesPlugin;enableSkipLevelLists;constructor(e,t=!1,n=!1,r=!1){this.document=e,this.hasMultiLevelListPlugin=t,this.hasTablePropertiesPlugin=n,this.enableSkipLevelLists=r}isActive(e){return p3.test(e)||m3.test(e)||h3.test(e)}execute(e){let t=new Np(this.document),n=e.extraContent.stylesString;D4(e.content,t),M4(e.content,n,this.hasMultiLevelListPlugin,this.enableSkipLevelLists),X4(e.content,e.dataTransfer.getData(`text/rtf`)),o3(e.content,t,this.hasTablePropertiesPlugin),s3(e.content,t),c3(e.content,t),a3(e.content)}};function _3(e,t){for(let n of e.getChildren())if(n.is(`element`,`b`)&&n.getStyle(`font-weight`)===`normal`){let r=e.getChildIndex(n);t.remove(n),t.insertChild(r,n.getChildren(),e)}}function v3(e,t){let n=new _c(new Cs(t.document.stylesProcessor),{renderingMode:`data`}),r=n.blockElements,i=n.inlineObjectElements,a=[];for(let n of t.createRangeIn(e)){let e=n.item;if(e.is(`element`,`br`)){let n=y3(e,`forward`,t,{blockElements:r,inlineObjectElements:i}),o=y3(e,`backward`,t,{blockElements:r,inlineObjectElements:i}),s=b3(n,r);(b3(o,r)||s)&&a.push(e)}}for(let e of a)e.hasClass(`Apple-interchange-newline`)?t.remove(e):t.replace(e,t.createElement(`p`))}function y3(e,t,n,{blockElements:r,inlineObjectElements:i}){let a=n.createPositionAt(e,t==`forward`?`after`:`before`);return a=a.getLastMatchingPosition(({item:e})=>e.is(`element`)&&!r.includes(e.name)&&!i.includes(e.name),{direction:t}),t==`forward`?a.nodeAfter:a.nodeBefore}function b3(e,t){return!!e&&e.is(`element`)&&t.includes(e.name)}function x3(e,t,n){let r=new Set;for(let n of t.createRangeIn(e).getItems())!n.is(`view:$textProxy`)||!n.data.includes(` `)||S3(n.parent)&&r.add(n.textNode);for(let e of r)C3(e,t,n)}function S3(e){let t=e;for(;t;){if(t.is(`element`)&&t.getStyle?.(`white-space`)===`pre-wrap`)return!0;t=t.parent}return!1}function C3(e,t,n){let{parent:r,data:i}=e,a=i.replaceAll(` `,` `.repeat(n)),o=r.getChildIndex(e);t.remove(e),t.insertChild(o,t.createText(a),r)}const w3=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;var T3=class{document;constructor(e){this.document=e}isActive(e){return w3.test(e)}execute(e){let t=new Np(this.document);_3(e.content,t),I4(e.content,t),v3(e.content,t),x3(e.content,t,8)}};function E3(e,t){for(let n of e.getChildren())n.is(`element`,`table`)&&n.hasAttribute(`xmlns`)&&t.removeAttribute(`xmlns`,n)}function D3(e,t){for(let n of e.getChildren())if(n.is(`element`,`google-sheets-html-origin`)){let r=e.getChildIndex(n);t.remove(n),t.insertChild(r,n.getChildren(),e)}}function O3(e,t){for(let n of Array.from(e.getChildren()))n.is(`element`,`style`)&&t.remove(n)}const k3=/<google-sheets-html-origin/i;var A3=class{document;constructor(e){this.document=e}isActive(e){return k3.test(e)}execute(e){let t=new Np(this.document);D3(e.content,t),E3(e.content,t),s3(e.content,t),O3(e.content,t)}};function j3(e){return N3(N3(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,`\xA0</`).replace(/ <o:p><\/o:p>/g,`\xA0<o:p></o:p>`).replace(/<o:p>(&nbsp;|\u00A0)<\/o:p>/g,``).replace(/>([^\S\r\n]*[\r\n]\s*)</g,`><`)}function M3(e){e.querySelectorAll(`span[style*=spacerun]`).forEach(e=>{let t=e,n=t.innerText.length||0;t.innerText=Array(n+1).join(`\xA0 `).substr(0,n)})}function N3(e){return e.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(e,t)=>t.length===1?` `:Array(t.length+1).join(`\xA0 `).substr(0,t.length))}function P3(e,t){let n=new DOMParser;e=e.replace(/<!--\[if gte vml 1]>/g,``),e=e.replace(/<o:SmartTagType(?:\s+[^\s>=]+(?:="[^"]*")?)*\s*\/?>/gi,``);let r=j3(R3(e)),i=n.parseFromString(r,`text/html`);M3(i),I3(i);let a=i.body.innerHTML,o=F3(i,t),s=L3(i);return{body:o,bodyString:a,styles:s.styles,stylesString:s.stylesString}}function F3(e,t){let n=new _c(new Cs(t),{renderingMode:`data`}),r=e.createDocumentFragment(),i=e.body.childNodes;for(;i.length>0;)r.appendChild(i[0]);return n.domToView(r,{skipComments:!0})}function I3(e){for(let t of Array.from(e.body.querySelectorAll(`style`)))t.remove()}function L3(e){let t=[],n=[],r=Array.from(e.getElementsByTagName(`style`));for(let e of r)e.sheet&&e.sheet.cssRules&&e.sheet.cssRules.length&&(t.push(e.sheet),n.push(e.innerHTML));return{styles:t,stylesString:n.join(` `)}}function R3(e){let t=e.indexOf(`</body>`);if(t<0)return e;let n=e.indexOf(`</html>`,t+7);return e.substring(0,t+7)+(n>=0?e.substring(n):``)}var z3=class extends F{_normalizers=[];static get pluginName(){return`PasteFromOffice`}static get licenseFeatureCode(){return`PFO`}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}static get requires(){return[_O]}init(){let e=this.editor,t=e.plugins.get(`ClipboardPipeline`),n=e.editing.view.document,r=this.editor.plugins.has(`MultiLevelListEditing`),i=this.editor.plugins.has(`TablePropertiesEditing`),a=!!this.editor.config.get(`list.enableSkipLevelLists`);this.registerNormalizer(new g3(n,r,i,a)),this.registerNormalizer(new T3(n)),this.registerNormalizer(new A3(n)),n.on(`clipboardInput`,(e,t)=>{if(typeof t.content!=`string`)return;let r=t.dataTransfer.getData(`text/html`);if(this._normalizers.find(({normalizer:e})=>e.isActive(r))){let e=P3(t.content,n.stylesProcessor);t.content=e.body,t.extraContent={...e,isTransformedWithPasteFromOffice:!0}}},{priority:ge.low+10}),t.on(`inputTransformation`,(e,t)=>{if(!t.extraContent||!t.extraContent.isTransformedWithPasteFromOffice)return;let n=t.dataTransfer.getData(`text/html`),r=this._normalizers.filter(({normalizer:e})=>e.isActive(n));for(let{normalizer:e}of r)e.execute(t)},{priority:`high`})}registerNormalizer(e,t){_e(this._normalizers,{normalizer:e,priority:ge.get(t)})}};const B3=`removeFormat`;var V3=class extends F{static get pluginName(){return`RemoveFormatUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.ui.componentFactory.add(B3,()=>{let e=this._createButton(H);return e.set({tooltip:!0}),e}),e.ui.componentFactory.add(`menuBar:${B3}`,()=>this._createButton(U))}_createButton(e){let t=this.editor,n=t.locale,r=t.commands.get(B3),i=new e(t.locale),a=n.t;return i.set({label:a(`Remove Format`),icon:Zv}),i.bind(`isEnabled`).to(r,`isEnabled`),this.listenTo(i,`execute`,()=>{t.execute(B3),t.editing.view.focus()}),i}},H3=class extends I{_customAttributesHandlers=[];refresh(){let e=this.editor.model;this.isEnabled=!!j(this._getFormattingItems(e.document.selection))}execute(){let e=this.editor.model;e.change(t=>{for(let n of this._getFormattingItems(e.document.selection))if(n.is(`selection`))for(let e of this._getFormattingAttributes(n))t.removeSelectionAttribute(e);else{let e=t.createRangeOn(n);for(let r of this._getFormattingAttributes(n))this._removeFormatting(r,n,e,t)}})}registerCustomAttribute(e,t){this._customAttributesHandlers.push({isFormatting:e,removeFormatting:t})}_removeFormatting(e,t,n,r){let i=!1,a=U3(e);for(let{isFormatting:o,removeFormatting:s}of this._customAttributesHandlers)o(a,t)&&(s(e,n,r),i=!0);i||r.removeAttribute(e,n)}*_getFormattingItems(e){let t=this.editor.model,n=t.schema,r=e=>!!j(this._getFormattingAttributes(e));for(let i of e.getRanges())for(let e of i.getItems())n.isBlock(e)&&i.end.isTouching(t.createPositionAt(e,0))||r(e)&&(yield e);for(let t of e.getSelectedBlocks())r(t)&&(yield t);r(e)&&(yield e)}*_getFormattingAttributes(e){let{schema:t}=this.editor.model;for(let[n]of e.getAttributes()){let r=U3(n);for(let{isFormatting:t}of this._customAttributesHandlers)t(r,e)&&(yield n);let i=t.getAttributeProperties(r);i&&i.isFormatting&&(yield n)}}};function U3(e){return e.replace(/^selection:/,``)}var W3=class extends F{static get pluginName(){return`RemoveFormatEditing`}static get licenseFeatureCode(){return`RF`}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}init(){let e=this.editor;e.commands.add(`removeFormat`,new H3(e))}},G3=class extends F{static get requires(){return[W3,V3]}static get pluginName(){return`RemoveFormat`}static get isOfficialPlugin(){return!0}};function K3(e,t){for(let n of e.model.markers)if(q3(Y3(n,e.model),t)&&n.name.startsWith(`restrictedEditingException:`))return n}function q3(e,t){return e.containsPosition(t)||e.end.isEqual(t)||e.start.isEqual(t)}function J3(e,t,n){if(!n)return!1;let r=Y3(n,t);return e.isCollapsed?q3(r,e.focus):r.containsRange(e.getFirstRange(),!0)}function Y3(e,t){let n=e.getRange(),r=n.getContainedElement();return r&&r.is(`element`,`restrictedEditingException`)?t.createRangeIn(r):n}var X3=class extends I{_direction;constructor(e,t){super(e),this.affectsData=!1,this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute(){let e=Z3(this.editor.model,this._direction);e&&this.editor.model.change(t=>{t.setSelection(e)})}_checkEnabled(){return!!Z3(this.editor.model,this._direction)}};function Z3(e,t){let n=e.document.selection.getFirstPosition(),r=[];for(let i of e.markers.getMarkersGroup(`restrictedEditingException`)){let a=Y3(i,e),o=n.isTouching(a.start)&&n.hasSameParentAs(a.start)||n.isTouching(a.end)&&n.hasSameParentAs(a.end);a.containsPosition(n)||o||(t===`forward`&&a.start.isAfter(n)||t===`backward`&&a.end.isBefore(n))&&r.push(a)}if(r.length)return r.sort((e,n)=>t===`forward`?e.start.isAfter(n.start)?1:-1:e.start.isBefore(n.start)?1:-1).shift()}const Q3=`restricted-editing-exception_selected`;function $3(e){let t=e.editing.view,n=e.model,r=new Set;t.document.registerPostFixer(t=>{let i=n.document.selection,a=K3(e,i.anchor);if(!a)return!1;let o=a.getRange().getContainedElement();if(o&&o.is(`element`,`restrictedEditingException`)){let n=e.editing.mapper.toViewElement(o);t.addClass(Q3,n),r.add(n)}else for(let n of e.editing.mapper.markerNameToElements(a.name))t.addClass(Q3,n),r.add(n);return!1}),e.conversion.for(`editingDowncast`).add(e=>{e.on(`insert`,n,{priority:`highest`}),e.on(`remove`,n,{priority:`highest`}),e.on(`attribute`,n,{priority:`highest`}),e.on(`cleanSelection`,n);function n(){t.change(e=>{for(let t of r.values())e.removeClass(Q3,t),r.delete(t)})}})}function e6(e){return t=>{let n=!1;for(let{name:r,data:i}of e.model.document.differ.getChangedMarkers())r.startsWith(`restrictedEditingException`)&&i.newRange&&i.newRange.root.rootName==`$graveyard`&&(t.updateMarker(r,{range:t.createRange(t.createPositionAt(i.oldRange.start))}),n=!0);return n}}function t6(e){return t=>{let n=!1,r=e.model.schema;for(let i of e.model.document.differ.getChanges())i.type==`insert`&&r.checkChild(`$block`,i.name)&&(n=r6(e,i.position,i.length,t)||n,n=i6(e,i.position,i.length,t)||n);return n}}function n6(e){return t=>t.on(`element`,(t,n,r)=>{let{writer:i}=r,a=new Po(e.view).match(n.viewItem);if(!a)return;let o=a.match;if(o.name=!0,!r.consumable.test(n.viewItem,o))return;let s=n.modelCursor,c=null;if(e.useWrapperElement){if(!r.schema.checkChild(s,`restrictedEditingException`))return;c=i.createElement(`restrictedEditingException`),i.insert(c,s),s=i.createPositionAt(c,0)}let{modelRange:l}=r.convertChildren(n.viewItem,s);r.consumable.consume(n.viewItem,o);let u=e.model(),d=i.createElement(`$marker`,{"data-name":u}),f=i.createElement(`$marker`,{"data-name":u});c?(i.insert(d,i.createPositionBefore(c)),i.insert(f,i.createPositionAfter(c))):(i.insert(f,l.end),i.insert(d,l.start)),n.modelRange=i.createRange(i.createPositionBefore(d),i.createPositionAfter(f)),n.modelCursor=n.modelRange.end})}function r6(e,t,n,r){let i=K3(e,t.getShiftedBy(n));return i&&i.getStart().isEqual(t.getShiftedBy(n))?(r.updateMarker(i,{range:r.createRange(i.getStart().getShiftedBy(-n),i.getEnd())}),!0):!1}function i6(e,t,n,r){let i=K3(e,t);return i&&i.getEnd().isEqual(t)?(r.updateMarker(i,{range:r.createRange(i.getStart(),i.getEnd().getShiftedBy(n))}),!0):!1}const a6=`RestrictedEditingMode`;var o6=class extends F{_alwaysEnabled;_allowedInException;static get pluginName(){return`RestrictedEditingModeEditing`}static get licenseFeatureCode(){return`RED`}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}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(){let 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 X3(e,`backward`)),e.commands.add(`goToNextRestrictedEditingException`,new X3(e,`forward`)),this.listenTo(t.document,`tab`,(t,n)=>{let r=n.shiftKey?`goToPreviousRestrictedEditingException`:`goToNextRestrictedEditingException`;e.commands.get(r).isEnabled&&(e.execute(r),n.preventDefault(),n.stopPropagation()),t.stop()},{context:`$capture`}),this.listenTo(t.document,`keydown`,s6(e),{priority:`high`}),t.change(e=>{for(let n of t.document.roots)e.addClass(`ck-restricted-editing_mode_restricted`,n)}),e.data.on(`set`,()=>{e.model.change(t=>{for(let n of e.model.markers.getMarkersGroup(`restrictedEditingException`))t.removeMarker(n.name)})},{priority:`high`})}enableCommand(e){this.editor.commands.get(e).clearForceDisabled(a6),this._alwaysEnabled.add(e)}_setupSchema(){this.editor.model.schema.register(`restrictedEditingException`,{allowWhere:`$block`,allowContentOf:`$container`,isLimit:!0})}_setupConversion(){let e=this.editor,t=e.model.document,n=0;e.conversion.for(`upcast`).add(n6({view:{name:`span`,classes:`restricted-editing-exception`},model:()=>(n++,`restrictedEditingException:inline:${n}`)})),e.conversion.for(`upcast`).add(n6({view:{name:`div`,classes:`restricted-editing-exception`},model:()=>(n++,`restrictedEditingException:block:${n}`),useWrapperElement:!0})),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,n)=>{if(!t.item||t.item.is(`selection`)||!n.schema.isInline(t.item)||!n.consumable.consume(t.item,e.name))return;let r=n.writer,i=r.createAttributeElement(`span`,{class:`restricted-editing-exception`},{id:t.markerName,priority:-10}),a=n.mapper.toViewRange(t.range),o=r.wrap(a,i);for(let e of o.getItems())if(e.is(`attributeElement`)&&e.isSimilar(i)){n.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(t6(e)),t.registerPostFixer(e6(e)),t.registerPostFixer(f6(e)),$3(e)}_setupRestrictions(){let e=this.editor,t=e.model,n=t.document.selection,r=e.editing.view.document,i=e.plugins.get(`ClipboardPipeline`);this.listenTo(t,`deleteContent`,l6(e),{priority:`high`});let a=e.commands.get(`insertText`);a&&this.listenTo(a,`execute`,u6(e),{priority:`high`}),this.listenTo(i,`contentInsertion`,(r,i)=>{d6(e,n.getFirstRange())||r.stop();let a=K3(e,n.focus);if(a&&a.name.startsWith(`restrictedEditingException:inline:`)){let n=e.config.get(`restrictedEditing.allowedAttributes`);t.change(e=>{let t=e.createDocumentFragment(),r=Array.from(e.createRangeIn(i.content).getItems()).filter(e=>e.is(`$textProxy`));for(let i of r){for(let t of i.getAttributeKeys())n.includes(t)||e.removeAttribute(t,i);e.append(i,t)}i.content=t})}}),this.listenTo(r,`clipboardOutput`,(t,r)=>{r.method==`cut`&&!d6(e,n.getFirstRange())&&t.stop()},{priority:`high`}),t.schema.addChildCheck(e=>{if(e.startsWith(`$clipboardHolder`))return!1},`restrictedEditingException`)}_setupCommandsToggling(){let 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(){let e=this.editor,t=e.model.document.selection;if(t.rangeCount>1){this._disableCommands();return}let n=K3(e,t.focus);this._disableCommands(),J3(t,e.model,n)&&this._enableCommands(n)}_enableCommands(e){let t=this.editor,n=t.model.document.selection;for(let[r,i]of t.commands)!i.affectsData||this._alwaysEnabled.has(r)||!e.name.startsWith(`restrictedEditingException:block:`)&&!this._allowedInException.has(r)||c6(r,n,Y3(e,t.model))||i.clearForceDisabled(a6)}_disableCommands(){let e=this.editor;for(let[t,n]of e.commands)!n.affectsData||this._alwaysEnabled.has(t)||n.forceDisabled(a6)}};function s6(e){return(t,n)=>{if(vi(n)!=yi(`Ctrl+A`))return;let r=e.model,i=e.model.document.selection,a=K3(e,i.focus);if(!a)return;let o=i.getFirstRange(),s=Y3(a,e.model);(s.containsRange(o,!0)||i.isCollapsed)&&(t.stop(),n.preventDefault(),n.stopPropagation(),r.change(e=>{e.setSelection(s)}))}}function c6(e,t,n){return!!(e==`delete`&&t.isCollapsed&&n.start.isTouching(t.focus)||e==`deleteForward`&&t.isCollapsed&&n.end.isTouching(t.focus))}function l6(e){return(t,n)=>{let[r]=n,i=K3(e,r.focus)||K3(e,r.anchor);if(!i){t.stop();return}if(r.isCollapsed)return;let a=Y3(i,e.model).getIntersection(r.getFirstRange());r.is(`documentSelection`)?e.model.change(e=>{e.setSelection(a)}):r.setTo(a)}}function u6(e){return(t,n)=>{let[r]=n,{range:i}=r;i&&(d6(e,i)||t.stop())}}function d6(e,t){let n=K3(e,t.start),r=K3(e,t.end);return n&&r&&r===n}function f6(e){return t=>{let n=!1,r=e.model.document.differ.getChangedMarkers();for(let{data:e,name:i}of r){if(!i.startsWith(`restrictedEditingException`))continue;let r=e.newRange;if(!e.oldRange&&!r.isFlat){let e=r.start,a=r.end,o=e.path.length>a.path.length,s=o?r.start:t.createPositionAt(a.parent,0),c=o?t.createPositionAt(e.parent,`end`):r.end;t.updateMarker(i,{range:t.createRange(s,c)}),n=!0}}return n}}var p6=class extends F{static get pluginName(){return`RestrictedEditingModeUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.t;e.ui.componentFactory.add(`restrictedEditing`,n=>{let r=Nx(n),i=new Fi;return this._getButtonDefinitions().forEach(({commandName:e,label:t,keystroke:n})=>{i.add(this._getButtonDefinition(e,t,n))}),Lx(r,i,{role:`menu`}),r.buttonView.set({label:t(`Navigate editable regions`),icon:h_,tooltip:!0,isEnabled:!0,isOn:!1}),this.listenTo(r,`execute`,t=>{let{_commandName:n}=t.source;e.execute(n),e.editing.view.focus()}),r}),e.ui.componentFactory.add(`menuBar:restrictedEditing`,e=>{let n=new uw(e),r=new dw(e);return r.set({ariaLabel:t(`Navigate editable regions`),role:`menu`}),n.buttonView.set({label:t(`Navigate editable regions`),icon:h_}),n.panelView.children.add(r),this._getButtonDefinitions().forEach(({commandName:t,label:i,keystroke:a})=>{let o=new rC(e,n),s=this._createMenuBarButton(i,t,a);s.delegate(`execute`).to(n),o.children.add(s),r.items.add(o)}),n})}_createMenuBarButton(e,t,n){let r=this.editor,i=r.commands.get(t),a=new U(r.locale);return a.set({label:e,keystroke:n,isEnabled:!0,isOn:!1}),a.bind(`isEnabled`).to(i),this.listenTo(a,`execute`,()=>{r.execute(t),r.editing.view.focus()}),a}_getButtonDefinition(e,t,n){let r=this.editor.commands.get(e),i={type:`button`,model:new RC({label:t,withText:!0,keystroke:n,withKeystroke:!0,role:`menuitem`,_commandName:e})};return i.model.bind(`isEnabled`).to(r,`isEnabled`),i}_getButtonDefinitions(){let 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`}]}},m6=class extends F{static get pluginName(){return`RestrictedEditingMode`}static get isOfficialPlugin(){return!0}static get requires(){return[o6,p6]}},h6=class extends I{refresh(){let e=this.editor.model,t=e.document;this.value=!!t.selection.getAttribute(`restrictedEditingException`),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,`restrictedEditingException`)}execute(e={}){let t=this.editor.model,n=t.document.selection,r=e.forceValue===void 0?!this.value:e.forceValue;t.change(e=>{let i=t.schema.getValidRanges(n.getRanges(),`restrictedEditingException`);if(n.isCollapsed)if(r)e.setSelectionAttribute(`restrictedEditingException`,r);else{let t=e=>e.item.getAttribute(`restrictedEditingException`)===this.value,r=n.focus,i=r.getLastMatchingPosition(t,{direction:`backward`}),a=r.getLastMatchingPosition(t);e.removeSelectionAttribute(`restrictedEditingException`),r.isEqual(i)||r.isEqual(a)||e.removeAttribute(`restrictedEditingException`,e.createRange(i,a))}else for(let t of i)r?e.setAttribute(`restrictedEditingException`,r,t):e.removeAttribute(`restrictedEditingException`,t)})}},g6=class extends I{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){let t=this.editor.model,n=t.schema,r=t.document.selection,i=Array.from(r.getSelectedBlocks()),a=e.forceValue===void 0?!this.value:e.forceValue;t.change(e=>{if(a){let t=i.filter(e=>_6(e)||b6(n,e));this._applyException(e,t)}else{let t=i.map(e=>v6(e)).filter(e=>!!e);this._removeException(e,t)}})}_getValue(){let e=this.editor.model.document.selection,t=j(e.getSelectedBlocks());return!!(t&&_6(t))}_checkEnabled(){if(this.value)return!0;let e=this.editor.model.document.selection,t=this.editor.model.schema,n=j(e.getSelectedBlocks());return n?b6(t,n):!1}_removeException(e,t){y6(e,t).reverse().forEach(t=>{if(t.start.isAtStart&&t.end.isAtEnd){e.unwrap(t.start.parent);return}if(t.start.isAtStart){let n=e.createPositionBefore(t.start.parent);e.move(t,n);return}t.end.isAtEnd||e.split(t.end);let n=e.createPositionAfter(t.end.parent);e.move(t,n)})}_applyException(e,t){let n=this.editor.model.schema,r=[];if(y6(e,t).reverse().forEach(t=>{let n=_6(t.start);n||(n=e.createElement(`restrictedEditingException`),e.wrap(t,n)),r.push(n)}),r.reverse(),r.length){let e=r.at(0).previousSibling,t=r.at(-1).nextSibling;e?.is(`element`,`restrictedEditingException`)&&r.unshift(e),t?.is(`element`,`restrictedEditingException`)&&r.push(t)}r.reduce((t,n)=>t.nextSibling==n?(e.merge(e.createPositionAfter(t)),t):n),n.removeDisallowedAttributes(t,e)}};function _6(e){return e.findAncestor(`restrictedEditingException`,{includeSelf:!0})}function v6(e){let t=e;for(;t.parent;){if(t.parent.name==`restrictedEditingException`)return t;t=t.parent}return null}function y6(e,t){let n,r=0,i=[];for(;r<t.length;){let a=t[r],o=t[r+1];n||=e.createPositionBefore(a),(!o||a.nextSibling!=o)&&(i.push(e.createRange(n,e.createPositionAfter(a))),n=null),r++}return i}function b6(e,t){let n=e.createContext(t.parent);return!(!e.checkChild(n,`restrictedEditingException`)||!e.checkChild(n.push(`restrictedEditingException`),t))}var x6=class extends I{_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(){let 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{let t=e.model.schema,n=e.model.document.selection,r=n.getSelectedElement();n.isCollapsed||r&&t.isObject(r)&&t.isBlock(r)||dr(n.getSelectedBlocks())>1?e.execute(`restrictedEditingExceptionBlock`):e.execute(`restrictedEditingException`)}}},S6=class extends F{static get pluginName(){return`StandardEditingModeEditing`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.model.schema;t.extend(`$text`,{allowAttributes:[`restrictedEditingException`]}),t.register(`restrictedEditingException`,{allowWhere:`$container`,allowContentOf:`$container`}),t.addChildCheck(e=>{for(let t of e)if(t.name==`restrictedEditingException`)return!1},`restrictedEditingException`),t.addAttributeCheck(e=>{for(let t of e)if(t.name==`restrictedEditingException`)return!1},`restrictedEditingException`),e.model.document.registerPostFixer(n=>{let r=e.model.document.differ.getChanges(),i=new Set,a=new Set,o=new Set,s=!1;for(let e of r)if(e.type==`insert`){let r=n.createRange(e.position,e.position.getShiftedBy(e.length));for(let e of r.getItems())e.is(`element`,`restrictedEditingException`)?t.checkChild(n.createPositionBefore(e),e)?e.isEmpty?a.add(e):o.add(e):i.add(e):e.is(`$textProxy`)&&e.hasAttribute(`restrictedEditingException`)&&!t.checkAttribute(e,`restrictedEditingException`)&&(n.removeAttribute(`restrictedEditingException`,e),s=!0)}else if(e.type==`remove`){let t=e.position.parent;t.is(`element`,`restrictedEditingException`)&&t.isEmpty&&a.add(t);for(let e of t.getChildren())e.is(`element`,`restrictedEditingException`)&&o.add(e)}for(let e of i)n.unwrap(e),s=!0;for(let e of a)n.remove(e),s=!0;for(let e of o){if(e.root.rootName==`$graveyard`)continue;let t=e.previousSibling,r=e.nextSibling;t&&t.is(`element`,`restrictedEditingException`)&&n.merge(n.createPositionBefore(e)),r&&r.is(`element`,`restrictedEditingException`)&&n.merge(n.createPositionAfter(e))}return s}),e.conversion.for(`upcast`).elementToAttribute({model:`restrictedEditingException`,view:{name:`span`,classes:`restricted-editing-exception`}}).elementToElement({model:`restrictedEditingException`,view:{name:`div`,classes:`restricted-editing-exception`}}),C6(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 h6(e)),e.commands.add(`restrictedEditingExceptionBlock`,new g6(e)),e.commands.add(`restrictedEditingExceptionAuto`,new x6(e)),e.editing.view.change(t=>{for(let n of e.editing.view.document.roots)t.addClass(`ck-restricted-editing_mode_standard`,n)})}};function C6(e){let t=new Po({name:`span`,classes:`restricted-editing-exception`});e.conversion.for(`upcast`).add(e=>e.on(`element:span`,(e,n,r)=>{let i=t.match(n.viewItem);if(!i)return;let a=i.match;if(!r.consumable.test(n.viewItem,a))return;let o=r.writer.createText(` `,{restrictedEditingException:!0});r.safeInsert(o,n.modelCursor)&&(r.consumable.consume(n.viewItem,a),n.modelRange=r.writer.createRange(n.modelCursor,n.modelCursor.getShiftedBy(o.offsetSize)),n.modelCursor=n.modelRange.end)},{priority:`low`}))}var w6=class extends F{static get pluginName(){return`StandardEditingModeUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.ui.componentFactory;t.add(`restrictedEditingException:dropdown`,n=>{let r=Nx(n),i=n.t,a=[t.create(`restrictedEditingException:inline`),t.create(`restrictedEditingException:block`)];for(let e of a)e.set({withText:!0,tooltip:!1});return Fx(r,a,{enableActiveItemFocusOnDropdownOpen:!0,isVertical:!0,ariaLabel:i(`Enable editing`)}),r.buttonView.set({label:i(`Enable editing`),icon:g_,tooltip:!0}),r.extendTemplate({attributes:{class:`ck-restricted-editing-dropdown`}}),r.bind(`isEnabled`).toMany(a,`isEnabled`,(...e)=>e.some(e=>e)),this.listenTo(r,`execute`,()=>{e.editing.view.focus()}),r}),t.add(`restrictedEditingException:inline`,()=>{let e=this._createButton(`restrictedEditingException`,H);return e.set({tooltip:!0}),e}),t.add(`restrictedEditingException:block`,()=>{let e=this._createButton(`restrictedEditingExceptionBlock`,H);return e.set({tooltip:!0}),e}),t.add(`menuBar:restrictedEditingException:inline`,()=>this._createButton(`restrictedEditingException`,U)),t.add(`menuBar:restrictedEditingException:block`,()=>this._createButton(`restrictedEditingExceptionBlock`,U)),t.add(`restrictedEditingException:auto`,()=>{let e=this._createButton(`restrictedEditingExceptionAuto`,H);return e.set({tooltip:!0}),e}),t.add(`menuBar:restrictedEditingException:auto`,()=>this._createButton(`restrictedEditingExceptionAuto`,U)),t.add(`restrictedEditingException`,()=>t.create(`restrictedEditingException:inline`)),t.add(`menuBar:restrictedEditingException`,()=>t.create(`menuBar:restrictedEditingException:inline`))}_createButton(e,t){let n=this.editor,r=n.locale,i=this.editor.commands.get(e),a=new t(r),o=r.t;return a.icon=g_,a.isToggleable=!0,a.bind(`isOn`,`isEnabled`).to(i,`value`,`isEnabled`),e==`restrictedEditingExceptionAuto`?a.bind(`label`).to(i,`value`,e=>o(e?`Disable editing`:`Enable editing`)):e==`restrictedEditingExceptionBlock`?a.bind(`label`).to(i,`value`,e=>o(e?`Disable block editing`:`Enable block editing`)):a.bind(`label`).to(i,`value`,e=>o(e?`Disable inline editing`:`Enable inline editing`)),this.listenTo(a,`execute`,()=>{n.execute(e),n.editing.view.focus()}),a}},T6=class extends F{static get pluginName(){return`StandardEditingMode`}static get isOfficialPlugin(){return!0}static get requires(){return[S6,w6]}};const E6=`ck-show-blocks`,D6=`__TEXT__`,O6=[[`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`]],k6={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'>${D6}</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'>${D6}</text></svg>`};var A6=class extends I{constructor(e){super(e),this.affectsData=!1,this.value=!1}execute(){let e=this.editor.editing.view;e.change(t=>{for(let n of e.document.roots)n.hasClass(E6)?(t.removeClass(E6,n),this.value=!1):(j6(t,n),t.addClass(E6,n),this.value=!0)})}};function j6(e,t){if(!t.getStyle(`--ck-show-blocks-label-address-ltr`))for(let[n,r]of O6)e.setStyle(`--ck-show-blocks-label-${n}-ltr`,M6(r,`ltr`),t),e.setStyle(`--ck-show-blocks-label-${n}-rtl`,M6(r,`rtl`),t)}function M6(e,t){return`url("data:image/svg+xml;utf8,${k6[t].replace(D6,e)}")`}var N6=class extends F{static get pluginName(){return`ShowBlocksEditing`}static get isOfficialPlugin(){return!0}init(){let{editor:e}=this;e.commands.add(`showBlocks`,new A6(e))}},P6=class extends F{static get pluginName(){return`ShowBlocksUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor;e.ui.componentFactory.add(`showBlocks`,()=>{let e=this._createButton(H);return e.set({tooltip:!0,icon:ay}),e}),e.ui.componentFactory.add(`menuBar:showBlocks`,()=>this._createButton(U))}_createButton(e){let t=this.editor,n=t.locale,r=t.commands.get(`showBlocks`),i=new e(n),a=n.t;return i.set({label:a(`Show blocks`),isToggleable:!0,role:`menuitemcheckbox`}),i.bind(`isEnabled`).to(r),i.bind(`isOn`).to(r,`value`,r,`isEnabled`,(e,t)=>e&&t),this.listenTo(i,`execute`,()=>{t.execute(`showBlocks`),t.editing.view.focus()}),i}},F6=class extends F{static get pluginName(){return`ShowBlocks`}static get isOfficialPlugin(){return!0}static get requires(){return[N6,P6]}};const I6=`SourceEditingMode`;var L6=class extends F{static get pluginName(){return`SourceEditing`}static get isOfficialPlugin(){return!0}static get requires(){return[wg]}_elementReplacer;_replacedRoots;_dataFromRoots;constructor(e){super(e),this.set(`isSourceEditingMode`,!1),this._elementReplacer=new lr,this._replacedRoots=new Map,this._dataFromRoots=new Map,e.config.define(`sourceEditing.allowCollaborationFeatures`,!1)}init(){this._checkCompatibility();let e=this.editor,t=e.locale.t;e.ui.componentFactory.add(`sourceEditing`,()=>{let e=this._createButton(H);return e.set({label:t(`Source`),icon:cy,tooltip:!0,class:`ck-source-editing-button`}),e}),e.ui.componentFactory.add(`menuBar:sourceEditing`,()=>{let e=this._createButton(U);return e.set({label:t(`Show source`),role:`menuitemcheckbox`}),e}),this._isAllowedToHandleSourceEditingMode()&&(this.on(`change:isSourceEditingMode`,(e,t,n)=>{n?(this._hideVisibleDialog(),this._showSourceEditing(),this._disableCommands()):(this._hideSourceEditing(),this._enableCommands())}),this.on(`change:isEnabled`,(e,t,n)=>this._handleReadOnlyMode(!n)),this.listenTo(e,`change:isReadOnly`,(e,t,n)=>this._handleReadOnlyMode(n))),e.data.on(`get`,()=>{this.isSourceEditingMode&&this.updateEditorData()},{priority:`high`})}updateEditorData(){let e=this.editor,t={};for(let[e,n]of this._replacedRoots){let r=this._dataFromRoots.get(e),i=n.dataset.value;r!==i&&(t[e]=i,this._dataFromRoots.set(e,i))}Object.keys(t).length&&e.data.set(t,{batchType:{isUndoable:!0},suppressErrorInCollaboration:!0})}_checkCompatibility(){let e=this.editor,t=e.config.get(`sourceEditing.allowCollaborationFeatures`);if(!t&&e.plugins.has(`RealTimeCollaborativeEditing`))throw new w(`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(){let e=this.editor,t=e.editing.view,n=e.model;n.change(e=>{e.setSelection(null),e.removeSelectionAttribute(n.document.selection.getAttributeKeys())});for(let[n,r]of t.domRoots){let i=R6(e.data.get({rootName:n})),a=mr(r.ownerDocument,`textarea`,{rows:`1`,"aria-label":`Source code editing area`}),o=mr(r.ownerDocument,`div`,{class:`ck-source-editing-area`,"data-value":i},[a]);a.value=i,a.setSelectionRange(0,0),a.addEventListener(`input`,()=>{o.dataset.value=a.value,e.ui.update()}),a.addEventListener(`keydown`,e=>{let t=e.key.toLowerCase();(e.ctrlKey||e.metaKey)&&!e.altKey&&(t===`z`||t===`y`)&&(e.stopImmediatePropagation(),p.isMac&&t===`y`&&(e.preventDefault(),r.ownerDocument.execCommand(`redo`)))}),t.change(e=>{let r=t.document.getRoot(n);e.addClass(`ck-hidden`,r)}),e.ui.setEditableElement(`sourceEditing:`+n,a),this._replacedRoots.set(n,o),this._elementReplacer.replace(r,o),this._dataFromRoots.set(n,i)}this._hideDocumentOutline(),this._refreshAnnotationsVisibility(),this._focusSourceEditing()}_hideSourceEditing(){let e=this.editor.editing.view;this.updateEditorData(),e.change(t=>{for(let[n]of this._replacedRoots)t.removeClass(`ck-hidden`,e.document.getRoot(n))}),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(){let e=this.editor,[t]=this._replacedRoots.values(),n=t.querySelector(`textarea`);e.editing.view.document.isFocused=!1,n.focus()}_disableCommands(){let e=this.editor;for(let t of e.commands.commands())t.forceDisabled(I6);e.plugins.has(`CommentsArchiveUI`)&&e.plugins.get(`CommentsArchiveUI`).forceDisabled(I6)}_enableCommands(){let e=this.editor;for(let t of e.commands.commands())t.clearForceDisabled(I6);e.plugins.has(`CommentsArchiveUI`)&&e.plugins.get(`CommentsArchiveUI`).clearForceDisabled(I6)}_handleReadOnlyMode(e){if(this.isSourceEditingMode)for(let[,t]of this._replacedRoots)t.querySelector(`textarea`).readOnly=e}_isAllowedToHandleSourceEditingMode(){let e=this.editor.ui.view.editable;return e&&!e.hasExternalElement}_hideVisibleDialog(){if(this.editor.plugins.has(`Dialog`)){let e=this.editor.plugins.get(`Dialog`);e.isOpen&&e.hide()}}_createButton(e){let t=this.editor,n=new e(t.locale);return n.set({withText:!0,isToggleable:!0}),n.bind(`isOn`).to(this,`isSourceEditingMode`),n.bind(`isEnabled`).to(this,`isEnabled`,t,`isReadOnly`,t.plugins.get(wg),`hasAny`,(e,t,n)=>!(!e||t||n)),this.listenTo(n,`execute`,()=>{this.isSourceEditingMode=!this.isSourceEditingMode}),n}};function R6(e){return z6(e)?Qi(e):e}function z6(e){return e.startsWith(`<`)}var B6=class extends P{tiles;focusTracker;keystrokes;constructor(e){super(e),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 M,this.keystrokes=new N,$a({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.tiles,numberOfColumns:()=>u.window.getComputedStyle(this.element.firstChild).getPropertyValue(`grid-template-columns`).split(` `).length,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}createTile(e,t){let n=new H(this.locale);return n.set({label:e,withText:!0,class:`ck-character-grid__tile`}),n.extendTemplate({attributes:{title:t},on:{mouseover:n.bindTemplate.to(`mouseover`),focus:n.bindTemplate.to(`focus`)}}),n.on(`mouseover`,()=>{this.fire(`tileHover`,{name:t,character:e})}),n.on(`focus`,()=>{this.fire(`tileFocus`,{name:t,character:e})}),n.on(`execute`,()=>{this.fire(`execute`,{name:t,character:e})}),n}render(){super.render();for(let e of this.tiles)this.focusTracker.add(e.element);this.tiles.on(`change`,(e,{added:t,removed:n})=>{if(t.length>0)for(let e of t)this.focusTracker.add(e.element);if(n.length>0)for(let e of n)this.focusTracker.remove(e.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.keystrokes.destroy(),this.focusTracker.destroy()}focus(){this.tiles.first.focus()}},V6=class extends P{constructor(e){super(e);let t=this.bindTemplate;this.set(`character`,null),this.set(`name`,null),this.bind(`code`).to(this,`character`,H6),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 H6(e){return e===null?``:`U+`+(`0000`+e.codePointAt(0).toString(16)).slice(-4)}var U6=class extends P{items;focusTracker;keystrokes;_focusCycler;categoriesView;gridView;infoView;constructor(e,t,n,r){super(e),this.categoriesView=t,this.gridView=n,this.infoView=r,this.items=this.createCollection(),this.focusTracker=new M,this.keystrokes=new N,this._focusCycler=new Hy({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()}},W6=class extends P{_groupNames;_dropdownView;constructor(e,t){super(e),this.set(`currentGroupName`,Array.from(t.entries())[0][0]),this._groupNames=t,this._dropdownView=new Qb(e,Zx),this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-character-categories`]},children:[this._dropdownView]})}render(){super.render(),this._setupDropdown()}focus(){this._dropdownView.focus()}_setupDropdown(){let e=new Fi;for(let[t,n]of this._groupNames){let r={type:`button`,model:new RC({name:t,label:n,role:`menuitemradio`,withText:!0})};r.model.bind(`isOn`).to(this,`currentGroupName`,e=>e===t),e.add(r)}let t=this.locale.t,n=t(`Category`);this._dropdownView.set({label:n,isEmpty:!1}),this._dropdownView.fieldView.panelPosition=this.locale.uiLanguageDirection===`rtl`?`se`:`sw`,this._dropdownView.fieldView.buttonView.set({withText:!0,tooltip:n,ariaLabel:n,ariaLabelledBy:void 0,isOn:!1}),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}),Lx(this._dropdownView.fieldView,e,{ariaLabel:n,role:`menu`})}},G6=class extends F{_characters;_groups;_allSpecialCharactersGroupLabel;static get requires(){return[gT,Qy]}static get pluginName(){return`SpecialCharacters`}static get licenseFeatureCode(){return`SCH`}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}constructor(e){super(e);let t=e.t;this._characters=new Map,this._groups=new Map,this._allSpecialCharactersGroupLabel=t(`All`)}init(){let e=this.editor;e.ui.componentFactory.add(`specialCharacters`,()=>{let e=this._createDialogButton(H);return e.set({tooltip:!0}),e}),e.ui.componentFactory.add(`menuBar:specialCharacters`,()=>this._createDialogButton(U))}addItems(e,t,n={label:e}){if(e===`All`)throw new w(`special-character-invalid-group-name`,null);let r=this._getGroup(e,n.label);for(let e of t)r.items.add(e.title),this._characters.set(e.title,e.character)}getGroups(){let e=Array.from(this._groups.keys()),t=this.editor.config.get(`specialCharacters.order`)||[],n=t.find(t=>!e.includes(t));if(n)throw new w(`special-character-invalid-order-group-name`,null,{invalidGroup:n});return new Set([...t,...e])}getCharactersForGroup(e){if(e===`All`)return new Set(this._characters.keys());let t=this._groups.get(e);if(t)return t.items}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();let n=this.getCharactersForGroup(e);for(let e of n){let n=this.getCharacter(e);t.tiles.add(t.createTile(n,e))}}_createDropdownPanelContent(e){let t=Array.from(this.getGroups()).map(e=>[e,this._groups.get(e).label]),n=new W6(e,new Map([[`All`,this._allSpecialCharactersGroupLabel],...t])),r=new B6(e),i=new V6(e);return r.on(`tileHover`,(e,t)=>{i.set(t)}),r.on(`tileFocus`,(e,t)=>{i.set(t)}),n.on(`change:currentGroupName`,(e,t,n)=>{this._updateGrid(n,r)}),this._updateGrid(n.currentGroupName,r),{categoriesView:n,gridView:r,infoView:i}}_createDialogButton(e){let t=this.editor,n=t.locale,r=new e(t.locale),i=t.commands.get(`insertText`),a=n.t,o=this.editor.plugins.get(`Dialog`);return r.set({label:a(`Special characters`),icon:uy,isToggleable:!0}),r.bind(`isOn`).to(o,`id`,e=>e===`specialCharacters`),r.bind(`isEnabled`).to(i,`isEnabled`),r.on(`execute`,()=>{if(o.id===`specialCharacters`){o.hide();return}this._showDialog()}),r}_showDialog(){let e=this.editor,t=e.plugins.get(`Dialog`),n=e.locale,r=n.t,{categoriesView:i,gridView:a,infoView:o}=this._createDropdownPanelContent(n),s=new U6(n,i,a,o);a.on(`execute`,(t,n)=>{e.execute(`insertText`,{text:n.character})}),t.show({id:`specialCharacters`,title:r(`Special characters`),className:`ck-special-characters`,content:s,position:Jy.EDITOR_TOP_SIDE})}},K6=class extends F{static get pluginName(){return`SpecialCharactersArrows`}static get isOfficialPlugin(){return!0}init(){let 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`)})}},q6=class extends F{static get pluginName(){return`SpecialCharactersText`}static get isOfficialPlugin(){return!0}init(){let 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`)})}},J6=class extends F{static get pluginName(){return`SpecialCharactersMathematical`}static get isOfficialPlugin(){return!0}init(){let 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`)})}},Y6=class extends F{static get pluginName(){return`SpecialCharactersLatin`}static get isOfficialPlugin(){return!0}init(){let 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:`IJ`,title:t(`Latin capital ligature ij`)},{character:`ij`,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:`ʼn`,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`)})}},X6=class extends F{static get pluginName(){return`SpecialCharactersCurrency`}static get isOfficialPlugin(){return!0}init(){let 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`)})}},Z6=class extends F{static get pluginName(){return`SpecialCharactersEssentials`}static get isOfficialPlugin(){return!0}static get requires(){return[X6,q6,J6,K6,Y6]}},Q6=class extends H{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:!0}),this.extendTemplate({attributes:{role:`option`}}),this.children.add(this.previewView,0)}_createPreview(){let e=new P(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}},$6=class extends P{focusTracker;keystrokes;children;constructor(e,t){super(e),this.focusTracker=new M,this.keystrokes=new N,this.set(`activeStyles`,[]),this.set(`enabledStyles`,[]),this.children=this.createCollection(),this.children.delegate(`execute`).to(this);for(let n of t){let t=new Q6(e,n);this.children.add(t)}this.on(`change:activeStyles`,()=>{for(let e of this.children)e.isOn=this.activeStyles.includes(e.styleDefinition.name)}),this.on(`change:enabledStyles`,()=>{for(let 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(let e of this.children)this.focusTracker.add(e.element);$a({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()}},e8=class extends P{gridView;labelView;constructor(e,t,n){super(e),this.labelView=new eo(e),this.labelView.text=t,this.gridView=new $6(e,n),this.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-style-panel__style-group`],role:`group`,"aria-labelledby":this.labelView.id},children:[this.labelView,this.gridView]})}},t8=class extends P{focusTracker;keystrokes;children;blockStylesGroupView;inlineStylesGroupView;_focusables;_focusCycler;constructor(e,t){super(e);let n=e.t;this.focusTracker=new M,this.keystrokes=new N,this.children=this.createCollection(),this.blockStylesGroupView=new e8(e,n(`Block styles`),t.block),this.inlineStylesGroupView=new e8(e,n(`Text styles`),t.inline),this.set(`activeStyles`,[]),this.set(`enabledStyles`,[]),this._focusables=new pa,this._focusCycler=new Hy({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 n8=[`caption`,`colgroup`,`dd`,`dt`,`figcaption`,`legend`,`li`,`optgroup`,`option`,`rp`,`rt`,`summary`,`tbody`,`td`,`tfoot`,`th`,`thead`,`tr`];var r8=class extends F{_htmlSupport;static get pluginName(){return`StyleUtils`}static get isOfficialPlugin(){return!0}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=[]){let n={block:[],inline:[]};for(let r of t){let t=[],i=[];for(let n of e.getDefinitionsForView(r.element)){let e=`appliesToBlock`in n?n.appliesToBlock:!1;if(n.isBlock||e){if(typeof e==`string`)t.push(e);else if(n.isBlock){let e=n;t.push(n.model),e.paragraphLikeModel&&t.push(e.paragraphLikeModel)}}else i.push(n.model)}let a=this.getStylePreview(r,[{text:`AaBbCcDdEeFfGgHhIiJj`}]);t.length?n.block.push({...r,previewTemplate:a,modelElements:t,isBlock:!0}):n.inline.push({...r,previewTemplate:a,ghsAttributes:i})}return n}isStyleEnabledForBlock(e,t){let n=this.editor.model,r=this._htmlSupport.getGhsAttributeNameForElement(e.element);return n.schema.checkAttribute(t,r)?e.modelElements.includes(t.name):!1}isStyleActiveForBlock(e,t){let n=this._htmlSupport.getGhsAttributeNameForElement(e.element),r=t.getAttribute(n);return this.hasAllClasses(r,e.classes)}getAffectedBlocks(e,t){return e.modelElements.includes(t.name)?[t]:null}isStyleEnabledForInlineSelection(e,t){let n=this.editor.model;for(let r of e.ghsAttributes)if(n.schema.checkAttributeInSelection(t,r))return!0;return!1}isStyleActiveForInlineSelection(e,t){for(let n of e.ghsAttributes){let r=this._getValueFromFirstAllowedNode(t,n);if(this.hasAllClasses(r,e.classes))return!0}return!1}getAffectedInlineSelectable(e,t){return t}getStylePreview(e,t){let{element:n,classes:r}=e;return{tag:a8(n)?n:`div`,attributes:{class:r},children:t}}hasAllClasses(e,t){return Xe(e)&&i8(e)&&t.every(t=>e.classes.includes(t))}configureGHSDataFilter({block:e,inline:t}){let n=this.editor.plugins.get(`DataFilter`);n.loadAllowedConfig(e.map(o8)),n.loadAllowedConfig(t.map(o8))}_getValueFromFirstAllowedNode(e,t){let n=this.editor.model.schema;if(e.isCollapsed)return e.getAttribute(t);for(let r of e.getRanges())for(let e of r.getItems())if(n.checkAttribute(e,t))return e.getAttribute(t);return null}};function i8(e){return!!e.classes&&Array.isArray(e.classes)}function a8(e){return!n8.includes(e)}function o8({element:e,classes:t}){return{name:e,classes:t}}var s8=class extends F{static get pluginName(){return`StyleUI`}static get isOfficialPlugin(){return!0}static get requires(){return[r8]}init(){let e=this.editor,t=e.plugins.get(`DataSchema`),n=e.plugins.get(`StyleUtils`),r=e.config.get(`style.definitions`),i=n.normalizeConfig(t,r);e.ui.componentFactory.add(`style`,t=>{let n=t.t,r=Nx(t),a=e.commands.get(`style`);return r.once(`change:isOpen`,()=>{let e=new t8(t,i);r.panelView.children.add(e),e.delegate(`execute`).to(r),e.bind(`activeStyles`).to(a,`value`),e.bind(`enabledStyles`).to(a,`enabledStyles`)}),r.bind(`isEnabled`).to(a),r.buttonView.withText=!0,r.buttonView.bind(`label`).to(a,`value`,e=>e.length>1?n(`Multiple styles`):e.length===1?e[0]:n(`Styles`)),r.bind(`class`).to(a,`value`,e=>{let t=[`ck-style-dropdown`];return e.length>1&&t.push(`ck-style-dropdown_multiple-active`),t.join(` `)}),r.on(`execute`,t=>{e.execute(`style`,{styleName:t.source.styleDefinition.name}),e.editing.view.focus()}),r})}},c8=class extends I{_styleDefinitions;_styleUtils;constructor(e,t){super(e),this.set(`value`,[]),this.set(`enabledStyles`,[]),this._styleDefinitions=t,this._styleUtils=this.editor.plugins.get(r8)}refresh(){let e=this.editor.model,t=e.document.selection,n=new Set,r=new Set;for(let e of this._styleDefinitions.inline)this._styleUtils.isStyleEnabledForInlineSelection(e,t)&&r.add(e.name),this._styleUtils.isStyleActiveForInlineSelection(e,t)&&n.add(e.name);let i=j(t.getSelectedBlocks())||t.getFirstPosition().parent;if(i){let t=i.getAncestors({includeSelf:!0,parentFirst:!0});for(let i of t){if(i.is(`rootElement`))break;for(let e of this._styleDefinitions.block)this._styleUtils.isStyleEnabledForBlock(e,i)&&(r.add(e.name),this._styleUtils.isStyleActiveForBlock(e,i)&&n.add(e.name));if(e.schema.isObject(i))break}}this.enabledStyles=Array.from(r).sort(),this.isEnabled=this.enabledStyles.length>0,this.value=this.isEnabled?Array.from(n).sort():[]}execute({styleName:e,forceValue:t}){if(!this.enabledStyles.includes(e)){T(`style-command-executed-with-incorrect-style-name`);return}let n=this.editor.model,r=n.document.selection,i=this.editor.plugins.get(`GeneralHtmlSupport`),a=[...this._styleDefinitions.inline,...this._styleDefinitions.block],o=a.filter(({name:e})=>this.value.includes(e)),s=a.find(({name:t})=>t==e),c=t===void 0?!this.value.includes(s.name):t;n.change(()=>{let e;e=u8(s)?this._findAffectedBlocks(d8(r),s):[this._styleUtils.getAffectedInlineSelectable(s,r)];for(let t of e)c?i.addModelHtmlClass(s.element,s.classes,t):i.removeModelHtmlClass(s.element,l8(o,s),t)})}_findAffectedBlocks(e,t){let n=new Set;for(let r of e){let e=r.getAncestors({includeSelf:!0,parentFirst:!0});for(let r of e){if(r.is(`rootElement`))break;let e=this._styleUtils.getAffectedBlocks(t,r);if(e){for(let t of e)n.add(t);break}}}return n}};function l8(e,t){return e.reduce((e,n)=>n.name===t.name?e:e.filter(e=>!n.classes.includes(e)),t.classes)}function u8(e){return`isBlock`in e}function d8(e){let t=Array.from(e.getSelectedBlocks());return t.length?t:[e.getFirstPosition().parent]}var f8=class extends F{_listUtils;_styleUtils;_htmlSupport;static get pluginName(){return`ListStyleSupport`}static get isOfficialPlugin(){return!0}static get requires(){return[r8,cR]}init(){let e=this.editor;e.plugins.has(`ListEditing`)&&(this._styleUtils=e.plugins.get(r8),this._listUtils=this.editor.plugins.get(`ListUtils`),this._htmlSupport=this.editor.plugins.get(cR),this.listenTo(this._styleUtils,`isStyleEnabledForBlock`,(e,[t,n])=>{this._isStyleEnabledForBlock(t,n)&&(e.return=!0,e.stop())},{priority:`high`}),this.listenTo(this._styleUtils,`isStyleActiveForBlock`,(e,[t,n])=>{this._isStyleActiveForBlock(t,n)&&(e.return=!0,e.stop())},{priority:`high`}),this.listenTo(this._styleUtils,`getAffectedBlocks`,(e,[t,n])=>{let r=this._getAffectedBlocks(t,n);r&&(e.return=r,e.stop())},{priority:`high`}),this.listenTo(this._styleUtils,`getStylePreview`,(e,[t,n])=>{let r=this._getStylePreview(t,n);r&&(e.return=r,e.stop())},{priority:`high`}))}_isStyleEnabledForBlock(e,t){let n=this.editor.model;if(![`ol`,`ul`,`li`].includes(e.element)||!this._listUtils.isListItemBlock(t))return!1;let r=this._htmlSupport.getGhsAttributeNameForElement(e.element);if(e.element==`ol`||e.element==`ul`){if(!n.schema.checkAttribute(t,r))return!1;let i=this._listUtils.isNumberedListType(t.getAttribute(`listType`))?`ol`:`ul`;return e.element==i}else return n.schema.checkAttribute(t,r)}_isStyleActiveForBlock(e,t){let n=this._htmlSupport.getGhsAttributeNameForElement(e.element),r=t.getAttribute(n);return this._styleUtils.hasAllClasses(r,e.classes)}_getAffectedBlocks(e,t){return this._isStyleEnabledForBlock(e,t)?e.element==`li`?this._listUtils.expandListBlocksToCompleteItems(t,{withNested:!1}):this._listUtils.expandListBlocksToCompleteList(t):null}_getStylePreview(e,t){let{element:n,classes:r}=e;return n==`ol`||n==`ul`?{tag:n,attributes:{class:r},children:[{tag:`li`,children:t}]}:n==`li`?{tag:`ol`,children:[{tag:n,attributes:{class:r},children:t}]}:null}},p8=class extends F{_tableUtils;_styleUtils;static get pluginName(){return`TableStyleSupport`}static get isOfficialPlugin(){return!0}static get requires(){return[r8]}init(){let e=this.editor;e.plugins.has(`TableEditing`)&&(this._styleUtils=e.plugins.get(r8),this._tableUtils=this.editor.plugins.get(`TableUtils`),this.listenTo(this._styleUtils,`isStyleEnabledForBlock`,(e,[t,n])=>{this._isApplicable(t,n)&&(e.return=this._isStyleEnabledForBlock(t,n),e.stop())},{priority:`high`}),this.listenTo(this._styleUtils,`getAffectedBlocks`,(e,[t,n])=>{this._isApplicable(t,n)&&(e.return=this._getAffectedBlocks(t,n),e.stop())},{priority:`high`}),this.listenTo(this._styleUtils,`configureGHSDataFilter`,(e,[{block:t}])=>{this.editor.plugins.get(`DataFilter`).loadAllowedConfig(t.filter(e=>e.element==`figcaption`).map(e=>({name:`caption`,classes:e.classes})))}))}_isApplicable(e,t){return[`td`,`th`].includes(e.element)?t.name==`tableCell`:[`thead`,`tbody`,`tfoot`].includes(e.element)?t.name==`table`:!1}_isStyleEnabledForBlock(e,t){if([`td`,`th`].includes(e.element)){let n=this._tableUtils.getCellLocation(t),r=t.parent.parent,i=r.getAttribute(`headingRows`)||0,a=r.getAttribute(`headingColumns`)||0,o=n.row<i||n.column<a;return e.element==`th`?o:!o}if([`thead`,`tbody`,`tfoot`].includes(e.element)){let n=t.getAttribute(`headingRows`)||0,r=t.getAttribute(`footerRows`)||0;return e.element==`thead`?n>0:e.element==`tfoot`?r>0:n+r<this._tableUtils.getRows(t)}return!1}_getAffectedBlocks(e,t){return this._isStyleEnabledForBlock(e,t)?[t]:null}},m8=class extends F{_styleUtils;_htmlSupport;static get pluginName(){return`LinkStyleSupport`}static get isOfficialPlugin(){return!0}static get requires(){return[r8,cR]}init(){let e=this.editor;e.plugins.has(`LinkEditing`)&&(this._styleUtils=e.plugins.get(r8),this._htmlSupport=this.editor.plugins.get(cR),this.listenTo(this._styleUtils,`isStyleEnabledForInlineSelection`,(e,[t,n])=>{t.element==`a`&&(e.return=this._isStyleEnabled(t,n),e.stop())},{priority:`high`}),this.listenTo(this._styleUtils,`isStyleActiveForInlineSelection`,(e,[t,n])=>{t.element==`a`&&(e.return=this._isStyleActive(t,n),e.stop())},{priority:`high`}),this.listenTo(this._styleUtils,`getAffectedInlineSelectable`,(e,[t,n])=>{if(t.element!=`a`)return;let r=this._getAffectedSelectable(t,n);r&&(e.return=r,e.stop())},{priority:`high`}))}_isStyleEnabled(e,t){let n=this.editor.model;if(t.isCollapsed)return t.hasAttribute(`linkHref`);for(let e of t.getRanges())for(let t of e.getItems())if((t.is(`$textProxy`)||n.schema.isInline(t))&&t.hasAttribute(`linkHref`))return!0;return!1}_isStyleActive(e,t){let n=this.editor.model,r=this._htmlSupport.getGhsAttributeNameForElement(e.element);if(t.isCollapsed){if(t.hasAttribute(`linkHref`)){let n=t.getAttribute(r);if(this._styleUtils.hasAllClasses(n,e.classes))return!0}return!1}for(let i of t.getRanges())for(let t of i.getItems())if((t.is(`$textProxy`)||n.schema.isInline(t))&&t.hasAttribute(`linkHref`)){let n=t.getAttribute(r);return this._styleUtils.hasAllClasses(n,e.classes)}return!1}_getAffectedSelectable(e,t){let n=this.editor.model;if(t.isCollapsed){let e=t.getAttribute(`linkHref`);return LT(t.getFirstPosition(),`linkHref`,e,n)}let r=[];for(let e of t.getRanges()){let t=n.createRange(h8(e.start,`linkHref`,!0,n),h8(e.end,`linkHref`,!1,n));for(let e of t.getItems())(e.is(`$textProxy`)||n.schema.isInline(e))&&e.hasAttribute(`linkHref`)&&r.push(this.editor.model.createRangeOn(e))}return g8(r)}};function h8(e,t,n,r){let i=e.textNode||(n?e.nodeAfter:e.nodeBefore);return!i||!i.hasAttribute(t)?e:RT(e,t,i.getAttribute(t),n,r)}function g8(e){for(let t=1;t<e.length;t++){let n=e[t-1].getJoined(e[t]);n&&e.splice(--t,2,n)}return e}var _8=class extends F{static get pluginName(){return`StyleEditing`}static get isOfficialPlugin(){return!0}static get requires(){return[cR,r8,f8,p8,m8]}init(){let e=this.editor,t=e.plugins.get(`DataSchema`),n=e.plugins.get(`StyleUtils`),r=e.config.get(`style.definitions`),i=n.normalizeConfig(t,r);e.commands.add(`style`,new c8(e,i)),n.configureGHSDataFilter(i)}},v8=class extends F{static get pluginName(){return`Style`}static get isOfficialPlugin(){return!0}static get requires(){return[_8,s8]}};const y8=/^(left|center|right)$/,b8=/^(left|none|right)$/;function x8(e,t){let{modelAttribute:n,styleName:r,attributeName:i,attributeType:a,viewElement:o,defaultValue:s,shouldUpcast:c=()=>!0,reduceBoxSides:l=!1}=t;e.for(`upcast`).attributeToAttribute({view:{name:o,styles:{[r]:/[\s\S]+/}},model:{key:n,value:(e,t,n)=>{if(!c(e))return;let i=T8(s,``,n),a=e.getNormalizedStyle(r),o=l?E8(a):a;if(i!==o)return o;t.consumable.consume(e,{styles:r})}}}),i&&e.for(`upcast`).attributeToAttribute({view:{name:o,attributes:{[i]:/.+/}},model:{key:n,value:(e,t,n)=>{if(e.name==`figure`||e.hasStyle(r)||e.name==`table`&&e.parent.name==`figure`&&e.parent.hasStyle(r))return;let o=T8(s,``,n),c=e.getAttribute(i);if(c&&a==`length`){let e=parseFloat(c);c=isNaN(e)?o:e+(c.includes(`%`)?`%`:`px`)}if(o!==c)return c;t.consumable.consume(e,{attributes:i})}}})}function S8(e,t,n,r){let{conversion:i}=e;i.for(`upcast`).add(e=>{e.on(`element:${t}`,(e,t,i)=>{let{modelRange:a,viewItem:o}=t;if(!a)return;let s=[`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=>o.hasStyle(e)),c=o.is(`element`,`table`)?o:o.findAncestor(`table`),l=c.hasAttribute(`border`);if(!s.length&&!l)return;let u={styles:s};if(!i.consumable.test(o,u))return;let d=j(a.getItems({shallow:!0})),f=d.findAncestor(`table`,{includeSelf:!0}),p=r;f&&f.getAttribute(`tableType`)==`layout`&&(p={style:`none`,color:``,width:``}),i.consumable.consume(o,u);let m={style:o.getNormalizedStyle(`border-style`),color:o.getNormalizedStyle(`border-color`),width:o.getNormalizedStyle(`border-width`)};if(l&&i.consumable.test(c,{attributes:`border`})){let e=parseFloat(c.getAttribute(`border`)||`1`),t=Number.isNaN(e)||!Number.isFinite(e)||e<0||o.name!=`table`&&e>1?`1px`:`${e}px`;m.width={top:t,bottom:t,right:t,left:t,...m.width||{}},o.is(`element`,`table`)&&i.consumable.consume(c,{attributes:`border`})}let h={style:E8(m.style),color:E8(m.color),width:E8(m.width)};h.style!==p.style&&i.writer.setAttribute(n.style,h.style,d),h.color!==p.color&&i.writer.setAttribute(n.color,h.color,d),h.width!==p.width&&i.writer.setAttribute(n.width,h.width,d)})})}function C8(e,t){let{modelElement:n,modelAttribute:r,styleName:i}=t;e.for(`downcast`).attributeToAttribute({model:{name:n,key:r},view:e=>({key:`style`,value:{[i]:e}})})}function w8(e,t){let{modelAttribute:n,styleName:r}=t;e.for(`downcast`).add(e=>{e.on(`attribute:${n}:table`,(e,t,n)=>{let{item:i,attributeNewValue:a}=t,{mapper:o,writer:s}=n;if(!n.consumable.consume(t.item,e.name))return;let c=Array.from(o.toViewElement(i).getChildren()).find(e=>e.is(`element`,`table`));a?s.setStyle(r,a,c):s.removeStyle(r,c)})})}function T8(e,t,n){let r=n.modelRange&&j(n.modelRange.getItems({shallow:!0})),i=r&&r.is(`element`)&&r.findAncestor(`table`,{includeSelf:!0});return i&&i.getAttribute(`tableType`)===`layout`?t:e}function E8(e){if(!e)return;let t=[`top`,`right`,`bottom`,`left`];if(!t.every(t=>e[t]))return e;let n=e.top;return t.every(t=>e[t]===n)?n:e}function D8(e,t,n){let{conversion:r}=e;r.for(`upcast`).add(e=>{e.on(`element:${t}`,(e,t,r)=>{let{modelRange:i,viewItem:a}=t;if(!i)return;if(a.is(`element`,`table`)){r.consumable.consume(a,{attributes:`cellpadding`});return}let o=a.findAncestor(`table`);if(!o.hasAttribute(`cellpadding`)||!r.consumable.test(o,{attributes:`cellpadding`}))return;let s=i?.start?.nodeAfter,c=parseFloat(o.getAttribute(`cellpadding`)||`1`),l=Number.isNaN(c)||!Number.isFinite(c)||c<0?`0px`:`${c}px`,u=s.getAttribute(`tableCellPadding`);if(!u)n!==l&&r.writer.setAttribute(`tableCellPadding`,l,s);else if(typeof u==`object`){let e={...n!==l&&{top:l},...n!==l&&{right:l},...n!==l&&{bottom:l},...n!==l&&{left:l},...u};r.writer.setAttribute(`tableCellPadding`,e,s)}},{priority:`low`})})}const O8={left:{className:`table-style-align-left`},center:{className:`table-style-align-center`},right:{className:`table-style-align-right`},blockLeft:{className:`table-style-block-align-left`},blockRight:{className:`table-style-block-align-right`}},k8=[{view:{name:/^(table|figure)$/,styles:{float:b8}},getAlign:e=>{let t=e.getStyle(`float`);return t===`none`&&(t=`center`),t},getConsumables(e){let t=e.getStyle(`float`),n=[`float`];return t===`left`&&e.hasStyle(`margin-right`)?n.push(`margin-right`):t===`right`&&e.hasStyle(`margin-left`)&&n.push(`margin-left`),{styles:n}}},{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(){return{classes:O8.left.className}}},{view:{name:/^(table|figure)$/,key:`class`,value:O8.right.className},getAlign:()=>`right`,getConsumables(){return{classes:O8.right.className}}},{view:{name:/^(table|figure)$/,key:`class`,value:O8.center.className},getAlign:()=>`center`,getConsumables(){return{classes:O8.center.className}}},{view:{name:/^(table|figure)$/,key:`class`,value:O8.blockLeft.className},getAlign:()=>`blockLeft`,getConsumables(){return{classes:O8.blockLeft.className}}},{view:{name:/^(table|figure)$/,key:`class`,value:O8.blockRight.className},getAlign:()=>`blockRight`,getConsumables(){return{classes:O8.blockRight.className}}},{view:{name:/^(table|figure)$/,styles:{"margin-left":`0`,"margin-right":`auto`}},getAlign:()=>`blockLeft`,getConsumables(){return{styles:[`margin-left`,`margin-right`]}}},{view:{name:/^(table|figure)$/,styles:{"margin-left":`auto`,"margin-right":`0`}},getAlign:()=>`blockRight`,getConsumables(){return{styles:[`margin-left`,`margin-right`]}}},{view:{name:`table`,attributes:{align:y8}},getAlign:e=>e.getAttribute(`align`),getConsumables(){return{attributes:`align`}}}],A8={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:O8.blockLeft.className},blockRight:{align:void 0,style:`margin-left: auto; margin-right: 0;`,className:O8.blockRight.className}};var $=class{_table;_startRow;_endRow;_startColumn;_endColumn;_includeAllSlots;_skipRows;_row;_rowIndex;_column;_cellIndex;_spannedCells;_nextCellAtColumn;_jumpedToStartRow=!1;constructor(e,t={}){this._table=e,this._startRow=t.row===void 0?t.startRow||0:t.row,this._endRow=t.row===void 0?t.endRow:t.row,this._startColumn=t.column===void 0?t.startColumn||0:t.column,this._endColumn=t.column===void 0?t.endColumn:t.column,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();let e=this._table.getChild(this._rowIndex);if(!e||this._isOverEndRow())return{done:!0,value:void 0};if(!e.is(`element`,`tableRow`))return this._rowIndex++,this.next();if(this._isOverEndColumn())return this._advanceToNextRow();let t=null,n=this._getSpanned();if(n)this._includeAllSlots&&!this._shouldSkipSlot()&&(t=this._formatOutValue(n.cell,n.row,n.column));else{let n=e.getChild(this._cellIndex);if(!n)return this._advanceToNextRow();let r=parseInt(n.getAttribute(`colspan`)||`1`),i=parseInt(n.getAttribute(`rowspan`)||`1`);(r>1||i>1)&&this._recordSpans(n,i,r),this._shouldSkipSlot()||(t=this._formatOutValue(n)),this._nextCellAtColumn=this._column+r}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 this._endRow!==void 0&&this._row>this._endRow}_isOverEndColumn(){return this._endColumn!==void 0&&this._column>this._endColumn}_formatOutValue(e,t=this._row,n=this._column){return{done:!1,value:new j8(this,e,t,n)}}_shouldSkipSlot(){let e=this._skipRows.has(this._row),t=this._row<this._startRow,n=this._column<this._startColumn,r=this._endColumn!==void 0&&this._column>this._endColumn;return e||t||n||r}_getSpanned(){let e=this._spannedCells.get(this._row);return e&&e.get(this._column)||null}_recordSpans(e,t,n){let r={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+n;t++)(e!=this._row||t!=this._column)&&this._markSpannedCell(e,t,r)}_markSpannedCell(e,t,n){this._spannedCells.has(e)||this._spannedCells.set(e,new Map),this._spannedCells.get(e).set(t,n)}_canJumpToStartRow(){return!!this._startRow&&this._startRow>0&&!this._jumpedToStartRow}_jumpToNonSpannedRowClosestToStartRow(){let e=this._getRowLength(0);for(let t=this._startRow;!this._jumpedToStartRow;t--)e===this._getRowLength(t)&&(this._row=t,this._rowIndex=t,this._jumpedToStartRow=!0)}_getRowLength(e){return[...this._table.getChild(e).getChildren()].reduce((e,t)=>e+parseInt(t.getAttribute(`colspan`)||`1`),0)}},j8=class{cell;row;column;cellAnchorRow;cellAnchorColumn;_cellIndex;_rowIndex;_table;constructor(e,t,n,r){this.cell=t,this.row=e._row,this.column=e._column,this.cellAnchorRow=n,this.cellAnchorColumn=r,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 M8(e){return e===`header`||e===`header-row`||e===`header-column`}function N8(e,t,n,r,i=1){t!=null&&i!=null&&t>i?r.setAttribute(e,t,n):r.removeAttribute(e,n)}function P8(e,t,n={}){let r=e.createElement(`tableCell`,n);return e.insertElement(`paragraph`,r),e.insert(r,t),r}function F8(e,t){let n=t.parent.parent,r=parseInt(n.getAttribute(`headingColumns`)||`0`),{column:i}=e.getCellLocation(t);return!!r&&i<r}function I8(e,t,n){let{modelAttribute:r}=n;e.extend(`tableCell`,{allowAttributes:[r]}),e.setAttributeProperties(r,{isFormatting:!0}),x8(t,{viewElement:/^(td|th)$/,...n}),C8(t,{modelElement:`tableCell`,...n})}function L8(e){let t=e.getSelectedElement();return t&&t.is(`element`,`table`)?t:e.getFirstPosition().findAncestor(`table`)}function R8(e){let t=new Map;for(let n of e){let e=n.findAncestor(`table`);t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function z8({table:e,row:t,column:n}){let r=new $(e,{row:t,column:n});for(let{cell:e}of r)if(!M8(e.getAttribute(`tableCellType`)))return!1;return!0}function B8(e){return e.model.schema.checkAttribute(`tableCell`,`tableCellType`)}function V8(e,t,n){let{startRow:r,startColumn:i,endRow:a,endColumn:o}=t,s=n.createElement(`table`),c=e.getAttribute(`tableType`);c&&n.setAttribute(`tableType`,c,s);let l=a-r+1;for(let e=0;e<l;e++)n.insertElement(`tableRow`,s,`end`);let u=[...new $(e,{startRow:r,endRow:a,startColumn:i,endColumn:o,includeAllSlots:!0})];for(let{row:e,column:t,cell:c,isAnchor:l,cellAnchorRow:d,cellAnchorColumn:f}of u){let u=e-r,p=s.getChild(u);if(!l)(d<r||f<i)&&P8(n,n.createPositionAt(p,`end`));else{let r=n.cloneElement(c);n.append(r,p),K8(r,e,t,a,o,n)}}return q8(s,e,r,i,n),J8(s,e,r,a,n),s}function H8(e,t,n=0){let r=[],i=new $(e,{startRow:n,endRow:t-1});for(let e of i){let{row:n,cellHeight:i}=e,a=n+i-1;n<t&&t<=a&&r.push(e)}return r}function U8(e,t,n){let r=e.parent,i=r.parent,a=r.index,o=parseInt(e.getAttribute(`rowspan`)),s=t-a,c={},l=o-s;l>1&&(c.rowspan=l);let u=parseInt(e.getAttribute(`colspan`)||`1`);u>1&&(c.colspan=u);let d=a,f=d+s,p=[...new $(i,{startRow:d,endRow:f,includeAllSlots:!0})],m=null,h;for(let t of p){let{row:r,column:i,cell:a}=t;a===e&&h===void 0&&(h=i),h!==void 0&&h===i&&r===f&&(m=P8(n,t.getPositionBefore(),c))}return N8(`rowspan`,s,e,n),m}function W8(e,t){let n=[],r=new $(e);for(let e of r){let{column:r,cellWidth:i}=e,a=r+i-1;r<t&&t<=a&&n.push(e)}return n}function G8(e,t,n,r){let i=parseInt(e.getAttribute(`colspan`)),a=n-t,o={},s=i-a;s>1&&(o.colspan=s);let c=parseInt(e.getAttribute(`rowspan`)||`1`);c>1&&(o.rowspan=c);let l=P8(r,r.createPositionAfter(e),o);return N8(`colspan`,a,e,r),l}function K8(e,t,n,r,i,a){let o=parseInt(e.getAttribute(`colspan`)||`1`),s=parseInt(e.getAttribute(`rowspan`)||`1`);n+o-1>i&&N8(`colspan`,i-n+1,e,a,1),t+s-1>r&&N8(`rowspan`,r-t+1,e,a,1)}function q8(e,t,n,r,i){let a=parseInt(t.getAttribute(`headingRows`)||`0`);a>0&&N8(`headingRows`,a-n,e,i,0);let o=parseInt(t.getAttribute(`headingColumns`)||`0`);o>0&&N8(`headingColumns`,o-r,e,i,0)}function J8(e,t,n,r,i){let a=Array.from(t.getChildren()).reduce((e,t)=>t.is(`element`,`tableRow`)?e+1:e,0),o=parseInt(t.getAttribute(`footerRows`)||`0`),s=a-o;if(o<1)return;let c=0;r>=s&&(c=r-Math.max(s,n)+1),N8(`footerRows`,c,e,i,0)}function Y8(e,t){let n=t.getColumns(e),r=Array(n).fill(0);for(let{column:t}of new $(e))r[t]++;let i=r.reduce((e,t,n)=>t?e:[...e,n],[]);if(i.length>0){let n=i[i.length-1];return t.removeColumns(e,{at:n}),!0}return!1}function X8(e,t){let n=[],r=t.getRows(e);for(let t=0;t<r;t++)e.getChild(t).isEmpty&&n.push(t);if(n.length>0){let r=n[n.length-1];return t.removeRows(e,{at:r}),!0}return!1}function Z8(e,t){Y8(e,t)||X8(e,t)}function Q8(e,t){let n=Array.from(new $(e,{startColumn:t.firstColumn,endColumn:t.lastColumn,row:t.lastRow}));if(n.every(({cellHeight:e})=>e===1))return t.lastRow;let r=n[0].cellHeight-1;return t.lastRow+r}function $8(e,t){let n=Array.from(new $(e,{startRow:t.firstRow,endRow:t.lastRow,column:t.lastColumn}));if(n.every(({cellWidth:e})=>e===1))return t.lastColumn;let r=n[0].cellWidth-1;return t.lastColumn+r}function e5(e){for(let t of e.getChildren())if(t.is(`element`,`table`))return t}function t5(){return e=>{e.on(`element:figure`,(e,t,n)=>{if(!n.consumable.test(t.viewItem,{name:!0,classes:`table`}))return;let r=e5(t.viewItem);if(!r||!n.consumable.test(r,{name:!0}))return;n.consumable.consume(t.viewItem,{name:!0,classes:`table`});let i=n.convertItem(r,t.modelCursor);if(!i.modelRange){n.consumable.revert(t.viewItem,{name:!0,classes:`table`});return}let a=j(i.modelRange.getItems());if(!a||!a.is(`element`,`table`)){n.consumable.revert(t.viewItem,{name:!0,classes:`table`}),i.modelRange.isCollapsed||(t.modelRange=i.modelRange,t.modelCursor=i.modelCursor);return}n.convertChildren(t.viewItem,n.writer.createPositionAt(a,`end`)),n.updateConversionResult(a,t)})}}function n5(e){return t=>{t.on(`element:table`,(t,n,r)=>{let i=n.viewItem;if(!r.consumable.test(i,{name:!0}))return;let{rows:a,headingRows:o,headingColumns:s,footerRows:c}=a5(i),l={};s&&(l.headingColumns=s),o&&(l.headingRows=o),e.enableFooters&&c&&(l.footerRows=c);let u=r.writer.createElement(`table`,l);if(r.safeInsert(u,n.modelCursor)){if(r.consumable.consume(i,{name:!0}),a.forEach(e=>r.convertItem(e,r.writer.createPositionAt(u,`end`))),r.convertChildren(i,r.writer.createPositionAt(u,`end`)),u.isEmpty){let e=r.writer.createElement(`tableRow`);r.writer.insert(e,r.writer.createPositionAt(u,`end`)),P8(r.writer,r.writer.createPositionAt(e,`end`))}r.updateConversionResult(u,n)}})}}function r5(){return e=>{e.on(`element:tr`,(e,t)=>{t.viewItem.isEmpty&&t.modelCursor.index==0&&e.stop()},{priority:`high`})}}function i5(e){return t=>{t.on(`element:${e}`,(e,t,{writer:n})=>{if(!t.modelRange)return;let r=t.modelRange.start.nodeAfter,i=n.createPositionAt(r,0);if(t.viewItem.isEmpty){n.insertElement(`paragraph`,i);return}let a=Array.from(r.getChildren());if(a.every(e=>e.is(`element`,`$marker`))){let e=n.createElement(`paragraph`);n.insert(e,n.createPositionAt(r,0));for(let t of a)n.move(n.createRangeOn(t),n.createPositionAt(e,`end`))}},{priority:`low`})}}function a5(e){let t,n=!0,r=[],i=[],a=[],o=null,s=null,c=Array.from(e.getChildren());for(let e=0;e<c.length;e++){let t=c[e];if(t.name!==`tbody`&&t.name!==`thead`&&t.name!==`tfoot`)continue;t.name===`thead`&&!o&&(n=!0,o=t);let l=Array.from(t.getChildren()).filter(e=>e.is(`element`,`tr`)),u=null,d=null;for(let f of l){let p=Array.from(f.getChildren()).filter(e=>e.is(`element`,`td`)||e.is(`element`,`th`));if(t.name===`tfoot`){s||={element:t,rows:l},n=!1;let r=s.element===t;if(!r&&d===null)for(let t=e;t<c.length&&(d=c[t].name===`tfoot`,d);t++);if(r){a.push(f);continue}if(d!==!1){a.splice(a.length-s.rows.length,0,f);continue}}o&&t===o||t.name===`tbody`&&p.length>0&&(u===null||p.length===u)&&p.every(e=>e.is(`element`,`th`))&&n?(r.push(f),n=!0):(i.push(f),n=!1),u=Math.max(u||0,p.length)}}let l=o5(i);for(let e of l){let n=0;for(;n<e.length&&e[n]?.name===`th`;)n+=1;(t===void 0||n<t)&&(t=n)}return{headingRows:r.length,headingColumns:t||0,footerRows:a.length,rows:[...r,...i,...a]}}function o5(e){let t=new Map,n=0,r=e.map(e=>{let r=[],i=Array.from(e.getChildren()).filter(e=>e.name===`th`||e.name===`td`),a=new Map;for(;i.length||r.length<n;){let e=t.get(r.length);if(e&&e.remaining>0)r.push(e.cell);else{let e=i.shift();if(e){let t=parseInt(e.getAttribute(`colspan`)||`1`),n=parseInt(e.getAttribute(`rowspan`)||`1`);for(let i=0;i<t;i++)n>1&&a.set(r.length,{cell:e,remaining:n-1}),r.push(e)}else{r.push(null);continue}}}for(let[e,n]of t.entries())--n.remaining,n.remaining>0&&!a.has(e)&&a.set(e,n);return t=a,n=Math.max(n,r.length),r});for(let e of r)for(;e.length<n;)e.push(null);return r}const s5=5,c5=40,l5=2,u5=3;function d5(e){let t=new Set;for(let n of e.document.differ.getChanges()){let r=null;switch(n.type){case`insert`:r=[`table`,`tableRow`,`tableCell`].includes(n.name)?n.position:null;break;case`remove`:r=[`tableRow`,`tableCell`].includes(n.name)?n.position:null;break;case`attribute`:n.range.start.nodeAfter&&(r=[`table`,`tableRow`,`tableCell`].includes(n.range.start.nodeAfter.name)?n.range.start:null);break}if(!r)continue;let i=r.nodeAfter&&r.nodeAfter.is(`element`,`table`)?r.nodeAfter:r.findAncestor(`table`);for(let n of e.createRangeOn(i).getItems())n.is(`element`,`table`)&&w5(n)&&t.add(n)}return t}function f5(e,t){return 4e3/p5(e,t)}function p5(e,t){let n=m5(e,`tbody`,t)||m5(e,`thead`,t)||m5(e,`tfoot`,t);return h5(t.editing.view.domConverter.mapViewToDom(n))}function m5(e,t,n){return[...[...n.editing.mapper.toViewElement(e).getChildren()].find(e=>e.is(`element`,`table`)).getChildren()].find(e=>e.is(`element`,t))}function h5(e){let t=u.window.getComputedStyle(e);return t.boxSizing===`border-box`?parseFloat(t.width)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight)-parseFloat(t.borderLeftWidth)-parseFloat(t.borderRightWidth):parseFloat(t.width)}function g5(e,t){let n=t.getCellLocation(e).column;return{leftEdge:n,rightEdge:n+(e.getAttribute(`colspan`)||1)-1}}function _5(e){return Math.round((typeof e==`number`?e:parseFloat(e))*100)/100}function v5(e,t,n){return _5(e<=t?t:e>=n?n:e)}function y5(e,t){return Array(e).fill(t)}function b5(e){return e.map(e=>typeof e==`number`?e:parseFloat(e)).filter(e=>!Number.isNaN(e)).reduce((e,t)=>e+t,0)}function x5(e){let t=Nne(e.map(e=>e===`auto`||e===void 0?`auto`:parseFloat(e.replace(`%`,``)))),n=b5(t);return n!==100&&(t=t.map(e=>_5(e*100/n)).map((e,t,n)=>{if(t!==n.length-1)return e;let r=b5(n);return _5(e+100-r)})),t.map(e=>e+`%`)}function Nne(e){let t=e.filter(e=>e===`auto`).length;if(t===0)return e.map(e=>_5(e));let n=b5(e),r=Math.max((100-n)/t,5);return e.map(e=>e===`auto`?r:e).map(e=>_5(e))}function S5(e){let t=u.window.getComputedStyle(e);return t.boxSizing===`border-box`?parseInt(t.width):parseFloat(t.width)+parseFloat(t.paddingLeft)+parseFloat(t.paddingRight)+parseFloat(t.borderWidth)}function C5(e,t,n,r){for(let i=0;i<Math.max(n.length,e.length);i++){let a=e[i],o=n[i];o?a?r.setAttribute(`columnWidth`,o,a):r.appendElement(`tableColumn`,{columnWidth:o},t):r.remove(a)}}function w5(e){if(e.is(`element`,`tableColumnGroup`))return e;let t=e.getChildren();return Array.from(t).find(e=>e.is(`element`,`tableColumnGroup`))}function T5(e){let t=w5(e);return t?Array.from(t.getChildren()):[]}function E5(e){return T5(e).map(e=>e.getAttribute(`columnWidth`))}function D5(e,t){return T5(e).reduce((e,n)=>{let r=n.getAttribute(`columnWidth`),i=n.getAttribute(`colSpan`);if(!i)return e.push(r),e;for(let t=0;t<i;t++)e.push(r);return t.removeAttribute(`colSpan`,n),e},[])}var O5=class extends F{static get pluginName(){return`TableUtils`}static get isOfficialPlugin(){return!0}init(){this.decorate(`insertColumns`),this.decorate(`insertRows`)}getCellLocation(e){let t=e.parent,n=t.parent,r=new $(n,{row:n.getChildIndex(t)});for(let{cell:t,row:n,column:i}of r)if(t===e)return{row:n,column:i}}createTable(e,t){let n=e.createElement(`table`);return k5(e,n,0,t.rows||2,t.columns||2),t.footerRows&&this.setFooterRowsCount(e,n,t.footerRows),t.headingRows&&this.setHeadingRowsCount(e,n,t.headingRows),t.headingColumns&&this.setHeadingColumnsCount(e,n,t.headingColumns),n}insertRows(e,t={}){let n=this.editor.model,r=t.at||0,i=t.rows||1,a=t.copyStructureFromAbove!==void 0,o=t.copyStructureFromAbove?r-1:r,s=B8(this.editor),c=!!this.editor.config.get(`table.tableCellProperties.scopedHeaders`),l=this.getRows(e),u=this.getColumns(e);if(r>l)throw new w(`tableutils-insertrows-insert-out-of-range`,this,{options:t});n.change(t=>{let n=e.getAttribute(`headingRows`)||0,d=e.getAttribute(`footerRows`)||0;if(n>r&&(n+=i),d&&r>l-d&&(d+=i),!a&&(r===0||r===l)){let n=k5(t,e,r,i,u);if(s)for(let i=0;i<n.length;i++){let a=n[i];for(let n=0;n<u;n++)M5({table:e,writer:t,cell:a[n],row:r+i,column:n,scopedHeaders:c})}}else{let n=new $(e,{endRow:a?Math.max(r,o):r}),l=Array(u).fill(1);for(let{row:e,column:s,cellHeight:c,cellWidth:u,cell:d}of n){let n=e+c-1;e<r&&r<=n?(t.setAttribute(`rowspan`,c+i,d),l[s]=-u):a&&e<=o&&o<=n&&(l[s]=u)}for(let n=0;n<i;n++){let i=t.createElement(`tableRow`);t.insert(i,e,r);for(let a=0;a<l.length;a++){let o=l[a],u=t.createPositionAt(i,`end`);if(o>0){let i=P8(t,u,o>1?{colspan:o}:void 0);s&&M5({table:e,writer:t,cell:i,row:r+n,column:a,scopedHeaders:c})}a+=Math.abs(o)-1}}}this.setFooterRowsCount(t,e,d),this.setHeadingRowsCount(t,e,n,{updateCellType:!1})})}insertColumns(e,t={}){let n=this.editor.model,r=t.at||0,i=t.columns||1,a=B8(this.editor),o=!!this.editor.config.get(`table.tableCellProperties.scopedHeaders`);n.change(t=>{let n=e.getAttribute(`headingColumns`);r<n&&(n+=i);let s=this.getColumns(e);if(r===0||s===r){let n=0;for(let s of e.getChildren()){if(!s.is(`element`,`tableRow`))continue;let c=A5(i,t,t.createPositionAt(s,r?`end`:0));if(a)for(let i=0;i<c.length;i++)M5({table:e,writer:t,cell:c[i],row:n,column:r+i,scopedHeaders:o});n++}}else{let n=new $(e,{column:r,includeAllSlots:!0});for(let s of n){let{row:c,cell:l,cellAnchorColumn:u,cellAnchorRow:d,cellWidth:f,cellHeight:p}=s;if(u<r){t.setAttribute(`colspan`,f+i,l);let e=d+p-1;for(let t=c;t<=e;t++)n.skipRow(t)}else{let n=A5(i,t,s.getPositionBefore());if(a)for(let i=0;i<n.length;i++)M5({table:e,writer:t,cell:n[i],row:c,column:r+i,scopedHeaders:o})}}}this.setHeadingColumnsCount(t,e,n,{updateCellType:!1})})}removeRows(e,t){let n=this.editor.model,r=t.rows||1,i=this.getRows(e),a=t.at,o=a+r-1;if(o>i-1)throw new w(`tableutils-removerows-row-index-out-of-range`,this,{table:e,options:t});n.change(t=>{let n={first:a,last:o},{cellsToMove:r,cellsToTrim:s}=Lne(e,n);r.size&&Rne(e,o+1,r,t);for(let n=o;n>=a;n--)t.remove(e.getChild(n));for(let{rowspan:e,cell:n}of s)N8(`rowspan`,e,n,t);if(Fne(e,n,t),Ine(e,i,n,t),Y8(e,this)||X8(e,this),B8(this.editor)){let n=e.getAttribute(`headingRows`)||0,r=this.getRows(e);for(;n<r&&z8({table:e,row:n});)n++;this.setHeadingRowsCount(t,e,n,{updateCellType:!1})}})}removeColumns(e,t){let n=this.editor.model,r=t.at,i=t.columns||1,a=t.at+i-1;n.change(t=>{Pne(e,{first:r,last:a},t);let n=T5(e);for(let i=a;i>=r;i--){for(let{cell:n,column:r,cellWidth:a}of[...new $(e)])r<=i&&a>1&&r+a>i?N8(`colspan`,a-1,n,t):r===i&&t.remove(n);if(n[i]){let e=i===0?n[1]:n[i-1],r=parseFloat(n[i].getAttribute(`columnWidth`)),a=parseFloat(e.getAttribute(`columnWidth`));t.remove(n[i]),t.setAttribute(`columnWidth`,r+a+`%`,e)}}if(X8(e,this)||Y8(e,this),B8(this.editor)){let n=e.getAttribute(`headingColumns`)||0,r=this.getColumns(e);for(;n<r&&z8({table:e,column:n});)n++;this.setHeadingColumnsCount(t,e,n,{updateCellType:!1})}})}splitCellVertically(e,t=2){let n=this.editor.model,r=e.parent.parent,i=parseInt(e.getAttribute(`rowspan`)||`1`),a=parseInt(e.getAttribute(`colspan`)||`1`);n.change(n=>{if(a>1){let{newCellsSpan:r,updatedSpan:o}=j5(a,t);N8(`colspan`,o,e,n);let s={};r>1&&(s.colspan=r),i>1&&(s.rowspan=i),A5(a>t?t-1:a-1,n,n.createPositionAfter(e),s)}if(a<t){let o=t-a,s=[...new $(r)],{column:c}=s.find(({cell:t})=>t===e),l=s.filter(({cell:t,cellWidth:n,column:r})=>{let i=t!==e&&r===c,a=r<c&&r+n>c;return i||a});for(let{cell:e,cellWidth:t}of l)n.setAttribute(`colspan`,t+o,e);let u={};i>1&&(u.rowspan=i),A5(o,n,n.createPositionAfter(e),u);let d=r.getAttribute(`headingColumns`)||0;d>c&&N8(`headingColumns`,d+o,r,n)}})}splitCellHorizontally(e,t=2){let n=this.editor.model,r=e.parent,i=r.parent,a=i.getChildIndex(r),o=parseInt(e.getAttribute(`rowspan`)||`1`),s=parseInt(e.getAttribute(`colspan`)||`1`);n.change(n=>{if(o>1){let r=[...new $(i,{startRow:a,endRow:a+o-1,includeAllSlots:!0})],{newCellsSpan:c,updatedSpan:l}=j5(o,t);N8(`rowspan`,l,e,n);let{column:u}=r.find(({cell:t})=>t===e),d={};c>1&&(d.rowspan=c),s>1&&(d.colspan=s);let f=0;for(let e of r){let{column:t,row:r}=e,i=r>=a+l,o=t===u;f>=c&&o&&(f=0),i&&o&&(f||A5(1,n,e.getPositionBefore(),d),f++)}}if(o<t){let r=t-o,c=this.getRows(i),l=[...new $(i,{startRow:0,endRow:a})];for(let{cell:t,cellHeight:i,row:o}of l)if(t!==e&&o+i>a){let e=i+r;n.setAttribute(`rowspan`,e,t)}let u={};s>1&&(u.colspan=s),k5(n,i,a+1,r,1,u);let d=i.getAttribute(`headingRows`)||0;d>a&&N8(`headingRows`,d+r,i,n);let f=i.getAttribute(`footerRows`)||0;c-f<=a&&N8(`footerRows`,f+r,i,n)}})}getColumns(e){return[...e.getChild(0).getChildren()].filter(e=>e.is(`element`,`tableCell`)).reduce((e,t)=>e+parseInt(t.getAttribute(`colspan`)||`1`),0)}getRows(e){return Array.from(e.getChildren()).reduce((e,t)=>t.is(`element`,`tableRow`)?e+1:e,0)}createTableWalker(e,t={}){return new $(e,t)}getSelectedTableCells(e){let t=[];for(let n of this.sortRanges(e.getRanges())){let e=n.getContainedElement();e&&e.is(`element`,`tableCell`)&&t.push(e)}return t}setFooterRowsCount(e,t,n){if(!this.editor.config.get(`table.enableFooters`))return;let r=t.getAttribute(`headingRows`)||0,i=this.getRows(t),a=Math.min(n,i);if(N8(`footerRows`,a,t,e,0),r+a>i){let n=i-a;this.setHeadingRowsCount(e,t,n)}}setHeadingRowsCount(e,t,n,r={}){let{updateCellType:i=!0,resetFormerHeadingCells:a=!0,autoExpand:o=!0}=r,s=this.getRows(t),c=!!this.editor.config.get(`table.tableCellProperties.scopedHeaders`),l=t.getAttribute(`headingRows`)||0,u=Math.min(n,s);if(u===l)return;N8(`headingRows`,u,t,e,0);let d=t.getAttribute(`footerRows`)||0;if(u+d>s){let n=s-u;this.setFooterRowsCount(e,t,n)}if(B8(this.editor)){if(i){for(let{cell:n,row:r,column:i}of new $(t,{endRow:u-1}))M5({table:t,writer:e,cell:n,row:r,column:i,scopedHeaders:c});if(a&&u<l)for(let n=u;n<l&&z8({table:t,row:n});n++)for(let{cell:r,row:i,column:a}of new $(t,{row:n}))M5({table:t,writer:e,cell:r,row:i,column:a,scopedHeaders:c})}if(o&&u>l){for(;u<s&&z8({table:t,row:u});)u++;N8(`headingRows`,u,t,e,0)}}}setHeadingColumnsCount(e,t,n,r={}){let{updateCellType:i=!0,resetFormerHeadingCells:a=!0,autoExpand:o=!0}=r,s=this.getColumns(t),c=t.getAttribute(`headingColumns`)||0,l=!!this.editor.config.get(`table.tableCellProperties.scopedHeaders`),u=Math.min(n,s);if(u!==c&&(N8(`headingColumns`,u,t,e,0),B8(this.editor))){if(i){for(let{cell:n,row:r,column:i}of new $(t,{endColumn:u-1}))M5({table:t,writer:e,cell:n,row:r,column:i,scopedHeaders:l});if(a&&u<c)for(let n=u;n<c&&z8({table:t,column:n});n++)for(let{cell:r,row:i,column:a}of new $(t,{column:n}))M5({table:t,writer:e,cell:r,row:i,column:a,scopedHeaders:l})}if(o&&u>c){for(;u<s&&z8({table:t,column:u});)u++;N8(`headingColumns`,u,t,e,0)}}}getTableCellsContainingSelection(e){let t=[];for(let n of e.getRanges()){let e=n.start.findAncestor(`tableCell`);e&&t.push(e)}return t}getSelectionAffectedTableCells(e){let t=this.getSelectedTableCells(e);return t.length?t:this.getTableCellsContainingSelection(e)}getRowIndexes(e){let t=e.map(e=>e.parent.index);return this._getFirstLastIndexesObject(t)}getColumnIndexes(e){let t=[...new $(e[0].findAncestor(`table`))].filter(t=>e.includes(t.cell)).map(e=>e.column);return this._getFirstLastIndexesObject(t)}isSelectionRectangular(e){if(e.length<2||!this._areCellInTheSameTableSection(e))return!1;let t=new Set,n=new Set,r=0;for(let i of e){let{row:e,column:a}=this.getCellLocation(i),o=parseInt(i.getAttribute(`rowspan`))||1,s=parseInt(i.getAttribute(`colspan`))||1;t.add(e),n.add(a),o>1&&t.add(e+o-1),s>1&&n.add(a+s-1),r+=o*s}return Bne(t,n)==r}sortRanges(e){return Array.from(e).sort(zne)}_getFirstLastIndexesObject(e){let t=e.sort((e,t)=>e-t);return{first:t[0],last:t[t.length-1]}}_areCellInTheSameTableSection(e){let t=e[0].findAncestor(`table`),n=this.getRows(t),r=this.getRowIndexes(e),i=parseInt(t.getAttribute(`headingRows`))||0,a=parseInt(t.getAttribute(`footerRows`))||0;if(!this._areIndexesInSameHeadingSection(r,i)||!this._areIndexesInSameFooterSection(r,n,a))return!1;let o=this.getColumnIndexes(e),s=parseInt(t.getAttribute(`headingColumns`))||0;return this._areIndexesInSameHeadingSection(o,s)}_areIndexesInSameHeadingSection({first:e,last:t},n){return e<n==t<n}_areIndexesInSameFooterSection({first:e,last:t},n,r){let i=n-r;return e>=i==t>=i}};function k5(e,t,n,r,i,a={}){let o=[];for(let s=0;s<r;s++){let r=e.createElement(`tableRow`);e.insert(r,t,n),o.push(A5(i,e,e.createPositionAt(r,`end`),a))}return o}function A5(e,t,n,r={}){let i=[],a=n;for(let n=0;n<e;n++){let e=P8(t,a,r);i.push(e),a=t.createPositionAfter(e)}return i}function j5(e,t){if(e<t)return{newCellsSpan:1,updatedSpan:1};let n=Math.floor(e/t);return{newCellsSpan:n,updatedSpan:e-n*t+n}}function Pne(e,t,n){let r=e.getAttribute(`headingColumns`)||0;if(r&&t.first<r){let i=Math.min(r-1,t.last)-t.first+1;n.setAttribute(`headingColumns`,r-i,e)}}function Fne(e,{first:t,last:n},r){let i=e.getAttribute(`headingRows`)||0;t<i&&N8(`headingRows`,n<i?i-(n-t+1):t,e,r,0)}function Ine(e,t,{first:n,last:r},i){if(!e.hasAttribute(`footerRows`))return;let a=e.getAttribute(`footerRows`),o=t-a;r>=o&&N8(`footerRows`,n>=o?a-(r-n+1):t-1-r,e,i,0)}function Lne(e,{first:t,last:n}){let r=new Map,i=[];for(let{row:a,column:o,cellHeight:s,cell:c}of new $(e,{endRow:n})){let e=a+s-1;if(a>=t&&a<=n&&e>n){let e=s-(n-a+1);r.set(o,{cell:c,rowspan:e})}if(a<t&&e>=t){let r;r=e>=n?n-t+1:e-t+1,i.push({cell:c,rowspan:s-r})}}return{cellsToMove:r,cellsToTrim:i}}function Rne(e,t,n,r){let i=[...new $(e,{includeAllSlots:!0,row:t})],a=e.getChild(t),o;for(let{column:e,cell:t,isAnchor:s}of i)if(n.has(e)){let{cell:t,rowspan:i}=n.get(e),s=o?r.createPositionAfter(o):r.createPositionAt(a,0);r.move(r.createRangeOn(t),s),N8(`rowspan`,i,t,r),o=t}else s&&(o=t)}function zne(e,t){let n=e.start,r=t.start;return n.isBefore(r)?-1:1}function Bne(e,t){let n=Array.from(e.values()),r=Array.from(t.values()),i=Math.max(...n),a=Math.min(...n),o=Math.max(...r),s=Math.min(...r);return(i-a+1)*(o-s+1)}function M5({writer:e,table:t,row:n,column:r,cell:i,scopedHeaders:a}){let o=t.getAttribute(`headingRows`)||0,s=t.getAttribute(`headingColumns`)||0;if(n>=o&&r>=s){e.removeAttribute(`tableCellType`,i);return}let c=`header`;a&&(c=n<o?`header-column`:`header-row`),e.setAttribute(`tableCellType`,c,i)}function N5(e){if(!e||!Xe(e))return e;let{top:t,right:n,bottom:r,left:i}=e;if(t==n&&n==r&&r==i)return t}function P5(e,t){let n=parseFloat(e);return Number.isNaN(n)||String(n)!==String(e)?e:`${n}${t}`}function F5(e,t={}){let n={borderStyle:`none`,borderWidth:``,borderColor:``,backgroundColor:``,width:``,height:``,...e};return t.includeAlignmentProperty&&!n.alignment&&(n.alignment=`center`),t.includePaddingProperty&&!n.padding&&(n.padding=``),t.includeVerticalAlignmentProperty&&!n.verticalAlignment&&(n.verticalAlignment=`middle`),t.includeHorizontalAlignmentProperty&&!n.horizontalAlignment&&(n.horizontalAlignment=t.isRightToLeftContent?`right`:`left`),n}function I5(e,t){return F5({borderStyle:`double`,borderColor:`hsl(0, 0%, 70%)`,borderWidth:`1px`,...e},t)}function L5(e,t){return F5({borderStyle:`solid`,borderColor:`hsl(0, 0%, 75%)`,borderWidth:`1px`,...e},t)}function R5(e,t){return(n,{writer:r})=>{let i=n.getAttribute(`headingRows`)||0,a=n.getAttribute(`footerRows`)||0,o=r.createContainerElement(`table`,null,[]),s=r.createContainerElement(`figure`,{class:`table`},o),c=e.getRows(n);i>0&&r.insert(r.createPositionAt(o,`end`),r.createContainerElement(`thead`,null,r.createSlot(e=>e.is(`element`,`tableRow`)&&e.index<i))),i+a<c&&r.insert(r.createPositionAt(o,`end`),r.createContainerElement(`tbody`,null,r.createSlot(e=>e.is(`element`,`tableRow`)&&e.index>=i&&e.index<c-a))),a>0&&r.insert(r.createPositionAt(o,`end`),r.createContainerElement(`tfoot`,null,r.createSlot(e=>e.is(`element`,`tableRow`)&&e.index>=c-a)));for(let{positionOffset:e,filter:n}of t.additionalSlots)r.insert(r.createPositionAt(o,e),r.createSlot(n));return r.insert(r.createPositionAt(o,`after`),r.createSlot(e=>e.is(`element`,`tableRow`)?!1:!t.additionalSlots.some(({filter:t})=>t(e)))),t.asWidget?Vne(s,r):s}}function z5(){return(e,{writer:t})=>e.isEmpty?t.createEmptyElement(`tr`):t.createContainerElement(`tr`)}function B5(e){return(n,{writer:r})=>{if(e.cellTypeEnabled?.())return t(r,M8(n.getAttribute(`tableCellType`))?`th`:`td`);let i=n.parent,a=i.parent,o=new $(a,{row:a.getChildIndex(i)}),s=a.getAttribute(`headingRows`)||0,c=a.getAttribute(`headingColumns`)||0,l=null;for(let e of o)if(e.cell==n){l=t(r,e.row<s||e.column<c?`th`:`td`);break}return l};function t(t,n){return e.asWidget?YE(t.createEditableElement(n),t,{withAriaRole:!1}):t.createContainerElement(n)}}function V5(e={}){return(t,{writer:n})=>{if(!t.parent.is(`element`,`tableCell`)||!H5(t))return null;if(e.asWidget)return n.createContainerElement(`span`,{class:`ck-table-bogus-paragraph`});{let e=n.createContainerElement(`p`);return n.setCustomProperty(`dataPipeline:transparentRendering`,!0,e),e}}}function H5(e){return e.parent.childCount==1&&!Hne(e)}function Vne(e,t){return t.setCustomProperty(`table`,!0,e),UE(e,t,{hasSelectionHandle:!0})}function Hne(e){for(let t of e.getAttributeKeys())if(!(t.startsWith(`selection:`)||t==`htmlEmptyBlock`))return!0;return!1}function Une(e){return(t,n)=>{let r=e.plugins.has(`PlainTableOutput`),i=n.options.isClipboardPipeline,a=U5(e,t);return r||a||i?Gne(t,n,e):null}}function Wne(e){return(t,{writer:n,options:r})=>{let i=e.plugins.has(`PlainTableOutput`),a=r.isClipboardPipeline,o=U5(e,t);return(i||o||a)&&t.parent.name===`table`?n.createContainerElement(`caption`):null}}function Gne(e,t,n){let r=n.plugins.get(O5),i=t.writer,a=r.getRows(e),o=e.getAttribute(`headingRows`)||0,s=e.getAttribute(`footerRows`)||0,c=a-s,l=i.createSlot(e=>e.is(`element`,`tableRow`)&&e.index<o),u=i.createSlot(e=>e.is(`element`,`tableRow`)&&e.index>=o&&e.index<c),d=i.createSlot(e=>e.is(`element`,`tableRow`)&&e.index>=c),f=i.createSlot(e=>!e.is(`element`,`tableRow`)),p=i.createContainerElement(`thead`,null,l),m=i.createContainerElement(`tbody`,null,u),h=i.createContainerElement(`tfoot`,null,d),g=[];o&&g.push(p),o+s<a&&g.push(m),s&&g.push(h);let _={class:`table`};if(n.plugins.has(`TablePropertiesEditing`)&&t.options.isClipboardPipeline){let t=I5(n.config.get(`table.tableProperties.defaultProperties`),{includeAlignmentProperty:!0}),r=e.getAttribute(`tableAlignment`),i=t.alignment;e.getAttribute(`tableType`)===`layout`&&(i=``);let a=r||i;a&&(_.class+=` `+A8[a].className,_.style=A8[a].style,A8[a].align!==void 0&&(_.align=A8[a].align))}return i.createContainerElement(`table`,_,[f,...g])}function Kne(e){for(let[t,n]of Object.entries({"border-width":`tableBorderWidth`,"border-color":`tableBorderColor`,"border-style":`tableBorderStyle`,"background-color":`tableBackgroundColor`}))e.conversion.for(`dataDowncast`).add(r=>r.on(`attribute:${n}:table`,(n,r,i)=>{let{item:a,attributeNewValue:o}=r,{mapper:s,writer:c}=i,l=e.plugins.has(`PlainTableOutput`),u=i.options.isClipboardPipeline,d=U5(e,a);if(!(l||d||u)||!i.consumable.consume(a,n.name))return;let f=s.toViewElement(a);o?c.setStyle(t,o,f):c.removeStyle(t,f)},{priority:`high`}))}function U5(e,t){let n=e.plugins.has(`TableLayoutEditing`),r=e.config.get(`table.tableLayout.stripFigureFromContentTable`)??!1,i=t.findAncestor(`table`,{includeSelf:!0})?.getAttribute(`tableType`);return n&&(r||i===`layout`)}var W5=class extends I{refresh(){let e=this.editor.model,t=e.document.selection,n=e.schema;this.isEnabled=qne(t,n)}execute(e={}){let t=this.editor,n=t.model,r=t.plugins.get(`TableUtils`),i=!!t.config.get(`table.enableFooters`),a=t.config.get(`table.defaultHeadings.rows`),o=t.config.get(`table.defaultHeadings.columns`),s=t.config.get(`table.defaultFooters`);e.headingRows===void 0&&a&&(e.headingRows=a),e.headingColumns===void 0&&o&&(e.headingColumns=o),i&&e.footerRows===void 0&&s&&(e.footerRows=s),!i&&`footerRows`in e&&delete e.footerRows,n.change(t=>{let i=r.createTable(t,e);n.insertObject(i,null,null,{findOptimalPosition:`auto`}),t.setSelection(t.createPositionAt(i.getNodeByPath([0,0,0]),0))})}};function qne(e,t){let n=e.getFirstPosition().parent,r=n===n.root?n:n.parent;return t.checkChild(r,`table`)}var G5=class extends I{order;constructor(e,t={}){super(e),this.order=t.order||`below`}refresh(){let e=this.editor.model.document.selection,t=!!this.editor.plugins.get(`TableUtils`).getSelectionAffectedTableCells(e).length;this.isEnabled=t}execute(){let e=this.editor,t=e.model.document.selection,n=e.plugins.get(`TableUtils`),r=this.order===`above`,i=n.getSelectionAffectedTableCells(t),a=n.getRowIndexes(i),o=r?a.first:a.last,s=i[0].findAncestor(`table`);n.insertRows(s,{at:r?o:o+1,copyStructureFromAbove:!r})}},K5=class extends I{order;constructor(e,t={}){super(e),this.order=t.order||`right`}refresh(){let e=this.editor.model.document.selection,t=!!this.editor.plugins.get(`TableUtils`).getSelectionAffectedTableCells(e).length;this.isEnabled=t}execute(){let e=this.editor,t=e.model.document.selection,n=e.plugins.get(`TableUtils`),r=this.order===`left`,i=n.getSelectionAffectedTableCells(t),a=n.getColumnIndexes(i),o=r?a.first:a.last,s=i[0].findAncestor(`table`);n.insertColumns(s,{columns:1,at:r?o:o+1})}},q5=class extends I{direction;constructor(e,t={}){super(e),this.direction=t.direction||`horizontally`}refresh(){let e=this.editor.plugins.get(`TableUtils`).getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length===1}execute(){let e=this.editor.plugins.get(`TableUtils`),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection)[0];this.direction===`horizontally`?e.splitCellHorizontally(t,2):e.splitCellVertically(t,2)}},J5=class extends I{direction;isHorizontal;constructor(e,t){super(e),this.direction=t.direction,this.isHorizontal=this.direction==`right`||this.direction==`left`}refresh(){let e=this._getMergeableCell();this.value=e,this.isEnabled=!!e}execute(){let e=this.editor.model,t=e.document,n=this.editor.plugins.get(`TableUtils`).getTableCellsContainingSelection(t.selection)[0],r=this.value,i=this.direction;e.change(e=>{let t=i==`right`||i==`down`,a=t?n:r,o=t?r:n,s=o.parent;Xne(o,a,e);let c=this.isHorizontal?`colspan`:`rowspan`,l=parseInt(n.getAttribute(c)||`1`),u=parseInt(r.getAttribute(c)||`1`);e.setAttribute(c,l+u,a),e.setSelection(e.createRangeIn(a));let d=this.editor.plugins.get(`TableUtils`);Z8(s.findAncestor(`table`),d)})}_getMergeableCell(){let e=this.editor.model.document,t=this.editor.plugins.get(`TableUtils`),n=t.getTableCellsContainingSelection(e.selection)[0];if(!n)return;let r=this.isHorizontal?Jne(n,this.direction,t):Yne(n,this.direction,t);if(!r)return;let i=this.isHorizontal?`rowspan`:`colspan`,a=parseInt(n.getAttribute(i)||`1`);if(parseInt(r.getAttribute(i)||`1`)===a)return r}};function Jne(e,t,n){let r=e.parent.parent,i=t==`right`?e.nextSibling:e.previousSibling,a=(r.getAttribute(`headingColumns`)||0)>0;if(!i)return;let o=t==`right`?e:i,s=t==`right`?i:e,{column:c}=n.getCellLocation(o),{column:l}=n.getCellLocation(s),u=parseInt(o.getAttribute(`colspan`)||`1`),d=F8(n,o),f=F8(n,s);if(!(a&&d!=f))return c+u===l?i:void 0}function Yne(e,t,n){let r=e.parent,i=r.parent,a=i.getChildIndex(r),o=n.getRows(i);if(t==`down`&&a===o-1||t==`up`&&a===0)return null;let s=parseInt(e.getAttribute(`rowspan`)||`1`),c=i.getAttribute(`headingRows`)||0,l=i.getAttribute(`footerRows`)||0,u=o-l,d=t==`up`&&a===u,f=t==`up`&&a===c,p=t==`down`&&a+s===c,m=t==`down`&&a+s===u;if(c&&(p||f)||l&&(d||m))return null;let h=parseInt(e.getAttribute(`rowspan`)||`1`),g=t==`down`?a+h:a,_=[...new $(i,{endRow:g})],v=_.find(t=>t.cell===e).column,y=_.find(({row:e,cellHeight:n,column:r})=>r===v?t==`down`?e===g:g===e+n:!1);return y&&y.cell?y.cell:null}function Xne(e,t,n){Y5(e)||(Y5(t)&&n.remove(n.createRangeIn(t)),n.move(n.createRangeIn(e),n.createPositionAt(t,`end`))),n.remove(e)}function Y5(e){let t=e.getChild(0);return e.childCount==1&&t.is(`element`,`paragraph`)&&t.isEmpty}var X5=class extends I{refresh(){let e=this.editor.plugins.get(`TableUtils`),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),n=t[0];if(n){let r=n.findAncestor(`table`),i=e.getRows(r)-1,a=e.getRowIndexes(t),o=a.first===0&&a.last===i;this.isEnabled=!o}else this.isEnabled=!1}execute(){let e=this.editor.model,t=this.editor.plugins.get(`TableUtils`),n=t.getSelectionAffectedTableCells(e.document.selection),r=t.getRowIndexes(n),i=n[0],a=i.findAncestor(`table`),o=t.getCellLocation(i).column;e.change(e=>{let n=r.last-r.first+1;t.removeRows(a,{at:r.first,rows:n});let i=Zne(a,r.first,o,t.getRows(a));e.setSelection(e.createPositionAt(i,0))})}};function Zne(e,t,n,r){let i=e.getChild(Math.min(t,r-1)),a=i.getChild(0),o=0;for(let e of i.getChildren()){if(o>n)return a;a=e,o+=parseInt(e.getAttribute(`colspan`)||`1`)}return a}var Z5=class extends I{refresh(){let e=this.editor.plugins.get(`TableUtils`),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),n=t[0];if(n){let r=n.findAncestor(`table`),i=e.getColumns(r),{first:a,last:o}=e.getColumnIndexes(t);this.isEnabled=o-a<i-1}else this.isEnabled=!1}execute(){let e=this.editor.plugins.get(`TableUtils`),[t,n]=$ne(this.editor.model.document.selection,e),r=t.parent.parent,i=[...new $(r)],a={first:i.find(e=>e.cell===t).column,last:i.find(e=>e.cell===n).column},o=Qne(i,t,n,a);this.editor.model.change(t=>{let n=a.last-a.first+1;e.removeColumns(r,{at:a.first,columns:n}),t.setSelection(t.createPositionAt(o,0))})}};function Qne(e,t,n,r){return parseInt(n.getAttribute(`colspan`)||`1`)>1?n:t.previousSibling||n.nextSibling?n.nextSibling||t.previousSibling:r.first?e.reverse().find(({column:e})=>e<r.first).cell:e.reverse().find(({column:e})=>e>r.last).cell}function $ne(e,t){let n=t.getSelectionAffectedTableCells(e),r=n[0],i=n.pop(),a=[r,i];return r.isBefore(i)?a:a.reverse()}var Q5=class extends I{refresh(){let e=this.editor.plugins.get(`TableUtils`),t=this.editor.model,n=e.getSelectionAffectedTableCells(t.document.selection);if(n.length===0){this.isEnabled=!1,this.value=!1;return}let r=n[0].findAncestor(`table`);this.isEnabled=t.schema.checkAttribute(r,`headingRows`),this.value=n.every(e=>this._isInHeading(e,e.parent.parent))}execute(e={}){if(e.forceValue===this.value)return;let t=this.editor.plugins.get(`TableUtils`),n=this.editor.model,r=t.getSelectionAffectedTableCells(n.document.selection),i=r[0].findAncestor(`table`),{first:a,last:o}=t.getRowIndexes(r),s=this.value?a:o+1,c=i.getAttribute(`headingRows`)||0;n.change(e=>{if(s){let t=H8(i,s,s>c?c:0);for(let{cell:n}of t)U8(n,s,e)}t.setHeadingRowsCount(e,i,s)})}_isInHeading(e,t){let n=parseInt(t.getAttribute(`headingRows`)||`0`);return!!n&&e.parent.index<n}},$5=class extends I{refresh(){let e=this.editor.plugins.get(`TableUtils`),t=this.editor.model,n=e.getSelectionAffectedTableCells(t.document.selection);if(n.length===0){this.isEnabled=!1,this.value=!1;return}let r=n[0].findAncestor(`table`);this.isEnabled=t.schema.checkAttribute(r,`footerRows`),this.value=n.every(e=>this._isInFooter(e,r))}execute(e={}){if(e.forceValue===this.value)return;let t=this.editor.plugins.get(`TableUtils`),n=this.editor.model,r=t.getSelectionAffectedTableCells(n.document.selection),i=r[0].findAncestor(`table`),{first:a,last:o}=t.getRowIndexes(r),s=t.getRows(i),c=this.value?s-(o+1):s-a,l=i.getAttribute(`footerRows`)||0;n.change(e=>{if(c){let t=s-c,n=s-l,r=H8(i,t,t>n?n:0);for(let{cell:n}of r)U8(n,t,e)}t.setFooterRowsCount(e,i,c)})}_isInFooter(e,t){let n=parseInt(t.getAttribute(`footerRows`)||`0`),r=this.editor.plugins.get(`TableUtils`).getRows(t),i=e.parent.index;return!!n&&i>=r-n}},e7=class extends I{refresh(){let e=this.editor.plugins.get(`TableUtils`),t=this.editor.model,n=e.getSelectionAffectedTableCells(t.document.selection);if(n.length===0){this.isEnabled=!1,this.value=!1;return}let r=n[0].findAncestor(`table`);this.isEnabled=t.schema.checkAttribute(r,`headingColumns`),this.value=n.every(t=>F8(e,t))}execute(e={}){if(e.forceValue===this.value)return;let t=this.editor.plugins.get(`TableUtils`),n=this.editor.model,r=t.getSelectionAffectedTableCells(n.document.selection),i=r[0].findAncestor(`table`),{first:a,last:o}=t.getColumnIndexes(r),s=this.value?a:o+1;n.change(e=>{if(s){let t=W8(i,s);for(let{cell:n,column:r}of t)G8(n,r,s,e)}t.setHeadingColumnsCount(e,i,s)})}},t7=class extends I{refresh(){let e=this.editor.plugins.get(O5),t=e.getSelectedTableCells(this.editor.model.document.selection);this.isEnabled=e.isSelectionRectangular(t)}execute(){let e=this.editor.model,t=this.editor.plugins.get(O5);e.change(n=>{let r=t.getSelectedTableCells(e.document.selection),i=r.shift(),{mergeWidth:a,mergeHeight:o}=tre(i,r,t);N8(`colspan`,a,i,n),N8(`rowspan`,o,i,n);for(let e of r)ere(e,i,n);Z8(i.findAncestor(`table`),t),n.setSelection(i,`in`)})}};function ere(e,t,n){n7(e)||(n7(t)&&n.remove(n.createRangeIn(t)),n.move(n.createRangeIn(e),n.createPositionAt(t,`end`))),n.remove(e)}function n7(e){let t=e.getChild(0);return e.childCount==1&&t.is(`element`,`paragraph`)&&t.isEmpty}function tre(e,t,n){let r=0,i=0;for(let e of t){let{row:t,column:a}=n.getCellLocation(e);r=r7(e,a,r,`colspan`),i=r7(e,t,i,`rowspan`)}let{row:a,column:o}=n.getCellLocation(e);return{mergeWidth:r-o,mergeHeight:i-a}}function r7(e,t,n,r){let i=parseInt(e.getAttribute(r)||`1`);return Math.max(n,t+i)}var i7=class extends I{constructor(e){super(e),this.affectsData=!1}refresh(){let e=this.editor.plugins.get(`TableUtils`).getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){let e=this.editor.model,t=this.editor.plugins.get(`TableUtils`),n=t.getSelectionAffectedTableCells(e.document.selection),r=t.getRowIndexes(n),i=n[0].findAncestor(`table`),a=[];for(let t=r.first;t<=r.last;t++)for(let n of i.getChild(t).getChildren())a.push(e.createRangeOn(n));e.change(e=>{e.setSelection(a)})}},a7=class extends I{constructor(e){super(e),this.affectsData=!1}refresh(){let e=this.editor.plugins.get(`TableUtils`).getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){let e=this.editor.plugins.get(`TableUtils`),t=this.editor.model,n=e.getSelectionAffectedTableCells(t.document.selection),r=n[0],i=n.pop(),a=r.findAncestor(`table`),o=e.getCellLocation(r),s=e.getCellLocation(i),c=Math.min(o.column,s.column),l=Math.max(o.column,s.column),u=[];for(let e of new $(a,{startColumn:c,endColumn:l}))u.push(t.createRangeOn(e.cell));t.change(e=>{e.setSelection(u)})}};function o7(e){e.document.registerPostFixer(t=>nre(t,e))}function nre(e,t){let n=t.document.differ.getChanges(),r=!1,i=new Set;for(let t of n){let n=null;t.type==`insert`&&t.name==`table`&&(n=t.position.nodeAfter),(t.type==`insert`||t.type==`remove`)&&(t.name==`tableRow`||t.name==`tableCell`)&&(n=t.position.findAncestor(`table`)),sre(t)&&(n=t.range.start.findAncestor(`table`)),n&&!i.has(n)&&(r=rre(n,e)||r,r=ire(n,e)||r,i.add(n))}return r}function rre(e,t){let n=!1,r=are(e);if(r.length){n=!0;for(let e of r)N8(`rowspan`,e.rowspan,e.cell,t,1)}return n}function ire(e,t){let n=!1,r=ore(e),i=[];for(let[t,n]of r.entries())!n&&e.getChild(t).is(`element`,`tableRow`)&&i.push(t);if(i.length){n=!0;for(let n of i.reverse())t.remove(e.getChild(n)),r.splice(n,1)}let a=r.filter((t,n)=>e.getChild(n).is(`element`,`tableRow`)),o=a[0];if(!a.every(e=>e===o)){let r=a.reduce((e,t)=>t>e?t:e,0);for(let[i,o]of a.entries()){let a=r-o;if(a){for(let n=0;n<a;n++)P8(t,t.createPositionAt(e.getChild(i),`end`));n=!0}}}return n}function are(e){let t=parseInt(e.getAttribute(`headingRows`)||`0`),n=parseInt(e.getAttribute(`footerRows`)||`0`),r=Array.from(e.getChildren()).reduce((e,t)=>t.is(`element`,`tableRow`)?e+1:e,0),i=r-n,a=[];for(let{row:n,cell:o,cellHeight:s}of new $(e)){if(s<2)continue;let e=n<t,c=n>=i,l;if(l=e?t:c?r:i,n+s>l){let e=l-n;a.push({cell:o,rowspan:e})}}return a}function ore(e){let t=Array(e.childCount).fill(0);for(let{rowIndex:n}of new $(e,{includeAllSlots:!0}))t[n]++;return t}function sre(e){if(e.type!==`attribute`)return!1;let t=e.attributeKey;return t===`headingRows`||t===`colspan`||t===`rowspan`}function s7(e){e.document.registerPostFixer(t=>cre(t,e))}function cre(e,t){let n=t.document.differ.getChanges(),r=!1;for(let t of n)t.type==`insert`&&t.name==`table`&&(r=lre(t.position.nodeAfter,e)||r),t.type==`insert`&&t.name==`tableRow`&&(r=c7(t.position.nodeAfter,e)||r),t.type==`insert`&&t.name==`tableCell`&&(r=l7(t.position.nodeAfter,e)||r),(t.type==`remove`||t.type==`insert`)&&ure(t)&&(r=l7(t.position.parent,e)||r);return r}function lre(e,t){let n=!1;for(let r of e.getChildren())r.is(`element`,`tableRow`)&&(n=c7(r,t)||n);return n}function c7(e,t){let n=!1;for(let r of e.getChildren())n=l7(r,t)||n;return n}function l7(e,t){if(e.childCount==0)return t.insertElement(`paragraph`,e),!0;let n=Array.from(e.getChildren()).filter(e=>e.is(`$text`));for(let e of n)t.wrap(t.createRangeOn(e),`paragraph`);return!!n.length}function ure(e){return e.position.parent.is(`element`,`tableCell`)?e.type==`insert`&&e.name==`$text`||e.type==`remove`:!1}function dre(e){let{model:t}=e,n=e.plugins.get(O5);t.document.registerPostFixer(e=>{let r=!1,i=t.document.differ.getChanges(),a=new Set;for(let e of i){let t=null;e.type==`attribute`&&(e.attributeKey==`headingRows`||e.attributeKey==`footerRows`)?t=e.range.start.nodeAfter:(e.type==`insert`&&e.name==`tableRow`||e.type==`remove`&&e.name==`tableRow`)&&(t=e.position.parent),t&&t.is(`element`,`table`)&&a.add(t)}for(let t of a)fre(n,e,t)&&(r=!0);return r})}function fre(e,t,n){let r=n.getAttribute(`headingRows`)||0,i=n.getAttribute(`footerRows`)||0,a=e.getRows(n);return r+i>a?(N8(`footerRows`,Math.max(0,a-r),n,t,0),!0):!1}function u7(e,t){let n=e.document.differ,r=new Set,i=new Set,a=new Set;for(let e of n.getChanges()){let n;if(e.type==`attribute`){let t=e.range.start.nodeAfter;if(!t||!t.is(`element`,`table`)||e.attributeKey!=`headingRows`&&e.attributeKey!=`headingColumns`&&e.attributeKey!=`footerRows`)continue;n=t}else(e.name==`tableRow`||e.name==`tableCell`)&&(n=e.position.findAncestor(`table`));if(!n)continue;e.type==`insert`&&e.name==`tableRow`&&t.mapper.toViewElement(e.position.nodeAfter)&&r.add(e.position.nodeAfter);let o=n.getAttribute(`headingRows`)||0,s=n.getAttribute(`headingColumns`)||0,c=new $(n);for(let e of c){let n=t.mapper.toViewElement(e.cell);if(!n||!n.is(`element`))continue;let c=e.row<o||e.column<s?`th`:`td`;n.name!=c&&(a.add(e.cell),r.has(e.cell.parent)&&i.add(e.cell.parent))}}for(let e of i)t.reconvertItem(e);for(let e of a)t.reconvertItem(e)}function d7(e,t){let n=e.document.differ,r=new Set;for(let e of n.getChanges()){let t=e.type==`attribute`?e.range.start.parent:e.position.parent;t.is(`element`,`tableCell`)&&r.add(t)}for(let e of r.values()){let n=Array.from(e.getChildren()).filter(e=>pre(e,t.mapper));for(let e of n)t.reconvertItem(e)}}function pre(e,t){if(!e.is(`element`,`paragraph`))return!1;let n=t.toViewElement(e);return n?H5(e)!==n.is(`element`,`span`):!1}var f7=class extends F{_additionalSlots;static get pluginName(){return`TableEditing`}static get isOfficialPlugin(){return!0}static get requires(){return[O5]}constructor(e){super(e),this._additionalSlots=[]}init(){let e=this.editor,t=e.model,n=t.schema,r=e.conversion,i=e.plugins.get(O5);e.config.define(`table.enableFooters`,!1);let a=!!e.config.get(`table.enableFooters`);n.register(`table`,{inheritAllFrom:`$blockObject`,allowAttributes:[`headingRows`,`headingColumns`,...a?[`footerRows`]:[]]}),n.register(`tableRow`,{allowIn:`table`,isLimit:!0}),n.register(`tableCell`,{allowContentOf:`$container`,allowIn:`tableRow`,allowAttributes:[`colspan`,`rowspan`],isLimit:!0,isSelectable:!0}),r.for(`upcast`).add(t5()),r.for(`upcast`).add(n5({enableFooters:a})),r.for(`editingDowncast`).elementToStructure({model:{name:`table`,attributes:[`headingRows`,...a?[`footerRows`]:[]]},view:R5(i,{asWidget:!0,additionalSlots:this._additionalSlots})}),r.for(`dataDowncast`).elementToStructure({model:{name:`table`,attributes:[`headingRows`,...a?[`footerRows`]:[]]},view:R5(i,{additionalSlots:this._additionalSlots})}),r.for(`upcast`).elementToElement({model:`tableRow`,view:`tr`}),r.for(`upcast`).add(r5()),r.for(`downcast`).elementToElement({model:`tableRow`,view:z5()}),r.for(`upcast`).elementToElement({model:`tableCell`,view:`td`}),r.for(`upcast`).elementToElement({model:`tableCell`,view:`th`}),r.for(`upcast`).add(i5(`td`)),r.for(`upcast`).add(i5(`th`)),r.for(`editingDowncast`).elementToElement({model:`tableCell`,view:B5({asWidget:!0,cellTypeEnabled:()=>B8(this.editor)})}),r.for(`dataDowncast`).elementToElement({model:`tableCell`,view:B5({cellTypeEnabled:()=>B8(this.editor)})}),r.for(`editingDowncast`).elementToElement({model:`paragraph`,view:V5({asWidget:!0}),converterPriority:`high`}),r.for(`dataDowncast`).elementToElement({model:`paragraph`,view:V5(),converterPriority:`high`}),r.for(`downcast`).attributeToAttribute({model:`colspan`,view:`colspan`}),r.for(`upcast`).attributeToAttribute({model:{key:`colspan`,value:p7(`colspan`)},view:`colspan`}),r.for(`downcast`).attributeToAttribute({model:`rowspan`,view:`rowspan`}),r.for(`upcast`).attributeToAttribute({model:{key:`rowspan`,value:p7(`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`,!0),e.config.get(`table.showHiddenBorders`)&&e.editing.view.change(t=>{for(let n of e.editing.view.document.roots)t.addClass(`ck-table-show-hidden-borders`,n)}),e.commands.add(`insertTable`,new W5(e)),e.commands.add(`insertTableRowAbove`,new G5(e,{order:`above`})),e.commands.add(`insertTableRowBelow`,new G5(e,{order:`below`})),e.commands.add(`insertTableColumnLeft`,new K5(e,{order:`left`})),e.commands.add(`insertTableColumnRight`,new K5(e,{order:`right`})),e.commands.add(`removeTableRow`,new X5(e)),e.commands.add(`removeTableColumn`,new Z5(e)),e.commands.add(`splitTableCellVertically`,new q5(e,{direction:`vertically`})),e.commands.add(`splitTableCellHorizontally`,new q5(e,{direction:`horizontally`})),e.commands.add(`mergeTableCells`,new t7(e)),e.commands.add(`mergeTableCellRight`,new J5(e,{direction:`right`})),e.commands.add(`mergeTableCellLeft`,new J5(e,{direction:`left`})),e.commands.add(`mergeTableCellDown`,new J5(e,{direction:`down`})),e.commands.add(`mergeTableCellUp`,new J5(e,{direction:`up`})),e.commands.add(`setTableColumnHeader`,new e7(e)),e.commands.add(`setTableRowHeader`,new Q5(e)),a&&e.commands.add(`setTableFooterRow`,new $5(e)),e.commands.add(`selectTableRow`,new i7(e)),e.commands.add(`selectTableColumn`,new a7(e)),o7(t),s7(t),a&&dre(e),this.listenTo(t.document,`change:data`,()=>{B8(e)||u7(t,e.editing),d7(t,e.editing)})}registerAdditionalSlot(e){this._additionalSlots.push(e)}_addPlainTableOutputConverters(){let e=this.editor;e.conversion.for(`dataDowncast`).elementToStructure({model:`table`,view:Une(e),converterPriority:`high`}),e.plugins.has(`TableCaptionEditing`)&&e.conversion.for(`dataDowncast`).elementToElement({model:`caption`,view:Wne(e),converterPriority:`high`}),e.plugins.has(`TablePropertiesEditing`)&&Kne(e)}};function p7(e){return t=>{let n=parseInt(t.getAttribute(e));return Number.isNaN(n)||n<=0?null:n}}var m7=class extends P{items;keystrokes;focusTracker;constructor(e){super(e);let t=this.bindTemplate;this.items=this._createGridCollection(),this.keystrokes=new N,this.focusTracker=new M,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":!0},children:[{text:t.to(`label`)}]}],on:{mousedown:t.to(e=>{e.preventDefault()}),click:t.to(()=>{this.fire(`execute`)})}}),this.on(`boxover`,(e,t)=>{let{row:n,column:r}=t.target.dataset;this.items.get((parseInt(n,10)-1)*10+(parseInt(r,10)-1)).focus()}),this.focusTracker.on(`change:focusedElement`,(e,t,n)=>{if(!n)return;let{row:r,column:i}=n.dataset;this.set({rows:parseInt(r),columns:parseInt(i)})}),this.on(`change:columns`,()=>this._highlightGridBoxes()),this.on(`change:rows`,()=>this._highlightGridBoxes())}render(){super.render(),$a({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:10,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection});for(let 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(){let e=this.rows,t=this.columns;this.items.map((n,r)=>{let i=Math.floor(r/10),a=r%10,o=i<e&&a<t;n.set(`isOn`,o)})}_createGridButton(e,t,n,r){let i=new H(e);return i.set({label:r,class:`ck-insert-table-dropdown-grid-box`}),i.extendTemplate({attributes:{"data-row":t,"data-column":n}}),i}_createGridCollection(){let e=[];for(let t=0;t<100;t++){let n=Math.floor(t/10),r=t%10,i=`${n+1} × ${r+1}`;e.push(this._createGridButton(this.locale,n+1,r+1,i))}return this.createCollection(e)}},h7=class extends F{static get pluginName(){return`TableUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=this.editor.t,n=e.locale.contentLanguageDirection===`ltr`,r=!!e.config.get(`table.enableFooters`);e.ui.componentFactory.add(`insertTable`,n=>{let r=e.commands.get(`insertTable`),i=Nx(n);i.bind(`isEnabled`).to(r),i.buttonView.set({icon:xy,label:t(`Insert table`),tooltip:!0});let a;return i.on(`change:isOpen`,()=>{a||(a=new m7(n),i.panelView.children.add(a),a.delegate(`execute`).to(i),i.on(`execute`,()=>{e.execute(`insertTable`,{rows:a.rows,columns:a.columns}),e.editing.view.focus()}))}),i}),e.ui.componentFactory.add(`menuBar:insertTable`,n=>{let r=e.commands.get(`insertTable`),i=new uw(n),a=new m7(n);return a.delegate(`execute`).to(i),i.on(`change:isOpen`,(e,t,n)=>{n||a.reset()}),a.on(`execute`,()=>{e.execute(`insertTable`,{rows:a.rows,columns:a.columns}),e.editing.view.focus()}),i.buttonView.set({label:t(`Table`),icon:xy}),i.panelView.children.add(a),i.bind(`isEnabled`).to(r),i}),e.ui.componentFactory.add(`tableColumn`,e=>{let r=[{type:`switchbutton`,model:{commandName:`setTableColumnHeader`,label:t(`Header column`),bindIsOn:!0}},{type:`separator`},{type:`button`,model:{commandName:n?`insertTableColumnLeft`:`insertTableColumnRight`,label:t(`Insert column left`)}},{type:`button`,model:{commandName:n?`insertTableColumnRight`:`insertTableColumnLeft`,label:t(`Insert column right`)}},{type:`button`,model:{commandName:`removeTableColumn`,label:t(`Delete column`)}},{type:`button`,model:{commandName:`selectTableColumn`,label:t(`Select column`)}}];return this._prepareDropdown(t(`Column`),_y,r,e)}),e.ui.componentFactory.add(`tableRow`,e=>{let n=[{type:`switchbutton`,model:{commandName:`setTableRowHeader`,label:t(`Header row`),bindIsOn:!0}},r&&{type:`switchbutton`,model:{commandName:`setTableFooterRow`,label:t(`Footer row`),bindIsOn:!0}},{type:`separator`},{type:`button`,model:{commandName:`insertTableRowAbove`,label:t(`Insert row above`)}},{type:`button`,model:{commandName:`insertTableRowBelow`,label:t(`Insert row below`)}},{type:`button`,model:{commandName:`removeTableRow`,label:t(`Delete row`)}},{type:`button`,model:{commandName:`selectTableRow`,label:t(`Select row`)}}].filter(Boolean);return this._prepareDropdown(t(`Row`),by,n,e)}),e.ui.componentFactory.add(`mergeTableCells`,e=>{let r=[{type:`button`,model:{commandName:`mergeTableCellUp`,label:t(`Merge cell up`)}},{type:`button`,model:{commandName:n?`mergeTableCellRight`:`mergeTableCellLeft`,label:t(`Merge cell right`)}},{type:`button`,model:{commandName:`mergeTableCellDown`,label:t(`Merge cell down`)}},{type:`button`,model:{commandName:n?`mergeTableCellLeft`:`mergeTableCellRight`,label:t(`Merge cell left`)}},{type:`separator`},{type:`button`,model:{commandName:`splitTableCellVertically`,label:t(`Split cell vertically`)}},{type:`button`,model:{commandName:`splitTableCellHorizontally`,label:t(`Split cell horizontally`)}}];return this._prepareMergeSplitButtonDropdown(t(`Merge cells`),vy,r,e)})}_prepareDropdown(e,t,n,r){let i=this.editor,a=Nx(r),o=this._fillDropdownWithListOptions(a,n);return a.buttonView.set({label:e,icon:t,tooltip:!0}),a.bind(`isEnabled`).toMany(o,`isEnabled`,(...e)=>e.some(e=>e)),this.listenTo(a,`execute`,e=>{i.execute(e.source.commandName),e.source instanceof mb||i.editing.view.focus()}),a}_prepareMergeSplitButtonDropdown(e,t,n,r){let i=this.editor,a=Nx(r,Mx),o=`mergeTableCells`,s=i.commands.get(o),c=this._fillDropdownWithListOptions(a,n);return a.buttonView.set({label:e,icon:t,tooltip:!0,isEnabled:!0}),a.bind(`isEnabled`).toMany([s,...c],`isEnabled`,(...e)=>e.some(e=>e)),this.listenTo(a.buttonView,`execute`,()=>{i.execute(o),i.editing.view.focus()}),this.listenTo(a,`execute`,e=>{i.execute(e.source.commandName),i.editing.view.focus()}),a}_fillDropdownWithListOptions(e,t){let n=this.editor,r=[],i=new Fi;for(let e of t)mre(e,n,r,i);return Lx(e,i),r}};function mre(e,t,n,r){if(e.type===`button`||e.type===`switchbutton`){let r=e.model=new RC(e.model),{commandName:i,bindIsOn:a}=e.model,o=t.commands.get(i);n.push(o),r.set({commandName:i}),r.bind(`isEnabled`).to(o),a&&r.bind(`isOn`).to(o,`value`),r.set({withText:!0})}r.add(e)}var g7=class extends F{static get pluginName(){return`TableSelection`}static get isOfficialPlugin(){return!0}static get requires(){return[O5,O5]}init(){let e=this.editor,t=e.model,n=e.editing.view;this.listenTo(t,`deleteContent`,(e,t)=>this._handleDeleteContent(e,t),{priority:`high`}),this.listenTo(n.document,`insertText`,(e,t)=>this._handleInsertTextEvent(e,t),{priority:`high`}),this._defineSelectionConverter(),this._enablePluginDisabling()}getSelectedTableCells(){let e=this.editor.plugins.get(O5),t=this.editor.model.document.selection,n=e.getSelectedTableCells(t);return n.length==0?null:n}getSelectionAsFragment(){let e=this.editor.plugins.get(O5),t=this.getSelectedTableCells();return t?this.editor.model.change(n=>{let r=n.createDocumentFragment(),{first:i,last:a}=e.getColumnIndexes(t),{first:o,last:s}=e.getRowIndexes(t),c=t[0].findAncestor(`table`),l=s,u=a;if(e.isSelectionRectangular(t)){let e={firstColumn:i,lastColumn:a,firstRow:o,lastRow:s};l=Q8(c,e),u=$8(c,e)}let d=V8(c,{startRow:o,startColumn:i,endRow:l,endColumn:u},n);return n.insert(d,r,0),r}):null}setCellSelection(e,t){let n=this._getCellsToSelect(e,t);this.editor.model.change(e=>{e.setSelection(n.cells.map(t=>e.createRangeOn(t)),{backward:n.backward})})}getFocusCell(){let e=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return e&&e.is(`element`,`tableCell`)?e:null}getAnchorCell(){let e=this.editor.model.document.selection,t=j(e.getRanges()).getContainedElement();return t&&t.is(`element`,`tableCell`)?t:null}_defineSelectionConverter(){let e=this.editor,t=new Set;e.conversion.for(`editingDowncast`).add(e=>e.on(`selection`,(e,r,i)=>{let a=i.writer;n(a);let o=this.getSelectedTableCells();if(!o)return;for(let e of o){let n=i.mapper.toViewElement(e);a.addClass(`ck-editor__editable_selected`,n),t.add(n)}let s=i.mapper.toViewElement(o[o.length-1]);a.setSelection(s,0)},{priority:`lowest`}));function n(e){for(let n of t)e.removeClass(`ck-editor__editable_selected`,n);t.clear()}}_enablePluginDisabling(){let e=this.editor;this.on(`change:isEnabled`,()=>{if(!this.isEnabled){let t=this.getSelectedTableCells();if(!t)return;e.model.change(n=>{let r=n.createPositionAt(t[0],0),i=e.model.schema.getNearestSelectionRange(r);n.setSelection(i)})}})}_handleDeleteContent(e,t){let n=this.editor.plugins.get(O5),r=t[0],i=t[1],a=this.editor.model,o=!i||i.direction==`backward`,s=n.getSelectedTableCells(r);s.length&&(e.stop(),a.change(e=>{let t=s[o?s.length-1:0];a.change(e=>{for(let t of s)a.deleteContent(e.createSelection(t,`in`))});let n=a.schema.getNearestSelectionRange(e.createPositionAt(t,0));r.is(`documentSelection`)?e.setSelection(n):r.setTo(n)}))}_handleInsertTextEvent(e,t){let n=this.editor,r=this.getSelectedTableCells();if(!r)return;let i=n.editing.view,a=n.editing.mapper,o=r.map(e=>i.createRangeOn(a.toViewElement(e)));t.selection=i.createSelection(o),t.preventDefault()}_getCellsToSelect(e,t){let n=this.editor.plugins.get(`TableUtils`),r=n.getCellLocation(e),i=n.getCellLocation(t),a=Math.min(r.row,i.row),o=Math.max(r.row,i.row),s=Math.min(r.column,i.column),c=parseInt(t.getAttribute(`colspan`)||`1`)-1,l=Math.max(r.column,i.column+c),u=Array(o-a+1).fill(null).map(()=>[]),d={startRow:a,endRow:o,startColumn:s,endColumn:l};for(let{row:t,cell:n}of new $(e.findAncestor(`table`),d))u[t-a].push(n);let f=i.row<r.row,p=i.column<r.column;return f&&u.reverse(),p&&u.forEach(e=>e.reverse()),{cells:u.flat(),backward:f||p}}},_7=class extends F{static get pluginName(){return`TableClipboard`}static get isOfficialPlugin(){return!0}static get requires(){return[gO,_O,g7,O5]}init(){let 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(){let{editor:e}=this,t=e.plugins.get(_O),n=e.plugins.get(g7),r=!1;t.on(`contentInsertion`,(e,t)=>{r=t.method===`paste`}),this.listenTo(e.model,`insertContent`,(e,[t,i])=>{(r||n.getSelectedTableCells()!==null)&&this._onInsertContent(e,t,i)},{priority:`high`}),t.on(`contentInsertion`,()=>{r=!1},{priority:`lowest`})}_onCopyCut(e,t){let n=this.editor.editing.view,r=this.editor.plugins.get(g7),i=this.editor.plugins.get(gO);r.getSelectedTableCells()&&(e.name==`cut`&&!this.editor.model.canEditAt(this.editor.model.document.selection)||(t.preventDefault(),e.stop(),this.editor.model.enqueueChange({isUndoable:e.name===`cut`},()=>{let a=i._copySelectedFragmentWithMarkers(e.name,this.editor.model.document.selection,()=>r.getSelectionAsFragment());n.document.fire(`clipboardOutput`,{dataTransfer:t.dataTransfer,content:this.editor.data.toView(a),method:e.name})})))}_onInsertContent(e,t,n){if(n&&!n.is(`documentSelection`))return;let r=this.editor.model,i=this.editor.plugins.get(O5),a=this.editor.plugins.get(gO),o=this.getTableIfOnlyTableInContent(t,r);if(!o)return;let s=i.getSelectionAffectedTableCells(r.document.selection);if(!s.length){Z8(o,i);return}e.stop(),t.is(`documentFragment`)?a._pasteMarkersIntoTransformedElement(t.markers,e=>this._replaceSelectedCells(o,s,e)):this.editor.model.change(e=>{this._replaceSelectedCells(o,s,e)})}_replaceSelectedCells(e,t,n){let r=this.editor.plugins.get(O5),i={width:r.getColumns(e),height:r.getRows(e)},a=hre(t,i,n,r),o=a.lastRow-a.firstRow+1,s=a.lastColumn-a.firstColumn+1,c={startRow:0,startColumn:0,endRow:Math.min(o,i.height)-1,endColumn:Math.min(s,i.width)-1};e=V8(e,c,n);let l=t[0].findAncestor(`table`),u=this._replaceSelectedCellsWithPasted(e,i,l,a,n,r);if(this.editor.plugins.get(`TableSelection`).isEnabled){let e=r.sortRanges(u.map(e=>n.createRangeOn(e)));n.setSelection(e)}else n.setSelection(u[0],0);return l}_replaceSelectedCellsWithPasted(e,t,n,r,i,a){let{width:o,height:s}=t,c=_re(e,o,s),l=[...new $(n,{startRow:r.firstRow,endRow:r.lastRow,startColumn:r.firstColumn,endColumn:r.lastColumn,includeAllSlots:!0})],u=[],d;for(let e of l){let{row:t,column:n}=e;n===r.firstColumn&&(d=e.getPositionBefore());let a=t-r.firstRow,l=n-r.firstColumn,f=c[a%s][l%o],p=f?i.cloneElement(f):null,m=this._replaceTableSlotCell(e,p,d,i);m&&(K8(m,t,n,r.lastRow,r.lastColumn,i),u.push(m),d=i.createPositionAfter(m))}let f=parseInt(n.getAttribute(`headingRows`)||`0`),p=parseInt(n.getAttribute(`headingColumns`)||`0`),m=parseInt(n.getAttribute(`footerRows`)||`0`),h=a.getRows(n)-m,g=r.firstRow<f&&f<=r.lastRow,_=r.firstColumn<p&&p<=r.lastColumn,v=r.firstRow<h&&h<=r.lastRow;if(g){let e=v7(n,f,{first:r.firstColumn,last:r.lastColumn},i,r.firstRow);u.push(...e)}if(_){let e=y7(n,p,{first:r.firstRow,last:r.lastRow},i);u.push(...e)}if(v){let e=v7(n,h,{first:r.firstColumn,last:r.lastColumn},i,r.firstRow);u.push(...e)}return u}_replaceTableSlotCell(e,t,n,r){let{cell:i,isAnchor:a}=e;return a&&r.remove(i),t?(r.insert(t,n),t):null}getTableIfOnlyTableInContent(e,t){if(!e.is(`documentFragment`)&&!e.is(`element`))return null;if(e.is(`element`,`table`))return e;if(e.childCount==1&&e.getChild(0).is(`element`,`table`))return e.getChild(0);let n=t.createRangeIn(e);for(let e of n.getItems())if(e.is(`element`,`table`)){let r=t.createRange(n.start,t.createPositionBefore(e));if(t.hasContent(r,{ignoreWhitespaces:!0}))return null;let i=t.createRange(t.createPositionAfter(e),n.end);return t.hasContent(i,{ignoreWhitespaces:!0})?null:e}return null}};function hre(e,t,n,r){let i=e[0].findAncestor(`table`),a=r.getColumnIndexes(e),o=r.getRowIndexes(e),s={firstColumn:a.first,lastColumn:a.last,firstRow:o.first,lastRow:o.last},c=e.length===1;return c&&(s.lastRow+=t.height-1,s.lastColumn+=t.width-1,gre(i,s.lastRow+1,s.lastColumn+1,r)),c||!r.isSelectionRectangular(e)?vre(i,s,n):(s.lastRow=Q8(i,s),s.lastColumn=$8(i,s)),s}function gre(e,t,n,r){let i=r.getColumns(e),a=r.getRows(e);n>i&&r.insertColumns(e,{at:i,columns:n-i}),t>a&&r.insertRows(e,{at:a,rows:t-a})}function _re(e,t,n){let r=Array(n).fill(null).map(()=>Array(t).fill(null));for(let{column:t,row:n,cell:i}of new $(e))r[n][t]=i;return r}function vre(e,t,n){let{firstRow:r,lastRow:i,firstColumn:a,lastColumn:o}=t,s={first:r,last:i},c={first:a,last:o};y7(e,a,s,n),y7(e,o+1,s,n),v7(e,r,c,n),v7(e,i+1,c,n,r)}function v7(e,t,n,r,i=0){if(!(t<1))return H8(e,t,i).filter(({column:e,cellWidth:t})=>b7(e,t,n)).map(({cell:e})=>U8(e,t,r))}function y7(e,t,n,r){if(!(t<1))return W8(e,t).filter(({row:e,cellHeight:t})=>b7(e,t,n)).map(({cell:e,column:n})=>G8(e,n,t,r))}function b7(e,t,n){let r=e+t-1,{first:i,last:a}=n;return e>=i&&e<=a||e<i&&r>=i}var x7=class extends F{static get pluginName(){return`TableKeyboard`}static get isOfficialPlugin(){return!0}static get requires(){return[g7,O5]}init(){let e=this.editor,t=e.editing.view.document,n=e.t;this.listenTo(t,`arrowKey`,(...e)=>this._onArrowKey(...e),{context:`table`}),this.listenTo(t,`tab`,(...e)=>this._handleTabOnSelectedTable(...e),{context:`figure`}),this.listenTo(t,`tab`,(...e)=>this._handleTab(...e),{context:[`th`,`td`]}),e.accessibility.addKeystrokeInfoGroup({id:`table`,label:n(`Keystrokes that can be used in a table cell`),keystrokes:[{label:n(`Move the selection to the next cell`),keystroke:`Tab`},{label:n(`Move the selection to the previous cell`),keystroke:`Shift+Tab`},{label:n(`Insert a new table row (when in the last cell of a table)`),keystroke:`Tab`},{label:n(`Navigate through the table`),keystroke:[[`arrowup`],[`arrowright`],[`arrowdown`],[`arrowleft`]]}]})}_handleTabOnSelectedTable(e,t){let n=this.editor.model.document.selection.getSelectedElement();!n||!n.is(`element`,`table`)||t.stopPropagation()}_handleTab(e,t){let n=this.editor,r=this.editor.plugins.get(O5),i=this.editor.plugins.get(`TableSelection`),a=n.model.document.selection,o=!t.shiftKey,s=r.getTableCellsContainingSelection(a)[0];if(s||=i.getFocusCell(),!s)return;t.stopPropagation();let c=s.parent,l=c.parent,u=l.getChildIndex(c),d=c.getChildIndex(s)===c.childCount-1,f=u===r.getRows(l)-1;o&&f&&d&&n.execute(`insertTableRowBelow`)}_onArrowKey(e,t){let n=this.editor,r=t.keyCode,i=Si(r,n.locale.contentLanguageDirection);this._handleArrowKeys(i,t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),e.stop())}_handleArrowKeys(e,t){let n=this.editor.plugins.get(O5),r=this.editor.plugins.get(`TableSelection`),i=this.editor.model,a=i.document.selection,o=[`right`,`down`].includes(e),s=n.getSelectedTableCells(a);if(s.length){let n;return n=t?r.getFocusCell():o?s[s.length-1]:s[0],this._navigateFromCellInDirection(n,e,t),!0}let c=a.focus.findAncestor(`tableCell`);if(!c)return!1;if(!a.isCollapsed)if(t){if(a.isBackward==o&&!a.containsEntireContent(c))return!1}else{let e=a.getSelectedElement();if(!e||!i.schema.isObject(e))return!1}return this._isSelectionAtCellEdge(a,c,o)?(this._navigateFromCellInDirection(c,e,t),!0):!1}_isSelectionAtCellEdge(e,t,n){let r=this.editor.model,i=this.editor.model.schema,a=n?e.getLastPosition():e.getFirstPosition();if(!i.getLimitElement(a).is(`element`,`tableCell`))return r.createPositionAt(t,n?`end`:0).isTouching(a);let o=r.createSelection(a);return r.modifySelection(o,{direction:n?`forward`:`backward`}),a.isEqual(o.focus)}_navigateFromCellInDirection(e,t,n=!1){let r=this.editor.model,i=e.findAncestor(`table`),a=[...new $(i,{includeAllSlots:!0})],{row:o,column:s}=a[a.length-1],c=a.find(({cell:t})=>t==e),{row:l,column:u}=c;switch(t){case`left`:u--;break;case`up`:l--;break;case`right`:u+=c.cellWidth;break;case`down`:l+=c.cellHeight;break}if(l<0||l>o||u<0&&l<=0||u>s&&l>=o){r.change(e=>{e.setSelection(e.createRangeOn(i))});return}u<0?(u=n?0:s,l--):u>s&&(u=n?s:0,l++);let d=a.find(e=>e.row==l&&e.column==u).cell,f=[`right`,`down`].includes(t),p=this.editor.plugins.get(`TableSelection`);if(n&&p.isEnabled){let t=p.getAnchorCell()||e;p.setCellSelection(t,d)}else{let e=r.createPositionAt(d,f?0:`end`);r.change(t=>{t.setSelection(e)})}}},S7=class extends jc{domEventType=[`mousemove`,`mouseleave`];onDomEvent(e){this.fire(e.type,e)}},C7=class extends F{static get pluginName(){return`TableMouse`}static get isOfficialPlugin(){return!0}static get requires(){return[g7,O5]}init(){this.editor.editing.view.addObserver(S7),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){let e=this.editor,t=e.plugins.get(O5),n=!1,r=e.plugins.get(g7);this.listenTo(e.editing.view.document,`mousedown`,(i,a)=>{let o=e.model.document.selection;if(!this.isEnabled||!r.isEnabled||!a.domEvent.shiftKey)return;let s=r.getAnchorCell()||t.getTableCellsContainingSelection(o)[0];if(!s)return;let c=this._getModelTableCellFromDomEvent(a);c&&w7(s,c)&&(n=!0,r.setCellSelection(s,c),a.preventDefault())}),this.listenTo(e.editing.view.document,`mouseup`,()=>{n=!1}),this.listenTo(e.editing.view.document,`selectionChange`,e=>{n&&e.stop()},{priority:`highest`})}_enableMouseDragSelection(){let e=this.editor,t,n,r=!1,i=!1,a=e.plugins.get(g7);this.listenTo(e.editing.view.document,`mousedown`,(e,n)=>{!this.isEnabled||!a.isEnabled||n.domEvent.shiftKey||n.domEvent.ctrlKey||n.domEvent.altKey||(t=this._getModelTableCellFromDomEvent(n))}),this.listenTo(e.editing.view.document,`mousemove`,(e,o)=>{if(!o.domEvent.buttons||!t)return;let s=this._getModelTableCellFromDomEvent(o);s&&w7(t,s)&&(n=s,!r&&n!=t&&(r=!0)),r&&(i=!0,a.setCellSelection(t,n),o.preventDefault())}),this.listenTo(e.editing.view.document,`mouseup`,()=>{r=!1,i=!1,t=null,n=null}),this.listenTo(e.editing.view.document,`selectionChange`,e=>{i&&e.stop()},{priority:`highest`})}_getModelTableCellFromDomEvent(e){let t=e.target,n=this.editor.editing.view.createPositionAt(t,0);return this.editor.editing.mapper.toModelPosition(n).parent.findAncestor(`tableCell`,{includeSelf:!0})}};function w7(e,t){return e.parent.parent==t.parent.parent}var T7=class extends F{static get requires(){return[f7,h7,g7,C7,x7,_7,xD]}static get pluginName(){return`Table`}static get isOfficialPlugin(){return!0}},yre=class extends F{static get pluginName(){return`PlainTableOutput`}static get isOfficialPlugin(){return!0}static get requires(){return[T7]}init(){this.editor.conversion.for(`upcast`).add(e=>{e.on(`element:table`,(e,t,n)=>{n.consumable.consume(t.viewItem,{classes:`table`})})})}};function E7(e){return D7(e)||O7(e)}function D7(e){let t=e.getSelectedElement();return t&&k7(t)?t:null}function O7(e){let t=e.getFirstPosition();if(!t)return null;let n=t.parent;for(;n;){if(n.is(`element`)&&k7(n))return n;n=n.parent}return null}function k7(e){return e.is(`element`)&&!!e.getCustomProperty(`table`)&&HE(e)}var bre=class extends F{static get requires(){return[kD]}static get pluginName(){return`TableToolbar`}static get isOfficialPlugin(){return!0}afterInit(){let e=this.editor,t=e.t,n=e.plugins.get(kD),r=e.config.get(`table.contentToolbar`),i=e.config.get(`table.tableToolbar`);r&&n.register(`tableContent`,{ariaLabel:t(`Table toolbar`),items:r,getRelatedElement:O7}),i&&n.register(`table`,{ariaLabel:t(`Table toolbar`),items:i,getRelatedElement:D7})}},A7=class extends P{options;focusTracker;focusCycler;_focusables;dropdownView;inputView;keystrokes;_stillTyping;constructor(e,t){super(e),this.set(`value`,``),this.set(`isReadOnly`,!1),this.set(`isFocused`,!1),this.set(`isEmpty`,!0),this.options=t,this.focusTracker=new M,this._focusables=new pa,this.dropdownView=this._createDropdownView(),this.inputView=this._createInputTextView(),this.keystrokes=new N,this._stillTyping=!1,this.focusCycler=new Hy({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,n)=>this._setInputValue(n))}render(){super.render(),[this.inputView,this.dropdownView.buttonView].forEach(e=>{this.focusTracker.add(e.element),this._focusables.add(e)}),this.keystrokes.listenTo(this.element)}focus(e){e===-1?this.focusCycler.focusLast():this.focusCycler.focusFirst()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createDropdownView(){let e=this.locale,t=e.t,n=this.bindTemplate,r=this._createColorSelector(e),i=Nx(e),a=new P;return a.setTemplate({tag:`span`,attributes:{class:[`ck`,`ck-input-color__button__preview`],style:{backgroundColor:n.to(`value`)}},children:[{tag:`span`,attributes:{class:[`ck`,`ck-input-color__button__preview__no-color-indicator`,n.if(`value`,`ck-hidden`,e=>e!=``)]}}]}),i.buttonView.extendTemplate({attributes:{class:`ck-input-color__button`}}),i.buttonView.children.add(a),i.buttonView.label=t(`Color picker`),i.buttonView.tooltip=!0,i.panelPosition=e.uiLanguageDirection===`rtl`?`se`:`sw`,i.panelView.children.add(r),i.bind(`isEnabled`).to(this,`isReadOnly`,e=>!e),i.on(`change:isOpen`,(e,t,n)=>{n&&(r.updateSelectedColors(),r.showColorGridsFragment())}),i}_createInputTextView(){let e=this.locale,t=new nx(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`,()=>{let e=t.element.value,n=this.options.colorDefinitions.find(t=>e===t.label);this._stillTyping=!0,this.value=n&&n.color||e}),t.on(`blur`,()=>{this._stillTyping=!1,this._setInputValue(t.element.value)}),t.delegate(`input`).to(this),t}_createColorSelector(e){let t=e.t,n=this.options.defaultColorValue||``,r=t(n?`Restore default`:`Remove color`),i=new GS(e,{colors:this.options.colorDefinitions,columns:this.options.columns,removeButtonLabel:r,colorPickerLabel:t(`Color picker`),colorPickerViewConfig:this.options.colorPickerConfig===!1?!1:{...this.options.colorPickerConfig,hideInput:!0}});i.appendUI(),i.on(`execute`,(e,t)=>{if(t.source===`colorPickerSaveButton`){this.dropdownView.isOpen=!1;return}this.value=t.value||n,this.fire(`input`),t.source!==`colorPicker`&&(this.dropdownView.isOpen=!1)});let a=this.value;return i.on(`colorPicker:cancel`,()=>{this.value=a,this.fire(`input`),this.dropdownView.isOpen=!1}),i.colorGridsFragmentView.colorPickerButtonView.on(`execute`,()=>{a=this.value}),i.bind(`selectedColor`).to(this,`value`),i}_setInputValue(e){if(!this._stillTyping){let t=j7(e),n=this.options.colorDefinitions.find(e=>t===j7(e.color));n?this.inputView.value=n.label:this.inputView.value=e||``}}};function j7(e){return e.replace(/([(,])\s+/g,`$1`).replace(/^\s+|\s+(?=[),\s]|$)/g,``).replace(/,|\s/g,` `)}const M7=e=>e===``;function N7(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 P7(e){return e(`The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".`)}function F7(e){return e(`The value is invalid. Try "10px" or "2em" or simply "2".`)}function I7(e){return e=e.trim().toLowerCase(),M7(e)||Vp(e)}function L7(e){return e=e.trim(),M7(e)||U7(e)||Gp(e)||qp(e)}function R7(e){return e=e.trim(),M7(e)||U7(e)||Gp(e)}function z7(e,t){let n=new Fi,r=N7(e.t);for(let i in r){let a={type:`button`,model:new RC({_borderStyleValue:i,label:r[i],role:`menuitemradio`,withText:!0})};i===`none`?a.model.bind(`isOn`).to(e,`borderStyle`,e=>t===`none`?!e:e===i):a.model.bind(`isOn`).to(e,`borderStyle`,e=>e===i),n.add(a)}return n}function B7(e){let{view:t,icons:n,toolbar:r,labels:i,propertyName:a,nameToValue:o,defaultValue:s}=e;for(let e in i){let c=new H(t.locale);c.set({role:`radio`,isToggleable:!0,label:i[e],icon:n[e],tooltip:i[e]});let l=o?o(e):e;c.bind(`isOn`).to(t,a,e=>{let t=e;return e===``&&s&&(t=s),l===t}),c.on(`execute`,()=>{!s&&l&&t[a]===l?t[a]=void 0:t[a]=l}),r.items.add(c)}}const V7=[{color:`hsl(0, 0%, 0%)`,label:`Black`},{color:`hsl(0, 0%, 30%)`,label:`Dim grey`},{color:`hsl(0, 0%, 60%)`,label:`Grey`},{color:`hsl(0, 0%, 90%)`,label:`Light grey`},{color:`hsl(0, 0%, 100%)`,label:`White`,hasBorder:!0},{color:`hsl(0, 75%, 60%)`,label:`Red`},{color:`hsl(30, 75%, 60%)`,label:`Orange`},{color:`hsl(60, 75%, 60%)`,label:`Yellow`},{color:`hsl(90, 75%, 60%)`,label:`Light green`},{color:`hsl(120, 75%, 60%)`,label:`Green`},{color:`hsl(150, 75%, 60%)`,label:`Aquamarine`},{color:`hsl(180, 75%, 60%)`,label:`Turquoise`},{color:`hsl(210, 75%, 60%)`,label:`Light blue`},{color:`hsl(240, 75%, 60%)`,label:`Blue`},{color:`hsl(270, 75%, 60%)`,label:`Purple`}];function H7(e){return(t,n,r)=>{let i=new A7(t.locale,{colorDefinitions:xre(e.colorConfig),columns:e.columns,defaultColorValue:e.defaultColorValue,colorPickerConfig:e.colorPickerConfig});return i.inputView.set({id:n,ariaDescribedById:r}),i.bind(`isReadOnly`).to(t,`isEnabled`,e=>!e),i.bind(`hasError`).to(t,`errorText`,e=>!!e),i.on(`input`,()=>{t.errorText=null}),t.bind(`isEmpty`,`isFocused`).to(i),i}}function U7(e){let t=parseFloat(e);return!Number.isNaN(t)&&e===String(t)}function xre(e){return e.map(e=>({color:e.model,label:e.label,options:{hasBorder:e.hasBorder}}))}var W7=class extends P{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;let{borderStyleDropdown:n,borderWidthInput:r,borderColorInput:i,borderRowLabel:a}=this._createBorderFields(),{backgroundRowLabel:o,backgroundInput:s}=this._createBackgroundFields(),{cellTypeRowLabel:c,cellTypeDropdown:l}=this._createCellTypeField(),{widthInput:u,operatorLabel:d,heightInput:f,dimensionsLabel:p}=this._createDimensionFields(),{horizontalAlignmentToolbar:m,verticalAlignmentToolbar:h,alignmentLabel:g}=this._createAlignmentFields();this.focusTracker=new M,this.keystrokes=new N,this.children=this.createCollection(),this.borderStyleDropdown=n,this.borderWidthInput=r,this.borderColorInput=i,this.backgroundInput=s,this.cellTypeDropdown=l,this.paddingInput=this._createPaddingField(),this.widthInput=u,this.heightInput=f,this.horizontalAlignmentToolbar=m,this.verticalAlignmentToolbar=h;let{saveButtonView:_,cancelButtonView:v}=this._createActionButtons();this.saveButtonView=_,this.cancelButtonView=v,this.backButtonView=this._createBackButton(),this._focusables=new pa,this._focusCycler=new Hy({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:`shift + tab`,focusNext:`tab`}});let y=new By(e,{label:this.t(`Cell properties`)});y.children.add(this.backButtonView,0),this.children.add(y),this.children.add(new MC(e,{labelView:a,children:[a,n,r,i],class:`ck-table-form__border-row`})),this.children.add(new MC(e,{children:[new MC(e,{labelView:c,children:[c,l],class:`ck-table-form__cell-type-row`}),new MC(e,{labelView:o,children:[o,s],class:`ck-table-form__background-row`})]})),this.children.add(new MC(e,{children:[new MC(e,{labelView:p,children:[p,u,d,f],class:`ck-table-form__dimensions-row`}),new MC(e,{children:[this.paddingInput],class:`ck-table-cell-properties-form__padding-row`})]})),this.children.add(new MC(e,{labelView:g,children:[g,m,h],class:`ck-table-cell-properties-form__alignment-row`})),this.children.add(new MC(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(),Qa({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(){let e=this.options.defaultTableCellProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},n=H7({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),r=this.locale,i=this.t,a=i(`Style`),o=new eo(r);o.text=i(`Border`);let s=N7(i),c=new Qb(r,Zx);c.set({label:a,class:`ck-table-form__border-style`}),c.fieldView.buttonView.set({ariaLabel:a,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:a}),c.fieldView.buttonView.bind(`label`).to(this,`borderStyle`,e=>s[e||`none`]),c.fieldView.on(`execute`,e=>{this.borderStyle=e.source._borderStyleValue}),c.bind(`isEmpty`).to(this,`borderStyle`,e=>!e),Lx(c.fieldView,z7(this,t.style),{role:`menu`,ariaLabel:a});let l=new Qb(r,Jx);l.set({label:i(`Width`),class:`ck-table-form__border-width`}),l.fieldView.bind(`value`).to(this,`borderWidth`),l.bind(`isEnabled`).to(this,`borderStyle`,G7),l.fieldView.on(`input`,()=>{this.borderWidth=l.fieldView.element.value});let u=new Qb(r,n);return u.set({label:i(`Color`),class:`ck-table-form__border-color`}),u.fieldView.bind(`value`).to(this,`borderColor`),u.bind(`isEnabled`).to(this,`borderStyle`,G7),u.fieldView.on(`input`,()=>{this.borderColor=u.fieldView.value}),this.on(`change:borderStyle`,(e,n,r,i)=>{G7(r)||(this.borderColor=``,this.borderWidth=``),G7(i)||(this.borderColor=t.color,this.borderWidth=t.width)}),{borderRowLabel:o,borderStyleDropdown:c,borderColorInput:u,borderWidthInput:l}}_createBackgroundFields(){let e=this.locale,t=this.t,n=new eo(e);n.text=t(`Background`);let r=new Qb(e,H7({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableCellProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}));return r.set({label:t(`Color`),class:`ck-table-cell-properties-form__background`}),r.fieldView.bind(`value`).to(this,`backgroundColor`),r.fieldView.on(`input`,()=>{this.backgroundColor=r.fieldView.value}),{backgroundRowLabel:n,backgroundInput:r}}_createCellTypeField(){let e=this.locale,t=this.t,n=new eo(e);n.text=t(`Cell type`);let r=this._cellTypeLabels,i=new Qb(e,Zx);return i.set({label:t(`Cell type`),class:`ck-table-cell-properties-form__cell-type`}),i.fieldView.buttonView.set({ariaLabel:t(`Cell type`),ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:t(`Cell type`)}),i.fieldView.buttonView.bind(`label`).to(this,`cellType`,e=>r[e||`data`]),i.fieldView.on(`execute`,e=>{this.cellType=e.source._cellTypeValue}),i.bind(`isEmpty`).to(this,`cellType`,e=>!e),Lx(i.fieldView,this._getCellTypeDefinitions(),{role:`menu`,ariaLabel:t(`Cell type`)}),{cellTypeRowLabel:n,cellTypeDropdown:i}}_createDimensionFields(){let e=this.locale,t=this.t,n=new eo(e);n.text=t(`Dimensions`);let r=new Qb(e,Jx);r.set({label:t(`Width`),class:`ck-table-form__dimensions-row__width`}),r.fieldView.bind(`value`).to(this,`width`),r.fieldView.on(`input`,()=>{this.width=r.fieldView.element.value});let i=new P(e);i.setTemplate({tag:`span`,attributes:{class:[`ck-table-form__dimension-operator`]},children:[{text:`×`}]});let a=new Qb(e,Jx);return a.set({label:t(`Height`),class:`ck-table-form__dimensions-row__height`}),a.fieldView.bind(`value`).to(this,`height`),a.fieldView.on(`input`,()=>{this.height=a.fieldView.element.value}),{dimensionsLabel:n,widthInput:r,operatorLabel:i,heightInput:a}}_createPaddingField(){let e=this.locale,t=this.t,n=new Qb(e,Jx);return n.set({label:t(`Padding`),class:`ck-table-cell-properties-form__padding`}),n.fieldView.bind(`value`).to(this,`padding`),n.fieldView.on(`input`,()=>{this.padding=n.fieldView.element.value}),n}_createAlignmentFields(){let e=this.locale,t=this.t,n=new eo(e),r={left:Gg,center:Ug,right:qg,justify:Wg,top:Jg,middle:Kg,bottom:Hg};n.text=t(`Table cell text alignment`);let i=new Ox(e),a=e.contentLanguageDirection===`rtl`;i.set({isCompact:!0,role:`radiogroup`,ariaLabel:t(`Horizontal text alignment toolbar`),class:`ck-table-cell-properties-form__horizontal-alignment-toolbar`}),B7({view:this,icons:r,toolbar:i,labels:this._horizontalAlignmentLabels,propertyName:`horizontalAlignment`,nameToValue:e=>{if(a){if(e===`left`)return`right`;if(e===`right`)return`left`}return e},defaultValue:this.options.defaultTableCellProperties.horizontalAlignment});let o=new Ox(e);return o.set({isCompact:!0,role:`radiogroup`,ariaLabel:t(`Vertical text alignment toolbar`),class:`ck-table-cell-properties-form__vertical-alignment-toolbar`}),B7({view:this,icons:r,toolbar:o,labels:this._verticalAlignmentLabels,propertyName:`verticalAlignment`,defaultValue:this.options.defaultTableCellProperties.verticalAlignment}),{horizontalAlignmentToolbar:i,verticalAlignmentToolbar:o,alignmentLabel:n}}_createActionButtons(){let e=this.locale,t=this.t,n=new H(e),r=new H(e),i=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return n.set({label:t(`Save`),class:`ck-button-action`,type:`submit`,withText:!0}),n.bind(`isEnabled`).toMany(i,`errorText`,(...e)=>e.every(e=>!e)),r.set({label:t(`Cancel`),withText:!0}),r.delegate(`execute`).to(this,`cancel`),{saveButtonView:n,cancelButtonView:r}}_createBackButton(){let e=this.locale.t,t=new H(this.locale);return t.set({class:`ck-button-back`,label:e(`Back`),icon:Wv,tooltip:!0}),t.delegate(`execute`).to(this,`cancel`),t}_getCellTypeDefinitions(){let e=new Fi,t=this._cellTypeLabels,n=[`data`,`header`];this.options.showScopedHeaderOptions&&n.push(`header-column`,`header-row`);for(let r of n){let n={type:`button`,model:new RC({_cellTypeValue:r,label:t[r],role:`menuitemradio`,withText:!0})};n.model.bind(`isOn`).to(this,`cellType`,e=>e===r),e.add(n)}return e}get _horizontalAlignmentLabels(){let e=this.locale,t=this.t,n=t(`Align cell text to the left`),r=t(`Align cell text to the center`),i=t(`Align cell text to the right`),a=t(`Justify cell text`);return e.uiLanguageDirection===`rtl`?{right:i,center:r,left:n,justify:a}:{left:n,center:r,right:i,justify:a}}get _verticalAlignmentLabels(){let 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(){let e=this.t;return{data:e(`Data cell`),header:e(`Header cell`),"header-column":e(`Column header`),"header-row":e(`Row header`)}}};function G7(e){return e!==`none`}const K7=[ab.defaultPositions.northArrowSouth,ab.defaultPositions.northArrowSouthWest,ab.defaultPositions.northArrowSouthEast,ab.defaultPositions.southArrowNorth,ab.defaultPositions.southArrowNorthWest,ab.defaultPositions.southArrowNorthEast,ab.defaultPositions.viewportStickyNorth];function q7(e,t){let n=e.plugins.get(`ContextualBalloon`),r=e.editing.view.document.selection,i;t===`cell`?O7(r)&&(i=Y7(e)):E7(r)&&(i=J7(e)),i&&n.updatePosition(i)}function J7(e){let t=e.model.document.selection,n=L8(t),r=e.editing.mapper.toViewElement(n);return{target:e.editing.view.domConverter.mapViewToDom(r),positions:K7}}function Y7(e){let t=e.editing.mapper,n=e.editing.view.domConverter,r=e.model.document.selection;if(r.rangeCount>1)return{target:()=>Sre(r.getRanges(),e),positions:K7};let i=X7(r.getFirstPosition()),a=t.toViewElement(i);return{target:n.mapViewToDom(a),positions:K7}}function X7(e){return e.nodeAfter&&e.nodeAfter.is(`element`,`tableCell`)?e.nodeAfter:e.findAncestor(`tableCell`)}function Sre(e,t){let n=t.editing.mapper,r=t.editing.view.domConverter,i=Array.from(e).map(e=>{let t=X7(e.start),i=n.toViewElement(t);return new O(r.mapViewToDom(i))});return O.getBoundingRect(i)}const Z7={borderStyle:`tableCellBorderStyle`,borderColor:`tableCellBorderColor`,borderWidth:`tableCellBorderWidth`,height:`tableCellHeight`,width:`tableCellWidth`,padding:`tableCellPadding`,backgroundColor:`tableCellBackgroundColor`,horizontalAlignment:`tableCellHorizontalAlignment`,verticalAlignment:`tableCellVerticalAlignment`,cellType:`tableCellType`};var Q7=class extends F{_defaultContentTableCellProperties;_defaultLayoutTableCellProperties;_balloon;view;_viewWithContentTableDefaults;_viewWithLayoutTableDefaults;_undoStepBatch;_isReady;static get requires(){return[BC]}static get pluginName(){return`TableCellPropertiesUI`}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(`table.tableCellProperties`,{borderColors:V7,backgroundColors:V7})}init(){let e=this.editor,t=e.t;this._defaultContentTableCellProperties=L5(e.config.get(`table.tableCellProperties.defaultProperties`),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:e.locale.contentLanguageDirection===`rtl`}),this._defaultLayoutTableCellProperties=F5(void 0,{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,isRightToLeftContent:e.locale.contentLanguageDirection===`rtl`}),this._balloon=e.plugins.get(BC),this.view=null,this._isReady=!1,e.ui.componentFactory.add(`tableCellProperties`,n=>{let r=new H(n);r.set({label:t(`Cell properties`),icon:gy,tooltip:!0}),this.listenTo(r,`execute`,()=>this._showView());let i=Object.values(Z7).map(t=>e.commands.get(t)).filter(e=>!!e);return r.bind(`isEnabled`).toMany(i,`isEnabled`,(...e)=>e.some(e=>e)),r})}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(e){let t=this.editor,n=t.config.get(`table.tableCellProperties`),r=!!t.config.get(`table.tableCellProperties.scopedHeaders`),i=Cb(n.borderColors),a=Sb(t.locale,i),o=Cb(n.backgroundColors),s=Sb(t.locale,o),c=n.colorPicker!==!1,l=new W7(t.locale,{borderColors:a,backgroundColors:s,defaultTableCellProperties:e,colorPickerConfig:c?n.colorPicker||{}:!1,showScopedHeaderOptions:r}),u=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()}),Ya({emitter:l,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});let d=P7(u),f=F7(u);l.on(`change:borderStyle`,this._getPropertyChangeCallback(`tableCellBorderStyle`)),l.on(`change:borderColor`,this._getValidatedPropertyChangeCallback({viewField:l.borderColorInput,commandName:`tableCellBorderColor`,errorText:d,validator:I7})),l.on(`change:borderWidth`,this._getValidatedPropertyChangeCallback({viewField:l.borderWidthInput,commandName:`tableCellBorderWidth`,errorText:f,validator:R7})),l.on(`change:padding`,this._getValidatedPropertyChangeCallback({viewField:l.paddingInput,commandName:`tableCellPadding`,errorText:f,validator:L7})),l.on(`change:width`,this._getValidatedPropertyChangeCallback({viewField:l.widthInput,commandName:`tableCellWidth`,errorText:f,validator:L7})),l.on(`change:height`,this._getValidatedPropertyChangeCallback({viewField:l.heightInput,commandName:`tableCellHeight`,errorText:f,validator:L7})),l.on(`change:backgroundColor`,this._getValidatedPropertyChangeCallback({viewField:l.backgroundInput,commandName:`tableCellBackgroundColor`,errorText:d,validator:I7})),l.on(`change:horizontalAlignment`,this._getPropertyChangeCallback(`tableCellHorizontalAlignment`)),l.on(`change:verticalAlignment`,this._getPropertyChangeCallback(`tableCellVerticalAlignment`));let p=t.commands.get(`tableCellType`);return p&&(l.cellTypeDropdown.bind(`isEnabled`).to(p,`isEnabled`),l.on(`change:cellType`,this._getPropertyChangeCallback(`tableCellType`))),l}_fillViewFormFromCommandValues(){let e=this.editor.commands,t=e.get(`tableCellBorderStyle`);Object.entries(Z7).flatMap(([t,n])=>{let r=e.get(n);if(!r)return[];let i=t,a;return a=i===`cellType`?``:this.view===this._viewWithContentTableDefaults?this._defaultContentTableCellProperties[i]||``:this._defaultLayoutTableCellProperties[i]||``,[[t,r.value||a]]}).forEach(([e,n])=>{(e===`borderColor`||e===`borderWidth`)&&t.value===`none`||this.view.set(e,n)}),this._isReady=!0}_showView(){let e=this.editor,t=E7(e.editing.view.document.selection),n=t&&e.editing.mapper.toModelElement(t),r=!n||n.getAttribute(`tableType`)!==`layout`;r&&!this._viewWithContentTableDefaults?this._viewWithContentTableDefaults=this._createPropertiesView(this._defaultContentTableCellProperties):!r&&!this._viewWithLayoutTableDefaults&&(this._viewWithLayoutTableDefaults=this._createPropertiesView(this._defaultLayoutTableCellProperties)),this.view=r?this._viewWithContentTableDefaults:this._viewWithLayoutTableDefaults,this.listenTo(e.ui,`update`,()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:Y7(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){let e=this.editor;this.stopListening(e.ui,`update`),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){let e=this.editor,t=e.editing.view.document;O7(t.selection)?this._isViewVisible&&q7(e,`cell`):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,n,r)=>{this._isReady&&this.editor.execute(e,{value:r,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){let{commandName:t,viewField:n,validator:r,errorText:i}=e,a=Kt(()=>{n.errorText=i},500);return(e,i,o)=>{a.cancel(),this._isReady&&(r(o)?(this.editor.execute(t,{value:o,batch:this._undoStepBatch}),n.errorText=null):a())}}},$7=class extends I{attributeName;_defaultValue;_defaultContentTableValue;_defaultLayoutTableValue;constructor(e,t,n){switch(super(e),this.attributeName=t,this._defaultContentTableValue=n,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(){let e=this.editor.model.document.selection,t=this.editor.plugins.get(`TableUtils`).getSelectionAffectedTableCells(e),n=L8(e);this._defaultValue=!n||n.getAttribute(`tableType`)!==`layout`?this._defaultContentTableValue:this._defaultLayoutTableValue,this.isEnabled=!!t.length,this.value=this._getSingleValue(t)}execute(e={}){let{value:t,batch:n}=e,r=this.editor.model,i=this.editor.plugins.get(`TableUtils`).getSelectionAffectedTableCells(r.document.selection),a=this._getValueToSet(t);r.enqueueChange(n,e=>{a?i.forEach(t=>e.setAttribute(this.attributeName,a,t)):i.forEach(t=>e.removeAttribute(this.attributeName,t)),this.fire(`afterExecute`,{writer:e,tableCells:i,valueToSet:a})})}_getAttribute(e){if(!e)return;let t=e.getAttribute(this.attributeName);if(t!==this._defaultValue)return t}_getValueToSet(e){if(e!==this._defaultValue)return e}_getSingleValue(e){let t=this._getAttribute(e[0]);return e.every(e=>this._getAttribute(e)===t)?t:void 0}},e9=class extends $7{constructor(e,t){super(e,`tableCellWidth`,t)}_getValueToSet(e){if(e=P5(e,`px`),e!==this._defaultValue)return e}},t9=class extends F{static get pluginName(){return`TableCellWidthEditing`}static get isOfficialPlugin(){return!0}static get requires(){return[f7]}init(){let e=this.editor,t=L5(e.config.get(`table.tableCellProperties.defaultProperties`));I8(e.model.schema,e.conversion,{modelAttribute:`tableCellWidth`,styleName:`width`,attributeName:`width`,attributeType:`length`,defaultValue:t.width}),e.commands.add(`tableCellWidth`,new e9(e,t.width))}},n9=class extends $7{constructor(e,t){super(e,`tableCellPadding`,t)}_getAttribute(e){if(!e)return;let t=N5(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}_getValueToSet(e){let t=P5(e,`px`);if(t!==this._defaultValue)return t}},r9=class extends $7{constructor(e,t){super(e,`tableCellHeight`,t)}_getValueToSet(e){let t=P5(e,`px`);if(t!==this._defaultValue)return t}},i9=class extends $7{constructor(e,t){super(e,`tableCellBackgroundColor`,t)}},a9=class extends $7{constructor(e,t){super(e,`tableCellVerticalAlignment`,t)}},o9=class extends $7{constructor(e,t){super(e,`tableCellHorizontalAlignment`,t)}},s9=class extends $7{constructor(e,t){super(e,`tableCellBorderStyle`,t)}_getAttribute(e){if(!e)return;let t=N5(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}},c9=class extends $7{constructor(e,t){super(e,`tableCellBorderColor`,t)}_getAttribute(e){if(!e)return;let t=N5(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}},l9=class extends $7{constructor(e,t){super(e,`tableCellBorderWidth`,t)}_getAttribute(e){if(!e)return;let t=N5(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}_getValueToSet(e){let t=P5(e,`px`);if(t!==this._defaultValue)return t}},u9=class extends $7{constructor(e){super(e,`tableCellType`,`data`),this.on(`afterExecute`,(e,t)=>{let{writer:n,tableCells:r}=t;d9(this.editor.plugins.get(O5),n,R8(r).keys())})}refresh(){super.refresh();let e=L8(this.editor.model.document.selection);this.isEnabled&&e&&e.getAttribute(`tableType`)===`layout`&&(this.isEnabled=!1)}_getAttribute(e){return e?.getAttribute(this.attributeName)||`data`}};function d9(e,t,n){let r=!1;for(let i of n){let n=i.getAttribute(`headingRows`)||0,a=i.getAttribute(`headingColumns`)||0,o=i.getAttribute(`footerRows`)||0,s=e.getRows(i)-o,c=a>n;if(c){let o=f9(e,i,`column`,a,n);o!==a&&(e.setHeadingColumnsCount(t,i,o,{updateCellType:!1}),a=o,r=!0)}let l=f9(e,i,`row`,n,a);if(o>0&&(l=Math.min(l,s)),l!==n&&(e.setHeadingRowsCount(t,i,l,{updateCellType:!1}),n=l,r=!0),!c){let o=f9(e,i,`column`,a,n);o!==a&&(e.setHeadingColumnsCount(t,i,o,{updateCellType:!1}),r=!0)}}return r}function f9(e,t,n,r,i){let a=n===`row`?e.getRows(t):e.getColumns(t),o=r;for(let e=0;e<a;e++){let r=new $(t,{[n]:e}),a=!0,s=!1;for(let{cell:e,row:t,column:o}of r){if(!M8(e.getAttribute(`tableCellType`))){a=!1;break}(n===`row`?o:t)>=i&&(s=!0)}if(!a)return Math.min(o,e);s&&(o=Math.max(o,e+1))}return Math.min(o,a)}const p9=/^(top|middle|bottom)$/,m9=/^(left|center|right|justify)$/;var h9=class extends F{static get pluginName(){return`TableCellPropertiesEditing`}static get licenseFeatureCode(){return`TCP`}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}static get requires(){return[f7,t9]}init(){let e=this.editor,t=e.model.schema,n=e.conversion;e.config.define(`table.tableCellProperties.defaultProperties`,{});let r=L5(e.config.get(`table.tableCellProperties.defaultProperties`),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:e.locale.contentLanguageDirection===`rtl`});e.data.addStyleProcessorRules(Mm),Cre(e,{color:r.borderColor,style:r.borderStyle,width:r.borderWidth}),e.commands.add(`tableCellBorderStyle`,new s9(e,r.borderStyle)),e.commands.add(`tableCellBorderColor`,new c9(e,r.borderColor)),e.commands.add(`tableCellBorderWidth`,new l9(e,r.borderWidth)),I8(t,n,{modelAttribute:`tableCellHeight`,styleName:`height`,attributeName:`height`,attributeType:`length`,defaultValue:r.height}),e.commands.add(`tableCellHeight`,new r9(e,r.height)),e.data.addStyleProcessorRules(Gm),I8(t,n,{modelAttribute:`tableCellPadding`,styleName:`padding`,reduceBoxSides:!0,defaultValue:r.padding}),Ore(e,r.padding),e.commands.add(`tableCellPadding`,new n9(e,r.padding)),e.data.addStyleProcessorRules(hm),I8(t,n,{modelAttribute:`tableCellBackgroundColor`,styleName:`background-color`,attributeName:`bgcolor`,attributeType:`color`,defaultValue:r.backgroundColor}),e.commands.add(`tableCellBackgroundColor`,new i9(e,r.backgroundColor)),wre(t,n,r.horizontalAlignment),Tre(n),e.commands.add(`tableCellHorizontalAlignment`,new o9(e,r.horizontalAlignment)),Ere(t,n,r.verticalAlignment),e.commands.add(`tableCellVerticalAlignment`,new a9(e,r.verticalAlignment)),Dre(e),e.commands.add(`tableCellType`,new u9(e))}};function Cre(e,t){let{conversion:n}=e,{schema:r}=e.model,i={width:`tableCellBorderWidth`,color:`tableCellBorderColor`,style:`tableCellBorderStyle`};r.extend(`tableCell`,{allowAttributes:Object.values(i)});for(let e of Object.values(i))r.setAttributeProperties(e,{isFormatting:!0});S8(e,`td`,i,t),S8(e,`th`,i,t),C8(n,{modelElement:`tableCell`,modelAttribute:i.style,styleName:`border-style`}),C8(n,{modelElement:`tableCell`,modelAttribute:i.color,styleName:`border-color`}),C8(n,{modelElement:`tableCell`,modelAttribute:i.width,styleName:`border-width`})}function wre(e,t,n){e.extend(`tableCell`,{allowAttributes:[`tableCellHorizontalAlignment`]}),e.setAttributeProperties(`tableCellHorizontalAlignment`,{isFormatting:!0}),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":m9}},model:{key:`tableCellHorizontalAlignment`,value:(e,t,r)=>{let i=T8(n,`left`,r),a=e.getStyle(`text-align`);if(a!==i)return a;t.consumable.consume(e,{styles:`text-align`})}}})}function Tre(e){e.for(`upcast`).add(e=>{let n=new Po({name:/^(td|th)$/,attributes:{align:m9}});e.on(`element`,(e,r,i)=>{if(!n.match(r.viewItem))return;let a=r.modelRange?.start.nodeAfter;if(!a?.is(`element`))return;let o=r.viewItem.getAttribute(`align`);if(i.consumable.consume(r.viewItem,{attributes:[`align`]}))for(let e of a.getChildren())e.is(`element`)&&t(e,o,i)},{priority:`low`})});function t(e,t,{schema:n,writer:r}){let i=n.getDefinition(e);if(i)for(let a of i.allowAttributes){if(e.hasAttribute(a))continue;let{blockAlignment:i}=n.getAttributeProperties(a);if(!i)continue;let o=(typeof i==`function`?i(e):i)[t];o&&!o.isDefault&&r.setAttribute(a,o.value,e);return}}}function Ere(e,t,n){e.extend(`tableCell`,{allowAttributes:[`tableCellVerticalAlignment`]}),e.setAttributeProperties(`tableCellVerticalAlignment`,{isFormatting:!0}),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":p9}},model:{key:`tableCellVerticalAlignment`,value:(e,t,r)=>{let i=T8(n,`middle`,r),a=e.getStyle(`vertical-align`);if(a!==i)return a;t.consumable.consume(e,{styles:`vertical-align`})}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{valign:p9}},model:{key:`tableCellVerticalAlignment`,value:(e,t,r)=>{let i=T8(n,`middle`,r),a=e.getAttribute(`valign`);if(a!==i)return a;t.consumable.consume(e,{attributes:`valign`})}}})}function Dre(e){let{model:t,conversion:n,editing:r,config:i}=e,{schema:a}=t;i.define(`table.tableCellProperties.scopedHeaders`,!0);let o=!!i.get(`table.tableCellProperties.scopedHeaders`),s=e.plugins.get(O5);a.extend(`tableCell`,{allowAttributes:[`tableCellType`]}),a.setAttributeProperties(`tableCellType`,{isFormatting:!0}),a.addAttributeCheck(e=>{if(Array.from(e).reverse().find(e=>e.name===`table`)?.getAttribute(`tableType`)===`layout`)return!1},`tableCellType`),n.for(`upcast`).add(e=>{e.on(`element:th`,(e,t,n)=>{let{writer:r}=n,{modelRange:i}=t,a=i?.start.nodeAfter;a?.is(`element`,`tableCell`)&&!a.hasAttribute(`tableCellType`)&&r.setAttribute(`tableCellType`,`header`,a)}),e.on(`element:table`,(e,t,n)=>{let{writer:r}=n,{modelRange:i}=t,a=i?.start.nodeAfter;if(a?.is(`element`,`table`)&&a.getAttribute(`tableType`)===`layout`){for(let{cell:e}of new $(a))if(M8(e.getAttribute(`tableCellType`))){r.setAttribute(`tableType`,`content`,a);break}}},{priority:ge.low-1})}),o&&(n.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`}}}}),n.for(`upcast`).add(e=>{e.on(`element:th`,(e,t,n)=>{let{writer:r,consumable:i}=n,{viewItem:a,modelRange:o}=t,s=o?.start.nodeAfter;if(s&&s.getAttribute(`tableCellType`)===`header`&&i.consume(a,{attributes:[`scope`]}))switch(a.getAttribute(`scope`)){case`row`:r.setAttribute(`tableCellType`,`header-row`,s);break;case`col`:r.setAttribute(`tableCellType`,`header-column`,s);break}})})),t.document.registerPostFixer(e=>{let n=t.document.differ.getChanges(),r=new Set;for(let e of n){if(e.type===`attribute`&&(e.attributeKey===`headingRows`||e.attributeKey===`headingColumns`)){let t=e.range.start.nodeAfter;t?.is(`element`,`table`)&&t.root.rootName!==`$graveyard`&&r.add(t)}if(e.type===`attribute`&&e.attributeKey===`tableCellType`){let t=e.range.start.nodeAfter;if(t?.is(`element`,`tableCell`)&&t.root.rootName!==`$graveyard`){let e=t.findAncestor(`table`);e&&r.add(e)}}if(e.type===`insert`&&e.position.nodeAfter){for(let{item:n}of t.createRangeOn(e.position.nodeAfter))if(n.is(`element`,`tableCell`)&&n.getAttribute(`tableCellType`)&&n.root.rootName!==`$graveyard`){let e=n.findAncestor(`table`);e&&r.add(e)}}}return d9(s,e,r)}),t.document.on(`change:data`,()=>{let{differ:e}=t.document,n=new Set;for(let t of e.getChanges())if(t.type===`attribute`&&t.attributeKey===`tableCellType`){let e=t.range.start.nodeAfter;e.is(`element`,`tableCell`)&&n.add(e)}for(let e of n){let t=r.mapper.toViewElement(e),n=M8(e.getAttribute(`tableCellType`))?`th`:`td`;t?.name!==n&&r.reconvertItem(e)}})}function Ore(e,t){D8(e,`td`,t),D8(e,`th`,t)}var kre=class extends F{static get pluginName(){return`TableCellProperties`}static get isOfficialPlugin(){return!0}static get requires(){return[h9,Q7]}},g9=class extends F{static get pluginName(){return`TableLayoutUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=this.editor.t;e.ui.componentFactory.add(`insertTableLayout`,n=>{let r=e.commands.get(`insertTableLayout`),i=Nx(n);i.bind(`isEnabled`).to(r),i.buttonView.set({icon:Sy,label:t(`Insert table layout`),tooltip:!0});let a;return i.on(`change:isOpen`,()=>{a||(a=new m7(n),i.panelView.children.add(a),a.delegate(`execute`).to(i),i.on(`execute`,()=>{e.execute(`insertTableLayout`,{rows:a.rows,columns:a.columns}),e.editing.view.focus()}))}),i}),e.ui.componentFactory.add(`menuBar:insertTableLayout`,n=>{let r=e.commands.get(`insertTableLayout`),i=new uw(n),a=new m7(n);return a.delegate(`execute`).to(i),i.on(`change:isOpen`,(e,t,n)=>{n||a.reset()}),a.on(`execute`,()=>{e.execute(`insertTableLayout`,{rows:a.rows,columns:a.columns}),e.editing.view.focus()}),i.buttonView.set({label:t(`Table layout`),icon:Sy}),i.panelView.children.add(a),i.bind(`isEnabled`).to(r),i}),e.ui.componentFactory.add(`tableType`,()=>{let e=this.editor,t=e.t,n=new cx(e.locale);return n.set({label:t(`Table type`),icon:yy,tooltip:!0}),_9(e,n)})}afterInit(){let{editor:e}=this,{ui:t,plugins:n}=e;if(!e.plugins.has(`TablePropertiesUI`))return;let r=n.get(`TablePropertiesUI`);t.componentFactory.add(`tableProperties`,t=>_9(e,new Mx(t,r._createTablePropertiesButton())))}};function _9(e,t){let n=e.t,r=e.locale,i=e.commands.get(`tableType`),a=Nx(r,t);return Lx(a,Are(e),{ariaLabel:n(`Table type options`),role:`menu`}),t.tooltip=n(`Choose table type`),a.on(`execute`,e=>{let t=e.source.tableType;t&&i.execute(t)}),a}function Are(e){let t=e.t,n=e.commands.get(`tableType`),r=new Fi;return r.add(v9(n,`layout`,t(`Layout table`))),r.add(v9(n,`content`,t(`Content table`))),r}function v9(e,t,n){let r=new RC({label:n,role:`menuitemradio`,withText:!0,tableType:t});return r.bind(`isEnabled`).to(e,`isEnabled`),r.bind(`isOn`).to(e,`value`,e=>e===t),{type:`button`,model:r}}var y9=class extends I{refresh(){let e=this.editor.model,t=e.document.selection,n=e.schema;this.isEnabled=jre(t,n)}execute(e={}){let t=this.editor,n=t.model,r=t.plugins.get(`TableUtils`);n.change(i=>{let a={rows:e.rows||2,columns:e.columns||2},o=r.createTable(i,a);i.setAttribute(`tableType`,`layout`,o),n.insertObject(o,null,null,{findOptimalPosition:`auto`});let s=`${100/a.columns}%`,c=Array(a.columns).fill(s);t.commands.get(`resizeColumnWidths`).execute({tableWidth:`100%`,columnWidths:c,table:o}),i.setSelection(i.createPositionAt(o.getNodeByPath([0,0,0]),0))})}};function jre(e,t){let n=e.getFirstPosition().parent,r=n===n.root?n:n.parent;return t.checkChild(r,`table`)}var b9=class extends I{refresh(){this.isEnabled=!0}execute(e={}){let{model:t,plugins:n}=this.editor,{table:r=t.document.selection.getSelectedElement(),columnWidths:i,tableWidth:a}=e;i&&=Array.isArray(i)?i:i.split(`,`),t.change(e=>{a?e.setAttribute(`tableWidth`,a,r):e.removeAttribute(`tableWidth`,r);let t=n.get(`TableColumnResizeEditing`).getColumnGroupElement(r);if(!i&&!t)return;if(!i)return e.remove(t);let o=x5(i);if(t)Array.from(t.getChildren()).forEach((t,n)=>e.setAttribute(`columnWidth`,o[n],t));else{let t=e.createElement(`tableColumnGroup`);o.forEach(n=>e.appendElement(`tableColumn`,{columnWidth:n},t)),e.append(t,r)}})}};function x9(e){return t=>t.on(`element:colgroup`,(t,n,r)=>{let i=n.modelCursor.findAncestor(`table`),a=w5(i);if(!a)return;let o=T5(a),s=e.getColumns(i),c=D5(a,r.writer);c=Array.from({length:s},(e,t)=>c[t]||`auto`),(c.length!=o.length||c.includes(`auto`))&&C5(o,a,x5(c),r.writer)},{priority:`low`})}function S9(){return e=>e.on(`insert:table`,(e,t,n)=>{let r=n.writer,i=t.item,a=n.mapper.toViewElement(i),o=a.is(`element`,`table`)?a:Array.from(a.getChildren()).find(e=>e.is(`element`,`table`));w5(i)?r.addClass(`ck-table-resized`,o):r.removeClass(`ck-table-resized`,o)},{priority:`low`})}function Mre(){return e=>{e.on(`element:table`,(e,t,n)=>{n.consumable.consume(t.viewItem,{classes:`ck-table-resized`})})}}const C9=Wr(`px`);var w9=class extends F{_isResizingActive;_resizingData;_domEmitter;_tableUtilsPlugin;_initialMouseEventData=null;static get requires(){return[f7,O5]}static get pluginName(){return`TableColumnResizeEditing`}static get licenseFeatureCode(){return`TCR`}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}constructor(e){super(e),this._isResizingActive=!1,this.set(`_isResizingAllowed`,!0),this._resizingData=null,this._domEmitter=new(br()),this._tableUtilsPlugin=e.plugins.get(`TableUtils`),this.on(`change:_isResizingAllowed`,(t,n,r)=>{let i=r?`removeClass`:`addClass`;e.editing.view.change(t=>{for(let n of e.editing.view.document.roots)t[i](`ck-column-resize_disabled`,e.editing.view.document.getRoot(n.rootName))})})}init(){this._extendSchema(),this._registerPostFixer(),this._registerConverters(),this._registerResizingListeners(),this._registerResizerInserter();let e=this.editor,t=e.plugins.get(`TableColumnResize`);e.plugins.get(`TableEditing`).registerAdditionalSlot({filter:e=>e.is(`element`,`tableColumnGroup`),positionOffset:0});let n=new b9(e);e.commands.add(`resizeTableWidth`,n),e.commands.add(`resizeColumnWidths`,n),this.bind(`_isResizingAllowed`).to(e,`isReadOnly`,t,`isEnabled`,n,`isEnabled`,(e,t,n)=>!e&&t&&n)}destroy(){this._domEmitter.stopListening(),super.destroy()}getColumnGroupElement(e){return w5(e)}getTableColumnElements(e){return T5(e)}getTableColumnsWidths(e){return E5(e)}_extendSchema(){let e=this.editor.model.schema;e.extend(`table`,{allowAttributes:[`tableWidth`]}),e.register(`tableColumnGroup`,{allowIn:`table`,isLimit:!0}),e.register(`tableColumn`,{allowIn:`tableColumnGroup`,allowAttributes:[`columnWidth`,`colSpan`],isLimit:!0}),e.setAttributeProperties(`columnWidth`,{isFormatting:!0})}_registerPostFixer(){let e=this.editor.model;e.document.registerPostFixer(n=>{let r=!1;for(let i of d5(e)){let e=this.getColumnGroupElement(i),a=this.getTableColumnElements(e),o=this.getTableColumnsWidths(e),s=x5(o);s=t(s,i,this),!$t(o,s)&&(C5(a,e,s,n),r=!0)}return r});function t(e,t,r){let i=r._tableUtilsPlugin.getColumns(t);if(i-e.length===0)return e;let a=e.map(e=>Number(e.replace(`%`,``))),o=n(r.editor.model.document.differ,t);for(let e of o){let n=i-a.length;if(n===0)continue;let o=n>0,s=r._tableUtilsPlugin.getCellLocation(e).column;if(o){let e=y5(n,f5(t,r.editor));a.splice(s,0,...e)}else{let e=a.splice(s,Math.abs(n));a[s]+=b5(e)}}return a.map(e=>e+`%`)}function n(e,t){let n=new Set;for(let r of e.getChanges())if(r.type==`insert`&&r.position.nodeAfter&&r.position.nodeAfter.name==`tableCell`&&r.position.nodeAfter.getAncestors().includes(t))n.add(r.position.nodeAfter);else if(r.type==`remove`){let e=r.position.nodeBefore||r.position.nodeAfter;e.name==`tableCell`&&e.getAncestors().includes(t)&&n.add(e)}return n}}_registerConverters(){let 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(S9()),e.for(`upcast`).add(Mre()),e.for(`upcast`).add(x9(this._tableUtilsPlugin)),e.for(`upcast`).attributeToAttribute({view:{name:`col`,styles:{width:/.*/}},model:{key:`columnWidth`,value:e=>{let t=e.getStyle(`width`);return!t||!t.endsWith(`%`)&&!t.endsWith(`pt`)?`auto`:t}}}),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(){let e=this.editor.editing.view;e.addObserver(S7),e.document.on(`mouseover`,this._onMouseOverHandler.bind(this),{priority:`high`}),e.document.on(`mousedown`,this._onMouseDownHandler.bind(this),{priority:`high`}),e.document.on(`mouseout`,this._onMouseOutHandler.bind(this),{priority:`high`}),this._domEmitter.listenTo(u.window.document,`mousemove`,qt(this._onMouseMoveHandler.bind(this),50)),this._domEmitter.listenTo(u.window.document,`mouseup`,this._onMouseUpHandler.bind(this))}_recalculateResizerElement(e){let t=this.editor,n=t.editing.view.domConverter,r=n.mapViewToDom(e.findAncestor(`table`)),i=n.mapViewToDom(e.findAncestor(e=>[`td`,`th`].includes(e.name))),a=new O(r),o=new O(i),s=C9(Number((a.top-o.top).toFixed(4))),c=C9(Number((o.bottom-a.bottom).toFixed(4)));t.editing.view.change(t=>{t.setStyle(`top`,s,e),t.setStyle(`bottom`,c,e)})}_resetResizerStyles(e){this.editor.editing.view.change(t=>{t.removeStyle(`top`,e),t.removeStyle(`bottom`,e)})}_onMouseOverHandler(e,t){let n=t.target;n.hasClass(`ck-table-column-resizer`)&&this._isResizingAllowed&&this._recalculateResizerElement(n)}_onMouseOutHandler(e,t){let n=t.target;n.hasClass(`ck-table-column-resizer`)&&this._isResizingAllowed&&(this._isResizingActive||this._resetResizerStyles(n))}_onMouseDownHandler(e,t){let n=t.target;if(!n.hasClass(`ck-table-column-resizer`)||!this._isResizingAllowed)return;let r=this.editor,i=r.editing.mapper.toModelElement(n.findAncestor(`figure`));r.model.canEditAt(i)&&(t.preventDefault(),e.stop(),this._initialMouseEventData=t)}_startResizingAfterThreshold(){let e=this._initialMouseEventData,{target:t}=e,n=this.editor.editing.mapper.toModelElement(t.findAncestor(`figure`)),r=t.findAncestor(`table`),i=a(n,this._tableUtilsPlugin,this.editor);Array.from(r.getChildren()).find(e=>e.is(`element`,`colgroup`))||this.editor.editing.view.change(e=>{o(e,i,r)}),this._isResizingActive=!0,this._resizingData=this._getResizingData(e,i),this.editor.editing.view.change(e=>s(e,r,this._resizingData));function a(e,t,n){let r=Array(t.getColumns(e)),i=new $(e);for(let e of i){let t=n.editing.mapper.toViewElement(e.cell),i=S5(n.editing.view.domConverter.mapViewToDom(t));(!r[e.column]||i<r[e.column])&&(r[e.column]=_5(i))}return r}function o(e,t,n){let r=e.createContainerElement(`colgroup`);for(let n=0;n<t.length;n++){let i=e.createEmptyElement(`col`),a=`${_5(t[n]/b5(t)*100)}%`;e.setStyle(`width`,a,i),e.insert(e.createPositionAt(r,`end`),i)}e.insert(e.createPositionAt(n,0),r)}function s(e,t,n){let r=n.widths.viewFigureWidth/n.widths.viewFigureParentWidth;e.addClass(`ck-table-resized`,t),e.addClass(`ck-table-column-resizer__active`,n.elements.viewResizer),e.setStyle(`width`,`${_5(r*100)}%`,t.findAncestor(`figure`))}}_onMouseMoveHandler(e,t){if(this._initialMouseEventData){let e=this._initialMouseEventData.domEvent;if(Math.abs(t.clientX-e.clientX)>=3)this._startResizingAfterThreshold(),this._initialMouseEventData=null;else return}if(!this._isResizingActive)return;if(!this._isResizingAllowed){this._onMouseUpHandler();return}let{columnPosition:n,flags:{isRightEdge:r,isTableCentered:i,isLtrContent:a},elements:{viewFigure:o,viewLeftColumn:s,viewRightColumn:c,viewResizer:l},widths:{viewFigureParentWidth:u,tableWidth:d,leftColumnWidth:f,rightColumnWidth:p}}=this._resizingData,m=-f+40,h=r?u-d:p-40,g=(a?1:-1)*(r&&i?2:1),_=v5((t.clientX-n)*g,Math.min(m,0),Math.max(h,0));_!==0&&(this.editor.editing.view.change(e=>{let t=_5((f+_)*100/d);if(e.setStyle(`width`,`${t}%`,s),r){let t=_5((d+_)*100/u);e.setStyle(`width`,`${t}%`,o)}else{let t=_5((p-_)*100/d);e.setStyle(`width`,`${t}%`,c)}}),this._recalculateResizerElement(l))}_onMouseUpHandler(){if(this._initialMouseEventData=null,!this._isResizingActive)return;let{viewResizer:e,modelTable:t,viewFigure:n,viewColgroup:r}=this._resizingData.elements,i=this.editor,a=i.editing.view,o=this.getColumnGroupElement(t),s=Array.from(r.getChildren()).filter(e=>e.is(`view:element`)),c=o?this.getTableColumnsWidths(o):null,l=s.map(e=>e.getStyle(`width`)),u=!$t(c,l),d=t.getAttribute(`tableWidth`),f=n.getStyle(`width`),p=d!==f;(u||p)&&(this._isResizingAllowed?i.execute(`resizeTableWidth`,{table:t,tableWidth:`${_5(f)}%`,columnWidths:l}):a.change(e=>{if(c)for(let t of s)e.setStyle(`width`,c.shift(),t);else e.remove(r);p&&(d?e.setStyle(`width`,d,n):e.removeStyle(`width`,n)),!c&&!d&&e.removeClass(`ck-table-resized`,[...n.getChildren()].find(e=>e.name===`table`))})),a.change(t=>{t.removeClass(`ck-table-column-resizer__active`,e)}),a.domConverter.mapViewToDom(e).matches(`:hover`)||this._resetResizerStyles(e),this._isResizingActive=!1,this._resizingData=null}_getResizingData(e,t){let n=this.editor,r=e.domEvent.clientX,i=e.target,a=i.findAncestor(`td`)||i.findAncestor(`th`),o=n.editing.mapper.toModelElement(a),s=o.findAncestor(`table`),c=g5(o,this._tableUtilsPlugin).rightEdge,l=this._tableUtilsPlugin.getColumns(s)-1,u=s.getAttribute(`tableAlignment`);s.getAttribute(`tableType`)!==`layout`&&(u||=n.config.get(`table.tableProperties.defaultProperties.alignment`),u||=`center`);let d=c===l,f=n.locale.contentLanguageDirection!==`rtl`,p=u===`center`,m=a.findAncestor(`table`),h=m.findAncestor(`figure`),g=[...m.getChildren()].find(e=>e.is(`element`,`colgroup`)),_=g.getChild(c),v=d?void 0:g.getChild(c+1),y=h5(n.editing.view.domConverter.mapViewToDom(h.parent)),ee=h5(n.editing.view.domConverter.mapViewToDom(h)),b=p5(s,n),x=t[c],te=d?void 0:t[c+1];return{columnPosition:r,flags:{isRightEdge:d,isTableCentered:p,isLtrContent:f},elements:{viewResizer:i,modelTable:s,viewFigure:h,viewColgroup:g,viewLeftColumn:_,viewRightColumn:v},widths:{viewFigureParentWidth:y,viewFigureWidth:ee,tableWidth:b,leftColumnWidth:x,rightColumnWidth:te}}}_registerResizerInserter(){this.editor.conversion.for(`editingDowncast`).add(e=>{e.on(`insert:tableCell`,(e,t,n)=>{let r=t.item,i=n.mapper.toViewElement(r),a=n.writer;a.insert(a.createPositionAt(i,`end`),a.createUIElement(`div`,{class:`ck-table-column-resizer`}))},{priority:`lowest`})})}},T9=class extends F{static get requires(){return[w9,t9]}static get pluginName(){return`TableColumnResize`}static get isOfficialPlugin(){return!0}},E9=class extends I{refresh(){let e=this.editor.model.document.selection,t=L8(e);t?(this.isEnabled=!0,this.value=t.getAttribute(`tableType`)):(this.isEnabled=!1,this.value=null)}execute(e){let t=this.editor.model,n=t.document.selection,r=L8(n);r.getAttribute(`tableType`)!==e&&t.change(n=>{n.setAttribute(`tableType`,e,r),t.schema.removeDisallowedAttributes([r],n);let i=r.getChildren();for(let e of i)t.schema.checkChild(r,e)||n.remove(e)})}};const Nre=[`content`,`layout`];var D9=class extends F{static get pluginName(){return`TableLayoutEditing`}static get licenseFeatureCode(){return`TL`}static get requires(){return[T9]}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}init(){this._defineSchema(),this._defineConverters(),this._defineClipboardPasteHandlers(),this._registerTableTypeAttributePostfixer(),this.editor.commands.add(`insertTableLayout`,new y9(this.editor)),this.editor.commands.add(`tableType`,new E9(this.editor))}_defineSchema(){let{schema:e}=this.editor.model;e.extend(`table`,{allowAttributes:`tableType`}),e.addChildCheck(k9,`caption`),e.addAttributeCheck(k9,`headingRows`),e.addAttributeCheck(k9,`headingColumns`),e.addAttributeCheck(k9,`footerRows`)}_defineConverters(){let{editor:e}=this,{conversion:t}=e,n=e.config.get(`table.tableLayout.preferredExternalTableType`);t.for(`upcast`).add(Pre(e,n)),t.for(`dataDowncast`).add(Fre()),t.for(`editingDowncast`).attributeToAttribute({model:{key:`tableType`,values:[`layout`,`content`]},view:{layout:{key:`class`,value:[`layout-table`]},content:{key:`class`,value:[`content-table`]}}})}_defineClipboardPasteHandlers(){let{plugins:e}=this.editor;if(!e.has(`ClipboardPipeline`))return;let t=e.get(`ClipboardPipeline`);this.listenTo(t,`contentInsertion`,(e,t)=>{t.sourceEditorId||this.editor.model.change(e=>{for(let{item:n}of e.createRangeIn(t.content))n.is(`element`,`table`)&&e.setAttribute(`tableType`,`content`,n)})})}_registerTableTypeAttributePostfixer(){let e=this.editor;e.model.document.registerPostFixer(t=>{let n=e.model.document.differ.getChanges(),r=!1;for(let i of n){if(i.type==`insert`&&i.name!=`$text`){let e=i.position.nodeAfter,n=t.createRangeOn(e);for(let e of n.getItems())e.is(`element`,`table`)&&!e.hasAttribute(`tableType`)&&(t.setAttribute(`tableType`,`content`,e),r=!0)}if(i.type==`attribute`&&i.attributeKey==`tableType`){for(let n of i.range.getItems())if(n.is(`element`,`table`)){e.model.schema.removeDisallowedAttributes([n],t);let i=n.getChildren();for(let a of i)e.model.schema.checkChild(n,a)||(t.remove(a),r=!0)}}}return r})}};function Pre(e,t){return e=>{e.on(`element:table`,(e,n,r)=>{let i=n.viewItem;if(!r.consumable.test(i,{name:!0})||O9(i,t)==`content`)return;let a=r.writer.createElement(`table`,{tableType:`layout`});if(r.safeInsert(a,n.modelCursor)){r.consumable.consume(i,{name:!0}),r.consumable.consume(i,{attributes:[`role`]}),r.consumable.consume(i,{classes:[`layout-table`]}),i.getAttribute(`border`)===`0`&&r.consumable.consume(i,{attributes:[`border`]});for(let e of i.getChildren())if(e.is(`element`))for(let t of e.getChildren())t.is(`element`,`tr`)&&r.convertItem(t,r.writer.createPositionAt(a,`end`));if(r.convertChildren(i,r.writer.createPositionAt(a,`end`)),a.isEmpty){let e=r.writer.createElement(`tableRow`);r.writer.insert(e,r.writer.createPositionAt(a,`end`)),P8(r.writer,r.writer.createPositionAt(e,`end`))}r.updateConversionResult(a,n)}},{priority:`high`}),e.on(`element:table`,(e,n,r)=>{let{viewItem:i,modelRange:a}=n;a&&(r.writer.setAttribute(`tableType`,O9(i,t),a),r.consumable.consume(i,{classes:[`layout-table`]}),r.consumable.consume(i,{classes:[`content-table`]}))},{priority:`low`})}}function Fre(){return e=>e.on(`attribute:tableType:table`,(e,t,n)=>{let{item:r,attributeNewValue:i}=t,{mapper:a,writer:o}=n;if(!n.consumable.test(r,e.name))return;let s=a.toViewElement(r);o.addClass(`${i}-table`,s),i==`layout`&&o.setAttribute(`role`,`presentation`,s),n.consumable.consume(r,e.name)})}function O9(e,t){return e.hasClass(`content-table`)?`content`:e.hasClass(`layout-table`)?`layout`:t&&Nre.includes(t)?t:e.parent.is(`element`,`figure`)||Array.from(e.getChildren()).some(e=>e.is(`element`,`caption`))?`content`:`layout`}function k9(e){if(e.endsWith(`table`)&&e.last.getAttribute(`tableType`)==`layout`)return!1}var Ire=class extends F{static get pluginName(){return`TableLayout`}static get isOfficialPlugin(){return!0}static get requires(){return[T9,D9,g9]}},A9=class extends I{attributeName;_defaultValue;_defaultContentTableValue;_defaultLayoutTableValue;constructor(e,t,n){super(e),this.attributeName=t,this._defaultContentTableValue=n,this._defaultLayoutTableValue=t===`tableBorderStyle`?`none`:void 0}refresh(){let e=this.editor.model.document.selection,t=L8(e);this._defaultValue=!t||t.getAttribute(`tableType`)!==`layout`?this._defaultContentTableValue:this._defaultLayoutTableValue,this.isEnabled=!!t,this.value=this._getValue(t)}execute(e={}){let t=this.editor.model,n=t.document.selection,{value:r,batch:i}=e,a=L8(n),o=this._getValueToSet(r);t.enqueueChange(i,e=>{o?e.setAttribute(this.attributeName,o,a):e.removeAttribute(this.attributeName,a)})}_getValue(e){if(!e)return;let t=e.getAttribute(this.attributeName);if(t!==this._defaultValue)return t}_getValueToSet(e){if(e!==this._defaultValue)return e}},j9=class extends A9{constructor(e,t){super(e,`tableBackgroundColor`,t)}},M9=class extends A9{constructor(e,t){super(e,`tableBorderColor`,t)}_getValue(e){if(!e)return;let t=N5(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}},N9=class extends A9{constructor(e,t){super(e,`tableBorderStyle`,t)}_getValue(e){if(!e)return;let t=N5(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}},P9=class extends A9{constructor(e,t){super(e,`tableBorderWidth`,t)}_getValue(e){if(!e)return;let t=N5(e.getAttribute(this.attributeName));if(t!==this._defaultValue)return t}_getValueToSet(e){let t=P5(e,`px`);if(t!==this._defaultValue)return t}},F9=class extends A9{constructor(e,t){super(e,`tableWidth`,t)}_getValueToSet(e){if(e=P5(e,`px`),e!==this._defaultValue)return e}},I9=class extends A9{constructor(e,t){super(e,`tableHeight`,t)}_getValueToSet(e){if(e=P5(e,`px`),e!==this._defaultValue)return e}},L9=class extends A9{constructor(e,t){super(e,`tableAlignment`,t)}},R9=class extends F{static get pluginName(){return`TablePropertiesEditing`}static get licenseFeatureCode(){return`TCP`}static get isOfficialPlugin(){return!0}static get isPremiumPlugin(){return!0}static get requires(){return[f7]}init(){let e=this.editor,t=e.model.schema,n=e.conversion;e.config.define(`table.tableProperties.defaultProperties`,{});let r=I5(e.config.get(`table.tableProperties.defaultProperties`),{includeAlignmentProperty:!0}),i=e.config.get(`table.tableProperties.alignment.useInlineStyles`)===!0;e.data.addStyleProcessorRules(Wm),e.data.addStyleProcessorRules(Mm),Rre(e,{color:r.borderColor,style:r.borderStyle,width:r.borderWidth}),e.commands.add(`tableBorderColor`,new M9(e,r.borderColor)),e.commands.add(`tableBorderStyle`,new N9(e,r.borderStyle)),e.commands.add(`tableBorderWidth`,new P9(e,r.borderWidth)),zre(t,n,r.alignment,i),e.commands.add(`tableAlignment`,new L9(e,r.alignment)),B9(t,n,{modelAttribute:`tableWidth`,styleName:`width`,attributeName:`width`,attributeType:`length`,defaultValue:r.width}),e.commands.add(`tableWidth`,new F9(e,r.width)),B9(t,n,{modelAttribute:`tableHeight`,styleName:`height`,attributeName:`height`,attributeType:`length`,defaultValue:r.height}),e.commands.add(`tableHeight`,new I9(e,r.height)),e.data.addStyleProcessorRules(hm),Hre(t,n,{modelAttribute:`tableBackgroundColor`,styleName:`background-color`,attributeName:`bgcolor`,attributeType:`color`,defaultValue:r.backgroundColor}),e.commands.add(`tableBackgroundColor`,new j9(e,r.backgroundColor)),D8(e,`table`);let a=e.editing.view.document;this.listenTo(a,`clipboardOutput`,(t,n)=>{e.editing.view.change(e=>{for(let{item:t}of e.createRangeIn(n.content))Lre(t,e);n.dataTransfer.setData(`text/html`,this.editor.data.htmlProcessor.toData(n.content))})},{priority:`lowest`})}};function Lre(e,t){if(!e.is(`element`,`table`))return;let n=e.getAttribute(`align`),r=e.getStyle(`float`),i=e.getStyle(`margin-left`),a=e.getStyle(`margin-right`);if(n&&n===`center`||r&&r===`right`&&n&&n===`right`){z9(t,n,e);return}r===void 0&&i===`auto`&&a===`0`&&z9(t,`right`,e)}function z9(e,t,n){let r=e.createPositionBefore(n),i=e.createContainerElement(`div`,{align:t},n);e.insert(r,i)}function Rre(e,t){let{conversion:n}=e,{schema:r}=e.model,i={width:`tableBorderWidth`,color:`tableBorderColor`,style:`tableBorderStyle`};r.extend(`table`,{allowAttributes:Object.values(i)});for(let e of Object.values(i))r.setAttributeProperties(e,{isFormatting:!0});S8(e,`table`,i,t),w8(n,{modelAttribute:i.color,styleName:`border-color`}),w8(n,{modelAttribute:i.style,styleName:`border-style`}),w8(n,{modelAttribute:i.width,styleName:`border-width`})}function zre(e,t,n,r){e.extend(`table`,{allowAttributes:[`tableAlignment`]}),e.setAttributeProperties(`tableAlignment`,{isFormatting:!0,blockAlignment:e=>({left:{value:`blockLeft`},right:{value:`blockRight`},center:{value:`center`,isDefault:e.getAttribute(`tableType`)!==`layout`}})}),t.for(`downcast`).attributeToAttribute({model:{name:`table`,key:`tableAlignment`,values:[`left`,`center`,`right`,`blockLeft`,`blockRight`]},view:{left:r?{key:`style`,value:{float:`left`,"margin-right":`var(--ck-content-table-style-spacing, 1.5em)`}}:{key:`class`,value:O8.left.className},right:r?{key:`style`,value:{float:`right`,"margin-left":`var(--ck-content-table-style-spacing, 1.5em)`}}:{key:`class`,value:O8.right.className},center:r?{key:`style`,value:{"margin-left":`auto`,"margin-right":`auto`}}:{key:`class`,value:O8.center.className},blockLeft:r?{key:`style`,value:{"margin-left":`0`,"margin-right":`auto`}}:{key:`class`,value:O8.blockLeft.className},blockRight:r?{key:`style`,value:{"margin-left":`auto`,"margin-right":`0`}}:{key:`class`,value:O8.blockRight.className}},converterPriority:`high`}),k8.forEach(e=>{t.for(`upcast`).attributeToAttribute({view:e.view,model:{key:`tableAlignment`,value:(t,r,i)=>{if(Ure(t))return;let a=T8(n,``,i),o=e.getAlign(t),s=e.getConsumables(t);if(r.consumable.consume(t,s),o!==a)return o}}})}),t.for(`upcast`).add(Bre(n))}function Bre(e){return t=>{t.on(`element:div`,(t,n,r)=>{if(!r.consumable.test(n.viewItem,{name:!0,attributes:`align`}))return;let i=e5(n.viewItem);if(!i||!r.consumable.test(i,{name:!0}))return;r.consumable.consume(n.viewItem,{name:!0,attributes:`align`});let a=r.convertItem(i,n.modelCursor),o=j(a.modelRange.getItems());if(!o||!o.is(`element`,`table`)){r.consumable.revert(n.viewItem,{name:!0,attributes:`align`}),a.modelRange&&!a.modelRange.isCollapsed&&(n.modelRange=a.modelRange,n.modelCursor=a.modelCursor);return}let s=Vre(n.viewItem.getAttribute(`align`),i.getAttribute(`align`),T8(e,``,n));s&&r.writer.setAttribute(`tableAlignment`,s,o),r.convertChildren(n.viewItem,r.writer.createPositionAt(o,`end`)),r.updateConversionResult(o,n)})}}function Vre(e,t,n){if(e)switch(e){case`right`:return t===`right`?`right`:t===`left`?`left`:`blockRight`;case`center`:return`center`;case`left`:return t===void 0?`blockLeft`:`left`;default:return n}}function Hre(e,t,n){let{modelAttribute:r}=n;e.extend(`table`,{allowAttributes:[r]}),e.setAttributeProperties(r,{isFormatting:!0}),x8(t,{viewElement:`table`,...n}),w8(t,n)}function B9(e,t,n){let{modelAttribute:r}=n;e.extend(`table`,{allowAttributes:[r]}),e.setAttributeProperties(r,{isFormatting:!0}),x8(t,{viewElement:/^(table|figure)$/,shouldUpcast:e=>!(e.name==`table`&&e.parent.name==`figure`||e.name==`figure`&&!e.hasClass(`table`)),...n}),C8(t,{modelElement:`table`,...n})}function Ure(e){return e.name==`figure`&&!e.hasClass(`table`)}var V9=class extends P{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;let{borderStyleDropdown:n,borderWidthInput:r,borderColorInput:i,borderRowLabel:a}=this._createBorderFields(),{backgroundRowLabel:o,backgroundInput:s}=this._createBackgroundFields(),{widthInput:c,operatorLabel:l,heightInput:u,dimensionsLabel:d}=this._createDimensionFields(),{alignmentToolbar:f,alignmentLabel:p}=this._createAlignmentFields();this.focusTracker=new M,this.keystrokes=new N,this.children=this.createCollection(),this.borderStyleDropdown=n,this.borderWidthInput=r,this.borderColorInput=i,this.backgroundInput=s,this.widthInput=c,this.heightInput=u,this.alignmentToolbar=f;let{saveButtonView:m,cancelButtonView:h}=this._createActionButtons();this.saveButtonView=m,this.cancelButtonView=h,this.backButtonView=this._createBackButton(),this._focusables=new pa,this._focusCycler=new Hy({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:`shift + tab`,focusNext:`tab`}});let g=new By(e,{label:this.t(`Table properties`)});g.children.add(this.backButtonView,0),this.children.add(g),this.children.add(new MC(e,{labelView:a,children:[a,n,r,i],class:`ck-table-form__border-row`})),this.children.add(new MC(e,{children:[new MC(e,{labelView:d,children:[d,c,l,u],class:`ck-table-form__dimensions-row`}),new MC(e,{labelView:o,children:[o,s],class:`ck-table-form__background-row`})]})),this.children.add(new MC(e,{labelView:p,children:[p,f],class:`ck-table-properties-form__alignment-row`})),this.children.add(new MC(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(),Qa({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(){let e=this.options.defaultTableProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},n=H7({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),r=this.locale,i=this.t,a=i(`Style`),o=new eo(r);o.text=i(`Border`);let s=N7(i),c=new Qb(r,Zx);c.set({label:a,class:`ck-table-form__border-style`}),c.fieldView.buttonView.set({ariaLabel:a,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:a}),c.fieldView.buttonView.bind(`label`).to(this,`borderStyle`,e=>s[e||`none`]),c.fieldView.on(`execute`,e=>{this.borderStyle=e.source._borderStyleValue}),c.bind(`isEmpty`).to(this,`borderStyle`,e=>!e),Lx(c.fieldView,z7(this,t.style),{role:`menu`,ariaLabel:a});let l=new Qb(r,Jx);l.set({label:i(`Width`),class:`ck-table-form__border-width`}),l.fieldView.bind(`value`).to(this,`borderWidth`),l.bind(`isEnabled`).to(this,`borderStyle`,H9),l.fieldView.on(`input`,()=>{this.borderWidth=l.fieldView.element.value});let u=new Qb(r,n);return u.set({label:i(`Color`),class:`ck-table-form__border-color`}),u.fieldView.bind(`value`).to(this,`borderColor`),u.bind(`isEnabled`).to(this,`borderStyle`,H9),u.fieldView.on(`input`,()=>{this.borderColor=u.fieldView.value}),this.on(`change:borderStyle`,(e,n,r,i)=>{H9(r)||(this.borderColor=``,this.borderWidth=``),H9(i)||(this.borderColor=t.color,this.borderWidth=t.width)}),{borderRowLabel:o,borderStyleDropdown:c,borderColorInput:u,borderWidthInput:l}}_createBackgroundFields(){let e=this.locale,t=this.t,n=new eo(e);n.text=t(`Background`);let r=new Qb(e,H7({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}));return r.set({label:t(`Color`),class:`ck-table-properties-form__background`}),r.fieldView.bind(`value`).to(this,`backgroundColor`),r.fieldView.on(`input`,()=>{this.backgroundColor=r.fieldView.value}),{backgroundRowLabel:n,backgroundInput:r}}_createDimensionFields(){let e=this.locale,t=this.t,n=new eo(e);n.text=t(`Dimensions`);let r=new Qb(e,Jx);r.set({label:t(`Width`),class:`ck-table-form__dimensions-row__width`}),r.fieldView.bind(`value`).to(this,`width`),r.fieldView.on(`input`,()=>{this.width=r.fieldView.element.value});let i=new P(e);i.setTemplate({tag:`span`,attributes:{class:[`ck-table-form__dimension-operator`]},children:[{text:`×`}]});let a=new Qb(e,Jx);return a.set({label:t(`Height`),class:`ck-table-form__dimensions-row__height`}),a.fieldView.bind(`value`).to(this,`height`),a.fieldView.on(`input`,()=>{this.height=a.fieldView.element.value}),{dimensionsLabel:n,widthInput:r,operatorLabel:i,heightInput:a}}_createAlignmentFields(){let e=this.locale,t=this.t,n=new eo(e);n.text=t(`Table Alignment`);let r=new Ox(e);return r.set({role:`radiogroup`,isCompact:!0,ariaLabel:t(`Table alignment toolbar`)}),B7({view:this,icons:{left:xv,center:yv,right:Sv,blockLeft:wv,blockRight:Tv},toolbar:r,labels:this._alignmentLabels,propertyName:`alignment`,defaultValue:this.options.defaultTableProperties.alignment}),{alignmentLabel:n,alignmentToolbar:r}}_createActionButtons(){let e=this.locale,t=this.t,n=new H(e),r=new H(e),i=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return n.set({label:t(`Save`),class:`ck-button-action`,type:`submit`,withText:!0}),n.bind(`isEnabled`).toMany(i,`errorText`,(...e)=>e.every(e=>!e)),r.set({label:t(`Cancel`),withText:!0}),r.delegate(`execute`).to(this,`cancel`),{saveButtonView:n,cancelButtonView:r}}_createBackButton(){let e=this.locale.t,t=new H(this.locale);return t.set({class:`ck-button-back`,label:e(`Back`),icon:Wv,tooltip:!0}),t.delegate(`execute`).to(this,`cancel`),t}get _alignmentLabels(){let e=this.locale,t=this.t,n=t(`Align table to the left with no text wrapping`),r=t(`Align table to the right with no text wrapping`),i=t(`Align table to the left with text wrapping`),a=t(`Center table with no text wrapping`),o=t(`Align table to the right with text wrapping`);return e.uiLanguageDirection===`rtl`?{right:o,left:i,blockRight:r,center:a,blockLeft:n}:{blockLeft:n,center:a,blockRight:r,left:i,right:o}}};function H9(e){return e!==`none`}const U9={borderStyle:`tableBorderStyle`,borderColor:`tableBorderColor`,borderWidth:`tableBorderWidth`,backgroundColor:`tableBackgroundColor`,width:`tableWidth`,height:`tableHeight`,alignment:`tableAlignment`};var W9=class extends F{_defaultContentTableProperties;_defaultLayoutTableProperties;_balloon;view=null;_viewWithContentTableDefaults=null;_viewWithLayoutTableDefaults=null;_undoStepBatch;_isReady;static get requires(){return[BC]}static get pluginName(){return`TablePropertiesUI`}static get isOfficialPlugin(){return!0}constructor(e){super(e),e.config.define(`table.tableProperties`,{borderColors:V7,backgroundColors:V7})}init(){let e=this.editor;this._defaultContentTableProperties=I5(e.config.get(`table.tableProperties.defaultProperties`),{includeAlignmentProperty:!0}),this._defaultLayoutTableProperties=F5(),this._balloon=e.plugins.get(BC),e.ui.componentFactory.add(`tableProperties`,()=>this._createTablePropertiesButton())}_createTablePropertiesButton(){let e=this.editor,t=e.t,n=new H(e.locale);n.set({label:t(`Table properties`),icon:yy,tooltip:!0}),this.listenTo(n,`execute`,()=>this._showView());let r=Object.values(U9).map(t=>e.commands.get(t));return n.bind(`isEnabled`).toMany(r,`isEnabled`,(...e)=>e.some(e=>e)),n}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(e){let t=this.editor,n=t.config.get(`table.tableProperties`),r=Cb(n.borderColors),i=Sb(t.locale,r),a=Cb(n.backgroundColors),o=Sb(t.locale,a),s=n.colorPicker!==!1,c=new V9(t.locale,{borderColors:i,backgroundColors:o,defaultTableProperties:e,colorPickerConfig:s?n.colorPicker||{}:!1}),l=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()}),Ya({emitter:c,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});let u=P7(l),d=F7(l);return c.on(`change:borderStyle`,this._getPropertyChangeCallback(`tableBorderStyle`)),c.on(`change:borderColor`,this._getValidatedPropertyChangeCallback({viewField:c.borderColorInput,commandName:`tableBorderColor`,errorText:u,validator:I7})),c.on(`change:borderWidth`,this._getValidatedPropertyChangeCallback({viewField:c.borderWidthInput,commandName:`tableBorderWidth`,errorText:d,validator:R7})),c.on(`change:backgroundColor`,this._getValidatedPropertyChangeCallback({viewField:c.backgroundInput,commandName:`tableBackgroundColor`,errorText:u,validator:I7})),c.on(`change:width`,this._getValidatedPropertyChangeCallback({viewField:c.widthInput,commandName:`tableWidth`,errorText:d,validator:L7})),c.on(`change:height`,this._getValidatedPropertyChangeCallback({viewField:c.heightInput,commandName:`tableHeight`,errorText:d,validator:L7})),c.on(`change:alignment`,this._getPropertyChangeCallback(`tableAlignment`)),c}_fillViewFormFromCommandValues(){let e=this.editor.commands,t=e.get(`tableBorderStyle`);Object.entries(U9).map(([t,n])=>{let r=t,i=this.view===this._viewWithContentTableDefaults?this._defaultContentTableProperties[r]||``:this._defaultLayoutTableProperties[r]||``;return[r,e.get(n).value||i]}).forEach(([e,n])=>{(e===`borderColor`||e===`borderWidth`)&&t.value===`none`||this.view.set(e,n)}),this._isReady=!0}_showView(){let e=this.editor,t=E7(e.editing.view.document.selection),n=t&&e.editing.mapper.toModelElement(t),r=!n||n.getAttribute(`tableType`)!==`layout`;r&&!this._viewWithContentTableDefaults?this._viewWithContentTableDefaults=this._createPropertiesView(this._defaultContentTableProperties):!r&&!this._viewWithLayoutTableDefaults&&(this._viewWithLayoutTableDefaults=this._createPropertiesView(this._defaultLayoutTableProperties)),this.view=r?this._viewWithContentTableDefaults:this._viewWithLayoutTableDefaults,this.listenTo(e.ui,`update`,()=>{this._updateView()}),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:J7(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){let e=this.editor;this.stopListening(e.ui,`update`),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){let e=this.editor,t=e.editing.view.document;E7(t.selection)?this._isViewVisible&&q7(e,`table`):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,n,r)=>{this._isReady&&this.editor.execute(e,{value:r,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){let{commandName:t,viewField:n,validator:r,errorText:i}=e,a=Kt(()=>{n.errorText=i},500);return(e,i,o)=>{a.cancel(),this._isReady&&(r(o)?(this.editor.execute(t,{value:o,batch:this._undoStepBatch}),n.errorText=null):a())}}},Wre=class extends F{static get pluginName(){return`TableProperties`}static get isOfficialPlugin(){return!0}static get requires(){return[R9,W9]}};function G9(e){e.document.registerPostFixer(t=>Gre(t,e))}function Gre(e,t){let n=t.document.differ.getChanges(),r=!1;for(let t of n){if(t.type!=`insert`)continue;let n=t.position.parent;if(n.is(`element`,`table`)||t.name==`table`){let i=t.name==`table`?t.position.nodeAfter:n,a=Array.from(i.getChildren()).filter(e=>e.is(`element`,`caption`)),o=a.shift();if(!o)continue;for(let t of a)e.move(e.createRangeIn(t),o,`end`),e.remove(t);o.nextSibling&&(e.move(e.createRangeOn(o),i,`end`),r=!0),r=!!a.length||r}}return r}function K9(e){return!!e&&e.is(`element`,`table`)}function q9(e){for(let t of e.getChildren())if(t.is(`element`,`caption`))return t;return null}function J9(e){let t=L8(e);return t?q9(t):null}function Y9(e){let t=e.parent;return e.name==`figcaption`&&t&&t.is(`element`,`figure`)&&t.hasClass(`table`)||e.name==`caption`&&t&&t.is(`element`,`table`)?{name:!0}:null}var X9=class extends I{refresh(){let e=this.editor,t=L8(e.model.document.selection);this.isEnabled=!!t&&e.model.schema.checkChild(t,`caption`),this.isEnabled?this.value=!!q9(t):this.value=!1}execute({focusCaptionOnShow:e=!1}={}){this.editor.model.change(t=>{this.value?this._hideTableCaption(t):this._showTableCaption(t,e)})}_showTableCaption(e,t){let n=this.editor.model,r=L8(n.document.selection),i=this.editor.plugins.get(`TableCaptionEditing`)._getSavedCaption(r)||e.createElement(`caption`);n.insertContent(i,r,`end`),t&&e.setSelection(i,`in`)}_hideTableCaption(e){let t=this.editor.model,n=L8(t.document.selection),r=this.editor.plugins.get(`TableCaptionEditing`),i=q9(n);r._saveCaption(n,i),t.deleteContent(e.createSelection(i,`on`))}},Z9=class extends F{_savedCaptionsMap=new WeakMap;_captionIdsMapping=new WeakMap;static get pluginName(){return`TableCaptionEditing`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.model.schema,n=e.editing.view,r=e.t,i=e.config.get(`table.tableCaption.useCaptionElement`);t.isRegistered(`caption`)?t.extend(`caption`,{allowIn:`table`}):t.register(`caption`,{allowIn:`table`,allowContentOf:`$block`,isLimit:!0}),e.commands.add(`toggleTableCaption`,new X9(this.editor)),i&&e.plugins.get(`TableEditing`).registerAdditionalSlot({filter:e=>e.is(`element`,`caption`),positionOffset:`end`}),e.conversion.for(`upcast`).elementToElement({view:Y9,model:`caption`}),e.conversion.for(`dataDowncast`).elementToElement({model:`caption`,view:(e,{writer:t})=>K9(e.parent)?t.createContainerElement(i?`caption`:`figcaption`):null}),e.conversion.for(`editingDowncast`).elementToElement({model:`caption`,view:(e,{writer:t})=>{if(!K9(e.parent))return null;let a=t.createEditableElement(i?`caption`:`figcaption`);return t.setCustomProperty(`tableCaption`,!0,a),a.placeholder=r(`Enter table caption`),yo({view:n,element:a,keepOnFocus:!0}),YE(a,t)}}),e.conversion.for(`editingDowncast`).add(e=>{e.on(`insert:table`,(e,t,{writer:n,mapper:r})=>{let i=t.item,a=r.toViewElement(i);if(!a)return;let o=Array.from(a.getChildren()).find(e=>e.is(`element`,`table`));if(!o)return;let s=q9(i);if(!s){n.removeAttribute(`aria-labelledby`,o);return}let c=r.toViewElement(s);if(!c)return;let l;l=c.hasAttribute(`id`)?c.getAttribute(`id`):this._captionIdsMapping.get(s)??`ck-editor__caption_${he()}`,this._captionIdsMapping.set(s,l),n.setAttribute(`id`,l,c),n.setAttribute(`aria-labelledby`,l,o)},{priority:`low`})}),G9(e.model)}_getSavedCaption(e){let t=this._savedCaptionsMap.get(e);return t?Ml.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON())}},Q9=class extends F{static get pluginName(){return`TableCaptionUI`}static get isOfficialPlugin(){return!0}init(){let e=this.editor,t=e.editing.view,n=e.t;e.ui.componentFactory.add(`toggleTableCaption`,r=>{let i=e.commands.get(`toggleTableCaption`),a=new H(r);return a.set({icon:c_,tooltip:!0,isToggleable:!0}),a.bind(`isOn`,`isEnabled`).to(i,`value`,`isEnabled`),a.bind(`label`).to(i,`value`,e=>n(e?`Toggle caption off`:`Toggle caption on`)),this.listenTo(a,`execute`,()=>{if(e.execute(`toggleTableCaption`,{focusCaptionOnShow:!0}),i.value){let n=J9(e.model.document.selection),r=e.editing.mapper.toViewElement(n);if(!r)return;t.scrollToTheSelection(),t.change(e=>{e.addClass(`table__caption_highlighted`,r)})}e.editing.view.focus()}),a})}},Kre=class extends F{static get pluginName(){return`TableCaption`}static get isOfficialPlugin(){return!0}static get requires(){return[Z9,Q9]}};function $9(e){if(e.is(`$text`)||e.is(`$textProxy`))return e.data;let t=e,n=``,r=null;for(let e of t.getChildren()){let t=$9(e);r&&r.is(`element`)&&(n+=`
`),n+=t,r=e}return n}var qre=class extends F{_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=p.features.isRegExpUnicodePropertySupported?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!0}static get isPremiumPlugin(){return!0}init(){this.editor.model.document.on(`change:data`,qt(this._refreshStats.bind(this),250)),typeof this._config.onUpdate==`function`&&this.on(`update`,(e,t)=>{this._config.onUpdate(t)}),jn(this._config.container)&&this._config.container.appendChild(this.wordCountContainer)}destroy(){this._outputView&&(this._outputView.element.remove(),this._outputView.destroy()),super.destroy()}get wordCountContainer(){let e=this.editor,t=e.t,n=e.config.get(`wordCount.displayWords`),r=e.config.get(`wordCount.displayCharacters`),i=ga.bind(this,this),a=[];return this._outputView||(this._outputView=new P,(n||n===void 0)&&(this.bind(`_wordsLabel`).to(this,`words`,e=>t(`Words: %0`,e)),a.push({tag:`div`,children:[{text:[i.to(`_wordsLabel`)]}],attributes:{class:`ck-word-count__words`}})),(r||r===void 0)&&(this.bind(`_charactersLabel`).to(this,`characters`,e=>t(`Characters: %0`,e)),a.push({tag:`div`,children:[{text:[i.to(`_charactersLabel`)]}],attributes:{class:`ck-word-count__characters`}})),this._outputView.setTemplate({tag:`div`,attributes:{class:[`ck`,`ck-word-count`]},children:a}),this._outputView.render()),this._outputView.element}_getText(){let e=``;for(let t of this.editor.model.document.getRoots())e!==``&&(e+=`
`),e+=$9(t);return e}_getCharacters(e){return e.replace(/\n/g,``).length}_getWords(e){return(e.match(this._wordsMatchRegExp)||[]).length}_refreshStats(){let e=this._getText(),t=this.words=this._getWords(e),n=this.characters=this._getCharacters(e);this.fire(`update`,{words:t,characters:n})}};export{qh as Accessibility,tb as AccessibilityHelp,to as AccessibilityHelpContentView,Bh as ActionsRecorder,nH as AdjacentListsSupport,Yw as Alignment,Rw as AlignmentCommand,Vw as AlignmentEditing,Jw as AlignmentUI,Ka as AriaLiveAnnouncer,Ga as AriaLiveAnnouncerPoliteness,Ja as AriaLiveAnnouncerRegionView,qa as AriaLiveAnnouncerView,GT as AttributeCommand,Gd as AttributeOperation,$k as AutoImage,Ck as AutoLink,w2 as AutoMediaEmbed,YC as AutocompleteView,zte as Autoformat,FO as AutomaticLinkDecorators,Bte as Autosave,cb as Badge,GN as BalloonEditor,HN as BalloonEditorUI,UN as BalloonEditorUIView,ab as BalloonPanelView,nw as BalloonToolbar,Sw as Base64UploadAdapter,gf as Batch,aw as BlockButtonView,$te as BlockQuote,AE as BlockQuoteCommand,PE as BlockQuoteEditing,FE as BlockQuoteUI,sw as BlockToolbar,nb as BodyCollection,Vte as Bold,qT as BoldEditing,XT as BoldUI,oO as Bookmark,QD as BookmarkEditing,KD as BookmarkFormView,rO as BookmarkUI,OC as BoxedEditorUIView,ps as BubblingEmitterMixin,ls as BubblingEventInfo,Ry as ButtonLabelView,QC as ButtonLabelWithHighlightView,H as ButtonView,$M as CKBox,xM as CKBoxCommand,GM as CKBoxEditing,aN as CKBoxImageEdit,nN as CKBoxImageEditCommand,rN as CKBoxImageEditEditing,iN as CKBoxImageEditUI,sO as CKBoxUI,HM as CKBoxUploadAdapter,VM as CKBoxUtils,w as CKEditorError,uN as CKFinder,sN as CKFinderCommand,lN as CKFinderEditing,oN as CKFinderUI,jw as CKFinderUploadAdapter,xB as CheckTodoListCommand,XN as ClassicEditor,qN as ClassicEditorUI,JN as ClassicEditorUIView,kp as ClickObserver,PO as Clipboard,gO as ClipboardMarkersUtils,lO as ClipboardObserver,_O as ClipboardPipeline,BM as CloudServices,zM as CloudServicesCore,zN as CloudServicesUploadAdapter,Hte as Code,RN as CodeBlock,bN as CodeBlockCommand,jN as CodeBlockEditing,kL as CodeBlockElementSupport,LN as CodeBlockUI,QT as CodeEditing,eE as CodeUI,xb as CollapsibleView,xb as _CollapsibleView,Fi as Collection,Eb as ColorGridView,US as ColorGridsFragmentView,WS as ColorPickerFragmentView,zS as ColorPickerInputRowView,FS as ColorPickerView,GS as ColorSelectorView,Tb as ColorTileView,I as Command,lo as CommandCollection,KS as ComponentFactory,zc as CompositionObserver,hr as Config,po as Context,ho as ContextPlugin,Lh as ContextWatchdog,BC as ContextualBalloon,Dd as Conversion,Fl as ConversionHelpers,Xa as CssTransitionDisablerMixin,oR as CustomElementSupport,ve as DOCUMENTATION_URL,Ed as DataController,SL as DataFilter,bL as DataSchema,tP as DecoupledEditor,QN as DecoupledEditorUI,$N as DecoupledEditorUIView,sC as DefaultMenuBarItems,hT as Delete,oT as DeleteCommand,Qy as Dialog,Ky as DialogActionsView,qy as DialogContentView,Zy as DialogView,Jy as DialogViewPosition,_f as Differ,HS as DocumentColorCollection,br as DomEmitterMixin,jc as DomEventObserver,fl as DowncastDispatcher,Il as DowncastHelpers,OO as DragDrop,OO as _DragDrop,DO as DragDropBlockToolbar,DO as _DragDropBlockToolbar,bO as DragDropTarget,bO as _DragDropTarget,Za as DraggableViewMixin,cx as DropdownButtonView,ux as DropdownMenuButtonView,lx as DropdownMenuListItemButtonView,_x as DropdownMenuListItemView,hx as DropdownMenuListView,bx as DropdownMenuNestedMenuPanelView,xx as DropdownMenuNestedMenuView,gx as DropdownMenuPanelPositioningFunctions,Sx as DropdownMenuRootListView,ox as DropdownPanelView,sx as DropdownView,ML as DualContentModelElementSupport,VN as EasyImage,kC as EditableUIView,Qu as EditingController,go as EditingKeystrokeHandler,qc as EditingView,rg as Editor,TC as EditorUI,DC as EditorUIView,Mh as EditorWatchdog,sg as ElementApiMixin,lr as ElementReplacer,E as EmitterMixin,tne as Emoji,dF as EmojiCategoriesView,lF as EmojiCommand,uF as EmojiGridView,cF as EmojiMention,_F as EmojiPicker,hF as EmojiPickerFormView,mF as EmojiPickerView,aF as EmojiRepository,fF as EmojiSearchView,pF as EmojiToneView,eF as EmojiUtils,gR as EmptyBlock,TE as Enter,SE as EnterCommand,wE as EnterObserver,rne as Essentials,eC as EvaluationBadge,pe as EventInfo,Nc as FakeSelectionObserver,_b as FileDialogButtonView,vb as FileDialogListItemButtonView,yb as FileDialogViewMixin,xw as FileLoader,vw as FileReader,bw as FileRepository,FM as FileUploader,sne as FindAndReplace,PF as FindAndReplaceEditing,CF as FindAndReplaceFormView,EF as FindAndReplaceState,wF as FindAndReplaceUI,NF as FindAndReplaceUtils,TF as FindCommand,jF as FindNextCommand,MF as FindPreviousCommand,OF as FindReplaceCommandBase,Hy as FocusCycler,Ic as FocusObserver,M as FocusTracker,yne as Font,fI as FontBackgroundColor,lI as FontBackgroundColorCommand,uI as FontBackgroundColorEditing,dI as FontBackgroundColorUI,cI as FontColor,iI as FontColorCommand,aI as FontColorEditing,sI as FontColorUI,oI as FontColorUIBase,FF as FontCommand,YF as FontFamily,WF as FontFamilyCommand,qF as FontFamilyEditing,JF as FontFamilyUI,rI as FontSize,XF as FontSizeCommand,tI as FontSizeEditing,nI as FontSizeUI,By as FormHeaderView,MC as FormRowView,pR as FullPage,Sne as Fullscreen,pI as FullscreenAbstractEditorHandler,mI as FullscreenClassicEditorHandler,gI as FullscreenCommand,hI as FullscreenDecoupledEditorHandler,_I as FullscreenEditing,yI as FullscreenUI,cR as GeneralHtmlSupport,wne as Heading,Ene as HeadingButtonsUI,wI as HeadingCommand,DI as HeadingEditing,NL as HeadingElementSupport,kI as HeadingUI,VI as Highlight,FI as HighlightCommand,II as HighlightEditing,RI as HighlightUI,XC as HighlightedTextView,Sf as History,JI as HorizontalLine,HI as HorizontalLineCommand,GI as HorizontalLineEditing,rR as HorizontalLineElementSupport,qI as HorizontalLineUI,dR as HtmlComment,Td as HtmlDataProcessor,nL as HtmlEmbed,YI as HtmlEmbedCommand,$I as HtmlEmbedEditing,tL as HtmlEmbedUI,fR as HtmlPageDataProcessor,Dg as IconAI,Og as IconAIAdjustLength,kg as IconAIAskAI,Ag as IconAIAuthor,jg as IconAIChangeTone,Bg as IconAIChat,Mg as IconAIChatCommands,Ng as IconAIContinueWriting,Pg as IconAIGrammarCheck,Vg as IconAIHistory,Fg as IconAIImproveWriting,Ig as IconAIOther,Lg as IconAIQuickActions,Rg as IconAIReview,zg as IconAITranslate,Tg as IconAccessibility,Eg as IconAddComment,Hg as IconAlignBottom,Ug as IconAlignCenter,Wg as IconAlignJustify,Gg as IconAlignLeft,Kg as IconAlignMiddle,qg as IconAlignRight,Jg as IconAlignTop,Yg as IconArrowDown,Xg as IconArrowUp,Zg as IconBold,$g as IconBookmark,Qg as IconBookmarkInline,e_ as IconBookmarkMedium,t_ as IconBookmarkSmall,n_ as IconBoxWithCheck,r_ as IconBoxWithCross,i_ as IconBoxWithMarker,a_ as IconBrowseFiles,Jee as IconBulb,o_ as IconBulletedList,s_ as IconCancel,c_ as IconCaption,Yee as IconCaseChange,l_ as IconCheck,Xee as IconChevronDown,Qee as IconChevronRight,Zee as IconChevronUp,u_ as IconCkboxImageEdit,$ee as IconClose,f_ as IconCode,d_ as IconCodeBlock,ete as IconCog,p_ as IconColorPalette,m_ as IconColorTileCheck,tte as IconCommentsArchive,h_ as IconContentLock,g_ as IconContentUnlock,nte as IconCopy,rte as IconDocument,ste as IconDocumentOutline,__ as IconDocumentOutlineToggle,ite as IconDocumentWithCheckmark,ate as IconDocumentWithCross,ote as IconDocumentWithLoupe,v_ as IconDragHandle,y_ as IconDragIndicator,cte as IconDropbox,b_ as IconDropdownArrow,lte as IconEditComment,x_ as IconEmoji,S_ as IconEraser,ute as IconError,dte as IconExportPdf,fte as IconExportWord,pte as IconEye,mte as IconEyeCrossedOut,hte as IconFacebook,gte as IconFileUpload,C_ as IconFindReplace,w_ as IconFontBackground,T_ as IconFontColor,E_ as IconFontFamily,D_ as IconFontSize,_te as IconFootnote,O_ as IconFullscreenEnter,k_ as IconFullscreenLeave,vte as IconGoogleDrive,yte as IconGooglePhotos,A_ as IconHeading1,j_ as IconHeading2,M_ as IconHeading3,N_ as IconHeading4,P_ as IconHeading5,F_ as IconHeading6,I_ as IconHistory,L_ as IconHorizontalLine,R_ as IconHtml,B_ as IconImage,z_ as IconImageAssetManager,V_ as IconImageUpload,H_ as IconImageUrl,U_ as IconImportExport,W_ as IconImportWord,G_ as IconIndent,K_ as IconInfo,q_ as IconInsertMergeField,J_ as IconItalic,Y_ as IconLegalStyleList,X_ as IconLineHeight,Z_ as IconLink,sv as IconListStyleArabicIndic,Q_ as IconListStyleCircle,ev as IconListStyleDecimal,$_ as IconListStyleDecimalLeadingZero,tv as IconListStyleDisc,nv as IconListStyleLowerLatin,rv as IconListStyleLowerRoman,iv as IconListStyleSquare,av as IconListStyleUpperLatin,ov as IconListStyleUpperRoman,cv as IconLocal,lv as IconLoupe,bte as IconLowVision,xte as IconMagicWand,uv as IconMarker,dv as IconMaximize,pv as IconMedia,fv as IconMediaPlaceholder,mv as IconMinimize,hv as IconMultiLevelList,gv as IconNextArrow,_v as IconNotification,vv as IconNumberedList,yv as IconObjectCenter,bv as IconObjectFullWidth,Cv as IconObjectInline,xv as IconObjectInlineLeft,Sv as IconObjectInlineRight,wv as IconObjectLeft,Tv as IconObjectRight,Ev as IconObjectSizeCustom,Dv as IconObjectSizeFull,Ov as IconObjectSizeLarge,kv as IconObjectSizeMedium,Av as IconObjectSizeSmall,Ste as IconOneDrive,Cte as IconOutdated,jv as IconOutdent,Mv as IconPageBreak,wte as IconPaginationExample,Fv as IconPaintRoller,Nv as IconPaintRollerCursorDefault,Pv as IconPaintRollerCursorText,Iv as IconPaperClip,Lv as IconParagraph,zv as IconPen,Rv as IconPencil,Bv as IconPilcrow,Py as IconPin,Vv as IconPlay,Hv as IconPlus,Uv as IconPreviewMergeFields,Wv as IconPreviousArrow,Gv as IconPrint,Kv as IconProjectLogo,qv as IconQuote,Jv as IconRedo,Yv as IconRefresh,Qv as IconRemove,Xv as IconRemoveComment,Zv as IconRemoveFormat,$v as IconReturnArrow,ey as IconRevisionHistory,ty as IconRobotPencil,ny as IconSelectAll,ry as IconSelection,iy as IconSettings,ay as IconShowBlocks,oy as IconShowChangesOff,sy as IconShowChangesOn,cy as IconSource,ly as IconSparkle,uy as IconSpecialCharacters,dy as IconStop,fy as IconStrikethrough,py as IconSubmit,my as IconSubscript,hy as IconSuperscript,xy as IconTable,gy as IconTableCellProperties,_y as IconTableColumn,Sy as IconTableLayout,vy as IconTableMergeCell,Tte as IconTableOfContents,yy as IconTableProperties,by as IconTableRow,Dte as IconTemplate,Ete as IconTemplateGeneric,wy as IconText,Cy as IconTextAlternative,Ote as IconThreeHorizontalDots,kte as IconThreeStars,Ty as IconThreeVerticalDots,jte as IconThumbDown,Ate as IconThumbUp,Ey as IconTodoList,Pte as IconTrackChanges,Mte as IconTrackChangesAccept,Nte as IconTrackChangesDiscard,Dy as IconUnderline,Oy as IconUndo,ky as IconUnlink,Ay as IconUploadcareImageEdit,jy as IconUploadcareImageUpload,My as IconUploadcareLink,Ny as IconUser,Ly as IconView,Fy as IconWarning,Iy as IconWeb,aR as IframeElementSupport,NC as IframeView,EA as Image,CA as ImageBlock,bA as ImageBlockEditing,jA as ImageCaption,kA as ImageCaptionEditing,AA as ImageCaptionUI,DA as ImageCaptionUtils,bj as ImageCustomResizeUI,gA as ImageEditing,FL as ImageElementSupport,TA as ImageInline,wA as ImageInlineEditing,oj as ImageInsert,SA as ImageInsertUI,aj as ImageInsertViaUrl,ij as ImageInsertViaUrlUI,pA as ImageLoadObserver,yA as ImagePlaceholder,Sj as ImageResize,uj as ImageResizeButtons,cj as ImageResizeEditing,hj as ImageResizeHandles,_A as ImageSizeAttributes,Gj as ImageStyle,Cj as ImageStyleCommand,zj as ImageStyleEditing,Vj as ImageStyleUI,oA as ImageTextAlternative,eA as ImageTextAlternativeCommand,tA as ImageTextAlternativeEditing,aA as ImageTextAlternativeUI,Kj as ImageToolbar,vA as ImageTypeCommand,nj as ImageUpload,$A as ImageUploadEditing,zA as ImageUploadProgress,RA as ImageUploadUI,Kk as ImageUtils,xR as Indent,fH as IndentBlock,SR as IndentBlockCommand,iH as IndentBlockListCommand,cH as IndentBlockListIntegration,aH as IndentBlockListItemCommand,SN as IndentCodeBlockCommand,yR as IndentEditing,bR as IndentUI,jC as InlineEditableUIView,sP as InlineEditor,rP as InlineEditorUI,aP as InlineEditorUIView,tT as Input,$b as InputBase,rx as InputNumberView,Hc as InputObserver,nx as InputTextView,tx as InputView,JD as InsertBookmarkCommand,K5 as InsertColumnCommand,mA as InsertImageCommand,Vd as InsertOperation,SI as InsertParagraphCommand,G5 as InsertRowCommand,W5 as InsertTableCommand,y9 as InsertTableLayoutCommand,Zw as InsertTextCommand,eT as InsertTextObserver,Ute as Italic,nE as ItalicEditing,iE as ItalicUI,kx as ItemsView,Mc as KeyObserver,N as KeystrokeHandler,eo as LabelView,$C as LabelWithHighlightView,Qb as LabeledFieldView,PC as LabeledInputView,VV as LegacyCheckTodoListCommand,zB as LegacyIndentCommand,xV as LegacyList,IB as LegacyListCommand,yV as LegacyListEditing,zV as LegacyListProperties,EV as LegacyListPropertiesEditing,CV as LegacyListReversedCommand,wV as LegacyListStartCommand,SV as LegacyListStyleCommand,$B as LegacyListUtils,tH as LegacyTodoList,QV as LegacyTodoListEditing,Ok as Link,nk as LinkCommand,uk as LinkEditing,mk as LinkFormView,tM as LinkImage,Yj as LinkImageEditing,eM as LinkImageUI,sk as LinkManualDecorator,gk as LinkPropertiesView,hk as LinkProviderItemsView,m8 as LinkStyleSupport,yk as LinkUI,qz as List,QR as ListCommand,Bz as ListEditing,$L as ListElementSupport,oz as ListFormatting,XR as ListIndentCommand,tz as ListItemBoldIntegration,$y as ListItemButtonView,iz as ListItemFontColorIntegration,az as ListItemFontFamilyIntegration,rz as ListItemFontSizeIntegration,px as ListItemGroupView,nz as ListItemItalicIntegration,dx as ListItemView,$R as ListMergeCommand,bB as ListProperties,dB as ListPropertiesEditing,mB as ListPropertiesUI,sB as ListPropertiesUtils,aB as ListReversedCommand,fx as ListSeparatorView,ez as ListSplitCommand,Jz as ListStartCommand,iB as ListStyleCommand,f8 as ListStyleSupport,Kz as ListUI,fz as ListUtils,mx as ListView,Mi as Locale,ol as Mapper,s2 as Markdown,o2 as MarkdownGfmDataProcessor,i2 as MarkdownGfmHtmlToMd,R$ as MarkdownGfmMdToHtml,L$ as MarkdownGfmMdToHtmlDefaultPlugins,jf as Marker,Af as MarkerCollection,Wd as MarkerOperation,Po as Matcher,O2 as MediaEmbed,_2 as MediaEmbedCommand,Q2 as MediaEmbedCustomResizeUI,S2 as MediaEmbedEditing,BL as MediaEmbedElementSupport,t4 as MediaEmbedResize,W2 as MediaEmbedResizeButtons,V2 as MediaEmbedResizeEditing,H2 as MediaEmbedResizeHandles,c4 as MediaEmbedStyle,n4 as MediaEmbedStyleCommand,r4 as MediaEmbedStyleEditing,i4 as MediaEmbedStyleUI,L2 as MediaEmbedToolbar,E2 as MediaEmbedUI,b2 as MediaRegistry,JP as Mention,bP as MentionCommand,NP as MentionDomWrapperView,xP as MentionEditing,PP as MentionListItemView,LP as MentionUI,MP as MentionsView,cw as MenuBarMenuButtonView,U as MenuBarMenuListItemButtonView,mw as MenuBarMenuListItemFileDialogButtonView,rC as MenuBarMenuListItemView,dw as MenuBarMenuListView,lw as MenuBarMenuPanelView,uw as MenuBarMenuView,gw as MenuBarView,J5 as MergeCellCommand,t7 as MergeCellsCommand,Ud as MergeOperation,y4 as Minimap,Dp as Model,cl as ModelConsumable,Ef as ModelDocument,Nf as ModelDocumentFragment,Tl as ModelDocumentSelection,Ml as ModelElement,pf as ModelLivePosition,xl as ModelLiveRange,gl as ModelNode,Al as ModelNodeList,z as ModelPosition,B as ModelRange,Cf as ModelRootElement,ed as ModelSchema,td as ModelSchemaContext,_l as ModelSelection,Sl as ModelText,Yc as ModelTextProxy,Xc as ModelTreeWalker,Jc as ModelTypeCheckable,Ff as ModelWriter,Ap as MouseObserver,Bd as MoveOperation,co as MultiCommand,dP as MultiRootEditor,lP as MultiRootEditorUI,uP as MultiRootEditorUIView,Pc as MutationObserver,Dx as NESTED_TOOLBAR_ICONS,Kd as NoOperation,IC as Notification,D as ObservableMixin,kc as Observer,jd as Operation,Zd as OperationFactory,CN as OutdentCodeBlockCommand,E4 as PageBreak,b4 as PageBreakCommand,C4 as PageBreakEditing,T4 as PageBreakUI,CI as Paragraph,Cne as ParagraphButtonUI,bI as ParagraphCommand,l2 as PasteFromMarkdownExperimental,z3 as PasteFromOffice,T3 as PasteFromOfficeGoogleDocsNormalizer,A3 as PasteFromOfficeGoogleSheetsNormalizer,g3 as PasteFromOfficeMSWordNormalizer,MO as PastePlainText,wg as PendingActions,Jj as PictureEditing,yre as PlainTableOutput,F as Plugin,fo as PluginCollection,Mp as PointerObserver,fb as PoweredBy,O as Rect,Nk as RedoCommand,Z5 as RemoveColumnCommand,G3 as RemoveFormat,H3 as RemoveFormatCommand,W3 as RemoveFormatEditing,V3 as RemoveFormatUI,X5 as RemoveRowCommand,qd as RenameOperation,AF as ReplaceAllCommand,kF as ReplaceCommand,hA as ReplaceImageSourceCommand,sj as ResizeImageCommand,z2 as ResizeMediaEmbedCommand,Hr as ResizeObserver,x6 as RestrictedEditingExceptionAutoCommand,g6 as RestrictedEditingExceptionBlockCommand,h6 as RestrictedEditingExceptionCommand,m6 as RestrictedEditingMode,o6 as RestrictedEditingModeEditing,X3 as RestrictedEditingModeNavigationCommand,p6 as RestrictedEditingModeUI,Jd as RootAttributeOperation,Yd as RootOperation,WL as ScriptElementSupport,KC as SearchInfoView,KC as _SearchInfoView,qC as SearchResultsView,JC as SearchTextView,SF as SelectAll,vF as SelectAllCommand,bF as SelectAllEditing,xF as SelectAllUI,a7 as SelectColumnCommand,i7 as SelectRowCommand,Lc as SelectionObserver,$5 as SetFooterRowCommand,e7 as SetHeaderColumnCommand,Q5 as SetHeaderRowCommand,kE as ShiftEnter,EE as ShiftEnterCommand,F6 as ShowBlocks,A6 as ShowBlocksCommand,N6 as ShowBlocksEditing,P6 as ShowBlocksUI,ww as SimpleUploadAdapter,LS as SliderView,L6 as SourceEditing,G6 as SpecialCharacters,K6 as SpecialCharactersArrows,X6 as SpecialCharactersCurrency,Z6 as SpecialCharactersEssentials,Y6 as SpecialCharactersLatin,J6 as SpecialCharactersMathematical,q6 as SpecialCharactersText,ew as SpinnerView,Mx as SplitButtonView,q5 as SplitCellCommand,Hd as SplitOperation,T6 as StandardEditingMode,S6 as StandardEditingModeEditing,w6 as StandardEditingModeUI,WC as StickyPanelView,Wte as Strikethrough,oE as StrikethroughEditing,cE as StrikethroughUI,v8 as Style,c8 as StyleCommand,_8 as StyleEditing,QL as StyleElementSupport,s8 as StyleUI,r8 as StyleUtils,Vo as StylesMap,Ho as StylesProcessor,Gte as Subscript,uE as SubscriptEditing,fE as SubscriptUI,Kte as Superscript,mE as SuperscriptEditing,gE as SuperscriptUI,mb as SwitchButtonView,Gc as TabObserver,T7 as Table,L9 as TableAlignmentCommand,j9 as TableBackgroundColorCommand,M9 as TableBorderColorCommand,N9 as TableBorderStyleCommand,P9 as TableBorderWidthCommand,Kre as TableCaption,Z9 as TableCaptionEditing,Q9 as TableCaptionUI,i9 as TableCellBackgroundColorCommand,c9 as TableCellBorderColorCommand,s9 as TableCellBorderStyleCommand,l9 as TableCellBorderWidthCommand,r9 as TableCellHeightCommand,o9 as TableCellHorizontalAlignmentCommand,n9 as TableCellPaddingCommand,kre as TableCellProperties,h9 as TableCellPropertiesEditing,Q7 as TableCellPropertiesUI,W7 as TableCellPropertiesView,$7 as TableCellPropertyCommand,u9 as TableCellTypeCommand,a9 as TableCellVerticalAlignmentCommand,e9 as TableCellWidthCommand,t9 as TableCellWidthEditing,_7 as TableClipboard,T9 as TableColumnResize,w9 as TableColumnResizeEditing,f7 as TableEditing,KL as TableElementSupport,I9 as TableHeightCommand,x7 as TableKeyboard,Ire as TableLayout,D9 as TableLayoutEditing,g9 as TableLayoutUI,C7 as TableMouse,Wre as TableProperties,R9 as TablePropertiesEditing,W9 as TablePropertiesUI,V9 as TablePropertiesView,A9 as TablePropertyCommand,g7 as TableSelection,j8 as TableSlot,p8 as TableStyleSupport,bre as TableToolbar,E9 as TableTypeCommand,h7 as TableUI,O5 as TableUtils,$ as TableWalker,F9 as TableWidthCommand,b9 as TableWidthsCommand,ga as Template,vH as TextPartLanguage,hH as TextPartLanguageCommand,gH as TextPartLanguageEditing,_H as TextPartLanguageUI,AT as TextTransformation,yT as TextWatcher,ix as TextareaView,Dne as Title,FB as TodoList,wB as TodoListEditing,PB as TodoListUI,OA as ToggleImageCaptionCommand,X9 as ToggleTableCaptionCommand,jM as Token,wx as ToolbarLineBreakView,Cx as ToolbarSeparatorView,Ox as ToolbarView,XS as TooltipManager,jp as TouchObserver,bT as TwoStepCaretMovement,gT as Typing,Xw as TypingChangeBuffer,RC as UIModel,RC as ViewModel,qte as Underline,vE as UnderlineEditing,bE as UnderlineUI,Ik as Undo,Mk as UndoCommand,Pk as UndoEditing,kk as UndoRedoBaseCommand,Fk as UndoUI,ak as UnlinkCommand,xd as UpcastDispatcher,ju as UpcastHelpers,Np as UpcastWriter,Np as ViewUpcastWriter,XD as UpdateBookmarkCommand,RM as UploadGateway,QA as UploadImageCommand,P as View,ws as ViewAttributeElement,pa as ViewCollection,Ao as ViewConsumable,Qo as ViewContainerElement,Bc as ViewDataTransfer,Cs as ViewDocument,Ac as ViewDocumentDomEventData,Is as ViewDocumentFragment,cs as ViewDocumentSelection,_c as ViewDomConverter,Rs as ViewDowncastWriter,es as ViewEditableElement,Jo as ViewElement,Ds as ViewEmptyElement,Do as ViewNode,L as ViewPosition,R as ViewRange,Ns as ViewRawElement,rc as ViewRenderer,ns as ViewRootEditableElement,os as ViewSelection,Oo as ViewText,ko as ViewTextProxy,qo as ViewTokenList,rs as ViewTreeWalker,Eo as ViewTypeCheckable,ks as ViewUIElement,BE as WIDGET_CLASS_NAME,VE as WIDGET_SELECTED_CLASS_NAME,Sh as Watchdog,xD as Widget,IE as WidgetHighlightStack,GD as WidgetResize,PD as WidgetResizeState,VD as WidgetResizer,kD as WidgetToolbarRepository,dD as WidgetTypeAround,qre as WordCount,Ad as XmlDataProcessor,Nw as _ALIGNMENT_SUPPORTED_OPTIONS,eb as _CheckIconHolderView,yO as _ClipboardLineView,VC as _ContextualBalloonRotatorView,Kh as _DEFAULT_ACCESSIBILITY_GROUP_ID,wd as _DataProcessorBasicHtmlWriter,fT as _DeleteObserver,Mf as _DetachOperation,yx as _DropdownMenuBehaviors,vx as _DropdownRootMenuBehaviors,yL as _HTML_SUPPORT_SCHEMA_DEFINITIONS,Ej as _IMAGE_DEFAULT_DROPDOWN_DEFINITIONS,Tj as _IMAGE_DEFAULT_ICONS,wj as _IMAGE_DEFAULT_OPTIONS,vj as _ImageCustomResizeFormView,xA as _ImageInsertFormView,rj as _ImageInsertUrlView,Fj as _ImageStyleUtils,nA as _ImageTextAlternativeFormView,wR as _IndentUsingClasses,CR as _IndentUsingOffset,m7 as _InsertTableView,BO as _LINK_KEYSTROKE,_k as _LinkButtonView,pk as _LinkPreviewButtonView,DR as _ListBlocksIterable,OR as _ListItemUid,pB as _ListPropertiesView,TR as _ListWalker,sl as _MapperCache,T2 as _MediaFormView,iC as _MenuBarBehaviors,aC as _MenuBarMenuBehaviors,oC as _MenuBarMenuViewPanelPositioningFunctions,u4 as _MinimapIframeView,f4 as _MinimapPositionTrackerView,p4 as _MinimapView,xh as _OperationReplayer,GC as _SearchTextQueryView,ER as _SiblingListBlocksIterator,W6 as _SpecialCharactersCategoriesView,B6 as _SpecialCharactersGridView,V6 as _SpecialCharactersInfoView,U6 as _SpecialCharactersView,Q6 as _StyleGridButtonView,$6 as _StyleGridView,e8 as _StyleGroupView,t8 as _StylePanelView,s5 as _TABLE_COLUMN_MIN_WIDTH_AS_PERCENTAGE,c5 as _TABLE_COLUMN_MIN_WIDTH_IN_PIXELS,u5 as _TABLE_COLUMN_RESIZE_DISTANCE_THRESHOLD,l5 as _TABLE_COLUMN_WIDTH_PRECISION,V7 as _TABLE_DEFAULT_COLORS,A7 as _TableColorInputView,S7 as _TableMouseEventsObserver,_a as _TemplateBinding,ya as _TemplateIfBinding,va as _TemplateToBinding,SB as _TodoCheckboxChangeObserver,Ys as _VIEW_BR_FILLER,Xs as _VIEW_INLINE_FILLER,Iee as _VIEW_INLINE_FILLER_LENGTH,Js as _VIEW_MARKED_NBSP_FILLER,qs as _VIEW_NBSP_FILLER,jo as _ViewElementConversionConsumables,nD as _WIDGET_TYPE_AROUND_SELECTION_ATTRIBUTE,zD as _WidgetSizeView,P5 as _addDefaultUnitToNumericValue,UF as _addFontColorSelectorToDropdown,SP as _addMentionAttributes,$8 as _adjustLastTableColumnIndex,Q8 as _adjustLastTableRowIndex,gL as _attributeToInlineHtmlSupportConverter,Ou as _autoParagraphEmptyModelRoots,BF as _buildFontDefinition,_N as _canBeCodeBlock,KR as _canBecomeSimpleListItem,Wk as _checkIfImageWidthAndHeightStylesAreBothSet,vM as _ckBoxConvertMimeTypeToExtension,hM as _ckboxBlurHashToDataUrl,v5 as _clamp,Oi as _clearTranslations,m4 as _cloneMinimapEditingViewDomRoot,I7 as _colorTableFieldValidator,Kb as _convertColor,qb as _convertColorToHex,Z4 as _convertHexToBase64,gh as _convertMapToStringifiedObject,hh as _convertMapToTags,V5 as _convertParagraphInTableCell,k4 as _convertPasteOfficeCssLengthToPx,Rk as _createBlockImageViewElement,eN as _createCKBoxEditabilityChecker,P8 as _createEmptyTableCell,y5 as _createFilledArray,Lk as _createInlineImageViewElement,HO as _createLinkElement,gz as _createListElement,_z as _createListItemElement,Wz as _createListUIComponents,m2 as _createMediaFigureElement,BP as _createMentionMarkerRegExp,jz as _createModelToViewListPositionMapper,pL as _createObjectHtmlSupportView,V8 as _cropTableToDimensions,DN as _dataViewToModelCodeBlockInsertion,kN as _dataViewToModelCodeBlockOrphanNodeConsumer,ON as _dataViewToModelCodeBlockTextNewlinesInsertion,Xf as _deleteModelContent,Hk as _determineImageTypeForInsertionAtSelection,Ul as _downcastCleanSelection,Hl as _downcastConvertCollapsedSelection,Vl as _downcastConvertRangeSelection,Bl as _downcastCreateViewElementFromDowncastHighlightDescriptor,fA as _downcastImageAttribute,dA as _downcastImageSourcesAttribute,uA as _downcastImageSrcsetAttribute,Rl as _downcastInsertAttributesAndChildren,Gl as _downcastInsertElement,Kl as _downcastInsertStructure,Ll as _downcastInsertText,ql as _downcastInsertUIElement,zl as _downcastRemove,R5 as _downcastTable,w8 as _downcastTableAttribute,C8 as _downcastTableAttributeToStyle,B5 as _downcastTableCell,S9 as _downcastTableResizedClass,z5 as _downcastTableRow,Wl as _downcastWrap,vh as _dumpTrees,hL as _emptyInlineModelElementToViewHtmlSupportConverter,I8 as _enableTableCellProperty,i5 as _ensureParagraphInTableCell,UO as _ensureSafeLinkUrl,FR as _expandListBlocksToCompleteItems,IR as _expandListBlocksToCompleteList,t6 as _extendRestrictedEditingMarkerOnTypingPostFixer,QO as _extractTextFromLinkRange,NA as _fetchLocalImage,B7 as _fillTableOrCellToolbar,bz as _findAndAddListHeadToMap,Az as _findMappedListItemViewElement,xz as _fixListIndents,Sz as _fixListItemIds,kR as _getAllListItemBlocks,$z as _getAllSupportedListStyleTypes,Y7 as _getBalloonTableCellPositionData,J7 as _getBalloonTablePositionData,JT as _getBasicStylesButtonCreator,N7 as _getBorderTableStyleLabels,yM as _getCKBoxContentTypeOfUrl,bM as _getCKBoxFileExtension,pM as _getCKBoxImageUrls,mM as _getCKBoxWorkspaceId,Ow as _getCKFinderCookie,Dw as _getCKFinderCsrfToken,d5 as _getChangedResizedTables,iD as _getClosestWidgetTypeAroundDomButton,oD as _getClosestWidgetViewElement,vN as _getCodeBlockAriaAnnouncement,hN as _getCodeBlockIndentOutdentPositions,pN as _getCodeBlockLeadingWhiteSpaces,fN as _getCodeBlockPropertyAssociation,yN as _getCodeBlockTextNodeAtLineStart,xE as _getCopyOnEnterAttributes,$s as _getDataWithoutViewFiller,T8 as _getDefaultTableValueAdjusted,S5 as _getDomTableCellOuterWidth,Jh as _getEditorUsageData,h5 as _getElementWidthInPixels,je as _getEmitterId,ke as _getEmitterListenedTo,W8 as _getHorizontallyOverlappingTableCells,uL as _getHtmlSupportAttributeName,PL as _getHtmlSupportDescendantElement,iA as _getImageBalloonPositionData,Uk as _getImageSizeValueIfInPx,zk as _getImageViewElementMatcher,H7 as _getLabeledTableColorInputCreator,hz as _getListIndent,AR as _getListItemBlocks,MR as _getListItems,tB as _getListStyleTypeFromTypeAttribute,eB as _getListTypeFromListStyleType,OI as _getLocalizedHeadingOptions,GO as _getLocalizedLinkDecorators,P7 as _getLocalizedTableColorErrorText,F7 as _getLocalizedTableLengthErrorText,_4 as _getMinimapClientHeight,g4 as _getMinimapDomElementRect,h4 as _getMinimapPageStyles,v4 as _getMinimapScrollable,ah as _getModelData,$c as _getModelNodeAfterPosition,el as _getModelNodeBeforePosition,Qc as _getModelTextNodeAtPosition,jR as _getNestedListBlocks,dN as _getNormalizedAndLocalizedCodeBlockLanguageDefinitions,F5 as _getNormalizedDefaultTableBaseProperties,L5 as _getNormalizedDefaultTableCellProperties,I5 as _getNormalizedDefaultTableProperties,cB as _getNormalizedListConfig,K3 as _getRestrictedEditingMarkerAtPosition,GR as _getSelectedBlockObject,gj as _getSelectedImageEditorNodes,yj as _getSelectedImagePossibleResizeRange,_j as _getSelectedImageWidthInUnits,h2 as _getSelectedMediaModelWidget,f2 as _getSelectedMediaViewWidget,pp as _getSelectedModelContent,D7 as _getSelectedTableWidget,L8 as _getSelectionAffectedTable,E7 as _getSelectionAffectedTableWidget,N5 as _getTableBorderBoxSingleValue,q9 as _getTableCaptionFromModelElement,J9 as _getTableCaptionFromModelSelection,g5 as _getTableColumnEdgesIndexes,T5 as _getTableColumnElements,w5 as _getTableColumnGroupElement,f5 as _getTableColumnMinWidthAsPercentage,E5 as _getTableColumnsWidths,z7 as _getTableOrCellBorderStyleDefinitions,O7 as _getTableWidgetAncestor,p5 as _getTableWidthInPixels,nB as _getTypeAttributeFromListStyleType,d as _getUserAgent,H8 as _getVerticallyOverlappingTableCells,Jm as _getViewData,yz as _getViewElementIdForListType,vz as _getViewElementNameForListType,aD as _getWidgetTypeAroundButtonPosition,sD as _getWidgetTypeAroundFakeCaretPosition,XO as _hasLinkProtocol,zR as _indentListBlocks,yh as _initDocumentDumping,Vf as _injectModelSelectionPostFixer,G9 as _injectTableCaptionPostFixer,s7 as _injectTableCellParagraphPostFixer,o7 as _injectTableLayoutPostFixer,ec as _injectViewQuirksHandling,As as _injectViewUIElementHandling,Md as _insertIntoModelNodeList,g2 as _insertMedia,hp as _insertModelContent,_p as _insertModelObject,Pw as _isAlignmentSupported,y as _isAndroid,ee as _isBlink,qD as _isBookmarkIdValid,Fw as _isDefaultAlignment,JO as _isEmailLink,XP as _isEmojiSupported,NR as _isFirstBlockOfListItem,g as _isGecko,Qs as _isInlineViewFiller,PR as _isLastBlockOfListItem,G as _isListItemBlock,mz as _isListItemView,pz as _isListView,PA as _isLocalImage,m as _isMac,x as _isMediaForcedColors,p2 as _isMediaWidget,gN as _isModelSelectionInCodeBlock,te as _isMotionReduced,qR as _isNumberedListType,ku as _isParagraphableModelNode,A4 as _isPasteOfficePxValue,b as _isRegExpUnicodePropertySupported,q3 as _isRestrictedEditingPositionInRangeBoundaries,J3 as _isRestrictedEditingSelectionInMarker,_ as _isSafari,HR as _isSingleListItem,H5 as _isSingleTableParagraphWithoutAttributes,F8 as _isTableHeadingColumnCell,K9 as _isTableModelElement,Fo as _isViewPatternMatched,h as _isWindows,v as _isiOS,L7 as _lengthTableFieldValidator,R7 as _lineWidthTableFieldValidator,kz as _listItemBogusParagraphCreator,Dz as _listItemDowncastConverter,Oz as _listItemDowncastRemoveConverter,Tz as _listItemUpcastConverter,oB as _listPropertiesUpcastConverter,bh as _logDocument,Y9 as _matchTableCaptionViewElement,oL as _mergeHtmlSupportViewElementAttributes,Jf as _mergeIntersectingModelRanges,RR as _mergeListItemBefore,$9 as _modelElementToPlainText,EN as _modelToDataViewCodeBlockSoftBreakInsertion,vL as _modelToViewBlockAttributeHtmlSupportConverter,TN as _modelToViewCodeBlockInsertion,Ij as _modelToViewImageStyleAttribute,u2 as _modelToViewUrlAttributeMediaConverter,sL as _modifyHtmlSupportGhsAttribute,yp as _modifyModelSelection,Pd as _moveInModelNodeList,Iw as _normalizeAlignmentOptions,uO as _normalizeClipboardData,Mo as _normalizeConversionConsumables,GF as _normalizeFontFamilyOptions,ZF as _normalizeFontSizeOptions,Id as _normalizeInModelNodeList,KO as _normalizeLinkDecorators,rB as _normalizeListStyle,M3 as _normalizePasteOfficeSpaceRunSpans,j3 as _normalizePasteOfficeSpacing,x5 as _normalizeTableColumnWidths,ZO as _openLink,tf as _operationTransform,UR as _outdentFollowingListItems,BR as _outdentListBlocksWithMerge,mH as _parseLanguageAttribute,ch as _parseModel,Zm as _parseView,CM as _prepareCKBoxImageAssetAttributes,Tx as _preventUiViewDefault,lC as _processMenuBarConfig,mN as _rawCodeBlockSnippetTextToViewDocumentFragment,Ez as _reconvertListItemsOnDataChange,Jb as _registerCustomElement,Y8 as _removeEmptyTableColumns,X8 as _removeEmptyTableRows,Z8 as _removeEmptyTableRowsColumns,Nd as _removeFromModelNodeList,aL as _removeHtmlSupportViewAttributes,VR as _removeListAttributes,D3 as _removePasteGoogleOfficeSheetsTag,a3 as _removePasteMSOfficeAttributes,_3 as _removePasteOfficeBoldWrapper,s3 as _removePasteOfficeInvalidTableWidths,O3 as _removePasteOfficeStyleBlock,E3 as _removePasteOfficeXmlnsAttributes,HF as _renderDowncastFontElement,VF as _renderUpcastFontColorAttribute,X4 as _replacePasteOfficeImagesSourceWithBase64,rA as _repositionImageContextualBalloon,q7 as _repositionTableContextualBalloon,e6 as _resurrectRestrictedEditingCollapsedMarkerPostFixer,gM as _sendCKBoxHttpRequest,Fd as _setAttributeInModelNodeList,kw as _setCKFinderCookie,Ae as _setEmitterId,iL as _setHtmlSupportViewAttributes,oh as _setModelData,Ym as _setViewData,$3 as _setupRestrictedEditingExceptionHighlighting,r5 as _skipEmptyTableRow,DF as _sortFindResultsByMarkerPositions,WR as _sortListBlocks,LR as _splitListItemBefore,U8 as _splitTableCellHorizontally,G8 as _splitTableCellVertically,Zs as _startsWithViewFiller,pH as _stringifyLanguageAttribute,sh as _stringifyModel,Xm as _stringifyView,b5 as _sumArray,d7 as _tableCellRefreshHandler,u7 as _tableStructureRefreshHandler,lL as _toHtmlSupportPascalCase,d2 as _toMediaWidget,CP as _toMentionAttribute,fL as _toObjectWidgetHtmlSupportConverter,j4 as _toPasteOfficePxValue,_5 as _toPrecision,v3 as _transformPasteOfficeBlockBrsToParagraphs,D4 as _transformPasteOfficeBookmarks,M4 as _transformPasteOfficeListItemLikeElementsIntoLists,o3 as _transformPasteOfficeTables,Di as _translate,D5 as _translateTableColspanAttribute,K8 as _trimTableCellIfNeeded,fa as _tryCastDimensionsToUnit,Uf as _tryFixingModelRange,BS as _tryNormalizeHexColor,da as _tryParseDimensionWithUnit,ki as _unifyTranslations,I4 as _unwrapPasteOfficeParagraphInListItem,Pu as _upcastConvertSelectionChange,Nu as _upcastConvertText,Mu as _upcastConvertToModelFragment,sA as _upcastImageFigure,lA as _upcastImagePicture,x8 as _upcastNormalizedTableStyleToAttribute,n6 as _upcastRestrictedEditingHighlightToMarker,n5 as _upcastTable,S8 as _upcastTableBorderStyles,x9 as _upcastTableColgroupElement,t5 as _upcastTableFigure,rL as _updateHtmlSupportViewAttributes,C5 as _updateTableColumnElements,N8 as _updateTableNumericAttribute,mL as _viewToAttributeInlineHtmlSupportConverter,_L as _viewToModelBlockAttributeHtmlSupportConverter,Lj as _viewToModelImageStyleAttribute,dL as _viewToModelObjectContentHtmlSupportConverter,Au as _wrapInModelParagraph,ur as abortableDebounce,Ei as add,hm as addBackgroundStylesRules,Mm as addBorderStylesRules,$a as addKeyboardHandlingForGrid,YO as addLinkProtocolIfApplicable,Lx as addListToDropdown,Wm as addMarginStylesRules,Fte as addMenuToDropdown,Gm as addPaddingStylesRules,Fx as addToolbarToDropdown,ce as areConnectedThroughProperties,ag as attachToForm,BT as blockAutoformatEditing,eD as calculateResizeHostAncestorWidth,tD as calculateResizeHostPercentageWidth,Ya as clickOutsideHandler,Cee as collectStylesheets,fr as compareArrays,dr as count,Zi as crc32,Nx as createDropdown,mr as createElement,MA as createImageTypeRegExp,Zx as createLabeledDropdown,Yx as createLabeledInputNumber,Jx as createLabeledInputText,Xx as createLabeledTextarea,ca as decodeLicenseKey,Yi as delay,oe as diff,se as diffToChanges,bo as disableViewPlaceholder,yo as enableViewPlaceholder,p as env,qi as exponentialDelay,ne as fastDiff,FC as filterGroupAndItemNames,LT as findAttributeRange,RT as findAttributeRangeBound,wr as findClosestScrollableAncestor,XE as findOptimalInsertionRange,j as first,zx as focusChildOnDropdownOpen,Qi as formatHtml,Tr as getAncestors,Dr as getBorderWidths,um as getBoxSidesStyleShorthandValue,lm as getBoxSidesStyleValueReducer,cm as getBoxSidesStyleValues,vi as getCode,kr as getCommonAncestor,Qr as getConstrainedViewportRect,Er as getDataFromElement,bi as getEnvKeystrokeText,JE as getLabel,Ti as getLanguageDirection,_T as getLastTextLine,Si as getLocalizedArrowKeyCodeDirection,Sb as getLocalizedColorOptions,Xr as getOptimalPosition,dm as getPositionStyleShorthandNormalizer,Ar as getPositionedAncestor,Or as getRangeFromMouseEvent,fm as getShorthandStylesValues,$o as getViewFillerOffset,ti as getVisualViewportOffset,u as global,So as hideViewPlaceholder,Gr as indexOf,HT as inlineAutoformatEditing,zT as inlineHighlight,Kr as insertAt,_e as insertToPriorityArray,xi as isArrowKeyCode,tm as isAttachmentStyleValue,Vp as isColorStyleValue,ea as isCombiningMark,qr as isComment,ua as isFeatureBlockedByLicenseKey,Wy as isFocusable,wi as isForwardArrowKeyCode,ta as isHighSurrogateHalf,ej as isHtmlInDataTransfer,ia as isInsideCombinedSymbol,oa as isInsideEmojiSequence,ra as isInsideSurrogatePair,pr as isIterable,Gp as isLengthStyleValue,Up as isLineStyleValue,VO as isLinkElement,qO as isLinkableElement,na as isLowSurrogateHalf,vr as isNode,qp as isPercentageStyleValue,$p as isPositionStyleValue,Mr as isRange,Zp as isRepeatStyleValue,M8 as isTableHeaderCellType,jr as isText,rD as isTypeAroundWidget,sm as isURLStyleValue,Jr as isValidAttributeName,Gy as isViewWithFocusCycler,Ri as isViewWithFocusTracker,Yr as isVisible,HE as isWidget,yr as isWindow,k as keyCodes,ye as logError,T as logWarning,Wi as mapsEqual,Co as needsViewPlaceholder,Cb as normalizeColorOptions,cC as normalizeMenuBarConfig,pg as normalizeMultiRootEditorConstructorParams,dg as normalizeRootsConfig,wb as normalizeSingleColorDefinition,fg as normalizeSingleRootEditorConstructorParams,Ex as normalizeToolbarConfig,vg as normalizeViewRootElementDefinition,Ii as nth,Hi as objectToMap,Xi as parseBase64EncodedObject,yi as parseKeystroke,P3 as parsePasteOfficeHtml,cO as plainTextToHtml,ge as priorities,ug as registerAndInitializeRootConfigAttributes,we as releaseDate,ei as remove,Ki as retry,Cg as rootAcceptsBlocks,ri as scrollAncestorsToShowTarget,ni as scrollViewportToShowTarget,cg as secureSourceElement,Ur as setDataInElement,KE as setHighlightHandling,qE as setLabel,xo as showViewPlaceholder,Ji as spliceArray,fe as spy,Qa as submitHandler,A as toArray,Ui as toMap,Wr as toUnit,UE as toWidget,YE as toWidgetEditable,nf as transformOperationSets,he as uid,Sg as verifyRootElements,Ce as version,gD as verticalWidgetNavigationHandler,ZE as viewToModelPositionOutsideModelElement,pO as viewToPlainText,Gi as wait};
//# sourceMappingURL=ckeditor5.js.map