!function(t){const e=t["en-gb"]=t["en-gb"]||{};e.dictionary=Object.assign(e.dictionary||{},{"%0 of %1":"%0 of %1",Accept:"","Align cell text to the bottom":"","Align cell text to the center":"","Align cell text to the left":"","Align cell text to the middle":"","Align cell text to the right":"","Align cell text to the top":"","Align center":"Align center","Align left":"Align left","Align right":"Align right","Align table to the left":"","Align table to the right":"",Alignment:"",Aquamarine:"Aquamarine",Background:"",Big:"Big",Black:"Black","Block quote":"Block quote",Blue:"Blue","Blue marker":"Blue marker",Bold:"Bold",Border:"","Break text":"","Bulleted List":"Bulleted List","Bulleted list styles toolbar":"",Cancel:"Cancel","Caption for image: %0":"","Caption for the image":"","Cell properties":"","Center table":"","Centered image":"Centred image","Change image text alternative":"Change image text alternative","Characters: %0":"Characters: %0","Choose heading":"Choose heading",Circle:"",Code:"Code",Color:"","Color picker":"",Column:"Column",Dashed:"",Decimal:"","Decimal with leading zero":"","Decrease indent":"Decrease indent",Default:"Default","Delete column":"Delete column","Delete row":"Delete row","Dim grey":"Dim grey",Dimensions:"",Disc:"","Document colors":"Document colours",Dotted:"",Double:"",Downloadable:"Downloadable","Dropdown toolbar":"","Edit block":"Edit block","Edit link":"Edit link","Editor block content toolbar":"","Editor contextual toolbar":"","Editor editing area: %0":"","Editor toolbar":"","Enter image caption":"Enter image caption","Enter table caption":"","Font Background Color":"Font Background Colour","Font Color":"Font Colour","Font Family":"Font Family","Font Size":"Font Size","Full size image":"Full size image",Green:"Green","Green marker":"Green marker","Green pen":"Green pen",Grey:"Grey",Groove:"","Header column":"Header column","Header row":"Header row",Heading:"Heading","Heading 1":"Heading 1","Heading 2":"Heading 2","Heading 3":"Heading 3","Heading 4":"Heading 4","Heading 5":"Heading 5","Heading 6":"Heading 6",Height:"",HEX:"",Highlight:"Highlight","Horizontal text alignment toolbar":"",Huge:"Huge","Image resize list":"","Image toolbar":"","image widget":"Image widget","In line":"","Increase indent":"Increase indent",Insert:"","Insert column left":"Insert column left","Insert column right":"Insert column right","Insert image":"Insert image","Insert image via URL":"","Insert media":"Insert media","Insert row above":"Insert row above","Insert row below":"Insert row below","Insert table":"Insert table",Inset:"",Italic:"Italic",Justify:"Justify","Justify cell text":"","Left aligned image":"Left aligned image","Light blue":"Light blue","Light green":"Light green","Light grey":"Light grey",Link:"Link","Link image":"","Link URL":"Link URL","List properties":"","Lower-latin":"","Lower–roman":"","Media toolbar":"","Media URL":"Media URL","media widget":"Media widget","Merge cell down":"Merge cell down","Merge cell left":"Merge cell left","Merge cell right":"Merge cell right","Merge cell up":"Merge cell up","Merge cells":"Merge cells",Next:"Next",None:"","Numbered List":"Numbered List","Numbered list styles toolbar":"","Open in a new tab":"Open in a new tab","Open link in new tab":"Open link in new tab","Open media in new tab":"",Orange:"Orange",Original:"",Outset:"",Padding:"",Paragraph:"Paragraph","Paste the media URL in the input.":"Paste the media URL in the input.","Pink marker":"Pink marker",Previous:"Previous",Purple:"Purple",Red:"Red","Red pen":"Red pen",Redo:"Redo","Remove color":"Remove colour","Remove Format":"Remove Format","Remove highlight":"Remove highlight","Resize image":"","Resize image to %0":"","Resize image to the original size":"","Restore default":"","Reversed order":"","Rich Text Editor":"Rich Text Editor",Ridge:"","Right aligned image":"Right aligned image",Row:"Row",Save:"Save","Select column":"","Select row":"","Show more items":"","Side image":"Side image",Small:"Small",Solid:"","Split cell horizontally":"Split cell horizontally","Split cell vertically":"Split cell vertically",Square:"","Start at":"","Start index must be greater than 0.":"",Strikethrough:"Strikethrough",Style:"",Subscript:"Subscript",Superscript:"Superscript","Table alignment toolbar":"","Table cell text alignment":"","Table properties":"","Table toolbar":"","Text alignment":"Text alignment","Text alignment toolbar":"","Text alternative":"Text alternative","Text highlight toolbar":"",'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".':"","The URL must not be empty.":"The URL must not be empty.",'The value is invalid. Try "10px" or "2em" or simply "2".':"","This link has no URL":"This link has no URL","This media URL is not supported.":"This media URL is not supported.",Tiny:"Tiny","Tip: Paste the URL into the content to embed faster.":"Tip: Paste the URL into the content to embed faster.","To-do List":"","Toggle caption off":"","Toggle caption on":"","Toggle the circle list style":"","Toggle the decimal list style":"","Toggle the decimal with leading zero list style":"","Toggle the disc list style":"","Toggle the lower–latin list style":"","Toggle the lower–roman list style":"","Toggle the square list style":"","Toggle the upper–latin list style":"","Toggle the upper–roman list style":"",Turquoise:"Turquoise",Underline:"Underline",Undo:"Undo",Unlink:"Unlink",Update:"","Update image URL":"","Upload failed":"Upload failed","Upload in progress":"Upload in progress","Upper-latin":"","Upper-roman":"","Vertical text alignment toolbar":"",White:"White",Width:"","Words: %0":"Words: %0","Wrap text":"",Yellow:"Yellow","Yellow marker":"Yellow marker"}),e.getPluralForm=function(t){return 1!=t}}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),
/*!
* @license Copyright (c) 2003-2023, 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.ClassicEditor=e():t.ClassicEditor=e()}(self,(()=>(()=>{var t={8168:(t,e,n)=>{const i=n(8874),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,l;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 c=(o+r)/2;return l=r===o?0:c<=.5?s/(r+o):s/(2-r-o),[a,100*l,100*c]},r.rgb.hsv=function(t){let e,n,i,o,r;const s=t[0]/255,a=t[1]/255,l=t[2]/255,c=Math.max(s,a,l),d=c-Math.min(s,a,l),h=function(t){return(c-t)/6/d+.5};return 0===d?(o=0,r=0):(r=d/c,e=h(s),n=h(a),i=h(l),s===c?o=i-n:a===c?o=1/3+e-i:l===c&&(o=2/3+n-e),o<0?o+=1:o>1&&(o-=1)),[360*o,100*r,100*c]},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=(a=i[e],((s=t)[0]-a[0])**2+(s[1]-a[1])**2+(s[2]-a[2])**2);o.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,[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];return 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,[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,l=[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,l[t]=255*s;return l},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);return i*=2,n*=i<=1?i:2-i,o*=r<=1?r:2-r,[e,100*(0===i?2*o/(r+o):2*n/(i+n)),(i+n)/2*100]},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),l=255*i*(1-n*(1-r));switch(i*=255,o){case 0:return[i,l,s];case 1:return[a,i,s];case 2:return[s,i,l];case 3:return[s,a,i];case 4:return[l,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,0!=(1&s)&&(r=1-r);const l=n+r*(a-n);let c,d,h;switch(s){default:case 6:case 0:c=a,d=l,h=n;break;case 1:c=l,d=a,h=n;break;case 2:c=n,d=a,h=l;break;case 3:c=n,d=l,h=a;break;case 4:c=l,d=n,h=a;break;case 5:c=a,d=n,h=l}return[255*c,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];return 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,[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;return o=360*Math.atan2(i,n)/2/Math.PI,o<0&&(o+=360),[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];return e===n&&n===i?e<8?16:e>248?231:Math.round((e-8)/247*24)+232: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;return t-=16,[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,l;return a=s<1?r/(1-s):0,l=s<=0?0:o===e?(n-i)/s%6:o===n?2+(i-e)/s:4+(e-n)/s,l/=6,l%=1,[360*l,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 l=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 l=(1-n)*i,[255*(n*o[0]+l),255*(n*o[1]+l),255*(n*o[2]+l)]},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]}},2085:(t,e,n)=>{const i=n(8168),o=n(4111),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},4111:(t,e,n)=>{const i=n(8168);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]}},8180:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var i=n(4015),o=n.n(i),r=n(3645),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://./node_modules/@ckeditor/ckeditor5-basic-styles/theme/code.css"],names:[],mappings:"AAKA,iBACC,kCAAuC,CAEvC,iBAAkB,CADlB,aAED,CAEA,0CACC,kCACD",sourcesContent:["/*\n * Copyright (c) 2003-2023, 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},636:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var i=n(4015),o=n.n(i),r=n(3645),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://./node_modules/@ckeditor/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-2023, 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},390:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var i=n(4015),o=n.n(i),r=n(3645),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}',"",{version:3,sources:["webpack://./node_modules/@ckeditor/ckeditor5-clipboard/theme/clipboard.css","webpack://./node_modules/@ckeditor/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,CChCA,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,eACD",sourcesContent:["/*\n * Copyright (c) 2003-2023, 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-2023, 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-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(var(--ck-clipboard-drop-target-dot-height) * -.5);\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'],sourceRoot:""}]);const a=s},9085:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var i=n(4015),o=n.n(i),r=n(3645),s=n.n(r)()(o());s.push([t.id,".ck-content pre{background:hsla(0,0%,78%,.3);border:1px solid #c4c4c4;border-radius:2px;color:#353535;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.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://./node_modules/@ckeditor/ckeditor5-code-block/theme/codeblock.css","webpack://./node_modules/@ckeditor/ckeditor5-theme-lark/theme/ckeditor5-code-block/codeblock.css"],names:[],mappings:"AAKA,gBAGC,4BAAiC,CACjC,wBAAiC,CACjC,iBAAkB,CAHlB,aAAwB,CAOxB,aAAc,CAMd,iBAAkB,CAGlB,eAAgB,CAjBhB,WAAY,CAUZ,UAAW,CAHX,eAAgB,CAIhB,oBAaD,CALC,qBACC,gBAAiB,CAEjB,eAAgB,CADhB,SAED,CAGD,4BACC,iBAMD,CAJC,iDACC,2BAA4B,CAC5B,iBACD,CCjCD,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-2023, 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\tcolor: hsl(0, 0%, 20.8%);\n\tbackground: hsla(0, 0%, 78%, 0.3);\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.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-2023, 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},3638:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var i=n(4015),o=n.n(i),r=n(3645),s=n.n(r)()(o());s.push([t.id,".ck.ck-editor{position:relative}.ck.ck-editor .ck-editor__top .ck-sticky-panel .ck-toolbar{z-index:var(--ck-z-modal)}.ck.ck-editor__top .ck-sticky-panel .ck-toolbar{border-radius:0}.ck-rounded-corners .ck.ck-editor__top .ck-sticky-panel .ck-toolbar,.ck.ck-editor__top .ck-sticky-panel .ck-toolbar.ck-rounded-corners{border-radius:var(--ck-border-radius);border-bottom-left-radius:0;border-bottom-right-radius:0}.ck.ck-editor__top .ck-sticky-panel .ck-toolbar{border-bottom-width:0}.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content_sticky .ck-toolbar{border-bottom-width:1px;border-radius:0}.ck-rounded-corners .ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content_sticky .ck-toolbar,.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content_sticky .ck-toolbar.ck-rounded-corners{border-radius:var(--ck-border-radius);border-radius:0}.ck.ck-editor__main>.ck-editor__editable{background:var(--ck-color-base-background);border-radius:0}.ck-rounded-corners .ck.ck-editor__main>.ck-editor__editable,.ck.ck-editor__main>.ck-editor__editable.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0;border-top-right-radius:0}.ck.ck-editor__main>.ck-editor__editable:not(.ck-focused){border-color:var(--ck-color-base-border)}","",{version:3,sources:["webpack://./node_modules/@ckeditor/ckeditor5-editor-classic/theme/classiceditor.css","webpack://./node_modules/@ckeditor/ckeditor5-theme-lark/theme/ckeditor5-editor-classic/classiceditor.css","webpack://./node_modules/@ckeditor/ckeditor5-theme-lark/theme/mixins/_rounded.css"],names:[],mappings:"AAKA,cAIC,iBAMD,CAJC,2DAEC,yBACD,CCLC,gDCED,eDKC,CAPA,uICMA,qCAAsC,CDJpC,2BAA4B,CAC5B,4BAIF,CAPA,gDAMC,qBACD,CAEA,iFACC,uBAAwB,CCR1B,eDaC,CANA,yMCHA,qCAAsC,CDOpC,eAEF,CAKF,yCAEC,0CAA2C,CCpB3C,eD8BD,CAZA,yHCdE,qCAAsC,CDmBtC,wBAAyB,CACzB,yBAMF,CAHC,0DACC,wCACD",sourcesContent:["/*\n * Copyright (c) 2003-2023, 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 {\n\t/* All the elements within `.ck-editor` are positioned relatively to it.\n\t If any element needs to be positioned with respect to the , etc.,\n\t it must land outside of the `.ck-editor` in DOM. */\n\tposition: relative;\n\n\t& .ck-editor__top .ck-sticky-panel .ck-toolbar {\n\t\t/* https://github.com/ckeditor/ckeditor5-editor-classic/issues/62 */\n\t\tz-index: var(--ck-z-modal);\n\t}\n}\n",'/*\n * Copyright (c) 2003-2023, 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 "../mixins/_rounded.css";\n\n.ck.ck-editor__top {\n\t& .ck-sticky-panel {\n\t\t& .ck-toolbar {\n\t\t\t@mixin ck-rounded-corners {\n\t\t\t\tborder-bottom-left-radius: 0;\n\t\t\t\tborder-bottom-right-radius: 0;\n\t\t\t}\n\n\t\t\tborder-bottom-width: 0;\n\t\t}\n\n\t\t& .ck-sticky-panel__content_sticky .ck-toolbar {\n\t\t\tborder-bottom-width: 1px;\n\n\t\t\t@mixin ck-rounded-corners {\n\t\t\t\tborder-radius: 0;\n\t\t\t}\n\t\t}\n\t}\n}\n\n/* Note: Use ck-editor__main to make sure these styles don\'t apply to other editor types */\n.ck.ck-editor__main > .ck-editor__editable {\n\t/* https://github.com/ckeditor/ckeditor5-theme-lark/issues/113 */\n\tbackground: var(--ck-color-base-background);\n\n\t@mixin ck-rounded-corners {\n\t\tborder-top-left-radius: 0;\n\t\tborder-top-right-radius: 0;\n\t}\n\n\t&:not(.ck-focused) {\n\t\tborder-color: var(--ck-color-base-border);\n\t}\n}\n',"/*\n * Copyright (c) 2003-2023, 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/**\n * Implements rounded corner interface for .ck-rounded-corners class.\n *\n * @see $ck-border-radius\n */\n@define-mixin ck-rounded-corners {\n\tborder-radius: 0;\n\n\t@nest .ck-rounded-corners &,\n\t&.ck-rounded-corners {\n\t\tborder-radius: var(--ck-border-radius);\n\t\t@mixin-content;\n\t}\n}\n"],sourceRoot:""}]);const a=s},8894:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var i=n(4015),o=n.n(i),r=n(3645),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}.ck .ck-placeholder:before,.ck.ck-placeholder:before{color:var(--ck-color-engine-placeholder-text);cursor:text}","",{version:3,sources:["webpack://./node_modules/@ckeditor/ckeditor5-engine/theme/placeholder.css","webpack://./node_modules/@ckeditor/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,CC5BC,qDAEC,6CAA8C,CAD9C,WAED",sourcesContent:["/*\n * Copyright (c) 2003-2023, 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-2023, 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, .ck .ck-placeholder {\n\t&::before {\n\t\tcursor: text;\n\t\tcolor: var(--ck-color-engine-placeholder-text);\n\t}\n}\n"],sourceRoot:""}]);const a=s},4401:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var i=n(4015),o=n.n(i),r=n(3645),s=n.n(r)()(o());s.push([t.id,".ck.ck-editor__editable span[data-ck-unsafe-element]{display:none}","",{version:3,sources:["webpack://./node_modules/@ckeditor/ckeditor5-engine/theme/renderer.css"],names:[],mappings:"AAMA,qDACC,YACD",sourcesContent:["/*\n * Copyright (c) 2003-2023, 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},5436:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var i=n(4015),o=n.n(i),r=n(3645),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://./node_modules/@ckeditor/ckeditor5-find-and-replace/theme/findandreplace.css"],names:[],mappings:"AAKA,gBACC,+CAAgD,CAChD,0BACD,CAEA,yBACC,kBACD",sourcesContent:["/*\n * Copyright (c) 2003-2023, 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},9289:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var i=n(4015),o=n.n(i),r=n(3645),s=n.n(r)()(o());s.push([t.id,".ck.ck-find-and-replace-form{max-width:100%}.ck.ck-find-and-replace-form fieldset{display:flex}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find .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 fieldset{align-content:stretch;align-items:center;border:0;flex-direction:row;flex-wrap:nowrap;margin:0;padding:var(--ck-spacing-large)}.ck.ck-find-and-replace-form fieldset>.ck-button{flex:0 0 auto}[dir=ltr] .ck.ck-find-and-replace-form fieldset>*+*{margin-left:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-find-and-replace-form fieldset>*+*{margin-right:var(--ck-spacing-standard)}.ck.ck-find-and-replace-form fieldset .ck-labeled-field-view{flex:1 1 auto}.ck.ck-find-and-replace-form fieldset .ck-labeled-field-view .ck-input{min-width:50px;width:100%}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find{align-items:flex-start}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find>.ck-button-find{font-weight:700}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find>.ck-button-find .ck-button__label{padding-left:var(--ck-spacing-large);padding-right:var(--ck-spacing-large)}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find>.ck-button-prev>.ck-icon{transform:rotate(90deg)}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find>.ck-button-next>.ck-icon{transform:rotate(-90deg)}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find .ck-results-counter{top:50%;transform:translateY(-50%)}[dir=ltr] .ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find .ck-results-counter{right:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find .ck-results-counter{left:var(--ck-spacing-standard)}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find .ck-results-counter{color:var(--ck-color-base-border)}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__replace{flex-wrap:wrap;justify-content:flex-end;margin-top:calc(var(--ck-spacing-large)*-1)}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__replace>.ck-labeled-field-view{margin-bottom:var(--ck-spacing-large)}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__replace>.ck-options-dropdown{margin-left:0;margin-right:auto}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__replace>.ck-labeled-field-view,.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__replace>.ck-labeled-field-view .ck-input{width:100%}@media screen and (max-width:600px){.ck.ck-find-and-replace-form{width:300px}.ck.ck-find-and-replace-form fieldset{flex-wrap:wrap}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find .ck-labeled-field-view{flex:1 0 auto;margin-bottom:var(--ck-spacing-standard);width:100%}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find>.ck-button{text-align:center}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find>.ck-button:first-of-type{flex:1 1 auto}[dir=ltr] .ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find>.ck-button:first-of-type{margin-left:0}[dir=rtl] .ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find>.ck-button:first-of-type{margin-right:0}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__find>.ck-button:first-of-type .ck-button__label{text-align:center;width:100%}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__replace>:not(.ck-labeled-field-view){flex:1 1 auto}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__replace>.ck-dropdown:not(.ck-labeled-field-view){flex-grow:0}.ck.ck-find-and-replace-form fieldset.ck-find-and-replace-form__replace>.ck-button:not(.ck-labeled-field-view)>.ck-button__label{text-align:center;width:100%}}","",{version:3,sources:["webpack://./node_modules/@ckeditor/ckeditor5-find-and-replace/theme/findandreplaceform.css","webpack://./node_modules/@ckeditor/ckeditor5-theme-lark/theme/ckeditor5-find-and-replace/findandreplaceform.css","webpack://./node_modules/@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css"],names:[],mappings:"AAKA,6BACC,cAUD,CARC,sCACC,YAMD,CAHC,yFACC,iBACD,CCNF,6BACC,WAyGD,CAnGC,mCACC,YACD,CAEA,sCAIC,qBAAsB,CADtB,kBAAmB,CAInB,QAAS,CANT,kBAAmB,CACnB,gBAAiB,CAMjB,QAAS,CAFT,+BAwFD,CApFC,iDACC,aACD,CAGC,oDACC,sCACD,CAIA,oDACC,uCACD,CAGD,6DACC,aAMD,CAJC,uEAEC,cAAe,CADf,UAED,CAID,qEAEC,sBAkCD,CAhCC,qFACC,eAOD,CAJC,uGACC,oCAAqC,CACrC,qCACD,CAGD,8FACC,uBACD,CAEA,8FACC,wBACD,CAEA,yFACC,OAAQ,CACR,0BAWD,CAbA,mGAKE,gCAQF,CAbA,mGASE,+BAIF,CAbA,yFAYC,iCACD,CAID,wEACC,cAAe,CACf,wBAAyB,CACzB,2CAeD,CAbC,+FACC,qCACD,CAEA,6FAEC,aAAc,CADd,iBAED,CAEA,wMAEC,UACD,CCzGF,oCD+GA,6BACC,WAiDD,CA/CC,sCACC,cA6CD,CAzCE,4FACC,aAAc,CAEd,wCAAyC,CADzC,UAED,CAEA,gFACC,iBAkBD,CAhBC,8FACC,aAcD,CAfA,wGAIE,aAWF,CAfA,wGAQE,cAOF,CAJC,gHAEC,iBAAkB,CADlB,UAED,CAMH,qGACC,aAUD,CARC,iHACC,WACD,CAEA,iIAEC,iBAAkB,CADlB,UAED,CC5JH",sourcesContent:["/*\n * Copyright (c) 2003-2023, 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& fieldset {\n\t\tdisplay: flex;\n\n\t\t/* The find fieldset */\n\t\t&.ck-find-and-replace-form__find .ck-results-counter {\n\t\t\tposition: absolute;\n\t\t}\n\t}\n}\n",'/*\n * Copyright (c) 2003-2023, 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 g(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,n)=>{n.resultRange=e.insertContent(n.content)}),{priority:"low"})}_setupCopyCut(){const t=this.editor,e=t.model.document,n=t.editing.view.document,i=(i,o)=>{const r=o.dataTransfer;o.preventDefault();const s=t.data.toView(t.model.getSelectedContent(e.selection));n.fire("clipboardOutput",{dataTransfer:r,content:s,method:i.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(n,"clipboardOutput",((n,i)=>{i.content.isEmpty||(i.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(i.content)),i.dataTransfer.setData("text/plain",fg(i.content))),"cut"==i.method&&t.model.deleteContent(e.selection)}),{priority:"low"})}}class kg{constructor(t,e=20){this._batch=null,this.model=t,this._size=0,this.limit=e,this._isLocked=!1,this._changeCallback=(t,e)=>{e.isLocal&&e.isUndoable&&e!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch({isTyping:!0})),this._batch}get size(){return this._size}input(t){this._size+=t,this._size>=this.limit&&this._reset(!0)}get isLocked(){return this._isLocked}lock(){this._isLocked=!0}unlock(){this._isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(t=!1){this.isLocked&&!t||(this._batch=null,this._size=0)}}class wg extends gr{constructor(t,e){super(t),this._buffer=new kg(t.model,e),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(t={}){const e=this.editor.model,n=e.document,i=t.text||"",o=i.length;let r=n.selection;if(t.selection?r=t.selection:t.range&&(r=e.createSelection(t.range)),!e.canEditAt(r))return;const s=t.resultRange;e.enqueueChange(this._buffer.batch,(t=>{this._buffer.lock(),e.deleteContent(r),i&&e.insertContent(t.createText(i,n.selection.getAttributes()),r),s?t.setSelection(s):r.is("documentSelection")||t.setSelection(r),this._buffer.unlock(),this._buffer.input(o)}))}}const Ag=["insertText","insertReplacementText"];class Cg extends Ba{constructor(t){super(t),l.isAndroid&&Ag.push("insertCompositionText");const e=t.document;e.on("beforeinput",((n,i)=>{if(!this.isEnabled)return;const{data:o,targetRanges:r,inputType:s,domEvent:a}=i;if(!Ag.includes(s))return;const l=new g(e,"insertText");e.fire(l,new Na(t,a,{text:o,selection:t.createSelection(r)})),l.stop.called&&n.stop()})),e.on("compositionend",((n,{data:i,domEvent:o})=>{this.isEnabled&&!l.isAndroid&&i&&e.fire("insertText",new Na(t,o,{text:i,selection:e.selection}))}),{priority:"lowest"})}observe(){}stopObserving(){}}class _g extends ur{static get pluginName(){return"Input"}init(){const t=this.editor,e=t.model,n=t.editing.view,i=e.document.selection;n.addObserver(Cg);const o=new wg(t,t.config.get("typing.undoStep")||20);t.commands.add("insertText",o),t.commands.add("input",o),this.listenTo(n.document,"insertText",((i,o)=>{n.document.isComposing||o.preventDefault();const{text:r,selection:s,resultRange:a}=o,c=Array.from(s.getRanges()).map((e=>t.editing.mapper.toModelRange(e)));let d=r;if(l.isAndroid){const t=Array.from(c[0].getItems()).reduce(((t,e)=>t+(e.is("$textProxy")?e.data:"")),"");t&&(t.length<=d.length?d.startsWith(t)&&(d=d.substring(t.length),c[0].start=c[0].start.getShiftedBy(t.length)):t.startsWith(d)&&(c[0].start=c[0].start.getShiftedBy(d.length),d=""))}const h={text:d,selection:e.createSelection(c)};a&&(h.resultRange=t.editing.mapper.toModelRange(a)),t.execute("insertText",h)})),l.isAndroid?this.listenTo(n.document,"keydown",((t,r)=>{!i.isCollapsed&&229==r.keyCode&&n.document.isComposing&&vg(e,o)})):this.listenTo(n.document,"compositionstart",(()=>{i.isCollapsed||vg(e,o)}))}}function vg(t,e){if(!e.isEnabled)return;const n=e.buffer;n.lock(),t.enqueueChange(n.batch,(()=>{t.deleteContent(t.document.selection)})),n.unlock()}class yg extends gr{constructor(t,e){super(t),this.direction=e,this._buffer=new kg(t.model,t.config.get("typing.undoStep")),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}execute(t={}){const e=this.editor.model,n=e.document;e.enqueueChange(this._buffer.batch,(i=>{this._buffer.lock();const o=i.createSelection(t.selection||n.selection);if(!e.canEditAt(o))return;const r=t.sequence||1,s=o.isCollapsed;if(o.isCollapsed&&e.modifySelection(o,{direction:this.direction,unit:t.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(r))return void this._replaceEntireContentWithParagraph(i);if(this._shouldReplaceFirstBlockWithParagraph(o,r))return void this.editor.execute("paragraph",{selection:o});if(o.isCollapsed)return;let a=0;o.getFirstRange().getMinimalFlatRanges().forEach((t=>{a+=Q(t.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))})),e.deleteContent(o,{doNotResetEntireContent:s,direction:this.direction}),this._buffer.input(a),i.setSelection(o),this._buffer.unlock()}))}_shouldEntireContentBeReplacedWithParagraph(t){if(t>1)return!1;const e=this.editor.model,n=e.document.selection,i=e.schema.getLimitElement(n);if(!n.isCollapsed||!n.containsEntireContent(i))return!1;if(!e.schema.checkChild(i,"paragraph"))return!1;const o=i.getChild(0);return!o||!o.is("element","paragraph")}_replaceEntireContentWithParagraph(t){const e=this.editor.model,n=e.document.selection,i=e.schema.getLimitElement(n),o=t.createElement("paragraph");t.remove(t.createRangeIn(i)),t.insert(o,i),t.setSelection(o,0)}_shouldReplaceFirstBlockWithParagraph(t,e){const n=this.editor.model;if(e>1||"backward"!=this.direction)return!1;if(!t.isCollapsed)return!1;const i=t.getFirstPosition(),o=n.schema.getLimitElement(i),r=o.getChild(0);return i.parent==r&&!!t.containsEntireContent(r)&&!!n.schema.checkChild(o,"paragraph")&&"paragraph"!=r.name}}const xg="word",Eg="selection",Dg="backward",Sg="forward",Tg={deleteContent:{unit:Eg,direction:Dg},deleteContentBackward:{unit:"codePoint",direction:Dg},deleteWordBackward:{unit:xg,direction:Dg},deleteHardLineBackward:{unit:Eg,direction:Dg},deleteSoftLineBackward:{unit:Eg,direction:Dg},deleteContentForward:{unit:"character",direction:Sg},deleteWordForward:{unit:xg,direction:Sg},deleteHardLineForward:{unit:Eg,direction:Sg},deleteSoftLineForward:{unit:Eg,direction:Sg}};class Ig extends Ba{constructor(t){super(t);const e=t.document;let n=0;e.on("keydown",(()=>{n++})),e.on("keyup",(()=>{n=0})),e.on("beforeinput",((i,o)=>{if(!this.isEnabled)return;const{targetRanges:r,domEvent:s,inputType:a}=o,c=Tg[a];if(!c)return;const d={direction:c.direction,unit:c.unit,sequence:n};d.unit==Eg&&(d.selectionToRemove=t.createSelection(r[0])),"deleteContentBackward"===a&&(l.isAndroid&&(d.sequence=1),function(t){if(1!=t.length||t[0].isCollapsed)return!1;const e=t[0].getWalker({direction:"backward",singleCharacters:!0,ignoreElementEnd:!0});let n=0;for(const{nextPosition:t}of e){if(t.parent.is("$text")){const e=t.parent.data,i=t.offset;if(Vi(e,i)||Fi(e,i)||Hi(e,i))continue;n++}else n++;if(n>1)return!0}return!1}(r)&&(d.unit=Eg,d.selectionToRemove=t.createSelection(r)));const h=new Bs(e,"delete",r[0]);e.fire(h,new Na(t,s,d)),h.stop.called&&i.stop()})),l.isBlink&&function(t){const e=t.view,n=e.document;let i=null,o=!1;function r(t){return t==vi.backspace||t==vi.delete}function s(t){return t==vi.backspace?Dg:Sg}n.on("keydown",((t,{keyCode:e})=>{i=e,o=!1})),n.on("keyup",((a,{keyCode:l,domEvent:c})=>{const d=n.selection,h=t.isEnabled&&l==i&&r(l)&&!d.isCollapsed&&!o;if(i=null,h){const t=d.getFirstRange(),i=new Bs(n,"delete",t),o={unit:Eg,direction:s(l),selectionToRemove:d};n.fire(i,new Na(e,c,o))}})),n.on("beforeinput",((t,{inputType:e})=>{const n=Tg[e];r(i)&&n&&n.direction==s(i)&&(o=!0)}),{priority:"high"}),n.on("beforeinput",((t,{inputType:e,data:n})=>{i==vi.delete&&"insertText"==e&&""==n&&t.stop()}),{priority:"high"})}(this)}observe(){}stopObserving(){}}class Bg extends ur{static get pluginName(){return"Delete"}init(){const t=this.editor,e=t.editing.view,n=e.document,i=t.model.document;e.addObserver(Ig),this._undoOnBackspace=!1;const o=new yg(t,"forward");t.commands.add("deleteForward",o),t.commands.add("forwardDelete",o),t.commands.add("delete",new yg(t,"backward")),this.listenTo(n,"delete",((i,o)=>{n.isComposing||o.preventDefault();const{direction:r,sequence:s,selectionToRemove:a,unit:l}=o,c="forward"===r?"deleteForward":"delete",d={sequence:s};if("selection"==l){const e=Array.from(a.getRanges()).map((e=>t.editing.mapper.toModelRange(e)));d.selection=t.model.createSelection(e)}else d.unit=l;t.execute(c,d),e.scrollToTheSelection()}),{priority:"low"}),this.editor.plugins.has("UndoEditing")&&(this.listenTo(n,"delete",((e,n)=>{this._undoOnBackspace&&"backward"==n.direction&&1==n.sequence&&"codePoint"==n.unit&&(this._undoOnBackspace=!1,t.execute("undo"),n.preventDefault(),e.stop())}),{context:"$capture"}),this.listenTo(i,"change",(()=>{this._undoOnBackspace=!1})))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}class Mg extends ur{static get requires(){return[_g,Bg]}static get pluginName(){return"Typing"}}function Ng(t,e){let n=t.start;return{text:Array.from(t.getItems()).reduce(((t,i)=>i.is("$text")||i.is("$textProxy")?t+i.data:(n=e.createPositionAfter(i),"")),""),range:e.createRange(n,t.end)}}class zg extends(G()){constructor(t,e){super(),this.model=t,this.testCallback=e,this._hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",(()=>{this.isEnabled?this._startListening():(this.stopListening(t.document.selection),this.stopListening(t.document))})),this._startListening()}get hasMatch(){return this._hasMatch}_startListening(){const t=this.model.document;this.listenTo(t.selection,"change:range",((e,{directChange:n})=>{n&&(t.selection.isCollapsed?this._evaluateTextBeforeSelection("selection"):this.hasMatch&&(this.fire("unmatched"),this._hasMatch=!1))})),this.listenTo(t,"change:data",((t,e)=>{!e.isUndo&&e.isLocal&&this._evaluateTextBeforeSelection("data",{batch:e})}))}_evaluateTextBeforeSelection(t,e={}){const n=this.model,i=n.document.selection,o=n.createRange(n.createPositionAt(i.focus.parent,0),i.focus),{text:r,range:s}=Ng(o,n),a=this.testCallback(r);if(!a&&this.hasMatch&&this.fire("unmatched"),this._hasMatch=!!a,a){const n=Object.assign(e,{text:r,range:s});"object"==typeof a&&Object.assign(n,a),this.fire(`matched:${t}`,n)}}}class Lg extends ur{static get pluginName(){return"TwoStepCaretMovement"}constructor(t){super(t),this.attributes=new Set,this._overrideUid=null}init(){const t=this.editor,e=t.model,n=t.editing.view,i=t.locale,o=e.document.selection;this.listenTo(n.document,"arrowKey",((t,e)=>{if(!o.isCollapsed)return;if(e.shiftKey||e.altKey||e.ctrlKey)return;const n=e.keyCode==vi.arrowright,r=e.keyCode==vi.arrowleft;if(!n&&!r)return;const s=i.contentLanguageDirection;let a=!1;a="ltr"===s&&n||"rtl"===s&&r?this._handleForwardMovement(e):this._handleBackwardMovement(e),!0===a&&t.stop()}),{context:"$text",priority:"highest"}),this._isNextGravityRestorationSkipped=!1,this.listenTo(o,"change:range",((t,e)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!e.directChange&&Vg(o.getFirstPosition(),this.attributes)||this._restoreGravity())}))}registerAttribute(t){this.attributes.add(t)}_handleForwardMovement(t){const e=this.attributes,n=this.editor.model.document.selection,i=n.getFirstPosition();return!(this._isGravityOverridden||i.isAtStart&&Pg(n,e)||!Vg(i,e)||(Og(t),this._overrideGravity(),0))}_handleBackwardMovement(t){const e=this.attributes,n=this.editor.model,i=n.document.selection,o=i.getFirstPosition();return this._isGravityOverridden?(Og(t),this._restoreGravity(),Rg(n,e,o),!0):o.isAtStart?!!Pg(i,e)&&(Og(t),Rg(n,e,o),!0):!!function(t,e){return Vg(t.getShiftedBy(-1),e)}(o,e)&&(o.isAtEnd&&!Pg(i,e)&&Vg(o,e)?(Og(t),Rg(n,e,o),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1))}get _isGravityOverridden(){return!!this._overrideUid}_overrideGravity(){this._overrideUid=this.editor.model.change((t=>t.overrideSelectionGravity()))}_restoreGravity(){this.editor.model.change((t=>{t.restoreSelectionGravity(this._overrideUid),this._overrideUid=null}))}}function Pg(t,e){for(const n of e)if(t.hasAttribute(n))return!0;return!1}function Rg(t,e,n){const i=n.nodeBefore;t.change((t=>{i?t.setSelectionAttribute(i.getAttributes()):t.removeSelectionAttribute(e)}))}function Og(t){t.preventDefault()}function Vg(t,e){const{nodeBefore:n,nodeAfter:i}=t;for(const t of e){const e=n?n.getAttribute(t):void 0;if((i?i.getAttribute(t):void 0)!==e)return!0}return!1}var Fg=/[\\^$.*+?()[\]{}|]/g,jg=RegExp(Fg.source);const Hg=function(t){return(t=qr(t))&&jg.test(t)?t.replace(Fg,"\\$&"):t},Ug={copyright:{from:"(c)",to:"©"},registeredTrademark:{from:"(r)",to:"®"},trademark:{from:"(tm)",to:"™"},oneHalf:{from:/(^|[^/a-z0-9])(1\/2)([^/a-z0-9])$/i,to:[null,"½",null]},oneThird:{from:/(^|[^/a-z0-9])(1\/3)([^/a-z0-9])$/i,to:[null,"⅓",null]},twoThirds:{from:/(^|[^/a-z0-9])(2\/3)([^/a-z0-9])$/i,to:[null,"⅔",null]},oneForth:{from:/(^|[^/a-z0-9])(1\/4)([^/a-z0-9])$/i,to:[null,"¼",null]},threeQuarters:{from:/(^|[^/a-z0-9])(3\/4)([^/a-z0-9])$/i,to:[null,"¾",null]},lessThanOrEqual:{from:"<=",to:"≤"},greaterThanOrEqual:{from:">=",to:"≥"},notEqual:{from:"!=",to:"≠"},arrowLeft:{from:"<-",to:"←"},arrowRight:{from:"->",to:"→"},horizontalEllipsis:{from:"...",to:"…"},enDash:{from:/(^| )(--)( )$/,to:[null,"–",null]},emDash:{from:/(^| )(---)( )$/,to:[null,"—",null]},quotesPrimary:{from:Yg('"'),to:[null,"“",null,"”"]},quotesSecondary:{from:Yg("'"),to:[null,"‘",null,"’"]},quotesPrimaryEnGb:{from:Yg("'"),to:[null,"‘",null,"’"]},quotesSecondaryEnGb:{from:Yg('"'),to:[null,"“",null,"”"]},quotesPrimaryPl:{from:Yg('"'),to:[null,"„",null,"”"]},quotesSecondaryPl:{from:Yg("'"),to:[null,"‚",null,"’"]}},Gg={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},Wg=["symbols","mathematical","typography","quotes"];function qg(t){return"string"==typeof t?new RegExp(`(${Hg(t)})$`):t}function $g(t){return"string"==typeof t?()=>[t]:t instanceof Array?()=>t:t}function Kg(t){return(t.textNode?t.textNode:t.nodeAfter).getAttributes()}function Yg(t){return new RegExp(`(^|\\s)(${t})([^${t}]*)(${t})$`)}function Zg(t,e,n,i){return i.createRange(Qg(t,e,n,!0,i),Qg(t,e,n,!1,i))}function Qg(t,e,n,i,o){let r=t.textNode||(i?t.nodeBefore:t.nodeAfter),s=null;for(;r&&r.getAttribute(e)==n;)s=r,r=i?r.previousSibling:r.nextSibling;return s?o.createPositionAt(s,i?"before":"after"):t}function Jg(t,e,n,i){const o=t.editing.view,r=new Set;o.document.registerPostFixer((o=>{const s=t.model.document.selection;let a=!1;if(s.hasAttribute(e)){const l=Zg(s.getFirstPosition(),e,s.getAttribute(e),t.model),c=t.editing.mapper.toViewRange(l);for(const t of c.getItems())t.is("element",n)&&!t.hasClass(i)&&(o.addClass(i,t),r.add(t),a=!0)}return a})),t.conversion.for("editingDowncast").add((t=>{function e(){o.change((t=>{for(const e of r.values())t.removeClass(i,e),r.delete(e)}))}t.on("insert",e,{priority:"highest"}),t.on("remove",e,{priority:"highest"}),t.on("attribute",e,{priority:"highest"}),t.on("selection",e,{priority:"highest"})}))}function*Xg(t,e){for(const n of e)n&&t.getAttributeProperties(n[0]).copyOnEnter&&(yield n)}class tp extends gr{execute(){this.editor.model.change((t=>{this.enterBlock(t),this.fire("afterExecute",{writer:t})}))}enterBlock(t){const e=this.editor.model,n=e.document.selection,i=e.schema,o=n.isCollapsed,r=n.getFirstRange(),s=r.start.parent,a=r.end.parent;if(i.isLimit(s)||i.isLimit(a))return o||s!=a||e.deleteContent(n),!1;if(o){const e=Xg(t.model.schema,n.getAttributes());return ep(t,r.start),t.setSelectionAttribute(e),!0}{const i=!(r.start.isAtStart&&r.end.isAtEnd),o=s==a;if(e.deleteContent(n,{leaveUnmerged:i}),i){if(o)return ep(t,n.focus),!0;t.setSelection(a,0)}}return!1}}function ep(t,e){t.split(e),t.setSelection(e.parent.nextSibling,0)}const np={insertParagraph:{isSoft:!1},insertLineBreak:{isSoft:!0}};class ip extends Ba{constructor(t){super(t);const e=this.document;let n=!1;e.on("keydown",((t,e)=>{n=e.shiftKey})),e.on("beforeinput",((i,o)=>{if(!this.isEnabled)return;let r=o.inputType;l.isSafari&&n&&"insertParagraph"==r&&(r="insertLineBreak");const s=o.domEvent,a=np[r];if(!a)return;const c=new Bs(e,"enter",o.targetRanges[0]);e.fire(c,new Na(t,s,{isSoft:a.isSoft})),c.stop.called&&i.stop()}))}observe(){}stopObserving(){}}class op extends ur{static get pluginName(){return"Enter"}init(){const t=this.editor,e=t.editing.view,n=e.document;e.addObserver(ip),t.commands.add("enter",new tp(t)),this.listenTo(n,"enter",((i,o)=>{n.isComposing||o.preventDefault(),o.isSoft||(t.execute("enter"),e.scrollToTheSelection())}),{priority:"low"})}}class rp extends gr{execute(){const t=this.editor.model,e=t.document;t.change((n=>{!function(t,e,n){const i=n.isCollapsed,o=n.getFirstRange(),r=o.start.parent,s=o.end.parent,a=r==s;if(i){const i=Xg(t.schema,n.getAttributes());sp(t,e,o.end),e.removeSelectionAttribute(n.getAttributeKeys()),e.setSelectionAttribute(i)}else{const i=!(o.start.isAtStart&&o.end.isAtEnd);t.deleteContent(n,{leaveUnmerged:i}),a?sp(t,e,n.focus):i&&e.setSelection(s,0)}}(t,n,e.selection),this.fire("afterExecute",{writer:n})}))}refresh(){const t=this.editor.model,e=t.document;this.isEnabled=function(t,e){if(e.rangeCount>1)return!1;const n=e.anchor;if(!n||!t.checkChild(n,"softBreak"))return!1;const i=e.getFirstRange(),o=i.start.parent,r=i.end.parent;return!ap(o,t)&&!ap(r,t)||o===r}(t.schema,e.selection)}}function sp(t,e,n){const i=e.createElement("softBreak");t.insertContent(i,n),e.setSelection(i,"after")}function ap(t,e){return!t.is("rootElement")&&(e.isLimit(t)||ap(t.parent,e))}class lp extends ur{static get pluginName(){return"ShiftEnter"}init(){const t=this.editor,e=t.model.schema,n=t.conversion,i=t.editing.view,o=i.document;e.register("softBreak",{allowWhere:"$text",isInline:!0}),n.for("upcast").elementToElement({model:"softBreak",view:"br"}),n.for("downcast").elementToElement({model:"softBreak",view:(t,{writer:e})=>e.createEmptyElement("br")}),i.addObserver(ip),t.commands.add("shiftEnter",new rp(t)),this.listenTo(o,"enter",((e,n)=>{o.isComposing||n.preventDefault(),n.isSoft&&(t.execute("shiftEnter"),i.scrollToTheSelection())}),{priority:"low"})}}class cp extends(T()){constructor(){super(...arguments),this._stack=[]}add(t,e){const n=this._stack,i=n[0];this._insertDescriptor(t);const o=n[0];i===o||dp(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||dp(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(dp(t,e[n]))return;n>-1&&e.splice(n,1);let i=0;for(;e[i]&&hp(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 dp(t,e){return t&&e&&t.priority==e.priority&&up(t.classes)==up(e.classes)}function hp(t,e){return t.priority>e.priority||!(t.priorityup(e.classes)}function up(t){return Array.isArray(t)?t.sort().join(","):t}const mp=' ',gp="ck-widget",pp="ck-widget_selected";function fp(t){return!!t.is("element")&&!!t.getCustomProperty("widget")}function bp(t,e,n={}){if(!t.is("containerElement"))throw new A("widget-to-widget-wrong-element-type",null,{element:t});return e.setAttribute("contenteditable","false",t),e.addClass(gp,t),e.setCustomProperty("widget",!0,t),t.getFillerOffset=vp,e.setCustomProperty("widgetLabel",[],t),n.label&&function(t,e){t.getCustomProperty("widgetLabel").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 ko;return n.set("content",mp),n.render(),e.appendChild(n.element),e}));e.insert(e.createPositionAt(t,0),n),e.addClass(["ck-widget_with-selection-handle"],t)}(t,e),Ap(t,e),t}function kp(t,e,n){if(e.classes&&n.addClass(Bi(e.classes),t),e.attributes)for(const i in e.attributes)n.setAttribute(i,e.attributes[i],t)}function wp(t,e,n){if(e.classes&&n.removeClass(Bi(e.classes),t),e.attributes)for(const i in e.attributes)n.removeAttribute(i,t)}function Ap(t,e,n=kp,i=wp){const o=new cp;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 Cp(t,e,n={}){return e.addClass(["ck-editor__editable","ck-editor__nested-editable"],t),e.setAttribute("role","textbox",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)})),Ap(t,e),t}function _p(t,e){const n=t.getSelectedElement();if(n){const i=Ep(t);if(i)return e.createRange(e.createPositionAt(n,i))}return eh(t,e)}function vp(){return null}const yp="widget-type-around";function xp(t,e,n){return!!t&&fp(t)&&!n.isInline(e)}function Ep(t){return t.getAttribute(yp)}var Dp=n(5137);Wi()(Dp.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),Dp.Z.locals;const Sp=["before","after"],Tp=(new DOMParser).parseFromString(' ',"image/svg+xml").firstChild,Ip="ck-widget__type-around_disabled";class Bp extends ur{constructor(){super(...arguments),this._currentFakeCaretModelElement=null}static get pluginName(){return"WidgetTypeAround"}static get requires(){return[op,Bg]}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(Ip,n):t.addClass(Ip,n)})),o||t.model.change((t=>{t.removeSelectionAttribute(yp)}))})),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=Ep(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);s&&xp(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 Sp){const i=new Ki({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(Tp,!0)]});t.appendChild(i.render())}}(n,e),function(t){const e=new Ki({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:[fp,"$text"],priority:"high"}),this._listenToIfEnabled(n,"change:range",((e,n)=>{n.directChange&&t.model.change((t=>{t.removeSelectionAttribute(yp)}))})),this._listenToIfEnabled(e.document,"change:data",(()=>{const e=n.getSelectedElement();e&&xp(t.editing.mapper.toViewElement(e),e,i)||t.model.change((t=>{t.removeSelectionAttribute(yp)}))})),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(Sp.map(r),t),this._currentFakeCaretModelElement=null)}const s=e.selection.getSelectedElement();if(!s)return;const a=n.mapper.toViewElement(s);if(!xp(a,s,i))return;const l=Ep(e.selection);l&&(o.addClass(r(l),a),this._currentFakeCaretModelElement=s)})),this._listenToIfEnabled(t.ui.focusTracker,"change:isFocused",((e,n,i)=>{i||t.model.change((t=>{t.removeSelectionAttribute(yp)}))}))}_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=Si(t,e);return"down"===n||"right"===n}(e.keyCode,n.locale.contentLanguageDirection),l=s.document.selection.getSelectedElement();let c;xp(l,n.editing.mapper.toModelElement(l),r)?c=this._handleArrowKeyPressOnSelectedWidget(a):o.isCollapsed?c=this._handleArrowKeyPressWhenSelectionNextToAWidget(a):e.shiftKey||(c=this._handleArrowKeyPressWhenNonCollapsedSelection(a)),c&&(e.preventDefault(),t.stop())}_handleArrowKeyPressOnSelectedWidget(t){const e=this.editor.model,n=Ep(e.document.selection);return e.change((e=>n?n!==(t?"after":"before")&&(e.removeSelectionAttribute(yp),!0):(e.setSelectionAttribute(yp,t?"after":"before"),!0)))}_handleArrowKeyPressWhenSelectionNextToAWidget(t){const e=this.editor,n=e.model,i=n.schema,o=e.plugins.get("Widget"),r=o._getObjectElementNextToSelection(t);return!!xp(e.editing.mapper.toViewElement(r),r,i)&&(n.change((e=>{o._setSelectionOverElement(r),e.setSelectionAttribute(yp,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!!xp(o.toViewElement(s),s,i)&&(n.change((e=>{e.setSelection(s,"on"),e.setSelectionAttribute(yp,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:xp(r,o,s)&&(this._insertParagraph(o,i.isSoft?"before":"after"),a=!0),a&&(i.preventDefault(),n.stop())}),{context:fp})}_enableInsertingParagraphsOnTypingKeystroke(){const t=this.editor.editing.view.document;this._listenToIfEnabled(t,"insertText",((e,n)=>{this._insertParagraphAccordingToFakeCaretPosition()&&(n.selection=t.selection)}),{priority:"high"}),l.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=Ep(n.document.selection);if(!r)return;const s=o.direction,a=n.document.selection.getSelectedElement(),l="forward"==s;if("before"===r===l)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(l?"deleteForward":"delete")}))}else n.change((n=>{n.setSelection(e),t.execute(l?"deleteForward":"delete")}))}o.preventDefault(),e.stop()}),{context:fp})}_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=Ep(n);return r?(t.stop(),e.change((t=>{const o=n.getSelectedElement(),s=e.createPositionAt(o,r),a=t.createSelection(s),l=e.insertContent(i,a);return t.setSelection(a),l}))):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=Ep(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])=>{n&&!n.is("documentSelection")||Ep(e)&&t.stop()}),{priority:"high"})}}function Mp(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 Np(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 zp=n(6507);Wi()(zp.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),zp.Z.locals;class Lp extends ur{constructor(){super(...arguments),this._previouslySelected=new Set}static get pluginName(){return"Widget"}static get requires(){return[Bp,Bg]}init(){const t=this.editor,e=t.editing.view,n=e.document;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 l;fp(a)&&i.consumable.consume(r,"selection")&&o.setSelection(o.createRangeOn(a),{fake:!0,label:(l=a,l.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;fp(t)&&!Pp(t,r)&&(i.addClass(pp,t),this._previouslySelected.add(t),r=t)}}),{priority:"low"}),e.addObserver(dh),this.listenTo(n,"mousedown",((...t)=>this._onMousedown(...t))),this.listenTo(n,"arrowKey",((...t)=>{this._handleSelectionChangeOnArrowKeyPress(...t)}),{context:[fp,"$text"]}),this.listenTo(n,"arrowKey",((...t)=>{this._preventDefaultOnArrowKeyPress(...t)}),{context:"$root"}),this.listenTo(n,"arrowKey",function(t){const e=t.model;return(n,i)=>{const o=i.keyCode==vi.arrowup,r=i.keyCode==vi.arrowdown,s=i.shiftKey,a=e.document.selection;if(!o&&!r)return;const l=r;if(s&&function(t,e){return!t.isCollapsed&&t.isBackward==e}(a,l))return;const c=function(t,e,n){const i=t.model;if(n){const t=e.isCollapsed?e.focus:e.getLastPosition(),n=Mp(i,t,"forward");if(!n)return null;const o=i.createRange(t,n),r=Np(i.schema,o,"backward");return r?i.createRange(t,r):null}{const t=e.isCollapsed?e.focus:e.getFirstPosition(),n=Mp(i,t,"backward");if(!n)return null;const o=i.createRange(n,t),r=Np(i.schema,o,"forward");return r?i.createRange(r,t):null}}(t,a,l);if(c){if(c.isCollapsed){if(a.isCollapsed)return;if(s)return}(c.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=Zn.getDomRangeRects(s);let l;for(const t of a)if(void 0!==l){if(Math.round(t.top)>=l)return!1;l=Math.max(l,Math.round(t.bottom))}else l=Math.round(t.bottom);return!0}(t,c,l))&&(e.change((t=>{const n=l?c.end:c.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())}}}(this.editor.editing),{context:"$text"}),this.listenTo(n,"delete",((t,e)=>{this._handleDelete("forward"==e.direction)&&(e.preventDefault(),t.stop())}),{context:"$root"})}_onMousedown(t,e){const n=this.editor,i=n.editing.view,o=i.document;let r=e.target;if(function(t){let e=t;for(;e;){if(e.is("editableElement")&&!e.is("rootElement"))return!0;if(fp(e))return!1;e=e.parent}return!1}(r)){if((l.isSafari||l.isGecko)&&e.domEvent.detail>=3){const t=n.editing.mapper,i=r.is("attributeElement")?r.findAncestor((t=>!t.is("attributeElement"))):r,o=t.toModelElement(i);e.preventDefault(),this.editor.model.change((t=>{t.setSelection(o,"in")}))}return}if(!fp(r)&&(r=r.findAncestor(fp),!r))return;l.isAndroid&&e.preventDefault(),o.isFocused||i.focus();const s=n.editing.mapper.toModelElement(r);this._setSelectionOverElement(s)}_handleSelectionChangeOnArrowKeyPress(t,e){const n=e.keyCode,i=this.editor.model,o=i.schema,r=i.document.selection,s=r.getSelectedElement(),a=Si(n,this.editor.locale.contentLanguageDirection),l="down"==a||"right"==a,c="up"==a||"down"==a;if(s&&o.isObject(s)){const n=l?r.getLastPosition():r.getFirstPosition(),s=o.getNearestSelectionRange(n,l?"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,c=s.nodeBefore;return void((a&&o.isObject(a)||c&&o.isObject(c))&&(i.change((t=>{t.setSelection(l?s:n)})),e.preventDefault(),t.stop()))}if(!r.isCollapsed)return;const d=this._getObjectElementNextToSelection(l);if(d&&o.isObject(d)){if(o.isInline(d)&&c)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(pp,e);this._previouslySelected.clear()}}function Pp(t,e){return!!e&&Array.from(t.getAncestors()).includes(e)}class Rp extends ur{constructor(){super(...arguments),this._toolbarDefinitions=new Map}static get requires(){return[Om]}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||!fp(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 C("widget-toolbar-no-items",{toolbarId:t});const r=this.editor,s=r.t,a=new au(r.locale);if(a.ariaLabel=e||s("Widget toolbar"),this._toolbarDefinitions.has(t))throw new A("widget-toolbar-duplicated",this,{toolbarId:t});const l={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(l,t)},afterBlur:()=>{this._hideToolbar(l)}}),this._toolbarDefinitions.set(t,l)}_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)?Op(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:Vp(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);Op(this.editor,e)}})))}_isToolbarVisible(t){return this._balloon.visibleView===t.view}_isToolbarInBalloon(t){return this._balloon.hasView(t.view)}}function Op(t,e){const n=t.plugins.get("ContextualBalloon"),i=Vp(t,e);n.updatePosition(i)}function Vp(t,e){const n=t.editing.view,i=dm.defaultPositions;return{target:n.domConverter.mapViewToDom(e),positions:[i.northArrowSouth,i.northArrowSouthWest,i.northArrowSouthEast,i.southArrowNorth,i.southArrowNorthWest,i.southArrowNorthEast,i.viewportStickyNorth]}}class Fp extends(G()){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 Zn(e);this.activeHandlePosition=function(t){const e=["top-left","top-right","bottom-right","bottom-left"];for(const n of e)if(t.classList.contains(jp(n)))return n}(t),this._referenceCoordinates=function(t,e){const n=new Zn(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){const n=t.parentElement;let i=parseFloat(n.ownerDocument.defaultView.getComputedStyle(n).width);let o=0,r=n;for(;isNaN(i);){if(r=r.parentElement,++o>5)return 0;i=parseFloat(n.ownerDocument.defaultView.getComputedStyle(r).width)}return e.width/i*100}(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 jp(t){return`ck-widget__resizer__handle-${t}`}class Hp extends $i{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 Up extends(G()){constructor(t){super(),this._viewResizerWrapper=null,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 Fp(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 Zn(n),o=Math.round(i.width),r=Math.round(i.height),s=new Zn(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 Zn(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"!==J(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=(o=t).pageX,i=o.pageY;var o;const r=!this._options.isCentered||this._options.isCentered(this),s={x:e._referenceCoordinates.x-(n+e.originalWidth),y:i-e.originalHeight-e._referenceCoordinates.y};r&&e.activeHandlePosition.endsWith("-right")&&(s.x=n-(e._referenceCoordinates.x+e.originalWidth)),r&&(s.x*=2);let a=Math.abs(e.originalWidth+s.x),l=Math.abs(e.originalHeight+s.y);return"width"==(a/e.aspectRatio>l?"width":"height")?l=a/e.aspectRatio:a=l*e.aspectRatio,{width:Math.round(a),height:Math.round(l),widthPercents:Math.min(Math.round(e.originalWidthPercents/e.originalWidth*a*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 Ki({tag:"div",attributes:{class:"ck-widget__resizer__handle "+(n=i,`ck-widget__resizer__handle-${n}`)}}).render());var n}_appendSizeUI(t){this._sizeView=new Hp,this._sizeView.render(),t.appendChild(this._sizeView.element)}}var Gp=n(2263);Wi()(Gp.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),Gp.Z.locals;class Wp extends ur{constructor(){super(...arguments),this._resizers=new Map}static get pluginName(){return"WidgetResize"}init(){const t=this.editor.editing,e=Gn.window.document;this.set("selectedResizer",null),this.set("_activeResizer",null),t.view.addObserver(dh),this._observer=new(Fn()),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=bm((()=>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(Gn.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 Up(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;Up.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)}}var qp=n(390);Wi()(qp.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),qp.Z.locals;class $p extends ur{static get pluginName(){return"DragDrop"}static get requires(){return[bg,Lp]}init(){const t=this.editor,e=t.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,this._updateDropMarkerThrottled=bm((t=>this._updateDropMarker(t)),40),this._removeDropMarkerDelayed=Oi((()=>this._removeDropMarker()),40),this._clearDraggableAttributesDelayed=Oi((()=>this._clearDraggableAttributes()),40),t.plugins.has("DragDropExperimental")?this.forceDisabled("DragDropExperimental"):(e.addObserver(gg),e.addObserver(dh),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDropMarker(),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)})),l.isAndroid&&this.forceDisabled("noAndroidSupport"))}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._updateDropMarkerThrottled.cancel(),this._removeDropMarkerDelayed.cancel(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const t=this.editor,e=t.model,n=e.document,i=t.editing.view,o=i.document;this.listenTo(o,"dragstart",((i,r)=>{const s=n.selection;if(r.target&&r.target.is("editableElement"))return void r.preventDefault();const a=r.target?Zp(r.target):null;if(a){const n=t.editing.mapper.toModelElement(a);this._draggedRange=Vl.fromRange(e.createRangeOn(n)),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop")}else if(!o.selection.isCollapsed){const t=o.selection.getSelectedElement();t&&fp(t)||(this._draggedRange=Vl.fromRange(s.getFirstRange()))}if(!this._draggedRange)return void r.preventDefault();this._draggingUid=f();const l=this.isEnabled&&t.model.canEditAt(this._draggedRange);r.dataTransfer.effectAllowed=l?"copyMove":"copy",r.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const c=e.createSelection(this._draggedRange.toRange()),d=t.data.toView(e.getSelectedContent(c));o.fire("clipboardOutput",{dataTransfer:r.dataTransfer,content:d,method:"dragstart"}),l||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")}),{priority:"low"}),this.listenTo(o,"dragend",((t,e)=>{this._finalizeDragging(!e.dataTransfer.isCanceled&&"move"==e.dataTransfer.dropEffect)}),{priority:"low"}),this.listenTo(o,"dragenter",(()=>{this.isEnabled&&i.focus()})),this.listenTo(o,"dragleave",(()=>{this._removeDropMarkerDelayed()})),this.listenTo(o,"dragging",((e,n)=>{if(!this.isEnabled)return void(n.dataTransfer.dropEffect="none");this._removeDropMarkerDelayed.cancel();const i=Kp(t,n.targetRanges,n.target);t.model.canEditAt(i)?(this._draggedRange||(n.dataTransfer.dropEffect="copy"),l.isGecko||("copy"==n.dataTransfer.effectAllowed?n.dataTransfer.dropEffect="copy":["all","copyMove"].includes(n.dataTransfer.effectAllowed)&&(n.dataTransfer.dropEffect="move")),i&&this._updateDropMarkerThrottled(i)):n.dataTransfer.dropEffect="none"}),{priority:"low"})}_setupClipboardInputIntegration(){const t=this.editor,e=t.editing.view.document;this.listenTo(e,"clipboardInput",((e,n)=>{if("drop"!=n.method)return;const i=Kp(t,n.targetRanges,n.target);return this._removeDropMarker(),i&&t.model.canEditAt(i)?(this._draggedRange&&this._draggingUid!=n.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid=""),"move"==Yp(n.dataTransfer)&&this._draggedRange&&this._draggedRange.containsRange(i,!0)?(this._finalizeDragging(!1),void e.stop()):void(n.targetRanges=[t.editing.mapper.toViewRange(i)])):(this._finalizeDragging(!1),void e.stop())}),{priority:"high"})}_setupContentInsertionIntegration(){const t=this.editor.plugins.get(bg);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"==Yp(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(l.isAndroid||!o)return;this._clearDraggableAttributesDelayed.cancel();let r=Zp(o.target);if(l.isBlink&&!r&&!n.selection.isCollapsed){const t=n.selection.getSelectedElement();if(!t||!fp(t)){const t=n.selection.editableElement;t&&!t.isReadOnly&&(r=t)}}r&&(e.change((t=>{t.setAttribute("draggable","true",r)})),this._draggableElement=t.editing.mapper.toModelElement(r))})),this.listenTo(n,"mouseup",(()=>{l.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}))}_setupDropMarker(){const t=this.editor;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 n.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},(function(t){const e=this.toDomElement(t);return e.append("",t.createElement("span"),""),e}))}})}_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})}))}_removeDropMarker(){const t=this.editor.model;this._removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),t.markers.has("drop-target")&&t.change((t=>{t.removeMarker("drop-target")}))}_finalizeDragging(t){const e=this.editor,n=e.model;this._removeDropMarker(),this._clearDraggableAttributes(),e.plugins.has("WidgetToolbarRepository")&&e.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._draggedRange&&(t&&this.isEnabled&&n.deleteContent(n.createSelection(this._draggedRange),{doNotAutoparagraph:!0}),this._draggedRange.detach(),this._draggedRange=null)}}function Kp(t,e,n){const i=t.model,o=t.editing.mapper;let r=null;const s=e?e[0].start:null;if(n.is("uiElement")&&(n=n.parent),r=function(t,e){const n=t.model,i=t.editing.mapper;if(fp(e))return n.createRangeOn(i.toModelElement(e));if(!e.is("editableElement")){const t=e.findAncestor((t=>fp(t)||t.is("editableElement")));if(fp(t))return n.createRangeOn(i.toModelElement(t))}return null}(t,n),r)return r;const a=function(t,e){const n=t.editing.mapper,i=t.editing.view,o=n.toModelElement(e);if(o)return o;const r=i.createPositionBefore(e),s=n.findMappedViewAncestor(r);return n.toModelElement(s)}(t,n),c=s?o.toModelPosition(s):null;return c?(r=function(t,e,n){const i=t.model;if(!i.schema.checkChild(n,"$block"))return null;const o=i.createPositionAt(n,0),r=e.path.slice(0,o.path.length),s=i.createPositionFromPath(e.root,r).nodeAfter;return s&&i.schema.isObject(s)?i.createRangeOn(s):null}(t,c,a),r||(r=i.schema.getNearestSelectionRange(c,l.isGecko?"forward":"backward"),r||function(t,e){const n=t.model;let i=e;for(;i;){if(n.schema.isObject(i))return n.createRangeOn(i);i=i.parent}return null}(t,c.parent))):function(t,e){const n=t.model,i=n.schema,o=n.createPositionAt(e,0);return i.getNearestSelectionRange(o,"forward")}(t,a)}function Yp(t){return l.isGecko?t.dropEffect:["all","copyMove"].includes(t.effectAllowed)?"move":"copy"}function Zp(t){if(t.is("editableElement"))return null;if(t.hasClass("ck-widget__selection-handle"))return t.findAncestor(fp);if(fp(t))return t;const e=t.findAncestor((t=>fp(t)||t.is("editableElement")));return fp(e)?e:null}class Qp extends ur{static get pluginName(){return"PastePlainText"}static get requires(){return[bg]}init(){const t=this.editor,e=t.model,n=t.editing.view,i=n.document,o=e.document.selection;let r=!1;n.addObserver(gg),this.listenTo(i,"keydown",((t,e)=>{r=e.shiftKey})),t.plugins.get(bg).on("contentInsertion",((t,n)=>{(r||function(t,e){if(t.childCount>1)return!1;const n=t.getChild(0);return!e.isObject(n)&&0==Array.from(n.getAttributeKeys()).length}(n.content,e.schema))&&e.change((t=>{const i=Array.from(o.getAttributes()).filter((([t])=>e.schema.getAttributeProperties(t).isFormatting));o.isCollapsed||e.deleteContent(o,{doNotAutoparagraph:!0}),i.push(...o.getAttributes());const r=t.createRangeIn(n.content);for(const e of r.getItems())e.is("$textProxy")&&t.setAttributes(i,e)}))}))}}class Jp extends ur{static get pluginName(){return"Clipboard"}static get requires(){return[bg,$p,Qp]}}ei("px");class Xp extends gr{constructor(t){super(t),this._stack=[],this._createdBatches=new WeakSet,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=>!ef(t,a)));e.length&&(tf(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=bd([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 ad(o.baseVersion)),e.addOperation(o),n.applyOperation(o),i.history.setOperationAsUndone(t,o)}}}}function tf(t){t.sort(((t,e)=>t.start.isBefore(e.start)?-1:1));for(let e=1;ee!==t&&e.containsRange(t,!0)))}class nf extends Xp{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 of extends Xp{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 rf extends ur{constructor(){super(...arguments),this._batchRegistry=new WeakSet}static get pluginName(){return"UndoEditing"}init(){const t=this.editor;this._undoCommand=new nf(t),this._redoCommand=new of(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")}}const sf=' ',af=' ';class lf extends ur{static get pluginName(){return"UndoUI"}init(){const t=this.editor,e=t.locale,n=t.t,i="ltr"==e.uiLanguageDirection?sf:af,o="ltr"==e.uiLanguageDirection?af:sf;this._addButton("undo",n("Undo"),"CTRL+Z",i),this._addButton("redo",n("Redo"),"CTRL+Y",o)}_addButton(t,e,n,i){const o=this.editor;o.ui.componentFactory.add(t,(r=>{const s=o.commands.get(t),a=new Ao(r);return a.set({label:e,icon:i,keystroke:n,tooltip:!0}),a.bind("isEnabled").to(s,"isEnabled"),this.listenTo(a,"execute",(()=>{o.execute(t),o.editing.view.focus()})),a}))}}class cf extends ur{static get requires(){return[rf,lf]}static get pluginName(){return"Undo"}}function df(t){return t.createContainerElement("figure",{class:"image"},[t.createEmptyElement("img"),t.createSlot("children")])}function hf(t,e){const n=t.plugins.get("ImageUtils"),i=t.plugins.has("ImageInlineEditing")&&t.plugins.has("ImageBlockEditing");return t=>n.isInlineImageView(t)?i&&("block"==t.getStyle("display")||t.findAncestor(n.isBlockImageView)?"imageBlock":"imageInline")!==e?null:o(t):null;function o(t){const e={name:!0};return t.hasAttribute("src")&&(e.attributes=["src"]),e}}function uf(t,e){const n=zi(e.getSelectedBlocks());return!n||t.isObject(n)||n.isEmpty&&"listItem"!=n.name?"imageBlock":"imageInline"}class mf extends ur{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){const i=this.editor,o=i.model,r=o.document.selection;n=gf(i,e||r,n),t={...Object.fromEntries(r.getAttributes()),...t};for(const e in t)o.schema.checkAttribute(n,e)||delete t[e];return o.change((i=>{const r=i.createElement(n,t);return o.insertObject(r,e,null,{setSelection:"on",findOptimalPosition:e||"imageInline"==n?void 0:"auto"}),r.parent?r:null}))}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")}isImageAllowed(){const t=this.editor.model.document.selection;return function(t,e){if("imageBlock"==gf(t,e,null)){const n=function(t,e){const n=_p(t,e).start.parent;return n.isEmpty&&!n.is("element","$root")?n.parent:n}(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){return e.setCustomProperty("image",!0,t),bp(t,e,{label:()=>{const e=this.findViewImgElement(t).getAttribute("alt");return e?`${e} ${n}`:n}})}isImageWidget(t){return!!t.getCustomProperty("image")&&fp(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}}function gf(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":"block"===o?"imageBlock":e.is("selection")?uf(i,e):i.checkChild(e,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}const pf=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));function ff(t,e,n,i){let o,r=null;"function"==typeof i?o=i:(r=t.commands.get(i),o=()=>{t.execute(i)}),t.model.document.on("change:data",((s,a)=>{if(r&&!r.isEnabled||!e.isEnabled)return;const l=zi(t.model.document.selection.getRanges());if(!l.isCollapsed)return;if(a.isUndo||!a.isLocal)return;const c=Array.from(t.model.document.differ.getChanges()),d=c[0];if(1!=c.length||"insert"!==d.type||"$text"!=d.name||1!=d.length)return;const h=d.position.parent;if(h.is("element","codeBlock"))return;if(h.is("element","listItem")&&"function"!=typeof i&&!["numberedList","bulletedList","todoList"].includes(i))return;if(r&&!0===r.value)return;const u=h.getChild(0),m=t.model.createRangeOn(u);if(!m.containsRange(l)&&!l.end.isEqual(m.end))return;const g=n.exec(u.data.substr(0,l.end.offset));g&&t.model.enqueueChange((e=>{const n=e.createPositionAt(h,0),i=e.createPositionAt(h,g[0].length),r=new Vl(n,i);if(!1!==o({match:g})){e.remove(r);const n=t.model.document.selection.getFirstRange(),i=e.createRangeIn(h);!h.isEmpty||i.isEqual(n)||i.containsRange(n,!0)||e.remove(h)}r.detach(),t.model.enqueueChange((()=>{t.plugins.get("Delete").requestUndoOnBackspace()}))}))}))}function bf(t,e,n,i){let o,r;n instanceof RegExp?o=n:r=n,r=r||(t=>{let e;const n=[],i=[];for(;null!==(e=o.exec(t))&&!(e&&e.length<4);){let{index:t,1:o,2:r,3:s}=e;const a=o+r+s;t+=e[0].length-a.length;const l=[t,t+o.length],c=[t+o.length+r.length,t+o.length+r.length+s.length];n.push(l),n.push(c),i.push([t+o.length,t+o.length+r.length])}return{remove:n,format:i}}),t.model.document.on("change:data",((n,o)=>{if(o.isUndo||!o.isLocal||!e.isEnabled)return;const s=t.model,a=s.document.selection;if(!a.isCollapsed)return;const l=Array.from(s.document.differ.getChanges()),c=l[0];if(1!=l.length||"insert"!==c.type||"$text"!=c.name||1!=c.length)return;const d=a.focus,h=d.parent,{text:u,range:m}=function(t,e){let n=t.start;return{text:Array.from(t.getItems()).reduce(((t,i)=>!i.is("$text")&&!i.is("$textProxy")||i.getAttribute("code")?(n=e.createPositionAfter(i),""):t+i.data),""),range:e.createRange(n,t.end)}}(s.createRange(s.createPositionAt(h,0),d),s),g=r(u),p=kf(m.start,g.format,s),f=kf(m.start,g.remove,s);p.length&&f.length&&s.enqueueChange((e=>{if(!1!==i(e,p)){for(const t of f.reverse())e.remove(t);s.enqueueChange((()=>{t.plugins.get("Delete").requestUndoOnBackspace()}))}}))}))}function kf(t,e,n){return e.filter((t=>void 0!==t[0]&&void 0!==t[1])).map((e=>n.createRange(t.getShiftedBy(e[0]),t.getShiftedBy(e[1]))))}function wf(t,e){return(n,i)=>{if(!t.commands.get(e).isEnabled)return!1;const o=t.model.schema.getValidRanges(i,e);for(const t of o)n.setAttribute(e,!0,t);n.removeSelectionAttribute(e)}}var Af=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");const Cf=function(t){return Af.test(t)};var _f="\\ud800-\\udfff",vf="["+_f+"]",yf="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",xf="\\ud83c[\\udffb-\\udfff]",Ef="[^"+_f+"]",Df="(?:\\ud83c[\\udde6-\\uddff]){2}",Sf="[\\ud800-\\udbff][\\udc00-\\udfff]",Tf="(?:"+yf+"|"+xf+")?",If="[\\ufe0e\\ufe0f]?",Bf=If+Tf+"(?:\\u200d(?:"+[Ef,Df,Sf].join("|")+")"+If+Tf+")*",Mf="(?:"+[Ef+yf+"?",yf,Df,Sf,vf].join("|")+")",Nf=RegExp(xf+"(?="+xf+")|"+Mf+Bf,"g");const zf=function(t){return Cf(t)?function(t){return t.match(Nf)||[]}(t):function(t){return t.split("")}(t)},Lf=function(t){t=qr(t);var e=Cf(t)?zf(t):void 0,n=e?e[0]:t.charAt(0),i=e?function(t,e,n){var i=t.length;return n=void 0===n?i:n,!e&&n>=i?t:Zr(t,e,n)}(e,1).join(""):t.slice(1);return n.toUpperCase()+i},Pf=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,Rf=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i,Of=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,Vf=/^((\w+:(\/{2,})?)|(\W))/i,Ff="Ctrl+K";function jf(t,{writer:e}){const n=e.createAttributeElement("a",{href:t},{priority:5});return e.setCustomProperty("link",!0,n),n}function Hf(t){const e=String(t);return function(t){return!!t.replace(Pf,"").match(Rf)}(e)?e:"#"}function Uf(t,e){return!!t&&e.checkAttribute(t.name,"linkHref")}function Gf(t,e){const n=(i=t,Of.test(i)?"mailto:":e);var i;const o=!!n&&!Wf(t);return t&&o?n+t:t}function Wf(t){return Vf.test(t)}function qf(t){window.open(t,"_blank","noopener")}const $f=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 Kf extends ur{static get requires(){return[Bg]}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()}_enableTypingHandling(){const t=this.editor,e=new zg(t.model,(t=>{if(!function(t){return t.length>4&&" "===t[t.length-1]&&" "!==t[t.length-2]}(t))return;const e=Yf(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),l=t.model.createRange(a,s);this._applyAutoLink(r,l)})),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}=Ng(t,e),o=Yf(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=Gf(t,this.editor.config.get("link.defaultProtocol"));this.isEnabled&&function(t,e){return e.schema.checkAttributeInSelection(e.createSelection(t),"linkHref")}(e,n)&&Wf(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 Yf(t){const e=$f.exec(t);return e?e[2]:null}class Zf extends gr{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,n=e.schema,i=e.document.selection,o=Array.from(i.getSelectedBlocks()),r=void 0===t.forceValue?!this.value:t.forceValue;e.change((t=>{if(r){const e=o.filter((t=>Qf(t)||Xf(n,t)));this._applyQuote(t,e)}else this._removeQuote(t,o.filter(Qf))}))}_getValue(){const t=zi(this.editor.model.document.selection.getSelectedBlocks());return!(!t||!Qf(t))}_checkEnabled(){if(this.value)return!0;const t=this.editor.model.document.selection,e=this.editor.model.schema,n=zi(t.getSelectedBlocks());return!!n&&Xf(e,n)}_removeQuote(t,e){Jf(t,e).reverse().forEach((e=>{if(e.start.isAtStart&&e.end.isAtEnd)return void t.unwrap(e.start.parent);if(e.start.isAtStart){const n=t.createPositionBefore(e.start.parent);return void t.move(e,n)}e.end.isAtEnd||t.split(e.end);const n=t.createPositionAfter(e.end.parent);t.move(e,n)}))}_applyQuote(t,e){const n=[];Jf(t,e).reverse().forEach((e=>{let i=Qf(e.start);i||(i=t.createElement("blockQuote"),t.wrap(e,i)),n.push(i)})),n.reverse().reduce(((e,n)=>e.nextSibling==n?(t.merge(t.createPositionAfter(e)),e):n))}}function Qf(t){return"blockQuote"==t.parent.name?t.parent:null}function Jf(t,e){let n,i=0;const o=[];for(;i{const i=t.model.document.differ.getChanges();for(const t of i)if("insert"==t.type){const i=t.position.nodeAfter;if(!i)continue;if(i.is("element","blockQuote")&&i.isEmpty)return n.remove(i),!0;if(i.is("element","blockQuote")&&!e.checkChild(t.position,i))return n.unwrap(i),!0;if(i.is("element")){const t=n.createRangeIn(i);for(const i of t.getItems())if(i.is("element","blockQuote")&&!e.checkChild(n.createPositionBefore(i),i))return n.unwrap(i),!0}}else if("remove"==t.type){const e=t.position.parent;if(e.is("element","blockQuote")&&e.isEmpty)return n.remove(e),!0}return!1}));const n=this.editor.editing.view.document,i=t.model.document.selection,o=t.commands.get("blockQuote");this.listenTo(n,"enter",((e,n)=>{i.isCollapsed&&o.value&&i.getLastPosition().parent.isEmpty&&(t.execute("blockQuote"),t.editing.view.scrollToTheSelection(),n.preventDefault(),e.stop())}),{context:"blockquote"}),this.listenTo(n,"delete",((e,n)=>{if("backward"!=n.direction||!i.isCollapsed||!o.value)return;const r=i.getLastPosition().parent;r.isEmpty&&!r.previousSibling&&(t.execute("blockQuote"),t.editing.view.scrollToTheSelection(),n.preventDefault(),e.stop())}),{context:"blockquote"})}}var eb=n(636);Wi()(eb.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),eb.Z.locals;class nb extends ur{static get pluginName(){return"BlockQuoteUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add("blockQuote",(n=>{const i=t.commands.get("blockQuote"),o=new Ao(n);return o.set({label:e("Block quote"),icon:iu.quote,tooltip:!0,isToggleable:!0}),o.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(o,"execute",(()=>{t.execute("blockQuote"),t.editing.view.focus()})),o}))}}class ib extends gr{constructor(t,e){super(t),this.attributeKey=e}refresh(){const t=this.editor.model,e=t.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=t.schema.checkAttributeInSelection(e.selection,this.attributeKey)}execute(t={}){const e=this.editor.model,n=e.document.selection,i=void 0===t.forceValue?!this.value:t.forceValue;e.change((t=>{if(n.isCollapsed)i?t.setSelectionAttribute(this.attributeKey,!0):t.removeSelectionAttribute(this.attributeKey);else{const o=e.schema.getValidRanges(n.getRanges(),this.attributeKey);for(const e of o)i?t.setAttribute(this.attributeKey,i,e):t.removeAttribute(this.attributeKey,e)}}))}_getValueFromFirstAllowedNode(){const t=this.editor.model,e=t.schema,n=t.document.selection;if(n.isCollapsed)return n.hasAttribute(this.attributeKey);for(const t of n.getRanges())for(const n of t.getItems())if(e.checkAttribute(n,this.attributeKey))return n.hasAttribute(this.attributeKey);return!1}}const ob="bold";class rb extends ur{static get pluginName(){return"BoldEditing"}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:ob}),t.model.schema.setAttributeProperties(ob,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:ob,view:"strong",upcastAlso:["b",t=>{const e=t.getStyle("font-weight");return e&&("bold"==e||Number(e)>=600)?{name:!0,styles:["font-weight"]}:null}]}),t.commands.add(ob,new ib(t,ob)),t.keystrokes.set("CTRL+B",ob)}}const sb="bold";class ab extends ur{static get pluginName(){return"BoldUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add(sb,(n=>{const i=t.commands.get(sb),o=new Ao(n);return o.set({label:e("Bold"),icon:iu.bold,keystroke:"CTRL+B",tooltip:!0,isToggleable:!0}),o.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(o,"execute",(()=>{t.execute(sb),t.editing.view.focus()})),o}))}}const lb="code";class cb extends ur{static get pluginName(){return"CodeEditing"}static get requires(){return[Lg]}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:lb}),t.model.schema.setAttributeProperties(lb,{isFormatting:!0,copyOnEnter:!1}),t.conversion.attributeToElement({model:lb,view:"code",upcastAlso:{styles:{"word-wrap":"break-word"}}}),t.commands.add(lb,new ib(t,lb)),t.plugins.get(Lg).registerAttribute(lb),Jg(t,lb,"code","ck-code_selected")}}var db=n(8180);Wi()(db.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),db.Z.locals;const hb="code";class ub extends ur{static get pluginName(){return"CodeUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add(hb,(n=>{const i=t.commands.get(hb),o=new Ao(n);return o.set({label:e("Code"),icon:' ',tooltip:!0,isToggleable:!0}),o.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(o,"execute",(()=>{t.execute(hb),t.editing.view.focus()})),o}))}}function mb(t){const e=t.t,n=t.config.get("codeBlock.languages");for(const t of n)"Plain text"===t.label&&(t.label=e("Plain text")),void 0===t.class&&(t.class=`language-${t.language}`);return n}function gb(t,e,n){const i={};for(const o of t)"class"===e?i[o[e].split(" ").shift()]=o[n]:i[o[e]]=o[n];return i}function pb(t){return t.data.match(/^(\s*)/)[0]}function fb(t){const e=t.document.selection,n=[];if(e.isCollapsed)return[e.anchor];const i=e.getFirstRange().getWalker({ignoreElementEnd:!0,direction:"backward"});for(const{item:e}of i){if(!e.is("$textProxy"))continue;const{parent:i,startOffset:o}=e.textNode;if(!i.is("element","codeBlock"))continue;const r=pb(e.textNode),s=t.createPositionAt(i,o+r.length);n.push(s)}return n}function bb(t){const e=zi(t.getSelectedBlocks());return!!e&&e.is("element","codeBlock")}function kb(t,e){return!e.is("rootElement")&&!t.isLimit(e)&&t.checkChild(e.parent,"codeBlock")}class wb extends gr{constructor(t){super(t),this._lastLanguage=null}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor,n=e.model,i=n.document.selection,o=mb(e)[0],r=Array.from(i.getSelectedBlocks()),s=null==t.forceValue?!this.value:t.forceValue,a=function(t,e,n){return t.language?t.language:t.usePreviousLanguageChoice&&e?e:n}(t,this._lastLanguage,o.language);n.change((t=>{s?this._applyCodeBlock(t,r,a):this._removeCodeBlock(t,r)}))}_getValue(){const t=zi(this.editor.model.document.selection.getSelectedBlocks());return!(!t||!t.is("element","codeBlock"))&&t.getAttribute("language")}_checkEnabled(){if(this.value)return!0;const t=this.editor.model.document.selection,e=this.editor.model.schema,n=zi(t.getSelectedBlocks());return!!n&&kb(e,n)}_applyCodeBlock(t,e,n){this._lastLanguage=n;const i=this.editor.model.schema,o=e.filter((t=>kb(i,t)));for(const e of o)t.rename(e,"codeBlock"),t.setAttribute("language",n,e),i.removeDisallowedAttributes([e],t),Array.from(e.getChildren()).filter((t=>!i.checkChild(e,t))).forEach((e=>t.remove(e)));o.reverse().forEach(((e,n)=>{const i=o[n+1];e.previousSibling===i&&(t.appendElement("softBreak",i),t.merge(t.createPositionBefore(e)))}))}_removeCodeBlock(t,e){const n=e.filter((t=>t.is("element","codeBlock")));for(const e of n){const n=t.createRangeOn(e);for(const e of Array.from(n.getItems()).reverse())if(e.is("element","softBreak")&&e.parent.is("element","codeBlock")){const{position:n}=t.split(t.createPositionBefore(e)),i=n.nodeAfter;t.rename(i,"paragraph"),t.removeAttribute("language",i),t.remove(e)}t.rename(e,"paragraph"),t.removeAttribute("language",e)}}}class Ab extends gr{constructor(t){super(t),this._indentSequence=t.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model;t.change((e=>{const n=fb(t);for(const i of n){const n=e.createText(this._indentSequence);t.insertContent(n,i)}}))}_checkEnabled(){return!!this._indentSequence&&bb(this.editor.model.document.selection)}}class Cb extends gr{constructor(t){super(t),this._indentSequence=t.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model;t.change((()=>{const e=fb(t);for(const n of e){const e=_b(t,n,this._indentSequence);e&&t.deleteContent(t.createSelection(e))}}))}_checkEnabled(){if(!this._indentSequence)return!1;const t=this.editor.model;return!!bb(t.document.selection)&&fb(t).some((e=>_b(t,e,this._indentSequence)))}}function _b(t,e,n){const i=function(t){let e=t.parent.getChild(t.index);return e&&!e.is("element","softBreak")||(e=t.nodeBefore),!e||e.is("element","softBreak")?null:e}(e);if(!i)return null;const o=pb(i),r=o.lastIndexOf(n);if(r+n.length!==o.length)return null;if(-1===r)return null;const{parent:s,startOffset:a}=i;return t.createRange(t.createPositionAt(s,a+r),t.createPositionAt(s,a+r+n.length))}function vb(t,e,n=!1){const i=gb(e,"language","class"),o=gb(e,"language","label");return(e,r,s)=>{const{writer:a,mapper:l,consumable:c}=s;if(!c.consume(r.item,"insert"))return;const d=r.item.getAttribute("language"),h=l.toViewPosition(t.createPositionBefore(r.item)),u={};n&&(u["data-language"]=o[d],u.spellcheck="false");const m=i[d]?{class:i[d]}:void 0,g=a.createContainerElement("code",m),p=a.createContainerElement("pre",u,g);a.insert(h,p),l.bindElements(r.item,g)}}const yb="paragraph";class xb extends ur{static get pluginName(){return"CodeBlockEditing"}static get requires(){return[lp]}constructor(t){super(t),t.config.define("codeBlock",{languages:[{language:"plaintext",label:"Plain text"},{language:"c",label:"C"},{language:"cs",label:"C#"},{language:"cpp",label:"C++"},{language:"css",label:"CSS"},{language:"diff",label:"Diff"},{language:"html",label:"HTML"},{language:"java",label:"Java"},{language:"javascript",label:"JavaScript"},{language:"php",label:"PHP"},{language:"python",label:"Python"},{language:"ruby",label:"Ruby"},{language:"typescript",label:"TypeScript"},{language:"xml",label:"XML"}],indentSequence:"\t"})}init(){const t=this.editor,e=t.model.schema,n=t.model,i=t.editing.view,o=t.plugins.has("DocumentListEditing"),r=mb(t);t.commands.add("codeBlock",new wb(t)),t.commands.add("indentCodeBlock",new Ab(t)),t.commands.add("outdentCodeBlock",new Cb(t)),this.listenTo(i.document,"tab",((e,n)=>{const i=n.shiftKey?"outdentCodeBlock":"indentCodeBlock";t.commands.get(i).isEnabled&&(t.execute(i),n.stopPropagation(),n.preventDefault(),e.stop())}),{context:"pre"}),e.register("codeBlock",{allowWhere:"$block",allowChildren:"$text",isBlock:!0,allowAttributes:["language"]}),e.addAttributeCheck(((t,e)=>{const n=t.endsWith("codeBlock")&&e.startsWith("list")&&"list"!==e;return!(!o||!n)||!t.endsWith("codeBlock $text")&&void 0})),t.model.schema.addChildCheck(((t,e)=>{if(t.endsWith("codeBlock")&&e.isObject)return!1})),t.editing.downcastDispatcher.on("insert:codeBlock",vb(n,r,!0)),t.data.downcastDispatcher.on("insert:codeBlock",vb(n,r)),t.data.downcastDispatcher.on("insert:softBreak",function(t){return(e,n,i)=>{if("codeBlock"!==n.item.parent.name)return;const{writer:o,mapper:r,consumable:s}=i;if(!s.consume(n.item,"insert"))return;const a=r.toViewPosition(t.createPositionBefore(n.item));o.insert(a,o.createText("\n"))}}(n),{priority:"high"}),t.data.upcastDispatcher.on("element:code",function(t,e){const n=gb(e,"class","language"),i=e[0].language;return(t,e,o)=>{const r=e.viewItem,s=r.parent;if(!s||!s.is("element","pre"))return;if(e.modelCursor.findAncestor("codeBlock"))return;const{consumable:a,writer:l}=o;if(!a.test(r,{name:!0}))return;const c=l.createElement("codeBlock"),d=[...r.getClassNames()];d.length||d.push("");for(const t of d){const e=n[t];if(e){l.setAttribute("language",e,c);break}}c.hasAttribute("language")||l.setAttribute("language",i,c),o.convertChildren(r,c),o.safeInsert(c,e.modelCursor)&&(a.consume(r,{name:!0}),o.updateConversionResult(c,e))}}(0,r)),t.data.upcastDispatcher.on("text",((t,e,{consumable:n,writer:i})=>{let o=e.modelCursor;if(!n.test(e.viewItem))return;if(!o.findAncestor("codeBlock"))return;n.consume(e.viewItem);const r=e.viewItem.data.split("\n").map((t=>i.createText(t))),s=r[r.length-1];for(const t of r)if(i.insert(t,o),o=o.getShiftedBy(t.offsetSize),t!==s){const t=i.createElement("softBreak");i.insert(t,o),o=i.createPositionAfter(t)}e.modelRange=i.createRange(e.modelCursor,o),e.modelCursor=o})),t.data.upcastDispatcher.on("element:pre",((t,e,{consumable:n})=>{const i=e.viewItem;if(i.findAncestor("pre"))return;const o=Array.from(i.getChildren()),r=o.find((t=>t.is("element","code")));if(r)for(const t of o)t!==r&&t.is("$text")&&n.consume(t,{name:!0})}),{priority:"high"}),this.listenTo(t.editing.view.document,"clipboardInput",((e,i)=>{let o=n.createRange(n.document.selection.anchor);if(i.targetRanges&&(o=t.editing.mapper.toModelRange(i.targetRanges[0])),!o.start.parent.is("element","codeBlock"))return;const r=i.dataTransfer.getData("text/plain"),s=new hh(t.editing.view.document);i.content=function(t,e){const n=t.createDocumentFragment(),i=e.split("\n"),o=i.reduce(((e,n,o)=>(e.push(n),o{const o=i.anchor;!i.isCollapsed&&o.parent.is("element","codeBlock")&&o.hasSameParentAs(i.focus)&&n.change((n=>{const r=t.return;if(o.parent.is("element")&&(r.childCount>1||i.containsEntireContent(o.parent))){const e=n.createElement("codeBlock",o.parent.getAttributes());n.append(r,e);const i=n.createDocumentFragment();return n.append(e,i),void(t.return=i)}const s=r.getChild(0);e.checkAttribute(s,"code")&&n.setAttribute("code",!0,s)}))}))}afterInit(){const t=this.editor,e=t.commands,n=e.get("indent"),i=e.get("outdent");n&&n.registerChildCommand(e.get("indentCodeBlock"),{priority:"highest"}),i&&i.registerChildCommand(e.get("outdentCodeBlock")),this.listenTo(t.editing.view.document,"enter",((e,n)=>{t.model.document.selection.getLastPosition().parent.is("element","codeBlock")&&(function(t,e){const n=t.model.document,i=t.editing.view,o=n.selection.getLastPosition(),r=o.nodeAfter;return!(e||!n.selection.isCollapsed||!o.isAtStart)&&(!!Db(r)&&(t.model.change((e=>{t.execute("enter");const i=n.selection.anchor.parent.previousSibling;e.rename(i,yb),e.setSelection(i,"in"),t.model.schema.removeDisallowedAttributes([i],e),e.remove(r)})),i.scrollToTheSelection(),!0))}(t,n.isSoft)||function(t,e){const n=t.model,i=n.document,o=t.editing.view,r=i.selection.getLastPosition(),s=r.nodeBefore;let a;if(e||!i.selection.isCollapsed||!r.isAtEnd||!s||!s.previousSibling)return!1;if(Db(s)&&Db(s.previousSibling))a=n.createRange(n.createPositionBefore(s.previousSibling),n.createPositionAfter(s));else if(Eb(s)&&Db(s.previousSibling)&&Db(s.previousSibling.previousSibling))a=n.createRange(n.createPositionBefore(s.previousSibling.previousSibling),n.createPositionAfter(s));else{if(!(Eb(s)&&Db(s.previousSibling)&&Eb(s.previousSibling.previousSibling)&&s.previousSibling.previousSibling&&Db(s.previousSibling.previousSibling.previousSibling)))return!1;a=n.createRange(n.createPositionBefore(s.previousSibling.previousSibling.previousSibling),n.createPositionAfter(s))}return t.model.change((e=>{e.remove(a),t.execute("enter");const n=i.selection.anchor.parent;e.rename(n,yb),t.model.schema.removeDisallowedAttributes([n],e)})),o.scrollToTheSelection(),!0}(t,n.isSoft)||function(t){const e=t.model.document,n=e.selection.getLastPosition(),i=n.nodeBefore||n.textNode;let o;i&&i.is("$text")&&(o=pb(i)),t.model.change((n=>{t.execute("shiftEnter"),o&&n.insertText(o,e.selection.anchor)}))}(t),n.preventDefault(),e.stop())}),{context:"pre"})}}function Eb(t){return t&&t.is("$text")&&!t.data.match(/\S/)}function Db(t){return t&&t.is("element","softBreak")}var Sb=n(9085);Wi()(Sb.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),Sb.Z.locals;class Tb extends ur{static get pluginName(){return"CodeBlockUI"}init(){const t=this.editor,e=t.t,n=t.ui.componentFactory,i=mb(t);n.add("codeBlock",(n=>{const o=t.commands.get("codeBlock"),r=wu(n,fu),s=r.buttonView,a=e("Insert code block");return s.set({label:a,tooltip:!0,icon:' ',isToggleable:!0}),s.bind("isOn").to(o,"value",(t=>!!t)),s.on("execute",(()=>{t.execute("codeBlock",{usePreviousLanguageChoice:!0}),t.editing.view.focus()})),r.on("execute",(e=>{t.execute("codeBlock",{language:e.source._codeBlockLanguage,forceValue:!0}),t.editing.view.focus()})),r.class="ck-code-block-dropdown",r.bind("isEnabled").to(o),_u(r,(()=>this._getLanguageListItemDefinitions(i)),{role:"menu",ariaLabel:a}),r}))}_getLanguageListItemDefinitions(t){const e=this.editor.commands.get("codeBlock"),n=new Ni;for(const i of t){const t={type:"button",model:new Nm({_codeBlockLanguage:i.language,label:i.label,role:"menuitemradio",withText:!0})};t.model.bind("isOn").to(e,"value",(e=>e===t.model._codeBlockLanguage)),n.add(t)}return n}}function Ib(t,e,n,i){e&&function(t,e,n){if(e.attributes)for(const[i]of Object.entries(e.attributes))t.removeAttribute(i,n);if(e.styles)for(const i of Object.keys(e.styles))t.removeStyle(i,n);e.classes&&t.removeClass(e.classes,n)}(t,e,i),n&&Bb(t,n,i)}function Bb(t,e,n){if(e.attributes)for(const[i,o]of Object.entries(e.attributes))t.setAttribute(i,o,n);e.styles&&t.setStyle(e.styles,n),e.classes&&t.addClass(e.classes,n)}function Mb(t,e){const n=$l(t);let i="attributes";for(i in e)n[i]="classes"==i?Array.from(new Set([...t[i]||[],...e[i]])):{...t[i],...e[i]};return n}function Nb(t,e,n,i,o){const r=e.getAttribute(n),s={};for(const t of["attributes","styles","classes"]){if(t!=i){r&&r[t]&&(s[t]=r[t]);continue}if("classes"==i){const e=new Set(r&&r.classes||[]);o(e),e.size&&(s[t]=Array.from(e));continue}const e=new Map(Object.entries(r&&r[t]||{}));o(e),e.size&&(s[t]=Object.fromEntries(e))}Object.keys(s).length?e.is("documentSelection")?t.setSelectionAttribute(n,s):t.setAttribute(n,s,e):r&&(e.is("documentSelection")?t.removeSelectionAttribute(n):t.removeAttribute(n,e))}function zb({model:t}){return(e,n)=>n.writer.createElement(t,{htmlContent:e.getCustomProperty("$rawContent")})}function Lb(t,{view:e,isInline:n}){const i=t.t;return(t,{writer:o})=>{const r=i("HTML object"),s=Pb(e,t,o),a=t.getAttribute("htmlAttributes");return o.addClass("html-object-embed__content",s),a&&Bb(o,a,s),bp(o.createContainerElement(n?"span":"div",{class:"html-object-embed","data-html-object-embed-label":r},s),o,{label:r})}}function Pb(t,e,n){return n.createRawElement(t,null,((t,n)=>{n.setContentOf(t,e.getAttribute("htmlContent"))}))}function Rb({priority:t,view:e}){return(n,i)=>{if(!n)return;const{writer:o}=i,r=o.createAttributeElement(e,null,{priority:t});return Bb(o,n,r),r}}function Ob({view:t},e){return n=>{n.on(`element:${t}`,((t,n,i)=>{if(!n.modelRange||n.modelRange.isCollapsed)return;const o=e.processViewAttributes(n.viewItem,i);o&&i.writer.setAttribute("htmlAttributes",o,n.modelRange)}),{priority:"low"})}}function Vb({model:t}){return e=>{e.on(`attribute:htmlAttributes:${t}`,((t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const{attributeOldValue:i,attributeNewValue:o}=e;Ib(n.writer,i,o,n.mapper.toViewElement(e.item))}))}}const Fb=[{model:"codeBlock",view:"pre"},{model:"paragraph",view:"p"},{model:"blockQuote",view:"blockquote"},{model:"listItem",view:"li"},{model:"pageBreak",view:"div"},{model:"rawHtml",view:"div"},{model:"table",view:"table"},{model:"tableRow",view:"tr"},{model:"tableCell",view:"td"},{model:"tableCell",view:"th"},{model:"tableColumnGroup",view:"colgroup"},{model:"tableColumn",view:"col"},{model:"caption",view:"caption"},{model:"caption",view:"figcaption"},{model:"imageBlock",view:"img"},{model:"imageInline",view:"img"},{model:"htmlP",view:"p",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlBlockquote",view:"blockquote",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlTable",view:"table",modelSchema:{allowWhere:"$block",isBlock:!0}},{model:"htmlTbody",view:"tbody",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlThead",view:"thead",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlTfoot",view:"tfoot",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlCaption",view:"caption",modelSchema:{allowIn:"htmlTable",allowChildren:"$text",isBlock:!1}},{model:"htmlColgroup",view:"colgroup",modelSchema:{allowIn:"htmlTable",allowChildren:"col",isBlock:!1}},{model:"htmlCol",view:"col",modelSchema:{allowIn:"htmlColgroup",isBlock:!1}},{model:"htmlTr",view:"tr",modelSchema:{allowIn:["htmlTable","htmlThead","htmlTbody"],isLimit:!0}},{model:"htmlTd",view:"td",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlTh",view:"th",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlFigure",view:"figure",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFigcaption",view:"figcaption",modelSchema:{allowIn:"htmlFigure",allowChildren:"$text",isBlock:!1}},{model:"htmlAddress",view:"address",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlAside",view:"aside",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlMain",view:"main",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDetails",view:"details",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSummary",view:"summary",modelSchema:{allowChildren:"$text",allowIn:"htmlDetails",isBlock:!1}},{model:"htmlDiv",view:"div",paragraphLikeModel:"htmlDivParagraph",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlFieldset",view:"fieldset",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlLegend",view:"legend",modelSchema:{allowIn:"htmlFieldset",allowChildren:"$text"}},{model:"htmlHeader",view:"header",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFooter",view:"footer",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlForm",view:"form",modelSchema:{inheritAllFrom:"$container",isBlock:!0}},{model:"htmlHgroup",view:"hgroup",modelSchema:{allowChildren:["htmlH1","htmlH2","htmlH3","htmlH4","htmlH5","htmlH6"],isBlock:!1}},{model:"htmlH1",view:"h1",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH2",view:"h2",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH3",view:"h3",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH4",view:"h4",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH5",view:"h5",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH6",view:"h6",modelSchema:{inheritAllFrom:"$block"}},{model:"$htmlList",modelSchema:{allowWhere:"$container",allowChildren:["$htmlList","htmlLi"],isBlock:!1}},{model:"htmlDir",view:"dir",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlMenu",view:"menu",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlUl",view:"ul",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlOl",view:"ol",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlLi",view:"li",modelSchema:{allowIn:"$htmlList",allowChildren:"$text",isBlock:!1}},{model:"htmlPre",view:"pre",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlArticle",view:"article",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSection",view:"section",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlNav",view:"nav",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDivDl",view:"div",modelSchema:{allowChildren:["htmlDt","htmlDd"],allowIn:"htmlDl"}},{model:"htmlDl",view:"dl",modelSchema:{allowWhere:"$container",allowChildren:["htmlDt","htmlDd","htmlDivDl"],isBlock:!1}},{model:"htmlDt",view:"dt",modelSchema:{allowChildren:"$block",isBlock:!1}},{model:"htmlDd",view:"dd",modelSchema:{allowChildren:"$block",isBlock:!1}},{model:"htmlCenter",view:"center",modelSchema:{inheritAllFrom:"$container",isBlock:!1}}],jb=[{model:"htmlLiAttributes",view:"li",appliesToBlock:!0},{model:"htmlListAttributes",view:"ol",appliesToBlock:!0},{model:"htmlListAttributes",view:"ul",appliesToBlock:!0},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"table"},{model:"htmlTheadAttributes",view:"thead",appliesToBlock:"table"},{model:"htmlTbodyAttributes",view:"tbody",appliesToBlock:"table"},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"imageBlock"},{model:"htmlAcronym",view:"acronym",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTt",view:"tt",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlFont",view:"font",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTime",view:"time",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlVar",view:"var",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBig",view:"big",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSmall",view:"small",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSamp",view:"samp",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlQ",view:"q",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlOutput",view:"output",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlKbd",view:"kbd",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdi",view:"bdi",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdo",view:"bdo",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlAbbr",view:"abbr",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlA",view:"a",priority:5,coupledAttribute:"linkHref",attributeProperties:{copyOnEnter:!0}},{model:"htmlStrong",view:"strong",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlB",view:"b",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlI",view:"i",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlEm",view:"em",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlS",view:"s",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDel",view:"del",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlIns",view:"ins",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlU",view:"u",coupledAttribute:"underline",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSub",view:"sub",coupledAttribute:"subscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSup",view:"sup",coupledAttribute:"superscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCode",view:"code",coupledAttribute:"code",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlMark",view:"mark",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSpan",view:"span",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCite",view:"cite",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlLabel",view:"label",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDfn",view:"dfn",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlObject",view:"object",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlIframe",view:"iframe",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlInput",view:"input",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlButton",view:"button",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlTextarea",view:"textarea",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlSelect",view:"select",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlVideo",view:"video",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlEmbed",view:"embed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlOembed",view:"oembed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlAudio",view:"audio",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlImg",view:"img",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlCanvas",view:"canvas",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlMeter",view:"meter",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlProgress",view:"progress",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlScript",view:"script",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlStyle",view:"style",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlCustomElement",view:"$customElement",modelSchema:{allowWhere:["$text","$block"],isInline:!0}}],Hb=hs((function(t,e,n,i){is(t,e,n,i)}));class Ub extends ur{constructor(){super(...arguments),this._definitions=[]}static get pluginName(){return"DataSchema"}init(){for(const t of Fb)this.registerBlockElement(t);for(const t of jb)this.registerInlineElement(t)}registerBlockElement(t){this._definitions.push({...t,isBlock:!0})}registerInlineElement(t){this._definitions.push({...t,isInline:!0})}extendBlockElement(t){this._extendDefinition({...t,isBlock:!0})}extendInlineElement(t){this._extendDefinition({...t,isInline:!0})}getDefinitionsForView(t,e=!1){const n=new Set;for(const i of this._getMatchingViewDefinitions(t)){if(e)for(const t of this._getReferences(i.model))n.add(t);n.add(i)}return n}getDefinitionsForModel(t){return this._definitions.filter((e=>e.model==t))}_getMatchingViewDefinitions(t){return this._definitions.filter((e=>e.view&&function(t,e){return"string"==typeof t?t===e:t instanceof RegExp&&t.test(e)}(t,e.view)))}*_getReferences(t){const e=["inheritAllFrom","inheritTypesFrom","allowWhere","allowContentOf","allowAttributesOf"],n=this._definitions.filter((e=>e.model==t));for(const{modelSchema:i}of n)if(i)for(const n of e)for(const e of Bi(i[n]||[])){const n=this._definitions.filter((t=>t.model==e));for(const i of n)e!==t&&(yield*this._getReferences(i.model),yield i)}}_extendDefinition(t){const e=Array.from(this._definitions.entries()).filter((([,e])=>e.model==t.model));if(0!=e.length)for(const[n,i]of e)this._definitions[n]=Hb({},i,t,((t,e)=>Array.isArray(t)?t.concat(e):void 0));else this._definitions.push(t)}}const Gb=function(t){return t!=t},Wb=function(t,e,n){return e==e?function(t,e,n){for(var i=n-1,o=t.length;++i-1;)a!==t&&$b.call(a,l,1),$b.call(t,l,1);return t}(t,e):t}));var Yb=n(8468);Wi()(Yb.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),Yb.Z.locals;class Zb extends ur{constructor(t){super(t),this._dataSchema=t.plugins.get("DataSchema"),this._allowedAttributes=new Br,this._disallowedAttributes=new Br,this._allowedElements=new Set,this._disallowedElements=new Set,this._dataInitialized=!1,this._coupledAttributes=null,this._registerElementsAfterInit(),this._registerElementHandlers(),this._registerModelPostFixer()}static get pluginName(){return"DataFilter"}static get requires(){return[Ub,Lp]}loadAllowedConfig(t){for(const e of t){const t=e.name||/[\s\S]+/,n=ek(e);this.allowElement(t),n.forEach((t=>this.allowAttributes(t)))}}loadDisallowedConfig(t){for(const e of t){const t=e.name||/[\s\S]+/,n=ek(e);0==n.length?this.disallowElement(t):n.forEach((t=>this.disallowAttributes(t)))}}allowElement(t){for(const e of this._dataSchema.getDefinitionsForView(t,!0))this._addAllowedElement(e),this._coupledAttributes=null}disallowElement(t){for(const e of this._dataSchema.getDefinitionsForView(t,!1))this._disallowedElements.add(e.view)}allowAttributes(t){this._allowedAttributes.add(t)}disallowAttributes(t){this._disallowedAttributes.add(t)}processViewAttributes(t,e){return Qb(t,e,this._disallowedAttributes),Qb(t,e,this._allowedAttributes)}_addAllowedElement(t){if(!this._allowedElements.has(t)){if(this._allowedElements.add(t),"appliesToBlock"in t&&"string"==typeof t.appliesToBlock)for(const e of this._dataSchema.getDefinitionsForModel(t.appliesToBlock))e.isBlock&&this._addAllowedElement(e);this._dataInitialized&&this.editor.data.once("set",(()=>{this._fireRegisterEvent(t)}),{priority:b.get("highest")+1})}}_registerElementsAfterInit(){this.editor.data.on("init",(()=>{this._dataInitialized=!0;for(const t of this._allowedElements)this._fireRegisterEvent(t)}),{priority:b.get("highest")+1})}_registerElementHandlers(){this.on("register",((t,e)=>{const n=this.editor.model.schema;if(e.isObject&&!n.isRegistered(e.model))this._registerObjectElement(e);else if(e.isBlock)this._registerBlockElement(e);else{if(!e.isInline)throw new A("data-filter-invalid-definition",null,e);this._registerInlineElement(e)}t.stop()}),{priority:"lowest"})}_registerModelPostFixer(){const t=this.editor.model;t.document.registerPostFixer((e=>{const n=t.document.differ.getChanges();let i=!1;const o=this._getCoupledAttributesMap();for(const t of n){if("attribute"!=t.type||null!==t.attributeNewValue)continue;const n=o.get(t.attributeKey);if(n)for(const{item:o}of t.range.getWalker({shallow:!0}))for(const t of n)o.hasAttribute(t)&&(e.removeAttribute(t,o),i=!0)}return i}))}_getCoupledAttributesMap(){if(this._coupledAttributes)return this._coupledAttributes;this._coupledAttributes=new Map;for(const t of this._allowedElements)if(t.coupledAttribute&&t.model){const e=this._coupledAttributes.get(t.coupledAttribute);e?e.push(t.model):this._coupledAttributes.set(t.coupledAttribute,[t.model])}return this._coupledAttributes}_fireRegisterEvent(t){t.view&&this._disallowedElements.has(t.view)||this.fire(t.view?`register:${t.view}`:"register",t)}_registerObjectElement(t){const e=this.editor,n=e.model.schema,i=e.conversion,{view:o,model:r}=t;n.register(r,t.modelSchema),o&&(n.extend(t.model,{allowAttributes:["htmlAttributes","htmlContent"]}),e.data.registerRawContentMatcher({name:o}),i.for("upcast").elementToElement({view:o,model:zb(t),converterPriority:b.get("low")+1}),i.for("upcast").add(Ob(t,this)),i.for("editingDowncast").elementToStructure({model:{name:r,attributes:["htmlAttributes"]},view:Lb(e,t)}),i.for("dataDowncast").elementToElement({model:r,view:(t,{writer:e})=>Pb(o,t,e)}),i.for("dataDowncast").add(Vb(t)))}_registerBlockElement(t){const e=this.editor,n=e.model.schema,i=e.conversion,{view:o,model:r}=t;if(!n.isRegistered(t.model)){if(n.register(t.model,t.modelSchema),!o)return;i.for("upcast").elementToElement({model:r,view:o,converterPriority:b.get("low")+1}),i.for("downcast").elementToElement({model:r,view:o})}o&&(n.extend(t.model,{allowAttributes:"htmlAttributes"}),i.for("upcast").add(Ob(t,this)),i.for("downcast").add(Vb(t)))}_registerInlineElement(t){const e=this.editor,n=e.model.schema,i=e.conversion,o=t.model;t.appliesToBlock||(n.extend("$text",{allowAttributes:o}),t.attributeProperties&&n.setAttributeProperties(o,t.attributeProperties),i.for("upcast").add(function({view:t,model:e},n){return i=>{i.on(`element:${t}`,((t,i,o)=>{let r=n.processViewAttributes(i.viewItem,o);if(r||o.consumable.test(i.viewItem,{name:!0})){r=r||{},o.consumable.consume(i.viewItem,{name:!0}),i.modelRange||(i=Object.assign(i,o.convertChildren(i.viewItem,i.modelCursor)));for(const t of i.modelRange.getItems())if(o.schema.checkAttribute(t,e)){const n=Mb(r,t.getAttribute(e)||{});o.writer.setAttribute(e,n,t)}}}),{priority:"low"})}}(t,this)),i.for("downcast").attributeToElement({model:o,view:Rb(t)}))}}function Qb(t,e,n){const i=function(t,{consumable:e},n){const i=n.matchAll(t)||[],o=[];for(const n of i)Jb(e,t,n),delete n.match.name,e.consume(t,n.match),o.push(n);return o}(t,e,n),{attributes:o,styles:r,classes:s}=function(t){const e={attributes:new Set,classes:new Set,styles:new Set};for(const n of t)for(const t in e)(n.match[t]||[]).forEach((n=>e[t].add(n)));return e}(i),a={};if(o.size)for(const t of o)ri(t)||o.delete(t);return o.size&&(a.attributes=Xb(o,(e=>t.getAttribute(e)))),r.size&&(a.styles=Xb(r,(e=>t.getStyle(e)))),s.size&&(a.classes=Array.from(s)),Object.keys(a).length?a:null}function Jb(t,e,n){for(const i of["attributes","classes","styles"]){const o=n.match[i];if(o)for(const n of Array.from(o))t.test(e,{[i]:[n]})||Kb(o,n)}}function Xb(t,e){const n={};for(const i of t)void 0!==e(i)&&(n[i]=e(i));return n}function tk(t,e){const{name:n}=t,i=t[e];return _t(i)?Object.entries(i).map((([t,i])=>({name:n,[e]:{[t]:i}}))):Array.isArray(i)?i.map((t=>({name:n,[e]:[t]}))):[t]}function ek(t){const{name:e,attributes:n,classes:i,styles:o}=t,r=[];return n&&r.push(...tk({name:e,attributes:n},"attributes")),i&&r.push(...tk({name:e,classes:i},"classes")),o&&r.push(...tk({name:e,styles:o},"styles")),r}class nk extends gr{constructor(t){super(t),this.affectsData=!1}execute(){const t=this.editor.model,e=t.document.selection;let n=t.schema.getLimitElement(e);if(e.containsEntireContent(n)||!ik(t.schema,n))do{if(n=n.parent,!n)return}while(!ik(t.schema,n));t.change((t=>{t.setSelection(n,"in")}))}}function ik(t,e){return t.isLimit(e)&&(t.checkChild(e,"$text")||t.checkChild(e,"paragraph"))}const ok=Ei("Ctrl+A");class rk extends ur{static get pluginName(){return"SelectAllEditing"}init(){const t=this.editor,e=t.editing.view.document;t.commands.add("selectAll",new nk(t)),this.listenTo(e,"keydown",((e,n)=>{xi(n)===ok&&(t.execute("selectAll"),n.preventDefault())}))}}class sk extends ur{static get pluginName(){return"SelectAllUI"}init(){const t=this.editor;t.ui.componentFactory.add("selectAll",(e=>{const n=t.commands.get("selectAll"),i=new Ao(e),o=e.t;return i.set({label:o("Select all"),icon:' ',keystroke:"Ctrl+A",tooltip:!0}),i.bind("isEnabled").to(n,"isEnabled"),this.listenTo(i,"execute",(()=>{t.execute("selectAll"),t.editing.view.focus()})),i}))}}class ak extends ur{static get requires(){return[rk,sk]}static get pluginName(){return"SelectAll"}}var lk=n(1590);Wi()(lk.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),lk.Z.locals;var ck=n(9289);Wi()(ck.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),ck.Z.locals;class dk extends $i{constructor(t){super(t);const e=t.t;this.set("matchCount",0),this.set("highlightOffset",0),this.set("isDirty",!1),this.set("_areCommandsEnabled",{}),this.set("_resultsCounterText",""),this.set("_matchCase",!1),this.set("_wholeWordsOnly",!1),this.bind("_searchResultsFound").to(this,"matchCount",this,"isDirty",((t,e)=>t>0&&!e)),this._findInputView=this._createInputField(e("Find in text…")),this._replaceInputView=this._createInputField(e("Replace with…")),this._findButtonView=this._createButton({label:e("Find"),class:"ck-button-find ck-button-action",withText:!0}),this._findPrevButtonView=this._createButton({label:e("Previous result"),class:"ck-button-prev",icon:zm,keystroke:"Shift+F3",tooltip:!0}),this._findNextButtonView=this._createButton({label:e("Next result"),class:"ck-button-next",icon:zm,keystroke:"F3",tooltip:!0}),this._optionsDropdown=this._createOptionsDropdown(),this._replaceButtonView=this._createButton({label:e("Replace"),class:"ck-button-replace",withText:!0}),this._replaceAllButtonView=this._createButton({label:e("Replace all"),class:"ck-button-replaceall",withText:!0}),this._findFieldsetView=this._createFindFieldset(),this._replaceFieldsetView=this._createReplaceFieldset(),this._focusTracker=new Li,this._keystrokes=new Pi,this._focusables=new Ui,this._focusCycler=new ar({focusables:this._focusables,focusTracker:this._focusTracker,keystrokeHandler:this._keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-find-and-replace-form"],tabindex:"-1"},children:[new Bm(t,{label:e("Find and replace")}),this._findFieldsetView,this._replaceFieldsetView]})}render(){super.render(),o({view:this}),this._initFocusCycling(),this._initKeystrokeHandling()}destroy(){super.destroy(),this._focusTracker.destroy(),this._keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}reset(){this._findInputView.errorText=null,this.isDirty=!0}get _textToFind(){return this._findInputView.fieldView.element.value}get _textToReplace(){return this._replaceInputView.fieldView.element.value}_createFindFieldset(){const t=this.locale,e=new $i(t);return this._findInputView.fieldView.on("input",(()=>{this.isDirty=!0})),this._findButtonView.on("execute",this._onFindButtonExecute.bind(this)),this._findPrevButtonView.delegate("execute").to(this,"findPrevious"),this._findNextButtonView.delegate("execute").to(this,"findNext"),this._findPrevButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",(({findPrevious:t})=>t)),this._findNextButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",(({findNext:t})=>t)),this._injectFindResultsCounter(),e.setTemplate({tag:"fieldset",attributes:{class:["ck","ck-find-and-replace-form__find"]},children:[this._findInputView,this._findButtonView,this._findPrevButtonView,this._findNextButtonView]}),e}_onFindButtonExecute(){if(this._textToFind)this.isDirty=!1,this.fire("findNext",{searchText:this._textToFind,matchCase:this._matchCase,wholeWords:this._wholeWordsOnly});else{const t=this.t;this._findInputView.errorText=t("Text to find must not be empty.")}}_injectFindResultsCounter(){const t=this.locale,e=t.t,n=this.bindTemplate,i=new $i(this.locale);this.bind("_resultsCounterText").to(this,"highlightOffset",this,"matchCount",((t,n)=>e("%0 of %1",[t,n]))),i.setTemplate({tag:"span",attributes:{class:["ck","ck-results-counter",n.if("isDirty","ck-hidden")]},children:[{text:n.to("_resultsCounterText")}]});const o=()=>{const e=this._findInputView.fieldView.element;if(!e||!si(e))return;const n=new Zn(i.element).width,o="ltr"===t.uiLanguageDirection?"paddingRight":"paddingLeft";e.style[o]=n?`calc( 2 * var(--ck-spacing-standard) + ${n}px )`:""};this.on("change:_resultsCounterText",o,{priority:"low"}),this.on("change:isDirty",o,{priority:"low"}),this._findInputView.template.children[0].children.push(i)}_createReplaceFieldset(){const t=this.locale.t,e=new $i(this.locale);return this._replaceButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",(({replace:t},e)=>t&&e)),this._replaceAllButtonView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",(({replaceAll:t},e)=>t&&e)),this._replaceInputView.bind("isEnabled").to(this,"_areCommandsEnabled",this,"_searchResultsFound",(({replace:t},e)=>t&&e)),this._replaceInputView.bind("infoText").to(this._replaceInputView,"isEnabled",this._replaceInputView,"isFocused",((e,n)=>e||!n?"":t("Tip: Find some text first in order to replace it."))),this._replaceButtonView.on("execute",(()=>{this.fire("replace",{searchText:this._textToFind,replaceText:this._textToReplace})})),this._replaceAllButtonView.on("execute",(()=>{this.fire("replaceAll",{searchText:this._textToFind,replaceText:this._textToReplace}),this.focus()})),e.setTemplate({tag:"fieldset",attributes:{class:["ck","ck-find-and-replace-form__replace"]},children:[this._replaceInputView,this._optionsDropdown,this._replaceButtonView,this._replaceAllButtonView]}),e}_createOptionsDropdown(){const t=this.locale.t,e=wu(this.locale);e.class="ck-options-dropdown",e.buttonView.set({withText:!1,label:t("Show options"),icon:iu.cog,tooltip:!0});const n=new Nm({withText:!0,label:t("Match case"),_isMatchCaseSwitch:!0}),i=new Nm({withText:!0,label:t("Whole words only")});return n.bind("isOn").to(this,"_matchCase"),i.bind("isOn").to(this,"_wholeWordsOnly"),e.on("execute",(t=>{t.source._isMatchCaseSwitch?this._matchCase=!this._matchCase:this._wholeWordsOnly=!this._wholeWordsOnly,this.isDirty=!0})),_u(e,new Ni([{type:"switchbutton",model:n},{type:"switchbutton",model:i}])),e}_initFocusCycling(){[this._findInputView,this._findButtonView,this._findPrevButtonView,this._findNextButtonView,this._replaceInputView,this._optionsDropdown,this._replaceButtonView,this._replaceAllButtonView].forEach((t=>{this._focusables.add(t),this._focusTracker.add(t.element)}))}_initKeystrokeHandling(){const t=t=>t.stopPropagation(),e=t=>{t.stopPropagation(),t.preventDefault()};this._keystrokes.listenTo(this.element),this._keystrokes.set("f3",(t=>{e(t),this._findNextButtonView.fire("execute")})),this._keystrokes.set("shift+f3",(t=>{e(t),this._findPrevButtonView.fire("execute")})),this._keystrokes.set("enter",(t=>{const n=t.target;n===this._findInputView.fieldView.element?(this._areCommandsEnabled.findNext?this._findNextButtonView.fire("execute"):this._findButtonView.fire("execute"),e(t)):n!==this._replaceInputView.fieldView.element||this.isDirty||(this._replaceButtonView.fire("execute"),e(t))})),this._keystrokes.set("shift+enter",(t=>{t.target===this._findInputView.fieldView.element&&(this._areCommandsEnabled.findPrevious?this._findPrevButtonView.fire("execute"):this._findButtonView.fire("execute"),e(t))})),this._keystrokes.set("arrowright",t),this._keystrokes.set("arrowleft",t),this._keystrokes.set("arrowup",t),this._keystrokes.set("arrowdown",t)}_createButton(t){const e=new Ao(this.locale);return e.set(t),e}_createInputField(t){const e=new Qo(this.locale,xu);return e.label=t,e}}class hk extends ur{static get pluginName(){return"FindAndReplaceUI"}constructor(t){super(t),this.formView=null}init(){const t=this.editor;t.ui.componentFactory.add("findAndReplace",(n=>{const i=wu(n),o=t.commands.get("find");return i.bind("isEnabled").to(o),i.once("change:isOpen",(()=>{this.formView=new(e(dk))(t.locale),i.panelView.children.add(this.formView),this._setupFormView(this.formView)})),i.on("change:isOpen",((t,e,n)=>{n?(this.formView.disableCssTransitions(),this.formView.reset(),this.formView._findInputView.fieldView.select(),this.formView.enableCssTransitions()):this.fire("searchReseted")}),{priority:"low"}),this._setupDropdownButton(i),i}))}_setupDropdownButton(t){const e=this.editor,n=e.locale.t;t.buttonView.set({icon:' ',label:n("Find and replace"),keystroke:"CTRL+F",tooltip:!0}),e.keystrokes.set("Ctrl+F",((e,n)=>{t.isEnabled&&(t.isOpen=!0,n())}))}_setupFormView(t){const e=this.editor.commands,n=this.editor.plugins.get("FindAndReplaceEditing").state,i={before:-1,same:0,after:1,different:1};t.bind("highlightOffset").to(n,"highlightedResult",(t=>t?Array.from(n.results).sort(((t,e)=>i[t.marker.getStart().compareWith(e.marker.getStart())])).indexOf(t)+1:0)),t.listenTo(n.results,"change",(()=>{t.matchCount=n.results.length}));const o=e.get("findNext"),r=e.get("findPrevious"),s=e.get("replace"),a=e.get("replaceAll");t.bind("_areCommandsEnabled").to(o,"isEnabled",r,"isEnabled",s,"isEnabled",a,"isEnabled",((t,e,n,i)=>({findNext:t,findPrevious:e,replace:n,replaceAll:i}))),t.delegate("findNext","findPrevious","replace","replaceAll").to(this),t.on("change:isDirty",((t,e,n)=>{n&&this.fire("searchReseted")}))}}class uk extends gr{constructor(t,e){super(t),this.isEnabled=!0,this.affectsData=!1,this._state=e}execute(t,{matchCase:e,wholeWords:n}={}){const{editor:i}=this,{model:o}=i,r=i.plugins.get("FindAndReplaceUtils");let s;"string"==typeof t?(s=r.findByTextCallback(t,{matchCase:e,wholeWords:n}),this._state.searchText=t):s=t;const a=o.document.getRootNames().reduce(((t,e)=>r.updateFindResultFromRange(o.createRangeIn(o.document.getRoot(e)),o,s,t)),null);return this._state.clear(o),this._state.results.addMany(a),this._state.highlightedResult=a.get(0),"string"==typeof t&&(this._state.searchText=t),this._state.matchCase=!!e,this._state.matchWholeWords=!!n,{results:a,findCallback:s}}}class mk extends gr{constructor(t,e){super(t),this.isEnabled=!0,this._state=e,this._isEnabledBasedOnSelection=!1}_replace(t,e){const{model:n}=this.editor,i=e.marker.getRange();n.canEditAt(i)&&n.change((o=>{if("$graveyard"===i.root.rootName)return void this._state.results.remove(e);let r={};for(const t of i.getItems())if(t.is("$text")||t.is("$textProxy")){r=t.getAttributes();break}n.insertContent(o.createText(t,r),i),this._state.results.has(e)&&this._state.results.remove(e)}))}}class gk extends mk{execute(t,e){this._replace(t,e)}}class pk extends mk{execute(t,e){const{editor:n}=this,{model:i}=n,o=n.plugins.get("FindAndReplaceUtils"),r=e instanceof Ni?e:i.document.getRootNames().reduce(((t,n)=>o.updateFindResultFromRange(i.createRangeIn(i.document.getRoot(n)),i,o.findByTextCallback(e,this._state),t)),null);r.length&&[...r].forEach((e=>{this._replace(t,e)}))}}class fk extends gr{constructor(t,e){super(t),this.affectsData=!1,this._state=e,this.isEnabled=!1,this.listenTo(this._state.results,"change",(()=>{this.isEnabled=this._state.results.length>1}))}refresh(){this.isEnabled=this._state.results.length>1}execute(){const t=this._state.results,e=t.getIndex(this._state.highlightedResult),n=e+1>=t.length?0:e+1;this._state.highlightedResult=this._state.results.get(n)}}class bk extends fk{execute(){const t=this._state.results.getIndex(this._state.highlightedResult),e=t-1<0?this._state.results.length-1:t-1;this._state.highlightedResult=this._state.results.get(e)}}class kk extends(G()){constructor(t){super(),this.set("results",new Ni),this.set("highlightedResult",null),this.set("searchText",""),this.set("replaceText",""),this.set("matchCase",!1),this.set("matchWholeWords",!1),this.results.on("change",((e,{removed:n,index:i})=>{if(Array.from(n).length){let e=!1;if(t.change((i=>{for(const o of n)this.highlightedResult===o&&(e=!0),t.markers.has(o.marker.name)&&i.removeMarker(o.marker)})),e){const t=i>=this.results.length?0:i;this.highlightedResult=this.results.get(t)}}}))}clear(t){this.searchText="",t.change((e=>{if(this.highlightedResult){const n=this.highlightedResult.marker.name.split(":")[1],i=t.markers.get(`findResultHighlighted:${n}`);i&&e.removeMarker(i)}[...this.results].forEach((({marker:t})=>{e.removeMarker(t)}))})),this.results.clear()}}class wk extends ur{static get pluginName(){return"FindAndReplaceUtils"}updateFindResultFromRange(t,e,n,i){const o=i||new Ni;return e.change((i=>{[...t].forEach((({type:t,item:r})=>{if("elementStart"===t&&e.schema.checkChild(r,"$text")){const t=n({item:r,text:this.rangeToText(e.createRangeIn(r))});if(!t)return;t.forEach((t=>{const e=`findResult:${f()}`,n=i.addMarker(e,{usingOperation:!1,affectsData:!1,range:i.createRange(i.createPositionAt(r,t.start),i.createPositionAt(r,t.end))}),s=function(t,e){const n=t.find((({marker:t})=>e.getStart().isBefore(t.getStart())));return n?t.getIndex(n):t.length}(o,n);o.add({id:e,label:t.label,marker:n},s)}))}}))})),o}rangeToText(t){return Array.from(t.getItems()).reduce(((t,e)=>e.is("$text")||e.is("$textProxy")?t+e.data:`${t}\n`),"")}findByTextCallback(t,e){let n="gu";e.matchCase||(n+="i");let i=`(${Hg(t)})`;if(e.wholeWords){const e="[^a-zA-ZÀ-ɏḀ-ỿ]";new RegExp("^"+e).test(t)||(i=`(^|${e}|_)${i}`),new RegExp(e+"$").test(t)||(i=`${i}(?=_|${e}|$)`)}const o=new RegExp(i,n);return function({text:t}){return[...t.matchAll(o)].map(Ak)}}}function Ak(t){const e=t.length-1;let n=t.index;return 3===t.length&&(n+=t[1].length),{label:t[e],start:n,end:n+t[e].length}}var Ck=n(5436);Wi()(Ck.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),Ck.Z.locals;class _k extends ur{static get requires(){return[wk]}static get pluginName(){return"FindAndReplaceEditing"}init(){this._activeResults=null,this.state=new kk(this.editor.model),this._defineConverters(),this._defineCommands(),this.listenTo(this.state,"change:highlightedResult",((t,e,n,i)=>{const{model:o}=this.editor;o.change((t=>{if(i){const e=i.marker.name.split(":")[1],n=o.markers.get(`findResultHighlighted:${e}`);n&&t.removeMarker(n)}if(n){const e=n.marker.name.split(":")[1];t.addMarker(`findResultHighlighted:${e}`,{usingOperation:!1,affectsData:!1,range:n.marker.getRange()})}}))}));const t=$o(((t,e,n)=>{if(n){const t=this.editor.editing.view.domConverter,e=this.editor.editing.mapper.toViewRange(n.marker.getRange());hi({target:t.viewRangeToDom(e),viewportOffset:40})}}).bind(this),32);this.listenTo(this.state,"change:highlightedResult",t,{priority:"low"}),this.listenTo(this.editor,"destroy",t.cancel)}find(t){const{editor:e}=this,{model:n}=e,{findCallback:i,results:o}=e.execute("find",t);return this._activeResults=o,this.listenTo(n.document,"change:data",(()=>function(t,e,n){const i=new Set,o=new Set,r=e.model;r.document.differ.getChanges().forEach((t=>{"$text"===t.name||r.schema.isInline(t.position.nodeAfter)?(i.add(t.position.parent),[...r.markers.getMarkersAtPosition(t.position)].forEach((t=>{o.add(t.name)}))):"insert"===t.type&&i.add(t.position.nodeAfter)})),r.document.differ.getChangedMarkers().forEach((({name:t,data:{newRange:e}})=>{e&&"$graveyard"===e.start.root.rootName&&o.add(t)})),i.forEach((t=>{[...r.markers.getMarkersIntersectingRange(r.createRangeIn(t))].forEach((t=>o.add(t.name)))})),r.change((e=>{o.forEach((n=>{t.has(n)&&t.remove(n),e.removeMarker(n)}))})),i.forEach((i=>{e.plugins.get("FindAndReplaceUtils").updateFindResultFromRange(r.createRangeOn(i),r,n,t)}))}(this._activeResults,e,i))),this._activeResults}stop(){this._activeResults&&(this.stopListening(this.editor.model.document),this.state.clear(this.editor.model),this._activeResults=null)}_defineCommands(){this.editor.commands.add("find",new uk(this.editor,this.state)),this.editor.commands.add("findNext",new fk(this.editor,this.state)),this.editor.commands.add("findPrevious",new bk(this.editor,this.state)),this.editor.commands.add("replace",new gk(this.editor,this.state)),this.editor.commands.add("replaceAll",new pk(this.editor,this.state))}_defineConverters(){const{editor:t}=this;t.conversion.for("editingDowncast").markerToHighlight({model:"findResult",view:({markerName:t})=>{const[,e]=t.split(":");return{name:"span",classes:["ck-find-result"],attributes:{"data-find-result":e}}}}),t.conversion.for("editingDowncast").markerToHighlight({model:"findResultHighlighted",view:({markerName:t})=>{const[,e]=t.split(":");return{name:"span",classes:["ck-find-result_selected"],attributes:{"data-find-result":e}}}})}}class vk extends gr{constructor(t,e){super(t),this.attributeKey=e}refresh(){const t=this.editor.model,e=t.document;this.value=e.selection.getAttribute(this.attributeKey),this.isEnabled=t.schema.checkAttributeInSelection(e.selection,this.attributeKey)}execute(t={}){const e=this.editor.model,n=e.document.selection,i=t.value,o=t.batch,r=t=>{if(n.isCollapsed)i?t.setSelectionAttribute(this.attributeKey,i):t.removeSelectionAttribute(this.attributeKey);else{const o=e.schema.getValidRanges(n.getRanges(),this.attributeKey);for(const e of o)i?t.setAttribute(this.attributeKey,i,e):t.removeAttribute(this.attributeKey,e)}};o?e.enqueueChange(o,(t=>{r(t)})):e.change((t=>{r(t)}))}}class yk extends(G(Ni)){constructor(t){super(t),this.set("isEmpty",!0),this.on("change",(()=>{this.set("isEmpty",0===this.length)}))}add(t,e){return this.find((e=>e.color===t.color))?this:super.add(t,e)}hasColor(t){return!!this.find((e=>e.color===t))}}var xk=n(2585);Wi()(xk.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),xk.Z.locals;class Ek extends $i{constructor(t,{colors:e,columns:n,removeButtonLabel:i,documentColorsLabel:o,documentColorsCount:r,colorPickerLabel:s,colorPickerConfig:a}){super(t),this.items=this.createCollection(),this.focusTracker=new Li,this.keystrokes=new Pi,this._focusables=new Ui,this._colorPickerConfig=a,this._focusCycler=new ar({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.colorGridsPageView=new Dk(t,{colors:e,columns:n,removeButtonLabel:i,documentColorsLabel:o,documentColorsCount:r,colorPickerLabel:s,focusTracker:this.focusTracker,focusables:this._focusables}),this.colorPickerPageView=new Sk(t,{focusables:this._focusables,focusTracker:this.focusTracker,keystrokes:this.keystrokes,colorPickerConfig:a}),this.set("_isColorGridsPageVisible",!0),this.set("_isColorPickerPageVisible",!1),this.set("selectedColor",void 0),this.colorGridsPageView.bind("isVisible").to(this,"_isColorGridsPageVisible"),this.colorPickerPageView.bind("isVisible").to(this,"_isColorPickerPageVisible"),this.on("change:selectedColor",((t,e,n)=>{this.colorGridsPageView.set("selectedColor",n),this.colorPickerPageView.set("selectedColor",n)})),this.colorGridsPageView.on("change:selectedColor",((t,e,n)=>{this.set("selectedColor",n)})),this.colorPickerPageView.on("change:selectedColor",((t,e,n)=>{this.set("selectedColor",n)})),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-table"]},children:this.items})}render(){super.render(),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}appendGrids(){this.items.length||(this.items.add(this.colorGridsPageView),this.colorGridsPageView.delegate("execute").to(this),this.colorGridsPageView.delegate("showColorPicker").to(this))}appendUI(){this.appendGrids(),this._colorPickerConfig&&this._appendColorPicker()}showColorPicker(){this.colorPickerPageView.colorPickerView&&(this.set("_isColorPickerPageVisible",!0),this.colorPickerPageView.focus(),this.set("_isColorGridsPageVisible",!1))}showColorGrids(){this.set("_isColorGridsPageVisible",!0),this.set("_isColorPickerPageVisible",!1)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}updateDocumentColors(t,e){this.colorGridsPageView.updateDocumentColors(t,e)}updateSelectedColors(){this.colorGridsPageView.updateSelectedColors()}_appendColorPicker(){2!==this.items.length&&(this.items.add(this.colorPickerPageView),this.colorGridsPageView.colorPickerButtonView&&this.colorGridsPageView.colorPickerButtonView.on("execute",(()=>{this.showColorPicker()})),this.colorGridsPageView.addColorPickerButton(),this.colorPickerPageView.delegate("execute").to(this),this.colorPickerPageView.delegate("cancel").to(this))}}class Dk extends $i{constructor(t,{colors:e,columns:n,removeButtonLabel:i,documentColorsLabel:o,documentColorsCount:r,colorPickerLabel:s,focusTracker:a,focusables:l}){super(t);const c=this.bindTemplate;this.set("isVisible",!0),this.focusTracker=a,this.items=this.createCollection(),this.colorDefinitions=e,this.columns=n,this.documentColors=new yk,this.documentColorsCount=r,this._focusables=l,this._removeButtonLabel=i,this._colorPickerLabel=s,this._documentColorsLabel=o,this.setTemplate({tag:"div",attributes:{class:["ck-color-grids-page-view",c.if("isVisible","ck-hidden",(t=>!t))]},children:this.items}),this.removeColorButtonView=this._createRemoveColorButton(),this.items.add(this.removeColorButtonView)}updateDocumentColors(t,e){const n=t.document,i=this.documentColorsCount;this.documentColors.clear();for(const o of n.getRootNames()){const r=n.getRoot(o),s=t.createRangeIn(r);for(const t of s.getItems())if(t.is("$textProxy")&&t.hasAttribute(e)&&(this._addColorToDocumentColors(t.getAttribute(e)),this.documentColors.length>=i))return}}updateSelectedColors(){const t=this.documentColorsGrid,e=this.staticColorsGrid,n=this.selectedColor;e.selectedColor=n,t&&(t.selectedColor=n)}render(){if(super.render(),this.staticColorsGrid=this._createStaticColorsGrid(),this.items.add(this.staticColorsGrid),this.documentColorsCount){const t=Ki.bind(this.documentColors,this.documentColors),e=new Yo(this.locale);e.text=this._documentColorsLabel,e.extendTemplate({attributes:{class:["ck","ck-color-grid__label",t.if("isEmpty","ck-hidden")]}}),this.items.add(e),this.documentColorsGrid=this._createDocumentColorsGrid(),this.items.add(this.documentColorsGrid)}this._createColorPickerButton(),this._addColorTablesElementsToFocusTracker(),this.focus()}focus(){this.removeColorButtonView.focus()}destroy(){super.destroy()}addColorPickerButton(){this.colorPickerButtonView&&(this.items.add(this.colorPickerButtonView),this.focusTracker.add(this.colorPickerButtonView.element),this._focusables.add(this.colorPickerButtonView))}_addColorTablesElementsToFocusTracker(){this.focusTracker.add(this.removeColorButtonView.element),this._focusables.add(this.removeColorButtonView),this.staticColorsGrid&&(this.focusTracker.add(this.staticColorsGrid.element),this._focusables.add(this.staticColorsGrid)),this.documentColorsGrid&&(this.focusTracker.add(this.documentColorsGrid.element),this._focusables.add(this.documentColorsGrid))}_createColorPickerButton(){this.colorPickerButtonView=new Ao,this.colorPickerButtonView.set({label:this._colorPickerLabel,withText:!0,icon:' ',class:"ck-color-table__color-picker"}),this.colorPickerButtonView.on("execute",(()=>{this.fire("showColorPicker")}))}_createRemoveColorButton(){const t=new Ao;return t.set({withText:!0,icon:iu.eraser,label:this._removeButtonLabel}),t.class="ck-color-table__remove-color",t.on("execute",(()=>{this.fire("execute",{value:null,source:"removeColorButton"})})),t.render(),t}_createStaticColorsGrid(){const t=new So(this.locale,{colorDefinitions:this.colorDefinitions,columns:this.columns});return t.on("execute",((t,e)=>{this.fire("execute",{value:e.value,source:"staticColorsGrid"})})),t}_createDocumentColorsGrid(){const t=Ki.bind(this.documentColors,this.documentColors),e=new So(this.locale,{columns:this.columns});return e.extendTemplate({attributes:{class:t.if("isEmpty","ck-hidden")}}),e.items.bindTo(this.documentColors).using((t=>{const e=new Eo;return e.set({color:t.color,hasBorder:t.options&&t.options.hasBorder}),t.label&&e.set({label:t.label,tooltip:!0}),e.on("execute",(()=>{this.fire("execute",{value:t.color,source:"documentColorsGrid"})})),e})),this.documentColors.on("change:isEmpty",((t,n,i)=>{i&&(e.selectedColor=null)})),e}_addColorToDocumentColors(t){const e=this.colorDefinitions.find((e=>e.color===t));e?this.documentColors.add(Object.assign({},e)):this.documentColors.add({color:t,label:t,options:{hasBorder:!1}})}}class Sk extends $i{constructor(t,{focusTracker:e,focusables:n,keystrokes:i,colorPickerConfig:o}){super(t),this.items=this.createCollection(),this.focusTracker=e,this.keystrokes=i,this.set("isVisible",!1),this.set("selectedColor",void 0),this._focusables=n,this._pickerConfig=o;const r=this.bindTemplate,{saveButtonView:s,cancelButtonView:a}=this._createActionButtons();this.saveButtonView=s,this.cancelButtonView=a,this.actionBarView=this._createActionBarView({saveButtonView:s,cancelButtonView:a}),this.setTemplate({tag:"div",attributes:{class:["ck-color-picker-page-view",r.if("isVisible","ck-hidden",(t=>!t))]},children:this.items})}render(){super.render();const t=new tm(this.locale,this._pickerConfig);this.colorPickerView=t,this.colorPickerView.render(),this.selectedColor&&(t.color=this.selectedColor),this.listenTo(this,"change:selectedColor",((e,n,i)=>{t.color=i})),this.items.add(this.colorPickerView),this.items.add(this.actionBarView),this._addColorPickersElementsToFocusTracker(),this._stopPropagationOnArrowsKeys(),this._executeOnEnterPress(),this._executeUponColorChange()}destroy(){super.destroy()}focus(){this.colorPickerView.focus()}_executeOnEnterPress(){this.keystrokes.set("enter",(t=>{this.isVisible&&this.focusTracker.focusedElement!==this.cancelButtonView.element&&(this.fire("execute",{value:this.selectedColor}),t.stopPropagation(),t.preventDefault())}))}_stopPropagationOnArrowsKeys(){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)}_addColorPickersElementsToFocusTracker(){for(const t of this.colorPickerView.slidersView)this.focusTracker.add(t.element),this._focusables.add(t);this.focusTracker.add(this.colorPickerView.hexInputRow.children.get(1).element),this._focusables.add(this.colorPickerView.hexInputRow.children.get(1)),this.focusTracker.add(this.saveButtonView.element),this._focusables.add(this.saveButtonView),this.focusTracker.add(this.cancelButtonView.element),this._focusables.add(this.cancelButtonView)}_createActionBarView({saveButtonView:t,cancelButtonView:e}){const n=new $i,i=this.createCollection();return i.add(t),i.add(e),n.setTemplate({tag:"div",attributes:{class:["ck","ck-color-table_action-bar"]},children:i}),n}_createActionButtons(){const t=this.locale,e=t.t,n=new Ao(t),i=new Ao(t);return n.set({icon:iu.check,class:"ck-button-save",withText:!1,label:e("Accept"),type:"submit"}),i.set({icon:iu.cancel,class:"ck-button-cancel",withText:!1,label:e("Cancel")}),n.on("execute",(()=>{this.fire("execute",{source:"saveButton",value:this.selectedColor})})),i.on("execute",(()=>{this.fire("cancel")})),{saveButtonView:n,cancelButtonView:i}}_executeUponColorChange(){this.colorPickerView.on("change:color",((t,e,n)=>{this.fire("execute",{value:n,source:"colorPicker"})}))}}const Tk="fontSize",Ik="fontFamily",Bk="fontColor",Mk="fontBackgroundColor";function Nk(t,e){const n={model:{key:t,values:[]},view:{},upcastAlso:{}};for(const t of e)n.model.values.push(t.model),n.view[t.model]=t.view,t.upcastAlso&&(n.upcastAlso[t.model]=t.upcastAlso);return n}function zk(t){return e=>e.getStyle(t).replace(/\s/g,"")}function Lk(t){return(e,{writer:n})=>n.createAttributeElement("span",{style:`${t}:${e}`},{priority:7})}class Pk extends vk{constructor(t){super(t,Mk)}}class Rk extends ur{static get pluginName(){return"FontBackgroundColorEditing"}constructor(t){super(t),t.config.define(Mk,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),t.data.addStyleProcessorRules(Oh),t.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{"background-color":/[\s\S]+/}},model:{key:Mk,value:zk("background-color")}}),t.conversion.for("downcast").attributeToElement({model:Mk,view:Lk("background-color")}),t.commands.add(Mk,new Pk(t)),t.model.schema.extend("$text",{allowAttributes:Mk}),t.model.schema.setAttributeProperties(Mk,{isFormatting:!0,copyOnEnter:!0})}}class Ok extends ur{constructor(t,{commandName:e,componentName:n,icon:i,dropdownLabel:o}){super(t),this.commandName=e,this.componentName=n,this.icon=i,this.dropdownLabel=o,this.columns=t.config.get(`${this.componentName}.columns`),this.colorTableView=void 0}init(){const t=this.editor,e=t.locale,n=e.t,i=t.commands.get(this.commandName),o=t.config.get(this.componentName),r=vo(e,yo(o.colors)),s=o.documentColors,a=!1!==o.colorPicker;t.ui.componentFactory.add(this.componentName,(e=>{const l=wu(e);let c=!1;return this.colorTableView=function({dropdownView:t,colors:e,columns:n,removeButtonLabel:i,colorPickerLabel:o,documentColorsLabel:r,documentColorsCount:s,colorPickerConfig:a}){const l=t.locale,c=new Ek(l,{colors:e,columns:n,removeButtonLabel:i,colorPickerLabel:o,documentColorsLabel:r,documentColorsCount:s,colorPickerConfig:a});return t.colorTableView=c,t.panelView.children.add(c),c}({dropdownView:l,colors:r.map((t=>({label:t.label,color:t.model,options:{hasBorder:t.hasBorder}}))),columns:this.columns,removeButtonLabel:n("Remove color"),colorPickerLabel:n("Color picker"),documentColorsLabel:0!==s?n("Document colors"):"",documentColorsCount:void 0===s?this.columns:s,colorPickerConfig:!!a&&(o.colorPicker||{})}),this.colorTableView.bind("selectedColor").to(i,"value"),l.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:!0}),l.extendTemplate({attributes:{class:"ck-color-ui-dropdown"}}),l.bind("isEnabled").to(i),this.colorTableView.on("execute",((e,n)=>{l.isOpen&&t.execute(this.commandName,{value:n.value,batch:this._undoStepBatch}),"colorPicker"!==n.source&&t.editing.view.focus()})),this.colorTableView.on("showColorPicker",(()=>{this._undoStepBatch=t.model.createBatch()})),this.colorTableView.on("cancel",(()=>{this._undoStepBatch.operations.length&&(l.isOpen=!1,t.execute("undo",this._undoStepBatch)),t.editing.view.focus()})),l.on("change:isOpen",((e,n,i)=>{c||(c=!0,l.colorTableView.appendUI()),i?(0!==s&&this.colorTableView.updateDocumentColors(t.model,this.componentName),this.colorTableView.updateSelectedColors()):this.colorTableView.showColorGrids()})),yu(l,(()=>l.colorTableView.colorGridsPageView.staticColorsGrid.items.find((t=>t.isOn)))),l}))}}class Vk extends Ok{constructor(t){const e=t.locale.t;super(t,{commandName:Mk,componentName:Mk,icon:' ',dropdownLabel:e("Font Background Color")})}static get pluginName(){return"FontBackgroundColorUI"}}class Fk extends vk{constructor(t){super(t,Bk)}}class jk extends ur{static get pluginName(){return"FontColorEditing"}constructor(t){super(t),t.config.define(Bk,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),t.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{color:/[\s\S]+/}},model:{key:Bk,value:zk("color")}}),t.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{color:/^#?\w+$/}},model:{key:Bk,value:t=>t.getAttribute("color")}}),t.conversion.for("downcast").attributeToElement({model:Bk,view:Lk("color")}),t.commands.add(Bk,new Fk(t)),t.model.schema.extend("$text",{allowAttributes:Bk}),t.model.schema.setAttributeProperties(Bk,{isFormatting:!0,copyOnEnter:!0})}}class Hk extends Ok{constructor(t){const e=t.locale.t;super(t,{commandName:Bk,componentName:Bk,icon:' ',dropdownLabel:e("Font Color")})}static get pluginName(){return"FontColorUI"}}class Uk extends vk{constructor(t){super(t,Ik)}}function Gk(t){return t.map(Wk).filter((t=>void 0!==t))}function Wk(t){return"object"==typeof t?t:"default"===t?{title:"Default",model:void 0}:"string"==typeof t?function(t){const e=t.replace(/"|'/g,"").split(","),n=e[0],i=e.map(qk).join(", ");return{title:n,model:i,view:{name:"span",styles:{"font-family":i},priority:7}}}(t):void 0}function qk(t){return(t=t.trim()).indexOf(" ")>0&&(t=`'${t}'`),t}class $k extends ur{static get pluginName(){return"FontFamilyEditing"}constructor(t){super(t),t.config.define(Ik,{options:["default","Arial, Helvetica, sans-serif","Courier New, Courier, monospace","Georgia, serif","Lucida Sans Unicode, Lucida Grande, sans-serif","Tahoma, Geneva, sans-serif","Times New Roman, Times, serif","Trebuchet MS, Helvetica, sans-serif","Verdana, Geneva, sans-serif"],supportAllValues:!1})}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:Ik}),t.model.schema.setAttributeProperties(Ik,{isFormatting:!0,copyOnEnter:!0});const e=Gk(t.config.get("fontFamily.options")).filter((t=>t.model)),n=Nk(Ik,e);t.config.get("fontFamily.supportAllValues")?(this._prepareAnyValueConverters(),this._prepareCompatibilityConverter()):t.conversion.attributeToElement(n),t.commands.add(Ik,new Uk(t))}_prepareAnyValueConverters(){const t=this.editor;t.conversion.for("downcast").attributeToElement({model:Ik,view:(t,{writer:e})=>e.createAttributeElement("span",{style:"font-family:"+t},{priority:7})}),t.conversion.for("upcast").elementToAttribute({model:{key:Ik,value:t=>t.getStyle("font-family")},view:{name:"span",styles:{"font-family":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{face:/.*/}},model:{key:Ik,value:t=>t.getAttribute("face")}})}}class Kk extends ur{static get pluginName(){return"FontFamilyUI"}init(){const t=this.editor,e=t.t,n=this._getLocalizedOptions(),i=t.commands.get(Ik),o=e("Font Family");t.ui.componentFactory.add(Ik,(e=>{const r=wu(e);return _u(r,(()=>function(t,e){const n=new Ni;for(const i of t){const t={type:"button",model:new Nm({commandName:Ik,commandParam:i.model,label:i.title,role:"menuitemradio",withText:!0})};t.model.bind("isOn").to(e,"value",(t=>t===i.model||!(!t||!i.model)&&t.split(",")[0].replace(/'/g,"").toLowerCase()===i.model.toLowerCase())),i.view&&"string"!=typeof i.view&&i.view.styles&&t.model.set("labelStyle",`font-family: ${i.view.styles["font-family"]}`),n.add(t)}return n}(n,i)),{role:"menu",ariaLabel:o}),r.buttonView.set({label:o,icon:' ',tooltip:!0}),r.extendTemplate({attributes:{class:"ck-font-family-dropdown"}}),r.bind("isEnabled").to(i),this.listenTo(r,"execute",(e=>{t.execute(e.source.commandName,{value:e.source.commandParam}),t.editing.view.focus()})),r}))}_getLocalizedOptions(){const t=this.editor,e=t.t;return Gk(t.config.get(Ik).options).map((t=>("Default"===t.title&&(t.title=e("Default")),t)))}}class Yk extends vk{constructor(t){super(t,Tk)}}function Zk(t){return t.map((t=>function(t){if("number"==typeof t&&(t=String(t)),"object"==typeof t&&((e=t).title&&e.model&&e.view))return Jk(t);var e;const n=function(t){return"string"==typeof t?Qk[t]:Qk[t.model]}(t);return n?Jk(n):"default"===t?{model:void 0,title:"Default"}:function(t){let e;if("object"==typeof t){if(!t.model)throw new A("font-size-invalid-definition",null,t);e=parseFloat(t.model)}else e=parseFloat(t);return isNaN(e)}(t)?void 0:function(t){return"string"==typeof t&&(t={title:t,model:`${parseFloat(t)}px`}),t.view={name:"span",styles:{"font-size":t.model}},Jk(t)}(t)}(t))).filter((t=>void 0!==t))}const Qk={get tiny(){return{title:"Tiny",model:"tiny",view:{name:"span",classes:"text-tiny",priority:7}}},get small(){return{title:"Small",model:"small",view:{name:"span",classes:"text-small",priority:7}}},get big(){return{title:"Big",model:"big",view:{name:"span",classes:"text-big",priority:7}}},get huge(){return{title:"Huge",model:"huge",view:{name:"span",classes:"text-huge",priority:7}}}};function Jk(t){return t.view&&"string"!=typeof t.view&&!t.view.priority&&(t.view.priority=7),t}const Xk=["x-small","x-small","small","medium","large","x-large","xx-large","xxx-large"];class tw extends ur{static get pluginName(){return"FontSizeEditing"}constructor(t){super(t),t.config.define(Tk,{options:["tiny","small","default","big","huge"],supportAllValues:!1})}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:Tk}),t.model.schema.setAttributeProperties(Tk,{isFormatting:!0,copyOnEnter:!0});const e=t.config.get("fontSize.supportAllValues"),n=Zk(this.editor.config.get("fontSize.options")).filter((t=>t.model)),i=Nk(Tk,n);e?(this._prepareAnyValueConverters(i),this._prepareCompatibilityConverter()):t.conversion.attributeToElement(i),t.commands.add(Tk,new Yk(t))}_prepareAnyValueConverters(t){const e=this.editor,n=t.model.values.filter((t=>!_h(String(t))&&!yh(String(t))));if(n.length)throw new A("font-size-invalid-use-of-named-presets",null,{presets:n});e.conversion.for("downcast").attributeToElement({model:Tk,view:(t,{writer:e})=>{if(t)return e.createAttributeElement("span",{style:"font-size:"+t},{priority:7})}}),e.conversion.for("upcast").elementToAttribute({model:{key:Tk,value:t=>t.getStyle("font-size")},view:{name:"span",styles:{"font-size":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{size:/^[+-]?\d{1,3}$/}},model:{key:Tk,value:t=>{const e=t.getAttribute("size"),n="-"===e[0]||"+"===e[0];let i=parseInt(e,10);n&&(i=3+i);const o=Xk.length-1,r=Math.min(Math.max(i,0),o);return Xk[r]}}})}}var ew=n(6203);Wi()(ew.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),ew.Z.locals;class nw extends ur{static get pluginName(){return"FontSizeUI"}init(){const t=this.editor,e=t.t,n=this._getLocalizedOptions(),i=t.commands.get(Tk),o=e("Font Size");t.ui.componentFactory.add(Tk,(e=>{const r=wu(e);return _u(r,(()=>function(t,e){const n=new Ni;for(const i of t){const t={type:"button",model:new Nm({commandName:Tk,commandParam:i.model,label:i.title,class:"ck-fontsize-option",role:"menuitemradio",withText:!0})};i.view&&"string"!=typeof i.view&&(i.view.styles&&t.model.set("labelStyle",`font-size:${i.view.styles["font-size"]}`),i.view.classes&&t.model.set("class",`${t.model.class} ${i.view.classes}`)),t.model.bind("isOn").to(e,"value",(t=>t===i.model)),n.add(t)}return n}(n,i)),{role:"menu",ariaLabel:o}),r.buttonView.set({label:o,icon:' ',tooltip:!0}),r.extendTemplate({attributes:{class:["ck-font-size-dropdown"]}}),r.bind("isEnabled").to(i),this.listenTo(r,"execute",(e=>{t.execute(e.source.commandName,{value:e.source.commandParam}),t.editing.view.focus()})),r}))}_getLocalizedOptions(){const t=this.editor,e=t.t,n={Default:e("Default"),Tiny:e("Tiny"),Small:e("Small"),Big:e("Big"),Huge:e("Huge")};return Zk(t.config.get(Tk).options).map((t=>{const e=n[t.title];return e&&e!=t.title&&(t=Object.assign({},t,{title:e})),t}))}}class iw extends ur{static get requires(){return[Zb]}static get pluginName(){return"CodeBlockElementSupport"}init(){if(!this.editor.plugins.has("CodeBlockEditing"))return;const t=this.editor.plugins.get(Zb);t.on("register:pre",((e,n)=>{if("codeBlock"!==n.model)return;const i=this.editor,o=i.model.schema,r=i.conversion;o.extend("codeBlock",{allowAttributes:["htmlAttributes","htmlContentAttributes"]}),r.for("upcast").add(function(t){return e=>{e.on("element:code",((e,n,i)=>{const o=n.viewItem,r=o.parent;function s(e,o){const r=t.processViewAttributes(e,i);r&&i.writer.setAttribute(o,r,n.modelRange)}r&&r.is("element","pre")&&(s(r,"htmlAttributes"),s(o,"htmlContentAttributes"))}),{priority:"low"})}}(t)),r.for("downcast").add((t=>{t.on("attribute:htmlAttributes:codeBlock",((t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const{attributeOldValue:i,attributeNewValue:o}=e,r=n.mapper.toViewElement(e.item).parent;Ib(n.writer,i,o,r)})),t.on("attribute:htmlContentAttributes:codeBlock",((t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const{attributeOldValue:i,attributeNewValue:o}=e,r=n.mapper.toViewElement(e.item);Ib(n.writer,i,o,r)}))})),e.stop()}))}}class ow extends ur{static get requires(){return[Zb]}static get pluginName(){return"DualContentModelElementSupport"}init(){this.editor.plugins.get(Zb).on("register",((t,e)=>{const n=e,i=this.editor,o=i.model.schema,r=i.conversion;if(!n.paragraphLikeModel)return;if(o.isRegistered(n.model)||o.isRegistered(n.paragraphLikeModel))return;const s={model:n.paragraphLikeModel,view:n.view};o.register(n.model,n.modelSchema),o.register(s.model,{inheritAllFrom:"$block"}),r.for("upcast").elementToElement({view:n.view,model:(t,{writer:e})=>this._hasBlockContent(t)?e.createElement(n.model):e.createElement(s.model),converterPriority:b.get("low")+.5}),r.for("downcast").elementToElement({view:n.view,model:n.model}),this._addAttributeConversion(n),r.for("downcast").elementToElement({view:s.view,model:s.model}),this._addAttributeConversion(s),t.stop()}))}_hasBlockContent(t){const e=this.editor.editing.view,n=e.domConverter.blockElements;for(const i of e.createRangeIn(t).getItems())if(i.is("element")&&n.includes(i.name))return!0;return!1}_addAttributeConversion(t){const e=this.editor,n=e.conversion,i=e.plugins.get(Zb);e.model.schema.extend(t.model,{allowAttributes:"htmlAttributes"}),n.for("upcast").add(Ob(t,i)),n.for("downcast").add(Vb(t))}}class rw extends ur{static get requires(){return[Ub,op]}static get pluginName(){return"HeadingElementSupport"}init(){const t=this.editor;if(!t.plugins.has("HeadingEditing"))return;const e=t.config.get("heading.options");this.registerHeadingElements(t,e),this.removeClassesOnEnter(t,e)}registerHeadingElements(t,e){const n=t.plugins.get(Ub),i=[];for(const t of e)"model"in t&&"view"in t&&(n.registerBlockElement({view:t.view,model:t.model}),i.push(t.model));n.extendBlockElement({model:"htmlHgroup",modelSchema:{allowChildren:i}})}removeClassesOnEnter(t,e){const n=t.commands.get("enter");this.listenTo(n,"afterExecute",((n,i)=>{const o=t.model.document.selection.getFirstPosition().parent;e.some((t=>o.is("element",t.model)))&&0===o.childCount&&Nb(i.writer,o,"htmlAttributes","classes",(t=>t.clear()))}))}}function sw(t,e,n){const i=t.createRangeOn(e);for(const{item:t}of i.getWalker())if(t.is("element",n))return t}class aw extends ur{static get requires(){return[Zb]}static get pluginName(){return"ImageElementSupport"}init(){const t=this.editor;if(!t.plugins.has("ImageInlineEditing")&&!t.plugins.has("ImageBlockEditing"))return;const e=t.model.schema,n=t.conversion,i=t.plugins.get(Zb);i.on("register:figure",(()=>{n.for("upcast").add(function(t){return e=>{e.on("element:figure",((e,n,i)=>{const o=n.viewItem;if(!n.modelRange||!o.hasClass("image"))return;const r=t.processViewAttributes(o,i);r&&i.writer.setAttribute("htmlFigureAttributes",r,n.modelRange)}),{priority:"low"})}}(i))})),i.on("register:img",((t,o)=>{"imageBlock"!==o.model&&"imageInline"!==o.model||(e.isRegistered("imageBlock")&&e.extend("imageBlock",{allowAttributes:["htmlAttributes","htmlFigureAttributes","htmlLinkAttributes"]}),e.isRegistered("imageInline")&&e.extend("imageInline",{allowAttributes:["htmlA","htmlAttributes"]}),n.for("upcast").add(function(t){return e=>{e.on("element:img",((e,n,i)=>{if(!n.modelRange)return;const o=n.viewItem,r=o.parent;function s(e,o){const r=t.processViewAttributes(e,i);r&&i.writer.setAttribute(o,r,n.modelRange)}s(o,"htmlAttributes"),r.is("element","a")&&function(t){n.modelRange&&n.modelRange.getContainedElement().is("element","imageBlock")&&s(t,"htmlLinkAttributes")}(r)}),{priority:"low"})}}(i)),n.for("downcast").add((t=>{function e(e,n){t.on(`attribute:${n}:imageBlock`,((t,n,i)=>{if(!i.consumable.test(n.item,t.name))return;const{attributeOldValue:o,attributeNewValue:r}=n,s=i.mapper.toViewElement(n.item),a=sw(i.writer,s,e);a&&(Ib(i.writer,o,r,a),i.consumable.consume(n.item,t.name))}),{priority:"low"}),"a"===e&&t.on("attribute:linkHref:imageBlock",((t,e,n)=>{if(!n.consumable.consume(e.item,"attribute:htmlLinkAttributes:imageBlock"))return;const i=n.mapper.toViewElement(e.item),o=sw(n.writer,i,"a");Bb(n.writer,e.item.getAttribute("htmlLinkAttributes"),o)}),{priority:"low"})}(function(e){t.on(`attribute:${e}:imageInline`,((t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const{attributeOldValue:i,attributeNewValue:o}=e,r=n.mapper.toViewElement(e.item);Ib(n.writer,i,o,r)}),{priority:"low"})})("htmlAttributes"),e("img","htmlAttributes"),e("figure","htmlFigureAttributes"),e("a","htmlLinkAttributes")})),t.stop())}))}}class lw extends ur{static get requires(){return[Zb]}static get pluginName(){return"MediaEmbedElementSupport"}init(){const t=this.editor;if(!t.plugins.has("MediaEmbed")||t.config.get("mediaEmbed.previewsInData"))return;const e=t.model.schema,n=t.conversion,i=this.editor.plugins.get(Zb),o=this.editor.plugins.get(Ub),r=t.config.get("mediaEmbed.elementName");o.registerBlockElement({model:"media",view:r}),i.on("register:figure",(()=>{n.for("upcast").add(function(t){return e=>{e.on("element:figure",((e,n,i)=>{const o=n.viewItem;if(!n.modelRange||!o.hasClass("media"))return;const r=t.processViewAttributes(o,i);r&&i.writer.setAttribute("htmlFigureAttributes",r,n.modelRange)}),{priority:"low"})}}(i))})),i.on(`register:${r}`,((t,o)=>{"media"===o.model&&(e.extend("media",{allowAttributes:["htmlAttributes","htmlFigureAttributes"]}),n.for("upcast").add(function(t,e){const n=(e,n,i)=>{!function(e,o){const r=t.processViewAttributes(e,i);r&&i.writer.setAttribute(o,r,n.modelRange)}(n.viewItem,"htmlAttributes")};return t=>{t.on(`element:${e}`,n,{priority:"low"})}}(i,r)),n.for("dataDowncast").add(function(t){return e=>{function n(t,n){e.on(`attribute:${n}:media`,((e,n,i)=>{if(!i.consumable.consume(n.item,e.name))return;const{attributeOldValue:o,attributeNewValue:r}=n,s=i.mapper.toViewElement(n.item),a=sw(i.writer,s,t);Ib(i.writer,o,r,a)}))}n(t,"htmlAttributes"),n("figure","htmlFigureAttributes")}}(r)),t.stop())}))}}class cw extends ur{static get requires(){return[Zb]}static get pluginName(){return"ScriptElementSupport"}init(){const t=this.editor.plugins.get(Zb);t.on("register:script",((e,n)=>{const i=this.editor,o=i.model.schema,r=i.conversion;o.register("htmlScript",n.modelSchema),o.extend("htmlScript",{allowAttributes:["htmlAttributes","htmlContent"],isContent:!0}),i.data.registerRawContentMatcher({name:"script"}),r.for("upcast").elementToElement({view:"script",model:zb(n)}),r.for("upcast").add(Ob(n,t)),r.for("downcast").elementToElement({model:"htmlScript",view:(t,{writer:e})=>Pb("script",t,e)}),r.for("downcast").add(Vb(n)),e.stop()}))}}class dw extends ur{static get requires(){return[Zb]}static get pluginName(){return"TableElementSupport"}init(){const t=this.editor;if(!t.plugins.has("TableEditing"))return;const e=t.model.schema,n=t.conversion,i=t.plugins.get(Zb),o=t.plugins.get("TableUtils");i.on("register:figure",(()=>{n.for("upcast").add(function(t){return e=>{e.on("element:figure",((e,n,i)=>{const o=n.viewItem;if(!n.modelRange||!o.hasClass("table"))return;const r=t.processViewAttributes(o,i);r&&i.writer.setAttribute("htmlFigureAttributes",r,n.modelRange)}),{priority:"low"})}}(i))})),i.on("register:table",((r,s)=>{"table"===s.model&&(e.extend("table",{allowAttributes:["htmlAttributes","htmlFigureAttributes","htmlTheadAttributes","htmlTbodyAttributes"]}),n.for("upcast").add(function(t){return e=>{e.on("element:table",((e,n,i)=>{if(!n.modelRange)return;const o=n.viewItem;r(o,"htmlAttributes");for(const t of o.getChildren())t.is("element","thead")&&r(t,"htmlTheadAttributes"),t.is("element","tbody")&&r(t,"htmlTbodyAttributes");function r(e,o){const r=t.processViewAttributes(e,i);r&&i.writer.setAttribute(o,r,n.modelRange)}}),{priority:"low"})}}(i)),n.for("downcast").add((t=>{function e(e,n){t.on(`attribute:${n}:table`,((t,n,i)=>{if(!i.consumable.test(n.item,t.name))return;const o=i.mapper.toViewElement(n.item),r=sw(i.writer,o,e);r&&(i.consumable.consume(n.item,t.name),Ib(i.writer,n.attributeOldValue,n.attributeNewValue,r))}))}e("table","htmlAttributes"),e("figure","htmlFigureAttributes"),e("thead","htmlTheadAttributes"),e("tbody","htmlTbodyAttributes")})),t.model.document.registerPostFixer(function(t,e){return n=>{const i=t.document.differ.getChanges();let o=!1;for(const t of i){if("attribute"!=t.type||"headingRows"!=t.attributeKey)continue;const i=t.range.start.nodeAfter,r=i.getAttribute("htmlTheadAttributes"),s=i.getAttribute("htmlTbodyAttributes");r&&!t.attributeNewValue?(n.removeAttribute("htmlTheadAttributes",i),o=!0):s&&t.attributeNewValue==e.getRows(i)&&(n.removeAttribute("htmlTbodyAttributes",i),o=!0)}return o}}(t.model,o)),r.stop())}))}}class hw extends ur{static get requires(){return[Zb]}static get pluginName(){return"StyleElementSupport"}init(){const t=this.editor.plugins.get(Zb);t.on("register:style",((e,n)=>{const i=this.editor,o=i.model.schema,r=i.conversion;o.register("htmlStyle",n.modelSchema),o.extend("htmlStyle",{allowAttributes:["htmlAttributes","htmlContent"],isContent:!0}),i.data.registerRawContentMatcher({name:"style"}),r.for("upcast").elementToElement({view:"style",model:zb(n)}),r.for("upcast").add(Ob(n,t)),r.for("downcast").elementToElement({model:"htmlStyle",view:(t,{writer:e})=>Pb("style",t,e)}),r.for("downcast").add(Vb(n)),e.stop()}))}}class uw extends ur{static get requires(){return[Zb]}static get pluginName(){return"DocumentListElementSupport"}init(){const t=this.editor;if(!t.plugins.has("DocumentListEditing"))return;const e=t.model.schema,n=t.conversion,i=t.plugins.get(Zb),o=t.plugins.get("DocumentListEditing");o.registerDowncastStrategy({scope:"item",attributeName:"htmlLiAttributes",setAttributeOnDowncast(t,e,n){Bb(t,e,n)}}),o.registerDowncastStrategy({scope:"list",attributeName:"htmlListAttributes",setAttributeOnDowncast(t,e,n){Bb(t,e,n)}}),i.on("register",((t,o)=>{["ul","ol","li"].includes(o.view)&&(t.stop(),e.checkAttribute("$block","htmlListAttributes")||(e.extend("$block",{allowAttributes:["htmlListAttributes","htmlLiAttributes"]}),e.extend("$blockObject",{allowAttributes:["htmlListAttributes","htmlLiAttributes"]}),e.extend("$container",{allowAttributes:["htmlListAttributes","htmlLiAttributes"]}),n.for("upcast").add((t=>{t.on("element:ul",mw("htmlListAttributes",i),{priority:"low"}),t.on("element:ol",mw("htmlListAttributes",i),{priority:"low"}),t.on("element:li",mw("htmlLiAttributes",i),{priority:"low"})}))))})),o.on("postFixer",((t,{listNodes:e,writer:n})=>{const i=[];for(const{node:o,previous:r}of e){if(!r)continue;const e=o.getAttribute("listIndent"),s=r.getAttribute("listIndent");let a=null;if(e>s?i[s]=r:e{t.model.change((t=>{for(const e of n)t.setAttribute("htmlListAttributes",{},e)}))}))}}function mw(t,e){return(n,i,o)=>{const r=i.viewItem;i.modelRange||Object.assign(i,o.convertChildren(i.viewItem,i.modelCursor));const s=e.processViewAttributes(r,o);for(const e of i.modelRange.getItems({shallow:!0}))e.hasAttribute("listItemId")&&(e.hasAttribute(t)||o.writer.setAttribute(t,s||{},e))}}class gw extends ur{static get requires(){return[Zb,Ub]}static get pluginName(){return"CustomElementSupport"}init(){const t=this.editor.plugins.get(Zb),e=this.editor.plugins.get(Ub);t.on("register:$customElement",((n,i)=>{n.stop();const o=this.editor,r=o.model.schema,s=o.conversion,a=o.editing.view.domConverter.unsafeElements,l=o.data.htmlProcessor.domConverter.preElements;r.register(i.model,i.modelSchema),r.extend(i.model,{allowAttributes:["htmlElementName","htmlAttributes","htmlContent"],isContent:!0}),s.for("upcast").elementToElement({view:/.*/,model:(n,r)=>{if("$comment"==n.name)return null;if(!function(t){try{document.createElement(t)}catch(t){return!1}return!0}(n.name))return null;if(e.getDefinitionsForView(n.name).size)return null;a.includes(n.name)||a.push(n.name),l.includes(n.name)||l.push(n.name);const s=r.writer.createElement(i.model,{htmlElementName:n.name}),c=t.processViewAttributes(n,r);c&&r.writer.setAttribute("htmlAttributes",c,s);const d=new hh(n.document).createDocumentFragment(n),h=o.data.processor.toData(d);r.writer.setAttribute("htmlContent",h,s);for(const{item:t}of o.editing.view.createRangeIn(n))r.consumable.consume(t,{name:!0});return s},converterPriority:"low"}),s.for("editingDowncast").elementToElement({model:{name:i.model,attributes:["htmlElementName","htmlAttributes","htmlContent"]},view:(t,{writer:e})=>{const n=t.getAttribute("htmlElementName"),i=e.createRawElement(n);return t.hasAttribute("htmlAttributes")&&Bb(e,t.getAttribute("htmlAttributes"),i),i}}),s.for("dataDowncast").elementToElement({model:{name:i.model,attributes:["htmlElementName","htmlAttributes","htmlContent"]},view:(t,{writer:e})=>{const n=t.getAttribute("htmlElementName"),i=t.getAttribute("htmlContent"),o=e.createRawElement(n,null,((t,e)=>{e.setContentOf(t,i);const n=t.firstChild;for(n.remove();n.firstChild;)t.appendChild(n.firstChild)}));return t.hasAttribute("htmlAttributes")&&Bb(e,t.getAttribute("htmlAttributes"),o),o}})}))}}function*pw(t,e,n){if(e)if(!(Symbol.iterator in e)&&e.is("documentSelection")&&e.isCollapsed)t.schema.checkAttributeInSelection(e,n)&&(yield e);else for(const i of function(t,e,n){return!(Symbol.iterator in e)&&(e.is("node")||e.is("$text")||e.is("$textProxy"))?t.schema.checkAttribute(e,n)?[t.createRangeOn(e)]:[]:t.schema.getValidRanges(t.createSelection(e).getRanges(),n)}(t,e,n))yield*i.getItems({shallow:!0})}class fw extends gr{constructor(t){super(t),this._isEnabledBasedOnSelection=!1}refresh(){const t=this.editor.model,e=zi(t.document.selection.getSelectedBlocks());this.value=!!e&&e.is("element","paragraph"),this.isEnabled=!!e&&bw(e,t.schema)}execute(t={}){const e=this.editor.model,n=e.document,i=t.selection||n.selection;e.canEditAt(i)&&e.change((t=>{const n=i.getSelectedBlocks();for(const i of n)!i.is("element","paragraph")&&bw(i,e.schema)&&t.rename(i,"paragraph")}))}}function bw(t,e){return e.checkChild(t.parent,"paragraph")&&!e.isObject(t)}class kw extends gr{constructor(t){super(t),this._isEnabledBasedOnSelection=!1}execute(t){const e=this.editor.model,n=t.attributes;let i=t.position;e.canEditAt(i)&&e.change((t=>{const o=t.createElement("paragraph");if(n&&e.schema.setAllowedAttributes(o,n,t),!e.schema.checkChild(i.parent,o)){const n=e.schema.findAllowedParent(i,o);if(!n)return;i=t.split(i,n).position}e.insertContent(o,i),t.setSelection(o,"in")}))}}class ww extends ur{static get pluginName(){return"Paragraph"}init(){const t=this.editor,e=t.model;t.commands.add("paragraph",new fw(t)),t.commands.add("insertParagraph",new kw(t)),e.schema.register("paragraph",{inheritAllFrom:"$block"}),t.conversion.elementToElement({model:"paragraph",view:"p"}),t.conversion.for("upcast").elementToElement({model:(t,{writer:e})=>ww.paragraphLikeElements.has(t.name)?t.isEmpty?null:e.createElement("paragraph"):null,view:/.+/,converterPriority:"low"})}}ww.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]);class Aw extends gr{constructor(t,e){super(t),this.modelElements=e}refresh(){const t=zi(this.editor.model.document.selection.getSelectedBlocks());this.value=!!t&&this.modelElements.includes(t.name)&&t.name,this.isEnabled=!!t&&this.modelElements.some((e=>Cw(t,e,this.editor.model.schema)))}execute(t){const e=this.editor.model,n=e.document,i=t.value;e.change((t=>{const o=Array.from(n.selection.getSelectedBlocks()).filter((t=>Cw(t,i,e.schema)));for(const e of o)e.is("element",i)||t.rename(e,i)}))}}function Cw(t,e,n){return n.checkChild(t.parent,e)&&!n.isObject(t)}const _w="paragraph";class vw extends ur{static get pluginName(){return"HeadingEditing"}constructor(t){super(t),t.config.define("heading",{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading1",view:"h2",title:"Heading 1",class:"ck-heading_heading1"},{model:"heading2",view:"h3",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h4",title:"Heading 3",class:"ck-heading_heading3"}]})}static get requires(){return[ww]}init(){const t=this.editor,e=t.config.get("heading.options"),n=[];for(const i of e)"paragraph"!==i.model&&(t.model.schema.register(i.model,{inheritAllFrom:"$block"}),t.conversion.elementToElement(i),n.push(i.model));this._addDefaultH1Conversion(t),t.commands.add("heading",new Aw(t,n))}afterInit(){const t=this.editor,e=t.commands.get("enter"),n=t.config.get("heading.options");e&&this.listenTo(e,"afterExecute",((e,i)=>{const o=t.model.document.selection.getFirstPosition().parent;n.some((t=>o.is("element",t.model)))&&!o.is("element",_w)&&0===o.childCount&&i.writer.rename(o,_w)}))}_addDefaultH1Conversion(t){t.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:b.get("low")+1})}}var yw=n(3230);Wi()(yw.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),yw.Z.locals;class xw extends ur{static get pluginName(){return"HeadingUI"}init(){const t=this.editor,e=t.t,n=function(t){const e=t.t,n={Paragraph:e("Paragraph"),"Heading 1":e("Heading 1"),"Heading 2":e("Heading 2"),"Heading 3":e("Heading 3"),"Heading 4":e("Heading 4"),"Heading 5":e("Heading 5"),"Heading 6":e("Heading 6")};return t.config.get("heading.options").map((t=>{const e=n[t.title];return e&&e!=t.title&&(t.title=e),t}))}(t),i=e("Choose heading"),o=e("Heading");t.ui.componentFactory.add("heading",(e=>{const r={},s=new Ni,a=t.commands.get("heading"),l=t.commands.get("paragraph"),c=[a];for(const t of n){const e={type:"button",model:new Nm({label:t.title,class:t.class,role:"menuitemradio",withText:!0})};"paragraph"===t.model?(e.model.bind("isOn").to(l,"value"),e.model.set("commandName","paragraph"),c.push(l)):(e.model.bind("isOn").to(a,"value",(e=>e===t.model)),e.model.set({commandName:"heading",commandValue:t.model})),s.add(e),r[t.model]=t.title}const d=wu(e);return _u(d,s,{ariaLabel:o,role:"menu"}),d.buttonView.set({ariaLabel:o,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:o}),d.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),d.bind("isEnabled").toMany(c,"isEnabled",((...t)=>t.some((t=>t)))),d.buttonView.bind("label").to(a,"value",l,"value",((t,e)=>{const n=t||e&&"paragraph";return"boolean"==typeof n?i:r[n]?r[n]:i})),this.listenTo(d,"execute",(e=>{const{commandName:n,commandValue:i}=e.source;t.execute(n,i?{value:i}:void 0),t.editing.view.focus()})),d}))}}class Ew extends gr{refresh(){const t=this.editor.model,e=t.document;this.value=e.selection.getAttribute("highlight"),this.isEnabled=t.schema.checkAttributeInSelection(e.selection,"highlight")}execute(t={}){const e=this.editor.model,n=e.document.selection,i=t.value;e.change((t=>{if(n.isCollapsed){const e=n.getFirstPosition();if(n.hasAttribute("highlight")){const n=t=>t.item.hasAttribute("highlight")&&t.item.getAttribute("highlight")===this.value,o=e.getLastMatchingPosition(n,{direction:"backward"}),r=e.getLastMatchingPosition(n),s=t.createRange(o,r);i&&this.value!==i?(e.isEqual(r)||t.setAttribute("highlight",i,s),t.setSelectionAttribute("highlight",i)):(e.isEqual(r)||t.removeAttribute("highlight",s),t.removeSelectionAttribute("highlight"))}else i&&t.setSelectionAttribute("highlight",i)}else{const o=e.schema.getValidRanges(n.getRanges(),"highlight");for(const e of o)i?t.setAttribute("highlight",i,e):t.removeAttribute("highlight",e)}}))}}class Dw extends ur{static get pluginName(){return"HighlightEditing"}constructor(t){super(t),t.config.define("highlight",{options:[{model:"yellowMarker",class:"marker-yellow",title:"Yellow marker",color:"var(--ck-highlight-marker-yellow)",type:"marker"},{model:"greenMarker",class:"marker-green",title:"Green marker",color:"var(--ck-highlight-marker-green)",type:"marker"},{model:"pinkMarker",class:"marker-pink",title:"Pink marker",color:"var(--ck-highlight-marker-pink)",type:"marker"},{model:"blueMarker",class:"marker-blue",title:"Blue marker",color:"var(--ck-highlight-marker-blue)",type:"marker"},{model:"redPen",class:"pen-red",title:"Red pen",color:"var(--ck-highlight-pen-red)",type:"pen"},{model:"greenPen",class:"pen-green",title:"Green pen",color:"var(--ck-highlight-pen-green)",type:"pen"}]})}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:"highlight"});const e=t.config.get("highlight.options");t.conversion.attributeToElement(function(t){const e={model:{key:"highlight",values:[]},view:{}};for(const n of t)e.model.values.push(n.model),e.view[n.model]={name:"mark",classes:n.class};return e}(e)),t.commands.add("highlight",new Ew(t))}}var Sw=n(713);Wi()(Sw.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),Sw.Z.locals;class Tw extends ur{get localizedOptionTitles(){const t=this.editor.t;return{"Yellow marker":t("Yellow marker"),"Green marker":t("Green marker"),"Pink marker":t("Pink marker"),"Blue marker":t("Blue marker"),"Red pen":t("Red pen"),"Green pen":t("Green pen")}}static get pluginName(){return"HighlightUI"}init(){const t=this.editor.config.get("highlight.options");for(const e of t)this._addHighlighterButton(e);this._addRemoveHighlightButton(),this._addDropdown(t)}_addRemoveHighlightButton(){const t=this.editor.t,e=this.editor.commands.get("highlight");this._addButton("removeHighlight",t("Remove highlight"),iu.eraser,null,(t=>{t.bind("isEnabled").to(e,"isEnabled")}))}_addHighlighterButton(t){const e=this.editor.commands.get("highlight");this._addButton("highlight:"+t.model,t.title,Iw(t.type),t.model,(function(n){n.bind("isEnabled").to(e,"isEnabled"),n.bind("isOn").to(e,"value",(e=>e===t.model)),n.iconView.fillColor=t.color,n.isToggleable=!0}))}_addButton(t,e,n,i,o){const r=this.editor;r.ui.componentFactory.add(t,(t=>{const s=new Ao(t),a=this.localizedOptionTitles[e]?this.localizedOptionTitles[e]:e;return s.set({label:a,icon:n,tooltip:!0}),s.on("execute",(()=>{r.execute("highlight",{value:i}),r.editing.view.focus()})),o(s),s}))}_addDropdown(t){const e=this.editor,n=e.t,i=e.ui.componentFactory,o=t[0],r=t.reduce(((t,e)=>(t[e.model]=e,t)),{});i.add("highlight",(s=>{const a=e.commands.get("highlight"),l=wu(s,fu),c=l.buttonView;function d(t,e){const n=t&&t!==c.lastExecuted?t:c.lastExecuted;return r[n][e]}return c.set({label:n("Highlight"),tooltip:!0,lastExecuted:o.model,commandValue:o.model,isToggleable:!0}),c.bind("icon").to(a,"value",(t=>Iw(d(t,"type")))),c.bind("color").to(a,"value",(t=>d(t,"color"))),c.bind("commandValue").to(a,"value",(t=>d(t,"model"))),c.bind("isOn").to(a,"value",(t=>!!t)),c.delegate("execute").to(l),l.bind("isEnabled").to(a,"isEnabled"),Au(l,(()=>{const e=t.map((t=>{const e=i.create("highlight:"+t.model);return this.listenTo(e,"execute",(()=>{l.buttonView.set({lastExecuted:t.model})})),e}));return e.push(new cr),e.push(i.create("removeHighlight")),e}),{enableActiveItemFocusOnDropdownOpen:!0,ariaLabel:n("Text highlight toolbar")}),function(t){t.buttonView.actionView.iconView.bind("fillColor").to(t.buttonView,"color")}(l),c.on("execute",(()=>{e.execute("highlight",{value:c.commandValue})})),this.listenTo(l,"execute",(()=>{e.editing.view.focus()})),l}))}}function Iw(t){return"marker"===t?' ':' '}class Bw extends gr{refresh(){const t=this.editor.model,e=t.schema,n=t.document.selection;this.isEnabled=function(t,e,n){const i=function(t,e){const n=_p(t,e).start.parent;return n.isEmpty&&!n.is("element","$root")?n.parent:n}(t,n);return e.checkChild(i,"horizontalLine")}(n,e,t)}execute(){const t=this.editor.model;t.change((e=>{const n=e.createElement("horizontalLine");t.insertObject(n,null,null,{setSelection:"after"})}))}}var Mw=n(2536);Wi()(Mw.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),Mw.Z.locals;class Nw extends ur{static get pluginName(){return"HorizontalLineEditing"}init(){const t=this.editor,e=t.model.schema,n=t.t,i=t.conversion;e.register("horizontalLine",{inheritAllFrom:"$blockObject"}),i.for("dataDowncast").elementToElement({model:"horizontalLine",view:(t,{writer:e})=>e.createEmptyElement("hr")}),i.for("editingDowncast").elementToStructure({model:"horizontalLine",view:(t,{writer:e})=>{const i=n("Horizontal line"),o=e.createContainerElement("div",null,e.createEmptyElement("hr"));return e.addClass("ck-horizontal-line",o),e.setCustomProperty("hr",!0,o),function(t,e,n){return e.setCustomProperty("horizontalLine",!0,t),bp(t,e,{label:n})}(o,e,i)}}),i.for("upcast").elementToElement({view:"hr",model:"horizontalLine"}),t.commands.add("horizontalLine",new Bw(t))}}class zw extends ur{static get pluginName(){return"HorizontalLineUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add("horizontalLine",(n=>{const i=t.commands.get("horizontalLine"),o=new Ao(n);return o.set({label:e("Horizontal line"),icon:' ',tooltip:!0}),o.bind("isEnabled").to(i,"isEnabled"),this.listenTo(o,"execute",(()=>{t.execute("horizontalLine"),t.editing.view.focus()})),o}))}}class Lw extends gr{refresh(){const t=this.editor.model,e=t.schema,n=t.document.selection,i=Pw(n);this.isEnabled=function(t,e,n){const i=function(t,e){const n=_p(t,e).start.parent;return n.isEmpty&&!n.is("rootElement")?n.parent:n}(t,n);return e.checkChild(i,"rawHtml")}(n,e,t),this.value=i?i.getAttribute("value")||"":null}execute(t){const e=this.editor.model,n=e.document.selection;e.change((i=>{let o;null!==this.value?o=Pw(n):(o=i.createElement("rawHtml"),e.insertObject(o,null,null,{setSelection:"on"})),i.setAttribute("value",t,o)}))}}function Pw(t){const e=t.getSelectedElement();return e&&e.is("element","rawHtml")?e:null}var Rw=n(3403);Wi()(Rw.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),Rw.Z.locals;class Ow extends ur{static get pluginName(){return"HtmlEmbedEditing"}constructor(t){super(t),this._widgetButtonViewReferences=new Set,t.config.define("htmlEmbed",{showPreviews:!1,sanitizeHtml:t=>(C("html-embed-provide-sanitize-function"),{html:t,hasChanged:!1})})}init(){const t=this.editor;t.model.schema.register("rawHtml",{inheritAllFrom:"$blockObject",allowAttributes:["value"]}),t.commands.add("htmlEmbed",new Lw(t)),this._setupConversion()}_setupConversion(){const t=this.editor,e=t.t,n=t.editing.view,i=this._widgetButtonViewReferences,o=t.config.get("htmlEmbed");function r({editor:t,domElement:n,state:o,props:r}){n.textContent="";const a=n.ownerDocument;let l;if(o.isEditable){const t={isDisabled:!1,placeholder:r.textareaPlaceholder};l=s({domDocument:a,state:o,props:t}),n.append(l)}else if(o.showPreviews){const i={sanitizeHtml:r.sanitizeHtml};n.append(function({editor:t,domDocument:n,state:i,props:o}){const r=o.sanitizeHtml(i.getRawHtmlValue()),s=gt(n,"div",{class:"ck ck-reset_all raw-html-embed__preview-placeholder"},i.getRawHtmlValue().length>0?e("No preview available"):e("Empty snippet content")),a=gt(n,"div",{class:"raw-html-embed__preview-content",dir:t.locale.contentLanguageDirection}),l=n.createRange().createContextualFragment(r.html);a.appendChild(l);return gt(n,"div",{class:"raw-html-embed__preview"},[s,a])}({domDocument:a,state:o,props:i,editor:t}))}else{const t={isDisabled:!0,placeholder:r.textareaPlaceholder};n.append(s({domDocument:a,state:o,props:t}))}const c={onEditClick:r.onEditClick,onSaveClick:()=>{r.onSaveClick(l.value)},onCancelClick:r.onCancelClick};n.prepend(function({editor:t,domDocument:e,state:n,props:o}){const r=gt(e,"div",{class:"raw-html-embed__buttons-wrapper"});if(n.isEditable){const e=Vw(t,"save",o.onSaveClick),n=Vw(t,"cancel",o.onCancelClick);r.append(e.element,n.element),i.add(e).add(n)}else{const e=Vw(t,"edit",o.onEditClick);r.append(e.element),i.add(e)}return r}({editor:t,domDocument:a,state:o,props:c}))}function s({domDocument:t,state:e,props:n}){const i=gt(t,"textarea",{placeholder:n.placeholder,class:"ck ck-reset ck-input ck-input-text raw-html-embed__source"});return i.disabled=n.isDisabled,i.value=e.getRawHtmlValue(),i}this.editor.editing.view.on("render",(()=>{for(const t of i){if(t.element&&t.element.isConnected)return;t.destroy(),i.delete(t)}}),{priority:"lowest"}),t.data.registerRawContentMatcher({name:"div",classes:"raw-html-embed"}),t.conversion.for("upcast").elementToElement({view:{name:"div",classes:"raw-html-embed"},model:(t,{writer:e})=>e.createElement("rawHtml",{value:t.getCustomProperty("$rawContent")})}),t.conversion.for("dataDowncast").elementToElement({model:"rawHtml",view:(t,{writer:e})=>e.createRawElement("div",{class:"raw-html-embed"},(function(e){e.innerHTML=t.getAttribute("value")||""}))}),t.conversion.for("editingDowncast").elementToStructure({model:{name:"rawHtml",attributes:["value"]},view:(i,{writer:s})=>{let a,l,c;const d=s.createRawElement("div",{class:"raw-html-embed__content-wrapper"},(function(e){a=e,r({editor:t,domElement:e,state:l,props:c}),a.addEventListener("mousedown",(()=>{if(l.isEditable){const e=t.model;e.document.selection.getSelectedElement()!==i&&e.change((t=>t.setSelection(i,"on")))}}),!0)})),h={makeEditable(){l=Object.assign({},l,{isEditable:!0}),r({domElement:a,editor:t,state:l,props:c}),n.change((t=>{t.setAttribute("data-cke-ignore-events","true",d)})),a.querySelector("textarea").focus()},save(e){e!==l.getRawHtmlValue()?(t.execute("htmlEmbed",e),t.editing.view.focus()):this.cancel()},cancel(){l=Object.assign({},l,{isEditable:!1}),r({domElement:a,editor:t,state:l,props:c}),t.editing.view.focus(),n.change((t=>{t.removeAttribute("data-cke-ignore-events",d)}))}};l={showPreviews:o.showPreviews,isEditable:!1,getRawHtmlValue:()=>i.getAttribute("value")||""},c={sanitizeHtml:o.sanitizeHtml,textareaPlaceholder:e("Paste raw HTML here..."),onEditClick(){h.makeEditable()},onSaveClick(t){h.save(t)},onCancelClick(){h.cancel()}};const u=s.createContainerElement("div",{class:"raw-html-embed","data-html-embed-label":e("HTML snippet"),dir:t.locale.uiLanguageDirection},d);return s.setCustomProperty("rawHtmlApi",h,u),s.setCustomProperty("rawHtml",!0,u),bp(u,s,{label:e("HTML snippet"),hasSelectionHandle:!0})}})}}function Vw(t,e,n){const{t:i}=t.locale,o=new Ao(t.locale),r=t.commands.get("htmlEmbed");return o.set({class:`raw-html-embed__${e}-button`,icon:iu.pencil,tooltip:!0,tooltipPosition:"rtl"===t.locale.uiLanguageDirection?"e":"w"}),o.render(),"edit"===e?(o.set({icon:iu.pencil,label:i("Edit source")}),o.bind("isEnabled").to(r)):"save"===e?(o.set({icon:iu.check,label:i("Save changes")}),o.bind("isEnabled").to(r)):o.set({icon:iu.cancel,label:i("Cancel")}),o.on("execute",n),o}class Fw extends ur{static get pluginName(){return"HtmlEmbedUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add("htmlEmbed",(n=>{const i=t.commands.get("htmlEmbed"),o=new Ao(n);return o.set({label:e("Insert HTML"),icon:' ',tooltip:!0}),o.bind("isEnabled").to(i,"isEnabled"),this.listenTo(o,"execute",(()=>{t.execute("htmlEmbed"),t.editing.view.focus(),t.editing.view.document.selection.getSelectedElement().getCustomProperty("rawHtmlApi").makeEditable()})),o}))}}class jw extends gr{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 Hw extends ur{static get requires(){return[mf]}static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new jw(this.editor))}}var Uw=n(6831);Wi()(Uw.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),Uw.Z.locals;class Gw extends $i{constructor(t){super(t);const e=this.locale.t;this.focusTracker=new Li,this.keystrokes=new Pi,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(e("Save"),iu.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(e("Cancel"),iu.cancel,"ck-button-cancel","cancel"),this._focusables=new Ui,this._focusCycler=new ar({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),o({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 Ao(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 Qo(this.locale,xu);return e.label=t("Text alternative"),e}}function Ww(t){const e=t.editing.view,n=dm.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 qw extends ur{static get requires(){return[Om]}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 Ao(n);return o.set({label:e("Change image text alternative"),icon:iu.lowVision,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 n=this.editor,i=n.editing.view.document,o=n.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(e(Gw))(n.locale),this._form.render(),this.listenTo(this._form,"submit",(()=>{n.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(n.ui,"update",(()=>{o.getClosestSelectedImageWidget(i.selection)?this._isVisible&&function(t){const e=t.plugins.get("ContextualBalloon");if(t.plugins.get("ImageUtils").getClosestSelectedImageWidget(t.editing.view.document.selection)){const n=Ww(t);e.updatePosition(n)}}(n):this._hideForm(!0)})),t({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:Ww(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 $w extends ur{static get requires(){return[Hw,qw]}static get pluginName(){return"ImageTextAlternative"}}function Kw(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);if(null===n.attributeNewValue){const t=n.attributeOldValue;t&&t.data&&(o.removeAttribute("srcset",s),o.removeAttribute("sizes",s),t.width&&o.removeAttribute("width",s))}else{const t=n.attributeNewValue;t&&t.data&&(o.setAttribute("srcset",t.data,s),o.setAttribute("sizes","100vw",s),t.width&&o.setAttribute("width",t.width,s))}};return t=>{t.on(`attribute:srcset:${e}`,n)}}function Yw(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 Zw extends Ba{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 Qw extends gr{constructor(t){super(t);const e=t.config.get("image.insert.type");t.plugins.has("ImageBlockEditing")||"block"===e&&C("image-block-plugin-required"),t.plugins.has("ImageInlineEditing")||"inline"===e&&C("image-inline-plugin-required")}refresh(){const t=this.editor.plugins.get("ImageUtils");this.isEnabled=t.isImageAllowed()}execute(t){const e=Bi(t.source),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("string"==typeof t&&(t={src:t}),e&&r&&i.isImage(r)){const e=this.editor.model.createPositionAfter(r);i.insertImage({...t,...o},e)}else i.insertImage({...t,...o})}))}}class Jw extends gr{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();this.editor.model.change((n=>{n.setAttribute("src",t.source,e),n.removeAttribute("srcset",e),n.removeAttribute("sizes",e)}))}}class Xw extends ur{static get requires(){return[mf]}static get pluginName(){return"ImageEditing"}init(){const t=this.editor,e=t.conversion;t.editing.view.addObserver(Zw),e.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:{key:"srcset",value:t=>{const e={data:t.getAttribute("srcset")};return t.hasAttribute("width")&&(e.width=t.getAttribute("width")),e}}});const n=new Qw(t),i=new Jw(t);t.commands.add("insertImage",n),t.commands.add("replaceImageSource",i),t.commands.add("imageInsert",n)}}class tA extends gr{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(){const t=this.editor,e=this.editor.model,n=t.plugins.get("ImageUtils"),i=n.getClosestSelectedImageElement(e.document.selection),o=Object.fromEntries(i.getAttributes());return o.src||o.uploadId?e.change((t=>{const r=Array.from(e.markers).filter((t=>t.getRange().containsItem(i))),s=n.insertImage(o,e.createSelection(i,"on"),this._modelElementName);if(!s)return null;const a=t.createRangeOn(s);for(const e of r){const n=e.getRange(),i="$graveyard"!=n.root.rootName?n.getJoined(a,!0):a;t.updateMarker(e,{range:i})}return{oldElement:i,newElement:s}})):null}}class eA extends ur{static get requires(){return[Xw,mf,bg]}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 tA(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})=>df(e)}),n.for("editingDowncast").elementToStructure({model:"imageBlock",view:(t,{writer:n})=>i.toImageWidget(df(n),n,e("image widget"))}),n.for("downcast").add(Yw(i,"imageBlock","src")).add(Yw(i,"imageBlock","alt")).add(Kw(i,"imageBlock")),n.for("upcast").elementToElement({view:hf(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=zi(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 l=e.createSelection(a);if("imageBlock"===uf(e.schema,l)){const t=new hh(n.document),e=s.map((e=>t.createElement("figure",{class:"image"},e)));r.content=t.createDocumentFragment(e)}}))}}var nA=n(9048);Wi()(nA.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),nA.Z.locals;class iA extends ur{static get requires(){return[eA,Lp,$w]}static get pluginName(){return"ImageBlock"}}class oA extends ur{static get requires(){return[Xw,mf,bg]}static get pluginName(){return"ImageInlineEditing"}init(){const t=this.editor,e=t.model.schema;e.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"]}),e.addChildCheck(((t,e)=>{if(t.endsWith("caption")&&"imageInline"===e.name)return!1})),this._setupConversion(),t.plugins.has("ImageBlockEditing")&&(t.commands.add("imageTypeInline",new tA(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(Yw(i,"imageInline","src")).add(Yw(i,"imageInline","alt")).add(Kw(i,"imageInline")),n.for("upcast").elementToElement({view:hf(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 l=e.createSelection(a);if("imageInline"===uf(e.schema,l)){const t=new hh(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)}}))}}class rA extends ur{static get requires(){return[oA,Lp,$w]}static get pluginName(){return"ImageInline"}}class sA extends gr{refresh(){const t=this.editor,e=t.plugins.get("ImageCaptionUtils"),n=t.plugins.get("ImageUtils");if(!t.plugins.has(eA))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 aA extends ur{static get pluginName(){return"ImageCaptionUtils"}static get requires(){return[mf]}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 lA extends ur{static get requires(){return[mf,aA]}static get pluginName(){return"ImageCaptionEditing"}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 sA(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({view:e,element:r,text:o("Enter image caption"),keepOnFocus:!0});const s=t.parent.getAttribute("alt");return Cp(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?fl.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 cA extends ur{static get requires(){return[aA]}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 Ao(o);return s.set({icon:iu.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 dA=n(8662);Wi()(dA.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),dA.Z.locals;class hA extends(G()){constructor(){super();const t=new window.FileReader;this._reader=t,this._data=void 0,this.set("loaded",0),t.onprogress=t=>{this.loaded=t.loaded}}get error(){return this._reader.error}get data(){return this._data}read(t){const e=this._reader;return this.total=t.size,new Promise(((n,i)=>{e.onload=()=>{const t=e.result;this._data=t,n(t)},e.onerror=()=>{i("error")},e.onabort=()=>{i("aborted")},this._reader.readAsDataURL(t)}))}abort(){this._reader.abort()}}class uA extends ur{constructor(){super(...arguments),this.loaders=new Ni,this._loadersMap=new Map,this._pendingAction=null}static get pluginName(){return"FileRepository"}static get requires(){return[nu]}init(){this.loaders.on("change",(()=>this._updatePendingAction())),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",((t,e)=>e?t/e*100:0))}getLoader(t){return this._loadersMap.get(t)||null}createLoader(t){if(!this.createUploadAdapter)return C("filerepository-no-upload-adapter"),null;const e=new mA(Promise.resolve(t),this.createUploadAdapter);return this.loaders.add(e),this._loadersMap.set(t,e),t instanceof Promise&&e.file.then((t=>{this._loadersMap.set(t,e)})).catch((()=>{})),e.on("change:uploaded",(()=>{let t=0;for(const e of this.loaders)t+=e.uploaded;this.uploaded=t})),e.on("change:uploadTotal",(()=>{let t=0;for(const e of this.loaders)e.uploadTotal&&(t+=e.uploadTotal);this.uploadTotal=t})),e}destroyLoader(t){const e=t instanceof mA?t:this.getLoader(t);e._destroy(),this.loaders.remove(e),this._loadersMap.forEach(((t,n)=>{t===e&&this._loadersMap.delete(n)}))}_updatePendingAction(){const t=this.editor.plugins.get(nu);if(this.loaders.length){if(!this._pendingAction){const e=this.editor.t,n=t=>`${e("Upload in progress")} ${parseInt(t)}%.`;this._pendingAction=t.add(n(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",n)}}else t.remove(this._pendingAction),this._pendingAction=null}}class mA extends(G()){constructor(t,e){super(),this.id=f(),this._filePromiseWrapper=this._createFilePromiseWrapper(t),this._adapter=e(this),this._reader=new hA,this.set("status","idle"),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",((t,e)=>e?t/e*100:0)),this.set("uploadResponse",null)}get file(){return this._filePromiseWrapper?this._filePromiseWrapper.promise.then((t=>this._filePromiseWrapper?t:null)):Promise.resolve(null)}get data(){return this._reader.data}read(){if("idle"!=this.status)throw new A("filerepository-read-wrong-status",this);return this.status="reading",this.file.then((t=>this._reader.read(t))).then((t=>{if("reading"!==this.status)throw this.status;return this.status="idle",t})).catch((t=>{if("aborted"===t)throw this.status="aborted","aborted";throw this.status="error",this._reader.error?this._reader.error:t}))}upload(){if("idle"!=this.status)throw new A("filerepository-upload-wrong-status",this);return this.status="uploading",this.file.then((()=>this._adapter.upload())).then((t=>(this.uploadResponse=t,this.status="idle",t))).catch((t=>{if("aborted"===this.status)throw"aborted";throw this.status="error",t}))}abort(){const t=this.status;this.status="aborted",this._filePromiseWrapper.isFulfilled?"reading"==t?this._reader.abort():"uploading"==t&&this._adapter.abort&&this._adapter.abort():(this._filePromiseWrapper.promise.catch((()=>{})),this._filePromiseWrapper.rejecter("aborted")),this._destroy()}_destroy(){this._filePromiseWrapper=void 0,this._reader=void 0,this._adapter=void 0,this.uploadResponse=void 0}_createFilePromiseWrapper(t){const e={};return e.promise=new Promise(((n,i)=>{e.rejecter=i,e.isFulfilled=!1,t.then((t=>{e.isFulfilled=!0,n(t)})).catch((t=>{e.isFulfilled=!0,i(t)}))})),e}}class gA extends $i{constructor(t){super(t),this.buttonView=new Ao(t),this._fileInputView=new pA(t),this._fileInputView.bind("acceptedType").to(this),this._fileInputView.bind("allowMultipleFiles").to(this),this._fileInputView.delegate("done").to(this),this.setTemplate({tag:"span",attributes:{class:"ck-file-dialog-button"},children:[this.buttonView,this._fileInputView]}),this.buttonView.on("execute",(()=>{this._fileInputView.open()}))}focus(){this.buttonView.focus()}}class pA extends $i{constructor(t){super(t),this.set("acceptedType",void 0),this.set("allowMultipleFiles",!1);const e=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:e.to("acceptedType"),multiple:e.to("allowMultipleFiles")},on:{change:e.to((()=>{this.element&&this.element.files&&this.element.files.length&&this.fire("done",this.element.files),this.element.value=""}))}})}open(){this.element.click()}}class fA{constructor(t,e){this.loader=t,this.options=e}upload(){return this.loader.file.then((t=>new Promise(((e,n)=>{this._initRequest(),this._initListeners(e,n,t),this._sendRequest(t)}))))}abort(){this.xhr&&this.xhr.abort()}_initRequest(){const t=this.xhr=new XMLHttpRequest;t.open("POST",this.options.uploadUrl,!0),t.responseType="json"}_initListeners(t,e,n){const i=this.xhr,o=this.loader,r=`Couldn't upload file: ${n.name}.`;i.addEventListener("error",(()=>e(r))),i.addEventListener("abort",(()=>e())),i.addEventListener("load",(()=>{const n=i.response;if(!n||n.error)return e(n&&n.error&&n.error.message?n.error.message:r);const o=n.url?{default:n.url}:n.urls;t({...n,urls:o})})),i.upload&&i.upload.addEventListener("progress",(t=>{t.lengthComputable&&(o.uploadTotal=t.total,o.uploaded=t.loaded)}))}_sendRequest(t){const e=this.options.headers||{},n=this.options.withCredentials||!1;for(const t of Object.keys(e))this.xhr.setRequestHeader(t,e[t]);this.xhr.withCredentials=n;const i=new FormData;i.append("upload",t),this.xhr.send(i)}}function bA(t){const e=t.map((t=>t.replace("+","\\+")));return new RegExp(`^image\\/(${e.join("|")})$`)}function kA(t){return new Promise(((e,n)=>{const i=t.getAttribute("src");fetch(i).then((t=>t.blob())).then((t=>{const n=wA(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=Gn.document.createElement("img");i.addEventListener("load",(()=>{const t=Gn.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=wA(e,t),i=n.replace("image/","");return new File([e],`image.${i}`,{type:n})}))}(i).then(e).catch(n):n(t)))}))}function wA(t,e){return t.type?t.type:e.match(/data:(image\/\w+);base64/)?e.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}class AA extends ur{static get pluginName(){return"ImageUploadUI"}init(){const t=this.editor,e=t.t,n=n=>{const i=new gA(n),o=t.commands.get("uploadImage"),r=t.config.get("image.upload.types"),s=bA(r);return i.set({acceptedType:r.map((t=>`image/${t}`)).join(","),allowMultipleFiles:!0}),i.buttonView.set({label:e("Insert image"),icon:iu.image,tooltip:!0}),i.buttonView.bind("isEnabled").to(o),i.on("done",((e,n)=>{const i=Array.from(n).filter((t=>s.test(t.type)));i.length&&(t.execute("uploadImage",{file:i}),t.editing.view.focus())})),i};t.ui.componentFactory.add("uploadImage",n),t.ui.componentFactory.add("imageUpload",n)}}var CA=n(5870);Wi()(CA.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),CA.Z.locals;var _A=n(9899);Wi()(_A.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),_A.Z.locals;var vA=n(9825);Wi()(vA.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),vA.Z.locals;class yA extends ur{static get pluginName(){return"ImageUploadProgress"}constructor(t){super(t),this.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(uA),l=r?e.attributeNewValue:null,c=this.placeholder,d=i.editing.mapper.toViewElement(o),h=n.writer;if("reading"==l)return xA(d,h),void EA(s,c,d,h);if("uploading"==l){const t=a.loaders.get(r);return xA(d,h),void(t?(DA(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)):EA(s,c,d,h))}"complete"==l&&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){TA(t,e,"progressBar")}(d,h),DA(d,h),function(t,e){e.removeClass("ck-appear",t)}(d,h)},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)}}function xA(t,e){t.hasClass("ck-appear")||e.addClass("ck-appear",t)}function EA(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),SA(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 DA(t,e){t.hasClass("ck-image-upload-placeholder")&&e.removeClass("ck-image-upload-placeholder",t),TA(t,e,"placeholder")}function SA(t,e){for(const n of t.getChildren())if(n.getCustomProperty(e))return n}function TA(t,e,n){const i=SA(t,n);i&&e.remove(e.createRangeOn(i))}class IA extends gr{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=Bi(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(uA).createLoader(t),r=i.plugins.get("ImageUtils");o&&r.insertImage({...e,uploadId:o.id},n)}}class BA extends ur{static get requires(){return[uA,Mm,bg,mf]}static get pluginName(){return"ImageUploadEditing"}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(uA),o=t.plugins.get("ImageUtils"),r=t.plugins.get("ClipboardPipeline"),s=bA(t.config.get("image.upload.types")),a=new IA(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)));o.length&&(e.stop(),t.model.change((e=>{n.targetRanges&&e.setSelection(n.targetRanges.map((e=>t.editing.mapper.toModelRange(e)))),t.model.enqueueChange((()=>{t.execute("uploadImage",{file:o})}))})))})),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:kA(t),imageElement:t})));if(!r.length)return;const s=new hh(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 MA(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)}))}),{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(uA),r=e.plugins.get(Mm),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 i=t.upload(),o=a.get(t.id);if(l.isSafari){const t=e.editing.mapper.toViewElement(o),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 n.enqueueChange({isUndoable:!1},(t=>{t.setAttribute("uploadStatus","uploading",o)})),i})).then((e=>{n.enqueueChange({isUndoable:!1},(n=>{const i=a.get(t.id);n.setAttribute("uploadStatus","complete",i),this.fire("uploadComplete",{data:e,imageElement:i})})),c()})).catch((e=>{if("error"!==t.status&&"aborted"!==t.status)throw e;"error"==t.status&&e&&r.showWarning(e,{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(", ");""!=o&&n.setAttribute("srcset",{data:o,width:i},e)}}function MA(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))}class NA extends ur{static get pluginName(){return"ImageUpload"}static get requires(){return[BA,AA,yA]}}var zA=n(5150);Wi()(zA.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),zA.Z.locals;class LA extends $i{constructor(t,e={}){super(t);const n=this.bindTemplate;this.set("class",e.class||null),this.children=this.createCollection(),e.children&&e.children.forEach((t=>this.children.add(t))),this.set("_role",null),this.set("_ariaLabelledBy",null),e.labelView&&this.set({_role:"group",_ariaLabelledBy:e.labelView.id}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__row",n.to("class")],role:n.to("_role"),"aria-labelledby":n.to("_ariaLabelledBy")},children:this.children})}}var PA=n(9292);Wi()(PA.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),PA.Z.locals;class RA extends $i{constructor(t,e={}){super(t);const{insertButtonView:n,cancelButtonView:i}=this._createActionButtons(t);this.insertButtonView=n,this.cancelButtonView=i,this.set("imageURLInputValue",""),this.focusTracker=new Li,this.keystrokes=new Pi,this._focusables=new Ui,this._focusCycler=new ar({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.set("_integrations",new Ni);for(const[t,n]of Object.entries(e))"insertImageViaUrl"===t&&(n.fieldView.bind("value").to(this,"imageURLInputValue",(t=>t||"")),n.fieldView.on("input",(()=>{this.imageURLInputValue=n.fieldView.element.value.trim()}))),n.name=t,this._integrations.add(n);this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-insert-form"],tabindex:"-1"},children:[...this._integrations,new LA(t,{children:[this.insertButtonView,this.cancelButtonView],class:"ck-image-insert-form__action-row"})]})}render(){super.render(),o({view:this}),[...this._integrations,this.insertButtonView,this.cancelButtonView].forEach((t=>{this._focusables.add(t),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()}getIntegration(t){return this._integrations.find((e=>e.name===t))}_createActionButtons(t){const e=t.t,n=new Ao(t),i=new Ao(t);return n.set({label:e("Insert"),icon:iu.check,class:"ck-button-save",type:"submit",withText:!0,isEnabled:this.imageURLInputValue}),i.set({label:e("Cancel"),icon:iu.cancel,class:"ck-button-cancel",withText:!0}),n.bind("isEnabled").to(this,"imageURLInputValue",(t=>!!t)),n.delegate("execute").to(this,"submit"),i.delegate("execute").to(this,"cancel"),{insertButtonView:n,cancelButtonView:i}}focus(){this._focusCycler.focusFirst()}}function OA(t){const e=t.t,n=new Qo(t,xu);return n.set({label:e("Insert image via URL")}),n.fieldView.placeholder="https://example.com/image.png",n}class VA extends ur{static get pluginName(){return"ImageInsertUI"}init(){const t=this.editor,e=t=>this._createDropdownView(t);t.ui.componentFactory.add("insertImage",e),t.ui.componentFactory.add("imageInsert",e)}_createDropdownView(t){const e=this.editor,n=t.t,i=e.commands.get("uploadImage"),o=e.commands.get("insertImage");this.dropdownView=wu(t,i?fu:void 0);const r=this.dropdownView.buttonView,s=this.dropdownView.panelView;if(r.set({label:n("Insert image"),icon:iu.image,tooltip:!0}),s.extendTemplate({attributes:{class:"ck-image-insert__panel"}}),i){const t=this.dropdownView.buttonView;t.actionView=e.ui.componentFactory.create("uploadImage"),t.actionView.extendTemplate({attributes:{class:"ck ck-button ck-splitbutton__action"}})}return this._setUpDropdown(i||o)}_setUpDropdown(t){const e=this.editor,n=e.t,i=this.dropdownView,o=i.panelView,r=this.editor.plugins.get("ImageUtils"),s=e.commands.get("replaceImageSource");let a;function l(){e.editing.view.focus(),i.isOpen=!1}return i.bind("isEnabled").to(t),i.once("change:isOpen",(()=>{a=new RA(e.locale,function(t){const e=t.config.get("image.insert.integrations"),n=t.plugins.get("ImageInsertUI"),i={insertImageViaUrl:OA(t.locale)};if(!e)return i;if(e.find((t=>"openCKFinder"===t))&&t.ui.componentFactory.has("ckfinder")){const e=t.ui.componentFactory.create("ckfinder");e.set({withText:!0,class:"ck-image-insert__ck-finder-button"}),e.delegate("execute").to(n,"cancel"),i.openCKFinder=e}return e.reduce(((e,n)=>(i[n]?e[n]=i[n]:t.ui.componentFactory.has(n)&&(e[n]=t.ui.componentFactory.create(n)),e)),{})}(e)),a.delegate("submit","cancel").to(i),o.children.add(a)})),i.on("change:isOpen",(()=>{const t=e.model.document.selection.getSelectedElement(),o=a.insertButtonView,l=a.getIntegration("insertImageViaUrl");i.isOpen&&(r.isImage(t)?(a.imageURLInputValue=s.value,o.label=n("Update"),l.label=n("Update image URL")):(a.imageURLInputValue="",o.label=n("Insert"),l.label=n("Insert image via URL")))}),{priority:"low"}),this.delegate("cancel").to(i),i.on("submit",(()=>{l(),function(){const t=e.model.document.selection.getSelectedElement();r.isImage(t)?e.execute("replaceImageSource",{source:a.imageURLInputValue}):e.execute("insertImage",{source:a.imageURLInputValue})}()})),i.on("cancel",(()=>{l()})),i}}class FA extends ur{static get pluginName(){return"ImageInsertViaUrl"}static get requires(){return[VA]}}class jA extends gr{refresh(){const t=this.editor,e=t.plugins.get("ImageUtils").getClosestSelectedImageElement(t.model.document.selection);this.isEnabled=!!e,e&&e.hasAttribute("width")?this.value={width:e.getAttribute("width"),height:null}:this.value=null}execute(t){const e=this.editor,n=e.model,i=e.plugins.get("ImageUtils").getClosestSelectedImageElement(n.document.selection);this.value={width:t.width,height:null},i&&n.change((e=>{e.setAttribute("width",t.width,i)}))}}class HA extends ur{static get requires(){return[mf]}static get pluginName(){return"ImageResizeEditing"}constructor(t){super(t),t.config.define("image",{resizeUnit:"%",resizeOptions:[{name:"resizeImage:original",value:null,icon:"original"},{name:"resizeImage:25",value:"25",icon:"small"},{name:"resizeImage:50",value:"50",icon:"medium"},{name:"resizeImage:75",value:"75",icon:"large"}]})}init(){const t=this.editor,e=new jA(t);this._registerSchema(),this._registerConverters("imageBlock"),this._registerConverters("imageInline"),t.commands.add("resizeImage",e),t.commands.add("imageResize",e)}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:"width"}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:"width"})}_registerConverters(t){const e=this.editor;e.conversion.for("downcast").add((e=>e.on(`attribute:width:${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("upcast").attributeToAttribute({view:{name:"imageBlock"===t?"figure":"img",styles:{width:/.+/}},model:{key:"width",value:t=>t.getStyle("width")}})}}const UA={small:iu.objectSizeSmall,medium:iu.objectSizeMedium,large:iu.objectSizeLarge,original:iu.objectSizeFull};class GA extends ur{static get requires(){return[HA]}static get pluginName(){return"ImageResizeButtons"}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,r=i?i+this._resizeUnit:null;e.ui.componentFactory.add(n,(n=>{const i=new Ao(n),s=e.commands.get("resizeImage"),a=this._getOptionLabelValue(t,!0);if(!UA[o])throw new A("imageresizebuttons-missing-icon",e,t);return i.set({label:a,icon:UA[o],tooltip:a,isToggleable:!0}),i.bind("isEnabled").to(this),i.bind("isOn").to(s,"value",WA(r)),this.listenTo(i,"execute",(()=>{e.execute("resizeImage",{width:r})})),i}))}_registerImageResizeDropdown(t){const e=this.editor,n=e.t,i=t.find((t=>!t.value)),o=o=>{const r=e.commands.get("resizeImage"),s=wu(o,sr),a=s.buttonView,l=n("Resize image");return a.set({tooltip:l,commandValue:i.value,icon:UA.medium,isToggleable:!0,label:this._getOptionLabelValue(i),withText:!0,class:"ck-resize-image-button",ariaLabel:l,ariaLabelledBy:void 0}),a.bind("label").to(r,"value",(t=>t&&t.width?t.width:this._getOptionLabelValue(i))),s.bind("isEnabled").to(this),_u(s,(()=>this._getResizeDropdownListItemDefinitions(t,r)),{ariaLabel:n("Image resize list"),role:"menu"}),this.listenTo(s,"execute",(t=>{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?t.value?n("Resize image to %0",t.value+this._resizeUnit):n("Resize image to the original size"):t.value?t.value+this._resizeUnit:n("Original")}_getResizeDropdownListItemDefinitions(t,e){const n=new Ni;return t.map((t=>{const i=t.value?t.value+this._resizeUnit:null,o={type:"button",model:new Nm({commandName:"resizeImage",commandValue:i,label:this._getOptionLabelValue(t),role:"menuitemradio",withText:!0,icon:null})};o.model.bind("isOn").to(e,"value",WA(i)),n.add(o)})),n}}function WA(t){return e=>null===t&&e===t||null!==e&&e.width===t}const qA=/(image|image-inline)/,$A="image_resized";class KA extends ur{static get requires(){return[Wp]}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;e.addObserver(Zw),this.listenTo(e.document,"imageLoaded",((n,i)=>{if(!i.target.matches("figure.image.ck-widget > img,figure.image.ck-widget > picture > img,figure.image.ck-widget > a > img,figure.image.ck-widget > a > picture > img,span.image-inline.ck-widget > img,span.image-inline.ck-widget > picture > img"))return;const o=t.editing.view.domConverter,r=o.domToView(i.target).findAncestor({classes:qA});let s=this.editor.plugins.get(Wp).getResizerByViewElement(r);if(s)return void s.redraw();const a=t.editing.mapper,l=a.toModelElement(r);s=t.plugins.get(Wp).attachTo({unit:t.config.get("image.resizeUnit"),modelElement:l,viewElement:r,editor:t,getHandleHost:t=>t.querySelector("img"),getResizeHost:()=>o.mapViewToDom(a.toViewElement(l.parent)),isCentered(){const t=l.getAttribute("imageStyle");return!t||"block"==t||"alignCenter"==t},onCommit(n){e.change((t=>{t.removeClass($A,r)})),t.execute("resizeImage",{width:n})}}),s.on("updateSize",(()=>{r.hasClass($A)||e.change((t=>{t.addClass($A,r)}))})),s.bind("isEnabled").to(this)}))}}var YA=n(1043);Wi()(YA.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),YA.Z.locals;class ZA extends gr{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;let r=i.getClosestSelectedImageElement(n.document.selection);o&&this.shouldConvertImageType(o,r)&&(this.editor.execute(i.isBlockImage(r)?"imageTypeInline":"imageTypeBlock"),r=i.getClosestSelectedImageElement(n.document.selection)),!o||this._styles.get(o).isDefault?e.removeAttribute("imageStyle",r):e.setAttribute("imageStyle",o,r)}))}shouldConvertImageType(t,e){return!this._styles.get(t).modelElements.includes(e.name)}}const{objectFullWidth:QA,objectInline:JA,objectLeft:XA,objectRight:tC,objectCenter:eC,objectBlockLeft:nC,objectBlockRight:iC}=iu,oC={get inline(){return{name:"inline",title:"In line",icon:JA,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:XA,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:nC,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:eC,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:tC,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:iC,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:eC,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:tC,modelElements:["imageBlock"],className:"image-style-side"}}},rC={full:QA,left:nC,right:iC,center:eC,inlineLeft:XA,inlineRight:tC,inline:JA},sC=[{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 aC(t){C("image-style-configuration-definition-invalid",t)}const lC={normalizeStyles:function(t){const e=(t.configuredStyles.options||[]).map((t=>function(t){return t="string"==typeof t?oC[t]?{...oC[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}(oC[t.name],t),"string"==typeof t.icon&&(t.icon=rC[t.icon]||t.icon),t}(t))).filter((e=>function(t,{isBlockPluginLoaded:e,isInlinePluginLoaded:n}){const{modelElements:i,name:o}=t;if(!(i&&i.length&&o))return aC({style:t}),!1;{const o=[e?"imageBlock":null,n?"imageInline":null];if(!i.some((t=>o.includes(t))))return C("image-style-missing-dependency",{style:t,missingPlugins:i.map((t=>"imageBlock"===t?"ImageBlockEditing":"ImageInlineEditing"))}),!1}return!0}(e,t)));return e},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")?[...sC]:[]},warnInvalidStyle:aC,DEFAULT_OPTIONS:oC,DEFAULT_ICONS:rC,DEFAULT_DROPDOWN_DEFINITIONS:sC};function cC(t,e){for(const n of e)if(n.name===t)return n}class dC extends ur{static get pluginName(){return"ImageStyleEditing"}static get requires(){return[mf]}init(){const{normalizeStyles:t,getDefaultStylesConfiguration:e}=lC,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 ZA(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=cC(e.attributeNewValue,r),o=cC(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=zi(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(mf),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 hC=n(4622);Wi()(hC.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),hC.Z.locals;class uC extends ur{static get requires(){return[dC]}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=mC(t.get("ImageStyleEditing").normalizedStyles,this.localizedDefaultStylesTitles);for(const t of n)this._createButton(t);const i=mC([...e.filter(R),...lC.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,l=s.filter((t=>e.find((({name:e})=>gC(e)===t)))).map((t=>{const e=n.create(t);return t===r&&(o=e),e}));s.length!==l.length&&lC.warnInvalidStyle({dropdown:t});const c=wu(i,fu),d=c.buttonView,h=d.arrowView;return Au(c,l,{enableActiveItemFocusOnDropdownOpen:!0}),d.set({label:pC(a,o.label),class:null,tooltip:!0}),h.unbind("label"),h.set({label:a}),d.bind("icon").toMany(l,"isOn",((...t)=>{const e=t.findIndex(os);return e<0?o.icon:l[e].icon})),d.bind("label").toMany(l,"isOn",((...t)=>{const e=t.findIndex(os);return pC(a,e<0?o.label:l[e].label)})),d.bind("isOn").toMany(l,"isOn",((...t)=>t.some(os))),d.bind("class").toMany(l,"isOn",((...t)=>t.some(os)?"ck-splitbutton_flatten":void 0)),d.on("execute",(()=>{l.some((({isOn:t})=>t))?c.isOpen=!c.isOpen:o.fire("execute")})),c.bind("isEnabled").toMany(l,"isEnabled",((...t)=>t.some(os))),this.listenTo(c,"execute",(()=>{this.editor.editing.view.focus()})),c}))}_createButton(t){const e=t.name;this.editor.ui.componentFactory.add(gC(e),(n=>{const i=this.editor.commands.get("imageStyle"),o=new Ao(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 mC(t,e){for(const n of t)e[n.title]&&(n.title=e[n.title]);return t}function gC(t){return`imageStyle:${t}`}function pC(t,e){return(t?t+": ":"")+e}class fC extends ur{static get pluginName(){return"IndentEditing"}init(){const t=this.editor;t.commands.add("indent",new fr(t)),t.commands.add("outdent",new fr(t))}}const bC=' ',kC=' ';class wC extends ur{static get pluginName(){return"IndentUI"}init(){const t=this.editor,e=t.locale,n=t.t,i="ltr"==e.uiLanguageDirection?bC:kC,o="ltr"==e.uiLanguageDirection?kC:bC;this._defineButton("indent",n("Increase indent"),i),this._defineButton("outdent",n("Decrease indent"),o)}_defineButton(t,e,n){const i=this.editor;i.ui.componentFactory.add(t,(o=>{const r=i.commands.get(t),s=new Ao(o);return s.set({label:e,icon:n,tooltip:!0}),s.bind("isEnabled").to(r,"isEnabled"),this.listenTo(s,"execute",(()=>{i.execute(t),i.editing.view.focus()})),s}))}}class AC extends gr{constructor(t,e){super(t),this._indentBehavior=e}refresh(){const t=this.editor.model,e=zi(t.document.selection.getSelectedBlocks());e&&t.schema.checkAttribute(e,"blockIndent")?this.isEnabled=this._indentBehavior.checkEnabled(e.getAttribute("blockIndent")):this.isEnabled=!1}execute(){const t=this.editor.model,e=function(t){const e=t.document.selection,n=t.schema;return Array.from(e.getSelectedBlocks()).filter((t=>n.checkAttribute(t,"blockIndent")))}(t);t.change((t=>{for(const n of e){const e=n.getAttribute("blockIndent"),i=this._indentBehavior.getNextIndent(e);i?t.setAttribute("blockIndent",i,n):t.removeAttribute("blockIndent",n)}}))}}class CC{constructor(t){this.isForward="forward"===t.direction,this.offset=t.offset,this.unit=t.unit}checkEnabled(t){const e=parseFloat(t||"0");return this.isForward||e>0}getNextIndent(t){const e=parseFloat(t||"0");if(t&&!t.endsWith(this.unit))return this.isForward?this.offset+this.unit:void 0;const n=e+(this.isForward?this.offset:-this.offset);return n>0?n+this.unit:void 0}}class _C{constructor(t){this.isForward="forward"===t.direction,this.classes=t.classes}checkEnabled(t){const e=this.classes.indexOf(t);return this.isForward?e=0}getNextIndent(t){const e=this.classes.indexOf(t),n=this.isForward?1:-1;return this.classes[e+n]}}const vC=["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"],yC="italic";class xC extends ur{static get pluginName(){return"ItalicEditing"}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:yC}),t.model.schema.setAttributeProperties(yC,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:yC,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),t.commands.add(yC,new ib(t,yC)),t.keystrokes.set("CTRL+I",yC)}}const EC="italic";class DC extends ur{static get pluginName(){return"ItalicUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add(EC,(n=>{const i=t.commands.get(EC),o=new Ao(n);return o.set({label:e("Italic"),icon:' ',keystroke:"CTRL+I",tooltip:!0,isToggleable:!0}),o.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(o,"execute",(()=>{t.execute(EC),t.editing.view.focus()})),o}))}}class SC{constructor(){this._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=Ri(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)}}}))}}}class TC extends gr{constructor(){super(...arguments),this.manualDecorators=new Ni,this.automaticDecorators=new SC}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()||zi(e.getSelectedBlocks());Uf(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=IC(i);let l=Zg(s,"linkHref",i.getAttribute("linkHref"),n);i.getAttribute("linkHref")===a&&(l=this._updateLinkContent(n,e,l,t)),e.setAttribute("linkHref",t,l),o.forEach((t=>{e.setAttribute(t,!0,l)})),r.forEach((t=>{e.removeAttribute(t,l)})),e.setSelection(e.createPositionAfter(l.end.nodeBefore))}else if(""!==t){const r=Ri(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 l=a.slice();for(const t of s)this._isRangeToUpdate(t,a)&&l.push(t);for(const s of l){let a=s;if(1===l.length){const o=IC(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 Uf(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 IC(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 BC extends gr{refresh(){const t=this.editor.model,e=t.document.selection,n=e.getSelectedElement();Uf(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?[Zg(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 MC extends(G()){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 NC=n(399);Wi()(NC.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),NC.Z.locals;const zC="automatic",LC=/^(https?:)?\/\//;class PC extends ur{static get pluginName(){return"LinkEditing"}static get requires(){return[Lg,_g,bg]}constructor(t){super(t),t.config.define("link",{addTargetToExternalLinks:!1})}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:"linkHref"}),t.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:jf}),t.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(t,e)=>jf(Hf(t),e)}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:t=>t.getAttribute("href")}}),t.commands.add("link",new TC(t)),t.commands.add("unlink",new BC(t));const e=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${Lf(n)}`});e.push(t)}return e}(t.config.get("link.decorators")));this._enableAutomaticDecorators(e.filter((t=>t.mode===zC))),this._enableManualDecorators(e.filter((t=>"manual"===t.mode))),t.plugins.get(Lg).registerAttribute("linkHref"),Jg(t,"linkHref","a","ck-link_selected"),this._enableLinkOpen(),this._enableInsertContentSelectionAttributesFixer(),this._enableClickingAfterLink(),this._enableTypingOverLink(),this._handleDeleteContentAfterLink(),this._enableClipboardIntegration()}_enableAutomaticDecorators(t){const e=this.editor,n=e.commands.get("link").automaticDecorators;e.config.get("link.addTargetToExternalLinks")&&n.add({id:"linkIsExternal",mode:zC,callback:t=>!!t&&LC.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 MC(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(!(l.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(),qf(i))}),{context:"$capture"}),this.listenTo(e,"keydown",((e,n)=>{const i=t.commands.get("link").value;i&&n.keyCode===vi.enter&&n.altKey&&(e.stop(),qf(i))}))}_enableInsertContentSelectionAttributesFixer(){const t=this.editor.model,e=t.document.selection;this.listenTo(t,"insertContent",(()=>{const n=e.anchor.nodeBefore,i=e.anchor.nodeAfter;e.hasAttribute("linkHref")&&n&&n.hasAttribute("linkHref")&&(i&&i.hasAttribute("linkHref")||t.change((e=>{RC(e,VC(t.schema))})))}),{priority:"low"})}_enableClickingAfterLink(){const t=this.editor,e=t.model;t.editing.view.addObserver(dh);let n=!1;this.listenTo(t.editing.view.document,"mousedown",(()=>{n=!0})),this.listenTo(t.editing.view.document,"selectionChange",(()=>{if(!n)return;n=!1;const t=e.document.selection;if(!t.isCollapsed)return;if(!t.hasAttribute("linkHref"))return;const i=t.getFirstPosition(),o=Zg(i,"linkHref",t.getAttribute("linkHref"),e);(i.isTouching(o.start)||i.isTouching(o.end))&&e.change((t=>{RC(t,VC(e.schema))}))}))}_enableTypingOverLink(){const t=this.editor,e=t.editing.view;let n=null,i=!1;this.listenTo(e.document,"delete",(()=>{i=!0}),{priority:"high"}),this.listenTo(t.model,"deleteContent",(()=>{const e=t.model.document.selection;e.isCollapsed||(i?i=!1:OC(t)&&function(t){const e=t.document.selection,n=e.getFirstPosition(),i=e.getLastPosition(),o=n.nodeAfter;if(!o)return!1;if(!o.is("$text"))return!1;if(!o.hasAttribute("linkHref"))return!1;return o===(i.textNode||i.nodeBefore)||Zg(n,"linkHref",o.getAttribute("linkHref"),t).containsRange(t.createRange(n,i),!0)}(t.model)&&(n=e.getAttributes()))}),{priority:"high"}),this.listenTo(t.model,"insertContent",((e,[o])=>{i=!1,OC(t)&&n&&(t.model.change((t=>{for(const[e,i]of n)t.setAttribute(e,i,o)})),n=null)}),{priority:"high"})}_handleDeleteContentAfterLink(){const t=this.editor,e=t.model,n=e.document.selection,i=t.editing.view;let o=!1,r=!1;this.listenTo(i.document,"delete",((t,e)=>{r="backward"===e.direction}),{priority:"high"}),this.listenTo(e,"deleteContent",(()=>{o=!1;const t=n.getFirstPosition(),i=n.getAttribute("linkHref");if(!i)return;const r=Zg(t,"linkHref",i,e);o=r.containsPosition(t)||r.end.isEqual(t)}),{priority:"high"}),this.listenTo(e,"deleteContent",(()=>{r&&(r=!1,o||t.model.enqueueChange((t=>{RC(t,VC(e.schema))})))}),{priority:"low"})}_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=Gf(i.getAttribute("linkHref"),n);t.setAttribute("linkHref",e,i)}}))}))}}function RC(t,e){t.removeSelectionAttribute("linkHref");for(const n of e)t.removeSelectionAttribute(n)}function OC(t){return t.model.change((t=>t.batch)).isTyping}function VC(t){return t.getDefinition("$text").allowAttributes.filter((t=>t.startsWith("link")))}var FC=n(4827);Wi()(FC.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),FC.Z.locals;class jC extends $i{constructor(t,e){super(t),this.focusTracker=new Li,this.keystrokes=new Pi,this._focusables=new Ui;const n=t.t;this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(n("Save"),iu.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(n("Cancel"),iu.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(e),this.children=this._createFormChildren(e.manualDecorators),this._focusCycler=new ar({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const i=["ck","ck-link-form","ck-responsive-form"];e.manualDecorators.length&&i.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:i,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce(((t,e)=>(t[e.name]=e.isOn,t)),{})}render(){super.render(),o({view:this}),[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].forEach((t=>{this._focusables.add(t),this.focusTracker.add(t.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createUrlInput(){const t=this.locale.t,e=new Qo(this.locale,xu);return e.label=t("Link URL"),e}_createButton(t,e,n,i){const o=new Ao(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 _o(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 $i;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}}var HC=n(9465);Wi()(HC.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),HC.Z.locals;class UC extends $i{constructor(t){super(t),this.focusTracker=new Li,this.keystrokes=new Pi,this._focusables=new Ui;const e=t.t;this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(e("Unlink"),' ',"unlink"),this.editButtonView=this._createButton(e("Edit link"),iu.pencil,"edit"),this.set("href",void 0),this._focusCycler=new ar({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 Ao(this.locale);return i.set({label:t,icon:e,tooltip:!0}),i.delegate("execute").to(this,n),i}_createPreviewButton(){const t=new Ao(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&&Hf(t))),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 GC=' ',WC="link-ui";class qC extends ur{constructor(){super(...arguments),this.actionsView=null,this.formView=null}static get requires(){return[Om]}static get pluginName(){return"LinkUI"}init(){const t=this.editor;t.editing.view.addObserver(ch),this._balloon=t.plugins.get(Om),this._createToolbarLinkButton(),this._enableBalloonActivators(),t.conversion.for("editingDowncast").markerToHighlight({model:WC,view:{classes:["ck-fake-link-selection"]}}),t.conversion.for("editingDowncast").markerToElement({model:WC,view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}})}destroy(){super.destroy(),this.formView&&this.formView.destroy(),this.actionsView&&this.actionsView.destroy()}_createViews(){this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._enableUserBalloonInteractions()}_createActionsView(){const t=this.editor,e=new UC(t.locale),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(Ff,((t,e)=>{this._addFormView(),e()})),e}_createFormView(){const t=this.editor,n=t.commands.get("link"),i=t.config.get("link.defaultProtocol"),o=new(e(jC))(t.locale,n);return o.urlInputView.fieldView.bind("value").to(n,"value"),o.urlInputView.bind("isEnabled").to(n,"isEnabled"),o.saveButtonView.bind("isEnabled").to(n),this.listenTo(o,"submit",(()=>{const{value:e}=o.urlInputView.fieldView.element,n=Gf(e,i);t.execute("link",n,o.getDecoratorSwitchesState()),this._closeFormView()})),this.listenTo(o,"cancel",(()=>{this._closeFormView()})),o.keystrokes.set("Esc",((t,e)=>{this._closeFormView(),e()})),o}_createToolbarLinkButton(){const t=this.editor,e=t.commands.get("link"),n=t.t;t.ui.componentFactory.add("link",(t=>{const i=new Ao(t);return i.isEnabled=!0,i.label=n("Link"),i.icon=GC,i.keystroke=Ff,i.tooltip=!0,i.isToggleable=!0,i.bind("isEnabled").to(e,"isEnabled"),i.bind("isOn").to(e,"value",(t=>!!t)),this.listenTo(i,"execute",(()=>this._showUI(!0))),i}))}_enableBalloonActivators(){const t=this.editor,e=t.editing.view.document;this.listenTo(e,"click",(()=>{this._getSelectedLinkElement()&&this._showUI()})),t.keystrokes.set(Ff,((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())})),t({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this.actionsView||this._createViews(),this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;const t=this.editor.commands.get("link");this.formView.disableCssTransitions(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions(),this.formView.urlInputView.fieldView.element.value=t.value||""}_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._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(WC)){const e=Array.from(this.editor.editing.mapper.markerNameToElements(WC)),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&&fp(n))return $C(e.getFirstPosition());{const n=e.getFirstRange().getTrimmed(),i=$C(n.start),o=$C(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(WC))e.updateMarker(WC,{range:n});else if(n.start.isAtEnd){const i=n.start.getLastMatchingPosition((({item:e})=>!t.schema.isContent(e)),{boundaries:n});e.addMarker(WC,{usingOperation:!1,affectsData:!1,range:e.createRange(i,n.end)})}else e.addMarker(WC,{usingOperation:!1,affectsData:!1,range:n})}))}_hideFakeVisualSelection(){const t=this.editor.model;t.markers.has(WC)&&t.change((t=>{t.removeMarker(WC)}))}}function $C(t){return t.getAncestors().find((t=>{return(e=t).is("attributeElement")&&!!e.getCustomProperty("link");var e}))||null}class KC extends ur{static get requires(){return["ImageEditing","ImageUtils",PC]}static get pluginName(){return"LinkImageEditing"}init(){const t=this.editor,e=t.model.schema;t.plugins.has("ImageBlockEditing")&&e.extend("imageBlock",{allowAttributes:["linkHref"]}),t.conversion.for("upcast").add(function(t){const e=t.plugins.has("ImageInlineEditing"),n=t.plugins.get("ImageUtils");return t=>{t.on("element:a",((t,i,o)=>{const r=i.viewItem,s=n.findViewImgElement(r);if(!s)return;const a=s.findAncestor((t=>n.isBlockImageView(t)));if(e&&!a)return;if(!o.consumable.consume(r,{attributes:["href"]}))return;const l=r.getAttribute("href");if(!l)return;let c=i.modelCursor.parent;if(!c.is("element","imageBlock")){const t=o.convertItem(s,i.modelCursor);i.modelRange=t.modelRange,i.modelCursor=t.modelCursor,c=i.modelCursor.nodeBefore}c&&c.is("element","imageBlock")&&o.writer.setAttribute("linkHref",l,c)}),{priority:"high"})}}(t)),t.conversion.for("downcast").add(function(t){const e=t.plugins.get("ImageUtils");return t=>{t.on("attribute:linkHref:imageBlock",((t,n,i)=>{if(!i.consumable.consume(n.item,t.name))return;const o=i.mapper.toViewElement(n.item),r=i.writer,s=Array.from(o.getChildren()).find((t=>t.is("element","a"))),a=e.findViewImgElement(o),l=a.parent.is("element","picture")?a.parent:a;if(s)n.attributeNewValue?r.setAttribute("href",n.attributeNewValue,s):(r.move(r.createRangeOn(l),r.createPositionAt(o,0)),r.remove(s));else{const t=r.createContainerElement("a",{href:n.attributeNewValue});r.insert(r.createPositionAt(o,0),t),r.move(r.createRangeOn(l),r.createPositionAt(t,0))}}),{priority:"high"})}}(t)),this._enableAutomaticDecorators(),this._enableManualDecorators()}_enableAutomaticDecorators(){const t=this.editor,e=t.commands.get("link").automaticDecorators;e.length&&t.conversion.for("downcast").add(e.getDispatcherForLinkedImage())}_enableManualDecorators(){const t=this.editor,e=t.commands.get("link");for(const n of e.manualDecorators)t.plugins.has("ImageBlockEditing")&&t.model.schema.extend("imageBlock",{allowAttributes:n.id}),t.plugins.has("ImageInlineEditing")&&t.model.schema.extend("imageInline",{allowAttributes:n.id}),t.conversion.for("downcast").add(YC(n)),t.conversion.for("upcast").add(ZC(t,n))}}function YC(t){return e=>{e.on(`attribute:${t.id}:imageBlock`,((e,n,i)=>{const o=i.mapper.toViewElement(n.item),r=Array.from(o.getChildren()).find((t=>t.is("element","a")));if(r){for(const[e,n]of Ri(t.attributes))i.writer.setAttribute(e,n,r);t.classes&&i.writer.addClass(t.classes,r);for(const e in t.styles)i.writer.setStyle(e,t.styles[e],r)}}))}}function ZC(t,e){const n=t.plugins.has("ImageInlineEditing"),i=t.plugins.get("ImageUtils");return t=>{t.on("element:a",((t,o,r)=>{const s=o.viewItem,a=i.findViewImgElement(s);if(!a)return;const l=a.findAncestor((t=>i.isBlockImageView(t)));if(n&&!l)return;const c=new Br(e._createPattern()).match(s);if(!c)return;if(!r.consumable.consume(s,c.match))return;const d=o.modelCursor.nodeBefore||o.modelCursor.parent;r.writer.setAttribute(e.id,!0,d)}),{priority:"high"})}}class QC extends ur{static get requires(){return[PC,qC,"ImageBlockEditing"]}static get pluginName(){return"LinkImageUI"}init(){const t=this.editor,e=t.editing.view.document;this.listenTo(e,"click",((e,n)=>{this._isSelectedLinkedImage(t.model.document.selection)&&(n.preventDefault(),e.stop())}),{priority:"high"}),this._createToolbarLinkImageButton()}_createToolbarLinkImageButton(){const t=this.editor,e=t.t;t.ui.componentFactory.add("linkImage",(n=>{const i=new Ao(n),o=t.plugins.get("LinkUI"),r=t.commands.get("link");return i.set({isEnabled:!0,label:e("Link image"),icon:GC,keystroke:Ff,tooltip:!0,isToggleable:!0}),i.bind("isEnabled").to(r,"isEnabled"),i.bind("isOn").to(r,"value",(t=>!!t)),this.listenTo(i,"execute",(()=>{this._isSelectedLinkedImage(t.model.document.selection)?o._addActionsView():o._showUI(!0)})),i}))}_isSelectedLinkedImage(t){const e=t.getSelectedElement();return this.editor.plugins.get("ImageUtils").isImage(e)&&e.hasAttribute("linkHref")}}var JC=n(3858);Wi()(JC.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),JC.Z.locals;class XC extends gr{constructor(t,e){super(t),this.type=e}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,n=e.document,i=Array.from(n.selection.getSelectedBlocks()).filter((t=>e_(t,e.schema))),o=void 0!==t.forceValue?!t.forceValue:this.value;e.change((t=>{if(o){let e=i[i.length-1].nextSibling,n=Number.POSITIVE_INFINITY,o=[];for(;e&&"listItem"==e.name&&0!==e.getAttribute("listIndent");){const t=e.getAttribute("listIndent");t=n;)r>o.getAttribute("listIndent")&&(r=o.getAttribute("listIndent")),o.getAttribute("listIndent")==r&&t[e?"unshift":"push"](o),o=o[e?"previousSibling":"nextSibling"]}}function e_(t,e){return e.checkChild(t.parent,"listItem")&&!e.isObject(t)}class n_ extends gr{constructor(t,e){super(t),this._indentBy="forward"==e?1:-1}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model,e=t.document;let n=Array.from(e.selection.getSelectedBlocks());t.change((t=>{const e=n[n.length-1];let i=e.nextSibling;for(;i&&"listItem"==i.name&&i.getAttribute("listIndent")>e.getAttribute("listIndent");)n.push(i),i=i.nextSibling;this._indentBy<0&&(n=n.reverse());for(const e of n){const n=e.getAttribute("listIndent")+this._indentBy;n<0?t.rename(e,"paragraph"):t.setAttribute("listIndent",n,e)}this.fire("_executeCleanup",n)}))}_checkEnabled(){const t=zi(this.editor.model.document.selection.getSelectedBlocks());if(!t||!t.is("element","listItem"))return!1;if(this._indentBy>0){const e=t.getAttribute("listIndent"),n=t.getAttribute("listType");let i=t.previousSibling;for(;i&&i.is("element","listItem")&&i.getAttribute("listIndent")>=e;){if(i.getAttribute("listIndent")==e)return i.getAttribute("listType")==n;i=i.previousSibling}return!1}return!0}}function i_(t,e){const n=e.mapper,i=e.writer,o="numbered"==t.getAttribute("listType")?"ol":"ul",r=function(t){const e=t.createContainerElement("li");return e.getFillerOffset=p_,e}(i),s=i.createContainerElement(o,null);return i.insert(i.createPositionAt(s,0),r),n.bindElements(t,r),r}function o_(t,e,n,i){const o=e.parent,r=n.mapper,s=n.writer;let a=r.toViewPosition(i.createPositionBefore(t));const l=a_(t.previousSibling,{sameIndent:!0,smallerIndent:!0,listIndent:t.getAttribute("listIndent")}),c=t.previousSibling;if(l&&l.getAttribute("listIndent")==t.getAttribute("listIndent")){const t=r.toViewElement(l);a=s.breakContainer(s.createPositionAfter(t))}else if(c&&"listItem"==c.name){a=r.toViewPosition(i.createPositionAt(c,"end"));const t=r.findMappedViewAncestor(a),e=c_(t);a=e?s.createPositionBefore(e):s.createPositionAt(t,"end")}else a=r.toViewPosition(i.createPositionBefore(t));if(a=s_(a),s.insert(a,o),c&&"listItem"==c.name){const t=r.toViewElement(c),n=s.createRange(s.createPositionAt(t,0),a).getWalker({ignoreElementEnd:!0});for(const t of n)if(t.item.is("element","li")){const i=s.breakContainer(s.createPositionBefore(t.item)),o=t.item.parent,r=s.createPositionAt(e,"end");r_(s,r.nodeBefore,r.nodeAfter),s.move(s.createRangeOn(o),r),n._position=i}}else{const n=o.nextSibling;if(n&&(n.is("element","ul")||n.is("element","ol"))){let i=null;for(const e of n.getChildren()){const n=r.toModelElement(e);if(!(n&&n.getAttribute("listIndent")>t.getAttribute("listIndent")))break;i=e}i&&(s.breakContainer(s.createPositionAfter(i)),s.move(s.createRangeOn(i.parent),s.createPositionAt(e,"end")))}}r_(s,o,o.nextSibling),r_(s,o.previousSibling,o)}function r_(t,e,n){return!e||!n||"ul"!=e.name&&"ol"!=e.name||e.name!=n.name||e.getAttribute("class")!==n.getAttribute("class")?null:t.mergeContainers(t.createPositionAfter(e))}function s_(t){return t.getLastMatchingPosition((t=>t.item.is("uiElement")))}function a_(t,e){const n=!!e.sameIndent,i=!!e.smallerIndent,o=e.listIndent;let r=t;for(;r&&"listItem"==r.name;){const t=r.getAttribute("listIndent");if(n&&o==t||i&&o>t)return r;r="forward"===e.direction?r.nextSibling:r.previousSibling}return null}function l_(t,e,n,i){t.ui.componentFactory.add(e,(o=>{const r=t.commands.get(e),s=new Ao(o);return s.set({label:n,icon:i,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.on("execute",(()=>{t.execute(e),t.editing.view.focus()})),s}))}function c_(t){for(const e of t.getChildren())if("ul"==e.name||"ol"==e.name)return e;return null}function d_(t,e){const n=[],i=t.parent,o={ignoreElementEnd:!1,startPosition:t,shallow:!0,direction:e},r=i.getAttribute("listIndent"),s=[...new bl(o)].filter((t=>t.item.is("element"))).map((t=>t.item));for(const t of s){if(!t.is("element","listItem"))break;if(t.getAttribute("listIndent")r)){if(t.getAttribute("listType")!==i.getAttribute("listType"))break;if(t.getAttribute("listStyle")!==i.getAttribute("listStyle"))break;if(t.getAttribute("listReversed")!==i.getAttribute("listReversed"))break;if(t.getAttribute("listStart")!==i.getAttribute("listStart"))break;"backward"===e?n.unshift(t):n.push(t)}}return n}function h_(t){let e=[...t.document.selection.getSelectedBlocks()].filter((t=>t.is("element","listItem"))).map((e=>{const n=t.change((t=>t.createPositionAt(e,0)));return[...d_(n,"backward"),...d_(n,"forward")]})).flat();return e=[...new Set(e)],e}const u_=["disc","circle","square"],m_=["decimal","decimal-leading-zero","lower-roman","upper-roman","lower-latin","upper-latin"];function g_(t){return u_.includes(t)?"bulleted":m_.includes(t)?"numbered":null}function p_(){const t=!this.isEmpty&&("ul"==this.getChild(0).name||"ol"==this.getChild(0).name);return this.isEmpty||t?0:Cs.call(this)}class f_ extends ur{static get pluginName(){return"ListUtils"}getListTypeFromListStyleType(t){return g_(t)}getSelectedListItems(t){return h_(t)}getSiblingNodes(t,e){return d_(t,e)}}function b_(t){return(e,n,i)=>{const o=i.consumable;if(!o.test(n.item,"insert")||!o.test(n.item,"attribute:listType")||!o.test(n.item,"attribute:listIndent"))return;o.consume(n.item,"insert"),o.consume(n.item,"attribute:listType"),o.consume(n.item,"attribute:listIndent");const r=n.item;o_(r,i_(r,i),i,t)}}const k_=(t,e,n)=>{if(!n.consumable.test(e.item,t.name))return;const i=n.mapper.toViewElement(e.item),o=n.writer;o.breakContainer(o.createPositionBefore(i)),o.breakContainer(o.createPositionAfter(i));const r=i.parent,s="numbered"==e.attributeNewValue?"ol":"ul";o.rename(s,r)},w_=(t,e,n)=>{n.consumable.consume(e.item,t.name);const i=n.mapper.toViewElement(e.item).parent,o=n.writer;r_(o,i,i.nextSibling),r_(o,i.previousSibling,i)},A_=(t,e,n)=>{if(n.consumable.test(e.item,t.name)&&"listItem"!=e.item.name){let t=n.mapper.toViewPosition(e.range.start);const i=n.writer,o=[];for(;("ul"==t.parent.name||"ol"==t.parent.name)&&(t=i.breakContainer(t),"li"==t.parent.name);){const e=t,n=i.createPositionAt(t.parent,"end");if(!e.isEqual(n)){const t=i.remove(i.createRange(e,n));o.push(t)}t=i.createPositionAfter(t.parent)}if(o.length>0){for(let e=0;e0){const e=r_(i,n,n.nextSibling);e&&e.parent==n&&t.offset--}}r_(i,t.nodeBefore,t.nodeAfter)}}},C_=(t,e,n)=>{const i=n.mapper.toViewPosition(e.position),o=i.nodeBefore,r=i.nodeAfter;r_(n.writer,o,r)},__=(t,e,n)=>{if(n.consumable.consume(e.viewItem,{name:!0})){const t=n.writer,i=t.createElement("listItem"),o=function(t){let e=0,n=t.parent;for(;n;){if(n.is("element","li"))e++;else{const t=n.previousSibling;t&&t.is("element","li")&&e++}n=n.parent}return e}(e.viewItem);t.setAttribute("listIndent",o,i);const r=e.viewItem.parent&&"ol"==e.viewItem.parent.name?"numbered":"bulleted";if(t.setAttribute("listType",r,i),!n.safeInsert(i,e.modelCursor))return;const s=function(t,e,n){const{writer:i,schema:o}=n;let r=i.createPositionAfter(t);for(const s of e)if("ul"==s.name||"ol"==s.name)r=n.convertItem(s,r).modelCursor;else{const e=n.convertItem(s,i.createPositionAt(t,"end")),a=e.modelRange.start.nodeAfter;a&&a.is("element")&&!o.checkChild(t,a.name)&&(t=e.modelCursor.parent.is("element","listItem")?e.modelCursor.parent:D_(e.modelCursor),r=i.createPositionAfter(t))}return r}(i,e.viewItem.getChildren(),n);e.modelRange=t.createRange(e.modelCursor,s),n.updateConversionResult(i,e)}},v_=(t,e,n)=>{if(n.consumable.test(e.viewItem,{name:!0})){const t=Array.from(e.viewItem.getChildren());for(const e of t)!e.is("element","li")&&!T_(e)&&e._remove()}},y_=(t,e,n)=>{if(n.consumable.test(e.viewItem,{name:!0})){if(0===e.viewItem.childCount)return;const t=[...e.viewItem.getChildren()];let n=!1;for(const e of t)n&&!T_(e)&&e._remove(),T_(e)&&(n=!0)}};function x_(t){return(e,n)=>{if(n.isPhantom)return;const i=n.modelPosition.nodeBefore;if(i&&i.is("element","listItem")){const e=n.mapper.toViewElement(i),o=e.getAncestors().find(T_),r=t.createPositionAt(e,0).getWalker();for(const t of r){if("elementStart"==t.type&&t.item.is("element","li")){n.viewPosition=t.previousPosition;break}if("elementEnd"==t.type&&t.item==o){n.viewPosition=t.nextPosition;break}}}}}const E_=function(t,[e,n]){let i,o=e.is("documentFragment")?e.getChild(0):e;if(i=n?this.createSelection(n):this.document.selection,o&&o.is("element","listItem")){const t=i.getFirstPosition();let e=null;if(t.parent.is("element","listItem")?e=t.parent:t.nodeBefore&&t.nodeBefore.is("element","listItem")&&(e=t.nodeBefore),e){const t=e.getAttribute("listIndent");if(t>0)for(;o&&o.is("element","listItem");)o._setAttribute("listIndent",o.getAttribute("listIndent")+t),o=o.nextSibling}}};function D_(t){const e=new bl({startPosition:t});let n;do{n=e.next()}while(!n.value.item.is("element","listItem"));return n.value.item}function S_(t,e,n,i,o,r){const s=a_(e.nodeBefore,{sameIndent:!0,smallerIndent:!0,listIndent:t}),a=o.mapper,l=o.writer,c=s?s.getAttribute("listIndent"):null;let d;if(s)if(c==t){const t=a.toViewElement(s).parent;d=l.createPositionAfter(t)}else{const t=r.createPositionAt(s,"end");d=a.toViewPosition(t)}else d=n;d=s_(d);for(const t of[...i.getChildren()])T_(t)&&(d=l.move(l.createRangeOn(t),d).end,r_(l,t,t.nextSibling),r_(l,t.previousSibling,t))}function T_(t){return t.is("element","ol")||t.is("element","ul")}var I_=n(9989);Wi()(I_.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),I_.Z.locals;class B_ extends ur{static get pluginName(){return"ListEditing"}static get requires(){return[op,Bg,f_]}init(){const t=this.editor;t.model.schema.register("listItem",{inheritAllFrom:"$block",allowAttributes:["listType","listIndent"]});const e=t.data,n=t.editing;var i;t.model.document.registerPostFixer((e=>function(t,e){const n=t.document.differ.getChanges(),i=new Map;let o=!1;for(const i of n)if("insert"==i.type&&"listItem"==i.name)r(i.position);else if("insert"==i.type&&"listItem"!=i.name){if("$text"!=i.name){const n=i.position.nodeAfter;n.hasAttribute("listIndent")&&(e.removeAttribute("listIndent",n),o=!0),n.hasAttribute("listType")&&(e.removeAttribute("listType",n),o=!0),n.hasAttribute("listStyle")&&(e.removeAttribute("listStyle",n),o=!0),n.hasAttribute("listReversed")&&(e.removeAttribute("listReversed",n),o=!0),n.hasAttribute("listStart")&&(e.removeAttribute("listStart",n),o=!0);for(const e of Array.from(t.createRangeIn(n)).filter((t=>t.item.is("element","listItem"))))r(e.previousPosition)}r(i.position.getShiftedBy(i.length))}else"remove"==i.type&&"listItem"==i.name?r(i.position):("attribute"==i.type&&"listIndent"==i.attributeKey||"attribute"==i.type&&"listType"==i.attributeKey)&&r(i.range.start);for(const t of i.values())s(t),a(t);return o;function r(t){const e=t.nodeBefore;if(e&&e.is("element","listItem")){let t=e;if(i.has(t))return;for(let e=t.previousSibling;e&&e.is("element","listItem");e=t.previousSibling)if(t=e,i.has(t))return;i.set(e,t)}else{const e=t.nodeAfter;e&&e.is("element","listItem")&&i.set(e,e)}}function s(t){let n=0,i=null;for(;t&&t.is("element","listItem");){const r=t.getAttribute("listIndent");if(r>n){let s;null===i?(i=r-n,s=n):(i>r&&(i=r),s=r-i),e.setAttribute("listIndent",s,t),o=!0}else i=null,n=t.getAttribute("listIndent")+1;t=t.nextSibling}}function a(t){let n=[],i=null;for(;t&&t.is("element","listItem");){const r=t.getAttribute("listIndent");if(i&&i.getAttribute("listIndent")>r&&(n=n.slice(0,r+1)),0!=r)if(n[r]){const i=n[r];t.getAttribute("listType")!=i&&(e.setAttribute("listType",i,t),o=!0)}else n[r]=t.getAttribute("listType");i=t,t=t.nextSibling}}}(t.model,e))),n.mapper.registerViewToModelLength("li",M_),e.mapper.registerViewToModelLength("li",M_),n.mapper.on("modelToViewPosition",x_(n.view)),n.mapper.on("viewToModelPosition",(i=t.model,(t,e)=>{const n=e.viewPosition,o=n.parent,r=e.mapper;if("ul"==o.name||"ol"==o.name){if(n.isAtEnd){const t=r.toModelElement(n.nodeBefore),o=r.getModelLength(n.nodeBefore);e.modelPosition=i.createPositionBefore(t).getShiftedBy(o)}else{const t=r.toModelElement(n.nodeAfter);e.modelPosition=i.createPositionBefore(t)}t.stop()}else if("li"==o.name&&n.nodeBefore&&("ul"==n.nodeBefore.name||"ol"==n.nodeBefore.name)){const s=r.toModelElement(o);let a=1,l=n.nodeBefore;for(;l&&T_(l);)a+=r.getModelLength(l),l=l.previousSibling;e.modelPosition=i.createPositionBefore(s).getShiftedBy(a),t.stop()}})),e.mapper.on("modelToViewPosition",x_(n.view)),t.conversion.for("editingDowncast").add((e=>{e.on("insert",A_,{priority:"high"}),e.on("insert:listItem",b_(t.model)),e.on("attribute:listType:listItem",k_,{priority:"high"}),e.on("attribute:listType:listItem",w_,{priority:"low"}),e.on("attribute:listIndent:listItem",function(t){return(e,n,i)=>{if(!i.consumable.consume(n.item,"attribute:listIndent"))return;const o=i.mapper.toViewElement(n.item),r=i.writer;r.breakContainer(r.createPositionBefore(o)),r.breakContainer(r.createPositionAfter(o));const s=o.parent,a=s.previousSibling,l=r.createRangeOn(s);r.remove(l),a&&a.nextSibling&&r_(r,a,a.nextSibling),S_(n.attributeOldValue+1,n.range.start,l.start,o,i,t),o_(n.item,o,i,t);for(const t of n.item.getChildren())i.consumable.consume(t,"insert")}}(t.model)),e.on("remove:listItem",function(t){return(e,n,i)=>{const o=i.mapper.toViewPosition(n.position).getLastMatchingPosition((t=>!t.item.is("element","li"))).nodeAfter,r=i.writer;r.breakContainer(r.createPositionBefore(o)),r.breakContainer(r.createPositionAfter(o));const s=o.parent,a=s.previousSibling,l=r.createRangeOn(s),c=r.remove(l);a&&a.nextSibling&&r_(r,a,a.nextSibling),S_(i.mapper.toModelElement(o).getAttribute("listIndent")+1,n.position,l.start,o,i,t);for(const t of r.createRangeIn(c).getItems())i.mapper.unbindViewElement(t);e.stop()}}(t.model)),e.on("remove",C_,{priority:"low"})})),t.conversion.for("dataDowncast").add((e=>{e.on("insert",A_,{priority:"high"}),e.on("insert:listItem",b_(t.model))})),t.conversion.for("upcast").add((t=>{t.on("element:ul",v_,{priority:"high"}),t.on("element:ol",v_,{priority:"high"}),t.on("element:li",y_,{priority:"high"}),t.on("element:li",__)})),t.model.on("insertContent",E_,{priority:"high"}),t.commands.add("numberedList",new XC(t,"numbered")),t.commands.add("bulletedList",new XC(t,"bulleted")),t.commands.add("indentList",new n_(t,"forward")),t.commands.add("outdentList",new n_(t,"backward"));const o=n.view.document;this.listenTo(o,"enter",((t,e)=>{const n=this.editor.model.document,i=n.selection.getLastPosition().parent;n.selection.isCollapsed&&"listItem"==i.name&&i.isEmpty&&(this.editor.execute("outdentList"),e.preventDefault(),t.stop())}),{context:"li"}),this.listenTo(o,"delete",((t,e)=>{if("backward"!==e.direction)return;const n=this.editor.model.document.selection;if(!n.isCollapsed)return;const i=n.getFirstPosition();if(!i.isAtStart)return;const o=i.parent;"listItem"===o.name&&(o.previousSibling&&"listItem"===o.previousSibling.name||(this.editor.execute("outdentList"),e.preventDefault(),t.stop()))}),{context:"li"}),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"})}afterInit(){const t=this.editor.commands,e=t.get("indent"),n=t.get("outdent");e&&e.registerChildCommand(t.get("indentList")),n&&n.registerChildCommand(t.get("outdentList"))}}function M_(t){let e=1;for(const n of t.getChildren())if("ul"==n.name||"ol"==n.name)for(const t of n.getChildren())e+=M_(t);return e}const N_=' ',z_=' ';class L_ extends ur{static get pluginName(){return"ListUI"}init(){const t=this.editor.t;l_(this.editor,"numberedList",t("Numbered List"),N_),l_(this.editor,"bulletedList",t("Bulleted List"),z_)}}class P_ extends gr{constructor(t,e){super(t),this.defaultType=e}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){this._tryToConvertItemsToList(t);const e=this.editor.model,n=h_(e);n.length&&e.change((e=>{for(const i of n)e.setAttribute("listStyle",t.type||this.defaultType,i)}))}_getValue(){const t=this.editor.model.document.selection.getFirstPosition().parent;return t&&t.is("element","listItem")?t.getAttribute("listStyle"):null}_checkEnabled(){const t=this.editor,e=t.commands.get("numberedList"),n=t.commands.get("bulletedList");return e.isEnabled||n.isEnabled}_tryToConvertItemsToList(t){if(!t.type)return;const e=g_(t.type);if(!e)return;const n=this.editor,i=`${e}List`;n.commands.get(i).value||n.execute(i)}}class R_ extends gr{refresh(){const t=this._getValue();this.value=t,this.isEnabled=null!=t}execute(t={}){const e=this.editor.model,n=h_(e).filter((t=>"numbered"==t.getAttribute("listType")));e.change((e=>{for(const i of n)e.setAttribute("listReversed",!!t.reversed,i)}))}_getValue(){const t=this.editor.model.document.selection.getFirstPosition().parent;return t&&t.is("element","listItem")&&"numbered"==t.getAttribute("listType")?t.getAttribute("listReversed"):null}}class O_ extends gr{refresh(){const t=this._getValue();this.value=t,this.isEnabled=null!=t}execute({startIndex:t=1}={}){const e=this.editor.model,n=h_(e).filter((t=>"numbered"==t.getAttribute("listType")));e.change((e=>{for(const i of n)e.setAttribute("listStart",t>=0?t:1,i)}))}_getValue(){const t=this.editor.model.document.selection.getFirstPosition().parent;return t&&t.is("element","listItem")&&"numbered"==t.getAttribute("listType")?t.getAttribute("listStart"):null}}const V_="default";class F_ extends ur{static get requires(){return[B_]}static get pluginName(){return"ListPropertiesEditing"}constructor(t){super(t),t.config.define("list",{properties:{styles:!0,startIndex:!1,reversed:!1}})}init(){const t=this.editor,e=t.model,n=function(t){const e=[];return t.styles&&e.push({attributeName:"listStyle",defaultValue:V_,addCommand(t){t.commands.add("listStyle",new P_(t,V_))},appliesToListItem:()=>!0,setAttributeOnDowncast(t,e,n){e&&e!==V_?t.setStyle("list-style-type",e,n):t.removeStyle("list-style-type",n)},getAttributeOnUpcast:t=>t.getStyle("list-style-type")||V_}),t.reversed&&e.push({attributeName:"listReversed",defaultValue:!1,addCommand(t){t.commands.add("listReversed",new R_(t))},appliesToListItem:t=>"numbered"==t.getAttribute("listType"),setAttributeOnDowncast(t,e,n){e?t.setAttribute("reversed","reversed",n):t.removeAttribute("reversed",n)},getAttributeOnUpcast:t=>t.hasAttribute("reversed")}),t.startIndex&&e.push({attributeName:"listStart",defaultValue:1,addCommand(t){t.commands.add("listStart",new O_(t))},appliesToListItem:t=>"numbered"==t.getAttribute("listType"),setAttributeOnDowncast(t,e,n){0==e||e>1?t.setAttribute("start",e,n):t.removeAttribute("start",n)},getAttributeOnUpcast(t){const e=t.getAttribute("start");return e>=0?e:1}}),e}(t.config.get("list.properties"));e.schema.extend("listItem",{allowAttributes:n.map((t=>t.attributeName))});for(const e of n)e.addCommand(t);var i;this.listenTo(t.commands.get("indentList"),"_executeCleanup",function(t,e){return(n,i)=>{const o=i[0],r=o.getAttribute("listIndent"),s=i.filter((t=>t.getAttribute("listIndent")===r));let a=null;o.previousSibling.getAttribute("listIndent")+1!==r&&(a=a_(o.previousSibling,{sameIndent:!0,direction:"backward",listIndent:r})),t.model.change((t=>{for(const n of s)for(const i of e)if(i.appliesToListItem(n)){const e=null==a?i.defaultValue:a.getAttribute(i.attributeName);t.setAttribute(i.attributeName,e,n)}}))}}(t,n)),this.listenTo(t.commands.get("outdentList"),"_executeCleanup",function(t,e){return(n,i)=>{if(!(i=i.reverse().filter((t=>t.is("element","listItem")))).length)return;const o=i[0].getAttribute("listIndent"),r=i[0].getAttribute("listType");let s=i[0].previousSibling;if(s.is("element","listItem"))for(;s.getAttribute("listIndent")!==o;)s=s.previousSibling;else s=null;s||(s=i[i.length-1].nextSibling),s&&s.is("element","listItem")&&s.getAttribute("listType")===r&&t.model.change((t=>{const n=i.filter((t=>t.getAttribute("listIndent")===o));for(const i of n)for(const n of e)if(n.appliesToListItem(i)){const e=n.attributeName,o=s.getAttribute(e);t.setAttribute(e,o,i)}}))}}(t,n)),this.listenTo(t.commands.get("bulletedList"),"_executeCleanup",U_(t)),this.listenTo(t.commands.get("numberedList"),"_executeCleanup",U_(t)),e.document.registerPostFixer(function(t,e){return n=>{let i=!1;const o=G_(t.model.document.differ.getChanges()).filter((t=>"todo"!==t.getAttribute("listType")));if(!o.length)return i;let r=o[o.length-1].nextSibling;if((!r||!r.is("element","listItem"))&&(r=o[0].previousSibling,r)){const t=o[0].getAttribute("listIndent");for(;r.is("element","listItem")&&r.getAttribute("listIndent")!==t&&(r=r.previousSibling,r););}for(const t of e){const e=t.attributeName;for(const s of o)if(t.appliesToListItem(s))if(s.hasAttribute(e)){const o=s.previousSibling;H_(o,s,t.attributeName)&&(n.setAttribute(e,o.getAttribute(e),s),i=!0)}else j_(r,s,t)?n.setAttribute(e,r.getAttribute(e),s):n.setAttribute(e,t.defaultValue,s),i=!0;else n.removeAttribute(e,s)}return i}}(t,n)),t.conversion.for("upcast").add((i=n,t=>{t.on("element:li",((t,e,n)=>{if(!e.modelRange)return;const o=e.viewItem.parent,r=e.modelRange.start.nodeAfter||e.modelRange.end.nodeBefore;for(const t of i)if(t.appliesToListItem(r)){const e=t.getAttributeOnUpcast(o);n.writer.setAttribute(t.attributeName,e,r)}}),{priority:"low"})})),t.conversion.for("downcast").add(function(t){return n=>{for(const i of t)n.on(`attribute:${i.attributeName}:listItem`,((t,n,o)=>{const r=o.writer,s=n.item,a=a_(s.previousSibling,{sameIndent:!0,listIndent:s.getAttribute("listIndent"),direction:"backward"}),l=o.mapper.toViewElement(s);e(s,a)||r.breakContainer(r.createPositionBefore(l)),i.setAttributeOnDowncast(r,n.attributeNewValue,l.parent)}),{priority:"low"})};function e(t,e){return e&&t.getAttribute("listType")===e.getAttribute("listType")&&t.getAttribute("listIndent")===e.getAttribute("listIndent")&&t.getAttribute("listStyle")===e.getAttribute("listStyle")&&t.getAttribute("listReversed")===e.getAttribute("listReversed")&&t.getAttribute("listStart")===e.getAttribute("listStart")}}(n)),this._mergeListAttributesWhileMergingLists(n)}afterInit(){const t=this.editor;t.commands.get("todoList")&&t.model.document.registerPostFixer(function(t){return e=>{const n=G_(t.model.document.differ.getChanges()).filter((t=>"todo"===t.getAttribute("listType")&&(t.hasAttribute("listStyle")||t.hasAttribute("listReversed")||t.hasAttribute("listStart"))));if(!n.length)return!1;for(const t of n)e.removeAttribute("listStyle",t),e.removeAttribute("listReversed",t),e.removeAttribute("listStart",t);return!0}}(t))}_mergeListAttributesWhileMergingLists(t){const e=this.editor.model;let n;this.listenTo(e,"deleteContent",((t,[e])=>{const i=e.getFirstPosition(),o=e.getLastPosition();if(i.parent===o.parent)return;if(!i.parent.is("element","listItem"))return;const r=o.parent.nextSibling;if(!r||!r.is("element","listItem"))return;const s=a_(i.parent,{sameIndent:!0,listIndent:r.getAttribute("listIndent")});s&&s.getAttribute("listType")===r.getAttribute("listType")&&(n=s)}),{priority:"high"}),this.listenTo(e,"deleteContent",(()=>{n&&(e.change((e=>{const i=a_(n.nextSibling,{sameIndent:!0,listIndent:n.getAttribute("listIndent"),direction:"forward"});if(!i)return void(n=null);const o=[i,...d_(e.createPositionAt(i,0),"forward")];for(const i of o)for(const o of t)if(o.appliesToListItem(i)){const t=o.attributeName,r=n.getAttribute(t);e.setAttribute(t,r,i)}})),n=null)}),{priority:"low"})}}function j_(t,e,n){if(!t)return!1;const i=t.getAttribute(n.attributeName);return!!i&&i!=n.defaultValue&&t.getAttribute("listType")===e.getAttribute("listType")}function H_(t,e,n){if(!t||!t.is("element","listItem"))return!1;if(e.getAttribute("listType")!==t.getAttribute("listType"))return!1;const i=t.getAttribute("listIndent");if(i<1||i!==e.getAttribute("listIndent"))return!1;const o=t.getAttribute(n);return!(!o||o===e.getAttribute(n))}function U_(t){return(e,n)=>{n=n.filter((t=>t.is("element","listItem"))),t.model.change((t=>{for(const e of n)t.removeAttribute("listStyle",e)}))}}function G_(t){const e=[];for(const n of t){const t=W_(n);t&&t.is("element","listItem")&&e.push(t)}return e}function W_(t){return"attribute"===t.type?t.range.start.nodeAfter:"insert"===t.type?t.position.nodeAfter:null}var q_=n(3195);Wi()(q_.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),q_.Z.locals;class $_ extends $i{constructor(t,e){super(t);const n=this.bindTemplate;this.set("isCollapsed",!1),this.set("label",""),this.buttonView=this._createButtonView(),this.children=this.createCollection(),this.set("_collapsibleAriaLabelUid",void 0),e&&this.children.addMany(e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-collapsible",n.if("isCollapsed","ck-collapsible_collapsed")]},children:[this.buttonView,{tag:"div",attributes:{class:["ck","ck-collapsible__children"],role:"region",hidden:n.if("isCollapsed","hidden"),"aria-labelledby":n.to("_collapsibleAriaLabelUid")},children:this.children}]})}render(){super.render(),this._collapsibleAriaLabelUid=this.buttonView.labelView.element.id}_createButtonView(){const t=new Ao(this.locale),e=t.bindTemplate;return t.set({withText:!0,icon:rr}),t.extendTemplate({attributes:{"aria-expanded":e.to("isOn",(t=>String(t)))}}),t.bind("label").to(this),t.bind("isOn").to(this,"isCollapsed",(t=>!t)),t.on("execute",(()=>{this.isCollapsed=!this.isCollapsed})),t}}var K_=n(7133);Wi()(K_.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),K_.Z.locals;class Y_ extends $i{constructor(t,{enabledProperties:e,styleButtonViews:n,styleGridAriaLabel:i}){super(t),this.stylesView=null,this.additionalPropertiesCollapsibleView=null,this.startIndexFieldView=null,this.reversedSwitchButtonView=null,this.focusTracker=new Li,this.keystrokes=new Pi,this.focusables=new Ui;const o=["ck","ck-list-properties"];this.children=this.createCollection(),this.focusCycler=new ar({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),e.styles?(this.stylesView=this._createStylesView(n,i),this.children.add(this.stylesView)):o.push("ck-list-properties_without-styles"),(e.startIndex||e.reversed)&&(this._addNumberedListPropertyViews(e),o.push("ck-list-properties_with-numbered-properties")),this.setTemplate({tag:"div",attributes:{class:o},children:this.children})}render(){if(super.render(),this.stylesView){this.focusables.add(this.stylesView),this.focusTracker.add(this.stylesView.element),(this.startIndexFieldView||this.reversedSwitchButtonView)&&(this.focusables.add(this.children.last.buttonView),this.focusTracker.add(this.children.last.buttonView.element));for(const t of this.stylesView.children)this.stylesView.focusTracker.add(t.element);r({keystrokeHandler:this.stylesView.keystrokes,focusTracker:this.stylesView.focusTracker,gridItems:this.stylesView.children,numberOfColumns:()=>Gn.window.getComputedStyle(this.stylesView.element).getPropertyValue("grid-template-columns").split(" ").length,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}if(this.startIndexFieldView){this.focusables.add(this.startIndexFieldView),this.focusTracker.add(this.startIndexFieldView.element);const t=t=>t.stopPropagation();this.keystrokes.set("arrowright",t),this.keystrokes.set("arrowleft",t),this.keystrokes.set("arrowup",t),this.keystrokes.set("arrowdown",t)}this.reversedSwitchButtonView&&(this.focusables.add(this.reversedSwitchButtonView),this.focusTracker.add(this.reversedSwitchButtonView.element)),this.keystrokes.listenTo(this.element)}focus(){this.focusCycler.focusFirst()}focusLast(){this.focusCycler.focusLast()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createStylesView(t,e){const n=new $i(this.locale);return n.children=n.createCollection(),n.children.addMany(t),n.setTemplate({tag:"div",attributes:{"aria-label":e,class:["ck","ck-list-styles-list"]},children:n.children}),n.children.delegate("execute").to(this),n.focus=function(){this.children.first.focus()},n.focusTracker=new Li,n.keystrokes=new Pi,n.render(),n.keystrokes.listenTo(n.element),n}_addNumberedListPropertyViews(t){const e=this.locale.t,n=[];t.startIndex&&(this.startIndexFieldView=this._createStartIndexField(),n.push(this.startIndexFieldView)),t.reversed&&(this.reversedSwitchButtonView=this._createReversedSwitchButton(),n.push(this.reversedSwitchButtonView)),t.styles?(this.additionalPropertiesCollapsibleView=new $_(this.locale,n),this.additionalPropertiesCollapsibleView.set({label:e("List properties"),isCollapsed:!0}),this.additionalPropertiesCollapsibleView.buttonView.bind("isEnabled").toMany(n,"isEnabled",((...t)=>t.some((t=>t)))),this.additionalPropertiesCollapsibleView.buttonView.on("change:isEnabled",((t,e,n)=>{n||(this.additionalPropertiesCollapsibleView.isCollapsed=!0)})),this.children.add(this.additionalPropertiesCollapsibleView)):this.children.addMany(n)}_createStartIndexField(){const t=this.locale.t,e=new Qo(this.locale,Eu);return e.set({label:t("Start at"),class:"ck-numbered-list-properties__start-index"}),e.fieldView.set({min:0,step:1,value:1,inputMode:"numeric"}),e.fieldView.on("input",(()=>{const n=e.fieldView.element,i=n.valueAsNumber;Number.isNaN(i)||(n.checkValidity()?this.fire("listStart",{startIndex:i}):e.errorText=t("Start index must be greater than 0."))})),e}_createReversedSwitchButton(){const t=this.locale.t,e=new _o(this.locale);return e.set({withText:!0,label:t("Reversed order"),class:"ck-numbered-list-properties__reversed-order"}),e.delegate("execute").to(this,"listReversed"),e}}var Z_=n(4553);Wi()(Z_.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),Z_.Z.locals;class Q_ extends ur{static get pluginName(){return"ListPropertiesUI"}init(){const t=this.editor,e=t.locale.t,n=t.config.get("list.properties");n.styles&&t.ui.componentFactory.add("bulletedList",J_({editor:t,parentCommandName:"bulletedList",buttonLabel:e("Bulleted List"),buttonIcon:z_,styleGridAriaLabel:e("Bulleted list styles toolbar"),styleDefinitions:[{label:e("Toggle the disc list style"),tooltip:e("Disc"),type:"disc",icon:' '},{label:e("Toggle the circle list style"),tooltip:e("Circle"),type:"circle",icon:' '},{label:e("Toggle the square list style"),tooltip:e("Square"),type:"square",icon:' '}]})),(n.styles||n.startIndex||n.reversed)&&t.ui.componentFactory.add("numberedList",J_({editor:t,parentCommandName:"numberedList",buttonLabel:e("Numbered List"),buttonIcon:N_,styleGridAriaLabel:e("Numbered list styles toolbar"),styleDefinitions:[{label:e("Toggle the decimal list style"),tooltip:e("Decimal"),type:"decimal",icon:' '},{label:e("Toggle the decimal with leading zero list style"),tooltip:e("Decimal with leading zero"),type:"decimal-leading-zero",icon:' '},{label:e("Toggle the lower–roman list style"),tooltip:e("Lower–roman"),type:"lower-roman",icon:' '},{label:e("Toggle the upper–roman list style"),tooltip:e("Upper-roman"),type:"upper-roman",icon:' '},{label:e("Toggle the lower–latin list style"),tooltip:e("Lower-latin"),type:"lower-latin",icon:' '},{label:e("Toggle the upper–latin list style"),tooltip:e("Upper-latin"),type:"upper-latin",icon:' '}]}))}}function J_({editor:t,parentCommandName:e,buttonLabel:n,buttonIcon:i,styleGridAriaLabel:o,styleDefinitions:r}){const s=t.commands.get(e);return a=>{const l=wu(a,fu),c=l.buttonView;return l.bind("isEnabled").to(s),l.class="ck-list-styles-dropdown",c.on("execute",(()=>{t.execute(e),t.editing.view.focus()})),c.set({label:n,icon:i,tooltip:!0,isToggleable:!0}),c.bind("isOn").to(s,"value",(t=>!!t)),l.once("change:isOpen",(()=>{const n=function({editor:t,dropdownView:e,parentCommandName:n,styleDefinitions:i,styleGridAriaLabel:o}){const r=t.locale,s=t.config.get("list.properties");let a=null;if("numberedList"!=n&&(s.startIndex=!1,s.reversed=!1),s.styles){const e=t.commands.get("listStyle"),o=function({editor:t,listStyleCommand:e,parentCommandName:n}){const i=t.locale,o=t.commands.get(n);return({label:n,type:r,icon:s,tooltip:a})=>{const l=new Ao(i);return l.set({label:n,icon:s,tooltip:a}),e.on("change:value",(()=>{l.isOn=e.value===r})),l.on("execute",(()=>{o.value?e.value!==r?t.execute("listStyle",{type:r}):t.execute("listStyle",{type:e.defaultType}):t.model.change((()=>{t.execute("listStyle",{type:r})}))})),l}}({editor:t,parentCommandName:n,listStyleCommand:e}),r="function"==typeof e.isStyleTypeSupported?t=>e.isStyleTypeSupported(t.type):()=>!0;a=i.filter(r).map(o)}const l=new Y_(r,{styleGridAriaLabel:o,enabledProperties:s,styleButtonViews:a});if(s.styles&&yu(e,(()=>l.stylesView.children.find((t=>t.isOn)))),s.startIndex){const e=t.commands.get("listStart");l.startIndexFieldView.bind("isEnabled").to(e),l.startIndexFieldView.fieldView.bind("value").to(e),l.on("listStart",((e,n)=>t.execute("listStart",n)))}if(s.reversed){const e=t.commands.get("listReversed");l.reversedSwitchButtonView.bind("isEnabled").to(e),l.reversedSwitchButtonView.bind("isOn").to(e,"value",(t=>!!t)),l.on("listReversed",(()=>{const n=e.value;t.execute("listReversed",{reversed:!n})}))}return l.delegate("execute").to(e),l}({editor:t,dropdownView:l,parentCommandName:e,styleGridAriaLabel:o,styleDefinitions:r});l.panelView.children.add(n)})),l.on("execute",(()=>{t.editing.view.focus()})),l}}function X_(t,e){const n=(n,i,o)=>{if(!o.consumable.consume(i.item,n.name))return;const r=i.attributeNewValue,s=o.writer,a=o.mapper.toViewElement(i.item),l=[...a.getChildren()].find((t=>t.getCustomProperty("media-content")));s.remove(l);const c=t.getMediaViewElement(s,r,e);s.insert(s.createPositionAt(a,0),c)};return t=>{t.on("attribute:url:media",n)}}function tv(t){const e=t.getSelectedElement();return e&&function(t){return!!t.getCustomProperty("media")&&fp(t)}(e)?e:null}function ev(t,e,n,i){return t.createContainerElement("figure",{class:"media"},[e.getMediaViewElement(t,n,i),t.createSlot()])}function nv(t){const e=t.getSelectedElement();return e&&e.is("element","media")?e:null}function iv(t,e,n,i){t.change((o=>{const r=o.createElement("media",{url:e});t.insertObject(r,n,null,{setSelection:"on",findOptimalPosition:i?"auto":void 0})}))}class ov extends gr{refresh(){const t=this.editor.model,e=t.document.selection,n=nv(e);this.value=n?n.getAttribute("url"):void 0,this.isEnabled=function(t){const e=t.getSelectedElement();return!!e&&"media"===e.name}(e)||function(t,e){let n=_p(t,e).start.parent;return n.isEmpty&&!e.schema.isLimit(n)&&(n=n.parent),e.schema.checkChild(n,"media")}(e,t)}execute(t){const e=this.editor.model,n=e.document.selection,i=nv(n);i?e.change((e=>{e.setAttribute("url",t,i)})):iv(e,t,n,!0)}}class rv{constructor(t,e){const n=e.providers,i=e.extraProviders||[],o=new Set(e.removeProviders),r=n.concat(i).filter((t=>{const e=t.name;return e?!o.has(e):(C("media-embed-no-provider-name",{provider:t}),!1)}));this.locale=t,this.providerDefinitions=r}hasMedia(t){return!!this._getMedia(t)}getMediaViewElement(t,e,n){return this._getMedia(e).getViewElement(t,n)}_getMedia(t){if(!t)return new sv(this.locale);t=t.trim();for(const e of this.providerDefinitions){const n=e.html,i=Bi(e.url);for(const e of i){const i=this._getUrlMatches(t,e);if(i)return new sv(this.locale,t,i,n)}}return null}_getUrlMatches(t,e){let n=t.match(e);if(n)return n;let i=t.replace(/^https?:\/\//,"");return n=i.match(e),n||(i=i.replace(/^www\./,""),n=i.match(e),n||null)}}class sv{constructor(t,e,n,i){this.url=this._getValidUrl(e),this._locale=t,this._match=n,this._previewRenderer=i}getViewElement(t,e){const n={};let i;if(e.renderForEditingView||e.renderMediaPreview&&this.url&&this._previewRenderer){this.url&&(n["data-oembed-url"]=this.url),e.renderForEditingView&&(n.class="ck-media__wrapper");const o=this._getPreviewHtml(e);i=t.createRawElement("div",n,((t,e)=>{e.setContentOf(t,o)}))}else this.url&&(n.url=this.url),i=t.createEmptyElement(e.elementName,n);return t.setCustomProperty("media-content",!0,i),i}_getPreviewHtml(t){return this._previewRenderer?this._previewRenderer(this._match):this.url&&t.renderForEditingView?this._getPlaceholderHtml():""}_getPlaceholderHtml(){const t=new ko,e=this._locale.t;return t.content=' ',t.viewBox="0 0 64 42",new Ki({tag:"div",attributes:{class:"ck ck-reset_all ck-media__placeholder"},children:[{tag:"div",attributes:{class:"ck-media__placeholder__icon"},children:[t]},{tag:"a",attributes:{class:"ck-media__placeholder__url",target:"_blank",rel:"noopener noreferrer",href:this.url,"data-cke-tooltip-text":e("Open media in new tab")},children:[{tag:"span",attributes:{class:"ck-media__placeholder__url__text"},children:[this.url]}]}]}).render().outerHTML}_getValidUrl(t){return t?t.match(/^https?/)?t:"https://"+t:null}}var av=n(952);Wi()(av.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),av.Z.locals;class lv extends ur{static get pluginName(){return"MediaEmbedEditing"}constructor(t){super(t),t.config.define("mediaEmbed",{elementName:"oembed",providers:[{name:"dailymotion",url:/^dailymotion\.com\/video\/(\w+)/,html:t=>`
`},{name:"spotify",url:[/^open\.spotify\.com\/(artist\/\w+)/,/^open\.spotify\.com\/(album\/\w+)/,/^open\.spotify\.com\/(track\/\w+)/],html:t=>`
`},{name:"youtube",url:[/^(?:m\.)?youtube\.com\/watch\?v=([\w-]+)(?:&t=(\d+))?/,/^(?:m\.)?youtube\.com\/v\/([\w-]+)(?:\?t=(\d+))?/,/^youtube\.com\/embed\/([\w-]+)(?:\?start=(\d+))?/,/^youtu\.be\/([\w-]+)(?:\?t=(\d+))?/],html:t=>{const e=t[1],n=t[2];return`VIDEO
`}},{name:"vimeo",url:[/^vimeo\.com\/(\d+)/,/^vimeo\.com\/[^/]+\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/album\/[^/]+\/video\/(\d+)/,/^vimeo\.com\/channels\/[^/]+\/(\d+)/,/^vimeo\.com\/groups\/[^/]+\/videos\/(\d+)/,/^vimeo\.com\/ondemand\/[^/]+\/(\d+)/,/^player\.vimeo\.com\/video\/(\d+)/],html:t=>`
`},{name:"instagram",url:/^instagram\.com\/p\/(\w+)/},{name:"twitter",url:/^twitter\.com/},{name:"googleMaps",url:[/^google\.com\/maps/,/^goo\.gl\/maps/,/^maps\.google\.com/,/^maps\.app\.goo\.gl/]},{name:"flickr",url:/^flickr\.com/},{name:"facebook",url:/^facebook\.com/}]}),this.registry=new rv(t.locale,t.config.get("mediaEmbed"))}init(){const t=this.editor,e=t.model.schema,n=t.t,i=t.conversion,o=t.config.get("mediaEmbed.previewsInData"),r=t.config.get("mediaEmbed.elementName"),s=this.registry;t.commands.add("mediaEmbed",new ov(t)),e.register("media",{inheritAllFrom:"$blockObject",allowAttributes:["url"]}),i.for("dataDowncast").elementToStructure({model:"media",view:(t,{writer:e})=>{const n=t.getAttribute("url");return ev(e,s,n,{elementName:r,renderMediaPreview:!!n&&o})}}),i.for("dataDowncast").add(X_(s,{elementName:r,renderMediaPreview:o})),i.for("editingDowncast").elementToStructure({model:"media",view:(t,{writer:e})=>{const i=t.getAttribute("url");return function(t,e,n){return e.setCustomProperty("media",!0,t),bp(t,e,{label:n})}(ev(e,s,i,{elementName:r,renderForEditingView:!0}),e,n("media widget"))}}),i.for("editingDowncast").add(X_(s,{elementName:r,renderForEditingView:!0})),i.for("upcast").elementToElement({view:t=>["oembed",r].includes(t.name)&&t.getAttribute("url")?{name:!0}:null,model:(t,{writer:e})=>{const n=t.getAttribute("url");return s.hasMedia(n)?e.createElement("media",{url:n}):null}}).elementToElement({view:{name:"div",attributes:{"data-oembed-url":!0}},model:(t,{writer:e})=>{const n=t.getAttribute("data-oembed-url");return s.hasMedia(n)?e.createElement("media",{url:n}):null}}).add((t=>{t.on("element:figure",((t,e,n)=>{if(!n.consumable.consume(e.viewItem,{name:!0,classes:"media"}))return;const{modelRange:i,modelCursor:o}=n.convertChildren(e.viewItem,e.modelCursor);e.modelRange=i,e.modelCursor=o,zi(i.getItems())||n.consumable.revert(e.viewItem,{name:!0,classes:"media"})}))}))}}const cv=/^(?:http(s)?:\/\/)?[\w-]+\.[\w-.~:/?#[\]@!$&'()*+,;=%]+$/;class dv extends ur{static get requires(){return[Jp,Bg,cf]}static get pluginName(){return"AutoMediaEmbed"}constructor(t){super(t),this._timeoutId=null,this._positionToInsert=null}init(){const t=this.editor,e=t.model.document,n=t.plugins.get("ClipboardPipeline");this.listenTo(n,"inputTransformation",(()=>{const t=e.selection.getFirstRange(),n=yd.fromPosition(t.start);n.stickiness="toPrevious";const i=yd.fromPosition(t.end);i.stickiness="toNext",e.once("change:data",(()=>{this._embedMediaBetweenPositions(n,i),n.detach(),i.detach()}),{priority:"high"})})),t.commands.get("undo").on("execute",(()=>{this._timeoutId&&(Gn.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)}),{priority:"high"})}_embedMediaBetweenPositions(t,e){const n=this.editor,i=n.plugins.get(lv).registry,o=new Vl(t,e),r=o.getWalker({ignoreElementEnd:!0});let s="";for(const t of r)t.item.is("$textProxy")&&(s+=t.item.data);s=s.trim(),s.match(cv)&&i.hasMedia(s)&&n.commands.get("mediaEmbed").isEnabled?(this._positionToInsert=yd.fromPosition(t),this._timeoutId=Gn.window.setTimeout((()=>{n.model.change((t=>{this._timeoutId=null,t.remove(o),o.detach();let e=null;"$graveyard"!==this._positionToInsert.root.rootName&&(e=this._positionToInsert),iv(n.model,s,e,!1),this._positionToInsert.detach(),this._positionToInsert=null})),n.plugins.get(Bg).requestUndoOnBackspace()}),100)):o.detach()}}var hv=n(3525);Wi()(hv.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),hv.Z.locals;class uv extends $i{constructor(t,e){super(e);const n=e.t;this.focusTracker=new Li,this.keystrokes=new Pi,this.set("mediaURLInputValue",""),this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(n("Save"),iu.check,"ck-button-save"),this.saveButtonView.type="submit",this.saveButtonView.bind("isEnabled").to(this,"mediaURLInputValue",(t=>!!t)),this.cancelButtonView=this._createButton(n("Cancel"),iu.cancel,"ck-button-cancel","cancel"),this._focusables=new Ui,this._focusCycler=new ar({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this._validators=t,this.setTemplate({tag:"form",attributes:{class:["ck","ck-media-form","ck-responsive-form"],tabindex:"-1"},children:[this.urlInputView,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),o({view:this}),[this.urlInputView,this.saveButtonView,this.cancelButtonView].forEach((t=>{this._focusables.add(t),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()}get url(){return this.urlInputView.fieldView.element.value.trim()}set url(t){this.urlInputView.fieldView.element.value=t.trim()}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,this.urlInputView.infoText=this._urlInputViewInfoDefault}_createUrlInput(){const t=this.locale.t,e=new Qo(this.locale,xu),n=e.fieldView;return this._urlInputViewInfoDefault=t("Paste the media URL in the input."),this._urlInputViewInfoTip=t("Tip: Paste the URL into the content to embed faster."),e.label=t("Media URL"),e.infoText=this._urlInputViewInfoDefault,n.on("input",(()=>{e.infoText=n.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault,this.mediaURLInputValue=n.element.value.trim()})),e}_createButton(t,e,n,i){const o=new Ao(this.locale);return o.set({label:t,icon:e,tooltip:!0}),o.extendTemplate({attributes:{class:n}}),i&&o.delegate("execute").to(this,i),o}}class mv extends ur{static get requires(){return[lv]}static get pluginName(){return"MediaEmbedUI"}init(){const t=this.editor,e=t.commands.get("mediaEmbed");t.ui.componentFactory.add("mediaEmbed",(t=>{const n=wu(t);return this._setUpDropdown(n,e),n}))}_setUpDropdown(t,n){const i=this.editor,o=i.t,r=t.buttonView,s=i.plugins.get(lv).registry;t.once("change:isOpen",(()=>{const o=new(e(uv))(function(t,e){return[e=>{if(!e.url.length)return t("The URL must not be empty.")},n=>{if(!e.hasMedia(n.url))return t("This media URL is not supported.")}]}(i.t,s),i.locale);t.panelView.children.add(o),r.on("open",(()=>{o.disableCssTransitions(),o.url=n.value||"",o.urlInputView.fieldView.select(),o.enableCssTransitions()}),{priority:"low"}),t.on("submit",(()=>{o.isValid()&&(i.execute("mediaEmbed",o.url),i.editing.view.focus())})),t.on("change:isOpen",(()=>o.resetFormStatus())),t.on("cancel",(()=>{i.editing.view.focus()})),o.delegate("submit","cancel").to(t),o.urlInputView.fieldView.bind("value").to(n,"value"),o.urlInputView.bind("isEnabled").to(n,"isEnabled")})),t.bind("isEnabled").to(n),r.set({label:o("Insert media"),icon:' ',tooltip:!0})}}var gv=n(5777);Wi()(gv.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),gv.Z.locals;class pv extends gr{refresh(){const t=this.editor.model,e=t.schema,n=t.document.selection;this.isEnabled=function(t,e,n){const i=function(t,e){const n=_p(t,e).start.parent;return n.isEmpty&&!n.is("element","$root")?n.parent:n}(t,n);return e.checkChild(i,"pageBreak")}(n,e,t)}execute(){const t=this.editor.model;t.change((e=>{const n=e.createElement("pageBreak");t.insertObject(n,null,null,{setSelection:"after"})}))}}var fv=n(6448);Wi()(fv.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),fv.Z.locals;class bv extends ur{static get pluginName(){return"PageBreakEditing"}init(){const t=this.editor,e=t.model.schema,n=t.t,i=t.conversion;e.register("pageBreak",{inheritAllFrom:"$blockObject"}),i.for("dataDowncast").elementToStructure({model:"pageBreak",view:(t,{writer:e})=>e.createContainerElement("div",{class:"page-break",style:"page-break-after: always"},e.createContainerElement("span",{style:"display: none"}))}),i.for("editingDowncast").elementToStructure({model:"pageBreak",view:(t,{writer:e})=>{const i=n("Page break"),o=e.createContainerElement("div"),r=e.createRawElement("span",{class:"page-break__label"},(function(t){t.innerText=n("Page break")}));return e.addClass("page-break",o),e.insert(e.createPositionAt(o,0),r),function(t,e,n){return e.setCustomProperty("pageBreak",!0,t),bp(t,e,{label:n})}(o,e,i)}}),i.for("upcast").elementToElement({view:t=>{const e="always"==t.getStyle("page-break-before"),n="always"==t.getStyle("page-break-after");if(!e&&!n)return null;if(1==t.childCount){const e=t.getChild(0);if(!e.is("element","span")||"none"!=e.getStyle("display"))return null}else if(t.childCount>1)return null;return{name:!0}},model:"pageBreak",converterPriority:"high"}),t.commands.add("pageBreak",new pv(t))}}class kv extends ur{static get pluginName(){return"PageBreakUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add("pageBreak",(n=>{const i=t.commands.get("pageBreak"),o=new Ao(n);return o.set({label:e("Page break"),icon:' ',tooltip:!0}),o.bind("isEnabled").to(i,"isEnabled"),this.listenTo(o,"execute",(()=>{t.execute("pageBreak"),t.editing.view.focus()})),o}))}}function wv(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 Av(t,e,n){const i=e.parent,o=n.createElement(t.type),r=i.getChildIndex(e)+1;return n.insertChild(r,o,i),t.style&&n.setStyle("list-style-type",t.style,o),t.startIndex&&t.startIndex>1&&n.setAttribute("start",t.startIndex,o),o}function Cv(t){const e={},n=t.getStyle("mso-list");if(n){const t=n.match(/(^|\s{1,100})l(\d+)/i),i=n.match(/\s{0,100}lfo(\d+)/i),o=n.match(/\s{0,100}level(\d+)/i);t&&i&&o&&(e.id=t[2],e.order=i[1],e.indent=parseInt(o[1]))}return e}function _v(t){return btoa(t.match(/\w{2}/g).map((t=>String.fromCharCode(parseInt(t,16)))).join(""))}const vv=/ /i,yv=/xmlns:o="urn:schemas-microsoft-com/i;class xv{constructor(t){this.document=t}isActive(t){return vv.test(t)||yv.test(t)}execute(t){const{body:e,stylesString:n}=t._parsedData;(function(t,e){if(!t.childCount)return;const n=new hh(t.document),i=function(t,e){const n=e.createRangeIn(t),i=new Br({name:/^p|h\d+$/,styles:{"mso-list":/.*/}}),o=[];for(const t of n)if("elementStart"===t.type&&i.match(t.item)){const e=Cv(t.item);o.push({element:t.item,id:e.id,order:e.order,indent:e.indent})}return o}(t,n);if(!i.length)return;let o=null,r=1;i.forEach(((t,s)=>{const a=function(t,e){if(!t)return!0;if(t.id!==e.id)return e.indent-t.indent!=1;const n=e.element.previousSibling;return!n||!((i=n).is("element","ol")||i.is("element","ul"));var i}(i[s-1],t),l=(d=t,(c=a?null:i[s-1])?d.indent-c.indent:d.indent-1);var c,d;if(a&&(o=null,r=1),!o||0!==l){const i=function(t,e){const n=/mso-level-number-format:([^;]{0,100});/gi,i=/mso-level-start-at:\s{0,100}([0-9]{0,10})\s{0,100};/gi,o=new RegExp(`@list l${t.id}:level${t.indent}\\s*({[^}]*)`,"gi").exec(e);let r="decimal",s="ol",a=null;if(o&&o[1]){const e=n.exec(o[1]);if(e&&e[1]&&(r=e[1].trim(),s="bullet"!==r&&"image"!==r?"ol":"ul"),"bullet"===r){const e=function(t){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;return"o"===n?"circle":"·"===n?"disc":"§"===n?"square":null}(t.element);e&&(r=e)}else{const t=i.exec(o[1]);t&&t[1]&&(a=parseInt(t[1]))}}return{type:s,startIndex:a,style:wv(r)}}(t,e);if(o){if(t.indent>r){const t=o.getChild(o.childCount-1),e=t.getChild(t.childCount-1);o=Av(i,e,n),r+=1}else if(t.indentt.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 Br({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 Br({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;it.is("element")&&!i.includes(t.name)&&!o.includes(t.name)),{direction:e}),"forward"==e?r.nodeAfter:r.nodeBefore}function Dv(t,e){return!!t&&t.is("element")&&e.includes(t.name)}const Sv=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class Tv{constructor(t){this.document=t}isActive(t){return Sv.test(t)}execute(t){const e=new hh(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 Os(e.document.stylesProcessor),i=new Da(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=Ev(t,"forward",e,{blockElements:o,inlineObjectElements:r}),i=Ev(t,"backward",e,{blockElements:o,inlineObjectElements:r}),a=Dv(n,o);(Dv(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 Iv=/(\s+)<\/span>/g,((t,e)=>1===e.length?" ":Array(e.length+1).join(" ").substr(0,e.length)))}const Nv="removeFormat";class zv extends ur{static get pluginName(){return"RemoveFormatUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add(Nv,(n=>{const i=t.commands.get(Nv),o=new Ao(n);return o.set({label:e("Remove Format"),icon:' ',tooltip:!0}),o.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(o,"execute",(()=>{t.execute(Nv),t.editing.view.focus()})),o}))}}class Lv extends gr{refresh(){const t=this.editor.model;this.isEnabled=!!zi(this._getFormattingItems(t.document.selection,t.schema))}execute(){const t=this.editor.model,e=t.schema;t.change((n=>{for(const i of this._getFormattingItems(t.document.selection,e))if(i.is("selection"))for(const t of this._getFormattingAttributes(i,e))n.removeSelectionAttribute(t);else{const t=n.createRangeOn(i);for(const o of this._getFormattingAttributes(i,e))n.removeAttribute(o,t)}}))}*_getFormattingItems(t,e){const n=t=>!!zi(this._getFormattingAttributes(t,e));for(const i of t.getRanges())for(const t of i.getItems())!e.isBlock(t)&&n(t)&&(yield t);for(const e of t.getSelectedBlocks())n(e)&&(yield e);n(t)&&(yield t)}*_getFormattingAttributes(t,e){for(const[n]of t.getAttributes()){const t=e.getAttributeProperties(n);t&&t.isFormatting&&(yield n)}}}class Pv extends ur{static get pluginName(){return"RemoveFormatEditing"}init(){const t=this.editor;t.commands.add("removeFormat",new Lv(t))}}function Rv(t,e,n=" "){return`${n.repeat(Math.max(0,e))}${t}`}var Ov=n(671);Wi()(Ov.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),Ov.Z.locals;const Vv="SourceEditingMode";function Fv(t){return function(t){return t.startsWith("<")}(t)?function(t){const e=[{name:"address",isVoid:!1},{name:"article",isVoid:!1},{name:"aside",isVoid:!1},{name:"blockquote",isVoid:!1},{name:"br",isVoid:!0},{name:"details",isVoid:!1},{name:"dialog",isVoid:!1},{name:"dd",isVoid:!1},{name:"div",isVoid:!1},{name:"dl",isVoid:!1},{name:"dt",isVoid:!1},{name:"fieldset",isVoid:!1},{name:"figcaption",isVoid:!1},{name:"figure",isVoid:!1},{name:"footer",isVoid:!1},{name:"form",isVoid:!1},{name:"h1",isVoid:!1},{name:"h2",isVoid:!1},{name:"h3",isVoid:!1},{name:"h4",isVoid:!1},{name:"h5",isVoid:!1},{name:"h6",isVoid:!1},{name:"header",isVoid:!1},{name:"hgroup",isVoid:!1},{name:"hr",isVoid:!0},{name:"input",isVoid:!0},{name:"li",isVoid:!1},{name:"main",isVoid:!1},{name:"nav",isVoid:!1},{name:"ol",isVoid:!1},{name:"p",isVoid:!1},{name:"section",isVoid:!1},{name:"table",isVoid:!1},{name:"tbody",isVoid:!1},{name:"td",isVoid:!1},{name:"textarea",isVoid:!1},{name:"th",isVoid:!1},{name:"thead",isVoid:!1},{name:"tr",isVoid:!1},{name:"ul",isVoid:!1}],n=e.map((t=>t.name)).join("|"),i=t.replace(new RegExp(`?(${n})( .*?)?>`,"g"),"\n$&\n").split("\n");let o=0;return i.filter((t=>t.length)).map((t=>function(t,e){return e.some((e=>!e.isVoid&&!!new RegExp(`<${e.name}( .*?)?>`).test(t)))}(t,e)?Rv(t,o++):function(t,e){return e.some((e=>new RegExp(`${e.name}>`).test(t)))}(t,e)?Rv(t,--o):Rv(t,o))).join("\n")}(t):t}class jv extends Bm{constructor(t,e){super(t);const n=t.t;this.set("class","ck-special-characters-navigation"),this.groupDropdownView=this._createGroupDropdown(e),this.groupDropdownView.panelPosition="rtl"===t.uiLanguageDirection?"se":"sw",this.label=n("Special characters"),this.children.add(this.groupDropdownView)}get currentGroupName(){return this.groupDropdownView.value}focus(){this.groupDropdownView.focus()}_createGroupDropdown(t){const e=this.locale,n=e.t,i=wu(e),o=this._getCharacterGroupListItemDefinitions(i,t),r=n("Character categories");return i.set("value",o.first.model.name),i.buttonView.bind("label").to(i,"value",(e=>t.get(e))),i.buttonView.set({isOn:!1,withText:!0,tooltip:r,class:["ck-dropdown__button_label-width_auto"],ariaLabel:r,ariaLabelledBy:void 0}),i.on("execute",(t=>{i.value=t.source.name})),i.delegate("execute").to(this),_u(i,o,{ariaLabel:r,role:"menu"}),i}_getCharacterGroupListItemDefinitions(t,e){const n=new Ni;for(const[i,o]of e){const e=new Nm({name:i,label:o,withText:!0,role:"menuitemradio"});e.bind("isOn").to(t,"value",(t=>t===e.name)),n.add({type:"button",model:e})}return n}}var Hv=n(4046);Wi()(Hv.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),Hv.Z.locals;class Uv extends $i{constructor(t){super(t),this.tiles=this.createCollection(),this.setTemplate({tag:"div",children:[{tag:"div",attributes:{class:["ck","ck-character-grid__tiles"]},children:this.tiles}],attributes:{class:["ck","ck-character-grid"]}}),this.focusTracker=new Li,this.keystrokes=new Pi,r({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.tiles,numberOfColumns:()=>Gn.window.getComputedStyle(this.element.firstChild).getPropertyValue("grid-template-columns").split(" ").length,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}createTile(t,e){const n=new Ao(this.locale);return n.set({label:t,withText:!0,class:"ck-character-grid__tile"}),n.extendTemplate({attributes:{title:e},on:{mouseover:n.bindTemplate.to("mouseover"),focus:n.bindTemplate.to("focus")}}),n.on("mouseover",(()=>{this.fire("tileHover",{name:e,character:t})})),n.on("focus",(()=>{this.fire("tileFocus",{name:e,character:t})})),n.on("execute",(()=>{this.fire("execute",{name:e,character:t})})),n}render(){super.render();for(const t of this.tiles)this.focusTracker.add(t.element);this.tiles.on("change",((t,{added:e,removed:n})=>{if(e.length>0)for(const t of e)this.focusTracker.add(t.element);if(n.length>0)for(const t of n)this.focusTracker.remove(t.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.keystrokes.destroy()}focus(){this.tiles.first.focus()}}var Gv=n(4779);Wi()(Gv.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),Gv.Z.locals;class Wv extends $i{constructor(t){super(t);const e=this.bindTemplate;this.set("character",null),this.set("name",null),this.bind("code").to(this,"character",qv),this.setTemplate({tag:"div",children:[{tag:"span",attributes:{class:["ck-character-info__name"]},children:[{text:e.to("name",(t=>t||""))}]},{tag:"span",attributes:{class:["ck-character-info__code"]},children:[{text:e.to("code")}]}],attributes:{class:["ck","ck-character-info"]}})}}function qv(t){return null===t?"":"U+"+("0000"+t.codePointAt(0).toString(16)).slice(-4)}class $v extends $i{constructor(t,e,n,i){super(t),this.navigationView=e,this.gridView=n,this.infoView=i,this.items=this.createCollection(),this.focusTracker=new Li,this.keystrokes=new Pi,this._focusCycler=new ar({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",children:[this.navigationView,this.gridView,this.infoView],attributes:{tabindex:"-1"}}),this.items.add(this.navigationView.groupDropdownView.buttonView),this.items.add(this.gridView)}render(){super.render(),this.focusTracker.add(this.navigationView.groupDropdownView.buttonView.element),this.focusTracker.add(this.gridView.element),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.navigationView.focus()}}var Kv=n(8170);Wi()(Kv.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),Kv.Z.locals;const Yv="All";class Zv extends ur{static get pluginName(){return"SpecialCharactersArrows"}init(){const t=this.editor,e=t.t;t.plugins.get("SpecialCharacters").addItems("Arrows",[{title:e("leftwards simple arrow"),character:"←"},{title:e("rightwards simple arrow"),character:"→"},{title:e("upwards simple arrow"),character:"↑"},{title:e("downwards simple arrow"),character:"↓"},{title:e("leftwards double arrow"),character:"⇐"},{title:e("rightwards double arrow"),character:"⇒"},{title:e("upwards double arrow"),character:"⇑"},{title:e("downwards double arrow"),character:"⇓"},{title:e("leftwards dashed arrow"),character:"⇠"},{title:e("rightwards dashed arrow"),character:"⇢"},{title:e("upwards dashed arrow"),character:"⇡"},{title:e("downwards dashed arrow"),character:"⇣"},{title:e("leftwards arrow to bar"),character:"⇤"},{title:e("rightwards arrow to bar"),character:"⇥"},{title:e("upwards arrow to bar"),character:"⤒"},{title:e("downwards arrow to bar"),character:"⤓"},{title:e("up down arrow with base"),character:"↨"},{title:e("back with leftwards arrow above"),character:"🔙"},{title:e("end with leftwards arrow above"),character:"🔚"},{title:e("on with exclamation mark with left right arrow above"),character:"🔛"},{title:e("soon with rightwards arrow above"),character:"🔜"},{title:e("top with upwards arrow above"),character:"🔝"}],{label:e("Arrows")})}}class Qv extends ur{static get pluginName(){return"SpecialCharactersCurrency"}init(){const t=this.editor,e=t.t;t.plugins.get("SpecialCharacters").addItems("Currency",[{character:"$",title:e("Dollar sign")},{character:"€",title:e("Euro sign")},{character:"¥",title:e("Yen sign")},{character:"£",title:e("Pound sign")},{character:"¢",title:e("Cent sign")},{character:"₠",title:e("Euro-currency sign")},{character:"₡",title:e("Colon sign")},{character:"₢",title:e("Cruzeiro sign")},{character:"₣",title:e("French franc sign")},{character:"₤",title:e("Lira sign")},{character:"¤",title:e("Currency sign")},{character:"₿",title:e("Bitcoin sign")},{character:"₥",title:e("Mill sign")},{character:"₦",title:e("Naira sign")},{character:"₧",title:e("Peseta sign")},{character:"₨",title:e("Rupee sign")},{character:"₩",title:e("Won sign")},{character:"₪",title:e("New sheqel sign")},{character:"₫",title:e("Dong sign")},{character:"₭",title:e("Kip sign")},{character:"₮",title:e("Tugrik sign")},{character:"₯",title:e("Drachma sign")},{character:"₰",title:e("German penny sign")},{character:"₱",title:e("Peso sign")},{character:"₲",title:e("Guarani sign")},{character:"₳",title:e("Austral sign")},{character:"₴",title:e("Hryvnia sign")},{character:"₵",title:e("Cedi sign")},{character:"₶",title:e("Livre tournois sign")},{character:"₷",title:e("Spesmilo sign")},{character:"₸",title:e("Tenge sign")},{character:"₹",title:e("Indian rupee sign")},{character:"₺",title:e("Turkish lira sign")},{character:"₻",title:e("Nordic mark sign")},{character:"₼",title:e("Manat sign")},{character:"₽",title:e("Ruble sign")}],{label:e("Currency")})}}class Jv extends ur{static get pluginName(){return"SpecialCharactersMathematical"}init(){const t=this.editor,e=t.t;t.plugins.get("SpecialCharacters").addItems("Mathematical",[{character:"<",title:e("Less-than sign")},{character:">",title:e("Greater-than sign")},{character:"≤",title:e("Less-than or equal to")},{character:"≥",title:e("Greater-than or equal to")},{character:"–",title:e("En dash")},{character:"—",title:e("Em dash")},{character:"¯",title:e("Macron")},{character:"‾",title:e("Overline")},{character:"°",title:e("Degree sign")},{character:"−",title:e("Minus sign")},{character:"±",title:e("Plus-minus sign")},{character:"÷",title:e("Division sign")},{character:"⁄",title:e("Fraction slash")},{character:"×",title:e("Multiplication sign")},{character:"ƒ",title:e("Latin small letter f with hook")},{character:"∫",title:e("Integral")},{character:"∑",title:e("N-ary summation")},{character:"∞",title:e("Infinity")},{character:"√",title:e("Square root")},{character:"∼",title:e("Tilde operator")},{character:"≅",title:e("Approximately equal to")},{character:"≈",title:e("Almost equal to")},{character:"≠",title:e("Not equal to")},{character:"≡",title:e("Identical to")},{character:"∈",title:e("Element of")},{character:"∉",title:e("Not an element of")},{character:"∋",title:e("Contains as member")},{character:"∏",title:e("N-ary product")},{character:"∧",title:e("Logical and")},{character:"∨",title:e("Logical or")},{character:"¬",title:e("Not sign")},{character:"∩",title:e("Intersection")},{character:"∪",title:e("Union")},{character:"∂",title:e("Partial differential")},{character:"∀",title:e("For all")},{character:"∃",title:e("There exists")},{character:"∅",title:e("Empty set")},{character:"∇",title:e("Nabla")},{character:"∗",title:e("Asterisk operator")},{character:"∝",title:e("Proportional to")},{character:"∠",title:e("Angle")},{character:"¼",title:e("Vulgar fraction one quarter")},{character:"½",title:e("Vulgar fraction one half")},{character:"¾",title:e("Vulgar fraction three quarters")}],{label:e("Mathematical")})}}class Xv extends ur{static get pluginName(){return"SpecialCharactersLatin"}init(){const t=this.editor,e=t.t;t.plugins.get("SpecialCharacters").addItems("Latin",[{character:"Ā",title:e("Latin capital letter a with macron")},{character:"ā",title:e("Latin small letter a with macron")},{character:"Ă",title:e("Latin capital letter a with breve")},{character:"ă",title:e("Latin small letter a with breve")},{character:"Ą",title:e("Latin capital letter a with ogonek")},{character:"ą",title:e("Latin small letter a with ogonek")},{character:"Ć",title:e("Latin capital letter c with acute")},{character:"ć",title:e("Latin small letter c with acute")},{character:"Ĉ",title:e("Latin capital letter c with circumflex")},{character:"ĉ",title:e("Latin small letter c with circumflex")},{character:"Ċ",title:e("Latin capital letter c with dot above")},{character:"ċ",title:e("Latin small letter c with dot above")},{character:"Č",title:e("Latin capital letter c with caron")},{character:"č",title:e("Latin small letter c with caron")},{character:"Ď",title:e("Latin capital letter d with caron")},{character:"ď",title:e("Latin small letter d with caron")},{character:"Đ",title:e("Latin capital letter d with stroke")},{character:"đ",title:e("Latin small letter d with stroke")},{character:"Ē",title:e("Latin capital letter e with macron")},{character:"ē",title:e("Latin small letter e with macron")},{character:"Ĕ",title:e("Latin capital letter e with breve")},{character:"ĕ",title:e("Latin small letter e with breve")},{character:"Ė",title:e("Latin capital letter e with dot above")},{character:"ė",title:e("Latin small letter e with dot above")},{character:"Ę",title:e("Latin capital letter e with ogonek")},{character:"ę",title:e("Latin small letter e with ogonek")},{character:"Ě",title:e("Latin capital letter e with caron")},{character:"ě",title:e("Latin small letter e with caron")},{character:"Ĝ",title:e("Latin capital letter g with circumflex")},{character:"ĝ",title:e("Latin small letter g with circumflex")},{character:"Ğ",title:e("Latin capital letter g with breve")},{character:"ğ",title:e("Latin small letter g with breve")},{character:"Ġ",title:e("Latin capital letter g with dot above")},{character:"ġ",title:e("Latin small letter g with dot above")},{character:"Ģ",title:e("Latin capital letter g with cedilla")},{character:"ģ",title:e("Latin small letter g with cedilla")},{character:"Ĥ",title:e("Latin capital letter h with circumflex")},{character:"ĥ",title:e("Latin small letter h with circumflex")},{character:"Ħ",title:e("Latin capital letter h with stroke")},{character:"ħ",title:e("Latin small letter h with stroke")},{character:"Ĩ",title:e("Latin capital letter i with tilde")},{character:"ĩ",title:e("Latin small letter i with tilde")},{character:"Ī",title:e("Latin capital letter i with macron")},{character:"ī",title:e("Latin small letter i with macron")},{character:"Ĭ",title:e("Latin capital letter i with breve")},{character:"ĭ",title:e("Latin small letter i with breve")},{character:"Į",title:e("Latin capital letter i with ogonek")},{character:"į",title:e("Latin small letter i with ogonek")},{character:"İ",title:e("Latin capital letter i with dot above")},{character:"ı",title:e("Latin small letter dotless i")},{character:"IJ",title:e("Latin capital ligature ij")},{character:"ij",title:e("Latin small ligature ij")},{character:"Ĵ",title:e("Latin capital letter j with circumflex")},{character:"ĵ",title:e("Latin small letter j with circumflex")},{character:"Ķ",title:e("Latin capital letter k with cedilla")},{character:"ķ",title:e("Latin small letter k with cedilla")},{character:"ĸ",title:e("Latin small letter kra")},{character:"Ĺ",title:e("Latin capital letter l with acute")},{character:"ĺ",title:e("Latin small letter l with acute")},{character:"Ļ",title:e("Latin capital letter l with cedilla")},{character:"ļ",title:e("Latin small letter l with cedilla")},{character:"Ľ",title:e("Latin capital letter l with caron")},{character:"ľ",title:e("Latin small letter l with caron")},{character:"Ŀ",title:e("Latin capital letter l with middle dot")},{character:"ŀ",title:e("Latin small letter l with middle dot")},{character:"Ł",title:e("Latin capital letter l with stroke")},{character:"ł",title:e("Latin small letter l with stroke")},{character:"Ń",title:e("Latin capital letter n with acute")},{character:"ń",title:e("Latin small letter n with acute")},{character:"Ņ",title:e("Latin capital letter n with cedilla")},{character:"ņ",title:e("Latin small letter n with cedilla")},{character:"Ň",title:e("Latin capital letter n with caron")},{character:"ň",title:e("Latin small letter n with caron")},{character:"ʼn",title:e("Latin small letter n preceded by apostrophe")},{character:"Ŋ",title:e("Latin capital letter eng")},{character:"ŋ",title:e("Latin small letter eng")},{character:"Ō",title:e("Latin capital letter o with macron")},{character:"ō",title:e("Latin small letter o with macron")},{character:"Ŏ",title:e("Latin capital letter o with breve")},{character:"ŏ",title:e("Latin small letter o with breve")},{character:"Ő",title:e("Latin capital letter o with double acute")},{character:"ő",title:e("Latin small letter o with double acute")},{character:"Œ",title:e("Latin capital ligature oe")},{character:"œ",title:e("Latin small ligature oe")},{character:"Ŕ",title:e("Latin capital letter r with acute")},{character:"ŕ",title:e("Latin small letter r with acute")},{character:"Ŗ",title:e("Latin capital letter r with cedilla")},{character:"ŗ",title:e("Latin small letter r with cedilla")},{character:"Ř",title:e("Latin capital letter r with caron")},{character:"ř",title:e("Latin small letter r with caron")},{character:"Ś",title:e("Latin capital letter s with acute")},{character:"ś",title:e("Latin small letter s with acute")},{character:"Ŝ",title:e("Latin capital letter s with circumflex")},{character:"ŝ",title:e("Latin small letter s with circumflex")},{character:"Ş",title:e("Latin capital letter s with cedilla")},{character:"ş",title:e("Latin small letter s with cedilla")},{character:"Š",title:e("Latin capital letter s with caron")},{character:"š",title:e("Latin small letter s with caron")},{character:"Ţ",title:e("Latin capital letter t with cedilla")},{character:"ţ",title:e("Latin small letter t with cedilla")},{character:"Ť",title:e("Latin capital letter t with caron")},{character:"ť",title:e("Latin small letter t with caron")},{character:"Ŧ",title:e("Latin capital letter t with stroke")},{character:"ŧ",title:e("Latin small letter t with stroke")},{character:"Ũ",title:e("Latin capital letter u with tilde")},{character:"ũ",title:e("Latin small letter u with tilde")},{character:"Ū",title:e("Latin capital letter u with macron")},{character:"ū",title:e("Latin small letter u with macron")},{character:"Ŭ",title:e("Latin capital letter u with breve")},{character:"ŭ",title:e("Latin small letter u with breve")},{character:"Ů",title:e("Latin capital letter u with ring above")},{character:"ů",title:e("Latin small letter u with ring above")},{character:"Ű",title:e("Latin capital letter u with double acute")},{character:"ű",title:e("Latin small letter u with double acute")},{character:"Ų",title:e("Latin capital letter u with ogonek")},{character:"ų",title:e("Latin small letter u with ogonek")},{character:"Ŵ",title:e("Latin capital letter w with circumflex")},{character:"ŵ",title:e("Latin small letter w with circumflex")},{character:"Ŷ",title:e("Latin capital letter y with circumflex")},{character:"ŷ",title:e("Latin small letter y with circumflex")},{character:"Ÿ",title:e("Latin capital letter y with diaeresis")},{character:"Ź",title:e("Latin capital letter z with acute")},{character:"ź",title:e("Latin small letter z with acute")},{character:"Ż",title:e("Latin capital letter z with dot above")},{character:"ż",title:e("Latin small letter z with dot above")},{character:"Ž",title:e("Latin capital letter z with caron")},{character:"ž",title:e("Latin small letter z with caron")},{character:"ſ",title:e("Latin small letter long s")}],{label:e("Latin")})}}class ty extends ur{static get pluginName(){return"SpecialCharactersText"}init(){const t=this.editor,e=t.t;t.plugins.get("SpecialCharacters").addItems("Text",[{character:"‹",title:e("Single left-pointing angle quotation mark")},{character:"›",title:e("Single right-pointing angle quotation mark")},{character:"«",title:e("Left-pointing double angle quotation mark")},{character:"»",title:e("Right-pointing double angle quotation mark")},{character:"‘",title:e("Left single quotation mark")},{character:"’",title:e("Right single quotation mark")},{character:"“",title:e("Left double quotation mark")},{character:"”",title:e("Right double quotation mark")},{character:"‚",title:e("Single low-9 quotation mark")},{character:"„",title:e("Double low-9 quotation mark")},{character:"¡",title:e("Inverted exclamation mark")},{character:"¿",title:e("Inverted question mark")},{character:"‥",title:e("Two dot leader")},{character:"…",title:e("Horizontal ellipsis")},{character:"‡",title:e("Double dagger")},{character:"‰",title:e("Per mille sign")},{character:"‱",title:e("Per ten thousand sign")},{character:"‼",title:e("Double exclamation mark")},{character:"⁈",title:e("Question exclamation mark")},{character:"⁉",title:e("Exclamation question mark")},{character:"⁇",title:e("Double question mark")},{character:"©",title:e("Copyright sign")},{character:"®",title:e("Registered sign")},{character:"™",title:e("Trade mark sign")},{character:"§",title:e("Section sign")},{character:"¶",title:e("Paragraph sign")},{character:"⁋",title:e("Reversed paragraph sign")}],{label:e("Text")})}}const ey="strikethrough";class ny extends ur{static get pluginName(){return"StrikethroughEditing"}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:ey}),t.model.schema.setAttributeProperties(ey,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:ey,view:"s",upcastAlso:["del","strike",{styles:{"text-decoration":"line-through"}}]}),t.commands.add(ey,new ib(t,ey)),t.keystrokes.set("CTRL+SHIFT+X","strikethrough")}}const iy="strikethrough";class oy extends ur{static get pluginName(){return"StrikethroughUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add(iy,(n=>{const i=t.commands.get(iy),o=new Ao(n);return o.set({label:e("Strikethrough"),icon:' ',keystroke:"CTRL+SHIFT+X",tooltip:!0,isToggleable:!0}),o.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(o,"execute",(()=>{t.execute(iy),t.editing.view.focus()})),o}))}}class ry extends Ao{constructor(t,e){super(t),this.styleDefinition=e,this.previewView=this._createPreview(),this.set({label:e.name,class:"ck-style-grid__button",withText:!0}),this.extendTemplate({attributes:{role:"option"}}),this.children.add(this.previewView,0)}_createPreview(){const t=new $i(this.locale);return t.setTemplate({tag:"div",attributes:{class:["ck","ck-reset_all-excluded","ck-style-grid__button__preview","ck-content"],"aria-hidden":"true"},children:[this.styleDefinition.previewTemplate]}),t}}var sy=n(3875);Wi()(sy.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),sy.Z.locals;class ay extends $i{constructor(t,e){super(t),this.focusTracker=new Li,this.keystrokes=new Pi,this.set("activeStyles",[]),this.set("enabledStyles",[]),this.children=this.createCollection(),this.children.delegate("execute").to(this);for(const n of e){const e=new ry(t,n);this.children.add(e)}this.on("change:activeStyles",(()=>{for(const t of this.children)t.isOn=this.activeStyles.includes(t.styleDefinition.name)})),this.on("change:enabledStyles",(()=>{for(const t of this.children)t.isEnabled=this.enabledStyles.includes(t.styleDefinition.name)})),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-grid"],role:"listbox"},children:this.children})}render(){super.render();for(const t of this.children)this.focusTracker.add(t.element);r({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.children,numberOfColumns:3,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection}),this.keystrokes.listenTo(this.element)}focus(){this.children.first.focus()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}}var ly=n(9545);Wi()(ly.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),ly.Z.locals;class cy extends $i{constructor(t,e,n){super(t),this.labelView=new Yo(t),this.labelView.text=e,this.gridView=new ay(t,n),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-panel__style-group"],role:"group","aria-labelledby":this.labelView.id},children:[this.labelView,this.gridView]})}}var dy=n(6746);Wi()(dy.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),dy.Z.locals;class hy extends $i{constructor(t,e){super(t);const n=t.t;this.focusTracker=new Li,this.keystrokes=new Pi,this.children=this.createCollection(),this.blockStylesGroupView=new cy(t,n("Block styles"),e.block),this.inlineStylesGroupView=new cy(t,n("Text styles"),e.inline),this.set("activeStyles",[]),this.set("enabledStyles",[]),this._focusables=new Ui,this._focusCycler=new ar({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:["shift + tab"],focusNext:["tab"]}}),e.block.length&&this.children.add(this.blockStylesGroupView),e.inline.length&&this.children.add(this.inlineStylesGroupView),this.blockStylesGroupView.gridView.delegate("execute").to(this),this.inlineStylesGroupView.gridView.delegate("execute").to(this),this.blockStylesGroupView.gridView.bind("activeStyles","enabledStyles").to(this,"activeStyles","enabledStyles"),this.inlineStylesGroupView.gridView.bind("activeStyles","enabledStyles").to(this,"activeStyles","enabledStyles"),this.setTemplate({tag:"div",attributes:{class:["ck","ck-style-panel"]},children:this.children})}render(){super.render(),this._focusables.add(this.blockStylesGroupView.gridView),this._focusables.add(this.inlineStylesGroupView.gridView),this.focusTracker.add(this.blockStylesGroupView.gridView.element),this.focusTracker.add(this.inlineStylesGroupView.gridView.element),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}const uy=["caption","colgroup","dd","dt","figcaption","legend","li","optgroup","option","rp","rt","summary","tbody","td","tfoot","th","thead","tr"];class my extends ur{static get pluginName(){return"StyleUtils"}constructor(t){super(t),this.decorate("isStyleEnabledForBlock"),this.decorate("isStyleActiveForBlock"),this.decorate("getAffectedBlocks"),this.decorate("isStyleEnabledForInlineSelection"),this.decorate("isStyleActiveForInlineSelection"),this.decorate("getAffectedInlineSelectable"),this.decorate("getStylePreview"),this.decorate("configureGHSDataFilter")}init(){this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport")}normalizeConfig(t,e=[]){const n={block:[],inline:[]};for(const i of e){const e=[],o=[];for(const n of t.getDefinitionsForView(i.element)){const t="appliesToBlock"in n&&n.appliesToBlock;if(n.isBlock||t){if("string"==typeof t)e.push(t);else if(n.isBlock){const t=n;e.push(n.model),t.paragraphLikeModel&&e.push(t.paragraphLikeModel)}}else o.push(n.model)}const r=this.getStylePreview(i,[{text:"AaBbCcDdEeFfGgHhIiJj"}]);e.length?n.block.push({...i,previewTemplate:r,modelElements:e,isBlock:!0}):n.inline.push({...i,previewTemplate:r,ghsAttributes:o})}return n}isStyleEnabledForBlock(t,e){const n=this.editor.model,i=this._htmlSupport.getGhsAttributeNameForElement(t.element);return!!n.schema.checkAttribute(e,i)&&t.modelElements.includes(e.name)}isStyleActiveForBlock(t,e){const n=this._htmlSupport.getGhsAttributeNameForElement(t.element),i=e.getAttribute(n);return this.hasAllClasses(i,t.classes)}getAffectedBlocks(t,e){return t.modelElements.includes(e.name)?[e]:null}isStyleEnabledForInlineSelection(t,e){const n=this.editor.model;for(const i of t.ghsAttributes)if(n.schema.checkAttributeInSelection(e,i))return!0;return!1}isStyleActiveForInlineSelection(t,e){for(const n of t.ghsAttributes){const i=this._getValueFromFirstAllowedNode(e,n);if(this.hasAllClasses(i,t.classes))return!0}return!1}getAffectedInlineSelectable(t,e){return e}getStylePreview(t,e){const{element:n,classes:i}=t;return{tag:(o=n,uy.includes(o)?"div":n),attributes:{class:i},children:e};var o}hasAllClasses(t,e){return R(t)&&(n=t,Boolean(n.classes)&&Array.isArray(n.classes))&&e.every((e=>t.classes.includes(e)));var n}configureGHSDataFilter({block:t,inline:e}){const n=this.editor.plugins.get("DataFilter");n.loadAllowedConfig(t.map(gy)),n.loadAllowedConfig(e.map(gy))}_getValueFromFirstAllowedNode(t,e){const n=this.editor.model.schema;if(t.isCollapsed)return t.getAttribute(e);for(const i of t.getRanges())for(const t of i.getItems())if(n.checkAttribute(t,e))return t.getAttribute(e);return null}}function gy({element:t,classes:e}){return{name:t,classes:e}}var py=n(2844);Wi()(py.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),py.Z.locals;class fy extends ur{static get pluginName(){return"StyleUI"}static get requires(){return[my]}init(){const t=this.editor,e=t.plugins.get("DataSchema"),n=t.plugins.get("StyleUtils"),i=t.config.get("style.definitions"),o=n.normalizeConfig(e,i);t.ui.componentFactory.add("style",(e=>{const n=e.t,i=wu(e),r=t.commands.get("style");return i.once("change:isOpen",(()=>{const t=new hy(e,o);i.panelView.children.add(t),t.delegate("execute").to(i),t.bind("activeStyles").to(r,"value"),t.bind("enabledStyles").to(r,"enabledStyles")})),i.bind("isEnabled").to(r),i.buttonView.withText=!0,i.buttonView.bind("label").to(r,"value",(t=>t.length>1?n("Multiple styles"):1===t.length?t[0]:n("Styles"))),i.bind("class").to(r,"value",(t=>{const e=["ck-style-dropdown"];return t.length>1&&e.push("ck-style-dropdown_multiple-active"),e.join(" ")})),i.on("execute",(e=>{t.execute("style",{styleName:e.source.styleDefinition.name}),t.editing.view.focus()})),i}))}}class by extends gr{constructor(t,e){super(t),this.set("value",[]),this.set("enabledStyles",[]),this._styleDefinitions=e,this._styleUtils=this.editor.plugins.get(my)}refresh(){const t=this.editor.model,e=t.document.selection,n=new Set,i=new Set;for(const t of this._styleDefinitions.inline)this._styleUtils.isStyleEnabledForInlineSelection(t,e)&&i.add(t.name),this._styleUtils.isStyleActiveForInlineSelection(t,e)&&n.add(t.name);const o=zi(e.getSelectedBlocks())||e.getFirstPosition().parent;if(o){const e=o.getAncestors({includeSelf:!0,parentFirst:!0});for(const o of e){if(o.is("rootElement"))break;for(const t of this._styleDefinitions.block)this._styleUtils.isStyleEnabledForBlock(t,o)&&(i.add(t.name),this._styleUtils.isStyleActiveForBlock(t,o)&&n.add(t.name));if(t.schema.isObject(o))break}}this.enabledStyles=Array.from(i).sort(),this.isEnabled=this.enabledStyles.length>0,this.value=this.isEnabled?Array.from(n).sort():[]}execute({styleName:t,forceValue:e}){if(!this.enabledStyles.includes(t))return void C("style-command-executed-with-incorrect-style-name");const n=this.editor.model,i=n.document.selection,o=this.editor.plugins.get("GeneralHtmlSupport"),r=[...this._styleDefinitions.inline,...this._styleDefinitions.block],s=r.filter((({name:t})=>this.value.includes(t))),a=r.find((({name:e})=>e==t)),l=void 0===e?!this.value.includes(a.name):e;n.change((()=>{let t;t=function(t){return"isBlock"in t}(a)?this._findAffectedBlocks(function(t){const e=Array.from(t.getSelectedBlocks());return e.length?e:[t.getFirstPosition().parent]}(i),a):[this._styleUtils.getAffectedInlineSelectable(a,i)];for(const e of t)l?o.addModelHtmlClass(a.element,a.classes,e):o.removeModelHtmlClass(a.element,ky(s,a),e)}))}_findAffectedBlocks(t,e){const n=new Set;for(const i of t){const t=i.getAncestors({includeSelf:!0,parentFirst:!0});for(const i of t){if(i.is("rootElement"))break;const t=this._styleUtils.getAffectedBlocks(e,i);if(t){for(const e of t)n.add(e);break}}}return n}}function ky(t,e){return t.reduce(((t,n)=>n.name===e.name?t:t.filter((t=>!n.classes.includes(t)))),e.classes)}class wy extends ur{static get pluginName(){return"DocumentListStyleSupport"}static get requires(){return[my,"GeneralHtmlSupport"]}init(){const t=this.editor;t.plugins.has("DocumentListEditing")&&(this._styleUtils=t.plugins.get(my),this._documentListUtils=this.editor.plugins.get("DocumentListUtils"),this._htmlSupport=this.editor.plugins.get("GeneralHtmlSupport"),this.listenTo(this._styleUtils,"isStyleEnabledForBlock",((t,[e,n])=>{this._isStyleEnabledForBlock(e,n)&&(t.return=!0,t.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"isStyleActiveForBlock",((t,[e,n])=>{this._isStyleActiveForBlock(e,n)&&(t.return=!0,t.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedBlocks",((t,[e,n])=>{const i=this._getAffectedBlocks(e,n);i&&(t.return=i,t.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"getStylePreview",((t,[e,n])=>{const i=this._getStylePreview(e,n);i&&(t.return=i,t.stop())}),{priority:"high"}))}_isStyleEnabledForBlock(t,e){const n=this.editor.model;if(!["ol","ul","li"].includes(t.element))return!1;if(!this._documentListUtils.isListItemBlock(e))return!1;const i=this._htmlSupport.getGhsAttributeNameForElement(t.element);if("ol"==t.element||"ul"==t.element){if(!n.schema.checkAttribute(e,i))return!1;const o="numbered"==e.getAttribute("listType")?"ol":"ul";return t.element==o}return n.schema.checkAttribute(e,i)}_isStyleActiveForBlock(t,e){const n=this._htmlSupport.getGhsAttributeNameForElement(t.element),i=e.getAttribute(n);return this._styleUtils.hasAllClasses(i,t.classes)}_getAffectedBlocks(t,e){return this._isStyleEnabledForBlock(t,e)?"li"==t.element?this._documentListUtils.expandListBlocksToCompleteItems(e,{withNested:!1}):this._documentListUtils.expandListBlocksToCompleteList(e):null}_getStylePreview(t,e){const{element:n,classes:i}=t;return"ol"==n||"ul"==n?{tag:n,attributes:{class:i},children:[{tag:"li",children:e}]}:"li"==n?{tag:"ol",children:[{tag:n,attributes:{class:i},children:e}]}:null}}class Ay extends ur{static get pluginName(){return"TableStyleSupport"}static get requires(){return[my]}init(){const t=this.editor;t.plugins.has("TableEditing")&&(this._styleUtils=t.plugins.get(my),this._tableUtils=this.editor.plugins.get("TableUtils"),this.listenTo(this._styleUtils,"isStyleEnabledForBlock",((t,[e,n])=>{this._isApplicable(e,n)&&(t.return=this._isStyleEnabledForBlock(e,n),t.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedBlocks",((t,[e,n])=>{this._isApplicable(e,n)&&(t.return=this._getAffectedBlocks(e,n),t.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"configureGHSDataFilter",((t,[{block:e}])=>{this.editor.plugins.get("DataFilter").loadAllowedConfig(e.filter((t=>"figcaption"==t.element)).map((t=>({name:"caption",classes:t.classes}))))})))}_isApplicable(t,e){return["td","th"].includes(t.element)?"tableCell"==e.name:!!["thead","tbody"].includes(t.element)&&"table"==e.name}_isStyleEnabledForBlock(t,e){if(["td","th"].includes(t.element)){const n=this._tableUtils.getCellLocation(e),i=e.parent.parent,o=i.getAttribute("headingRows")||0,r=i.getAttribute("headingColumns")||0,s=n.row0:n{"a"==e.element&&(t.return=this._isStyleEnabled(e,n),t.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"isStyleActiveForInlineSelection",((t,[e,n])=>{"a"==e.element&&(t.return=this._isStyleActive(e,n),t.stop())}),{priority:"high"}),this.listenTo(this._styleUtils,"getAffectedInlineSelectable",((t,[e,n])=>{if("a"!=e.element)return;const i=this._getAffectedSelectable(e,n);i&&(t.return=i,t.stop())}),{priority:"high"}))}_isStyleEnabled(t,e){const n=this.editor.model;if(e.isCollapsed)return e.hasAttribute("linkHref");for(const t of e.getRanges())for(const e of t.getItems())if((e.is("$textProxy")||n.schema.isInline(e))&&e.hasAttribute("linkHref"))return!0;return!1}_isStyleActive(t,e){const n=this.editor.model,i=this._htmlSupport.getGhsAttributeNameForElement(t.element);if(e.isCollapsed){if(e.hasAttribute("linkHref")){const n=e.getAttribute(i);if(this._styleUtils.hasAllClasses(n,t.classes))return!0}return!1}for(const o of e.getRanges())for(const e of o.getItems())if((e.is("$textProxy")||n.schema.isInline(e))&&e.hasAttribute("linkHref")){const n=e.getAttribute(i);return this._styleUtils.hasAllClasses(n,t.classes)}return!1}_getAffectedSelectable(t,e){const n=this.editor.model;if(e.isCollapsed){const t=e.getAttribute("linkHref");return Zg(e.getFirstPosition(),"linkHref",t,n)}const i=[];for(const t of e.getRanges()){const e=n.createRange(_y(t.start,"linkHref",!0,n),_y(t.end,"linkHref",!1,n));for(const t of e.getItems())(t.is("$textProxy")||n.schema.isInline(t))&&t.hasAttribute("linkHref")&&i.push(this.editor.model.createRangeOn(t))}return function(t){for(let e=1;e{const i=t.commands.get(Ey),o=new Ao(n);return o.set({label:e("Subscript"),icon:' ',tooltip:!0,isToggleable:!0}),o.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(o,"execute",(()=>{t.execute(Ey),t.editing.view.focus()})),o}))}}const Sy="superscript";class Ty extends ur{static get pluginName(){return"SuperscriptEditing"}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:Sy}),t.model.schema.setAttributeProperties(Sy,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:Sy,view:"sup",upcastAlso:[{styles:{"vertical-align":"super"}}]}),t.commands.add(Sy,new ib(t,Sy))}}const Iy="superscript";class By extends ur{static get pluginName(){return"SuperscriptUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add(Iy,(n=>{const i=t.commands.get(Iy),o=new Ao(n);return o.set({label:e("Superscript"),icon:' ',tooltip:!0,isToggleable:!0}),o.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(o,"execute",(()=>{t.execute(Iy),t.editing.view.focus()})),o}))}}function My(t,e){const{modelAttribute:n,styleName:i,viewElement:o,defaultValue:r,reduceBoxSides:s=!1,shouldUpcast:a=(()=>!0)}=e;t.for("upcast").attributeToAttribute({view:{name:o,styles:{[i]:/[\s\S]+/}},model:{key:n,value:t=>{if(!a(t))return;const e=t.getNormalizedStyle(i),n=s?Py(e):e;return r!==n?n:void 0}}})}function Ny(t,e,n,i){t.for("upcast").add((t=>t.on("element:"+e,((t,e,o)=>{if(!e.modelRange)return;const r=["border-top-width","border-top-color","border-top-style","border-bottom-width","border-bottom-color","border-bottom-style","border-right-width","border-right-color","border-right-style","border-left-width","border-left-color","border-left-style"].filter((t=>e.viewItem.hasStyle(t)));if(!r.length)return;const s={styles:r};if(!o.consumable.test(e.viewItem,s))return;const a=[...e.modelRange.getItems({shallow:!0})].pop();o.consumable.consume(e.viewItem,s);const l={style:e.viewItem.getNormalizedStyle("border-style"),color:e.viewItem.getNormalizedStyle("border-color"),width:e.viewItem.getNormalizedStyle("border-width")},c={style:Py(l.style),color:Py(l.color),width:Py(l.width)};c.style!==i.style&&o.writer.setAttribute(n.style,c.style,a),c.color!==i.color&&o.writer.setAttribute(n.color,c.color,a),c.width!==i.width&&o.writer.setAttribute(n.width,c.width,a)}))))}function zy(t,e){const{modelElement:n,modelAttribute:i,styleName:o}=e;t.for("downcast").attributeToAttribute({model:{name:n,key:i},view:t=>({key:"style",value:{[o]:t}})})}function Ly(t,e){const{modelAttribute:n,styleName:i}=e;t.for("downcast").add((t=>t.on(`attribute:${n}:table`,((t,e,n)=>{const{item:o,attributeNewValue:r}=e,{mapper:s,writer:a}=n;if(!n.consumable.consume(e.item,t.name))return;const l=[...s.toViewElement(o).getChildren()].find((t=>t.is("element","table")));r?a.setStyle(i,r,l):a.removeStyle(i,l)}))))}function Py(t){if(!t)return;const e=["top","right","bottom","left"];if(!e.every((e=>t[e])))return t;const n=t.top;return e.every((e=>t[e]===n))?n:t}function Ry(t,e,n,i,o=1){null!=e&&null!=o&&e>o?i.setAttribute(t,e,n):i.removeAttribute(t,n)}function Oy(t,e,n={}){const i=t.createElement("tableCell",n);return t.insertElement("paragraph",i),t.insert(i,e),i}function Vy(t,e){const n=e.parent.parent,i=parseInt(n.getAttribute("headingColumns")||"0"),{column:o}=t.getCellLocation(e);return!!i&&o{e.on(`element:${t}`,((t,e,{writer:n})=>{if(!e.modelRange)return;const i=e.modelRange.start.nodeAfter,o=n.createPositionAt(i,0);if(e.viewItem.isEmpty)return void n.insertElement("paragraph",o);const r=Array.from(i.getChildren());if(r.every((t=>t.is("element","$marker")))){const t=n.createElement("paragraph");n.insert(t,n.createPositionAt(i,0));for(const e of r)n.move(n.createRangeOn(e),n.createPositionAt(t,"end"))}}),{priority:"low"})}}function Hy(t){let e=0,n=0;const i=Array.from(t.getChildren()).filter((t=>"th"===t.name||"td"===t.name));for(;n1||o>1)&&this._recordSpans(n,o,i),this._shouldSkipSlot()||(e=this._formatOutValue(n)),this._nextCellAtColumn=this._column+i}return this._column++,this._column==this._nextCellAtColumn&&this._cellIndex++,e||this.next()}skipRow(t){this._skipRows.add(t)}_advanceToNextRow(){return this._row++,this._rowIndex++,this._column=0,this._cellIndex=0,this._nextCellAtColumn=-1,this.next()}_isOverEndRow(){return void 0!==this._endRow&&this._row>this._endRow}_isOverEndColumn(){return void 0!==this._endColumn&&this._column>this._endColumn}_formatOutValue(t,e=this._row,n=this._column){return{done:!1,value:new Gy(this,t,e,n)}}_shouldSkipSlot(){const t=this._skipRows.has(this._row),e=this._rowthis._endColumn;return t||e||n||i}_getSpanned(){const t=this._spannedCells.get(this._row);return t&&t.get(this._column)||null}_recordSpans(t,e,n){const i={cell:t,row:this._row,column:this._column};for(let t=this._row;t{const o=n.getAttribute("headingRows")||0,r=i.createContainerElement("table",null,[]),s=i.createContainerElement("figure",{class:"table"},r);o>0&&i.insert(i.createPositionAt(r,"end"),i.createContainerElement("thead",null,i.createSlot((t=>t.is("element","tableRow")&&t.indext.is("element","tableRow")&&t.index>=o))));for(const{positionOffset:t,filter:n}of e.additionalSlots)i.insert(i.createPositionAt(r,t),i.createSlot(n));return i.insert(i.createPositionAt(r,"after"),i.createSlot((t=>!t.is("element","tableRow")&&!e.additionalSlots.some((({filter:e})=>e(t)))))),e.asWidget?function(t,e){return e.setCustomProperty("table",!0,t),bp(t,e,{hasSelectionHandle:!0})}(s,i):s}}function qy(t={}){return(e,{writer:n})=>{const i=e.parent,o=i.parent,r=o.getChildIndex(i),s=new Uy(o,{row:r}),a=o.getAttribute("headingRows")||0,l=o.getAttribute("headingColumns")||0;let c=null;for(const i of s)if(i.cell==e){const e=i.row{if(!e.parent.is("element","tableCell"))return null;if(!Ky(e))return null;if(t.asWidget)return n.createContainerElement("span",{class:"ck-table-bogus-paragraph"});{const t=n.createContainerElement("p");return n.setCustomProperty("dataPipeline:transparentRendering",!0,t),t}}}function Ky(t){return 1==t.parent.childCount&&!!t.getAttributeKeys().next().done}class Yy extends gr{refresh(){const t=this.editor.model,e=t.document.selection,n=t.schema;this.isEnabled=function(t,e){const n=t.getFirstPosition().parent,i=n===n.root?n:n.parent;return e.checkChild(i,"table")}(e,n)}execute(t={}){const e=this.editor,n=e.model,i=e.plugins.get("TableUtils"),o=e.config.get("table.defaultHeadings.rows"),r=e.config.get("table.defaultHeadings.columns");void 0===t.headingRows&&o&&(t.headingRows=o),void 0===t.headingColumns&&r&&(t.headingColumns=r),n.change((e=>{const o=i.createTable(e,t);n.insertObject(o,null,null,{findOptimalPosition:"auto"}),e.setSelection(e.createPositionAt(o.getNodeByPath([0,0,0]),0))}))}}class Zy extends gr{constructor(t,e={}){super(t),this.order=e.order||"below"}refresh(){const t=this.editor.model.document.selection,e=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(t).length;this.isEnabled=e}execute(){const t=this.editor,e=t.model.document.selection,n=t.plugins.get("TableUtils"),i="above"===this.order,o=n.getSelectionAffectedTableCells(e),r=n.getRowIndexes(o),s=i?r.first:r.last,a=o[0].findAncestor("table");n.insertRows(a,{at:i?s:s+1,copyStructureFromAbove:!i})}}class Qy extends gr{constructor(t,e={}){super(t),this.order=e.order||"right"}refresh(){const t=this.editor.model.document.selection,e=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(t).length;this.isEnabled=e}execute(){const t=this.editor,e=t.model.document.selection,n=t.plugins.get("TableUtils"),i="left"===this.order,o=n.getSelectionAffectedTableCells(e),r=n.getColumnIndexes(o),s=i?r.first:r.last,a=o[0].findAncestor("table");n.insertColumns(a,{columns:1,at:i?s:s+1})}}class Jy extends gr{constructor(t,e={}){super(t),this.direction=e.direction||"horizontally"}refresh(){const t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=1===t.length}execute(){const t=this.editor.plugins.get("TableUtils"),e=t.getSelectionAffectedTableCells(this.editor.model.document.selection)[0];"horizontally"===this.direction?t.splitCellHorizontally(e,2):t.splitCellVertically(e,2)}}function Xy(t,e,n){const{startRow:i,startColumn:o,endRow:r,endColumn:s}=e,a=n.createElement("table"),l=r-i+1;for(let t=0;t0&&Ry("headingRows",r-n,t,o,0);const s=parseInt(e.getAttribute("headingColumns")||"0");s>0&&Ry("headingColumns",s-i,t,o,0)}(a,t,i,o,n),a}function tx(t,e,n=0){const i=[],o=new Uy(t,{startRow:n,endRow:e-1});for(const t of o){const{row:n,cellHeight:o}=t;n1&&(a.rowspan=l);const c=parseInt(t.getAttribute("colspan")||"1");c>1&&(a.colspan=c);const d=r+s,h=[...new Uy(o,{startRow:r,endRow:d,includeAllSlots:!0})];let u,m=null;for(const e of h){const{row:i,column:o,cell:r}=e;r===t&&void 0===u&&(u=o),void 0!==u&&u===o&&i===d&&(m=Oy(n,e.getPositionBefore(),a))}return Ry("rowspan",s,t,n),m}function nx(t,e){const n=[],i=new Uy(t);for(const t of i){const{column:i,cellWidth:o}=t;i1&&(r.colspan=s);const a=parseInt(t.getAttribute("rowspan")||"1");a>1&&(r.rowspan=a);const l=Oy(i,i.createPositionAfter(t),r);return Ry("colspan",o,t,i),l}function ox(t,e,n,i,o,r){const s=parseInt(t.getAttribute("colspan")||"1"),a=parseInt(t.getAttribute("rowspan")||"1");n+s-1>o&&Ry("colspan",o-n+1,t,r,1),e+a-1>i&&Ry("rowspan",i-e+1,t,r,1)}function rx(t,e){const n=e.getColumns(t),i=new Array(n).fill(0);for(const{column:e}of new Uy(t))i[e]++;const o=i.reduce(((t,e,n)=>e?t:[...t,n]),[]);if(o.length>0){const n=o[o.length-1];return e.removeColumns(t,{at:n}),!0}return!1}function sx(t,e){const n=[],i=e.getRows(t);for(let e=0;e0){const i=n[n.length-1];return e.removeRows(t,{at:i}),!0}return!1}function ax(t,e){rx(t,e)||sx(t,e)}function lx(t,e){const n=Array.from(new Uy(t,{startColumn:e.firstColumn,endColumn:e.lastColumn,row:e.lastRow}));if(n.every((({cellHeight:t})=>1===t)))return e.lastRow;const i=n[0].cellHeight-1;return e.lastRow+i}function cx(t,e){const n=Array.from(new Uy(t,{startRow:e.firstRow,endRow:e.lastRow,column:e.lastColumn}));if(n.every((({cellWidth:t})=>1===t)))return e.lastColumn;const i=n[0].cellWidth-1;return e.lastColumn+i}class dx extends gr{constructor(t,e){super(t),this.direction=e.direction,this.isHorizontal="right"==this.direction||"left"==this.direction}refresh(){const t=this._getMergeableCell();this.value=t,this.isEnabled=!!t}execute(){const t=this.editor.model,e=t.document,n=this.editor.plugins.get("TableUtils").getTableCellsContainingSelection(e.selection)[0],i=this.value,o=this.direction;t.change((t=>{const e="right"==o||"down"==o,r=e?n:i,s=e?i:n,a=s.parent;!function(t,e,n){hx(t)||(hx(e)&&n.remove(n.createRangeIn(e)),n.move(n.createRangeIn(t),n.createPositionAt(e,"end"))),n.remove(t)}(s,r,t);const l=this.isHorizontal?"colspan":"rowspan",c=parseInt(n.getAttribute(l)||"1"),d=parseInt(i.getAttribute(l)||"1");t.setAttribute(l,c+d,r),t.setSelection(t.createRangeIn(r));const h=this.editor.plugins.get("TableUtils");ax(a.findAncestor("table"),h)}))}_getMergeableCell(){const t=this.editor.model.document,e=this.editor.plugins.get("TableUtils"),n=e.getTableCellsContainingSelection(t.selection)[0];if(!n)return;const i=this.isHorizontal?function(t,e,n){const i=t.parent.parent,o="right"==e?t.nextSibling:t.previousSibling,r=(i.getAttribute("headingColumns")||0)>0;if(!o)return;const s="right"==e?t:o,a="right"==e?o:t,{column:l}=n.getCellLocation(s),{column:c}=n.getCellLocation(a),d=parseInt(s.getAttribute("colspan")||"1"),h=Vy(n,s),u=Vy(n,a);return r&&h!=u?void 0:l+d===c?o:void 0}(n,this.direction,e):function(t,e,n){const i=t.parent,o=i.parent,r=o.getChildIndex(i);if("down"==e&&r===n.getRows(o)-1||"up"==e&&0===r)return null;const s=parseInt(t.getAttribute("rowspan")||"1"),a=o.getAttribute("headingRows")||0;if(a&&("down"==e&&r+s===a||"up"==e&&r===a))return null;const l=parseInt(t.getAttribute("rowspan")||"1"),c="down"==e?r+l:r,d=[...new Uy(o,{endRow:c})],h=d.find((e=>e.cell===t)),u=h.column,m=d.find((({row:t,cellHeight:n,column:i})=>i===u&&("down"==e?t===c:c===t+n)));return m&&m.cell?m.cell:null}(n,this.direction,e);if(!i)return;const o=this.isHorizontal?"rowspan":"colspan",r=parseInt(n.getAttribute(o)||"1");return parseInt(i.getAttribute(o)||"1")===r?i:void 0}}function hx(t){const e=t.getChild(0);return 1==t.childCount&&e.is("element","paragraph")&&e.isEmpty}class ux extends gr{refresh(){const t=this.editor.plugins.get("TableUtils"),e=t.getSelectionAffectedTableCells(this.editor.model.document.selection),n=e[0];if(n){const i=n.findAncestor("table"),o=t.getRows(i)-1,r=t.getRowIndexes(e),s=0===r.first&&r.last===o;this.isEnabled=!s}else this.isEnabled=!1}execute(){const t=this.editor.model,e=this.editor.plugins.get("TableUtils"),n=e.getSelectionAffectedTableCells(t.document.selection),i=e.getRowIndexes(n),o=n[0],r=o.findAncestor("table"),s=e.getCellLocation(o).column;t.change((t=>{const n=i.last-i.first+1;e.removeRows(r,{at:i.first,rows:n});const o=function(t,e,n,i){const o=t.getChild(Math.min(e,i-1));let r=o.getChild(0),s=0;for(const t of o.getChildren()){if(s>n)return r;r=t,s+=parseInt(t.getAttribute("colspan")||"1")}return r}(r,i.first,s,e.getRows(r));t.setSelection(t.createPositionAt(o,0))}))}}class mx extends gr{refresh(){const t=this.editor.plugins.get("TableUtils"),e=t.getSelectionAffectedTableCells(this.editor.model.document.selection),n=e[0];if(n){const i=n.findAncestor("table"),o=t.getColumns(i),{first:r,last:s}=t.getColumnIndexes(e);this.isEnabled=s-rt.cell===e)).column,last:o.find((t=>t.cell===n)).column},s=function(t,e,n,i){return parseInt(n.getAttribute("colspan")||"1")>1?n:e.previousSibling||n.nextSibling?n.nextSibling||e.previousSibling:i.first?t.reverse().find((({column:t})=>tt>i.last)).cell}(o,e,n,r);this.editor.model.change((e=>{const n=r.last-r.first+1;t.removeColumns(i,{at:r.first,columns:n}),e.setSelection(e.createPositionAt(s,0))}))}}class gx extends gr{refresh(){const t=this.editor.plugins.get("TableUtils"),e=this.editor.model,n=t.getSelectionAffectedTableCells(e.document.selection),i=n.length>0;this.isEnabled=i,this.value=i&&n.every((t=>this._isInHeading(t,t.parent.parent)))}execute(t={}){if(t.forceValue===this.value)return;const e=this.editor.plugins.get("TableUtils"),n=this.editor.model,i=e.getSelectionAffectedTableCells(n.document.selection),o=i[0].findAncestor("table"),{first:r,last:s}=e.getRowIndexes(i),a=this.value?r:s+1,l=o.getAttribute("headingRows")||0;n.change((t=>{if(a){const e=tx(o,a,a>l?l:0);for(const{cell:n}of e)ex(n,a,t)}Ry("headingRows",a,o,t,0)}))}_isInHeading(t,e){const n=parseInt(e.getAttribute("headingRows")||"0");return!!n&&t.parent.index0;this.isEnabled=i,this.value=i&&n.every((t=>Vy(e,t)))}execute(t={}){if(t.forceValue===this.value)return;const e=this.editor.plugins.get("TableUtils"),n=this.editor.model,i=e.getSelectionAffectedTableCells(n.document.selection),o=i[0].findAncestor("table"),{first:r,last:s}=e.getColumnIndexes(i),a=this.value?r:s+1;n.change((t=>{if(a){const e=nx(o,a);for(const{cell:n,column:i}of e)ix(n,i,a,t)}Ry("headingColumns",a,o,t,0)}))}}class fx extends ur{static get pluginName(){return"TableUtils"}init(){this.decorate("insertColumns"),this.decorate("insertRows")}getCellLocation(t){const e=t.parent,n=e.parent,i=n.getChildIndex(e),o=new Uy(n,{row:i});for(const{cell:e,row:n,column:i}of o)if(e===t)return{row:n,column:i}}createTable(t,e){const n=t.createElement("table"),i=e.rows||2,o=e.columns||2;return bx(t,n,0,i,o),e.headingRows&&Ry("headingRows",Math.min(e.headingRows,i),n,t,0),e.headingColumns&&Ry("headingColumns",Math.min(e.headingColumns,o),n,t,0),n}insertRows(t,e={}){const n=this.editor.model,i=e.at||0,o=e.rows||1,r=void 0!==e.copyStructureFromAbove,s=e.copyStructureFromAbove?i-1:i,a=this.getRows(t),l=this.getColumns(t);if(i>a)throw new A("tableutils-insertrows-insert-out-of-range",this,{options:e});n.change((e=>{const n=t.getAttribute("headingRows")||0;if(n>i&&Ry("headingRows",n+o,t,e,0),!r&&(0===i||i===a))return void bx(e,t,i,o,l);const c=r?Math.max(i,s):i,d=new Uy(t,{endRow:c}),h=new Array(l).fill(1);for(const{row:t,column:n,cellHeight:a,cellWidth:l,cell:c}of d){const d=t+a-1,u=t<=s&&s<=d;t0&&Oy(e,o,i>1?{colspan:i}:void 0),t+=Math.abs(i)-1}}}))}insertColumns(t,e={}){const n=this.editor.model,i=e.at||0,o=e.columns||1;n.change((e=>{const n=t.getAttribute("headingColumns");io-1)throw new A("tableutils-removerows-row-index-out-of-range",this,{table:t,options:e});n.change((e=>{const n={first:r,last:s},{cellsToMove:i,cellsToTrim:o}=function(t,{first:e,last:n}){const i=new Map,o=[];for(const{row:r,column:s,cellHeight:a,cell:l}of new Uy(t,{endRow:n})){const t=r+a-1;if(r>=e&&r<=n&&t>n){const t=a-(n-r+1);i.set(s,{cell:l,rowspan:t})}if(r=e){let i;i=t>=n?n-e+1:t-e+1,o.push({cell:l,rowspan:a-i})}}return{cellsToMove:i,cellsToTrim:o}}(t,n);i.size&&function(t,e,n,i){const o=[...new Uy(t,{includeAllSlots:!0,row:e})],r=t.getChild(e);let s;for(const{column:t,cell:e,isAnchor:a}of o)if(n.has(t)){const{cell:e,rowspan:o}=n.get(t),a=s?i.createPositionAfter(s):i.createPositionAt(r,0);i.move(i.createRangeOn(e),a),Ry("rowspan",o,e,i),s=e}else a&&(s=e)}(t,s+1,i,e);for(let n=s;n>=r;n--)e.remove(t.getChild(n));for(const{rowspan:t,cell:n}of o)Ry("rowspan",t,n,e);!function(t,{first:e,last:n},i){const o=t.getAttribute("headingRows")||0;e{!function(t,e,n){const i=t.getAttribute("headingColumns")||0;if(i&&e.first=i;n--)for(const{cell:i,column:o,cellWidth:r}of[...new Uy(t)])o<=n&&r>1&&o+r>n?Ry("colspan",r-1,i,e):o===n&&e.remove(i);sx(t,this)||rx(t,this)}))}splitCellVertically(t,e=2){const n=this.editor.model,i=t.parent.parent,o=parseInt(t.getAttribute("rowspan")||"1"),r=parseInt(t.getAttribute("colspan")||"1");n.change((n=>{if(r>1){const{newCellsSpan:i,updatedSpan:s}=wx(r,e);Ry("colspan",s,t,n);const a={};i>1&&(a.colspan=i),o>1&&(a.rowspan=o),kx(r>e?e-1:r-1,n,n.createPositionAfter(t),a)}if(re===t)),c=a.filter((({cell:e,cellWidth:n,column:i})=>e!==t&&i===l||il));for(const{cell:t,cellWidth:e}of c)n.setAttribute("colspan",e+s,t);const d={};o>1&&(d.rowspan=o),kx(s,n,n.createPositionAfter(t),d);const h=i.getAttribute("headingColumns")||0;h>l&&Ry("headingColumns",h+s,i,n)}}))}splitCellHorizontally(t,e=2){const n=this.editor.model,i=t.parent,o=i.parent,r=o.getChildIndex(i),s=parseInt(t.getAttribute("rowspan")||"1"),a=parseInt(t.getAttribute("colspan")||"1");n.change((n=>{if(s>1){const i=[...new Uy(o,{startRow:r,endRow:r+s-1,includeAllSlots:!0})],{newCellsSpan:l,updatedSpan:c}=wx(s,e);Ry("rowspan",c,t,n);const{column:d}=i.find((({cell:e})=>e===t)),h={};l>1&&(h.rowspan=l),a>1&&(h.colspan=a);for(const t of i){const{column:e,row:i}=t;i>=r+c&&e===d&&(i+r+c)%l==0&&kx(1,n,t.getPositionBefore(),h)}}if(sr){const t=o+i;n.setAttribute("rowspan",t,e)}const c={};a>1&&(c.colspan=a),bx(n,o,r+1,i,1,c);const d=o.getAttribute("headingRows")||0;d>r&&Ry("headingRows",d+i,o,n)}}))}getColumns(t){return[...t.getChild(0).getChildren()].reduce(((t,e)=>t+parseInt(e.getAttribute("colspan")||"1")),0)}getRows(t){return Array.from(t.getChildren()).reduce(((t,e)=>e.is("element","tableRow")?t+1:t),0)}createTableWalker(t,e={}){return new Uy(t,e)}getSelectedTableCells(t){const e=[];for(const n of this.sortRanges(t.getRanges())){const t=n.getContainedElement();t&&t.is("element","tableCell")&&e.push(t)}return e}getTableCellsContainingSelection(t){const e=[];for(const n of t.getRanges()){const t=n.start.findAncestor("tableCell");t&&e.push(t)}return e}getSelectionAffectedTableCells(t){const e=this.getSelectedTableCells(t);return e.length?e:this.getTableCellsContainingSelection(t)}getRowIndexes(t){const e=t.map((t=>t.parent.index));return this._getFirstLastIndexesObject(e)}getColumnIndexes(t){const e=t[0].findAncestor("table"),n=[...new Uy(e)].filter((e=>t.includes(e.cell))).map((t=>t.column));return this._getFirstLastIndexesObject(n)}isSelectionRectangular(t){if(t.length<2||!this._areCellInTheSameTableSection(t))return!1;const e=new Set,n=new Set;let i=0;for(const o of t){const{row:t,column:r}=this.getCellLocation(o),s=parseInt(o.getAttribute("rowspan"))||1,a=parseInt(o.getAttribute("colspan"))||1;e.add(t),n.add(r),s>1&&e.add(t+s-1),a>1&&n.add(r+a-1),i+=s*a}const o=function(t,e){const n=Array.from(t.values()),i=Array.from(e.values());return(Math.max(...n)-Math.min(...n)+1)*(Math.max(...i)-Math.min(...i)+1)}(e,n);return o==i}sortRanges(t){return Array.from(t).sort(Ax)}_getFirstLastIndexesObject(t){const e=t.sort(((t,e)=>t-e));return{first:e[0],last:e[e.length-1]}}_areCellInTheSameTableSection(t){const e=t[0].findAncestor("table"),n=this.getRowIndexes(t),i=parseInt(e.getAttribute("headingRows"))||0;if(!this._areIndexesInSameSection(n,i))return!1;const o=this.getColumnIndexes(t),r=parseInt(e.getAttribute("headingColumns"))||0;return this._areIndexesInSameSection(o,r)}_areIndexesInSameSection({first:t,last:e},n){return t{const i=e.getSelectedTableCells(t.document.selection),o=i.shift(),{mergeWidth:r,mergeHeight:s}=function(t,e,n){let i=0,o=0;for(const t of e){const{row:e,column:r}=n.getCellLocation(t);i=yx(t,r,i,"colspan"),o=yx(t,e,o,"rowspan")}const{row:r,column:s}=n.getCellLocation(t);return{mergeWidth:i-s,mergeHeight:o-r}}(o,i,e);Ry("colspan",r,o,n),Ry("rowspan",s,o,n);for(const t of i)_x(t,o,n);ax(o.findAncestor("table"),e),n.setSelection(o,"in")}))}}function _x(t,e,n){vx(t)||(vx(e)&&n.remove(n.createRangeIn(e)),n.move(n.createRangeIn(t),n.createPositionAt(e,"end"))),n.remove(t)}function vx(t){const e=t.getChild(0);return 1==t.childCount&&e.is("element","paragraph")&&e.isEmpty}function yx(t,e,n,i){const o=parseInt(t.getAttribute(i)||"1");return Math.max(n,e+o)}class xx extends gr{constructor(t){super(t),this.affectsData=!1}refresh(){const t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=t.length>0}execute(){const t=this.editor.model,e=this.editor.plugins.get("TableUtils"),n=e.getSelectionAffectedTableCells(t.document.selection),i=e.getRowIndexes(n),o=n[0].findAncestor("table"),r=[];for(let e=i.first;e<=i.last;e++)for(const n of o.getChild(e).getChildren())r.push(t.createRangeOn(n));t.change((t=>{t.setSelection(r)}))}}class Ex extends gr{constructor(t){super(t),this.affectsData=!1}refresh(){const t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=t.length>0}execute(){const t=this.editor.plugins.get("TableUtils"),e=this.editor.model,n=t.getSelectionAffectedTableCells(e.document.selection),i=n[0],o=n.pop(),r=i.findAncestor("table"),s=t.getCellLocation(i),a=t.getCellLocation(o),l=Math.min(s.column,a.column),c=Math.max(s.column,a.column),d=[];for(const t of new Uy(r,{startColumn:l,endColumn:c}))d.push(e.createRangeOn(t.cell));e.change((t=>{t.setSelection(d)}))}}function Dx(t,e){let n=!1;const i=function(t){const e=parseInt(t.getAttribute("headingRows")||"0"),n=Array.from(t.getChildren()).reduce(((t,e)=>e.is("element","tableRow")?t+1:t),0),i=[];for(const{row:o,cell:r,cellHeight:s}of new Uy(t)){if(s<2)continue;const t=ot){const e=t-o;i.push({cell:r,rowspan:e})}}return i}(t);if(i.length){n=!0;for(const t of i)Ry("rowspan",t.rowspan,t.cell,e,1)}return n}function Sx(t,e){let n=!1;const i=function(t){const e=new Array(t.childCount).fill(0);for(const{rowIndex:n}of new Uy(t,{includeAllSlots:!0}))e[n]++;return e}(t),o=[];for(const[e,n]of i.entries())!n&&t.getChild(e).is("element","tableRow")&&o.push(e);if(o.length){n=!0;for(const n of o.reverse())e.remove(t.getChild(n)),i.splice(n,1)}const r=i.filter(((e,n)=>t.getChild(n).is("element","tableRow"))),s=r[0];if(!r.every((t=>t===s))){const i=r.reduce(((t,e)=>e>t?e:t),0);for(const[o,s]of r.entries()){const r=i-s;if(r){for(let n=0;nt.is("$text")));for(const t of n)e.wrap(e.createRangeOn(t),"paragraph");return!!n.length}function Nx(t){return!!t.position.parent.is("element","tableCell")&&("insert"==t.type&&"$text"==t.name||"remove"==t.type)}function zx(t,e){if(!t.is("element","paragraph"))return!1;const n=e.toViewElement(t);return!!n&&Ky(t)!==n.is("element","span")}var Lx=n(4777);Wi()(Lx.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),Lx.Z.locals;class Px extends ur{static get pluginName(){return"TableEditing"}static get requires(){return[fx]}constructor(t){super(t),this._additionalSlots=[]}init(){const t=this.editor,e=t.model,n=e.schema,i=t.conversion,o=t.plugins.get(fx);n.register("table",{inheritAllFrom:"$blockObject",allowAttributes:["headingRows","headingColumns"]}),n.register("tableRow",{allowIn:"table",isLimit:!0}),n.register("tableCell",{allowContentOf:"$container",allowIn:"tableRow",allowAttributes:["colspan","rowspan"],isLimit:!0,isSelectable:!0}),i.for("upcast").add((t=>{t.on("element:figure",((t,e,n)=>{if(!n.consumable.test(e.viewItem,{name:!0,classes:"table"}))return;const i=function(t){for(const e of t.getChildren())if(e.is("element","table"))return e}(e.viewItem);if(!i||!n.consumable.test(i,{name:!0}))return;n.consumable.consume(e.viewItem,{name:!0,classes:"table"});const o=zi(n.convertItem(i,e.modelCursor).modelRange.getItems());o?(n.convertChildren(e.viewItem,n.writer.createPositionAt(o,"end")),n.updateConversionResult(o,e)):n.consumable.revert(e.viewItem,{name:!0,classes:"table"})}))})),i.for("upcast").add((t=>{t.on("element:table",((t,e,n)=>{const i=e.viewItem;if(!n.consumable.test(i,{name:!0}))return;const{rows:o,headingRows:r,headingColumns:s}=function(t){let e,n=0;const i=[],o=[];let r;for(const s of Array.from(t.getChildren())){if("tbody"!==s.name&&"thead"!==s.name&&"tfoot"!==s.name)continue;"thead"!==s.name||r||(r=s);const t=Array.from(s.getChildren()).filter((t=>t.is("element","tr")));for(const a of t)if(r&&s===r||"tbody"===s.name&&Array.from(a.getChildren()).length&&Array.from(a.getChildren()).every((t=>t.is("element","th"))))n++,i.push(a);else{o.push(a);const t=Hy(a);(!e||tn.convertItem(t,n.writer.createPositionAt(l,"end")))),n.convertChildren(i,n.writer.createPositionAt(l,"end")),l.isEmpty){const t=n.writer.createElement("tableRow");n.writer.insert(t,n.writer.createPositionAt(l,"end")),Oy(n.writer,n.writer.createPositionAt(t,"end"))}n.updateConversionResult(l,e)}}))})),i.for("editingDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:Wy(o,{asWidget:!0,additionalSlots:this._additionalSlots})}),i.for("dataDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:Wy(o,{additionalSlots:this._additionalSlots})}),i.for("upcast").elementToElement({model:"tableRow",view:"tr"}),i.for("upcast").add((t=>{t.on("element:tr",((t,e)=>{e.viewItem.isEmpty&&0==e.modelCursor.index&&t.stop()}),{priority:"high"})})),i.for("downcast").elementToElement({model:"tableRow",view:(t,{writer:e})=>t.isEmpty?e.createEmptyElement("tr"):e.createContainerElement("tr")}),i.for("upcast").elementToElement({model:"tableCell",view:"td"}),i.for("upcast").elementToElement({model:"tableCell",view:"th"}),i.for("upcast").add(jy("td")),i.for("upcast").add(jy("th")),i.for("editingDowncast").elementToElement({model:"tableCell",view:qy({asWidget:!0})}),i.for("dataDowncast").elementToElement({model:"tableCell",view:qy()}),i.for("editingDowncast").elementToElement({model:"paragraph",view:$y({asWidget:!0}),converterPriority:"high"}),i.for("dataDowncast").elementToElement({model:"paragraph",view:$y(),converterPriority:"high"}),i.for("downcast").attributeToAttribute({model:"colspan",view:"colspan"}),i.for("upcast").attributeToAttribute({model:{key:"colspan",value:Rx("colspan")},view:"colspan"}),i.for("downcast").attributeToAttribute({model:"rowspan",view:"rowspan"}),i.for("upcast").attributeToAttribute({model:{key:"rowspan",value:Rx("rowspan")},view:"rowspan"}),t.config.define("table.defaultHeadings.rows",0),t.config.define("table.defaultHeadings.columns",0),t.commands.add("insertTable",new Yy(t)),t.commands.add("insertTableRowAbove",new Zy(t,{order:"above"})),t.commands.add("insertTableRowBelow",new Zy(t,{order:"below"})),t.commands.add("insertTableColumnLeft",new Qy(t,{order:"left"})),t.commands.add("insertTableColumnRight",new Qy(t,{order:"right"})),t.commands.add("removeTableRow",new ux(t)),t.commands.add("removeTableColumn",new mx(t)),t.commands.add("splitTableCellVertically",new Jy(t,{direction:"vertically"})),t.commands.add("splitTableCellHorizontally",new Jy(t,{direction:"horizontally"})),t.commands.add("mergeTableCells",new Cx(t)),t.commands.add("mergeTableCellRight",new dx(t,{direction:"right"})),t.commands.add("mergeTableCellLeft",new dx(t,{direction:"left"})),t.commands.add("mergeTableCellDown",new dx(t,{direction:"down"})),t.commands.add("mergeTableCellUp",new dx(t,{direction:"up"})),t.commands.add("setTableColumnHeader",new px(t)),t.commands.add("setTableRowHeader",new gx(t)),t.commands.add("selectTableRow",new xx(t)),t.commands.add("selectTableColumn",new Ex(t)),function(t){t.document.registerPostFixer((e=>function(t,e){const n=e.document.differ.getChanges();let i=!1;const o=new Set;for(const e of n){let n=null;"insert"==e.type&&"table"==e.name&&(n=e.position.nodeAfter),"insert"!=e.type&&"remove"!=e.type||"tableRow"!=e.name&&"tableCell"!=e.name||(n=e.position.findAncestor("table")),Tx(e)&&(n=e.range.start.findAncestor("table")),n&&!o.has(n)&&(i=Dx(n,t)||i,i=Sx(n,t)||i,o.add(n))}return i}(e,t)))}(e),function(t){t.document.registerPostFixer((e=>function(t,e){const n=e.document.differ.getChanges();let i=!1;for(const e of n)"insert"==e.type&&"table"==e.name&&(i=Ix(e.position.nodeAfter,t)||i),"insert"==e.type&&"tableRow"==e.name&&(i=Bx(e.position.nodeAfter,t)||i),"insert"==e.type&&"tableCell"==e.name&&(i=Mx(e.position.nodeAfter,t)||i),"remove"!=e.type&&"insert"!=e.type||!Nx(e)||(i=Mx(e.position.parent,t)||i);return i}(e,t)))}(e),this.listenTo(e.document,"change:data",(()=>{!function(t,e){const n=t.document.differ;for(const t of n.getChanges()){let n,i=!1;if("attribute"==t.type){const e=t.range.start.nodeAfter;if(!e||!e.is("element","table"))continue;if("headingRows"!=t.attributeKey&&"headingColumns"!=t.attributeKey)continue;n=e,i="headingRows"==t.attributeKey}else"tableRow"!=t.name&&"tableCell"!=t.name||(n=t.position.findAncestor("table"),i="tableRow"==t.name);if(!n)continue;const o=n.getAttribute("headingRows")||0,r=n.getAttribute("headingColumns")||0,s=new Uy(n);for(const t of s){const n=t.rowzx(t,e.mapper)));for(const t of n)e.reconvertItem(t)}}(e,t.editing)}))}registerAdditionalSlot(t){this._additionalSlots.push(t)}}function Rx(t){return e=>{const n=parseInt(e.getAttribute(t));return Number.isNaN(n)||n<=0?null:n}}var Ox=n(8085);Wi()(Ox.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),Ox.Z.locals;class Vx extends $i{constructor(t){super(t);const e=this.bindTemplate;this.items=this._createGridCollection(),this.keystrokes=new Pi,this.focusTracker=new Li,this.set("rows",0),this.set("columns",0),this.bind("label").to(this,"columns",this,"rows",((t,e)=>`${e} × ${t}`)),this.setTemplate({tag:"div",attributes:{class:["ck"]},children:[{tag:"div",attributes:{class:["ck-insert-table-dropdown__grid"]},on:{"mouseover@.ck-insert-table-dropdown-grid-box":e.to("boxover")},children:this.items},{tag:"div",attributes:{class:["ck","ck-insert-table-dropdown__label"],"aria-hidden":!0},children:[{text:e.to("label")}]}],on:{mousedown:e.to((t=>{t.preventDefault()})),click:e.to((()=>{this.fire("execute")}))}}),this.on("boxover",((t,e)=>{const{row:n,column:i}=e.target.dataset;this.items.get(10*(parseInt(n,10)-1)+(parseInt(i,10)-1)).focus()})),this.focusTracker.on("change:focusedElement",((t,e,n)=>{if(!n)return;const{row:i,column:o}=n.dataset;this.set({rows:parseInt(i),columns:parseInt(o)})})),this.on("change:columns",(()=>this._highlightGridBoxes())),this.on("change:rows",(()=>this._highlightGridBoxes()))}render(){super.render(),r({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:10,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection});for(const t of this.items)this.focusTracker.add(t.element);this.keystrokes.listenTo(this.element)}focus(){this.items.get(0).focus()}focusLast(){this.items.get(0).focus()}_highlightGridBoxes(){const t=this.rows,e=this.columns;this.items.map(((n,i)=>{const o=Math.floor(i/10){const i=t.commands.get("insertTable"),o=wu(n);let r;return o.bind("isEnabled").to(i),o.buttonView.set({icon:' ',label:e("Insert table"),tooltip:!0}),o.on("change:isOpen",(()=>{r||(r=new Vx(n),o.panelView.children.add(r),r.delegate("execute").to(o),o.on("execute",(()=>{t.execute("insertTable",{rows:r.rows,columns:r.columns}),t.editing.view.focus()})))})),o})),t.ui.componentFactory.add("tableColumn",(t=>{const i=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:e("Header column"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:n?"insertTableColumnLeft":"insertTableColumnRight",label:e("Insert column left")}},{type:"button",model:{commandName:n?"insertTableColumnRight":"insertTableColumnLeft",label:e("Insert column right")}},{type:"button",model:{commandName:"removeTableColumn",label:e("Delete column")}},{type:"button",model:{commandName:"selectTableColumn",label:e("Select column")}}];return this._prepareDropdown(e("Column"),' ',i,t)})),t.ui.componentFactory.add("tableRow",(t=>{const n=[{type:"switchbutton",model:{commandName:"setTableRowHeader",label:e("Header row"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:"insertTableRowAbove",label:e("Insert row above")}},{type:"button",model:{commandName:"insertTableRowBelow",label:e("Insert row below")}},{type:"button",model:{commandName:"removeTableRow",label:e("Delete row")}},{type:"button",model:{commandName:"selectTableRow",label:e("Select row")}}];return this._prepareDropdown(e("Row"),' ',n,t)})),t.ui.componentFactory.add("mergeTableCells",(t=>{const i=[{type:"button",model:{commandName:"mergeTableCellUp",label:e("Merge cell up")}},{type:"button",model:{commandName:n?"mergeTableCellRight":"mergeTableCellLeft",label:e("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:e("Merge cell down")}},{type:"button",model:{commandName:n?"mergeTableCellLeft":"mergeTableCellRight",label:e("Merge cell left")}},{type:"separator"},{type:"button",model:{commandName:"splitTableCellVertically",label:e("Split cell vertically")}},{type:"button",model:{commandName:"splitTableCellHorizontally",label:e("Split cell horizontally")}}];return this._prepareMergeSplitButtonDropdown(e("Merge cells"),' ',i,t)}))}_prepareDropdown(t,e,n,i){const o=this.editor,r=wu(i),s=this._fillDropdownWithListOptions(r,n);return r.buttonView.set({label:t,icon:e,tooltip:!0}),r.bind("isEnabled").toMany(s,"isEnabled",((...t)=>t.some((t=>t)))),this.listenTo(r,"execute",(t=>{o.execute(t.source.commandName),t.source instanceof _o||o.editing.view.focus()})),r}_prepareMergeSplitButtonDropdown(t,e,n,i){const o=this.editor,r=wu(i,fu),s="mergeTableCells",a=o.commands.get(s),l=this._fillDropdownWithListOptions(r,n);return r.buttonView.set({label:t,icon:e,tooltip:!0,isEnabled:!0}),r.bind("isEnabled").toMany([a,...l],"isEnabled",((...t)=>t.some((t=>t)))),this.listenTo(r.buttonView,"execute",(()=>{o.execute(s),o.editing.view.focus()})),this.listenTo(r,"execute",(t=>{o.execute(t.source.commandName),o.editing.view.focus()})),r}_fillDropdownWithListOptions(t,e){const n=this.editor,i=[],o=new Ni;for(const t of e)jx(t,n,i,o);return _u(t,o),i}}function jx(t,e,n,i){if("button"===t.type||"switchbutton"===t.type){const i=t.model=new Nm(t.model),{commandName:o,bindIsOn:r}=t.model,s=e.commands.get(o);n.push(s),i.set({commandName:o}),i.bind("isEnabled").to(s),r&&i.bind("isOn").to(s,"value"),i.set({withText:!0})}i.add(t)}var Hx=n(5593);Wi()(Hx.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),Hx.Z.locals;class Ux extends ur{static get pluginName(){return"TableSelection"}static get requires(){return[fx,fx]}init(){const t=this.editor,e=t.model,n=t.editing.view;this.listenTo(e,"deleteContent",((t,e)=>this._handleDeleteContent(t,e)),{priority:"high"}),this.listenTo(n.document,"insertText",((t,e)=>this._handleInsertTextEvent(t,e)),{priority:"high"}),this._defineSelectionConverter(),this._enablePluginDisabling()}getSelectedTableCells(){const t=this.editor.plugins.get(fx),e=this.editor.model.document.selection,n=t.getSelectedTableCells(e);return 0==n.length?null:n}getSelectionAsFragment(){const t=this.editor.plugins.get(fx),e=this.getSelectedTableCells();return e?this.editor.model.change((n=>{const i=n.createDocumentFragment(),{first:o,last:r}=t.getColumnIndexes(e),{first:s,last:a}=t.getRowIndexes(e),l=e[0].findAncestor("table");let c=a,d=r;if(t.isSelectionRectangular(e)){const t={firstColumn:o,lastColumn:r,firstRow:s,lastRow:a};c=lx(l,t),d=cx(l,t)}const h=Xy(l,{startRow:s,startColumn:o,endRow:c,endColumn:d},n);return n.insert(h,i,0),i})):null}setCellSelection(t,e){const n=this._getCellsToSelect(t,e);this.editor.model.change((t=>{t.setSelection(n.cells.map((e=>t.createRangeOn(e))),{backward:n.backward})}))}getFocusCell(){const t=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return t&&t.is("element","tableCell")?t:null}getAnchorCell(){const t=zi(this.editor.model.document.selection.getRanges()).getContainedElement();return t&&t.is("element","tableCell")?t:null}_defineSelectionConverter(){const t=this.editor,e=new Set;t.conversion.for("editingDowncast").add((t=>t.on("selection",((t,n,i)=>{const o=i.writer;!function(t){for(const n of e)t.removeClass("ck-editor__editable_selected",n);e.clear()}(o);const r=this.getSelectedTableCells();if(!r)return;for(const t of r){const n=i.mapper.toViewElement(t);o.addClass("ck-editor__editable_selected",n),e.add(n)}const s=i.mapper.toViewElement(r[r.length-1]);o.setSelection(s,0)}),{priority:"lowest"})))}_enablePluginDisabling(){const t=this.editor;this.on("change:isEnabled",(()=>{if(!this.isEnabled){const e=this.getSelectedTableCells();if(!e)return;t.model.change((n=>{const i=n.createPositionAt(e[0],0),o=t.model.schema.getNearestSelectionRange(i);n.setSelection(o)}))}}))}_handleDeleteContent(t,e){const n=this.editor.plugins.get(fx),i=e[0],o=e[1],r=this.editor.model,s=!o||"backward"==o.direction,a=n.getSelectedTableCells(i);a.length&&(t.stop(),r.change((t=>{const e=a[s?a.length-1:0];r.change((t=>{for(const e of a)r.deleteContent(t.createSelection(e,"in"))}));const n=r.schema.getNearestSelectionRange(t.createPositionAt(e,0));i.is("documentSelection")?t.setSelection(n):i.setTo(n)})))}_handleInsertTextEvent(t,e){const n=this.editor,i=this.getSelectedTableCells();if(!i)return;const o=n.editing.view,r=n.editing.mapper,s=i.map((t=>o.createRangeOn(r.toViewElement(t))));e.selection=o.createSelection(s)}_getCellsToSelect(t,e){const n=this.editor.plugins.get("TableUtils"),i=n.getCellLocation(t),o=n.getCellLocation(e),r=Math.min(i.row,o.row),s=Math.max(i.row,o.row),a=Math.min(i.column,o.column),l=Math.max(i.column,o.column),c=new Array(s-r+1).fill(null).map((()=>[])),d={startRow:r,endRow:s,startColumn:a,endColumn:l};for(const{row:e,cell:n}of new Uy(t.findAncestor("table"),d))c[e-r].push(n);const h=o.rowt.reverse())),{cells:c.flat(),backward:h||u}}}class Gx extends ur{static get pluginName(){return"TableClipboard"}static get requires(){return[Ux,fx]}init(){const t=this.editor,e=t.editing.view.document;this.listenTo(e,"copy",((t,e)=>this._onCopyCut(t,e))),this.listenTo(e,"cut",((t,e)=>this._onCopyCut(t,e))),this.listenTo(t.model,"insertContent",((t,[e,n])=>this._onInsertContent(t,e,n)),{priority:"high"}),this.decorate("_replaceTableSlotCell")}_onCopyCut(t,e){const n=this.editor.plugins.get(Ux);if(!n.getSelectedTableCells())return;if("cut"==t.name&&!this.editor.model.canEditAt(this.editor.model.document.selection))return;e.preventDefault(),t.stop();const i=this.editor.data,o=this.editor.editing.view.document,r=i.toView(n.getSelectionAsFragment());o.fire("clipboardOutput",{dataTransfer:e.dataTransfer,content:r,method:t.name})}_onInsertContent(t,e,n){if(n&&!n.is("documentSelection"))return;const i=this.editor.model,o=this.editor.plugins.get(fx);let r=this.getTableIfOnlyTableInContent(e,i);if(!r)return;const s=o.getSelectionAffectedTableCells(i.document.selection);s.length?(t.stop(),i.change((t=>{const e={width:o.getColumns(r),height:o.getRows(r)},n=function(t,e,n,i){const o=t[0].findAncestor("table"),r=i.getColumnIndexes(t),s=i.getRowIndexes(t),a={firstColumn:r.first,lastColumn:r.last,firstRow:s.first,lastRow:s.last},l=1===t.length;return l&&(a.lastRow+=e.height-1,a.lastColumn+=e.width-1,function(t,e,n,i){const o=i.getColumns(t),r=i.getRows(t);n>o&&i.insertColumns(t,{at:o,columns:n-o}),e>r&&i.insertRows(t,{at:r,rows:e-r})}(o,a.lastRow+1,a.lastColumn+1,i)),l||!i.isSelectionRectangular(t)?function(t,e,n){const{firstRow:i,lastRow:o,firstColumn:r,lastColumn:s}=e,a={first:i,last:o},l={first:r,last:s};qx(t,r,a,n),qx(t,s+1,a,n),Wx(t,i,l,n),Wx(t,o+1,l,n,i)}(o,a,n):(a.lastRow=lx(o,a),a.lastColumn=cx(o,a)),a}(s,e,t,o),i=n.lastRow-n.firstRow+1,a=n.lastColumn-n.firstColumn+1,l={startRow:0,startColumn:0,endRow:Math.min(i,e.height)-1,endColumn:Math.min(a,e.width)-1};r=Xy(r,l,t);const c=s[0].findAncestor("table"),d=this._replaceSelectedCellsWithPasted(r,e,c,n,t);if(this.editor.plugins.get("TableSelection").isEnabled){const e=o.sortRanges(d.map((e=>t.createRangeOn(e))));t.setSelection(e)}else t.setSelection(d[0],0)}))):ax(r,o)}_replaceSelectedCellsWithPasted(t,e,n,i,o){const{width:r,height:s}=e,a=function(t,e,n){const i=new Array(n).fill(null).map((()=>new Array(e).fill(null)));for(const{column:e,row:n,cell:o}of new Uy(t))i[n][e]=o;return i}(t,r,s),l=[...new Uy(n,{startRow:i.firstRow,endRow:i.lastRow,startColumn:i.firstColumn,endColumn:i.lastColumn,includeAllSlots:!0})],c=[];let d;for(const t of l){const{row:e,column:n}=t;n===i.firstColumn&&(d=t.getPositionBefore());const l=e-i.firstRow,h=n-i.firstColumn,u=a[l%s][h%r],m=u?o.cloneElement(u):null,g=this._replaceTableSlotCell(t,m,d,o);g&&(ox(g,e,n,i.lastRow,i.lastColumn,o),c.push(g),d=o.createPositionAfter(g))}const h=parseInt(n.getAttribute("headingRows")||"0"),u=parseInt(n.getAttribute("headingColumns")||"0"),m=i.firstRow$x(t,e,n))).map((({cell:t})=>ex(t,e,i)))}function qx(t,e,n,i){if(!(e<1))return nx(t,e).filter((({row:t,cellHeight:e})=>$x(t,e,n))).map((({cell:t,column:n})=>ix(t,n,e,i)))}function $x(t,e,n){const i=t+e-1,{first:o,last:r}=n;return t>=o&&t<=r||t=o}class Kx extends ur{static get pluginName(){return"TableKeyboard"}static get requires(){return[Ux,fx]}init(){const t=this.editor.editing.view.document;this.listenTo(t,"arrowKey",((...t)=>this._onArrowKey(...t)),{context:"table"}),this.listenTo(t,"tab",((...t)=>this._handleTabOnSelectedTable(...t)),{context:"figure"}),this.listenTo(t,"tab",((...t)=>this._handleTab(...t)),{context:["th","td"]})}_handleTabOnSelectedTable(t,e){const n=this.editor,i=n.model.document.selection.getSelectedElement();i&&i.is("element","table")&&(e.preventDefault(),e.stopPropagation(),t.stop(),n.model.change((t=>{t.setSelection(t.createRangeIn(i.getChild(0).getChild(0)))})))}_handleTab(t,e){const n=this.editor,i=this.editor.plugins.get(fx),o=this.editor.plugins.get("TableSelection"),r=n.model.document.selection,s=!e.shiftKey;let a=i.getTableCellsContainingSelection(r)[0];if(a||(a=o.getFocusCell()),!a)return;e.preventDefault(),e.stopPropagation(),t.stop();const l=a.parent,c=l.parent,d=c.getChildIndex(l),h=l.getChildIndex(a),u=0===h;if(!s&&u&&0===d)return void n.model.change((t=>{t.setSelection(t.createRangeOn(c))}));const m=h===l.childCount-1,g=d===i.getRows(c)-1;if(s&&g&&m&&(n.execute("insertTableRowBelow"),d===i.getRows(c)-1))return void n.model.change((t=>{t.setSelection(t.createRangeOn(c))}));let p;if(s&&m){const t=c.getChild(d+1);p=t.getChild(0)}else if(!s&&u){const t=c.getChild(d-1);p=t.getChild(t.childCount-1)}else p=l.getChild(h+(s?1:-1));n.model.change((t=>{t.setSelection(t.createRangeIn(p))}))}_onArrowKey(t,e){const n=this.editor,i=Si(e.keyCode,n.locale.contentLanguageDirection);this._handleArrowKeys(i,e.shiftKey)&&(e.preventDefault(),e.stopPropagation(),t.stop())}_handleArrowKeys(t,e){const n=this.editor.plugins.get(fx),i=this.editor.plugins.get("TableSelection"),o=this.editor.model,r=o.document.selection,s=["right","down"].includes(t),a=n.getSelectedTableCells(r);if(a.length){let n;return n=e?i.getFocusCell():s?a[a.length-1]:a[0],this._navigateFromCellInDirection(n,t,e),!0}const l=r.focus.findAncestor("tableCell");if(!l)return!1;if(!r.isCollapsed)if(e){if(r.isBackward==s&&!r.containsEntireContent(l))return!1}else{const t=r.getSelectedElement();if(!t||!o.schema.isObject(t))return!1}return!!this._isSelectionAtCellEdge(r,l,s)&&(this._navigateFromCellInDirection(l,t,e),!0)}_isSelectionAtCellEdge(t,e,n){const i=this.editor.model,o=this.editor.model.schema,r=n?t.getLastPosition():t.getFirstPosition();if(!o.getLimitElement(r).is("element","tableCell"))return i.createPositionAt(e,n?"end":0).isTouching(r);const s=i.createSelection(r);return i.modifySelection(s,{direction:n?"forward":"backward"}),r.isEqual(s.focus)}_navigateFromCellInDirection(t,e,n=!1){const i=this.editor.model,o=t.findAncestor("table"),r=[...new Uy(o,{includeAllSlots:!0})],{row:s,column:a}=r[r.length-1],l=r.find((({cell:e})=>e==t));let{row:c,column:d}=l;switch(e){case"left":d--;break;case"up":c--;break;case"right":d+=l.cellWidth;break;case"down":c+=l.cellHeight}if(c<0||c>s||d<0&&c<=0||d>a&&c>=s)return void i.change((t=>{t.setSelection(t.createRangeOn(o))}));d<0?(d=n?0:a,c--):d>a&&(d=n?a:0,c++);const h=r.find((t=>t.row==c&&t.column==d)).cell,u=["right","down"].includes(e),m=this.editor.plugins.get("TableSelection");if(n&&m.isEnabled){const e=m.getAnchorCell()||t;m.setCellSelection(e,h)}else{const t=i.createPositionAt(h,u?0:"end");i.change((e=>{e.setSelection(t)}))}}}class Yx extends za{constructor(){super(...arguments),this.domEventType=["mousemove","mouseleave"]}onDomEvent(t){this.fire(t.type,t)}}class Zx extends ur{static get pluginName(){return"TableMouse"}static get requires(){return[Ux,fx]}init(){this.editor.editing.view.addObserver(Yx),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){const t=this.editor,e=t.plugins.get(fx);let n=!1;const i=t.plugins.get(Ux);this.listenTo(t.editing.view.document,"mousedown",((o,r)=>{const s=t.model.document.selection;if(!this.isEnabled||!i.isEnabled)return;if(!r.domEvent.shiftKey)return;const a=i.getAnchorCell()||e.getTableCellsContainingSelection(s)[0];if(!a)return;const l=this._getModelTableCellFromDomEvent(r);l&&Qx(a,l)&&(n=!0,i.setCellSelection(a,l),r.preventDefault())})),this.listenTo(t.editing.view.document,"mouseup",(()=>{n=!1})),this.listenTo(t.editing.view.document,"selectionChange",(t=>{n&&t.stop()}),{priority:"highest"})}_enableMouseDragSelection(){const t=this.editor;let e,n,i=!1,o=!1;const r=t.plugins.get(Ux);this.listenTo(t.editing.view.document,"mousedown",((t,n)=>{this.isEnabled&&r.isEnabled&&(n.domEvent.shiftKey||n.domEvent.ctrlKey||n.domEvent.altKey||(e=this._getModelTableCellFromDomEvent(n)))})),this.listenTo(t.editing.view.document,"mousemove",((t,s)=>{if(!s.domEvent.buttons)return;if(!e)return;const a=this._getModelTableCellFromDomEvent(s);a&&Qx(e,a)&&(n=a,i||n==e||(i=!0)),i&&(o=!0,r.setCellSelection(e,n),s.preventDefault())})),this.listenTo(t.editing.view.document,"mouseup",(()=>{i=!1,o=!1,e=null,n=null})),this.listenTo(t.editing.view.document,"selectionChange",(t=>{o&&t.stop()}),{priority:"highest"})}_getModelTableCellFromDomEvent(t){const e=t.target,n=this.editor.editing.view.createPositionAt(e,0);return this.editor.editing.mapper.toModelPosition(n).parent.findAncestor("tableCell",{includeSelf:!0})}}function Qx(t,e){return t.parent.parent==e.parent.parent}var Jx=n(4104);function Xx(t){return!!t&&t.is("element","table")}function tE(t){for(const e of t.getChildren())if(e.is("element","caption"))return e;return null}function eE(t){const e=t.parent;return"figcaption"==t.name&&e&&e.is("element","figure")&&e.hasClass("table")||"caption"==t.name&&e&&e.is("element","table")?{name:!0}:null}function nE(t){const e=t.getSelectedElement();return e&&e.is("element","table")?e:t.getFirstPosition().findAncestor("table")}Wi()(Jx.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),Jx.Z.locals;class iE extends gr{refresh(){const t=nE(this.editor.model.document.selection);this.isEnabled=!!t,this.isEnabled?this.value=!!tE(t):this.value=!1}execute({focusCaptionOnShow:t=!1}={}){this.editor.model.change((e=>{this.value?this._hideTableCaption(e):this._showTableCaption(e,t)}))}_showTableCaption(t,e){const n=this.editor.model,i=nE(n.document.selection),o=this.editor.plugins.get("TableCaptionEditing")._getSavedCaption(i)||t.createElement("caption");n.insertContent(o,i,"end"),e&&t.setSelection(o,"in")}_hideTableCaption(t){const e=this.editor.model,n=nE(e.document.selection),i=this.editor.plugins.get("TableCaptionEditing"),o=tE(n);i._saveCaption(n,o),e.deleteContent(t.createSelection(o,"on"))}}class oE extends ur{static get pluginName(){return"TableCaptionEditing"}constructor(t){super(t),this._savedCaptionsMap=new WeakMap}init(){const t=this.editor,e=t.model.schema,n=t.editing.view,i=t.t;e.isRegistered("caption")?e.extend("caption",{allowIn:"table"}):e.register("caption",{allowIn:"table",allowContentOf:"$block",isLimit:!0}),t.commands.add("toggleTableCaption",new iE(this.editor)),t.conversion.for("upcast").elementToElement({view:eE,model:"caption"}),t.conversion.for("dataDowncast").elementToElement({model:"caption",view:(t,{writer:e})=>Xx(t.parent)?e.createContainerElement("figcaption"):null}),t.conversion.for("editingDowncast").elementToElement({model:"caption",view:(t,{writer:e})=>{if(!Xx(t.parent))return null;const o=e.createEditableElement("figcaption");return e.setCustomProperty("tableCaption",!0,o),_r({view:n,element:o,text:i("Enter table caption"),keepOnFocus:!0}),Cp(o,e)}}),function(t){t.document.registerPostFixer((e=>function(t,e){const n=e.document.differ.getChanges();let i=!1;for(const e of n){if("insert"!=e.type)continue;const n=e.position.parent;if(n.is("element","table")||"table"==e.name){const o="table"==e.name?e.position.nodeAfter:n,r=Array.from(o.getChildren()).filter((t=>t.is("element","caption"))),s=r.shift();if(!s)continue;for(const e of r)t.move(t.createRangeIn(e),s,"end"),t.remove(e);s.nextSibling&&(t.move(t.createRangeOn(s),o,"end"),i=!0),i=!!r.length||i}}return i}(e,t)))}(t.model)}_getSavedCaption(t){const e=this._savedCaptionsMap.get(t);return e?fl.fromJSON(e):null}_saveCaption(t,e){this._savedCaptionsMap.set(t,e.toJSON())}}class rE extends ur{static get pluginName(){return"TableCaptionUI"}init(){const t=this.editor,e=t.editing.view,n=t.t;t.ui.componentFactory.add("toggleTableCaption",(i=>{const o=t.commands.get("toggleTableCaption"),r=new Ao(i);return r.set({icon:iu.caption,tooltip:!0,isToggleable:!0}),r.bind("isOn","isEnabled").to(o,"value","isEnabled"),r.bind("label").to(o,"value",(t=>n(t?"Toggle caption off":"Toggle caption on"))),this.listenTo(r,"execute",(()=>{if(t.execute("toggleTableCaption",{focusCaptionOnShow:!0}),o.value){const n=function(t){const e=nE(t);return e?tE(e):null}(t.model.document.selection),i=t.editing.mapper.toViewElement(n);if(!i)return;e.scrollToTheSelection(),e.change((t=>{t.addClass("table__caption_highlighted",i)}))}t.editing.view.focus()})),r}))}}var sE=n(9888);Wi()(sE.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),sE.Z.locals;var aE=n(4082);Wi()(aE.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),aE.Z.locals;class lE extends $i{constructor(t,e){super(t),this.set("value",""),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isEmpty",!0),this.options=e,this.focusTracker=new Li,this._focusables=new Ui,this.dropdownView=this._createDropdownView(),this.inputView=this._createInputTextView(),this.keystrokes=new Pi,this._stillTyping=!1,this._focusCycler=new ar({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-input-color"]},children:[this.dropdownView,this.inputView]}),this.on("change:value",((t,e,n)=>this._setInputValue(n)))}render(){super.render(),this.keystrokes.listenTo(this.dropdownView.panelView.element)}focus(){this.inputView.focus()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createDropdownView(){const t=this.locale,e=t.t,n=this.bindTemplate,i=this._createColorGrid(t),o=wu(t),r=new $i,s=this._createRemoveColorButton();return r.setTemplate({tag:"span",attributes:{class:["ck","ck-input-color__button__preview"],style:{backgroundColor:n.to("value")}},children:[{tag:"span",attributes:{class:["ck","ck-input-color__button__preview__no-color-indicator",n.if("value","ck-hidden",(t=>""!=t))]}}]}),o.buttonView.extendTemplate({attributes:{class:"ck-input-color__button"}}),o.buttonView.children.add(r),o.buttonView.label=e("Color picker"),o.buttonView.tooltip=!0,o.panelPosition="rtl"===t.uiLanguageDirection?"se":"sw",o.panelView.children.add(s),o.panelView.children.add(i),o.bind("isEnabled").to(this,"isReadOnly",(t=>!t)),this._focusables.add(s),this._focusables.add(i),this.focusTracker.add(s.element),this.focusTracker.add(i.element),o}_createInputTextView(){const t=this.locale,e=new tr(t);return e.extendTemplate({on:{blur:e.bindTemplate.to("blur")}}),e.value=this.value,e.bind("isReadOnly","hasError").to(this),this.bind("isFocused","isEmpty").to(e),e.on("input",(()=>{const t=e.element.value,n=this.options.colorDefinitions.find((e=>t===e.label));this._stillTyping=!0,this.value=n&&n.color||t})),e.on("blur",(()=>{this._stillTyping=!1,this._setInputValue(e.element.value)})),e.delegate("input").to(this),e}_createRemoveColorButton(){const t=this.locale,e=t.t,n=new Ao(t),i=this.options.defaultColorValue||"",o=e(i?"Restore default":"Remove color");return n.class="ck-input-color__remove-color",n.withText=!0,n.icon=iu.eraser,n.label=o,n.on("execute",(()=>{this.value=i,this.dropdownView.isOpen=!1,this.fire("input")})),n}_createColorGrid(t){const e=new So(t,{colorDefinitions:this.options.colorDefinitions,columns:this.options.columns});return e.on("execute",((t,e)=>{this.value=e.value,this.dropdownView.isOpen=!1,this.fire("input")})),e.bind("selectedColor").to(this,"value"),e}_setInputValue(t){if(!this._stillTyping){const e=cE(t),n=this.options.colorDefinitions.find((t=>e===cE(t.color)));this.inputView.value=n?n.label:t||""}}}function cE(t){return t.replace(/([(,])\s+/g,"$1").replace(/^\s+|\s+(?=[),\s]|$)/g,"").replace(/,|\s/g," ")}const dE=t=>""===t;function hE(t){return{none:t("None"),solid:t("Solid"),dotted:t("Dotted"),dashed:t("Dashed"),double:t("Double"),groove:t("Groove"),ridge:t("Ridge"),inset:t("Inset"),outset:t("Outset")}}function uE(t){return t('The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".')}function mE(t){return t('The value is invalid. Try "10px" or "2em" or simply "2".')}function gE(t){return t=t.trim(),dE(t)||kh(t)}function pE(t){return t=t.trim(),dE(t)||CE(t)||_h(t)||yh(t)}function fE(t){return t=t.trim(),dE(t)||CE(t)||_h(t)}function bE(t,e){const n=new Ni,i=hE(t.t);for(const o in i){const r={type:"button",model:new Nm({_borderStyleValue:o,label:i[o],role:"menuitemradio",withText:!0})};"none"===o?r.model.bind("isOn").to(t,"borderStyle",(t=>"none"===e?!t:t===o)):r.model.bind("isOn").to(t,"borderStyle",(t=>t===o)),n.add(r)}return n}function kE(t){const{view:e,icons:n,toolbar:i,labels:o,propertyName:r,nameToValue:s,defaultValue:a}=t;for(const t in o){const l=new Ao(e.locale);l.set({label:o[t],icon:n[t],tooltip:o[t]});const c=s?s(t):t;l.bind("isOn").to(e,r,(t=>{let e=t;return""===t&&a&&(e=a),c===e})),l.on("execute",(()=>{e[r]=c})),i.items.add(l)}}const wE=[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}];function AE(t){return(e,n,i)=>{const o=new lE(e.locale,{colorDefinitions:(r=t.colorConfig,r.map((t=>({color:t.model,label:t.label,options:{hasBorder:t.hasBorder}})))),columns:t.columns,defaultColorValue:t.defaultColorValue});var r;return o.inputView.set({id:n,ariaDescribedById:i}),o.bind("isReadOnly").to(e,"isEnabled",(t=>!t)),o.bind("hasError").to(e,"errorText",(t=>!!t)),o.on("input",(()=>{e.errorText=null})),e.bind("isEmpty","isFocused").to(o),o}}function CE(t){const e=parseFloat(t);return!Number.isNaN(e)&&t===String(e)}var _E=n(9865);Wi()(_E.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),_E.Z.locals;class vE extends $i{constructor(t,e={}){super(t);const n=this.bindTemplate;this.set("class",e.class||null),this.children=this.createCollection(),e.children&&e.children.forEach((t=>this.children.add(t))),this.set("_role",null),this.set("_ariaLabelledBy",null),e.labelView&&this.set({_role:"group",_ariaLabelledBy:e.labelView.id}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__row",n.to("class")],role:n.to("_role"),"aria-labelledby":n.to("_ariaLabelledBy")},children:this.children})}}var yE=n(4880);Wi()(yE.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),yE.Z.locals;var xE=n(198);Wi()(xE.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),xE.Z.locals;var EE=n(5737);Wi()(EE.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),EE.Z.locals;const DE={left:iu.alignLeft,center:iu.alignCenter,right:iu.alignRight,justify:iu.alignJustify,top:iu.alignTop,middle:iu.alignMiddle,bottom:iu.alignBottom};class SE extends $i{constructor(t,e){super(t),this.set({borderStyle:"",borderWidth:"",borderColor:"",padding:"",backgroundColor:"",width:"",height:"",horizontalAlignment:"",verticalAlignment:""}),this.options=e;const{borderStyleDropdown:n,borderWidthInput:i,borderColorInput:o,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:s,backgroundInput:a}=this._createBackgroundFields(),{widthInput:l,operatorLabel:c,heightInput:d,dimensionsLabel:h}=this._createDimensionFields(),{horizontalAlignmentToolbar:u,verticalAlignmentToolbar:m,alignmentLabel:g}=this._createAlignmentFields();this.focusTracker=new Li,this.keystrokes=new Pi,this.children=this.createCollection(),this.borderStyleDropdown=n,this.borderWidthInput=i,this.borderColorInput=o,this.backgroundInput=a,this.paddingInput=this._createPaddingField(),this.widthInput=l,this.heightInput=d,this.horizontalAlignmentToolbar=u,this.verticalAlignmentToolbar=m;const{saveButtonView:p,cancelButtonView:f}=this._createActionButtons();this.saveButtonView=p,this.cancelButtonView=f,this._focusables=new Ui,this._focusCycler=new ar({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Bm(t,{label:this.t("Cell properties")})),this.children.add(new vE(t,{labelView:r,children:[r,n,o,i],class:"ck-table-form__border-row"})),this.children.add(new vE(t,{labelView:s,children:[s,a],class:"ck-table-form__background-row"})),this.children.add(new vE(t,{children:[new vE(t,{labelView:h,children:[h,l,c,d],class:"ck-table-form__dimensions-row"}),new vE(t,{children:[this.paddingInput],class:"ck-table-cell-properties-form__padding-row"})]})),this.children.add(new vE(t,{labelView:g,children:[g,u,m],class:"ck-table-cell-properties-form__alignment-row"})),this.children.add(new vE(t,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-cell-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),o({view:this}),[this.borderStyleDropdown,this.borderColorInput,this.borderColorInput.fieldView.dropdownView.buttonView,this.borderWidthInput,this.backgroundInput,this.backgroundInput.fieldView.dropdownView.buttonView,this.widthInput,this.heightInput,this.paddingInput,this.horizontalAlignmentToolbar,this.verticalAlignmentToolbar,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()}_createBorderFields(){const t=this.options.defaultTableCellProperties,e={style:t.borderStyle,width:t.borderWidth,color:t.borderColor},n=AE({colorConfig:this.options.borderColors,columns:5,defaultColorValue:e.color}),i=this.locale,o=this.t,r=o("Style"),s=new Yo(i);s.text=o("Border");const a=hE(o),l=new Qo(i,Du);l.set({label:r,class:"ck-table-form__border-style"}),l.fieldView.buttonView.set({ariaLabel:r,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:r}),l.fieldView.buttonView.bind("label").to(this,"borderStyle",(t=>a[t||"none"])),l.fieldView.on("execute",(t=>{this.borderStyle=t.source._borderStyleValue})),l.bind("isEmpty").to(this,"borderStyle",(t=>!t)),_u(l.fieldView,bE(this,e.style),{role:"menu",ariaLabel:r});const c=new Qo(i,xu);c.set({label:o("Width"),class:"ck-table-form__border-width"}),c.fieldView.bind("value").to(this,"borderWidth"),c.bind("isEnabled").to(this,"borderStyle",TE),c.fieldView.on("input",(()=>{this.borderWidth=c.fieldView.element.value}));const d=new Qo(i,n);return d.set({label:o("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",TE),d.fieldView.on("input",(()=>{this.borderColor=d.fieldView.value})),this.on("change:borderStyle",((t,n,i,o)=>{TE(i)||(this.borderColor="",this.borderWidth=""),TE(o)||(this.borderColor=e.color,this.borderWidth=e.width)})),{borderRowLabel:s,borderStyleDropdown:l,borderColorInput:d,borderWidthInput:c}}_createBackgroundFields(){const t=this.locale,e=this.t,n=new Yo(t);n.text=e("Background");const i=AE({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableCellProperties.backgroundColor}),o=new Qo(t,i);return o.set({label:e("Color"),class:"ck-table-cell-properties-form__background"}),o.fieldView.bind("value").to(this,"backgroundColor"),o.fieldView.on("input",(()=>{this.backgroundColor=o.fieldView.value})),{backgroundRowLabel:n,backgroundInput:o}}_createDimensionFields(){const t=this.locale,e=this.t,n=new Yo(t);n.text=e("Dimensions");const i=new Qo(t,xu);i.set({label:e("Width"),class:"ck-table-form__dimensions-row__width"}),i.fieldView.bind("value").to(this,"width"),i.fieldView.on("input",(()=>{this.width=i.fieldView.element.value}));const o=new $i(t);o.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const r=new Qo(t,xu);return r.set({label:e("Height"),class:"ck-table-form__dimensions-row__height"}),r.fieldView.bind("value").to(this,"height"),r.fieldView.on("input",(()=>{this.height=r.fieldView.element.value})),{dimensionsLabel:n,widthInput:i,operatorLabel:o,heightInput:r}}_createPaddingField(){const t=this.locale,e=this.t,n=new Qo(t,xu);return n.set({label:e("Padding"),class:"ck-table-cell-properties-form__padding"}),n.fieldView.bind("value").to(this,"padding"),n.fieldView.on("input",(()=>{this.padding=n.fieldView.element.value})),n}_createAlignmentFields(){const t=this.locale,e=this.t,n=new Yo(t);n.text=e("Table cell text alignment");const i=new au(t),o="rtl"===t.contentLanguageDirection;i.set({isCompact:!0,ariaLabel:e("Horizontal text alignment toolbar")}),kE({view:this,icons:DE,toolbar:i,labels:this._horizontalAlignmentLabels,propertyName:"horizontalAlignment",nameToValue:t=>{if(o){if("left"===t)return"right";if("right"===t)return"left"}return t},defaultValue:this.options.defaultTableCellProperties.horizontalAlignment});const r=new au(t);return r.set({isCompact:!0,ariaLabel:e("Vertical text alignment toolbar")}),kE({view:this,icons:DE,toolbar:r,labels:this._verticalAlignmentLabels,propertyName:"verticalAlignment",defaultValue:this.options.defaultTableCellProperties.verticalAlignment}),{horizontalAlignmentToolbar:i,verticalAlignmentToolbar:r,alignmentLabel:n}}_createActionButtons(){const t=this.locale,e=this.t,n=new Ao(t),i=new Ao(t),o=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return n.set({label:e("Save"),icon:iu.check,class:"ck-button-save",type:"submit",withText:!0}),n.bind("isEnabled").toMany(o,"errorText",((...t)=>t.every((t=>!t)))),i.set({label:e("Cancel"),icon:iu.cancel,class:"ck-button-cancel",withText:!0}),i.delegate("execute").to(this,"cancel"),{saveButtonView:n,cancelButtonView:i}}get _horizontalAlignmentLabels(){const t=this.locale,e=this.t,n=e("Align cell text to the left"),i=e("Align cell text to the center"),o=e("Align cell text to the right"),r=e("Justify cell text");return"rtl"===t.uiLanguageDirection?{right:o,center:i,left:n,justify:r}:{left:n,center:i,right:o,justify:r}}get _verticalAlignmentLabels(){const t=this.t;return{top:t("Align cell text to the top"),middle:t("Align cell text to the middle"),bottom:t("Align cell text to the bottom")}}}function TE(t){return"none"!==t}function IE(t){const e=t.getSelectedElement();return e&&ME(e)?e:null}function BE(t){const e=t.getFirstPosition();if(!e)return null;let n=e.parent;for(;n;){if(n.is("element")&&ME(n))return n;n=n.parent}return null}function ME(t){return!!t.getCustomProperty("table")&&fp(t)}const NE=dm.defaultPositions,zE=[NE.northArrowSouth,NE.northArrowSouthWest,NE.northArrowSouthEast,NE.southArrowNorth,NE.southArrowNorthWest,NE.southArrowNorthEast,NE.viewportStickyNorth];function LE(t,e){const n=t.plugins.get("ContextualBalloon");if(BE(t.editing.view.document.selection)){let i;i="cell"===e?RE(t):PE(t),n.updatePosition(i)}}function PE(t){const e=t.model.document.selection.getFirstPosition().findAncestor("table"),n=t.editing.mapper.toViewElement(e);return{target:t.editing.view.domConverter.mapViewToDom(n),positions:zE}}function RE(t){const e=t.editing.mapper,n=t.editing.view.domConverter,i=t.model.document.selection;if(i.rangeCount>1)return{target:()=>function(t,e){const n=e.editing.mapper,i=e.editing.view.domConverter,o=Array.from(t).map((t=>{const e=OE(t.start),o=n.toViewElement(e);return new Zn(i.mapViewToDom(o))}));return Zn.getBoundingRect(o)}(i.getRanges(),t),positions:zE};const o=OE(i.getFirstPosition()),r=e.toViewElement(o);return{target:n.mapViewToDom(r),positions:zE}}function OE(t){return t.nodeAfter&&t.nodeAfter.is("element","tableCell")?t.nodeAfter:t.findAncestor("tableCell")}function VE(t){if(!t||!R(t))return t;const{top:e,right:n,bottom:i,left:o}=t;return e==n&&n==i&&i==o?e:void 0}function FE(t,e){const n=parseFloat(t);return Number.isNaN(n)||String(n)!==String(t)?t:`${n}${e}`}function jE(t,e={}){const n={borderStyle:"none",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",...t};return e.includeAlignmentProperty&&!n.alignment&&(n.alignment="center"),e.includePaddingProperty&&!n.padding&&(n.padding=""),e.includeVerticalAlignmentProperty&&!n.verticalAlignment&&(n.verticalAlignment="middle"),e.includeHorizontalAlignmentProperty&&!n.horizontalAlignment&&(n.horizontalAlignment=e.isRightToLeftContent?"right":"left"),n}const HE={borderStyle:"tableCellBorderStyle",borderColor:"tableCellBorderColor",borderWidth:"tableCellBorderWidth",height:"tableCellHeight",width:"tableCellWidth",padding:"tableCellPadding",backgroundColor:"tableCellBackgroundColor",horizontalAlignment:"tableCellHorizontalAlignment",verticalAlignment:"tableCellVerticalAlignment"};class UE extends ur{static get requires(){return[Om]}static get pluginName(){return"TableCellPropertiesUI"}constructor(t){super(t),t.config.define("table.tableCellProperties",{borderColors:wE,backgroundColors:wE})}init(){const t=this.editor,e=t.t;this._defaultTableCellProperties=jE(t.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:"rtl"===t.locale.contentLanguageDirection}),this._balloon=t.plugins.get(Om),this.view=null,this._isReady=!1,t.ui.componentFactory.add("tableCellProperties",(n=>{const i=new Ao(n);i.set({label:e("Cell properties"),icon:' ',tooltip:!0}),this.listenTo(i,"execute",(()=>this._showView()));const o=Object.values(HE).map((e=>t.commands.get(e)));return i.bind("isEnabled").toMany(o,"isEnabled",((...t)=>t.some((t=>t)))),i}))}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(){const e=this.editor,n=e.config.get("table.tableCellProperties"),i=yo(n.borderColors),o=vo(e.locale,i),r=yo(n.backgroundColors),s=vo(e.locale,r),a=new SE(e.locale,{borderColors:o,backgroundColors:s,defaultTableCellProperties:this._defaultTableCellProperties}),l=e.t;a.render(),this.listenTo(a,"submit",(()=>{this._hideView()})),this.listenTo(a,"cancel",(()=>{this._undoStepBatch.operations.length&&e.execute("undo",this._undoStepBatch),this._hideView()})),a.keystrokes.set("Esc",((t,e)=>{this._hideView(),e()})),t({emitter:a,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const c=uE(l),d=mE(l);return a.on("change:borderStyle",this._getPropertyChangeCallback("tableCellBorderStyle")),a.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:a.borderColorInput,commandName:"tableCellBorderColor",errorText:c,validator:gE})),a.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:a.borderWidthInput,commandName:"tableCellBorderWidth",errorText:d,validator:fE})),a.on("change:padding",this._getValidatedPropertyChangeCallback({viewField:a.paddingInput,commandName:"tableCellPadding",errorText:d,validator:pE})),a.on("change:width",this._getValidatedPropertyChangeCallback({viewField:a.widthInput,commandName:"tableCellWidth",errorText:d,validator:pE})),a.on("change:height",this._getValidatedPropertyChangeCallback({viewField:a.heightInput,commandName:"tableCellHeight",errorText:d,validator:pE})),a.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:a.backgroundInput,commandName:"tableCellBackgroundColor",errorText:c,validator:gE})),a.on("change:horizontalAlignment",this._getPropertyChangeCallback("tableCellHorizontalAlignment")),a.on("change:verticalAlignment",this._getPropertyChangeCallback("tableCellVerticalAlignment")),a}_fillViewFormFromCommandValues(){const t=this.editor.commands,e=t.get("tableCellBorderStyle");Object.entries(HE).map((([e,n])=>{const i=this._defaultTableCellProperties[e]||"";return[e,t.get(n).value||i]})).forEach((([t,n])=>{("borderColor"!==t&&"borderWidth"!==t||"none"!==e.value)&&this.view.set(t,n)})),this._isReady=!0}_showView(){const t=this.editor;this.view||(this.view=this._createPropertiesView()),this.listenTo(t.ui,"update",(()=>{this._updateView()})),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:RE(t)}),this._undoStepBatch=t.model.createBatch(),this.view.focus()}_hideView(){const t=this.editor;this.stopListening(t.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){const t=this.editor;BE(t.editing.view.document.selection)?this._isViewVisible&&LE(t,"cell"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(t){return(e,n,i)=>{this._isReady&&this.editor.execute(t,{value:i,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(t){const{commandName:e,viewField:n,validator:i,errorText:o}=t,r=$o((()=>{n.errorText=o}),500);return(t,o,s)=>{r.cancel(),this._isReady&&(i(s)?(this.editor.execute(e,{value:s,batch:this._undoStepBatch}),n.errorText=null):r())}}}class GE extends gr{constructor(t,e,n){super(t),this.attributeName=e,this._defaultValue=n}refresh(){const t=this.editor,e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(t.model.document.selection);this.isEnabled=!!e.length,this.value=this._getSingleValue(e)}execute(t={}){const{value:e,batch:n}=t,i=this.editor.model,o=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(i.document.selection),r=this._getValueToSet(e);i.enqueueChange(n,(t=>{r?o.forEach((e=>t.setAttribute(this.attributeName,r,e))):o.forEach((e=>t.removeAttribute(this.attributeName,e)))}))}_getAttribute(t){if(!t)return;const e=t.getAttribute(this.attributeName);return e!==this._defaultValue?e:void 0}_getValueToSet(t){if(t!==this._defaultValue)return t}_getSingleValue(t){const e=this._getAttribute(t[0]);return t.every((t=>this._getAttribute(t)===e))?e:void 0}}class WE extends GE{constructor(t,e){super(t,"tableCellWidth",e)}_getValueToSet(t){if((t=FE(t,"px"))!==this._defaultValue)return t}}class qE extends ur{static get pluginName(){return"TableCellWidthEditing"}static get requires(){return[Px]}init(){const t=this.editor,e=jE(t.config.get("table.tableCellProperties.defaultProperties"));Fy(t.model.schema,t.conversion,{modelAttribute:"tableCellWidth",styleName:"width",defaultValue:e.width}),t.commands.add("tableCellWidth",new WE(t,e.width))}}class $E extends GE{constructor(t,e){super(t,"tableCellPadding",e)}_getAttribute(t){if(!t)return;const e=VE(t.getAttribute(this.attributeName));return e!==this._defaultValue?e:void 0}_getValueToSet(t){const e=FE(t,"px");if(e!==this._defaultValue)return e}}class KE extends GE{constructor(t,e){super(t,"tableCellHeight",e)}_getValueToSet(t){const e=FE(t,"px");if(e!==this._defaultValue)return e}}class YE extends GE{constructor(t,e){super(t,"tableCellBackgroundColor",e)}}class ZE extends GE{constructor(t,e){super(t,"tableCellVerticalAlignment",e)}}class QE extends GE{constructor(t,e){super(t,"tableCellHorizontalAlignment",e)}}class JE extends GE{constructor(t,e){super(t,"tableCellBorderStyle",e)}_getAttribute(t){if(!t)return;const e=VE(t.getAttribute(this.attributeName));return e!==this._defaultValue?e:void 0}}class XE extends GE{constructor(t,e){super(t,"tableCellBorderColor",e)}_getAttribute(t){if(!t)return;const e=VE(t.getAttribute(this.attributeName));return e!==this._defaultValue?e:void 0}}class tD extends GE{constructor(t,e){super(t,"tableCellBorderWidth",e)}_getAttribute(t){if(!t)return;const e=VE(t.getAttribute(this.attributeName));return e!==this._defaultValue?e:void 0}_getValueToSet(t){const e=FE(t,"px");if(e!==this._defaultValue)return e}}const eD=/^(top|middle|bottom)$/,nD=/^(left|center|right|justify)$/;class iD extends ur{static get pluginName(){return"TableCellPropertiesEditing"}static get requires(){return[Px,qE]}init(){const t=this.editor,e=t.model.schema,n=t.conversion;t.config.define("table.tableCellProperties.defaultProperties",{});const i=jE(t.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:"rtl"===t.locale.contentLanguageDirection});t.data.addStyleProcessorRules(Vh),function(t,e,n){const i={width:"tableCellBorderWidth",color:"tableCellBorderColor",style:"tableCellBorderStyle"};t.extend("tableCell",{allowAttributes:Object.values(i)}),Ny(e,"td",i,n),Ny(e,"th",i,n),zy(e,{modelElement:"tableCell",modelAttribute:i.style,styleName:"border-style"}),zy(e,{modelElement:"tableCell",modelAttribute:i.color,styleName:"border-color"}),zy(e,{modelElement:"tableCell",modelAttribute:i.width,styleName:"border-width"})}(e,n,{color:i.borderColor,style:i.borderStyle,width:i.borderWidth}),t.commands.add("tableCellBorderStyle",new JE(t,i.borderStyle)),t.commands.add("tableCellBorderColor",new XE(t,i.borderColor)),t.commands.add("tableCellBorderWidth",new tD(t,i.borderWidth)),Fy(e,n,{modelAttribute:"tableCellHeight",styleName:"height",defaultValue:i.height}),t.commands.add("tableCellHeight",new KE(t,i.height)),t.data.addStyleProcessorRules(Zh),Fy(e,n,{modelAttribute:"tableCellPadding",styleName:"padding",reduceBoxSides:!0,defaultValue:i.padding}),t.commands.add("tableCellPadding",new $E(t,i.padding)),t.data.addStyleProcessorRules(Oh),Fy(e,n,{modelAttribute:"tableCellBackgroundColor",styleName:"background-color",defaultValue:i.backgroundColor}),t.commands.add("tableCellBackgroundColor",new YE(t,i.backgroundColor)),function(t,e,n){t.extend("tableCell",{allowAttributes:["tableCellHorizontalAlignment"]}),e.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellHorizontalAlignment"},view:t=>({key:"style",value:{"text-align":t}})}),e.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"text-align":nD}},model:{key:"tableCellHorizontalAlignment",value:t=>{const e=t.getStyle("text-align");return e===n?null:e}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{align:nD}},model:{key:"tableCellHorizontalAlignment",value:t=>{const e=t.getAttribute("align");return e===n?null:e}}})}(e,n,i.horizontalAlignment),t.commands.add("tableCellHorizontalAlignment",new QE(t,i.horizontalAlignment)),function(t,e,n){t.extend("tableCell",{allowAttributes:["tableCellVerticalAlignment"]}),e.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellVerticalAlignment"},view:t=>({key:"style",value:{"vertical-align":t}})}),e.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"vertical-align":eD}},model:{key:"tableCellVerticalAlignment",value:t=>{const e=t.getStyle("vertical-align");return e===n?null:e}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{valign:eD}},model:{key:"tableCellVerticalAlignment",value:t=>{const e=t.getAttribute("valign");return e===n?null:e}}})}(e,n,i.verticalAlignment),t.commands.add("tableCellVerticalAlignment",new ZE(t,i.verticalAlignment))}}const oD=2;function rD(t,e){return 4e3/sD(t,e)}function sD(t,e){const n=aD(t,"tbody",e)||aD(t,"thead",e);return lD(e.editing.view.domConverter.mapViewToDom(n))}function aD(t,e,n){return[...[...n.editing.mapper.toViewElement(t).getChildren()].find((t=>t.is("element","table"))).getChildren()].find((t=>t.is("element",e)))}function lD(t){const e=Gn.window.getComputedStyle(t);return"border-box"===e.boxSizing?parseFloat(e.width)-parseFloat(e.paddingLeft)-parseFloat(e.paddingRight)-parseFloat(e.borderLeftWidth)-parseFloat(e.borderRightWidth):parseFloat(e.width)}function cD(t){const e=Math.pow(10,oD),n="number"==typeof t?t:parseFloat(t);return Math.round(n*e)/e}function dD(t){return t.map((t=>"number"==typeof t?t:parseFloat(t))).filter((t=>!Number.isNaN(t))).reduce(((t,e)=>t+e),0)}function hD(t){let e=function(t){const e=t.filter((t=>"auto"===t)).length;if(0===e)return t.map((t=>cD(t)));const n=dD(t),i=Math.max((100-n)/e,5);return t.map((t=>"auto"===t?i:t)).map((t=>cD(t)))}(t.map((t=>"auto"===t?t:parseFloat(t.replace("%","")))));const n=dD(e);return 100!==n&&(e=e.map((t=>cD(100*t/n))).map(((t,e,n)=>e!==n.length-1?t:cD(t+100-dD(n))))),e.map((t=>t+"%"))}function uD(t){const e=Gn.window.getComputedStyle(t);return"border-box"===e.boxSizing?parseInt(e.width):parseFloat(e.width)+parseFloat(e.paddingLeft)+parseFloat(e.paddingRight)+parseFloat(e.borderWidth)}function mD(t,e,n,i){for(let o=0;ot.is("element","tableColumnGroup")))}function pD(t){return Array.from(gD(t).getChildren())}function fD(t){return pD(t).map((t=>t.getAttribute("columnWidth")))}class bD extends gr{refresh(){this.isEnabled=!0}execute(t={}){const{model:e,plugins:n}=this.editor;let{table:i=e.document.selection.getSelectedElement(),columnWidths:o,tableWidth:r}=t;o&&(o=Array.isArray(o)?o:o.split(",")),e.change((t=>{r?t.setAttribute("tableWidth",r,i):t.removeAttribute("tableWidth",i);const e=n.get("TableColumnResizeEditing").getColumnGroupElement(i);if(!o&&!e)return;if(!o)return t.remove(e);const s=hD(o);if(e)Array.from(e.getChildren()).forEach(((e,n)=>t.setAttribute("columnWidth",s[n],e)));else{const e=t.createElement("tableColumnGroup");s.forEach((n=>t.appendElement("tableColumn",{columnWidth:n},e))),t.append(e,i)}}))}}class kD extends ur{static get requires(){return[Px,fx]}static get pluginName(){return"TableColumnResizeEditing"}constructor(t){super(t),this._isResizingActive=!1,this.set("_isResizingAllowed",!0),this._resizingData=null,this._domEmitter=new(Fn()),this._tableUtilsPlugin=t.plugins.get("TableUtils"),this.on("change:_isResizingAllowed",((e,n,i)=>{const o=i?"removeClass":"addClass";t.editing.view.change((e=>{for(const n of t.editing.view.document.roots)e[o]("ck-column-resize_disabled",t.editing.view.document.getRoot(n.rootName))}))}))}init(){this._extendSchema(),this._registerPostFixer(),this._registerConverters(),this._registerResizingListeners(),this._registerResizerInserter();const t=this.editor,e=t.plugins.get("TableColumnResize");t.plugins.get("TableEditing").registerAdditionalSlot({filter:t=>t.is("element","tableColumnGroup"),positionOffset:0});const n=new bD(t);t.commands.add("resizeTableWidth",n),t.commands.add("resizeColumnWidths",n),this.bind("_isResizingAllowed").to(t,"isReadOnly",e,"isEnabled",n,"isEnabled",((t,e,n)=>!t&&e&&n))}destroy(){this._domEmitter.stopListening(),super.destroy()}getColumnGroupElement(t){return gD(t)}getTableColumnElements(t){return pD(t)}getTableColumnsWidths(t){return fD(t)}_extendSchema(){this.editor.model.schema.extend("table",{allowAttributes:["tableWidth"]}),this.editor.model.schema.register("tableColumnGroup",{allowIn:"table",isLimit:!0}),this.editor.model.schema.register("tableColumn",{allowIn:"tableColumnGroup",allowAttributes:["columnWidth"],isLimit:!0})}_registerPostFixer(){const t=this.editor.model;function e(t,e,n){const i=n._tableUtilsPlugin.getColumns(e);if(0==i-t.length)return t;const o=t.map((t=>Number(t.replace("%","")))),r=function(t,e){const n=new Set;for(const i of t.getChanges())if("insert"==i.type&&i.position.nodeAfter&&"tableCell"==i.position.nodeAfter.name&&i.position.nodeAfter.getAncestors().includes(e))n.add(i.position.nodeAfter);else if("remove"==i.type){const t=i.position.nodeBefore||i.position.nodeAfter;"tableCell"==t.name&&t.getAncestors().includes(e)&&n.add(t)}return n}(n.editor.model.document.differ,e);for(const t of r){const r=i-o.length;if(0===r)continue;const a=r>0,l=n._tableUtilsPlugin.getCellLocation(t).column;if(a){const t=(s=rD(e,n.editor),Array(r).fill(s));o.splice(l,0,...t)}else{const t=o.splice(l,Math.abs(r));o[l]+=dD(t)}}var s;return o.map((t=>t+"%"))}t.document.registerPostFixer((n=>{let i=!1;for(const o of function(t){const e=new Set;for(const n of t.document.differ.getChanges()){let i=null;switch(n.type){case"insert":i=["table","tableRow","tableCell"].includes(n.name)?n.position:null;break;case"remove":i=["tableRow","tableCell"].includes(n.name)?n.position:null;break;case"attribute":n.range.start.nodeAfter&&(i=["table","tableRow","tableCell"].includes(n.range.start.nodeAfter.name)?n.range.start:null)}if(!i)continue;const o=i.nodeAfter&&i.nodeAfter.is("element","table")?i.nodeAfter:i.findAncestor("table");for(const n of t.createRangeOn(o).getItems())n.is("element","table")&&gD(n)&&e.add(n)}return e}(t)){const t=this.getColumnGroupElement(o),r=this.getTableColumnElements(t),s=this.getTableColumnsWidths(t);let a=hD(s);a=e(a,o,this),rd(s,a)||(mD(r,t,a,n),i=!0)}return i}))}_registerConverters(){const t=this.editor.conversion;var e;t.for("upcast").attributeToAttribute({view:{name:"figure",key:"style",value:{width:/[\s\S]+/}},model:{name:"table",key:"tableWidth",value:t=>t.getStyle("width")}}),t.for("downcast").attributeToAttribute({model:{name:"table",key:"tableWidth"},view:t=>({name:"figure",key:"style",value:{width:t}})}),t.elementToElement({model:"tableColumnGroup",view:"colgroup"}),t.elementToElement({model:"tableColumn",view:"col"}),t.for("downcast").add((t=>t.on("insert:table",((t,e,n)=>{const i=n.writer,o=e.item,r=n.mapper.toViewElement(o),s=r.is("element","table")?r:Array.from(r.getChildren()).find((t=>t.is("element","table")));gD(o)?i.addClass("ck-table-resized",s):i.removeClass("ck-table-resized",s)}),{priority:"low"}))),t.for("upcast").add((e=this._tableUtilsPlugin,t=>t.on("element:colgroup",((t,n,i)=>{const o=n.modelCursor.findAncestor("table"),r=gD(o);if(!r)return;const s=pD(r);let a=fD(r);const l=e.getColumns(o);a=Array.from({length:l},((t,e)=>a[e]||"auto")),(a.length!=s.length||a.includes("auto"))&&mD(s,r,hD(a),i.writer)}),{priority:"low"}))),t.for("upcast").attributeToAttribute({view:{name:"col",styles:{width:/.*/}},model:{key:"columnWidth",value:t=>{const e=t.getStyle("width");return e&&e.endsWith("%")?e:"auto"}}}),t.for("downcast").attributeToAttribute({model:{name:"tableColumn",key:"columnWidth"},view:t=>({key:"style",value:{width:t}})})}_registerResizingListeners(){const t=this.editor.editing.view;t.addObserver(Yx),t.document.on("mousedown",this._onMouseDownHandler.bind(this),{priority:"high"}),this._domEmitter.listenTo(Gn.window.document,"mousemove",bm(this._onMouseMoveHandler.bind(this),50)),this._domEmitter.listenTo(Gn.window.document,"mouseup",this._onMouseUpHandler.bind(this))}_onMouseDownHandler(t,e){const n=e.target;if(!n.hasClass("ck-table-column-resizer"))return;if(!this._isResizingAllowed)return;const i=this.editor,o=i.editing.mapper.toModelElement(n.findAncestor("figure"));if(!i.model.canEditAt(o))return;e.preventDefault(),t.stop();const r=function(t,e,n){const i=Array(e.getColumns(t)),o=new Uy(t);for(const t of o){const e=n.editing.mapper.toViewElement(t.cell),o=uD(n.editing.view.domConverter.mapViewToDom(e));(!i[t.column]||ot.is("element","colgroup")))||a.change((t=>{!function(t,e,n){const i=t.createContainerElement("colgroup");for(let n=0;nfunction(t,e,n){const i=n.widths.viewFigureWidth/n.widths.viewFigureParentWidth;t.addClass("ck-table-resized",e),t.addClass("ck-table-column-resizer__active",n.elements.viewResizer),t.setStyle("width",`${cD(100*i)}%`,e.findAncestor("figure"))}(t,s,this._resizingData)))}_onMouseMoveHandler(t,e){if(!this._isResizingActive)return;if(!this._isResizingAllowed)return void this._onMouseUpHandler();const{columnPosition:n,flags:{isRightEdge:i,isTableCentered:o,isLtrContent:r},elements:{viewFigure:s,viewLeftColumn:a,viewRightColumn:l},widths:{viewFigureParentWidth:c,tableWidth:d,leftColumnWidth:h,rightColumnWidth:u}}=this._resizingData,m=40-h,g=i?c-d:u-40,p=(r?1:-1)*(i&&o?2:1),f=(b=(e.clientX-n)*p,k=Math.min(m,0),w=Math.max(g,0),cD(b<=k?k:b>=w?w:b));var b,k,w;0!==f&&this.editor.editing.view.change((t=>{const e=cD(100*(h+f)/d);if(t.setStyle("width",`${e}%`,a),i){const e=cD(100*(d+f)/c);t.setStyle("width",`${e}%`,s)}else{const e=cD(100*(u-f)/d);t.setStyle("width",`${e}%`,l)}}))}_onMouseUpHandler(){if(!this._isResizingActive)return;const{viewResizer:t,modelTable:e,viewFigure:n,viewColgroup:i}=this._resizingData.elements,o=this.editor,r=o.editing.view,s=this.getColumnGroupElement(e),a=Array.from(i.getChildren()).filter((t=>t.is("view:element"))),l=s?this.getTableColumnsWidths(s):null,c=a.map((t=>t.getStyle("width"))),d=!rd(l,c),h=e.getAttribute("tableWidth"),u=n.getStyle("width"),m=h!==u;(d||m)&&(this._isResizingAllowed?o.execute("resizeTableWidth",{table:e,tableWidth:`${cD(u)}%`,columnWidths:c}):r.change((t=>{if(l)for(const e of a)t.setStyle("width",l.shift(),e);else t.remove(i);m&&(h?t.setStyle("width",h,n):t.removeStyle("width",n)),l||h||t.removeClass("ck-table-resized",[...n.getChildren()].find((t=>"table"===t.name)))}))),r.change((e=>{e.removeClass("ck-table-column-resizer__active",t)})),this._isResizingActive=!1,this._resizingData=null}_getResizingData(t,e){const n=this.editor,i=t.domEvent.clientX,o=t.target,r=o.findAncestor("td")||o.findAncestor("th"),s=n.editing.mapper.toModelElement(r),a=s.findAncestor("table"),l=function(t,e){const n=e.getCellLocation(t).column;return{leftEdge:n,rightEdge:n+(t.getAttribute("colspan")||1)-1}}(s,this._tableUtilsPlugin).rightEdge,c=l===this._tableUtilsPlugin.getColumns(a)-1,d=!a.hasAttribute("tableAlignment"),h="rtl"!==n.locale.contentLanguageDirection,u=r.findAncestor("table"),m=u.findAncestor("figure"),g=[...u.getChildren()].find((t=>t.is("element","colgroup"))),p=g.getChild(l),f=c?void 0:g.getChild(l+1);return{columnPosition:i,flags:{isRightEdge:c,isTableCentered:d,isLtrContent:h},elements:{viewResizer:o,modelTable:a,viewFigure:m,viewColgroup:g,viewLeftColumn:p,viewRightColumn:f},widths:{viewFigureParentWidth:lD(n.editing.view.domConverter.mapViewToDom(m.parent)),viewFigureWidth:lD(n.editing.view.domConverter.mapViewToDom(m)),tableWidth:sD(a,n),leftColumnWidth:e[l],rightColumnWidth:c?void 0:e[l+1]}}}_registerResizerInserter(){this.editor.conversion.for("editingDowncast").add((t=>{t.on("insert:tableCell",((t,e,n)=>{const i=e.item,o=n.mapper.toViewElement(i),r=n.writer;r.insert(r.createPositionAt(o,"end"),r.createUIElement("div",{class:"ck-table-column-resizer"}))}),{priority:"lowest"})}))}}var wD=n(728);Wi()(wD.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),wD.Z.locals;class AD extends gr{constructor(t,e,n){super(t),this.attributeName=e,this._defaultValue=n}refresh(){const t=this.editor.model.document.selection.getFirstPosition().findAncestor("table");this.isEnabled=!!t,this.value=this._getValue(t)}execute(t={}){const e=this.editor.model,n=e.document.selection,{value:i,batch:o}=t,r=n.getFirstPosition().findAncestor("table"),s=this._getValueToSet(i);e.enqueueChange(o,(t=>{s?t.setAttribute(this.attributeName,s,r):t.removeAttribute(this.attributeName,r)}))}_getValue(t){if(!t)return;const e=t.getAttribute(this.attributeName);return e!==this._defaultValue?e:void 0}_getValueToSet(t){if(t!==this._defaultValue)return t}}class CD extends AD{constructor(t,e){super(t,"tableBackgroundColor",e)}}class _D extends AD{constructor(t,e){super(t,"tableBorderColor",e)}_getValue(t){if(!t)return;const e=VE(t.getAttribute(this.attributeName));return e!==this._defaultValue?e:void 0}}class vD extends AD{constructor(t,e){super(t,"tableBorderStyle",e)}_getValue(t){if(!t)return;const e=VE(t.getAttribute(this.attributeName));return e!==this._defaultValue?e:void 0}}class yD extends AD{constructor(t,e){super(t,"tableBorderWidth",e)}_getValue(t){if(!t)return;const e=VE(t.getAttribute(this.attributeName));return e!==this._defaultValue?e:void 0}_getValueToSet(t){const e=FE(t,"px");if(e!==this._defaultValue)return e}}class xD extends AD{constructor(t,e){super(t,"tableWidth",e)}_getValueToSet(t){if((t=FE(t,"px"))!==this._defaultValue)return t}}class ED extends AD{constructor(t,e){super(t,"tableHeight",e)}_getValueToSet(t){if((t=FE(t,"px"))!==this._defaultValue)return t}}class DD extends AD{constructor(t,e){super(t,"tableAlignment",e)}}const SD=/^(left|center|right)$/,TD=/^(left|none|right)$/;class ID extends ur{static get pluginName(){return"TablePropertiesEditing"}static get requires(){return[Px]}init(){const t=this.editor,e=t.model.schema,n=t.conversion;t.config.define("table.tableProperties.defaultProperties",{});const i=jE(t.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0});t.data.addStyleProcessorRules(Vh),function(t,e,n){const i={width:"tableBorderWidth",color:"tableBorderColor",style:"tableBorderStyle"};t.extend("table",{allowAttributes:Object.values(i)}),Ny(e,"table",i,n),Ly(e,{modelAttribute:i.color,styleName:"border-color"}),Ly(e,{modelAttribute:i.style,styleName:"border-style"}),Ly(e,{modelAttribute:i.width,styleName:"border-width"})}(e,n,{color:i.borderColor,style:i.borderStyle,width:i.borderWidth}),t.commands.add("tableBorderColor",new _D(t,i.borderColor)),t.commands.add("tableBorderStyle",new vD(t,i.borderStyle)),t.commands.add("tableBorderWidth",new yD(t,i.borderWidth)),function(t,e,n){t.extend("table",{allowAttributes:["tableAlignment"]}),e.for("downcast").attributeToAttribute({model:{name:"table",key:"tableAlignment"},view:t=>({key:"style",value:{float:"center"===t?"none":t}}),converterPriority:"high"}),e.for("upcast").attributeToAttribute({view:{name:/^(table|figure)$/,styles:{float:TD}},model:{key:"tableAlignment",value:t=>{let e=t.getStyle("float");return"none"===e&&(e="center"),e===n?null:e}}}).attributeToAttribute({view:{attributes:{align:SD}},model:{name:"table",key:"tableAlignment",value:t=>{const e=t.getAttribute("align");return e===n?null:e}}})}(e,n,i.alignment),t.commands.add("tableAlignment",new DD(t,i.alignment)),BD(e,n,{modelAttribute:"tableWidth",styleName:"width",defaultValue:i.width}),t.commands.add("tableWidth",new xD(t,i.width)),BD(e,n,{modelAttribute:"tableHeight",styleName:"height",defaultValue:i.height}),t.commands.add("tableHeight",new ED(t,i.height)),t.data.addStyleProcessorRules(Oh),function(t,e,n){const{modelAttribute:i}=n;t.extend("table",{allowAttributes:[i]}),My(e,{viewElement:"table",...n}),Ly(e,n)}(e,n,{modelAttribute:"tableBackgroundColor",styleName:"background-color",defaultValue:i.backgroundColor}),t.commands.add("tableBackgroundColor",new CD(t,i.backgroundColor))}}function BD(t,e,n){const{modelAttribute:i}=n;t.extend("table",{allowAttributes:[i]}),My(e,{viewElement:/^(table|figure)$/,shouldUpcast:t=>!("table"==t.name&&"figure"==t.parent.name),...n}),zy(e,{modelElement:"table",...n})}var MD=n(9221);Wi()(MD.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),MD.Z.locals;const ND={left:iu.objectLeft,center:iu.objectCenter,right:iu.objectRight};class zD extends $i{constructor(t,e){super(t),this.set({borderStyle:"",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",alignment:""}),this.options=e;const{borderStyleDropdown:n,borderWidthInput:i,borderColorInput:o,borderRowLabel:r}=this._createBorderFields(),{backgroundRowLabel:s,backgroundInput:a}=this._createBackgroundFields(),{widthInput:l,operatorLabel:c,heightInput:d,dimensionsLabel:h}=this._createDimensionFields(),{alignmentToolbar:u,alignmentLabel:m}=this._createAlignmentFields();this.focusTracker=new Li,this.keystrokes=new Pi,this.children=this.createCollection(),this.borderStyleDropdown=n,this.borderWidthInput=i,this.borderColorInput=o,this.backgroundInput=a,this.widthInput=l,this.heightInput=d,this.alignmentToolbar=u;const{saveButtonView:g,cancelButtonView:p}=this._createActionButtons();this.saveButtonView=g,this.cancelButtonView=p,this._focusables=new Ui,this._focusCycler=new ar({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Bm(t,{label:this.t("Table properties")})),this.children.add(new vE(t,{labelView:r,children:[r,n,o,i],class:"ck-table-form__border-row"})),this.children.add(new vE(t,{labelView:s,children:[s,a],class:"ck-table-form__background-row"})),this.children.add(new vE(t,{children:[new vE(t,{labelView:h,children:[h,l,c,d],class:"ck-table-form__dimensions-row"}),new vE(t,{labelView:m,children:[m,u],class:"ck-table-properties-form__alignment-row"})]})),this.children.add(new vE(t,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),o({view:this}),[this.borderStyleDropdown,this.borderColorInput,this.borderColorInput.fieldView.dropdownView.buttonView,this.borderWidthInput,this.backgroundInput,this.backgroundInput.fieldView.dropdownView.buttonView,this.widthInput,this.heightInput,this.alignmentToolbar,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()}_createBorderFields(){const t=this.options.defaultTableProperties,e={style:t.borderStyle,width:t.borderWidth,color:t.borderColor},n=AE({colorConfig:this.options.borderColors,columns:5,defaultColorValue:e.color}),i=this.locale,o=this.t,r=o("Style"),s=new Yo(i);s.text=o("Border");const a=hE(o),l=new Qo(i,Du);l.set({label:r,class:"ck-table-form__border-style"}),l.fieldView.buttonView.set({ariaLabel:r,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:r}),l.fieldView.buttonView.bind("label").to(this,"borderStyle",(t=>a[t||"none"])),l.fieldView.on("execute",(t=>{this.borderStyle=t.source._borderStyleValue})),l.bind("isEmpty").to(this,"borderStyle",(t=>!t)),_u(l.fieldView,bE(this,e.style),{role:"menu",ariaLabel:r});const c=new Qo(i,xu);c.set({label:o("Width"),class:"ck-table-form__border-width"}),c.fieldView.bind("value").to(this,"borderWidth"),c.bind("isEnabled").to(this,"borderStyle",LD),c.fieldView.on("input",(()=>{this.borderWidth=c.fieldView.element.value}));const d=new Qo(i,n);return d.set({label:o("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",LD),d.fieldView.on("input",(()=>{this.borderColor=d.fieldView.value})),this.on("change:borderStyle",((t,n,i,o)=>{LD(i)||(this.borderColor="",this.borderWidth=""),LD(o)||(this.borderColor=e.color,this.borderWidth=e.width)})),{borderRowLabel:s,borderStyleDropdown:l,borderColorInput:d,borderWidthInput:c}}_createBackgroundFields(){const t=this.locale,e=this.t,n=new Yo(t);n.text=e("Background");const i=AE({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableProperties.backgroundColor}),o=new Qo(t,i);return o.set({label:e("Color"),class:"ck-table-properties-form__background"}),o.fieldView.bind("value").to(this,"backgroundColor"),o.fieldView.on("input",(()=>{this.backgroundColor=o.fieldView.value})),{backgroundRowLabel:n,backgroundInput:o}}_createDimensionFields(){const t=this.locale,e=this.t,n=new Yo(t);n.text=e("Dimensions");const i=new Qo(t,xu);i.set({label:e("Width"),class:"ck-table-form__dimensions-row__width"}),i.fieldView.bind("value").to(this,"width"),i.fieldView.on("input",(()=>{this.width=i.fieldView.element.value}));const o=new $i(t);o.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const r=new Qo(t,xu);return r.set({label:e("Height"),class:"ck-table-form__dimensions-row__height"}),r.fieldView.bind("value").to(this,"height"),r.fieldView.on("input",(()=>{this.height=r.fieldView.element.value})),{dimensionsLabel:n,widthInput:i,operatorLabel:o,heightInput:r}}_createAlignmentFields(){const t=this.locale,e=this.t,n=new Yo(t);n.text=e("Alignment");const i=new au(t);return i.set({isCompact:!0,ariaLabel:e("Table alignment toolbar")}),kE({view:this,icons:ND,toolbar:i,labels:this._alignmentLabels,propertyName:"alignment",defaultValue:this.options.defaultTableProperties.alignment}),{alignmentLabel:n,alignmentToolbar:i}}_createActionButtons(){const t=this.locale,e=this.t,n=new Ao(t),i=new Ao(t),o=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return n.set({label:e("Save"),icon:iu.check,class:"ck-button-save",type:"submit",withText:!0}),n.bind("isEnabled").toMany(o,"errorText",((...t)=>t.every((t=>!t)))),i.set({label:e("Cancel"),icon:iu.cancel,class:"ck-button-cancel",withText:!0}),i.delegate("execute").to(this,"cancel"),{saveButtonView:n,cancelButtonView:i}}get _alignmentLabels(){const t=this.locale,e=this.t,n=e("Align table to the left"),i=e("Center table"),o=e("Align table to the right");return"rtl"===t.uiLanguageDirection?{right:o,center:i,left:n}:{left:n,center:i,right:o}}}function LD(t){return"none"!==t}const PD={borderStyle:"tableBorderStyle",borderColor:"tableBorderColor",borderWidth:"tableBorderWidth",backgroundColor:"tableBackgroundColor",width:"tableWidth",height:"tableHeight",alignment:"tableAlignment"};class RD extends ur{static get requires(){return[Om]}static get pluginName(){return"TablePropertiesUI"}constructor(t){super(t),this.view=null,t.config.define("table.tableProperties",{borderColors:wE,backgroundColors:wE})}init(){const t=this.editor,e=t.t;this._defaultTableProperties=jE(t.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),this._balloon=t.plugins.get(Om),t.ui.componentFactory.add("tableProperties",(n=>{const i=new Ao(n);i.set({label:e("Table properties"),icon:' ',tooltip:!0}),this.listenTo(i,"execute",(()=>this._showView()));const o=Object.values(PD).map((e=>t.commands.get(e)));return i.bind("isEnabled").toMany(o,"isEnabled",((...t)=>t.some((t=>t)))),i}))}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(){const e=this.editor,n=e.config.get("table.tableProperties"),i=yo(n.borderColors),o=vo(e.locale,i),r=yo(n.backgroundColors),s=vo(e.locale,r),a=new zD(e.locale,{borderColors:o,backgroundColors:s,defaultTableProperties:this._defaultTableProperties}),l=e.t;a.render(),this.listenTo(a,"submit",(()=>{this._hideView()})),this.listenTo(a,"cancel",(()=>{this._undoStepBatch.operations.length&&e.execute("undo",this._undoStepBatch),this._hideView()})),a.keystrokes.set("Esc",((t,e)=>{this._hideView(),e()})),t({emitter:a,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const c=uE(l),d=mE(l);return a.on("change:borderStyle",this._getPropertyChangeCallback("tableBorderStyle")),a.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:a.borderColorInput,commandName:"tableBorderColor",errorText:c,validator:gE})),a.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:a.borderWidthInput,commandName:"tableBorderWidth",errorText:d,validator:fE})),a.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:a.backgroundInput,commandName:"tableBackgroundColor",errorText:c,validator:gE})),a.on("change:width",this._getValidatedPropertyChangeCallback({viewField:a.widthInput,commandName:"tableWidth",errorText:d,validator:pE})),a.on("change:height",this._getValidatedPropertyChangeCallback({viewField:a.heightInput,commandName:"tableHeight",errorText:d,validator:pE})),a.on("change:alignment",this._getPropertyChangeCallback("tableAlignment")),a}_fillViewFormFromCommandValues(){const t=this.editor.commands,e=t.get("tableBorderStyle");Object.entries(PD).map((([e,n])=>{const i=e,o=this._defaultTableProperties[i]||"";return[i,t.get(n).value||o]})).forEach((([t,n])=>{("borderColor"!==t&&"borderWidth"!==t||"none"!==e.value)&&this.view.set(t,n)})),this._isReady=!0}_showView(){const t=this.editor;this.view||(this.view=this._createPropertiesView()),this.listenTo(t.ui,"update",(()=>{this._updateView()})),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:PE(t)}),this._undoStepBatch=t.model.createBatch(),this.view.focus()}_hideView(){const t=this.editor;this.stopListening(t.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){const t=this.editor;BE(t.editing.view.document.selection)?this._isViewVisible&&LE(t,"table"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(t){return(e,n,i)=>{this._isReady&&this.editor.execute(t,{value:i,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(t){const{commandName:e,viewField:n,validator:i,errorText:o}=t,r=$o((()=>{n.errorText=o}),500);return(t,o,s)=>{r.cancel(),this._isReady&&(i(s)?(this.editor.execute(e,{value:s,batch:this._undoStepBatch}),n.errorText=null):r())}}}function OD(t,e){return`${t}:${e=e||Ii(t)}`}class VD extends gr{refresh(){const t=this.editor.model,e=t.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=t.schema.checkAttributeInSelection(e.selection,"language")}execute({languageCode:t,textDirection:e}={}){const n=this.editor.model,i=n.document.selection,o=!!t&&OD(t,e);n.change((t=>{if(i.isCollapsed)o?t.setSelectionAttribute("language",o):t.removeSelectionAttribute("language");else{const e=n.schema.getValidRanges(i.getRanges(),"language");for(const n of e)o?t.setAttribute("language",o,n):t.removeAttribute("language",n)}}))}_getValueFromFirstAllowedNode(){const t=this.editor.model,e=t.schema,n=t.document.selection;if(n.isCollapsed)return n.getAttribute("language")||!1;for(const t of n.getRanges())for(const n of t.getItems())if(e.checkAttribute(n,"language"))return n.getAttribute("language")||!1;return!1}}class FD extends ur{static get pluginName(){return"TextPartLanguageEditing"}constructor(t){super(t),t.config.define("language",{textPartLanguage:[{title:"Arabic",languageCode:"ar"},{title:"French",languageCode:"fr"},{title:"Spanish",languageCode:"es"}]})}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:"language"}),t.model.schema.setAttributeProperties("language",{copyOnEnter:!0}),this._defineConverters(),t.commands.add("textPartLanguage",new VD(t))}_defineConverters(){const t=this.editor.conversion;t.for("upcast").elementToAttribute({model:{key:"language",value:t=>OD(t.getAttribute("lang"),t.getAttribute("dir"))},view:{name:"span",attributes:{lang:/[\s\S]+/}}}),t.for("downcast").attributeToElement({model:"language",view:(t,{writer:e},n)=>{if(!t)return;if(!n.item.is("$textProxy")&&!n.item.is("documentSelection"))return;const{languageCode:i,textDirection:o}=function(t){const[e,n]=t.split(":");return{languageCode:e,textDirection:n}}(t);return e.createAttributeElement("span",{lang:i,dir:o})}})}}class jD extends ur{static get pluginName(){return"TextPartLanguageUI"}init(){const t=this.editor,e=t.t,n=t.config.get("language.textPartLanguage"),i=e("Choose language"),o=e("Remove language"),r=e("Language");t.ui.componentFactory.add("textPartLanguage",(e=>{const s=new Ni,a={},l=t.commands.get("textPartLanguage");s.add({type:"button",model:new Nm({label:o,languageCode:!1,withText:!0})}),s.add({type:"separator"});for(const t of n){const e={type:"button",model:new Nm({label:t.title,languageCode:t.languageCode,role:"menuitemradio",textDirection:t.textDirection,withText:!0})},n=OD(t.languageCode,t.textDirection);e.model.bind("isOn").to(l,"value",(t=>t===n)),s.add(e),a[n]=t.title}const c=wu(e);return _u(c,s,{ariaLabel:r,role:"menu"}),c.buttonView.set({ariaLabel:r,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:r}),c.extendTemplate({attributes:{class:["ck-text-fragment-language-dropdown"]}}),c.bind("isEnabled").to(l,"isEnabled"),c.buttonView.bind("label").to(l,"value",(t=>t&&a[t]||i)),this.listenTo(c,"execute",(e=>{l.execute({languageCode:e.source.languageCode,textDirection:e.source.textDirection}),t.editing.view.focus()})),c}))}}const HD="todoListChecked";class UD extends gr{constructor(t){super(t),this._selectedElements=[],this.on("execute",(()=>{this.refresh()}),{priority:"highest"})}refresh(){this._selectedElements=this._getSelectedItems(),this.value=this._selectedElements.every((t=>!!t.getAttribute(HD))),this.isEnabled=!!this._selectedElements.length}_getSelectedItems(){const t=this.editor.model,e=t.schema,n=t.document.selection.getFirstRange(),i=n.start.parent,o=[];e.checkAttribute(i,HD)&&o.push(i);for(const t of n.getItems())e.checkAttribute(t,HD)&&!o.includes(t)&&o.push(t);return o}execute(t={}){this.editor.model.change((e=>{for(const n of this._selectedElements)(void 0===t.forceValue?!this.value:t.forceValue)?e.setAttribute(HD,!0,n):e.removeAttribute(HD,n)}))}}const GD=(t,e,n)=>{const i=e.modelCursor,o=i.parent,r=e.viewItem;if("checkbox"!=r.getAttribute("type")||"listItem"!=o.name||!i.isAtStart)return;if(!n.consumable.consume(r,{name:!0}))return;const s=n.writer;s.setAttribute("listType","todo",o),e.viewItem.hasAttribute("checked")&&s.setAttribute("todoListChecked",!0,o),e.modelRange=s.createRange(i)};function WD(t){return(e,n)=>{const i=n.modelPosition,o=i.parent;if(!o.is("element","listItem")||"todo"!=o.getAttribute("listType"))return;const r=$D(n.mapper.toViewElement(o),t);r&&(n.viewPosition=n.mapper.findPositionIn(r,i.offset))}}function qD(t,e,n,i){return e.createUIElement("label",{class:"todo-list__label",contenteditable:!1},(function(e){const o=gt(document,"input",{type:"checkbox",tabindex:"-1"});n&&o.setAttribute("checked","checked"),o.addEventListener("change",(()=>i(t)));const r=this.toDomElement(e);return r.appendChild(o),r}))}function $D(t,e){const n=e.createRangeIn(t);for(const t of n)if(t.item.is("containerElement","span")&&t.item.hasClass("todo-list__label__description"))return t.item}const KD=Ei("Ctrl+Enter");class YD extends ur{static get pluginName(){return"TodoListEditing"}static get requires(){return[B_]}init(){const t=this.editor,{editing:e,data:n,model:i}=t;i.schema.extend("listItem",{allowAttributes:["todoListChecked"]}),i.schema.addAttributeCheck(((t,e)=>{const n=t.last;if("todoListChecked"==e&&"listItem"==n.name&&"todo"!=n.getAttribute("listType"))return!1})),t.commands.add("todoList",new XC(t,"todo"));const o=new UD(t);var r,s;t.commands.add("checkTodoList",o),t.commands.add("todoListCheck",o),n.downcastDispatcher.on("insert:listItem",function(t){return(e,n,i)=>{const o=i.consumable;if(!o.test(n.item,"insert")||!o.test(n.item,"attribute:listType")||!o.test(n.item,"attribute:listIndent"))return;if("todo"!=n.item.getAttribute("listType"))return;const r=n.item;o.consume(r,"insert"),o.consume(r,"attribute:listType"),o.consume(r,"attribute:listIndent"),o.consume(r,"attribute:todoListChecked");const s=i.writer,a=i_(r,i);s.addClass("todo-list",a.parent);const l=s.createContainerElement("label",{class:"todo-list__label"}),c=s.createEmptyElement("input",{type:"checkbox",disabled:"disabled"}),d=s.createContainerElement("span",{class:"todo-list__label__description"});r.getAttribute("todoListChecked")&&s.setAttribute("checked","checked",c),s.insert(s.createPositionAt(a,0),l),s.insert(s.createPositionAt(l,0),c),s.insert(s.createPositionAfter(c),d),o_(r,a,i,t)}}(i),{priority:"high"}),n.upcastDispatcher.on("element:input",GD,{priority:"high"}),e.downcastDispatcher.on("insert:listItem",function(t,e){return(n,i,o)=>{const r=o.consumable;if(!r.test(i.item,"insert")||!r.test(i.item,"attribute:listType")||!r.test(i.item,"attribute:listIndent"))return;if("todo"!=i.item.getAttribute("listType"))return;const s=i.item;r.consume(s,"insert"),r.consume(s,"attribute:listType"),r.consume(s,"attribute:listIndent"),r.consume(s,"attribute:todoListChecked");const a=o.writer,l=i_(s,o),c=!!s.getAttribute("todoListChecked"),d=qD(s,a,c,e),h=a.createContainerElement("span",{class:"todo-list__label__description"});a.addClass("todo-list",l.parent),a.insert(a.createPositionAt(l,0),d),a.insert(a.createPositionAfter(d),h),o_(s,l,o,t)}}(i,(t=>this._handleCheckmarkChange(t))),{priority:"high"}),e.downcastDispatcher.on("attribute:listType:listItem",(r=t=>this._handleCheckmarkChange(t),s=e.view,(t,e,n)=>{if(!n.consumable.consume(e.item,t.name))return;const i=n.mapper.toViewElement(e.item),o=n.writer,a=function(t,e){const n=e.createRangeIn(t);for(const t of n)if(t.item.is("uiElement","label"))return t.item}(i,s);if("todo"==e.attributeNewValue){const t=!!e.item.getAttribute("todoListChecked"),n=qD(e.item,o,t,r),s=o.createContainerElement("span",{class:"todo-list__label__description"}),a=o.createRangeIn(i),l=c_(i),c=s_(a.start),d=l?o.createPositionBefore(l):a.end,h=o.createRange(c,d);o.addClass("todo-list",i.parent),o.move(h,o.createPositionAt(s,0)),o.insert(o.createPositionAt(i,0),n),o.insert(o.createPositionAfter(n),s)}else if("todo"==e.attributeOldValue){const t=$D(i,s);o.removeClass("todo-list",i.parent),o.remove(a),o.move(o.createRangeIn(t),o.createPositionBefore(t)),o.remove(t)}})),e.downcastDispatcher.on("attribute:todoListChecked:listItem",function(t){return(e,n,i)=>{if("todo"!=n.item.getAttribute("listType"))return;if(!i.consumable.consume(n.item,"attribute:todoListChecked"))return;const{mapper:o,writer:r}=i,s=!!n.item.getAttribute("todoListChecked"),a=o.toViewElement(n.item).getChild(0),l=qD(n.item,r,s,t);r.insert(r.createPositionAfter(a),l),r.remove(a)}}((t=>this._handleCheckmarkChange(t)))),e.mapper.on("modelToViewPosition",WD(e.view)),n.mapper.on("modelToViewPosition",WD(e.view)),this.listenTo(e.view.document,"arrowKey",function(t,e){return(n,i)=>{if("left"!=Si(i.keyCode,e.contentLanguageDirection))return;const o=t.schema,r=t.document.selection;if(!r.isCollapsed)return;const s=r.getFirstPosition(),a=s.parent;if("listItem"===a.name&&"todo"==a.getAttribute("listType")&&s.isAtStart){const e=o.getNearestSelectionRange(t.createPositionBefore(a),"backward");e&&t.change((t=>t.setSelection(e))),i.preventDefault(),i.stopPropagation(),n.stop()}}}(i,t.locale),{context:"li"}),this.listenTo(e.view.document,"keydown",((e,n)=>{xi(n)===KD&&(t.execute("checkTodoList"),e.stop())}),{priority:"high"});const a=new Set;this.listenTo(i,"applyOperation",((t,e)=>{const n=e[0];if("rename"==n.type&&"listItem"==n.oldName){const t=n.position.nodeAfter;t.hasAttribute("todoListChecked")&&a.add(t)}else if("changeAttribute"==n.type&&"listType"==n.key&&"todo"===n.oldValue)for(const t of n.range.getItems())t.hasAttribute("todoListChecked")&&"todo"!==t.getAttribute("listType")&&a.add(t)})),i.document.registerPostFixer((t=>{let e=!1;for(const n of a)t.removeAttribute("todoListChecked",n),e=!0;return a.clear(),e}))}_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)}))}}class ZD extends ur{static get pluginName(){return"TodoListUI"}init(){const t=this.editor.t;l_(this.editor,"todoList",t("To-do List"),' ')}}var QD=n(1588);Wi()(QD.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),QD.Z.locals;const JD="underline";class XD extends ur{static get pluginName(){return"UnderlineEditing"}init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:JD}),t.model.schema.setAttributeProperties(JD,{isFormatting:!0,copyOnEnter:!0}),t.conversion.attributeToElement({model:JD,view:"u",upcastAlso:{styles:{"text-decoration":"underline"}}}),t.commands.add(JD,new ib(t,JD)),t.keystrokes.set("CTRL+U","underline")}}const tS="underline";class eS extends ur{static get pluginName(){return"UnderlineUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add(tS,(n=>{const i=t.commands.get(tS),o=new Ao(n);return o.set({label:e("Underline"),icon:' ',keystroke:"CTRL+U",tooltip:!0,isToggleable:!0}),o.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(o,"execute",(()=>{t.execute(tS),t.editing.view.focus()})),o}))}}function nS(t){if(t.is("$text")||t.is("$textProxy"))return t.data;const e=t;let n="",i=null;for(const t of e.getChildren()){const e=nS(t);i&&i.is("element")&&(n+="\n"),n+=e,i=t}return n}class iS extends ig{}iS.builtinPlugins=[class extends ur{static get requires(){return[hg,mg]}static get pluginName(){return"Alignment"}},class extends ur{static get requires(){return[Jp,mf,cf,Bg]}static get pluginName(){return"AutoImage"}constructor(t){super(t),this._timeoutId=null,this._positionToInsert=null}init(){const t=this.editor,e=t.model.document,n=t.plugins.get("ClipboardPipeline");this.listenTo(n,"inputTransformation",(()=>{const t=e.selection.getFirstRange(),n=yd.fromPosition(t.start);n.stickiness="toPrevious";const i=yd.fromPosition(t.end);i.stickiness="toNext",e.once("change:data",(()=>{this._embedImageBetweenPositions(n,i),n.detach(),i.detach()}),{priority:"high"})})),t.commands.get("undo").on("execute",(()=>{this._timeoutId&&(Gn.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)}),{priority:"high"})}_embedImageBetweenPositions(t,e){const n=this.editor,i=new Vl(t,e),o=i.getWalker({ignoreElementEnd:!0}),r=Object.fromEntries(n.model.document.selection.getAttributes()),s=this.editor.plugins.get("ImageUtils");let a="";for(const t of o)t.item.is("$textProxy")&&(a+=t.item.data);a=a.trim(),a.match(pf)?(this._positionToInsert=yd.fromPosition(t),this._timeoutId=setTimeout((()=>{n.commands.get("insertImage").isEnabled?(n.model.change((t=>{let e;this._timeoutId=null,t.remove(i),i.detach(),"$graveyard"!==this._positionToInsert.root.rootName&&(e=this._positionToInsert.toPosition()),s.insertImage({...r,src:a},e),this._positionToInsert.detach(),this._positionToInsert=null})),n.plugins.get("Delete").requestUndoOnBackspace()):i.detach()}),100)):i.detach()}},class extends ur{static get requires(){return[Bg]}static get pluginName(){return"Autoformat"}afterInit(){this._addListAutoformats(),this._addBasicStylesAutoformats(),this._addHeadingAutoformats(),this._addBlockQuoteAutoformats(),this._addCodeBlockAutoformats(),this._addHorizontalLineAutoformats()}_addListAutoformats(){const t=this.editor.commands;t.get("bulletedList")&&ff(this.editor,this,/^[*-]\s$/,"bulletedList"),t.get("numberedList")&&ff(this.editor,this,/^1[.|)]\s$/,"numberedList"),t.get("todoList")&&ff(this.editor,this,/^\[\s?\]\s$/,"todoList"),t.get("checkTodoList")&&ff(this.editor,this,/^\[\s?x\s?\]\s$/,(()=>{this.editor.execute("todoList"),this.editor.execute("checkTodoList")}))}_addBasicStylesAutoformats(){const t=this.editor.commands;if(t.get("bold")){const t=wf(this.editor,"bold");bf(this.editor,this,/(?:^|\s)(\*\*)([^*]+)(\*\*)$/g,t),bf(this.editor,this,/(?:^|\s)(__)([^_]+)(__)$/g,t)}if(t.get("italic")){const t=wf(this.editor,"italic");bf(this.editor,this,/(?:^|\s)(\*)([^*_]+)(\*)$/g,t),bf(this.editor,this,/(?:^|\s)(_)([^_]+)(_)$/g,t)}if(t.get("code")){const t=wf(this.editor,"code");bf(this.editor,this,/(`)([^`]+)(`)$/g,t)}if(t.get("strikethrough")){const t=wf(this.editor,"strikethrough");bf(this.editor,this,/(~~)([^~]+)(~~)$/g,t)}}_addHeadingAutoformats(){const t=this.editor.commands.get("heading");t&&t.modelElements.filter((t=>t.match(/^heading[1-6]$/))).forEach((e=>{const n=e[7],i=new RegExp(`^(#{${n}})\\s$`);ff(this.editor,this,i,(()=>{if(!t.isEnabled||t.value===e)return!1;this.editor.execute("heading",{value:e})}))}))}_addBlockQuoteAutoformats(){this.editor.commands.get("blockQuote")&&ff(this.editor,this,/^>\s$/,"blockQuote")}_addCodeBlockAutoformats(){const t=this.editor,e=t.model.document.selection;t.commands.get("codeBlock")&&ff(t,this,/^```$/,(()=>{if(e.getFirstPosition().parent.is("element","listItem"))return!1;this.editor.execute("codeBlock",{usePreviousLanguageChoice:!0})}))}_addHorizontalLineAutoformats(){this.editor.commands.get("horizontalLine")&&ff(this.editor,this,/^---$/,"horizontalLine")}},Kf,class extends ur{static get requires(){return[tb,nb]}static get pluginName(){return"BlockQuote"}},class extends ur{static get requires(){return[rb,ab]}static get pluginName(){return"Bold"}},class extends ur{static get requires(){return[cb,ub]}static get pluginName(){return"Code"}},class extends ur{static get requires(){return[xb,Tb]}static get pluginName(){return"CodeBlock"}},Zb,Ub,class extends ur{static get requires(){return[Jp,op,ak,lp,Mg,cf]}static get pluginName(){return"Essentials"}},class extends ur{static get requires(){return[_k,hk]}static get pluginName(){return"FindAndReplace"}init(){const t=this.editor.plugins.get("FindAndReplaceUI"),e=this.editor.plugins.get("FindAndReplaceEditing"),n=e.state;t.on("findNext",((t,e)=>{e?(n.searchText=e.searchText,this.editor.execute("find",e.searchText,e)):this.editor.execute("findNext")})),t.on("findPrevious",((t,e)=>{e&&n.searchText!==e.searchText?this.editor.execute("find",e.searchText):this.editor.execute("findPrevious")})),t.on("replace",((t,e)=>{n.searchText!==e.searchText&&this.editor.execute("find",e.searchText);const i=n.highlightedResult;i&&this.editor.execute("replace",e.replaceText,i)})),t.on("replaceAll",((t,e)=>{n.searchText!==e.searchText&&this.editor.execute("find",e.searchText),this.editor.execute("replaceAll",e.replaceText,n.results)})),t.on("searchReseted",(()=>{n.clear(this.editor.model),e.stop()}))}},class extends ur{static get requires(){return[Rk,Vk]}static get pluginName(){return"FontBackgroundColor"}},class extends ur{static get requires(){return[jk,Hk]}static get pluginName(){return"FontColor"}},class extends ur{static get requires(){return[$k,Kk]}static get pluginName(){return"FontFamily"}},class extends ur{static get requires(){return[tw,nw]}static get pluginName(){return"FontSize"}normalizeSizeOptions(t){return Zk(t)}},class extends ur{static get pluginName(){return"GeneralHtmlSupport"}static get requires(){return[Zb,iw,ow,rw,aw,lw,cw,dw,hw,uw,gw]}init(){const t=this.editor,e=t.plugins.get(Zb);e.loadAllowedConfig(t.config.get("htmlSupport.allow")||[]),e.loadDisallowedConfig(t.config.get("htmlSupport.disallow")||[])}getGhsAttributeNameForElement(t){const e=this.editor.plugins.get("DataSchema"),n=Array.from(e.getDefinitionsForView(t,!1)),i=n.find((t=>t.isInline&&!n[0].isObject));return i?i.model:"htmlAttributes"}addModelHtmlClass(t,e,n){const i=this.editor.model,o=this.getGhsAttributeNameForElement(t);i.change((t=>{for(const r of pw(i,n,o))Nb(t,r,o,"classes",(t=>{for(const n of Bi(e))t.add(n)}))}))}removeModelHtmlClass(t,e,n){const i=this.editor.model,o=this.getGhsAttributeNameForElement(t);i.change((t=>{for(const r of pw(i,n,o))Nb(t,r,o,"classes",(t=>{for(const n of Bi(e))t.delete(n)}))}))}setModelHtmlAttributes(t,e,n){const i=this.editor.model,o=this.getGhsAttributeNameForElement(t);i.change((t=>{for(const r of pw(i,n,o))Nb(t,r,o,"attributes",(t=>{for(const[n,i]of Object.entries(e))t.set(n,i)}))}))}removeModelHtmlAttributes(t,e,n){const i=this.editor.model,o=this.getGhsAttributeNameForElement(t);i.change((t=>{for(const r of pw(i,n,o))Nb(t,r,o,"attributes",(t=>{for(const n of Bi(e))t.delete(n)}))}))}setModelHtmlStyles(t,e,n){const i=this.editor.model,o=this.getGhsAttributeNameForElement(t);i.change((t=>{for(const r of pw(i,n,o))Nb(t,r,o,"styles",(t=>{for(const[n,i]of Object.entries(e))t.set(n,i)}))}))}removeModelHtmlStyles(t,e,n){const i=this.editor.model,o=this.getGhsAttributeNameForElement(t);i.change((t=>{for(const r of pw(i,n,o))Nb(t,r,o,"styles",(t=>{for(const n of Bi(e))t.delete(n)}))}))}},class extends ur{static get requires(){return[vw,xw]}static get pluginName(){return"Heading"}},class extends ur{static get requires(){return[Dw,Tw]}static get pluginName(){return"Highlight"}},class extends ur{static get requires(){return[Nw,zw,Lp]}static get pluginName(){return"HorizontalLine"}},class extends ur{static get pluginName(){return"HtmlComment"}init(){const t=this.editor;t.data.processor.skipComments=!1,t.model.schema.addAttributeCheck(((t,e)=>{if(t.endsWith("$root")&&e.startsWith("$comment"))return!0})),t.conversion.for("upcast").elementToMarker({view:"$comment",model:(t,{writer:e})=>{const n=this.editor.model.document.getRoot(),i=t.getCustomProperty("$rawContent"),o=`$comment:${f()}`;return e.setAttribute(o,i,n),o}}),t.conversion.for("dataDowncast").markerToElement({model:"$comment",view:(t,{writer:e})=>{const n=this.editor.model.document.getRoot(),i=t.markerName,o=n.getAttribute(i),r=e.createUIElement("$comment");return e.setCustomProperty("$rawContent",o,r),r}}),t.model.document.registerPostFixer((e=>{const n=t.model.document.getRoot(),i=t.model.document.differ.getChangedMarkers().filter((t=>t.name.startsWith("$comment"))),o=i.filter((t=>{const e=t.data.newRange;return e&&"$graveyard"===e.root.rootName}));if(0===o.length)return!1;for(const t of o)e.removeMarker(t.name),e.removeAttribute(t.name,n);return!0})),t.data.on("set",(()=>{for(const e of t.model.markers.getMarkersGroup("$comment"))this.removeHtmlComment(e.name)}),{priority:"high"}),t.model.on("deleteContent",((e,[n])=>{for(const e of n.getRanges()){const n=t.model.schema.getLimitElement(e),i=t.model.createPositionAt(n,0),o=t.model.createPositionAt(n,"end");let r;r=i.isTouching(e.start)&&o.isTouching(e.end)?this.getHtmlCommentsInRange(t.model.createRange(i,o)):this.getHtmlCommentsInRange(e,{skipBoundaries:!0});for(const t of r)this.removeHtmlComment(t)}}),{priority:"high"})}createHtmlComment(t,e){const n=f(),i=this.editor.model,o=i.document.getRoot(),r=`$comment:${n}`;return i.change((n=>{const i=n.createRange(t);return n.addMarker(r,{usingOperation:!0,affectsData:!0,range:i}),n.setAttribute(r,e,o),r}))}removeHtmlComment(t){const e=this.editor,n=e.model.document.getRoot(),i=e.model.markers.get(t);return!!i&&(e.model.change((e=>{e.removeMarker(i),e.removeAttribute(t,n)})),!0)}getHtmlCommentData(t){const e=this.editor,n=e.model.markers.get(t),i=e.model.document.getRoot();return n?{content:i.getAttribute(t),position:n.getStart()}:null}getHtmlCommentsInRange(t,{skipBoundaries:e=!1}={}){const n=!e;return Array.from(this.editor.model.markers.getMarkersGroup("$comment")).filter((e=>function(t,e){const i=t.getRange().start;return(i.isAfter(e.start)||n&&i.isEqual(e.start))&&(i.isBefore(e.end)||n&&i.isEqual(e.end))}(e,t))).map((t=>t.name))}},class extends ur{static get requires(){return[Ow,Fw,Lp]}static get pluginName(){return"HtmlEmbed"}},class extends ur{static get requires(){return[iA,rA]}static get pluginName(){return"Image"}},class extends ur{static get requires(){return[lA,cA]}static get pluginName(){return"ImageCaption"}},class extends ur{static get pluginName(){return"ImageInsert"}static get requires(){return[NA,FA,VA]}},class extends ur{static get requires(){return[HA,KA,GA]}static get pluginName(){return"ImageResize"}},class extends ur{static get requires(){return[dC,uC]}static get pluginName(){return"ImageStyle"}},class extends ur{static get requires(){return[Rp,mf]}static get pluginName(){return"ImageToolbar"}afterInit(){const t=this.editor,e=t.t,n=t.plugins.get(Rp),i=t.plugins.get("ImageUtils");var o;n.register("image",{ariaLabel:e("Image toolbar"),items:(o=t.config.get("image.toolbar")||[],o.map((t=>R(t)?t.name:t))),getRelatedElement:t=>i.getClosestSelectedImageWidget(t)})}},NA,class extends ur{static get pluginName(){return"Indent"}static get requires(){return[fC,wC]}},class extends ur{constructor(t){super(t),t.config.define("indentBlock",{offset:40,unit:"px"})}static get pluginName(){return"IndentBlock"}init(){const t=this.editor,e=t.config.get("indentBlock");e.classes&&e.classes.length?(this._setupConversionUsingClasses(e.classes),t.commands.add("indentBlock",new AC(t,new _C({direction:"forward",classes:e.classes}))),t.commands.add("outdentBlock",new AC(t,new _C({direction:"backward",classes:e.classes})))):(t.data.addStyleProcessorRules(Yh),this._setupConversionUsingOffset(),t.commands.add("indentBlock",new AC(t,new CC({direction:"forward",offset:e.offset,unit:e.unit}))),t.commands.add("outdentBlock",new AC(t,new CC({direction:"backward",offset:e.offset,unit:e.unit}))))}afterInit(){const t=this.editor,e=t.model.schema,n=t.commands.get("indent"),i=t.commands.get("outdent"),o=t.config.get("heading.options");(o&&o.map((t=>t.model))||vC).forEach((t=>{e.isRegistered(t)&&e.extend(t,{allowAttributes:"blockIndent"})})),e.setAttributeProperties("blockIndent",{isFormatting:!0}),n.registerChildCommand(t.commands.get("indentBlock")),i.registerChildCommand(t.commands.get("outdentBlock"))}_setupConversionUsingOffset(){const t=this.editor.conversion,e="rtl"===this.editor.locale.contentLanguageDirection?"margin-right":"margin-left";t.for("upcast").attributeToAttribute({view:{styles:{[e]:/[\s\S]+/}},model:{key:"blockIndent",value:t=>t.getStyle(e)}}),t.for("downcast").attributeToAttribute({model:"blockIndent",view:t=>({key:"style",value:{[e]:t}})})}_setupConversionUsingClasses(t){const e={model:{key:"blockIndent",values:[]},view:{}};for(const n of t)e.model.values.push(n),e.view[n]={key:"class",value:[n]};this.editor.conversion.attributeToAttribute(e)}},class extends ur{static get requires(){return[xC,DC]}static get pluginName(){return"Italic"}},class extends ur{static get requires(){return[PC,qC,Kf]}static get pluginName(){return"Link"}},class extends ur{static get requires(){return[KC,QC]}static get pluginName(){return"LinkImage"}},class extends ur{static get requires(){return[B_,L_]}static get pluginName(){return"List"}},class extends ur{static get requires(){return[F_,Q_]}static get pluginName(){return"ListProperties"}},class extends ur{static get requires(){return[lv,mv,dv,Lp]}static get pluginName(){return"MediaEmbed"}},class extends ur{static get requires(){return[Rp]}static get pluginName(){return"MediaEmbedToolbar"}afterInit(){const t=this.editor,e=t.t;t.plugins.get(Rp).register("mediaEmbed",{ariaLabel:e("Media toolbar"),items:t.config.get("mediaEmbed.toolbar")||[],getRelatedElement:tv})}},class extends ur{static get requires(){return[bv,kv,Lp]}static get pluginName(){return"PageBreak"}},ww,class extends ur{static get pluginName(){return"PasteFromOffice"}static get requires(){return[bg]}init(){const t=this.editor,e=t.plugins.get("ClipboardPipeline"),n=t.editing.view.document,i=[];i.push(new xv(n)),i.push(new Tv(n)),i.push(new Bv(n)),e.on("inputTransformation",((e,o)=>{if(o._isTransformedWithPasteFromOffice)return;if(t.model.document.selection.getFirstPosition().parent.is("element","codeBlock"))return;const r=o.dataTransfer.getData("text/html"),s=i.find((t=>t.isActive(r)));s&&(o._parsedData=function(t,e){const n=new DOMParser,i=function(t){return Mv(Mv(t)).replace(/([^\S\r\n]*?)[\r\n]+([^\S\r\n]*<\/span>)/g,"$1$2").replace(/<\/span>/g,"").replace(/ <\//g," ").replace(/ <\/o:p>/g," ").replace(/( |\u00A0)<\/o:p>/g,"").replace(/>([^\S\r\n]*[\r\n]\s*)<")}(function(t){const e="",n=t.indexOf(e);if(n<0)return t;const i=t.indexOf("