diff --git a/main.js b/main.js
index df86bdf2f..697946388 100644
--- a/main.js
+++ b/main.js
@@ -1 +1 @@
-(self.webpackChunkmifosx_web_app=self.webpackChunkmifosx_web_app||[]).push([["main"],{96170:(rt,it,b)=>{rt=b.nmd(rt),function(d){const p=d.en=d.en||{};p.dictionary=Object.assign(p.dictionary||{},{"%0 of %1":"%0 of %1",Accept:"Accept","Align cell text to the bottom":"Align cell text to the bottom","Align cell text to the center":"Align cell text to the center","Align cell text to the left":"Align cell text to the left","Align cell text to the middle":"Align cell text to the middle","Align cell text to the right":"Align cell text to the right","Align cell text to the top":"Align cell text to the top","Align table to the left":"Align table to the left","Align table to the right":"Align table to the right",Alignment:"Alignment",Aquamarine:"Aquamarine",Background:"Background",Black:"Black","Block quote":"Block quote",Blue:"Blue",Bold:"Bold",Border:"Border","Break text":"Break text","Bulleted List":"Bulleted List","Bulleted list styles toolbar":"Bulleted list styles toolbar",Cancel:"Cancel","Cannot access default workspace.":"Cannot access default workspace.","Cannot determine a category for the uploaded file.":"Cannot determine a category for the uploaded file.","Cannot upload file:":"Cannot upload file:","Caption for image: %0":"Caption for image: %0","Caption for the image":"Caption for the image","Cell properties":"Cell properties","Center table":"Center table","Centered image":"Centered image","Change image text alternative":"Change image text alternative","Choose heading":"Choose heading",Circle:"Circle",Clear:"Clear","Click to edit block":"Click to edit block",Code:"Code",Color:"Color","Color picker":"Color picker",Column:"Column","Could not insert image at the current position.":"Could not insert image at the current position.","Could not obtain resized image URL.":"Could not obtain resized image URL.",Dashed:"Dashed",Decimal:"Decimal","Decimal with leading zero":"Decimal with leading zero","Decrease indent":"Decrease indent","Delete column":"Delete column","Delete row":"Delete row","Dim grey":"Dim grey",Dimensions:"Dimensions",Disc:"Disc",Dotted:"Dotted",Double:"Double",Downloadable:"Downloadable","Drag to move":"Drag to move","Dropdown toolbar":"Dropdown toolbar","Edit block":"Edit block","Edit link":"Edit link","Editor block content toolbar":"Editor block content toolbar","Editor contextual toolbar":"Editor contextual toolbar","Editor editing area: %0":"Editor editing area: %0","Editor toolbar":"Editor toolbar","Enter image caption":"Enter image caption","Enter table caption":"Enter table caption","Full size image":"Full size image",Green:"Green",Grey:"Grey",Groove:"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:"Height",HEX:"HEX","Horizontal text alignment toolbar":"Horizontal text alignment toolbar","Image resize list":"Image resize list","Image toolbar":"Image toolbar","image widget":"image widget","In line":"In line","Increase indent":"Increase indent",Insert:"Insert","Insert column left":"Insert column left","Insert column right":"Insert column right","Insert image":"Insert image","Insert image or file":"Insert image or file","Insert image via URL":"Insert image via URL","Insert media":"Insert media","Insert paragraph after block":"Insert paragraph after block","Insert paragraph before block":"Insert paragraph before block","Insert row above":"Insert row above","Insert row below":"Insert row below","Insert table":"Insert table","Inserting image failed":"Inserting image failed",Inset:"Inset",Italic:"Italic","Justify cell text":"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 image","Link URL":"Link URL","List properties":"List properties","Lower-latin":"Lower-latin","Lower\u2013roman":"Lower\u2013roman","Media toolbar":"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","No results found":"No results found","No searchable items":"No searchable items",None:"None","Numbered List":"Numbered List","Numbered list styles toolbar":"Numbered list styles toolbar","Open file manager":"Open file manager","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":"Open media in new tab",Orange:"Orange",Original:"Original",Outset:"Outset",Padding:"Padding",Paragraph:"Paragraph","Paste the media URL in the input.":"Paste the media URL in the input.","Press Enter to type after or press Shift + Enter to type before the widget":"Press Enter to type after or press Shift + Enter to type before the widget",Previous:"Previous",Purple:"Purple",Red:"Red",Redo:"Redo","Remove color":"Remove color","Resize image":"Resize image","Resize image to %0":"Resize image to %0","Resize image to the original size":"Resize image to the original size","Restore default":"Restore default","Reversed order":"Reversed order","Rich Text Editor":"Rich Text Editor",Ridge:"Ridge","Right aligned image":"Right aligned image",Row:"Row",Save:"Save","Select all":"Select all","Select column":"Select column","Select row":"Select row","Selecting resized image failed":"Selecting resized image failed","Show more items":"Show more items","Side image":"Side image",Solid:"Solid","Split cell horizontally":"Split cell horizontally","Split cell vertically":"Split cell vertically",Square:"Square","Start at":"Start at","Start index must be greater than 0.":"Start index must be greater than 0.",Strikethrough:"Strikethrough",Style:"Style",Subscript:"Subscript",Superscript:"Superscript","Table alignment toolbar":"Table alignment toolbar","Table cell text alignment":"Table cell text alignment","Table properties":"Table properties","Table toolbar":"Table toolbar","Text alternative":"Text alternative",'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".':'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".':'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.","Tip: Paste the URL into the content to embed faster.":"Tip: Paste the URL into the content to embed faster.","To-do List":"To-do List","Toggle caption off":"Toggle caption off","Toggle caption on":"Toggle caption on","Toggle the circle list style":"Toggle the circle list style","Toggle the decimal list style":"Toggle the decimal list style","Toggle the decimal with leading zero list style":"Toggle the decimal with leading zero list style","Toggle the disc list style":"Toggle the disc list style","Toggle the lower\u2013latin list style":"Toggle the lower\u2013latin list style","Toggle the lower\u2013roman list style":"Toggle the lower\u2013roman list style","Toggle the square list style":"Toggle the square list style","Toggle the upper\u2013latin list style":"Toggle the upper\u2013latin list style","Toggle the upper\u2013roman list style":"Toggle the upper\u2013roman list style",Turquoise:"Turquoise","Type or paste your content here.":"Type or paste your content here.","Type your title":"Type your title",Underline:"Underline",Undo:"Undo",Unlink:"Unlink",Update:"Update","Update image URL":"Update image URL","Upload failed":"Upload failed","Upload in progress":"Upload in progress","Upper-latin":"Upper-latin","Upper-roman":"Upper-roman","Vertical text alignment toolbar":"Vertical text alignment toolbar",White:"White","Widget toolbar":"Widget toolbar",Width:"Width","Wrap text":"Wrap text",Yellow:"Yellow"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),self,rt.exports=(()=>(()=>{var d={4959:(t,A,x)=>{const w=x(1103),k={};for(const P of Object.keys(w))k[w[P]]=P;const D={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=D;for(const P of Object.keys(D)){if(!("channels"in D[P]))throw new Error("missing channels property: "+P);if(!("labels"in D[P]))throw new Error("missing channel labels property: "+P);if(D[P].labels.length!==D[P].channels)throw new Error("channel and label counts mismatch: "+P);const{channels:I,labels:z}=D[P];delete D[P].channels,delete D[P].labels,Object.defineProperty(D[P],"channels",{value:I}),Object.defineProperty(D[P],"labels",{value:z})}D.rgb.hsl=function(P){const I=P[0]/255,z=P[1]/255,G=P[2]/255,W=Math.min(I,z,G),ot=Math.max(I,z,G),ct=ot-W;let gt,Pt;ot===W?gt=0:I===ot?gt=(z-G)/ct:z===ot?gt=2+(G-I)/ct:G===ot&&(gt=4+(I-z)/ct),gt=Math.min(60*gt,360),gt<0&&(gt+=360);const St=(W+ot)/2;return Pt=ot===W?0:St<=.5?ct/(ot+W):ct/(2-ot-W),[gt,100*Pt,100*St]},D.rgb.hsv=function(P){let I,z,G,W,ot;const ct=P[0]/255,gt=P[1]/255,Pt=P[2]/255,St=Math.max(ct,gt,Pt),Ht=St-Math.min(ct,gt,Pt),Jt=function(at){return(St-at)/6/Ht+.5};return 0===Ht?(W=0,ot=0):(ot=Ht/St,I=Jt(ct),z=Jt(gt),G=Jt(Pt),ct===St?W=G-z:gt===St?W=.3333333333333333+I-G:Pt===St&&(W=.6666666666666666+z-I),W<0?W+=1:W>1&&(W-=1)),[360*W,100*ot,100*St]},D.rgb.hwb=function(P){const I=P[0],z=P[1];let G=P[2];const W=D.rgb.hsl(P)[0],ot=1/255*Math.min(I,Math.min(z,G));return G=1-.00392156862745098*Math.max(I,Math.max(z,G)),[W,100*ot,100*G]},D.rgb.cmyk=function(P){const I=P[0]/255,z=P[1]/255,G=P[2]/255,W=Math.min(1-I,1-z,1-G);return[100*((1-I-W)/(1-W)||0),100*((1-z-W)/(1-W)||0),100*((1-G-W)/(1-W)||0),100*W]},D.rgb.keyword=function(P){const I=k[P];if(I)return I;let z,G=1/0;for(const ct of Object.keys(w)){const Pt=((W=P)[0]-(ot=w[ct])[0])**2+(W[1]-ot[1])**2+(W[2]-ot[2])**2;Pt.04045?((I+.055)/1.055)**2.4:I/12.92,z=z>.04045?((z+.055)/1.055)**2.4:z/12.92,G=G>.04045?((G+.055)/1.055)**2.4:G/12.92,[100*(.4124*I+.3576*z+.1805*G),100*(.2126*I+.7152*z+.0722*G),100*(.0193*I+.1192*z+.9505*G)]},D.rgb.lab=function(P){const I=D.rgb.xyz(P);let z=I[0],G=I[1],W=I[2];return z/=95.047,G/=100,W/=108.883,z=z>.008856?z**.3333333333333333:7.787*z+.13793103448275862,G=G>.008856?G**.3333333333333333:7.787*G+.13793103448275862,W=W>.008856?W**.3333333333333333:7.787*W+.13793103448275862,[116*G-16,500*(z-G),200*(G-W)]},D.hsl.rgb=function(P){const I=P[0]/360,z=P[1]/100,G=P[2]/100;let W,ot,ct;if(0===z)return ct=255*G,[ct,ct,ct];W=G<.5?G*(1+z):G+z-G*z;const gt=2*G-W,Pt=[0,0,0];for(let St=0;St<3;St++)ot=I+.3333333333333333*-(St-1),ot<0&&ot++,ot>1&&ot--,ct=6*ot<1?gt+6*(W-gt)*ot:2*ot<1?W:3*ot<2?gt+(W-gt)*(.6666666666666666-ot)*6:gt,Pt[St]=255*ct;return Pt},D.hsl.hsv=function(P){const I=P[0];let z=P[1]/100,G=P[2]/100,W=z;const ot=Math.max(G,.01);return G*=2,z*=G<=1?G:2-G,W*=ot<=1?ot:2-ot,[I,100*(0===G?2*W/(ot+W):2*z/(G+z)),(G+z)/2*100]},D.hsv.rgb=function(P){const I=P[0]/60,z=P[1]/100;let G=P[2]/100;const W=Math.floor(I)%6,ot=I-Math.floor(I),ct=255*G*(1-z),gt=255*G*(1-z*ot),Pt=255*G*(1-z*(1-ot));switch(G*=255,W){case 0:return[G,Pt,ct];case 1:return[gt,G,ct];case 2:return[ct,G,Pt];case 3:return[ct,gt,G];case 4:return[Pt,ct,G];case 5:return[G,ct,gt]}},D.hsv.hsl=function(P){const I=P[0],z=P[1]/100,G=P[2]/100,W=Math.max(G,.01);let ot,ct;ct=(2-z)*G;const gt=(2-z)*W;return ot=z*W,ot/=gt<=1?gt:2-gt,ot=ot||0,ct/=2,[I,100*ot,100*ct]},D.hwb.rgb=function(P){const I=P[0]/360;let z=P[1]/100,G=P[2]/100;const W=z+G;let ot;W>1&&(z/=W,G/=W);const ct=Math.floor(6*I),gt=1-G;ot=6*I-ct,0!=(1&ct)&&(ot=1-ot);const Pt=z+ot*(gt-z);let St,Ht,Jt;switch(ct){default:case 6:case 0:St=gt,Ht=Pt,Jt=z;break;case 1:St=Pt,Ht=gt,Jt=z;break;case 2:St=z,Ht=gt,Jt=Pt;break;case 3:St=z,Ht=Pt,Jt=gt;break;case 4:St=Pt,Ht=z,Jt=gt;break;case 5:St=gt,Ht=z,Jt=Pt}return[255*St,255*Ht,255*Jt]},D.cmyk.rgb=function(P){const z=P[1]/100,G=P[2]/100,W=P[3]/100;return[255*(1-Math.min(1,P[0]/100*(1-W)+W)),255*(1-Math.min(1,z*(1-W)+W)),255*(1-Math.min(1,G*(1-W)+W))]},D.xyz.rgb=function(P){const I=P[0]/100,z=P[1]/100,G=P[2]/100;let W,ot,ct;return W=3.2406*I+-1.5372*z+-.4986*G,ot=-.9689*I+1.8758*z+.0415*G,ct=.0557*I+-.204*z+1.057*G,W=W>.0031308?1.055*W**.4166666666666667-.055:12.92*W,ot=ot>.0031308?1.055*ot**.4166666666666667-.055:12.92*ot,ct=ct>.0031308?1.055*ct**.4166666666666667-.055:12.92*ct,W=Math.min(Math.max(0,W),1),ot=Math.min(Math.max(0,ot),1),ct=Math.min(Math.max(0,ct),1),[255*W,255*ot,255*ct]},D.xyz.lab=function(P){let I=P[0],z=P[1],G=P[2];return I/=95.047,z/=100,G/=108.883,I=I>.008856?I**.3333333333333333:7.787*I+.13793103448275862,z=z>.008856?z**.3333333333333333:7.787*z+.13793103448275862,G=G>.008856?G**.3333333333333333:7.787*G+.13793103448275862,[116*z-16,500*(I-z),200*(z-G)]},D.lab.xyz=function(P){let I,z,G;z=(P[0]+16)/116,I=P[1]/500+z,G=z-P[2]/200;const W=z**3,ot=I**3,ct=G**3;return z=W>.008856?W:(z-.13793103448275862)/7.787,I=ot>.008856?ot:(I-.13793103448275862)/7.787,G=ct>.008856?ct:(G-.13793103448275862)/7.787,I*=95.047,z*=100,G*=108.883,[I,z,G]},D.lab.lch=function(P){const I=P[0],z=P[1],G=P[2];let W;return W=360*Math.atan2(G,z)/2/Math.PI,W<0&&(W+=360),[I,Math.sqrt(z*z+G*G),W]},D.lch.lab=function(P){const z=P[1],G=P[2]/360*2*Math.PI;return[P[0],z*Math.cos(G),z*Math.sin(G)]},D.rgb.ansi16=function(P,I=null){const[z,G,W]=P;let ot=null===I?D.rgb.hsv(P)[2]:I;if(ot=Math.round(ot/50),0===ot)return 30;let ct=30+(Math.round(W/255)<<2|Math.round(G/255)<<1|Math.round(z/255));return 2===ot&&(ct+=60),ct},D.hsv.ansi16=function(P){return D.rgb.ansi16(D.hsv.rgb(P),P[2])},D.rgb.ansi256=function(P){const I=P[0],z=P[1],G=P[2];return I===z&&z===G?I<8?16:I>248?231:Math.round((I-8)/247*24)+232:16+36*Math.round(I/255*5)+6*Math.round(z/255*5)+Math.round(G/255*5)},D.ansi16.rgb=function(P){let I=P%10;if(0===I||7===I)return P>50&&(I+=3.5),I=I/10.5*255,[I,I,I];const z=.5*(1+~~(P>50));return[(1&I)*z*255,(I>>1&1)*z*255,(I>>2&1)*z*255]},D.ansi256.rgb=function(P){if(P>=232){const z=10*(P-232)+8;return[z,z,z]}let I;return P-=16,[Math.floor(P/36)/5*255,Math.floor((I=P%36)/6)/5*255,I%6/5*255]},D.rgb.hex=function(P){const I=(((255&Math.round(P[0]))<<16)+((255&Math.round(P[1]))<<8)+(255&Math.round(P[2]))).toString(16).toUpperCase();return"000000".substring(I.length)+I},D.hex.rgb=function(P){const I=P.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!I)return[0,0,0];let z=I[0];3===I[0].length&&(z=z.split("").map(W=>W+W).join(""));const G=parseInt(z,16);return[G>>16&255,G>>8&255,255&G]},D.rgb.hcg=function(P){const I=P[0]/255,z=P[1]/255,G=P[2]/255,W=Math.max(Math.max(I,z),G),ot=Math.min(Math.min(I,z),G),ct=W-ot;let gt,Pt;return gt=ct<1?ot/(1-ct):0,Pt=ct<=0?0:W===I?(z-G)/ct%6:W===z?2+(G-I)/ct:4+(I-z)/ct,Pt/=6,Pt%=1,[360*Pt,100*ct,100*gt]},D.hsl.hcg=function(P){const I=P[1]/100,z=P[2]/100,G=z<.5?2*I*z:2*I*(1-z);let W=0;return G<1&&(W=(z-.5*G)/(1-G)),[P[0],100*G,100*W]},D.hsv.hcg=function(P){const z=P[2]/100,G=P[1]/100*z;let W=0;return G<1&&(W=(z-G)/(1-G)),[P[0],100*G,100*W]},D.hcg.rgb=function(P){const z=P[1]/100,G=P[2]/100;if(0===z)return[255*G,255*G,255*G];const W=[0,0,0],ot=P[0]/360%1*6,ct=ot%1,gt=1-ct;let Pt=0;switch(Math.floor(ot)){case 0:W[0]=1,W[1]=ct,W[2]=0;break;case 1:W[0]=gt,W[1]=1,W[2]=0;break;case 2:W[0]=0,W[1]=1,W[2]=ct;break;case 3:W[0]=0,W[1]=gt,W[2]=1;break;case 4:W[0]=ct,W[1]=0,W[2]=1;break;default:W[0]=1,W[1]=0,W[2]=gt}return Pt=(1-z)*G,[255*(z*W[0]+Pt),255*(z*W[1]+Pt),255*(z*W[2]+Pt)]},D.hcg.hsv=function(P){const I=P[1]/100,z=I+P[2]/100*(1-I);let G=0;return z>0&&(G=I/z),[P[0],100*G,100*z]},D.hcg.hsl=function(P){const I=P[1]/100,z=P[2]/100*(1-I)+.5*I;let G=0;return z>0&&z<.5?G=I/(2*z):z>=.5&&z<1&&(G=I/(2*(1-z))),[P[0],100*G,100*z]},D.hcg.hwb=function(P){const I=P[1]/100,z=I+P[2]/100*(1-I);return[P[0],100*(z-I),100*(1-z)]},D.hwb.hcg=function(P){const z=1-P[2]/100,G=z-P[1]/100;let W=0;return G<1&&(W=(z-G)/(1-G)),[P[0],100*G,100*W]},D.apple.rgb=function(P){return[P[0]/65535*255,P[1]/65535*255,P[2]/65535*255]},D.rgb.apple=function(P){return[P[0]/255*65535,P[1]/255*65535,P[2]/255*65535]},D.gray.rgb=function(P){return[P[0]/100*255,P[0]/100*255,P[0]/100*255]},D.gray.hsl=function(P){return[0,0,P[0]]},D.gray.hsv=D.gray.hsl,D.gray.hwb=function(P){return[0,100,P[0]]},D.gray.cmyk=function(P){return[0,0,0,P[0]]},D.gray.lab=function(P){return[P[0],0,0]},D.gray.hex=function(P){const I=255&Math.round(P[0]/100*255),z=((I<<16)+(I<<8)+I).toString(16).toUpperCase();return"000000".substring(z.length)+z},D.rgb.gray=function(P){return[(P[0]+P[1]+P[2])/3/255*100]}},841:(t,A,x)=>{const w=x(4959),k=x(9325),D={};Object.keys(w).forEach(P=>{D[P]={},Object.defineProperty(D[P],"channels",{value:w[P].channels}),Object.defineProperty(D[P],"labels",{value:w[P].labels});const I=k(P);Object.keys(I).forEach(z=>{const G=I[z];D[P][z]=function(W){const ot=function(...ct){const gt=ct[0];if(null==gt)return gt;gt.length>1&&(ct=gt);const Pt=W(ct);if("object"==typeof Pt)for(let St=Pt.length,Ht=0;Ht1&&(ct=gt),W(ct))};return"conversion"in W&&(ot.conversion=W.conversion),ot}(G)})}),t.exports=D},9325:(t,A,x)=>{const w=x(4959);function D(I,z){return function(G){return z(I(G))}}function P(I,z){const G=[z[I].parent,I];let W=w[z[I].parent][I],ot=z[I].parent;for(;z[ot].parent;)G.unshift(z[ot].parent),W=D(w[z[ot].parent][ot],W),ot=z[ot].parent;return W.conversion=G,W}t.exports=function(I){const z=function k(I){const z=function(){const W={},ot=Object.keys(w);for(let ct=ot.length,gt=0;gt{"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]}},8603:(t,A,x)=>{"use strict";x.d(A,{Z:()=>I});var w=x(1799),k=x.n(w),D=x(2609),P=x.n(D)()(k());P.push([t.id,".ck-content code{background-color:hsla(0,0%,78%,.3);border-radius:2px;padding:.15em}.ck.ck-editor__editable .ck-code_selected{background-color:hsla(0,0%,78%,.5)}","",{version:3,sources:["webpack://./../ckeditor5-basic-styles/theme/code.css"],names:[],mappings:"AAKA,iBACC,kCAAuC,CAEvC,iBAAkB,CADlB,aAED,CAEA,0CACC,kCACD",sourcesContent:["/*\n * Copyright (c) 2003-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 I=P},3062:(t,A,x)=>{"use strict";x.d(A,{Z:()=>I});var w=x(1799),k=x.n(w),D=x(2609),P=x.n(D)()(k());P.push([t.id,".ck-content blockquote{border-left:5px solid #ccc;font-style:italic;margin-left:0;margin-right:0;overflow:hidden;padding-left:1.5em;padding-right:1.5em}.ck-content[dir=rtl] blockquote{border-left:0;border-right:5px solid #ccc}","",{version:3,sources:["webpack://./../ckeditor5-block-quote/theme/blockquote.css"],names:[],mappings:"AAKA,uBAWC,0BAAsC,CADtC,iBAAkB,CAFlB,aAAc,CACd,cAAe,CAPf,eAAgB,CAIhB,kBAAmB,CADnB,mBAOD,CAEA,gCACC,aAAc,CACd,2BACD",sourcesContent:['/*\n * Copyright (c) 2003-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 I=P},903:(t,A,x)=>{"use strict";x.d(A,{Z:()=>I});var w=x(1799),k=x.n(w),D=x(2609),P=x.n(D)()(k());P.push([t.id,'.ck.ck-editor__editable .ck.ck-clipboard-drop-target-position{display:inline;pointer-events:none;position:relative}.ck.ck-editor__editable .ck.ck-clipboard-drop-target-position span{position:absolute;width:0}.ck.ck-editor__editable .ck-widget:-webkit-drag>.ck-widget__selection-handle,.ck.ck-editor__editable .ck-widget:-webkit-drag>.ck-widget__type-around{display:none}.ck.ck-clipboard-drop-target-line{pointer-events:none;position:absolute}:root{--ck-clipboard-drop-target-dot-width:12px;--ck-clipboard-drop-target-dot-height:8px;--ck-clipboard-drop-target-color:var(--ck-color-focus-border)}.ck.ck-editor__editable .ck.ck-clipboard-drop-target-position span{background:var(--ck-clipboard-drop-target-color);border:1px solid var(--ck-clipboard-drop-target-color);bottom:calc(var(--ck-clipboard-drop-target-dot-height)*-.5);margin-left:-1px;top:calc(var(--ck-clipboard-drop-target-dot-height)*-.5)}.ck.ck-editor__editable .ck.ck-clipboard-drop-target-position span:after{border-color:var(--ck-clipboard-drop-target-color) transparent transparent transparent;border-style:solid;border-width:calc(var(--ck-clipboard-drop-target-dot-height)) calc(var(--ck-clipboard-drop-target-dot-width)*.5) 0 calc(var(--ck-clipboard-drop-target-dot-width)*.5);content:"";display:block;height:0;left:50%;position:absolute;top:calc(var(--ck-clipboard-drop-target-dot-height)*-.5);transform:translateX(-50%);width:0}.ck.ck-editor__editable .ck-widget.ck-clipboard-drop-target-range{outline:var(--ck-widget-outline-thickness) solid var(--ck-clipboard-drop-target-color)!important}.ck.ck-editor__editable .ck-widget:-webkit-drag{zoom:.6;outline:none!important}.ck.ck-clipboard-drop-target-line{background:var(--ck-clipboard-drop-target-color);border:1px solid var(--ck-clipboard-drop-target-color);height:0;margin-top:-1px}.ck.ck-clipboard-drop-target-line:before{border-style:solid;content:"";height:0;position:absolute;top:calc(var(--ck-clipboard-drop-target-dot-width)*-.5);width:0}[dir=ltr] .ck.ck-clipboard-drop-target-line:before{border-color:transparent transparent transparent var(--ck-clipboard-drop-target-color);border-width:calc(var(--ck-clipboard-drop-target-dot-width)*.5) 0 calc(var(--ck-clipboard-drop-target-dot-width)*.5) var(--ck-clipboard-drop-target-dot-height);left:-1px}[dir=rtl] .ck.ck-clipboard-drop-target-line:before{border-color:transparent var(--ck-clipboard-drop-target-color) transparent transparent;border-width:calc(var(--ck-clipboard-drop-target-dot-width)*.5) var(--ck-clipboard-drop-target-dot-height) calc(var(--ck-clipboard-drop-target-dot-width)*.5) 0;right:-1px}',"",{version:3,sources:["webpack://./../ckeditor5-clipboard/theme/clipboard.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-clipboard/clipboard.css"],names:[],mappings:"AASC,8DACC,cAAe,CAEf,mBAAoB,CADpB,iBAOD,CAJC,mEACC,iBAAkB,CAClB,OACD,CAWA,qJACC,YACD,CAIF,kCAEC,mBAAoB,CADpB,iBAED,CC9BA,MACC,yCAA0C,CAC1C,yCAA0C,CAC1C,6DACD,CAOE,mEAIC,gDAAiD,CADjD,sDAAuD,CAFvD,2DAA8D,CAI9D,gBAAiB,CAHjB,wDAqBD,CAfC,yEAWC,sFAAuF,CAEvF,kBAAmB,CADnB,qKAA0K,CAX1K,UAAW,CAIX,aAAc,CAFd,QAAS,CAIT,QAAS,CADT,iBAAkB,CAElB,wDAA2D,CAE3D,0BAA2B,CAR3B,OAYD,CAOF,kEACC,gGACD,CAKA,gDACC,OAAS,CACT,sBACD,CAGD,kCAGC,gDAAiD,CADjD,sDAAuD,CADvD,QAAS,CAGT,eAwBD,CAtBC,yCAMC,kBAAmB,CALnB,UAAW,CAIX,QAAS,CAHT,iBAAkB,CAClB,uDAA0D,CAC1D,OAiBD,CArBA,mDAYE,sFAAuF,CADvF,+JAAoK,CAFpK,SAYF,CArBA,mDAmBE,sFAAuF,CADvF,+JAAmK,CAFnK,UAKF",sourcesContent:["/*\n * Copyright (c) 2003-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@import \"@ckeditor/ckeditor5-ui/theme/mixins/_dir.css\";\n\n:root {\n\t--ck-clipboard-drop-target-dot-width: 12px;\n\t--ck-clipboard-drop-target-dot-height: 8px;\n\t--ck-clipboard-drop-target-color: var(--ck-color-focus-border);\n}\n\n.ck.ck-editor__editable {\n\t/*\n\t * Vertical drop target (in text).\n\t */\n\t& .ck.ck-clipboard-drop-target-position {\n\t\t& span {\n\t\t\tbottom: calc(-.5 * var(--ck-clipboard-drop-target-dot-height));\n\t\t\ttop: calc(-.5 * var(--ck-clipboard-drop-target-dot-height));\n\t\t\tborder: 1px solid var(--ck-clipboard-drop-target-color);\n\t\t\tbackground: var(--ck-clipboard-drop-target-color);\n\t\t\tmargin-left: -1px;\n\n\t\t\t/* The triangle above the marker */\n\t\t\t&::after {\n\t\t\t\tcontent: '';\n\t\t\t\twidth: 0;\n\t\t\t\theight: 0;\n\n\t\t\t\tdisplay: block;\n\t\t\t\tposition: absolute;\n\t\t\t\tleft: 50%;\n\t\t\t\ttop: calc(-.5 * var(--ck-clipboard-drop-target-dot-height));\n\n\t\t\t\ttransform: translateX(-50%);\n\t\t\t\tborder-color: var(--ck-clipboard-drop-target-color) transparent transparent transparent;\n\t\t\t\tborder-width: calc(var(--ck-clipboard-drop-target-dot-height)) calc(.5 * var(--ck-clipboard-drop-target-dot-width)) 0 calc(.5 * var(--ck-clipboard-drop-target-dot-width));\n\t\t\t\tborder-style: solid;\n\t\t\t}\n\t\t}\n\t}\n\n\t/*\n\t * Styles of the widget that it a drop target.\n\t */\n\t& .ck-widget.ck-clipboard-drop-target-range {\n\t\toutline: var(--ck-widget-outline-thickness) solid var(--ck-clipboard-drop-target-color) !important;\n\t}\n\n\t/*\n\t * Styles of the widget being dragged (its preview).\n\t */\n\t& .ck-widget:-webkit-drag {\n\t\tzoom: 0.6;\n\t\toutline: none !important;\n\t}\n}\n\n.ck.ck-clipboard-drop-target-line {\n\theight: 0;\n\tborder: 1px solid var(--ck-clipboard-drop-target-color);\n\tbackground: var(--ck-clipboard-drop-target-color);\n\tmargin-top: -1px;\n\n\t&::before {\n\t\tcontent: '';\n\t\tposition: absolute;\n\t\ttop: calc(-.5 * var(--ck-clipboard-drop-target-dot-width));\n\t\twidth: 0;\n\t\theight: 0;\n\t\tborder-style: solid;\n\n\t\t@mixin ck-dir ltr {\n\t\t\tleft: -1px;\n\n\t\t\tborder-width: calc(.5 * var(--ck-clipboard-drop-target-dot-width)) 0 calc(.5 * var(--ck-clipboard-drop-target-dot-width)) var(--ck-clipboard-drop-target-dot-height);\n\t\t\tborder-color: transparent transparent transparent var(--ck-clipboard-drop-target-color);\n\t\t}\n\n\t\t@mixin ck-dir rtl {\n\t\t\tright: -1px;\n\n\t\t\tborder-width:calc(.5 * var(--ck-clipboard-drop-target-dot-width)) var(--ck-clipboard-drop-target-dot-height) calc(.5 * var(--ck-clipboard-drop-target-dot-width)) 0;\n\t\t\tborder-color: transparent var(--ck-clipboard-drop-target-color) transparent transparent;\n\t\t}\n\t}\n}\n"],sourceRoot:""}]);const I=P},3143:(t,A,x)=>{"use strict";x.d(A,{Z:()=>I});var w=x(1799),k=x.n(w),D=x(2609),P=x.n(D)()(k());P.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://./../ckeditor5-editor-classic/theme/classiceditor.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-editor-classic/classiceditor.css","webpack://./../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 I=P},4717:(t,A,x)=>{"use strict";x.d(A,{Z:()=>I});var w=x(1799),k=x.n(w),D=x(2609),P=x.n(D)()(k());P.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://./../ckeditor5-engine/theme/placeholder.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-engine/placeholder.css"],names:[],mappings:"AAMA,uCAEC,iBAWD,CATC,qDAIC,8BAA+B,CAF/B,MAAO,CAKP,mBAAoB,CANpB,iBAAkB,CAElB,OAKD,CAKA,wCACC,YACD,CAQD,iCACC,iBACD,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 I=P},9315:(t,A,x)=>{"use strict";x.d(A,{Z:()=>I});var w=x(1799),k=x.n(w),D=x(2609),P=x.n(D)()(k());P.push([t.id,".ck.ck-editor__editable span[data-ck-unsafe-element]{display:none}","",{version:3,sources:["webpack://./../ckeditor5-engine/theme/renderer.css"],names:[],mappings:"AAMA,qDACC,YACD",sourcesContent:["/*\n * Copyright (c) 2003-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 I=P},8733:(t,A,x)=>{"use strict";x.d(A,{Z:()=>I});var w=x(1799),k=x.n(w),D=x(2609),P=x.n(D)()(k());P.push([t.id,".ck.ck-heading_heading1{font-size:20px}.ck.ck-heading_heading2{font-size:17px}.ck.ck-heading_heading3{font-size:14px}.ck[class*=ck-heading_heading]{font-weight:700}.ck.ck-dropdown.ck-heading-dropdown .ck-dropdown__button .ck-button__label{width:8em}.ck.ck-dropdown.ck-heading-dropdown .ck-dropdown__panel .ck-list__item{min-width:18em}","",{version:3,sources:["webpack://./../ckeditor5-heading/theme/heading.css","webpack://./../ckeditor5-theme-lark/theme/ckeditor5-heading/heading.css"],names:[],mappings:"AAKA,wBACC,cACD,CAEA,wBACC,cACD,CAEA,wBACC,cACD,CAEA,+BACC,eACD,CCZC,2EACC,SACD,CAEA,uEACC,cACD",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-heading_heading1 {\n\tfont-size: 20px;\n}\n\n.ck.ck-heading_heading2 {\n\tfont-size: 17px;\n}\n\n.ck.ck-heading_heading3 {\n\tfont-size: 14px;\n}\n\n.ck[class*="ck-heading_heading"] {\n\tfont-weight: bold;\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/* Resize dropdown's button label. */\n.ck.ck-dropdown.ck-heading-dropdown {\n\t& .ck-dropdown__button .ck-button__label {\n\t\twidth: 8em;\n\t}\n\n\t& .ck-dropdown__panel .ck-list__item {\n\t\tmin-width: 18em;\n\t}\n}\n"],sourceRoot:""}]);const I=P},3508:(t,A,x)=>{"use strict";x.d(A,{Z:()=>I});var w=x(1799),k=x.n(w),D=x(2609),P=x.n(D)()(k());P.push([t.id,".ck-content .image{clear:both;display:table;margin:.9em auto;min-width:50px;text-align:center}.ck-content .image img{display:block;height:auto;margin:0 auto;max-width:100%;min-width:100%}.ck-content .image-inline{align-items:flex-start;display:inline-flex;max-width:100%}.ck-content .image-inline picture{display:flex}.ck-content .image-inline img,.ck-content .image-inline picture{flex-grow:1;flex-shrink:1;max-width:100%}.ck.ck-editor__editable .image>figcaption.ck-placeholder:before{overflow:hidden;padding-left:inherit;padding-right:inherit;text-overflow:ellipsis;white-space:nowrap}.ck.ck-editor__editable .image{z-index:1}.ck.ck-editor__editable .image.ck-widget_selected{z-index:2}.ck.ck-editor__editable .image-inline{z-index:1}.ck.ck-editor__editable .image-inline.ck-widget_selected{z-index:2}.ck.ck-editor__editable .image-inline.ck-widget_selected ::selection{display:none}.ck.ck-editor__editable .image-inline img{height:auto}.ck.ck-editor__editable td .image-inline img,.ck.ck-editor__editable th .image-inline img{max-width:none}","",{version:3,sources:["webpack://./../ckeditor5-image/theme/image.css"],names:[],mappings:"AAMC,mBAEC,UAAW,CADX,aAAc,CAOd,gBAAkB,CAGlB,cAAe,CARf,iBA2BD,CAjBC,uBAEC,aAAc,CAad,WAAY,CAVZ,aAAc,CAGd,cAAe,CAGf,cAKD,CAGD,0BAYC,sBAAuB,CANvB,mBAAoB,CAGpB,cAoBD,CAdC,kCACC,YACD,CAGA,gEAGC,WAAY,CACZ,aAAc,CAGd,cACD,CAUD,gEASC,eAAgB,CARhB,oBAAqB,CACrB,qBAAsB,CAQtB,sBAAuB,CAFvB,kBAGD,CAKA,+BACC,SASD,CAHC,kDACC,SACD,CAMD,sCACC,SAkBD,CAZC,yDACC,SAUD,CAHC,qEACC,YACD,CAMF,0CACC,WACD,CAMC,0FACC,cACD",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 {\n\t& .image {\n\t\tdisplay: table;\n\t\tclear: both;\n\t\ttext-align: center;\n\n\t\t/* Make sure there is some space between the content and the image. Center image by default. */\n\t\t/* The first value should be equal to --ck-spacing-large variable if used in the editor context\n\t \tto avoid the content jumping (See https://github.com/ckeditor/ckeditor5/issues/9825). */\n\t\tmargin: 0.9em auto;\n\n\t\t/* Make sure the caption will be displayed properly (See: https://github.com/ckeditor/ckeditor5/issues/1870). */\n\t\tmin-width: 50px;\n\n\t\t& img {\n\t\t\t/* Prevent unnecessary margins caused by line-height (see #44). */\n\t\t\tdisplay: block;\n\n\t\t\t/* Center the image if its width is smaller than the content\'s width. */\n\t\t\tmargin: 0 auto;\n\n\t\t\t/* Make sure the image never exceeds the size of the parent container (ckeditor/ckeditor5-ui#67). */\n\t\t\tmax-width: 100%;\n\n\t\t\t/* Make sure the image is never smaller than the parent container (See: https://github.com/ckeditor/ckeditor5/issues/9300). */\n\t\t\tmin-width: 100%;\n\n\t\t\t/* Keep proportions of the block image if the height is set and the image is wider than the editor width.\n\t\t\tSee https://github.com/ckeditor/ckeditor5/issues/14542. */\n\t\t\theight: auto;\n\t\t}\n\t}\n\n\t& .image-inline {\n\t\t/*\n\t\t * Normally, the .image-inline would have "display: inline-block" and "img { width: 100% }" (to follow the wrapper while resizing).\n\t\t * Unfortunately, together with "srcset", it gets automatically stretched up to the width of the editing root.\n\t\t * This strange behavior does not happen with inline-flex.\n\t\t */\n\t\tdisplay: inline-flex;\n\n\t\t/* While being resized, don\'t allow the image to exceed the width of the editing root. */\n\t\tmax-width: 100%;\n\n\t\t/* This is required by Safari to resize images in a sensible way. Without this, the browser breaks the ratio. */\n\t\talign-items: flex-start;\n\n\t\t/* When the picture is present it must act as a flex container to let the img resize properly */\n\t\t& picture {\n\t\t\tdisplay: flex;\n\t\t}\n\n\t\t/* When the picture is present, it must act like a resizable img. */\n\t\t& picture,\n\t\t& img {\n\t\t\t/* This is necessary for the img to span the entire .image-inline wrapper and to resize properly. */\n\t\t\tflex-grow: 1;\n\t\t\tflex-shrink: 1;\n\n\t\t\t/* Prevents overflowing the editing root boundaries when an inline image is very wide. */\n\t\t\tmax-width: 100%;\n\t\t}\n\t}\n}\n\n.ck.ck-editor__editable {\n\t/*\n\t * Inhertit the content styles padding of the in case the integration overrides `text-align: center`\n\t * of `.image` (e.g. to the left/right). This ensures the placeholder stays at the padding just like the native\n\t * caret does, and not at the edge of .\n\t */\n\t& .image > figcaption.ck-placeholder::before {\n\t\tpadding-left: inherit;\n\t\tpadding-right: inherit;\n\n\t\t/*\n\t\t * Make sure the image caption placeholder doesn\'t overflow the placeholder area.\n\t\t * See https://github.com/ckeditor/ckeditor5/issues/9162.\n\t\t */\n\t\twhite-space: nowrap;\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\t}\n\n\t/*\n\t * See https://github.com/ckeditor/ckeditor5/issues/15115.\n\t */\n\t& .image {\n\t\tz-index: 1;\n\n\t\t/*\n\t\t * Make sure the selected image always stays on top of its siblings.\n\t\t * See https://github.com/ckeditor/ckeditor5/issues/9108.\n\t\t */\n\t\t&.ck-widget_selected {\n\t\t\tz-index: 2;\n\t\t}\n\t}\n\n\t/*\n\t * See https://github.com/ckeditor/ckeditor5/issues/15115.\n\t */\n\t& .image-inline {\n\t\tz-index: 1;\n\n\t\t/*\n\t\t * Make sure the selected inline image always stays on top of its siblings.\n\t\t * See https://github.com/ckeditor/ckeditor5/issues/9108.\n\t\t */\n\t\t&.ck-widget_selected {\n\t\t\tz-index: 2;\n\n\t\t\t/*\n\t\t\t * Make sure the native browser selection style is not displayed.\n\t\t\t * Inline image widgets have their own styles for the selected state and\n\t\t\t * leaving this up to the browser is asking for a visual collision.\n\t\t\t */\n\t\t\t& ::selection {\n\t\t\t\tdisplay: none;\n\t\t\t}\n\t\t}\n\t}\n\n\t/* Keep proportions of the inline image if the height is set and the image is wider than the editor width.\n\tSee https://github.com/ckeditor/ckeditor5/issues/14542. */\n\t& .image-inline img {\n\t\theight: auto;\n\t}\n\n\t/* The inline image nested in the table should have its original size if not resized.\n\tSee https://github.com/ckeditor/ckeditor5/issues/9117. */\n\t& td,\n\t& th {\n\t\t& .image-inline img {\n\t\t\tmax-width: none;\n\t\t}\n\t}\n}\n'],sourceRoot:""}]);const I=P},2640:(t,A,x)=>{"use strict";x.d(A,{Z:()=>I});var w=x(1799),k=x.n(w),D=x(2609),P=x.n(D)()(k());P.push([t.id,":root{--ck-color-image-caption-background:#f7f7f7;--ck-color-image-caption-text:#333;--ck-color-image-caption-highligted-background:#fd0}.ck-content .image>figcaption{background-color:var(--ck-color-image-caption-background);caption-side:bottom;color:var(--ck-color-image-caption-text);display:table-caption;font-size:.75em;outline-offset:-1px;padding:.6em;word-break:break-word}.ck.ck-editor__editable .image>figcaption.image__caption_highlighted{animation:ck-image-caption-highlight .6s ease-out}@keyframes ck-image-caption-highlight{0%{background-color:var(--ck-color-image-caption-highligted-background)}to{background-color:var(--ck-color-image-caption-background)}}","",{version:3,sources:["webpack://./../ckeditor5-image/theme/imagecaption.css"],names:[],mappings:"AAKA,MACC,2CAAoD,CACpD,kCAA8C,CAC9C,mDACD,CAGA,8BAKC,yDAA0D,CAH1D,mBAAoB,CAEpB,wCAAyC,CAHzC,qBAAsB,CAMtB,eAAgB,CAChB,mBAAoB,CAFpB,YAAa,CAHb,qBAMD,CAGA,qEACC,iDACD,CAEA,sCACC,GACC,oEACD,CAEA,GACC,yDACD,CACD",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:root {\n\t--ck-color-image-caption-background: hsl(0, 0%, 97%);\n\t--ck-color-image-caption-text: hsl(0, 0%, 20%);\n\t--ck-color-image-caption-highligted-background: hsl(52deg 100% 50%);\n}\n\n/* Content styles */\n.ck-content .image > figcaption {\n\tdisplay: table-caption;\n\tcaption-side: bottom;\n\tword-break: break-word;\n\tcolor: var(--ck-color-image-caption-text);\n\tbackground-color: var(--ck-color-image-caption-background);\n\tpadding: .6em;\n\tfont-size: .75em;\n\toutline-offset: -1px;\n}\n\n/* Editing styles */\n.ck.ck-editor__editable .image > figcaption.image__caption_highlighted {\n\tanimation: ck-image-caption-highlight .6s ease-out;\n}\n\n@keyframes ck-image-caption-highlight {\n\t0% {\n\t\tbackground-color: var(--ck-color-image-caption-highligted-background);\n\t}\n\n\t100% {\n\t\tbackground-color: var(--ck-color-image-caption-background);\n\t}\n}\n"],sourceRoot:""}]);const I=P},3535:(t,A,x)=>{"use strict";x.d(A,{Z:()=>I});var w=x(1799),k=x.n(w),D=x(2609),P=x.n(D)()(k());P.push([t.id,".ck.ck-image-insert__panel{padding:var(--ck-spacing-large)}.ck.ck-image-insert__ck-finder-button{border:1px solid #ccc;border-radius:var(--ck-border-radius);display:block;margin:var(--ck-spacing-standard) auto;width:100%}.ck.ck-splitbutton>.ck-file-dialog-button.ck-button{border:none;margin:0;padding:0}","",{version:3,sources:["webpack://./../ckeditor5-image/theme/imageinsert.css"],names:[],mappings:"AAKA,2BACC,+BACD,CAEA,sCAIC,qBAAiC,CACjC,qCAAsC,CAJtC,aAAc,CAEd,sCAAuC,CADvC,UAID,CAGA,oDAGC,WAAY,CADZ,QAAS,CADT,SAGD",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-image-insert__panel {\n\tpadding: var(--ck-spacing-large);\n}\n\n.ck.ck-image-insert__ck-finder-button {\n\tdisplay: block;\n\twidth: 100%;\n\tmargin: var(--ck-spacing-standard) auto;\n\tborder: 1px solid hsl(0, 0%, 80%);\n\tborder-radius: var(--ck-border-radius);\n}\n\n/* https://github.com/ckeditor/ckeditor5/issues/7986 */\n.ck.ck-splitbutton > .ck-file-dialog-button.ck-button {\n\tpadding: 0;\n\tmargin: 0;\n\tborder: none;\n}\n"],sourceRoot:""}]);const I=P},1568:(t,A,x)=>{"use strict";x.d(A,{Z:()=>I});var w=x(1799),k=x.n(w),D=x(2609),P=x.n(D)()(k());P.push([t.id,".ck.ck-image-insert-form:focus{outline:none}.ck.ck-form__row{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between}.ck.ck-form__row>:not(.ck-label){flex-grow:1}.ck.ck-form__row.ck-image-insert-form__action-row{margin-top:var(--ck-spacing-standard)}.ck.ck-form__row.ck-image-insert-form__action-row .ck-button-cancel,.ck.ck-form__row.ck-image-insert-form__action-row .ck-button-save{justify-content:center}.ck.ck-form__row.ck-image-insert-form__action-row .ck-button .ck-button__label{color:var(--ck-color-text)}","",{version:3,sources:["webpack://./../ckeditor5-image/theme/imageinsertformrowview.css"],names:[],mappings:"AAMC,+BAEC,YACD,CAGD,iBACC,YAAa,CACb,kBAAmB,CACnB,gBAAiB,CACjB,6BAmBD,CAhBC,iCACC,WACD,CAEA,kDACC,qCAUD,CARC,sIAEC,sBACD,CAEA,+EACC,0BACD",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-image-insert-form {\n\t&:focus {\n\t\t/* See: https://github.com/ckeditor/ckeditor5/issues/4773 */\n\t\toutline: none;\n\t}\n}\n\n.ck.ck-form__row {\n\tdisplay: flex;\n\tflex-direction: row;\n\tflex-wrap: nowrap;\n\tjustify-content: space-between;\n\n\t/* Ignore labels that work as fieldset legends */\n\t& > *:not(.ck-label) {\n\t\tflex-grow: 1;\n\t}\n\n\t&.ck-image-insert-form__action-row {\n\t\tmargin-top: var(--ck-spacing-standard);\n\n\t\t& .ck-button-save,\n\t\t& .ck-button-cancel {\n\t\t\tjustify-content: center;\n\t\t}\n\n\t\t& .ck-button .ck-button__label {\n\t\t\tcolor: var(--ck-color-text);\n\t\t}\n\t}\n}\n"],sourceRoot:""}]);const I=P},6270:(t,A,x)=>{"use strict";x.d(A,{Z:()=>I});var w=x(1799),k=x.n(w),D=x(2609),P=x.n(D)()(k());P.push([t.id,".ck-content img.image_resized{height:auto}.ck-content .image.image_resized{box-sizing:border-box;display:block;max-width:100%}.ck-content .image.image_resized img{width:100%}.ck-content .image.image_resized>figcaption{display:block}.ck.ck-editor__editable td .image-inline.image_resized img,.ck.ck-editor__editable th .image-inline.image_resized img{max-width:100%}[dir=ltr] .ck.ck-button.ck-button_with-text.ck-resize-image-button .ck-button__icon{margin-right:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-button.ck-button_with-text.ck-resize-image-button .ck-button__icon{margin-left:var(--ck-spacing-standard)}.ck.ck-dropdown .ck-button.ck-resize-image-button .ck-button__label{width:4em}","",{version:3,sources:["webpack://./../ckeditor5-image/theme/imageresize.css"],names:[],mappings:"AAMA,8BACC,WACD,CAEA,iCAQC,qBAAsB,CADtB,aAAc,CANd,cAkBD,CATC,qCAEC,UACD,CAEA,4CAEC,aACD,CAQC,sHACC,cACD,CAIF,oFACC,uCACD,CAEA,oFACC,sCACD,CAEA,oEACC,SACD",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/* Preserve aspect ratio of the resized image after introducing image height attribute. */\n.ck-content img.image_resized {\n\theight: auto;\n}\n\n.ck-content .image.image_resized {\n\tmax-width: 100%;\n\t/*\n\tThe `/g,">").replace(/\r?\n\r?\n/g,"
`),dt=j),N=this.editor.data.htmlProcessor.toView(dt)}var j;const K=new ct(this,"inputTransformation");this.fire(K,{content:N,dataTransfer:E,targetRanges:M.targetRanges,method:M.method}),K.stop.called&&C.stop(),u.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(C,M)=>{if(M.content.isEmpty)return;const E=this.editor.data.toModel(M.content,"$clipboardHolder");0!=E.childCount&&(C.stop(),c.change(()=>{this.fire("contentInsertion",{content:E,method:M.method,dataTransfer:M.dataTransfer,targetRanges:M.targetRanges})}))},{priority:"low"}),this.listenTo(this,"contentInsertion",(C,M)=>{M.resultRange=c.insertContent(M.content)},{priority:"low"})}_setupCopyCut(){const r=this.editor,c=r.model.document,u=r.editing.view.document,_=(C,M)=>{const E=M.dataTransfer;M.preventDefault(),this._fireOutputTransformationEvent(E,c.selection,C.name)};this.listenTo(u,"copy",_,{priority:"low"}),this.listenTo(u,"cut",(C,M)=>{r.model.canEditAt(r.model.document.selection)?_(C,M):M.preventDefault()},{priority:"low"}),this.listenTo(this,"outputTransformation",(C,M)=>{const E=r.data.toView(M.content);u.fire("clipboardOutput",{dataTransfer:M.dataTransfer,content:E,method:M.method})},{priority:"low"}),this.listenTo(u,"clipboardOutput",(C,M)=>{M.content.isEmpty||(M.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(M.content)),M.dataTransfer.setData("text/plain",w5(M.content))),"cut"==M.method&&r.model.deleteContent(c.selection)},{priority:"low"})}}class U5{constructor(r,c=20){this._batch=null,this.model=r,this._size=0,this.limit=c,this._isLocked=!1,this._changeCallback=(u,_)=>{_.isLocal&&_.isUndoable&&_!==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(r){this._size+=r,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(r=!1){this.isLocked&&!r||(this._batch=null,this._size=0)}}class F8 extends Ua{constructor(r,c){super(r),this._buffer=new U5(r.model,c),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(r={}){const c=this.editor.model,u=c.document,_=r.text||"",C=_.length;let M=u.selection;if(r.selection?M=r.selection:r.range&&(M=c.createSelection(r.range)),!c.canEditAt(M))return;const E=r.resultRange;c.enqueueChange(this._buffer.batch,N=>{this._buffer.lock(),c.deleteContent(M),_&&c.insertContent(N.createText(_,u.selection.getAttributes()),M),E?N.setSelection(E):M.is("documentSelection")||N.setSelection(M),this._buffer.unlock(),this._buffer.input(C)})}}const Vv=["insertText","insertReplacementText"];class jv extends Qu{constructor(r){super(r),this.focusObserver=r.getObserver(z_),D_isAndroid&&Vv.push("insertCompositionText");const c=r.document;c.on("beforeinput",(u,_)=>{if(!this.isEnabled)return;const{data:C,targetRanges:M,inputType:E,domEvent:N}=_;if(!Vv.includes(E))return;this.focusObserver.flush();const j=new ct(c,"insertText");c.fire(j,new pc(r,N,{text:C,selection:r.createSelection(M)})),j.stop.called&&u.stop()}),c.on("compositionend",(u,{data:_,domEvent:C})=>{this.isEnabled&&!D_isAndroid&&_&&c.fire("insertText",new pc(r,C,{text:_,selection:c.selection}))},{priority:"lowest"})}observe(){}stopObserving(){}}class Jv extends lo{static get pluginName(){return"Input"}init(){const r=this.editor,c=r.model,u=r.editing.view,_=c.document.selection;u.addObserver(jv);const C=new F8(r,r.config.get("typing.undoStep")||20);r.commands.add("insertText",C),r.commands.add("input",C),this.listenTo(u.document,"insertText",(M,E)=>{u.document.isComposing||E.preventDefault();const{text:N,selection:j,resultRange:K}=E,dt=Array.from(j.getRanges()).map(Ue=>r.editing.mapper.toModelRange(Ue));let Dt=N;if(D_isAndroid){const Ue=Array.from(dt[0].getItems()).reduce((qe,pn)=>qe+(pn.is("$textProxy")?pn.data:""),"");Ue&&(Ue.length<=Dt.length?Dt.startsWith(Ue)&&(Dt=Dt.substring(Ue.length),dt[0].start=dt[0].start.getShiftedBy(Ue.length)):Ue.startsWith(Dt)&&(dt[0].start=dt[0].start.getShiftedBy(Dt.length),Dt=""))}const me={text:Dt,selection:c.createSelection(dt)};K&&(me.resultRange=r.editing.mapper.toModelRange(K)),r.execute("insertText",me),u.scrollToTheSelection()}),D_isAndroid?this.listenTo(u.document,"keydown",(M,E)=>{!_.isCollapsed&&229==E.keyCode&&u.document.isComposing&&Z5(c,C)}):this.listenTo(u.document,"compositionstart",()=>{_.isCollapsed||Z5(c,C)})}}function Z5(m,r){if(!r.isEnabled)return;const c=r.buffer;c.lock(),m.enqueueChange(c.batch,()=>{m.deleteContent(m.document.selection)}),c.unlock()}class Gv extends Ua{constructor(r,c){super(r),this.direction=c,this._buffer=new U5(r.model,r.config.get("typing.undoStep")),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}execute(r={}){const c=this.editor.model,u=c.document;c.enqueueChange(this._buffer.batch,_=>{this._buffer.lock();const C=_.createSelection(r.selection||u.selection);if(!c.canEditAt(C))return;const M=r.sequence||1,E=C.isCollapsed;if(C.isCollapsed&&c.modifySelection(C,{direction:this.direction,unit:r.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(M))return void this._replaceEntireContentWithParagraph(_);if(this._shouldReplaceFirstBlockWithParagraph(C,M))return void this.editor.execute("paragraph",{selection:C});if(C.isCollapsed)return;let N=0;C.getFirstRange().getMinimalFlatRanges().forEach(j=>{N+=xt(j.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))}),c.deleteContent(C,{doNotResetEntireContent:E,direction:this.direction}),this._buffer.input(N),_.setSelection(C),this._buffer.unlock()})}_shouldEntireContentBeReplacedWithParagraph(r){if(r>1)return!1;const c=this.editor.model,u=c.document.selection,_=c.schema.getLimitElement(u);if(!u.isCollapsed||!u.containsEntireContent(_)||!c.schema.checkChild(_,"paragraph"))return!1;const C=_.getChild(0);return!C||!C.is("element","paragraph")}_replaceEntireContentWithParagraph(r){const c=this.editor.model,_=c.schema.getLimitElement(c.document.selection),C=r.createElement("paragraph");r.remove(r.createRangeIn(_)),r.insert(C,_),r.setSelection(C,0)}_shouldReplaceFirstBlockWithParagraph(r,c){const u=this.editor.model;if(c>1||"backward"!=this.direction||!r.isCollapsed)return!1;const _=r.getFirstPosition(),C=u.schema.getLimitElement(_),M=C.getChild(0);return _.parent==M&&!!r.containsEntireContent(M)&&!!u.schema.checkChild(C,"paragraph")&&"paragraph"!=M.name}}const p2="selection",Hh="backward",a_="forward",Wv={deleteContent:{unit:p2,direction:Hh},deleteContentBackward:{unit:"codePoint",direction:Hh},deleteWordBackward:{unit:"word",direction:Hh},deleteHardLineBackward:{unit:p2,direction:Hh},deleteSoftLineBackward:{unit:p2,direction:Hh},deleteContentForward:{unit:"character",direction:a_},deleteWordForward:{unit:"word",direction:a_},deleteHardLineForward:{unit:p2,direction:a_},deleteSoftLineForward:{unit:p2,direction:a_}};class $v extends Qu{constructor(r){super(r);const c=r.document;let u=0;c.on("keydown",()=>{u++}),c.on("keyup",()=>{u=0}),c.on("beforeinput",(_,C)=>{if(!this.isEnabled)return;const{targetRanges:M,domEvent:E,inputType:N}=C,j=Wv[N];if(!j)return;const K={direction:j.direction,unit:j.unit,sequence:u};K.unit==p2&&(K.selectionToRemove=r.createSelection(M[0])),"deleteContentBackward"===N&&(D_isAndroid&&(K.sequence=1),function(Dt){if(1!=Dt.length||Dt[0].isCollapsed)return!1;const me=Dt[0].getWalker({direction:"backward",singleCharacters:!0,ignoreElementEnd:!0});let Ue=0;for(const{nextPosition:qe}of me){if(qe.parent.is("$text")){const pn=qe.parent.data,Ln=qe.offset;if(un(pn,Ln)||hd(pn,Ln)||kl(pn,Ln))continue;Ue++}else Ue++;if(Ue>1)return!0}return!1}(M)&&(K.unit=p2,K.selectionToRemove=r.createSelection(M)));const dt=new Cp(c,"delete",M[0]);c.fire(dt,new pc(r,E,K)),dt.stop.called&&_.stop()}),D_isBlink&&function(_){const C=_.view,M=C.document;let E=null,N=!1;function j(dt){return dt==Ka.backspace||dt==Ka.delete}function K(dt){return dt==Ka.backspace?Hh:a_}M.on("keydown",(dt,{keyCode:Dt})=>{E=Dt,N=!1}),M.on("keyup",(dt,{keyCode:Dt,domEvent:me})=>{const Ue=M.selection,qe=_.isEnabled&&Dt==E&&j(Dt)&&!Ue.isCollapsed&&!N;if(E=null,qe){const pn=Ue.getFirstRange(),Ln=new Cp(M,"delete",pn),pi={unit:p2,direction:K(Dt),selectionToRemove:Ue};M.fire(Ln,new pc(C,me,pi))}}),M.on("beforeinput",(dt,{inputType:Dt})=>{const me=Wv[Dt];j(E)&&me&&me.direction==K(E)&&(N=!0)},{priority:"high"}),M.on("beforeinput",(dt,{inputType:Dt,data:me})=>{E==Ka.delete&&"insertText"==Dt&&"\x7f"==me&&dt.stop()},{priority:"high"})}(this)}observe(){}stopObserving(){}}class r_ extends lo{static get pluginName(){return"Delete"}init(){const r=this.editor,c=r.editing.view,u=c.document,_=r.model.document;c.addObserver($v),this._undoOnBackspace=!1;const C=new Gv(r,"forward");r.commands.add("deleteForward",C),r.commands.add("forwardDelete",C),r.commands.add("delete",new Gv(r,"backward")),this.listenTo(u,"delete",(M,E)=>{u.isComposing||E.preventDefault();const{direction:N,sequence:j,selectionToRemove:K,unit:dt}=E,Dt="forward"===N?"deleteForward":"delete",me={sequence:j};if("selection"==dt){const Ue=Array.from(K.getRanges()).map(qe=>r.editing.mapper.toModelRange(qe));me.selection=r.model.createSelection(Ue)}else me.unit=dt;r.execute(Dt,me),c.scrollToTheSelection()},{priority:"low"}),this.editor.plugins.has("UndoEditing")&&(this.listenTo(u,"delete",(M,E)=>{this._undoOnBackspace&&"backward"==E.direction&&1==E.sequence&&"codePoint"==E.unit&&(this._undoOnBackspace=!1,r.execute("undo"),E.preventDefault(),M.stop())},{context:"$capture"}),this.listenTo(_,"change",()=>{this._undoOnBackspace=!1}))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}class Ba extends lo{static get requires(){return[Jv,r_]}static get pluginName(){return"Typing"}}function L4(m,r){let c=m.start;return{text:Array.from(m.getWalker({ignoreElementEnd:!1})).reduce((u,{item:_})=>_.is("$text")||_.is("$textProxy")?u+_.data:(c=r.createPositionAfter(_),""),""),range:r.createRange(c,m.end)}}class Kv extends(Ze()){constructor(r,c){super(),this.model=r,this.testCallback=c,this._hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",()=>{this.isEnabled?this._startListening():(this.stopListening(r.document.selection),this.stopListening(r.document))}),this._startListening()}get hasMatch(){return this._hasMatch}_startListening(){const r=this.model.document;this.listenTo(r.selection,"change:range",(c,{directChange:u})=>{u&&(r.selection.isCollapsed?this._evaluateTextBeforeSelection("selection"):this.hasMatch&&(this.fire("unmatched"),this._hasMatch=!1))}),this.listenTo(r,"change:data",(c,u)=>{!u.isUndo&&u.isLocal&&this._evaluateTextBeforeSelection("data",{batch:u})})}_evaluateTextBeforeSelection(r,c={}){const u=this.model,_=u.document.selection,C=u.createRange(u.createPositionAt(_.focus.parent,0),_.focus),{text:M,range:E}=L4(C,u),N=this.testCallback(M);if(!N&&this.hasMatch&&this.fire("unmatched"),this._hasMatch=!!N,N){const j=Object.assign(c,{text:M,range:E});"object"==typeof N&&Object.assign(j,N),this.fire(`matched:${r}`,j)}}}class M5 extends lo{constructor(r){super(r),this.attributes=new Set,this._overrideUid=null}static get pluginName(){return"TwoStepCaretMovement"}init(){const r=this.editor,_=r.locale,C=r.model.document.selection;this.listenTo(r.editing.view.document,"arrowKey",(M,E)=>{if(!C.isCollapsed||E.shiftKey||E.altKey||E.ctrlKey)return;const N=E.keyCode==Ka.arrowright,j=E.keyCode==Ka.arrowleft;if(!N&&!j)return;const K=_.contentLanguageDirection;let dt=!1;dt="ltr"===K&&N||"rtl"===K&&j?this._handleForwardMovement(E):this._handleBackwardMovement(E),!0===dt&&M.stop()},{context:"$text",priority:"highest"}),this._isNextGravityRestorationSkipped=!1,this.listenTo(C,"change:range",(M,E)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!E.directChange&&V0(C.getFirstPosition(),this.attributes)||this._restoreGravity())})}registerAttribute(r){this.attributes.add(r)}_handleForwardMovement(r){const c=this.attributes,u=this.editor.model.document.selection,_=u.getFirstPosition();return!(this._isGravityOverridden||_.isAtStart&&O4(u,c)||!V0(_,c)||(zh(r),this._overrideGravity(),0))}_handleBackwardMovement(r){const c=this.attributes,u=this.editor.model,_=u.document.selection,C=_.getFirstPosition();return this._isGravityOverridden?(zh(r),this._restoreGravity(),E4(u,c,C),!0):C.isAtStart?!!O4(_,c)&&(zh(r),E4(u,c,C),!0):(E=c,!(!V0(C.getShiftedBy(-1),E)||(C.isAtEnd&&!O4(_,c)&&V0(C,c)?(zh(r),E4(u,c,C),0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),1))));var E}get _isGravityOverridden(){return!!this._overrideUid}_overrideGravity(){this._overrideUid=this.editor.model.change(r=>r.overrideSelectionGravity())}_restoreGravity(){this.editor.model.change(r=>{r.restoreSelectionGravity(this._overrideUid),this._overrideUid=null})}}function O4(m,r){for(const c of r)if(m.hasAttribute(c))return!0;return!1}function E4(m,r,c){const u=c.nodeBefore;m.change(_=>{if(u){const C=[],M=m.schema.isObject(u)&&m.schema.isInline(u);for(const[E,N]of u.getAttributes())!m.schema.checkAttribute("$text",E)||M&&!1===m.schema.getAttributeProperties(E).copyFromObject||C.push([E,N]);_.setSelectionAttribute(C)}else _.removeSelectionAttribute(r)})}function zh(m){m.preventDefault()}function V0(m,r){const{nodeBefore:c,nodeAfter:u}=m;for(const _ of r){const C=c?c.getAttribute(_):void 0;if((u?u.getAttribute(_):void 0)!==C)return!0}return!1}const k5={copyright:{from:"(c)",to:"\xa9"},registeredTrademark:{from:"(r)",to:"\xae"},trademark:{from:"(tm)",to:"\u2122"},oneHalf:{from:/(^|[^/a-z0-9])(1\/2)([^/a-z0-9])$/i,to:[null,"\xbd",null]},oneThird:{from:/(^|[^/a-z0-9])(1\/3)([^/a-z0-9])$/i,to:[null,"\u2153",null]},twoThirds:{from:/(^|[^/a-z0-9])(2\/3)([^/a-z0-9])$/i,to:[null,"\u2154",null]},oneForth:{from:/(^|[^/a-z0-9])(1\/4)([^/a-z0-9])$/i,to:[null,"\xbc",null]},threeQuarters:{from:/(^|[^/a-z0-9])(3\/4)([^/a-z0-9])$/i,to:[null,"\xbe",null]},lessThanOrEqual:{from:"<=",to:"\u2264"},greaterThanOrEqual:{from:">=",to:"\u2265"},notEqual:{from:"!=",to:"\u2260"},arrowLeft:{from:"<-",to:"\u2190"},arrowRight:{from:"->",to:"\u2192"},horizontalEllipsis:{from:"...",to:"\u2026"},enDash:{from:/(^| )(--)( )$/,to:[null,"\u2013",null]},emDash:{from:/(^| )(---)( )$/,to:[null,"\u2014",null]},quotesPrimary:{from:a1('"'),to:[null,"\u201c",null,"\u201d"]},quotesSecondary:{from:a1("'"),to:[null,"\u2018",null,"\u2019"]},quotesPrimaryEnGb:{from:a1("'"),to:[null,"\u2018",null,"\u2019"]},quotesSecondaryEnGb:{from:a1('"'),to:[null,"\u201c",null,"\u201d"]},quotesPrimaryPl:{from:a1('"'),to:[null,"\u201e",null,"\u201d"]},quotesSecondaryPl:{from:a1("'"),to:[null,"\u201a",null,"\u2019"]}},Dd={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},da=["symbols","mathematical","typography","quotes"];function Xv(m){return"string"==typeof m?new RegExp(`(${_5(m)})$`):m}function I4(m){return"string"==typeof m?()=>[m]:m instanceof Array?()=>m:m}function D5(m){return(m.textNode?m.textNode:m.nodeAfter).getAttributes()}function a1(m){return new RegExp(`(^|\\s)(${m})([^${m}]*)(${m})$`)}function gc(m,r,c,u){return u.createRange(tx(m,r,c,!0,u),tx(m,r,c,!1,u))}function tx(m,r,c,u,_){let C=m.textNode||(u?m.nodeBefore:m.nodeAfter),M=null;for(;C&&C.getAttribute(r)==c;)M=C,C=u?C.previousSibling:C.nextSibling;return M?_.createPositionAt(M,u?"before":"after"):m}function*m2(m,r){for(const c of r)c&&m.getAttributeProperties(c[0]).copyOnEnter&&(yield c)}class ex extends Ua{execute(){this.editor.model.change(r=>{this.enterBlock(r),this.fire("afterExecute",{writer:r})})}enterBlock(r){const c=this.editor.model,u=c.document.selection,_=c.schema,C=u.isCollapsed,M=u.getFirstRange(),E=M.start.parent,N=M.end.parent;if(_.isLimit(E)||_.isLimit(N))return C||E!=N||c.deleteContent(u),!1;if(C){const j=m2(r.model.schema,u.getAttributes());return wi(r,M.start),r.setSelectionAttribute(j),!0}{const j=!(M.start.isAtStart&&M.end.isAtEnd),K=E==N;if(c.deleteContent(u,{leaveUnmerged:j}),j){if(K)return wi(r,u.focus),!0;r.setSelection(N,0)}}return!1}}function wi(m,r){m.split(r),m.setSelection(r.parent.nextSibling,0)}const jn={insertParagraph:{isSoft:!1},insertLineBreak:{isSoft:!0}};class H extends Qu{constructor(r){super(r);const c=this.document;let u=!1;c.on("keydown",(_,C)=>{u=C.shiftKey}),c.on("beforeinput",(_,C)=>{if(!this.isEnabled)return;let M=C.inputType;D_isSafari&&u&&"insertParagraph"==M&&(M="insertLineBreak");const E=C.domEvent,N=jn[M];if(!N)return;const j=new Cp(c,"enter",C.targetRanges[0]);c.fire(j,new pc(r,E,{isSoft:N.isSoft})),j.stop.called&&_.stop()})}observe(){}stopObserving(){}}class Tm extends lo{static get pluginName(){return"Enter"}init(){const r=this.editor,c=r.editing.view,u=c.document;c.addObserver(H),r.commands.add("enter",new ex(r)),this.listenTo(u,"enter",(_,C)=>{u.isComposing||C.preventDefault(),C.isSoft||(r.execute("enter"),c.scrollToTheSelection())},{priority:"low"})}}class hu extends Ua{execute(){const r=this.editor.model,c=r.document;r.change(u=>{(function(_,C,M){const E=M.isCollapsed,N=M.getFirstRange(),K=N.end.parent,dt=N.start.parent==K;if(E){const Dt=m2(_.schema,M.getAttributes());Ma(_,C,N.end),C.removeSelectionAttribute(M.getAttributeKeys()),C.setSelectionAttribute(Dt)}else{const Dt=!(N.start.isAtStart&&N.end.isAtEnd);_.deleteContent(M,{leaveUnmerged:Dt}),dt?Ma(_,C,M.focus):Dt&&C.setSelection(K,0)}})(r,u,c.selection),this.fire("afterExecute",{writer:u})})}refresh(){const r=this.editor.model;this.isEnabled=function(u,_){if(_.rangeCount>1)return!1;const C=_.anchor;if(!C||!u.checkChild(C,"softBreak"))return!1;const M=_.getFirstRange(),E=M.start.parent,N=M.end.parent;return!((F4(E,u)||F4(N,u))&&E!==N)}(r.schema,r.document.selection)}}function Ma(m,r,c){const u=r.createElement("softBreak");m.insertContent(u,c),r.setSelection(u,"after")}function F4(m,r){return!m.is("rootElement")&&(r.isLimit(m)||F4(m.parent,r))}class N8 extends lo{static get pluginName(){return"ShiftEnter"}init(){const r=this.editor,u=r.conversion,_=r.editing.view,C=_.document;r.model.schema.register("softBreak",{allowWhere:"$text",isInline:!0}),u.for("upcast").elementToElement({model:"softBreak",view:"br"}),u.for("downcast").elementToElement({model:"softBreak",view:(M,{writer:E})=>E.createEmptyElement("br")}),_.addObserver(H),r.commands.add("shiftEnter",new hu(r)),this.listenTo(C,"enter",(M,E)=>{C.isComposing||E.preventDefault(),E.isSoft&&(r.execute("shiftEnter"),_.scrollToTheSelection())},{priority:"low"})}}class nx extends(Ne()){constructor(){super(...arguments),this._stack=[]}add(r,c){const u=this._stack,_=u[0];this._insertDescriptor(r);const C=u[0];_===C||s_(_,C)||this.fire("change:top",{oldDescriptor:_,newDescriptor:C,writer:c})}remove(r,c){const u=this._stack,_=u[0];this._removeDescriptor(r);const C=u[0];_===C||s_(_,C)||this.fire("change:top",{oldDescriptor:_,newDescriptor:C,writer:c})}_insertDescriptor(r){const c=this._stack,u=c.findIndex(C=>C.id===r.id);if(s_(r,c[u]))return;u>-1&&c.splice(u,1);let _=0;for(;c[_]&&q8(c[_],r);)_++;c.splice(_,0,r)}_removeDescriptor(r){const c=this._stack,u=c.findIndex(_=>_.id===r);u>-1&&c.splice(u,1)}}function s_(m,r){return m&&r&&m.priority==r.priority&&ff(m.classes)==ff(r.classes)}function q8(m,r){return m.priority>r.priority||!(m.priorityff(r.classes)}function ff(m){return Array.isArray(m)?m.sort().join(","):m}const ix="ck-widget_selected";function El(m){return!!m.is("element")&&!!m.getCustomProperty("widget")}function ep(m,r,c={}){if(!m.is("containerElement"))throw new at("widget-to-widget-wrong-element-type",null,{element:m});return r.setAttribute("contenteditable","false",m),r.addClass("ck-widget",m),r.setCustomProperty("widget",!0,m),m.getFillerOffset=H8,r.setCustomProperty("widgetLabel",[],m),c.label&&(_=c.label,m.getCustomProperty("widgetLabel").push(_)),c.hasSelectionHandle&&function(u,_){const C=_.createUIElement("div",{class:"ck ck-widget__selection-handle"},function(M){const E=this.toDomElement(M),N=new zs;return N.set("content",''),N.render(),E.appendChild(N.element),E});_.insert(_.createPositionAt(u,0),C),_.addClass(["ck-widget_with-selection-handle"],u)}(m,r),P5(m,r),m;var _}function R8(m,r,c){if(r.classes&&c.addClass(Ss(r.classes),m),r.attributes)for(const u in r.attributes)c.setAttribute(u,r.attributes[u],m)}function ox(m,r,c){if(r.classes&&c.removeClass(Ss(r.classes),m),r.attributes)for(const u in r.attributes)c.removeAttribute(u,m)}function P5(m,r,c=R8,u=ox){const _=new nx;_.on("change:top",(C,M)=>{M.oldDescriptor&&u(m,M.oldDescriptor,M.writer),M.newDescriptor&&c(m,M.newDescriptor,M.writer)}),r.setCustomProperty("addHighlight",(C,M,E)=>_.add(M,E),m),r.setCustomProperty("removeHighlight",(C,M,E)=>_.remove(M,E),m)}function S5(m,r,c={}){return r.addClass(["ck-editor__editable","ck-editor__nested-editable"],m),r.setAttribute("role","textbox",m),c.label&&r.setAttribute("aria-label",c.label,m),r.setAttribute("contenteditable",m.isReadOnly?"false":"true",m),m.on("change:isReadOnly",(u,_,C)=>{r.setAttribute("contenteditable",C?"false":"true",m)}),m.on("change:isFocused",(u,_,C)=>{C?r.addClass("ck-editor__nested-editable_focused",m):r.removeClass("ck-editor__nested-editable_focused",m)}),P5(m,r),m}function q4(m,r){const c=m.getSelectedElement();if(c){const u=np(m);if(u)return r.createRange(r.createPositionAt(c,u))}return x0(m,r)}function H8(){return null}const c_="widget-type-around";function hf(m,r,c){return!!m&&El(m)&&!c.isInline(r)}function np(m){return m.getAttribute(c_)}var ax=v(4921);Fo()(ax.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});const gf=["before","after"],_2=(new DOMParser).parseFromString('',"image/svg+xml").firstChild,R4="ck-widget__type-around_disabled";class sx extends lo{constructor(){super(...arguments),this._currentFakeCaretModelElement=null}static get pluginName(){return"WidgetTypeAround"}static get requires(){return[Tm,r_]}init(){const r=this.editor,c=r.editing.view;this.on("change:isEnabled",(u,_,C)=>{c.change(M=>{for(const E of c.document.roots)C?M.removeClass(R4,E):M.addClass(R4,E)}),C||r.model.change(M=>{M.removeSelectionAttribute(c_)})}),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(r,c){const u=this.editor,_=u.editing.view,C=u.model.schema.getAttributesWithProperty(r,"copyOnReplace",!0);u.execute("insertParagraph",{position:u.model.createPositionAt(r,c),attributes:C}),_.focus(),_.scrollToTheSelection()}_listenToIfEnabled(r,c,u,_){this.listenTo(r,c,(...C)=>{this.isEnabled&&u(...C)},_)}_insertParagraphAccordingToFakeCaretPosition(){const r=this.editor.model.document.selection,c=np(r);if(!c)return!1;const u=r.getSelectedElement();return this._insertParagraph(u,c),!0}_enableTypeAroundUIInjection(){const r=this.editor,c=r.model.schema,u=r.locale.t,_={before:u("Insert paragraph before block"),after:u("Insert paragraph after block")};r.editing.downcastDispatcher.on("insert",(C,M,E)=>{const N=E.mapper.toViewElement(M.item);N&&hf(N,M.item,c)&&(function(j,K,dt){const Dt=j.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},function(me){const Ue=this.toDomElement(me);return function(qe,pn){for(const Ln of gf){const pi=new Ur({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${Ln}`],title:pn[Ln],"aria-hidden":"true"},children:[qe.ownerDocument.importNode(_2,!0)]});qe.appendChild(pi.render())}}(Ue,K),function(qe){const pn=new Ur({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});qe.appendChild(pn.render())}(Ue),Ue});j.insert(j.createPositionAt(dt,"end"),Dt)}(E.writer,_,N),N.getCustomProperty("widgetLabel").push(()=>this.isEnabled?u("Press Enter to type after or press Shift + Enter to type before the widget"):""))},{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const r=this.editor,c=r.model,u=c.document.selection,_=c.schema;function M(E){return`ck-widget_type-around_show-fake-caret_${E}`}this._listenToIfEnabled(r.editing.view.document,"arrowKey",(E,N)=>{this._handleArrowKeyPress(E,N)},{context:[El,"$text"],priority:"high"}),this._listenToIfEnabled(u,"change:range",(E,N)=>{N.directChange&&r.model.change(j=>{j.removeSelectionAttribute(c_)})}),this._listenToIfEnabled(c.document,"change:data",()=>{const E=u.getSelectedElement();E&&hf(r.editing.mapper.toViewElement(E),E,_)||r.model.change(N=>{N.removeSelectionAttribute(c_)})}),this._listenToIfEnabled(r.editing.downcastDispatcher,"selection",(E,N,j)=>{const K=j.writer;if(this._currentFakeCaretModelElement){const Ue=j.mapper.toViewElement(this._currentFakeCaretModelElement);Ue&&(K.removeClass(gf.map(M),Ue),this._currentFakeCaretModelElement=null)}const dt=N.selection.getSelectedElement();if(!dt)return;const Dt=j.mapper.toViewElement(dt);if(!hf(Dt,dt,_))return;const me=np(N.selection);me&&(K.addClass(M(me),Dt),this._currentFakeCaretModelElement=dt)}),this._listenToIfEnabled(r.ui.focusTracker,"change:isFocused",(E,N,j)=>{j||r.model.change(K=>{K.removeSelectionAttribute(c_)})})}_handleArrowKeyPress(r,c){const u=this.editor,_=u.model,C=_.document.selection,M=_.schema,E=u.editing.view,N=function(dt,Dt){const me=b1(dt,Dt);return"down"===me||"right"===me}(c.keyCode,u.locale.contentLanguageDirection),j=E.document.selection.getSelectedElement();let K;hf(j,u.editing.mapper.toModelElement(j),M)?K=this._handleArrowKeyPressOnSelectedWidget(N):C.isCollapsed?K=this._handleArrowKeyPressWhenSelectionNextToAWidget(N):c.shiftKey||(K=this._handleArrowKeyPressWhenNonCollapsedSelection(N)),K&&(c.preventDefault(),r.stop())}_handleArrowKeyPressOnSelectedWidget(r){const c=this.editor.model,u=np(c.document.selection);return c.change(_=>u?u!==(r?"after":"before")&&(_.removeSelectionAttribute(c_),!0):(_.setSelectionAttribute(c_,r?"after":"before"),!0))}_handleArrowKeyPressWhenSelectionNextToAWidget(r){const c=this.editor,u=c.model,_=u.schema,C=c.plugins.get("Widget"),M=C._getObjectElementNextToSelection(r);return!!hf(c.editing.mapper.toViewElement(M),M,_)&&(u.change(E=>{C._setSelectionOverElement(M),E.setSelectionAttribute(c_,r?"before":"after")}),!0)}_handleArrowKeyPressWhenNonCollapsedSelection(r){const c=this.editor,u=c.model,_=u.schema,C=c.editing.mapper,M=u.document.selection,E=r?M.getLastPosition().nodeBefore:M.getFirstPosition().nodeAfter;return!!hf(C.toViewElement(E),E,_)&&(u.change(N=>{N.setSelection(E,"on"),N.setSelectionAttribute(c_,r?"after":"before")}),!0)}_enableInsertingParagraphsOnButtonClick(){const r=this.editor,c=r.editing.view;this._listenToIfEnabled(c.document,"mousedown",(u,_)=>{const C=_.domTarget.closest(".ck-widget__type-around__button");if(!C)return;const M=C.classList.contains("ck-widget__type-around__button_before")?"before":"after",E=function(j,K){const dt=j.closest(".ck-widget");return K.mapDomToView(dt)}(C,c.domConverter),N=r.editing.mapper.toModelElement(E);this._insertParagraph(N,M),_.preventDefault(),u.stop()})}_enableInsertingParagraphsOnEnterKeypress(){const r=this.editor,c=r.model.document.selection;this._listenToIfEnabled(r.editing.view.document,"enter",(_,C)=>{if("atTarget"!=_.eventPhase)return;const M=c.getSelectedElement(),E=r.editing.mapper.toViewElement(M),N=r.model.schema;let j;this._insertParagraphAccordingToFakeCaretPosition()?j=!0:hf(E,M,N)&&(this._insertParagraph(M,C.isSoft?"before":"after"),j=!0),j&&(C.preventDefault(),_.stop())},{context:El})}_enableInsertingParagraphsOnTypingKeystroke(){const r=this.editor.editing.view.document;this._listenToIfEnabled(r,"insertText",(c,u)=>{this._insertParagraphAccordingToFakeCaretPosition()&&(u.selection=r.selection)},{priority:"high"}),D_isAndroid?this._listenToIfEnabled(r,"keydown",(c,u)=>{229==u.keyCode&&this._insertParagraphAccordingToFakeCaretPosition()}):this._listenToIfEnabled(r,"compositionstart",()=>{this._insertParagraphAccordingToFakeCaretPosition()},{priority:"high"})}_enableDeleteIntegration(){const r=this.editor,u=r.model,_=u.schema;this._listenToIfEnabled(r.editing.view.document,"delete",(C,M)=>{if("atTarget"!=C.eventPhase)return;const E=np(u.document.selection);if(!E)return;const N=M.direction,j=u.document.selection.getSelectedElement(),K="forward"==N;if("before"===E===K)r.execute("delete",{selection:u.createSelection(j,"on")});else{const dt=_.getNearestSelectionRange(u.createPositionAt(j,E),N);if(dt)if(dt.isCollapsed){const Dt=u.createSelection(dt.start);if(u.modifySelection(Dt,{direction:N}),Dt.focus.isEqual(dt.start)){const me=function(Ue,qe){let pn=qe;for(const Ln of qe.getAncestors({parentFirst:!0})){if(Ln.childCount>1||Ue.isLimit(Ln))break;pn=Ln}return pn}(_,dt.start.parent);u.deleteContent(u.createSelection(me,"on"),{doNotAutoparagraph:!0})}else u.change(me=>{me.setSelection(dt),r.execute(K?"deleteForward":"delete")})}else u.change(Dt=>{Dt.setSelection(dt),r.execute(K?"deleteForward":"delete")})}M.preventDefault(),C.stop()},{context:El})}_enableInsertContentIntegration(){const c=this.editor.model,u=c.document.selection;this._listenToIfEnabled(this.editor.model,"insertContent",(_,[C,M])=>{if(M&&!M.is("documentSelection"))return;const E=np(u);return E?(_.stop(),c.change(N=>{const j=u.getSelectedElement(),K=c.createPositionAt(j,E),dt=N.createSelection(K),Dt=c.insertContent(C,dt);return N.setSelection(dt),Dt})):void 0},{priority:"high"})}_enableInsertObjectIntegration(){const c=this.editor.model.document.selection;this._listenToIfEnabled(this.editor.model,"insertObject",(u,_)=>{const[,C,M={}]=_;if(C&&!C.is("documentSelection"))return;const E=np(c);E&&(M.findOptimalPosition=E,_[3]=M)},{priority:"high"})}_enableDeleteContentIntegration(){const c=this.editor.model.document.selection;this._listenToIfEnabled(this.editor.model,"deleteContent",(u,[_])=>{_&&!_.is("documentSelection")||np(c)&&u.stop()},{priority:"high"})}}function lx(m,r,c){const u=m.schema,_=m.createRangeIn(r.root),C="forward"==c?"elementStart":"elementEnd";for(const{previousPosition:M,item:E,type:N}of _.getWalker({startPosition:r,direction:c})){if(u.isLimit(E)&&!u.isInline(E))return M;if(N==C&&u.isBlock(E))return null}return null}function bf(m,r,c){const u="backward"==c?r.end:r.start;if(m.checkChild(u,"$text"))return u;for(const{nextPosition:_}of r.getWalker({direction:c}))if(m.checkChild(_,"$text"))return _;return null}var Bh=v(3488);Fo()(Bh.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});class j0 extends lo{constructor(){super(...arguments),this._previouslySelected=new Set}static get pluginName(){return"Widget"}static get requires(){return[sx,r_]}init(){const r=this.editor,c=r.editing.view,u=c.document;this.editor.editing.downcastDispatcher.on("selection",(_,C,M)=>{const E=M.writer,N=C.selection;if(N.isCollapsed)return;const j=N.getSelectedElement();if(!j)return;const K=r.editing.mapper.toViewElement(j);var dt;El(K)&&M.consumable.consume(N,"selection")&&E.setSelection(E.createRangeOn(K),{fake:!0,label:(dt=K,dt.getCustomProperty("widgetLabel").reduce((Dt,me)=>"function"==typeof me?Dt?Dt+". "+me():me():Dt?Dt+". "+me:me,""))})}),this.editor.editing.downcastDispatcher.on("selection",(_,C,M)=>{this._clearPreviouslySelectedWidgets(M.writer);const E=M.writer,N=E.document.selection;let j=null;for(const K of N.getRanges())for(const dt of K){const Dt=dt.item;El(Dt)&&!z8(Dt,j)&&(E.addClass(ix,Dt),this._previouslySelected.add(Dt),j=Dt)}},{priority:"low"}),c.addObserver(A0),this.listenTo(u,"mousedown",(..._)=>this._onMousedown(..._)),this.listenTo(u,"arrowKey",(..._)=>{this._handleSelectionChangeOnArrowKeyPress(..._)},{context:[El,"$text"]}),this.listenTo(u,"arrowKey",(..._)=>{this._preventDefaultOnArrowKeyPress(..._)},{context:"$root"}),this.listenTo(u,"arrowKey",function cx(m){const r=m.model;return(c,u)=>{const C=u.keyCode==Ka.arrowdown,M=u.shiftKey,E=r.document.selection;if(u.keyCode!=Ka.arrowup&&!C)return;const N=C;if(M&&!(K=E).isCollapsed&&K.isBackward==N)return;var K;const j=function(K,dt,Dt){const me=K.model;if(Dt){const Ue=dt.isCollapsed?dt.focus:dt.getLastPosition(),qe=lx(me,Ue,"forward");if(!qe)return null;const pn=me.createRange(Ue,qe),Ln=bf(me.schema,pn,"backward");return Ln?me.createRange(Ue,Ln):null}{const Ue=dt.isCollapsed?dt.focus:dt.getFirstPosition(),qe=lx(me,Ue,"backward");if(!qe)return null;const pn=me.createRange(qe,Ue),Ln=bf(me.schema,pn,"forward");return Ln?me.createRange(Ln,Ue):null}}(m,E,N);if(j){if(j.isCollapsed&&(E.isCollapsed||M))return;(j.isCollapsed||function(K,dt,Dt){const me=K.model,Ue=K.view.domConverter;if(Dt){const Ri=me.createSelection(dt.start);me.modifySelection(Ri),Ri.focus.isAtEnd||dt.start.isEqual(Ri.focus)||(dt=me.createRange(Ri.focus,dt.end))}const qe=K.mapper.toViewRange(dt),pn=Ue.viewRangeToDom(qe),Ln=de.getDomRangeRects(pn);let pi;for(const Ri of Ln)if(void 0!==pi){if(Math.round(Ri.top)>=pi)return!1;pi=Math.max(pi,Math.round(Ri.bottom))}else pi=Math.round(Ri.bottom);return!0}(m,j,N))&&(r.change(K=>{const dt=N?j.end:j.start;if(M){const Dt=r.createSelection(E.anchor);Dt.setFocus(dt),K.setSelection(Dt)}else K.setSelection(dt)}),c.stop(),u.preventDefault(),u.stopPropagation())}}}(this.editor.editing),{context:"$text"}),this.listenTo(u,"delete",(_,C)=>{this._handleDelete("forward"==C.direction)&&(C.preventDefault(),_.stop())},{context:"$root"})}_onMousedown(r,c){const u=this.editor,_=u.editing.view,C=_.document;let M=c.target;if(function(N){let j=N;for(;j;){if(j.is("editableElement")&&!j.is("rootElement"))return!0;if(El(j))return!1;j=j.parent}return!1}(M)){if((D_isSafari||D_isGecko)&&c.domEvent.detail>=3){const N=u.editing.mapper,j=M.is("attributeElement")?M.findAncestor(dt=>!dt.is("attributeElement")):M,K=N.toModelElement(j);c.preventDefault(),this.editor.model.change(dt=>{dt.setSelection(K,"in")})}return}if(!El(M)&&(M=M.findAncestor(El),!M))return;D_isAndroid&&c.preventDefault(),C.isFocused||_.focus();const E=u.editing.mapper.toModelElement(M);this._setSelectionOverElement(E)}_handleSelectionChangeOnArrowKeyPress(r,c){const u=c.keyCode,_=this.editor.model,C=_.schema,M=_.document.selection,E=M.getSelectedElement(),N=b1(u,this.editor.locale.contentLanguageDirection),j="down"==N||"right"==N,K="up"==N||"down"==N;if(E&&C.isObject(E)){const Dt=j?M.getLastPosition():M.getFirstPosition(),me=C.getNearestSelectionRange(Dt,j?"forward":"backward");return void(me&&(_.change(Ue=>{Ue.setSelection(me)}),c.preventDefault(),r.stop()))}if(!M.isCollapsed&&!c.shiftKey){const Dt=M.getFirstPosition(),me=M.getLastPosition(),Ue=Dt.nodeAfter,qe=me.nodeBefore;return void((Ue&&C.isObject(Ue)||qe&&C.isObject(qe))&&(_.change(pn=>{pn.setSelection(j?me:Dt)}),c.preventDefault(),r.stop()))}if(!M.isCollapsed)return;const dt=this._getObjectElementNextToSelection(j);if(dt&&C.isObject(dt)){if(C.isInline(dt)&&K)return;this._setSelectionOverElement(dt),c.preventDefault(),r.stop()}}_preventDefaultOnArrowKeyPress(r,c){const u=this.editor.model,_=u.schema,C=u.document.selection.getSelectedElement();C&&_.isObject(C)&&(c.preventDefault(),r.stop())}_handleDelete(r){const c=this.editor.model.document.selection;if(!this.editor.model.canEditAt(c)||!c.isCollapsed)return;const u=this._getObjectElementNextToSelection(r);return u?(this.editor.model.change(_=>{let C=c.anchor.parent;for(;C.isEmpty;){const M=C;C=M.parent,_.remove(M)}this._setSelectionOverElement(u)}),!0):void 0}_setSelectionOverElement(r){this.editor.model.change(c=>{c.setSelection(c.createRangeOn(r))})}_getObjectElementNextToSelection(r){const c=this.editor.model,u=c.schema,_=c.document.selection,C=c.createSelection(_);if(c.modifySelection(C,{direction:r?"forward":"backward"}),C.isEqual(_))return null;const M=r?C.focus.nodeBefore:C.focus.nodeAfter;return M&&u.isObject(M)?M:null}_clearPreviouslySelectedWidgets(r){for(const c of this._previouslySelected)r.removeClass(ix,c);this._previouslySelected.clear()}}function z8(m,r){return!!r&&Array.from(m.getAncestors()).includes(r)}class J0 extends lo{constructor(){super(...arguments),this._toolbarDefinitions=new Map}static get requires(){return[q0]}static get pluginName(){return"WidgetToolbarRepository"}init(){const r=this.editor;if(r.plugins.has("BalloonToolbar")){const c=r.plugins.get("BalloonToolbar");this.listenTo(c,"show",u=>{(function(_){const C=_.getSelectedElement();return!(!C||!El(C))})(r.editing.view.document.selection)&&u.stop()},{priority:"high"})}this._balloon=this.editor.plugins.get("ContextualBalloon"),this.on("change:isEnabled",()=>{this._updateToolbarsVisibility()}),this.listenTo(r.ui,"update",()=>{this._updateToolbarsVisibility()}),this.listenTo(r.ui.focusTracker,"change:isFocused",()=>{this._updateToolbarsVisibility()},{priority:"low"})}destroy(){super.destroy();for(const r of this._toolbarDefinitions.values())r.view.destroy()}register(r,{ariaLabel:c,items:u,getRelatedElement:_,balloonClassName:C="ck-toolbar-container"}){if(!u.length)return void Zt("widget-toolbar-no-items",{toolbarId:r});const M=this.editor,E=M.t,N=new w0(M.locale);if(N.ariaLabel=c||E("Widget toolbar"),this._toolbarDefinitions.has(r))throw new at("widget-toolbar-duplicated",this,{toolbarId:r});const j={view:N,getRelatedElement:_,balloonClassName:C,itemsConfig:u,initialized:!1};M.ui.addToolbar(N,{isContextual:!0,beforeFocus:()=>{const K=_(M.editing.view.document.selection);K&&this._showToolbar(j,K)},afterBlur:()=>{this._hideToolbar(j)}}),this._toolbarDefinitions.set(r,j)}_updateToolbarsVisibility(){let r=0,c=null,u=null;for(const _ of this._toolbarDefinitions.values()){const C=_.getRelatedElement(this.editor.editing.view.document.selection);if(this.isEnabled&&C)if(this.editor.ui.focusTracker.isFocused){const M=C.getAncestors().length;M>r&&(r=M,c=C,u=_)}else this._isToolbarVisible(_)&&this._hideToolbar(_);else this._isToolbarInBalloon(_)&&this._hideToolbar(_)}u&&this._showToolbar(u,c)}_hideToolbar(r){this._balloon.remove(r.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(r,c){this._isToolbarVisible(r)?L5(this.editor,c):this._isToolbarInBalloon(r)||(r.initialized||(r.initialized=!0,r.view.fillFromConfig(r.itemsConfig,this.editor.ui.componentFactory)),this._balloon.add({view:r.view,position:O5(this.editor,c),balloonClassName:r.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",()=>{for(const u of this._toolbarDefinitions.values())if(this._isToolbarVisible(u)){const _=u.getRelatedElement(this.editor.editing.view.document.selection);L5(this.editor,_)}}))}_isToolbarVisible(r){return this._balloon.visibleView===r.view}_isToolbarInBalloon(r){return this._balloon.hasView(r.view)}}function L5(m,r){const c=m.plugins.get("ContextualBalloon"),u=O5(m,r);c.updatePosition(u)}function O5(m,r){const u=id.defaultPositions;return{target:m.editing.view.domConverter.mapViewToDom(r),positions:[u.northArrowSouth,u.northArrowSouthWest,u.northArrowSouthEast,u.southArrowNorth,u.southArrowNorthWest,u.southArrowNorthEast,u.viewportStickyNorth]}}Ze(),Ze();var dx=v(8506);Fo()(dx.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});const E5=bo("px");class B8 extends oa{constructor(){super();const r=this.bindTemplate;this.set({isVisible:!1,left:null,top:null,width:null}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-clipboard-drop-target-line",r.if("isVisible","ck-hidden",c=>!c)],style:{left:r.to("left",c=>E5(c)),top:r.to("top",c=>E5(c)),width:r.to("width",c=>E5(c))}}})}}class I5 extends lo{constructor(){super(...arguments),this.removeDropMarkerDelayed=wr(()=>this.removeDropMarker(),40),this._updateDropMarkerThrottled=Lh(r=>this._updateDropMarker(r),40),this._reconvertMarkerThrottled=Lh(()=>{this.editor.model.markers.has("drop-target")&&this.editor.editing.reconvertMarker("drop-target")},0),this._dropTargetLineView=new B8,this._domEmitter=new(Xi()),this._scrollables=new Map}static get pluginName(){return"DragDropTarget"}init(){this._setupDropMarker()}destroy(){this._domEmitter.stopListening();for(const{resizeObserver:r}of this._scrollables.values())r.destroy();return this._updateDropMarkerThrottled.cancel(),this.removeDropMarkerDelayed.cancel(),this._reconvertMarkerThrottled.cancel(),super.destroy()}updateDropMarker(r,c,u,_,C){this.removeDropMarkerDelayed.cancel();const M=F5(this.editor,r,c,u,_,C);M&&this._updateDropMarkerThrottled(M)}getFinalDropRange(r,c,u,_,C){const M=F5(this.editor,r,c,u,_,C);return this.removeDropMarker(),M}removeDropMarker(){const r=this.editor.model;this.removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),this._dropTargetLineView.isVisible=!1,r.markers.has("drop-target")&&r.change(c=>{c.removeMarker("drop-target")})}_setupDropMarker(){const r=this.editor;r.ui.view.body.add(this._dropTargetLineView),r.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),r.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(c,{writer:u})=>{if(r.model.schema.checkChild(c.markerRange.start,"$text"))return this._dropTargetLineView.isVisible=!1,this._createDropTargetPosition(u);c.markerRange.isCollapsed?this._updateDropTargetLine(c.markerRange):this._dropTargetLineView.isVisible=!1}})}_updateDropMarker(r){const c=this.editor,u=c.model.markers;c.model.change(_=>{u.has("drop-target")?u.get("drop-target").getRange().isEqual(r)||_.updateMarker("drop-target",{range:r}):_.addMarker("drop-target",{range:r,usingOperation:!1,affectsData:!1})})}_createDropTargetPosition(r){return r.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},function(c){const u=this.toDomElement(c);return u.append("\u2060",c.createElement("span"),"\u2060"),u})}_updateDropTargetLine(r){const c=this.editor.editing,u=r.start.nodeBefore,_=r.start.nodeAfter,C=r.start.parent,M=u?c.mapper.toViewElement(u):null,E=M?c.view.domConverter.mapViewToDom(M):null,N=_?c.mapper.toViewElement(_):null,j=N?c.view.domConverter.mapViewToDom(N):null,K=c.mapper.toViewElement(C),dt=c.view.domConverter.mapViewToDom(K),Dt=this._getScrollableRect(K),{scrollX:me,scrollY:Ue}=Lt.window,qe=E?new de(E):null,pn=j?new de(j):null,Ln=new de(dt).excludeScrollbarsAndBorders(),pi=qe?qe.bottom:Ln.top,Ri=pn?pn.top:Ln.bottom,Go=Lt.window.getComputedStyle(dt),ka=pi<=Ri?(pi+Ri)/2:Ri;if(Dt.topDt.is("element")&&!iy(m,Dt));let K=0,dt=j.length;if(0==dt)return M.createRange(M.createPositionAt(N,"end"));for(;Kr in m?Y8(m,r,{enumerable:!0,configurable:!0,writable:!0,value:c}):m[r]=c;class j8 extends lo{constructor(){super(...arguments),this._isBlockDragging=!1,this._domEmitter=new(Xi())}static get pluginName(){return"DragDropBlockToolbar"}init(){const r=this.editor;if(this.listenTo(r,"change:isReadOnly",(c,u,_)=>{_?(this.forceDisabled("readOnlyMode"),this._isBlockDragging=!1):this.clearForceDisabled("readOnlyMode")}),D_isAndroid&&this.forceDisabled("noAndroidSupport"),r.plugins.has("BlockToolbar")){const c=r.plugins.get("BlockToolbar").buttonView.element;this._domEmitter.listenTo(c,"dragstart",(u,_)=>this._handleBlockDragStart(_)),this._domEmitter.listenTo(Lt.document,"dragover",(u,_)=>this._handleBlockDragging(_)),this._domEmitter.listenTo(Lt.document,"drop",(u,_)=>this._handleBlockDragging(_)),this._domEmitter.listenTo(Lt.document,"dragend",()=>this._handleBlockDragEnd(),{useCapture:!0}),this.isEnabled&&c.setAttribute("draggable","true"),this.on("change:isEnabled",(u,_,C)=>{c.setAttribute("draggable",C?"true":"false")})}}destroy(){return this._domEmitter.stopListening(),super.destroy()}_handleBlockDragStart(r){if(!this.isEnabled)return;const c=this.editor.model,_=this.editor.editing.view,C=Array.from(c.document.selection.getSelectedBlocks()),M=c.createRange(c.createPositionBefore(C[0]),c.createPositionAfter(C[C.length-1]));c.change(E=>E.setSelection(M)),this._isBlockDragging=!0,_.focus(),_.getObserver(Rh).onDomEvent(r)}_handleBlockDragging(r){if(!this.isEnabled||!this._isBlockDragging)return;const c=r.clientX+("ltr"==this.editor.locale.contentLanguageDirection?100:-100),u=r.clientY,_=document.elementFromPoint(c,u),C=this.editor.editing.view;var M;_&&_.closest(".ck-editor__editable")&&C.getObserver(Rh).onDomEvent((M=((N,j)=>{for(var K in j||(j={}))_x.call(j,K)&&fx(N,K,j[K]);if(vf)for(var K of vf(j))N5.call(j,K)&&fx(N,K,j[K]);return N})({},r),V8(M,mx({type:r.type,dataTransfer:r.dataTransfer,target:_,clientX:c,clientY:u,preventDefault:()=>r.preventDefault(),stopPropagation:()=>r.stopPropagation()}))))}_handleBlockDragEnd(){this._isBlockDragging=!1}}var hx=v(903);Fo()(hx.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});class bx extends lo{constructor(){super(...arguments),this._clearDraggableAttributesDelayed=wr(()=>this._clearDraggableAttributes(),40),this._blockMode=!1,this._domEmitter=new(Xi())}static get pluginName(){return"DragDrop"}static get requires(){return[Np,j0,I5,j8]}init(){const r=this.editor,c=r.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,c.addObserver(Rh),c.addObserver(A0),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDraggableAttributeHandling(),this.listenTo(r,"change:isReadOnly",(u,_,C)=>{C?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")}),this.on("change:isEnabled",(u,_,C)=>{C||this._finalizeDragging(!1)}),D_isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._previewContainer&&this._previewContainer.remove(),this._domEmitter.stopListening(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const r=this.editor,c=r.model,u=r.editing.view,_=u.document,C=r.plugins.get(I5);this.listenTo(_,"dragstart",(M,E)=>{if(E.target&&E.target.is("editableElement")||(this._prepareDraggedRange(E.target),!this._draggedRange))return void E.preventDefault();this._draggingUid=Pt(),E.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",E.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const N=c.createSelection(this._draggedRange.toRange());this.editor.plugins.get("ClipboardPipeline")._fireOutputTransformationEvent(E.dataTransfer,N,"dragstart");const{dataTransfer:j,domTarget:K,domEvent:dt}=E,{clientX:Dt}=dt;this._updatePreview({dataTransfer:j,domTarget:K,clientX:Dt}),E.stopPropagation(),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")},{priority:"low"}),this.listenTo(_,"dragend",(M,E)=>{this._finalizeDragging(!E.dataTransfer.isCanceled&&"move"==E.dataTransfer.dropEffect)},{priority:"low"}),this._domEmitter.listenTo(Lt.document,"dragend",()=>{this._blockMode=!1},{useCapture:!0}),this.listenTo(_,"dragenter",()=>{this.isEnabled&&u.focus()}),this.listenTo(_,"dragleave",()=>{C.removeDropMarkerDelayed()}),this.listenTo(_,"dragging",(M,E)=>{if(!this.isEnabled)return void(E.dataTransfer.dropEffect="none");const{clientX:N,clientY:j}=E.domEvent;C.updateDropMarker(E.target,E.targetRanges,N,j,this._blockMode),this._draggedRange||(E.dataTransfer.dropEffect="copy"),D_isGecko||("copy"==E.dataTransfer.effectAllowed?E.dataTransfer.dropEffect="copy":["all","copyMove"].includes(E.dataTransfer.effectAllowed)&&(E.dataTransfer.dropEffect="move")),M.stop()},{priority:"low"})}_setupClipboardInputIntegration(){const r=this.editor,c=r.editing.view.document,u=r.plugins.get(I5);this.listenTo(c,"clipboardInput",(_,C)=>{if("drop"!=C.method)return;const{clientX:M,clientY:E}=C.domEvent,N=u.getFinalDropRange(C.target,C.targetRanges,M,E,this._blockMode);return N?(this._draggedRange&&this._draggingUid!=C.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid=""),"move"==vx(C.dataTransfer)&&this._draggedRange&&this._draggedRange.containsRange(N,!0)?(this._finalizeDragging(!1),void _.stop()):void(C.targetRanges=[r.editing.mapper.toViewRange(N)])):(this._finalizeDragging(!1),void _.stop())},{priority:"high"})}_setupContentInsertionIntegration(){const r=this.editor.plugins.get(Np);r.on("contentInsertion",(c,u)=>{if(!this.isEnabled||"drop"!==u.method)return;const _=u.targetRanges.map(C=>this.editor.editing.mapper.toModelRange(C));this.editor.model.change(C=>C.setSelection(_))},{priority:"high"}),r.on("contentInsertion",(c,u)=>{if(!this.isEnabled||"drop"!==u.method)return;const _="move"==vx(u.dataTransfer);this._finalizeDragging((!u.resultRange||!u.resultRange.isCollapsed)&&_)},{priority:"lowest"})}_setupDraggableAttributeHandling(){const r=this.editor,c=r.editing.view,u=c.document;this.listenTo(u,"mousedown",(_,C)=>{if(D_isAndroid||!C)return;this._clearDraggableAttributesDelayed.cancel();let M=Yh(C.target);if(D_isBlink&&!r.isReadOnly&&!M&&!u.selection.isCollapsed){const E=u.selection.getSelectedElement();E&&El(E)||(M=u.selection.editableElement)}M&&(c.change(E=>{E.setAttribute("draggable","true",M)}),this._draggableElement=r.editing.mapper.toModelElement(M))}),this.listenTo(u,"mouseup",()=>{D_isAndroid||this._clearDraggableAttributesDelayed()})}_clearDraggableAttributes(){const r=this.editor.editing;r.view.change(c=>{this._draggableElement&&"$graveyard"!=this._draggableElement.root.rootName&&c.removeAttribute("draggable",r.mapper.toViewElement(this._draggableElement)),this._draggableElement=null})}_finalizeDragging(r){const c=this.editor,u=c.model;c.plugins.get(I5).removeDropMarker(),this._clearDraggableAttributes(),c.plugins.has("WidgetToolbarRepository")&&c.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._previewContainer&&(this._previewContainer.remove(),this._previewContainer=void 0),this._draggedRange&&(r&&this.isEnabled&&u.change(_=>{const C=u.createSelection(this._draggedRange);u.deleteContent(C,{doNotAutoparagraph:!0});const M=C.getFirstPosition().parent;M.isEmpty&&!u.schema.checkChild(M,"$text")&&u.schema.checkChild(M,"paragraph")&&_.insertElement("paragraph",M,0)}),this._draggedRange.detach(),this._draggedRange=null)}_prepareDraggedRange(r){const c=this.editor,u=c.model,_=u.document.selection,C=r?Yh(r):null;if(C){const j=c.editing.mapper.toModelElement(C);return this._draggedRange=Xu.fromRange(u.createRangeOn(j)),this._blockMode=u.schema.isBlock(j),void(c.plugins.has("WidgetToolbarRepository")&&c.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop"))}if(_.isCollapsed&&!_.getFirstPosition().parent.isEmpty)return;const M=Array.from(_.getSelectedBlocks()),E=_.getFirstRange();if(0==M.length)return void(this._draggedRange=Xu.fromRange(E));const N=xx(u,M);if(M.length>1)this._draggedRange=Xu.fromRange(N),this._blockMode=!0;else if(1==M.length){const j=E.start.isTouching(N.start)&&E.end.isTouching(N.end);this._draggedRange=Xu.fromRange(j?N:E),this._blockMode=j}u.change(j=>j.setSelection(this._draggedRange.toRange()))}_updatePreview({dataTransfer:r,domTarget:c,clientX:u}){const _=this.editor.editing.view,M=_.domConverter.mapViewToDom(_.document.selection.editableElement),E=Lt.window.getComputedStyle(M);this._previewContainer?this._previewContainer.firstElementChild&&this._previewContainer.removeChild(this._previewContainer.firstElementChild):(this._previewContainer=tn(Lt.document,"div",{style:"position: fixed; left: -999999px;"}),Lt.document.body.appendChild(this._previewContainer));const N=new de(M);if(M.contains(c))return;const j=parseFloat(E.paddingLeft),K=tn(Lt.document,"div");K.className="ck ck-content",K.style.width=E.width,K.style.paddingLeft=`${N.left-u+j}px`,D_isiOS&&(K.style.backgroundColor="white"),K.innerHTML=r.getData("text/html"),r.setDragImage(K,0,0),this._previewContainer.appendChild(K)}}function vx(m){return D_isGecko?m.dropEffect:["all","copyMove"].includes(m.effectAllowed)?"move":"copy"}function Yh(m){if(m.is("editableElement"))return null;if(m.hasClass("ck-widget__selection-handle"))return m.findAncestor(El);if(El(m))return m;const r=m.findAncestor(c=>El(c)||c.is("editableElement"));return El(r)?r:null}function xx(m,r){const c=r[0],u=r[r.length-1],_=c.getCommonAncestor(u),C=m.createPositionBefore(c),M=m.createPositionAfter(u);if(_&&_.is("element")&&!m.schema.isLimit(_)){const E=m.createRangeOn(_),N=C.isTouching(E.start),j=M.isTouching(E.end);if(N&&j)return xx(m,[_])}return m.createRange(C,M)}class Cx extends lo{static get pluginName(){return"PastePlainText"}static get requires(){return[Np]}init(){const r=this.editor,c=r.model,u=r.editing.view,_=u.document,C=c.document.selection;let M=!1;u.addObserver(Rh),this.listenTo(_,"keydown",(E,N)=>{M=N.shiftKey}),r.plugins.get(Np).on("contentInsertion",(E,N)=>{(M||function(j,K){if(j.childCount>1)return!1;const dt=j.getChild(0);return!K.isObject(dt)&&0==Array.from(dt.getAttributeKeys()).length}(N.content,c.schema))&&c.change(j=>{const K=Array.from(C.getAttributes()).filter(([Dt])=>c.schema.getAttributeProperties(Dt).isFormatting);C.isCollapsed||c.deleteContent(C,{doNotAutoparagraph:!0}),K.push(...C.getAttributes());const dt=j.createRangeIn(N.content);for(const Dt of dt.getItems())Dt.is("$textProxy")&&j.setAttributes(K,Dt)})})}}class Ax extends lo{static get pluginName(){return"Clipboard"}static get requires(){return[Np,bx,Cx]}}class z4 extends Ua{constructor(r){super(r),this.affectsData=!1}execute(){const r=this.editor.model,c=r.document.selection;let u=r.schema.getLimitElement(c);if(c.containsEntireContent(u)||!yx(r.schema,u))do{if(u=u.parent,!u)return}while(!yx(r.schema,u));r.change(_=>{_.setSelection(u,"in")})}}function yx(m,r){return m.isLimit(r)&&(m.checkChild(r,"$text")||m.checkChild(r,"paragraph"))}const Tx=tc("Ctrl+A");class J8 extends lo{static get pluginName(){return"SelectAllEditing"}init(){const r=this.editor,c=r.editing.view.document;r.commands.add("selectAll",new z4(r)),this.listenTo(c,"keydown",(u,_)=>{Tc(_)===Tx&&(r.execute("selectAll"),_.preventDefault())})}}class q5 extends lo{static get pluginName(){return"SelectAllUI"}init(){const r=this.editor;r.ui.componentFactory.add("selectAll",c=>{const u=r.commands.get("selectAll"),_=new $o(c);return _.set({label:(0,c.t)("Select all"),icon:'',keystroke:"Ctrl+A",tooltip:!0}),_.bind("isEnabled").to(u,"isEnabled"),this.listenTo(_,"execute",()=>{r.execute("selectAll"),r.editing.view.focus()}),_})}}class G8 extends lo{static get requires(){return[J8,q5]}static get pluginName(){return"SelectAll"}}var wx=Object.defineProperty,R5=Object.getOwnPropertySymbols,Ux=Object.prototype.hasOwnProperty,Zx=Object.prototype.propertyIsEnumerable,Mx=(m,r,c)=>r in m?wx(m,r,{enumerable:!0,configurable:!0,writable:!0,value:c}):m[r]=c;class Vh extends Ua{constructor(r){super(r),this._stack=[],this._createdBatches=new WeakSet,this.refresh(),this._isEnabledBasedOnSelection=!1,this.listenTo(r.data,"set",(c,u)=>{u[1]=((C,M)=>{for(var E in M||(M={}))Ux.call(M,E)&&Mx(C,E,M[E]);if(R5)for(var E of R5(M))Zx.call(M,E)&&Mx(C,E,M[E]);return C})({},u[1]);const _=u[1];_.batchType||(_.batchType={isUndoable:!1})},{priority:"high"}),this.listenTo(r.data,"set",(c,u)=>{u[1].batchType.isUndoable||this.clearStack()})}refresh(){this.isEnabled=this._stack.length>0}get createdBatches(){return this._createdBatches}addBatch(r){const c=this.editor.model.document.selection,u={ranges:c.hasOwnRange?Array.from(c.getRanges()):[],isBackward:c.isBackward};this._stack.push({batch:r,selection:u}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(r,c,u){const _=this.editor.model,C=_.document,M=[],E=r.map(j=>j.getTransformedByOperations(u)),N=E.flat();for(const j of E){const K=j.filter(dt=>dt.root!=C.graveyard).filter(dt=>!kx(dt,N));K.length&&(Q8(K),M.push(K[0]))}M.length&&_.change(j=>{j.setSelection(M,{backward:c})})}_undo(r,c){const u=this.editor.model,_=u.document;this._createdBatches.add(c);const C=r.operations.slice().filter(M=>M.isDocumentOperation);C.reverse();for(const M of C){const N=Array.from(_.history.getOperations(M.baseVersion+1)),j=fh([M.getReversed()],N,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(let K of j){const dt=K.affectedSelectable;dt&&!u.canEditAt(dt)&&(K=new fc(K.baseVersion)),c.addOperation(K),u.applyOperation(K),_.history.setOperationAsUndone(M,K)}}}}function Q8(m){m.sort((r,c)=>r.start.isBefore(c.start)?-1:1);for(let r=1;rc!==m&&c.containsRange(m,!0))}class Dx extends Vh{execute(r=null){const c=r?this._stack.findIndex(C=>C.batch==r):this._stack.length-1,u=this._stack.splice(c,1)[0],_=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(_,()=>{this._undo(u.batch,_);const C=this.editor.model.document.history.getOperations(u.batch.baseVersion);this._restoreSelection(u.selection.ranges,u.selection.isBackward,C)}),this.fire("revert",u.batch,_),this.refresh()}}class W8 extends Vh{execute(){const r=this._stack.pop(),c=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(c,()=>{const _=this.editor.model.document.history.getOperations(r.batch.operations[r.batch.operations.length-1].baseVersion+1);this._restoreSelection(r.selection.ranges,r.selection.isBackward,_),this._undo(r.batch,c)}),this.refresh()}}class $8 extends lo{constructor(){super(...arguments),this._batchRegistry=new WeakSet}static get pluginName(){return"UndoEditing"}init(){const r=this.editor;this._undoCommand=new Dx(r),this._redoCommand=new W8(r),r.commands.add("undo",this._undoCommand),r.commands.add("redo",this._redoCommand),this.listenTo(r.model,"applyOperation",(c,u)=>{const _=u[0];if(!_.isDocumentOperation)return;const C=_.batch,M=this._redoCommand.createdBatches.has(C),E=this._undoCommand.createdBatches.has(C);this._batchRegistry.has(C)||(this._batchRegistry.add(C),C.isUndoable&&(M?this._undoCommand.addBatch(C):E||(this._undoCommand.addBatch(C),this._redoCommand.clearStack())))},{priority:"highest"}),this.listenTo(this._undoCommand,"revert",(c,u,_)=>{this._redoCommand.addBatch(_)}),r.keystrokes.set("CTRL+Z","undo"),r.keystrokes.set("CTRL+Y","redo"),r.keystrokes.set("CTRL+SHIFT+Z","redo")}}const H5='',Px='';class K8 extends lo{static get pluginName(){return"UndoUI"}init(){const r=this.editor,c=r.locale,u=r.t,_="ltr"==c.uiLanguageDirection?H5:Px,C="ltr"==c.uiLanguageDirection?Px:H5;this._addButton("undo",u("Undo"),"CTRL+Z",_),this._addButton("redo",u("Redo"),"CTRL+Y",C)}_addButton(r,c,u,_){const C=this.editor;C.ui.componentFactory.add(r,M=>{const E=C.commands.get(r),N=new $o(M);return N.set({label:c,icon:_,keystroke:u,tooltip:!0}),N.bind("isEnabled").to(E,"isEnabled"),this.listenTo(N,"execute",()=>{C.execute(r),C.editing.view.focus()}),N})}}class Sx extends lo{static get requires(){return[$8,K8]}static get pluginName(){return"Undo"}}class Lx extends(Ze()){constructor(){super();const r=new window.FileReader;this._reader=r,this._data=void 0,this.set("loaded",0),r.onprogress=c=>{this.loaded=c.loaded}}get error(){return this._reader.error}get data(){return this._data}read(r){const c=this._reader;return this.total=r.size,new Promise((u,_)=>{c.onload=()=>{const C=c.result;this._data=C,u(C)},c.onerror=()=>{_("error")},c.onabort=()=>{_("aborted")},this._reader.readAsDataURL(r)})}abort(){this._reader.abort()}}class ip extends lo{constructor(){super(...arguments),this.loaders=new ec,this._loadersMap=new Map,this._pendingAction=null}static get pluginName(){return"FileRepository"}static get requires(){return[wh]}init(){this.loaders.on("change",()=>this._updatePendingAction()),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(r,c)=>c?r/c*100:0)}getLoader(r){return this._loadersMap.get(r)||null}createLoader(r){if(!this.createUploadAdapter)return Zt("filerepository-no-upload-adapter"),null;const c=new z5(Promise.resolve(r),this.createUploadAdapter);return this.loaders.add(c),this._loadersMap.set(r,c),r instanceof Promise&&c.file.then(u=>{this._loadersMap.set(u,c)}).catch(()=>{}),c.on("change:uploaded",()=>{let u=0;for(const _ of this.loaders)u+=_.uploaded;this.uploaded=u}),c.on("change:uploadTotal",()=>{let u=0;for(const _ of this.loaders)_.uploadTotal&&(u+=_.uploadTotal);this.uploadTotal=u}),c}destroyLoader(r){const c=r instanceof z5?r:this.getLoader(r);c._destroy(),this.loaders.remove(c),this._loadersMap.forEach((u,_)=>{u===c&&this._loadersMap.delete(_)})}_updatePendingAction(){const r=this.editor.plugins.get(wh);if(this.loaders.length){if(!this._pendingAction){const c=this.editor.t,u=_=>`${c("Upload in progress")} ${parseInt(_)}%.`;this._pendingAction=r.add(u(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",u)}}else r.remove(this._pendingAction),this._pendingAction=null}}class z5 extends(Ze()){constructor(r,c){super(),this.id=Pt(),this._filePromiseWrapper=this._createFilePromiseWrapper(r),this._adapter=c(this),this._reader=new Lx,this.set("status","idle"),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(u,_)=>_?u/_*100:0),this.set("uploadResponse",null)}get file(){return this._filePromiseWrapper?this._filePromiseWrapper.promise.then(r=>this._filePromiseWrapper?r:null):Promise.resolve(null)}get data(){return this._reader.data}read(){if("idle"!=this.status)throw new at("filerepository-read-wrong-status",this);return this.status="reading",this.file.then(r=>this._reader.read(r)).then(r=>{if("reading"!==this.status)throw this.status;return this.status="idle",r}).catch(r=>{throw"aborted"===r?(this.status="aborted","aborted"):(this.status="error",this._reader.error?this._reader.error:r)})}upload(){if("idle"!=this.status)throw new at("filerepository-upload-wrong-status",this);return this.status="uploading",this.file.then(()=>this._adapter.upload()).then(r=>(this.uploadResponse=r,this.status="idle",r)).catch(r=>{throw"aborted"===this.status?"aborted":(this.status="error",r)})}abort(){const r=this.status;this.status="aborted",this._filePromiseWrapper.isFulfilled?"reading"==r?this._reader.abort():"uploading"==r&&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(r){const c={};return c.promise=new Promise((u,_)=>{c.rejecter=_,c.isFulfilled=!1,r.then(C=>{c.isFulfilled=!0,u(C)}).catch(C=>{c.isFulfilled=!0,_(C)})}),c}}class Ox extends oa{constructor(r){super(r),this.buttonView=new $o(r),this._fileInputView=new X8(r),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 X8 extends oa{constructor(r){super(r),this.set("acceptedType",void 0),this.set("allowMultipleFiles",!1);const c=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:c.to("acceptedType"),multiple:c.to("allowMultipleFiles")},on:{change:c.to(()=>{this.element&&this.element.files&&this.element.files.length&&this.fire("done",this.element.files),this.element.value=""})}})}open(){this.element.click()}}const B5="abcdefghijklmnopqrstuvwxyz0123456789";class tA{constructor(r,c,u){this.loader=r,this.url=c,this.t=u}upload(){return this.loader.file.then(r=>new Promise((c,u)=>{this._initRequest(),this._initListeners(c,u,r),this._sendRequest(r)}))}abort(){this.xhr&&this.xhr.abort()}_initRequest(){const r=this.xhr=new XMLHttpRequest;r.open("POST",this.url,!0),r.responseType="json"}_initListeners(r,c,u){const _=this.xhr,C=this.loader,M=(0,this.t)("Cannot upload file:")+` ${u.name}.`;_.addEventListener("error",()=>c(M)),_.addEventListener("abort",()=>c()),_.addEventListener("load",()=>{const E=_.response;if(!E||!E.uploaded)return c(E&&E.error&&E.error.message?E.error.message:M);r({default:E.url})}),_.upload&&_.upload.addEventListener("progress",E=>{E.lengthComputable&&(C.uploadTotal=E.total,C.uploaded=E.loaded)})}_sendRequest(r){const c=new FormData;c.append("upload",r),c.append("ckCsrfToken",function Y5(){let m=function(u){u=u.toLowerCase();const _=document.cookie.split(";");for(const C of _){const M=C.split("=");if(decodeURIComponent(M[0].trim().toLowerCase())===u)return decodeURIComponent(M[1])}return null}("ckCsrfToken");var c;return m&&40==m.length||(m=function(u){let _="";const C=new Uint8Array(40);window.crypto.getRandomValues(C);for(let M=0;M.5?E.toUpperCase():E}return _}(),c=m,document.cookie=encodeURIComponent("ckCsrfToken")+"="+encodeURIComponent(c)+";path=/"),m}()),this.xhr.send(c)}}function qp(m,r,c,u){let _,C=null;"function"==typeof u?_=u:(C=m.commands.get(u),_=()=>{m.execute(u)}),m.model.document.on("change:data",(M,E)=>{if(C&&!C.isEnabled||!r.isEnabled)return;const N=os(m.model.document.selection.getRanges());if(!N.isCollapsed||E.isUndo||!E.isLocal)return;const j=Array.from(m.model.document.differ.getChanges()),K=j[0];if(1!=j.length||"insert"!==K.type||"$text"!=K.name||1!=K.length)return;const dt=K.position.parent;if(dt.is("element","codeBlock")||dt.is("element","listItem")&&"function"!=typeof u&&!["numberedList","bulletedList","todoList"].includes(u)||C&&!0===C.value)return;const Dt=dt.getChild(0),me=m.model.createRangeOn(Dt);if(!me.containsRange(N)&&!N.end.isEqual(me.end))return;const Ue=c.exec(Dt.data.substr(0,N.end.offset));Ue&&m.model.enqueueChange(qe=>{const pn=qe.createPositionAt(dt,0),Ln=qe.createPositionAt(dt,Ue[0].length),pi=new Xu(pn,Ln);if(!1!==_({match:Ue})){qe.remove(pi);const Ri=m.model.document.selection.getFirstRange(),Go=qe.createRangeIn(dt);!dt.isEmpty||Go.isEqual(Ri)||Go.containsRange(Ri,!0)||qe.remove(dt)}pi.detach(),m.model.enqueueChange(()=>{m.plugins.get("Delete").requestUndoOnBackspace()})})})}function f2(m,r,c,u){let _,C;c instanceof RegExp?_=c:C=c,C=C||(M=>{let E;const N=[],j=[];for(;null!==(E=_.exec(M))&&!(E&&E.length<4);){let{index:K,1:dt,2:Dt,3:me}=E;K+=E[0].length-(dt+Dt+me).length;const pn=[K+dt.length+Dt.length,K+dt.length+Dt.length+me.length];N.push([K,K+dt.length]),N.push(pn),j.push([K+dt.length,K+dt.length+Dt.length])}return{remove:N,format:j}}),m.model.document.on("change:data",(M,E)=>{if(E.isUndo||!E.isLocal||!r.isEnabled)return;const N=m.model,j=N.document.selection;if(!j.isCollapsed)return;const K=Array.from(N.document.differ.getChanges()),dt=K[0];if(1!=K.length||"insert"!==dt.type||"$text"!=dt.name||1!=dt.length)return;const Dt=j.focus,me=Dt.parent,{text:Ue,range:qe}=function(Ri,Go){let ka=Ri.start;return{text:Array.from(Ri.getItems()).reduce(($r,Il)=>!Il.is("$text")&&!Il.is("$textProxy")||Il.getAttribute("code")?(ka=Go.createPositionAfter(Il),""):$r+Il.data,""),range:Go.createRange(ka,Ri.end)}}(N.createRange(N.createPositionAt(me,0),Dt),N),pn=C(Ue),Ln=V5(qe.start,pn.format,N),pi=V5(qe.start,pn.remove,N);Ln.length&&pi.length&&N.enqueueChange(Ri=>{if(!1!==u(Ri,Ln)){for(const Go of pi.reverse())Ri.remove(Go);N.enqueueChange(()=>{m.plugins.get("Delete").requestUndoOnBackspace()})}})})}function V5(m,r,c){return r.filter(u=>void 0!==u[0]&&void 0!==u[1]).map(u=>c.createRange(m.getShiftedBy(u[0]),m.getShiftedBy(u[1])))}function jh(m,r){return(c,u)=>{if(!m.commands.get(r).isEnabled)return!1;const _=m.model.schema.getValidRanges(u,r);for(const C of _)c.setAttribute(r,!0,C);c.removeSelectionAttribute(r)}}class Ex extends Ua{constructor(r,c){super(r),this.attributeKey=c}refresh(){const r=this.editor.model,c=r.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=r.schema.checkAttributeInSelection(c.selection,this.attributeKey)}execute(r={}){const c=this.editor.model,u=c.document.selection,_=void 0===r.forceValue?!this.value:r.forceValue;c.change(C=>{if(u.isCollapsed)_?C.setSelectionAttribute(this.attributeKey,!0):C.removeSelectionAttribute(this.attributeKey);else{const M=c.schema.getValidRanges(u.getRanges(),this.attributeKey);for(const E of M)_?C.setAttribute(this.attributeKey,_,E):C.removeAttribute(this.attributeKey,E)}})}_getValueFromFirstAllowedNode(){const r=this.editor.model,c=r.schema,u=r.document.selection;if(u.isCollapsed)return u.hasAttribute(this.attributeKey);for(const _ of u.getRanges())for(const C of _.getItems())if(c.checkAttribute(C,this.attributeKey))return C.hasAttribute(this.attributeKey);return!1}}const Jh="bold";class j5 extends lo{static get pluginName(){return"BoldEditing"}init(){const r=this.editor;r.model.schema.extend("$text",{allowAttributes:Jh}),r.model.schema.setAttributeProperties(Jh,{isFormatting:!0,copyOnEnter:!0}),r.conversion.attributeToElement({model:Jh,view:"strong",upcastAlso:["b",c=>{const u=c.getStyle("font-weight");return u&&("bold"==u||Number(u)>=600)?{name:!0,styles:["font-weight"]}:null}]}),r.commands.add(Jh,new Ex(r,Jh)),r.keystrokes.set("CTRL+B",Jh)}}const J5="bold";class G5 extends lo{static get pluginName(){return"BoldUI"}init(){const r=this.editor,c=r.t;r.ui.componentFactory.add(J5,u=>{const _=r.commands.get(J5),C=new $o(u);return C.set({label:c("Bold"),icon:hs.bold,keystroke:"CTRL+B",tooltip:!0,isToggleable:!0}),C.bind("isOn","isEnabled").to(_,"value","isEnabled"),this.listenTo(C,"execute",()=>{r.execute(J5),r.editing.view.focus()}),C})}}var xf=v(8603);Fo()(xf.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});const Gh="italic";class oy extends lo{static get pluginName(){return"ItalicEditing"}init(){const r=this.editor;r.model.schema.extend("$text",{allowAttributes:Gh}),r.model.schema.setAttributeProperties(Gh,{isFormatting:!0,copyOnEnter:!0}),r.conversion.attributeToElement({model:Gh,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),r.commands.add(Gh,new Ex(r,Gh)),r.keystrokes.set("CTRL+I",Gh)}}const W0="italic";class V4 extends lo{static get pluginName(){return"ItalicUI"}init(){const r=this.editor,c=r.t;r.ui.componentFactory.add(W0,u=>{const _=r.commands.get(W0),C=new $o(u);return C.set({label:c("Italic"),icon:'',keystroke:"CTRL+I",tooltip:!0,isToggleable:!0}),C.bind("isOn","isEnabled").to(_,"value","isEnabled"),this.listenTo(C,"execute",()=>{r.execute(W0),r.editing.view.focus()}),C})}}class eA extends Ua{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(r={}){const c=this.editor.model,u=c.schema,C=Array.from(c.document.selection.getSelectedBlocks()),M=void 0===r.forceValue?!this.value:r.forceValue;c.change(E=>{if(M){const N=C.filter(j=>Cf(j)||Q5(u,j));this._applyQuote(E,N)}else this._removeQuote(E,C.filter(Cf))})}_getValue(){const r=os(this.editor.model.document.selection.getSelectedBlocks());return!(!r||!Cf(r))}_checkEnabled(){if(this.value)return!0;const c=this.editor.model.schema,u=os(this.editor.model.document.selection.getSelectedBlocks());return!!u&&Q5(c,u)}_removeQuote(r,c){Ix(r,c).reverse().forEach(u=>{if(u.start.isAtStart&&u.end.isAtEnd)return void r.unwrap(u.start.parent);if(u.start.isAtStart){const C=r.createPositionBefore(u.start.parent);return void r.move(u,C)}u.end.isAtEnd||r.split(u.end);const _=r.createPositionAfter(u.end.parent);r.move(u,_)})}_applyQuote(r,c){const u=[];Ix(r,c).reverse().forEach(_=>{let C=Cf(_.start);C||(C=r.createElement("blockQuote"),r.wrap(_,C)),u.push(C)}),u.reverse().reduce((_,C)=>_.nextSibling==C?(r.merge(r.createPositionAfter(_)),_):C)}}function Cf(m){return"blockQuote"==m.parent.name?m.parent:null}function Ix(m,r){let c,u=0;const _=[];for(;u{const E=r.model.document.differ.getChanges();for(const N of E)if("insert"==N.type){const j=N.position.nodeAfter;if(!j)continue;if(j.is("element","blockQuote")&&j.isEmpty)return M.remove(j),!0;if(j.is("element","blockQuote")&&!c.checkChild(N.position,j))return M.unwrap(j),!0;if(j.is("element")){const K=M.createRangeIn(j);for(const dt of K.getItems())if(dt.is("element","blockQuote")&&!c.checkChild(M.createPositionBefore(dt),dt))return M.unwrap(dt),!0}}else if("remove"==N.type){const j=N.position.parent;if(j.is("element","blockQuote")&&j.isEmpty)return M.remove(j),!0}return!1});const u=this.editor.editing.view.document,_=r.model.document.selection,C=r.commands.get("blockQuote");this.listenTo(u,"enter",(M,E)=>{!_.isCollapsed||!C.value||_.getLastPosition().parent.isEmpty&&(r.execute("blockQuote"),r.editing.view.scrollToTheSelection(),E.preventDefault(),M.stop())},{context:"blockquote"}),this.listenTo(u,"delete",(M,E)=>{if("backward"!=E.direction||!_.isCollapsed||!C.value)return;const N=_.getLastPosition().parent;N.isEmpty&&!N.previousSibling&&(r.execute("blockQuote"),r.editing.view.scrollToTheSelection(),E.preventDefault(),M.stop())},{context:"blockquote"})}}var _a=v(3062);Fo()(_a.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});class Fx extends lo{static get pluginName(){return"BlockQuoteUI"}init(){const r=this.editor,c=r.t;r.ui.componentFactory.add("blockQuote",u=>{const _=r.commands.get("blockQuote"),C=new $o(u);return C.set({label:c("Block quote"),icon:hs.quote,tooltip:!0,isToggleable:!0}),C.bind("isOn","isEnabled").to(_,"value","isEnabled"),this.listenTo(C,"execute",()=>{r.execute("blockQuote"),r.editing.view.focus()}),C})}}class Nx extends lo{static get pluginName(){return"CKBoxUI"}afterInit(){const r=this.editor,c=r.commands.get("ckbox");if(!c)return;const u=r.t;r.ui.componentFactory.add("ckbox",_=>{const C=new $o(_);return C.set({label:u("Open file manager"),icon:'',tooltip:!0}),C.bind("isOn","isEnabled").to(c,"value","isEnabled"),C.on("execute",()=>{r.execute("ckbox")}),C})}}function qx(m){const r=[];let c=0;for(const _ in m){const C=parseInt(_,10);isNaN(C)||(C>c&&(c=C),r.push(`${m[_]} ${_}w`))}const u=[{srcset:r.join(","),sizes:`(max-width: ${c}px) 100vw, ${c}px`,type:"image/webp"}];return{imageFallbackUrl:m.default,imageSources:u}}class nA extends Ua{constructor(r){super(r),this._chosenAssets=new Set,this._wrapper=null,this._initListeners()}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(){this.fire("ckbox:open")}_getValue(){return null!==this._wrapper}_checkEnabled(){const r=this.editor.commands.get("insertImage"),c=this.editor.commands.get("link");return!(!r.isEnabled&&!c.isEnabled)}_prepareOptions(){const r=this.editor.config.get("ckbox");return{theme:r.theme,language:r.language,tokenUrl:r.tokenUrl,serviceOrigin:r.serviceOrigin,dialog:{onClose:()=>this.fire("ckbox:close")},assets:{onChoose:c=>this.fire("ckbox:choose",c)}}}_initListeners(){const r=this.editor,c=r.model,u=!r.config.get("ckbox.ignoreDataId");this.on("ckbox",()=>{this.refresh()},{priority:"low"}),this.on("ckbox:open",()=>{this.isEnabled&&!this.value&&(this._wrapper=tn(document,"div",{class:"ck ckbox-wrapper"}),document.body.appendChild(this._wrapper),window.CKBox.mount(this._wrapper,this._prepareOptions()))}),this.on("ckbox:close",()=>{this.value&&(this._wrapper.remove(),this._wrapper=null)}),this.on("ckbox:choose",(_,C)=>{if(!this.isEnabled)return;const M=r.commands.get("insertImage"),E=r.commands.get("link"),N=function({assets:j,isImageAllowed:K,isLinkAllowed:dt}){return j.map(Dt=>function(me){const Ue=me.data.metadata;return!!Ue&&Ue.width&&Ue.height}(Dt)?{id:Dt.data.id,type:"image",attributes:iA(Dt)}:{id:Dt.data.id,type:"link",attributes:oA(Dt)}).filter(Dt=>"image"===Dt.type?K:dt)}({assets:C,isImageAllowed:M.isEnabled,isLinkAllowed:E.isEnabled});0!==N.length&&c.change(j=>{for(const K of N)this._insertAsset(K,K===N[N.length-1],j),u&&(setTimeout(()=>this._chosenAssets.delete(K),1e3),this._chosenAssets.add(K))})}),this.listenTo(r,"destroy",()=>{this.fire("ckbox:close"),this._chosenAssets.clear()})}_insertAsset(r,c,u){const _=this.editor.model.document.selection;u.removeSelectionAttribute("linkHref"),"image"===r.type?this._insertImage(r):this._insertLink(r,u),c||u.setSelection(_.getLastPosition())}_insertImage(r){const c=this.editor,{imageFallbackUrl:u,imageSources:_,imageTextAlternative:C}=r.attributes;c.execute("insertImage",{source:{src:u,sources:_,alt:C}})}_insertLink(r,c){const u=this.editor,_=u.model,C=_.document.selection,{linkName:M,linkHref:E}=r.attributes;if(C.isCollapsed){const N=Kc(C.getAttributes()),j=c.createText(M,N),K=_.insertContent(j);c.setSelection(K)}u.execute("link",E)}}function iA(m){const{imageFallbackUrl:r,imageSources:c}=qx(m.data.imageUrls);return{imageFallbackUrl:r,imageSources:c,imageTextAlternative:m.data.metadata.description||""}}function oA(m){return{linkName:m.data.name,linkHref:$5(m)}}function $5(m){const r=new URL(m.data.url);return r.searchParams.set("download","true"),r.toString()}var Qh=(m,r,c)=>new Promise((u,_)=>{var C=N=>{try{E(c.next(N))}catch(j){_(j)}},M=N=>{try{E(c.throw(N))}catch(j){_(j)}},E=N=>N.done?u(N.value):Promise.resolve(N.value).then(C,M);E((c=c.apply(m,r)).next())});class Rx extends lo{static get requires(){return["ImageUploadEditing","ImageUploadProgress",ip,K5]}static get pluginName(){return"CKBoxUploadAdapter"}afterInit(){return Qh(this,null,function*(){const r=this.editor,c=!!r.config.get("ckbox"),u=!!window.CKBox;if(!c&&!u)return;const _=r.plugins.get(ip),C=r.plugins.get(K5);_.createUploadAdapter=N=>new Hx(N,C.getToken(),r);const M=!r.config.get("ckbox.ignoreDataId"),E=r.plugins.get("ImageUploadEditing");M&&E.on("uploadComplete",(N,{imageElement:j,data:K})=>{r.model.change(dt=>{dt.setAttribute("ckboxImageId",K.ckboxImageId,j)})})})}}class Hx{constructor(r,c,u){this.loader=r,this.token=c,this.editor=u,this.controller=new AbortController,this.serviceOrigin=u.config.get("ckbox.serviceOrigin")}getWorkspaceId(){const r=(0,this.editor.t)("Cannot access default workspace."),c=this.editor.config.get("ckbox.defaultUploadWorkspaceId"),u=function(_,C){const[,M]=_.value.split("."),E=JSON.parse(atob(M)),N=E.auth&&E.auth.ckbox&&E.auth.ckbox.workspaces||[E.aud];return C?"superadmin"==(E.auth&&E.auth.ckbox&&E.auth.ckbox.role)||N.includes(C)?C:null:N[0]}(this.token,c);if(null==u)throw wt("ckbox-access-default-workspace-error"),r;return u}getAvailableCategories(r=0){return Qh(this,null,function*(){const c=new URL("categories",this.serviceOrigin);return c.searchParams.set("limit",50..toString()),c.searchParams.set("offset",r.toString()),c.searchParams.set("workspaceId",this.getWorkspaceId()),this._sendHttpRequest({url:c}).then(u=>Qh(this,null,function*(){if(u.totalCount-(r+50)>0){const _=yield this.getAvailableCategories(r+50);return[...u.items,..._]}return u.items})).catch(()=>{this.controller.signal.throwIfAborted(),wt("ckbox-fetch-category-http-error")})})}getCategoryIdForFile(r){return Qh(this,null,function*(){const c=function(M){const E=new RegExp("\\.(?[^.]+)$");return M.match(E).groups.ext.toLowerCase()}(r.name),u=yield this.getAvailableCategories();if(!u)return null;const _=this.editor.config.get("ckbox.defaultUploadCategories");if(_){const M=Object.keys(_).find(E=>_[E].find(N=>N.toLowerCase()==c));if(M){const E=u.find(N=>N.id===M||N.name===M);return E?E.id:null}}const C=u.find(M=>M.extensions.find(E=>E.toLowerCase()==c));return C?C.id:null})}upload(){return Qh(this,null,function*(){const r=this.editor.t,c=r("Cannot determine a category for the uploaded file."),u=yield this.loader.file,_=yield this.getCategoryIdForFile(u);if(!_)return Promise.reject(c);const C=new URL("assets",this.serviceOrigin),M=new FormData;return C.searchParams.set("workspaceId",this.getWorkspaceId()),M.append("categoryId",_),M.append("file",u),this._sendHttpRequest({method:"POST",url:C,data:M,onUploadProgress:N=>{N.lengthComputable&&(this.loader.uploadTotal=N.total,this.loader.uploaded=N.loaded)}}).then(N=>Qh(this,null,function*(){const j=qx(N.imageUrls);return{ckboxImageId:N.id,default:j.imageFallbackUrl,sources:j.imageSources}})).catch(()=>{const N=r("Cannot upload file:")+` ${u.name}.`;return Promise.reject(N)})})}abort(){this.controller.abort()}_sendHttpRequest({url:r,method:c="GET",data:u,onUploadProgress:_}){const C=this.controller.signal,M=new XMLHttpRequest;M.open(c,r.toString(),!0),M.setRequestHeader("Authorization",this.token.value),M.setRequestHeader("CKBox-Version","CKEditor 5"),M.responseType="json";const E=()=>{M.abort()};return new Promise((N,j)=>{C.addEventListener("abort",E),M.addEventListener("loadstart",()=>{C.addEventListener("abort",E)}),M.addEventListener("loadend",()=>{C.removeEventListener("abort",E)}),M.addEventListener("error",()=>{j()}),M.addEventListener("abort",()=>{j()}),M.addEventListener("load",()=>Qh(this,null,function*(){const K=M.response;return!K||K.statusCode>=400?j(K&&K.message):N(K)})),_&&M.upload.addEventListener("progress",K=>{_(K)}),M.send(u)})}}class K5 extends lo{static get pluginName(){return"CKBoxEditing"}static get requires(){return["CloudServices","LinkEditing","PictureEditing",Rx]}init(){return r=this,u=function*(){const _=this.editor,C=!!_.config.get("ckbox"),M=!!window.CKBox;if(!C&&!M)return;this._initConfig();const E=_.plugins.get("CloudServicesCore"),N=_.config.get("ckbox.tokenUrl");if(N===_.config.get("cloudServices.tokenUrl")){const j=_.plugins.get("CloudServices");this._token=j.token}else this._token=yield E.createToken(N).init();_.config.get("ckbox.ignoreDataId")||(this._initSchema(),this._initConversion(),this._initFixers()),M&&_.commands.add("ckbox",new nA(_))},new Promise((_,C)=>{var M=j=>{try{N(u.next(j))}catch(K){C(K)}},E=j=>{try{N(u.throw(j))}catch(K){C(K)}},N=j=>j.done?_(j.value):Promise.resolve(j.value).then(M,E);N((u=u.apply(r,null)).next())});var r,u}getToken(){return this._token}_initConfig(){const r=this.editor;if(r.config.define("ckbox",{serviceOrigin:"https://api.ckbox.io",defaultUploadCategories:null,ignoreDataId:!1,language:r.locale.uiLanguage,theme:"default",tokenUrl:r.config.get("cloudServices.tokenUrl")}),!r.config.get("ckbox.tokenUrl"))throw new at("ckbox-plugin-missing-token-url",this);r.plugins.has("ImageBlockEditing")||r.plugins.has("ImageInlineEditing")||wt("ckbox-plugin-image-feature-missing",r)}_initSchema(){const r=this.editor.model.schema;r.extend("$text",{allowAttributes:"ckboxLinkId"}),r.isRegistered("imageBlock")&&r.extend("imageBlock",{allowAttributes:["ckboxImageId","ckboxLinkId"]}),r.isRegistered("imageInline")&&r.extend("imageInline",{allowAttributes:["ckboxImageId","ckboxLinkId"]}),r.addAttributeCheck((c,u)=>{if(!c.last.getAttribute("linkHref")&&"ckboxLinkId"===u)return!1})}_initConversion(){const r=this.editor;r.conversion.for("downcast").add(c=>{c.on("attribute:ckboxLinkId:imageBlock",(u,_,C)=>{const{writer:M,mapper:E,consumable:N}=C;if(!N.consume(_.item,u.name))return;const j=[...E.toViewElement(_.item).getChildren()].find(K=>"a"===K.name);j&&(_.item.hasAttribute("ckboxLinkId")?M.setAttribute("data-ckbox-resource-id",_.item.getAttribute("ckboxLinkId"),j):M.removeAttribute("data-ckbox-resource-id",j))},{priority:"low"}),c.on("attribute:ckboxLinkId",(u,_,C)=>{const{writer:M,mapper:E,consumable:N}=C;if(N.consume(_.item,u.name)){if(_.attributeOldValue){const j=rA(M,_.attributeOldValue);M.unwrap(E.toViewRange(_.range),j)}if(_.attributeNewValue){const j=rA(M,_.attributeNewValue);_.item.is("selection")?M.wrap(M.document.selection.getFirstRange(),j):M.wrap(E.toViewRange(_.range),j)}}},{priority:"low"})}),r.conversion.for("upcast").add(c=>{c.on("element:a",(u,_,C)=>{const{writer:M,consumable:E}=C;if(!_.viewItem.getAttribute("href")||!E.consume(_.viewItem,{attributes:["data-ckbox-resource-id"]}))return;const N=_.viewItem.getAttribute("data-ckbox-resource-id");if(N)if(_.modelRange)for(let j of _.modelRange.getItems())j.is("$textProxy")&&(j=j.textNode),sA(j)&&M.setAttribute("ckboxLinkId",N,j);else M.setAttribute("ckboxLinkId",N,_.modelCursor.nodeBefore||_.modelCursor.parent)},{priority:"low"})}),r.conversion.for("downcast").attributeToAttribute({model:"ckboxImageId",view:"data-ckbox-resource-id"}),r.conversion.for("upcast").elementToAttribute({model:{key:"ckboxImageId",value:c=>c.getAttribute("data-ckbox-resource-id")},view:{attributes:{"data-ckbox-resource-id":/[\s\S]+/}}})}_initFixers(){const r=this.editor,c=r.model,u=c.document.selection;var _;c.document.registerPostFixer((_=r,C=>{let M=!1;const E=_.model,N=_.commands.get("ckbox");if(!N)return M;for(const j of E.document.differ.getChanges()){if("insert"!==j.type&&"attribute"!==j.type)continue;const K="insert"===j.type?new Li(j.position,j.position.getShiftedBy(j.length)):j.range,dt="attribute"===j.type&&"linkHref"===j.attributeKey&&null===j.attributeNewValue;for(const Dt of K.getItems()){if(dt&&Dt.hasAttribute("ckboxLinkId")){C.removeAttribute("ckboxLinkId",Dt),M=!0;continue}const me=aA(Dt,N._chosenAssets);for(const Ue of me){const qe="image"===Ue.type?"ckboxImageId":"ckboxLinkId";Ue.id!==Dt.getAttribute(qe)&&(C.setAttribute(qe,Ue.id,Dt),M=!0)}}}return M})),c.document.registerPostFixer(function(_){return C=>!(_.hasAttribute("linkHref")||!_.hasAttribute("ckboxLinkId")||(C.removeSelectionAttribute("ckboxLinkId"),0))}(u))}}function aA(m,r){const c=m.is("element","imageInline")||m.is("element","imageBlock"),u=m.hasAttribute("linkHref");return[...r].filter(_=>"image"===_.type&&c?_.attributes.imageFallbackUrl===m.getAttribute("src"):"link"===_.type&&u?_.attributes.linkHref===m.getAttribute("linkHref"):void 0)}function rA(m,r){const c=m.createAttributeElement("a",{"data-ckbox-resource-id":r},{priority:5});return m.setCustomProperty("link",!0,c),c}function sA(m){return!!m.is("$text")||!(!m.is("element","imageInline")&&!m.is("element","imageBlock"))}class zx extends lo{static get pluginName(){return"CKFinderUI"}init(){const r=this.editor,u=r.t;r.ui.componentFactory.add("ckfinder",_=>{const C=r.commands.get("ckfinder"),M=new $o(_);return M.set({label:u("Insert image or file"),icon:'',tooltip:!0}),M.bind("isEnabled").to(C),M.on("execute",()=>{r.execute("ckfinder"),r.editing.view.focus()}),M})}}class Bx extends Ua{constructor(r){super(r),this.affectsData=!1,this.stopListening(this.editor.model.document,"change"),this.listenTo(this.editor.model.document,"change",()=>this.refresh(),{priority:"low"})}refresh(){const r=this.editor.commands.get("insertImage"),c=this.editor.commands.get("link");this.isEnabled=r.isEnabled||c.isEnabled}execute(){const r=this.editor,c=this.editor.config.get("ckfinder.openerMethod")||"modal";if("popup"!=c&&"modal"!=c)throw new at("ckfinder-unknown-openermethod",r);const u=this.editor.config.get("ckfinder.options")||{};u.chooseFiles=!0;const _=u.onInit;u.language||(u.language=r.locale.uiLanguage),u.onInit=C=>{_&&_(C),C.on("files:choose",M=>{const E=M.data.files.toArray(),N=E.filter(dt=>!dt.isImage()),j=E.filter(dt=>dt.isImage());for(const dt of N)r.execute("link",dt.getUrl());const K=[];for(const dt of j){const Dt=dt.getUrl();K.push(Dt||C.request("file:getProxyUrl",{file:dt}))}K.length&&X5(r,K)}),C.on("file:choose:resizedImage",M=>{const E=M.data.resizedUrl;if(E)X5(r,[E]);else{const N=r.plugins.get("Notification"),j=r.locale.t;N.showWarning(j("Could not obtain resized image URL."),{title:j("Selecting resized image failed"),namespace:"ckfinder"})}})},window.CKFinder[c](u)}}function X5(m,r){if(m.commands.get("insertImage").isEnabled)m.execute("insertImage",{source:r});else{const c=m.plugins.get("Notification"),u=m.locale.t;c.showWarning(u("Could not insert image at the current position."),{title:u("Inserting image failed"),namespace:"ckfinder"})}}class Yx extends lo{static get pluginName(){return"CKFinderEditing"}static get requires(){return[u2,"LinkEditing"]}init(){const r=this.editor;if(!r.plugins.has("ImageBlockEditing")&&!r.plugins.has("ImageInlineEditing"))throw new at("ckfinder-missing-image-plugin",r);r.commands.add("ckfinder",new Bx(r))}}class cA extends lo{static get pluginName(){return"CloudServicesUploadAdapter"}static get requires(){return["CloudServices",ip]}init(){const r=this.editor,c=r.plugins.get("CloudServices"),u=c.token,_=c.uploadUrl;if(!u)return;const C=r.plugins.get("CloudServicesCore");this._uploadGateway=C.createUploadGateway(u,_),r.plugins.get(ip).createUploadAdapter=M=>new lA(this._uploadGateway,M)}}class lA{constructor(r,c){this.uploadGateway=r,this.loader=c}upload(){return this.loader.file.then(r=>(this.fileUploader=this.uploadGateway.upload(r),this.fileUploader.on("progress",(c,u)=>{this.loader.uploadTotal=u.total,this.loader.uploaded=u.uploaded}),this.fileUploader.send()))}abort(){this.fileUploader.abort()}}class tb extends Ua{constructor(r){super(r),this._isEnabledBasedOnSelection=!1}refresh(){const r=this.editor.model,c=os(r.document.selection.getSelectedBlocks());this.value=!!c&&c.is("element","paragraph"),this.isEnabled=!!c&&Vx(c,r.schema)}execute(r={}){const c=this.editor.model,_=r.selection||c.document.selection;c.canEditAt(_)&&c.change(C=>{const M=_.getSelectedBlocks();for(const E of M)!E.is("element","paragraph")&&Vx(E,c.schema)&&C.rename(E,"paragraph")})}}function Vx(m,r){return r.checkChild(m.parent,"paragraph")&&!r.isObject(m)}class uA extends Ua{constructor(r){super(r),this._isEnabledBasedOnSelection=!1}execute(r){const c=this.editor.model,u=r.attributes;let _=r.position;c.canEditAt(_)&&c.change(C=>{if(_=this._findPositionToInsertParagraph(_,C),!_)return;const M=C.createElement("paragraph");u&&c.schema.setAllowedAttributes(M,u,C),c.insertContent(M,_),C.setSelection(M,"in")})}_findPositionToInsertParagraph(r,c){const u=this.editor.model;if(u.schema.checkChild(r,"paragraph"))return r;const _=u.schema.findAllowedParent(r,"paragraph");if(!_)return null;const C=r.parent,M=u.schema.checkChild(C,"$text");return C.isEmpty||M&&r.isAtEnd?u.createPositionAfter(C):!C.isEmpty&&M&&r.isAtStart?u.createPositionBefore(C):c.split(r,_).position}}const eb=class extends lo{static get pluginName(){return"Paragraph"}init(){const m=this.editor,r=m.model;m.commands.add("paragraph",new tb(m)),m.commands.add("insertParagraph",new uA(m)),r.schema.register("paragraph",{inheritAllFrom:"$block"}),m.conversion.elementToElement({model:"paragraph",view:"p"}),m.conversion.for("upcast").elementToElement({model:(c,{writer:u})=>eb.paragraphLikeElements.has(c.name)?c.isEmpty?null:u.createElement("paragraph"):null,view:/.+/,converterPriority:"low"})}};let nb=eb;nb.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]);class h2 extends Ua{constructor(r,c){super(r),this.modelElements=c}refresh(){const r=os(this.editor.model.document.selection.getSelectedBlocks());this.value=!!r&&this.modelElements.includes(r.name)&&r.name,this.isEnabled=!!r&&this.modelElements.some(c=>j4(r,c,this.editor.model.schema))}execute(r){const c=this.editor.model,u=c.document,_=r.value;c.change(C=>{const M=Array.from(u.selection.getSelectedBlocks()).filter(E=>j4(E,_,c.schema));for(const E of M)E.is("element",_)||C.rename(E,_)})}}function j4(m,r,c){return c.checkChild(m.parent,r)&&!c.isObject(m)}const ib="paragraph";class ob extends lo{static get pluginName(){return"HeadingEditing"}constructor(r){super(r),r.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[nb]}init(){const r=this.editor,c=r.config.get("heading.options"),u=[];for(const _ of c)"paragraph"!==_.model&&(r.model.schema.register(_.model,{inheritAllFrom:"$block"}),r.conversion.elementToElement(_),u.push(_.model));this._addDefaultH1Conversion(r),r.commands.add("heading",new h2(r,u))}afterInit(){const r=this.editor,c=r.commands.get("enter"),u=r.config.get("heading.options");c&&this.listenTo(c,"afterExecute",(_,C)=>{const M=r.model.document.selection.getFirstPosition().parent;u.some(E=>M.is("element",E.model))&&!M.is("element",ib)&&0===M.childCount&&C.writer.rename(M,ib)})}_addDefaultH1Conversion(r){r.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:St.low+1})}}var ab=v(8733);Fo()(ab.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});class Jx extends lo{static get pluginName(){return"HeadingUI"}init(){const r=this.editor,c=r.t,u=function(M){const E=M.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 M.config.get("heading.options").map(j=>{const K=N[j.title];return K&&K!=j.title&&(j.title=K),j})}(r),_=c("Choose heading"),C=c("Heading");r.ui.componentFactory.add("heading",M=>{const E={},N=new ec,j=r.commands.get("heading"),K=r.commands.get("paragraph"),dt=[j];for(const me of u){const Ue={type:"button",model:new M4({label:me.title,class:me.class,role:"menuitemradio",withText:!0})};"paragraph"===me.model?(Ue.model.bind("isOn").to(K,"value"),Ue.model.set("commandName","paragraph"),dt.push(K)):(Ue.model.bind("isOn").to(j,"value",qe=>qe===me.model),Ue.model.set({commandName:"heading",commandValue:me.model})),N.add(Ue),E[me.model]=me.title}const Dt=Op(M);return t1(Dt,N,{ariaLabel:C,role:"menu"}),Dt.buttonView.set({ariaLabel:C,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:C}),Dt.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),Dt.bind("isEnabled").toMany(dt,"isEnabled",(...me)=>me.some(Ue=>Ue)),Dt.buttonView.bind("label").to(j,"value",K,"value",(me,Ue)=>{const qe=me||Ue&&"paragraph";return"boolean"==typeof qe?_:E[qe]?E[qe]:_}),this.listenTo(Dt,"execute",me=>{const{commandName:Ue,commandValue:qe}=me.source;r.execute(Ue,qe?{value:qe}:void 0),r.editing.view.focus()}),Dt})}}function Gx(m){return m.createContainerElement("figure",{class:"image"},[m.createEmptyElement("img"),m.createSlot("children")])}function dA(m,r){const c=m.plugins.get("ImageUtils"),u=m.plugins.has("ImageInlineEditing")&&m.plugins.has("ImageBlockEditing");return C=>c.isInlineImageView(C)?u&&("block"==C.getStyle("display")||C.findAncestor(c.isBlockImageView)?"imageBlock":"imageInline")!==r?null:function _(C){const M={name:!0};return C.hasAttribute("src")&&(M.attributes=["src"]),M}(C):null}function J4(m,r){const c=os(r.getSelectedBlocks());return!c||m.isObject(c)||c.isEmpty&&"listItem"!=c.name?"imageBlock":"imageInline"}function $0(m){return m&&m.endsWith("px")?parseInt(m):null}function rb(m){const r=$0(m.getStyle("width")),c=$0(m.getStyle("height"));return!(!r||!c)}var G4=Object.defineProperty,Qx=Object.getOwnPropertySymbols,K0=Object.prototype.hasOwnProperty,pA=Object.prototype.propertyIsEnumerable,sa=(m,r,c)=>r in m?G4(m,r,{enumerable:!0,configurable:!0,writable:!0,value:c}):m[r]=c,Pd=(m,r)=>{for(var c in r||(r={}))K0.call(r,c)&&sa(m,c,r[c]);if(Qx)for(var c of Qx(r))pA.call(r,c)&&sa(m,c,r[c]);return m};const mA=/^(image|image-inline)$/;class Sd extends lo{constructor(){super(...arguments),this._domEmitter=new(Xi())}static get pluginName(){return"ImageUtils"}isImage(r){return this.isInlineImage(r)||this.isBlockImage(r)}isInlineImageView(r){return!!r&&r.is("element","img")}isBlockImageView(r){return!!r&&r.is("element","figure")&&r.hasClass("image")}insertImage(r={},c=null,u=null,_={}){const C=this.editor,M=C.model,E=M.document.selection;u=Wh(C,c||E,u),r=Pd(Pd({},Object.fromEntries(E.getAttributes())),r);for(const N in r)M.schema.checkAttribute(u,N)||delete r[N];return M.change(N=>{const{setImageSizes:j=!0}=_,K=N.createElement(u,r);return M.insertObject(K,c,null,{setSelection:"on",findOptimalPosition:c||"imageInline"==u?void 0:"auto"}),K.parent?(j&&this.setImageNaturalSizeAttributes(K),K):null})}setImageNaturalSizeAttributes(r){const c=r.getAttribute("src");c&&(r.getAttribute("width")||r.getAttribute("height")||this.editor.model.change(u=>{const _=new Lt.window.Image;this._domEmitter.listenTo(_,"load",()=>{r.getAttribute("width")||r.getAttribute("height")||this.editor.model.enqueueChange(u.batch,C=>{C.setAttribute("width",_.naturalWidth,r),C.setAttribute("height",_.naturalHeight,r)}),this._domEmitter.stopListening(_,"load")}),_.src=c}))}getClosestSelectedImageWidget(r){const c=r.getFirstPosition();if(!c)return null;const u=r.getSelectedElement();if(u&&this.isImageWidget(u))return u;let _=c.parent;for(;_;){if(_.is("element")&&this.isImageWidget(_))return _;_=_.parent}return null}getClosestSelectedImageElement(r){const c=r.getSelectedElement();return this.isImage(c)?c:r.getFirstPosition().findAncestor("imageBlock")}getImageWidgetFromImageView(r){return r.findAncestor({classes:mA})}isImageAllowed(){const r=this.editor.model.document.selection;return function(c,u){if("imageBlock"==Wh(c,u,null)){const C=function(M,E){const j=q4(M,E).start.parent;return j.isEmpty&&!j.is("element","$root")?j.parent:j}(u,c.model);if(c.model.schema.checkChild(C,"imageBlock"))return!0}else if(c.model.schema.checkChild(u.focus,"imageInline"))return!0;return!1}(this.editor,r)&&[...r.focus.getAncestors()].every(u=>!u.is("element","imageBlock"))}toImageWidget(r,c,u){return c.setCustomProperty("image",!0,r),ep(r,c,{label:()=>{const _=this.findViewImgElement(r).getAttribute("alt");return _?`${_} ${u}`:u}})}isImageWidget(r){return!!r.getCustomProperty("image")&&El(r)}isBlockImage(r){return!!r&&r.is("element","imageBlock")}isInlineImage(r){return!!r&&r.is("element","imageInline")}findViewImgElement(r){if(this.isInlineImageView(r))return r;const c=this.editor.editing.view;for(const{item:u}of c.createRangeIn(r))if(this.isInlineImageView(u))return u}destroy(){return this._domEmitter.stopListening(),super.destroy()}}function Wh(m,r,c){const u=m.model.schema,_=m.config.get("image.insert.type");return m.plugins.has("ImageBlockEditing")?m.plugins.has("ImageInlineEditing")?c||("inline"===_?"imageInline":"block"===_?"imageBlock":r.is("selection")?J4(u,r):u.checkChild(r,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}new RegExp(String(/^(http(s)?:\/\/)?[\w-]+\.[\w.~:/[\]@!$&'()*+,;=%-]+/.source+/\.(jpg|jpeg|png|gif|ico|webp|JPG|JPEG|PNG|GIF|ICO|WEBP)/.source+/(\?[\w.~:/[\]@!$&'()*+,;=%-]*)?/.source+/(#[\w.~:/[\]@!$&'()*+,;=%-]*)?$/.source));class sb extends Ua{refresh(){const r=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!r,this.value=!(!this.isEnabled||!r.hasAttribute("alt"))&&r.getAttribute("alt")}execute(r){const c=this.editor,u=c.plugins.get("ImageUtils"),_=c.model,C=u.getClosestSelectedImageElement(_.document.selection);_.change(M=>{M.setAttribute("alt",r.newValue,C)})}}class Wx extends lo{static get requires(){return[Sd]}static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new sb(this.editor))}}var $x=v(1905);Fo()($x.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});var X0=v(6764);Fo()(X0.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});class Kx extends oa{constructor(r){super(r);const c=this.locale.t;this.focusTracker=new as,this.keystrokes=new $c,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(c("Save"),hs.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(c("Cancel"),hs.cancel,"ck-button-cancel","cancel"),this._focusables=new Ia,this._focusCycler=new dl({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),x({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach(r=>{this._focusables.add(r),this.focusTracker.add(r.element)})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(r,c,u,_){const C=new $o(this.locale);return C.set({label:r,icon:c,tooltip:!0}),C.extendTemplate({attributes:{class:u}}),_&&C.delegate("execute").to(this,_),C}_createLabeledInputView(){const r=this.locale.t,c=new Sr(this.locale,uf);return c.label=r("Text alternative"),c}}function cb(m){const r=m.editing.view,c=id.defaultPositions,u=m.plugins.get("ImageUtils");return{target:r.domConverter.mapViewToDom(u.getClosestSelectedImageWidget(r.document.selection)),positions:[c.northArrowSouth,c.northArrowSouthWest,c.northArrowSouthEast,c.southArrowNorth,c.southArrowNorthWest,c.southArrowNorthEast,c.viewportStickyNorth]}}class Xx extends lo{static get requires(){return[q0]}static get pluginName(){return"ImageTextAlternativeUI"}init(){this._createButton()}destroy(){super.destroy(),this._form&&this._form.destroy()}_createButton(){const r=this.editor,c=r.t;r.ui.componentFactory.add("imageTextAlternative",u=>{const _=r.commands.get("imageTextAlternative"),C=new $o(u);return C.set({label:c("Change image text alternative"),icon:hs.lowVision,tooltip:!0}),C.bind("isEnabled").to(_,"isEnabled"),C.bind("isOn").to(_,"value",M=>!!M),this.listenTo(C,"execute",()=>{this._showForm()}),C})}_createForm(){const r=this.editor,c=r.editing.view.document,u=r.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(A(Kx))(r.locale),this._form.render(),this.listenTo(this._form,"submit",()=>{r.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",(_,C)=>{this._hideForm(!0),C()}),this.listenTo(r.ui,"update",()=>{u.getClosestSelectedImageWidget(c.selection)?this._isVisible&&function(_){const C=_.plugins.get("ContextualBalloon");if(_.plugins.get("ImageUtils").getClosestSelectedImageWidget(_.editing.view.document.selection)){const M=cb(_);C.updatePosition(M)}}(r):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 r=this.editor,c=r.commands.get("imageTextAlternative"),u=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:cb(r)}),u.fieldView.value=u.fieldView.element.value=c.value||"",this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(r=!1){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),r&&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 Q4 extends lo{static get requires(){return[Wx,Xx]}static get pluginName(){return"ImageTextAlternative"}}function W4(m,r){const c=(u,_,C)=>{if(!C.consumable.consume(_.item,u.name))return;const M=C.writer,E=C.mapper.toViewElement(_.item),N=m.findViewImgElement(E);null===_.attributeNewValue?(M.removeAttribute("srcset",N),M.removeAttribute("sizes",N)):_.attributeNewValue&&(M.setAttribute("srcset",_.attributeNewValue,N),M.setAttribute("sizes","100vw",N))};return u=>{u.on(`attribute:srcset:${r}`,c)}}function $4(m,r,c){const u=(_,C,M)=>{if(!M.consumable.consume(C.item,_.name))return;const E=M.writer,N=M.mapper.toViewElement(C.item),j=m.findViewImgElement(N);E.setAttribute(C.attributeKey,C.attributeNewValue||"",j)};return _=>{_.on(`attribute:${c}:${r}`,u)}}class fA extends Qu{observe(r){this.listenTo(r,"load",(c,u)=>{const _=u.target;this.checkShouldIgnoreEventFromTarget(_)||"IMG"==_.tagName&&this._fireEvents(u)},{useCapture:!0})}stopObserving(r){this.stopListening(r)}_fireEvents(r){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",r))}}var ay=Object.defineProperty,t3=Object.getOwnPropertySymbols,lb=Object.prototype.hasOwnProperty,ub=Object.prototype.propertyIsEnumerable,K4=(m,r,c)=>r in m?ay(m,r,{enumerable:!0,configurable:!0,writable:!0,value:c}):m[r]=c,Kh=(m,r)=>{for(var c in r||(r={}))lb.call(r,c)&&K4(m,c,r[c]);if(t3)for(var c of t3(r))ub.call(r,c)&&K4(m,c,r[c]);return m};class db extends Ua{constructor(r){super(r);const c=r.config.get("image.insert.type");r.plugins.has("ImageBlockEditing")||"block"===c&&Zt("image-block-plugin-required"),r.plugins.has("ImageInlineEditing")||"inline"===c&&Zt("image-inline-plugin-required")}refresh(){const r=this.editor.plugins.get("ImageUtils");this.isEnabled=r.isImageAllowed()}execute(r){const c=Ss(r.source),u=this.editor.model.document.selection,_=this.editor.plugins.get("ImageUtils"),C=Object.fromEntries(u.getAttributes());c.forEach((M,E)=>{const N=u.getSelectedElement();if("string"==typeof M&&(M={src:M}),E&&N&&_.isImage(N)){const j=this.editor.model.createPositionAfter(N);_.insertImage(Kh(Kh({},M),C),j)}else _.insertImage(Kh(Kh({},M),C))})}}class hA extends Ua{refresh(){const r=this.editor.plugins.get("ImageUtils"),c=this.editor.model.document.selection.getSelectedElement();this.isEnabled=r.isImage(c),this.value=this.isEnabled?c.getAttribute("src"):null}execute(r){const c=this.editor.model.document.selection.getSelectedElement();this.editor.model.change(u=>{u.setAttribute("src",r.source,c),u.removeAttribute("srcset",c),u.removeAttribute("sizes",c)})}}class pb extends lo{static get requires(){return[Sd]}static get pluginName(){return"ImageEditing"}init(){const r=this.editor,c=r.conversion;r.editing.view.addObserver(fA),c.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:"srcset"});const u=new db(r),_=new hA(r);r.commands.add("insertImage",u),r.commands.add("replaceImageSource",_),r.commands.add("imageInsert",u)}}class mb extends lo{static get requires(){return[Sd]}static get pluginName(){return"ImageSizeAttributes"}afterInit(){this._registerSchema(),this._registerConverters("imageBlock"),this._registerConverters("imageInline")}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:["width","height"]}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:["width","height"]})}_registerConverters(r){const c=this.editor,u=c.plugins.get("ImageUtils"),_="imageBlock"===r?"figure":"img";function C(M,E,N,j){M.on(`attribute:${E}:${r}`,(K,dt,Dt)=>{if(!Dt.consumable.consume(dt.item,K.name))return;const me=Dt.writer,Ue=Dt.mapper.toViewElement(dt.item),qe=u.findViewImgElement(Ue);if(null!==dt.attributeNewValue?me.setAttribute(N,dt.attributeNewValue,qe):me.removeAttribute(N,qe),dt.item.hasAttribute("sources"))return;const pn=dt.item.hasAttribute("resizedWidth");if("imageInline"===r&&!pn&&!j)return;const Ln=dt.item.getAttribute("width"),pi=dt.item.getAttribute("height"),Ri=qe.getStyle("aspect-ratio");Ln&&pi&&!Ri&&me.setStyle("aspect-ratio",`${Ln}/${pi}`,qe)})}c.conversion.for("upcast").attributeToAttribute({view:{name:_,styles:{width:/.+/}},model:{key:"width",value:M=>rb(M)?$0(M.getStyle("width")):null}}).attributeToAttribute({view:{name:_,key:"width"},model:"width"}).attributeToAttribute({view:{name:_,styles:{height:/.+/}},model:{key:"height",value:M=>rb(M)?$0(M.getStyle("height")):null}}).attributeToAttribute({view:{name:_,key:"height"},model:"height"}),c.conversion.for("editingDowncast").add(M=>{C(M,"width","width",!0),C(M,"height","height",!0)}),c.conversion.for("dataDowncast").add(M=>{C(M,"width","width",!1),C(M,"height","height",!1)})}}class _b extends Ua{constructor(r,c){super(r),this._modelElementName=c}refresh(){const r=this.editor.plugins.get("ImageUtils"),c=r.getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled="imageBlock"===this._modelElementName?r.isInlineImage(c):r.isBlockImage(c)}execute(r={}){const u=this.editor.model,_=this.editor.plugins.get("ImageUtils"),C=_.getClosestSelectedImageElement(u.document.selection),M=Object.fromEntries(C.getAttributes());return M.src||M.uploadId?u.change(E=>{const{setImageSizes:N=!0}=r,j=Array.from(u.markers).filter(Dt=>Dt.getRange().containsItem(C)),K=_.insertImage(M,u.createSelection(C,"on"),this._modelElementName,{setImageSizes:N});if(!K)return null;const dt=E.createRangeOn(K);for(const Dt of j){const me=Dt.getRange(),Ue="$graveyard"!=me.root.rootName?me.getJoined(dt,!0):dt;E.updateMarker(Dt,{range:Ue})}return{oldElement:C,newElement:K}}):null}}class e3 extends lo{static get requires(){return[pb,mb,Sd,Np]}static get pluginName(){return"ImageBlockEditing"}init(){const r=this.editor;r.model.schema.register("imageBlock",{inheritAllFrom:"$blockObject",allowAttributes:["alt","src","srcset"]}),this._setupConversion(),r.plugins.has("ImageInlineEditing")&&(r.commands.add("imageTypeBlock",new _b(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){const r=this.editor,c=r.t,u=r.conversion,_=r.plugins.get("ImageUtils");u.for("dataDowncast").elementToStructure({model:"imageBlock",view:(C,{writer:M})=>Gx(M)}),u.for("editingDowncast").elementToStructure({model:"imageBlock",view:(C,{writer:M})=>_.toImageWidget(Gx(M),M,c("image widget"))}),u.for("downcast").add($4(_,"imageBlock","src")).add($4(_,"imageBlock","alt")).add(W4(_,"imageBlock")),u.for("upcast").elementToElement({view:dA(r,"imageBlock"),model:(C,{writer:M})=>M.createElement("imageBlock",C.hasAttribute("src")?{src:C.getAttribute("src")}:void 0)}).add(function(C){const M=(E,N,j)=>{if(!j.consumable.test(N.viewItem,{name:!0,classes:"image"}))return;const K=C.findViewImgElement(N.viewItem);if(!K||!j.consumable.test(K,{name:!0}))return;j.consumable.consume(N.viewItem,{name:!0,classes:"image"});const dt=os(j.convertItem(K,N.modelCursor).modelRange.getItems());dt?(j.convertChildren(N.viewItem,dt),j.updateConversionResult(dt,N)):j.consumable.revert(N.viewItem,{name:!0,classes:"image"})};return E=>{E.on("element:figure",M)}}(_))}_setupClipboardIntegration(){const r=this.editor,c=r.model,u=r.editing.view,_=r.plugins.get("ImageUtils"),C=r.plugins.get("ClipboardPipeline");this.listenTo(C,"inputTransformation",(M,E)=>{const N=Array.from(E.content.getChildren());let j;if(!N.every(_.isInlineImageView))return;j=E.targetRanges?r.editing.mapper.toModelRange(E.targetRanges[0]):c.document.selection.getFirstRange();const K=c.createSelection(j);if("imageBlock"===J4(c.schema,K)){const dt=new W1(u.document),Dt=N.map(me=>dt.createElement("figure",{class:"image"},me));E.content=dt.createDocumentFragment(Dt)}}),this.listenTo(C,"contentInsertion",(M,E)=>{"paste"===E.method&&c.change(N=>{const j=N.createRangeIn(E.content);for(const K of j.getItems())K.is("element","imageBlock")&&_.setImageNaturalSizeAttributes(K)})})}}var X4=v(3508);Fo()(X4.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});class tC extends lo{static get requires(){return[e3,j0,Q4]}static get pluginName(){return"ImageBlock"}}class eC extends lo{static get requires(){return[pb,mb,Sd,Np]}static get pluginName(){return"ImageInlineEditing"}init(){const r=this.editor,c=r.model.schema;c.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"]}),c.addChildCheck((u,_)=>{if(u.endsWith("caption")&&"imageInline"===_.name)return!1}),this._setupConversion(),r.plugins.has("ImageBlockEditing")&&(r.commands.add("imageTypeInline",new _b(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){const r=this.editor,c=r.t,u=r.conversion,_=r.plugins.get("ImageUtils");u.for("dataDowncast").elementToElement({model:"imageInline",view:(C,{writer:M})=>M.createEmptyElement("img")}),u.for("editingDowncast").elementToStructure({model:"imageInline",view:(C,{writer:M})=>{return _.toImageWidget((E=M).createContainerElement("span",{class:"image-inline"},E.createEmptyElement("img")),M,c("image widget"));var E}}),u.for("downcast").add($4(_,"imageInline","src")).add($4(_,"imageInline","alt")).add(W4(_,"imageInline")),u.for("upcast").elementToElement({view:dA(r,"imageInline"),model:(C,{writer:M})=>M.createElement("imageInline",C.hasAttribute("src")?{src:C.getAttribute("src")}:void 0)})}_setupClipboardIntegration(){const r=this.editor,c=r.model,u=r.editing.view,_=r.plugins.get("ImageUtils"),C=r.plugins.get("ClipboardPipeline");this.listenTo(C,"inputTransformation",(M,E)=>{const N=Array.from(E.content.getChildren());let j;if(!N.every(_.isBlockImageView))return;j=E.targetRanges?r.editing.mapper.toModelRange(E.targetRanges[0]):c.document.selection.getFirstRange();const K=c.createSelection(j);if("imageInline"===J4(c.schema,K)){const dt=new W1(u.document),Dt=N.map(me=>1===me.childCount?(Array.from(me.getAttributes()).forEach(Ue=>dt.setAttribute(...Ue,_.findViewImgElement(me))),me.getChild(0)):me);E.content=dt.createDocumentFragment(Dt)}}),this.listenTo(C,"contentInsertion",(M,E)=>{"paste"===E.method&&c.change(N=>{const j=N.createRangeIn(E.content);for(const K of j.getItems())K.is("element","imageInline")&&_.setImageNaturalSizeAttributes(K)})})}}class gA extends lo{static get requires(){return[eC,j0,Q4]}static get pluginName(){return"ImageInline"}}class n3 extends lo{static get pluginName(){return"ImageCaptionUtils"}static get requires(){return[Sd]}getCaptionFromImageModelElement(r){for(const c of r.getChildren())if(c&&c.is("element","caption"))return c;return null}getCaptionFromModelSelection(r){const c=this.editor.plugins.get("ImageUtils"),u=r.getFirstPosition().findAncestor("caption");return u&&c.isBlockImage(u.parent)?u:null}matchImageCaptionViewElement(r){const c=this.editor.plugins.get("ImageUtils");return"figcaption"==r.name&&c.isBlockImageView(r.parent)?{name:!0}:null}}class nC extends Ua{refresh(){const r=this.editor,c=r.plugins.get("ImageCaptionUtils"),u=r.plugins.get("ImageUtils");if(!r.plugins.has(e3))return this.isEnabled=!1,void(this.value=!1);const _=r.model.document.selection,C=_.getSelectedElement();if(!C){const M=c.getCaptionFromModelSelection(_);return this.isEnabled=!!M,void(this.value=!!M)}this.isEnabled=u.isImage(C),this.value=!!this.isEnabled&&!!c.getCaptionFromImageModelElement(C)}execute(r={}){const{focusCaptionOnShow:c}=r;this.editor.model.change(u=>{this.value?this._hideImageCaption(u):this._showImageCaption(u,c)})}_showImageCaption(r,c){const u=this.editor.model.document.selection,_=this.editor.plugins.get("ImageCaptionEditing"),C=this.editor.plugins.get("ImageUtils");let M=u.getSelectedElement();const E=_._getSavedCaption(M);C.isInlineImage(M)&&(this.editor.execute("imageTypeBlock"),M=u.getSelectedElement());const N=E||r.createElement("caption");r.append(N,M),c&&r.setSelection(N,"in")}_hideImageCaption(r){const c=this.editor,u=c.model.document.selection,_=c.plugins.get("ImageCaptionEditing"),C=c.plugins.get("ImageCaptionUtils");let M,E=u.getSelectedElement();E?M=C.getCaptionFromImageModelElement(E):(M=C.getCaptionFromModelSelection(u),E=M.parent),_._saveCaption(E,M),r.setSelection(E,"on"),r.remove(M)}}class bA extends lo{constructor(r){super(r),this._savedCaptionsMap=new WeakMap}static get requires(){return[Sd,n3]}static get pluginName(){return"ImageCaptionEditing"}init(){const r=this.editor,c=r.model.schema;c.isRegistered("caption")?c.extend("caption",{allowIn:"imageBlock"}):c.register("caption",{allowIn:"imageBlock",allowContentOf:"$block",isLimit:!0}),r.commands.add("toggleImageCaption",new nC(this.editor)),this._setupConversion(),this._setupImageTypeCommandsIntegration(),this._registerCaptionReconversion()}_setupConversion(){const r=this.editor,c=r.editing.view,u=r.plugins.get("ImageUtils"),_=r.plugins.get("ImageCaptionUtils"),C=r.t;r.conversion.for("upcast").elementToElement({view:M=>_.matchImageCaptionViewElement(M),model:"caption"}),r.conversion.for("dataDowncast").elementToElement({model:"caption",view:(M,{writer:E})=>u.isBlockImage(M.parent)?E.createContainerElement("figcaption"):null}),r.conversion.for("editingDowncast").elementToElement({model:"caption",view:(M,{writer:E})=>{if(!u.isBlockImage(M.parent))return null;const N=E.createEditableElement("figcaption");E.setCustomProperty("imageCaption",!0,N),N.placeholder=C("Enter image caption"),B({view:c,element:N,keepOnFocus:!0});const j=M.parent.getAttribute("alt");return S5(N,E,{label:j?C("Caption for image: %0",[j]):C("Caption for the image")})}})}_setupImageTypeCommandsIntegration(){const r=this.editor,c=r.plugins.get("ImageUtils"),u=r.plugins.get("ImageCaptionUtils"),_=r.commands.get("imageTypeInline"),C=r.commands.get("imageTypeBlock"),M=E=>{if(!E.return)return;const{oldElement:N,newElement:j}=E.return;if(!N)return;if(c.isBlockImage(N)){const dt=u.getCaptionFromImageModelElement(N);if(dt)return void this._saveCaption(j,dt)}const K=this._getSavedCaption(N);K&&this._saveCaption(j,K)};_&&this.listenTo(_,"execute",M,{priority:"low"}),C&&this.listenTo(C,"execute",M,{priority:"low"})}_getSavedCaption(r){const c=this._savedCaptionsMap.get(r);return c?Jr.fromJSON(c):null}_saveCaption(r,c){this._savedCaptionsMap.set(r,c.toJSON())}_registerCaptionReconversion(){const r=this.editor,c=r.model,u=r.plugins.get("ImageUtils"),_=r.plugins.get("ImageCaptionUtils");c.document.on("change:data",()=>{const C=c.document.differ.getChanges();for(const M of C){if("alt"!==M.attributeKey)continue;const E=M.range.start.nodeAfter;if(u.isBlockImage(E)){const N=_.getCaptionFromImageModelElement(E);if(!N)return;r.editing.reconvertItem(N)}}})}}class hb extends lo{static get requires(){return[n3]}static get pluginName(){return"ImageCaptionUI"}init(){const r=this.editor,c=r.editing.view,u=r.plugins.get("ImageCaptionUtils"),_=r.t;r.ui.componentFactory.add("toggleImageCaption",C=>{const M=r.commands.get("toggleImageCaption"),E=new $o(C);return E.set({icon:hs.caption,tooltip:!0,isToggleable:!0}),E.bind("isOn","isEnabled").to(M,"value","isEnabled"),E.bind("label").to(M,"value",N=>_(N?"Toggle caption off":"Toggle caption on")),this.listenTo(E,"execute",()=>{r.execute("toggleImageCaption",{focusCaptionOnShow:!0});const N=u.getCaptionFromModelSelection(r.model.document.selection);if(N){const j=r.editing.mapper.toViewElement(N);c.scrollToTheSelection(),c.change(K=>{K.addClass("image__caption_highlighted",j)})}r.editing.view.focus()}),E})}}var gb=v(2640);function Af(m){const r=m.map(c=>c.replace("+","\\+"));return new RegExp(`^image\\/(${r.join("|")})$`)}function vA(m){return new Promise((r,c)=>{const u=m.getAttribute("src");fetch(u).then(_=>_.blob()).then(_=>{const C=iC(_,u),M=C.replace("image/",""),E=new File([_],`image.${M}`,{type:C});r(E)}).catch(_=>{return _&&"TypeError"===_.name?(C=u,(M=C,new Promise((E,N)=>{const j=Lt.document.createElement("img");j.addEventListener("load",()=>{const K=Lt.document.createElement("canvas");K.width=j.width,K.height=j.height,K.getContext("2d").drawImage(j,0,0),K.toBlob(dt=>dt?E(dt):N())}),j.addEventListener("error",()=>N()),j.src=M})).then(M=>{const E=iC(M,C),N=E.replace("image/","");return new File([M],`image.${N}`,{type:E})})).then(r).catch(c):c(_);var C,M})})}function iC(m,r){return m.type?m.type:r.match(/data:(image\/\w+);base64/)?r.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}Fo()(gb.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});class bb extends lo{static get pluginName(){return"ImageUploadUI"}init(){const r=this.editor,c=r.t,u=_=>{const C=new Ox(_),M=r.commands.get("uploadImage"),E=r.config.get("image.upload.types"),N=Af(E);return C.set({acceptedType:E.map(j=>`image/${j}`).join(","),allowMultipleFiles:!0}),C.buttonView.set({label:c("Insert image"),icon:hs.image,tooltip:!0}),C.buttonView.bind("isEnabled").to(M),C.on("done",(j,K)=>{const dt=Array.from(K).filter(Dt=>N.test(Dt.type));dt.length&&(r.execute("uploadImage",{file:dt}),r.editing.view.focus())}),C};r.ui.componentFactory.add("uploadImage",u),r.ui.componentFactory.add("imageUpload",u)}}var xA=v(3689);Fo()(xA.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});var vb=v(4036);Fo()(vb.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});var xb=v(3773);Fo()(xb.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});class CA extends lo{constructor(r){super(r),this.uploadStatusChange=(c,u,_)=>{const C=this.editor,M=u.item,E=M.getAttribute("uploadId");if(!_.consumable.consume(u.item,c.name))return;const N=C.plugins.get("ImageUtils"),j=C.plugins.get(ip),K=E?u.attributeNewValue:null,dt=this.placeholder,Dt=C.editing.mapper.toViewElement(M),me=_.writer;if("reading"==K)return Cb(Dt,me),void aC(N,dt,Dt,me);if("uploading"==K){const Ue=j.loaders.get(E);return Cb(Dt,me),void(Ue?(rC(Dt,me),function(qe,pn,Ln,pi){const Ri=function(Go){const ka=Go.createUIElement("div",{class:"ck-progress-bar"});return Go.setCustomProperty("progressBar",!0,ka),ka}(pn);pn.insert(pn.createPositionAt(qe,"end"),Ri),Ln.on("change:uploadedPercent",(Go,ka,Ts)=>{pi.change($r=>{$r.setStyle("width",Ts+"%",Ri)})})}(Dt,me,Ue,C.editing.view),function(qe,pn,Ln,pi){if(pi.data){const Ri=qe.findViewImgElement(pn);Ln.setAttribute("src",pi.data,Ri)}}(N,Dt,me,Ue)):aC(N,dt,Dt,me))}"complete"==K&&j.loaders.get(E)&&function(Ue,qe,pn){const Ln=qe.createUIElement("div",{class:"ck-image-upload-complete-icon"});qe.insert(qe.createPositionAt(Ue,"end"),Ln),setTimeout(()=>{pn.change(pi=>pi.remove(pi.createRangeOn(Ln)))},3e3)}(Dt,me,C.editing.view),i3(Dt,me,"progressBar"),rC(Dt,me),me.removeClass("ck-appear",Dt)},this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}static get pluginName(){return"ImageUploadProgress"}init(){const r=this.editor;r.plugins.has("ImageBlockEditing")&&r.editing.downcastDispatcher.on("attribute:uploadStatus:imageBlock",this.uploadStatusChange),r.plugins.has("ImageInlineEditing")&&r.editing.downcastDispatcher.on("attribute:uploadStatus:imageInline",this.uploadStatusChange)}}function Cb(m,r){m.hasClass("ck-appear")||r.addClass("ck-appear",m)}function aC(m,r,c,u){c.hasClass("ck-image-upload-placeholder")||u.addClass("ck-image-upload-placeholder",c);const _=m.findViewImgElement(c);_.getAttribute("src")!==r&&u.setAttribute("src",r,_),sC(c,"placeholder")||u.insert(u.createPositionAfter(_),function(C){const M=C.createUIElement("div",{class:"ck-upload-placeholder-loader"});return C.setCustomProperty("placeholder",!0,M),M}(u))}function rC(m,r){m.hasClass("ck-image-upload-placeholder")&&r.removeClass("ck-image-upload-placeholder",m),i3(m,r,"placeholder")}function sC(m,r){for(const c of m.getChildren())if(c.getCustomProperty(r))return c}function i3(m,r,c){const u=sC(m,c);u&&r.remove(r.createRangeOn(u))}var cC=Object.defineProperty,lC=Object.defineProperties,e6=Object.getOwnPropertyDescriptors,n6=Object.getOwnPropertySymbols,ry=Object.prototype.hasOwnProperty,Ab=Object.prototype.propertyIsEnumerable,uC=(m,r,c)=>r in m?cC(m,r,{enumerable:!0,configurable:!0,writable:!0,value:c}):m[r]=c;class dC extends Ua{refresh(){const r=this.editor,c=r.plugins.get("ImageUtils"),u=r.model.document.selection.getSelectedElement();this.isEnabled=c.isImageAllowed()||c.isImage(u)}execute(r){const c=Ss(r.file),u=this.editor.model.document.selection,_=this.editor.plugins.get("ImageUtils"),C=Object.fromEntries(u.getAttributes());c.forEach((M,E)=>{const N=u.getSelectedElement();if(E&&N&&_.isImage(N)){const j=this.editor.model.createPositionAfter(N);this._uploadImage(M,C,j)}else this._uploadImage(M,C)})}_uploadImage(r,c,u){const _=this.editor,C=_.plugins.get(ip).createLoader(r),M=_.plugins.get("ImageUtils");var E;C&&M.insertImage((E=((j,K)=>{for(var dt in K||(K={}))ry.call(K,dt)&&uC(j,dt,K[dt]);if(n6)for(var dt of n6(K))Ab.call(K,dt)&&uC(j,dt,K[dt]);return j})({},c),lC(E,e6({uploadId:C.id}))),u)}}class yf extends lo{constructor(r){super(r),r.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}static get requires(){return[ip,u2,Np,Sd]}static get pluginName(){return"ImageUploadEditing"}init(){const r=this.editor,c=r.model.document,u=r.conversion,_=r.plugins.get(ip),C=r.plugins.get("ImageUtils"),M=r.plugins.get("ClipboardPipeline"),E=Af(r.config.get("image.upload.types")),N=new dC(r);r.commands.add("uploadImage",N),r.commands.add("imageUpload",N),u.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(r.editing.view.document,"clipboardInput",(j,K)=>{if(dt=K.dataTransfer,Array.from(dt.types).includes("text/html")&&""!==dt.getData("text/html"))return;var dt;const Dt=Array.from(K.dataTransfer.files).filter(me=>!!me&&E.test(me.type));Dt.length&&(j.stop(),r.model.change(me=>{K.targetRanges&&me.setSelection(K.targetRanges.map(Ue=>r.editing.mapper.toModelRange(Ue))),r.execute("uploadImage",{file:Dt})}))}),this.listenTo(M,"inputTransformation",(j,K)=>{const dt=Array.from(r.editing.view.createRangeIn(K.content)).map(me=>me.item).filter(me=>{return!(!C.isInlineImageView(qe=me)||!qe.getAttribute("src")||!qe.getAttribute("src").match(/^data:image\/\w+;base64,/g)&&!qe.getAttribute("src").match(/^blob:/g)||me.getAttribute("uploadProcessed"));var qe}).map(me=>({promise:vA(me),imageElement:me}));if(!dt.length)return;const Dt=new W1(r.editing.view.document);for(const me of dt){Dt.setAttribute("uploadProcessed",!0,me.imageElement);const Ue=_.createLoader(me.promise);Ue&&(Dt.setAttribute("src","",me.imageElement),Dt.setAttribute("uploadId",Ue.id,me.imageElement))}}),r.editing.view.document.on("dragover",(j,K)=>{K.preventDefault()}),c.on("change",()=>{const j=c.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),K=new Set;for(const dt of j)if("insert"==dt.type&&"$text"!=dt.name){const Dt=dt.position.nodeAfter,me="$graveyard"==dt.position.root.rootName;for(const Ue of AA(r,Dt)){const qe=Ue.getAttribute("uploadId");if(!qe)continue;const pn=_.loaders.get(qe);pn&&(me?K.has(qe)||pn.abort():(K.add(qe),this._uploadImageElements.set(qe,Ue),"idle"==pn.status&&this._readAndUpload(pn)))}}}),this.on("uploadComplete",(j,{imageElement:K,data:dt})=>{const Dt=dt.urls?dt.urls:dt;this.editor.model.change(me=>{me.setAttribute("src",Dt.default,K),this._parseAndSetSrcsetAttributeOnImage(Dt,K,me),C.setImageNaturalSizeAttributes(K)})},{priority:"low"})}afterInit(){const r=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&r.extend("imageBlock",{allowAttributes:["uploadId","uploadStatus"]}),this.editor.plugins.has("ImageInlineEditing")&&r.extend("imageInline",{allowAttributes:["uploadId","uploadStatus"]})}_readAndUpload(r){const c=this.editor,u=c.model,_=c.locale.t,C=c.plugins.get(ip),M=c.plugins.get(u2),E=c.plugins.get("ImageUtils"),N=this._uploadImageElements;return u.enqueueChange({isUndoable:!1},K=>{K.setAttribute("uploadStatus","reading",N.get(r.id))}),r.read().then(()=>{const K=r.upload(),dt=N.get(r.id);if(D_isSafari){const Dt=c.editing.mapper.toViewElement(dt),me=E.findViewImgElement(Dt);c.editing.view.once("render",()=>{if(!me.parent)return;const Ue=c.editing.view.domConverter.mapViewToDom(me.parent);if(!Ue)return;const qe=Ue.style.display;Ue.style.display="none",Ue._ckHack=Ue.offsetHeight,Ue.style.display=qe})}return u.enqueueChange({isUndoable:!1},Dt=>{Dt.setAttribute("uploadStatus","uploading",dt)}),K}).then(K=>{u.enqueueChange({isUndoable:!1},dt=>{const Dt=N.get(r.id);dt.setAttribute("uploadStatus","complete",Dt),this.fire("uploadComplete",{data:K,imageElement:Dt})}),j()}).catch(K=>{if("error"!==r.status&&"aborted"!==r.status)throw K;"error"==r.status&&K&&M.showWarning(K,{title:_("Upload failed"),namespace:"upload"}),u.enqueueChange({isUndoable:!1},dt=>{dt.remove(N.get(r.id))}),j()});function j(){u.enqueueChange({isUndoable:!1},K=>{const dt=N.get(r.id);K.removeAttribute("uploadId",dt),K.removeAttribute("uploadStatus",dt),N.delete(r.id)}),C.destroyLoader(r)}}_parseAndSetSrcsetAttributeOnImage(r,c,u){let _=0;const C=Object.keys(r).filter(M=>{const E=parseInt(M,10);if(!isNaN(E))return _=Math.max(_,E),!0}).map(M=>`${r[M]} ${M}w`).join(", ");if(""!=C){const M={srcset:C};c.hasAttribute("width")||c.hasAttribute("height")||(M.width=_),u.setAttributes(M,c)}}}function AA(m,r){const c=m.plugins.get("ImageUtils");return Array.from(m.model.createRangeOn(r)).filter(u=>c.isImage(u.item)).map(u=>u.item)}var o3=v(1568);Fo()(o3.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});var pC=v(3535);Fo()(pC.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});var yA=v(6270);Fo()(yA.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});class wA extends Ua{constructor(r,c){super(r),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(c.map(u=>{if(u.isDefault)for(const _ of u.modelElements)this._defaultStyles[_]=u.name;return[u.name,u]}))}refresh(){const r=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!r,this.value=!!this.isEnabled&&(r.hasAttribute("imageStyle")?r.getAttribute("imageStyle"):this._defaultStyles[r.name])}execute(r={}){const c=this.editor,u=c.model,_=c.plugins.get("ImageUtils");u.change(C=>{const M=r.value,{setImageSizes:E=!0}=r;let N=_.getClosestSelectedImageElement(u.document.selection);M&&this.shouldConvertImageType(M,N)&&(this.editor.execute(_.isBlockImage(N)?"imageTypeInline":"imageTypeBlock",{setImageSizes:E}),N=_.getClosestSelectedImageElement(u.document.selection)),!M||this._styles.get(M).isDefault?C.removeAttribute("imageStyle",N):C.setAttribute("imageStyle",M,N),E&&_.setImageNaturalSizeAttributes(N)})}shouldConvertImageType(r,c){return!this._styles.get(r).modelElements.includes(c.name)}}var UA=Object.defineProperty,Tb=Object.getOwnPropertySymbols,wb=Object.prototype.hasOwnProperty,ZA=Object.prototype.propertyIsEnumerable,i6=(m,r,c)=>r in m?UA(m,r,{enumerable:!0,configurable:!0,writable:!0,value:c}):m[r]=c,Ub=(m,r)=>{for(var c in r||(r={}))wb.call(r,c)&&i6(m,c,r[c]);if(Tb)for(var c of Tb(r))ZA.call(r,c)&&i6(m,c,r[c]);return m};const{objectFullWidth:o6,objectInline:mC,objectLeft:Zb,objectRight:Mb,objectCenter:a3,objectBlockLeft:kb,objectBlockRight:Db}=hs,tg={get inline(){return{name:"inline",title:"In line",icon:mC,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:Zb,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:kb,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:a3,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:Mb,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:Db,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:a3,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:Mb,modelElements:["imageBlock"],className:"image-style-side"}}},Pb={full:o6,left:kb,right:Db,center:a3,inlineLeft:Zb,inlineRight:Mb,inline:mC},_C=[{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 MA(m){Zt("image-style-configuration-definition-invalid",m)}const r3={normalizeStyles:function(m){return(m.configuredStyles.options||[]).map(r=>{return"string"==typeof(c="string"==typeof(c=r)?tg[c]?Ub({},tg[c]):{name:c}:function(u,_){const C=Ub({},_);for(const M in u)Object.prototype.hasOwnProperty.call(_,M)||(C[M]=u[M]);return C}(tg[c.name],c)).icon&&(c.icon=Pb[c.icon]||c.icon),c;var c}).filter(r=>function(c,{isBlockPluginLoaded:u,isInlinePluginLoaded:_}){const{modelElements:C,name:M}=c;if(!(C&&C.length&&M))return MA({style:c}),!1;{const E=[u?"imageBlock":null,_?"imageInline":null];if(!C.some(N=>E.includes(N)))return Zt("image-style-missing-dependency",{style:c,missingPlugins:C.map(N=>"imageBlock"===N?"ImageBlockEditing":"ImageInlineEditing")}),!1}return!0}(r,m))},getDefaultStylesConfiguration:function(m,r){return m&&r?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:m?{options:["block","side"]}:r?{options:["inline","alignLeft","alignRight"]}:{}},getDefaultDropdownDefinitions:function(m){return m.has("ImageBlockEditing")&&m.has("ImageInlineEditing")?[..._C]:[]},warnInvalidStyle:MA,DEFAULT_OPTIONS:tg,DEFAULT_ICONS:Pb,DEFAULT_DROPDOWN_DEFINITIONS:_C};function kA(m,r){for(const c of r)if(c.name===m)return c}class fC extends lo{static get pluginName(){return"ImageStyleEditing"}static get requires(){return[Sd]}init(){const{normalizeStyles:r,getDefaultStylesConfiguration:c}=r3,u=this.editor,_=u.plugins.has("ImageBlockEditing"),C=u.plugins.has("ImageInlineEditing");u.config.define("image.styles",c(_,C)),this.normalizedStyles=r({configuredStyles:u.config.get("image.styles"),isBlockPluginLoaded:_,isInlinePluginLoaded:C}),this._setupConversion(_,C),this._setupPostFixer(),u.commands.add("imageStyle",new wA(u,this.normalizedStyles))}_setupConversion(r,c){const u=this.editor,_=u.model.schema,C=(M=this.normalizedStyles,(N,j,K)=>{if(!K.consumable.consume(j.item,N.name))return;const dt=kA(j.attributeNewValue,M),Dt=kA(j.attributeOldValue,M),me=K.mapper.toViewElement(j.item),Ue=K.writer;Dt&&Ue.removeClass(Dt.className,me),dt&&Ue.addClass(dt.className,me)});var M;const E=function(N){const j={imageInline:N.filter(K=>!K.isDefault&&K.modelElements.includes("imageInline")),imageBlock:N.filter(K=>!K.isDefault&&K.modelElements.includes("imageBlock"))};return(K,dt,Dt)=>{if(!dt.modelRange)return;const me=dt.viewItem,Ue=os(dt.modelRange.getItems());if(Ue&&Dt.schema.checkAttribute(Ue,"imageStyle"))for(const qe of j[Ue.name])Dt.consumable.consume(me,{classes:qe.className})&&Dt.writer.setAttribute("imageStyle",qe.name,Ue)}}(this.normalizedStyles);u.editing.downcastDispatcher.on("attribute:imageStyle",C),u.data.downcastDispatcher.on("attribute:imageStyle",C),r&&(_.extend("imageBlock",{allowAttributes:"imageStyle"}),u.data.upcastDispatcher.on("element:figure",E,{priority:"low"})),c&&(_.extend("imageInline",{allowAttributes:"imageStyle"}),u.data.upcastDispatcher.on("element:img",E,{priority:"low"}))}_setupPostFixer(){const r=this.editor,c=r.model.document,u=r.plugins.get(Sd),_=new Map(this.normalizedStyles.map(C=>[C.name,C]));c.registerPostFixer(C=>{let M=!1;for(const E of c.differ.getChanges())if("insert"==E.type||"attribute"==E.type&&"imageStyle"==E.attributeKey){let N="insert"==E.type?E.position.nodeAfter:E.range.start.nodeAfter;if(N&&N.is("element","paragraph")&&N.childCount>0&&(N=N.getChild(0)),!u.isImage(N))continue;const j=N.getAttribute("imageStyle");if(!j)continue;const K=_.get(j);K&&K.modelElements.includes(N.name)||(C.removeAttribute("imageStyle",N),M=!0)}return M})}}var DA=v(5083);Fo()(DA.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});class cy extends lo{static get requires(){return[fC]}static get pluginName(){return"ImageStyleUI"}get localizedDefaultStylesTitles(){const r=this.editor.t;return{"Wrap text":r("Wrap text"),"Break text":r("Break text"),"In line":r("In line"),"Full size image":r("Full size image"),"Side image":r("Side image"),"Left aligned image":r("Left aligned image"),"Centered image":r("Centered image"),"Right aligned image":r("Right aligned image")}}init(){const r=this.editor.plugins,c=this.editor.config.get("image.toolbar")||[],u=PA(r.get("ImageStyleEditing").normalizedStyles,this.localizedDefaultStylesTitles);for(const C of u)this._createButton(C);const _=PA([...c.filter(Kt),...r3.getDefaultDropdownDefinitions(r)],this.localizedDefaultStylesTitles);for(const C of _)this._createDropdown(C,u)}_createDropdown(r,c){const u=this.editor.ui.componentFactory;u.add(r.name,_=>{let C;const{defaultItem:M,items:E,title:N}=r,j=E.filter(me=>c.find(({name:Ue})=>SA(Ue)===me)).map(me=>{const Ue=u.create(me);return me===M&&(C=Ue),Ue});E.length!==j.length&&r3.warnInvalidStyle({dropdown:r});const K=Op(_,m4),dt=K.buttonView,Dt=dt.arrowView;return e_(K,j,{enableActiveItemFocusOnDropdownOpen:!0}),dt.set({label:LA(N,C.label),class:null,tooltip:!0}),Dt.unbind("label"),Dt.set({label:N}),dt.bind("icon").toMany(j,"isOn",(...me)=>{const Ue=me.findIndex(ku);return Ue<0?C.icon:j[Ue].icon}),dt.bind("label").toMany(j,"isOn",(...me)=>{const Ue=me.findIndex(ku);return LA(N,Ue<0?C.label:j[Ue].label)}),dt.bind("isOn").toMany(j,"isOn",(...me)=>me.some(ku)),dt.bind("class").toMany(j,"isOn",(...me)=>me.some(ku)?"ck-splitbutton_flatten":void 0),dt.on("execute",()=>{j.some(({isOn:me})=>me)?K.isOpen=!K.isOpen:C.fire("execute")}),K.bind("isEnabled").toMany(j,"isEnabled",(...me)=>me.some(ku)),this.listenTo(K,"execute",()=>{this.editor.editing.view.focus()}),K})}_createButton(r){const c=r.name;this.editor.ui.componentFactory.add(SA(c),u=>{const _=this.editor.commands.get("imageStyle"),C=new $o(u);return C.set({label:r.title,icon:r.icon,tooltip:!0,isToggleable:!0}),C.bind("isEnabled").to(_,"isEnabled"),C.bind("isOn").to(_,"value",M=>M===c),C.on("execute",this._executeCommand.bind(this,c)),C})}_executeCommand(r){this.editor.execute("imageStyle",{value:r}),this.editor.editing.view.focus()}}function PA(m,r){for(const c of m)r[c.title]&&(c.title=r[c.title]);return m}function SA(m){return`imageStyle:${m}`}function LA(m,r){return(m?m+": ":"")+r}class a6 extends lo{static get pluginName(){return"IndentEditing"}init(){const r=this.editor;r.commands.add("indent",new Qp(r)),r.commands.add("outdent",new Qp(r))}}const OA='',Sb='';class s3 extends lo{static get pluginName(){return"IndentUI"}init(){const r=this.editor,c=r.locale,u=r.t,_="ltr"==c.uiLanguageDirection?OA:Sb,C="ltr"==c.uiLanguageDirection?Sb:OA;this._defineButton("indent",u("Increase indent"),_),this._defineButton("outdent",u("Decrease indent"),C)}_defineButton(r,c,u){const _=this.editor;_.ui.componentFactory.add(r,C=>{const M=_.commands.get(r),E=new $o(C);return E.set({label:c,icon:u,tooltip:!0}),E.bind("isEnabled").to(M,"isEnabled"),this.listenTo(E,"execute",()=>{_.execute(r),_.editing.view.focus()}),E})}}class hC{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(r){Array.isArray(r)?r.forEach(c=>this._definitions.add(c)):this._definitions.add(r)}getDispatcher(){return r=>{r.on("attribute:linkHref",(c,u,_)=>{if(!_.consumable.test(u.item,"attribute:linkHref")||!u.item.is("selection")&&!_.schema.isInline(u.item))return;const C=_.writer,M=C.document.selection;for(const E of this._definitions){const N=C.createAttributeElement("a",E.attributes,{priority:5});E.classes&&C.addClass(E.classes,N);for(const j in E.styles)C.setStyle(j,E.styles[j],N);C.setCustomProperty("link",!0,N),E.callback(u.attributeNewValue)?u.item.is("selection")?C.wrap(M.getFirstRange(),N):C.wrap(_.mapper.toViewRange(u.range),N):C.unwrap(_.mapper.toViewRange(u.range),N)}},{priority:"high"})}}getDispatcherForLinkedImage(){return r=>{r.on("attribute:linkHref:imageBlock",(c,u,{writer:_,mapper:C})=>{const M=C.toViewElement(u.item),E=Array.from(M.getChildren()).find(N=>N.is("element","a"));for(const N of this._definitions){const j=Kc(N.attributes);if(N.callback(u.attributeNewValue)){for(const[K,dt]of j)"class"===K?_.addClass(dt,E):_.setAttribute(K,dt,E);N.classes&&_.addClass(N.classes,E);for(const K in N.styles)_.setStyle(K,N.styles[K],E)}else{for(const[K,dt]of j)"class"===K?_.removeClass(dt,E):_.removeAttribute(K,E);N.classes&&_.removeClass(N.classes,E);for(const K in N.styles)_.removeStyle(K,E)}}})}}}var ly=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");const c3=function(m){return ly.test(m)};var vC="\\ud800-\\udfff",xC="["+vC+"]",Lb="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Ob="\\ud83c[\\udffb-\\udfff]",CC="[^"+vC+"]",AC="(?:\\ud83c[\\udde6-\\uddff]){2}",l3="[\\ud800-\\udbff][\\udc00-\\udfff]",yC="(?:"+Lb+"|"+Ob+")?",TC="[\\ufe0e\\ufe0f]?",EA=TC+yC+"(?:\\u200d(?:"+[CC,AC,l3].join("|")+")"+TC+yC+")*",uy="(?:"+[CC+Lb+"?",Lb,AC,l3,xC].join("|")+")",IA=RegExp(Ob+"(?="+Ob+")|"+uy+EA,"g");const dy=function(r){r=Ug(r);var c=c3(r)?function(m){return c3(m)?function(m){return m.match(IA)||[]}(m):function(m){return m.split("")}(m)}(r):void 0,u=c?c[0]:r.charAt(0),_=c?function(m,r,c){var u=m.length;return P2(m,1,c=void 0===c?u:c)}(c).join(""):r.slice(1);return u.toUpperCase()+_},UC=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,ZC=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i,MC=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,py=/^((\w+:(\/{2,})?)|(\W))/i,k1="Ctrl+K";function kC(m,{writer:r}){const c=r.createAttributeElement("a",{href:m},{priority:5});return r.setCustomProperty("link",!0,c),c}function u3(m){const r=String(m);return r.replace(UC,"").match(ZC)?r:"#"}function r6(m,r){return!!m&&r.checkAttribute(m.name,"linkHref")}function r1(m,r){const c=MC.test(m)?"mailto:":r,_=!!c&&!Eb(m);return m&&_?c+m:m}function Eb(m){return py.test(m)}function s6(m){window.open(m,"_blank","noopener")}class Ib extends Ua{constructor(){super(...arguments),this.manualDecorators=new ec,this.automaticDecorators=new hC}restoreManualDecoratorStates(){for(const r of this.manualDecorators)r.value=this._getDecoratorStateFromModel(r.id)}refresh(){const r=this.editor.model,c=r.document.selection,u=c.getSelectedElement()||os(c.getSelectedBlocks());r6(u,r.schema)?(this.value=u.getAttribute("linkHref"),this.isEnabled=r.schema.checkAttribute(u,"linkHref")):(this.value=c.getAttribute("linkHref"),this.isEnabled=r.schema.checkAttributeInSelection(c,"linkHref"));for(const _ of this.manualDecorators)_.value=this._getDecoratorStateFromModel(_.id)}execute(r,c={}){const u=this.editor.model,_=u.document.selection,C=[],M=[];for(const E in c)c[E]?C.push(E):M.push(E);u.change(E=>{if(_.isCollapsed){const N=_.getFirstPosition();if(_.hasAttribute("linkHref")){const j=DC(_);let K=gc(N,"linkHref",_.getAttribute("linkHref"),u);_.getAttribute("linkHref")===j&&(K=this._updateLinkContent(u,E,K,r)),E.setAttribute("linkHref",r,K),C.forEach(dt=>{E.setAttribute(dt,!0,K)}),M.forEach(dt=>{E.removeAttribute(dt,K)}),E.setSelection(E.createPositionAfter(K.end.nodeBefore))}else if(""!==r){const j=Kc(_.getAttributes());j.set("linkHref",r),C.forEach(dt=>{j.set(dt,!0)});const{end:K}=u.insertContent(E.createText(r,j),N);E.setSelection(K)}["linkHref",...C,...M].forEach(j=>{E.removeSelectionAttribute(j)})}else{const N=u.schema.getValidRanges(_.getRanges(),"linkHref"),j=[];for(const dt of _.getSelectedBlocks())u.schema.checkAttribute(dt,"linkHref")&&j.push(E.createRangeOn(dt));const K=j.slice();for(const dt of N)this._isRangeToUpdate(dt,j)&&K.push(dt);for(const dt of K){let Dt=dt;if(1===K.length){const me=DC(_);_.getAttribute("linkHref")===me&&(Dt=this._updateLinkContent(u,E,dt,r),E.setSelection(E.createSelection(Dt)))}E.setAttribute("linkHref",r,Dt),C.forEach(me=>{E.setAttribute(me,!0,Dt)}),M.forEach(me=>{E.removeAttribute(me,Dt)})}}})}_getDecoratorStateFromModel(r){const c=this.editor.model,u=c.document.selection,_=u.getSelectedElement();return r6(_,c.schema)?_.getAttribute(r):u.getAttribute(r)}_isRangeToUpdate(r,c){for(const u of c)if(u.containsRange(r))return!1;return!0}_updateLinkContent(r,c,u,_){const C=c.createText(_,{linkHref:_});return r.insertContent(C,u)}}function DC(m){if(m.isCollapsed){const r=m.getFirstPosition();return r.textNode&&r.textNode.data}{const r=Array.from(m.getFirstRange().getItems());if(r.length>1)return null;const c=r[0];return c.is("$text")||c.is("$textProxy")?c.data:null}}class Fb extends Ua{refresh(){const r=this.editor.model,c=r.document.selection,u=c.getSelectedElement();this.isEnabled=r6(u,r.schema)?r.schema.checkAttribute(u,"linkHref"):r.schema.checkAttributeInSelection(c,"linkHref")}execute(){const c=this.editor.model,u=c.document.selection,_=this.editor.commands.get("link");c.change(C=>{const M=u.isCollapsed?[gc(u.getFirstPosition(),"linkHref",u.getAttribute("linkHref"),c)]:c.schema.getValidRanges(u.getRanges(),"linkHref");for(const E of M)if(C.removeAttribute("linkHref",E),_)for(const N of _.manualDecorators)C.removeAttribute(N.id,E)})}}class PC extends(Ze()){constructor({id:r,label:c,attributes:u,classes:_,styles:C,defaultValue:M}){super(),this.id=r,this.set("value",void 0),this.defaultValue=M,this.label=c,this.attributes=u,this.classes=_,this.styles=C}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}var Nb=v(9773);Fo()(Nb.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});var SC=Object.defineProperty,Rb=Object.getOwnPropertySymbols,LC=Object.prototype.hasOwnProperty,OC=Object.prototype.propertyIsEnumerable,EC=(m,r,c)=>r in m?SC(m,r,{enumerable:!0,configurable:!0,writable:!0,value:c}):m[r]=c,c6=(m,r)=>{for(var c in r||(r={}))LC.call(r,c)&&EC(m,c,r[c]);if(Rb)for(var c of Rb(r))OC.call(r,c)&&EC(m,c,r[c]);return m};const l_="automatic",Hb=/^(https?:)?\/\//;class zb extends lo{static get pluginName(){return"LinkEditing"}static get requires(){return[M5,Jv,Np]}constructor(r){super(r),r.config.define("link",{addTargetToExternalLinks:!1})}init(){const r=this.editor;r.model.schema.extend("$text",{allowAttributes:"linkHref"}),r.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:kC}),r.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(u,_)=>kC(u3(u),_)}),r.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:u=>u.getAttribute("href")}}),r.commands.add("link",new Ib(r)),r.commands.add("unlink",new Fb(r));const c=function(u,_){const C={"Open in a new tab":u("Open in a new tab"),Downloadable:u("Downloadable")};return _.forEach(M=>("label"in M&&C[M.label]&&(M.label=C[M.label]),M)),_}(r.t,function(u){const _=[];if(u)for(const[C,M]of Object.entries(u)){const E=Object.assign({},M,{id:`link${dy(C)}`});_.push(E)}return _}(r.config.get("link.decorators")));this._enableAutomaticDecorators(c.filter(u=>u.mode===l_)),this._enableManualDecorators(c.filter(u=>"manual"===u.mode)),r.plugins.get(M5).registerAttribute("linkHref"),function(u,_,C,M){const E=u.editing.view,N=new Set;E.document.registerPostFixer(j=>{const K=u.model.document.selection;let dt=!1;if(K.hasAttribute(_)){const Dt=gc(K.getFirstPosition(),_,K.getAttribute(_),u.model),me=u.editing.mapper.toViewRange(Dt);for(const Ue of me.getItems())Ue.is("element","a")&&!Ue.hasClass(M)&&(j.addClass(M,Ue),N.add(Ue),dt=!0)}return dt}),u.conversion.for("editingDowncast").add(j=>{function K(){E.change(dt=>{for(const Dt of N.values())dt.removeClass(M,Dt),N.delete(Dt)})}j.on("insert",K,{priority:"highest"}),j.on("remove",K,{priority:"highest"}),j.on("attribute",K,{priority:"highest"}),j.on("selection",K,{priority:"highest"})})}(r,"linkHref",0,"ck-link_selected"),this._enableLinkOpen(),this._enableInsertContentSelectionAttributesFixer(),this._enableClickingAfterLink(),this._enableTypingOverLink(),this._handleDeleteContentAfterLink(),this._enableClipboardIntegration()}_enableAutomaticDecorators(r){const c=this.editor,u=c.commands.get("link").automaticDecorators;c.config.get("link.addTargetToExternalLinks")&&u.add({id:"linkIsExternal",mode:l_,callback:_=>!!_&&Hb.test(_),attributes:{target:"_blank",rel:"noopener noreferrer"}}),u.add(r),u.length&&c.conversion.for("downcast").add(u.getDispatcher())}_enableManualDecorators(r){if(!r.length)return;const c=this.editor,u=c.commands.get("link").manualDecorators;r.forEach(_=>{c.model.schema.extend("$text",{allowAttributes:_.id});const C=new PC(_);u.add(C),c.conversion.for("downcast").attributeToElement({model:C.id,view:(M,{writer:E,schema:N},{item:j})=>{if((j.is("selection")||N.isInline(j))&&M){const K=E.createAttributeElement("a",C.attributes,{priority:5});C.classes&&E.addClass(C.classes,K);for(const dt in C.styles)E.setStyle(dt,C.styles[dt],K);return E.setCustomProperty("link",!0,K),K}}}),c.conversion.for("upcast").elementToAttribute({view:c6({name:"a"},C._createPattern()),model:{key:C.id}})})}_enableLinkOpen(){const r=this.editor,c=r.editing.view.document;this.listenTo(c,"click",(u,_)=>{if(!(D_isMac?_.domEvent.metaKey:_.domEvent.ctrlKey))return;let C=_.domTarget;if("a"!=C.tagName.toLowerCase()&&(C=C.closest("a")),!C)return;const M=C.getAttribute("href");M&&(u.stop(),_.preventDefault(),s6(M))},{context:"$capture"}),this.listenTo(c,"keydown",(u,_)=>{const C=r.commands.get("link").value;C&&_.keyCode===Ka.enter&&_.altKey&&(u.stop(),s6(C))})}_enableInsertContentSelectionAttributesFixer(){const r=this.editor.model,c=r.document.selection;this.listenTo(r,"insertContent",()=>{const u=c.anchor.nodeBefore,_=c.anchor.nodeAfter;c.hasAttribute("linkHref")&&u&&u.hasAttribute("linkHref")&&(_&&_.hasAttribute("linkHref")||r.change(C=>{op(C,FC(r.schema))}))},{priority:"low"})}_enableClickingAfterLink(){const r=this.editor,c=r.model;r.editing.view.addObserver(A0);let u=!1;this.listenTo(r.editing.view.document,"mousedown",()=>{u=!0}),this.listenTo(r.editing.view.document,"selectionChange",()=>{if(!u)return;u=!1;const _=c.document.selection;if(!_.isCollapsed||!_.hasAttribute("linkHref"))return;const C=_.getFirstPosition(),M=gc(C,"linkHref",_.getAttribute("linkHref"),c);(C.isTouching(M.start)||C.isTouching(M.end))&&c.change(E=>{op(E,FC(c.schema))})})}_enableTypingOverLink(){const r=this.editor;let u=null,_=!1;this.listenTo(r.editing.view.document,"delete",()=>{_=!0},{priority:"high"}),this.listenTo(r.model,"deleteContent",()=>{const C=r.model.document.selection;C.isCollapsed||(_?_=!1:IC(r)&&function(M){const E=M.document.selection,N=E.getFirstPosition(),j=E.getLastPosition(),K=N.nodeAfter;return!!(K&&K.is("$text")&&K.hasAttribute("linkHref"))&&(K===(j.textNode||j.nodeBefore)||gc(N,"linkHref",K.getAttribute("linkHref"),M).containsRange(M.createRange(N,j),!0))}(r.model)&&(u=C.getAttributes()))},{priority:"high"}),this.listenTo(r.model,"insertContent",(C,[M])=>{_=!1,IC(r)&&u&&(r.model.change(E=>{for(const[N,j]of u)E.setAttribute(N,j,M)}),u=null)},{priority:"high"})}_handleDeleteContentAfterLink(){const r=this.editor,c=r.model,u=c.document.selection;let C=!1,M=!1;this.listenTo(r.editing.view.document,"delete",(E,N)=>{M="backward"===N.direction},{priority:"high"}),this.listenTo(c,"deleteContent",()=>{C=!1;const E=u.getFirstPosition(),N=u.getAttribute("linkHref");if(!N)return;const j=gc(E,"linkHref",N,c);C=j.containsPosition(E)||j.end.isEqual(E)},{priority:"high"}),this.listenTo(c,"deleteContent",()=>{M&&(M=!1,C||r.model.enqueueChange(E=>{op(E,FC(c.schema))}))},{priority:"low"})}_enableClipboardIntegration(){const r=this.editor,c=r.model,u=this.editor.config.get("link.defaultProtocol");u&&this.listenTo(r.plugins.get("ClipboardPipeline"),"contentInsertion",(_,C)=>{c.change(M=>{const E=M.createRangeIn(C.content);for(const N of E.getItems())if(N.hasAttribute("linkHref")){const j=r1(N.getAttribute("linkHref"),u);M.setAttribute("linkHref",j,N)}})})}}function op(m,r){m.removeSelectionAttribute("linkHref");for(const c of r)m.removeSelectionAttribute(c)}function IC(m){return m.model.change(r=>r.batch).isTyping}function FC(m){return m.getDefinition("$text").allowAttributes.filter(r=>r.startsWith("link"))}var p3=v(7754);Fo()(p3.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});class NA extends oa{constructor(r,c){super(r),this.focusTracker=new as,this.keystrokes=new $c,this._focusables=new Ia;const u=r.t;this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(u("Save"),hs.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(u("Cancel"),hs.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(c),this.children=this._createFormChildren(c.manualDecorators),this._focusCycler=new dl({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const _=["ck","ck-link-form","ck-responsive-form"];c.manualDecorators.length&&_.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:_,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce((r,c)=>(r[c.name]=c.isOn,r),{})}render(){super.render(),x({view:this}),[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].forEach(r=>{this._focusables.add(r),this.focusTracker.add(r.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createUrlInput(){const r=this.locale.t,c=new Sr(this.locale,uf);return c.label=r("Link URL"),c}_createButton(r,c,u,_){const C=new $o(this.locale);return C.set({label:r,icon:c,tooltip:!0}),C.extendTemplate({attributes:{class:u}}),_&&C.delegate("execute").to(this,_),C}_createManualDecoratorSwitches(r){const c=this.createCollection();for(const u of r.manualDecorators){const _=new As(this.locale);_.set({name:u.id,label:u.label,withText:!0}),_.bind("isOn").toMany([u,r],"value",(C,M)=>void 0===M&&void 0===C?!!u.defaultValue:!!C),_.on("execute",()=>{u.set("value",!_.isOn)}),c.add(_)}return c}_createFormChildren(r){const c=this.createCollection();if(c.add(this.urlInputView),r.length){const u=new oa;u.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map(_=>({tag:"li",children:[_],attributes:{class:["ck","ck-list__item"]}})),attributes:{class:["ck","ck-reset","ck-list"]}}),c.add(u)}return c.add(this.saveButtonView),c.add(this.cancelButtonView),c}}var qC=v(2347);Fo()(qC.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});class my extends oa{constructor(r){super(r),this.focusTracker=new as,this.keystrokes=new $c,this._focusables=new Ia;const c=r.t;this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(c("Unlink"),'',"unlink"),this.editButtonView=this._createButton(c("Edit link"),hs.pencil,"edit"),this.set("href",void 0),this._focusCycler=new dl({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(r=>{this._focusables.add(r),this.focusTracker.add(r.element)}),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createButton(r,c,u){const _=new $o(this.locale);return _.set({label:r,icon:c,tooltip:!0}),_.delegate("execute").to(this,u),_}_createPreviewButton(){const r=new $o(this.locale),c=this.bindTemplate,u=this.t;return r.set({withText:!0,tooltip:u("Open link in new tab")}),r.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:c.to("href",_=>_&&u3(_)),target:"_blank",rel:"noopener noreferrer"}}),r.bind("label").to(this,"href",_=>_||u("This link has no URL")),r.bind("isEnabled").to(this,"href",_=>!!_),r.template.tag="a",r.template.eventListeners={},r}}const ap="link-ui";class qA extends lo{constructor(){super(...arguments),this.actionsView=null,this.formView=null}static get requires(){return[q0]}static get pluginName(){return"LinkUI"}init(){const r=this.editor;r.editing.view.addObserver(c4),this._balloon=r.plugins.get(q0),this._createToolbarLinkButton(),this._enableBalloonActivators(),r.conversion.for("editingDowncast").markerToHighlight({model:ap,view:{classes:["ck-fake-link-selection"]}}),r.conversion.for("editingDowncast").markerToElement({model:ap,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 r=this.editor,c=new my(r.locale),u=r.commands.get("link"),_=r.commands.get("unlink");return c.bind("href").to(u,"value"),c.editButtonView.bind("isEnabled").to(u),c.unlinkButtonView.bind("isEnabled").to(_),this.listenTo(c,"edit",()=>{this._addFormView()}),this.listenTo(c,"unlink",()=>{r.execute("unlink"),this._hideUI()}),c.keystrokes.set("Esc",(C,M)=>{this._hideUI(),M()}),c.keystrokes.set(k1,(C,M)=>{this._addFormView(),M()}),c}_createFormView(){const r=this.editor,c=r.commands.get("link"),u=r.config.get("link.defaultProtocol"),_=new(A(NA))(r.locale,c);return _.urlInputView.fieldView.bind("value").to(c,"value"),_.urlInputView.bind("isEnabled").to(c,"isEnabled"),_.saveButtonView.bind("isEnabled").to(c),this.listenTo(_,"submit",()=>{const{value:C}=_.urlInputView.fieldView.element,M=r1(C,u);r.execute("link",M,_.getDecoratorSwitchesState()),this._closeFormView()}),this.listenTo(_,"cancel",()=>{this._closeFormView()}),_.keystrokes.set("Esc",(C,M)=>{this._closeFormView(),M()}),_}_createToolbarLinkButton(){const r=this.editor,c=r.commands.get("link"),u=r.t;r.ui.componentFactory.add("link",_=>{const C=new $o(_);return C.isEnabled=!0,C.label=u("Link"),C.icon='',C.keystroke=k1,C.tooltip=!0,C.isToggleable=!0,C.bind("isEnabled").to(c,"isEnabled"),C.bind("isOn").to(c,"value",M=>!!M),this.listenTo(C,"execute",()=>this._showUI(!0)),C})}_enableBalloonActivators(){const r=this.editor;this.listenTo(r.editing.view.document,"click",()=>{this._getSelectedLinkElement()&&this._showUI()}),r.keystrokes.set(k1,(u,_)=>{_(),r.commands.get("link").isEnabled&&this._showUI(!0)})}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",(r,c)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),c())},{priority:"high"}),this.editor.keystrokes.set("Esc",(r,c)=>{this._isUIVisible&&(this._hideUI(),c())}),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 r=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=r.value||""}_closeFormView(){const r=this.editor.commands.get("link");r.restoreManualDecoratorStates(),void 0!==r.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(r=!1){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),r&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),r&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const r=this.editor;this.stopListening(r.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),r.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const r=this.editor,c=r.editing.view.document;let u=this._getSelectedLinkElement(),_=M();const C=()=>{const E=this._getSelectedLinkElement(),N=M();u&&!E||!u&&N!==_?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),u=E,_=N};function M(){return c.selection.focus.getAncestors().reverse().find(E=>E.is("element"))}this.listenTo(r.ui,"update",C),this.listenTo(this._balloon,"change:visibleView",C)}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(){return!!this.formView&&this._balloon.visibleView==this.formView||this._areActionsVisible}_getBalloonPositionData(){const r=this.editor.editing.view,u=r.document;let _;if(this.editor.model.markers.has(ap)){const C=Array.from(this.editor.editing.mapper.markerNameToElements(ap)),M=r.createRange(r.createPositionBefore(C[0]),r.createPositionAfter(C[C.length-1]));_=r.domConverter.viewRangeToDom(M)}else _=()=>{const C=this._getSelectedLinkElement();return C?r.domConverter.mapViewToDom(C):r.domConverter.viewRangeToDom(u.selection.getFirstRange())};return{target:_}}_getSelectedLinkElement(){const r=this.editor.editing.view,c=r.document.selection,u=c.getSelectedElement();if(c.isCollapsed||u&&El(u))return l6(c.getFirstPosition());{const _=c.getFirstRange().getTrimmed(),C=l6(_.start),M=l6(_.end);return C&&C==M&&r.createRangeIn(C).getTrimmed().isEqual(_)?C:null}}_showFakeVisualSelection(){const r=this.editor.model;r.change(c=>{const u=r.document.selection.getFirstRange();if(r.markers.has(ap))c.updateMarker(ap,{range:u});else if(u.start.isAtEnd){const _=u.start.getLastMatchingPosition(({item:C})=>!r.schema.isContent(C),{boundaries:u});c.addMarker(ap,{usingOperation:!1,affectsData:!1,range:c.createRange(_,u.end)})}else c.addMarker(ap,{usingOperation:!1,affectsData:!1,range:u})})}_hideFakeVisualSelection(){const r=this.editor.model;r.markers.has(ap)&&r.change(c=>{c.removeMarker(ap)})}}function l6(m){return m.getAncestors().find(r=>{return(c=r).is("attributeElement")&&!!c.getCustomProperty("link");var c})||null}const _y=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 u6 extends lo{static get requires(){return[r_]}static get pluginName(){return"AutoLink"}init(){const r=this.editor.model.document.selection;r.on("change:range",()=>{this.isEnabled=!r.anchor.parent.is("element","codeBlock")}),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling()}_enableTypingHandling(){const r=this.editor,c=new Kv(r.model,u=>{if(!((C=u).length>4&&" "===C[C.length-1]&&" "!==C[C.length-2]))return;var C;const _=d6(u.substr(0,u.length-1));return _?{url:_}:void 0});c.on("matched:data",(u,_)=>{const{batch:C,range:M,url:E}=_;if(!C.isTyping)return;const N=M.end.getShiftedBy(-1),j=N.getShiftedBy(-E.length),K=r.model.createRange(j,N);this._applyAutoLink(E,K)}),c.bind("isEnabled").to(this)}_enableEnterHandling(){const r=this.editor,c=r.model,u=r.commands.get("enter");u&&u.on("execute",()=>{const _=c.document.selection.getFirstPosition();if(!_.parent.previousSibling)return;const C=c.createRangeIn(_.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(C)})}_enableShiftEnterHandling(){const r=this.editor,c=r.model,u=r.commands.get("shiftEnter");u&&u.on("execute",()=>{const _=c.document.selection.getFirstPosition(),C=c.createRange(c.createPositionAt(_.parent,0),_.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(C)})}_checkAndApplyAutoLinkOnRange(r){const c=this.editor.model,{text:u,range:_}=L4(r,c),C=d6(u);if(C){const M=c.createRange(_.end.getShiftedBy(-C.length),_.end);this._applyAutoLink(C,M)}}_applyAutoLink(r,c){const u=this.editor.model,_=r1(r,this.editor.config.get("link.defaultProtocol"));var M;this.isEnabled&&(M=u).schema.checkAttributeInSelection(M.createSelection(c),"linkHref")&&Eb(_)&&!function(C){const M=C.start.nodeAfter;return!!M&&M.hasAttribute("linkHref")}(c)&&this._persistAutoLink(_,c)}_persistAutoLink(r,c){const u=this.editor.model,_=this.editor.plugins.get("Delete");u.enqueueChange(C=>{C.setAttribute("linkHref",r,c),u.enqueueChange(()=>{_.requestUndoOnBackspace()})})}}function d6(m){const r=_y.exec(m);return r?r[2]:null}var m3=v(111);Fo()(m3.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});var Bb=v(5730);Fo()(Bb.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});var _3=v(4564);function BC(m,r,c,u){const _=r.parent,C=c.mapper,M=c.writer;let E=C.toViewPosition(u.createPositionBefore(m));const N=YC(m.previousSibling,{sameIndent:!0,smallerIndent:!0,listIndent:m.getAttribute("listIndent")}),j=m.previousSibling;if(N&&N.getAttribute("listIndent")==m.getAttribute("listIndent")){const K=C.toViewElement(N);E=M.breakContainer(M.createPositionAfter(K))}else if(j&&"listItem"==j.name){E=C.toViewPosition(u.createPositionAt(j,"end"));const K=C.findMappedViewAncestor(E),dt=function(Dt){for(const me of Dt.getChildren())if("ul"==me.name||"ol"==me.name)return me;return null}(K);E=dt?M.createPositionBefore(dt):M.createPositionAt(K,"end")}else E=C.toViewPosition(u.createPositionBefore(m));if(E=Vb(E),M.insert(E,_),j&&"listItem"==j.name){const K=C.toViewElement(j),dt=M.createRange(M.createPositionAt(K,0),E).getWalker({ignoreElementEnd:!0});for(const Dt of dt)if(Dt.item.is("element","li")){const me=M.breakContainer(M.createPositionBefore(Dt.item)),Ue=Dt.item.parent,qe=M.createPositionAt(r,"end");D1(M,qe.nodeBefore,qe.nodeAfter),M.move(M.createRangeOn(Ue),qe),dt._position=me}}else{const K=_.nextSibling;if(K&&(K.is("element","ul")||K.is("element","ol"))){let dt=null;for(const Dt of K.getChildren()){const me=C.toModelElement(Dt);if(!(me&&me.getAttribute("listIndent")>m.getAttribute("listIndent")))break;dt=Dt}dt&&(M.breakContainer(M.createPositionAfter(dt)),M.move(M.createRangeOn(dt.parent),M.createPositionAt(r,"end")))}}D1(M,_,_.nextSibling),D1(M,_.previousSibling,_)}function D1(m,r,c){return!r||!c||"ul"!=r.name&&"ol"!=r.name||r.name!=c.name||r.getAttribute("class")!==c.getAttribute("class")?null:m.mergeContainers(m.createPositionAfter(r))}function Vb(m){return m.getLastMatchingPosition(r=>r.item.is("uiElement"))}function YC(m,r){const c=!!r.sameIndent,u=!!r.smallerIndent,_=r.listIndent;let C=m;for(;C&&"listItem"==C.name;){const M=C.getAttribute("listIndent");if(c&&_==M||u&&_>M)return C;C="forward"===r.direction?C.nextSibling:C.previousSibling}return null}function VC(m,r,c,u){m.ui.componentFactory.add(r,_=>{const C=m.commands.get(r),M=new $o(_);return M.set({label:c,icon:u,tooltip:!0,isToggleable:!0}),M.bind("isOn","isEnabled").to(C,"value","isEnabled"),M.on("execute",()=>{m.execute(r),m.editing.view.focus()}),M})}function jC(m,r){const c=[],u=m.parent,_={ignoreElementEnd:!1,startPosition:m,shallow:!0,direction:r},C=u.getAttribute("listIndent"),M=[...new Gd(_)].filter(E=>E.item.is("element")).map(E=>E.item);for(const E of M){if(!E.is("element","listItem")||E.getAttribute("listIndent")C)){if(E.getAttribute("listType")!==u.getAttribute("listType")||E.getAttribute("listStyle")!==u.getAttribute("listStyle")||E.getAttribute("listReversed")!==u.getAttribute("listReversed")||E.getAttribute("listStart")!==u.getAttribute("listStart"))break;"backward"===r?c.unshift(E):c.push(E)}}return c}Fo()(_3.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});const RA=["disc","circle","square"],JC=["decimal","decimal-leading-zero","lower-roman","upper-roman","lower-latin","upper-latin"];function GC(){const m=!this.isEmpty&&("ul"==this.getChild(0).name||"ol"==this.getChild(0).name);return this.isEmpty||m?0:Bf.call(this)}class HA extends lo{static get pluginName(){return"ListUI"}init(){const r=this.editor.t;VC(this.editor,"numberedList",r("Numbered List"),''),VC(this.editor,"bulletedList",r("Bulleted List"),'')}}const QC={},fy={},hy={},gy=[{listStyle:"disc",typeAttribute:"disc",listType:"bulleted"},{listStyle:"circle",typeAttribute:"circle",listType:"bulleted"},{listStyle:"square",typeAttribute:"square",listType:"bulleted"},{listStyle:"decimal",typeAttribute:"1",listType:"numbered"},{listStyle:"decimal-leading-zero",typeAttribute:null,listType:"numbered"},{listStyle:"lower-roman",typeAttribute:"i",listType:"numbered"},{listStyle:"upper-roman",typeAttribute:"I",listType:"numbered"},{listStyle:"lower-alpha",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-alpha",typeAttribute:"A",listType:"numbered"},{listStyle:"lower-latin",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-latin",typeAttribute:"A",listType:"numbered"}];for(const{listStyle:m,typeAttribute:r,listType:c}of gy)QC[m]=c,fy[m]=r,r&&(hy[r]=m);var zA=v(4721);Fo()(zA.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});var jb=v(6082);Fo()(jb.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});var WC=v(2417);Fo()(WC.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});class Gb extends Ua{constructor(r,c){super(r),this._indentBy="forward"==c?1:-1}refresh(){this.isEnabled=this._checkEnabled()}execute(){const r=this.editor.model;let u=Array.from(r.document.selection.getSelectedBlocks());r.change(_=>{const C=u[u.length-1];let M=C.nextSibling;for(;M&&"listItem"==M.name&&M.getAttribute("listIndent")>C.getAttribute("listIndent");)u.push(M),M=M.nextSibling;this._indentBy<0&&(u=u.reverse());for(const E of u){const N=E.getAttribute("listIndent")+this._indentBy;N<0?_.rename(E,"paragraph"):_.setAttribute("listIndent",N,E)}this.fire("_executeCleanup",u)})}_checkEnabled(){const r=os(this.editor.model.document.selection.getSelectedBlocks());if(!r||!r.is("element","listItem"))return!1;if(this._indentBy>0){const c=r.getAttribute("listIndent"),u=r.getAttribute("listType");let _=r.previousSibling;for(;_&&_.is("element","listItem")&&_.getAttribute("listIndent")>=c;){if(_.getAttribute("listIndent")==c)return _.getAttribute("listType")==u;_=_.previousSibling}return!1}return!0}}class g2 extends Ua{constructor(r,c){super(r),this.type=c}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(r={}){const c=this.editor.model,_=Array.from(c.document.selection.getSelectedBlocks()).filter(M=>m6(M,c.schema)),C=void 0!==r.forceValue?!r.forceValue:this.value;c.change(M=>{if(C){let E=_[_.length-1].nextSibling,N=Number.POSITIVE_INFINITY,j=[];for(;E&&"listItem"==E.name&&0!==E.getAttribute("listIndent");){const K=E.getAttribute("listIndent");K=c;)C>_.getAttribute("listIndent")&&(C=_.getAttribute("listIndent")),_.getAttribute("listIndent")==C&&m[r?"unshift":"push"](_),_=_[r?"previousSibling":"nextSibling"]}}function m6(m,r){return r.checkChild(m.parent,"listItem")&&!r.isObject(m)}class Wb extends lo{static get pluginName(){return"ListUtils"}getListTypeFromListStyleType(r){return RA.includes(c=r)?"bulleted":JC.includes(c)?"numbered":null;var c}getSelectedListItems(r){return function(c){let u=[...c.document.selection.getSelectedBlocks()].filter(_=>_.is("element","listItem")).map(_=>{const C=c.change(M=>M.createPositionAt(_,0));return[...jC(C,"backward"),...jC(C,"forward")]}).flat();return u=[...new Set(u)],u}(r)}getSiblingNodes(r,c){return jC(r,c)}}function $C(m){return(r,c,u)=>{const _=u.consumable;if(!_.test(c.item,"insert")||!_.test(c.item,"attribute:listType")||!_.test(c.item,"attribute:listIndent"))return;_.consume(c.item,"insert"),_.consume(c.item,"attribute:listType"),_.consume(c.item,"attribute:listIndent");const C=c.item;BC(C,function zC(m,r){const c=r.mapper,u=r.writer,_="numbered"==m.getAttribute("listType")?"ol":"ul",C=function(E){const N=E.createContainerElement("li");return N.getFillerOffset=GC,N}(u),M=u.createContainerElement(_,null);return u.insert(u.createPositionAt(M,0),C),c.bindElements(m,C),C}(C,u),u,m)}}const $b=(m,r,c)=>{if(!c.consumable.test(r.item,m.name))return;const u=c.mapper.toViewElement(r.item),_=c.writer;_.breakContainer(_.createPositionBefore(u)),_.breakContainer(_.createPositionAfter(u)),_.rename("numbered"==r.attributeNewValue?"ol":"ul",u.parent)},Tf=(m,r,c)=>{c.consumable.consume(r.item,m.name);const u=c.mapper.toViewElement(r.item).parent,_=c.writer;D1(_,u,u.nextSibling),D1(_,u.previousSibling,u)},h3=(m,r,c)=>{if(c.consumable.test(r.item,m.name)&&"listItem"!=r.item.name){let u=c.mapper.toViewPosition(r.range.start);const _=c.writer,C=[];for(;("ul"==u.parent.name||"ol"==u.parent.name)&&(u=_.breakContainer(u),"li"==u.parent.name);){const M=u,E=_.createPositionAt(u.parent,"end");if(!M.isEqual(E)){const N=_.remove(_.createRange(M,E));C.push(N)}u=_.createPositionAfter(u.parent)}if(C.length>0){for(let M=0;M0){const N=D1(_,E,E.nextSibling);N&&N.parent==E&&u.offset--}}D1(_,u.nodeBefore,u.nodeAfter)}}},by=(m,r,c)=>{const u=c.mapper.toViewPosition(r.position);D1(c.writer,u.nodeBefore,u.nodeAfter)},vy=(m,r,c)=>{if(c.consumable.consume(r.viewItem,{name:!0})){const u=c.writer,_=u.createElement("listItem"),C=function(N){let j=0,K=N.parent;for(;K;){if(K.is("element","li"))j++;else{const dt=K.previousSibling;dt&&dt.is("element","li")&&j++}K=K.parent}return j}(r.viewItem);if(u.setAttribute("listIndent",C,_),u.setAttribute("listType",r.viewItem.parent&&"ol"==r.viewItem.parent.name?"numbered":"bulleted",_),!c.safeInsert(_,r.modelCursor))return;const E=function(N,j,K){const{writer:dt,schema:Dt}=K;let me=dt.createPositionAfter(N);for(const Ue of j)if("ul"==Ue.name||"ol"==Ue.name)me=K.convertItem(Ue,me).modelCursor;else{const qe=K.convertItem(Ue,dt.createPositionAt(N,"end")),pn=qe.modelRange.start.nodeAfter;pn&&pn.is("element")&&!Dt.checkChild(N,pn.name)&&(N=qe.modelCursor.parent.is("element","listItem")?qe.modelCursor.parent:jA(qe.modelCursor),me=dt.createPositionAfter(N))}return me}(_,r.viewItem.getChildren(),c);r.modelRange=u.createRange(r.modelCursor,E),c.updateConversionResult(_,r)}},YA=(m,r,c)=>{if(c.consumable.test(r.viewItem,{name:!0})){const u=Array.from(r.viewItem.getChildren());for(const _ of u)!_.is("element","li")&&!eg(_)&&_._remove()}},Kb=(m,r,c)=>{if(c.consumable.test(r.viewItem,{name:!0})){if(0===r.viewItem.childCount)return;const u=[...r.viewItem.getChildren()];let _=!1;for(const C of u)_&&!eg(C)&&C._remove(),eg(C)&&(_=!0)}};function Xb(m){return(r,c)=>{if(c.isPhantom)return;const u=c.modelPosition.nodeBefore;if(u&&u.is("element","listItem")){const _=c.mapper.toViewElement(u),C=_.getAncestors().find(eg),M=m.createPositionAt(_,0).getWalker();for(const E of M){if("elementStart"==E.type&&E.item.is("element","li")){c.viewPosition=E.previousPosition;break}if("elementEnd"==E.type&&E.item==C){c.viewPosition=E.nextPosition;break}}}}}const VA=function(m,[r,c]){let _,C=r.is("documentFragment")?r.getChild(0):r;if(_=c?this.createSelection(c):this.document.selection,C&&C.is("element","listItem")){const M=_.getFirstPosition();let E=null;if(M.parent.is("element","listItem")?E=M.parent:M.nodeBefore&&M.nodeBefore.is("element","listItem")&&(E=M.nodeBefore),E){const N=E.getAttribute("listIndent");if(N>0)for(;C&&C.is("element","listItem");)C._setAttribute("listIndent",C.getAttribute("listIndent")+N),C=C.nextSibling}}};function jA(m){const r=new Gd({startPosition:m});let c;do{c=r.next()}while(!c.value.item.is("element","listItem"));return c.value.item}function KC(m,r,c,u,_,C){const M=YC(r.nodeBefore,{sameIndent:!0,smallerIndent:!0,listIndent:m}),E=_.mapper,N=_.writer,j=M?M.getAttribute("listIndent"):null;let K;if(M)if(j==m){const dt=E.toViewElement(M).parent;K=N.createPositionAfter(dt)}else{const dt=C.createPositionAt(M,"end");K=E.toViewPosition(dt)}else K=c;K=Vb(K);for(const dt of[...u.getChildren()])eg(dt)&&(K=N.move(N.createRangeOn(dt),K).end,D1(N,dt,dt.nextSibling),D1(N,dt.previousSibling,dt))}function eg(m){return m.is("element","ol")||m.is("element","ul")}class tv extends lo{static get pluginName(){return"ListEditing"}static get requires(){return[Tm,r_,Wb]}init(){const r=this.editor;r.model.schema.register("listItem",{inheritAllFrom:"$block",allowAttributes:["listType","listIndent"]});const c=r.data,u=r.editing;var _;r.model.document.registerPostFixer(M=>function(E,N){const j=E.document.differ.getChanges(),K=new Map;let dt=!1;for(const qe of j)if("insert"==qe.type&&"listItem"==qe.name)Dt(qe.position);else if("insert"==qe.type&&"listItem"!=qe.name){if("$text"!=qe.name){const pn=qe.position.nodeAfter;pn.hasAttribute("listIndent")&&(N.removeAttribute("listIndent",pn),dt=!0),pn.hasAttribute("listType")&&(N.removeAttribute("listType",pn),dt=!0),pn.hasAttribute("listStyle")&&(N.removeAttribute("listStyle",pn),dt=!0),pn.hasAttribute("listReversed")&&(N.removeAttribute("listReversed",pn),dt=!0),pn.hasAttribute("listStart")&&(N.removeAttribute("listStart",pn),dt=!0);for(const Ln of Array.from(E.createRangeIn(pn)).filter(pi=>pi.item.is("element","listItem")))Dt(Ln.previousPosition)}Dt(qe.position.getShiftedBy(qe.length))}else"remove"==qe.type&&"listItem"==qe.name?Dt(qe.position):("attribute"==qe.type&&"listIndent"==qe.attributeKey||"attribute"==qe.type&&"listType"==qe.attributeKey)&&Dt(qe.range.start);for(const qe of K.values())me(qe),Ue(qe);return dt;function Dt(qe){const pn=qe.nodeBefore;if(pn&&pn.is("element","listItem")){let Ln=pn;if(K.has(Ln))return;for(let pi=Ln.previousSibling;pi&&pi.is("element","listItem");pi=Ln.previousSibling)if(Ln=pi,K.has(Ln))return;K.set(pn,Ln)}else{const Ln=qe.nodeAfter;Ln&&Ln.is("element","listItem")&&K.set(Ln,Ln)}}function me(qe){let pn=0,Ln=null;for(;qe&&qe.is("element","listItem");){const pi=qe.getAttribute("listIndent");if(pi>pn){let Ri;null===Ln?(Ln=pi-pn,Ri=pn):(Ln>pi&&(Ln=pi),Ri=pi-Ln),N.setAttribute("listIndent",Ri,qe),dt=!0}else Ln=null,pn=qe.getAttribute("listIndent")+1;qe=qe.nextSibling}}function Ue(qe){let pn=[],Ln=null;for(;qe&&qe.is("element","listItem");){const pi=qe.getAttribute("listIndent");if(Ln&&Ln.getAttribute("listIndent")>pi&&(pn=pn.slice(0,pi+1)),0!=pi)if(pn[pi]){const Ri=pn[pi];qe.getAttribute("listType")!=Ri&&(N.setAttribute("listType",Ri,qe),dt=!0)}else pn[pi]=qe.getAttribute("listType");Ln=qe,qe=qe.nextSibling}}}(r.model,M)),u.mapper.registerViewToModelLength("li",_6),c.mapper.registerViewToModelLength("li",_6),u.mapper.on("modelToViewPosition",Xb(u.view)),u.mapper.on("viewToModelPosition",(_=r.model,(M,E)=>{const N=E.viewPosition,j=N.parent,K=E.mapper;if("ul"==j.name||"ol"==j.name){if(N.isAtEnd){const dt=K.toModelElement(N.nodeBefore),Dt=K.getModelLength(N.nodeBefore);E.modelPosition=_.createPositionBefore(dt).getShiftedBy(Dt)}else{const dt=K.toModelElement(N.nodeAfter);E.modelPosition=_.createPositionBefore(dt)}M.stop()}else if("li"==j.name&&N.nodeBefore&&("ul"==N.nodeBefore.name||"ol"==N.nodeBefore.name)){const dt=K.toModelElement(j);let Dt=1,me=N.nodeBefore;for(;me&&eg(me);)Dt+=K.getModelLength(me),me=me.previousSibling;E.modelPosition=_.createPositionBefore(dt).getShiftedBy(Dt),M.stop()}})),c.mapper.on("modelToViewPosition",Xb(u.view)),r.conversion.for("editingDowncast").add(M=>{var E;M.on("insert",h3,{priority:"high"}),M.on("insert:listItem",$C(r.model)),M.on("attribute:listType:listItem",$b,{priority:"high"}),M.on("attribute:listType:listItem",Tf,{priority:"low"}),M.on("attribute:listIndent:listItem",(E=r.model,(N,j,K)=>{if(!K.consumable.consume(j.item,"attribute:listIndent"))return;const dt=K.mapper.toViewElement(j.item),Dt=K.writer;Dt.breakContainer(Dt.createPositionBefore(dt)),Dt.breakContainer(Dt.createPositionAfter(dt));const me=dt.parent,Ue=me.previousSibling,qe=Dt.createRangeOn(me);Dt.remove(qe),Ue&&Ue.nextSibling&&D1(Dt,Ue,Ue.nextSibling),KC(j.attributeOldValue+1,j.range.start,qe.start,dt,K,E),BC(j.item,dt,K,E);for(const pn of j.item.getChildren())K.consumable.consume(pn,"insert")})),M.on("remove:listItem",function(E){return(N,j,K)=>{const dt=K.mapper.toViewPosition(j.position).getLastMatchingPosition(Ln=>!Ln.item.is("element","li")).nodeAfter,Dt=K.writer;Dt.breakContainer(Dt.createPositionBefore(dt)),Dt.breakContainer(Dt.createPositionAfter(dt));const me=dt.parent,Ue=me.previousSibling,qe=Dt.createRangeOn(me),pn=Dt.remove(qe);Ue&&Ue.nextSibling&&D1(Dt,Ue,Ue.nextSibling),KC(K.mapper.toModelElement(dt).getAttribute("listIndent")+1,j.position,qe.start,dt,K,E);for(const Ln of Dt.createRangeIn(pn).getItems())K.mapper.unbindViewElement(Ln);N.stop()}}(r.model)),M.on("remove",by,{priority:"low"})}),r.conversion.for("dataDowncast").add(M=>{M.on("insert",h3,{priority:"high"}),M.on("insert:listItem",$C(r.model))}),r.conversion.for("upcast").add(M=>{M.on("element:ul",YA,{priority:"high"}),M.on("element:ol",YA,{priority:"high"}),M.on("element:li",Kb,{priority:"high"}),M.on("element:li",vy)}),r.model.on("insertContent",VA,{priority:"high"}),r.commands.add("numberedList",new g2(r,"numbered")),r.commands.add("bulletedList",new g2(r,"bulleted")),r.commands.add("indentList",new Gb(r,"forward")),r.commands.add("outdentList",new Gb(r,"backward"));const C=u.view.document;this.listenTo(C,"enter",(M,E)=>{const N=this.editor.model.document,j=N.selection.getLastPosition().parent;N.selection.isCollapsed&&"listItem"==j.name&&j.isEmpty&&(this.editor.execute("outdentList"),E.preventDefault(),M.stop())},{context:"li"}),this.listenTo(C,"delete",(M,E)=>{if("backward"!==E.direction)return;const N=this.editor.model.document.selection;if(!N.isCollapsed)return;const j=N.getFirstPosition();if(!j.isAtStart)return;const K=j.parent;"listItem"===K.name&&(K.previousSibling&&"listItem"===K.previousSibling.name||(this.editor.execute("outdentList"),E.preventDefault(),M.stop()))},{context:"li"}),this.listenTo(r.editing.view.document,"tab",(M,E)=>{const N=E.shiftKey?"outdentList":"indentList";this.editor.commands.get(N).isEnabled&&(r.execute(N),E.stopPropagation(),E.preventDefault(),M.stop())},{context:"li"})}afterInit(){const r=this.editor.commands,c=r.get("indent"),u=r.get("outdent");c&&c.registerChildCommand(r.get("indentList")),u&&u.registerChildCommand(r.get("outdentList"))}}function _6(m){let r=1;for(const c of m.getChildren())if("ul"==c.name||"ol"==c.name)for(const u of c.getChildren())r+=_6(u);return r}tc("Ctrl+Enter");var ev=v(1199);function XC(m,r){const c=(u,_,C)=>{if(!C.consumable.consume(_.item,u.name))return;const M=_.attributeNewValue,E=C.writer,N=C.mapper.toViewElement(_.item),j=[...N.getChildren()].find(dt=>dt.getCustomProperty("media-content"));E.remove(j);const K=m.getMediaViewElement(E,M,r);E.insert(E.createPositionAt(N,0),K)};return u=>{u.on("attribute:url:media",c)}}function f6(m,r,c,u){return m.createContainerElement("figure",{class:"media"},[r.getMediaViewElement(m,c,u),m.createSlot()])}function h6(m){const r=m.getSelectedElement();return r&&r.is("element","media")?r:null}function GA(m,r,c,u){m.change(_=>{const C=_.createElement("media",{url:r});m.insertObject(C,c,null,{setSelection:"on",findOptimalPosition:u?"auto":void 0})})}Fo()(ev.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0}),tc("Ctrl+Enter");class t8 extends Ua{refresh(){const r=this.editor.model,c=r.document.selection,u=h6(c);this.value=u?u.getAttribute("url"):void 0,this.isEnabled=function(_){const C=_.getSelectedElement();return!!C&&"media"===C.name}(c)||function(_,C){let E=q4(_,C).start.parent;return E.isEmpty&&!C.schema.isLimit(E)&&(E=E.parent),C.schema.checkChild(E,"media")}(c,r)}execute(r){const c=this.editor.model,u=c.document.selection,_=h6(u);_?c.change(C=>{C.setAttribute("url",r,_)}):GA(c,r,u,!0)}}class ng{constructor(r,c){const u=c.providers,_=c.extraProviders||[],C=new Set(c.removeProviders),M=u.concat(_).filter(E=>{const N=E.name;return N?!C.has(N):(Zt("media-embed-no-provider-name",{provider:E}),!1)});this.locale=r,this.providerDefinitions=M}hasMedia(r){return!!this._getMedia(r)}getMediaViewElement(r,c,u){return this._getMedia(c).getViewElement(r,u)}_getMedia(r){if(!r)return new e8(this.locale);r=r.trim();for(const c of this.providerDefinitions){const u=c.html,_=Ss(c.url);for(const C of _){const M=this._getUrlMatches(r,C);if(M)return new e8(this.locale,r,M,u)}}return null}_getUrlMatches(r,c){let u=r.match(c);if(u)return u;let _=r.replace(/^https?:\/\//,"");return u=_.match(c),u||(_=_.replace(/^www\./,""),u=_.match(c),u||null)}}class e8{constructor(r,c,u,_){this.url=this._getValidUrl(c),this._locale=r,this._match=u,this._previewRenderer=_}getViewElement(r,c){const u={};let _;if(c.renderForEditingView||c.renderMediaPreview&&this.url&&this._previewRenderer){this.url&&(u["data-oembed-url"]=this.url),c.renderForEditingView&&(u.class="ck-media__wrapper");const C=this._getPreviewHtml(c);_=r.createRawElement("div",u,(M,E)=>{E.setContentOf(M,C)})}else this.url&&(u.url=this.url),_=r.createEmptyElement(c.elementName,u);return r.setCustomProperty("media-content",!0,_),_}_getPreviewHtml(r){return this._previewRenderer?this._previewRenderer(this._match):this.url&&r.renderForEditingView?this._getPlaceholderHtml():""}_getPlaceholderHtml(){const r=new zs,c=this._locale.t;return r.content='',r.viewBox="0 0 64 42",new Ur({tag:"div",attributes:{class:"ck ck-reset_all ck-media__placeholder"},children:[{tag:"div",attributes:{class:"ck-media__placeholder__icon"},children:[r]},{tag:"a",attributes:{class:"ck-media__placeholder__url",target:"_blank",rel:"noopener noreferrer",href:this.url,"data-cke-tooltip-text":c("Open media in new tab")},children:[{tag:"span",attributes:{class:"ck-media__placeholder__url__text"},children:[this.url]}]}]}).render().outerHTML}_getValidUrl(r){return r?r.match(/^https?/)?r:"https://"+r:null}}var n8=v(7442);Fo()(n8.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});class nv extends lo{constructor(r){super(r),r.config.define("mediaEmbed",{elementName:"oembed",providers:[{name:"dailymotion",url:/^dailymotion\.com\/video\/(\w+)/,html:c=>``},{name:"spotify",url:[/^open\.spotify\.com\/(artist\/\w+)/,/^open\.spotify\.com\/(album\/\w+)/,/^open\.spotify\.com\/(track\/\w+)/],html:c=>``},{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:c=>{const _=c[2];return``}},{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:c=>``},{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 ng(r.locale,r.config.get("mediaEmbed"))}static get pluginName(){return"MediaEmbedEditing"}init(){const r=this.editor,c=r.model.schema,u=r.t,_=r.conversion,C=r.config.get("mediaEmbed.previewsInData"),M=r.config.get("mediaEmbed.elementName"),E=this.registry;r.commands.add("mediaEmbed",new t8(r)),c.register("media",{inheritAllFrom:"$blockObject",allowAttributes:["url"]}),_.for("dataDowncast").elementToStructure({model:"media",view:(N,{writer:j})=>{const K=N.getAttribute("url");return f6(j,E,K,{elementName:M,renderMediaPreview:!!K&&C})}}),_.for("dataDowncast").add(XC(E,{elementName:M,renderMediaPreview:C})),_.for("editingDowncast").elementToStructure({model:"media",view:(N,{writer:j})=>{const K=N.getAttribute("url");return dt=f6(j,E,K,{elementName:M,renderForEditingView:!0}),Dt=j,me=u("media widget"),Dt.setCustomProperty("media",!0,dt),ep(dt,Dt,{label:me});var dt,Dt,me}}),_.for("editingDowncast").add(XC(E,{elementName:M,renderForEditingView:!0})),_.for("upcast").elementToElement({view:N=>["oembed",M].includes(N.name)&&N.getAttribute("url")?{name:!0}:null,model:(N,{writer:j})=>{const K=N.getAttribute("url");return E.hasMedia(K)?j.createElement("media",{url:K}):null}}).elementToElement({view:{name:"div",attributes:{"data-oembed-url":!0}},model:(N,{writer:j})=>{const K=N.getAttribute("data-oembed-url");return E.hasMedia(K)?j.createElement("media",{url:K}):null}}).add(N=>{N.on("element:figure",(j,K,dt)=>{if(!dt.consumable.consume(K.viewItem,{name:!0,classes:"media"}))return;const{modelRange:Dt,modelCursor:me}=dt.convertChildren(K.viewItem,K.modelCursor);K.modelRange=Dt,K.modelCursor=me,os(Dt.getItems())||dt.consumable.revert(K.viewItem,{name:!0,classes:"media"})})})}}const QA=/^(?:http(s)?:\/\/)?[\w-]+\.[\w-.~:/?#[\]@!$&'()*+,;=%]+$/;class WA extends lo{constructor(r){super(r),this._timeoutId=null,this._positionToInsert=null}static get requires(){return[Ax,r_,Sx]}static get pluginName(){return"AutoMediaEmbed"}init(){const r=this.editor,c=r.model.document,u=r.plugins.get("ClipboardPipeline");this.listenTo(u,"inputTransformation",()=>{const _=c.selection.getFirstRange(),C=el.fromPosition(_.start);C.stickiness="toPrevious";const M=el.fromPosition(_.end);M.stickiness="toNext",c.once("change:data",()=>{this._embedMediaBetweenPositions(C,M),C.detach(),M.detach()},{priority:"high"})}),r.commands.get("undo").on("execute",()=>{this._timeoutId&&(Lt.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)},{priority:"high"})}_embedMediaBetweenPositions(r,c){const u=this.editor,_=u.plugins.get(nv).registry,C=new Xu(r,c),M=C.getWalker({ignoreElementEnd:!0});let E="";for(const N of M)N.item.is("$textProxy")&&(E+=N.item.data);E=E.trim(),E.match(QA)&&_.hasMedia(E)&&u.commands.get("mediaEmbed").isEnabled?(this._positionToInsert=el.fromPosition(r),this._timeoutId=Lt.window.setTimeout(()=>{u.model.change(N=>{this._timeoutId=null,N.remove(C),C.detach();let j=null;"$graveyard"!==this._positionToInsert.root.rootName&&(j=this._positionToInsert),GA(u.model,E,j,!1),this._positionToInsert.detach(),this._positionToInsert=null}),u.plugins.get(r_).requestUndoOnBackspace()},100)):C.detach()}}var i8=v(9292);Fo()(i8.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});class Ay extends oa{constructor(r,c){super(c);const u=c.t;this.focusTracker=new as,this.keystrokes=new $c,this.set("mediaURLInputValue",""),this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(u("Save"),hs.check,"ck-button-save"),this.saveButtonView.type="submit",this.saveButtonView.bind("isEnabled").to(this,"mediaURLInputValue",_=>!!_),this.cancelButtonView=this._createButton(u("Cancel"),hs.cancel,"ck-button-cancel","cancel"),this._focusables=new Ia,this._focusCycler=new dl({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this._validators=r,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(),x({view:this}),[this.urlInputView,this.saveButtonView,this.cancelButtonView].forEach(c=>{this._focusables.add(c),this.focusTracker.add(c.element)}),this.keystrokes.listenTo(this.element);const r=c=>c.stopPropagation();this.keystrokes.set("arrowright",r),this.keystrokes.set("arrowleft",r),this.keystrokes.set("arrowup",r),this.keystrokes.set("arrowdown",r)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}get url(){return this.urlInputView.fieldView.element.value.trim()}set url(r){this.urlInputView.fieldView.element.value=r.trim()}isValid(){this.resetFormStatus();for(const r of this._validators){const c=r(this);if(c)return this.urlInputView.errorText=c,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null,this.urlInputView.infoText=this._urlInputViewInfoDefault}_createUrlInput(){const r=this.locale.t,c=new Sr(this.locale,uf),u=c.fieldView;return this._urlInputViewInfoDefault=r("Paste the media URL in the input."),this._urlInputViewInfoTip=r("Tip: Paste the URL into the content to embed faster."),c.label=r("Media URL"),c.infoText=this._urlInputViewInfoDefault,u.on("input",()=>{c.infoText=u.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault,this.mediaURLInputValue=u.element.value.trim()}),c}_createButton(r,c,u,_){const C=new $o(this.locale);return C.set({label:r,icon:c,tooltip:!0}),C.extendTemplate({attributes:{class:u}}),_&&C.delegate("execute").to(this,_),C}}class $A extends lo{static get requires(){return[nv]}static get pluginName(){return"MediaEmbedUI"}init(){const r=this.editor,c=r.commands.get("mediaEmbed");r.ui.componentFactory.add("mediaEmbed",u=>{const _=Op(u);return this._setUpDropdown(_,c),_})}_setUpDropdown(r,c){const u=this.editor,_=u.t,C=r.buttonView,M=u.plugins.get(nv).registry;r.once("change:isOpen",()=>{const E=new(A(Ay))((N=u.t,j=M,[K=>{if(!K.url.length)return N("The URL must not be empty.")},K=>{if(!j.hasMedia(K.url))return N("This media URL is not supported.")}]),u.locale);var N,j;r.panelView.children.add(E),C.on("open",()=>{E.disableCssTransitions(),E.url=c.value||"",E.urlInputView.fieldView.select(),E.enableCssTransitions()},{priority:"low"}),r.on("submit",()=>{E.isValid()&&(u.execute("mediaEmbed",E.url),u.editing.view.focus())}),r.on("change:isOpen",()=>E.resetFormStatus()),r.on("cancel",()=>{u.editing.view.focus()}),E.delegate("submit","cancel").to(r),E.urlInputView.fieldView.bind("value").to(c,"value"),E.urlInputView.bind("isEnabled").to(c,"isEnabled")}),r.bind("isEnabled").to(c),C.set({label:_("Insert media"),icon:'',tooltip:!0})}}var KA=v(4652);function Ty(m){if(m.startsWith("arabic-leading-zero"))return"decimal-leading-zero";switch(m){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 m;default:return null}}function XA(m,r,c){const u=r.parent,_=c.createElement(m.type),C=u.getChildIndex(r)+1;return c.insertChild(C,_,u),m.style&&c.setStyle("list-style-type",m.style,_),m.startIndex&&m.startIndex>1&&c.setAttribute("start",m.startIndex,_),_}function t7(m){const r={},c=m.getStyle("mso-list");if(c){const u=c.match(/(^|\s{1,100})l(\d+)/i),_=c.match(/\s{0,100}lfo(\d+)/i),C=c.match(/\s{0,100}level(\d+)/i);u&&_&&C&&(r.id=u[2],r.order=_[1],r.indent=parseInt(C[1]))}return r}function Uy(m){return btoa(m.match(/\w{2}/g).map(r=>String.fromCharCode(parseInt(r,16))).join(""))}Fo()(KA.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});const Zy=//i,h=/xmlns:o="urn:schemas-microsoft-com/i;class g{constructor(r){this.document=r}isActive(r){return Zy.test(r)||h.test(r)}execute(r){const{body:c,stylesString:u}=r._parsedData;(function o8(m,r){if(!m.childCount)return;const c=new W1(m.document),u=function(M,E){const N=E.createRangeIn(M),j=new ds({name:/^p|h\d+$/,styles:{"mso-list":/.*/}}),K=[];for(const dt of N)if("elementStart"===dt.type&&j.match(dt.item)){const Dt=t7(dt.item);K.push({element:dt.item,id:Dt.id,order:Dt.order,indent:Dt.indent})}return K}(m,c);if(!u.length)return;let _=null,C=1;u.forEach((M,E)=>{const N=function(Ue,qe){if(!Ue)return!0;if(Ue.id!==qe.id)return qe.indent-Ue.indent!=1;const pn=qe.element.previousSibling;return!pn||!((Ln=pn).is("element","ol")||Ln.is("element","ul"));var Ln}(u[E-1],M),K=(Dt=M,(dt=N?null:u[E-1])?Dt.indent-dt.indent:Dt.indent-1);var dt,Dt;if(N&&(_=null,C=1),!_||0!==K){const Ue=function(qe,pn){const pi=/mso-level-number-format:([^;]{0,100});/gi,Ri=/mso-level-start-at:\s{0,100}([0-9]{0,10})\s{0,100};/gi,Go=new RegExp(`@list l${qe.id}:level${qe.indent}\\s*({[^}]*)`,"gi").exec(pn);let ka="decimal",Ts="ol",$r=null;if(Go&&Go[1]){const Il=pi.exec(Go[1]);if(Il&&Il[1]&&(ka=Il[1].trim(),Ts="bullet"!==ka&&"image"!==ka?"ol":"ul"),"bullet"===ka){const hl=function(T6){const v2=function(Uf){if(Uf.getChild(0).is("$text"))return null;for(const x2 of Uf.getChildren()){if(!x2.is("element","span"))continue;const C3=x2.getChild(0);if(C3)return C3.is("$text")?C3:C3.getChild(0)}return null}(T6);if(!v2)return null;const Rp=v2._data;return"o"===Rp?"circle":"\xb7"===Rp?"disc":"\xa7"===Rp?"square":null}(qe.element);hl&&(ka=hl)}else{const hl=Ri.exec(Go[1]);hl&&hl[1]&&($r=parseInt(hl[1]))}}return{type:Ts,startIndex:$r,style:Ty(ka)}}(M,r);if(_)if(M.indent>C){const qe=_.getChild(_.childCount-1),pn=qe.getChild(qe.childCount-1);_=XA(Ue,pn,c),C+=1}else M.indentC.indexOf(Ue)>-1)?K.push(Dt):Dt.getAttribute("src")||K.push(Dt)}for(const dt of K)E.remove(dt)})(u,m,c),function(C,M,E){const N=E.createRangeIn(M),j=[];for(const Dt of N)if("elementStart"==Dt.type&&Dt.item.is("element","v:shape")){const me=Dt.item.getAttribute("id");if(C.includes(me))continue;K(Dt.item.parent.getChildren(),me)||j.push(Dt.item)}for(const Dt of j){const me={src:dt(Dt)};Dt.hasAttribute("alt")&&(me.alt=Dt.getAttribute("alt"));const Ue=E.createElement("img",me);E.insertChild(Dt.index+1,Ue,Dt.parent)}function K(Dt,me){for(const Ue of Dt)if(Ue.is("element")&&("img"==Ue.name&&Ue.getAttribute("v:shapes")==me||K(Ue.getChildren(),me)))return!0;return!1}function dt(Dt){for(const me of Dt.getChildren())if(me.is("element")&&me.getAttribute("src"))return me.getAttribute("src")}}(u,m,c),function(C,M){const E=M.createRangeIn(C),N=new ds({name:/v:(.+)/}),j=[];for(const K of E)"elementStart"==K.type&&N.match(K.item)&&j.push(K.item);for(const K of j)M.remove(K)}(m,c);const _=function(C,M){const E=M.createRangeIn(C),N=new ds({name:"img"}),j=[];for(const K of E)K.item.is("element")&&N.match(K.item)&&K.item.getAttribute("src").startsWith("file://")&&j.push(K.item);return j}(m,c);_.length&&function(C,M,E){if(C.length===M.length)for(let N=0;NM.is("element")&&!u.includes(M.name)&&!_.includes(M.name),{direction:r}),"forward"==r?C.nodeAfter:C.nodeBefore}function O(m,r){return!!m&&m.is("element")&&r.includes(m.name)}const q=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class V{constructor(r){this.document=r}isActive(r){return q.test(r)}execute(r){const c=new W1(this.document),{body:u}=r._parsedData;(function(_,C){for(const M of _.getChildren())if(M.is("element","b")&&"normal"===M.getStyle("font-weight")){const E=_.getChildIndex(M);C.remove(M),C.insertChild(E,M.getChildren(),_)}})(u,c),function(_,C){for(const M of C.createRangeIn(_)){const E=M.item;if(E.is("element","li")){const N=E.getChild(0);N&&N.is("element","p")&&C.unwrapElement(N)}}}(u,c),function(_,C){const M=new Xp(C.document.stylesProcessor),E=new N_(M,{renderingMode:"data"}),N=E.blockElements,j=E.inlineObjectElements,K=[];for(const dt of C.createRangeIn(_)){const Dt=dt.item;if(Dt.is("element","br")){const me=U(Dt,"forward",C,{blockElements:N,inlineObjectElements:j}),Ue=U(Dt,"backward",C,{blockElements:N,inlineObjectElements:j}),qe=O(me,N);(O(Ue,N)||qe)&&K.push(Dt)}}for(const dt of K)dt.hasClass("Apple-interchange-newline")?C.remove(dt):C.replace(dt,C.createElement("p"))}(u,c),r.content=u}}const ut=/(\s+)<\/span>/g,(r,c)=>1===c.length?" ":Array(c.length+1).join("\xa0 ").substr(0,c.length))}function Qe(m,r,c,u,_=1){null!=r&&null!=_&&r>_?u.setAttribute(m,r,c):u.removeAttribute(m,c)}function An(m,r,c={}){const u=m.createElement("tableCell",c);return m.insertElement("paragraph",u),m.insert(u,r),u}function si(m,r){const u=parseInt(r.parent.parent.getAttribute("headingColumns")||"0"),{column:_}=m.getCellLocation(r);return!!u&&_{r.on(`element:${m}`,(c,u,{writer:_})=>{if(!u.modelRange)return;const C=u.modelRange.start.nodeAfter,M=_.createPositionAt(C,0);if(u.viewItem.isEmpty)return void _.insertElement("paragraph",M);const E=Array.from(C.getChildren());if(E.every(N=>N.is("element","$marker"))){const N=_.createElement("paragraph");_.insert(N,_.createPositionAt(C,0));for(const j of E)_.move(_.createRangeOn(j),_.createPositionAt(N,"end"))}},{priority:"low"})}}function Ao(m){let r=0,c=0;const u=Array.from(m.getChildren()).filter(_=>"th"===_.name||"td"===_.name);for(;c1||M>1)&&this._recordSpans(_,M,C),this._shouldSkipSlot()||(c=this._formatOutValue(_)),this._nextCellAtColumn=this._column+C}return this._column++,this._column==this._nextCellAtColumn&&this._cellIndex++,c||this.next()}skipRow(r){this._skipRows.add(r)}_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(r,c=this._row,u=this._column){return{done:!1,value:new pa(this,r,c,u)}}_shouldSkipSlot(){return this._skipRows.has(this._row)||this._rowthis._endColumn}_getSpanned(){const r=this._spannedCells.get(this._row);return r&&r.get(this._column)||null}_recordSpans(r,c,u){const _={cell:r,row:this._row,column:this._column};for(let C=this._row;C0&&!this._jumpedToStartRow}_jumpToNonSpannedRowClosestToStartRow(){const r=this._getRowLength(0);for(let c=this._startRow;!this._jumpedToStartRow;c--)r===this._getRowLength(c)&&(this._row=c,this._rowIndex=c,this._jumpedToStartRow=!0)}_getRowLength(r){return[...this._table.getChild(r).getChildren()].reduce((c,u)=>c+parseInt(u.getAttribute("colspan")||"1"),0)}}class pa{constructor(r,c,u,_){this.cell=c,this.row=r._row,this.column=r._column,this.cellAnchorRow=u,this.cellAnchorColumn=_,this._cellIndex=r._cellIndex,this._rowIndex=r._rowIndex,this._table=r._table}get isAnchor(){return this.row===this.cellAnchorRow&&this.column===this.cellAnchorColumn}get cellWidth(){return parseInt(this.cell.getAttribute("colspan")||"1")}get cellHeight(){return parseInt(this.cell.getAttribute("rowspan")||"1")}get rowIndex(){return this._rowIndex}getPositionBefore(){return this._table.root.document.model.createPositionAt(this._table.getChild(this.row),this._cellIndex)}}function Ta(m,r){return(c,{writer:u})=>{const _=c.getAttribute("headingRows")||0,C=u.createContainerElement("table",null,[]),M=u.createContainerElement("figure",{class:"table"},C);_>0&&u.insert(u.createPositionAt(C,"end"),u.createContainerElement("thead",null,u.createSlot(E=>E.is("element","tableRow")&&E.index<_))),_E.is("element","tableRow")&&E.index>=_)));for(const{positionOffset:E,filter:N}of r.additionalSlots)u.insert(u.createPositionAt(C,E),u.createSlot(N));return u.insert(u.createPositionAt(C,"after"),u.createSlot(E=>!E.is("element","tableRow")&&!r.additionalSlots.some(({filter:N})=>N(E)))),r.asWidget?((N=u).setCustomProperty("table",!0,E=M),ep(E,N,{hasSelectionHandle:!0})):M;var E,N}}function oo(m={}){return(r,{writer:c})=>{const u=r.parent,_=u.parent,C=_.getChildIndex(u),M=new ro(_,{row:C}),E=_.getAttribute("headingRows")||0,N=_.getAttribute("headingColumns")||0;let j=null;for(const K of M)if(K.cell==r){const dt=K.row{if(!r.parent.is("element","tableCell")||!zr(r))return null;if(m.asWidget)return c.createContainerElement("span",{class:"ck-table-bogus-paragraph"});{const u=c.createContainerElement("p");return c.setCustomProperty("dataPipeline:transparentRendering",!0,u),u}}}function zr(m){return 1==m.parent.childCount&&!!m.getAttributeKeys().next().done}class Mc extends Ua{refresh(){const r=this.editor.model;this.isEnabled=function(_,C){const M=_.getFirstPosition().parent;return C.checkChild(M===M.root?M:M.parent,"table")}(r.document.selection,r.schema)}execute(r={}){const c=this.editor,u=c.model,_=c.plugins.get("TableUtils"),C=c.config.get("table.defaultHeadings.rows"),M=c.config.get("table.defaultHeadings.columns");void 0===r.headingRows&&C&&(r.headingRows=C),void 0===r.headingColumns&&M&&(r.headingColumns=M),u.change(E=>{const N=_.createTable(E,r);u.insertObject(N,null,null,{findOptimalPosition:"auto"}),E.setSelection(E.createPositionAt(N.getNodeByPath([0,0,0]),0))})}}class b2 extends Ua{constructor(r,c={}){super(r),this.order=c.order||"below"}refresh(){const r=this.editor.model.document.selection,c=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(r).length;this.isEnabled=c}execute(){const r=this.editor,c=r.model.document.selection,u=r.plugins.get("TableUtils"),_="above"===this.order,C=u.getSelectionAffectedTableCells(c),M=u.getRowIndexes(C),E=_?M.first:M.last,N=C[0].findAncestor("table");u.insertRows(N,{at:_?E:E+1,copyStructureFromAbove:!_})}}class g6 extends Ua{constructor(r,c={}){super(r),this.order=c.order||"right"}refresh(){const r=this.editor.model.document.selection,c=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(r).length;this.isEnabled=c}execute(){const r=this.editor,c=r.model.document.selection,u=r.plugins.get("TableUtils"),_="left"===this.order,C=u.getSelectionAffectedTableCells(c),M=u.getColumnIndexes(C),E=_?M.first:M.last,N=C[0].findAncestor("table");u.insertColumns(N,{columns:1,at:_?E:E+1})}}class g3 extends Ua{constructor(r,c={}){super(r),this.direction=c.direction||"horizontally"}refresh(){const r=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=1===r.length}execute(){const r=this.editor.plugins.get("TableUtils"),c=r.getSelectionAffectedTableCells(this.editor.model.document.selection)[0];"horizontally"===this.direction?r.splitCellHorizontally(c,2):r.splitCellVertically(c,2)}}function b6(m,r,c){const{startRow:u,startColumn:_,endRow:C,endColumn:M}=r,E=c.createElement("table"),N=C-u+1;for(let K=0;K0&&Qe("headingRows",qe-Dt,K,Ue,0);const pn=parseInt(dt.getAttribute("headingColumns")||"0");pn>0&&Qe("headingColumns",pn-me,K,Ue,0)}(E,m,u,_,c),E}function v6(m,r,c=0){const u=[],_=new ro(m,{startRow:c,endRow:r-1});for(const C of _){const{row:M,cellHeight:E}=C;M1&&(E.rowspan=N);const j=parseInt(m.getAttribute("colspan")||"1");j>1&&(E.colspan=j);const K=C+M,dt=[...new ro(_,{startRow:C,endRow:K,includeAllSlots:!0})];let Dt,me=null;for(const Ue of dt){const{row:qe,column:pn,cell:Ln}=Ue;Ln===m&&void 0===Dt&&(Dt=pn),void 0!==Dt&&Dt===pn&&qe===K&&(me=An(c,Ue.getPositionBefore(),E))}return Qe("rowspan",M,m,c),me}function C6(m,r){const c=[],u=new ro(m);for(const _ of u){const{column:C,cellWidth:M}=_;C1&&(C.colspan=M);const E=parseInt(m.getAttribute("rowspan")||"1");E>1&&(C.rowspan=E);const N=An(u,u.createPositionAfter(m),C);return Qe("colspan",_,m,u),N}function b3(m,r,c,u,_,C){const M=parseInt(m.getAttribute("colspan")||"1"),E=parseInt(m.getAttribute("rowspan")||"1");c+M-1>_&&Qe("colspan",_-c+1,m,C,1),r+E-1>u&&Qe("rowspan",u-r+1,m,C,1)}function v3(m,r){const c=r.getColumns(m),u=new Array(c).fill(0);for(const{column:C}of new ro(m))u[C]++;const _=u.reduce((C,M,E)=>M?C:[...C,E],[]);return _.length>0&&(r.removeColumns(m,{at:_[_.length-1]}),!0)}function a8(m,r){const c=[],u=r.getRows(m);for(let _=0;_0&&(r.removeRows(m,{at:c[c.length-1]}),!0)}function e7(m,r){v3(m,r)||a8(m,r)}function n7(m,r){const c=Array.from(new ro(m,{startColumn:r.firstColumn,endColumn:r.lastColumn,row:r.lastRow}));return c.every(({cellHeight:_})=>1===_)?r.lastRow:r.lastRow+(c[0].cellHeight-1)}function My(m,r){const c=Array.from(new ro(m,{startRow:r.firstRow,endRow:r.lastRow,column:r.lastColumn}));return c.every(({cellWidth:_})=>1===_)?r.lastColumn:r.lastColumn+(c[0].cellWidth-1)}class iv extends Ua{constructor(r,c){super(r),this.direction=c.direction,this.isHorizontal="right"==this.direction||"left"==this.direction}refresh(){const r=this._getMergeableCell();this.value=r,this.isEnabled=!!r}execute(){const r=this.editor.model,c=r.document,u=this.editor.plugins.get("TableUtils").getTableCellsContainingSelection(c.selection)[0],_=this.value,C=this.direction;r.change(M=>{const E="right"==C||"down"==C,N=E?u:_,j=E?_:u,K=j.parent;var qe,pn,Ln;pn=N,Ln=M,ky(qe=j)||(ky(pn)&&Ln.remove(Ln.createRangeIn(pn)),Ln.move(Ln.createRangeIn(qe),Ln.createPositionAt(pn,"end"))),Ln.remove(qe);const dt=this.isHorizontal?"colspan":"rowspan",Dt=parseInt(u.getAttribute(dt)||"1"),me=parseInt(_.getAttribute(dt)||"1");M.setAttribute(dt,Dt+me,N),M.setSelection(M.createRangeIn(N));const Ue=this.editor.plugins.get("TableUtils");e7(K.findAncestor("table"),Ue)})}_getMergeableCell(){const r=this.editor.model.document,c=this.editor.plugins.get("TableUtils"),u=c.getTableCellsContainingSelection(r.selection)[0];if(!u)return;const _=this.isHorizontal?function(E,N,j){const Dt="right"==N?E.nextSibling:E.previousSibling,me=(E.parent.parent.getAttribute("headingColumns")||0)>0;if(!Dt)return;const Ue="right"==N?E:Dt,qe="right"==N?Dt:E,{column:pn}=j.getCellLocation(Ue),{column:Ln}=j.getCellLocation(qe),pi=parseInt(Ue.getAttribute("colspan")||"1"),Ri=si(j,Ue),Go=si(j,qe);return me&&Ri!=Go?void 0:pn+pi===Ln?Dt:void 0}(u,this.direction,c):function(E,N,j){const K=E.parent,dt=K.parent,Dt=dt.getChildIndex(K);if("down"==N&&Dt===j.getRows(dt)-1||"up"==N&&0===Dt)return null;const me=parseInt(E.getAttribute("rowspan")||"1"),Ue=dt.getAttribute("headingRows")||0;if(Ue&&("down"==N&&Dt+me===Ue||"up"==N&&Dt===Ue))return null;const Ln=parseInt(E.getAttribute("rowspan")||"1"),pi="down"==N?Dt+Ln:Dt,Ri=[...new ro(dt,{endRow:pi})],ka=Ri.find($r=>$r.cell===E).column,Ts=Ri.find(({row:$r,cellHeight:Il,column:hl})=>hl===ka&&("down"==N?$r===pi:pi===$r+Il));return Ts&&Ts.cell?Ts.cell:null}(u,this.direction,c);if(!_)return;const C=this.isHorizontal?"rowspan":"colspan",M=parseInt(u.getAttribute(C)||"1");return parseInt(_.getAttribute(C)||"1")===M?_:void 0}}function ky(m){const r=m.getChild(0);return 1==m.childCount&&r.is("element","paragraph")&&r.isEmpty}class Dy extends Ua{refresh(){const r=this.editor.plugins.get("TableUtils"),c=r.getSelectionAffectedTableCells(this.editor.model.document.selection),u=c[0];if(u){const _=u.findAncestor("table"),C=r.getRows(_)-1,M=r.getRowIndexes(c);this.isEnabled=!(0===M.first&&M.last===C)}else this.isEnabled=!1}execute(){const r=this.editor.model,c=this.editor.plugins.get("TableUtils"),u=c.getSelectionAffectedTableCells(r.document.selection),_=c.getRowIndexes(u),C=u[0],M=C.findAncestor("table"),E=c.getCellLocation(C).column;r.change(N=>{c.removeRows(M,{at:_.first,rows:_.last-_.first+1});const K=function(dt,Dt,me,Ue){const qe=dt.getChild(Math.min(Dt,Ue-1));let pn=qe.getChild(0),Ln=0;for(const pi of qe.getChildren()){if(Ln>me)return pn;pn=pi,Ln+=parseInt(pi.getAttribute("colspan")||"1")}return pn}(M,_.first,E,c.getRows(M));N.setSelection(N.createPositionAt(K,0))})}}class Py extends Ua{refresh(){const r=this.editor.plugins.get("TableUtils"),c=r.getSelectionAffectedTableCells(this.editor.model.document.selection),u=c[0];if(u){const _=u.findAncestor("table"),C=r.getColumns(_),{first:M,last:E}=r.getColumnIndexes(c);this.isEnabled=E-MN.cell===c).column,last:C.find(N=>N.cell===u).column},E=(N=C,j=c,K=u,dt=M,parseInt(K.getAttribute("colspan")||"1")>1?K:j.previousSibling||K.nextSibling?K.nextSibling||j.previousSibling:dt.first?N.reverse().find(({column:me})=>meme>dt.last).cell);var N,j,K,dt;this.editor.model.change(N=>{r.removeColumns(_,{at:M.first,columns:M.last-M.first+1}),N.setSelection(N.createPositionAt(E,0))})}}class GT extends Ua{refresh(){const u=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection),_=u.length>0;this.isEnabled=_,this.value=_&&u.every(C=>this._isInHeading(C,C.parent.parent))}execute(r={}){if(r.forceValue===this.value)return;const c=this.editor.plugins.get("TableUtils"),u=this.editor.model,_=c.getSelectionAffectedTableCells(u.document.selection),C=_[0].findAncestor("table"),{first:M,last:E}=c.getRowIndexes(_),N=this.value?M:E+1,j=C.getAttribute("headingRows")||0;u.change(K=>{if(N){const dt=v6(C,N,N>j?j:0);for(const{cell:Dt}of dt)x6(Dt,N,K)}Qe("headingRows",N,C,K,0)})}_isInHeading(r,c){const u=parseInt(c.getAttribute("headingRows")||"0");return!!u&&r.parent.index0;this.isEnabled=_,this.value=_&&u.every(C=>si(c,C))}execute(r={}){if(r.forceValue===this.value)return;const c=this.editor.plugins.get("TableUtils"),u=this.editor.model,_=c.getSelectionAffectedTableCells(u.document.selection),C=_[0].findAncestor("table"),{first:M,last:E}=c.getColumnIndexes(_),N=this.value?M:E+1;u.change(j=>{if(N){const K=C6(C,N);for(const{cell:dt,column:Dt}of K)A6(dt,Dt,N,j)}Qe("headingColumns",N,C,j,0)})}}class s1 extends lo{static get pluginName(){return"TableUtils"}init(){this.decorate("insertColumns"),this.decorate("insertRows")}getCellLocation(r){const c=r.parent,u=c.parent,_=u.getChildIndex(c),C=new ro(u,{row:_});for(const{cell:M,row:E,column:N}of C)if(M===r)return{row:E,column:N}}createTable(r,c){const u=r.createElement("table"),_=c.rows||2,C=c.columns||2;return i7(r,u,0,_,C),c.headingRows&&Qe("headingRows",Math.min(c.headingRows,_),u,r,0),c.headingColumns&&Qe("headingColumns",Math.min(c.headingColumns,C),u,r,0),u}insertRows(r,c={}){const u=this.editor.model,_=c.at||0,C=c.rows||1,M=void 0!==c.copyStructureFromAbove,E=c.copyStructureFromAbove?_-1:_,N=this.getRows(r),j=this.getColumns(r);if(_>N)throw new at("tableutils-insertrows-insert-out-of-range",this,{options:c});u.change(K=>{const dt=r.getAttribute("headingRows")||0;if(dt>_&&Qe("headingRows",dt+C,r,K,0),!M&&(0===_||_===N))return void i7(K,r,_,C,j);const Dt=M?Math.max(_,E):_,me=new ro(r,{endRow:Dt}),Ue=new Array(j).fill(1);for(const{row:qe,column:pn,cellHeight:Ln,cellWidth:pi,cell:Ri}of me){const Go=qe+Ln-1,ka=qe<=E&&E<=Go;qe<_&&_<=Go?(K.setAttribute("rowspan",Ln+C,Ri),Ue[pn]=-pi):M&&ka&&(Ue[pn]=pi)}for(let qe=0;qe0&&An(K,Ri,pi>1?{colspan:pi}:void 0),Ln+=Math.abs(pi)-1}}})}insertColumns(r,c={}){const _=c.at||0,C=c.columns||1;this.editor.model.change(M=>{const E=r.getAttribute("headingColumns");_C-1)throw new at("tableutils-removerows-row-index-out-of-range",this,{table:r,options:c});u.change(N=>{const j={first:M,last:E},{cellsToMove:K,cellsToTrim:dt}=function(Dt,{first:me,last:Ue}){const qe=new Map,pn=[];for(const{row:Ln,column:pi,cellHeight:Ri,cell:Go}of new ro(Dt,{endRow:Ue})){const ka=Ln+Ri-1;if(Ln>=me&&Ln<=Ue&&ka>Ue&&qe.set(pi,{cell:Go,rowspan:Ri-(Ue-Ln+1)}),Ln=me){let Ts;Ts=ka>=Ue?Ue-me+1:ka-me+1,pn.push({cell:Go,rowspan:Ri-Ts})}}return{cellsToMove:qe,cellsToTrim:pn}}(r,j);K.size&&function(Dt,me,Ue,qe){const Ln=[...new ro(Dt,{includeAllSlots:!0,row:me})],pi=Dt.getChild(me);let Ri;for(const{column:Go,cell:ka,isAnchor:Ts}of Ln)if(Ue.has(Go)){const{cell:$r,rowspan:Il}=Ue.get(Go),hl=Ri?qe.createPositionAfter(Ri):qe.createPositionAt(pi,0);qe.move(qe.createRangeOn($r),hl),Qe("rowspan",Il,$r,qe),Ri=$r}else Ts&&(Ri=ka)}(r,E+1,K,N);for(let Dt=E;Dt>=M;Dt--)N.remove(r.getChild(Dt));for(const{rowspan:Dt,cell:me}of dt)Qe("rowspan",Dt,me,N);(function(Dt,{first:me,last:Ue},qe){const pn=Dt.getAttribute("headingRows")||0;me{!function(j,K,dt){const Dt=j.getAttribute("headingColumns")||0;if(Dt&&K.first
c.is("element","tableColumnGroup"))}(m);return r?Array.from(r.getChildren()):[]}(r);for(let j=M;j>=_;j--){for(const{cell:K,column:dt,cellWidth:Dt}of[...new ro(r)])dt<=j&&Dt>1&&dt+Dt>j?Qe("colspan",Dt-1,K,E):dt===j&&E.remove(K);if(N[j]){const K=0===j?N[1]:N[j-1],dt=parseFloat(N[j].getAttribute("columnWidth")),Dt=parseFloat(K.getAttribute("columnWidth"));E.remove(N[j]),E.setAttribute("columnWidth",dt+Dt+"%",K)}}a8(r,this)||v3(r,this)})}splitCellVertically(r,c=2){const u=this.editor.model,_=r.parent.parent,C=parseInt(r.getAttribute("rowspan")||"1"),M=parseInt(r.getAttribute("colspan")||"1");u.change(E=>{if(M>1){const{newCellsSpan:N,updatedSpan:j}=Sy(M,c);Qe("colspan",j,r,E);const K={};N>1&&(K.colspan=N),C>1&&(K.rowspan=C),y6(M>c?c-1:M-1,E,E.createPositionAfter(r),K)}if(MUe===r),dt=j.filter(({cell:Ue,cellWidth:qe,column:pn})=>Ue!==r&&pn===K||pnK);for(const{cell:Ue,cellWidth:qe}of dt)E.setAttribute("colspan",qe+N,Ue);const Dt={};C>1&&(Dt.rowspan=C),y6(N,E,E.createPositionAfter(r),Dt);const me=_.getAttribute("headingColumns")||0;me>K&&Qe("headingColumns",me+N,_,E)}})}splitCellHorizontally(r,c=2){const u=this.editor.model,_=r.parent,C=_.parent,M=C.getChildIndex(_),E=parseInt(r.getAttribute("rowspan")||"1"),N=parseInt(r.getAttribute("colspan")||"1");u.change(j=>{if(E>1){const K=[...new ro(C,{startRow:M,endRow:M+E-1,includeAllSlots:!0})],{newCellsSpan:dt,updatedSpan:Dt}=Sy(E,c);Qe("rowspan",Dt,r,j);const{column:me}=K.find(({cell:qe})=>qe===r),Ue={};dt>1&&(Ue.rowspan=dt),N>1&&(Ue.colspan=N);for(const qe of K){const{column:pn,row:Ln}=qe;Ln>=M+Dt&&pn===me&&(Ln+M+Dt)%dt==0&&y6(1,j,qe.getPositionBefore(),Ue)}}if(EM&&j.setAttribute("rowspan",qe+K,Ue);const Dt={};N>1&&(Dt.colspan=N),i7(j,C,M+1,K,1,Dt);const me=C.getAttribute("headingRows")||0;me>M&&Qe("headingRows",me+K,C,j)}})}getColumns(r){return[...r.getChild(0).getChildren()].reduce((c,u)=>c+parseInt(u.getAttribute("colspan")||"1"),0)}getRows(r){return Array.from(r.getChildren()).reduce((c,u)=>u.is("element","tableRow")?c+1:c,0)}createTableWalker(r,c={}){return new ro(r,c)}getSelectedTableCells(r){const c=[];for(const u of this.sortRanges(r.getRanges())){const _=u.getContainedElement();_&&_.is("element","tableCell")&&c.push(_)}return c}getTableCellsContainingSelection(r){const c=[];for(const u of r.getRanges()){const _=u.start.findAncestor("tableCell");_&&c.push(_)}return c}getSelectionAffectedTableCells(r){const c=this.getSelectedTableCells(r);return c.length?c:this.getTableCellsContainingSelection(r)}getRowIndexes(r){const c=r.map(u=>u.parent.index);return this._getFirstLastIndexesObject(c)}getColumnIndexes(r){const c=r[0].findAncestor("table"),u=[...new ro(c)].filter(_=>r.includes(_.cell)).map(_=>_.column);return this._getFirstLastIndexesObject(u)}isSelectionRectangular(r){if(r.length<2||!this._areCellInTheSameTableSection(r))return!1;const c=new Set,u=new Set;let _=0;for(const M of r){const{row:E,column:N}=this.getCellLocation(M),j=parseInt(M.getAttribute("rowspan"))||1,K=parseInt(M.getAttribute("colspan"))||1;c.add(E),u.add(N),j>1&&c.add(E+j-1),K>1&&u.add(N+K-1),_+=j*K}return function(M,E){const N=Array.from(M.values()),j=Array.from(E.values());return(Math.max(...N)-Math.min(...N)+1)*(Math.max(...j)-Math.min(...j)+1)}(c,u)==_}sortRanges(r){return Array.from(r).sort(Ly)}_getFirstLastIndexesObject(r){const c=r.sort((u,_)=>u-_);return{first:c[0],last:c[c.length-1]}}_areCellInTheSameTableSection(r){const c=r[0].findAncestor("table"),u=this.getRowIndexes(r),_=parseInt(c.getAttribute("headingRows"))||0;if(!this._areIndexesInSameSection(u,_))return!1;const C=this.getColumnIndexes(r),M=parseInt(c.getAttribute("headingColumns"))||0;return this._areIndexesInSameSection(C,M)}_areIndexesInSameSection({first:r,last:c},u){return r{const _=c.getSelectedTableCells(r.document.selection),C=_.shift(),{mergeWidth:M,mergeHeight:E}=function(N,j,K){let dt=0,Dt=0;for(const Ln of j){const{row:pi,column:Ri}=K.getCellLocation(Ln);dt=Ey(Ln,Ri,dt,"colspan"),Dt=Ey(Ln,pi,Dt,"rowspan")}const{row:me,column:Ue}=K.getCellLocation(N);return{mergeWidth:dt-Ue,mergeHeight:Dt-me}}(C,_,c);Qe("colspan",M,C,u),Qe("rowspan",E,C,u);for(const N of _)KT(N,C,u);e7(C.findAncestor("table"),c),u.setSelection(C,"in")})}}function KT(m,r,c){Oy(m)||(Oy(r)&&c.remove(c.createRangeIn(r)),c.move(c.createRangeIn(m),c.createPositionAt(r,"end"))),c.remove(m)}function Oy(m){const r=m.getChild(0);return 1==m.childCount&&r.is("element","paragraph")&&r.isEmpty}function Ey(m,r,c,u){const _=parseInt(m.getAttribute(u)||"1");return Math.max(c,r+_)}class Xn extends Ua{constructor(r){super(r),this.affectsData=!1}refresh(){const r=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=r.length>0}execute(){const r=this.editor.model,c=this.editor.plugins.get("TableUtils"),u=c.getSelectionAffectedTableCells(r.document.selection),_=c.getRowIndexes(u),C=u[0].findAncestor("table"),M=[];for(let E=_.first;E<=_.last;E++)for(const N of C.getChild(E).getChildren())M.push(r.createRangeOn(N));r.change(E=>{E.setSelection(M)})}}class Ya extends Ua{constructor(r){super(r),this.affectsData=!1}refresh(){const r=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=r.length>0}execute(){const r=this.editor.plugins.get("TableUtils"),c=this.editor.model,u=r.getSelectionAffectedTableCells(c.document.selection),_=u[0],C=u.pop(),M=_.findAncestor("table"),E=r.getCellLocation(_),N=r.getCellLocation(C),j=Math.min(E.column,N.column),K=Math.max(E.column,N.column),dt=[];for(const Dt of new ro(M,{startColumn:j,endColumn:K}))dt.push(c.createRangeOn(Dt.cell));c.change(Dt=>{Dt.setSelection(dt)})}}function tw(m,r){let c=!1;const u=function(_){const C=parseInt(_.getAttribute("headingRows")||"0"),M=Array.from(_.getChildren()).reduce((N,j)=>j.is("element","tableRow")?N+1:N,0),E=[];for(const{row:N,cell:j,cellHeight:K}of new ro(_)){if(K<2)continue;const dt=Ndt&&E.push({cell:j,rowspan:dt-N})}return E}(m);if(u.length){c=!0;for(const _ of u)Qe("rowspan",_.rowspan,_.cell,r,1)}return c}function o7(m,r){let c=!1;const u=function(E){const N=new Array(E.childCount).fill(0);for(const{rowIndex:j}of new ro(E,{includeAllSlots:!0}))N[j]++;return N}(m),_=[];for(const[E,N]of u.entries())!N&&m.getChild(E).is("element","tableRow")&&_.push(E);if(_.length){c=!0;for(const E of _.reverse())r.remove(m.getChild(E)),u.splice(E,1)}const C=u.filter((E,N)=>m.getChild(N).is("element","tableRow")),M=C[0];if(!C.every(E=>E===M)){const E=C.reduce((N,j)=>j>N?j:N,0);for(const[N,j]of C.entries()){const K=E-j;if(K){for(let dt=0;dtu.is("$text"));for(const u of c)r.wrap(r.createRangeOn(u),"paragraph");return!!c.length}function ow(m){return!!m.position.parent.is("element","tableCell")&&("insert"==m.type&&"$text"==m.name||"remove"==m.type)}function aw(m,r){if(!m.is("element","paragraph"))return!1;const c=r.toViewElement(m);return!!c&&zr(m)!==c.is("element","span")}var Fy=v(3881);Fo()(Fy.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});class Ny extends lo{constructor(r){super(r),this._additionalSlots=[]}static get pluginName(){return"TableEditing"}static get requires(){return[s1]}init(){const r=this.editor,c=r.model,u=c.schema,_=r.conversion,C=r.plugins.get(s1);u.register("table",{inheritAllFrom:"$blockObject",allowAttributes:["headingRows","headingColumns"]}),u.register("tableRow",{allowIn:"table",isLimit:!0}),u.register("tableCell",{allowContentOf:"$container",allowIn:"tableRow",allowAttributes:["colspan","rowspan"],isLimit:!0,isSelectable:!0}),_.for("upcast").add(M=>{M.on("element:figure",(E,N,j)=>{if(!j.consumable.test(N.viewItem,{name:!0,classes:"table"}))return;const K=function(Dt){for(const me of Dt.getChildren())if(me.is("element","table"))return me}(N.viewItem);if(!K||!j.consumable.test(K,{name:!0}))return;j.consumable.consume(N.viewItem,{name:!0,classes:"table"});const dt=os(j.convertItem(K,N.modelCursor).modelRange.getItems());dt?(j.convertChildren(N.viewItem,j.writer.createPositionAt(dt,"end")),j.updateConversionResult(dt,N)):j.consumable.revert(N.viewItem,{name:!0,classes:"table"})})}),_.for("upcast").add(function Ai(){return m=>{m.on("element:table",(r,c,u)=>{const _=c.viewItem;if(!u.consumable.test(_,{name:!0}))return;const{rows:C,headingRows:M,headingColumns:E}=function(K){let dt,Dt=0;const me=[],Ue=[];let qe;for(const pn of Array.from(K.getChildren())){if("tbody"!==pn.name&&"thead"!==pn.name&&"tfoot"!==pn.name)continue;"thead"!==pn.name||qe||(qe=pn);const Ln=Array.from(pn.getChildren()).filter(pi=>pi.is("element","tr"));for(const pi of Ln)if(qe&&pn===qe||"tbody"===pn.name&&Array.from(pi.getChildren()).length&&Array.from(pi.getChildren()).every(Ri=>Ri.is("element","th")))Dt++,me.push(pi);else{Ue.push(pi);const Ri=Ao(pi);(!dt||Ri
u.convertItem(K,u.writer.createPositionAt(j,"end"))),u.convertChildren(_,u.writer.createPositionAt(j,"end")),j.isEmpty){const K=u.writer.createElement("tableRow");u.writer.insert(K,u.writer.createPositionAt(j,"end")),An(u.writer,u.writer.createPositionAt(K,"end"))}u.updateConversionResult(j,c)}})}}()),_.for("editingDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:Ta(C,{asWidget:!0,additionalSlots:this._additionalSlots})}),_.for("dataDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:Ta(C,{additionalSlots:this._additionalSlots})}),_.for("upcast").elementToElement({model:"tableRow",view:"tr"}),_.for("upcast").add(M=>{M.on("element:tr",(E,N)=>{N.viewItem.isEmpty&&0==N.modelCursor.index&&E.stop()},{priority:"high"})}),_.for("downcast").elementToElement({model:"tableRow",view:(M,{writer:E})=>M.isEmpty?E.createEmptyElement("tr"):E.createContainerElement("tr")}),_.for("upcast").elementToElement({model:"tableCell",view:"td"}),_.for("upcast").elementToElement({model:"tableCell",view:"th"}),_.for("upcast").add(Vi("td")),_.for("upcast").add(Vi("th")),_.for("editingDowncast").elementToElement({model:"tableCell",view:oo({asWidget:!0})}),_.for("dataDowncast").elementToElement({model:"tableCell",view:oo()}),_.for("editingDowncast").elementToElement({model:"paragraph",view:Oa({asWidget:!0}),converterPriority:"high"}),_.for("dataDowncast").elementToElement({model:"paragraph",view:Oa(),converterPriority:"high"}),_.for("downcast").attributeToAttribute({model:"colspan",view:"colspan"}),_.for("upcast").attributeToAttribute({model:{key:"colspan",value:qy("colspan")},view:"colspan"}),_.for("downcast").attributeToAttribute({model:"rowspan",view:"rowspan"}),_.for("upcast").attributeToAttribute({model:{key:"rowspan",value:qy("rowspan")},view:"rowspan"}),r.config.define("table.defaultHeadings.rows",0),r.config.define("table.defaultHeadings.columns",0),r.commands.add("insertTable",new Mc(r)),r.commands.add("insertTableRowAbove",new b2(r,{order:"above"})),r.commands.add("insertTableRowBelow",new b2(r,{order:"below"})),r.commands.add("insertTableColumnLeft",new g6(r,{order:"left"})),r.commands.add("insertTableColumnRight",new g6(r,{order:"right"})),r.commands.add("removeTableRow",new Dy(r)),r.commands.add("removeTableColumn",new Py(r)),r.commands.add("splitTableCellVertically",new g3(r,{direction:"vertically"})),r.commands.add("splitTableCellHorizontally",new g3(r,{direction:"horizontally"})),r.commands.add("mergeTableCells",new $T(r)),r.commands.add("mergeTableCellRight",new iv(r,{direction:"right"})),r.commands.add("mergeTableCellLeft",new iv(r,{direction:"left"})),r.commands.add("mergeTableCellDown",new iv(r,{direction:"down"})),r.commands.add("mergeTableCellUp",new iv(r,{direction:"up"})),r.commands.add("setTableColumnHeader",new QT(r)),r.commands.add("setTableRowHeader",new GT(r)),r.commands.add("selectTableRow",new Xn(r)),r.commands.add("selectTableColumn",new Ya(r)),function XT(m){m.document.registerPostFixer(r=>function(c,u){const _=u.document.differ.getChanges();let C=!1;const M=new Set;for(const E of _){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")),ew(E)&&(N=E.range.start.findAncestor("table")),N&&!M.has(N)&&(C=tw(N,c)||C,C=o7(N,c)||C,M.add(N))}return C}(r,m))}(c),function nw(m){m.document.registerPostFixer(r=>function(c,u){const _=u.document.differ.getChanges();let C=!1;for(const M of _)"insert"==M.type&&"table"==M.name&&(C=iw(M.position.nodeAfter,c)||C),"insert"==M.type&&"tableRow"==M.name&&(C=Iy(M.position.nodeAfter,c)||C),"insert"==M.type&&"tableCell"==M.name&&(C=ov(M.position.nodeAfter,c)||C),"remove"!=M.type&&"insert"!=M.type||!ow(M)||(C=ov(M.position.parent,c)||C);return C}(r,m))}(c),this.listenTo(c.document,"change:data",()=>{(function(M,E){const N=M.document.differ;for(const j of N.getChanges()){let K,dt=!1;if("attribute"==j.type){const qe=j.range.start.nodeAfter;if(!qe||!qe.is("element","table")||"headingRows"!=j.attributeKey&&"headingColumns"!=j.attributeKey)continue;K=qe,dt="headingRows"==j.attributeKey}else"tableRow"!=j.name&&"tableCell"!=j.name||(K=j.position.findAncestor("table"),dt="tableRow"==j.name);if(!K)continue;const Dt=K.getAttribute("headingRows")||0,me=K.getAttribute("headingColumns")||0,Ue=new ro(K);for(const qe of Ue){const pn=qe.row
aw(Dt,E.mapper));for(const Dt of dt)E.reconvertItem(Dt)}}(c,r.editing)})}registerAdditionalSlot(r){this._additionalSlots.push(r)}}function qy(m){return r=>{const c=parseInt(r.getAttribute(m));return Number.isNaN(c)||c<=0?null:c}}var Ry=v(1613);Fo()(Ry.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});class cw extends oa{constructor(r){super(r);const c=this.bindTemplate;this.items=this._createGridCollection(),this.keystrokes=new $c,this.focusTracker=new as,this.set("rows",0),this.set("columns",0),this.bind("label").to(this,"columns",this,"rows",(u,_)=>`${_} \xd7 ${u}`),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":c.to("boxover")},children:this.items},{tag:"div",attributes:{class:["ck","ck-insert-table-dropdown__label"],"aria-hidden":!0},children:[{text:c.to("label")}]}],on:{mousedown:c.to(u=>{u.preventDefault()}),click:c.to(()=>{this.fire("execute")})}}),this.on("boxover",(u,_)=>{const{row:C,column:M}=_.target.dataset;this.items.get(10*(parseInt(C,10)-1)+(parseInt(M,10)-1)).focus()}),this.focusTracker.on("change:focusedElement",(u,_,C)=>{if(!C)return;const{row:M,column:E}=C.dataset;this.set({rows:parseInt(M),columns:parseInt(E)})}),this.on("change:columns",()=>this._highlightGridBoxes()),this.on("change:rows",()=>this._highlightGridBoxes())}render(){super.render(),function({keystrokeHandler:r,focusTracker:c,gridItems:u,numberOfColumns:_,uiLanguageDirection:C}){const M="number"==typeof _?()=>_:_;function E(K){return dt=>{const Dt=u.find(qe=>qe.element===c.focusedElement),me=u.getIndex(Dt),Ue=K(me,u);u.get(Ue).focus(),dt.stopPropagation(),dt.preventDefault()}}function N(K,dt){return K===dt-1?0:K+1}function j(K,dt){return 0===K?dt-1:K-1}r.set("arrowright",E((K,dt)=>"rtl"===C?j(K,dt.length):N(K,dt.length))),r.set("arrowleft",E((K,dt)=>"rtl"===C?N(K,dt.length):j(K,dt.length))),r.set("arrowup",E((K,dt)=>{let Dt=K-M();return Dt<0&&(Dt=K+M()*Math.floor(dt.length/M()),Dt>dt.length-1&&(Dt-=M())),Dt})),r.set("arrowdown",E((K,dt)=>{let Dt=K+M();return Dt>dt.length-1&&(Dt=K%M()),Dt}))}({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:10,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection});for(const r of this.items)this.focusTracker.add(r.element);this.keystrokes.listenTo(this.element)}focus(){this.items.get(0).focus()}focusLast(){this.items.get(0).focus()}_highlightGridBoxes(){const r=this.rows,c=this.columns;this.items.map((u,_)=>{const C=Math.floor(_/10){const C=r.commands.get("insertTable"),M=Op(_);let E;return M.bind("isEnabled").to(C),M.buttonView.set({icon:'',label:c("Insert table"),tooltip:!0}),M.on("change:isOpen",()=>{E||(E=new cw(_),M.panelView.children.add(E),E.delegate("execute").to(M),M.on("execute",()=>{r.execute("insertTable",{rows:E.rows,columns:E.columns}),r.editing.view.focus()}))}),M}),r.ui.componentFactory.add("tableColumn",_=>{const C=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:c("Header column"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:u?"insertTableColumnLeft":"insertTableColumnRight",label:c("Insert column left")}},{type:"button",model:{commandName:u?"insertTableColumnRight":"insertTableColumnLeft",label:c("Insert column right")}},{type:"button",model:{commandName:"removeTableColumn",label:c("Delete column")}},{type:"button",model:{commandName:"selectTableColumn",label:c("Select column")}}];return this._prepareDropdown(c("Column"),'',C,_)}),r.ui.componentFactory.add("tableRow",_=>{const C=[{type:"switchbutton",model:{commandName:"setTableRowHeader",label:c("Header row"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:"insertTableRowAbove",label:c("Insert row above")}},{type:"button",model:{commandName:"insertTableRowBelow",label:c("Insert row below")}},{type:"button",model:{commandName:"removeTableRow",label:c("Delete row")}},{type:"button",model:{commandName:"selectTableRow",label:c("Select row")}}];return this._prepareDropdown(c("Row"),'',C,_)}),r.ui.componentFactory.add("mergeTableCells",_=>{const C=[{type:"button",model:{commandName:"mergeTableCellUp",label:c("Merge cell up")}},{type:"button",model:{commandName:u?"mergeTableCellRight":"mergeTableCellLeft",label:c("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:c("Merge cell down")}},{type:"button",model:{commandName:u?"mergeTableCellLeft":"mergeTableCellRight",label:c("Merge cell left")}},{type:"separator"},{type:"button",model:{commandName:"splitTableCellVertically",label:c("Split cell vertically")}},{type:"button",model:{commandName:"splitTableCellHorizontally",label:c("Split cell horizontally")}}];return this._prepareMergeSplitButtonDropdown(c("Merge cells"),'',C,_)})}_prepareDropdown(r,c,u,_){const C=this.editor,M=Op(_),E=this._fillDropdownWithListOptions(M,u);return M.buttonView.set({label:r,icon:c,tooltip:!0}),M.bind("isEnabled").toMany(E,"isEnabled",(...N)=>N.some(j=>j)),this.listenTo(M,"execute",N=>{C.execute(N.source.commandName),N.source instanceof As||C.editing.view.focus()}),M}_prepareMergeSplitButtonDropdown(r,c,u,_){const C=this.editor,M=Op(_,m4),E="mergeTableCells",N=C.commands.get(E),j=this._fillDropdownWithListOptions(M,u);return M.buttonView.set({label:r,icon:c,tooltip:!0,isEnabled:!0}),M.bind("isEnabled").toMany([N,...j],"isEnabled",(...K)=>K.some(dt=>dt)),this.listenTo(M.buttonView,"execute",()=>{C.execute(E),C.editing.view.focus()}),this.listenTo(M,"execute",K=>{C.execute(K.source.commandName),C.editing.view.focus()}),M}_fillDropdownWithListOptions(r,c){const u=this.editor,_=[],C=new ec;for(const M of c)uw(M,u,_,C);return t1(r,C),_}}function uw(m,r,c,u){if("button"===m.type||"switchbutton"===m.type){const _=m.model=new M4(m.model),{commandName:C,bindIsOn:M}=m.model,E=r.commands.get(C);c.push(E),_.set({commandName:C}),_.bind("isEnabled").to(E),M&&_.bind("isOn").to(E,"value"),_.set({withText:!0})}u.add(m)}var a7=v(6945);Fo()(a7.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});class x3 extends lo{static get pluginName(){return"TableSelection"}static get requires(){return[s1,s1]}init(){const r=this.editor,u=r.editing.view;this.listenTo(r.model,"deleteContent",(_,C)=>this._handleDeleteContent(_,C),{priority:"high"}),this.listenTo(u.document,"insertText",(_,C)=>this._handleInsertTextEvent(_,C),{priority:"high"}),this._defineSelectionConverter(),this._enablePluginDisabling()}getSelectedTableCells(){const u=this.editor.plugins.get(s1).getSelectedTableCells(this.editor.model.document.selection);return 0==u.length?null:u}getSelectionAsFragment(){const r=this.editor.plugins.get(s1),c=this.getSelectedTableCells();return c?this.editor.model.change(u=>{const _=u.createDocumentFragment(),{first:C,last:M}=r.getColumnIndexes(c),{first:E,last:N}=r.getRowIndexes(c),j=c[0].findAncestor("table");let K=N,dt=M;if(r.isSelectionRectangular(c)){const me={firstColumn:C,lastColumn:M,firstRow:E,lastRow:N};K=n7(j,me),dt=My(j,me)}const Dt=b6(j,{startRow:E,startColumn:C,endRow:K,endColumn:dt},u);return u.insert(Dt,_,0),_}):null}setCellSelection(r,c){const u=this._getCellsToSelect(r,c);this.editor.model.change(_=>{_.setSelection(u.cells.map(C=>_.createRangeOn(C)),{backward:u.backward})})}getFocusCell(){const r=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return r&&r.is("element","tableCell")?r:null}getAnchorCell(){const r=os(this.editor.model.document.selection.getRanges()).getContainedElement();return r&&r.is("element","tableCell")?r:null}_defineSelectionConverter(){const r=this.editor,c=new Set;r.conversion.for("editingDowncast").add(u=>u.on("selection",(_,C,M)=>{const E=M.writer;!function(K){for(const dt of c)K.removeClass("ck-editor__editable_selected",dt);c.clear()}(E);const N=this.getSelectedTableCells();if(!N)return;for(const K of N){const dt=M.mapper.toViewElement(K);E.addClass("ck-editor__editable_selected",dt),c.add(dt)}const j=M.mapper.toViewElement(N[N.length-1]);E.setSelection(j,0)},{priority:"lowest"}))}_enablePluginDisabling(){const r=this.editor;this.on("change:isEnabled",()=>{if(!this.isEnabled){const c=this.getSelectedTableCells();if(!c)return;r.model.change(u=>{const _=u.createPositionAt(c[0],0),C=r.model.schema.getNearestSelectionRange(_);u.setSelection(C)})}})}_handleDeleteContent(r,c){const u=this.editor.plugins.get(s1),_=c[0],C=c[1],M=this.editor.model,E=!C||"backward"==C.direction,N=u.getSelectedTableCells(_);N.length&&(r.stop(),M.change(j=>{const K=N[E?N.length-1:0];M.change(Dt=>{for(const me of N)M.deleteContent(Dt.createSelection(me,"in"))});const dt=M.schema.getNearestSelectionRange(j.createPositionAt(K,0));_.is("documentSelection")?j.setSelection(dt):_.setTo(dt)}))}_handleInsertTextEvent(r,c){const u=this.editor,_=this.getSelectedTableCells();if(!_)return;const C=u.editing.view,M=u.editing.mapper,E=_.map(N=>C.createRangeOn(M.toViewElement(N)));c.selection=C.createSelection(E)}_getCellsToSelect(r,c){const u=this.editor.plugins.get("TableUtils"),_=u.getCellLocation(r),C=u.getCellLocation(c),M=Math.min(_.row,C.row),E=Math.max(_.row,C.row),N=Math.min(_.column,C.column),j=Math.max(_.column,C.column),K=new Array(E-M+1).fill(null).map(()=>[]),dt={startRow:M,endRow:E,startColumn:N,endColumn:j};for(const{row:Ue,cell:qe}of new ro(r.findAncestor("table"),dt))K[Ue-M].push(qe);const Dt=C.row<_.row,me=C.column<_.column;return Dt&&K.reverse(),me&&K.forEach(Ue=>Ue.reverse()),{cells:K.flat(),backward:Dt||me}}}class r7 extends lo{static get pluginName(){return"TableClipboard"}static get requires(){return[x3,s1]}init(){const r=this.editor,c=r.editing.view.document;this.listenTo(c,"copy",(u,_)=>this._onCopyCut(u,_)),this.listenTo(c,"cut",(u,_)=>this._onCopyCut(u,_)),this.listenTo(r.model,"insertContent",(u,[_,C])=>this._onInsertContent(u,_,C),{priority:"high"}),this.decorate("_replaceTableSlotCell")}_onCopyCut(r,c){const u=this.editor.plugins.get(x3);if(!u.getSelectedTableCells()||"cut"==r.name&&!this.editor.model.canEditAt(this.editor.model.document.selection))return;c.preventDefault(),r.stop();const C=this.editor.editing.view.document,M=this.editor.data.toView(u.getSelectionAsFragment());C.fire("clipboardOutput",{dataTransfer:c.dataTransfer,content:M,method:r.name})}_onInsertContent(r,c,u){if(u&&!u.is("documentSelection"))return;const _=this.editor.model,C=this.editor.plugins.get(s1);let M=this.getTableIfOnlyTableInContent(c,_);if(!M)return;const E=C.getSelectionAffectedTableCells(_.document.selection);E.length?(r.stop(),_.change(N=>{const j={width:C.getColumns(M),height:C.getRows(M)},K=function(pn,Ln,pi,Ri){const Go=pn[0].findAncestor("table"),ka=Ri.getColumnIndexes(pn),Ts=Ri.getRowIndexes(pn),$r={firstColumn:ka.first,lastColumn:ka.last,firstRow:Ts.first,lastRow:Ts.last},Il=1===pn.length;return Il&&($r.lastRow+=Ln.height-1,$r.lastColumn+=Ln.width-1,function(hl,T6,v2,Rp){const Uf=Rp.getColumns(hl),x2=Rp.getRows(hl);v2>Uf&&Rp.insertColumns(hl,{at:Uf,columns:v2-Uf}),T6>x2&&Rp.insertRows(hl,{at:x2,rows:T6-x2})}(Go,$r.lastRow+1,$r.lastColumn+1,Ri)),Il||!Ri.isSelectionRectangular(pn)?function(hl,T6,v2){const{firstRow:Rp,lastRow:Uf,firstColumn:x2,lastColumn:C3}=T6,iT={first:Rp,last:Uf},f7={first:x2,last:C3};qa(hl,x2,iT,v2),qa(hl,C3+1,iT,v2),s7(hl,Rp,f7,v2),s7(hl,Uf+1,f7,v2,Rp)}(Go,$r,pi):($r.lastRow=n7(Go,$r),$r.lastColumn=My(Go,$r)),$r}(E,j,N,C),Dt=K.lastColumn-K.firstColumn+1,me={startRow:0,startColumn:0,endRow:Math.min(K.lastRow-K.firstRow+1,j.height)-1,endColumn:Math.min(Dt,j.width)-1};M=b6(M,me,N);const Ue=E[0].findAncestor("table"),qe=this._replaceSelectedCellsWithPasted(M,j,Ue,K,N);if(this.editor.plugins.get("TableSelection").isEnabled){const pn=C.sortRanges(qe.map(Ln=>N.createRangeOn(Ln)));N.setSelection(pn)}else N.setSelection(qe[0],0)})):e7(M,C)}_replaceSelectedCellsWithPasted(r,c,u,_,C){const{width:M,height:E}=c,N=function(pn,Ln,pi){const Ri=new Array(pi).fill(null).map(()=>new Array(Ln).fill(null));for(const{column:Go,row:ka,cell:Ts}of new ro(pn))Ri[ka][Go]=Ts;return Ri}(r,M,E),j=[...new ro(u,{startRow:_.firstRow,endRow:_.lastRow,startColumn:_.firstColumn,endColumn:_.lastColumn,includeAllSlots:!0})],K=[];let dt;for(const pn of j){const{row:Ln,column:pi}=pn;pi===_.firstColumn&&(dt=pn.getPositionBefore());const ka=N[(Ln-_.firstRow)%E][(pi-_.firstColumn)%M],Ts=ka?C.cloneElement(ka):null,$r=this._replaceTableSlotCell(pn,Ts,dt,C);$r&&(b3($r,Ln,pi,_.lastRow,_.lastColumn,C),K.push($r),dt=C.createPositionAfter($r))}const Dt=parseInt(u.getAttribute("headingRows")||"0"),me=parseInt(u.getAttribute("headingColumns")||"0"),qe=_.firstColumnCa(C,M,c)).map(({cell:C})=>x6(C,r,u))}function qa(m,r,c,u){if(!(r<1))return C6(m,r).filter(({row:_,cellHeight:C})=>Ca(_,C,c)).map(({cell:_,column:C})=>A6(_,C,r,u))}function Ca(m,r,c){const u=m+r-1,{first:_,last:C}=c;return m>=_&&m<=C||m<_&&u>=_}class lr extends lo{static get pluginName(){return"TableKeyboard"}static get requires(){return[x3,s1]}init(){const r=this.editor.editing.view.document;this.listenTo(r,"arrowKey",(...c)=>this._onArrowKey(...c),{context:"table"}),this.listenTo(r,"tab",(...c)=>this._handleTabOnSelectedTable(...c),{context:"figure"}),this.listenTo(r,"tab",(...c)=>this._handleTab(...c),{context:["th","td"]})}_handleTabOnSelectedTable(r,c){const u=this.editor,_=u.model.document.selection.getSelectedElement();_&&_.is("element","table")&&(c.preventDefault(),c.stopPropagation(),r.stop(),u.model.change(C=>{C.setSelection(C.createRangeIn(_.getChild(0).getChild(0)))}))}_handleTab(r,c){const u=this.editor,_=this.editor.plugins.get(s1),C=this.editor.plugins.get("TableSelection"),E=!c.shiftKey;let N=_.getTableCellsContainingSelection(u.model.document.selection)[0];if(N||(N=C.getFocusCell()),!N)return;c.preventDefault(),c.stopPropagation(),r.stop();const j=N.parent,K=j.parent,dt=K.getChildIndex(j),Dt=j.getChildIndex(N),me=0===Dt;if(!E&&me&&0===dt)return void u.model.change(Ln=>{Ln.setSelection(Ln.createRangeOn(K))});const Ue=Dt===j.childCount-1,qe=dt===_.getRows(K)-1;if(E&&qe&&Ue&&(u.execute("insertTableRowBelow"),dt===_.getRows(K)-1))return void u.model.change(Ln=>{Ln.setSelection(Ln.createRangeOn(K))});let pn;if(E&&Ue)pn=K.getChild(dt+1).getChild(0);else if(!E&&me){const Ln=K.getChild(dt-1);pn=Ln.getChild(Ln.childCount-1)}else pn=j.getChild(Dt+(E?1:-1));u.model.change(Ln=>{Ln.setSelection(Ln.createRangeIn(pn))})}_onArrowKey(r,c){const _=b1(c.keyCode,this.editor.locale.contentLanguageDirection);this._handleArrowKeys(_,c.shiftKey)&&(c.preventDefault(),c.stopPropagation(),r.stop())}_handleArrowKeys(r,c){const u=this.editor.plugins.get(s1),_=this.editor.plugins.get("TableSelection"),C=this.editor.model,M=C.document.selection,E=["right","down"].includes(r),N=u.getSelectedTableCells(M);if(N.length){let K;return K=c?_.getFocusCell():E?N[N.length-1]:N[0],this._navigateFromCellInDirection(K,r,c),!0}const j=M.focus.findAncestor("tableCell");if(!j)return!1;if(!M.isCollapsed)if(c){if(M.isBackward==E&&!M.containsEntireContent(j))return!1}else{const K=M.getSelectedElement();if(!K||!C.schema.isObject(K))return!1}return!!this._isSelectionAtCellEdge(M,j,E)&&(this._navigateFromCellInDirection(j,r,c),!0)}_isSelectionAtCellEdge(r,c,u){const _=this.editor.model,C=this.editor.model.schema,M=u?r.getLastPosition():r.getFirstPosition();if(!C.getLimitElement(M).is("element","tableCell"))return _.createPositionAt(c,u?"end":0).isTouching(M);const E=_.createSelection(M);return _.modifySelection(E,{direction:u?"forward":"backward"}),M.isEqual(E.focus)}_navigateFromCellInDirection(r,c,u=!1){const _=this.editor.model,C=r.findAncestor("table"),M=[...new ro(C,{includeAllSlots:!0})],{row:E,column:N}=M[M.length-1],j=M.find(({cell:qe})=>qe==r);let{row:K,column:dt}=j;switch(c){case"left":dt--;break;case"up":K--;break;case"right":dt+=j.cellWidth;break;case"down":K+=j.cellHeight}if(K<0||K>E||dt<0&&K<=0||dt>N&&K>=E)return void _.change(qe=>{qe.setSelection(qe.createRangeOn(C))});dt<0?(dt=u?0:N,K--):dt>N&&(dt=u?N:0,K++);const Dt=M.find(qe=>qe.row==K&&qe.column==dt).cell,me=["right","down"].includes(c),Ue=this.editor.plugins.get("TableSelection");if(u&&Ue.isEnabled){const qe=Ue.getAnchorCell()||r;Ue.setCellSelection(qe,Dt)}else{const qe=_.createPositionAt(Dt,me?0:"end");_.change(pn=>{pn.setSelection(qe)})}}}class Hy extends Wu{constructor(){super(...arguments),this.domEventType=["mousemove","mouseleave"]}onDomEvent(r){this.fire(r.type,r)}}class pw extends lo{static get pluginName(){return"TableMouse"}static get requires(){return[x3,s1]}init(){this.editor.editing.view.addObserver(Hy),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){const r=this.editor,c=r.plugins.get(s1);let u=!1;const _=r.plugins.get(x3);this.listenTo(r.editing.view.document,"mousedown",(C,M)=>{const E=r.model.document.selection;if(!this.isEnabled||!_.isEnabled||!M.domEvent.shiftKey)return;const N=_.getAnchorCell()||c.getTableCellsContainingSelection(E)[0];if(!N)return;const j=this._getModelTableCellFromDomEvent(M);j&&zy(N,j)&&(u=!0,_.setCellSelection(N,j),M.preventDefault())}),this.listenTo(r.editing.view.document,"mouseup",()=>{u=!1}),this.listenTo(r.editing.view.document,"selectionChange",C=>{u&&C.stop()},{priority:"highest"})}_enableMouseDragSelection(){const r=this.editor;let c,u,_=!1,C=!1;const M=r.plugins.get(x3);this.listenTo(r.editing.view.document,"mousedown",(E,N)=>{this.isEnabled&&M.isEnabled&&(N.domEvent.shiftKey||N.domEvent.ctrlKey||N.domEvent.altKey||(c=this._getModelTableCellFromDomEvent(N)))}),this.listenTo(r.editing.view.document,"mousemove",(E,N)=>{if(!N.domEvent.buttons||!c)return;const j=this._getModelTableCellFromDomEvent(N);j&&zy(c,j)&&(u=j,_||u==c||(_=!0)),_&&(C=!0,M.setCellSelection(c,u),N.preventDefault())}),this.listenTo(r.editing.view.document,"mouseup",()=>{_=!1,C=!1,c=null,u=null}),this.listenTo(r.editing.view.document,"selectionChange",E=>{C&&E.stop()},{priority:"highest"})}_getModelTableCellFromDomEvent(r){const u=this.editor.editing.view.createPositionAt(r.target,0);return this.editor.editing.mapper.toModelPosition(u).parent.findAncestor("tableCell",{includeSelf:!0})}}function zy(m,r){return m.parent.parent==r.parent.parent}var c7=v(6306);function _w(m){const r=m.getSelectedElement();return r&&l7(r)?r:null}function By(m){const r=m.getFirstPosition();if(!r)return null;let c=r.parent;for(;c;){if(c.is("element")&&l7(c))return c;c=c.parent}return null}function l7(m){return!!m.getCustomProperty("table")&&El(m)}Fo()(c7.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});var s8=v(7368);Fo()(s8.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});var Yy=v(9247);Fo()(Yy.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});var jy=v(4070);Fo()(jy.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});var Gy=v(6237);Fo()(Gy.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});var Qy=v(5087);Fo()(Qy.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});var Wy=v(7341);Fo()(Wy.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});var c8=v(2128);Fo()(c8.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});var Ky=v(4101);Fo()(Ky.Z,{injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0});var vw=Object.defineProperty,u7=Object.getOwnPropertySymbols,d7=Object.prototype.hasOwnProperty,wf=Object.prototype.propertyIsEnumerable,tT=(m,r,c)=>r in m?vw(m,r,{enumerable:!0,configurable:!0,writable:!0,value:c}):m[r]=c,av=(m,r)=>{for(var c in r||(r={}))d7.call(r,c)&&tT(m,c,r[c]);if(u7)for(var c of u7(r))wf.call(r,c)&&tT(m,c,r[c]);return m};const xw={autoRefresh:!0};class p7 extends(Ze()){constructor(r,c={}){if(super(),!r)throw new at("token-missing-token-url",this);c.initValue&&this._validateTokenValue(c.initValue),this.set("value",c.initValue),this._refresh="function"==typeof r?r:()=>{return u=r,new Promise((_,C)=>{const M=new XMLHttpRequest;M.open("GET",u),M.addEventListener("load",()=>{const E=M.status,N=M.response;return E<200||E>299?C(new at("token-cannot-download-new-token",null)):_(N)}),M.addEventListener("error",()=>C(new Error("Network Error"))),M.addEventListener("abort",()=>C(new Error("Abort"))),M.send()});var u},this._options=av(av({},xw),c)}init(){return new Promise((r,c)=>{this.value?(this._options.autoRefresh&&this._registerRefreshTokenTimeout(),r(this)):this.refreshToken().then(r).catch(c)})}refreshToken(){return this._refresh().then(r=>(this._validateTokenValue(r),this.set("value",r),this._options.autoRefresh&&this._registerRefreshTokenTimeout(),this))}destroy(){clearTimeout(this._tokenRefreshTimeout)}_validateTokenValue(r){const c="string"==typeof r,u=!/^".*"$/.test(r),_=c&&3===r.split(".").length;if(!u||!_)throw new at("token-not-in-jwt-format",this)}_registerRefreshTokenTimeout(){const r=this._getTokenRefreshTimeoutTime();clearTimeout(this._tokenRefreshTimeout),this._tokenRefreshTimeout=setTimeout(()=>{this.refreshToken()},r)}_getTokenRefreshTimeoutTime(){try{const[,r]=this.value.split("."),{exp:c}=JSON.parse(atob(r));return c?Math.floor((1e3*c-Date.now())/2):36e5}catch{return 36e5}}static create(r,c={}){return new p7(r,c).init()}}const m7=/^data:(\S*?);base64,/;class Cw extends(Ne()){constructor(r,c,u){if(super(),!r)throw new at("fileuploader-missing-file",null);if(!c)throw new at("fileuploader-missing-token",null);if(!u)throw new at("fileuploader-missing-api-address",null);this.file=function(_){if("string"!=typeof _)return!1;const C=_.match(m7);return!(!C||!C.length)}(r)?function(_,C=512){try{const M=_.match(m7)[1],E=atob(_.replace(m7,"")),N=[];for(let j=0;jr(u)),this}onError(r){return this.once("error",(c,u)=>r(u)),this}abort(){this.xhr.abort()}send(){return this._prepareRequest(),this._attachXHRListeners(),this._sendRequest()}_prepareRequest(){const r=new XMLHttpRequest;r.open("POST",this._apiAddress),r.setRequestHeader("Authorization",this._token.value),r.responseType="json",this.xhr=r}_attachXHRListeners(){const r=this.xhr,c=u=>()=>this.fire("error",u);r.addEventListener("error",c("Network Error")),r.addEventListener("abort",c("Abort")),r.upload&&r.upload.addEventListener("progress",u=>{u.lengthComputable&&this.fire("progress",{total:u.total,uploaded:u.loaded})}),r.addEventListener("load",()=>{const u=r.status,_=r.response;if(u<200||u>299)return this.fire("error",_.message||_.error)})}_sendRequest(){const r=new FormData,c=this.xhr;return r.append("file",this.file),new Promise((u,_)=>{c.addEventListener("load",()=>{const C=c.status,M=c.response;return C<200||C>299?_(M.message?new at("fileuploader-uploading-data-failed",this,{message:M.message}):M.error):u(M)}),c.addEventListener("error",()=>_(new Error("Network Error"))),c.addEventListener("abort",()=>_(new Error("Abort"))),c.send(r)})}}class eT{constructor(r,c){if(!r)throw new at("uploadgateway-missing-token",null);if(!c)throw new at("uploadgateway-missing-api-address",null);this._token=r,this._apiAddress=c}upload(r){return new Cw(r,this._token,this._apiAddress)}}class Aw extends w_{static get pluginName(){return"CloudServicesCore"}createToken(r,c){return new p7(r,c)}createUploadGateway(r,c){return new eT(r,c)}}var nT=(m,r,c)=>new Promise((u,_)=>{var C=N=>{try{E(c.next(N))}catch(j){_(j)}},M=N=>{try{E(c.throw(N))}catch(j){_(j)}},E=N=>N.done?u(N.value):Promise.resolve(N.value).then(C,M);E((c=c.apply(m,r)).next())});class _7 extends Y0{}_7.builtinPlugins=[class extends lo{static get requires(){return[Ax,Tm,G8,N8,Ba,Sx]}static get pluginName(){return"Essentials"}},class extends lo{static get requires(){return[ip]}static get pluginName(){return"CKFinderUploadAdapter"}init(){const m=this.editor.config.get("ckfinder.uploadUrl");m&&(this.editor.plugins.get(ip).createUploadAdapter=r=>new tA(r,m,this.editor.t))}},class extends lo{static get requires(){return[r_]}static get pluginName(){return"Autoformat"}afterInit(){this._addListAutoformats(),this._addBasicStylesAutoformats(),this._addHeadingAutoformats(),this._addBlockQuoteAutoformats(),this._addCodeBlockAutoformats(),this._addHorizontalLineAutoformats()}_addListAutoformats(){const m=this.editor.commands;m.get("bulletedList")&&qp(this.editor,this,/^[*-]\s$/,"bulletedList"),m.get("numberedList")&&qp(this.editor,this,/^1[.|)]\s$/,"numberedList"),m.get("todoList")&&qp(this.editor,this,/^\[\s?\]\s$/,"todoList"),m.get("checkTodoList")&&qp(this.editor,this,/^\[\s?x\s?\]\s$/,()=>{this.editor.execute("todoList"),this.editor.execute("checkTodoList")})}_addBasicStylesAutoformats(){const m=this.editor.commands;if(m.get("bold")){const r=jh(this.editor,"bold");f2(this.editor,this,/(?:^|\s)(\*\*)([^*]+)(\*\*)$/g,r),f2(this.editor,this,/(?:^|\s)(__)([^_]+)(__)$/g,r)}if(m.get("italic")){const r=jh(this.editor,"italic");f2(this.editor,this,/(?:^|\s)(\*)([^*_]+)(\*)$/g,r),f2(this.editor,this,/(?:^|\s)(_)([^_]+)(_)$/g,r)}if(m.get("code")){const r=jh(this.editor,"code");f2(this.editor,this,/(`)([^`]+)(`)$/g,r)}if(m.get("strikethrough")){const r=jh(this.editor,"strikethrough");f2(this.editor,this,/(~~)([^~]+)(~~)$/g,r)}}_addHeadingAutoformats(){const m=this.editor.commands.get("heading");m&&m.modelElements.filter(r=>r.match(/^heading[1-6]$/)).forEach(r=>{const u=new RegExp(`^(#{${r[7]}})\\s$`);qp(this.editor,this,u,()=>{if(!m.isEnabled||m.value===r)return!1;this.editor.execute("heading",{value:r})})})}_addBlockQuoteAutoformats(){this.editor.commands.get("blockQuote")&&qp(this.editor,this,/^>\s$/,"blockQuote")}_addCodeBlockAutoformats(){const m=this.editor,r=m.model.document.selection;m.commands.get("codeBlock")&&qp(m,this,/^```$/,()=>{if(r.getFirstPosition().parent.is("element","listItem"))return!1;this.editor.execute("codeBlock",{usePreviousLanguageChoice:!0})})}_addHorizontalLineAutoformats(){this.editor.commands.get("horizontalLine")&&qp(this.editor,this,/^---$/,"horizontalLine")}},class extends lo{static get requires(){return[j5,G5]}static get pluginName(){return"Bold"}},class extends lo{static get requires(){return[oy,V4]}static get pluginName(){return"Italic"}},class extends lo{static get requires(){return[W5,Fx]}static get pluginName(){return"BlockQuote"}},class extends lo{static get pluginName(){return"CKBox"}static get requires(){return[K5,Nx]}},class extends lo{static get pluginName(){return"CKFinder"}static get requires(){return["Link","CKFinderUploadAdapter",Yx,zx]}},class extends w_{constructor(){super(...arguments),this.token=null,this._tokens=new Map}static get pluginName(){return"CloudServices"}static get requires(){return[Aw]}init(){return nT(this,null,function*(){const m=this.context.config.get("cloudServices")||{};for(const[c,u]of Object.entries(m))this[c]=u;if(!this.tokenUrl)return void(this.token=null);const r=this.context.plugins.get("CloudServicesCore");this.token=yield r.createToken(this.tokenUrl).init(),this._tokens.set(this.tokenUrl,this.token)})}registerTokenUrl(m){return nT(this,null,function*(){if(this._tokens.has(m))return this.getTokenFor(m);const r=this.context.plugins.get("CloudServicesCore"),c=yield r.createToken(m).init();return this._tokens.set(m,c),c})}getTokenFor(m){const r=this._tokens.get(m);if(!r)throw new at("cloudservices-token-not-registered",this);return r}destroy(){super.destroy();for(const m of this._tokens.values())m.destroy()}},class extends lo{static get pluginName(){return"EasyImage"}static get requires(){return[cA,"ImageUpload"]}init(){const m=this.editor;m.plugins.has("ImageBlockEditing")||m.plugins.has("ImageInlineEditing")||Zt("easy-image-image-feature-missing",m)}},class extends lo{static get requires(){return[ob,Jx]}static get pluginName(){return"Heading"}},class extends lo{static get requires(){return[tC,gA]}static get pluginName(){return"Image"}},class extends lo{static get requires(){return[bA,hb]}static get pluginName(){return"ImageCaption"}},class extends lo{static get requires(){return[fC,cy]}static get pluginName(){return"ImageStyle"}},class extends lo{static get requires(){return[J0,Sd]}static get pluginName(){return"ImageToolbar"}afterInit(){const m=this.editor,r=m.t,c=m.plugins.get(J0),u=m.plugins.get("ImageUtils");var _;c.register("image",{ariaLabel:r("Image toolbar"),items:(_=m.config.get("image.toolbar")||[],_.map(C=>Kt(C)?C.name:C)),getRelatedElement:C=>u.getClosestSelectedImageWidget(C)})}},class extends lo{static get pluginName(){return"ImageUpload"}static get requires(){return[yf,bb,CA]}},class extends lo{static get pluginName(){return"Indent"}static get requires(){return[a6,s3]}},class extends lo{static get requires(){return[zb,qA,u6]}static get pluginName(){return"Link"}},class extends lo{static get requires(){return[tv,HA]}static get pluginName(){return"List"}},class extends lo{static get requires(){return[nv,$A,WA,j0]}static get pluginName(){return"MediaEmbed"}},nb,class extends lo{static get pluginName(){return"PasteFromOffice"}static get requires(){return[Np]}init(){const m=this.editor,r=m.plugins.get("ClipboardPipeline"),c=m.editing.view.document,u=[];u.push(new g(c)),u.push(new V(c)),u.push(new kt(c)),r.on("inputTransformation",(_,C)=>{if(C._isTransformedWithPasteFromOffice||m.model.document.selection.getFirstPosition().parent.is("element","codeBlock"))return;const M=C.dataTransfer.getData("text/html"),E=u.find(N=>N.isActive(M));E&&(C._parsedData||(C._parsedData=function ye(m,r){const c=new DOMParser,u=jt(jt(function(N){const j="",dt=N.indexOf(j);if(dt<0)return N;const Dt=N.indexOf("