@qualityunit/liveagent-components-editor 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -0
- package/dist/ckeditor.cjs +1 -0
- package/dist/ckeditor.js +1 -0
- package/dist/ckeditor5-DMTIEzP4.js +58385 -0
- package/dist/ckeditor5-EBIBA6Vx.cjs +1693 -0
- package/dist/editor-lib.cjs +1 -0
- package/dist/editor-lib.js +298 -0
- package/dist/style.css +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,1693 @@
|
|
|
1
|
+
"use strict";function Wp(n,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in n)){const o=Object.getOwnPropertyDescriptor(i,s);o&&Object.defineProperty(n,s,o.get?o:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}function Gt(){}function oh(n){return n()}function fl(){return Object.create(null)}function qi(n){n.forEach(oh)}function ua(n){return typeof n=="function"}function rh(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}function qp(n){return Object.keys(n).length===0}function jp(n,e){n.appendChild(e)}function da(n,e,t){n.insertBefore(e,t||null)}function no(n){n.parentNode&&n.parentNode.removeChild(n)}function Gp(n,e){for(let t=0;t<n.length;t+=1)n[t]&&n[t].d(e)}function ha(n){return document.createElement(n)}function ah(n){return document.createTextNode(n)}function Kp(){return ah(" ")}function Zp(n,e,t,i){return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)}function lh(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}function Jp(n){return Array.from(n.childNodes)}function Yp(n,e){e=""+e,n.data!==e&&(n.data=e)}function Qp(n,e){n.value=e??""}function Xp(n,e,{bubbles:t=!1,cancelable:i=!1}={}){return new CustomEvent(n,{detail:e,bubbles:t,cancelable:i})}function e1(n){const e={};return n.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}let yn;function fn(n){yn=n}function t1(){if(!yn)throw new Error("Function called outside component initialization");return yn}function i1(){const n=t1();return(e,t,{cancelable:i=!1}={})=>{const s=n.$$.callbacks[e];if(s){const o=Xp(e,t,{cancelable:i});return s.slice().forEach(r=>{r.call(n,o)}),!o.defaultPrevented}return!0}}const Ai=[],Vs=[];let Bi=[];const dr=[],n1=Promise.resolve();let hr=!1;function s1(){hr||(hr=!0,n1.then(Re))}function fr(n){Bi.push(n)}function o1(n){dr.push(n)}const ko=new Set;let pi=0;function Re(){if(pi!==0)return;const n=yn;do{try{for(;pi<Ai.length;){const e=Ai[pi];pi++,fn(e),r1(e.$$)}}catch(e){throw Ai.length=0,pi=0,e}for(fn(null),Ai.length=0,pi=0;Vs.length;)Vs.pop()();for(let e=0;e<Bi.length;e+=1){const t=Bi[e];ko.has(t)||(ko.add(t),t())}Bi.length=0}while(Ai.length);for(;dr.length;)dr.pop()();hr=!1,ko.clear(),fn(n)}function r1(n){if(n.fragment!==null){n.update(),qi(n.before_update);const e=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,e),n.after_update.forEach(fr)}}function a1(n){const e=[],t=[];Bi.forEach(i=>n.indexOf(i)===-1?e.push(i):t.push(i)),t.forEach(i=>i()),Bi=e}const ks=new Set;let qt;function l1(){qt={r:0,c:[],p:qt}}function c1(){qt.r||qi(qt.c),qt=qt.p}function ch(n,e){n&&n.i&&(ks.delete(n),n.i(e))}function u1(n,e,t,i){if(n&&n.o){if(ks.has(n))return;ks.add(n),qt.c.push(()=>{ks.delete(n),i&&(t&&n.d(1),i())}),n.o(e)}else i&&i()}function d1(n,e,t){const i=n.$$.props[e];i!==void 0&&(n.$$.bound[i]=t,t(n.$$.ctx[i]))}function h1(n){n&&n.c()}function uh(n,e,t){const{fragment:i,after_update:s}=n.$$;i&&i.m(e,t),fr(()=>{const o=n.$$.on_mount.map(oh).filter(ua);n.$$.on_destroy?n.$$.on_destroy.push(...o):qi(o),n.$$.on_mount=[]}),s.forEach(fr)}function dh(n,e){const t=n.$$;t.fragment!==null&&(a1(t.after_update),qi(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function f1(n,e){n.$$.dirty[0]===-1&&(Ai.push(n),s1(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<<e%31}function hh(n,e,t,i,s,o,r=null,a=[-1]){const l=yn;fn(n);const c=n.$$={fragment:null,ctx:[],props:o,update:Gt,not_equal:s,bound:fl(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(l?l.$$.context:[])),callbacks:fl(),dirty:a,skip_bound:!1,root:e.target||l.$$.root};r&&r(c.root);let u=!1;if(c.ctx=t?t(n,e.props||{},(d,h,...f)=>{const m=f.length?f[0]:h;return c.ctx&&s(c.ctx[d],c.ctx[d]=m)&&(!c.skip_bound&&c.bound[d]&&c.bound[d](m),u&&f1(n,d)),h}):[],c.update(),u=!0,qi(c.before_update),c.fragment=i?i(c.ctx):!1,e.target){if(e.hydrate){const d=Jp(e.target);c.fragment&&c.fragment.l(d),d.forEach(no)}else c.fragment&&c.fragment.c();e.intro&&ch(n.$$.fragment),uh(n,e.target,e.anchor),Re()}fn(l)}let fh;typeof HTMLElement=="function"&&(fh=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;constructor(n,e,t){super(),this.$$ctor=n,this.$$s=e,t&&this.attachShadow({mode:"open"})}addEventListener(n,e,t){if(this.$$l[n]=this.$$l[n]||[],this.$$l[n].push(e),this.$$c){const i=this.$$c.$on(n,e);this.$$l_u.set(e,i)}super.addEventListener(n,e,t)}removeEventListener(n,e,t){if(super.removeEventListener(n,e,t),this.$$c){const i=this.$$l_u.get(e);i&&(i(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let n=function(s){return()=>{let o;return{c:function(){o=ha("slot"),s!=="default"&&lh(o,"name",s)},m:function(l,c){da(l,o,c)},d:function(l){l&&no(o)}}}};if(await Promise.resolve(),!this.$$cn)return;const e={},t=e1(this);for(const s of this.$$s)s in t&&(e[s]=[n(s)]);for(const s of this.attributes){const o=this.$$g_p(s.name);o in this.$$d||(this.$$d[o]=Es(o,s.value,this.$$p_d,"toProp"))}for(const s in this.$$p_d)!(s in this.$$d)&&this[s]!==void 0&&(this.$$d[s]=this[s],delete this[s]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:e,$$scope:{ctx:[]}}});const i=()=>{this.$$r=!0;for(const s in this.$$p_d)if(this.$$d[s]=this.$$c.$$.ctx[this.$$c.$$.props[s]],this.$$p_d[s].reflect){const o=Es(s,this.$$d[s],this.$$p_d,"toAttribute");o==null?this.removeAttribute(this.$$p_d[s].attribute||s):this.setAttribute(this.$$p_d[s].attribute||s,o)}this.$$r=!1};this.$$c.$$.after_update.push(i),i();for(const s in this.$$l)for(const o of this.$$l[s]){const r=this.$$c.$on(s,o);this.$$l_u.set(o,r)}this.$$l={}}}attributeChangedCallback(n,e,t){this.$$r||(n=this.$$g_p(n),this.$$d[n]=Es(n,t,this.$$p_d,"toProp"),this.$$c?.$set({[n]:this.$$d[n]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{this.$$cn||(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(n){return Object.keys(this.$$p_d).find(e=>this.$$p_d[e].attribute===n||!this.$$p_d[e].attribute&&e.toLowerCase()===n)||n}});function Es(n,e,t,i){const s=t[n]?.type;if(e=s==="Boolean"&&typeof e!="boolean"?e!=null:e,!i||!t[n])return e;if(i==="toAttribute")switch(s){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e??null;default:return e}else switch(s){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function mh(n,e,t,i,s,o){let r=class extends fh{constructor(){super(n,t,s),this.$$p_d=e}static get observedAttributes(){return Object.keys(e).map(a=>(e[a].attribute||a).toLowerCase())}};return Object.keys(e).forEach(a=>{Object.defineProperty(r.prototype,a,{get(){return this.$$c&&a in this.$$c?this.$$c[a]:this.$$d[a]},set(l){l=Es(a,l,e),this.$$d[a]=l,this.$$c?.$set({[a]:l})}})}),i.forEach(a=>{Object.defineProperty(r.prototype,a,{get(){return this.$$c?.[a]}})}),o&&(r=o(r)),n.element=r,r}class gh{$$=void 0;$$set=void 0;$destroy(){dh(this,1),this.$destroy=Gt}$on(e,t){if(!ua(t))return Gt;const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(t),()=>{const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}$set(e){this.$$set&&!qp(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const m1="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(m1);/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/function fa({emitter:n,activator:e,callback:t,contextElements:i}){n.listenTo(document,"mousedown",(s,o)=>{if(!e())return;const r=typeof o.composedPath=="function"?o.composedPath():[],a=typeof i=="function"?i():i;for(const l of a)if(l.contains(o.target)||r.includes(l))return;t()})}/**
|
|
5
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
6
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
7
|
+
*/function ma(n){class e extends n{disableCssTransitions(){this._isCssTransitionsDisabled=!0}enableCssTransitions(){this._isCssTransitionsDisabled=!1}constructor(...i){super(...i),this.set("_isCssTransitionsDisabled",!1),this.initializeCssTransitionDisablerMixin()}initializeCssTransitionDisablerMixin(){this.extendTemplate({attributes:{class:[this.bindTemplate.if("_isCssTransitionsDisabled","ck-transitions-disabled")]}})}}return e}/**
|
|
8
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
9
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
10
|
+
*/function so({view:n}){n.listenTo(n.element,"submit",(e,t)=>{t.preventDefault(),n.fire("submit")},{useCapture:!0})}/**
|
|
11
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
12
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
13
|
+
*/function Wn({keystrokeHandler:n,focusTracker:e,gridItems:t,numberOfColumns:i,uiLanguageDirection:s}){const o=typeof i=="number"?()=>i:i;n.set("arrowright",r((c,u)=>s==="rtl"?l(c,u.length):a(c,u.length))),n.set("arrowleft",r((c,u)=>s==="rtl"?a(c,u.length):l(c,u.length))),n.set("arrowup",r((c,u)=>{let d=c-o();return d<0&&(d=c+o()*Math.floor(u.length/o()),d>u.length-1&&(d-=o())),d})),n.set("arrowdown",r((c,u)=>{let d=c+o();return d>u.length-1&&(d=c%o()),d}));function r(c){return u=>{const d=t.find(m=>m.element===e.focusedElement),h=t.getIndex(d),f=c(h,t);t.get(f).focus(),u.stopPropagation(),u.preventDefault()}}function a(c,u){return c===u-1?0:c+1}function l(c,u){return c===0?u-1:c-1}}/**
|
|
14
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
15
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
16
|
+
*/function g1(){try{return navigator.userAgent.toLowerCase()}catch{return""}}const Mt=g1(),L={isMac:ph(Mt),isWindows:p1(Mt),isGecko:w1(Mt),isSafari:b1(Mt),isiOS:_1(Mt),isAndroid:v1(Mt),isBlink:y1(Mt),features:{isRegExpUnicodePropertySupported:C1()}};function ph(n){return n.indexOf("macintosh")>-1}function p1(n){return n.indexOf("windows")>-1}function w1(n){return!!n.match(/gecko\/\d+/)}function b1(n){return n.indexOf(" applewebkit/")>-1&&n.indexOf("chrome")===-1}function _1(n){return!!n.match(/iphone|ipad/i)||ph(n)&&navigator.maxTouchPoints>0}function v1(n){return n.indexOf("android")>-1}function y1(n){return n.indexOf("chrome/")>-1&&n.indexOf("edge/")<0}function C1(){let n=!1;try{n="ć".search(new RegExp("[\\p{L}]","u"))===0}catch{}return n}/**
|
|
17
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
18
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
19
|
+
*/function wh(n,e,t,i){t=t||function(l,c){return l===c};const s=Array.isArray(n)?n:Array.prototype.slice.call(n),o=Array.isArray(e)?e:Array.prototype.slice.call(e),r=k1(s,o,t);return i?T1(r,o.length):E1(o,r)}function k1(n,e,t){const i=ml(n,e,t);if(i===-1)return{firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};const s=gl(n,i),o=gl(e,i),r=ml(s,o,t),a=n.length-r,l=e.length-r;return{firstIndex:i,lastIndexOld:a,lastIndexNew:l}}function ml(n,e,t){for(let i=0;i<Math.max(n.length,e.length);i++)if(n[i]===void 0||e[i]===void 0||!t(n[i],e[i]))return i;return-1}function gl(n,e){return n.slice(e).reverse()}function E1(n,e){const t=[],{firstIndex:i,lastIndexOld:s,lastIndexNew:o}=e;return o-i>0&&t.push({index:i,type:"insert",values:n.slice(i,o)}),s-i>0&&t.push({index:i+(o-i),type:"delete",howMany:s-i}),t}function T1(n,e){const{firstIndex:t,lastIndexOld:i,lastIndexNew:s}=n;if(t===-1)return Array(e).fill("equal");let o=[];return t>0&&(o=o.concat(Array(t).fill("equal"))),s-t>0&&(o=o.concat(Array(s-t).fill("insert"))),i-t>0&&(o=o.concat(Array(i-t).fill("delete"))),s<e&&(o=o.concat(Array(e-s).fill("equal"))),o}/**
|
|
20
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
21
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
22
|
+
*/function mn(n,e,t){t=t||function(p,_){return p===_};const i=n.length,s=e.length;if(i>200||s>200||i+s>300)return mn.fastDiff(n,e,t,!0);let o,r;if(s<i){const p=n;n=e,e=p,o="delete",r="insert"}else o="insert",r="delete";const a=n.length,l=e.length,c=l-a,u={},d={};function h(p){const _=(d[p-1]!==void 0?d[p-1]:-1)+1,C=d[p+1]!==void 0?d[p+1]:-1,v=_>C?-1:1;u[p+v]&&(u[p]=u[p+v].slice(0)),u[p]||(u[p]=[]),u[p].push(_>C?o:r);let P=Math.max(_,C),M=P-p;for(;M<a&&P<l&&t(n[M],e[P]);)M++,P++,u[p].push("equal");return P}let f=0,m;do{for(m=-f;m<c;m++)d[m]=h(m);for(m=c+f;m>c;m--)d[m]=h(m);d[c]=h(c),f++}while(d[c]!==l);return u[c].slice(1)}mn.fastDiff=wh;/**
|
|
23
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
24
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
25
|
+
*/function pl(){return function n(){n.called=!0}}/**
|
|
26
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
27
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
28
|
+
*/class _t{constructor(e,t){this.source=e,this.name=t,this.path=[],this.stop=pl(),this.off=pl()}}/**
|
|
29
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
30
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
31
|
+
*/const ve=new Array(256).fill("").map((n,e)=>("0"+e.toString(16)).slice(-2));function Ze(){const n=Math.random()*4294967296>>>0,e=Math.random()*4294967296>>>0,t=Math.random()*4294967296>>>0,i=Math.random()*4294967296>>>0;return"e"+ve[n>>0&255]+ve[n>>8&255]+ve[n>>16&255]+ve[n>>24&255]+ve[e>>0&255]+ve[e>>8&255]+ve[e>>16&255]+ve[e>>24&255]+ve[t>>0&255]+ve[t>>8&255]+ve[t>>16&255]+ve[t>>24&255]+ve[i>>0&255]+ve[i>>8&255]+ve[i>>16&255]+ve[i>>24&255]}/**
|
|
32
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
33
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
34
|
+
*/const Me={get(n="normal"){return typeof n!="number"?this[n]||this.normal:n},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5};/**
|
|
35
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
36
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
37
|
+
*/function bh(n,e){const t=Me.get(e.priority);for(let i=0;i<n.length;i++)if(Me.get(n[i].priority)<t){n.splice(i,0,e);return}n.push(e)}/**
|
|
38
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
39
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
40
|
+
*/const A1="https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html";class g extends Error{constructor(e,t,i){super(S1(e,i)),this.name="CKEditorError",this.context=t,this.data=i}is(e){return e==="CKEditorError"}static rethrowUnexpectedError(e,t){if(e.is&&e.is("CKEditorError"))throw e;const i=new g(e.message,t);throw i.stack=e.stack,i}}function H(n,e){console.warn(...x1(n,e))}function _h(n){return`
|
|
41
|
+
Read more: ${A1}#error-${n}`}function S1(n,e){const t=new WeakSet,s=e?` ${JSON.stringify(e,(r,a)=>{if(typeof a=="object"&&a!==null){if(t.has(a))return`[object ${a.constructor.name}]`;t.add(a)}return a})}`:"",o=_h(n);return n+s+o}function x1(n,e){const t=_h(n);return e?[n,e,t]:[n,t]}/**
|
|
42
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
43
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
44
|
+
*/const I1="41.1.0",P1=new Date(2024,1,7);/* istanbul ignore next -- @preserve */if(globalThis.CKEDITOR_VERSION)throw new g("ckeditor-duplicated-modules",null);globalThis.CKEDITOR_VERSION=I1;/**
|
|
45
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
46
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
47
|
+
*/const Si=Symbol("listeningTo"),mr=Symbol("emitterId"),ct=Symbol("delegations"),vh=Z(Object);function Z(n){if(!n)return vh;class e extends n{on(i,s,o){this.listenTo(this,i,s,o)}once(i,s,o){let r=!1;const a=(l,...c)=>{r||(r=!0,l.off(),s.call(this,l,...c))};this.listenTo(this,i,a,o)}off(i,s){this.stopListening(this,i,s)}listenTo(i,s,o,r={}){let a,l;this[Si]||(this[Si]={});const c=this[Si];Eo(i)||yh(i);const u=Eo(i);(a=c[u])||(a=c[u]={emitter:i,callbacks:{}}),(l=a.callbacks[s])||(l=a.callbacks[s]=[]),l.push(o),B1(this,i,s,o,r)}stopListening(i,s,o){const r=this[Si];let a=i&&Eo(i);const l=r&&a?r[a]:void 0,c=l&&s?l.callbacks[s]:void 0;if(!(!r||i&&!l||s&&!c))if(o)To(this,i,s,o),c.indexOf(o)!==-1&&(c.length===1?delete l.callbacks[s]:To(this,i,s,o));else if(c){for(;o=c.pop();)To(this,i,s,o);delete l.callbacks[s]}else if(l){for(s in l.callbacks)this.stopListening(i,s);delete r[a]}else{for(a in r)this.stopListening(r[a].emitter);delete this[Si]}}fire(i,...s){try{const o=i instanceof _t?i:new _t(this,i),r=o.name;let a=kh(this,r);if(o.path.push(this),a){const c=[o,...s];a=Array.from(a);for(let u=0;u<a.length&&(a[u].callback.apply(this,c),o.off.called&&(delete o.off.called,this._removeEventListener(r,a[u].callback)),!o.stop.called);u++);}const l=this[ct];if(l){const c=l.get(r),u=l.get("*");c&&wl(c,o,s),u&&wl(u,o,s)}return o.return}catch(o){/* istanbul ignore next -- @preserve */g.rethrowUnexpectedError(o,this)}}delegate(...i){return{to:(s,o)=>{this[ct]||(this[ct]=new Map),i.forEach(r=>{const a=this[ct].get(r);a?a.set(s,o):this[ct].set(r,new Map([[s,o]]))})}}}stopDelegating(i,s){if(this[ct])if(!i)this[ct].clear();else if(!s)this[ct].delete(i);else{const o=this[ct].get(i);o&&o.delete(s)}}_addEventListener(i,s,o){L1(this,i);const r=gr(this,i),a=Me.get(o.priority),l={callback:s,priority:a};for(const c of r)bh(c,l)}_removeEventListener(i,s){const o=gr(this,i);for(const r of o)for(let a=0;a<r.length;a++)r[a].callback==s&&(r.splice(a,1),a--)}}return e}["on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach(n=>{Z[n]=vh.prototype[n]});function R1(n,e){const t=n[Si];return t&&t[e]?t[e].emitter:null}function yh(n,e){n[mr]||(n[mr]=e||Ze())}function Eo(n){return n[mr]}function Ch(n){return n._events||Object.defineProperty(n,"_events",{value:{}}),n._events}function V1(){return{callbacks:[],childEvents:[]}}function L1(n,e){const t=Ch(n);if(t[e])return;let i=e,s=null;const o=[];for(;i!==""&&!t[i];)t[i]=V1(),o.push(t[i]),s&&t[i].childEvents.push(s),s=i,i=i.substr(0,i.lastIndexOf(":"));if(i!==""){for(const r of o)r.callbacks=t[i].callbacks.slice();t[i].childEvents.push(s)}}function gr(n,e){const t=Ch(n)[e];if(!t)return[];let i=[t.callbacks];for(let s=0;s<t.childEvents.length;s++){const o=gr(n,t.childEvents[s]);i=i.concat(o)}return i}function kh(n,e){let t;return!n._events||!(t=n._events[e])||!t.callbacks.length?e.indexOf(":")>-1?kh(n,e.substr(0,e.lastIndexOf(":"))):null:t.callbacks}function wl(n,e,t){for(let[i,s]of n){s?typeof s=="function"&&(s=s(e.name)):s=e.name;const o=new _t(e.source,s);o.path=[...e.path],i.fire(o,...t)}}function B1(n,e,t,i,s){e._addEventListener?e._addEventListener(t,i,s):n._addEventListener.call(e,t,i,s)}function To(n,e,t,i){e._removeEventListener?e._removeEventListener(t,i):n._removeEventListener.call(e,t,i)}var Eh=typeof global=="object"&&global&&global.Object===Object&&global,O1=typeof self=="object"&&self&&self.Object===Object&&self,Qe=Eh||O1||Function("return this")(),ot=Qe.Symbol,Th=Object.prototype,M1=Th.hasOwnProperty,F1=Th.toString,en=ot?ot.toStringTag:void 0;function D1(n){var e=M1.call(n,en),t=n[en];try{n[en]=void 0;var i=!0}catch{}var s=F1.call(n);return i&&(e?n[en]=t:delete n[en]),s}var N1=Object.prototype,$1=N1.toString;function z1(n){return $1.call(n)}var H1="[object Null]",U1="[object Undefined]",bl=ot?ot.toStringTag:void 0;function Vt(n){return n==null?n===void 0?U1:H1:bl&&bl in Object(n)?D1(n):z1(n)}function Ue(n){return n!=null&&typeof n=="object"}var W1="[object Symbol]";function oo(n){return typeof n=="symbol"||Ue(n)&&Vt(n)==W1}function Ah(n,e){for(var t=-1,i=n==null?0:n.length,s=Array(i);++t<i;)s[t]=e(n[t],t,n);return s}var Ee=Array.isArray,q1=1/0,_l=ot?ot.prototype:void 0,vl=_l?_l.toString:void 0;function Sh(n){if(typeof n=="string")return n;if(Ee(n))return Ah(n,Sh)+"";if(oo(n))return vl?vl.call(n):"";var e=n+"";return e=="0"&&1/n==-q1?"-0":e}var j1=/\s/;function G1(n){for(var e=n.length;e--&&j1.test(n.charAt(e)););return e}var K1=/^\s+/;function Z1(n){return n&&n.slice(0,G1(n)+1).replace(K1,"")}function ie(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var yl=NaN,J1=/^[-+]0x[0-9a-f]+$/i,Y1=/^0b[01]+$/i,Q1=/^0o[0-7]+$/i,X1=parseInt;function Cl(n){if(typeof n=="number")return n;if(oo(n))return yl;if(ie(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=ie(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=Z1(n);var t=Y1.test(n);return t||Q1.test(n)?X1(n.slice(2),t?2:8):J1.test(n)?yl:+n}function Wt(n){return n}var e0="[object AsyncFunction]",t0="[object Function]",i0="[object GeneratorFunction]",n0="[object Proxy]";function Xt(n){if(!ie(n))return!1;var e=Vt(n);return e==t0||e==i0||e==e0||e==n0}var Ao=Qe["__core-js_shared__"],kl=function(){var n=/[^.]+$/.exec(Ao&&Ao.keys&&Ao.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function s0(n){return!!kl&&kl in n}var o0=Function.prototype,r0=o0.toString;function ri(n){if(n!=null){try{return r0.call(n)}catch{}try{return n+""}catch{}}return""}var a0=/[\\^$.*+?()[\]{}|]/g,l0=/^\[object .+?Constructor\]$/,c0=Function.prototype,u0=Object.prototype,d0=c0.toString,h0=u0.hasOwnProperty,f0=RegExp("^"+d0.call(h0).replace(a0,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m0(n){if(!ie(n)||s0(n))return!1;var e=Xt(n)?f0:l0;return e.test(ri(n))}function g0(n,e){return n?.[e]}function ai(n,e){var t=g0(n,e);return m0(t)?t:void 0}var pr=ai(Qe,"WeakMap"),El=Object.create,p0=function(){function n(){}return function(e){if(!ie(e))return{};if(El)return El(e);n.prototype=e;var t=new n;return n.prototype=void 0,t}}();function w0(n,e,t){switch(t.length){case 0:return n.call(e);case 1:return n.call(e,t[0]);case 2:return n.call(e,t[0],t[1]);case 3:return n.call(e,t[0],t[1],t[2])}return n.apply(e,t)}function ga(n,e){var t=-1,i=n.length;for(e||(e=Array(i));++t<i;)e[t]=n[t];return e}var b0=800,_0=16,v0=Date.now;function y0(n){var e=0,t=0;return function(){var i=v0(),s=_0-(i-t);if(t=i,s>0){if(++e>=b0)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}function C0(n){return function(){return n}}var Ls=function(){try{var n=ai(Object,"defineProperty");return n({},"",{}),n}catch{}}(),k0=Ls?function(n,e){return Ls(n,"toString",{configurable:!0,enumerable:!1,value:C0(e),writable:!0})}:Wt;const E0=k0;var T0=y0(E0);function A0(n,e){for(var t=-1,i=n==null?0:n.length;++t<i&&e(n[t],t,n)!==!1;);return n}function S0(n,e,t,i){for(var s=n.length,o=t+(i?1:-1);i?o--:++o<s;)if(e(n[o],o,n))return o;return-1}function x0(n){return n!==n}function I0(n,e,t){for(var i=t-1,s=n.length;++i<s;)if(n[i]===e)return i;return-1}function P0(n,e,t){return e===e?I0(n,e,t):S0(n,x0,t)}var R0=9007199254740991,V0=/^(?:0|[1-9]\d*)$/;function pa(n,e){var t=typeof n;return e=e??R0,!!e&&(t=="number"||t!="symbol"&&V0.test(n))&&n>-1&&n%1==0&&n<e}function wa(n,e,t){e=="__proto__"&&Ls?Ls(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):n[e]=t}function qn(n,e){return n===e||n!==n&&e!==e}var L0=Object.prototype,B0=L0.hasOwnProperty;function ba(n,e,t){var i=n[e];(!(B0.call(n,e)&&qn(i,t))||t===void 0&&!(e in n))&&wa(n,e,t)}function ji(n,e,t,i){var s=!t;t||(t={});for(var o=-1,r=e.length;++o<r;){var a=e[o],l=i?i(t[a],n[a],a,t,n):void 0;l===void 0&&(l=n[a]),s?wa(t,a,l):ba(t,a,l)}return t}var Tl=Math.max;function O0(n,e,t){return e=Tl(e===void 0?n.length-1:e,0),function(){for(var i=arguments,s=-1,o=Tl(i.length-e,0),r=Array(o);++s<o;)r[s]=i[e+s];s=-1;for(var a=Array(e+1);++s<e;)a[s]=i[s];return a[e]=t(r),w0(n,this,a)}}function xh(n,e){return T0(O0(n,e,Wt),n+"")}var M0=9007199254740991;function Ih(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=M0}function ro(n){return n!=null&&Ih(n.length)&&!Xt(n)}function F0(n,e,t){if(!ie(t))return!1;var i=typeof e;return(i=="number"?ro(t)&&pa(e,t.length):i=="string"&&e in t)?qn(t[e],n):!1}function _a(n){return xh(function(e,t){var i=-1,s=t.length,o=s>1?t[s-1]:void 0,r=s>2?t[2]:void 0;for(o=n.length>3&&typeof o=="function"?(s--,o):void 0,r&&F0(t[0],t[1],r)&&(o=s<3?void 0:o,s=1),e=Object(e);++i<s;){var a=t[i];a&&n(e,a,i,o)}return e})}var D0=Object.prototype;function va(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||D0;return n===t}function N0(n,e){for(var t=-1,i=Array(n);++t<n;)i[t]=e(t);return i}var $0="[object Arguments]";function Al(n){return Ue(n)&&Vt(n)==$0}var Ph=Object.prototype,z0=Ph.hasOwnProperty,H0=Ph.propertyIsEnumerable,wr=Al(function(){return arguments}())?Al:function(n){return Ue(n)&&z0.call(n,"callee")&&!H0.call(n,"callee")};function U0(){return!1}var Rh=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Sl=Rh&&typeof module=="object"&&module&&!module.nodeType&&module,W0=Sl&&Sl.exports===Rh,xl=W0?Qe.Buffer:void 0,q0=xl?xl.isBuffer:void 0,Cn=q0||U0,j0="[object Arguments]",G0="[object Array]",K0="[object Boolean]",Z0="[object Date]",J0="[object Error]",Y0="[object Function]",Q0="[object Map]",X0="[object Number]",ew="[object Object]",tw="[object RegExp]",iw="[object Set]",nw="[object String]",sw="[object WeakMap]",ow="[object ArrayBuffer]",rw="[object DataView]",aw="[object Float32Array]",lw="[object Float64Array]",cw="[object Int8Array]",uw="[object Int16Array]",dw="[object Int32Array]",hw="[object Uint8Array]",fw="[object Uint8ClampedArray]",mw="[object Uint16Array]",gw="[object Uint32Array]",ee={};ee[aw]=ee[lw]=ee[cw]=ee[uw]=ee[dw]=ee[hw]=ee[fw]=ee[mw]=ee[gw]=!0;ee[j0]=ee[G0]=ee[ow]=ee[K0]=ee[rw]=ee[Z0]=ee[J0]=ee[Y0]=ee[Q0]=ee[X0]=ee[ew]=ee[tw]=ee[iw]=ee[nw]=ee[sw]=!1;function pw(n){return Ue(n)&&Ih(n.length)&&!!ee[Vt(n)]}function ao(n){return function(e){return n(e)}}var Vh=typeof exports=="object"&&exports&&!exports.nodeType&&exports,gn=Vh&&typeof module=="object"&&module&&!module.nodeType&&module,ww=gn&&gn.exports===Vh,So=ww&&Eh.process,Fi=function(){try{var n=gn&&gn.require&&gn.require("util").types;return n||So&&So.binding&&So.binding("util")}catch{}}(),Il=Fi&&Fi.isTypedArray,ya=Il?ao(Il):pw,bw=Object.prototype,_w=bw.hasOwnProperty;function Lh(n,e){var t=Ee(n),i=!t&&wr(n),s=!t&&!i&&Cn(n),o=!t&&!i&&!s&&ya(n),r=t||i||s||o,a=r?N0(n.length,String):[],l=a.length;for(var c in n)(e||_w.call(n,c))&&!(r&&(c=="length"||s&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||pa(c,l)))&&a.push(c);return a}function Bh(n,e){return function(t){return n(e(t))}}var vw=Bh(Object.keys,Object),yw=Object.prototype,Cw=yw.hasOwnProperty;function kw(n){if(!va(n))return vw(n);var e=[];for(var t in Object(n))Cw.call(n,t)&&t!="constructor"&&e.push(t);return e}function Ca(n){return ro(n)?Lh(n):kw(n)}function Ew(n){var e=[];if(n!=null)for(var t in Object(n))e.push(t);return e}var Tw=Object.prototype,Aw=Tw.hasOwnProperty;function Sw(n){if(!ie(n))return Ew(n);var e=va(n),t=[];for(var i in n)i=="constructor"&&(e||!Aw.call(n,i))||t.push(i);return t}function Gi(n){return ro(n)?Lh(n,!0):Sw(n)}var Oh=_a(function(n,e){ji(e,Gi(e),n)}),xw=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Iw=/^\w*$/;function Pw(n,e){if(Ee(n))return!1;var t=typeof n;return t=="number"||t=="symbol"||t=="boolean"||n==null||oo(n)?!0:Iw.test(n)||!xw.test(n)||e!=null&&n in Object(e)}var kn=ai(Object,"create");function Rw(){this.__data__=kn?kn(null):{},this.size=0}function Vw(n){var e=this.has(n)&&delete this.__data__[n];return this.size-=e?1:0,e}var Lw="__lodash_hash_undefined__",Bw=Object.prototype,Ow=Bw.hasOwnProperty;function Mw(n){var e=this.__data__;if(kn){var t=e[n];return t===Lw?void 0:t}return Ow.call(e,n)?e[n]:void 0}var Fw=Object.prototype,Dw=Fw.hasOwnProperty;function Nw(n){var e=this.__data__;return kn?e[n]!==void 0:Dw.call(e,n)}var $w="__lodash_hash_undefined__";function zw(n,e){var t=this.__data__;return this.size+=this.has(n)?0:1,t[n]=kn&&e===void 0?$w:e,this}function ei(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}ei.prototype.clear=Rw;ei.prototype.delete=Vw;ei.prototype.get=Mw;ei.prototype.has=Nw;ei.prototype.set=zw;function Hw(){this.__data__=[],this.size=0}function lo(n,e){for(var t=n.length;t--;)if(qn(n[t][0],e))return t;return-1}var Uw=Array.prototype,Ww=Uw.splice;function qw(n){var e=this.__data__,t=lo(e,n);if(t<0)return!1;var i=e.length-1;return t==i?e.pop():Ww.call(e,t,1),--this.size,!0}function jw(n){var e=this.__data__,t=lo(e,n);return t<0?void 0:e[t][1]}function Gw(n){return lo(this.__data__,n)>-1}function Kw(n,e){var t=this.__data__,i=lo(t,n);return i<0?(++this.size,t.push([n,e])):t[i][1]=e,this}function kt(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}kt.prototype.clear=Hw;kt.prototype.delete=qw;kt.prototype.get=jw;kt.prototype.has=Gw;kt.prototype.set=Kw;var En=ai(Qe,"Map");function Zw(){this.size=0,this.__data__={hash:new ei,map:new(En||kt),string:new ei}}function Jw(n){var e=typeof n;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?n!=="__proto__":n===null}function co(n,e){var t=n.__data__;return Jw(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Yw(n){var e=co(this,n).delete(n);return this.size-=e?1:0,e}function Qw(n){return co(this,n).get(n)}function Xw(n){return co(this,n).has(n)}function eb(n,e){var t=co(this,n),i=t.size;return t.set(n,e),this.size+=t.size==i?0:1,this}function Et(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var i=n[e];this.set(i[0],i[1])}}Et.prototype.clear=Zw;Et.prototype.delete=Yw;Et.prototype.get=Qw;Et.prototype.has=Xw;Et.prototype.set=eb;var tb="Expected a function";function ka(n,e){if(typeof n!="function"||e!=null&&typeof e!="function")throw new TypeError(tb);var t=function(){var i=arguments,s=e?e.apply(this,i):i[0],o=t.cache;if(o.has(s))return o.get(s);var r=n.apply(this,i);return t.cache=o.set(s,r)||o,r};return t.cache=new(ka.Cache||Et),t}ka.Cache=Et;var ib=500;function nb(n){var e=ka(n,function(i){return t.size===ib&&t.clear(),i}),t=e.cache;return e}var sb=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ob=/\\(\\)?/g,rb=nb(function(n){var e=[];return n.charCodeAt(0)===46&&e.push(""),n.replace(sb,function(t,i,s,o){e.push(s?o.replace(ob,"$1"):i||t)}),e});function jn(n){return n==null?"":Sh(n)}function Ea(n,e){return Ee(n)?n:Pw(n,e)?[n]:rb(jn(n))}var ab=1/0;function Ta(n){if(typeof n=="string"||oo(n))return n;var e=n+"";return e=="0"&&1/n==-ab?"-0":e}function Mh(n,e){e=Ea(e,n);for(var t=0,i=e.length;n!=null&&t<i;)n=n[Ta(e[t++])];return t&&t==i?n:void 0}function Bs(n,e,t){var i=n==null?void 0:Mh(n,e);return i===void 0?t:i}function Fh(n,e){for(var t=-1,i=e.length,s=n.length;++t<i;)n[s+t]=e[t];return n}var Aa=Bh(Object.getPrototypeOf,Object),lb="[object Object]",cb=Function.prototype,ub=Object.prototype,Dh=cb.toString,db=ub.hasOwnProperty,hb=Dh.call(Object);function Se(n){if(!Ue(n)||Vt(n)!=lb)return!1;var e=Aa(n);if(e===null)return!0;var t=db.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&Dh.call(t)==hb}function Nh(n,e,t){var i=-1,s=n.length;e<0&&(e=-e>s?0:s+e),t=t>s?s:t,t<0&&(t+=s),s=e>t?0:t-e>>>0,e>>>=0;for(var o=Array(s);++i<s;)o[i]=n[i+e];return o}function fb(n,e,t){var i=n.length;return t=t===void 0?i:t,!e&&t>=i?n:Nh(n,e,t)}var mb="\\ud800-\\udfff",gb="\\u0300-\\u036f",pb="\\ufe20-\\ufe2f",wb="\\u20d0-\\u20ff",bb=gb+pb+wb,_b="\\ufe0e\\ufe0f",vb="\\u200d",yb=RegExp("["+vb+mb+bb+_b+"]");function $h(n){return yb.test(n)}function Cb(n){return n.split("")}var zh="\\ud800-\\udfff",kb="\\u0300-\\u036f",Eb="\\ufe20-\\ufe2f",Tb="\\u20d0-\\u20ff",Ab=kb+Eb+Tb,Sb="\\ufe0e\\ufe0f",xb="["+zh+"]",br="["+Ab+"]",_r="\\ud83c[\\udffb-\\udfff]",Ib="(?:"+br+"|"+_r+")",Hh="[^"+zh+"]",Uh="(?:\\ud83c[\\udde6-\\uddff]){2}",Wh="[\\ud800-\\udbff][\\udc00-\\udfff]",Pb="\\u200d",qh=Ib+"?",jh="["+Sb+"]?",Rb="(?:"+Pb+"(?:"+[Hh,Uh,Wh].join("|")+")"+jh+qh+")*",Vb=jh+qh+Rb,Lb="(?:"+[Hh+br+"?",br,Uh,Wh,xb].join("|")+")",Bb=RegExp(_r+"(?="+_r+")|"+Lb+Vb,"g");function Ob(n){return n.match(Bb)||[]}function Mb(n){return $h(n)?Ob(n):Cb(n)}function Fb(n){return function(e){e=jn(e);var t=$h(e)?Mb(e):void 0,i=t?t[0]:e.charAt(0),s=t?fb(t,1).join(""):e.slice(1);return i[n]()+s}}var Gh=Fb("toUpperCase");function Db(n,e,t,i){var s=-1,o=n==null?0:n.length;for(i&&o&&(t=n[++s]);++s<o;)t=e(t,n[s],s,n);return t}function Nb(n){return function(e){return n?.[e]}}var $b={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},zb=Nb($b);const Hb=zb;var Ub=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Wb="\\u0300-\\u036f",qb="\\ufe20-\\ufe2f",jb="\\u20d0-\\u20ff",Gb=Wb+qb+jb,Kb="["+Gb+"]",Zb=RegExp(Kb,"g");function Jb(n){return n=jn(n),n&&n.replace(Ub,Hb).replace(Zb,"")}var Yb=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Qb(n){return n.match(Yb)||[]}var Xb=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function e_(n){return Xb.test(n)}var Kh="\\ud800-\\udfff",t_="\\u0300-\\u036f",i_="\\ufe20-\\ufe2f",n_="\\u20d0-\\u20ff",s_=t_+i_+n_,Zh="\\u2700-\\u27bf",Jh="a-z\\xdf-\\xf6\\xf8-\\xff",o_="\\xac\\xb1\\xd7\\xf7",r_="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",a_="\\u2000-\\u206f",l_=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Yh="A-Z\\xc0-\\xd6\\xd8-\\xde",c_="\\ufe0e\\ufe0f",Qh=o_+r_+a_+l_,Xh="['’]",Pl="["+Qh+"]",u_="["+s_+"]",ef="\\d+",d_="["+Zh+"]",tf="["+Jh+"]",nf="[^"+Kh+Qh+ef+Zh+Jh+Yh+"]",h_="\\ud83c[\\udffb-\\udfff]",f_="(?:"+u_+"|"+h_+")",m_="[^"+Kh+"]",sf="(?:\\ud83c[\\udde6-\\uddff]){2}",of="[\\ud800-\\udbff][\\udc00-\\udfff]",xi="["+Yh+"]",g_="\\u200d",Rl="(?:"+tf+"|"+nf+")",p_="(?:"+xi+"|"+nf+")",Vl="(?:"+Xh+"(?:d|ll|m|re|s|t|ve))?",Ll="(?:"+Xh+"(?:D|LL|M|RE|S|T|VE))?",rf=f_+"?",af="["+c_+"]?",w_="(?:"+g_+"(?:"+[m_,sf,of].join("|")+")"+af+rf+")*",b_="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",__="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",v_=af+rf+w_,y_="(?:"+[d_,sf,of].join("|")+")"+v_,C_=RegExp([xi+"?"+tf+"+"+Vl+"(?="+[Pl,xi,"$"].join("|")+")",p_+"+"+Ll+"(?="+[Pl,xi+Rl,"$"].join("|")+")",xi+"?"+Rl+"+"+Vl,xi+"+"+Ll,__,b_,ef,y_].join("|"),"g");function k_(n){return n.match(C_)||[]}function E_(n,e,t){return n=jn(n),e=t?void 0:e,e===void 0?e_(n)?k_(n):Qb(n):n.match(e)||[]}var T_="['’]",A_=RegExp(T_,"g");function S_(n){return function(e){return Db(E_(Jb(e).replace(A_,"")),n,"")}}function x_(){this.__data__=new kt,this.size=0}function I_(n){var e=this.__data__,t=e.delete(n);return this.size=e.size,t}function P_(n){return this.__data__.get(n)}function R_(n){return this.__data__.has(n)}var V_=200;function L_(n,e){var t=this.__data__;if(t instanceof kt){var i=t.__data__;if(!En||i.length<V_-1)return i.push([n,e]),this.size=++t.size,this;t=this.__data__=new Et(i)}return t.set(n,e),this.size=t.size,this}function it(n){var e=this.__data__=new kt(n);this.size=e.size}it.prototype.clear=x_;it.prototype.delete=I_;it.prototype.get=P_;it.prototype.has=R_;it.prototype.set=L_;function B_(n,e){return n&&ji(e,Ca(e),n)}function O_(n,e){return n&&ji(e,Gi(e),n)}var lf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Bl=lf&&typeof module=="object"&&module&&!module.nodeType&&module,M_=Bl&&Bl.exports===lf,Ol=M_?Qe.Buffer:void 0,Ml=Ol?Ol.allocUnsafe:void 0;function cf(n,e){if(e)return n.slice();var t=n.length,i=Ml?Ml(t):new n.constructor(t);return n.copy(i),i}function F_(n,e){for(var t=-1,i=n==null?0:n.length,s=0,o=[];++t<i;){var r=n[t];e(r,t,n)&&(o[s++]=r)}return o}function uf(){return[]}var D_=Object.prototype,N_=D_.propertyIsEnumerable,Fl=Object.getOwnPropertySymbols,Sa=Fl?function(n){return n==null?[]:(n=Object(n),F_(Fl(n),function(e){return N_.call(n,e)}))}:uf;function $_(n,e){return ji(n,Sa(n),e)}var z_=Object.getOwnPropertySymbols,df=z_?function(n){for(var e=[];n;)Fh(e,Sa(n)),n=Aa(n);return e}:uf;function H_(n,e){return ji(n,df(n),e)}function hf(n,e,t){var i=e(n);return Ee(n)?i:Fh(i,t(n))}function vr(n){return hf(n,Ca,Sa)}function U_(n){return hf(n,Gi,df)}var yr=ai(Qe,"DataView"),Cr=ai(Qe,"Promise"),kr=ai(Qe,"Set"),Dl="[object Map]",W_="[object Object]",Nl="[object Promise]",$l="[object Set]",zl="[object WeakMap]",Hl="[object DataView]",q_=ri(yr),j_=ri(En),G_=ri(Cr),K_=ri(kr),Z_=ri(pr),Ht=Vt;(yr&&Ht(new yr(new ArrayBuffer(1)))!=Hl||En&&Ht(new En)!=Dl||Cr&&Ht(Cr.resolve())!=Nl||kr&&Ht(new kr)!=$l||pr&&Ht(new pr)!=zl)&&(Ht=function(n){var e=Vt(n),t=e==W_?n.constructor:void 0,i=t?ri(t):"";if(i)switch(i){case q_:return Hl;case j_:return Dl;case G_:return Nl;case K_:return $l;case Z_:return zl}return e});const Tn=Ht;var J_=Object.prototype,Y_=J_.hasOwnProperty;function Q_(n){var e=n.length,t=new n.constructor(e);return e&&typeof n[0]=="string"&&Y_.call(n,"index")&&(t.index=n.index,t.input=n.input),t}var Os=Qe.Uint8Array;function xa(n){var e=new n.constructor(n.byteLength);return new Os(e).set(new Os(n)),e}function X_(n,e){var t=e?xa(n.buffer):n.buffer;return new n.constructor(t,n.byteOffset,n.byteLength)}var ev=/\w*$/;function tv(n){var e=new n.constructor(n.source,ev.exec(n));return e.lastIndex=n.lastIndex,e}var Ul=ot?ot.prototype:void 0,Wl=Ul?Ul.valueOf:void 0;function iv(n){return Wl?Object(Wl.call(n)):{}}function ff(n,e){var t=e?xa(n.buffer):n.buffer;return new n.constructor(t,n.byteOffset,n.length)}var nv="[object Boolean]",sv="[object Date]",ov="[object Map]",rv="[object Number]",av="[object RegExp]",lv="[object Set]",cv="[object String]",uv="[object Symbol]",dv="[object ArrayBuffer]",hv="[object DataView]",fv="[object Float32Array]",mv="[object Float64Array]",gv="[object Int8Array]",pv="[object Int16Array]",wv="[object Int32Array]",bv="[object Uint8Array]",_v="[object Uint8ClampedArray]",vv="[object Uint16Array]",yv="[object Uint32Array]";function Cv(n,e,t){var i=n.constructor;switch(e){case dv:return xa(n);case nv:case sv:return new i(+n);case hv:return X_(n,t);case fv:case mv:case gv:case pv:case wv:case bv:case _v:case vv:case yv:return ff(n,t);case ov:return new i;case rv:case cv:return new i(n);case av:return tv(n);case lv:return new i;case uv:return iv(n)}}function mf(n){return typeof n.constructor=="function"&&!va(n)?p0(Aa(n)):{}}var kv="[object Map]";function Ev(n){return Ue(n)&&Tn(n)==kv}var ql=Fi&&Fi.isMap,Tv=ql?ao(ql):Ev,Av="[object Set]";function Sv(n){return Ue(n)&&Tn(n)==Av}var jl=Fi&&Fi.isSet,xv=jl?ao(jl):Sv,Iv=1,Pv=2,Rv=4,gf="[object Arguments]",Vv="[object Array]",Lv="[object Boolean]",Bv="[object Date]",Ov="[object Error]",pf="[object Function]",Mv="[object GeneratorFunction]",Fv="[object Map]",Dv="[object Number]",wf="[object Object]",Nv="[object RegExp]",$v="[object Set]",zv="[object String]",Hv="[object Symbol]",Uv="[object WeakMap]",Wv="[object ArrayBuffer]",qv="[object DataView]",jv="[object Float32Array]",Gv="[object Float64Array]",Kv="[object Int8Array]",Zv="[object Int16Array]",Jv="[object Int32Array]",Yv="[object Uint8Array]",Qv="[object Uint8ClampedArray]",Xv="[object Uint16Array]",ey="[object Uint32Array]",Y={};Y[gf]=Y[Vv]=Y[Wv]=Y[qv]=Y[Lv]=Y[Bv]=Y[jv]=Y[Gv]=Y[Kv]=Y[Zv]=Y[Jv]=Y[Fv]=Y[Dv]=Y[wf]=Y[Nv]=Y[$v]=Y[zv]=Y[Hv]=Y[Yv]=Y[Qv]=Y[Xv]=Y[ey]=!0;Y[Ov]=Y[pf]=Y[Uv]=!1;function Oi(n,e,t,i,s,o){var r,a=e&Iv,l=e&Pv,c=e&Rv;if(t&&(r=s?t(n,i,s,o):t(n)),r!==void 0)return r;if(!ie(n))return n;var u=Ee(n);if(u){if(r=Q_(n),!a)return ga(n,r)}else{var d=Tn(n),h=d==pf||d==Mv;if(Cn(n))return cf(n,a);if(d==wf||d==gf||h&&!s){if(r=l||h?{}:mf(n),!a)return l?H_(n,O_(r,n)):$_(n,B_(r,n))}else{if(!Y[d])return s?n:{};r=Cv(n,d,a)}}o||(o=new it);var f=o.get(n);if(f)return f;o.set(n,r),xv(n)?n.forEach(function(_){r.add(Oi(_,e,t,_,n,o))}):Tv(n)&&n.forEach(function(_,C){r.set(C,Oi(_,e,t,C,n,o))});var m=c?l?U_:vr:l?Gi:Ca,p=u?void 0:m(n);return A0(p||n,function(_,C){p&&(C=_,_=n[C]),ba(r,C,Oi(_,e,t,C,n,o))}),r}var ty=4;function bf(n){return Oi(n,ty)}var iy=1,ny=4;function Tt(n){return Oi(n,iy|ny)}var sy=1,oy=4;function Ia(n,e){return e=typeof e=="function"?e:void 0,Oi(n,sy|oy,e)}var ry="__lodash_hash_undefined__";function ay(n){return this.__data__.set(n,ry),this}function ly(n){return this.__data__.has(n)}function Ms(n){var e=-1,t=n==null?0:n.length;for(this.__data__=new Et;++e<t;)this.add(n[e])}Ms.prototype.add=Ms.prototype.push=ay;Ms.prototype.has=ly;function cy(n,e){for(var t=-1,i=n==null?0:n.length;++t<i;)if(e(n[t],t,n))return!0;return!1}function uy(n,e){return n.has(e)}var dy=1,hy=2;function _f(n,e,t,i,s,o){var r=t&dy,a=n.length,l=e.length;if(a!=l&&!(r&&l>a))return!1;var c=o.get(n),u=o.get(e);if(c&&u)return c==e&&u==n;var d=-1,h=!0,f=t&hy?new Ms:void 0;for(o.set(n,e),o.set(e,n);++d<a;){var m=n[d],p=e[d];if(i)var _=r?i(p,m,d,e,n,o):i(m,p,d,n,e,o);if(_!==void 0){if(_)continue;h=!1;break}if(f){if(!cy(e,function(C,v){if(!uy(f,v)&&(m===C||s(m,C,t,i,o)))return f.push(v)})){h=!1;break}}else if(!(m===p||s(m,p,t,i,o))){h=!1;break}}return o.delete(n),o.delete(e),h}function fy(n){var e=-1,t=Array(n.size);return n.forEach(function(i,s){t[++e]=[s,i]}),t}function my(n){var e=-1,t=Array(n.size);return n.forEach(function(i){t[++e]=i}),t}var gy=1,py=2,wy="[object Boolean]",by="[object Date]",_y="[object Error]",vy="[object Map]",yy="[object Number]",Cy="[object RegExp]",ky="[object Set]",Ey="[object String]",Ty="[object Symbol]",Ay="[object ArrayBuffer]",Sy="[object DataView]",Gl=ot?ot.prototype:void 0,xo=Gl?Gl.valueOf:void 0;function xy(n,e,t,i,s,o,r){switch(t){case Sy:if(n.byteLength!=e.byteLength||n.byteOffset!=e.byteOffset)return!1;n=n.buffer,e=e.buffer;case Ay:return!(n.byteLength!=e.byteLength||!o(new Os(n),new Os(e)));case wy:case by:case yy:return qn(+n,+e);case _y:return n.name==e.name&&n.message==e.message;case Cy:case Ey:return n==e+"";case vy:var a=fy;case ky:var l=i&gy;if(a||(a=my),n.size!=e.size&&!l)return!1;var c=r.get(n);if(c)return c==e;i|=py,r.set(n,e);var u=_f(a(n),a(e),i,s,o,r);return r.delete(n),u;case Ty:if(xo)return xo.call(n)==xo.call(e)}return!1}var Iy=1,Py=Object.prototype,Ry=Py.hasOwnProperty;function Vy(n,e,t,i,s,o){var r=t&Iy,a=vr(n),l=a.length,c=vr(e),u=c.length;if(l!=u&&!r)return!1;for(var d=l;d--;){var h=a[d];if(!(r?h in e:Ry.call(e,h)))return!1}var f=o.get(n),m=o.get(e);if(f&&m)return f==e&&m==n;var p=!0;o.set(n,e),o.set(e,n);for(var _=r;++d<l;){h=a[d];var C=n[h],v=e[h];if(i)var P=r?i(v,C,h,e,n,o):i(C,v,h,n,e,o);if(!(P===void 0?C===v||s(C,v,t,i,o):P)){p=!1;break}_||(_=h=="constructor")}if(p&&!_){var M=n.constructor,D=e.constructor;M!=D&&"constructor"in n&&"constructor"in e&&!(typeof M=="function"&&M instanceof M&&typeof D=="function"&&D instanceof D)&&(p=!1)}return o.delete(n),o.delete(e),p}var Ly=1,Kl="[object Arguments]",Zl="[object Array]",os="[object Object]",By=Object.prototype,Jl=By.hasOwnProperty;function Oy(n,e,t,i,s,o){var r=Ee(n),a=Ee(e),l=r?Zl:Tn(n),c=a?Zl:Tn(e);l=l==Kl?os:l,c=c==Kl?os:c;var u=l==os,d=c==os,h=l==c;if(h&&Cn(n)){if(!Cn(e))return!1;r=!0,u=!1}if(h&&!u)return o||(o=new it),r||ya(n)?_f(n,e,t,i,s,o):xy(n,e,l,t,i,s,o);if(!(t&Ly)){var f=u&&Jl.call(n,"__wrapped__"),m=d&&Jl.call(e,"__wrapped__");if(f||m){var p=f?n.value():n,_=m?e.value():e;return o||(o=new it),s(p,_,t,i,o)}}return h?(o||(o=new it),Vy(n,e,t,i,s,o)):!1}function Pa(n,e,t,i,s){return n===e?!0:n==null||e==null||!Ue(n)&&!Ue(e)?n!==n&&e!==e:Oy(n,e,t,i,Pa,s)}function My(n){return function(e,t,i){for(var s=-1,o=Object(e),r=i(e),a=r.length;a--;){var l=r[n?a:++s];if(t(o[l],l,o)===!1)break}return e}}var Fy=My(),Io=function(){return Qe.Date.now()},Dy="Expected a function",Ny=Math.max,$y=Math.min;function Di(n,e,t){var i,s,o,r,a,l,c=0,u=!1,d=!1,h=!0;if(typeof n!="function")throw new TypeError(Dy);e=Cl(e)||0,ie(t)&&(u=!!t.leading,d="maxWait"in t,o=d?Ny(Cl(t.maxWait)||0,e):o,h="trailing"in t?!!t.trailing:h);function f(A){var V=i,x=s;return i=s=void 0,c=A,r=n.apply(x,V),r}function m(A){return c=A,a=setTimeout(C,e),u?f(A):r}function p(A){var V=A-l,x=A-c,X=e-V;return d?$y(X,o-x):X}function _(A){var V=A-l,x=A-c;return l===void 0||V>=e||V<0||d&&x>=o}function C(){var A=Io();if(_(A))return v(A);a=setTimeout(C,p(A))}function v(A){return a=void 0,h&&i?f(A):(i=s=void 0,r)}function P(){a!==void 0&&clearTimeout(a),c=0,i=l=s=a=void 0}function M(){return a===void 0?r:v(Io())}function D(){var A=Io(),V=_(A);if(i=arguments,s=this,l=A,V){if(a===void 0)return m(l);if(d)return clearTimeout(a),a=setTimeout(C,e),f(l)}return a===void 0&&(a=setTimeout(C,e)),r}return D.cancel=P,D.flush=M,D}function Er(n,e,t){(t!==void 0&&!qn(n[e],t)||t===void 0&&!(e in n))&&wa(n,e,t)}function zy(n){return Ue(n)&&ro(n)}function Tr(n,e){if(!(e==="constructor"&&typeof n[e]=="function")&&e!="__proto__")return n[e]}function Hy(n){return ji(n,Gi(n))}function Uy(n,e,t,i,s,o,r){var a=Tr(n,t),l=Tr(e,t),c=r.get(l);if(c){Er(n,t,c);return}var u=o?o(a,l,t+"",n,e,r):void 0,d=u===void 0;if(d){var h=Ee(l),f=!h&&Cn(l),m=!h&&!f&&ya(l);u=l,h||f||m?Ee(a)?u=a:zy(a)?u=ga(a):f?(d=!1,u=cf(l,!0)):m?(d=!1,u=ff(l,!0)):u=[]:Se(l)||wr(l)?(u=a,wr(a)?u=Hy(a):(!ie(a)||Xt(a))&&(u=mf(l))):d=!1}d&&(r.set(l,u),s(u,l,i,o,r),r.delete(l)),Er(n,t,u)}function Ra(n,e,t,i,s){n!==e&&Fy(e,function(o,r){if(s||(s=new it),ie(o))Uy(n,e,r,t,Ra,i,s);else{var a=i?i(Tr(n,r),o,r+"",n,e,s):void 0;a===void 0&&(a=o),Er(n,r,a)}},Gi)}var Wy=_a(function(n,e,t,i){Ra(n,e,t,i)});function qy(n){var e=n==null?0:n.length;return e?n[e-1]:void 0}var vf=/[\\^$.*+?()[\]{}|]/g,jy=RegExp(vf.source);function Gy(n){return n=jn(n),n&&jy.test(n)?n.replace(vf,"\\$&"):n}var Ky="[object String]";function Yl(n){return typeof n=="string"||!Ee(n)&&Ue(n)&&Vt(n)==Ky}function Zy(n,e){return e.length<2?n:Mh(n,Nh(e,0,-1))}function ti(n){return Ue(n)&&n.nodeType===1&&!Se(n)}function Fs(n,e){return Pa(n,e)}function Jy(n,e,t){t=typeof t=="function"?t:void 0;var i=t?t(n,e):void 0;return i===void 0?Pa(n,e,void 0,t):!!i}var yf=_a(function(n,e,t){Ra(n,e,t)});function Yy(n,e){return e=Ea(e,n),n=Zy(n,e),n==null||delete n[Ta(qy(e))]}function Qy(n,e,t,i){if(!ie(n))return n;e=Ea(e,n);for(var s=-1,o=e.length,r=o-1,a=n;a!=null&&++s<o;){var l=Ta(e[s]),c=t;if(l==="__proto__"||l==="constructor"||l==="prototype")return n;if(s!=r){var u=a[l];c=i?i(u,l,a):void 0,c===void 0&&(c=ie(u)?u:pa(e[s+1])?[]:{})}ba(a,l,c),a=a[l]}return n}function Xy(n,e,t,i){for(var s=t-1,o=n.length;++s<o;)if(i(n[s],e))return s;return-1}var e2=Array.prototype,Ql=e2.splice;function t2(n,e,t,i){var s=i?Xy:P0,o=-1,r=e.length,a=n;for(n===e&&(e=ga(e)),t&&(a=Ah(n,ao(t)));++o<r;)for(var l=0,c=e[o],u=t?t(c):c;(l=s(a,u,l,i))>-1;)a!==n&&Ql.call(a,l,1),Ql.call(n,l,1);return n}function i2(n,e){return n&&n.length&&e&&e.length?t2(n,e):n}var n2=xh(i2);function s2(n,e,t){return n==null?n:Qy(n,e,t)}var o2=S_(function(n,e,t){return n+(t?" ":"")+Gh(e)}),r2="Expected a function";function An(n,e,t){var i=!0,s=!0;if(typeof n!="function")throw new TypeError(r2);return ie(t)&&(i="leading"in t?!!t.leading:i,s="trailing"in t?!!t.trailing:s),Di(n,e,{leading:i,maxWait:e,trailing:s})}function a2(n,e){return n==null?!0:Yy(n,e)}/**
|
|
48
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
49
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
50
|
+
*/const Ds=Symbol("observableProperties"),uo=Symbol("boundObservables"),Ns=Symbol("boundProperties"),wi=Symbol("decoratedMethods"),Xl=Symbol("decoratedOriginal"),Cf=U(Z());function U(n){if(!n)return Cf;class e extends n{set(i,s){if(ie(i)){Object.keys(i).forEach(r=>{this.set(r,i[r])},this);return}Po(this);const o=this[Ds];if(i in this&&!o.has(i))throw new g("observable-set-cannot-override",this);Object.defineProperty(this,i,{enumerable:!0,configurable:!0,get(){return o.get(i)},set(r){const a=o.get(i);let l=this.fire(`set:${i}`,i,r,a);l===void 0&&(l=r),(a!==l||!o.has(i))&&(o.set(i,l),this.fire(`change:${i}`,i,l,a))}}),this[i]=s}bind(...i){if(!i.length||!ec(i))throw new g("observable-bind-wrong-properties",this);if(new Set(i).size!==i.length)throw new g("observable-bind-duplicate-properties",this);Po(this);const s=this[Ns];i.forEach(r=>{if(s.has(r))throw new g("observable-bind-rebind",this)});const o=new Map;return i.forEach(r=>{const a={property:r,to:[]};s.set(r,a),o.set(r,a)}),{to:l2,toMany:c2,_observable:this,_bindProperties:i,_to:[],_bindings:o}}unbind(...i){if(!this[Ds])return;const s=this[Ns],o=this[uo];if(i.length){if(!ec(i))throw new g("observable-unbind-wrong-properties",this);i.forEach(r=>{const a=s.get(r);a&&(a.to.forEach(([l,c])=>{const u=o.get(l),d=u[c];d.delete(a),d.size||delete u[c],Object.keys(u).length||(o.delete(l),this.stopListening(l,"change"))}),s.delete(r))})}else o.forEach((r,a)=>{this.stopListening(a,"change")}),o.clear(),s.clear()}decorate(i){Po(this);const s=this[i];if(!s)throw new g("observablemixin-cannot-decorate-undefined",this,{object:this,methodName:i});this.on(i,(o,r)=>{o.return=s.apply(this,r)}),this[i]=function(...o){return this.fire(i,o)},this[i][Xl]=s,this[wi]||(this[wi]=[]),this[wi].push(i)}stopListening(i,s,o){if(!i&&this[wi]){for(const r of this[wi])this[r]=this[r][Xl];delete this[wi]}super.stopListening(i,s,o)}}return e}["set","bind","unbind","decorate","on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach(n=>{U[n]=Cf.prototype[n]});function Po(n){n[Ds]||(Object.defineProperty(n,Ds,{value:new Map}),Object.defineProperty(n,uo,{value:new Map}),Object.defineProperty(n,Ns,{value:new Map}))}function l2(...n){const e=d2(...n),t=Array.from(this._bindings.keys()),i=t.length;if(!e.callback&&e.to.length>1)throw new g("observable-bind-to-no-callback",this);if(i>1&&e.callback)throw new g("observable-bind-to-extra-callback",this);e.to.forEach(s=>{if(s.properties.length&&s.properties.length!==i)throw new g("observable-bind-to-properties-length",this);s.properties.length||(s.properties=this._bindProperties)}),this._to=e.to,e.callback&&(this._bindings.get(t[0]).callback=e.callback),m2(this._observable,this._to),f2(this),this._bindProperties.forEach(s=>{kf(this._observable,s)})}function c2(n,e,t){if(this._bindings.size>1)throw new g("observable-bind-to-many-not-one-binding",this);this.to(...u2(n,e),t)}function u2(n,e){const t=n.map(i=>[i,e]);return Array.prototype.concat.apply([],t)}function ec(n){return n.every(e=>typeof e=="string")}function d2(...n){if(!n.length)throw new g("observable-bind-to-parse-error",null);const e={to:[]};let t;return typeof n[n.length-1]=="function"&&(e.callback=n.pop()),n.forEach(i=>{if(typeof i=="string")t.properties.push(i);else if(typeof i=="object")t={observable:i,properties:[]},e.to.push(t);else throw new g("observable-bind-to-parse-error",null)}),e}function h2(n,e,t,i){const s=n[uo],o=s.get(t),r=o||{};r[i]||(r[i]=new Set),r[i].add(e),o||s.set(t,r)}function f2(n){let e;n._bindings.forEach((t,i)=>{n._to.forEach(s=>{e=s.properties[t.callback?0:n._bindProperties.indexOf(i)],t.to.push([s.observable,e]),h2(n._observable,t,s.observable,e)})})}function kf(n,e){const i=n[Ns].get(e);let s;i.callback?s=i.callback.apply(n,i.to.map(o=>o[0][o[1]])):(s=i.to[0],s=s[0][s[1]]),Object.prototype.hasOwnProperty.call(n,e)?n[e]=s:n.set(e,s)}function m2(n,e){e.forEach(t=>{const i=n[uo];let s;i.get(t.observable)||n.listenTo(t.observable,"change",(o,r)=>{s=i.get(t.observable)[r],s&&s.forEach(a=>{kf(n,a.property)})})})}/**
|
|
51
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
52
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
53
|
+
*/class Ef{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=[]}}/**
|
|
54
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
55
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
56
|
+
*/function Ar(n){let e=0;for(const t of n)e++;return e}/**
|
|
57
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
58
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
59
|
+
*/function ye(n,e){const t=Math.min(n.length,e.length);for(let i=0;i<t;i++)if(n[i]!=e[i])return i;return n.length==e.length?"same":n.length<e.length?"prefix":"extension"}/**
|
|
60
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
61
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
62
|
+
*/function De(n){return!!(n&&n[Symbol.iterator])}/**
|
|
63
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
64
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
65
|
+
*/function Sn(n,e,t={},i=[]){const s=t&&t.xmlns,o=s?n.createElementNS(s,e):n.createElement(e);for(const r in t)o.setAttribute(r,t[r]);(Yl(i)||!De(i))&&(i=[i]);for(let r of i)Yl(r)&&(r=n.createTextNode(r)),o.appendChild(r);return o}/**
|
|
66
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
67
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
68
|
+
*/class Tf{constructor(e,t){this._config={},t&&this.define(tc(t)),e&&this._setObjectToTarget(this._config,e)}set(e,t){this._setToTarget(this._config,e,t)}define(e,t){this._setToTarget(this._config,e,t,!0)}get(e){return this._getFromSource(this._config,e)}*names(){for(const e of Object.keys(this._config))yield e}_setToTarget(e,t,i,s=!1){if(Se(t)){this._setObjectToTarget(e,t,s);return}const o=t.split(".");t=o.pop();for(const r of o)Se(e[r])||(e[r]={}),e=e[r];if(Se(i)){Se(e[t])||(e[t]={}),e=e[t],this._setObjectToTarget(e,i,s);return}s&&typeof e[t]<"u"||(e[t]=i)}_getFromSource(e,t){const i=t.split(".");t=i.pop();for(const s of i){if(!Se(e[s])){e=null;break}e=e[s]}return e?tc(e[t]):void 0}_setObjectToTarget(e,t,i){Object.keys(t).forEach(s=>{this._setToTarget(e,s,t[s],i)})}}function tc(n){return Ia(n,g2)}function g2(n){return ti(n)||typeof n=="function"?n:void 0}/**
|
|
69
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
70
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
71
|
+
*/function Pt(n){if(n){if(n.defaultView)return n instanceof n.defaultView.Document;if(n.ownerDocument&&n.ownerDocument.defaultView)return n instanceof n.ownerDocument.defaultView.Node}return!1}/**
|
|
72
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
73
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
74
|
+
*/function $s(n){const e=Object.prototype.toString.apply(n);return e=="[object Window]"||e=="[object global]"}/**
|
|
75
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
76
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
77
|
+
*/const Af=$e(Z());function $e(n){if(!n)return Af;class e extends n{listenTo(i,s,o,r={}){if(Pt(i)||$s(i)){const a={capture:!!r.useCapture,passive:!!r.usePassive},l=this._getProxyEmitter(i,a)||new p2(i,a);this.listenTo(l,s,o,r)}else super.listenTo(i,s,o,r)}stopListening(i,s,o){if(Pt(i)||$s(i)){const r=this._getAllProxyEmitters(i);for(const a of r)this.stopListening(a,s,o)}else super.stopListening(i,s,o)}_getProxyEmitter(i,s){return R1(this,Sf(i,s))}_getAllProxyEmitters(i){return[{capture:!1,passive:!1},{capture:!1,passive:!0},{capture:!0,passive:!1},{capture:!0,passive:!0}].map(s=>this._getProxyEmitter(i,s)).filter(s=>!!s)}}return e}["_getProxyEmitter","_getAllProxyEmitters","on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach(n=>{$e[n]=Af.prototype[n]});class p2 extends Z(){constructor(e,t){super(),yh(this,Sf(e,t)),this._domNode=e,this._options=t}attach(e){if(this._domListeners&&this._domListeners[e])return;const t=this._createDomListener(e);this._domNode.addEventListener(e,t,this._options),this._domListeners||(this._domListeners={}),this._domListeners[e]=t}detach(e){let t;this._domListeners[e]&&(!(t=this._events[e])||!t.callbacks.length)&&this._domListeners[e].removeListener()}_addEventListener(e,t,i){this.attach(e),Z().prototype._addEventListener.call(this,e,t,i)}_removeEventListener(e,t){Z().prototype._removeEventListener.call(this,e,t),this.detach(e)}_createDomListener(e){const t=i=>{this.fire(e,i)};return t.removeListener=()=>{this._domNode.removeEventListener(e,t,this._options),delete this._domListeners[e]},t}}function w2(n){return n["data-ck-expando"]||(n["data-ck-expando"]=Ze())}function Sf(n,e){let t=w2(n);for(const i of Object.keys(e).sort())e[i]&&(t+="-"+i);return t}/**
|
|
78
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
79
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
80
|
+
*/let Sr;try{Sr={window,document}}catch{/* istanbul ignore next -- @preserve */Sr={window:{},document:{}}}const E=Sr;/**
|
|
81
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
82
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
83
|
+
*/function b2(n){const e=[];let t=n;for(;t&&t.nodeType!=Node.DOCUMENT_NODE;)e.unshift(t),t=t.parentNode;return e}/**
|
|
84
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
85
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
86
|
+
*/function _2(n){return n instanceof HTMLTextAreaElement?n.value:n.innerHTML}/**
|
|
87
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
88
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
89
|
+
*/function xf(n){const e=n.ownerDocument.defaultView.getComputedStyle(n);return{top:parseInt(e.borderTopWidth,10),right:parseInt(e.borderRightWidth,10),bottom:parseInt(e.borderBottomWidth,10),left:parseInt(e.borderLeftWidth,10)}}/**
|
|
90
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
91
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
92
|
+
*/function ue(n){return Object.prototype.toString.call(n)=="[object Text]"}/**
|
|
93
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
94
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
95
|
+
*/function ho(n){return Object.prototype.toString.apply(n)=="[object Range]"}/**
|
|
96
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
97
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
98
|
+
*/function If(n){return!n||!n.parentNode||n.offsetParent===E.document.body?null:n.offsetParent}/**
|
|
99
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
100
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
101
|
+
*/const Pf=["top","right","bottom","left","width","height"];class O{constructor(e){const t=ho(e);if(Object.defineProperty(this,"_source",{value:e._source||e,writable:!0,enumerable:!1}),xr(e)||t)if(t){const i=O.getDomRangeRects(e);rs(this,O.getBoundingRect(i))}else rs(this,e.getBoundingClientRect());else if($s(e)){const{innerWidth:i,innerHeight:s}=e;rs(this,{top:0,right:i,bottom:s,left:0,width:i,height:s})}else rs(this,e)}clone(){return new O(this)}moveTo(e,t){return this.top=t,this.right=e+this.width,this.bottom=t+this.height,this.left=e,this}moveBy(e,t){return this.top+=t,this.right+=e,this.left+=e,this.bottom+=t,this}getIntersection(e){const t={top:Math.max(this.top,e.top),right:Math.min(this.right,e.right),bottom:Math.min(this.bottom,e.bottom),left:Math.max(this.left,e.left),width:0,height:0};if(t.width=t.right-t.left,t.height=t.bottom-t.top,t.width<0||t.height<0)return null;{const i=new O(t);return i._source=this._source,i}}getIntersectionArea(e){const t=this.getIntersection(e);return t?t.getArea():0}getArea(){return this.width*this.height}getVisible(){const e=this._source;let t=this.clone();if(ic(e))return t;let i=e,s=e.parentNode||e.commonAncestorContainer,o;for(;s&&!ic(s);){const r=v2(s)==="visible";i instanceof HTMLElement&&nc(i)==="absolute"&&(o=i);const a=nc(s);if(r||o&&(a==="relative"&&r||a!=="relative")){i=s,s=s.parentNode;continue}const l=new O(s),c=t.getIntersection(l);if(c)c.getArea()<t.getArea()&&(t=c);else return null;i=s,s=s.parentNode}return t}isEqual(e){for(const t of Pf)if(this[t]!==e[t])return!1;return!0}contains(e){const t=this.getIntersection(e);return!!(t&&t.isEqual(e))}toAbsoluteRect(){const{scrollX:e,scrollY:t}=E.window,i=this.clone().moveBy(e,t);if(xr(i._source)){const s=If(i._source);s&&y2(i,s)}return i}excludeScrollbarsAndBorders(){const e=this._source;let t,i,s;if($s(e))t=e.innerWidth-e.document.documentElement.clientWidth,i=e.innerHeight-e.document.documentElement.clientHeight,s=e.getComputedStyle(e.document.documentElement).direction;else{const o=xf(e);t=e.offsetWidth-e.clientWidth-o.left-o.right,i=e.offsetHeight-e.clientHeight-o.top-o.bottom,s=e.ownerDocument.defaultView.getComputedStyle(e).direction,this.left+=o.left,this.top+=o.top,this.right-=o.right,this.bottom-=o.bottom,this.width=this.right-this.left,this.height=this.bottom-this.top}return this.width-=t,s==="ltr"?this.right-=t:this.left+=t,this.height-=i,this.bottom-=i,this}static getDomRangeRects(e){const t=[],i=Array.from(e.getClientRects());if(i.length)for(const s of i)t.push(new O(s));else{let s=e.startContainer;ue(s)&&(s=s.parentNode);const o=new O(s.getBoundingClientRect());o.right=o.left,o.width=0,t.push(o)}return t}static getBoundingRect(e){const t={left:Number.POSITIVE_INFINITY,top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,width:0,height:0};let i=0;for(const s of e)i++,t.left=Math.min(t.left,s.left),t.top=Math.min(t.top,s.top),t.right=Math.max(t.right,s.right),t.bottom=Math.max(t.bottom,s.bottom);return i==0?null:(t.width=t.right-t.left,t.height=t.bottom-t.top,new O(t))}}function rs(n,e){for(const t of Pf)n[t]=e[t]}function ic(n){return xr(n)?n===n.ownerDocument.body:!1}function xr(n){return n!==null&&typeof n=="object"&&n.nodeType===1&&typeof n.getBoundingClientRect=="function"}function nc(n){return n instanceof HTMLElement?n.ownerDocument.defaultView.getComputedStyle(n).position:"static"}function v2(n){return n instanceof HTMLElement?n.ownerDocument.defaultView.getComputedStyle(n).overflow:"visible"}function y2(n,e){const t=new O(e),i=xf(e);let s=0,o=0;s-=t.left,o-=t.top,s+=e.scrollLeft,o+=e.scrollTop,s-=i.left,o-=i.top,n.moveBy(s,o)}/**
|
|
102
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
103
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
104
|
+
*/class Q{constructor(e,t){Q._observerInstance||Q._createObserver(),this._element=e,this._callback=t,Q._addElementCallback(e,t),Q._observerInstance.observe(e)}get element(){return this._element}destroy(){Q._deleteElementCallback(this._element,this._callback)}static _addElementCallback(e,t){Q._elementCallbacks||(Q._elementCallbacks=new Map);let i=Q._elementCallbacks.get(e);i||(i=new Set,Q._elementCallbacks.set(e,i)),i.add(t)}static _deleteElementCallback(e,t){const i=Q._getElementCallbacks(e);i&&(i.delete(t),i.size||(Q._elementCallbacks.delete(e),Q._observerInstance.unobserve(e))),Q._elementCallbacks&&!Q._elementCallbacks.size&&(Q._observerInstance=null,Q._elementCallbacks=null)}static _getElementCallbacks(e){return Q._elementCallbacks?Q._elementCallbacks.get(e):null}static _createObserver(){Q._observerInstance=new E.window.ResizeObserver(e=>{for(const t of e){const i=Q._getElementCallbacks(t.target);if(i)for(const s of i)s(t)}})}}Q._observerInstance=null;Q._elementCallbacks=null;/**
|
|
105
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
106
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
107
|
+
*/function sc(n,e){n instanceof HTMLTextAreaElement&&(n.value=e),n.innerHTML=e}/**
|
|
108
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
109
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
110
|
+
*/function Ki(n){return e=>e+n}/**
|
|
111
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
112
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
113
|
+
*/function as(n){let e=0;for(;n.previousSibling;)n=n.previousSibling,e++;return e}/**
|
|
114
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
115
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
116
|
+
*/function Rf(n,e,t){n.insertBefore(t,n.childNodes[e]||null)}/**
|
|
117
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
118
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
119
|
+
*/function pn(n){return n&&n.nodeType===Node.COMMENT_NODE}/**
|
|
120
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
121
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
122
|
+
*/function Vf(n){try{E.document.createAttribute(n)}catch{return!1}return!0}/**
|
|
123
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
124
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
125
|
+
*/function ii(n){return!!(n&&n.getClientRects&&n.getClientRects().length)}/**
|
|
126
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
127
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
128
|
+
*/function Va({element:n,target:e,positions:t,limiter:i,fitInViewport:s,viewportOffsetConfig:o}){Xt(e)&&(e=e()),Xt(i)&&(i=i());const r=If(n),a=C2(o),l=new O(n),c=oc(e,a);let u;if(!c||!a.getIntersection(c))return null;const d={targetRect:c,elementRect:l,positionedElementAncestor:r,viewportRect:a};if(!i&&!s)u=new Lf(t[0],d);else{if(i){const h=oc(i,a);h&&(d.limiterRect=h)}u=k2(t,d)}return u}function oc(n,e){const t=new O(n).getVisible();return t?t.getIntersection(e):null}function C2(n){n=Object.assign({top:0,bottom:0,left:0,right:0},n);const e=new O(E.window);return e.top+=n.top,e.height-=n.top,e.bottom-=n.bottom,e.height-=n.bottom,e}function k2(n,e){const{elementRect:t}=e,i=t.getArea(),s=n.map(a=>new Lf(a,e)).filter(a=>!!a.name);let o=0,r=null;for(const a of s){const{limiterIntersectionArea:l,viewportIntersectionArea:c}=a;if(l===i)return a;const u=c**2+l**2;u>o&&(o=u,r=a)}return r}class Lf{constructor(e,t){const i=e(t.targetRect,t.elementRect,t.viewportRect,t.limiterRect);if(!i)return;const{left:s,top:o,name:r,config:a}=i;this.name=r,this.config=a,this._positioningFunctionCoordinates={left:s,top:o},this._options=t}get left(){return this._absoluteRect.left}get top(){return this._absoluteRect.top}get limiterIntersectionArea(){const e=this._options.limiterRect;return e?e.getIntersectionArea(this._rect):0}get viewportIntersectionArea(){return this._options.viewportRect.getIntersectionArea(this._rect)}get _rect(){return this._cachedRect?this._cachedRect:(this._cachedRect=this._options.elementRect.clone().moveTo(this._positioningFunctionCoordinates.left,this._positioningFunctionCoordinates.top),this._cachedRect)}get _absoluteRect(){return this._cachedAbsoluteRect?this._cachedAbsoluteRect:(this._cachedAbsoluteRect=this._rect.toAbsoluteRect(),this._cachedAbsoluteRect)}}/**
|
|
129
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
130
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
131
|
+
*/function rc(n){const e=n.parentNode;e&&e.removeChild(n)}/**
|
|
132
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
133
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
134
|
+
*/function E2({target:n,viewportOffset:e=0,ancestorOffset:t=0,alignToTop:i,forceScroll:s}){const o=La(n);let r=o,a=null;for(e=S2(e);r;){let l;r==o?l=ac(n):l=ac(a),A2({parent:l,getRect:()=>lc(n,r),alignToTop:i,ancestorOffset:t,forceScroll:s});const c=lc(n,r);if(T2({window:r,rect:c,viewportOffset:e,alignToTop:i,forceScroll:s}),r.parent!=r){if(a=r.frameElement,r=r.parent,!a)return}else r=null}}function T2({window:n,rect:e,alignToTop:t,forceScroll:i,viewportOffset:s}){const o=e.clone().moveBy(0,s.bottom),r=e.clone().moveBy(0,-s.top),a=new O(n).excludeScrollbarsAndBorders(),l=[r,o],c=t&&i,u=l.every(p=>a.contains(p));let{scrollX:d,scrollY:h}=n;const f=d,m=h;c?h-=a.top-e.top+s.top:u||(Of(r,a)?h-=a.top-e.top+s.top:Bf(o,a)&&(t?h+=e.top-a.top-s.top:h+=e.bottom-a.bottom+s.bottom)),u||(Mf(e,a)?d-=a.left-e.left+s.left:Ff(e,a)&&(d+=e.right-a.right+s.right)),(d!=f||h!==m)&&n.scrollTo(d,h)}function A2({parent:n,getRect:e,alignToTop:t,forceScroll:i,ancestorOffset:s=0,limiterElement:o}){const r=La(n),a=t&&i;let l,c,u;const d=o||r.document.body;for(;n!=d;)c=e(),l=new O(n).excludeScrollbarsAndBorders(),u=l.contains(c),a?n.scrollTop-=l.top-c.top+s:u||(Of(c,l)?n.scrollTop-=l.top-c.top+s:Bf(c,l)&&(t?n.scrollTop+=c.top-l.top-s:n.scrollTop+=c.bottom-l.bottom+s)),u||(Mf(c,l)?n.scrollLeft-=l.left-c.left+s:Ff(c,l)&&(n.scrollLeft+=c.right-l.right+s)),n=n.parentNode}function Bf(n,e){return n.bottom>e.bottom}function Of(n,e){return n.top<e.top}function Mf(n,e){return n.left<e.left}function Ff(n,e){return n.right>e.right}function La(n){return ho(n)?n.startContainer.ownerDocument.defaultView:n.ownerDocument.defaultView}function ac(n){if(ho(n)){let e=n.commonAncestorContainer;return ue(e)&&(e=e.parentNode),e}else return n.parentNode}function lc(n,e){const t=La(n),i=new O(n);if(t===e)return i;{let s=t;for(;s!=e;){const o=s.frameElement,r=new O(o).excludeScrollbarsAndBorders();i.moveBy(r.left,r.top),s=s.parent}}return i}function S2(n){return typeof n=="number"?{top:n,bottom:n,left:n,right:n}:n}/**
|
|
135
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
136
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
137
|
+
*/const x2={ctrl:"⌃",cmd:"⌘",alt:"⌥",shift:"⇧"},I2={ctrl:"Ctrl+",alt:"Alt+",shift:"Shift+"},N=B2(),P2=Object.fromEntries(Object.entries(N).map(([n,e])=>[e,n.charAt(0).toUpperCase()+n.slice(1)]));function Ni(n){let e;if(typeof n=="string"){if(e=N[n.toLowerCase()],!e)throw new g("keyboard-unknown-key",null,{key:n})}else e=n.keyCode+(n.altKey?N.alt:0)+(n.ctrlKey?N.ctrl:0)+(n.shiftKey?N.shift:0)+(n.metaKey?N.cmd:0);return e}function Gn(n){return typeof n=="string"&&(n=O2(n)),n.map(e=>typeof e=="string"?V2(e):e).reduce((e,t)=>t+e,0)}function cc(n){let e=Gn(n);return Object.entries(L.isMac||L.isiOS?x2:I2).reduce((s,[o,r])=>(e&N[o]&&(e&=~N[o],s+=r),s),"")+(e?P2[e]:"")}function R2(n){return n==N.arrowright||n==N.arrowleft||n==N.arrowup||n==N.arrowdown}function Ba(n,e){const t=e==="ltr";switch(n){case N.arrowleft:return t?"left":"right";case N.arrowright:return t?"right":"left";case N.arrowup:return"up";case N.arrowdown:return"down"}}function V2(n){if(n.endsWith("!"))return Ni(n.slice(0,-1));const e=Ni(n);return(L.isMac||L.isiOS)&&e==N.ctrl?N.cmd:e}function L2(n,e){const t=Ba(n,e);return t==="down"||t==="right"}function B2(){const n={arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,backspace:8,delete:46,enter:13,space:32,esc:27,tab:9,ctrl:1114112,shift:2228224,alt:4456448,cmd:8912896};for(let e=65;e<=90;e++){const t=String.fromCharCode(e);n[t.toLowerCase()]=e}for(let e=48;e<=57;e++)n[e-48]=e;for(let e=112;e<=123;e++)n["f"+(e-111)]=e;for(const e of"`-=[];',./\\")n[e]=e.charCodeAt(0);return n}function O2(n){return n.split("+").map(e=>e.trim())}/**
|
|
138
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
139
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
140
|
+
*/const M2=["ar","ara","fa","per","fas","he","heb","ku","kur","ug","uig"];function uc(n){return M2.includes(n)?"rtl":"ltr"}/**
|
|
141
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
142
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
143
|
+
*/function K(n){return Array.isArray(n)?n:[n]}/**
|
|
144
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
145
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
146
|
+
*//* istanbul ignore else -- @preserve */E.window.CKEDITOR_TRANSLATIONS||(E.window.CKEDITOR_TRANSLATIONS={});function F2(n,e,t=1){if(typeof t!="number")throw new g("translation-service-quantity-not-a-number",null,{quantity:t});const i=N2();i===1&&(n=Object.keys(E.window.CKEDITOR_TRANSLATIONS)[0]);const s=e.id||e.string;if(i===0||!D2(n,s))return t!==1?e.plural:e.string;const o=E.window.CKEDITOR_TRANSLATIONS[n].dictionary,r=E.window.CKEDITOR_TRANSLATIONS[n].getPluralForm||(c=>c===1?0:1),a=o[s];if(typeof a=="string")return a;const l=Number(r(t));return a[l]}function D2(n,e){return!!E.window.CKEDITOR_TRANSLATIONS[n]&&!!E.window.CKEDITOR_TRANSLATIONS[n].dictionary[e]}function N2(){return Object.keys(E.window.CKEDITOR_TRANSLATIONS).length}/**
|
|
147
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
148
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
149
|
+
*/class $2{constructor({uiLanguage:e="en",contentLanguage:t}={}){this.uiLanguage=e,this.contentLanguage=t||this.uiLanguage,this.uiLanguageDirection=uc(this.uiLanguage),this.contentLanguageDirection=uc(this.contentLanguage),this.t=(i,s)=>this._t(i,s)}get language(){return console.warn("locale-deprecated-language-property: The Locale#language property has been deprecated and will be removed in the near future. Please use #uiLanguage and #contentLanguage properties instead."),this.uiLanguage}_t(e,t=[]){t=K(t),typeof e=="string"&&(e={string:e});const s=!!e.plural?t[0]:1,o=F2(this.uiLanguage,e,s);return z2(o,t)}}function z2(n,e){return n.replace(/%(\d+)/g,(t,i)=>i<e.length?e[i]:t)}/**
|
|
150
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
151
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
152
|
+
*/class _e extends Z(){constructor(e={},t={}){super();const i=De(e);if(i||(t=e),this._items=[],this._itemMap=new Map,this._idProperty=t.idProperty||"id",this._bindToExternalToInternalMap=new WeakMap,this._bindToInternalToExternalMap=new WeakMap,this._skippedIndexesFromExternal=[],i)for(const s of e)this._items.push(s),this._itemMap.set(this._getItemIdBeforeAdding(s),s)}get length(){return this._items.length}get first(){return this._items[0]||null}get last(){return this._items[this.length-1]||null}add(e,t){return this.addMany([e],t)}addMany(e,t){if(t===void 0)t=this._items.length;else if(t>this._items.length||t<0)throw new g("collection-add-item-invalid-index",this);let i=0;for(const s of e){const o=this._getItemIdBeforeAdding(s),r=t+i;this._items.splice(r,0,s),this._itemMap.set(o,s),this.fire("add",s,r),i++}return this.fire("change",{added:e,removed:[],index:t}),this}get(e){let t;if(typeof e=="string")t=this._itemMap.get(e);else if(typeof e=="number")t=this._items[e];else throw new g("collection-get-invalid-arg",this);return t||null}has(e){if(typeof e=="string")return this._itemMap.has(e);{const t=this._idProperty,i=e[t];return i&&this._itemMap.has(i)}}getIndex(e){let t;return typeof e=="string"?t=this._itemMap.get(e):t=e,t?this._items.indexOf(t):-1}remove(e){const[t,i]=this._remove(e);return this.fire("change",{added:[],removed:[t],index:i}),t}map(e,t){return this._items.map(e,t)}forEach(e,t){this._items.forEach(e,t)}find(e,t){return this._items.find(e,t)}filter(e,t){return this._items.filter(e,t)}clear(){this._bindToCollection&&(this.stopListening(this._bindToCollection),this._bindToCollection=null);const e=Array.from(this._items);for(;this.length;)this._remove(0);this.fire("change",{added:[],removed:e,index:0})}bindTo(e){if(this._bindToCollection)throw new g("collection-bind-to-rebind",this);return this._bindToCollection=e,{as:t=>{this._setUpBindToBinding(i=>new t(i))},using:t=>{typeof t=="function"?this._setUpBindToBinding(t):this._setUpBindToBinding(i=>i[t])}}}_setUpBindToBinding(e){const t=this._bindToCollection,i=(s,o,r)=>{const a=t._bindToCollection==this,l=t._bindToInternalToExternalMap.get(o);if(a&&l)this._bindToExternalToInternalMap.set(o,l),this._bindToInternalToExternalMap.set(l,o);else{const c=e(o);if(!c){this._skippedIndexesFromExternal.push(r);return}let u=r;for(const d of this._skippedIndexesFromExternal)r>d&&u--;for(const d of t._skippedIndexesFromExternal)u>=d&&u++;this._bindToExternalToInternalMap.set(o,c),this._bindToInternalToExternalMap.set(c,o),this.add(c,u);for(let d=0;d<t._skippedIndexesFromExternal.length;d++)u<=t._skippedIndexesFromExternal[d]&&t._skippedIndexesFromExternal[d]++}};for(const s of t)i(null,s,t.getIndex(s));this.listenTo(t,"add",i),this.listenTo(t,"remove",(s,o,r)=>{const a=this._bindToExternalToInternalMap.get(o);a&&this.remove(a),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce((l,c)=>(r<c&&l.push(c-1),r>c&&l.push(c),l),[])})}_getItemIdBeforeAdding(e){const t=this._idProperty;let i;if(t in e){if(i=e[t],typeof i!="string")throw new g("collection-add-invalid-id",this);if(this.get(i))throw new g("collection-add-item-already-exists",this)}else e[t]=i=Ze();return i}_remove(e){let t,i,s,o=!1;const r=this._idProperty;if(typeof e=="string"?(i=e,s=this._itemMap.get(i),o=!s,s&&(t=this._items.indexOf(s))):typeof e=="number"?(t=e,s=this._items[t],o=!s,s&&(i=s[r])):(s=e,i=s[r],t=this._items.indexOf(s),o=t==-1||!this._itemMap.get(i)),o)throw new g("collection-remove-404",this);this._items.splice(t,1),this._itemMap.delete(i);const a=this._bindToInternalToExternalMap.get(s);return this._bindToInternalToExternalMap.delete(s),this._bindToExternalToInternalMap.delete(a),this.fire("remove",s,t),[s,t]}[Symbol.iterator](){return this._items[Symbol.iterator]()}}/**
|
|
153
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
154
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
155
|
+
*/function J(n){const e=n.next();return e.done?null:e.value}/**
|
|
156
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
157
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
158
|
+
*/class ne extends $e(U()){constructor(){super(),this._elements=new Set,this._nextEventLoopTimeout=null,this.set("isFocused",!1),this.set("focusedElement",null)}add(e){if(this._elements.has(e))throw new g("focustracker-add-element-already-exist",this);this.listenTo(e,"focus",()=>this._focus(e),{useCapture:!0}),this.listenTo(e,"blur",()=>this._blur(),{useCapture:!0}),this._elements.add(e)}remove(e){e===this.focusedElement&&this._blur(),this._elements.has(e)&&(this.stopListening(e),this._elements.delete(e))}destroy(){this.stopListening()}_focus(e){clearTimeout(this._nextEventLoopTimeout),this.focusedElement=e,this.isFocused=!0}_blur(){clearTimeout(this._nextEventLoopTimeout),this._nextEventLoopTimeout=setTimeout(()=>{this.focusedElement=null,this.isFocused=!1},0)}}/**
|
|
159
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
160
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
161
|
+
*/class ae{constructor(){this._listener=new($e())}listenTo(e){this._listener.listenTo(e,"keydown",(t,i)=>{this._listener.fire("_keydown:"+Ni(i),i)})}set(e,t,i={}){const s=Gn(e),o=i.priority;this._listener.listenTo(this._listener,"_keydown:"+s,(r,a)=>{t(a,()=>{a.preventDefault(),a.stopPropagation(),r.stop()}),r.return=!0},{priority:o})}press(e){return!!this._listener.fire("_keydown:"+Ni(e),e)}stopListening(e){this._listener.stopListening(e)}destroy(){this.stopListening()}}/**
|
|
162
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
163
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
164
|
+
*/function H2(n){const e=new Map;for(const t in n)e.set(t,n[t]);return e}/**
|
|
165
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
166
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
167
|
+
*/function vt(n){return De(n)?new Map(n):H2(n)}/**
|
|
168
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
169
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
170
|
+
*/const U2=1e4;function W2(n,e,t,i){if(Math.max(e.length,n.length)>U2)return n.slice(0,t).concat(e).concat(n.slice(t+i,n.length));{const s=Array.from(n);return s.splice(t,i,...e),s}}/**
|
|
171
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
172
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
173
|
+
*/function Oa(n,e){let t;function i(...s){i.cancel(),t=setTimeout(()=>n(...s),e)}return i.cancel=()=>{clearTimeout(t)},i}/**
|
|
174
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
175
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
176
|
+
*/function q2(n){function e(d){return d.length>=40&&d.length<=255?"VALID":"INVALID"}if(!n)return"INVALID";let t="";try{t=atob(n)}catch{return"INVALID"}const i=t.split("-"),s=i[0],o=i[1];if(!o)return e(n);try{atob(o)}catch{try{if(atob(s),!atob(s).length)return e(n)}catch{return e(n)}}if(s.length<40||s.length>255)return"INVALID";let r="";try{atob(s),r=atob(o)}catch{return"INVALID"}if(r.length!==8)return"INVALID";const a=Number(r.substring(0,4)),l=Number(r.substring(4,6))-1,c=Number(r.substring(6,8)),u=new Date(a,l,c);return u<P1||isNaN(Number(u))?"INVALID":"VALID"}/**
|
|
177
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
178
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
179
|
+
*/function j2(n){return!!n&&n.length==1&&/[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/.test(n)}function G2(n){return!!n&&n.length==1&&/[\ud800-\udbff]/.test(n)}function K2(n){return!!n&&n.length==1&&/[\udc00-\udfff]/.test(n)}function Ma(n,e){return G2(n.charAt(e-1))&&K2(n.charAt(e))}function Fa(n,e){return j2(n.charAt(e))}const Z2=J2();function Df(n,e){const t=String(n).matchAll(Z2);return Array.from(t).some(i=>i.index<e&&e<i.index+i[0].length)}function J2(){const n=[/\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],e=/\p{Regional_Indicator}{2}/u.source,t="(?:"+n.map(s=>s.source).join("|")+")",i=`${e}|${t}(?:${t})*`;return new RegExp(i,"ug")}/**
|
|
180
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
181
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
182
|
+
*/class Ae extends _e{constructor(e=[]){super(e,{idProperty:"viewUid"}),this.on("add",(t,i,s)=>{this._renderViewIntoCollectionParent(i,s)}),this.on("remove",(t,i)=>{i.element&&this._parentElement&&i.element.remove()}),this._parentElement=null}destroy(){this.map(e=>e.destroy())}setParent(e){this._parentElement=e;for(const t of this)this._renderViewIntoCollectionParent(t)}delegate(...e){if(!e.length||!Y2(e))throw new g("ui-viewcollection-delegate-wrong-events",this);return{to:t=>{for(const i of this)for(const s of e)i.delegate(s).to(t);this.on("add",(i,s)=>{for(const o of e)s.delegate(o).to(t)}),this.on("remove",(i,s)=>{for(const o of e)s.stopDelegating(o,t)})}}}_renderViewIntoCollectionParent(e,t){e.isRendered||e.render(),e.element&&this._parentElement&&this._parentElement.insertBefore(e.element,this._parentElement.children[t])}remove(e){return super.remove(e)}}function Y2(n){return n.every(e=>typeof e=="string")}/**
|
|
183
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
184
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
185
|
+
*/let T=class extends $e(U()){constructor(e){super(),this.element=null,this.isRendered=!1,this.locale=e,this.t=e&&e.t,this._viewCollections=new _e,this._unboundChildren=this.createCollection(),this._viewCollections.on("add",(t,i)=>{i.locale=e,i.t=e&&e.t}),this.decorate("render")}get bindTemplate(){return this._bindTemplate?this._bindTemplate:this._bindTemplate=xe.bind(this,this)}createCollection(e){const t=new Ae(e);return this._viewCollections.add(t),t}registerChild(e){De(e)||(e=[e]);for(const t of e)this._unboundChildren.add(t)}deregisterChild(e){De(e)||(e=[e]);for(const t of e)this._unboundChildren.remove(t)}setTemplate(e){this.template=new xe(e)}extendTemplate(e){xe.extend(this.template,e)}render(){if(this.isRendered)throw new g("ui-view-render-already-rendered",this);this.template&&(this.element=this.template.render(),this.registerChild(this.template.getViews())),this.isRendered=!0}destroy(){this.stopListening(),this._viewCollections.map(e=>e.destroy()),this.template&&this.template._revertData&&this.template.revert(this.element)}};/**
|
|
186
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
187
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
188
|
+
*/const Q2="http://www.w3.org/1999/xhtml";class xe extends Z(){constructor(e){super(),Object.assign(this,hc(dc(e))),this._isRendered=!1,this._revertData=null}render(){const e=this._renderNode({intoFragment:!0});return this._isRendered=!0,e}apply(e){return this._revertData=gc(),this._renderNode({node:e,intoFragment:!1,isApplying:!0,revertData:this._revertData}),e}revert(e){if(!this._revertData)throw new g("ui-template-revert-not-applied",[this,e]);this._revertTemplateFromNode(e,this._revertData)}*getViews(){function*e(t){if(t.children)for(const i of t.children)zs(i)?yield i:Da(i)&&(yield*e(i))}yield*e(this)}static bind(e,t){return{to(i,s){return new X2({eventNameOrFunction:i,attribute:i,observable:e,emitter:t,callback:s})},if(i,s,o){return new Nf({observable:e,emitter:t,attribute:i,valueIfTrue:s,callback:o})}}}static extend(e,t){if(e._isRendered)throw new g("template-extend-render",[this,e]);Uf(e,hc(dc(t)))}_renderNode(e){let t;if(e.node?t=this.tag&&this.text:t=this.tag?this.text:!this.text,t)throw new g("ui-template-wrong-syntax",this);return this.text?this._renderText(e):this._renderElement(e)}_renderElement(e){let t=e.node;return t||(t=e.node=document.createElementNS(this.ns||Q2,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(""),Ts(this.text)?this._bindToObservable({schema:this.text,updater:tC(t),data:e}):t.textContent=this.text.join(""),t}_renderAttributes(e){if(!this.attributes)return;const t=e.node,i=e.revertData;for(const s in this.attributes){const o=t.getAttribute(s),r=this.attributes[s];i&&(i.attributes[s]=o);const a=mc(r)?r[0].ns:null;if(Ts(r)){const l=mc(r)?r[0].value:r;i&&pc(s)&&l.unshift(o),this._bindToObservable({schema:l,updater:iC(t,s,a),data:e})}else if(s=="style"&&typeof r[0]!="string")this._renderStyleAttribute(r[0],e);else{i&&o&&pc(s)&&r.unshift(o);const l=r.map(c=>c&&(c.value||c)).reduce((c,u)=>c.concat(u),[]).reduce(Hf,"");$i(l)||t.setAttributeNS(a,s,l)}}}_renderStyleAttribute(e,t){const i=t.node;for(const s in e){const o=e[s];Ts(o)?this._bindToObservable({schema:[o],updater:nC(i,s),data:t}):i.style[s]=o}}_renderElementChildren(e){const t=e.node,i=e.intoFragment?document.createDocumentFragment():t,s=e.isApplying;let o=0;for(const r of this.children)if(Na(r)){if(!s){r.setParent(t);for(const a of r)i.appendChild(a.element)}}else if(zs(r))s||(r.isRendered||r.render(),i.appendChild(r.element));else if(Pt(r))i.appendChild(r);else if(s){const a=e.revertData,l=gc();a.children.push(l),r._renderNode({intoFragment:!1,node:i.childNodes[o++],isApplying:!0,revertData:l})}else i.appendChild(r.render());e.intoFragment&&t.appendChild(i)}_setUpListeners(e){if(this.eventListeners)for(const t in this.eventListeners){const i=this.eventListeners[t].map(s=>{const[o,r]=t.split("@");return s.activateDomEventListener(o,r,e)});e.revertData&&e.revertData.bindings.push(i)}}_bindToObservable({schema:e,updater:t,data:i}){const s=i.revertData;$f(e,t,i);const o=e.filter(r=>!$i(r)).filter(r=>r.observable).map(r=>r.activateAttributeListener(e,t,i));s&&s.bindings.push(o)}_revertTemplateFromNode(e,t){for(const s of t.bindings)for(const o of s)o();if(t.text){e.textContent=t.text;return}const i=e;for(const s in t.attributes){const o=t.attributes[s];o===null?i.removeAttribute(s):i.setAttribute(s,o)}for(let s=0;s<t.children.length;++s)this._revertTemplateFromNode(i.childNodes[s],t.children[s])}}class Kn{constructor(e){this.attribute=e.attribute,this.observable=e.observable,this.emitter=e.emitter,this.callback=e.callback}getValue(e){const t=this.observable[this.attribute];return this.callback?this.callback(t,e):t}activateAttributeListener(e,t,i){const s=()=>$f(e,t,i);return this.emitter.listenTo(this.observable,`change:${this.attribute}`,s),()=>{this.emitter.stopListening(this.observable,`change:${this.attribute}`,s)}}}class X2 extends Kn{constructor(e){super(e),this.eventNameOrFunction=e.eventNameOrFunction}activateDomEventListener(e,t,i){const s=(o,r)=>{(!t||r.target.matches(t))&&(typeof this.eventNameOrFunction=="function"?this.eventNameOrFunction(r):this.observable.fire(this.eventNameOrFunction,r))};return this.emitter.listenTo(i.node,e,s),()=>{this.emitter.stopListening(i.node,e,s)}}}class Nf extends Kn{constructor(e){super(e),this.valueIfTrue=e.valueIfTrue}getValue(e){const t=super.getValue(e);return $i(t)?!1:this.valueIfTrue||!0}}function Ts(n){return n?(n.value&&(n=n.value),Array.isArray(n)?n.some(Ts):n instanceof Kn):!1}function eC(n,e){return n.map(t=>t instanceof Kn?t.getValue(e):t)}function $f(n,e,{node:t}){const i=eC(n,t);let s;n.length==1&&n[0]instanceof Nf?s=i[0]:s=i.reduce(Hf,""),$i(s)?e.remove():e.set(s)}function tC(n){return{set(e){n.textContent=e},remove(){n.textContent=""}}}function iC(n,e,t){return{set(i){n.setAttributeNS(t,e,i)},remove(){n.removeAttributeNS(t,e)}}}function nC(n,e){return{set(t){n.style[e]=t},remove(){n.style[e]=null}}}function dc(n){return Ia(n,t=>{if(t&&(t instanceof Kn||Da(t)||zs(t)||Na(t)))return t})}function hc(n){if(typeof n=="string"?n=rC(n):n.text&&aC(n),n.on&&(n.eventListeners=oC(n.on),delete n.on),!n.text){n.attributes&&sC(n.attributes);const e=[];if(n.children)if(Na(n.children))e.push(n.children);else for(const t of n.children)Da(t)||zs(t)||Pt(t)?e.push(t):e.push(new xe(t));n.children=e}return n}function sC(n){for(const e in n)n[e].value&&(n[e].value=K(n[e].value)),zf(n,e)}function oC(n){for(const e in n)zf(n,e);return n}function rC(n){return{text:[n]}}function aC(n){n.text=K(n.text)}function zf(n,e){n[e]=K(n[e])}function Hf(n,e){return $i(e)?n:$i(n)?e:`${n} ${e}`}function fc(n,e){for(const t in e)n[t]?n[t].push(...e[t]):n[t]=e[t]}function Uf(n,e){if(e.attributes&&(n.attributes||(n.attributes={}),fc(n.attributes,e.attributes)),e.eventListeners&&(n.eventListeners||(n.eventListeners={}),fc(n.eventListeners,e.eventListeners)),e.text&&n.text.push(...e.text),e.children&&e.children.length){if(n.children.length!=e.children.length)throw new g("ui-template-extend-children-mismatch",n);let t=0;for(const i of e.children)Uf(n.children[t++],i)}}function $i(n){return!n&&n!==0}function zs(n){return n instanceof T}function Da(n){return n instanceof xe}function Na(n){return n instanceof Ae}function mc(n){return ie(n[0])&&n[0].ns}function gc(){return{children:[],bindings:[],attributes:{}}}function pc(n){return n=="class"||n=="style"}/**
|
|
189
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
190
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
191
|
+
*/class lC extends Ae{constructor(e,t=[]){super(t),this.locale=e}get bodyCollectionContainer(){return this._bodyCollectionContainer}attachToDom(){this._bodyCollectionContainer=new xe({tag:"div",attributes:{class:["ck","ck-reset_all","ck-body","ck-rounded-corners"],dir:this.locale.uiLanguageDirection},children:this}).render();let e=document.querySelector(".ck-body-wrapper");e||(e=Sn(document,"div",{class:"ck-body-wrapper"}),document.body.appendChild(e)),e.appendChild(this._bodyCollectionContainer)}detachFromDom(){super.destroy(),this._bodyCollectionContainer&&this._bodyCollectionContainer.remove();const e=document.querySelector(".ck-body-wrapper");e&&e.childElementCount==0&&e.remove()}}/**
|
|
192
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
193
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
194
|
+
*/class at extends T{constructor(){super();const e=this.bindTemplate;this.set("content",""),this.set("viewBox","0 0 20 20"),this.set("fillColor",""),this.set("isColorInherited",!0),this.set("isVisible",!0),this.setTemplate({tag:"svg",ns:"http://www.w3.org/2000/svg",attributes:{class:["ck","ck-icon",e.if("isVisible","ck-hidden",t=>!t),"ck-reset_all-excluded",e.if("isColorInherited","ck-icon_inherit-color")],viewBox:e.to("viewBox")}})}render(){super.render(),this._updateXMLContent(),this._colorFillPaths(),this.on("change:content",()=>{this._updateXMLContent(),this._colorFillPaths()}),this.on("change:fillColor",()=>{this._colorFillPaths()})}_updateXMLContent(){if(this.content){const t=new DOMParser().parseFromString(this.content.trim(),"image/svg+xml").querySelector("svg"),i=t.getAttribute("viewBox");i&&(this.viewBox=i);for(const{name:s,value:o}of Array.from(t.attributes))at.presentationalAttributeNames.includes(s)&&this.element.setAttribute(s,o);for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);for(;t.childNodes.length>0;)this.element.appendChild(t.childNodes[0])}}_colorFillPaths(){this.fillColor&&this.element.querySelectorAll(".ck-icon__fill").forEach(e=>{e.style.fill=this.fillColor})}}at.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"];/**
|
|
195
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
196
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
197
|
+
*/class cC extends T{constructor(){super(),this.set({style:void 0,text:void 0,id:void 0});const e=this.bindTemplate;this.setTemplate({tag:"span",attributes:{class:["ck","ck-button__label"],style:e.to("style"),id:e.to("id")},children:[{text:e.to("text")}]})}}/**
|
|
198
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
199
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
200
|
+
*/class B extends T{constructor(e,t=new cC){super(e),this._focusDelayed=null;const i=this.bindTemplate,s=Ze();this.set("ariaLabel",void 0),this.set("ariaLabelledBy",`ck-editor__aria-label_${s}`),this.set("class",void 0),this.set("labelStyle",void 0),this.set("icon",void 0),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isVisible",!0),this.set("isToggleable",!1),this.set("keystroke",void 0),this.set("label",void 0),this.set("role",void 0),this.set("tabindex",-1),this.set("tooltip",!1),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.set("withKeystroke",!1),this.children=this.createCollection(),this.labelView=this._setupLabelView(t),this.iconView=new at,this.iconView.extendTemplate({attributes:{class:"ck-button__icon"}}),this.keystrokeView=this._createKeystrokeView(),this.bind("_tooltipString").to(this,"tooltip",this,"label",this,"keystroke",this._getTooltipString.bind(this));const o={tag:"button",attributes:{class:["ck","ck-button",i.to("class"),i.if("isEnabled","ck-disabled",r=>!r),i.if("isVisible","ck-hidden",r=>!r),i.to("isOn",r=>r?"ck-on":"ck-off"),i.if("withText","ck-button_with-text"),i.if("withKeystroke","ck-button_with-keystroke")],role:i.to("role"),type:i.to("type",r=>r||"button"),tabindex:i.to("tabindex"),"aria-label":i.to("ariaLabel"),"aria-labelledby":i.to("ariaLabelledBy"),"aria-disabled":i.if("isEnabled",!0,r=>!r),"aria-pressed":i.to("isOn",r=>this.isToggleable?String(!!r):!1),"data-cke-tooltip-text":i.to("_tooltipString"),"data-cke-tooltip-position":i.to("tooltipPosition")},children:this.children,on:{click:i.to(r=>{this.isEnabled?this.fire("execute"):r.preventDefault()})}};L.isSafari&&(this._focusDelayed||(this._focusDelayed=Oa(()=>this.focus(),0)),o.on.mousedown=i.to(()=>{this._focusDelayed()}),o.on.mouseup=i.to(()=>{this._focusDelayed.cancel()})),this.setTemplate(o)}render(){super.render(),this.icon&&(this.iconView.bind("content").to(this,"icon"),this.children.add(this.iconView)),this.children.add(this.labelView),this.withKeystroke&&this.keystroke&&this.children.add(this.keystrokeView)}focus(){this.element.focus()}destroy(){this._focusDelayed&&this._focusDelayed.cancel(),super.destroy()}_setupLabelView(e){return e.bind("text","style","id").to(this,"label","labelStyle","ariaLabelledBy"),e}_createKeystrokeView(){const e=new T;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__keystroke"]},children:[{text:this.bindTemplate.to("keystroke",t=>cc(t))}]}),e}_getTooltipString(e,t,i){return e?typeof e=="string"?e:(i&&(i=cc(i)),e instanceof Function?e(t,i):`${t}${i?` (${i})`:""}`):""}}/**
|
|
201
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
202
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
203
|
+
*/class Zn extends B{constructor(e){super(e),this.isToggleable=!0,this.toggleSwitchView=this._createToggleView(),this.extendTemplate({attributes:{class:"ck-switchbutton"}})}render(){super.render(),this.children.add(this.toggleSwitchView)}_createToggleView(){const e=new T;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),e}}const $a='<svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"><path d="M.941 4.523a.75.75 0 1 1 1.06-1.06l3.006 3.005 3.005-3.005a.75.75 0 1 1 1.06 1.06l-3.549 3.55a.75.75 0 0 1-1.168-.136L.941 4.523z"/></svg>';/**
|
|
204
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
205
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
206
|
+
*/class Wf extends T{constructor(e,t){super(e);const i=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",i.if("isCollapsed","ck-collapsible_collapsed")]},children:[this.buttonView,{tag:"div",attributes:{class:["ck","ck-collapsible__children"],role:"region",hidden:i.if("isCollapsed","hidden"),"aria-labelledby":i.to("_collapsibleAriaLabelUid")},children:this.children}]})}render(){super.render(),this._collapsibleAriaLabelUid=this.buttonView.labelView.element.id}focus(){this.buttonView.focus()}_createButtonView(){const e=new B(this.locale),t=e.bindTemplate;return e.set({withText:!0,icon:$a}),e.extendTemplate({attributes:{"aria-expanded":t.to("isOn",i=>String(i))}}),e.bind("label").to(this),e.bind("isOn").to(this,"isCollapsed",i=>!i),e.on("execute",()=>{this.isCollapsed=!this.isCollapsed}),e}}/**
|
|
207
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
208
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
209
|
+
*/function uC(n,e){const t=n.t,i={Black:t("Black"),"Dim grey":t("Dim grey"),Grey:t("Grey"),"Light grey":t("Light grey"),White:t("White"),Red:t("Red"),Orange:t("Orange"),Yellow:t("Yellow"),"Light green":t("Light green"),Green:t("Green"),Aquamarine:t("Aquamarine"),Turquoise:t("Turquoise"),"Light blue":t("Light blue"),Blue:t("Blue"),Purple:t("Purple")};return e.map(s=>{const o=i[s.label];return o&&o!=s.label&&(s.label=o),s})}function dC(n){return n.map(hC).filter(e=>!!e)}function hC(n){return typeof n=="string"?{model:n,label:n,hasBorder:!1,view:{name:"span",styles:{color:n}}}:{model:n.color,label:n.label||n.color,hasBorder:n.hasBorder===void 0?!1:n.hasBorder,view:{name:"span",styles:{color:`${n.color}`}}}}const fC='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path class="ck-icon__fill" d="M16.935 5.328a2 2 0 0 1 0 2.829l-7.778 7.778a2 2 0 0 1-2.829 0L3.5 13.107a1.999 1.999 0 1 1 2.828-2.829l.707.707a1 1 0 0 0 1.414 0l5.658-5.657a2 2 0 0 1 2.828 0z"/><path d="M14.814 6.035 8.448 12.4a1 1 0 0 1-1.414 0l-1.413-1.415A1 1 0 1 0 4.207 12.4l2.829 2.829a1 1 0 0 0 1.414 0l7.778-7.778a1 1 0 1 0-1.414-1.415z"/></svg>';/**
|
|
210
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
211
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
212
|
+
*/class qf extends B{constructor(e){super(e);const t=this.bindTemplate;this.set("color",void 0),this.set("hasBorder",!1),this.icon=fC,this.extendTemplate({attributes:{style:{backgroundColor:t.to("color")},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%)"}}/**
|
|
213
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
214
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
215
|
+
*/class wc extends T{constructor(e,t){super(e);const i=t&&t.colorDefinitions?t.colorDefinitions:[];this.columns=t&&t.columns?t.columns:5;const s={gridTemplateColumns:`repeat( ${this.columns}, 1fr)`};this.set("selectedColor",void 0),this.items=this.createCollection(),this.focusTracker=new ne,this.keystrokes=new ae,this.items.on("add",(o,r)=>{r.isOn=r.color===this.selectedColor}),i.forEach(o=>{const r=new qf;r.set({color:o.color,label:o.label,tooltip:!0,hasBorder:o.options.hasBorder}),r.on("execute",()=>{this.fire("execute",{value:o.color,hasBorder:o.options.hasBorder,label:o.label})}),this.items.add(r)}),this.setTemplate({tag:"div",children:this.items,attributes:{class:["ck","ck-color-grid"],style:s}}),this.on("change:selectedColor",(o,r,a)=>{for(const l of this.items)l.isOn=l.color===a})}focus(){this.items.length&&this.items.first.focus()}focusLast(){this.items.length&&this.items.last.focus()}render(){super.render();for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",(e,t)=>{this.focusTracker.add(t.element)}),this.items.on("remove",(e,t)=>{this.focusTracker.remove(t.element)}),this.keystrokes.listenTo(this.element),Wn({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:this.columns,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}}function jf(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Gf={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const bc=jf(Gf);var _c={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function vc(n){var e,t=[],i=1,s;if(typeof n=="string")if(bc[n])t=bc[n].slice(),s="rgb";else if(n==="transparent")i=0,s="rgb",t=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(n)){var o=n.slice(1),r=o.length,a=r<=4;i=1,a?(t=[parseInt(o[0]+o[0],16),parseInt(o[1]+o[1],16),parseInt(o[2]+o[2],16)],r===4&&(i=parseInt(o[3]+o[3],16)/255)):(t=[parseInt(o[0]+o[1],16),parseInt(o[2]+o[3],16),parseInt(o[4]+o[5],16)],r===8&&(i=parseInt(o[6]+o[7],16)/255)),t[0]||(t[0]=0),t[1]||(t[1]=0),t[2]||(t[2]=0),s="rgb"}else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(n)){var l=e[1],c=l==="rgb",o=l.replace(/a$/,"");s=o;var r=o==="cmyk"?4:o==="gray"?1:3;t=e[2].trim().split(/\s*[,\/]\s*|\s+/).map(function(h,f){if(/%$/.test(h))return f===r?parseFloat(h)/100:o==="rgb"?parseFloat(h)*255/100:parseFloat(h);if(o[f]==="h"){if(/deg$/.test(h))return parseFloat(h);if(_c[h]!==void 0)return _c[h]}return parseFloat(h)}),l===o&&t.push(1),i=c||t[r]===void 0?1:t[r],t=t.slice(0,r)}else n.length>10&&/[0-9](?:\s|\/)/.test(n)&&(t=n.match(/([0-9]+)/g).map(function(u){return parseFloat(u)}),s=n.match(/([a-z])/ig).join("").toLowerCase());else isNaN(n)?Array.isArray(n)||n.length?(t=[n[0],n[1],n[2]],s="rgb",i=n.length===4?n[3]:1):n instanceof Object&&(n.r!=null||n.red!=null||n.R!=null?(s="rgb",t=[n.r||n.red||n.R||0,n.g||n.green||n.G||0,n.b||n.blue||n.B||0]):(s="hsl",t=[n.h||n.hue||n.H||0,n.s||n.saturation||n.S||0,n.l||n.lightness||n.L||n.b||n.brightness]),i=n.a||n.alpha||n.opacity||1,n.opacity!=null&&(i/=100)):(s="rgb",t=[n>>>16,(n&65280)>>>8,n&255]);return{space:s,values:t,alpha:i}}const xn=Gf,Kf={};for(const n of Object.keys(xn))Kf[xn[n]]=n;const S={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};var Zf=S;for(const n of Object.keys(S)){if(!("channels"in S[n]))throw new Error("missing channels property: "+n);if(!("labels"in S[n]))throw new Error("missing channel labels property: "+n);if(S[n].labels.length!==S[n].channels)throw new Error("channel and label counts mismatch: "+n);const{channels:e,labels:t}=S[n];delete S[n].channels,delete S[n].labels,Object.defineProperty(S[n],"channels",{value:e}),Object.defineProperty(S[n],"labels",{value:t})}S.rgb.hsl=function(n){const e=n[0]/255,t=n[1]/255,i=n[2]/255,s=Math.min(e,t,i),o=Math.max(e,t,i),r=o-s;let a,l;o===s?a=0:e===o?a=(t-i)/r:t===o?a=2+(i-e)/r:i===o&&(a=4+(e-t)/r),a=Math.min(a*60,360),a<0&&(a+=360);const c=(s+o)/2;return o===s?l=0:c<=.5?l=r/(o+s):l=r/(2-o-s),[a,l*100,c*100]};S.rgb.hsv=function(n){let e,t,i,s,o;const r=n[0]/255,a=n[1]/255,l=n[2]/255,c=Math.max(r,a,l),u=c-Math.min(r,a,l),d=function(h){return(c-h)/6/u+1/2};return u===0?(s=0,o=0):(o=u/c,e=d(r),t=d(a),i=d(l),r===c?s=i-t:a===c?s=1/3+e-i:l===c&&(s=2/3+t-e),s<0?s+=1:s>1&&(s-=1)),[s*360,o*100,c*100]};S.rgb.hwb=function(n){const e=n[0],t=n[1];let i=n[2];const s=S.rgb.hsl(n)[0],o=1/255*Math.min(e,Math.min(t,i));return i=1-1/255*Math.max(e,Math.max(t,i)),[s,o*100,i*100]};S.rgb.cmyk=function(n){const e=n[0]/255,t=n[1]/255,i=n[2]/255,s=Math.min(1-e,1-t,1-i),o=(1-e-s)/(1-s)||0,r=(1-t-s)/(1-s)||0,a=(1-i-s)/(1-s)||0;return[o*100,r*100,a*100,s*100]};function mC(n,e){return(n[0]-e[0])**2+(n[1]-e[1])**2+(n[2]-e[2])**2}S.rgb.keyword=function(n){const e=Kf[n];if(e)return e;let t=1/0,i;for(const s of Object.keys(xn)){const o=xn[s],r=mC(n,o);r<t&&(t=r,i=s)}return i};S.keyword.rgb=function(n){return xn[n]};S.rgb.xyz=function(n){let e=n[0]/255,t=n[1]/255,i=n[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92;const s=e*.4124+t*.3576+i*.1805,o=e*.2126+t*.7152+i*.0722,r=e*.0193+t*.1192+i*.9505;return[s*100,o*100,r*100]};S.rgb.lab=function(n){const e=S.rgb.xyz(n);let t=e[0],i=e[1],s=e[2];t/=95.047,i/=100,s/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,s=s>.008856?s**(1/3):7.787*s+16/116;const o=116*i-16,r=500*(t-i),a=200*(i-s);return[o,r,a]};S.hsl.rgb=function(n){const e=n[0]/360,t=n[1]/100,i=n[2]/100;let s,o,r;if(t===0)return r=i*255,[r,r,r];i<.5?s=i*(1+t):s=i+t-i*t;const a=2*i-s,l=[0,0,0];for(let c=0;c<3;c++)o=e+1/3*-(c-1),o<0&&o++,o>1&&o--,6*o<1?r=a+(s-a)*6*o:2*o<1?r=s:3*o<2?r=a+(s-a)*(2/3-o)*6:r=a,l[c]=r*255;return l};S.hsl.hsv=function(n){const e=n[0];let t=n[1]/100,i=n[2]/100,s=t;const o=Math.max(i,.01);i*=2,t*=i<=1?i:2-i,s*=o<=1?o:2-o;const r=(i+t)/2,a=i===0?2*s/(o+s):2*t/(i+t);return[e,a*100,r*100]};S.hsv.rgb=function(n){const e=n[0]/60,t=n[1]/100;let i=n[2]/100;const s=Math.floor(e)%6,o=e-Math.floor(e),r=255*i*(1-t),a=255*i*(1-t*o),l=255*i*(1-t*(1-o));switch(i*=255,s){case 0:return[i,l,r];case 1:return[a,i,r];case 2:return[r,i,l];case 3:return[r,a,i];case 4:return[l,r,i];case 5:return[i,r,a]}};S.hsv.hsl=function(n){const e=n[0],t=n[1]/100,i=n[2]/100,s=Math.max(i,.01);let o,r;r=(2-t)*i;const a=(2-t)*s;return o=t*s,o/=a<=1?a:2-a,o=o||0,r/=2,[e,o*100,r*100]};S.hwb.rgb=function(n){const e=n[0]/360;let t=n[1]/100,i=n[2]/100;const s=t+i;let o;s>1&&(t/=s,i/=s);const r=Math.floor(6*e),a=1-i;o=6*e-r,r&1&&(o=1-o);const l=t+o*(a-t);let c,u,d;switch(r){default:case 6:case 0:c=a,u=l,d=t;break;case 1:c=l,u=a,d=t;break;case 2:c=t,u=a,d=l;break;case 3:c=t,u=l,d=a;break;case 4:c=l,u=t,d=a;break;case 5:c=a,u=t,d=l;break}return[c*255,u*255,d*255]};S.cmyk.rgb=function(n){const e=n[0]/100,t=n[1]/100,i=n[2]/100,s=n[3]/100,o=1-Math.min(1,e*(1-s)+s),r=1-Math.min(1,t*(1-s)+s),a=1-Math.min(1,i*(1-s)+s);return[o*255,r*255,a*255]};S.xyz.rgb=function(n){const e=n[0]/100,t=n[1]/100,i=n[2]/100;let s,o,r;return s=e*3.2406+t*-1.5372+i*-.4986,o=e*-.9689+t*1.8758+i*.0415,r=e*.0557+t*-.204+i*1.057,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,r=r>.0031308?1.055*r**(1/2.4)-.055:r*12.92,s=Math.min(Math.max(0,s),1),o=Math.min(Math.max(0,o),1),r=Math.min(Math.max(0,r),1),[s*255,o*255,r*255]};S.xyz.lab=function(n){let e=n[0],t=n[1],i=n[2];e/=95.047,t/=100,i/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,t=t>.008856?t**(1/3):7.787*t+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;const s=116*t-16,o=500*(e-t),r=200*(t-i);return[s,o,r]};S.lab.xyz=function(n){const e=n[0],t=n[1],i=n[2];let s,o,r;o=(e+16)/116,s=t/500+o,r=o-i/200;const a=o**3,l=s**3,c=r**3;return o=a>.008856?a:(o-16/116)/7.787,s=l>.008856?l:(s-16/116)/7.787,r=c>.008856?c:(r-16/116)/7.787,s*=95.047,o*=100,r*=108.883,[s,o,r]};S.lab.lch=function(n){const e=n[0],t=n[1],i=n[2];let s;s=Math.atan2(i,t)*360/2/Math.PI,s<0&&(s+=360);const r=Math.sqrt(t*t+i*i);return[e,r,s]};S.lch.lab=function(n){const e=n[0],t=n[1],s=n[2]/360*2*Math.PI,o=t*Math.cos(s),r=t*Math.sin(s);return[e,o,r]};S.rgb.ansi16=function(n,e=null){const[t,i,s]=n;let o=e===null?S.rgb.hsv(n)[2]:e;if(o=Math.round(o/50),o===0)return 30;let r=30+(Math.round(s/255)<<2|Math.round(i/255)<<1|Math.round(t/255));return o===2&&(r+=60),r};S.hsv.ansi16=function(n){return S.rgb.ansi16(S.hsv.rgb(n),n[2])};S.rgb.ansi256=function(n){const e=n[0],t=n[1],i=n[2];return e===t&&t===i?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(i/255*5)};S.ansi16.rgb=function(n){let e=n%10;if(e===0||e===7)return n>50&&(e+=3.5),e=e/10.5*255,[e,e,e];const t=(~~(n>50)+1)*.5,i=(e&1)*t*255,s=(e>>1&1)*t*255,o=(e>>2&1)*t*255;return[i,s,o]};S.ansi256.rgb=function(n){if(n>=232){const o=(n-232)*10+8;return[o,o,o]}n-=16;let e;const t=Math.floor(n/36)/5*255,i=Math.floor((e=n%36)/6)/5*255,s=e%6/5*255;return[t,i,s]};S.rgb.hex=function(n){const t=(((Math.round(n[0])&255)<<16)+((Math.round(n[1])&255)<<8)+(Math.round(n[2])&255)).toString(16).toUpperCase();return"000000".substring(t.length)+t};S.hex.rgb=function(n){const e=n.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let t=e[0];e[0].length===3&&(t=t.split("").map(a=>a+a).join(""));const i=parseInt(t,16),s=i>>16&255,o=i>>8&255,r=i&255;return[s,o,r]};S.rgb.hcg=function(n){const e=n[0]/255,t=n[1]/255,i=n[2]/255,s=Math.max(Math.max(e,t),i),o=Math.min(Math.min(e,t),i),r=s-o;let a,l;return r<1?a=o/(1-r):a=0,r<=0?l=0:s===e?l=(t-i)/r%6:s===t?l=2+(i-e)/r:l=4+(e-t)/r,l/=6,l%=1,[l*360,r*100,a*100]};S.hsl.hcg=function(n){const e=n[1]/100,t=n[2]/100,i=t<.5?2*e*t:2*e*(1-t);let s=0;return i<1&&(s=(t-.5*i)/(1-i)),[n[0],i*100,s*100]};S.hsv.hcg=function(n){const e=n[1]/100,t=n[2]/100,i=e*t;let s=0;return i<1&&(s=(t-i)/(1-i)),[n[0],i*100,s*100]};S.hcg.rgb=function(n){const e=n[0]/360,t=n[1]/100,i=n[2]/100;if(t===0)return[i*255,i*255,i*255];const s=[0,0,0],o=e%1*6,r=o%1,a=1-r;let l=0;switch(Math.floor(o)){case 0:s[0]=1,s[1]=r,s[2]=0;break;case 1:s[0]=a,s[1]=1,s[2]=0;break;case 2:s[0]=0,s[1]=1,s[2]=r;break;case 3:s[0]=0,s[1]=a,s[2]=1;break;case 4:s[0]=r,s[1]=0,s[2]=1;break;default:s[0]=1,s[1]=0,s[2]=a}return l=(1-t)*i,[(t*s[0]+l)*255,(t*s[1]+l)*255,(t*s[2]+l)*255]};S.hcg.hsv=function(n){const e=n[1]/100,t=n[2]/100,i=e+t*(1-e);let s=0;return i>0&&(s=e/i),[n[0],s*100,i*100]};S.hcg.hsl=function(n){const e=n[1]/100,i=n[2]/100*(1-e)+.5*e;let s=0;return i>0&&i<.5?s=e/(2*i):i>=.5&&i<1&&(s=e/(2*(1-i))),[n[0],s*100,i*100]};S.hcg.hwb=function(n){const e=n[1]/100,t=n[2]/100,i=e+t*(1-e);return[n[0],(i-e)*100,(1-i)*100]};S.hwb.hcg=function(n){const e=n[1]/100,i=1-n[2]/100,s=i-e;let o=0;return s<1&&(o=(i-s)/(1-s)),[n[0],s*100,o*100]};S.apple.rgb=function(n){return[n[0]/65535*255,n[1]/65535*255,n[2]/65535*255]};S.rgb.apple=function(n){return[n[0]/255*65535,n[1]/255*65535,n[2]/255*65535]};S.gray.rgb=function(n){return[n[0]/100*255,n[0]/100*255,n[0]/100*255]};S.gray.hsl=function(n){return[0,0,n[0]]};S.gray.hsv=S.gray.hsl;S.gray.hwb=function(n){return[0,100,n[0]]};S.gray.cmyk=function(n){return[0,0,0,n[0]]};S.gray.lab=function(n){return[n[0],0,0]};S.gray.hex=function(n){const e=Math.round(n[0]/100*255)&255,i=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(i.length)+i};S.rgb.gray=function(n){return[(n[0]+n[1]+n[2])/3/255*100]};const Hs=Zf;function gC(){const n={},e=Object.keys(Hs);for(let t=e.length,i=0;i<t;i++)n[e[i]]={distance:-1,parent:null};return n}function pC(n){const e=gC(),t=[n];for(e[n].distance=0;t.length;){const i=t.pop(),s=Object.keys(Hs[i]);for(let o=s.length,r=0;r<o;r++){const a=s[r],l=e[a];l.distance===-1&&(l.distance=e[i].distance+1,l.parent=i,t.unshift(a))}}return e}function wC(n,e){return function(t){return e(n(t))}}function bC(n,e){const t=[e[n].parent,n];let i=Hs[e[n].parent][n],s=e[n].parent;for(;e[s].parent;)t.unshift(e[s].parent),i=wC(Hs[e[s].parent][s],i),s=e[s].parent;return i.conversion=t,i}var _C=function(n){const e=pC(n),t={},i=Object.keys(e);for(let s=i.length,o=0;o<s;o++){const r=i[o];e[r].parent!==null&&(t[r]=bC(r,e))}return t};const Ir=Zf,vC=_C,Ii={},yC=Object.keys(Ir);function CC(n){const e=function(...t){const i=t[0];return i==null?i:(i.length>1&&(t=i),n(t))};return"conversion"in n&&(e.conversion=n.conversion),e}function kC(n){const e=function(...t){const i=t[0];if(i==null)return i;i.length>1&&(t=i);const s=n(t);if(typeof s=="object")for(let o=s.length,r=0;r<o;r++)s[r]=Math.round(s[r]);return s};return"conversion"in n&&(e.conversion=n.conversion),e}yC.forEach(n=>{Ii[n]={},Object.defineProperty(Ii[n],"channels",{value:Ir[n].channels}),Object.defineProperty(Ii[n],"labels",{value:Ir[n].labels});const e=vC(n);Object.keys(e).forEach(i=>{const s=e[i];Ii[n][i]=kC(s),Ii[n][i].raw=CC(s)})});var Jf=Ii;const EC=jf(Jf),Yf=Wp({__proto__:null,default:EC},[Jf]);/**
|
|
216
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
217
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
218
|
+
*/function Qf(n,e){if(!n)return"";const t=Xf(n);if(!t)return"";if(t.space===e)return n;if(!xC(t))return"";const s=Yf[t.space][e];if(!s)return"";const o=s(t.space==="hex"?t.hexValue:t.values);return SC(o,e)}function TC(n){if(!n)return"";const e=Xf(n);return e?e.space==="hex"?e.hexValue:Qf(n,"hex"):"#000"}function AC(n,e){customElements.get(n)===void 0&&customElements.define(n,e)}function SC(n,e){switch(e){case"hex":return`#${n}`;case"rgb":return`rgb( ${n[0]}, ${n[1]}, ${n[2]} )`;case"hsl":return`hsl( ${n[0]}, ${n[1]}%, ${n[2]}% )`;case"hwb":return`hwb( ${n[0]}, ${n[1]}, ${n[2]} )`;case"lab":return`lab( ${n[0]}% ${n[1]} ${n[2]} )`;case"lch":return`lch( ${n[0]}% ${n[1]} ${n[2]} )`;default:return""}}function Xf(n){if(n.startsWith("#")){const t=vc(n);return{space:"hex",values:t.values,hexValue:n,alpha:t.alpha}}const e=vc(n);return e.space?e:null}function xC(n){return Object.keys(Yf).includes(n.space)}/**
|
|
219
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
220
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
221
|
+
*/class Jn extends T{constructor(e){super(e),this.set("text",void 0),this.set("for",void 0),this.id=`ck-editor__label_${Ze()}`;const t=this.bindTemplate;this.setTemplate({tag:"label",attributes:{class:["ck","ck-label"],id:this.id,for:t.to("for")},children:[{text:t.to("text")}]})}}/**
|
|
222
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
223
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
224
|
+
*/class Zi extends T{constructor(e,t){super(e);const i=`ck-labeled-field-view-${Ze()}`,s=`ck-labeled-field-view-status-${Ze()}`;this.fieldView=t(this,i,s),this.set("label",void 0),this.set("isEnabled",!0),this.set("isEmpty",!0),this.set("isFocused",!1),this.set("errorText",null),this.set("infoText",null),this.set("class",void 0),this.set("placeholder",void 0),this.labelView=this._createLabelView(i),this.statusView=this._createStatusView(s),this.fieldWrapperChildren=this.createCollection([this.fieldView,this.labelView]),this.bind("_statusText").to(this,"errorText",this,"infoText",(r,a)=>r||a);const o=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view",o.to("class"),o.if("isEnabled","ck-disabled",r=>!r),o.if("isEmpty","ck-labeled-field-view_empty"),o.if("isFocused","ck-labeled-field-view_focused"),o.if("placeholder","ck-labeled-field-view_placeholder"),o.if("errorText","ck-error")]},children:[{tag:"div",attributes:{class:["ck","ck-labeled-field-view__input-wrapper"]},children:this.fieldWrapperChildren},this.statusView]})}_createLabelView(e){const t=new Jn(this.locale);return t.for=e,t.bind("text").to(this,"label"),t}_createStatusView(e){const t=new T(this.locale),i=this.bindTemplate;return t.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view__status",i.if("errorText","ck-labeled-field-view__status_error"),i.if("_statusText","ck-hidden",s=>!s)],id:e,role:i.if("errorText","alert")},children:[{text:i.to("_statusText")}]}),t}focus(e){this.fieldView.focus(e)}}/**
|
|
225
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
226
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
227
|
+
*/class IC extends T{constructor(e){super(e),this.set("value",void 0),this.set("id",void 0),this.set("placeholder",void 0),this.set("isReadOnly",!1),this.set("hasError",!1),this.set("ariaDescribedById",void 0),this.focusTracker=new ne,this.bind("isFocused").to(this.focusTracker),this.set("isEmpty",!0);const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck","ck-input",t.if("isFocused","ck-input_focused"),t.if("isEmpty","ck-input-text_empty"),t.if("hasError","ck-error")],id:t.to("id"),placeholder:t.to("placeholder"),readonly:t.to("isReadOnly"),"aria-invalid":t.if("hasError",!0),"aria-describedby":t.to("ariaDescribedById")},on:{input:t.to((...i)=>{this.fire("input",...i),this._updateIsEmpty()}),change:t.to(this._updateIsEmpty.bind(this))}})}render(){super.render(),this.focusTracker.add(this.element),this._setDomElementValue(this.value),this._updateIsEmpty(),this.on("change:value",(e,t,i)=>{this._setDomElementValue(i),this._updateIsEmpty()})}destroy(){super.destroy(),this.focusTracker.destroy()}select(){this.element.select()}focus(){this.element.focus()}reset(){this.value=this.element.value="",this._updateIsEmpty()}_updateIsEmpty(){this.isEmpty=PC(this.element)}_setDomElementValue(e){this.element.value=!e&&e!==0?"":e}}function PC(n){return!n.value}/**
|
|
228
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
229
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
230
|
+
*/class em extends IC{constructor(e){super(e),this.set("inputMode","text");const t=this.bindTemplate;this.extendTemplate({attributes:{inputmode:t.to("inputMode")}})}}/**
|
|
231
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
232
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
233
|
+
*/class RC extends em{constructor(e){super(e),this.extendTemplate({attributes:{type:"text",class:["ck-input-text"]}})}}/**
|
|
234
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
235
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
236
|
+
*/class VC extends em{constructor(e,{min:t,max:i,step:s}={}){super(e);const o=this.bindTemplate;this.set("min",t),this.set("max",i),this.set("step",s),this.extendTemplate({attributes:{type:"number",class:["ck-input-number"],min:o.to("min"),max:o.to("max"),step:o.to("step")}})}}/**
|
|
237
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
238
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
239
|
+
*/class LC extends T{constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!1),this.set("position","se"),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-dropdown__panel",t.to("position",i=>`ck-dropdown__panel_${i}`),t.if("isVisible","ck-dropdown__panel-visible")],tabindex:"-1"},children:this.children,on:{selectstart:t.to(i=>{i.target.tagName.toLocaleLowerCase()!=="input"&&i.preventDefault()})}})}focus(){if(this.children.length){const e=this.children.first;typeof e.focus=="function"?e.focus():H("ui-dropdown-panel-focus-child-missing-focus",{childView:this.children.first,dropdownPanel:this})}}focusLast(){if(this.children.length){const e=this.children.last;typeof e.focusLast=="function"?e.focusLast():e.focus()}}}/**
|
|
240
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
241
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
242
|
+
*/class zi extends T{constructor(e,t,i){super(e);const s=this.bindTemplate;this.buttonView=t,this.panelView=i,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 ae,this.focusTracker=new ne,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",s.to("class"),s.if("isEnabled","ck-disabled",o=>!o)],id:s.to("id"),"aria-describedby":s.to("ariaDescribedById")},children:[t,i]}),t.extendTemplate({attributes:{class:["ck-dropdown__button"],"data-cke-tooltip-disabled":s.to("isOpen")}})}render(){super.render(),this.focusTracker.add(this.buttonView.element),this.focusTracker.add(this.panelView.element),this.listenTo(this.buttonView,"open",()=>{this.isOpen=!this.isOpen}),this.on("change:isOpen",(t,i,s)=>{if(s)if(this.panelPosition==="auto"){const o=zi._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions});this.panelView.position=o?o.name:this._panelPositions[0].name}else this.panelView.position=this.panelPosition}),this.keystrokes.listenTo(this.element);const e=(t,i)=>{this.isOpen&&(this.isOpen=!1,i())};this.keystrokes.set("arrowdown",(t,i)=>{this.buttonView.isEnabled&&!this.isOpen&&(this.isOpen=!0,i())}),this.keystrokes.set("arrowright",(t,i)=>{this.isOpen&&i()}),this.keystrokes.set("arrowleft",e),this.keystrokes.set("esc",e)}focus(){this.buttonView.focus()}get _panelPositions(){const{south:e,north:t,southEast:i,southWest:s,northEast:o,northWest:r,southMiddleEast:a,southMiddleWest:l,northMiddleEast:c,northMiddleWest:u}=zi.defaultPanelPositions;return this.locale.uiLanguageDirection!=="rtl"?[i,s,a,l,e,o,r,c,u,t]:[s,i,l,a,e,r,o,u,c,t]}}zi.defaultPanelPositions={south:(n,e)=>({top:n.bottom,left:n.left-(e.width-n.width)/2,name:"s"}),southEast:n=>({top:n.bottom,left:n.left,name:"se"}),southWest:(n,e)=>({top:n.bottom,left:n.left-e.width+n.width,name:"sw"}),southMiddleEast:(n,e)=>({top:n.bottom,left:n.left-(e.width-n.width)/4,name:"sme"}),southMiddleWest:(n,e)=>({top:n.bottom,left:n.left-(e.width-n.width)*3/4,name:"smw"}),north:(n,e)=>({top:n.top-e.height,left:n.left-(e.width-n.width)/2,name:"n"}),northEast:(n,e)=>({top:n.top-e.height,left:n.left,name:"ne"}),northWest:(n,e)=>({top:n.top-e.height,left:n.left-e.width+n.width,name:"nw"}),northMiddleEast:(n,e)=>({top:n.top-e.height,left:n.left-(e.width-n.width)/4,name:"nme"}),northMiddleWest:(n,e)=>({top:n.top-e.height,left:n.left-(e.width-n.width)*3/4,name:"nmw"})};zi._getOptimalPosition=Va;/**
|
|
243
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
244
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
245
|
+
*/class tm extends B{constructor(e){super(e),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{"aria-haspopup":!0,"aria-expanded":this.bindTemplate.to("isOn",t=>String(t))}}),this.delegate("execute").to(this,"open")}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new at;return e.content=$a,e.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),e}}/**
|
|
246
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
247
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
248
|
+
*/class ke extends Z(){constructor(e){if(super(),this.focusables=e.focusables,this.focusTracker=e.focusTracker,this.keystrokeHandler=e.keystrokeHandler,this.actions=e.actions,e.actions&&e.keystrokeHandler)for(const t in e.actions){let i=e.actions[t];typeof i=="string"&&(i=[i]);for(const s of i)e.keystrokeHandler.set(s,(o,r)=>{this[t](),r()})}this.on("forwardCycle",()=>this.focusFirst(),{priority:"low"}),this.on("backwardCycle",()=>this.focusLast(),{priority:"low"})}get first(){return this.focusables.find(Ro)||null}get last(){return this.focusables.filter(Ro).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,i)=>{const s=t.element===this.focusTracker.focusedElement;return s&&(e=i),s}),e)}focusFirst(){this._focus(this.first,1)}focusLast(){this._focus(this.last,-1)}focusNext(){const e=this.next;if(e&&this.focusables.getIndex(e)===this.current){this.fire("forwardCycle");return}e===this.first?this.fire("forwardCycle"):this._focus(e,1)}focusPrevious(){const e=this.previous;if(e&&this.focusables.getIndex(e)===this.current){this.fire("backwardCycle");return}e===this.last?this.fire("backwardCycle"):this._focus(e,-1)}_focus(e,t){e&&this.focusTracker.focusedElement!==e.element&&e.focus(t)}_getDomFocusableItem(e){const t=this.focusables.length;if(!t)return null;const i=this.current;if(i===null)return this[e===1?"first":"last"];let s=this.focusables.get(i),o=(i+t+e)%t;do{const r=this.focusables.get(o);if(Ro(r)){s=r;break}o=(o+t+e)%t}while(o!==i);return s}}function Ro(n){return Yn(n)&&ii(n.element)}function Yn(n){return"focus"in n&&typeof n.focus=="function"}function BC(n){return Yn(n)&&"focusCycler"in n&&n.focusCycler instanceof ke}/**
|
|
249
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
250
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
251
|
+
*/class im extends T{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}})}}/**
|
|
252
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
253
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
254
|
+
*/class OC extends T{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__line-break"]}})}}/**
|
|
255
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
256
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
257
|
+
*/function MC(n){return n.bindTemplate.to(e=>{e.target===n.element&&e.preventDefault()})}/**
|
|
258
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
259
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
260
|
+
*/function nm(n){if(Array.isArray(n))return{items:n,removeItems:[]};const e={items:[],removeItems:[]};return n?{...e,...n}:e}/**
|
|
261
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
262
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
263
|
+
*/class w extends U(){constructor(e){super(),this._disableStack=new Set,this.editor=e,this.set("isEnabled",!0)}forceDisabled(e){this._disableStack.add(e),this._disableStack.size==1&&(this.on("set:isEnabled",yc,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),this._disableStack.size==0&&(this.off("set:isEnabled",yc),this.isEnabled=!0)}destroy(){this.stopListening()}static get isContextPlugin(){return!1}}function yc(n){n.return=!1,n.stop()}/**
|
|
264
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
265
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
266
|
+
*/class R extends U(){constructor(e){super(),this.editor=e,this.set("value",void 0),this.set("isEnabled",!1),this._affectsData=!0,this._isEnabledBasedOnSelection=!0,this._disableStack=new Set,this.decorate("execute"),this.listenTo(this.editor.model.document,"change",()=>{this.refresh()}),this.listenTo(e,"change:isReadOnly",()=>{this.refresh()}),this.on("set:isEnabled",t=>{if(!this.affectsData)return;const i=e.model.document.selection,o=!(i.getFirstPosition().root.rootName=="$graveyard")&&e.model.canEditAt(i);(e.isReadOnly||this._isEnabledBasedOnSelection&&!o)&&(t.return=!1,t.stop())},{priority:"highest"}),this.on("execute",t=>{this.isEnabled||t.stop()},{priority:"high"})}get affectsData(){return this._affectsData}set affectsData(e){this._affectsData=e}refresh(){this.isEnabled=!0}forceDisabled(e){this._disableStack.add(e),this._disableStack.size==1&&(this.on("set:isEnabled",Cc,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),this._disableStack.size==0&&(this.off("set:isEnabled",Cc),this.refresh())}execute(...e){}destroy(){this.stopListening()}}function Cc(n){n.return=!1,n.stop()}/**
|
|
267
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
268
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
269
|
+
*/class kc extends R{constructor(){super(...arguments),this._childCommandsDefinitions=[]}refresh(){}execute(...e){const t=this._getFirstEnabledCommand();return!!t&&t.execute(e)}registerChildCommand(e,t={}){bh(this._childCommandsDefinitions,{command:e,priority:t.priority||"normal"}),e.on("change:isEnabled",()=>this._checkEnabled()),this._checkEnabled()}_checkEnabled(){this.isEnabled=!!this._getFirstEnabledCommand()}_getFirstEnabledCommand(){const e=this._childCommandsDefinitions.find(({command:t})=>t.isEnabled);return e&&e.command}}/**
|
|
270
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
271
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
272
|
+
*/class sm extends Z(){constructor(e,t=[],i=[]){super(),this._plugins=new Map,this._context=e,this._availablePlugins=new Map;for(const s of t)s.pluginName&&this._availablePlugins.set(s.pluginName,s);this._contextPlugins=new Map;for(const[s,o]of i)this._contextPlugins.set(s,o),this._contextPlugins.set(o,s),s.pluginName&&this._availablePlugins.set(s.pluginName,s)}*[Symbol.iterator](){for(const e of this._plugins)typeof e[0]=="function"&&(yield e)}get(e){const t=this._plugins.get(e);if(!t){let i=e;throw typeof e=="function"&&(i=e.pluginName||e.name),new g("plugincollection-plugin-not-loaded",this._context,{plugin:i})}return t}has(e){return this._plugins.has(e)}init(e,t=[],i=[]){const s=this,o=this._context;f(e),p(e);const r=e.filter(A=>!d(A,t)),a=[...m(r)];D(a,i);const l=P(a);return M(l,"init").then(()=>M(l,"afterInit")).then(()=>l);function c(A){return typeof A=="function"}function u(A){return c(A)&&!!A.isContextPlugin}function d(A,V){return V.some(x=>x===A||h(A)===x||h(x)===A)}function h(A){return c(A)?A.pluginName||A.name:A}function f(A,V=new Set){A.forEach(x=>{c(x)&&(V.has(x)||(V.add(x),x.pluginName&&!s._availablePlugins.has(x.pluginName)&&s._availablePlugins.set(x.pluginName,x),x.requires&&f(x.requires,V)))})}function m(A,V=new Set){return A.map(x=>c(x)?x:s._availablePlugins.get(x)).reduce((x,X)=>V.has(X)?x:(V.add(X),X.requires&&(p(X.requires,X),m(X.requires,V).forEach(Ot=>x.add(Ot))),x.add(X)),new Set)}function p(A,V=null){A.map(x=>c(x)?x:s._availablePlugins.get(x)||x).forEach(x=>{_(x,V),C(x,V),v(x,V)})}function _(A,V){if(!c(A))throw V?new g("plugincollection-soft-required",o,{missingPlugin:A,requiredBy:h(V)}):new g("plugincollection-plugin-not-found",o,{plugin:A})}function C(A,V){if(u(V)&&!u(A))throw new g("plugincollection-context-required",o,{plugin:h(A),requiredBy:h(V)})}function v(A,V){if(V&&d(A,t))throw new g("plugincollection-required",o,{plugin:h(A),requiredBy:h(V)})}function P(A){return A.map(V=>{let x=s._contextPlugins.get(V);return x=x||new V(o),s._add(V,x),x})}function M(A,V){return A.reduce((x,X)=>!X[V]||s._contextPlugins.has(X)?x:x.then(X[V].bind(X)),Promise.resolve())}function D(A,V){for(const x of V){if(typeof x!="function")throw new g("plugincollection-replace-plugin-invalid-type",null,{pluginItem:x});const X=x.pluginName;if(!X)throw new g("plugincollection-replace-plugin-missing-name",null,{pluginItem:x});if(x.requires&&x.requires.length)throw new g("plugincollection-plugin-for-replacing-cannot-have-dependencies",null,{pluginName:X});const Ot=s._availablePlugins.get(X);if(!Ot)throw new g("plugincollection-plugin-for-replacing-not-exist",null,{pluginName:X});const hl=A.indexOf(Ot);if(hl===-1){if(s._contextPlugins.has(Ot))return;throw new g("plugincollection-plugin-for-replacing-not-loaded",null,{pluginName:X})}if(Ot.requires&&Ot.requires.length)throw new g("plugincollection-replaced-plugin-cannot-have-dependencies",null,{pluginName:X});A.splice(hl,1,x),s._availablePlugins.set(X,x)}}}destroy(){const e=[];for(const[,t]of this)typeof t.destroy=="function"&&!this._contextPlugins.has(t)&&e.push(t.destroy());return Promise.all(e)}_add(e,t){this._plugins.set(e,t);const i=e.pluginName;if(i){if(this._plugins.has(i))throw new g("plugincollection-plugin-name-conflict",null,{pluginName:i,plugin1:this._plugins.get(i).constructor,plugin2:e});this._plugins.set(i,t)}}}/**
|
|
273
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
274
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
275
|
+
*/class om{constructor(e){this._contextOwner=null,this.config=new Tf(e,this.constructor.defaultConfig);const t=this.constructor.builtinPlugins;this.config.define("plugins",t),this.plugins=new sm(this,t);const i=this.config.get("language")||{};this.locale=new $2({uiLanguage:typeof i=="string"?i:i.ui,contentLanguage:this.config.get("language.content")}),this.t=this.locale.t,this.editors=new _e}initPlugins(){const e=this.config.get("plugins")||[],t=this.config.get("substitutePlugins")||[];for(const i of e.concat(t)){if(typeof i!="function")throw new g("context-initplugins-constructor-only",null,{Plugin:i});if(i.isContextPlugin!==!0)throw new g("context-initplugins-invalid-plugin",null,{Plugin:i})}return this.plugins.init(e,[],t)}destroy(){return Promise.all(Array.from(this.editors,e=>e.destroy())).then(()=>this.plugins.destroy())}_addEditor(e,t){if(this._contextOwner)throw new g("context-addeditor-private-context");this.editors.add(e),t&&(this._contextOwner=e)}_removeEditor(e){return this.editors.has(e)&&this.editors.remove(e),this._contextOwner===e?this.destroy():Promise.resolve()}_getEditorConfig(){const e={};for(const t of this.config.names())["plugins","removePlugins","extraPlugins"].includes(t)||(e[t]=this.config.get(t));return e}static create(e){return new Promise(t=>{const i=new this(e);t(i.initPlugins().then(()=>i))})}}/**
|
|
276
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
277
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
278
|
+
*/class rm extends U(){constructor(e){super(),this.context=e}destroy(){this.stopListening()}static get isContextPlugin(){return!0}}/**
|
|
279
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
280
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
281
|
+
*/const As=new WeakMap;let Ec=!1;function am({view:n,element:e,text:t,isDirectHost:i=!0,keepOnFocus:s=!1}){const o=n.document;As.has(o)||(As.set(o,new Map),o.registerPostFixer(a=>Vo(o,a)),o.on("change:isComposing",()=>{n.change(a=>Vo(o,a))},{priority:"high"})),e.is("editableElement")&&e.on("change:placeholder",(a,l,c)=>{r(c)}),e.placeholder?r(e.placeholder):t&&r(t),t&&zC();function r(a){As.get(o).set(e,{text:a,isDirectHost:i,keepOnFocus:s,hostElement:i?e:null}),n.change(l=>Vo(o,l))}}function FC(n,e){return e.hasClass("ck-placeholder")?!1:(n.addClass("ck-placeholder",e),!0)}function DC(n,e){return e.hasClass("ck-placeholder")?(n.removeClass("ck-placeholder",e),!0):!1}function NC(n,e){if(!n.isAttached()||Array.from(n.getChildren()).some(r=>!r.is("uiElement")))return!1;const i=n.document,o=i.selection.anchor;return i.isComposing&&o&&o.parent===n?!1:e||!i.isFocused?!0:!!o&&o.parent!==n}function Vo(n,e){const t=As.get(n),i=[];let s=!1;for(const[o,r]of t)r.isDirectHost&&(i.push(o),Tc(e,o,r)&&(s=!0));for(const[o,r]of t){if(r.isDirectHost)continue;const a=$C(o);a&&(i.includes(a)||(r.hostElement=a,Tc(e,o,r)&&(s=!0)))}return s}function Tc(n,e,t){const{text:i,isDirectHost:s,hostElement:o}=t;let r=!1;return o.getAttribute("data-placeholder")!==i&&(n.setAttribute("data-placeholder",i,o),r=!0),(s||e.childCount==1)&&NC(o,t.keepOnFocus)?FC(n,o)&&(r=!0):DC(n,o)&&(r=!0),r}function $C(n){if(n.childCount){const e=n.getChild(0);if(e.is("element")&&!e.is("uiElement")&&!e.is("attributeElement"))return e}return null}function zC(){Ec||H("enableplaceholder-deprecated-text-option"),Ec=!0}/**
|
|
282
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
283
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
284
|
+
*/let li=class{is(){throw new Error("is() method is abstract")}};/**
|
|
285
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
286
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
287
|
+
*/let ci=class extends Z(li){constructor(e){super(),this.document=e,this.parent=null}get index(){let e;if(!this.parent)return null;if((e=this.parent.getChildIndex(this))==-1)throw new g("view-node-not-found-in-parent",this);return e}get nextSibling(){const e=this.index;return e!==null&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return e!==null&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.root.is("rootElement")}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.index),t=t.parent;return e}getAncestors(e={}){const t=[];let i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}getCommonAncestor(e,t={}){const i=this.getAncestors(t),s=e.getAncestors(t);let o=0;for(;i[o]==s[o]&&i[o];)o++;return o===0?null:i[o-1]}isBefore(e){if(this==e||this.root!==e.root)return!1;const t=this.getPath(),i=e.getPath(),s=ye(t,i);switch(s){case"prefix":return!0;case"extension":return!1;default:return t[s]<i[s]}}isAfter(e){return this==e||this.root!==e.root?!1:!this.isBefore(e)}_remove(){this.parent._removeChildren(this.index)}_fireChange(e,t){this.fire(`change:${e}`,t),this.parent&&this.parent._fireChange(e,t)}toJSON(){const e=bf(this);return delete e.parent,e}};ci.prototype.is=function(n){return n==="node"||n==="view:node"};/**
|
|
288
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
289
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
290
|
+
*/let te=class Pr extends ci{constructor(e,t){super(e),this._textData=t}get data(){return this._textData}get _data(){return this.data}set _data(e){this._fireChange("text",this),this._textData=e}isSimilar(e){return e instanceof Pr?this===e||this.data===e.data:!1}_clone(){return new Pr(this.document,this.data)}};te.prototype.is=function(n){return n==="$text"||n==="view:$text"||n==="text"||n==="view:text"||n==="node"||n==="view:node"};/**
|
|
291
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
292
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
293
|
+
*/let et=class extends li{constructor(e,t,i){if(super(),this.textNode=e,t<0||t>e.data.length)throw new g("view-textproxy-wrong-offsetintext",this);if(i<0||t+i>e.data.length)throw new g("view-textproxy-wrong-length",this);this.data=e.data.substring(t,t+i),this.offsetInText=t}get offsetSize(){return this.data.length}get isPartial(){return this.data.length!==this.textNode.data.length}get parent(){return this.textNode.parent}get root(){return this.textNode.root}get document(){return this.textNode.document}getAncestors(e={}){const t=[];let i=e.includeSelf?this.textNode:this.parent;for(;i!==null;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}};et.prototype.is=function(n){return n==="$textProxy"||n==="view:$textProxy"||n==="textProxy"||n==="view:textProxy"};/**
|
|
294
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
295
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
296
|
+
*/class ni{constructor(...e){this._patterns=[],this.add(...e)}add(...e){for(let t of e)(typeof t=="string"||t instanceof RegExp)&&(t={name:t}),this._patterns.push(t)}match(...e){for(const t of e)for(const i of this._patterns){const s=Ac(t,i);if(s)return{element:t,pattern:i,match:s}}return null}matchAll(...e){const t=[];for(const i of e)for(const s of this._patterns){const o=Ac(i,s);o&&t.push({element:i,pattern:s,match:o})}return t.length>0?t:null}getElementName(){if(this._patterns.length!==1)return null;const e=this._patterns[0],t=e.name;return typeof e!="function"&&t&&!(t instanceof RegExp)?t:null}}function Ac(n,e){if(typeof e=="function")return e(n);const t={};return e.name&&(t.name=HC(e.name,n.name),!t.name)||e.attributes&&(t.attributes=jC(e.attributes,n),!t.attributes)||e.classes&&(t.classes=GC(e.classes,n),!t.classes)||e.styles&&(t.styles=KC(e.styles,n),!t.styles)?null:t}function HC(n,e){return n instanceof RegExp?!!e.match(n):n===e}function za(n,e,t){const i=UC(n),s=Array.from(e),o=[];if(i.forEach(([r,a])=>{s.forEach(l=>{WC(r,l)&&qC(a,l,t)&&o.push(l)})}),!(!i.length||o.length<i.length))return o}function UC(n){return Array.isArray(n)?n.map(e=>Se(e)?((e.key===void 0||e.value===void 0)&&H("matcher-pattern-missing-key-or-value",e),[e.key,e.value]):[e,!0]):Se(n)?Object.entries(n):[[n,!0]]}function WC(n,e){return n===!0||n===e||n instanceof RegExp&&e.match(n)}function qC(n,e,t){if(n===!0)return!0;const i=t(e);return n===i||n instanceof RegExp&&!!String(i).match(n)}function jC(n,e){const t=new Set(e.getAttributeKeys());return Se(n)?(n.style!==void 0&&H("matcher-pattern-deprecated-attributes-style-key",n),n.class!==void 0&&H("matcher-pattern-deprecated-attributes-class-key",n)):(t.delete("style"),t.delete("class")),za(n,t,i=>e.getAttribute(i))}function GC(n,e){return za(n,e.getClassNames(),()=>{})}function KC(n,e){return za(n,e.getStyleNames(!0),t=>e.getStyle(t))}/**
|
|
297
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
298
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
299
|
+
*/class Rr{constructor(e){this._styles={},this._styleProcessor=e}get isEmpty(){return!Object.entries(this._styles).length}get size(){return this.isEmpty?0:this.getStyleNames().length}setTo(e){this.clear();const t=JC(e);for(const[i,s]of t)this._styleProcessor.toNormalizedForm(i,s,this._styles)}has(e){if(this.isEmpty)return!1;const i=this._styleProcessor.getReducedForm(e,this._styles).find(([s])=>s===e);return Array.isArray(i)}set(e,t){if(ie(e))for(const[i,s]of Object.entries(e))this._styleProcessor.toNormalizedForm(i,s,this._styles);else this._styleProcessor.toNormalizedForm(e,t,this._styles)}remove(e){const t=Vr(e);a2(this._styles,t),delete this._styles[e],this._cleanEmptyObjectsOnPath(t)}getNormalized(e){return this._styleProcessor.getNormalized(e,this._styles)}toString(){return this.isEmpty?"":this.getStylesEntries().map(e=>e.join(":")).sort().join(";")+";"}getAsString(e){if(this.isEmpty)return;if(this._styles[e]&&!ie(this._styles[e]))return this._styles[e];const i=this._styleProcessor.getReducedForm(e,this._styles).find(([s])=>s===e);if(Array.isArray(i))return i[1]}getStyleNames(e=!1){return this.isEmpty?[]:e?this._styleProcessor.getStyleNames(this._styles):this.getStylesEntries().map(([i])=>i)}clear(){this._styles={}}getStylesEntries(){const e=[],t=Object.keys(this._styles);for(const i of t)e.push(...this._styleProcessor.getReducedForm(i,this._styles));return e}_cleanEmptyObjectsOnPath(e){const t=e.split(".");if(!(t.length>1))return;const s=t.splice(0,t.length-1).join("."),o=Bs(this._styles,s);if(!o)return;!Object.keys(o).length&&this.remove(s)}}class ZC{constructor(){this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(e,t,i){if(ie(t)){Lo(i,Vr(e),t);return}if(this._normalizers.has(e)){const s=this._normalizers.get(e),{path:o,value:r}=s(t);Lo(i,o,r)}else Lo(i,e,t)}getNormalized(e,t){if(!e)return yf({},t);if(t[e]!==void 0)return t[e];if(this._extractors.has(e)){const i=this._extractors.get(e);if(typeof i=="string")return Bs(t,i);const s=i(e,t);if(s)return s}return Bs(t,Vr(e))}getReducedForm(e,t){const i=this.getNormalized(e,t);return i===void 0?[]:this._reducers.has(e)?this._reducers.get(e)(i):[[e,i]]}getStyleNames(e){const t=Array.from(this._consumables.keys()).filter(s=>{const o=this.getNormalized(s,e);return o&&typeof o=="object"?Object.keys(o).length:o}),i=new Set([...t,...Object.keys(e)]);return Array.from(i)}getRelatedStyles(e){return this._consumables.get(e)||[]}setNormalizer(e,t){this._normalizers.set(e,t)}setExtractor(e,t){this._extractors.set(e,t)}setReducer(e,t){this._reducers.set(e,t)}setStyleRelation(e,t){this._mapStyleNames(e,t);for(const i of t)this._mapStyleNames(i,[e])}_mapStyleNames(e,t){this._consumables.has(e)||this._consumables.set(e,[]),this._consumables.get(e).push(...t)}}function JC(n){let e=null,t=0,i=0,s=null;const o=new Map;if(n==="")return o;n.charAt(n.length-1)!=";"&&(n=n+";");for(let r=0;r<n.length;r++){const a=n.charAt(r);if(e===null)switch(a){case":":s||(s=n.substr(t,r-t),i=r+1);break;case'"':case"'":e=a;break;case";":{const l=n.substr(i,r-i);s&&o.set(s.trim(),l.trim()),s=null,t=r+1;break}}else a===e&&(e=null)}return o}function Vr(n){return n.replace("-",".")}function Lo(n,e,t){let i=t;ie(t)&&(i=yf({},Bs(n,e),t)),s2(n,e,i)}/**
|
|
300
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
301
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
302
|
+
*/let Je=class lm extends ci{constructor(e,t,i,s){if(super(e),this._unsafeAttributesToRender=[],this._customProperties=new Map,this.name=t,this._attrs=YC(i),this._children=[],s&&this._insertChild(0,s),this._classes=new Set,this._attrs.has("class")){const o=this._attrs.get("class");Sc(this._classes,o),this._attrs.delete("class")}this._styles=new Rr(this.document.stylesProcessor),this._attrs.has("style")&&(this._styles.setTo(this._attrs.get("style")),this._attrs.delete("style"))}get childCount(){return this._children.length}get isEmpty(){return this._children.length===0}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}*getAttributeKeys(){this._classes.size>0&&(yield"class"),this._styles.isEmpty||(yield"style"),yield*this._attrs.keys()}*getAttributes(){yield*this._attrs.entries(),this._classes.size>0&&(yield["class",this.getAttribute("class")]),this._styles.isEmpty||(yield["style",this.getAttribute("style")])}getAttribute(e){if(e=="class")return this._classes.size>0?[...this._classes].join(" "):void 0;if(e=="style"){const t=this._styles.toString();return t==""?void 0:t}return this._attrs.get(e)}hasAttribute(e){return e=="class"?this._classes.size>0:e=="style"?!this._styles.isEmpty:this._attrs.has(e)}isSimilar(e){if(!(e instanceof lm))return!1;if(this===e)return!0;if(this.name!=e.name||this._attrs.size!==e._attrs.size||this._classes.size!==e._classes.size||this._styles.size!==e._styles.size)return!1;for(const[t,i]of this._attrs)if(!e._attrs.has(t)||e._attrs.get(t)!==i)return!1;for(const t of this._classes)if(!e._classes.has(t))return!1;for(const t of this._styles.getStyleNames())if(!e._styles.has(t)||e._styles.getAsString(t)!==this._styles.getAsString(t))return!1;return!0}hasClass(...e){for(const t of e)if(!this._classes.has(t))return!1;return!0}getClassNames(){return this._classes.keys()}getStyle(e){return this._styles.getAsString(e)}getNormalizedStyle(e){return this._styles.getNormalized(e)}getStyleNames(e){return this._styles.getStyleNames(e)}hasStyle(...e){for(const t of e)if(!this._styles.has(t))return!1;return!0}findAncestor(...e){const t=new ni(...e);let i=this.parent;for(;i&&!i.is("documentFragment");){if(t.match(i))return i;i=i.parent}return null}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}getIdentity(){const e=Array.from(this._classes).sort().join(","),t=this._styles.toString(),i=Array.from(this._attrs).map(s=>`${s[0]}="${s[1]}"`).sort().join(" ");return this.name+(e==""?"":` class="${e}"`)+(t?` style="${t}"`:"")+(i==""?"":` ${i}`)}shouldRenderUnsafeAttribute(e){return this._unsafeAttributesToRender.includes(e)}_clone(e=!1){const t=[];if(e)for(const s of this.getChildren())t.push(s._clone(e));const i=new this.constructor(this.document,this.name,this._attrs,t);return i._classes=new Set(this._classes),i._styles.set(this._styles.getNormalized()),i._customProperties=new Map(this._customProperties),i.getFillerOffset=this.getFillerOffset,i._unsafeAttributesToRender=this._unsafeAttributesToRender,i}_appendChild(e){return this._insertChild(this.childCount,e)}_insertChild(e,t){this._fireChange("children",this);let i=0;const s=QC(this.document,t);for(const o of s)o.parent!==null&&o._remove(),o.parent=this,o.document=this.document,this._children.splice(e,0,o),e++,i++;return i}_removeChildren(e,t=1){this._fireChange("children",this);for(let i=e;i<e+t;i++)this._children[i].parent=null;return this._children.splice(e,t)}_setAttribute(e,t){const i=String(t);this._fireChange("attributes",this),e=="class"?Sc(this._classes,i):e=="style"?this._styles.setTo(i):this._attrs.set(e,i)}_removeAttribute(e){return this._fireChange("attributes",this),e=="class"?this._classes.size>0?(this._classes.clear(),!0):!1:e=="style"?this._styles.isEmpty?!1:(this._styles.clear(),!0):this._attrs.delete(e)}_addClass(e){this._fireChange("attributes",this);for(const t of K(e))this._classes.add(t)}_removeClass(e){this._fireChange("attributes",this);for(const t of K(e))this._classes.delete(t)}_setStyle(e,t){this._fireChange("attributes",this),typeof e!="string"?this._styles.set(e):this._styles.set(e,t)}_removeStyle(e){this._fireChange("attributes",this);for(const t of K(e))this._styles.remove(t)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}};Je.prototype.is=function(n,e){return e?e===this.name&&(n==="element"||n==="view:element"):n==="element"||n==="view:element"||n==="node"||n==="view:node"};function YC(n){const e=vt(n);for(const[t,i]of e)i===null?e.delete(t):typeof i!="string"&&e.set(t,String(i));return e}function Sc(n,e){const t=e.split(/\s+/);n.clear(),t.forEach(i=>n.add(i))}function QC(n,e){return typeof e=="string"?[new te(n,e)]:(De(e)||(e=[e]),Array.from(e).map(t=>typeof t=="string"?new te(n,t):t instanceof et?new te(n,t.data):t))}/**
|
|
303
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
304
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
305
|
+
*/class In extends Je{constructor(e,t,i,s){super(e,t,i,s),this.getFillerOffset=XC}}In.prototype.is=function(n,e){return e?e===this.name&&(n==="containerElement"||n==="view:containerElement"||n==="element"||n==="view:element"):n==="containerElement"||n==="view:containerElement"||n==="element"||n==="view:element"||n==="node"||n==="view:node"};function XC(){const n=[...this.getChildren()],e=n[this.childCount-1];if(e&&e.is("element","br"))return this.childCount;for(const t of n)if(!t.is("uiElement"))return null;return this.childCount}/**
|
|
306
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
307
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
308
|
+
*/class fo extends U(In){constructor(e,t,i,s){super(e,t,i,s),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("placeholder",void 0),this.bind("isReadOnly").to(e),this.bind("isFocused").to(e,"isFocused",o=>o&&e.selection.editableElement==this),this.listenTo(e.selection,"change",()=>{this.isFocused=e.isFocused&&e.selection.editableElement==this})}destroy(){this.stopListening()}}fo.prototype.is=function(n,e){return e?e===this.name&&(n==="editableElement"||n==="view:editableElement"||n==="containerElement"||n==="view:containerElement"||n==="element"||n==="view:element"):n==="editableElement"||n==="view:editableElement"||n==="containerElement"||n==="view:containerElement"||n==="element"||n==="view:element"||n==="node"||n==="view:node"};/**
|
|
309
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
310
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
311
|
+
*/const xc=Symbol("rootName");class cm extends fo{constructor(e,t){super(e,t),this.rootName="main"}get rootName(){return this.getCustomProperty(xc)}set rootName(e){this._setCustomProperty(xc,e)}set _name(e){this.name=e}}cm.prototype.is=function(n,e){return e?e===this.name&&(n==="rootElement"||n==="view:rootElement"||n==="editableElement"||n==="view:editableElement"||n==="containerElement"||n==="view:containerElement"||n==="element"||n==="view:element"):n==="rootElement"||n==="view:rootElement"||n==="editableElement"||n==="view:editableElement"||n==="containerElement"||n==="view:containerElement"||n==="element"||n==="view:element"||n==="node"||n==="view:node"};/**
|
|
312
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
313
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
314
|
+
*/let jt=class{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new g("view-tree-walker-no-start-position",null);if(e.direction&&e.direction!="forward"&&e.direction!="backward")throw new g("view-tree-walker-unknown-direction",e.startPosition,{direction:e.direction});this.boundaries=e.boundaries||null,e.startPosition?this._position=k._createAt(e.startPosition):this._position=k._createAt(e.boundaries[e.direction=="backward"?"end":"start"]),this.direction=e.direction||"forward",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null}[Symbol.iterator](){return this}get position(){return this._position}skip(e){let t,i;do i=this.position,t=this.next();while(!t.done&&e(t.value));t.done||(this._position=i)}next(){return this.direction=="forward"?this._next():this._previous()}_next(){let e=this.position.clone();const t=this.position,i=e.parent;if(i.parent===null&&e.offset===i.childCount)return{done:!0,value:void 0};if(i===this._boundaryEndParent&&e.offset==this.boundaries.end.offset)return{done:!0,value:void 0};let s;if(i instanceof te){if(e.isAtEnd)return this._position=k._createAfter(i),this._next();s=i.data[e.offset]}else s=i.getChild(e.offset);if(s instanceof Je){if(!this.shallow)e=new k(s,0);else{if(this.boundaries&&this.boundaries.end.isBefore(e))return{done:!0,value:void 0};e.offset++}return this._position=e,this._formatReturnValue("elementStart",s,t,e,1)}if(s instanceof te){if(this.singleCharacters)return e=new k(s,0),this._position=e,this._next();let o=s.data.length,r;return s==this._boundaryEndParent?(o=this.boundaries.end.offset,r=new et(s,0,o),e=k._createAfter(r)):(r=new et(s,0,s.data.length),e.offset++),this._position=e,this._formatReturnValue("text",r,t,e,o)}if(typeof s=="string"){let o;this.singleCharacters?o=1:o=(i===this._boundaryEndParent?this.boundaries.end.offset:i.data.length)-e.offset;const r=new et(i,e.offset,o);return e.offset+=o,this._position=e,this._formatReturnValue("text",r,t,e,o)}return e=k._createAfter(i),this._position=e,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",i,t,e)}_previous(){let e=this.position.clone();const t=this.position,i=e.parent;if(i.parent===null&&e.offset===0)return{done:!0,value:void 0};if(i==this._boundaryStartParent&&e.offset==this.boundaries.start.offset)return{done:!0,value:void 0};let s;if(i instanceof te){if(e.isAtStart)return this._position=k._createBefore(i),this._previous();s=i.data[e.offset-1]}else s=i.getChild(e.offset-1);if(s instanceof Je)return this.shallow?(e.offset--,this._position=e,this._formatReturnValue("elementStart",s,t,e,1)):(e=new k(s,s.childCount),this._position=e,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",s,t,e));if(s instanceof te){if(this.singleCharacters)return e=new k(s,s.data.length),this._position=e,this._previous();let o=s.data.length,r;if(s==this._boundaryStartParent){const a=this.boundaries.start.offset;r=new et(s,a,s.data.length-a),o=r.data.length,e=k._createBefore(r)}else r=new et(s,0,s.data.length),e.offset--;return this._position=e,this._formatReturnValue("text",r,t,e,o)}if(typeof s=="string"){let o;if(this.singleCharacters)o=1;else{const a=i===this._boundaryStartParent?this.boundaries.start.offset:0;o=e.offset-a}e.offset-=o;const r=new et(i,e.offset,o);return this._position=e,this._formatReturnValue("text",r,t,e,o)}return e=k._createBefore(i),this._position=e,this._formatReturnValue("elementStart",i,t,e,1)}_formatReturnValue(e,t,i,s,o){return t instanceof et&&(t.offsetInText+t.data.length==t.textNode.data.length&&(this.direction=="forward"&&!(this.boundaries&&this.boundaries.end.isEqual(this.position))?(s=k._createAfter(t.textNode),this._position=s):i=k._createAfter(t.textNode)),t.offsetInText===0&&(this.direction=="backward"&&!(this.boundaries&&this.boundaries.start.isEqual(this.position))?(s=k._createBefore(t.textNode),this._position=s):i=k._createBefore(t.textNode))),{done:!1,value:{type:e,item:t,previousPosition:i,nextPosition:s,length:o}}}};/**
|
|
315
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
316
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
317
|
+
*/let k=class ht extends li{constructor(e,t){super(),this.parent=e,this.offset=t}get nodeAfter(){return this.parent.is("$text")?null:this.parent.getChild(this.offset)||null}get nodeBefore(){return this.parent.is("$text")?null:this.parent.getChild(this.offset-1)||null}get isAtStart(){return this.offset===0}get isAtEnd(){const e=this.parent.is("$text")?this.parent.data.length:this.parent.childCount;return this.offset===e}get root(){return this.parent.root}get editableElement(){let e=this.parent;for(;!(e instanceof fo);)if(e.parent)e=e.parent;else return null;return e}getShiftedBy(e){const t=ht._createAt(this),i=t.offset+e;return t.offset=i<0?0:i,t}getLastMatchingPosition(e,t={}){t.startPosition=this;const i=new jt(t);return i.skip(e),i.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(e){const t=this.getAncestors(),i=e.getAncestors();let s=0;for(;t[s]==i[s]&&t[s];)s++;return s===0?null:t[s-1]}isEqual(e){return this.parent==e.parent&&this.offset==e.offset}isBefore(e){return this.compareWith(e)=="before"}isAfter(e){return this.compareWith(e)=="after"}compareWith(e){if(this.root!==e.root)return"different";if(this.isEqual(e))return"same";const t=this.parent.is("node")?this.parent.getPath():[],i=e.parent.is("node")?e.parent.getPath():[];t.push(this.offset),i.push(e.offset);const s=ye(t,i);switch(s){case"prefix":return"before";case"extension":return"after";default:return t[s]<i[s]?"before":"after"}}getWalker(e={}){return e.startPosition=this,new jt(e)}clone(){return new ht(this.parent,this.offset)}static _createAt(e,t){if(e instanceof ht)return new this(e.parent,e.offset);{const i=e;if(t=="end")t=i.is("$text")?i.data.length:i.childCount;else{if(t=="before")return this._createBefore(i);if(t=="after")return this._createAfter(i);if(t!==0&&!t)throw new g("view-createpositionat-offset-required",i)}return new ht(i,t)}}static _createAfter(e){if(e.is("$textProxy"))return new ht(e.textNode,e.offsetInText+e.data.length);if(!e.parent)throw new g("view-position-after-root",e,{root:e});return new ht(e.parent,e.index+1)}static _createBefore(e){if(e.is("$textProxy"))return new ht(e.textNode,e.offsetInText);if(!e.parent)throw new g("view-position-before-root",e,{root:e});return new ht(e.parent,e.index)}};k.prototype.is=function(n){return n==="position"||n==="view:position"};/**
|
|
318
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
319
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
320
|
+
*/let F=class St extends li{constructor(e,t=null){super(),this.start=e.clone(),this.end=t?t.clone():e.clone()}*[Symbol.iterator](){yield*new jt({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return this.start.parent===this.end.parent}get root(){return this.start.root}getEnlarged(){let e=this.start.getLastMatchingPosition(ls,{direction:"backward"}),t=this.end.getLastMatchingPosition(ls);return e.parent.is("$text")&&e.isAtStart&&(e=k._createBefore(e.parent)),t.parent.is("$text")&&t.isAtEnd&&(t=k._createAfter(t.parent)),new St(e,t)}getTrimmed(){let e=this.start.getLastMatchingPosition(ls);if(e.isAfter(this.end)||e.isEqual(this.end))return new St(e,e);let t=this.end.getLastMatchingPosition(ls,{direction:"backward"});const i=e.nodeAfter,s=t.nodeBefore;return i&&i.is("$text")&&(e=new k(i,0)),s&&s.is("$text")&&(t=new k(s,s.data.length)),new St(e,t)}isEqual(e){return this==e||this.start.isEqual(e.start)&&this.end.isEqual(e.end)}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);const i=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),s=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return i&&s}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new St(this.start,e.start)),this.containsPosition(e.end)&&t.push(new St(e.end,this.end))):t.push(this.clone()),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,i=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(i=e.end),new St(t,i)}return null}getWalker(e={}){return e.boundaries=this,new jt(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 St(this.start,this.end)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new jt(e);for(const i of t)yield i.item}*getPositions(e={}){e.boundaries=this;const t=new jt(e);yield t.position;for(const i of t)yield i.nextPosition}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}static _createFromParentsAndOffsets(e,t,i,s){return new this(new k(e,t),new k(i,s))}static _createFromPositionAndShift(e,t){const i=e,s=e.getShiftedBy(t);return t>0?new this(i,s):new this(s,i)}static _createIn(e){return this._createFromParentsAndOffsets(e,0,e,e.childCount)}static _createOn(e){const t=e.is("$textProxy")?e.offsetSize:1;return this._createFromPositionAndShift(k._createBefore(e),t)}};F.prototype.is=function(n){return n==="range"||n==="view:range"};function ls(n){return!!(n.item.is("attributeElement")||n.item.is("uiElement"))}/**
|
|
321
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
322
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
323
|
+
*/let wt=class um extends Z(li){constructor(...e){super(),this._ranges=[],this._lastRangeBackward=!1,this._isFake=!1,this._fakeSelectionLabel="",e.length&&this.setTo(...e)}get isFake(){return this._isFake}get fakeSelectionLabel(){return this._fakeSelectionLabel}get anchor(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.end:e.start).clone()}get focus(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.start:e.end).clone()}get isCollapsed(){return this.rangeCount===1&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}get editableElement(){return this.anchor?this.anchor.editableElement:null}*getRanges(){for(const e of this._ranges)yield e.clone()}getFirstRange(){let e=null;for(const t of this._ranges)(!e||t.start.isBefore(e.start))&&(e=t);return e?e.clone():null}getLastRange(){let e=null;for(const t of this._ranges)(!e||t.end.isAfter(e.end))&&(e=t);return e?e.clone():null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}isEqual(e){if(this.isFake!=e.isFake||this.isFake&&this.fakeSelectionLabel!=e.fakeSelectionLabel||this.rangeCount!=e.rangeCount)return!1;if(this.rangeCount===0)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let i=!1;for(const s of e._ranges)if(t.isEqual(s)){i=!0;break}if(!i)return!1}return!0}isSimilar(e){if(this.isBackward!=e.isBackward)return!1;const t=Ar(this.getRanges()),i=Ar(e.getRanges());if(t!=i)return!1;if(t==0)return!0;for(let s of this.getRanges()){s=s.getTrimmed();let o=!1;for(let r of e.getRanges())if(r=r.getTrimmed(),s.start.isEqual(r.start)&&s.end.isEqual(r.end)){o=!0;break}if(!o)return!1}return!0}getSelectedElement(){return this.rangeCount!==1?null:this.getFirstRange().getContainedElement()}setTo(...e){let[t,i,s]=e;if(typeof i=="object"&&(s=i,i=void 0),t===null)this._setRanges([]),this._setFakeOptions(s);else if(t instanceof um||t instanceof Ha)this._setRanges(t.getRanges(),t.isBackward),this._setFakeOptions({fake:t.isFake,label:t.fakeSelectionLabel});else if(t instanceof F)this._setRanges([t],s&&s.backward),this._setFakeOptions(s);else if(t instanceof k)this._setRanges([new F(t)]),this._setFakeOptions(s);else if(t instanceof ci){const o=!!s&&!!s.backward;let r;if(i===void 0)throw new g("view-selection-setto-required-second-parameter",this);i=="in"?r=F._createIn(t):i=="on"?r=F._createOn(t):r=new F(k._createAt(t,i)),this._setRanges([r],o),this._setFakeOptions(s)}else if(De(t))this._setRanges(t,s&&s.backward),this._setFakeOptions(s);else throw new g("view-selection-setto-not-selectable",this);this.fire("change")}setFocus(e,t){if(this.anchor===null)throw new g("view-selection-setfocus-no-ranges",this);const i=k._createAt(e,t);if(i.compareWith(this.focus)=="same")return;const s=this.anchor;this._ranges.pop(),i.compareWith(s)=="before"?this._addRange(new F(i,s),!0):this._addRange(new F(s,i)),this.fire("change")}_setRanges(e,t=!1){e=Array.from(e),this._ranges=[];for(const i of e)this._addRange(i);this._lastRangeBackward=!!t}_setFakeOptions(e={}){this._isFake=!!e.fake,this._fakeSelectionLabel=e.fake&&e.label||""}_addRange(e,t=!1){if(!(e instanceof F))throw new g("view-selection-add-range-not-range",this);this._pushRange(e),this._lastRangeBackward=!!t}_pushRange(e){for(const t of this._ranges)if(e.isIntersecting(t))throw new g("view-selection-range-intersects",this,{addedRange:e,intersectingRange:t});this._ranges.push(new F(e.start,e.end))}};wt.prototype.is=function(n){return n==="selection"||n==="view:selection"};/**
|
|
324
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
325
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
326
|
+
*/let Ha=class extends Z(li){constructor(...e){super(),this._selection=new wt,this._selection.delegate("change").to(this),e.length&&this._selection.setTo(...e)}get isFake(){return this._selection.isFake}get fakeSelectionLabel(){return this._selection.fakeSelectionLabel}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get isCollapsed(){return this._selection.isCollapsed}get rangeCount(){return this._selection.rangeCount}get isBackward(){return this._selection.isBackward}get editableElement(){return this._selection.editableElement}get _ranges(){return this._selection._ranges}*getRanges(){yield*this._selection.getRanges()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getSelectedElement(){return this._selection.getSelectedElement()}isEqual(e){return this._selection.isEqual(e)}isSimilar(e){return this._selection.isSimilar(e)}_setTo(...e){this._selection.setTo(...e)}_setFocus(e,t){this._selection.setFocus(e,t)}};Ha.prototype.is=function(n){return n==="selection"||n=="documentSelection"||n=="view:selection"||n=="view:documentSelection"};/**
|
|
327
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
328
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
329
|
+
*/class Ji extends _t{constructor(e,t,i){super(e,t),this.startRange=i,this._eventPhase="none",this._currentTarget=null}get eventPhase(){return this._eventPhase}get currentTarget(){return this._currentTarget}}/**
|
|
330
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
331
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
332
|
+
*/const Bo=Symbol("bubbling contexts");function Lr(n){class e extends n{fire(i,...s){try{const o=i instanceof _t?i:new _t(this,i),r=Oo(this);if(!r.size)return;if(tn(o,"capturing",this),bi(r,"$capture",o,...s))return o.return;const a=o.startRange||this.selection.getFirstRange(),l=a?a.getContainedElement():null,c=l?!!dm(r,l):!1;let u=l||ek(a);if(tn(o,"atTarget",u),!c){if(bi(r,"$text",o,...s))return o.return;tn(o,"bubbling",u)}for(;u;){if(u.is("rootElement")){if(bi(r,"$root",o,...s))return o.return}else if(u.is("element")&&bi(r,u.name,o,...s))return o.return;if(bi(r,u,o,...s))return o.return;u=u.parent,tn(o,"bubbling",u)}return tn(o,"bubbling",this),bi(r,"$document",o,...s),o.return}catch(o){/* istanbul ignore next -- @preserve */g.rethrowUnexpectedError(o,this)}}_addEventListener(i,s,o){const r=K(o.context||"$document"),a=Oo(this);for(const l of r){let c=a.get(l);c||(c=new(Z()),a.set(l,c)),this.listenTo(c,i,s,o)}}_removeEventListener(i,s){const o=Oo(this);for(const r of o.values())this.stopListening(r,i,s)}}return e}{const n=Lr(Object);["fire","_addEventListener","_removeEventListener"].forEach(e=>{Lr[e]=n.prototype[e]})}function tn(n,e,t){n instanceof Ji&&(n._eventPhase=e,n._currentTarget=t)}function bi(n,e,t,...i){const s=typeof e=="string"?n.get(e):dm(n,e);return s?(s.fire(t,...i),t.stop.called):!1}function dm(n,e){for(const[t,i]of n)if(typeof t=="function"&&t(e))return i;return null}function Oo(n){return n[Bo]||(n[Bo]=new Map),n[Bo]}function ek(n){if(!n)return null;const e=n.start.parent,t=n.end.parent,i=e.getPath(),s=t.getPath();return i.length>s.length?e:t}/**
|
|
333
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
334
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
335
|
+
*/let hm=class extends Lr(U()){constructor(e){super(),this._postFixers=new Set,this.selection=new Ha,this.roots=new _e({idProperty:"rootName"}),this.stylesProcessor=e,this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isSelecting",!1),this.set("isComposing",!1)}getRoot(e="main"){return this.roots.get(e)}registerPostFixer(e){this._postFixers.add(e)}destroy(){this.roots.forEach(e=>e.destroy()),this.stopListening()}_callPostFixers(e){let t=!1;do for(const i of this._postFixers)if(t=i(e),t)break;while(t)}};/**
|
|
336
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
337
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
338
|
+
*/const fm=10;class Kt extends Je{constructor(e,t,i,s){super(e,t,i,s),this._priority=fm,this._id=null,this._clonesGroup=null,this.getFillerOffset=tk}get priority(){return this._priority}get id(){return this._id}getElementsWithSameId(){if(this.id===null)throw new g("attribute-element-get-elements-with-same-id-no-id",this);return new Set(this._clonesGroup)}isSimilar(e){return this.id!==null||e.id!==null?this.id===e.id:super.isSimilar(e)&&this.priority==e.priority}_clone(e=!1){const t=super._clone(e);return t._priority=this._priority,t._id=this._id,t}}Kt.DEFAULT_PRIORITY=fm;Kt.prototype.is=function(n,e){return e?e===this.name&&(n==="attributeElement"||n==="view:attributeElement"||n==="element"||n==="view:element"):n==="attributeElement"||n==="view:attributeElement"||n==="element"||n==="view:element"||n==="node"||n==="view:node"};function tk(){if(Mo(this))return null;let n=this.parent;for(;n&&n.is("attributeElement");){if(Mo(n)>1)return null;n=n.parent}return!n||Mo(n)>1?null:this.childCount}function Mo(n){return Array.from(n.getChildren()).filter(e=>!e.is("uiElement")).length}/**
|
|
339
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
340
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
341
|
+
*/class Ua extends Je{constructor(e,t,i,s){super(e,t,i,s),this.getFillerOffset=ik}_insertChild(e,t){if(t&&(t instanceof ci||Array.from(t).length>0))throw new g("view-emptyelement-cannot-add",[this,t]);return 0}}Ua.prototype.is=function(n,e){return e?e===this.name&&(n==="emptyElement"||n==="view:emptyElement"||n==="element"||n==="view:element"):n==="emptyElement"||n==="view:emptyElement"||n==="element"||n==="view:element"||n==="node"||n==="view:node"};function ik(){return null}/**
|
|
342
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
343
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
344
|
+
*/class mo extends Je{constructor(e,t,i,s){super(e,t,i,s),this.getFillerOffset=sk}_insertChild(e,t){if(t&&(t instanceof ci||Array.from(t).length>0))throw new g("view-uielement-cannot-add",[this,t]);return 0}render(e,t){return this.toDomElement(e)}toDomElement(e){const t=e.createElement(this.name);for(const i of this.getAttributeKeys())t.setAttribute(i,this.getAttribute(i));return t}}mo.prototype.is=function(n,e){return e?e===this.name&&(n==="uiElement"||n==="view:uiElement"||n==="element"||n==="view:element"):n==="uiElement"||n==="view:uiElement"||n==="element"||n==="view:element"||n==="node"||n==="view:node"};function nk(n){n.document.on("arrowKey",(e,t)=>ok(e,t,n.domConverter),{priority:"low"})}function sk(){return null}function ok(n,e,t){if(e.keyCode==N.arrowright){const i=e.domTarget.ownerDocument.defaultView.getSelection(),s=i.rangeCount==1&&i.getRangeAt(0).collapsed;if(s||e.shiftKey){const o=i.focusNode,r=i.focusOffset,a=t.domPositionToView(o,r);if(a===null)return;let l=!1;const c=a.getLastMatchingPosition(u=>(u.item.is("uiElement")&&(l=!0),!!(u.item.is("uiElement")||u.item.is("attributeElement"))));if(l){const u=t.viewPositionToDom(c);s?i.collapse(u.parent,u.offset):i.extend(u.parent,u.offset)}}}}/**
|
|
345
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
346
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
347
|
+
*/class Wa extends Je{constructor(e,t,i,s){super(e,t,i,s),this.getFillerOffset=rk}_insertChild(e,t){if(t&&(t instanceof ci||Array.from(t).length>0))throw new g("view-rawelement-cannot-add",[this,t]);return 0}render(e,t){}}Wa.prototype.is=function(n,e){return e?e===this.name&&(n==="rawElement"||n==="view:rawElement"||n==="element"||n==="view:element"):n==="rawElement"||n==="view:rawElement"||n===this.name||n==="view:"+this.name||n==="element"||n==="view:element"||n==="node"||n==="view:node"};function rk(){return null}/**
|
|
348
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
349
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
350
|
+
*/let Zt=class extends Z(li){constructor(e,t){super(),this._children=[],this._customProperties=new Map,this.document=e,t&&this._insertChild(0,t)}[Symbol.iterator](){return this._children[Symbol.iterator]()}get childCount(){return this._children.length}get isEmpty(){return this.childCount===0}get root(){return this}get parent(){return null}get name(){}get getFillerOffset(){}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}_appendChild(e){return this._insertChild(this.childCount,e)}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}_insertChild(e,t){this._fireChange("children",this);let i=0;const s=ak(this.document,t);for(const o of s)o.parent!==null&&o._remove(),o.parent=this,this._children.splice(e,0,o),e++,i++;return i}_removeChildren(e,t=1){this._fireChange("children",this);for(let i=e;i<e+t;i++)this._children[i].parent=null;return this._children.splice(e,t)}_fireChange(e,t){this.fire("change:"+e,t)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}};Zt.prototype.is=function(n){return n==="documentFragment"||n==="view:documentFragment"};function ak(n,e){return typeof e=="string"?[new te(n,e)]:(De(e)||(e=[e]),Array.from(e).map(t=>typeof t=="string"?new te(n,t):t instanceof et?new te(n,t.data):t))}/**
|
|
351
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
352
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
353
|
+
*/class mm{constructor(e){this._cloneGroups=new Map,this._slotFactory=null,this.document=e}setSelection(...e){this.document.selection._setTo(...e)}setSelectionFocus(e,t){this.document.selection._setFocus(e,t)}createDocumentFragment(e){return new Zt(this.document,e)}createText(e){return new te(this.document,e)}createAttributeElement(e,t,i={}){const s=new Kt(this.document,e,t);return typeof i.priority=="number"&&(s._priority=i.priority),i.id&&(s._id=i.id),i.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),s}createContainerElement(e,t,i={},s={}){let o=null;Se(i)?s=i:o=i;const r=new In(this.document,e,t,o);return s.renderUnsafeAttributes&&r._unsafeAttributesToRender.push(...s.renderUnsafeAttributes),r}createEditableElement(e,t,i={}){const s=new fo(this.document,e,t);return i.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),s}createEmptyElement(e,t,i={}){const s=new Ua(this.document,e,t);return i.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),s}createUIElement(e,t,i){const s=new mo(this.document,e,t);return i&&(s.render=i),s}createRawElement(e,t,i,s={}){const o=new Wa(this.document,e,t);return i&&(o.render=i),s.renderUnsafeAttributes&&o._unsafeAttributesToRender.push(...s.renderUnsafeAttributes),o}setAttribute(e,t,i){i._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,i){Se(e)&&i===void 0?t._setStyle(e):i._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,i){i._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}breakAttributes(e){return e instanceof k?this._breakAttributes(e):this._breakAttributesRange(e)}breakContainer(e){const t=e.parent;if(!t.is("containerElement"))throw new g("view-writer-break-non-container-element",this.document);if(!t.parent)throw new g("view-writer-break-root",this.document);if(e.isAtStart)return k._createBefore(t);if(!e.isAtEnd){const i=t._clone(!1);this.insert(k._createAfter(t),i);const s=new F(e,k._createAt(t,"end")),o=new k(i,0);this.move(s,o)}return k._createAfter(t)}mergeAttributes(e){const t=e.offset,i=e.parent;if(i.is("$text"))return e;if(i.is("attributeElement")&&i.childCount===0){const r=i.parent,a=i.index;return i._remove(),this._removeFromClonedElementsGroup(i),this.mergeAttributes(new k(r,a))}const s=i.getChild(t-1),o=i.getChild(t);if(!s||!o)return e;if(s.is("$text")&&o.is("$text"))return Pc(s,o);if(s.is("attributeElement")&&o.is("attributeElement")&&s.isSimilar(o)){const r=s.childCount;return s._appendChild(o.getChildren()),o._remove(),this._removeFromClonedElementsGroup(o),this.mergeAttributes(new k(s,r))}return e}mergeContainers(e){const t=e.nodeBefore,i=e.nodeAfter;if(!t||!i||!t.is("containerElement")||!i.is("containerElement"))throw new g("view-writer-merge-containers-invalid-position",this.document);const s=t.getChild(t.childCount-1),o=s instanceof te?k._createAt(s,"end"):k._createAt(t,"end");return this.move(F._createIn(i),k._createAt(t,"end")),this.remove(F._createOn(i)),o}insert(e,t){t=De(t)?[...t]:[t],gm(t,this.document);const i=t.reduce((r,a)=>{const l=r[r.length-1],c=!a.is("uiElement");return!l||l.breakAttributes!=c?r.push({breakAttributes:c,nodes:[a]}):l.nodes.push(a),r},[]);let s=null,o=e;for(const{nodes:r,breakAttributes:a}of i){const l=this._insertNodes(o,r,a);s||(s=l.start),o=l.end}return s?new F(s,o):new F(e)}remove(e){const t=e instanceof F?e:F._createOn(e);if(nn(t,this.document),t.isCollapsed)return new Zt(this.document);const{start:i,end:s}=this._breakAttributesRange(t,!0),o=i.parent,r=s.offset-i.offset,a=o._removeChildren(i.offset,r);for(const c of a)this._removeFromClonedElementsGroup(c);const l=this.mergeAttributes(i);return t.start=l,t.end=l.clone(),new Zt(this.document,a)}clear(e,t){nn(e,this.document);const i=e.getWalker({direction:"backward",ignoreElementEnd:!0});for(const s of i){const o=s.item;let r;if(o.is("element")&&t.isSimilar(o))r=F._createOn(o);else if(!s.nextPosition.isAfter(e.start)&&o.is("$textProxy")){const a=o.getAncestors().find(l=>l.is("element")&&t.isSimilar(l));a&&(r=F._createIn(a))}r&&(r.end.isAfter(e.end)&&(r.end=e.end),r.start.isBefore(e.start)&&(r.start=e.start),this.remove(r))}}move(e,t){let i;if(t.isAfter(e.end)){t=this._breakAttributes(t,!0);const s=t.parent,o=s.childCount;e=this._breakAttributesRange(e,!0),i=this.remove(e),t.offset+=s.childCount-o}else i=this.remove(e);return this.insert(t,i)}wrap(e,t){if(!(t instanceof Kt))throw new g("view-writer-wrap-invalid-attribute",this.document);if(nn(e,this.document),e.isCollapsed){let i=e.start;i.parent.is("element")&&!lk(i.parent)&&(i=i.getLastMatchingPosition(o=>o.item.is("uiElement"))),i=this._wrapPosition(i,t);const s=this.document.selection;return s.isCollapsed&&s.getFirstPosition().isEqual(e.start)&&this.setSelection(i),new F(i)}else return this._wrapRange(e,t)}unwrap(e,t){if(!(t instanceof Kt))throw new g("view-writer-unwrap-invalid-attribute",this.document);if(nn(e,this.document),e.isCollapsed)return e;const{start:i,end:s}=this._breakAttributesRange(e,!0),o=i.parent,r=this._unwrapChildren(o,i.offset,s.offset,t),a=this.mergeAttributes(r.start);a.isEqual(r.start)||r.end.offset--;const l=this.mergeAttributes(r.end);return new F(a,l)}rename(e,t){const i=new In(this.document,e,t.getAttributes());return this.insert(k._createAfter(t),i),this.move(F._createIn(t),k._createAt(i,0)),this.remove(F._createOn(t)),i}clearClonedElementsGroup(e){this._cloneGroups.delete(e)}createPositionAt(e,t){return k._createAt(e,t)}createPositionAfter(e){return k._createAfter(e)}createPositionBefore(e){return k._createBefore(e)}createRange(e,t){return new F(e,t)}createRangeOn(e){return F._createOn(e)}createRangeIn(e){return F._createIn(e)}createSelection(...e){return new wt(...e)}createSlot(e="children"){if(!this._slotFactory)throw new g("view-writer-invalid-create-slot-context",this.document);return this._slotFactory(this,e)}_registerSlotFactory(e){this._slotFactory=e}_clearSlotFactory(){this._slotFactory=null}_insertNodes(e,t,i){let s;if(i?s=Br(e):s=e.parent.is("$text")?e.parent.parent:e.parent,!s)throw new g("view-writer-invalid-position-container",this.document);let o;i?o=this._breakAttributes(e,!0):o=e.parent.is("$text")?Fo(e):e;const r=s._insertChild(o.offset,t);for(const u of t)this._addToClonedElementsGroup(u);const a=o.getShiftedBy(r),l=this.mergeAttributes(o);l.isEqual(o)||a.offset--;const c=this.mergeAttributes(a);return new F(l,c)}_wrapChildren(e,t,i,s){let o=t;const r=[];for(;o<i;){const l=e.getChild(o),c=l.is("$text"),u=l.is("attributeElement");if(u&&this._wrapAttributeElement(s,l))r.push(new k(e,o));else if(c||!u||ck(s,l)){const d=s._clone();l._remove(),d._appendChild(l),e._insertChild(o,d),this._addToClonedElementsGroup(d),r.push(new k(e,o))}else this._wrapChildren(l,0,l.childCount,s);o++}let a=0;for(const l of r){if(l.offset-=a,l.offset==t)continue;this.mergeAttributes(l).isEqual(l)||(a++,i--)}return F._createFromParentsAndOffsets(e,t,e,i)}_unwrapChildren(e,t,i,s){let o=t;const r=[];for(;o<i;){const l=e.getChild(o);if(!l.is("attributeElement")){o++;continue}if(l.isSimilar(s)){const c=l.getChildren(),u=l.childCount;l._remove(),e._insertChild(o,c),this._removeFromClonedElementsGroup(l),r.push(new k(e,o),new k(e,o+u)),o+=u,i+=u-1;continue}if(this._unwrapAttributeElement(s,l)){r.push(new k(e,o),new k(e,o+1)),o++;continue}this._unwrapChildren(l,0,l.childCount,s),o++}let a=0;for(const l of r){if(l.offset-=a,l.offset==t||l.offset==i)continue;this.mergeAttributes(l).isEqual(l)||(a++,i--)}return F._createFromParentsAndOffsets(e,t,e,i)}_wrapRange(e,t){const{start:i,end:s}=this._breakAttributesRange(e,!0),o=i.parent,r=this._wrapChildren(o,i.offset,s.offset,t),a=this.mergeAttributes(r.start);a.isEqual(r.start)||r.end.offset--;const l=this.mergeAttributes(r.end);return new F(a,l)}_wrapPosition(e,t){if(t.isSimilar(e.parent))return Ic(e.clone());e.parent.is("$text")&&(e=Fo(e));const i=this.createAttributeElement("_wrapPosition-fake-element");i._priority=Number.POSITIVE_INFINITY,i.isSimilar=()=>!1,e.parent._insertChild(e.offset,i);const s=new F(e,e.getShiftedBy(1));this.wrap(s,t);const o=new k(i.parent,i.index);i._remove();const r=o.nodeBefore,a=o.nodeAfter;return r instanceof te&&a instanceof te?Pc(r,a):Ic(o)}_wrapAttributeElement(e,t){if(!Rc(e,t)||e.name!==t.name||e.priority!==t.priority)return!1;for(const i of e.getAttributeKeys())if(!(i==="class"||i==="style")&&t.hasAttribute(i)&&t.getAttribute(i)!==e.getAttribute(i))return!1;for(const i of e.getStyleNames())if(t.hasStyle(i)&&t.getStyle(i)!==e.getStyle(i))return!1;for(const i of e.getAttributeKeys())i==="class"||i==="style"||t.hasAttribute(i)||this.setAttribute(i,e.getAttribute(i),t);for(const i of e.getStyleNames())t.hasStyle(i)||this.setStyle(i,e.getStyle(i),t);for(const i of e.getClassNames())t.hasClass(i)||this.addClass(i,t);return!0}_unwrapAttributeElement(e,t){if(!Rc(e,t)||e.name!==t.name||e.priority!==t.priority)return!1;for(const i of e.getAttributeKeys())if(!(i==="class"||i==="style")&&(!t.hasAttribute(i)||t.getAttribute(i)!==e.getAttribute(i)))return!1;if(!t.hasClass(...e.getClassNames()))return!1;for(const i of e.getStyleNames())if(!t.hasStyle(i)||t.getStyle(i)!==e.getStyle(i))return!1;for(const i of e.getAttributeKeys())i==="class"||i==="style"||this.removeAttribute(i,t);return this.removeClass(Array.from(e.getClassNames()),t),this.removeStyle(Array.from(e.getStyleNames()),t),!0}_breakAttributesRange(e,t=!1){const i=e.start,s=e.end;if(nn(e,this.document),e.isCollapsed){const l=this._breakAttributes(e.start,t);return new F(l,l)}const o=this._breakAttributes(s,t),r=o.parent.childCount,a=this._breakAttributes(i,t);return o.offset+=o.parent.childCount-r,new F(a,o)}_breakAttributes(e,t=!1){const i=e.offset,s=e.parent;if(e.parent.is("emptyElement"))throw new g("view-writer-cannot-break-empty-element",this.document);if(e.parent.is("uiElement"))throw new g("view-writer-cannot-break-ui-element",this.document);if(e.parent.is("rawElement"))throw new g("view-writer-cannot-break-raw-element",this.document);if(!t&&s.is("$text")&&Or(s.parent)||Or(s))return e.clone();if(s.is("$text"))return this._breakAttributes(Fo(e),t);const o=s.childCount;if(i==o){const r=new k(s.parent,s.index+1);return this._breakAttributes(r,t)}else if(i===0){const r=new k(s.parent,s.index);return this._breakAttributes(r,t)}else{const r=s.index+1,a=s._clone();s.parent._insertChild(r,a),this._addToClonedElementsGroup(a);const l=s.childCount-i,c=s._removeChildren(i,l);a._appendChild(c);const u=new k(s.parent,r);return this._breakAttributes(u,t)}}_addToClonedElementsGroup(e){if(!e.root.is("rootElement"))return;if(e.is("element"))for(const s of e.getChildren())this._addToClonedElementsGroup(s);const t=e.id;if(!t)return;let i=this._cloneGroups.get(t);i||(i=new Set,this._cloneGroups.set(t,i)),i.add(e),e._clonesGroup=i}_removeFromClonedElementsGroup(e){if(e.is("element"))for(const s of e.getChildren())this._removeFromClonedElementsGroup(s);const t=e.id;if(!t)return;const i=this._cloneGroups.get(t);i&&i.delete(e)}}function lk(n){return Array.from(n.getChildren()).some(e=>!e.is("uiElement"))}function Br(n){let e=n.parent;for(;!Or(e);){if(!e)return;e=e.parent}return e}function ck(n,e){return n.priority<e.priority?!0:n.priority>e.priority?!1:n.getIdentity()<e.getIdentity()}function Ic(n){const e=n.nodeBefore;if(e&&e.is("$text"))return new k(e,e.data.length);const t=n.nodeAfter;return t&&t.is("$text")?new k(t,0):n}function Fo(n){if(n.offset==n.parent.data.length)return new k(n.parent.parent,n.parent.index+1);if(n.offset===0)return new k(n.parent.parent,n.parent.index);const e=n.parent.data.slice(n.offset);return n.parent._data=n.parent.data.slice(0,n.offset),n.parent.parent._insertChild(n.parent.index+1,new te(n.root.document,e)),new k(n.parent.parent,n.parent.index+1)}function Pc(n,e){const t=n.data.length;return n._data+=e.data,e._remove(),new k(n,t)}const uk=[te,Kt,In,Ua,Wa,mo];function gm(n,e){for(const t of n){if(!uk.some(i=>t instanceof i))throw new g("view-writer-insert-invalid-node-type",e);t.is("$text")||gm(t.getChildren(),e)}}function Or(n){return n&&(n.is("containerElement")||n.is("documentFragment"))}function nn(n,e){const t=Br(n.start),i=Br(n.end);if(!t||!i||t!==i)throw new g("view-writer-invalid-range-container",e)}function Rc(n,e){return n.id===null&&e.id===null}/**
|
|
354
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
355
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
356
|
+
*/const pm=n=>n.createTextNode(" "),wm=n=>{const e=n.createElement("span");return e.dataset.ckeFiller="true",e.innerText=" ",e},bm=n=>{const e=n.createElement("br");return e.dataset.ckeFiller="true",e},Ge=7,Pn="".repeat(Ge);function Be(n){return typeof n=="string"?n.substr(0,Ge)===Pn:ue(n)&&n.data.substr(0,Ge)===Pn}function dn(n){return n.data.length==Ge&&Be(n)}function Vc(n){const e=typeof n=="string"?n:n.data;return Be(n)?e.slice(Ge):e}function dk(n){n.document.on("arrowKey",hk,{priority:"low"})}function hk(n,e){if(e.keyCode==N.arrowleft){const t=e.domTarget.ownerDocument.defaultView.getSelection();if(t.rangeCount==1&&t.getRangeAt(0).collapsed){const i=t.getRangeAt(0).startContainer,s=t.getRangeAt(0).startOffset;Be(i)&&s<=Ge&&t.collapse(i,0)}}}/**
|
|
357
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
358
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
359
|
+
*/class fk extends U(){constructor(e,t){super(),this.domDocuments=new Set,this.markedAttributes=new Set,this.markedChildren=new Set,this.markedTexts=new Set,this._inlineFiller=null,this._fakeSelectionContainer=null,this.domConverter=e,this.selection=t,this.set("isFocused",!1),this.set("isSelecting",!1),L.isBlink&&!L.isAndroid&&this.on("change:isSelecting",()=>{this.isSelecting||this.render()}),this.set("isComposing",!1),this.on("change:isComposing",()=>{this.isComposing||this.render()})}markToSync(e,t){if(e==="text")this.domConverter.mapViewToDom(t.parent)&&this.markedTexts.add(t);else{if(!this.domConverter.mapViewToDom(t))return;if(e==="attributes")this.markedAttributes.add(t);else if(e==="children")this.markedChildren.add(t);else throw new g("view-renderer-unknown-type",this)}}render(){if(this.isComposing&&!L.isAndroid)return;let e=null;const t=L.isBlink&&!L.isAndroid?!this.isSelecting:!0;for(const i of this.markedChildren)this._updateChildrenMappings(i);t?(this._inlineFiller&&!this._isSelectionInInlineFiller()&&this._removeInlineFiller(),this._inlineFiller?e=this._getInlineFillerPosition():this._needsInlineFillerAtSelection()&&(e=this.selection.getFirstPosition(),this.markedChildren.add(e.parent))):this._inlineFiller&&this._inlineFiller.parentNode&&(e=this.domConverter.domPositionToView(this._inlineFiller),e&&e.parent.is("$text")&&(e=k._createBefore(e.parent)));for(const i of this.markedAttributes)this._updateAttrs(i);for(const i of this.markedChildren)this._updateChildren(i,{inlineFillerPosition:e});for(const i of this.markedTexts)!this.markedChildren.has(i.parent)&&this.domConverter.mapViewToDom(i.parent)&&this._updateText(i,{inlineFillerPosition:e});if(t)if(e){const i=this.domConverter.viewPositionToDom(e),s=i.parent.ownerDocument;Be(i.parent)?this._inlineFiller=i.parent:this._inlineFiller=Lc(s,i.parent,i.offset)}else this._inlineFiller=null;this._updateFocus(),this._updateSelection(),this.domConverter._clearTemporaryCustomProperties(),this.markedTexts.clear(),this.markedAttributes.clear(),this.markedChildren.clear()}_updateChildrenMappings(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const i=Array.from(t.childNodes),s=Array.from(this.domConverter.viewChildrenToDom(e,{withChildren:!1})),o=this._diffNodeLists(i,s),r=this._findUpdateActions(o,i,s,gk);if(r.indexOf("update")!==-1){const a={equal:0,insert:0,delete:0};for(const l of r)if(l==="update"){const c=a.equal+a.insert,u=a.equal+a.delete,d=e.getChild(c);d&&!d.is("uiElement")&&!d.is("rawElement")&&this._updateElementMappings(d,i[u]),rc(s[c]),a.equal++}else a[l]++}}_updateElementMappings(e,t){this.domConverter.unbindDomElement(t),this.domConverter.bindElements(t,e),this.markedChildren.add(e),this.markedAttributes.add(e)}_getInlineFillerPosition(){const e=this.selection.getFirstPosition();return e.parent.is("$text")?k._createBefore(e.parent):e}_isSelectionInInlineFiller(){if(this.selection.rangeCount!=1||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=this.domConverter.viewPositionToDom(e);return!!(t&&ue(t.parent)&&Be(t.parent))}_removeInlineFiller(){const e=this._inlineFiller;if(!Be(e))throw new g("view-renderer-filler-was-lost",this);dn(e)?e.remove():e.data=e.data.substr(Ge),this._inlineFiller=null}_needsInlineFillerAtSelection(){if(this.selection.rangeCount!=1||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=e.parent,i=e.offset;if(!this.domConverter.mapViewToDom(t.root)||!t.is("element")||!mk(t)||i===t.getFillerOffset())return!1;const s=e.nodeBefore,o=e.nodeAfter;return!(s instanceof te||o instanceof te||L.isAndroid&&(s||o))}_updateText(e,t){const i=this.domConverter.findCorrespondingDomText(e);let o=this.domConverter.viewToDom(e).data;const r=t.inlineFillerPosition;r&&r.parent==e.parent&&r.offset==e.index&&(o=Pn+o),Bc(i,o)}_updateAttrs(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const i=Array.from(t.attributes).map(o=>o.name),s=e.getAttributeKeys();for(const o of s)this.domConverter.setDomElementAttribute(t,o,e.getAttribute(o),e);for(const o of i)e.hasAttribute(o)||this.domConverter.removeDomElementAttribute(t,o)}_updateChildren(e,t){const i=this.domConverter.mapViewToDom(e);if(!i)return;if(L.isAndroid){let d=null;for(const h of Array.from(i.childNodes)){if(d&&ue(d)&&ue(h)){i.normalize();break}d=h}}const s=t.inlineFillerPosition,o=i.childNodes,r=Array.from(this.domConverter.viewChildrenToDom(e,{bind:!0}));s&&s.parent===e&&Lc(i.ownerDocument,r,s.offset);const a=this._diffNodeLists(o,r),l=this._findUpdateActions(a,o,r,pk);let c=0;const u=new Set;for(const d of l)d==="delete"?(u.add(o[c]),rc(o[c])):(d==="equal"||d==="update")&&c++;c=0;for(const d of l)d==="insert"?(Rf(i,c,r[c]),c++):d==="update"?(Bc(o[c],r[c].data),c++):d==="equal"&&(this._markDescendantTextToSync(this.domConverter.domToView(r[c])),c++);for(const d of u)d.parentNode||this.domConverter.unbindDomElement(d)}_diffNodeLists(e,t){return e=_k(e,this._fakeSelectionContainer),mn(e,t,wk.bind(null,this.domConverter))}_findUpdateActions(e,t,i,s){if(e.indexOf("insert")===-1||e.indexOf("delete")===-1)return e;let o=[],r=[],a=[];const l={equal:0,insert:0,delete:0};for(const c of e)c==="insert"?a.push(i[l.equal+l.insert]):c==="delete"?r.push(t[l.equal+l.delete]):(o=o.concat(mn(r,a,s).map(u=>u==="equal"?"update":u)),o.push("equal"),r=[],a=[]),l[c]++;return o.concat(mn(r,a,s).map(c=>c==="equal"?"update":c))}_markDescendantTextToSync(e){if(e){if(e.is("$text"))this.markedTexts.add(e);else if(e.is("element"))for(const t of e.getChildren())this._markDescendantTextToSync(t)}}_updateSelection(){if(L.isBlink&&!L.isAndroid&&this.isSelecting&&!this.markedChildren.size)return;if(this.selection.rangeCount===0){this._removeDomSelection(),this._removeFakeSelection();return}const e=this.domConverter.mapViewToDom(this.selection.editableElement);!this.isFocused||!e||(this.selection.isFake?this._updateFakeSelection(e):this._fakeSelectionContainer&&this._fakeSelectionContainer.isConnected?(this._removeFakeSelection(),this._updateDomSelection(e)):this.isComposing&&L.isAndroid||this._updateDomSelection(e))}_updateFakeSelection(e){const t=e.ownerDocument;this._fakeSelectionContainer||(this._fakeSelectionContainer=vk(t));const i=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(i,this.selection),!this._fakeSelectionNeedsUpdate(e))return;(!i.parentElement||i.parentElement!=e)&&e.appendChild(i),i.textContent=this.selection.fakeSelectionLabel||" ";const s=t.getSelection(),o=t.createRange();s.removeAllRanges(),o.selectNodeContents(i),s.addRange(o)}_updateDomSelection(e){const t=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(t))return;const i=this.domConverter.viewPositionToDom(this.selection.anchor),s=this.domConverter.viewPositionToDom(this.selection.focus);t.setBaseAndExtent(i.parent,i.offset,s.parent,s.offset),L.isGecko&&bk(s,t)}_domSelectionNeedsUpdate(e){if(!this.domConverter.isDomSelectionCorrect(e))return!0;const t=e&&this.domConverter.domSelectionToView(e);return!(t&&this.selection.isEqual(t)||!this.selection.isCollapsed&&this.selection.isSimilar(t))}_fakeSelectionNeedsUpdate(e){const t=this._fakeSelectionContainer,i=e.ownerDocument.getSelection();return!t||t.parentElement!==e||i.anchorNode!==t&&!t.contains(i.anchorNode)?!0:t.textContent!==this.selection.fakeSelectionLabel}_removeDomSelection(){for(const e of this.domDocuments){const t=e.getSelection();if(t.rangeCount){const i=e.activeElement,s=this.domConverter.mapDomToView(i);i&&s&&t.removeAllRanges()}}}_removeFakeSelection(){const e=this._fakeSelectionContainer;e&&e.remove()}_updateFocus(){if(this.isFocused){const e=this.selection.editableElement;e&&this.domConverter.focus(e)}}}function mk(n){if(n.getAttribute("contenteditable")=="false")return!1;const e=n.findAncestor(t=>t.hasAttribute("contenteditable"));return!e||e.getAttribute("contenteditable")=="true"}function Lc(n,e,t){const i=e instanceof Array?e:e.childNodes,s=i[t];if(ue(s))return s.data=Pn+s.data,s;{const o=n.createTextNode(Pn);return Array.isArray(e)?i.splice(t,0,o):Rf(e,t,o),o}}function gk(n,e){return Pt(n)&&Pt(e)&&!ue(n)&&!ue(e)&&!pn(n)&&!pn(e)&&n.tagName.toLowerCase()===e.tagName.toLowerCase()}function pk(n,e){return Pt(n)&&Pt(e)&&ue(n)&&ue(e)}function wk(n,e,t){return e===t?!0:ue(e)&&ue(t)?e.data===t.data:!!(n.isBlockFiller(e)&&n.isBlockFiller(t))}function bk(n,e){const t=n.parent;if(t.nodeType!=Node.ELEMENT_NODE||n.offset!=t.childNodes.length-1)return;const i=t.childNodes[n.offset];i&&i.tagName=="BR"&&e.addRange(e.getRangeAt(0))}function _k(n,e){const t=Array.from(n);return t.length==0||!e||t[t.length-1]==e&&t.pop(),t}function vk(n){const e=n.createElement("div");return e.className="ck-fake-selection-container",Object.assign(e.style,{position:"fixed",top:0,left:"-9999px",width:"42px"}),e.textContent=" ",e}function Bc(n,e){const t=n.data;if(t==e)return;const i=wh(t,e);for(const s of i)s.type==="insert"?n.insertData(s.index,s.values.join("")):n.deleteData(s.index,s.howMany)}/**
|
|
360
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
361
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
362
|
+
*/const yk=bm(E.document),Ck=pm(E.document),kk=wm(E.document),cs="data-ck-unsafe-attribute-",Oc="data-ck-unsafe-element";class _m{constructor(e,{blockFillerMode:t,renderingMode:i="editing"}={}){this._domToViewMapping=new WeakMap,this._viewToDomMapping=new WeakMap,this._fakeSelectionMapping=new WeakMap,this._rawContentElementMatcher=new ni,this._inlineObjectElementMatcher=new ni,this._elementsWithTemporaryCustomProperties=new Set,this.document=e,this.renderingMode=i,this.blockFillerMode=t||(i==="editing"?"br":"nbsp"),this.preElements=["pre"],this.blockElements=["address","article","aside","blockquote","caption","center","dd","details","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","legend","li","main","menu","nav","ol","p","pre","section","summary","table","tbody","td","tfoot","th","thead","tr","ul"],this.inlineObjectElements=["object","iframe","input","button","textarea","select","option","video","embed","audio","img","canvas"],this.unsafeElements=["script","style"],this._domDocument=this.renderingMode==="editing"?E.document:E.document.implementation.createHTMLDocument("")}bindFakeSelection(e,t){this._fakeSelectionMapping.set(e,new wt(t))}fakeSelectionToView(e){return this._fakeSelectionMapping.get(e)}bindElements(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}unbindDomElement(e){const t=this._domToViewMapping.get(e);if(t){this._domToViewMapping.delete(e),this._viewToDomMapping.delete(t);for(const i of Array.from(e.children))this.unbindDomElement(i)}}bindDocumentFragments(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}shouldRenderAttribute(e,t,i){return this.renderingMode==="data"?!0:(e=e.toLowerCase(),e.startsWith("on")||e==="srcdoc"&&t.match(/\bon\S+\s*=|javascript:|<\s*\/*script/i)?!1:i==="img"&&(e==="src"||e==="srcset")||i==="source"&&e==="srcset"?!0:!t.match(/^\s*(javascript:|data:(image\/svg|text\/x?html))/i))}setContentOf(e,t){if(this.renderingMode==="data"){e.innerHTML=t;return}const i=new DOMParser().parseFromString(t,"text/html"),s=i.createDocumentFragment(),o=i.body.childNodes;for(;o.length>0;)s.appendChild(o[0]);const r=i.createTreeWalker(s,NodeFilter.SHOW_ELEMENT),a=[];let l;for(;l=r.nextNode();)a.push(l);for(const c of a){for(const d of c.getAttributeNames())this.setDomElementAttribute(c,d,c.getAttribute(d));const u=c.tagName.toLowerCase();this._shouldRenameElement(u)&&(Fc(u),c.replaceWith(this._createReplacementDomElement(u,c)))}for(;e.firstChild;)e.firstChild.remove();e.append(s)}viewToDom(e,t={}){if(e.is("$text")){const i=this._processDataFromViewText(e);return this._domDocument.createTextNode(i)}else{const i=e;if(this.mapViewToDom(i))if(i.getCustomProperty("editingPipeline:doNotReuseOnce"))this._elementsWithTemporaryCustomProperties.add(i);else return this.mapViewToDom(i);let s;if(i.is("documentFragment"))s=this._domDocument.createDocumentFragment(),t.bind&&this.bindDocumentFragments(s,i);else{if(i.is("uiElement"))return i.name==="$comment"?s=this._domDocument.createComment(i.getCustomProperty("$rawContent")):s=i.render(this._domDocument,this),t.bind&&this.bindElements(s,i),s;this._shouldRenameElement(i.name)?(Fc(i.name),s=this._createReplacementDomElement(i.name)):i.hasAttribute("xmlns")?s=this._domDocument.createElementNS(i.getAttribute("xmlns"),i.name):s=this._domDocument.createElement(i.name),i.is("rawElement")&&i.render(s,this),t.bind&&this.bindElements(s,i);for(const o of i.getAttributeKeys())this.setDomElementAttribute(s,o,i.getAttribute(o),i)}if(t.withChildren!==!1)for(const o of this.viewChildrenToDom(i,t))s.appendChild(o);return s}}setDomElementAttribute(e,t,i,s){const o=this.shouldRenderAttribute(t,i,e.tagName.toLowerCase())||s&&s.shouldRenderUnsafeAttribute(t);if(o||H("domconverter-unsafe-attribute-detected",{domElement:e,key:t,value:i}),!Vf(t)){H("domconverter-invalid-attribute-detected",{domElement:e,key:t,value:i});return}e.hasAttribute(t)&&!o?e.removeAttribute(t):e.hasAttribute(cs+t)&&o&&e.removeAttribute(cs+t),e.setAttribute(o?t:cs+t,i)}removeDomElementAttribute(e,t){t!=Oc&&(e.removeAttribute(t),e.removeAttribute(cs+t))}*viewChildrenToDom(e,t={}){const i=e.getFillerOffset&&e.getFillerOffset();let s=0;for(const o of e.getChildren()){i===s&&(yield this._getBlockFiller());const r=o.is("element")&&!!o.getCustomProperty("dataPipeline:transparentRendering")&&!J(o.getAttributes());r&&this.renderingMode=="data"?yield*this.viewChildrenToDom(o,t):(r&&H("domconverter-transparent-rendering-unsupported-in-editing-pipeline",{viewElement:o}),yield this.viewToDom(o,t)),s++}i===s&&(yield this._getBlockFiller())}viewRangeToDom(e){const t=this.viewPositionToDom(e.start),i=this.viewPositionToDom(e.end),s=this._domDocument.createRange();return s.setStart(t.parent,t.offset),s.setEnd(i.parent,i.offset),s}viewPositionToDom(e){const t=e.parent;if(t.is("$text")){const i=this.findCorrespondingDomText(t);if(!i)return null;let s=e.offset;return Be(i)&&(s+=Ge),{parent:i,offset:s}}else{let i,s,o;if(e.offset===0){if(i=this.mapViewToDom(t),!i)return null;o=i.childNodes[0]}else{const a=e.nodeBefore;if(s=a.is("$text")?this.findCorrespondingDomText(a):this.mapViewToDom(a),!s)return null;i=s.parentNode,o=s.nextSibling}if(ue(o)&&Be(o))return{parent:o,offset:Ge};const r=s?as(s)+1:0;return{parent:i,offset:r}}}domToView(e,t={}){const i=[],s=this._domToView(e,t,i),o=s.next().value;return!o||(s.next(),this._processDomInlineNodes(null,i,t),o.is("$text")&&o.data.length==0)?null:o}*domChildrenToView(e,t={},i=[]){for(let s=0;s<e.childNodes.length;s++){const o=e.childNodes[s],r=this._domToView(o,t,i),a=r.next().value;a!==null&&(this._isBlockViewElement(a)&&this._processDomInlineNodes(e,i,t),yield a,r.next())}this._processDomInlineNodes(e,i,t)}domSelectionToView(e){if(Ak(e))return new wt([]);if(e.rangeCount===1){let s=e.getRangeAt(0).startContainer;ue(s)&&(s=s.parentNode);const o=this.fakeSelectionToView(s);if(o)return o}const t=this.isDomSelectionBackward(e),i=[];for(let s=0;s<e.rangeCount;s++){const o=e.getRangeAt(s),r=this.domRangeToView(o);r&&i.push(r)}return new wt(i,{backward:t})}domRangeToView(e){const t=this.domPositionToView(e.startContainer,e.startOffset),i=this.domPositionToView(e.endContainer,e.endOffset);return t&&i?new F(t,i):null}domPositionToView(e,t=0){if(this.isBlockFiller(e))return this.domPositionToView(e.parentNode,as(e));const i=this.mapDomToView(e);if(i&&(i.is("uiElement")||i.is("rawElement")))return k._createBefore(i);if(ue(e)){if(dn(e))return this.domPositionToView(e.parentNode,as(e));const s=this.findCorrespondingViewText(e);let o=t;return s?(Be(e)&&(o-=Ge,o=o<0?0:o),new k(s,o)):null}else{if(t===0){const s=this.mapDomToView(e);if(s)return new k(s,0)}else{const s=e.childNodes[t-1];if(ue(s)&&dn(s)||s&&this.isBlockFiller(s))return this.domPositionToView(s.parentNode,as(s));const o=ue(s)?this.findCorrespondingViewText(s):this.mapDomToView(s);if(o&&o.parent)return new k(o.parent,o.index+1)}return null}}mapDomToView(e){return this.getHostViewElement(e)||this._domToViewMapping.get(e)}findCorrespondingViewText(e){if(dn(e))return null;const t=this.getHostViewElement(e);if(t)return t;const i=e.previousSibling;if(i){if(!this.isElement(i))return null;const s=this.mapDomToView(i);if(s){const o=s.nextSibling;return o instanceof te?o:null}}else{const s=this.mapDomToView(e.parentNode);if(s){const o=s.getChild(0);return o instanceof te?o:null}}return null}mapViewToDom(e){return this._viewToDomMapping.get(e)}findCorrespondingDomText(e){const t=e.previousSibling;return t&&this.mapViewToDom(t)?this.mapViewToDom(t).nextSibling:!t&&e.parent&&this.mapViewToDom(e.parent)?this.mapViewToDom(e.parent).childNodes[0]:null}focus(e){const t=this.mapViewToDom(e);if(t&&t.ownerDocument.activeElement!==t){const{scrollX:i,scrollY:s}=E.window,o=[];Mc(t,r=>{const{scrollLeft:a,scrollTop:l}=r;o.push([a,l])}),t.focus(),Mc(t,r=>{const[a,l]=o.shift();r.scrollLeft=a,r.scrollTop=l}),E.window.scrollTo(i,s)}}_clearDomSelection(){const e=this.mapViewToDom(this.document.selection.editableElement);if(!e)return;const t=e.ownerDocument.defaultView.getSelection(),i=this.domSelectionToView(t);i&&i.rangeCount>0&&t.removeAllRanges()}isElement(e){return e&&e.nodeType==Node.ELEMENT_NODE}isDocumentFragment(e){return e&&e.nodeType==Node.DOCUMENT_FRAGMENT_NODE}isBlockFiller(e){return this.blockFillerMode=="br"?e.isEqualNode(yk):e.tagName==="BR"&&vm(e,this.blockElements)&&e.parentNode.childNodes.length===1?!0:e.isEqualNode(kk)||Tk(e,this.blockElements)}isDomSelectionBackward(e){if(e.isCollapsed)return!1;const t=this._domDocument.createRange();try{t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset)}catch{return!1}const i=t.collapsed;return t.detach(),i}getHostViewElement(e){const t=b2(e);for(t.pop();t.length;){const i=t.pop(),s=this._domToViewMapping.get(i);if(s&&(s.is("uiElement")||s.is("rawElement")))return s}return null}isDomSelectionCorrect(e){return this._isDomSelectionPositionCorrect(e.anchorNode,e.anchorOffset)&&this._isDomSelectionPositionCorrect(e.focusNode,e.focusOffset)}registerRawContentMatcher(e){this._rawContentElementMatcher.add(e)}registerInlineObjectMatcher(e){this._inlineObjectElementMatcher.add(e)}_clearTemporaryCustomProperties(){for(const e of this._elementsWithTemporaryCustomProperties)e._removeCustomProperty("editingPipeline:doNotReuseOnce");this._elementsWithTemporaryCustomProperties.clear()}_getBlockFiller(){switch(this.blockFillerMode){case"nbsp":return pm(this._domDocument);case"markedNbsp":return wm(this._domDocument);case"br":return bm(this._domDocument)}}_isDomSelectionPositionCorrect(e,t){if(ue(e)&&Be(e)&&t<Ge||this.isElement(e)&&Be(e.childNodes[t]))return!1;const i=this.mapDomToView(e);return!(i&&(i.is("uiElement")||i.is("rawElement")))}*_domToView(e,t,i){if(this.isBlockFiller(e))return null;const s=this.getHostViewElement(e);if(s)return s;if(pn(e)&&t.skipComments)return null;if(ue(e)){if(dn(e))return null;{const o=e.data;if(o==="")return null;const r=new te(this.document,o);return i.push(r),r}}else{let o=this.mapDomToView(e);if(o)return this._isInlineObjectElement(o)&&i.push(o),o;if(this.isDocumentFragment(e))o=new Zt(this.document),t.bind&&this.bindDocumentFragments(e,o);else{o=this._createViewElement(e,t),t.bind&&this.bindElements(e,o);const a=e.attributes;if(a)for(let l=a.length,c=0;c<l;c++)o._setAttribute(a[c].name,a[c].value);if(this._isViewElementWithRawContent(o,t))return o._setCustomProperty("$rawContent",e.innerHTML),this._isBlockViewElement(o)||i.push(o),o;if(pn(e))return o._setCustomProperty("$rawContent",e.data),o}yield o;const r=[];if(t.withChildren!==!1)for(const a of this.domChildrenToView(e,t,r))o._appendChild(a);if(this._isInlineObjectElement(o))i.push(o);else for(const a of r)i.push(a)}}_processDomInlineNodes(e,t,i){if(!t.length||e&&!this.isDocumentFragment(e)&&!this._isBlockDomElement(e))return;let s=!1;for(let o=0;o<t.length;o++){const r=t[o];if(!r.is("$text")){s=!1;continue}let a,l=!1;if(Ek(r,this.preElements))a=Vc(r.data);else{a=r.data.replace(/[ \n\t\r]{1,}/g," "),l=/[^\S\u00A0]/.test(a.charAt(a.length-1));const c=o>0?t[o-1]:null,u=o+1<t.length?t[o+1]:null,d=!c||c.is("element")&&c.name=="br"||s,h=u?!1:!Be(r.data);i.withChildren!==!1&&(d&&(a=a.replace(/^ /,"")),h&&(a=a.replace(/ $/,""))),a=Vc(a),a=a.replace(/ \u00A0/g," ");const f=u&&u.is("element")&&u.name!="br",m=u&&u.is("$text")&&u.data.charAt(0)==" ";(/[ \u00A0]\u00A0$/.test(a)||!u||f||m)&&(a=a.replace(/\u00A0$/," ")),(d||c&&c.is("element")&&c.name!="br")&&(a=a.replace(/^\u00A0/," "))}a.length==0&&r.parent?(r._remove(),t.splice(o,1),o--):(r._data=a,s=l)}t.length=0}_processDataFromViewText(e){let t=e.data;if(e.getAncestors().some(i=>this.preElements.includes(i.name)))return t;if(t.charAt(0)==" "){const i=this._getTouchingInlineViewNode(e,!1);(i&&i.is("$textProxy")&&this._nodeEndsWithSpace(i)||!i)&&(t=" "+t.substr(1))}if(t.charAt(t.length-1)==" "){const i=this._getTouchingInlineViewNode(e,!0),s=i&&i.is("$textProxy")&&i.data.charAt(0)==" ";(t.charAt(t.length-2)==" "||!i||s)&&(t=t.substr(0,t.length-1)+" ")}return t.replace(/ {2}/g," ")}_nodeEndsWithSpace(e){if(e.getAncestors().some(i=>this.preElements.includes(i.name)))return!1;const t=this._processDataFromViewText(e);return t.charAt(t.length-1)==" "}_getTouchingInlineViewNode(e,t){const i=new jt({startPosition:t?k._createAfter(e):k._createBefore(e),direction:t?"forward":"backward"});for(const s of i){if(s.item.is("element","br"))return null;if(this._isInlineObjectElement(s.item))return s.item;if(s.item.is("containerElement"))return null;if(s.item.is("$textProxy"))return s.item}return null}_isBlockDomElement(e){return this.isElement(e)&&this.blockElements.includes(e.tagName.toLowerCase())}_isBlockViewElement(e){return e.is("element")&&this.blockElements.includes(e.name)}_isInlineObjectElement(e){return e.is("element")?e.name=="br"||this.inlineObjectElements.includes(e.name)||!!this._inlineObjectElementMatcher.match(e):!1}_createViewElement(e,t){if(pn(e))return new mo(this.document,"$comment");const i=t.keepOriginalCase?e.tagName:e.tagName.toLowerCase();return new Je(this.document,i)}_isViewElementWithRawContent(e,t){return t.withChildren!==!1&&e.is("element")&&!!this._rawContentElementMatcher.match(e)}_shouldRenameElement(e){const t=e.toLowerCase();return this.renderingMode==="editing"&&this.unsafeElements.includes(t)}_createReplacementDomElement(e,t){const i=this._domDocument.createElement("span");if(i.setAttribute(Oc,e),t){for(;t.firstChild;)i.appendChild(t.firstChild);for(const s of t.getAttributeNames())i.setAttribute(s,t.getAttribute(s))}return i}}function Ek(n,e){return n.getAncestors().some(t=>t.is("element")&&e.includes(t.name))}function Mc(n,e){let t=n;for(;t;)e(t),t=t.parentElement}function Tk(n,e){return n.isEqualNode(Ck)&&vm(n,e)&&n.parentNode.childNodes.length===1}function vm(n,e){const t=n.parentNode;return!!t&&!!t.tagName&&e.includes(t.tagName.toLowerCase())}function Fc(n){n==="script"&&H("domconverter-unsafe-script-element-detected"),n==="style"&&H("domconverter-unsafe-style-element-detected")}function Ak(n){if(!L.isGecko||!n.rangeCount)return!1;const e=n.getRangeAt(0).startContainer;try{Object.prototype.toString.call(e)}catch{return!0}return!1}/**
|
|
363
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
364
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
365
|
+
*/class lt extends $e(){constructor(e){super(),this._isEnabled=!1,this.view=e,this.document=e.document}get isEnabled(){return this._isEnabled}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}destroy(){this.disable(),this.stopListening()}checkShouldIgnoreEventFromTarget(e){return e&&e.nodeType===3&&(e=e.parentNode),!e||e.nodeType!==1?!1:e.matches("[data-cke-ignore-events], [data-cke-ignore-events] *")}}/**
|
|
366
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
367
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
368
|
+
*/class Hi{constructor(e,t,i){this.view=e,this.document=e.document,this.domEvent=t,this.domTarget=t.target,Oh(this,i)}get target(){return this.view.domConverter.mapDomToView(this.domTarget)}preventDefault(){this.domEvent.preventDefault()}stopPropagation(){this.domEvent.stopPropagation()}}/**
|
|
369
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
370
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
371
|
+
*/class Lt extends lt{constructor(){super(...arguments),this.useCapture=!1}observe(e){(typeof this.domEventType=="string"?[this.domEventType]:this.domEventType).forEach(i=>{this.listenTo(e,i,(s,o)=>{this.isEnabled&&!this.checkShouldIgnoreEventFromTarget(o.target)&&this.onDomEvent(o)},{useCapture:this.useCapture})})}stopObserving(e){this.stopListening(e)}fire(e,t,i){this.isEnabled&&this.document.fire(e,new Hi(this.view,t,i))}}/**
|
|
372
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
373
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
374
|
+
*/class Sk extends Lt{constructor(){super(...arguments),this.domEventType=["keydown","keyup"]}onDomEvent(e){const t={keyCode:e.keyCode,altKey:e.altKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,metaKey:e.metaKey,get keystroke(){return Ni(this)}};this.fire(e.type,e,t)}}/**
|
|
375
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
376
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
377
|
+
*/class xk extends lt{constructor(e){super(e),this._fireSelectionChangeDoneDebounced=Di(t=>{this.document.fire("selectionChangeDone",t)},200)}observe(){const e=this.document;e.on("arrowKey",(t,i)=>{e.selection.isFake&&this.isEnabled&&i.preventDefault()},{context:"$capture"}),e.on("arrowKey",(t,i)=>{e.selection.isFake&&this.isEnabled&&this._handleSelectionMove(i.keyCode)},{priority:"lowest"})}stopObserving(){}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(e){const t=this.document.selection,i=new wt(t.getRanges(),{backward:t.isBackward,fake:!1});(e==N.arrowleft||e==N.arrowup)&&i.setTo(i.getFirstPosition()),(e==N.arrowright||e==N.arrowdown)&&i.setTo(i.getLastPosition());const s={oldSelection:t,newSelection:i,domSelection:null};this.document.fire("selectionChange",s),this._fireSelectionChangeDoneDebounced(s)}}/**
|
|
378
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
379
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
380
|
+
*/class ym extends lt{constructor(e){super(e),this._config={childList:!0,characterData:!0,subtree:!0},this.domConverter=e.domConverter,this.renderer=e._renderer,this._domElements=new Set,this._mutationObserver=new window.MutationObserver(this._onMutations.bind(this))}flush(){this._onMutations(this._mutationObserver.takeRecords())}observe(e){this._domElements.add(e),this.isEnabled&&this._mutationObserver.observe(e,this._config)}stopObserving(e){if(this._domElements.delete(e),this.isEnabled){this._mutationObserver.disconnect();for(const t of this._domElements)this._mutationObserver.observe(t,this._config)}}enable(){super.enable();for(const e of this._domElements)this._mutationObserver.observe(e,this._config)}disable(){super.disable(),this._mutationObserver.disconnect()}destroy(){super.destroy(),this._mutationObserver.disconnect()}_onMutations(e){if(e.length===0)return;const t=this.domConverter,i=new Set,s=new Set;for(const r of e){const a=t.mapDomToView(r.target);a&&(a.is("uiElement")||a.is("rawElement")||r.type==="childList"&&!this._isBogusBrMutation(r)&&s.add(a))}for(const r of e){const a=t.mapDomToView(r.target);if(!(a&&(a.is("uiElement")||a.is("rawElement")))&&r.type==="characterData"){const l=t.findCorrespondingViewText(r.target);l&&!s.has(l.parent)?i.add(l):!l&&Be(r.target)&&s.add(t.mapDomToView(r.target.parentNode))}}let o=!1;for(const r of i)o=!0,this.renderer.markToSync("text",r);for(const r of s){const a=t.mapViewToDom(r),l=Array.from(r.getChildren()),c=Array.from(t.domChildrenToView(a,{withChildren:!1}));Jy(l,c,Ik)||(o=!0,this.renderer.markToSync("children",r))}o&&this.view.forceRender()}_isBogusBrMutation(e){let t=null;return e.nextSibling===null&&e.removedNodes.length===0&&e.addedNodes.length==1&&(t=this.domConverter.domToView(e.addedNodes[0],{withChildren:!1})),t&&t.is("element","br")}}function Ik(n,e){if(!Array.isArray(n))return n===e?!0:n.is("$text")&&e.is("$text")?n.data===e.data:!1}/**
|
|
381
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
382
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
383
|
+
*/class Us extends Lt{constructor(e){super(e),this._isFocusChanging=!1,this.domEventType=["focus","blur"],this.useCapture=!0;const t=this.document;t.on("focus",()=>{this._isFocusChanging=!0,this._renderTimeoutId=setTimeout(()=>{this.flush(),e.change(()=>{})},50)}),t.on("blur",(i,s)=>{const o=t.selection.editableElement;(o===null||o===s.target)&&(t.isFocused=!1,this._isFocusChanging=!1,e.change(()=>{}))})}flush(){this._isFocusChanging&&(this._isFocusChanging=!1,this.document.isFocused=!0)}onDomEvent(e){this.fire(e.type,e)}destroy(){this._renderTimeoutId&&clearTimeout(this._renderTimeoutId),super.destroy()}}/**
|
|
384
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
385
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
386
|
+
*/class Pk extends lt{constructor(e){super(e),this.mutationObserver=e.getObserver(ym),this.focusObserver=e.getObserver(Us),this.selection=this.document.selection,this.domConverter=e.domConverter,this._documents=new WeakSet,this._fireSelectionChangeDoneDebounced=Di(t=>{this.document.fire("selectionChangeDone",t)},200),this._clearInfiniteLoopInterval=setInterval(()=>this._clearInfiniteLoop(),1e3),this._documentIsSelectingInactivityTimeoutDebounced=Di(()=>this.document.isSelecting=!1,5e3),this._loopbackCounter=0}observe(e){const t=e.ownerDocument,i=()=>{this.document.isSelecting=!0,this._documentIsSelectingInactivityTimeoutDebounced()},s=()=>{this.document.isSelecting&&(this._handleSelectionChange(null,t),this.document.isSelecting=!1,this._documentIsSelectingInactivityTimeoutDebounced.cancel())};this.listenTo(e,"selectstart",i,{priority:"highest"}),this.listenTo(e,"keydown",s,{priority:"highest",useCapture:!0}),this.listenTo(e,"keyup",s,{priority:"highest",useCapture:!0}),!this._documents.has(t)&&(this.listenTo(t,"mouseup",s,{priority:"highest",useCapture:!0}),this.listenTo(t,"selectionchange",(o,r)=>{this.document.isComposing&&!L.isAndroid||(this._handleSelectionChange(r,t),this._documentIsSelectingInactivityTimeoutDebounced())}),this._documents.add(t))}stopObserving(e){this.stopListening(e)}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel(),this._documentIsSelectingInactivityTimeoutDebounced.cancel()}_reportInfiniteLoop(){}_handleSelectionChange(e,t){if(!this.isEnabled)return;const i=t.defaultView.getSelection();if(this.checkShouldIgnoreEventFromTarget(i.anchorNode))return;this.mutationObserver.flush();const s=this.domConverter.domSelectionToView(i);if(s.rangeCount==0){this.view.hasDomSelection=!1;return}if(this.view.hasDomSelection=!0,this.focusObserver.flush(),!(this.selection.isEqual(s)&&this.domConverter.isDomSelectionCorrect(i))){if(++this._loopbackCounter>60){this._reportInfiniteLoop();return}if(this.selection.isSimilar(s))this.view.forceRender();else{const o={oldSelection:this.selection,newSelection:s,domSelection:i};this.document.fire("selectionChange",o),this._fireSelectionChangeDoneDebounced(o)}}}_clearInfiniteLoop(){this._loopbackCounter=0}}/**
|
|
387
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
388
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
389
|
+
*/class Rk extends Lt{constructor(e){super(e),this.domEventType=["compositionstart","compositionupdate","compositionend"];const t=this.document;t.on("compositionstart",()=>{t.isComposing=!0},{priority:"low"}),t.on("compositionend",()=>{t.isComposing=!1},{priority:"low"})}onDomEvent(e){this.fire(e.type,e,{data:e.data})}}/**
|
|
390
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
391
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
392
|
+
*/class Cm{constructor(e,t={}){this._files=t.cacheFiles?Dc(e):null,this._native=e}get files(){return this._files||(this._files=Dc(this._native)),this._files}get types(){return this._native.types}getData(e){return this._native.getData(e)}setData(e,t){this._native.setData(e,t)}set effectAllowed(e){this._native.effectAllowed=e}get effectAllowed(){return this._native.effectAllowed}set dropEffect(e){this._native.dropEffect=e}get dropEffect(){return this._native.dropEffect}setDragImage(e,t,i){this._native.setDragImage(e,t,i)}get isCanceled(){return this._native.dropEffect=="none"||!!this._native.mozUserCancelled}}function Dc(n){const e=Array.from(n.files||[]),t=Array.from(n.items||[]);return e.length?e:t.filter(i=>i.kind==="file").map(i=>i.getAsFile())}/**
|
|
393
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
394
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
395
|
+
*/class Vk extends Lt{constructor(){super(...arguments),this.domEventType="beforeinput"}onDomEvent(e){const t=e.getTargetRanges(),i=this.view,s=i.document;let o=null,r=null,a=[];if(e.dataTransfer&&(o=new Cm(e.dataTransfer)),e.data!==null?r=e.data:o&&(r=o.getData("text/plain")),s.selection.isFake)a=Array.from(s.selection.getRanges());else if(t.length)a=t.map(l=>{const c=i.domConverter.domPositionToView(l.startContainer,l.startOffset),u=i.domConverter.domPositionToView(l.endContainer,l.endOffset);if(c)return i.createRange(c,u);if(u)return i.createRange(u)}).filter(l=>!!l);else if(L.isAndroid){const l=e.target.ownerDocument.defaultView.getSelection();a=Array.from(i.domConverter.domSelectionToView(l).getRanges())}if(L.isAndroid&&e.inputType=="insertCompositionText"&&r&&r.endsWith(`
|
|
396
|
+
`)){this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:[i.createRange(a[0].end)]});return}if(e.inputType=="insertText"&&r&&r.includes(`
|
|
397
|
+
`)){const l=r.split(/\n{1,2}/g);let c=a;for(let u=0;u<l.length;u++){const d=l[u];d!=""&&(this.fire(e.type,e,{data:d,dataTransfer:o,targetRanges:c,inputType:e.inputType,isComposing:e.isComposing}),c=[s.selection.getFirstRange()]),u+1<l.length&&(this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:c}),c=[s.selection.getFirstRange()])}return}this.fire(e.type,e,{data:r,dataTransfer:o,targetRanges:a,inputType:e.inputType,isComposing:e.isComposing})}}/**
|
|
398
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
399
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
400
|
+
*/class Lk extends lt{constructor(e){super(e),this.document.on("keydown",(t,i)=>{if(this.isEnabled&&R2(i.keyCode)){const s=new Ji(this.document,"arrowKey",this.document.selection.getFirstRange());this.document.fire(s,i),s.stop.called&&t.stop()}})}observe(){}stopObserving(){}}/**
|
|
401
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
402
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
403
|
+
*/class Bk extends lt{constructor(e){super(e);const t=this.document;t.on("keydown",(i,s)=>{if(!this.isEnabled||s.keyCode!=N.tab||s.ctrlKey)return;const o=new Ji(t,"tab",t.selection.getFirstRange());t.fire(o,s),o.stop.called&&i.stop()})}observe(){}stopObserving(){}}/**
|
|
404
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
405
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
406
|
+
*/class Ok extends U(){constructor(e){super(),this.domRoots=new Map,this._initialDomRootAttributes=new WeakMap,this._observers=new Map,this._ongoingChange=!1,this._postFixersInProgress=!1,this._renderingDisabled=!1,this._hasChangedSinceTheLastRendering=!1,this.document=new hm(e),this.domConverter=new _m(this.document),this.set("isRenderingInProgress",!1),this.set("hasDomSelection",!1),this._renderer=new fk(this.domConverter,this.document.selection),this._renderer.bind("isFocused","isSelecting","isComposing").to(this.document,"isFocused","isSelecting","isComposing"),this._writer=new mm(this.document),this.addObserver(ym),this.addObserver(Us),this.addObserver(Pk),this.addObserver(Sk),this.addObserver(xk),this.addObserver(Rk),this.addObserver(Lk),this.addObserver(Vk),this.addObserver(Bk),dk(this),nk(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}),L.isiOS&&this.listenTo(this.document,"blur",(t,i)=>{this.domConverter.mapDomToView(i.domEvent.relatedTarget)||this.domConverter._clearDomSelection()})}attachDomRoot(e,t="main"){const i=this.document.getRoot(t);i._name=e.tagName.toLowerCase();const s={};for(const{name:r,value:a}of Array.from(e.attributes))s[r]=a,r==="class"?this._writer.addClass(a.split(" "),i):this._writer.setAttribute(r,a,i);this._initialDomRootAttributes.set(e,s);const o=()=>{this._writer.setAttribute("contenteditable",(!i.isReadOnly).toString(),i),i.isReadOnly?this._writer.addClass("ck-read-only",i):this._writer.removeClass("ck-read-only",i)};o(),this.domRoots.set(t,e),this.domConverter.bindElements(e,i),this._renderer.markToSync("children",i),this._renderer.markToSync("attributes",i),this._renderer.domDocuments.add(e.ownerDocument),i.on("change:children",(r,a)=>this._renderer.markToSync("children",a)),i.on("change:attributes",(r,a)=>this._renderer.markToSync("attributes",a)),i.on("change:text",(r,a)=>this._renderer.markToSync("text",a)),i.on("change:isReadOnly",()=>this.change(o)),i.on("change",()=>{this._hasChangedSinceTheLastRendering=!0});for(const r of this._observers.values())r.observe(e,t)}detachDomRoot(e){const t=this.domRoots.get(e);Array.from(t.attributes).forEach(({name:s})=>t.removeAttribute(s));const i=this._initialDomRootAttributes.get(t);for(const s in i)t.setAttribute(s,i[s]);this.domRoots.delete(e),this.domConverter.unbindDomElement(t);for(const s of this._observers.values())s.stopObserving(t)}getDomRoot(e="main"){return this.domRoots.get(e)}addObserver(e){let t=this._observers.get(e);if(t)return t;t=new e(this),this._observers.set(e,t);for(const[i,s]of this.domRoots)t.observe(s,i);return t.enable(),t}getObserver(e){return this._observers.get(e)}disableObservers(){for(const e of this._observers.values())e.disable()}enableObservers(){for(const e of this._observers.values())e.enable()}scrollToTheSelection({alignToTop:e,forceScroll:t,viewportOffset:i=20,ancestorOffset:s=20}={}){const o=this.document.selection.getFirstRange();if(!o)return;const r=Tt({alignToTop:e,forceScroll:t,viewportOffset:i,ancestorOffset:s});typeof i=="number"&&(i={top:i,bottom:i,left:i,right:i});const a={target:this.domConverter.viewRangeToDom(o),viewportOffset:i,ancestorOffset:s,alignToTop:e,forceScroll:t};this.fire("scrollToTheSelection",a,r),E2(a)}focus(){if(!this.document.isFocused){const e=this.document.selection.editableElement;e&&(this.domConverter.focus(e),this.forceRender())}}change(e){if(this.isRenderingInProgress||this._postFixersInProgress)throw new g("cannot-change-view-tree",this);try{if(this._ongoingChange)return e(this._writer);this._ongoingChange=!0;const t=e(this._writer);return this._ongoingChange=!1,!this._renderingDisabled&&this._hasChangedSinceTheLastRendering&&(this._postFixersInProgress=!0,this.document._callPostFixers(this._writer),this._postFixersInProgress=!1,this.fire("render")),t}catch(t){/* istanbul ignore next -- @preserve */g.rethrowUnexpectedError(t,this)}}forceRender(){this._hasChangedSinceTheLastRendering=!0,this.getObserver(Us).flush(),this.change(()=>{})}destroy(){for(const e of this._observers.values())e.destroy();this.document.destroy(),this.stopListening()}createPositionAt(e,t){return k._createAt(e,t)}createPositionAfter(e){return k._createAfter(e)}createPositionBefore(e){return k._createBefore(e)}createRange(e,t){return new F(e,t)}createRangeOn(e){return F._createOn(e)}createRangeIn(e){return F._createIn(e)}createSelection(...e){return new wt(...e)}_disableRendering(e){this._renderingDisabled=e,e==!1&&this.change(()=>{})}_render(){this.isRenderingInProgress=!0,this.disableObservers(),this._renderer.render(),this.enableObservers(),this.isRenderingInProgress=!1}}/**
|
|
407
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
408
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
409
|
+
*/class Bt{is(){throw new Error("is() method is abstract")}}/**
|
|
410
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
411
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
412
|
+
*/let ui=class extends Bt{constructor(e){super(),this.parent=null,this._attrs=vt(e)}get document(){return null}get index(){let e;if(!this.parent)return null;if((e=this.parent.getChildIndex(this))===null)throw new g("model-node-not-found-in-parent",this);return e}get startOffset(){let e;if(!this.parent)return null;if((e=this.parent.getChildStartOffset(this))===null)throw new g("model-node-not-found-in-parent",this);return e}get offsetSize(){return 1}get endOffset(){return this.parent?this.startOffset+this.offsetSize:null}get nextSibling(){const e=this.index;return e!==null&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return e!==null&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.parent===null?!1:this.root.isAttached()}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.startOffset),t=t.parent;return e}getAncestors(e={}){const t=[];let i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}getCommonAncestor(e,t={}){const i=this.getAncestors(t),s=e.getAncestors(t);let o=0;for(;i[o]==s[o]&&i[o];)o++;return o===0?null:i[o-1]}isBefore(e){if(this==e||this.root!==e.root)return!1;const t=this.getPath(),i=e.getPath(),s=ye(t,i);switch(s){case"prefix":return!0;case"extension":return!1;default:return t[s]<i[s]}}isAfter(e){return this==e||this.root!==e.root?!1:!this.isBefore(e)}hasAttribute(e){return this._attrs.has(e)}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}toJSON(){const e={};return this._attrs.size&&(e.attributes=Array.from(this._attrs).reduce((t,i)=>(t[i[0]]=i[1],t),{})),e}_clone(e){return new this.constructor(this._attrs)}_remove(){this.parent._removeChildren(this.index)}_setAttribute(e,t){this._attrs.set(e,t)}_setAttributesTo(e){this._attrs=vt(e)}_removeAttribute(e){return this._attrs.delete(e)}_clearAttributes(){this._attrs.clear()}};ui.prototype.is=function(n){return n==="node"||n==="model:node"};/**
|
|
413
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
414
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
415
|
+
*/class wn{constructor(e){this._nodes=[],e&&this._insertNodes(0,e)}[Symbol.iterator](){return this._nodes[Symbol.iterator]()}get length(){return this._nodes.length}get maxOffset(){return this._nodes.reduce((e,t)=>e+t.offsetSize,0)}getNode(e){return this._nodes[e]||null}getNodeIndex(e){const t=this._nodes.indexOf(e);return t==-1?null:t}getNodeStartOffset(e){const t=this.getNodeIndex(e);return t===null?null:this._nodes.slice(0,t).reduce((i,s)=>i+s.offsetSize,0)}indexToOffset(e){if(e==this._nodes.length)return this.maxOffset;const t=this._nodes[e];if(!t)throw new g("model-nodelist-index-out-of-bounds",this);return this.getNodeStartOffset(t)}offsetToIndex(e){let t=0;for(const i of this._nodes){if(e>=t&&e<t+i.offsetSize)return this.getNodeIndex(i);t+=i.offsetSize}if(t!=e)throw new g("model-nodelist-offset-out-of-bounds",this,{offset:e,nodeList:this});return this.length}_insertNodes(e,t){for(const i of t)if(!(i instanceof ui))throw new g("model-nodelist-insertnodes-not-node",this);this._nodes=W2(this._nodes,Array.from(t),e,0)}_removeNodes(e,t=1){return this._nodes.splice(e,t)}toJSON(){return this._nodes.map(e=>e.toJSON())}}/**
|
|
416
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
417
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
418
|
+
*/class j extends ui{constructor(e,t){super(t),this._data=e||""}get offsetSize(){return this.data.length}get data(){return this._data}toJSON(){const e=super.toJSON();return e.data=this.data,e}_clone(){return new j(this.data,this.getAttributes())}static fromJSON(e){return new j(e.data,e.attributes)}}j.prototype.is=function(n){return n==="$text"||n==="model:$text"||n==="text"||n==="model:text"||n==="node"||n==="model:node"};/**
|
|
419
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
420
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
421
|
+
*/class Ke extends Bt{constructor(e,t,i){if(super(),this.textNode=e,t<0||t>e.offsetSize)throw new g("model-textproxy-wrong-offsetintext",this);if(i<0||t+i>e.offsetSize)throw new g("model-textproxy-wrong-length",this);this.data=e.data.substring(t,t+i),this.offsetInText=t}get startOffset(){return this.textNode.startOffset!==null?this.textNode.startOffset+this.offsetInText:null}get offsetSize(){return this.data.length}get endOffset(){return this.startOffset!==null?this.startOffset+this.offsetSize:null}get isPartial(){return this.offsetSize!==this.textNode.offsetSize}get parent(){return this.textNode.parent}get root(){return this.textNode.root}getPath(){const e=this.textNode.getPath();return e.length>0&&(e[e.length-1]+=this.offsetInText),e}getAncestors(e={}){const t=[];let i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}hasAttribute(e){return this.textNode.hasAttribute(e)}getAttribute(e){return this.textNode.getAttribute(e)}getAttributes(){return this.textNode.getAttributes()}getAttributeKeys(){return this.textNode.getAttributeKeys()}}Ke.prototype.is=function(n){return n==="$textProxy"||n==="model:$textProxy"||n==="textProxy"||n==="model:textProxy"};/**
|
|
422
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
423
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
424
|
+
*/class W extends ui{constructor(e,t,i){super(t),this._children=new wn,this.name=e,i&&this._insertChild(0,i)}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return this.childCount===0}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}offsetToIndex(e){return this._children.offsetToIndex(e)}getNodeByPath(e){let t=this;for(const i of e)t=t.getChild(t.offsetToIndex(i));return t}findAncestor(e,t={}){let i=t.includeSelf?this:this.parent;for(;i;){if(i.name===e)return i;i=i.parent}return null}toJSON(){const e=super.toJSON();if(e.name=this.name,this._children.length>0){e.children=[];for(const t of this._children)e.children.push(t.toJSON())}return e}_clone(e=!1){const t=e?Array.from(this._children).map(i=>i._clone(!0)):void 0;return new W(this.name,this.getAttributes(),t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const i=Mk(t);for(const s of i)s.parent!==null&&s._remove(),s.parent=this;this._children._insertNodes(e,i)}_removeChildren(e,t=1){const i=this._children._removeNodes(e,t);for(const s of i)s.parent=null;return i}static fromJSON(e){let t;if(e.children){t=[];for(const i of e.children)i.name?t.push(W.fromJSON(i)):t.push(j.fromJSON(i))}return new W(e.name,e.attributes,t)}}W.prototype.is=function(n,e){return e?e===this.name&&(n==="element"||n==="model:element"):n==="element"||n==="model:element"||n==="node"||n==="model:node"};function Mk(n){return typeof n=="string"?[new j(n)]:(De(n)||(n=[n]),Array.from(n).map(e=>typeof e=="string"?new j(e):e instanceof Ke?new j(e.data,e.getAttributes()):e))}/**
|
|
425
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
426
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
427
|
+
*/class pt{constructor(e){if(!e||!e.boundaries&&!e.startPosition)throw new g("model-tree-walker-no-start-position",null);const t=e.direction||"forward";if(t!="forward"&&t!="backward")throw new g("model-tree-walker-unknown-direction",e,{direction:t});this.direction=t,this.boundaries=e.boundaries||null,e.startPosition?this._position=e.startPosition.clone():this._position=y._createAt(this.boundaries[this.direction=="backward"?"end":"start"]),this.position.stickiness="toNone",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null,this._visitedParent=this.position.parent}[Symbol.iterator](){return this}get position(){return this._position}skip(e){let t,i,s,o;do s=this.position,o=this._visitedParent,{done:t,value:i}=this.next();while(!t&&e(i));t||(this._position=s,this._visitedParent=o)}next(){return this.direction=="forward"?this._next():this._previous()}_next(){const e=this.position,t=this.position.clone(),i=this._visitedParent;if(i.parent===null&&t.offset===i.maxOffset)return{done:!0,value:void 0};if(i===this._boundaryEndParent&&t.offset==this.boundaries.end.offset)return{done:!0,value:void 0};const s=bn(t,i),o=s||km(t,i,s);if(o instanceof W){if(!this.shallow)t.path.push(0),this._visitedParent=o;else{if(this.boundaries&&this.boundaries.end.isBefore(t))return{done:!0,value:void 0};t.offset++}return this._position=t,Ft("elementStart",o,e,t,1)}if(o instanceof j){let r;if(this.singleCharacters)r=1;else{let c=o.endOffset;this._boundaryEndParent==i&&this.boundaries.end.offset<c&&(c=this.boundaries.end.offset),r=c-t.offset}const a=t.offset-o.startOffset,l=new Ke(o,a,r);return t.offset+=r,this._position=t,Ft("text",l,e,t,r)}return t.path.pop(),t.offset++,this._position=t,this._visitedParent=i.parent,this.ignoreElementEnd?this._next():Ft("elementEnd",i,e,t)}_previous(){const e=this.position,t=this.position.clone(),i=this._visitedParent;if(i.parent===null&&t.offset===0)return{done:!0,value:void 0};if(i==this._boundaryStartParent&&t.offset==this.boundaries.start.offset)return{done:!0,value:void 0};const s=t.parent,o=bn(t,s),r=o||Em(t,s,o);if(r instanceof W)return t.offset--,this.shallow?(this._position=t,Ft("elementStart",r,e,t,1)):(t.path.push(r.maxOffset),this._position=t,this._visitedParent=r,this.ignoreElementEnd?this._previous():Ft("elementEnd",r,e,t));if(r instanceof j){let a;if(this.singleCharacters)a=1;else{let u=r.startOffset;this._boundaryStartParent==i&&this.boundaries.start.offset>u&&(u=this.boundaries.start.offset),a=t.offset-u}const l=t.offset-r.startOffset,c=new Ke(r,l-a,a);return t.offset-=a,this._position=t,Ft("text",c,e,t,a)}return t.path.pop(),this._position=t,this._visitedParent=i.parent,Ft("elementStart",i,e,t,1)}}function Ft(n,e,t,i,s){return{done:!1,value:{type:n,item:e,previousPosition:t,nextPosition:i,length:s}}}/**
|
|
428
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
429
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
430
|
+
*/class y extends Bt{constructor(e,t,i="toNone"){if(super(),!e.is("element")&&!e.is("documentFragment"))throw new g("model-position-root-invalid",e);if(!(t instanceof Array)||t.length===0)throw new g("model-position-path-incorrect-format",e,{path:t});e.is("rootElement")?t=t.slice():(t=[...e.getPath(),...t],e=e.root),this.root=e,this.path=t,this.stickiness=i}get offset(){return this.path[this.path.length-1]}set offset(e){this.path[this.path.length-1]=e}get parent(){let e=this.root;for(let t=0;t<this.path.length-1;t++)if(e=e.getChild(e.offsetToIndex(this.path[t])),!e)throw new g("model-position-path-incorrect",this,{position:this});if(e.is("$text"))throw new g("model-position-path-incorrect",this,{position:this});return e}get index(){return this.parent.offsetToIndex(this.offset)}get textNode(){return bn(this,this.parent)}get nodeAfter(){const e=this.parent;return km(this,e,bn(this,e))}get nodeBefore(){const e=this.parent;return Em(this,e,bn(this,e))}get isAtStart(){return this.offset===0}get isAtEnd(){return this.offset==this.parent.maxOffset}compareWith(e){if(this.root!=e.root)return"different";const t=ye(this.path,e.path);switch(t){case"same":return"same";case"prefix":return"before";case"extension":return"after";default:return this.path[t]<e.path[t]?"before":"after"}}getLastMatchingPosition(e,t={}){t.startPosition=this;const i=new pt(t);return i.skip(e),i.position}getParentPath(){return this.path.slice(0,-1)}getAncestors(){const e=this.parent;return e.is("documentFragment")?[e]:e.getAncestors({includeSelf:!0})}findAncestor(e){const t=this.parent;return t.is("element")?t.findAncestor(e,{includeSelf:!0}):null}getCommonPath(e){if(this.root!=e.root)return[];const t=ye(this.path,e.path),i=typeof t=="string"?Math.min(this.path.length,e.path.length):t;return this.path.slice(0,i)}getCommonAncestor(e){const t=this.getAncestors(),i=e.getAncestors();let s=0;for(;t[s]==i[s]&&t[s];)s++;return s===0?null:t[s-1]}getShiftedBy(e){const t=this.clone(),i=t.offset+e;return t.offset=i<0?0:i,t}isAfter(e){return this.compareWith(e)=="after"}isBefore(e){return this.compareWith(e)=="before"}isEqual(e){return this.compareWith(e)=="same"}isTouching(e){if(this.root!==e.root)return!1;const t=Math.min(this.path.length,e.path.length);for(let i=0;i<t;i++){const s=this.path[i]-e.path[i];if(s<-1||s>1)return!1;if(s===1)return Nc(e,this,i);if(s===-1)return Nc(this,e,i)}return this.path.length===e.path.length?!0:this.path.length>e.path.length?Mr(this.path,t):Mr(e.path,t)}hasSameParentAs(e){if(this.root!==e.root)return!1;const t=this.getParentPath(),i=e.getParentPath();return ye(t,i)=="same"}getTransformedByOperation(e){let t;switch(e.type){case"insert":t=this._getTransformedByInsertOperation(e);break;case"move":case"remove":case"reinsert":t=this._getTransformedByMoveOperation(e);break;case"split":t=this._getTransformedBySplitOperation(e);break;case"merge":t=this._getTransformedByMergeOperation(e);break;default:t=y._createAt(this);break}return t}_getTransformedByInsertOperation(e){return this._getTransformedByInsertion(e.position,e.howMany)}_getTransformedByMoveOperation(e){return this._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany)}_getTransformedBySplitOperation(e){const t=e.movedRange;return t.containsPosition(this)||t.start.isEqual(this)&&this.stickiness=="toNext"?this._getCombined(e.splitPosition,e.moveTargetPosition):e.graveyardPosition?this._getTransformedByMove(e.graveyardPosition,e.insertionPosition,1):this._getTransformedByInsertion(e.insertionPosition,1)}_getTransformedByMergeOperation(e){const t=e.movedRange,i=t.containsPosition(this)||t.start.isEqual(this);let s;return i?(s=this._getCombined(e.sourcePosition,e.targetPosition),e.sourcePosition.isBefore(e.targetPosition)&&(s=s._getTransformedByDeletion(e.deletionPosition,1))):this.isEqual(e.deletionPosition)?s=y._createAt(e.deletionPosition):s=this._getTransformedByMove(e.deletionPosition,e.graveyardPosition,1),s}_getTransformedByDeletion(e,t){const i=y._createAt(this);if(this.root!=e.root)return i;if(ye(e.getParentPath(),this.getParentPath())=="same"){if(e.offset<this.offset){if(e.offset+t>this.offset)return null;i.offset-=t}}else if(ye(e.getParentPath(),this.getParentPath())=="prefix"){const s=e.path.length-1;if(e.offset<=this.path[s]){if(e.offset+t>this.path[s])return null;i.path[s]-=t}}return i}_getTransformedByInsertion(e,t){const i=y._createAt(this);if(this.root!=e.root)return i;if(ye(e.getParentPath(),this.getParentPath())=="same")(e.offset<this.offset||e.offset==this.offset&&this.stickiness!="toPrevious")&&(i.offset+=t);else if(ye(e.getParentPath(),this.getParentPath())=="prefix"){const s=e.path.length-1;e.offset<=this.path[s]&&(i.path[s]+=t)}return i}_getTransformedByMove(e,t,i){if(t=t._getTransformedByDeletion(e,i),e.isEqual(t))return y._createAt(this);const s=this._getTransformedByDeletion(e,i);return s===null||e.isEqual(this)&&this.stickiness=="toNext"||e.getShiftedBy(i).isEqual(this)&&this.stickiness=="toPrevious"?this._getCombined(e,t):s._getTransformedByInsertion(t,i)}_getCombined(e,t){const i=e.path.length-1,s=y._createAt(t);return s.stickiness=this.stickiness,s.offset=s.offset+this.path[i]-e.offset,s.path=[...s.path,...this.path.slice(i+1)],s}toJSON(){return{root:this.root.toJSON(),path:Array.from(this.path),stickiness:this.stickiness}}clone(){return new this.constructor(this.root,this.path,this.stickiness)}static _createAt(e,t,i="toNone"){if(e instanceof y)return new y(e.root,e.path,e.stickiness);{const s=e;if(t=="end")t=s.maxOffset;else{if(t=="before")return this._createBefore(s,i);if(t=="after")return this._createAfter(s,i);if(t!==0&&!t)throw new g("model-createpositionat-offset-required",[this,e])}if(!s.is("element")&&!s.is("documentFragment"))throw new g("model-position-parent-incorrect",[this,e]);const o=s.getPath();return o.push(t),new this(s.root,o,i)}}static _createAfter(e,t){if(!e.parent)throw new g("model-position-after-root",[this,e],{root:e});return this._createAt(e.parent,e.endOffset,t)}static _createBefore(e,t){if(!e.parent)throw new g("model-position-before-root",e,{root:e});return this._createAt(e.parent,e.startOffset,t)}static fromJSON(e,t){if(e.root==="$graveyard"){const i=new y(t.graveyard,e.path);return i.stickiness=e.stickiness,i}if(!t.getRoot(e.root))throw new g("model-position-fromjson-no-root",t,{rootName:e.root});return new y(t.getRoot(e.root),e.path,e.stickiness)}}y.prototype.is=function(n){return n==="position"||n==="model:position"};function bn(n,e){const t=e.getChild(e.offsetToIndex(n.offset));return t&&t.is("$text")&&t.startOffset<n.offset?t:null}function km(n,e,t){return t!==null?null:e.getChild(e.offsetToIndex(n.offset))}function Em(n,e,t){return t!==null?null:e.getChild(e.offsetToIndex(n.offset)-1)}function Nc(n,e,t){return!(t+1===n.path.length||!Mr(e.path,t+1)||!Fk(n,t+1))}function Mr(n,e){for(;e<n.length;){if(n[e]!==0)return!1;e++}return!0}function Fk(n,e){let t=n.parent,i=n.path.length-1,s=0;for(;i>=e;){if(n.path[i]+s!==t.maxOffset)return!1;s=1,i--,t=t.parent}return!0}/**
|
|
431
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
432
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
433
|
+
*/class b extends Bt{constructor(e,t){super(),this.start=y._createAt(e),this.end=t?y._createAt(t):y._createAt(e),this.start.stickiness=this.isCollapsed?"toNone":"toNext",this.end.stickiness=this.isCollapsed?"toNone":"toPrevious"}*[Symbol.iterator](){yield*new pt({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){const e=this.start.getParentPath(),t=this.end.getParentPath();return ye(e,t)=="same"}get root(){return this.start.root}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);const i=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),s=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return i&&s}containsItem(e){const t=y._createBefore(e);return this.containsPosition(t)||this.start.isEqual(t)}isEqual(e){return this.start.isEqual(e.start)&&this.end.isEqual(e.end)}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new b(this.start,e.start)),this.containsPosition(e.end)&&t.push(new b(e.end,this.end))):t.push(new b(this.start,this.end)),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,i=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(i=e.end),new b(t,i)}return null}getJoined(e,t=!1){let i=this.isIntersecting(e);if(i||(this.start.isBefore(e.start)?i=t?this.end.isTouching(e.start):this.end.isEqual(e.start):i=t?e.end.isTouching(this.start):e.end.isEqual(this.start)),!i)return null;let s=this.start,o=this.end;return e.start.isBefore(s)&&(s=e.start),e.end.isAfter(o)&&(o=e.end),new b(s,o)}getMinimalFlatRanges(){const e=[],t=this.start.getCommonPath(this.end).length,i=y._createAt(this.start);let s=i.parent;for(;i.path.length>t+1;){const o=s.maxOffset-i.offset;o!==0&&e.push(new b(i,i.getShiftedBy(o))),i.path=i.path.slice(0,-1),i.offset++,s=s.parent}for(;i.path.length<=this.end.path.length;){const o=this.end.path[i.path.length-1],r=o-i.offset;r!==0&&e.push(new b(i,i.getShiftedBy(r))),i.offset=o,i.path.push(0)}return e}getWalker(e={}){return e.boundaries=this,new pt(e)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new pt(e);for(const i of t)yield i.item}*getPositions(e={}){e.boundaries=this;const t=new pt(e);yield t.position;for(const i of t)yield i.nextPosition}getTransformedByOperation(e){switch(e.type){case"insert":return this._getTransformedByInsertOperation(e);case"move":case"remove":case"reinsert":return this._getTransformedByMoveOperation(e);case"split":return[this._getTransformedBySplitOperation(e)];case"merge":return[this._getTransformedByMergeOperation(e)]}return[new b(this.start,this.end)]}getTransformedByOperations(e){const t=[new b(this.start,this.end)];for(const i of e)for(let s=0;s<t.length;s++){const o=t[s].getTransformedByOperation(i);t.splice(s,1,...o),s+=o.length-1}for(let i=0;i<t.length;i++){const s=t[i];for(let o=i+1;o<t.length;o++){const r=t[o];(s.containsRange(r)||r.containsRange(s)||s.isEqual(r))&&t.splice(o,1)}}return t}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;const e=this.start.nodeAfter,t=this.end.nodeBefore;return e&&e.is("element")&&e===t?e:null}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}clone(){return new this.constructor(this.start,this.end)}_getTransformedByInsertOperation(e,t=!1){return this._getTransformedByInsertion(e.position,e.howMany,t)}_getTransformedByMoveOperation(e,t=!1){const i=e.sourcePosition,s=e.howMany,o=e.targetPosition;return this._getTransformedByMove(i,o,s,t)}_getTransformedBySplitOperation(e){const t=this.start._getTransformedBySplitOperation(e);let i=this.end._getTransformedBySplitOperation(e);return this.end.isEqual(e.insertionPosition)&&(i=this.end.getShiftedBy(1)),t.root!=i.root&&(i=this.end.getShiftedBy(-1)),new b(t,i)}_getTransformedByMergeOperation(e){if(this.start.isEqual(e.targetPosition)&&this.end.isEqual(e.deletionPosition))return new b(this.start);let t=this.start._getTransformedByMergeOperation(e),i=this.end._getTransformedByMergeOperation(e);return t.root!=i.root&&(i=this.end.getShiftedBy(-1)),t.isAfter(i)?(e.sourcePosition.isBefore(e.targetPosition)?(t=y._createAt(i),t.offset=0):(e.deletionPosition.isEqual(t)||(i=e.deletionPosition),t=e.targetPosition),new b(t,i)):new b(t,i)}_getTransformedByInsertion(e,t,i=!1){if(i&&this.containsPosition(e))return[new b(this.start,e),new b(e.getShiftedBy(t),this.end._getTransformedByInsertion(e,t))];{const s=new b(this.start,this.end);return s.start=s.start._getTransformedByInsertion(e,t),s.end=s.end._getTransformedByInsertion(e,t),[s]}}_getTransformedByMove(e,t,i,s=!1){if(this.isCollapsed){const d=this.start._getTransformedByMove(e,t,i);return[new b(d)]}const o=b._createFromPositionAndShift(e,i),r=t._getTransformedByDeletion(e,i);if(this.containsPosition(t)&&!s&&(o.containsPosition(this.start)||o.containsPosition(this.end))){const d=this.start._getTransformedByMove(e,t,i),h=this.end._getTransformedByMove(e,t,i);return[new b(d,h)]}let a;const l=this.getDifference(o);let c=null;const u=this.getIntersection(o);if(l.length==1?c=new b(l[0].start._getTransformedByDeletion(e,i),l[0].end._getTransformedByDeletion(e,i)):l.length==2&&(c=new b(this.start,this.end._getTransformedByDeletion(e,i))),c?a=c._getTransformedByInsertion(r,i,u!==null||s):a=[],u){const d=new b(u.start._getCombined(o.start,r),u.end._getCombined(o.start,r));a.length==2?a.splice(1,0,d):a.push(d)}return a}_getTransformedByDeletion(e,t){let i=this.start._getTransformedByDeletion(e,t),s=this.end._getTransformedByDeletion(e,t);return i==null&&s==null?null:(i==null&&(i=e),s==null&&(s=e),new b(i,s))}static _createFromPositionAndShift(e,t){const i=e,s=e.getShiftedBy(t);return t>0?new this(i,s):new this(s,i)}static _createIn(e){return new this(y._createAt(e,0),y._createAt(e,e.maxOffset))}static _createOn(e){return this._createFromPositionAndShift(y._createBefore(e),e.offsetSize)}static _createFromRanges(e){if(e.length===0)throw new g("range-create-from-ranges-empty-array",null);if(e.length==1)return e[0].clone();const t=e[0];e.sort((o,r)=>o.start.isAfter(r.start)?1:-1);const i=e.indexOf(t),s=new this(t.start,t.end);if(i>0)for(let o=i-1;e[o].end.isEqual(s.start);o++)s.start=y._createAt(e[o].start);for(let o=i+1;o<e.length&&e[o].start.isEqual(s.end);o++)s.end=y._createAt(e[o].end);return s}static fromJSON(e,t){return new this(y.fromJSON(e.start,t),y.fromJSON(e.end,t))}}b.prototype.is=function(n){return n==="range"||n==="model:range"};/**
|
|
434
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
435
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
436
|
+
*/class Tm extends Z(){constructor(){super(),this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._viewToModelLengthCallbacks=new Map,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._deferredBindingRemovals=new Map,this._unboundMarkerNames=new Set,this.on("modelToViewPosition",(e,t)=>{if(t.viewPosition)return;const i=this._modelToViewMapping.get(t.modelPosition.parent);if(!i)throw new g("mapping-model-position-view-parent-not-found",this,{modelPosition:t.modelPosition});t.viewPosition=this.findPositionIn(i,t.modelPosition.offset)},{priority:"low"}),this.on("viewToModelPosition",(e,t)=>{if(t.modelPosition)return;const i=this.findMappedViewAncestor(t.viewPosition),s=this._viewToModelMapping.get(i),o=this._toModelOffset(t.viewPosition.parent,t.viewPosition.offset,i);t.modelPosition=y._createAt(s,o)},{priority:"low"})}bindElements(e,t){this._modelToViewMapping.set(e,t),this._viewToModelMapping.set(t,e)}unbindViewElement(e,t={}){const i=this.toModelElement(e);if(this._elementToMarkerNames.has(e))for(const s of this._elementToMarkerNames.get(e))this._unboundMarkerNames.add(s);t.defer?this._deferredBindingRemovals.set(e,e.root):(this._viewToModelMapping.delete(e),this._modelToViewMapping.get(i)==e&&this._modelToViewMapping.delete(i))}unbindModelElement(e){const t=this.toViewElement(e);this._modelToViewMapping.delete(e),this._viewToModelMapping.get(t)==e&&this._viewToModelMapping.delete(t)}bindElementToMarker(e,t){const i=this._markerNameToElements.get(t)||new Set;i.add(e);const s=this._elementToMarkerNames.get(e)||new Set;s.add(t),this._markerNameToElements.set(t,i),this._elementToMarkerNames.set(e,s)}unbindElementFromMarkerName(e,t){const i=this._markerNameToElements.get(t);i&&(i.delete(e),i.size==0&&this._markerNameToElements.delete(t));const s=this._elementToMarkerNames.get(e);s&&(s.delete(t),s.size==0&&this._elementToMarkerNames.delete(e))}flushUnboundMarkerNames(){const e=Array.from(this._unboundMarkerNames);return this._unboundMarkerNames.clear(),e}flushDeferredBindings(){for(const[e,t]of this._deferredBindingRemovals)e.root==t&&this.unbindViewElement(e);this._deferredBindingRemovals=new Map}clearBindings(){this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._unboundMarkerNames=new Set,this._deferredBindingRemovals=new Map}toModelElement(e){return this._viewToModelMapping.get(e)}toViewElement(e){return this._modelToViewMapping.get(e)}toModelRange(e){return new b(this.toModelPosition(e.start),this.toModelPosition(e.end))}toViewRange(e){return new F(this.toViewPosition(e.start),this.toViewPosition(e.end))}toModelPosition(e){const t={viewPosition:e,mapper:this};return this.fire("viewToModelPosition",t),t.modelPosition}toViewPosition(e,t={}){const i={modelPosition:e,mapper:this,isPhantom:t.isPhantom};return this.fire("modelToViewPosition",i),i.viewPosition}markerNameToElements(e){const t=this._markerNameToElements.get(e);if(!t)return null;const i=new Set;for(const s of t)if(s.is("attributeElement"))for(const o of s.getElementsWithSameId())i.add(o);else i.add(s);return i}registerViewToModelLength(e,t){this._viewToModelLengthCallbacks.set(e,t)}findMappedViewAncestor(e){let t=e.parent;for(;!this._viewToModelMapping.has(t);)t=t.parent;return t}_toModelOffset(e,t,i){if(i!=e){const o=this._toModelOffset(e.parent,e.index,i),r=this._toModelOffset(e,t,e);return o+r}if(e.is("$text"))return t;let s=0;for(let o=0;o<t;o++)s+=this.getModelLength(e.getChild(o));return s}getModelLength(e){if(this._viewToModelLengthCallbacks.get(e.name))return this._viewToModelLengthCallbacks.get(e.name)(e);if(this._viewToModelMapping.has(e))return 1;if(e.is("$text"))return e.data.length;if(e.is("uiElement"))return 0;{let t=0;for(const i of e.getChildren())t+=this.getModelLength(i);return t}}findPositionIn(e,t){let i,s=0,o=0,r=0;if(e.is("$text"))return new k(e,t);for(;o<t;)i=e.getChild(r),s=this.getModelLength(i),o+=s,r++;return o==t?this._moveViewPositionToTextNode(new k(e,r)):this.findPositionIn(i,t-(o-s))}_moveViewPositionToTextNode(e){const t=e.nodeBefore,i=e.nodeAfter;return t instanceof te?new k(t,t.data.length):i instanceof te?new k(i,0):e}}/**
|
|
437
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
438
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
439
|
+
*/class Dk{constructor(){this._consumable=new Map,this._textProxyRegistry=new Map}add(e,t){t=us(t),e instanceof Ke&&(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=us(t),e instanceof Ke&&(e=this._getSymbolForTextProxy(e)),this.test(e,t)?(this._consumable.get(e).set(t,!1),!0):!1}test(e,t){t=us(t),e instanceof Ke&&(e=this._getSymbolForTextProxy(e));const i=this._consumable.get(e);if(i===void 0)return null;const s=i.get(t);return s===void 0?null:s}revert(e,t){t=us(t),e instanceof Ke&&(e=this._getSymbolForTextProxy(e));const i=this.test(e,t);return i===!1?(this._consumable.get(e).set(t,!0),!0):i===!0?!1:null}verifyAllConsumed(e){const t=[];for(const[i,s]of this._consumable)for(const[o,r]of s){const a=o.split(":")[0];r&&e==a&&t.push({event:o,item:i.name||i.description})}if(t.length)throw new g("conversion-model-consumable-not-consumed",null,{items:t})}_getSymbolForTextProxy(e){let t=null;const i=this._textProxyRegistry.get(e.startOffset);if(i){const s=i.get(e.endOffset);s&&(t=s.get(e.parent))}return t||(t=this._addSymbolForTextProxy(e)),t}_addSymbolForTextProxy(e){const t=e.startOffset,i=e.endOffset,s=e.parent,o=Symbol("$textProxy:"+e.data);let r,a;return r=this._textProxyRegistry.get(t),r||(r=new Map,this._textProxyRegistry.set(t,r)),a=r.get(i),a||(a=new Map,r.set(i,a)),a.set(s,o),o}}function us(n){const e=n.split(":");return e[0]=="insert"?e[0]:e[0]=="addMarker"||e[0]=="removeMarker"?n:e.length>1?e[0]+":"+e[1]:e[0]}/**
|
|
440
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
441
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
442
|
+
*/class Am extends Z(){constructor(e){super(),this._conversionApi={dispatcher:this,...e},this._firedEventsMap=new WeakMap}convertChanges(e,t,i){const s=this._createConversionApi(i,e.getRefreshedItems());for(const r of e.getMarkersToRemove())this._convertMarkerRemove(r.name,r.range,s);const o=this._reduceChanges(e.getChanges());for(const r of o)r.type==="insert"?this._convertInsert(b._createFromPositionAndShift(r.position,r.length),s):r.type==="reinsert"?this._convertReinsert(b._createFromPositionAndShift(r.position,r.length),s):r.type==="remove"?this._convertRemove(r.position,r.length,r.name,s):this._convertAttribute(r.range,r.attributeKey,r.attributeOldValue,r.attributeNewValue,s);s.mapper.flushDeferredBindings();for(const r of s.mapper.flushUnboundMarkerNames()){const a=t.get(r).getRange();this._convertMarkerRemove(r,a,s),this._convertMarkerAdd(r,a,s)}for(const r of e.getMarkersToAdd())this._convertMarkerAdd(r.name,r.range,s);s.consumable.verifyAllConsumed("insert")}convert(e,t,i,s={}){const o=this._createConversionApi(i,void 0,s);this._convertInsert(e,o);for(const[r,a]of t)this._convertMarkerAdd(r,a,o);o.consumable.verifyAllConsumed("insert")}convertSelection(e,t,i){const s=this._createConversionApi(i);this.fire("cleanSelection",{selection:e},s);const o=e.getFirstPosition().root;if(!s.mapper.toViewElement(o))return;const r=Array.from(t.getMarkersAtPosition(e.getFirstPosition()));if(this._addConsumablesForSelection(s.consumable,e,r),this.fire("selection",{selection:e},s),!!e.isCollapsed){for(const a of r)if(s.consumable.test(e,"addMarker:"+a.name)){const l=a.getRange();if(!Nk(e.getFirstPosition(),a,s.mapper))continue;const c={item:e,markerName:a.name,markerRange:l};this.fire(`addMarker:${a.name}`,c,s)}for(const a of e.getAttributeKeys())if(s.consumable.test(e,"attribute:"+a)){const l={item:e,range:e.getFirstRange(),attributeKey:a,attributeOldValue:null,attributeNewValue:e.getAttribute(a)};this.fire(`attribute:${a}:$text`,l,s)}}}_convertInsert(e,t,i={}){i.doNotAddConsumables||this._addConsumablesForInsert(t.consumable,e);for(const s of Array.from(e.getWalker({shallow:!0})).map($c))this._testAndFire("insert",s,t)}_convertRemove(e,t,i,s){this.fire(`remove:${i}`,{position:e,length:t},s)}_convertAttribute(e,t,i,s,o){this._addConsumablesForRange(o.consumable,e,`attribute:${t}`);for(const r of e){const a={item:r.item,range:b._createFromPositionAndShift(r.previousPosition,r.length),attributeKey:t,attributeOldValue:i,attributeNewValue:s};this._testAndFire(`attribute:${t}`,a,o)}}_convertReinsert(e,t){const i=Array.from(e.getWalker({shallow:!0}));this._addConsumablesForInsert(t.consumable,i);for(const s of i.map($c))this._testAndFire("insert",{...s,reconversion:!0},t)}_convertMarkerAdd(e,t,i){if(t.root.rootName=="$graveyard")return;const s=`addMarker:${e}`;if(i.consumable.add(t,s),this.fire(s,{markerName:e,markerRange:t},i),!!i.consumable.consume(t,s)){this._addConsumablesForRange(i.consumable,t,s);for(const o of t.getItems()){if(!i.consumable.test(o,s))continue;const r={item:o,range:b._createOn(o),markerName:e,markerRange:t};this.fire(s,r,i)}}}_convertMarkerRemove(e,t,i){t.root.rootName!="$graveyard"&&this.fire(`removeMarker:${e}`,{markerName:e,markerRange:t},i)}_reduceChanges(e){const t={changes:e};return this.fire("reduceChanges",t),t.changes}_addConsumablesForInsert(e,t){for(const i of t){const s=i.item;if(e.test(s,"insert")===null){e.add(s,"insert");for(const o of s.getAttributeKeys())e.add(s,"attribute:"+o)}}return e}_addConsumablesForRange(e,t,i){for(const s of t.getItems())e.add(s,i);return e}_addConsumablesForSelection(e,t,i){e.add(t,"selection");for(const s of i)e.add(t,"addMarker:"+s.name);for(const s of t.getAttributeKeys())e.add(t,"attribute:"+s);return e}_testAndFire(e,t,i){const s=$k(e,t),o=t.item.is("$textProxy")?i.consumable._getSymbolForTextProxy(t.item):t.item,r=this._firedEventsMap.get(i),a=r.get(o);if(!a)r.set(o,new Set([s]));else if(!a.has(s))a.add(s);else return;this.fire(s,t,i)}_testAndFireAddAttributes(e,t){const i={item:e,range:b._createOn(e)};for(const s of i.item.getAttributeKeys())i.attributeKey=s,i.attributeOldValue=null,i.attributeNewValue=i.item.getAttribute(s),this._testAndFire(`attribute:${s}`,i,t)}_createConversionApi(e,t=new Set,i={}){const s={...this._conversionApi,consumable:new Dk,writer:e,options:i,convertItem:o=>this._convertInsert(b._createOn(o),s),convertChildren:o=>this._convertInsert(b._createIn(o),s,{doNotAddConsumables:!0}),convertAttributes:o=>this._testAndFireAddAttributes(o,s),canReuseView:o=>!t.has(s.mapper.toModelElement(o))};return this._firedEventsMap.set(s,new Map),s}}function Nk(n,e,t){const i=e.getRange(),s=Array.from(n.getAncestors());return s.shift(),s.reverse(),!s.some(r=>{if(i.containsItem(r))return!!t.toViewElement(r).getCustomProperty("addHighlight")})}function $k(n,e){const t=e.item.is("element")?e.item.name:"$text";return`${n}:${t}`}function $c(n){const e=n.item,t=b._createFromPositionAndShift(n.previousPosition,n.length);return{item:e,range:t}}/**
|
|
443
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
444
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
445
|
+
*/class Oe extends Z(Bt){constructor(...e){super(),this._lastRangeBackward=!1,this._attrs=new Map,this._ranges=[],e.length&&this.setTo(...e)}get anchor(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.end:e.start}return null}get focus(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.start:e.end}return null}get isCollapsed(){return this._ranges.length===1?this._ranges[0].isCollapsed:!1}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}isEqual(e){if(this.rangeCount!=e.rangeCount)return!1;if(this.rangeCount===0)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let i=!1;for(const s of e._ranges)if(t.isEqual(s)){i=!0;break}if(!i)return!1}return!0}*getRanges(){for(const e of this._ranges)yield new b(e.start,e.end)}getFirstRange(){let e=null;for(const t of this._ranges)(!e||t.start.isBefore(e.start))&&(e=t);return e?new b(e.start,e.end):null}getLastRange(){let e=null;for(const t of this._ranges)(!e||t.end.isAfter(e.end))&&(e=t);return e?new b(e.start,e.end):null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}setTo(...e){let[t,i,s]=e;if(typeof i=="object"&&(s=i,i=void 0),t===null)this._setRanges([]);else if(t instanceof Oe)this._setRanges(t.getRanges(),t.isBackward);else if(t&&typeof t.getRanges=="function")this._setRanges(t.getRanges(),t.isBackward);else if(t instanceof b)this._setRanges([t],!!s&&!!s.backward);else if(t instanceof y)this._setRanges([new b(t)]);else if(t instanceof ui){const o=!!s&&!!s.backward;let r;if(i=="in")r=b._createIn(t);else if(i=="on")r=b._createOn(t);else if(i!==void 0)r=new b(y._createAt(t,i));else throw new g("model-selection-setto-required-second-parameter",[this,t]);this._setRanges([r],o)}else if(De(t))this._setRanges(t,s&&!!s.backward);else throw new g("model-selection-setto-not-selectable",[this,t])}_setRanges(e,t=!1){const i=Array.from(e),s=i.some(o=>{if(!(o instanceof b))throw new g("model-selection-set-ranges-not-range",[this,e]);return this._ranges.every(r=>!r.isEqual(o))});i.length===this._ranges.length&&!s||(this._replaceAllRanges(i),this._lastRangeBackward=!!t,this.fire("change:range",{directChange:!0}))}setFocus(e,t){if(this.anchor===null)throw new g("model-selection-setfocus-no-ranges",[this,e]);const i=y._createAt(e,t);if(i.compareWith(this.focus)=="same")return;const s=this.anchor;this._ranges.length&&this._popRange(),i.compareWith(s)=="before"?(this._pushRange(new b(i,s)),this._lastRangeBackward=!0):(this._pushRange(new b(s,i)),this._lastRangeBackward=!1),this.fire("change:range",{directChange:!0})}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}hasAttribute(e){return this._attrs.has(e)}removeAttribute(e){this.hasAttribute(e)&&(this._attrs.delete(e),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}setAttribute(e,t){this.getAttribute(e)!==t&&(this._attrs.set(e,t),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}getSelectedElement(){return this.rangeCount!==1?null:this.getFirstRange().getContainedElement()}*getSelectedBlocks(){const e=new WeakSet;for(const t of this.getRanges()){const i=zc(t.start,e);Hk(i,t)&&(yield i);for(const o of t.getWalker()){const r=o.item;o.type=="elementEnd"&&zk(r,e,t)&&(yield r)}const s=zc(t.end,e);Uk(s,t)&&(yield s)}}containsEntireContent(e=this.anchor.root){const t=y._createAt(e,0),i=y._createAt(e,"end");return t.isTouching(this.getFirstPosition())&&i.isTouching(this.getLastPosition())}_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 g("model-selection-range-intersects",[this,e],{addedRange:e,intersectingRange:this._ranges[t]})}_replaceAllRanges(e){this._removeAllRanges();for(const t of e)this._pushRange(t)}_removeAllRanges(){for(;this._ranges.length>0;)this._popRange()}_popRange(){this._ranges.pop()}}Oe.prototype.is=function(n){return n==="selection"||n==="model:selection"};function Sm(n,e){return e.has(n)?!1:(e.add(n),n.root.document.model.schema.isBlock(n)&&!!n.parent)}function zk(n,e,t){return Sm(n,e)&&qa(n,t)}function zc(n,e){const i=n.parent.root.document.model.schema,s=n.parent.getAncestors({parentFirst:!0,includeSelf:!0});let o=!1;const r=s.find(a=>o?!1:(o=i.isLimit(a),!o&&Sm(a,e)));return s.forEach(a=>e.add(a)),r}function qa(n,e){const t=Wk(n);return t?!e.containsRange(b._createOn(t),!0):!0}function Hk(n,e){return n?e.isCollapsed||n.isEmpty?!0:e.start.isTouching(y._createAt(n,n.maxOffset))?!1:qa(n,e):!1}function Uk(n,e){return n?e.isCollapsed||n.isEmpty?!0:e.end.isTouching(y._createAt(n,0))?!1:qa(n,e):!1}function Wk(n){const e=n.root.document.model.schema;let t=n.parent;for(;t;){if(e.isBlock(t))return t;t=t.parent}}/**
|
|
446
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
447
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
448
|
+
*/class Fe extends Z(b){constructor(e,t){super(e,t),qk.call(this)}detach(){this.stopListening()}toRange(){return new b(this.start,this.end)}static fromRange(e){return new Fe(e.start,e.end)}}Fe.prototype.is=function(n){return n==="liveRange"||n==="model:liveRange"||n=="range"||n==="model:range"};function qk(){this.listenTo(this.root.document.model,"applyOperation",(n,e)=>{const t=e[0];t.isDocumentOperation&&jk.call(this,t)},{priority:"low"})}function jk(n){const e=this.getTransformedByOperation(n),t=b._createFromRanges(e),i=!t.isEqual(this),s=Gk(this,n);let o=null;if(i){t.root.rootName=="$graveyard"&&(n.type=="remove"?o=n.sourcePosition:o=n.deletionPosition);const r=this.toRange();this.start=t.start,this.end=t.end,this.fire("change:range",r,{deletionPosition:o})}else s&&this.fire("change:content",this.toRange(),{deletionPosition:o})}function Gk(n,e){switch(e.type){case"insert":return n.containsPosition(e.position);case"move":case"remove":case"reinsert":case"merge":return n.containsPosition(e.sourcePosition)||n.start.isEqual(e.sourcePosition)||n.containsPosition(e.targetPosition);case"split":return n.containsPosition(e.splitPosition)||n.containsPosition(e.insertionPosition)}return!1}/**
|
|
449
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
450
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
451
|
+
*/const Rn="selection:";class Ye extends Z(Bt){constructor(e){super(),this._selection=new Kk(e),this._selection.delegate("change:range").to(this),this._selection.delegate("change:attribute").to(this),this._selection.delegate("change:marker").to(this)}get isCollapsed(){return this._selection.isCollapsed}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get rangeCount(){return this._selection.rangeCount}get hasOwnRange(){return this._selection.hasOwnRange}get isBackward(){return this._selection.isBackward}get isGravityOverridden(){return this._selection.isGravityOverridden}get markers(){return this._selection.markers}get _ranges(){return this._selection._ranges}getRanges(){return this._selection.getRanges()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getSelectedBlocks(){return this._selection.getSelectedBlocks()}getSelectedElement(){return this._selection.getSelectedElement()}containsEntireContent(e){return this._selection.containsEntireContent(e)}destroy(){this._selection.destroy()}getAttributeKeys(){return this._selection.getAttributeKeys()}getAttributes(){return this._selection.getAttributes()}getAttribute(e){return this._selection.getAttribute(e)}hasAttribute(e){return this._selection.hasAttribute(e)}refresh(){this._selection.updateMarkers(),this._selection._updateAttributes(!1)}observeMarkers(e){this._selection.observeMarkers(e)}_setFocus(e,t){this._selection.setFocus(e,t)}_setTo(...e){this._selection.setTo(...e)}_setAttribute(e,t){this._selection.setAttribute(e,t)}_removeAttribute(e){this._selection.removeAttribute(e)}_getStoredAttributes(){return this._selection.getStoredAttributes()}_overrideGravity(){return this._selection.overrideGravity()}_restoreGravity(e){this._selection.restoreGravity(e)}static _getStoreAttributeKey(e){return Rn+e}static _isStoreAttributeKey(e){return e.startsWith(Rn)}}Ye.prototype.is=function(n){return n==="selection"||n=="model:selection"||n=="documentSelection"||n=="model:documentSelection"};class Kk extends Oe{constructor(e){super(),this.markers=new _e({idProperty:"name"}),this._attributePriority=new Map,this._selectionRestorePosition=null,this._hasChangedRange=!1,this._overriddenGravityRegister=new Set,this._observedMarkers=new Set,this._model=e.model,this._document=e,this.listenTo(this._model,"applyOperation",(t,i)=>{const s=i[0];!s.isDocumentOperation||s.type=="marker"||s.type=="rename"||s.type=="noop"||(this._ranges.length==0&&this._selectionRestorePosition&&this._fixGraveyardSelection(this._selectionRestorePosition),this._selectionRestorePosition=null,this._hasChangedRange&&(this._hasChangedRange=!1,this.fire("change:range",{directChange:!1})))},{priority:"lowest"}),this.on("change:range",()=>{this._validateSelectionRanges(this.getRanges())}),this.listenTo(this._model.markers,"update",(t,i,s,o)=>{this._updateMarker(i,o)}),this.listenTo(this._document,"change",(t,i)=>{Zk(this._model,i)})}get isCollapsed(){return this._ranges.length===0?this._document._getDefaultRange().isCollapsed:super.isCollapsed}get anchor(){return super.anchor||this._document._getDefaultRange().start}get focus(){return super.focus||this._document._getDefaultRange().end}get rangeCount(){return this._ranges.length?this._ranges.length:1}get hasOwnRange(){return this._ranges.length>0}get isGravityOverridden(){return!!this._overriddenGravityRegister.size}destroy(){for(let e=0;e<this._ranges.length;e++)this._ranges[e].detach();this.stopListening()}*getRanges(){this._ranges.length?yield*super.getRanges():yield this._document._getDefaultRange()}getFirstRange(){return super.getFirstRange()||this._document._getDefaultRange()}getLastRange(){return super.getLastRange()||this._document._getDefaultRange()}setTo(...e){super.setTo(...e),this._updateAttributes(!0),this.updateMarkers()}setFocus(e,t){super.setFocus(e,t),this._updateAttributes(!0),this.updateMarkers()}setAttribute(e,t){if(this._setAttribute(e,t)){const i=[e];this.fire("change:attribute",{attributeKeys:i,directChange:!0})}}removeAttribute(e){if(this._removeAttribute(e)){const t=[e];this.fire("change:attribute",{attributeKeys:t,directChange:!0})}}overrideGravity(){const e=Ze();return this._overriddenGravityRegister.add(e),this._overriddenGravityRegister.size===1&&this._updateAttributes(!0),e}restoreGravity(e){if(!this._overriddenGravityRegister.has(e))throw new g("document-selection-gravity-wrong-restore",this,{uid:e});this._overriddenGravityRegister.delete(e),this.isGravityOverridden||this._updateAttributes(!0)}observeMarkers(e){this._observedMarkers.add(e),this.updateMarkers()}_replaceAllRanges(e){this._validateSelectionRanges(e),super._replaceAllRanges(e)}_popRange(){this._ranges.pop().detach()}_pushRange(e){const t=this._prepareRange(e);t&&this._ranges.push(t)}_validateSelectionRanges(e){for(const t of e)if(!this._document._validateSelectionRange(t))throw new g("document-selection-wrong-position",this,{range:t})}_prepareRange(e){if(this._checkRange(e),e.root==this._document.graveyard)return;const t=Fe.fromRange(e);return t.on("change:range",(i,s,o)=>{if(this._hasChangedRange=!0,t.root==this._document.graveyard){this._selectionRestorePosition=o.deletionPosition;const r=this._ranges.indexOf(t);this._ranges.splice(r,1),t.detach()}}),t}updateMarkers(){if(!this._observedMarkers.size)return;const e=[];let t=!1;for(const s of this._model.markers){const o=s.name.split(":",1)[0];if(!this._observedMarkers.has(o))continue;const r=s.getRange();for(const a of this.getRanges())r.containsRange(a,!a.isCollapsed)&&e.push(s)}const i=Array.from(this.markers);for(const s of e)this.markers.has(s)||(this.markers.add(s),t=!0);for(const s of Array.from(this.markers))e.includes(s)||(this.markers.remove(s),t=!0);t&&this.fire("change:marker",{oldMarkers:i,directChange:!1})}_updateMarker(e,t){const i=e.name.split(":",1)[0];if(!this._observedMarkers.has(i))return;let s=!1;const o=Array.from(this.markers),r=this.markers.has(e);if(!t)r&&(this.markers.remove(e),s=!0);else{let a=!1;for(const l of this.getRanges())if(t.containsRange(l,!l.isCollapsed)){a=!0;break}a&&!r?(this.markers.add(e),s=!0):!a&&r&&(this.markers.remove(e),s=!0)}s&&this.fire("change:marker",{oldMarkers:o,directChange:!1})}_updateAttributes(e){const t=vt(this._getSurroundingAttributes()),i=vt(this.getAttributes());if(e)this._attributePriority=new Map,this._attrs=new Map;else for(const[o,r]of this._attributePriority)r=="low"&&(this._attrs.delete(o),this._attributePriority.delete(o));this._setAttributesTo(t);const s=[];for(const[o,r]of this.getAttributes())(!i.has(o)||i.get(o)!==r)&&s.push(o);for(const[o]of i)this.hasAttribute(o)||s.push(o);s.length>0&&this.fire("change:attribute",{attributeKeys:s,directChange:!1})}_setAttribute(e,t,i=!0){const s=i?"normal":"low";return s=="low"&&this._attributePriority.get(e)=="normal"||super.getAttribute(e)===t?!1:(this._attrs.set(e,t),this._attributePriority.set(e,s),!0)}_removeAttribute(e,t=!0){const i=t?"normal":"low";return i=="low"&&this._attributePriority.get(e)=="normal"||(this._attributePriority.set(e,i),!super.hasAttribute(e))?!1:(this._attrs.delete(e),!0)}_setAttributesTo(e){const t=new Set;for(const[i,s]of this.getAttributes())e.get(i)!==s&&this._removeAttribute(i,!1);for(const[i,s]of e)this._setAttribute(i,s,!1)&&t.add(i);return t}*getStoredAttributes(){const e=this.getFirstPosition().parent;if(this.isCollapsed&&e.isEmpty)for(const t of e.getAttributeKeys())t.startsWith(Rn)&&(yield[t.substr(Rn.length),e.getAttribute(t)])}_getSurroundingAttributes(){const e=this.getFirstPosition(),t=this._model.schema;if(e.root.rootName=="$graveyard")return null;let i=null;if(this.isCollapsed){const s=e.textNode?e.textNode:e.nodeBefore,o=e.textNode?e.textNode:e.nodeAfter;if(this.isGravityOverridden||(i=sn(s,t)),i||(i=sn(o,t)),!this.isGravityOverridden&&!i){let r=s;for(;r&&!i;)r=r.previousSibling,i=sn(r,t)}if(!i){let r=o;for(;r&&!i;)r=r.nextSibling,i=sn(r,t)}i||(i=this.getStoredAttributes())}else{const s=this.getFirstRange();for(const o of s){if(o.item.is("element")&&t.isObject(o.item)){i=sn(o.item,t);break}if(o.type=="text"){i=o.item.getAttributes();break}}}return i}_fixGraveyardSelection(e){const t=this._model.schema.getNearestSelectionRange(e);t&&this._pushRange(t)}}function sn(n,e){if(!n)return null;if(n instanceof Ke||n instanceof j)return n.getAttributes();if(!e.isInline(n))return null;if(!e.isObject(n))return[];const t=[];for(const[i,s]of n.getAttributes())e.checkAttribute("$text",i)&&e.getAttributeProperties(i).copyFromObject!==!1&&t.push([i,s]);return t}function Zk(n,e){const t=n.document.differ;for(const i of t.getChanges()){if(i.type!="insert")continue;const s=i.position.parent;i.length===s.maxOffset&&n.enqueueChange(e,r=>{const a=Array.from(s.getAttributeKeys()).filter(l=>l.startsWith(Rn));for(const l of a)r.removeAttribute(l,s)})}}/**
|
|
452
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
453
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
454
|
+
*/class xm{constructor(e){this._dispatchers=e}add(e){for(const t of this._dispatchers)e(t);return this}}/**
|
|
455
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
456
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
457
|
+
*/class Jk extends xm{elementToElement(e){return this.add(m5(e))}elementToStructure(e){return this.add(g5(e))}attributeToElement(e){return this.add(p5(e))}attributeToAttribute(e){return this.add(w5(e))}markerToElement(e){return this.add(b5(e))}markerToHighlight(e){return this.add(v5(e))}markerToData(e){return this.add(_5(e))}}function Im(){return(n,e,t)=>{if(!t.consumable.consume(e.item,n.name))return;const i=t.writer,s=t.mapper.toViewPosition(e.range.start),o=i.createText(e.item.data);i.insert(s,o)}}function Pm(){return(n,e,t)=>{t.convertAttributes(e.item),!e.reconversion&&e.item.is("element")&&!e.item.isEmpty&&t.convertChildren(e.item)}}function Yk(){return(n,e,t)=>{const i=t.mapper.toViewPosition(e.position),s=e.position.getShiftedBy(e.length),o=t.mapper.toViewPosition(s,{isPhantom:!0}),r=t.writer.createRange(i,o),a=t.writer.remove(r.getTrimmed());for(const l of t.writer.createRangeIn(a).getItems())t.mapper.unbindViewElement(l,{defer:!0})}}function Rm(n,e){const t=n.createAttributeElement("span",e.attributes);return e.classes&&t._addClass(e.classes),typeof e.priority=="number"&&(t._priority=e.priority),t._id=e.id,t}function Qk(){return(n,e,t)=>{const i=e.selection;if(i.isCollapsed||!t.consumable.consume(i,"selection"))return;const s=[];for(const o of i.getRanges())s.push(t.mapper.toViewRange(o));t.writer.setSelection(s,{backward:i.isBackward})}}function Xk(){return(n,e,t)=>{const i=e.selection;if(!i.isCollapsed||!t.consumable.consume(i,"selection"))return;const s=t.writer,o=i.getFirstPosition(),r=t.mapper.toViewPosition(o),a=s.breakAttributes(r);s.setSelection(a)}}function e5(){return(n,e,t)=>{const i=t.writer,s=i.document.selection;for(const o of s.getRanges())o.isCollapsed&&o.end.parent.isAttached()&&t.writer.mergeAttributes(o.start);i.setSelection(null)}}function t5(n){return(e,t,i)=>{if(!i.consumable.test(t.item,e.name))return;const s=n(t.attributeOldValue,i,t),o=n(t.attributeNewValue,i,t);if(!s&&!o)return;i.consumable.consume(t.item,e.name);const r=i.writer,a=r.document.selection;if(t.item instanceof Oe||t.item instanceof Ye)r.wrap(a.getFirstRange(),o);else{let l=i.mapper.toViewRange(t.range);t.attributeOldValue!==null&&s&&(l=r.unwrap(l,s)),t.attributeNewValue!==null&&o&&r.wrap(l,o)}}}function i5(n,e=S5){return(t,i,s)=>{if(!e(i.item,s.consumable,{preflight:!0}))return;const o=n(i.item,s,i);if(!o)return;e(i.item,s.consumable);const r=s.mapper.toViewPosition(i.range.start);s.mapper.bindElements(i.item,o),s.writer.insert(r,o),s.convertAttributes(i.item),Mm(o,i.item.getChildren(),s,{reconversion:i.reconversion})}}function n5(n,e){return(t,i,s)=>{if(!e(i.item,s.consumable,{preflight:!0}))return;const o=new Map;s.writer._registerSlotFactory(k5(i.item,o,s));const r=n(i.item,s,i);if(s.writer._clearSlotFactory(),!r)return;E5(i.item,o,s),e(i.item,s.consumable);const a=s.mapper.toViewPosition(i.range.start);s.mapper.bindElements(i.item,r),s.writer.insert(a,r),s.convertAttributes(i.item),T5(r,o,s,{reconversion:i.reconversion})}}function s5(n){return(e,t,i)=>{t.isOpening=!0;const s=n(t,i);t.isOpening=!1;const o=n(t,i);if(!s||!o)return;const r=t.markerRange;if(r.isCollapsed&&!i.consumable.consume(r,e.name))return;for(const c of r)if(!i.consumable.consume(c.item,e.name))return;const a=i.mapper,l=i.writer;l.insert(a.toViewPosition(r.start),s),i.mapper.bindElementToMarker(s,t.markerName),r.isCollapsed||(l.insert(a.toViewPosition(r.end),o),i.mapper.bindElementToMarker(o,t.markerName)),e.stop()}}function o5(){return(n,e,t)=>{const i=t.mapper.markerNameToElements(e.markerName);if(i){for(const s of i)t.mapper.unbindElementFromMarkerName(s,e.markerName),t.writer.clear(t.writer.createRangeOn(s),s);t.writer.clearClonedElementsGroup(e.markerName),n.stop()}}}function r5(n){return(e,t,i)=>{const s=n(t.markerName,i);if(!s)return;const o=t.markerRange;i.consumable.consume(o,e.name)&&(Hc(o,!1,i,t,s),Hc(o,!0,i,t,s),e.stop())}}function Hc(n,e,t,i,s){const o=e?n.start:n.end,r=o.nodeAfter&&o.nodeAfter.is("element")?o.nodeAfter:null,a=o.nodeBefore&&o.nodeBefore.is("element")?o.nodeBefore:null;if(r||a){let c,u;e&&r||!e&&!a?(c=r,u=!0):(c=a,u=!1);const d=t.mapper.toViewElement(c);if(d){a5(d,e,u,t,i,s);return}}const l=t.mapper.toViewPosition(o);l5(l,e,t,i,s)}function a5(n,e,t,i,s,o){const r=`data-${o.group}-${e?"start":"end"}-${t?"before":"after"}`,a=n.hasAttribute(r)?n.getAttribute(r).split(","):[];a.unshift(o.name),i.writer.setAttribute(r,a.join(","),n),i.mapper.bindElementToMarker(n,s.markerName)}function l5(n,e,t,i,s){const o=`${s.group}-${e?"start":"end"}`,r=s.name?{name:s.name}:null,a=t.writer.createUIElement(o,r);t.writer.insert(n,a),t.mapper.bindElementToMarker(a,i.markerName)}function c5(n){return(e,t,i)=>{const s=n(t.markerName,i);if(!s)return;const o=i.mapper.markerNameToElements(t.markerName);if(!o)return;for(const a of o)i.mapper.unbindElementFromMarkerName(a,t.markerName),a.is("containerElement")?(r(`data-${s.group}-start-before`,a),r(`data-${s.group}-start-after`,a),r(`data-${s.group}-end-before`,a),r(`data-${s.group}-end-after`,a)):i.writer.clear(i.writer.createRangeOn(a),a);i.writer.clearClonedElementsGroup(t.markerName),e.stop();function r(a,l){if(l.hasAttribute(a)){const c=new Set(l.getAttribute(a).split(","));c.delete(s.name),c.size==0?i.writer.removeAttribute(a,l):i.writer.setAttribute(a,Array.from(c).join(","),l)}}}}function u5(n){return(e,t,i)=>{if(!i.consumable.test(t.item,e.name))return;const s=n(t.attributeOldValue,i,t),o=n(t.attributeNewValue,i,t);if(!s&&!o)return;i.consumable.consume(t.item,e.name);const r=i.mapper.toViewElement(t.item),a=i.writer;if(!r)throw new g("conversion-attribute-to-attribute-on-text",i.dispatcher,t);if(t.attributeOldValue!==null&&s)if(s.key=="class"){const l=typeof s.value=="string"?s.value.split(/\s+/):s.value;for(const c of l)a.removeClass(c,r)}else if(s.key=="style")if(typeof s.value=="string"){const l=new Rr(a.document.stylesProcessor);l.setTo(s.value);for(const[c]of l.getStylesEntries())a.removeStyle(c,r)}else{const l=Object.keys(s.value);for(const c of l)a.removeStyle(c,r)}else a.removeAttribute(s.key,r);if(t.attributeNewValue!==null&&o)if(o.key=="class"){const l=typeof o.value=="string"?o.value.split(/\s+/):o.value;for(const c of l)a.addClass(c,r)}else if(o.key=="style")if(typeof o.value=="string"){const l=new Rr(a.document.stylesProcessor);l.setTo(o.value);for(const[c,u]of l.getStylesEntries())a.setStyle(c,u,r)}else{const l=Object.keys(o.value);for(const c of l)a.setStyle(c,o.value[c],r)}else a.setAttribute(o.key,o.value,r)}}function d5(n){return(e,t,i)=>{if(!t.item||!(t.item instanceof Oe||t.item instanceof Ye)&&!t.item.is("$textProxy"))return;const s=ja(n,t,i);if(!s||!i.consumable.consume(t.item,e.name))return;const o=i.writer,r=Rm(o,s),a=o.document.selection;if(t.item instanceof Oe||t.item instanceof Ye)o.wrap(a.getFirstRange(),r);else{const l=i.mapper.toViewRange(t.range),c=o.wrap(l,r);for(const u of c.getItems())if(u.is("attributeElement")&&u.isSimilar(r)){i.mapper.bindElementToMarker(u,t.markerName);break}}}}function h5(n){return(e,t,i)=>{if(!t.item||!(t.item instanceof W))return;const s=ja(n,t,i);if(!s||!i.consumable.test(t.item,e.name))return;const o=i.mapper.toViewElement(t.item);if(o&&o.getCustomProperty("addHighlight")){i.consumable.consume(t.item,e.name);for(const a of b._createIn(t.item))i.consumable.consume(a.item,e.name);o.getCustomProperty("addHighlight")(o,s,i.writer),i.mapper.bindElementToMarker(o,t.markerName)}}}function f5(n){return(e,t,i)=>{if(t.markerRange.isCollapsed)return;const s=ja(n,t,i);if(!s)return;const o=Rm(i.writer,s),r=i.mapper.markerNameToElements(t.markerName);if(r){for(const a of r)i.mapper.unbindElementFromMarkerName(a,t.markerName),a.is("attributeElement")?i.writer.unwrap(i.writer.createRangeOn(a),o):a.getCustomProperty("removeHighlight")(a,s.id,i.writer);i.writer.clearClonedElementsGroup(t.markerName),e.stop()}}}function m5(n){const e=Vm(n.model),t=Vn(n.view,"container");return e.attributes.length&&(e.children=!0),i=>{i.on(`insert:${e.name}`,i5(t,Om(e)),{priority:n.converterPriority||"normal"}),(e.children||e.attributes.length)&&i.on("reduceChanges",Bm(e),{priority:"low"})}}function g5(n){const e=Vm(n.model),t=Vn(n.view,"container");return e.children=!0,i=>{if(i._conversionApi.schema.checkChild(e.name,"$text"))throw new g("conversion-element-to-structure-disallowed-text",i,{elementName:e.name});i.on(`insert:${e.name}`,n5(t,Om(e)),{priority:n.converterPriority||"normal"}),i.on("reduceChanges",Bm(e),{priority:"low"})}}function p5(n){n=Tt(n);let e=n.model;typeof e=="string"&&(e={key:e});let t=`attribute:${e.key}`;if(e.name&&(t+=":"+e.name),e.values)for(const s of e.values)n.view[s]=Vn(n.view[s],"attribute");else n.view=Vn(n.view,"attribute");const i=Lm(n);return s=>{s.on(t,t5(i),{priority:n.converterPriority||"normal"})}}function w5(n){n=Tt(n);let e=n.model;typeof e=="string"&&(e={key:e});let t=`attribute:${e.key}`;if(e.name&&(t+=":"+e.name),e.values)for(const s of e.values)n.view[s]=Uc(n.view[s]);else n.view=Uc(n.view);const i=Lm(n);return s=>{s.on(t,u5(i),{priority:n.converterPriority||"normal"})}}function b5(n){const e=Vn(n.view,"ui");return t=>{t.on(`addMarker:${n.model}`,s5(e),{priority:n.converterPriority||"normal"}),t.on(`removeMarker:${n.model}`,o5(),{priority:n.converterPriority||"normal"})}}function _5(n){n=Tt(n);const e=n.model;let t=n.view;return t||(t=i=>({group:e,name:i.substr(n.model.length+1)})),i=>{i.on(`addMarker:${e}`,r5(t),{priority:n.converterPriority||"normal"}),i.on(`removeMarker:${e}`,c5(t),{priority:n.converterPriority||"normal"})}}function v5(n){return e=>{e.on(`addMarker:${n.model}`,d5(n.view),{priority:n.converterPriority||"normal"}),e.on(`addMarker:${n.model}`,h5(n.view),{priority:n.converterPriority||"normal"}),e.on(`removeMarker:${n.model}`,f5(n.view),{priority:n.converterPriority||"normal"})}}function Vm(n){return typeof n=="string"&&(n={name:n}),{name:n.name,attributes:n.attributes?K(n.attributes):[],children:!!n.children}}function Vn(n,e){return typeof n=="function"?n:(t,i)=>y5(n,i,e)}function y5(n,e,t){typeof n=="string"&&(n={name:n});let i;const s=e.writer,o=Object.assign({},n.attributes);if(t=="container")i=s.createContainerElement(n.name,o);else if(t=="attribute"){const r={priority:n.priority||Kt.DEFAULT_PRIORITY};i=s.createAttributeElement(n.name,o,r)}else i=s.createUIElement(n.name,o);if(n.styles){const r=Object.keys(n.styles);for(const a of r)s.setStyle(a,n.styles[a],i)}if(n.classes){const r=n.classes;if(typeof r=="string")s.addClass(r,i);else for(const a of r)s.addClass(a,i)}return i}function Lm(n){return n.model.values?(e,t,i)=>{const s=n.view[e];return s?s(e,t,i):null}:n.view}function Uc(n){return typeof n=="string"?e=>({key:n,value:e}):typeof n=="object"?n.value?()=>n:e=>({key:n.key,value:e}):n}function ja(n,e,t){const i=typeof n=="function"?n(e,t):n;return i?(i.priority||(i.priority=10),i.id||(i.id=e.markerName),i):null}function C5(n){return(e,t)=>{if(!e.is("element",n.name))return!1;if(t.type=="attribute"){if(n.attributes.includes(t.attributeKey))return!0}else{/* istanbul ignore else: This is always true because otherwise it would not register a reducer callback. -- @preserve */if(n.children)return!0}return!1}}function Bm(n){const e=C5(n);return(t,i)=>{const s=[];i.reconvertedElements||(i.reconvertedElements=new Set);for(const o of i.changes){const r=o.type=="attribute"?o.range.start.nodeAfter:o.position.parent;if(!r||!e(r,o)){s.push(o);continue}if(!i.reconvertedElements.has(r)){i.reconvertedElements.add(r);const a=y._createBefore(r);let l=s.length;for(let c=s.length-1;c>=0;c--){const u=s[c],h=(u.type=="attribute"?u.range.start:u.position).compareWith(a);if(h=="before"||u.type=="remove"&&h=="same")break;l=c}s.splice(l,0,{type:"remove",name:r.name,position:a,length:1},{type:"reinsert",name:r.name,position:a,length:1})}}i.changes=s}}function Om(n){return(e,t,i={})=>{const s=["insert"];for(const o of n.attributes)e.hasAttribute(o)&&s.push(`attribute:${o}`);return s.every(o=>t.test(e,o))?(i.preflight||s.forEach(o=>t.consume(e,o)),!0):!1}}function k5(n,e,t){return(i,s)=>{const o=i.createContainerElement("$slot");let r=null;if(s==="children")r=Array.from(n.getChildren());else if(typeof s=="function")r=Array.from(n.getChildren()).filter(a=>s(a));else throw new g("conversion-slot-mode-unknown",t.dispatcher,{modeOrFilter:s});return e.set(o,r),o}}function E5(n,e,t){const i=Array.from(e.values()).flat(),s=new Set(i);if(s.size!=i.length)throw new g("conversion-slot-filter-overlap",t.dispatcher,{element:n});if(s.size!=n.childCount)throw new g("conversion-slot-filter-incomplete",t.dispatcher,{element:n})}function T5(n,e,t,i){t.mapper.on("modelToViewPosition",r,{priority:"highest"});let s=null,o=null;for([s,o]of e)Mm(n,o,t,i),t.writer.move(t.writer.createRangeIn(s),t.writer.createPositionBefore(s)),t.writer.remove(s);t.mapper.off("modelToViewPosition",r);function r(a,l){const c=l.modelPosition.nodeAfter,u=o.indexOf(c);u<0||(l.viewPosition=l.mapper.findPositionIn(s,u))}}function Mm(n,e,t,i){for(const s of e)A5(n.root,s,t,i)||t.convertItem(s)}function A5(n,e,t,i){const{writer:s,mapper:o}=t;if(!i.reconversion)return!1;const r=o.toViewElement(e);return!r||r.root==n||!t.canReuseView(r)?!1:(s.move(s.createRangeOn(r),o.toViewPosition(y._createBefore(e))),!0)}function S5(n,e,{preflight:t}={}){return t?e.test(n,"insert"):e.consume(n,"insert")}/**
|
|
458
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
459
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
460
|
+
*/function Fm(n){const{schema:e,document:t}=n.model;for(const i of t.getRoots())if(i.isEmpty&&!e.checkChild(i,"$text")&&e.checkChild(i,"paragraph"))return n.insertElement("paragraph",i),!0;return!1}function Dm(n,e,t){const i=t.createContext(n);return!(!t.checkChild(i,"paragraph")||!t.checkChild(i.push("paragraph"),e))}function Nm(n,e){const t=e.createElement("paragraph");return e.insert(t,n),e.createPositionAt(t,0)}/**
|
|
461
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
462
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
463
|
+
*/class x5 extends xm{elementToElement(e){return this.add($m(e))}elementToAttribute(e){return this.add(R5(e))}attributeToAttribute(e){return this.add(V5(e))}elementToMarker(e){return this.add(L5(e))}dataToMarker(e){return this.add(B5(e))}}function Wc(){return(n,e,t)=>{if(!e.modelRange&&t.consumable.consume(e.viewItem,{name:!0})){const{modelRange:i,modelCursor:s}=t.convertChildren(e.viewItem,e.modelCursor);e.modelRange=i,e.modelCursor=s}}}function I5(){return(n,e,{schema:t,consumable:i,writer:s})=>{let o=e.modelCursor;if(!i.test(e.viewItem))return;if(!t.checkChild(o,"$text")){if(!Dm(o,"$text",t)||e.viewItem.data.trim().length==0)return;const a=o.nodeBefore;o=Nm(o,s),a&&a.is("element","$marker")&&(s.move(s.createRangeOn(a),o),o=s.createPositionAfter(a))}i.consume(e.viewItem);const r=s.createText(e.viewItem.data);s.insert(r,o),e.modelRange=s.createRange(o,o.getShiftedBy(r.offsetSize)),e.modelCursor=e.modelRange.end}}function P5(n,e){return(t,i)=>{const s=i.newSelection,o=[];for(const a of s.getRanges())o.push(e.toModelRange(a));const r=n.createSelection(o,{backward:s.isBackward});r.isEqual(n.document.selection)||n.change(a=>{a.setSelection(r)})}}function $m(n){n=Tt(n);const e=Fr(n),t=Ga(n.view),i=t?`element:${t}`:"element";return s=>{s.on(i,e,{priority:n.converterPriority||"normal"})}}function R5(n){n=Tt(n),zm(n);const e=Hm(n,!1),t=Ga(n.view),i=t?`element:${t}`:"element";return s=>{s.on(i,e,{priority:n.converterPriority||"low"})}}function V5(n){n=Tt(n);let e=null;(typeof n.view=="string"||n.view.key)&&(e=F5(n)),zm(n,e);const t=Hm(n,!0);return i=>{i.on("element",t,{priority:n.converterPriority||"low"})}}function L5(n){const e=$5(n.model);return $m({...n,model:e})}function B5(n){n=Tt(n),n.model||(n.model=s=>s?n.view+":"+s:n.view);const e={view:n.view,model:n.model},t=Fr(qc(e,"start")),i=Fr(qc(e,"end"));return s=>{s.on(`element:${n.view}-start`,t,{priority:n.converterPriority||"normal"}),s.on(`element:${n.view}-end`,i,{priority:n.converterPriority||"normal"});const o=Me.low,r=Me.highest,a=Me.get(n.converterPriority)/r;s.on("element",O5(e),{priority:o+a})}}function O5(n){return(e,t,i)=>{const s=`data-${n.view}`;if(!i.consumable.test(t.viewItem,{attributes:s+"-end-after"})&&!i.consumable.test(t.viewItem,{attributes:s+"-start-after"})&&!i.consumable.test(t.viewItem,{attributes:s+"-end-before"})&&!i.consumable.test(t.viewItem,{attributes:s+"-start-before"}))return;t.modelRange||Object.assign(t,i.convertChildren(t.viewItem,t.modelCursor)),i.consumable.consume(t.viewItem,{attributes:s+"-end-after"})&&o(t.modelRange.end,t.viewItem.getAttribute(s+"-end-after").split(",")),i.consumable.consume(t.viewItem,{attributes:s+"-start-after"})&&o(t.modelRange.end,t.viewItem.getAttribute(s+"-start-after").split(",")),i.consumable.consume(t.viewItem,{attributes:s+"-end-before"})&&o(t.modelRange.start,t.viewItem.getAttribute(s+"-end-before").split(",")),i.consumable.consume(t.viewItem,{attributes:s+"-start-before"})&&o(t.modelRange.start,t.viewItem.getAttribute(s+"-start-before").split(","));function o(r,a){for(const l of a){const c=n.model(l,i),u=i.writer.createElement("$marker",{"data-name":c});i.writer.insert(u,r),t.modelCursor.isEqual(r)?t.modelCursor=t.modelCursor.getShiftedBy(1):t.modelCursor=t.modelCursor._getTransformedByInsertion(r,1),t.modelRange=t.modelRange._getTransformedByInsertion(r,1)[0]}}}}function Ga(n){return typeof n=="string"?n:typeof n=="object"&&typeof n.name=="string"?n.name:null}function Fr(n){const e=new ni(n.view);return(t,i,s)=>{const o=e.match(i.viewItem);if(!o)return;const r=o.match;if(r.name=!0,!s.consumable.test(i.viewItem,r))return;const a=M5(n.model,i.viewItem,s);a&&s.safeInsert(a,i.modelCursor)&&(s.consumable.consume(i.viewItem,r),s.convertChildren(i.viewItem,a),s.updateConversionResult(a,i))}}function M5(n,e,t){return n instanceof Function?n(e,t):t.writer.createElement(n)}function F5(n){typeof n.view=="string"&&(n.view={key:n.view});const e=n.view.key,t=typeof n.view.value>"u"?/[\s\S]*/:n.view.value;let i;return e=="class"||e=="style"?i={[e=="class"?"classes":"styles"]:t}:i={attributes:{[e]:t}},n.view.name&&(i.name=n.view.name),n.view=i,e}function zm(n,e=null){const t=e===null?!0:o=>o.getAttribute(e),i=typeof n.model!="object"?n.model:n.model.key,s=typeof n.model!="object"||typeof n.model.value>"u"?t:n.model.value;n.model={key:i,value:s}}function Hm(n,e){const t=new ni(n.view);return(i,s,o)=>{if(!s.modelRange&&e)return;const r=t.match(s.viewItem);if(!r||(D5(n.view,s.viewItem)?r.match.name=!0:delete r.match.name,!o.consumable.test(s.viewItem,r.match)))return;const a=n.model.key,l=typeof n.model.value=="function"?n.model.value(s.viewItem,o):n.model.value;if(l===null)return;s.modelRange||Object.assign(s,o.convertChildren(s.viewItem,s.modelCursor)),N5(s.modelRange,{key:a,value:l},e,o)&&(o.consumable.test(s.viewItem,{name:!0})&&(r.match.name=!0),o.consumable.consume(s.viewItem,r.match))}}function D5(n,e){const t=typeof n=="function"?n(e):n;return typeof t=="object"&&!Ga(t)?!1:!t.classes&&!t.attributes&&!t.styles}function N5(n,e,t,i){let s=!1;for(const o of Array.from(n.getItems({shallow:t})))i.schema.checkAttribute(o,e.key)&&(s=!0,!o.hasAttribute(e.key)&&i.writer.setAttribute(e.key,e.value,o));return s}function $5(n){return(e,t)=>{const i=typeof n=="string"?n:n(e,t);return t.writer.createElement("$marker",{"data-name":i})}}function qc(n,e){const t=(i,s)=>{const o=i.getAttribute("name"),r=n.model(o,s);return s.writer.createElement("$marker",{"data-name":r})};return{view:`${n.view}-${e}`,model:t}}/**
|
|
464
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
465
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
466
|
+
*/function z5(n){n.document.registerPostFixer(e=>H5(e,n))}function H5(n,e){const t=e.document.selection,i=e.schema,s=[];let o=!1;for(const r of t.getRanges()){const a=Um(r,i);a&&!a.isEqual(r)?(s.push(a),o=!0):s.push(r)}return o&&n.setSelection(j5(s),{backward:t.isBackward}),!1}function Um(n,e){return n.isCollapsed?U5(n,e):W5(n,e)}function U5(n,e){const t=n.start,i=e.getNearestSelectionRange(t);if(!i){const o=t.getAncestors().reverse().find(r=>e.isObject(r));return o?b._createOn(o):null}if(!i.isCollapsed)return i;const s=i.start;return t.isEqual(s)?null:new b(s)}function W5(n,e){const{start:t,end:i}=n,s=e.checkChild(t,"$text"),o=e.checkChild(i,"$text"),r=e.getLimitElement(t),a=e.getLimitElement(i);if(r===a){if(s&&o)return null;if(q5(t,i,e)){const d=t.nodeAfter&&e.isSelectable(t.nodeAfter)?null:e.getNearestSelectionRange(t,"forward"),f=i.nodeBefore&&e.isSelectable(i.nodeBefore)?null:e.getNearestSelectionRange(i,"backward"),m=d?d.start:t,p=f?f.end:i;return new b(m,p)}}const l=r&&!r.is("rootElement"),c=a&&!a.is("rootElement");if(l||c){const u=t.nodeAfter&&i.nodeBefore&&t.nodeAfter.parent===i.nodeBefore.parent,d=l&&(!u||!Gc(t.nodeAfter,e)),h=c&&(!u||!Gc(i.nodeBefore,e));let f=t,m=i;return d&&(f=y._createBefore(jc(r,e))),h&&(m=y._createAfter(jc(a,e))),new b(f,m)}return null}function jc(n,e){let t=n,i=t;for(;e.isLimit(i)&&i.parent;)t=i,i=i.parent;return t}function q5(n,e,t){const i=n.nodeAfter&&!t.isLimit(n.nodeAfter)||t.checkChild(n,"$text"),s=e.nodeBefore&&!t.isLimit(e.nodeBefore)||t.checkChild(e,"$text");return i||s}function j5(n){const e=[...n],t=new Set;let i=1;for(;i<e.length;){const o=e[i],r=e.slice(0,i);for(const[a,l]of r.entries())if(!t.has(a)){if(o.isEqual(l))t.add(a);else if(o.isIntersecting(l)){t.add(a),t.add(i);const c=o.getJoined(l);e.push(c)}}i++}return e.filter((o,r)=>!t.has(r))}function Gc(n,e){return n&&e.isSelectable(n)}/**
|
|
467
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
468
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
469
|
+
*/class G5 extends U(){constructor(e,t){super(),this.model=e,this.view=new Ok(t),this.mapper=new Tm,this.downcastDispatcher=new Am({mapper:this.mapper,schema:e.schema});const i=this.model.document,s=i.selection,o=this.model.markers;this.listenTo(this.model,"_beforeChanges",()=>{this.view._disableRendering(!0)},{priority:"highest"}),this.listenTo(this.model,"_afterChanges",()=>{this.view._disableRendering(!1)},{priority:"lowest"}),this.listenTo(i,"change",()=>{this.view.change(r=>{this.downcastDispatcher.convertChanges(i.differ,o,r),this.downcastDispatcher.convertSelection(s,o,r)})},{priority:"low"}),this.listenTo(this.view.document,"selectionChange",P5(this.model,this.mapper)),this.listenTo(this.view.document,"beforeinput",K5(this.mapper,this.model.schema,this.view),{priority:"high"}),this.downcastDispatcher.on("insert:$text",Im(),{priority:"lowest"}),this.downcastDispatcher.on("insert",Pm(),{priority:"lowest"}),this.downcastDispatcher.on("remove",Yk(),{priority:"low"}),this.downcastDispatcher.on("cleanSelection",e5()),this.downcastDispatcher.on("selection",Qk(),{priority:"low"}),this.downcastDispatcher.on("selection",Xk(),{priority:"low"}),this.view.document.roots.bindTo(this.model.document.roots).using(r=>{if(r.rootName=="$graveyard")return null;const a=new cm(this.view.document,r.name);return a.rootName=r.rootName,this.mapper.bindElements(r,a),a})}destroy(){this.view.destroy(),this.stopListening()}reconvertMarker(e){const t=typeof e=="string"?e:e.name,i=this.model.markers.get(t);if(!i)throw new g("editingcontroller-reconvertmarker-marker-not-exist",this,{markerName:t});this.model.change(()=>{this.model.markers._refresh(i)})}reconvertItem(e){this.model.change(()=>{this.model.document.differ._refreshItem(e)})}}function K5(n,e,t){return(i,s)=>{if(!(t.document.isComposing&&!L.isAndroid))for(let o=0;o<s.targetRanges.length;o++){const r=s.targetRanges[o],a=n.toModelRange(r),l=Um(a,e);!l||l.isEqual(a)||(s.targetRanges[o]=n.toViewRange(l))}}}/**
|
|
470
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
471
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
472
|
+
*/class _n{constructor(){this._consumables=new Map}add(e,t){let i;if(e.is("$text")||e.is("documentFragment")){this._consumables.set(e,!0);return}this._consumables.has(e)?i=this._consumables.get(e):(i=new Z5(e),this._consumables.set(e,i)),i.add(t)}test(e,t){const i=this._consumables.get(e);return i===void 0?null:e.is("$text")||e.is("documentFragment")?i:i.test(t)}consume(e,t){return this.test(e,t)?(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!1):this._consumables.get(e).consume(t),!0):!1}revert(e,t){const i=this._consumables.get(e);i!==void 0&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):i.revert(t))}static consumablesFromElement(e){const t={element:e,name:!0,attributes:[],classes:[],styles:[]},i=e.getAttributeKeys();for(const r of i)r=="style"||r=="class"||t.attributes.push(r);const s=e.getClassNames();for(const r of s)t.classes.push(r);const o=e.getStyleNames();for(const r of o)t.styles.push(r);return t}static createFrom(e,t){if(t||(t=new _n),e.is("$text"))return t.add(e),t;e.is("element")&&t.add(e,_n.consumablesFromElement(e)),e.is("documentFragment")&&t.add(e);for(const i of e.getChildren())t=_n.createFrom(i,t);return t}}const ds=["attributes","classes","styles"];class Z5{constructor(e){this.element=e,this._canConsumeName=null,this._consumables={attributes:new Map,styles:new Map,classes:new Map}}add(e){e.name&&(this._canConsumeName=!0);for(const t of ds)t in e&&this._add(t,e[t])}test(e){if(e.name&&!this._canConsumeName)return this._canConsumeName;for(const t of ds)if(t in e){const i=this._test(t,e[t]);if(i!==!0)return i}return!0}consume(e){e.name&&(this._canConsumeName=!1);for(const t of ds)t in e&&this._consume(t,e[t])}revert(e){e.name&&(this._canConsumeName=!0);for(const t of ds)t in e&&this._revert(t,e[t])}_add(e,t){const i=Ee(t)?t:[t],s=this._consumables[e];for(const o of i){if(e==="attributes"&&(o==="class"||o==="style"))throw new g("viewconsumable-invalid-attribute",this);if(s.set(o,!0),e==="styles")for(const r of this.element.document.stylesProcessor.getRelatedStyles(o))s.set(r,!0)}}_test(e,t){const i=Ee(t)?t:[t],s=this._consumables[e];for(const o of i)if(e==="attributes"&&(o==="class"||o==="style")){const r=o=="class"?"classes":"styles",a=this._test(r,[...this._consumables[r].keys()]);if(a!==!0)return a}else{const r=s.get(o);if(r===void 0)return null;if(!r)return!1}return!0}_consume(e,t){const i=Ee(t)?t:[t],s=this._consumables[e];for(const o of i)if(e==="attributes"&&(o==="class"||o==="style")){const r=o=="class"?"classes":"styles";this._consume(r,[...this._consumables[r].keys()])}else if(s.set(o,!1),e=="styles")for(const r of this.element.document.stylesProcessor.getRelatedStyles(o))s.set(r,!1)}_revert(e,t){const i=Ee(t)?t:[t],s=this._consumables[e];for(const o of i)if(e==="attributes"&&(o==="class"||o==="style")){const r=o=="class"?"classes":"styles";this._revert(r,[...this._consumables[r].keys()])}else s.get(o)===!1&&s.set(o,!0)}}/**
|
|
473
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
474
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
475
|
+
*/class J5 extends U(){constructor(){super(),this._sourceDefinitions={},this._attributeProperties={},this.decorate("checkChild"),this.decorate("checkAttribute"),this.on("checkAttribute",(e,t)=>{t[0]=new Jt(t[0])},{priority:"highest"}),this.on("checkChild",(e,t)=>{t[0]=new Jt(t[0]),t[1]=this.getDefinition(t[1])},{priority:"highest"})}register(e,t){if(this._sourceDefinitions[e])throw new g("schema-cannot-register-item-twice",this,{itemName:e});this._sourceDefinitions[e]=[Object.assign({},t)],this._clearCache()}extend(e,t){if(!this._sourceDefinitions[e])throw new g("schema-cannot-extend-missing-item",this,{itemName:e});this._sourceDefinitions[e].push(Object.assign({},t)),this._clearCache()}getDefinitions(){return this._compiledDefinitions||this._compile(),this._compiledDefinitions}getDefinition(e){let t;return typeof e=="string"?t=e:"is"in e&&(e.is("$text")||e.is("$textProxy"))?t="$text":t=e.name,this.getDefinitions()[t]}isRegistered(e){return!!this.getDefinition(e)}isBlock(e){const t=this.getDefinition(e);return!!(t&&t.isBlock)}isLimit(e){const t=this.getDefinition(e);return t?!!(t.isLimit||t.isObject):!1}isObject(e){const t=this.getDefinition(e);return t?!!(t.isObject||t.isLimit&&t.isSelectable&&t.isContent):!1}isInline(e){const t=this.getDefinition(e);return!!(t&&t.isInline)}isSelectable(e){const t=this.getDefinition(e);return t?!!(t.isSelectable||t.isObject):!1}isContent(e){const t=this.getDefinition(e);return t?!!(t.isContent||t.isObject):!1}checkChild(e,t){return t?this._checkContextMatch(t,e):!1}checkAttribute(e,t){const i=this.getDefinition(e.last);return i?i.allowAttributes.includes(t):!1}checkMerge(e,t){if(e instanceof y){const i=e.nodeBefore,s=e.nodeAfter;if(!(i instanceof W))throw new g("schema-check-merge-no-element-before",this);if(!(s instanceof W))throw new g("schema-check-merge-no-element-after",this);return this.checkMerge(i,s)}for(const i of t.getChildren())if(!this.checkChild(e,i))return!1;return!0}addChildCheck(e){this.on("checkChild",(t,[i,s])=>{if(!s)return;const o=e(i,s);typeof o=="boolean"&&(t.stop(),t.return=o)},{priority:"high"})}addAttributeCheck(e){this.on("checkAttribute",(t,[i,s])=>{const o=e(i,s);typeof o=="boolean"&&(t.stop(),t.return=o)},{priority:"high"})}setAttributeProperties(e,t){this._attributeProperties[e]=Object.assign(this.getAttributeProperties(e),t)}getAttributeProperties(e){return this._attributeProperties[e]||{}}getLimitElement(e){let t;for(e instanceof y?t=e.parent:t=(e instanceof b?[e]:Array.from(e.getRanges())).reduce((s,o)=>{const r=o.getCommonAncestor();return s?s.getCommonAncestor(r,{includeSelf:!0}):r},null);!this.isLimit(t)&&t.parent;)t=t.parent;return t}checkAttributeInSelection(e,t){if(e.isCollapsed){const s=[...e.getFirstPosition().getAncestors(),new j("",e.getAttributes())];return this.checkAttribute(s,t)}else{const i=e.getRanges();for(const s of i)for(const o of s)if(this.checkAttribute(o.item,t))return!0}return!1}*getValidRanges(e,t){e=hE(e);for(const i of e)yield*this._getValidRangesForRange(i,t)}getNearestSelectionRange(e,t="both"){if(e.root.rootName=="$graveyard")return null;if(this.checkChild(e,"$text"))return new b(e);let i,s;const o=e.getAncestors().reverse().find(r=>this.isLimit(r))||e.root;(t=="both"||t=="backward")&&(i=new pt({boundaries:b._createIn(o),startPosition:e,direction:"backward"})),(t=="both"||t=="forward")&&(s=new pt({boundaries:b._createIn(o),startPosition:e}));for(const r of dE(i,s)){const a=r.walker==i?"elementEnd":"elementStart",l=r.value;if(l.type==a&&this.isObject(l.item))return b._createOn(l.item);if(this.checkChild(l.nextPosition,"$text"))return new b(l.nextPosition)}return null}findAllowedParent(e,t){let i=e.parent;for(;i;){if(this.checkChild(i,t))return i;if(this.isLimit(i))return null;i=i.parent}return null}setAllowedAttributes(e,t,i){const s=i.model;for(const[o,r]of Object.entries(t))s.schema.checkAttribute(e,o)&&i.setAttribute(o,r,e)}removeDisallowedAttributes(e,t){for(const i of e)if(i.is("$text"))Kc(this,i,t);else{const o=b._createIn(i).getPositions();for(const r of o){const a=r.nodeBefore||r.parent;Kc(this,a,t)}}}getAttributesWithProperty(e,t,i){const s={};for(const[o,r]of e.getAttributes()){const a=this.getAttributeProperties(o);a[t]!==void 0&&(i===void 0||i===a[t])&&(s[o]=r)}return s}createContext(e){return new Jt(e)}_clearCache(){this._compiledDefinitions=null}_compile(){const e={},t=this._sourceDefinitions,i=Object.keys(t);for(const s of i)e[s]=Y5(t[s],s);for(const s of i)Q5(e,s);for(const s of i)X5(e,s);for(const s of i)eE(e,s);for(const s of i)tE(e,s),iE(e,s);for(const s of i)nE(e,s),sE(e,s),oE(e,s);this._compiledDefinitions=e}_checkContextMatch(e,t,i=t.length-1){const s=t.getItem(i);if(e.allowIn.includes(s.name)){if(i==0)return!0;{const o=this.getDefinition(s);return this._checkContextMatch(o,t,i-1)}}else return!1}*_getValidRangesForRange(e,t){let i=e.start,s=e.start;for(const o of e.getItems({shallow:!0}))o.is("element")&&(yield*this._getValidRangesForRange(b._createIn(o),t)),this.checkAttribute(o,t)||(i.isEqual(s)||(yield new b(i,s)),i=y._createAfter(o)),s=y._createAfter(o);i.isEqual(s)||(yield new b(i,s))}findOptimalInsertionRange(e,t){const i=e.getSelectedElement();if(i&&this.isObject(i)&&!this.isInline(i))return t=="before"||t=="after"?new b(y._createAt(i,t)):b._createOn(i);const s=J(e.getSelectedBlocks());if(!s)return new b(e.focus);if(s.isEmpty)return new b(y._createAt(s,0));const o=y._createAfter(s);return e.focus.isTouching(o)?new b(o):new b(y._createBefore(s))}}class Jt{constructor(e){if(e instanceof Jt)return e;let t;typeof e=="string"?t=[e]:Array.isArray(e)?t=e:t=e.getAncestors({includeSelf:!0}),this._items=t.map(uE)}get length(){return this._items.length}get last(){return this._items[this._items.length-1]}[Symbol.iterator](){return this._items[Symbol.iterator]()}push(e){const t=new Jt([e]);return t._items=[...this._items,...t._items],t}getItem(e){return this._items[e]}*getNames(){yield*this._items.map(e=>e.name)}endsWith(e){return Array.from(this.getNames()).join(" ").endsWith(e)}startsWith(e){return Array.from(this.getNames()).join(" ").startsWith(e)}}function Y5(n,e){const t={name:e,allowIn:[],allowContentOf:[],allowWhere:[],allowAttributes:[],allowAttributesOf:[],allowChildren:[],inheritTypesFrom:[]};return rE(n,t),Dt(n,t,"allowIn"),Dt(n,t,"allowContentOf"),Dt(n,t,"allowWhere"),Dt(n,t,"allowAttributes"),Dt(n,t,"allowAttributesOf"),Dt(n,t,"allowChildren"),Dt(n,t,"inheritTypesFrom"),aE(n,t),t}function Q5(n,e){const t=n[e];for(const i of t.allowChildren){const s=n[i];s&&s.allowIn.push(e)}t.allowChildren.length=0}function X5(n,e){for(const t of n[e].allowContentOf)n[t]&&lE(n,t).forEach(s=>{s.allowIn.push(e)});delete n[e].allowContentOf}function eE(n,e){for(const t of n[e].allowWhere){const i=n[t];if(i){const s=i.allowIn;n[e].allowIn.push(...s)}}delete n[e].allowWhere}function tE(n,e){for(const t of n[e].allowAttributesOf){const i=n[t];if(i){const s=i.allowAttributes;n[e].allowAttributes.push(...s)}}delete n[e].allowAttributesOf}function iE(n,e){const t=n[e];for(const i of t.inheritTypesFrom){const s=n[i];if(s){const o=Object.keys(s).filter(r=>r.startsWith("is"));for(const r of o)r in t||(t[r]=s[r])}}delete t.inheritTypesFrom}function nE(n,e){const t=n[e],i=t.allowIn.filter(s=>n[s]);t.allowIn=Array.from(new Set(i))}function sE(n,e){const t=n[e];for(const i of t.allowIn)n[i].allowChildren.push(e)}function oE(n,e){const t=n[e];t.allowAttributes=Array.from(new Set(t.allowAttributes))}function rE(n,e){for(const t of n){const i=Object.keys(t).filter(s=>s.startsWith("is"));for(const s of i)e[s]=!!t[s]}}function Dt(n,e,t){for(const i of n){const s=i[t];typeof s=="string"?e[t].push(s):Array.isArray(s)&&e[t].push(...s)}}function aE(n,e){for(const t of n){const i=t.inheritAllFrom;i&&(e.allowContentOf.push(i),e.allowWhere.push(i),e.allowAttributesOf.push(i),e.inheritTypesFrom.push(i))}}function lE(n,e){const t=n[e];return cE(n).filter(i=>i.allowIn.includes(t.name))}function cE(n){return Object.keys(n).map(e=>n[e])}function uE(n){return typeof n=="string"||n.is("documentFragment")?{name:typeof n=="string"?n:"$documentFragment",*getAttributeKeys(){},getAttribute(){}}:{name:n.is("element")?n.name:"$text",*getAttributeKeys(){yield*n.getAttributeKeys()},getAttribute(e){return n.getAttribute(e)}}}function*dE(n,e){let t=!1;for(;!t;){if(t=!0,n){const i=n.next();i.done||(t=!1,yield{walker:n,value:i.value})}if(e){const i=e.next();i.done||(t=!1,yield{walker:e,value:i.value})}}}function*hE(n){for(const e of n)yield*e.getMinimalFlatRanges()}function Kc(n,e,t){for(const i of e.getAttributeKeys())n.checkAttribute(e,i)||t.removeAttribute(i,e)}/**
|
|
476
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
477
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
478
|
+
*/class fE extends Z(){constructor(e){super(),this._splitParts=new Map,this._cursorParents=new Map,this._modelCursor=null,this._emptyElementsToKeep=new Set,this.conversionApi={...e,consumable:null,writer:null,store:null,convertItem:(t,i)=>this._convertItem(t,i),convertChildren:(t,i)=>this._convertChildren(t,i),safeInsert:(t,i)=>this._safeInsert(t,i),updateConversionResult:(t,i)=>this._updateConversionResult(t,i),splitToAllowedParent:(t,i)=>this._splitToAllowedParent(t,i),getSplitParts:t=>this._getSplitParts(t),keepEmptyElement:t=>this._keepEmptyElement(t)}}convert(e,t,i=["$root"]){this.fire("viewCleanup",e),this._modelCursor=gE(i,t),this.conversionApi.writer=t,this.conversionApi.consumable=_n.createFrom(e),this.conversionApi.store={};const{modelRange:s}=this._convertItem(e,this._modelCursor),o=t.createDocumentFragment();if(s){this._removeEmptyElements();for(const r of Array.from(this._modelCursor.parent.getChildren()))t.append(r,o);o.markers=mE(o,t)}return this._modelCursor=null,this._splitParts.clear(),this._cursorParents.clear(),this._emptyElementsToKeep.clear(),this.conversionApi.writer=null,this.conversionApi.store=null,o}_convertItem(e,t){const i={viewItem:e,modelCursor:t,modelRange:null};if(e.is("element")?this.fire(`element:${e.name}`,i,this.conversionApi):e.is("$text")?this.fire("text",i,this.conversionApi):this.fire("documentFragment",i,this.conversionApi),i.modelRange&&!(i.modelRange instanceof b))throw new g("view-conversion-dispatcher-incorrect-result",this);return{modelRange:i.modelRange,modelCursor:i.modelCursor}}_convertChildren(e,t){let i=t.is("position")?t:y._createAt(t,0);const s=new b(i);for(const o of Array.from(e.getChildren())){const r=this._convertItem(o,i);r.modelRange instanceof b&&(s.end=r.modelRange.end,i=r.modelCursor)}return{modelRange:s,modelCursor:i}}_safeInsert(e,t){const i=this._splitToAllowedParent(e,t);return i?(this.conversionApi.writer.insert(e,i.position),!0):!1}_updateConversionResult(e,t){const i=this._getSplitParts(e),s=this.conversionApi.writer;t.modelRange||(t.modelRange=s.createRange(s.createPositionBefore(e),s.createPositionAfter(i[i.length-1])));const o=this._cursorParents.get(e);o?t.modelCursor=s.createPositionAt(o,0):t.modelCursor=t.modelRange.end}_splitToAllowedParent(e,t){const{schema:i,writer:s}=this.conversionApi;let o=i.findAllowedParent(t,e);if(o){if(o===t.parent)return{position:t};this._modelCursor.parent.getAncestors().includes(o)&&(o=null)}if(!o)return Dm(t,e,i)?{position:Nm(t,s)}:null;const r=this.conversionApi.writer.split(t,o),a=[];for(const c of r.range.getWalker())if(c.type=="elementEnd")a.push(c.item);else{const u=a.pop(),d=c.item;this._registerSplitPair(u,d)}const l=r.range.end.parent;return this._cursorParents.set(e,l),{position:r.position,cursorParent:l}}_registerSplitPair(e,t){this._splitParts.has(e)||this._splitParts.set(e,[e]);const i=this._splitParts.get(e);this._splitParts.set(t,i),i.push(t)}_getSplitParts(e){let t;return this._splitParts.has(e)?t=this._splitParts.get(e):t=[e],t}_keepEmptyElement(e){this._emptyElementsToKeep.add(e)}_removeEmptyElements(){let e=!1;for(const t of this._splitParts.keys())t.isEmpty&&!this._emptyElementsToKeep.has(t)&&(this.conversionApi.writer.remove(t),this._splitParts.delete(t),e=!0);e&&this._removeEmptyElements()}}function mE(n,e){const t=new Set,i=new Map,s=b._createIn(n).getItems();for(const o of s)o.is("element","$marker")&&t.add(o);for(const o of t){const r=o.getAttribute("data-name"),a=e.createPositionBefore(o);i.has(r)?i.get(r).end=a.clone():i.set(r,new b(a.clone())),e.remove(o)}return i}function gE(n,e){let t;for(const i of new Jt(n)){const s={};for(const r of i.getAttributeKeys())s[r]=i.getAttribute(r);const o=e.createElement(i.name,s);t&&e.insert(o,t),t=y._createAt(o,0)}return t}/**
|
|
479
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
480
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
481
|
+
*/class pE{getHtml(e){const i=E.document.implementation.createHTMLDocument("").createElement("div");return i.appendChild(e),i.innerHTML}}/**
|
|
482
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
483
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
484
|
+
*/class wE{constructor(e){this.skipComments=!0,this.domParser=new DOMParser,this.domConverter=new _m(e,{renderingMode:"data"}),this.htmlWriter=new pE}toData(e){const t=this.domConverter.viewToDom(e);return this.htmlWriter.getHtml(t)}toView(e){const t=this._toDom(e);return this.domConverter.domToView(t,{skipComments:this.skipComments})}registerRawContentMatcher(e){this.domConverter.registerRawContentMatcher(e)}useFillerType(e){this.domConverter.blockFillerMode=e=="marked"?"markedNbsp":"nbsp"}_toDom(e){e.match(/<(?:html|body|head|meta)(?:\s[^>]*)?>/i)||(e=`<body>${e}</body>`);const t=this.domParser.parseFromString(e,"text/html"),i=t.createDocumentFragment(),s=t.body.childNodes;for(;s.length>0;)i.appendChild(s[0]);return i}}/**
|
|
485
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
486
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
487
|
+
*/class bE extends Z(){constructor(e,t){super(),this.model=e,this.mapper=new Tm,this.downcastDispatcher=new Am({mapper:this.mapper,schema:e.schema}),this.downcastDispatcher.on("insert:$text",Im(),{priority:"lowest"}),this.downcastDispatcher.on("insert",Pm(),{priority:"lowest"}),this.upcastDispatcher=new fE({schema:e.schema}),this.viewDocument=new hm(t),this.stylesProcessor=t,this.htmlProcessor=new wE(this.viewDocument),this.processor=this.htmlProcessor,this._viewWriter=new mm(this.viewDocument),this.upcastDispatcher.on("text",I5(),{priority:"lowest"}),this.upcastDispatcher.on("element",Wc(),{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",Wc(),{priority:"lowest"}),U().prototype.decorate.call(this,"init"),U().prototype.decorate.call(this,"set"),U().prototype.decorate.call(this,"get"),U().prototype.decorate.call(this,"toView"),U().prototype.decorate.call(this,"toModel"),this.on("init",()=>{this.fire("ready")},{priority:"lowest"}),this.on("ready",()=>{this.model.enqueueChange({isUndoable:!1},Fm)},{priority:"lowest"})}get(e={}){const{rootName:t="main",trim:i="empty"}=e;if(!this._checkIfRootsExists([t]))throw new g("datacontroller-get-non-existent-root",this);const s=this.model.document.getRoot(t);return s.isAttached()||H("datacontroller-get-detached-root",this),i==="empty"&&!this.model.hasContent(s,{ignoreWhitespaces:!0})?"":this.stringify(s,e)}stringify(e,t={}){const i=this.toView(e,t);return this.processor.toData(i)}toView(e,t={}){const i=this.viewDocument,s=this._viewWriter;this.mapper.clearBindings();const o=b._createIn(e),r=new Zt(i);this.mapper.bindElements(e,r);const a=e.is("documentFragment")?e.markers:_E(e);return this.downcastDispatcher.convert(o,a,s,t),r}init(e){if(this.model.document.version)throw new g("datacontroller-init-document-not-empty",this);let t={};if(typeof e=="string"?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new g("datacontroller-init-non-existent-root",this);return this.model.enqueueChange({isUndoable:!1},i=>{for(const s of Object.keys(t)){const o=this.model.document.getRoot(s);i.insert(this.parse(t[s],o),o,0)}}),Promise.resolve()}set(e,t={}){let i={};if(typeof e=="string"?i.main=e:i=e,!this._checkIfRootsExists(Object.keys(i)))throw new g("datacontroller-set-non-existent-root",this);this.model.enqueueChange(t.batchType||{},s=>{s.setSelection(null),s.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());for(const o of Object.keys(i)){const r=this.model.document.getRoot(o);s.remove(s.createRangeIn(r)),s.insert(this.parse(i[o],r),r,0)}})}parse(e,t="$root"){const i=this.processor.toView(e);return this.toModel(i,t)}toModel(e,t="$root"){return this.model.change(i=>this.upcastDispatcher.convert(e,i,t))}addStyleProcessorRules(e){e(this.stylesProcessor)}registerRawContentMatcher(e){this.processor&&this.processor!==this.htmlProcessor&&this.processor.registerRawContentMatcher(e),this.htmlProcessor.registerRawContentMatcher(e)}destroy(){this.stopListening()}_checkIfRootsExists(e){for(const t of e)if(!this.model.document.getRoot(t))return!1;return!0}}function _E(n){const e=[],t=n.root.document;if(!t)return new Map;const i=b._createIn(n);for(const s of t.model.markers){const o=s.getRange(),r=o.isCollapsed,a=o.start.isEqual(i.start)||o.end.isEqual(i.end);if(r&&a)e.push([s.name,o]);else{const l=i.getIntersection(o);l&&e.push([s.name,l])}}return e.sort(([s,o],[r,a])=>{if(o.end.compareWith(a.start)!=="after")return 1;if(o.start.compareWith(a.end)!=="before")return-1;switch(o.start.compareWith(a.start)){case"before":return 1;case"after":return-1;default:switch(o.end.compareWith(a.end)){case"before":return 1;case"after":return-1;default:return r.localeCompare(s)}}}),new Map(e)}/**
|
|
488
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
489
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
490
|
+
*/class vE{constructor(e,t){this._helpers=new Map,this._downcast=K(e),this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=K(t),this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:!1})}addAlias(e,t){const i=this._downcast.includes(t);if(!this._upcast.includes(t)&&!i)throw new g("conversion-add-alias-dispatcher-not-registered",this);this._createConversionHelpers({name:e,dispatchers:[t],isDowncast:i})}for(e){if(!this._helpers.has(e))throw new g("conversion-for-unknown-group",this);return this._helpers.get(e)}elementToElement(e){this.for("downcast").elementToElement(e);for(const{model:t,view:i}of Do(e))this.for("upcast").elementToElement({model:t,view:i,converterPriority:e.converterPriority})}attributeToElement(e){this.for("downcast").attributeToElement(e);for(const{model:t,view:i}of Do(e))this.for("upcast").elementToAttribute({view:i,model:t,converterPriority:e.converterPriority})}attributeToAttribute(e){this.for("downcast").attributeToAttribute(e);for(const{model:t,view:i}of Do(e))this.for("upcast").attributeToAttribute({view:i,model:t})}_createConversionHelpers({name:e,dispatchers:t,isDowncast:i}){if(this._helpers.has(e))throw new g("conversion-group-exists",this);const s=i?new Jk(t):new x5(t);this._helpers.set(e,s)}}function*Do(n){if(n.model.values)for(const e of n.model.values){const t={key:n.model.key,value:e},i=n.view[e],s=n.upcastAlso?n.upcastAlso[e]:void 0;yield*Zc(t,i,s)}else yield*Zc(n.model,n.view,n.upcastAlso)}function*Zc(n,e,t){if(yield{model:n,view:e},t)for(const i of K(t))yield{model:n,view:i}}/**
|
|
491
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
492
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
493
|
+
*/class Ne{constructor(e){this.baseVersion=e,this.isDocumentOperation=this.baseVersion!==null,this.batch=null}_validate(){}toJSON(){const e=Object.assign({},this);return e.__className=this.constructor.className,delete e.batch,delete e.isDocumentOperation,e}static get className(){return"Operation"}static fromJSON(e,t){return new this(e.baseVersion)}}/**
|
|
494
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
495
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
496
|
+
*/function Ka(n,e){const t=qm(e),i=t.reduce((r,a)=>r+a.offsetSize,0),s=n.parent;On(n);const o=n.index;return s._insertChild(o,t),Bn(s,o+t.length),Bn(s,o),new b(n,n.getShiftedBy(i))}function Wm(n){if(!n.isFlat)throw new g("operation-utils-remove-range-not-flat",this);const e=n.start.parent;On(n.start),On(n.end);const t=e._removeChildren(n.start.index,n.end.index-n.start.index);return Bn(e,n.start.index),t}function Ln(n,e){if(!n.isFlat)throw new g("operation-utils-move-range-not-flat",this);const t=Wm(n);return e=e._getTransformedByDeletion(n.start,n.end.offset-n.start.offset),Ka(e,t)}function yE(n,e,t){On(n.start),On(n.end);for(const i of n.getItems({shallow:!0})){const s=i.is("$textProxy")?i.textNode:i;t!==null?s._setAttribute(e,t):s._removeAttribute(e),Bn(s.parent,s.index)}Bn(n.end.parent,n.end.index)}function qm(n){const e=[];function t(i){if(typeof i=="string")e.push(new j(i));else if(i instanceof Ke)e.push(new j(i.data,i.getAttributes()));else if(i instanceof ui)e.push(i);else if(De(i))for(const s of i)t(s)}t(n);for(let i=1;i<e.length;i++){const s=e[i],o=e[i-1];s instanceof j&&o instanceof j&&jm(s,o)&&(e.splice(i-1,2,new j(o.data+s.data,o.getAttributes())),i--)}return e}function Bn(n,e){const t=n.getChild(e-1),i=n.getChild(e);if(t&&i&&t.is("$text")&&i.is("$text")&&jm(t,i)){const s=new j(t.data+i.data,t.getAttributes());n._removeChildren(e-1,2),n._insertChild(e-1,s)}}function On(n){const e=n.textNode,t=n.parent;if(e){const i=n.offset-e.startOffset,s=e.index;t._removeChildren(s,1);const o=new j(e.data.substr(0,i),e.getAttributes()),r=new j(e.data.substr(i),e.getAttributes());t._insertChild(s,[o,r])}}function jm(n,e){const t=n.getAttributes(),i=e.getAttributes();for(const s of t){if(s[1]!==e.getAttribute(s[0]))return!1;i.next()}return i.next().done}/**
|
|
497
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
498
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
499
|
+
*/class z extends Ne{constructor(e,t,i,s){super(s),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toNext",this.howMany=t,this.targetPosition=i.clone(),this.targetPosition.stickiness="toNone"}get type(){return this.targetPosition.root.rootName=="$graveyard"?"remove":this.sourcePosition.root.rootName=="$graveyard"?"reinsert":"move"}get affectedSelectable(){return[b._createFromPositionAndShift(this.sourcePosition,this.howMany),b._createFromPositionAndShift(this.targetPosition,0)]}clone(){return new z(this.sourcePosition,this.howMany,this.targetPosition,this.baseVersion)}getMovedRangeStart(){return this.targetPosition._getTransformedByDeletion(this.sourcePosition,this.howMany)}getReversed(){const e=this.sourcePosition._getTransformedByInsertion(this.targetPosition,this.howMany);return new z(this.getMovedRangeStart(),this.howMany,e,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent,i=this.sourcePosition.offset,s=this.targetPosition.offset;if(i+this.howMany>e.maxOffset)throw new g("move-operation-nodes-do-not-exist",this);if(e===t&&i<s&&s<i+this.howMany)throw new g("move-operation-range-into-itself",this);if(this.sourcePosition.root==this.targetPosition.root&&ye(this.sourcePosition.getParentPath(),this.targetPosition.getParentPath())=="prefix"){const o=this.sourcePosition.path.length-1;if(this.targetPosition.path[o]>=i&&this.targetPosition.path[o]<i+this.howMany)throw new g("move-operation-node-into-itself",this)}}_execute(){Ln(b._createFromPositionAndShift(this.sourcePosition,this.howMany),this.targetPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e.targetPosition=this.targetPosition.toJSON(),e}static get className(){return"MoveOperation"}static fromJSON(e,t){const i=y.fromJSON(e.sourcePosition,t),s=y.fromJSON(e.targetPosition,t);return new this(i,e.howMany,s,e.baseVersion)}}/**
|
|
500
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
501
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
502
|
+
*/class ge extends Ne{constructor(e,t,i){super(i),this.position=e.clone(),this.position.stickiness="toNone",this.nodes=new wn(qm(t)),this.shouldReceiveAttributes=!1}get type(){return"insert"}get howMany(){return this.nodes.maxOffset}get affectedSelectable(){return this.position.clone()}clone(){const e=new wn([...this.nodes].map(i=>i._clone(!0))),t=new ge(this.position,e,this.baseVersion);return t.shouldReceiveAttributes=this.shouldReceiveAttributes,t}getReversed(){const e=this.position.root.document.graveyard,t=new y(e,[0]);return new z(this.position,this.nodes.maxOffset,t,this.baseVersion+1)}_validate(){const e=this.position.parent;if(!e||e.maxOffset<this.position.offset)throw new g("insert-operation-position-invalid",this)}_execute(){const e=this.nodes;this.nodes=new wn([...e].map(t=>t._clone(!0))),Ka(this.position,e)}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e.nodes=this.nodes.toJSON(),e}static get className(){return"InsertOperation"}static fromJSON(e,t){const i=[];for(const o of e.nodes)o.name?i.push(W.fromJSON(o)):i.push(j.fromJSON(o));const s=new ge(y.fromJSON(e.position,t),i,e.baseVersion);return s.shouldReceiveAttributes=e.shouldReceiveAttributes,s}}/**
|
|
503
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
504
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
505
|
+
*/class G extends Ne{constructor(e,t,i,s,o){super(o),this.splitPosition=e.clone(),this.splitPosition.stickiness="toNext",this.howMany=t,this.insertionPosition=i,this.graveyardPosition=s?s.clone():null,this.graveyardPosition&&(this.graveyardPosition.stickiness="toNext")}get type(){return"split"}get moveTargetPosition(){const e=this.insertionPosition.path.slice();return e.push(0),new y(this.insertionPosition.root,e)}get movedRange(){const e=this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);return new b(this.splitPosition,e)}get affectedSelectable(){const e=[b._createFromPositionAndShift(this.splitPosition,0),b._createFromPositionAndShift(this.insertionPosition,0)];return this.graveyardPosition&&e.push(b._createFromPositionAndShift(this.graveyardPosition,0)),e}clone(){return new G(this.splitPosition,this.howMany,this.insertionPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.splitPosition.root.document.graveyard,t=new y(e,[0]);return new re(this.moveTargetPosition,this.howMany,this.splitPosition,t,this.baseVersion+1)}_validate(){const e=this.splitPosition.parent,t=this.splitPosition.offset;if(!e||e.maxOffset<t)throw new g("split-operation-position-invalid",this);if(e.parent){if(this.howMany!=e.maxOffset-this.splitPosition.offset)throw new g("split-operation-how-many-invalid",this);if(this.graveyardPosition&&!this.graveyardPosition.nodeAfter)throw new g("split-operation-graveyard-position-invalid",this)}else throw new g("split-operation-split-in-root",this)}_execute(){const e=this.splitPosition.parent;if(this.graveyardPosition)Ln(b._createFromPositionAndShift(this.graveyardPosition,1),this.insertionPosition);else{const i=e._clone();Ka(this.insertionPosition,i)}const t=new b(y._createAt(e,this.splitPosition.offset),y._createAt(e,e.maxOffset));Ln(t,this.moveTargetPosition)}toJSON(){const e=super.toJSON();return e.splitPosition=this.splitPosition.toJSON(),e.insertionPosition=this.insertionPosition.toJSON(),this.graveyardPosition&&(e.graveyardPosition=this.graveyardPosition.toJSON()),e}static get className(){return"SplitOperation"}static getInsertionPosition(e){const t=e.path.slice(0,-1);return t[t.length-1]++,new y(e.root,t,"toPrevious")}static fromJSON(e,t){const i=y.fromJSON(e.splitPosition,t),s=y.fromJSON(e.insertionPosition,t),o=e.graveyardPosition?y.fromJSON(e.graveyardPosition,t):null;return new this(i,e.howMany,s,o,e.baseVersion)}}/**
|
|
506
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
507
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
508
|
+
*/class re extends Ne{constructor(e,t,i,s,o){super(o),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toPrevious",this.howMany=t,this.targetPosition=i.clone(),this.targetPosition.stickiness="toNext",this.graveyardPosition=s.clone()}get type(){return"merge"}get deletionPosition(){return new y(this.sourcePosition.root,this.sourcePosition.path.slice(0,-1))}get movedRange(){const e=this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);return new b(this.sourcePosition,e)}get affectedSelectable(){const e=this.sourcePosition.parent;return[b._createOn(e),b._createFromPositionAndShift(this.targetPosition,0),b._createFromPositionAndShift(this.graveyardPosition,0)]}clone(){return new re(this.sourcePosition,this.howMany,this.targetPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.targetPosition._getTransformedByMergeOperation(this),t=this.sourcePosition.path.slice(0,-1),i=new y(this.sourcePosition.root,t)._getTransformedByMergeOperation(this);return new G(e,this.howMany,i,this.graveyardPosition,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent;if(e.parent)if(t.parent){if(this.howMany!=e.maxOffset)throw new g("merge-operation-how-many-invalid",this)}else throw new g("merge-operation-target-position-invalid",this);else throw new g("merge-operation-source-position-invalid",this)}_execute(){const e=this.sourcePosition.parent,t=b._createIn(e);Ln(t,this.targetPosition),Ln(b._createOn(e),this.graveyardPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=e.sourcePosition.toJSON(),e.targetPosition=e.targetPosition.toJSON(),e.graveyardPosition=e.graveyardPosition.toJSON(),e}static get className(){return"MergeOperation"}static fromJSON(e,t){const i=y.fromJSON(e.sourcePosition,t),s=y.fromJSON(e.targetPosition,t),o=y.fromJSON(e.graveyardPosition,t);return new this(i,e.howMany,s,o,e.baseVersion)}}/**
|
|
509
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
510
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
511
|
+
*/class Ie extends Ne{constructor(e,t,i,s,o,r){super(r),this.name=e,this.oldRange=t?t.clone():null,this.newRange=i?i.clone():null,this.affectsData=o,this._markers=s}get type(){return"marker"}get affectedSelectable(){const e=[];return this.oldRange&&e.push(this.oldRange.clone()),this.newRange&&(this.oldRange?e.push(...this.newRange.getDifference(this.oldRange)):e.push(this.newRange.clone())),e}clone(){return new Ie(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new Ie(this.name,this.newRange,this.oldRange,this._markers,this.affectsData,this.baseVersion+1)}_execute(){this.newRange?this._markers._set(this.name,this.newRange,!0,this.affectsData):this._markers._remove(this.name)}toJSON(){const e=super.toJSON();return this.oldRange&&(e.oldRange=this.oldRange.toJSON()),this.newRange&&(e.newRange=this.newRange.toJSON()),delete e._markers,e}static get className(){return"MarkerOperation"}static fromJSON(e,t){return new Ie(e.name,e.oldRange?b.fromJSON(e.oldRange,t):null,e.newRange?b.fromJSON(e.newRange,t):null,t.model.markers,e.affectsData,e.baseVersion)}}/**
|
|
512
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
513
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
514
|
+
*/class le extends Ne{constructor(e,t,i,s,o){super(o),this.range=e.clone(),this.key=t,this.oldValue=i===void 0?null:i,this.newValue=s===void 0?null:s}get type(){return this.oldValue===null?"addAttribute":this.newValue===null?"removeAttribute":"changeAttribute"}get affectedSelectable(){return this.range.clone()}clone(){return new le(this.range,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new le(this.range,this.key,this.newValue,this.oldValue,this.baseVersion+1)}toJSON(){const e=super.toJSON();return e.range=this.range.toJSON(),e}_validate(){if(!this.range.isFlat)throw new g("attribute-operation-range-not-flat",this);for(const e of this.range.getItems({shallow:!0})){if(this.oldValue!==null&&!Fs(e.getAttribute(this.key),this.oldValue))throw new g("attribute-operation-wrong-old-value",this,{item:e,key:this.key,value:this.oldValue});if(this.oldValue===null&&this.newValue!==null&&e.hasAttribute(this.key))throw new g("attribute-operation-attribute-exists",this,{node:e,key:this.key})}}_execute(){Fs(this.oldValue,this.newValue)||yE(this.range,this.key,this.newValue)}static get className(){return"AttributeOperation"}static fromJSON(e,t){return new le(b.fromJSON(e.range,t),e.key,e.oldValue,e.newValue,e.baseVersion)}}/**
|
|
515
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
516
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
517
|
+
*/class de extends Ne{get type(){return"noop"}get affectedSelectable(){return null}clone(){return new de(this.baseVersion)}getReversed(){return new de(this.baseVersion+1)}_execute(){}static get className(){return"NoOperation"}}/**
|
|
518
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
519
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
520
|
+
*/class Pe extends Ne{constructor(e,t,i,s){super(s),this.position=e,this.position.stickiness="toNext",this.oldName=t,this.newName=i}get type(){return"rename"}get affectedSelectable(){return this.position.nodeAfter}clone(){return new Pe(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new Pe(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){const e=this.position.nodeAfter;if(e instanceof W){if(e.name!==this.oldName)throw new g("rename-operation-wrong-name",this)}else throw new g("rename-operation-wrong-position",this)}_execute(){const e=this.position.nodeAfter;e.name=this.newName}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e}static get className(){return"RenameOperation"}static fromJSON(e,t){return new Pe(y.fromJSON(e.position,t),e.oldName,e.newName,e.baseVersion)}}/**
|
|
521
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
522
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
523
|
+
*/class bt extends Ne{constructor(e,t,i,s,o){super(o),this.root=e,this.key=t,this.oldValue=i===void 0?null:i,this.newValue=s===void 0?null:s}get type(){return this.oldValue===null?"addRootAttribute":this.newValue===null?"removeRootAttribute":"changeRootAttribute"}get affectedSelectable(){return this.root}clone(){return new bt(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new bt(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is("documentFragment"))throw new g("rootattribute-operation-not-a-root",this,{root:this.root,key:this.key});if(this.oldValue!==null&&this.root.getAttribute(this.key)!==this.oldValue)throw new g("rootattribute-operation-wrong-old-value",this,{root:this.root,key:this.key});if(this.oldValue===null&&this.newValue!==null&&this.root.hasAttribute(this.key))throw new g("rootattribute-operation-attribute-exists",this,{root:this.root,key:this.key})}_execute(){this.newValue!==null?this.root._setAttribute(this.key,this.newValue):this.root._removeAttribute(this.key)}toJSON(){const e=super.toJSON();return e.root=this.root.toJSON(),e}static get className(){return"RootAttributeOperation"}static fromJSON(e,t){if(!t.getRoot(e.root))throw new g("rootattribute-operation-fromjson-no-root",this,{rootName:e.root});return new bt(t.getRoot(e.root),e.key,e.oldValue,e.newValue,e.baseVersion)}}/**
|
|
524
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
525
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
526
|
+
*/class nt extends Ne{constructor(e,t,i,s,o){if(super(o),this.rootName=e,this.elementName=t,this.isAdd=i,this._document=s,!this._document.getRoot(this.rootName)){const r=this._document.createRoot(this.elementName,this.rootName);r._isAttached=!1}}get type(){return this.isAdd?"addRoot":"detachRoot"}get affectedSelectable(){return this._document.getRoot(this.rootName)}clone(){return new nt(this.rootName,this.elementName,this.isAdd,this._document,this.baseVersion)}getReversed(){return new nt(this.rootName,this.elementName,!this.isAdd,this._document,this.baseVersion+1)}_execute(){this._document.getRoot(this.rootName)._isAttached=this.isAdd}toJSON(){const e=super.toJSON();return delete e._document,e}static get className(){return"RootOperation"}static fromJSON(e,t){return new nt(e.rootName,e.elementName,e.isAdd,t,e.baseVersion)}}/**
|
|
527
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
528
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
529
|
+
*/const qe={};qe[le.className]=le;qe[ge.className]=ge;qe[Ie.className]=Ie;qe[z.className]=z;qe[de.className]=de;qe[Ne.className]=Ne;qe[Pe.className]=Pe;qe[bt.className]=bt;qe[nt.className]=nt;qe[G.className]=G;qe[re.className]=re;class CE{static fromJSON(e,t){return qe[e.__className].fromJSON(e,t)}}/**
|
|
530
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
531
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
532
|
+
*/const Dr=new Map;function $(n,e,t){let i=Dr.get(n);i||(i=new Map,Dr.set(n,i)),i.set(e,t)}function kE(n,e){const t=Dr.get(n);return t&&t.has(e)?t.get(e):EE}function EE(n){return[n]}function Jc(n,e,t={}){const i=kE(n.constructor,e.constructor);try{return n=n.clone(),i(n,e,t)}catch(s){throw s}}function TE(n,e,t){n=n.slice(),e=e.slice();const i=new AE(t.document,t.useRelations,t.forceWeakRemove);i.setOriginalOperations(n),i.setOriginalOperations(e);const s=i.originalOperations;if(n.length==0||e.length==0)return{operationsA:n,operationsB:e,originalOperations:s};const o=new WeakMap;for(const l of n)o.set(l,0);const r={nextBaseVersionA:n[n.length-1].baseVersion+1,nextBaseVersionB:e[e.length-1].baseVersion+1,originalOperationsACount:n.length,originalOperationsBCount:e.length};let a=0;for(;a<n.length;){const l=n[a],c=o.get(l);if(c==e.length){a++;continue}const u=e[c],d=Jc(l,u,i.getContext(l,u,!0)),h=Jc(u,l,i.getContext(u,l,!1));i.updateRelation(l,u),i.setOriginalOperations(d,l),i.setOriginalOperations(h,u);for(const f of d)o.set(f,c+h.length);n.splice(a,1,...d),e.splice(c,1,...h)}if(t.padWithNoOps){const l=n.length-r.originalOperationsACount,c=e.length-r.originalOperationsBCount;Qc(n,c-l),Qc(e,l-c)}return Yc(n,r.nextBaseVersionB),Yc(e,r.nextBaseVersionA),{operationsA:n,operationsB:e,originalOperations:s}}class AE{constructor(e,t,i=!1){this.originalOperations=new Map,this._history=e.history,this._useRelations=t,this._forceWeakRemove=!!i,this._relations=new Map}setOriginalOperations(e,t=null){const i=t?this.originalOperations.get(t):null;for(const s of e)this.originalOperations.set(s,i||s)}updateRelation(e,t){if(e instanceof z)t instanceof re?e.targetPosition.isEqual(t.sourcePosition)||t.movedRange.containsPosition(e.targetPosition)?this._setRelation(e,t,"insertAtSource"):e.targetPosition.isEqual(t.deletionPosition)?this._setRelation(e,t,"insertBetween"):e.targetPosition.isAfter(t.sourcePosition)&&this._setRelation(e,t,"moveTargetAfter"):t instanceof z&&(e.targetPosition.isEqual(t.sourcePosition)||e.targetPosition.isBefore(t.sourcePosition)?this._setRelation(e,t,"insertBefore"):this._setRelation(e,t,"insertAfter"));else if(e instanceof G){if(t instanceof re)e.splitPosition.isBefore(t.sourcePosition)&&this._setRelation(e,t,"splitBefore");else if(t instanceof z)if(e.splitPosition.isEqual(t.sourcePosition)||e.splitPosition.isBefore(t.sourcePosition))this._setRelation(e,t,"splitBefore");else{const i=b._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&i.containsPosition(e.splitPosition)){const s=i.end.offset-e.splitPosition.offset,o=e.splitPosition.offset-i.start.offset;this._setRelation(e,t,{howMany:s,offset:o})}}}else if(e instanceof re)t instanceof re?(e.targetPosition.isEqual(t.sourcePosition)||this._setRelation(e,t,"mergeTargetNotMoved"),e.sourcePosition.isEqual(t.targetPosition)&&this._setRelation(e,t,"mergeSourceNotMoved"),e.sourcePosition.isEqual(t.sourcePosition)&&this._setRelation(e,t,"mergeSameElement")):t instanceof G&&e.sourcePosition.isEqual(t.splitPosition)&&this._setRelation(e,t,"splitAtSource");else if(e instanceof Ie){const i=e.newRange;if(!i)return;if(t instanceof z){const s=b._createFromPositionAndShift(t.sourcePosition,t.howMany),o=s.containsPosition(i.start)||s.start.isEqual(i.start),r=s.containsPosition(i.end)||s.end.isEqual(i.end);(o||r)&&!s.containsRange(i)&&this._setRelation(e,t,{side:o?"left":"right",path:o?i.start.path.slice():i.end.path.slice()})}else if(t instanceof re){const s=i.start.isEqual(t.targetPosition),o=i.start.isEqual(t.deletionPosition),r=i.end.isEqual(t.deletionPosition),a=i.end.isEqual(t.sourcePosition);(s||o||r||a)&&this._setRelation(e,t,{wasInLeftElement:s,wasStartBeforeMergedElement:o,wasEndBeforeMergedElement:r,wasInRightElement:a})}}}getContext(e,t,i){return{aIsStrong:i,aWasUndone:this._wasUndone(e),bWasUndone:this._wasUndone(t),abRelation:this._useRelations?this._getRelation(e,t):null,baRelation:this._useRelations?this._getRelation(t,e):null,forceWeakRemove:this._forceWeakRemove}}_wasUndone(e){const t=this.originalOperations.get(e);return t.wasUndone||this._history.isUndoneOperation(t)}_getRelation(e,t){const i=this.originalOperations.get(t),s=this._history.getUndoneOperation(i);if(!s)return null;const o=this.originalOperations.get(e),r=this._relations.get(o);return r&&r.get(s)||null}_setRelation(e,t,i){const s=this.originalOperations.get(e),o=this.originalOperations.get(t);let r=this._relations.get(s);r||(r=new Map,this._relations.set(s,r)),r.set(o,i)}}function Yc(n,e){for(const t of n)t.baseVersion=e++}function Qc(n,e){for(let t=0;t<e;t++)n.push(new de(0))}$(le,le,(n,e,t)=>{if(n.key===e.key&&n.range.start.hasSameParentAs(e.range.start)){const i=n.range.getDifference(e.range).map(o=>new le(o,n.key,n.oldValue,n.newValue,0)),s=n.range.getIntersection(e.range);return s&&t.aIsStrong&&i.push(new le(s,e.key,e.newValue,n.newValue,0)),i.length==0?[new de(0)]:i}else return[n]});$(le,ge,(n,e)=>{if(n.range.start.hasSameParentAs(e.position)&&n.range.containsPosition(e.position)){const i=n.range._getTransformedByInsertion(e.position,e.howMany,!e.shouldReceiveAttributes).map(s=>new le(s,n.key,n.oldValue,n.newValue,n.baseVersion));if(e.shouldReceiveAttributes){const s=Gm(e,n.key,n.oldValue);s&&i.unshift(s)}return i}return n.range=n.range._getTransformedByInsertion(e.position,e.howMany,!1)[0],[n]});function Gm(n,e,t){const s=n.nodes.getNode(0).getAttribute(e);if(s==t)return null;const o=new b(n.position,n.position.getShiftedBy(n.howMany));return new le(o,e,s,t,0)}$(le,re,(n,e)=>{const t=[];n.range.start.hasSameParentAs(e.deletionPosition)&&(n.range.containsPosition(e.deletionPosition)||n.range.start.isEqual(e.deletionPosition))&&t.push(b._createFromPositionAndShift(e.graveyardPosition,1));const i=n.range._getTransformedByMergeOperation(e);return i.isCollapsed||t.push(i),t.map(s=>new le(s,n.key,n.oldValue,n.newValue,n.baseVersion))});$(le,z,(n,e)=>SE(n.range,e).map(i=>new le(i,n.key,n.oldValue,n.newValue,n.baseVersion)));function SE(n,e){const t=b._createFromPositionAndShift(e.sourcePosition,e.howMany);let i=null,s=[];t.containsRange(n,!0)?i=n:n.start.hasSameParentAs(t.start)?(s=n.getDifference(t),i=n.getIntersection(t)):s=[n];const o=[];for(let r of s){r=r._getTransformedByDeletion(e.sourcePosition,e.howMany);const a=e.getMovedRangeStart(),l=r.start.hasSameParentAs(a),c=r._getTransformedByInsertion(a,e.howMany,l);o.push(...c)}return i&&o.push(i._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany,!1)[0]),o}$(le,G,(n,e)=>{if(n.range.end.isEqual(e.insertionPosition))return e.graveyardPosition||n.range.end.offset++,[n];if(n.range.start.hasSameParentAs(e.splitPosition)&&n.range.containsPosition(e.splitPosition)){const t=n.clone();return t.range=new b(e.moveTargetPosition.clone(),n.range.end._getCombined(e.splitPosition,e.moveTargetPosition)),n.range.end=e.splitPosition.clone(),n.range.end.stickiness="toPrevious",[n,t]}return n.range=n.range._getTransformedBySplitOperation(e),[n]});$(ge,le,(n,e)=>{const t=[n];if(n.shouldReceiveAttributes&&n.position.hasSameParentAs(e.range.start)&&e.range.containsPosition(n.position)){const i=Gm(n,e.key,e.newValue);i&&t.push(i)}return t});$(ge,ge,(n,e,t)=>n.position.isEqual(e.position)&&t.aIsStrong?[n]:(n.position=n.position._getTransformedByInsertOperation(e),[n]));$(ge,z,(n,e)=>(n.position=n.position._getTransformedByMoveOperation(e),[n]));$(ge,G,(n,e)=>(n.position=n.position._getTransformedBySplitOperation(e),[n]));$(ge,re,(n,e)=>(n.position=n.position._getTransformedByMergeOperation(e),[n]));$(Ie,ge,(n,e)=>(n.oldRange&&(n.oldRange=n.oldRange._getTransformedByInsertOperation(e)[0]),n.newRange&&(n.newRange=n.newRange._getTransformedByInsertOperation(e)[0]),[n]));$(Ie,Ie,(n,e,t)=>{if(n.name==e.name)if(t.aIsStrong)n.oldRange=e.newRange?e.newRange.clone():null;else return[new de(0)];return[n]});$(Ie,re,(n,e)=>(n.oldRange&&(n.oldRange=n.oldRange._getTransformedByMergeOperation(e)),n.newRange&&(n.newRange=n.newRange._getTransformedByMergeOperation(e)),[n]));$(Ie,z,(n,e,t)=>{if(n.oldRange&&(n.oldRange=b._createFromRanges(n.oldRange._getTransformedByMoveOperation(e))),n.newRange){if(t.abRelation){const i=b._createFromRanges(n.newRange._getTransformedByMoveOperation(e));if(t.abRelation.side=="left"&&e.targetPosition.isEqual(n.newRange.start))return n.newRange.end=i.end,n.newRange.start.path=t.abRelation.path,[n];if(t.abRelation.side=="right"&&e.targetPosition.isEqual(n.newRange.end))return n.newRange.start=i.start,n.newRange.end.path=t.abRelation.path,[n]}n.newRange=b._createFromRanges(n.newRange._getTransformedByMoveOperation(e))}return[n]});$(Ie,G,(n,e,t)=>{if(n.oldRange&&(n.oldRange=n.oldRange._getTransformedBySplitOperation(e)),n.newRange){if(t.abRelation){const i=n.newRange._getTransformedBySplitOperation(e);return n.newRange.start.isEqual(e.splitPosition)&&t.abRelation.wasStartBeforeMergedElement?n.newRange.start=y._createAt(e.insertionPosition):n.newRange.start.isEqual(e.splitPosition)&&!t.abRelation.wasInLeftElement&&(n.newRange.start=y._createAt(e.moveTargetPosition)),n.newRange.end.isEqual(e.splitPosition)&&t.abRelation.wasInRightElement?n.newRange.end=y._createAt(e.moveTargetPosition):n.newRange.end.isEqual(e.splitPosition)&&t.abRelation.wasEndBeforeMergedElement?n.newRange.end=y._createAt(e.insertionPosition):n.newRange.end=i.end,[n]}n.newRange=n.newRange._getTransformedBySplitOperation(e)}return[n]});$(re,ge,(n,e)=>(n.sourcePosition.hasSameParentAs(e.position)&&(n.howMany+=e.howMany),n.sourcePosition=n.sourcePosition._getTransformedByInsertOperation(e),n.targetPosition=n.targetPosition._getTransformedByInsertOperation(e),[n]));$(re,re,(n,e,t)=>{if(n.sourcePosition.isEqual(e.sourcePosition)&&n.targetPosition.isEqual(e.targetPosition))if(t.bWasUndone){const i=e.graveyardPosition.path.slice();return i.push(0),n.sourcePosition=new y(e.graveyardPosition.root,i),n.howMany=0,[n]}else return[new de(0)];if(n.sourcePosition.isEqual(e.sourcePosition)&&!n.targetPosition.isEqual(e.targetPosition)&&!t.bWasUndone&&t.abRelation!="splitAtSource"){const i=n.targetPosition.root.rootName=="$graveyard",s=e.targetPosition.root.rootName=="$graveyard";if(s&&!i||!(i&&!s)&&t.aIsStrong){const l=e.targetPosition._getTransformedByMergeOperation(e),c=n.targetPosition._getTransformedByMergeOperation(e);return[new z(l,n.howMany,c,0)]}else return[new de(0)]}return n.sourcePosition.hasSameParentAs(e.targetPosition)&&(n.howMany+=e.howMany),n.sourcePosition=n.sourcePosition._getTransformedByMergeOperation(e),n.targetPosition=n.targetPosition._getTransformedByMergeOperation(e),(!n.graveyardPosition.isEqual(e.graveyardPosition)||!t.aIsStrong)&&(n.graveyardPosition=n.graveyardPosition._getTransformedByMergeOperation(e)),[n]});$(re,z,(n,e,t)=>{const i=b._createFromPositionAndShift(e.sourcePosition,e.howMany);return e.type=="remove"&&!t.bWasUndone&&!t.forceWeakRemove&&n.deletionPosition.hasSameParentAs(e.sourcePosition)&&i.containsPosition(n.sourcePosition)?[new de(0)]:(n.sourcePosition.hasSameParentAs(e.targetPosition)&&(n.howMany+=e.howMany),n.sourcePosition.hasSameParentAs(e.sourcePosition)&&(n.howMany-=e.howMany),n.sourcePosition=n.sourcePosition._getTransformedByMoveOperation(e),n.targetPosition=n.targetPosition._getTransformedByMoveOperation(e),n.graveyardPosition.isEqual(e.targetPosition)||(n.graveyardPosition=n.graveyardPosition._getTransformedByMoveOperation(e)),[n])});$(re,G,(n,e,t)=>{if(e.graveyardPosition&&(n.graveyardPosition=n.graveyardPosition._getTransformedByDeletion(e.graveyardPosition,1),n.deletionPosition.isEqual(e.graveyardPosition)&&(n.howMany=e.howMany)),n.targetPosition.isEqual(e.splitPosition)){const i=e.howMany!=0,s=e.graveyardPosition&&n.deletionPosition.isEqual(e.graveyardPosition);if(i||s||t.abRelation=="mergeTargetNotMoved")return n.sourcePosition=n.sourcePosition._getTransformedBySplitOperation(e),[n]}if(n.sourcePosition.isEqual(e.splitPosition)){if(t.abRelation=="mergeSourceNotMoved")return n.howMany=0,n.targetPosition=n.targetPosition._getTransformedBySplitOperation(e),[n];if(t.abRelation=="mergeSameElement"||n.sourcePosition.offset>0)return n.sourcePosition=e.moveTargetPosition.clone(),n.targetPosition=n.targetPosition._getTransformedBySplitOperation(e),[n]}return n.sourcePosition.hasSameParentAs(e.splitPosition)&&(n.howMany=e.splitPosition.offset),n.sourcePosition=n.sourcePosition._getTransformedBySplitOperation(e),n.targetPosition=n.targetPosition._getTransformedBySplitOperation(e),[n]});$(z,ge,(n,e)=>{const i=b._createFromPositionAndShift(n.sourcePosition,n.howMany)._getTransformedByInsertOperation(e,!1)[0];return n.sourcePosition=i.start,n.howMany=i.end.offset-i.start.offset,n.targetPosition.isEqual(e.position)||(n.targetPosition=n.targetPosition._getTransformedByInsertOperation(e)),[n]});$(z,z,(n,e,t)=>{const i=b._createFromPositionAndShift(n.sourcePosition,n.howMany),s=b._createFromPositionAndShift(e.sourcePosition,e.howMany);let o=t.aIsStrong,r=!t.aIsStrong;t.abRelation=="insertBefore"||t.baRelation=="insertAfter"?r=!0:(t.abRelation=="insertAfter"||t.baRelation=="insertBefore")&&(r=!1);let a;if(n.targetPosition.isEqual(e.targetPosition)&&r?a=n.targetPosition._getTransformedByDeletion(e.sourcePosition,e.howMany):a=n.targetPosition._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),Xc(n,e)&&Xc(e,n))return[e.getReversed()];if(i.containsPosition(e.targetPosition)&&i.containsRange(s,!0))return i.start=i.start._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),i.end=i.end._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),Li([i],a);if(s.containsPosition(n.targetPosition)&&s.containsRange(i,!0))return i.start=i.start._getCombined(e.sourcePosition,e.getMovedRangeStart()),i.end=i.end._getCombined(e.sourcePosition,e.getMovedRangeStart()),Li([i],a);const u=ye(n.sourcePosition.getParentPath(),e.sourcePosition.getParentPath());if(u=="prefix"||u=="extension")return i.start=i.start._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),i.end=i.end._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),Li([i],a);n.type=="remove"&&e.type!="remove"&&!t.aWasUndone&&!t.forceWeakRemove?o=!0:n.type!="remove"&&e.type=="remove"&&!t.bWasUndone&&!t.forceWeakRemove&&(o=!1);const d=[],h=i.getDifference(s);for(const m of h){m.start=m.start._getTransformedByDeletion(e.sourcePosition,e.howMany),m.end=m.end._getTransformedByDeletion(e.sourcePosition,e.howMany);const p=ye(m.start.getParentPath(),e.getMovedRangeStart().getParentPath())=="same",_=m._getTransformedByInsertion(e.getMovedRangeStart(),e.howMany,p);d.push(..._)}const f=i.getIntersection(s);return f!==null&&o&&(f.start=f.start._getCombined(e.sourcePosition,e.getMovedRangeStart()),f.end=f.end._getCombined(e.sourcePosition,e.getMovedRangeStart()),d.length===0?d.push(f):d.length==1?s.start.isBefore(i.start)||s.start.isEqual(i.start)?d.unshift(f):d.push(f):d.splice(1,0,f)),d.length===0?[new de(n.baseVersion)]:Li(d,a)});$(z,G,(n,e,t)=>{let i=n.targetPosition.clone();(!n.targetPosition.isEqual(e.insertionPosition)||!e.graveyardPosition||t.abRelation=="moveTargetAfter")&&(i=n.targetPosition._getTransformedBySplitOperation(e));const s=b._createFromPositionAndShift(n.sourcePosition,n.howMany);if(s.end.isEqual(e.insertionPosition))return e.graveyardPosition||n.howMany++,n.targetPosition=i,[n];if(s.start.hasSameParentAs(e.splitPosition)&&s.containsPosition(e.splitPosition)){let a=new b(e.splitPosition,s.end);a=a._getTransformedBySplitOperation(e);const l=[new b(s.start,e.splitPosition),a];return Li(l,i)}n.targetPosition.isEqual(e.splitPosition)&&t.abRelation=="insertAtSource"&&(i=e.moveTargetPosition),n.targetPosition.isEqual(e.insertionPosition)&&t.abRelation=="insertBetween"&&(i=n.targetPosition);const r=[s._getTransformedBySplitOperation(e)];if(e.graveyardPosition){const a=s.start.isEqual(e.graveyardPosition)||s.containsPosition(e.graveyardPosition);n.howMany>1&&a&&!t.aWasUndone&&r.push(b._createFromPositionAndShift(e.insertionPosition,1))}return Li(r,i)});$(z,re,(n,e,t)=>{const i=b._createFromPositionAndShift(n.sourcePosition,n.howMany);if(e.deletionPosition.hasSameParentAs(n.sourcePosition)&&i.containsPosition(e.sourcePosition)){if(n.type=="remove"&&!t.forceWeakRemove){if(!t.aWasUndone){const r=[];let a=e.graveyardPosition.clone(),l=e.targetPosition._getTransformedByMergeOperation(e);n.howMany>1&&(r.push(new z(n.sourcePosition,n.howMany-1,n.targetPosition,0)),a=a._getTransformedByMove(n.sourcePosition,n.targetPosition,n.howMany-1),l=l._getTransformedByMove(n.sourcePosition,n.targetPosition,n.howMany-1));const c=e.deletionPosition._getCombined(n.sourcePosition,n.targetPosition),u=new z(a,1,c,0),d=u.getMovedRangeStart().path.slice();d.push(0);const h=new y(u.targetPosition.root,d);l=l._getTransformedByMove(a,c,1);const f=new z(l,e.howMany,h,0);return r.push(u),r.push(f),r}}else if(n.howMany==1)return t.bWasUndone?(n.sourcePosition=e.graveyardPosition.clone(),n.targetPosition=n.targetPosition._getTransformedByMergeOperation(e),[n]):[new de(0)]}const o=b._createFromPositionAndShift(n.sourcePosition,n.howMany)._getTransformedByMergeOperation(e);return n.sourcePosition=o.start,n.howMany=o.end.offset-o.start.offset,n.targetPosition=n.targetPosition._getTransformedByMergeOperation(e),[n]});$(Pe,ge,(n,e)=>(n.position=n.position._getTransformedByInsertOperation(e),[n]));$(Pe,re,(n,e)=>n.position.isEqual(e.deletionPosition)?(n.position=e.graveyardPosition.clone(),n.position.stickiness="toNext",[n]):(n.position=n.position._getTransformedByMergeOperation(e),[n]));$(Pe,z,(n,e)=>(n.position=n.position._getTransformedByMoveOperation(e),[n]));$(Pe,Pe,(n,e,t)=>{if(n.position.isEqual(e.position))if(t.aIsStrong)n.oldName=e.newName;else return[new de(0)];return[n]});$(Pe,G,(n,e)=>{const t=n.position.path,i=e.splitPosition.getParentPath();if(ye(t,i)=="same"&&!e.graveyardPosition){const s=new Pe(n.position.getShiftedBy(1),n.oldName,n.newName,0);return[n,s]}return n.position=n.position._getTransformedBySplitOperation(e),[n]});$(bt,bt,(n,e,t)=>{if(n.root===e.root&&n.key===e.key){if(!t.aIsStrong||n.newValue===e.newValue)return[new de(0)];n.oldValue=e.newValue}return[n]});$(nt,nt,(n,e)=>n.rootName===e.rootName&&n.isAdd===e.isAdd?[new de(0)]:[n]);$(G,ge,(n,e)=>(n.splitPosition.hasSameParentAs(e.position)&&n.splitPosition.offset<e.position.offset&&(n.howMany+=e.howMany),n.splitPosition=n.splitPosition._getTransformedByInsertOperation(e),n.insertionPosition=n.insertionPosition._getTransformedByInsertOperation(e),[n]));$(G,re,(n,e,t)=>{if(!n.graveyardPosition&&!t.bWasUndone&&n.splitPosition.hasSameParentAs(e.sourcePosition)){const i=e.graveyardPosition.path.slice();i.push(0);const s=new y(e.graveyardPosition.root,i),o=G.getInsertionPosition(new y(e.graveyardPosition.root,i)),r=new G(s,0,o,null,0);return n.splitPosition=n.splitPosition._getTransformedByMergeOperation(e),n.insertionPosition=G.getInsertionPosition(n.splitPosition),n.graveyardPosition=r.insertionPosition.clone(),n.graveyardPosition.stickiness="toNext",[r,n]}return n.splitPosition.hasSameParentAs(e.deletionPosition)&&!n.splitPosition.isAfter(e.deletionPosition)&&n.howMany--,n.splitPosition.hasSameParentAs(e.targetPosition)&&(n.howMany+=e.howMany),n.splitPosition=n.splitPosition._getTransformedByMergeOperation(e),n.insertionPosition=G.getInsertionPosition(n.splitPosition),n.graveyardPosition&&(n.graveyardPosition=n.graveyardPosition._getTransformedByMergeOperation(e)),[n]});$(G,z,(n,e,t)=>{const i=b._createFromPositionAndShift(e.sourcePosition,e.howMany);if(n.graveyardPosition){const o=i.start.isEqual(n.graveyardPosition)||i.containsPosition(n.graveyardPosition);if(!t.bWasUndone&&o){const r=n.splitPosition._getTransformedByMoveOperation(e),a=n.graveyardPosition._getTransformedByMoveOperation(e),l=a.path.slice();l.push(0);const c=new y(a.root,l);return[new z(r,n.howMany,c,0)]}n.graveyardPosition=n.graveyardPosition._getTransformedByMoveOperation(e)}const s=n.splitPosition.isEqual(e.targetPosition);if(s&&(t.baRelation=="insertAtSource"||t.abRelation=="splitBefore"))return n.howMany+=e.howMany,n.splitPosition=n.splitPosition._getTransformedByDeletion(e.sourcePosition,e.howMany),n.insertionPosition=G.getInsertionPosition(n.splitPosition),[n];if(s&&t.abRelation&&t.abRelation.howMany){const{howMany:o,offset:r}=t.abRelation;return n.howMany+=o,n.splitPosition=n.splitPosition.getShiftedBy(r),[n]}if(n.splitPosition.hasSameParentAs(e.sourcePosition)&&i.containsPosition(n.splitPosition)){const o=e.howMany-(n.splitPosition.offset-e.sourcePosition.offset);return n.howMany-=o,n.splitPosition.hasSameParentAs(e.targetPosition)&&n.splitPosition.offset<e.targetPosition.offset&&(n.howMany+=e.howMany),n.splitPosition=e.sourcePosition.clone(),n.insertionPosition=G.getInsertionPosition(n.splitPosition),[n]}return e.sourcePosition.isEqual(e.targetPosition)||(n.splitPosition.hasSameParentAs(e.sourcePosition)&&n.splitPosition.offset<=e.sourcePosition.offset&&(n.howMany-=e.howMany),n.splitPosition.hasSameParentAs(e.targetPosition)&&n.splitPosition.offset<e.targetPosition.offset&&(n.howMany+=e.howMany)),n.splitPosition.stickiness="toNone",n.splitPosition=n.splitPosition._getTransformedByMoveOperation(e),n.splitPosition.stickiness="toNext",n.graveyardPosition?n.insertionPosition=n.insertionPosition._getTransformedByMoveOperation(e):n.insertionPosition=G.getInsertionPosition(n.splitPosition),[n]});$(G,G,(n,e,t)=>{if(n.splitPosition.isEqual(e.splitPosition)){if(!n.graveyardPosition&&!e.graveyardPosition)return[new de(0)];if(n.graveyardPosition&&e.graveyardPosition&&n.graveyardPosition.isEqual(e.graveyardPosition))return[new de(0)];if(t.abRelation=="splitBefore")return n.howMany=0,n.graveyardPosition=n.graveyardPosition._getTransformedBySplitOperation(e),[n]}if(n.graveyardPosition&&e.graveyardPosition&&n.graveyardPosition.isEqual(e.graveyardPosition)){const i=n.splitPosition.root.rootName=="$graveyard",s=e.splitPosition.root.rootName=="$graveyard";if(s&&!i||!(i&&!s)&&t.aIsStrong){const l=[];return e.howMany&&l.push(new z(e.moveTargetPosition,e.howMany,e.splitPosition,0)),n.howMany&&l.push(new z(n.splitPosition,n.howMany,n.moveTargetPosition,0)),l}else return[new de(0)]}if(n.graveyardPosition&&(n.graveyardPosition=n.graveyardPosition._getTransformedBySplitOperation(e)),n.splitPosition.isEqual(e.insertionPosition)&&t.abRelation=="splitBefore")return n.howMany++,[n];if(e.splitPosition.isEqual(n.insertionPosition)&&t.baRelation=="splitBefore"){const i=e.insertionPosition.path.slice();i.push(0);const s=new y(e.insertionPosition.root,i),o=new z(n.insertionPosition,1,s,0);return[n,o]}return n.splitPosition.hasSameParentAs(e.splitPosition)&&n.splitPosition.offset<e.splitPosition.offset&&(n.howMany-=e.howMany),n.splitPosition=n.splitPosition._getTransformedBySplitOperation(e),n.insertionPosition=G.getInsertionPosition(n.splitPosition),[n]});function Xc(n,e){return n.targetPosition._getTransformedByDeletion(e.sourcePosition,e.howMany)===null}function Li(n,e){const t=[];for(let i=0;i<n.length;i++){const s=n[i],o=new z(s.start,s.end.offset-s.start.offset,e,0);t.push(o);for(let r=i+1;r<n.length;r++)n[r]=n[r]._getTransformedByMove(o.sourcePosition,o.targetPosition,o.howMany)[0];e=e._getTransformedByMove(o.sourcePosition,o.targetPosition,o.howMany)}return t}/**
|
|
533
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
534
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
535
|
+
*/class pe extends Z(y){constructor(e,t,i="toNone"){if(super(e,t,i),!this.root.is("rootElement"))throw new g("model-liveposition-root-not-rootelement",e);xE.call(this)}detach(){this.stopListening()}toPosition(){return new y(this.root,this.path.slice(),this.stickiness)}static fromPosition(e,t){return new this(e.root,e.path.slice(),t||e.stickiness)}}pe.prototype.is=function(n){return n==="livePosition"||n==="model:livePosition"||n=="position"||n==="model:position"};function xE(){this.listenTo(this.root.document.model,"applyOperation",(n,e)=>{const t=e[0];t.isDocumentOperation&&IE.call(this,t)},{priority:"low"})}function IE(n){const e=this.getTransformedByOperation(n);if(!this.isEqual(e)){const t=this.toPosition();this.path=e.path,this.root=e.root,this.fire("change",t)}}/**
|
|
536
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
537
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
538
|
+
*/class _i{constructor(e={}){typeof e=="string"&&(e=e==="transparent"?{isUndoable:!1}:{},H("batch-constructor-deprecated-string-type"));const{isUndoable:t=!0,isLocal:i=!0,isUndo:s=!1,isTyping:o=!1}=e;this.operations=[],this.isUndoable=t,this.isLocal=i,this.isUndo=s,this.isTyping=o}get type(){return H("batch-type-deprecated"),"default"}get baseVersion(){for(const e of this.operations)if(e.baseVersion!==null)return e.baseVersion;return null}addOperation(e){return e.batch=this,this.operations.push(e),e}}/**
|
|
539
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
540
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
541
|
+
*/class PE{constructor(e){this._changesInElement=new Map,this._elementSnapshots=new Map,this._changedMarkers=new Map,this._changedRoots=new Map,this._changeCount=0,this._cachedChanges=null,this._cachedChangesWithGraveyard=null,this._refreshedItems=new Set,this._markerCollection=e}get isEmpty(){return this._changesInElement.size==0&&this._changedMarkers.size==0&&this._changedRoots.size==0}bufferOperation(e){const t=e;switch(t.type){case"insert":{if(this._isInInsertedElement(t.position.parent))return;this._markInsert(t.position.parent,t.position.offset,t.nodes.maxOffset);break}case"addAttribute":case"removeAttribute":case"changeAttribute":{for(const i of t.range.getItems({shallow:!0}))this._isInInsertedElement(i.parent)||this._markAttribute(i);break}case"remove":case"move":case"reinsert":{if(t.sourcePosition.isEqual(t.targetPosition)||t.sourcePosition.getShiftedBy(t.howMany).isEqual(t.targetPosition))return;const i=this._isInInsertedElement(t.sourcePosition.parent),s=this._isInInsertedElement(t.targetPosition.parent);i||this._markRemove(t.sourcePosition.parent,t.sourcePosition.offset,t.howMany),s||this._markInsert(t.targetPosition.parent,t.getMovedRangeStart().offset,t.howMany);break}case"rename":{if(this._isInInsertedElement(t.position.parent))return;this._markRemove(t.position.parent,t.position.offset,1),this._markInsert(t.position.parent,t.position.offset,1);const i=b._createFromPositionAndShift(t.position,1);for(const s of this._markerCollection.getMarkersIntersectingRange(i)){const o=s.getData();this.bufferMarkerChange(s.name,o,o)}break}case"split":{const i=t.splitPosition.parent;this._isInInsertedElement(i)||this._markRemove(i,t.splitPosition.offset,t.howMany),this._isInInsertedElement(t.insertionPosition.parent)||this._markInsert(t.insertionPosition.parent,t.insertionPosition.offset,1),t.graveyardPosition&&this._markRemove(t.graveyardPosition.parent,t.graveyardPosition.offset,1);break}case"merge":{const i=t.sourcePosition.parent;this._isInInsertedElement(i.parent)||this._markRemove(i.parent,i.startOffset,1);const s=t.graveyardPosition.parent;this._markInsert(s,t.graveyardPosition.offset,1);const o=t.targetPosition.parent;this._isInInsertedElement(o)||this._markInsert(o,t.targetPosition.offset,i.maxOffset);break}case"detachRoot":case"addRoot":{const i=t.affectedSelectable;if(!i._isLoaded||i.isAttached()==t.isAdd)return;this._bufferRootStateChange(t.rootName,t.isAdd);break}case"addRootAttribute":case"removeRootAttribute":case"changeRootAttribute":{if(!t.root._isLoaded)return;const i=t.root.rootName;this._bufferRootAttributeChange(i,t.key,t.oldValue,t.newValue);break}}this._cachedChanges=null}bufferMarkerChange(e,t,i){t.range&&t.range.root.is("rootElement")&&!t.range.root._isLoaded&&(t.range=null),i.range&&i.range.root.is("rootElement")&&!i.range.root._isLoaded&&(i.range=null);let s=this._changedMarkers.get(e);s?s.newMarkerData=i:(s={newMarkerData:i,oldMarkerData:t},this._changedMarkers.set(e,s)),s.oldMarkerData.range==null&&i.range==null&&this._changedMarkers.delete(e)}getMarkersToRemove(){const e=[];for(const[t,i]of this._changedMarkers)i.oldMarkerData.range!=null&&e.push({name:t,range:i.oldMarkerData.range});return e}getMarkersToAdd(){const e=[];for(const[t,i]of this._changedMarkers)i.newMarkerData.range!=null&&e.push({name:t,range:i.newMarkerData.range});return e}getChangedMarkers(){return Array.from(this._changedMarkers).map(([e,t])=>({name:e,data:{oldRange:t.oldMarkerData.range,newRange:t.newMarkerData.range}}))}hasDataChanges(){if(this._changesInElement.size>0||this._changedRoots.size>0)return!0;for(const{newMarkerData:e,oldMarkerData:t}of this._changedMarkers.values()){if(e.affectsData!==t.affectsData)return!0;if(e.affectsData){const i=e.range&&!t.range,s=!e.range&&t.range,o=e.range&&t.range&&!e.range.isEqual(t.range);if(i||s||o)return!0}}return!1}getChanges(e={}){if(this._cachedChanges)return e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice();let t=[];for(const i of this._changesInElement.keys()){const s=this._changesInElement.get(i).sort((u,d)=>u.offset===d.offset?u.type!=d.type?u.type=="remove"?-1:1:0:u.offset<d.offset?-1:1),o=this._elementSnapshots.get(i),r=eu(i.getChildren()),a=RE(o.length,s);let l=0,c=0;for(const u of a)if(u==="i")t.push(this._getInsertDiff(i,l,r[l])),l++;else if(u==="r")t.push(this._getRemoveDiff(i,l,o[c])),c++;else if(u==="a"){const d=r[l].attributes,h=o[c].attributes;let f;if(r[l].name=="$text")f=new b(y._createAt(i,l),y._createAt(i,l+1));else{const m=i.offsetToIndex(l);f=new b(y._createAt(i,l),y._createAt(i.getChild(m),0))}t.push(...this._getAttributesDiff(f,h,d)),l++,c++}else l++,c++}t.sort((i,s)=>i.position.root!=s.position.root?i.position.root.rootName<s.position.root.rootName?-1:1:i.position.isEqual(s.position)?i.changeCount-s.changeCount:i.position.isBefore(s.position)?-1:1);for(let i=1,s=0;i<t.length;i++){const o=t[s],r=t[i],a=o.type=="remove"&&r.type=="remove"&&o.name=="$text"&&r.name=="$text"&&o.position.isEqual(r.position),l=o.type=="insert"&&r.type=="insert"&&o.name=="$text"&&r.name=="$text"&&o.position.parent==r.position.parent&&o.position.offset+o.length==r.position.offset,c=o.type=="attribute"&&r.type=="attribute"&&o.position.parent==r.position.parent&&o.range.isFlat&&r.range.isFlat&&o.position.offset+o.length==r.position.offset&&o.attributeKey==r.attributeKey&&o.attributeOldValue==r.attributeOldValue&&o.attributeNewValue==r.attributeNewValue;a||l||c?(o.length++,c&&(o.range.end=o.range.end.getShiftedBy(1)),t[i]=null):s=i}t=t.filter(i=>i);for(const i of t)delete i.changeCount,i.type=="attribute"&&(delete i.position,delete i.length);return this._changeCount=0,this._cachedChangesWithGraveyard=t,this._cachedChanges=t.filter(VE),e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice()}getChangedRoots(){return Array.from(this._changedRoots.values()).map(e=>{const t={...e};return t.state!==void 0&&delete t.attributes,t})}getRefreshedItems(){return new Set(this._refreshedItems)}reset(){this._changesInElement.clear(),this._elementSnapshots.clear(),this._changedMarkers.clear(),this._changedRoots.clear(),this._refreshedItems=new Set,this._cachedChanges=null}_bufferRootStateChange(e,t){if(!this._changedRoots.has(e)){this._changedRoots.set(e,{name:e,state:t?"attached":"detached"});return}const i=this._changedRoots.get(e);i.state!==void 0?(delete i.state,i.attributes===void 0&&this._changedRoots.delete(e)):i.state=t?"attached":"detached"}_bufferRootAttributeChange(e,t,i,s){const o=this._changedRoots.get(e)||{name:e},r=o.attributes||{};if(r[t]){const a=r[t];s===a.oldValue?delete r[t]:a.newValue=s}else r[t]={oldValue:i,newValue:s};Object.entries(r).length===0?(delete o.attributes,o.state===void 0&&this._changedRoots.delete(e)):(o.attributes=r,this._changedRoots.set(e,o))}_refreshItem(e){if(this._isInInsertedElement(e.parent))return;this._markRemove(e.parent,e.startOffset,e.offsetSize),this._markInsert(e.parent,e.startOffset,e.offsetSize),this._refreshedItems.add(e);const t=b._createOn(e);for(const i of this._markerCollection.getMarkersIntersectingRange(t)){const s=i.getData();this.bufferMarkerChange(i.name,s,s)}this._cachedChanges=null}_bufferRootLoad(e){if(e.isAttached()){this._bufferRootStateChange(e.rootName,!0),this._markInsert(e,0,e.maxOffset);for(const t of e.getAttributeKeys())this._bufferRootAttributeChange(e.rootName,t,null,e.getAttribute(t));for(const t of this._markerCollection)if(t.getRange().root==e){const i=t.getData();this.bufferMarkerChange(t.name,{...i,range:null},i)}}}_markInsert(e,t,i){if(e.root.is("rootElement")&&!e.root._isLoaded)return;const s={type:"insert",offset:t,howMany:i,count:this._changeCount++};this._markChange(e,s)}_markRemove(e,t,i){if(e.root.is("rootElement")&&!e.root._isLoaded)return;const s={type:"remove",offset:t,howMany:i,count:this._changeCount++};this._markChange(e,s),this._removeAllNestedChanges(e,t,i)}_markAttribute(e){if(e.root.is("rootElement")&&!e.root._isLoaded)return;const t={type:"attribute",offset:e.startOffset,howMany:e.offsetSize,count:this._changeCount++};this._markChange(e.parent,t)}_markChange(e,t){this._makeSnapshot(e);const i=this._getChangesForElement(e);this._handleChange(t,i),i.push(t);for(let s=0;s<i.length;s++)i[s].howMany<1&&(i.splice(s,1),s--)}_getChangesForElement(e){let t;return this._changesInElement.has(e)?t=this._changesInElement.get(e):(t=[],this._changesInElement.set(e,t)),t}_makeSnapshot(e){this._elementSnapshots.has(e)||this._elementSnapshots.set(e,eu(e.getChildren()))}_handleChange(e,t){e.nodesToHandle=e.howMany;for(const i of t){const s=e.offset+e.howMany,o=i.offset+i.howMany;if(e.type=="insert"&&(i.type=="insert"&&(e.offset<=i.offset?i.offset+=e.howMany:e.offset<o&&(i.howMany+=e.nodesToHandle,e.nodesToHandle=0)),i.type=="remove"&&e.offset<i.offset&&(i.offset+=e.howMany),i.type=="attribute")){if(e.offset<=i.offset)i.offset+=e.howMany;else if(e.offset<o){const r=i.howMany;i.howMany=e.offset-i.offset,t.unshift({type:"attribute",offset:s,howMany:r-i.howMany,count:this._changeCount++})}}if(e.type=="remove"){if(i.type=="insert"){if(s<=i.offset)i.offset-=e.howMany;else if(s<=o)if(e.offset<i.offset){const r=s-i.offset;i.offset=e.offset,i.howMany-=r,e.nodesToHandle-=r}else i.howMany-=e.nodesToHandle,e.nodesToHandle=0;else if(e.offset<=i.offset)e.nodesToHandle-=i.howMany,i.howMany=0;else if(e.offset<o){const r=o-e.offset;i.howMany-=r,e.nodesToHandle-=r}}if(i.type=="remove"&&(s<=i.offset?i.offset-=e.howMany:e.offset<i.offset&&(e.nodesToHandle+=i.howMany,i.howMany=0)),i.type=="attribute"){if(s<=i.offset)i.offset-=e.howMany;else if(e.offset<i.offset){const r=s-i.offset;i.offset=e.offset,i.howMany-=r}else if(e.offset<o)if(s<=o){const r=i.howMany;i.howMany=e.offset-i.offset;const a=r-i.howMany-e.nodesToHandle;t.unshift({type:"attribute",offset:e.offset,howMany:a,count:this._changeCount++})}else i.howMany-=o-e.offset}}if(e.type=="attribute"){if(i.type=="insert")if(e.offset<i.offset&&s>i.offset){if(s>o){const r={type:"attribute",offset:o,howMany:s-o,count:this._changeCount++};this._handleChange(r,t),t.push(r)}e.nodesToHandle=i.offset-e.offset,e.howMany=e.nodesToHandle}else e.offset>=i.offset&&e.offset<o&&(s>o?(e.nodesToHandle=s-o,e.offset=o):e.nodesToHandle=0);if(i.type=="remove"&&e.offset<i.offset&&s>i.offset){const r={type:"attribute",offset:i.offset,howMany:s-i.offset,count:this._changeCount++};this._handleChange(r,t),t.push(r),e.nodesToHandle=i.offset-e.offset,e.howMany=e.nodesToHandle}i.type=="attribute"&&(e.offset>=i.offset&&s<=o?(e.nodesToHandle=0,e.howMany=0,e.offset=0):e.offset<=i.offset&&s>=o&&(i.howMany=0))}}e.howMany=e.nodesToHandle,delete e.nodesToHandle}_getInsertDiff(e,t,i){return{type:"insert",position:y._createAt(e,t),name:i.name,attributes:new Map(i.attributes),length:1,changeCount:this._changeCount++,_element:i.element}}_getRemoveDiff(e,t,i){return{type:"remove",position:y._createAt(e,t),name:i.name,attributes:new Map(i.attributes),length:1,changeCount:this._changeCount++,_element:i.element}}_getAttributesDiff(e,t,i){const s=[];i=new Map(i);for(const[o,r]of t){const a=i.has(o)?i.get(o):null;a!==r&&s.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:o,attributeOldValue:r,attributeNewValue:a,changeCount:this._changeCount++}),i.delete(o)}for(const[o,r]of i)s.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:o,attributeOldValue:null,attributeNewValue:r,changeCount:this._changeCount++});return s}_isInInsertedElement(e){const t=e.parent;if(!t)return!1;const i=this._changesInElement.get(t),s=e.startOffset;if(i){for(const o of i)if(o.type=="insert"&&s>=o.offset&&s<o.offset+o.howMany)return!0}return this._isInInsertedElement(t)}_removeAllNestedChanges(e,t,i){const s=new b(y._createAt(e,t),y._createAt(e,t+i));for(const o of s.getItems({shallow:!0}))o.is("element")&&(this._elementSnapshots.delete(o),this._changesInElement.delete(o),this._removeAllNestedChanges(o,0,o.maxOffset))}}function eu(n){const e=[];for(const t of n)if(t.is("$text"))for(let i=0;i<t.data.length;i++)e.push({name:"$text",attributes:new Map(t.getAttributes())});else e.push({name:t.name,attributes:new Map(t.getAttributes()),element:t});return e}function RE(n,e){const t=[];let i=0,s=0;for(const o of e){if(o.offset>i){for(let r=0;r<o.offset-i;r++)t.push("e");s+=o.offset-i}if(o.type=="insert"){for(let r=0;r<o.howMany;r++)t.push("i");i=o.offset+o.howMany}else if(o.type=="remove"){for(let r=0;r<o.howMany;r++)t.push("r");i=o.offset,s+=o.howMany}else t.push(..."a".repeat(o.howMany).split("")),i=o.offset+o.howMany,s+=o.howMany}if(s<n)for(let o=0;o<n-s-i;o++)t.push("e");return t}function VE(n){const e="position"in n&&n.position.root.rootName=="$graveyard",t="range"in n&&n.range.root.rootName=="$graveyard";return!e&&!t}/**
|
|
542
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
543
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
544
|
+
*/class LE{constructor(){this._operations=[],this._undoPairs=new Map,this._undoneOperations=new Set,this._baseVersionToOperationIndex=new Map,this._version=0,this._gaps=new Map}get version(){return this._version}set version(e){this._operations.length&&e>this._version+1&&this._gaps.set(this._version,e),this._version=e}get lastOperation(){return this._operations[this._operations.length-1]}addOperation(e){if(e.baseVersion!==this.version)throw new g("model-document-history-addoperation-incorrect-version",this,{operation:e,historyVersion:this.version});this._operations.push(e),this._version++,this._baseVersionToOperationIndex.set(e.baseVersion,this._operations.length-1)}getOperations(e,t=this.version){if(!this._operations.length)return[];const i=this._operations[0];e===void 0&&(e=i.baseVersion);let s=t-1;for(const[a,l]of this._gaps)e>a&&e<l&&(e=l),s>a&&s<l&&(s=a-1);if(s<i.baseVersion||e>this.lastOperation.baseVersion)return[];let o=this._baseVersionToOperationIndex.get(e);o===void 0&&(o=0);let r=this._baseVersionToOperationIndex.get(s);return r===void 0&&(r=this._operations.length-1),this._operations.slice(o,r+1)}getOperation(e){const t=this._baseVersionToOperationIndex.get(e);if(t!==void 0)return this._operations[t]}setOperationAsUndone(e,t){this._undoPairs.set(t,e),this._undoneOperations.add(e)}isUndoingOperation(e){return this._undoPairs.has(e)}isUndoneOperation(e){return this._undoneOperations.has(e)}getUndoneOperation(e){return this._undoPairs.get(e)}reset(){this._version=0,this._undoPairs=new Map,this._operations=[],this._undoneOperations=new Set,this._gaps=new Map,this._baseVersionToOperationIndex=new Map}}/**
|
|
545
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
546
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
547
|
+
*/class Ws extends W{constructor(e,t,i="main"){super(t),this._isAttached=!0,this._isLoaded=!0,this._document=e,this.rootName=i}get document(){return this._document}isAttached(){return this._isAttached}toJSON(){return this.rootName}}Ws.prototype.is=function(n,e){return e?e===this.name&&(n==="rootElement"||n==="model:rootElement"||n==="element"||n==="model:element"):n==="rootElement"||n==="model:rootElement"||n==="element"||n==="model:element"||n==="node"||n==="model:node"};/**
|
|
548
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
549
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
550
|
+
*/const tu="$graveyard";class BE extends Z(){constructor(e){super(),this.model=e,this.history=new LE,this.selection=new Ye(this),this.roots=new _e({idProperty:"rootName"}),this.differ=new PE(e.markers),this.isReadOnly=!1,this._postFixers=new Set,this._hasSelectionChangedFromTheLastChangeBlock=!1,this.createRoot("$root",tu),this.listenTo(e,"applyOperation",(t,i)=>{const s=i[0];s.isDocumentOperation&&this.differ.bufferOperation(s)},{priority:"high"}),this.listenTo(e,"applyOperation",(t,i)=>{const s=i[0];s.isDocumentOperation&&this.history.addOperation(s)},{priority:"low"}),this.listenTo(this.selection,"change",()=>{this._hasSelectionChangedFromTheLastChangeBlock=!0}),this.listenTo(e.markers,"update",(t,i,s,o,r)=>{const a={...i.getData(),range:o};this.differ.bufferMarkerChange(i.name,r,a),s===null&&i.on("change",(l,c)=>{const u=i.getData();this.differ.bufferMarkerChange(i.name,{...u,range:c},u)})}),this.registerPostFixer(t=>{let i=!1;for(const s of this.roots)!s.isAttached()&&!s.isEmpty&&(t.remove(t.createRangeIn(s)),i=!0);for(const s of this.model.markers)s.getRange().root.isAttached()||(t.removeMarker(s),i=!0);return i})}get version(){return this.history.version}set version(e){this.history.version=e}get graveyard(){return this.getRoot(tu)}createRoot(e="$root",t="main"){if(this.roots.get(t))throw new g("model-document-createroot-name-exists",this,{name:t});const i=new Ws(this,e,t);return this.roots.add(i),i}destroy(){this.selection.destroy(),this.stopListening()}getRoot(e="main"){return this.roots.get(e)}getRootNames(e=!1){return this.getRoots(e).map(t=>t.rootName)}getRoots(e=!1){return this.roots.filter(t=>t!=this.graveyard&&(e||t.isAttached())&&t._isLoaded)}registerPostFixer(e){this._postFixers.add(e)}toJSON(){const e=bf(this);return e.selection="[engine.model.DocumentSelection]",e.model="[engine.model.Model]",e}_handleChangeBlock(e){this._hasDocumentChangedFromTheLastChangeBlock()&&(this._callPostFixers(e),this.selection.refresh(),this.differ.hasDataChanges()?this.fire("change:data",e.batch):this.fire("change",e.batch),this.selection.refresh(),this.differ.reset()),this._hasSelectionChangedFromTheLastChangeBlock=!1}_hasDocumentChangedFromTheLastChangeBlock(){return!this.differ.isEmpty||this._hasSelectionChangedFromTheLastChangeBlock}_getDefaultRoot(){const e=this.getRoots();return e.length?e[0]:this.graveyard}_getDefaultRange(){const e=this._getDefaultRoot(),t=this.model,i=t.schema,s=t.createPositionFromPath(e,[0]);return i.getNearestSelectionRange(s)||t.createRange(s)}_validateSelectionRange(e){return iu(e.start)&&iu(e.end)}_callPostFixers(e){let t=!1;do for(const i of this._postFixers)if(this.selection.refresh(),t=i(e),t)break;while(t)}}function iu(n){const e=n.textNode;if(e){const t=e.data,i=n.offset-e.startOffset;return!Ma(t,i)&&!Fa(t,i)}return!0}/**
|
|
551
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
552
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
553
|
+
*/class OE extends Z(){constructor(){super(...arguments),this._markers=new Map}[Symbol.iterator](){return this._markers.values()}has(e){const t=e instanceof Pi?e.name:e;return this._markers.has(t)}get(e){return this._markers.get(e)||null}_set(e,t,i=!1,s=!1){const o=e instanceof Pi?e.name:e;if(o.includes(","))throw new g("markercollection-incorrect-marker-name",this);const r=this._markers.get(o);if(r){const c=r.getData(),u=r.getRange();let d=!1;return u.isEqual(t)||(r._attachLiveRange(Fe.fromRange(t)),d=!0),i!=r.managedUsingOperations&&(r._managedUsingOperations=i,d=!0),typeof s=="boolean"&&s!=r.affectsData&&(r._affectsData=s,d=!0),d&&this.fire(`update:${o}`,r,u,t,c),r}const a=Fe.fromRange(t),l=new Pi(o,a,i,s);return this._markers.set(o,l),this.fire(`update:${o}`,l,null,t,{...l.getData(),range:null}),l}_remove(e){const t=e instanceof Pi?e.name:e,i=this._markers.get(t);return i?(this._markers.delete(t),this.fire(`update:${t}`,i,i.getRange(),null,i.getData()),this._destroyMarker(i),!0):!1}_refresh(e){const t=e instanceof Pi?e.name:e,i=this._markers.get(t);if(!i)throw new g("markercollection-refresh-marker-not-exists",this);const s=i.getRange();this.fire(`update:${t}`,i,s,s,i.getData())}*getMarkersAtPosition(e){for(const t of this)t.getRange().containsPosition(e)&&(yield t)}*getMarkersIntersectingRange(e){for(const t of this)t.getRange().getIntersection(e)!==null&&(yield t)}destroy(){for(const e of this._markers.values())this._destroyMarker(e);this._markers=null,this.stopListening()}*getMarkersGroup(e){for(const t of this._markers.values())t.name.startsWith(e+":")&&(yield t)}_destroyMarker(e){e.stopListening(),e._detachLiveRange()}}class Pi extends Z(Bt){constructor(e,t,i,s){super(),this.name=e,this._liveRange=this._attachLiveRange(t),this._managedUsingOperations=i,this._affectsData=s}get managedUsingOperations(){if(!this._liveRange)throw new g("marker-destroyed",this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new g("marker-destroyed",this);return this._affectsData}getData(){return{range:this.getRange(),affectsData:this.affectsData,managedUsingOperations:this.managedUsingOperations}}getStart(){if(!this._liveRange)throw new g("marker-destroyed",this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new g("marker-destroyed",this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new g("marker-destroyed",this);return this._liveRange.toRange()}_attachLiveRange(e){return this._liveRange&&this._detachLiveRange(),e.delegate("change:range").to(this),e.delegate("change:content").to(this),this._liveRange=e,e}_detachLiveRange(){this._liveRange.stopDelegating("change:range",this),this._liveRange.stopDelegating("change:content",this),this._liveRange.detach(),this._liveRange=null}}Pi.prototype.is=function(n){return n==="marker"||n==="model:marker"};/**
|
|
554
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
555
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
556
|
+
*/class ME extends Ne{constructor(e,t){super(null),this.sourcePosition=e.clone(),this.howMany=t}get type(){return"detach"}get affectedSelectable(){return null}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e}_validate(){if(this.sourcePosition.root.document)throw new g("detach-operation-on-document-node",this)}_execute(){Wm(b._createFromPositionAndShift(this.sourcePosition,this.howMany))}static get className(){return"DetachOperation"}}/**
|
|
557
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
558
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
559
|
+
*/class mt extends Bt{constructor(e){super(),this.markers=new Map,this._children=new wn,e&&this._insertChild(0,e)}[Symbol.iterator](){return this.getChildren()}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return this.childCount===0}get nextSibling(){return null}get previousSibling(){return null}get root(){return this}get parent(){return null}get document(){return null}isAttached(){return!1}getAncestors(){return[]}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}getPath(){return[]}getNodeByPath(e){let t=this;for(const i of e)t=t.getChild(t.offsetToIndex(i));return t}offsetToIndex(e){return this._children.offsetToIndex(e)}toJSON(){const e=[];for(const t of this._children)e.push(t.toJSON());return e}static fromJSON(e){const t=[];for(const i of e)i.name?t.push(W.fromJSON(i)):t.push(j.fromJSON(i));return new mt(t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const i=FE(t);for(const s of i)s.parent!==null&&s._remove(),s.parent=this;this._children._insertNodes(e,i)}_removeChildren(e,t=1){const i=this._children._removeNodes(e,t);for(const s of i)s.parent=null;return i}}mt.prototype.is=function(n){return n==="documentFragment"||n==="model:documentFragment"};function FE(n){return typeof n=="string"?[new j(n)]:(De(n)||(n=[n]),Array.from(n).map(e=>typeof e=="string"?new j(e):e instanceof Ke?new j(e.data,e.getAttributes()):e))}/**
|
|
560
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
561
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
562
|
+
*/class DE{constructor(e,t){this.model=e,this.batch=t}createText(e,t){return new j(e,t)}createElement(e,t){return new W(e,t)}createDocumentFragment(){return new mt}cloneElement(e,t=!0){return e._clone(t)}insert(e,t,i=0){if(this._assertWriterUsedCorrectly(),e instanceof j&&e.data=="")return;const s=y._createAt(t,i);if(e.parent)if(ou(e.root,s.root)){this.move(b._createOn(e),s);return}else{if(e.root.document)throw new g("model-writer-insert-forbidden-move",this);this.remove(e)}const o=s.root.document?s.root.document.version:null,r=new ge(s,e,o);if(e instanceof j&&(r.shouldReceiveAttributes=!0),this.batch.addOperation(r),this.model.applyOperation(r),e instanceof mt)for(const[a,l]of e.markers){const c=y._createAt(l.root,0),d={range:new b(l.start._getCombined(c,s),l.end._getCombined(c,s)),usingOperation:!0,affectsData:!0};this.model.markers.has(a)?this.updateMarker(a,d):this.addMarker(a,d)}}insertText(e,t,i,s){t instanceof mt||t instanceof W||t instanceof y?this.insert(this.createText(e),t,i):this.insert(this.createText(e,t),i,s)}insertElement(e,t,i,s){t instanceof mt||t instanceof W||t instanceof y?this.insert(this.createElement(e),t,i):this.insert(this.createElement(e,t),i,s)}append(e,t){this.insert(e,t,"end")}appendText(e,t,i){t instanceof mt||t instanceof W?this.insert(this.createText(e),t,"end"):this.insert(this.createText(e,t),i,"end")}appendElement(e,t,i){t instanceof mt||t instanceof W?this.insert(this.createElement(e),t,"end"):this.insert(this.createElement(e,t),i,"end")}setAttribute(e,t,i){if(this._assertWriterUsedCorrectly(),i instanceof b){const s=i.getMinimalFlatRanges();for(const o of s)nu(this,e,t,o)}else su(this,e,t,i)}setAttributes(e,t){for(const[i,s]of vt(e))this.setAttribute(i,s,t)}removeAttribute(e,t){if(this._assertWriterUsedCorrectly(),t instanceof b){const i=t.getMinimalFlatRanges();for(const s of i)nu(this,e,null,s)}else su(this,e,null,t)}clearAttributes(e){this._assertWriterUsedCorrectly();const t=i=>{for(const s of i.getAttributeKeys())this.removeAttribute(s,i)};if(!(e instanceof b))t(e);else for(const i of e.getItems())t(i)}move(e,t,i){if(this._assertWriterUsedCorrectly(),!(e instanceof b))throw new g("writer-move-invalid-range",this);if(!e.isFlat)throw new g("writer-move-range-not-flat",this);const s=y._createAt(t,i);if(s.isEqual(e.start))return;if(this._addOperationForAffectedMarkers("move",e),!ou(e.root,s.root))throw new g("writer-move-different-document",this);const o=e.root.document?e.root.document.version:null,r=new z(e.start,e.end.offset-e.start.offset,s,o);this.batch.addOperation(r),this.model.applyOperation(r)}remove(e){this._assertWriterUsedCorrectly();const i=(e instanceof b?e:b._createOn(e)).getMinimalFlatRanges().reverse();for(const s of i)this._addOperationForAffectedMarkers("move",s),NE(s.start,s.end.offset-s.start.offset,this.batch,this.model)}merge(e){this._assertWriterUsedCorrectly();const t=e.nodeBefore,i=e.nodeAfter;if(this._addOperationForAffectedMarkers("merge",e),!(t instanceof W))throw new g("writer-merge-no-element-before",this);if(!(i instanceof W))throw new g("writer-merge-no-element-after",this);e.root.document?this._merge(e):this._mergeDetached(e)}createPositionFromPath(e,t,i){return this.model.createPositionFromPath(e,t,i)}createPositionAt(e,t){return this.model.createPositionAt(e,t)}createPositionAfter(e){return this.model.createPositionAfter(e)}createPositionBefore(e){return this.model.createPositionBefore(e)}createRange(e,t){return this.model.createRange(e,t)}createRangeIn(e){return this.model.createRangeIn(e)}createRangeOn(e){return this.model.createRangeOn(e)}createSelection(...e){return this.model.createSelection(...e)}_mergeDetached(e){const t=e.nodeBefore,i=e.nodeAfter;this.move(b._createIn(i),y._createAt(t,"end")),this.remove(i)}_merge(e){const t=y._createAt(e.nodeBefore,"end"),i=y._createAt(e.nodeAfter,0),s=e.root.document.graveyard,o=new y(s,[0]),r=e.root.document.version,a=new re(i,e.nodeAfter.maxOffset,t,o,r);this.batch.addOperation(a),this.model.applyOperation(a)}rename(e,t){if(this._assertWriterUsedCorrectly(),!(e instanceof W))throw new g("writer-rename-not-element-instance",this);const i=e.root.document?e.root.document.version:null,s=new Pe(y._createBefore(e),e.name,t,i);this.batch.addOperation(s),this.model.applyOperation(s)}split(e,t){this._assertWriterUsedCorrectly();let i=e.parent;if(!i.parent)throw new g("writer-split-element-no-parent",this);if(t||(t=i.parent),!e.parent.getAncestors({includeSelf:!0}).includes(t))throw new g("writer-split-invalid-limit-element",this);let s,o;do{const r=i.root.document?i.root.document.version:null,a=i.maxOffset-e.offset,l=G.getInsertionPosition(e),c=new G(e,a,l,null,r);this.batch.addOperation(c),this.model.applyOperation(c),!s&&!o&&(s=i,o=e.parent.nextSibling),e=this.createPositionAfter(e.parent),i=e.parent}while(i!==t);return{position:e,range:new b(y._createAt(s,"end"),y._createAt(o,0))}}wrap(e,t){if(this._assertWriterUsedCorrectly(),!e.isFlat)throw new g("writer-wrap-range-not-flat",this);const i=t instanceof W?t:new W(t);if(i.childCount>0)throw new g("writer-wrap-element-not-empty",this);if(i.parent!==null)throw new g("writer-wrap-element-attached",this);this.insert(i,e.start);const s=new b(e.start.getShiftedBy(1),e.end.getShiftedBy(1));this.move(s,y._createAt(i,0))}unwrap(e){if(this._assertWriterUsedCorrectly(),e.parent===null)throw new g("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 g("writer-addmarker-no-usingoperation",this);const i=t.usingOperation,s=t.range,o=t.affectsData===void 0?!1:t.affectsData;if(this.model.markers.has(e))throw new g("writer-addmarker-marker-exists",this);if(!s)throw new g("writer-addmarker-no-range",this);return i?(on(this,e,null,s,o),this.model.markers.get(e)):this.model.markers._set(e,s,i,o)}updateMarker(e,t){this._assertWriterUsedCorrectly();const i=typeof e=="string"?e:e.name,s=this.model.markers.get(i);if(!s)throw new g("writer-updatemarker-marker-not-exists",this);if(!t){H("writer-updatemarker-reconvert-using-editingcontroller",{markerName:i}),this.model.markers._refresh(s);return}const o=typeof t.usingOperation=="boolean",r=typeof t.affectsData=="boolean",a=r?t.affectsData:s.affectsData;if(!o&&!t.range&&!r)throw new g("writer-updatemarker-wrong-options",this);const l=s.getRange(),c=t.range?t.range:l;if(o&&t.usingOperation!==s.managedUsingOperations){t.usingOperation?on(this,i,null,c,a):(on(this,i,l,null,a),this.model.markers._set(i,c,void 0,a));return}s.managedUsingOperations?on(this,i,l,c,a):this.model.markers._set(i,c,void 0,a)}removeMarker(e){this._assertWriterUsedCorrectly();const t=typeof e=="string"?e:e.name;if(!this.model.markers.has(t))throw new g("writer-removemarker-no-marker",this);const i=this.model.markers.get(t);if(!i.managedUsingOperations){this.model.markers._remove(t);return}const s=i.getRange();on(this,t,s,null,i.affectsData)}addRoot(e,t="$root"){this._assertWriterUsedCorrectly();const i=this.model.document.getRoot(e);if(i&&i.isAttached())throw new g("writer-addroot-root-exists",this);const s=this.model.document,o=new nt(e,t,!0,s,s.version);return this.batch.addOperation(o),this.model.applyOperation(o),this.model.document.getRoot(e)}detachRoot(e){this._assertWriterUsedCorrectly();const t=typeof e=="string"?this.model.document.getRoot(e):e;if(!t||!t.isAttached())throw new g("writer-detachroot-no-root",this);for(const o of this.model.markers)o.getRange().root===t&&this.removeMarker(o);for(const o of t.getAttributeKeys())this.removeAttribute(o,t);this.remove(this.createRangeIn(t));const i=this.model.document,s=new nt(t.rootName,t.name,!1,i,i.version);this.batch.addOperation(s),this.model.applyOperation(s)}setSelection(...e){this._assertWriterUsedCorrectly(),this.model.document.selection._setTo(...e)}setSelectionFocus(e,t){this._assertWriterUsedCorrectly(),this.model.document.selection._setFocus(e,t)}setSelectionAttribute(e,t){if(this._assertWriterUsedCorrectly(),typeof e=="string")this._setSelectionAttribute(e,t);else for(const[i,s]of vt(e))this._setSelectionAttribute(i,s)}removeSelectionAttribute(e){if(this._assertWriterUsedCorrectly(),typeof e=="string")this._removeSelectionAttribute(e);else for(const t of e)this._removeSelectionAttribute(t)}overrideSelectionGravity(){return this.model.document.selection._overrideGravity()}restoreSelectionGravity(e){this.model.document.selection._restoreGravity(e)}_setSelectionAttribute(e,t){const i=this.model.document.selection;if(i.isCollapsed&&i.anchor.parent.isEmpty){const s=Ye._getStoreAttributeKey(e);this.setAttribute(s,t,i.anchor.parent)}i._setAttribute(e,t)}_removeSelectionAttribute(e){const t=this.model.document.selection;if(t.isCollapsed&&t.anchor.parent.isEmpty){const i=Ye._getStoreAttributeKey(e);this.removeAttribute(i,t.anchor.parent)}t._removeAttribute(e)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new g("writer-incorrect-use",this)}_addOperationForAffectedMarkers(e,t){for(const i of this.model.markers){if(!i.managedUsingOperations)continue;const s=i.getRange();let o=!1;if(e==="move"){const r=t;o=r.containsPosition(s.start)||r.start.isEqual(s.start)||r.containsPosition(s.end)||r.end.isEqual(s.end)}else{const r=t,a=r.nodeBefore,l=r.nodeAfter,c=s.start.parent==a&&s.start.isAtEnd,u=s.end.parent==l&&s.end.offset==0,d=s.end.nodeAfter==l,h=s.start.nodeAfter==l;o=c||u||d||h}o&&this.updateMarker(i.name,{range:s})}}}function nu(n,e,t,i){const s=n.model,o=s.document;let r=i.start,a,l,c;for(const d of i.getWalker({shallow:!0}))c=d.item.getAttribute(e),a&&l!=c&&(l!=t&&u(),r=a),a=d.nextPosition,l=c;a instanceof y&&a!=r&&l!=t&&u();function u(){const d=new b(r,a),h=d.root.document?o.version:null,f=new le(d,e,l,t,h);n.batch.addOperation(f),s.applyOperation(f)}}function su(n,e,t,i){const s=n.model,o=s.document,r=i.getAttribute(e);let a,l;if(r!=t){if(i.root===i){const u=i.document?o.version:null;l=new bt(i,e,r,t,u)}else{a=new b(y._createBefore(i),n.createPositionAfter(i));const u=a.root.document?o.version:null;l=new le(a,e,r,t,u)}n.batch.addOperation(l),s.applyOperation(l)}}function on(n,e,t,i,s){const o=n.model,r=o.document,a=new Ie(e,t,i,o.markers,!!s,r.version);n.batch.addOperation(a),o.applyOperation(a)}function NE(n,e,t,i){let s;if(n.root.document){const o=i.document,r=new y(o.graveyard,[0]);s=new z(n,e,r,o.version)}else s=new ME(n,e);t.addOperation(s),i.applyOperation(s)}function ou(n,e){return n===e||n instanceof Ws&&e instanceof Ws}/**
|
|
563
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
564
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
565
|
+
*/function $E(n,e,t={}){if(e.isCollapsed)return;const i=e.getFirstRange();if(i.root.rootName=="$graveyard")return;const s=n.schema;n.change(o=>{if(!t.doNotResetEntireContent&&ZE(s,e)){KE(o,e);return}const r={};if(!t.doNotAutoparagraph){const c=e.getSelectedElement();c&&Object.assign(r,s.getAttributesWithProperty(c,"copyOnReplace",!0))}const[a,l]=zE(i);a.isTouching(l)||o.remove(o.createRange(a,l)),t.leaveUnmerged||(UE(o,a,l),s.removeDisallowedAttributes(a.parent.getChildren(),o)),Ym(o,e,a),!t.doNotAutoparagraph&&jE(s,a)&&Jm(o,a,e,r),a.detach(),l.detach()})}function zE(n){const e=n.root.document.model,t=n.start;let i=n.end;if(e.hasContent(n,{ignoreMarkers:!0})){const s=HE(i);if(s&&i.isTouching(e.createPositionAt(s,0))){const o=e.createSelection(n);e.modifySelection(o,{direction:"backward"});const r=o.getLastPosition(),a=e.createRange(r,i);e.hasContent(a,{ignoreMarkers:!0})||(i=r)}}return[pe.fromPosition(t,"toPrevious"),pe.fromPosition(i,"toNext")]}function HE(n){const e=n.parent,t=e.root.document.model.schema,i=e.getAncestors({parentFirst:!0,includeSelf:!0});for(const s of i){if(t.isLimit(s))return null;if(t.isBlock(s))return s}}function UE(n,e,t){const i=n.model;if(!Za(n.model.schema,e,t))return;const[s,o]=qE(e,t);!s||!o||(!i.hasContent(s,{ignoreMarkers:!0})&&i.hasContent(o,{ignoreMarkers:!0})?Zm(n,e,t,s.parent):Km(n,e,t,s.parent))}function Km(n,e,t,i){const s=e.parent,o=t.parent;if(!(s==i||o==i)){for(e=n.createPositionAfter(s),t=n.createPositionBefore(o),t.isEqual(e)||n.insert(o,e),n.merge(e);t.parent.isEmpty;){const r=t.parent;t=n.createPositionBefore(r),n.remove(r)}Za(n.model.schema,e,t)&&Km(n,e,t,i)}}function Zm(n,e,t,i){const s=e.parent,o=t.parent;if(!(s==i||o==i)){for(e=n.createPositionAfter(s),t=n.createPositionBefore(o),t.isEqual(e)||n.insert(s,t);e.parent.isEmpty;){const r=e.parent;e=n.createPositionBefore(r),n.remove(r)}t=n.createPositionBefore(o),WE(n,t),Za(n.model.schema,e,t)&&Zm(n,e,t,i)}}function WE(n,e){const t=e.nodeBefore,i=e.nodeAfter;t.name!=i.name&&n.rename(t,i.name),n.clearAttributes(t),n.setAttributes(Object.fromEntries(i.getAttributes()),t),n.merge(e)}function Za(n,e,t){const i=e.parent,s=t.parent;return i==s||n.isLimit(i)||n.isLimit(s)?!1:GE(e,t,n)}function qE(n,e){const t=n.getAncestors(),i=e.getAncestors();let s=0;for(;t[s]&&t[s]==i[s];)s++;return[t[s],i[s]]}function jE(n,e){const t=n.checkChild(e,"$text"),i=n.checkChild(e,"paragraph");return!t&&i}function GE(n,e,t){const i=new b(n,e);for(const s of i.getWalker())if(t.isLimit(s.item))return!1;return!0}function Jm(n,e,t,i={}){const s=n.createElement("paragraph");n.model.schema.setAllowedAttributes(s,i,n),n.insert(s,e),Ym(n,t,n.createPositionAt(s,0))}function KE(n,e){const t=n.model.schema.getLimitElement(e);n.remove(n.createRangeIn(t)),Jm(n,n.createPositionAt(t,0),e)}function ZE(n,e){const t=n.getLimitElement(e);if(!e.containsEntireContent(t))return!1;const i=e.getFirstRange();return i.start.parent==i.end.parent?!1:n.checkChild(t,"paragraph")}function Ym(n,e,t){e instanceof Ye?n.setSelection(t):e.setTo(t)}/**
|
|
566
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
567
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
568
|
+
*/function JE(n,e){return n.change(t=>{const i=t.createDocumentFragment(),s=e.getFirstRange();if(!s||s.isCollapsed)return i;const o=s.start.root,r=s.start.getCommonPath(s.end),a=o.getNodeByPath(r);let l;s.start.parent==s.end.parent?l=s:l=t.createRange(t.createPositionAt(a,s.start.path[r.length]),t.createPositionAt(a,s.end.path[r.length]+1));const c=l.end.offset-l.start.offset;for(const u of l.getItems({shallow:!0}))u.is("$textProxy")?t.appendText(u.data,u.getAttributes(),i):t.append(t.cloneElement(u,!0),i);if(l!=s){const u=s._getTransformedByMove(l.start,t.createPositionAt(i,0),c)[0],d=t.createRange(t.createPositionAt(i,0),u.start),h=t.createRange(u.end,t.createPositionAt(i,"end"));ru(h,t),ru(d,t)}return i})}function ru(n,e){const t=[];Array.from(n.getItems({direction:"backward"})).map(i=>e.createRangeOn(i)).filter(i=>(i.start.isAfter(n.start)||i.start.isEqual(n.start))&&(i.end.isBefore(n.end)||i.end.isEqual(n.end))).forEach(i=>{t.push(i.start.parent),e.remove(i)}),t.forEach(i=>{let s=i;for(;s.parent&&s.isEmpty;){const o=e.createRangeOn(s);s=s.parent,e.remove(o)}})}/**
|
|
569
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
570
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
571
|
+
*/function YE(n,e,t){return n.change(i=>{const s=t||n.document.selection;s.isCollapsed||n.deleteContent(s,{doNotAutoparagraph:!0});const o=new QE(n,i,s.anchor),r=[];let a;if(e.is("documentFragment")){if(e.markers.size){const u=[];for(const[d,h]of e.markers){const{start:f,end:m}=h,p=f.isEqual(m);u.push({position:f,name:d,isCollapsed:p},{position:m,name:d,isCollapsed:p})}u.sort(({position:d},{position:h})=>d.isBefore(h)?1:-1);for(const{position:d,name:h,isCollapsed:f}of u){let m=null,p=null;const _=d.parent===e&&d.isAtStart,C=d.parent===e&&d.isAtEnd;!_&&!C?(m=i.createElement("$marker"),i.insert(m,d)):f&&(p=_?"start":"end"),r.push({name:h,element:m,collapsed:p})}}a=e.getChildren()}else a=[e];o.handleNodes(a);let l=o.getSelectionRange();if(e.is("documentFragment")&&r.length){const u=l?Fe.fromRange(l):null,d={};for(let h=r.length-1;h>=0;h--){const{name:f,element:m,collapsed:p}=r[h],_=!d[f];if(_&&(d[f]=[]),m){const C=i.createPositionAt(m,"before");d[f].push(C),i.remove(m)}else{const C=o.getAffectedRange();if(!C){p&&d[f].push(o.position);continue}p?d[f].push(C[p]):d[f].push(_?C.start:C.end)}}for(const[h,[f,m]]of Object.entries(d))f&&m&&f.root===m.root&&i.addMarker(h,{usingOperation:!0,affectsData:!0,range:new b(f,m)});u&&(l=u.toRange(),u.detach())}/* istanbul ignore else -- @preserve */l&&(s instanceof Ye?i.setSelection(l):s.setTo(l));const c=o.getAffectedRange()||n.createRange(s.anchor);return o.destroy(),c})}class QE{constructor(e,t,i){this._firstNode=null,this._lastNode=null,this._lastAutoParagraph=null,this._filterAttributesOf=[],this._affectedStart=null,this._affectedEnd=null,this._nodeToSelect=null,this.model=e,this.writer=t,this.position=i,this.canMergeWith=new Set([this.position.parent]),this.schema=e.schema,this._documentFragment=t.createDocumentFragment(),this._documentFragmentPosition=t.createPositionAt(this._documentFragment,0)}handleNodes(e){for(const t of Array.from(e))this._handleNode(t);this._insertPartialFragment(),this._lastAutoParagraph&&this._updateLastNodeFromAutoParagraph(this._lastAutoParagraph),this._mergeOnRight(),this.schema.removeDisallowedAttributes(this._filterAttributesOf,this.writer),this._filterAttributesOf=[]}_updateLastNodeFromAutoParagraph(e){const t=this.writer.createPositionAfter(this._lastNode),i=this.writer.createPositionAfter(e);if(i.isAfter(t)){this._lastNode=e;/* istanbul ignore if -- @preserve */if(this.position.parent!=e||!this.position.isAtEnd)throw new g("insertcontent-invalid-insertion-position",this);this.position=i,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.schema.isObject(e)){this._handleObject(e);return}let t=this._checkAndAutoParagraphToAllowedPosition(e);if(!t&&(t=this._checkAndSplitToAllowedPosition(e),!t)){this._handleDisallowedNode(e);return}this._appendToFragment(e),this._firstNode||(this._firstNode=e),this._lastNode=e}_insertPartialFragment(){if(this._documentFragment.isEmpty)return;const e=pe.fromPosition(this.position,"toNext");this._setAffectedBoundaries(this.position),this._documentFragment.getChild(0)==this._firstNode&&(this.writer.insert(this._firstNode,this.position),this._mergeOnLeft(),this.position=e.toPosition()),this._documentFragment.isEmpty||this.writer.insert(this._documentFragment,this.position),this._documentFragmentPosition=this.writer.createPositionAt(this._documentFragment,0),this.position=e.toPosition(),e.detach()}_handleObject(e){this._checkAndSplitToAllowedPosition(e)?this._appendToFragment(e):this._tryAutoparagraphing(e)}_handleDisallowedNode(e){e.is("element")?this.handleNodes(e.getChildren()):this._tryAutoparagraphing(e)}_appendToFragment(e){/* istanbul ignore if -- @preserve */if(!this.schema.checkChild(this.position,e))throw new g("insertcontent-wrong-position",this,{node:e,position:this.position});this.writer.insert(e,this._documentFragmentPosition),this._documentFragmentPosition=this._documentFragmentPosition.getShiftedBy(e.offsetSize),this.schema.isObject(e)&&!this.schema.checkChild(this.position,"$text")?this._nodeToSelect=e:this._nodeToSelect=null,this._filterAttributesOf.push(e)}_setAffectedBoundaries(e){this._affectedStart||(this._affectedStart=pe.fromPosition(e,"toPrevious")),(!this._affectedEnd||this._affectedEnd.isBefore(e))&&(this._affectedEnd&&this._affectedEnd.detach(),this._affectedEnd=pe.fromPosition(e,"toNext"))}_mergeOnLeft(){const e=this._firstNode;if(!(e instanceof W)||!this._canMergeLeft(e))return;const t=pe._createBefore(e);t.stickiness="toNext";const i=pe.fromPosition(this.position,"toNext");this._affectedStart.isEqual(t)&&(this._affectedStart.detach(),this._affectedStart=pe._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=pe._createAt(t.nodeBefore,"end","toNext")),this.position=i.toPosition(),i.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_mergeOnRight(){const e=this._lastNode;if(!(e instanceof W)||!this._canMergeRight(e))return;const t=pe._createAfter(e);t.stickiness="toNext";/* istanbul ignore if -- @preserve */if(!this.position.isEqual(t))throw new g("insertcontent-invalid-insertion-position",this);this.position=y._createAt(t.nodeBefore,"end");const i=pe.fromPosition(this.position,"toPrevious");this._affectedEnd.isEqual(t)&&(this._affectedEnd.detach(),this._affectedEnd=pe._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=pe._createAt(t.nodeBefore,0,"toPrevious")),this.position=i.toPosition(),i.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_canMergeLeft(e){const t=e.previousSibling;return t instanceof W&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(t,e)}_canMergeRight(e){const t=e.nextSibling;return t instanceof W&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(e,t)}_tryAutoparagraphing(e){const t=this.writer.createElement("paragraph");this._getAllowedIn(this.position.parent,t)&&this.schema.checkChild(t,e)&&(t._appendChild(e),this._handleNode(t))}_checkAndAutoParagraphToAllowedPosition(e){if(this.schema.checkChild(this.position.parent,e))return!0;if(!this.schema.checkChild(this.position.parent,"paragraph")||!this.schema.checkChild("paragraph",e))return!1;this._insertPartialFragment();const t=this.writer.createElement("paragraph");return this.writer.insert(t,this.position),this._setAffectedBoundaries(this.position),this._lastAutoParagraph=t,this.position=this.writer.createPositionAt(t,0),!0}_checkAndSplitToAllowedPosition(e){const t=this._getAllowedIn(this.position.parent,e);if(!t)return!1;for(t!=this.position.parent&&this._insertPartialFragment();t!=this.position.parent;)if(this.position.isAtStart){const i=this.position.parent;this.position=this.writer.createPositionBefore(i),i.isEmpty&&i.parent===t&&this.writer.remove(i)}else if(this.position.isAtEnd)this.position=this.writer.createPositionAfter(this.position.parent);else{const i=this.writer.createPositionAfter(this.position.parent);this._setAffectedBoundaries(this.position),this.writer.split(this.position),this.position=i,this.canMergeWith.add(this.position.nodeAfter)}return!0}_getAllowedIn(e,t){return this.schema.checkChild(e,t)?e:this.schema.isLimit(e)?null:this._getAllowedIn(e.parent,t)}}/**
|
|
572
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
573
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
574
|
+
*/function XE(n,e,t,i={}){if(!n.schema.isObject(e))throw new g("insertobject-element-not-an-object",n,{object:e});const s=t||n.document.selection;let o=s;i.findOptimalPosition&&n.schema.isBlock(e)&&(o=n.createSelection(n.schema.findOptimalInsertionRange(s,i.findOptimalPosition)));const r=J(s.getSelectedBlocks()),a={};return r&&Object.assign(a,n.schema.getAttributesWithProperty(r,"copyOnReplace",!0)),n.change(l=>{o.isCollapsed||n.deleteContent(o,{doNotAutoparagraph:!0});let c=e;const u=o.anchor.parent;!n.schema.checkChild(u,e)&&n.schema.checkChild(u,"paragraph")&&n.schema.checkChild("paragraph",e)&&(c=l.createElement("paragraph"),l.insert(e,c)),n.schema.setAllowedAttributes(c,a,l);const d=n.insertContent(c,o);return d.isCollapsed||i.setSelection&&eT(l,e,i.setSelection,a),d})}function eT(n,e,t,i){const s=n.model;if(t=="on"){n.setSelection(e,"on");return}if(t!="after")throw new g("insertobject-invalid-place-parameter-value",s);let o=e.nextSibling;if(s.schema.isInline(e)){n.setSelection(e,"after");return}!(o&&s.schema.checkChild(o,"$text"))&&s.schema.checkChild(e.parent,"paragraph")&&(o=n.createElement("paragraph"),s.schema.setAllowedAttributes(o,i,n),s.insertContent(o,n.createPositionAfter(e))),o&&n.setSelection(o,0)}/**
|
|
575
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
576
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
577
|
+
*/const tT=' ,.?!:;"-()';function iT(n,e,t={}){const i=n.schema,s=t.direction!="backward",o=t.unit?t.unit:"character",r=!!t.treatEmojiAsSingleUnit,a=e.focus,l=new pt({boundaries:rT(a,s),singleCharacters:!0,direction:s?"forward":"backward"}),c={walker:l,schema:i,isForward:s,unit:o,treatEmojiAsSingleUnit:r};let u;for(;u=l.next();){if(u.done)return;const d=nT(c,u.value);if(d){e instanceof Ye?n.change(h=>{h.setSelectionFocus(d)}):e.setFocus(d);return}}}function nT(n,e){const{isForward:t,walker:i,unit:s,schema:o,treatEmojiAsSingleUnit:r}=n,{type:a,item:l,nextPosition:c}=e;if(a=="text")return n.unit==="word"?oT(i,t):sT(i,s,r);if(a==(t?"elementStart":"elementEnd")){if(o.isSelectable(l))return y._createAt(l,t?"after":"before");if(o.checkChild(c,"$text"))return c}else{if(o.isLimit(l)){i.skip(()=>!0);return}if(o.checkChild(c,"$text"))return c}}function sT(n,e,t){const i=n.position.textNode;if(i){const s=i.data;let o=n.position.offset-i.startOffset;for(;Ma(s,o)||e=="character"&&Fa(s,o)||t&&Df(s,o);)n.next(),o=n.position.offset-i.startOffset}return n.position}function oT(n,e){let t=n.position.textNode;for(t||(t=e?n.position.nodeAfter:n.position.nodeBefore);t&&t.is("$text");){const i=n.position.offset-t.startOffset;if(lT(t,i,e))t=e?n.position.nodeAfter:n.position.nodeBefore;else{if(aT(t.data,i,e))break;n.next()}}return n.position}function rT(n,e){const t=n.root,i=y._createAt(t,e?"end":0);return e?new b(n,i):new b(i,n)}function aT(n,e,t){const i=e+(t?0:-1);return tT.includes(n.charAt(i))}function lT(n,e,t){return e===(t?n.offsetSize:0)}/**
|
|
578
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
579
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
580
|
+
*/let cT=class extends U(){constructor(){super(),this.markers=new OE,this.document=new BE(this),this.schema=new J5,this._pendingChanges=[],this._currentWriter=null,["deleteContent","modifySelection","getSelectedContent","applyOperation"].forEach(e=>this.decorate(e)),this.on("applyOperation",(e,t)=>{t[0]._validate()},{priority:"highest"}),this.schema.register("$root",{isLimit:!0}),this.schema.register("$container",{allowIn:["$root","$container"]}),this.schema.register("$block",{allowIn:["$root","$container"],isBlock:!0}),this.schema.register("$blockObject",{allowWhere:"$block",isBlock:!0,isObject:!0}),this.schema.register("$inlineObject",{allowWhere:"$text",allowAttributesOf:"$text",isInline:!0,isObject:!0}),this.schema.register("$text",{allowIn:"$block",isInline:!0,isContent:!0}),this.schema.register("$clipboardHolder",{allowContentOf:"$root",allowChildren:"$text",isLimit:!0}),this.schema.register("$documentFragment",{allowContentOf:"$root",allowChildren:"$text",isLimit:!0}),this.schema.register("$marker"),this.schema.addChildCheck((e,t)=>{if(t.name==="$marker")return!0}),z5(this),this.document.registerPostFixer(Fm),this.on("insertContent",(e,[t,i])=>{e.return=YE(this,t,i)}),this.on("insertObject",(e,[t,i,s])=>{e.return=XE(this,t,i,s)}),this.on("canEditAt",e=>{const t=!this.document.isReadOnly;e.return=t,t||e.stop()})}change(e){try{return this._pendingChanges.length===0?(this._pendingChanges.push({batch:new _i,callback:e}),this._runPendingChanges()[0]):e(this._currentWriter)}catch(t){/* istanbul ignore next -- @preserve */g.rethrowUnexpectedError(t,this)}}enqueueChange(e,t){try{e?typeof e=="function"?(t=e,e=new _i):e instanceof _i||(e=new _i(e)):e=new _i,this._pendingChanges.push({batch:e,callback:t}),this._pendingChanges.length==1&&this._runPendingChanges()}catch(i){/* istanbul ignore next -- @preserve */g.rethrowUnexpectedError(i,this)}}applyOperation(e){e._execute()}insertContent(e,t,i,...s){const o=No(t,i);return this.fire("insertContent",[e,o,i,...s])}insertObject(e,t,i,s,...o){const r=No(t,i);return this.fire("insertObject",[e,r,s,s,...o])}deleteContent(e,t){$E(this,e,t)}modifySelection(e,t){iT(this,e,t)}getSelectedContent(e){return JE(this,e)}hasContent(e,t={}){const i=e instanceof b?e:b._createIn(e);if(i.isCollapsed)return!1;const{ignoreWhitespaces:s=!1,ignoreMarkers:o=!1}=t;if(!o){for(const r of this.markers.getMarkersIntersectingRange(i))if(r.affectsData)return!0}for(const r of i.getItems())if(this.schema.isContent(r))if(r.is("$textProxy"))if(s){if(r.data.search(/\S/)!==-1)return!0}else return!0;else return!0;return!1}canEditAt(e){const t=No(e);return this.fire("canEditAt",[t])}createPositionFromPath(e,t,i){return new y(e,t,i)}createPositionAt(e,t){return y._createAt(e,t)}createPositionAfter(e){return y._createAfter(e)}createPositionBefore(e){return y._createBefore(e)}createRange(e,t){return new b(e,t)}createRangeIn(e){return b._createIn(e)}createRangeOn(e){return b._createOn(e)}createSelection(...e){return new Oe(...e)}createBatch(e){return new _i(e)}createOperationFromJSON(e){return CE.fromJSON(e,this.document)}destroy(){this.document.destroy(),this.stopListening()}_runPendingChanges(){const e=[];this.fire("_beforeChanges");try{for(;this._pendingChanges.length;){const t=this._pendingChanges[0].batch;this._currentWriter=new DE(this,t);const i=this._pendingChanges[0].callback(this._currentWriter);e.push(i),this.document._handleChangeBlock(this._currentWriter),this._pendingChanges.shift(),this._currentWriter=null}}finally{this._pendingChanges.length=0,this._currentWriter=null,this.fire("_afterChanges")}return e}};function No(n,e){if(n)return n instanceof Oe||n instanceof Ye?n:n instanceof ui?e||e===0?new Oe(n,e):n.is("rootElement")?new Oe(n,"in"):new Oe(n,"on"):new Oe(n)}/**
|
|
581
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
582
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
583
|
+
*/class uT extends Lt{constructor(){super(...arguments),this.domEventType="click"}onDomEvent(e){this.fire(e.type,e)}}/**
|
|
584
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
585
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
586
|
+
*/class go extends Lt{constructor(){super(...arguments),this.domEventType=["mousedown","mouseup","mouseover","mouseout"]}onDomEvent(e){this.fire(e.type,e)}}/**
|
|
587
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
588
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
589
|
+
*/class Yi{constructor(e){this.document=e}createDocumentFragment(e){return new Zt(this.document,e)}createElement(e,t,i){return new Je(this.document,e,t,i)}createText(e){return new te(this.document,e)}clone(e,t=!1){return e._clone(t)}appendChild(e,t){return t._appendChild(e)}insertChild(e,t,i){return i._insertChild(e,t)}removeChildren(e,t,i){return i._removeChildren(e,t)}remove(e){const t=e.parent;return t?this.removeChildren(t.getChildIndex(e),1,t):[]}replace(e,t){const i=e.parent;if(i){const s=i.getChildIndex(e);return this.removeChildren(s,1,i),this.insertChild(s,t,i),!0}return!1}unwrapElement(e){const t=e.parent;if(t){const i=t.getChildIndex(e);this.remove(e),this.insertChild(i,e.getChildren(),t)}}rename(e,t){const i=new Je(this.document,e,t.getAttributes(),t.getChildren());return this.replace(t,i)?i:null}setAttribute(e,t,i){i._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,i){Se(e)&&i===void 0?t._setStyle(e):i._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,i){i._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}createPositionAt(e,t){return k._createAt(e,t)}createPositionAfter(e){return k._createAfter(e)}createPositionBefore(e){return k._createBefore(e)}createRange(e,t){return new F(e,t)}createRangeOn(e){return F._createOn(e)}createRangeIn(e){return F._createIn(e)}createSelection(...e){return new wt(...e)}}/**
|
|
590
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
591
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
592
|
+
*/const dT=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,hT=/^rgb\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}[0-9]{1,3}[ %]?\)$/i,fT=/^rgba\([ ]?([0-9]{1,3}[ %]?,[ ]?){3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,mT=/^hsl\([ ]?([0-9]{1,3}[ %]?[,]?[ ]*){3}(1|[0-9]+%|[0]?\.?[0-9]+)?\)$/i,gT=/^hsla\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,pT=/\w+\((?:[^()]|\([^()]*\))*\)|\S+/gi,wT=new Set(["black","silver","gray","white","maroon","red","purple","fuchsia","green","lime","olive","yellow","navy","blue","teal","aqua","orange","aliceblue","antiquewhite","aquamarine","azure","beige","bisque","blanchedalmond","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","gainsboro","ghostwhite","gold","goldenrod","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","limegreen","linen","magenta","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","oldlace","olivedrab","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","thistle","tomato","turquoise","violet","wheat","whitesmoke","yellowgreen","activeborder","activecaption","appworkspace","background","buttonface","buttonhighlight","buttonshadow","buttontext","captiontext","graytext","highlight","highlighttext","inactiveborder","inactivecaption","inactivecaptiontext","infobackground","infotext","menu","menutext","scrollbar","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","window","windowframe","windowtext","rebeccapurple","currentcolor","transparent"]);function bT(n){return n.startsWith("#")?dT.test(n):n.startsWith("rgb")?hT.test(n)||fT.test(n):n.startsWith("hsl")?mT.test(n)||gT.test(n):wT.has(n.toLowerCase())}const _T=/^([+-]?[0-9]*([.][0-9]+)?(px|cm|mm|in|pc|pt|ch|em|ex|rem|vh|vw|vmin|vmax)|0)$/;function vT(n){return _T.test(n)}const yT=/^[+-]?[0-9]*([.][0-9]+)?%$/;function CT(n){return yT.test(n)}const kT=["repeat-x","repeat-y","repeat","space","round","no-repeat"];function ET(n){return kT.includes(n)}const TT=["center","top","bottom","left","right"];function AT(n){return TT.includes(n)}const ST=["fixed","scroll","local"];function xT(n){return ST.includes(n)}const IT=/^url\(/;function PT(n){return IT.test(n)}function RT(n=""){if(n==="")return{top:void 0,right:void 0,bottom:void 0,left:void 0};const e=Qm(n),t=e[0],i=e[2]||t,s=e[1]||t,o=e[3]||s;return{top:t,bottom:i,right:s,left:o}}function VT(n){return e=>{const{top:t,right:i,bottom:s,left:o}=e,r=[];return[t,i,o,s].every(a=>!!a)?r.push([n,LT(e)]):(t&&r.push([n+"-top",t]),i&&r.push([n+"-right",i]),s&&r.push([n+"-bottom",s]),o&&r.push([n+"-left",o])),r}}function LT({top:n,right:e,bottom:t,left:i}){const s=[];return i!==e?s.push(n,e,t,i):t!==n?s.push(n,e,t):e!==n?s.push(n,e):s.push(n),s.join(" ")}function BT(n){return e=>({path:n,value:RT(e)})}function Qm(n){const e=n.matchAll(pT);return Array.from(e).map(t=>t[0])}/**
|
|
593
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
594
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
595
|
+
*/function OT(n){n.setNormalizer("background",MT()),n.setNormalizer("background-color",FT()),n.setReducer("background",DT()),n.setStyleRelation("background",["background-color"])}function MT(){return n=>{const e={},t=Qm(n);for(const i of t)ET(i)?(e.repeat=e.repeat||[],e.repeat.push(i)):AT(i)?(e.position=e.position||[],e.position.push(i)):xT(i)?e.attachment=i:bT(i)?e.color=i:PT(i)&&(e.image=i);return{path:"background",value:e}}}function FT(){return n=>({path:"background.color",value:n})}function DT(){return n=>{const e=[];return e.push(["background-color",n.color]),e}}/**
|
|
596
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
597
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
598
|
+
*/function NT(n){n.setNormalizer("margin",BT("margin")),n.setNormalizer("margin-top",e=>({path:"margin.top",value:e})),n.setNormalizer("margin-right",e=>({path:"margin.right",value:e})),n.setNormalizer("margin-bottom",e=>({path:"margin.bottom",value:e})),n.setNormalizer("margin-left",e=>({path:"margin.left",value:e})),n.setReducer("margin",VT("margin")),n.setStyleRelation("margin",["margin-top","margin-right","margin-bottom","margin-left"])}/**
|
|
599
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
600
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
601
|
+
*/class $T{constructor(){this._commands=new Map}add(e,t){this._commands.set(e,t)}get(e){return this._commands.get(e)}execute(e,...t){const i=this.get(e);if(!i)throw new g("commandcollection-command-not-found",this,{commandName:e});return i.execute(...t)}*names(){yield*this._commands.keys()}*commands(){yield*this._commands.values()}[Symbol.iterator](){return this._commands[Symbol.iterator]()}destroy(){for(const e of this.commands())e.destroy()}}/**
|
|
602
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
603
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
604
|
+
*/class zT extends ae{constructor(e){super(),this.editor=e}set(e,t,i={}){if(typeof t=="string"){const s=t;t=(o,r)=>{this.editor.execute(s),r()}}super.set(e,t,i)}}/**
|
|
605
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
606
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
607
|
+
*/class HT extends U(){constructor(e={}){super();const t=this.constructor,i=e.language||t.defaultConfig&&t.defaultConfig.language;this._context=e.context||new om({language:i}),this._context._addEditor(this,!e.context);const s=Array.from(t.builtinPlugins||[]);this.config=new Tf(e,t.defaultConfig),this.config.define("plugins",s),this.config.define(this._context._getEditorConfig()),this.plugins=new sm(this,s,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this._readOnlyLocks=new Set,this.commands=new $T,this.set("state","initializing"),this.once("ready",()=>this.state="ready",{priority:"high"}),this.once("destroy",()=>this.state="destroyed",{priority:"high"}),this.model=new cT,this.on("change:isReadOnly",()=>{this.model.document.isReadOnly=this.isReadOnly});const o=new ZC;this.data=new bE(this.model,o),this.editing=new G5(this.model,o),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new vE([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 zT(this),this.keystrokes.listenTo(this.editing.view.document)}get isReadOnly(){return this._readOnlyLocks.size>0}set isReadOnly(e){throw new g("editor-isreadonly-has-no-setter")}enableReadOnlyMode(e){if(typeof e!="string"&&typeof e!="symbol")throw new g("editor-read-only-lock-id-invalid",null,{lockId:e});this._readOnlyLocks.has(e)||(this._readOnlyLocks.add(e),this._readOnlyLocks.size===1&&this.fire("change:isReadOnly","isReadOnly",!0,!1))}disableReadOnlyMode(e){if(typeof e!="string"&&typeof e!="symbol")throw new g("editor-read-only-lock-id-invalid",null,{lockId:e});this._readOnlyLocks.has(e)&&(this._readOnlyLocks.delete(e),this._readOnlyLocks.size===0&&this.fire("change:isReadOnly","isReadOnly",!1,!0))}initPlugins(){const e=this.config,t=e.get("plugins"),i=e.get("removePlugins")||[],s=e.get("extraPlugins")||[],o=e.get("substitutePlugins")||[];return this.plugins.init(t.concat(s),i,o)}destroy(){let e=Promise.resolve();return this.state=="initializing"&&(e=new Promise(t=>this.once("ready",t))),e.then(()=>{this.fire("destroy"),this.stopListening(),this.commands.destroy()}).then(()=>this.plugins.destroy()).then(()=>{this.model.destroy(),this.data.destroy(),this.editing.destroy(),this.keystrokes.destroy()}).then(()=>this._context._removeEditor(this))}execute(e,...t){try{return this.commands.execute(e,...t)}catch(i){/* istanbul ignore next -- @preserve */g.rethrowUnexpectedError(i,this)}}focus(){this.editing.view.focus()}static create(...e){throw new Error("This is an abstract method.")}}/**
|
|
608
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
609
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
610
|
+
*/function UT(n){if(!Xt(n.updateSourceElement))throw new g("attachtoform-missing-elementapi-interface",n);const e=n.sourceElement;if(WT(e)&&e.form){let t;const i=e.form,s=()=>n.updateSourceElement();Xt(i.submit)&&(t=i.submit,i.submit=()=>{s(),t.apply(i)}),i.addEventListener("submit",s),n.on("destroy",()=>{i.removeEventListener("submit",s),t&&(i.submit=t)})}}function WT(n){return!!n&&n.tagName.toLowerCase()==="textarea"}/**
|
|
611
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
612
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
613
|
+
*/function Ss(n){class e extends n{setData(i){this.data.set(i)}getData(i){return this.data.get(i)}}return e}{const n=Ss(Object);Ss.setData=n.prototype.setData,Ss.getData=n.prototype.getData}/**
|
|
614
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
615
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
616
|
+
*/function Nr(n){class e extends n{updateSourceElement(i){if(!this.sourceElement)throw new g("editor-missing-sourceelement",this);const s=this.config.get("updateSourceElementOnDestroy"),o=this.sourceElement instanceof HTMLTextAreaElement;if(!s&&!o){sc(this.sourceElement,"");return}const r=typeof i=="string"?i:this.data.get();sc(this.sourceElement,r)}}return e}Nr.updateSourceElement=Nr(Object).prototype.updateSourceElement;/**
|
|
617
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
618
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
619
|
+
*/class qs extends rm{static get pluginName(){return"PendingActions"}init(){this.set("hasAny",!1),this._actions=new _e({idProperty:"_id"}),this._actions.delegate("add","remove").to(this)}add(e){if(typeof e!="string")throw new g("pendingactions-add-invalid-message",this);const t=new(U());return t.set("message",e),this._actions.add(t),this.hasAny=!0,t}remove(e){this._actions.remove(e),this.hasAny=!!this._actions.length}get first(){return this._actions.get(0)}[Symbol.iterator](){return this._actions[Symbol.iterator]()}}const qT='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.591 10.177 4.243 4.242a1 1 0 0 1-1.415 1.415l-4.242-4.243-4.243 4.243a1 1 0 0 1-1.414-1.415l4.243-4.242L4.52 5.934A1 1 0 0 1 5.934 4.52l4.243 4.243 4.242-4.243a1 1 0 1 1 1.415 1.414l-4.243 4.243z"/></svg>',jT='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 16h9a1 1 0 0 1 0 2H2a1 1 0 0 1 0-2z"/><path d="M17 1a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h14zm0 1.5H3a.5.5 0 0 0-.492.41L2.5 3v9a.5.5 0 0 0 .41.492L3 12.5h14a.5.5 0 0 0 .492-.41L17.5 12V3a.5.5 0 0 0-.41-.492L17 2.5z" fill-opacity=".6"/></svg>',GT='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.972 16.615a.997.997 0 0 1-.744-.292l-4.596-4.596a1 1 0 1 1 1.414-1.414l3.926 3.926 9.937-9.937a1 1 0 0 1 1.414 1.415L7.717 16.323a.997.997 0 0 1-.745.292z"/></svg>',KT='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.333 2 .19 2.263a5.899 5.899 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.19a5.899 5.899 0 0 1-.604 1.458l1.467 1.733-1.886 1.886-1.733-1.467a5.899 5.899 0 0 1-1.46.605L11.334 18H8.667l-.19-2.263a5.899 5.899 0 0 1-1.458-.604L5.286 16.6 3.4 14.714l1.467-1.733a5.899 5.899 0 0 1-.604-1.458L2 11.333V8.667l2.262-.189a5.899 5.899 0 0 1 .605-1.459L3.4 5.286 5.286 3.4l1.733 1.467a5.899 5.899 0 0 1 1.46-.605L8.666 2h2.666zM10 6.267a3.733 3.733 0 1 0 0 7.466 3.733 3.733 0 0 0 0-7.466z"/></svg>',ZT='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.209 18.717A8.5 8.5 0 1 1 18.686 9.6h-.008l.002.12a3 3 0 0 1-2.866 2.997h-.268l-.046-.002v.002h-4.791a2 2 0 1 0 0 4 1 1 0 1 1-.128 1.992 8.665 8.665 0 0 1-.372.008Zm-3.918-7.01a1.25 1.25 0 1 0-2.415-.648 1.25 1.25 0 0 0 2.415.647ZM5.723 8.18a1.25 1.25 0 1 0 .647-2.414 1.25 1.25 0 0 0-.647 2.414ZM9.76 6.155a1.25 1.25 0 1 0 .647-2.415 1.25 1.25 0 0 0-.647 2.415Zm4.028 1.759a1.25 1.25 0 1 0 .647-2.415 1.25 1.25 0 0 0-.647 2.415Z"/></svg>',JT='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m8.636 9.531-2.758 3.94a.5.5 0 0 0 .122.696l3.224 2.284h1.314l2.636-3.736L8.636 9.53zm.288 8.451L5.14 15.396a2 2 0 0 1-.491-2.786l6.673-9.53a2 2 0 0 1 2.785-.49l3.742 2.62a2 2 0 0 1 .491 2.785l-7.269 10.053-2.147-.066z"/><path d="M4 18h5.523v-1H4zm-2 0h1v-1H2z"/></svg>',YT='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><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 1z"/><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.052z"/><path d="M11.5 5v4.999l3.196 3.196-1.06 1.06L10.1 10.72l-.1-.113V5z"/></svg>',QT='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5.085 6.22 2.943 4.078a.75.75 0 1 1 1.06-1.06l2.592 2.59A11.094 11.094 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.488.488 0 0 1-.15.084.75.75 0 0 1-.821-.16L6.17 7.304c-.258.11-.51.233-.757.365l6.239 6.24-.006.005.78.78c-.388.094-.78.166-1.174.215l-1.11-1.11h.011L4.55 8.197a7.2 7.2 0 0 0-.665.514l-.112.098 4.897 4.897-.005.006 1.276 1.276a10.164 10.164 0 0 1-1.477-.117l-.479-.479-.009.009-4.863-4.863-.022.031a2.563 2.563 0 0 0-.124.2c-.043.077-.08.158-.108.241a.534.534 0 0 0-.028.133.29.29 0 0 0 .008.072.927.927 0 0 0 .082.226c.067.133.145.26.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.93zm7.07.531a4.632 4.632 0 0 1 1.108 5.992l.345.344.046-.018a9.313 9.313 0 0 0 2-1.112c.256-.187.5-.392.727-.613.137-.134.27-.277.392-.431.072-.091.141-.185.203-.286.057-.093.107-.19.148-.292a.72.72 0 0 0 .036-.12.29.29 0 0 0 .008-.072.492.492 0 0 0-.028-.133.999.999 0 0 0-.036-.096 2.165 2.165 0 0 0-.071-.145 2.917 2.917 0 0 0-.125-.2 3.592 3.592 0 0 0-.263-.335 5.444 5.444 0 0 0-.53-.523 7.955 7.955 0 0 0-1.054-.768 9.766 9.766 0 0 0-1.879-.891c-.337-.118-.68-.219-1.027-.301zm-2.85.21-.069.002a.508.508 0 0 0-.254.097.496.496 0 0 0-.104.679.498.498 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.494.494 0 0 0 .45.287h.008a.496.496 0 0 0 .35-.158.482.482 0 0 0 .13-.335.638.638 0 0 0-.048-.219 3.379 3.379 0 0 0-.36-.723 3.438 3.438 0 0 0-2.791-1.543l-.028-.001h-.013z"/></svg>',XT='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.035 1C2.446 1 2 1.54 2 2.098V10.5h1.5v-8h13v8H18V2.098C18 1.539 17.48 1 16.9 1H3.035Zm10.453 2.61a1.885 1.885 0 0 0-1.442.736 1.89 1.89 0 0 0 1.011 2.976 1.903 1.903 0 0 0 2.253-1.114 1.887 1.887 0 0 0-1.822-2.598ZM7.463 8.163a.611.611 0 0 0-.432.154L5.071 10.5h5.119L7.88 8.348a.628.628 0 0 0-.417-.185Zm6.236 1.059a.62.62 0 0 0-.42.164L12.07 10.5h2.969l-.92-1.113a.618.618 0 0 0-.42-.165ZM.91 11.5a.91.91 0 0 0-.91.912v6.877c0 .505.405.91.91.91h18.178a.91.91 0 0 0 .912-.91v-6.877a.908.908 0 0 0-.912-.912H.91ZM3.668 13h1.947l2.135 5.7H5.898l-.28-.946H3.601l-.278.945H1.516L3.668 13Zm4.947 0h1.801v4.3h2.7v1.4h-4.5V13h-.001Zm4.5 0h5.4v1.4h-1.798v4.3h-1.701v-4.3h-1.9V13h-.001Zm-8.517 1.457-.614 2.059h1.262l-.648-2.059Z"/></svg>',eA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.68 13.74h-.001l4.209 4.208a1 1 0 1 0 1.414-1.414l-4.267-4.268a6 6 0 1 0-1.355 1.474ZM13 9a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z"/></svg>',tA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.463 5.187a.888.888 0 1 1 1.254 1.255L9.16 10l3.557 3.557a.888.888 0 1 1-1.254 1.255L7.26 10.61a.888.888 0 0 1 .16-1.382l4.043-4.042z"/></svg>',iA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8.537 14.813a.888.888 0 1 1-1.254-1.255L10.84 10 7.283 6.442a.888.888 0 1 1 1.254-1.255L12.74 9.39a.888.888 0 0 1-.16 1.382l-4.043 4.042z"/></svg>',nA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><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.1l4.16-4.482ZM17.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 1h15.6Zm-5.655 6a2.128 2.128 0 0 1 .157-2.364A2.133 2.133 0 1 1 12.145 7Z"/></svg>',sA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M1.201 1C.538 1 0 1.47 0 2.1v14.363c0 .64.534 1.037 1.186 1.037h9.494a2.97 2.97 0 0 1-.414-.287 2.998 2.998 0 0 1-1.055-2.03 3.003 3.003 0 0 1 .693-2.185l.383-.455-.02.018-3.65-3.41a.695.695 0 0 0-.957-.034L1.5 13.6V2.5h15v5.535a2.97 2.97 0 0 1 1.412.932l.088.105V2.1c0-.63-.547-1.1-1.2-1.1H1.202Zm11.713 2.803a2.146 2.146 0 0 0-2.049 1.992 2.14 2.14 0 0 0 1.28 2.096 2.13 2.13 0 0 0 2.644-3.11 2.134 2.134 0 0 0-1.875-.978Z"/><path d="M15.522 19.1a.79.79 0 0 0 .79-.79v-5.373l2.059 2.455a.79.79 0 1 0 1.211-1.015l-3.352-3.995a.79.79 0 0 0-.995-.179.784.784 0 0 0-.299.221l-3.35 3.99a.79.79 0 1 0 1.21 1.017l1.936-2.306v5.185c0 .436.353.79.79.79Z"/><path d="M15.522 19.1a.79.79 0 0 0 .79-.79v-5.373l2.059 2.455a.79.79 0 1 0 1.211-1.015l-3.352-3.995a.79.79 0 0 0-.995-.179.784.784 0 0 0-.299.221l-3.35 3.99a.79.79 0 1 0 1.21 1.017l1.936-2.306v5.185c0 .436.353.79.79.79Z"/></svg>',oA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><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.1H1.202Zm11.723 2.805a2.094 2.094 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.133 2.133 0 0 0-.76-2.244 2.13 2.13 0 0 0-1.366-.44Z"/><path clip-rule="evenodd" 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.843.843 0 0 1 .597.248l.838.852h4.75c.223 0 .441.114.6.272a.844.844 0 0 1 .247.597Zm-1.52.654-4.377.02-1.1-1.143H11v6h7.4l-.023-4.877Z"/></svg>',rA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M1.201 1C.538 1 0 1.47 0 2.1v14.363c0 .64.534 1.037 1.186 1.037h7.029a5.401 5.401 0 0 1 .615-4.338l.762-1.232-2.975-2.78a.696.696 0 0 0-.957-.033L1.5 13.6V2.5h15v6.023c.449.131.887.32 1.307.573l.058.033c.046.028.09.057.135.086V2.1c0-.63-.547-1.1-1.2-1.1H1.202Zm11.713 2.803a2.15 2.15 0 0 0-1.611.834 2.118 2.118 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-.978Z"/><path d="M16.63 10.294a3.003 3.003 0 0 0-4.142.887l-.117.177a.647.647 0 0 0-.096.492.664.664 0 0 0 .278.418.7.7 0 0 0 .944-.234 1.741 1.741 0 0 1 2.478-.463 1.869 1.869 0 0 1 .476 2.55.637.637 0 0 0-.071.5.646.646 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.228 3.228 0 0 0 .82 4.403 3.005 3.005 0 0 0 4.275-.798l.13-.197a.626.626 0 0 0 .092-.475.638.638 0 0 0-.268-.402.713.713 0 0 0-.99.26l-.018.029a1.741 1.741 0 0 1-2.477.461 1.87 1.87 0 0 1-.475-2.55l.029-.047a.647.647 0 0 0 .086-.485.66.66 0 0 0-.275-.408l-.04-.027a.609.609 0 0 0-.845.17Z"/><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-.236l1.268-1.907Z"/></svg>',aA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m9.239 13.938-2.88-1.663a.75.75 0 0 1 .75-1.3L9 12.067V4.75a.75.75 0 1 1 1.5 0v7.318l1.89-1.093a.75.75 0 0 1 .75 1.3l-2.879 1.663a.752.752 0 0 1-.511.187.752.752 0 0 1-.511-.187zM4.25 17a.75.75 0 1 1 0-1.5h10.5a.75.75 0 0 1 0 1.5H4.25z"/></svg>',lA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.75 11.875a.752.752 0 0 1 .508.184l2.883 1.666a.75.75 0 0 1-.659 1.344l-.091-.044-1.892-1.093.001 4.318a.75.75 0 1 1-1.5 0v-4.317l-1.89 1.092a.75.75 0 0 1-.75-1.3l2.879-1.663a.752.752 0 0 1 .51-.187zM15.25 9a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.5h10.5zM9.75.375a.75.75 0 0 1 .75.75v4.318l1.89-1.093.092-.045a.75.75 0 0 1 .659 1.344l-2.883 1.667a.752.752 0 0 1-.508.184.752.752 0 0 1-.511-.187L6.359 5.65a.75.75 0 0 1 .75-1.299L9 5.442V1.125a.75.75 0 0 1 .75-.75z"/></svg>',cA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m10.261 7.062 2.88 1.663a.75.75 0 0 1-.75 1.3L10.5 8.933v7.317a.75.75 0 1 1-1.5 0V8.932l-1.89 1.093a.75.75 0 0 1-.75-1.3l2.879-1.663a.752.752 0 0 1 .511-.187.752.752 0 0 1 .511.187zM15.25 4a.75.75 0 1 1 0 1.5H4.75a.75.75 0 0 1 0-1.5h10.5z"/></svg>',uA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75z"/></svg>',dA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm2.286 4c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75z"/></svg>',hA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M18 3.75a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75zm0 8a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75zm0 4a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75zm0-8a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75z"/></svg>',fA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75z"/></svg>',mA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',gA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M15.003 7v5.5a1 1 0 0 1-1 1H5.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H6.5V12h6.997V7.5z"/></svg>',pA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M18.003 7v5.5a1 1 0 0 1-1 1H8.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H9.5V12h6.997V7.5z"/></svg>',wA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M18 7v5.5a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1zm-1.505.5H3.504V12h12.991V7.5z"/></svg>',bA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zM2 15h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',_A='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zm0-3H18v1.5h-4.5zm0-3H18v1.5h-4.5zM2 15h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',vA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2zm0-9h5v1.5H2zm0 3h5v1.5H2zm0 3h5v1.5H2z"/><path d="M18.003 7v5.5a1 1 0 0 1-1 1H8.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H9.5V12h6.997V7.5z"/></svg>',yA='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 17v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zM1 15.5v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm0-2v1h-1v-1h1zm-19 0v1H0v-1h1zM14.5 2v1h-1V2h1zm2 0v1h-1V2h1zm2 0v1h-1V2h1zm-8 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm8 0v1h-1V2h1zm-10 0v1h-1V2h1z"/><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-2zm0 1.5c.263 0 .476.224.476.5v12c0 .276-.213.5-.476.5H1.905a.489.489 0 0 1-.476-.5V4c0-.276.213-.5.476-.5h16.19z"/></svg>',CA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 16.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1ZM1 15v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 13v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 11v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 9v1H0V9h1Zm19 0v1h-1V9h1ZM1 7v1H0V7h1Zm19 0v1h-1V7h1ZM1 5v1H0V5h1Zm19 0v1h-1V5h1Zm0-2v1h-1V3h1ZM1 3v1H0V3h1Zm13.5-1.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm-8 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm8 0v1h-1v-1h1Zm-10 0v1h-1v-1h1Z"/><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-2ZM13 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 7h11Z"/></svg>',kA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 16.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1ZM1 15v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 13v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 11v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 9v1H0V9h1Zm19 0v1h-1V9h1ZM1 7v1H0V7h1Zm19 0v1h-1V7h1ZM1 5v1H0V5h1Zm19 0v1h-1V5h1Zm0-2v1h-1V3h1ZM1 3v1H0V3h1Zm13.5-1.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm-8 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm8 0v1h-1v-1h1Zm-10 0v1h-1v-1h1Z"/><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-2ZM7 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 11h5Z"/></svg>',EA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 16.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1ZM1 15v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 13v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 11v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 9v1H0V9h1Zm19 0v1h-1V9h1ZM1 7v1H0V7h1Zm19 0v1h-1V7h1ZM1 5v1H0V5h1Zm19 0v1h-1V5h1Zm0-2v1h-1V3h1ZM1 3v1H0V3h1Zm13.5-1.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm-8 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm8 0v1h-1v-1h1Zm-10 0v1h-1v-1h1Z"/><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-2ZM10 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 9h8Z"/></svg>',TA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m7.3 17.37-.061.088a1.518 1.518 0 0 1-.934.535l-4.178.663-.806-4.153a1.495 1.495 0 0 1 .187-1.058l.056-.086L8.77 2.639c.958-1.351 2.803-1.076 4.296-.03 1.497 1.047 2.387 2.693 1.433 4.055L7.3 17.37zM9.14 4.728l-5.545 8.346 3.277 2.294 5.544-8.346L9.14 4.728zM6.07 16.512l-3.276-2.295.53 2.73 2.746-.435zM9.994 3.506 13.271 5.8c.316-.452-.16-1.333-1.065-1.966-.905-.634-1.895-.78-2.212-.328zM8 18.5 9.375 17H19v1.5H8z"/></svg>',AA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.999 2H15a1 1 0 0 1 0 2h-1.004v13a1 1 0 1 1-2 0V4H8.999v13a1 1 0 1 1-2 0v-7A4 4 0 0 1 3 6a4 4 0 0 1 3.999-4z"/></svg>',SA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 10.423a6.5 6.5 0 0 1 6.056-6.408l.038.67C6.448 5.423 5.354 7.663 5.22 10H9c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003v-4.574zm8 0a6.5 6.5 0 0 1 6.056-6.408l.038.67c-2.646.739-3.74 2.979-3.873 5.315H17c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003v-4.574z"/></svg>',xA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="9.5" cy="4.5" r="1.5"/><circle cx="9.5" cy="10.5" r="1.5"/><circle cx="9.5" cy="16.5" r="1.5"/></svg>',IA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5 3.25a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M12 3.25a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M12 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M5 16.75a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M12 16.75a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/></svg>',PA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.187 17H5.773c-.637 0-1.092-.138-1.364-.415-.273-.277-.409-.718-.409-1.323V4.738c0-.617.14-1.062.419-1.332.279-.27.73-.406 1.354-.406h4.68c.69 0 1.288.041 1.793.124.506.083.96.242 1.36.478.341.197.644.447.906.75a3.262 3.262 0 0 1 .808 2.162c0 1.401-.722 2.426-2.167 3.075C15.05 10.175 16 11.315 16 13.01a3.756 3.756 0 0 1-2.296 3.504 6.1 6.1 0 0 1-1.517.377c-.571.073-1.238.11-2 .11zm-.217-6.217H7v4.087h3.069c1.977 0 2.965-.69 2.965-2.072 0-.707-.256-1.22-.768-1.537-.512-.319-1.277-.478-2.296-.478zM7 5.13v3.619h2.606c.729 0 1.292-.067 1.69-.2a1.6 1.6 0 0 0 .91-.765c.165-.267.247-.566.247-.897 0-.707-.26-1.176-.778-1.409-.519-.232-1.31-.348-2.375-.348H7z"/></svg>',RA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.5 5.5H7v5h3.5a2.5 2.5 0 1 0 0-5zM5 3h6.5v.025a5 5 0 0 1 0 9.95V13H7v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z"/></svg>',VA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10 2a1 1 0 0 0-1 1v6H3a1 1 0 1 0 0 2h6v6a1 1 0 1 0 2 0v-6h6a1 1 0 1 0 0-2h-6V3a1 1 0 0 0-1-1Z"/></svg>',LA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.816 11.5 7.038 4.785 4.261 11.5h5.555Zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663L10.436 13Z"/><path d="m12.09 17-.534-1.292.848-1.971.545 1.319L12.113 17h-.023Zm1.142-5.187.545 1.319L15.5 9.13l1.858 4.316h-3.45l.398.965h3.467L18.887 17H20l-3.873-9h-1.254l-1.641 3.813Z"/></svg>',BA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M19 4.5 14 0H3v12.673l.868-1.041c.185-.222.4-.402.632-.54V1.5h8v5h5v7.626a2.24 2.24 0 0 1 1.5.822V4.5ZM14 5V2l3.3 3H14Zm-3.692 12.5c.062.105.133.206.213.303L11.52 19H8v-.876a2.243 2.243 0 0 0 1.82-.624h.488Zm7.518-.657a.75.75 0 0 0-1.152-.96L15.5 17.29V12H14v5.29l-1.174-1.408a.75.75 0 0 0-1.152.96l2.346 2.816a.95.95 0 0 0 1.46 0l2.346-2.815Zm-15.056-.38a.75.75 0 0 1-.096-1.056l2.346-2.815a.95.95 0 0 1 1.46 0l2.346 2.815a.75.75 0 1 1-1.152.96L6.5 14.96V20H5v-5.04l-1.174 1.408a.75.75 0 0 1-1.056.096Z"/></svg>',OA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m14.958 9.367-2.189 1.837a.75.75 0 0 0 .965 1.149l3.788-3.18a.747.747 0 0 0 .21-.284.75.75 0 0 0-.17-.945L13.77 4.762a.75.75 0 1 0-.964 1.15l2.331 1.955H6.22A.75.75 0 0 0 6 7.9a4 4 0 1 0 1.477 7.718l-.344-1.489A2.5 2.5 0 1 1 6.039 9.4l-.008-.032h8.927z"/></svg>',MA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m5.042 9.367 2.189 1.837a.75.75 0 0 1-.965 1.149l-3.788-3.18a.747.747 0 0 1-.21-.284.75.75 0 0 1 .17-.945L6.23 4.762a.75.75 0 1 1 .964 1.15L4.863 7.866h8.917A.75.75 0 0 1 14 7.9a4 4 0 1 1-1.477 7.718l.344-1.489a2.5 2.5 0 1 0 1.094-4.73l.008-.032H5.042z"/></svg>',FA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zm-6 0C1 4.784 1.777 4 2.75 4c.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75C1.784 7.5 1 6.723 1 5.75zm6 9c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zm-6 0c0-.966.777-1.75 1.75-1.75.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75-.966 0-1.75-.777-1.75-1.75z"/></svg>',DA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM3.5 3v5H2V3.7H1v-1h2.5V3zM.343 17.857l2.59-3.257H2.92a.6.6 0 1 0-1.04 0H.302a2 2 0 1 1 3.995 0h-.001c-.048.405-.16.734-.333.988-.175.254-.59.692-1.244 1.312H4.3v1h-4l.043-.043zM7 14.75a.75.75 0 0 1 .75-.75h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75z"/></svg>',NA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m2.315 14.705 2.224-2.24a.689.689 0 0 1 .963 0 .664.664 0 0 1 0 .949L2.865 16.07a.682.682 0 0 1-.112.089.647.647 0 0 1-.852-.051L.688 14.886a.635.635 0 0 1 0-.903.647.647 0 0 1 .91 0l.717.722zm5.185.045a.75.75 0 0 1 .75-.75h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75zM2.329 5.745l2.21-2.226a.689.689 0 0 1 .963 0 .664.664 0 0 1 0 .95L2.865 7.125a.685.685 0 0 1-.496.196.644.644 0 0 1-.468-.187L.688 5.912a.635.635 0 0 1 0-.903.647.647 0 0 1 .91 0l.73.736zM7.5 5.75A.75.75 0 0 1 8.25 5h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75z"/></svg>',$A='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.87 12.61a.75.75 0 0 1-.089.976l-.085.07-3.154 2.254 3.412 2.414a.75.75 0 0 1 .237.95l-.057.095a.75.75 0 0 1-.95.237l-.096-.058-4.272-3.022-.003-1.223 4.01-2.867a.75.75 0 0 1 1.047.174zm2.795-.231.095.057 4.011 2.867-.003 1.223-4.272 3.022-.095.058a.75.75 0 0 1-.88-.151l-.07-.086-.058-.095a.75.75 0 0 1 .15-.88l.087-.07 3.412-2.414-3.154-2.253-.085-.071a.75.75 0 0 1 .862-1.207zM16 0a2 2 0 0 1 2 2v9.354l-.663-.492-.837-.001V2a.5.5 0 0 0-.5-.5H2a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h3.118L7.156 19H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h14zM5.009 15l.003 1H3v-1h2.009zm2.188-2-1.471 1H5v-1h2.197zM10 11v.095L8.668 12H7v-1h3zm4-2v1H7V9h7zm0-2v1H7V7h7zm-4-2v1H5V5h5zM6 3v1H3V3h3z"/></svg>',zA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.627 16.5zm5.873-.196zm0-7.001V8h-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.027 6.027 0 0 0-1.5-1.228zM16 6.5v-1H8.5l-2-2H2v13h1V8a1.5 1.5 0 0 1 1.5-1.5H16z"/><path d="M14.5 19.5a5 5 0 1 1 0-10 5 5 0 0 1 0 10zM15 14v-2h-1v2h-2v1h2v2h1v-2h2v-1h-2z"/></svg>',HA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M19 9v10h-2v-8h-2V9h4zM4 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 1v4.5z"/></svg>',UA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><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 1v4.5zm16.076 8.343V18.5h-6.252c.067-.626.27-1.22.61-1.78.338-.561 1.006-1.305 2.005-2.232.804-.749 1.297-1.257 1.479-1.523.245-.368.368-.732.368-1.092 0-.398-.107-.703-.32-.917-.214-.214-.51-.32-.886-.32-.372 0-.669.111-.889.336-.22.224-.347.596-.38 1.117l-1.778-.178c.106-.982.438-1.686.997-2.114.558-.427 1.257-.64 2.095-.64.918 0 1.64.247 2.164.742.525.495.787 1.11.787 1.847 0 .419-.075.818-.225 1.197-.15.378-.388.775-.714 1.19-.216.275-.605.67-1.168 1.187-.563.516-.92.859-1.07 1.028a3.11 3.11 0 0 0-.365.495h3.542z"/></svg>',WA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><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 1v4.5zm9.989 7.53 1.726-.209c.055.44.203.777.445 1.01.24.232.533.349.876.349.368 0 .678-.14.93-.42.251-.279.377-.655.377-1.13 0-.448-.12-.803-.362-1.066a1.153 1.153 0 0 0-.882-.393c-.228 0-.501.044-.819.133l.197-1.453c.482.012.85-.092 1.105-.315.253-.222.38-.517.38-.885 0-.313-.093-.563-.279-.75-.186-.185-.434-.278-.743-.278a1.07 1.07 0 0 0-.78.317c-.216.212-.347.52-.394.927l-1.644-.28c.114-.562.287-1.012.517-1.348.231-.337.553-.601.965-.794a3.24 3.24 0 0 1 1.387-.289c.876 0 1.579.28 2.108.838.436.457.653.973.653 1.549 0 .817-.446 1.468-1.339 1.955.533.114.96.37 1.28.768.319.398.478.878.478 1.441 0 .817-.298 1.513-.895 2.088-.596.576-1.339.864-2.228.864-.842 0-1.54-.243-2.094-.727-.555-.485-.876-1.118-.965-1.901z"/></svg>',qA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><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 1v4.5zm13.55 10v-1.873h-3.81v-1.561l4.037-5.91h1.498v5.904h1.156v1.567h-1.156V18.5H17.05zm0-3.44v-3.18l-2.14 3.18h2.14z"/></svg>',jA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><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 1v4.5zm9.578 7.607 1.777-.184c.05.402.201.72.45.955a1.223 1.223 0 0 0 1.81-.101c.258-.303.387-.759.387-1.368 0-.572-.128-1-.384-1.286-.256-.285-.59-.428-1-.428-.512 0-.971.226-1.377.679l-1.448-.21.915-4.843h4.716v1.67H15.56l-.28 1.58a2.697 2.697 0 0 1 1.219-.298 2.68 2.68 0 0 1 2.012.863c.55.576.825 1.323.825 2.241a3.36 3.36 0 0 1-.666 2.05c-.605.821-1.445 1.232-2.52 1.232-.86 0-1.56-.23-2.101-.692-.542-.461-.866-1.081-.971-1.86z"/></svg>',GA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><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 1v4.5zm15.595 2.973-1.726.19c-.043-.355-.153-.617-.33-.787-.178-.169-.409-.253-.692-.253-.377 0-.695.169-.956.507-.26.339-.424 1.043-.492 2.114.445-.525.997-.787 1.657-.787.745 0 1.383.284 1.914.85.531.568.797 1.3.797 2.197 0 .952-.28 1.716-.838 2.291-.559.576-1.276.864-2.152.864-.94 0-1.712-.365-2.317-1.095-.605-.73-.908-1.927-.908-3.59 0-1.705.316-2.935.946-3.688.63-.753 1.45-1.13 2.457-1.13.706 0 1.291.198 1.755.594.463.395.758.97.885 1.723zm-4.043 3.891c0 .58.133 1.028.4 1.343.266.315.57.473.914.473.33 0 .605-.13.825-.388.22-.258.33-.68.33-1.27 0-.604-.118-1.047-.355-1.329a1.115 1.115 0 0 0-.89-.422c-.342 0-.632.134-.869.403s-.355.666-.355 1.19z"/></svg>',KA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 9h16v2H2z"/></svg>',ZA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="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-2h14zm.499 15.999h-15L2.5 17a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5l-.001-1.001zm-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-.965l-.014-.014zM2 10H1v5h1v-2h2v2h1v-5H4v2H2v-2zm7 0H6v1h1v4h1v-4h1v-1zm8 0h-1v5h3v-1h-2v-4zm0-8.5H3a.5.5 0 0 0-.5.5l-.001 6.999h15L17.5 2a.5.5 0 0 0-.5-.5zM10 7v1H4V7h6zm3-2v1H4V5h9zm-3-2v1H4V3h6z"/></svg>',JA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5zM1.632 6.95 5.02 9.358a.4.4 0 0 1-.013.661l-3.39 2.207A.4.4 0 0 1 1 11.892V7.275a.4.4 0 0 1 .632-.326z"/></svg>',YA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5zm1.618-9.55L.98 9.358a.4.4 0 0 0 .013.661l3.39 2.207A.4.4 0 0 0 5 11.892V7.275a.4.4 0 0 0-.632-.326z"/></svg>',QA='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 5.5v3h4v-3H3Zm0 4v3h4v-3H3Zm0 4v3h4v-3H3Zm5 3h4v-3H8v3Zm5 0h4v-3h-4v3Zm4-4v-3h-4v3h4Zm0-4v-3h-4v3h4Zm1.5 8A1.5 1.5 0 0 1 17 18H3a1.5 1.5 0 0 1-1.5-1.5V3c.222-.863 1.068-1.5 2-1.5h13c.932 0 1.778.637 2 1.5v13.5Zm-6.5-4v-3H8v3h4Zm0-4v-3H8v3h4Z"/></svg>';/**
|
|
620
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
621
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
622
|
+
*/const I={bold:PA,cancel:qT,caption:jT,check:GT,cog:KT,colorPalette:ZT,eraser:JT,history:YT,image:nA,imageUpload:sA,imageAssetManager:oA,imageUrl:rA,lowVision:QT,textAlternative:XT,loupe:eA,previousArrow:tA,nextArrow:iA,importExport:BA,paragraph:RA,plus:VA,text:LA,alignBottom:aA,alignMiddle:lA,alignTop:cA,alignLeft:uA,alignCenter:dA,alignRight:hA,alignJustify:fA,objectLeft:_A,objectCenter:gA,objectRight:vA,objectFullWidth:wA,objectInline:bA,objectBlockLeft:mA,objectBlockRight:pA,objectSizeFull:yA,objectSizeLarge:CA,objectSizeSmall:kA,objectSizeMedium:EA,pencil:TA,pilcrow:AA,quote:SA,threeVerticalDots:xA,dragIndicator:IA,redo:OA,undo:MA,bulletedList:FA,numberedList:DA,todoList:NA,codeBlock:$A,browseFiles:zA,heading1:HA,heading2:UA,heading3:WA,heading4:qA,heading5:jA,heading6:GA,horizontalLine:KA,html:ZA,indent:JA,outdent:YA,table:QA};/**
|
|
623
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
624
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
625
|
+
*/const{threeVerticalDots:Xm}=I,XA={alignLeft:I.alignLeft,bold:I.bold,importExport:I.importExport,paragraph:I.paragraph,plus:I.plus,text:I.text,threeVerticalDots:I.threeVerticalDots,pilcrow:I.pilcrow,dragIndicator:I.dragIndicator};class Ja extends T{constructor(e,t){super(e);const i=this.bindTemplate,s=this.t;this.options=t||{},this.set("ariaLabel",s("Editor toolbar")),this.set("maxWidth","auto"),this.items=this.createCollection(),this.focusTracker=new ne,this.keystrokes=new ae,this.set("class",void 0),this.set("isCompact",!1),this.itemsView=new eS(e),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection();const o=e.uiLanguageDirection==="rtl";this._focusCycler=new ke({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:[o?"arrowright":"arrowleft","arrowup"],focusNext:[o?"arrowleft":"arrowright","arrowdown"]}});const r=["ck","ck-toolbar",i.to("class"),i.if("isCompact","ck-toolbar_compact")];this.options.shouldGroupWhenFull&&this.options.isFloating&&r.push("ck-toolbar_floating"),this.setTemplate({tag:"div",attributes:{class:r,role:"toolbar","aria-label":i.to("ariaLabel"),style:{maxWidth:i.to("maxWidth")},tabindex:-1},children:this.children,on:{mousedown:MC(this)}}),this._behavior=this.options.shouldGroupWhenFull?new iS(this):new tS(this)}render(){super.render(),this.focusTracker.add(this.element);for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",(e,t)=>{this.focusTracker.add(t.element)}),this.items.on("remove",(e,t)=>{this.focusTracker.remove(t.element)}),this.keystrokes.listenTo(this.element),this._behavior.render(this)}destroy(){return this._behavior.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy(),super.destroy()}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}fillFromConfig(e,t,i){this.items.addMany(this._buildItemsFromConfig(e,t,i))}_buildItemsFromConfig(e,t,i){const s=nm(e),o=i||s.removeItems;return this._cleanItemsConfiguration(s.items,t,o).map(a=>ie(a)?this._createNestedToolbarDropdown(a,t,o):a==="|"?new im:a==="-"?new OC:t.create(a)).filter(a=>!!a)}_cleanItemsConfiguration(e,t,i){const s=e.filter((o,r,a)=>o==="|"?!0:i.indexOf(o)!==-1?!1:o==="-"?this.options.shouldGroupWhenFull?(H("toolbarview-line-break-ignored-when-grouping-items",a),!1):!0:!ie(o)&&!t.has(o)?(H("toolbarview-item-unavailable",{item:o}),!1):!0);return this._cleanSeparatorsAndLineBreaks(s)}_cleanSeparatorsAndLineBreaks(e){const t=r=>r!=="-"&&r!=="|",i=e.length,s=e.findIndex(t);if(s===-1)return[];const o=i-e.slice().reverse().findIndex(t);return e.slice(s,o).filter((r,a,l)=>t(r)?!0:!(a>0&&l[a-1]===r))}_createNestedToolbarDropdown(e,t,i){let{label:s,icon:o,items:r,tooltip:a=!0,withText:l=!1}=e;if(r=this._cleanItemsConfiguration(r,t,i),!r.length)return null;const c=this.locale,u=fe(c);return s||H("toolbarview-nested-toolbar-dropdown-missing-label",e),u.class="ck-toolbar__nested-toolbar-dropdown",u.buttonView.set({label:s,tooltip:a,withText:!!l}),o!==!1?u.buttonView.icon=XA[o]||o||Xm:u.buttonView.withText=!0,po(u,()=>u.toolbarView._buildItemsFromConfig(r,t,i)),u}}class eS extends T{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children})}}class tS{constructor(e){const t=e.bindTemplate;e.set("isVertical",!1),e.itemsView.children.bindTo(e.items).using(i=>i),e.focusables.bindTo(e.items).using(i=>Yn(i)?i:null),e.extendTemplate({attributes:{class:[t.if("isVertical","ck-toolbar_vertical")]}})}render(){}destroy(){}}class iS{constructor(e){this.resizeObserver=null,this.cachedPadding=null,this.shouldUpdateGroupingOnNextResize=!1,this.view=e,this.viewChildren=e.children,this.viewFocusables=e.focusables,this.viewItemsView=e.itemsView,this.viewFocusTracker=e.focusTracker,this.viewLocale=e.locale,this.ungroupedItems=e.createCollection(),this.groupedItems=e.createCollection(),this.groupedItemsDropdown=this._createGroupedItemsDropdown(),e.itemsView.children.bindTo(this.ungroupedItems).using(t=>t),this.ungroupedItems.on("change",this._updateFocusCyclableItems.bind(this)),e.children.on("change",this._updateFocusCyclableItems.bind(this)),e.items.on("change",(t,i)=>{const s=i.index,o=Array.from(i.added);for(const r of i.removed)s>=this.ungroupedItems.length?this.groupedItems.remove(r):this.ungroupedItems.remove(r);for(let r=s;r<s+o.length;r++){const a=o[r-s];r>this.ungroupedItems.length?this.groupedItems.add(a,r-this.ungroupedItems.length):this.ungroupedItems.add(a,r)}this._updateGrouping()}),e.extendTemplate({attributes:{class:["ck-toolbar_grouping"]}})}render(e){this.viewElement=e.element,this._enableGroupingOnResize(),this._enableGroupingOnMaxWidthChange(e)}destroy(){this.groupedItemsDropdown.destroy(),this.resizeObserver.destroy()}_updateGrouping(){if(!this.viewElement.ownerDocument.body.contains(this.viewElement))return;if(!ii(this.viewElement)){this.shouldUpdateGroupingOnNextResize=!0;return}const e=this.groupedItems.length;let t;for(;this._areItemsOverflowing;)this._groupLastItem(),t=!0;if(!t&&this.groupedItems.length){for(;this.groupedItems.length&&!this._areItemsOverflowing;)this._ungroupFirstItem();this._areItemsOverflowing&&this._groupLastItem()}this.groupedItems.length!==e&&this.view.fire("groupedItemsUpdate")}get _areItemsOverflowing(){if(!this.ungroupedItems.length)return!1;const e=this.viewElement,t=this.viewLocale.uiLanguageDirection,i=new O(e.lastChild),s=new O(e);if(!this.cachedPadding){const o=E.window.getComputedStyle(e),r=t==="ltr"?"paddingRight":"paddingLeft";this.cachedPadding=Number.parseInt(o[r])}return t==="ltr"?i.right>s.right-this.cachedPadding:i.left<s.left+this.cachedPadding}_enableGroupingOnResize(){let e;this.resizeObserver=new Q(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 im),this.viewChildren.add(this.groupedItemsDropdown),this.viewFocusTracker.add(this.groupedItemsDropdown.element)),this.groupedItems.add(this.ungroupedItems.remove(this.ungroupedItems.last),0)}_ungroupFirstItem(){this.ungroupedItems.add(this.groupedItems.remove(this.groupedItems.first)),this.groupedItems.length||(this.viewChildren.remove(this.groupedItemsDropdown),this.viewChildren.remove(this.viewChildren.last),this.viewFocusTracker.remove(this.groupedItemsDropdown.element))}_createGroupedItemsDropdown(){const e=this.viewLocale,t=e.t,i=fe(e);return i.class="ck-toolbar__grouped-dropdown",i.panelPosition=e.uiLanguageDirection==="ltr"?"sw":"se",po(i,this.groupedItems),i.buttonView.set({label:t("Show more items"),tooltip:!0,tooltipPosition:e.uiLanguageDirection==="rtl"?"se":"sw",icon:Xm}),i}_updateFocusCyclableItems(){this.viewFocusables.clear(),this.ungroupedItems.map(e=>{Yn(e)&&this.viewFocusables.add(e)}),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}}/**
|
|
626
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
627
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
628
|
+
*/class js extends T{constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!0),this.children=this.createCollection(),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__item",t.if("isVisible","ck-hidden",i=>!i)],role:"presentation"},children:this.children})}focus(){this.children.first&&this.children.first.focus()}}/**
|
|
629
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
630
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
631
|
+
*/class eg extends T{constructor(e){super(e),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}})}}/**
|
|
632
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
633
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
634
|
+
*/class xs extends T{constructor(e,t=new Jn){super(e);const i=this.bindTemplate,s=new tg(e);this.set({label:"",isVisible:!0}),this.labelView=t,this.labelView.bind("text").to(this,"label"),this.children=this.createCollection(),this.children.addMany([this.labelView,s]),s.set({role:"group",ariaLabelledBy:t.id}),s.focusTracker.destroy(),s.keystrokes.destroy(),this.items=s.items,this.setTemplate({tag:"li",attributes:{role:"presentation",class:["ck","ck-list__group",i.if("isVisible","ck-hidden",o=>!o)]},children:this.children})}focus(){if(this.items){const e=this.items.find(t=>!(t instanceof eg));e&&e.focus()}}}/**
|
|
635
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
636
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
637
|
+
*/class tg extends T{constructor(e){super(e),this._listItemGroupToChangeListeners=new WeakMap;const t=this.bindTemplate;this.focusables=new Ae,this.items=this.createCollection(),this.focusTracker=new ne,this.keystrokes=new ae,this._focusCycler=new ke({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowup",focusNext:"arrowdown"}}),this.set("ariaLabel",void 0),this.set("ariaLabelledBy",void 0),this.set("role",void 0),this.setTemplate({tag:"ul",attributes:{class:["ck","ck-reset","ck-list"],role:t.to("role"),"aria-label":t.to("ariaLabel"),"aria-labelledby":t.to("ariaLabelledBy")},children:this.items})}render(){super.render();for(const e of this.items)e instanceof xs?this._registerFocusableItemsGroup(e):e instanceof js&&this._registerFocusableListItem(e);this.items.on("change",(e,t)=>{for(const i of t.removed)i instanceof xs?this._deregisterFocusableItemsGroup(i):i instanceof js&&this._deregisterFocusableListItem(i);for(const i of Array.from(t.added).reverse())i instanceof xs?this._registerFocusableItemsGroup(i,t.index):this._registerFocusableListItem(i,t.index)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}focusFirst(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}_registerFocusableListItem(e,t){this.focusTracker.add(e.element),this.focusables.add(e,t)}_deregisterFocusableListItem(e){this.focusTracker.remove(e.element),this.focusables.remove(e)}_getOnGroupItemsChangeCallback(e){return(t,i)=>{for(const s of i.removed)this._deregisterFocusableListItem(s);for(const s of Array.from(i.added).reverse())this._registerFocusableListItem(s,this.items.getIndex(e)+i.index)}}_registerFocusableItemsGroup(e,t){Array.from(e.items).forEach((s,o)=>{const r=typeof t<"u"?t+o:void 0;this._registerFocusableListItem(s,r)});const i=this._getOnGroupItemsChangeCallback(e);this._listItemGroupToChangeListeners.set(e,i),e.items.on("change",i)}_deregisterFocusableItemsGroup(e){for(const t of e.items)this._deregisterFocusableListItem(t);e.items.off("change",this._listItemGroupToChangeListeners.get(e)),this._listItemGroupToChangeListeners.delete(e)}}/**
|
|
638
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
639
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
640
|
+
*/class Qi extends T{constructor(e,t){super(e);const i=this.bindTemplate;this.set("class",void 0),this.set("labelStyle",void 0),this.set("icon",void 0),this.set("isEnabled",!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 ae,this.focusTracker=new ne,this.setTemplate({tag:"div",attributes:{class:["ck","ck-splitbutton",i.to("class"),i.if("isVisible","ck-hidden",s=>!s),this.arrowView.bindTemplate.if("isOn","ck-splitbutton_open")]},children:this.children})}render(){super.render(),this.children.add(this.actionView),this.children.add(this.arrowView),this.focusTracker.add(this.actionView.element),this.focusTracker.add(this.arrowView.element),this.keystrokes.listenTo(this.element),this.keystrokes.set("arrowright",(e,t)=>{this.focusTracker.focusedElement===this.actionView.element&&(this.arrowView.focus(),t())}),this.keystrokes.set("arrowleft",(e,t)=>{this.focusTracker.focusedElement===this.arrowView.element&&(this.actionView.focus(),t())})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.actionView.focus()}_createActionView(e){const t=e||new B;return e||t.bind("icon","isEnabled","isOn","isToggleable","keystroke","label","tabindex","tooltip","tooltipPosition","type","withText").to(this),t.extendTemplate({attributes:{class:"ck-splitbutton__action"}}),t.delegate("execute").to(this),t}_createArrowView(){const e=new B,t=e.bindTemplate;return e.icon=$a,e.extendTemplate({attributes:{class:["ck-splitbutton__arrow"],"data-cke-tooltip-disabled":t.to("isOn"),"aria-haspopup":!0,"aria-expanded":t.to("isOn",i=>String(i))}}),e.bind("isEnabled").to(this),e.bind("label").to(this),e.bind("tooltip").to(this),e.delegate("execute").to(this,"open"),e}}/**
|
|
641
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
642
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
643
|
+
*/function fe(n,e=tm){const t=typeof e=="function"?new e(n):e,i=new LC(n),s=new zi(n,t,i);return t.bind("isEnabled").to(s),t instanceof Qi?t.arrowView.bind("isOn").to(s,"isOpen"):t.bind("isOn").to(s,"isOpen"),nS(s),s}function po(n,e,t={}){n.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),n.isOpen?au(n,e,t):n.once("change:isOpen",()=>au(n,e,t),{priority:"highest"}),t.enableActiveItemFocusOnDropdownOpen&&wo(n,()=>n.toolbarView.items.find(i=>i.isOn))}function au(n,e,t){const i=n.locale,s=i.t,o=n.toolbarView=new Ja(i),r=typeof e=="function"?e():e;o.ariaLabel=t.ariaLabel||s("Dropdown toolbar"),t.maxWidth&&(o.maxWidth=t.maxWidth),t.class&&(o.class=t.class),t.isCompact&&(o.isCompact=t.isCompact),t.isVertical&&(o.isVertical=!0),r instanceof Ae?o.items.bindTo(r).using(a=>a):o.items.addMany(r),n.panelView.children.add(o),o.items.delegate("execute").to(n)}function di(n,e,t={}){n.isOpen?lu(n,e,t):n.once("change:isOpen",()=>lu(n,e,t),{priority:"highest"}),wo(n,()=>n.listView.items.find(i=>i instanceof js?i.children.first.isOn:!1))}function lu(n,e,t){const i=n.locale,s=n.listView=new tg(i),o=typeof e=="function"?e():e;s.ariaLabel=t.ariaLabel,s.role=t.role,ig(n,s.items,o,i),n.panelView.children.add(s),s.items.delegate("execute").to(n)}function wo(n,e){n.on("change:isOpen",()=>{if(!n.isOpen)return;const t=e();t&&(typeof t.focus=="function"?t.focus():H("ui-dropdown-focus-child-on-open-child-missing-focus",{view:t}))},{priority:Me.low-10})}function nS(n){sS(n),oS(n),rS(n),aS(n),lS(n),cS(n)}function sS(n){n.on("render",()=>{fa({emitter:n,activator:()=>n.isOpen,callback:()=>{n.isOpen=!1},contextElements:()=>[n.element,...n.focusTracker._elements]})})}function oS(n){n.on("execute",e=>{e.source instanceof Zn||(n.isOpen=!1)})}function rS(n){n.focusTracker.on("change:isFocused",(e,t,i)=>{n.isOpen&&!i&&(n.isOpen=!1)})}function aS(n){n.keystrokes.set("arrowdown",(e,t)=>{n.isOpen&&(n.panelView.focus(),t())}),n.keystrokes.set("arrowup",(e,t)=>{n.isOpen&&(n.panelView.focusLast(),t())})}function lS(n){n.on("change:isOpen",(e,t,i)=>{if(i)return;const s=n.panelView.element;s&&s.contains(E.document.activeElement)&&n.buttonView.focus()})}function cS(n){n.on("change:isOpen",(e,t,i)=>{i&&n.panelView.focus()},{priority:"low"})}function ig(n,e,t,i){e.bindTo(t).using(s=>{if(s.type==="separator")return new eg(i);if(s.type==="group"){const o=new xs(i);return o.set({label:s.label}),ig(n,o.items,s.items,i),o.items.delegate("execute").to(n),o}else if(s.type==="button"||s.type==="switchbutton"){const o=new js(i);let r;return s.type==="button"?(r=new B(i),r.extendTemplate({attributes:{"aria-checked":r.bindTemplate.to("isOn")}})):r=new Zn(i),r.bind(...Object.keys(s.model)).to(s.model),r.delegate("execute").to(o),o.children.add(r),o}return null})}/**
|
|
644
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
645
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
646
|
+
*/const Qn=(n,e,t)=>{const i=new RC(n.locale);return i.set({id:e,ariaDescribedById:t}),i.bind("isReadOnly").to(n,"isEnabled",s=>!s),i.bind("hasError").to(n,"errorText",s=>!!s),i.on("input",()=>{n.errorText=null}),n.bind("isEmpty","isFocused","placeholder").to(i),i},uS=(n,e,t)=>{const i=new VC(n.locale);return i.set({id:e,ariaDescribedById:t,inputMode:"numeric"}),i.bind("isReadOnly").to(n,"isEnabled",s=>!s),i.bind("hasError").to(n,"errorText",s=>!!s),i.on("input",()=>{n.errorText=null}),n.bind("isEmpty","isFocused","placeholder").to(i),i},Mn=(n,e=0,t=1)=>n>t?t:n<e?e:n,we=(n,e=0,t=Math.pow(10,e))=>Math.round(t*n)/t,dS=n=>pS($r(n)),$r=n=>(n[0]==="#"&&(n=n.substring(1)),n.length<6?{r:parseInt(n[0]+n[0],16),g:parseInt(n[1]+n[1],16),b:parseInt(n[2]+n[2],16),a:n.length===4?we(parseInt(n[3]+n[3],16)/255,2):1}:{r:parseInt(n.substring(0,2),16),g:parseInt(n.substring(2,4),16),b:parseInt(n.substring(4,6),16),a:n.length===8?we(parseInt(n.substring(6,8),16)/255,2):1}),hS=n=>gS(mS(n)),fS=({h:n,s:e,v:t,a:i})=>{const s=(200-e)*t/100;return{h:we(n),s:we(s>0&&s<200?e*t/100/(s<=100?s:200-s)*100:0),l:we(s/2),a:we(i,2)}},zr=n=>{const{h:e,s:t,l:i}=fS(n);return`hsl(${e}, ${t}%, ${i}%)`},mS=({h:n,s:e,v:t,a:i})=>{n=n/360*6,e=e/100,t=t/100;const s=Math.floor(n),o=t*(1-e),r=t*(1-(n-s)*e),a=t*(1-(1-n+s)*e),l=s%6;return{r:we([t,r,o,o,a,t][l]*255),g:we([a,t,t,r,o,o][l]*255),b:we([o,o,a,t,t,r][l]*255),a:we(i,2)}},hs=n=>{const e=n.toString(16);return e.length<2?"0"+e:e},gS=({r:n,g:e,b:t,a:i})=>{const s=i<1?hs(we(i*255)):"";return"#"+hs(n)+hs(e)+hs(t)+s},pS=({r:n,g:e,b:t,a:i})=>{const s=Math.max(n,e,t),o=s-Math.min(n,e,t),r=o?s===n?(e-t)/o:s===e?2+(t-n)/o:4+(n-e)/o:0;return{h:we(60*(r<0?r+6:r)),s:we(s?o/s*100:0),v:we(s/255*100),a:i}},ng=(n,e)=>{if(n===e)return!0;for(const t in n)if(n[t]!==e[t])return!1;return!0},wS=(n,e)=>n.toLowerCase()===e.toLowerCase()?!0:ng($r(n),$r(e)),cu={},sg=n=>{let e=cu[n];return e||(e=document.createElement("template"),e.innerHTML=n,cu[n]=e),e},Ya=(n,e,t)=>{n.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:t}))};let Mi=!1;const Hr=n=>"touches"in n,bS=n=>Mi&&!Hr(n)?!1:(Mi||(Mi=Hr(n)),!0),uu=(n,e)=>{const t=Hr(e)?e.touches[0]:e,i=n.el.getBoundingClientRect();Ya(n.el,"move",n.getMove({x:Mn((t.pageX-(i.left+window.pageXOffset))/i.width),y:Mn((t.pageY-(i.top+window.pageYOffset))/i.height)}))},_S=(n,e)=>{const t=e.keyCode;t>40||n.xy&&t<37||t<33||(e.preventDefault(),Ya(n.el,"move",n.getMove({x:t===39?.01:t===37?-.01:t===34?.05:t===33?-.05:t===35?1:t===36?-1:0,y:t===40?.01:t===38?-.01:0},!0)))};class og{constructor(e,t,i,s){const o=sg(`<div role="slider" tabindex="0" part="${t}" ${i}><div part="${t}-pointer"></div></div>`);e.appendChild(o.content.cloneNode(!0));const r=e.querySelector(`[part=${t}]`);r.addEventListener("mousedown",this),r.addEventListener("touchstart",this),r.addEventListener("keydown",this),this.el=r,this.xy=s,this.nodes=[r.firstChild,r]}set dragging(e){const t=e?document.addEventListener:document.removeEventListener;t(Mi?"touchmove":"mousemove",this),t(Mi?"touchend":"mouseup",this)}handleEvent(e){switch(e.type){case"mousedown":case"touchstart":if(e.preventDefault(),!bS(e)||!Mi&&e.button!=0)return;this.el.focus(),uu(this,e),this.dragging=!0;break;case"mousemove":case"touchmove":e.preventDefault(),uu(this,e);break;case"mouseup":case"touchend":this.dragging=!1;break;case"keydown":_S(this,e);break}}style(e){e.forEach((t,i)=>{for(const s in t)this.nodes[i].style.setProperty(s,t[s])})}}class vS extends og{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:zr({h:e,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuenow",`${we(e)}`)}getMove(e,t){return{h:t?Mn(this.h+e.x*360,0,360):360*e.x}}}class yS extends og{constructor(e){super(e,"saturation",'aria-label="Color"',!0)}update(e){this.hsva=e,this.style([{top:`${100-e.v}%`,left:`${e.s}%`,color:zr(e)},{"background-color":zr({h:e.h,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuetext",`Saturation ${we(e.s)}%, Brightness ${we(e.v)}%`)}getMove(e,t){return{s:t?Mn(this.hsva.s+e.x*100,0,100):e.x*100,v:t?Mn(this.hsva.v-e.y*100,0,100):Math.round(100-e.y*100)}}}const CS=':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)}',kS="[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}",ES="[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}",fs=Symbol("same"),$o=Symbol("color"),du=Symbol("hsva"),zo=Symbol("update"),hu=Symbol("parts"),fu=Symbol("css"),mu=Symbol("sliders");class TS extends HTMLElement{static get observedAttributes(){return["color"]}get[fu](){return[CS,kS,ES]}get[mu](){return[yS,vS]}get color(){return this[$o]}set color(e){if(!this[fs](e)){const t=this.colorModel.toHsva(e);this[zo](t),this[$o]=e}}constructor(){super();const e=sg(`<style>${this[fu].join("")}</style>`),t=this.attachShadow({mode:"open"});t.appendChild(e.content.cloneNode(!0)),t.addEventListener("move",this),this[hu]=this[mu].map(i=>new i(t))}connectedCallback(){if(this.hasOwnProperty("color")){const e=this.color;delete this.color,this.color=e}else this.color||(this.color=this.colorModel.defaultColor)}attributeChangedCallback(e,t,i){const s=this.colorModel.fromAttr(i);this[fs](s)||(this.color=s)}handleEvent(e){const t=this[du],i={...t,...e.detail};this[zo](i);let s;!ng(i,t)&&!this[fs](s=this.colorModel.fromHsva(i))&&(this[$o]=s,Ya(this,"color-changed",{value:s}))}[fs](e){return this.color&&this.colorModel.equal(e,this.color)}[zo](e){this[du]=e,this[hu].forEach(t=>t.update(e))}}const AS={defaultColor:"#000",toHsva:dS,fromHsva:({h:n,s:e,v:t})=>hS({h:n,s:e,v:t,a:1}),equal:wS,fromAttr:n=>n};class SS extends TS{get colorModel(){return AS}}/**
|
|
647
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
648
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
649
|
+
*/const xS=150;class IS extends T{constructor(e,t={}){super(e),this.set({color:"",_hexColor:""}),this.hexInputRow=this._createInputRow();const i=this.createCollection();t.hideInput||i.add(this.hexInputRow),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker"],tabindex:-1},children:i}),this._config=t,this._debounceColorPickerEvent=Di(s=>{this.set("color",s),this.fire("colorSelected",{color:this.color})},xS,{leading:!0}),this.on("set:color",(s,o,r)=>{s.return=Qf(r,this._config.format||"hsl")}),this.on("change:color",()=>{this._hexColor=Ho(this.color)}),this.on("change:_hexColor",()=>{document.activeElement!==this.picker&&this.picker.setAttribute("color",this._hexColor),Ho(this.color)!=Ho(this._hexColor)&&(this.color=this._hexColor)})}render(){if(super.render(),AC("hex-color-picker",SS),this.picker=E.document.createElement("hex-color-picker"),this.picker.setAttribute("class","hex-color-picker"),this.picker.setAttribute("tabindex","-1"),this._createSlidersView(),this.element){this.hexInputRow.element?this.element.insertBefore(this.picker,this.hexInputRow.element):this.element.appendChild(this.picker);const e=document.createElement("style");e.textContent='[role="slider"]:focus [part$="pointer"] {border: 1px solid #fff;outline: 1px solid var(--ck-color-focus-border);box-shadow: 0 0 0 2px #fff;}',this.picker.shadowRoot.appendChild(e)}this.picker.addEventListener("color-changed",e=>{const t=e.detail.value;this._debounceColorPickerEvent(t)})}focus(){/* istanbul ignore next -- @preserve */!this._config.hideInput&&(L.isGecko||L.isiOS||L.isSafari)&&this.hexInputRow.children.get(1).focus(),this.slidersView.first.focus()}_createSlidersView(){const i=[...this.picker.shadowRoot.children].filter(s=>s.getAttribute("role")==="slider").map(s=>new PS(s));this.slidersView=this.createCollection(),i.forEach(s=>{this.slidersView.add(s)})}_createInputRow(){const e=new RS,t=this._createColorInput();return new VS(this.locale,[e,t])}_createColorInput(){const e=new Zi(this.locale,Qn),{t}=this.locale;return e.set({label:t("HEX"),class:"color-picker-hex-input"}),e.fieldView.bind("value").to(this,"_hexColor",i=>e.isFocused?e.fieldView.value:i.startsWith("#")?i.substring(1):i),e.fieldView.on("input",()=>{const i=e.fieldView.element.value;if(i){const s=i.trim(),o=s.startsWith("#")?s.substring(1):s;[3,4,6,8].includes(o.length)&&/(([0-9a-fA-F]{2}){3,4}|([0-9a-fA-F]){3,4})/.test(o)&&this._debounceColorPickerEvent("#"+o)}}),e}}function Ho(n){let e=TC(n);return e||(e="#000"),e.length===4&&(e="#"+[e[1],e[1],e[2],e[2],e[3],e[3]].join("")),e.toLowerCase()}class PS extends T{constructor(e){super(),this.element=e}focus(){this.element.focus()}}class RS extends T{constructor(e){super(e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker__hash-view"]},children:"#"})}}class VS extends T{constructor(e,t){super(e),this.children=this.createCollection(t),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker__row"]},children:this.children})}}/**
|
|
650
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
651
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
652
|
+
*/class LS extends U(_e){constructor(e){super(e),this.set("isEmpty",!0),this.on("change",()=>{this.set("isEmpty",this.length===0)})}add(e,t){return this.find(i=>i.color===e.color)?this:super.add(e,t)}hasColor(e){return!!this.find(t=>t.color===e)}}/**
|
|
653
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
654
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
655
|
+
*/const{eraser:BS,colorPalette:OS}=I;class MS extends T{constructor(e,{colors:t,columns:i,removeButtonLabel:s,documentColorsLabel:o,documentColorsCount:r,colorPickerLabel:a,focusTracker:l,focusables:c}){super(e);const u=this.bindTemplate;this.set("isVisible",!0),this.focusTracker=l,this.items=this.createCollection(),this.colorDefinitions=t,this.columns=i,this.documentColors=new LS,this.documentColorsCount=r,this._focusables=c,this._removeButtonLabel=s,this._colorPickerLabel=a,this._documentColorsLabel=o,this.setTemplate({tag:"div",attributes:{class:["ck-color-grids-fragment",u.if("isVisible","ck-hidden",d=>!d)]},children:this.items}),this.removeColorButtonView=this._createRemoveColorButton(),this.items.add(this.removeColorButtonView)}updateDocumentColors(e,t){const i=e.document,s=this.documentColorsCount;this.documentColors.clear();for(const o of i.getRoots()){const r=e.createRangeIn(o);for(const a of r.getItems())if(a.is("$textProxy")&&a.hasAttribute(t)&&(this._addColorToDocumentColors(a.getAttribute(t)),this.documentColors.length>=s))return}}updateSelectedColors(){const e=this.documentColorsGrid,t=this.staticColorsGrid,i=this.selectedColor;t.selectedColor=i,e&&(e.selectedColor=i)}render(){if(super.render(),this.staticColorsGrid=this._createStaticColorsGrid(),this.items.add(this.staticColorsGrid),this.documentColorsCount){const e=xe.bind(this.documentColors,this.documentColors),t=new Jn(this.locale);t.text=this._documentColorsLabel,t.extendTemplate({attributes:{class:["ck","ck-color-grid__label",e.if("isEmpty","ck-hidden")]}}),this.items.add(t),this.documentColorsGrid=this._createDocumentColorsGrid(),this.items.add(this.documentColorsGrid)}this._createColorPickerButton(),this._addColorSelectorElementsToFocusTracker()}focus(){this.removeColorButtonView.focus()}destroy(){super.destroy()}addColorPickerButton(){this.colorPickerButtonView&&(this.items.add(this.colorPickerButtonView),this.focusTracker.add(this.colorPickerButtonView.element),this._focusables.add(this.colorPickerButtonView))}_addColorSelectorElementsToFocusTracker(){this.focusTracker.add(this.removeColorButtonView.element),this._focusables.add(this.removeColorButtonView),this.staticColorsGrid&&(this.focusTracker.add(this.staticColorsGrid.element),this._focusables.add(this.staticColorsGrid)),this.documentColorsGrid&&(this.focusTracker.add(this.documentColorsGrid.element),this._focusables.add(this.documentColorsGrid))}_createColorPickerButton(){this.colorPickerButtonView=new B,this.colorPickerButtonView.set({label:this._colorPickerLabel,withText:!0,icon:OS,class:"ck-color-selector__color-picker"}),this.colorPickerButtonView.on("execute",()=>{this.fire("colorPicker:show")})}_createRemoveColorButton(){const e=new B;return e.set({withText:!0,icon:BS,label:this._removeButtonLabel}),e.class="ck-color-selector__remove-color",e.on("execute",()=>{this.fire("execute",{value:null,source:"removeColorButton"})}),e.render(),e}_createStaticColorsGrid(){const e=new wc(this.locale,{colorDefinitions:this.colorDefinitions,columns:this.columns});return e.on("execute",(t,i)=>{this.fire("execute",{value:i.value,source:"staticColorsGrid"})}),e}_createDocumentColorsGrid(){const e=xe.bind(this.documentColors,this.documentColors),t=new wc(this.locale,{columns:this.columns});return t.extendTemplate({attributes:{class:e.if("isEmpty","ck-hidden")}}),t.items.bindTo(this.documentColors).using(i=>{const s=new qf;return s.set({color:i.color,hasBorder:i.options&&i.options.hasBorder}),i.label&&s.set({label:i.label,tooltip:!0}),s.on("execute",()=>{this.fire("execute",{value:i.color,source:"documentColorsGrid"})}),s}),this.documentColors.on("change:isEmpty",(i,s,o)=>{o&&(t.selectedColor=null)}),t}_addColorToDocumentColors(e){const t=this.colorDefinitions.find(i=>i.color===e);t?this.documentColors.add(Object.assign({},t)):this.documentColors.add({color:e,label:e,options:{hasBorder:!1}})}}/**
|
|
656
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
657
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
658
|
+
*/class FS extends T{constructor(e,{focusTracker:t,focusables:i,keystrokes:s,colorPickerViewConfig:o}){super(e),this.items=this.createCollection(),this.focusTracker=t,this.keystrokes=s,this.set("isVisible",!1),this.set("selectedColor",void 0),this._focusables=i,this._colorPickerViewConfig=o;const r=this.bindTemplate,{saveButtonView:a,cancelButtonView:l}=this._createActionButtons();this.saveButtonView=a,this.cancelButtonView=l,this.actionBarView=this._createActionBarView({saveButtonView:a,cancelButtonView:l}),this.setTemplate({tag:"div",attributes:{class:["ck-color-picker-fragment",r.if("isVisible","ck-hidden",c=>!c)]},children:this.items})}render(){super.render();const e=new IS(this.locale,{...this._colorPickerViewConfig});this.colorPickerView=e,this.colorPickerView.render(),this.selectedColor&&(e.color=this.selectedColor),this.listenTo(this,"change:selectedColor",(t,i,s)=>{e.color=s}),this.items.add(this.colorPickerView),this.items.add(this.actionBarView),this._addColorPickersElementsToFocusTracker(),this._stopPropagationOnArrowsKeys(),this._executeOnEnterPress(),this._executeUponColorChange()}destroy(){super.destroy()}focus(){this.colorPickerView.focus()}_executeOnEnterPress(){this.keystrokes.set("enter",e=>{this.isVisible&&this.focusTracker.focusedElement!==this.cancelButtonView.element&&(this.fire("execute",{value:this.selectedColor}),e.stopPropagation(),e.preventDefault())})}_stopPropagationOnArrowsKeys(){const e=t=>t.stopPropagation();this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}_addColorPickersElementsToFocusTracker(){for(const t of this.colorPickerView.slidersView)this.focusTracker.add(t.element),this._focusables.add(t);const e=this.colorPickerView.hexInputRow.children.get(1);e.element&&(this.focusTracker.add(e.element),this._focusables.add(e)),this.focusTracker.add(this.saveButtonView.element),this._focusables.add(this.saveButtonView),this.focusTracker.add(this.cancelButtonView.element),this._focusables.add(this.cancelButtonView)}_createActionBarView({saveButtonView:e,cancelButtonView:t}){const i=new T,s=this.createCollection();return s.add(e),s.add(t),i.setTemplate({tag:"div",attributes:{class:["ck","ck-color-selector_action-bar"]},children:s}),i}_createActionButtons(){const e=this.locale,t=e.t,i=new B(e),s=new B(e);return i.set({icon:I.check,class:"ck-button-save",type:"button",withText:!1,label:t("Accept")}),s.set({icon:I.cancel,class:"ck-button-cancel",type:"button",withText:!1,label:t("Cancel")}),i.on("execute",()=>{this.fire("execute",{source:"colorPickerSaveButton",value:this.selectedColor})}),s.on("execute",()=>{this.fire("colorPicker:cancel")}),{saveButtonView:i,cancelButtonView:s}}_executeUponColorChange(){this.colorPickerView.on("colorSelected",(e,t)=>{this.fire("execute",{value:t.color,source:"colorPicker"}),this.set("selectedColor",t.color)})}}/**
|
|
659
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
660
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
661
|
+
*/class DS extends T{constructor(e,{colors:t,columns:i,removeButtonLabel:s,documentColorsLabel:o,documentColorsCount:r,colorPickerLabel:a,colorPickerViewConfig:l}){super(e),this.items=this.createCollection(),this.focusTracker=new ne,this.keystrokes=new ae,this._focusables=new Ae,this._colorPickerViewConfig=l,this._focusCycler=new ke({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.colorGridsFragmentView=new MS(e,{colors:t,columns:i,removeButtonLabel:s,documentColorsLabel:o,documentColorsCount:r,colorPickerLabel:a,focusTracker:this.focusTracker,focusables:this._focusables}),this.colorPickerFragmentView=new FS(e,{focusables:this._focusables,focusTracker:this.focusTracker,keystrokes:this.keystrokes,colorPickerViewConfig:l}),this.set("_isColorGridsFragmentVisible",!0),this.set("_isColorPickerFragmentVisible",!1),this.set("selectedColor",void 0),this.colorGridsFragmentView.bind("isVisible").to(this,"_isColorGridsFragmentVisible"),this.colorPickerFragmentView.bind("isVisible").to(this,"_isColorPickerFragmentVisible"),this.on("change:selectedColor",(c,u,d)=>{this.colorGridsFragmentView.set("selectedColor",d),this.colorPickerFragmentView.set("selectedColor",d)}),this.colorGridsFragmentView.on("change:selectedColor",(c,u,d)=>{this.set("selectedColor",d)}),this.colorPickerFragmentView.on("change:selectedColor",(c,u,d)=>{this.set("selectedColor",d)}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-selector"]},children:this.items})}render(){super.render(),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}appendUI(){this._appendColorGridsFragment(),this._colorPickerViewConfig&&this._appendColorPickerFragment()}showColorPickerFragment(){!this.colorPickerFragmentView.colorPickerView||this._isColorPickerFragmentVisible||(this._isColorPickerFragmentVisible=!0,this.colorPickerFragmentView.focus(),this._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))}}/**
|
|
662
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
663
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
664
|
+
*/class NS{constructor(e){this._components=new Map,this.editor=e}*names(){for(const e of this._components.values())yield e.originalName}add(e,t){this._components.set(Uo(e),{callback:t,originalName:e})}create(e){if(!this.has(e))throw new g("componentfactory-item-missing",this,{name:e});return this._components.get(Uo(e)).callback(this.editor.locale)}has(e){return this._components.has(Uo(e))}}function Uo(n){return String(n).toLowerCase()}/**
|
|
665
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
666
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
667
|
+
*/class rg extends T{constructor(e,t={}){super(e);const i=this.bindTemplate;this.set("label",t.label||""),this.set("class",t.class||null),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__header",i.to("class")]},children:this.children}),t.icon&&(this.iconView=new at,this.iconView.content=t.icon,this.children.add(this.iconView));const s=new T(e);s.setTemplate({tag:"h2",attributes:{class:["ck","ck-form__header__label"]},children:[{text:i.to("label")}]}),this.children.add(s)}}/**
|
|
668
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
669
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
670
|
+
*/function $S(n){class e extends n{constructor(...i){super(...i),this._onDragBound=this._onDrag.bind(this),this._onDragEndBound=this._onDragEnd.bind(this),this._lastDraggingCoordinates={x:0,y:0},this.on("render",()=>{this._attachListeners()}),this.set("isDragging",!1)}_attachListeners(){this.listenTo(this.element,"mousedown",this._onDragStart.bind(this)),this.listenTo(this.element,"touchstart",this._onDragStart.bind(this))}_attachDragListeners(){this.listenTo(E.document,"mouseup",this._onDragEndBound),this.listenTo(E.document,"touchend",this._onDragEndBound),this.listenTo(E.document,"mousemove",this._onDragBound),this.listenTo(E.document,"touchmove",this._onDragBound)}_detachDragListeners(){this.stopListening(E.document,"mouseup",this._onDragEndBound),this.stopListening(E.document,"touchend",this._onDragEndBound),this.stopListening(E.document,"mousemove",this._onDragBound),this.stopListening(E.document,"touchmove",this._onDragBound)}_onDragStart(i,s){if(!this._isHandleElementPressed(s))return;this._attachDragListeners();let o=0,r=0;s instanceof MouseEvent?(o=s.clientX,r=s.clientY):(o=s.touches[0].clientX,r=s.touches[0].clientY),this._lastDraggingCoordinates={x:o,y:r},this.isDragging=!0}_onDrag(i,s){if(!this.isDragging){this._detachDragListeners();return}let o=0,r=0;s instanceof MouseEvent?(o=s.clientX,r=s.clientY):(o=s.touches[0].clientX,r=s.touches[0].clientY),s.preventDefault(),this.fire("drag",{deltaX:Math.round(o-this._lastDraggingCoordinates.x),deltaY:Math.round(r-this._lastDraggingCoordinates.y)}),this._lastDraggingCoordinates={x:o,y:r}}_onDragEnd(){this._detachDragListeners(),this.isDragging=!1}_isHandleElementPressed(i){return this.dragHandleElement?this.dragHandleElement===i.target||i.target instanceof HTMLElement&&this.dragHandleElement.contains(i.target):!1}}return e}/**
|
|
671
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
672
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
673
|
+
*/class zS extends T{constructor(e){super(e),this.children=this.createCollection(),this.keystrokes=new ae,this._focusTracker=new ne,this._focusables=new Ae,this.focusCycler=new ke({focusables:this._focusables,focusTracker:this._focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-dialog__actions"]},children:this.children})}render(){super.render(),this.keystrokes.listenTo(this.element)}setButtons(e){for(const t of e){const i=new B(this.locale);let s;i.on("execute",()=>t.onExecute()),t.onCreate&&t.onCreate(i);for(s in t)s!="onExecute"&&s!="onCreate"&&i.set(s,t[s]);this.children.add(i)}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)})}}/**
|
|
674
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
675
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
676
|
+
*/class HS extends T{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)}}/**
|
|
677
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
678
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
679
|
+
*/const ut={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"},gu=Ki("px");class Fn extends $S(T){constructor(e,{getCurrentDomRoot:t,getViewportOffset:i}){super(e),this.wasMoved=!1;const s=this.bindTemplate,o=e.t;this.set("className",""),this.set("ariaLabel",o("Editor dialog")),this.set("isModal",!1),this.set("position",ut.SCREEN_CENTER),this.set("_isVisible",!1),this.set("_isTransparent",!1),this.set("_top",0),this.set("_left",0),this._getCurrentDomRoot=t,this._getViewportOffset=i,this.decorate("moveTo"),this.parts=this.createCollection(),this.keystrokes=new ae,this.focusTracker=new ne,this._focusables=new Ae,this._focusCycler=new ke({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-dialog-overlay",s.if("isModal","ck-dialog-overlay__transparent",r=>!r),s.if("_isVisible","ck-hidden",r=>!r)],tabindex:"-1"},children:[{tag:"div",attributes:{tabindex:"-1",class:["ck","ck-dialog",s.to("className")],role:"dialog","aria-label":s.to("ariaLabel"),style:{top:s.to("_top",r=>gu(r)),left:s.to("_left",r=>gu(r)),visibility:s.if("_isTransparent","hidden")}},children:this.parts}]})}render(){super.render(),this.keystrokes.set("Esc",(e,t)=>{this.fire("close",{source:"escKeyPress"}),t()}),this.on("drag",(e,{deltaX:t,deltaY:i})=>{this.wasMoved=!0,this.moveBy(t,i)}),this.listenTo(E.window,"resize",()=>{this._isVisible&&!this.wasMoved&&this.updatePosition()}),this.listenTo(E.document,"scroll",()=>{this._isVisible&&!this.wasMoved&&this.updatePosition()}),this.on("change:_isVisible",(e,t,i)=>{i&&(this._isTransparent=!0,setTimeout(()=>{this.updatePosition(),this._isTransparent=!1,this.focus()},10))}),this.keystrokes.listenTo(this.element)}get dragHandleElement(){return this.headerView?this.headerView.element:null}setupParts({icon:e,title:t,hasCloseButton:i=!0,content:s,actionButtons:o}){t&&(this.headerView=new rg(this.locale,{icon:e}),i&&(this.closeButtonView=this._createCloseButton(),this.headerView.children.add(this.closeButtonView)),this.headerView.label=t,this.ariaLabel=t,this.parts.add(this.headerView,0)),s&&(s instanceof T&&(s=[s]),this.contentView=new HS(this.locale),this.contentView.children.addMany(s),this.parts.add(this.contentView)),o&&(this.actionsView=new zS(this.locale),this.actionsView.setButtons(o),this.parts.add(this.actionsView)),this._updateFocusCyclableItems()}focus(){this._focusCycler.focusFirst()}moveTo(e,t){const i=this._getViewportRect(),s=this._getDialogRect();e+s.width>i.right&&(e=i.right-s.width),e<i.left&&(e=i.left),t<i.top&&(t=i.top),this._moveTo(e,t)}_moveTo(e,t){this._left=e,this._top=t}moveBy(e,t){this.moveTo(this._left+e,this._top+t)}_moveOffScreen(){this._moveTo(-9999,-9999)}updatePosition(){if(!this.element||!this.element.parentNode)return;const e=this._getViewportRect();let t=this.position,i;this._getCurrentDomRoot()?i=this._getVisibleDomRootRect(e):t=ut.SCREEN_CENTER;const s=Fn.defaultOffset,o=this._getDialogRect();switch(t){case ut.EDITOR_TOP_SIDE:{if(i){const r=this.locale.contentLanguageDirection==="ltr"?i.right-o.width-s:i.left+s;this.moveTo(r,i.top+s)}else this._moveOffScreen();break}case ut.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 ut.SCREEN_CENTER:{this.moveTo(Math.round((e.width-o.width)/2),Math.round((e.height-o.height)/2));break}case ut.EDITOR_TOP_CENTER:{i?this.moveTo(Math.round(i.left+i.width/2-o.width/2),i.top+s):this._moveOffScreen();break}case ut.EDITOR_BOTTOM_CENTER:{i?this.moveTo(Math.round(i.left+i.width/2-o.width/2),i.bottom-o.height-s):this._moveOffScreen();break}case ut.EDITOR_ABOVE_CENTER:{i?this.moveTo(Math.round(i.left+i.width/2-o.width/2),i.top-o.height-s):this._moveOffScreen();break}case ut.EDITOR_BELOW_CENTER:{i?this.moveTo(Math.round(i.left+i.width/2-o.width/2),i.bottom+s):this._moveOffScreen();break}}}_getVisibleDomRootRect(e){let t=new O(this._getCurrentDomRoot()).getVisible();if(t){if(t=e.getIntersection(t),!t)return null}else return null;return t}_getDialogRect(){return new O(this.element.firstElementChild)}_getViewportRect(){return US(this._getViewportOffset())}_updateFocusCyclableItems(){const e=[];if(this.contentView)for(const t of this.contentView.children)Yn(t)&&e.push(t);this.actionsView&&e.push(this.actionsView),this.closeButtonView&&e.push(this.closeButtonView),e.forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element),BC(t)&&(this.listenTo(t.focusCycler,"forwardCycle",i=>{this._focusCycler.focusNext(),this._focusCycler.next!==this._focusCycler.focusables.get(this._focusCycler.current)&&i.stop()}),this.listenTo(t.focusCycler,"backwardCycle",i=>{this._focusCycler.focusPrevious(),this._focusCycler.previous!==this._focusCycler.focusables.get(this._focusCycler.current)&&i.stop()}))})}_createCloseButton(){const e=new B(this.locale),t=this.locale.t;return e.set({label:t("Close"),tooltip:!0,icon:I.cancel}),e.on("execute",()=>this.fire("close",{source:"closeButton"})),e}}Fn.defaultOffset=15;function US(n){n=Object.assign({top:0,bottom:0,left:0,right:0},n);const e=new O(E.window);return e.top+=n.top,e.height-=n.top,e.bottom-=n.bottom,e.height-=n.bottom,e.left+=n.left,e.right-=n.right,e.width-=n.left+n.right,e}/**
|
|
680
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
681
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
682
|
+
*/const pu=Ki("px"),wu=E.document.body,WS={top:-99999,left:-99999,name:"arrowless",config:{withArrow:!1}};class be extends T{constructor(e){super(e);const t=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("position","arrow_nw"),this.set("isVisible",!1),this.set("withArrow",!0),this.set("class",void 0),this._pinWhenIsVisibleCallback=null,this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-panel",t.to("position",i=>`ck-balloon-panel_${i}`),t.if("isVisible","ck-balloon-panel_visible"),t.if("withArrow","ck-balloon-panel_with-arrow"),t.to("class")],style:{top:t.to("top",pu),left:t.to("left",pu)}},children:this.content})}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(e){this.show();const t=be.defaultPositions,i=Object.assign({},{element:this.element,positions:[t.southArrowNorth,t.southArrowNorthMiddleWest,t.southArrowNorthMiddleEast,t.southArrowNorthWest,t.southArrowNorthEast,t.northArrowSouth,t.northArrowSouthMiddleWest,t.northArrowSouthMiddleEast,t.northArrowSouthWest,t.northArrowSouthEast,t.viewportStickyNorth],limiter:wu,fitInViewport:!0},e),s=be._getOptimalPosition(i)||WS,o=parseInt(s.left),r=parseInt(s.top),a=s.name,l=s.config||{},{withArrow:c=!0}=l;this.top=r,this.left=o,this.position=a,this.withArrow=c}pin(e){this.unpin(),this._pinWhenIsVisibleCallback=()=>{this.isVisible?this._startPinning(e):this._stopPinning()},this._startPinning(e),this.listenTo(this,"change:isVisible",this._pinWhenIsVisibleCallback)}unpin(){this._pinWhenIsVisibleCallback&&(this._stopPinning(),this.stopListening(this,"change:isVisible",this._pinWhenIsVisibleCallback),this._pinWhenIsVisibleCallback=null,this.hide())}_startPinning(e){this.attachTo(e);const t=Ur(e.target),i=e.limiter?Ur(e.limiter):wu;this.listenTo(E.document,"scroll",(s,o)=>{const r=o.target,a=t&&r.contains(t),l=i&&r.contains(i);(a||l||!t||!i)&&this.attachTo(e)},{useCapture:!0}),this.listenTo(E.window,"resize",()=>{this.attachTo(e)})}_stopPinning(){this.stopListening(E.document,"scroll"),this.stopListening(E.window,"resize")}}be.arrowSideOffset=25;be.arrowHeightOffset=10;be.stickyVerticalOffset=20;be._getOptimalPosition=Va;be.defaultPositions=ag();function Ur(n){return ti(n)?n:ho(n)?n.commonAncestorContainer:typeof n=="function"?Ur(n()):null}function ag(n={}){const{sideOffset:e=be.arrowSideOffset,heightOffset:t=be.arrowHeightOffset,stickyVerticalOffset:i=be.stickyVerticalOffset,config:s}=n;return{northWestArrowSouthWest:(a,l)=>({top:o(a,l),left:a.left-e,name:"arrow_sw",...s&&{config:s}}),northWestArrowSouthMiddleWest:(a,l)=>({top:o(a,l),left:a.left-l.width*.25-e,name:"arrow_smw",...s&&{config:s}}),northWestArrowSouth:(a,l)=>({top:o(a,l),left:a.left-l.width/2,name:"arrow_s",...s&&{config:s}}),northWestArrowSouthMiddleEast:(a,l)=>({top:o(a,l),left:a.left-l.width*.75+e,name:"arrow_sme",...s&&{config:s}}),northWestArrowSouthEast:(a,l)=>({top:o(a,l),left:a.left-l.width+e,name:"arrow_se",...s&&{config:s}}),northArrowSouthWest:(a,l)=>({top:o(a,l),left:a.left+a.width/2-e,name:"arrow_sw",...s&&{config:s}}),northArrowSouthMiddleWest:(a,l)=>({top:o(a,l),left:a.left+a.width/2-l.width*.25-e,name:"arrow_smw",...s&&{config:s}}),northArrowSouth:(a,l)=>({top:o(a,l),left:a.left+a.width/2-l.width/2,name:"arrow_s",...s&&{config:s}}),northArrowSouthMiddleEast:(a,l)=>({top:o(a,l),left:a.left+a.width/2-l.width*.75+e,name:"arrow_sme",...s&&{config:s}}),northArrowSouthEast:(a,l)=>({top:o(a,l),left:a.left+a.width/2-l.width+e,name:"arrow_se",...s&&{config:s}}),northEastArrowSouthWest:(a,l)=>({top:o(a,l),left:a.right-e,name:"arrow_sw",...s&&{config:s}}),northEastArrowSouthMiddleWest:(a,l)=>({top:o(a,l),left:a.right-l.width*.25-e,name:"arrow_smw",...s&&{config:s}}),northEastArrowSouth:(a,l)=>({top:o(a,l),left:a.right-l.width/2,name:"arrow_s",...s&&{config:s}}),northEastArrowSouthMiddleEast:(a,l)=>({top:o(a,l),left:a.right-l.width*.75+e,name:"arrow_sme",...s&&{config:s}}),northEastArrowSouthEast:(a,l)=>({top:o(a,l),left:a.right-l.width+e,name:"arrow_se",...s&&{config:s}}),southWestArrowNorthWest:a=>({top:r(a),left:a.left-e,name:"arrow_nw",...s&&{config:s}}),southWestArrowNorthMiddleWest:(a,l)=>({top:r(a),left:a.left-l.width*.25-e,name:"arrow_nmw",...s&&{config:s}}),southWestArrowNorth:(a,l)=>({top:r(a),left:a.left-l.width/2,name:"arrow_n",...s&&{config:s}}),southWestArrowNorthMiddleEast:(a,l)=>({top:r(a),left:a.left-l.width*.75+e,name:"arrow_nme",...s&&{config:s}}),southWestArrowNorthEast:(a,l)=>({top:r(a),left:a.left-l.width+e,name:"arrow_ne",...s&&{config:s}}),southArrowNorthWest:a=>({top:r(a),left:a.left+a.width/2-e,name:"arrow_nw",...s&&{config:s}}),southArrowNorthMiddleWest:(a,l)=>({top:r(a),left:a.left+a.width/2-l.width*.25-e,name:"arrow_nmw",...s&&{config:s}}),southArrowNorth:(a,l)=>({top:r(a),left:a.left+a.width/2-l.width/2,name:"arrow_n",...s&&{config:s}}),southArrowNorthMiddleEast:(a,l)=>({top:r(a),left:a.left+a.width/2-l.width*.75+e,name:"arrow_nme",...s&&{config:s}}),southArrowNorthEast:(a,l)=>({top:r(a),left:a.left+a.width/2-l.width+e,name:"arrow_ne",...s&&{config:s}}),southEastArrowNorthWest:a=>({top:r(a),left:a.right-e,name:"arrow_nw",...s&&{config:s}}),southEastArrowNorthMiddleWest:(a,l)=>({top:r(a),left:a.right-l.width*.25-e,name:"arrow_nmw",...s&&{config:s}}),southEastArrowNorth:(a,l)=>({top:r(a),left:a.right-l.width/2,name:"arrow_n",...s&&{config:s}}),southEastArrowNorthMiddleEast:(a,l)=>({top:r(a),left:a.right-l.width*.75+e,name:"arrow_nme",...s&&{config:s}}),southEastArrowNorthEast:(a,l)=>({top:r(a),left:a.right-l.width+e,name:"arrow_ne",...s&&{config:s}}),westArrowEast:(a,l)=>({top:a.top+a.height/2-l.height/2,left:a.left-l.width-t,name:"arrow_e",...s&&{config:s}}),eastArrowWest:(a,l)=>({top:a.top+a.height/2-l.height/2,left:a.right+t,name:"arrow_w",...s&&{config:s}}),viewportStickyNorth:(a,l,c,u)=>{const d=u||c;return!a.getIntersection(d)||d.height-a.height>i?null:{top:d.top+i,left:a.left+a.width/2-l.width/2,name:"arrowless",config:{withArrow:!1,...s}}}};function o(a,l){return a.top-l.height-t}function r(a){return a.bottom+t}}/**
|
|
683
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
684
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
685
|
+
*/const bu="ck-tooltip";class me extends $e(){constructor(e){if(super(),this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this._resizeObserver=null,me._editors.add(e),me._instance)return me._instance;me._instance=this,this.tooltipTextView=new T(e.locale),this.tooltipTextView.set("text",""),this.tooltipTextView.setTemplate({tag:"span",attributes:{class:["ck","ck-tooltip__text"]},children:[{text:this.tooltipTextView.bindTemplate.to("text")}]}),this.balloonPanelView=new be(e.locale),this.balloonPanelView.class=bu,this.balloonPanelView.content.add(this.tooltipTextView),this._pinTooltipDebounced=Di(this._pinTooltip,600),this.listenTo(E.document,"mouseenter",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(E.document,"mouseleave",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(E.document,"focus",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(E.document,"blur",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(E.document,"scroll",this._onScroll.bind(this),{useCapture:!0}),this._watchdogExcluded=!0}destroy(e){const t=e.ui.view&&e.ui.view.body;me._editors.delete(e),this.stopListening(e.ui),t&&t.has(this.balloonPanelView)&&t.remove(this.balloonPanelView),me._editors.size||(this._unpinTooltip(),this.balloonPanelView.destroy(),this.stopListening(),me._instance=null)}static getPositioningFunctions(e){const t=me.defaultBalloonPositions;return{s:[t.southArrowNorth,t.southArrowNorthEast,t.southArrowNorthWest],n:[t.northArrowSouth],e:[t.eastArrowWest],w:[t.westArrowEast],sw:[t.southArrowNorthEast],se:[t.southArrowNorthWest]}[e]}_onEnterOrFocus(e,{target:t}){const i=Wo(t);i&&i!==this._currentElementWithTooltip&&(this._unpinTooltip(),this._pinTooltipDebounced(i,qS(i)))}_onLeaveOrBlur(e,{target:t,relatedTarget:i}){if(e.name==="mouseleave"){if(!ti(t)||this._currentElementWithTooltip&&t!==this._currentElementWithTooltip)return;const s=Wo(t),o=Wo(i);s&&s!==o&&this._unpinTooltip()}else{if(this._currentElementWithTooltip&&t!==this._currentElementWithTooltip)return;this._unpinTooltip()}}_onScroll(e,{target:t}){this._currentElementWithTooltip&&(t.contains(this.balloonPanelView.element)&&t.contains(this._currentElementWithTooltip)||this._unpinTooltip())}_pinTooltip(e,{text:t,position:i,cssClass:s}){const o=J(me._editors.values()).ui.view.body;o.has(this.balloonPanelView)||o.add(this.balloonPanelView),this.tooltipTextView.text=t,this.balloonPanelView.pin({target:e,positions:me.getPositioningFunctions(i)}),this._resizeObserver=new Q(e,()=>{ii(e)||this._unpinTooltip()}),this.balloonPanelView.class=[bu,s].filter(r=>r).join(" ");for(const r of me._editors)this.listenTo(r.ui,"update",this._updateTooltipPosition.bind(this),{priority:"low"});this._currentElementWithTooltip=e,this._currentTooltipPosition=i}_unpinTooltip(){this._pinTooltipDebounced.cancel(),this.balloonPanelView.unpin();for(const e of me._editors)this.stopListening(e.ui,"update");this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this._resizeObserver&&this._resizeObserver.destroy()}_updateTooltipPosition(){if(!ii(this._currentElementWithTooltip)){this._unpinTooltip();return}this.balloonPanelView.pin({target:this._currentElementWithTooltip,positions:me.getPositioningFunctions(this._currentTooltipPosition)})}}me.defaultBalloonPositions=ag({heightOffset:5,sideOffset:13});me._editors=new Set;me._instance=null;function Wo(n){return ti(n)?n.closest("[data-cke-tooltip-text]:not([data-cke-tooltip-disabled])"):null}function qS(n){return{text:n.dataset.ckeTooltipText,position:n.dataset.ckeTooltipPosition||"s",cssClass:n.dataset.ckeTooltipClass||""}}const jS=`<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>
|
|
686
|
+
`;/**
|
|
687
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
688
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
689
|
+
*/const GS=53,KS=10,ZS=50,JS=350,YS="Powered by";class QS extends $e(){constructor(e){super(),this.editor=e,this._balloonView=null,this._lastFocusedEditableElement=null,this._showBalloonThrottled=An(this._showBalloon.bind(this),50,{leading:!0}),e.on("ready",this._handleEditorReady.bind(this))}destroy(){const e=this._balloonView;e&&(e.unpin(),this._balloonView=null),this._showBalloonThrottled.cancel(),this.stopListening()}_handleEditorReady(){const e=this.editor,t=!!e.config.get("ui.poweredBy.forceVisible");/* istanbul ignore next -- @preserve */!t&&q2(e.config.get("licenseKey"))==="VALID"||e.ui.view&&(e.ui.focusTracker.on("change:isFocused",(i,s,o)=>{this._updateLastFocusedEditableElement(),o?this._showBalloon():this._hideBalloon()}),e.ui.focusTracker.on("change:focusedElement",(i,s,o)=>{this._updateLastFocusedEditableElement(),o&&this._showBalloon()}),e.ui.on("update",()=>{this._showBalloonThrottled()}))}_createBalloonView(){const e=this.editor,t=this._balloonView=new be,i=cg(e),s=new XS(e.locale,i.label);t.content.add(s),t.set({class:"ck-powered-by-balloon"}),e.ui.view.body.add(t),e.ui.focusTracker.add(t.element),this._balloonView=t}_showBalloon(){if(!this._lastFocusedEditableElement)return;const e=ex(this.editor,this._lastFocusedEditableElement);e&&(this._balloonView||this._createBalloonView(),this._balloonView.pin(e))}_hideBalloon(){this._balloonView&&this._balloonView.unpin()}_updateLastFocusedEditableElement(){const e=this.editor,t=e.ui.focusTracker.isFocused,i=e.ui.focusTracker.focusedElement;if(!t||!i){this._lastFocusedEditableElement=null;return}const s=Array.from(e.ui.getEditableElementsNames()).map(o=>e.ui.getEditableElement(o));s.includes(i)?this._lastFocusedEditableElement=i:this._lastFocusedEditableElement=s[0]}}class XS extends T{constructor(e,t){super(e);const i=new at,s=this.bindTemplate;i.set({content:jS,isColorInherited:!1}),i.extendTemplate({attributes:{style:{width:GS+"px",height:KS+"px"}}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-powered-by"],"aria-hidden":!0},children:[{tag:"a",attributes:{href:"https://ckeditor.com/?utm_source=ckeditor&utm_medium=referral&utm_campaign=701Dn000000hVgmIAE_powered_by_ckeditor_logo",target:"_blank",tabindex:"-1"},children:[...t?[{tag:"span",attributes:{class:["ck","ck-powered-by__label"]},children:[t]}]:[],i],on:{dragstart:s.to(o=>o.preventDefault())}}]})}}function ex(n,e){const t=cg(n),i=t.side==="right"?tx(e,t):ix(e,t);return{target:e,positions:[i]}}function tx(n,e){return lg(n,e,(t,i)=>t.left+t.width-i.width-e.horizontalOffset)}function ix(n,e){return lg(n,e,t=>t.left+e.horizontalOffset)}function lg(n,e,t){return(i,s)=>{const o=new O(n);if(o.width<JS||o.height<ZS)return null;let r;e.position==="inside"?r=o.bottom-s.height:r=o.bottom-s.height/2,r-=e.verticalOffset;const a=t(o,s),c=i.clone().moveTo(a,r).getIntersection(s.clone().moveTo(a,r)).getVisible();return!c||c.getArea()<s.getArea()?null:{top:r,left:a,name:`position_${e.position}-side_${e.side}`,config:{withArrow:!1}}}}function cg(n){const e=n.config.get("ui.poweredBy"),t=e&&e.position||"border";return{position:t,label:YS,verticalOffset:t==="inside"?5:0,horizontalOffset:5,side:n.locale.contentLanguageDirection==="ltr"?"right":"left",...e}}/**
|
|
690
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
691
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
692
|
+
*/const ug={POLITE:"polite",ASSERTIVE:"assertive"};class nx{constructor(e){this.editor=e}announce(e,t,i=ug.POLITE){const s=this.editor;this.view||(this.view=new sx(s.locale),s.ui.view.body.add(this.view));let o=this.view.regionViews.find(r=>r.regionName===e);o||(o=new ox(this.view.locale),this.view.regionViews.add(o)),o.set({regionName:e,text:t,politeness:i})}}class sx extends T{constructor(e){super(e),this.regionViews=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-aria-live-announcer"]},children:this.regionViews})}}class ox extends T{constructor(e){super(e);const t=this.bindTemplate;this.set("regionName",""),this.set("text",""),this.set("politeness",ug.POLITE),this.setTemplate({tag:"div",attributes:{role:"region","data-region":t.to("regionName"),"aria-live":t.to("politeness")},children:[{text:t.to("text")}]})}}/**
|
|
693
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
694
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
695
|
+
*/class rx extends U(){constructor(e){super(),this.isReady=!1,this._editableElementsMap=new Map,this._focusableToolbarDefinitions=[];const t=e.editing.view;this.editor=e,this.componentFactory=new NS(e),this.focusTracker=new ne,this.tooltipManager=new me(e),this.poweredBy=new QS(e),this.ariaLiveAnnouncer=new nx(e),this.set("viewportOffset",this._readViewportOffsetFromConfig()),this.once("ready",()=>{this.isReady=!0}),this.listenTo(t.document,"layoutChanged",this.update.bind(this)),this.listenTo(t,"scrollToTheSelection",this._handleScrollToTheSelection.bind(this)),this._initFocusTracking()}get element(){return null}update(){this.fire("update")}destroy(){this.stopListening(),this.focusTracker.destroy(),this.tooltipManager.destroy(this.editor),this.poweredBy.destroy();for(const e of this._editableElementsMap.values())e.ckeditorInstance=null,this.editor.keystrokes.stopListening(e);this._editableElementsMap=new Map,this._focusableToolbarDefinitions=[]}setEditableElement(e,t){this._editableElementsMap.set(e,t),t.ckeditorInstance||(t.ckeditorInstance=this.editor),this.focusTracker.add(t);const i=()=>{this.editor.editing.view.getDomRoot(e)||this.editor.keystrokes.listenTo(t)};this.isReady?i():this.once("ready",i)}removeEditableElement(e){const t=this._editableElementsMap.get(e);t&&(this._editableElementsMap.delete(e),this.editor.keystrokes.stopListening(t),this.focusTracker.remove(t),t.ckeditorInstance=null)}getEditableElement(e="main"){return this._editableElementsMap.get(e)}getEditableElementsNames(){return this._editableElementsMap.keys()}addToolbar(e,t={}){e.isRendered?(this.focusTracker.add(e.element),this.editor.keystrokes.listenTo(e.element)):e.once("render",()=>{this.focusTracker.add(e.element),this.editor.keystrokes.listenTo(e.element)}),this._focusableToolbarDefinitions.push({toolbarView:e,options:t})}get _editableElements(){return console.warn("editor-ui-deprecated-editable-elements: The EditorUI#_editableElements property has been deprecated and will be removed in the near future.",{editorUI:this}),this._editableElementsMap}_readViewportOffsetFromConfig(){const e=this.editor,t=e.config.get("ui.viewportOffset");if(t)return t;const i=e.config.get("toolbar.viewportTopOffset");return i?(console.warn("editor-ui-deprecated-viewport-offset-config: The `toolbar.vieportTopOffset` configuration option is deprecated. It will be removed from future CKEditor versions. Use `ui.viewportOffset.top` instead."),{top:i}):{top:0}}_initFocusTracking(){const e=this.editor,t=e.editing.view;let i,s;e.keystrokes.set("Alt+F10",(o,r)=>{const a=this.focusTracker.focusedElement;Array.from(this._editableElementsMap.values()).includes(a)&&!Array.from(t.domRoots.values()).includes(a)&&(i=a);const l=this._getCurrentFocusedToolbarDefinition();(!l||!s)&&(s=this._getFocusableCandidateToolbarDefinitions());for(let c=0;c<s.length;c++){const u=s.shift();if(s.push(u),u!==l&&this._focusFocusableCandidateToolbar(u)){l&&l.options.afterBlur&&l.options.afterBlur();break}}r()}),e.keystrokes.set("Esc",(o,r)=>{const a=this._getCurrentFocusedToolbarDefinition();a&&(i?(i.focus(),i=null):e.editing.view.focus(),a.options.afterBlur&&a.options.afterBlur(),r())})}_getFocusableCandidateToolbarDefinitions(){const e=[];for(const t of this._focusableToolbarDefinitions){const{toolbarView:i,options:s}=t;(ii(i.element)||s.beforeFocus)&&e.push(t)}return e.sort((t,i)=>_u(t)-_u(i)),e}_getCurrentFocusedToolbarDefinition(){for(const e of this._focusableToolbarDefinitions)if(e.toolbarView.element&&e.toolbarView.element.contains(this.focusTracker.focusedElement))return e;return null}_focusFocusableCandidateToolbar(e){const{toolbarView:t,options:{beforeFocus:i}}=e;return i&&i(),ii(t.element)?(t.focus(),!0):!1}_handleScrollToTheSelection(e,t){const i={top:0,bottom:0,left:0,right:0,...this.viewportOffset};t.viewportOffset.top+=i.top,t.viewportOffset.bottom+=i.bottom,t.viewportOffset.left+=i.left,t.viewportOffset.right+=i.right}}function _u(n){const{toolbarView:e,options:t}=n;let i=10;return ii(e.element)&&i--,t.isContextual&&i--,i}/**
|
|
696
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
697
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
698
|
+
*/class ax extends T{constructor(e){super(e),this.body=new lC(e)}render(){super.render(),this.body.attachToDom()}destroy(){return this.body.detachFromDom(),super.destroy()}}/**
|
|
699
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
700
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
701
|
+
*/class lx extends ax{constructor(e){super(e),this.top=this.createCollection(),this.main=this.createCollection(),this._voiceLabelView=this._createVoiceLabel(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-editor","ck-rounded-corners"],role:"application",dir:e.uiLanguageDirection,lang:e.uiLanguage,"aria-labelledby":this._voiceLabelView.id},children:[this._voiceLabelView,{tag:"div",attributes:{class:["ck","ck-editor__top","ck-reset_all"],role:"presentation"},children:this.top},{tag:"div",attributes:{class:["ck","ck-editor__main"],role:"presentation"},children:this.main}]})}_createVoiceLabel(){const e=this.t,t=new Jn;return t.text=e("Rich Text Editor"),t.extendTemplate({attributes:{class:"ck-voice-label"}}),t}}/**
|
|
702
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
703
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
704
|
+
*/class cx extends T{constructor(e,t,i){super(e),this.name=null,this.setTemplate({tag:"div",attributes:{class:["ck","ck-content","ck-editor__editable","ck-rounded-corners"],lang:e.contentLanguage,dir:e.contentLanguageDirection}}),this.set("isFocused",!1),this._editableElement=i,this._hasExternalElement=!!this._editableElement,this._editingView=t}render(){super.render(),this._hasExternalElement?this.template.apply(this.element=this._editableElement):this._editableElement=this.element,this.on("change:isFocused",()=>this._updateIsFocusedClasses()),this._updateIsFocusedClasses()}destroy(){this._hasExternalElement&&this.template.revert(this._editableElement),super.destroy()}get hasExternalElement(){return this._hasExternalElement}_updateIsFocusedClasses(){const e=this._editingView;e.isRenderingInProgress?i(this):t(this);function t(s){e.change(o=>{const r=e.document.getRoot(s.name);o.addClass(s.isFocused?"ck-focused":"ck-blurred",r),o.removeClass(s.isFocused?"ck-blurred":"ck-focused",r)})}function i(s){e.once("change:isRenderingInProgress",(o,r,a)=>{a?i(s):t(s)})}}}/**
|
|
705
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
706
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
707
|
+
*/class ux extends cx{constructor(e,t,i,s={}){super(e,t,i);const o=e.t;this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}}),this._generateLabel=s.label||(()=>o("Editor editing area: %0",this.name))}render(){super.render();const e=this._editingView;e.change(t=>{const i=e.document.getRoot(this.name);t.setAttribute("aria-label",this._generateLabel(this),i)})}}/**
|
|
708
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
709
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
710
|
+
*/class vu extends rm{static get pluginName(){return"Notification"}init(){this.on("show:warning",(e,t)=>{window.alert(t.message)},{priority:"lowest"})}showSuccess(e,t={}){this._showNotification({message:e,type:"success",namespace:t.namespace,title:t.title})}showInfo(e,t={}){this._showNotification({message:e,type:"info",namespace:t.namespace,title:t.title})}showWarning(e,t={}){this._showNotification({message:e,type:"warning",namespace:t.namespace,title:t.title})}_showNotification(e){const t=e.namespace?`show:${e.type}:${e.namespace}`:`show:${e.type}`;this.fire(t,{message:e.message,type:e.type,title:e.title||""})}}/**
|
|
711
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
712
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
713
|
+
*/class hi extends U(){constructor(e,t){super(),t&&Oh(this,t),e&&this.set(e)}}/**
|
|
714
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
715
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
716
|
+
*/const ms=Ki("px");class Gs extends w{static get pluginName(){return"ContextualBalloon"}constructor(e){super(e),this._viewToStack=new Map,this._idToStack=new Map,this._view=null,this._rotatorView=null,this._fakePanelsView=null,this.positionLimiter=()=>{const t=this.editor.editing.view,s=t.document.selection.editableElement;return s?t.domConverter.mapViewToDom(s.root):null},this.set("visibleView",null),this.set("_numberOfStacks",0),this.set("_singleViewMode",!1)}destroy(){super.destroy(),this._view&&this._view.destroy(),this._rotatorView&&this._rotatorView.destroy(),this._fakePanelsView&&this._fakePanelsView.destroy()}get view(){return this._view||this._createPanelView(),this._view}hasView(e){return Array.from(this._viewToStack.keys()).includes(e)}add(e){if(this._view||this._createPanelView(),this.hasView(e.view))throw new g("contextualballoon-add-view-exist",[this,e]);const t=e.stackId||"main";if(!this._idToStack.has(t)){this._idToStack.set(t,new Map([[e.view,e]])),this._viewToStack.set(e.view,this._idToStack.get(t)),this._numberOfStacks=this._idToStack.size,(!this._visibleStack||e.singleViewMode)&&this.showStack(t);return}const i=this._idToStack.get(t);e.singleViewMode&&this.showStack(t),i.set(e.view,e),this._viewToStack.set(e.view,i),i===this._visibleStack&&this._showView(e)}remove(e){if(!this.hasView(e))throw new g("contextualballoon-remove-view-not-exist",[this,e]);const t=this._viewToStack.get(e);this._singleViewMode&&this.visibleView===e&&(this._singleViewMode=!1),this.visibleView===e&&(t.size===1?this._idToStack.size>1?this._showNextStack():(this.view.hide(),this.visibleView=null,this._rotatorView.hideView()):this._showView(Array.from(t.values())[t.size-2])),t.size===1?(this._idToStack.delete(this._getStackId(t)),this._numberOfStacks=this._idToStack.size):t.delete(e),this._viewToStack.delete(e)}updatePosition(e){e&&(this._visibleStack.get(this.visibleView).position=e),this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition()}showStack(e){this.visibleStack=e;const t=this._idToStack.get(e);if(!t)throw new g("contextualballoon-showstack-stack-not-exist",this);this._visibleStack!==t&&this._showView(Array.from(t.values()).pop())}_createPanelView(){this._view=new be(this.editor.locale),this.editor.ui.view.body.add(this._view),this.editor.ui.focusTracker.add(this._view.element),this._rotatorView=this._createRotatorView(),this._fakePanelsView=this._createFakePanelsView()}get _visibleStack(){return this._viewToStack.get(this.visibleView)}_getStackId(e){return Array.from(this._idToStack.entries()).find(i=>i[1]===e)[0]}_showNextStack(){const e=Array.from(this._idToStack.values());let t=e.indexOf(this._visibleStack)+1;e[t]||(t=0),this.showStack(this._getStackId(e[t]))}_showPrevStack(){const e=Array.from(this._idToStack.values());let t=e.indexOf(this._visibleStack)-1;e[t]||(t=e.length-1),this.showStack(this._getStackId(e[t]))}_createRotatorView(){const e=new dx(this.editor.locale),t=this.editor.locale.t;return this.view.content.add(e),e.bind("isNavigationVisible").to(this,"_numberOfStacks",this,"_singleViewMode",(i,s)=>!s&&i>1),e.on("change:isNavigationVisible",()=>this.updatePosition(),{priority:"low"}),e.bind("counter").to(this,"visibleView",this,"_numberOfStacks",(i,s)=>{if(s<2)return"";const o=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return t("%0 of %1",[o,s])}),e.buttonNextView.on("execute",()=>{e.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showNextStack()}),e.buttonPrevView.on("execute",()=>{e.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showPrevStack()}),e}_createFakePanelsView(){const e=new hx(this.editor.locale,this.view);return e.bind("numberOfPanels").to(this,"_numberOfStacks",this,"_singleViewMode",(t,i)=>!i&&t>=2?Math.min(t-1,2):0),e.listenTo(this.view,"change:top",()=>e.updatePosition()),e.listenTo(this.view,"change:left",()=>e.updatePosition()),this.editor.ui.view.body.add(e),e}_showView({view:e,balloonClassName:t="",withArrow:i=!0,singleViewMode:s=!1}){this.view.class=t,this.view.withArrow=i,this._rotatorView.showView(e),this.visibleView=e,this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition(),s&&(this._singleViewMode=!0)}_getBalloonPosition(){let e=Array.from(this._visibleStack.values()).pop().position;return e&&(e.limiter||(e=Object.assign({},e,{limiter:this.positionLimiter})),e=Object.assign({},e,{viewportOffsetConfig:this.editor.ui.viewportOffset})),e}}class dx extends T{constructor(e){super(e);const t=e.t,i=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new ne,this.buttonPrevView=this._createButtonView(t("Previous"),I.previousArrow),this.buttonNextView=this._createButtonView(t("Next"),I.nextArrow),this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-rotator"],"z-index":"-1"},children:[{tag:"div",attributes:{class:["ck-balloon-rotator__navigation",i.to("isNavigationVisible",s=>s?"":"ck-hidden")]},children:[this.buttonPrevView,{tag:"span",attributes:{class:["ck-balloon-rotator__counter"]},children:[{text:i.to("counter")}]},this.buttonNextView]},{tag:"div",attributes:{class:"ck-balloon-rotator__content"},children:this.content}]})}render(){super.render(),this.focusTracker.add(this.element)}destroy(){super.destroy(),this.focusTracker.destroy()}showView(e){this.hideView(),this.content.add(e)}hideView(){this.content.clear()}_createButtonView(e,t){const i=new B(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i}}class hx extends T{constructor(e,t){super(e);const i=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("height",0),this.set("width",0),this.set("numberOfPanels",0),this.content=this.createCollection(),this._balloonPanelView=t,this.setTemplate({tag:"div",attributes:{class:["ck-fake-panel",i.to("numberOfPanels",s=>s?"":"ck-hidden")],style:{top:i.to("top",ms),left:i.to("left",ms),width:i.to("width",ms),height:i.to("height",ms)}},children:this.content}),this.on("change:numberOfPanels",(s,o,r,a)=>{r>a?this._addPanels(r-a):this._removePanels(a-r),this.updatePosition()})}_addPanels(e){for(;e--;){const t=new T;t.setTemplate({tag:"div"}),this.content.add(t),this.registerChild(t)}}_removePanels(e){for(;e--;){const t=this.content.last;this.content.remove(t),this.deregisterChild(t),t.destroy()}}updatePosition(){if(this.numberOfPanels){const{top:e,left:t}=this._balloonPanelView,{width:i,height:s}=new O(this._balloonPanelView.element);Object.assign(this,{top:e,left:t,width:i,height:s})}}}/**
|
|
717
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
718
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
719
|
+
*/const vi=Ki("px");class fx extends T{constructor(e){super(e);const t=this.bindTemplate;this.set("isActive",!1),this.set("isSticky",!1),this.set("limiterElement",null),this.set("limiterBottomOffset",50),this.set("viewportTopOffset",0),this.set("_marginLeft",null),this.set("_isStickyToTheBottomOfLimiter",!1),this.set("_stickyTopOffset",null),this.set("_stickyBottomOffset",null),this.content=this.createCollection(),this._contentPanelPlaceholder=new xe({tag:"div",attributes:{class:["ck","ck-sticky-panel__placeholder"],style:{display:t.to("isSticky",i=>i?"block":"none"),height:t.to("isSticky",i=>i?vi(this._contentPanelRect.height):null)}}}).render(),this.contentPanelElement=new xe({tag:"div",attributes:{class:["ck","ck-sticky-panel__content",t.if("isSticky","ck-sticky-panel__content_sticky"),t.if("_isStickyToTheBottomOfLimiter","ck-sticky-panel__content_sticky_bottom-limit")],style:{width:t.to("isSticky",i=>i?vi(this._contentPanelPlaceholder.getBoundingClientRect().width):null),top:t.to("_stickyTopOffset",i=>i&&vi(i)),bottom:t.to("_stickyBottomOffset",i=>i&&vi(i)),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(E.document,"scroll",()=>{this.checkIfShouldBeSticky()},{useCapture:!0}),this.listenTo(this,"change:isActive",()=>{this.checkIfShouldBeSticky()})}checkIfShouldBeSticky(){if(!this.limiterElement||!this.isActive){this._unstick();return}const e=new O(this.limiterElement);let t=e.getVisible();if(t){const i=new O(E.window);i.top+=this.viewportTopOffset,i.height-=this.viewportTopOffset,t=t.getIntersection(i)}if(t&&e.top<t.top){const i=t.top;if(i+this._contentPanelRect.height+this.limiterBottomOffset>t.bottom){const s=Math.max(e.bottom-t.bottom,0)+this.limiterBottomOffset;e.bottom-s>e.top+this._contentPanelRect.height?this._stickToBottomOfLimiter(s):this._unstick()}else this._contentPanelRect.height+this.limiterBottomOffset<e.height?this._stickToTopOfAncestors(i):this._unstick()}else this._unstick()}_stickToTopOfAncestors(e){this.isSticky=!0,this._isStickyToTheBottomOfLimiter=!1,this._stickyTopOffset=e,this._stickyBottomOffset=null,this._marginLeft=vi(-E.window.scrollX)}_stickToBottomOfLimiter(e){this.isSticky=!0,this._isStickyToTheBottomOfLimiter=!0,this._stickyTopOffset=null,this._stickyBottomOffset=e,this._marginLeft=vi(-E.window.scrollX)}_unstick(){this.isSticky=!1,this._isStickyToTheBottomOfLimiter=!1,this._stickyTopOffset=null,this._stickyBottomOffset=null,this._marginLeft=null}get _contentPanelRect(){return new O(this.contentPanelElement)}}/**
|
|
720
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
721
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
722
|
+
*/class mx extends Zi{constructor(e,t){const i=e.t,s=Object.assign({},{showResetButton:!0,showIcon:!0,creator:Qn},t);super(e,s.creator),this.label=t.label,this._viewConfig=s,this._viewConfig.showIcon&&(this.iconView=new at,this.iconView.content=I.loupe,this.fieldWrapperChildren.add(this.iconView,0),this.extendTemplate({attributes:{class:"ck-search__query_with-icon"}})),this._viewConfig.showResetButton&&(this.resetButtonView=new B(e),this.resetButtonView.set({label:i("Clear"),icon:I.cancel,class:"ck-search__reset",isVisible:!1,tooltip:!0}),this.resetButtonView.on("execute",()=>{this.reset(),this.focus(),this.fire("reset")}),this.resetButtonView.bind("isVisible").to(this.fieldView,"isEmpty",o=>!o),this.fieldWrapperChildren.add(this.resetButtonView),this.extendTemplate({attributes:{class:"ck-search__query_with-reset"}}))}reset(){this.fieldView.reset(),this._viewConfig.showResetButton&&(this.resetButtonView.isVisible=!1)}}/**
|
|
723
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
724
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
725
|
+
*/class gx extends T{constructor(){super();const e=this.bindTemplate;this.set({isVisible:!1,primaryText:"",secondaryText:""}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-search__info",e.if("isVisible","ck-hidden",t=>!t)],tabindex:-1},children:[{tag:"span",children:[{text:[e.to("primaryText")]}]},{tag:"span",children:[{text:[e.to("secondaryText")]}]}]})}focus(){this.element.focus()}}/**
|
|
726
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
727
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
728
|
+
*/class px extends T{constructor(e){super(e),this.children=this.createCollection(),this.focusTracker=new ne,this.setTemplate({tag:"div",attributes:{class:["ck","ck-search__results"],tabindex:-1},children:this.children}),this._focusCycler=new ke({focusables:this.children,focusTracker:this.focusTracker})}render(){super.render();for(const e of this.children)this.focusTracker.add(e.element)}focus(){this._focusCycler.focusFirst()}focusFirst(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}/**
|
|
729
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
730
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
731
|
+
*/class wx extends T{constructor(e,t){super(e),this._config=t,this.filteredView=t.filteredView,this.queryView=this._createSearchTextQueryView(),this.focusTracker=new ne,this.keystrokes=new ae,this.resultsView=new px(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 gx,this._enableDefaultInfoViewBehavior(),this.on("render",()=>{this.search("")})),this.resultsView.children.addMany([this.infoView,this.filteredView]),this.focusCycler=new ke({focusables:this.focusableChildren,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.on("search",(i,{resultsCount:s,totalItemsCount:o})=>{this.resultsCount=s,this.totalItemsCount=o}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-search",t.class||null],tabindex:"-1"},children:this.children})}render(){super.render(),this.children.addMany([this.queryView,this.resultsView]);const e=t=>t.stopPropagation();for(const t of this.focusableChildren)this.focusTracker.add(t.element);this.keystrokes.listenTo(this.element),this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}focus(){this.queryView.focus()}reset(){this.queryView.reset(),this.search("")}search(e){const t=e?new RegExp(Gy(e),"ig"):null,i=this.filteredView.filter(t);this.fire("search",{query:e,...i})}_createSearchTextQueryView(){const e=new mx(this.locale,this._config.queryView);return this.listenTo(e.fieldView,"input",()=>{this.search(e.fieldView.element.value)}),e.on("reset",()=>this.reset()),e.bind("isEnabled").to(this),e}_enableDefaultInfoViewBehavior(){const e=this.locale.t,t=this.infoView;this.on("search",(s,o)=>{if(o.resultsCount)t.set({isVisible:!1});else{const r=this._config.infoView&&this._config.infoView.text;let a,l;o.totalItemsCount?r&&r.notFound?(a=r.notFound.primary,l=r.notFound.secondary):(a=e("No results found"),l=""):r&&r.noSearchableItems?(a=r.noSearchableItems.primary,l=r.noSearchableItems.secondary):(a=e("No searchable items"),l=""),t.set({primaryText:i(a,o),secondaryText:i(l,o),isVisible:!0})}});function i(s,{query:o,resultsCount:r,totalItemsCount:a}){return typeof s=="function"?s(o,r,a):s}}}/**
|
|
732
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
733
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
734
|
+
*/class Dn extends wx{constructor(e,t){super(e,t),this._config=t;const i=Ki("px");this.extendTemplate({attributes:{class:["ck-autocomplete"]}});const s=this.resultsView.bindTemplate;this.resultsView.set("isVisible",!1),this.resultsView.set("_position","s"),this.resultsView.set("_width",0),this.resultsView.extendTemplate({attributes:{class:[s.if("isVisible","ck-hidden",o=>!o),s.to("_position",o=>`ck-search__results_${o}`)],style:{width:s.to("_width",i)}}}),this.focusTracker.on("change:isFocused",(o,r,a)=>{this._updateResultsVisibility(),a?this.resultsView.element.scrollTop=0:t.resetOnBlur&&this.queryView.reset()}),this.on("search",()=>{this._updateResultsVisibility(),this._updateResultsViewWidthAndPosition()}),this.keystrokes.set("esc",(o,r)=>{this.resultsView.isVisible&&(this.queryView.focus(),this.resultsView.isVisible=!1,r())}),this.listenTo(E.document,"scroll",()=>{this._updateResultsViewWidthAndPosition()}),this.on("change:isEnabled",()=>{this._updateResultsVisibility()}),this.filteredView.on("execute",(o,{value:r})=>{this.focus(),this.reset(),this.queryView.fieldView.value=this.queryView.fieldView.element.value=r,this.resultsView.isVisible=!1}),this.resultsView.on("change:isVisible",()=>{this._updateResultsViewWidthAndPosition()})}_updateResultsViewWidthAndPosition(){if(!this.resultsView.isVisible)return;this.resultsView._width=new O(this.queryView.fieldView.element).width;const e=Dn._getOptimalPosition({element:this.resultsView.element,target:this.queryView.element,fitInViewport:!0,positions:Dn.defaultResultsPositions});this.resultsView._position=e?e.name:"s"}_updateResultsVisibility(){const e=typeof this._config.queryMinChars>"u"?0:this._config.queryMinChars,t=this.queryView.fieldView.element.value.length;this.resultsView.isVisible=this.focusTracker.isFocused&&this.isEnabled&&t>=e}}Dn.defaultResultsPositions=[n=>({top:n.bottom,left:n.left,name:"s"}),(n,e)=>({top:n.top-e.height,left:n.left,name:"n"})];Dn._getOptimalPosition=Va;/**
|
|
735
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
736
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
737
|
+
*/class bx extends rx{constructor(e,t){super(e),this.view=t,this._toolbarConfig=nm(e.config.get("toolbar")),this._elementReplacer=new Ef,this.listenTo(e.editing.view,"scrollToTheSelection",this._handleScrollToTheSelectionWithStickyPanel.bind(this))}get element(){return this.view.element}init(e){const t=this.editor,i=this.view,s=t.editing.view,o=i.editable,r=s.document.getRoot();o.name=r.rootName,i.render();const a=o.element;this.setEditableElement(o.name,a),i.editable.bind("isFocused").to(this.focusTracker),s.attachDomRoot(a),e&&this._elementReplacer.replace(e,this.element),this._initPlaceholder(),this._initToolbar(),this._initDialogPluginIntegration(),this.fire("ready")}destroy(){super.destroy();const e=this.view,t=this.editor.editing.view;this._elementReplacer.restore(),t.detachDomRoot(e.editable.name),e.destroy()}_initToolbar(){const e=this.view;e.stickyPanel.bind("isActive").to(this.focusTracker,"isFocused"),e.stickyPanel.limiterElement=e.element,e.stickyPanel.bind("viewportTopOffset").to(this,"viewportOffset",({top:t})=>t||0),e.toolbar.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(e.toolbar)}_initPlaceholder(){const e=this.editor,t=e.editing.view,i=t.document.getRoot(),s=e.sourceElement;let o;const r=e.config.get("placeholder");r&&(o=typeof r=="string"?r:r[this.view.editable.name]),!o&&s&&s.tagName.toLowerCase()==="textarea"&&(o=s.getAttribute("placeholder")),o&&(i.placeholder=o),am({view:t,element:i,isDirectHost:!1,keepOnFocus:!0})}_handleScrollToTheSelectionWithStickyPanel(e,t,i){const s=this.view.stickyPanel;if(s.isSticky){const o=new O(s.element).height;t.viewportOffset.top+=o}else{const o=()=>{this.editor.editing.view.scrollToTheSelection(i)};this.listenTo(s,"change:isSticky",o),setTimeout(()=>{this.stopListening(s,"change:isSticky",o)},20)}}_initDialogPluginIntegration(){if(!this.editor.plugins.has("Dialog"))return;const e=this.view.stickyPanel,t=this.editor.plugins.get("Dialog");t.on("show",()=>{const i=t.view;i.on("moveTo",(s,o)=>{if(!e.isSticky||i.wasMoved)return;const r=new O(e.contentPanelElement);o[1]<r.bottom+Fn.defaultOffset&&(o[1]=r.bottom+Fn.defaultOffset)},{priority:"high"})},{priority:"low"})}}/**
|
|
738
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
739
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
740
|
+
*/class _x extends lx{constructor(e,t,i={}){super(e),this.stickyPanel=new fx(e),this.toolbar=new Ja(e,{shouldGroupWhenFull:i.shouldToolbarGroupWhenFull}),this.editable=new ux(e,t)}render(){super.render(),this.stickyPanel.content.add(this.toolbar),this.top.add(this.stickyPanel),this.main.add(this.editable)}}/**
|
|
741
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
742
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
743
|
+
*/class dg{constructor(e){if(this.crashes=[],this.state="initializing",this._now=Date.now,this.crashes=[],this._crashNumberLimit=typeof e.crashNumberLimit=="number"?e.crashNumberLimit:3,this._minimumNonErrorTimePeriod=typeof e.minimumNonErrorTimePeriod=="number"?e.minimumNonErrorTimePeriod:5e3,this._boundErrorHandler=t=>{const i="error"in t?t.error:t.reason;i instanceof Error&&this._handleError(i,t)},this._listeners={},!this._restart)throw new Error("The Watchdog class was split into the abstract `Watchdog` class and the `EditorWatchdog` class. Please, use `EditorWatchdog` if you have used the `Watchdog` class previously.")}destroy(){this._stopErrorHandling(),this._listeners={}}on(e,t){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t)}off(e,t){this._listeners[e]=this._listeners[e].filter(i=>i!==t)}_fire(e,...t){const i=this._listeners[e]||[];for(const s of i)s.apply(this,[null,...t])}_startErrorHandling(){window.addEventListener("error",this._boundErrorHandler),window.addEventListener("unhandledrejection",this._boundErrorHandler)}_stopErrorHandling(){window.removeEventListener("error",this._boundErrorHandler),window.removeEventListener("unhandledrejection",this._boundErrorHandler)}_handleError(e,t){if(this._shouldReactToError(e)){this.crashes.push({message:e.message,stack:e.stack,filename:t instanceof ErrorEvent?t.filename:void 0,lineno:t instanceof ErrorEvent?t.lineno:void 0,colno:t instanceof ErrorEvent?t.colno:void 0,date:this._now()});const i=this._shouldRestart();this.state="crashed",this._fire("stateChange"),this._fire("error",{error:e,causesRestart:i}),i?this._restart():(this.state="crashedPermanently",this._fire("stateChange"))}}_shouldReactToError(e){return e.is&&e.is("CKEditorError")&&e.context!==void 0&&e.context!==null&&this.state==="ready"&&this._isErrorComingFromThisItem(e)}_shouldRestart(){if(this.crashes.length<=this._crashNumberLimit)return!0;const e=this.crashes[this.crashes.length-1].date,t=this.crashes[this.crashes.length-1-this._crashNumberLimit].date;return(e-t)/this._crashNumberLimit>this._minimumNonErrorTimePeriod}}/**
|
|
744
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
745
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
746
|
+
*/function Wr(n,e=new Set){const t=[n],i=new Set;let s=0;for(;t.length>s;){const o=t[s++];if(!(i.has(o)||!vx(o)||e.has(o)))if(i.add(o),Symbol.iterator in o)try{for(const r of o)t.push(r)}catch{}else for(const r in o)r!=="defaultValue"&&t.push(o[r])}return i}function vx(n){const e=Object.prototype.toString.call(n),t=typeof n;return!(t==="number"||t==="boolean"||t==="string"||t==="symbol"||t==="function"||e==="[object Date]"||e==="[object RegExp]"||e==="[object Module]"||n===void 0||n===null||n._watchdogExcluded||n instanceof EventTarget||n instanceof Event)}/**
|
|
747
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
748
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
749
|
+
*/function hg(n,e,t=new Set){if(n===e&&yx(n))return!0;const i=Wr(n,t),s=Wr(e,t);for(const o of i)if(s.has(o))return!0;return!1}function yx(n){return typeof n=="object"&&n!==null}/**
|
|
750
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
751
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
752
|
+
*/class fg extends dg{constructor(e,t={}){super(t),this._editor=null,this._initUsingData=!0,this._editables={},this._throttledSave=An(this._save.bind(this),typeof t.saveInterval=="number"?t.saveInterval:5e3),e&&(this._creator=(i,s)=>e.create(i,s)),this._destructor=i=>i.destroy()}get editor(){return this._editor}get _item(){return this._editor}setCreator(e){this._creator=e}setDestructor(e){this._destructor=e}_restart(){return Promise.resolve().then(()=>(this.state="initializing",this._fire("stateChange"),this._destroy())).catch(e=>{console.error("An error happened during the editor destroying.",e)}).then(()=>{const e={},t=[],i=this._config.rootsAttributes||{},s={};for(const[r,a]of Object.entries(this._data.roots))a.isLoaded?(e[r]="",s[r]=i[r]||{}):t.push(r);const o={...this._config,extraPlugins:this._config.extraPlugins||[],lazyRoots:t,rootsAttributes:s,_watchdogInitialData:this._data};return delete o.initialData,o.extraPlugins.push(Cx),this._initUsingData?this.create(e,o,o.context):ti(this._elementOrData)?this.create(this._elementOrData,o,o.context):this.create(this._editables,o,o.context)}).then(()=>{this._fire("restart")})}create(e=this._elementOrData,t=this._config,i){return Promise.resolve().then(()=>(super._startErrorHandling(),this._elementOrData=e,this._initUsingData=typeof e=="string"||Object.keys(e).length>0&&typeof Object.values(e)[0]=="string",this._config=this._cloneEditorConfiguration(t)||{},this._config.context=i,this._creator(e,this._config))).then(s=>{this._editor=s,s.model.document.on("change:data",this._throttledSave),this._lastDocumentVersion=s.model.document.version,this._data=this._getData(),this._initUsingData||(this._editables=this._getEditables()),this.state="ready",this._fire("stateChange")})}destroy(){return Promise.resolve().then(()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy()))}_destroy(){return Promise.resolve().then(()=>{this._stopErrorHandling(),this._throttledSave.cancel();const e=this._editor;return this._editor=null,e.model.document.off("change:data",this._throttledSave),this._destructor(e)})}_save(){const e=this._editor.model.document.version;try{this._data=this._getData(),this._initUsingData||(this._editables=this._getEditables()),this._lastDocumentVersion=e}catch(t){console.error(t,"An error happened during restoring editor data. Editor will be restored from the previously saved data.")}}_setExcludedProperties(e){this._excludedProps=e}_getData(){const e=this._editor,t=e.model.document.roots.filter(a=>a.isAttached()&&a.rootName!="$graveyard"),{plugins:i}=e,s=i.has("CommentsRepository")&&i.get("CommentsRepository"),o=i.has("TrackChanges")&&i.get("TrackChanges"),r={roots:{},markers:{},commentThreads:JSON.stringify([]),suggestions:JSON.stringify([])};t.forEach(a=>{r.roots[a.rootName]={content:JSON.stringify(Array.from(a.getChildren())),attributes:JSON.stringify(Array.from(a.getAttributes())),isLoaded:a._isLoaded}});for(const a of e.model.markers)a._affectsData&&(r.markers[a.name]={rangeJSON:a.getRange().toJSON(),usingOperation:a._managedUsingOperations,affectsData:a._affectsData});return s&&(r.commentThreads=JSON.stringify(s.getCommentThreads({toJSON:!0,skipNotAttached:!0}))),o&&(r.suggestions=JSON.stringify(o.getSuggestions({toJSON:!0,skipNotAttached:!0}))),r}_getEditables(){const e={};for(const t of this.editor.model.document.getRootNames()){const i=this.editor.ui.getEditableElement(t);i&&(e[t]=i)}return e}_isErrorComingFromThisItem(e){return hg(this._editor,e.context,this._excludedProps)}_cloneEditorConfiguration(e){return Ia(e,(t,i)=>{if(ti(t)||i==="context")return t})}}class Cx{constructor(e){this.editor=e,this._data=e.config.get("_watchdogInitialData")}init(){this.editor.data.on("init",e=>{e.stop(),this.editor.model.enqueueChange({isUndoable:!1},t=>{this._restoreCollaborationData(),this._restoreEditorData(t)}),this.editor.data.fire("ready")},{priority:999})}_createNode(e,t){if("name"in t){const i=e.createElement(t.name,t.attributes);if(t.children)for(const s of t.children)i._appendChild(this._createNode(e,s));return i}else return e.createText(t.data,t.attributes)}_restoreEditorData(e){const t=this.editor;Object.entries(this._data.roots).forEach(([i,{content:s,attributes:o}])=>{const r=JSON.parse(s),a=JSON.parse(o),l=t.model.document.getRoot(i);for(const[c,u]of a)e.setAttribute(c,u,l);for(const c of r){const u=this._createNode(e,c);e.insert(u,l,"end")}}),Object.entries(this._data.markers).forEach(([i,s])=>{const{document:o}=t.model,{rangeJSON:{start:r,end:a},...l}=s,c=o.getRoot(r.root),u=e.createPositionFromPath(c,r.path,r.stickiness),d=e.createPositionFromPath(c,a.path,a.stickiness),h=e.createRange(u,d);e.addMarker(i,{range:h,...l})})}_restoreCollaborationData(){const e=JSON.parse(this._data.commentThreads),t=JSON.parse(this._data.suggestions);e.forEach(i=>{const s=this.editor.config.get("collaboration.channelId"),o=this.editor.plugins.get("CommentsRepository");o.hasCommentThread(i.threadId)&&o.getCommentThread(i.threadId).remove(),o.addCommentThread({channelId:s,...i})}),t.forEach(i=>{const s=this.editor.plugins.get("TrackChangesEditing");if(s.hasSuggestion(i.id)){const o=s.getSuggestion(i.id);o.attributes=i.attributes}else s.addSuggestionData(i)})}}/**
|
|
753
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
754
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
755
|
+
*/const vn=Symbol("MainQueueId");class kx extends dg{constructor(e,t={}){super(t),this._watchdogs=new Map,this._context=null,this._contextProps=new Set,this._actionQueues=new Ex,this._watchdogConfig=t,this._creator=i=>e.create(i),this._destructor=i=>i.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(vn,()=>(this._contextConfig=e,this._create()))}getItem(e){return this._getWatchdog(e)._item}getItemState(e){return this._getWatchdog(e).state}add(e){const t=yu(e);return Promise.all(t.map(i=>this._actionQueues.enqueue(i.id,()=>{if(this.state==="destroyed")throw new Error("Cannot add items to destroyed watchdog.");if(!this._context)throw new Error("Context was not created yet. You should call the `ContextWatchdog#create()` method first.");let s;if(this._watchdogs.has(i.id))throw new Error(`Item with the given id is already added: '${i.id}'.`);if(i.type==="editor")return s=new fg(null,this._watchdogConfig),s.setCreator(i.creator),s._setExcludedProperties(this._contextProps),i.destructor&&s.setDestructor(i.destructor),this._watchdogs.set(i.id,s),s.on("error",(o,{error:r,causesRestart:a})=>{this._fire("itemError",{itemId:i.id,error:r}),a&&this._actionQueues.enqueue(i.id,()=>new Promise(l=>{const c=()=>{s.off("restart",c),this._fire("itemRestart",{itemId:i.id}),l()};s.on("restart",c)}))}),s.create(i.sourceElementOrData,i.config,this._context);throw new Error(`Not supported item type: '${i.type}'.`)})))}remove(e){const t=yu(e);return Promise.all(t.map(i=>this._actionQueues.enqueue(i,()=>{const s=this._getWatchdog(i);return this._watchdogs.delete(i),s.destroy()})))}destroy(){return this._actionQueues.enqueue(vn,()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy()))}_restart(){return this._actionQueues.enqueue(vn,()=>(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=Wr(this._context),Promise.all(Array.from(this._watchdogs.values()).map(t=>(t._setExcludedProperties(this._contextProps),t.create(void 0,void 0,this._context))))))}_destroy(){return Promise.resolve().then(()=>{this._stopErrorHandling();const e=this._context;return this._context=null,this._contextProps=new Set,Promise.all(Array.from(this._watchdogs.values()).map(t=>t.destroy())).then(()=>this._destructor(e))})}_getWatchdog(e){const t=this._watchdogs.get(e);if(!t)throw new Error(`Item with the given id was not registered: ${e}.`);return t}_isErrorComingFromThisItem(e){for(const t of this._watchdogs.values())if(t._isErrorComingFromThisItem(e))return!1;return hg(this._context,e.context)}}class Ex{constructor(){this._onEmptyCallbacks=[],this._queues=new Map,this._activeActions=0}onEmpty(e){this._onEmptyCallbacks.push(e)}enqueue(e,t){const i=e===vn;this._activeActions++,this._queues.get(e)||this._queues.set(e,Promise.resolve());const o=(i?Promise.all(this._queues.values()):Promise.all([this._queues.get(vn),this._queues.get(e)])).then(t),r=o.catch(()=>{});return this._queues.set(e,r),o.finally(()=>{this._activeActions--,this._queues.get(e)===r&&this._activeActions===0&&this._onEmptyCallbacks.forEach(a=>a())})}}function yu(n){return Array.isArray(n)?n:[n]}/**
|
|
756
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
757
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
758
|
+
*/class bo extends Ss(Nr(HT)){constructor(e,t={}){if(!Is(e)&&t.initialData!==void 0)throw new g("editor-create-initial-data",null);super(t),this.config.get("initialData")===void 0&&this.config.set("initialData",Tx(e)),Is(e)&&(this.sourceElement=e),this.model.document.createRoot();const i=!this.config.get("toolbar.shouldNotGroupWhenFull"),s=new _x(this.locale,this.editing.view,{shouldToolbarGroupWhenFull:i});this.ui=new bx(this,s),UT(this)}destroy(){return this.sourceElement&&this.updateSourceElement(),this.ui.destroy(),super.destroy()}static create(e,t={}){return new Promise(i=>{const s=new this(e,t);i(s.initPlugins().then(()=>s.ui.init(Is(e)?e:null)).then(()=>s.data.init(s.config.get("initialData"))).then(()=>s.fire("ready")).then(()=>s))})}}bo.Context=om;bo.EditorWatchdog=fg;bo.ContextWatchdog=kx;function Tx(n){return Is(n)?_2(n):n}function Is(n){return ti(n)}/**
|
|
759
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
760
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
761
|
+
*/const Qa=["left","right","center","justify"];function mg(n){return Qa.includes(n)}function gg(n,e){return e.contentLanguageDirection=="rtl"?n==="right":n==="left"}function pg(n){const e=n.map(i=>{let s;return typeof i=="string"?s={name:i}:s=i,s}).filter(i=>{const s=Qa.includes(i.name);return s||H("alignment-config-name-not-recognized",{option:i}),s}),t=e.filter(i=>!!i.className).length;if(t&&t<e.length)throw new g("alignment-config-classnames-are-missing",{configuredOptions:n});return e.forEach((i,s,o)=>{const r=o.slice(s+1);if(r.some(l=>l.name==i.name))throw new g("alignment-config-name-already-defined",{option:i,configuredOptions:n});if(i.className&&r.some(c=>c.className==i.className))throw new g("alignment-config-classname-already-defined",{option:i,configuredOptions:n})}),e}/**
|
|
762
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
763
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
764
|
+
*/const Xa="alignment";class Ax extends R{refresh(){const t=this.editor.locale,i=J(this.editor.model.document.selection.getSelectedBlocks());this.isEnabled=!!i&&this._canBeAligned(i),this.isEnabled&&i.hasAttribute("alignment")?this.value=i.getAttribute("alignment"):this.value=t.contentLanguageDirection==="rtl"?"right":"left"}execute(e={}){const t=this.editor,i=t.locale,s=t.model,o=s.document,r=e.value;s.change(a=>{const l=Array.from(o.selection.getSelectedBlocks()).filter(d=>this._canBeAligned(d)),c=l[0].getAttribute("alignment");gg(r,i)||c===r||!r?Sx(l,a):xx(l,a,r)})}_canBeAligned(e){return this.editor.model.schema.checkAttribute(e,Xa)}}function Sx(n,e){for(const t of n)e.removeAttribute(Xa,t)}function xx(n,e,t){for(const i of n)e.setAttribute(Xa,t,i)}/**
|
|
765
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
766
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
767
|
+
*/class Ix extends w{static get pluginName(){return"AlignmentEditing"}constructor(e){super(e),e.config.define("alignment",{options:Qa.map(t=>({name:t}))})}init(){const e=this.editor,t=e.locale,i=e.model.schema,o=pg(e.config.get("alignment.options")).filter(c=>mg(c.name)&&!gg(c.name,t)),r=o.some(c=>!!c.className);i.extend("$block",{allowAttributes:"alignment"}),e.model.schema.setAttributeProperties("alignment",{isFormatting:!0}),r?e.conversion.attributeToAttribute(Lx(o)):e.conversion.for("downcast").attributeToAttribute(Px(o));const a=Rx(o);for(const c of a)e.conversion.for("upcast").attributeToAttribute(c);const l=Vx(o);for(const c of l)e.conversion.for("upcast").attributeToAttribute(c);e.commands.add("alignment",new Ax(e))}}function Px(n){const e={};for(const{name:i}of n)e[i]={key:"style",value:{"text-align":i}};return{model:{key:"alignment",values:n.map(i=>i.name)},view:e}}function Rx(n){const e=[];for(const{name:t}of n)e.push({view:{key:"style",value:{"text-align":t}},model:{key:"alignment",value:t}});return e}function Vx(n){const e=[];for(const{name:t}of n)e.push({view:{key:"align",value:t},model:{key:"alignment",value:t}});return e}function Lx(n){const e={};for(const i of n)e[i.name]={key:"class",value:i.className};return{model:{key:"alignment",values:n.map(i=>i.name)},view:e}}/**
|
|
768
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
769
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
770
|
+
*/const gs=new Map([["left",I.alignLeft],["right",I.alignRight],["center",I.alignCenter],["justify",I.alignJustify]]);class Bx extends w{get localizedOptionTitles(){const e=this.editor.t;return{left:e("Align left"),right:e("Align right"),center:e("Align center"),justify:e("Justify")}}static get pluginName(){return"AlignmentUI"}init(){const e=this.editor,t=e.ui.componentFactory,i=e.t,s=pg(e.config.get("alignment.options"));s.map(o=>o.name).filter(mg).forEach(o=>this._addButton(o)),t.add("alignment",o=>{const r=fe(o);po(r,()=>s.map(c=>t.create(`alignment:${c.name}`)),{enableActiveItemFocusOnDropdownOpen:!0,isVertical:!0,ariaLabel:i("Text alignment toolbar")}),r.buttonView.set({label:i("Text alignment"),tooltip:!0}),r.extendTemplate({attributes:{class:"ck-alignment-dropdown"}});const a=o.contentLanguageDirection==="rtl"?gs.get("right"):gs.get("left"),l=e.commands.get("alignment");return r.buttonView.bind("icon").to(l,"value",c=>gs.get(c)||a),r.bind("isEnabled").to(l,"isEnabled"),this.listenTo(r,"execute",()=>{e.editing.view.focus()}),r})}_addButton(e){const t=this.editor;t.ui.componentFactory.add(`alignment:${e}`,i=>{const s=t.commands.get("alignment"),o=new B(i);return o.set({label:this.localizedOptionTitles[e],icon:gs.get(e),tooltip:!0,isToggleable:!0}),o.bind("isEnabled").to(s),o.bind("isOn").to(s,"value",r=>r===e),this.listenTo(o,"execute",()=>{t.execute("alignment",{value:e}),t.editing.view.focus()}),o})}}/**
|
|
771
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
772
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
773
|
+
*/class Ox extends w{static get requires(){return[Ix,Bx]}static get pluginName(){return"Alignment"}}/**
|
|
774
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
775
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
776
|
+
*/class wg{constructor(e,t=20){this._batch=null,this.model=e,this._size=0,this.limit=t,this._isLocked=!1,this._changeCallback=(i,s)=>{s.isLocal&&s.isUndoable&&s!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch({isTyping:!0})),this._batch}get size(){return this._size}input(e){this._size+=e,this._size>=this.limit&&this._reset(!0)}get isLocked(){return this._isLocked}lock(){this._isLocked=!0}unlock(){this._isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(e=!1){(!this.isLocked||e)&&(this._batch=null,this._size=0)}}/**
|
|
777
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
778
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
779
|
+
*/class Mx extends R{constructor(e,t){super(e),this._buffer=new wg(e.model,t),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){const t=this.editor.model,i=t.document,s=e.text||"",o=s.length;let r=i.selection;if(e.selection?r=e.selection:e.range&&(r=t.createSelection(e.range)),!t.canEditAt(r))return;const a=e.resultRange;t.enqueueChange(this._buffer.batch,l=>{this._buffer.lock();const c=Array.from(i.selection.getAttributes());t.deleteContent(r),s&&t.insertContent(l.createText(s,c),r),a?l.setSelection(a):r.is("documentSelection")||l.setSelection(r),this._buffer.unlock(),this._buffer.input(o)})}}/**
|
|
780
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
781
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
782
|
+
*/const Cu=["insertText","insertReplacementText"];class Fx extends lt{constructor(e){super(e),this.focusObserver=e.getObserver(Us),L.isAndroid&&Cu.push("insertCompositionText");const t=e.document;t.on("beforeinput",(i,s)=>{if(!this.isEnabled)return;const{data:o,targetRanges:r,inputType:a,domEvent:l}=s;if(!Cu.includes(a))return;this.focusObserver.flush();const c=new _t(t,"insertText");t.fire(c,new Hi(e,l,{text:o,selection:e.createSelection(r)})),c.stop.called&&i.stop()}),t.on("compositionend",(i,{data:s,domEvent:o})=>{!this.isEnabled||L.isAndroid||s&&t.fire("insertText",new Hi(e,o,{text:s,selection:t.selection}))},{priority:"lowest"})}observe(){}stopObserving(){}}/**
|
|
783
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
784
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
785
|
+
*/class bg extends w{static get pluginName(){return"Input"}init(){const e=this.editor,t=e.model,i=e.editing.view,s=t.document.selection;i.addObserver(Fx);const o=new Mx(e,e.config.get("typing.undoStep")||20);e.commands.add("insertText",o),e.commands.add("input",o),this.listenTo(i.document,"insertText",(r,a)=>{i.document.isComposing||a.preventDefault();const{text:l,selection:c,resultRange:u}=a,d=Array.from(c.getRanges()).map(m=>e.editing.mapper.toModelRange(m));let h=l;if(L.isAndroid){const m=Array.from(d[0].getItems()).reduce((p,_)=>p+(_.is("$textProxy")?_.data:""),"");m&&(m.length<=h.length?h.startsWith(m)&&(h=h.substring(m.length),d[0].start=d[0].start.getShiftedBy(m.length)):m.startsWith(h)&&(d[0].start=d[0].start.getShiftedBy(h.length),h=""))}const f={text:h,selection:t.createSelection(d)};u&&(f.resultRange=e.editing.mapper.toModelRange(u)),e.execute("insertText",f),i.scrollToTheSelection()}),L.isAndroid?this.listenTo(i.document,"keydown",(r,a)=>{s.isCollapsed||a.keyCode!=229||!i.document.isComposing||ku(t,o)}):this.listenTo(i.document,"compositionstart",()=>{s.isCollapsed||ku(t,o)})}}function ku(n,e){if(!e.isEnabled)return;const t=e.buffer;t.lock(),n.enqueueChange(t.batch,()=>{n.deleteContent(n.document.selection)}),t.unlock()}/**
|
|
786
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
787
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
788
|
+
*/class Eu extends R{constructor(e,t){super(e),this.direction=t,this._buffer=new wg(e.model,e.config.get("typing.undoStep")),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}execute(e={}){const t=this.editor.model,i=t.document;t.enqueueChange(this._buffer.batch,s=>{this._buffer.lock();const o=s.createSelection(e.selection||i.selection);if(!t.canEditAt(o))return;const r=e.sequence||1,a=o.isCollapsed;if(o.isCollapsed&&t.modifySelection(o,{direction:this.direction,unit:e.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(r)){this._replaceEntireContentWithParagraph(s);return}if(this._shouldReplaceFirstBlockWithParagraph(o,r)){this.editor.execute("paragraph",{selection:o});return}if(o.isCollapsed)return;let l=0;o.getFirstRange().getMinimalFlatRanges().forEach(c=>{l+=Ar(c.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))}),t.deleteContent(o,{doNotResetEntireContent:a,direction:this.direction}),this._buffer.input(l),s.setSelection(o),this._buffer.unlock()})}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;const t=this.editor.model,s=t.document.selection,o=t.schema.getLimitElement(s);if(!(s.isCollapsed&&s.containsEntireContent(o))||!t.schema.checkChild(o,"paragraph"))return!1;const a=o.getChild(0);return!(a&&a.is("element","paragraph"))}_replaceEntireContentWithParagraph(e){const t=this.editor.model,s=t.document.selection,o=t.schema.getLimitElement(s),r=e.createElement("paragraph");e.remove(e.createRangeIn(o)),e.insert(r,o),e.setSelection(r,0)}_shouldReplaceFirstBlockWithParagraph(e,t){const i=this.editor.model;if(t>1||this.direction!="backward"||!e.isCollapsed)return!1;const s=e.getFirstPosition(),o=i.schema.getLimitElement(s),r=o.getChild(0);return!(s.parent!=r||!e.containsEntireContent(r)||!i.schema.checkChild(o,"paragraph")||r.name=="paragraph")}}/**
|
|
789
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
790
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
791
|
+
*/const Dx="character",Tu="word",Nx="codePoint",It="selection",Ri="backward",hn="forward",_g={deleteContent:{unit:It,direction:Ri},deleteContentBackward:{unit:Nx,direction:Ri},deleteWordBackward:{unit:Tu,direction:Ri},deleteHardLineBackward:{unit:It,direction:Ri},deleteSoftLineBackward:{unit:It,direction:Ri},deleteContentForward:{unit:Dx,direction:hn},deleteWordForward:{unit:Tu,direction:hn},deleteHardLineForward:{unit:It,direction:hn},deleteSoftLineForward:{unit:It,direction:hn}};class $x extends lt{constructor(e){super(e);const t=e.document;let i=0;t.on("keydown",()=>{i++}),t.on("keyup",()=>{i=0}),t.on("beforeinput",(s,o)=>{if(!this.isEnabled)return;const{targetRanges:r,domEvent:a,inputType:l}=o,c=_g[l];if(!c)return;const u={direction:c.direction,unit:c.unit,sequence:i};u.unit==It&&(u.selectionToRemove=e.createSelection(r[0])),l==="deleteContentBackward"&&(L.isAndroid&&(u.sequence=1),Hx(r)&&(u.unit=It,u.selectionToRemove=e.createSelection(r)));const d=new Ji(t,"delete",r[0]);t.fire(d,new Hi(e,a,u)),d.stop.called&&s.stop()}),L.isBlink&&zx(this)}observe(){}stopObserving(){}}function zx(n){const e=n.view,t=e.document;let i=null,s=!1;t.on("keydown",(a,{keyCode:l})=>{i=l,s=!1}),t.on("keyup",(a,{keyCode:l,domEvent:c})=>{const u=t.selection,d=n.isEnabled&&l==i&&o(l)&&!u.isCollapsed&&!s;if(i=null,d){const h=u.getFirstRange(),f=new Ji(t,"delete",h),m={unit:It,direction:r(l),selectionToRemove:u};t.fire(f,new Hi(e,c,m))}}),t.on("beforeinput",(a,{inputType:l})=>{const c=_g[l];o(i)&&c&&c.direction==r(i)&&(s=!0)},{priority:"high"}),t.on("beforeinput",(a,{inputType:l,data:c})=>{i==N.delete&&l=="insertText"&&c==""&&a.stop()},{priority:"high"});function o(a){return a==N.backspace||a==N.delete}function r(a){return a==N.backspace?Ri:hn}}function Hx(n){if(n.length!=1||n[0].isCollapsed)return!1;const e=n[0].getWalker({direction:"backward",singleCharacters:!0,ignoreElementEnd:!0});let t=0;for(const{nextPosition:i}of e){if(!i.parent.is("$text"))t++;else{const s=i.parent.data,o=i.offset;if(Ma(s,o)||Fa(s,o)||Df(s,o))continue;t++}if(t>1)return!0}return!1}/**
|
|
792
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
793
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
794
|
+
*/class yt extends w{static get pluginName(){return"Delete"}init(){const e=this.editor,t=e.editing.view,i=t.document,s=e.model.document;t.addObserver($x),this._undoOnBackspace=!1;const o=new Eu(e,"forward");e.commands.add("deleteForward",o),e.commands.add("forwardDelete",o),e.commands.add("delete",new Eu(e,"backward")),this.listenTo(i,"delete",(r,a)=>{i.isComposing||a.preventDefault();const{direction:l,sequence:c,selectionToRemove:u,unit:d}=a,h=l==="forward"?"deleteForward":"delete",f={sequence:c};if(d=="selection"){const m=Array.from(u.getRanges()).map(p=>e.editing.mapper.toModelRange(p));f.selection=e.model.createSelection(m)}else f.unit=d;e.execute(h,f),t.scrollToTheSelection()},{priority:"low"}),this.editor.plugins.has("UndoEditing")&&(this.listenTo(i,"delete",(r,a)=>{this._undoOnBackspace&&a.direction=="backward"&&a.sequence==1&&a.unit=="codePoint"&&(this._undoOnBackspace=!1,e.execute("undo"),a.preventDefault(),r.stop())},{context:"$capture"}),this.listenTo(s,"change",()=>{this._undoOnBackspace=!1}))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}/**
|
|
795
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
796
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
797
|
+
*/class vg extends w{static get requires(){return[bg,yt]}static get pluginName(){return"Typing"}}/**
|
|
798
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
799
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
800
|
+
*/function yg(n,e){let t=n.start;return{text:Array.from(n.getWalker({ignoreElementEnd:!1})).reduce((s,{item:o})=>o.is("$text")||o.is("$textProxy")?s+o.data:(t=e.createPositionAfter(o),""),""),range:e.createRange(t,n.end)}}/**
|
|
801
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
802
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
803
|
+
*/class Ux extends U(){constructor(e,t){super(),this.model=e,this.testCallback=t,this._hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",()=>{this.isEnabled?this._startListening():(this.stopListening(e.document.selection),this.stopListening(e.document))}),this._startListening()}get hasMatch(){return this._hasMatch}_startListening(){const t=this.model.document;this.listenTo(t.selection,"change:range",(i,{directChange:s})=>{if(s){if(!t.selection.isCollapsed){this.hasMatch&&(this.fire("unmatched"),this._hasMatch=!1);return}this._evaluateTextBeforeSelection("selection")}}),this.listenTo(t,"change:data",(i,s)=>{s.isUndo||!s.isLocal||this._evaluateTextBeforeSelection("data",{batch:s})})}_evaluateTextBeforeSelection(e,t={}){const i=this.model,o=i.document.selection,r=i.createRange(i.createPositionAt(o.focus.parent,0),o.focus),{text:a,range:l}=yg(r,i),c=this.testCallback(a);if(!c&&this.hasMatch&&this.fire("unmatched"),this._hasMatch=!!c,c){const u=Object.assign(t,{text:a,range:l});typeof c=="object"&&Object.assign(u,c),this.fire(`matched:${e}`,u)}}}/**
|
|
804
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
805
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
806
|
+
*/class Ks extends w{static get pluginName(){return"TwoStepCaretMovement"}constructor(e){super(e),this._isNextGravityRestorationSkipped=!1,this.attributes=new Set,this._overrideUid=null}init(){const e=this.editor,t=e.model,i=e.editing.view,s=e.locale,o=t.document.selection;this.listenTo(i.document,"arrowKey",(r,a)=>{if(!o.isCollapsed||a.shiftKey||a.altKey||a.ctrlKey)return;const l=a.keyCode==N.arrowright,c=a.keyCode==N.arrowleft;if(!l&&!c)return;const u=s.contentLanguageDirection;let d=!1;u==="ltr"&&l||u==="rtl"&&c?d=this._handleForwardMovement(a):d=this._handleBackwardMovement(a),d===!0&&r.stop()},{context:"$text",priority:"highest"}),this.listenTo(o,"change:range",(r,a)=>{if(this._isNextGravityRestorationSkipped){this._isNextGravityRestorationSkipped=!1;return}this._isGravityOverridden&&(!a.directChange&&ze(o.getFirstPosition(),this.attributes)||this._restoreGravity())}),this._enableClickingAfterNode(),this._enableInsertContentSelectionAttributesFixer(),this._handleDeleteContentAfterNode()}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){const t=this.attributes,i=this.editor.model,s=i.document.selection,o=s.getFirstPosition();return this._isGravityOverridden||o.isAtStart&&dt(s,t)?!1:ze(o,t)?(an(e),dt(s,t)&&ze(o,t,!0)?rn(i,t):this._overrideGravity(),!0):!1}_handleBackwardMovement(e){const t=this.attributes,i=this.editor.model,s=i.document.selection,o=s.getFirstPosition();return this._isGravityOverridden?(an(e),this._restoreGravity(),ze(o,t,!0)?rn(i,t):ps(i,t,o),!0):o.isAtStart?dt(s,t)?(an(e),ps(i,t,o),!0):!1:!dt(s,t)&&ze(o,t,!0)?(an(e),ps(i,t,o),!0):Au(o,t)?o.isAtEnd&&!dt(s,t)&&ze(o,t)?(an(e),ps(i,t,o),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1):!1}_enableClickingAfterNode(){const e=this.editor,t=e.model,i=t.document.selection,s=e.editing.view.document;e.editing.view.addObserver(go);let o=!1;this.listenTo(s,"mousedown",()=>{o=!0}),this.listenTo(s,"selectionChange",()=>{const r=this.attributes;if(!o||(o=!1,!i.isCollapsed)||!dt(i,r))return;const a=i.getFirstPosition();ze(a,r)&&(a.isAtStart||ze(a,r,!0)?rn(t,r):this._isGravityOverridden||this._overrideGravity())})}_enableInsertContentSelectionAttributesFixer(){const t=this.editor.model,i=t.document.selection,s=this.attributes;this.listenTo(t,"insertContent",()=>{const o=i.getFirstPosition();dt(i,s)&&ze(o,s)&&rn(t,s)},{priority:"low"})}_handleDeleteContentAfterNode(){const e=this.editor,t=e.model,i=t.document.selection,s=e.editing.view;let o=!1,r=!1;this.listenTo(s.document,"delete",(a,l)=>{o=l.direction==="backward"},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{if(!o)return;const a=i.getFirstPosition();r=dt(i,this.attributes)&&!Au(a,this.attributes)},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{o&&(o=!1,!r&&e.model.enqueueChange(()=>{const a=i.getFirstPosition();dt(i,this.attributes)&&ze(a,this.attributes)&&(a.isAtStart||ze(a,this.attributes,!0)?rn(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 dt(n,e){for(const t of e)if(n.hasAttribute(t))return!0;return!1}function ps(n,e,t){const i=t.nodeBefore;n.change(s=>{if(i){const o=[],r=n.schema.isObject(i)&&n.schema.isInline(i);for(const[a,l]of i.getAttributes())n.schema.checkAttribute("$text",a)&&(!r||n.schema.getAttributeProperties(a).copyFromObject!==!1)&&o.push([a,l]);s.setSelectionAttribute(o)}else s.removeSelectionAttribute(e)})}function rn(n,e){n.change(t=>{t.removeSelectionAttribute(e)})}function an(n){n.preventDefault()}function Au(n,e){const t=n.getShiftedBy(-1);return ze(t,e)}function ze(n,e,t=!1){const{nodeBefore:i,nodeAfter:s}=n;for(const o of e){const r=i?i.getAttribute(o):void 0,a=s?s.getAttribute(o):void 0;if(!(t&&(r===void 0||a===void 0))&&a!==r)return!0}return!1}/**
|
|
807
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
808
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
809
|
+
*/function Xn(n,e,t,i){return i.createRange(qr(n,e,t,!0,i),qr(n,e,t,!1,i))}function qr(n,e,t,i,s){let o=n.textNode||(i?n.nodeBefore:n.nodeAfter),r=null;for(;o&&o.getAttribute(e)==t;)r=o,o=i?o.previousSibling:o.nextSibling;return r?s.createPositionAt(r,i?"before":"after"):n}/**
|
|
810
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
811
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
812
|
+
*/function Cg(n,e,t,i){const s=n.editing.view,o=new Set;s.document.registerPostFixer(r=>{const a=n.model.document.selection;let l=!1;if(a.hasAttribute(e)){const c=Xn(a.getFirstPosition(),e,a.getAttribute(e),n.model),u=n.editing.mapper.toViewRange(c);for(const d of u.getItems())d.is("element",t)&&!d.hasClass(i)&&(r.addClass(i,d),o.add(d),l=!0)}return l}),n.conversion.for("editingDowncast").add(r=>{r.on("insert",a,{priority:"highest"}),r.on("remove",a,{priority:"highest"}),r.on("attribute",a,{priority:"highest"}),r.on("selection",a,{priority:"highest"});function a(){s.change(l=>{for(const c of o.values())l.removeClass(i,c),o.delete(c)})}})}/**
|
|
813
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
814
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
815
|
+
*/function At(n,e,t,i){let s,o=null;typeof i=="function"?s=i:(o=n.commands.get(i),s=()=>{n.execute(i)}),n.model.document.on("change:data",(r,a)=>{if(o&&!o.isEnabled||!e.isEnabled)return;const l=J(n.model.document.selection.getRanges());if(!l.isCollapsed||a.isUndo||!a.isLocal)return;const c=Array.from(n.model.document.differ.getChanges()),u=c[0];if(c.length!=1||u.type!=="insert"||u.name!="$text"||u.length!=1)return;const d=u.position.parent;if(d.is("element","codeBlock")||d.is("element","listItem")&&typeof i!="function"&&!["numberedList","bulletedList","todoList"].includes(i)||o&&o.value===!0)return;const h=d.getChild(0),f=n.model.createRangeOn(h);if(!f.containsRange(l)&&!l.end.isEqual(f.end))return;const m=t.exec(h.data.substr(0,l.end.offset));m&&n.model.enqueueChange(p=>{const _=p.createPositionAt(d,0),C=p.createPositionAt(d,m[0].length),v=new Fe(_,C);if(s({match:m})!==!1){p.remove(v);const M=n.model.document.selection.getFirstRange(),D=p.createRangeIn(d);d.isEmpty&&!D.isEqual(M)&&!D.containsRange(M,!0)&&p.remove(d)}v.detach(),n.model.enqueueChange(()=>{n.plugins.get("Delete").requestUndoOnBackspace()})})})}/**
|
|
816
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
817
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
818
|
+
*/function yi(n,e,t,i){let s,o;t instanceof RegExp?s=t:o=t,o=o||(r=>{let a;const l=[],c=[];for(;(a=s.exec(r))!==null&&!(a&&a.length<4);){let{index:u,"1":d,"2":h,"3":f}=a;const m=d+h+f;u+=a[0].length-m.length;const p=[u,u+d.length],_=[u+d.length+h.length,u+d.length+h.length+f.length];l.push(p),l.push(_),c.push([u+d.length,u+d.length+h.length])}return{remove:l,format:c}}),n.model.document.on("change:data",(r,a)=>{if(a.isUndo||!a.isLocal||!e.isEnabled)return;const l=n.model,c=l.document.selection;if(!c.isCollapsed)return;const u=Array.from(l.document.differ.getChanges()),d=u[0];if(u.length!=1||d.type!=="insert"||d.name!="$text"||d.length!=1)return;const h=c.focus,f=h.parent,{text:m,range:p}=Wx(l.createRange(l.createPositionAt(f,0),h),l),_=o(m),C=Su(p.start,_.format,l),v=Su(p.start,_.remove,l);C.length&&v.length&&l.enqueueChange(P=>{if(i(P,C)!==!1){for(const D of v.reverse())P.remove(D);l.enqueueChange(()=>{n.plugins.get("Delete").requestUndoOnBackspace()})}})})}function Su(n,e,t){return e.filter(i=>i[0]!==void 0&&i[1]!==void 0).map(i=>t.createRange(n.getShiftedBy(i[0]),n.getShiftedBy(i[1])))}function Wx(n,e){let t=n.start;return{text:Array.from(n.getItems()).reduce((s,o)=>!(o.is("$text")||o.is("$textProxy"))||o.getAttribute("code")?(t=e.createPositionAfter(o),""):s+o.data,""),range:e.createRange(t,n.end)}}/**
|
|
819
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
820
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
821
|
+
*/class qx extends w{static get requires(){return[yt]}static get pluginName(){return"Autoformat"}afterInit(){this._addListAutoformats(),this._addBasicStylesAutoformats(),this._addHeadingAutoformats(),this._addBlockQuoteAutoformats(),this._addCodeBlockAutoformats(),this._addHorizontalLineAutoformats()}_addListAutoformats(){const e=this.editor.commands;e.get("bulletedList")&&At(this.editor,this,/^[*-]\s$/,"bulletedList"),e.get("numberedList")&&At(this.editor,this,/^1[.|)]\s$/,"numberedList"),e.get("todoList")&&At(this.editor,this,/^\[\s?\]\s$/,"todoList"),e.get("checkTodoList")&&At(this.editor,this,/^\[\s?x\s?\]\s$/,()=>{this.editor.execute("todoList"),this.editor.execute("checkTodoList")})}_addBasicStylesAutoformats(){const e=this.editor.commands;if(e.get("bold")){const t=ws(this.editor,"bold");yi(this.editor,this,/(?:^|\s)(\*\*)([^*]+)(\*\*)$/g,t),yi(this.editor,this,/(?:^|\s)(__)([^_]+)(__)$/g,t)}if(e.get("italic")){const t=ws(this.editor,"italic");yi(this.editor,this,/(?:^|\s)(\*)([^*_]+)(\*)$/g,t),yi(this.editor,this,/(?:^|\s)(_)([^_]+)(_)$/g,t)}if(e.get("code")){const t=ws(this.editor,"code");yi(this.editor,this,/(`)([^`]+)(`)$/g,t)}if(e.get("strikethrough")){const t=ws(this.editor,"strikethrough");yi(this.editor,this,/(~~)([^~]+)(~~)$/g,t)}}_addHeadingAutoformats(){const e=this.editor.commands.get("heading");e&&e.modelElements.filter(t=>t.match(/^heading[1-6]$/)).forEach(t=>{const i=t[7],s=new RegExp(`^(#{${i}})\\s$`);At(this.editor,this,s,()=>{if(!e.isEnabled||e.value===t)return!1;this.editor.execute("heading",{value:t})})})}_addBlockQuoteAutoformats(){this.editor.commands.get("blockQuote")&&At(this.editor,this,/^>\s$/,"blockQuote")}_addCodeBlockAutoformats(){const e=this.editor,t=e.model.document.selection;e.commands.get("codeBlock")&&At(e,this,/^```$/,()=>{if(t.getFirstPosition().parent.is("element","listItem"))return!1;this.editor.execute("codeBlock",{usePreviousLanguageChoice:!0})})}_addHorizontalLineAutoformats(){this.editor.commands.get("horizontalLine")&&At(this.editor,this,/^---$/,"horizontalLine")}}function ws(n,e){return(t,i)=>{if(!n.commands.get(e).isEnabled)return!1;const o=n.model.schema.getValidRanges(i,e);for(const r of o)t.setAttribute(e,!0,r);t.removeSelectionAttribute(e)}}/**
|
|
822
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
823
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
824
|
+
*/class es extends R{constructor(e,t){super(e),this.attributeKey=t}refresh(){const e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){const t=this.editor.model,s=t.document.selection,o=e.forceValue===void 0?!this.value:e.forceValue;t.change(r=>{if(s.isCollapsed)o?r.setSelectionAttribute(this.attributeKey,!0):r.removeSelectionAttribute(this.attributeKey);else{const a=t.schema.getValidRanges(s.getRanges(),this.attributeKey);for(const l of a)o?r.setAttribute(this.attributeKey,o,l):r.removeAttribute(this.attributeKey,l)}})}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,i=e.document.selection;if(i.isCollapsed)return i.hasAttribute(this.attributeKey);for(const s of i.getRanges())for(const o of s.getItems())if(t.checkAttribute(o,this.attributeKey))return o.hasAttribute(this.attributeKey);return!1}}/**
|
|
825
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
826
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
827
|
+
*/const Ci="bold";class jx extends w{static get pluginName(){return"BoldEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:Ci}),e.model.schema.setAttributeProperties(Ci,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Ci,view:"strong",upcastAlso:["b",t=>{const i=t.getStyle("font-weight");return i&&(i=="bold"||Number(i)>=600)?{name:!0,styles:["font-weight"]}:null}]}),e.commands.add(Ci,new es(e,Ci)),e.keystrokes.set("CTRL+B",Ci)}}/**
|
|
828
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
829
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
830
|
+
*/const qo="bold";class Gx extends w{static get pluginName(){return"BoldUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add(qo,i=>{const s=e.commands.get(qo),o=new B(i);return o.set({label:t("Bold"),icon:I.bold,keystroke:"CTRL+B",tooltip:!0,isToggleable:!0}),o.bind("isOn","isEnabled").to(s,"value","isEnabled"),this.listenTo(o,"execute",()=>{e.execute(qo),e.editing.view.focus()}),o})}}/**
|
|
831
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
832
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
833
|
+
*/class Kx extends w{static get requires(){return[jx,Gx]}static get pluginName(){return"Bold"}}/**
|
|
834
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
835
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
836
|
+
*/const Nt="code",Zx="ck-code_selected";class Jx extends w{static get pluginName(){return"CodeEditing"}static get requires(){return[Ks]}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:Nt}),e.model.schema.setAttributeProperties(Nt,{isFormatting:!0,copyOnEnter:!1}),e.conversion.attributeToElement({model:Nt,view:"code",upcastAlso:{styles:{"word-wrap":"break-word"}}}),e.commands.add(Nt,new es(e,Nt)),e.plugins.get(Ks).registerAttribute(Nt),Cg(e,Nt,"code",Zx)}}const Yx='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m12.5 5.7 5.2 3.9v1.3l-5.6 4c-.1.2-.3.2-.5.2-.3-.1-.6-.7-.6-1l.3-.4 4.7-3.5L11.5 7l-.2-.2c-.1-.3-.1-.6 0-.8.2-.2.5-.4.8-.4a.8.8 0 0 1 .4.1zm-5.2 0L2 9.6v1.3l5.6 4c.1.2.3.2.5.2.3-.1.7-.7.6-1 0-.1 0-.3-.2-.4l-5-3.5L8.2 7l.2-.2c.1-.3.1-.6 0-.8-.2-.2-.5-.4-.8-.4a.8.8 0 0 0-.3.1z"/></svg>';/**
|
|
837
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
838
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
839
|
+
*/const jo="code";class Qx extends w{static get pluginName(){return"CodeUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add(jo,i=>{const s=e.commands.get(jo),o=new B(i);return o.set({label:t("Code"),icon:Yx,tooltip:!0,isToggleable:!0}),o.bind("isOn","isEnabled").to(s,"value","isEnabled"),this.listenTo(o,"execute",()=>{e.execute(jo),e.editing.view.focus()}),o})}}/**
|
|
840
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
841
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
842
|
+
*/class Xx extends w{static get requires(){return[Jx,Qx]}static get pluginName(){return"Code"}}/**
|
|
843
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
844
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
845
|
+
*/const ki="italic";class e3 extends w{static get pluginName(){return"ItalicEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:ki}),e.model.schema.setAttributeProperties(ki,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:ki,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),e.commands.add(ki,new es(e,ki)),e.keystrokes.set("CTRL+I",ki)}}const t3='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m9.586 14.633.021.004c-.036.335.095.655.393.962.082.083.173.15.274.201h1.474a.6.6 0 1 1 0 1.2H5.304a.6.6 0 0 1 0-1.2h1.15c.474-.07.809-.182 1.005-.334.157-.122.291-.32.404-.597l2.416-9.55a1.053 1.053 0 0 0-.281-.823 1.12 1.12 0 0 0-.442-.296H8.15a.6.6 0 0 1 0-1.2h6.443a.6.6 0 1 1 0 1.2h-1.195c-.376.056-.65.155-.823.296-.215.175-.423.439-.623.79l-2.366 9.347z"/></svg>';/**
|
|
846
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
847
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
848
|
+
*/const Go="italic";class i3 extends w{static get pluginName(){return"ItalicUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add(Go,i=>{const s=e.commands.get(Go),o=new B(i);return o.set({label:t("Italic"),icon:t3,keystroke:"CTRL+I",tooltip:!0,isToggleable:!0}),o.bind("isOn","isEnabled").to(s,"value","isEnabled"),this.listenTo(o,"execute",()=>{e.execute(Go),e.editing.view.focus()}),o})}}/**
|
|
849
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
850
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
851
|
+
*/class n3 extends w{static get requires(){return[e3,i3]}static get pluginName(){return"Italic"}}/**
|
|
852
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
853
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
854
|
+
*/const ln="strikethrough";class s3 extends w{static get pluginName(){return"StrikethroughEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:ln}),e.model.schema.setAttributeProperties(ln,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:ln,view:"s",upcastAlso:["del","strike",{styles:{"text-decoration":"line-through"}}]}),e.commands.add(ln,new es(e,ln)),e.keystrokes.set("CTRL+SHIFT+X","strikethrough")}}const o3='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 16.4c-.8-.4-1.5-.9-2.2-1.5a.6.6 0 0 1-.2-.5l.3-.6h1c1 1.2 2.1 1.7 3.7 1.7 1 0 1.8-.3 2.3-.6.6-.4.6-1.2.6-1.3.2-1.2-.9-2.1-.9-2.1h2.1c.3.7.4 1.2.4 1.7v.8l-.6 1.2c-.6.8-1.1 1-1.6 1.2a6 6 0 0 1-2.4.6c-1 0-1.8-.3-2.5-.6zM6.8 9 6 8.3c-.4-.5-.5-.8-.5-1.6 0-.7.1-1.3.5-1.8.4-.6 1-1 1.6-1.3a6.3 6.3 0 0 1 4.7 0 4 4 0 0 1 1.7 1l.3.7c0 .1.2.4-.2.7-.4.2-.9.1-1 0a3 3 0 0 0-1.2-1c-.4-.2-1-.3-2-.4-.7 0-1.4.2-2 .6-.8.6-1 .8-1 1.5 0 .8.5 1 1.2 1.5.6.4 1.1.7 1.9 1H6.8z"/><path d="M3 10.5V9h14v1.5z"/></svg>';/**
|
|
855
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
856
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
857
|
+
*/const Ko="strikethrough";class r3 extends w{static get pluginName(){return"StrikethroughUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add(Ko,i=>{const s=e.commands.get(Ko),o=new B(i);return o.set({label:t("Strikethrough"),icon:o3,keystroke:"CTRL+SHIFT+X",tooltip:!0,isToggleable:!0}),o.bind("isOn","isEnabled").to(s,"value","isEnabled"),this.listenTo(o,"execute",()=>{e.execute(Ko),e.editing.view.focus()}),o})}}/**
|
|
858
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
859
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
860
|
+
*/class a3 extends w{static get requires(){return[s3,r3]}static get pluginName(){return"Strikethrough"}}/**
|
|
861
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
862
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
863
|
+
*/const cn="underline";class l3 extends w{static get pluginName(){return"UnderlineEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:cn}),e.model.schema.setAttributeProperties(cn,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:cn,view:"u",upcastAlso:{styles:{"text-decoration":"underline"}}}),e.commands.add(cn,new es(e,cn)),e.keystrokes.set("CTRL+U","underline")}}const c3='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 18v-1.5h14V18zm2.2-8V3.6c0-.4.4-.6.8-.6.3 0 .7.2.7.6v6.2c0 2 1.3 2.8 3.2 2.8 1.9 0 3.4-.9 3.4-2.9V3.6c0-.3.4-.5.8-.5.3 0 .7.2.7.5V10c0 2.7-2.2 4-4.9 4-2.6 0-4.7-1.2-4.7-4z"/></svg>';/**
|
|
864
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
865
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
866
|
+
*/const Zo="underline";class u3 extends w{static get pluginName(){return"UnderlineUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add(Zo,i=>{const s=e.commands.get(Zo),o=new B(i);return o.set({label:t("Underline"),icon:c3,keystroke:"CTRL+U",tooltip:!0,isToggleable:!0}),o.bind("isOn","isEnabled").to(s,"value","isEnabled"),this.listenTo(o,"execute",()=>{e.execute(Zo),e.editing.view.focus()}),o})}}/**
|
|
867
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
868
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
869
|
+
*/class d3 extends w{static get requires(){return[l3,u3]}static get pluginName(){return"Underline"}}/**
|
|
870
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
871
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
872
|
+
*/function*kg(n,e){for(const t of e)t&&n.getAttributeProperties(t[0]).copyOnEnter&&(yield t)}/**
|
|
873
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
874
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
875
|
+
*/class h3 extends R{execute(){this.editor.model.change(e=>{this.enterBlock(e),this.fire("afterExecute",{writer:e})})}enterBlock(e){const t=this.editor.model,i=t.document.selection,s=t.schema,o=i.isCollapsed,r=i.getFirstRange(),a=r.start.parent,l=r.end.parent;if(s.isLimit(a)||s.isLimit(l))return!o&&a==l&&t.deleteContent(i),!1;if(o){const c=kg(e.model.schema,i.getAttributes());return xu(e,r.start),e.setSelectionAttribute(c),!0}else{const c=!(r.start.isAtStart&&r.end.isAtEnd),u=a==l;if(t.deleteContent(i,{leaveUnmerged:c}),c){if(u)return xu(e,i.focus),!0;e.setSelection(l,0)}}return!1}}function xu(n,e){n.split(e),n.setSelection(e.parent.nextSibling,0)}/**
|
|
876
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
877
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
878
|
+
*/const f3={insertParagraph:{isSoft:!1},insertLineBreak:{isSoft:!0}};class Eg extends lt{constructor(e){super(e);const t=this.document;let i=!1;t.on("keydown",(s,o)=>{i=o.shiftKey}),t.on("beforeinput",(s,o)=>{if(!this.isEnabled)return;let r=o.inputType;L.isSafari&&i&&r=="insertParagraph"&&(r="insertLineBreak");const a=o.domEvent,l=f3[r];if(!l)return;const c=new Ji(t,"enter",o.targetRanges[0]);t.fire(c,new Hi(e,a,{isSoft:l.isSoft})),c.stop.called&&s.stop()})}observe(){}stopObserving(){}}/**
|
|
879
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
880
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
881
|
+
*/class ts extends w{static get pluginName(){return"Enter"}init(){const e=this.editor,t=e.editing.view,i=t.document;t.addObserver(Eg),e.commands.add("enter",new h3(e)),this.listenTo(i,"enter",(s,o)=>{i.isComposing||o.preventDefault(),!o.isSoft&&(e.execute("enter"),t.scrollToTheSelection())},{priority:"low"})}}/**
|
|
882
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
883
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
884
|
+
*/class m3 extends R{execute(){const e=this.editor.model,t=e.document;e.change(i=>{p3(e,i,t.selection),this.fire("afterExecute",{writer:i})})}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=g3(e.schema,t.selection)}}function g3(n,e){if(e.rangeCount>1)return!1;const t=e.anchor;if(!t||!n.checkChild(t,"softBreak"))return!1;const i=e.getFirstRange(),s=i.start.parent,o=i.end.parent;return!((jr(s,n)||jr(o,n))&&s!==o)}function p3(n,e,t){const i=t.isCollapsed,s=t.getFirstRange(),o=s.start.parent,r=s.end.parent,a=o==r;if(i){const l=kg(n.schema,t.getAttributes());Iu(n,e,s.end),e.removeSelectionAttribute(t.getAttributeKeys()),e.setSelectionAttribute(l)}else{const l=!(s.start.isAtStart&&s.end.isAtEnd);n.deleteContent(t,{leaveUnmerged:l}),a?Iu(n,e,t.focus):l&&e.setSelection(r,0)}}function Iu(n,e,t){const i=e.createElement("softBreak");n.insertContent(i,t),e.setSelection(i,"after")}function jr(n,e){return n.is("rootElement")?!1:e.isLimit(n)||jr(n.parent,e)}/**
|
|
885
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
886
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
887
|
+
*/class Tg extends w{static get pluginName(){return"ShiftEnter"}init(){const e=this.editor,t=e.model.schema,i=e.conversion,s=e.editing.view,o=s.document;t.register("softBreak",{allowWhere:"$text",isInline:!0}),i.for("upcast").elementToElement({model:"softBreak",view:"br"}),i.for("downcast").elementToElement({model:"softBreak",view:(r,{writer:a})=>a.createEmptyElement("br")}),s.addObserver(Eg),e.commands.add("shiftEnter",new m3(e)),this.listenTo(o,"enter",(r,a)=>{o.isComposing||a.preventDefault(),a.isSoft&&(e.execute("shiftEnter"),s.scrollToTheSelection())},{priority:"low"})}}/**
|
|
888
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
889
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
890
|
+
*/class w3 extends R{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,i=t.schema,s=t.document.selection,o=Array.from(s.getSelectedBlocks()),r=e.forceValue===void 0?!this.value:e.forceValue;t.change(a=>{if(!r)this._removeQuote(a,o.filter(bs));else{const l=o.filter(c=>bs(c)||Ru(i,c));this._applyQuote(a,l)}})}_getValue(){const e=this.editor.model.document.selection,t=J(e.getSelectedBlocks());return!!(t&&bs(t))}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,i=J(e.getSelectedBlocks());return i?Ru(t,i):!1}_removeQuote(e,t){Pu(e,t).reverse().forEach(i=>{if(i.start.isAtStart&&i.end.isAtEnd){e.unwrap(i.start.parent);return}if(i.start.isAtStart){const o=e.createPositionBefore(i.start.parent);e.move(i,o);return}i.end.isAtEnd||e.split(i.end);const s=e.createPositionAfter(i.end.parent);e.move(i,s)})}_applyQuote(e,t){const i=[];Pu(e,t).reverse().forEach(s=>{let o=bs(s.start);o||(o=e.createElement("blockQuote"),e.wrap(s,o)),i.push(o)}),i.reverse().reduce((s,o)=>s.nextSibling==o?(e.merge(e.createPositionAfter(s)),s):o)}}function bs(n){return n.parent.name=="blockQuote"?n.parent:null}function Pu(n,e){let t,i=0;const s=[];for(;i<e.length;){const o=e[i],r=e[i+1];t||(t=n.createPositionBefore(o)),(!r||o.nextSibling!=r)&&(s.push(n.createRange(t,n.createPositionAfter(o))),t=null),i++}return s}function Ru(n,e){const t=n.checkChild(e.parent,"blockQuote"),i=n.checkChild(["$root","blockQuote"],e);return t&&i}/**
|
|
891
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
892
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
893
|
+
*/class b3 extends w{static get pluginName(){return"BlockQuoteEditing"}static get requires(){return[ts,yt]}init(){const e=this.editor,t=e.model.schema;e.commands.add("blockQuote",new w3(e)),t.register("blockQuote",{inheritAllFrom:"$container"}),e.conversion.elementToElement({model:"blockQuote",view:"blockquote"}),e.model.document.registerPostFixer(r=>{const a=e.model.document.differ.getChanges();for(const l of a)if(l.type=="insert"){const c=l.position.nodeAfter;if(!c)continue;if(c.is("element","blockQuote")&&c.isEmpty)return r.remove(c),!0;if(c.is("element","blockQuote")&&!t.checkChild(l.position,c))return r.unwrap(c),!0;if(c.is("element")){const u=r.createRangeIn(c);for(const d of u.getItems())if(d.is("element","blockQuote")&&!t.checkChild(r.createPositionBefore(d),d))return r.unwrap(d),!0}}else if(l.type=="remove"){const c=l.position.parent;if(c.is("element","blockQuote")&&c.isEmpty)return r.remove(c),!0}return!1});const i=this.editor.editing.view.document,s=e.model.document.selection,o=e.commands.get("blockQuote");this.listenTo(i,"enter",(r,a)=>{if(!s.isCollapsed||!o.value)return;s.getLastPosition().parent.isEmpty&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),a.preventDefault(),r.stop())},{context:"blockquote"}),this.listenTo(i,"delete",(r,a)=>{if(a.direction!="backward"||!s.isCollapsed||!o.value)return;const l=s.getLastPosition().parent;l.isEmpty&&!l.previousSibling&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),a.preventDefault(),r.stop())},{context:"blockquote"})}}/**
|
|
894
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
895
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
896
|
+
*/class _3 extends w{static get pluginName(){return"BlockQuoteUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("blockQuote",i=>{const s=e.commands.get("blockQuote"),o=new B(i);return o.set({label:t("Block quote"),icon:I.quote,tooltip:!0,isToggleable:!0}),o.bind("isOn","isEnabled").to(s,"value","isEnabled"),this.listenTo(o,"execute",()=>{e.execute("blockQuote"),e.editing.view.focus()}),o})}}/**
|
|
897
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
898
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
899
|
+
*/class v3 extends w{static get requires(){return[b3,_3]}static get pluginName(){return"BlockQuote"}}/**
|
|
900
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
901
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
902
|
+
*/class Nn extends Lt{constructor(e){super(e),this.domEventType=["paste","copy","cut","drop","dragover","dragstart","dragend","dragenter","dragleave"];const t=this.document;this.listenTo(t,"paste",i("clipboardInput"),{priority:"low"}),this.listenTo(t,"drop",i("clipboardInput"),{priority:"low"}),this.listenTo(t,"dragover",i("dragging"),{priority:"low"});function i(s){return(o,r)=>{r.preventDefault();const a=r.dropRange?[r.dropRange]:null,l=new _t(t,s);t.fire(l,{dataTransfer:r.dataTransfer,method:o.name,targetRanges:a,target:r.target,domEvent:r.domEvent}),l.stop.called&&r.stopPropagation()}}}onDomEvent(e){const t="clipboardData"in e?e.clipboardData:e.dataTransfer,i=e.type=="drop"||e.type=="paste",s={dataTransfer:new Cm(t,{cacheFiles:i})};(e.type=="drop"||e.type=="dragover")&&(s.dropRange=y3(this.view,e)),this.fire(e.type,e,s)}}function y3(n,e){const t=e.target.ownerDocument,i=e.clientX,s=e.clientY;let o;return t.caretRangeFromPoint&&t.caretRangeFromPoint(i,s)?o=t.caretRangeFromPoint(i,s):e.rangeParent&&(o=t.createRange(),o.setStart(e.rangeParent,e.rangeOffset),o.collapse(!0)),o?n.domConverter.domRangeToView(o):null}/**
|
|
903
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
904
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
905
|
+
*/function C3(n){return n=n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\r?\n\r?\n/g,"</p><p>").replace(/\r?\n/g,"<br>").replace(/\t/g," ").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g," "),(n.includes("</p><p>")||n.includes("<br>"))&&(n=`<p>${n}</p>`),n}/**
|
|
906
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
907
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
908
|
+
*/function k3(n){return n.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(e,t)=>t.length==1?" ":t).replace(/<!--[\s\S]*?-->/g,"")}/**
|
|
909
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
910
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
911
|
+
*/const Vu=["figcaption","li"],Lu=["ol","ul"];function Ag(n){if(n.is("$text")||n.is("$textProxy"))return n.data;if(n.is("element","img")&&n.hasAttribute("alt"))return n.getAttribute("alt");if(n.is("element","br"))return`
|
|
912
|
+
`;let e="",t=null;for(const i of n.getChildren())e+=E3(i,t)+Ag(i),t=i;return e}function E3(n,e){return e?n.is("element","li")&&!n.isEmpty&&n.getChild(0).is("containerElement")||Lu.includes(n.name)&&Lu.includes(e.name)?`
|
|
913
|
+
|
|
914
|
+
`:!n.is("containerElement")&&!e.is("containerElement")?"":Vu.includes(n.name)||Vu.includes(e.name)?`
|
|
915
|
+
`:`
|
|
916
|
+
|
|
917
|
+
`:""}/**
|
|
918
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
919
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
920
|
+
*/class rt extends w{static get pluginName(){return"ClipboardPipeline"}init(){this.editor.editing.view.addObserver(Nn),this._setupPasteDrop(),this._setupCopyCut()}_fireOutputTransformationEvent(e,t,i){const s=this.editor.model.getSelectedContent(t);this.fire("outputTransformation",{dataTransfer:e,content:s,method:i})}_setupPasteDrop(){const e=this.editor,t=e.model,i=e.editing.view,s=i.document;this.listenTo(s,"clipboardInput",(o,r)=>{r.method=="paste"&&!e.model.canEditAt(e.model.document.selection)&&o.stop()},{priority:"highest"}),this.listenTo(s,"clipboardInput",(o,r)=>{const a=r.dataTransfer;let l;if(r.content)l=r.content;else{let u="";a.getData("text/html")?u=k3(a.getData("text/html")):a.getData("text/plain")&&(u=C3(a.getData("text/plain"))),l=this.editor.data.htmlProcessor.toView(u)}const c=new _t(this,"inputTransformation");this.fire(c,{content:l,dataTransfer:a,targetRanges:r.targetRanges,method:r.method}),c.stop.called&&o.stop(),i.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(o,r)=>{if(r.content.isEmpty)return;const l=this.editor.data.toModel(r.content,"$clipboardHolder");l.childCount!=0&&(o.stop(),t.change(()=>{this.fire("contentInsertion",{content:l,method:r.method,dataTransfer:r.dataTransfer,targetRanges:r.targetRanges})}))},{priority:"low"}),this.listenTo(this,"contentInsertion",(o,r)=>{r.resultRange=t.insertContent(r.content)},{priority:"low"})}_setupCopyCut(){const e=this.editor,t=e.model.document,s=e.editing.view.document,o=(r,a)=>{const l=a.dataTransfer;a.preventDefault(),this._fireOutputTransformationEvent(l,t.selection,r.name)};this.listenTo(s,"copy",o,{priority:"low"}),this.listenTo(s,"cut",(r,a)=>{e.model.canEditAt(e.model.document.selection)?o(r,a):a.preventDefault()},{priority:"low"}),this.listenTo(this,"outputTransformation",(r,a)=>{const l=e.data.toView(a.content);s.fire("clipboardOutput",{dataTransfer:a.dataTransfer,content:l,method:a.method})},{priority:"low"}),this.listenTo(s,"clipboardOutput",(r,a)=>{a.content.isEmpty||(a.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(a.content)),a.dataTransfer.setData("text/plain",Ag(a.content))),a.method=="cut"&&e.model.deleteContent(t.selection)},{priority:"low"})}}/**
|
|
921
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
922
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
923
|
+
*/class T3 extends Z(){constructor(){super(...arguments),this._stack=[]}add(e,t){const i=this._stack,s=i[0];this._insertDescriptor(e);const o=i[0];s!==o&&!Jo(s,o)&&this.fire("change:top",{oldDescriptor:s,newDescriptor:o,writer:t})}remove(e,t){const i=this._stack,s=i[0];this._removeDescriptor(e);const o=i[0];s!==o&&!Jo(s,o)&&this.fire("change:top",{oldDescriptor:s,newDescriptor:o,writer:t})}_insertDescriptor(e){const t=this._stack,i=t.findIndex(o=>o.id===e.id);if(Jo(e,t[i]))return;i>-1&&t.splice(i,1);let s=0;for(;t[s]&&A3(t[s],e);)s++;t.splice(s,0,e)}_removeDescriptor(e){const t=this._stack,i=t.findIndex(s=>s.id===e);i>-1&&t.splice(i,1)}}function Jo(n,e){return n&&e&&n.priority==e.priority&&Zs(n.classes)==Zs(e.classes)}function A3(n,e){return n.priority>e.priority?!0:n.priority<e.priority?!1:Zs(n.classes)>Zs(e.classes)}function Zs(n){return Array.isArray(n)?n.sort().join(","):n}const S3='<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M4 0v1H1v3H0V.5A.5.5 0 0 1 .5 0H4zm8 0h3.5a.5.5 0 0 1 .5.5V4h-1V1h-3V0zM4 16H.5a.5.5 0 0 1-.5-.5V12h1v3h3v1zm8 0v-1h3v-3h1v3.5a.5.5 0 0 1-.5.5H12z"/><path fill-opacity=".256" d="M1 1h14v14H1z"/><g class="ck-icon__selected-indicator"><path d="M7 0h2v1H7V0zM0 7h1v2H0V7zm15 0h1v2h-1V7zm-8 8h2v1H7v-1z"/><path fill-opacity=".254" d="M1 1h14v14H1z"/></g></svg>';/**
|
|
924
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
925
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
926
|
+
*/const x3="ck-widget",Bu="ck-widget_selected";function he(n){return n.is("element")?!!n.getCustomProperty("widget"):!1}function Xi(n,e,t={}){if(!n.is("containerElement"))throw new g("widget-to-widget-wrong-element-type",null,{element:n});return e.setAttribute("contenteditable","false",n),e.addClass(x3,n),e.setCustomProperty("widget",!0,n),n.getFillerOffset=L3,e.setCustomProperty("widgetLabel",[],n),t.label&&R3(n,t.label),t.hasSelectionHandle&&B3(n,e),Sg(n,e),n}function I3(n,e,t){if(e.classes&&t.addClass(K(e.classes),n),e.attributes)for(const i in e.attributes)t.setAttribute(i,e.attributes[i],n)}function P3(n,e,t){if(e.classes&&t.removeClass(K(e.classes),n),e.attributes)for(const i in e.attributes)t.removeAttribute(i,n)}function Sg(n,e,t=I3,i=P3){const s=new T3;s.on("change:top",(a,l)=>{l.oldDescriptor&&i(n,l.oldDescriptor,l.writer),l.newDescriptor&&t(n,l.newDescriptor,l.writer)});const o=(a,l,c)=>s.add(l,c),r=(a,l,c)=>s.remove(l,c);e.setCustomProperty("addHighlight",o,n),e.setCustomProperty("removeHighlight",r,n)}function R3(n,e){n.getCustomProperty("widgetLabel").push(e)}function V3(n){return n.getCustomProperty("widgetLabel").reduce((t,i)=>typeof i=="function"?t?t+". "+i():i():t?t+". "+i:i,"")}function xg(n,e,t={}){return e.addClass(["ck-editor__editable","ck-editor__nested-editable"],n),e.setAttribute("role","textbox",n),t.label&&e.setAttribute("aria-label",t.label,n),e.setAttribute("contenteditable",n.isReadOnly?"false":"true",n),n.on("change:isReadOnly",(i,s,o)=>{e.setAttribute("contenteditable",o?"false":"true",n)}),n.on("change:isFocused",(i,s,o)=>{o?e.addClass("ck-editor__nested-editable_focused",n):e.removeClass("ck-editor__nested-editable_focused",n)}),Sg(n,e),n}function el(n,e){const t=n.getSelectedElement();if(t){const i=xt(n);if(i)return e.createRange(e.createPositionAt(t,i))}return e.schema.findOptimalInsertionRange(n)}function L3(){return null}function B3(n,e){const t=e.createUIElement("div",{class:"ck ck-widget__selection-handle"},function(i){const s=this.toDomElement(i),o=new at;return o.set("content",S3),o.render(),s.appendChild(o.element),s});e.insert(e.createPositionAt(n,0),t),e.addClass(["ck-widget_with-selection-handle"],n)}/**
|
|
927
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
928
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
929
|
+
*/const ft="widget-type-around";function $t(n,e,t){return!!n&&he(n)&&!t.isInline(e)}function O3(n){return n.closest(".ck-widget__type-around__button")}function M3(n){return n.classList.contains("ck-widget__type-around__button_before")?"before":"after"}function F3(n,e){const t=n.closest(".ck-widget");return e.mapDomToView(t)}function xt(n){return n.getAttribute(ft)}const D3='<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>';/**
|
|
930
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
931
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
932
|
+
*/const Ig=["before","after"],N3=new DOMParser().parseFromString(D3,"image/svg+xml").firstChild,Ou="ck-widget__type-around_disabled";class $3 extends w{constructor(){super(...arguments),this._currentFakeCaretModelElement=null}static get pluginName(){return"WidgetTypeAround"}static get requires(){return[ts,yt]}init(){const e=this.editor,t=e.editing.view;this.on("change:isEnabled",(i,s,o)=>{t.change(r=>{for(const a of t.document.roots)o?r.removeClass(Ou,a):r.addClass(Ou,a)}),o||e.model.change(r=>{r.removeSelectionAttribute(ft)})}),this._enableTypeAroundUIInjection(),this._enableInsertingParagraphsOnButtonClick(),this._enableInsertingParagraphsOnEnterKeypress(),this._enableInsertingParagraphsOnTypingKeystroke(),this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(),this._enableDeleteIntegration(),this._enableInsertContentIntegration(),this._enableInsertObjectIntegration(),this._enableDeleteContentIntegration()}destroy(){super.destroy(),this._currentFakeCaretModelElement=null}_insertParagraph(e,t){const i=this.editor,s=i.editing.view,o=i.model.schema.getAttributesWithProperty(e,"copyOnReplace",!0);i.execute("insertParagraph",{position:i.model.createPositionAt(e,t),attributes:o}),s.focus(),s.scrollToTheSelection()}_listenToIfEnabled(e,t,i,s){this.listenTo(e,t,(...o)=>{this.isEnabled&&i(...o)},s)}_insertParagraphAccordingToFakeCaretPosition(){const i=this.editor.model.document.selection,s=xt(i);if(!s)return!1;const o=i.getSelectedElement();return this._insertParagraph(o,s),!0}_enableTypeAroundUIInjection(){const e=this.editor,t=e.model.schema,i=e.locale.t,s={before:i("Insert paragraph before block"),after:i("Insert paragraph after block")};e.editing.downcastDispatcher.on("insert",(o,r,a)=>{const l=a.mapper.toViewElement(r.item);l&&$t(l,r.item,t)&&(z3(a.writer,s,l),l.getCustomProperty("widgetLabel").push(()=>this.isEnabled?i("Press Enter to type after or press Shift + Enter to type before the widget"):""))},{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const e=this.editor,t=e.model,i=t.document.selection,s=t.schema,o=e.editing.view;this._listenToIfEnabled(o.document,"arrowKey",(a,l)=>{this._handleArrowKeyPress(a,l)},{context:[he,"$text"],priority:"high"}),this._listenToIfEnabled(i,"change:range",(a,l)=>{l.directChange&&e.model.change(c=>{c.removeSelectionAttribute(ft)})}),this._listenToIfEnabled(t.document,"change:data",()=>{const a=i.getSelectedElement();if(a){const l=e.editing.mapper.toViewElement(a);if($t(l,a,s))return}e.model.change(l=>{l.removeSelectionAttribute(ft)})}),this._listenToIfEnabled(e.editing.downcastDispatcher,"selection",(a,l,c)=>{const u=c.writer;if(this._currentFakeCaretModelElement){const m=c.mapper.toViewElement(this._currentFakeCaretModelElement);m&&(u.removeClass(Ig.map(r),m),this._currentFakeCaretModelElement=null)}const d=l.selection.getSelectedElement();if(!d)return;const h=c.mapper.toViewElement(d);if(!$t(h,d,s))return;const f=xt(l.selection);f&&(u.addClass(r(f),h),this._currentFakeCaretModelElement=d)}),this._listenToIfEnabled(e.ui.focusTracker,"change:isFocused",(a,l,c)=>{c||e.model.change(u=>{u.removeSelectionAttribute(ft)})});function r(a){return`ck-widget_type-around_show-fake-caret_${a}`}}_handleArrowKeyPress(e,t){const i=this.editor,s=i.model,o=s.document.selection,r=s.schema,a=i.editing.view,l=t.keyCode,c=L2(l,i.locale.contentLanguageDirection),u=a.document.selection.getSelectedElement(),d=i.editing.mapper.toModelElement(u);let h;$t(u,d,r)?h=this._handleArrowKeyPressOnSelectedWidget(c):o.isCollapsed?h=this._handleArrowKeyPressWhenSelectionNextToAWidget(c):t.shiftKey||(h=this._handleArrowKeyPressWhenNonCollapsedSelection(c)),h&&(t.preventDefault(),e.stop())}_handleArrowKeyPressOnSelectedWidget(e){const i=this.editor.model,s=i.document.selection,o=xt(s);return i.change(r=>{if(o){if(!(o===(e?"after":"before")))return r.removeSelectionAttribute(ft),!0}else return r.setSelectionAttribute(ft,e?"after":"before"),!0;return!1})}_handleArrowKeyPressWhenSelectionNextToAWidget(e){const t=this.editor,i=t.model,s=i.schema,o=t.plugins.get("Widget"),r=o._getObjectElementNextToSelection(e),a=t.editing.mapper.toViewElement(r);return $t(a,r,s)?(i.change(l=>{o._setSelectionOverElement(r),l.setSelectionAttribute(ft,e?"before":"after")}),!0):!1}_handleArrowKeyPressWhenNonCollapsedSelection(e){const t=this.editor,i=t.model,s=i.schema,o=t.editing.mapper,r=i.document.selection,a=e?r.getLastPosition().nodeBefore:r.getFirstPosition().nodeAfter,l=o.toViewElement(a);return $t(l,a,s)?(i.change(c=>{c.setSelection(a,"on"),c.setSelectionAttribute(ft,e?"after":"before")}),!0):!1}_enableInsertingParagraphsOnButtonClick(){const e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,"mousedown",(i,s)=>{const o=O3(s.domTarget);if(!o)return;const r=M3(o),a=F3(o,t.domConverter),l=e.editing.mapper.toModelElement(a);this._insertParagraph(l,r),s.preventDefault(),i.stop()})}_enableInsertingParagraphsOnEnterKeypress(){const e=this.editor,t=e.model.document.selection,i=e.editing.view;this._listenToIfEnabled(i.document,"enter",(s,o)=>{if(s.eventPhase!="atTarget")return;const r=t.getSelectedElement(),a=e.editing.mapper.toViewElement(r),l=e.model.schema;let c;this._insertParagraphAccordingToFakeCaretPosition()?c=!0:$t(a,r,l)&&(this._insertParagraph(r,o.isSoft?"before":"after"),c=!0),c&&(o.preventDefault(),s.stop())},{context:he})}_enableInsertingParagraphsOnTypingKeystroke(){const t=this.editor.editing.view.document;this._listenToIfEnabled(t,"insertText",(i,s)=>{this._insertParagraphAccordingToFakeCaretPosition()&&(s.selection=t.selection)},{priority:"high"}),L.isAndroid?this._listenToIfEnabled(t,"keydown",(i,s)=>{s.keyCode==229&&this._insertParagraphAccordingToFakeCaretPosition()}):this._listenToIfEnabled(t,"compositionstart",()=>{this._insertParagraphAccordingToFakeCaretPosition()},{priority:"high"})}_enableDeleteIntegration(){const e=this.editor,t=e.editing.view,i=e.model,s=i.schema;this._listenToIfEnabled(t.document,"delete",(o,r)=>{if(o.eventPhase!="atTarget")return;const a=xt(i.document.selection);if(!a)return;const l=r.direction,c=i.document.selection.getSelectedElement(),u=a==="before",d=l=="forward";if(u===d)e.execute("delete",{selection:i.createSelection(c,"on")});else{const f=s.getNearestSelectionRange(i.createPositionAt(c,a),l);if(f)if(!f.isCollapsed)i.change(m=>{m.setSelection(f),e.execute(d?"deleteForward":"delete")});else{const m=i.createSelection(f.start);if(i.modifySelection(m,{direction:l}),!m.focus.isEqual(f.start))i.change(p=>{p.setSelection(f),e.execute(d?"deleteForward":"delete")});else{const p=W3(s,f.start.parent);i.deleteContent(i.createSelection(p,"on"),{doNotAutoparagraph:!0})}}}r.preventDefault(),o.stop()},{context:he})}_enableInsertContentIntegration(){const e=this.editor,t=this.editor.model,i=t.document.selection;this._listenToIfEnabled(e.model,"insertContent",(s,[o,r])=>{if(r&&!r.is("documentSelection"))return;const a=xt(i);if(a)return s.stop(),t.change(l=>{const c=i.getSelectedElement(),u=t.createPositionAt(c,a),d=l.createSelection(u),h=t.insertContent(o,d);return l.setSelection(d),h})},{priority:"high"})}_enableInsertObjectIntegration(){const e=this.editor,i=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"insertObject",(s,o)=>{const[,r,a={}]=o;if(r&&!r.is("documentSelection"))return;const l=xt(i);l&&(a.findOptimalPosition=l,o[3]=a)},{priority:"high"})}_enableDeleteContentIntegration(){const e=this.editor,i=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"deleteContent",(s,[o])=>{if(o&&!o.is("documentSelection"))return;xt(i)&&s.stop()},{priority:"high"})}}function z3(n,e,t){const i=n.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},function(s){const o=this.toDomElement(s);return H3(o,e),U3(o),o});n.insert(n.createPositionAt(t,"end"),i)}function H3(n,e){for(const t of Ig){const i=new xe({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${t}`],title:e[t],"aria-hidden":"true"},children:[n.ownerDocument.importNode(N3,!0)]});n.appendChild(i.render())}}function U3(n){const e=new xe({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});n.appendChild(e.render())}function W3(n,e){let t=e;for(const i of e.getAncestors({parentFirst:!0})){if(i.childCount>1||n.isLimit(i))break;t=i}return t}/**
|
|
933
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
934
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
935
|
+
*/function q3(n){const e=n.model;return(t,i)=>{const s=i.keyCode==N.arrowup,o=i.keyCode==N.arrowdown,r=i.shiftKey,a=e.document.selection;if(!s&&!o)return;const l=o;if(r&&K3(a,l))return;const c=j3(n,a,l);if(c){if(c.isCollapsed){if(a.isCollapsed)return;if(r)return}(c.isCollapsed||G3(n,c,l))&&(e.change(u=>{const d=l?c.end:c.start;if(r){const h=e.createSelection(a.anchor);h.setFocus(d),u.setSelection(h)}else u.setSelection(d)}),t.stop(),i.preventDefault(),i.stopPropagation())}}}function j3(n,e,t){const i=n.model;if(t){const s=e.isCollapsed?e.focus:e.getLastPosition(),o=Mu(i,s,"forward");if(!o)return null;const r=i.createRange(s,o),a=Fu(i.schema,r,"backward");return a?i.createRange(s,a):null}else{const s=e.isCollapsed?e.focus:e.getFirstPosition(),o=Mu(i,s,"backward");if(!o)return null;const r=i.createRange(o,s),a=Fu(i.schema,r,"forward");return a?i.createRange(a,s):null}}function Mu(n,e,t){const i=n.schema,s=n.createRangeIn(e.root),o=t=="forward"?"elementStart":"elementEnd";for(const{previousPosition:r,item:a,type:l}of s.getWalker({startPosition:e,direction:t})){if(i.isLimit(a)&&!i.isInline(a))return r;if(l==o&&i.isBlock(a))return null}return null}function Fu(n,e,t){const i=t=="backward"?e.end:e.start;if(n.checkChild(i,"$text"))return i;for(const{nextPosition:s}of e.getWalker({direction:t}))if(n.checkChild(s,"$text"))return s;return null}function G3(n,e,t){const i=n.model,s=n.view.domConverter;if(t){const c=i.createSelection(e.start);i.modifySelection(c),!c.focus.isAtEnd&&!e.start.isEqual(c.focus)&&(e=i.createRange(c.focus,e.end))}const o=n.mapper.toViewRange(e),r=s.viewRangeToDom(o),a=O.getDomRangeRects(r);let l;for(const c of a){if(l===void 0){l=Math.round(c.bottom);continue}if(Math.round(c.top)>=l)return!1;l=Math.max(l,Math.round(c.bottom))}return!0}function K3(n,e){return!n.isCollapsed&&n.isBackward==e}/**
|
|
936
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
937
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
938
|
+
*/class fi extends w{constructor(){super(...arguments),this._previouslySelected=new Set}static get pluginName(){return"Widget"}static get requires(){return[$3,yt]}init(){const e=this.editor,t=e.editing.view,i=t.document;this.editor.editing.downcastDispatcher.on("selection",(s,o,r)=>{const a=r.writer,l=o.selection;if(l.isCollapsed)return;const c=l.getSelectedElement();if(!c)return;const u=e.editing.mapper.toViewElement(c);he(u)&&r.consumable.consume(l,"selection")&&a.setSelection(a.createRangeOn(u),{fake:!0,label:V3(u)})}),this.editor.editing.downcastDispatcher.on("selection",(s,o,r)=>{this._clearPreviouslySelectedWidgets(r.writer);const a=r.writer,l=a.document.selection;let c=null;for(const u of l.getRanges())for(const d of u){const h=d.item;he(h)&&!J3(h,c)&&(a.addClass(Bu,h),this._previouslySelected.add(h),c=h)}},{priority:"low"}),t.addObserver(go),this.listenTo(i,"mousedown",(...s)=>this._onMousedown(...s)),this.listenTo(i,"arrowKey",(...s)=>{this._handleSelectionChangeOnArrowKeyPress(...s)},{context:[he,"$text"]}),this.listenTo(i,"arrowKey",(...s)=>{this._preventDefaultOnArrowKeyPress(...s)},{context:"$root"}),this.listenTo(i,"arrowKey",q3(this.editor.editing),{context:"$text"}),this.listenTo(i,"delete",(s,o)=>{this._handleDelete(o.direction=="forward")&&(o.preventDefault(),s.stop())},{context:"$root"})}_onMousedown(e,t){const i=this.editor,s=i.editing.view,o=s.document;let r=t.target;if(t.domEvent.detail>=3){this._selectBlockContent(r)&&t.preventDefault();return}if(Z3(r)||!he(r)&&(r=r.findAncestor(he),!r))return;L.isAndroid&&t.preventDefault(),o.isFocused||s.focus();const a=i.editing.mapper.toModelElement(r);this._setSelectionOverElement(a)}_selectBlockContent(e){const t=this.editor,i=t.model,s=t.editing.mapper,o=i.schema,r=s.findMappedViewAncestor(this.editor.editing.view.createPositionAt(e,0)),a=Y3(s.toModelElement(r),i.schema);return a?(i.change(l=>{const c=o.isLimit(a)?null:Q3(l.createPositionAfter(a),o),u=l.createPositionAt(a,0),d=c?l.createPositionAt(c,0):l.createPositionAt(a,"end");l.setSelection(l.createRange(u,d))}),!0):!1}_handleSelectionChangeOnArrowKeyPress(e,t){const i=t.keyCode,s=this.editor.model,o=s.schema,r=s.document.selection,a=r.getSelectedElement(),l=Ba(i,this.editor.locale.contentLanguageDirection),c=l=="down"||l=="right",u=l=="up"||l=="down";if(a&&o.isObject(a)){const h=c?r.getLastPosition():r.getFirstPosition(),f=o.getNearestSelectionRange(h,c?"forward":"backward");f&&(s.change(m=>{m.setSelection(f)}),t.preventDefault(),e.stop());return}if(!r.isCollapsed&&!t.shiftKey){const h=r.getFirstPosition(),f=r.getLastPosition(),m=h.nodeAfter,p=f.nodeBefore;(m&&o.isObject(m)||p&&o.isObject(p))&&(s.change(_=>{_.setSelection(c?f:h)}),t.preventDefault(),e.stop());return}if(!r.isCollapsed)return;const d=this._getObjectElementNextToSelection(c);if(d&&o.isObject(d)){if(o.isInline(d)&&u)return;this._setSelectionOverElement(d),t.preventDefault(),e.stop()}}_preventDefaultOnArrowKeyPress(e,t){const i=this.editor.model,s=i.schema,o=i.document.selection.getSelectedElement();o&&s.isObject(o)&&(t.preventDefault(),e.stop())}_handleDelete(e){const i=this.editor.model.document.selection;if(!this.editor.model.canEditAt(i)||!i.isCollapsed)return;const s=this._getObjectElementNextToSelection(e);if(s)return this.editor.model.change(o=>{let r=i.anchor.parent;for(;r.isEmpty;){const a=r;r=a.parent,o.remove(a)}this._setSelectionOverElement(s)}),!0}_setSelectionOverElement(e){this.editor.model.change(t=>{t.setSelection(t.createRangeOn(e))})}_getObjectElementNextToSelection(e){const t=this.editor.model,i=t.schema,s=t.document.selection,o=t.createSelection(s);if(t.modifySelection(o,{direction:e?"forward":"backward"}),o.isEqual(s))return null;const r=e?o.focus.nodeBefore:o.focus.nodeAfter;return r&&i.isObject(r)?r:null}_clearPreviouslySelectedWidgets(e){for(const t of this._previouslySelected)e.removeClass(Bu,t);this._previouslySelected.clear()}}function Z3(n){let e=n;for(;e;){if(e.is("editableElement")&&!e.is("rootElement"))return!0;if(he(e))return!1;e=e.parent}return!1}function J3(n,e){return e?Array.from(n.getAncestors()).includes(e):!1}function Y3(n,e){for(const t of n.getAncestors({includeSelf:!0,parentFirst:!0})){if(e.checkChild(t,"$text"))return t;if(e.isLimit(t)&&!e.isObject(t))break}return null}function Q3(n,e){const t=new pt({startPosition:n});for(const{item:i}of t){if(e.isLimit(i)||!i.is("element"))return null;if(e.checkChild(i,"$text"))return i}return null}/**
|
|
939
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
940
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
941
|
+
*/class Js extends w{constructor(){super(...arguments),this._toolbarDefinitions=new Map}static get requires(){return[Gs]}static get pluginName(){return"WidgetToolbarRepository"}init(){const e=this.editor;if(e.plugins.has("BalloonToolbar")){const t=e.plugins.get("BalloonToolbar");this.listenTo(t,"show",i=>{X3(e.editing.view.document.selection)&&i.stop()},{priority:"high"})}this._balloon=this.editor.plugins.get("ContextualBalloon"),this.on("change:isEnabled",()=>{this._updateToolbarsVisibility()}),this.listenTo(e.ui,"update",()=>{this._updateToolbarsVisibility()}),this.listenTo(e.ui.focusTracker,"change:isFocused",()=>{this._updateToolbarsVisibility()},{priority:"low"})}destroy(){super.destroy();for(const e of this._toolbarDefinitions.values())e.view.destroy()}register(e,{ariaLabel:t,items:i,getRelatedElement:s,balloonClassName:o="ck-toolbar-container"}){if(!i.length){H("widget-toolbar-no-items",{toolbarId:e});return}const r=this.editor,a=r.t,l=new Ja(r.locale);if(l.ariaLabel=t||a("Widget toolbar"),this._toolbarDefinitions.has(e))throw new g("widget-toolbar-duplicated",this,{toolbarId:e});const c={view:l,getRelatedElement:s,balloonClassName:o,itemsConfig:i,initialized:!1};r.ui.addToolbar(l,{isContextual:!0,beforeFocus:()=>{const u=s(r.editing.view.document.selection);u&&this._showToolbar(c,u)},afterBlur:()=>{this._hideToolbar(c)}}),this._toolbarDefinitions.set(e,c)}_updateToolbarsVisibility(){let e=0,t=null,i=null;for(const s of this._toolbarDefinitions.values()){const o=s.getRelatedElement(this.editor.editing.view.document.selection);if(!this.isEnabled||!o)this._isToolbarInBalloon(s)&&this._hideToolbar(s);else if(!this.editor.ui.focusTracker.isFocused)this._isToolbarVisible(s)&&this._hideToolbar(s);else{const r=o.getAncestors().length;r>e&&(e=r,t=o,i=s)}}i&&this._showToolbar(i,t)}_hideToolbar(e){this._balloon.remove(e.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(e,t){this._isToolbarVisible(e)?Du(this.editor,t):this._isToolbarInBalloon(e)||(e.initialized||(e.initialized=!0,e.view.fillFromConfig(e.itemsConfig,this.editor.ui.componentFactory)),this._balloon.add({view:e.view,position:Pg(this.editor,t),balloonClassName:e.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",()=>{for(const i of this._toolbarDefinitions.values())if(this._isToolbarVisible(i)){const s=i.getRelatedElement(this.editor.editing.view.document.selection);Du(this.editor,s)}}))}_isToolbarVisible(e){return this._balloon.visibleView===e.view}_isToolbarInBalloon(e){return this._balloon.hasView(e.view)}}function Du(n,e){const t=n.plugins.get("ContextualBalloon"),i=Pg(n,e);t.updatePosition(i)}function Pg(n,e){const t=n.editing.view,i=be.defaultPositions;return{target:t.domConverter.mapViewToDom(e),positions:[i.northArrowSouth,i.northArrowSouthWest,i.northArrowSouthEast,i.southArrowNorth,i.southArrowNorthWest,i.southArrowNorthEast,i.viewportStickyNorth]}}function X3(n){const e=n.getSelectedElement();return!!(e&&he(e))}/**
|
|
942
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
943
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
944
|
+
*/class eI extends U(){constructor(e){super(),this.set("activeHandlePosition",null),this.set("proposedWidthPercents",null),this.set("proposedWidth",null),this.set("proposedHeight",null),this.set("proposedHandleHostWidth",null),this.set("proposedHandleHostHeight",null),this._options=e,this._referenceCoordinates=null}get originalWidth(){return this._originalWidth}get originalHeight(){return this._originalHeight}get originalWidthPercents(){return this._originalWidthPercents}get aspectRatio(){return this._aspectRatio}begin(e,t,i){const s=new O(t);this.activeHandlePosition=sI(e),this._referenceCoordinates=iI(t,oI(this.activeHandlePosition)),this._originalWidth=s.width,this._originalHeight=s.height,this._aspectRatio=s.width/s.height;const o=i.style.width;o&&o.match(/^\d+(\.\d*)?%$/)?this._originalWidthPercents=parseFloat(o):this._originalWidthPercents=tI(i,s)}update(e){this.proposedWidth=e.width,this.proposedHeight=e.height,this.proposedWidthPercents=e.widthPercents,this.proposedHandleHostWidth=e.handleHostWidth,this.proposedHandleHostHeight=e.handleHostHeight}}function tI(n,e){const t=n.parentElement;let i=parseFloat(t.ownerDocument.defaultView.getComputedStyle(t).width);const s=5;let o=0,r=t;for(;isNaN(i);){if(r=r.parentElement,++o>s)return 0;i=parseFloat(t.ownerDocument.defaultView.getComputedStyle(r).width)}return e.width/i*100}function iI(n,e){const t=new O(n),i=e.split("-"),s={x:i[1]=="right"?t.right:t.left,y:i[0]=="bottom"?t.bottom:t.top};return s.x+=n.ownerDocument.defaultView.scrollX,s.y+=n.ownerDocument.defaultView.scrollY,s}function nI(n){return`ck-widget__resizer__handle-${n}`}function sI(n){const e=["top-left","top-right","bottom-right","bottom-left"];for(const t of e)if(n.classList.contains(nI(t)))return t}function oI(n){const e=n.split("-"),t={top:"bottom",bottom:"top",left:"right",right:"left"};return`${t[e[0]]}-${t[e[1]]}`}/**
|
|
945
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
946
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
947
|
+
*/class rI extends T{constructor(){super();const e=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-size-view",e.to("_viewPosition",t=>t?`ck-orientation-${t}`:"")],style:{display:e.if("_isVisible","none",t=>!t)}},children:[{text:e.to("_label")}]})}_bindToState(e,t){this.bind("_isVisible").to(t,"proposedWidth",t,"proposedHeight",(i,s)=>i!==null&&s!==null),this.bind("_label").to(t,"proposedHandleHostWidth",t,"proposedHandleHostHeight",t,"proposedWidthPercents",(i,s,o)=>e.unit==="px"?`${i}×${s}`:`${o}%`),this.bind("_viewPosition").to(t,"activeHandlePosition",t,"proposedHandleHostWidth",t,"proposedHandleHostHeight",(i,s,o)=>s<50||o<50?"above-center":i)}_dismiss(){this.unbind(),this._isVisible=!1}}/**
|
|
948
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
949
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
950
|
+
*/class Nu extends U(){constructor(e){super(),this._viewResizerWrapper=null,this._options=e,this.set("isEnabled",!0),this.set("isSelected",!1),this.bind("isVisible").to(this,"isEnabled",this,"isSelected",(t,i)=>t&&i),this.decorate("begin"),this.decorate("cancel"),this.decorate("commit"),this.decorate("updateSize"),this.on("commit",t=>{!this.state.proposedWidth&&!this.state.proposedWidthPercents&&(this._cleanup(),t.stop())},{priority:"high"})}get state(){return this._state}show(){this._options.editor.editing.view.change(t=>{t.removeClass("ck-hidden",this._viewResizerWrapper)})}hide(){this._options.editor.editing.view.change(t=>{t.addClass("ck-hidden",this._viewResizerWrapper)})}attach(){const e=this,t=this._options.viewElement;this._options.editor.editing.view.change(s=>{const o=s.createUIElement("div",{class:"ck ck-reset_all ck-widget__resizer"},function(r){const a=this.toDomElement(r);return e._appendHandles(a),e._appendSizeUI(a),a});s.insert(s.createPositionAt(t,"end"),o),s.addClass("ck-widget_with-resizer",t),this._viewResizerWrapper=o,this.isVisible||this.hide()}),this.on("change:isVisible",()=>{this.isVisible?(this.show(),this.redraw()):this.hide()})}begin(e){this._state=new eI(this._options),this._sizeView._bindToState(this._options,this.state),this._initialViewWidth=this._options.viewElement.getStyle("width"),this.state.begin(e,this._getHandleHost(),this._getResizeHost())}updateSize(e){const t=this._proposeNewSize(e);this._options.editor.editing.view.change(c=>{const u=this._options.unit||"%",d=(u==="%"?t.widthPercents:t.width)+u;c.setStyle("width",d,this._options.viewElement)});const s=this._getHandleHost(),o=new O(s),r=Math.round(o.width),a=Math.round(o.height),l=new O(s);t.width=Math.round(l.width),t.height=Math.round(l.height),this.redraw(o),this.state.update({...t,handleHostWidth:r,handleHostHeight:a})}commit(){const e=this._options.unit||"%",t=(e==="%"?this.state.proposedWidthPercents:this.state.proposedWidth)+e;this._options.editor.editing.view.change(()=>{this._cleanup(),this._options.onCommit(t)})}cancel(){this._cleanup()}destroy(){this.cancel()}redraw(e){const t=this._domResizerWrapper;if(!cI(t))return;const i=t.parentElement,s=this._getHandleHost(),o=this._viewResizerWrapper,r=[o.getStyle("width"),o.getStyle("height"),o.getStyle("left"),o.getStyle("top")];let a;if(i.isSameNode(s)){const l=e||new O(s);a=[l.width+"px",l.height+"px",void 0,void 0]}else a=[s.offsetWidth+"px",s.offsetHeight+"px",s.offsetLeft+"px",s.offsetTop+"px"];ye(r,a)!=="same"&&this._options.editor.editing.view.change(l=>{l.setStyle({width:a[0],height:a[1],left:a[2],top:a[3]},o)})}containsHandle(e){return this._domResizerWrapper.contains(e)}static isResizeHandle(e){return e.classList.contains("ck-widget__resizer__handle")}_cleanup(){this._sizeView._dismiss(),this._options.editor.editing.view.change(t=>{t.setStyle("width",this._initialViewWidth,this._options.viewElement)})}_proposeNewSize(e){const t=this.state,i=lI(e),s=this._options.isCentered?this._options.isCentered(this):!0,o={x:t._referenceCoordinates.x-(i.x+t.originalWidth),y:i.y-t.originalHeight-t._referenceCoordinates.y};s&&t.activeHandlePosition.endsWith("-right")&&(o.x=i.x-(t._referenceCoordinates.x+t.originalWidth)),s&&(o.x*=2);let r=Math.abs(t.originalWidth+o.x),a=Math.abs(t.originalHeight+o.y);return(r/t.aspectRatio>a?"width":"height")=="width"?a=r/t.aspectRatio:r=a*t.aspectRatio,{width:Math.round(r),height:Math.round(a),widthPercents:Math.min(Math.round(t.originalWidthPercents/t.originalWidth*r*100)/100,100)}}_getResizeHost(){const e=this._domResizerWrapper.parentElement;return this._options.getResizeHost(e)}_getHandleHost(){const e=this._domResizerWrapper.parentElement;return this._options.getHandleHost(e)}get _domResizerWrapper(){return this._options.editor.editing.view.domConverter.mapViewToDom(this._viewResizerWrapper)}_appendHandles(e){const t=["top-left","top-right","bottom-right","bottom-left"];for(const i of t)e.appendChild(new xe({tag:"div",attributes:{class:`ck-widget__resizer__handle ${aI(i)}`}}).render())}_appendSizeUI(e){this._sizeView=new rI,this._sizeView.render(),e.appendChild(this._sizeView.element)}}function aI(n){return`ck-widget__resizer__handle-${n}`}function lI(n){return{x:n.pageX,y:n.pageY}}function cI(n){return n&&n.ownerDocument&&n.ownerDocument.contains(n)}/**
|
|
951
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
952
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
953
|
+
*/class Yo extends w{constructor(){super(...arguments),this._resizers=new Map}static get pluginName(){return"WidgetResize"}init(){const e=this.editor.editing,t=E.window.document;this.set("selectedResizer",null),this.set("_activeResizer",null),e.view.addObserver(go),this._observer=new($e()),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=An(()=>this.redrawSelectedResizer(),200),this.editor.ui.on("update",this._redrawSelectedResizerThrottled),this.editor.model.document.on("change",()=>{for(const[s,o]of this._resizers)s.isAttached()||(this._resizers.delete(s),o.destroy())},{priority:"lowest"}),this._observer.listenTo(E.window,"resize",this._redrawSelectedResizerThrottled);const i=this.editor.editing.view.document.selection;i.on("change",()=>{const s=i.getSelectedElement(),o=this.getResizerByViewElement(s)||null;o?this.select(o):this.deselect()})}redrawSelectedResizer(){this.selectedResizer&&this.selectedResizer.isVisible&&this.selectedResizer.redraw()}destroy(){super.destroy(),this._observer.stopListening();for(const e of this._resizers.values())e.destroy();this._redrawSelectedResizerThrottled.cancel()}select(e){this.deselect(),this.selectedResizer=e,this.selectedResizer.isSelected=!0}deselect(){this.selectedResizer&&(this.selectedResizer.isSelected=!1),this.selectedResizer=null}attachTo(e){const t=new Nu(e),i=this.editor.plugins;if(t.attach(),i.has("WidgetToolbarRepository")){const r=i.get("WidgetToolbarRepository");t.on("begin",()=>{r.forceDisabled("resize")},{priority:"lowest"}),t.on("cancel",()=>{r.clearForceDisabled("resize")},{priority:"highest"}),t.on("commit",()=>{r.clearForceDisabled("resize")},{priority:"highest"})}this._resizers.set(e.viewElement,t);const o=this.editor.editing.view.document.selection.getSelectedElement();return this.getResizerByViewElement(o)==t&&this.select(t),t}getResizerByViewElement(e){return this._resizers.get(e)}_getResizerByHandle(e){for(const t of this._resizers.values())if(t.containsHandle(e))return t}_mouseDownListener(e,t){const i=t.domTarget;Nu.isResizeHandle(i)&&(this._activeResizer=this._getResizerByHandle(i)||null,this._activeResizer&&(this._activeResizer.begin(i),e.stop(),t.preventDefault()))}_mouseMoveListener(e,t){this._activeResizer&&this._activeResizer.updateSize(t)}_mouseUpListener(){this._activeResizer&&(this._activeResizer.commit(),this._activeResizer=null)}}/**
|
|
954
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
955
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
956
|
+
*//* istanbul ignore file -- @preserve */const Qo=Ki("px");class uI extends T{constructor(){super();const e=this.bindTemplate;this.set({isVisible:!1,left:null,top:null,width:null}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-clipboard-drop-target-line",e.if("isVisible","ck-hidden",t=>!t)],style:{left:e.to("left",t=>Qo(t)),top:e.to("top",t=>Qo(t)),width:e.to("width",t=>Qo(t))}}})}}/**
|
|
957
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
958
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
959
|
+
*/class _s extends w{constructor(){super(...arguments),this.removeDropMarkerDelayed=Oa(()=>this.removeDropMarker(),40),this._updateDropMarkerThrottled=An(e=>this._updateDropMarker(e),40),this._reconvertMarkerThrottled=An(()=>{this.editor.model.markers.has("drop-target")&&this.editor.editing.reconvertMarker("drop-target")},0),this._dropTargetLineView=new uI,this._domEmitter=new($e()),this._scrollables=new Map}static get pluginName(){return"DragDropTarget"}init(){this._setupDropMarker()}destroy(){this._domEmitter.stopListening();for(const{resizeObserver:e}of this._scrollables.values())e.destroy();return this._updateDropMarkerThrottled.cancel(),this.removeDropMarkerDelayed.cancel(),this._reconvertMarkerThrottled.cancel(),super.destroy()}updateDropMarker(e,t,i,s,o,r){this.removeDropMarkerDelayed.cancel();const a=$u(this.editor,e,t,i,s,o,r);/* istanbul ignore next -- @preserve */if(a){if(r&&r.containsRange(a))return this.removeDropMarker();this._updateDropMarkerThrottled(a)}}getFinalDropRange(e,t,i,s,o,r){const a=$u(this.editor,e,t,i,s,o,r);return this.removeDropMarker(),a}removeDropMarker(){const e=this.editor.model;this.removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),this._dropTargetLineView.isVisible=!1,e.markers.has("drop-target")&&e.change(t=>{t.removeMarker("drop-target")})}_setupDropMarker(){const e=this.editor;e.ui.view.body.add(this._dropTargetLineView),e.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),e.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(t,{writer:i})=>{if(e.model.schema.checkChild(t.markerRange.start,"$text"))return this._dropTargetLineView.isVisible=!1,this._createDropTargetPosition(i);t.markerRange.isCollapsed?this._updateDropTargetLine(t.markerRange):this._dropTargetLineView.isVisible=!1}})}_updateDropMarker(e){const t=this.editor,i=t.model.markers;t.model.change(s=>{i.has("drop-target")?i.get("drop-target").getRange().isEqual(e)||s.updateMarker("drop-target",{range:e}):s.addMarker("drop-target",{range:e,usingOperation:!1,affectsData:!1})})}_createDropTargetPosition(e){return e.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},function(t){const i=this.toDomElement(t);return i.append("",t.createElement("span"),""),i})}_updateDropTargetLine(e){const t=this.editor.editing,i=e.start.nodeBefore,s=e.start.nodeAfter,o=e.start.parent,r=i?t.mapper.toViewElement(i):null,a=r?t.view.domConverter.mapViewToDom(r):null,l=s?t.mapper.toViewElement(s):null,c=l?t.view.domConverter.mapViewToDom(l):null,u=t.mapper.toViewElement(o);if(!u)return;const d=t.view.domConverter.mapViewToDom(u),h=this._getScrollableRect(u),{scrollX:f,scrollY:m}=E.window,p=a?new O(a):null,_=c?new O(c):null,C=new O(d).excludeScrollbarsAndBorders(),v=p?p.bottom:C.top,P=_?_.top:C.bottom,M=E.window.getComputedStyle(d),D=v<=P?(v+P)/2:P;if(h.top<D&&D<h.bottom){const A=C.left+parseFloat(M.paddingLeft),V=C.right-parseFloat(M.paddingRight),x=Math.max(A+f,h.left),X=Math.min(V+f,h.right);this._dropTargetLineView.set({isVisible:!0,left:x,top:D+m,width:X-x})}else this._dropTargetLineView.isVisible=!1}_getScrollableRect(e){const t=e.root.rootName;let i;if(this._scrollables.has(t))i=this._scrollables.get(t).domElement;else{const s=this.editor.editing.view.domConverter.mapViewToDom(e);i=hI(s),this._domEmitter.listenTo(i,"scroll",this._reconvertMarkerThrottled,{usePassive:!0});const o=new Q(i,this._reconvertMarkerThrottled);this._scrollables.set(t,{domElement:i,resizeObserver:o})}return new O(i).excludeScrollbarsAndBorders()}}function $u(n,e,t,i,s,o,r){const a=n.model,l=n.editing.mapper;let u=zu(n,e);for(;u;){if(!o){if(a.schema.checkChild(u,"$text")){if(t){const d=t[0].start,h=l.toModelPosition(d);if(!r||Array.from(r.getItems()).every(m=>a.schema.checkChild(h,m))){if(a.schema.checkChild(h,"$text"))return a.createRange(h);if(d)return vs(n,zu(n,d.parent),i,s)}}}else if(a.schema.isInline(u))return vs(n,u,i,s)}if(a.schema.isBlock(u))return vs(n,u,i,s);if(a.schema.checkChild(u,"$block")){const d=Array.from(u.getChildren()).filter(m=>m.is("element")&&!dI(n,m));let h=0,f=d.length;if(f==0)return a.createRange(a.createPositionAt(u,"end"));for(;h<f-1;){const m=Math.floor((h+f)/2);Rg(n,d[m],i,s)=="before"?f=m:h=m}return vs(n,d[h],i,s)}u=u.parent}return null}function dI(n,e){const t=n.editing.mapper,i=n.editing.view.domConverter,s=t.toViewElement(e);if(!s)return!0;const o=i.mapViewToDom(s);return E.window.getComputedStyle(o).float!="none"}function vs(n,e,t,i){const s=n.model;return s.createRange(s.createPositionAt(e,Rg(n,e,t,i)))}function Rg(n,e,t,i){const s=n.editing.mapper,o=n.editing.view.domConverter,r=s.toViewElement(e),a=o.mapViewToDom(r),l=new O(a);return n.model.schema.isInline(e)?t<(l.left+l.right)/2?"before":"after":i<(l.top+l.bottom)/2?"before":"after"}function zu(n,e){const t=n.editing.mapper,i=n.editing.view,s=t.toModelElement(e);if(s)return s;const o=i.createPositionBefore(e),r=t.findMappedViewAncestor(o);return t.toModelElement(r)}function hI(n){let e=n;do{e=e.parentElement;const t=E.window.getComputedStyle(e).overflowY;if(t=="auto"||t=="scroll")break}while(e.tagName!="BODY");return e}/**
|
|
960
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
961
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
962
|
+
*/class fI extends w{constructor(){super(...arguments),this._isBlockDragging=!1,this._domEmitter=new($e())}static get pluginName(){return"DragDropBlockToolbar"}init(){const e=this.editor;if(this.listenTo(e,"change:isReadOnly",(t,i,s)=>{s?(this.forceDisabled("readOnlyMode"),this._isBlockDragging=!1):this.clearForceDisabled("readOnlyMode")}),L.isAndroid&&this.forceDisabled("noAndroidSupport"),e.plugins.has("BlockToolbar")){const i=e.plugins.get("BlockToolbar").buttonView.element;this._domEmitter.listenTo(i,"dragstart",(s,o)=>this._handleBlockDragStart(o)),this._domEmitter.listenTo(E.document,"dragover",(s,o)=>this._handleBlockDragging(o)),this._domEmitter.listenTo(E.document,"drop",(s,o)=>this._handleBlockDragging(o)),this._domEmitter.listenTo(E.document,"dragend",()=>this._handleBlockDragEnd(),{useCapture:!0}),this.isEnabled&&i.setAttribute("draggable","true"),this.on("change:isEnabled",(s,o,r)=>{i.setAttribute("draggable",r?"true":"false")})}}destroy(){return this._domEmitter.stopListening(),super.destroy()}_handleBlockDragStart(e){if(!this.isEnabled)return;const t=this.editor.model,i=t.document.selection,s=this.editor.editing.view,o=Array.from(i.getSelectedBlocks()),r=t.createRange(t.createPositionBefore(o[0]),t.createPositionAfter(o[o.length-1]));t.change(a=>a.setSelection(r)),this._isBlockDragging=!0,s.focus(),s.getObserver(Nn).onDomEvent(e)}_handleBlockDragging(e){if(!this.isEnabled||!this._isBlockDragging)return;const t=e.clientX+(this.editor.locale.contentLanguageDirection=="ltr"?100:-100),i=e.clientY,s=document.elementFromPoint(t,i),o=this.editor.editing.view;!s||!s.closest(".ck-editor__editable")||o.getObserver(Nn).onDomEvent({...e,type:e.type,dataTransfer:e.dataTransfer,target:s,clientX:t,clientY:i,preventDefault:()=>e.preventDefault(),stopPropagation:()=>e.stopPropagation()})}_handleBlockDragEnd(){this._isBlockDragging=!1}}/**
|
|
963
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
964
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
965
|
+
*/class mI extends w{constructor(){super(...arguments),this._clearDraggableAttributesDelayed=Oa(()=>this._clearDraggableAttributes(),40),this._blockMode=!1,this._domEmitter=new($e())}static get pluginName(){return"DragDrop"}static get requires(){return[rt,fi,_s,fI]}init(){const e=this.editor,t=e.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,t.addObserver(Nn),t.addObserver(go),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDraggableAttributeHandling(),this.listenTo(e,"change:isReadOnly",(i,s,o)=>{o?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")}),this.on("change:isEnabled",(i,s,o)=>{o||this._finalizeDragging(!1)}),L.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._previewContainer&&this._previewContainer.remove(),this._domEmitter.stopListening(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const e=this.editor,t=e.model,i=e.editing.view,s=i.document,o=e.plugins.get(_s);this.listenTo(s,"dragstart",(r,a)=>{if(a.target&&a.target.is("editableElement")){a.preventDefault();return}if(this._prepareDraggedRange(a.target),!this._draggedRange){a.preventDefault();return}this._draggingUid=Ze(),a.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",a.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const l=t.createSelection(this._draggedRange.toRange());this.editor.plugins.get("ClipboardPipeline")._fireOutputTransformationEvent(a.dataTransfer,l,"dragstart");const{dataTransfer:u,domTarget:d,domEvent:h}=a,{clientX:f}=h;this._updatePreview({dataTransfer:u,domTarget:d,clientX:f}),a.stopPropagation(),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")},{priority:"low"}),this.listenTo(s,"dragend",(r,a)=>{this._finalizeDragging(!a.dataTransfer.isCanceled&&a.dataTransfer.dropEffect=="move")},{priority:"low"}),this._domEmitter.listenTo(E.document,"dragend",()=>{this._blockMode=!1},{useCapture:!0}),this.listenTo(s,"dragenter",()=>{this.isEnabled&&i.focus()}),this.listenTo(s,"dragleave",()=>{o.removeDropMarkerDelayed()}),this.listenTo(s,"dragging",(r,a)=>{if(!this.isEnabled){a.dataTransfer.dropEffect="none";return}const{clientX:l,clientY:c}=a.domEvent;o.updateDropMarker(a.target,a.targetRanges,l,c,this._blockMode,this._draggedRange),this._draggedRange||(a.dataTransfer.dropEffect="copy"),L.isGecko||(a.dataTransfer.effectAllowed=="copy"?a.dataTransfer.dropEffect="copy":["all","copyMove"].includes(a.dataTransfer.effectAllowed)&&(a.dataTransfer.dropEffect="move")),r.stop()},{priority:"low"})}_setupClipboardInputIntegration(){const e=this.editor,i=e.editing.view.document,s=e.plugins.get(_s);this.listenTo(i,"clipboardInput",(o,r)=>{if(r.method!="drop")return;const{clientX:a,clientY:l}=r.domEvent,c=s.getFinalDropRange(r.target,r.targetRanges,a,l,this._blockMode,this._draggedRange);if(!c){this._finalizeDragging(!1),o.stop();return}if(this._draggedRange&&this._draggingUid!=r.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid=""),Hu(r.dataTransfer)=="move"&&this._draggedRange&&this._draggedRange.containsRange(c,!0)){this._finalizeDragging(!1),o.stop();return}r.targetRanges=[e.editing.mapper.toViewRange(c)]},{priority:"high"})}_setupContentInsertionIntegration(){const e=this.editor.plugins.get(rt);e.on("contentInsertion",(t,i)=>{if(!this.isEnabled||i.method!=="drop")return;const s=i.targetRanges.map(o=>this.editor.editing.mapper.toModelRange(o));this.editor.model.change(o=>o.setSelection(s))},{priority:"high"}),e.on("contentInsertion",(t,i)=>{if(!this.isEnabled||i.method!=="drop")return;const s=Hu(i.dataTransfer)=="move",o=!i.resultRange||!i.resultRange.isCollapsed;this._finalizeDragging(o&&s)},{priority:"lowest"})}_setupDraggableAttributeHandling(){const e=this.editor,t=e.editing.view,i=t.document;this.listenTo(i,"mousedown",(s,o)=>{if(L.isAndroid||!o)return;this._clearDraggableAttributesDelayed.cancel();let r=Uu(o.target);if(L.isBlink&&!e.isReadOnly&&!r&&!i.selection.isCollapsed){const a=i.selection.getSelectedElement();(!a||!he(a))&&(r=i.selection.editableElement)}r&&(t.change(a=>{a.setAttribute("draggable","true",r)}),this._draggableElement=e.editing.mapper.toModelElement(r))}),this.listenTo(i,"mouseup",()=>{L.isAndroid||this._clearDraggableAttributesDelayed()})}_clearDraggableAttributes(){const e=this.editor.editing;e.view.change(t=>{this._draggableElement&&this._draggableElement.root.rootName!="$graveyard"&&t.removeAttribute("draggable",e.mapper.toViewElement(this._draggableElement)),this._draggableElement=null})}_finalizeDragging(e){const t=this.editor,i=t.model;t.plugins.get(_s).removeDropMarker(),this._clearDraggableAttributes(),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._previewContainer&&(this._previewContainer.remove(),this._previewContainer=void 0),this._draggedRange&&(e&&this.isEnabled&&i.change(o=>{const r=i.createSelection(this._draggedRange);i.deleteContent(r,{doNotAutoparagraph:!0});const a=r.getFirstPosition().parent;a.isEmpty&&!i.schema.checkChild(a,"$text")&&i.schema.checkChild(a,"paragraph")&&o.insertElement("paragraph",a,0)}),this._draggedRange.detach(),this._draggedRange=null)}_prepareDraggedRange(e){const t=this.editor,i=t.model,s=i.document.selection,o=e?Uu(e):null;if(o){const c=t.editing.mapper.toModelElement(o);this._draggedRange=Fe.fromRange(i.createRangeOn(c)),this._blockMode=i.schema.isBlock(c),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop");return}if(s.isCollapsed&&!s.getFirstPosition().parent.isEmpty)return;const r=Array.from(s.getSelectedBlocks()),a=s.getFirstRange();if(r.length==0){this._draggedRange=Fe.fromRange(a);return}const l=Vg(i,r);if(r.length>1)this._draggedRange=Fe.fromRange(l),this._blockMode=!0;else if(r.length==1){const c=a.start.isTouching(l.start)&&a.end.isTouching(l.end);this._draggedRange=Fe.fromRange(c?l:a),this._blockMode=c}i.change(c=>c.setSelection(this._draggedRange.toRange()))}_updatePreview({dataTransfer:e,domTarget:t,clientX:i}){const s=this.editor.editing.view,o=s.document.selection.editableElement,r=s.domConverter.mapViewToDom(o),a=E.window.getComputedStyle(r);this._previewContainer?this._previewContainer.firstElementChild&&this._previewContainer.removeChild(this._previewContainer.firstElementChild):(this._previewContainer=Sn(E.document,"div",{style:"position: fixed; left: -999999px;"}),E.document.body.appendChild(this._previewContainer));const l=new O(r);if(r.contains(t))return;const c=parseFloat(a.paddingLeft),u=Sn(E.document,"div");u.className="ck ck-content",u.style.width=a.width,u.style.paddingLeft=`${l.left-i+c}px`,L.isiOS&&(u.style.backgroundColor="white"),u.innerHTML=e.getData("text/html"),e.setDragImage(u,0,0),this._previewContainer.appendChild(u)}}function Hu(n){return L.isGecko?n.dropEffect:["all","copyMove"].includes(n.effectAllowed)?"move":"copy"}function Uu(n){if(n.is("editableElement"))return null;if(n.hasClass("ck-widget__selection-handle"))return n.findAncestor(he);if(he(n))return n;const e=n.findAncestor(t=>he(t)||t.is("editableElement"));return he(e)?e:null}function Vg(n,e){const t=e[0],i=e[e.length-1],s=t.getCommonAncestor(i),o=n.createPositionBefore(t),r=n.createPositionAfter(i);if(s&&s.is("element")&&!n.schema.isLimit(s)){const a=n.createRangeOn(s),l=o.isTouching(a.start),c=r.isTouching(a.end);if(l&&c)return Vg(n,[s])}return n.createRange(o,r)}/**
|
|
966
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
967
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
968
|
+
*/class gI extends w{static get pluginName(){return"PastePlainText"}static get requires(){return[rt]}init(){const e=this.editor,t=e.model,i=e.editing.view,s=i.document,o=t.document.selection;let r=!1;i.addObserver(Nn),this.listenTo(s,"keydown",(a,l)=>{r=l.shiftKey}),e.plugins.get(rt).on("contentInsertion",(a,l)=>{!r&&!pI(l.content,t.schema)||t.change(c=>{const u=Array.from(o.getAttributes()).filter(([h])=>t.schema.getAttributeProperties(h).isFormatting);o.isCollapsed||t.deleteContent(o,{doNotAutoparagraph:!0}),u.push(...o.getAttributes());const d=c.createRangeIn(l.content);for(const h of d.getItems())h.is("$textProxy")&&c.setAttributes(u,h)})})}}function pI(n,e){if(n.childCount>1)return!1;const t=n.getChild(0);return e.isObject(t)?!1:Array.from(t.getAttributeKeys()).length==0}/**
|
|
969
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
970
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
971
|
+
*/class Lg extends w{static get pluginName(){return"Clipboard"}static get requires(){return[rt,mI,gI]}}/**
|
|
972
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
973
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
974
|
+
*/class wI extends R{constructor(e){super(e),this.affectsData=!1}execute(){const e=this.editor.model,t=e.document.selection;let i=e.schema.getLimitElement(t);if(t.containsEntireContent(i)||!Wu(e.schema,i))do if(i=i.parent,!i)return;while(!Wu(e.schema,i));e.change(s=>{s.setSelection(i,"in")})}}function Wu(n,e){return n.isLimit(e)&&(n.checkChild(e,"$text")||n.checkChild(e,"paragraph"))}/**
|
|
975
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
976
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
977
|
+
*/const bI=Gn("Ctrl+A");class _I extends w{static get pluginName(){return"SelectAllEditing"}init(){const e=this.editor,i=e.editing.view.document;e.commands.add("selectAll",new wI(e)),this.listenTo(i,"keydown",(s,o)=>{Ni(o)===bI&&(e.execute("selectAll"),o.preventDefault())})}}const vI='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M.75 15.5a.75.75 0 0 1 .75.75V18l.008.09A.5.5 0 0 0 2 18.5h1.75a.75.75 0 1 1 0 1.5H1.5l-.144-.007a1.5 1.5 0 0 1-1.35-1.349L0 18.5v-2.25a.75.75 0 0 1 .75-.75zm18.5 0a.75.75 0 0 1 .75.75v2.25l-.007.144a1.5 1.5 0 0 1-1.349 1.35L18.5 20h-2.25a.75.75 0 1 1 0-1.5H18a.5.5 0 0 0 .492-.41L18.5 18v-1.75a.75.75 0 0 1 .75-.75zm-10.45 3c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2H7.2a.2.2 0 0 1-.2-.2v-1.1c0-.11.09-.2.2-.2h1.6zm4 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2h-1.6a.2.2 0 0 1-.2-.2v-1.1c0-.11.09-.2.2-.2h1.6zm.45-5.5a.75.75 0 1 1 0 1.5h-8.5a.75.75 0 1 1 0-1.5h8.5zM1.3 11c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2H.2a.2.2 0 0 1-.2-.2v-1.6c0-.11.09-.2.2-.2h1.1zm18.5 0c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2h-1.1a.2.2 0 0 1-.2-.2v-1.6c0-.11.09-.2.2-.2h1.1zm-4.55-2a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.5h10.5zM1.3 7c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2H.2a.2.2 0 0 1-.2-.2V7.2c0-.11.09-.2.2-.2h1.1zm18.5 0c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2h-1.1a.2.2 0 0 1-.2-.2V7.2c0-.11.09-.2.2-.2h1.1zm-4.55-2a.75.75 0 1 1 0 1.5h-2.5a.75.75 0 1 1 0-1.5h2.5zm-5 0a.75.75 0 1 1 0 1.5h-5.5a.75.75 0 0 1 0-1.5h5.5zm-6.5-5a.75.75 0 0 1 0 1.5H2a.5.5 0 0 0-.492.41L1.5 2v1.75a.75.75 0 0 1-1.5 0V1.5l.007-.144A1.5 1.5 0 0 1 1.356.006L1.5 0h2.25zM18.5 0l.144.007a1.5 1.5 0 0 1 1.35 1.349L20 1.5v2.25a.75.75 0 1 1-1.5 0V2l-.008-.09A.5.5 0 0 0 18 1.5h-1.75a.75.75 0 1 1 0-1.5h2.25zM8.8 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2H7.2a.2.2 0 0 1-.2-.2V.2c0-.11.09-.2.2-.2h1.6zm4 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2h-1.6a.2.2 0 0 1-.2-.2V.2c0-.11.09-.2.2-.2h1.6z"/></svg>';/**
|
|
978
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
979
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
980
|
+
*/class yI extends w{static get pluginName(){return"SelectAllUI"}init(){const e=this.editor;e.ui.componentFactory.add("selectAll",t=>{const i=e.commands.get("selectAll"),s=new B(t),o=t.t;return s.set({label:o("Select all"),icon:vI,keystroke:"Ctrl+A",tooltip:!0}),s.bind("isEnabled").to(i,"isEnabled"),this.listenTo(s,"execute",()=>{e.execute("selectAll"),e.editing.view.focus()}),s})}}/**
|
|
981
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
982
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
983
|
+
*/class CI extends w{static get requires(){return[_I,yI]}static get pluginName(){return"SelectAll"}}/**
|
|
984
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
985
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
986
|
+
*/class Bg extends R{constructor(e){super(e),this._stack=[],this._createdBatches=new WeakSet,this.refresh(),this._isEnabledBasedOnSelection=!1,this.listenTo(e.data,"set",(t,i)=>{i[1]={...i[1]};const s=i[1];s.batchType||(s.batchType={isUndoable:!1})},{priority:"high"}),this.listenTo(e.data,"set",(t,i)=>{i[1].batchType.isUndoable||this.clearStack()})}refresh(){this.isEnabled=this._stack.length>0}get createdBatches(){return this._createdBatches}addBatch(e){const t=this.editor.model.document.selection,i={ranges:t.hasOwnRange?Array.from(t.getRanges()):[],isBackward:t.isBackward};this._stack.push({batch:e,selection:i}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(e,t,i){const s=this.editor.model,o=s.document,r=[],a=e.map(c=>c.getTransformedByOperations(i)),l=a.flat();for(const c of a){const u=c.filter(d=>d.root!=o.graveyard).filter(d=>!EI(d,l));u.length&&(kI(u),r.push(u[0]))}r.length&&s.change(c=>{c.setSelection(r,{backward:t})})}_undo(e,t){const i=this.editor.model,s=i.document;this._createdBatches.add(t);const o=e.operations.slice().filter(r=>r.isDocumentOperation);o.reverse();for(const r of o){const a=r.baseVersion+1,l=Array.from(s.history.getOperations(a)),u=TE([r.getReversed()],l,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(let d of u){const h=d.affectedSelectable;h&&!i.canEditAt(h)&&(d=new de(d.baseVersion)),t.addOperation(d),i.applyOperation(d),s.history.setOperationAsUndone(r,d)}}}}function kI(n){n.sort((e,t)=>e.start.isBefore(t.start)?-1:1);for(let e=1;e<n.length;e++){const i=n[e-1].getJoined(n[e],!0);i&&(e--,n.splice(e,2,i))}}function EI(n,e){return e.some(t=>t!==n&&t.containsRange(n,!0))}/**
|
|
987
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
988
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
989
|
+
*/class TI extends Bg{execute(e=null){const t=e?this._stack.findIndex(o=>o.batch==e):this._stack.length-1,i=this._stack.splice(t,1)[0],s=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(s,()=>{this._undo(i.batch,s);const o=this.editor.model.document.history.getOperations(i.batch.baseVersion);this._restoreSelection(i.selection.ranges,i.selection.isBackward,o)}),this.fire("revert",i.batch,s),this.refresh()}}/**
|
|
990
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
991
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
992
|
+
*/class AI extends Bg{execute(){const e=this._stack.pop(),t=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(t,()=>{const s=e.batch.operations[e.batch.operations.length-1].baseVersion+1,o=this.editor.model.document.history.getOperations(s);this._restoreSelection(e.selection.ranges,e.selection.isBackward,o),this._undo(e.batch,t)}),this.refresh()}}/**
|
|
993
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
994
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
995
|
+
*/class SI extends w{constructor(){super(...arguments),this._batchRegistry=new WeakSet}static get pluginName(){return"UndoEditing"}init(){const e=this.editor;this._undoCommand=new TI(e),this._redoCommand=new AI(e),e.commands.add("undo",this._undoCommand),e.commands.add("redo",this._redoCommand),this.listenTo(e.model,"applyOperation",(t,i)=>{const s=i[0];if(!s.isDocumentOperation)return;const o=s.batch,r=this._redoCommand.createdBatches.has(o),a=this._undoCommand.createdBatches.has(o);this._batchRegistry.has(o)||(this._batchRegistry.add(o),o.isUndoable&&(r?this._undoCommand.addBatch(o):a||(this._undoCommand.addBatch(o),this._redoCommand.clearStack())))},{priority:"highest"}),this.listenTo(this._undoCommand,"revert",(t,i,s)=>{this._redoCommand.addBatch(s)}),e.keystrokes.set("CTRL+Z","undo"),e.keystrokes.set("CTRL+Y","redo"),e.keystrokes.set("CTRL+SHIFT+Z","redo")}}/**
|
|
996
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
997
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
998
|
+
*/class xI extends w{static get pluginName(){return"UndoUI"}init(){const e=this.editor,t=e.locale,i=e.t,s=t.uiLanguageDirection=="ltr"?I.undo:I.redo,o=t.uiLanguageDirection=="ltr"?I.redo:I.undo;this._addButton("undo",i("Undo"),"CTRL+Z",s),this._addButton("redo",i("Redo"),"CTRL+Y",o)}_addButton(e,t,i,s){const o=this.editor;o.ui.componentFactory.add(e,r=>{const a=o.commands.get(e),l=new B(r);return l.set({label:t,icon:s,keystroke:i,tooltip:!0}),l.bind("isEnabled").to(a,"isEnabled"),this.listenTo(l,"execute",()=>{o.execute(e),o.editing.view.focus()}),l})}}/**
|
|
999
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1000
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1001
|
+
*/class Og extends w{static get requires(){return[SI,xI]}static get pluginName(){return"Undo"}}/**
|
|
1002
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1003
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1004
|
+
*/class II extends w{static get requires(){return[Lg,ts,CI,Tg,vg,Og]}static get pluginName(){return"Essentials"}}/**
|
|
1005
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1006
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1007
|
+
*/class PI extends R{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}refresh(){const e=this.editor.model,t=e.document,i=J(t.selection.getSelectedBlocks());this.value=!!i&&i.is("element","paragraph"),this.isEnabled=!!i&&qu(i,e.schema)}execute(e={}){const t=this.editor.model,i=t.document,s=e.selection||i.selection;t.canEditAt(s)&&t.change(o=>{const r=s.getSelectedBlocks();for(const a of r)!a.is("element","paragraph")&&qu(a,t.schema)&&o.rename(a,"paragraph")})}}function qu(n,e){return e.checkChild(n.parent,"paragraph")&&!e.isObject(n)}/**
|
|
1008
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1009
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1010
|
+
*/class RI extends R{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}execute(e){const t=this.editor.model,i=e.attributes;let s=e.position;t.canEditAt(s)&&t.change(o=>{if(s=this._findPositionToInsertParagraph(s,o),!s)return;const r=o.createElement("paragraph");i&&t.schema.setAllowedAttributes(r,i,o),t.insertContent(r,s),o.setSelection(r,"in")})}_findPositionToInsertParagraph(e,t){const i=this.editor.model;if(i.schema.checkChild(e,"paragraph"))return e;const s=i.schema.findAllowedParent(e,"paragraph");if(!s)return null;const o=e.parent,r=i.schema.checkChild(o,"$text");return o.isEmpty||r&&e.isAtEnd?i.createPositionAfter(o):!o.isEmpty&&r&&e.isAtStart?i.createPositionBefore(o):t.split(e,s).position}}/**
|
|
1011
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1012
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1013
|
+
*/class is extends w{static get pluginName(){return"Paragraph"}init(){const e=this.editor,t=e.model;e.commands.add("paragraph",new PI(e)),e.commands.add("insertParagraph",new RI(e)),t.schema.register("paragraph",{inheritAllFrom:"$block"}),e.conversion.elementToElement({model:"paragraph",view:"p"}),e.conversion.for("upcast").elementToElement({model:(i,{writer:s})=>!is.paragraphLikeElements.has(i.name)||i.isEmpty?null:s.createElement("paragraph"),view:/.+/,converterPriority:"low"})}}is.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]);/**
|
|
1014
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1015
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1016
|
+
*/class VI extends R{constructor(e,t){super(e),this.modelElements=t}refresh(){const 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=>ju(e,t,this.editor.model.schema))}execute(e){const t=this.editor.model,i=t.document,s=e.value;t.change(o=>{const r=Array.from(i.selection.getSelectedBlocks()).filter(a=>ju(a,s,t.schema));for(const a of r)a.is("element",s)||o.rename(a,s)})}}function ju(n,e,t){return t.checkChild(n.parent,e)&&!t.isObject(n)}/**
|
|
1017
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1018
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1019
|
+
*/const Gu="paragraph";class LI extends w{static get pluginName(){return"HeadingEditing"}constructor(e){super(e),e.config.define("heading",{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading1",view:"h2",title:"Heading 1",class:"ck-heading_heading1"},{model:"heading2",view:"h3",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h4",title:"Heading 3",class:"ck-heading_heading3"}]})}static get requires(){return[is]}init(){const e=this.editor,t=e.config.get("heading.options"),i=[];for(const s of t)s.model!=="paragraph"&&(e.model.schema.register(s.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(s),i.push(s.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new VI(e,i))}afterInit(){const e=this.editor,t=e.commands.get("enter"),i=e.config.get("heading.options");t&&this.listenTo(t,"afterExecute",(s,o)=>{const r=e.model.document.selection.getFirstPosition().parent;i.some(l=>r.is("element",l.model))&&!r.is("element",Gu)&&r.childCount===0&&o.writer.rename(r,Gu)})}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:Me.low+1})}}/**
|
|
1020
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1021
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1022
|
+
*/function BI(n){const e=n.t,t={Paragraph:e("Paragraph"),"Heading 1":e("Heading 1"),"Heading 2":e("Heading 2"),"Heading 3":e("Heading 3"),"Heading 4":e("Heading 4"),"Heading 5":e("Heading 5"),"Heading 6":e("Heading 6")};return n.config.get("heading.options").map(i=>{const s=t[i.title];return s&&s!=i.title&&(i.title=s),i})}/**
|
|
1023
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1024
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1025
|
+
*/class OI extends w{static get pluginName(){return"HeadingUI"}init(){const e=this.editor,t=e.t,i=BI(e),s=t("Choose heading"),o=t("Heading");e.ui.componentFactory.add("heading",r=>{const a={},l=new _e,c=e.commands.get("heading"),u=e.commands.get("paragraph"),d=[c];for(const f of i){const m={type:"button",model:new hi({label:f.title,class:f.class,role:"menuitemradio",withText:!0})};f.model==="paragraph"?(m.model.bind("isOn").to(u,"value"),m.model.set("commandName","paragraph"),d.push(u)):(m.model.bind("isOn").to(c,"value",p=>p===f.model),m.model.set({commandName:"heading",commandValue:f.model})),l.add(m),a[f.model]=f.title}const h=fe(r);return di(h,l,{ariaLabel:o,role:"menu"}),h.buttonView.set({ariaLabel:o,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:o}),h.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),h.bind("isEnabled").toMany(d,"isEnabled",(...f)=>f.some(m=>m)),h.buttonView.bind("label").to(c,"value",u,"value",(f,m)=>{const p=f||m&&"paragraph";return typeof p=="boolean"||!a[p]?s:a[p]}),this.listenTo(h,"execute",f=>{const{commandName:m,commandValue:p}=f.source;e.execute(m,p?{value:p}:void 0),e.editing.view.focus()}),h})}}/**
|
|
1026
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1027
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1028
|
+
*/class MI extends w{static get requires(){return[LI,OI]}static get pluginName(){return"Heading"}}/**
|
|
1029
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1030
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1031
|
+
*/function FI(n){return n.createContainerElement("span",{class:"image-inline"},n.createEmptyElement("img"))}function Ku(n){return n.createContainerElement("figure",{class:"image"},[n.createEmptyElement("img"),n.createSlot("children")])}function Mg(n,e){const t=n.plugins.get("ImageUtils"),i=n.plugins.has("ImageInlineEditing")&&n.plugins.has("ImageBlockEditing");return o=>t.isInlineImageView(o)?i&&(o.getStyle("display")=="block"||o.findAncestor(t.isBlockImageView)?"imageBlock":"imageInline")!==e?null:s(o):null;function s(o){const r={name:!0};return o.hasAttribute("src")&&(r.attributes=["src"]),r}}function tl(n,e){const t=J(e.getSelectedBlocks());return!t||n.isObject(t)||t.isEmpty&&t.name!="listItem"?"imageBlock":"imageInline"}function Ys(n){return n&&n.endsWith("px")?parseInt(n):null}function Qs(n){const e=Ys(n.getStyle("width")),t=Ys(n.getStyle("height"));return!!(e&&t)}/**
|
|
1032
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1033
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1034
|
+
*/const DI=/^(image|image-inline)$/;class Te extends w{constructor(){super(...arguments),this._domEmitter=new($e())}static get pluginName(){return"ImageUtils"}isImage(e){return this.isInlineImage(e)||this.isBlockImage(e)}isInlineImageView(e){return!!e&&e.is("element","img")}isBlockImageView(e){return!!e&&e.is("element","figure")&&e.hasClass("image")}insertImage(e={},t=null,i=null,s={}){const o=this.editor,r=o.model,a=r.document.selection,l=Fg(o,t||a,i);e={...Object.fromEntries(a.getAttributes()),...e};for(const c in e)r.schema.checkAttribute(l,c)||delete e[c];return r.change(c=>{const{setImageSizes:u=!0}=s,d=c.createElement(l,e);return r.insertObject(d,t,null,{setSelection:"on",findOptimalPosition:!t&&l!="imageInline"?"auto":void 0}),d.parent?(u&&this.setImageNaturalSizeAttributes(d),d):null})}setImageNaturalSizeAttributes(e){const t=e.getAttribute("src");t&&(e.getAttribute("width")||e.getAttribute("height")||this.editor.model.change(i=>{const s=new E.window.Image;this._domEmitter.listenTo(s,"load",()=>{!e.getAttribute("width")&&!e.getAttribute("height")&&this.editor.model.enqueueChange(i.batch,o=>{o.setAttribute("width",s.naturalWidth,e),o.setAttribute("height",s.naturalHeight,e)}),this._domEmitter.stopListening(s,"load")}),s.src=t}))}getClosestSelectedImageWidget(e){const t=e.getFirstPosition();if(!t)return null;const i=e.getSelectedElement();if(i&&this.isImageWidget(i))return i;let s=t.parent;for(;s;){if(s.is("element")&&this.isImageWidget(s))return s;s=s.parent}return null}getClosestSelectedImageElement(e){const t=e.getSelectedElement();return this.isImage(t)?t:e.getFirstPosition().findAncestor("imageBlock")}getImageWidgetFromImageView(e){return e.findAncestor({classes:DI})}isImageAllowed(){const t=this.editor.model.document.selection;return NI(this.editor,t)&&$I(t)}toImageWidget(e,t,i){return t.setCustomProperty("image",!0,e),Xi(e,t,{label:()=>{const r=this.findViewImgElement(e).getAttribute("alt");return r?`${r} ${i}`:i}})}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;const t=this.editor.editing.view;for(const{item:i}of t.createRangeIn(e))if(this.isInlineImageView(i))return i}destroy(){return this._domEmitter.stopListening(),super.destroy()}}function NI(n,e){if(Fg(n,e,null)=="imageBlock"){const i=zI(e,n.model);if(n.model.schema.checkChild(i,"imageBlock"))return!0}else if(n.model.schema.checkChild(e.focus,"imageInline"))return!0;return!1}function $I(n){return[...n.focus.getAncestors()].every(e=>!e.is("element","imageBlock"))}function zI(n,e){const i=el(n,e).start.parent;return i.isEmpty&&!i.is("element","$root")?i.parent:i}function Fg(n,e,t){const i=n.model.schema,s=n.config.get("image.insert.type");return n.plugins.has("ImageBlockEditing")?n.plugins.has("ImageInlineEditing")?t||(s==="inline"?"imageInline":s!=="auto"?"imageBlock":e.is("selection")?tl(i,e):i.checkChild(e,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}/**
|
|
1035
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1036
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1037
|
+
*/class HI extends R{refresh(){const i=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!i,this.isEnabled&&i.hasAttribute("alt")?this.value=i.getAttribute("alt"):this.value=!1}execute(e){const t=this.editor,i=t.plugins.get("ImageUtils"),s=t.model,o=i.getClosestSelectedImageElement(s.document.selection);s.change(r=>{r.setAttribute("alt",e.newValue,o)})}}/**
|
|
1038
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1039
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1040
|
+
*/class UI extends w{static get requires(){return[Te]}static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new HI(this.editor))}}/**
|
|
1041
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1042
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1043
|
+
*/class WI extends T{constructor(e){super(e);const t=this.locale.t;this.focusTracker=new ne,this.keystrokes=new ae,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(t("Save"),I.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(t("Cancel"),I.cancel,"ck-button-cancel","cancel"),this._focusables=new Ae,this._focusCycler=new ke({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-text-alternative-form","ck-responsive-form"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),this.keystrokes.listenTo(this.element),so({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(e,t,i,s){const o=new B(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o.extendTemplate({attributes:{class:i}}),s&&o.delegate("execute").to(this,s),o}_createLabeledInputView(){const e=this.locale.t,t=new Zi(this.locale,Qn);return t.label=e("Text alternative"),t}}/**
|
|
1044
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1045
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1046
|
+
*/function qI(n){const e=n.plugins.get("ContextualBalloon");if(n.plugins.get("ImageUtils").getClosestSelectedImageWidget(n.editing.view.document.selection)){const i=Dg(n);e.updatePosition(i)}}function Dg(n){const e=n.editing.view,t=be.defaultPositions,i=n.plugins.get("ImageUtils");return{target:e.domConverter.mapViewToDom(i.getClosestSelectedImageWidget(e.document.selection)),positions:[t.northArrowSouth,t.northArrowSouthWest,t.northArrowSouthEast,t.southArrowNorth,t.southArrowNorthWest,t.southArrowNorthEast,t.viewportStickyNorth]}}/**
|
|
1047
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1048
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1049
|
+
*/class jI extends w{static get requires(){return[Gs]}static get pluginName(){return"ImageTextAlternativeUI"}init(){this._createButton()}destroy(){super.destroy(),this._form&&this._form.destroy()}_createButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("imageTextAlternative",i=>{const s=e.commands.get("imageTextAlternative"),o=new B(i);return o.set({label:t("Change image text alternative"),icon:I.textAlternative,tooltip:!0}),o.bind("isEnabled").to(s,"isEnabled"),o.bind("isOn").to(s,"value",r=>!!r),this.listenTo(o,"execute",()=>{this._showForm()}),o})}_createForm(){const e=this.editor,i=e.editing.view.document,s=e.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(ma(WI))(e.locale),this._form.render(),this.listenTo(this._form,"submit",()=>{e.execute("imageTextAlternative",{newValue:this._form.labeledInput.fieldView.element.value}),this._hideForm(!0)}),this.listenTo(this._form,"cancel",()=>{this._hideForm(!0)}),this._form.keystrokes.set("Esc",(o,r)=>{this._hideForm(!0),r()}),this.listenTo(e.ui,"update",()=>{s.getClosestSelectedImageWidget(i.selection)?this._isVisible&&qI(e):this._hideForm(!0)}),fa({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;this._form||this._createForm();const e=this.editor,t=e.commands.get("imageTextAlternative"),i=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:Dg(e)}),i.fieldView.value=i.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)}}/**
|
|
1050
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1051
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1052
|
+
*/class Ng extends w{static get requires(){return[UI,jI]}static get pluginName(){return"ImageTextAlternative"}}/**
|
|
1053
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1054
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1055
|
+
*/function GI(n){const e=(t,i,s)=>{if(!s.consumable.test(i.viewItem,{name:!0,classes:"image"}))return;const o=n.findViewImgElement(i.viewItem);if(!o||!s.consumable.test(o,{name:!0}))return;s.consumable.consume(i.viewItem,{name:!0,classes:"image"});const r=s.convertItem(o,i.modelCursor),a=J(r.modelRange.getItems());if(!a){s.consumable.revert(i.viewItem,{name:!0,classes:"image"});return}s.convertChildren(i.viewItem,a),s.updateConversionResult(a,i)};return t=>{t.on("element:figure",e)}}function $g(n,e){const t=(i,s,o)=>{if(!o.consumable.consume(s.item,i.name))return;const r=o.writer,a=o.mapper.toViewElement(s.item),l=n.findViewImgElement(a);s.attributeNewValue===null?(r.removeAttribute("srcset",l),r.removeAttribute("sizes",l)):s.attributeNewValue&&(r.setAttribute("srcset",s.attributeNewValue,l),r.setAttribute("sizes","100vw",l))};return i=>{i.on(`attribute:srcset:${e}`,t)}}function Xs(n,e,t){const i=(s,o,r)=>{if(!r.consumable.consume(o.item,s.name))return;const a=r.writer,l=r.mapper.toViewElement(o.item),c=n.findViewImgElement(l);a.setAttribute(o.attributeKey,o.attributeNewValue||"",c)};return s=>{s.on(`attribute:${t}:${e}`,i)}}/**
|
|
1056
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1057
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1058
|
+
*/class il extends lt{observe(e){this.listenTo(e,"load",(t,i)=>{const s=i.target;this.checkShouldIgnoreEventFromTarget(s)||s.tagName=="IMG"&&this._fireEvents(i)},{useCapture:!0})}stopObserving(e){this.stopListening(e)}_fireEvents(e){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",e))}}/**
|
|
1059
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1060
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1061
|
+
*/class KI extends R{constructor(e){super(e);const t=e.config.get("image.insert.type");e.plugins.has("ImageBlockEditing")||t==="block"&&H("image-block-plugin-required"),e.plugins.has("ImageInlineEditing")||t==="inline"&&H("image-inline-plugin-required")}refresh(){const e=this.editor.plugins.get("ImageUtils");this.isEnabled=e.isImageAllowed()}execute(e){const t=K(e.source),i=this.editor.model.document.selection,s=this.editor.plugins.get("ImageUtils"),o=Object.fromEntries(i.getAttributes());t.forEach((r,a)=>{const l=i.getSelectedElement();if(typeof r=="string"&&(r={src:r}),a&&l&&s.isImage(l)){const c=this.editor.model.createPositionAfter(l);s.insertImage({...r,...o},c)}else s.insertImage({...r,...o})})}}/**
|
|
1062
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1063
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1064
|
+
*/class ZI extends R{constructor(e){super(e),this.decorate("cleanupImage")}refresh(){const t=this.editor.plugins.get("ImageUtils"),i=this.editor.model.document.selection.getSelectedElement();this.isEnabled=t.isImage(i),this.value=this.isEnabled?i.getAttribute("src"):null}execute(e){const t=this.editor.model.document.selection.getSelectedElement(),i=this.editor.plugins.get("ImageUtils");this.editor.model.change(s=>{s.setAttribute("src",e.source,t),this.cleanupImage(s,t),i.setImageNaturalSizeAttributes(t)})}cleanupImage(e,t){e.removeAttribute("srcset",t),e.removeAttribute("sizes",t),e.removeAttribute("sources",t),e.removeAttribute("width",t),e.removeAttribute("height",t),e.removeAttribute("alt",t)}}/**
|
|
1065
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1066
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1067
|
+
*/class zg extends w{static get requires(){return[Te]}static get pluginName(){return"ImageEditing"}init(){const e=this.editor,t=e.conversion;e.editing.view.addObserver(il),t.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:"srcset"});const i=new KI(e),s=new ZI(e);e.commands.add("insertImage",i),e.commands.add("replaceImageSource",s),e.commands.add("imageInsert",i)}}/**
|
|
1068
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1069
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1070
|
+
*/class Hg extends w{static get requires(){return[Te]}static get pluginName(){return"ImageSizeAttributes"}afterInit(){this._registerSchema(),this._registerConverters("imageBlock"),this._registerConverters("imageInline")}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:["width","height"]}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:["width","height"]})}_registerConverters(e){const t=this.editor,i=t.plugins.get("ImageUtils"),s=e==="imageBlock"?"figure":"img";t.conversion.for("upcast").attributeToAttribute({view:{name:s,styles:{width:/.+/}},model:{key:"width",value:r=>Qs(r)?Ys(r.getStyle("width")):null}}).attributeToAttribute({view:{name:s,key:"width"},model:"width"}).attributeToAttribute({view:{name:s,styles:{height:/.+/}},model:{key:"height",value:r=>Qs(r)?Ys(r.getStyle("height")):null}}).attributeToAttribute({view:{name:s,key:"height"},model:"height"}),t.conversion.for("editingDowncast").add(r=>{o(r,"width","width",!0),o(r,"height","height",!0)}),t.conversion.for("dataDowncast").add(r=>{o(r,"width","width",!1),o(r,"height","height",!1)});function o(r,a,l,c){r.on(`attribute:${a}:${e}`,(u,d,h)=>{if(!h.consumable.consume(d.item,u.name))return;const f=h.writer,m=h.mapper.toViewElement(d.item),p=i.findViewImgElement(m);if(d.attributeNewValue!==null?f.setAttribute(l,d.attributeNewValue,p):f.removeAttribute(l,p),d.item.hasAttribute("sources"))return;const _=d.item.hasAttribute("resizedWidth");if(e==="imageInline"&&!_&&!c)return;const C=d.item.getAttribute("width"),v=d.item.getAttribute("height");C&&v&&f.setStyle("aspect-ratio",`${C}/${v}`,p)})}}}/**
|
|
1071
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1072
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1073
|
+
*/class Ug extends R{constructor(e,t){super(e),this._modelElementName=t}refresh(){const t=this.editor.plugins.get("ImageUtils"),i=t.getClosestSelectedImageElement(this.editor.model.document.selection);this._modelElementName==="imageBlock"?this.isEnabled=t.isInlineImage(i):this.isEnabled=t.isBlockImage(i)}execute(e={}){const t=this.editor,i=this.editor.model,s=t.plugins.get("ImageUtils"),o=s.getClosestSelectedImageElement(i.document.selection),r=Object.fromEntries(o.getAttributes());return!r.src&&!r.uploadId?null:i.change(a=>{const{setImageSizes:l=!0}=e,c=Array.from(i.markers).filter(h=>h.getRange().containsItem(o)),u=s.insertImage(r,i.createSelection(o,"on"),this._modelElementName,{setImageSizes:l});if(!u)return null;const d=a.createRangeOn(u);for(const h of c){const f=h.getRange(),m=f.root.rootName!="$graveyard"?f.getJoined(d,!0):d;a.updateMarker(h,{range:m})}return{oldElement:o,newElement:u}})}}/**
|
|
1074
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1075
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1076
|
+
*/class Wg extends w{static get requires(){return[Te]}static get pluginName(){return"ImagePlaceholder"}afterInit(){this._setupSchema(),this._setupConversion(),this._setupLoadListener()}_setupSchema(){const e=this.editor.model.schema;e.isRegistered("imageBlock")&&e.extend("imageBlock",{allowAttributes:["placeholder"]}),e.isRegistered("imageInline")&&e.extend("imageInline",{allowAttributes:["placeholder"]})}_setupConversion(){const e=this.editor,t=e.conversion,i=e.plugins.get("ImageUtils");t.for("editingDowncast").add(s=>{s.on("attribute:placeholder",(o,r,a)=>{if(!a.consumable.test(r.item,o.name)||!r.item.is("element","imageBlock")&&!r.item.is("element","imageInline"))return;a.consumable.consume(r.item,o.name);const l=a.writer,c=a.mapper.toViewElement(r.item),u=i.findViewImgElement(c);r.attributeNewValue?(l.addClass("image_placeholder",u),l.setStyle("background-image",`url(${r.attributeNewValue})`,u),l.setCustomProperty("editingPipeline:doNotReuseOnce",!0,u)):(l.removeClass("image_placeholder",u),l.removeStyle("background-image",u))})})}_setupLoadListener(){const e=this.editor,t=e.model,i=e.editing,s=i.view,o=e.plugins.get("ImageUtils");s.addObserver(il),this.listenTo(s.document,"imageLoaded",(r,a)=>{const l=s.domConverter.mapDomToView(a.target);if(!l)return;const c=o.getImageWidgetFromImageView(l);if(!c)return;const u=i.mapper.toModelElement(c);!u||!u.hasAttribute("placeholder")||t.enqueueChange({isUndoable:!1},d=>{d.removeAttribute("placeholder",u)})})}}/**
|
|
1077
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1078
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1079
|
+
*/class qg extends w{static get requires(){return[zg,Hg,Te,Wg,rt]}static get pluginName(){return"ImageBlockEditing"}init(){const e=this.editor;e.model.schema.register("imageBlock",{inheritAllFrom:"$blockObject",allowAttributes:["alt","src","srcset"]}),this._setupConversion(),e.plugins.has("ImageInlineEditing")&&(e.commands.add("imageTypeBlock",new Ug(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,i=e.conversion,s=e.plugins.get("ImageUtils");i.for("dataDowncast").elementToStructure({model:"imageBlock",view:(o,{writer:r})=>Ku(r)}),i.for("editingDowncast").elementToStructure({model:"imageBlock",view:(o,{writer:r})=>s.toImageWidget(Ku(r),r,t("image widget"))}),i.for("downcast").add(Xs(s,"imageBlock","src")).add(Xs(s,"imageBlock","alt")).add($g(s,"imageBlock")),i.for("upcast").elementToElement({view:Mg(e,"imageBlock"),model:(o,{writer:r})=>r.createElement("imageBlock",o.hasAttribute("src")?{src:o.getAttribute("src")}:void 0)}).add(GI(s))}_setupClipboardIntegration(){const e=this.editor,t=e.model,i=e.editing.view,s=e.plugins.get("ImageUtils"),o=e.plugins.get("ClipboardPipeline");this.listenTo(o,"inputTransformation",(r,a)=>{const l=Array.from(a.content.getChildren());let c;if(!l.every(s.isInlineImageView))return;a.targetRanges?c=e.editing.mapper.toModelRange(a.targetRanges[0]):c=t.document.selection.getFirstRange();const u=t.createSelection(c);if(tl(t.schema,u)==="imageBlock"){const d=new Yi(i.document),h=l.map(f=>d.createElement("figure",{class:"image"},f));a.content=d.createDocumentFragment(h)}}),this.listenTo(o,"contentInsertion",(r,a)=>{a.method==="paste"&&t.change(l=>{const c=l.createRangeIn(a.content);for(const u of c.getItems())u.is("element","imageBlock")&&s.setImageNaturalSizeAttributes(u)})})}}/**
|
|
1080
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1081
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1082
|
+
*/class JI extends T{constructor(e,t=[]){super(e),this.focusTracker=new ne,this.keystrokes=new ae,this._focusables=new Ae,this.children=this.createCollection(),this._focusCycler=new ke({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});for(const i of t)this.children.add(i),this._focusables.add(i),i instanceof Wf&&this._focusables.addMany(i.children);if(this._focusables.length>1)for(const i of this._focusables)YI(i)&&(i.focusCycler.on("forwardCycle",s=>{this._focusCycler.focusNext(),s.stop()}),i.focusCycler.on("backwardCycle",s=>{this._focusCycler.focusPrevious(),s.stop()}));this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-insert-form"],tabindex:-1},children:this.children})}render(){super.render(),so({view:this});for(const t of this._focusables)this.focusTracker.add(t.element);this.keystrokes.listenTo(this.element);const e=t=>t.stopPropagation();this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}}function YI(n){return"focusCycler"in n}/**
|
|
1083
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1084
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1085
|
+
*/class jg extends w{static get pluginName(){return"ImageInsertUI"}static get requires(){return[Te]}constructor(e){super(e),this._integrations=new Map,e.config.define("image.insert.integrations",["upload","assetManager","url"])}init(){const e=this.editor,t=e.model.document.selection,i=e.plugins.get("ImageUtils");this.set("isImageSelected",!1),this.listenTo(e.model.document,"change",()=>{this.isImageSelected=i.isImage(t.getSelectedElement())});const s=o=>this._createToolbarComponent(o);e.ui.componentFactory.add("insertImage",s),e.ui.componentFactory.add("imageInsert",s)}registerIntegration({name:e,observable:t,buttonViewCreator:i,formViewCreator:s,requiresForm:o}){this._integrations.has(e)&&H("image-insert-integration-exists",{name:e}),this._integrations.set(e,{observable:t,buttonViewCreator:i,formViewCreator:s,requiresForm:!!o})}_createToolbarComponent(e){const t=this.editor,i=e.t,s=this._prepareIntegrations();if(!s.length)return null;let o;const r=s[0];if(s.length==1){if(!r.requiresForm)return r.buttonViewCreator(!0);o=r.buttonViewCreator(!0)}else{const c=r.buttonViewCreator(!1);o=new Qi(e,c),o.tooltip=!0,o.bind("label").to(this,"isImageSelected",u=>i(u?"Replace image":"Insert image"))}const a=this.dropdownView=fe(e,o),l=s.map(({observable:c})=>c);return a.bind("isEnabled").toMany(l,"isEnabled",(...c)=>c.some(u=>u)),a.once("change:isOpen",()=>{const c=s.map(({formViewCreator:d})=>d(s.length==1)),u=new JI(t.locale,c);a.panelView.children.add(u)}),a}_prepareIntegrations(){const t=this.editor.config.get("image.insert.integrations"),i=[];if(!t.length)return H("image-insert-integrations-not-specified"),i;for(const s of t){if(!this._integrations.has(s)){["upload","assetManager","url"].includes(s)||H("image-insert-unknown-integration",{item:s});continue}i.push(this._integrations.get(s))}return i.length||H("image-insert-integrations-not-registered"),i}}/**
|
|
1086
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1087
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1088
|
+
*/class QI extends w{static get requires(){return[qg,fi,Ng,jg]}static get pluginName(){return"ImageBlock"}}/**
|
|
1089
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1090
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1091
|
+
*/class XI extends w{static get requires(){return[zg,Hg,Te,Wg,rt]}static get pluginName(){return"ImageInlineEditing"}init(){const e=this.editor,t=e.model.schema;t.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"]}),t.addChildCheck((i,s)=>{if(i.endsWith("caption")&&s.name==="imageInline")return!1}),this._setupConversion(),e.plugins.has("ImageBlockEditing")&&(e.commands.add("imageTypeInline",new Ug(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,i=e.conversion,s=e.plugins.get("ImageUtils");i.for("dataDowncast").elementToElement({model:"imageInline",view:(o,{writer:r})=>r.createEmptyElement("img")}),i.for("editingDowncast").elementToStructure({model:"imageInline",view:(o,{writer:r})=>s.toImageWidget(FI(r),r,t("image widget"))}),i.for("downcast").add(Xs(s,"imageInline","src")).add(Xs(s,"imageInline","alt")).add($g(s,"imageInline")),i.for("upcast").elementToElement({view:Mg(e,"imageInline"),model:(o,{writer:r})=>r.createElement("imageInline",o.hasAttribute("src")?{src:o.getAttribute("src")}:void 0)})}_setupClipboardIntegration(){const e=this.editor,t=e.model,i=e.editing.view,s=e.plugins.get("ImageUtils"),o=e.plugins.get("ClipboardPipeline");this.listenTo(o,"inputTransformation",(r,a)=>{const l=Array.from(a.content.getChildren());let c;if(!l.every(s.isBlockImageView))return;a.targetRanges?c=e.editing.mapper.toModelRange(a.targetRanges[0]):c=t.document.selection.getFirstRange();const u=t.createSelection(c);if(tl(t.schema,u)==="imageInline"){const d=new Yi(i.document),h=l.map(f=>f.childCount===1?(Array.from(f.getAttributes()).forEach(m=>d.setAttribute(...m,s.findViewImgElement(f))),f.getChild(0)):f);a.content=d.createDocumentFragment(h)}}),this.listenTo(o,"contentInsertion",(r,a)=>{a.method==="paste"&&t.change(l=>{const c=l.createRangeIn(a.content);for(const u of c.getItems())u.is("element","imageInline")&&s.setImageNaturalSizeAttributes(u)})})}}/**
|
|
1092
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1093
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1094
|
+
*/class eP extends w{static get requires(){return[XI,fi,Ng,jg]}static get pluginName(){return"ImageInline"}}/**
|
|
1095
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1096
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1097
|
+
*/class tP extends w{static get requires(){return[QI,eP]}static get pluginName(){return"Image"}}/**
|
|
1098
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1099
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1100
|
+
*/class Gg extends w{static get pluginName(){return"ImageCaptionUtils"}static get requires(){return[Te]}getCaptionFromImageModelElement(e){for(const t of e.getChildren())if(t&&t.is("element","caption"))return t;return null}getCaptionFromModelSelection(e){const t=this.editor.plugins.get("ImageUtils"),i=e.getFirstPosition().findAncestor("caption");return i&&t.isBlockImage(i.parent)?i:null}matchImageCaptionViewElement(e){const t=this.editor.plugins.get("ImageUtils");return e.name=="figcaption"&&t.isBlockImageView(e.parent)?{name:!0}:null}}/**
|
|
1101
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1102
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1103
|
+
*/class iP extends R{refresh(){const e=this.editor,t=e.plugins.get("ImageCaptionUtils"),i=e.plugins.get("ImageUtils");if(!e.plugins.has(qg)){this.isEnabled=!1,this.value=!1;return}const s=e.model.document.selection,o=s.getSelectedElement();if(!o){const r=t.getCaptionFromModelSelection(s);this.isEnabled=!!r,this.value=!!r;return}this.isEnabled=i.isImage(o),this.isEnabled?this.value=!!t.getCaptionFromImageModelElement(o):this.value=!1}execute(e={}){const{focusCaptionOnShow:t}=e;this.editor.model.change(i=>{this.value?this._hideImageCaption(i):this._showImageCaption(i,t)})}_showImageCaption(e,t){const s=this.editor.model.document.selection,o=this.editor.plugins.get("ImageCaptionEditing"),r=this.editor.plugins.get("ImageUtils");let a=s.getSelectedElement();const l=o._getSavedCaption(a);r.isInlineImage(a)&&(this.editor.execute("imageTypeBlock"),a=s.getSelectedElement());const c=l||e.createElement("caption");e.append(c,a),t&&e.setSelection(c,"in")}_hideImageCaption(e){const t=this.editor,i=t.model.document.selection,s=t.plugins.get("ImageCaptionEditing"),o=t.plugins.get("ImageCaptionUtils");let r=i.getSelectedElement(),a;r?a=o.getCaptionFromImageModelElement(r):(a=o.getCaptionFromModelSelection(i),r=a.parent),s._saveCaption(r,a),e.setSelection(r,"on"),e.remove(a)}}/**
|
|
1104
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1105
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1106
|
+
*/class nP extends w{static get requires(){return[Te,Gg]}static get pluginName(){return"ImageCaptionEditing"}constructor(e){super(e),this._savedCaptionsMap=new WeakMap}init(){const e=this.editor,t=e.model.schema;t.isRegistered("caption")?t.extend("caption",{allowIn:"imageBlock"}):t.register("caption",{allowIn:"imageBlock",allowContentOf:"$block",isLimit:!0}),e.commands.add("toggleImageCaption",new iP(this.editor)),this._setupConversion(),this._setupImageTypeCommandsIntegration(),this._registerCaptionReconversion()}_setupConversion(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageUtils"),s=e.plugins.get("ImageCaptionUtils"),o=e.t;e.conversion.for("upcast").elementToElement({view:r=>s.matchImageCaptionViewElement(r),model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(r,{writer:a})=>i.isBlockImage(r.parent)?a.createContainerElement("figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(r,{writer:a})=>{if(!i.isBlockImage(r.parent))return null;const l=a.createEditableElement("figcaption");a.setCustomProperty("imageCaption",!0,l),l.placeholder=o("Enter image caption"),am({view:t,element:l,keepOnFocus:!0});const c=r.parent.getAttribute("alt"),u=c?o("Caption for image: %0",[c]):o("Caption for the image");return xg(l,a,{label:u})}})}_setupImageTypeCommandsIntegration(){const e=this.editor,t=e.plugins.get("ImageUtils"),i=e.plugins.get("ImageCaptionUtils"),s=e.commands.get("imageTypeInline"),o=e.commands.get("imageTypeBlock"),r=a=>{if(!a.return)return;const{oldElement:l,newElement:c}=a.return;/* istanbul ignore if: paranoid check -- @preserve */if(!l)return;if(t.isBlockImage(l)){const d=i.getCaptionFromImageModelElement(l);if(d){this._saveCaption(c,d);return}}const u=this._getSavedCaption(l);u&&this._saveCaption(c,u)};s&&this.listenTo(s,"execute",r,{priority:"low"}),o&&this.listenTo(o,"execute",r,{priority:"low"})}_getSavedCaption(e){const t=this._savedCaptionsMap.get(e);return t?W.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON())}_registerCaptionReconversion(){const e=this.editor,t=e.model,i=e.plugins.get("ImageUtils"),s=e.plugins.get("ImageCaptionUtils");t.document.on("change:data",()=>{const o=t.document.differ.getChanges();for(const r of o){if(r.attributeKey!=="alt")continue;const a=r.range.start.nodeAfter;if(i.isBlockImage(a)){const l=s.getCaptionFromImageModelElement(a);if(!l)return;e.editing.reconvertItem(l)}}})}}/**
|
|
1107
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1108
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1109
|
+
*/class sP extends w{static get requires(){return[Gg]}static get pluginName(){return"ImageCaptionUI"}init(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageCaptionUtils"),s=e.t;e.ui.componentFactory.add("toggleImageCaption",o=>{const r=e.commands.get("toggleImageCaption"),a=new B(o);return a.set({icon:I.caption,tooltip:!0,isToggleable:!0}),a.bind("isOn","isEnabled").to(r,"value","isEnabled"),a.bind("label").to(r,"value",l=>s(l?"Toggle caption off":"Toggle caption on")),this.listenTo(a,"execute",()=>{e.execute("toggleImageCaption",{focusCaptionOnShow:!0});const l=i.getCaptionFromModelSelection(e.model.document.selection);if(l){const c=e.editing.mapper.toViewElement(l);t.scrollToTheSelection(),t.change(u=>{u.addClass("image__caption_highlighted",c)})}e.editing.view.focus()}),a})}}/**
|
|
1110
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1111
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1112
|
+
*/class oP extends w{static get requires(){return[nP,sP]}static get pluginName(){return"ImageCaption"}}/**
|
|
1113
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1114
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1115
|
+
*/class rP extends U(){constructor(){super();const e=new window.FileReader;this._reader=e,this._data=void 0,this.set("loaded",0),e.onprogress=t=>{this.loaded=t.loaded}}get error(){return this._reader.error}get data(){return this._data}read(e){const t=this._reader;return this.total=e.size,new Promise((i,s)=>{t.onload=()=>{const o=t.result;this._data=o,i(o)},t.onerror=()=>{s("error")},t.onabort=()=>{s("aborted")},this._reader.readAsDataURL(e)})}abort(){this._reader.abort()}}/**
|
|
1116
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1117
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1118
|
+
*/class Yt extends w{constructor(){super(...arguments),this.loaders=new _e,this._loadersMap=new Map,this._pendingAction=null}static get pluginName(){return"FileRepository"}static get requires(){return[qs]}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 H("filerepository-no-upload-adapter"),null;const t=new Zu(Promise.resolve(e),this.createUploadAdapter);return this.loaders.add(t),this._loadersMap.set(e,t),e instanceof Promise&&t.file.then(i=>{this._loadersMap.set(i,t)}).catch(()=>{}),t.on("change:uploaded",()=>{let i=0;for(const s of this.loaders)i+=s.uploaded;this.uploaded=i}),t.on("change:uploadTotal",()=>{let i=0;for(const s of this.loaders)s.uploadTotal&&(i+=s.uploadTotal);this.uploadTotal=i}),t}destroyLoader(e){const t=e instanceof Zu?e:this.getLoader(e);t._destroy(),this.loaders.remove(t),this._loadersMap.forEach((i,s)=>{i===t&&this._loadersMap.delete(s)})}_updatePendingAction(){const e=this.editor.plugins.get(qs);if(this.loaders.length){if(!this._pendingAction){const t=this.editor.t,i=s=>`${t("Upload in progress")} ${parseInt(s)}%.`;this._pendingAction=e.add(i(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",i)}}else e.remove(this._pendingAction),this._pendingAction=null}}class Zu extends U(){constructor(e,t){super(),this.id=Ze(),this._filePromiseWrapper=this._createFilePromiseWrapper(e),this._adapter=t(this),this._reader=new rP,this.set("status","idle"),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(i,s)=>s?i/s*100:0),this.set("uploadResponse",null)}get file(){return this._filePromiseWrapper?this._filePromiseWrapper.promise.then(e=>this._filePromiseWrapper?e:null):Promise.resolve(null)}get data(){return this._reader.data}read(){if(this.status!="idle")throw new g("filerepository-read-wrong-status",this);return this.status="reading",this.file.then(e=>this._reader.read(e)).then(e=>{if(this.status!=="reading")throw this.status;return this.status="idle",e}).catch(e=>{throw e==="aborted"?(this.status="aborted","aborted"):(this.status="error",this._reader.error?this._reader.error:e)})}upload(){if(this.status!="idle")throw new g("filerepository-upload-wrong-status",this);return this.status="uploading",this.file.then(()=>this._adapter.upload()).then(e=>(this.uploadResponse=e,this.status="idle",e)).catch(e=>{throw this.status==="aborted"?"aborted":(this.status="error",e)})}abort(){const e=this.status;this.status="aborted",this._filePromiseWrapper.isFulfilled?e=="reading"?this._reader.abort():e=="uploading"&&this._adapter.abort&&this._adapter.abort():(this._filePromiseWrapper.promise.catch(()=>{}),this._filePromiseWrapper.rejecter("aborted")),this._destroy()}_destroy(){this._filePromiseWrapper=void 0,this._reader=void 0,this._adapter=void 0,this.uploadResponse=void 0}_createFilePromiseWrapper(e){const t={};return t.promise=new Promise((i,s)=>{t.rejecter=s,t.isFulfilled=!1,e.then(o=>{t.isFulfilled=!0,i(o)}).catch(o=>{t.isFulfilled=!0,s(o)})}),t}}/**
|
|
1119
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1120
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1121
|
+
*/class aP extends B{constructor(e){super(e),this.buttonView=this,this._fileInputView=new lP(e),this._fileInputView.bind("acceptedType").to(this),this._fileInputView.bind("allowMultipleFiles").to(this),this._fileInputView.delegate("done").to(this),this.on("execute",()=>{this._fileInputView.open()}),this.extendTemplate({attributes:{class:"ck-file-dialog-button"}})}render(){super.render(),this.children.add(this._fileInputView)}}class lP extends T{constructor(e){super(e),this.set("acceptedType",void 0),this.set("allowMultipleFiles",!1);const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:t.to("acceptedType"),multiple:t.to("allowMultipleFiles")},on:{change:t.to(()=>{this.element&&this.element.files&&this.element.files.length&&this.fire("done",this.element.files),this.element.value=""})}})}open(){this.element.click()}}/**
|
|
1122
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1123
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1124
|
+
*/function Kg(n){const e=n.map(t=>t.replace("+","\\+"));return new RegExp(`^image\\/(${e.join("|")})$`)}function cP(n){return new Promise((e,t)=>{const i=n.getAttribute("src");fetch(i).then(s=>s.blob()).then(s=>{const o=Zg(s,i),a=`image.${o.replace("image/","")}`,l=new File([s],a,{type:o});e(l)}).catch(s=>s&&s.name==="TypeError"?dP(i).then(e).catch(t):t(s))})}function uP(n,e){return!n.isInlineImageView(e)||!e.getAttribute("src")?!1:!!e.getAttribute("src").match(/^data:image\/\w+;base64,/g)||!!e.getAttribute("src").match(/^blob:/g)}function Zg(n,e){return n.type?n.type:e.match(/data:(image\/\w+);base64/)?e.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}function dP(n){return hP(n).then(e=>{const t=Zg(e,n),s=`image.${t.replace("image/","")}`;return new File([e],s,{type:t})})}function hP(n){return new Promise((e,t)=>{const i=E.document.createElement("img");i.addEventListener("load",()=>{const s=E.document.createElement("canvas");s.width=i.width,s.height=i.height,s.getContext("2d").drawImage(i,0,0),s.toBlob(r=>r?e(r):t())}),i.addEventListener("error",()=>t()),i.src=n})}/**
|
|
1125
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1126
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1127
|
+
*/class fP extends w{static get pluginName(){return"ImageUploadUI"}init(){const e=this.editor,t=e.t,i=s=>{const o=new aP(s),r=e.commands.get("uploadImage"),a=e.config.get("image.upload.types"),l=Kg(a);return o.set({acceptedType:a.map(c=>`image/${c}`).join(","),allowMultipleFiles:!0,label:t("Upload image from computer"),icon:I.imageUpload,tooltip:!0}),o.bind("isEnabled").to(r),o.on("done",(c,u)=>{const d=Array.from(u).filter(h=>l.test(h.type));d.length&&(e.execute("uploadImage",{file:d}),e.editing.view.focus())}),o};if(e.ui.componentFactory.add("uploadImage",i),e.ui.componentFactory.add("imageUpload",i),e.plugins.has("ImageInsertUI")){const s=e.plugins.get("ImageInsertUI"),o=e.commands.get("uploadImage");s.registerIntegration({name:"upload",observable:o,buttonViewCreator:()=>{const r=e.ui.componentFactory.create("uploadImage");return r.bind("label").to(s,"isImageSelected",a=>t(a?"Replace image from computer":"Upload image from computer")),r},formViewCreator:()=>{const r=e.ui.componentFactory.create("uploadImage");return r.withText=!0,r.bind("label").to(s,"isImageSelected",a=>t(a?"Replace from computer":"Upload from computer")),r.on("execute",()=>{s.dropdownView.isOpen=!1}),r}})}}}/**
|
|
1128
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1129
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1130
|
+
*/class mP extends w{static get pluginName(){return"ImageUploadProgress"}constructor(e){super(e),this.uploadStatusChange=(t,i,s)=>{const o=this.editor,r=i.item,a=r.getAttribute("uploadId");if(!s.consumable.consume(i.item,t.name))return;const l=o.plugins.get("ImageUtils"),c=o.plugins.get(Yt),u=a?i.attributeNewValue:null,d=this.placeholder,h=o.editing.mapper.toViewElement(r),f=s.writer;if(u=="reading"){Ju(h,f),Yu(l,d,h,f);return}if(u=="uploading"){const m=c.loaders.get(a);Ju(h,f),m?(Qu(h,f),pP(h,f,m,o.editing.view),yP(l,h,f,m)):Yu(l,d,h,f);return}u=="complete"&&c.loaders.get(a)&&bP(h,f,o.editing.view),wP(h,f),Qu(h,f),gP(h,f)},this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}init(){const e=this.editor;e.plugins.has("ImageBlockEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageBlock",this.uploadStatusChange),e.plugins.has("ImageInlineEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageInline",this.uploadStatusChange)}}function Ju(n,e){n.hasClass("ck-appear")||e.addClass("ck-appear",n)}function gP(n,e){e.removeClass("ck-appear",n)}function Yu(n,e,t,i){t.hasClass("ck-image-upload-placeholder")||i.addClass("ck-image-upload-placeholder",t);const s=n.findViewImgElement(t);s.getAttribute("src")!==e&&i.setAttribute("src",e,s),Jg(t,"placeholder")||i.insert(i.createPositionAfter(s),vP(i))}function Qu(n,e){n.hasClass("ck-image-upload-placeholder")&&e.removeClass("ck-image-upload-placeholder",n),Yg(n,e,"placeholder")}function pP(n,e,t,i){const s=_P(e);e.insert(e.createPositionAt(n,"end"),s),t.on("change:uploadedPercent",(o,r,a)=>{i.change(l=>{l.setStyle("width",a+"%",s)})})}function wP(n,e){Yg(n,e,"progressBar")}function bP(n,e,t){const i=e.createUIElement("div",{class:"ck-image-upload-complete-icon"});e.insert(e.createPositionAt(n,"end"),i),setTimeout(()=>{t.change(s=>s.remove(s.createRangeOn(i)))},3e3)}function _P(n){const e=n.createUIElement("div",{class:"ck-progress-bar"});return n.setCustomProperty("progressBar",!0,e),e}function vP(n){const e=n.createUIElement("div",{class:"ck-upload-placeholder-loader"});return n.setCustomProperty("placeholder",!0,e),e}function Jg(n,e){for(const t of n.getChildren())if(t.getCustomProperty(e))return t}function Yg(n,e,t){const i=Jg(n,t);i&&e.remove(e.createRangeOn(i))}function yP(n,e,t,i){if(i.data){const s=n.findViewImgElement(e);t.setAttribute("src",i.data,s)}}/**
|
|
1131
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1132
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1133
|
+
*/class CP extends R{refresh(){const e=this.editor,t=e.plugins.get("ImageUtils"),i=e.model.document.selection.getSelectedElement();this.isEnabled=t.isImageAllowed()||t.isImage(i)}execute(e){const t=K(e.file),i=this.editor.model.document.selection,s=this.editor.plugins.get("ImageUtils"),o=Object.fromEntries(i.getAttributes());t.forEach((r,a)=>{const l=i.getSelectedElement();if(a&&l&&s.isImage(l)){const c=this.editor.model.createPositionAfter(l);this._uploadImage(r,o,c)}else this._uploadImage(r,o)})}_uploadImage(e,t,i){const s=this.editor,r=s.plugins.get(Yt).createLoader(e),a=s.plugins.get("ImageUtils");r&&a.insertImage({...t,uploadId:r.id},i)}}/**
|
|
1134
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1135
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1136
|
+
*/class kP extends w{static get requires(){return[Yt,vu,rt,Te]}static get pluginName(){return"ImageUploadEditing"}constructor(e){super(e),e.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}init(){const e=this.editor,t=e.model.document,i=e.conversion,s=e.plugins.get(Yt),o=e.plugins.get("ImageUtils"),r=e.plugins.get("ClipboardPipeline"),a=Kg(e.config.get("image.upload.types")),l=new CP(e);e.commands.add("uploadImage",l),e.commands.add("imageUpload",l),i.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(e.editing.view.document,"clipboardInput",(c,u)=>{if(EP(u.dataTransfer))return;const d=Array.from(u.dataTransfer.files).filter(h=>h?a.test(h.type):!1);d.length&&(c.stop(),e.model.change(h=>{u.targetRanges&&h.setSelection(u.targetRanges.map(f=>e.editing.mapper.toModelRange(f))),e.execute("uploadImage",{file:d})}))}),this.listenTo(r,"inputTransformation",(c,u)=>{const d=Array.from(e.editing.view.createRangeIn(u.content)).map(f=>f.item).filter(f=>uP(o,f)&&!f.getAttribute("uploadProcessed")).map(f=>({promise:cP(f),imageElement:f}));if(!d.length)return;const h=new Yi(e.editing.view.document);for(const f of d){h.setAttribute("uploadProcessed",!0,f.imageElement);const m=s.createLoader(f.promise);m&&(h.setAttribute("src","",f.imageElement),h.setAttribute("uploadId",m.id,f.imageElement))}}),e.editing.view.document.on("dragover",(c,u)=>{u.preventDefault()}),t.on("change",()=>{const c=t.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),u=new Set;for(const d of c)if(d.type=="insert"&&d.name!="$text"){const h=d.position.nodeAfter,f=d.position.root.rootName=="$graveyard";for(const m of TP(e,h)){const p=m.getAttribute("uploadId");if(!p)continue;const _=s.loaders.get(p);_&&(f?u.has(p)||_.abort():(u.add(p),this._uploadImageElements.set(p,m),_.status=="idle"&&this._readAndUpload(_)))}}}),this.on("uploadComplete",(c,{imageElement:u,data:d})=>{const h=d.urls?d.urls:d;this.editor.model.change(f=>{f.setAttribute("src",h.default,u),this._parseAndSetSrcsetAttributeOnImage(h,u,f),o.setImageNaturalSizeAttributes(u)})},{priority:"low"})}afterInit(){const e=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&e.extend("imageBlock",{allowAttributes:["uploadId","uploadStatus"]}),this.editor.plugins.has("ImageInlineEditing")&&e.extend("imageInline",{allowAttributes:["uploadId","uploadStatus"]})}_readAndUpload(e){const t=this.editor,i=t.model,s=t.locale.t,o=t.plugins.get(Yt),r=t.plugins.get(vu),a=t.plugins.get("ImageUtils"),l=this._uploadImageElements;return i.enqueueChange({isUndoable:!1},u=>{u.setAttribute("uploadStatus","reading",l.get(e.id))}),e.read().then(()=>{const u=e.upload(),d=l.get(e.id);/* istanbul ignore next -- @preserve */if(L.isSafari){const h=t.editing.mapper.toViewElement(d),f=a.findViewImgElement(h);t.editing.view.once("render",()=>{if(!f.parent)return;const m=t.editing.view.domConverter.mapViewToDom(f.parent);if(!m)return;const p=m.style.display;m.style.display="none",m._ckHack=m.offsetHeight,m.style.display=p})}return i.enqueueChange({isUndoable:!1},h=>{h.setAttribute("uploadStatus","uploading",d)}),u}).then(u=>{i.enqueueChange({isUndoable:!1},d=>{const h=l.get(e.id);d.setAttribute("uploadStatus","complete",h),this.fire("uploadComplete",{data:u,imageElement:h})}),c()}).catch(u=>{if(e.status!=="error"&&e.status!=="aborted")throw u;e.status=="error"&&u&&r.showWarning(u,{title:s("Upload failed"),namespace:"upload"}),i.enqueueChange({isUndoable:!1},d=>{d.remove(l.get(e.id))}),c()});function c(){i.enqueueChange({isUndoable:!1},u=>{const d=l.get(e.id);u.removeAttribute("uploadId",d),u.removeAttribute("uploadStatus",d),l.delete(e.id)}),o.destroyLoader(e)}}_parseAndSetSrcsetAttributeOnImage(e,t,i){let s=0;const o=Object.keys(e).filter(r=>{const a=parseInt(r,10);if(!isNaN(a))return s=Math.max(s,a),!0}).map(r=>`${e[r]} ${r}w`).join(", ");if(o!=""){const r={srcset:o};!t.hasAttribute("width")&&!t.hasAttribute("height")&&(r.width=s),i.setAttributes(r,t)}}}function EP(n){return Array.from(n.types).includes("text/html")&&n.getData("text/html")!==""}function TP(n,e){const t=n.plugins.get("ImageUtils");return Array.from(n.model.createRangeOn(e)).filter(i=>t.isImage(i.item)).map(i=>i.item)}/**
|
|
1137
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1138
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1139
|
+
*/class AP extends w{static get pluginName(){return"ImageUpload"}static get requires(){return[kP,fP,mP]}}/**
|
|
1140
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1141
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1142
|
+
*/class SP extends R{refresh(){const e=this.editor,i=e.plugins.get("ImageUtils").getClosestSelectedImageElement(e.model.document.selection);this.isEnabled=!!i,!i||!i.hasAttribute("resizedWidth")?this.value=null:this.value={width:i.getAttribute("resizedWidth"),height:null}}execute(e){const t=this.editor,i=t.model,s=t.plugins.get("ImageUtils"),o=s.getClosestSelectedImageElement(i.document.selection);this.value={width:e.width,height:null},o&&i.change(r=>{r.setAttribute("resizedWidth",e.width,o),r.removeAttribute("resizedHeight",o),s.setImageNaturalSizeAttributes(o)})}}/**
|
|
1143
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1144
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1145
|
+
*/class Qg extends w{static get requires(){return[Te]}static get pluginName(){return"ImageResizeEditing"}constructor(e){super(e),e.config.define("image",{resizeUnit:"%",resizeOptions:[{name:"resizeImage:original",value:null,icon:"original"},{name:"resizeImage:25",value:"25",icon:"small"},{name:"resizeImage:50",value:"50",icon:"medium"},{name:"resizeImage:75",value:"75",icon:"large"}]})}init(){const e=this.editor,t=new SP(e);this._registerSchema(),this._registerConverters("imageBlock"),this._registerConverters("imageInline"),e.commands.add("resizeImage",t),e.commands.add("imageResize",t)}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:["resizedWidth","resizedHeight"]}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:["resizedWidth","resizedHeight"]})}_registerConverters(e){const t=this.editor,i=t.plugins.get("ImageUtils");t.conversion.for("downcast").add(s=>s.on(`attribute:resizedWidth:${e}`,(o,r,a)=>{if(!a.consumable.consume(r.item,o.name))return;const l=a.writer,c=a.mapper.toViewElement(r.item);r.attributeNewValue!==null?(l.setStyle("width",r.attributeNewValue,c),l.addClass("image_resized",c)):(l.removeStyle("width",c),l.removeClass("image_resized",c))})),t.conversion.for("dataDowncast").attributeToAttribute({model:{name:e,key:"resizedHeight"},view:s=>({key:"style",value:{height:s}})}),t.conversion.for("editingDowncast").add(s=>s.on(`attribute:resizedHeight:${e}`,(o,r,a)=>{if(!a.consumable.consume(r.item,o.name))return;const l=a.writer,c=a.mapper.toViewElement(r.item),u=e==="imageInline"?i.findViewImgElement(c):c;r.attributeNewValue!==null?l.setStyle("height",r.attributeNewValue,u):l.removeStyle("height",u)})),t.conversion.for("upcast").attributeToAttribute({view:{name:e==="imageBlock"?"figure":"img",styles:{width:/.+/}},model:{key:"resizedWidth",value:s=>Qs(s)?null:s.getStyle("width")}}),t.conversion.for("upcast").attributeToAttribute({view:{name:e==="imageBlock"?"figure":"img",styles:{height:/.+/}},model:{key:"resizedHeight",value:s=>Qs(s)?null:s.getStyle("height")}})}}/**
|
|
1146
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1147
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1148
|
+
*/const Xo={small:I.objectSizeSmall,medium:I.objectSizeMedium,large:I.objectSizeLarge,original:I.objectSizeFull};class xP extends w{static get requires(){return[Qg]}static get pluginName(){return"ImageResizeButtons"}constructor(e){super(e),this._resizeUnit=e.config.get("image.resizeUnit")}init(){const e=this.editor,t=e.config.get("image.resizeOptions"),i=e.commands.get("resizeImage");this.bind("isEnabled").to(i);for(const s of t)this._registerImageResizeButton(s);this._registerImageResizeDropdown(t)}_registerImageResizeButton(e){const t=this.editor,{name:i,value:s,icon:o}=e,r=s?s+this._resizeUnit:null;t.ui.componentFactory.add(i,a=>{const l=new B(a),c=t.commands.get("resizeImage"),u=this._getOptionLabelValue(e,!0);if(!Xo[o])throw new g("imageresizebuttons-missing-icon",t,e);return l.set({label:u,icon:Xo[o],tooltip:u,isToggleable:!0}),l.bind("isEnabled").to(this),l.bind("isOn").to(c,"value",Xu(r)),this.listenTo(l,"execute",()=>{t.execute("resizeImage",{width:r})}),l})}_registerImageResizeDropdown(e){const t=this.editor,i=t.t,s=e.find(r=>!r.value),o=r=>{const a=t.commands.get("resizeImage"),l=fe(r,tm),c=l.buttonView,u=i("Resize image");return c.set({tooltip:u,commandValue:s.value,icon:Xo.medium,isToggleable:!0,label:this._getOptionLabelValue(s),withText:!0,class:"ck-resize-image-button",ariaLabel:u,ariaLabelledBy:void 0}),c.bind("label").to(a,"value",d=>d&&d.width?d.width:this._getOptionLabelValue(s)),l.bind("isEnabled").to(this),di(l,()=>this._getResizeDropdownListItemDefinitions(e,a),{ariaLabel:i("Image resize list"),role:"menu"}),this.listenTo(l,"execute",d=>{t.execute(d.source.commandName,{width:d.source.commandValue}),t.editing.view.focus()}),l};t.ui.componentFactory.add("resizeImage",o),t.ui.componentFactory.add("imageResize",o)}_getOptionLabelValue(e,t=!1){const i=this.editor.t;return e.label?e.label:t?e.value?i("Resize image to %0",e.value+this._resizeUnit):i("Resize image to the original size"):e.value?e.value+this._resizeUnit:i("Original")}_getResizeDropdownListItemDefinitions(e,t){const i=new _e;return e.map(s=>{const o=s.value?s.value+this._resizeUnit:null,r={type:"button",model:new hi({commandName:"resizeImage",commandValue:o,label:this._getOptionLabelValue(s),role:"menuitemradio",withText:!0,icon:null})};r.model.bind("isOn").to(t,"value",Xu(o)),i.add(r)}),i}}function Xu(n){return e=>{const t=e;return n===null&&t===n?!0:t!==null&&t.width===n}}/**
|
|
1149
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1150
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1151
|
+
*/const IP="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",er="image_resized";class PP extends w{static get requires(){return[Yo,Te]}static get pluginName(){return"ImageResizeHandles"}init(){const e=this.editor.commands.get("resizeImage");this.bind("isEnabled").to(e),this._setupResizerCreator()}_setupResizerCreator(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageUtils");t.addObserver(il),this.listenTo(t.document,"imageLoaded",(s,o)=>{if(!o.target.matches(IP))return;const r=e.editing.view.domConverter,a=r.domToView(o.target),l=i.getImageWidgetFromImageView(a);let c=this.editor.plugins.get(Yo).getResizerByViewElement(l);if(c){c.redraw();return}const u=e.editing.mapper,d=u.toModelElement(l);c=e.plugins.get(Yo).attachTo({unit:e.config.get("image.resizeUnit"),modelElement:d,viewElement:l,editor:e,getHandleHost(h){return h.querySelector("img")},getResizeHost(){return r.mapViewToDom(u.toViewElement(d.parent))},isCentered(){const h=d.getAttribute("imageStyle");return!h||h=="block"||h=="alignCenter"},onCommit(h){t.change(f=>{f.removeClass(er,l)}),e.execute("resizeImage",{width:h})}}),c.on("updateSize",()=>{l.hasClass(er)||t.change(f=>{f.addClass(er,l)});const h=d.name==="imageInline"?a:l;h.getStyle("height")&&t.change(f=>{f.removeStyle("height",h)})}),c.bind("isEnabled").to(this)})}}/**
|
|
1152
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1153
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1154
|
+
*/class RP extends w{static get requires(){return[Qg,PP,xP]}static get pluginName(){return"ImageResize"}}/**
|
|
1155
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1156
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1157
|
+
*/class VP extends R{constructor(e,t){super(e),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(t.map(i=>{if(i.isDefault)for(const s of i.modelElements)this._defaultStyles[s]=i.name;return[i.name,i]}))}refresh(){const i=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!i,this.isEnabled?i.hasAttribute("imageStyle")?this.value=i.getAttribute("imageStyle"):this.value=this._defaultStyles[i.name]:this.value=!1}execute(e={}){const t=this.editor,i=t.model,s=t.plugins.get("ImageUtils");i.change(o=>{const r=e.value,{setImageSizes:a=!0}=e;let l=s.getClosestSelectedImageElement(i.document.selection);r&&this.shouldConvertImageType(r,l)&&(this.editor.execute(s.isBlockImage(l)?"imageTypeInline":"imageTypeBlock",{setImageSizes:a}),l=s.getClosestSelectedImageElement(i.document.selection)),!r||this._styles.get(r).isDefault?o.removeAttribute("imageStyle",l):o.setAttribute("imageStyle",r,l),a&&s.setImageNaturalSizeAttributes(l)})}shouldConvertImageType(e,t){return!this._styles.get(e).modelElements.includes(t.name)}}/**
|
|
1158
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1159
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1160
|
+
*/const{objectFullWidth:LP,objectInline:Xg,objectLeft:ep,objectRight:Gr,objectCenter:Kr,objectBlockLeft:tp,objectBlockRight:ip}=I,Ps={get inline(){return{name:"inline",title:"In line",icon:Xg,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:ep,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:tp,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:Kr,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:Gr,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:ip,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:Kr,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:Gr,modelElements:["imageBlock"],className:"image-style-side"}}},np={full:LP,left:tp,right:ip,center:Kr,inlineLeft:ep,inlineRight:Gr,inline:Xg},sp=[{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 BP(n){return(n.configuredStyles.options||[]).map(i=>FP(i)).filter(i=>DP(i,n))}function OP(n,e){return n&&e?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:n?{options:["block","side"]}:e?{options:["inline","alignLeft","alignRight"]}:{}}function MP(n){return n.has("ImageBlockEditing")&&n.has("ImageInlineEditing")?[...sp]:[]}function FP(n){return typeof n=="string"?Ps[n]?n={...Ps[n]}:n={name:n}:n=NP(Ps[n.name],n),typeof n.icon=="string"&&(n.icon=np[n.icon]||n.icon),n}function DP(n,{isBlockPluginLoaded:e,isInlinePluginLoaded:t}){const{modelElements:i,name:s}=n;if(!i||!i.length||!s)return op({style:n}),!1;{const o=[e?"imageBlock":null,t?"imageInline":null];if(!i.some(r=>o.includes(r)))return H("image-style-missing-dependency",{style:n,missingPlugins:i.map(r=>r==="imageBlock"?"ImageBlockEditing":"ImageInlineEditing")}),!1}return!0}function NP(n,e){const t={...e};for(const i in n)Object.prototype.hasOwnProperty.call(e,i)||(t[i]=n[i]);return t}function op(n){H("image-style-configuration-definition-invalid",n)}const Zr={normalizeStyles:BP,getDefaultStylesConfiguration:OP,getDefaultDropdownDefinitions:MP,warnInvalidStyle:op,DEFAULT_OPTIONS:Ps,DEFAULT_ICONS:np,DEFAULT_DROPDOWN_DEFINITIONS:sp};/**
|
|
1161
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1162
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1163
|
+
*/function $P(n){return(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const s=ed(t.attributeNewValue,n),o=ed(t.attributeOldValue,n),r=i.mapper.toViewElement(t.item),a=i.writer;o&&a.removeClass(o.className,r),s&&a.addClass(s.className,r)}}function zP(n){const e={imageInline:n.filter(t=>!t.isDefault&&t.modelElements.includes("imageInline")),imageBlock:n.filter(t=>!t.isDefault&&t.modelElements.includes("imageBlock"))};return(t,i,s)=>{if(!i.modelRange)return;const o=i.viewItem,r=J(i.modelRange.getItems());if(r&&s.schema.checkAttribute(r,"imageStyle"))for(const a of e[r.name])s.consumable.consume(o,{classes:a.className})&&s.writer.setAttribute("imageStyle",a.name,r)}}function ed(n,e){for(const t of e)if(t.name===n)return t}/**
|
|
1164
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1165
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1166
|
+
*/class rp extends w{static get pluginName(){return"ImageStyleEditing"}static get requires(){return[Te]}init(){const{normalizeStyles:e,getDefaultStylesConfiguration:t}=Zr,i=this.editor,s=i.plugins.has("ImageBlockEditing"),o=i.plugins.has("ImageInlineEditing");i.config.define("image.styles",t(s,o)),this.normalizedStyles=e({configuredStyles:i.config.get("image.styles"),isBlockPluginLoaded:s,isInlinePluginLoaded:o}),this._setupConversion(s,o),this._setupPostFixer(),i.commands.add("imageStyle",new VP(i,this.normalizedStyles))}_setupConversion(e,t){const i=this.editor,s=i.model.schema,o=$P(this.normalizedStyles),r=zP(this.normalizedStyles);i.editing.downcastDispatcher.on("attribute:imageStyle",o),i.data.downcastDispatcher.on("attribute:imageStyle",o),e&&(s.extend("imageBlock",{allowAttributes:"imageStyle"}),i.data.upcastDispatcher.on("element:figure",r,{priority:"low"})),t&&(s.extend("imageInline",{allowAttributes:"imageStyle"}),i.data.upcastDispatcher.on("element:img",r,{priority:"low"}))}_setupPostFixer(){const e=this.editor,t=e.model.document,i=e.plugins.get(Te),s=new Map(this.normalizedStyles.map(o=>[o.name,o]));t.registerPostFixer(o=>{let r=!1;for(const a of t.differ.getChanges())if(a.type=="insert"||a.type=="attribute"&&a.attributeKey=="imageStyle"){let l=a.type=="insert"?a.position.nodeAfter:a.range.start.nodeAfter;if(l&&l.is("element","paragraph")&&l.childCount>0&&(l=l.getChild(0)),!i.isImage(l))continue;const c=l.getAttribute("imageStyle");if(!c)continue;const u=s.get(c);(!u||!u.modelElements.includes(l.name))&&(o.removeAttribute("imageStyle",l),r=!0)}return r})}}/**
|
|
1167
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1168
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1169
|
+
*/class HP extends w{static get requires(){return[rp]}static get pluginName(){return"ImageStyleUI"}get localizedDefaultStylesTitles(){const e=this.editor.t;return{"Wrap text":e("Wrap text"),"Break text":e("Break text"),"In line":e("In line"),"Full size image":e("Full size image"),"Side image":e("Side image"),"Left aligned image":e("Left aligned image"),"Centered image":e("Centered image"),"Right aligned image":e("Right aligned image")}}init(){const e=this.editor.plugins,t=this.editor.config.get("image.toolbar")||[],i=e.get("ImageStyleEditing"),s=td(i.normalizedStyles,this.localizedDefaultStylesTitles);for(const r of s)this._createButton(r);const o=td([...t.filter(ie),...Zr.getDefaultDropdownDefinitions(e)],this.localizedDefaultStylesTitles);for(const r of o)this._createDropdown(r,s)}_createDropdown(e,t){const i=this.editor.ui.componentFactory;i.add(e.name,s=>{let o;const{defaultItem:r,items:a,title:l}=e,c=a.filter(f=>t.find(({name:m})=>id(m)===f)).map(f=>{const m=i.create(f);return f===r&&(o=m),m});a.length!==c.length&&Zr.warnInvalidStyle({dropdown:e});const u=fe(s,Qi),d=u.buttonView,h=d.arrowView;return po(u,c,{enableActiveItemFocusOnDropdownOpen:!0}),d.set({label:nd(l,o.label),class:null,tooltip:!0}),h.unbind("label"),h.set({label:l}),d.bind("icon").toMany(c,"isOn",(...f)=>{const m=f.findIndex(Wt);return m<0?o.icon:c[m].icon}),d.bind("label").toMany(c,"isOn",(...f)=>{const m=f.findIndex(Wt);return nd(l,m<0?o.label:c[m].label)}),d.bind("isOn").toMany(c,"isOn",(...f)=>f.some(Wt)),d.bind("class").toMany(c,"isOn",(...f)=>f.some(Wt)?"ck-splitbutton_flatten":void 0),d.on("execute",()=>{c.some(({isOn:f})=>f)?u.isOpen=!u.isOpen:o.fire("execute")}),u.bind("isEnabled").toMany(c,"isEnabled",(...f)=>f.some(Wt)),this.listenTo(u,"execute",()=>{this.editor.editing.view.focus()}),u})}_createButton(e){const t=e.name;this.editor.ui.componentFactory.add(id(t),i=>{const s=this.editor.commands.get("imageStyle"),o=new B(i);return o.set({label:e.title,icon:e.icon,tooltip:!0,isToggleable:!0}),o.bind("isEnabled").to(s,"isEnabled"),o.bind("isOn").to(s,"value",r=>r===t),o.on("execute",this._executeCommand.bind(this,t)),o})}_executeCommand(e){this.editor.execute("imageStyle",{value:e}),this.editor.editing.view.focus()}}function td(n,e){for(const t of n)e[t.title]&&(t.title=e[t.title]);return n}function id(n){return`imageStyle:${n}`}function nd(n,e){return(n?n+": ":"")+e}/**
|
|
1170
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1171
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1172
|
+
*/class UP extends w{static get requires(){return[rp,HP]}static get pluginName(){return"ImageStyle"}}/**
|
|
1173
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1174
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1175
|
+
*/class WP extends w{static get requires(){return[Js,Te]}static get pluginName(){return"ImageToolbar"}afterInit(){const e=this.editor,t=e.t,i=e.plugins.get(Js),s=e.plugins.get("ImageUtils");i.register("image",{ariaLabel:t("Image toolbar"),items:qP(e.config.get("image.toolbar")||[]),getRelatedElement:o=>s.getClosestSelectedImageWidget(o)})}}function qP(n){return n.map(e=>ie(e)?e.name:e)}/**
|
|
1176
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1177
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1178
|
+
*/class jP extends w{static get pluginName(){return"IndentEditing"}init(){const e=this.editor;e.commands.add("indent",new kc(e)),e.commands.add("outdent",new kc(e))}}/**
|
|
1179
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1180
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1181
|
+
*/class GP extends w{static get pluginName(){return"IndentUI"}init(){const e=this.editor,t=e.locale,i=e.t,s=t.uiLanguageDirection=="ltr"?I.indent:I.outdent,o=t.uiLanguageDirection=="ltr"?I.outdent:I.indent;this._defineButton("indent",i("Increase indent"),s),this._defineButton("outdent",i("Decrease indent"),o)}_defineButton(e,t,i){const s=this.editor;s.ui.componentFactory.add(e,o=>{const r=s.commands.get(e),a=new B(o);return a.set({label:t,icon:i,tooltip:!0}),a.bind("isEnabled").to(r,"isEnabled"),this.listenTo(a,"execute",()=>{s.execute(e),s.editing.view.focus()}),a})}}/**
|
|
1182
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1183
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1184
|
+
*/class KP extends w{static get pluginName(){return"Indent"}static get requires(){return[jP,GP]}}/**
|
|
1185
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1186
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1187
|
+
*/class ys extends R{constructor(e,t){super(e),this._indentBehavior=t}refresh(){const t=this.editor.model,i=J(t.document.selection.getSelectedBlocks());if(!i||!this._isIndentationChangeAllowed(i)){this.isEnabled=!1;return}this.isEnabled=this._indentBehavior.checkEnabled(i.getAttribute("blockIndent"))}execute(){const e=this.editor.model,t=this._getBlocksToChange();e.change(i=>{for(const s of t){const o=s.getAttribute("blockIndent"),r=this._indentBehavior.getNextIndent(o);r?i.setAttribute("blockIndent",r,s):i.removeAttribute("blockIndent",s)}})}_getBlocksToChange(){const t=this.editor.model.document.selection;return Array.from(t.getSelectedBlocks()).filter(s=>this._isIndentationChangeAllowed(s))}_isIndentationChangeAllowed(e){const t=this.editor;return t.model.schema.checkAttribute(e,"blockIndent")?!t.plugins.has("ListUtils")||!this._indentBehavior.isForward?!0:!t.plugins.get("ListUtils").isListItemBlock(e):!1}}/**
|
|
1188
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1189
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1190
|
+
*/class sd{constructor(e){this.isForward=e.direction==="forward",this.offset=e.offset,this.unit=e.unit}checkEnabled(e){const t=parseFloat(e||"0");return this.isForward||t>0}getNextIndent(e){const t=parseFloat(e||"0");if(!(!e||e.endsWith(this.unit)))return this.isForward?this.offset+this.unit:void 0;const s=this.isForward?this.offset:-this.offset,o=t+s;return o>0?o+this.unit:void 0}}/**
|
|
1191
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1192
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1193
|
+
*/class od{constructor(e){this.isForward=e.direction==="forward",this.classes=e.classes}checkEnabled(e){const t=this.classes.indexOf(e);return this.isForward?t<this.classes.length-1:t>=0}getNextIndent(e){const t=this.classes.indexOf(e),i=this.isForward?1:-1;return this.classes[t+i]}}/**
|
|
1194
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1195
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1196
|
+
*/const ZP=["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"];class JP extends w{constructor(e){super(e),e.config.define("indentBlock",{offset:40,unit:"px"})}static get pluginName(){return"IndentBlock"}init(){const e=this.editor,t=e.config.get("indentBlock");t.classes&&t.classes.length?(this._setupConversionUsingClasses(t.classes),e.commands.add("indentBlock",new ys(e,new od({direction:"forward",classes:t.classes}))),e.commands.add("outdentBlock",new ys(e,new od({direction:"backward",classes:t.classes})))):(e.data.addStyleProcessorRules(NT),this._setupConversionUsingOffset(),e.commands.add("indentBlock",new ys(e,new sd({direction:"forward",offset:t.offset,unit:t.unit}))),e.commands.add("outdentBlock",new ys(e,new sd({direction:"backward",offset:t.offset,unit:t.unit}))))}afterInit(){const e=this.editor,t=e.model.schema,i=e.commands.get("indent"),s=e.commands.get("outdent"),o=e.config.get("heading.options");(o&&o.map(l=>l.model)||ZP).forEach(l=>{t.isRegistered(l)&&t.extend(l,{allowAttributes:"blockIndent"})}),t.setAttributeProperties("blockIndent",{isFormatting:!0}),i.registerChildCommand(e.commands.get("indentBlock")),s.registerChildCommand(e.commands.get("outdentBlock"))}_setupConversionUsingOffset(){const e=this.editor.conversion,i=this.editor.locale.contentLanguageDirection==="rtl"?"margin-right":"margin-left";e.for("upcast").attributeToAttribute({view:{styles:{[i]:/[\s\S]+/}},model:{key:"blockIndent",value:s=>{if(!s.is("element","li"))return s.getStyle(i)}}}),e.for("downcast").attributeToAttribute({model:"blockIndent",view:s=>({key:"style",value:{[i]:s}})})}_setupConversionUsingClasses(e){const t={model:{key:"blockIndent",values:[]},view:{}};for(const i of e)t.model.values.push(i),t.view[i]={key:"class",value:[i]};this.editor.conversion.attributeToAttribute(t)}}/**
|
|
1197
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1198
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1199
|
+
*/class YP{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(e){Array.isArray(e)?e.forEach(t=>this._definitions.add(t)):this._definitions.add(e)}getDispatcher(){return e=>{e.on("attribute:linkHref",(t,i,s)=>{if(!s.consumable.test(i.item,"attribute:linkHref")||!(i.item.is("selection")||s.schema.isInline(i.item)))return;const o=s.writer,r=o.document.selection;for(const a of this._definitions){const l=o.createAttributeElement("a",a.attributes,{priority:5});a.classes&&o.addClass(a.classes,l);for(const c in a.styles)o.setStyle(c,a.styles[c],l);o.setCustomProperty("link",!0,l),a.callback(i.attributeNewValue)?i.item.is("selection")?o.wrap(r.getFirstRange(),l):o.wrap(s.mapper.toViewRange(i.range),l):o.unwrap(s.mapper.toViewRange(i.range),l)}},{priority:"high"})}}getDispatcherForLinkedImage(){return e=>{e.on("attribute:linkHref:imageBlock",(t,i,{writer:s,mapper:o})=>{const r=o.toViewElement(i.item),a=Array.from(r.getChildren()).find(l=>l.is("element","a"));for(const l of this._definitions){const c=vt(l.attributes);if(l.callback(i.attributeNewValue)){for(const[u,d]of c)u==="class"?s.addClass(d,a):s.setAttribute(u,d,a);l.classes&&s.addClass(l.classes,a);for(const u in l.styles)s.setStyle(u,l.styles[u],a)}else{for(const[u,d]of c)u==="class"?s.removeClass(d,a):s.removeAttribute(u,a);l.classes&&s.removeClass(l.classes,a);for(const u in l.styles)s.removeStyle(u,a)}}})}}}/**
|
|
1200
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1201
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1202
|
+
*/const QP=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,XP=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i,e4=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,t4=/^((\w+:(\/{2,})?)|(\W))/i,tr="Ctrl+K";function i4(n){return n.is("attributeElement")&&!!n.getCustomProperty("link")}function rd(n,{writer:e}){const t=e.createAttributeElement("a",{href:n},{priority:5});return e.setCustomProperty("link",!0,t),t}function ap(n){const e=String(n);return n4(e)?e:"#"}function n4(n){return!!n.replace(QP,"").match(XP)}function s4(n,e){const t={"Open in a new tab":n("Open in a new tab"),Downloadable:n("Downloadable")};return e.forEach(i=>("label"in i&&t[i.label]&&(i.label=t[i.label]),i)),e}function o4(n){const e=[];if(n)for(const[t,i]of Object.entries(n)){const s=Object.assign({},i,{id:`link${Gh(t)}`});e.push(s)}return e}function Jr(n,e){return n?e.checkAttribute(n.name,"linkHref"):!1}function r4(n){return e4.test(n)}function nl(n,e){const t=r4(n)?"mailto:":e,i=!!t&&!lp(n);return n&&i?t+n:n}function lp(n){return t4.test(n)}function ad(n){window.open(n,"_blank","noopener")}/**
|
|
1203
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1204
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1205
|
+
*/class a4 extends R{constructor(){super(...arguments),this.manualDecorators=new _e,this.automaticDecorators=new YP}restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement()||J(t.getSelectedBlocks());Jr(i,e.schema)?(this.value=i.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(i,"linkHref")):(this.value=t.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref"));for(const s of this.manualDecorators)s.value=this._getDecoratorStateFromModel(s.id)}execute(e,t={}){const i=this.editor.model,s=i.document.selection,o=[],r=[];for(const a in t)t[a]?o.push(a):r.push(a);i.change(a=>{if(s.isCollapsed){const l=s.getFirstPosition();if(s.hasAttribute("linkHref")){const c=ld(s);let u=Xn(l,"linkHref",s.getAttribute("linkHref"),i);s.getAttribute("linkHref")===c&&(u=this._updateLinkContent(i,a,u,e)),a.setAttribute("linkHref",e,u),o.forEach(d=>{a.setAttribute(d,!0,u)}),r.forEach(d=>{a.removeAttribute(d,u)}),a.setSelection(a.createPositionAfter(u.end.nodeBefore))}else if(e!==""){const c=vt(s.getAttributes());c.set("linkHref",e),o.forEach(d=>{c.set(d,!0)});const{end:u}=i.insertContent(a.createText(e,c),l);a.setSelection(u)}["linkHref",...o,...r].forEach(c=>{a.removeSelectionAttribute(c)})}else{const l=i.schema.getValidRanges(s.getRanges(),"linkHref"),c=[];for(const d of s.getSelectedBlocks())i.schema.checkAttribute(d,"linkHref")&&c.push(a.createRangeOn(d));const u=c.slice();for(const d of l)this._isRangeToUpdate(d,c)&&u.push(d);for(const d of u){let h=d;if(u.length===1){const f=ld(s);s.getAttribute("linkHref")===f&&(h=this._updateLinkContent(i,a,d,e),a.setSelection(a.createSelection(h)))}a.setAttribute("linkHref",e,h),o.forEach(f=>{a.setAttribute(f,!0,h)}),r.forEach(f=>{a.removeAttribute(f,h)})}}})}_getDecoratorStateFromModel(e){const t=this.editor.model,i=t.document.selection,s=i.getSelectedElement();return Jr(s,t.schema)?s.getAttribute(e):i.getAttribute(e)}_isRangeToUpdate(e,t){for(const i of t)if(i.containsRange(e))return!1;return!0}_updateLinkContent(e,t,i,s){const o=t.createText(s,{linkHref:s});return e.insertContent(o,i)}}function ld(n){if(n.isCollapsed){const e=n.getFirstPosition();return e.textNode&&e.textNode.data}else{const e=Array.from(n.getFirstRange().getItems());if(e.length>1)return null;const t=e[0];return t.is("$text")||t.is("$textProxy")?t.data:null}}/**
|
|
1206
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1207
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1208
|
+
*/class l4 extends R{refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement();Jr(i,e.schema)?this.isEnabled=e.schema.checkAttribute(i,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref")}execute(){const e=this.editor,t=this.editor.model,i=t.document.selection,s=e.commands.get("link");t.change(o=>{const r=i.isCollapsed?[Xn(i.getFirstPosition(),"linkHref",i.getAttribute("linkHref"),t)]:t.schema.getValidRanges(i.getRanges(),"linkHref");for(const a of r)if(o.removeAttribute("linkHref",a),s)for(const l of s.manualDecorators)o.removeAttribute(l.id,a)})}}/**
|
|
1209
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1210
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1211
|
+
*/class c4 extends U(){constructor({id:e,label:t,attributes:i,classes:s,styles:o,defaultValue:r}){super(),this.id=e,this.set("value",void 0),this.defaultValue=r,this.label=t,this.attributes=i,this.classes=s,this.styles=o}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}/**
|
|
1212
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1213
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1214
|
+
*/const u4="ck-link_selected",cd="automatic",d4="manual",h4=/^(https?:)?\/\//;class cp extends w{static get pluginName(){return"LinkEditing"}static get requires(){return[Ks,bg,rt]}constructor(e){super(e),e.config.define("link",{allowCreatingEmptyLinks:!1,addTargetToExternalLinks:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"linkHref"}),e.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:rd}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(s,o)=>rd(ap(s),o)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:s=>s.getAttribute("href")}}),e.commands.add("link",new a4(e)),e.commands.add("unlink",new l4(e));const t=s4(e.t,o4(e.config.get("link.decorators")));this._enableAutomaticDecorators(t.filter(s=>s.mode===cd)),this._enableManualDecorators(t.filter(s=>s.mode===d4)),e.plugins.get(Ks).registerAttribute("linkHref"),Cg(e,"linkHref","a",u4),this._enableLinkOpen(),this._enableSelectionAttributesFixer(),this._enableClipboardIntegration()}_enableAutomaticDecorators(e){const t=this.editor,s=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&s.add({id:"linkIsExternal",mode:cd,callback:o=>!!o&&h4.test(o),attributes:{target:"_blank",rel:"noopener noreferrer"}}),s.add(e),s.length&&t.conversion.for("downcast").add(s.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,s=t.commands.get("link").manualDecorators;e.forEach(o=>{t.model.schema.extend("$text",{allowAttributes:o.id});const r=new c4(o);s.add(r),t.conversion.for("downcast").attributeToElement({model:r.id,view:(a,{writer:l,schema:c},{item:u})=>{if((u.is("selection")||c.isInline(u))&&a){const d=l.createAttributeElement("a",r.attributes,{priority:5});r.classes&&l.addClass(r.classes,d);for(const h in r.styles)l.setStyle(h,r.styles[h],d);return l.setCustomProperty("link",!0,d),d}}}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",...r._createPattern()},model:{key:r.id}})})}_enableLinkOpen(){const e=this.editor,i=e.editing.view.document;this.listenTo(i,"click",(s,o)=>{if(!(L.isMac?o.domEvent.metaKey:o.domEvent.ctrlKey))return;let a=o.domTarget;if(a.tagName.toLowerCase()!="a"&&(a=a.closest("a")),!a)return;const l=a.getAttribute("href");l&&(s.stop(),o.preventDefault(),ad(l))},{context:"$capture"}),this.listenTo(i,"keydown",(s,o)=>{const a=e.commands.get("link").value;a&&o.keyCode===N.enter&&o.altKey&&(s.stop(),ad(a))})}_enableSelectionAttributesFixer(){const t=this.editor.model,i=t.document.selection;this.listenTo(i,"change:attribute",(s,{attributeKeys:o})=>{!o.includes("linkHref")||i.hasAttribute("linkHref")||t.change(r=>{f4(r,m4(t.schema))})})}_enableClipboardIntegration(){const e=this.editor,t=e.model,i=this.editor.config.get("link.defaultProtocol");i&&this.listenTo(e.plugins.get("ClipboardPipeline"),"contentInsertion",(s,o)=>{t.change(r=>{const a=r.createRangeIn(o.content);for(const l of a.getItems())if(l.hasAttribute("linkHref")){const c=nl(l.getAttribute("linkHref"),i);r.setAttribute("linkHref",c,l)}})})}}function f4(n,e){n.removeSelectionAttribute("linkHref");for(const t of e)n.removeSelectionAttribute(t)}function m4(n){return n.getDefinition("$text").allowAttributes.filter(t=>t.startsWith("link"))}/**
|
|
1215
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1216
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1217
|
+
*/class g4 extends T{constructor(e,t){super(e),this.focusTracker=new ne,this.keystrokes=new ae,this._focusables=new Ae;const i=e.t;this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(i("Save"),I.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(i("Cancel"),I.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(t),this.children=this._createFormChildren(t.manualDecorators),this._focusCycler=new ke({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const s=["ck","ck-link-form","ck-responsive-form"];t.manualDecorators.length&&s.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:s,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce((e,t)=>(e[t.name]=t.isOn,e),{})}render(){super.render(),so({view:this}),[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createUrlInput(){const e=this.locale.t,t=new Zi(this.locale,Qn);return t.label=e("Link URL"),t}_createButton(e,t,i,s){const o=new B(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o.extendTemplate({attributes:{class:i}}),s&&o.delegate("execute").to(this,s),o}_createManualDecoratorSwitches(e){const t=this.createCollection();for(const i of e.manualDecorators){const s=new Zn(this.locale);s.set({name:i.id,label:i.label,withText:!0}),s.bind("isOn").toMany([i,e],"value",(o,r)=>r===void 0&&o===void 0?!!i.defaultValue:!!o),s.on("execute",()=>{i.set("value",!s.isOn)}),t.add(s)}return t}_createFormChildren(e){const t=this.createCollection();if(t.add(this.urlInputView),e.length){const i=new T;i.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map(s=>({tag:"li",children:[s],attributes:{class:["ck","ck-list__item"]}})),attributes:{class:["ck","ck-reset","ck-list"]}}),t.add(i)}return t.add(this.saveButtonView),t.add(this.cancelButtonView),t}}const p4='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184zm4.919 10.562-1.414 1.414a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.061-1.06l1.414 1.414 1.414-1.415a.75.75 0 0 1 1.061 1.061l-1.414 1.414 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414z"/></svg>';/**
|
|
1218
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1219
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1220
|
+
*/class w4 extends T{constructor(e){super(e),this.focusTracker=new ne,this.keystrokes=new ae,this._focusables=new Ae;const t=e.t;this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(t("Unlink"),p4,"unlink"),this.editButtonView=this._createButton(t("Edit link"),I.pencil,"edit"),this.set("href",void 0),this._focusCycler=new ke({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-link-actions","ck-responsive-form"],tabindex:"-1"},children:[this.previewButtonView,this.editButtonView,this.unlinkButtonView]})}render(){super.render(),[this.previewButtonView,this.editButtonView,this.unlinkButtonView].forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createButton(e,t,i){const s=new B(this.locale);return s.set({label:e,icon:t,tooltip:!0}),s.delegate("execute").to(this,i),s}_createPreviewButton(){const e=new B(this.locale),t=this.bindTemplate,i=this.t;return e.set({withText:!0,tooltip:i("Open link in new tab")}),e.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:t.to("href",s=>s&&ap(s)),target:"_blank",rel:"noopener noreferrer"}}),e.bind("label").to(this,"href",s=>s||i("This link has no URL")),e.bind("isEnabled").to(this,"href",s=>!!s),e.template.tag="a",e.template.eventListeners={},e}}const b4='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184z"/></svg>';/**
|
|
1221
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1222
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1223
|
+
*/const Xe="link-ui";class _4 extends w{constructor(){super(...arguments),this.actionsView=null,this.formView=null}static get requires(){return[Gs]}static get pluginName(){return"LinkUI"}init(){const e=this.editor;e.editing.view.addObserver(uT),this._balloon=e.plugins.get(Gs),this._createToolbarLinkButton(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:Xe,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:Xe,view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}})}destroy(){super.destroy(),this.formView&&this.formView.destroy(),this.actionsView&&this.actionsView.destroy()}_createViews(){this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._enableUserBalloonInteractions()}_createActionsView(){const e=this.editor,t=new w4(e.locale),i=e.commands.get("link"),s=e.commands.get("unlink");return t.bind("href").to(i,"value"),t.editButtonView.bind("isEnabled").to(i),t.unlinkButtonView.bind("isEnabled").to(s),this.listenTo(t,"edit",()=>{this._addFormView()}),this.listenTo(t,"unlink",()=>{e.execute("unlink"),this._hideUI()}),t.keystrokes.set("Esc",(o,r)=>{this._hideUI(),r()}),t.keystrokes.set(tr,(o,r)=>{this._addFormView(),r()}),t}_createFormView(){const e=this.editor,t=e.commands.get("link"),i=e.config.get("link.defaultProtocol"),s=e.config.get("link.allowCreatingEmptyLinks"),o=new(ma(g4))(e.locale,t);return o.urlInputView.fieldView.bind("value").to(t,"value"),o.urlInputView.bind("isEnabled").to(t,"isEnabled"),o.saveButtonView.bind("isEnabled").to(t,"isEnabled",o.urlInputView,"isEmpty",(r,a)=>r&&(s||!a)),this.listenTo(o,"submit",()=>{const{value:r}=o.urlInputView.fieldView.element,a=nl(r,i);e.execute("link",a,o.getDecoratorSwitchesState()),this._closeFormView()}),this.listenTo(o,"cancel",()=>{this._closeFormView()}),o.keystrokes.set("Esc",(r,a)=>{this._closeFormView(),a()}),o}_createToolbarLinkButton(){const e=this.editor,t=e.commands.get("link"),i=e.t;e.ui.componentFactory.add("link",s=>{const o=new B(s);return o.isEnabled=!0,o.label=i("Link"),o.icon=b4,o.keystroke=tr,o.tooltip=!0,o.isToggleable=!0,o.bind("isEnabled").to(t,"isEnabled"),o.bind("isOn").to(t,"value",r=>!!r),this.listenTo(o,"execute",()=>this._showUI(!0)),o})}_enableBalloonActivators(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",()=>{this._getSelectedLinkElement()&&this._showUI()}),e.keystrokes.set(tr,(i,s)=>{s(),e.commands.get("link").isEnabled&&this._showUI(!0)})}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",(e,t)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),t())},{priority:"high"}),this.editor.keystrokes.set("Esc",(e,t)=>{this._isUIVisible&&(this._hideUI(),t())}),fa({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this.actionsView||this._createViews(),!this._areActionsInPanel&&this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;const t=this.editor.commands.get("link");this.formView.disableCssTransitions(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this.formView.urlInputView.fieldView.value=t.value||"",this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions()}_closeFormView(){const e=this.editor.commands.get("link");e.restoreManualDecoratorStates(),e.value!==void 0?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this.formView.urlInputView.fieldView.reset(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(e=!1){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const e=this.editor;this.stopListening(e.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const e=this.editor,t=e.editing.view.document;let i=this._getSelectedLinkElement(),s=r();const o=()=>{const a=this._getSelectedLinkElement(),l=r();i&&!a||!i&&l!==s?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),i=a,s=l};function r(){return t.selection.focus.getAncestors().reverse().find(a=>a.is("element"))}this.listenTo(e.ui,"update",o),this.listenTo(this._balloon,"change:visibleView",o)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _areActionsInPanel(){return!!this.actionsView&&this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return!!this.actionsView&&this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){const e=this._balloon.visibleView;return!!this.formView&&e==this.formView||this._areActionsVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=this.editor.model,i=e.document;let s;if(t.markers.has(Xe)){const o=Array.from(this.editor.editing.mapper.markerNameToElements(Xe)),r=e.createRange(e.createPositionBefore(o[0]),e.createPositionAfter(o[o.length-1]));s=e.domConverter.viewRangeToDom(r)}else s=()=>{const o=this._getSelectedLinkElement();return o?e.domConverter.mapViewToDom(o):e.domConverter.viewRangeToDom(i.selection.getFirstRange())};return{target:s}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection,i=t.getSelectedElement();if(t.isCollapsed||i&&he(i))return ir(t.getFirstPosition());{const s=t.getFirstRange().getTrimmed(),o=ir(s.start),r=ir(s.end);return!o||o!=r?null:e.createRangeIn(o).getTrimmed().isEqual(s)?o:null}}_showFakeVisualSelection(){const e=this.editor.model;e.change(t=>{const i=e.document.selection.getFirstRange();if(e.markers.has(Xe))t.updateMarker(Xe,{range:i});else if(i.start.isAtEnd){const s=i.start.getLastMatchingPosition(({item:o})=>!e.schema.isContent(o),{boundaries:i});t.addMarker(Xe,{usingOperation:!1,affectsData:!1,range:t.createRange(s,i.end)})}else t.addMarker(Xe,{usingOperation:!1,affectsData:!1,range:i})})}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(Xe)&&e.change(t=>{t.removeMarker(Xe)})}}function ir(n){return n.getAncestors().find(e=>i4(e))||null}/**
|
|
1224
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1225
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1226
|
+
*/const v4=4,up=new RegExp("(^|\\s)(((?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(((?!www\\.)|(www\\.))(?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.)+(?:[a-z\\u00a1-\\uffff]{2,63})))(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i"),y4=2;class dp extends w{static get requires(){return[yt,cp]}static get pluginName(){return"AutoLink"}init(){const t=this.editor.model.document.selection;t.on("change:range",()=>{this.isEnabled=!t.anchor.parent.is("element","codeBlock")}),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling(),this._enablePasteLinking()}_expandLinkRange(e,t){return t.textNode&&t.textNode.hasAttribute("linkHref")?Xn(t,"linkHref",t.textNode.getAttribute("linkHref"),e):null}_selectEntireLinks(e,t){const s=this.editor.model,o=s.document.selection,r=o.getFirstPosition(),a=o.getLastPosition();let l=t.getJoined(this._expandLinkRange(s,r)||t);l&&(l=l.getJoined(this._expandLinkRange(s,a)||t)),l&&(l.start.isBefore(r)||l.end.isAfter(a))&&e.setSelection(l)}_enablePasteLinking(){const e=this.editor,t=e.model,i=t.document.selection,s=e.plugins.get("ClipboardPipeline"),o=e.commands.get("link");s.on("inputTransformation",(r,a)=>{if(!this.isEnabled||!o.isEnabled||i.isCollapsed||a.method!=="paste"||i.rangeCount>1)return;const l=i.getFirstRange(),c=a.dataTransfer.getData("text/plain");if(!c)return;const u=c.match(up);u&&u[2]===c&&(t.change(d=>{this._selectEntireLinks(d,l),o.execute(c)}),r.stop())},{priority:"high"})}_enableTypingHandling(){const e=this.editor,t=new Ux(e.model,i=>{if(!C4(i))return;const s=ud(i.substr(0,i.length-1));if(s)return{url:s}});t.on("matched:data",(i,s)=>{const{batch:o,range:r,url:a}=s;if(!o.isTyping)return;const l=r.end.getShiftedBy(-1),c=l.getShiftedBy(-a.length),u=e.model.createRange(c,l);this._applyAutoLink(a,u)}),t.bind("isEnabled").to(this)}_enableEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("enter");i&&i.on("execute",()=>{const s=t.document.selection.getFirstPosition();if(!s.parent.previousSibling)return;const o=t.createRangeIn(s.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(o)})}_enableShiftEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("shiftEnter");i&&i.on("execute",()=>{const s=t.document.selection.getFirstPosition(),o=t.createRange(t.createPositionAt(s.parent,0),s.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(o)})}_checkAndApplyAutoLinkOnRange(e){const t=this.editor.model,{text:i,range:s}=yg(e,t),o=ud(i);if(o){const r=t.createRange(s.end.getShiftedBy(-o.length),s.end);this._applyAutoLink(o,r)}}_applyAutoLink(e,t){const i=this.editor.model,s=this.editor.config.get("link.defaultProtocol"),o=nl(e,s);!this.isEnabled||!k4(t,i)||!lp(o)||E4(t)||this._persistAutoLink(o,t)}_persistAutoLink(e,t){const i=this.editor.model,s=this.editor.plugins.get("Delete");i.enqueueChange(o=>{o.setAttribute("linkHref",e,t),i.enqueueChange(()=>{s.requestUndoOnBackspace()})})}}function C4(n){return n.length>v4&&n[n.length-1]===" "&&n[n.length-2]!==" "}function ud(n){const e=up.exec(n);return e?e[y4]:null}function k4(n,e){return e.schema.checkAttributeInSelection(e.createSelection(n),"linkHref")}function E4(n){const e=n.start.nodeAfter;return!!e&&e.hasAttribute("linkHref")}/**
|
|
1227
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1228
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1229
|
+
*/class T4 extends w{static get requires(){return[cp,_4,dp]}static get pluginName(){return"Link"}}/**
|
|
1230
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1231
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1232
|
+
*/class We{constructor(e,t){this._startElement=e,this._referenceIndent=e.getAttribute("listIndent"),this._isForward=t.direction=="forward",this._includeSelf=!!t.includeSelf,this._sameAttributes=K(t.sameAttributes||[]),this._sameIndent=!!t.sameIndent,this._lowerIndent=!!t.lowerIndent,this._higherIndent=!!t.higherIndent}static first(e,t){const s=new this(e,t)[Symbol.iterator]();return J(s)}*[Symbol.iterator](){const e=[];for(const{node:t}of ns(this._getStartNode(),this._isForward?"forward":"backward")){const i=t.getAttribute("listIndent");if(i<this._referenceIndent){if(!this._lowerIndent)break;this._referenceIndent=i}else if(i>this._referenceIndent){if(!this._higherIndent)continue;if(!this._isForward){e.push(t);continue}}else{if(!this._sameIndent){if(this._higherIndent){e.length&&(yield*e,e.length=0);break}continue}if(this._sameAttributes.some(s=>t.getAttribute(s)!==this._startElement.getAttribute(s)))break}e.length&&(yield*e,e.length=0),yield t}}_getStartNode(){return this._includeSelf?this._startElement:this._isForward?this._startElement.nextSibling:this._startElement.previousSibling}}function*ns(n,e="forward"){const t=e=="forward",i=[];let s=null;for(;se(n);){let o=null;if(s){const r=n.getAttribute("listIndent"),a=s.getAttribute("listIndent");r>a?i[a]=s:r<a?(o=i[r],i.length=r):o=s}yield{node:n,previous:s,previousNodeInList:o},s=n,n=t?n.nextSibling:n.previousSibling}}class A4{constructor(e){this._listHead=e}[Symbol.iterator](){return ns(this._listHead,"forward")}}/**
|
|
1233
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1234
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1235
|
+
*/class Ui{static next(){return Ze()}}function se(n){return!!n&&n.is("element")&&n.hasAttribute("listItemId")}function sl(n,e={}){return[...Rt(n,{...e,direction:"backward"}),...Rt(n,{...e,direction:"forward"})]}function Rt(n,e={}){const t=e.direction=="forward",i=Array.from(new We(n,{...e,includeSelf:t,sameIndent:!0,sameAttributes:"listItemId"}));return t?i:i.reverse()}function S4(n){return Array.from(new We(n,{direction:"forward",higherIndent:!0}))}function hp(n){const e=new We(n,{sameIndent:!0,sameAttributes:"listType"}),t=new We(n,{sameIndent:!0,sameAttributes:"listType",includeSelf:!0,direction:"forward"});return[...Array.from(e).reverse(),...t]}function si(n){return!We.first(n,{sameIndent:!0,sameAttributes:"listItemId"})}function dd(n){return!We.first(n,{direction:"forward",sameIndent:!0,sameAttributes:"listItemId"})}function ss(n,e={}){n=K(n);const t=e.withNested!==!1,i=new Set;for(const s of n)for(const o of sl(s,{higherIndent:t}))i.add(o);return mi(i)}function _o(n){n=K(n);const e=new Set;for(const t of n)for(const i of hp(t))e.add(i);return mi(e)}function ol(n,e){const t=Rt(n,{direction:"forward"}),i=Ui.next();for(const s of t)e.setAttribute("listItemId",i,s);return t}function Yr(n,e,t){const i={};for(const[o,r]of e.getAttributes())o.startsWith("list")&&(i[o]=r);const s=Rt(n,{direction:"forward"});for(const o of s)t.setAttributes(i,o);return s}function Qr(n,e,{expand:t,indentBy:i=1}={}){n=K(n);const s=t?ss(n):n;for(const o of s){const r=o.getAttribute("listIndent")+i;r<0?vo(o,e):e.setAttribute("listIndent",r,o)}return s}function x4(n,e){n=K(n);const t=ss(n),i=new Set,s=Math.min(...t.map(r=>r.getAttribute("listIndent"))),o=new Map;for(const r of t)o.set(r,We.first(r,{lowerIndent:!0}));for(const r of t){if(i.has(r))continue;i.add(r);const a=r.getAttribute("listIndent")-1;if(a<0){vo(r,e);continue}if(r.getAttribute("listIndent")==s){const l=P4(r,o.get(r),e);for(const c of l)i.add(c);if(l.length)continue}e.setAttribute("listIndent",a,r)}return mi(i)}function vo(n,e){n=K(n);for(const t of n)t.is("element","listItem")&&e.rename(t,"paragraph");for(const t of n)for(const i of t.getAttributeKeys())i.startsWith("list")&&e.removeAttribute(i,t);return n}function $n(n){if(!n.length)return!1;const e=n[0].getAttribute("listItemId");return e?!n.some(t=>t.getAttribute("listItemId")!=e):!1}function I4(n,e){const t=[];let i=Number.POSITIVE_INFINITY;for(const{node:s}of ns(n.nextSibling,"forward")){const o=s.getAttribute("listIndent");if(o==0)break;o<i&&(i=o);const r=o-i;e.setAttribute("listIndent",r,s),t.push(s)}return t}function mi(n){return Array.from(n).filter(e=>e.root.rootName!=="$graveyard").sort((e,t)=>e.index-t.index)}function zn(n){const e=n.document.selection.getSelectedElement();return e&&n.schema.isObject(e)&&n.schema.isBlock(e)?e:null}function nr(n,e){return e.checkChild(n.parent,"listItem")&&e.checkChild(n,"$text")&&!e.isObject(n)}function P4(n,e,t){return Rt(e,{direction:"forward"}).pop().index>n.index?Yr(n,e,t):[]}/**
|
|
1236
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1237
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1238
|
+
*/class hd extends R{constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model,t=fd(e.document.selection);e.change(i=>{const s=[];$n(t)&&!si(t[0])?(this._direction=="forward"&&s.push(...Qr(t,i)),s.push(...ol(t[0],i))):this._direction=="forward"?s.push(...Qr(t,i,{expand:!0})):s.push(...x4(t,i));for(const o of s){if(!o.hasAttribute("listType"))continue;const r=We.first(o,{sameIndent:!0});r&&i.setAttribute("listType",r.getAttribute("listType"),o)}this._fireAfterExecute(s)})}_fireAfterExecute(e){this.fire("afterExecute",mi(new Set(e)))}_checkEnabled(){let e=fd(this.editor.model.document.selection),t=e[0];if(!t)return!1;if(this._direction=="backward"||$n(e)&&!si(e[0]))return!0;e=ss(e),t=e[0];const i=We.first(t,{sameIndent:!0});return i?i.getAttribute("listType")==t.getAttribute("listType"):!1}}function fd(n){const e=Array.from(n.getSelectedBlocks()),t=e.findIndex(i=>!se(i));return t!=-1&&(e.length=t),e}/**
|
|
1239
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1240
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1241
|
+
*/class md extends R{constructor(e,t){super(e),this.type=t}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,i=t.document,s=zn(t),o=Array.from(i.selection.getSelectedBlocks()).filter(a=>t.schema.checkAttribute(a,"listType")||nr(a,t.schema)),r=e.forceValue!==void 0?!e.forceValue:this.value;t.change(a=>{if(r){const l=o[o.length-1],c=Rt(l,{direction:"forward"}),u=[];c.length>1&&u.push(...ol(c[1],a)),u.push(...vo(o,a)),u.push(...I4(l,a)),this._fireAfterExecute(u)}else if((s||i.selection.isCollapsed)&&se(o[0])){const l=hp(s||o[0]);for(const c of l)a.setAttribute("listType",this.type,c);this._fireAfterExecute(l)}else{const l=[];for(const c of o)if(!c.hasAttribute("listType"))!c.is("element","listItem")&&nr(c,t.schema)&&a.rename(c,"listItem"),a.setAttributes({listIndent:0,listItemId:Ui.next(),listType:this.type},c),l.push(c);else for(const u of ss(c,{withNested:!1}))u.getAttribute("listType")!=this.type&&(a.setAttribute("listType",this.type,u),l.push(u));this._fireAfterExecute(l)}})}_fireAfterExecute(e){this.fire("afterExecute",mi(new Set(e)))}_getValue(){const e=this.editor.model.document.selection,t=Array.from(e.getSelectedBlocks());if(!t.length)return!1;for(const i of t)if(i.getAttribute("listType")!=this.type)return!1;return!0}_checkEnabled(){const e=this.editor.model,t=e.schema,i=e.document.selection,s=Array.from(i.getSelectedBlocks());if(!s.length)return!1;if(this.value)return!0;for(const o of s)if(t.checkAttribute(o,"listType")||nr(o,t))return!0;return!1}}/**
|
|
1242
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1243
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1244
|
+
*/class gd extends R{constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute({shouldMergeOnBlocksContentLevel:e=!1}={}){const t=this.editor.model,i=t.document.selection,s=[];t.change(o=>{const{firstElement:r,lastElement:a}=this._getMergeSubjectElements(i,e),l=r.getAttribute("listIndent")||0,c=a.getAttribute("listIndent"),u=a.getAttribute("listItemId");if(l!=c){const d=S4(a);s.push(...Qr([a,...d],o,{indentBy:l-c,expand:l<c}))}if(e){let d=i;i.isCollapsed&&(d=o.createSelection(o.createRange(o.createPositionAt(r,"end"),o.createPositionAt(a,0)))),t.deleteContent(d,{doNotResetEntireContent:i.isCollapsed});const h=d.getLastPosition().parent,f=h.nextSibling;s.push(h),f&&f!==a&&f.getAttribute("listItemId")==u&&s.push(...Yr(f,h,o))}else s.push(...Yr(a,r,o));this._fireAfterExecute(s)})}_fireAfterExecute(e){this.fire("afterExecute",mi(new Set(e)))}_checkEnabled(){const e=this.editor.model,t=e.document.selection,i=zn(e);if(t.isCollapsed||i){const s=i||t.getFirstPosition().parent;if(!se(s))return!1;const o=this._direction=="backward"?s.previousSibling:s.nextSibling;if(!o||$n([s,o]))return!1}else{const s=t.getLastPosition(),o=t.getFirstPosition();if(s.parent===o.parent||!se(s.parent))return!1}return!0}_getMergeSubjectElements(e,t){const i=this.editor.model,s=zn(i);let o,r;if(e.isCollapsed||s){const a=s||e.getFirstPosition().parent,l=si(a);this._direction=="backward"?(r=a,l&&!t?o=We.first(a,{sameIndent:!0,lowerIndent:!0}):o=a.previousSibling):(o=a,r=a.nextSibling)}else o=e.getFirstPosition().parent,r=e.getLastPosition().parent;return{firstElement:o,lastElement:r}}}/**
|
|
1245
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1246
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1247
|
+
*/class pd extends R{constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute(){this.editor.model.change(t=>{const i=ol(this._getStartBlock(),t);this._fireAfterExecute(i)})}_fireAfterExecute(e){this.fire("afterExecute",mi(new Set(e)))}_checkEnabled(){const e=this.editor.model.document.selection,t=this._getStartBlock();return e.isCollapsed&&se(t)&&!si(t)}_getStartBlock(){const t=this.editor.model.document.selection.getFirstPosition().parent;return this._direction=="before"?t:t.nextSibling}}/**
|
|
1248
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1249
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1250
|
+
*/class R4 extends w{static get pluginName(){return"ListUtils"}expandListBlocksToCompleteList(e){return _o(e)}isFirstBlockOfListItem(e){return si(e)}isListItemBlock(e){return se(e)}expandListBlocksToCompleteItems(e,t={}){return ss(e,t)}}/**
|
|
1251
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1252
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1253
|
+
*/function fp(n){return n.is("element","ol")||n.is("element","ul")}function eo(n){return n.is("element","li")}function V4(n){let e=0,t=n.parent;for(;t;){if(eo(t))e++;else{const i=t.previousSibling;i&&eo(i)&&e++}t=t.parent}return e}function L4(n,e,t,i=gp(t,e)){return n.createAttributeElement(mp(t),null,{priority:2*e/100-100,id:i})}function B4(n,e,t){return n.createAttributeElement("li",null,{priority:(2*e+1)/100-100,id:t})}function mp(n){return n=="numbered"?"ol":"ul"}function gp(n,e){return`list-${n}-${e}`}/**
|
|
1254
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1255
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1256
|
+
*/function je(n,e){const t=n.nodeBefore;if(se(t)){let i=t;for(const{node:s}of ns(i,"backward"))if(i=s,e.has(i))return;e.set(t,i)}else{const i=n.nodeAfter;se(i)&&e.set(i,i)}}function O4(n,e){let t=0,i=-1,s=null,o=!1;for(const{node:r}of n){const a=r.getAttribute("listIndent");if(a>t){let l;s===null?(s=a-t,l=t):(s>a&&(s=a),l=a-s),l>i+1&&(l=i+1),e.setAttribute("listIndent",l,r),o=!0,i=l}else s=null,t=a+1,i=a}return o}function M4(n,e,t){const i=new Set;let s=!1;for(const{node:o}of n){if(i.has(o))continue;let r=o.getAttribute("listType"),a=o.getAttribute("listItemId");if(e.has(a)&&(a=Ui.next()),e.add(a),o.is("element","listItem")){o.getAttribute("listItemId")!=a&&(t.setAttribute("listItemId",a,o),s=!0);continue}for(const l of Rt(o,{direction:"forward"}))i.add(l),l.getAttribute("listType")!=r&&(a=Ui.next(),r=l.getAttribute("listType")),l.getAttribute("listItemId")!=a&&(t.setAttribute("listItemId",a,l),s=!0)}return s}/**
|
|
1257
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1258
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1259
|
+
*/function F4(){return(n,e,t)=>{const{writer:i,schema:s}=t;if(!e.modelRange)return;const o=Array.from(e.modelRange.getItems({shallow:!0})).filter(d=>s.checkAttribute(d,"listItemId"));if(!o.length)return;const r=Ui.next(),a=V4(e.viewItem);let l=e.viewItem.parent&&e.viewItem.parent.is("element","ol")?"numbered":"bulleted";const c=o[0].getAttribute("listType");c&&(l=c);const u={listItemId:r,listIndent:a,listType:l};for(const d of o)d.hasAttribute("listItemId")||i.setAttributes(u,d);o.length>1&&o[1].getAttribute("listItemId")!=u.listItemId&&t.keepEmptyElement(o[0])}}function wd(){return(n,e,t)=>{if(!t.consumable.test(e.viewItem,{name:!0}))return;const i=new Yi(e.viewItem.document);for(const s of Array.from(e.viewItem.getChildren()))!eo(s)&&!fp(s)&&i.remove(s)}}function D4(n,e,t,i){return()=>{const a=n.document.differ.getChanges(),l=[],c=new Map,u=new Set;for(const d of a)if(d.type=="insert"&&d.name!="$text")je(d.position,c),d.attributes.has("listItemId")?u.add(d.position.nodeAfter):je(d.position.getShiftedBy(d.length),c);else if(d.type=="remove"&&d.attributes.has("listItemId"))je(d.position,c);else if(d.type=="attribute"){const h=d.range.start.nodeAfter;t.includes(d.attributeKey)?(je(d.range.start,c),d.attributeNewValue===null?(je(d.range.start.getShiftedBy(1),c),o(h)&&l.push(h)):u.add(h)):se(h)&&o(h)&&l.push(h)}for(const d of c.values())l.push(...s(d,u));for(const d of new Set(l))e.reconvertItem(d)};function s(a,l){const c=[],u=new Set,d=[];for(const{node:h,previous:f}of ns(a,"forward")){if(u.has(h))continue;const m=h.getAttribute("listIndent");f&&m<f.getAttribute("listIndent")&&(d.length=m+1),d[m]=Object.fromEntries(Array.from(h.getAttributes()).filter(([_])=>t.includes(_)));const p=Rt(h,{direction:"forward"});for(const _ of p)u.add(_),(o(_,p)||r(_,d,l))&&c.push(_)}return c}function o(a,l){const c=e.mapper.toViewElement(a);if(!c)return!1;if(i.fire("checkElement",{modelElement:a,viewElement:c}))return!0;if(!a.is("element","paragraph")&&!a.is("element","listItem"))return!1;const d=pp(a,t,l);return d&&c.is("element","p")?!0:!!(!d&&c.is("element","span"))}function r(a,l,c){if(c.has(a))return!1;const u=e.mapper.toViewElement(a);let d=l.length-1;for(let h=u.parent;!h.is("editableElement");h=h.parent){const f=eo(h),m=fp(h);if(!m&&!f)continue;const p=`checkAttributes:${f?"item":"list"}`;if(i.fire(p,{viewElement:h,modelAttributes:l[d]}))break;if(m&&(d--,d<0))return!1}return!0}}function bd(n,e,t,{dataPipeline:i}={}){const s=W4(n);return(o,r,a)=>{const{writer:l,mapper:c,consumable:u}=a,d=r.item;if(!n.includes(r.attributeKey)||!s(d,u))return;const h=N4(d,c,t);$4(h,l,c),H4(h,l);const f=z4(d,h,e,l,{dataPipeline:i});U4(d,f,e,l)}}function _d(n,{dataPipeline:e}={}){return(t,{writer:i})=>{if(!pp(t,n))return null;if(!e)return i.createContainerElement("span",{class:"ck-list-bogus-paragraph"});const s=i.createContainerElement("p");return i.setCustomProperty("dataPipeline:transparentRendering",!0,s),s}}function N4(n,e,t){const i=t.createRangeOn(n);return e.toViewRange(i).getTrimmed().end.nodeBefore}function $4(n,e,t){for(;n.parent.is("attributeElement")&&n.parent.getCustomProperty("listItemWrapper");)e.unwrap(e.createRangeIn(n.parent),n.parent);const i=e.createPositionBefore(n).getWalker({direction:"backward"}),s=[];for(const{item:o}of i){if(o.is("element")&&t.toModelElement(o))break;o.is("element")&&o.getCustomProperty("listItemMarker")&&s.push(o)}for(const o of s)e.remove(o)}function z4(n,e,t,i,{dataPipeline:s}){let o=i.createRangeOn(e);if(!si(n))return o;for(const r of t){if(r.scope!="itemMarker")continue;const a=r.createElement(i,n,{dataPipeline:s});if(!a||(i.setCustomProperty("listItemMarker",!0,a),i.insert(o.start,a),o=i.createRange(i.createPositionBefore(a),i.createPositionAfter(e)),!r.createWrapperElement||!r.canWrapElement))continue;const l=r.createWrapperElement(i,n,{dataPipeline:s});i.setCustomProperty("listItemWrapper",!0,l),r.canWrapElement(n)?o=i.wrap(o,l):(o=i.wrap(i.createRangeOn(a),l),o=i.createRange(o.start,i.createPositionAfter(e)))}return o}function H4(n,e){let t=n.parent;for(;t.is("attributeElement")&&["ul","ol","li"].includes(t.name);){const i=t.parent;e.unwrap(e.createRangeOn(n),t),t=i}}function U4(n,e,t,i){if(!n.hasAttribute("listIndent"))return;const s=n.getAttribute("listIndent");let o=n;for(let r=s;r>=0;r--){const a=B4(i,r,o.getAttribute("listItemId")),l=L4(i,r,o.getAttribute("listType"));for(const c of t)(c.scope=="list"||c.scope=="item")&&o.hasAttribute(c.attributeName)&&c.setAttributeOnDowncast(i,o.getAttribute(c.attributeName),c.scope=="list"?l:a);if(e=i.wrap(e,a),e=i.wrap(e,l),r==0||(o=We.first(o,{lowerIndent:!0}),!o))break}}function W4(n){return(e,t)=>{const i=[];for(const s of n)e.hasAttribute(s)&&i.push(`attribute:${s}`);return i.every(s=>t.test(e,s)!==!1)?(i.forEach(s=>t.consume(e,s)),!0):!1}}function pp(n,e,t=sl(n)){if(!se(n))return!1;for(const i of n.getAttributeKeys())if(!i.startsWith("selection:")&&!e.includes(i))return!1;return t.length<2}/**
|
|
1260
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1261
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1262
|
+
*/const Rs=["listType","listIndent","listItemId"];class Xr extends w{static get pluginName(){return"ListEditing"}static get requires(){return[ts,yt,R4,rt]}constructor(e){super(e),this._downcastStrategies=[],e.config.define("list.multiBlock",!0)}init(){const e=this.editor,t=e.model,i=e.config.get("list.multiBlock");if(e.plugins.has("LegacyListEditing"))throw new g("list-feature-conflict",this,{conflictPlugin:"LegacyListEditing"});t.schema.register("$listItem",{allowAttributes:Rs}),i?(t.schema.extend("$container",{allowAttributesOf:"$listItem"}),t.schema.extend("$block",{allowAttributesOf:"$listItem"}),t.schema.extend("$blockObject",{allowAttributesOf:"$listItem"})):t.schema.register("listItem",{inheritAllFrom:"$block",allowAttributesOf:"$listItem"});for(const s of Rs)t.schema.setAttributeProperties(s,{copyOnReplace:!0});e.commands.add("numberedList",new md(e,"numbered")),e.commands.add("bulletedList",new md(e,"bulleted")),e.commands.add("indentList",new hd(e,"forward")),e.commands.add("outdentList",new hd(e,"backward")),e.commands.add("splitListItemBefore",new pd(e,"before")),e.commands.add("splitListItemAfter",new pd(e,"after")),i&&(e.commands.add("mergeListItemBackward",new gd(e,"backward")),e.commands.add("mergeListItemForward",new gd(e,"forward"))),this._setupDeleteIntegration(),this._setupEnterIntegration(),this._setupTabIntegration(),this._setupClipboardIntegration()}afterInit(){const t=this.editor.commands,i=t.get("indent"),s=t.get("outdent");i&&i.registerChildCommand(t.get("indentList"),{priority:"high"}),s&&s.registerChildCommand(t.get("outdentList"),{priority:"lowest"}),this._setupModelPostFixing(),this._setupConversion()}registerDowncastStrategy(e){this._downcastStrategies.push(e)}getListAttributeNames(){return[...Rs,...this._downcastStrategies.map(e=>e.attributeName)]}_setupDeleteIntegration(){const e=this.editor,t=e.commands.get("mergeListItemBackward"),i=e.commands.get("mergeListItemForward");this.listenTo(e.editing.view.document,"delete",(s,o)=>{const r=e.model.document.selection;zn(e.model)||e.model.change(()=>{const a=r.getFirstPosition();if(r.isCollapsed&&o.direction=="backward"){if(!a.isAtStart)return;const l=a.parent;if(!se(l))return;if(!We.first(l,{sameAttributes:"listType",sameIndent:!0})&&l.getAttribute("listIndent")===0)dd(l)||e.execute("splitListItemAfter"),e.execute("outdentList");else{if(!t||!t.isEnabled)return;t.execute({shouldMergeOnBlocksContentLevel:vd(e.model,"backward")})}o.preventDefault(),s.stop()}else{if(r.isCollapsed&&!r.getLastPosition().isAtEnd||!i||!i.isEnabled)return;i.execute({shouldMergeOnBlocksContentLevel:vd(e.model,"forward")}),o.preventDefault(),s.stop()}})},{context:"li"})}_setupEnterIntegration(){const e=this.editor,t=e.model,i=e.commands,s=i.get("enter");this.listenTo(e.editing.view.document,"enter",(o,r)=>{const a=t.document,l=a.selection.getFirstPosition().parent;if(a.selection.isCollapsed&&se(l)&&l.isEmpty&&!r.isSoft){const c=si(l),u=dd(l);c&&u?(e.execute("outdentList"),r.preventDefault(),o.stop()):c&&!u?(e.execute("splitListItemAfter"),r.preventDefault(),o.stop()):u&&(e.execute("splitListItemBefore"),r.preventDefault(),o.stop())}},{context:"li"}),this.listenTo(s,"afterExecute",()=>{const o=i.get("splitListItemBefore");if(o.refresh(),!o.isEnabled)return;const a=e.model.document.selection.getLastPosition().parent;sl(a).length===2&&o.execute()})}_setupTabIntegration(){const e=this.editor;this.listenTo(e.editing.view.document,"tab",(t,i)=>{const s=i.shiftKey?"outdentList":"indentList";this.editor.commands.get(s).isEnabled&&(e.execute(s),i.stopPropagation(),i.preventDefault(),t.stop())},{context:"li"})}_setupConversion(){const e=this.editor,t=e.model,i=this.getListAttributeNames(),s=e.config.get("list.multiBlock"),o=s?"paragraph":"listItem";e.conversion.for("upcast").elementToElement({view:"li",model:(r,{writer:a})=>a.createElement(o,{listType:""})}).elementToElement({view:"p",model:(r,{writer:a})=>r.parent&&r.parent.is("element","li")?a.createElement(o,{listType:""}):null,converterPriority:"high"}).add(r=>{r.on("element:li",F4()),r.on("element:ul",wd(),{priority:"high"}),r.on("element:ol",wd(),{priority:"high"})}),s||e.conversion.for("downcast").elementToElement({model:"listItem",view:"p"}),e.conversion.for("editingDowncast").elementToElement({model:o,view:_d(i),converterPriority:"high"}).add(r=>{r.on("attribute",bd(i,this._downcastStrategies,t))}),e.conversion.for("dataDowncast").elementToElement({model:o,view:_d(i,{dataPipeline:!0}),converterPriority:"high"}).add(r=>{r.on("attribute",bd(i,this._downcastStrategies,t,{dataPipeline:!0}))}),this.listenTo(t.document,"change:data",D4(t,e.editing,i,this),{priority:"high"}),this.on("checkAttributes:item",(r,{viewElement:a,modelAttributes:l})=>{a.id!=l.listItemId&&(r.return=!0,r.stop())}),this.on("checkAttributes:list",(r,{viewElement:a,modelAttributes:l})=>{(a.name!=mp(l.listType)||a.id!=gp(l.listType,l.listIndent))&&(r.return=!0,r.stop())})}_setupModelPostFixing(){const e=this.editor.model,t=this.getListAttributeNames();e.document.registerPostFixer(i=>q4(e,i,t,this)),this.on("postFixer",(i,{listNodes:s,writer:o})=>{i.return=O4(s,o)||i.return},{priority:"high"}),this.on("postFixer",(i,{listNodes:s,writer:o,seenIds:r})=>{i.return=M4(s,r,o)||i.return},{priority:"high"})}_setupClipboardIntegration(){const e=this.editor.model,t=this.editor.plugins.get("ClipboardPipeline");this.listenTo(e,"insertContent",j4(e),{priority:"high"}),this.listenTo(t,"outputTransformation",(i,s)=>{e.change(o=>{const r=Array.from(s.content.getChildren()),a=r[r.length-1];if(r.length>1&&a.is("element")&&a.isEmpty&&r.slice(0,-1).every(se)&&o.remove(a),s.method=="copy"||s.method=="cut"){const l=Array.from(s.content.getChildren());$n(l)&&vo(l,o)}})})}}function q4(n,e,t,i){const s=n.document.differ.getChanges(),o=new Map,r=i.editor.config.get("list.multiBlock");let a=!1;for(const c of s){if(c.type=="insert"&&c.name!="$text"){const u=c.position.nodeAfter;if(!n.schema.checkAttribute(u,"listItemId"))for(const d of Array.from(u.getAttributeKeys()))t.includes(d)&&(e.removeAttribute(d,u),a=!0);je(c.position,o),c.attributes.has("listItemId")||je(c.position.getShiftedBy(c.length),o);for(const{item:d,previousPosition:h}of n.createRangeIn(u))se(d)&&je(h,o)}else c.type=="remove"?je(c.position,o):c.type=="attribute"&&t.includes(c.attributeKey)&&(je(c.range.start,o),c.attributeNewValue===null&&je(c.range.start.getShiftedBy(1),o));if(!r&&c.type=="attribute"&&Rs.includes(c.attributeKey)){const u=c.range.start.nodeAfter;c.attributeNewValue===null&&u&&u.is("element","listItem")?(e.rename(u,"paragraph"),a=!0):c.attributeOldValue===null&&u&&u.is("element")&&u.name!="listItem"&&(e.rename(u,"listItem"),a=!0)}}const l=new Set;for(const c of o.values())a=i.fire("postFixer",{listNodes:new A4(c),listHead:c,writer:e,seenIds:l})||a;return a}function j4(n){return(e,[t,i])=>{const s=t.is("documentFragment")?Array.from(t.getChildren()):[t];if(!s.length)return;const r=(i?n.createSelection(i):n.document.selection).getFirstPosition();let a;if(se(r.parent))a=r.parent;else if(se(r.nodeBefore))a=r.nodeBefore;else return;n.change(l=>{const c=a.getAttribute("listType"),u=a.getAttribute("listIndent"),d=s[0].getAttribute("listIndent")||0,h=Math.max(u-d,0);for(const f of s){const m=se(f);a.is("element","listItem")&&f.is("element","paragraph")&&l.rename(f,"listItem"),l.setAttributes({listIndent:(m?f.getAttribute("listIndent"):0)+h,listItemId:m?f.getAttribute("listItemId"):Ui.next(),listType:c},f)}})}}function vd(n,e){const t=n.document.selection;if(!t.isCollapsed)return!zn(n);if(e==="forward")return!0;const s=t.getFirstPosition().parent,o=s.previousSibling;return n.schema.isObject(o)?!1:o.isEmpty?!0:$n([s,o])}/**
|
|
1263
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1264
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1265
|
+
*/function yd(n,e,t,i){n.ui.componentFactory.add(e,s=>{const o=n.commands.get(e),r=new B(s);return r.set({label:t,icon:i,tooltip:!0,isToggleable:!0}),r.bind("isOn","isEnabled").to(o,"value","isEnabled"),r.on("execute",()=>{n.execute(e),n.editing.view.focus()}),r})}/**
|
|
1266
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1267
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1268
|
+
*/class G4 extends w{static get pluginName(){return"ListUI"}init(){const e=this.editor.t;yd(this.editor,"numberedList",e("Numbered List"),I.numberedList),yd(this.editor,"bulletedList",e("Bulleted List"),I.bulletedList)}}/**
|
|
1269
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1270
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1271
|
+
*/class K4 extends w{static get requires(){return[Xr,G4]}static get pluginName(){return"List"}}/**
|
|
1272
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1273
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1274
|
+
*/class Z4 extends R{refresh(){const e=this._getValue();this.value=e,this.isEnabled=e!=null}execute({startIndex:e=1}={}){const t=this.editor.model,i=t.document;let s=Array.from(i.selection.getSelectedBlocks()).filter(o=>se(o)&&o.getAttribute("listType")=="numbered");s=_o(s),t.change(o=>{for(const r of s)o.setAttribute("listStart",e>=0?e:1,r)})}_getValue(){const t=this.editor.model.document,i=J(t.selection.getSelectedBlocks());return i&&se(i)&&i.getAttribute("listType")=="numbered"?i.getAttribute("listStart"):null}}/**
|
|
1275
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1276
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1277
|
+
*/const wp={},bp={},_p={},vp=[{listStyle:"disc",typeAttribute:"disc",listType:"bulleted"},{listStyle:"circle",typeAttribute:"circle",listType:"bulleted"},{listStyle:"square",typeAttribute:"square",listType:"bulleted"},{listStyle:"decimal",typeAttribute:"1",listType:"numbered"},{listStyle:"decimal-leading-zero",typeAttribute:null,listType:"numbered"},{listStyle:"lower-roman",typeAttribute:"i",listType:"numbered"},{listStyle:"upper-roman",typeAttribute:"I",listType:"numbered"},{listStyle:"lower-alpha",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-alpha",typeAttribute:"A",listType:"numbered"},{listStyle:"lower-latin",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-latin",typeAttribute:"A",listType:"numbered"}];for(const{listStyle:n,typeAttribute:e,listType:t}of vp)wp[n]=t,bp[n]=e,e&&(_p[e]=n);function yp(){return vp.map(n=>n.listStyle)}function rl(n){return wp[n]||null}function Cp(n){return _p[n]||null}function ea(n){return bp[n]||null}/**
|
|
1278
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1279
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1280
|
+
*/class J4 extends R{constructor(e,t,i){super(e),this.defaultType=t,this._supportedTypes=i}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,i=t.document;t.change(s=>{this._tryToConvertItemsToList(e);let o=Array.from(i.selection.getSelectedBlocks()).filter(r=>r.hasAttribute("listType"));if(o.length){o=_o(o);for(const r of o)s.setAttribute("listStyle",e.type||this.defaultType,r)}})}isStyleTypeSupported(e){return this._supportedTypes?this._supportedTypes.includes(e):!0}_getValue(){const e=J(this.editor.model.document.selection.getSelectedBlocks());return se(e)?e.getAttribute("listStyle"):null}_checkEnabled(){const e=this.editor,t=e.commands.get("numberedList"),i=e.commands.get("bulletedList");return t.isEnabled||i.isEnabled}_tryToConvertItemsToList(e){if(!e.type)return;const t=rl(e.type);if(!t)return;const i=this.editor,s=`${t}List`;i.commands.get(s).value||i.execute(s)}}/**
|
|
1281
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1282
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1283
|
+
*/class Y4 extends R{refresh(){const e=this._getValue();this.value=e,this.isEnabled=e!=null}execute(e={}){const t=this.editor.model,i=t.document;let s=Array.from(i.selection.getSelectedBlocks()).filter(o=>se(o)&&o.getAttribute("listType")=="numbered");s=_o(s),t.change(o=>{for(const r of s)o.setAttribute("listReversed",!!e.reversed,r)})}_getValue(){const t=this.editor.model.document,i=J(t.selection.getSelectedBlocks());return se(i)&&i.getAttribute("listType")=="numbered"?i.getAttribute("listReversed"):null}}/**
|
|
1284
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1285
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1286
|
+
*/function Cd(n){return(e,t,i)=>{const{writer:s,schema:o,consumable:r}=i;if(r.test(t.viewItem,n.viewConsumables)===!1)return;t.modelRange||Object.assign(t,i.convertChildren(t.viewItem,t.modelCursor));let a=!1;for(const l of t.modelRange.getItems({shallow:!0}))o.checkAttribute(l,n.attributeName)&&n.appliesToListItem(l)&&(l.hasAttribute(n.attributeName)||(s.setAttribute(n.attributeName,n.getAttributeOnUpcast(t.viewItem),l),a=!0));a&&r.consume(t.viewItem,n.viewConsumables)}}/**
|
|
1287
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1288
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1289
|
+
*/class Q4 extends w{static get pluginName(){return"ListPropertiesUtils"}getAllSupportedStyleTypes(){return yp()}getListTypeFromListStyleType(e){return rl(e)}getListStyleTypeFromTypeAttribute(e){return Cp(e)}getTypeAttributeFromListStyleType(e){return ea(e)}}/**
|
|
1290
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1291
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1292
|
+
*/const un="default";class X4 extends w{static get requires(){return[Xr,Q4]}static get pluginName(){return"ListPropertiesEditing"}constructor(e){super(e),e.config.define("list.properties",{styles:!0,startIndex:!1,reversed:!1})}init(){const e=this.editor,t=e.model,i=e.plugins.get(Xr),s=e.config.get("list.properties"),o=e7(s);for(const r of o)r.addCommand(e),t.schema.extend("$listItem",{allowAttributes:r.attributeName}),i.registerDowncastStrategy({scope:"list",attributeName:r.attributeName,setAttributeOnDowncast(a,l,c){r.setAttributeOnDowncast(a,l,c)}});e.conversion.for("upcast").add(r=>{for(const a of o)r.on("element:ol",Cd(a)),r.on("element:ul",Cd(a))}),i.on("checkAttributes:list",(r,{viewElement:a,modelAttributes:l})=>{for(const c of o)c.getAttributeOnUpcast(a)!=l[c.attributeName]&&(r.return=!0,r.stop())}),this.listenTo(e.commands.get("indentList"),"afterExecute",(r,a)=>{t.change(l=>{for(const c of a)for(const u of o)u.appliesToListItem(c)&&l.setAttribute(u.attributeName,u.defaultValue,c)})}),i.on("postFixer",(r,{listNodes:a,writer:l})=>{for(const{node:c}of a)for(const u of o)u.hasValidAttribute(c)||(u.appliesToListItem(c)?l.setAttribute(u.attributeName,u.defaultValue,c):l.removeAttribute(u.attributeName,c),r.return=!0)}),i.on("postFixer",(r,{listNodes:a,writer:l})=>{for(const{node:c,previousNodeInList:u}of a)if(u&&u.getAttribute("listType")==c.getAttribute("listType"))for(const d of o){const{attributeName:h}=d;if(!d.appliesToListItem(c))continue;const f=u.getAttribute(h);c.getAttribute(h)!=f&&(l.setAttribute(h,f,c),r.return=!0)}})}}function e7(n){const e=[];if(n.styles){const t=typeof n.styles=="object"&&n.styles.useAttribute;e.push({attributeName:"listStyle",defaultValue:un,viewConsumables:{styles:"list-style-type"},addCommand(i){let s=yp();t&&(s=s.filter(o=>!!ea(o))),i.commands.add("listStyle",new J4(i,un,s))},appliesToListItem(i){return i.getAttribute("listType")=="numbered"||i.getAttribute("listType")=="bulleted"},hasValidAttribute(i){if(!this.appliesToListItem(i))return!i.hasAttribute("listStyle");if(!i.hasAttribute("listStyle"))return!1;const s=i.getAttribute("listStyle");return s==un?!0:rl(s)==i.getAttribute("listType")},setAttributeOnDowncast(i,s,o){if(s&&s!==un)if(t){const r=ea(s);if(r){i.setAttribute("type",r,o);return}}else{i.setStyle("list-style-type",s,o);return}i.removeStyle("list-style-type",o),i.removeAttribute("type",o)},getAttributeOnUpcast(i){const s=i.getStyle("list-style-type");if(s)return s;const o=i.getAttribute("type");return o?Cp(o):un}})}return n.reversed&&e.push({attributeName:"listReversed",defaultValue:!1,viewConsumables:{attributes:"reversed"},addCommand(t){t.commands.add("listReversed",new Y4(t))},appliesToListItem(t){return t.getAttribute("listType")=="numbered"},hasValidAttribute(t){return this.appliesToListItem(t)==t.hasAttribute("listReversed")},setAttributeOnDowncast(t,i,s){i?t.setAttribute("reversed","reversed",s):t.removeAttribute("reversed",s)},getAttributeOnUpcast(t){return t.hasAttribute("reversed")}}),n.startIndex&&e.push({attributeName:"listStart",defaultValue:1,viewConsumables:{attributes:"start"},addCommand(t){t.commands.add("listStart",new Z4(t))},appliesToListItem(t){return t.getAttribute("listType")=="numbered"},hasValidAttribute(t){return this.appliesToListItem(t)==t.hasAttribute("listStart")},setAttributeOnDowncast(t,i,s){i==0||i>1?t.setAttribute("start",i,s):t.removeAttribute("start",s)},getAttributeOnUpcast(t){const i=t.getAttribute("start");return i>=0?i:1}}),e}/**
|
|
1293
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1294
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1295
|
+
*/class t7 extends T{constructor(e,{enabledProperties:t,styleButtonViews:i,styleGridAriaLabel:s}){super(e),this.stylesView=null,this.additionalPropertiesCollapsibleView=null,this.startIndexFieldView=null,this.reversedSwitchButtonView=null,this.focusTracker=new ne,this.keystrokes=new ae,this.focusables=new Ae;const o=["ck","ck-list-properties"];this.children=this.createCollection(),this.focusCycler=new ke({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),t.styles?(this.stylesView=this._createStylesView(i,s),this.children.add(this.stylesView)):o.push("ck-list-properties_without-styles"),(t.startIndex||t.reversed)&&(this._addNumberedListPropertyViews(t),o.push("ck-list-properties_with-numbered-properties")),this.setTemplate({tag:"div",attributes:{class:o},children:this.children})}render(){if(super.render(),this.stylesView){this.focusables.add(this.stylesView),this.focusTracker.add(this.stylesView.element),(this.startIndexFieldView||this.reversedSwitchButtonView)&&(this.focusables.add(this.children.last.buttonView),this.focusTracker.add(this.children.last.buttonView.element));for(const e of this.stylesView.children)this.stylesView.focusTracker.add(e.element);Wn({keystrokeHandler:this.stylesView.keystrokes,focusTracker:this.stylesView.focusTracker,gridItems:this.stylesView.children,numberOfColumns:()=>E.window.getComputedStyle(this.stylesView.element).getPropertyValue("grid-template-columns").split(" ").length,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}if(this.startIndexFieldView){this.focusables.add(this.startIndexFieldView),this.focusTracker.add(this.startIndexFieldView.element);const e=t=>t.stopPropagation();this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}this.reversedSwitchButtonView&&(this.focusables.add(this.reversedSwitchButtonView),this.focusTracker.add(this.reversedSwitchButtonView.element)),this.keystrokes.listenTo(this.element)}focus(){this.focusCycler.focusFirst()}focusLast(){this.focusCycler.focusLast()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createStylesView(e,t){const i=new T(this.locale);return i.children=i.createCollection(),i.children.addMany(e),i.setTemplate({tag:"div",attributes:{"aria-label":t,class:["ck","ck-list-styles-list"]},children:i.children}),i.children.delegate("execute").to(this),i.focus=function(){this.children.first.focus()},i.focusTracker=new ne,i.keystrokes=new ae,i.render(),i.keystrokes.listenTo(i.element),i}_addNumberedListPropertyViews(e){const t=this.locale.t,i=[];e.startIndex&&(this.startIndexFieldView=this._createStartIndexField(),i.push(this.startIndexFieldView)),e.reversed&&(this.reversedSwitchButtonView=this._createReversedSwitchButton(),i.push(this.reversedSwitchButtonView)),e.styles?(this.additionalPropertiesCollapsibleView=new Wf(this.locale,i),this.additionalPropertiesCollapsibleView.set({label:t("List properties"),isCollapsed:!0}),this.additionalPropertiesCollapsibleView.buttonView.bind("isEnabled").toMany(i,"isEnabled",(...s)=>s.some(o=>o)),this.additionalPropertiesCollapsibleView.buttonView.on("change:isEnabled",(s,o,r)=>{r||(this.additionalPropertiesCollapsibleView.isCollapsed=!0)}),this.children.add(this.additionalPropertiesCollapsibleView)):this.children.addMany(i)}_createStartIndexField(){const e=this.locale.t,t=new Zi(this.locale,uS);return t.set({label:e("Start at"),class:"ck-numbered-list-properties__start-index"}),t.fieldView.set({min:0,step:1,value:1,inputMode:"numeric"}),t.fieldView.on("input",()=>{const i=t.fieldView.element,s=i.valueAsNumber;Number.isNaN(s)||(i.checkValidity()?this.fire("listStart",{startIndex:s}):t.errorText=e("Start index must be greater than 0."))}),t}_createReversedSwitchButton(){const e=this.locale.t,t=new Zn(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}}const i7='<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path 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-1h17zm0-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-1h17zm0-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-1h17z" fill-opacity=".163"/><path d="M11 27a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0-9a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0-9a3 3 0 1 1 0 6 3 3 0 0 1 0-6z"/></svg>',n7='<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path 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-1h17zm0-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-1h17zm0-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-1h17z" fill-opacity=".163"/><path d="M11 27a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0 1a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm0-10a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0 1a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm0-10a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0 1a2 2 0 1 0 0 4 2 2 0 0 0 0-4z"/></svg>',s7='<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path 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-1h17zm0-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-1h17zm0-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-1h17z" fill-opacity=".163"/><path d="M14 27v6H8v-6h6zm0-9v6H8v-6h6zm0-9v6H8V9h6z"/></svg>',o7='<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path 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-1h17zm0-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-1h17zm0-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-1h17z" fill-opacity=".163"/><path d="M10.29 15V8.531H9.286c-.14.393-.4.736-.778 1.03-.378.295-.728.495-1.05.6v1.121a4.257 4.257 0 0 0 1.595-.936V15h1.235zm3.343 0v-1.235h-1.235V15h1.235zM11.3 24v-1.147H8.848c.064-.111.148-.226.252-.343.104-.117.351-.354.74-.712.39-.357.66-.631.81-.821.225-.288.39-.562.494-.824.104-.263.156-.539.156-.829 0-.51-.182-.936-.545-1.279-.363-.342-.863-.514-1.499-.514-.58 0-1.063.148-1.45.444-.387.296-.617.784-.69 1.463l1.23.124c.024-.36.112-.619.264-.774.153-.155.358-.233.616-.233.26 0 .465.074.613.222.148.148.222.36.222.635 0 .25-.085.501-.255.756-.126.185-.468.536-1.024 1.055-.692.641-1.155 1.156-1.389 1.544-.234.389-.375.8-.422 1.233H11.3zm2.333 0v-1.235h-1.235V24h1.235zM9.204 34.11c.615 0 1.129-.2 1.542-.598.413-.398.62-.88.62-1.446 0-.39-.11-.722-.332-.997a1.5 1.5 0 0 0-.886-.532c.619-.337.928-.788.928-1.353 0-.399-.151-.756-.453-1.073-.366-.386-.852-.58-1.459-.58a2.25 2.25 0 0 0-.96.2 1.617 1.617 0 0 0-.668.55c-.16.232-.28.544-.358.933l1.138.194c.032-.282.123-.495.272-.642.15-.146.33-.22.54-.22.215 0 .386.065.515.194s.193.302.193.518c0 .255-.087.46-.263.613-.176.154-.43.227-.765.218l-.136 1.006c.22-.061.409-.092.567-.092.24 0 .444.09.61.272.168.182.251.428.251.739 0 .328-.087.589-.261.782a.833.833 0 0 1-.644.29.841.841 0 0 1-.607-.242c-.167-.16-.27-.394-.307-.698l-1.196.145c.062.542.285.98.668 1.316.384.335.868.503 1.45.503zm4.43-.11v-1.235h-1.236V34h1.235z"/></svg>',r7='<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path 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-1h17zm0-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-1h17zm0-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-1h17z" fill-opacity=".163"/><path d="M5.714 15.11c.624 0 1.11-.22 1.46-.66.421-.533.632-1.408.632-2.627 0-1.222-.21-2.096-.629-2.624-.351-.445-.839-.668-1.463-.668-.624 0-1.11.22-1.459.66-.422.533-.633 1.406-.633 2.619 0 1.236.192 2.095.576 2.577.384.482.89.723 1.516.723zm0-1.024a.614.614 0 0 1-.398-.14c-.115-.094-.211-.283-.287-.565-.077-.283-.115-.802-.115-1.558s.043-1.294.128-1.613c.064-.246.155-.417.272-.512a.617.617 0 0 1 .4-.143.61.61 0 0 1 .398.143c.116.095.211.284.288.567.076.283.114.802.114 1.558s-.043 1.292-.128 1.608c-.064.246-.155.417-.272.512a.617.617 0 0 1-.4.143zm6.078.914V8.531H10.79c-.14.393-.4.736-.778 1.03-.378.295-.728.495-1.05.6v1.121a4.257 4.257 0 0 0 1.595-.936V15h1.235zm3.344 0v-1.235h-1.235V15h1.235zm-9.422 9.11c.624 0 1.11-.22 1.46-.66.421-.533.632-1.408.632-2.627 0-1.222-.21-2.096-.629-2.624-.351-.445-.839-.668-1.463-.668-.624 0-1.11.22-1.459.66-.422.533-.633 1.406-.633 2.619 0 1.236.192 2.095.576 2.577.384.482.89.723 1.516.723zm0-1.024a.614.614 0 0 1-.398-.14c-.115-.094-.211-.283-.287-.565-.077-.283-.115-.802-.115-1.558s.043-1.294.128-1.613c.064-.246.155-.417.272-.512a.617.617 0 0 1 .4-.143.61.61 0 0 1 .398.143c.116.095.211.284.288.567.076.283.114.802.114 1.558s-.043 1.292-.128 1.608c-.064.246-.155.417-.272.512a.617.617 0 0 1-.4.143zm7.088.914v-1.147H10.35c.065-.111.149-.226.253-.343.104-.117.35-.354.74-.712.39-.357.66-.631.81-.821.225-.288.39-.562.493-.824.104-.263.156-.539.156-.829 0-.51-.181-.936-.544-1.279-.364-.342-.863-.514-1.499-.514-.58 0-1.063.148-1.45.444-.387.296-.617.784-.69 1.463l1.23.124c.024-.36.112-.619.264-.774.152-.155.357-.233.615-.233.261 0 .465.074.613.222.148.148.222.36.222.635 0 .25-.085.501-.255.756-.126.185-.467.536-1.024 1.055-.691.641-1.154 1.156-1.388 1.544-.235.389-.375.8-.422 1.233h4.328zm2.334 0v-1.235h-1.235V24h1.235zM5.714 34.11c.624 0 1.11-.22 1.46-.66.421-.533.632-1.408.632-2.627 0-1.222-.21-2.096-.629-2.624-.351-.445-.839-.668-1.463-.668-.624 0-1.11.22-1.459.66-.422.533-.633 1.406-.633 2.619 0 1.236.192 2.095.576 2.577.384.482.89.723 1.516.723zm0-1.024a.614.614 0 0 1-.398-.14c-.115-.094-.211-.283-.287-.565-.077-.283-.115-.802-.115-1.558s.043-1.294.128-1.613c.064-.246.155-.417.272-.512a.617.617 0 0 1 .4-.143.61.61 0 0 1 .398.143c.116.095.211.284.288.567.076.283.114.802.114 1.558s-.043 1.292-.128 1.608c-.064.246-.155.417-.272.512a.617.617 0 0 1-.4.143zm4.992 1.024c.616 0 1.13-.2 1.543-.598.413-.398.62-.88.62-1.446 0-.39-.111-.722-.332-.997a1.5 1.5 0 0 0-.886-.532c.618-.337.927-.788.927-1.353 0-.399-.15-.756-.452-1.073-.366-.386-.853-.58-1.46-.58a2.25 2.25 0 0 0-.96.2 1.617 1.617 0 0 0-.667.55c-.16.232-.28.544-.359.933l1.139.194c.032-.282.123-.495.272-.642.15-.146.33-.22.54-.22.214 0 .386.065.515.194s.193.302.193.518c0 .255-.088.46-.264.613-.175.154-.43.227-.764.218l-.136 1.006c.22-.061.408-.092.566-.092.24 0 .444.09.611.272.167.182.25.428.25.739 0 .328-.086.589-.26.782a.833.833 0 0 1-.644.29.841.841 0 0 1-.607-.242c-.167-.16-.27-.394-.308-.698l-1.195.145c.062.542.284.98.668 1.316.384.335.867.503 1.45.503zm4.43-.11v-1.235h-1.235V34h1.235z"/></svg>',a7='<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path 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-1h17zm0-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-1h17zm0-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-1h17z" fill-opacity=".163"/><path d="M11.88 8.7V7.558h-1.234V8.7h1.234zm0 5.3V9.333h-1.234V14h1.234zm2.5 0v-1.235h-1.234V14h1.235zm-4.75 4.7v-1.142H8.395V18.7H9.63zm0 5.3v-4.667H8.395V24H9.63zm2.5-5.3v-1.142h-1.234V18.7h1.235zm0 5.3v-4.667h-1.234V24h1.235zm2.501 0v-1.235h-1.235V24h1.235zM7.38 28.7v-1.142H6.145V28.7H7.38zm0 5.3v-4.667H6.145V34H7.38zm2.5-5.3v-1.142H8.646V28.7H9.88zm0 5.3v-4.667H8.646V34H9.88zm2.5-5.3v-1.142h-1.234V28.7h1.235zm0 5.3v-4.667h-1.234V34h1.235zm2.501 0v-1.235h-1.235V34h1.235z"/></svg>',l7='<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path 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-1h17zm0-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-1h17zm0-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-1h17z" fill-opacity=".163"/><path d="M11.916 15V8.558h-1.301V15h1.3zm2.465 0v-1.235h-1.235V15h1.235zM9.665 25v-6.442h-1.3V25h1.3zm2.5 0v-6.442h-1.3V25h1.3zm2.466 0v-1.235h-1.235V25h1.235zm-7.216 9v-6.442h-1.3V34h1.3zm2.5 0v-6.442h-1.3V34h1.3zm2.501 0v-6.442h-1.3V34h1.3zm2.465 0v-1.235h-1.235V34h1.235z"/></svg>',c7='<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path 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-1h17zm0-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-1h17zm0-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-1h17z" fill-opacity=".163"/><path d="M9.62 14.105c.272 0 .528-.05.768-.153s.466-.257.677-.462c.009.024.023.072.044.145.047.161.086.283.119.365h1.221a2.649 2.649 0 0 1-.222-.626c-.04-.195-.059-.498-.059-.908l.013-1.441c0-.536-.055-.905-.165-1.105-.11-.201-.3-.367-.569-.497-.27-.13-.68-.195-1.23-.195-.607 0-1.064.108-1.371.325-.308.217-.525.55-.65 1.002l1.12.202c.076-.217.176-.369.299-.455.123-.086.294-.13.514-.13.325 0 .546.05.663.152.118.101.176.27.176.508v.123c-.222.093-.622.194-1.2.303-.427.082-.755.178-.982.288-.227.11-.403.268-.53.474a1.327 1.327 0 0 0-.188.706c0 .398.138.728.415.988.277.261.656.391 1.136.391zm.368-.87a.675.675 0 0 1-.492-.189.606.606 0 0 1-.193-.448c0-.176.08-.32.241-.435.106-.07.33-.142.673-.215a7.19 7.19 0 0 0 .751-.19v.247c0 .296-.016.496-.048.602a.773.773 0 0 1-.295.409 1.07 1.07 0 0 1-.637.22zm4.645.765v-1.235h-1.235V14h1.235zM10.2 25.105c.542 0 1.003-.215 1.382-.646.38-.43.57-1.044.57-1.84 0-.771-.187-1.362-.559-1.774a1.82 1.82 0 0 0-1.41-.617c-.522 0-.973.216-1.354.65v-2.32H7.594V25h1.147v-.686a1.9 1.9 0 0 0 .67.592c.26.133.523.2.79.2zm-.299-.975c-.354 0-.638-.164-.852-.492-.153-.232-.229-.59-.229-1.073 0-.468.098-.818.295-1.048a.93.93 0 0 1 .738-.345c.302 0 .55.118.743.354.193.236.29.62.29 1.154 0 .5-.096.868-.288 1.1-.192.233-.424.35-.697.35zm4.478.87v-1.235h-1.234V25h1.234zm-4.017 9.105c.6 0 1.08-.142 1.437-.426.357-.284.599-.704.725-1.261l-1.213-.207c-.061.326-.167.555-.316.688a.832.832 0 0 1-.576.2.916.916 0 0 1-.75-.343c-.185-.228-.278-.62-.278-1.173 0-.498.091-.853.274-1.066.183-.212.429-.318.736-.318.232 0 .42.061.565.184.145.123.238.306.28.55l1.216-.22c-.146-.501-.387-.874-.722-1.119-.336-.244-.788-.366-1.356-.366-.695 0-1.245.214-1.653.643-.407.43-.61 1.03-.61 1.8 0 .762.202 1.358.608 1.788.406.431.95.646 1.633.646zM14.633 34v-1.235h-1.235V34h1.235z"/></svg>',u7='<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path 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-1h17zm0-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-1h17zm0-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-1h17z" fill-opacity=".163"/><path d="m7.88 15 .532-1.463h2.575L11.549 15h1.415l-2.58-6.442H9.01L6.5 15h1.38zm2.69-2.549H8.811l.87-2.39.887 2.39zM14.88 15v-1.235h-1.234V15h1.234zM9.352 25c.83-.006 1.352-.02 1.569-.044.346-.038.636-.14.872-.305.236-.166.422-.387.558-.664.137-.277.205-.562.205-.855 0-.372-.106-.695-.317-.97-.21-.276-.512-.471-.905-.585a1.51 1.51 0 0 0 .661-.567 1.5 1.5 0 0 0 .244-.83c0-.28-.066-.53-.197-.754a1.654 1.654 0 0 0-.495-.539 1.676 1.676 0 0 0-.672-.266c-.25-.042-.63-.063-1.14-.063H7.158V25h2.193zm.142-3.88H8.46v-1.49h.747c.612 0 .983.007 1.112.022.217.026.38.102.49.226.11.125.165.287.165.486a.68.68 0 0 1-.192.503.86.86 0 0 1-.525.23 11.47 11.47 0 0 1-.944.023h.18zm.17 2.795H8.46v-1.723h1.05c.592 0 .977.03 1.154.092.177.062.313.16.406.295a.84.84 0 0 1 .14.492c0 .228-.06.41-.181.547a.806.806 0 0 1-.473.257c-.126.026-.423.04-.892.04zM14.88 25v-1.235h-1.234V25h1.234zm-5.018 9.11c.691 0 1.262-.17 1.711-.512.45-.341.772-.864.965-1.567l-1.261-.4c-.109.472-.287.818-.536 1.037-.25.22-.547.33-.892.33-.47 0-.85-.173-1.143-.519-.293-.345-.44-.925-.44-1.74 0-.767.15-1.322.447-1.665.297-.343.684-.514 1.162-.514.346 0 .64.096.881.29.242.193.4.457.477.79l1.288-.307c-.147-.516-.367-.911-.66-1.187-.492-.465-1.132-.698-1.92-.698-.902 0-1.63.296-2.184.89-.554.593-.83 1.426-.83 2.498 0 1.014.275 1.813.825 2.397.551.585 1.254.877 2.11.877zM14.88 34v-1.235h-1.234V34h1.234z"/></svg>';/**
|
|
1296
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1297
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1298
|
+
*/class d7 extends w{static get pluginName(){return"ListPropertiesUI"}init(){const e=this.editor,t=e.locale.t,i=e.config.get("list.properties");i.styles&&e.ui.componentFactory.add("bulletedList",kd({editor:e,parentCommandName:"bulletedList",buttonLabel:t("Bulleted List"),buttonIcon:I.bulletedList,styleGridAriaLabel:t("Bulleted list styles toolbar"),styleDefinitions:[{label:t("Toggle the disc list style"),tooltip:t("Disc"),type:"disc",icon:i7},{label:t("Toggle the circle list style"),tooltip:t("Circle"),type:"circle",icon:n7},{label:t("Toggle the square list style"),tooltip:t("Square"),type:"square",icon:s7}]})),(i.styles||i.startIndex||i.reversed)&&e.ui.componentFactory.add("numberedList",kd({editor:e,parentCommandName:"numberedList",buttonLabel:t("Numbered List"),buttonIcon:I.numberedList,styleGridAriaLabel:t("Numbered list styles toolbar"),styleDefinitions:[{label:t("Toggle the decimal list style"),tooltip:t("Decimal"),type:"decimal",icon:o7},{label:t("Toggle the decimal with leading zero list style"),tooltip:t("Decimal with leading zero"),type:"decimal-leading-zero",icon:r7},{label:t("Toggle the lower–roman list style"),tooltip:t("Lower–roman"),type:"lower-roman",icon:a7},{label:t("Toggle the upper–roman list style"),tooltip:t("Upper-roman"),type:"upper-roman",icon:l7},{label:t("Toggle the lower–latin list style"),tooltip:t("Lower-latin"),type:"lower-latin",icon:c7},{label:t("Toggle the upper–latin list style"),tooltip:t("Upper-latin"),type:"upper-latin",icon:u7}]}))}}function kd({editor:n,parentCommandName:e,buttonLabel:t,buttonIcon:i,styleGridAriaLabel:s,styleDefinitions:o}){const r=n.commands.get(e);return a=>{const l=fe(a,Qi),c=l.buttonView;return l.bind("isEnabled").to(r),l.class="ck-list-styles-dropdown",c.on("execute",()=>{n.execute(e),n.editing.view.focus()}),c.set({label:t,icon:i,tooltip:!0,isToggleable:!0}),c.bind("isOn").to(r,"value",u=>!!u),l.once("change:isOpen",()=>{const u=f7({editor:n,dropdownView:l,parentCommandName:e,styleGridAriaLabel:s,styleDefinitions:o});l.panelView.children.add(u)}),l.on("execute",()=>{n.editing.view.focus()}),l}}function h7({editor:n,listStyleCommand:e,parentCommandName:t}){const i=n.locale,s=n.commands.get(t);return({label:o,type:r,icon:a,tooltip:l})=>{const c=new B(i);return c.set({label:o,icon:a,tooltip:l}),e.on("change:value",()=>{c.isOn=e.value===r}),c.on("execute",()=>{s.value?e.value!==r?n.execute("listStyle",{type:r}):n.execute("listStyle",{type:e.defaultType}):n.model.change(()=>{n.execute("listStyle",{type:r})})}),c}}function f7({editor:n,dropdownView:e,parentCommandName:t,styleDefinitions:i,styleGridAriaLabel:s}){const o=n.locale,r=n.config.get("list.properties");let a=null;if(t!="numberedList"&&(r.startIndex=!1,r.reversed=!1),r.styles){const c=n.commands.get("listStyle"),u=h7({editor:n,parentCommandName:t,listStyleCommand:c}),d=typeof c.isStyleTypeSupported=="function"?h=>c.isStyleTypeSupported(h.type):()=>!0;a=i.filter(d).map(u)}const l=new t7(o,{styleGridAriaLabel:s,enabledProperties:r,styleButtonViews:a});if(r.styles&&wo(e,()=>l.stylesView.children.find(c=>c.isOn)),r.startIndex){const c=n.commands.get("listStart");l.startIndexFieldView.bind("isEnabled").to(c),l.startIndexFieldView.fieldView.bind("value").to(c),l.on("listStart",(u,d)=>n.execute("listStart",d))}if(r.reversed){const c=n.commands.get("listReversed");l.reversedSwitchButtonView.bind("isEnabled").to(c),l.reversedSwitchButtonView.bind("isOn").to(c,"value",u=>!!u),l.on("listReversed",()=>{const u=c.value;n.execute("listReversed",{reversed:!u})})}return l.delegate("execute").to(e),l}/**
|
|
1299
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1300
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1301
|
+
*/class m7 extends w{static get requires(){return[X4,d7]}static get pluginName(){return"ListProperties"}}/**
|
|
1302
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1303
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1304
|
+
*/Gn("Ctrl+Enter");/**
|
|
1305
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1306
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1307
|
+
*/Gn("Ctrl+Enter");/**
|
|
1308
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1309
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1310
|
+
*/function oe(n,e,t,i,s=1){e!=null&&s!==void 0&&s!==null&&e>s?i.setAttribute(n,e,t):i.removeAttribute(n,t)}function gi(n,e,t={}){const i=n.createElement("tableCell",t);return n.insertElement("paragraph",i),n.insert(i,e),i}function ta(n,e){const t=e.parent.parent,i=parseInt(t.getAttribute("headingColumns")||"0"),{column:s}=n.getCellLocation(e);return!!i&&s<i}/**
|
|
1311
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1312
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1313
|
+
*/function g7(){return n=>{n.on("element:figure",(e,t,i)=>{if(!i.consumable.test(t.viewItem,{name:!0,classes:"table"}))return;const s=b7(t.viewItem);if(!s||!i.consumable.test(s,{name:!0}))return;i.consumable.consume(t.viewItem,{name:!0,classes:"table"});const o=i.convertItem(s,t.modelCursor),r=J(o.modelRange.getItems());if(!r){i.consumable.revert(t.viewItem,{name:!0,classes:"table"});return}i.convertChildren(t.viewItem,i.writer.createPositionAt(r,"end")),i.updateConversionResult(r,t)})}}function p7(){return n=>{n.on("element:table",(e,t,i)=>{const s=t.viewItem;if(!i.consumable.test(s,{name:!0}))return;const{rows:o,headingRows:r,headingColumns:a}=_7(s),l={};a&&(l.headingColumns=a),r&&(l.headingRows=r);const c=i.writer.createElement("table",l);if(i.safeInsert(c,t.modelCursor)){if(i.consumable.consume(s,{name:!0}),o.forEach(u=>i.convertItem(u,i.writer.createPositionAt(c,"end"))),i.convertChildren(s,i.writer.createPositionAt(c,"end")),c.isEmpty){const u=i.writer.createElement("tableRow");i.writer.insert(u,i.writer.createPositionAt(c,"end")),gi(i.writer,i.writer.createPositionAt(u,"end"))}i.updateConversionResult(c,t)}})}}function w7(){return n=>{n.on("element:tr",(e,t)=>{t.viewItem.isEmpty&&t.modelCursor.index==0&&e.stop()},{priority:"high"})}}function Ed(n){return e=>{e.on(`element:${n}`,(t,i,{writer:s})=>{if(!i.modelRange)return;const o=i.modelRange.start.nodeAfter,r=s.createPositionAt(o,0);if(i.viewItem.isEmpty){s.insertElement("paragraph",r);return}const a=Array.from(o.getChildren());if(a.every(l=>l.is("element","$marker"))){const l=s.createElement("paragraph");s.insert(l,s.createPositionAt(o,0));for(const c of a)s.move(s.createRangeOn(c),s.createPositionAt(l,"end"))}},{priority:"low"})}}function b7(n){for(const e of n.getChildren())if(e.is("element","table"))return e}function _7(n){let e=0,t;const i=[],s=[];let o;for(const r of Array.from(n.getChildren())){if(r.name!=="tbody"&&r.name!=="thead"&&r.name!=="tfoot")continue;r.name==="thead"&&!o&&(o=r);const a=Array.from(r.getChildren()).filter(l=>l.is("element","tr"));for(const l of a)if(o&&r===o||r.name==="tbody"&&Array.from(l.getChildren()).length&&Array.from(l.getChildren()).every(c=>c.is("element","th")))e++,i.push(l);else{s.push(l);const c=v7(l);(!t||c<t)&&(t=c)}}return{headingRows:e,headingColumns:t||0,rows:[...i,...s]}}function v7(n){let e=0,t=0;const i=Array.from(n.getChildren()).filter(s=>s.name==="th"||s.name==="td");for(;t<i.length&&i[t].name==="th";){const s=i[t],o=parseInt(s.getAttribute("colspan")||"1");e=e+o,t++}return e}/**
|
|
1314
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1315
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1316
|
+
*/class q{constructor(e,t={}){this._jumpedToStartRow=!1,this._table=e,this._startRow=t.row!==void 0?t.row:t.startRow||0,this._endRow=t.row!==void 0?t.row:t.endRow,this._startColumn=t.column!==void 0?t.column:t.startColumn||0,this._endColumn=t.column!==void 0?t.column:t.endColumn,this._includeAllSlots=!!t.includeAllSlots,this._skipRows=new Set,this._row=0,this._rowIndex=0,this._column=0,this._cellIndex=0,this._spannedCells=new Map,this._nextCellAtColumn=-1}[Symbol.iterator](){return this}next(){this._canJumpToStartRow()&&this._jumpToNonSpannedRowClosestToStartRow();const e=this._table.getChild(this._rowIndex);if(!e||this._isOverEndRow())return{done:!0,value:void 0};if(!e.is("element","tableRow"))return this._rowIndex++,this.next();if(this._isOverEndColumn())return this._advanceToNextRow();let t=null;const i=this._getSpanned();if(i)this._includeAllSlots&&!this._shouldSkipSlot()&&(t=this._formatOutValue(i.cell,i.row,i.column));else{const s=e.getChild(this._cellIndex);if(!s)return this._advanceToNextRow();const o=parseInt(s.getAttribute("colspan")||"1"),r=parseInt(s.getAttribute("rowspan")||"1");(o>1||r>1)&&this._recordSpans(s,r,o),this._shouldSkipSlot()||(t=this._formatOutValue(s)),this._nextCellAtColumn=this._column+o}return this._column++,this._column==this._nextCellAtColumn&&this._cellIndex++,t||this.next()}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,i=this._column){return{done:!1,value:new y7(this,e,t,i)}}_shouldSkipSlot(){const e=this._skipRows.has(this._row),t=this._row<this._startRow,i=this._column<this._startColumn,s=this._endColumn!==void 0&&this._column>this._endColumn;return e||t||i||s}_getSpanned(){const e=this._spannedCells.get(this._row);return e&&e.get(this._column)||null}_recordSpans(e,t,i){const s={cell:e,row:this._row,column:this._column};for(let o=this._row;o<this._row+t;o++)for(let r=this._column;r<this._column+i;r++)(o!=this._row||r!=this._column)&&this._markSpannedCell(o,r,s)}_markSpannedCell(e,t,i){this._spannedCells.has(e)||this._spannedCells.set(e,new Map),this._spannedCells.get(e).set(t,i)}_canJumpToStartRow(){return!!this._startRow&&this._startRow>0&&!this._jumpedToStartRow}_jumpToNonSpannedRowClosestToStartRow(){const e=this._getRowLength(0);for(let t=this._startRow;!this._jumpedToStartRow;t--)e===this._getRowLength(t)&&(this._row=t,this._rowIndex=t,this._jumpedToStartRow=!0)}_getRowLength(e){return[...this._table.getChild(e).getChildren()].reduce((i,s)=>i+parseInt(s.getAttribute("colspan")||"1"),0)}}class y7{constructor(e,t,i,s){this.cell=t,this.row=e._row,this.column=e._column,this.cellAnchorRow=i,this.cellAnchorColumn=s,this._cellIndex=e._cellIndex,this._rowIndex=e._rowIndex,this._table=e._table}get isAnchor(){return this.row===this.cellAnchorRow&&this.column===this.cellAnchorColumn}get cellWidth(){return parseInt(this.cell.getAttribute("colspan")||"1")}get cellHeight(){return parseInt(this.cell.getAttribute("rowspan")||"1")}get rowIndex(){return this._rowIndex}getPositionBefore(){return this._table.root.document.model.createPositionAt(this._table.getChild(this.row),this._cellIndex)}}/**
|
|
1317
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1318
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1319
|
+
*/function Td(n,e){return(t,{writer:i})=>{const s=t.getAttribute("headingRows")||0,o=i.createContainerElement("table",null,[]),r=i.createContainerElement("figure",{class:"table"},o);s>0&&i.insert(i.createPositionAt(o,"end"),i.createContainerElement("thead",null,i.createSlot(a=>a.is("element","tableRow")&&a.index<s))),s<n.getRows(t)&&i.insert(i.createPositionAt(o,"end"),i.createContainerElement("tbody",null,i.createSlot(a=>a.is("element","tableRow")&&a.index>=s)));for(const{positionOffset:a,filter:l}of e.additionalSlots)i.insert(i.createPositionAt(o,a),i.createSlot(l));return i.insert(i.createPositionAt(o,"after"),i.createSlot(a=>a.is("element","tableRow")?!1:!e.additionalSlots.some(({filter:l})=>l(a)))),e.asWidget?k7(r,i):r}}function C7(){return(n,{writer:e})=>n.isEmpty?e.createEmptyElement("tr"):e.createContainerElement("tr")}function Ad(n={}){return(e,{writer:t})=>{const i=e.parent,s=i.parent,o=s.getChildIndex(i),r=new q(s,{row:o}),a=s.getAttribute("headingRows")||0,l=s.getAttribute("headingColumns")||0;let c=null;for(const u of r)if(u.cell==e){const h=u.row<a||u.column<l?"th":"td";c=n.asWidget?xg(t.createEditableElement(h),t):t.createContainerElement(h);break}return c}}function Sd(n={}){return(e,{writer:t})=>{if(!e.parent.is("element","tableCell")||!kp(e))return null;if(n.asWidget)return t.createContainerElement("span",{class:"ck-table-bogus-paragraph"});{const i=t.createContainerElement("p");return t.setCustomProperty("dataPipeline:transparentRendering",!0,i),i}}}function kp(n){return n.parent.childCount==1&&!E7(n)}function k7(n,e){return e.setCustomProperty("table",!0,n),Xi(n,e,{hasSelectionHandle:!0})}function E7(n){return!n.getAttributeKeys().next().done}/**
|
|
1320
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1321
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1322
|
+
*/class T7 extends R{refresh(){const e=this.editor.model,t=e.document.selection,i=e.schema;this.isEnabled=A7(t,i)}execute(e={}){const t=this.editor,i=t.model,s=t.plugins.get("TableUtils"),o=t.config.get("table.defaultHeadings.rows"),r=t.config.get("table.defaultHeadings.columns");e.headingRows===void 0&&o&&(e.headingRows=o),e.headingColumns===void 0&&r&&(e.headingColumns=r),i.change(a=>{const l=s.createTable(a,e);i.insertObject(l,null,null,{findOptimalPosition:"auto"}),a.setSelection(a.createPositionAt(l.getNodeByPath([0,0,0]),0))})}}function A7(n,e){const t=n.getFirstPosition().parent,i=t===t.root?t:t.parent;return e.checkChild(i,"table")}/**
|
|
1323
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1324
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1325
|
+
*/class xd extends R{constructor(e,t={}){super(e),this.order=t.order||"below"}refresh(){const e=this.editor.model.document.selection,i=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=i}execute(){const e=this.editor,t=e.model.document.selection,i=e.plugins.get("TableUtils"),s=this.order==="above",o=i.getSelectionAffectedTableCells(t),r=i.getRowIndexes(o),a=s?r.first:r.last,l=o[0].findAncestor("table");i.insertRows(l,{at:s?a:a+1,copyStructureFromAbove:!s})}}/**
|
|
1326
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1327
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1328
|
+
*/class Id extends R{constructor(e,t={}){super(e),this.order=t.order||"right"}refresh(){const e=this.editor.model.document.selection,i=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=i}execute(){const e=this.editor,t=e.model.document.selection,i=e.plugins.get("TableUtils"),s=this.order==="left",o=i.getSelectionAffectedTableCells(t),r=i.getColumnIndexes(o),a=s?r.first:r.last,l=o[0].findAncestor("table");i.insertColumns(l,{columns:1,at:s?a:a+1})}}/**
|
|
1329
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1330
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1331
|
+
*/class Pd extends R{constructor(e,t={}){super(e),this.direction=t.direction||"horizontally"}refresh(){const t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=t.length===1}execute(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection)[0];this.direction==="horizontally"?e.splitCellHorizontally(t,2):e.splitCellVertically(t,2)}}/**
|
|
1332
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1333
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1334
|
+
*/function Ep(n,e,t){const{startRow:i,startColumn:s,endRow:o,endColumn:r}=e,a=t.createElement("table"),l=o-i+1;for(let u=0;u<l;u++)t.insertElement("tableRow",a,"end");const c=[...new q(n,{startRow:i,endRow:o,startColumn:s,endColumn:r,includeAllSlots:!0})];for(const{row:u,column:d,cell:h,isAnchor:f,cellAnchorRow:m,cellAnchorColumn:p}of c){const _=u-i,C=a.getChild(_);if(!f)(m<i||p<s)&&gi(t,t.createPositionAt(C,"end"));else{const v=t.cloneElement(h);t.append(v,C),Ip(v,u,d,o,r,t)}}return S7(a,n,i,s,t),a}function Tp(n,e,t=0){const i=[],s=new q(n,{startRow:t,endRow:e-1});for(const o of s){const{row:r,cellHeight:a}=o,l=r+a-1;r<e&&e<=l&&i.push(o)}return i}function Ap(n,e,t){const i=n.parent,s=i.parent,o=i.index,r=parseInt(n.getAttribute("rowspan")),a=e-o,l={},c=r-a;c>1&&(l.rowspan=c);const u=parseInt(n.getAttribute("colspan")||"1");u>1&&(l.colspan=u);const d=o,h=d+a,f=[...new q(s,{startRow:d,endRow:h,includeAllSlots:!0})];let m=null,p;for(const _ of f){const{row:C,column:v,cell:P}=_;P===n&&p===void 0&&(p=v),p!==void 0&&p===v&&C===h&&(m=gi(t,_.getPositionBefore(),l))}return oe("rowspan",a,n,t),m}function Sp(n,e){const t=[],i=new q(n);for(const s of i){const{column:o,cellWidth:r}=s,a=o+r-1;o<e&&e<=a&&t.push(s)}return t}function xp(n,e,t,i){const s=parseInt(n.getAttribute("colspan")),o=t-e,r={},a=s-o;a>1&&(r.colspan=a);const l=parseInt(n.getAttribute("rowspan")||"1");l>1&&(r.rowspan=l);const c=gi(i,i.createPositionAfter(n),r);return oe("colspan",o,n,i),c}function Ip(n,e,t,i,s,o){const r=parseInt(n.getAttribute("colspan")||"1"),a=parseInt(n.getAttribute("rowspan")||"1");if(t+r-1>s){const u=s-t+1;oe("colspan",u,n,o,1)}if(e+a-1>i){const u=i-e+1;oe("rowspan",u,n,o,1)}}function S7(n,e,t,i,s){const o=parseInt(e.getAttribute("headingRows")||"0");if(o>0){const a=o-t;oe("headingRows",a,n,s,0)}const r=parseInt(e.getAttribute("headingColumns")||"0");if(r>0){const a=r-i;oe("headingColumns",a,n,s,0)}}function ia(n,e){const t=e.getColumns(n),i=new Array(t).fill(0);for(const{column:o}of new q(n))i[o]++;const s=i.reduce((o,r,a)=>r?o:[...o,a],[]);if(s.length>0){const o=s[s.length-1];return e.removeColumns(n,{at:o}),!0}return!1}function na(n,e){const t=[],i=e.getRows(n);for(let s=0;s<i;s++)n.getChild(s).isEmpty&&t.push(s);if(t.length>0){const s=t[t.length-1];return e.removeRows(n,{at:s}),!0}return!1}function al(n,e){ia(n,e)||na(n,e)}function Pp(n,e){const t=Array.from(new q(n,{startColumn:e.firstColumn,endColumn:e.lastColumn,row:e.lastRow}));if(t.every(({cellHeight:o})=>o===1))return e.lastRow;const s=t[0].cellHeight-1;return e.lastRow+s}function Rp(n,e){const t=Array.from(new q(n,{startRow:e.firstRow,endRow:e.lastRow,column:e.lastColumn}));if(t.every(({cellWidth:o})=>o===1))return e.lastColumn;const s=t[0].cellWidth-1;return e.lastColumn+s}/**
|
|
1335
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1336
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1337
|
+
*/class Cs extends R{constructor(e,t){super(e),this.direction=t.direction,this.isHorizontal=this.direction=="right"||this.direction=="left"}refresh(){const e=this._getMergeableCell();this.value=e,this.isEnabled=!!e}execute(){const e=this.editor.model,t=e.document,s=this.editor.plugins.get("TableUtils").getTableCellsContainingSelection(t.selection)[0],o=this.value,r=this.direction;e.change(a=>{const l=r=="right"||r=="down",c=l?s:o,u=l?o:s,d=u.parent;P7(u,c,a);const h=this.isHorizontal?"colspan":"rowspan",f=parseInt(s.getAttribute(h)||"1"),m=parseInt(o.getAttribute(h)||"1");a.setAttribute(h,f+m,c),a.setSelection(a.createRangeIn(c));const p=this.editor.plugins.get("TableUtils"),_=d.findAncestor("table");al(_,p)})}_getMergeableCell(){const t=this.editor.model.document,i=this.editor.plugins.get("TableUtils"),s=i.getTableCellsContainingSelection(t.selection)[0];if(!s)return;const o=this.isHorizontal?x7(s,this.direction,i):I7(s,this.direction,i);if(!o)return;const r=this.isHorizontal?"rowspan":"colspan",a=parseInt(s.getAttribute(r)||"1");if(parseInt(o.getAttribute(r)||"1")===a)return o}}function x7(n,e,t){const s=n.parent.parent,o=e=="right"?n.nextSibling:n.previousSibling,r=(s.getAttribute("headingColumns")||0)>0;if(!o)return;const a=e=="right"?n:o,l=e=="right"?o:n,{column:c}=t.getCellLocation(a),{column:u}=t.getCellLocation(l),d=parseInt(a.getAttribute("colspan")||"1"),h=ta(t,a),f=ta(t,l);return r&&h!=f?void 0:c+d===u?o:void 0}function I7(n,e,t){const i=n.parent,s=i.parent,o=s.getChildIndex(i);if(e=="down"&&o===t.getRows(s)-1||e=="up"&&o===0)return null;const r=parseInt(n.getAttribute("rowspan")||"1"),a=s.getAttribute("headingRows")||0,l=e=="down"&&o+r===a,c=e=="up"&&o===a;if(a&&(l||c))return null;const u=parseInt(n.getAttribute("rowspan")||"1"),d=e=="down"?o+u:o,h=[...new q(s,{endRow:d})],m=h.find(_=>_.cell===n).column,p=h.find(({row:_,cellHeight:C,column:v})=>v!==m?!1:e=="down"?_===d:d===_+C);return p&&p.cell?p.cell:null}function P7(n,e,t){Rd(n)||(Rd(e)&&t.remove(t.createRangeIn(e)),t.move(t.createRangeIn(n),t.createPositionAt(e,"end"))),t.remove(n)}function Rd(n){const e=n.getChild(0);return n.childCount==1&&e.is("element","paragraph")&&e.isEmpty}/**
|
|
1338
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1339
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1340
|
+
*/class R7 extends R{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),i=t[0];if(i){const s=i.findAncestor("table"),r=e.getRows(s)-1,a=e.getRowIndexes(t),l=a.first===0&&a.last===r;this.isEnabled=!l}else this.isEnabled=!1}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),i=t.getSelectionAffectedTableCells(e.document.selection),s=t.getRowIndexes(i),o=i[0],r=o.findAncestor("table"),a=t.getCellLocation(o).column;e.change(l=>{const c=s.last-s.first+1;t.removeRows(r,{at:s.first,rows:c});const u=V7(r,s.first,a,t.getRows(r));l.setSelection(l.createPositionAt(u,0))})}}function V7(n,e,t,i){const s=n.getChild(Math.min(e,i-1));let o=s.getChild(0),r=0;for(const a of s.getChildren()){if(r>t)return o;o=a,r+=parseInt(a.getAttribute("colspan")||"1")}return o}/**
|
|
1341
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1342
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1343
|
+
*/class L7 extends R{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),i=t[0];if(i){const s=i.findAncestor("table"),o=e.getColumns(s),{first:r,last:a}=e.getColumnIndexes(t);this.isEnabled=a-r<o-1}else this.isEnabled=!1}execute(){const e=this.editor.plugins.get("TableUtils"),[t,i]=O7(this.editor.model.document.selection,e),s=t.parent.parent,o=[...new q(s)],r={first:o.find(l=>l.cell===t).column,last:o.find(l=>l.cell===i).column},a=B7(o,t,i,r);this.editor.model.change(l=>{const c=r.last-r.first+1;e.removeColumns(s,{at:r.first,columns:c}),l.setSelection(l.createPositionAt(a,0))})}}function B7(n,e,t,i){return parseInt(t.getAttribute("colspan")||"1")>1?t:e.previousSibling||t.nextSibling?t.nextSibling||e.previousSibling:i.first?n.reverse().find(({column:o})=>o<i.first).cell:n.reverse().find(({column:o})=>o>i.last).cell}function O7(n,e){const t=e.getSelectionAffectedTableCells(n),i=t[0],s=t.pop(),o=[i,s];return i.isBefore(s)?o:o.reverse()}/**
|
|
1344
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1345
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1346
|
+
*/class M7 extends R{refresh(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,i=e.getSelectionAffectedTableCells(t.document.selection),s=i.length>0;this.isEnabled=s,this.value=s&&i.every(o=>this._isInHeading(o,o.parent.parent))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),i=this.editor.model,s=t.getSelectionAffectedTableCells(i.document.selection),o=s[0].findAncestor("table"),{first:r,last:a}=t.getRowIndexes(s),l=this.value?r:a+1,c=o.getAttribute("headingRows")||0;i.change(u=>{if(l){const d=l>c?c:0,h=Tp(o,l,d);for(const{cell:f}of h)Ap(f,l,u)}oe("headingRows",l,o,u,0)})}_isInHeading(e,t){const i=parseInt(t.getAttribute("headingRows")||"0");return!!i&&e.parent.index<i}}/**
|
|
1347
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1348
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1349
|
+
*/class F7 extends R{refresh(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),i=t.getSelectionAffectedTableCells(e.document.selection),s=i.length>0;this.isEnabled=s,this.value=s&&i.every(o=>ta(t,o))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),i=this.editor.model,s=t.getSelectionAffectedTableCells(i.document.selection),o=s[0].findAncestor("table"),{first:r,last:a}=t.getColumnIndexes(s),l=this.value?r:a+1;i.change(c=>{if(l){const u=Sp(o,l);for(const{cell:d,column:h}of u)xp(d,h,l,c)}oe("headingColumns",l,o,c,0)})}}/**
|
|
1350
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1351
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1352
|
+
*/function D7(n){if(n.is("element","tableColumnGroup"))return n;const e=n.getChildren();return Array.from(e).find(t=>t.is("element","tableColumnGroup"))}function N7(n){const e=D7(n);return e?Array.from(e.getChildren()):[]}/**
|
|
1353
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1354
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1355
|
+
*/class Ce extends w{static get pluginName(){return"TableUtils"}init(){this.decorate("insertColumns"),this.decorate("insertRows")}getCellLocation(e){const t=e.parent,i=t.parent,s=i.getChildIndex(t),o=new q(i,{row:s});for(const{cell:r,row:a,column:l}of o)if(r===e)return{row:a,column:l};/* istanbul ignore next -- @preserve */}createTable(e,t){const i=e.createElement("table"),s=t.rows||2,o=t.columns||2;return sr(e,i,0,s,o),t.headingRows&&oe("headingRows",Math.min(t.headingRows,s),i,e,0),t.headingColumns&&oe("headingColumns",Math.min(t.headingColumns,o),i,e,0),i}insertRows(e,t={}){const i=this.editor.model,s=t.at||0,o=t.rows||1,r=t.copyStructureFromAbove!==void 0,a=t.copyStructureFromAbove?s-1:s,l=this.getRows(e),c=this.getColumns(e);if(s>l)throw new g("tableutils-insertrows-insert-out-of-range",this,{options:t});i.change(u=>{const d=e.getAttribute("headingRows")||0;if(d>s&&oe("headingRows",d+o,e,u,0),!r&&(s===0||s===l)){sr(u,e,s,o,c);return}const h=r?Math.max(s,a):s,f=new q(e,{endRow:h}),m=new Array(c).fill(1);for(const{row:p,column:_,cellHeight:C,cellWidth:v,cell:P}of f){const M=p+C-1,D=p<s&&s<=M,A=p<=a&&a<=M;D?(u.setAttribute("rowspan",C+o,P),m[_]=-v):r&&A&&(m[_]=v)}for(let p=0;p<o;p++){const _=u.createElement("tableRow");u.insert(_,e,s);for(let C=0;C<m.length;C++){const v=m[C],P=u.createPositionAt(_,"end");v>0&&gi(u,P,v>1?{colspan:v}:void 0),C+=Math.abs(v)-1}}})}insertColumns(e,t={}){const i=this.editor.model,s=t.at||0,o=t.columns||1;i.change(r=>{const a=e.getAttribute("headingColumns");s<a&&r.setAttribute("headingColumns",a+o,e);const l=this.getColumns(e);if(s===0||l===s){for(const u of e.getChildren())u.is("element","tableRow")&&Vi(o,r,r.createPositionAt(u,s?"end":0));return}const c=new q(e,{column:s,includeAllSlots:!0});for(const u of c){const{row:d,cell:h,cellAnchorColumn:f,cellAnchorRow:m,cellWidth:p,cellHeight:_}=u;if(f<s){r.setAttribute("colspan",p+o,h);const C=m+_-1;for(let v=d;v<=C;v++)c.skipRow(v)}else Vi(o,r,u.getPositionBefore())}})}removeRows(e,t){const i=this.editor.model,s=t.rows||1,o=this.getRows(e),r=t.at,a=r+s-1;if(a>o-1)throw new g("tableutils-removerows-row-index-out-of-range",this,{table:e,options:t});i.change(l=>{const c={first:r,last:a},{cellsToMove:u,cellsToTrim:d}=H7(e,c);if(u.size){const h=a+1;U7(e,h,u,l)}for(let h=a;h>=r;h--)l.remove(e.getChild(h));for(const{rowspan:h,cell:f}of d)oe("rowspan",h,f,l);z7(e,c,l),ia(e,this)||na(e,this)})}removeColumns(e,t){const i=this.editor.model,s=t.at,o=t.columns||1,r=t.at+o-1;i.change(a=>{$7(e,{first:s,last:r},a);const l=N7(e);for(let c=r;c>=s;c--){for(const{cell:u,column:d,cellWidth:h}of[...new q(e)])d<=c&&h>1&&d+h>c?oe("colspan",h-1,u,a):d===c&&a.remove(u);if(l[c]){const u=c===0?l[1]:l[c-1],d=parseFloat(l[c].getAttribute("columnWidth")),h=parseFloat(u.getAttribute("columnWidth"));a.remove(l[c]),a.setAttribute("columnWidth",d+h+"%",u)}}na(e,this)||ia(e,this)})}splitCellVertically(e,t=2){const i=this.editor.model,o=e.parent.parent,r=parseInt(e.getAttribute("rowspan")||"1"),a=parseInt(e.getAttribute("colspan")||"1");i.change(l=>{if(a>1){const{newCellsSpan:c,updatedSpan:u}=Vd(a,t);oe("colspan",u,e,l);const d={};c>1&&(d.colspan=c),r>1&&(d.rowspan=r);const h=a>t?t-1:a-1;Vi(h,l,l.createPositionAfter(e),d)}if(a<t){const c=t-a,u=[...new q(o)],{column:d}=u.find(({cell:p})=>p===e),h=u.filter(({cell:p,cellWidth:_,column:C})=>{const v=p!==e&&C===d,P=C<d&&C+_>d;return v||P});for(const{cell:p,cellWidth:_}of h)l.setAttribute("colspan",_+c,p);const f={};r>1&&(f.rowspan=r),Vi(c,l,l.createPositionAfter(e),f);const m=o.getAttribute("headingColumns")||0;m>d&&oe("headingColumns",m+c,o,l)}})}splitCellHorizontally(e,t=2){const i=this.editor.model,s=e.parent,o=s.parent,r=o.getChildIndex(s),a=parseInt(e.getAttribute("rowspan")||"1"),l=parseInt(e.getAttribute("colspan")||"1");i.change(c=>{if(a>1){const u=[...new q(o,{startRow:r,endRow:r+a-1,includeAllSlots:!0})],{newCellsSpan:d,updatedSpan:h}=Vd(a,t);oe("rowspan",h,e,c);const{column:f}=u.find(({cell:p})=>p===e),m={};d>1&&(m.rowspan=d),l>1&&(m.colspan=l);for(const p of u){const{column:_,row:C}=p,v=C>=r+h,P=_===f,M=(C+r+h)%d===0;v&&P&&M&&Vi(1,c,p.getPositionBefore(),m)}}if(a<t){const u=t-a,d=[...new q(o,{startRow:0,endRow:r})];for(const{cell:m,cellHeight:p,row:_}of d)if(m!==e&&_+p>r){const C=p+u;c.setAttribute("rowspan",C,m)}const h={};l>1&&(h.colspan=l),sr(c,o,r+1,u,1,h);const f=o.getAttribute("headingRows")||0;f>r&&oe("headingRows",f+u,o,c)}})}getColumns(e){return[...e.getChild(0).getChildren()].reduce((i,s)=>{const o=parseInt(s.getAttribute("colspan")||"1");return i+o},0)}getRows(e){return Array.from(e.getChildren()).reduce((t,i)=>i.is("element","tableRow")?t+1:t,0)}createTableWalker(e,t={}){return new q(e,t)}getSelectedTableCells(e){const t=[];for(const i of this.sortRanges(e.getRanges())){const s=i.getContainedElement();s&&s.is("element","tableCell")&&t.push(s)}return t}getTableCellsContainingSelection(e){const t=[];for(const i of e.getRanges()){const s=i.start.findAncestor("tableCell");s&&t.push(s)}return t}getSelectionAffectedTableCells(e){const t=this.getSelectedTableCells(e);return t.length?t:this.getTableCellsContainingSelection(e)}getRowIndexes(e){const t=e.map(i=>i.parent.index);return this._getFirstLastIndexesObject(t)}getColumnIndexes(e){const t=e[0].findAncestor("table"),s=[...new q(t)].filter(o=>e.includes(o.cell)).map(o=>o.column);return this._getFirstLastIndexesObject(s)}isSelectionRectangular(e){if(e.length<2||!this._areCellInTheSameTableSection(e))return!1;const t=new Set,i=new Set;let s=0;for(const r of e){const{row:a,column:l}=this.getCellLocation(r),c=parseInt(r.getAttribute("rowspan"))||1,u=parseInt(r.getAttribute("colspan"))||1;t.add(a),i.add(l),c>1&&t.add(a+c-1),u>1&&i.add(l+u-1),s+=c*u}return q7(t,i)==s}sortRanges(e){return Array.from(e).sort(W7)}_getFirstLastIndexesObject(e){const t=e.sort((o,r)=>o-r),i=t[0],s=t[t.length-1];return{first:i,last:s}}_areCellInTheSameTableSection(e){const t=e[0].findAncestor("table"),i=this.getRowIndexes(e),s=parseInt(t.getAttribute("headingRows"))||0;if(!this._areIndexesInSameSection(i,s))return!1;const o=this.getColumnIndexes(e),r=parseInt(t.getAttribute("headingColumns"))||0;return this._areIndexesInSameSection(o,r)}_areIndexesInSameSection({first:e,last:t},i){const s=e<i,o=t<i;return s===o}}function sr(n,e,t,i,s,o={}){for(let r=0;r<i;r++){const a=n.createElement("tableRow");n.insert(a,e,t),Vi(s,n,n.createPositionAt(a,"end"),o)}}function Vi(n,e,t,i={}){for(let s=0;s<n;s++)gi(e,t,i)}function Vd(n,e){if(n<e)return{newCellsSpan:1,updatedSpan:1};const t=Math.floor(n/e),i=n-t*e+t;return{newCellsSpan:t,updatedSpan:i}}function $7(n,e,t){const i=n.getAttribute("headingColumns")||0;if(i&&e.first<i){const s=Math.min(i-1,e.last)-e.first+1;t.setAttribute("headingColumns",i-s,n)}}function z7(n,{first:e,last:t},i){const s=n.getAttribute("headingRows")||0;if(e<s){const o=t<s?s-(t-e+1):e;oe("headingRows",o,n,i,0)}}function H7(n,{first:e,last:t}){const i=new Map,s=[];for(const{row:o,column:r,cellHeight:a,cell:l}of new q(n,{endRow:t})){const c=o+a-1;if(o>=e&&o<=t&&c>t){const h=t-o+1,f=a-h;i.set(r,{cell:l,rowspan:f})}if(o<e&&c>=e){let h;c>=t?h=t-e+1:h=c-e+1,s.push({cell:l,rowspan:a-h})}}return{cellsToMove:i,cellsToTrim:s}}function U7(n,e,t,i){const o=[...new q(n,{includeAllSlots:!0,row:e})],r=n.getChild(e);let a;for(const{column:l,cell:c,isAnchor:u}of o)if(t.has(l)){const{cell:d,rowspan:h}=t.get(l),f=a?i.createPositionAfter(a):i.createPositionAt(r,0);i.move(i.createRangeOn(d),f),oe("rowspan",h,d,i),a=d}else u&&(a=c)}function W7(n,e){const t=n.start,i=e.start;return t.isBefore(i)?-1:1}function q7(n,e){const t=Array.from(n.values()),i=Array.from(e.values()),s=Math.max(...t),o=Math.min(...t),r=Math.max(...i),a=Math.min(...i);return(s-o+1)*(r-a+1)}/**
|
|
1356
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1357
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1358
|
+
*/class j7 extends R{refresh(){const e=this.editor.plugins.get(Ce),t=e.getSelectedTableCells(this.editor.model.document.selection);this.isEnabled=e.isSelectionRectangular(t)}execute(){const e=this.editor.model,t=this.editor.plugins.get(Ce);e.change(i=>{const s=t.getSelectedTableCells(e.document.selection),o=s.shift(),{mergeWidth:r,mergeHeight:a}=K7(o,s,t);oe("colspan",r,o,i),oe("rowspan",a,o,i);for(const c of s)G7(c,o,i);const l=o.findAncestor("table");al(l,t),i.setSelection(o,"in")})}}function G7(n,e,t){Ld(n)||(Ld(e)&&t.remove(t.createRangeIn(e)),t.move(t.createRangeIn(n),t.createPositionAt(e,"end"))),t.remove(n)}function Ld(n){const e=n.getChild(0);return n.childCount==1&&e.is("element","paragraph")&&e.isEmpty}function K7(n,e,t){let i=0,s=0;for(const c of e){const{row:u,column:d}=t.getCellLocation(c);i=Bd(c,d,i,"colspan"),s=Bd(c,u,s,"rowspan")}const{row:o,column:r}=t.getCellLocation(n),a=i-r,l=s-o;return{mergeWidth:a,mergeHeight:l}}function Bd(n,e,t,i){const s=parseInt(n.getAttribute(i)||"1");return Math.max(t,e+s)}/**
|
|
1359
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1360
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1361
|
+
*/class Z7 extends R{constructor(e){super(e),this.affectsData=!1}refresh(){const t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=t.length>0}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),i=t.getSelectionAffectedTableCells(e.document.selection),s=t.getRowIndexes(i),o=i[0].findAncestor("table"),r=[];for(let a=s.first;a<=s.last;a++)for(const l of o.getChild(a).getChildren())r.push(e.createRangeOn(l));e.change(a=>{a.setSelection(r)})}}/**
|
|
1362
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1363
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1364
|
+
*/class J7 extends R{constructor(e){super(e),this.affectsData=!1}refresh(){const t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=t.length>0}execute(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,i=e.getSelectionAffectedTableCells(t.document.selection),s=i[0],o=i.pop(),r=s.findAncestor("table"),a=e.getCellLocation(s),l=e.getCellLocation(o),c=Math.min(a.column,l.column),u=Math.max(a.column,l.column),d=[];for(const h of new q(r,{startColumn:c,endColumn:u}))d.push(t.createRangeOn(h.cell));t.change(h=>{h.setSelection(d)})}}/**
|
|
1365
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1366
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1367
|
+
*/function Y7(n){n.document.registerPostFixer(e=>Q7(e,n))}function Q7(n,e){const t=e.document.differ.getChanges();let i=!1;const s=new Set;for(const o of t){let r=null;o.type=="insert"&&o.name=="table"&&(r=o.position.nodeAfter),(o.type=="insert"||o.type=="remove")&&(o.name=="tableRow"||o.name=="tableCell")&&(r=o.position.findAncestor("table")),n6(o)&&(r=o.range.start.findAncestor("table")),r&&!s.has(r)&&(i=X7(r,n)||i,i=e6(r,n)||i,s.add(r))}return i}function X7(n,e){let t=!1;const i=t6(n);if(i.length){t=!0;for(const s of i)oe("rowspan",s.rowspan,s.cell,e,1)}return t}function e6(n,e){let t=!1;const i=i6(n),s=[];for(const[l,c]of i.entries())!c&&n.getChild(l).is("element","tableRow")&&s.push(l);if(s.length){t=!0;for(const l of s.reverse())e.remove(n.getChild(l)),i.splice(l,1)}const o=i.filter((l,c)=>n.getChild(c).is("element","tableRow")),r=o[0];if(!o.every(l=>l===r)){const l=o.reduce((c,u)=>u>c?u:c,0);for(const[c,u]of o.entries()){const d=l-u;if(d){for(let h=0;h<d;h++)gi(e,e.createPositionAt(n.getChild(c),"end"));t=!0}}}return t}function t6(n){const e=parseInt(n.getAttribute("headingRows")||"0"),t=Array.from(n.getChildren()).reduce((s,o)=>o.is("element","tableRow")?s+1:s,0),i=[];for(const{row:s,cell:o,cellHeight:r}of new q(n)){if(r<2)continue;const l=s<e?e:t;if(s+r>l){const c=l-s;i.push({cell:o,rowspan:c})}}return i}function i6(n){const e=new Array(n.childCount).fill(0);for(const{rowIndex:t}of new q(n,{includeAllSlots:!0}))e[t]++;return e}function n6(n){if(n.type!=="attribute")return!1;const e=n.attributeKey;return e==="headingRows"||e==="colspan"||e==="rowspan"}/**
|
|
1368
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1369
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1370
|
+
*/function s6(n){n.document.registerPostFixer(e=>o6(e,n))}function o6(n,e){const t=e.document.differ.getChanges();let i=!1;for(const s of t)s.type=="insert"&&s.name=="table"&&(i=r6(s.position.nodeAfter,n)||i),s.type=="insert"&&s.name=="tableRow"&&(i=Vp(s.position.nodeAfter,n)||i),s.type=="insert"&&s.name=="tableCell"&&(i=sa(s.position.nodeAfter,n)||i),(s.type=="remove"||s.type=="insert")&&a6(s)&&(i=sa(s.position.parent,n)||i);return i}function r6(n,e){let t=!1;for(const i of n.getChildren())i.is("element","tableRow")&&(t=Vp(i,e)||t);return t}function Vp(n,e){let t=!1;for(const i of n.getChildren())t=sa(i,e)||t;return t}function sa(n,e){if(n.childCount==0)return e.insertElement("paragraph",n),!0;const t=Array.from(n.getChildren()).filter(i=>i.is("$text"));for(const i of t)e.wrap(e.createRangeOn(i),"paragraph");return!!t.length}function a6(n){return n.position.parent.is("element","tableCell")?n.type=="insert"&&n.name=="$text"||n.type=="remove":!1}/**
|
|
1371
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1372
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1373
|
+
*/function l6(n,e){const t=n.document.differ;for(const i of t.getChanges()){let s,o=!1;if(i.type=="attribute"){const c=i.range.start.nodeAfter;if(!c||!c.is("element","table")||i.attributeKey!="headingRows"&&i.attributeKey!="headingColumns")continue;s=c,o=i.attributeKey=="headingRows"}else(i.name=="tableRow"||i.name=="tableCell")&&(s=i.position.findAncestor("table"),o=i.name=="tableRow");if(!s)continue;const r=s.getAttribute("headingRows")||0,a=s.getAttribute("headingColumns")||0,l=new q(s);for(const c of l){const d=c.row<r||c.column<a?"th":"td",h=e.mapper.toViewElement(c.cell);h&&h.is("element")&&h.name!=d&&e.reconvertItem(o?c.cell.parent:c.cell)}}}/**
|
|
1374
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1375
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1376
|
+
*/function c6(n,e){const t=n.document.differ,i=new Set;for(const s of t.getChanges()){const o=s.type=="attribute"?s.range.start.parent:s.position.parent;o.is("element","tableCell")&&i.add(o)}for(const s of i.values()){const o=Array.from(s.getChildren()).filter(r=>u6(r,e.mapper));for(const r of o)e.reconvertItem(r)}}function u6(n,e){if(!n.is("element","paragraph"))return!1;const t=e.toViewElement(n);return t?kp(n)!==t.is("element","span"):!1}/**
|
|
1377
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1378
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1379
|
+
*/class d6 extends w{static get pluginName(){return"TableEditing"}static get requires(){return[Ce]}constructor(e){super(e),this._additionalSlots=[]}init(){const e=this.editor,t=e.model,i=t.schema,s=e.conversion,o=e.plugins.get(Ce);i.register("table",{inheritAllFrom:"$blockObject",allowAttributes:["headingRows","headingColumns"]}),i.register("tableRow",{allowIn:"table",isLimit:!0}),i.register("tableCell",{allowContentOf:"$container",allowIn:"tableRow",allowAttributes:["colspan","rowspan"],isLimit:!0,isSelectable:!0}),s.for("upcast").add(g7()),s.for("upcast").add(p7()),s.for("editingDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:Td(o,{asWidget:!0,additionalSlots:this._additionalSlots})}),s.for("dataDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:Td(o,{additionalSlots:this._additionalSlots})}),s.for("upcast").elementToElement({model:"tableRow",view:"tr"}),s.for("upcast").add(w7()),s.for("downcast").elementToElement({model:"tableRow",view:C7()}),s.for("upcast").elementToElement({model:"tableCell",view:"td"}),s.for("upcast").elementToElement({model:"tableCell",view:"th"}),s.for("upcast").add(Ed("td")),s.for("upcast").add(Ed("th")),s.for("editingDowncast").elementToElement({model:"tableCell",view:Ad({asWidget:!0})}),s.for("dataDowncast").elementToElement({model:"tableCell",view:Ad()}),s.for("editingDowncast").elementToElement({model:"paragraph",view:Sd({asWidget:!0}),converterPriority:"high"}),s.for("dataDowncast").elementToElement({model:"paragraph",view:Sd(),converterPriority:"high"}),s.for("downcast").attributeToAttribute({model:"colspan",view:"colspan"}),s.for("upcast").attributeToAttribute({model:{key:"colspan",value:Od("colspan")},view:"colspan"}),s.for("downcast").attributeToAttribute({model:"rowspan",view:"rowspan"}),s.for("upcast").attributeToAttribute({model:{key:"rowspan",value:Od("rowspan")},view:"rowspan"}),e.config.define("table.defaultHeadings.rows",0),e.config.define("table.defaultHeadings.columns",0),e.commands.add("insertTable",new T7(e)),e.commands.add("insertTableRowAbove",new xd(e,{order:"above"})),e.commands.add("insertTableRowBelow",new xd(e,{order:"below"})),e.commands.add("insertTableColumnLeft",new Id(e,{order:"left"})),e.commands.add("insertTableColumnRight",new Id(e,{order:"right"})),e.commands.add("removeTableRow",new R7(e)),e.commands.add("removeTableColumn",new L7(e)),e.commands.add("splitTableCellVertically",new Pd(e,{direction:"vertically"})),e.commands.add("splitTableCellHorizontally",new Pd(e,{direction:"horizontally"})),e.commands.add("mergeTableCells",new j7(e)),e.commands.add("mergeTableCellRight",new Cs(e,{direction:"right"})),e.commands.add("mergeTableCellLeft",new Cs(e,{direction:"left"})),e.commands.add("mergeTableCellDown",new Cs(e,{direction:"down"})),e.commands.add("mergeTableCellUp",new Cs(e,{direction:"up"})),e.commands.add("setTableColumnHeader",new F7(e)),e.commands.add("setTableRowHeader",new M7(e)),e.commands.add("selectTableRow",new Z7(e)),e.commands.add("selectTableColumn",new J7(e)),Y7(t),s6(t),this.listenTo(t.document,"change:data",()=>{l6(t,e.editing),c6(t,e.editing)})}registerAdditionalSlot(e){this._additionalSlots.push(e)}}function Od(n){return e=>{const t=parseInt(e.getAttribute(n));return Number.isNaN(t)||t<=0?null:t}}/**
|
|
1380
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1381
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1382
|
+
*/class h6 extends T{constructor(e){super(e);const t=this.bindTemplate;this.items=this._createGridCollection(),this.keystrokes=new ae,this.focusTracker=new ne,this.set("rows",0),this.set("columns",0),this.bind("label").to(this,"columns",this,"rows",(i,s)=>`${s} × ${i}`),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(i=>{i.preventDefault()}),click:t.to(()=>{this.fire("execute")})}}),this.on("boxover",(i,s)=>{const{row:o,column:r}=s.target.dataset;this.items.get((parseInt(o,10)-1)*10+(parseInt(r,10)-1)).focus()}),this.focusTracker.on("change:focusedElement",(i,s,o)=>{if(!o)return;const{row:r,column:a}=o.dataset;this.set({rows:parseInt(r),columns:parseInt(a)})}),this.on("change:columns",()=>this._highlightGridBoxes()),this.on("change:rows",()=>this._highlightGridBoxes())}render(){super.render(),Wn({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:10,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection});for(const e of this.items)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element)}focus(){this.items.get(0).focus()}focusLast(){this.items.get(0).focus()}_highlightGridBoxes(){const e=this.rows,t=this.columns;this.items.map((i,s)=>{const o=Math.floor(s/10),r=s%10,a=o<e&&r<t;i.set("isOn",a)})}_createGridButton(e,t,i,s){const o=new B(e);return o.set({label:s,class:"ck-insert-table-dropdown-grid-box"}),o.extendTemplate({attributes:{"data-row":t,"data-column":i}}),o}_createGridCollection(){const e=[];for(let t=0;t<100;t++){const i=Math.floor(t/10),s=t%10,o=`${i+1} × ${s+1}`;e.push(this._createGridButton(this.locale,i+1,s+1,o))}return this.createCollection(e)}}const f6='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M18 7v1H2V7h16zm0 5v1H2v-1h16z" opacity=".6"/><path d="M14 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1zm-2 1H8v4h4V2zm0 6H8v4h4V8zm0 6H8v4h4v-4z"/></svg>',m6='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v16h-1V2z" opacity=".6"/><path d="M1 6h18a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm1 2v4h4V8H2zm6 0v4h4V8H8zm6 0v4h4V8h-4z"/></svg>',g6='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v7h-1V2zm6 5v1H2V7h16zM8 12v1H2v-1h6z" opacity=".6"/><path d="M7 7h12a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1zm1 2v9h10V9H8z"/></svg>';/**
|
|
1383
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1384
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1385
|
+
*/class p6 extends w{static get pluginName(){return"TableUI"}init(){const e=this.editor,t=this.editor.t,s=e.locale.contentLanguageDirection==="ltr";e.ui.componentFactory.add("insertTable",o=>{const r=e.commands.get("insertTable"),a=fe(o);a.bind("isEnabled").to(r),a.buttonView.set({icon:I.table,label:t("Insert table"),tooltip:!0});let l;return a.on("change:isOpen",()=>{l||(l=new h6(o),a.panelView.children.add(l),l.delegate("execute").to(a),a.on("execute",()=>{e.execute("insertTable",{rows:l.rows,columns:l.columns}),e.editing.view.focus()}))}),a}),e.ui.componentFactory.add("tableColumn",o=>{const r=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:t("Header column"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:s?"insertTableColumnLeft":"insertTableColumnRight",label:t("Insert column left")}},{type:"button",model:{commandName:s?"insertTableColumnRight":"insertTableColumnLeft",label:t("Insert column right")}},{type:"button",model:{commandName:"removeTableColumn",label:t("Delete column")}},{type:"button",model:{commandName:"selectTableColumn",label:t("Select column")}}];return this._prepareDropdown(t("Column"),f6,r,o)}),e.ui.componentFactory.add("tableRow",o=>{const r=[{type:"switchbutton",model:{commandName:"setTableRowHeader",label:t("Header row"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:"insertTableRowAbove",label:t("Insert row above")}},{type:"button",model:{commandName:"insertTableRowBelow",label:t("Insert row below")}},{type:"button",model:{commandName:"removeTableRow",label:t("Delete row")}},{type:"button",model:{commandName:"selectTableRow",label:t("Select row")}}];return this._prepareDropdown(t("Row"),m6,r,o)}),e.ui.componentFactory.add("mergeTableCells",o=>{const r=[{type:"button",model:{commandName:"mergeTableCellUp",label:t("Merge cell up")}},{type:"button",model:{commandName:s?"mergeTableCellRight":"mergeTableCellLeft",label:t("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:t("Merge cell down")}},{type:"button",model:{commandName:s?"mergeTableCellLeft":"mergeTableCellRight",label:t("Merge cell left")}},{type:"separator"},{type:"button",model:{commandName:"splitTableCellVertically",label:t("Split cell vertically")}},{type:"button",model:{commandName:"splitTableCellHorizontally",label:t("Split cell horizontally")}}];return this._prepareMergeSplitButtonDropdown(t("Merge cells"),g6,r,o)})}_prepareDropdown(e,t,i,s){const o=this.editor,r=fe(s),a=this._fillDropdownWithListOptions(r,i);return r.buttonView.set({label:e,icon:t,tooltip:!0}),r.bind("isEnabled").toMany(a,"isEnabled",(...l)=>l.some(c=>c)),this.listenTo(r,"execute",l=>{o.execute(l.source.commandName),l.source instanceof Zn||o.editing.view.focus()}),r}_prepareMergeSplitButtonDropdown(e,t,i,s){const o=this.editor,r=fe(s,Qi),a="mergeTableCells",l=o.commands.get(a),c=this._fillDropdownWithListOptions(r,i);return r.buttonView.set({label:e,icon:t,tooltip:!0,isEnabled:!0}),r.bind("isEnabled").toMany([l,...c],"isEnabled",(...u)=>u.some(d=>d)),this.listenTo(r.buttonView,"execute",()=>{o.execute(a),o.editing.view.focus()}),this.listenTo(r,"execute",u=>{o.execute(u.source.commandName),o.editing.view.focus()}),r}_fillDropdownWithListOptions(e,t){const i=this.editor,s=[],o=new _e;for(const r of t)w6(r,i,s,o);return di(e,o),s}}function w6(n,e,t,i){if(n.type==="button"||n.type==="switchbutton"){const s=n.model=new hi(n.model),{commandName:o,bindIsOn:r}=n.model,a=e.commands.get(o);t.push(a),s.set({commandName:o}),s.bind("isEnabled").to(a),r&&s.bind("isOn").to(a,"value"),s.set({withText:!0})}i.add(n)}/**
|
|
1386
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1387
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1388
|
+
*/class Qt extends w{static get pluginName(){return"TableSelection"}static get requires(){return[Ce,Ce]}init(){const e=this.editor,t=e.model,i=e.editing.view;this.listenTo(t,"deleteContent",(s,o)=>this._handleDeleteContent(s,o),{priority:"high"}),this.listenTo(i.document,"insertText",(s,o)=>this._handleInsertTextEvent(s,o),{priority:"high"}),this._defineSelectionConverter(),this._enablePluginDisabling()}getSelectedTableCells(){const e=this.editor.plugins.get(Ce),t=this.editor.model.document.selection,i=e.getSelectedTableCells(t);return i.length==0?null:i}getSelectionAsFragment(){const e=this.editor.plugins.get(Ce),t=this.getSelectedTableCells();return t?this.editor.model.change(i=>{const s=i.createDocumentFragment(),{first:o,last:r}=e.getColumnIndexes(t),{first:a,last:l}=e.getRowIndexes(t),c=t[0].findAncestor("table");let u=l,d=r;if(e.isSelectionRectangular(t)){const m={firstColumn:o,lastColumn:r,firstRow:a,lastRow:l};u=Pp(c,m),d=Rp(c,m)}const f=Ep(c,{startRow:a,startColumn:o,endRow:u,endColumn:d},i);return i.insert(f,s,0),s}):null}setCellSelection(e,t){const i=this._getCellsToSelect(e,t);this.editor.model.change(s=>{s.setSelection(i.cells.map(o=>s.createRangeOn(o)),{backward:i.backward})})}getFocusCell(){const i=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return i&&i.is("element","tableCell")?i:null}getAnchorCell(){const e=this.editor.model.document.selection,i=J(e.getRanges()).getContainedElement();return i&&i.is("element","tableCell")?i:null}_defineSelectionConverter(){const e=this.editor,t=new Set;e.conversion.for("editingDowncast").add(s=>s.on("selection",(o,r,a)=>{const l=a.writer;i(l);const c=this.getSelectedTableCells();if(!c)return;for(const d of c){const h=a.mapper.toViewElement(d);l.addClass("ck-editor__editable_selected",h),t.add(h)}const u=a.mapper.toViewElement(c[c.length-1]);l.setSelection(u,0)},{priority:"lowest"}));function i(s){for(const o of t)s.removeClass("ck-editor__editable_selected",o);t.clear()}}_enablePluginDisabling(){const e=this.editor;this.on("change:isEnabled",()=>{if(!this.isEnabled){const t=this.getSelectedTableCells();if(!t)return;e.model.change(i=>{const s=i.createPositionAt(t[0],0),o=e.model.schema.getNearestSelectionRange(s);i.setSelection(o)})}})}_handleDeleteContent(e,t){const i=this.editor.plugins.get(Ce),s=t[0],o=t[1],r=this.editor.model,a=!o||o.direction=="backward",l=i.getSelectedTableCells(s);l.length&&(e.stop(),r.change(c=>{const u=l[a?l.length-1:0];r.change(h=>{for(const f of l)r.deleteContent(h.createSelection(f,"in"))});const d=r.schema.getNearestSelectionRange(c.createPositionAt(u,0));s.is("documentSelection")?c.setSelection(d):s.setTo(d)}))}_handleInsertTextEvent(e,t){const i=this.editor,s=this.getSelectedTableCells();if(!s)return;const o=i.editing.view,r=i.editing.mapper,a=s.map(l=>o.createRangeOn(r.toViewElement(l)));t.selection=o.createSelection(a)}_getCellsToSelect(e,t){const i=this.editor.plugins.get("TableUtils"),s=i.getCellLocation(e),o=i.getCellLocation(t),r=Math.min(s.row,o.row),a=Math.max(s.row,o.row),l=Math.min(s.column,o.column),c=Math.max(s.column,o.column),u=new Array(a-r+1).fill(null).map(()=>[]),d={startRow:r,endRow:a,startColumn:l,endColumn:c};for(const{row:m,cell:p}of new q(e.findAncestor("table"),d))u[m-r].push(p);const h=o.row<s.row,f=o.column<s.column;return h&&u.reverse(),f&&u.forEach(m=>m.reverse()),{cells:u.flat(),backward:h||f}}}/**
|
|
1389
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1390
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1391
|
+
*/class b6 extends w{static get pluginName(){return"TableClipboard"}static get requires(){return[Qt,Ce]}init(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"copy",(i,s)=>this._onCopyCut(i,s)),this.listenTo(t,"cut",(i,s)=>this._onCopyCut(i,s)),this.listenTo(e.model,"insertContent",(i,[s,o])=>this._onInsertContent(i,s,o),{priority:"high"}),this.decorate("_replaceTableSlotCell")}_onCopyCut(e,t){const i=this.editor.plugins.get(Qt);if(!i.getSelectedTableCells()||e.name=="cut"&&!this.editor.model.canEditAt(this.editor.model.document.selection))return;t.preventDefault(),e.stop();const s=this.editor.data,o=this.editor.editing.view.document,r=s.toView(i.getSelectionAsFragment());o.fire("clipboardOutput",{dataTransfer:t.dataTransfer,content:r,method:e.name})}_onInsertContent(e,t,i){if(i&&!i.is("documentSelection"))return;const s=this.editor.model,o=this.editor.plugins.get(Ce);let r=this.getTableIfOnlyTableInContent(t,s);if(!r)return;const a=o.getSelectionAffectedTableCells(s.document.selection);if(!a.length){al(r,o);return}e.stop(),s.change(l=>{const c={width:o.getColumns(r),height:o.getRows(r)},u=_6(a,c,l,o),d=u.lastRow-u.firstRow+1,h=u.lastColumn-u.firstColumn+1,f={startRow:0,startColumn:0,endRow:Math.min(d,c.height)-1,endColumn:Math.min(h,c.width)-1};r=Ep(r,f,l);const m=a[0].findAncestor("table"),p=this._replaceSelectedCellsWithPasted(r,c,m,u,l);if(this.editor.plugins.get("TableSelection").isEnabled){const _=o.sortRanges(p.map(C=>l.createRangeOn(C)));l.setSelection(_)}else l.setSelection(p[0],0)})}_replaceSelectedCellsWithPasted(e,t,i,s,o){const{width:r,height:a}=t,l=y6(e,r,a),c=[...new q(i,{startRow:s.firstRow,endRow:s.lastRow,startColumn:s.firstColumn,endColumn:s.lastColumn,includeAllSlots:!0})],u=[];let d;for(const _ of c){const{row:C,column:v}=_;v===s.firstColumn&&(d=_.getPositionBefore());const P=C-s.firstRow,M=v-s.firstColumn,D=l[P%a][M%r],A=D?o.cloneElement(D):null,V=this._replaceTableSlotCell(_,A,d,o);V&&(Ip(V,C,v,s.lastRow,s.lastColumn,o),u.push(V),d=o.createPositionAfter(V))}const h=parseInt(i.getAttribute("headingRows")||"0"),f=parseInt(i.getAttribute("headingColumns")||"0"),m=s.firstRow<h&&h<=s.lastRow,p=s.firstColumn<f&&f<=s.lastColumn;if(m){const _={first:s.firstColumn,last:s.lastColumn},C=oa(i,h,_,o,s.firstRow);u.push(...C)}if(p){const _={first:s.firstRow,last:s.lastRow},C=ra(i,f,_,o);u.push(...C)}return u}_replaceTableSlotCell(e,t,i,s){const{cell:o,isAnchor:r}=e;return r&&s.remove(o),t?(s.insert(t,i),t):null}getTableIfOnlyTableInContent(e,t){if(!e.is("documentFragment")&&!e.is("element"))return null;if(e.is("element","table"))return e;if(e.childCount==1&&e.getChild(0).is("element","table"))return e.getChild(0);const i=t.createRangeIn(e);for(const s of i.getItems())if(s.is("element","table")){const o=t.createRange(i.start,t.createPositionBefore(s));if(t.hasContent(o,{ignoreWhitespaces:!0}))return null;const r=t.createRange(t.createPositionAfter(s),i.end);return t.hasContent(r,{ignoreWhitespaces:!0})?null:s}return null}}function _6(n,e,t,i){const s=n[0].findAncestor("table"),o=i.getColumnIndexes(n),r=i.getRowIndexes(n),a={firstColumn:o.first,lastColumn:o.last,firstRow:r.first,lastRow:r.last},l=n.length===1;return l&&(a.lastRow+=e.height-1,a.lastColumn+=e.width-1,v6(s,a.lastRow+1,a.lastColumn+1,i)),l||!i.isSelectionRectangular(n)?C6(s,a,t):(a.lastRow=Pp(s,a),a.lastColumn=Rp(s,a)),a}function v6(n,e,t,i){const s=i.getColumns(n),o=i.getRows(n);t>s&&i.insertColumns(n,{at:s,columns:t-s}),e>o&&i.insertRows(n,{at:o,rows:e-o})}function y6(n,e,t){const i=new Array(t).fill(null).map(()=>new Array(e).fill(null));for(const{column:s,row:o,cell:r}of new q(n))i[o][s]=r;return i}function C6(n,e,t){const{firstRow:i,lastRow:s,firstColumn:o,lastColumn:r}=e,a={first:i,last:s},l={first:o,last:r};ra(n,o,a,t),ra(n,r+1,a,t),oa(n,i,l,t),oa(n,s+1,l,t,i)}function oa(n,e,t,i,s=0){return e<1?void 0:Tp(n,e,s).filter(({column:a,cellWidth:l})=>Lp(a,l,t)).map(({cell:a})=>Ap(a,e,i))}function ra(n,e,t,i){return e<1?void 0:Sp(n,e).filter(({row:r,cellHeight:a})=>Lp(r,a,t)).map(({cell:r,column:a})=>xp(r,a,e,i))}function Lp(n,e,t){const i=n+e-1,{first:s,last:o}=t,r=n>=s&&n<=o,a=n<s&&i>=s;return r||a}/**
|
|
1392
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1393
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1394
|
+
*/class k6 extends w{static get pluginName(){return"TableKeyboard"}static get requires(){return[Qt,Ce]}init(){const t=this.editor.editing.view.document;this.listenTo(t,"arrowKey",(...i)=>this._onArrowKey(...i),{context:"table"}),this.listenTo(t,"tab",(...i)=>this._handleTabOnSelectedTable(...i),{context:"figure"}),this.listenTo(t,"tab",(...i)=>this._handleTab(...i),{context:["th","td"]})}_handleTabOnSelectedTable(e,t){const i=this.editor,o=i.model.document.selection.getSelectedElement();!o||!o.is("element","table")||(t.preventDefault(),t.stopPropagation(),e.stop(),i.model.change(r=>{r.setSelection(r.createRangeIn(o.getChild(0).getChild(0)))}))}_handleTab(e,t){const i=this.editor,s=this.editor.plugins.get(Ce),o=this.editor.plugins.get("TableSelection"),r=i.model.document.selection,a=!t.shiftKey;let l=s.getTableCellsContainingSelection(r)[0];if(l||(l=o.getFocusCell()),!l)return;t.preventDefault(),t.stopPropagation(),e.stop();const c=l.parent,u=c.parent,d=u.getChildIndex(c),h=c.getChildIndex(l),f=h===0;if(!a&&f&&d===0){i.model.change(C=>{C.setSelection(C.createRangeOn(u))});return}const m=h===c.childCount-1,p=d===s.getRows(u)-1;if(a&&p&&m&&(i.execute("insertTableRowBelow"),d===s.getRows(u)-1)){i.model.change(C=>{C.setSelection(C.createRangeOn(u))});return}let _;if(a&&m)_=u.getChild(d+1).getChild(0);else if(!a&&f){const C=u.getChild(d-1);_=C.getChild(C.childCount-1)}else _=c.getChild(h+(a?1:-1));i.model.change(C=>{C.setSelection(C.createRangeIn(_))})}_onArrowKey(e,t){const i=this.editor,s=t.keyCode,o=Ba(s,i.locale.contentLanguageDirection);this._handleArrowKeys(o,t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),e.stop())}_handleArrowKeys(e,t){const i=this.editor.plugins.get(Ce),s=this.editor.plugins.get("TableSelection"),o=this.editor.model,r=o.document.selection,a=["right","down"].includes(e),l=i.getSelectedTableCells(r);if(l.length){let u;return t?u=s.getFocusCell():u=a?l[l.length-1]:l[0],this._navigateFromCellInDirection(u,e,t),!0}const c=r.focus.findAncestor("tableCell");/* istanbul ignore if: paranoid check -- @preserve */if(!c)return!1;if(!r.isCollapsed)if(t){if(r.isBackward==a&&!r.containsEntireContent(c))return!1}else{const u=r.getSelectedElement();if(!u||!o.schema.isObject(u))return!1}return this._isSelectionAtCellEdge(r,c,a)?(this._navigateFromCellInDirection(c,e,t),!0):!1}_isSelectionAtCellEdge(e,t,i){const s=this.editor.model,o=this.editor.model.schema,r=i?e.getLastPosition():e.getFirstPosition();if(!o.getLimitElement(r).is("element","tableCell"))return s.createPositionAt(t,i?"end":0).isTouching(r);const a=s.createSelection(r);return s.modifySelection(a,{direction:i?"forward":"backward"}),r.isEqual(a.focus)}_navigateFromCellInDirection(e,t,i=!1){const s=this.editor.model,o=e.findAncestor("table"),r=[...new q(o,{includeAllSlots:!0})],{row:a,column:l}=r[r.length-1],c=r.find(({cell:v})=>v==e);let{row:u,column:d}=c;switch(t){case"left":d--;break;case"up":u--;break;case"right":d+=c.cellWidth;break;case"down":u+=c.cellHeight;break}const h=u<0||u>a,f=d<0&&u<=0,m=d>l&&u>=a;if(h||f||m){s.change(v=>{v.setSelection(v.createRangeOn(o))});return}d<0?(d=i?0:l,u--):d>l&&(d=i?l:0,u++);const p=r.find(v=>v.row==u&&v.column==d).cell,_=["right","down"].includes(t),C=this.editor.plugins.get("TableSelection");if(i&&C.isEnabled){const v=C.getAnchorCell()||e;C.setCellSelection(v,p)}else{const v=s.createPositionAt(p,_?0:"end");s.change(P=>{P.setSelection(v)})}}}/**
|
|
1395
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1396
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1397
|
+
*/class E6 extends Lt{constructor(){super(...arguments),this.domEventType=["mousemove","mouseleave"]}onDomEvent(e){this.fire(e.type,e)}}/**
|
|
1398
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1399
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1400
|
+
*/class T6 extends w{static get pluginName(){return"TableMouse"}static get requires(){return[Qt,Ce]}init(){this.editor.editing.view.addObserver(E6),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){const e=this.editor,t=e.plugins.get(Ce);let i=!1;const s=e.plugins.get(Qt);this.listenTo(e.editing.view.document,"mousedown",(o,r)=>{const a=e.model.document.selection;if(!this.isEnabled||!s.isEnabled||!r.domEvent.shiftKey)return;const l=s.getAnchorCell()||t.getTableCellsContainingSelection(a)[0];if(!l)return;const c=this._getModelTableCellFromDomEvent(r);c&&Md(l,c)&&(i=!0,s.setCellSelection(l,c),r.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{i=!1}),this.listenTo(e.editing.view.document,"selectionChange",o=>{i&&o.stop()},{priority:"highest"})}_enableMouseDragSelection(){const e=this.editor;let t,i,s=!1,o=!1;const r=e.plugins.get(Qt);this.listenTo(e.editing.view.document,"mousedown",(a,l)=>{!this.isEnabled||!r.isEnabled||l.domEvent.shiftKey||l.domEvent.ctrlKey||l.domEvent.altKey||(t=this._getModelTableCellFromDomEvent(l))}),this.listenTo(e.editing.view.document,"mousemove",(a,l)=>{if(!l.domEvent.buttons||!t)return;const c=this._getModelTableCellFromDomEvent(l);c&&Md(t,c)&&(i=c,!s&&i!=t&&(s=!0)),s&&(o=!0,r.setCellSelection(t,i),l.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{s=!1,o=!1,t=null,i=null}),this.listenTo(e.editing.view.document,"selectionChange",a=>{o&&a.stop()},{priority:"highest"})}_getModelTableCellFromDomEvent(e){const t=e.target,i=this.editor.editing.view.createPositionAt(t,0);return this.editor.editing.mapper.toModelPosition(i).parent.findAncestor("tableCell",{includeSelf:!0})}}function Md(n,e){return n.parent.parent==e.parent.parent}/**
|
|
1401
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1402
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1403
|
+
*/class A6 extends w{static get requires(){return[d6,p6,Qt,T6,k6,b6,fi]}static get pluginName(){return"Table"}}/**
|
|
1404
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1405
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1406
|
+
*/function S6(n){const e=n.getSelectedElement();return e&&Bp(e)?e:null}function x6(n){const e=n.getFirstPosition();if(!e)return null;let t=e.parent;for(;t;){if(t.is("element")&&Bp(t))return t;t=t.parent}return null}function Bp(n){return!!n.getCustomProperty("table")&&he(n)}/**
|
|
1407
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1408
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1409
|
+
*/class I6 extends w{static get requires(){return[Js]}static get pluginName(){return"TableToolbar"}afterInit(){const e=this.editor,t=e.t,i=e.plugins.get(Js),s=e.config.get("table.contentToolbar"),o=e.config.get("table.tableToolbar");s&&i.register("tableContent",{ariaLabel:t("Table toolbar"),items:s,getRelatedElement:x6}),o&&i.register("table",{ariaLabel:t("Table toolbar"),items:o,getRelatedElement:S6})}}/**
|
|
1410
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1411
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1412
|
+
*/const zt=be.defaultPositions;zt.northArrowSouth,zt.northArrowSouthWest,zt.northArrowSouthEast,zt.southArrowNorth,zt.southArrowNorthWest,zt.southArrowNorthEast,zt.viewportStickyNorth;/**
|
|
1413
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1414
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1415
|
+
*/function P6(n){const e=[{name:"address",isVoid:!1},{name:"article",isVoid:!1},{name:"aside",isVoid:!1},{name:"blockquote",isVoid:!1},{name:"details",isVoid:!1},{name:"dialog",isVoid:!1},{name:"dd",isVoid:!1},{name:"div",isVoid:!1},{name:"dl",isVoid:!1},{name:"dt",isVoid:!1},{name:"fieldset",isVoid:!1},{name:"figcaption",isVoid:!1},{name:"figure",isVoid:!1},{name:"footer",isVoid:!1},{name:"form",isVoid:!1},{name:"h1",isVoid:!1},{name:"h2",isVoid:!1},{name:"h3",isVoid:!1},{name:"h4",isVoid:!1},{name:"h5",isVoid:!1},{name:"h6",isVoid:!1},{name:"header",isVoid:!1},{name:"hgroup",isVoid:!1},{name:"hr",isVoid:!0},{name:"li",isVoid:!1},{name:"main",isVoid:!1},{name:"nav",isVoid:!1},{name:"ol",isVoid:!1},{name:"p",isVoid:!1},{name:"section",isVoid:!1},{name:"table",isVoid:!1},{name:"tbody",isVoid:!1},{name:"td",isVoid:!1},{name:"th",isVoid:!1},{name:"thead",isVoid:!1},{name:"tr",isVoid:!1},{name:"ul",isVoid:!1}],t=e.map(o=>o.name).join("|"),i=n.replace(new RegExp(`</?(${t})( .*?)?>`,"g"),`
|
|
1416
|
+
$&
|
|
1417
|
+
`).replace(/<br[^>]*>/g,`$&
|
|
1418
|
+
`).split(`
|
|
1419
|
+
`);let s=0;return i.filter(o=>o.length).map(o=>R6(o,e)?or(o,s++):V6(o,e)?or(o,--s):or(o,s)).join(`
|
|
1420
|
+
`)}function R6(n,e){return e.some(t=>!(t.isVoid||!new RegExp(`<${t.name}( .*?)?>`).test(n)))}function V6(n,e){return e.some(t=>new RegExp(`</${t.name}>`).test(n))}function or(n,e,t=" "){return`${t.repeat(Math.max(0,e))}${n}`}const L6='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m12.5 0 5 4.5v15.003h-16V0h11zM3 1.5v3.25l-1.497 1-.003 8 1.5 1v3.254L7.685 18l-.001 1.504H17.5V8.002L16 9.428l-.004-4.22-4.222-3.692L3 1.5z"/><path d="M4.06 6.64a.75.75 0 0 1 .958 1.15l-.085.07L2.29 9.75l2.646 1.89c.302.216.4.62.232.951l-.058.095a.75.75 0 0 1-.951.232l-.095-.058-3.5-2.5V9.14l3.496-2.5zm4.194 6.22a.75.75 0 0 1-.958-1.149l.085-.07 2.643-1.89-2.646-1.89a.75.75 0 0 1-.232-.952l.058-.095a.75.75 0 0 1 .95-.232l.096.058 3.5 2.5v1.22l-3.496 2.5zm7.644-.836 2.122 2.122-5.825 5.809-2.125-.005.003-2.116zm2.539-1.847 1.414 1.414a.5.5 0 0 1 0 .707l-1.06 1.06-2.122-2.12 1.061-1.061a.5.5 0 0 1 .707 0z"/></svg>';/**
|
|
1421
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1422
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1423
|
+
*/const Fd="SourceEditingMode";class B6 extends w{static get pluginName(){return"SourceEditing"}static get requires(){return[qs]}constructor(e){super(e),this.set("isSourceEditingMode",!1),this._elementReplacer=new Ef,this._replacedRoots=new Map,this._dataFromRoots=new Map,e.config.define("sourceEditing.allowCollaborationFeatures",!1)}init(){this._checkCompatibility();const e=this.editor,t=e.t;e.ui.componentFactory.add("sourceEditing",i=>{const s=new B(i);return s.set({label:t("Source"),icon:L6,tooltip:!0,withText:!0,class:"ck-source-editing-button"}),s.bind("isOn").to(this,"isSourceEditingMode"),s.bind("isEnabled").to(this,"isEnabled",e,"isReadOnly",e.plugins.get(qs),"hasAny",(o,r,a)=>!(!o||r||a)),this.listenTo(s,"execute",()=>{this.isSourceEditingMode=!this.isSourceEditingMode}),s}),this._isAllowedToHandleSourceEditingMode()&&(this.on("change:isSourceEditingMode",(i,s,o)=>{o?(this._hideVisibleDialog(),this._showSourceEditing(),this._disableCommands()):(this._hideSourceEditing(),this._enableCommands())}),this.on("change:isEnabled",(i,s,o)=>this._handleReadOnlyMode(!o)),this.listenTo(e,"change:isReadOnly",(i,s,o)=>this._handleReadOnlyMode(o))),e.data.on("get",()=>{this.isSourceEditingMode&&this.updateEditorData()},{priority:"high"})}updateEditorData(){const e=this.editor,t={};for(const[i,s]of this._replacedRoots){const o=this._dataFromRoots.get(i),r=s.dataset.value;o!==r&&(t[i]=r,this._dataFromRoots.set(i,r))}Object.keys(t).length&&e.data.set(t,{batchType:{isUndoable:!0},suppressErrorInCollaboration:!0})}_checkCompatibility(){const e=this.editor,t=e.config.get("sourceEditing.allowCollaborationFeatures");if(!t&&e.plugins.has("RealTimeCollaborativeEditing"))throw new g("source-editing-incompatible-with-real-time-collaboration",null);!t&&["CommentsEditing","TrackChangesEditing","RevisionHistory"].some(s=>e.plugins.has(s))&&console.warn("You initialized the editor with the source editing feature and at least one of the collaboration features. Please be advised that the source editing feature may not work, and be careful when editing document source that contains markers created by the collaboration features."),e.plugins.has("RestrictedEditingModeEditing")&&console.warn("You initialized the editor with the source editing feature and restricted editing feature. Please be advised that the source editing feature may not work, and be careful when editing document source that contains markers created by the restricted editing feature.")}_showSourceEditing(){const e=this.editor,t=e.editing.view,i=e.model;i.change(s=>{s.setSelection(null),s.removeSelectionAttribute(i.document.selection.getAttributeKeys())});for(const[s,o]of t.domRoots){const r=O6(e.data.get({rootName:s})),a=Sn(o.ownerDocument,"textarea",{rows:"1","aria-label":"Source code editing area"}),l=Sn(o.ownerDocument,"div",{class:"ck-source-editing-area","data-value":r},[a]);a.value=r,a.setSelectionRange(0,0),a.addEventListener("input",()=>{l.dataset.value=a.value,e.ui.update()}),t.change(c=>{const u=t.document.getRoot(s);c.addClass("ck-hidden",u)}),e.ui.setEditableElement("sourceEditing:"+s,a),this._replacedRoots.set(s,l),this._elementReplacer.replace(o,l),this._dataFromRoots.set(s,r)}this._focusSourceEditing()}_hideSourceEditing(){const t=this.editor.editing.view;this.updateEditorData(),t.change(i=>{for(const[s]of this._replacedRoots)i.removeClass("ck-hidden",t.document.getRoot(s))}),this._elementReplacer.restore(),this._replacedRoots.clear(),this._dataFromRoots.clear(),t.focus()}_focusSourceEditing(){const e=this.editor,[t]=this._replacedRoots.values(),i=t.querySelector("textarea");e.editing.view.document.isFocused=!1,i.focus()}_disableCommands(){const e=this.editor;for(const t of e.commands.commands())t.forceDisabled(Fd)}_enableCommands(){const e=this.editor;for(const t of e.commands.commands())t.clearForceDisabled(Fd)}_handleReadOnlyMode(e){if(this.isSourceEditingMode)for(const[,t]of this._replacedRoots)t.querySelector("textarea").readOnly=e}_isAllowedToHandleSourceEditingMode(){const t=this.editor.ui.view.editable;return t&&!t.hasExternalElement}_hideVisibleDialog(){if(this.editor.plugins.has("Dialog")){const e=this.editor.plugins.get("Dialog");e.isOpen&&e.hide()}}}function O6(n){return M6(n)?P6(n):n}function M6(n){return n.startsWith("<")}/**
|
|
1424
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1425
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1426
|
+
*/function oi(n,e,t,i){e&&F6(n,e,i),t&&st(n,t,i)}function st(n,e,t){if(e.attributes)for(const[i,s]of Object.entries(e.attributes))n.setAttribute(i,s,t);e.styles&&n.setStyle(e.styles,t),e.classes&&n.addClass(e.classes,t)}function F6(n,e,t){if(e.attributes)for(const[i]of Object.entries(e.attributes))n.removeAttribute(i,t);if(e.styles)for(const i of Object.keys(e.styles))n.removeStyle(i,t);e.classes&&n.removeClass(e.classes,t)}function D6(n,e){const t=Tt(n);let i="attributes";for(i in e)i=="classes"?t[i]=Array.from(new Set([...n[i]||[],...e[i]])):t[i]={...n[i],...e[i]};return t}function Ei(n,e,t,i,s){const o=e.getAttribute(t),r={};for(const a of["attributes","styles","classes"]){if(a!=i){o&&o[a]&&(r[a]=o[a]);continue}if(i=="classes"){const c=new Set(o&&o.classes||[]);s(c),c.size&&(r[a]=Array.from(c));continue}const l=new Map(Object.entries(o&&o[a]||{}));s(l),l.size&&(r[a]=Object.fromEntries(l))}Object.keys(r).length?e.is("documentSelection")?n.setSelectionAttribute(t,r):n.setAttribute(t,r,e):o&&(e.is("documentSelection")?n.removeSelectionAttribute(t):n.removeAttribute(t,e))}function N6(n){return o2(n).replace(/ /g,"")}function He(n){return`html${N6(n)}Attributes`}/**
|
|
1427
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1428
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1429
|
+
*/function ll({model:n}){return(e,t)=>t.writer.createElement(n,{htmlContent:e.getCustomProperty("$rawContent")})}function $6(n,{view:e,isInline:t}){const i=n.t;return(s,{writer:o})=>{const r=i("HTML object"),a=yo(e,s,o),l=s.getAttribute(He(e));o.addClass("html-object-embed__content",a),l&&st(o,l,a);const c=o.createContainerElement(t?"span":"div",{class:"html-object-embed","data-html-object-embed-label":r},a);return Xi(c,o,{label:r})}}function yo(n,e,t){return t.createRawElement(n,null,(i,s)=>{s.setContentOf(i,e.getAttribute("htmlContent"))})}function z6({view:n,model:e,allowEmpty:t},i){return o=>{o.on(`element:${n}`,(r,a,l)=>{let c=i.processViewAttributes(a.viewItem,l);if(!(!c&&!l.consumable.test(a.viewItem,{name:!0}))){if(c=c||{},l.consumable.consume(a.viewItem,{name:!0}),a.modelRange||(a=Object.assign(a,l.convertChildren(a.viewItem,a.modelCursor))),t&&a.modelRange.isCollapsed&&Object.keys(c).length){const u=l.writer.createElement("htmlEmptyElement");if(!l.safeInsert(u,a.modelCursor))return;const d=l.getSplitParts(u);a.modelRange=l.writer.createRange(a.modelRange.start,l.writer.createPositionAfter(d[d.length-1])),l.updateConversionResult(u,a),s(u,c,l);return}for(const u of a.modelRange.getItems())s(u,c,l)}},{priority:"low"})};function s(o,r,a){if(a.schema.checkAttribute(o,e)){const l=o.getAttribute(e),c=D6(r,l||{});a.writer.setAttribute(e,c,o)}}}function Dd({model:n,view:e},t){return(i,{writer:s,consumable:o})=>{if(!i.hasAttribute(n))return null;const r=s.createContainerElement(e),a=i.getAttribute(n);return o.consume(i,`attribute:${n}`),st(s,a,r),r.getFillerOffset=()=>null,t?Xi(r,s):r}}function H6({priority:n,view:e}){return(t,i)=>{if(!t)return;const{writer:s}=i,o=s.createAttributeElement(e,null,{priority:n});return st(s,t,o),o}}function Hn({view:n},e){return t=>{t.on(`element:${n}`,(i,s,o)=>{if(!s.modelRange||s.modelRange.isCollapsed)return;const r=e.processViewAttributes(s.viewItem,o);r&&o.writer.setAttribute(He(s.viewItem.name),r,s.modelRange)},{priority:"low"})}}function Un({view:n,model:e}){return t=>{t.on(`attribute:${He(n)}:${e}`,(i,s,o)=>{if(!o.consumable.consume(s.item,i.name))return;const{attributeOldValue:r,attributeNewValue:a}=s,l=o.writer,c=o.mapper.toViewElement(s.item);oi(l,r,a,c)})}}/**
|
|
1430
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1431
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1432
|
+
*/const Nd={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:"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"],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:"$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:!0}},{model:"htmlHgroup",view:"hgroup",modelSchema:{allowChildren:["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:"htmlDivDl",view:"div",modelSchema:{allowChildren:["htmlDt","htmlDd"],allowIn:"htmlDl"}},{model:"htmlDl",view:"dl",modelSchema:{allowWhere:"$container",allowChildren:["htmlDt","htmlDd","htmlDivDl"],isBlock:!1}},{model:"htmlDt",view:"dt",modelSchema:{allowChildren:"$block",isBlock:!1}},{model:"htmlDd",view:"dd",modelSchema:{allowChildren:"$block",isBlock:!1}},{model:"htmlCenter",view:"center",modelSchema:{inheritAllFrom:"$container",isBlock:!1}}],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:"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"},{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}}]};/**
|
|
1433
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1434
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1435
|
+
*/class Wi extends w{constructor(){super(...arguments),this._definitions=[]}static get pluginName(){return"DataSchema"}init(){for(const e of Nd.block)this.registerBlockElement(e);for(const e of Nd.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){const i=new Set;for(const s of this._getMatchingViewDefinitions(e)){if(t)for(const o of this._getReferences(s.model))i.add(o);i.add(s)}return i}getDefinitionsForModel(e){return this._definitions.filter(t=>t.model==e)}_getMatchingViewDefinitions(e){return this._definitions.filter(t=>t.view&&U6(e,t.view))}*_getReferences(e){const t=["inheritAllFrom","inheritTypesFrom","allowWhere","allowContentOf","allowAttributesOf"],i=this._definitions.filter(s=>s.model==e);for(const{modelSchema:s}of i)if(s)for(const o of t)for(const r of K(s[o]||[])){const a=this._definitions.filter(l=>l.model==r);for(const l of a)r!==e&&(yield*this._getReferences(l.model),yield l)}}_extendDefinition(e){const t=Array.from(this._definitions.entries()).filter(([,i])=>i.model==e.model);if(t.length==0){this._definitions.push(e);return}for(const[i,s]of t)this._definitions[i]=Wy({},s,e,(o,r)=>Array.isArray(o)?o.concat(r):void 0)}}function U6(n,e){return typeof n=="string"?n===e:n instanceof RegExp?n.test(e):!1}/**
|
|
1436
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1437
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1438
|
+
*/class ce extends w{constructor(e){super(e),this._dataSchema=e.plugins.get("DataSchema"),this._allowedAttributes=new ni,this._disallowedAttributes=new ni,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 requires(){return[Wi,fi]}loadAllowedConfig(e){for(const t of e){const i=t.name||/[\s\S]+/,s=Hd(t);this.allowElement(i),s.forEach(o=>this.allowAttributes(o))}}loadDisallowedConfig(e){for(const t of e){const i=t.name||/[\s\S]+/,s=Hd(t);s.length==0?this.disallowElement(i):s.forEach(o=>this.disallowAttributes(o))}}loadAllowedEmptyElementsConfig(e){for(const t of e)this.allowEmptyElement(t)}allowElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,!0))this._addAllowedElement(t),this._coupledAttributes=null}disallowElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,!1))this._disallowedElements.add(t.view)}allowEmptyElement(e){for(const 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){return $d(e,t,this._disallowedAttributes),$d(e,t,this._allowedAttributes)}_addAllowedElement(e){if(!this._allowedElements.has(e)){if(this._allowedElements.add(e),"appliesToBlock"in e&&typeof e.appliesToBlock=="string")for(const t of this._dataSchema.getDefinitionsForModel(e.appliesToBlock))t.isBlock&&this._addAllowedElement(t);this._dataInitialized&&this.editor.data.once("set",()=>{this._fireRegisterEvent(e)},{priority:Me.highest+1})}}_registerElementsAfterInit(){this.editor.data.on("init",()=>{this._dataInitialized=!0;for(const e of this._allowedElements)this._fireRegisterEvent(e)},{priority:Me.highest+1})}_registerElementHandlers(){this.on("register",(e,t)=>{const i=this.editor.model.schema;if(t.isObject&&!i.isRegistered(t.model))this._registerObjectElement(t);else if(t.isBlock)this._registerBlockElement(t);else if(t.isInline)this._registerInlineElement(t);else throw new g("data-filter-invalid-definition",null,t);e.stop()},{priority:"lowest"})}_registerCoupledAttributesPostFixer(){const e=this.editor.model,t=e.document.selection;e.document.registerPostFixer(i=>{const s=e.document.differ.getChanges();let o=!1;const r=this._getCoupledAttributesMap();for(const a of s){if(a.type!="attribute"||a.attributeNewValue!==null)continue;const l=r.get(a.attributeKey);if(l)for(const{item:c}of a.range.getWalker())for(const u of l)c.hasAttribute(u)&&(i.removeAttribute(u,c),o=!0)}return o}),this.listenTo(t,"change:attribute",(i,{attributeKeys:s})=>{const o=new Set,r=this._getCoupledAttributesMap();for(const a of s){if(t.hasAttribute(a))continue;const l=r.get(a);if(l)for(const c of l)t.hasAttribute(c)&&o.add(c)}o.size!=0&&e.change(a=>{for(const l of o)a.removeSelectionAttribute(l)})})}_registerAssociatedHtmlAttributesPostFixer(){const e=this.editor.model;e.document.registerPostFixer(t=>{const i=e.document.differ.getChanges();let s=!1;for(const o of i)if(!(o.type!=="insert"||o.name==="$text"))for(const r of o.attributes.keys())!r.startsWith("html")||!r.endsWith("Attributes")||e.schema.checkAttribute(o.name,r)||(t.removeAttribute(r,o.position.nodeAfter),s=!0);return s})}_getCoupledAttributesMap(){if(this._coupledAttributes)return this._coupledAttributes;this._coupledAttributes=new Map;for(const e of this._allowedElements)if(e.coupledAttribute&&e.model){const t=this._coupledAttributes.get(e.coupledAttribute);t?t.push(e.model):this._coupledAttributes.set(e.coupledAttribute,[e.model])}return this._coupledAttributes}_fireRegisterEvent(e){e.view&&this._disallowedElements.has(e.view)||this.fire(e.view?`register:${e.view}`:"register",e)}_registerObjectElement(e){const t=this.editor,i=t.model.schema,s=t.conversion,{view:o,model:r}=e;i.register(r,e.modelSchema);/* istanbul ignore next: paranoid check -- @preserve */o&&(i.extend(e.model,{allowAttributes:[He(o),"htmlContent"]}),t.data.registerRawContentMatcher({name:o}),s.for("upcast").elementToElement({view:o,model:ll(e),converterPriority:Me.low+2}),s.for("upcast").add(Hn(e,this)),s.for("editingDowncast").elementToStructure({model:{name:r,attributes:[He(o)]},view:$6(t,e)}),s.for("dataDowncast").elementToElement({model:r,view:(a,{writer:l})=>yo(o,a,l)}),s.for("dataDowncast").add(Un(e)))}_registerBlockElement(e){const t=this.editor,i=t.model.schema,s=t.conversion,{view:o,model:r}=e;if(!i.isRegistered(e.model)){if(i.register(e.model,e.modelSchema),!o)return;s.for("upcast").elementToElement({model:r,view:o,converterPriority:Me.low+2}),s.for("downcast").elementToElement({model:r,view:o})}o&&(i.extend(e.model,{allowAttributes:He(o)}),s.for("upcast").add(Hn(e,this)),s.for("downcast").add(Un(e)))}_registerInlineElement(e){const t=this.editor,i=t.model.schema,s=t.conversion,o=e.model;e.appliesToBlock||(i.extend("$text",{allowAttributes:o}),e.attributeProperties&&i.setAttributeProperties(o,e.attributeProperties),s.for("upcast").add(z6(e,this)),s.for("downcast").attributeToElement({model:o,view:H6(e)}),e.allowEmpty&&(i.setAttributeProperties(o,{copyFromObject:!1}),i.isRegistered("htmlEmptyElement")||i.register("htmlEmptyElement",{inheritAllFrom:"$inlineObject"}),t.data.htmlProcessor.domConverter.registerInlineObjectMatcher(r=>r.name==e.view&&r.isEmpty&&Array.from(r.getAttributeKeys()).length?{name:!0}:null),s.for("editingDowncast").elementToElement({model:"htmlEmptyElement",view:Dd(e,!0)}),s.for("dataDowncast").elementToElement({model:"htmlEmptyElement",view:Dd(e)})))}}function $d(n,e,t){const i=W6(n,e,t),{attributes:s,styles:o,classes:r}=j6(i),a={};if(s.size)for(const l of s)Vf(l)||s.delete(l);return s.size&&(a.attributes=zd(s,l=>n.getAttribute(l))),o.size&&(a.styles=zd(o,l=>n.getStyle(l))),r.size&&(a.classes=Array.from(r)),Object.keys(a).length?a:null}function W6(n,{consumable:e},t){const i=t.matchAll(n)||[],s=[];for(const o of i)q6(e,n,o),delete o.match.name,e.consume(n,o.match),s.push(o);return s}function q6(n,e,t){for(const i of["attributes","classes","styles"]){const s=t.match[i];if(s)for(const o of Array.from(s))n.test(e,{[i]:[o]})||n2(s,o)}}function j6(n){const e={attributes:new Set,classes:new Set,styles:new Set};for(const t of n)for(const i in e)(t.match[i]||[]).forEach(o=>e[i].add(o));return e}function zd(n,e){const t={};for(const i of n)e(i)!==void 0&&(t[i]=e(i));return t}function rr(n,e){const{name:t}=n,i=n[e];return Se(i)?Object.entries(i).map(([s,o])=>({name:t,[e]:{[s]:o}})):Array.isArray(i)?i.map(s=>({name:t,[e]:[s]})):[n]}function Hd(n){const{name:e,attributes:t,classes:i,styles:s}=n,o=[];return t&&o.push(...rr({name:e,attributes:t},"attributes")),i&&o.push(...rr({name:e,classes:i},"classes")),s&&o.push(...rr({name:e,styles:s},"styles")),o}/**
|
|
1439
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1440
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1441
|
+
*/class G6 extends w{static get requires(){return[ce]}static get pluginName(){return"CodeBlockElementSupport"}init(){if(!this.editor.plugins.has("CodeBlockEditing"))return;const e=this.editor.plugins.get(ce);e.on("register:pre",(t,i)=>{if(i.model!=="codeBlock")return;const s=this.editor,o=s.model.schema,r=s.conversion;o.extend("codeBlock",{allowAttributes:["htmlPreAttributes","htmlContentAttributes"]}),r.for("upcast").add(K6(e)),r.for("downcast").add(Z6()),t.stop()})}}function K6(n){return e=>{e.on("element:code",(t,i,s)=>{const o=i.viewItem,r=o.parent;if(!r||!r.is("element","pre"))return;a(r,"htmlPreAttributes"),a(o,"htmlContentAttributes");function a(l,c){const u=n.processViewAttributes(l,s);u&&s.writer.setAttribute(c,u,i.modelRange)}},{priority:"low"})}}function Z6(){return n=>{n.on("attribute:htmlPreAttributes:codeBlock",(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const{attributeOldValue:s,attributeNewValue:o}=t,a=i.mapper.toViewElement(t.item).parent;oi(i.writer,s,o,a)}),n.on("attribute:htmlContentAttributes:codeBlock",(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const{attributeOldValue:s,attributeNewValue:o}=t,r=i.mapper.toViewElement(t.item);oi(i.writer,s,o,r)})}}/**
|
|
1442
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1443
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1444
|
+
*/class J6 extends w{static get requires(){return[ce]}static get pluginName(){return"DualContentModelElementSupport"}init(){this.editor.plugins.get(ce).on("register",(t,i)=>{const s=i,o=this.editor,r=o.model.schema,a=o.conversion;if(!s.paragraphLikeModel||r.isRegistered(s.model)||r.isRegistered(s.paragraphLikeModel))return;const l={model:s.paragraphLikeModel,view:s.view};r.register(s.model,s.modelSchema),r.register(l.model,{inheritAllFrom:"$block"}),a.for("upcast").elementToElement({view:s.view,model:(c,{writer:u})=>this._hasBlockContent(c)?u.createElement(s.model):u.createElement(l.model),converterPriority:Me.low+.5}),a.for("downcast").elementToElement({view:s.view,model:s.model}),this._addAttributeConversion(s),a.for("downcast").elementToElement({view:l.view,model:l.model}),this._addAttributeConversion(l),t.stop()})}_hasBlockContent(e){const t=this.editor.editing.view,i=t.domConverter.blockElements;for(const s of t.createRangeIn(e).getItems())if(s.is("element")&&i.includes(s.name))return!0;return!1}_addAttributeConversion(e){const t=this.editor,i=t.conversion,s=t.plugins.get(ce);t.model.schema.extend(e.model,{allowAttributes:He(e.view)}),i.for("upcast").add(Hn(e,s)),i.for("downcast").add(Un(e))}}/**
|
|
1445
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1446
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1447
|
+
*/class Y6 extends w{static get requires(){return[Wi,ts]}static get pluginName(){return"HeadingElementSupport"}init(){const e=this.editor;if(!e.plugins.has("HeadingEditing"))return;const t=e.config.get("heading.options");this.registerHeadingElements(e,t)}registerHeadingElements(e,t){const i=e.plugins.get(Wi),s=[];for(const o of t)"model"in o&&"view"in o&&(i.registerBlockElement({view:o.view,model:o.model}),s.push(o.model));i.extendBlockElement({model:"htmlHgroup",modelSchema:{allowChildren:s}})}}/**
|
|
1448
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1449
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1450
|
+
*/function to(n,e,t){const i=n.createRangeOn(e);for(const{item:s}of i.getWalker())if(s.is("element",t))return s}/**
|
|
1451
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1452
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1453
|
+
*/class Q6 extends w{static get requires(){return[ce]}static get pluginName(){return"ImageElementSupport"}init(){const e=this.editor;if(!e.plugins.has("ImageInlineEditing")&&!e.plugins.has("ImageBlockEditing"))return;const t=e.model.schema,i=e.conversion,s=e.plugins.get(ce);s.on("register:figure",()=>{i.for("upcast").add(tR(s))}),s.on("register:img",(o,r)=>{r.model!=="imageBlock"&&r.model!=="imageInline"||(t.isRegistered("imageBlock")&&t.extend("imageBlock",{allowAttributes:["htmlImgAttributes","htmlFigureAttributes","htmlLinkAttributes"]}),t.isRegistered("imageInline")&&t.extend("imageInline",{allowAttributes:["htmlA","htmlImgAttributes"]}),i.for("upcast").add(X6(s)),i.for("downcast").add(iR()),e.plugins.has("LinkImage")&&i.for("upcast").add(eR(s,e)),o.stop())})}}function X6(n){return e=>{e.on("element:img",(t,i,s)=>{if(!i.modelRange)return;const o=i.viewItem,r=n.processViewAttributes(o,s);r&&s.writer.setAttribute("htmlImgAttributes",r,i.modelRange)},{priority:"low"})}}function eR(n,e){const t=e.plugins.get("ImageUtils");return i=>{i.on("element:a",(s,o,r)=>{const a=o.viewItem;if(!t.findViewImgElement(a))return;const c=o.modelCursor.parent;if(!c.is("element","imageBlock"))return;const u=n.processViewAttributes(a,r);u&&r.writer.setAttribute("htmlLinkAttributes",u,c)},{priority:"low"})}}function tR(n){return e=>{e.on("element:figure",(t,i,s)=>{const o=i.viewItem;if(!i.modelRange||!o.hasClass("image"))return;const r=n.processViewAttributes(o,s);r&&s.writer.setAttribute("htmlFigureAttributes",r,i.modelRange)},{priority:"low"})}}function iR(){return n=>{e("htmlImgAttributes"),t("img","htmlImgAttributes"),t("figure","htmlFigureAttributes"),t("a","htmlLinkAttributes");function e(i){n.on(`attribute:${i}:imageInline`,(s,o,r)=>{if(!r.consumable.consume(o.item,s.name))return;const{attributeOldValue:a,attributeNewValue:l}=o,c=r.mapper.toViewElement(o.item);oi(r.writer,a,l,c)},{priority:"low"})}function t(i,s){n.on(`attribute:${s}:imageBlock`,(o,r,a)=>{if(!a.consumable.test(r.item,o.name))return;const{attributeOldValue:l,attributeNewValue:c}=r,u=a.mapper.toViewElement(r.item),d=to(a.writer,u,i);d&&(oi(a.writer,l,c,d),a.consumable.consume(r.item,o.name))},{priority:"low"}),i==="a"&&n.on("attribute:linkHref:imageBlock",(o,r,a)=>{if(!a.consumable.consume(r.item,"attribute:htmlLinkAttributes:imageBlock"))return;const l=a.mapper.toViewElement(r.item),c=to(a.writer,l,"a");st(a.writer,r.item.getAttribute("htmlLinkAttributes"),c)},{priority:"low"})}}}/**
|
|
1454
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1455
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1456
|
+
*/class nR extends w{static get requires(){return[ce]}static get pluginName(){return"MediaEmbedElementSupport"}init(){const e=this.editor;if(!e.plugins.has("MediaEmbed")||e.config.get("mediaEmbed.previewsInData"))return;const t=e.model.schema,i=e.conversion,s=this.editor.plugins.get(ce),o=this.editor.plugins.get(Wi),r=e.config.get("mediaEmbed.elementName");o.registerBlockElement({model:"media",view:r}),s.on("register:figure",()=>{i.for("upcast").add(oR(s))}),s.on(`register:${r}`,(a,l)=>{l.model==="media"&&(t.extend("media",{allowAttributes:[He(r),"htmlFigureAttributes"]}),i.for("upcast").add(sR(s,r)),i.for("dataDowncast").add(rR(r)),a.stop())})}}function sR(n,e){const t=(i,s,o)=>{const r=s.viewItem;a(r,He(e));function a(l,c){const u=n.processViewAttributes(l,o);u&&o.writer.setAttribute(c,u,s.modelRange)}};return i=>{i.on(`element:${e}`,t,{priority:"low"})}}function oR(n){return e=>{e.on("element:figure",(t,i,s)=>{const o=i.viewItem;if(!i.modelRange||!o.hasClass("media"))return;const r=n.processViewAttributes(o,s);r&&s.writer.setAttribute("htmlFigureAttributes",r,i.modelRange)},{priority:"low"})}}function rR(n){return e=>{t(n,He(n)),t("figure","htmlFigureAttributes");function t(i,s){e.on(`attribute:${s}:media`,(o,r,a)=>{if(!a.consumable.consume(r.item,o.name))return;const{attributeOldValue:l,attributeNewValue:c}=r,u=a.mapper.toViewElement(r.item),d=to(a.writer,u,i);oi(a.writer,l,c,d)})}}}/**
|
|
1457
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1458
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1459
|
+
*/class aR extends w{static get requires(){return[ce]}static get pluginName(){return"ScriptElementSupport"}init(){const e=this.editor.plugins.get(ce);e.on("register:script",(t,i)=>{const s=this.editor,o=s.model.schema,r=s.conversion;o.register("htmlScript",i.modelSchema),o.extend("htmlScript",{allowAttributes:["htmlScriptAttributes","htmlContent"],isContent:!0}),s.data.registerRawContentMatcher({name:"script"}),r.for("upcast").elementToElement({view:"script",model:ll(i)}),r.for("upcast").add(Hn(i,e)),r.for("downcast").elementToElement({model:"htmlScript",view:(a,{writer:l})=>yo("script",a,l)}),r.for("downcast").add(Un(i)),t.stop()})}}/**
|
|
1460
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1461
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1462
|
+
*/class lR extends w{static get requires(){return[ce]}static get pluginName(){return"TableElementSupport"}init(){const e=this.editor;if(!e.plugins.has("TableEditing"))return;const t=e.model.schema,i=e.conversion,s=e.plugins.get(ce),o=e.plugins.get("TableUtils");s.on("register:figure",()=>{i.for("upcast").add(dR(s))}),s.on("register:table",(r,a)=>{a.model==="table"&&(t.extend("table",{allowAttributes:["htmlTableAttributes","htmlFigureAttributes","htmlTheadAttributes","htmlTbodyAttributes"]}),i.for("upcast").add(uR(s)),i.for("downcast").add(hR()),e.model.document.registerPostFixer(cR(e.model,o)),r.stop())})}}function cR(n,e){return t=>{const i=n.document.differ.getChanges();let s=!1;for(const o of i){if(o.type!="attribute"||o.attributeKey!="headingRows")continue;const r=o.range.start.nodeAfter,a=r.getAttribute("htmlTheadAttributes"),l=r.getAttribute("htmlTbodyAttributes");a&&!o.attributeNewValue?(t.removeAttribute("htmlTheadAttributes",r),s=!0):l&&o.attributeNewValue==e.getRows(r)&&(t.removeAttribute("htmlTbodyAttributes",r),s=!0)}return s}}function uR(n){return e=>{e.on("element:table",(t,i,s)=>{if(!i.modelRange)return;const o=i.viewItem;r(o,"htmlTableAttributes");for(const a of o.getChildren())a.is("element","thead")&&r(a,"htmlTheadAttributes"),a.is("element","tbody")&&r(a,"htmlTbodyAttributes");function r(a,l){const c=n.processViewAttributes(a,s);c&&s.writer.setAttribute(l,c,i.modelRange)}},{priority:"low"})}}function dR(n){return e=>{e.on("element:figure",(t,i,s)=>{const o=i.viewItem;if(!i.modelRange||!o.hasClass("table"))return;const r=n.processViewAttributes(o,s);r&&s.writer.setAttribute("htmlFigureAttributes",r,i.modelRange)},{priority:"low"})}}function hR(){return n=>{e("table","htmlTableAttributes"),e("figure","htmlFigureAttributes"),e("thead","htmlTheadAttributes"),e("tbody","htmlTbodyAttributes");function e(t,i){n.on(`attribute:${i}:table`,(s,o,r)=>{if(!r.consumable.test(o.item,s.name))return;const a=r.mapper.toViewElement(o.item),l=to(r.writer,a,t);l&&(r.consumable.consume(o.item,s.name),oi(r.writer,o.attributeOldValue,o.attributeNewValue,l))})}}}/**
|
|
1463
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1464
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1465
|
+
*/class fR extends w{static get requires(){return[ce]}static get pluginName(){return"StyleElementSupport"}init(){const e=this.editor.plugins.get(ce);e.on("register:style",(t,i)=>{const s=this.editor,o=s.model.schema,r=s.conversion;o.register("htmlStyle",i.modelSchema),o.extend("htmlStyle",{allowAttributes:["htmlStyleAttributes","htmlContent"],isContent:!0}),s.data.registerRawContentMatcher({name:"style"}),r.for("upcast").elementToElement({view:"style",model:ll(i)}),r.for("upcast").add(Hn(i,e)),r.for("downcast").elementToElement({model:"htmlStyle",view:(a,{writer:l})=>yo("style",a,l)}),r.for("downcast").add(Un(i)),t.stop()})}}/**
|
|
1466
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1467
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1468
|
+
*/class mR extends w{static get requires(){return[ce]}static get pluginName(){return"ListElementSupport"}init(){const e=this.editor;if(!e.plugins.has("ListEditing"))return;const t=e.model.schema,i=e.conversion,s=e.plugins.get(ce),o=e.plugins.get("ListEditing"),r=["ul","ol","li"];o.registerDowncastStrategy({scope:"item",attributeName:"htmlLiAttributes",setAttributeOnDowncast:st}),o.registerDowncastStrategy({scope:"list",attributeName:"htmlUlAttributes",setAttributeOnDowncast:st}),o.registerDowncastStrategy({scope:"list",attributeName:"htmlOlAttributes",setAttributeOnDowncast:st}),s.on("register",(a,l)=>{if(!r.includes(l.view)||(a.stop(),t.checkAttribute("$block","htmlLiAttributes")))return;const c=r.map(u=>He(u));t.extend("$listItem",{allowAttributes:c}),i.for("upcast").add(u=>{u.on("element:ul",ar("htmlUlAttributes",s),{priority:"low"}),u.on("element:ol",ar("htmlOlAttributes",s),{priority:"low"}),u.on("element:li",ar("htmlLiAttributes",s),{priority:"low"})})}),o.on("postFixer",(a,{listNodes:l,writer:c})=>{for(const{node:u,previousNodeInList:d}of l)if(d){if(d.getAttribute("listType")==u.getAttribute("listType")){const h=Ud(d.getAttribute("listType")),f=d.getAttribute(h);!Fs(u.getAttribute(h),f)&&c.model.schema.checkAttribute(u,h)&&(c.setAttribute(h,f,u),a.return=!0)}if(d.getAttribute("listItemId")==u.getAttribute("listItemId")){const h=d.getAttribute("htmlLiAttributes");!Fs(u.getAttribute("htmlLiAttributes"),h)&&c.model.schema.checkAttribute(u,"htmlLiAttributes")&&(c.setAttribute("htmlLiAttributes",h,u),a.return=!0)}}}),o.on("postFixer",(a,{listNodes:l,writer:c})=>{for(const{node:u}of l){const d=u.getAttribute("listType");d!=="numbered"&&u.getAttribute("htmlOlAttributes")&&(c.removeAttribute("htmlOlAttributes",u),a.return=!0),d==="numbered"&&u.getAttribute("htmlUlAttributes")&&(c.removeAttribute("htmlUlAttributes",u),a.return=!0)}})}afterInit(){const e=this.editor;if(!e.commands.get("indentList"))return;const t=e.commands.get("indentList");this.listenTo(t,"afterExecute",(i,s)=>{e.model.change(o=>{for(const r of s){const a=Ud(r.getAttribute("listType"));e.model.schema.checkAttribute(r,a)&&o.setAttribute(a,{},r)}})})}}function ar(n,e){return(t,i,s)=>{const o=i.viewItem;i.modelRange||Object.assign(i,s.convertChildren(i.viewItem,i.modelCursor));const r=e.processViewAttributes(o,s);for(const a of i.modelRange.getItems({shallow:!0}))a.hasAttribute("listItemId")&&(a.hasAttribute(n)||s.writer.model.schema.checkAttribute(a,n)&&s.writer.setAttribute(n,r||{},a))}}function Ud(n){return n==="numbered"?"htmlOlAttributes":"htmlUlAttributes"}/**
|
|
1469
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1470
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1471
|
+
*/class gR extends w{static get requires(){return[ce,Wi]}static get pluginName(){return"CustomElementSupport"}init(){const e=this.editor.plugins.get(ce),t=this.editor.plugins.get(Wi);e.on("register:$customElement",(i,s)=>{i.stop();const o=this.editor,r=o.model.schema,a=o.conversion,l=o.editing.view.domConverter.unsafeElements,c=o.data.htmlProcessor.domConverter.preElements;r.register(s.model,s.modelSchema),r.extend(s.model,{allowAttributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"],isContent:!0}),o.data.htmlProcessor.domConverter.registerRawContentMatcher({name:"template"}),a.for("upcast").elementToElement({view:/.*/,model:(u,d)=>{if(u.name=="$comment"||!pR(u.name)||t.getDefinitionsForView(u.name).size)return null;l.includes(u.name)||l.push(u.name),c.includes(u.name)||c.push(u.name);const h=d.writer.createElement(s.model,{htmlElementName:u.name}),f=e.processViewAttributes(u,d);f&&d.writer.setAttribute("htmlCustomElementAttributes",f,h);let m;if(u.is("element","template")&&u.getCustomProperty("$rawContent"))m=u.getCustomProperty("$rawContent");else{const _=new Yi(u.document).createDocumentFragment(u),C=o.data.htmlProcessor.domConverter.viewToDom(_),v=C.firstChild;for(;v.firstChild;)C.appendChild(v.firstChild);v.remove(),m=o.data.htmlProcessor.htmlWriter.getHtml(C)}d.writer.setAttribute("htmlContent",m,h);for(const{item:p}of o.editing.view.createRangeIn(u))d.consumable.consume(p,{name:!0});return h},converterPriority:"low"}),a.for("editingDowncast").elementToElement({model:{name:s.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(u,{writer:d})=>{const h=u.getAttribute("htmlElementName"),f=d.createRawElement(h);return u.hasAttribute("htmlCustomElementAttributes")&&st(d,u.getAttribute("htmlCustomElementAttributes"),f),f}}),a.for("dataDowncast").elementToElement({model:{name:s.model,attributes:["htmlElementName","htmlCustomElementAttributes","htmlContent"]},view:(u,{writer:d})=>{const h=u.getAttribute("htmlElementName"),f=u.getAttribute("htmlContent"),m=d.createRawElement(h,null,(p,_)=>{_.setContentOf(p,f)});return u.hasAttribute("htmlCustomElementAttributes")&&st(d,u.getAttribute("htmlCustomElementAttributes"),m),m}})})}}function pR(n){try{document.createElement(n)}catch{return!1}return!0}/**
|
|
1472
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1473
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1474
|
+
*/class wR extends w{static get pluginName(){return"GeneralHtmlSupport"}static get requires(){return[ce,G6,J6,Y6,Q6,nR,aR,lR,fR,mR,gR]}init(){const e=this.editor,t=e.plugins.get(ce);t.loadAllowedEmptyElementsConfig(e.config.get("htmlSupport.allowEmpty")||[]),t.loadAllowedConfig(e.config.get("htmlSupport.allow")||[]),t.loadDisallowedConfig(e.config.get("htmlSupport.disallow")||[])}getGhsAttributeNameForElement(e){const t=this.editor.plugins.get("DataSchema"),i=Array.from(t.getDefinitionsForView(e,!1)),s=i.find(o=>o.isInline&&!i[0].isObject);return s?s.model:He(e)}addModelHtmlClass(e,t,i){const s=this.editor.model,o=this.getGhsAttributeNameForElement(e);s.change(r=>{for(const a of Ti(s,i,o))Ei(r,a,o,"classes",l=>{for(const c of K(t))l.add(c)})})}removeModelHtmlClass(e,t,i){const s=this.editor.model,o=this.getGhsAttributeNameForElement(e);s.change(r=>{for(const a of Ti(s,i,o))Ei(r,a,o,"classes",l=>{for(const c of K(t))l.delete(c)})})}setModelHtmlAttributes(e,t,i){const s=this.editor.model,o=this.getGhsAttributeNameForElement(e);s.change(r=>{for(const a of Ti(s,i,o))Ei(r,a,o,"attributes",l=>{for(const[c,u]of Object.entries(t))l.set(c,u)})})}removeModelHtmlAttributes(e,t,i){const s=this.editor.model,o=this.getGhsAttributeNameForElement(e);s.change(r=>{for(const a of Ti(s,i,o))Ei(r,a,o,"attributes",l=>{for(const c of K(t))l.delete(c)})})}setModelHtmlStyles(e,t,i){const s=this.editor.model,o=this.getGhsAttributeNameForElement(e);s.change(r=>{for(const a of Ti(s,i,o))Ei(r,a,o,"styles",l=>{for(const[c,u]of Object.entries(t))l.set(c,u)})})}removeModelHtmlStyles(e,t,i){const s=this.editor.model,o=this.getGhsAttributeNameForElement(e);s.change(r=>{for(const a of Ti(s,i,o))Ei(r,a,o,"styles",l=>{for(const c of K(t))l.delete(c)})})}}function*Ti(n,e,t){if(e)if(!(Symbol.iterator in e)&&e.is("documentSelection")&&e.isCollapsed)n.schema.checkAttributeInSelection(e,t)&&(yield e);else for(const i of bR(n,e,t))yield*i.getItems({shallow:!0})}function bR(n,e,t){return!(Symbol.iterator in e)&&(e.is("node")||e.is("$text")||e.is("$textProxy"))?n.schema.checkAttribute(e,t)?[n.createRangeOn(e)]:[]:n.schema.getValidRanges(n.createSelection(e).getRanges(),t)}/**
|
|
1475
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1476
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1477
|
+
*/class Co extends R{constructor(e,t){super(e),this.attributeKey=t}refresh(){const e=this.editor.model,t=e.document;this.value=t.selection.getAttribute(this.attributeKey),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){const t=this.editor.model,s=t.document.selection,o=e.value,r=e.batch,a=l=>{if(s.isCollapsed)o?l.setSelectionAttribute(this.attributeKey,o):l.removeSelectionAttribute(this.attributeKey);else{const c=t.schema.getValidRanges(s.getRanges(),this.attributeKey);for(const u of c)o?l.setAttribute(this.attributeKey,o,u):l.removeAttribute(this.attributeKey,u)}};r?t.enqueueChange(r,l=>{a(l)}):t.change(l=>{a(l)})}}/**
|
|
1478
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1479
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1480
|
+
*/const Ve="fontSize",Le="fontFamily",tt="fontColor",gt="fontBackgroundColor";function Op(n,e){const t={model:{key:n,values:[]},view:{},upcastAlso:{}};for(const i of e)t.model.values.push(i.model),t.view[i.model]=i.view,i.upcastAlso&&(t.upcastAlso[i.model]=i.upcastAlso);return t}function Mp(n){return e=>vR(e.getStyle(n))}function Fp(n){return(e,{writer:t})=>t.createAttributeElement("span",{style:`${n}:${e}`},{priority:7})}function _R({dropdownView:n,colors:e,columns:t,removeButtonLabel:i,colorPickerLabel:s,documentColorsLabel:o,documentColorsCount:r,colorPickerViewConfig:a}){const l=n.locale,c=new DS(l,{colors:e,columns:t,removeButtonLabel:i,colorPickerLabel:s,documentColorsLabel:o,documentColorsCount:r,colorPickerViewConfig:a});return n.colorSelectorView=c,n.panelView.children.add(c),c}function vR(n){return n.replace(/\s/g,"")}/**
|
|
1481
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1482
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1483
|
+
*/class yR extends Co{constructor(e){super(e,Le)}}/**
|
|
1484
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1485
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1486
|
+
*/function Dp(n){return n.map(CR).filter(e=>e!==void 0)}function CR(n){if(typeof n=="object")return n;if(n==="default")return{title:"Default",model:void 0};if(typeof n=="string")return kR(n)}function kR(n){const e=n.replace(/"|'/g,"").split(","),t=e[0],i=e.map(ER).join(", ");return{title:t,model:i,view:{name:"span",styles:{"font-family":i},priority:7}}}function ER(n){return n=n.trim(),n.indexOf(" ")>0&&(n=`'${n}'`),n}/**
|
|
1487
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1488
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1489
|
+
*/class TR extends w{static get pluginName(){return"FontFamilyEditing"}constructor(e){super(e),e.config.define(Le,{options:["default","Arial, Helvetica, sans-serif","Courier New, Courier, monospace","Georgia, serif","Lucida Sans Unicode, Lucida Grande, sans-serif","Tahoma, Geneva, sans-serif","Times New Roman, Times, serif","Trebuchet MS, Helvetica, sans-serif","Verdana, Geneva, sans-serif"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:Le}),e.model.schema.setAttributeProperties(Le,{isFormatting:!0,copyOnEnter:!0});const t=Dp(e.config.get("fontFamily.options")).filter(s=>s.model),i=Op(Le,t);e.config.get("fontFamily.supportAllValues")?(this._prepareAnyValueConverters(),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(i),e.commands.add(Le,new yR(e))}_prepareAnyValueConverters(){const e=this.editor;e.conversion.for("downcast").attributeToElement({model:Le,view:(t,{writer:i})=>i.createAttributeElement("span",{style:"font-family:"+t},{priority:7})}),e.conversion.for("upcast").elementToAttribute({model:{key:Le,value:t=>t.getStyle("font-family")},view:{name:"span",styles:{"font-family":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{face:/.*/}},model:{key:Le,value:t=>t.getAttribute("face")}})}}const AR='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.03 3h6.149a.75.75 0 1 1 0 1.5h-5.514L11.03 3zm1.27 3h4.879a.75.75 0 1 1 0 1.5h-4.244L12.3 6zm1.27 3h3.609a.75.75 0 1 1 0 1.5h-2.973L13.57 9zm-2.754 2.5L8.038 4.785 5.261 11.5h5.555zm.62 1.5H4.641l-1.666 4.028H1.312l5.789-14h1.875l5.789 14h-1.663L11.436 13z"/></svg>';/**
|
|
1490
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1491
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1492
|
+
*/class SR extends w{static get pluginName(){return"FontFamilyUI"}init(){const e=this.editor,t=e.t,i=this._getLocalizedOptions(),s=e.commands.get(Le),o=t("Font Family");e.ui.componentFactory.add(Le,r=>{const a=fe(r);return di(a,()=>xR(i,s),{role:"menu",ariaLabel:o}),a.buttonView.set({label:o,icon:AR,tooltip:!0}),a.extendTemplate({attributes:{class:"ck-font-family-dropdown"}}),a.bind("isEnabled").to(s),this.listenTo(a,"execute",l=>{e.execute(l.source.commandName,{value:l.source.commandParam}),e.editing.view.focus()}),a})}_getLocalizedOptions(){const e=this.editor,t=e.t;return Dp(e.config.get(Le).options).map(s=>(s.title==="Default"&&(s.title=t("Default")),s))}}function xR(n,e){const t=new _e;for(const i of n){const s={type:"button",model:new hi({commandName:Le,commandParam:i.model,label:i.title,role:"menuitemradio",withText:!0})};s.model.bind("isOn").to(e,"value",o=>o===i.model?!0:!o||!i.model?!1:o.split(",")[0].replace(/'/g,"").toLowerCase()===i.model.toLowerCase()),i.view&&typeof i.view!="string"&&i.view.styles&&s.model.set("labelStyle",`font-family: ${i.view.styles["font-family"]}`),t.add(s)}return t}/**
|
|
1493
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1494
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1495
|
+
*/class IR extends w{static get requires(){return[TR,SR]}static get pluginName(){return"FontFamily"}}/**
|
|
1496
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1497
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1498
|
+
*/class PR extends Co{constructor(e){super(e,Ve)}}/**
|
|
1499
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1500
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1501
|
+
*/function cl(n){return n.map(e=>RR(e)).filter(e=>e!==void 0)}const Wd={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 RR(n){if(typeof n=="number"&&(n=String(n)),typeof n=="object"&&BR(n))return aa(n);const e=LR(n);if(e)return aa(e);if(n==="default")return{model:void 0,title:"Default"};if(!OR(n))return VR(n)}function VR(n){return typeof n=="string"&&(n={title:n,model:`${parseFloat(n)}px`}),n.view={name:"span",styles:{"font-size":n.model}},aa(n)}function aa(n){return n.view&&typeof n.view!="string"&&!n.view.priority&&(n.view.priority=7),n}function LR(n){return typeof n=="string"?Wd[n]:Wd[n.model]}function BR(n){return n.title&&n.model&&n.view}function OR(n){let e;if(typeof n=="object")if(n.model)e=parseFloat(n.model);else throw new g("font-size-invalid-definition",null,n);else e=parseFloat(n);return isNaN(e)}/**
|
|
1502
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1503
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1504
|
+
*/const qd=["x-small","x-small","small","medium","large","x-large","xx-large","xxx-large"];class MR extends w{static get pluginName(){return"FontSizeEditing"}constructor(e){super(e),e.config.define(Ve,{options:["tiny","small","default","big","huge"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:Ve}),e.model.schema.setAttributeProperties(Ve,{isFormatting:!0,copyOnEnter:!0});const t=e.config.get("fontSize.supportAllValues"),i=cl(this.editor.config.get("fontSize.options")).filter(o=>o.model),s=Op(Ve,i);t?(this._prepareAnyValueConverters(s),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(s),e.commands.add(Ve,new PR(e))}_prepareAnyValueConverters(e){const t=this.editor,i=e.model.values.filter(s=>!vT(String(s))&&!CT(String(s)));if(i.length)throw new g("font-size-invalid-use-of-named-presets",null,{presets:i});t.conversion.for("downcast").attributeToElement({model:Ve,view:(s,{writer:o})=>{if(s)return o.createAttributeElement("span",{style:"font-size:"+s},{priority:7})}}),t.conversion.for("upcast").elementToAttribute({model:{key:Ve,value:s=>s.getStyle("font-size")},view:{name:"span",styles:{"font-size":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{size:/^[+-]?\d{1,3}$/}},model:{key:Ve,value:t=>{const i=t.getAttribute("size"),s=i[0]==="-"||i[0]==="+";let o=parseInt(i,10);s&&(o=3+o);const r=qd.length-1,a=Math.min(Math.max(o,0),r);return qd[a]}}})}}const FR='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.816 11.5 7.038 4.785 4.261 11.5h5.555zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663L10.436 13zm7.55 2.279.779-.779.707.707-2.265 2.265-2.193-2.265.707-.707.765.765V4.825c0-.042 0-.083.002-.123l-.77.77-.707-.707L17.207 2.5l2.265 2.265-.707.707-.782-.782c.002.043.003.089.003.135v10.454z"/></svg>';/**
|
|
1505
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1506
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1507
|
+
*/class DR extends w{static get pluginName(){return"FontSizeUI"}init(){const e=this.editor,t=e.t,i=this._getLocalizedOptions(),s=e.commands.get(Ve),o=t("Font Size");e.ui.componentFactory.add(Ve,r=>{const a=fe(r);return di(a,()=>NR(i,s),{role:"menu",ariaLabel:o}),a.buttonView.set({label:o,icon:FR,tooltip:!0}),a.extendTemplate({attributes:{class:["ck-font-size-dropdown"]}}),a.bind("isEnabled").to(s),this.listenTo(a,"execute",l=>{e.execute(l.source.commandName,{value:l.source.commandParam}),e.editing.view.focus()}),a})}_getLocalizedOptions(){const e=this.editor,t=e.t,i={Default:t("Default"),Tiny:t("Tiny"),Small:t("Small"),Big:t("Big"),Huge:t("Huge")};return cl(e.config.get(Ve).options).map(o=>{const r=i[o.title];return r&&r!=o.title&&(o=Object.assign({},o,{title:r})),o})}}function NR(n,e){const t=new _e;for(const i of n){const s={type:"button",model:new hi({commandName:Ve,commandParam:i.model,label:i.title,class:"ck-fontsize-option",role:"menuitemradio",withText:!0})};i.view&&typeof i.view!="string"&&(i.view.styles&&s.model.set("labelStyle",`font-size:${i.view.styles["font-size"]}`),i.view.classes&&s.model.set("class",`${s.model.class} ${i.view.classes}`)),s.model.bind("isOn").to(e,"value",o=>o===i.model),t.add(s)}return t}/**
|
|
1508
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1509
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1510
|
+
*/class $R extends w{static get requires(){return[MR,DR]}static get pluginName(){return"FontSize"}normalizeSizeOptions(e){return cl(e)}}/**
|
|
1511
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1512
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1513
|
+
*/class zR extends Co{constructor(e){super(e,tt)}}/**
|
|
1514
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1515
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1516
|
+
*/class HR extends w{static get pluginName(){return"FontColorEditing"}constructor(e){super(e),e.config.define(tt,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{color:/[\s\S]+/}},model:{key:tt,value:Mp("color")}}),e.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{color:/^#?\w+$/}},model:{key:tt,value:t=>t.getAttribute("color")}}),e.conversion.for("downcast").attributeToElement({model:tt,view:Fp("color")}),e.commands.add(tt,new zR(e)),e.model.schema.extend("$text",{allowAttributes:tt}),e.model.schema.setAttributeProperties(tt,{isFormatting:!0,copyOnEnter:!0})}}/**
|
|
1517
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1518
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1519
|
+
*/class Np extends w{constructor(e,{commandName:t,componentName:i,icon:s,dropdownLabel:o}){super(e),this.commandName=t,this.componentName=i,this.icon=s,this.dropdownLabel=o,this.columns=e.config.get(`${this.componentName}.columns`)}init(){const e=this.editor,t=e.locale,i=t.t,s=e.commands.get(this.commandName),o=e.config.get(this.componentName),r=dC(o.colors),a=uC(t,r),l=o.documentColors,c=o.colorPicker!==!1;e.ui.componentFactory.add(this.componentName,u=>{const d=fe(u);let h=!1;const f=_R({dropdownView:d,colors:a.map(m=>({label:m.label,color:m.model,options:{hasBorder:m.hasBorder}})),columns:this.columns,removeButtonLabel:i("Remove color"),colorPickerLabel:i("Color picker"),documentColorsLabel:l!==0?i("Document colors"):"",documentColorsCount:l===void 0?this.columns:l,colorPickerViewConfig:c?o.colorPicker||{}:!1});return f.bind("selectedColor").to(s,"value"),d.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:!0}),d.extendTemplate({attributes:{class:"ck-color-ui-dropdown"}}),d.bind("isEnabled").to(s),f.on("execute",(m,p)=>{d.isOpen&&e.execute(this.commandName,{value:p.value,batch:this._undoStepBatch}),p.source!=="colorPicker"&&e.editing.view.focus(),p.source==="colorPickerSaveButton"&&(d.isOpen=!1)}),f.on("colorPicker:show",()=>{this._undoStepBatch=e.model.createBatch()}),f.on("colorPicker:cancel",()=>{this._undoStepBatch.operations.length&&(d.isOpen=!1,e.execute("undo",this._undoStepBatch)),e.editing.view.focus()}),d.on("change:isOpen",(m,p,_)=>{h||(h=!0,d.colorSelectorView.appendUI()),_&&(l!==0&&f.updateDocumentColors(e.model,this.componentName),f.updateSelectedColors(),f.showColorGridsFragment())}),wo(d,()=>d.colorSelectorView.colorGridsFragmentView.staticColorsGrid.items.find(m=>m.isOn)),d})}}const UR='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.4 10.3 10 4.5l-2.4 5.8h4.8zm.5 1.2H7.1L5.7 15H4.2l5-12h1.6l5 12h-1.5L13 11.5zm3.1 7H4a1 1 0 0 1 0-2h12a1 1 0 0 1 0 2z"/></svg>';/**
|
|
1520
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1521
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1522
|
+
*/class WR extends Np{constructor(e){const t=e.locale.t;super(e,{commandName:tt,componentName:tt,icon:UR,dropdownLabel:t("Font Color")})}static get pluginName(){return"FontColorUI"}}/**
|
|
1523
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1524
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1525
|
+
*/class qR extends w{static get requires(){return[HR,WR]}static get pluginName(){return"FontColor"}}/**
|
|
1526
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1527
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1528
|
+
*/class jR extends Co{constructor(e){super(e,gt)}}/**
|
|
1529
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1530
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1531
|
+
*/class GR extends w{static get pluginName(){return"FontBackgroundColorEditing"}constructor(e){super(e),e.config.define(gt,{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(OT),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{"background-color":/[\s\S]+/}},model:{key:gt,value:Mp("background-color")}}),e.conversion.for("downcast").attributeToElement({model:gt,view:Fp("background-color")}),e.commands.add(gt,new jR(e)),e.model.schema.extend("$text",{allowAttributes:gt}),e.model.schema.setAttributeProperties(gt,{isFormatting:!0,copyOnEnter:!0})}}const KR='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M4 2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zm8.38 9.262H7.62L10 5.506l2.38 5.756zm.532 1.285L14.34 16h1.426L10.804 4H9.196L4.234 16H5.66l1.428-3.453h5.824z"/></svg>';/**
|
|
1532
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1533
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1534
|
+
*/class ZR extends Np{constructor(e){const t=e.locale.t;super(e,{commandName:gt,componentName:gt,icon:KR,dropdownLabel:t("Font Background Color")})}static get pluginName(){return"FontBackgroundColorUI"}}/**
|
|
1535
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1536
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1537
|
+
*/class JR extends w{static get requires(){return[GR,ZR]}static get pluginName(){return"FontBackgroundColor"}}/**
|
|
1538
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1539
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1540
|
+
*/class YR extends w{static get requires(){return[IR,$R,qR,JR]}static get pluginName(){return"Font"}}/**
|
|
1541
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1542
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1543
|
+
*/class QR extends B{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(){const e=new T(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}}/**
|
|
1544
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1545
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1546
|
+
*/class XR extends T{constructor(e,t){super(e),this.focusTracker=new ne,this.keystrokes=new ae,this.set("activeStyles",[]),this.set("enabledStyles",[]),this.children=this.createCollection(),this.children.delegate("execute").to(this);for(const i of t){const s=new QR(e,i);this.children.add(s)}this.on("change:activeStyles",()=>{for(const i of this.children)i.isOn=this.activeStyles.includes(i.styleDefinition.name)}),this.on("change:enabledStyles",()=>{for(const i of this.children)i.isEnabled=this.enabledStyles.includes(i.styleDefinition.name)}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-grid"],role:"listbox"},children:this.children})}render(){super.render();for(const e of this.children)this.focusTracker.add(e.element);Wn({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()}}/**
|
|
1547
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1548
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1549
|
+
*/class jd extends T{constructor(e,t,i){super(e),this.labelView=new Jn(e),this.labelView.text=t,this.gridView=new XR(e,i),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-panel__style-group"],role:"group","aria-labelledby":this.labelView.id},children:[this.labelView,this.gridView]})}}/**
|
|
1550
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1551
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1552
|
+
*/class e8 extends T{constructor(e,t){super(e);const i=e.t;this.focusTracker=new ne,this.keystrokes=new ae,this.children=this.createCollection(),this.blockStylesGroupView=new jd(e,i("Block styles"),t.block),this.inlineStylesGroupView=new jd(e,i("Text styles"),t.inline),this.set("activeStyles",[]),this.set("enabledStyles",[]),this._focusables=new Ae,this._focusCycler=new ke({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()}}/**
|
|
1553
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1554
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1555
|
+
*/const t8=["caption","colgroup","dd","dt","figcaption","legend","li","optgroup","option","rp","rt","summary","tbody","td","tfoot","th","thead","tr"];class Ct extends w{static get pluginName(){return"StyleUtils"}constructor(e){super(e),this.decorate("isStyleEnabledForBlock"),this.decorate("isStyleActiveForBlock"),this.decorate("getAffectedBlocks"),this.decorate("isStyleEnabledForInlineSelection"),this.decorate("isStyleActiveForInlineSelection"),this.decorate("getAffectedInlineSelectable"),this.decorate("getStylePreview"),this.decorate("configureGHSDataFilter")}init(){this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport")}normalizeConfig(e,t=[]){const i={block:[],inline:[]};for(const s of t){const o=[],r=[];for(const l of e.getDefinitionsForView(s.element)){const c="appliesToBlock"in l?l.appliesToBlock:!1;if(l.isBlock||c){if(typeof c=="string")o.push(c);else if(l.isBlock){const u=l;o.push(l.model),u.paragraphLikeModel&&o.push(u.paragraphLikeModel)}}else r.push(l.model)}const a=this.getStylePreview(s,[{text:"AaBbCcDdEeFfGgHhIiJj"}]);o.length?i.block.push({...s,previewTemplate:a,modelElements:o,isBlock:!0}):i.inline.push({...s,previewTemplate:a,ghsAttributes:r})}return i}isStyleEnabledForBlock(e,t){const i=this.editor.model,s=this._htmlSupport.getGhsAttributeNameForElement(e.element);return i.schema.checkAttribute(t,s)?e.modelElements.includes(t.name):!1}isStyleActiveForBlock(e,t){const i=this._htmlSupport.getGhsAttributeNameForElement(e.element),s=t.getAttribute(i);return this.hasAllClasses(s,e.classes)}getAffectedBlocks(e,t){return e.modelElements.includes(t.name)?[t]:null}isStyleEnabledForInlineSelection(e,t){const i=this.editor.model;for(const s of e.ghsAttributes)if(i.schema.checkAttributeInSelection(t,s))return!0;return!1}isStyleActiveForInlineSelection(e,t){for(const i of e.ghsAttributes){const s=this._getValueFromFirstAllowedNode(t,i);if(this.hasAllClasses(s,e.classes))return!0}return!1}getAffectedInlineSelectable(e,t){return t}getStylePreview(e,t){const{element:i,classes:s}=e;return{tag:n8(i)?i:"div",attributes:{class:s},children:t}}hasAllClasses(e,t){return ie(e)&&i8(e)&&t.every(i=>e.classes.includes(i))}configureGHSDataFilter({block:e,inline:t}){const i=this.editor.plugins.get("DataFilter");i.loadAllowedConfig(e.map(Gd)),i.loadAllowedConfig(t.map(Gd))}_getValueFromFirstAllowedNode(e,t){const s=this.editor.model.schema;if(e.isCollapsed)return e.getAttribute(t);for(const o of e.getRanges())for(const r of o.getItems())if(s.checkAttribute(r,t))return r.getAttribute(t);return null}}function i8(n){return!!n.classes&&Array.isArray(n.classes)}function n8(n){return!t8.includes(n)}function Gd({element:n,classes:e}){return{name:n,classes:e}}/**
|
|
1556
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1557
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1558
|
+
*/class s8 extends w{static get pluginName(){return"StyleUI"}static get requires(){return[Ct]}init(){const e=this.editor,t=e.plugins.get("DataSchema"),i=e.plugins.get("StyleUtils"),s=e.config.get("style.definitions"),o=i.normalizeConfig(t,s);e.ui.componentFactory.add("style",r=>{const a=r.t,l=fe(r),c=e.commands.get("style");return l.once("change:isOpen",()=>{const u=new e8(r,o);l.panelView.children.add(u),u.delegate("execute").to(l),u.bind("activeStyles").to(c,"value"),u.bind("enabledStyles").to(c,"enabledStyles")}),l.bind("isEnabled").to(c),l.buttonView.withText=!0,l.buttonView.bind("label").to(c,"value",u=>u.length>1?a("Multiple styles"):u.length===1?u[0]:a("Styles")),l.bind("class").to(c,"value",u=>{const d=["ck-style-dropdown"];return u.length>1&&d.push("ck-style-dropdown_multiple-active"),d.join(" ")}),l.on("execute",u=>{e.execute("style",{styleName:u.source.styleDefinition.name}),e.editing.view.focus()}),l})}}/**
|
|
1559
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1560
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1561
|
+
*/class o8 extends R{constructor(e,t){super(e),this.set("value",[]),this.set("enabledStyles",[]),this._styleDefinitions=t,this._styleUtils=this.editor.plugins.get(Ct)}refresh(){const e=this.editor.model,t=e.document.selection,i=new Set,s=new Set;for(const r of this._styleDefinitions.inline)this._styleUtils.isStyleEnabledForInlineSelection(r,t)&&s.add(r.name),this._styleUtils.isStyleActiveForInlineSelection(r,t)&&i.add(r.name);const o=J(t.getSelectedBlocks())||t.getFirstPosition().parent;if(o){const r=o.getAncestors({includeSelf:!0,parentFirst:!0});for(const a of r){if(a.is("rootElement"))break;for(const l of this._styleDefinitions.block)this._styleUtils.isStyleEnabledForBlock(l,a)&&(s.add(l.name),this._styleUtils.isStyleActiveForBlock(l,a)&&i.add(l.name));if(e.schema.isObject(a))break}}this.enabledStyles=Array.from(s).sort(),this.isEnabled=this.enabledStyles.length>0,this.value=this.isEnabled?Array.from(i).sort():[]}execute({styleName:e,forceValue:t}){if(!this.enabledStyles.includes(e)){H("style-command-executed-with-incorrect-style-name");return}const i=this.editor.model,s=i.document.selection,o=this.editor.plugins.get("GeneralHtmlSupport"),r=[...this._styleDefinitions.inline,...this._styleDefinitions.block],a=r.filter(({name:u})=>this.value.includes(u)),l=r.find(({name:u})=>u==e),c=t===void 0?!this.value.includes(l.name):t;i.change(()=>{let u;a8(l)?u=this._findAffectedBlocks(l8(s),l):u=[this._styleUtils.getAffectedInlineSelectable(l,s)];for(const d of u)c?o.addModelHtmlClass(l.element,l.classes,d):o.removeModelHtmlClass(l.element,r8(a,l),d)})}_findAffectedBlocks(e,t){const i=new Set;for(const s of e){const o=s.getAncestors({includeSelf:!0,parentFirst:!0});for(const r of o){if(r.is("rootElement"))break;const a=this._styleUtils.getAffectedBlocks(t,r);if(a){for(const l of a)i.add(l);break}}}return i}}function r8(n,e){return n.reduce((t,i)=>i.name===e.name?t:t.filter(s=>!i.classes.includes(s)),e.classes)}function a8(n){return"isBlock"in n}function l8(n){const e=Array.from(n.getSelectedBlocks());return e.length?e:[n.getFirstPosition().parent]}/**
|
|
1562
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1563
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1564
|
+
*/class c8 extends w{static get pluginName(){return"ListStyleSupport"}static get requires(){return[Ct,"GeneralHtmlSupport"]}init(){const e=this.editor;e.plugins.has("ListEditing")&&(this._styleUtils=e.plugins.get(Ct),this._listUtils=this.editor.plugins.get("ListUtils"),this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport"),this.listenTo(this._styleUtils,"isStyleEnabledForBlock",(t,[i,s])=>{this._isStyleEnabledForBlock(i,s)&&(t.return=!0,t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"isStyleActiveForBlock",(t,[i,s])=>{this._isStyleActiveForBlock(i,s)&&(t.return=!0,t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedBlocks",(t,[i,s])=>{const o=this._getAffectedBlocks(i,s);o&&(t.return=o,t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"getStylePreview",(t,[i,s])=>{const o=this._getStylePreview(i,s);o&&(t.return=o,t.stop())},{priority:"high"}))}_isStyleEnabledForBlock(e,t){const i=this.editor.model;if(!["ol","ul","li"].includes(e.element)||!this._listUtils.isListItemBlock(t))return!1;const s=this._htmlSupport.getGhsAttributeNameForElement(e.element);if(e.element=="ol"||e.element=="ul"){if(!i.schema.checkAttribute(t,s))return!1;const o=t.getAttribute("listType")=="numbered"?"ol":"ul";return e.element==o}else return i.schema.checkAttribute(t,s)}_isStyleActiveForBlock(e,t){const i=this._htmlSupport.getGhsAttributeNameForElement(e.element),s=t.getAttribute(i);return this._styleUtils.hasAllClasses(s,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){const{element:i,classes:s}=e;return i=="ol"||i=="ul"?{tag:i,attributes:{class:s},children:[{tag:"li",children:t}]}:i=="li"?{tag:"ol",children:[{tag:i,attributes:{class:s},children:t}]}:null}}/**
|
|
1565
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1566
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1567
|
+
*/class u8 extends w{static get pluginName(){return"TableStyleSupport"}static get requires(){return[Ct]}init(){const e=this.editor;e.plugins.has("TableEditing")&&(this._styleUtils=e.plugins.get(Ct),this._tableUtils=this.editor.plugins.get("TableUtils"),this.listenTo(this._styleUtils,"isStyleEnabledForBlock",(t,[i,s])=>{this._isApplicable(i,s)&&(t.return=this._isStyleEnabledForBlock(i,s),t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedBlocks",(t,[i,s])=>{this._isApplicable(i,s)&&(t.return=this._getAffectedBlocks(i,s),t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"configureGHSDataFilter",(t,[{block:i}])=>{this.editor.plugins.get("DataFilter").loadAllowedConfig(i.filter(o=>o.element=="figcaption").map(o=>({name:"caption",classes:o.classes})))}))}_isApplicable(e,t){return["td","th"].includes(e.element)?t.name=="tableCell":["thead","tbody"].includes(e.element)?t.name=="table":!1}_isStyleEnabledForBlock(e,t){if(["td","th"].includes(e.element)){const i=this._tableUtils.getCellLocation(t),o=t.parent.parent,r=o.getAttribute("headingRows")||0,a=o.getAttribute("headingColumns")||0,l=i.row<r||i.column<a;return e.element=="th"?l:!l}if(["thead","tbody"].includes(e.element)){const i=t.getAttribute("headingRows")||0;return e.element=="thead"?i>0:i<this._tableUtils.getRows(t)}/* istanbul ignore next -- @preserve */return!1}_getAffectedBlocks(e,t){return this._isStyleEnabledForBlock(e,t)?[t]:null}}/**
|
|
1568
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1569
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1570
|
+
*/class d8 extends w{static get pluginName(){return"LinkStyleSupport"}static get requires(){return[Ct,"GeneralHtmlSupport"]}init(){const e=this.editor;e.plugins.has("LinkEditing")&&(this._styleUtils=e.plugins.get(Ct),this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport"),this.listenTo(this._styleUtils,"isStyleEnabledForInlineSelection",(t,[i,s])=>{i.element=="a"&&(t.return=this._isStyleEnabled(i,s),t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"isStyleActiveForInlineSelection",(t,[i,s])=>{i.element=="a"&&(t.return=this._isStyleActive(i,s),t.stop())},{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedInlineSelectable",(t,[i,s])=>{if(i.element!="a")return;const o=this._getAffectedSelectable(i,s);o&&(t.return=o,t.stop())},{priority:"high"}))}_isStyleEnabled(e,t){const i=this.editor.model;if(t.isCollapsed)return t.hasAttribute("linkHref");for(const s of t.getRanges())for(const o of s.getItems())if((o.is("$textProxy")||i.schema.isInline(o))&&o.hasAttribute("linkHref"))return!0;return!1}_isStyleActive(e,t){const i=this.editor.model,s=this._htmlSupport.getGhsAttributeNameForElement(e.element);if(t.isCollapsed){if(t.hasAttribute("linkHref")){const o=t.getAttribute(s);if(this._styleUtils.hasAllClasses(o,e.classes))return!0}return!1}for(const o of t.getRanges())for(const r of o.getItems())if((r.is("$textProxy")||i.schema.isInline(r))&&r.hasAttribute("linkHref")){const a=r.getAttribute(s);return this._styleUtils.hasAllClasses(a,e.classes)}return!1}_getAffectedSelectable(e,t){const i=this.editor.model;if(t.isCollapsed){const o=t.getAttribute("linkHref");return Xn(t.getFirstPosition(),"linkHref",o,i)}const s=[];for(const o of t.getRanges()){const r=i.createRange(Kd(o.start,"linkHref",!0,i),Kd(o.end,"linkHref",!1,i));for(const a of r.getItems())(a.is("$textProxy")||i.schema.isInline(a))&&a.hasAttribute("linkHref")&&s.push(this.editor.model.createRangeOn(a))}return h8(s)}}function Kd(n,e,t,i){const s=n.textNode||(t?n.nodeAfter:n.nodeBefore);if(!s||!s.hasAttribute(e))return n;const o=s.getAttribute(e);return qr(n,e,o,t,i)}function h8(n){for(let e=1;e<n.length;e++){const t=n[e-1].getJoined(n[e]);t&&n.splice(--e,2,t)}return n}/**
|
|
1571
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1572
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1573
|
+
*/class f8 extends w{static get pluginName(){return"StyleEditing"}static get requires(){return["GeneralHtmlSupport",Ct,c8,u8,d8]}init(){const e=this.editor,t=e.plugins.get("DataSchema"),i=e.plugins.get("StyleUtils"),s=e.config.get("style.definitions"),o=i.normalizeConfig(t,s);e.commands.add("style",new o8(e,o)),i.configureGHSDataFilter(o)}}/**
|
|
1574
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1575
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1576
|
+
*/class m8 extends w{static get pluginName(){return"Style"}static get requires(){return[f8,s8]}}/**
|
|
1577
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1578
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1579
|
+
*/function ul(n){const e=n.t,t=n.config.get("codeBlock.languages");for(const i of t)i.label==="Plain text"&&(i.label=e("Plain text")),i.class===void 0&&(i.class=`language-${i.language}`);return t}function la(n,e,t){const i={};for(const s of n)if(e==="class"){const o=s[e].split(" ").shift();i[o]=s[t]}else i[s[e]]=s[t];return i}function dl(n){return n.data.match(/^(\s*)/)[0]}function g8(n,e){const t=n.createDocumentFragment(),i=e.split(`
|
|
1580
|
+
`),s=i.reduce((o,r,a)=>(o.push(r),a<i.length-1&&o.push(n.createElement("br")),o),[]);return n.appendChild(s,t),t}function ca(n){const e=n.document.selection,t=[];if(e.isCollapsed)return[e.anchor];const i=e.getFirstRange().getWalker({ignoreElementEnd:!0,direction:"backward"});for(const{item:s}of i){if(!s.is("$textProxy"))continue;const{parent:o,startOffset:r}=s.textNode;if(!o.is("element","codeBlock"))continue;const a=dl(s.textNode),l=n.createPositionAt(o,r+a.length);t.push(l)}return t}function $p(n){const e=J(n.getSelectedBlocks());return!!e&&e.is("element","codeBlock")}function Zd(n,e){return e.is("rootElement")||n.isLimit(e)?!1:n.checkChild(e.parent,"codeBlock")}/**
|
|
1581
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1582
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1583
|
+
*/class p8 extends R{constructor(e){super(e),this._lastLanguage=null}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor,i=t.model,s=i.document.selection,r=ul(t)[0],a=Array.from(s.getSelectedBlocks()),l=e.forceValue==null?!this.value:e.forceValue,c=w8(e,this._lastLanguage,r.language);i.change(u=>{l?this._applyCodeBlock(u,a,c):this._removeCodeBlock(u,a)})}_getValue(){const e=this.editor.model.document.selection,t=J(e.getSelectedBlocks());return!!(t&&t.is("element","codeBlock"))?t.getAttribute("language"):!1}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,i=J(e.getSelectedBlocks());return i?Zd(t,i):!1}_applyCodeBlock(e,t,i){this._lastLanguage=i;const s=this.editor.model.schema,o=t.filter(r=>Zd(s,r));for(const r of o)e.rename(r,"codeBlock"),e.setAttribute("language",i,r),s.removeDisallowedAttributes([r],e),Array.from(r.getChildren()).filter(a=>!s.checkChild(r,a)).forEach(a=>e.remove(a));o.reverse().forEach((r,a)=>{const l=o[a+1];r.previousSibling===l&&(e.appendElement("softBreak",l),e.merge(e.createPositionBefore(r)))})}_removeCodeBlock(e,t){const i=t.filter(s=>s.is("element","codeBlock"));for(const s of i){const o=e.createRangeOn(s);for(const r of Array.from(o.getItems()).reverse())if(r.is("element","softBreak")&&r.parent.is("element","codeBlock")){const{position:a}=e.split(e.createPositionBefore(r)),l=a.nodeAfter;e.rename(l,"paragraph"),e.removeAttribute("language",l),e.remove(r)}e.rename(s,"paragraph"),e.removeAttribute("language",s)}}}function w8(n,e,t){return n.language?n.language:n.usePreviousLanguageChoice&&e?e:t}/**
|
|
1584
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1585
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1586
|
+
*/class b8 extends R{constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model;t.change(i=>{const s=ca(t);for(const o of s){const r=i.createText(this._indentSequence);t.insertContent(r,o)}})}_checkEnabled(){return this._indentSequence?$p(this.editor.model.document.selection):!1}}/**
|
|
1587
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1588
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1589
|
+
*/class _8 extends R{constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model;t.change(()=>{const i=ca(t);for(const s of i){const o=Jd(t,s,this._indentSequence);o&&t.deleteContent(t.createSelection(o))}})}_checkEnabled(){if(!this._indentSequence)return!1;const e=this.editor.model;return $p(e.document.selection)?ca(e).some(t=>Jd(e,t,this._indentSequence)):!1}}function Jd(n,e,t){const i=v8(e);if(!i)return null;const s=dl(i),o=s.lastIndexOf(t);if(o+t.length!==s.length||o===-1)return null;const{parent:r,startOffset:a}=i;return n.createRange(n.createPositionAt(r,a+o),n.createPositionAt(r,a+o+t.length))}function v8(n){let e=n.parent.getChild(n.index);return(!e||e.is("element","softBreak"))&&(e=n.nodeBefore),!e||e.is("element","softBreak")?null:e}/**
|
|
1590
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1591
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1592
|
+
*/function Yd(n,e,t=!1){const i=la(e,"language","class"),s=la(e,"language","label");return(o,r,a)=>{const{writer:l,mapper:c,consumable:u}=a;if(!u.consume(r.item,"insert"))return;const d=r.item.getAttribute("language"),h=c.toViewPosition(n.createPositionBefore(r.item)),f={};t&&(f["data-language"]=s[d],f.spellcheck="false");const m=i[d]?{class:i[d]}:void 0,p=l.createContainerElement("code",m),_=l.createContainerElement("pre",f,p);l.insert(h,_),c.bindElements(r.item,p)}}function y8(n){return(e,t,i)=>{if(t.item.parent.name!=="codeBlock")return;const{writer:s,mapper:o,consumable:r}=i;if(!r.consume(t.item,"insert"))return;const a=o.toViewPosition(n.createPositionBefore(t.item));s.insert(a,s.createText(`
|
|
1593
|
+
`))}}function C8(n,e){const t=la(e,"class","language"),i=e[0].language;return(s,o,r)=>{const a=o.viewItem,l=a.parent;if(!l||!l.is("element","pre")||o.modelCursor.findAncestor("codeBlock"))return;const{consumable:c,writer:u}=r;if(!c.test(a,{name:!0}))return;const d=u.createElement("codeBlock"),h=[...a.getClassNames()];h.length||h.push("");for(const f of h){const m=t[f];if(m){u.setAttribute("language",m,d);break}}d.hasAttribute("language")||u.setAttribute("language",i,d),r.convertChildren(a,d),r.safeInsert(d,o.modelCursor)&&(c.consume(a,{name:!0}),r.updateConversionResult(d,o))}}function k8(){return(n,e,{consumable:t,writer:i})=>{let s=e.modelCursor;if(!t.test(e.viewItem)||!s.findAncestor("codeBlock"))return;t.consume(e.viewItem);const r=e.viewItem.data.split(`
|
|
1594
|
+
`).map(l=>i.createText(l)),a=r[r.length-1];for(const l of r)if(i.insert(l,s),s=s.getShiftedBy(l.offsetSize),l!==a){const c=i.createElement("softBreak");i.insert(c,s),s=i.createPositionAfter(c)}e.modelRange=i.createRange(e.modelCursor,s),e.modelCursor=s}}function E8(){return(n,e,{consumable:t})=>{const i=e.viewItem;if(i.findAncestor("pre"))return;const s=Array.from(i.getChildren()),o=s.find(r=>r.is("element","code"));if(o)for(const r of s)r===o||!r.is("$text")||t.consume(r,{name:!0})}}/**
|
|
1595
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1596
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1597
|
+
*/const zp="paragraph";class T8 extends w{static get pluginName(){return"CodeBlockEditing"}static get requires(){return[Tg]}constructor(e){super(e),e.config.define("codeBlock",{languages:[{language:"plaintext",label:"Plain text"},{language:"c",label:"C"},{language:"cs",label:"C#"},{language:"cpp",label:"C++"},{language:"css",label:"CSS"},{language:"diff",label:"Diff"},{language:"html",label:"HTML"},{language:"java",label:"Java"},{language:"javascript",label:"JavaScript"},{language:"php",label:"PHP"},{language:"python",label:"Python"},{language:"ruby",label:"Ruby"},{language:"typescript",label:"TypeScript"},{language:"xml",label:"XML"}],indentSequence:" "})}init(){const e=this.editor,t=e.model.schema,i=e.model,s=e.editing.view,o=e.plugins.has("ListEditing")?e.plugins.get("ListEditing"):null,r=ul(e);e.commands.add("codeBlock",new p8(e)),e.commands.add("indentCodeBlock",new b8(e)),e.commands.add("outdentCodeBlock",new _8(e)),this.listenTo(s.document,"tab",(a,l)=>{const c=l.shiftKey?"outdentCodeBlock":"indentCodeBlock";e.commands.get(c).isEnabled&&(e.execute(c),l.stopPropagation(),l.preventDefault(),a.stop())},{context:"pre"}),t.register("codeBlock",{allowWhere:"$block",allowChildren:"$text",isBlock:!0,allowAttributes:["language"]}),t.addAttributeCheck((a,l)=>{if(a.endsWith("codeBlock")&&o&&o.getListAttributeNames().includes(l))return!0;if(a.endsWith("codeBlock $text"))return!1}),e.model.schema.addChildCheck((a,l)=>{if(a.endsWith("codeBlock")&&l.isObject)return!1}),e.editing.downcastDispatcher.on("insert:codeBlock",Yd(i,r,!0)),e.data.downcastDispatcher.on("insert:codeBlock",Yd(i,r)),e.data.downcastDispatcher.on("insert:softBreak",y8(i),{priority:"high"}),e.data.upcastDispatcher.on("element:code",C8(s,r)),e.data.upcastDispatcher.on("text",k8()),e.data.upcastDispatcher.on("element:pre",E8(),{priority:"high"}),this.listenTo(e.editing.view.document,"clipboardInput",(a,l)=>{let c=i.createRange(i.document.selection.anchor);if(l.targetRanges&&(c=e.editing.mapper.toModelRange(l.targetRanges[0])),!c.start.parent.is("element","codeBlock"))return;const u=l.dataTransfer.getData("text/plain"),d=new Yi(e.editing.view.document);l.content=g8(d,u)}),this.listenTo(i,"getSelectedContent",(a,[l])=>{const c=l.anchor;l.isCollapsed||!c.parent.is("element","codeBlock")||!c.hasSameParentAs(l.focus)||i.change(u=>{const d=a.return;if(c.parent.is("element")&&(d.childCount>1||l.containsEntireContent(c.parent))){const f=u.createElement("codeBlock",c.parent.getAttributes());u.append(d,f);const m=u.createDocumentFragment();u.append(f,m),a.return=m;return}const h=d.getChild(0);t.checkAttribute(h,"code")&&u.setAttribute("code",!0,h)})})}afterInit(){const e=this.editor,t=e.commands,i=t.get("indent"),s=t.get("outdent");i&&i.registerChildCommand(t.get("indentCodeBlock"),{priority:"highest"}),s&&s.registerChildCommand(t.get("outdentCodeBlock")),this.listenTo(e.editing.view.document,"enter",(o,r)=>{e.model.document.selection.getLastPosition().parent.is("element","codeBlock")&&(!S8(e,r.isSoft)&&!x8(e,r.isSoft)&&A8(e),r.preventDefault(),o.stop())},{context:"pre"})}}function A8(n){const t=n.model.document,i=t.selection.getLastPosition(),s=i.nodeBefore||i.textNode;let o;s&&s.is("$text")&&(o=dl(s)),n.model.change(r=>{n.execute("shiftEnter"),o&&r.insertText(o,t.selection.anchor)})}function S8(n,e){const i=n.model.document,s=n.editing.view,o=i.selection.getLastPosition(),r=o.nodeAfter;return e||!i.selection.isCollapsed||!o.isAtStart||!Ut(r)?!1:(n.model.change(a=>{n.execute("enter");const l=i.selection.anchor.parent.previousSibling;a.rename(l,zp),a.setSelection(l,"in"),n.model.schema.removeDisallowedAttributes([l],a),a.remove(r)}),s.scrollToTheSelection(),!0)}function x8(n,e){const t=n.model,i=t.document,s=n.editing.view,o=i.selection.getLastPosition(),r=o.nodeBefore;let a;if(e||!i.selection.isCollapsed||!o.isAtEnd||!r||!r.previousSibling)return!1;if(Ut(r)&&Ut(r.previousSibling))a=t.createRange(t.createPositionBefore(r.previousSibling),t.createPositionAfter(r));else if(lr(r)&&Ut(r.previousSibling)&&Ut(r.previousSibling.previousSibling))a=t.createRange(t.createPositionBefore(r.previousSibling.previousSibling),t.createPositionAfter(r));else if(lr(r)&&Ut(r.previousSibling)&&lr(r.previousSibling.previousSibling)&&r.previousSibling.previousSibling&&Ut(r.previousSibling.previousSibling.previousSibling))a=t.createRange(t.createPositionBefore(r.previousSibling.previousSibling.previousSibling),t.createPositionAfter(r));else return!1;return n.model.change(l=>{l.remove(a),n.execute("enter");const c=i.selection.anchor.parent;l.rename(c,zp),n.model.schema.removeDisallowedAttributes([c],l)}),s.scrollToTheSelection(),!0}function lr(n){return n&&n.is("$text")&&!n.data.match(/\S/)}function Ut(n){return n&&n.is("element","softBreak")}/**
|
|
1598
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1599
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1600
|
+
*/class I8 extends w{static get pluginName(){return"CodeBlockUI"}init(){const e=this.editor,t=e.t,i=e.ui.componentFactory,s=ul(e);i.add("codeBlock",o=>{const r=e.commands.get("codeBlock"),a=fe(o,Qi),l=a.buttonView,c=t("Insert code block");return l.set({label:c,tooltip:!0,icon:I.codeBlock,isToggleable:!0}),l.bind("isOn").to(r,"value",u=>!!u),l.on("execute",()=>{e.execute("codeBlock",{usePreviousLanguageChoice:!0}),e.editing.view.focus()}),a.on("execute",u=>{e.execute("codeBlock",{language:u.source._codeBlockLanguage,forceValue:!0}),e.editing.view.focus()}),a.class="ck-code-block-dropdown",a.bind("isEnabled").to(r),di(a,()=>this._getLanguageListItemDefinitions(s),{role:"menu",ariaLabel:c}),a})}_getLanguageListItemDefinitions(e){const i=this.editor.commands.get("codeBlock"),s=new _e;for(const o of e){const r={type:"button",model:new hi({_codeBlockLanguage:o.language,label:o.label,role:"menuitemradio",withText:!0})};r.model.bind("isOn").to(i,"value",a=>a===r.model._codeBlockLanguage),s.add(r)}return s}}/**
|
|
1601
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1602
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1603
|
+
*/class P8 extends w{static get requires(){return[T8,I8]}static get pluginName(){return"CodeBlock"}}/**
|
|
1604
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1605
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1606
|
+
*/class R8 extends R{refresh(){const e=this.editor.model,t=e.schema,i=e.document.selection;this.isEnabled=V8(i,t,e)}execute(){const e=this.editor.model;e.change(t=>{const i=t.createElement("horizontalLine");e.insertObject(i,null,null,{setSelection:"after"})})}}function V8(n,e,t){const i=L8(n,t);return e.checkChild(i,"horizontalLine")}function L8(n,e){const i=el(n,e).start.parent;return i.isEmpty&&!i.is("element","$root")?i.parent:i}/**
|
|
1607
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1608
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1609
|
+
*/class B8 extends w{static get pluginName(){return"HorizontalLineEditing"}init(){const e=this.editor,t=e.model.schema,i=e.t,s=e.conversion;t.register("horizontalLine",{inheritAllFrom:"$blockObject"}),s.for("dataDowncast").elementToElement({model:"horizontalLine",view:(o,{writer:r})=>r.createEmptyElement("hr")}),s.for("editingDowncast").elementToStructure({model:"horizontalLine",view:(o,{writer:r})=>{const a=i("Horizontal line"),l=r.createContainerElement("div",null,r.createEmptyElement("hr"));return r.addClass("ck-horizontal-line",l),r.setCustomProperty("hr",!0,l),O8(l,r,a)}}),s.for("upcast").elementToElement({view:"hr",model:"horizontalLine"}),e.commands.add("horizontalLine",new R8(e))}}function O8(n,e,t){return e.setCustomProperty("horizontalLine",!0,n),Xi(n,e,{label:t})}/**
|
|
1610
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1611
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1612
|
+
*/class M8 extends w{static get pluginName(){return"HorizontalLineUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("horizontalLine",i=>{const s=e.commands.get("horizontalLine"),o=new B(i);return o.set({label:t("Horizontal line"),icon:I.horizontalLine,tooltip:!0}),o.bind("isEnabled").to(s,"isEnabled"),this.listenTo(o,"execute",()=>{e.execute("horizontalLine"),e.editing.view.focus()}),o})}}/**
|
|
1613
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1614
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1615
|
+
*/class F8 extends w{static get requires(){return[B8,M8,fi]}static get pluginName(){return"HorizontalLine"}}const D8='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8.69 14.915c.053.052.173.083.36.093a.366.366 0 0 1 .345.485l-.003.01a.738.738 0 0 1-.697.497h-2.67a.374.374 0 0 1-.353-.496l.013-.038a.681.681 0 0 1 .644-.458c.197-.012.325-.043.386-.093a.28.28 0 0 0 .072-.11L9.592 4.5H6.269c-.359-.017-.609.013-.75.09-.142.078-.289.265-.442.563-.192.29-.516.464-.864.464H4.17a.43.43 0 0 1-.407-.569L4.46 3h13.08l-.62 2.043a.81.81 0 0 1-.775.574h-.114a.486.486 0 0 1-.486-.486c.001-.284-.054-.464-.167-.54-.112-.076-.367-.106-.766-.091h-3.28l-2.68 10.257c-.006.074.007.127.038.158zM3 17h8a.5.5 0 1 1 0 1H3a.5.5 0 1 1 0-1zm11.299 1.17a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.06-1.06l1.415 1.414 1.414-1.415a.75.75 0 1 1 1.06 1.06l-1.413 1.415 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414-1.414 1.414z"/></svg>';/**
|
|
1616
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1617
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1618
|
+
*/const cr="removeFormat";class N8 extends w{static get pluginName(){return"RemoveFormatUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add(cr,i=>{const s=e.commands.get(cr),o=new B(i);return o.set({label:t("Remove Format"),icon:D8,tooltip:!0}),o.bind("isOn","isEnabled").to(s,"value","isEnabled"),this.listenTo(o,"execute",()=>{e.execute(cr),e.editing.view.focus()}),o})}}/**
|
|
1619
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1620
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1621
|
+
*/class $8 extends R{refresh(){const e=this.editor.model;this.isEnabled=!!J(this._getFormattingItems(e.document.selection,e.schema))}execute(){const e=this.editor.model,t=e.schema;e.change(i=>{for(const s of this._getFormattingItems(e.document.selection,t))if(s.is("selection"))for(const o of this._getFormattingAttributes(s,t))i.removeSelectionAttribute(o);else{const o=i.createRangeOn(s);for(const r of this._getFormattingAttributes(s,t))i.removeAttribute(r,o)}})}*_getFormattingItems(e,t){const i=s=>!!J(this._getFormattingAttributes(s,t));for(const s of e.getRanges())for(const o of s.getItems())!t.isBlock(o)&&i(o)&&(yield o);for(const s of e.getSelectedBlocks())i(s)&&(yield s);i(e)&&(yield e)}*_getFormattingAttributes(e,t){for(const[i]of e.getAttributes()){const s=t.getAttributeProperties(i);s&&s.isFormatting&&(yield i)}}}/**
|
|
1622
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1623
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1624
|
+
*/class z8 extends w{static get pluginName(){return"RemoveFormatEditing"}init(){const e=this.editor;e.commands.add("removeFormat",new $8(e))}}/**
|
|
1625
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1626
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1627
|
+
*/class H8 extends w{static get requires(){return[z8,N8]}static get pluginName(){return"RemoveFormat"}}/**
|
|
1628
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1629
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1630
|
+
*/class U8 extends rg{constructor(e,t){super(e);const i=e.t;this.set("class","ck-special-characters-navigation"),this.groupDropdownView=this._createGroupDropdown(t),this.groupDropdownView.panelPosition=e.uiLanguageDirection==="rtl"?"se":"sw",this.label=i("Special characters"),this.children.add(this.groupDropdownView)}get currentGroupName(){return this.groupDropdownView.value}focus(){this.groupDropdownView.focus()}_createGroupDropdown(e){const t=this.locale,i=t.t,s=fe(t),o=this._getCharacterGroupListItemDefinitions(s,e),r=i("Character categories");return s.set("value",o.first.model.name),s.buttonView.bind("label").to(s,"value",a=>e.get(a)),s.buttonView.set({isOn:!1,withText:!0,tooltip:r,class:["ck-dropdown__button_label-width_auto"],ariaLabel:r,ariaLabelledBy:void 0}),s.on("execute",a=>{s.value=a.source.name}),s.delegate("execute").to(this),di(s,o,{ariaLabel:r,role:"menu"}),s}_getCharacterGroupListItemDefinitions(e,t){const i=new _e;for(const[s,o]of t){const r=new hi({name:s,label:o,withText:!0,role:"menuitemradio"});r.bind("isOn").to(e,"value",a=>a===r.name),i.add({type:"button",model:r})}return i}}/**
|
|
1631
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1632
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1633
|
+
*/class W8 extends T{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 ne,this.keystrokes=new ae,Wn({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.tiles,numberOfColumns:()=>E.window.getComputedStyle(this.element.firstChild).getPropertyValue("grid-template-columns").split(" ").length,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}createTile(e,t){const i=new B(this.locale);return i.set({label:e,withText:!0,class:"ck-character-grid__tile"}),i.extendTemplate({attributes:{title:t},on:{mouseover:i.bindTemplate.to("mouseover"),focus:i.bindTemplate.to("focus")}}),i.on("mouseover",()=>{this.fire("tileHover",{name:t,character:e})}),i.on("focus",()=>{this.fire("tileFocus",{name:t,character:e})}),i.on("execute",()=>{this.fire("execute",{name:t,character:e})}),i}render(){super.render();for(const e of this.tiles)this.focusTracker.add(e.element);this.tiles.on("change",(e,{added:t,removed:i})=>{if(t.length>0)for(const s of t)this.focusTracker.add(s.element);if(i.length>0)for(const s of i)this.focusTracker.remove(s.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.keystrokes.destroy()}focus(){this.tiles.first.focus()}}/**
|
|
1634
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1635
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1636
|
+
*/class q8 extends T{constructor(e){super(e);const t=this.bindTemplate;this.set("character",null),this.set("name",null),this.bind("code").to(this,"character",j8),this.setTemplate({tag:"div",children:[{tag:"span",attributes:{class:["ck-character-info__name"]},children:[{text:t.to("name",i=>i||"")}]},{tag:"span",attributes:{class:["ck-character-info__code"]},children:[{text:t.to("code")}]}],attributes:{class:["ck","ck-character-info"]}})}}function j8(n){return n===null?"":"U+"+("0000"+n.codePointAt(0).toString(16)).slice(-4)}/**
|
|
1637
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1638
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1639
|
+
*/class G8 extends T{constructor(e,t,i,s){super(e),this.navigationView=t,this.gridView=i,this.infoView=s,this.items=this.createCollection(),this.focusTracker=new ne,this.keystrokes=new ae,this._focusCycler=new ke({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",children:[this.navigationView,this.gridView,this.infoView],attributes:{tabindex:"-1"}}),this.items.add(this.navigationView.groupDropdownView.buttonView),this.items.add(this.gridView)}render(){super.render(),this.focusTracker.add(this.navigationView.groupDropdownView.buttonView.element),this.focusTracker.add(this.gridView.element),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.navigationView.focus()}}const K8='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10 2.5a7.47 7.47 0 0 1 4.231 1.31 7.268 7.268 0 0 1 2.703 3.454 7.128 7.128 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.873.873 0 0 1-.547.28l-.101.006h-4.695a.517.517 0 0 1-.516-.518v-1.265c0-.21.128-.398.317-.489a5.601 5.601 0 0 0 2.492-2.371 5.459 5.459 0 0 0 .552-3.693 5.53 5.53 0 0 0-1.955-3.2A5.71 5.71 0 0 0 10 4.206 5.708 5.708 0 0 0 6.419 5.46 5.527 5.527 0 0 0 4.46 8.663a5.457 5.457 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.877.877 0 0 1-.614-.25.845.845 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.128 7.128 0 0 1 .199-4.352 7.268 7.268 0 0 1 2.703-3.455A7.475 7.475 0 0 1 10 2.5z"/></svg>';/**
|
|
1640
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1641
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1642
|
+
*/const ur="All";class Z8 extends w{static get requires(){return[vg]}static get pluginName(){return"SpecialCharacters"}constructor(e){super(e);const t=e.t;this._characters=new Map,this._groups=new Map,this._allSpecialCharactersGroupLabel=t("All")}init(){const e=this.editor,t=e.t,i=e.commands.get("insertText");e.ui.componentFactory.add("specialCharacters",s=>{const o=fe(s);let r;return o.buttonView.set({label:t("Special characters"),icon:K8,tooltip:!0}),o.bind("isEnabled").to(i),o.on("execute",(a,l)=>{e.execute("insertText",{text:l.character}),e.editing.view.focus()}),o.on("change:isOpen",()=>{if(!r){r=this._createDropdownPanelContent(s,o);const a=new G8(s,r.navigationView,r.gridView,r.infoView);o.panelView.children.add(a)}r.infoView.set({character:null,name:null})}),o})}addItems(e,t,i={label:e}){if(e===ur)throw new g("special-character-invalid-group-name",null);const s=this._getGroup(e,i.label);for(const o of t)s.items.add(o.title),this._characters.set(o.title,o.character)}getGroups(){const e=Array.from(this._groups.keys()),t=this.editor.config.get("specialCharacters.order")||[],i=t.find(s=>!e.includes(s));if(i)throw new g("special-character-invalid-order-group-name",null,{invalidGroup:i});return new Set([...t,...e])}getCharactersForGroup(e){if(e===ur)return new Set(this._characters.keys());const 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();const i=this.getCharactersForGroup(e);for(const s of i){const o=this.getCharacter(s);t.tiles.add(t.createTile(o,s))}}_createDropdownPanelContent(e,t){const i=Array.from(this.getGroups()).map(l=>[l,this._groups.get(l).label]),s=new Map([[ur,this._allSpecialCharactersGroupLabel],...i]),o=new U8(e,s),r=new W8(e),a=new q8(e);return r.delegate("execute").to(t),r.on("tileHover",(l,c)=>{a.set(c)}),r.on("tileFocus",(l,c)=>{a.set(c)}),o.on("execute",()=>{this._updateGrid(o.currentGroupName,r)}),this._updateGrid(o.currentGroupName,r),{navigationView:o,gridView:r,infoView:a}}}/**
|
|
1643
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1644
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1645
|
+
*/class J8 extends w{static get pluginName(){return"SpecialCharactersArrows"}init(){const e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Arrows",[{title:t("leftwards simple arrow"),character:"←"},{title:t("rightwards simple arrow"),character:"→"},{title:t("upwards simple arrow"),character:"↑"},{title:t("downwards simple arrow"),character:"↓"},{title:t("leftwards double arrow"),character:"⇐"},{title:t("rightwards double arrow"),character:"⇒"},{title:t("upwards double arrow"),character:"⇑"},{title:t("downwards double arrow"),character:"⇓"},{title:t("leftwards dashed arrow"),character:"⇠"},{title:t("rightwards dashed arrow"),character:"⇢"},{title:t("upwards dashed arrow"),character:"⇡"},{title:t("downwards dashed arrow"),character:"⇣"},{title:t("leftwards arrow to bar"),character:"⇤"},{title:t("rightwards arrow to bar"),character:"⇥"},{title:t("upwards arrow to bar"),character:"⤒"},{title:t("downwards arrow to bar"),character:"⤓"},{title:t("up down arrow with base"),character:"↨"},{title:t("back with leftwards arrow above"),character:"🔙"},{title:t("end with leftwards arrow above"),character:"🔚"},{title:t("on with exclamation mark with left right arrow above"),character:"🔛"},{title:t("soon with rightwards arrow above"),character:"🔜"},{title:t("top with upwards arrow above"),character:"🔝"}],{label:t("Arrows")})}}/**
|
|
1646
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1647
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1648
|
+
*/class Y8 extends w{static get pluginName(){return"SpecialCharactersText"}init(){const e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Text",[{character:"‹",title:t("Single left-pointing angle quotation mark")},{character:"›",title:t("Single right-pointing angle quotation mark")},{character:"«",title:t("Left-pointing double angle quotation mark")},{character:"»",title:t("Right-pointing double angle quotation mark")},{character:"‘",title:t("Left single quotation mark")},{character:"’",title:t("Right single quotation mark")},{character:"“",title:t("Left double quotation mark")},{character:"”",title:t("Right double quotation mark")},{character:"‚",title:t("Single low-9 quotation mark")},{character:"„",title:t("Double low-9 quotation mark")},{character:"¡",title:t("Inverted exclamation mark")},{character:"¿",title:t("Inverted question mark")},{character:"‥",title:t("Two dot leader")},{character:"…",title:t("Horizontal ellipsis")},{character:"‡",title:t("Double dagger")},{character:"‰",title:t("Per mille sign")},{character:"‱",title:t("Per ten thousand sign")},{character:"‼",title:t("Double exclamation mark")},{character:"⁈",title:t("Question exclamation mark")},{character:"⁉",title:t("Exclamation question mark")},{character:"⁇",title:t("Double question mark")},{character:"©",title:t("Copyright sign")},{character:"®",title:t("Registered sign")},{character:"™",title:t("Trade mark sign")},{character:"§",title:t("Section sign")},{character:"¶",title:t("Paragraph sign")},{character:"⁋",title:t("Reversed paragraph sign")}],{label:t("Text")})}}/**
|
|
1649
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1650
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1651
|
+
*/class Q8 extends w{static get pluginName(){return"SpecialCharactersMathematical"}init(){const e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Mathematical",[{character:"<",title:t("Less-than sign")},{character:">",title:t("Greater-than sign")},{character:"≤",title:t("Less-than or equal to")},{character:"≥",title:t("Greater-than or equal to")},{character:"–",title:t("En dash")},{character:"—",title:t("Em dash")},{character:"¯",title:t("Macron")},{character:"‾",title:t("Overline")},{character:"°",title:t("Degree sign")},{character:"−",title:t("Minus sign")},{character:"±",title:t("Plus-minus sign")},{character:"÷",title:t("Division sign")},{character:"⁄",title:t("Fraction slash")},{character:"×",title:t("Multiplication sign")},{character:"ƒ",title:t("Latin small letter f with hook")},{character:"∫",title:t("Integral")},{character:"∑",title:t("N-ary summation")},{character:"∞",title:t("Infinity")},{character:"√",title:t("Square root")},{character:"∼",title:t("Tilde operator")},{character:"≅",title:t("Approximately equal to")},{character:"≈",title:t("Almost equal to")},{character:"≠",title:t("Not equal to")},{character:"≡",title:t("Identical to")},{character:"∈",title:t("Element of")},{character:"∉",title:t("Not an element of")},{character:"∋",title:t("Contains as member")},{character:"∏",title:t("N-ary product")},{character:"∧",title:t("Logical and")},{character:"∨",title:t("Logical or")},{character:"¬",title:t("Not sign")},{character:"∩",title:t("Intersection")},{character:"∪",title:t("Union")},{character:"∂",title:t("Partial differential")},{character:"∀",title:t("For all")},{character:"∃",title:t("There exists")},{character:"∅",title:t("Empty set")},{character:"∇",title:t("Nabla")},{character:"∗",title:t("Asterisk operator")},{character:"∝",title:t("Proportional to")},{character:"∠",title:t("Angle")},{character:"¼",title:t("Vulgar fraction one quarter")},{character:"½",title:t("Vulgar fraction one half")},{character:"¾",title:t("Vulgar fraction three quarters")}],{label:t("Mathematical")})}}/**
|
|
1652
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1653
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1654
|
+
*/class X8 extends w{static get pluginName(){return"SpecialCharactersLatin"}init(){const e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Latin",[{character:"Ā",title:t("Latin capital letter a with macron")},{character:"ā",title:t("Latin small letter a with macron")},{character:"Ă",title:t("Latin capital letter a with breve")},{character:"ă",title:t("Latin small letter a with breve")},{character:"Ą",title:t("Latin capital letter a with ogonek")},{character:"ą",title:t("Latin small letter a with ogonek")},{character:"Ć",title:t("Latin capital letter c with acute")},{character:"ć",title:t("Latin small letter c with acute")},{character:"Ĉ",title:t("Latin capital letter c with circumflex")},{character:"ĉ",title:t("Latin small letter c with circumflex")},{character:"Ċ",title:t("Latin capital letter c with dot above")},{character:"ċ",title:t("Latin small letter c with dot above")},{character:"Č",title:t("Latin capital letter c with caron")},{character:"č",title:t("Latin small letter c with caron")},{character:"Ď",title:t("Latin capital letter d with caron")},{character:"ď",title:t("Latin small letter d with caron")},{character:"Đ",title:t("Latin capital letter d with stroke")},{character:"đ",title:t("Latin small letter d with stroke")},{character:"Ē",title:t("Latin capital letter e with macron")},{character:"ē",title:t("Latin small letter e with macron")},{character:"Ĕ",title:t("Latin capital letter e with breve")},{character:"ĕ",title:t("Latin small letter e with breve")},{character:"Ė",title:t("Latin capital letter e with dot above")},{character:"ė",title:t("Latin small letter e with dot above")},{character:"Ę",title:t("Latin capital letter e with ogonek")},{character:"ę",title:t("Latin small letter e with ogonek")},{character:"Ě",title:t("Latin capital letter e with caron")},{character:"ě",title:t("Latin small letter e with caron")},{character:"Ĝ",title:t("Latin capital letter g with circumflex")},{character:"ĝ",title:t("Latin small letter g with circumflex")},{character:"Ğ",title:t("Latin capital letter g with breve")},{character:"ğ",title:t("Latin small letter g with breve")},{character:"Ġ",title:t("Latin capital letter g with dot above")},{character:"ġ",title:t("Latin small letter g with dot above")},{character:"Ģ",title:t("Latin capital letter g with cedilla")},{character:"ģ",title:t("Latin small letter g with cedilla")},{character:"Ĥ",title:t("Latin capital letter h with circumflex")},{character:"ĥ",title:t("Latin small letter h with circumflex")},{character:"Ħ",title:t("Latin capital letter h with stroke")},{character:"ħ",title:t("Latin small letter h with stroke")},{character:"Ĩ",title:t("Latin capital letter i with tilde")},{character:"ĩ",title:t("Latin small letter i with tilde")},{character:"Ī",title:t("Latin capital letter i with macron")},{character:"ī",title:t("Latin small letter i with macron")},{character:"Ĭ",title:t("Latin capital letter i with breve")},{character:"ĭ",title:t("Latin small letter i with breve")},{character:"Į",title:t("Latin capital letter i with ogonek")},{character:"į",title:t("Latin small letter i with ogonek")},{character:"İ",title:t("Latin capital letter i with dot above")},{character:"ı",title:t("Latin small letter dotless i")},{character:"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")})}}/**
|
|
1655
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1656
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1657
|
+
*/class eV extends w{static get pluginName(){return"SpecialCharactersCurrency"}init(){const e=this.editor,t=e.t;e.plugins.get("SpecialCharacters").addItems("Currency",[{character:"$",title:t("Dollar sign")},{character:"€",title:t("Euro sign")},{character:"¥",title:t("Yen sign")},{character:"£",title:t("Pound sign")},{character:"¢",title:t("Cent sign")},{character:"₠",title:t("Euro-currency sign")},{character:"₡",title:t("Colon sign")},{character:"₢",title:t("Cruzeiro sign")},{character:"₣",title:t("French franc sign")},{character:"₤",title:t("Lira sign")},{character:"¤",title:t("Currency sign")},{character:"₿",title:t("Bitcoin sign")},{character:"₥",title:t("Mill sign")},{character:"₦",title:t("Naira sign")},{character:"₧",title:t("Peseta sign")},{character:"₨",title:t("Rupee sign")},{character:"₩",title:t("Won sign")},{character:"₪",title:t("New sheqel sign")},{character:"₫",title:t("Dong sign")},{character:"₭",title:t("Kip sign")},{character:"₮",title:t("Tugrik sign")},{character:"₯",title:t("Drachma sign")},{character:"₰",title:t("German penny sign")},{character:"₱",title:t("Peso sign")},{character:"₲",title:t("Guarani sign")},{character:"₳",title:t("Austral sign")},{character:"₴",title:t("Hryvnia sign")},{character:"₵",title:t("Cedi sign")},{character:"₶",title:t("Livre tournois sign")},{character:"₷",title:t("Spesmilo sign")},{character:"₸",title:t("Tenge sign")},{character:"₹",title:t("Indian rupee sign")},{character:"₺",title:t("Turkish lira sign")},{character:"₻",title:t("Nordic mark sign")},{character:"₼",title:t("Manat sign")},{character:"₽",title:t("Ruble sign")}],{label:t("Currency")})}}/**
|
|
1658
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1659
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1660
|
+
*/class tV extends w{static get pluginName(){return"SpecialCharactersEssentials"}static get requires(){return[eV,Y8,Q8,J8,X8]}}/**
|
|
1661
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1662
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1663
|
+
*/function Qd(n,e){const t=(i,s,o)=>{if(!o.consumable.consume(s.item,i.name))return;const r=s.attributeNewValue,a=o.writer,l=o.mapper.toViewElement(s.item),c=[...l.getChildren()].find(d=>d.getCustomProperty("media-content"));a.remove(c);const u=n.getMediaViewElement(a,r,e);a.insert(a.createPositionAt(l,0),u)};return i=>{i.on("attribute:url:media",t)}}/**
|
|
1664
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1665
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1666
|
+
*/function iV(n,e,t){return e.setCustomProperty("media",!0,n),Xi(n,e,{label:t})}function Xd(n,e,t,i){return n.createContainerElement("figure",{class:"media"},[e.getMediaViewElement(n,t,i),n.createSlot()])}function eh(n){const e=n.getSelectedElement();return e&&e.is("element","media")?e:null}function Hp(n,e,t,i){n.change(s=>{const o=s.createElement("media",{url:e});n.insertObject(o,t,null,{setSelection:"on",findOptimalPosition:i?"auto":void 0})})}/**
|
|
1667
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1668
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1669
|
+
*/class nV extends R{refresh(){const e=this.editor.model,t=e.document.selection,i=eh(t);this.value=i?i.getAttribute("url"):void 0,this.isEnabled=oV(t)||sV(t,e)}execute(e){const t=this.editor.model,i=t.document.selection,s=eh(i);s?t.change(o=>{o.setAttribute("url",e,s)}):Hp(t,e,i,!0)}}function sV(n,e){let i=el(n,e).start.parent;return i.isEmpty&&!e.schema.isLimit(i)&&(i=i.parent),e.schema.checkChild(i,"media")}function oV(n){const e=n.getSelectedElement();return!!e&&e.name==="media"}const rV='<svg viewBox="0 0 64 42" xmlns="http://www.w3.org/2000/svg"><path d="M47.426 17V3.713L63.102 0v19.389h-.001l.001.272c0 1.595-2.032 3.43-4.538 4.098-2.506.668-4.538-.083-4.538-1.678 0-1.594 2.032-3.43 4.538-4.098.914-.244 2.032-.565 2.888-.603V4.516L49.076 7.447v9.556A1.014 1.014 0 0 0 49 17h-1.574zM29.5 17h-8.343a7.073 7.073 0 1 0-4.657 4.06v3.781H3.3a2.803 2.803 0 0 1-2.8-2.804V8.63a2.803 2.803 0 0 1 2.8-2.805h4.082L8.58 2.768A1.994 1.994 0 0 1 10.435 1.5h8.985c.773 0 1.477.448 1.805 1.149l1.488 3.177H26.7c1.546 0 2.8 1.256 2.8 2.805V17zm-11.637 0H17.5a1 1 0 0 0-1 1v.05A4.244 4.244 0 1 1 17.863 17zm29.684 2c.97 0 .953-.048.953.889v20.743c0 .953.016.905-.953.905H19.453c-.97 0-.953.048-.953-.905V19.89c0-.937-.016-.889.97-.889h28.077zm-4.701 19.338V22.183H24.154v16.155h18.692zM20.6 21.375v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616V37.53H20.6zm24.233-16.155v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615V37.53h-1.615zM29.485 25.283a.4.4 0 0 1 .593-.35l9.05 4.977a.4.4 0 0 1 0 .701l-9.05 4.978a.4.4 0 0 1-.593-.35v-9.956z"/></svg>';/**
|
|
1670
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1671
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1672
|
+
*/const aV="0 0 64 42";class lV{constructor(e,t){const i=t.providers,s=t.extraProviders||[],o=new Set(t.removeProviders),r=i.concat(s).filter(a=>{const l=a.name;return l?!o.has(l):(H("media-embed-no-provider-name",{provider:a}),!1)});this.locale=e,this.providerDefinitions=r}hasMedia(e){return!!this._getMedia(e)}getMediaViewElement(e,t,i){return this._getMedia(t).getViewElement(e,i)}_getMedia(e){if(!e)return new th(this.locale);e=e.trim();for(const t of this.providerDefinitions){const i=t.html,s=K(t.url);for(const o of s){const r=this._getUrlMatches(e,o);if(r)return new th(this.locale,e,r,i)}}return null}_getUrlMatches(e,t){let i=e.match(t);if(i)return i;let s=e.replace(/^https?:\/\//,"");return i=s.match(t),i||(s=s.replace(/^www\./,""),i=s.match(t),i)?i:null}}class th{constructor(e,t,i,s){this.url=this._getValidUrl(t),this._locale=e,this._match=i,this._previewRenderer=s}getViewElement(e,t){const i={};let s;if(t.renderForEditingView||t.renderMediaPreview&&this.url&&this._previewRenderer){this.url&&(i["data-oembed-url"]=this.url),t.renderForEditingView&&(i.class="ck-media__wrapper");const o=this._getPreviewHtml(t);s=e.createRawElement("div",i,(r,a)=>{a.setContentOf(r,o)})}else this.url&&(i.url=this.url),s=e.createEmptyElement(t.elementName,i);return e.setCustomProperty("media-content",!0,s),s}_getPreviewHtml(e){return this._previewRenderer?this._previewRenderer(this._match):this.url&&e.renderForEditingView?this._getPlaceholderHtml():""}_getPlaceholderHtml(){const e=new at,t=this._locale.t;return e.content=rV,e.viewBox=aV,new xe({tag:"div",attributes:{class:"ck ck-reset_all ck-media__placeholder"},children:[{tag:"div",attributes:{class:"ck-media__placeholder__icon"},children:[e]},{tag:"a",attributes:{class:"ck-media__placeholder__url",target:"_blank",rel:"noopener noreferrer",href:this.url,"data-cke-tooltip-text":t("Open media in new tab")},children:[{tag:"span",attributes:{class:"ck-media__placeholder__url__text"},children:[this.url]}]}]}).render().outerHTML}_getValidUrl(e){return e?e.match(/^https?/)?e:"https://"+e:null}}/**
|
|
1673
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1674
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1675
|
+
*/class io extends w{static get pluginName(){return"MediaEmbedEditing"}constructor(e){super(e),e.config.define("mediaEmbed",{elementName:"oembed",providers:[{name:"dailymotion",url:[/^dailymotion\.com\/video\/(\w+)/,/^dai.ly\/(\w+)/],html:t=>`<div style="position: relative; padding-bottom: 100%; height: 0; "><iframe src="https://www.dailymotion.com/embed/video/${t[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" width="480" height="270" allowfullscreen allow="autoplay"></iframe></div>`},{name:"spotify",url:[/^open\.spotify\.com\/(artist\/\w+)/,/^open\.spotify\.com\/(album\/\w+)/,/^open\.spotify\.com\/(track\/\w+)/],html:t=>`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 126%;"><iframe src="https://open.spotify.com/embed/${t[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe></div>`},{name:"youtube",url:[/^(?:m\.)?youtube\.com\/watch\?v=([\w-]+)(?:&t=(\d+))?/,/^(?:m\.)?youtube\.com\/v\/([\w-]+)(?:\?t=(\d+))?/,/^youtube\.com\/embed\/([\w-]+)(?:\?start=(\d+))?/,/^youtu\.be\/([\w-]+)(?:\?t=(\d+))?/],html:t=>{const i=t[1],s=t[2];return`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;"><iframe src="https://www.youtube.com/embed/${i}${s?`?start=${s}`:""}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe></div>`}},{name:"vimeo",url:[/^vimeo\.com\/(\d+)/,/^vimeo\.com\/[^/]+\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/album\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/channels\/[^/]+\/(\d+)/,/^vimeo\.com\/groups\/[^/]+\/videos\/(\d+)/,/^vimeo\.com\/ondemand\/[^/]+\/(\d+)/,/^player\.vimeo\.com\/video\/(\d+)/],html:t=>`<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 56.2493%;"><iframe src="https://player.vimeo.com/video/${t[1]}" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>`},{name:"instagram",url:/^instagram\.com\/p\/(\w+)/},{name:"twitter",url:/^twitter\.com/},{name:"googleMaps",url:[/^google\.com\/maps/,/^goo\.gl\/maps/,/^maps\.google\.com/,/^maps\.app\.goo\.gl/]},{name:"flickr",url:/^flickr\.com/},{name:"facebook",url:/^facebook\.com/}]}),this.registry=new lV(e.locale,e.config.get("mediaEmbed"))}init(){const e=this.editor,t=e.model.schema,i=e.t,s=e.conversion,o=e.config.get("mediaEmbed.previewsInData"),r=e.config.get("mediaEmbed.elementName"),a=this.registry;e.commands.add("mediaEmbed",new nV(e)),t.register("media",{inheritAllFrom:"$blockObject",allowAttributes:["url"]}),s.for("dataDowncast").elementToStructure({model:"media",view:(l,{writer:c})=>{const u=l.getAttribute("url");return Xd(c,a,u,{elementName:r,renderMediaPreview:!!u&&o})}}),s.for("dataDowncast").add(Qd(a,{elementName:r,renderMediaPreview:o})),s.for("editingDowncast").elementToStructure({model:"media",view:(l,{writer:c})=>{const u=l.getAttribute("url"),d=Xd(c,a,u,{elementName:r,renderForEditingView:!0});return iV(d,c,i("media widget"))}}),s.for("editingDowncast").add(Qd(a,{elementName:r,renderForEditingView:!0})),s.for("upcast").elementToElement({view:l=>["oembed",r].includes(l.name)&&l.getAttribute("url")?{name:!0}:null,model:(l,{writer:c})=>{const u=l.getAttribute("url");return a.hasMedia(u)?c.createElement("media",{url:u}):null}}).elementToElement({view:{name:"div",attributes:{"data-oembed-url":!0}},model:(l,{writer:c})=>{const u=l.getAttribute("data-oembed-url");return a.hasMedia(u)?c.createElement("media",{url:u}):null}}).add(l=>{const c=(u,d,h)=>{if(!h.consumable.consume(d.viewItem,{name:!0,classes:"media"}))return;const{modelRange:f,modelCursor:m}=h.convertChildren(d.viewItem,d.modelCursor);d.modelRange=f,d.modelCursor=m,J(f.getItems())||h.consumable.revert(d.viewItem,{name:!0,classes:"media"})};l.on("element:figure",c)})}}/**
|
|
1676
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1677
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1678
|
+
*/const cV=/^(?:http(s)?:\/\/)?[\w-]+\.[\w-.~:/?#[\]@!$&'()*+,;=%]+$/;class uV extends w{static get requires(){return[Lg,yt,Og]}static get pluginName(){return"AutoMediaEmbed"}constructor(e){super(e),this._timeoutId=null,this._positionToInsert=null}init(){const e=this.editor,t=e.model.document,i=e.plugins.get("ClipboardPipeline");this.listenTo(i,"inputTransformation",()=>{const o=t.selection.getFirstRange(),r=pe.fromPosition(o.start);r.stickiness="toPrevious";const a=pe.fromPosition(o.end);a.stickiness="toNext",t.once("change:data",()=>{this._embedMediaBetweenPositions(r,a),r.detach(),a.detach()},{priority:"high"})}),e.commands.get("undo").on("execute",()=>{this._timeoutId&&(E.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)},{priority:"high"})}_embedMediaBetweenPositions(e,t){const i=this.editor,s=i.plugins.get(io).registry,o=new Fe(e,t),r=o.getWalker({ignoreElementEnd:!0});let a="";for(const c of r)c.item.is("$textProxy")&&(a+=c.item.data);if(a=a.trim(),!a.match(cV)){o.detach();return}if(!s.hasMedia(a)){o.detach();return}if(!i.commands.get("mediaEmbed").isEnabled){o.detach();return}this._positionToInsert=pe.fromPosition(e),this._timeoutId=E.window.setTimeout(()=>{i.model.change(c=>{this._timeoutId=null,c.remove(o),o.detach();let u=null;this._positionToInsert.root.rootName!=="$graveyard"&&(u=this._positionToInsert),Hp(i.model,a,u,!1),this._positionToInsert.detach(),this._positionToInsert=null}),i.plugins.get(yt).requestUndoOnBackspace()},100)}}/**
|
|
1679
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1680
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1681
|
+
*/class dV extends T{constructor(e,t){super(t);const i=t.t;this.focusTracker=new ne,this.keystrokes=new ae,this.set("mediaURLInputValue",""),this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(i("Save"),I.check,"ck-button-save"),this.saveButtonView.type="submit",this.saveButtonView.bind("isEnabled").to(this,"mediaURLInputValue",s=>!!s),this.cancelButtonView=this._createButton(i("Cancel"),I.cancel,"ck-button-cancel","cancel"),this._focusables=new Ae,this._focusCycler=new ke({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this._validators=e,this.setTemplate({tag:"form",attributes:{class:["ck","ck-media-form","ck-responsive-form"],tabindex:"-1"},children:[this.urlInputView,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),so({view:this}),[this.urlInputView,this.saveButtonView,this.cancelButtonView].forEach(i=>{this._focusables.add(i),this.focusTracker.add(i.element)}),this.keystrokes.listenTo(this.element);const t=i=>i.stopPropagation();this.keystrokes.set("arrowright",t),this.keystrokes.set("arrowleft",t),this.keystrokes.set("arrowup",t),this.keystrokes.set("arrowdown",t)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}get url(){return this.urlInputView.fieldView.element.value.trim()}set url(e){this.urlInputView.fieldView.element.value=e.trim()}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.urlInputView.errorText=t,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null,this.urlInputView.infoText=this._urlInputViewInfoDefault}_createUrlInput(){const e=this.locale.t,t=new Zi(this.locale,Qn),i=t.fieldView;return this._urlInputViewInfoDefault=e("Paste the media URL in the input."),this._urlInputViewInfoTip=e("Tip: Paste the URL into the content to embed faster."),t.label=e("Media URL"),t.infoText=this._urlInputViewInfoDefault,i.on("input",()=>{t.infoText=i.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault,this.mediaURLInputValue=i.element.value.trim()}),t}_createButton(e,t,i,s){const o=new B(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o.extendTemplate({attributes:{class:i}}),s&&o.delegate("execute").to(this,s),o}}const hV='<svg viewBox="0 0 22 20" xmlns="http://www.w3.org/2000/svg"><path d="M1.587 1.5c-.612 0-.601-.029-.601.551v14.84c0 .59-.01.559.591.559h18.846c.602 0 .591.03.591-.56V2.052c0-.58.01-.55-.591-.55H1.587Zm.701.971h1.003v1H2.288v-1Zm16.448 0h1.003v1h-1.003v-1Zm-14.24 1h13.008v12H4.467l.029-12Zm-2.208 1h1.003v1H2.288v-1Zm16.448 0h1.003v1h-1.003v-1Zm-16.448 2h1.003v1H2.288v-1Zm16.448 0h1.003v1h-1.003v-1Zm-16.448 2h1.003v1H2.288v-1Zm16.448 0h1.003v1h-1.003v-1Zm-16.448 2h1.003v1H2.288v-1Zm16.448 0h1.003v1h-1.003v-1Zm-16.448 2h1.003l-.029 1h-.974v-1Zm16.448 0h1.003v1h-1.003v-1Zm-16.448 2h.974v1h-.974v-1Zm16.448 0h1.003v1h-1.003v-1Z"/><path d="M8.374 6.648a.399.399 0 0 1 .395-.4.402.402 0 0 1 .2.049l5.148 2.824a.4.4 0 0 1 0 .7l-5.148 2.824a.403.403 0 0 1-.595-.35V6.648Z"/></svg>';/**
|
|
1682
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1683
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1684
|
+
*/class fV extends w{static get requires(){return[io]}static get pluginName(){return"MediaEmbedUI"}init(){const e=this.editor,t=e.commands.get("mediaEmbed");e.ui.componentFactory.add("mediaEmbed",i=>{const s=fe(i);return this._setUpDropdown(s,t),s})}_setUpDropdown(e,t){const i=this.editor,s=i.t,o=e.buttonView,r=i.plugins.get(io).registry;e.once("change:isOpen",()=>{const a=new(ma(dV))(mV(i.t,r),i.locale);e.panelView.children.add(a),o.on("open",()=>{a.disableCssTransitions(),a.url=t.value||"",a.urlInputView.fieldView.select(),a.enableCssTransitions()},{priority:"low"}),e.on("submit",()=>{a.isValid()&&(i.execute("mediaEmbed",a.url),i.editing.view.focus())}),e.on("change:isOpen",()=>a.resetFormStatus()),e.on("cancel",()=>{i.editing.view.focus()}),a.delegate("submit","cancel").to(e),a.urlInputView.fieldView.bind("value").to(t,"value"),a.urlInputView.bind("isEnabled").to(t,"isEnabled")}),e.bind("isEnabled").to(t),o.set({label:s("Insert media"),icon:hV,tooltip:!0})}}function mV(n,e){return[t=>{if(!t.url.length)return n("The URL must not be empty.")},t=>{if(!e.hasMedia(t.url))return n("This media URL is not supported.")}]}/**
|
|
1685
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1686
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1687
|
+
*/class gV extends w{static get requires(){return[io,fV,uV,fi]}static get pluginName(){return"MediaEmbed"}}/**
|
|
1688
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1689
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1690
|
+
*/const ih="ckCsrfToken",nh=40,sh="abcdefghijklmnopqrstuvwxyz0123456789";function pV(){let n=wV(ih);return(!n||n.length!=nh)&&(n=_V(nh),bV(ih,n)),n}function wV(n){n=n.toLowerCase();const e=document.cookie.split(";");for(const t of e){const i=t.split("=");if(decodeURIComponent(i[0].trim().toLowerCase())===n)return decodeURIComponent(i[1])}return null}function bV(n,e){document.cookie=encodeURIComponent(n)+"="+encodeURIComponent(e)+";path=/"}function _V(n){let e="";const t=new Uint8Array(n);window.crypto.getRandomValues(t);for(let i=0;i<t.length;i++){const s=sh.charAt(t[i]%sh.length);e+=Math.random()>.5?s.toUpperCase():s}return e}/**
|
|
1691
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
1692
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
1693
|
+
*/class vV extends w{static get requires(){return[Yt]}static get pluginName(){return"CKFinderUploadAdapter"}init(){const e=this.editor.config.get("ckfinder.uploadUrl");e&&(this.editor.plugins.get(Yt).createUploadAdapter=t=>new yV(t,e,this.editor.t))}}class yV{constructor(e,t,i){this.loader=e,this.url=t,this.t=i}upload(){return this.loader.file.then(e=>new Promise((t,i)=>{this._initRequest(),this._initListeners(t,i,e),this._sendRequest(e)}))}abort(){this.xhr&&this.xhr.abort()}_initRequest(){const e=this.xhr=new XMLHttpRequest;e.open("POST",this.url,!0),e.responseType="json"}_initListeners(e,t,i){const s=this.xhr,o=this.loader,r=this.t,a=r("Cannot upload file:")+` ${i.name}.`;s.addEventListener("error",()=>t(a)),s.addEventListener("abort",()=>t()),s.addEventListener("load",()=>{const l=s.response;if(!l||!l.uploaded)return t(l&&l.error&&l.error.message?l.error.message:a);e({default:l.url})});/* istanbul ignore else -- @preserve */s.upload&&s.upload.addEventListener("progress",l=>{l.lengthComputable&&(o.uploadTotal=l.total,o.uploaded=l.loaded)})}_sendRequest(e){const t=new FormData;t.append("upload",e),t.append("ckCsrfToken",pV()),this.xhr.send(t)}}class CV extends bo{static builtinPlugins=[MI,Ox,qx,v3,Kx,II,tP,oP,RP,UP,WP,AP,KP,JP,n3,T4,dp,K4,m7,is,A6,I6,B6,wR,YR,a3,d3,Xx,m8,P8,F8,H8,Z8,tV,gV,vV];static defaultConfig={toolbar:{items:["undo","redo","|","heading","bold","italic","strikethrough","underline","fontColor","fontBackgroundColor","fontFamily","fontSize","|","numberedList","bulletedList","|","outdent","indent","blockQuote","|","alignment","|","link","imageUpload","mediaEmbed","horizontalLine","specialCharacters","code","codeBlock","insertTable","|","style","|","removeFormat","selectAll","|","sourceEditing"]},style:{definitions:[{name:"Source code",element:"pre",classes:["SourceCode"]},{name:"Error",element:"p",classes:["Error"]},{name:"Path",element:"p",classes:["Path"]}]},codeBlock:{languages:[{language:"plaintext",label:"Plain text"},{language:"html",label:"HTML"},{language:"javascript",label:"JavaScript"},{language:"php",label:"PHP"},{language:"css",label:"CSS"}]},heading:{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading1",view:"h1",title:"Heading 1",class:"ck-heading_heading1"},{model:"heading2",view:"h2",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h3",title:"Heading 3",class:"ck-heading_heading3"}]},image:{resizeOptions:[{name:"resizeImage:25",value:"25",icon:"small"},{name:"resizeImage:50",value:"50",icon:"medium"},{name:"resizeImage:75",value:"75",icon:"large"},{name:"resizeImage:original",value:null,icon:"original"}],toolbar:["toggleImageCaption","imageTextAlternative","|","imageStyle:inline","imageStyle:block","imageStyle:side","|","imageStyle:wrapText","imageStyle:breakText","|","resizeImage:25","resizeImage:50","resizeImage:75","resizeImage:original"]},language:"en"}}class kV{loader;xhr;insertImageServiceUrl;getImageServiceUrl;constructor(e,t,i){this.loader=e,this.insertImageServiceUrl=t,this.getImageServiceUrl=i}upload(){return this.loader.file.then(e=>new Promise((t,i)=>{this._initRequest(e),this._initListeners(t,i,e),this._sendRequest(e)}))}abort(){this.xhr&&this.xhr.abort()}_initRequest(e){const t=this.xhr=new XMLHttpRequest;let i=this.insertImageServiceUrl;i+="&dADFileUpload=Y",i+="&max_file_size=0",i+="&name="+window.btoa(encodeURIComponent(e.name)),i+="&size="+e.size,i+="&type="+(e.type?e.type:"n/a"),t.open("POST",i,!0),t.responseType="json"}_initListeners(e,t,i){const s=this.xhr,o=this.loader,r=`Couldn't upload file: ${i.name}.`;s.addEventListener("error",()=>t(r)),s.addEventListener("abort",()=>t()),s.addEventListener("load",()=>{const a=s.response;if(a&&a.S){if(a.S==="Y"){const l=this._getFileIdFromResponse(a);if(l){e({default:this.getImageServiceUrl+"?view=Y&file="+l});return}}else if(a.M){t(a.M);return}}t(r)}),s.upload&&s.upload.addEventListener("progress",a=>{a.lengthComputable&&(o.uploadTotal=a.total,o.uploaded=a.loaded)})}_sendRequest(e){this.xhr.send(e.slice())}_getFileIdFromResponse(e){if(e.F&&Array.isArray(e.F)){for(const t of e.F)if(Array.isArray(t)&&t.length>1&&t[0]==="id")return t[1]}return null}}function EV(n){let e;return{c(){e=ha("div")},m(t,i){da(t,e,i),n[13](e)},p:Gt,i:Gt,o:Gt,d(t){t&&no(e),n[13](null)}}}function TV(n,e,t){const i=e.createRangeIn(t);for(const s of i.getWalker()){const o=s.item;if(o.is("$textProxy")&&o.data!=""&&o.data.includes(n))return o}return null}function AV(n,e,t){let{insertImageServiceUrl:i=""}=e,{getImageServiceUrl:s=""}=e,{items:o=["undo","redo","|","heading","bold","italic","strikethrough","underline","fontColor","fontBackgroundColor","fontFamily","fontSize","|","numberedList","bulletedList","|","outdent","indent","blockQuote","|","alignment","|","link","imageUpload","mediaEmbed","horizontalLine","specialCharacters","code","codeBlock","insertTable","|","style","|","removeFormat","selectAll","|","sourceEditing"]}=e,{allowHtmlSupport:r=!1}=e,{value:a=""}=e,{placeHolder:l=""}=e,{lang:c="en"}=e,{valueChange:u=(v,P)=>{}}=e,{stateChange:d=(v,P)=>{}}=e,{editor:h=null}=e,f=null;function m(v){v.plugins.get("FileRepository").createUploadAdapter=P=>new kV(P,i,s)}function p(v){h!=null&&(h.focus(),h.model.change(P=>{if(h==null)return;let M=h.model.document.getRoot();if(M==null)return;const D=TV(v,P,M);if(D!=null){P.setSelection(P.createPositionBefore(D)),P.remove(D);const A=D.data.split(v);P.insertText(A[0],h.model.document.selection.getFirstPosition()??void 0);const V=h.model.document.selection.getFirstPosition();P.insertText(A[1],h.model.document.selection.getFirstPosition()??void 0),P.setSelection(V)}}))}function _(v){h!=null&&(h.focus(),h.model.change(P=>{if(h==null)return;let M=JSON.parse(v);if(M.root==null||M.path==null||M.stickiness==null)return;let D=h.model.document.getRoot(M.root);D!=null&&P.setSelection(P.createPositionFromPath(D,M.path,M.stickiness))}))}CV.create(a,{placeholder:l,toolbar:o,extraPlugins:[m],htmlSupport:{allow:r?[{name:/.*/,attributes:!0,classes:!0,styles:!0}]:[]},language:{ui:c}}).then(v=>{t(1,h=v),f!=null&&v.ui.view.element!=null&&f.appendChild(v.ui.view.element),v.model.document.on("change:data",(P,M)=>{t(2,a=v.getData()),u(P,M)}),v.on("change:state",(P,M,D,A)=>{d(P,D)}),d(null,"ready")}).catch(v=>{console.error(v.stack)});function C(v){Vs[v?"unshift":"push"](()=>{f=v,t(0,f)})}return n.$$set=v=>{"insertImageServiceUrl"in v&&t(3,i=v.insertImageServiceUrl),"getImageServiceUrl"in v&&t(4,s=v.getImageServiceUrl),"items"in v&&t(5,o=v.items),"allowHtmlSupport"in v&&t(6,r=v.allowHtmlSupport),"value"in v&&t(2,a=v.value),"placeHolder"in v&&t(7,l=v.placeHolder),"lang"in v&&t(8,c=v.lang),"valueChange"in v&&t(9,u=v.valueChange),"stateChange"in v&&t(10,d=v.stateChange),"editor"in v&&t(1,h=v.editor)},n.$$.update=()=>{if(n.$$.dirty&130){let v;h!=null&&(v=h.editing.view.document.getRoot("main"))!=null&&v.placeholder!=l&&(v.placeholder=l)}},[f,h,a,i,s,o,r,l,c,u,d,p,_,C]}class Up extends gh{constructor(e){super(),hh(this,e,AV,EV,rh,{insertImageServiceUrl:3,getImageServiceUrl:4,items:5,allowHtmlSupport:6,value:2,placeHolder:7,lang:8,valueChange:9,stateChange:10,editor:1,setCursorPositionAtPlaceholder:11,setCursorPositionFromJSONString:12})}get insertImageServiceUrl(){return this.$$.ctx[3]}set insertImageServiceUrl(e){this.$$set({insertImageServiceUrl:e}),Re()}get getImageServiceUrl(){return this.$$.ctx[4]}set getImageServiceUrl(e){this.$$set({getImageServiceUrl:e}),Re()}get items(){return this.$$.ctx[5]}set items(e){this.$$set({items:e}),Re()}get allowHtmlSupport(){return this.$$.ctx[6]}set allowHtmlSupport(e){this.$$set({allowHtmlSupport:e}),Re()}get value(){return this.$$.ctx[2]}set value(e){this.$$set({value:e}),Re()}get placeHolder(){return this.$$.ctx[7]}set placeHolder(e){this.$$set({placeHolder:e}),Re()}get lang(){return this.$$.ctx[8]}set lang(e){this.$$set({lang:e}),Re()}get valueChange(){return this.$$.ctx[9]}set valueChange(e){this.$$set({valueChange:e}),Re()}get stateChange(){return this.$$.ctx[10]}set stateChange(e){this.$$set({stateChange:e}),Re()}get editor(){return this.$$.ctx[1]}set editor(e){this.$$set({editor:e}),Re()}get setCursorPositionAtPlaceholder(){return this.$$.ctx[11]}get setCursorPositionFromJSONString(){return this.$$.ctx[12]}}customElements.define("ckeditor5-classic",mh(Up,{insertImageServiceUrl:{},getImageServiceUrl:{},items:{},allowHtmlSupport:{type:"Boolean"},value:{},placeHolder:{},lang:{},valueChange:{},stateChange:{},editor:{}},[],["setCursorPositionAtPlaceholder","setCursorPositionFromJSONString"],!1));exports.CKEditor5Classic_1=Up;exports.SvelteComponent=gh;exports.add_flush_callback=o1;exports.append=jp;exports.attr=lh;exports.bind=d1;exports.binding_callbacks=Vs;exports.check_outros=c1;exports.createEventDispatcher=i1;exports.create_component=h1;exports.create_custom_element=mh;exports.destroy_component=dh;exports.destroy_each=Gp;exports.detach=no;exports.element=ha;exports.flush=Re;exports.group_outros=l1;exports.init=hh;exports.insert=da;exports.is_function=ua;exports.listen=Zp;exports.mount_component=uh;exports.noop=Gt;exports.run_all=qi;exports.safe_not_equal=rh;exports.set_data=Yp;exports.set_input_value=Qp;exports.space=Kp;exports.text=ah;exports.transition_in=ch;exports.transition_out=u1;
|