diff --git a/libraries/ckeditor/ckeditor.js b/libraries/ckeditor/ckeditor.js
index b3688c106..c947be406 100644
--- a/libraries/ckeditor/ckeditor.js
+++ b/libraries/ckeditor/ckeditor.js
@@ -3,5 +3,5 @@
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md.
*/
-function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.CKEditor=e():t.CKEditor=e()}(self,(()=>(()=>{var t={9246:(t,e,n)=>{const i=n(6931),o={};for(const t of Object.keys(i))o[i[t]]=t;const r={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"]}};t.exports=r;for(const t of Object.keys(r)){if(!("channels"in r[t]))throw new Error("missing channels property: "+t);if(!("labels"in r[t]))throw new Error("missing channel labels property: "+t);if(r[t].labels.length!==r[t].channels)throw new Error("channel and label counts mismatch: "+t);const{channels:e,labels:n}=r[t];delete r[t].channels,delete r[t].labels,Object.defineProperty(r[t],"channels",{value:e}),Object.defineProperty(r[t],"labels",{value:n})}r.rgb.hsl=function(t){const e=t[0]/255,n=t[1]/255,i=t[2]/255,o=Math.min(e,n,i),r=Math.max(e,n,i),s=r-o;let a,c;r===o?a=0:e===r?a=(n-i)/s:n===r?a=2+(i-e)/s:i===r&&(a=4+(e-n)/s),a=Math.min(60*a,360),a<0&&(a+=360);const l=(o+r)/2;return c=r===o?0:l<=.5?s/(r+o):s/(2-r-o),[a,100*c,100*l]},r.rgb.hsv=function(t){let e,n,i,o,r;const s=t[0]/255,a=t[1]/255,c=t[2]/255,l=Math.max(s,a,c),d=l-Math.min(s,a,c),h=function(t){return(l-t)/6/d+.5};return 0===d?(o=0,r=0):(r=d/l,e=h(s),n=h(a),i=h(c),s===l?o=i-n:a===l?o=1/3+e-i:c===l&&(o=2/3+n-e),o<0?o+=1:o>1&&(o-=1)),[360*o,100*r,100*l]},r.rgb.hwb=function(t){const e=t[0],n=t[1];let i=t[2];const o=r.rgb.hsl(t)[0],s=1/255*Math.min(e,Math.min(n,i));return i=1-1/255*Math.max(e,Math.max(n,i)),[o,100*s,100*i]},r.rgb.cmyk=function(t){const e=t[0]/255,n=t[1]/255,i=t[2]/255,o=Math.min(1-e,1-n,1-i);return[100*((1-e-o)/(1-o)||0),100*((1-n-o)/(1-o)||0),100*((1-i-o)/(1-o)||0),100*o]},r.rgb.keyword=function(t){const e=o[t];if(e)return e;let n,r=1/0;for(const e of Object.keys(i)){const o=i[e],c=(a=o,((s=t)[0]-a[0])**2+(s[1]-a[1])**2+(s[2]-a[2])**2);c.04045?((e+.055)/1.055)**2.4:e/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92;return[100*(.4124*e+.3576*n+.1805*i),100*(.2126*e+.7152*n+.0722*i),100*(.0193*e+.1192*n+.9505*i)]},r.rgb.lab=function(t){const e=r.rgb.xyz(t);let n=e[0],i=e[1],o=e[2];n/=95.047,i/=100,o/=108.883,n=n>.008856?n**(1/3):7.787*n+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;return[116*i-16,500*(n-i),200*(i-o)]},r.hsl.rgb=function(t){const e=t[0]/360,n=t[1]/100,i=t[2]/100;let o,r,s;if(0===n)return s=255*i,[s,s,s];o=i<.5?i*(1+n):i+n-i*n;const a=2*i-o,c=[0,0,0];for(let t=0;t<3;t++)r=e+1/3*-(t-1),r<0&&r++,r>1&&r--,s=6*r<1?a+6*(o-a)*r:2*r<1?o:3*r<2?a+(o-a)*(2/3-r)*6:a,c[t]=255*s;return c},r.hsl.hsv=function(t){const e=t[0];let n=t[1]/100,i=t[2]/100,o=n;const r=Math.max(i,.01);i*=2,n*=i<=1?i:2-i,o*=r<=1?r:2-r;return[e,100*(0===i?2*o/(r+o):2*n/(i+n)),100*((i+n)/2)]},r.hsv.rgb=function(t){const e=t[0]/60,n=t[1]/100;let i=t[2]/100;const o=Math.floor(e)%6,r=e-Math.floor(e),s=255*i*(1-n),a=255*i*(1-n*r),c=255*i*(1-n*(1-r));switch(i*=255,o){case 0:return[i,c,s];case 1:return[a,i,s];case 2:return[s,i,c];case 3:return[s,a,i];case 4:return[c,s,i];case 5:return[i,s,a]}},r.hsv.hsl=function(t){const e=t[0],n=t[1]/100,i=t[2]/100,o=Math.max(i,.01);let r,s;s=(2-n)*i;const a=(2-n)*o;return r=n*o,r/=a<=1?a:2-a,r=r||0,s/=2,[e,100*r,100*s]},r.hwb.rgb=function(t){const e=t[0]/360;let n=t[1]/100,i=t[2]/100;const o=n+i;let r;o>1&&(n/=o,i/=o);const s=Math.floor(6*e),a=1-i;r=6*e-s,1&s&&(r=1-r);const c=n+r*(a-n);let l,d,h;switch(s){default:case 6:case 0:l=a,d=c,h=n;break;case 1:l=c,d=a,h=n;break;case 2:l=n,d=a,h=c;break;case 3:l=n,d=c,h=a;break;case 4:l=c,d=n,h=a;break;case 5:l=a,d=n,h=c}return[255*l,255*d,255*h]},r.cmyk.rgb=function(t){const e=t[0]/100,n=t[1]/100,i=t[2]/100,o=t[3]/100;return[255*(1-Math.min(1,e*(1-o)+o)),255*(1-Math.min(1,n*(1-o)+o)),255*(1-Math.min(1,i*(1-o)+o))]},r.xyz.rgb=function(t){const e=t[0]/100,n=t[1]/100,i=t[2]/100;let o,r,s;return o=3.2406*e+-1.5372*n+-.4986*i,r=-.9689*e+1.8758*n+.0415*i,s=.0557*e+-.204*n+1.057*i,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,o=Math.min(Math.max(0,o),1),r=Math.min(Math.max(0,r),1),s=Math.min(Math.max(0,s),1),[255*o,255*r,255*s]},r.xyz.lab=function(t){let e=t[0],n=t[1],i=t[2];e/=95.047,n/=100,i/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;return[116*n-16,500*(e-n),200*(n-i)]},r.lab.xyz=function(t){let e,n,i;n=(t[0]+16)/116,e=t[1]/500+n,i=n-t[2]/200;const o=n**3,r=e**3,s=i**3;return n=o>.008856?o:(n-16/116)/7.787,e=r>.008856?r:(e-16/116)/7.787,i=s>.008856?s:(i-16/116)/7.787,e*=95.047,n*=100,i*=108.883,[e,n,i]},r.lab.lch=function(t){const e=t[0],n=t[1],i=t[2];let o;o=360*Math.atan2(i,n)/2/Math.PI,o<0&&(o+=360);return[e,Math.sqrt(n*n+i*i),o]},r.lch.lab=function(t){const e=t[0],n=t[1],i=t[2]/360*2*Math.PI;return[e,n*Math.cos(i),n*Math.sin(i)]},r.rgb.ansi16=function(t,e=null){const[n,i,o]=t;let s=null===e?r.rgb.hsv(t)[2]:e;if(s=Math.round(s/50),0===s)return 30;let a=30+(Math.round(o/255)<<2|Math.round(i/255)<<1|Math.round(n/255));return 2===s&&(a+=60),a},r.hsv.ansi16=function(t){return r.rgb.ansi16(r.hsv.rgb(t),t[2])},r.rgb.ansi256=function(t){const e=t[0],n=t[1],i=t[2];if(e===n&&n===i)return e<8?16:e>248?231:Math.round((e-8)/247*24)+232;return 16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5)},r.ansi16.rgb=function(t){let e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];const n=.5*(1+~~(t>50));return[(1&e)*n*255,(e>>1&1)*n*255,(e>>2&1)*n*255]},r.ansi256.rgb=function(t){if(t>=232){const e=10*(t-232)+8;return[e,e,e]}let e;t-=16;return[Math.floor(t/36)/5*255,Math.floor((e=t%36)/6)/5*255,e%6/5*255]},r.rgb.hex=function(t){const e=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(e.length)+e},r.hex.rgb=function(t){const e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let n=e[0];3===e[0].length&&(n=n.split("").map((t=>t+t)).join(""));const i=parseInt(n,16);return[i>>16&255,i>>8&255,255&i]},r.rgb.hcg=function(t){const e=t[0]/255,n=t[1]/255,i=t[2]/255,o=Math.max(Math.max(e,n),i),r=Math.min(Math.min(e,n),i),s=o-r;let a,c;return a=s<1?r/(1-s):0,c=s<=0?0:o===e?(n-i)/s%6:o===n?2+(i-e)/s:4+(e-n)/s,c/=6,c%=1,[360*c,100*s,100*a]},r.hsl.hcg=function(t){const e=t[1]/100,n=t[2]/100,i=n<.5?2*e*n:2*e*(1-n);let o=0;return i<1&&(o=(n-.5*i)/(1-i)),[t[0],100*i,100*o]},r.hsv.hcg=function(t){const e=t[1]/100,n=t[2]/100,i=e*n;let o=0;return i<1&&(o=(n-i)/(1-i)),[t[0],100*i,100*o]},r.hcg.rgb=function(t){const e=t[0]/360,n=t[1]/100,i=t[2]/100;if(0===n)return[255*i,255*i,255*i];const o=[0,0,0],r=e%1*6,s=r%1,a=1-s;let c=0;switch(Math.floor(r)){case 0:o[0]=1,o[1]=s,o[2]=0;break;case 1:o[0]=a,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=s;break;case 3:o[0]=0,o[1]=a,o[2]=1;break;case 4:o[0]=s,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=a}return c=(1-n)*i,[255*(n*o[0]+c),255*(n*o[1]+c),255*(n*o[2]+c)]},r.hcg.hsv=function(t){const e=t[1]/100,n=e+t[2]/100*(1-e);let i=0;return n>0&&(i=e/n),[t[0],100*i,100*n]},r.hcg.hsl=function(t){const e=t[1]/100,n=t[2]/100*(1-e)+.5*e;let i=0;return n>0&&n<.5?i=e/(2*n):n>=.5&&n<1&&(i=e/(2*(1-n))),[t[0],100*i,100*n]},r.hcg.hwb=function(t){const e=t[1]/100,n=e+t[2]/100*(1-e);return[t[0],100*(n-e),100*(1-n)]},r.hwb.hcg=function(t){const e=t[1]/100,n=1-t[2]/100,i=n-e;let o=0;return i<1&&(o=(n-i)/(1-i)),[t[0],100*i,100*o]},r.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},r.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},r.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},r.gray.hsl=function(t){return[0,0,t[0]]},r.gray.hsv=r.gray.hsl,r.gray.hwb=function(t){return[0,100,t[0]]},r.gray.cmyk=function(t){return[0,0,0,t[0]]},r.gray.lab=function(t){return[t[0],0,0]},r.gray.hex=function(t){const e=255&Math.round(t[0]/100*255),n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n},r.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}},9047:(t,e,n)=>{const i=n(9246),o=n(802),r={};Object.keys(i).forEach((t=>{r[t]={},Object.defineProperty(r[t],"channels",{value:i[t].channels}),Object.defineProperty(r[t],"labels",{value:i[t].labels});const e=o(t);Object.keys(e).forEach((n=>{const i=e[n];r[t][n]=function(t){const e=function(...e){const n=e[0];if(null==n)return n;n.length>1&&(e=n);const i=t(e);if("object"==typeof i)for(let t=i.length,e=0;e1&&(e=n),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}(i)}))})),t.exports=r},802:(t,e,n)=>{const i=n(9246);function o(t){const e=function(){const t={},e=Object.keys(i);for(let n=e.length,i=0;i{"use strict";t.exports={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]}},7241:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(9372),o=n.n(i),r=n(935),s=n.n(r)()(o());s.push([t.id,'.ck .footnote-section{border:1px solid #c4c4c4;border-radius:2px;counter-reset:footnote-counter;margin:1em 0;padding:10px}.ck .footnote-item{counter-increment:footnote-counter;display:flex;list-style:none;margin-left:.5em}.ck .footnote-item>*{vertical-align:text-top}.ck .footnote-back-link{margin-right:.1em;position:relative;top:-.2em}.ck .footnotes .footnote-back-link>sup{margin-right:0}.ck .footnote-item:before{content:counter(footnote-counter) ". ";display:inline-block;min-width:fit-content;position:relative;right:.2em;text-align:right}.ck .footnote-content{border-radius:2px;display:inline-block;flex-grow:1;padding:0 .3em;width:95%}.ck .ck-widget.footnote-section .ck-widget__type-around__button_after{display:none}.placeholder{line-height:1em;margin:0 1px;outline-offset:-2px;padding:2px}.placeholder::selection{display:none}',"",{version:3,sources:["webpack://./../../node_modules/@triliumnext/ckeditor5-footnotes/src/footnote.css"],names:[],mappings:"AAAA,sBAGC,wBAAiC,CACjC,iBAAkB,CAClB,8BAA+B,CAH/B,YAAa,CADb,YAKD,CAEA,mBAEC,kCAAmC,CAEnC,YAAa,CAHb,eAAgB,CAEhB,gBAED,CAEA,qBACC,uBACD,CAEA,wBAEC,iBAAmB,CADnB,iBAAkB,CAElB,SACD,CAEA,uCACC,cACD,CAEA,0BACC,sCAAuC,CACvC,oBAAqB,CAGrB,qBAAsB,CAFtB,iBAAkB,CAClB,UAAY,CAEZ,gBACD,CAEA,sBAIC,iBAAkB,CAHlB,oBAAqB,CAIrB,WAAY,CAHZ,cAAgB,CAChB,SAGD,CAEA,sEACC,YACD,CAEA,aAGC,eAAgB,CAChB,YAAa,CAFb,mBAAoB,CADpB,WAID,CAEA,wBACC,YACD",sourcesContent:[".ck .footnote-section {\n\tpadding: 10px;\n\tmargin: 1em 0;\n\tborder: solid 1px hsl(0, 0%, 77%);\n\tborder-radius: 2px;\n\tcounter-reset: footnote-counter;\n}\n\n.ck .footnote-item {\n\tlist-style: none;\n\tcounter-increment: footnote-counter;\n\tmargin-left: 0.5em;\n\tdisplay: flex;\n}\n\n.ck .footnote-item > * {\n\tvertical-align: text-top;\n}\n\n.ck .footnote-back-link {\n\tposition: relative;\n\tmargin-right: 0.1em;\n\ttop: -0.2em;\n}\n\n.ck .footnotes .footnote-back-link > sup {\n\tmargin-right: 0;\n}\n\n.ck .footnote-item::before {\n\tcontent: counter(footnote-counter) \". \";\n\tdisplay: inline-block;\n\tposition: relative;\n\tright: 0.2em;\n\tmin-width: fit-content;\n\ttext-align: right;\n}\n\n.ck .footnote-content {\n\tdisplay: inline-block;\n\tpadding: 0 0.3em;\n\twidth: 95%;\n\tborder-radius: 2px;\n\tflex-grow: 1;\n}\n\n.ck .ck-widget.footnote-section .ck-widget__type-around__button_after {\n\tdisplay:none; /* hides the 'insert after' button from the ckeditor widget */\n}\n\n.placeholder {\n\tpadding: 2px 2px;\n\toutline-offset: -2px;\n\tline-height: 1em;\n\tmargin: 0 1px;\n}\n\n.placeholder::selection {\n\tdisplay: none;\n}"],sourceRoot:""}]);const a=s},7111:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(9372),o=n.n(i),r=n(935),s=n.n(r)()(o());s.push([t.id,".ck.ck-math-form{align-items:flex-start;display:flex;flex-direction:row;flex-wrap:nowrap}@media screen and (max-width:600px){.ck.ck-math-form{flex-wrap:wrap}.ck.ck-math-form .ck-math-view,.ck.ck-math-form .ck-math-view .ck-label,.ck.ck-math-form .ck-math-view .ck-labeled-view{flex-basis:100%}.ck.ck-math-form .ck-button{flex-basis:50%}}.ck-math-tex.ck-placeholder:before{display:none!important}.ck.ck-toolbar-container{z-index:calc(var(--ck-z-panel) + 2)}.ck.ck-math-form{padding:var(--ck-spacing-standard)}.ck.ck-math-form:focus{outline:none}[dir=ltr] .ck.ck-math-form>:not(:first-child),[dir=rtl] .ck.ck-math-form>:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-math-form{padding:0}.ck.ck-math-form .ck-labeled-input{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-math-form .ck-labeled-input .ck-input-text{min-width:0;width:100%}.ck.ck-math-form .ck-label,.ck.ck-math-form .ck-math-view .ck-button,.ck.ck-math-form .ck-math-view .ck.ck-math-preview{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-math-form>.ck-button{border:0;border-radius:0;border-top:1px solid var(--ck-color-base-border);margin-top:var(--ck-spacing-standard);padding:var(--ck-spacing-standard)}[dir=ltr] .ck.ck-math-form>.ck-button{margin-left:0}[dir=ltr] .ck.ck-math-form>.ck-button:first-of-type{border-right:1px solid var(--ck-color-base-border)}[dir=rtl] .ck.ck-math-form>.ck-button{margin-left:0}[dir=rtl] .ck.ck-math-form>.ck-button:last-of-type{border-right:1px solid var(--ck-color-base-border)}}","",{version:3,sources:["webpack://./../../node_modules/@triliumnext/ckeditor5-math/theme/mathform.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-math/mathform.css","webpack://./../ckeditor5-ui/theme/mixins/_rwd.css"],names:[],mappings:"AAAA,iBAEC,sBAAuB,CADvB,YAAa,CAEb,kBAAmB,CACnB,gBAsBD,CAnBC,oCAPD,iBAQE,cAkBF,CATG,wHACC,eACD,CAGD,4BACC,cACD,CACD,CAGD,mCACC,sBACD,CAEA,yBACC,mCACD,CC/BA,iBACI,kCAsEJ,CApEI,uBAEF,YACD,CASC,2FACC,sCACD,CCdD,oCDHD,iBAqBE,SAkDF,CAhDE,mCACC,8DAMD,CAJC,kDACC,WAAY,CACZ,UACD,CAYA,wHACC,8DACD,CAGD,4BAKC,QAAS,CADT,eAAgB,CAEhB,gDAAiD,CAJjD,qCAAsC,CADtC,kCAsBD,CAvBA,sCASE,aAcF,CAZE,oDACC,kDACD,CAbF,sCAiBE,aAMF,CAJE,mDACC,kDACD,CC9DH",sourcesContent:[".ck.ck-math-form {\n\tdisplay: flex;\n\talign-items: flex-start;\n\tflex-direction: row;\n\tflex-wrap: nowrap;\n\tpadding: var(--ck-spacing-standard);\n\n\t@media screen and (max-width: 600px) {\n\t\tflex-wrap: wrap;\n\n\t\t& .ck-math-view {\n\t\t\tflex-basis: 100%;\n\n\t\t\t& .ck-labeled-view {\n\t\t\t\tflex-basis: 100%;\n\t\t\t}\n\n\t\t\t& .ck-label {\n\t\t\t\tflex-basis: 100%;\n\t\t\t}\n\t\t}\n\n\t\t& .ck-button {\n\t\t\tflex-basis: 50%;\n\t\t}\n\t}\n}\n\n.ck-math-tex.ck-placeholder::before {\n\tdisplay: none !important;\n}\n\n.ck.ck-toolbar-container {\n\tz-index: calc(var(--ck-z-panel) + 2);\n}\n",'@import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";\n\n.ck.ck-math-form {\n padding: var(--ck-spacing-standard);\n\n &:focus {\n\t\t/* https://github.com/ckeditor/ckeditor5-link/issues/90 */\n\t\toutline: none;\n\t}\n\n @mixin ck-dir ltr {\n\t\t& > :not(:first-child) {\n\t\t\tmargin-left: var(--ck-spacing-standard);\n\t\t}\n\t}\n\n\t@mixin ck-dir rtl {\n\t\t& > :not(:last-child) {\n\t\t\tmargin-left: var(--ck-spacing-standard);\n\t\t}\n\t}\n\n\t@mixin ck-media-phone {\n\t\tpadding: 0;\n\n\t\t& .ck-labeled-input {\n\t\t\tmargin: var(--ck-spacing-standard) var(--ck-spacing-standard) 0;\n\n\t\t\t& .ck-input-text {\n\t\t\t\tmin-width: 0;\n\t\t\t\twidth: 100%;\n\t\t\t}\n\t\t}\n\n & .ck-label {\n margin: var(--ck-spacing-standard) var(--ck-spacing-standard) 0;\n }\n\n\t\t& .ck-math-view {\n\t\t\t& .ck-button {\n\t\t\t\tmargin: var(--ck-spacing-standard) var(--ck-spacing-standard) 0;\n\t\t\t}\n\n\t\t\t& .ck.ck-math-preview {\n\t\t\t\tmargin: var(--ck-spacing-standard) var(--ck-spacing-standard) 0;\n\t\t\t}\n\t\t}\n\n\t\t& > .ck-button {\n\t\t\tpadding: var(--ck-spacing-standard);\n\t\t\tmargin-top: var(--ck-spacing-standard);\n\n\t\t\tborder-radius: 0;\n\t\t\tborder: 0;\n\t\t\tborder-top: 1px solid var(--ck-color-base-border);\n\n\t\t\t@mixin ck-dir ltr {\n\t\t\t\tmargin-left: 0;\n\n\t\t\t\t&:first-of-type {\n\t\t\t\t\tborder-right: 1px solid var(--ck-color-base-border);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t@mixin ck-dir rtl {\n\t\t\t\tmargin-left: 0;\n\n\t\t\t\t&:last-of-type {\n\t\t\t\t\tborder-right: 1px solid var(--ck-color-base-border);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n',"/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@define-mixin ck-media-phone {\n\t@media screen and (max-width: 600px) {\n\t\t@mixin-content;\n\t}\n}\n"],sourceRoot:""}]);const a=s},4199:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(9372),o=n.n(i),r=n(935),s=n.n(r)()(o());s.push([t.id,".ck-content code{background-color:hsla(0,0%,78%,.3);border-radius:2px;padding:.15em}.ck.ck-editor__editable .ck-code_selected{background-color:hsla(0,0%,78%,.5)}","",{version:3,sources:["webpack://./../ckeditor5-basic-styles/theme/code.css"],names:[],mappings:"AAKA,iBACC,kCAAuC,CAEvC,iBAAkB,CADlB,aAED,CAEA,0CACC,kCACD",sourcesContent:["/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck-content code {\n\tbackground-color: hsla(0, 0%, 78%, 0.3);\n\tpadding: .15em;\n\tborder-radius: 2px;\n}\n\n.ck.ck-editor__editable .ck-code_selected {\n\tbackground-color: hsla(0, 0%, 78%, 0.5);\n}\n"],sourceRoot:""}]);const a=s},8708:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(9372),o=n.n(i),r=n(935),s=n.n(r)()(o());s.push([t.id,".ck-content blockquote{border-left:5px solid #ccc;font-style:italic;margin-left:0;margin-right:0;overflow:hidden;padding-left:1.5em;padding-right:1.5em}.ck-content[dir=rtl] blockquote{border-left:0;border-right:5px solid #ccc}","",{version:3,sources:["webpack://./../ckeditor5-block-quote/theme/blockquote.css"],names:[],mappings:"AAKA,uBAWC,0BAAsC,CADtC,iBAAkB,CAFlB,aAAc,CACd,cAAe,CAPf,eAAgB,CAIhB,kBAAmB,CADnB,mBAOD,CAEA,gCACC,aAAc,CACd,2BACD",sourcesContent:['/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck-content blockquote {\n\t/* See #12 */\n\toverflow: hidden;\n\n\t/* https://github.com/ckeditor/ckeditor5-block-quote/issues/15 */\n\tpadding-right: 1.5em;\n\tpadding-left: 1.5em;\n\n\tmargin-left: 0;\n\tmargin-right: 0;\n\tfont-style: italic;\n\tborder-left: solid 5px hsl(0, 0%, 80%);\n}\n\n.ck-content[dir="rtl"] blockquote {\n\tborder-left: 0;\n\tborder-right: solid 5px hsl(0, 0%, 80%);\n}\n'],sourceRoot:""}]);const a=s},9826:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(9372),o=n.n(i),r=n(935),s=n.n(r)()(o());s.push([t.id,".ck.ck-block-toolbar-button{transform:translateX(calc(var(--ck-spacing-large)*-1))}","",{version:3,sources:["webpack://./theme/theme.css"],names:[],mappings:"AAMA,4BACC,sDACD",sourcesContent:["/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/* Give the block toolbar button some space, moving it a few pixels away from the editable area. */\n.ck.ck-block-toolbar-button {\n\ttransform: translateX( calc(-1 * var(--ck-spacing-large)) );\n}\n"],sourceRoot:""}]);const a=s},7793:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(9372),o=n.n(i),r=n(935),s=n.n(r)()(o());s.push([t.id,'.ck.ck-editor__editable .ck.ck-clipboard-drop-target-position{display:inline;pointer-events:none;position:relative}.ck.ck-editor__editable .ck.ck-clipboard-drop-target-position span{position:absolute;width:0}.ck.ck-editor__editable .ck-widget:-webkit-drag>.ck-widget__selection-handle,.ck.ck-editor__editable .ck-widget:-webkit-drag>.ck-widget__type-around{display:none}.ck.ck-clipboard-drop-target-line{pointer-events:none;position:absolute}:root{--ck-clipboard-drop-target-dot-width:12px;--ck-clipboard-drop-target-dot-height:8px;--ck-clipboard-drop-target-color:var(--ck-color-focus-border)}.ck.ck-editor__editable .ck.ck-clipboard-drop-target-position span{background:var(--ck-clipboard-drop-target-color);border:1px solid var(--ck-clipboard-drop-target-color);bottom:calc(var(--ck-clipboard-drop-target-dot-height)*-.5);margin-left:-1px;top:calc(var(--ck-clipboard-drop-target-dot-height)*-.5)}.ck.ck-editor__editable .ck.ck-clipboard-drop-target-position span:after{border-color:var(--ck-clipboard-drop-target-color) transparent transparent transparent;border-style:solid;border-width:calc(var(--ck-clipboard-drop-target-dot-height)) calc(var(--ck-clipboard-drop-target-dot-width)*.5) 0 calc(var(--ck-clipboard-drop-target-dot-width)*.5);content:"";display:block;height:0;left:50%;position:absolute;top:calc(var(--ck-clipboard-drop-target-dot-height)*-.5);transform:translateX(-50%);width:0}.ck.ck-editor__editable .ck-widget.ck-clipboard-drop-target-range{outline:var(--ck-widget-outline-thickness) solid var(--ck-clipboard-drop-target-color)!important}.ck.ck-editor__editable .ck-widget:-webkit-drag{zoom:.6;outline:none!important}.ck.ck-clipboard-drop-target-line{background:var(--ck-clipboard-drop-target-color);border:1px solid var(--ck-clipboard-drop-target-color);height:0;margin-top:-1px}.ck.ck-clipboard-drop-target-line:before{border-style:solid;content:"";height:0;position:absolute;top:calc(var(--ck-clipboard-drop-target-dot-width)*-.5);width:0}[dir=ltr] .ck.ck-clipboard-drop-target-line:before{border-color:transparent transparent transparent var(--ck-clipboard-drop-target-color);border-width:calc(var(--ck-clipboard-drop-target-dot-width)*.5) 0 calc(var(--ck-clipboard-drop-target-dot-width)*.5) var(--ck-clipboard-drop-target-dot-height);left:-1px}[dir=rtl] .ck.ck-clipboard-drop-target-line:before{border-color:transparent var(--ck-clipboard-drop-target-color) transparent transparent;border-width:calc(var(--ck-clipboard-drop-target-dot-width)*.5) var(--ck-clipboard-drop-target-dot-height) calc(var(--ck-clipboard-drop-target-dot-width)*.5) 0;right:-1px}',"",{version:3,sources:["webpack://./../ckeditor5-clipboard/theme/clipboard.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-clipboard/clipboard.css"],names:[],mappings:"AASC,8DACC,cAAe,CAEf,mBAAoB,CADpB,iBAOD,CAJC,mEACC,iBAAkB,CAClB,OACD,CAWA,qJACC,YACD,CAIF,kCAEC,mBAAoB,CADpB,iBAED,CC9BA,MACC,yCAA0C,CAC1C,yCAA0C,CAC1C,6DACD,CAOE,mEAIC,gDAAiD,CADjD,sDAAuD,CAFvD,2DAA8D,CAI9D,gBAAiB,CAHjB,wDAqBD,CAfC,yEAWC,sFAAuF,CAEvF,kBAAmB,CADnB,qKAA0K,CAX1K,UAAW,CAIX,aAAc,CAFd,QAAS,CAIT,QAAS,CADT,iBAAkB,CAElB,wDAA2D,CAE3D,0BAA2B,CAR3B,OAYD,CAOF,kEACC,gGACD,CAKA,gDACC,OAAS,CACT,sBACD,CAGD,kCAGC,gDAAiD,CADjD,sDAAuD,CADvD,QAAS,CAGT,eAwBD,CAtBC,yCAMC,kBAAmB,CALnB,UAAW,CAIX,QAAS,CAHT,iBAAkB,CAClB,uDAA0D,CAC1D,OAiBD,CArBA,mDAYE,sFAAuF,CADvF,+JAAoK,CAFpK,SAYF,CArBA,mDAmBE,sFAAuF,CADvF,+JAAmK,CAFnK,UAKF",sourcesContent:["/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck.ck-editor__editable {\n\t/*\n\t * Vertical drop target (in text).\n\t */\n\t& .ck.ck-clipboard-drop-target-position {\n\t\tdisplay: inline;\n\t\tposition: relative;\n\t\tpointer-events: none;\n\n\t\t& span {\n\t\t\tposition: absolute;\n\t\t\twidth: 0;\n\t\t}\n\t}\n\n\t/*\n\t * Styles of the widget being dragged (its preview).\n\t */\n\t& .ck-widget:-webkit-drag {\n\t\t& > .ck-widget__selection-handle {\n\t\t\tdisplay: none;\n\t\t}\n\n\t\t& > .ck-widget__type-around {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n}\n\n.ck.ck-clipboard-drop-target-line {\n\tposition: absolute;\n\tpointer-events: none;\n}\n","/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import \"@ckeditor/ckeditor5-ui/theme/mixins/_dir.css\";\n\n:root {\n\t--ck-clipboard-drop-target-dot-width: 12px;\n\t--ck-clipboard-drop-target-dot-height: 8px;\n\t--ck-clipboard-drop-target-color: var(--ck-color-focus-border);\n}\n\n.ck.ck-editor__editable {\n\t/*\n\t * Vertical drop target (in text).\n\t */\n\t& .ck.ck-clipboard-drop-target-position {\n\t\t& span {\n\t\t\tbottom: calc(-.5 * var(--ck-clipboard-drop-target-dot-height));\n\t\t\ttop: calc(-.5 * var(--ck-clipboard-drop-target-dot-height));\n\t\t\tborder: 1px solid var(--ck-clipboard-drop-target-color);\n\t\t\tbackground: var(--ck-clipboard-drop-target-color);\n\t\t\tmargin-left: -1px;\n\n\t\t\t/* The triangle above the marker */\n\t\t\t&::after {\n\t\t\t\tcontent: '';\n\t\t\t\twidth: 0;\n\t\t\t\theight: 0;\n\n\t\t\t\tdisplay: block;\n\t\t\t\tposition: absolute;\n\t\t\t\tleft: 50%;\n\t\t\t\ttop: calc(-.5 * var(--ck-clipboard-drop-target-dot-height));\n\n\t\t\t\ttransform: translateX(-50%);\n\t\t\t\tborder-color: var(--ck-clipboard-drop-target-color) transparent transparent transparent;\n\t\t\t\tborder-width: calc(var(--ck-clipboard-drop-target-dot-height)) calc(.5 * var(--ck-clipboard-drop-target-dot-width)) 0 calc(.5 * var(--ck-clipboard-drop-target-dot-width));\n\t\t\t\tborder-style: solid;\n\t\t\t}\n\t\t}\n\t}\n\n\t/*\n\t * Styles of the widget that it a drop target.\n\t */\n\t& .ck-widget.ck-clipboard-drop-target-range {\n\t\toutline: var(--ck-widget-outline-thickness) solid var(--ck-clipboard-drop-target-color) !important;\n\t}\n\n\t/*\n\t * Styles of the widget being dragged (its preview).\n\t */\n\t& .ck-widget:-webkit-drag {\n\t\tzoom: 0.6;\n\t\toutline: none !important;\n\t}\n}\n\n.ck.ck-clipboard-drop-target-line {\n\theight: 0;\n\tborder: 1px solid var(--ck-clipboard-drop-target-color);\n\tbackground: var(--ck-clipboard-drop-target-color);\n\tmargin-top: -1px;\n\n\t&::before {\n\t\tcontent: '';\n\t\tposition: absolute;\n\t\ttop: calc(-.5 * var(--ck-clipboard-drop-target-dot-width));\n\t\twidth: 0;\n\t\theight: 0;\n\t\tborder-style: solid;\n\n\t\t@mixin ck-dir ltr {\n\t\t\tleft: -1px;\n\n\t\t\tborder-width: calc(.5 * var(--ck-clipboard-drop-target-dot-width)) 0 calc(.5 * var(--ck-clipboard-drop-target-dot-width)) var(--ck-clipboard-drop-target-dot-height);\n\t\t\tborder-color: transparent transparent transparent var(--ck-clipboard-drop-target-color);\n\t\t}\n\n\t\t@mixin ck-dir rtl {\n\t\t\tright: -1px;\n\n\t\t\tborder-width:calc(.5 * var(--ck-clipboard-drop-target-dot-width)) var(--ck-clipboard-drop-target-dot-height) calc(.5 * var(--ck-clipboard-drop-target-dot-width)) 0;\n\t\t\tborder-color: transparent var(--ck-clipboard-drop-target-color) transparent transparent;\n\t\t}\n\t}\n}\n"],sourceRoot:""}]);const a=s},6610:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(9372),o=n.n(i),r=n(935),s=n.n(r)()(o());s.push([t.id,".ck-content pre{border:1px solid #c4c4c4;border-radius:2px;direction:ltr;font-style:normal;min-width:200px;padding:1em;tab-size:4;text-align:left;white-space:pre-wrap}.ck-content pre code{background:unset;border-radius:0;padding:0}.ck-content pre:not(.hljs){background:hsla(0,0%,78%,.3);color:#353535}.ck.ck-editor__editable pre{position:relative}.ck.ck-editor__editable pre[data-language]:after{content:attr(data-language);position:absolute}:root{--ck-color-code-block-label-background:#757575}.ck.ck-editor__editable pre[data-language]:after{background:var(--ck-color-code-block-label-background);color:#fff;font-family:var(--ck-font-face);font-size:10px;line-height:16px;padding:var(--ck-spacing-tiny) var(--ck-spacing-medium);right:10px;top:-1px;white-space:nowrap}.ck.ck-code-block-dropdown .ck-dropdown__panel{max-height:250px;overflow-x:hidden;overflow-y:auto}","",{version:3,sources:["webpack://./../ckeditor5-code-block/theme/codeblock.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-code-block/codeblock.css"],names:[],mappings:"AAKA,gBAEC,wBAAiC,CACjC,iBAAkB,CAIlB,aAAc,CAMd,iBAAkB,CAGlB,eAAgB,CAfhB,WAAY,CAQZ,UAAW,CAHX,eAAgB,CAIhB,oBAaD,CALC,qBACC,gBAAiB,CAEjB,eAAgB,CADhB,SAED,CAGD,2BAEC,4BAAiC,CADjC,aAED,CAEA,4BACC,iBAMD,CAJC,iDACC,2BAA4B,CAC5B,iBACD,CCpCD,MACC,8CACD,CAEA,iDAGC,sDAAuD,CAMvD,UAAuB,CAHvB,+BAAgC,CADhC,cAAe,CAEf,gBAAiB,CACjB,uDAAwD,CANxD,UAAW,CADX,QAAS,CAST,kBACD,CAEA,+CAEC,gBAAiB,CAEjB,iBAAkB,CADlB,eAED",sourcesContent:["/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck-content pre {\n\tpadding: 1em;\n\tborder: 1px solid hsl(0, 0%, 77%);\n\tborder-radius: 2px;\n\n\t/* Code block are language direction–agnostic. */\n\ttext-align: left;\n\tdirection: ltr;\n\n\ttab-size: 4;\n\twhite-space: pre-wrap;\n\n\t/* Don't inherit the style, e.g. when in a block quote. */\n\tfont-style: normal;\n\n\t/* Don't let the code be squashed e.g. when in a table cell. */\n\tmin-width: 200px;\n\n\t& code {\n\t\tbackground: unset;\n\t\tpadding: 0;\n\t\tborder-radius: 0;\n\t}\n}\n\n.ck-content pre:not(.hljs) {\n\tcolor: hsl(0, 0%, 20.8%);\n\tbackground: hsla(0, 0%, 78%, 0.3);\n}\n\n.ck.ck-editor__editable pre {\n\tposition: relative;\n\n\t&[data-language]::after {\n\t\tcontent: attr(data-language);\n\t\tposition: absolute;\n\t}\n}\n","/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n:root {\n\t--ck-color-code-block-label-background: hsl(0, 0%, 46%);\n}\n\n.ck.ck-editor__editable pre[data-language]::after {\n\ttop: -1px;\n\tright: 10px;\n\tbackground: var(--ck-color-code-block-label-background);\n\n\tfont-size: 10px;\n\tfont-family: var(--ck-font-face);\n\tline-height: 16px;\n\tpadding: var(--ck-spacing-tiny) var(--ck-spacing-medium);\n\tcolor: hsl(0, 0%, 100%);\n\twhite-space: nowrap;\n}\n\n.ck.ck-code-block-dropdown .ck-dropdown__panel {\n\t/* There could be dozens of languages available. Use scroll to prevent a 10e6px dropdown. */\n\tmax-height: 250px;\n\toverflow-y: auto;\n\toverflow-x: hidden;\n}\n"],sourceRoot:""}]);const a=s},4098:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(9372),o=n.n(i),r=n(935),s=n.n(r)()(o());s.push([t.id,".ck .ck-placeholder,.ck.ck-placeholder{position:relative}.ck .ck-placeholder:before,.ck.ck-placeholder:before{content:attr(data-placeholder);left:0;pointer-events:none;position:absolute;right:0}.ck.ck-read-only .ck-placeholder:before{display:none}.ck.ck-reset_all .ck-placeholder{position:relative}@media (forced-colors:active){.ck .ck-placeholder,.ck.ck-placeholder{forced-color-adjust:preserve-parent-color}}.ck .ck-placeholder:before,.ck.ck-placeholder:before{cursor:text}@media (forced-colors:none){.ck .ck-placeholder:before,.ck.ck-placeholder:before{color:var(--ck-color-engine-placeholder-text)}}@media (forced-colors:active){.ck .ck-placeholder:before,.ck.ck-placeholder:before{font-style:italic;margin-left:1px}}","",{version:3,sources:["webpack://./../ckeditor5-engine/theme/placeholder.css","webpack://./../ckeditor5-ui/theme/mixins/_mediacolors.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-engine/placeholder.css"],names:[],mappings:"AAMA,uCAEC,iBAWD,CATC,qDAIC,8BAA+B,CAF/B,MAAO,CAKP,mBAAoB,CANpB,iBAAkB,CAElB,OAKD,CAKA,wCACC,YACD,CAQD,iCACC,iBACD,CC7BC,8BACC,uCCOA,yCDLA,CACD,CCOA,qDACC,WAmBD,CDvBA,4BACC,qDCMC,6CDJD,CACD,CAZA,8BACC,qDCsBC,iBAAkB,CAMlB,eD1BD,CACD",sourcesContent:["/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/* See ckeditor/ckeditor5#936. */\n.ck.ck-placeholder,\n.ck .ck-placeholder {\n\tposition: relative;\n\n\t&::before {\n\t\tposition: absolute;\n\t\tleft: 0;\n\t\tright: 0;\n\t\tcontent: attr(data-placeholder);\n\n\t\t/* See ckeditor/ckeditor5#469. */\n\t\tpointer-events: none;\n\t}\n}\n\n/* See ckeditor/ckeditor5#1987. */\n.ck.ck-read-only .ck-placeholder {\n\t&::before {\n\t\tdisplay: none;\n\t}\n}\n\n/*\n * Rules for the `ck-placeholder` are loaded before the rules for `ck-reset_all` in the base CKEditor 5 DLL build.\n * This fix overwrites the incorrectly set `position: static` from `ck-reset_all`.\n * See https://github.com/ckeditor/ckeditor5/issues/11418.\n */\n.ck.ck-reset_all .ck-placeholder {\n\tposition: relative;\n}\n","/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@define-mixin ck-media-forced-colors {\n\t@media (forced-colors: active) {\n\t\t& {\n\t\t\t@mixin-content;\n\t\t}\n\t}\n}\n\n@define-mixin ck-media-default-colors {\n\t@media (forced-colors: none) {\n\t\t& {\n\t\t\t@mixin-content;\n\t\t}\n\t}\n}\n",'/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_mediacolors.css";\n\n/* See ckeditor/ckeditor5#936. */\n.ck.ck-placeholder, .ck .ck-placeholder {\n\t@mixin ck-media-forced-colors {\n\t\t/*\n\t\t * This is needed for Edge on Windows to use the right color for the placeholder content (::before).\n\t\t * See https://github.com/ckeditor/ckeditor5/issues/14907.\n\t\t */\n\t\tforced-color-adjust: preserve-parent-color;\n\t}\n\n\t&::before {\n\t\tcursor: text;\n\n\t\t@mixin ck-media-default-colors {\n\t\t\tcolor: var(--ck-color-engine-placeholder-text);\n\t\t}\n\n\t\t@mixin ck-media-forced-colors {\n\t\t\t/*\n\t\t\t * In the high contrast mode there is no telling between regular and placeholder text. Using\n\t\t\t * italic text to address that issue. See https://github.com/ckeditor/ckeditor5/issues/14907.\n\t\t\t */\n\t\t\tfont-style: italic;\n\n\t\t\t/*\n\t\t\t * Without this margin, the caret will not show up and blink when the user puts the selection\n\t\t\t * in the placeholder (Edge on Windows). See https://github.com/ckeditor/ckeditor5/issues/14907.\n\t\t\t */\n\t\t\tmargin-left: 1px;\n\t\t}\n\t}\n}\n'],sourceRoot:""}]);const a=s},8264:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(9372),o=n.n(i),r=n(935),s=n.n(r)()(o());s.push([t.id,".ck.ck-editor__editable span[data-ck-unsafe-element]{display:none}","",{version:3,sources:["webpack://./../ckeditor5-engine/theme/renderer.css"],names:[],mappings:"AAMA,qDACC,YACD",sourcesContent:["/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/* Elements marked by the Renderer as hidden should be invisible in the editor. */\n.ck.ck-editor__editable span[data-ck-unsafe-element] {\n\tdisplay: none;\n}\n"],sourceRoot:""}]);const a=s},4341:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(9372),o=n.n(i),r=n(935),s=n.n(r)()(o());s.push([t.id,".ck-find-result{background:var(--ck-color-highlight-background);color:var(--ck-color-text)}.ck-find-result_selected{background:#ff9633}","",{version:3,sources:["webpack://./../ckeditor5-find-and-replace/theme/findandreplace.css"],names:[],mappings:"AAKA,gBACC,+CAAgD,CAChD,0BACD,CAEA,yBACC,kBACD",sourcesContent:["/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck-find-result {\n\tbackground: var(--ck-color-highlight-background);\n\tcolor: var(--ck-color-text);\n}\n\n.ck-find-result_selected {\n\tbackground: hsl(29, 100%, 60%);\n}\n"],sourceRoot:""}]);const a=s},9627:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(9372),o=n.n(i),r=n(935),s=n.n(r)()(o());s.push([t.id,".ck.ck-find-and-replace-form{max-width:100%}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs{display:flex}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions.ck-find-and-replace-form__inputs .ck-results-counter,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs.ck-find-and-replace-form__inputs .ck-results-counter{position:absolute}.ck.ck-find-and-replace-form{width:400px}.ck.ck-find-and-replace-form:focus{outline:none}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs{align-content:stretch;align-items:center;flex:1 1 auto;flex-direction:row;flex-wrap:wrap;margin:0;padding:var(--ck-spacing-large)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions>.ck-button,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-button{flex:0 0 auto}[dir=ltr] .ck.ck-find-and-replace-form .ck-find-and-replace-form__actions>*+*,[dir=ltr] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>*+*{margin-left:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-find-and-replace-form .ck-find-and-replace-form__actions>*+*,[dir=rtl] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>*+*{margin-right:var(--ck-spacing-standard)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions .ck-labeled-field-view,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-labeled-field-view{flex:1 1 auto}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions .ck-labeled-field-view .ck-input,.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-labeled-field-view .ck-input{min-width:50px;width:100%}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs{align-items:flex-start}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-button-prev>.ck-icon{transform:rotate(90deg)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-button-next>.ck-icon{transform:rotate(-90deg)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-results-counter{top:50%;transform:translateY(-50%)}[dir=ltr] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-results-counter{right:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-results-counter{left:var(--ck-spacing-standard)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs .ck-results-counter{color:var(--ck-color-base-border)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-labeled-field-replace{flex:0 0 100%;padding-top:var(--ck-spacing-standard)}[dir=ltr] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-labeled-field-replace{margin-left:0}[dir=rtl] .ck.ck-find-and-replace-form .ck-find-and-replace-form__inputs>.ck-labeled-field-replace{margin-right:0}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions{flex-wrap:wrap;justify-content:flex-end;margin-top:calc(var(--ck-spacing-large)*-1)}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions>.ck-button-find{font-weight:700}.ck.ck-find-and-replace-form .ck-find-and-replace-form__actions>.ck-button-find .ck-button__label{padding-left:var(--ck-spacing-large);padding-right:var(--ck-spacing-large)}.ck.ck-find-and-replace-form .ck-switchbutton{align-items:center;display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;width:100%}@media screen and (max-width:600px){.ck.ck-find-and-replace-form{max-width:100%;width:300px}.ck.ck-find-and-replace-form.ck-find-and-replace-form__input{flex-wrap:wrap}.ck.ck-find-and-replace-form.ck-find-and-replace-form__input .ck-labeled-field-view{flex:1 0 auto;margin-bottom:var(--ck-spacing-standard);width:100%}.ck.ck-find-and-replace-form.ck-find-and-replace-form__input>.ck-button{text-align:center}.ck.ck-find-and-replace-form.ck-find-and-replace-form__input>.ck-button:first-of-type{flex:1 1 auto}[dir=ltr] .ck.ck-find-and-replace-form.ck-find-and-replace-form__input>.ck-button:first-of-type{margin-left:0}[dir=rtl] .ck.ck-find-and-replace-form.ck-find-and-replace-form__input>.ck-button:first-of-type{margin-right:0}.ck.ck-find-and-replace-form.ck-find-and-replace-form__input>.ck-button:first-of-type .ck-button__label{text-align:center;width:100%}.ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view){flex:1 1 auto;flex-wrap:wrap}.ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view)>.ck-button{text-align:center}.ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view)>.ck-button:first-of-type{flex:1 1 auto}[dir=ltr] .ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view)>.ck-button:first-of-type{margin-left:0}[dir=rtl] .ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view)>.ck-button:first-of-type{margin-right:0}.ck.ck-find-and-replace-form.ck-find-and-replace-form__actions>:not(.ck-labeled-field-view)>.ck-button .ck-button__label{text-align:center;width:100%}}","",{version:3,sources:["webpack://./../ckeditor5-find-and-replace/theme/findandreplaceform.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-find-and-replace/findandreplaceform.css","webpack://./../ckeditor5-ui/theme/mixins/_rwd.css"],names:[],mappings:"AAKA,6BACC,cAUD,CARC,+HACC,YAMD,CAHC,yOACC,iBACD,CCNF,6BACC,WAoHD,CA9GC,mCACC,YACD,CAGA,+HAMC,qBAAsB,CADtB,kBAAmB,CAHnB,aAAc,CACd,kBAAmB,CACnB,cAAe,CAKf,QAAS,CADT,+BA4BD,CAzBC,qJACC,aACD,CAGC,2JACC,sCACD,CAIA,2JACC,uCACD,CAGD,6KACC,aAMD,CAJC,iMAEC,cAAe,CADf,UAED,CAMF,+DAEC,sBAqCD,CAnCC,wFACC,uBACD,CAEA,wFACC,wBACD,CAEA,mFACC,OAAQ,CACR,0BAWD,CAbA,6FAKE,gCAQF,CAbA,6FASE,+BAIF,CAbA,mFAYC,iCACD,CAEA,yFACC,aAAc,CACd,sCASD,CAXA,mGAKE,aAMF,CAXA,mGASE,cAEF,CAID,gEACC,cAAe,CACf,wBAAyB,CACzB,2CAWD,CATC,gFACC,eAOD,CAJC,kGACC,oCAAqC,CACrC,qCACD,CAIF,8CAMC,kBAAmB,CAJnB,YAAa,CACb,kBAAmB,CACnB,gBAAiB,CACjB,6BAA8B,CAJ9B,UAMD,CCtHA,oCD0HA,6BAIC,cAAe,CAHf,WA+DD,CAzDC,6DACC,cA4BD,CA1BC,oFACC,aAAc,CAEd,wCAAyC,CADzC,UAED,CAEA,wEACC,iBAkBD,CAhBC,sFACC,aAcD,CAfA,gGAIE,aAWF,CAfA,gGAQE,cAOF,CAJC,wGAEC,iBAAkB,CADlB,UAED,CAMH,4FAEC,aAAc,CADd,cAuBD,CApBC,uGACC,iBAkBD,CAhBC,qHACC,aASD,CAVA,+HAIE,aAMF,CAVA,+HAQE,cAEF,CAEA,yHAEC,iBAAkB,CADlB,UAED,CCrLH",sourcesContent:["/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n.ck.ck-find-and-replace-form {\n\tmax-width: 100%;\n\n\t& .ck-find-and-replace-form__inputs, .ck-find-and-replace-form__actions {\n\t\tdisplay: flex;\n\n\t\t/* The inputs area styles */\n\t\t&.ck-find-and-replace-form__inputs .ck-results-counter {\n\t\t\tposition: absolute;\n\t\t}\n\t}\n}\n",'/*\n * Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";\n@import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";\n\n.ck.ck-find-and-replace-form {\n\twidth: 400px;\n\n\t/*\n\t * The
").replace(/\r?\n/g,"
").replace(/\t/g," ").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g," ")).includes("
")||r.includes("
"))&&(r=`
${r}
`),t=r),o=this.editor.data.htmlProcessor.toView(t)}var r;const s=new mi(this,"inputTransformation");this.fire(s,{content:o,dataTransfer:i,targetRanges:e.targetRanges,method:e.method}),s.stop.called&&t.stop(),n.scrollToTheSelection()}),{priority:"low"}),this.listenTo(this,"inputTransformation",((t,n)=>{if(n.content.isEmpty)return;const i=this.editor.data.toModel(n.content,"$clipboardHolder");0!=i.childCount&&(t.stop(),e.change((()=>{this.fire("contentInsertion",{content:i,method:n.method,dataTransfer:n.dataTransfer,targetRanges:n.targetRanges})})))}),{priority:"low"}),this.listenTo(this,"contentInsertion",((t,e)=>{e.resultRange=o._pasteFragmentWithMarkers(e.content)}),{priority:"low"})}_setupCopyCut(){const t=this.editor,e=t.model.document,n=t.editing.view.document,i=(t,n)=>{const i=n.dataTransfer;n.preventDefault(),this._fireOutputTransformationEvent(i,e.selection,t.name)};this.listenTo(n,"copy",i,{priority:"low"}),this.listenTo(n,"cut",((e,n)=>{t.model.canEditAt(t.model.document.selection)?i(e,n):n.preventDefault()}),{priority:"low"}),this.listenTo(this,"outputTransformation",((e,i)=>{const o=t.data.toView(i.content);n.fire("clipboardOutput",{dataTransfer:i.dataTransfer,content:o,method:i.method})}),{priority:"low"}),this.listenTo(n,"clipboardOutput",((n,i)=>{i.content.isEmpty||(i.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(i.content)),i.dataTransfer.setData("text/plain",WA(i.content))),"cut"==i.method&&t.model.deleteContent(e.selection)}),{priority:"low"})}}class l_ extends(Di()){_stack=[];add(t,e){const n=this._stack,i=n[0];this._insertDescriptor(t);const o=n[0];i===o||d_(i,o)||this.fire("change:top",{oldDescriptor:i,newDescriptor:o,writer:e})}remove(t,e){const n=this._stack,i=n[0];this._removeDescriptor(t);const o=n[0];i===o||d_(i,o)||this.fire("change:top",{oldDescriptor:i,newDescriptor:o,writer:e})}_insertDescriptor(t){const e=this._stack,n=e.findIndex((e=>e.id===t.id));if(d_(t,e[n]))return;n>-1&&e.splice(n,1);let i=0;for(;e[i]&&h_(e[i],t);)i++;e.splice(i,0,t)}_removeDescriptor(t){const e=this._stack,n=e.findIndex((e=>e.id===t));n>-1&&e.splice(n,1)}}function d_(t,e){return t&&e&&t.priority==e.priority&&u_(t.classes)==u_(e.classes)}function h_(t,e){return t.priority>e.priority||!(t.priorityu_(e.classes)}function u_(t){return Array.isArray(t)?t.sort().join(","):t}const m_='',g_="ck-widget_selected";function p_(t){return!!t.is("element")&&!!t.getCustomProperty("widget")}function f_(t,e,n={}){if(!t.is("containerElement"))throw new bi("widget-to-widget-wrong-element-type",null,{element:t});return e.setAttribute("contenteditable","false",t),e.addClass("ck-widget",t),e.setCustomProperty("widget",!0,t),t.getFillerOffset=v_,e.setCustomProperty("widgetLabel",[],t),n.label&&function(t,e){const n=t.getCustomProperty("widgetLabel");n.push(e)}(t,n.label),n.hasSelectionHandle&&function(t,e){const n=e.createUIElement("div",{class:"ck ck-widget__selection-handle"},(function(t){const e=this.toDomElement(t),n=new pm;return n.set("content",m_),n.render(),e.appendChild(n.element),e}));e.insert(e.createPositionAt(t,0),n),e.addClass(["ck-widget_with-selection-handle"],t)}(t,e),w_(t,e),t}function k_(t,e,n){if(e.classes&&n.addClass(tr(e.classes),t),e.attributes)for(const i in e.attributes)n.setAttribute(i,e.attributes[i],t)}function b_(t,e,n){if(e.classes&&n.removeClass(tr(e.classes),t),e.attributes)for(const i in e.attributes)n.removeAttribute(i,t)}function w_(t,e,n=k_,i=b_){const o=new l_;o.on("change:top",((e,o)=>{o.oldDescriptor&&i(t,o.oldDescriptor,o.writer),o.newDescriptor&&n(t,o.newDescriptor,o.writer)}));e.setCustomProperty("addHighlight",((t,e,n)=>o.add(e,n)),t),e.setCustomProperty("removeHighlight",((t,e,n)=>o.remove(e,n)),t)}function A_(t,e,n={}){return e.addClass(["ck-editor__editable","ck-editor__nested-editable"],t),e.setAttribute("role","textbox",t),e.setAttribute("tabindex","-1",t),n.label&&e.setAttribute("aria-label",n.label,t),e.setAttribute("contenteditable",t.isReadOnly?"false":"true",t),t.on("change:isReadOnly",((n,i,o)=>{e.setAttribute("contenteditable",o?"false":"true",t)})),t.on("change:isFocused",((n,i,o)=>{o?e.addClass("ck-editor__nested-editable_focused",t):e.removeClass("ck-editor__nested-editable_focused",t)})),w_(t,e),t}function __(t,e){const n=t.getSelectedElement();if(n){const i=B_(t);if(i)return e.createRange(e.createPositionAt(n,i))}return e.schema.findOptimalInsertionRange(t)}function C_(t,e){return(n,i)=>{const{mapper:o,viewPosition:r}=i,s=o.findMappedViewAncestor(r);if(!e(s))return;const a=o.toModelElement(s);i.modelPosition=t.createPositionAt(a,r.isAtStart?"before":"after")}}function v_(){return null}function y_(t){const e=t=>{const{width:e,paddingLeft:n,paddingRight:i}=t.ownerDocument.defaultView.getComputedStyle(t);return parseFloat(e)-(parseFloat(n)||0)-(parseFloat(i)||0)},n=t.parentElement;if(!n)return 0;let i=e(n);let o=0,r=n;for(;isNaN(i);){if(r=r.parentElement,++o>5)return 0;i=e(r)}return i}const x_="widget-type-around";function E_(t,e,n){return!!t&&p_(t)&&!n.isInline(e)}function B_(t){return t.getAttribute(x_)}var D_=n(8508),S_={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$r()(D_.A,S_);D_.A.locals;const T_=["before","after"],I_=(new DOMParser).parseFromString('',"image/svg+xml").firstChild,P_="ck-widget__type-around_disabled";class F_ extends Lr{_currentFakeCaretModelElement=null;static get pluginName(){return"WidgetTypeAround"}static get requires(){return[pA,sw]}init(){const t=this.editor,e=t.editing.view;this.on("change:isEnabled",((n,i,o)=>{e.change((t=>{for(const n of e.document.roots)o?t.removeClass(P_,n):t.addClass(P_,n)})),o||t.model.change((t=>{t.removeSelectionAttribute(x_)}))})),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(t,e){const n=this.editor,i=n.editing.view,o=n.model.schema.getAttributesWithProperty(t,"copyOnReplace",!0);n.execute("insertParagraph",{position:n.model.createPositionAt(t,e),attributes:o}),i.focus(),i.scrollToTheSelection()}_listenToIfEnabled(t,e,n,i){this.listenTo(t,e,((...t)=>{this.isEnabled&&n(...t)}),i)}_insertParagraphAccordingToFakeCaretPosition(){const t=this.editor.model.document.selection,e=B_(t);if(!e)return!1;const n=t.getSelectedElement();return this._insertParagraph(n,e),!0}_enableTypeAroundUIInjection(){const t=this.editor,e=t.model.schema,n=t.locale.t,i={before:n("Insert paragraph before block"),after:n("Insert paragraph after block")};t.editing.downcastDispatcher.on("insert",((t,o,r)=>{const s=r.mapper.toViewElement(o.item);if(s&&E_(s,o.item,e)){!function(t,e,n){const i=t.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},(function(t){const n=this.toDomElement(t);return function(t,e){for(const n of T_){const i=new Ou({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${n}`],title:e[n],"aria-hidden":"true"},children:[t.ownerDocument.importNode(I_,!0)]});t.appendChild(i.render())}}(n,e),function(t){const e=new Ou({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});t.appendChild(e.render())}(n),n}));t.insert(t.createPositionAt(n,"end"),i)}(r.writer,i,s);s.getCustomProperty("widgetLabel").push((()=>this.isEnabled?n("Press Enter to type after or press Shift + Enter to type before the widget"):""))}}),{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const t=this.editor,e=t.model,n=e.document.selection,i=e.schema,o=t.editing.view;function r(t){return`ck-widget_type-around_show-fake-caret_${t}`}this._listenToIfEnabled(o.document,"arrowKey",((t,e)=>{this._handleArrowKeyPress(t,e)}),{context:[p_,"$text"],priority:"high"}),this._listenToIfEnabled(n,"change:range",((e,n)=>{n.directChange&&t.model.change((t=>{t.removeSelectionAttribute(x_)}))})),this._listenToIfEnabled(e.document,"change:data",(()=>{const e=n.getSelectedElement();if(e){if(E_(t.editing.mapper.toViewElement(e),e,i))return}t.model.change((t=>{t.removeSelectionAttribute(x_)}))})),this._listenToIfEnabled(t.editing.downcastDispatcher,"selection",((t,e,n)=>{const o=n.writer;if(this._currentFakeCaretModelElement){const t=n.mapper.toViewElement(this._currentFakeCaretModelElement);t&&(o.removeClass(T_.map(r),t),this._currentFakeCaretModelElement=null)}const s=e.selection.getSelectedElement();if(!s)return;const a=n.mapper.toViewElement(s);if(!E_(a,s,i))return;const c=B_(e.selection);c&&(o.addClass(r(c),a),this._currentFakeCaretModelElement=s)})),this._listenToIfEnabled(t.ui.focusTracker,"change:isFocused",((e,n,i)=>{i||t.model.change((t=>{t.removeSelectionAttribute(x_)}))}))}_handleArrowKeyPress(t,e){const n=this.editor,i=n.model,o=i.document.selection,r=i.schema,s=n.editing.view,a=function(t,e){const n=Qo(t,e);return"down"===n||"right"===n}(e.keyCode,n.locale.contentLanguageDirection),c=s.document.selection.getSelectedElement();let l;E_(c,n.editing.mapper.toModelElement(c),r)?l=this._handleArrowKeyPressOnSelectedWidget(a):o.isCollapsed?l=this._handleArrowKeyPressWhenSelectionNextToAWidget(a):e.shiftKey||(l=this._handleArrowKeyPressWhenNonCollapsedSelection(a)),l&&(e.preventDefault(),t.stop())}_handleArrowKeyPressOnSelectedWidget(t){const e=this.editor.model,n=B_(e.document.selection);return e.change((e=>{if(!n)return e.setSelectionAttribute(x_,t?"after":"before"),!0;if(!(n===(t?"after":"before")))return e.removeSelectionAttribute(x_),!0;return!1}))}_handleArrowKeyPressWhenSelectionNextToAWidget(t){const e=this.editor,n=e.model,i=n.schema,o=e.plugins.get("Widget"),r=o._getObjectElementNextToSelection(t);return!!E_(e.editing.mapper.toViewElement(r),r,i)&&(n.change((e=>{o._setSelectionOverElement(r),e.setSelectionAttribute(x_,t?"before":"after")})),!0)}_handleArrowKeyPressWhenNonCollapsedSelection(t){const e=this.editor,n=e.model,i=n.schema,o=e.editing.mapper,r=n.document.selection,s=t?r.getLastPosition().nodeBefore:r.getFirstPosition().nodeAfter;return!!E_(o.toViewElement(s),s,i)&&(n.change((e=>{e.setSelection(s,"on"),e.setSelectionAttribute(x_,t?"after":"before")})),!0)}_enableInsertingParagraphsOnButtonClick(){const t=this.editor,e=t.editing.view;this._listenToIfEnabled(e.document,"mousedown",((n,i)=>{const o=i.domTarget.closest(".ck-widget__type-around__button");if(!o)return;const r=function(t){return t.classList.contains("ck-widget__type-around__button_before")?"before":"after"}(o),s=function(t,e){const n=t.closest(".ck-widget");return e.mapDomToView(n)}(o,e.domConverter),a=t.editing.mapper.toModelElement(s);this._insertParagraph(a,r),i.preventDefault(),n.stop()}))}_enableInsertingParagraphsOnEnterKeypress(){const t=this.editor,e=t.model.document.selection,n=t.editing.view;this._listenToIfEnabled(n.document,"enter",((n,i)=>{if("atTarget"!=n.eventPhase)return;const o=e.getSelectedElement(),r=t.editing.mapper.toViewElement(o),s=t.model.schema;let a;this._insertParagraphAccordingToFakeCaretPosition()?a=!0:E_(r,o,s)&&(this._insertParagraph(o,i.isSoft?"before":"after"),a=!0),a&&(i.preventDefault(),n.stop())}),{context:p_})}_enableInsertingParagraphsOnTypingKeystroke(){const t=this.editor.editing.view.document;this._listenToIfEnabled(t,"insertText",((e,n)=>{this._insertParagraphAccordingToFakeCaretPosition()&&(n.selection=t.selection)}),{priority:"high"}),Xn.isAndroid?this._listenToIfEnabled(t,"keydown",((t,e)=>{229==e.keyCode&&this._insertParagraphAccordingToFakeCaretPosition()})):this._listenToIfEnabled(t,"compositionstart",(()=>{this._insertParagraphAccordingToFakeCaretPosition()}),{priority:"high"})}_enableDeleteIntegration(){const t=this.editor,e=t.editing.view,n=t.model,i=n.schema;this._listenToIfEnabled(e.document,"delete",((e,o)=>{if("atTarget"!=e.eventPhase)return;const r=B_(n.document.selection);if(!r)return;const s=o.direction,a=n.document.selection.getSelectedElement(),c="forward"==s;if("before"===r===c)t.execute("delete",{selection:n.createSelection(a,"on")});else{const e=i.getNearestSelectionRange(n.createPositionAt(a,r),s);if(e)if(e.isCollapsed){const o=n.createSelection(e.start);if(n.modifySelection(o,{direction:s}),o.focus.isEqual(e.start)){const t=function(t,e){let n=e;for(const i of e.getAncestors({parentFirst:!0})){if(i.childCount>1||t.isLimit(i))break;n=i}return n}(i,e.start.parent);n.deleteContent(n.createSelection(t,"on"),{doNotAutoparagraph:!0})}else n.change((n=>{n.setSelection(e),t.execute(c?"deleteForward":"delete")}))}else n.change((n=>{n.setSelection(e),t.execute(c?"deleteForward":"delete")}))}o.preventDefault(),e.stop()}),{context:p_})}_enableInsertContentIntegration(){const t=this.editor,e=this.editor.model,n=e.document.selection;this._listenToIfEnabled(t.model,"insertContent",((t,[i,o])=>{if(o&&!o.is("documentSelection"))return;const r=B_(n);return r?(t.stop(),e.change((t=>{const o=n.getSelectedElement(),s=e.createPositionAt(o,r),a=t.createSelection(s),c=e.insertContent(i,a);return t.setSelection(a),c}))):void 0}),{priority:"high"})}_enableInsertObjectIntegration(){const t=this.editor,e=this.editor.model.document.selection;this._listenToIfEnabled(t.model,"insertObject",((t,n)=>{const[,i,o={}]=n;if(i&&!i.is("documentSelection"))return;const r=B_(e);r&&(o.findOptimalPosition=r,n[3]=o)}),{priority:"high"})}_enableDeleteContentIntegration(){const t=this.editor,e=this.editor.model.document.selection;this._listenToIfEnabled(t.model,"deleteContent",((t,[n])=>{if(n&&!n.is("documentSelection"))return;B_(e)&&t.stop()}),{priority:"high"})}}function R_(t){const e=t.model;return(n,i)=>{const o=i.keyCode==Go.arrowup,r=i.keyCode==Go.arrowdown,s=i.shiftKey,a=e.document.selection;if(!o&&!r)return;const c=r;if(s&&function(t,e){return!t.isCollapsed&&t.isBackward==e}(a,c))return;const l=function(t,e,n){const i=t.model;if(n){const t=e.isCollapsed?e.focus:e.getLastPosition(),n=V_(i,t,"forward");if(!n)return null;const o=i.createRange(t,n),r=L_(i.schema,o,"backward");return r?i.createRange(t,r):null}{const t=e.isCollapsed?e.focus:e.getFirstPosition(),n=V_(i,t,"backward");if(!n)return null;const o=i.createRange(n,t),r=L_(i.schema,o,"forward");return r?i.createRange(r,t):null}}(t,a,c);if(l){if(l.isCollapsed){if(a.isCollapsed)return;if(s)return}(l.isCollapsed||function(t,e,n){const i=t.model,o=t.view.domConverter;if(n){const t=i.createSelection(e.start);i.modifySelection(t),t.focus.isAtEnd||e.start.isEqual(t.focus)||(e=i.createRange(t.focus,e.end))}const r=t.mapper.toViewRange(e),s=o.viewRangeToDom(r),a=ko.getDomRangeRects(s);let c;for(const t of a)if(void 0!==c){if(Math.round(t.top)>=c)return!1;c=Math.max(c,Math.round(t.bottom))}else c=Math.round(t.bottom);return!0}(t,l,c))&&(e.change((t=>{const n=c?l.end:l.start;if(s){const i=e.createSelection(a.anchor);i.setFocus(n),t.setSelection(i)}else t.setSelection(n)})),n.stop(),i.preventDefault(),i.stopPropagation())}}}function V_(t,e,n){const i=t.schema,o=t.createRangeIn(e.root),r="forward"==n?"elementStart":"elementEnd";for(const{previousPosition:t,item:s,type:a}of o.getWalker({startPosition:e,direction:n})){if(i.isLimit(s)&&!i.isInline(s))return t;if(a==r&&i.isBlock(s))return null}return null}function L_(t,e,n){const i="backward"==n?e.end:e.start;if(t.checkChild(i,"$text"))return i;for(const{nextPosition:i}of e.getWalker({direction:n}))if(t.checkChild(i,"$text"))return i;return null}var M_=n(695),z_={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$r()(M_.A,z_);M_.A.locals;class O_ extends Lr{_previouslySelected=new Set;static get pluginName(){return"Widget"}static get requires(){return[F_,sw]}init(){const t=this.editor,e=t.editing.view,n=e.document,i=t.t;this.editor.editing.downcastDispatcher.on("selection",((e,n,i)=>{const o=i.writer,r=n.selection;if(r.isCollapsed)return;const s=r.getSelectedElement();if(!s)return;const a=t.editing.mapper.toViewElement(s);var c;p_(a)&&(i.consumable.consume(r,"selection")&&o.setSelection(o.createRangeOn(a),{fake:!0,label:(c=a,c.getCustomProperty("widgetLabel").reduce(((t,e)=>"function"==typeof e?t?t+". "+e():e():t?t+". "+e:e),""))}))})),this.editor.editing.downcastDispatcher.on("selection",((t,e,n)=>{this._clearPreviouslySelectedWidgets(n.writer);const i=n.writer,o=i.document.selection;let r=null;for(const t of o.getRanges())for(const e of t){const t=e.item;p_(t)&&!N_(t,r)&&(i.addClass(g_,t),this._previouslySelected.add(t),r=t)}}),{priority:"low"}),e.addObserver(Hh),this.listenTo(n,"mousedown",((...t)=>this._onMousedown(...t))),this.listenTo(n,"arrowKey",((...t)=>{this._handleSelectionChangeOnArrowKeyPress(...t)}),{context:[p_,"$text"]}),this.listenTo(n,"arrowKey",((...t)=>{this._preventDefaultOnArrowKeyPress(...t)}),{context:"$root"}),this.listenTo(n,"arrowKey",R_(this.editor.editing),{context:"$text"}),this.listenTo(n,"delete",((t,e)=>{this._handleDelete("forward"==e.direction)&&(e.preventDefault(),t.stop())}),{context:"$root"}),this.listenTo(n,"tab",((t,e)=>{"atTarget"==t.eventPhase&&(e.shiftKey||this._selectFirstNestedEditable()&&(e.preventDefault(),t.stop()))}),{context:p_,priority:"low"}),this.listenTo(n,"tab",((t,e)=>{e.shiftKey&&this._selectAncestorWidget()&&(e.preventDefault(),t.stop())}),{priority:"low"}),this.listenTo(n,"keydown",((t,e)=>{e.keystroke==Go.esc&&this._selectAncestorWidget()&&(e.preventDefault(),t.stop())}),{priority:"low"}),t.accessibility.addKeystrokeInfoGroup({id:"widget",label:i("Keystrokes that can be used when a widget is selected (for example: image, table, etc.)"),keystrokes:[{label:i("Move focus from an editable area back to the parent widget"),keystroke:"Esc"},{label:i("Insert a new paragraph directly after a widget"),keystroke:"Enter"},{label:i("Insert a new paragraph directly before a widget"),keystroke:"Shift+Enter"},{label:i("Move the caret to allow typing directly before a widget"),keystroke:[["arrowup"],["arrowleft"]]},{label:i("Move the caret to allow typing directly after a widget"),keystroke:[["arrowdown"],["arrowright"]]}]})}_onMousedown(t,e){const n=this.editor,i=n.editing.view,o=i.document;let r=e.target;if(!r)return;if(e.domEvent.detail>=3)return void(this._selectBlockContent(r)&&e.preventDefault());if(!p_(r)){const t=function(t){let e=t;for(;e;){if(e.is("editableElement")||p_(e))return e;e=e.parent}return null}(r);if(!t)return;if(p_(t))r=t;else{const t=function(t,e){const n=uo(e.domEvent);let i=null;i=n?t.domConverter.domRangeToView(n):t.createRange(t.createPositionAt(e.target,0));if(!i)return null;const o=i.start;if(!o.parent)return null;let r=o.parent;o.parent.is("editableElement")&&(o.isAtEnd&&o.nodeBefore?r=o.nodeBefore:o.isAtStart&&o.nodeAfter&&(r=o.nodeAfter));if(r.is("$text"))return r.parent;return r}(i,e);if(!t||!p_(t))return;r=t}}Xn.isAndroid&&e.preventDefault(),o.isFocused||i.focus();const s=n.editing.mapper.toModelElement(r);this._setSelectionOverElement(s)}_selectBlockContent(t){const e=this.editor,n=e.model,i=e.editing.mapper,o=n.schema,r=i.findMappedViewAncestor(this.editor.editing.view.createPositionAt(t,0)),s=function(t,e){for(const n of t.getAncestors({includeSelf:!0,parentFirst:!0})){if(e.checkChild(n,"$text"))return n;if(e.isLimit(n)&&!e.isObject(n))break}return null}(i.toModelElement(r),n.schema);return!!s&&(n.change((t=>{const e=o.isLimit(s)?null:function(t,e){const n=new Wc({startPosition:t});for(const{item:t}of n){if(e.isLimit(t)||!t.is("element"))return null;if(e.checkChild(t,"$text"))return t}return null}(t.createPositionAfter(s),o),n=t.createPositionAt(s,0),i=e?t.createPositionAt(e,0):t.createPositionAt(s,"end");t.setSelection(t.createRange(n,i))})),!0)}_handleSelectionChangeOnArrowKeyPress(t,e){const n=e.keyCode,i=this.editor.model,o=i.schema,r=i.document.selection,s=r.getSelectedElement(),a=Qo(n,this.editor.locale.contentLanguageDirection),c="down"==a||"right"==a,l="up"==a||"down"==a;if(s&&o.isObject(s)){const n=c?r.getLastPosition():r.getFirstPosition(),s=o.getNearestSelectionRange(n,c?"forward":"backward");return void(s&&(i.change((t=>{t.setSelection(s)})),e.preventDefault(),t.stop()))}if(!r.isCollapsed&&!e.shiftKey){const n=r.getFirstPosition(),s=r.getLastPosition(),a=n.nodeAfter,l=s.nodeBefore;return void((a&&o.isObject(a)||l&&o.isObject(l))&&(i.change((t=>{t.setSelection(c?s:n)})),e.preventDefault(),t.stop()))}if(!r.isCollapsed)return;const d=this._getObjectElementNextToSelection(c);if(d&&o.isObject(d)){if(o.isInline(d)&&l)return;this._setSelectionOverElement(d),e.preventDefault(),t.stop()}}_preventDefaultOnArrowKeyPress(t,e){const n=this.editor.model,i=n.schema,o=n.document.selection.getSelectedElement();o&&i.isObject(o)&&(e.preventDefault(),t.stop())}_handleDelete(t){const e=this.editor.model.document.selection;if(!this.editor.model.canEditAt(e))return;if(!e.isCollapsed)return;const n=this._getObjectElementNextToSelection(t);return n?(this.editor.model.change((t=>{let i=e.anchor.parent;for(;i.isEmpty;){const e=i;i=e.parent,t.remove(e)}this._setSelectionOverElement(n)})),!0):void 0}_setSelectionOverElement(t){this.editor.model.change((e=>{e.setSelection(e.createRangeOn(t))}))}_getObjectElementNextToSelection(t){const e=this.editor.model,n=e.schema,i=e.document.selection,o=e.createSelection(i);if(e.modifySelection(o,{direction:t?"forward":"backward"}),o.isEqual(i))return null;const r=t?o.focus.nodeBefore:o.focus.nodeAfter;return r&&n.isObject(r)?r:null}_clearPreviouslySelectedWidgets(t){for(const e of this._previouslySelected)t.removeClass(g_,e);this._previouslySelected.clear()}_selectFirstNestedEditable(){const t=this.editor,e=this.editor.editing.view.document;for(const n of e.selection.getFirstRange().getItems())if(n.is("editableElement")){const e=t.editing.mapper.toModelElement(n);if(!e)continue;const i=t.model.createPositionAt(e,0),o=t.model.schema.getNearestSelectionRange(i,"forward");return t.model.change((t=>{t.setSelection(o)})),!0}return!1}_selectAncestorWidget(){const t=this.editor,e=t.editing.mapper,n=t.editing.view.document.selection.getFirstPosition().parent,i=(n.is("$text")?n.parent:n).findAncestor(p_);if(!i)return!1;const o=e.toModelElement(i);return!!o&&(t.model.change((t=>{t.setSelection(o,"on")})),!0)}}function N_(t,e){return!!e&&Array.from(t.getAncestors()).includes(e)}class H_ extends Lr{_toolbarDefinitions=new Map;_balloon;static get requires(){return[yk]}static get pluginName(){return"WidgetToolbarRepository"}init(){const t=this.editor;if(t.plugins.has("BalloonToolbar")){const e=t.plugins.get("BalloonToolbar");this.listenTo(e,"show",(e=>{(function(t){const e=t.getSelectedElement();return!(!e||!p_(e))})(t.editing.view.document.selection)&&e.stop()}),{priority:"high"})}this._balloon=this.editor.plugins.get("ContextualBalloon"),this.on("change:isEnabled",(()=>{this._updateToolbarsVisibility()})),this.listenTo(t.ui,"update",(()=>{this._updateToolbarsVisibility()})),this.listenTo(t.ui.focusTracker,"change:isFocused",(()=>{this._updateToolbarsVisibility()}),{priority:"low"})}destroy(){super.destroy();for(const t of this._toolbarDefinitions.values())t.view.destroy()}register(t,{ariaLabel:e,items:n,getRelatedElement:i,balloonClassName:o="ck-toolbar-container"}){if(!n.length)return void wi("widget-toolbar-no-items",{toolbarId:t});const r=this.editor,s=r.t,a=new kp(r.locale);if(a.ariaLabel=e||s("Widget toolbar"),this._toolbarDefinitions.has(t))throw new bi("widget-toolbar-duplicated",this,{toolbarId:t});const c={view:a,getRelatedElement:i,balloonClassName:o,itemsConfig:n,initialized:!1};r.ui.addToolbar(a,{isContextual:!0,beforeFocus:()=>{const t=i(r.editing.view.document.selection);t&&this._showToolbar(c,t)},afterBlur:()=>{this._hideToolbar(c)}}),this._toolbarDefinitions.set(t,c)}_updateToolbarsVisibility(){let t=0,e=null,n=null;for(const i of this._toolbarDefinitions.values()){const o=i.getRelatedElement(this.editor.editing.view.document.selection);if(this.isEnabled&&o)if(this.editor.ui.focusTracker.isFocused){const r=o.getAncestors().length;r>t&&(t=r,e=o,n=i)}else this._isToolbarVisible(i)&&this._hideToolbar(i);else this._isToolbarInBalloon(i)&&this._hideToolbar(i)}n&&this._showToolbar(n,e)}_hideToolbar(t){this._balloon.remove(t.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(t,e){this._isToolbarVisible(t)?j_(this.editor,e):this._isToolbarInBalloon(t)||(t.initialized||(t.initialized=!0,t.view.fillFromConfig(t.itemsConfig,this.editor.ui.componentFactory)),this._balloon.add({view:t.view,position:q_(this.editor,e),balloonClassName:t.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",(()=>{for(const t of this._toolbarDefinitions.values())if(this._isToolbarVisible(t)){const e=t.getRelatedElement(this.editor.editing.view.document.selection);j_(this.editor,e)}})))}_isToolbarVisible(t){return this._balloon.visibleView===t.view}_isToolbarInBalloon(t){return this._balloon.hasView(t.view)}}function j_(t,e){const n=t.plugins.get("ContextualBalloon"),i=q_(t,e);n.updatePosition(i)}function q_(t,e){const n=t.editing.view,i=rp.defaultPositions;return{target:n.domConverter.mapViewToDom(e),positions:[i.northArrowSouth,i.northArrowSouthWest,i.northArrowSouthEast,i.southArrowNorth,i.southArrowNorthWest,i.southArrowNorthEast,i.viewportStickyNorth]}}class W_ extends(ji()){_referenceCoordinates;_options;_originalWidth;_originalHeight;_originalWidthPercents;_aspectRatio;constructor(t){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=t,this._referenceCoordinates=null}get originalWidth(){return this._originalWidth}get originalHeight(){return this._originalHeight}get originalWidthPercents(){return this._originalWidthPercents}get aspectRatio(){return this._aspectRatio}begin(t,e,n){const i=new ko(e);this.activeHandlePosition=function(t){const e=["top-left","top-right","bottom-right","bottom-left"];for(const n of e)if(t.classList.contains(U_(n)))return n}(t),this._referenceCoordinates=function(t,e){const n=new ko(t),i=e.split("-"),o={x:"right"==i[1]?n.right:n.left,y:"bottom"==i[0]?n.bottom:n.top};return o.x+=t.ownerDocument.defaultView.scrollX,o.y+=t.ownerDocument.defaultView.scrollY,o}(e,function(t){const e=t.split("-"),n={top:"bottom",bottom:"top",left:"right",right:"left"};return`${n[e[0]]}-${n[e[1]]}`}(this.activeHandlePosition)),this._originalWidth=i.width,this._originalHeight=i.height,this._aspectRatio=i.width/i.height;const o=n.style.width;o&&o.match(/^\d+(\.\d*)?%$/)?this._originalWidthPercents=parseFloat(o):this._originalWidthPercents=function(t,e=new ko(t)){const n=y_(t);return n?e.width/n*100:0}(n,i)}update(t){this.proposedWidth=t.width,this.proposedHeight=t.height,this.proposedWidthPercents=t.widthPercents,this.proposedHandleHostWidth=t.handleHostWidth,this.proposedHandleHostHeight=t.handleHostHeight}}function U_(t){return`ck-widget__resizer__handle-${t}`}class $_ extends cm{constructor(){super();const t=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-size-view",t.to("_viewPosition",(t=>t?`ck-orientation-${t}`:""))],style:{display:t.if("_isVisible","none",(t=>!t))}},children:[{text:t.to("_label")}]})}_bindToState(t,e){this.bind("_isVisible").to(e,"proposedWidth",e,"proposedHeight",((t,e)=>null!==t&&null!==e)),this.bind("_label").to(e,"proposedHandleHostWidth",e,"proposedHandleHostHeight",e,"proposedWidthPercents",((e,n,i)=>"px"===t.unit?`${e}×${n}`:`${i}%`)),this.bind("_viewPosition").to(e,"activeHandlePosition",e,"proposedHandleHostWidth",e,"proposedHandleHostHeight",((t,e,n)=>e<50||n<50?"above-center":t))}_dismiss(){this.unbind(),this._isVisible=!1}}class G_ extends(ji()){_state;_sizeView;_options;_viewResizerWrapper=null;_initialViewWidth;constructor(t){super(),this._options=t,this.set("isEnabled",!0),this.set("isSelected",!1),this.bind("isVisible").to(this,"isEnabled",this,"isSelected",((t,e)=>t&&e)),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 t=this,e=this._options.viewElement;this._options.editor.editing.view.change((n=>{const i=n.createUIElement("div",{class:"ck ck-reset_all ck-widget__resizer"},(function(e){const n=this.toDomElement(e);return t._appendHandles(n),t._appendSizeUI(n),n}));n.insert(n.createPositionAt(e,"end"),i),n.addClass("ck-widget_with-resizer",e),this._viewResizerWrapper=i,this.isVisible||this.hide()})),this.on("change:isVisible",(()=>{this.isVisible?(this.show(),this.redraw()):this.hide()}))}begin(t){this._state=new W_(this._options),this._sizeView._bindToState(this._options,this.state),this._initialViewWidth=this._options.viewElement.getStyle("width"),this.state.begin(t,this._getHandleHost(),this._getResizeHost())}updateSize(t){const e=this._proposeNewSize(t);this._options.editor.editing.view.change((t=>{const n=this._options.unit||"%",i=("%"===n?e.widthPercents:e.width)+n;t.setStyle("width",i,this._options.viewElement)}));const n=this._getHandleHost(),i=new ko(n),o=Math.round(i.width),r=Math.round(i.height),s=new ko(n);e.width=Math.round(s.width),e.height=Math.round(s.height),this.redraw(i),this.state.update({...e,handleHostWidth:o,handleHostHeight:r})}commit(){const t=this._options.unit||"%",e=("%"===t?this.state.proposedWidthPercents:this.state.proposedWidth)+t;this._options.editor.editing.view.change((()=>{this._cleanup(),this._options.onCommit(e)}))}cancel(){this._cleanup()}destroy(){this.cancel()}redraw(t){const e=this._domResizerWrapper;if(!((n=e)&&n.ownerDocument&&n.ownerDocument.contains(n)))return;var n;const i=e.parentElement,o=this._getHandleHost(),r=this._viewResizerWrapper,s=[r.getStyle("width"),r.getStyle("height"),r.getStyle("left"),r.getStyle("top")];let a;if(i.isSameNode(o)){const e=t||new ko(o);a=[e.width+"px",e.height+"px",void 0,void 0]}else a=[o.offsetWidth+"px",o.offsetHeight+"px",o.offsetLeft+"px",o.offsetTop+"px"];"same"!==Zi(s,a)&&this._options.editor.editing.view.change((t=>{t.setStyle({width:a[0],height:a[1],left:a[2],top:a[3]},r)}))}containsHandle(t){return this._domResizerWrapper.contains(t)}static isResizeHandle(t){return t.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(t){const e=this.state,n={x:(i=t).pageX,y:i.pageY};var i;const o=!this._options.isCentered||this._options.isCentered(this),r={x:e._referenceCoordinates.x-(n.x+e.originalWidth),y:n.y-e.originalHeight-e._referenceCoordinates.y};o&&e.activeHandlePosition.endsWith("-right")&&(r.x=n.x-(e._referenceCoordinates.x+e.originalWidth)),o&&(r.x*=2);let s=Math.abs(e.originalWidth+r.x),a=Math.abs(e.originalHeight+r.y);return"width"==(s/e.aspectRatio>a?"width":"height")?a=s/e.aspectRatio:s=a*e.aspectRatio,{width:Math.round(s),height:Math.round(a),widthPercents:Math.min(Math.round(e.originalWidthPercents/e.originalWidth*s*100)/100,100)}}_getResizeHost(){const t=this._domResizerWrapper.parentElement;return this._options.getResizeHost(t)}_getHandleHost(){const t=this._domResizerWrapper.parentElement;return this._options.getHandleHost(t)}get _domResizerWrapper(){return this._options.editor.editing.view.domConverter.mapViewToDom(this._viewResizerWrapper)}_appendHandles(t){const e=["top-left","top-right","bottom-right","bottom-left"];for(const i of e)t.appendChild(new Ou({tag:"div",attributes:{class:"ck-widget__resizer__handle "+(n=i,`ck-widget__resizer__handle-${n}`)}}).render());var n}_appendSizeUI(t){this._sizeView=new $_,this._sizeView.render(),t.appendChild(this._sizeView.element)}}var K_=n(4095),Z_={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$r()(K_.A,Z_);K_.A.locals;class Y_ extends Lr{_resizers=new Map;_observer;_redrawSelectedResizerThrottled;static get pluginName(){return"WidgetResize"}init(){const t=this.editor.editing,e=Yn.window.document;this.set("selectedResizer",null),this.set("_activeResizer",null),t.view.addObserver(Hh),this._observer=new(ro()),this.listenTo(t.view.document,"mousedown",this._mouseDownListener.bind(this),{priority:"high"}),this._observer.listenTo(e,"mousemove",this._mouseMoveListener.bind(this)),this._observer.listenTo(e,"mouseup",this._mouseUpListener.bind(this)),this._redrawSelectedResizerThrottled=V((()=>this.redrawSelectedResizer()),200),this.editor.ui.on("update",this._redrawSelectedResizerThrottled),this.editor.model.document.on("change",(()=>{for(const[t,e]of this._resizers)t.isAttached()||(this._resizers.delete(t),e.destroy())}),{priority:"lowest"}),this._observer.listenTo(Yn.window,"resize",this._redrawSelectedResizerThrottled);const n=this.editor.editing.view.document.selection;n.on("change",(()=>{const t=n.getSelectedElement(),e=this.getResizerByViewElement(t)||null;e?this.select(e):this.deselect()}))}redrawSelectedResizer(){this.selectedResizer&&this.selectedResizer.isVisible&&this.selectedResizer.redraw()}destroy(){super.destroy(),this._observer.stopListening();for(const t of this._resizers.values())t.destroy();this._redrawSelectedResizerThrottled.cancel()}select(t){this.deselect(),this.selectedResizer=t,this.selectedResizer.isSelected=!0}deselect(){this.selectedResizer&&(this.selectedResizer.isSelected=!1),this.selectedResizer=null}attachTo(t){const e=new G_(t),n=this.editor.plugins;if(e.attach(),n.has("WidgetToolbarRepository")){const t=n.get("WidgetToolbarRepository");e.on("begin",(()=>{t.forceDisabled("resize")}),{priority:"lowest"}),e.on("cancel",(()=>{t.clearForceDisabled("resize")}),{priority:"highest"}),e.on("commit",(()=>{t.clearForceDisabled("resize")}),{priority:"highest"})}this._resizers.set(t.viewElement,e);const i=this.editor.editing.view.document.selection.getSelectedElement();return this.getResizerByViewElement(i)==e&&this.select(e),e}getResizerByViewElement(t){return this._resizers.get(t)}_getResizerByHandle(t){for(const e of this._resizers.values())if(e.containsHandle(t))return e}_mouseDownListener(t,e){const n=e.domTarget;G_.isResizeHandle(n)&&(this._activeResizer=this._getResizerByHandle(n)||null,this._activeResizer&&(this._activeResizer.begin(n),t.stop(),e.preventDefault()))}_mouseMoveListener(t,e){this._activeResizer&&this._activeResizer.updateSize(e)}_mouseUpListener(){this._activeResizer&&(this._activeResizer.commit(),this._activeResizer=null)}}const J_=yo("px");class Q_ extends cm{constructor(){super();const t=this.bindTemplate;this.set({isVisible:!1,left:null,top:null,width:null}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-clipboard-drop-target-line",t.if("isVisible","ck-hidden",(t=>!t))],style:{left:t.to("left",(t=>J_(t))),top:t.to("top",(t=>J_(t))),width:t.to("width",(t=>J_(t)))}}})}}class X_ extends Lr{removeDropMarkerDelayed=Tr((()=>this.removeDropMarker()),40);_updateDropMarkerThrottled=V((t=>this._updateDropMarker(t)),40);_reconvertMarkerThrottled=V((()=>{this.editor.model.markers.has("drop-target")&&this.editor.editing.reconvertMarker("drop-target")}),0);_dropTargetLineView=new Q_;_domEmitter=new(ro());_scrollables=new Map;static get pluginName(){return"DragDropTarget"}init(){this._setupDropMarker()}destroy(){this._domEmitter.stopListening();for(const{resizeObserver:t}of this._scrollables.values())t.destroy();return this._updateDropMarkerThrottled.cancel(),this.removeDropMarkerDelayed.cancel(),this._reconvertMarkerThrottled.cancel(),super.destroy()}updateDropMarker(t,e,n,i,o,r){this.removeDropMarkerDelayed.cancel();const s=tC(this.editor,t,e,n,i,o,r);if(s)return r&&r.containsRange(s)?this.removeDropMarker():void this._updateDropMarkerThrottled(s)}getFinalDropRange(t,e,n,i,o,r){const s=tC(this.editor,t,e,n,i,o,r);return this.removeDropMarker(),s}removeDropMarker(){const t=this.editor.model;this.removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),this._dropTargetLineView.isVisible=!1,t.markers.has("drop-target")&&t.change((t=>{t.removeMarker("drop-target")}))}_setupDropMarker(){const t=this.editor;t.ui.view.body.add(this._dropTargetLineView),t.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),t.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(e,{writer:n})=>{if(t.model.schema.checkChild(e.markerRange.start,"$text"))return this._dropTargetLineView.isVisible=!1,this._createDropTargetPosition(n);e.markerRange.isCollapsed?this._updateDropTargetLine(e.markerRange):this._dropTargetLineView.isVisible=!1}})}_updateDropMarker(t){const e=this.editor,n=e.model.markers;e.model.change((e=>{n.has("drop-target")?n.get("drop-target").getRange().isEqual(t)||e.updateMarker("drop-target",{range:t}):e.addMarker("drop-target",{range:t,usingOperation:!1,affectsData:!1})}))}_createDropTargetPosition(t){return t.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},(function(t){const e=this.toDomElement(t);return e.append("",t.createElement("span"),""),e}))}_updateDropTargetLine(t){const e=this.editor.editing,n=t.start.nodeBefore,i=t.start.nodeAfter,o=t.start.parent,r=n?e.mapper.toViewElement(n):null,s=r?e.view.domConverter.mapViewToDom(r):null,a=i?e.mapper.toViewElement(i):null,c=a?e.view.domConverter.mapViewToDom(a):null,l=e.mapper.toViewElement(o);if(!l)return;const d=e.view.domConverter.mapViewToDom(l),h=this._getScrollableRect(l),{scrollX:u,scrollY:m}=Yn.window,g=s?new ko(s):null,p=c?new ko(c):null,f=new ko(d).excludeScrollbarsAndBorders(),k=g?g.bottom:f.top,b=p?p.top:f.bottom,w=Yn.window.getComputedStyle(d),A=k<=b?(k+b)/2:b;if(h.topa.schema.checkChild(r,t)))){if(a.schema.checkChild(r,"$text"))return a.createRange(r);if(e)return nC(t,oC(t,e.parent),i,o)}}}else if(a.schema.isInline(l))return nC(t,l,i,o);if(a.schema.isBlock(l))return nC(t,l,i,o);if(a.schema.checkChild(l,"$block")){const e=Array.from(l.getChildren()).filter((e=>e.is("element")&&!eC(t,e)));let n=0,r=e.length;if(0==r)return a.createRange(a.createPositionAt(l,"end"));for(;n{n?(this.forceDisabled("readOnlyMode"),this._isBlockDragging=!1):this.clearForceDisabled("readOnlyMode")})),Xn.isAndroid&&this.forceDisabled("noAndroidSupport"),t.plugins.has("BlockToolbar")){const e=t.plugins.get("BlockToolbar").buttonView.element;this._domEmitter.listenTo(e,"dragstart",((t,e)=>this._handleBlockDragStart(e))),this._domEmitter.listenTo(Yn.document,"dragover",((t,e)=>this._handleBlockDragging(e))),this._domEmitter.listenTo(Yn.document,"drop",((t,e)=>this._handleBlockDragging(e))),this._domEmitter.listenTo(Yn.document,"dragend",(()=>this._handleBlockDragEnd()),{useCapture:!0}),this.isEnabled&&e.setAttribute("draggable","true"),this.on("change:isEnabled",((t,n,i)=>{e.setAttribute("draggable",i?"true":"false")}))}}destroy(){return this._domEmitter.stopListening(),super.destroy()}_handleBlockDragStart(t){if(!this.isEnabled)return;const e=this.editor.model,n=e.document.selection,i=this.editor.editing.view,o=Array.from(n.getSelectedBlocks()),r=e.createRange(e.createPositionBefore(o[0]),e.createPositionAfter(o[o.length-1]));e.change((t=>t.setSelection(r))),this._isBlockDragging=!0,i.focus(),i.getObserver(HA).onDomEvent(t)}_handleBlockDragging(t){if(!this.isEnabled||!this._isBlockDragging)return;const e=t.clientX+("ltr"==this.editor.locale.contentLanguageDirection?100:-100),n=t.clientY,i=document.elementFromPoint(e,n),o=this.editor.editing.view;i&&i.closest(".ck-editor__editable")&&o.getObserver(HA).onDomEvent({...t,type:t.type,dataTransfer:t.dataTransfer,target:i,clientX:e,clientY:n,preventDefault:()=>t.preventDefault(),stopPropagation:()=>t.stopPropagation()})}_handleBlockDragEnd(){this._isBlockDragging=!1}}var sC=n(7793),aC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$r()(sC.A,aC);sC.A.locals;class cC extends Lr{_draggedRange;_draggingUid;_draggableElement;_clearDraggableAttributesDelayed=Tr((()=>this._clearDraggableAttributes()),40);_blockMode=!1;_domEmitter=new(ro());_previewContainer;static get pluginName(){return"DragDrop"}static get requires(){return[c_,O_,X_,rC]}init(){const t=this.editor,e=t.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,e.addObserver(HA),e.addObserver(Hh),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDraggableAttributeHandling(),this.listenTo(t,"change:isReadOnly",((t,e,n)=>{n?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")})),this.on("change:isEnabled",((t,e,n)=>{n||this._finalizeDragging(!1)})),Xn.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._previewContainer&&this._previewContainer.remove(),this._domEmitter.stopListening(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const t=this.editor,e=t.model,n=t.editing.view,i=n.document,o=t.plugins.get(X_);this.listenTo(i,"dragstart",((t,n)=>{if(n.target&&n.target.is("editableElement"))return void n.preventDefault();if(this._prepareDraggedRange(n.target),!this._draggedRange)return void n.preventDefault();this._draggingUid=pi(),n.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",n.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const i=e.createSelection(this._draggedRange.toRange());this.editor.plugins.get("ClipboardPipeline")._fireOutputTransformationEvent(n.dataTransfer,i,"dragstart");const{dataTransfer:o,domTarget:r,domEvent:s}=n,{clientX:a}=s;this._updatePreview({dataTransfer:o,domTarget:r,clientX:a}),n.stopPropagation(),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")}),{priority:"low"}),this.listenTo(i,"dragend",((t,e)=>{this._finalizeDragging(!e.dataTransfer.isCanceled&&"move"==e.dataTransfer.dropEffect)}),{priority:"low"}),this._domEmitter.listenTo(Yn.document,"dragend",(()=>{this._blockMode=!1}),{useCapture:!0}),this.listenTo(i,"dragenter",(()=>{this.isEnabled&&n.focus()})),this.listenTo(i,"dragleave",(()=>{o.removeDropMarkerDelayed()})),this.listenTo(i,"dragging",((t,e)=>{if(!this.isEnabled)return void(e.dataTransfer.dropEffect="none");const{clientX:n,clientY:i}=e.domEvent;o.updateDropMarker(e.target,e.targetRanges,n,i,this._blockMode,this._draggedRange),this._draggedRange||(e.dataTransfer.dropEffect="copy"),Xn.isGecko||("copy"==e.dataTransfer.effectAllowed?e.dataTransfer.dropEffect="copy":["all","copyMove"].includes(e.dataTransfer.effectAllowed)&&(e.dataTransfer.dropEffect="move")),t.stop()}),{priority:"low"})}_setupClipboardInputIntegration(){const t=this.editor,e=t.editing.view.document,n=t.plugins.get(X_);this.listenTo(e,"clipboardInput",((e,i)=>{if("drop"!=i.method)return;const{clientX:o,clientY:r}=i.domEvent,s=n.getFinalDropRange(i.target,i.targetRanges,o,r,this._blockMode,this._draggedRange);if(!s)return this._finalizeDragging(!1),void e.stop();this._draggedRange&&this._draggingUid!=i.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="");if("move"==lC(i.dataTransfer)&&this._draggedRange&&this._draggedRange.containsRange(s,!0))return this._finalizeDragging(!1),void e.stop();i.targetRanges=[t.editing.mapper.toViewRange(s)]}),{priority:"high"})}_setupContentInsertionIntegration(){const t=this.editor.plugins.get(c_);t.on("contentInsertion",((t,e)=>{if(!this.isEnabled||"drop"!==e.method)return;const n=e.targetRanges.map((t=>this.editor.editing.mapper.toModelRange(t)));this.editor.model.change((t=>t.setSelection(n)))}),{priority:"high"}),t.on("contentInsertion",((t,e)=>{if(!this.isEnabled||"drop"!==e.method)return;const n="move"==lC(e.dataTransfer),i=!e.resultRange||!e.resultRange.isCollapsed;this._finalizeDragging(i&&n)}),{priority:"lowest"})}_setupDraggableAttributeHandling(){const t=this.editor,e=t.editing.view,n=e.document;this.listenTo(n,"mousedown",((i,o)=>{if(Xn.isAndroid||!o)return;this._clearDraggableAttributesDelayed.cancel();let r=dC(o.target);if(Xn.isBlink&&!t.isReadOnly&&!r&&!n.selection.isCollapsed){const t=n.selection.getSelectedElement();t&&p_(t)||(r=n.selection.editableElement)}r&&(e.change((t=>{t.setAttribute("draggable","true",r)})),this._draggableElement=t.editing.mapper.toModelElement(r))})),this.listenTo(n,"mouseup",(()=>{Xn.isAndroid||this._clearDraggableAttributesDelayed()}))}_clearDraggableAttributes(){const t=this.editor.editing;t.view.change((e=>{this._draggableElement&&"$graveyard"!=this._draggableElement.root.rootName&&e.removeAttribute("draggable",t.mapper.toViewElement(this._draggableElement)),this._draggableElement=null}))}_finalizeDragging(t){const e=this.editor,n=e.model;if(e.plugins.get(X_).removeDropMarker(),this._clearDraggableAttributes(),e.plugins.has("WidgetToolbarRepository")){e.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop")}this._draggingUid="",this._previewContainer&&(this._previewContainer.remove(),this._previewContainer=void 0),this._draggedRange&&(t&&this.isEnabled&&n.change((t=>{const e=n.createSelection(this._draggedRange);n.deleteContent(e,{doNotAutoparagraph:!0});const i=e.getFirstPosition().parent;i.isEmpty&&!n.schema.checkChild(i,"$text")&&n.schema.checkChild(i,"paragraph")&&t.insertElement("paragraph",i,0)})),this._draggedRange.detach(),this._draggedRange=null)}_prepareDraggedRange(t){const e=this.editor,n=e.model,i=n.document.selection,o=t?dC(t):null;if(o){const t=e.editing.mapper.toModelElement(o);if(this._draggedRange=ul.fromRange(n.createRangeOn(t)),this._blockMode=n.schema.isBlock(t),e.plugins.has("WidgetToolbarRepository")){e.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop")}return}if(i.isCollapsed&&!i.getFirstPosition().parent.isEmpty)return;const r=Array.from(i.getSelectedBlocks()),s=i.getFirstRange();if(0==r.length)return void(this._draggedRange=ul.fromRange(s));const a=hC(n,r);if(r.length>1)this._draggedRange=ul.fromRange(a),this._blockMode=!0;else if(1==r.length){const t=s.start.isTouching(a.start)&&s.end.isTouching(a.end);this._draggedRange=ul.fromRange(t?a:s),this._blockMode=t}n.change((t=>t.setSelection(this._draggedRange.toRange())))}_updatePreview({dataTransfer:t,domTarget:e,clientX:n}){const i=this.editor.editing.view,o=i.document.selection.editableElement,r=i.domConverter.mapViewToDom(o),s=Yn.window.getComputedStyle(r);this._previewContainer?this._previewContainer.firstElementChild&&this._previewContainer.removeChild(this._previewContainer.firstElementChild):(this._previewContainer=Qi(Yn.document,"div",{style:"position: fixed; left: -999999px;"}),Yn.document.body.appendChild(this._previewContainer));const a=new ko(r);if(r.contains(e))return;const c=parseFloat(s.paddingLeft),l=Qi(Yn.document,"div");l.className="ck ck-content",l.style.width=s.width,l.style.paddingLeft=`${a.left-n+c}px`,Xn.isiOS&&(l.style.backgroundColor="white"),i.domConverter.setContentOf(l,t.getData("text/html")),t.setDragImage(l,0,0),this._previewContainer.appendChild(l)}}function lC(t){return Xn.isGecko?t.dropEffect:["all","copyMove"].includes(t.effectAllowed)?"move":"copy"}function dC(t){if(t.is("editableElement"))return null;if(t.hasClass("ck-widget__selection-handle"))return t.findAncestor(p_);if(p_(t))return t;const e=t.findAncestor((t=>p_(t)||t.is("editableElement")));return p_(e)?e:null}function hC(t,e){const n=e[0],i=e[e.length-1],o=n.getCommonAncestor(i),r=t.createPositionBefore(n),s=t.createPositionAfter(i);if(o&&o.is("element")&&!t.schema.isLimit(o)){const e=t.createRangeOn(o),n=r.isTouching(e.start),i=s.isTouching(e.end);if(n&&i)return hC(t,[o])}return t.createRange(r,s)}class uC extends Lr{static get pluginName(){return"PastePlainText"}static get requires(){return[c_]}init(){const t=this.editor,e=t.model,n=t.editing.view,i=e.document.selection;n.addObserver(HA),t.plugins.get(c_).on("contentInsertion",((t,n)=>{(function(t,e){let n=e.createRangeIn(t);if(1==t.childCount){const i=t.getChild(0);i.is("element")&&e.schema.isBlock(i)&&!e.schema.isObject(i)&&!e.schema.isLimit(i)&&(n=e.createRangeIn(i))}for(const t of n.getItems()){if(!e.schema.isInline(t))return!1;if(Array.from(t.getAttributeKeys()).find((t=>e.schema.getAttributeProperties(t).isFormatting)))return!1}return!0})(n.content,e)&&e.change((t=>{const o=Array.from(i.getAttributes()).filter((([t])=>e.schema.getAttributeProperties(t).isFormatting));i.isCollapsed||e.deleteContent(i,{doNotAutoparagraph:!0}),o.push(...i.getAttributes());const r=t.createRangeIn(n.content);for(const n of r.getItems())for(const i of o)e.schema.checkAttribute(n,i[0])&&t.setAttribute(i[0],i[1],n)}))}))}}class mC extends Lr{static get pluginName(){return"Clipboard"}static get requires(){return[a_,c_,cC,uC]}init(){const t=this.editor,e=this.editor.t;t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Copy selected content"),keystroke:"CTRL+C"},{label:e("Paste content"),keystroke:"CTRL+V"},{label:e("Paste content as plain text"),keystroke:"CTRL+SHIFT+V"}]})}}class gC extends zr{_stack=[];_createdBatches=new WeakSet;constructor(t){super(t),this.refresh(),this._isEnabledBasedOnSelection=!1,this.listenTo(t.data,"set",((t,e)=>{e[1]={...e[1]};const n=e[1];n.batchType||(n.batchType={isUndoable:!1})}),{priority:"high"}),this.listenTo(t.data,"set",((t,e)=>{e[1].batchType.isUndoable||this.clearStack()}))}refresh(){this.isEnabled=this._stack.length>0}get createdBatches(){return this._createdBatches}addBatch(t){const e=this.editor.model.document.selection,n={ranges:e.hasOwnRange?Array.from(e.getRanges()):[],isBackward:e.isBackward};this._stack.push({batch:t,selection:n}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(t,e,n){const i=this.editor.model,o=i.document,r=[],s=t.map((t=>t.getTransformedByOperations(n))),a=s.flat();for(const t of s){const e=t.filter((t=>t.root!=o.graveyard)).filter((t=>!fC(t,a)));e.length&&(pC(e),r.push(e[0]))}r.length&&i.change((t=>{t.setSelection(r,{backward:e})}))}_undo(t,e){const n=this.editor.model,i=n.document;this._createdBatches.add(e);const o=t.operations.slice().filter((t=>t.isDocumentOperation));o.reverse();for(const t of o){const o=t.baseVersion+1,r=Array.from(i.history.getOperations(o)),s=Gd([t.getReversed()],r,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(let o of s){const r=o.affectedSelectable;r&&!n.canEditAt(r)&&(o=new Md(o.baseVersion)),e.addOperation(o),n.applyOperation(o),i.history.setOperationAsUndone(t,o)}}}}function pC(t){t.sort(((t,e)=>t.start.isBefore(e.start)?-1:1));for(let e=1;ee!==t&&e.containsRange(t,!0)))}class kC extends gC{execute(t=null){const e=t?this._stack.findIndex((e=>e.batch==t)):this._stack.length-1,n=this._stack.splice(e,1)[0],i=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(i,(()=>{this._undo(n.batch,i);const t=this.editor.model.document.history.getOperations(n.batch.baseVersion);this._restoreSelection(n.selection.ranges,n.selection.isBackward,t)})),this.fire("revert",n.batch,i),this.refresh()}}class bC extends gC{execute(){const t=this._stack.pop(),e=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(e,(()=>{const n=t.batch.operations[t.batch.operations.length-1].baseVersion+1,i=this.editor.model.document.history.getOperations(n);this._restoreSelection(t.selection.ranges,t.selection.isBackward,i),this._undo(t.batch,e)})),this.refresh()}}class wC extends Lr{_undoCommand;_redoCommand;_batchRegistry=new WeakSet;static get pluginName(){return"UndoEditing"}init(){const t=this.editor,e=t.t;this._undoCommand=new kC(t),this._redoCommand=new bC(t),t.commands.add("undo",this._undoCommand),t.commands.add("redo",this._redoCommand),this.listenTo(t.model,"applyOperation",((t,e)=>{const n=e[0];if(!n.isDocumentOperation)return;const i=n.batch,o=this._redoCommand.createdBatches.has(i),r=this._undoCommand.createdBatches.has(i);this._batchRegistry.has(i)||(this._batchRegistry.add(i),i.isUndoable&&(o?this._undoCommand.addBatch(i):r||(this._undoCommand.addBatch(i),this._redoCommand.clearStack())))}),{priority:"highest"}),this.listenTo(this._undoCommand,"revert",((t,e,n)=>{this._redoCommand.addBatch(n)})),t.keystrokes.set("CTRL+Z","undo"),t.keystrokes.set("CTRL+Y","redo"),t.keystrokes.set("CTRL+SHIFT+Z","redo"),t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Undo"),keystroke:"CTRL+Z"},{label:e("Redo"),keystroke:[["CTRL+Y"],["CTRL+SHIFT+Z"]]}]})}}class AC extends Lr{static get pluginName(){return"UndoUI"}init(){const t=this.editor,e=t.locale,n=t.t,i="ltr"==e.uiLanguageDirection?Mu.undo:Mu.redo,o="ltr"==e.uiLanguageDirection?Mu.redo:Mu.undo;this._addButtonsToFactory("undo",n("Undo"),"CTRL+Z",i),this._addButtonsToFactory("redo",n("Redo"),"CTRL+Y",o)}_addButtonsToFactory(t,e,n,i){const o=this.editor;o.ui.componentFactory.add(t,(()=>{const o=this._createButton(wm,t,e,n,i);return o.set({tooltip:!0}),o})),o.ui.componentFactory.add("menuBar:"+t,(()=>this._createButton(Ym,t,e,n,i)))}_createButton(t,e,n,i,o){const r=this.editor,s=r.locale,a=r.commands.get(e),c=new t(s);return c.set({label:n,icon:o,keystroke:i}),c.bind("isEnabled").to(a,"isEnabled"),this.listenTo(c,"execute",(()=>{r.execute(e),r.editing.view.focus()})),c}}class _C extends Lr{static get requires(){return[wC,AC]}static get pluginName(){return"Undo"}}function CC(t){return t.createContainerElement("figure",{class:"image"},[t.createEmptyElement("img"),t.createSlot("children")])}function vC(t,e){const n=t.plugins.get("ImageUtils"),i=t.plugins.has("ImageInlineEditing")&&t.plugins.has("ImageBlockEditing");return t=>{if(!n.isInlineImageView(t))return null;if(!i)return o(t);return("block"==t.getStyle("display")||t.findAncestor(n.isBlockImageView)?"imageBlock":"imageInline")!==e?null:o(t)};function o(t){const e={name:!0};return t.hasAttribute("src")&&(e.attributes=["src"]),e}}function yC(t,e){const n=Er(e.getSelectedBlocks());return!n||t.isObject(n)||n.isEmpty&&"listItem"!=n.name?"imageBlock":"imageInline"}function xC(t){return t&&t.endsWith("px")?parseInt(t):null}function EC(t){const e=xC(t.getStyle("width")),n=xC(t.getStyle("height"));return!(!e||!n)}const BC=/^(image|image-inline)$/;class DC extends Lr{_domEmitter=new(ro());static get pluginName(){return"ImageUtils"}isImage(t){return this.isInlineImage(t)||this.isBlockImage(t)}isInlineImageView(t){return!!t&&t.is("element","img")}isBlockImageView(t){return!!t&&t.is("element","figure")&&t.hasClass("image")}insertImage(t={},e=null,n=null,i={}){const o=this.editor,r=o.model,s=r.document.selection,a=SC(o,e||s,n);t={...Object.fromEntries(s.getAttributes()),...t};for(const e in t)r.schema.checkAttribute(a,e)||delete t[e];return r.change((n=>{const{setImageSizes:o=!0}=i,s=n.createElement(a,t);return r.insertObject(s,e,null,{setSelection:"on",findOptimalPosition:e||"imageInline"==a?void 0:"auto"}),s.parent?(o&&this.setImageNaturalSizeAttributes(s),s):null}))}setImageNaturalSizeAttributes(t){const e=t.getAttribute("src");e&&(t.getAttribute("width")||t.getAttribute("height")||this.editor.model.change((n=>{const i=new Yn.window.Image;this._domEmitter.listenTo(i,"load",(()=>{t.getAttribute("width")||t.getAttribute("height")||this.editor.model.enqueueChange(n.batch,(e=>{e.setAttribute("width",i.naturalWidth,t),e.setAttribute("height",i.naturalHeight,t)})),this._domEmitter.stopListening(i,"load")})),i.src=e})))}getClosestSelectedImageWidget(t){const e=t.getFirstPosition();if(!e)return null;const n=t.getSelectedElement();if(n&&this.isImageWidget(n))return n;let i=e.parent;for(;i;){if(i.is("element")&&this.isImageWidget(i))return i;i=i.parent}return null}getClosestSelectedImageElement(t){const e=t.getSelectedElement();return this.isImage(e)?e:t.getFirstPosition().findAncestor("imageBlock")}getImageWidgetFromImageView(t){return t.findAncestor({classes:BC})}isImageAllowed(){const t=this.editor.model.document.selection;return function(t,e){const n=SC(t,e,null);if("imageBlock"==n){const n=function(t,e){const n=__(t,e),i=n.start.parent;if(i.isEmpty&&!i.is("element","$root"))return i.parent;return i}(e,t.model);if(t.model.schema.checkChild(n,"imageBlock"))return!0}else if(t.model.schema.checkChild(e.focus,"imageInline"))return!0;return!1}(this.editor,t)&&function(t){return[...t.focus.getAncestors()].every((t=>!t.is("element","imageBlock")))}(t)}toImageWidget(t,e,n){e.setCustomProperty("image",!0,t);return f_(t,e,{label:()=>{const e=this.findViewImgElement(t).getAttribute("alt");return e?`${e} ${n}`:n}})}isImageWidget(t){return!!t.getCustomProperty("image")&&p_(t)}isBlockImage(t){return!!t&&t.is("element","imageBlock")}isInlineImage(t){return!!t&&t.is("element","imageInline")}findViewImgElement(t){if(this.isInlineImageView(t))return t;const e=this.editor.editing.view;for(const{item:n}of e.createRangeIn(t))if(this.isInlineImageView(n))return n}destroy(){return this._domEmitter.stopListening(),super.destroy()}}function SC(t,e,n){const i=t.model.schema,o=t.config.get("image.insert.type");return t.plugins.has("ImageBlockEditing")?t.plugins.has("ImageInlineEditing")?n||("inline"===o?"imageInline":"auto"!==o?"imageBlock":e.is("selection")?yC(i,e):i.checkChild(e,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}new RegExp(String(/^(http(s)?:\/\/)?[\w-]+\.[\w.~:/[\]@!$&'()*+,;=%-]+/.source+/\.(jpg|jpeg|png|gif|ico|webp|JPG|JPEG|PNG|GIF|ICO|WEBP)/.source+/(\?[\w.~:/[\]@!$&'()*+,;=%-]*)?/.source+/(#[\w.~:/[\]@!$&'()*+,;=%-]*)?$/.source));class TC extends zr{refresh(){const t=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!t,this.isEnabled&&t.hasAttribute("alt")?this.value=t.getAttribute("alt"):this.value=!1}execute(t){const e=this.editor,n=e.plugins.get("ImageUtils"),i=e.model,o=n.getClosestSelectedImageElement(i.document.selection);i.change((e=>{e.setAttribute("alt",t.newValue,o)}))}}class IC extends Lr{static get requires(){return[DC]}static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new TC(this.editor))}}var PC=n(4062),FC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$r()(PC.A,FC);PC.A.locals;class RC extends cm{focusTracker;keystrokes;labeledInput;saveButtonView;cancelButtonView;_focusables;_focusCycler;constructor(t){super(t);const e=this.locale.t;this.focusTracker=new Br,this.keystrokes=new Dr,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(e("Save"),Mu.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(e("Cancel"),Mu.cancel,"ck-button-cancel","cancel"),this._focusables=new zu,this._focusCycler=new ym({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),hm({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach((t=>{this._focusables.add(t),this.focusTracker.add(t.element)}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(t,e,n,i){const o=new wm(this.locale);return o.set({label:t,icon:e,tooltip:!0}),o.extendTemplate({attributes:{class:n}}),i&&o.delegate("execute").to(this,i),o}_createLabeledInputView(){const t=this.locale.t,e=new Sg(this.locale,Vp);return e.label=t("Text alternative"),e}}function VC(t){const e=t.editing.view,n=rp.defaultPositions,i=t.plugins.get("ImageUtils");return{target:e.domConverter.mapViewToDom(i.getClosestSelectedImageWidget(e.document.selection)),positions:[n.northArrowSouth,n.northArrowSouthWest,n.northArrowSouthEast,n.southArrowNorth,n.southArrowNorthWest,n.southArrowNorthEast,n.viewportStickyNorth]}}class LC extends Lr{_balloon;_form;static get requires(){return[yk]}static get pluginName(){return"ImageTextAlternativeUI"}init(){this._createButton()}destroy(){super.destroy(),this._form&&this._form.destroy()}_createButton(){const t=this.editor,e=t.t;t.ui.componentFactory.add("imageTextAlternative",(n=>{const i=t.commands.get("imageTextAlternative"),o=new wm(n);return o.set({label:e("Change image text alternative"),icon:Mu.textAlternative,tooltip:!0}),o.bind("isEnabled").to(i,"isEnabled"),o.bind("isOn").to(i,"value",(t=>!!t)),this.listenTo(o,"execute",(()=>{this._showForm()})),o}))}_createForm(){const t=this.editor,e=t.editing.view.document,n=t.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(dm(RC))(t.locale),this._form.render(),this.listenTo(this._form,"submit",(()=>{t.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",((t,e)=>{this._hideForm(!0),e()})),this.listenTo(t.ui,"update",(()=>{n.getClosestSelectedImageWidget(e.selection)?this._isVisible&&function(t){const e=t.plugins.get("ContextualBalloon");if(t.plugins.get("ImageUtils").getClosestSelectedImageWidget(t.editing.view.document.selection)){const n=VC(t);e.updatePosition(n)}}(t):this._hideForm(!0)})),lm({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;this._form||this._createForm();const t=this.editor,e=t.commands.get("imageTextAlternative"),n=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:VC(t)}),n.fieldView.value=n.fieldView.element.value=e.value||"",this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(t=!1){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),t&&this.editor.editing.view.focus())}get _isVisible(){return!!this._balloon&&this._balloon.visibleView===this._form}get _isInBalloon(){return!!this._balloon&&this._balloon.hasView(this._form)}}class MC extends Lr{static get requires(){return[IC,LC]}static get pluginName(){return"ImageTextAlternative"}}function zC(t,e){const n=(e,n,i)=>{if(!i.consumable.consume(n.item,e.name))return;const o=i.writer,r=i.mapper.toViewElement(n.item),s=t.findViewImgElement(r);null===n.attributeNewValue?(o.removeAttribute("srcset",s),o.removeAttribute("sizes",s)):n.attributeNewValue&&(o.setAttribute("srcset",n.attributeNewValue,s),o.setAttribute("sizes","100vw",s))};return t=>{t.on(`attribute:srcset:${e}`,n)}}function OC(t,e,n){const i=(e,n,i)=>{if(!i.consumable.consume(n.item,e.name))return;const o=i.writer,r=i.mapper.toViewElement(n.item),s=t.findViewImgElement(r);o.setAttribute(n.attributeKey,n.attributeNewValue||"",s)};return t=>{t.on(`attribute:${n}:${e}`,i)}}class NC extends Xa{observe(t){this.listenTo(t,"load",((t,e)=>{const n=e.target;this.checkShouldIgnoreEventFromTarget(n)||"IMG"==n.tagName&&this._fireEvents(e)}),{useCapture:!0})}stopObserving(t){this.stopListening(t)}_fireEvents(t){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",t))}}class HC extends zr{constructor(t){super(t);const e=t.config.get("image.insert.type");t.plugins.has("ImageBlockEditing")||"block"===e&&wi("image-block-plugin-required"),t.plugins.has("ImageInlineEditing")||"inline"===e&&wi("image-inline-plugin-required")}refresh(){const t=this.editor.plugins.get("ImageUtils");this.isEnabled=t.isImageAllowed()}execute(t){const e=tr(t.source),n=this.editor.model.document.selection,i=this.editor.plugins.get("ImageUtils"),o=Object.fromEntries(n.getAttributes());e.forEach(((e,r)=>{const s=n.getSelectedElement();if("string"==typeof e&&(e={src:e}),r&&s&&i.isImage(s)){const n=this.editor.model.createPositionAfter(s);i.insertImage({...e,...o},n,t.imageType)}else i.insertImage({...e,...o},null,t.imageType)}))}}class jC extends zr{constructor(t){super(t),this.decorate("cleanupImage")}refresh(){const t=this.editor.plugins.get("ImageUtils"),e=this.editor.model.document.selection.getSelectedElement();this.isEnabled=t.isImage(e),this.value=this.isEnabled?e.getAttribute("src"):null}execute(t){const e=this.editor.model.document.selection.getSelectedElement(),n=this.editor.plugins.get("ImageUtils");this.editor.model.change((i=>{i.setAttribute("src",t.source,e),this.cleanupImage(i,e),n.setImageNaturalSizeAttributes(e)}))}cleanupImage(t,e){t.removeAttribute("srcset",e),t.removeAttribute("sizes",e),t.removeAttribute("sources",e),t.removeAttribute("width",e),t.removeAttribute("height",e),t.removeAttribute("alt",e)}}class qC extends Lr{static get requires(){return[DC]}static get pluginName(){return"ImageEditing"}init(){const t=this.editor,e=t.conversion;t.editing.view.addObserver(NC),e.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:"srcset"});const n=new HC(t),i=new jC(t);t.commands.add("insertImage",n),t.commands.add("replaceImageSource",i),t.commands.add("imageInsert",n)}}class WC extends Lr{static get requires(){return[DC]}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(t){const e=this.editor,n=e.plugins.get("ImageUtils"),i="imageBlock"===t?"figure":"img";function o(e,i,o,r){e.on(`attribute:${i}:${t}`,((e,i,s)=>{if(!s.consumable.consume(i.item,e.name))return;const a=s.writer,c=s.mapper.toViewElement(i.item),l=n.findViewImgElement(c);if(null!==i.attributeNewValue?a.setAttribute(o,i.attributeNewValue,l):a.removeAttribute(o,l),i.item.hasAttribute("sources"))return;const d=i.item.hasAttribute("resizedWidth");if("imageInline"===t&&!d&&!r)return;const h=i.item.getAttribute("width"),u=i.item.getAttribute("height");h&&u&&a.setStyle("aspect-ratio",`${h}/${u}`,l)}))}e.conversion.for("upcast").attributeToAttribute({view:{name:i,styles:{width:/.+/}},model:{key:"width",value:t=>EC(t)?xC(t.getStyle("width")):null}}).attributeToAttribute({view:{name:i,key:"width"},model:"width"}).attributeToAttribute({view:{name:i,styles:{height:/.+/}},model:{key:"height",value:t=>EC(t)?xC(t.getStyle("height")):null}}).attributeToAttribute({view:{name:i,key:"height"},model:"height"}),e.conversion.for("editingDowncast").add((t=>{o(t,"width","width",!0),o(t,"height","height",!0)})),e.conversion.for("dataDowncast").add((t=>{o(t,"width","width",!1),o(t,"height","height",!1)}))}}class UC extends zr{_modelElementName;constructor(t,e){super(t),this._modelElementName=e}refresh(){const t=this.editor.plugins.get("ImageUtils"),e=t.getClosestSelectedImageElement(this.editor.model.document.selection);"imageBlock"===this._modelElementName?this.isEnabled=t.isInlineImage(e):this.isEnabled=t.isBlockImage(e)}execute(t={}){const e=this.editor,n=this.editor.model,i=e.plugins.get("ImageUtils"),o=i.getClosestSelectedImageElement(n.document.selection),r=Object.fromEntries(o.getAttributes());return r.src||r.uploadId?n.change((e=>{const{setImageSizes:s=!0}=t,a=Array.from(n.markers).filter((t=>t.getRange().containsItem(o))),c=i.insertImage(r,n.createSelection(o,"on"),this._modelElementName,{setImageSizes:s});if(!c)return null;const l=e.createRangeOn(c);for(const t of a){const n=t.getRange(),i="$graveyard"!=n.root.rootName?n.getJoined(l,!0):l;e.updateMarker(t,{range:i})}return{oldElement:o,newElement:c}})):null}}var $C=n(7378),GC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$r()($C.A,GC);$C.A.locals;class KC extends Lr{static get requires(){return[DC]}static get pluginName(){return"ImagePlaceholder"}afterInit(){this._setupSchema(),this._setupConversion(),this._setupLoadListener()}_setupSchema(){const t=this.editor.model.schema;t.isRegistered("imageBlock")&&t.extend("imageBlock",{allowAttributes:["placeholder"]}),t.isRegistered("imageInline")&&t.extend("imageInline",{allowAttributes:["placeholder"]})}_setupConversion(){const t=this.editor,e=t.conversion,n=t.plugins.get("ImageUtils");e.for("editingDowncast").add((t=>{t.on("attribute:placeholder",((t,e,i)=>{if(!i.consumable.test(e.item,t.name))return;if(!e.item.is("element","imageBlock")&&!e.item.is("element","imageInline"))return;i.consumable.consume(e.item,t.name);const o=i.writer,r=i.mapper.toViewElement(e.item),s=n.findViewImgElement(r);e.attributeNewValue?(o.addClass("image_placeholder",s),o.setStyle("background-image",`url(${e.attributeNewValue})`,s),o.setCustomProperty("editingPipeline:doNotReuseOnce",!0,s)):(o.removeClass("image_placeholder",s),o.removeStyle("background-image",s))}))}))}_setupLoadListener(){const t=this.editor,e=t.model,n=t.editing,i=n.view,o=t.plugins.get("ImageUtils");i.addObserver(NC),this.listenTo(i.document,"imageLoaded",((t,r)=>{const s=i.domConverter.mapDomToView(r.target);if(!s)return;const a=o.getImageWidgetFromImageView(s);if(!a)return;const c=n.mapper.toModelElement(a);c&&c.hasAttribute("placeholder")&&e.enqueueChange({isUndoable:!1},(t=>{t.removeAttribute("placeholder",c)}))}))}}class ZC extends Lr{static get requires(){return[qC,WC,DC,KC,c_]}static get pluginName(){return"ImageBlockEditing"}init(){const t=this.editor;t.model.schema.register("imageBlock",{inheritAllFrom:"$blockObject",allowAttributes:["alt","src","srcset"]}),this._setupConversion(),t.plugins.has("ImageInlineEditing")&&(t.commands.add("imageTypeBlock",new UC(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){const t=this.editor,e=t.t,n=t.conversion,i=t.plugins.get("ImageUtils");n.for("dataDowncast").elementToStructure({model:"imageBlock",view:(t,{writer:e})=>CC(e)}),n.for("editingDowncast").elementToStructure({model:"imageBlock",view:(t,{writer:n})=>i.toImageWidget(CC(n),n,e("image widget"))}),n.for("downcast").add(OC(i,"imageBlock","src")).add(OC(i,"imageBlock","alt")).add(zC(i,"imageBlock")),n.for("upcast").elementToElement({view:vC(t,"imageBlock"),model:(t,{writer:e})=>e.createElement("imageBlock",t.hasAttribute("src")?{src:t.getAttribute("src")}:void 0)}).add(function(t){const e=(e,n,i)=>{if(!i.consumable.test(n.viewItem,{name:!0,classes:"image"}))return;const o=t.findViewImgElement(n.viewItem);if(!o||!i.consumable.test(o,{name:!0}))return;i.consumable.consume(n.viewItem,{name:!0,classes:"image"});const r=Er(i.convertItem(o,n.modelCursor).modelRange.getItems());r?(i.convertChildren(n.viewItem,r),i.updateConversionResult(r,n)):i.consumable.revert(n.viewItem,{name:!0,classes:"image"})};return t=>{t.on("element:figure",e)}}(i))}_setupClipboardIntegration(){const t=this.editor,e=t.model,n=t.editing.view,i=t.plugins.get("ImageUtils"),o=t.plugins.get("ClipboardPipeline");this.listenTo(o,"inputTransformation",((o,r)=>{const s=Array.from(r.content.getChildren());let a;if(!s.every(i.isInlineImageView))return;a=r.targetRanges?t.editing.mapper.toModelRange(r.targetRanges[0]):e.document.selection.getFirstRange();const c=e.createSelection(a);if("imageBlock"===yC(e.schema,c)){const t=new jh(n.document),e=s.map((e=>t.createElement("figure",{class:"image"},e)));r.content=t.createDocumentFragment(e)}})),this.listenTo(o,"contentInsertion",((t,n)=>{"paste"===n.method&&e.change((t=>{const e=t.createRangeIn(n.content);for(const t of e.getItems())t.is("element","imageBlock")&&i.setImageNaturalSizeAttributes(t)}))}))}}var YC=n(3350),JC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$r()(YC.A,JC);YC.A.locals;class QC extends cm{focusTracker;keystrokes;_focusables;_focusCycler;children;constructor(t,e=[]){super(t),this.focusTracker=new Br,this.keystrokes=new Dr,this._focusables=new zu,this.children=this.createCollection(),this._focusCycler=new ym({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});for(const t of e)this.children.add(t),this._focusables.add(t),t instanceof mg&&this._focusables.addMany(t.children);this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-insert-form"],tabindex:-1},children:this.children})}render(){super.render(),hm({view:this});for(const t of this._focusables)this.focusTracker.add(t.element);this.keystrokes.listenTo(this.element);const t=t=>t.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()}}class XC extends Lr{static get pluginName(){return"ImageInsertUI"}static get requires(){return[DC]}dropdownView;_integrations=new Map;constructor(t){super(t),t.config.define("image.insert.integrations",["upload","assetManager","url"])}init(){const t=this.editor,e=t.model.document.selection,n=t.plugins.get("ImageUtils");this.set("isImageSelected",!1),this.listenTo(t.model.document,"change",(()=>{this.isImageSelected=n.isImage(e.getSelectedElement())}));const i=t=>this._createToolbarComponent(t);t.ui.componentFactory.add("insertImage",i),t.ui.componentFactory.add("imageInsert",i),t.ui.componentFactory.add("menuBar:insertImage",(t=>this._createMenuBarComponent(t)))}registerIntegration({name:t,observable:e,buttonViewCreator:n,formViewCreator:i,menuBarButtonViewCreator:o,requiresForm:r=!1}){this._integrations.has(t)&&wi("image-insert-integration-exists",{name:t}),this._integrations.set(t,{observable:e,buttonViewCreator:n,menuBarButtonViewCreator:o,formViewCreator:i,requiresForm:r})}_createToolbarComponent(t){const e=this.editor,n=t.t,i=this._prepareIntegrations();if(!i.length)return null;let o;const r=i[0];if(1==i.length){if(!r.requiresForm)return r.buttonViewCreator(!0);o=r.buttonViewCreator(!0)}else{const e=r.buttonViewCreator(!1);o=new vp(t,e),o.tooltip=!0,o.bind("label").to(this,"isImageSelected",(t=>n(t?"Replace image":"Insert image")))}const s=this.dropdownView=Dp(t,o),a=i.map((({observable:t})=>"function"==typeof t?t():t));return s.bind("isEnabled").toMany(a,"isEnabled",((...t)=>t.some((t=>t)))),s.once("change:isOpen",(()=>{const t=i.map((({formViewCreator:t})=>t(1==i.length))),n=new QC(e.locale,t);s.panelView.children.add(n)})),s}_createMenuBarComponent(t){const e=t.t,n=this._prepareIntegrations();if(!n.length)return null;let i;const o=n[0];if(1==n.length)i=o.menuBarButtonViewCreator(!0);else{i=new ob(t);const o=new rb(t);i.panelView.children.add(o),i.buttonView.set({icon:Mu.image,label:e("Image")});for(const e of n){const n=new Kf(t,i),r=e.menuBarButtonViewCreator(!1);n.children.add(r),o.items.add(n)}}return i}_prepareIntegrations(){const t=this.editor.config.get("image.insert.integrations"),e=[];if(!t.length)return wi("image-insert-integrations-not-specified"),e;for(const n of t)this._integrations.has(n)?e.push(this._integrations.get(n)):["upload","assetManager","url"].includes(n)||wi("image-insert-unknown-integration",{item:n});return e.length||wi("image-insert-integrations-not-registered"),e}}var tv=n(265),ev={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$r()(tv.A,ev);tv.A.locals;class nv extends Lr{static get requires(){return[ZC,O_,MC,XC]}static get pluginName(){return"ImageBlock"}}class iv extends Lr{static get requires(){return[qC,WC,DC,KC,c_]}static get pluginName(){return"ImageInlineEditing"}init(){const t=this.editor;t.model.schema.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"],disallowIn:["caption"]}),this._setupConversion(),t.plugins.has("ImageBlockEditing")&&(t.commands.add("imageTypeInline",new UC(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){const t=this.editor,e=t.t,n=t.conversion,i=t.plugins.get("ImageUtils");n.for("dataDowncast").elementToElement({model:"imageInline",view:(t,{writer:e})=>e.createEmptyElement("img")}),n.for("editingDowncast").elementToStructure({model:"imageInline",view:(t,{writer:n})=>i.toImageWidget(function(t){return t.createContainerElement("span",{class:"image-inline"},t.createEmptyElement("img"))}(n),n,e("image widget"))}),n.for("downcast").add(OC(i,"imageInline","src")).add(OC(i,"imageInline","alt")).add(zC(i,"imageInline")),n.for("upcast").elementToElement({view:vC(t,"imageInline"),model:(t,{writer:e})=>e.createElement("imageInline",t.hasAttribute("src")?{src:t.getAttribute("src")}:void 0)})}_setupClipboardIntegration(){const t=this.editor,e=t.model,n=t.editing.view,i=t.plugins.get("ImageUtils"),o=t.plugins.get("ClipboardPipeline");this.listenTo(o,"inputTransformation",((o,r)=>{const s=Array.from(r.content.getChildren());let a;if(!s.every(i.isBlockImageView))return;a=r.targetRanges?t.editing.mapper.toModelRange(r.targetRanges[0]):e.document.selection.getFirstRange();const c=e.createSelection(a);if("imageInline"===yC(e.schema,c)){const t=new jh(n.document),e=s.map((e=>1===e.childCount?(Array.from(e.getAttributes()).forEach((n=>t.setAttribute(...n,i.findViewImgElement(e)))),e.getChild(0)):e));r.content=t.createDocumentFragment(e)}})),this.listenTo(o,"contentInsertion",((t,n)=>{"paste"===n.method&&e.change((t=>{const e=t.createRangeIn(n.content);for(const t of e.getItems())t.is("element","imageInline")&&i.setImageNaturalSizeAttributes(t)}))}))}}class ov extends Lr{static get requires(){return[iv,O_,MC,XC]}static get pluginName(){return"ImageInline"}}class rv extends Lr{static get pluginName(){return"ImageCaptionUtils"}static get requires(){return[DC]}getCaptionFromImageModelElement(t){for(const e of t.getChildren())if(e&&e.is("element","caption"))return e;return null}getCaptionFromModelSelection(t){const e=this.editor.plugins.get("ImageUtils"),n=t.getFirstPosition().findAncestor("caption");return n&&e.isBlockImage(n.parent)?n:null}matchImageCaptionViewElement(t){const e=this.editor.plugins.get("ImageUtils");return"figcaption"==t.name&&e.isBlockImageView(t.parent)?{name:!0}:null}}class sv extends zr{refresh(){const t=this.editor,e=t.plugins.get("ImageCaptionUtils"),n=t.plugins.get("ImageUtils");if(!t.plugins.has(ZC))return this.isEnabled=!1,void(this.value=!1);const i=t.model.document.selection,o=i.getSelectedElement();if(!o){const t=e.getCaptionFromModelSelection(i);return this.isEnabled=!!t,void(this.value=!!t)}this.isEnabled=n.isImage(o),this.isEnabled?this.value=!!e.getCaptionFromImageModelElement(o):this.value=!1}execute(t={}){const{focusCaptionOnShow:e}=t;this.editor.model.change((t=>{this.value?this._hideImageCaption(t):this._showImageCaption(t,e)}))}_showImageCaption(t,e){const n=this.editor.model.document.selection,i=this.editor.plugins.get("ImageCaptionEditing"),o=this.editor.plugins.get("ImageUtils");let r=n.getSelectedElement();const s=i._getSavedCaption(r);o.isInlineImage(r)&&(this.editor.execute("imageTypeBlock"),r=n.getSelectedElement());const a=s||t.createElement("caption");t.append(a,r),e&&t.setSelection(a,"in")}_hideImageCaption(t){const e=this.editor,n=e.model.document.selection,i=e.plugins.get("ImageCaptionEditing"),o=e.plugins.get("ImageCaptionUtils");let r,s=n.getSelectedElement();s?r=o.getCaptionFromImageModelElement(s):(r=o.getCaptionFromModelSelection(n),s=r.parent),i._saveCaption(s,r),t.setSelection(s,"on"),t.remove(r)}}class av extends Lr{static get requires(){return[DC,rv]}static get pluginName(){return"ImageCaptionEditing"}_savedCaptionsMap;constructor(t){super(t),this._savedCaptionsMap=new WeakMap}init(){const t=this.editor,e=t.model.schema;e.isRegistered("caption")?e.extend("caption",{allowIn:"imageBlock"}):e.register("caption",{allowIn:"imageBlock",allowContentOf:"$block",isLimit:!0}),t.commands.add("toggleImageCaption",new sv(this.editor)),this._setupConversion(),this._setupImageTypeCommandsIntegration(),this._registerCaptionReconversion()}_setupConversion(){const t=this.editor,e=t.editing.view,n=t.plugins.get("ImageUtils"),i=t.plugins.get("ImageCaptionUtils"),o=t.t;t.conversion.for("upcast").elementToElement({view:t=>i.matchImageCaptionViewElement(t),model:"caption"}),t.conversion.for("dataDowncast").elementToElement({model:"caption",view:(t,{writer:e})=>n.isBlockImage(t.parent)?e.createContainerElement("figcaption"):null}),t.conversion.for("editingDowncast").elementToElement({model:"caption",view:(t,{writer:i})=>{if(!n.isBlockImage(t.parent))return null;const r=i.createEditableElement("figcaption");i.setCustomProperty("imageCaption",!0,r),r.placeholder=o("Enter image caption"),Jr({view:e,element:r,keepOnFocus:!0});const s=t.parent.getAttribute("alt");return A_(r,i,{label:s?o("Caption for image: %0",[s]):o("Caption for the image")})}})}_setupImageTypeCommandsIntegration(){const t=this.editor,e=t.plugins.get("ImageUtils"),n=t.plugins.get("ImageCaptionUtils"),i=t.commands.get("imageTypeInline"),o=t.commands.get("imageTypeBlock"),r=t=>{if(!t.return)return;const{oldElement:i,newElement:o}=t.return;if(!i)return;if(e.isBlockImage(i)){const t=n.getCaptionFromImageModelElement(i);if(t)return void this._saveCaption(o,t)}const r=this._getSavedCaption(i);r&&this._saveCaption(o,r)};i&&this.listenTo(i,"execute",r,{priority:"low"}),o&&this.listenTo(o,"execute",r,{priority:"low"})}_getSavedCaption(t){const e=this._savedCaptionsMap.get(t);return e?qc.fromJSON(e):null}_saveCaption(t,e){this._savedCaptionsMap.set(t,e.toJSON())}_registerCaptionReconversion(){const t=this.editor,e=t.model,n=t.plugins.get("ImageUtils"),i=t.plugins.get("ImageCaptionUtils");e.document.on("change:data",(()=>{const o=e.document.differ.getChanges();for(const e of o){if("alt"!==e.attributeKey)continue;const o=e.range.start.nodeAfter;if(n.isBlockImage(o)){const e=i.getCaptionFromImageModelElement(o);if(!e)return;t.editing.reconvertItem(e)}}}))}}class cv extends Lr{static get requires(){return[rv]}static get pluginName(){return"ImageCaptionUI"}init(){const t=this.editor,e=t.editing.view,n=t.plugins.get("ImageCaptionUtils"),i=t.t;t.ui.componentFactory.add("toggleImageCaption",(o=>{const r=t.commands.get("toggleImageCaption"),s=new wm(o);return s.set({icon:Mu.caption,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.bind("label").to(r,"value",(t=>i(t?"Toggle caption off":"Toggle caption on"))),this.listenTo(s,"execute",(()=>{t.execute("toggleImageCaption",{focusCaptionOnShow:!0});const i=n.getCaptionFromModelSelection(t.model.document.selection);if(i){const n=t.editing.mapper.toViewElement(i);e.scrollToTheSelection(),e.change((t=>{t.addClass("image__caption_highlighted",n)}))}t.editing.view.focus()})),s}))}}var lv=n(5247),dv={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$r()(lv.A,dv);lv.A.locals;function hv(t){const e=t.map((t=>t.replace("+","\\+")));return new RegExp(`^image\\/(${e.join("|")})$`)}function uv(t){return new Promise(((e,n)=>{const i=t.getAttribute("src");fetch(i).then((t=>t.blob())).then((t=>{const n=mv(t,i),o=n.replace("image/",""),r=new File([t],`image.${o}`,{type:n});e(r)})).catch((t=>t&&"TypeError"===t.name?function(t){return function(t){return new Promise(((e,n)=>{const i=Yn.document.createElement("img");i.addEventListener("load",(()=>{const t=Yn.document.createElement("canvas");t.width=i.width,t.height=i.height;t.getContext("2d").drawImage(i,0,0),t.toBlob((t=>t?e(t):n()))})),i.addEventListener("error",(()=>n())),i.src=t}))}(t).then((e=>{const n=mv(e,t),i=n.replace("image/","");return new File([e],`image.${i}`,{type:n})}))}(i).then(e).catch(n):n(t)))}))}function mv(t,e){return t.type?t.type:e.match(/data:(image\/\w+);base64/)?e.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}class gv extends Lr{static get pluginName(){return"ImageUploadUI"}init(){const t=this.editor;t.ui.componentFactory.add("uploadImage",(()=>this._createToolbarButton())),t.ui.componentFactory.add("imageUpload",(()=>this._createToolbarButton())),t.ui.componentFactory.add("menuBar:uploadImage",(()=>this._createMenuBarButton("standalone"))),t.plugins.has("ImageInsertUI")&&t.plugins.get("ImageInsertUI").registerIntegration({name:"upload",observable:()=>t.commands.get("uploadImage"),buttonViewCreator:()=>this._createToolbarButton(),formViewCreator:()=>this._createDropdownButton(),menuBarButtonViewCreator:t=>this._createMenuBarButton(t?"insertOnly":"insertNested")})}_createButton(t){const e=this.editor,n=e.locale,i=e.commands.get("uploadImage"),o=e.config.get("image.upload.types"),r=hv(o),s=new t(e.locale),a=n.t;return s.set({acceptedType:o.map((t=>`image/${t}`)).join(","),allowMultipleFiles:!0,label:a("Upload from computer"),icon:Mu.imageUpload}),s.bind("isEnabled").to(i),s.on("done",((t,n)=>{const i=Array.from(n).filter((t=>r.test(t.type)));i.length&&(e.execute("uploadImage",{file:i}),e.editing.view.focus())})),s}_createToolbarButton(){const t=this.editor.locale.t,e=this.editor.plugins.get("ImageInsertUI"),n=this.editor.commands.get("uploadImage"),i=this._createButton(sg);return i.tooltip=!0,i.bind("label").to(e,"isImageSelected",n,"isAccessAllowed",((e,n)=>t(n?e?"Replace image from computer":"Upload image from computer":"You have no image upload permissions."))),i}_createDropdownButton(){const t=this.editor.locale.t,e=this.editor.plugins.get("ImageInsertUI"),n=this._createButton(sg);return n.withText=!0,n.bind("label").to(e,"isImageSelected",(e=>t(e?"Replace from computer":"Upload from computer"))),n.on("execute",(()=>{e.dropdownView.isOpen=!1})),n}_createMenuBarButton(t){const e=this.editor.locale.t,n=this._createButton(ab);switch(n.withText=!0,t){case"standalone":n.label=e("Image from computer");break;case"insertOnly":n.label=e("Image");break;case"insertNested":n.label=e("From computer")}return n}}var pv=n(2267),fv={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$r()(pv.A,fv);pv.A.locals;var kv=n(7693),bv={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$r()(kv.A,bv);kv.A.locals;var wv=n(1559),Av={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$r()(wv.A,Av);wv.A.locals;class _v extends Lr{static get pluginName(){return"ImageUploadProgress"}placeholder;constructor(t){super(t),this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}init(){const t=this.editor;t.plugins.has("ImageBlockEditing")&&t.editing.downcastDispatcher.on("attribute:uploadStatus:imageBlock",this.uploadStatusChange),t.plugins.has("ImageInlineEditing")&&t.editing.downcastDispatcher.on("attribute:uploadStatus:imageInline",this.uploadStatusChange)}uploadStatusChange=(t,e,n)=>{const i=this.editor,o=e.item,r=o.getAttribute("uploadId");if(!n.consumable.consume(e.item,t.name))return;const s=i.plugins.get("ImageUtils"),a=i.plugins.get(zb),c=r?e.attributeNewValue:null,l=this.placeholder,d=i.editing.mapper.toViewElement(o),h=n.writer;if("reading"==c)return Cv(d,h),void vv(s,l,d,h);if("uploading"==c){const t=a.loaders.get(r);return Cv(d,h),void(t?(yv(d,h),function(t,e,n,i){const o=function(t){const e=t.createUIElement("div",{class:"ck-progress-bar"});return t.setCustomProperty("progressBar",!0,e),e}(e);e.insert(e.createPositionAt(t,"end"),o),n.on("change:uploadedPercent",((t,e,n)=>{i.change((t=>{t.setStyle("width",n+"%",o)}))}))}(d,h,t,i.editing.view),function(t,e,n,i){if(i.data){const o=t.findViewImgElement(e);n.setAttribute("src",i.data,o)}}(s,d,h,t)):vv(s,l,d,h))}"complete"==c&&a.loaders.get(r)&&function(t,e,n){const i=e.createUIElement("div",{class:"ck-image-upload-complete-icon"});e.insert(e.createPositionAt(t,"end"),i),setTimeout((()=>{n.change((t=>t.remove(t.createRangeOn(i))))}),3e3)}(d,h,i.editing.view),function(t,e){Ev(t,e,"progressBar")}(d,h),yv(d,h),function(t,e){e.removeClass("ck-appear",t)}(d,h)}}function Cv(t,e){t.hasClass("ck-appear")||e.addClass("ck-appear",t)}function vv(t,e,n,i){n.hasClass("ck-image-upload-placeholder")||i.addClass("ck-image-upload-placeholder",n);const o=t.findViewImgElement(n);o.getAttribute("src")!==e&&i.setAttribute("src",e,o),xv(n,"placeholder")||i.insert(i.createPositionAfter(o),function(t){const e=t.createUIElement("div",{class:"ck-upload-placeholder-loader"});return t.setCustomProperty("placeholder",!0,e),e}(i))}function yv(t,e){t.hasClass("ck-image-upload-placeholder")&&e.removeClass("ck-image-upload-placeholder",t),Ev(t,e,"placeholder")}function xv(t,e){for(const n of t.getChildren())if(n.getCustomProperty(e))return n}function Ev(t,e,n){const i=xv(t,n);i&&e.remove(e.createRangeOn(i))}class Bv extends zr{constructor(t){super(t),this.set("isAccessAllowed",!0)}refresh(){const t=this.editor,e=t.plugins.get("ImageUtils"),n=t.model.document.selection.getSelectedElement();this.isEnabled=e.isImageAllowed()||e.isImage(n)}execute(t){const e=tr(t.file),n=this.editor.model.document.selection,i=this.editor.plugins.get("ImageUtils"),o=Object.fromEntries(n.getAttributes());e.forEach(((t,e)=>{const r=n.getSelectedElement();if(e&&r&&i.isImage(r)){const e=this.editor.model.createPositionAfter(r);this._uploadImage(t,o,e)}else this._uploadImage(t,o)}))}_uploadImage(t,e,n){const i=this.editor,o=i.plugins.get(zb).createLoader(t),r=i.plugins.get("ImageUtils");o&&r.insertImage({...e,uploadId:o.id},n)}}class Dv extends Lr{static get requires(){return[zb,kk,c_,DC]}static get pluginName(){return"ImageUploadEditing"}_uploadImageElements;constructor(t){super(t),t.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}init(){const t=this.editor,e=t.model.document,n=t.conversion,i=t.plugins.get(zb),o=t.plugins.get("ImageUtils"),r=t.plugins.get("ClipboardPipeline"),s=hv(t.config.get("image.upload.types")),a=new Bv(t);t.commands.add("uploadImage",a),t.commands.add("imageUpload",a),n.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(t.editing.view.document,"clipboardInput",((e,n)=>{if(i=n.dataTransfer,Array.from(i.types).includes("text/html")&&""!==i.getData("text/html"))return;var i;const o=Array.from(n.dataTransfer.files).filter((t=>!!t&&s.test(t.type)));if(!o.length)return;e.stop(),t.model.change((e=>{n.targetRanges&&e.setSelection(n.targetRanges.map((e=>t.editing.mapper.toModelRange(e)))),t.execute("uploadImage",{file:o})}));if(!t.commands.get("uploadImage").isAccessAllowed){const e=t.plugins.get("Notification"),n=t.locale.t;e.showWarning(n("You have no image upload permissions."),{namespace:"image"})}})),this.listenTo(r,"inputTransformation",((e,n)=>{const r=Array.from(t.editing.view.createRangeIn(n.content)).map((t=>t.item)).filter((t=>function(t,e){return!(!t.isInlineImageView(e)||!e.getAttribute("src")||!e.getAttribute("src").match(/^data:image\/\w+;base64,/g)&&!e.getAttribute("src").match(/^blob:/g))}(o,t)&&!t.getAttribute("uploadProcessed"))).map((t=>({promise:uv(t),imageElement:t})));if(!r.length)return;const s=new jh(t.editing.view.document);for(const t of r){s.setAttribute("uploadProcessed",!0,t.imageElement);const e=i.createLoader(t.promise);e&&(s.setAttribute("src","",t.imageElement),s.setAttribute("uploadId",e.id,t.imageElement))}})),t.editing.view.document.on("dragover",((t,e)=>{e.preventDefault()})),e.on("change",(()=>{const n=e.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),o=new Set;for(const e of n)if("insert"==e.type&&"$text"!=e.name){const n=e.position.nodeAfter,r="$graveyard"==e.position.root.rootName;for(const e of Sv(t,n)){const t=e.getAttribute("uploadId");if(!t)continue;const n=i.loaders.get(t);n&&(r?o.has(t)||n.abort():(o.add(t),this._uploadImageElements.set(t,e),"idle"==n.status&&this._readAndUpload(n)))}}})),this.on("uploadComplete",((t,{imageElement:e,data:n})=>{const i=n.urls?n.urls:n;this.editor.model.change((t=>{t.setAttribute("src",i.default,e),this._parseAndSetSrcsetAttributeOnImage(i,e,t),o.setImageNaturalSizeAttributes(e)}))}),{priority:"low"})}afterInit(){const t=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&t.extend("imageBlock",{allowAttributes:["uploadId","uploadStatus"]}),this.editor.plugins.has("ImageInlineEditing")&&t.extend("imageInline",{allowAttributes:["uploadId","uploadStatus"]})}_readAndUpload(t){const e=this.editor,n=e.model,i=e.locale.t,o=e.plugins.get(zb),r=e.plugins.get(kk),s=e.plugins.get("ImageUtils"),a=this._uploadImageElements;return n.enqueueChange({isUndoable:!1},(e=>{e.setAttribute("uploadStatus","reading",a.get(t.id))})),t.read().then((()=>{const o=t.upload(),r=a.get(t.id);if(Xn.isSafari){const t=e.editing.mapper.toViewElement(r),n=s.findViewImgElement(t);e.editing.view.once("render",(()=>{if(!n.parent)return;const t=e.editing.view.domConverter.mapViewToDom(n.parent);if(!t)return;const i=t.style.display;t.style.display="none",t._ckHack=t.offsetHeight,t.style.display=i}))}return e.ui&&e.ui.ariaLiveAnnouncer.announce(i("Uploading image")),n.enqueueChange({isUndoable:!1},(t=>{t.setAttribute("uploadStatus","uploading",r)})),o})).then((o=>{n.enqueueChange({isUndoable:!1},(n=>{const r=a.get(t.id);n.setAttribute("uploadStatus","complete",r),e.ui&&e.ui.ariaLiveAnnouncer.announce(i("Image upload complete")),this.fire("uploadComplete",{data:o,imageElement:r})})),c()})).catch((o=>{if(e.ui&&e.ui.ariaLiveAnnouncer.announce(i("Error during image upload")),"error"!==t.status&&"aborted"!==t.status)throw o;"error"==t.status&&o&&r.showWarning(o,{title:i("Upload failed"),namespace:"upload"}),n.enqueueChange({isUndoable:!1},(e=>{e.remove(a.get(t.id))})),c()}));function c(){n.enqueueChange({isUndoable:!1},(e=>{const n=a.get(t.id);e.removeAttribute("uploadId",n),e.removeAttribute("uploadStatus",n),a.delete(t.id)})),o.destroyLoader(t)}}_parseAndSetSrcsetAttributeOnImage(t,e,n){let i=0;const o=Object.keys(t).filter((t=>{const e=parseInt(t,10);if(!isNaN(e))return i=Math.max(i,e),!0})).map((e=>`${t[e]} ${e}w`)).join(", ");if(""!=o){const t={srcset:o};e.hasAttribute("width")||e.hasAttribute("height")||(t.width=i),n.setAttributes(t,e)}}}function Sv(t,e){const n=t.plugins.get("ImageUtils");return Array.from(t.model.createRangeOn(e)).filter((t=>n.isImage(t.item))).map((t=>t.item))}const Tv=function(t,e){return function(n,i){if(null==n)return n;if(!Be(n))return t(n,i);for(var o=n.length,r=e?o:-1,s=Object(n);(e?r--:++r{e.setAttribute("resizedWidth",t.width,o),e.removeAttribute("resizedHeight",o),i.setImageNaturalSizeAttributes(o)}))}}class Rv extends Lr{static get requires(){return[DC]}static get pluginName(){return"ImageResizeEditing"}constructor(t){super(t),t.config.define("image",{resizeUnit:"%",resizeOptions:[{name:"resizeImage:original",value:null,icon:"original"},{name:"resizeImage:custom",value:"custom",icon:"custom"},{name:"resizeImage:25",value:"25",icon:"small"},{name:"resizeImage:50",value:"50",icon:"medium"},{name:"resizeImage:75",value:"75",icon:"large"}]})}init(){const t=this.editor,e=new Fv(t);this._registerConverters("imageBlock"),this._registerConverters("imageInline"),t.commands.add("resizeImage",e),t.commands.add("imageResize",e)}afterInit(){this._registerSchema()}_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(t){const e=this.editor,n=e.plugins.get("ImageUtils");e.conversion.for("downcast").add((e=>e.on(`attribute:resizedWidth:${t}`,((t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const i=n.writer,o=n.mapper.toViewElement(e.item);null!==e.attributeNewValue?(i.setStyle("width",e.attributeNewValue,o),i.addClass("image_resized",o)):(i.removeStyle("width",o),i.removeClass("image_resized",o))})))),e.conversion.for("dataDowncast").attributeToAttribute({model:{name:t,key:"resizedHeight"},view:t=>({key:"style",value:{height:t}})}),e.conversion.for("editingDowncast").add((e=>e.on(`attribute:resizedHeight:${t}`,((e,i,o)=>{if(!o.consumable.consume(i.item,e.name))return;const r=o.writer,s=o.mapper.toViewElement(i.item),a="imageInline"===t?n.findViewImgElement(s):s;null!==i.attributeNewValue?r.setStyle("height",i.attributeNewValue,a):r.removeStyle("height",a)})))),e.conversion.for("upcast").attributeToAttribute({view:{name:"imageBlock"===t?"figure":"img",styles:{width:/.+/}},model:{key:"resizedWidth",value:t=>EC(t)?null:t.getStyle("width")}}),e.conversion.for("upcast").attributeToAttribute({view:{name:"imageBlock"===t?"figure":"img",styles:{height:/.+/}},model:{key:"resizedHeight",value:t=>EC(t)?null:t.getStyle("height")}})}}const Vv=(()=>({small:Mu.objectSizeSmall,medium:Mu.objectSizeMedium,large:Mu.objectSizeLarge,custom:Mu.objectSizeCustom,original:Mu.objectSizeFull}))();class Lv extends Lr{static get requires(){return[Rv]}static get pluginName(){return"ImageResizeButtons"}_resizeUnit;constructor(t){super(t),this._resizeUnit=t.config.get("image.resizeUnit")}init(){const t=this.editor,e=t.config.get("image.resizeOptions"),n=t.commands.get("resizeImage");this.bind("isEnabled").to(n);for(const t of e)this._registerImageResizeButton(t);this._registerImageResizeDropdown(e)}_registerImageResizeButton(t){const e=this.editor,{name:n,value:i,icon:o}=t;e.ui.componentFactory.add(n,(n=>{const r=new wm(n),s=e.commands.get("resizeImage"),a=this._getOptionLabelValue(t,!0);if(!Vv[o])throw new bi("imageresizebuttons-missing-icon",e,t);if(r.set({label:a,icon:Vv[o],tooltip:a,isToggleable:!0}),r.bind("isEnabled").to(this),e.plugins.has("ImageCustomResizeUI")&&Mv(t)){const t=e.plugins.get("ImageCustomResizeUI");this.listenTo(r,"execute",(()=>{t._showForm(this._resizeUnit)}))}else{const t=i?i+this._resizeUnit:null;r.bind("isOn").to(s,"value",zv(t)),this.listenTo(r,"execute",(()=>{e.execute("resizeImage",{width:t})}))}return r}))}_registerImageResizeDropdown(t){const e=this.editor,n=e.t,i=t.find((t=>!t.value)),o=o=>{const r=e.commands.get("resizeImage"),s=Dp(o,jg),a=s.buttonView,c=n("Resize image");return a.set({tooltip:c,commandValue:i.value,icon:Vv.medium,isToggleable:!0,label:this._getOptionLabelValue(i),withText:!0,class:"ck-resize-image-button",ariaLabel:c,ariaLabelledBy:void 0}),a.bind("label").to(r,"value",(t=>t&&t.width?t.width:this._getOptionLabelValue(i))),s.bind("isEnabled").to(this),Ip(s,(()=>this._getResizeDropdownListItemDefinitions(t,r)),{ariaLabel:n("Image resize list"),role:"menu"}),this.listenTo(s,"execute",(t=>{"onClick"in t.source?t.source.onClick():(e.execute(t.source.commandName,{width:t.source.commandValue}),e.editing.view.focus())})),s};e.ui.componentFactory.add("resizeImage",o),e.ui.componentFactory.add("imageResize",o)}_getOptionLabelValue(t,e=!1){const n=this.editor.t;return t.label?t.label:e?Mv(t)?n("Custom image size"):t.value?n("Resize image to %0",t.value+this._resizeUnit):n("Resize image to the original size"):Mv(t)?n("Custom"):t.value?t.value+this._resizeUnit:n("Original")}_getResizeDropdownListItemDefinitions(t,e){const{editor:n}=this,i=new xr,o=t.map((t=>Mv(t)?{...t,valueWithUnits:"custom"}:t.value?{...t,valueWithUnits:`${t.value}${this._resizeUnit}`}:{...t,valueWithUnits:null}));for(const t of o){let r=null;if(n.plugins.has("ImageCustomResizeUI")&&Mv(t)){const i=n.plugins.get("ImageCustomResizeUI");r={type:"button",model:new bk({label:this._getOptionLabelValue(t),role:"menuitemradio",withText:!0,icon:null,onClick:()=>{i._showForm(this._resizeUnit)}})};const s=Pv(o,"valueWithUnits");r.model.bind("isOn").to(e,"value",Ov(s))}else r={type:"button",model:new bk({commandName:"resizeImage",commandValue:t.valueWithUnits,label:this._getOptionLabelValue(t),role:"menuitemradio",withText:!0,icon:null})},r.model.bind("isOn").to(e,"value",zv(t.valueWithUnits));r.model.bind("isEnabled").to(e,"isEnabled"),i.add(r)}return i}}function Mv(t){return"custom"===t.value}function zv(t){return e=>null===t&&e===t||null!==e&&e.width===t}function Ov(t){return e=>!t.some((t=>zv(t)(e)))}const Nv="image_resized";class Hv extends Lr{static get requires(){return[Y_,DC]}static get pluginName(){return"ImageResizeHandles"}init(){const t=this.editor.commands.get("resizeImage");this.bind("isEnabled").to(t),this._setupResizerCreator()}_setupResizerCreator(){const t=this.editor,e=t.editing.view,n=t.plugins.get("ImageUtils");e.addObserver(NC),this.listenTo(e.document,"imageLoaded",((i,o)=>{if(!o.target.matches("figure.image.ck-widget > img,figure.image.ck-widget > picture > img,figure.image.ck-widget > a > img,figure.image.ck-widget > a > picture > img,span.image-inline.ck-widget > img,span.image-inline.ck-widget > picture > img"))return;const r=t.editing.view.domConverter,s=r.domToView(o.target),a=n.getImageWidgetFromImageView(s);let c=this.editor.plugins.get(Y_).getResizerByViewElement(a);if(c)return void c.redraw();const l=t.editing.mapper,d=l.toModelElement(a);c=t.plugins.get(Y_).attachTo({unit:t.config.get("image.resizeUnit"),modelElement:d,viewElement:a,editor:t,getHandleHost:t=>t.querySelector("img"),getResizeHost:()=>r.mapViewToDom(l.toViewElement(d)),isCentered:()=>"alignCenter"==d.getAttribute("imageStyle"),onCommit(n){e.change((t=>{t.removeClass(Nv,a)})),t.execute("resizeImage",{width:n})}}),c.on("updateSize",(()=>{a.hasClass(Nv)||e.change((t=>{t.addClass(Nv,a)}));const t="imageInline"===d.name?s:a;t.getStyle("height")&&e.change((e=>{e.removeStyle("height",t)}))})),c.bind("isEnabled").to(this)}))}}function jv(t){if(!t)return null;const[,e,n]=t.trim().match(/([.,\d]+)(%|px)$/)||[],i=Number.parseFloat(e);return Number.isNaN(i)?null:{value:i,unit:n}}function qv(t,e,n){return"px"===n?{value:e.value,unit:"px"}:{value:e.value/t*100,unit:"%"}}function Wv(t){const{editing:e}=t,n=t.plugins.get("ImageUtils").getClosestSelectedImageElement(t.model.document.selection);if(!n)return null;const i=e.mapper.toViewElement(n);return{model:n,view:i,dom:e.view.domConverter.mapViewToDom(i)}}var Uv=n(4642),$v={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$r()(Uv.A,$v);Uv.A.locals;class Gv extends cm{focusTracker;keystrokes;unit;labeledInput;saveButtonView;cancelButtonView;_focusables;_focusCycler;_validators;constructor(t,e,n){super(t);const i=this.locale.t;this.focusTracker=new Br,this.keystrokes=new Dr,this.unit=e,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(i("Save"),Mu.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(i("Cancel"),Mu.cancel,"ck-button-cancel","cancel"),this._focusables=new zu,this._validators=n,this._focusCycler=new ym({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-custom-resize-form","ck-responsive-form"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),this.keystrokes.listenTo(this.element),hm({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach((t=>{this._focusables.add(t),this.focusTracker.add(t.element)}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(t,e,n,i){const o=new wm(this.locale);return o.set({label:t,icon:e,tooltip:!0}),o.extendTemplate({attributes:{class:n}}),i&&o.delegate("execute").to(this,i),o}_createLabeledInputView(){const t=this.locale.t,e=new Sg(this.locale,Lp);return e.label=t("Resize image (in %0)",this.unit),e.fieldView.set({step:.1}),e}isValid(){this.resetFormStatus();for(const t of this._validators){const e=t(this);if(e)return this.labeledInput.errorText=e,!1}return!0}resetFormStatus(){this.labeledInput.errorText=null}get rawSize(){const{element:t}=this.labeledInput.fieldView;return t?t.value:null}get parsedSize(){const{rawSize:t}=this;if(null===t)return null;const e=Number.parseFloat(t);return Number.isNaN(e)?null:e}get sizeWithUnits(){const{parsedSize:t,unit:e}=this;return null===t?null:`${t}${e}`}}class Kv extends Lr{_balloon;_form;static get requires(){return[yk]}static get pluginName(){return"ImageCustomResizeUI"}destroy(){super.destroy(),this._form&&this._form.destroy()}_createForm(t){const e=this.editor;this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(dm(Gv))(e.locale,t,function(t){const e=t.t;return[t=>""===t.rawSize.trim()?e("The value must not be empty."):null===t.parsedSize?e("The value should be a plain number."):void 0]}(e)),this._form.render(),this.listenTo(this._form,"submit",(()=>{this._form.isValid()&&(e.execute("resizeImage",{width:this._form.sizeWithUnits}),this._hideForm(!0))})),this.listenTo(this._form.labeledInput,"change:errorText",(()=>{e.ui.update()})),this.listenTo(this._form,"cancel",(()=>{this._hideForm(!0)})),this._form.keystrokes.set("Esc",((t,e)=>{this._hideForm(!0),e()})),lm({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(t){if(this._isVisible)return;this._form||this._createForm(t);const e=this.editor,n=this._form.labeledInput;this._form.disableCssTransitions(),this._form.resetFormStatus(),this._isInBalloon||this._balloon.add({view:this._form,position:VC(e)});const i=function(t,e){const n=Wv(t);if(!n)return null;const i=jv(n.model.getAttribute("resizedWidth")||null);return i?i.unit===e?i:qv(y_(n.dom),{unit:"px",value:new ko(n.dom).width},e):null}(e,t),o=i?i.value.toFixed(1):"",r=function(t,e){const n=Wv(t);if(!n)return null;const i=y_(n.dom),o=jv(window.getComputedStyle(n.dom).minWidth)||{value:1,unit:"px"};return{unit:e,lower:Math.max(.1,qv(i,o,e).value),upper:"px"===e?i:100}}(e,t);n.fieldView.value=n.fieldView.element.value=o,r&&Object.assign(n.fieldView,{min:r.lower.toFixed(1),max:Math.ceil(r.upper).toFixed(1)}),this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(t=!1){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),t&&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)}}var Zv=n(3469),Yv={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$r()(Zv.A,Yv);Zv.A.locals;class Jv extends zr{_defaultStyles;_styles;constructor(t,e){super(t),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(e.map((t=>{if(t.isDefault)for(const e of t.modelElements)this._defaultStyles[e]=t.name;return[t.name,t]})))}refresh(){const t=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!t,this.isEnabled?t.hasAttribute("imageStyle")?this.value=t.getAttribute("imageStyle"):this.value=this._defaultStyles[t.name]:this.value=!1}execute(t={}){const e=this.editor,n=e.model,i=e.plugins.get("ImageUtils");n.change((e=>{const o=t.value,{setImageSizes:r=!0}=t;let s=i.getClosestSelectedImageElement(n.document.selection);o&&this.shouldConvertImageType(o,s)&&(this.editor.execute(i.isBlockImage(s)?"imageTypeInline":"imageTypeBlock",{setImageSizes:r}),s=i.getClosestSelectedImageElement(n.document.selection)),!o||this._styles.get(o).isDefault?e.removeAttribute("imageStyle",s):e.setAttribute("imageStyle",o,s),r&&i.setImageNaturalSizeAttributes(s)}))}shouldConvertImageType(t,e){return!this._styles.get(t).modelElements.includes(e.name)}}const Qv={get inline(){return{name:"inline",title:"In line",icon:Mu.objectInline,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:Mu.objectLeft,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:Mu.objectBlockLeft,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:Mu.objectCenter,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:Mu.objectRight,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:Mu.objectBlockRight,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:Mu.objectCenter,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:Mu.objectRight,modelElements:["imageBlock"],className:"image-style-side"}}},Xv=(()=>({full:Mu.objectFullWidth,left:Mu.objectBlockLeft,right:Mu.objectBlockRight,center:Mu.objectCenter,inlineLeft:Mu.objectLeft,inlineRight:Mu.objectRight,inline:Mu.objectInline}))(),ty=[{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 ey(t){wi("image-style-configuration-definition-invalid",t)}const ny={normalizeStyles:function(t){return(t.configuredStyles.options||[]).map((t=>function(t){t="string"==typeof t?Qv[t]?{...Qv[t]}:{name:t}:function(t,e){const n={...e};for(const i in t)Object.prototype.hasOwnProperty.call(e,i)||(n[i]=t[i]);return n}(Qv[t.name],t);"string"==typeof t.icon&&(t.icon=Xv[t.icon]||t.icon);return t}(t))).filter((e=>function(t,{isBlockPluginLoaded:e,isInlinePluginLoaded:n}){const{modelElements:i,name:o}=t;if(!(i&&i.length&&o))return ey({style:t}),!1;{const o=[e?"imageBlock":null,n?"imageInline":null];if(!i.some((t=>o.includes(t))))return wi("image-style-missing-dependency",{style:t,missingPlugins:i.map((t=>"imageBlock"===t?"ImageBlockEditing":"ImageInlineEditing"))}),!1}return!0}(e,t)))},getDefaultStylesConfiguration:function(t,e){return t&&e?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:t?{options:["block","side"]}:e?{options:["inline","alignLeft","alignRight"]}:{}},getDefaultDropdownDefinitions:function(t){return t.has("ImageBlockEditing")&&t.has("ImageInlineEditing")?[...ty]:[]},warnInvalidStyle:ey,DEFAULT_OPTIONS:Qv,DEFAULT_ICONS:Xv,DEFAULT_DROPDOWN_DEFINITIONS:ty};function iy(t,e){for(const n of e)if(n.name===t)return n}class oy extends Lr{static get pluginName(){return"ImageStyleEditing"}static get requires(){return[DC]}normalizedStyles;init(){const{normalizeStyles:t,getDefaultStylesConfiguration:e}=ny,n=this.editor,i=n.plugins.has("ImageBlockEditing"),o=n.plugins.has("ImageInlineEditing");n.config.define("image.styles",e(i,o)),this.normalizedStyles=t({configuredStyles:n.config.get("image.styles"),isBlockPluginLoaded:i,isInlinePluginLoaded:o}),this._setupConversion(i,o),this._setupPostFixer(),n.commands.add("imageStyle",new Jv(n,this.normalizedStyles))}_setupConversion(t,e){const n=this.editor,i=n.model.schema,o=(r=this.normalizedStyles,(t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const i=iy(e.attributeNewValue,r),o=iy(e.attributeOldValue,r),s=n.mapper.toViewElement(e.item),a=n.writer;o&&a.removeClass(o.className,s),i&&a.addClass(i.className,s)});var r;const s=function(t){const e={imageInline:t.filter((t=>!t.isDefault&&t.modelElements.includes("imageInline"))),imageBlock:t.filter((t=>!t.isDefault&&t.modelElements.includes("imageBlock")))};return(t,n,i)=>{if(!n.modelRange)return;const o=n.viewItem,r=Er(n.modelRange.getItems());if(r&&i.schema.checkAttribute(r,"imageStyle"))for(const t of e[r.name])i.consumable.consume(o,{classes:t.className})&&i.writer.setAttribute("imageStyle",t.name,r)}}(this.normalizedStyles);n.editing.downcastDispatcher.on("attribute:imageStyle",o),n.data.downcastDispatcher.on("attribute:imageStyle",o),t&&(i.extend("imageBlock",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:figure",s,{priority:"low"})),e&&(i.extend("imageInline",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:img",s,{priority:"low"}))}_setupPostFixer(){const t=this.editor,e=t.model.document,n=t.plugins.get(DC),i=new Map(this.normalizedStyles.map((t=>[t.name,t])));e.registerPostFixer((t=>{let o=!1;for(const r of e.differ.getChanges())if("insert"==r.type||"attribute"==r.type&&"imageStyle"==r.attributeKey){let e="insert"==r.type?r.position.nodeAfter:r.range.start.nodeAfter;if(e&&e.is("element","paragraph")&&e.childCount>0&&(e=e.getChild(0)),!n.isImage(e))continue;const s=e.getAttribute("imageStyle");if(!s)continue;const a=i.get(s);a&&a.modelElements.includes(e.name)||(t.removeAttribute("imageStyle",e),o=!0)}return o}))}}var ry=n(6386),sy={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$r()(ry.A,sy);ry.A.locals;class ay extends Lr{static get requires(){return[oy]}static get pluginName(){return"ImageStyleUI"}get localizedDefaultStylesTitles(){const t=this.editor.t;return{"Wrap text":t("Wrap text"),"Break text":t("Break text"),"In line":t("In line"),"Full size image":t("Full size image"),"Side image":t("Side image"),"Left aligned image":t("Left aligned image"),"Centered image":t("Centered image"),"Right aligned image":t("Right aligned image")}}init(){const t=this.editor.plugins,e=this.editor.config.get("image.toolbar")||[],n=cy(t.get("ImageStyleEditing").normalizedStyles,this.localizedDefaultStylesTitles);for(const t of n)this._createButton(t);const i=cy([...e.filter(s),...ny.getDefaultDropdownDefinitions(t)],this.localizedDefaultStylesTitles);for(const t of i)this._createDropdown(t,n)}_createDropdown(t,e){const n=this.editor.ui.componentFactory;n.add(t.name,(i=>{let o;const{defaultItem:r,items:s,title:a}=t,c=s.filter((t=>e.find((({name:e})=>ly(e)===t)))).map((t=>{const e=n.create(t);return t===r&&(o=e),e}));s.length!==c.length&&ny.warnInvalidStyle({dropdown:t});const l=Dp(i,vp),d=l.buttonView,h=d.arrowView;return Sp(l,c,{enableActiveItemFocusOnDropdownOpen:!0}),d.set({label:dy(a,o.label),class:null,tooltip:!0}),h.unbind("label"),h.set({label:a}),d.bind("icon").toMany(c,"isOn",((...t)=>{const e=t.findIndex(cr);return e<0?o.icon:c[e].icon})),d.bind("label").toMany(c,"isOn",((...t)=>{const e=t.findIndex(cr);return dy(a,e<0?o.label:c[e].label)})),d.bind("isOn").toMany(c,"isOn",((...t)=>t.some(cr))),d.bind("class").toMany(c,"isOn",((...t)=>t.some(cr)?"ck-splitbutton_flatten":void 0)),d.on("execute",(()=>{c.some((({isOn:t})=>t))?l.isOpen=!l.isOpen:o.fire("execute")})),l.bind("isEnabled").toMany(c,"isEnabled",((...t)=>t.some(cr))),this.listenTo(l,"execute",(()=>{this.editor.editing.view.focus()})),l}))}_createButton(t){const e=t.name;this.editor.ui.componentFactory.add(ly(e),(n=>{const i=this.editor.commands.get("imageStyle"),o=new wm(n);return o.set({label:t.title,icon:t.icon,tooltip:!0,isToggleable:!0}),o.bind("isEnabled").to(i,"isEnabled"),o.bind("isOn").to(i,"value",(t=>t===e)),o.on("execute",this._executeCommand.bind(this,e)),o}))}_executeCommand(t){this.editor.execute("imageStyle",{value:t}),this.editor.editing.view.focus()}}function cy(t,e){for(const n of t)e[n.title]&&(n.title=e[n.title]);return t}function ly(t){return`imageStyle:${t}`}function dy(t,e){return(t?t+": ":"")+e}class hy{_definitions=new Set;get length(){return this._definitions.size}add(t){Array.isArray(t)?t.forEach((t=>this._definitions.add(t))):this._definitions.add(t)}getDispatcher(){return t=>{t.on("attribute:linkHref",((t,e,n)=>{if(!n.consumable.test(e.item,"attribute:linkHref"))return;if(!e.item.is("selection")&&!n.schema.isInline(e.item))return;const i=n.writer,o=i.document.selection;for(const t of this._definitions){const r=i.createAttributeElement("a",t.attributes,{priority:5});t.classes&&i.addClass(t.classes,r);for(const e in t.styles)i.setStyle(e,t.styles[e],r);i.setCustomProperty("link",!0,r),t.callback(e.attributeNewValue)?e.item.is("selection")?i.wrap(o.getFirstRange(),r):i.wrap(n.mapper.toViewRange(e.range),r):i.unwrap(n.mapper.toViewRange(e.range),r)}}),{priority:"high"})}}getDispatcherForLinkedImage(){return t=>{t.on("attribute:linkHref:imageBlock",((t,e,{writer:n,mapper:i})=>{const o=i.toViewElement(e.item),r=Array.from(o.getChildren()).find((t=>t.is("element","a")));for(const t of this._definitions){const i=Sr(t.attributes);if(t.callback(e.attributeNewValue)){for(const[t,e]of i)"class"===t?n.addClass(e,r):n.setAttribute(t,e,r);t.classes&&n.addClass(t.classes,r);for(const e in t.styles)n.setStyle(e,t.styles[e],r)}else{for(const[t,e]of i)"class"===t?n.removeClass(e,r):n.removeAttribute(t,r);t.classes&&n.removeClass(t.classes,r);for(const e in t.styles)n.removeStyle(e,r)}}}))}}}const uy=function(t,e,n){var i=t.length;return n=void 0===n?i:n,!e&&n>=i?t:Ss(t,e,n)};var my=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");const gy=function(t){return my.test(t)};const py=function(t){return t.split("")};var fy="\\ud800-\\udfff",ky="["+fy+"]",by="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",wy="\\ud83c[\\udffb-\\udfff]",Ay="[^"+fy+"]",_y="(?:\\ud83c[\\udde6-\\uddff]){2}",Cy="[\\ud800-\\udbff][\\udc00-\\udfff]",vy="(?:"+by+"|"+wy+")"+"?",yy="[\\ufe0e\\ufe0f]?",xy=yy+vy+("(?:\\u200d(?:"+[Ay,_y,Cy].join("|")+")"+yy+vy+")*"),Ey="(?:"+[Ay+by+"?",by,_y,Cy,ky].join("|")+")",By=RegExp(wy+"(?="+wy+")|"+Ey+xy,"g");const Dy=function(t){return t.match(By)||[]};const Sy=function(t){return gy(t)?Dy(t):py(t)};const Ty=function(t){return function(e){e=ys(e);var n=gy(e)?Sy(e):void 0,i=n?n[0]:e.charAt(0),o=n?uy(n,1).join(""):e.slice(1);return i[t]()+o}}("toUpperCase"),Iy=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,Py=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,Fy=/^((\w+:(\/{2,})?)|(\W))/i,Ry=["https?","ftps?","mailto"],Vy="Ctrl+K";function Ly(t,{writer:e}){const n=e.createAttributeElement("a",{href:t},{priority:5});return e.setCustomProperty("link",!0,n),n}function My(t,e=Ry){const n=String(t),i=e.join("|");return function(t,e){const n=t.replace(Iy,"");return!!n.match(e)}(n,new RegExp(`${"^(?:(?:):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))".replace("",i)}`,"i"))?n:"#"}function zy(t,e){return!!t&&e.checkAttribute(t.name,"linkHref")}function Oy(t,e){const n=(i=t,Py.test(i)?"mailto:":e);var i;const o=!!n&&!Ny(t);return t&&o?n+t:t}function Ny(t){return Fy.test(t)}function Hy(t){window.open(t,"_blank","noopener")}class jy extends zr{manualDecorators=new xr;automaticDecorators=new hy;restoreManualDecoratorStates(){for(const t of this.manualDecorators)t.value=this._getDecoratorStateFromModel(t.id)}refresh(){const t=this.editor.model,e=t.document.selection,n=e.getSelectedElement()||Er(e.getSelectedBlocks());zy(n,t.schema)?(this.value=n.getAttribute("linkHref"),this.isEnabled=t.schema.checkAttribute(n,"linkHref")):(this.value=e.getAttribute("linkHref"),this.isEnabled=t.schema.checkAttributeInSelection(e,"linkHref"));for(const t of this.manualDecorators)t.value=this._getDecoratorStateFromModel(t.id)}execute(t,e={}){const n=this.editor.model,i=n.document.selection,o=[],r=[];for(const t in e)e[t]?o.push(t):r.push(t);n.change((e=>{if(i.isCollapsed){const s=i.getFirstPosition();if(i.hasAttribute("linkHref")){const a=qy(i);let c=yw(s,"linkHref",i.getAttribute("linkHref"),n);i.getAttribute("linkHref")===a&&(c=this._updateLinkContent(n,e,c,t)),e.setAttribute("linkHref",t,c),o.forEach((t=>{e.setAttribute(t,!0,c)})),r.forEach((t=>{e.removeAttribute(t,c)})),e.setSelection(e.createPositionAfter(c.end.nodeBefore))}else if(""!==t){const r=Sr(i.getAttributes());r.set("linkHref",t),o.forEach((t=>{r.set(t,!0)}));const{end:a}=n.insertContent(e.createText(t,r),s);e.setSelection(a)}["linkHref",...o,...r].forEach((t=>{e.removeSelectionAttribute(t)}))}else{const s=n.schema.getValidRanges(i.getRanges(),"linkHref"),a=[];for(const t of i.getSelectedBlocks())n.schema.checkAttribute(t,"linkHref")&&a.push(e.createRangeOn(t));const c=a.slice();for(const t of s)this._isRangeToUpdate(t,a)&&c.push(t);for(const s of c){let a=s;if(1===c.length){const o=qy(i);i.getAttribute("linkHref")===o&&(a=this._updateLinkContent(n,e,s,t),e.setSelection(e.createSelection(a)))}e.setAttribute("linkHref",t,a),o.forEach((t=>{e.setAttribute(t,!0,a)})),r.forEach((t=>{e.removeAttribute(t,a)}))}}}))}_getDecoratorStateFromModel(t){const e=this.editor.model,n=e.document.selection,i=n.getSelectedElement();return zy(i,e.schema)?i.getAttribute(t):n.getAttribute(t)}_isRangeToUpdate(t,e){for(const n of e)if(n.containsRange(t))return!1;return!0}_updateLinkContent(t,e,n,i){const o=e.createText(i,{linkHref:i});return t.insertContent(o,n)}}function qy(t){if(t.isCollapsed){const e=t.getFirstPosition();return e.textNode&&e.textNode.data}{const e=Array.from(t.getFirstRange().getItems());if(e.length>1)return null;const n=e[0];return n.is("$text")||n.is("$textProxy")?n.data:null}}class Wy extends zr{refresh(){const t=this.editor.model,e=t.document.selection,n=e.getSelectedElement();zy(n,t.schema)?this.isEnabled=t.schema.checkAttribute(n,"linkHref"):this.isEnabled=t.schema.checkAttributeInSelection(e,"linkHref")}execute(){const t=this.editor,e=this.editor.model,n=e.document.selection,i=t.commands.get("link");e.change((t=>{const o=n.isCollapsed?[yw(n.getFirstPosition(),"linkHref",n.getAttribute("linkHref"),e)]:e.schema.getValidRanges(n.getRanges(),"linkHref");for(const e of o)if(t.removeAttribute("linkHref",e),i)for(const n of i.manualDecorators)t.removeAttribute(n.id,e)}))}}class Uy extends(ji()){id;defaultValue;label;attributes;classes;styles;constructor({id:t,label:e,attributes:n,classes:i,styles:o,defaultValue:r}){super(),this.id=t,this.set("value",void 0),this.defaultValue=r,this.label=e,this.attributes=n,this.classes=i,this.styles=o}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}var $y=n(7719),Gy={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$r()($y.A,Gy);$y.A.locals;const Ky="automatic",Zy=/^(https?:)?\/\//;class Yy extends Lr{static get pluginName(){return"LinkEditing"}static get requires(){return[dw,Zb,c_]}constructor(t){super(t),t.config.define("link",{allowCreatingEmptyLinks:!1,addTargetToExternalLinks:!1})}init(){const t=this.editor,e=this.editor.config.get("link.allowedProtocols");t.model.schema.extend("$text",{allowAttributes:"linkHref"}),t.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:Ly}),t.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(t,n)=>Ly(My(t,e),n)}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:t=>t.getAttribute("href")}}),t.commands.add("link",new jy(t)),t.commands.add("unlink",new Wy(t));const n=function(t,e){const n={"Open in a new tab":t("Open in a new tab"),Downloadable:t("Downloadable")};return e.forEach((t=>("label"in t&&n[t.label]&&(t.label=n[t.label]),t))),e}(t.t,function(t){const e=[];if(t)for(const[n,i]of Object.entries(t)){const t=Object.assign({},i,{id:`link${Ty(n)}`});e.push(t)}return e}(t.config.get("link.decorators")));this._enableAutomaticDecorators(n.filter((t=>t.mode===Ky))),this._enableManualDecorators(n.filter((t=>"manual"===t.mode)));t.plugins.get(dw).registerAttribute("linkHref"),Ew(t,"linkHref","a","ck-link_selected"),this._enableSelectionAttributesFixer(),this._enableClipboardIntegration()}_enableAutomaticDecorators(t){const e=this.editor,n=e.commands.get("link").automaticDecorators;e.config.get("link.addTargetToExternalLinks")&&n.add({id:"linkIsExternal",mode:Ky,callback:t=>!!t&&Zy.test(t),attributes:{target:"_blank",rel:"noopener noreferrer"}}),n.add(t),n.length&&e.conversion.for("downcast").add(n.getDispatcher())}_enableManualDecorators(t){if(!t.length)return;const e=this.editor,n=e.commands.get("link").manualDecorators;t.forEach((t=>{e.model.schema.extend("$text",{allowAttributes:t.id});const i=new Uy(t);n.add(i),e.conversion.for("downcast").attributeToElement({model:i.id,view:(t,{writer:e,schema:n},{item:o})=>{if((o.is("selection")||n.isInline(o))&&t){const t=e.createAttributeElement("a",i.attributes,{priority:5});i.classes&&e.addClass(i.classes,t);for(const n in i.styles)e.setStyle(n,i.styles[n],t);return e.setCustomProperty("link",!0,t),t}}}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",...i._createPattern()},model:{key:i.id}})}))}_enableLinkOpen(){const t=this.editor,e=t.editing.view.document;this.listenTo(e,"click",((t,e)=>{if(!(Xn.isMac?e.domEvent.metaKey:e.domEvent.ctrlKey))return;let n=e.domTarget;if("a"!=n.tagName.toLowerCase()&&(n=n.closest("a")),!n)return;const i=n.getAttribute("href");i&&(t.stop(),e.preventDefault(),Hy(i))}),{context:"$capture"}),this.listenTo(e,"keydown",((e,n)=>{const i=t.commands.get("link").value;!!i&&n.keyCode===Go.enter&&n.altKey&&(e.stop(),Hy(i))}))}_enableSelectionAttributesFixer(){const t=this.editor.model,e=t.document.selection;this.listenTo(e,"change:attribute",((n,{attributeKeys:i})=>{i.includes("linkHref")&&!e.hasAttribute("linkHref")&&t.change((e=>{var n;!function(t,e){t.removeSelectionAttribute("linkHref");for(const n of e)t.removeSelectionAttribute(n)}(e,(n=t.schema,n.getDefinition("$text").allowAttributes.filter((t=>t.startsWith("link")))))}))}))}_enableClipboardIntegration(){const t=this.editor,e=t.model,n=this.editor.config.get("link.defaultProtocol");n&&this.listenTo(t.plugins.get("ClipboardPipeline"),"contentInsertion",((t,i)=>{e.change((t=>{const e=t.createRangeIn(i.content);for(const i of e.getItems())if(i.hasAttribute("linkHref")){const e=Oy(i.getAttribute("linkHref"),n);t.setAttribute("linkHref",e,i)}}))}))}}var Jy=n(3817),Qy={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$r()(Jy.A,Qy);Jy.A.locals;class Xy extends cm{focusTracker=new Br;keystrokes=new Dr;urlInputView;saveButtonView;cancelButtonView;_manualDecoratorSwitches;children;_validators;_focusables=new zu;_focusCycler;constructor(t,e,n){super(t);const i=t.t;this._validators=n,this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(i("Save"),Mu.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(i("Cancel"),Mu.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(e),this.children=this._createFormChildren(e.manualDecorators),this._focusCycler=new ym({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const o=["ck","ck-link-form","ck-responsive-form"];e.manualDecorators.length&&o.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:o,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce(((t,e)=>(t[e.name]=e.isOn,t)),{})}render(){super.render(),hm({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()}isValid(){this.resetFormStatus();for(const t of this._validators){const e=t(this);if(e)return this.urlInputView.errorText=e,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null}_createUrlInput(){const t=this.locale.t,e=new Sg(this.locale,Vp);return e.fieldView.inputMode="url",e.label=t("Link URL"),e}_createButton(t,e,n,i){const o=new wm(this.locale);return o.set({label:t,icon:e,tooltip:!0}),o.extendTemplate({attributes:{class:n}}),i&&o.delegate("execute").to(this,i),o}_createManualDecoratorSwitches(t){const e=this.createCollection();for(const n of t.manualDecorators){const i=new rg(this.locale);i.set({name:n.id,label:n.label,withText:!0}),i.bind("isOn").toMany([n,t],"value",((t,e)=>void 0===e&&void 0===t?!!n.defaultValue:!!t)),i.on("execute",(()=>{n.set("value",!i.isOn)})),e.add(i)}return e}_createFormChildren(t){const e=this.createCollection();if(e.add(this.urlInputView),t.length){const t=new cm;t.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map((t=>({tag:"li",children:[t],attributes:{class:["ck","ck-list__item"]}}))),attributes:{class:["ck","ck-reset","ck-list"]}}),e.add(t)}return e.add(this.saveButtonView),e.add(this.cancelButtonView),e}get url(){const{element:t}=this.urlInputView.fieldView;return t?t.value.trim():null}}var tx=n(8762),ex={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$r()(tx.A,ex);tx.A.locals;class nx extends cm{focusTracker=new Br;keystrokes=new Dr;previewButtonView;unlinkButtonView;editButtonView;_focusables=new zu;_focusCycler;_linkConfig;constructor(t,e={}){super(t);const n=t.t;this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(n("Unlink"),'',"unlink"),this.editButtonView=this._createButton(n("Edit link"),Mu.pencil,"edit"),this.set("href",void 0),this._linkConfig=e,this._focusCycler=new ym({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(t,e,n){const i=new wm(this.locale);return i.set({label:t,icon:e,tooltip:!0}),i.delegate("execute").to(this,n),i}_createPreviewButton(){const t=new wm(this.locale),e=this.bindTemplate,n=this.t;return t.set({withText:!0,tooltip:n("Open link in new tab")}),t.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:e.to("href",(t=>t&&My(t,this._linkConfig.allowedProtocols))),target:"_blank",rel:"noopener noreferrer"}}),t.bind("label").to(this,"href",(t=>t||n("This link has no URL"))),t.bind("isEnabled").to(this,"href",(t=>!!t)),t.template.tag="a",t.template.eventListeners={},t}}const ix="link-ui";class ox extends Lr{actionsView=null;formView=null;_balloon;static get requires(){return[yk]}static get pluginName(){return"LinkUI"}init(){const t=this.editor,e=this.editor.t;t.editing.view.addObserver(Nh),this._balloon=t.plugins.get(yk),this._createToolbarLinkButton(),this._enableBalloonActivators(),t.conversion.for("editingDowncast").markerToHighlight({model:ix,view:{classes:["ck-fake-link-selection"]}}),t.conversion.for("editingDowncast").markerToElement({model:ix,view:(t,{writer:e})=>{if(!t.markerRange.isCollapsed)return null;const n=e.createUIElement("span");return e.addClass(["ck-fake-link-selection","ck-fake-link-selection_collapsed"],n),n}}),t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Create link"),keystroke:Vy},{label:e("Move out of a link"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}destroy(){super.destroy(),this.formView&&this.formView.destroy(),this.actionsView&&this.actionsView.destroy()}_createViews(){this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._enableUserBalloonInteractions()}_createActionsView(){const t=this.editor,e=new nx(t.locale,t.config.get("link")),n=t.commands.get("link"),i=t.commands.get("unlink");return e.bind("href").to(n,"value"),e.editButtonView.bind("isEnabled").to(n),e.unlinkButtonView.bind("isEnabled").to(i),this.listenTo(e,"edit",(()=>{this._addFormView()})),this.listenTo(e,"unlink",(()=>{t.execute("unlink"),this._hideUI()})),e.keystrokes.set("Esc",((t,e)=>{this._hideUI(),e()})),e.keystrokes.set(Vy,((t,e)=>{this._addFormView(),e()})),e}_createFormView(){const t=this.editor,e=t.commands.get("link"),n=t.config.get("link.defaultProtocol"),i=new(dm(Xy))(t.locale,e,function(t){const e=t.t,n=t.config.get("link.allowCreatingEmptyLinks");return[t=>{if(!n&&!t.url.length)return e("Link URL must not be empty.")}]}(t));return i.urlInputView.fieldView.bind("value").to(e,"value"),i.urlInputView.bind("isEnabled").to(e,"isEnabled"),i.saveButtonView.bind("isEnabled").to(e,"isEnabled"),this.listenTo(i,"submit",(()=>{if(i.isValid()){const{value:e}=i.urlInputView.fieldView.element,o=Oy(e,n);t.execute("link",o,i.getDecoratorSwitchesState()),this._closeFormView()}})),this.listenTo(i.urlInputView,"change:errorText",(()=>{t.ui.update()})),this.listenTo(i,"cancel",(()=>{this._closeFormView()})),i.keystrokes.set("Esc",((t,e)=>{this._closeFormView(),e()})),i}_createToolbarLinkButton(){const t=this.editor;t.ui.componentFactory.add("link",(()=>{const t=this._createButton(wm);return t.set({tooltip:!0}),t})),t.ui.componentFactory.add("menuBar:link",(()=>{const t=this._createButton(Ym);return t.set({role:"menuitemcheckbox"}),t}))}_createButton(t){const e=this.editor,n=e.locale,i=e.commands.get("link"),o=new t(e.locale),r=n.t;return o.set({label:r("Link"),icon:'',keystroke:Vy,isToggleable:!0}),o.bind("isEnabled").to(i,"isEnabled"),o.bind("isOn").to(i,"value",(t=>!!t)),this.listenTo(o,"execute",(()=>this._showUI(!0))),o}_enableBalloonActivators(){const t=this.editor,e=t.editing.view.document;this.listenTo(e,"click",(()=>{this._getSelectedLinkElement()&&this._showUI()})),t.keystrokes.set(Vy,((e,n)=>{n(),t.commands.get("link").isEnabled&&this._showUI(!0)}))}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",((t,e)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),e())}),{priority:"high"}),this.editor.keystrokes.set("Esc",((t,e)=>{this._isUIVisible&&(this._hideUI(),e())})),lm({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.formView.resetFormStatus(),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 t=this.editor.commands.get("link");t.restoreManualDecoratorStates(),void 0!==t.value?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this.formView.urlInputView.fieldView.reset(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(t=!1){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),t&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),t&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const t=this.editor;this.stopListening(t.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),t.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const t=this.editor,e=t.editing.view.document;let n=this._getSelectedLinkElement(),i=r();const o=()=>{const t=this._getSelectedLinkElement(),e=r();n&&!t||!n&&e!==i?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),n=t,i=e};function r(){return e.selection.focus.getAncestors().reverse().find((t=>t.is("element")))}this.listenTo(t.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 t=this._balloon.visibleView;return!!this.formView&&t==this.formView||this._areActionsVisible}_getBalloonPositionData(){const t=this.editor.editing.view,e=this.editor.model,n=t.document;let i;if(e.markers.has(ix)){const e=Array.from(this.editor.editing.mapper.markerNameToElements(ix)),n=t.createRange(t.createPositionBefore(e[0]),t.createPositionAfter(e[e.length-1]));i=t.domConverter.viewRangeToDom(n)}else i=()=>{const e=this._getSelectedLinkElement();return e?t.domConverter.mapViewToDom(e):t.domConverter.viewRangeToDom(n.selection.getFirstRange())};return{target:i}}_getSelectedLinkElement(){const t=this.editor.editing.view,e=t.document.selection,n=e.getSelectedElement();if(e.isCollapsed||n&&p_(n))return rx(e.getFirstPosition());{const n=e.getFirstRange().getTrimmed(),i=rx(n.start),o=rx(n.end);return i&&i==o&&t.createRangeIn(i).getTrimmed().isEqual(n)?i:null}}_showFakeVisualSelection(){const t=this.editor.model;t.change((e=>{const n=t.document.selection.getFirstRange();if(t.markers.has(ix))e.updateMarker(ix,{range:n});else if(n.start.isAtEnd){const i=n.start.getLastMatchingPosition((({item:e})=>!t.schema.isContent(e)),{boundaries:n});e.addMarker(ix,{usingOperation:!1,affectsData:!1,range:e.createRange(i,n.end)})}else e.addMarker(ix,{usingOperation:!1,affectsData:!1,range:n})}))}_hideFakeVisualSelection(){const t=this.editor.model;t.markers.has(ix)&&t.change((t=>{t.removeMarker(ix)}))}}function rx(t){return t.getAncestors().find((t=>{return(e=t).is("attributeElement")&&!!e.getCustomProperty("link");var e}))||null}const sx=new RegExp("(^|\\s)(((?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(((?!www\\.)|(www\\.))(?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.)+(?:[a-z\\u00a1-\\uffff]{2,63})))(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-_a-z0-9\\u00a1-\\uffff]{1,63}\\.))+(?:[a-z\\u00a1-\\uffff]{2,63})))$","i");class ax extends Lr{static get requires(){return[sw,Yy]}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(t,e){return e.textNode&&e.textNode.hasAttribute("linkHref")?yw(e,"linkHref",e.textNode.getAttribute("linkHref"),t):null}_selectEntireLinks(t,e){const n=this.editor.model,i=n.document.selection,o=i.getFirstPosition(),r=i.getLastPosition();let s=e.getJoined(this._expandLinkRange(n,o)||e);s&&(s=s.getJoined(this._expandLinkRange(n,r)||e)),s&&(s.start.isBefore(o)||s.end.isAfter(r))&&t.setSelection(s)}_enablePasteLinking(){const t=this.editor,e=t.model,n=e.document.selection,i=t.plugins.get("ClipboardPipeline"),o=t.commands.get("link");i.on("inputTransformation",((t,i)=>{if(!this.isEnabled||!o.isEnabled||n.isCollapsed||"paste"!==i.method)return;if(n.rangeCount>1)return;const r=n.getFirstRange(),s=i.dataTransfer.getData("text/plain");if(!s)return;const a=s.match(sx);a&&a[2]===s&&(e.change((t=>{this._selectEntireLinks(t,r),o.execute(s)})),t.stop())}),{priority:"high"})}_enableTypingHandling(){const t=this.editor,e=new lw(t.model,(t=>{if(!function(t){return t.length>4&&" "===t[t.length-1]&&" "!==t[t.length-2]}(t))return;const e=cx(t.substr(0,t.length-1));return e?{url:e}:void 0}));e.on("matched:data",((e,n)=>{const{batch:i,range:o,url:r}=n;if(!i.isTyping)return;const s=o.end.getShiftedBy(-1),a=s.getShiftedBy(-r.length),c=t.model.createRange(a,s);this._applyAutoLink(r,c)})),e.bind("isEnabled").to(this)}_enableEnterHandling(){const t=this.editor,e=t.model,n=t.commands.get("enter");n&&n.on("execute",(()=>{const t=e.document.selection.getFirstPosition();if(!t.parent.previousSibling)return;const n=e.createRangeIn(t.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(n)}))}_enableShiftEnterHandling(){const t=this.editor,e=t.model,n=t.commands.get("shiftEnter");n&&n.on("execute",(()=>{const t=e.document.selection.getFirstPosition(),n=e.createRange(e.createPositionAt(t.parent,0),t.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(n)}))}_checkAndApplyAutoLinkOnRange(t){const e=this.editor.model,{text:n,range:i}=cw(t,e),o=cx(n);if(o){const t=e.createRange(i.end.getShiftedBy(-o.length),i.end);this._applyAutoLink(o,t)}}_applyAutoLink(t,e){const n=this.editor.model,i=Oy(t,this.editor.config.get("link.defaultProtocol"));this.isEnabled&&function(t,e){return e.schema.checkAttributeInSelection(e.createSelection(t),"linkHref")}(e,n)&&Ny(i)&&!function(t){const e=t.start.nodeAfter;return!!e&&e.hasAttribute("linkHref")}(e)&&this._persistAutoLink(i,e)}_persistAutoLink(t,e){const n=this.editor.model,i=this.editor.plugins.get("Delete");n.enqueueChange((o=>{o.setAttribute("linkHref",t,e),n.enqueueChange((()=>{i.requestUndoOnBackspace()}))}))}}function cx(t){const e=sx.exec(t);return e?e[2]:null}var lx=n(4808),dx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$r()(lx.A,dx);lx.A.locals;class hx{_startElement;_referenceIndent;_isForward;_includeSelf;_sameAttributes;_sameIndent;_lowerIndent;_higherIndent;constructor(t,e){this._startElement=t,this._referenceIndent=t.getAttribute("listIndent"),this._isForward="forward"==e.direction,this._includeSelf=!!e.includeSelf,this._sameAttributes=tr(e.sameAttributes||[]),this._sameIndent=!!e.sameIndent,this._lowerIndent=!!e.lowerIndent,this._higherIndent=!!e.higherIndent}static first(t,e){return Er(new this(t,e)[Symbol.iterator]())}*[Symbol.iterator](){const t=[];for(const{node:e}of ux(this._getStartNode(),this._isForward?"forward":"backward")){const n=e.getAttribute("listIndent");if(nthis._referenceIndent){if(!this._higherIndent)continue;if(!this._isForward){t.push(e);continue}}else{if(!this._sameIndent){if(this._higherIndent){t.length&&(yield*t,t.length=0);break}continue}if(this._sameAttributes.some((t=>e.getAttribute(t)!==this._startElement.getAttribute(t))))break}t.length&&(yield*t,t.length=0),yield e}}_getStartNode(){return this._includeSelf?this._startElement:this._isForward?this._startElement.nextSibling:this._startElement.previousSibling}}function*ux(t,e="forward"){const n="forward"==e,i=[];let o=null;for(;px(t);){let e=null;if(o){const n=t.getAttribute("listIndent"),r=o.getAttribute("listIndent");n>r?i[r]=o:nt.getAttribute("listItemId")!=e))}function Dx(t){return Array.from(t).filter((t=>"$graveyard"!==t.root.rootName)).sort(((t,e)=>t.index-e.index))}function Sx(t){const e=t.document.selection.getSelectedElement();return e&&t.schema.isObject(e)&&t.schema.isBlock(e)?e:null}function Tx(t,e){return e.checkChild(t.parent,"listItem")&&e.checkChild(t,"$text")&&!e.isObject(t)}function Ix(t){return"numbered"==t||"customNumbered"==t}function Px(t,e,n){return kx(e,{direction:"forward"}).pop().index>t.index?yx(t,e,n):[]}class Fx extends zr{_direction;constructor(t,e){super(t),this._direction=e}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model,e=Rx(t.document.selection);t.change((t=>{const n=[];Bx(e)&&!wx(e[0])?("forward"==this._direction&&n.push(...xx(e,t)),n.push(...vx(e[0],t))):"forward"==this._direction?n.push(...xx(e,t,{expand:!0})):n.push(...function(t,e){const n=_x(t=tr(t)),i=new Set,o=Math.min(...n.map((t=>t.getAttribute("listIndent")))),r=new Map;for(const t of n)r.set(t,hx.first(t,{lowerIndent:!0}));for(const t of n){if(i.has(t))continue;i.add(t);const n=t.getAttribute("listIndent")-1;if(n<0)Ex(t,e);else{if(t.getAttribute("listIndent")==o){const n=Px(t,r.get(t),e);for(const t of n)i.add(t);if(n.length)continue}e.setAttribute("listIndent",n,t)}}return Dx(i)}(e,t));for(const e of n){if(!e.hasAttribute("listType"))continue;const n=hx.first(e,{sameIndent:!0});n&&t.setAttribute("listType",n.getAttribute("listType"),e)}this._fireAfterExecute(n)}))}_fireAfterExecute(t){this.fire("afterExecute",Dx(new Set(t)))}_checkEnabled(){let t=Rx(this.editor.model.document.selection),e=t[0];if(!e)return!1;if("backward"==this._direction)return!0;if(Bx(t)&&!wx(t[0]))return!0;t=_x(t),e=t[0];const n=hx.first(e,{sameIndent:!0});return!!n&&n.getAttribute("listType")==e.getAttribute("listType")}}function Rx(t){const e=Array.from(t.getSelectedBlocks()),n=e.findIndex((t=>!px(t)));return-1!=n&&(e.length=n),e}class Vx extends zr{type;_listWalkerOptions;constructor(t,e,n={}){super(t),this.type=e,this._listWalkerOptions=n.multiLevel?{higherIndent:!0,lowerIndent:!0,sameAttributes:[]}:void 0}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,n=e.document,i=Sx(e),o=Array.from(n.selection.getSelectedBlocks()).filter((t=>e.schema.checkAttribute(t,"listType")||Tx(t,e.schema))),r=void 0!==t.forceValue?!t.forceValue:this.value;e.change((s=>{if(r){const t=o[o.length-1],e=kx(t,{direction:"forward"}),n=[];e.length>1&&n.push(...vx(e[1],s)),n.push(...Ex(o,s)),n.push(...function(t,e){const n=[];let i=Number.POSITIVE_INFINITY;for(const{node:o}of ux(t.nextSibling,"forward")){const t=o.getAttribute("listIndent");if(0==t)break;t{const{firstElement:r,lastElement:s}=this._getMergeSubjectElements(n,t),a=r.getAttribute("listIndent")||0,c=s.getAttribute("listIndent"),l=s.getAttribute("listItemId");if(a!=c){const t=(d=s,Array.from(new hx(d,{direction:"forward",higherIndent:!0})));i.push(...xx([s,...t],o,{indentBy:a-c,expand:a{const e=vx(this._getStartBlock(),t);this._fireAfterExecute(e)}))}_fireAfterExecute(t){this.fire("afterExecute",Dx(new Set(t)))}_checkEnabled(){const t=this.editor.model.document.selection,e=this._getStartBlock();return t.isCollapsed&&px(e)&&!wx(e)}_getStartBlock(){const t=this.editor.model.document.selection.getFirstPosition().parent;return"before"==this._direction?t:t.nextSibling}}class zx extends Lr{static get pluginName(){return"ListUtils"}expandListBlocksToCompleteList(t){return Cx(t)}isFirstBlockOfListItem(t){return wx(t)}isListItemBlock(t){return px(t)}expandListBlocksToCompleteItems(t,e={}){return _x(t,e)}isNumberedListType(t){return Ix(t)}}function Ox(t){return t.is("element","ol")||t.is("element","ul")}function Nx(t){return t.is("element","li")}function Hx(t,e,n,i=Wx(n,e)){return t.createAttributeElement(qx(n),null,{priority:2*e/100-100,id:i})}function jx(t,e,n){return t.createAttributeElement("li",null,{priority:(2*e+1)/100-100,id:n})}function qx(t){return"numbered"==t||"customNumbered"==t?"ol":"ul"}function Wx(t,e){return`list-${t}-${e}`}function Ux(t,e){const n=t.nodeBefore;if(px(n)){let t=n;for(const{node:n}of ux(t,"backward"))if(t=n,e.has(t))return;e.set(n,t)}else{const n=t.nodeAfter;px(n)&&e.set(n,n)}}function $x(){return(t,e,n)=>{const{writer:i,schema:o}=n;if(!e.modelRange)return;const r=Array.from(e.modelRange.getItems({shallow:!0})).filter((t=>o.checkAttribute(t,"listItemId")));if(!r.length)return;const s=gx.next(),a=function(t){let e=0,n=t.parent;for(;n;){if(Nx(n))e++;else{const t=n.previousSibling;t&&Nx(t)&&e++}n=n.parent}return e}(e.viewItem);let c=e.viewItem.parent&&e.viewItem.parent.is("element","ol")?"numbered":"bulleted";const l=r[0].getAttribute("listType");l&&(c=l);const d={listItemId:s,listIndent:a,listType:c};for(const t of r)t.hasAttribute("listItemId")||i.setAttributes(d,t);r.length>1&&r[1].getAttribute("listItemId")!=d.listItemId&&n.keepEmptyElement(r[0])}}function Gx(t,e,n,{dataPipeline:i}={}){const o=function(t){return(e,n)=>{const i=[];for(const n of t)e.hasAttribute(n)&&i.push(`attribute:${n}`);return!!i.every((t=>!1!==n.test(e,t)))&&(i.forEach((t=>n.consume(e,t))),!0)}}(t);return(r,s,a)=>{const{writer:c,mapper:l,consumable:d}=a,h=s.item;if(!t.includes(s.attributeKey))return;if(!o(h,d))return;const u=function(t,e,n){const i=n.createRangeOn(t),o=e.toViewRange(i).getTrimmed();return o.end.nodeBefore}(h,l,n);Zx(u,c,l),function(t,e){let n=t.parent;for(;n.is("attributeElement")&&["ul","ol","li"].includes(n.name);){const i=n.parent;e.unwrap(e.createRangeOn(t),n),n=i}}(u,c);const m=function(t,e,n,i,{dataPipeline:o}){let r=i.createRangeOn(e);if(!wx(t))return r;for(const s of n){if("itemMarker"!=s.scope)continue;const n=s.createElement(i,t,{dataPipeline:o});if(!n)continue;if(i.setCustomProperty("listItemMarker",!0,n),s.canInjectMarkerIntoElement&&s.canInjectMarkerIntoElement(t)?i.insert(i.createPositionAt(e,0),n):(i.insert(r.start,n),r=i.createRange(i.createPositionBefore(n),i.createPositionAfter(e))),!s.createWrapperElement||!s.canWrapElement)continue;const a=s.createWrapperElement(i,t,{dataPipeline:o});i.setCustomProperty("listItemWrapper",!0,a),s.canWrapElement(t)?r=i.wrap(r,a):(r=i.wrap(i.createRangeOn(n),a),r=i.createRange(r.start,i.createPositionAfter(e)))}return r}(h,u,e,c,{dataPipeline:i});!function(t,e,n,i){if(!t.hasAttribute("listIndent"))return;const o=t.getAttribute("listIndent");let r=t;for(let t=o;t>=0;t--){const o=jx(i,t,r.getAttribute("listItemId")),s=Hx(i,t,r.getAttribute("listType"));for(const t of n)"list"!=t.scope&&"item"!=t.scope||!r.hasAttribute(t.attributeName)||t.setAttributeOnDowncast(i,r.getAttribute(t.attributeName),"list"==t.scope?s:o);if(e=i.wrap(e,o),e=i.wrap(e,s),0==t)break;if(r=hx.first(r,{lowerIndent:!0}),!r)break}}(h,m,e,c)}}function Kx(t,{dataPipeline:e}={}){return(n,{writer:i})=>{if(!Yx(n,t))return null;if(!e)return i.createContainerElement("span",{class:"ck-list-bogus-paragraph"});const o=i.createContainerElement("p");return i.setCustomProperty("dataPipeline:transparentRendering",!0,o),o}}function Zx(t,e,n){for(;t.parent.is("attributeElement")&&t.parent.getCustomProperty("listItemWrapper");)e.unwrap(e.createRangeOn(t),t.parent);const i=[];o(e.createPositionBefore(t).getWalker({direction:"backward"})),o(e.createRangeIn(t).getWalker());for(const t of i)e.remove(t);function o(t){for(const{item:e}of t){if(e.is("element")&&n.toModelElement(e))break;e.is("element")&&e.getCustomProperty("listItemMarker")&&i.push(e)}}}function Yx(t,e,n=fx(t)){if(!px(t))return!1;for(const n of t.getAttributeKeys())if(!n.startsWith("selection:")&&!e.includes(n))return!1;return n.length<2}var Jx=n(1232),Qx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$r()(Jx.A,Qx);Jx.A.locals;var Xx=n(6903),tE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$r()(Xx.A,tE);Xx.A.locals;const eE=["listType","listIndent","listItemId"];class nE extends Lr{_downcastStrategies=[];static get pluginName(){return"ListEditing"}static get requires(){return[pA,sw,zx,c_]}constructor(t){super(t),t.config.define("list.multiBlock",!0)}init(){const t=this.editor,e=t.model,n=t.config.get("list.multiBlock");if(t.plugins.has("LegacyListEditing"))throw new bi("list-feature-conflict",this,{conflictPlugin:"LegacyListEditing"});e.schema.register("$listItem",{allowAttributes:eE}),n?(e.schema.extend("$container",{allowAttributesOf:"$listItem"}),e.schema.extend("$block",{allowAttributesOf:"$listItem"}),e.schema.extend("$blockObject",{allowAttributesOf:"$listItem"})):e.schema.register("listItem",{inheritAllFrom:"$block",allowAttributesOf:"$listItem"});for(const t of eE)e.schema.setAttributeProperties(t,{copyOnReplace:!0});t.commands.add("numberedList",new Vx(t,"numbered")),t.commands.add("bulletedList",new Vx(t,"bulleted")),t.commands.add("customNumberedList",new Vx(t,"customNumbered",{multiLevel:!0})),t.commands.add("customBulletedList",new Vx(t,"customBulleted",{multiLevel:!0})),t.commands.add("indentList",new Fx(t,"forward")),t.commands.add("outdentList",new Fx(t,"backward")),t.commands.add("splitListItemBefore",new Mx(t,"before")),t.commands.add("splitListItemAfter",new Mx(t,"after")),n&&(t.commands.add("mergeListItemBackward",new Lx(t,"backward")),t.commands.add("mergeListItemForward",new Lx(t,"forward"))),this._setupDeleteIntegration(),this._setupEnterIntegration(),this._setupTabIntegration(),this._setupClipboardIntegration(),this._setupAccessibilityIntegration()}afterInit(){const t=this.editor.commands,e=t.get("indent"),n=t.get("outdent");e&&e.registerChildCommand(t.get("indentList"),{priority:"high"}),n&&n.registerChildCommand(t.get("outdentList"),{priority:"lowest"}),this._setupModelPostFixing(),this._setupConversion()}registerDowncastStrategy(t){this._downcastStrategies.push(t)}getListAttributeNames(){return[...eE,...this._downcastStrategies.map((t=>t.attributeName))]}_setupDeleteIntegration(){const t=this.editor,e=t.commands.get("mergeListItemBackward"),n=t.commands.get("mergeListItemForward");this.listenTo(t.editing.view.document,"delete",((i,o)=>{const r=t.model.document.selection;Sx(t.model)||t.model.change((()=>{const s=r.getFirstPosition();if(r.isCollapsed&&"backward"==o.direction){if(!s.isAtStart)return;const n=s.parent;if(!px(n))return;if(hx.first(n,{sameAttributes:"listType",sameIndent:!0})||0!==n.getAttribute("listIndent")){if(!e||!e.isEnabled)return;e.execute({shouldMergeOnBlocksContentLevel:iE(t.model,"backward")})}else Ax(n)||t.execute("splitListItemAfter"),t.execute("outdentList");o.preventDefault(),i.stop()}else{if(r.isCollapsed&&!r.getLastPosition().isAtEnd)return;if(!n||!n.isEnabled)return;n.execute({shouldMergeOnBlocksContentLevel:iE(t.model,"forward")}),o.preventDefault(),i.stop()}}))}),{context:"li"})}_setupEnterIntegration(){const t=this.editor,e=t.model,n=t.commands,i=n.get("enter");this.listenTo(t.editing.view.document,"enter",((n,i)=>{const o=e.document,r=o.selection.getFirstPosition().parent;if(o.selection.isCollapsed&&px(r)&&r.isEmpty&&!i.isSoft){const e=wx(r),o=Ax(r);e&&o?(t.execute("outdentList"),i.preventDefault(),n.stop()):e&&!o?(t.execute("splitListItemAfter"),i.preventDefault(),n.stop()):o&&(t.execute("splitListItemBefore"),i.preventDefault(),n.stop())}}),{context:"li"}),this.listenTo(i,"afterExecute",(()=>{const e=n.get("splitListItemBefore");if(e.refresh(),!e.isEnabled)return;2===fx(t.model.document.selection.getLastPosition().parent).length&&e.execute()}))}_setupTabIntegration(){const t=this.editor;this.listenTo(t.editing.view.document,"tab",((e,n)=>{const i=n.shiftKey?"outdentList":"indentList";this.editor.commands.get(i).isEnabled&&(t.execute(i),n.stopPropagation(),n.preventDefault(),e.stop())}),{context:"li"})}_setupConversion(){const t=this.editor,e=t.model,n=this.getListAttributeNames(),i=t.config.get("list.multiBlock"),o=i?"paragraph":"listItem";t.conversion.for("upcast").elementToElement({view:"li",model:(t,{writer:e})=>e.createElement(o,{listType:""})}).elementToElement({view:"p",model:(t,{writer:e})=>t.parent&&t.parent.is("element","li")?e.createElement(o,{listType:""}):null,converterPriority:"high"}).add((t=>{t.on("element:li",$x())})),i||t.conversion.for("downcast").elementToElement({model:"listItem",view:"p"}),t.conversion.for("editingDowncast").elementToElement({model:o,view:Kx(n),converterPriority:"high"}).add((t=>{var i;t.on("attribute",Gx(n,this._downcastStrategies,e)),t.on("remove",(i=e.schema,(t,e,n)=>{const{writer:o,mapper:r}=n,s=t.name.split(":")[1];if(!i.checkAttribute(s,"listItemId"))return;const a=r.toViewPosition(e.position),c=e.position.getShiftedBy(e.length),l=r.toViewPosition(c,{isPhantom:!0}),d=o.createRange(a,l).getTrimmed().end.nodeBefore;d&&Zx(d,o,r)}))})),t.conversion.for("dataDowncast").elementToElement({model:o,view:Kx(n,{dataPipeline:!0}),converterPriority:"high"}).add((t=>{t.on("attribute",Gx(n,this._downcastStrategies,e,{dataPipeline:!0}))}));const r=(s=this._downcastStrategies,a=t.editing.view,(t,e)=>{if(e.modelPosition.offset>0)return;const n=e.modelPosition.parent;if(!px(n))return;if(!s.some((t=>"itemMarker"==t.scope&&t.canInjectMarkerIntoElement&&t.canInjectMarkerIntoElement(n))))return;const i=e.mapper.toViewElement(n),o=a.createRangeIn(i),r=o.getWalker();let c=o.start;for(const{item:t}of r){if(t.is("element")&&e.mapper.toModelElement(t)||t.is("$textProxy"))break;t.is("element")&&t.getCustomProperty("listItemMarker")&&(c=a.createPositionAfter(t),r.skip((({previousPosition:t})=>!t.isEqual(c))))}e.viewPosition=c});var s,a;t.editing.mapper.on("modelToViewPosition",r),t.data.mapper.on("modelToViewPosition",r),this.listenTo(e.document,"change:data",function(t,e,n,i){return()=>{const i=t.document.differ.getChanges(),s=[],a=new Map,c=new Set;for(const t of i)if("insert"==t.type&&"$text"!=t.name)Ux(t.position,a),t.attributes.has("listItemId")?c.add(t.position.nodeAfter):Ux(t.position.getShiftedBy(t.length),a);else if("remove"==t.type&&t.attributes.has("listItemId"))Ux(t.position,a);else if("attribute"==t.type){const e=t.range.start.nodeAfter;n.includes(t.attributeKey)?(Ux(t.range.start,a),null===t.attributeNewValue?(Ux(t.range.start.getShiftedBy(1),a),r(e)&&s.push(e)):c.add(e)):px(e)&&r(e)&&s.push(e)}for(const t of a.values())s.push(...o(t,c));for(const t of new Set(s))e.reconvertItem(t)};function o(t,e){const i=[],o=new Set,a=[];for(const{node:c,previous:l}of ux(t,"forward")){if(o.has(c))continue;const t=c.getAttribute("listIndent");l&&tn.includes(t))));const d=kx(c,{direction:"forward"});for(const t of d)o.add(t),(r(t,d)||s(t,a,e))&&i.push(t)}return i}function r(t,o){const r=e.mapper.toViewElement(t);if(!r)return!1;if(i.fire("checkElement",{modelElement:t,viewElement:r}))return!0;if(!t.is("element","paragraph")&&!t.is("element","listItem"))return!1;const s=Yx(t,n,o);return!(!s||!r.is("element","p"))||!(s||!r.is("element","span"))}function s(t,n,o){if(o.has(t))return!1;const r=e.mapper.toViewElement(t);let s=n.length-1;for(let t=r.parent;!t.is("editableElement");t=t.parent){const e=Nx(t),o=Ox(t);if(!o&&!e)continue;const r="checkAttributes:"+(e?"item":"list");if(i.fire(r,{viewElement:t,modelAttributes:n[s]}))break;if(o&&(s--,s<0))return!1}return!0}}(e,t.editing,n,this),{priority:"high"}),this.on("checkAttributes:item",((t,{viewElement:e,modelAttributes:n})=>{e.id!=n.listItemId&&(t.return=!0,t.stop())})),this.on("checkAttributes:list",((t,{viewElement:e,modelAttributes:n})=>{e.name==qx(n.listType)&&e.id==Wx(n.listType,n.listIndent)||(t.return=!0,t.stop())}))}_setupModelPostFixing(){const t=this.editor.model,e=this.getListAttributeNames();t.document.registerPostFixer((n=>function(t,e,n,i){const o=t.document.differ.getChanges(),r=new Map,s=i.editor.config.get("list.multiBlock");let a=!1;for(const i of o){if("insert"==i.type&&"$text"!=i.name){const o=i.position.nodeAfter;if(!t.schema.checkAttribute(o,"listItemId"))for(const t of Array.from(o.getAttributeKeys()))n.includes(t)&&(e.removeAttribute(t,o),a=!0);Ux(i.position,r),i.attributes.has("listItemId")||Ux(i.position.getShiftedBy(i.length),r);for(const{item:e,previousPosition:n}of t.createRangeIn(o))px(e)&&Ux(n,r)}else"remove"==i.type?Ux(i.position,r):"attribute"==i.type&&n.includes(i.attributeKey)&&(Ux(i.range.start,r),null===i.attributeNewValue&&Ux(i.range.start.getShiftedBy(1),r));if(!s&&"attribute"==i.type&&eE.includes(i.attributeKey)){const t=i.range.start.nodeAfter;null===i.attributeNewValue&&t&&t.is("element","listItem")?(e.rename(t,"paragraph"),a=!0):null===i.attributeOldValue&&t&&t.is("element")&&"listItem"!=t.name&&(e.rename(t,"listItem"),a=!0)}}const c=new Set;for(const t of r.values())a=i.fire("postFixer",{listNodes:new mx(t),listHead:t,writer:e,seenIds:c})||a;return a}(t,n,e,this))),this.on("postFixer",((t,{listNodes:e,writer:n})=>{t.return=function(t,e){let n=0,i=-1,o=null,r=!1;for(const{node:s}of t){const t=s.getAttribute("listIndent");if(t>n){let a;null===o?(o=t-n,a=n):(o>t&&(o=t),a=t-o),a>i+1&&(a=i+1),e.setAttribute("listIndent",a,s),r=!0,i=a}else o=null,n=t+1,i=t}return r}(e,n)||t.return}),{priority:"high"}),this.on("postFixer",((t,{listNodes:e,writer:n,seenIds:i})=>{t.return=function(t,e,n){const i=new Set;let o=!1;for(const{node:r}of t){if(i.has(r))continue;let t=r.getAttribute("listType"),s=r.getAttribute("listItemId");if(e.has(s)&&(s=gx.next()),e.add(s),r.is("element","listItem"))r.getAttribute("listItemId")!=s&&(n.setAttribute("listItemId",s,r),o=!0);else for(const e of kx(r,{direction:"forward"}))i.add(e),e.getAttribute("listType")!=t&&(s=gx.next(),t=e.getAttribute("listType")),e.getAttribute("listItemId")!=s&&(n.setAttribute("listItemId",s,e),o=!0)}return o}(e,i,n)||t.return}),{priority:"high"})}_setupClipboardIntegration(){const t=this.editor.model,e=this.editor.plugins.get("ClipboardPipeline");this.listenTo(t,"insertContent",function(t){return(e,[n,i])=>{const o=n.is("documentFragment")?Array.from(n.getChildren()):[n];if(!o.length)return;const r=(i?t.createSelection(i):t.document.selection).getFirstPosition();let s;if(px(r.parent))s=r.parent;else{if(!px(r.nodeBefore))return;s=r.nodeBefore}t.change((t=>{const e=s.getAttribute("listType"),n=s.getAttribute("listIndent"),i=o[0].getAttribute("listIndent")||0,r=Math.max(n-i,0);for(const n of o){const i=px(n);s.is("element","listItem")&&n.is("element","paragraph")&&t.rename(n,"listItem"),t.setAttributes({listIndent:(i?n.getAttribute("listIndent"):0)+r,listItemId:i?n.getAttribute("listItemId"):gx.next(),listType:e},n)}}))}}(t),{priority:"high"}),this.listenTo(e,"outputTransformation",((e,n)=>{t.change((t=>{const e=Array.from(n.content.getChildren()),i=e[e.length-1];if(e.length>1&&i.is("element")&&i.isEmpty){e.slice(0,-1).every(px)&&t.remove(i)}if("copy"==n.method||"cut"==n.method){const e=Array.from(n.content.getChildren());Bx(e)&&Ex(e,t)}}))}))}_setupAccessibilityIntegration(){const t=this.editor,e=t.t;t.accessibility.addKeystrokeInfoGroup({id:"list",label:e("Keystrokes that can be used in a list"),keystrokes:[{label:e("Increase list item indent"),keystroke:"Tab"},{label:e("Decrease list item indent"),keystroke:"Shift+Tab"}]})}}function iE(t,e){const n=t.document.selection;if(!n.isCollapsed)return!Sx(t);if("forward"===e)return!0;const i=n.getFirstPosition().parent,o=i.previousSibling;return!t.schema.isObject(o)&&(!!o.isEmpty||Bx([i,o]))}function oE(t,e,n,i){t.ui.componentFactory.add(e,(()=>{const o=rE(wm,t,e,n,i);return o.set({tooltip:!0,isToggleable:!0}),o})),t.ui.componentFactory.add(`menuBar:${e}`,(()=>{const o=rE(Ym,t,e,n,i);return o.set({role:"menuitemcheckbox",isToggleable:!0}),o}))}function rE(t,e,n,i,o){const r=e.commands.get(n),s=new t(e.locale);return s.set({label:i,icon:o}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.on("execute",(()=>{e.execute(n),e.editing.view.focus()})),s}class sE extends Lr{static get pluginName(){return"ListUI"}init(){const t=this.editor.t;this.editor.ui.componentFactory.has("numberedList")||oE(this.editor,"numberedList",t("Numbered List"),Mu.numberedList),this.editor.ui.componentFactory.has("bulletedList")||oE(this.editor,"bulletedList",t("Bulleted List"),Mu.bulletedList)}}class aE extends Lr{static get requires(){return[nE,sE]}static get pluginName(){return"List"}}const cE={},lE={},dE={},hE=[{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:t,typeAttribute:e,listType:n}of hE)cE[t]=n,lE[t]=e,e&&(dE[e]=t);var uE=n(9968),mE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$r()(uE.A,mE);uE.A.locals;var gE=n(7141),pE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$r()(gE.A,pE);gE.A.locals;class fE extends zr{constructor(t){super(t),this.on("execute",(()=>{this.refresh()}),{priority:"highest"})}refresh(){const t=this._getSelectedItems();this.value=this._getValue(t),this.isEnabled=!!t.length}execute(t={}){this.editor.model.change((e=>{const n=this._getSelectedItems(),i=void 0===t.forceValue?!this._getValue(n):t.forceValue;for(const t of n)i?e.setAttribute("todoListChecked",!0,t):e.removeAttribute("todoListChecked",t)}))}_getValue(t){return t.every((t=>t.getAttribute("todoListChecked")))}_getSelectedItems(){const t=this.editor.model,e=t.schema,n=t.document.selection.getFirstRange(),i=n.start.parent,o=[];e.checkAttribute(i,"todoListChecked")&&o.push(...fx(i));for(const t of n.getItems({shallow:!0}))e.checkAttribute(t,"todoListChecked")&&!o.includes(t)&&o.push(...fx(t));return o}}class kE extends nc{domEventType=["change"];onDomEvent(t){if(t.target){const e=this.view.domConverter.mapDomToView(t.target);e&&e.is("element","input")&&"checkbox"==e.getAttribute("type")&&e.findAncestor({classes:"todo-list__label"})&&this.fire("todoCheckboxChange",t)}}}const bE=Yo("Ctrl+Enter");class wE extends Lr{static get pluginName(){return"TodoListEditing"}static get requires(){return[nE]}init(){const t=this.editor,e=t.model,n=t.editing,i=t.plugins.get(nE),o=t.config.get("list.multiBlock")?"paragraph":"listItem";t.commands.add("todoList",new Vx(t,"todo")),t.commands.add("checkTodoList",new fE(t)),n.view.addObserver(kE),e.schema.extend("$listItem",{allowAttributes:"todoListChecked"}),e.schema.addAttributeCheck((t=>{const e=t.last;if(!e.getAttribute("listItemId")||"todo"!=e.getAttribute("listType"))return!1}),"todoListChecked"),t.conversion.for("upcast").add((t=>{t.on("element:input",((t,e,n)=>{const i=e.modelCursor,o=i.parent,r=e.viewItem;if(!n.consumable.test(r,{name:!0}))return;if("checkbox"!=r.getAttribute("type")||!i.isAtStart||!o.hasAttribute("listType"))return;n.consumable.consume(r,{name:!0});const s=n.writer;s.setAttribute("listType","todo",o),e.viewItem.hasAttribute("checked")&&s.setAttribute("todoListChecked",!0,o),e.modelRange=s.createRange(i)})),t.on("element:li",((t,e,n)=>{const{writer:i,schema:o}=n;if(!e.modelRange)return;const r=Array.from(e.modelRange.getItems({shallow:!0})).filter((t=>"todo"===t.getAttribute("listType")&&o.checkAttribute(t,"listItemId"))).reduce(((t,e)=>{const n=e.getAttribute("listItemId");return t.has(n)||t.set(n,fx(e)),t}),new Map);for(const[,t]of r.entries())if(t.some((t=>t.getAttribute("todoListChecked"))))for(const e of t)i.setAttribute("todoListChecked",!0,e)}),{priority:"low"}),t.on("element:label",AE({name:"label",classes:"todo-list__label"})),t.on("element:label",AE({name:"label",classes:["todo-list__label","todo-list__label_without-description"]})),t.on("element:span",AE({name:"span",classes:"todo-list__label__description"})),t.on("element:ul",function(t){const e=new as(t);return(t,n,i)=>{const o=e.match(n.viewItem);if(!o)return;const r=o.match;r.name=!1,i.consumable.consume(n.viewItem,r)}}({name:"ul",classes:"todo-list"}))})),t.conversion.for("downcast").elementToElement({model:o,view:(t,{writer:e})=>{if(_E(t,i.getListAttributeNames()))return e.createContainerElement("span",{class:"todo-list__label__description"})},converterPriority:"highest"}),i.registerDowncastStrategy({scope:"list",attributeName:"listType",setAttributeOnDowncast(t,e,n){"todo"==e?t.addClass("todo-list",n):t.removeClass("todo-list",n)}}),i.registerDowncastStrategy({scope:"itemMarker",attributeName:"todoListChecked",createElement(t,e,{dataPipeline:n}){if("todo"!=e.getAttribute("listType"))return null;const i=t.createUIElement("input",{type:"checkbox",...e.getAttribute("todoListChecked")?{checked:"checked"}:null,...n?{disabled:"disabled"}:{tabindex:"-1"}});if(n)return i;const o=t.createContainerElement("span",{contenteditable:"false"},i);return o.getFillerOffset=()=>null,o},canWrapElement:t=>_E(t,i.getListAttributeNames()),createWrapperElement(t,e,{dataPipeline:n}){const o=["todo-list__label"];return _E(e,i.getListAttributeNames())||o.push("todo-list__label_without-description"),t.createAttributeElement(n?"label":"span",{class:o.join(" ")})}}),i.on("checkElement",((t,{modelElement:e,viewElement:n})=>{const o=_E(e,i.getListAttributeNames());n.hasClass("todo-list__label__description")!=o&&(t.return=!0,t.stop())})),i.on("checkElement",((e,{modelElement:n,viewElement:i})=>{const o="todo"==n.getAttribute("listType")&&wx(n);let r=!1;const s=t.editing.view.createPositionBefore(i).getWalker({direction:"backward"});for(const{item:e}of s){if(e.is("element")&&t.editing.mapper.toModelElement(e))break;e.is("element","input")&&"checkbox"==e.getAttribute("type")&&(r=!0)}r!=o&&(e.return=!0,e.stop())})),i.on("postFixer",((t,{listNodes:e,writer:n})=>{for(const{node:i,previousNodeInList:o}of e){if(!o)continue;if(o.getAttribute("listItemId")!=i.getAttribute("listItemId"))continue;const e=o.hasAttribute("todoListChecked"),r=i.hasAttribute("todoListChecked");r&&!e?(n.removeAttribute("todoListChecked",i),t.return=!0):!r&&e&&(n.setAttribute("todoListChecked",!0,i),t.return=!0)}})),e.document.registerPostFixer((t=>{const n=e.document.differ.getChanges();let i=!1;for(const e of n)if("attribute"==e.type&&"listType"==e.attributeKey){const n=e.range.start.nodeAfter;"todo"==e.attributeOldValue&&n.hasAttribute("todoListChecked")&&(t.removeAttribute("todoListChecked",n),i=!0)}else if("insert"==e.type&&"$text"!=e.name)for(const{item:n}of t.createRangeOn(e.position.nodeAfter))n.is("element")&&"todo"!=n.getAttribute("listType")&&n.hasAttribute("todoListChecked")&&(t.removeAttribute("todoListChecked",n),i=!0);return i})),this.listenTo(n.view.document,"keydown",((e,n)=>{Zo(n)===bE&&(t.execute("checkTodoList"),e.stop())}),{priority:"high"}),this.listenTo(n.view.document,"todoCheckboxChange",((t,e)=>{const i=e.target;if(!i||!i.is("element","input"))return;const o=n.view.createPositionAfter(i),r=n.mapper.toModelPosition(o).parent;r&&px(r)&&"todo"==r.getAttribute("listType")&&this._handleCheckmarkChange(r)})),this.listenTo(n.view.document,"arrowKey",function(t,e){return(n,i)=>{const o=Qo(i.keyCode,e.contentLanguageDirection),r=t.schema,s=t.document.selection;if(!s.isCollapsed)return;const a=s.getFirstPosition(),c=a.parent;if("right"==o&&a.isAtEnd){const e=r.getNearestSelectionRange(t.createPositionAfter(c),"forward");if(!e)return;const o=e.start.parent;o&&px(o)&&"todo"==o.getAttribute("listType")&&(t.change((t=>t.setSelection(e))),i.preventDefault(),i.stopPropagation(),n.stop())}else if("left"==o&&a.isAtStart&&px(c)&&"todo"==c.getAttribute("listType")){const e=r.getNearestSelectionRange(t.createPositionBefore(c),"backward");if(!e)return;t.change((t=>t.setSelection(e))),i.preventDefault(),i.stopPropagation(),n.stop()}}}(e,t.locale),{context:"$text"}),this.listenTo(n.mapper,"viewToModelPosition",((t,n)=>{const i=n.viewPosition.parent,o=i.is("attributeElement","li")&&0==n.viewPosition.offset,r=CE(i)&&n.viewPosition.offset<=1,s=i.is("element","span")&&"false"==i.getAttribute("contenteditable")&&CE(i.parent);if(!o&&!r&&!s)return;const a=n.modelPosition.nodeAfter;a&&"todo"==a.getAttribute("listType")&&(n.modelPosition=e.createPositionAt(a,0))}),{priority:"low"}),this._initAriaAnnouncements()}_handleCheckmarkChange(t){const e=this.editor,n=e.model,i=Array.from(n.document.selection.getRanges());n.change((n=>{n.setSelection(t,"end"),e.execute("checkTodoList"),n.setSelection(i)}))}_initAriaAnnouncements(){const{model:t,ui:e,t:n}=this.editor;let i=null;e&&t.document.selection.on("change:range",(()=>{const o=t.document.selection.focus.parent,r=vE(i),s=vE(o);r&&!s?e.ariaLiveAnnouncer.announce(n("Leaving a to-do list")):!r&&s&&e.ariaLiveAnnouncer.announce(n("Entering a to-do list")),i=o}))}}function AE(t){const e=new as(t);return(t,n,i)=>{const o=e.match(n.viewItem);o&&i.consumable.consume(n.viewItem,o.match)&&Object.assign(n,i.convertChildren(n.viewItem,n.modelCursor))}}function _E(t,e){return(t.is("element","paragraph")||t.is("element","listItem"))&&"todo"==t.getAttribute("listType")&&wx(t)&&function(t,e){for(const n of t.getAttributeKeys())if(!n.startsWith("selection:")&&!e.includes(n))return!1;return!0}(t,e)}function CE(t){return!!t&&t.is("attributeElement")&&t.hasClass("todo-list__label")}function vE(t){return!!t&&(!(!t.is("element","paragraph")&&!t.is("element","listItem"))&&"todo"==t.getAttribute("listType"))}class yE extends Lr{static get pluginName(){return"TodoListUI"}init(){const t=this.editor.t;oE(this.editor,"todoList",t("To-do List"),Mu.todoList)}}var xE=n(8991),EE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};$r()(xE.A,EE);xE.A.locals;class BE extends Lr{static get requires(){return[wE,yE]}static get pluginName(){return"TodoList"}}function DE(t){return void 0!==t&&t.endsWith("px")}function SE(t){return t.toFixed(2).replace(/\.?0+$/,"")+"px"}function TE(t,e,n){if(!t.childCount)return;const i=new jh(t.document),o=function(t,e){const n=e.createRangeIn(t),i=[],o=new Set;for(const t of n.getItems()){if(!t.is("element")||!t.name.match(/^(p|h\d+|li|div)$/))continue;let e=zE(t);if(void 0===e||0!=parseFloat(e)||Array.from(t.getClassNames()).find((t=>t.startsWith("MsoList")))||(e=void 0),t.hasStyle("mso-list")||void 0!==e&&o.has(e)){const n=LE(t);i.push({element:t,id:n.id,order:n.order,indent:n.indent,marginLeft:e}),void 0!==e&&o.add(e)}else o.clear()}return i}(t,i);if(!o.length)return;const r={},s=[];for(const t of o)if(void 0!==t.indent){IE(t)||(s.length=0);const o=`${t.id}:${t.indent}`,a=Math.min(t.indent-1,s.length);if(as.length-1||s[a].listElement.name!=c.type){0==a&&"ol"==c.type&&void 0!==t.id&&r[o]&&(c.startIndex=r[o]);const e=VE(c,i,n);if(DE(t.marginLeft)&&(0==a||DE(s[a-1].marginLeft))){let n=t.marginLeft;a>0&&(n=SE(parseFloat(n)-parseFloat(s[a-1].marginLeft))),i.setStyle("padding-left",n,e)}if(0==s.length){const n=t.element.parent,o=n.getChildIndex(t.element)+1;i.insertChild(o,e,n)}else{const t=s[a-1].listItemElements;i.appendChild(e,t[t.length-1])}s[a]={...t,listElement:e,listItemElements:[]},0==a&&void 0!==t.id&&(r[o]=c.startIndex||1)}}const c="li"==t.element.name?t.element:i.createElement("li");i.appendChild(c,s[a].listElement),s[a].listItemElements.push(c),0==a&&void 0!==t.id&&r[o]++,t.element!=c&&i.appendChild(t.element,c),ME(t.element,i),i.removeStyle("text-indent",t.element),i.removeStyle("margin-left",t.element)}else{const e=s.find((e=>e.marginLeft==t.marginLeft));if(e){const n=e.listItemElements;i.appendChild(t.element,n[n.length-1]),i.removeStyle("margin-left",t.element)}else s.length=0}}function IE(t){const e=t.element.previousSibling;return PE(e||t.element.parent)}function PE(t){return t.is("element","ol")||t.is("element","ul")}function FE(t,e){const n=new RegExp(`@list l${t.id}:level${t.indent}\\s*({[^}]*)`,"gi"),i=/mso-level-number-format:([^;]{0,100});/gi,o=/mso-level-start-at:\s{0,100}([0-9]{0,10})\s{0,100};/gi,r=new RegExp(`@list\\s+l${t.id}:level\\d\\s*{[^{]*mso-level-text:"%\\d\\\\.`,"gi"),s=new RegExp(`@list l${t.id}:level\\d\\s*{[^{]*mso-level-number-format:`,"gi"),a=r.exec(e),c=s.exec(e),l=a&&!c,d=n.exec(e);let h="decimal",u="ol",m=null;if(d&&d[1]){const e=i.exec(d[1]);if(e&&e[1]&&(h=e[1].trim(),u="bullet"!==h&&"image"!==h?"ol":"ul"),"bullet"===h){const e=function(t){if("li"==t.name&&"ul"==t.parent.name&&t.parent.hasAttribute("type"))return t.parent.getAttribute("type");const e=function(t){if(t.getChild(0).is("$text"))return null;for(const e of t.getChildren()){if(!e.is("element","span"))continue;const t=e.getChild(0);if(t)return t.is("$text")?t:t.getChild(0)}return null}(t);if(!e)return null;const n=e._data;if("o"===n)return"circle";if("·"===n)return"disc";if("§"===n)return"square";return null}(t.element);e&&(h=e)}else{const t=o.exec(d[1]);t&&t[1]&&(m=parseInt(t[1]))}l&&(u="ol")}return{type:u,startIndex:m,style:RE(h),isLegalStyleList:l}}function RE(t){if(t.startsWith("arabic-leading-zero"))return"decimal-leading-zero";switch(t){case"alpha-upper":return"upper-alpha";case"alpha-lower":return"lower-alpha";case"roman-upper":return"upper-roman";case"roman-lower":return"lower-roman";case"circle":case"disc":case"square":return t;default:return null}}function VE(t,e,n){const i=e.createElement(t.type);return t.style&&e.setStyle("list-style-type",t.style,i),t.startIndex&&t.startIndex>1&&e.setAttribute("start",t.startIndex,i),t.isLegalStyleList&&n&&e.addClass("legal-list",i),i}function LE(t){const e=t.getStyle("mso-list");if(void 0===e)return{};const n=e.match(/(^|\s{1,100})l(\d+)/i),i=e.match(/\s{0,100}lfo(\d+)/i),o=e.match(/\s{0,100}level(\d+)/i);return n&&i&&o?{id:n[2],order:i[1],indent:parseInt(o[1])}:{indent:1}}function ME(t,e){const n=new as({name:"span",styles:{"mso-list":"Ignore"}}),i=e.createRangeIn(t);for(const t of i)"elementStart"===t.type&&n.match(t.item)&&e.remove(t.item)}function zE(t){const e=t.getStyle("margin-left");return void 0===e||e.endsWith("px")?e:function(t){const e=parseFloat(t);return t.endsWith("pt")?SE(96*e/72):t.endsWith("pc")?SE(12*e*96/72):t.endsWith("in")?SE(96*e):t.endsWith("cm")?SE(96*e/2.54):t.endsWith("mm")?SE(e/10*96/2.54):t}(e)}function OE(t,e){if(!t.childCount)return;const n=new jh(t.document),i=function(t,e){const n=e.createRangeIn(t),i=new as({name:/v:(.+)/}),o=[];for(const t of n){if("elementStart"!=t.type)continue;const e=t.item,n=e.previousSibling,r=n&&n.is("element")?n.name:null,s=["Chart"],a=i.match(e),c=e.getAttribute("o:gfxdata"),l="v:shapetype"===r,d=c&&s.some((t=>e.getAttribute("id").includes(t)));a&&c&&!l&&!d&&o.push(t.item.getAttribute("id"))}return o}(t,n);!function(t,e,n){const i=n.createRangeIn(e),o=new as({name:"img"}),r=[];for(const e of i)if(e.item.is("element")&&o.match(e.item)){const n=e.item,i=n.getAttribute("v:shapes")?n.getAttribute("v:shapes").split(" "):[];i.length&&i.every((e=>t.indexOf(e)>-1))?r.push(n):n.getAttribute("src")||r.push(n)}for(const t of r)n.remove(t)}(i,t,n),function(t,e,n){const i=n.createRangeIn(e),o=[];for(const e of i)if("elementStart"==e.type&&e.item.is("element","v:shape")){const n=e.item.getAttribute("id");if(t.includes(n))continue;r(e.item.parent.getChildren(),n)||o.push(e.item)}for(const t of o){const e={src:s(t)};t.hasAttribute("alt")&&(e.alt=t.getAttribute("alt"));const i=n.createElement("img",e);n.insertChild(t.index+1,i,t.parent)}function r(t,e){for(const n of t)if(n.is("element")){if("img"==n.name&&n.getAttribute("v:shapes")==e)return!0;if(r(n.getChildren(),e))return!0}return!1}function s(t){for(const e of t.getChildren())if(e.is("element")&&e.getAttribute("src"))return e.getAttribute("src")}}(i,t,n),function(t,e){const n=e.createRangeIn(t),i=new as({name:/v:(.+)/}),o=[];for(const t of n)"elementStart"==t.type&&i.match(t.item)&&o.push(t.item);for(const t of o)e.remove(t)}(t,n);const o=function(t,e){const n=e.createRangeIn(t),i=new as({name:"img"}),o=[];for(const t of n)t.item.is("element")&&i.match(t.item)&&t.item.getAttribute("src").startsWith("file://")&&o.push(t.item);return o}(t,n);o.length&&function(t,e,n){if(t.length===e.length)for(let i=0;iString.fromCharCode(parseInt(t,16)))).join(""))}const HE=//i,jE=/xmlns:o="urn:schemas-microsoft-com/i;class qE{document;hasMultiLevelListPlugin;constructor(t,e=!1){this.document=t,this.hasMultiLevelListPlugin=e}isActive(t){return HE.test(t)||jE.test(t)}execute(t){const{body:e,stylesString:n}=t._parsedData;TE(e,n,this.hasMultiLevelListPlugin),OE(e,t.dataTransfer.getData("text/rtf")),function(t){const e=[],n=new jh(t.document);for(const{item:i}of n.createRangeIn(t))if(i.is("element")){for(const t of i.getClassNames())/\bmso/gi.exec(t)&&n.removeClass(t,i);for(const t of i.getStyleNames())/\bmso/gi.exec(t)&&n.removeStyle(t,i);(i.is("element","w:sdt")||i.is("element","w:sdtpr")&&i.isEmpty||i.is("element","o:p")&&i.isEmpty)&&e.push(i)}for(const t of e){const e=t.parent,i=e.getChildIndex(t);n.insertChild(i,t.getChildren(),e),n.remove(t)}}(e),t.content=e}}function WE(t,e,n,{blockElements:i,inlineObjectElements:o}){let r=n.createPositionAt(t,"forward"==e?"after":"before");return r=r.getLastMatchingPosition((({item:t})=>t.is("element")&&!i.includes(t.name)&&!o.includes(t.name)),{direction:e}),"forward"==e?r.nodeAfter:r.nodeBefore}function UE(t,e){return!!t&&t.is("element")&&e.includes(t.name)}const $E=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class GE{document;constructor(t){this.document=t}isActive(t){return $E.test(t)}execute(t){const e=new jh(this.document),{body:n}=t._parsedData;!function(t,e){for(const n of t.getChildren())if(n.is("element","b")&&"normal"===n.getStyle("font-weight")){const i=t.getChildIndex(n);e.remove(n),e.insertChild(i,n.getChildren(),t)}}(n,e),function(t,e){for(const n of e.createRangeIn(t)){const t=n.item;if(t.is("element","li")){const n=t.getChild(0);n&&n.is("element","p")&&e.unwrapElement(n)}}}(n,e),function(t,e){const n=new sa(e.document.stylesProcessor),i=new Za(n,{renderingMode:"data"}),o=i.blockElements,r=i.inlineObjectElements,s=[];for(const n of e.createRangeIn(t)){const t=n.item;if(t.is("element","br")){const n=WE(t,"forward",e,{blockElements:o,inlineObjectElements:r}),i=WE(t,"backward",e,{blockElements:o,inlineObjectElements:r}),a=UE(n,o);(UE(i,o)||a)&&s.push(t)}}for(const t of s)t.hasClass("Apple-interchange-newline")?e.remove(t):e.replace(t,e.createElement("p"))}(n,e),t.content=n}}const KE=/(\s+)<\/span>/g,((t,e)=>1===e.length?" ":Array(e.length+1).join(" ").substr(0,e.length)))}function JE(t,e){const n=new DOMParser,i=function(t){return YE(YE(t)).replace(/([^\S\r\n]*?)[\r\n]+([^\S\r\n]*<\/span>)/g,"$1$2").replace(/<\/span>/g,"").replace(/()[\r\n]+(<\/span>)/g,"$1 $2").replace(/ <\//g," ").replace(/ <\/o:p>/g," ").replace(/( |\u00A0)<\/o:p>/g,"").replace(/>([^\S\r\n]*[\r\n]\s*)<")}(function(t){const e="