Update the CKEditor 5 bundle
authorAlexander Ebert <ebert@woltlab.com>
Mon, 26 Aug 2024 13:38:35 +0000 (15:38 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 26 Aug 2024 13:38:35 +0000 (15:38 +0200)
wcfsetup/install/files/js/3rdParty/ckeditor/ckeditor5.bundle.js

index 26e81e998963597ad9008a25f5a92ede909c9e17..478d61b1738ace510f6cf2ebd9993fab9fb7e70f 100644 (file)
@@ -1,2 +1,2 @@
 /*! For license information please see ckeditor5.bundle.js.LICENSE.txt */
-!function(e){const t=e.en=e.en||{};t.dictionary=Object.assign(t.dictionary||{},{"(may require <kbd>Fn</kbd>)":"(may require <kbd>Fn</kbd>)","%0 of %1":"%0 of %1",Accept:"Accept",Accessibility:"Accessibility","Accessibility help":"Accessibility help","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 center":"Align center","Align left":"Align left","Align right":"Align right","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","Below, you can find a list of keyboard shortcuts that can be used in the editor.":"Below, you can find a list of keyboard shortcuts that can be used in the editor.",Big:"Big",Black:"Black","Block quote":"Block quote",Blue:"Blue","Blue marker":"Blue marker",Bold:"Bold","Bold text":"Bold text",Border:"Border","Break text":"Break text","Bulleted List":"Bulleted List","Bulleted list styles toolbar":"Bulleted list styles toolbar",Cancel:"Cancel","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","Choose language":"Choose language",Circle:"Circle",Clear:"Clear","Click to edit block":"Click to edit block",Close:"Close","Close contextual balloons, dropdowns, and dialogs":"Close contextual balloons, dropdowns, and dialogs",Code:"Code","Code block":"Code block",Color:"Color","Color picker":"Color picker",Column:"Column","Content editing keystrokes":"Content editing keystrokes","Copy selected content":"Copy selected content","Create link":"Create link",Custom:"Custom","Custom image size":"Custom image size",Dashed:"Dashed",Decimal:"Decimal","Decimal with leading zero":"Decimal with leading zero","Decrease indent":"Decrease indent","Decrease list item indent":"Decrease list item indent",Default:"Default","Delete column":"Delete column","Delete row":"Delete row","Dim grey":"Dim grey",Dimensions:"Dimensions",Disc:"Disc","Document colors":"Document colors",Dotted:"Dotted",Double:"Double",Downloadable:"Downloadable","Drag to move":"Drag to move","Dropdown toolbar":"Dropdown toolbar","Edit block":"Edit block","Edit link":"Edit link","Edit source":"Edit source","Editor block content toolbar":"Editor block content toolbar","Editor contextual toolbar":"Editor contextual toolbar","Editor dialog":"Editor dialog","Editor editing area: %0":"Editor editing area: %0","Editor menu bar":"Editor menu bar","Editor toolbar":"Editor toolbar","Empty snippet content":"Empty snippet content","Enter image caption":"Enter image caption","Enter table caption":"Enter table caption","Entering %0 code snippet":"Entering %0 code snippet","Entering a to-do list":"Entering a to-do list","Entering code snippet":"Entering code snippet","Error during image upload":"Error during image upload","Execute the currently focused button. Executing buttons that interact with the editor content moves the focus back to the content.":"Execute the currently focused button. Executing buttons that interact with the editor content moves the focus back to the content.","Font Background Color":"Font Background Color","Font Color":"Font Color","Font Family":"Font Family","Font Size":"Font Size","From computer":"From computer","Full size image":"Full size image",Green:"Green","Green marker":"Green marker","Green pen":"Green pen",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","Help Contents. To close this dialog press ESC.":"Help Contents. To close this dialog press ESC.",HEX:"HEX",Highlight:"Highlight","Horizontal line":"Horizontal line","Horizontal text alignment toolbar":"Horizontal text alignment toolbar","HTML snippet":"HTML snippet",Huge:"Huge",Image:"Image","Image from computer":"Image from computer","Image resize list":"Image resize list","Image toolbar":"Image toolbar","Image upload complete":"Image upload complete","Image via URL":"Image via URL","image widget":"image widget","In line":"In line","Increase indent":"Increase indent","Increase list item indent":"Increase list item indent","Insert a hard break (a new paragraph)":"Insert a hard break (a new paragraph)","Insert a new paragraph directly after a widget":"Insert a new paragraph directly after a widget","Insert a new paragraph directly before a widget":"Insert a new paragraph directly before a widget","Insert a new table row (when in the last cell of a table)":"Insert a new table row (when in the last cell of a table)","Insert a soft break (a <code>&lt;br&gt;</code> element)":"Insert a soft break (a <code>&lt;br&gt;</code> element)","Insert code block":"Insert code block","Insert column left":"Insert column left","Insert column right":"Insert column right","Insert HTML":"Insert HTML","Insert image":"Insert image","Insert image via URL":"Insert image via URL","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","Insert via URL":"Insert via URL",Inset:"Inset","Invalid start index value.":"Invalid start index value.",Italic:"Italic","Italic text":"Italic text",Justify:"Justify","Justify cell text":"Justify cell text","Keystrokes that can be used in a list":"Keystrokes that can be used in a list","Keystrokes that can be used in a table cell":"Keystrokes that can be used in a table cell","Keystrokes that can be used when a widget is selected (for example: image, table, etc.)":"Keystrokes that can be used when a widget is selected (for example: image, table, etc.)",Language:"Language","Leaving %0 code snippet":"Leaving %0 code snippet","Leaving a to-do list":"Leaving a to-do list","Leaving code snippet":"Leaving code snippet","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","Link URL must not be empty.":"Link URL must not be empty.","List properties":"List properties","Lower-latin":"Lower-latin","Lower–roman":"Lower–roman",MENU_BAR_MENU_EDIT:"Edit",MENU_BAR_MENU_FILE:"File",MENU_BAR_MENU_FONT:"Font",MENU_BAR_MENU_FORMAT:"Format",MENU_BAR_MENU_HELP:"Help",MENU_BAR_MENU_INSERT:"Insert",MENU_BAR_MENU_TEXT:"Text",MENU_BAR_MENU_TOOLS:"Tools",MENU_BAR_MENU_VIEW:"View","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","Move focus between form fields (inputs, buttons, etc.)":"Move focus between form fields (inputs, buttons, etc.)","Move focus from an editable area back to the parent widget":"Move focus from an editable area back to the parent widget","Move focus in and out of an active dialog window":"Move focus in and out of an active dialog window","Move focus to the menu bar, navigate between menu bars":"Move focus to the menu bar, navigate between menu bars","Move focus to the toolbar, navigate between toolbars":"Move focus to the toolbar, navigate between toolbars","Move out of a link":"Move out of a link","Move out of an inline code style":"Move out of an inline code style","Move the caret to allow typing directly after a widget":"Move the caret to allow typing directly after a widget","Move the caret to allow typing directly before a widget":"Move the caret to allow typing directly before a widget","Move the selection to the next cell":"Move the selection to the next cell","Move the selection to the previous cell":"Move the selection to the previous cell","Navigate through the table":"Navigate through the table","Navigate through the toolbar or menu bar":"Navigate through the toolbar or menu bar",Next:"Next","No preview available":"No preview available","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 in a new tab":"Open in a new tab","Open link in new tab":"Open link in new tab","Open the accessibility help dialog":"Open the accessibility help dialog",Orange:"Orange",Original:"Original",Outset:"Outset",Padding:"Padding",Paragraph:"Paragraph","Paste content":"Paste content","Paste content as plain text":"Paste content as plain text","Paste raw HTML here...":"Paste raw HTML here...","Pink marker":"Pink marker","Plain text":"Plain text",'Please enter a valid color (e.g. "ff0000").':'Please enter a valid color (e.g. "ff0000").',"Press %0 for help.":"Press %0 for help.","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","Red pen":"Red pen",Redo:"Redo","Remove color":"Remove color","Remove Format":"Remove Format","Remove highlight":"Remove highlight","Remove language":"Remove language","Replace from computer":"Replace from computer","Replace image":"Replace image","Replace image from computer":"Replace image from computer","Resize image":"Resize image","Resize image (in %0)":"Resize image (in %0)","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","Save changes":"Save changes","Saving changes":"Saving changes","Select all":"Select all","Select column":"Select column","Select row":"Select row","Show more items":"Show more items","Side image":"Side image",Small:"Small",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","Strikethrough text":"Strikethrough text",Style:"Style",Subscript:"Subscript",Superscript:"Superscript",Table:"Table","Table alignment toolbar":"Table alignment toolbar","Table cell text alignment":"Table cell text alignment","Table properties":"Table properties","Table toolbar":"Table toolbar","Text alignment":"Text alignment","Text alignment toolbar":"Text alignment toolbar","Text alternative":"Text alternative","Text highlight toolbar":"Text highlight toolbar",'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 value is invalid. Try "10px" or "2em" or simply "2".':'The value is invalid. Try "10px" or "2em" or simply "2".',"The value must not be empty.":"The value must not be empty.","The value should be a plain number.":"The value should be a plain number.","These keyboard shortcuts allow for quick access to content editing features.":"These keyboard shortcuts allow for quick access to content editing features.","This link has no URL":"This link has no URL",Tiny:"Tiny","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–latin list style":"Toggle the lower–latin list style","Toggle the lower–roman list style":"Toggle the lower–roman list style","Toggle the square list style":"Toggle the square list style","Toggle the upper–latin list style":"Toggle the upper–latin list style","Toggle the upper–roman list style":"Toggle the upper–roman list style",Turquoise:"Turquoise","Type or paste your content here.":"Type or paste your content here.","Type your title":"Type your title",Underline:"Underline","Underline text":"Underline text",Undo:"Undo",Unlink:"Unlink","Update image URL":"Update image URL","Upload failed":"Upload failed","Upload from computer":"Upload from computer","Upload image from computer":"Upload image from computer","Upload in progress":"Upload in progress","Uploading image":"Uploading image","Upper-latin":"Upper-latin","Upper-roman":"Upper-roman","Use the following keystrokes for more efficient navigation in the CKEditor 5 user interface.":"Use the following keystrokes for more efficient navigation in the CKEditor 5 user interface.","User interface and content navigation keystrokes":"User interface and content navigation keystrokes","Vertical text alignment toolbar":"Vertical text alignment toolbar","Via URL":"Via URL",White:"White","Widget toolbar":"Widget toolbar",Width:"Width","Wrap text":"Wrap text",Yellow:"Yellow","Yellow marker":"Yellow marker","You have no image upload permissions.":"You have no image upload permissions."})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),define("@woltlab/editor",[],(()=>(()=>{var e,t,i={5659:(e,t,i)=>{const n=i(8156),o={};for(const e of Object.keys(n))o[n[e]]=e;const s={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};e.exports=s;for(const e of Object.keys(s)){if(!("channels"in s[e]))throw new Error("missing channels property: "+e);if(!("labels"in s[e]))throw new Error("missing channel labels property: "+e);if(s[e].labels.length!==s[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:i}=s[e];delete s[e].channels,delete s[e].labels,Object.defineProperty(s[e],"channels",{value:t}),Object.defineProperty(s[e],"labels",{value:i})}s.rgb.hsl=function(e){const t=e[0]/255,i=e[1]/255,n=e[2]/255,o=Math.min(t,i,n),s=Math.max(t,i,n),r=s-o;let a,l;s===o?a=0:t===s?a=(i-n)/r:i===s?a=2+(n-t)/r:n===s&&(a=4+(t-i)/r),a=Math.min(60*a,360),a<0&&(a+=360);const c=(o+s)/2;return l=s===o?0:c<=.5?r/(s+o):r/(2-s-o),[a,100*l,100*c]},s.rgb.hsv=function(e){let t,i,n,o,s;const r=e[0]/255,a=e[1]/255,l=e[2]/255,c=Math.max(r,a,l),d=c-Math.min(r,a,l),u=function(e){return(c-e)/6/d+.5};return 0===d?(o=0,s=0):(s=d/c,t=u(r),i=u(a),n=u(l),r===c?o=n-i:a===c?o=1/3+t-n:l===c&&(o=2/3+i-t),o<0?o+=1:o>1&&(o-=1)),[360*o,100*s,100*c]},s.rgb.hwb=function(e){const t=e[0],i=e[1];let n=e[2];const o=s.rgb.hsl(e)[0],r=1/255*Math.min(t,Math.min(i,n));return n=1-1/255*Math.max(t,Math.max(i,n)),[o,100*r,100*n]},s.rgb.cmyk=function(e){const t=e[0]/255,i=e[1]/255,n=e[2]/255,o=Math.min(1-t,1-i,1-n);return[100*((1-t-o)/(1-o)||0),100*((1-i-o)/(1-o)||0),100*((1-n-o)/(1-o)||0),100*o]},s.rgb.keyword=function(e){const t=o[e];if(t)return t;let i,s=1/0;for(const t of Object.keys(n)){const o=(a=n[t],((r=e)[0]-a[0])**2+(r[1]-a[1])**2+(r[2]-a[2])**2);o<s&&(s=o,i=t)}var r,a;return i},s.keyword.rgb=function(e){return n[e]},s.rgb.xyz=function(e){let t=e[0]/255,i=e[1]/255,n=e[2]/255;return t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,[100*(.4124*t+.3576*i+.1805*n),100*(.2126*t+.7152*i+.0722*n),100*(.0193*t+.1192*i+.9505*n)]},s.rgb.lab=function(e){const t=s.rgb.xyz(e);let i=t[0],n=t[1],o=t[2];return i/=95.047,n/=100,o/=108.883,i=i>.008856?i**(1/3):7.787*i+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,o=o>.008856?o**(1/3):7.787*o+16/116,[116*n-16,500*(i-n),200*(n-o)]},s.hsl.rgb=function(e){const t=e[0]/360,i=e[1]/100,n=e[2]/100;let o,s,r;if(0===i)return r=255*n,[r,r,r];o=n<.5?n*(1+i):n+i-n*i;const a=2*n-o,l=[0,0,0];for(let e=0;e<3;e++)s=t+1/3*-(e-1),s<0&&s++,s>1&&s--,r=6*s<1?a+6*(o-a)*s:2*s<1?o:3*s<2?a+(o-a)*(2/3-s)*6:a,l[e]=255*r;return l},s.hsl.hsv=function(e){const t=e[0];let i=e[1]/100,n=e[2]/100,o=i;const s=Math.max(n,.01);return n*=2,i*=n<=1?n:2-n,o*=s<=1?s:2-s,[t,100*(0===n?2*o/(s+o):2*i/(n+i)),(n+i)/2*100]},s.hsv.rgb=function(e){const t=e[0]/60,i=e[1]/100;let n=e[2]/100;const o=Math.floor(t)%6,s=t-Math.floor(t),r=255*n*(1-i),a=255*n*(1-i*s),l=255*n*(1-i*(1-s));switch(n*=255,o){case 0:return[n,l,r];case 1:return[a,n,r];case 2:return[r,n,l];case 3:return[r,a,n];case 4:return[l,r,n];case 5:return[n,r,a]}},s.hsv.hsl=function(e){const t=e[0],i=e[1]/100,n=e[2]/100,o=Math.max(n,.01);let s,r;r=(2-i)*n;const a=(2-i)*o;return s=i*o,s/=a<=1?a:2-a,s=s||0,r/=2,[t,100*s,100*r]},s.hwb.rgb=function(e){const t=e[0]/360;let i=e[1]/100,n=e[2]/100;const o=i+n;let s;o>1&&(i/=o,n/=o);const r=Math.floor(6*t),a=1-n;s=6*t-r,0!=(1&r)&&(s=1-s);const l=i+s*(a-i);let c,d,u;switch(r){default:case 6:case 0:c=a,d=l,u=i;break;case 1:c=l,d=a,u=i;break;case 2:c=i,d=a,u=l;break;case 3:c=i,d=l,u=a;break;case 4:c=l,d=i,u=a;break;case 5:c=a,d=i,u=l}return[255*c,255*d,255*u]},s.cmyk.rgb=function(e){const t=e[0]/100,i=e[1]/100,n=e[2]/100,o=e[3]/100;return[255*(1-Math.min(1,t*(1-o)+o)),255*(1-Math.min(1,i*(1-o)+o)),255*(1-Math.min(1,n*(1-o)+o))]},s.xyz.rgb=function(e){const t=e[0]/100,i=e[1]/100,n=e[2]/100;let o,s,r;return o=3.2406*t+-1.5372*i+-.4986*n,s=-.9689*t+1.8758*i+.0415*n,r=.0557*t+-.204*i+1.057*n,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,o=Math.min(Math.max(0,o),1),s=Math.min(Math.max(0,s),1),r=Math.min(Math.max(0,r),1),[255*o,255*s,255*r]},s.xyz.lab=function(e){let t=e[0],i=e[1],n=e[2];return t/=95.047,i/=100,n/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,[116*i-16,500*(t-i),200*(i-n)]},s.lab.xyz=function(e){let t,i,n;i=(e[0]+16)/116,t=e[1]/500+i,n=i-e[2]/200;const o=i**3,s=t**3,r=n**3;return i=o>.008856?o:(i-16/116)/7.787,t=s>.008856?s:(t-16/116)/7.787,n=r>.008856?r:(n-16/116)/7.787,t*=95.047,i*=100,n*=108.883,[t,i,n]},s.lab.lch=function(e){const t=e[0],i=e[1],n=e[2];let o;return o=360*Math.atan2(n,i)/2/Math.PI,o<0&&(o+=360),[t,Math.sqrt(i*i+n*n),o]},s.lch.lab=function(e){const t=e[0],i=e[1],n=e[2]/360*2*Math.PI;return[t,i*Math.cos(n),i*Math.sin(n)]},s.rgb.ansi16=function(e,t=null){const[i,n,o]=e;let r=null===t?s.rgb.hsv(e)[2]:t;if(r=Math.round(r/50),0===r)return 30;let a=30+(Math.round(o/255)<<2|Math.round(n/255)<<1|Math.round(i/255));return 2===r&&(a+=60),a},s.hsv.ansi16=function(e){return s.rgb.ansi16(s.hsv.rgb(e),e[2])},s.rgb.ansi256=function(e){const t=e[0],i=e[1],n=e[2];return t===i&&i===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(i/255*5)+Math.round(n/255*5)},s.ansi16.rgb=function(e){let t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const i=.5*(1+~~(e>50));return[(1&t)*i*255,(t>>1&1)*i*255,(t>>2&1)*i*255]},s.ansi256.rgb=function(e){if(e>=232){const t=10*(e-232)+8;return[t,t,t]}let t;return e-=16,[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},s.rgb.hex=function(e){const t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},s.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let i=t[0];3===t[0].length&&(i=i.split("").map((e=>e+e)).join(""));const n=parseInt(i,16);return[n>>16&255,n>>8&255,255&n]},s.rgb.hcg=function(e){const t=e[0]/255,i=e[1]/255,n=e[2]/255,o=Math.max(Math.max(t,i),n),s=Math.min(Math.min(t,i),n),r=o-s;let a,l;return a=r<1?s/(1-r):0,l=r<=0?0:o===t?(i-n)/r%6:o===i?2+(n-t)/r:4+(t-i)/r,l/=6,l%=1,[360*l,100*r,100*a]},s.hsl.hcg=function(e){const t=e[1]/100,i=e[2]/100,n=i<.5?2*t*i:2*t*(1-i);let o=0;return n<1&&(o=(i-.5*n)/(1-n)),[e[0],100*n,100*o]},s.hsv.hcg=function(e){const t=e[1]/100,i=e[2]/100,n=t*i;let o=0;return n<1&&(o=(i-n)/(1-n)),[e[0],100*n,100*o]},s.hcg.rgb=function(e){const t=e[0]/360,i=e[1]/100,n=e[2]/100;if(0===i)return[255*n,255*n,255*n];const o=[0,0,0],s=t%1*6,r=s%1,a=1-r;let l=0;switch(Math.floor(s)){case 0:o[0]=1,o[1]=r,o[2]=0;break;case 1:o[0]=a,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=r;break;case 3:o[0]=0,o[1]=a,o[2]=1;break;case 4:o[0]=r,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=a}return l=(1-i)*n,[255*(i*o[0]+l),255*(i*o[1]+l),255*(i*o[2]+l)]},s.hcg.hsv=function(e){const t=e[1]/100,i=t+e[2]/100*(1-t);let n=0;return i>0&&(n=t/i),[e[0],100*n,100*i]},s.hcg.hsl=function(e){const t=e[1]/100,i=e[2]/100*(1-t)+.5*t;let n=0;return i>0&&i<.5?n=t/(2*i):i>=.5&&i<1&&(n=t/(2*(1-i))),[e[0],100*n,100*i]},s.hcg.hwb=function(e){const t=e[1]/100,i=t+e[2]/100*(1-t);return[e[0],100*(i-t),100*(1-i)]},s.hwb.hcg=function(e){const t=e[1]/100,i=1-e[2]/100,n=i-t;let o=0;return n<1&&(o=(i-n)/(1-n)),[e[0],100*n,100*o]},s.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},s.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},s.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},s.gray.hsl=function(e){return[0,0,e[0]]},s.gray.hsv=s.gray.hsl,s.gray.hwb=function(e){return[0,100,e[0]]},s.gray.cmyk=function(e){return[0,0,0,e[0]]},s.gray.lab=function(e){return[e[0],0,0]},s.gray.hex=function(e){const t=255&Math.round(e[0]/100*255),i=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(i.length)+i},s.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}},734:(e,t,i)=>{const n=i(5659),o=i(8507),s={};Object.keys(n).forEach((e=>{s[e]={},Object.defineProperty(s[e],"channels",{value:n[e].channels}),Object.defineProperty(s[e],"labels",{value:n[e].labels});const t=o(e);Object.keys(t).forEach((i=>{const n=t[i];s[e][i]=function(e){const t=function(...t){const i=t[0];if(null==i)return i;i.length>1&&(t=i);const n=e(t);if("object"==typeof n)for(let e=n.length,t=0;t<e;t++)n[t]=Math.round(n[t]);return n};return"conversion"in e&&(t.conversion=e.conversion),t}(n),s[e][i].raw=function(e){const t=function(...t){const i=t[0];return null==i?i:(i.length>1&&(t=i),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(n)}))})),e.exports=s},8507:(e,t,i)=>{const n=i(5659);function o(e,t){return function(i){return t(e(i))}}function s(e,t){const i=[t[e].parent,e];let s=n[t[e].parent][e],r=t[e].parent;for(;t[r].parent;)i.unshift(t[r].parent),s=o(n[t[r].parent][r],s),r=t[r].parent;return s.conversion=i,s}e.exports=function(e){const t=function(e){const t=function(){const e={},t=Object.keys(n);for(let i=t.length,n=0;n<i;n++)e[t[n]]={distance:-1,parent:null};return e}(),i=[e];for(t[e].distance=0;i.length;){const e=i.pop(),o=Object.keys(n[e]);for(let n=o.length,s=0;s<n;s++){const n=o[s],r=t[n];-1===r.distance&&(r.distance=t[e].distance+1,r.parent=e,i.unshift(n))}}return t}(e),i={},o=Object.keys(t);for(let e=o.length,n=0;n<e;n++){const e=o[n];null!==t[e].parent&&(i[e]=s(e,t))}return i}},8156:e=>{"use strict";e.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]}},7833:(e,t,i)=>{"use strict";i.r(t)},6856:(e,t,i)=>{"use strict";i.r(t)},6474:(e,t,i)=>{"use strict";i.r(t)},6734:(e,t,i)=>{"use strict";i.r(t)},1278:(e,t,i)=>{"use strict";i.r(t)},2486:(e,t,i)=>{var n,o;n=[i,t,i(1948)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.create=async function(e,t){const o=(t=Object.assign(t,n)).removePlugins||[];if(!o.includes("Image")){const e=["url"];o.includes("WoltlabAttachment")||e.unshift("upload"),t.image={insert:{integrations:e,type:"inline"},toolbar:["imageStyle:inline","imageStyle:sideLeft","imageStyle:block","imageStyle:side"],resizeUnit:"px",styles:{options:["inline",{name:"sideLeft",title:"Left aligned image",icon:i.Core.icons.objectLeft,modelElements:["imageBlock"],className:"image-style-side-left"},"block","side"]}},o.includes("Link")||t.image.toolbar.push("|","linkImage")}return o.includes("Table")||(t.table={contentToolbar:["tableColumn","tableRow","mergeTableCells"]}),await i.ClassicEditor.ClassicEditor.create(e,t)};const n={plugins:[i.Autosave.Autosave,i.Essentials.Essentials,i.Indent.Indent,i.Mention.Mention,i.Paragraph.Paragraph,i.PasteFromOffice.PasteFromOffice,i.Undo.Undo,i.Alignment.Alignment,i.BasicStyles.Bold,i.BasicStyles.Code,i.Font.FontColor,i.Font.FontFamily,i.Font.FontSize,i.Heading.Heading,i.Highlight.Highlight,i.BasicStyles.Italic,i.RemoveFormat.RemoveFormat,i.BasicStyles.Strikethrough,i.BasicStyles.Subscript,i.BasicStyles.Superscript,i.BasicStyles.Underline,i.BlockQuote.BlockQuote,i.CodeBlock.CodeBlock,i.HtmlEmbed.HtmlEmbed,i.HorizontalLine.HorizontalLine,i.Image.Image,i.Image.ImageInsertUI,i.Image.ImageInsertViaUrl,i.Image.ImageToolbar,i.Image.ImageResizeEditing,i.Image.ImageResizeHandles,i.Image.ImageStyle,i.Image.ImageUpload,i.Image.ImageUploadUI,i.Link.Link,i.Link.LinkImage,i.List.List,i.Table.Table,i.Table.TableToolbar,i.WoltlabAttachment.WoltlabAttachment,i.WoltlabAutoLink.WoltlabAutoLink,i.WoltlabAutosave.WoltlabAutosave,i.WoltlabBlockQuote.WoltlabBlockQuote,i.WoltlabBbcode.WoltlabBbcode,i.WoltlabCode.WoltlabCode,i.WoltlabCodeBlock.WoltlabCodeBlock,i.WoltlabHtmlEmbed.WoltlabHtmlEmbed,i.WoltlabImage.WoltlabImage,i.WoltlabMagicParagraph.WoltlabMagicParagraph,i.WoltlabMedia.WoltlabMedia,i.WoltlabMention.WoltlabMention,i.WoltlabMetacode.WoltlabMetacode,i.WoltlabSmiley.WoltlabSmiley,i.WoltlabSpoiler.WoltlabSpoiler,i.WoltlabToolbarGroup.WoltlabToolbarGroup,i.WoltlabUpload.WoltlabUpload,i.WoltlabFontSize.WoltlabFontSize]}}.apply(t,n),void 0===o||(e.exports=o)},73:(e,t,i)=>{var n,o;n=[i,t,i(2486),i(1948)],o=function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CKEditor5=t.create=void 0,Object.defineProperty(t,"create",{enumerable:!0,get:function(){return i.create}}),t.CKEditor5=n}.apply(t,n),void 0===o||(e.exports=o)},1948:(e,t,i)=>{var n,o;n=[i,t,i(7109),i(7933),i(6191),i(8839),i(5247),i(6034),i(1703),i(1024),i(5247),i(151),i(7207),i(708),i(6913),i(9174),i(174),i(9306),i(9090),i(5048),i(2016),i(2685),i(4608),i(3312),i(2801),i(1980),i(9448),i(8368),i(6206),i(478),i(6192),i(7243),i(8511),i(4857),i(7906),i(3906),i(4182),i(4751),i(105),i(4138),i(7223),i(4814),i(3546),i(9374),i(9897),i(1151),i(5107),i(2473),i(5123),i(6976),i(6153),i(3806),i(5842),i(1266)],o=function(e,t,i,n,o,s,r,a,l,c,d,u,h,m,g,f,p,b,w,v,_,y,k,C,A,E,x,T,P,I,S,V,R,B,M,O,L,F,N,D,z,W,H,U,$,j,q,K,G,Z,J,Q,Y,X){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabFontSize=t.WoltlabUpload=t.WoltlabToolbarGroup=t.WoltlabSpoiler=t.WoltlabSmiley=t.WoltlabMetacode=t.WoltlabMention=t.WoltlabMedia=t.WoltlabMagicParagraph=t.WoltlabImage=t.WoltlabHtmlEmbed=t.WoltlabCodeBlock=t.WoltlabCode=t.WoltlabBlockQuote=t.WoltlabBbcode=t.WoltlabAutosave=t.WoltlabAutoLink=t.WoltlabAttachment=t.Widget=t.Utils=t.Upload=t.Undo=t.Ui=t.Typing=t.Table=t.SelectAll=t.RemoveFormat=t.PasteFromOffice=t.Paragraph=t.Mention=t.List=t.Link=t.Language=t.Indent=t.Image=t.HtmlEmbed=t.HorizontalLine=t.Highlight=t.Heading=t.Font=t.Essentials=t.Enter=t.Engine=t.Editor=t.Core=t.CodeBlock=t.Clipboard=t.ClassicEditor=t.BlockQuote=t.BasicStyles=t.Autosave=t.Alignment=void 0,t.Alignment=i,t.Autosave=n,t.BasicStyles=o,t.BlockQuote=s,t.ClassicEditor=r,t.Clipboard=a,t.CodeBlock=l,t.Core=c,t.Editor=d,t.Engine=u,t.Enter=h,t.Essentials=m,t.Font=g,t.Heading=f,t.Highlight=p,t.HorizontalLine=b,t.HtmlEmbed=w,t.Image=v,t.Indent=_,t.Language=y,t.Link=k,t.List=C,t.Mention=A,t.Paragraph=E,t.PasteFromOffice=x,t.RemoveFormat=T,t.SelectAll=P,t.Table=I,t.Typing=S,t.Ui=V,t.Undo=R,t.Upload=B,t.Utils=M,t.Widget=O,t.WoltlabAttachment=L,t.WoltlabAutoLink=F,t.WoltlabAutosave=N,t.WoltlabBbcode=D,t.WoltlabBlockQuote=z,t.WoltlabCode=W,t.WoltlabCodeBlock=H,t.WoltlabHtmlEmbed=U,t.WoltlabImage=$,t.WoltlabMagicParagraph=j,t.WoltlabMedia=q,t.WoltlabMention=K,t.WoltlabMetacode=G,t.WoltlabSmiley=Z,t.WoltlabSpoiler=J,t.WoltlabToolbarGroup=Q,t.WoltlabUpload=Y,t.WoltlabFontSize=X}.apply(t,n),void 0===o||(e.exports=o)},4182:(e,t,i)=>{var n,o;n=[i,t,i(1146)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabAttachment=void 0,Object.defineProperty(t,"WoltlabAttachment",{enumerable:!0,get:function(){return i.WoltlabAttachment}})}.apply(t,n),void 0===o||(e.exports=o)},1146:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(5048)],o=function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabAttachment=void 0;class o extends i.Plugin{static get pluginName(){return"WoltlabAttachment"}static get requires(){return[n.Image,n.ImageUtils]}init(){const{conversion:e,model:t,plugins:i}=this.editor,{schema:n}=t,o=["imageBlock","imageInline"];o.forEach((t=>{n.extend(t,{allowAttributes:["attachmentId"]}),e.attributeToAttribute({model:{key:"classList",values:["woltlabAttachment"]},view:{woltlabAttachment:{name:"imageBlock"===t?"figure":"img",key:"class",value:"woltlabAttachment"}}})}));const s=new Map([["attachmentId","data-attachment-id"]]),r=this.editor.plugins.get("ImageUtils");Array.from(s.entries()).forEach((([t,i])=>{e.for("upcast").attributeToAttribute({view:i,model:t}),e.for("downcast").add((e=>{o.forEach((n=>{e.on(`attribute:${t}:${n}`,((e,t,n)=>{if(!n.consumable.consume(t.item,e.name))return;const o=n.writer,s=r.findViewImgElement(n.mapper.toViewElement(t.item));null!==t.attributeNewValue?(o.setAttribute(i,t.attributeNewValue,s),o.addClass("woltlabAttachment",s)):o.removeAttribute(i,s)}))}))}))})),i.get("ImageUploadEditing").on("uploadComplete",((e,{data:i,imageElement:n})=>{t.change((e=>{e.setAttribute("attachmentId",i["data-attachment-id"],n)}))}))}}t.WoltlabAttachment=o,t.default=o}.apply(t,n),void 0===o||(e.exports=o)},4751:(e,t,i)=>{var n,o;n=[i,t,i(2502)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabAutoLink=void 0,Object.defineProperty(t,"WoltlabAutoLink",{enumerable:!0,get:function(){return i.WoltlabAutoLink}})}.apply(t,n),void 0===o||(e.exports=o)},2502:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(4608)],o=function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabAutoLink=void 0;class o extends i.Plugin{#e="WoltlabAutoLink";static get pluginName(){return"WoltlabAutoLink"}static get requires(){return[n.AutoLink]}init(){if(!this.editor.plugins.has(n.AutoLink))return;const e=this.editor.plugins.get(n.AutoLink);e.forceDisabled(this.#e);const t=this.editor.plugins.get("ClipboardPipeline");t.on("inputTransformation",(()=>{e.clearForceDisabled(this.#e)}),{priority:"highest"}),t.on("inputTransformation",(()=>{e.forceDisabled(this.#e)}),{priority:"normal"})}}t.WoltlabAutoLink=o,t.default=o}.apply(t,n),void 0===o||(e.exports=o)},105:(e,t,i)=>{var n,o;n=[i,t,i(2278)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabAutosave=void 0,Object.defineProperty(t,"WoltlabAutosave",{enumerable:!0,get:function(){return i.WoltlabAutosave}})}.apply(t,n),void 0===o||(e.exports=o)},2278:(e,t,i)=>{var n,o;n=[i,t,i(7933),i(1024)],o=function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabAutosave=void 0;class o extends n.Plugin{static get pluginName(){return"WoltlabAutosave"}static get requires(){return[i.Autosave]}init(){const e=this.editor.plugins.get("PendingActions");e.hasAny=!1,e.on("set:hasAny",(e=>{e.return=!1,e.stop()}),{priority:"highest"})}}t.WoltlabAutosave=o,t.default=o}.apply(t,n),void 0===o||(e.exports=o)},4138:(e,t,i)=>{var n,o;n=[i,t,i(9514),i(4129)],o=function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabBbcodeCommand=t.WoltlabBbcode=void 0,Object.defineProperty(t,"WoltlabBbcode",{enumerable:!0,get:function(){return i.WoltlabBbcode}}),Object.defineProperty(t,"WoltlabBbcodeCommand",{enumerable:!0,get:function(){return n.WoltlabBbcodeCommand}})}.apply(t,n),void 0===o||(e.exports=o)},9514:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(7243),i(4129)],o=function(e,t,i,n,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabBbcode=void 0;class s extends i.Plugin{static get pluginName(){return"WoltlabBbcode"}init(){const{componentFactory:e}=this.editor.ui,t=this.editor.config.get("woltlabBbcode");if(!t)return;const i=new o.default(this.editor);this.editor.commands.add("insertBbcode",i);for(const n of t)this.#t(n,e,i)}#t(e,t,i){const{icon:o,name:s,label:r}=e;t.add(`woltlabBbcode_${s}`,(()=>{const e=new n.ButtonView;if(e.label=r,e.tooltip=!0,e.withText=!0,o)if(o.includes(";")){const[t,i]=o.split(";",2);let n={name:t};"true"===i&&(n.solid="true"),e.labelView.setTemplate({tag:"fa-icon",attributes:n})}else e.labelView.setTemplate({tag:"img",attributes:{src:o}});return e.bind("isEnabled").to(i,"isEnabled"),this.listenTo(e,"execute",(()=>{this.editor.execute("insertBbcode",s)})),e}))}}t.WoltlabBbcode=s,t.default=s}.apply(t,n),void 0===o||(e.exports=o)},4129:(e,t,i)=>{var n,o;n=[i,t,i(1024)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabBbcodeCommand=void 0;class n extends i.Command{execute(e){const{editing:t,model:i}=this.editor,n=this.editor.sourceElement,o=new CustomEvent("ckeditor5:bbcode",{cancelable:!0,detail:{bbcode:e}});n.dispatchEvent(o),o.defaultPrevented||i.change((n=>{const o=i.document.selection,s=n.createText(`[${e}]`),r=i.insertContent(s,o.getFirstPosition()),a=i.insertContent(n.createText(`[/${e}]`),o.isCollapsed?r.end:o.getLastPosition()),l=n.createRange(a.start);n.setSelection(l),t.view.focus()}))}refresh(){this.isEnabled=this.#i()}#i(){const{document:e,schema:t}=this.editor.model,{selection:i}=e;return t.checkAttributeInSelection(i,"bold")}}t.WoltlabBbcodeCommand=n,t.default=n}.apply(t,n),void 0===o||(e.exports=o)},7223:(e,t,i)=>{var n,o;n=[i,t,i(5765)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabBlockQuote=void 0,Object.defineProperty(t,"WoltlabBlockQuote",{enumerable:!0,get:function(){return i.WoltlabBlockQuote}})}.apply(t,n),void 0===o||(e.exports=o)},1545:(e,t,i)=>{var n,o;n=[i,t,i(7243),i(6856)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabBlockQuoteFormRowView=void 0;class n extends i.View{children;constructor(e,t={}){super(e);const i=this.bindTemplate;this.set("class",t.class||""),this.children=this.createCollection(),t.children&&t.children.forEach((e=>this.children.add(e))),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__row",i.to("class")]},children:this.children})}}t.WoltlabBlockQuoteFormRowView=n,t.default=n}.apply(t,n),void 0===o||(e.exports=o)},7209:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(7243),i(7906),i(1545)],o=function(e,t,i,n,o,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabBlockQuotePanelView=void 0;class r extends n.View{#n;#o;#s;#r;focusTracker;keystrokes;#a;#l;constructor(e){const{locale:t}=e;super(t),this.set("author",""),this.set("link",""),this.focusTracker=new o.FocusTracker,this.keystrokes=new o.KeystrokeHandler,this.#a=new n.ViewCollection,this.#l=this.#c();const i=this.#d(t);this.#s=i.fieldView;const s=this.#u(t);this.#r=s.fieldView,this.#n=this.#h(t),this.#o=this.#m(t),this.#g(t,i,s)}render(){super.render(),(0,n.submitHandler)({view:this});const e=[this.#s,this.#r,this.#n,this.#o];e.forEach((e=>{this.#a.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element),this.keystrokes.set("arrowright",(e=>e.stopPropagation())),this.keystrokes.set("arrowleft",(e=>e.stopPropagation())),this.keystrokes.set("arrowup",(e=>e.stopPropagation())),this.keystrokes.set("arrowdown",(e=>e.stopPropagation())),this.listenTo(e[0].element,"selectstart",((e,t)=>{t.stopPropagation()}),{priority:"high"}),this.on("submit",(()=>{this.fire("execute")}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.#l.focusFirst()}#d(e){const t=e.t,i=new n.LabeledFieldView(e,n.createLabeledInputText);return i.label=t("Author"),i.fieldView.bind("value").to(this,"author",(e=>e||"")),i.fieldView.on("input",(()=>{this.author=i.fieldView.element.value})),i}#u(e){const t=e.t,i=new n.LabeledFieldView(e,n.createLabeledInputText);return i.label=t("Link"),i.fieldView.bind("value").to(this,"link",(e=>e||"")),i.fieldView.on("input",(()=>{this.link=i.fieldView.element.value})),i}#h(e){const t=e.t,o=new n.ButtonView(e);return o.set({label:t("Insert"),icon:i.icons.check,class:"ck-button-save",type:"submit",withText:!0,isEnabled:!0}),o}#m(e){const t=e.t,o=new n.ButtonView(e);return o.set({label:t("Cancel"),icon:i.icons.cancel,class:"ck-button-cancel",withText:!0}),o.delegate("execute").to(this,"cancel"),o}#g(e,t,i){this.setTemplate({tag:"form",attributes:{class:["ck","ck-vertical-form","ck-woltlabblockquote-insert-form"],tabindex:"-1"},children:[t,i,new s.default(e,{children:[this.#n,this.#o],class:"ck-woltlabblockquote-insert-form__action-row"})]})}#c(){return new n.FocusCycler({focusables:this.#a,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}})}}t.WoltlabBlockQuotePanelView=r,t.default=r}.apply(t,n),void 0===o||(e.exports=o)},5765:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(7243),i(7906),i(7209),i(7833)],o=function(e,t,i,n,o,s){"use strict";function r(e){switch(typeof e){case"string":return e;case"number":case"boolean":return e.toString();default:return""}}Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabBlockQuote=void 0;class a extends i.Plugin{#f=void 0;static get pluginName(){return"WoltlabBlockQuote"}init(){const e=this.editor;e.model.schema.extend("blockQuote",{allowAttributes:["author","link"]});const t=e.commands.get("blockQuote");this.#p(t),this.#b(),this.#w(),this.#v(),this.listenTo(t,"execute",(()=>{this.#_(this.#f)}))}#p(e){const t=this.editor,o=t.t;this.editor.ui.componentFactory.add("blockQuote",(a=>{const l=(0,n.createDropdown)(a,n.SplitButtonView),c=l.buttonView;c.set({label:o("Block quote"),tooltip:!0,icon:i.icons.quote,isToggleable:!0}),c.bind("isOn").to(e,"value",(e=>!!e)),c.on("execute",(()=>{t.execute("blockQuote"),t.editing.view.focus()})),l.on("submit",(e=>{const i=e.path.find((e=>e instanceof s.WoltlabBlockQuotePanelView));i instanceof s.WoltlabBlockQuotePanelView&&(this.#f=i,t.execute("blockQuote",{forceValue:!0}),this.#f=void 0,t.editing.view.focus(),l.isOpen=!1)})),l.on("cancel",(()=>{t.editing.view.focus(),l.isOpen=!1})),l.bind("isEnabled").to(e);const d=new s.WoltlabBlockQuotePanelView(t);return l.on("change:isOpen",(()=>{if(l.isOpen){const e=this.#y();e?(d.author=r(e.getAttribute("author")),d.link=r(e.getAttribute("link"))):(d.author="",d.link="")}})),l.panelView.children.add(d),d.delegate("submit","cancel").to(l),l}))}#b(){this.editor.data.upcastDispatcher.on("element:woltlab-quote",((e,t,i)=>{const{viewItem:n}=t,{consumable:o,writer:s}=i,r=s.createElement("blockQuote");s.setAttributes({author:n.getAttribute("data-author")||"",link:n.getAttribute("data-link")||""},r),i.convertChildren(n,r),i.safeInsert(r,t.modelCursor)&&(o.consume(n,{name:!0}),i.updateConversionResult(r,t))}),{priority:"high"})}#v(){this.editor.editing.downcastDispatcher.on("insert:blockQuote",((e,t,i)=>{const{writer:n,mapper:o,consumable:s}=i;if(!s.consume(t.item,"insert"))return;const a=r(t.item.getAttribute("author")),l=r(t.item.getAttribute("link")),c=this.getSource(a,l),d={};""!==c&&(d["data-source"]=c);const u=n.createContainerElement("blockquote",d),h=o.toViewPosition(this.editor.model.createPositionBefore(t.item));n.insert(h,u),o.bindElements(t.item,u)}),{priority:"high"}),this.editor.editing.downcastDispatcher.on("attribute:author:blockQuote",((e,t,i)=>{const{writer:n,mapper:o}=i,s=r(t.attributeNewValue),a=r(t.item.getAttribute("link")),l=this.getSource(s,a),c=o.toViewElement(t.item);""===l?n.removeAttribute("data-source",c):n.setAttribute("data-source",l,c)})),this.editor.editing.downcastDispatcher.on("attribute:link:blockQuote",((e,t,i)=>{const{writer:n,mapper:o}=i,s=r(t.item.getAttribute("author")),a=r(t.attributeNewValue),l=this.getSource(s,a),c=o.toViewElement(t.item);""===l?n.removeAttribute("data-source",c):n.setAttribute("data-source",l,c)}))}#w(){this.editor.data.downcastDispatcher.on("insert:blockQuote",((e,t,i)=>{const{writer:n,mapper:o,consumable:s}=i;if(!s.consume(t.item,"insert"))return;const a=r(t.item.getAttribute("author")),l=r(t.item.getAttribute("link")),c=o.toViewPosition(this.editor.model.createPositionBefore(t.item)),d=n.createContainerElement("woltlab-quote",{"data-author":a,"data-link":l});n.insert(c,d),o.bindElements(t.item,d)}),{priority:"high"})}#_(e){const t=this.#y();t&&void 0!==e&&this.editor.model.change((i=>{i.setAttribute("author",e.author,t),i.setAttribute("link",e.link,t)}))}#y(){const e=this.editor.model.document.selection,t=(0,o.first)(e.getSelectedBlocks());return this.#k(t)}#k(e){return e.is("element","blockQuote")?e:e.parent&&!e.parent.is("element","$root")?this.#k(e.parent):null}getSource(e,t){const{t:i}=this.editor;return e?i("Quote from %0",e):i("Quote")}}t.WoltlabBlockQuote=a,t.default=a}.apply(t,n),void 0===o||(e.exports=o)},3546:(e,t,i)=>{var n,o;n=[i,t,i(1401)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabCodeBlock=void 0,Object.defineProperty(t,"WoltlabCodeBlock",{enumerable:!0,get:function(){return i.WoltlabCodeBlock}})}.apply(t,n),void 0===o||(e.exports=o)},5685:(e,t,i)=>{var n,o;n=[i,t,i(7243),i(6474)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabCodeBlockFormRowView=void 0;class n extends i.View{children;constructor(e,t={}){super(e);const i=this.bindTemplate;this.set("class",t.class||""),this.children=this.createCollection(),t.children&&t.children.forEach((e=>this.children.add(e))),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__row",i.to("class")]},children:this.children})}}t.WoltlabCodeBlockFormRowView=n,t.default=n}.apply(t,n),void 0===o||(e.exports=o)},9061:(e,t,i)=>{var n,o;n=[i,t,i(2148),i(1024),i(7243),i(7906),i(5685)],o=function(e,t,i,n,o,s,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabCodeBlockPanelView=void 0;class a extends o.View{#n;#o;#C;#A;#E;focusTracker;keystrokes;#a;#l;constructor(e){const{locale:t}=e;super(t),this.set("file",""),this.set("highlighter",""),this.set("line",""),this.focusTracker=new s.FocusTracker,this.keystrokes=new s.KeystrokeHandler,this.#a=new o.ViewCollection,this.#l=this.#c();const n=(0,i.getNormalizedAndLocalizedLanguageDefinitions)(e);this.#C=this.#x(t,n);const r=this.#T(t);this.#A=r.fieldView;const a=this.#u(t);this.#E=a.fieldView,this.#n=this.#h(t),this.#o=this.#m(t),this.#g(t,r,a)}render(){super.render(),(0,o.submitHandler)({view:this});const e=[this.#C,this.#A,this.#E,this.#n,this.#o];e.forEach((e=>{this.#a.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element),this.keystrokes.set("arrowright",(e=>e.stopPropagation())),this.keystrokes.set("arrowleft",(e=>e.stopPropagation())),this.keystrokes.set("arrowup",(e=>e.stopPropagation())),this.keystrokes.set("arrowdown",(e=>e.stopPropagation())),this.listenTo(e[0].element,"selectstart",((e,t)=>{t.stopPropagation()}),{priority:"high"}),this.on("submit",(()=>{this.fire("execute")}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.#l.focusFirst()}set insertButtonLabel(e){this.#n.label=e}#x(e,t){const i=e.t,n=(0,o.createDropdown)(e),s=this.#P(t);return this.highlighter=s.first.model._codeBlockLanguage,n.buttonView.bind("label").to(this,"highlighter",(e=>{const i=e?e.toString():"";return t.find((e=>e.language==i)).label})),n.buttonView.set({isOn:!1,withText:!0,tooltip:i("Language"),class:["ck-dropdown__button_label-width_auto"]}),n.on("execute",(e=>{this.highlighter=e.source._codeBlockLanguage})),(0,o.addListToDropdown)(n,s),n}#T(e){const t=e.t,i=new o.LabeledFieldView(e,o.createLabeledInputNumber);i.label=t("Line number");const{fieldView:n}=i;return n.min=0,n.bind("value").to(this,"line",(e=>e||"")),n.on("input",(()=>{this.line=n.element.value})),i}#u(e){const t=e.t,i=new o.LabeledFieldView(e,o.createLabeledInputText);return i.label=t("Filename"),i.fieldView.bind("value").to(this,"file",(e=>e||"")),i.fieldView.on("input",(()=>{this.file=i.fieldView.element.value})),i}#P(e){const t=new s.Collection;for(const i of e){const e={type:"button",model:new o.ViewModel({_codeBlockLanguage:i.language,label:i.label,withText:!0})};e.model.bind("isOn").to(this,"highlighter",(t=>t===e.model._codeBlockLanguage)),t.add(e)}return t}#h(e){const t=e.t,i=new o.ButtonView(e);return i.set({label:t("Insert"),icon:n.icons.check,class:"ck-button-save",type:"submit",withText:!0,isEnabled:!0}),i}#m(e){const t=e.t,i=new o.ButtonView(e);return i.set({label:t("Cancel"),icon:n.icons.cancel,class:"ck-button-cancel",withText:!0}),i.delegate("execute").to(this,"cancel"),i}#g(e,t,i){this.setTemplate({tag:"form",attributes:{class:["ck","ck-vertical-form","ck-woltlabcodeblock-insert-form"],tabindex:"-1"},children:[this.#C,t,i,new r.default(e,{children:[this.#n,this.#o],class:"ck-woltlabcodeblock-insert-form__action-row"})]})}#c(){return new o.FocusCycler({focusables:this.#a,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}})}}t.WoltlabCodeBlockPanelView=a,t.default=a}.apply(t,n),void 0===o||(e.exports=o)},1401:(e,t,i)=>{var n,o;n=[i,t,i(2148),i(1024),i(7243),i(7906),i(9061)],o=function(e,t,i,n,o,s,r){"use strict";function a(e){switch(typeof e){case"string":return e;case"number":case"boolean":return e.toString();default:return""}}Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabCodeBlock=void 0;class l extends n.Plugin{#I;#f=void 0;static get pluginName(){return"WoltlabCodeBlock"}init(){const e=this.editor;this.#I=e.commands.get("codeBlock"),e.model.schema.extend("codeBlock",{allowAttributes:["file","line"]}),this.#S(),this.#b(),this.#w(),this.#v(),this.#V(),this.listenTo(this.#I,"execute",(()=>{this.#_(this.#f)}))}#S(){const e=this.editor,t=e.t;e.ui.componentFactory.add("codeBlock",(i=>{const n=(0,o.createDropdown)(i,o.SplitButtonView),s=n.buttonView;s.set({label:t("Insert code block"),tooltip:!0,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.87 12.61a.75.75 0 0 1-.089.976l-.085.07-3.154 2.254 3.412 2.414a.75.75 0 0 1 .237.95l-.057.095a.75.75 0 0 1-.95.237l-.096-.058-4.272-3.022-.003-1.223 4.01-2.867a.75.75 0 0 1 1.047.174zm2.795-.231.095.057 4.011 2.867-.003 1.223-4.272 3.022-.095.058a.75.75 0 0 1-.88-.151l-.07-.086-.058-.095a.75.75 0 0 1 .15-.88l.087-.07 3.412-2.414-3.154-2.253-.085-.071a.75.75 0 0 1 .862-1.207zM16 0a2 2 0 0 1 2 2v9.354l-.663-.492-.837-.001V2a.5.5 0 0 0-.5-.5H2a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h3.118L7.156 19H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h14zM5.009 15l.003 1H3v-1h2.009zm2.188-2-1.471 1H5v-1h2.197zM10 11v.095L8.668 12H7v-1h3zm4-2v1H7V9h7zm0-2v1H7V7h7zm-4-2v1H5V5h5zM6 3v1H3V3h3z"/></svg>',isToggleable:!0}),s.bind("isOn").to(this.#I,"value",(e=>"string"==typeof e)),s.on("execute",(()=>{const t={usePreviousLanguageChoice:!1};""===this.#I.value&&(t.forceValue=!1),e.execute("codeBlock",t),e.editing.view.focus()})),n.on("submit",(t=>{const i=t.path.find((e=>e instanceof r.WoltlabCodeBlockPanelView));i instanceof r.WoltlabCodeBlockPanelView&&(this.#f=i,e.execute("codeBlock",{language:i.highlighter,forceValue:!0}),this.#f=void 0,e.editing.view.focus(),n.isOpen=!1)})),n.on("cancel",(()=>{e.editing.view.focus(),n.isOpen=!1})),n.bind("isEnabled").to(this.#I);const l=new r.WoltlabCodeBlockPanelView(e);return n.on("change:isOpen",(()=>{if(n.isOpen){const e=this.#R();e?(l.file=a(e.getAttribute("file")),l.highlighter=a(e.getAttribute("language")),l.line=a(e.getAttribute("line")),l.insertButtonLabel=t("Update")):(l.file="",l.highlighter="",l.line="",l.insertButtonLabel=t("Insert"))}})),n.panelView.children.add(l),l.delegate("submit","cancel").to(n),n}))}#b(){this.editor.data.upcastDispatcher.on("element:pre",((e,t,i)=>{const{viewItem:n}=t,{consumable:o,writer:s}=i;if(n.hasClass("woltlabHtml"))return;const r=s.createElement("codeBlock");s.setAttributes({file:n.getAttribute("data-file")||"",language:n.getAttribute("data-highlighter")||"",line:n.getAttribute("data-line")||""},r),i.convertChildren(n,r),i.safeInsert(r,t.modelCursor)&&(o.consume(n,{name:!0}),i.updateConversionResult(r,t))}),{priority:"high"})}#v(){const e=(0,i.getNormalizedAndLocalizedLanguageDefinitions)(this.editor);this.editor.editing.downcastDispatcher.on("insert:codeBlock",((t,i,n)=>{const{writer:o,mapper:s,consumable:r}=n;if(!r.consume(i.item,"insert"))return;const l=a(i.item.getAttribute("file")),c=a(i.item.getAttribute("language")),d=a(i.item.getAttribute("line")),u=o.createContainerElement("code",{class:`language-${c}`});let h="";const m=e.find((e=>e.language===c));h+=m?m.label:`Unknown (${c})`,(l||d)&&(h+=" (",l&&(h+=l),d&&(l&&(h+=" "),h+=`@ ${d}`),h+=")");const g=o.createContainerElement("pre",{"data-language":h,spellcheck:"false"},u),f=s.toViewPosition(this.editor.model.createPositionBefore(i.item));o.insert(f,g),s.bindElements(i.item,u)}),{priority:"high"})}#w(){this.editor.data.downcastDispatcher.on("insert:codeBlock",((e,t,i)=>{const{writer:n,mapper:o,consumable:s}=i;if(!s.consume(t.item,"insert"))return;const r=a(t.item.getAttribute("file")),l=a(t.item.getAttribute("language")),c=a(t.item.getAttribute("line")),d=o.toViewPosition(this.editor.model.createPositionBefore(t.item)),u=n.createContainerElement("pre",{"data-file":r,"data-highlighter":l,"data-line":c});n.insert(d,u),o.bindElements(t.item,u)}),{priority:"high"})}#_(e){const t=this.#R();t&&void 0!==e&&this.editor.model.change((i=>{i.setAttribute("file",e.file,t),i.setAttribute("line",e.line,t)}))}#V(){const e=(0,i.getNormalizedAndLocalizedLanguageDefinitions)(this.editor),t=["file","line"];for(const i of t)this.editor.editing.downcastDispatcher.on(`attribute:${i}:codeBlock`,((t,i,n)=>{const{mapper:o}=n,s=o.toViewElement(i.item);if(void 0===s)return;const r=s.getAncestors(),l=r[r.length-1];if(!l.is("element","pre"))return;const c=a(i.item.getAttribute("file")),d=a(i.item.getAttribute("language")),u=a(i.item.getAttribute("line"));let h="";const m=e.find((e=>e.language===d));h+=m?m.label:`Unknown (${d})`,(c||u)&&(h+=" (",c&&(h+=c),u&&(c&&(h+=" "),h+=`@ ${u}`),h+=")"),this.editor.editing.view.change((e=>{e.setAttribute("data-language",h,l)}))}))}#R(){const e=this.editor.model.document.selection,t=(0,s.first)(e.getSelectedBlocks());return t&&t.is("element","codeBlock")?t:null}}t.WoltlabCodeBlock=l,t.default=l}.apply(t,n),void 0===o||(e.exports=o)},4814:(e,t,i)=>{var n,o;n=[i,t,i(7274)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabCode=void 0,Object.defineProperty(t,"WoltlabCode",{enumerable:!0,get:function(){return i.WoltlabCode}})}.apply(t,n),void 0===o||(e.exports=o)},7274:(e,t,i)=>{var n,o;n=[i,t,i(6191),i(1024)],o=function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabCode=void 0;class o extends n.Plugin{static get pluginName(){return"WoltlabCode"}static get requires(){return[i.Code]}init(){const{conversion:e}=this.editor;e.for("upcast").elementToAttribute({view:"kbd",model:"code",converterPriority:"high"}),e.for("dataDowncast").attributeToElement({model:"code",view:"kbd",converterPriority:"high"})}}t.WoltlabCode=o,t.default=o}.apply(t,n),void 0===o||(e.exports=o)},1266:(e,t,i)=>{var n,o;n=[i,t,i(2443)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabFontSize=void 0,Object.defineProperty(t,"WoltlabFontSize",{enumerable:!0,get:function(){return i.WoltlabFontSize}})}.apply(t,n),void 0===o||(e.exports=o)},2443:(e,t,i)=>{var n,o;n=[i,t,i(1024)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabFontSize=void 0;class n extends i.Plugin{static defaultFontSize=15;static get pluginName(){return"WoltlabFontSize"}init(){if(!this.editor.plugins.has("FontSize"))return;const e=this.editor.config.get("fontSize").options.map((e=>"default"===e?n.defaultFontSize:e));this.editor.conversion.for("upcast").elementToAttribute({model:{key:"fontSize",value:t=>{const i=this.convertFontSizeToPx(t.getStyle("font-size"));if(void 0!==i)return e.reduce(((e,t)=>Math.abs(t-i)<Math.abs(e-i)?t:e))+"px"}},view:{name:"span",styles:{"font-size":/.*/}},converterPriority:"highest"})}convertFontSizeToPx(e){if(void 0===e)return;const t=e.match(/^(\d*\.?\d+)(px|pt|em|%)$/);if(!t)return;const i=parseFloat(t[1]);switch(t[2]){case"px":return i;case"pt":return 1.33*i;case"em":return 16*i;case"%":return i/100*n.defaultFontSize}}}t.WoltlabFontSize=n,t.default=n}.apply(t,n),void 0===o||(e.exports=o)},9374:(e,t,i)=>{var n,o;n=[i,t,i(2373)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabHtmlEmbed=void 0,Object.defineProperty(t,"WoltlabHtmlEmbed",{enumerable:!0,get:function(){return i.WoltlabHtmlEmbed}})}.apply(t,n),void 0===o||(e.exports=o)},2373:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(9090)],o=function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabHtmlEmbed=void 0;class o extends i.Plugin{static get pluginName(){return"WoltlabHtmlEmbed"}static get requires(){return[n.HtmlEmbed]}init(){const{conversion:e,data:t}=this.editor;t.registerRawContentMatcher({name:"pre",classes:"woltlabHtml"}),e.for("upcast").elementToElement({view:{name:"pre",classes:"woltlabHtml"},model:(e,{writer:t})=>{let i=e.getCustomProperty("$rawContent");return i="string"==typeof i?this.#B(i):"",t.createElement("rawHtml",{value:i})},converterPriority:"high"}),e.for("dataDowncast").elementToElement({model:"rawHtml",view:(e,{writer:t})=>t.createRawElement("pre",{class:"woltlabHtml"},(function(t){t.textContent=e.getAttribute("value")||""})),converterPriority:"high"})}#B(e){return String(e).replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}}t.WoltlabHtmlEmbed=o,t.default=o}.apply(t,n),void 0===o||(e.exports=o)},9897:(e,t,i)=>{var n,o;n=[i,t,i(3490)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabImage=void 0,Object.defineProperty(t,"WoltlabImage",{enumerable:!0,get:function(){return i.WoltlabImage}})}.apply(t,n),void 0===o||(e.exports=o)},3490:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(5048)],o=function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabImage=void 0;class o extends i.Plugin{static get pluginName(){return"WoltlabImage"}static get requires(){return[n.ImageUtils]}init(){this.#M(this.editor.commands.get("uploadImage")),this.#M(this.editor.commands.get("insertImage")),this.#M(this.editor.commands.get("replaceImageSource"));const{conversion:e}=this.editor,t=["imageBlock","imageInline"],i=this.editor.plugins.get("ImageUtils");for(const n of t)e.for("dataDowncast").attributeToAttribute({model:{name:n,key:"data-width"},view:"data-width"}),e.for("upcast").attributeToAttribute({view:{name:"imageBlock"===n?"figure":"img",key:"data-width"},model:"data-width"}),e.for("dataDowncast").add((e=>{e.on(`attribute:resizedWidth:${n}`,((e,t,i)=>{this.#O(t.item,t.attributeNewValue,i)}),{priority:"lowest"})})),e.for("editingDowncast").add((e=>{e.on(`insert:${n}`,((e,{item:t},n)=>{const{mapper:o,writer:s}=n,{domConverter:r}=this.editor.editing.view,a=o.toViewElement(t);if(!a||!a.is("containerElement")||1!==a.childCount)return;const l=a.getChild(0);if(!l.is("element"))return;const c=r.viewToDom(i.findViewImgElement(l));if(!(c instanceof HTMLImageElement))return;const d=()=>{s.setStyle("max-width",`${c.naturalWidth}px`,a)};c.complete&&0!==c.naturalHeight?d():c.addEventListener("load",(()=>d()),{once:!0})})),e.on(`attribute:resizedWidth:${n}`,((e,t,i)=>{this.#O(t.item,t.attributeNewValue,i)}),{priority:"lowest"})}))}#O(e,t,i){if(!e.is("element"))return;if("string"!=typeof t)return;const{mapper:n,writer:o}=i,s=n.toViewElement(e);if(void 0===s)return;const r=this.editor.plugins.get("ImageUtils");o.setAttribute("data-width",t,r.findViewImgElement(s))}#M(e){const t=this.editor.plugins.get("ImageUtils");e?.on("set:isEnabled",((e,i,n)=>{if(!n)return;const o=this.editor.model.document.selection,s=t.getClosestSelectedImageElement(o);s&&(e.return=!(this.#L(s)||this.#F(s)))}),{priority:"high"})}#L(e){return"woltlabAttachment"===e.getAttribute("classList")||e.hasAttribute("attachmentId")}#F(e){return"woltlabSuiteMedia"===e.getAttribute("classList")||e.hasAttribute("mediaId")}}t.WoltlabImage=o,t.default=o}.apply(t,n),void 0===o||(e.exports=o)},1151:(e,t,i)=>{var n,o;n=[i,t,i(2222)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabMagicParagraph=void 0,Object.defineProperty(t,"WoltlabMagicParagraph",{enumerable:!0,get:function(){return i.WoltlabMagicParagraph}})}.apply(t,n),void 0===o||(e.exports=o)},2222:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(151)],o=function(e,t,i,n){"use strict";var o;Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabMagicParagraph=void 0;class s extends i.Plugin{static blockModels=["blockQuote","codeBlock","spoiler","table"];static get pluginName(){return"WoltlabMagicParagraph"}init(){const{mapper:e,view:t}=this.editor.editing,{document:i,domConverter:s}=t;t.addObserver(n.ClickObserver),this.listenTo(i,"click",((t,n)=>{const{domEvent:r,target:a}=n;if(void 0===a)return;const l=a.getAncestors();l.push(a);for(const e of l)if(e.is("element","p")||e.is("element","li"))return;const{clientY:c}=r,d=i.getRoot(),u=d.getChild(0);if(void 0!==u){if(u.is("containerElement")){let i=u,n=e.toModelElement(i);if(void 0===n&&i.childCount>0){const t=i.getChild(0);t.is("containerElement")&&(i=t,n=e.toModelElement(i))}if(n&&o.blockModels.includes(n.name)){const e=s.mapViewToDom(i),{top:n}=e.getBoundingClientRect();if(c<=n)return t.stop(),void this.#N(i)}}if(0!==d.childCount){const i=d.getChild(d.childCount-1);if(i.is("containerElement")){let n=i,r=e.toModelElement(n);if(void 0===r&&n.childCount>0){const t=n.getChild(n.childCount-1);t.is("containerElement")&&(n=t,r=e.toModelElement(n))}if(r&&o.blockModels.includes(r.name)){const e=s.mapViewToDom(n),{bottom:i}=e.getBoundingClientRect();if(c>=i)return t.stop(),void this.#D(n)}}}for(const e of this.#z()){const i=s.mapViewToDom(e),{bottom:n,top:o}=i.getBoundingClientRect(),{marginBottom:r,marginTop:a}=window.getComputedStyle(i),l=o-parseInt(a),d=n+parseInt(r);if(c<l)return;if(c>=l&&c<=o)return this.#N(e),void t.stop();if(c>=n&&c<=d)return this.#D(e),void t.stop()}}}))}#N(e){const{mapper:t}=this.editor.editing;let i;i=e.previousSibling&&e.previousSibling.is("element","p")?t.toModelElement(e.previousSibling):void 0,this.editor.model.change((n=>{if(void 0===i){i=n.createElement("paragraph");const o=n.createPositionBefore(t.toModelElement(e));n.insert(i,o)}n.setSelection(i,"end")}))}#D(e){const{mapper:t}=this.editor.editing;let i;i=e.nextSibling&&e.nextSibling.is("element","p")?t.toModelElement(e.nextSibling):void 0,this.editor.model.change((n=>{if(void 0===i){i=n.createElement("paragraph");const o=n.createPositionAfter(t.toModelElement(e));n.insert(i,o)}n.setSelection(i,"end")}))}*#z(){const{mapper:e,view:t}=this.editor.editing,i=t.document.getRoot(),n=t.createRangeIn(i);for(const t of n.getWalker({ignoreElementEnd:!0})){const i=t.item;if(!i.is("containerElement"))continue;const n=e.toModelElement(i);void 0!==n&&o.blockModels.includes(n.name)&&(yield i)}}}t.WoltlabMagicParagraph=s,o=s,t.default=s}.apply(t,n),void 0===o||(e.exports=o)},5107:(e,t,i)=>{var n,o;n=[i,t,i(2196)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabMedia=void 0,Object.defineProperty(t,"WoltlabMedia",{enumerable:!0,get:function(){return i.WoltlabMedia}})}.apply(t,n),void 0===o||(e.exports=o)},2196:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(5048),i(5123)],o=function(e,t,i,n,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabMedia=void 0;class s extends i.Plugin{static get pluginName(){return"WoltlabMedia"}static get requires(){return[n.Image,o.WoltlabMetacode,n.ImageUtils]}init(){this.#W()}#W(){const{conversion:e,model:t}=this.editor,{schema:i}=t,n=["imageBlock","imageInline"];n.forEach((t=>{i.extend(t,{allowAttributes:["mediaId","mediaSize"]}),e.attributeToAttribute({model:{key:"classList",values:["woltlabSuiteMedia"]},view:{woltlabSuiteMedia:{name:"imageBlock"===t?"figure":"img",key:"class",value:"woltlabSuiteMedia"}}})}));const o=new Map([["mediaId","data-media-id"],["mediaSize","data-media-size"]]),s=this.editor.plugins.get("ImageUtils");Array.from(o.entries()).forEach((([t,i])=>{e.for("upcast").attributeToAttribute({view:i,model:t}),e.for("downcast").add((e=>{n.forEach((n=>{e.on(`attribute:${t}:${n}`,((e,t,n)=>{if(!n.consumable.consume(t.item,e.name))return;const o=n.writer,r=s.findViewImgElement(n.mapper.toViewElement(t.item));null!==t.attributeNewValue?o.setAttribute(i,t.attributeNewValue,r):o.removeAttribute(i,r)}))}))}))}))}}t.WoltlabMedia=s,t.default=s}.apply(t,n),void 0===o||(e.exports=o)},2473:(e,t,i)=>{var n,o;n=[i,t,i(6296)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabMention=void 0,Object.defineProperty(t,"WoltlabMention",{enumerable:!0,get:function(){return i.WoltlabMention}})}.apply(t,n),void 0===o||(e.exports=o)},6296:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(2801),i(5123),i(7906)],o=function(e,t,i,n,o,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabMention=void 0;class r extends i.Plugin{static get pluginName(){return"WoltlabMention"}static get requires(){return[n.Mention,o.WoltlabMetacode]}init(){this.editor.plugins.get("WoltlabMetacode").on("upcast",((e,t)=>{"user"===t.name&&1===t.attributes.length&&(Number.isNaN(parseInt(t.attributes[0].toString()))||(e.stop(),this.#H(t)))})),this.#w()}#H(e){const{attributes:t,conversionApi:i,data:n,name:o}=e,{writer:r}=i,{viewItem:a}=n,l=a.getChild(0);Object.assign(n,i.convertChildren(n.viewItem,n.modelCursor));for(const e of Array.from(n.modelRange.getItems()))(e.is("$text")||e.is("$textProxy"))&&r.setAttribute("mention",{id:t[0].toString(),objectId:t[0],type:o,uid:(0,s.uid)(),_text:l.data},e)}#w(){this.editor.conversion.for("dataDowncast").attributeToElement({model:"mention",view:(e,{writer:t})=>{if(!e)return;const i=e.objectId;return t.createAttributeElement("woltlab-metacode",{"data-name":e.type,"data-attributes":btoa(JSON.stringify([i]))},{priority:20,id:e.uid})},converterPriority:"high"})}}t.WoltlabMention=r,t.default=r}.apply(t,n),void 0===o||(e.exports=o)},5123:(e,t,i)=>{var n,o;n=[i,t,i(6178)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabMetacode=void 0,Object.defineProperty(t,"WoltlabMetacode",{enumerable:!0,get:function(){return i.WoltlabMetacode}})}.apply(t,n),void 0===o||(e.exports=o)},6178:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(7906)],o=function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabMetacode=void 0;class o extends i.Plugin{static get pluginName(){return"WoltlabMetacode"}init(){this.editor.data.htmlProcessor.domConverter.inlineObjectElements.push("woltlab-metacode"),this.editor.editing.view.domConverter.inlineObjectElements.push("woltlab-metacode"),this.#U()}#U(){this.editor.conversion.for("upcast").add((e=>{e.on("element:woltlab-metacode",((e,t,i)=>{const{consumable:o,convertChildren:s,writer:r}=i,{viewItem:a}=t;if(!o.test(a,{name:!0}))return;const l=a.getAttribute("data-name");if(void 0===l)return;const c=this.#$(a.getAttribute("data-attributes")||""),d=new n.EventInfo(this,"upcast"),u={attributes:c,conversionApi:i,data:t,name:l};if(this.fire(d,u),d.stop.called)return;let{modelCursor:h}=t;const m=this.#j(c),g=r.createText(`[${l}${m}]`),f=r.createText(`[/${l}]`),p=h.parent;let b=!1;const w=h.getAncestors();if("$root"===w[w.length-1].name)b=!0;else if("blockQuote"===p.name)b=!0;else for(const e of a.getChildren())if(e.is("containerElement")){b=!0;break}if(b){let e=r.createElement("paragraph");r.insert(g,e),r.insert(e,h),h=r.createPositionAfter(e);const i=s(a,h);e=r.createElement("paragraph"),r.insert(f,e),r.insert(e,i.modelCursor),t.modelCursor=r.createPositionAfter(e)}else{r.insert(g,h),h=h.getShiftedBy(g.offsetSize);const e=s(a,h);r.insert(f,e.modelCursor),t.modelCursor=e.modelCursor.getShiftedBy(f.offsetSize)}}))}))}#$(e){if(""===e)return[];const t=atob(e);let i;try{i=JSON.parse(t)}catch(e){return[]}return i}#j(e){return 0===e.length?"":"="+e.map((e=>"number"==typeof e?e.toString():`'${e}'`)).join(",")}}t.WoltlabMetacode=o,t.default=o}.apply(t,n),void 0===o||(e.exports=o)},6976:(e,t,i)=>{var n,o;n=[i,t,i(2286),i(7701)],o=function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabSmileyCommand=t.WoltlabSmiley=void 0,Object.defineProperty(t,"WoltlabSmiley",{enumerable:!0,get:function(){return i.WoltlabSmiley}}),Object.defineProperty(t,"WoltlabSmileyCommand",{enumerable:!0,get:function(){return n.default}})}.apply(t,n),void 0===o||(e.exports=o)},2286:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(5048),i(1092),i(6734)],o=function(e,t,i,n,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabSmiley=void 0;class s extends i.Plugin{static get pluginName(){return"WoltlabSmiley"}static get requires(){return[n.Image,o.WoltlabSmileyUi]}init(){const{conversion:e,model:t}=this.editor,i=["imageBlock","imageInline"];for(const e of i)t.schema.extend(e,{allowAttributes:["classList"]});e.attributeToAttribute({model:{key:"classList",values:["smiley"]},view:{smiley:{name:"img",key:"class",value:"smiley"}}}),e.for("editingDowncast").add((e=>{e.on("insert:imageInline",((e,t,i)=>{const{item:n}=t;if("smiley"!==n.getAttribute("classList"))return;if(!n.is("element"))return;const{consumable:o,mapper:s,writer:r}=i;if(!o.test(n,"insert"))return;o.consume(n,"insert");const a=r.createEmptyElement("img");r.setAttribute("translate","no",a);const l=s.toViewPosition(this.editor.model.createPositionBefore(n));r.insert(l,a),s.bindElements(n,a)}),{priority:"high"})}))}}t.WoltlabSmiley=s,t.default=s}.apply(t,n),void 0===o||(e.exports=o)},7701:(e,t,i)=>{var n,o;n=[i,t,i(1024)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class n extends i.Command{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}execute(e){const t=this.editor.model,i=t.document.selection,n=("string"==typeof e.smiley?{id:e.smiley}:e.smiley).id,o=e.range||i.getFirstRange();if(!t.canEditAt(o))return;const s=e.html||n;t.change((e=>{const i=this.editor.data.processor.toView(s),n=this.editor.data.toModel(i),r=t.insertContent(n,o);e.setSelection(t.insertContent(e.createText(" "),r.end).end)}))}}t.default=n}.apply(t,n),void 0===o||(e.exports=o)},1092:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(7243),i(6192),i(7906),i(2801),i(7701)],o=function(e,t,i,n,o,s,r,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabSmileyUi=void 0,t.getRegexExp=f;const l="smiley",c=[s.keyCodes.enter,s.keyCodes.tab],d=[s.keyCodes.arrowup,s.keyCodes.arrowdown,s.keyCodes.esc,...c];class u extends i.Plugin{#q;#K;#G=new s.Collection;constructor(e){super(e),this.#K=this.#Z()}static get pluginName(){return"WoltlabSmileyUI"}static get requires(){return[n.ContextualBalloon]}get#J(){return this.#q.visibleView===this.#K}init(){this.#q=this.editor.plugins.get(n.ContextualBalloon),this.editor.commands.add("smiley",new a.default(this.editor)),this.editor.editing.view.document.on("keydown",((e,t)=>{var i;i=t.keyCode,d.includes(i)&&this.#J&&(t.preventDefault(),e.stop(),t.keyCode==s.keyCodes.arrowdown&&this.#K.selectNext(),t.keyCode==s.keyCodes.arrowup&&this.#K.selectPrevious(),c.includes(t.keyCode)&&this.#K.executeSelected(),t.keyCode==s.keyCodes.esc&&this.#Q())}),{priority:"highest"}),this.#Y(),(0,n.clickOutsideHandler)({emitter:this.#K,activator:()=>this.#J,contextElements:()=>[this.#q.view.element],callback:()=>this.#Q()}),this.listenTo(this.editor,"change:isReadOnly",(()=>{this.#Q()}))}destroy(){super.destroy(),this.#K?.destroy()}#Z(){const e=new r.MentionsView(this.editor.locale);return e.items.bindTo(this.#G).using((t=>{const{item:i,marker:n}=t;if(e.items.length>=10)return null;const o=new r.MentionListItemView(this.editor.locale),s=this.#X(i);return s.delegate("execute").to(o),o.children.add(s),o.item=i,o.marker=n,o.on("execute",(()=>{e.fire("execute",{item:i,marker:n})})),o})),e.on("execute",((e,t)=>{const i=this.editor,n=i.model,o=t.item,s=i.model.markers.get(l),r=n.createPositionAt(n.document.selection.focus),a=n.createPositionAt(s.getStart()),c=n.createRange(a,r);this.#Q(),i.execute("smiley",{smiley:o,html:o.text,range:c}),i.editing.view.focus()})),e}#X(e){const t=this.editor,i=document.createElement("span");return i.classList.add("ckeditor5__mention","ckeditor5__smiley"),i.innerHTML=`${e.text} ${e.id}`,new r.DomWrapperView(t.locale,i)}#Y(){const e=this.editor,t=new o.TextWatcher(e.model,(e=>void 0!==h(e)));t.on("matched",((t,i)=>{const n=h(i.text),o=i.text.substring(n).match(f())[0],s=i.range.start.getShiftedBy(n),r=e.model.createRange(s,s.getShiftedBy(1));if(m(e)){const t=e.model.markers.get(l);e.model.change((e=>{e.updateMarker(t,{range:r})}))}else e.model.change((e=>{e.addMarker(l,{range:r,usingOperation:!1,affectsData:!1})}));this.#G.clear(),(e.config.get("woltlabSmileys")||[]).filter((e=>e.code.startsWith(o))).forEach((e=>{this.#G.add({item:{id:e.code,text:e.html},marker:l})})),this.#G.length?this.#ee():this.#Q()})),t.on("unmatched",(()=>{this.#Q()}));const i=e.commands.get("smiley");t.bind("isEnabled").to(i)}#Q(){this.#q.hasView(this.#K)&&this.#q.remove(this.#K),m(this.editor)&&this.editor.model.change((e=>e.removeMarker(l)))}#ee(){const e=this.editor.model.markers.get(l);e?(this.#J?this.#q.updatePosition(this._getBalloonPanelPositionData(e,this.#K.position)):this.#q.add({view:this.#K,position:this._getBalloonPanelPositionData(e,this.#K.position),singleViewMode:!0}),this.#K.position=this.#q.view.position,this.#K.selectFirst()):this.#Q()}_getBalloonPanelPositionData(e,t){const i=this.editor,n=i.editing,o=n.view.domConverter,r=n.mapper;return{target:()=>{let t=e.getRange();"$graveyard"==t.start.root.rootName&&(t=i.model.document.selection.getFirstRange());const n=r.toViewRange(t);return s.Rect.getDomRangeRects(o.viewRangeToDom(n)).pop()},limiter:()=>{const e=this.editor.editing.view,t=e.document.selection.editableElement;return t?e.domConverter.mapViewToDom(t.root):null},positions:g(t,i.locale.uiLanguageDirection)}}}function h(e){const t=e.lastIndexOf(":");if(-1!==t&&e.substring(t-1).match(f()))return t}function m(e){return e.model.markers.has(l)}function g(e,t){const i={caret_se:e=>({top:e.bottom+3,left:e.right,name:"caret_se",config:{withArrow:!1}}),caret_ne:(e,t)=>({top:e.top-t.height-3,left:e.right,name:"caret_ne",config:{withArrow:!1}}),caret_sw:(e,t)=>({top:e.bottom+3,left:e.right-t.width,name:"caret_sw",config:{withArrow:!1}}),caret_nw:(e,t)=>({top:e.top-t.height-3,left:e.right-t.width,name:"caret_nw",config:{withArrow:!1}})};return Object.prototype.hasOwnProperty.call(i,e)?[i[e]]:"rtl"!==t?[i.caret_se,i.caret_sw,i.caret_ne,i.caret_nw]:[i.caret_sw,i.caret_se,i.caret_nw,i.caret_ne]}function f(){const e=s.env.features.isRegExpUnicodePropertySupported?"\\p{Ps}\\p{Pi}\"'":"\\(\\[{\"'";return new RegExp(`(?:^|[ ${e}])(:)([a-z]+(?:_[a-z]+)*)$`,"u")}t.WoltlabSmileyUi=u}.apply(t,n),void 0===o||(e.exports=o)},6153:(e,t,i)=>{var n,o;n=[i,t,i(772),i(1315)],o=function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabSpoilerCommand=t.WoltlabSpoiler=void 0,Object.defineProperty(t,"WoltlabSpoiler",{enumerable:!0,get:function(){return i.WoltlabSpoiler}}),Object.defineProperty(t,"WoltlabSpoilerCommand",{enumerable:!0,get:function(){return n.WoltlabSpoilerCommand}})}.apply(t,n),void 0===o||(e.exports=o)},772:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(254)],o=function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabSpoiler=void 0;class o extends i.Plugin{static get requires(){return[n.default]}static get pluginName(){return"WoltlabSpoiler"}}t.WoltlabSpoiler=o,t.default=o}.apply(t,n),void 0===o||(e.exports=o)},1315:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(151),i(7906)],o=function(e,t,i,n,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabSpoilerCommand=void 0;class s extends i.Command{execute(){const{model:e}=this.editor,{schema:t}=e,{selection:i}=e.document,n=Array.from(i.getSelectedBlocks());e.change((e=>{if(this.value)this.#te(e,n);else{const i=n.filter((e=>this.#ie(e)||this.#ne(t,e)));this.#oe(e,i)}}))}refresh(){this.value=this.#se(),this.isEnabled=this.#i()}#te(e,t){for(const i of t){const t=this.#ie(i);if(null===t)continue;const o=t.previousSibling;if(null===o||!o.is("element","spoilerTitle"))throw new Error("Invalid structure, expected a `<spoilerTitle>` adjacent to `<spoilerContent>`",{cause:{spoilerTitle:o}});const s=t.parent;if(!(s instanceof n.Element&&s.is("element","spoiler")))throw new Error("Invalid structure, expected a `<spoiler>` as the parent of a `<spoilerContent>`",{cause:{spoiler:s}});e.remove(o),e.unwrap(s),e.unwrap(t)}}#oe(e,t){const i=[];this.#re(e,t).reverse().forEach((t=>{let n=this.#ie(t.start);n||(n=this.#ae(e,t)),i.push(n.parent)})),i.reverse().reduce(((t,i)=>{if(t.nextSibling===i){const n=t.getChild(1),o=i.getChild(1);return e.move(e.createRangeIn(o),e.createPositionAt(n,"end")),e.remove(i),t}return i}))}#re(e,t){let i=null,n=0;const o=[];for(;n<t.length;){const s=t[n],r=t[n+1];i||(i=e.createPositionBefore(s)),r&&s.nextSibling===r||(o.push(e.createRange(i,e.createPositionAfter(s))),i=null),n++}return o}#i(){if(this.value)return!0;const{selection:e}=this.editor.model.document,t=(0,o.first)(e.getSelectedBlocks());if(!t)return!1;const{schema:i}=this.editor.model;return this.#ne(i,t)}#se(){const{selection:e}=this.editor.model.document,t=(0,o.first)(e.getSelectedBlocks());return!(!t||!this.#ie(t))}#ie(e){return e.parent instanceof n.Element?"spoilerContent"===e.parent.name?e.parent:this.#ie(e.parent):null}#ne(e,t){const i=e.checkChild(t.parent,"spoiler"),n=e.checkChild("spoilerContent",t);return i&&n}#ae(e,t){const i=e.createElement("spoilerContent");e.wrap(t,i);const n=e.createElement("spoiler");e.wrap(e.createRangeOn(i),n);const o=e.createElement("spoilerTitle");return e.insert(o,n,0),i}}t.WoltlabSpoilerCommand=s,t.default=s}.apply(t,n),void 0===o||(e.exports=o)},254:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(3906),i(151),i(7243),i(1315),i(1278)],o=function(e,t,i,n,o,s,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabSpoilerEditing=void 0;class a extends i.Plugin{static get pluginName(){return"WoltlabSpoilerEditing"}static get requires(){return[n.Widget]}init(){this.#le(),this.#U(),this.editor.commands.add("insertSpoiler",new r.default(this.editor)),this.#ce()}#ce(){const{t:e}=this.editor.locale;this.editor.ui.componentFactory.add("spoiler",(t=>{const i=this.editor.commands.get("insertSpoiler"),n=new s.ButtonView(t);return n.set({label:e("Spoiler"),tooltip:!0,withText:!0}),n.labelView.setTemplate({tag:"fa-icon",attributes:{name:"eye-slash"}}),n.bind("isOn").to(i,"value"),n.bind("isEnabled").to(i,"isEnabled"),this.listenTo(n,"execute",(()=>this.editor.execute("insertSpoiler"))),n}))}#le(){const{schema:e}=this.editor.model;e.register("spoiler",{allowWhere:"$block",isObject:!0}),e.register("spoilerTitle",{allowChildren:"$text",allowIn:"spoiler",isLimit:!0}),e.register("spoilerContent",{allowContentOf:"$root",allowIn:"spoiler",isLimit:!0}),e.addChildCheck(((e,t)=>("spoiler"!==t.name||!Array.from(e.getNames()).includes("spoiler"))&&(!e.endsWith("spoilerContent")||"spoiler"!==t.name)&&(!e.endsWith("spoilerTitle")||"$text"===t.name)&&void 0)),e.addAttributeCheck((e=>{if(e.endsWith("spoilerTitle $text"))return!1}))}#U(){const{conversion:e}=this.editor,{t}=this.editor.locale;e.for("upcast").add((e=>{e.on("element:woltlab-spoiler",((e,t,i)=>{const{consumable:n,writer:o,safeInsert:s,convertChildren:r,updateConversionResult:a}=i,{viewItem:l}=t,c={name:!0};if(!n.test(l,c))return;const d=o.createElement("spoiler"),u=o.createElement("spoilerTitle");o.append(u,d);const h=(l.getAttribute("data-label")||"").trim();o.appendText(h,u);const m=o.createElement("spoilerContent");o.append(m,d),s(d,t.modelCursor)&&(n.consume(l,c),r(l,m),a(d,t))}))})),e.for("dataDowncast").add((e=>{e.on("insert:spoiler",((e,t,i)=>{const{item:n}=t,{consumable:o,mapper:s,writer:r}=i;if(2!==n.childCount)return null;const a=n.getChild(0);if(!a.is("element","spoilerTitle"))return null;if(!o.consume(n,"insert"))return;o.consume(a,"insert");let l="";if(1===a.childCount){const e=a.getChild(0);e.is("$text")&&(l=e.data)}const c=r.createContainerElement("woltlab-spoiler",{"data-label":l}),d=s.toViewPosition(this.editor.model.createPositionBefore(n));r.insert(d,c),s.bindElements(n,c),s.bindElements(a,c);const u=n.getChild(1);u.is("element","spoilerContent")&&(s.bindElements(u,c),o.consume(u,"insert"))})),e.on("insert:$text",((e,t,i)=>{const n=t.item.parent;n&&n.is("element","spoilerTitle")&&i.consumable.consume(t.item,"insert")}))})),e.for("editingDowncast").elementToElement({model:"spoiler",view:(e,{writer:t})=>{const i=t.createContainerElement("div",{class:"ck-woltlabspoiler"});return(0,n.toWidget)(i,t,{hasSelectionHandle:!0,label:"spoiler widget"})}}).elementToElement({model:"spoilerTitle",view:(e,{writer:i})=>{const s=i.createEditableElement("div",{class:"ck-woltlabspoiler__title","data-label":t("Spoiler")});return s.placeholder=t("Type your title"),(0,o.enablePlaceholder)({view:this.editor.editing.view,element:s,keepOnFocus:!0}),(0,n.toWidgetEditable)(s,i)}}).elementToElement({model:"spoilerContent",view:(e,{writer:t})=>{const i=t.createEditableElement("div",{class:"ck-woltlabspoiler__content"});return(0,n.toWidgetEditable)(i,t)}})}}t.WoltlabSpoilerEditing=a,t.default=a}.apply(t,n),void 0===o||(e.exports=o)},3806:(e,t,i)=>{var n,o;n=[i,t,i(4565)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabToolbarGroup=void 0,Object.defineProperty(t,"WoltlabToolbarGroup",{enumerable:!0,get:function(){return i.WoltlabToolbarGroup}})}.apply(t,n),void 0===o||(e.exports=o)},4565:(e,t,i)=>{var n,o;n=[i,t,i(1024)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabToolbarGroup=void 0;class n extends i.Plugin{static get pluginName(){return"WoltlabToolbarGroup"}init(){const e=this.editor.config.get("woltlabToolbarGroup");e&&this.editor.once("ready",(()=>{const t=this.editor.ui.view.toolbar.items;Object.entries(e).forEach((([e,i])=>{const n=t.find((t=>null!==t.element?.querySelector(`[data-cke-tooltip-text="woltlabToolbarGroup_${e}"]`))),o=n.element.querySelector(".ck-button__icon"),[s,r]=i.icon.split(";",2),a=document.createElement("fa-icon");a.setIcon(s,"true"===r),o.replaceWith(a),n.buttonView.label=i.label}))}))}}t.WoltlabToolbarGroup=n,t.default=n}.apply(t,n),void 0===o||(e.exports=o)},5842:(e,t,i)=>{var n,o;n=[i,t,i(7873)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabUpload=void 0,Object.defineProperty(t,"WoltlabUpload",{enumerable:!0,get:function(){return i.WoltlabUpload}})}.apply(t,n),void 0===o||(e.exports=o)},7873:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(4857),i(135)],o=function(e,t,i,n,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabUpload=void 0;class s extends i.Plugin{static get pluginName(){return"WoltlabUpload"}static get requires(){return[n.FileRepository]}init(){const{config:e,editing:t,plugins:i}=this.editor,s=e.get("woltlabUpload");s&&"function"==typeof s.uploadImage&&(i.get(n.FileRepository).createUploadAdapter=e=>new o.WoltlabUploadAdapter(e,s),"function"==typeof s.uploadOther&&this.listenTo(t.view.document,"clipboardInput",((e,t)=>{if(e.stop.called)return;const{dataTransfer:i,method:n}=t;if("drop"===n){for(const e of i.files)null!==e&&s.uploadOther(e);e.stop()}}),{priority:"lowest"}))}}t.WoltlabUpload=s,t.default=s}.apply(t,n),void 0===o||(e.exports=o)},135:(e,t,i)=>{var n;n=function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabUploadAdapter=void 0;class i{#de;#ue;#he;constructor(e,t){this.#de=e,this.#ue=t}abort(){this.#he?.abort()}async upload(){const e=await this.#de.file;return this.#he=new AbortController,this.#ue.uploadImage(e,this.#he)}}t.WoltlabUploadAdapter=i,t.default=i}.apply(t,[i,t]),void 0===n||(e.exports=n)},7109:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Alignment:()=>f,AlignmentEditing:()=>u,AlignmentUI:()=>g});var n=i(1204),o=i(5318);const s=["left","right","center","justify"];function r(e){return s.includes(e)}function a(e,t){return"rtl"==t.contentLanguageDirection?"right"===e:"left"===e}function l(e){const t=e.map((e=>{let t;return t="string"==typeof e?{name:e}:e,t})).filter((e=>{const t=s.includes(e.name);return t||(0,o.FF)("alignment-config-name-not-recognized",{option:e}),t})),i=t.filter((e=>Boolean(e.className))).length;if(i&&i<t.length)throw new o.Yb("alignment-config-classnames-are-missing",{configuredOptions:e});return t.forEach(((t,i,n)=>{const s=n.slice(i+1);if(s.some((e=>e.name==t.name)))throw new o.Yb("alignment-config-name-already-defined",{option:t,configuredOptions:e});if(t.className&&s.some((e=>e.className==t.className)))throw new o.Yb("alignment-config-classname-already-defined",{option:t,configuredOptions:e})})),t}const c="alignment";class d extends n.uB{refresh(){const e=this.editor.locale,t=(0,o.$1)(this.editor.model.document.selection.getSelectedBlocks());this.isEnabled=Boolean(t)&&this._canBeAligned(t),this.isEnabled&&t.hasAttribute("alignment")?this.value=t.getAttribute("alignment"):this.value="rtl"===e.contentLanguageDirection?"right":"left"}execute(e={}){const t=this.editor,i=t.locale,n=t.model,o=n.document,s=e.value;n.change((e=>{const t=Array.from(o.selection.getSelectedBlocks()).filter((e=>this._canBeAligned(e))),n=t[0].getAttribute("alignment");a(s,i)||n===s||!s?function(e,t){for(const i of e)t.removeAttribute(c,i)}(t,e):function(e,t,i){for(const n of e)t.setAttribute(c,i,n)}(t,e,s)}))}_canBeAligned(e){return this.editor.model.schema.checkAttribute(e,c)}}class u extends n.k_{static get pluginName(){return"AlignmentEditing"}constructor(e){super(e),e.config.define("alignment",{options:s.map((e=>({name:e})))})}init(){const e=this.editor,t=e.locale,i=e.model.schema,n=l(e.config.get("alignment.options")).filter((e=>r(e.name)&&!a(e.name,t))),o=n.some((e=>!!e.className));i.extend("$block",{allowAttributes:"alignment"}),e.model.schema.setAttributeProperties("alignment",{isFormatting:!0}),o?e.conversion.attributeToAttribute(function(e){const t={};for(const i of e)t[i.name]={key:"class",value:i.className};return{model:{key:"alignment",values:e.map((e=>e.name))},view:t}}(n)):e.conversion.for("downcast").attributeToAttribute(function(e){const t={};for(const{name:i}of e)t[i]={key:"style",value:{"text-align":i}};return{model:{key:"alignment",values:e.map((e=>e.name))},view:t}}(n));const s=function(e){const t=[];for(const{name:i}of e)t.push({view:{key:"style",value:{"text-align":i}},model:{key:"alignment",value:i}});return t}(n);for(const t of s)e.conversion.for("upcast").attributeToAttribute(t);const c=function(e){const t=[];for(const{name:i}of e)t.push({view:{key:"align",value:i},model:{key:"alignment",value:i}});return t}(n);for(const t of c)e.conversion.for("upcast").attributeToAttribute(t);e.commands.add("alignment",new d(e))}}var h=i(949);const m=(()=>new Map([["left",n.Pt.alignLeft],["right",n.Pt.alignRight],["center",n.Pt.alignCenter],["justify",n.Pt.alignJustify]]))();class g extends n.k_{get localizedOptionTitles(){const e=this.editor.t;return{left:e("Align left"),right:e("Align right"),center:e("Align center"),justify:e("Justify")}}static get pluginName(){return"AlignmentUI"}init(){const e=l(this.editor.config.get("alignment.options"));e.map((e=>e.name)).filter(r).forEach((e=>this._addButton(e))),this._addToolbarDropdown(e),this._addMenuBarMenu(e)}_addButton(e){this.editor.ui.componentFactory.add(`alignment:${e}`,(t=>this._createButton(t,e)))}_createButton(e,t,i={}){const n=this.editor,o=n.commands.get("alignment"),s=new h._(e);return s.set({label:this.localizedOptionTitles[t],icon:m.get(t),tooltip:!0,isToggleable:!0,...i}),s.bind("isEnabled").to(o),s.bind("isOn").to(o,"value",(e=>e===t)),this.listenTo(s,"execute",(()=>{n.execute("alignment",{value:t}),n.editing.view.focus()})),s}_addToolbarDropdown(e){const t=this.editor;t.ui.componentFactory.add("alignment",(i=>{const n=(0,h.yu)(i),o="rtl"===i.uiLanguageDirection?"w":"e",s=i.t;(0,h.fM)(n,(()=>e.map((e=>this._createButton(i,e.name,{tooltipPosition:o})))),{enableActiveItemFocusOnDropdownOpen:!0,isVertical:!0,ariaLabel:s("Text alignment toolbar")}),n.buttonView.set({label:s("Text alignment"),tooltip:!0}),n.extendTemplate({attributes:{class:"ck-alignment-dropdown"}});const r="rtl"===i.contentLanguageDirection?m.get("right"):m.get("left"),a=t.commands.get("alignment");return n.buttonView.bind("icon").to(a,"value",(e=>m.get(e)||r)),n.bind("isEnabled").to(a,"isEnabled"),this.listenTo(n,"execute",(()=>{t.editing.view.focus()})),n}))}_addMenuBarMenu(e){const t=this.editor;t.ui.componentFactory.add("menuBar:alignment",(i=>{const n=t.commands.get("alignment"),o=i.t,s=new h.zj(i),r=new h.BY(i);s.bind("isEnabled").to(n),r.set({ariaLabel:o("Text alignment"),role:"menu"}),s.buttonView.set({label:o("Text alignment")});for(const o of e){const e=new h.I8(i,s),a=new h.kS(i);a.delegate("execute").to(s),a.set({label:this.localizedOptionTitles[o.name],icon:m.get(o.name),role:"menuitemcheckbox",isToggleable:!0}),a.on("execute",(()=>{t.execute("alignment",{value:o.name}),t.editing.view.focus()})),a.bind("isOn").to(n,"value",(e=>e===o.name)),a.bind("isEnabled").to(n,"isEnabled"),e.children.add(a),r.items.add(e)}return s.panelView.children.add(r),s}))}}class f extends n.k_{static get requires(){return[u,g]}static get pluginName(){return"Alignment"}}},7933:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Autosave:()=>r});var n=i(1204),o=i(5318),s=i(2223);class r extends n.k_{static get pluginName(){return"Autosave"}static get requires(){return[n.TS]}constructor(e){super(e),this._action=null;const t=e.config.get("autosave")||{},i=t.waitingTime||1e3;this.set("state","synchronized"),this._debouncedSave=(0,s.A)(this._save.bind(this),i),this._lastDocumentVersion=e.model.document.version,this._savePromise=null,this._domEmitter=new((0,o.c5)()),this._config=t,this._pendingActions=e.plugins.get(n.TS),this._makeImmediateSave=!1}init(){const e=this.editor,t=e.model.document;this.listenTo(e,"ready",(()=>{this.listenTo(t,"change:data",((e,t)=>{this._saveCallbacks.length&&t.isLocal&&("synchronized"===this.state&&(this.state="waiting",this._setPendingAction()),"waiting"===this.state&&this._debouncedSave())}))})),this.listenTo(e,"destroy",(()=>this._flush()),{priority:"highest"}),this._domEmitter.listenTo(window,"beforeunload",((e,t)=>{this._pendingActions.hasAny&&(t.returnValue=this._pendingActions.first.message)}))}destroy(){this._domEmitter.stopListening(),super.destroy()}save(){return this._debouncedSave.cancel(),this._save()}_flush(){this._debouncedSave.flush()}_save(){return this._savePromise?(this._makeImmediateSave=this.editor.model.document.version>this._lastDocumentVersion,this._savePromise):(this._setPendingAction(),this.state="saving",this._lastDocumentVersion=this.editor.model.document.version,this._savePromise=Promise.resolve().then((()=>Promise.all(this._saveCallbacks.map((e=>e(this.editor)))))).finally((()=>{this._savePromise=null})).then((()=>{if(this._makeImmediateSave)return this._makeImmediateSave=!1,this._save();this.editor.model.document.version>this._lastDocumentVersion?(this.state="waiting",this._debouncedSave()):(this.state="synchronized",this._pendingActions.remove(this._action),this._action=null)})).catch((e=>{throw this.state="error",this.state="saving",this._debouncedSave(),e})),this._savePromise)}_setPendingAction(){const e=this.editor.t;this._action||(this._action=this._pendingActions.add(e("Saving changes")))}get _saveCallbacks(){const e=[];return this.adapter&&this.adapter.save&&e.push(this.adapter.save),this._config.save&&e.push(this._config.save),e}}},6191:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Bold:()=>u,BoldEditing:()=>r,BoldUI:()=>d,Code:()=>b,CodeEditing:()=>g,CodeUI:()=>p,Italic:()=>k,ItalicEditing:()=>v,ItalicUI:()=>y,Strikethrough:()=>T,StrikethroughEditing:()=>A,StrikethroughUI:()=>x,Subscript:()=>R,SubscriptEditing:()=>I,SubscriptUI:()=>V,Superscript:()=>F,SuperscriptEditing:()=>M,SuperscriptUI:()=>L,Underline:()=>H,UnderlineEditing:()=>D,UnderlineUI:()=>W});var n=i(1204);class o extends n.uB{constructor(e,t){super(e),this.attributeKey=t}refresh(){const e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){const t=this.editor.model,i=t.document.selection,n=void 0===e.forceValue?!this.value:e.forceValue;t.change((e=>{if(i.isCollapsed)n?e.setSelectionAttribute(this.attributeKey,!0):e.removeSelectionAttribute(this.attributeKey);else{const o=t.schema.getValidRanges(i.getRanges(),this.attributeKey);for(const t of o)n?e.setAttribute(this.attributeKey,n,t):e.removeAttribute(this.attributeKey,t)}}))}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,i=e.document.selection;if(i.isCollapsed)return i.hasAttribute(this.attributeKey);for(const e of i.getRanges())for(const i of e.getItems())if(t.checkAttribute(i,this.attributeKey))return i.hasAttribute(this.attributeKey);return!1}}const s="bold";class r extends n.k_{static get pluginName(){return"BoldEditing"}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:s}),e.model.schema.setAttributeProperties(s,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:s,view:"strong",upcastAlso:["b",e=>{const t=e.getStyle("font-weight");return t&&("bold"==t||Number(t)>=600)?{name:!0,styles:["font-weight"]}:null}]}),e.commands.add(s,new o(e,s)),e.keystrokes.set("CTRL+B",s),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Bold text"),keystroke:"CTRL+B"}]})}}var a=i(949);function l({editor:e,commandName:t,plugin:i,icon:n,label:o,keystroke:s}){return r=>{const l=e.commands.get(t),c=new r(e.locale);return c.set({label:o,icon:n,keystroke:s,isToggleable:!0}),c.bind("isEnabled").to(l,"isEnabled"),c.bind("isOn").to(l,"value"),c instanceof a.kS?c.set({role:"menuitemcheckbox"}):c.set({tooltip:!0}),i.listenTo(c,"execute",(()=>{e.execute(t),e.editing.view.focus()})),c}}const c="bold";class d extends n.k_{static get pluginName(){return"BoldUI"}init(){const e=this.editor,t=e.locale.t,i=l({editor:e,commandName:c,plugin:this,icon:n.Pt.bold,label:t("Bold"),keystroke:"CTRL+B"});e.ui.componentFactory.add(c,(()=>i(a._))),e.ui.componentFactory.add("menuBar:"+c,(()=>i(a.kS)))}}class u extends n.k_{static get requires(){return[r,d]}static get pluginName(){return"Bold"}}var h=i(7211);const m="code";class g extends n.k_{static get pluginName(){return"CodeEditing"}static get requires(){return[h.Vp]}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:m}),e.model.schema.setAttributeProperties(m,{isFormatting:!0,copyOnEnter:!1}),e.conversion.attributeToElement({model:m,view:"code",upcastAlso:{styles:{"word-wrap":"break-word"}}}),e.commands.add(m,new o(e,m)),e.plugins.get(h.Vp).registerAttribute(m),(0,h.Il)(e,m,"code","ck-code_selected"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Move out of an inline code style"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}}const f="code";class p extends n.k_{static get pluginName(){return"CodeUI"}init(){const e=this.editor,t=e.locale.t,i=l({editor:e,commandName:f,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m12.5 5.7 5.2 3.9v1.3l-5.6 4c-.1.2-.3.2-.5.2-.3-.1-.6-.7-.6-1l.3-.4 4.7-3.5L11.5 7l-.2-.2c-.1-.3-.1-.6 0-.8.2-.2.5-.4.8-.4a.8.8 0 0 1 .4.1zm-5.2 0L2 9.6v1.3l5.6 4c.1.2.3.2.5.2.3-.1.7-.7.6-1 0-.1 0-.3-.2-.4l-5-3.5L8.2 7l.2-.2c.1-.3.1-.6 0-.8-.2-.2-.5-.4-.8-.4a.8.8 0 0 0-.3.1z"/></svg>',label:t("Code")});e.ui.componentFactory.add(f,(()=>i(a._))),e.ui.componentFactory.add("menuBar:"+f,(()=>i(a.kS)))}}class b extends n.k_{static get requires(){return[g,p]}static get pluginName(){return"Code"}}const w="italic";class v extends n.k_{static get pluginName(){return"ItalicEditing"}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:w}),e.model.schema.setAttributeProperties(w,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:w,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),e.commands.add(w,new o(e,w)),e.keystrokes.set("CTRL+I",w),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Italic text"),keystroke:"CTRL+I"}]})}}const _="italic";class y extends n.k_{static get pluginName(){return"ItalicUI"}init(){const e=this.editor,t=e.locale.t,i=l({editor:e,commandName:_,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m9.586 14.633.021.004c-.036.335.095.655.393.962.082.083.173.15.274.201h1.474a.6.6 0 1 1 0 1.2H5.304a.6.6 0 0 1 0-1.2h1.15c.474-.07.809-.182 1.005-.334.157-.122.291-.32.404-.597l2.416-9.55a1.053 1.053 0 0 0-.281-.823 1.12 1.12 0 0 0-.442-.296H8.15a.6.6 0 0 1 0-1.2h6.443a.6.6 0 1 1 0 1.2h-1.195c-.376.056-.65.155-.823.296-.215.175-.423.439-.623.79l-2.366 9.347z"/></svg>',keystroke:"CTRL+I",label:t("Italic")});e.ui.componentFactory.add(_,(()=>i(a._))),e.ui.componentFactory.add("menuBar:"+_,(()=>i(a.kS)))}}class k extends n.k_{static get requires(){return[v,y]}static get pluginName(){return"Italic"}}const C="strikethrough";class A extends n.k_{static get pluginName(){return"StrikethroughEditing"}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:C}),e.model.schema.setAttributeProperties(C,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:C,view:"s",upcastAlso:["del","strike",{styles:{"text-decoration":"line-through"}}]}),e.commands.add(C,new o(e,C)),e.keystrokes.set("CTRL+SHIFT+X","strikethrough"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Strikethrough text"),keystroke:"CTRL+SHIFT+X"}]})}}const E="strikethrough";class x extends n.k_{static get pluginName(){return"StrikethroughUI"}init(){const e=this.editor,t=e.locale.t,i=l({editor:e,commandName:E,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 16.4c-.8-.4-1.5-.9-2.2-1.5a.6.6 0 0 1-.2-.5l.3-.6h1c1 1.2 2.1 1.7 3.7 1.7 1 0 1.8-.3 2.3-.6.6-.4.6-1.2.6-1.3.2-1.2-.9-2.1-.9-2.1h2.1c.3.7.4 1.2.4 1.7v.8l-.6 1.2c-.6.8-1.1 1-1.6 1.2a6 6 0 0 1-2.4.6c-1 0-1.8-.3-2.5-.6zM6.8 9 6 8.3c-.4-.5-.5-.8-.5-1.6 0-.7.1-1.3.5-1.8.4-.6 1-1 1.6-1.3a6.3 6.3 0 0 1 4.7 0 4 4 0 0 1 1.7 1l.3.7c0 .1.2.4-.2.7-.4.2-.9.1-1 0a3 3 0 0 0-1.2-1c-.4-.2-1-.3-2-.4-.7 0-1.4.2-2 .6-.8.6-1 .8-1 1.5 0 .8.5 1 1.2 1.5.6.4 1.1.7 1.9 1H6.8z"/><path d="M3 10.5V9h14v1.5z"/></svg>',keystroke:"CTRL+SHIFT+X",label:t("Strikethrough")});e.ui.componentFactory.add(E,(()=>i(a._))),e.ui.componentFactory.add("menuBar:"+E,(()=>i(a.kS)))}}class T extends n.k_{static get requires(){return[A,x]}static get pluginName(){return"Strikethrough"}}const P="subscript";class I extends n.k_{static get pluginName(){return"SubscriptEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:P}),e.model.schema.setAttributeProperties(P,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:P,view:"sub",upcastAlso:[{styles:{"vertical-align":"sub"}}]}),e.commands.add(P,new o(e,P))}}const S="subscript";class V extends n.k_{static get pluginName(){return"SubscriptUI"}init(){const e=this.editor,t=e.locale.t,i=l({editor:e,commandName:S,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m7.03 10.349 3.818-3.819a.8.8 0 1 1 1.132 1.132L8.16 11.48l3.819 3.818a.8.8 0 1 1-1.132 1.132L7.03 12.61l-3.818 3.82a.8.8 0 1 1-1.132-1.132L5.9 11.48 2.08 7.662A.8.8 0 1 1 3.212 6.53l3.818 3.82zm8.147 7.829h2.549c.254 0 .447.05.58.152a.49.49 0 0 1 .201.413.54.54 0 0 1-.159.393c-.105.108-.266.162-.48.162h-3.594c-.245 0-.435-.066-.572-.197a.621.621 0 0 1-.205-.463c0-.114.044-.265.132-.453a1.62 1.62 0 0 1 .288-.444c.433-.436.824-.81 1.172-1.122.348-.312.597-.517.747-.615.267-.183.49-.368.667-.553.177-.185.312-.375.405-.57.093-.194.139-.384.139-.57a1.008 1.008 0 0 0-.554-.917 1.197 1.197 0 0 0-.56-.133c-.426 0-.761.182-1.005.546a2.332 2.332 0 0 0-.164.39 1.609 1.609 0 0 1-.258.488c-.096.114-.237.17-.423.17a.558.558 0 0 1-.405-.156.568.568 0 0 1-.161-.427c0-.218.05-.446.151-.683.101-.238.252-.453.452-.646s.454-.349.762-.467a2.998 2.998 0 0 1 1.081-.178c.498 0 .923.076 1.274.228a1.916 1.916 0 0 1 1.004 1.032 1.984 1.984 0 0 1-.156 1.794c-.2.32-.405.572-.613.754-.208.182-.558.468-1.048.857-.49.39-.826.691-1.008.906a2.703 2.703 0 0 0-.24.309z"/></svg>',label:t("Subscript")});e.ui.componentFactory.add(S,(()=>i(a._))),e.ui.componentFactory.add("menuBar:"+S,(()=>i(a.kS)))}}class R extends n.k_{static get requires(){return[I,V]}static get pluginName(){return"Subscript"}}const B="superscript";class M extends n.k_{static get pluginName(){return"SuperscriptEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:B}),e.model.schema.setAttributeProperties(B,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:B,view:"sup",upcastAlso:[{styles:{"vertical-align":"super"}}]}),e.commands.add(B,new o(e,B))}}const O="superscript";class L extends n.k_{static get pluginName(){return"SuperscriptUI"}init(){const e=this.editor,t=e.locale.t,i=l({editor:e,commandName:O,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M15.677 8.678h2.549c.254 0 .447.05.58.152a.49.49 0 0 1 .201.413.54.54 0 0 1-.159.393c-.105.108-.266.162-.48.162h-3.594c-.245 0-.435-.066-.572-.197a.621.621 0 0 1-.205-.463c0-.114.044-.265.132-.453a1.62 1.62 0 0 1 .288-.444c.433-.436.824-.81 1.172-1.122.348-.312.597-.517.747-.615.267-.183.49-.368.667-.553.177-.185.312-.375.405-.57.093-.194.139-.384.139-.57a1.008 1.008 0 0 0-.554-.917 1.197 1.197 0 0 0-.56-.133c-.426 0-.761.182-1.005.546a2.332 2.332 0 0 0-.164.39 1.609 1.609 0 0 1-.258.488c-.096.114-.237.17-.423.17a.558.558 0 0 1-.405-.156.568.568 0 0 1-.161-.427c0-.218.05-.446.151-.683.101-.238.252-.453.452-.646s.454-.349.762-.467a2.998 2.998 0 0 1 1.081-.178c.498 0 .923.076 1.274.228a1.916 1.916 0 0 1 1.004 1.032 1.984 1.984 0 0 1-.156 1.794c-.2.32-.405.572-.613.754-.208.182-.558.468-1.048.857-.49.39-.826.691-1.008.906a2.703 2.703 0 0 0-.24.309zM7.03 10.349l3.818-3.819a.8.8 0 1 1 1.132 1.132L8.16 11.48l3.819 3.818a.8.8 0 1 1-1.132 1.132L7.03 12.61l-3.818 3.82a.8.8 0 1 1-1.132-1.132L5.9 11.48 2.08 7.662A.8.8 0 1 1 3.212 6.53l3.818 3.82z"/></svg>',label:t("Superscript")});e.ui.componentFactory.add(O,(()=>i(a._))),e.ui.componentFactory.add("menuBar:"+O,(()=>i(a.kS)))}}class F extends n.k_{static get requires(){return[M,L]}static get pluginName(){return"Superscript"}}const N="underline";class D extends n.k_{static get pluginName(){return"UnderlineEditing"}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:N}),e.model.schema.setAttributeProperties(N,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:N,view:"u",upcastAlso:{styles:{"text-decoration":"underline"}}}),e.commands.add(N,new o(e,N)),e.keystrokes.set("CTRL+U","underline"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Underline text"),keystroke:"CTRL+U"}]})}}const z="underline";class W extends n.k_{static get pluginName(){return"UnderlineUI"}init(){const e=this.editor,t=e.locale.t,i=l({editor:e,commandName:z,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 18v-1.5h14V18zm2.2-8V3.6c0-.4.4-.6.8-.6.3 0 .7.2.7.6v6.2c0 2 1.3 2.8 3.2 2.8 1.9 0 3.4-.9 3.4-2.9V3.6c0-.3.4-.5.8-.5.3 0 .7.2.7.5V10c0 2.7-2.2 4-4.9 4-2.6 0-4.7-1.2-4.7-4z"/></svg>',label:t("Underline"),keystroke:"CTRL+U"});e.ui.componentFactory.add(z,(()=>i(a._))),e.ui.componentFactory.add("menuBar:"+z,(()=>i(a.kS)))}}class H extends n.k_{static get requires(){return[D,W]}static get pluginName(){return"Underline"}}},8839:(e,t,i)=>{"use strict";i.r(t),i.d(t,{BlockQuote:()=>g,BlockQuoteEditing:()=>u,BlockQuoteUI:()=>m});var n=i(1204),o=i(6449),s=i(7211),r=i(5318);class a extends n.uB{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,i=t.schema,n=t.document.selection,o=Array.from(n.getSelectedBlocks()),s=void 0===e.forceValue?!this.value:e.forceValue;t.change((e=>{if(s){const t=o.filter((e=>l(e)||d(i,e)));this._applyQuote(e,t)}else this._removeQuote(e,o.filter(l))}))}_getValue(){const e=this.editor.model.document.selection,t=(0,r.$1)(e.getSelectedBlocks());return!(!t||!l(t))}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,i=(0,r.$1)(e.getSelectedBlocks());return!!i&&d(t,i)}_removeQuote(e,t){c(e,t).reverse().forEach((t=>{if(t.start.isAtStart&&t.end.isAtEnd)return void e.unwrap(t.start.parent);if(t.start.isAtStart){const i=e.createPositionBefore(t.start.parent);return void e.move(t,i)}t.end.isAtEnd||e.split(t.end);const i=e.createPositionAfter(t.end.parent);e.move(t,i)}))}_applyQuote(e,t){const i=[];c(e,t).reverse().forEach((t=>{let n=l(t.start);n||(n=e.createElement("blockQuote"),e.wrap(t,n)),i.push(n)})),i.reverse().reduce(((t,i)=>t.nextSibling==i?(e.merge(e.createPositionAfter(t)),t):i))}}function l(e){return"blockQuote"==e.parent.name?e.parent:null}function c(e,t){let i,n=0;const o=[];for(;n<t.length;){const s=t[n],r=t[n+1];i||(i=e.createPositionBefore(s)),r&&s.nextSibling==r||(o.push(e.createRange(i,e.createPositionAfter(s))),i=null),n++}return o}function d(e,t){const i=e.checkChild(t.parent,"blockQuote"),n=e.checkChild(["$root","blockQuote"],t);return i&&n}class u extends n.k_{static get pluginName(){return"BlockQuoteEditing"}static get requires(){return[o.x,s.ep]}init(){const e=this.editor,t=e.model.schema;e.commands.add("blockQuote",new a(e)),t.register("blockQuote",{inheritAllFrom:"$container"}),e.conversion.elementToElement({model:"blockQuote",view:"blockquote"}),e.model.document.registerPostFixer((i=>{const n=e.model.document.differ.getChanges();for(const e of n)if("insert"==e.type){const n=e.position.nodeAfter;if(!n)continue;if(n.is("element","blockQuote")&&n.isEmpty)return i.remove(n),!0;if(n.is("element","blockQuote")&&!t.checkChild(e.position,n))return i.unwrap(n),!0;if(n.is("element")){const e=i.createRangeIn(n);for(const n of e.getItems())if(n.is("element","blockQuote")&&!t.checkChild(i.createPositionBefore(n),n))return i.unwrap(n),!0}}else if("remove"==e.type){const t=e.position.parent;if(t.is("element","blockQuote")&&t.isEmpty)return i.remove(t),!0}return!1}));const i=this.editor.editing.view.document,n=e.model.document.selection,o=e.commands.get("blockQuote");this.listenTo(i,"enter",((t,i)=>{n.isCollapsed&&o.value&&n.getLastPosition().parent.isEmpty&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),i.preventDefault(),t.stop())}),{context:"blockquote"}),this.listenTo(i,"delete",((t,i)=>{if("backward"!=i.direction||!n.isCollapsed||!o.value)return;const s=n.getLastPosition().parent;s.isEmpty&&!s.previousSibling&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),i.preventDefault(),t.stop())}),{context:"blockquote"})}}var h=i(949);class m extends n.k_{static get pluginName(){return"BlockQuoteUI"}init(){const e=this.editor;e.ui.componentFactory.add("blockQuote",(()=>{const e=this._createButton(h._);return e.set({tooltip:!0}),e})),e.ui.componentFactory.add("menuBar:blockQuote",(()=>{const e=this._createButton(h.kS);return e.set({role:"menuitemcheckbox"}),e}))}_createButton(e){const t=this.editor,i=t.locale,o=t.commands.get("blockQuote"),s=new e(t.locale),r=i.t;return s.set({label:r("Block quote"),icon:n.Pt.quote,isToggleable:!0}),s.bind("isEnabled").to(o,"isEnabled"),s.bind("isOn").to(o,"value"),this.listenTo(s,"execute",(()=>{t.execute("blockQuote"),t.editing.view.focus()})),s}}class g extends n.k_{static get requires(){return[u,m]}static get pluginName(){return"BlockQuote"}}},6034:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Clipboard:()=>R,ClipboardMarkersUtils:()=>m,ClipboardPipeline:()=>g,DragDrop:()=>T,DragDropBlockToolbar:()=>x,DragDropTarget:()=>_,PastePlainText:()=>V});var n=i(1024),o=i(7906),s=i(151);class r extends s.DomEventObserver{constructor(e){super(e),this.domEventType=["paste","copy","cut","drop","dragover","dragstart","dragend","dragenter","dragleave"];const t=this.document;function i(e){return(i,n)=>{n.preventDefault();const s=n.dropRange?[n.dropRange]:null,r=new o.EventInfo(t,e);t.fire(r,{dataTransfer:n.dataTransfer,method:i.name,targetRanges:s,target:n.target,domEvent:n.domEvent}),r.stop.called&&n.stopPropagation()}}this.listenTo(t,"paste",i("clipboardInput"),{priority:"low"}),this.listenTo(t,"drop",i("clipboardInput"),{priority:"low"}),this.listenTo(t,"dragover",i("dragging"),{priority:"low"})}onDomEvent(e){const t="clipboardData"in e?e.clipboardData:e.dataTransfer,i="drop"==e.type||"paste"==e.type,n={dataTransfer:new s.DataTransfer(t,{cacheFiles:i})};"drop"!=e.type&&"dragover"!=e.type||(n.dropRange=function(e,t){const i=t.target.ownerDocument,n=t.clientX,o=t.clientY;let s;return i.caretRangeFromPoint&&i.caretRangeFromPoint(n,o)?s=i.caretRangeFromPoint(n,o):t.rangeParent&&(s=i.createRange(),s.setStart(t.rangeParent,t.rangeOffset),s.collapse(!0)),s?e.domConverter.domRangeToView(s):null}(this.view,e)),this.fire(e.type,e,n)}}const a=["figcaption","li"],l=["ol","ul"];function c(e){if(e.is("$text")||e.is("$textProxy"))return e.data;if(e.is("element","img")&&e.hasAttribute("alt"))return e.getAttribute("alt");if(e.is("element","br"))return"\n";let t="",i=null;for(const s of e.getChildren())t+=(n=s,((o=i)?n.is("element","li")&&!n.isEmpty&&n.getChild(0).is("containerElement")||l.includes(n.name)&&l.includes(o.name)?"\n\n":n.is("containerElement")||o.is("containerElement")?a.includes(n.name)||a.includes(o.name)?"\n":n.is("element")&&n.getCustomProperty("dataPipeline:transparentRendering")||o.is("element")&&o.getCustomProperty("dataPipeline:transparentRendering")?"":"\n\n":"":"")+c(s)),i=s;var n,o;return t}var d=i(2528),u=i(9841),h=i(5396);class m extends n.Plugin{constructor(){super(...arguments),this._markersToCopy=new Map}static get pluginName(){return"ClipboardMarkersUtils"}_registerMarkerToCopy(e,t){this._markersToCopy.set(e,t)}_copySelectedFragmentWithMarkers(e,t,i=(e=>e.model.getSelectedContent(e.model.document.selection))){return this.editor.model.change((n=>{const o=n.model.document.selection;n.setSelection(t);const s=this._insertFakeMarkersIntoSelection(n,n.model.document.selection,e),r=i(n),a=this._removeFakeMarkersInsideElement(n,r);for(const[e,t]of Object.entries(s)){a[e]||(a[e]=n.createRangeIn(r));for(const e of t)n.remove(e)}r.markers.clear();for(const[e,t]of Object.entries(a))r.markers.set(e,t);return n.setSelection(o),r}))}_pasteMarkersIntoTransformedElement(e,t){const i=this._getPasteMarkersFromRangeMap(e);return this.editor.model.change((e=>{const n=this._insertFakeMarkersElements(e,i),o=t(e),s=this._removeFakeMarkersInsideElement(e,o);for(const t of Object.values(n).flat())e.remove(t);for(const[t,i]of Object.entries(s))e.model.markers.has(t)||e.addMarker(t,{usingOperation:!0,affectsData:!0,range:i});return o}))}_pasteFragmentWithMarkers(e){const t=this._getPasteMarkersFromRangeMap(e.markers);e.markers.clear();for(const i of t)e.markers.set(i.name,i.range);return this.editor.model.insertContent(e)}_forceMarkersCopy(e,t,i={allowedActions:"all",copyPartiallySelected:!0,duplicateOnPaste:!0}){const n=this._markersToCopy.get(e);this._markersToCopy.set(e,i),t(),n?this._markersToCopy.set(e,n):this._markersToCopy.delete(e)}_isMarkerCopyable(e,t){const i=this._getMarkerClipboardConfig(e);if(!i)return!1;if(!t)return!0;const{allowedActions:n}=i;return"all"===n||n.includes(t)}_hasMarkerConfiguration(e){return!!this._getMarkerClipboardConfig(e)}_getMarkerClipboardConfig(e){const[t]=e.split(":");return this._markersToCopy.get(t)||null}_insertFakeMarkersIntoSelection(e,t,i){const n=this._getCopyableMarkersFromSelection(e,t,i);return this._insertFakeMarkersElements(e,n)}_getCopyableMarkersFromSelection(e,t,i){const n=Array.from(t.getRanges()),o=new Set(n.flatMap((t=>Array.from(e.model.markers.getMarkersIntersectingRange(t)))));return Array.from(o).filter((e=>{if(!this._isMarkerCopyable(e.name,i))return!1;const{copyPartiallySelected:t}=this._getMarkerClipboardConfig(e.name);if(!t){const t=e.getRange();return n.some((e=>e.containsRange(t,!0)))}return!0})).map((e=>({name:"dragstart"===i?this._getUniqueMarkerName(e.name):e.name,range:e.getRange()})))}_getPasteMarkersFromRangeMap(e,t=null){const{model:i}=this.editor;return(e instanceof Map?Array.from(e.entries()):Object.entries(e)).flatMap((([e,n])=>{if(!this._hasMarkerConfiguration(e))return[{name:e,range:n}];if(this._isMarkerCopyable(e,t)){const t=this._getMarkerClipboardConfig(e),o=i.markers.has(e)&&"$graveyard"===i.markers.get(e).getRange().root.rootName;return(t.duplicateOnPaste||o)&&(e=this._getUniqueMarkerName(e)),[{name:e,range:n}]}return[]}))}_insertFakeMarkersElements(e,t){const i={},n=t.flatMap((e=>{const{start:t,end:i}=e.range;return[{position:t,marker:e,type:"start"},{position:i,marker:e,type:"end"}]})).sort((({position:e},{position:t})=>e.isBefore(t)?1:-1));for(const{position:t,marker:o,type:s}of n){const n=e.createElement("$marker",{"data-name":o.name,"data-type":s});i[o.name]||(i[o.name]=[]),i[o.name].push(n),e.insert(n,t)}return i}_removeFakeMarkersInsideElement(e,t){const i=this._getAllFakeMarkersFromElement(e,t).reduce(((t,i)=>{const n=i.markerElement&&e.createPositionBefore(i.markerElement);let o=t[i.name],s=!1;return o&&o.start&&o.end&&(this._getMarkerClipboardConfig(i.name).duplicateOnPaste?t[this._getUniqueMarkerName(i.name)]=t[i.name]:s=!0,o=null),s||(t[i.name]={...o,[i.type]:n}),i.markerElement&&e.remove(i.markerElement),t}),{});return n=i,o=i=>new s.Range(i.start||e.createPositionFromPath(t,[0]),i.end||e.createPositionAt(t,"end")),r={},o=(0,h.A)(o,3),(0,u.A)(n,(function(e,t,i){(0,d.A)(r,t,o(e,t,i))})),r;var n,o,r}_getAllFakeMarkersFromElement(e,t){const i=Array.from(e.createRangeIn(t)).flatMap((({item:e})=>{if(!e.is("element","$marker"))return[];const t=e.getAttribute("data-name"),i=e.getAttribute("data-type");return[{markerElement:e,name:t,type:i}]})),n=[],o=[];for(const e of i)"end"===e.type&&(i.some((t=>t.name===e.name&&"start"===t.type))||n.push({markerElement:null,name:e.name,type:"start"})),"start"===e.type&&(i.some((t=>t.name===e.name&&"end"===t.type))||o.unshift({markerElement:null,name:e.name,type:"end"}));return[...n,...i,...o]}_getUniqueMarkerName(e){const t=e.split(":"),i=(0,o.uid)().substring(1,6);return 3===t.length?`${t.slice(0,2).join(":")}:${i}`:`${t.join(":")}:${i}`}}class g extends n.Plugin{static get pluginName(){return"ClipboardPipeline"}static get requires(){return[m]}init(){this.editor.editing.view.addObserver(r),this._setupPasteDrop(),this._setupCopyCut()}_fireOutputTransformationEvent(e,t,i){const n=this.editor.plugins.get("ClipboardMarkersUtils");this.editor.model.enqueueChange({isUndoable:"cut"===i},(()=>{const o=n._copySelectedFragmentWithMarkers(i,t);this.fire("outputTransformation",{dataTransfer:e,content:o,method:i})}))}_setupPasteDrop(){const e=this.editor,t=e.model,i=e.editing.view,n=i.document,s=this.editor.plugins.get("ClipboardMarkersUtils");this.listenTo(n,"clipboardInput",((t,i)=>{"paste"!=i.method||e.model.canEditAt(e.model.document.selection)||t.stop()}),{priority:"highest"}),this.listenTo(n,"clipboardInput",((e,t)=>{const n=t.dataTransfer;let s;if(t.content)s=t.content;else{let e="";n.getData("text/html")?e=function(e){return e.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,((e,t)=>1==t.length?" ":t)).replace(/<!--[\s\S]*?-->/g,"")}(n.getData("text/html")):n.getData("text/plain")&&(((r=(r=n.getData("text/plain")).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r?\n\r?\n/g,"</p><p>").replace(/\r?\n/g,"<br>").replace(/\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;").replace(/^\s/,"&nbsp;").replace(/\s$/,"&nbsp;").replace(/\s\s/g," &nbsp;")).includes("</p><p>")||r.includes("<br>"))&&(r=`<p>${r}</p>`),e=r),s=this.editor.data.htmlProcessor.toView(e)}var r;const a=new o.EventInfo(this,"inputTransformation");this.fire(a,{content:s,dataTransfer:n,targetRanges:t.targetRanges,method:t.method}),a.stop.called&&e.stop(),i.scrollToTheSelection()}),{priority:"low"}),this.listenTo(this,"inputTransformation",((e,i)=>{if(i.content.isEmpty)return;const n=this.editor.data.toModel(i.content,"$clipboardHolder");0!=n.childCount&&(e.stop(),t.change((()=>{this.fire("contentInsertion",{content:n,method:i.method,dataTransfer:i.dataTransfer,targetRanges:i.targetRanges})})))}),{priority:"low"}),this.listenTo(this,"contentInsertion",((e,t)=>{t.resultRange=s._pasteFragmentWithMarkers(t.content)}),{priority:"low"})}_setupCopyCut(){const e=this.editor,t=e.model.document,i=e.editing.view.document,n=(e,i)=>{const n=i.dataTransfer;i.preventDefault(),this._fireOutputTransformationEvent(n,t.selection,e.name)};this.listenTo(i,"copy",n,{priority:"low"}),this.listenTo(i,"cut",((t,i)=>{e.model.canEditAt(e.model.document.selection)?n(t,i):i.preventDefault()}),{priority:"low"}),this.listenTo(this,"outputTransformation",((t,n)=>{const o=e.data.toView(n.content);i.fire("clipboardOutput",{dataTransfer:n.dataTransfer,content:o,method:n.method})}),{priority:"low"}),this.listenTo(i,"clipboardOutput",((i,n)=>{n.content.isEmpty||(n.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(n.content)),n.dataTransfer.setData("text/plain",c(n.content))),"cut"==n.method&&e.model.deleteContent(t.selection)}),{priority:"low"})}}var f=i(3906),p=i(7243);const b=(0,o.toUnit)("px");class w extends p.View{constructor(){super();const e=this.bindTemplate;this.set({isVisible:!1,left:null,top:null,width:null}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-clipboard-drop-target-line",e.if("isVisible","ck-hidden",(e=>!e))],style:{left:e.to("left",(e=>b(e))),top:e.to("top",(e=>b(e))),width:e.to("width",(e=>b(e)))}}})}}var v=i(4022);class _ extends n.Plugin{constructor(){super(...arguments),this.removeDropMarkerDelayed=(0,o.delay)((()=>this.removeDropMarker()),40),this._updateDropMarkerThrottled=(0,v.A)((e=>this._updateDropMarker(e)),40),this._reconvertMarkerThrottled=(0,v.A)((()=>{this.editor.model.markers.has("drop-target")&&this.editor.editing.reconvertMarker("drop-target")}),0),this._dropTargetLineView=new w,this._domEmitter=new((0,o.DomEmitterMixin)()),this._scrollables=new Map}static get pluginName(){return"DragDropTarget"}init(){this._setupDropMarker()}destroy(){this._domEmitter.stopListening();for(const{resizeObserver:e}of this._scrollables.values())e.destroy();return this._updateDropMarkerThrottled.cancel(),this.removeDropMarkerDelayed.cancel(),this._reconvertMarkerThrottled.cancel(),super.destroy()}updateDropMarker(e,t,i,n,o,s){this.removeDropMarkerDelayed.cancel();const r=y(this.editor,e,t,i,n,o,s);if(r)return s&&s.containsRange(r)?this.removeDropMarker():void this._updateDropMarkerThrottled(r)}getFinalDropRange(e,t,i,n,o,s){const r=y(this.editor,e,t,i,n,o,s);return this.removeDropMarker(),r}removeDropMarker(){const e=this.editor.model;this.removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),this._dropTargetLineView.isVisible=!1,e.markers.has("drop-target")&&e.change((e=>{e.removeMarker("drop-target")}))}_setupDropMarker(){const e=this.editor;e.ui.view.body.add(this._dropTargetLineView),e.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),e.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(t,{writer:i})=>{if(e.model.schema.checkChild(t.markerRange.start,"$text"))return this._dropTargetLineView.isVisible=!1,this._createDropTargetPosition(i);t.markerRange.isCollapsed?this._updateDropTargetLine(t.markerRange):this._dropTargetLineView.isVisible=!1}})}_updateDropMarker(e){const t=this.editor,i=t.model.markers;t.model.change((t=>{i.has("drop-target")?i.get("drop-target").getRange().isEqual(e)||t.updateMarker("drop-target",{range:e}):t.addMarker("drop-target",{range:e,usingOperation:!1,affectsData:!1})}))}_createDropTargetPosition(e){return e.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},(function(e){const t=this.toDomElement(e);return t.append("⁠",e.createElement("span"),"⁠"),t}))}_updateDropTargetLine(e){const t=this.editor.editing,i=e.start.nodeBefore,n=e.start.nodeAfter,s=e.start.parent,r=i?t.mapper.toViewElement(i):null,a=r?t.view.domConverter.mapViewToDom(r):null,l=n?t.mapper.toViewElement(n):null,c=l?t.view.domConverter.mapViewToDom(l):null,d=t.mapper.toViewElement(s);if(!d)return;const u=t.view.domConverter.mapViewToDom(d),h=this._getScrollableRect(d),{scrollX:m,scrollY:g}=o.global.window,f=a?new o.Rect(a):null,p=c?new o.Rect(c):null,b=new o.Rect(u).excludeScrollbarsAndBorders(),w=f?f.bottom:b.top,v=p?p.top:b.bottom,_=o.global.window.getComputedStyle(u),y=w<=v?(w+v)/2:v;if(h.top<y&&y<h.bottom){const e=b.left+parseFloat(_.paddingLeft),t=b.right-parseFloat(_.paddingRight),i=Math.max(e+m,h.left),n=Math.min(t+m,h.right);this._dropTargetLineView.set({isVisible:!0,left:i,top:y+g,width:n-i})}else this._dropTargetLineView.isVisible=!1}_getScrollableRect(e){const t=e.root.rootName;let i;if(this._scrollables.has(t))i=this._scrollables.get(t).domElement;else{i=function(e){let t=e;do{t=t.parentElement;const e=o.global.window.getComputedStyle(t).overflowY;if("auto"==e||"scroll"==e)break}while("BODY"!=t.tagName);return t}(this.editor.editing.view.domConverter.mapViewToDom(e)),this._domEmitter.listenTo(i,"scroll",this._reconvertMarkerThrottled,{usePassive:!0});const n=new o.ResizeObserver(i,this._reconvertMarkerThrottled);this._scrollables.set(t,{domElement:i,resizeObserver:n})}return new o.Rect(i).excludeScrollbarsAndBorders()}}function y(e,t,i,n,o,s,r){const a=e.model,l=e.editing.mapper;let c=E(e,t);for(;c;){if(!s)if(a.schema.checkChild(c,"$text")){if(i){const t=i[0].start,s=l.toModelPosition(t);if(!r||Array.from(r.getItems()).every((e=>a.schema.checkChild(s,e)))){if(a.schema.checkChild(s,"$text"))return a.createRange(s);if(t)return C(e,E(e,t.parent),n,o)}}}else if(a.schema.isInline(c))return C(e,c,n,o);if(a.schema.isBlock(c))return C(e,c,n,o);if(a.schema.checkChild(c,"$block")){const t=Array.from(c.getChildren()).filter((t=>t.is("element")&&!k(e,t)));let i=0,s=t.length;if(0==s)return a.createRange(a.createPositionAt(c,"end"));for(;i<s-1;){const r=Math.floor((i+s)/2);"before"==A(e,t[r],n,o)?s=r:i=r}return C(e,t[i],n,o)}c=c.parent}return null}function k(e,t){const i=e.editing.mapper,n=e.editing.view.domConverter,s=i.toViewElement(t);if(!s)return!0;const r=n.mapViewToDom(s);return"none"!=o.global.window.getComputedStyle(r).float}function C(e,t,i,n){const o=e.model;return o.createRange(o.createPositionAt(t,A(e,t,i,n)))}function A(e,t,i,n){const s=e.editing.mapper,r=e.editing.view.domConverter,a=s.toViewElement(t),l=r.mapViewToDom(a),c=new o.Rect(l);return e.model.schema.isInline(t)?i<(c.left+c.right)/2?"before":"after":n<(c.top+c.bottom)/2?"before":"after"}function E(e,t){const i=e.editing.mapper,n=e.editing.view,o=i.toModelElement(t);if(o)return o;const s=n.createPositionBefore(t),r=i.findMappedViewAncestor(s);return i.toModelElement(r)}class x extends n.Plugin{constructor(){super(...arguments),this._isBlockDragging=!1,this._domEmitter=new((0,o.DomEmitterMixin)())}static get pluginName(){return"DragDropBlockToolbar"}init(){const e=this.editor;if(this.listenTo(e,"change:isReadOnly",((e,t,i)=>{i?(this.forceDisabled("readOnlyMode"),this._isBlockDragging=!1):this.clearForceDisabled("readOnlyMode")})),o.env.isAndroid&&this.forceDisabled("noAndroidSupport"),e.plugins.has("BlockToolbar")){const t=e.plugins.get("BlockToolbar").buttonView.element;this._domEmitter.listenTo(t,"dragstart",((e,t)=>this._handleBlockDragStart(t))),this._domEmitter.listenTo(o.global.document,"dragover",((e,t)=>this._handleBlockDragging(t))),this._domEmitter.listenTo(o.global.document,"drop",((e,t)=>this._handleBlockDragging(t))),this._domEmitter.listenTo(o.global.document,"dragend",(()=>this._handleBlockDragEnd()),{useCapture:!0}),this.isEnabled&&t.setAttribute("draggable","true"),this.on("change:isEnabled",((e,i,n)=>{t.setAttribute("draggable",n?"true":"false")}))}}destroy(){return this._domEmitter.stopListening(),super.destroy()}_handleBlockDragStart(e){if(!this.isEnabled)return;const t=this.editor.model,i=t.document.selection,n=this.editor.editing.view,o=Array.from(i.getSelectedBlocks()),s=t.createRange(t.createPositionBefore(o[0]),t.createPositionAfter(o[o.length-1]));t.change((e=>e.setSelection(s))),this._isBlockDragging=!0,n.focus(),n.getObserver(r).onDomEvent(e)}_handleBlockDragging(e){if(!this.isEnabled||!this._isBlockDragging)return;const t=e.clientX+("ltr"==this.editor.locale.contentLanguageDirection?100:-100),i=e.clientY,n=document.elementFromPoint(t,i),o=this.editor.editing.view;n&&n.closest(".ck-editor__editable")&&o.getObserver(r).onDomEvent({...e,type:e.type,dataTransfer:e.dataTransfer,target:n,clientX:t,clientY:i,preventDefault:()=>e.preventDefault(),stopPropagation:()=>e.stopPropagation()})}_handleBlockDragEnd(){this._isBlockDragging=!1}}class T extends n.Plugin{constructor(){super(...arguments),this._clearDraggableAttributesDelayed=(0,o.delay)((()=>this._clearDraggableAttributes()),40),this._blockMode=!1,this._domEmitter=new((0,o.DomEmitterMixin)())}static get pluginName(){return"DragDrop"}static get requires(){return[g,f.Widget,_,x]}init(){const e=this.editor,t=e.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,t.addObserver(r),t.addObserver(s.MouseObserver),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDraggableAttributeHandling(),this.listenTo(e,"change:isReadOnly",((e,t,i)=>{i?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")})),this.on("change:isEnabled",((e,t,i)=>{i||this._finalizeDragging(!1)})),o.env.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._previewContainer&&this._previewContainer.remove(),this._domEmitter.stopListening(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const e=this.editor,t=e.model,i=e.editing.view,n=i.document,s=e.plugins.get(_);this.listenTo(n,"dragstart",((e,i)=>{if(i.target&&i.target.is("editableElement"))return void i.preventDefault();if(this._prepareDraggedRange(i.target),!this._draggedRange)return void i.preventDefault();this._draggingUid=(0,o.uid)(),i.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",i.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const n=t.createSelection(this._draggedRange.toRange());this.editor.plugins.get("ClipboardPipeline")._fireOutputTransformationEvent(i.dataTransfer,n,"dragstart");const{dataTransfer:s,domTarget:r,domEvent:a}=i,{clientX:l}=a;this._updatePreview({dataTransfer:s,domTarget:r,clientX:l}),i.stopPropagation(),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")}),{priority:"low"}),this.listenTo(n,"dragend",((e,t)=>{this._finalizeDragging(!t.dataTransfer.isCanceled&&"move"==t.dataTransfer.dropEffect)}),{priority:"low"}),this._domEmitter.listenTo(o.global.document,"dragend",(()=>{this._blockMode=!1}),{useCapture:!0}),this.listenTo(n,"dragenter",(()=>{this.isEnabled&&i.focus()})),this.listenTo(n,"dragleave",(()=>{s.removeDropMarkerDelayed()})),this.listenTo(n,"dragging",((e,t)=>{if(!this.isEnabled)return void(t.dataTransfer.dropEffect="none");const{clientX:i,clientY:n}=t.domEvent;s.updateDropMarker(t.target,t.targetRanges,i,n,this._blockMode,this._draggedRange),this._draggedRange||(t.dataTransfer.dropEffect="copy"),o.env.isGecko||("copy"==t.dataTransfer.effectAllowed?t.dataTransfer.dropEffect="copy":["all","copyMove"].includes(t.dataTransfer.effectAllowed)&&(t.dataTransfer.dropEffect="move")),e.stop()}),{priority:"low"})}_setupClipboardInputIntegration(){const e=this.editor,t=e.editing.view.document,i=e.plugins.get(_);this.listenTo(t,"clipboardInput",((t,n)=>{if("drop"!=n.method)return;const{clientX:o,clientY:s}=n.domEvent,r=i.getFinalDropRange(n.target,n.targetRanges,o,s,this._blockMode,this._draggedRange);return r?(this._draggedRange&&this._draggingUid!=n.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid=""),"move"==P(n.dataTransfer)&&this._draggedRange&&this._draggedRange.containsRange(r,!0)?(this._finalizeDragging(!1),void t.stop()):void(n.targetRanges=[e.editing.mapper.toViewRange(r)])):(this._finalizeDragging(!1),void t.stop())}),{priority:"high"})}_setupContentInsertionIntegration(){const e=this.editor.plugins.get(g);e.on("contentInsertion",((e,t)=>{if(!this.isEnabled||"drop"!==t.method)return;const i=t.targetRanges.map((e=>this.editor.editing.mapper.toModelRange(e)));this.editor.model.change((e=>e.setSelection(i)))}),{priority:"high"}),e.on("contentInsertion",((e,t)=>{if(!this.isEnabled||"drop"!==t.method)return;const i="move"==P(t.dataTransfer),n=!t.resultRange||!t.resultRange.isCollapsed;this._finalizeDragging(n&&i)}),{priority:"lowest"})}_setupDraggableAttributeHandling(){const e=this.editor,t=e.editing.view,i=t.document;this.listenTo(i,"mousedown",((n,s)=>{if(o.env.isAndroid||!s)return;this._clearDraggableAttributesDelayed.cancel();let r=I(s.target);if(o.env.isBlink&&!e.isReadOnly&&!r&&!i.selection.isCollapsed){const e=i.selection.getSelectedElement();e&&(0,f.isWidget)(e)||(r=i.selection.editableElement)}r&&(t.change((e=>{e.setAttribute("draggable","true",r)})),this._draggableElement=e.editing.mapper.toModelElement(r))})),this.listenTo(i,"mouseup",(()=>{o.env.isAndroid||this._clearDraggableAttributesDelayed()}))}_clearDraggableAttributes(){const e=this.editor.editing;e.view.change((t=>{this._draggableElement&&"$graveyard"!=this._draggableElement.root.rootName&&t.removeAttribute("draggable",e.mapper.toViewElement(this._draggableElement)),this._draggableElement=null}))}_finalizeDragging(e){const t=this.editor,i=t.model;t.plugins.get(_).removeDropMarker(),this._clearDraggableAttributes(),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._previewContainer&&(this._previewContainer.remove(),this._previewContainer=void 0),this._draggedRange&&(e&&this.isEnabled&&i.change((e=>{const t=i.createSelection(this._draggedRange);i.deleteContent(t,{doNotAutoparagraph:!0});const n=t.getFirstPosition().parent;n.isEmpty&&!i.schema.checkChild(n,"$text")&&i.schema.checkChild(n,"paragraph")&&e.insertElement("paragraph",n,0)})),this._draggedRange.detach(),this._draggedRange=null)}_prepareDraggedRange(e){const t=this.editor,i=t.model,n=i.document.selection,o=e?I(e):null;if(o){const e=t.editing.mapper.toModelElement(o);return this._draggedRange=s.LiveRange.fromRange(i.createRangeOn(e)),this._blockMode=i.schema.isBlock(e),void(t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop"))}if(n.isCollapsed&&!n.getFirstPosition().parent.isEmpty)return;const r=Array.from(n.getSelectedBlocks()),a=n.getFirstRange();if(0==r.length)return void(this._draggedRange=s.LiveRange.fromRange(a));const l=S(i,r);if(r.length>1)this._draggedRange=s.LiveRange.fromRange(l),this._blockMode=!0;else if(1==r.length){const e=a.start.isTouching(l.start)&&a.end.isTouching(l.end);this._draggedRange=s.LiveRange.fromRange(e?l:a),this._blockMode=e}i.change((e=>e.setSelection(this._draggedRange.toRange())))}_updatePreview({dataTransfer:e,domTarget:t,clientX:i}){const n=this.editor.editing.view,s=n.document.selection.editableElement,r=n.domConverter.mapViewToDom(s),a=o.global.window.getComputedStyle(r);this._previewContainer?this._previewContainer.firstElementChild&&this._previewContainer.removeChild(this._previewContainer.firstElementChild):(this._previewContainer=(0,o.createElement)(o.global.document,"div",{style:"position: fixed; left: -999999px;"}),o.global.document.body.appendChild(this._previewContainer));const l=new o.Rect(r);if(r.contains(t))return;const c=parseFloat(a.paddingLeft),d=(0,o.createElement)(o.global.document,"div");d.className="ck ck-content",d.style.width=a.width,d.style.paddingLeft=`${l.left-i+c}px`,o.env.isiOS&&(d.style.backgroundColor="white"),d.innerHTML=e.getData("text/html"),e.setDragImage(d,0,0),this._previewContainer.appendChild(d)}}function P(e){return o.env.isGecko?e.dropEffect:["all","copyMove"].includes(e.effectAllowed)?"move":"copy"}function I(e){if(e.is("editableElement"))return null;if(e.hasClass("ck-widget__selection-handle"))return e.findAncestor(f.isWidget);if((0,f.isWidget)(e))return e;const t=e.findAncestor((e=>(0,f.isWidget)(e)||e.is("editableElement")));return(0,f.isWidget)(t)?t:null}function S(e,t){const i=t[0],n=t[t.length-1],o=i.getCommonAncestor(n),s=e.createPositionBefore(i),r=e.createPositionAfter(n);if(o&&o.is("element")&&!e.schema.isLimit(o)){const t=e.createRangeOn(o),i=s.isTouching(t.start),n=r.isTouching(t.end);if(i&&n)return S(e,[o])}return e.createRange(s,r)}class V extends n.Plugin{static get pluginName(){return"PastePlainText"}static get requires(){return[g]}init(){const e=this.editor,t=e.model,i=e.editing.view,n=t.document.selection;i.addObserver(r),e.plugins.get(g).on("contentInsertion",((e,i)=>{(function(e,t){let i=t.createRangeIn(e);if(1==e.childCount){const n=e.getChild(0);n.is("element")&&t.schema.isBlock(n)&&!t.schema.isObject(n)&&!t.schema.isLimit(n)&&(i=t.createRangeIn(n))}for(const e of i.getItems()){if(!t.schema.isInline(e))return!1;if(Array.from(e.getAttributeKeys()).find((e=>t.schema.getAttributeProperties(e).isFormatting)))return!1}return!0})(i.content,t)&&t.change((e=>{const o=Array.from(n.getAttributes()).filter((([e])=>t.schema.getAttributeProperties(e).isFormatting));n.isCollapsed||t.deleteContent(n,{doNotAutoparagraph:!0}),o.push(...n.getAttributes());const s=e.createRangeIn(i.content);for(const i of s.getItems())for(const n of o)t.schema.checkAttribute(i,n[0])&&e.setAttribute(n[0],n[1],i)}))}))}}class R extends n.Plugin{static get pluginName(){return"Clipboard"}static get requires(){return[m,g,T,V]}init(){const e=this.editor,t=this.editor.t;e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Copy selected content"),keystroke:"CTRL+C"},{label:t("Paste content"),keystroke:"CTRL+V"},{label:t("Paste content as plain text"),keystroke:"CTRL+SHIFT+V"}]})}}},1703:(e,t,i)=>{"use strict";i.r(t),i.d(t,{CodeBlock:()=>_,CodeBlockEditing:()=>f,CodeBlockUI:()=>v});var n=i(1204),o=i(6449),s=i(4133),r=i(7377),a=i(5318),l=i(2148);class c extends n.uB{constructor(e){super(e),this._lastLanguage=null}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor,i=t.model,n=i.document.selection,o=(0,l.getNormalizedAndLocalizedLanguageDefinitions)(t)[0],s=Array.from(n.getSelectedBlocks()),r=null==e.forceValue?!this.value:e.forceValue,a=function(e,t,i){return e.language?e.language:e.usePreviousLanguageChoice&&t?t:i}(e,this._lastLanguage,o.language);i.change((e=>{r?this._applyCodeBlock(e,s,a):this._removeCodeBlock(e,s)}))}_getValue(){const e=this.editor.model.document.selection,t=(0,a.$1)(e.getSelectedBlocks());return!(!t||!t.is("element","codeBlock"))&&t.getAttribute("language")}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,i=(0,a.$1)(e.getSelectedBlocks());return!!i&&(0,l.canBeCodeBlock)(t,i)}_applyCodeBlock(e,t,i){this._lastLanguage=i;const n=this.editor.model.schema,o=t.filter((e=>(0,l.canBeCodeBlock)(n,e)));for(const t of o)e.rename(t,"codeBlock"),e.setAttribute("language",i,t),n.removeDisallowedAttributes([t],e),Array.from(t.getChildren()).filter((e=>!n.checkChild(t,e))).forEach((t=>e.remove(t)));o.reverse().forEach(((t,i)=>{const n=o[i+1];t.previousSibling===n&&(e.appendElement("softBreak",n),e.merge(e.createPositionBefore(t)))}))}_removeCodeBlock(e,t){const i=t.filter((e=>e.is("element","codeBlock")));for(const t of i){const i=e.createRangeOn(t);for(const t of Array.from(i.getItems()).reverse())if(t.is("element","softBreak")&&t.parent.is("element","codeBlock")){const{position:i}=e.split(e.createPositionBefore(t)),n=i.nodeAfter;e.rename(n,"paragraph"),e.removeAttribute("language",n),e.remove(t)}e.rename(t,"paragraph"),e.removeAttribute("language",t)}}}class d extends n.uB{constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model;e.change((t=>{const i=(0,l.getIndentOutdentPositions)(e);for(const n of i){const i=t.createText(this._indentSequence);e.insertContent(i,n)}}))}_checkEnabled(){return!!this._indentSequence&&(0,l.isModelSelectionInCodeBlock)(this.editor.model.document.selection)}}class u extends n.uB{constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model;e.change((()=>{const t=(0,l.getIndentOutdentPositions)(e);for(const i of t){const t=h(e,i,this._indentSequence);t&&e.deleteContent(e.createSelection(t))}}))}_checkEnabled(){if(!this._indentSequence)return!1;const e=this.editor.model;return!!(0,l.isModelSelectionInCodeBlock)(e.document.selection)&&(0,l.getIndentOutdentPositions)(e).some((t=>h(e,t,this._indentSequence)))}}function h(e,t,i){const n=(0,l.getTextNodeAtLineStart)(t,e);if(!n)return null;const o=(0,l.getLeadingWhiteSpaces)(n),s=o.lastIndexOf(i);if(s+i.length!==o.length)return null;if(-1===s)return null;const{parent:r,startOffset:a}=n;return e.createRange(e.createPositionAt(r,a+s),e.createPositionAt(r,a+s+i.length))}function m(e,t,i=!1){const n=(0,l.getPropertyAssociation)(t,"language","class"),o=(0,l.getPropertyAssociation)(t,"language","label");return(t,s,r)=>{const{writer:a,mapper:l,consumable:c}=r;if(!c.consume(s.item,"insert"))return;const d=s.item.getAttribute("language"),u=l.toViewPosition(e.createPositionBefore(s.item)),h={};i&&(h["data-language"]=o[d],h.spellcheck="false");const m=n[d]?{class:n[d]}:void 0,g=a.createContainerElement("code",m),f=a.createContainerElement("pre",h,g);a.insert(u,f),l.bindElements(s.item,g)}}const g="paragraph";class f extends n.k_{static get pluginName(){return"CodeBlockEditing"}static get requires(){return[o.D]}constructor(e){super(e),e.config.define("codeBlock",{languages:[{language:"plaintext",label:"Plain text"},{language:"c",label:"C"},{language:"cs",label:"C#"},{language:"cpp",label:"C++"},{language:"css",label:"CSS"},{language:"diff",label:"Diff"},{language:"html",label:"HTML"},{language:"java",label:"Java"},{language:"javascript",label:"JavaScript"},{language:"php",label:"PHP"},{language:"python",label:"Python"},{language:"ruby",label:"Ruby"},{language:"typescript",label:"TypeScript"},{language:"xml",label:"XML"}],indentSequence:"\t"})}init(){const e=this.editor,t=e.model.schema,i=e.model,n=e.editing.view,o=(0,l.getNormalizedAndLocalizedLanguageDefinitions)(e);e.commands.add("codeBlock",new c(e)),e.commands.add("indentCodeBlock",new d(e)),e.commands.add("outdentCodeBlock",new u(e)),this.listenTo(n.document,"tab",((t,i)=>{const n=i.shiftKey?"outdentCodeBlock":"indentCodeBlock";e.commands.get(n).isEnabled&&(e.execute(n),i.stopPropagation(),i.preventDefault(),t.stop())}),{context:"pre"}),t.register("codeBlock",{allowWhere:"$block",allowChildren:"$text",disallowChildren:"$inlineObject",allowAttributes:["language"],allowAttributesOf:"$listItem",isBlock:!0}),t.addAttributeCheck(((e,i)=>{const n=e.getItem(e.length-2);if(t.getAttributeProperties(i).isFormatting&&n&&"codeBlock"==n.name)return!1})),e.editing.downcastDispatcher.on("insert:codeBlock",m(i,o,!0)),e.data.downcastDispatcher.on("insert:codeBlock",m(i,o)),e.data.downcastDispatcher.on("insert:softBreak",function(e){return(t,i,n)=>{if("codeBlock"!==i.item.parent.name)return;const{writer:o,mapper:s,consumable:r}=n;if(!r.consume(i.item,"insert"))return;const a=s.toViewPosition(e.createPositionBefore(i.item));o.insert(a,o.createText("\n"))}}(i),{priority:"high"}),e.data.upcastDispatcher.on("element:code",function(e,t){const i=(0,l.getPropertyAssociation)(t,"class","language"),n=t[0].language;return(e,t,o)=>{const s=t.viewItem,r=s.parent;if(!r||!r.is("element","pre"))return;if(t.modelCursor.findAncestor("codeBlock"))return;const{consumable:a,writer:l}=o;if(!a.test(s,{name:!0}))return;const c=l.createElement("codeBlock"),d=[...s.getClassNames()];d.length||d.push("");for(const e of d){const t=i[e];if(t){l.setAttribute("language",t,c);break}}c.hasAttribute("language")||l.setAttribute("language",n,c),o.convertChildren(s,c),o.safeInsert(c,t.modelCursor)&&(a.consume(s,{name:!0}),o.updateConversionResult(c,t))}}(0,o)),e.data.upcastDispatcher.on("text",((e,t,{consumable:i,writer:n})=>{let o=t.modelCursor;if(!i.test(t.viewItem))return;if(!o.findAncestor("codeBlock"))return;i.consume(t.viewItem);const s=t.viewItem.data.split("\n").map((e=>n.createText(e))),r=s[s.length-1];for(const e of s)if(n.insert(e,o),o=o.getShiftedBy(e.offsetSize),e!==r){const e=n.createElement("softBreak");n.insert(e,o),o=n.createPositionAfter(e)}t.modelRange=n.createRange(t.modelCursor,o),t.modelCursor=o})),e.data.upcastDispatcher.on("element:pre",((e,t,{consumable:i})=>{const n=t.viewItem;if(n.findAncestor("pre"))return;const o=Array.from(n.getChildren()),s=o.find((e=>e.is("element","code")));if(s)for(const e of o)e!==s&&e.is("$text")&&i.consume(e,{name:!0})}),{priority:"high"}),this.listenTo(e.editing.view.document,"clipboardInput",((t,n)=>{let o=i.createRange(i.document.selection.anchor);if(n.targetRanges&&(o=e.editing.mapper.toModelRange(n.targetRanges[0])),!o.start.parent.is("element","codeBlock"))return;const r=n.dataTransfer.getData("text/plain"),a=new s.Wq(e.editing.view.document);n.content=(0,l.rawSnippetTextToViewDocumentFragment)(a,r)})),e.plugins.has("ClipboardPipeline")&&e.plugins.get(r.xz).on("contentInsertion",((i,n)=>{const o=e.model,s=o.document.selection;s.anchor.parent.is("element","codeBlock")&&o.change((e=>{const i=e.createRangeIn(n.content);for(const n of[...i.getItems()])n.is("node")&&!t.checkChild(s.anchor,n)&&e.remove(n)}))})),this.listenTo(i,"getSelectedContent",((e,[n])=>{const o=n.anchor;!n.isCollapsed&&o.parent.is("element","codeBlock")&&o.hasSameParentAs(n.focus)&&i.change((i=>{const s=e.return;if(o.parent.is("element")&&(s.childCount>1||n.containsEntireContent(o.parent))){const t=i.createElement("codeBlock",o.parent.getAttributes());i.append(s,t);const n=i.createDocumentFragment();return i.append(t,n),void(e.return=n)}const r=s.getChild(0);t.checkAttribute(r,"code")&&i.setAttribute("code",!0,r)}))}))}afterInit(){const e=this.editor,t=e.commands,i=t.get("indent"),n=t.get("outdent");i&&i.registerChildCommand(t.get("indentCodeBlock"),{priority:"highest"}),n&&n.registerChildCommand(t.get("outdentCodeBlock")),this.listenTo(e.editing.view.document,"enter",((t,i)=>{e.model.document.selection.getLastPosition().parent.is("element","codeBlock")&&(function(e,t){const i=e.model.document,n=e.editing.view,o=i.selection.getLastPosition(),s=o.nodeAfter;return!(t||!i.selection.isCollapsed||!o.isAtStart)&&(!!b(s)&&(e.model.change((t=>{e.execute("enter");const n=i.selection.anchor.parent.previousSibling;t.rename(n,g),t.setSelection(n,"in"),e.model.schema.removeDisallowedAttributes([n],t),t.remove(s)})),n.scrollToTheSelection(),!0))}(e,i.isSoft)||function(e,t){const i=e.model,n=i.document,o=e.editing.view,s=n.selection.getLastPosition(),r=s.nodeBefore;let a;if(t||!n.selection.isCollapsed||!s.isAtEnd||!r||!r.previousSibling)return!1;if(b(r)&&b(r.previousSibling))a=i.createRange(i.createPositionBefore(r.previousSibling),i.createPositionAfter(r));else if(p(r)&&b(r.previousSibling)&&b(r.previousSibling.previousSibling))a=i.createRange(i.createPositionBefore(r.previousSibling.previousSibling),i.createPositionAfter(r));else{if(!(p(r)&&b(r.previousSibling)&&p(r.previousSibling.previousSibling)&&r.previousSibling.previousSibling&&b(r.previousSibling.previousSibling.previousSibling)))return!1;a=i.createRange(i.createPositionBefore(r.previousSibling.previousSibling.previousSibling),i.createPositionAfter(r))}return e.model.change((t=>{t.remove(a),e.execute("enter");const i=n.selection.anchor.parent;t.rename(i,g),e.model.schema.removeDisallowedAttributes([i],t)})),o.scrollToTheSelection(),!0}(e,i.isSoft)||function(e){const t=e.model,i=t.document,n=i.selection.getLastPosition();let o;const s=(0,l.getTextNodeAtLineStart)(n,t);s&&s.is("$text")&&(o=(0,l.getLeadingWhiteSpaces)(s)),e.model.change((t=>{e.execute("shiftEnter"),o&&t.insertText(o,i.selection.anchor)}))}(e),i.preventDefault(),t.stop())}),{context:"pre"}),this._initAriaAnnouncements()}_initAriaAnnouncements(){const{model:e,ui:t,t:i}=this.editor,n=(0,l.getNormalizedAndLocalizedLanguageDefinitions)(this.editor);let o=null;e.document.selection.on("change:range",(()=>{const s=e.document.selection.focus.parent;t&&o!==s&&s.is("element")&&(o&&o.is("element","codeBlock")&&t.ariaLiveAnnouncer.announce((0,l.getCodeBlockAriaAnnouncement)(i,n,o,"leave")),s.is("element","codeBlock")&&t.ariaLiveAnnouncer.announce((0,l.getCodeBlockAriaAnnouncement)(i,n,s,"enter")),o=s)}))}}function p(e){return e&&e.is("$text")&&!e.data.match(/\S/)}function b(e){return e&&e.is("element","softBreak")}var w=i(949);class v extends n.k_{static get pluginName(){return"CodeBlockUI"}init(){const e=this.editor,t=e.t,i=e.ui.componentFactory,o=(0,l.getNormalizedAndLocalizedLanguageDefinitions)(e),s=this._getLanguageListItemDefinitions(o),r=e.commands.get("codeBlock");i.add("codeBlock",(i=>{const o=(0,w.yu)(i,w.AO),a=o.buttonView,l=t("Insert code block");return a.set({label:l,tooltip:!0,icon:n.Pt.codeBlock,isToggleable:!0}),a.bind("isOn").to(r,"value",(e=>!!e)),a.on("execute",(()=>{e.execute("codeBlock",{usePreviousLanguageChoice:!0}),e.editing.view.focus()})),o.on("execute",(t=>{e.execute("codeBlock",{language:t.source._codeBlockLanguage,forceValue:!0}),e.editing.view.focus()})),o.class="ck-code-block-dropdown",o.bind("isEnabled").to(r),(0,w.O)(o,s,{role:"menu",ariaLabel:l}),o})),i.add("menuBar:codeBlock",(i=>{const o=new w.zj(i);o.buttonView.set({role:"menuitem",label:t("Code block"),icon:n.Pt.codeBlock}),o.bind("isEnabled").to(r);const a=new w.BY(i);a.set({ariaLabel:t("Insert code block")});for(const t of s){const n=new w.I8(i,o),s=new w.kS(i);s.bind(...Object.keys(t.model)).to(t.model),s.set({isToggleable:!0,role:"menuitemcheckbox"}),s.delegate("execute").to(o),s.on("execute",(()=>{e.execute("codeBlock",{language:t.model._codeBlockLanguage,forceValue:r.value!=t.model._codeBlockLanguage}),e.editing.view.focus()})),n.children.add(s),a.items.add(n)}return o.panelView.children.add(a),o}))}_getLanguageListItemDefinitions(e){const t=this.editor.commands.get("codeBlock"),i=new a.pM;for(const n of e){const e={type:"button",model:new w.Jc({_codeBlockLanguage:n.language,label:n.label,role:"menuitemradio",withText:!0})};e.model.bind("isOn").to(t,"value",(t=>t===e.model._codeBlockLanguage)),i.add(e)}return i}}class _ extends n.k_{static get requires(){return[f,v]}static get pluginName(){return"CodeBlock"}}},2148:(e,t,i)=>{"use strict";i.r(t),i.d(t,{canBeCodeBlock:()=>d,getCodeBlockAriaAnnouncement:()=>u,getIndentOutdentPositions:()=>l,getLeadingWhiteSpaces:()=>r,getNormalizedAndLocalizedLanguageDefinitions:()=>o,getPropertyAssociation:()=>s,getTextNodeAtLineStart:()=>h,isModelSelectionInCodeBlock:()=>c,rawSnippetTextToViewDocumentFragment:()=>a});var n=i(5318);function o(e){const t=e.t,i=e.config.get("codeBlock.languages");for(const e of i)"Plain text"===e.label&&(e.label=t("Plain text")),void 0===e.class&&(e.class=`language-${e.language}`);return i}function s(e,t,i){const n={};for(const o of e)"class"===t?n[o[t].split(" ").shift()]=o[i]:n[o[t]]=o[i];return n}function r(e){return e.data.match(/^(\s*)/)[0]}function a(e,t){const i=e.createDocumentFragment(),n=t.split("\n"),o=n.reduce(((t,i,o)=>(t.push(i),o<n.length-1&&t.push(e.createElement("br")),t)),[]);return e.appendChild(o,i),i}function l(e){const t=e.document.selection,i=[];if(t.isCollapsed)return[t.anchor];const n=t.getFirstRange().getWalker({ignoreElementEnd:!0,direction:"backward"});for(const{item:t}of n){let n=t.is("$textProxy")?t.textNode:t;const o=n.parent;if(!o.is("element","codeBlock")||n.is("element","softBreak"))continue;for(;n.previousSibling&&!n.previousSibling.is("element","softBreak");)n=n.previousSibling;const s=n.is("$text")?n.startOffset+r(n).length:n.startOffset,a=e.createPositionAt(o,s);i.every((e=>!e.isEqual(a)))&&i.push(a)}return i}function c(e){const t=(0,n.$1)(e.getSelectedBlocks());return!!t&&t.is("element","codeBlock")}function d(e,t){return!t.is("rootElement")&&!e.isLimit(t)&&e.checkChild(t.parent,"codeBlock")}function u(e,t,i,n){const o=s(t,"language","label"),r=i.getAttribute("language");if(r in o){return e("enter"===n?"Entering %0 code snippet":"Leaving %0 code snippet",o[r])}return e("enter"===n?"Entering code snippet":"Leaving code snippet")}function h(e,t){for(e.textNode&&(e=t.createPositionBefore(e.textNode));e.nodeBefore&&!e.nodeBefore.is("element","softBreak");)e=t.createPositionBefore(e.nodeBefore);const i=e.nodeAfter;return i&&i.is("$text")?i:null}},1024:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Command:()=>r,Context:()=>d,ContextPlugin:()=>u,DataApiMixin:()=>M,Editor:()=>V,ElementApiMixin:()=>O,MultiCommand:()=>l,PendingActions:()=>F,Plugin:()=>o,attachToForm:()=>B,icons:()=>N,secureSourceElement:()=>L});var n=i(7906);class o extends((0,n.ObservableMixin)()){constructor(e){super(),this._disableStack=new Set,this.editor=e,this.set("isEnabled",!0)}forceDisabled(e){this._disableStack.add(e),1==this._disableStack.size&&(this.on("set:isEnabled",s,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",s),this.isEnabled=!0)}destroy(){this.stopListening()}static get isContextPlugin(){return!1}}function s(e){e.return=!1,e.stop()}class r extends((0,n.ObservableMixin)()){constructor(e){super(),this.editor=e,this.set("value",void 0),this.set("isEnabled",!1),this._affectsData=!0,this._isEnabledBasedOnSelection=!0,this._disableStack=new Set,this.decorate("execute"),this.listenTo(this.editor.model.document,"change",(()=>{this.refresh()})),this.listenTo(e,"change:isReadOnly",(()=>{this.refresh()})),this.on("set:isEnabled",(t=>{if(!this.affectsData)return;const i=e.model.document.selection,n=!("$graveyard"==i.getFirstPosition().root.rootName)&&e.model.canEditAt(i);(e.isReadOnly||this._isEnabledBasedOnSelection&&!n)&&(t.return=!1,t.stop())}),{priority:"highest"}),this.on("execute",(e=>{this.isEnabled||e.stop()}),{priority:"high"})}get affectsData(){return this._affectsData}set affectsData(e){this._affectsData=e}refresh(){this.isEnabled=!0}forceDisabled(e){this._disableStack.add(e),1==this._disableStack.size&&(this.on("set:isEnabled",a,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",a),this.refresh())}execute(...e){}destroy(){this.stopListening()}}function a(e){e.return=!1,e.stop()}class l extends r{constructor(){super(...arguments),this._childCommandsDefinitions=[]}refresh(){}execute(...e){const t=this._getFirstEnabledCommand();return!!t&&t.execute(e)}registerChildCommand(e,t={}){(0,n.insertToPriorityArray)(this._childCommandsDefinitions,{command:e,priority:t.priority||"normal"}),e.on("change:isEnabled",(()=>this._checkEnabled())),this._checkEnabled()}_checkEnabled(){this.isEnabled=!!this._getFirstEnabledCommand()}_getFirstEnabledCommand(){const e=this._childCommandsDefinitions.find((({command:e})=>e.isEnabled));return e&&e.command}}class c extends((0,n.EmitterMixin)()){constructor(e,t=[],i=[]){super(),this._plugins=new Map,this._context=e,this._availablePlugins=new Map;for(const e of t)e.pluginName&&this._availablePlugins.set(e.pluginName,e);this._contextPlugins=new Map;for(const[e,t]of i)this._contextPlugins.set(e,t),this._contextPlugins.set(t,e),e.pluginName&&this._availablePlugins.set(e.pluginName,e)}*[Symbol.iterator](){for(const e of this._plugins)"function"==typeof e[0]&&(yield e)}get(e){const t=this._plugins.get(e);if(!t){let t=e;throw"function"==typeof e&&(t=e.pluginName||e.name),new n.CKEditorError("plugincollection-plugin-not-loaded",this._context,{plugin:t})}return t}has(e){return this._plugins.has(e)}init(e,t=[],i=[]){const o=this,s=this._context;!function e(t,i=new Set){t.forEach((t=>{l(t)&&(i.has(t)||(i.add(t),t.pluginName&&!o._availablePlugins.has(t.pluginName)&&o._availablePlugins.set(t.pluginName,t),t.requires&&e(t.requires,i)))}))}(e),h(e);const r=[...function e(t,i=new Set){return t.map((e=>l(e)?e:o._availablePlugins.get(e))).reduce(((t,n)=>i.has(n)?t:(i.add(n),n.requires&&(h(n.requires,n),e(n.requires,i).forEach((e=>t.add(e)))),t.add(n))),new Set)}(e.filter((e=>!d(e,t))))];!function(e,t){for(const i of t){if("function"!=typeof i)throw new n.CKEditorError("plugincollection-replace-plugin-invalid-type",null,{pluginItem:i});const t=i.pluginName;if(!t)throw new n.CKEditorError("plugincollection-replace-plugin-missing-name",null,{pluginItem:i});if(i.requires&&i.requires.length)throw new n.CKEditorError("plugincollection-plugin-for-replacing-cannot-have-dependencies",null,{pluginName:t});const s=o._availablePlugins.get(t);if(!s)throw new n.CKEditorError("plugincollection-plugin-for-replacing-not-exist",null,{pluginName:t});const r=e.indexOf(s);if(-1===r){if(o._contextPlugins.has(s))return;throw new n.CKEditorError("plugincollection-plugin-for-replacing-not-loaded",null,{pluginName:t})}if(s.requires&&s.requires.length)throw new n.CKEditorError("plugincollection-replaced-plugin-cannot-have-dependencies",null,{pluginName:t});e.splice(r,1,i),o._availablePlugins.set(t,i)}}(r,i);const a=function(e){return e.map((e=>{let t=o._contextPlugins.get(e);return t=t||new e(s),o._add(e,t),t}))}(r);return m(a,"init").then((()=>m(a,"afterInit"))).then((()=>a));function l(e){return"function"==typeof e}function c(e){return l(e)&&!!e.isContextPlugin}function d(e,t){return t.some((t=>t===e||u(e)===t||u(t)===e))}function u(e){return l(e)?e.pluginName||e.name:e}function h(e,i=null){e.map((e=>l(e)?e:o._availablePlugins.get(e)||e)).forEach((e=>{!function(e,t){if(!l(e)){if(t)throw new n.CKEditorError("plugincollection-soft-required",s,{missingPlugin:e,requiredBy:u(t)});throw new n.CKEditorError("plugincollection-plugin-not-found",s,{plugin:e})}}(e,i),function(e,t){if(c(t)&&!c(e))throw new n.CKEditorError("plugincollection-context-required",s,{plugin:u(e),requiredBy:u(t)})}(e,i),function(e,i){if(i&&d(e,t))throw new n.CKEditorError("plugincollection-required",s,{plugin:u(e),requiredBy:u(i)})}(e,i)}))}function m(e,t){return e.reduce(((e,i)=>i[t]?o._contextPlugins.has(i)?e:e.then(i[t].bind(i)):e),Promise.resolve())}}destroy(){const e=[];for(const[,t]of this)"function"!=typeof t.destroy||this._contextPlugins.has(t)||e.push(t.destroy());return Promise.all(e)}_add(e,t){this._plugins.set(e,t);const i=e.pluginName;if(i){if(this._plugins.has(i))throw new n.CKEditorError("plugincollection-plugin-name-conflict",null,{pluginName:i,plugin1:this._plugins.get(i).constructor,plugin2:e});this._plugins.set(i,t)}}}class d{constructor(e){this._contextOwner=null;const{translations:t,...i}=e||{};this.config=new n.Config(i,this.constructor.defaultConfig);const o=this.constructor.builtinPlugins;this.config.define("plugins",o),this.plugins=new c(this,o);const s=this.config.get("language")||{};this.locale=new n.Locale({uiLanguage:"string"==typeof s?s:s.ui,contentLanguage:this.config.get("language.content"),translations:t}),this.t=this.locale.t,this.editors=new n.Collection}initPlugins(){const e=this.config.get("plugins")||[],t=this.config.get("substitutePlugins")||[];for(const i of e.concat(t)){if("function"!=typeof i)throw new n.CKEditorError("context-initplugins-constructor-only",null,{Plugin:i});if(!0!==i.isContextPlugin)throw new n.CKEditorError("context-initplugins-invalid-plugin",null,{Plugin:i})}return this.plugins.init(e,[],t)}destroy(){return Promise.all(Array.from(this.editors,(e=>e.destroy()))).then((()=>this.plugins.destroy()))}_addEditor(e,t){if(this._contextOwner)throw new n.CKEditorError("context-addeditor-private-context");this.editors.add(e),t&&(this._contextOwner=e)}_removeEditor(e){return this.editors.has(e)&&this.editors.remove(e),this._contextOwner===e?this.destroy():Promise.resolve()}_getEditorConfig(){const e={};for(const t of this.config.names())["plugins","removePlugins","extraPlugins"].includes(t)||(e[t]=this.config.get(t));return e}static create(e){return new Promise((t=>{const i=new this(e);t(i.initPlugins().then((()=>i)))}))}}class u extends((0,n.ObservableMixin)()){constructor(e){super(),this.context=e}destroy(){this.stopListening()}static get isContextPlugin(){return!0}}var h=i(151);class m{constructor(e){if(this.crashes=[],this.state="initializing",this._now=Date.now,this.crashes=[],this._crashNumberLimit="number"==typeof e.crashNumberLimit?e.crashNumberLimit:3,this._minimumNonErrorTimePeriod="number"==typeof e.minimumNonErrorTimePeriod?e.minimumNonErrorTimePeriod:5e3,this._boundErrorHandler=e=>{const t="error"in e?e.error:e.reason;t instanceof Error&&this._handleError(t,e)},this._listeners={},!this._restart)throw new Error("The Watchdog class was split into the abstract `Watchdog` class and the `EditorWatchdog` class. Please, use `EditorWatchdog` if you have used the `Watchdog` class previously.")}destroy(){this._stopErrorHandling(),this._listeners={}}on(e,t){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t)}off(e,t){this._listeners[e]=this._listeners[e].filter((e=>e!==t))}_fire(e,...t){const i=this._listeners[e]||[];for(const e of i)e.apply(this,[null,...t])}_startErrorHandling(){window.addEventListener("error",this._boundErrorHandler),window.addEventListener("unhandledrejection",this._boundErrorHandler)}_stopErrorHandling(){window.removeEventListener("error",this._boundErrorHandler),window.removeEventListener("unhandledrejection",this._boundErrorHandler)}_handleError(e,t){if(this._shouldReactToError(e)){this.crashes.push({message:e.message,stack:e.stack,filename:t instanceof ErrorEvent?t.filename:void 0,lineno:t instanceof ErrorEvent?t.lineno:void 0,colno:t instanceof ErrorEvent?t.colno:void 0,date:this._now()});const i=this._shouldRestart();this.state="crashed",this._fire("stateChange"),this._fire("error",{error:e,causesRestart:i}),i?this._restart():(this.state="crashedPermanently",this._fire("stateChange"))}}_shouldReactToError(e){return e.is&&e.is("CKEditorError")&&void 0!==e.context&&null!==e.context&&"ready"===this.state&&this._isErrorComingFromThisItem(e)}_shouldRestart(){return this.crashes.length<=this._crashNumberLimit||(this.crashes[this.crashes.length-1].date-this.crashes[this.crashes.length-1-this._crashNumberLimit].date)/this._crashNumberLimit>this._minimumNonErrorTimePeriod}}function g(e,t=new Set){const i=[e],n=new Set;let o=0;for(;i.length>o;){const e=i[o++];if(!n.has(e)&&f(e)&&!t.has(e))if(n.add(e),Symbol.iterator in e)try{for(const t of e)i.push(t)}catch(e){}else for(const t in e)"defaultValue"!==t&&i.push(e[t])}return n}function f(e){const t=Object.prototype.toString.call(e),i=typeof e;return!("number"===i||"boolean"===i||"string"===i||"symbol"===i||"function"===i||"[object Date]"===t||"[object RegExp]"===t||"[object Module]"===t||null==e||e._watchdogExcluded||e instanceof EventTarget||e instanceof Event)}function p(e,t,i=new Set){if(e===t&&"object"==typeof(n=e)&&null!==n)return!0;var n;const o=g(e,i),s=g(t,i);for(const e of o)if(s.has(e))return!0;return!1}var b=i(4022),w=i(1500),v=i(3967);class _ extends m{constructor(e,t={}){super(t),this._editor=null,this._lifecyclePromise=null,this._initUsingData=!0,this._editables={},this._throttledSave=(0,b.A)(this._save.bind(this),"number"==typeof t.saveInterval?t.saveInterval:5e3),e&&(this._creator=(t,i)=>e.create(t,i)),this._destructor=e=>e.destroy()}get editor(){return this._editor}get _item(){return this._editor}setCreator(e){this._creator=e}setDestructor(e){this._destructor=e}_restart(){return Promise.resolve().then((()=>(this.state="initializing",this._fire("stateChange"),this._destroy()))).catch((e=>{console.error("An error happened during the editor destroying.",e)})).then((()=>{const e={},t=[],i=this._config.rootsAttributes||{},n={};for(const[o,s]of Object.entries(this._data.roots))s.isLoaded?(e[o]="",n[o]=i[o]||{}):t.push(o);const o={...this._config,extraPlugins:this._config.extraPlugins||[],lazyRoots:t,rootsAttributes:n,_watchdogInitialData:this._data};return delete o.initialData,o.extraPlugins.push(y),this._initUsingData?this.create(e,o,o.context):(0,w.A)(this._elementOrData)?this.create(this._elementOrData,o,o.context):this.create(this._editables,o,o.context)})).then((()=>{this._fire("restart")}))}create(e=this._elementOrData,t=this._config,i){return this._lifecyclePromise=Promise.resolve(this._lifecyclePromise).then((()=>(super._startErrorHandling(),this._elementOrData=e,this._initUsingData="string"==typeof e||Object.keys(e).length>0&&"string"==typeof Object.values(e)[0],this._config=this._cloneEditorConfiguration(t)||{},this._config.context=i,this._creator(e,this._config)))).then((e=>{this._editor=e,e.model.document.on("change:data",this._throttledSave),this._lastDocumentVersion=e.model.document.version,this._data=this._getData(),this._initUsingData||(this._editables=this._getEditables()),this.state="ready",this._fire("stateChange")})).finally((()=>{this._lifecyclePromise=null})),this._lifecyclePromise}destroy(){return this._lifecyclePromise=Promise.resolve(this._lifecyclePromise).then((()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy()))).finally((()=>{this._lifecyclePromise=null})),this._lifecyclePromise}_destroy(){return Promise.resolve().then((()=>{this._stopErrorHandling(),this._throttledSave.cancel();const e=this._editor;return this._editor=null,e.model.document.off("change:data",this._throttledSave),this._destructor(e)}))}_save(){const e=this._editor.model.document.version;try{this._data=this._getData(),this._initUsingData||(this._editables=this._getEditables()),this._lastDocumentVersion=e}catch(e){console.error(e,"An error happened during restoring editor data. Editor will be restored from the previously saved data.")}}_setExcludedProperties(e){this._excludedProps=e}_getData(){const e=this._editor,t=e.model.document.roots.filter((e=>e.isAttached()&&"$graveyard"!=e.rootName)),{plugins:i}=e,n=i.has("CommentsRepository")&&i.get("CommentsRepository"),o=i.has("TrackChanges")&&i.get("TrackChanges"),s={roots:{},markers:{},commentThreads:JSON.stringify([]),suggestions:JSON.stringify([])};t.forEach((e=>{s.roots[e.rootName]={content:JSON.stringify(Array.from(e.getChildren())),attributes:JSON.stringify(Array.from(e.getAttributes())),isLoaded:e._isLoaded}}));for(const t of e.model.markers)t._affectsData&&(s.markers[t.name]={rangeJSON:t.getRange().toJSON(),usingOperation:t._managedUsingOperations,affectsData:t._affectsData});return n&&(s.commentThreads=JSON.stringify(n.getCommentThreads({toJSON:!0,skipNotAttached:!0}))),o&&(s.suggestions=JSON.stringify(o.getSuggestions({toJSON:!0,skipNotAttached:!0}))),s}_getEditables(){const e={};for(const t of this.editor.model.document.getRootNames()){const i=this.editor.ui.getEditableElement(t);i&&(e[t]=i)}return e}_isErrorComingFromThisItem(e){return p(this._editor,e.context,this._excludedProps)}_cloneEditorConfiguration(e){return(0,v.A)(e,((e,t)=>(0,w.A)(e)||"context"===t?e:void 0))}}class y{constructor(e){this.editor=e,this._data=e.config.get("_watchdogInitialData")}init(){this.editor.data.on("init",(e=>{e.stop(),this.editor.model.enqueueChange({isUndoable:!1},(e=>{this._restoreCollaborationData(),this._restoreEditorData(e)})),this.editor.data.fire("ready")}),{priority:999})}_createNode(e,t){if("name"in t){const i=e.createElement(t.name,t.attributes);if(t.children)for(const n of t.children)i._appendChild(this._createNode(e,n));return i}return e.createText(t.data,t.attributes)}_restoreEditorData(e){const t=this.editor;Object.entries(this._data.roots).forEach((([i,{content:n,attributes:o}])=>{const s=JSON.parse(n),r=JSON.parse(o),a=t.model.document.getRoot(i);for(const[t,i]of r)e.setAttribute(t,i,a);for(const t of s){const i=this._createNode(e,t);e.insert(i,a,"end")}})),Object.entries(this._data.markers).forEach((([i,n])=>{const{document:o}=t.model,{rangeJSON:{start:s,end:r},...a}=n,l=o.getRoot(s.root),c=e.createPositionFromPath(l,s.path,s.stickiness),d=e.createPositionFromPath(l,r.path,r.stickiness),u=e.createRange(c,d);e.addMarker(i,{range:u,...a})}))}_restoreCollaborationData(){const e=JSON.parse(this._data.commentThreads),t=JSON.parse(this._data.suggestions);e.forEach((e=>{const t=this.editor.config.get("collaboration.channelId"),i=this.editor.plugins.get("CommentsRepository");i.hasCommentThread(e.threadId)&&i.getCommentThread(e.threadId).remove(),i.addCommentThread({channelId:t,...e})})),t.forEach((e=>{const t=this.editor.plugins.get("TrackChangesEditing");t.hasSuggestion(e.id)?t.getSuggestion(e.id).attributes=e.attributes:t.addSuggestionData(e)}))}}const k=Symbol("MainQueueId");class C{constructor(){this._onEmptyCallbacks=[],this._queues=new Map,this._activeActions=0}onEmpty(e){this._onEmptyCallbacks.push(e)}enqueue(e,t){const i=e===k;this._activeActions++,this._queues.get(e)||this._queues.set(e,Promise.resolve());const n=(i?Promise.all(this._queues.values()):Promise.all([this._queues.get(k),this._queues.get(e)])).then(t),o=n.catch((()=>{}));return this._queues.set(e,o),n.finally((()=>{this._activeActions--,this._queues.get(e)===o&&0===this._activeActions&&this._onEmptyCallbacks.forEach((e=>e()))}))}}function A(e){return Array.isArray(e)?e:[e]}class E{constructor(){this._commands=new Map}add(e,t){this._commands.set(e,t)}get(e){return this._commands.get(e)}execute(e,...t){const i=this.get(e);if(!i)throw new n.CKEditorError("commandcollection-command-not-found",this,{commandName:e});return i.execute(...t)}*names(){yield*this._commands.keys()}*commands(){yield*this._commands.values()}[Symbol.iterator](){return this._commands[Symbol.iterator]()}destroy(){for(const e of this.commands())e.destroy()}}class x extends n.KeystrokeHandler{constructor(e){super(),this.editor=e}set(e,t,i={}){if("string"==typeof t){const e=t;t=(t,i)=>{this.editor.execute(e),i()}}super.set(e,t,i)}}const T="contentEditing",P="common";class I{constructor(e){this.keystrokeInfos=new Map,this._editor=e;const t=e.config.get("menuBar.isVisible"),i=e.locale.t;this.addKeystrokeInfoCategory({id:T,label:i("Content editing keystrokes"),description:i("These keyboard shortcuts allow for quick access to content editing features.")});const n=[{label:i("Close contextual balloons, dropdowns, and dialogs"),keystroke:"Esc"},{label:i("Open the accessibility help dialog"),keystroke:"Alt+0"},{label:i("Move focus between form fields (inputs, buttons, etc.)"),keystroke:[["Tab"],["Shift+Tab"]]},{label:i("Move focus to the toolbar, navigate between toolbars"),keystroke:"Alt+F10",mayRequireFn:!0},{label:i("Navigate through the toolbar or menu bar"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]},{label:i("Execute the currently focused button. Executing buttons that interact with the editor content moves the focus back to the content."),keystroke:[["Enter"],["Space"]]}];t&&n.push({label:i("Move focus to the menu bar, navigate between menu bars"),keystroke:"Alt+F9",mayRequireFn:!0}),this.addKeystrokeInfoCategory({id:"navigation",label:i("User interface and content navigation keystrokes"),description:i("Use the following keystrokes for more efficient navigation in the CKEditor 5 user interface."),groups:[{id:"common",keystrokes:n}]})}addKeystrokeInfoCategory({id:e,label:t,description:i,groups:n}){this.keystrokeInfos.set(e,{id:e,label:t,description:i,groups:new Map}),this.addKeystrokeInfoGroup({categoryId:e,id:P}),n&&n.forEach((t=>{this.addKeystrokeInfoGroup({categoryId:e,...t})}))}addKeystrokeInfoGroup({categoryId:e=T,id:t,label:i,keystrokes:o}){const s=this.keystrokeInfos.get(e);if(!s)throw new n.CKEditorError("accessibility-unknown-keystroke-info-category",this._editor,{groupId:t,categoryId:e});s.groups.set(t,{id:t,label:i,keystrokes:o||[]})}addKeystrokeInfos({categoryId:e=T,groupId:t=P,keystrokes:i}){if(!this.keystrokeInfos.has(e))throw new n.CKEditorError("accessibility-unknown-keystroke-info-category",this._editor,{categoryId:e,keystrokes:i});const o=this.keystrokeInfos.get(e);if(!o.groups.has(t))throw new n.CKEditorError("accessibility-unknown-keystroke-info-group",this._editor,{groupId:t,categoryId:e,keystrokes:i});o.groups.get(t).keystrokes.push(...i)}}class S extends((0,n.ObservableMixin)()){constructor(e={}){super();const t=this.constructor,{translations:i,...o}=t.defaultConfig||{},{translations:s=i,...r}=e,a=e.language||o.language;this._context=e.context||new d({language:a,translations:s}),this._context._addEditor(this,!e.context);const l=Array.from(t.builtinPlugins||[]);this.config=new n.Config(r,o),this.config.define("plugins",l),this.config.define(this._context._getEditorConfig()),this.plugins=new c(this,l,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this._readOnlyLocks=new Set,this.commands=new E,this.set("state","initializing"),this.once("ready",(()=>this.state="ready"),{priority:"high"}),this.once("destroy",(()=>this.state="destroyed"),{priority:"high"}),this.model=new h.Model,this.on("change:isReadOnly",(()=>{this.model.document.isReadOnly=this.isReadOnly}));const u=new h.StylesProcessor;this.data=new h.DataController(this.model,u),this.editing=new h.EditingController(this.model,u),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new h.Conversion([this.editing.downcastDispatcher,this.data.downcastDispatcher],this.data.upcastDispatcher),this.conversion.addAlias("dataDowncast",this.data.downcastDispatcher),this.conversion.addAlias("editingDowncast",this.editing.downcastDispatcher),this.keystrokes=new x(this),this.keystrokes.listenTo(this.editing.view.document),this.accessibility=new I(this)}get isReadOnly(){return this._readOnlyLocks.size>0}set isReadOnly(e){throw new n.CKEditorError("editor-isreadonly-has-no-setter")}enableReadOnlyMode(e){if("string"!=typeof e&&"symbol"!=typeof e)throw new n.CKEditorError("editor-read-only-lock-id-invalid",null,{lockId:e});this._readOnlyLocks.has(e)||(this._readOnlyLocks.add(e),1===this._readOnlyLocks.size&&this.fire("change:isReadOnly","isReadOnly",!0,!1))}disableReadOnlyMode(e){if("string"!=typeof e&&"symbol"!=typeof e)throw new n.CKEditorError("editor-read-only-lock-id-invalid",null,{lockId:e});this._readOnlyLocks.has(e)&&(this._readOnlyLocks.delete(e),0===this._readOnlyLocks.size&&this.fire("change:isReadOnly","isReadOnly",!1,!0))}setData(e){this.data.set(e)}getData(e){return this.data.get(e)}initPlugins(){const e=this.config,t=e.get("plugins"),i=e.get("removePlugins")||[],n=e.get("extraPlugins")||[],o=e.get("substitutePlugins")||[];return this.plugins.init(t.concat(n),i,o)}destroy(){let e=Promise.resolve();return"initializing"==this.state&&(e=new Promise((e=>this.once("ready",e)))),e.then((()=>{this.fire("destroy"),this.stopListening(),this.commands.destroy()})).then((()=>this.plugins.destroy())).then((()=>{this.model.destroy(),this.data.destroy(),this.editing.destroy(),this.keystrokes.destroy()})).then((()=>this._context._removeEditor(this)))}execute(e,...t){try{return this.commands.execute(e,...t)}catch(e){n.CKEditorError.rethrowUnexpectedError(e,this)}}focus(){this.editing.view.focus()}static create(...e){throw new Error("This is an abstract method.")}}S.Context=d,S.EditorWatchdog=_,S.ContextWatchdog=class extends m{constructor(e,t={}){super(t),this._watchdogs=new Map,this._context=null,this._contextProps=new Set,this._actionQueues=new C,this._watchdogConfig=t,this._creator=t=>e.create(t),this._destructor=e=>e.destroy(),this._actionQueues.onEmpty((()=>{"initializing"===this.state&&(this.state="ready",this._fire("stateChange"))}))}setCreator(e){this._creator=e}setDestructor(e){this._destructor=e}get context(){return this._context}create(e={}){return this._actionQueues.enqueue(k,(()=>(this._contextConfig=e,this._create())))}getItem(e){return this._getWatchdog(e)._item}getItemState(e){return this._getWatchdog(e).state}add(e){const t=A(e);return Promise.all(t.map((e=>this._actionQueues.enqueue(e.id,(()=>{if("destroyed"===this.state)throw new Error("Cannot add items to destroyed watchdog.");if(!this._context)throw new Error("Context was not created yet. You should call the `ContextWatchdog#create()` method first.");let t;if(this._watchdogs.has(e.id))throw new Error(`Item with the given id is already added: '${e.id}'.`);if("editor"===e.type)return t=new _(null,this._watchdogConfig),t.setCreator(e.creator),t._setExcludedProperties(this._contextProps),e.destructor&&t.setDestructor(e.destructor),this._watchdogs.set(e.id,t),t.on("error",((i,{error:n,causesRestart:o})=>{this._fire("itemError",{itemId:e.id,error:n}),o&&this._actionQueues.enqueue(e.id,(()=>new Promise((i=>{const n=()=>{t.off("restart",n),this._fire("itemRestart",{itemId:e.id}),i()};t.on("restart",n)}))))})),t.create(e.sourceElementOrData,e.config,this._context);throw new Error(`Not supported item type: '${e.type}'.`)})))))}remove(e){const t=A(e);return Promise.all(t.map((e=>this._actionQueues.enqueue(e,(()=>{const t=this._getWatchdog(e);return this._watchdogs.delete(e),t.destroy()})))))}destroy(){return this._actionQueues.enqueue(k,(()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy())))}_restart(){return this._actionQueues.enqueue(k,(()=>(this.state="initializing",this._fire("stateChange"),this._destroy().catch((e=>{console.error("An error happened during destroying the context or items.",e)})).then((()=>this._create())).then((()=>this._fire("restart"))))))}_create(){return Promise.resolve().then((()=>(this._startErrorHandling(),this._creator(this._contextConfig)))).then((e=>(this._context=e,this._contextProps=g(this._context),Promise.all(Array.from(this._watchdogs.values()).map((e=>(e._setExcludedProperties(this._contextProps),e.create(void 0,void 0,this._context))))))))}_destroy(){return Promise.resolve().then((()=>{this._stopErrorHandling();const e=this._context;return this._context=null,this._contextProps=new Set,Promise.all(Array.from(this._watchdogs.values()).map((e=>e.destroy()))).then((()=>this._destructor(e)))}))}_getWatchdog(e){const t=this._watchdogs.get(e);if(!t)throw new Error(`Item with the given id was not registered: ${e}.`);return t}_isErrorComingFromThisItem(e){for(const t of this._watchdogs.values())if(t._isErrorComingFromThisItem(e))return!1;return p(this._context,e.context)}};const V=S;var R=i(9610);function B(e){if(!(0,R.A)(e.updateSourceElement))throw new n.CKEditorError("attachtoform-missing-elementapi-interface",e);const t=e.sourceElement;if(function(e){return!!e&&"textarea"===e.tagName.toLowerCase()}(t)&&t.form){let i;const n=t.form,o=()=>e.updateSourceElement();(0,R.A)(n.submit)&&(i=n.submit,n.submit=()=>{o(),i.apply(n)}),n.addEventListener("submit",o),e.on("destroy",(()=>{n.removeEventListener("submit",o),i&&(n.submit=i)}))}}function M(e){return e}function O(e){return class extends e{updateSourceElement(e){if(!this.sourceElement)throw new n.CKEditorError("editor-missing-sourceelement",this);const t=this.config.get("updateSourceElementOnDestroy"),i=this.sourceElement instanceof HTMLTextAreaElement;if(!t&&!i)return void(0,n.setDataInElement)(this.sourceElement,"");const o="string"==typeof e?e:this.data.get();(0,n.setDataInElement)(this.sourceElement,o)}}}function L(e,t){if(t.ckeditorInstance)throw new n.CKEditorError("editor-source-element-already-used",e);t.ckeditorInstance=e,e.once("destroy",(()=>{delete t.ckeditorInstance}))}O.updateSourceElement=O(Object).prototype.updateSourceElement;class F extends u{static get pluginName(){return"PendingActions"}init(){this.set("hasAny",!1),this._actions=new n.Collection({idProperty:"_id"}),this._actions.delegate("add","remove").to(this)}add(e){if("string"!=typeof e)throw new n.CKEditorError("pendingactions-add-invalid-message",this);const t=new((0,n.ObservableMixin)());return t.set("message",e),this._actions.add(t),this.hasAny=!0,t}remove(e){this._actions.remove(e),this.hasAny=!!this._actions.length}get first(){return this._actions.get(0)}[Symbol.iterator](){return this._actions[Symbol.iterator]()}}const N={bold:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.187 17H5.773c-.637 0-1.092-.138-1.364-.415-.273-.277-.409-.718-.409-1.323V4.738c0-.617.14-1.062.419-1.332.279-.27.73-.406 1.354-.406h4.68c.69 0 1.288.041 1.793.124.506.083.96.242 1.36.478.341.197.644.447.906.75a3.262 3.262 0 0 1 .808 2.162c0 1.401-.722 2.426-2.167 3.075C15.05 10.175 16 11.315 16 13.01a3.756 3.756 0 0 1-2.296 3.504 6.1 6.1 0 0 1-1.517.377c-.571.073-1.238.11-2 .11zm-.217-6.217H7v4.087h3.069c1.977 0 2.965-.69 2.965-2.072 0-.707-.256-1.22-.768-1.537-.512-.319-1.277-.478-2.296-.478zM7 5.13v3.619h2.606c.729 0 1.292-.067 1.69-.2a1.6 1.6 0 0 0 .91-.765c.165-.267.247-.566.247-.897 0-.707-.26-1.176-.778-1.409-.519-.232-1.31-.348-2.375-.348H7z"/></svg>',cancel:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.591 10.177 4.243 4.242a1 1 0 0 1-1.415 1.415l-4.242-4.243-4.243 4.243a1 1 0 0 1-1.414-1.415l4.243-4.242L4.52 5.934A1 1 0 0 1 5.934 4.52l4.243 4.243 4.242-4.243a1 1 0 1 1 1.415 1.414l-4.243 4.243z"/></svg>',caption:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 16h9a1 1 0 0 1 0 2H2a1 1 0 0 1 0-2z"/><path d="M17 1a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h14zm0 1.5H3a.5.5 0 0 0-.492.41L2.5 3v9a.5.5 0 0 0 .41.492L3 12.5h14a.5.5 0 0 0 .492-.41L17.5 12V3a.5.5 0 0 0-.41-.492L17 2.5z" fill-opacity=".6"/></svg>',check:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.972 16.615a.997.997 0 0 1-.744-.292l-4.596-4.596a1 1 0 1 1 1.414-1.414l3.926 3.926 9.937-9.937a1 1 0 0 1 1.414 1.415L7.717 16.323a.997.997 0 0 1-.745.292z"/></svg>',cog:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.333 2 .19 2.263a5.899 5.899 0 0 1 1.458.604L14.714 3.4 16.6 5.286l-1.467 1.733c.263.452.468.942.605 1.46L18 8.666v2.666l-2.263.19a5.899 5.899 0 0 1-.604 1.458l1.467 1.733-1.886 1.886-1.733-1.467a5.899 5.899 0 0 1-1.46.605L11.334 18H8.667l-.19-2.263a5.899 5.899 0 0 1-1.458-.604L5.286 16.6 3.4 14.714l1.467-1.733a5.899 5.899 0 0 1-.604-1.458L2 11.333V8.667l2.262-.189a5.899 5.899 0 0 1 .605-1.459L3.4 5.286 5.286 3.4l1.733 1.467a5.899 5.899 0 0 1 1.46-.605L8.666 2h2.666zM10 6.267a3.733 3.733 0 1 0 0 7.466 3.733 3.733 0 0 0 0-7.466z"/></svg>',colorPalette:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.209 18.717A8.5 8.5 0 1 1 18.686 9.6h-.008l.002.12a3 3 0 0 1-2.866 2.997h-.268l-.046-.002v.002h-4.791a2 2 0 1 0 0 4 1 1 0 1 1-.128 1.992 8.665 8.665 0 0 1-.372.008Zm-3.918-7.01a1.25 1.25 0 1 0-2.415-.648 1.25 1.25 0 0 0 2.415.647ZM5.723 8.18a1.25 1.25 0 1 0 .647-2.414 1.25 1.25 0 0 0-.647 2.414ZM9.76 6.155a1.25 1.25 0 1 0 .647-2.415 1.25 1.25 0 0 0-.647 2.415Zm4.028 1.759a1.25 1.25 0 1 0 .647-2.415 1.25 1.25 0 0 0-.647 2.415Z"/></svg>',eraser:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m8.636 9.531-2.758 3.94a.5.5 0 0 0 .122.696l3.224 2.284h1.314l2.636-3.736L8.636 9.53zm.288 8.451L5.14 15.396a2 2 0 0 1-.491-2.786l6.673-9.53a2 2 0 0 1 2.785-.49l3.742 2.62a2 2 0 0 1 .491 2.785l-7.269 10.053-2.147-.066z"/><path d="M4 18h5.523v-1H4zm-2 0h1v-1H2z"/></svg>',history:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11 1a9 9 0 1 1-8.027 13.075l1.128-1.129A7.502 7.502 0 0 0 18.5 10a7.5 7.5 0 1 0-14.962.759l-.745-.746-.76.76A9 9 0 0 1 11 1z"/><path d="M.475 8.17a.75.75 0 0 1 .978.047l.075.082 1.284 1.643 1.681-1.284a.75.75 0 0 1 .978.057l.073.083a.75.75 0 0 1-.057.978l-.083.073-2.27 1.737a.75.75 0 0 1-.973-.052l-.074-.082-1.741-2.23a.75.75 0 0 1 .13-1.052z"/><path d="M11.5 5v4.999l3.196 3.196-1.06 1.06L10.1 10.72l-.1-.113V5z"/></svg>',image:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.66 9.118a.693.693 0 0 1 .956.032l3.65 3.411 2.422-2.238a.695.695 0 0 1 .945 0L17.5 13.6V2.5h-15v11.1l4.16-4.482ZM17.8 1c.652 0 1.2.47 1.2 1.1v14.362c0 .64-.532 1.038-1.184 1.038H2.184C1.532 17.5 1 17.103 1 16.462V2.1C1 1.47 1.537 1 2.2 1h15.6Zm-5.655 6a2.128 2.128 0 0 1 .157-2.364A2.133 2.133 0 1 1 12.145 7Z"/></svg>',imageUpload:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M1.201 1C.538 1 0 1.47 0 2.1v14.363c0 .64.534 1.037 1.186 1.037h9.494a2.97 2.97 0 0 1-.414-.287 2.998 2.998 0 0 1-1.055-2.03 3.003 3.003 0 0 1 .693-2.185l.383-.455-.02.018-3.65-3.41a.695.695 0 0 0-.957-.034L1.5 13.6V2.5h15v5.535a2.97 2.97 0 0 1 1.412.932l.088.105V2.1c0-.63-.547-1.1-1.2-1.1H1.202Zm11.713 2.803a2.146 2.146 0 0 0-2.049 1.992 2.14 2.14 0 0 0 1.28 2.096 2.13 2.13 0 0 0 2.644-3.11 2.134 2.134 0 0 0-1.875-.978Z"/><path d="M15.522 19.1a.79.79 0 0 0 .79-.79v-5.373l2.059 2.455a.79.79 0 1 0 1.211-1.015l-3.352-3.995a.79.79 0 0 0-.995-.179.784.784 0 0 0-.299.221l-3.35 3.99a.79.79 0 1 0 1.21 1.017l1.936-2.306v5.185c0 .436.353.79.79.79Z"/><path d="M15.522 19.1a.79.79 0 0 0 .79-.79v-5.373l2.059 2.455a.79.79 0 1 0 1.211-1.015l-3.352-3.995a.79.79 0 0 0-.995-.179.784.784 0 0 0-.299.221l-3.35 3.99a.79.79 0 1 0 1.21 1.017l1.936-2.306v5.185c0 .436.353.79.79.79Z"/></svg>',imageAssetManager:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M1.201 1c-.662 0-1.2.47-1.2 1.1v14.248c0 .64.533 1.152 1.185 1.152h6.623v-7.236L6.617 9.15a.694.694 0 0 0-.957-.033L1.602 13.55V2.553l14.798.003V9.7H18V2.1c0-.63-.547-1.1-1.2-1.1H1.202Zm11.723 2.805a2.094 2.094 0 0 0-1.621.832 2.127 2.127 0 0 0 1.136 3.357 2.13 2.13 0 0 0 2.611-1.506 2.133 2.133 0 0 0-.76-2.244 2.13 2.13 0 0 0-1.366-.44Z"/><path clip-rule="evenodd" d="M19.898 12.369v6.187a.844.844 0 0 1-.844.844h-8.719a.844.844 0 0 1-.843-.844v-7.312a.844.844 0 0 1 .843-.844h2.531a.843.843 0 0 1 .597.248l.838.852h4.75c.223 0 .441.114.6.272a.844.844 0 0 1 .247.597Zm-1.52.654-4.377.02-1.1-1.143H11v6h7.4l-.023-4.877Z"/></svg>',imageUrl:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M1.201 1C.538 1 0 1.47 0 2.1v14.363c0 .64.534 1.037 1.186 1.037h7.029a5.401 5.401 0 0 1 .615-4.338l.762-1.232-2.975-2.78a.696.696 0 0 0-.957-.033L1.5 13.6V2.5h15v6.023c.449.131.887.32 1.307.573l.058.033c.046.028.09.057.135.086V2.1c0-.63-.547-1.1-1.2-1.1H1.202Zm11.713 2.803a2.15 2.15 0 0 0-1.611.834 2.118 2.118 0 0 0-.438 1.158 2.14 2.14 0 0 0 1.277 2.096 2.132 2.132 0 0 0 2.645-3.11 2.13 2.13 0 0 0-1.873-.978Z"/><path d="M16.63 10.294a3.003 3.003 0 0 0-4.142.887l-.117.177a.647.647 0 0 0-.096.492.664.664 0 0 0 .278.418.7.7 0 0 0 .944-.234 1.741 1.741 0 0 1 2.478-.463 1.869 1.869 0 0 1 .476 2.55.637.637 0 0 0-.071.5.646.646 0 0 0 .309.396.627.627 0 0 0 .869-.19l.027-.041a3.226 3.226 0 0 0-.956-4.492Zm-6.061 3.78-.044.066a3.228 3.228 0 0 0 .82 4.403 3.005 3.005 0 0 0 4.275-.798l.13-.197a.626.626 0 0 0 .092-.475.638.638 0 0 0-.268-.402.713.713 0 0 0-.99.26l-.018.029a1.741 1.741 0 0 1-2.477.461 1.87 1.87 0 0 1-.475-2.55l.029-.047a.647.647 0 0 0 .086-.485.66.66 0 0 0-.275-.408l-.04-.027a.609.609 0 0 0-.845.17Z"/><path d="M15.312 13.925c.24-.36.154-.838-.19-1.067-.346-.23-.82-.124-1.059.236l-1.268 1.907c-.239.36-.153.838.192 1.067.345.23.818.123 1.057-.236l1.268-1.907Z"/></svg>',lowVision:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5.085 6.22 2.943 4.078a.75.75 0 1 1 1.06-1.06l2.592 2.59A11.094 11.094 0 0 1 10 5.068c4.738 0 8.578 3.101 8.578 5.083 0 1.197-1.401 2.803-3.555 3.887l1.714 1.713a.75.75 0 0 1-.09 1.138.488.488 0 0 1-.15.084.75.75 0 0 1-.821-.16L6.17 7.304c-.258.11-.51.233-.757.365l6.239 6.24-.006.005.78.78c-.388.094-.78.166-1.174.215l-1.11-1.11h.011L4.55 8.197a7.2 7.2 0 0 0-.665.514l-.112.098 4.897 4.897-.005.006 1.276 1.276a10.164 10.164 0 0 1-1.477-.117l-.479-.479-.009.009-4.863-4.863-.022.031a2.563 2.563 0 0 0-.124.2c-.043.077-.08.158-.108.241a.534.534 0 0 0-.028.133.29.29 0 0 0 .008.072.927.927 0 0 0 .082.226c.067.133.145.26.234.379l3.242 3.365.025.01.59.623c-3.265-.918-5.59-3.155-5.59-4.668 0-1.194 1.448-2.838 3.663-3.93zm7.07.531a4.632 4.632 0 0 1 1.108 5.992l.345.344.046-.018a9.313 9.313 0 0 0 2-1.112c.256-.187.5-.392.727-.613.137-.134.27-.277.392-.431.072-.091.141-.185.203-.286.057-.093.107-.19.148-.292a.72.72 0 0 0 .036-.12.29.29 0 0 0 .008-.072.492.492 0 0 0-.028-.133.999.999 0 0 0-.036-.096 2.165 2.165 0 0 0-.071-.145 2.917 2.917 0 0 0-.125-.2 3.592 3.592 0 0 0-.263-.335 5.444 5.444 0 0 0-.53-.523 7.955 7.955 0 0 0-1.054-.768 9.766 9.766 0 0 0-1.879-.891c-.337-.118-.68-.219-1.027-.301zm-2.85.21-.069.002a.508.508 0 0 0-.254.097.496.496 0 0 0-.104.679.498.498 0 0 0 .326.199l.045.005c.091.003.181.003.272.012a2.45 2.45 0 0 1 2.017 1.513c.024.061.043.125.069.185a.494.494 0 0 0 .45.287h.008a.496.496 0 0 0 .35-.158.482.482 0 0 0 .13-.335.638.638 0 0 0-.048-.219 3.379 3.379 0 0 0-.36-.723 3.438 3.438 0 0 0-2.791-1.543l-.028-.001h-.013z"/></svg>',textAlternative:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.035 1C2.446 1 2 1.54 2 2.098V10.5h1.5v-8h13v8H18V2.098C18 1.539 17.48 1 16.9 1H3.035Zm10.453 2.61a1.885 1.885 0 0 0-1.442.736 1.89 1.89 0 0 0 1.011 2.976 1.903 1.903 0 0 0 2.253-1.114 1.887 1.887 0 0 0-1.822-2.598ZM7.463 8.163a.611.611 0 0 0-.432.154L5.071 10.5h5.119L7.88 8.348a.628.628 0 0 0-.417-.185Zm6.236 1.059a.62.62 0 0 0-.42.164L12.07 10.5h2.969l-.92-1.113a.618.618 0 0 0-.42-.165ZM.91 11.5a.91.91 0 0 0-.91.912v6.877c0 .505.405.91.91.91h18.178a.91.91 0 0 0 .912-.91v-6.877a.908.908 0 0 0-.912-.912H.91ZM3.668 13h1.947l2.135 5.7H5.898l-.28-.946H3.601l-.278.945H1.516L3.668 13Zm4.947 0h1.801v4.3h2.7v1.4h-4.5V13h-.001Zm4.5 0h5.4v1.4h-1.798v4.3h-1.701v-4.3h-1.9V13h-.001Zm-8.517 1.457-.614 2.059h1.262l-.648-2.059Z"/></svg>',loupe:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.68 13.74h-.001l4.209 4.208a1 1 0 1 0 1.414-1.414l-4.267-4.268a6 6 0 1 0-1.355 1.474ZM13 9a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z"/></svg>',previousArrow:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.463 5.187a.888.888 0 1 1 1.254 1.255L9.16 10l3.557 3.557a.888.888 0 1 1-1.254 1.255L7.26 10.61a.888.888 0 0 1 .16-1.382l4.043-4.042z"/></svg>',nextArrow:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8.537 14.813a.888.888 0 1 1-1.254-1.255L10.84 10 7.283 6.442a.888.888 0 1 1 1.254-1.255L12.74 9.39a.888.888 0 0 1-.16 1.382l-4.043 4.042z"/></svg>',importExport:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M19 4.5 14 0H3v12.673l.868-1.041c.185-.222.4-.402.632-.54V1.5h8v5h5v7.626a2.24 2.24 0 0 1 1.5.822V4.5ZM14 5V2l3.3 3H14Zm-3.692 12.5c.062.105.133.206.213.303L11.52 19H8v-.876a2.243 2.243 0 0 0 1.82-.624h.488Zm7.518-.657a.75.75 0 0 0-1.152-.96L15.5 17.29V12H14v5.29l-1.174-1.408a.75.75 0 0 0-1.152.96l2.346 2.816a.95.95 0 0 0 1.46 0l2.346-2.815Zm-15.056-.38a.75.75 0 0 1-.096-1.056l2.346-2.815a.95.95 0 0 1 1.46 0l2.346 2.815a.75.75 0 1 1-1.152.96L6.5 14.96V20H5v-5.04l-1.174 1.408a.75.75 0 0 1-1.056.096Z"/></svg>',paragraph:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.5 5.5H7v5h3.5a2.5 2.5 0 1 0 0-5zM5 3h6.5v.025a5 5 0 0 1 0 9.95V13H7v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z"/></svg>',plus:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10 2a1 1 0 0 0-1 1v6H3a1 1 0 1 0 0 2h6v6a1 1 0 1 0 2 0v-6h6a1 1 0 1 0 0-2h-6V3a1 1 0 0 0-1-1Z"/></svg>',text:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.816 11.5 7.038 4.785 4.261 11.5h5.555Zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663L10.436 13Z"/><path d="m12.09 17-.534-1.292.848-1.971.545 1.319L12.113 17h-.023Zm1.142-5.187.545 1.319L15.5 9.13l1.858 4.316h-3.45l.398.965h3.467L18.887 17H20l-3.873-9h-1.254l-1.641 3.813Z"/></svg>',alignBottom:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m9.239 13.938-2.88-1.663a.75.75 0 0 1 .75-1.3L9 12.067V4.75a.75.75 0 1 1 1.5 0v7.318l1.89-1.093a.75.75 0 0 1 .75 1.3l-2.879 1.663a.752.752 0 0 1-.511.187.752.752 0 0 1-.511-.187zM4.25 17a.75.75 0 1 1 0-1.5h10.5a.75.75 0 0 1 0 1.5H4.25z"/></svg>',alignMiddle:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.75 11.875a.752.752 0 0 1 .508.184l2.883 1.666a.75.75 0 0 1-.659 1.344l-.091-.044-1.892-1.093.001 4.318a.75.75 0 1 1-1.5 0v-4.317l-1.89 1.092a.75.75 0 0 1-.75-1.3l2.879-1.663a.752.752 0 0 1 .51-.187zM15.25 9a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.5h10.5zM9.75.375a.75.75 0 0 1 .75.75v4.318l1.89-1.093.092-.045a.75.75 0 0 1 .659 1.344l-2.883 1.667a.752.752 0 0 1-.508.184.752.752 0 0 1-.511-.187L6.359 5.65a.75.75 0 0 1 .75-1.299L9 5.442V1.125a.75.75 0 0 1 .75-.75z"/></svg>',alignTop:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m10.261 7.062 2.88 1.663a.75.75 0 0 1-.75 1.3L10.5 8.933v7.317a.75.75 0 1 1-1.5 0V8.932l-1.89 1.093a.75.75 0 0 1-.75-1.3l2.879-1.663a.752.752 0 0 1 .511-.187.752.752 0 0 1 .511.187zM15.25 4a.75.75 0 1 1 0 1.5H4.75a.75.75 0 0 1 0-1.5h10.5z"/></svg>',alignLeft:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75z"/></svg>',alignCenter:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm2.286 4c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75z"/></svg>',alignRight:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M18 3.75a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75zm0 8a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75zm0 4a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75zm0-8a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75z"/></svg>',alignJustify:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75z"/></svg>',objectLeft:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zm0-3H18v1.5h-4.5zm0-3H18v1.5h-4.5zM2 15h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',objectCenter:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M15.003 7v5.5a1 1 0 0 1-1 1H5.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H6.5V12h6.997V7.5z"/></svg>',objectRight:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2zm0-9h5v1.5H2zm0 3h5v1.5H2zm0 3h5v1.5H2z"/><path d="M18.003 7v5.5a1 1 0 0 1-1 1H8.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H9.5V12h6.997V7.5z"/></svg>',objectFullWidth:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M18 7v5.5a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1zm-1.505.5H3.504V12h12.991V7.5z"/></svg>',objectInline:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zM2 15h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',objectBlockLeft:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',objectBlockRight:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M18.003 7v5.5a1 1 0 0 1-1 1H8.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H9.5V12h6.997V7.5z"/></svg>',objectSizeCustom:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:v="https://vecta.io/nano" viewBox="0 0 20 20"><path d="M.95 1.43a.95.95 0 0 0-.95.95v3.1a.95.95 0 0 0 .95.95h.75v6.3H.95a.95.95 0 0 0-.95.95v3.1a.95.95 0 0 0 .95.95h3.1a.95.95 0 0 0 .95-.95v-.65h1.932l1.539-1.5H5v-.95a.95.95 0 0 0-.95-.95H3.2v-6.3h.85A.95.95 0 0 0 5 5.48v-.55h10v.55a.95.95 0 0 0 .95.95h3.1a.95.95 0 0 0 .95-.95v-3.1a.95.95 0 0 0-.95-.95h-3.1a.95.95 0 0 0-.95.95v1.05H5V2.38a.95.95 0 0 0-.95-.95H.95zm.55 3.5v-2h2v2h-2zm0 9.3v2h2v-2h-2zm15-11.3v2h2v-2h-2z"/><path d="M8.139 20.004v-2.388l7.045-7.048 2.391 2.391-7.046 7.046h-2.39zm11.421-9.101a.64.64 0 0 1-.138.206l-1.165 1.168-2.391-2.391 1.167-1.163a.63.63 0 0 1 .206-.138.635.635 0 0 1 .243-.049.63.63 0 0 1 .449.187l1.491 1.488c.059.059.108.129.138.206s.049.16.049.243a.6.6 0 0 1-.049.243z"/></svg>',objectSizeFull:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 17v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zM1 15.5v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm0-2v1h-1v-1h1zm-19 0v1H0v-1h1zM14.5 2v1h-1V2h1zm2 0v1h-1V2h1zm2 0v1h-1V2h1zm-8 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm8 0v1h-1V2h1zm-10 0v1h-1V2h1z"/><path d="M18.095 2H1.905C.853 2 0 2.895 0 4v12c0 1.105.853 2 1.905 2h16.19C19.147 18 20 17.105 20 16V4c0-1.105-.853-2-1.905-2zm0 1.5c.263 0 .476.224.476.5v12c0 .276-.213.5-.476.5H1.905a.489.489 0 0 1-.476-.5V4c0-.276.213-.5.476-.5h16.19z"/></svg>',objectSizeLarge:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 16.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1ZM1 15v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 13v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 11v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 9v1H0V9h1Zm19 0v1h-1V9h1ZM1 7v1H0V7h1Zm19 0v1h-1V7h1ZM1 5v1H0V5h1Zm19 0v1h-1V5h1Zm0-2v1h-1V3h1ZM1 3v1H0V3h1Zm13.5-1.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm-8 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm8 0v1h-1v-1h1Zm-10 0v1h-1v-1h1Z"/><path d="M13 5.5H2a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-8a2 2 0 0 0-2-2ZM13 7a.5.5 0 0 1 .5.5v8a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-8A.5.5 0 0 1 2 7h11Z"/></svg>',objectSizeSmall:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 16.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1ZM1 15v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 13v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 11v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 9v1H0V9h1Zm19 0v1h-1V9h1ZM1 7v1H0V7h1Zm19 0v1h-1V7h1ZM1 5v1H0V5h1Zm19 0v1h-1V5h1Zm0-2v1h-1V3h1ZM1 3v1H0V3h1Zm13.5-1.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm-8 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm8 0v1h-1v-1h1Zm-10 0v1h-1v-1h1Z"/><path d="M7 9.5H2a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h5a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2ZM7 11a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-4A.5.5 0 0 1 2 11h5Z"/></svg>',objectSizeMedium:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 16.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1ZM1 15v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 13v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 11v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 9v1H0V9h1Zm19 0v1h-1V9h1ZM1 7v1H0V7h1Zm19 0v1h-1V7h1ZM1 5v1H0V5h1Zm19 0v1h-1V5h1Zm0-2v1h-1V3h1ZM1 3v1H0V3h1Zm13.5-1.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm-8 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm8 0v1h-1v-1h1Zm-10 0v1h-1v-1h1Z"/><path d="M10 7.5H2a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2ZM10 9a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-6A.5.5 0 0 1 2 9h8Z"/></svg>',pencil:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m7.3 17.37-.061.088a1.518 1.518 0 0 1-.934.535l-4.178.663-.806-4.153a1.495 1.495 0 0 1 .187-1.058l.056-.086L8.77 2.639c.958-1.351 2.803-1.076 4.296-.03 1.497 1.047 2.387 2.693 1.433 4.055L7.3 17.37zM9.14 4.728l-5.545 8.346 3.277 2.294 5.544-8.346L9.14 4.728zM6.07 16.512l-3.276-2.295.53 2.73 2.746-.435zM9.994 3.506 13.271 5.8c.316-.452-.16-1.333-1.065-1.966-.905-.634-1.895-.78-2.212-.328zM8 18.5 9.375 17H19v1.5H8z"/></svg>',pilcrow:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.999 2H15a1 1 0 0 1 0 2h-1.004v13a1 1 0 1 1-2 0V4H8.999v13a1 1 0 1 1-2 0v-7A4 4 0 0 1 3 6a4 4 0 0 1 3.999-4z"/></svg>',quote:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 10.423a6.5 6.5 0 0 1 6.056-6.408l.038.67C6.448 5.423 5.354 7.663 5.22 10H9c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003v-4.574zm8 0a6.5 6.5 0 0 1 6.056-6.408l.038.67c-2.646.739-3.74 2.979-3.873 5.315H17c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003v-4.574z"/></svg>',threeVerticalDots:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="9.5" cy="4.5" r="1.5"/><circle cx="9.5" cy="10.5" r="1.5"/><circle cx="9.5" cy="16.5" r="1.5"/></svg>',dragIndicator:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5 3.25a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M12 3.25a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M12 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M5 16.75a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M12 16.75a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/></svg>',redo:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m14.958 9.367-2.189 1.837a.75.75 0 0 0 .965 1.149l3.788-3.18a.747.747 0 0 0 .21-.284.75.75 0 0 0-.17-.945L13.77 4.762a.75.75 0 1 0-.964 1.15l2.331 1.955H6.22A.75.75 0 0 0 6 7.9a4 4 0 1 0 1.477 7.718l-.344-1.489A2.5 2.5 0 1 1 6.039 9.4l-.008-.032h8.927z"/></svg>',undo:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m5.042 9.367 2.189 1.837a.75.75 0 0 1-.965 1.149l-3.788-3.18a.747.747 0 0 1-.21-.284.75.75 0 0 1 .17-.945L6.23 4.762a.75.75 0 1 1 .964 1.15L4.863 7.866h8.917A.75.75 0 0 1 14 7.9a4 4 0 1 1-1.477 7.718l.344-1.489a2.5 2.5 0 1 0 1.094-4.73l.008-.032H5.042z"/></svg>',bulletedList:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zm-6 0C1 4.784 1.777 4 2.75 4c.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75C1.784 7.5 1 6.723 1 5.75zm6 9c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zm-6 0c0-.966.777-1.75 1.75-1.75.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75-.966 0-1.75-.777-1.75-1.75z"/></svg>',numberedList:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM3.5 3v5H2V3.7H1v-1h2.5V3zM.343 17.857l2.59-3.257H2.92a.6.6 0 1 0-1.04 0H.302a2 2 0 1 1 3.995 0h-.001c-.048.405-.16.734-.333.988-.175.254-.59.692-1.244 1.312H4.3v1h-4l.043-.043zM7 14.75a.75.75 0 0 1 .75-.75h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75z"/></svg>',todoList:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m2.315 14.705 2.224-2.24a.689.689 0 0 1 .963 0 .664.664 0 0 1 0 .949L2.865 16.07a.682.682 0 0 1-.112.089.647.647 0 0 1-.852-.051L.688 14.886a.635.635 0 0 1 0-.903.647.647 0 0 1 .91 0l.717.722zm5.185.045a.75.75 0 0 1 .75-.75h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75zM2.329 5.745l2.21-2.226a.689.689 0 0 1 .963 0 .664.664 0 0 1 0 .95L2.865 7.125a.685.685 0 0 1-.496.196.644.644 0 0 1-.468-.187L.688 5.912a.635.635 0 0 1 0-.903.647.647 0 0 1 .91 0l.73.736zM7.5 5.75A.75.75 0 0 1 8.25 5h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75z"/></svg>',codeBlock:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.87 12.61a.75.75 0 0 1-.089.976l-.085.07-3.154 2.254 3.412 2.414a.75.75 0 0 1 .237.95l-.057.095a.75.75 0 0 1-.95.237l-.096-.058-4.272-3.022-.003-1.223 4.01-2.867a.75.75 0 0 1 1.047.174zm2.795-.231.095.057 4.011 2.867-.003 1.223-4.272 3.022-.095.058a.75.75 0 0 1-.88-.151l-.07-.086-.058-.095a.75.75 0 0 1 .15-.88l.087-.07 3.412-2.414-3.154-2.253-.085-.071a.75.75 0 0 1 .862-1.207zM16 0a2 2 0 0 1 2 2v9.354l-.663-.492-.837-.001V2a.5.5 0 0 0-.5-.5H2a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h3.118L7.156 19H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h14zM5.009 15l.003 1H3v-1h2.009zm2.188-2-1.471 1H5v-1h2.197zM10 11v.095L8.668 12H7v-1h3zm4-2v1H7V9h7zm0-2v1H7V7h7zm-4-2v1H5V5h5zM6 3v1H3V3h3z"/></svg>',browseFiles:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.627 16.5zm5.873-.196zm0-7.001V8h-13v8.5h4.341c.191.54.457 1.044.785 1.5H2a1.5 1.5 0 0 1-1.5-1.5v-13A1.5 1.5 0 0 1 2 2h4.5a1.5 1.5 0 0 1 1.06.44L9.122 4H16a1.5 1.5 0 0 1 1.5 1.5v1A1.5 1.5 0 0 1 19 8v2.531a6.027 6.027 0 0 0-1.5-1.228zM16 6.5v-1H8.5l-2-2H2v13h1V8a1.5 1.5 0 0 1 1.5-1.5H16z"/><path d="M14.5 19.5a5 5 0 1 1 0-10 5 5 0 0 1 0 10zM15 14v-2h-1v2h-2v1h2v2h1v-2h2v-1h-2z"/></svg>',heading1:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M19 9v10h-2v-8h-2V9h4zM4 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1H10a1 1 0 0 1-1-1V11H4v4.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1H3a1 1 0 0 1 1 1v4.5z"/></svg>',heading2:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V11H3v4.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1H2a1 1 0 0 1 1 1v4.5zm16.076 8.343V18.5h-6.252c.067-.626.27-1.22.61-1.78.338-.561 1.006-1.305 2.005-2.232.804-.749 1.297-1.257 1.479-1.523.245-.368.368-.732.368-1.092 0-.398-.107-.703-.32-.917-.214-.214-.51-.32-.886-.32-.372 0-.669.111-.889.336-.22.224-.347.596-.38 1.117l-1.778-.178c.106-.982.438-1.686.997-2.114.558-.427 1.257-.64 2.095-.64.918 0 1.64.247 2.164.742.525.495.787 1.11.787 1.847 0 .419-.075.818-.225 1.197-.15.378-.388.775-.714 1.19-.216.275-.605.67-1.168 1.187-.563.516-.92.859-1.07 1.028a3.11 3.11 0 0 0-.365.495h3.542z"/></svg>',heading3:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V11H3v4.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1H2a1 1 0 0 1 1 1v4.5zm9.989 7.53 1.726-.209c.055.44.203.777.445 1.01.24.232.533.349.876.349.368 0 .678-.14.93-.42.251-.279.377-.655.377-1.13 0-.448-.12-.803-.362-1.066a1.153 1.153 0 0 0-.882-.393c-.228 0-.501.044-.819.133l.197-1.453c.482.012.85-.092 1.105-.315.253-.222.38-.517.38-.885 0-.313-.093-.563-.279-.75-.186-.185-.434-.278-.743-.278a1.07 1.07 0 0 0-.78.317c-.216.212-.347.52-.394.927l-1.644-.28c.114-.562.287-1.012.517-1.348.231-.337.553-.601.965-.794a3.24 3.24 0 0 1 1.387-.289c.876 0 1.579.28 2.108.838.436.457.653.973.653 1.549 0 .817-.446 1.468-1.339 1.955.533.114.96.37 1.28.768.319.398.478.878.478 1.441 0 .817-.298 1.513-.895 2.088-.596.576-1.339.864-2.228.864-.842 0-1.54-.243-2.094-.727-.555-.485-.876-1.118-.965-1.901z"/></svg>',heading4:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.5 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V11h-5v4.5a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v4.5zm13.55 10v-1.873h-3.81v-1.561l4.037-5.91h1.498v5.904h1.156v1.567h-1.156V18.5H17.05zm0-3.44v-3.18l-2.14 3.18h2.14z"/></svg>',heading5:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.5 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V11h-5v4.5a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v4.5zm9.578 7.607 1.777-.184c.05.402.201.72.45.955a1.223 1.223 0 0 0 1.81-.101c.258-.303.387-.759.387-1.368 0-.572-.128-1-.384-1.286-.256-.285-.59-.428-1-.428-.512 0-.971.226-1.377.679l-1.448-.21.915-4.843h4.716v1.67H15.56l-.28 1.58a2.697 2.697 0 0 1 1.219-.298 2.68 2.68 0 0 1 2.012.863c.55.576.825 1.323.825 2.241a3.36 3.36 0 0 1-.666 2.05c-.605.821-1.445 1.232-2.52 1.232-.86 0-1.56-.23-2.101-.692-.542-.461-.866-1.081-.971-1.86z"/></svg>',heading6:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.5 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V11h-5v4.5a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v4.5zm15.595 2.973-1.726.19c-.043-.355-.153-.617-.33-.787-.178-.169-.409-.253-.692-.253-.377 0-.695.169-.956.507-.26.339-.424 1.043-.492 2.114.445-.525.997-.787 1.657-.787.745 0 1.383.284 1.914.85.531.568.797 1.3.797 2.197 0 .952-.28 1.716-.838 2.291-.559.576-1.276.864-2.152.864-.94 0-1.712-.365-2.317-1.095-.605-.73-.908-1.927-.908-3.59 0-1.705.316-2.935.946-3.688.63-.753 1.45-1.13 2.457-1.13.706 0 1.291.198 1.755.594.463.395.758.97.885 1.723zm-4.043 3.891c0 .58.133 1.028.4 1.343.266.315.57.473.914.473.33 0 .605-.13.825-.388.22-.258.33-.68.33-1.27 0-.604-.118-1.047-.355-1.329a1.115 1.115 0 0 0-.89-.422c-.342 0-.632.134-.869.403s-.355.666-.355 1.19z"/></svg>',horizontalLine:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 9h16v2H2z"/></svg>',html:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M17 0a2 2 0 0 1 2 2v7a1 1 0 0 1 1 1v5a1 1 0 0 1-.883.993l-.118.006L19 17a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2l-.001-1.001-.116-.006A1 1 0 0 1 0 15v-5a1 1 0 0 1 .999-1L1 2a2 2 0 0 1 2-2h14zm.499 15.999h-15L2.5 17a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5l-.001-1.001zm-3.478-6.013-.014.014H14v.007l-1.525 1.525-1.46-1.46-.015.013V10h-1v5h1v-3.53l1.428 1.43.048.043.131-.129L14 11.421V15h1v-5h-.965l-.014-.014zM2 10H1v5h1v-2h2v2h1v-5H4v2H2v-2zm7 0H6v1h1v4h1v-4h1v-1zm8 0h-1v5h3v-1h-2v-4zm0-8.5H3a.5.5 0 0 0-.5.5l-.001 6.999h15L17.5 2a.5.5 0 0 0-.5-.5zM10 7v1H4V7h6zm3-2v1H4V5h9zm-3-2v1H4V3h6z"/></svg>',indent:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5zM1.632 6.95 5.02 9.358a.4.4 0 0 1-.013.661l-3.39 2.207A.4.4 0 0 1 1 11.892V7.275a.4.4 0 0 1 .632-.326z"/></svg>',outdent:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5zm1.618-9.55L.98 9.358a.4.4 0 0 0 .013.661l3.39 2.207A.4.4 0 0 0 5 11.892V7.275a.4.4 0 0 0-.632-.326z"/></svg>',table:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 5.5v3h4v-3H3Zm0 4v3h4v-3H3Zm0 4v3h4v-3H3Zm5 3h4v-3H8v3Zm5 0h4v-3h-4v3Zm4-4v-3h-4v3h4Zm0-4v-3h-4v3h4Zm1.5 8A1.5 1.5 0 0 1 17 18H3a1.5 1.5 0 0 1-1.5-1.5V3c.222-.863 1.068-1.5 2-1.5h13c.932 0 1.778.637 2 1.5v13.5Zm-6.5-4v-3H8v3h4Zm0-4v-3H8v3h4Z"/></svg>'}},5247:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ClassicEditor:()=>d});var n=i(949),o=i(4133),s=i(5318);class r extends n.Gn{constructor(e,t){super(e),this.view=t,this._toolbarConfig=(0,n.fl)(e.config.get("toolbar")),this._elementReplacer=new s.PZ,this.listenTo(e.editing.view,"scrollToTheSelection",this._handleScrollToTheSelectionWithStickyPanel.bind(this))}get element(){return this.view.element}init(e){const t=this.editor,i=this.view,n=t.editing.view,o=i.editable,s=n.document.getRoot();o.name=s.rootName,i.render();const r=o.element;this.setEditableElement(o.name,r),i.editable.bind("isFocused").to(this.focusTracker),n.attachDomRoot(r),e&&this._elementReplacer.replace(e,this.element),this._initPlaceholder(),this._initToolbar(),i.menuBarView&&this._initMenuBar(i.menuBarView),this._initDialogPluginIntegration(),this.fire("ready")}destroy(){super.destroy();const e=this.view,t=this.editor.editing.view;this._elementReplacer.restore(),t.detachDomRoot(e.editable.name),e.destroy()}_initToolbar(){const e=this.view;e.stickyPanel.bind("isActive").to(this.focusTracker,"isFocused"),e.stickyPanel.limiterElement=e.element,e.stickyPanel.bind("viewportTopOffset").to(this,"viewportOffset",(({top:e})=>e||0)),e.toolbar.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(e.toolbar)}_initPlaceholder(){const e=this.editor,t=e.editing.view,i=t.document.getRoot(),n=e.sourceElement;let s;const r=e.config.get("placeholder");r&&(s="string"==typeof r?r:r[this.view.editable.name]),!s&&n&&"textarea"===n.tagName.toLowerCase()&&(s=n.getAttribute("placeholder")),s&&(i.placeholder=s),(0,o.JT)({view:t,element:i,isDirectHost:!1,keepOnFocus:!0})}_handleScrollToTheSelectionWithStickyPanel(e,t,i){const n=this.view.stickyPanel;if(n.isSticky){const e=new s.rw(n.element).height;t.viewportOffset.top+=e}else{const e=()=>{this.editor.editing.view.scrollToTheSelection(i)};this.listenTo(n,"change:isSticky",e),setTimeout((()=>{this.stopListening(n,"change:isSticky",e)}),20)}}_initDialogPluginIntegration(){if(!this.editor.plugins.has("Dialog"))return;const e=this.view.stickyPanel,t=this.editor.plugins.get("Dialog");t.on("show",(()=>{const i=t.view;i.on("moveTo",((t,o)=>{if(!e.isSticky||i.wasMoved)return;const r=new s.rw(e.contentPanelElement);o[1]<r.bottom+n._m.defaultOffset&&(o[1]=r.bottom+n._m.defaultOffset)}),{priority:"high"})}),{priority:"low"})}}class a extends n.Xt{constructor(e,t,i={}){super(e),this.stickyPanel=new n.xw(e),this.toolbar=new n.X3(e,{shouldGroupWhenFull:i.shouldToolbarGroupWhenFull}),i.useMenuBar&&(this.menuBarView=new n.yJ(e)),this.editable=new n.LU(e,t)}render(){super.render(),this.menuBarView?this.stickyPanel.content.addMany([this.menuBarView,this.toolbar]):this.stickyPanel.content.add(this.toolbar),this.top.add(this.stickyPanel),this.main.add(this.editable)}}var l=i(1204),c=i(1500);class d extends((0,l.mJ)(l.KE)){constructor(e,t={}){if(!u(e)&&void 0!==t.initialData)throw new s.Yb("editor-create-initial-data",null);super(t),this.config.define("menuBar.isVisible",!1),void 0===this.config.get("initialData")&&this.config.set("initialData",function(e){return u(e)?(0,s.pG)(e):e}(e)),u(e)&&(this.sourceElement=e),this.model.document.createRoot();const i=!this.config.get("toolbar.shouldNotGroupWhenFull"),n=this.config.get("menuBar"),o=new a(this.locale,this.editing.view,{shouldToolbarGroupWhenFull:i,useMenuBar:n.isVisible});this.ui=new r(this,o),(0,l.JF)(this)}destroy(){return this.sourceElement&&this.updateSourceElement(),this.ui.destroy(),super.destroy()}static create(e,t={}){return new Promise((i=>{const n=new this(e,t);i(n.initPlugins().then((()=>n.ui.init(u(e)?e:null))).then((()=>n.data.init(n.config.get("initialData")))).then((()=>n.fire("ready"))).then((()=>n)))}))}}function u(e){return(0,c.A)(e)}},151:(e,t,i)=>{"use strict";i.r(t),i.d(t,{AttributeElement:()=>ae,AttributeOperation:()=>fn,BubblingEventInfo:()=>Y,ClickObserver:()=>_o,Conversion:()=>Ji,DataController:()=>Zi,DataTransfer:()=>ct,DocumentFragment:()=>Qn,DocumentSelection:()=>Gt,DomConverter:()=>qe,DomEventData:()=>Ye,DomEventObserver:()=>Xe,DowncastWriter:()=>be,EditingController:()=>Ti,EditingView:()=>ft,Element:()=>yt,FocusObserver:()=>rt,History:()=>Un,HtmlDataProcessor:()=>Gi,InsertOperation:()=>dn,LivePosition:()=>Bn,LiveRange:()=>$t,MarkerOperation:()=>mn,Matcher:()=>y,MergeOperation:()=>hn,Model:()=>wo,MouseObserver:()=>yo,MoveOperation:()=>cn,NoOperation:()=>pn,Observer:()=>Je,OperationFactory:()=>yn,Position:()=>At,Range:()=>St,RenameOperation:()=>bn,Renderer:()=>Le,RootAttributeOperation:()=>wn,RootOperation:()=>vn,SplitOperation:()=>un,StylesMap:()=>O,StylesProcessor:()=>L,TabObserver:()=>mt,Text:()=>vt,TextProxy:()=>_t,TreeWalker:()=>kt,UpcastWriter:()=>ko,ViewAttributeElement:()=>ae,ViewContainerElement:()=>W,ViewDocument:()=>se,ViewDocumentFragment:()=>pe,ViewEditableElement:()=>U,ViewElement:()=>D,ViewEmptyElement:()=>de,ViewRawElement:()=>ge,ViewRootEditableElement:()=>j,ViewText:()=>w,ViewTreeWalker:()=>q,ViewUIElement:()=>he,XmlDataProcessor:()=>Xi,_getModelData:()=>ks,_getViewData:()=>fs,_parseModel:()=>Es,_parseView:()=>ws,_setModelData:()=>Cs,_setViewData:()=>ps,_stringifyModel:()=>As,_stringifyView:()=>bs,addBackgroundRules:()=>Jo,addBorderRules:()=>Qo,addMarginRules:()=>as,addPaddingRules:()=>ls,autoParagraphEmptyRoots:()=>gi,disablePlaceholder:()=>a,enablePlaceholder:()=>r,getBoxSidesShorthandValue:()=>Ko,getBoxSidesValueReducer:()=>qo,getBoxSidesValues:()=>jo,getFillerOffset:()=>H,getPositionShorthandNormalizer:()=>Go,getShorthandValues:()=>Zo,hidePlaceholder:()=>c,isAttachment:()=>Ho,isColor:()=>So,isLength:()=>Mo,isLineStyle:()=>Ro,isParagraphable:()=>fi,isPercentage:()=>Lo,isPosition:()=>zo,isRepeat:()=>No,isURL:()=>$o,needsPlaceholder:()=>d,showPlaceholder:()=>l,transformSets:()=>xn,wrapInParagraph:()=>pi});var n=i(7906);const o=new WeakMap;let s=!1;function r({view:e,element:t,text:i,isDirectHost:r=!0,keepOnFocus:a=!1}){const l=e.document;function c(i){o.get(l).set(t,{text:i,isDirectHost:r,keepOnFocus:a,hostElement:r?t:null}),e.change((e=>u(l,e)))}o.has(l)||(o.set(l,new Map),l.registerPostFixer((e=>u(l,e))),l.on("change:isComposing",(()=>{e.change((e=>u(l,e)))}),{priority:"high"})),t.is("editableElement")&&t.on("change:placeholder",((e,t,i)=>{c(i)})),t.placeholder?c(t.placeholder):i&&c(i),i&&(s||(0,n.logWarning)("enableplaceholder-deprecated-text-option"),s=!0)}function a(e,t){const i=t.document;o.has(i)&&e.change((e=>{const n=o.get(i),s=n.get(t);e.removeAttribute("data-placeholder",s.hostElement),c(e,s.hostElement),n.delete(t)}))}function l(e,t){return!t.hasClass("ck-placeholder")&&(e.addClass("ck-placeholder",t),!0)}function c(e,t){return!!t.hasClass("ck-placeholder")&&(e.removeClass("ck-placeholder",t),!0)}function d(e,t){if(!e.isAttached())return!1;const i=Array.from(e.getChildren()).some((e=>!e.is("uiElement")));if(i)return!1;const n=e.document,o=n.selection.anchor;return!(n.isComposing&&o&&o.parent===e||!t&&n.isFocused&&(!o||o.parent===e))}function u(e,t){const i=o.get(e),n=[];let s=!1;for(const[e,o]of i)o.isDirectHost&&(n.push(e),h(t,e,o)&&(s=!0));for(const[e,o]of i){if(o.isDirectHost)continue;const i=m(e);i&&(n.includes(i)||(o.hostElement=i,h(t,e,o)&&(s=!0)))}return s}function h(e,t,i){const{text:n,isDirectHost:o,hostElement:s}=i;let r=!1;return s.getAttribute("data-placeholder")!==n&&(e.setAttribute("data-placeholder",n,s),r=!0),(o||1==t.childCount)&&d(s,i.keepOnFocus)?l(e,s)&&(r=!0):c(e,s)&&(r=!0),r}function m(e){if(e.childCount){const t=e.getChild(0);if(t.is("element")&&!t.is("uiElement")&&!t.is("attributeElement"))return t}return null}class g{is(){throw new Error("is() method is abstract")}}var f=i(9592);const p=function(e){return(0,f.A)(e,4)};class b extends((0,n.EmitterMixin)(g)){constructor(e){super(),this.document=e,this.parent=null}get index(){let e;if(!this.parent)return null;if(-1==(e=this.parent.getChildIndex(this)))throw new n.CKEditorError("view-node-not-found-in-parent",this);return e}get nextSibling(){const e=this.index;return null!==e&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return null!==e&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.root.is("rootElement")}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.index),t=t.parent;return e}getAncestors(e={}){const t=[];let i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}getCommonAncestor(e,t={}){const i=this.getAncestors(t),n=e.getAncestors(t);let o=0;for(;i[o]==n[o]&&i[o];)o++;return 0===o?null:i[o-1]}isBefore(e){if(this==e)return!1;if(this.root!==e.root)return!1;const t=this.getPath(),i=e.getPath(),o=(0,n.compareArrays)(t,i);switch(o){case"prefix":return!0;case"extension":return!1;default:return t[o]<i[o]}}isAfter(e){return this!=e&&this.root===e.root&&!this.isBefore(e)}_remove(){this.parent._removeChildren(this.index)}_fireChange(e,t){this.fire(`change:${e}`,t),this.parent&&this.parent._fireChange(e,t)}toJSON(){const e=p(this);return delete e.parent,e}}b.prototype.is=function(e){return"node"===e||"view:node"===e};class w extends b{constructor(e,t){super(e),this._textData=t}get data(){return this._textData}get _data(){return this.data}set _data(e){this._fireChange("text",this),this._textData=e}isSimilar(e){return e instanceof w&&(this===e||this.data===e.data)}_clone(){return new w(this.document,this.data)}}w.prototype.is=function(e){return"$text"===e||"view:$text"===e||"text"===e||"view:text"===e||"node"===e||"view:node"===e};class v extends g{constructor(e,t,i){if(super(),this.textNode=e,t<0||t>e.data.length)throw new n.CKEditorError("view-textproxy-wrong-offsetintext",this);if(i<0||t+i>e.data.length)throw new n.CKEditorError("view-textproxy-wrong-length",this);this.data=e.data.substring(t,t+i),this.offsetInText=t}get offsetSize(){return this.data.length}get isPartial(){return this.data.length!==this.textNode.data.length}get parent(){return this.textNode.parent}get root(){return this.textNode.root}get document(){return this.textNode.document}getAncestors(e={}){const t=[];let i=e.includeSelf?this.textNode:this.parent;for(;null!==i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}}v.prototype.is=function(e){return"$textProxy"===e||"view:$textProxy"===e||"textProxy"===e||"view:textProxy"===e};var _=i(4963);class y{constructor(...e){this._patterns=[],this.add(...e)}add(...e){for(let t of e)("string"==typeof t||t instanceof RegExp)&&(t={name:t}),this._patterns.push(t)}match(...e){for(const t of e)for(const e of this._patterns){const i=k(t,e);if(i)return{element:t,pattern:e,match:i}}return null}matchAll(...e){const t=[];for(const i of e)for(const e of this._patterns){const n=k(i,e);n&&t.push({element:i,pattern:e,match:n})}return t.length>0?t:null}getElementName(){if(1!==this._patterns.length)return null;const e=this._patterns[0],t=e.name;return"function"==typeof e||!t||t instanceof RegExp?null:t}}function k(e,t){if("function"==typeof t)return t(e);const i={};return t.name&&(i.name=function(e,t){return e instanceof RegExp?!!t.match(e):e===t}(t.name,e.name),!i.name)||t.attributes&&(i.attributes=function(e,t){const i=new Set(t.getAttributeKeys());return(0,_.A)(e)?(void 0!==e.style&&(0,n.logWarning)("matcher-pattern-deprecated-attributes-style-key",e),void 0!==e.class&&(0,n.logWarning)("matcher-pattern-deprecated-attributes-class-key",e)):(i.delete("style"),i.delete("class")),C(e,i,(e=>t.getAttribute(e)))}(t.attributes,e),!i.attributes)||t.classes&&(i.classes=function(e,t){return C(e,t.getClassNames(),(()=>{}))}(t.classes,e),!i.classes)||t.styles&&(i.styles=function(e,t){return C(e,t.getStyleNames(!0),(e=>t.getStyle(e)))}(t.styles,e),!i.styles)?null:i}function C(e,t,i){const o=function(e){return Array.isArray(e)?e.map((e=>(0,_.A)(e)?(void 0!==e.key&&void 0!==e.value||(0,n.logWarning)("matcher-pattern-missing-key-or-value",e),[e.key,e.value]):[e,!0])):(0,_.A)(e)?Object.entries(e):[[e,!0]]}(e),s=Array.from(t),r=[];if(o.forEach((([e,t])=>{s.forEach((n=>{(function(e,t){return!0===e||e===t||e instanceof RegExp&&t.match(e)})(e,n)&&function(e,t,i){if(!0===e)return!0;const n=i(t);return e===n||e instanceof RegExp&&!!String(n).match(e)}(t,n,i)&&r.push(n)}))})),o.length&&!(r.length<o.length))return r}var A=i(3149),E=i(4878);var x=i(6318),T=i(7688);var P=i(901);const I=function(e,t){return null==(e=function(e,t){return t.length<2?e:(0,x.A)(e,(0,T.A)(t,0,-1))}(e,t=(0,E.A)(t,e)))||delete e[(0,P.A)((i=t,n=null==i?0:i.length,n?i[n-1]:void 0))];var i,n};var S=i(7500),V=i(6248),R=i(2851),B=i(5353);const M=function(e,t,i){return null==e?e:function(e,t,i,n){if(!(0,A.A)(e))return e;for(var o=-1,s=(t=(0,E.A)(t,e)).length,r=s-1,a=e;null!=a&&++o<s;){var l=(0,P.A)(t[o]),c=i;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(o!=r){var d=a[l];void 0===(c=n?n(d,l,a):void 0)&&(c=(0,A.A)(d)?d:(0,B.A)(t[o+1])?[]:{})}(0,R.A)(a,l,c),a=a[l]}return e}(e,t,i)};class O{constructor(e){this._styles={},this._styleProcessor=e}get isEmpty(){return!Object.entries(this._styles).length}get size(){return this.isEmpty?0:this.getStyleNames().length}setTo(e){this.clear();const t=function(e){let t=null,i=0,n=0,o=null;const s=new Map;if(""===e)return s;";"!=e.charAt(e.length-1)&&(e+=";");for(let r=0;r<e.length;r++){const a=e.charAt(r);if(null===t)switch(a){case":":o||(o=e.substr(i,r-i),n=r+1);break;case'"':case"'":t=a;break;case";":{const t=e.substr(n,r-n);o&&s.set(o.trim(),t.trim()),o=null,i=r+1;break}}else a===t&&(t=null)}return s}(e);for(const[e,i]of t)this._styleProcessor.toNormalizedForm(e,i,this._styles)}has(e){if(this.isEmpty)return!1;const t=this._styleProcessor.getReducedForm(e,this._styles).find((([t])=>t===e));return Array.isArray(t)}set(e,t){if((0,A.A)(e))for(const[t,i]of Object.entries(e))this._styleProcessor.toNormalizedForm(t,i,this._styles);else this._styleProcessor.toNormalizedForm(e,t,this._styles)}remove(e){const t=F(e);(function(e,t){null==e||I(e,t)})(this._styles,t),delete this._styles[e],this._cleanEmptyObjectsOnPath(t)}getNormalized(e){return this._styleProcessor.getNormalized(e,this._styles)}toString(){return this.isEmpty?"":this.getStylesEntries().map((e=>e.join(":"))).sort().join(";")+";"}getAsString(e){if(this.isEmpty)return;if(this._styles[e]&&!(0,A.A)(this._styles[e]))return this._styles[e];const t=this._styleProcessor.getReducedForm(e,this._styles).find((([t])=>t===e));return Array.isArray(t)?t[1]:void 0}getStyleNames(e=!1){return this.isEmpty?[]:e?this._styleProcessor.getStyleNames(this._styles):this.getStylesEntries().map((([e])=>e))}clear(){this._styles={}}getStylesEntries(){const e=[],t=Object.keys(this._styles);for(const i of t)e.push(...this._styleProcessor.getReducedForm(i,this._styles));return e}_cleanEmptyObjectsOnPath(e){const t=e.split(".");if(!(t.length>1))return;const i=t.splice(0,t.length-1).join("."),n=(0,S.A)(this._styles,i);n&&!Object.keys(n).length&&this.remove(i)}}class L{constructor(){this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(e,t,i){if((0,A.A)(t))N(i,F(e),t);else if(this._normalizers.has(e)){const n=this._normalizers.get(e),{path:o,value:s}=n(t);N(i,o,s)}else N(i,e,t)}getNormalized(e,t){if(!e)return(0,V.A)({},t);if(void 0!==t[e])return t[e];if(this._extractors.has(e)){const i=this._extractors.get(e);if("string"==typeof i)return(0,S.A)(t,i);const n=i(e,t);if(n)return n}return(0,S.A)(t,F(e))}getReducedForm(e,t){const i=this.getNormalized(e,t);return void 0===i?[]:this._reducers.has(e)?this._reducers.get(e)(i):[[e,i]]}getStyleNames(e){const t=Array.from(this._consumables.keys()).filter((t=>{const i=this.getNormalized(t,e);return i&&"object"==typeof i?Object.keys(i).length:i})),i=new Set([...t,...Object.keys(e)]);return Array.from(i)}getRelatedStyles(e){return this._consumables.get(e)||[]}setNormalizer(e,t){this._normalizers.set(e,t)}setExtractor(e,t){this._extractors.set(e,t)}setReducer(e,t){this._reducers.set(e,t)}setStyleRelation(e,t){this._mapStyleNames(e,t);for(const i of t)this._mapStyleNames(i,[e])}_mapStyleNames(e,t){this._consumables.has(e)||this._consumables.set(e,[]),this._consumables.get(e).push(...t)}}function F(e){return e.replace("-",".")}function N(e,t,i){let n=i;(0,A.A)(i)&&(n=(0,V.A)({},(0,S.A)(e,t),i)),M(e,t,n)}class D extends b{constructor(e,t,i,o){if(super(e),this._unsafeAttributesToRender=[],this._customProperties=new Map,this.name=t,this._attrs=function(e){const t=(0,n.toMap)(e);for(const[e,i]of t)null===i?t.delete(e):"string"!=typeof i&&t.set(e,String(i));return t}(i),this._children=[],o&&this._insertChild(0,o),this._classes=new Set,this._attrs.has("class")){const e=this._attrs.get("class");z(this._classes,e),this._attrs.delete("class")}this._styles=new O(this.document.stylesProcessor),this._attrs.has("style")&&(this._styles.setTo(this._attrs.get("style")),this._attrs.delete("style"))}get childCount(){return this._children.length}get isEmpty(){return 0===this._children.length}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}*getAttributeKeys(){this._classes.size>0&&(yield"class"),this._styles.isEmpty||(yield"style"),yield*this._attrs.keys()}*getAttributes(){yield*this._attrs.entries(),this._classes.size>0&&(yield["class",this.getAttribute("class")]),this._styles.isEmpty||(yield["style",this.getAttribute("style")])}getAttribute(e){if("class"==e)return this._classes.size>0?[...this._classes].join(" "):void 0;if("style"==e){const e=this._styles.toString();return""==e?void 0:e}return this._attrs.get(e)}hasAttribute(e){return"class"==e?this._classes.size>0:"style"==e?!this._styles.isEmpty:this._attrs.has(e)}isSimilar(e){if(!(e instanceof D))return!1;if(this===e)return!0;if(this.name!=e.name)return!1;if(this._attrs.size!==e._attrs.size||this._classes.size!==e._classes.size||this._styles.size!==e._styles.size)return!1;for(const[t,i]of this._attrs)if(!e._attrs.has(t)||e._attrs.get(t)!==i)return!1;for(const t of this._classes)if(!e._classes.has(t))return!1;for(const t of this._styles.getStyleNames())if(!e._styles.has(t)||e._styles.getAsString(t)!==this._styles.getAsString(t))return!1;return!0}hasClass(...e){for(const t of e)if(!this._classes.has(t))return!1;return!0}getClassNames(){return this._classes.keys()}getStyle(e){return this._styles.getAsString(e)}getNormalizedStyle(e){return this._styles.getNormalized(e)}getStyleNames(e){return this._styles.getStyleNames(e)}hasStyle(...e){for(const t of e)if(!this._styles.has(t))return!1;return!0}findAncestor(...e){const t=new y(...e);let i=this.parent;for(;i&&!i.is("documentFragment");){if(t.match(i))return i;i=i.parent}return null}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}getIdentity(){const e=Array.from(this._classes).sort().join(","),t=this._styles.toString(),i=Array.from(this._attrs).map((e=>`${e[0]}="${e[1]}"`)).sort().join(" ");return this.name+(""==e?"":` class="${e}"`)+(t?` style="${t}"`:"")+(""==i?"":` ${i}`)}shouldRenderUnsafeAttribute(e){return this._unsafeAttributesToRender.includes(e)}_clone(e=!1){const t=[];if(e)for(const i of this.getChildren())t.push(i._clone(e));const i=new this.constructor(this.document,this.name,this._attrs,t);return i._classes=new Set(this._classes),i._styles.set(this._styles.getNormalized()),i._customProperties=new Map(this._customProperties),i.getFillerOffset=this.getFillerOffset,i._unsafeAttributesToRender=this._unsafeAttributesToRender,i}_appendChild(e){return this._insertChild(this.childCount,e)}_insertChild(e,t){this._fireChange("children",this);let i=0;const o=function(e,t){return"string"==typeof t?[new w(e,t)]:((0,n.isIterable)(t)||(t=[t]),Array.from(t).map((t=>"string"==typeof t?new w(e,t):t instanceof v?new w(e,t.data):t)))}(this.document,t);for(const t of o)null!==t.parent&&t._remove(),t.parent=this,t.document=this.document,this._children.splice(e,0,t),e++,i++;return i}_removeChildren(e,t=1){this._fireChange("children",this);for(let i=e;i<e+t;i++)this._children[i].parent=null;return this._children.splice(e,t)}_setAttribute(e,t){const i=String(t);this._fireChange("attributes",this),"class"==e?z(this._classes,i):"style"==e?this._styles.setTo(i):this._attrs.set(e,i)}_removeAttribute(e){return this._fireChange("attributes",this),"class"==e?this._classes.size>0&&(this._classes.clear(),!0):"style"==e?!this._styles.isEmpty&&(this._styles.clear(),!0):this._attrs.delete(e)}_addClass(e){this._fireChange("attributes",this);for(const t of(0,n.toArray)(e))this._classes.add(t)}_removeClass(e){this._fireChange("attributes",this);for(const t of(0,n.toArray)(e))this._classes.delete(t)}_setStyle(e,t){this._fireChange("attributes",this),"string"!=typeof e?this._styles.set(e):this._styles.set(e,t)}_removeStyle(e){this._fireChange("attributes",this);for(const t of(0,n.toArray)(e))this._styles.remove(t)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}}function z(e,t){const i=t.split(/\s+/);e.clear(),i.forEach((t=>e.add(t)))}D.prototype.is=function(e,t){return t?t===this.name&&("element"===e||"view:element"===e):"element"===e||"view:element"===e||"node"===e||"view:node"===e};class W extends D{constructor(e,t,i,n){super(e,t,i,n),this.getFillerOffset=H}}function H(){const e=[...this.getChildren()],t=e[this.childCount-1];if(t&&t.is("element","br"))return this.childCount;for(const t of e)if(!t.is("uiElement"))return null;return this.childCount}W.prototype.is=function(e,t){return t?t===this.name&&("containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e):"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e};class U extends((0,n.ObservableMixin)(W)){constructor(e,t,i,n){super(e,t,i,n),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("placeholder",void 0),this.bind("isReadOnly").to(e),this.bind("isFocused").to(e,"isFocused",(t=>t&&e.selection.editableElement==this)),this.listenTo(e.selection,"change",(()=>{this.isFocused=e.isFocused&&e.selection.editableElement==this}))}destroy(){this.stopListening()}}U.prototype.is=function(e,t){return t?t===this.name&&("editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e):"editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e};const $=Symbol("rootName");class j extends U{constructor(e,t){super(e,t),this.rootName="main"}get rootName(){return this.getCustomProperty($)}set rootName(e){this._setCustomProperty($,e)}set _name(e){this.name=e}}j.prototype.is=function(e,t){return t?t===this.name&&("rootElement"===e||"view:rootElement"===e||"editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e):"rootElement"===e||"view:rootElement"===e||"editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e};class q{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new n.CKEditorError("view-tree-walker-no-start-position",null);if(e.direction&&"forward"!=e.direction&&"backward"!=e.direction)throw new n.CKEditorError("view-tree-walker-unknown-direction",e.startPosition,{direction:e.direction});this.boundaries=e.boundaries||null,e.startPosition?this._position=K._createAt(e.startPosition):this._position=K._createAt(e.boundaries["backward"==e.direction?"end":"start"]),this.direction=e.direction||"forward",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null}[Symbol.iterator](){return this}get position(){return this._position}skip(e){let t,i;do{i=this.position,t=this.next()}while(!t.done&&e(t.value));t.done||(this._position=i)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){let e=this.position.clone();const t=this.position,i=e.parent;if(null===i.parent&&e.offset===i.childCount)return{done:!0,value:void 0};if(i===this._boundaryEndParent&&e.offset==this.boundaries.end.offset)return{done:!0,value:void 0};let n;if(i instanceof w){if(e.isAtEnd)return this._position=K._createAfter(i),this._next();n=i.data[e.offset]}else n=i.getChild(e.offset);if(n instanceof D){if(this.shallow){if(this.boundaries&&this.boundaries.end.isBefore(e))return{done:!0,value:void 0};e.offset++}else e=new K(n,0);return this._position=e,this._formatReturnValue("elementStart",n,t,e,1)}if(n instanceof w){if(this.singleCharacters)return e=new K(n,0),this._position=e,this._next();let i,o=n.data.length;return n==this._boundaryEndParent?(o=this.boundaries.end.offset,i=new v(n,0,o),e=K._createAfter(i)):(i=new v(n,0,n.data.length),e.offset++),this._position=e,this._formatReturnValue("text",i,t,e,o)}if("string"==typeof n){let n;n=this.singleCharacters?1:(i===this._boundaryEndParent?this.boundaries.end.offset:i.data.length)-e.offset;const o=new v(i,e.offset,n);return e.offset+=n,this._position=e,this._formatReturnValue("text",o,t,e,n)}return e=K._createAfter(i),this._position=e,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",i,t,e)}_previous(){let e=this.position.clone();const t=this.position,i=e.parent;if(null===i.parent&&0===e.offset)return{done:!0,value:void 0};if(i==this._boundaryStartParent&&e.offset==this.boundaries.start.offset)return{done:!0,value:void 0};let n;if(i instanceof w){if(e.isAtStart)return this._position=K._createBefore(i),this._previous();n=i.data[e.offset-1]}else n=i.getChild(e.offset-1);if(n instanceof D)return this.shallow?(e.offset--,this._position=e,this._formatReturnValue("elementStart",n,t,e,1)):(e=new K(n,n.childCount),this._position=e,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",n,t,e));if(n instanceof w){if(this.singleCharacters)return e=new K(n,n.data.length),this._position=e,this._previous();let i,o=n.data.length;if(n==this._boundaryStartParent){const t=this.boundaries.start.offset;i=new v(n,t,n.data.length-t),o=i.data.length,e=K._createBefore(i)}else i=new v(n,0,n.data.length),e.offset--;return this._position=e,this._formatReturnValue("text",i,t,e,o)}if("string"==typeof n){let n;if(this.singleCharacters)n=1;else{const t=i===this._boundaryStartParent?this.boundaries.start.offset:0;n=e.offset-t}e.offset-=n;const o=new v(i,e.offset,n);return this._position=e,this._formatReturnValue("text",o,t,e,n)}return e=K._createBefore(i),this._position=e,this._formatReturnValue("elementStart",i,t,e,1)}_formatReturnValue(e,t,i,n,o){return t instanceof v&&(t.offsetInText+t.data.length==t.textNode.data.length&&("forward"!=this.direction||this.boundaries&&this.boundaries.end.isEqual(this.position)?i=K._createAfter(t.textNode):(n=K._createAfter(t.textNode),this._position=n)),0===t.offsetInText&&("backward"!=this.direction||this.boundaries&&this.boundaries.start.isEqual(this.position)?i=K._createBefore(t.textNode):(n=K._createBefore(t.textNode),this._position=n))),{done:!1,value:{type:e,item:t,previousPosition:i,nextPosition:n,length:o}}}}class K extends g{constructor(e,t){super(),this.parent=e,this.offset=t}get nodeAfter(){return this.parent.is("$text")?null:this.parent.getChild(this.offset)||null}get nodeBefore(){return this.parent.is("$text")?null:this.parent.getChild(this.offset-1)||null}get isAtStart(){return 0===this.offset}get isAtEnd(){const e=this.parent.is("$text")?this.parent.data.length:this.parent.childCount;return this.offset===e}get root(){return this.parent.root}get editableElement(){let e=this.parent;for(;!(e instanceof U);){if(!e.parent)return null;e=e.parent}return e}getShiftedBy(e){const t=K._createAt(this),i=t.offset+e;return t.offset=i<0?0:i,t}getLastMatchingPosition(e,t={}){t.startPosition=this;const i=new q(t);return i.skip(e),i.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(e){const t=this.getAncestors(),i=e.getAncestors();let n=0;for(;t[n]==i[n]&&t[n];)n++;return 0===n?null:t[n-1]}isEqual(e){return this.parent==e.parent&&this.offset==e.offset}isBefore(e){return"before"==this.compareWith(e)}isAfter(e){return"after"==this.compareWith(e)}compareWith(e){if(this.root!==e.root)return"different";if(this.isEqual(e))return"same";const t=this.parent.is("node")?this.parent.getPath():[],i=e.parent.is("node")?e.parent.getPath():[];t.push(this.offset),i.push(e.offset);const o=(0,n.compareArrays)(t,i);switch(o){case"prefix":return"before";case"extension":return"after";default:return t[o]<i[o]?"before":"after"}}getWalker(e={}){return e.startPosition=this,new q(e)}clone(){return new K(this.parent,this.offset)}static _createAt(e,t){if(e instanceof K)return new this(e.parent,e.offset);{const i=e;if("end"==t)t=i.is("$text")?i.data.length:i.childCount;else{if("before"==t)return this._createBefore(i);if("after"==t)return this._createAfter(i);if(0!==t&&!t)throw new n.CKEditorError("view-createpositionat-offset-required",i)}return new K(i,t)}}static _createAfter(e){if(e.is("$textProxy"))return new K(e.textNode,e.offsetInText+e.data.length);if(!e.parent)throw new n.CKEditorError("view-position-after-root",e,{root:e});return new K(e.parent,e.index+1)}static _createBefore(e){if(e.is("$textProxy"))return new K(e.textNode,e.offsetInText);if(!e.parent)throw new n.CKEditorError("view-position-before-root",e,{root:e});return new K(e.parent,e.index)}}K.prototype.is=function(e){return"position"===e||"view:position"===e};class G extends g{constructor(e,t=null){super(),this.start=e.clone(),this.end=t?t.clone():e.clone()}*[Symbol.iterator](){yield*new q({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return this.start.parent===this.end.parent}get root(){return this.start.root}getEnlarged(){let e=this.start.getLastMatchingPosition(Z,{direction:"backward"}),t=this.end.getLastMatchingPosition(Z);return e.parent.is("$text")&&e.isAtStart&&(e=K._createBefore(e.parent)),t.parent.is("$text")&&t.isAtEnd&&(t=K._createAfter(t.parent)),new G(e,t)}getTrimmed(){let e=this.start.getLastMatchingPosition(Z);if(e.isAfter(this.end)||e.isEqual(this.end))return new G(e,e);let t=this.end.getLastMatchingPosition(Z,{direction:"backward"});const i=e.nodeAfter,n=t.nodeBefore;return i&&i.is("$text")&&(e=new K(i,0)),n&&n.is("$text")&&(t=new K(n,n.data.length)),new G(e,t)}isEqual(e){return this==e||this.start.isEqual(e.start)&&this.end.isEqual(e.end)}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);const i=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),n=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return i&&n}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new G(this.start,e.start)),this.containsPosition(e.end)&&t.push(new G(e.end,this.end))):t.push(this.clone()),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,i=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(i=e.end),new G(t,i)}return null}getWalker(e={}){return e.boundaries=this,new q(e)}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;let e=this.start.nodeAfter,t=this.end.nodeBefore;return this.start.parent.is("$text")&&this.start.isAtEnd&&this.start.parent.nextSibling&&(e=this.start.parent.nextSibling),this.end.parent.is("$text")&&this.end.isAtStart&&this.end.parent.previousSibling&&(t=this.end.parent.previousSibling),e&&e.is("element")&&e===t?e:null}clone(){return new G(this.start,this.end)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new q(e);for(const e of t)yield e.item}*getPositions(e={}){e.boundaries=this;const t=new q(e);yield t.position;for(const e of t)yield e.nextPosition}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}static _createFromParentsAndOffsets(e,t,i,n){return new this(new K(e,t),new K(i,n))}static _createFromPositionAndShift(e,t){const i=e,n=e.getShiftedBy(t);return t>0?new this(i,n):new this(n,i)}static _createIn(e){return this._createFromParentsAndOffsets(e,0,e,e.childCount)}static _createOn(e){const t=e.is("$textProxy")?e.offsetSize:1;return this._createFromPositionAndShift(K._createBefore(e),t)}}function Z(e){return!(!e.item.is("attributeElement")&&!e.item.is("uiElement"))}G.prototype.is=function(e){return"range"===e||"view:range"===e};class J extends((0,n.EmitterMixin)(g)){constructor(...e){super(),this._ranges=[],this._lastRangeBackward=!1,this._isFake=!1,this._fakeSelectionLabel="",e.length&&this.setTo(...e)}get isFake(){return this._isFake}get fakeSelectionLabel(){return this._fakeSelectionLabel}get anchor(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.end:e.start).clone()}get focus(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.start:e.end).clone()}get isCollapsed(){return 1===this.rangeCount&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}get editableElement(){return this.anchor?this.anchor.editableElement:null}*getRanges(){for(const e of this._ranges)yield e.clone()}getFirstRange(){let e=null;for(const t of this._ranges)e&&!t.start.isBefore(e.start)||(e=t);return e?e.clone():null}getLastRange(){let e=null;for(const t of this._ranges)e&&!t.end.isAfter(e.end)||(e=t);return e?e.clone():null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}isEqual(e){if(this.isFake!=e.isFake)return!1;if(this.isFake&&this.fakeSelectionLabel!=e.fakeSelectionLabel)return!1;if(this.rangeCount!=e.rangeCount)return!1;if(0===this.rangeCount)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let i=!1;for(const n of e._ranges)if(t.isEqual(n)){i=!0;break}if(!i)return!1}return!0}isSimilar(e){if(this.isBackward!=e.isBackward)return!1;const t=(0,n.count)(this.getRanges());if(t!=(0,n.count)(e.getRanges()))return!1;if(0==t)return!0;for(let t of this.getRanges()){t=t.getTrimmed();let i=!1;for(let n of e.getRanges())if(n=n.getTrimmed(),t.start.isEqual(n.start)&&t.end.isEqual(n.end)){i=!0;break}if(!i)return!1}return!0}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}setTo(...e){let[t,i,o]=e;if("object"==typeof i&&(o=i,i=void 0),null===t)this._setRanges([]),this._setFakeOptions(o);else if(t instanceof J||t instanceof Q)this._setRanges(t.getRanges(),t.isBackward),this._setFakeOptions({fake:t.isFake,label:t.fakeSelectionLabel});else if(t instanceof G)this._setRanges([t],o&&o.backward),this._setFakeOptions(o);else if(t instanceof K)this._setRanges([new G(t)]),this._setFakeOptions(o);else if(t instanceof b){const e=!!o&&!!o.backward;let s;if(void 0===i)throw new n.CKEditorError("view-selection-setto-required-second-parameter",this);s="in"==i?G._createIn(t):"on"==i?G._createOn(t):new G(K._createAt(t,i)),this._setRanges([s],e),this._setFakeOptions(o)}else{if(!(0,n.isIterable)(t))throw new n.CKEditorError("view-selection-setto-not-selectable",this);this._setRanges(t,o&&o.backward),this._setFakeOptions(o)}this.fire("change")}setFocus(e,t){if(null===this.anchor)throw new n.CKEditorError("view-selection-setfocus-no-ranges",this);const i=K._createAt(e,t);if("same"==i.compareWith(this.focus))return;const o=this.anchor;this._ranges.pop(),"before"==i.compareWith(o)?this._addRange(new G(i,o),!0):this._addRange(new G(o,i)),this.fire("change")}_setRanges(e,t=!1){e=Array.from(e),this._ranges=[];for(const t of e)this._addRange(t);this._lastRangeBackward=!!t}_setFakeOptions(e={}){this._isFake=!!e.fake,this._fakeSelectionLabel=e.fake&&e.label||""}_addRange(e,t=!1){if(!(e instanceof G))throw new n.CKEditorError("view-selection-add-range-not-range",this);this._pushRange(e),this._lastRangeBackward=!!t}_pushRange(e){for(const t of this._ranges)if(e.isIntersecting(t))throw new n.CKEditorError("view-selection-range-intersects",this,{addedRange:e,intersectingRange:t});this._ranges.push(new G(e.start,e.end))}}J.prototype.is=function(e){return"selection"===e||"view:selection"===e};class Q extends((0,n.EmitterMixin)(g)){constructor(...e){super(),this._selection=new J,this._selection.delegate("change").to(this),e.length&&this._selection.setTo(...e)}get isFake(){return this._selection.isFake}get fakeSelectionLabel(){return this._selection.fakeSelectionLabel}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get isCollapsed(){return this._selection.isCollapsed}get rangeCount(){return this._selection.rangeCount}get isBackward(){return this._selection.isBackward}get editableElement(){return this._selection.editableElement}get _ranges(){return this._selection._ranges}*getRanges(){yield*this._selection.getRanges()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getSelectedElement(){return this._selection.getSelectedElement()}isEqual(e){return this._selection.isEqual(e)}isSimilar(e){return this._selection.isSimilar(e)}_setTo(...e){this._selection.setTo(...e)}_setFocus(e,t){this._selection.setFocus(e,t)}}Q.prototype.is=function(e){return"selection"===e||"documentSelection"==e||"view:selection"==e||"view:documentSelection"==e};class Y extends n.EventInfo{constructor(e,t,i){super(e,t),this.startRange=i,this._eventPhase="none",this._currentTarget=null}get eventPhase(){return this._eventPhase}get currentTarget(){return this._currentTarget}}const X=Symbol("bubbling contexts");function ee(e){return class extends e{fire(e,...t){try{const i=e instanceof n.EventInfo?e:new n.EventInfo(this,e),o=oe(this);if(!o.size)return;if(te(i,"capturing",this),ie(o,"$capture",i,...t))return i.return;const s=i.startRange||this.selection.getFirstRange(),r=s?s.getContainedElement():null,a=!!r&&Boolean(ne(o,r));let l=r||function(e){if(!e)return null;const t=e.start.parent,i=e.end.parent,n=t.getPath(),o=i.getPath();return n.length>o.length?t:i}(s);if(te(i,"atTarget",l),!a){if(ie(o,"$text",i,...t))return i.return;te(i,"bubbling",l)}for(;l;){if(l.is("rootElement")){if(ie(o,"$root",i,...t))return i.return}else if(l.is("element")&&ie(o,l.name,i,...t))return i.return;if(ie(o,l,i,...t))return i.return;l=l.parent,te(i,"bubbling",l)}return te(i,"bubbling",this),ie(o,"$document",i,...t),i.return}catch(e){n.CKEditorError.rethrowUnexpectedError(e,this)}}_addEventListener(e,t,i){const o=(0,n.toArray)(i.context||"$document"),s=oe(this);for(const r of o){let o=s.get(r);o||(o=new((0,n.EmitterMixin)()),s.set(r,o)),this.listenTo(o,e,t,i)}}_removeEventListener(e,t){const i=oe(this);for(const n of i.values())this.stopListening(n,e,t)}}}{const e=ee(Object);["fire","_addEventListener","_removeEventListener"].forEach((t=>{ee[t]=e.prototype[t]}))}function te(e,t,i){e instanceof Y&&(e._eventPhase=t,e._currentTarget=i)}function ie(e,t,i,...n){const o="string"==typeof t?e.get(t):ne(e,t);return!!o&&(o.fire(i,...n),i.stop.called)}function ne(e,t){for(const[i,n]of e)if("function"==typeof i&&i(t))return n;return null}function oe(e){return e[X]||(e[X]=new Map),e[X]}class se extends(ee((0,n.ObservableMixin)())){constructor(e){super(),this._postFixers=new Set,this.selection=new Q,this.roots=new n.Collection({idProperty:"rootName"}),this.stylesProcessor=e,this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isSelecting",!1),this.set("isComposing",!1)}getRoot(e="main"){return this.roots.get(e)}registerPostFixer(e){this._postFixers.add(e)}destroy(){this.roots.forEach((e=>e.destroy())),this.stopListening()}_callPostFixers(e){let t=!1;do{for(const i of this._postFixers)if(t=i(e),t)break}while(t)}}class re extends D{constructor(e,t,i,n){super(e,t,i,n),this._priority=10,this._id=null,this._clonesGroup=null,this.getFillerOffset=le}get priority(){return this._priority}get id(){return this._id}getElementsWithSameId(){if(null===this.id)throw new n.CKEditorError("attribute-element-get-elements-with-same-id-no-id",this);return new Set(this._clonesGroup)}isSimilar(e){return null!==this.id||null!==e.id?this.id===e.id:super.isSimilar(e)&&this.priority==e.priority}_clone(e=!1){const t=super._clone(e);return t._priority=this._priority,t._id=this._id,t}}re.DEFAULT_PRIORITY=10;const ae=re;function le(){if(ce(this))return null;let e=this.parent;for(;e&&e.is("attributeElement");){if(ce(e)>1)return null;e=e.parent}return!e||ce(e)>1?null:this.childCount}function ce(e){return Array.from(e.getChildren()).filter((e=>!e.is("uiElement"))).length}re.prototype.is=function(e,t){return t?t===this.name&&("attributeElement"===e||"view:attributeElement"===e||"element"===e||"view:element"===e):"attributeElement"===e||"view:attributeElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e};class de extends D{constructor(e,t,i,n){super(e,t,i,n),this.getFillerOffset=ue}_insertChild(e,t){if(t&&(t instanceof b||Array.from(t).length>0))throw new n.CKEditorError("view-emptyelement-cannot-add",[this,t]);return 0}}function ue(){return null}de.prototype.is=function(e,t){return t?t===this.name&&("emptyElement"===e||"view:emptyElement"===e||"element"===e||"view:element"===e):"emptyElement"===e||"view:emptyElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e};class he extends D{constructor(e,t,i,n){super(e,t,i,n),this.getFillerOffset=me}_insertChild(e,t){if(t&&(t instanceof b||Array.from(t).length>0))throw new n.CKEditorError("view-uielement-cannot-add",[this,t]);return 0}render(e,t){return this.toDomElement(e)}toDomElement(e){const t=e.createElement(this.name);for(const e of this.getAttributeKeys())t.setAttribute(e,this.getAttribute(e));return t}}function me(){return null}he.prototype.is=function(e,t){return t?t===this.name&&("uiElement"===e||"view:uiElement"===e||"element"===e||"view:element"===e):"uiElement"===e||"view:uiElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e};class ge extends D{constructor(e,t,i,n){super(e,t,i,n),this.getFillerOffset=fe}_insertChild(e,t){if(t&&(t instanceof b||Array.from(t).length>0))throw new n.CKEditorError("view-rawelement-cannot-add",[this,t]);return 0}render(e,t){}}function fe(){return null}ge.prototype.is=function(e,t){return t?t===this.name&&("rawElement"===e||"view:rawElement"===e||"element"===e||"view:element"===e):"rawElement"===e||"view:rawElement"===e||e===this.name||e==="view:"+this.name||"element"===e||"view:element"===e||"node"===e||"view:node"===e};class pe extends((0,n.EmitterMixin)(g)){constructor(e,t){super(),this._children=[],this._customProperties=new Map,this.document=e,t&&this._insertChild(0,t)}[Symbol.iterator](){return this._children[Symbol.iterator]()}get childCount(){return this._children.length}get isEmpty(){return 0===this.childCount}get root(){return this}get parent(){return null}get name(){}get getFillerOffset(){}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}_appendChild(e){return this._insertChild(this.childCount,e)}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}_insertChild(e,t){this._fireChange("children",this);let i=0;const o=function(e,t){return"string"==typeof t?[new w(e,t)]:((0,n.isIterable)(t)||(t=[t]),Array.from(t).map((t=>"string"==typeof t?new w(e,t):t instanceof v?new w(e,t.data):t)))}(this.document,t);for(const t of o)null!==t.parent&&t._remove(),t.parent=this,this._children.splice(e,0,t),e++,i++;return i}_removeChildren(e,t=1){this._fireChange("children",this);for(let i=e;i<e+t;i++)this._children[i].parent=null;return this._children.splice(e,t)}_fireChange(e,t){this.fire("change:"+e,t)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}}pe.prototype.is=function(e){return"documentFragment"===e||"view:documentFragment"===e};class be{constructor(e){this._cloneGroups=new Map,this._slotFactory=null,this.document=e}setSelection(...e){this.document.selection._setTo(...e)}setSelectionFocus(e,t){this.document.selection._setFocus(e,t)}createDocumentFragment(e){return new pe(this.document,e)}createText(e){return new w(this.document,e)}createAttributeElement(e,t,i={}){const n=new ae(this.document,e,t);return"number"==typeof i.priority&&(n._priority=i.priority),i.id&&(n._id=i.id),i.renderUnsafeAttributes&&n._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),n}createContainerElement(e,t,i={},n={}){let o=null;(0,_.A)(i)?n=i:o=i;const s=new W(this.document,e,t,o);return n.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),s}createEditableElement(e,t,i={}){const n=new U(this.document,e,t);return i.renderUnsafeAttributes&&n._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),n}createEmptyElement(e,t,i={}){const n=new de(this.document,e,t);return i.renderUnsafeAttributes&&n._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),n}createUIElement(e,t,i){const n=new he(this.document,e,t);return i&&(n.render=i),n}createRawElement(e,t,i,n={}){const o=new ge(this.document,e,t);return i&&(o.render=i),n.renderUnsafeAttributes&&o._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),o}setAttribute(e,t,i){i._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,i){(0,_.A)(e)&&void 0===i?t._setStyle(e):i._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,i){i._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}breakAttributes(e){return e instanceof K?this._breakAttributes(e):this._breakAttributesRange(e)}breakContainer(e){const t=e.parent;if(!t.is("containerElement"))throw new n.CKEditorError("view-writer-break-non-container-element",this.document);if(!t.parent)throw new n.CKEditorError("view-writer-break-root",this.document);if(e.isAtStart)return K._createBefore(t);if(!e.isAtEnd){const i=t._clone(!1);this.insert(K._createAfter(t),i);const n=new G(e,K._createAt(t,"end")),o=new K(i,0);this.move(n,o)}return K._createAfter(t)}mergeAttributes(e){const t=e.offset,i=e.parent;if(i.is("$text"))return e;if(i.is("attributeElement")&&0===i.childCount){const e=i.parent,t=i.index;return i._remove(),this._removeFromClonedElementsGroup(i),this.mergeAttributes(new K(e,t))}const n=i.getChild(t-1),o=i.getChild(t);if(!n||!o)return e;if(n.is("$text")&&o.is("$text"))return ye(n,o);if(n.is("attributeElement")&&o.is("attributeElement")&&n.isSimilar(o)){const e=n.childCount;return n._appendChild(o.getChildren()),o._remove(),this._removeFromClonedElementsGroup(o),this.mergeAttributes(new K(n,e))}return e}mergeContainers(e){const t=e.nodeBefore,i=e.nodeAfter;if(!(t&&i&&t.is("containerElement")&&i.is("containerElement")))throw new n.CKEditorError("view-writer-merge-containers-invalid-position",this.document);const o=t.getChild(t.childCount-1),s=o instanceof w?K._createAt(o,"end"):K._createAt(t,"end");return this.move(G._createIn(i),K._createAt(t,"end")),this.remove(G._createOn(i)),s}insert(e,t){Ce(t=(0,n.isIterable)(t)?[...t]:[t],this.document);const i=t.reduce(((e,t)=>{const i=e[e.length-1],n=!t.is("uiElement");return i&&i.breakAttributes==n?i.nodes.push(t):e.push({breakAttributes:n,nodes:[t]}),e}),[]);let o=null,s=e;for(const{nodes:e,breakAttributes:t}of i){const i=this._insertNodes(s,e,t);o||(o=i.start),s=i.end}return o?new G(o,s):new G(e)}remove(e){const t=e instanceof G?e:G._createOn(e);if(Ee(t,this.document),t.isCollapsed)return new pe(this.document);const{start:i,end:n}=this._breakAttributesRange(t,!0),o=i.parent,s=n.offset-i.offset,r=o._removeChildren(i.offset,s);for(const e of r)this._removeFromClonedElementsGroup(e);const a=this.mergeAttributes(i);return t.start=a,t.end=a.clone(),new pe(this.document,r)}clear(e,t){Ee(e,this.document);const i=e.getWalker({direction:"backward",ignoreElementEnd:!0});for(const n of i){const i=n.item;let o;if(i.is("element")&&t.isSimilar(i))o=G._createOn(i);else if(!n.nextPosition.isAfter(e.start)&&i.is("$textProxy")){const e=i.getAncestors().find((e=>e.is("element")&&t.isSimilar(e)));e&&(o=G._createIn(e))}o&&(o.end.isAfter(e.end)&&(o.end=e.end),o.start.isBefore(e.start)&&(o.start=e.start),this.remove(o))}}move(e,t){let i;if(t.isAfter(e.end)){const n=(t=this._breakAttributes(t,!0)).parent,o=n.childCount;e=this._breakAttributesRange(e,!0),i=this.remove(e),t.offset+=n.childCount-o}else i=this.remove(e);return this.insert(t,i)}wrap(e,t){if(!(t instanceof ae))throw new n.CKEditorError("view-writer-wrap-invalid-attribute",this.document);if(Ee(e,this.document),e.isCollapsed){let n=e.start;n.parent.is("element")&&(i=n.parent,!Array.from(i.getChildren()).some((e=>!e.is("uiElement"))))&&(n=n.getLastMatchingPosition((e=>e.item.is("uiElement")))),n=this._wrapPosition(n,t);const o=this.document.selection;return o.isCollapsed&&o.getFirstPosition().isEqual(e.start)&&this.setSelection(n),new G(n)}return this._wrapRange(e,t);var i}unwrap(e,t){if(!(t instanceof ae))throw new n.CKEditorError("view-writer-unwrap-invalid-attribute",this.document);if(Ee(e,this.document),e.isCollapsed)return e;const{start:i,end:o}=this._breakAttributesRange(e,!0),s=i.parent,r=this._unwrapChildren(s,i.offset,o.offset,t),a=this.mergeAttributes(r.start);a.isEqual(r.start)||r.end.offset--;const l=this.mergeAttributes(r.end);return new G(a,l)}rename(e,t){const i=new W(this.document,e,t.getAttributes());return this.insert(K._createAfter(t),i),this.move(G._createIn(t),K._createAt(i,0)),this.remove(G._createOn(t)),i}clearClonedElementsGroup(e){this._cloneGroups.delete(e)}createPositionAt(e,t){return K._createAt(e,t)}createPositionAfter(e){return K._createAfter(e)}createPositionBefore(e){return K._createBefore(e)}createRange(e,t){return new G(e,t)}createRangeOn(e){return G._createOn(e)}createRangeIn(e){return G._createIn(e)}createSelection(...e){return new J(...e)}createSlot(e="children"){if(!this._slotFactory)throw new n.CKEditorError("view-writer-invalid-create-slot-context",this.document);return this._slotFactory(this,e)}_registerSlotFactory(e){this._slotFactory=e}_clearSlotFactory(){this._slotFactory=null}_insertNodes(e,t,i){let o,s;if(o=i?we(e):e.parent.is("$text")?e.parent.parent:e.parent,!o)throw new n.CKEditorError("view-writer-invalid-position-container",this.document);s=i?this._breakAttributes(e,!0):e.parent.is("$text")?_e(e):e;const r=o._insertChild(s.offset,t);for(const e of t)this._addToClonedElementsGroup(e);const a=s.getShiftedBy(r),l=this.mergeAttributes(s);l.isEqual(s)||a.offset--;const c=this.mergeAttributes(a);return new G(l,c)}_wrapChildren(e,t,i,n){let o=t;const s=[];for(;o<i;){const t=e.getChild(o),i=t.is("$text"),l=t.is("attributeElement");if(l&&this._wrapAttributeElement(n,t))s.push(new K(e,o));else if(i||!l||(a=t,(r=n).priority<a.priority||!(r.priority>a.priority)&&r.getIdentity()<a.getIdentity())){const i=n._clone();t._remove(),i._appendChild(t),e._insertChild(o,i),this._addToClonedElementsGroup(i),s.push(new K(e,o))}else this._wrapChildren(t,0,t.childCount,n);o++}var r,a;let l=0;for(const e of s)e.offset-=l,e.offset!=t&&(this.mergeAttributes(e).isEqual(e)||(l++,i--));return G._createFromParentsAndOffsets(e,t,e,i)}_unwrapChildren(e,t,i,n){let o=t;const s=[];for(;o<i;){const t=e.getChild(o);if(t.is("attributeElement"))if(t.isSimilar(n)){const n=t.getChildren(),r=t.childCount;t._remove(),e._insertChild(o,n),this._removeFromClonedElementsGroup(t),s.push(new K(e,o),new K(e,o+r)),o+=r,i+=r-1}else this._unwrapAttributeElement(n,t)?(s.push(new K(e,o),new K(e,o+1)),o++):(this._unwrapChildren(t,0,t.childCount,n),o++);else o++}let r=0;for(const e of s)e.offset-=r,e.offset!=t&&e.offset!=i&&(this.mergeAttributes(e).isEqual(e)||(r++,i--));return G._createFromParentsAndOffsets(e,t,e,i)}_wrapRange(e,t){const{start:i,end:n}=this._breakAttributesRange(e,!0),o=i.parent,s=this._wrapChildren(o,i.offset,n.offset,t),r=this.mergeAttributes(s.start);r.isEqual(s.start)||s.end.offset--;const a=this.mergeAttributes(s.end);return new G(r,a)}_wrapPosition(e,t){if(t.isSimilar(e.parent))return ve(e.clone());e.parent.is("$text")&&(e=_e(e));const i=this.createAttributeElement("_wrapPosition-fake-element");i._priority=Number.POSITIVE_INFINITY,i.isSimilar=()=>!1,e.parent._insertChild(e.offset,i);const n=new G(e,e.getShiftedBy(1));this.wrap(n,t);const o=new K(i.parent,i.index);i._remove();const s=o.nodeBefore,r=o.nodeAfter;return s instanceof w&&r instanceof w?ye(s,r):ve(o)}_wrapAttributeElement(e,t){if(!xe(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const i of e.getAttributeKeys())if("class"!==i&&"style"!==i&&t.hasAttribute(i)&&t.getAttribute(i)!==e.getAttribute(i))return!1;for(const i of e.getStyleNames())if(t.hasStyle(i)&&t.getStyle(i)!==e.getStyle(i))return!1;for(const i of e.getAttributeKeys())"class"!==i&&"style"!==i&&(t.hasAttribute(i)||this.setAttribute(i,e.getAttribute(i),t));for(const i of e.getStyleNames())t.hasStyle(i)||this.setStyle(i,e.getStyle(i),t);for(const i of e.getClassNames())t.hasClass(i)||this.addClass(i,t);return!0}_unwrapAttributeElement(e,t){if(!xe(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const i of e.getAttributeKeys())if("class"!==i&&"style"!==i&&(!t.hasAttribute(i)||t.getAttribute(i)!==e.getAttribute(i)))return!1;if(!t.hasClass(...e.getClassNames()))return!1;for(const i of e.getStyleNames())if(!t.hasStyle(i)||t.getStyle(i)!==e.getStyle(i))return!1;for(const i of e.getAttributeKeys())"class"!==i&&"style"!==i&&this.removeAttribute(i,t);return this.removeClass(Array.from(e.getClassNames()),t),this.removeStyle(Array.from(e.getStyleNames()),t),!0}_breakAttributesRange(e,t=!1){const i=e.start,n=e.end;if(Ee(e,this.document),e.isCollapsed){const i=this._breakAttributes(e.start,t);return new G(i,i)}const o=this._breakAttributes(n,t),s=o.parent.childCount,r=this._breakAttributes(i,t);return o.offset+=o.parent.childCount-s,new G(r,o)}_breakAttributes(e,t=!1){const i=e.offset,o=e.parent;if(e.parent.is("emptyElement"))throw new n.CKEditorError("view-writer-cannot-break-empty-element",this.document);if(e.parent.is("uiElement"))throw new n.CKEditorError("view-writer-cannot-break-ui-element",this.document);if(e.parent.is("rawElement"))throw new n.CKEditorError("view-writer-cannot-break-raw-element",this.document);if(!t&&o.is("$text")&&Ae(o.parent))return e.clone();if(Ae(o))return e.clone();if(o.is("$text"))return this._breakAttributes(_e(e),t);if(i==o.childCount){const e=new K(o.parent,o.index+1);return this._breakAttributes(e,t)}if(0===i){const e=new K(o.parent,o.index);return this._breakAttributes(e,t)}{const e=o.index+1,n=o._clone();o.parent._insertChild(e,n),this._addToClonedElementsGroup(n);const s=o.childCount-i,r=o._removeChildren(i,s);n._appendChild(r);const a=new K(o.parent,e);return this._breakAttributes(a,t)}}_addToClonedElementsGroup(e){if(!e.root.is("rootElement"))return;if(e.is("element"))for(const t of e.getChildren())this._addToClonedElementsGroup(t);const t=e.id;if(!t)return;let i=this._cloneGroups.get(t);i||(i=new Set,this._cloneGroups.set(t,i)),i.add(e),e._clonesGroup=i}_removeFromClonedElementsGroup(e){if(e.is("element"))for(const t of e.getChildren())this._removeFromClonedElementsGroup(t);const t=e.id;if(!t)return;const i=this._cloneGroups.get(t);i&&i.delete(e)}}function we(e){let t=e.parent;for(;!Ae(t);){if(!t)return;t=t.parent}return t}function ve(e){const t=e.nodeBefore;if(t&&t.is("$text"))return new K(t,t.data.length);const i=e.nodeAfter;return i&&i.is("$text")?new K(i,0):e}function _e(e){if(e.offset==e.parent.data.length)return new K(e.parent.parent,e.parent.index+1);if(0===e.offset)return new K(e.parent.parent,e.parent.index);const t=e.parent.data.slice(e.offset);return e.parent._data=e.parent.data.slice(0,e.offset),e.parent.parent._insertChild(e.parent.index+1,new w(e.root.document,t)),new K(e.parent.parent,e.parent.index+1)}function ye(e,t){const i=e.data.length;return e._data+=t.data,t._remove(),new K(e,i)}const ke=[w,ae,W,de,ge,he];function Ce(e,t){for(const i of e){if(!ke.some((e=>i instanceof e)))throw new n.CKEditorError("view-writer-insert-invalid-node-type",t);i.is("$text")||Ce(i.getChildren(),t)}}function Ae(e){return e&&(e.is("containerElement")||e.is("documentFragment"))}function Ee(e,t){const i=we(e.start),o=we(e.end);if(!i||!o||i!==o)throw new n.CKEditorError("view-writer-invalid-range-container",t)}function xe(e,t){return null===e.id&&null===t.id}const Te=e=>e.createTextNode(" "),Pe=e=>{const t=e.createElement("span");return t.dataset.ckeFiller="true",t.innerText=" ",t},Ie=e=>{const t=e.createElement("br");return t.dataset.ckeFiller="true",t},Se=7,Ve="⁠".repeat(Se);function Re(e){return"string"==typeof e?e.substr(0,Se)===Ve:(0,n.isText)(e)&&e.data.substr(0,Se)===Ve}function Be(e){return e.data.length==Se&&Re(e)}function Me(e){const t="string"==typeof e?e:e.data;return Re(e)?t.slice(Se):t}function Oe(e,t){if(t.keyCode==n.keyCodes.arrowleft){const e=t.domTarget.ownerDocument.defaultView.getSelection();if(1==e.rangeCount&&e.getRangeAt(0).collapsed){const t=e.getRangeAt(0).startContainer,i=e.getRangeAt(0).startOffset;Re(t)&&i<=Se&&e.collapse(t,0)}}}class Le extends((0,n.ObservableMixin)()){constructor(e,t){super(),this.domDocuments=new Set,this.markedAttributes=new Set,this.markedChildren=new Set,this.markedTexts=new Set,this._inlineFiller=null,this._fakeSelectionContainer=null,this.domConverter=e,this.selection=t,this.set("isFocused",!1),this.set("isSelecting",!1),this.set("isComposing",!1),n.env.isBlink&&!n.env.isAndroid&&this.on("change:isSelecting",(()=>{this.isSelecting||this.render()}))}markToSync(e,t){if("text"===e)this.domConverter.mapViewToDom(t.parent)&&this.markedTexts.add(t);else{if(!this.domConverter.mapViewToDom(t))return;if("attributes"===e)this.markedAttributes.add(t);else{if("children"!==e)throw new n.CKEditorError("view-renderer-unknown-type",this);this.markedChildren.add(t)}}}render(){if(this.isComposing&&!n.env.isAndroid)return;let e=null;const t=!(n.env.isBlink&&!n.env.isAndroid&&this.isSelecting);for(const e of this.markedChildren)this._updateChildrenMappings(e);t?(this._inlineFiller&&!this._isSelectionInInlineFiller()&&this._removeInlineFiller(),this._inlineFiller?e=this._getInlineFillerPosition():this._needsInlineFillerAtSelection()&&(e=this.selection.getFirstPosition(),this.markedChildren.add(e.parent))):this._inlineFiller&&this._inlineFiller.parentNode&&(e=this.domConverter.domPositionToView(this._inlineFiller),e&&e.parent.is("$text")&&(e=K._createBefore(e.parent)));for(const e of this.markedAttributes)this._updateAttrs(e);for(const t of this.markedChildren)this._updateChildren(t,{inlineFillerPosition:e});for(const t of this.markedTexts)!this.markedChildren.has(t.parent)&&this.domConverter.mapViewToDom(t.parent)&&this._updateText(t,{inlineFillerPosition:e});if(t)if(e){const t=this.domConverter.viewPositionToDom(e),i=t.parent.ownerDocument;Re(t.parent)?this._inlineFiller=t.parent:this._inlineFiller=Fe(i,t.parent,t.offset)}else this._inlineFiller=null;this._updateFocus(),this._updateSelection(),this.domConverter._clearTemporaryCustomProperties(),this.markedTexts.clear(),this.markedAttributes.clear(),this.markedChildren.clear()}_updateChildrenMappings(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const i=Array.from(t.childNodes),o=Array.from(this.domConverter.viewChildrenToDom(e,{withChildren:!1})),s=this._diffNodeLists(i,o),r=this._findUpdateActions(s,i,o,Ne);if(-1!==r.indexOf("update")){const t={equal:0,insert:0,delete:0};for(const s of r)if("update"===s){const s=t.equal+t.insert,r=t.equal+t.delete,a=e.getChild(s);!a||a.is("uiElement")||a.is("rawElement")||this._updateElementMappings(a,i[r]),(0,n.remove)(o[s]),t.equal++}else t[s]++}}_updateElementMappings(e,t){this.domConverter.unbindDomElement(t),this.domConverter.bindElements(t,e),this.markedChildren.add(e),this.markedAttributes.add(e)}_getInlineFillerPosition(){const e=this.selection.getFirstPosition();return e.parent.is("$text")?K._createBefore(e.parent):e}_isSelectionInInlineFiller(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=this.domConverter.viewPositionToDom(e);return!!(t&&(0,n.isText)(t.parent)&&Re(t.parent))}_removeInlineFiller(){const e=this._inlineFiller;if(!Re(e))throw new n.CKEditorError("view-renderer-filler-was-lost",this);Be(e)?e.remove():e.data=e.data.substr(Se),this._inlineFiller=null}_needsInlineFillerAtSelection(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=e.parent,i=e.offset;if(!this.domConverter.mapViewToDom(t.root))return!1;if(!t.is("element"))return!1;if(!function(e){if("false"==e.getAttribute("contenteditable"))return!1;const t=e.findAncestor((e=>e.hasAttribute("contenteditable")));return!t||"true"==t.getAttribute("contenteditable")}(t))return!1;const o=e.nodeBefore,s=e.nodeAfter;return!(o instanceof w||s instanceof w||!(i!==t.getFillerOffset()||o&&o.is("element","br"))||n.env.isAndroid&&(o||s))}_updateText(e,t){const i=this.domConverter.findCorrespondingDomText(e);let n=this.domConverter.viewToDom(e).data;const o=t.inlineFillerPosition;o&&o.parent==e.parent&&o.offset==e.index&&(n=Ve+n),this._updateTextNode(i,n)}_updateAttrs(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const i=Array.from(t.attributes).map((e=>e.name)),n=e.getAttributeKeys();for(const i of n)this.domConverter.setDomElementAttribute(t,i,e.getAttribute(i),e);for(const n of i)e.hasAttribute(n)||this.domConverter.removeDomElementAttribute(t,n)}_updateChildren(e,t){const i=this.domConverter.mapViewToDom(e);if(!i)return;if(n.env.isAndroid){let e=null;for(const t of Array.from(i.childNodes)){if(e&&(0,n.isText)(e)&&(0,n.isText)(t)){i.normalize();break}e=t}}const o=t.inlineFillerPosition,s=i.childNodes,r=Array.from(this.domConverter.viewChildrenToDom(e,{bind:!0}));o&&o.parent===e&&Fe(i.ownerDocument,r,o.offset);const a=this._diffNodeLists(s,r),l=this._findUpdateActions(a,s,r,De);let c=0;const d=new Set;for(const e of l)"delete"===e?(d.add(s[c]),(0,n.remove)(s[c])):"equal"!==e&&"update"!==e||c++;c=0;for(const e of l)"insert"===e?((0,n.insertAt)(i,c,r[c]),c++):"update"===e?(this._updateTextNode(s[c],r[c].data),c++):"equal"===e&&(this._markDescendantTextToSync(this.domConverter.domToView(r[c])),c++);for(const e of d)e.parentNode||this.domConverter.unbindDomElement(e)}_diffNodeLists(e,t){return e=function(e,t){const i=Array.from(e);if(0==i.length||!t)return i;return i[i.length-1]==t&&i.pop(),i}(e,this._fakeSelectionContainer),(0,n.diff)(e,t,ze.bind(null,this.domConverter))}_findUpdateActions(e,t,i,o){if(-1===e.indexOf("insert")||-1===e.indexOf("delete"))return e;let s=[],r=[],a=[];const l={equal:0,insert:0,delete:0};for(const c of e)"insert"===c?a.push(i[l.equal+l.insert]):"delete"===c?r.push(t[l.equal+l.delete]):(s=s.concat((0,n.diff)(r,a,o).map((e=>"equal"===e?"update":e))),s.push("equal"),r=[],a=[]),l[c]++;return s.concat((0,n.diff)(r,a,o).map((e=>"equal"===e?"update":e)))}_updateTextNode(e,t){const i=e.data;i!=t&&(n.env.isAndroid&&this.isComposing&&i.replace(/\u00A0/g," ")==t.replace(/\u00A0/g," ")||this._updateTextNodeInternal(e,t))}_updateTextNodeInternal(e,t){const i=(0,n.fastDiff)(e.data,t);for(const t of i)"insert"===t.type?e.insertData(t.index,t.values.join("")):e.deleteData(t.index,t.howMany)}_markDescendantTextToSync(e){if(e)if(e.is("$text"))this.markedTexts.add(e);else if(e.is("element"))for(const t of e.getChildren())this._markDescendantTextToSync(t)}_updateSelection(){if(n.env.isBlink&&!n.env.isAndroid&&this.isSelecting&&!this.markedChildren.size)return;if(0===this.selection.rangeCount)return this._removeDomSelection(),void this._removeFakeSelection();const e=this.domConverter.mapViewToDom(this.selection.editableElement);this.isFocused&&e&&(this.selection.isFake?this._updateFakeSelection(e):this._fakeSelectionContainer&&this._fakeSelectionContainer.isConnected?(this._removeFakeSelection(),this._updateDomSelection(e)):this.isComposing&&n.env.isAndroid||this._updateDomSelection(e))}_updateFakeSelection(e){const t=e.ownerDocument;this._fakeSelectionContainer||(this._fakeSelectionContainer=function(e){const t=e.createElement("div");return t.className="ck-fake-selection-container",Object.assign(t.style,{position:"fixed",top:0,left:"-9999px",width:"42px"}),t.textContent=" ",t}(t));const i=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(i,this.selection),!this._fakeSelectionNeedsUpdate(e))return;i.parentElement&&i.parentElement==e||e.appendChild(i),i.textContent=this.selection.fakeSelectionLabel||" ";const n=t.getSelection(),o=t.createRange();n.removeAllRanges(),o.selectNodeContents(i),n.addRange(o)}_updateDomSelection(e){const t=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(t))return;const i=this.domConverter.viewPositionToDom(this.selection.anchor),o=this.domConverter.viewPositionToDom(this.selection.focus);t.setBaseAndExtent(i.parent,i.offset,o.parent,o.offset),n.env.isGecko&&function(e,t){let i=e.parent,o=e.offset;if((0,n.isText)(i)&&Be(i)&&(o=(0,n.indexOf)(i)+1,i=i.parentNode),i.nodeType!=Node.ELEMENT_NODE||o!=i.childNodes.length-1)return;const s=i.childNodes[o];s&&"BR"==s.tagName&&t.addRange(t.getRangeAt(0))}(o,t)}_domSelectionNeedsUpdate(e){if(!this.domConverter.isDomSelectionCorrect(e))return!0;const t=e&&this.domConverter.domSelectionToView(e);return!(t&&this.selection.isEqual(t)||!this.selection.isCollapsed&&this.selection.isSimilar(t))}_fakeSelectionNeedsUpdate(e){const t=this._fakeSelectionContainer,i=e.ownerDocument.getSelection();return!t||t.parentElement!==e||i.anchorNode!==t&&!t.contains(i.anchorNode)||t.textContent!==this.selection.fakeSelectionLabel}_removeDomSelection(){for(const e of this.domDocuments){const t=e.getSelection();if(t.rangeCount){const i=e.activeElement,n=this.domConverter.mapDomToView(i);i&&n&&t.removeAllRanges()}}}_removeFakeSelection(){const e=this._fakeSelectionContainer;e&&e.remove()}_updateFocus(){if(this.isFocused){const e=this.selection.editableElement;e&&this.domConverter.focus(e)}}}function Fe(e,t,i){const o=t instanceof Array?t:t.childNodes,s=o[i];if((0,n.isText)(s))return s.data=Ve+s.data,s;{const s=e.createTextNode(Ve);return Array.isArray(t)?o.splice(i,0,s):(0,n.insertAt)(t,i,s),s}}function Ne(e,t){return(0,n.isNode)(e)&&(0,n.isNode)(t)&&!(0,n.isText)(e)&&!(0,n.isText)(t)&&!(0,n.isComment)(e)&&!(0,n.isComment)(t)&&e.tagName.toLowerCase()===t.tagName.toLowerCase()}function De(e,t){return(0,n.isNode)(e)&&(0,n.isNode)(t)&&(0,n.isText)(e)&&(0,n.isText)(t)}function ze(e,t,i){return t===i||((0,n.isText)(t)&&(0,n.isText)(i)?t.data===i.data:!(!e.isBlockFiller(t)||!e.isBlockFiller(i)))}const We=Ie(n.global.document),He=Te(n.global.document),Ue=Pe(n.global.document),$e="data-ck-unsafe-attribute-",je="data-ck-unsafe-element";class qe{constructor(e,{blockFillerMode:t,renderingMode:i="editing"}={}){this._domToViewMapping=new WeakMap,this._viewToDomMapping=new WeakMap,this._fakeSelectionMapping=new WeakMap,this._rawContentElementMatcher=new y,this._inlineObjectElementMatcher=new y,this._elementsWithTemporaryCustomProperties=new Set,this.document=e,this.renderingMode=i,this.blockFillerMode=t||("editing"===i?"br":"nbsp"),this.preElements=["pre"],this.blockElements=["address","article","aside","blockquote","caption","center","dd","details","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","legend","li","main","menu","nav","ol","p","pre","section","summary","table","tbody","td","tfoot","th","thead","tr","ul"],this.inlineObjectElements=["object","iframe","input","button","textarea","select","option","video","embed","audio","img","canvas"],this.unsafeElements=["script","style"],this._domDocument="editing"===this.renderingMode?n.global.document:n.global.document.implementation.createHTMLDocument("")}bindFakeSelection(e,t){this._fakeSelectionMapping.set(e,new J(t))}fakeSelectionToView(e){return this._fakeSelectionMapping.get(e)}bindElements(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}unbindDomElement(e){const t=this._domToViewMapping.get(e);if(t){this._domToViewMapping.delete(e),this._viewToDomMapping.delete(t);for(const t of Array.from(e.children))this.unbindDomElement(t)}}bindDocumentFragments(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}shouldRenderAttribute(e,t,i){return"data"===this.renderingMode||!(e=e.toLowerCase()).startsWith("on")&&("srcdoc"!==e||!t.match(/\bon\S+\s*=|javascript:|<\s*\/*script/i))&&("img"===i&&("src"===e||"srcset"===e)||"source"===i&&"srcset"===e||!t.match(/^\s*(javascript:|data:(image\/svg|text\/x?html))/i))}setContentOf(e,t){if("data"===this.renderingMode)return void(e.innerHTML=t);const i=(new DOMParser).parseFromString(t,"text/html"),n=i.createDocumentFragment(),o=i.body.childNodes;for(;o.length>0;)n.appendChild(o[0]);const s=i.createTreeWalker(n,NodeFilter.SHOW_ELEMENT),r=[];let a;for(;a=s.nextNode();)r.push(a);for(const e of r){for(const t of e.getAttributeNames())this.setDomElementAttribute(e,t,e.getAttribute(t));const t=e.tagName.toLowerCase();this._shouldRenameElement(t)&&(Ze(t),e.replaceWith(this._createReplacementDomElement(t,e)))}for(;e.firstChild;)e.firstChild.remove();e.append(n)}viewToDom(e,t={}){if(e.is("$text")){const t=this._processDataFromViewText(e);return this._domDocument.createTextNode(t)}{const i=e;if(this.mapViewToDom(i)){if(!i.getCustomProperty("editingPipeline:doNotReuseOnce"))return this.mapViewToDom(i);this._elementsWithTemporaryCustomProperties.add(i)}let n;if(i.is("documentFragment"))n=this._domDocument.createDocumentFragment(),t.bind&&this.bindDocumentFragments(n,i);else{if(i.is("uiElement"))return n="$comment"===i.name?this._domDocument.createComment(i.getCustomProperty("$rawContent")):i.render(this._domDocument,this),t.bind&&this.bindElements(n,i),n;this._shouldRenameElement(i.name)?(Ze(i.name),n=this._createReplacementDomElement(i.name)):n=i.hasAttribute("xmlns")?this._domDocument.createElementNS(i.getAttribute("xmlns"),i.name):this._domDocument.createElement(i.name),i.is("rawElement")&&i.render(n,this),t.bind&&this.bindElements(n,i);for(const e of i.getAttributeKeys())this.setDomElementAttribute(n,e,i.getAttribute(e),i)}if(!1!==t.withChildren)for(const e of this.viewChildrenToDom(i,t))n instanceof HTMLTemplateElement?n.content.appendChild(e):n.appendChild(e);return n}}setDomElementAttribute(e,t,i,o){const s=this.shouldRenderAttribute(t,i,e.tagName.toLowerCase())||o&&o.shouldRenderUnsafeAttribute(t);s||(0,n.logWarning)("domconverter-unsafe-attribute-detected",{domElement:e,key:t,value:i}),(0,n.isValidAttributeName)(t)?(e.hasAttribute(t)&&!s?e.removeAttribute(t):e.hasAttribute($e+t)&&s&&e.removeAttribute($e+t),e.setAttribute(s?t:$e+t,i)):(0,n.logWarning)("domconverter-invalid-attribute-detected",{domElement:e,key:t,value:i})}removeDomElementAttribute(e,t){t!=je&&(e.removeAttribute(t),e.removeAttribute($e+t))}*viewChildrenToDom(e,t={}){const i=e.getFillerOffset&&e.getFillerOffset();let o=0;for(const s of e.getChildren()){i===o&&(yield this._getBlockFiller());const e=s.is("element")&&!!s.getCustomProperty("dataPipeline:transparentRendering")&&!(0,n.first)(s.getAttributes());if(e&&"data"==this.renderingMode)if(s.is("rawElement")){const e=this._domDocument.createElement(s.name);s.render(e,this),yield*[...e.childNodes]}else yield*this.viewChildrenToDom(s,t);else e&&(0,n.logWarning)("domconverter-transparent-rendering-unsupported-in-editing-pipeline",{viewElement:s}),yield this.viewToDom(s,t);o++}i===o&&(yield this._getBlockFiller())}viewRangeToDom(e){const t=this.viewPositionToDom(e.start),i=this.viewPositionToDom(e.end),n=this._domDocument.createRange();return n.setStart(t.parent,t.offset),n.setEnd(i.parent,i.offset),n}viewPositionToDom(e){const t=e.parent;if(t.is("$text")){const i=this.findCorrespondingDomText(t);if(!i)return null;let n=e.offset;return Re(i)&&(n+=Se),{parent:i,offset:n}}{let i,o,s;if(0===e.offset){if(i=this.mapViewToDom(t),!i)return null;s=i.childNodes[0]}else{const t=e.nodeBefore;if(o=t.is("$text")?this.findCorrespondingDomText(t):this.mapViewToDom(t),!o)return null;i=o.parentNode,s=o.nextSibling}return(0,n.isText)(s)&&Re(s)?{parent:s,offset:Se}:{parent:i,offset:o?(0,n.indexOf)(o)+1:0}}}domToView(e,t={}){const i=[],n=this._domToView(e,t,i),o=n.next().value;return o?(n.next(),this._processDomInlineNodes(null,i,t),o.is("$text")&&0==o.data.length?null:o):null}*domChildrenToView(e,t={},i=[]){let n=[];n=e instanceof HTMLTemplateElement?[...e.content.childNodes]:[...e.childNodes];for(let o=0;o<n.length;o++){const s=n[o],r=this._domToView(s,t,i),a=r.next().value;null!==a&&(this._isBlockViewElement(a)&&this._processDomInlineNodes(e,i,t),yield a,r.next())}this._processDomInlineNodes(e,i,t)}domSelectionToView(e){if(function(e){if(!n.env.isGecko)return!1;if(!e.rangeCount)return!1;const t=e.getRangeAt(0).startContainer;try{Object.prototype.toString.call(t)}catch(e){return!0}return!1}(e))return new J([]);if(1===e.rangeCount){let t=e.getRangeAt(0).startContainer;(0,n.isText)(t)&&(t=t.parentNode);const i=this.fakeSelectionToView(t);if(i)return i}const t=this.isDomSelectionBackward(e),i=[];for(let t=0;t<e.rangeCount;t++){const n=e.getRangeAt(t),o=this.domRangeToView(n);o&&i.push(o)}return new J(i,{backward:t})}domRangeToView(e){const t=this.domPositionToView(e.startContainer,e.startOffset),i=this.domPositionToView(e.endContainer,e.endOffset);return t&&i?new G(t,i):null}domPositionToView(e,t=0){if(this.isBlockFiller(e))return this.domPositionToView(e.parentNode,(0,n.indexOf)(e));const i=this.mapDomToView(e);if(i&&(i.is("uiElement")||i.is("rawElement")))return K._createBefore(i);if((0,n.isText)(e)){if(Be(e))return this.domPositionToView(e.parentNode,(0,n.indexOf)(e));const i=this.findCorrespondingViewText(e);let o=t;return i?(Re(e)&&(o-=Se,o=o<0?0:o),new K(i,o)):null}if(0===t){const t=this.mapDomToView(e);if(t)return new K(t,0)}else{const i=e.childNodes[t-1];if((0,n.isText)(i)&&Be(i)||i&&this.isBlockFiller(i))return this.domPositionToView(i.parentNode,(0,n.indexOf)(i));const o=(0,n.isText)(i)?this.findCorrespondingViewText(i):this.mapDomToView(i);if(o&&o.parent)return new K(o.parent,o.index+1)}return null}mapDomToView(e){return this.getHostViewElement(e)||this._domToViewMapping.get(e)}findCorrespondingViewText(e){if(Be(e))return null;const t=this.getHostViewElement(e);if(t)return t;const i=e.previousSibling;if(i){if(!this.isElement(i))return null;const e=this.mapDomToView(i);if(e){const t=e.nextSibling;return t instanceof w?t:null}}else{const t=this.mapDomToView(e.parentNode);if(t){const e=t.getChild(0);return e instanceof w?e:null}}return null}mapViewToDom(e){return this._viewToDomMapping.get(e)}findCorrespondingDomText(e){const t=e.previousSibling;return t&&this.mapViewToDom(t)?this.mapViewToDom(t).nextSibling:!t&&e.parent&&this.mapViewToDom(e.parent)?this.mapViewToDom(e.parent).childNodes[0]:null}focus(e){const t=this.mapViewToDom(e);if(t&&t.ownerDocument.activeElement!==t){const{scrollX:e,scrollY:i}=n.global.window,o=[];Ke(t,(e=>{const{scrollLeft:t,scrollTop:i}=e;o.push([t,i])})),t.focus(),Ke(t,(e=>{const[t,i]=o.shift();e.scrollLeft=t,e.scrollTop=i})),n.global.window.scrollTo(e,i)}}_clearDomSelection(){const e=this.mapViewToDom(this.document.selection.editableElement);if(!e)return;const t=e.ownerDocument.defaultView.getSelection(),i=this.domSelectionToView(t);i&&i.rangeCount>0&&t.removeAllRanges()}isElement(e){return e&&e.nodeType==Node.ELEMENT_NODE}isDocumentFragment(e){return e&&e.nodeType==Node.DOCUMENT_FRAGMENT_NODE}isBlockFiller(e){return"br"==this.blockFillerMode?e.isEqualNode(We):!("BR"!==e.tagName||!Ge(e,this.blockElements)||1!==e.parentNode.childNodes.length)||e.isEqualNode(Ue)||function(e,t){return e.isEqualNode(He)&&Ge(e,t)&&1===e.parentNode.childNodes.length}(e,this.blockElements)}isDomSelectionBackward(e){if(e.isCollapsed)return!1;const t=this._domDocument.createRange();try{t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset)}catch(e){return!1}const i=t.collapsed;return t.detach(),i}getHostViewElement(e){const t=(0,n.getAncestors)(e);for(t.pop();t.length;){const e=t.pop(),i=this._domToViewMapping.get(e);if(i&&(i.is("uiElement")||i.is("rawElement")))return i}return null}isDomSelectionCorrect(e){return this._isDomSelectionPositionCorrect(e.anchorNode,e.anchorOffset)&&this._isDomSelectionPositionCorrect(e.focusNode,e.focusOffset)}registerRawContentMatcher(e){this._rawContentElementMatcher.add(e)}registerInlineObjectMatcher(e){this._inlineObjectElementMatcher.add(e)}_clearTemporaryCustomProperties(){for(const e of this._elementsWithTemporaryCustomProperties)e._removeCustomProperty("editingPipeline:doNotReuseOnce");this._elementsWithTemporaryCustomProperties.clear()}_getBlockFiller(){switch(this.blockFillerMode){case"nbsp":return Te(this._domDocument);case"markedNbsp":return Pe(this._domDocument);case"br":return Ie(this._domDocument)}}_isDomSelectionPositionCorrect(e,t){if((0,n.isText)(e)&&Re(e)&&t<Se)return!1;if(this.isElement(e)&&Re(e.childNodes[t]))return!1;const i=this.mapDomToView(e);return!i||!i.is("uiElement")&&!i.is("rawElement")}*_domToView(e,t,i){if(this.isBlockFiller(e))return null;const o=this.getHostViewElement(e);if(o)return o;if((0,n.isComment)(e)&&t.skipComments)return null;if((0,n.isText)(e)){if(Be(e))return null;{const t=e.data;if(""===t)return null;const n=new w(this.document,t);return i.push(n),n}}{let o=this.mapDomToView(e);if(o)return this._isInlineObjectElement(o)&&i.push(o),o;if(this.isDocumentFragment(e))o=new pe(this.document),t.bind&&this.bindDocumentFragments(e,o);else{o=this._createViewElement(e,t),t.bind&&this.bindElements(e,o);const s=e.attributes;if(s)for(let e=s.length,t=0;t<e;t++)o._setAttribute(s[t].name,s[t].value);if(this._isViewElementWithRawContent(o,t))return o._setCustomProperty("$rawContent",e.innerHTML),this._isBlockViewElement(o)||i.push(o),o;if((0,n.isComment)(e))return o._setCustomProperty("$rawContent",e.data),o}yield o;const s=[];if(!1!==t.withChildren)for(const i of this.domChildrenToView(e,t,s))o._appendChild(i);if(this._isInlineObjectElement(o))i.push(o);else for(const e of s)i.push(e)}}_processDomInlineNodes(e,t,i){if(!t.length)return;if(e&&!this.isDocumentFragment(e)&&!this._isBlockDomElement(e))return;let n=!1;for(let e=0;e<t.length;e++){const o=t[e];if(!o.is("$text")){n=!1;continue}let s,r=!1;if(this._isPreFormatted(o))s=Me(o.data);else{s=o.data.replace(/[ \n\t\r]{1,}/g," "),r=/[^\S\u00A0]/.test(s.charAt(s.length-1));const a=e>0?t[e-1]:null,l=e+1<t.length?t[e+1]:null,c=!a||a.is("element")&&"br"==a.name||n,d=!l&&!Re(o.data);!1!==i.withChildren&&(c&&(s=s.replace(/^ /,"")),d&&(s=s.replace(/ $/,""))),s=Me(s),s=s.replace(/ \u00A0/g,"  ");const u=l&&l.is("element")&&"br"!=l.name,h=l&&l.is("$text")&&" "==l.data.charAt(0);(/[ \u00A0]\u00A0$/.test(s)||!l||u||h)&&(s=s.replace(/\u00A0$/," ")),(c||a&&a.is("element")&&"br"!=a.name)&&(s=s.replace(/^\u00A0/," "))}0==s.length&&o.parent?(o._remove(),t.splice(e,1),e--):(o._data=s,n=r)}t.length=0}_processDataFromViewText(e){let t=e.data;if(this._isPreFormatted(e))return t;if(" "==t.charAt(0)){const i=this._getTouchingInlineViewNode(e,!1);!(i&&i.is("$textProxy")&&this._nodeEndsWithSpace(i))&&i||(t=" "+t.substr(1))}if(" "==t.charAt(t.length-1)){const i=this._getTouchingInlineViewNode(e,!0),n=i&&i.is("$textProxy")&&" "==i.data.charAt(0);" "!=t.charAt(t.length-2)&&i&&!n||(t=t.substr(0,t.length-1)+" ")}return t.replace(/ {2}/g,"  ")}_nodeEndsWithSpace(e){if(this._isPreFormatted(e))return!1;const t=this._processDataFromViewText(e);return" "==t.charAt(t.length-1)}_isPreFormatted(e){if(function(e,t){return e.getAncestors().some((e=>e.is("element")&&t.includes(e.name)))}(e,this.preElements))return!0;for(const t of e.getAncestors({parentFirst:!0}))if(t.is("element")&&t.hasStyle("white-space")&&"inherit"!==t.getStyle("white-space"))return["pre","pre-wrap","break-spaces"].includes(t.getStyle("white-space"));return!1}_getTouchingInlineViewNode(e,t){const i=new q({startPosition:t?K._createAfter(e):K._createBefore(e),direction:t?"forward":"backward"});for(const{item:e}of i){if(e.is("$textProxy"))return e;if(!e.is("element")||!e.getCustomProperty("dataPipeline:transparentRendering")){if(e.is("element","br"))return null;if(this._isInlineObjectElement(e))return e;if(e.is("containerElement"))return null}}return null}_isBlockDomElement(e){return this.isElement(e)&&this.blockElements.includes(e.tagName.toLowerCase())}_isBlockViewElement(e){return e.is("element")&&this.blockElements.includes(e.name)}_isInlineObjectElement(e){return!!e.is("element")&&("br"==e.name||this.inlineObjectElements.includes(e.name)||!!this._inlineObjectElementMatcher.match(e))}_createViewElement(e,t){if((0,n.isComment)(e))return new he(this.document,"$comment");const i=t.keepOriginalCase?e.tagName:e.tagName.toLowerCase();return new D(this.document,i)}_isViewElementWithRawContent(e,t){return!1!==t.withChildren&&e.is("element")&&!!this._rawContentElementMatcher.match(e)}_shouldRenameElement(e){const t=e.toLowerCase();return"editing"===this.renderingMode&&this.unsafeElements.includes(t)}_createReplacementDomElement(e,t){const i=this._domDocument.createElement("span");if(i.setAttribute(je,e),t){for(;t.firstChild;)i.appendChild(t.firstChild);for(const e of t.getAttributeNames())i.setAttribute(e,t.getAttribute(e))}return i}}function Ke(e,t){let i=e;for(;i;)t(i),i=i.parentElement}function Ge(e,t){const i=e.parentNode;return!!i&&!!i.tagName&&t.includes(i.tagName.toLowerCase())}function Ze(e){"script"===e&&(0,n.logWarning)("domconverter-unsafe-script-element-detected"),"style"===e&&(0,n.logWarning)("domconverter-unsafe-style-element-detected")}class Je extends((0,n.DomEmitterMixin)()){constructor(e){super(),this._isEnabled=!1,this.view=e,this.document=e.document}get isEnabled(){return this._isEnabled}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}destroy(){this.disable(),this.stopListening()}checkShouldIgnoreEventFromTarget(e){return e&&3===e.nodeType&&(e=e.parentNode),!(!e||1!==e.nodeType)&&e.matches("[data-cke-ignore-events], [data-cke-ignore-events] *")}}var Qe=i(6232);class Ye{constructor(e,t,i){this.view=e,this.document=e.document,this.domEvent=t,this.domTarget=t.target,(0,Qe.A)(this,i)}get target(){return this.view.domConverter.mapDomToView(this.domTarget)}preventDefault(){this.domEvent.preventDefault()}stopPropagation(){this.domEvent.stopPropagation()}}class Xe extends Je{constructor(){super(...arguments),this.useCapture=!1}observe(e){("string"==typeof this.domEventType?[this.domEventType]:this.domEventType).forEach((t=>{this.listenTo(e,t,((e,t)=>{this.isEnabled&&!this.checkShouldIgnoreEventFromTarget(t.target)&&this.onDomEvent(t)}),{useCapture:this.useCapture})}))}stopObserving(e){this.stopListening(e)}fire(e,t,i){this.isEnabled&&this.document.fire(e,new Ye(this.view,t,i))}}class et extends Xe{constructor(){super(...arguments),this.domEventType=["keydown","keyup"]}onDomEvent(e){const t={keyCode:e.keyCode,altKey:e.altKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,metaKey:e.metaKey,get keystroke(){return(0,n.getCode)(this)}};this.fire(e.type,e,t)}}var tt=i(2223);class it extends Je{constructor(e){super(e),this._fireSelectionChangeDoneDebounced=(0,tt.A)((e=>{this.document.fire("selectionChangeDone",e)}),200)}observe(){const e=this.document;e.on("arrowKey",((t,i)=>{e.selection.isFake&&this.isEnabled&&i.preventDefault()}),{context:"$capture"}),e.on("arrowKey",((t,i)=>{e.selection.isFake&&this.isEnabled&&this._handleSelectionMove(i.keyCode)}),{priority:"lowest"})}stopObserving(){}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(e){const t=this.document.selection,i=new J(t.getRanges(),{backward:t.isBackward,fake:!1});e!=n.keyCodes.arrowleft&&e!=n.keyCodes.arrowup||i.setTo(i.getFirstPosition()),e!=n.keyCodes.arrowright&&e!=n.keyCodes.arrowdown||i.setTo(i.getLastPosition());const o={oldSelection:t,newSelection:i,domSelection:null};this.document.fire("selectionChange",o),this._fireSelectionChangeDoneDebounced(o)}}var nt=i(5407);class ot extends Je{constructor(e){super(e),this._config={childList:!0,characterData:!0,subtree:!0},this.domConverter=e.domConverter,this._domElements=new Set,this._mutationObserver=new window.MutationObserver(this._onMutations.bind(this))}flush(){this._onMutations(this._mutationObserver.takeRecords())}observe(e){this._domElements.add(e),this.isEnabled&&this._mutationObserver.observe(e,this._config)}stopObserving(e){if(this._domElements.delete(e),this.isEnabled){this._mutationObserver.disconnect();for(const e of this._domElements)this._mutationObserver.observe(e,this._config)}}enable(){super.enable();for(const e of this._domElements)this._mutationObserver.observe(e,this._config)}disable(){super.disable(),this._mutationObserver.disconnect()}destroy(){super.destroy(),this._mutationObserver.disconnect()}_onMutations(e){if(0===e.length)return;const t=this.domConverter,i=new Set,n=new Set;for(const i of e){const e=t.mapDomToView(i.target);e&&(e.is("uiElement")||e.is("rawElement")||"childList"!==i.type||this._isBogusBrMutation(i)||n.add(e))}for(const o of e){const e=t.mapDomToView(o.target);if((!e||!e.is("uiElement")&&!e.is("rawElement"))&&"characterData"===o.type){const e=t.findCorrespondingViewText(o.target);e&&!n.has(e.parent)?i.add(e):!e&&Re(o.target)&&n.add(t.mapDomToView(o.target.parentNode))}}const o=[];for(const e of i)o.push({type:"text",node:e});for(const e of n){const i=t.mapViewToDom(e),n=Array.from(e.getChildren()),c=Array.from(t.domChildrenToView(i,{withChildren:!1}));s=n,r=c,l=void 0,(void 0===(l=(a="function"==typeof(a=st)?a:void 0)?a(s,r):void 0)?(0,nt.A)(s,r,void 0,a):l)||o.push({type:"children",node:e})}var s,r,a,l;o.length&&this.document.fire("mutations",{mutations:o})}_isBogusBrMutation(e){let t=null;return null===e.nextSibling&&0===e.removedNodes.length&&1==e.addedNodes.length&&(t=this.domConverter.domToView(e.addedNodes[0],{withChildren:!1})),t&&t.is("element","br")}}function st(e,t){if(!Array.isArray(e))return e===t||!(!e.is("$text")||!t.is("$text"))&&e.data===t.data}class rt extends Xe{constructor(e){super(e),this._renderTimeoutId=null,this._isFocusChanging=!1,this.domEventType=["focus","blur"],this.useCapture=!0;const t=this.document;t.on("focus",(()=>this._handleFocus())),t.on("blur",((e,t)=>this._handleBlur(t))),t.on("beforeinput",(()=>{t.isFocused||this._handleFocus()}),{priority:"highest"})}flush(){this._isFocusChanging&&(this._isFocusChanging=!1,this.document.isFocused=!0)}onDomEvent(e){this.fire(e.type,e)}destroy(){this._clearTimeout(),super.destroy()}_handleFocus(){this._clearTimeout(),this._isFocusChanging=!0,this._renderTimeoutId=setTimeout((()=>{this._renderTimeoutId=null,this.flush(),this.view.change((()=>{}))}),50)}_handleBlur(e){const t=this.document.selection.editableElement;null!==t&&t!==e.target||(this.document.isFocused=!1,this._isFocusChanging=!1,this.view.change((()=>{})))}_clearTimeout(){this._renderTimeoutId&&(clearTimeout(this._renderTimeoutId),this._renderTimeoutId=null)}}class at extends Je{constructor(e){super(e),this.mutationObserver=e.getObserver(ot),this.focusObserver=e.getObserver(rt),this.selection=this.document.selection,this.domConverter=e.domConverter,this._documents=new WeakSet,this._fireSelectionChangeDoneDebounced=(0,tt.A)((e=>{this.document.fire("selectionChangeDone",e)}),200),this._clearInfiniteLoopInterval=setInterval((()=>this._clearInfiniteLoop()),1e3),this._documentIsSelectingInactivityTimeoutDebounced=(0,tt.A)((()=>this.document.isSelecting=!1),5e3),this._loopbackCounter=0}observe(e){const t=e.ownerDocument,i=()=>{this.document.isSelecting&&(this._handleSelectionChange(t),this.document.isSelecting=!1,this._documentIsSelectingInactivityTimeoutDebounced.cancel())};this.listenTo(e,"selectstart",(()=>{this.document.isSelecting=!0,this._documentIsSelectingInactivityTimeoutDebounced()}),{priority:"highest"}),this.listenTo(e,"keydown",i,{priority:"highest",useCapture:!0}),this.listenTo(e,"keyup",i,{priority:"highest",useCapture:!0}),this._documents.has(t)||(this.listenTo(t,"mouseup",i,{priority:"highest",useCapture:!0}),this.listenTo(t,"selectionchange",((e,i)=>{this.document.isComposing&&!n.env.isAndroid||(this._handleSelectionChange(t),this._documentIsSelectingInactivityTimeoutDebounced())})),this.listenTo(this.view.document,"compositionstart",(()=>{this._handleSelectionChange(t)}),{priority:"lowest"}),this._documents.add(t))}stopObserving(e){this.stopListening(e)}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel(),this._documentIsSelectingInactivityTimeoutDebounced.cancel()}_reportInfiniteLoop(){}_handleSelectionChange(e){if(!this.isEnabled)return;const t=e.defaultView.getSelection();if(this.checkShouldIgnoreEventFromTarget(t.anchorNode))return;this.mutationObserver.flush();const i=this.domConverter.domSelectionToView(t);if(0!=i.rangeCount){if(this.view.hasDomSelection=!0,this.focusObserver.flush(),!this.selection.isEqual(i)||!this.domConverter.isDomSelectionCorrect(t))if(++this._loopbackCounter>60)this._reportInfiniteLoop();else if(this.selection.isSimilar(i))this.view.forceRender();else{const e={oldSelection:this.selection,newSelection:i,domSelection:t};this.document.fire("selectionChange",e),this._fireSelectionChangeDoneDebounced(e)}}else this.view.hasDomSelection=!1}_clearInfiniteLoop(){this._loopbackCounter=0}}class lt extends Xe{constructor(e){super(e),this.domEventType=["compositionstart","compositionupdate","compositionend"];const t=this.document;t.on("compositionstart",(()=>{t.isComposing=!0}),{priority:"low"}),t.on("compositionend",(()=>{t.isComposing=!1}),{priority:"low"})}onDomEvent(e){this.fire(e.type,e,{data:e.data})}}class ct{constructor(e,t={}){this._files=t.cacheFiles?dt(e):null,this._native=e}get files(){return this._files||(this._files=dt(this._native)),this._files}get types(){return this._native.types}getData(e){return this._native.getData(e)}setData(e,t){this._native.setData(e,t)}set effectAllowed(e){this._native.effectAllowed=e}get effectAllowed(){return this._native.effectAllowed}set dropEffect(e){this._native.dropEffect=e}get dropEffect(){return this._native.dropEffect}setDragImage(e,t,i){this._native.setDragImage(e,t,i)}get isCanceled(){return"none"==this._native.dropEffect||!!this._native.mozUserCancelled}}function dt(e){const t=Array.from(e.files||[]),i=Array.from(e.items||[]);return t.length?t:i.filter((e=>"file"===e.kind)).map((e=>e.getAsFile()))}class ut extends Xe{constructor(){super(...arguments),this.domEventType="beforeinput"}onDomEvent(e){const t=e.getTargetRanges(),i=this.view,o=i.document;let s=null,r=null,a=[];if(e.dataTransfer&&(s=new ct(e.dataTransfer)),null!==e.data?r=e.data:s&&(r=s.getData("text/plain")),o.selection.isFake)a=Array.from(o.selection.getRanges());else if(t.length)a=t.map((e=>{const t=i.domConverter.domPositionToView(e.startContainer,e.startOffset),n=i.domConverter.domPositionToView(e.endContainer,e.endOffset);return t?i.createRange(t,n):n?i.createRange(n):void 0})).filter((e=>!!e));else if(n.env.isAndroid){const t=e.target.ownerDocument.defaultView.getSelection();a=Array.from(i.domConverter.domSelectionToView(t).getRanges())}if(n.env.isAndroid&&"insertCompositionText"==e.inputType&&r&&r.endsWith("\n"))this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:[i.createRange(a[0].end)]});else if("insertText"==e.inputType&&r&&r.includes("\n")){const t=r.split(/\n{1,2}/g);let i=a;for(let n=0;n<t.length;n++){const r=t[n];""!=r&&(this.fire(e.type,e,{data:r,dataTransfer:s,targetRanges:i,inputType:e.inputType,isComposing:e.isComposing}),i=[o.selection.getFirstRange()]),n+1<t.length&&(this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:i}),i=[o.selection.getFirstRange()])}}else this.fire(e.type,e,{data:r,dataTransfer:s,targetRanges:a,inputType:e.inputType,isComposing:e.isComposing})}}class ht extends Je{constructor(e){super(e),this.document.on("keydown",((e,t)=>{if(this.isEnabled&&(0,n.isArrowKeyCode)(t.keyCode)){const i=new Y(this.document,"arrowKey",this.document.selection.getFirstRange());this.document.fire(i,t),i.stop.called&&e.stop()}}))}observe(){}stopObserving(){}}class mt extends Je{constructor(e){super(e);const t=this.document;t.on("keydown",((e,i)=>{if(!this.isEnabled||i.keyCode!=n.keyCodes.tab||i.ctrlKey)return;const o=new Y(t,"tab",t.selection.getFirstRange());t.fire(o,i),o.stop.called&&e.stop()}))}observe(){}stopObserving(){}}var gt=i(903);class ft extends((0,n.ObservableMixin)()){constructor(e){var t;super(),this.domRoots=new Map,this._initialDomRootAttributes=new WeakMap,this._observers=new Map,this._ongoingChange=!1,this._postFixersInProgress=!1,this._renderingDisabled=!1,this._hasChangedSinceTheLastRendering=!1,this.document=new se(e),this.domConverter=new qe(this.document),this.set("isRenderingInProgress",!1),this.set("hasDomSelection",!1),this._renderer=new Le(this.domConverter,this.document.selection),this._renderer.bind("isFocused","isSelecting","isComposing").to(this.document,"isFocused","isSelecting","isComposing"),this._writer=new be(this.document),this.addObserver(ot),this.addObserver(rt),this.addObserver(at),this.addObserver(et),this.addObserver(it),this.addObserver(lt),this.addObserver(ht),this.addObserver(ut),this.addObserver(mt),this.document.on("arrowKey",Oe,{priority:"low"}),(t=this).document.on("arrowKey",((e,i)=>function(e,t,i){if(t.keyCode==n.keyCodes.arrowright){const e=t.domTarget.ownerDocument.defaultView.getSelection(),n=1==e.rangeCount&&e.getRangeAt(0).collapsed;if(n||t.shiftKey){const t=e.focusNode,o=e.focusOffset,s=i.domPositionToView(t,o);if(null===s)return;let r=!1;const a=s.getLastMatchingPosition((e=>(e.item.is("uiElement")&&(r=!0),!(!e.item.is("uiElement")&&!e.item.is("attributeElement")))));if(r){const t=i.viewPositionToDom(a);n?e.collapse(t.parent,t.offset):e.extend(t.parent,t.offset)}}}}(0,i,t.domConverter)),{priority:"low"}),this.on("render",(()=>{this._render(),this.document.fire("layoutChanged"),this._hasChangedSinceTheLastRendering=!1})),this.listenTo(this.document.selection,"change",(()=>{this._hasChangedSinceTheLastRendering=!0})),this.listenTo(this.document,"change:isFocused",(()=>{this._hasChangedSinceTheLastRendering=!0})),n.env.isiOS&&this.listenTo(this.document,"blur",((e,t)=>{this.domConverter.mapDomToView(t.domEvent.relatedTarget)||this.domConverter._clearDomSelection()})),this.listenTo(this.document,"mutations",((e,{mutations:t})=>{t.forEach((e=>this._renderer.markToSync(e.type,e.node)))}),{priority:"low"}),this.listenTo(this.document,"mutations",(()=>{this.forceRender()}),{priority:"lowest"})}attachDomRoot(e,t="main"){const i=this.document.getRoot(t);i._name=e.tagName.toLowerCase();const n={};for(const{name:t,value:o}of Array.from(e.attributes))n[t]=o,"class"===t?this._writer.addClass(o.split(" "),i):this._writer.setAttribute(t,o,i);this._initialDomRootAttributes.set(e,n);const o=()=>{this._writer.setAttribute("contenteditable",(!i.isReadOnly).toString(),i),i.isReadOnly?this._writer.addClass("ck-read-only",i):this._writer.removeClass("ck-read-only",i)};o(),this.domRoots.set(t,e),this.domConverter.bindElements(e,i),this._renderer.markToSync("children",i),this._renderer.markToSync("attributes",i),this._renderer.domDocuments.add(e.ownerDocument),i.on("change:children",((e,t)=>this._renderer.markToSync("children",t))),i.on("change:attributes",((e,t)=>this._renderer.markToSync("attributes",t))),i.on("change:text",((e,t)=>this._renderer.markToSync("text",t))),i.on("change:isReadOnly",(()=>this.change(o))),i.on("change",(()=>{this._hasChangedSinceTheLastRendering=!0}));for(const i of this._observers.values())i.observe(e,t)}detachDomRoot(e){const t=this.domRoots.get(e);Array.from(t.attributes).forEach((({name:e})=>t.removeAttribute(e)));const i=this._initialDomRootAttributes.get(t);for(const e in i)t.setAttribute(e,i[e]);this.domRoots.delete(e),this.domConverter.unbindDomElement(t);for(const e of this._observers.values())e.stopObserving(t)}getDomRoot(e="main"){return this.domRoots.get(e)}addObserver(e){let t=this._observers.get(e);if(t)return t;t=new e(this),this._observers.set(e,t);for(const[e,i]of this.domRoots)t.observe(i,e);return t.enable(),t}getObserver(e){return this._observers.get(e)}disableObservers(){for(const e of this._observers.values())e.disable()}enableObservers(){for(const e of this._observers.values())e.enable()}scrollToTheSelection({alignToTop:e,forceScroll:t,viewportOffset:i=20,ancestorOffset:o=20}={}){const s=this.document.selection.getFirstRange();if(!s)return;const r=(0,gt.A)({alignToTop:e,forceScroll:t,viewportOffset:i,ancestorOffset:o});"number"==typeof i&&(i={top:i,bottom:i,left:i,right:i});const a={target:this.domConverter.viewRangeToDom(s),viewportOffset:i,ancestorOffset:o,alignToTop:e,forceScroll:t};this.fire("scrollToTheSelection",a,r),(0,n.scrollViewportToShowTarget)(a)}focus(){if(!this.document.isFocused){const e=this.document.selection.editableElement;e&&(this.domConverter.focus(e),this.forceRender())}}change(e){if(this.isRenderingInProgress||this._postFixersInProgress)throw new n.CKEditorError("cannot-change-view-tree",this);try{if(this._ongoingChange)return e(this._writer);this._ongoingChange=!0;const t=e(this._writer);return this._ongoingChange=!1,!this._renderingDisabled&&this._hasChangedSinceTheLastRendering&&(this._postFixersInProgress=!0,this.document._callPostFixers(this._writer),this._postFixersInProgress=!1,this.fire("render")),t}catch(e){n.CKEditorError.rethrowUnexpectedError(e,this)}}forceRender(){this._hasChangedSinceTheLastRendering=!0,this.getObserver(rt).flush(),this.change((()=>{}))}destroy(){for(const e of this._observers.values())e.destroy();this.document.destroy(),this.stopListening()}createPositionAt(e,t){return K._createAt(e,t)}createPositionAfter(e){return K._createAfter(e)}createPositionBefore(e){return K._createBefore(e)}createRange(e,t){return new G(e,t)}createRangeOn(e){return G._createOn(e)}createRangeIn(e){return G._createIn(e)}createSelection(...e){return new J(...e)}_disableRendering(e){this._renderingDisabled=e,0==e&&this.change((()=>{}))}_render(){this.isRenderingInProgress=!0,this.disableObservers(),this._renderer.render(),this.enableObservers(),this.isRenderingInProgress=!1}}class pt{is(){throw new Error("is() method is abstract")}}class bt extends pt{constructor(e){super(),this.parent=null,this._attrs=(0,n.toMap)(e)}get document(){return null}get index(){let e;if(!this.parent)return null;if(null===(e=this.parent.getChildIndex(this)))throw new n.CKEditorError("model-node-not-found-in-parent",this);return e}get startOffset(){let e;if(!this.parent)return null;if(null===(e=this.parent.getChildStartOffset(this)))throw new n.CKEditorError("model-node-not-found-in-parent",this);return e}get offsetSize(){return 1}get endOffset(){return this.parent?this.startOffset+this.offsetSize:null}get nextSibling(){const e=this.index;return null!==e&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return null!==e&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return null!==this.parent&&this.root.isAttached()}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.startOffset),t=t.parent;return e}getAncestors(e={}){const t=[];let i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}getCommonAncestor(e,t={}){const i=this.getAncestors(t),n=e.getAncestors(t);let o=0;for(;i[o]==n[o]&&i[o];)o++;return 0===o?null:i[o-1]}isBefore(e){if(this==e)return!1;if(this.root!==e.root)return!1;const t=this.getPath(),i=e.getPath(),o=(0,n.compareArrays)(t,i);switch(o){case"prefix":return!0;case"extension":return!1;default:return t[o]<i[o]}}isAfter(e){return this!=e&&this.root===e.root&&!this.isBefore(e)}hasAttribute(e){return this._attrs.has(e)}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}toJSON(){const e={};return this._attrs.size&&(e.attributes=Array.from(this._attrs).reduce(((e,t)=>(e[t[0]]=t[1],e)),{})),e}_clone(e){return new this.constructor(this._attrs)}_remove(){this.parent._removeChildren(this.index)}_setAttribute(e,t){this._attrs.set(e,t)}_setAttributesTo(e){this._attrs=(0,n.toMap)(e)}_removeAttribute(e){return this._attrs.delete(e)}_clearAttributes(){this._attrs.clear()}}bt.prototype.is=function(e){return"node"===e||"model:node"===e};class wt{constructor(e){this._nodes=[],e&&this._insertNodes(0,e)}[Symbol.iterator](){return this._nodes[Symbol.iterator]()}get length(){return this._nodes.length}get maxOffset(){return this._nodes.reduce(((e,t)=>e+t.offsetSize),0)}getNode(e){return this._nodes[e]||null}getNodeIndex(e){const t=this._nodes.indexOf(e);return-1==t?null:t}getNodeStartOffset(e){const t=this.getNodeIndex(e);return null===t?null:this._nodes.slice(0,t).reduce(((e,t)=>e+t.offsetSize),0)}indexToOffset(e){if(e==this._nodes.length)return this.maxOffset;const t=this._nodes[e];if(!t)throw new n.CKEditorError("model-nodelist-index-out-of-bounds",this);return this.getNodeStartOffset(t)}offsetToIndex(e){let t=0;for(const i of this._nodes){if(e>=t&&e<t+i.offsetSize)return this.getNodeIndex(i);t+=i.offsetSize}if(t!=e)throw new n.CKEditorError("model-nodelist-offset-out-of-bounds",this,{offset:e,nodeList:this});return this.length}_insertNodes(e,t){for(const e of t)if(!(e instanceof bt))throw new n.CKEditorError("model-nodelist-insertnodes-not-node",this);this._nodes=(0,n.spliceArray)(this._nodes,Array.from(t),e,0)}_removeNodes(e,t=1){return this._nodes.splice(e,t)}toJSON(){return this._nodes.map((e=>e.toJSON()))}}class vt extends bt{constructor(e,t){super(t),this._data=e||""}get offsetSize(){return this.data.length}get data(){return this._data}toJSON(){const e=super.toJSON();return e.data=this.data,e}_clone(){return new vt(this.data,this.getAttributes())}static fromJSON(e){return new vt(e.data,e.attributes)}}vt.prototype.is=function(e){return"$text"===e||"model:$text"===e||"text"===e||"model:text"===e||"node"===e||"model:node"===e};class _t extends pt{constructor(e,t,i){if(super(),this.textNode=e,t<0||t>e.offsetSize)throw new n.CKEditorError("model-textproxy-wrong-offsetintext",this);if(i<0||t+i>e.offsetSize)throw new n.CKEditorError("model-textproxy-wrong-length",this);this.data=e.data.substring(t,t+i),this.offsetInText=t}get startOffset(){return null!==this.textNode.startOffset?this.textNode.startOffset+this.offsetInText:null}get offsetSize(){return this.data.length}get endOffset(){return null!==this.startOffset?this.startOffset+this.offsetSize:null}get isPartial(){return this.offsetSize!==this.textNode.offsetSize}get parent(){return this.textNode.parent}get root(){return this.textNode.root}getPath(){const e=this.textNode.getPath();return e.length>0&&(e[e.length-1]+=this.offsetInText),e}getAncestors(e={}){const t=[];let i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}hasAttribute(e){return this.textNode.hasAttribute(e)}getAttribute(e){return this.textNode.getAttribute(e)}getAttributes(){return this.textNode.getAttributes()}getAttributeKeys(){return this.textNode.getAttributeKeys()}}_t.prototype.is=function(e){return"$textProxy"===e||"model:$textProxy"===e||"textProxy"===e||"model:textProxy"===e};class yt extends bt{constructor(e,t,i){super(t),this._children=new wt,this.name=e,i&&this._insertChild(0,i)}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return 0===this.childCount}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}offsetToIndex(e){return this._children.offsetToIndex(e)}getNodeByPath(e){let t=this;for(const i of e)t=t.getChild(t.offsetToIndex(i));return t}findAncestor(e,t={}){let i=t.includeSelf?this:this.parent;for(;i;){if(i.name===e)return i;i=i.parent}return null}toJSON(){const e=super.toJSON();if(e.name=this.name,this._children.length>0){e.children=[];for(const t of this._children)e.children.push(t.toJSON())}return e}_clone(e=!1){const t=e?Array.from(this._children).map((e=>e._clone(!0))):void 0;return new yt(this.name,this.getAttributes(),t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const i=function(e){return"string"==typeof e?[new vt(e)]:((0,n.isIterable)(e)||(e=[e]),Array.from(e).map((e=>"string"==typeof e?new vt(e):e instanceof _t?new vt(e.data,e.getAttributes()):e)))}(t);for(const e of i)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,i)}_removeChildren(e,t=1){const i=this._children._removeNodes(e,t);for(const e of i)e.parent=null;return i}static fromJSON(e){let t;if(e.children){t=[];for(const i of e.children)i.name?t.push(yt.fromJSON(i)):t.push(vt.fromJSON(i))}return new yt(e.name,e.attributes,t)}}yt.prototype.is=function(e,t){return t?t===this.name&&("element"===e||"model:element"===e):"element"===e||"model:element"===e||"node"===e||"model:node"===e};class kt{constructor(e){if(!e||!e.boundaries&&!e.startPosition)throw new n.CKEditorError("model-tree-walker-no-start-position",null);const t=e.direction||"forward";if("forward"!=t&&"backward"!=t)throw new n.CKEditorError("model-tree-walker-unknown-direction",e,{direction:t});this.direction=t,this.boundaries=e.boundaries||null,e.startPosition?this._position=e.startPosition.clone():this._position=At._createAt(this.boundaries["backward"==this.direction?"end":"start"]),this.position.stickiness="toNone",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null,this._visitedParent=this.position.parent}[Symbol.iterator](){return this}get position(){return this._position}skip(e){let t,i,n,o;do{n=this.position,o=this._visitedParent,({done:t,value:i}=this.next())}while(!t&&e(i));t||(this._position=n,this._visitedParent=o)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){const e=this.position,t=this.position.clone(),i=this._visitedParent;if(null===i.parent&&t.offset===i.maxOffset)return{done:!0,value:void 0};if(i===this._boundaryEndParent&&t.offset==this.boundaries.end.offset)return{done:!0,value:void 0};const n=Et(t,i),o=n||xt(t,i,n);if(o instanceof yt){if(this.shallow){if(this.boundaries&&this.boundaries.end.isBefore(t))return{done:!0,value:void 0};t.offset++}else t.path.push(0),this._visitedParent=o;return this._position=t,Ct("elementStart",o,e,t,1)}if(o instanceof vt){let n;if(this.singleCharacters)n=1;else{let e=o.endOffset;this._boundaryEndParent==i&&this.boundaries.end.offset<e&&(e=this.boundaries.end.offset),n=e-t.offset}const s=t.offset-o.startOffset,r=new _t(o,s,n);return t.offset+=n,this._position=t,Ct("text",r,e,t,n)}return t.path.pop(),t.offset++,this._position=t,this._visitedParent=i.parent,this.ignoreElementEnd?this._next():Ct("elementEnd",i,e,t)}_previous(){const e=this.position,t=this.position.clone(),i=this._visitedParent;if(null===i.parent&&0===t.offset)return{done:!0,value:void 0};if(i==this._boundaryStartParent&&t.offset==this.boundaries.start.offset)return{done:!0,value:void 0};const n=t.parent,o=Et(t,n),s=o||Tt(t,n,o);if(s instanceof yt)return t.offset--,this.shallow?(this._position=t,Ct("elementStart",s,e,t,1)):(t.path.push(s.maxOffset),this._position=t,this._visitedParent=s,this.ignoreElementEnd?this._previous():Ct("elementEnd",s,e,t));if(s instanceof vt){let n;if(this.singleCharacters)n=1;else{let e=s.startOffset;this._boundaryStartParent==i&&this.boundaries.start.offset>e&&(e=this.boundaries.start.offset),n=t.offset-e}const o=t.offset-s.startOffset,r=new _t(s,o-n,n);return t.offset-=n,this._position=t,Ct("text",r,e,t,n)}return t.path.pop(),this._position=t,this._visitedParent=i.parent,Ct("elementStart",i,e,t,1)}}function Ct(e,t,i,n,o){return{done:!1,value:{type:e,item:t,previousPosition:i,nextPosition:n,length:o}}}class At extends pt{constructor(e,t,i="toNone"){if(super(),!e.is("element")&&!e.is("documentFragment"))throw new n.CKEditorError("model-position-root-invalid",e);if(!(t instanceof Array)||0===t.length)throw new n.CKEditorError("model-position-path-incorrect-format",e,{path:t});e.is("rootElement")?t=t.slice():(t=[...e.getPath(),...t],e=e.root),this.root=e,this.path=t,this.stickiness=i}get offset(){return this.path[this.path.length-1]}set offset(e){this.path[this.path.length-1]=e}get parent(){let e=this.root;for(let t=0;t<this.path.length-1;t++)if(e=e.getChild(e.offsetToIndex(this.path[t])),!e)throw new n.CKEditorError("model-position-path-incorrect",this,{position:this});if(e.is("$text"))throw new n.CKEditorError("model-position-path-incorrect",this,{position:this});return e}get index(){return this.parent.offsetToIndex(this.offset)}get textNode(){return Et(this,this.parent)}get nodeAfter(){const e=this.parent;return xt(this,e,Et(this,e))}get nodeBefore(){const e=this.parent;return Tt(this,e,Et(this,e))}get isAtStart(){return 0===this.offset}get isAtEnd(){return this.offset==this.parent.maxOffset}compareWith(e){if(this.root!=e.root)return"different";const t=(0,n.compareArrays)(this.path,e.path);switch(t){case"same":return"same";case"prefix":return"before";case"extension":return"after";default:return this.path[t]<e.path[t]?"before":"after"}}getLastMatchingPosition(e,t={}){t.startPosition=this;const i=new kt(t);return i.skip(e),i.position}getParentPath(){return this.path.slice(0,-1)}getAncestors(){const e=this.parent;return e.is("documentFragment")?[e]:e.getAncestors({includeSelf:!0})}findAncestor(e){const t=this.parent;return t.is("element")?t.findAncestor(e,{includeSelf:!0}):null}getCommonPath(e){if(this.root!=e.root)return[];const t=(0,n.compareArrays)(this.path,e.path),i="string"==typeof t?Math.min(this.path.length,e.path.length):t;return this.path.slice(0,i)}getCommonAncestor(e){const t=this.getAncestors(),i=e.getAncestors();let n=0;for(;t[n]==i[n]&&t[n];)n++;return 0===n?null:t[n-1]}getShiftedBy(e){const t=this.clone(),i=t.offset+e;return t.offset=i<0?0:i,t}isAfter(e){return"after"==this.compareWith(e)}isBefore(e){return"before"==this.compareWith(e)}isEqual(e){return"same"==this.compareWith(e)}isTouching(e){if(this.root!==e.root)return!1;const t=Math.min(this.path.length,e.path.length);for(let i=0;i<t;i++){const t=this.path[i]-e.path[i];if(t<-1||t>1)return!1;if(1===t)return Pt(e,this,i);if(-1===t)return Pt(this,e,i)}return this.path.length===e.path.length||(this.path.length>e.path.length?It(this.path,t):It(e.path,t))}hasSameParentAs(e){if(this.root!==e.root)return!1;const t=this.getParentPath(),i=e.getParentPath();return"same"==(0,n.compareArrays)(t,i)}getTransformedByOperation(e){let t;switch(e.type){case"insert":t=this._getTransformedByInsertOperation(e);break;case"move":case"remove":case"reinsert":t=this._getTransformedByMoveOperation(e);break;case"split":t=this._getTransformedBySplitOperation(e);break;case"merge":t=this._getTransformedByMergeOperation(e);break;default:t=At._createAt(this)}return t}_getTransformedByInsertOperation(e){return this._getTransformedByInsertion(e.position,e.howMany)}_getTransformedByMoveOperation(e){return this._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany)}_getTransformedBySplitOperation(e){const t=e.movedRange;return t.containsPosition(this)||t.start.isEqual(this)&&"toNext"==this.stickiness?this._getCombined(e.splitPosition,e.moveTargetPosition):e.graveyardPosition?this._getTransformedByMove(e.graveyardPosition,e.insertionPosition,1):this._getTransformedByInsertion(e.insertionPosition,1)}_getTransformedByMergeOperation(e){const t=e.movedRange;let i;return t.containsPosition(this)||t.start.isEqual(this)?(i=this._getCombined(e.sourcePosition,e.targetPosition),e.sourcePosition.isBefore(e.targetPosition)&&(i=i._getTransformedByDeletion(e.deletionPosition,1))):i=this.isEqual(e.deletionPosition)?At._createAt(e.deletionPosition):this._getTransformedByMove(e.deletionPosition,e.graveyardPosition,1),i}_getTransformedByDeletion(e,t){const i=At._createAt(this);if(this.root!=e.root)return i;if("same"==(0,n.compareArrays)(e.getParentPath(),this.getParentPath())){if(e.offset<this.offset){if(e.offset+t>this.offset)return null;i.offset-=t}}else if("prefix"==(0,n.compareArrays)(e.getParentPath(),this.getParentPath())){const n=e.path.length-1;if(e.offset<=this.path[n]){if(e.offset+t>this.path[n])return null;i.path[n]-=t}}return i}_getTransformedByInsertion(e,t){const i=At._createAt(this);if(this.root!=e.root)return i;if("same"==(0,n.compareArrays)(e.getParentPath(),this.getParentPath()))(e.offset<this.offset||e.offset==this.offset&&"toPrevious"!=this.stickiness)&&(i.offset+=t);else if("prefix"==(0,n.compareArrays)(e.getParentPath(),this.getParentPath())){const n=e.path.length-1;e.offset<=this.path[n]&&(i.path[n]+=t)}return i}_getTransformedByMove(e,t,i){if(t=t._getTransformedByDeletion(e,i),e.isEqual(t))return At._createAt(this);const n=this._getTransformedByDeletion(e,i);return null===n||e.isEqual(this)&&"toNext"==this.stickiness||e.getShiftedBy(i).isEqual(this)&&"toPrevious"==this.stickiness?this._getCombined(e,t):n._getTransformedByInsertion(t,i)}_getCombined(e,t){const i=e.path.length-1,n=At._createAt(t);return n.stickiness=this.stickiness,n.offset=n.offset+this.path[i]-e.offset,n.path=[...n.path,...this.path.slice(i+1)],n}toJSON(){return{root:this.root.toJSON(),path:Array.from(this.path),stickiness:this.stickiness}}clone(){return new this.constructor(this.root,this.path,this.stickiness)}static _createAt(e,t,i="toNone"){if(e instanceof At)return new At(e.root,e.path,e.stickiness);{const o=e;if("end"==t)t=o.maxOffset;else{if("before"==t)return this._createBefore(o,i);if("after"==t)return this._createAfter(o,i);if(0!==t&&!t)throw new n.CKEditorError("model-createpositionat-offset-required",[this,e])}if(!o.is("element")&&!o.is("documentFragment"))throw new n.CKEditorError("model-position-parent-incorrect",[this,e]);const s=o.getPath();return s.push(t),new this(o.root,s,i)}}static _createAfter(e,t){if(!e.parent)throw new n.CKEditorError("model-position-after-root",[this,e],{root:e});return this._createAt(e.parent,e.endOffset,t)}static _createBefore(e,t){if(!e.parent)throw new n.CKEditorError("model-position-before-root",e,{root:e});return this._createAt(e.parent,e.startOffset,t)}static fromJSON(e,t){if("$graveyard"===e.root){const i=new At(t.graveyard,e.path);return i.stickiness=e.stickiness,i}if(!t.getRoot(e.root))throw new n.CKEditorError("model-position-fromjson-no-root",t,{rootName:e.root});return new At(t.getRoot(e.root),e.path,e.stickiness)}}function Et(e,t){const i=t.getChild(t.offsetToIndex(e.offset));return i&&i.is("$text")&&i.startOffset<e.offset?i:null}function xt(e,t,i){return null!==i?null:t.getChild(t.offsetToIndex(e.offset))}function Tt(e,t,i){return null!==i?null:t.getChild(t.offsetToIndex(e.offset)-1)}function Pt(e,t,i){return i+1!==e.path.length&&!!It(t.path,i+1)&&!!function(e,t){let i=e.parent,n=e.path.length-1,o=0;for(;n>=t;){if(e.path[n]+o!==i.maxOffset)return!1;o=1,n--,i=i.parent}return!0}(e,i+1)}function It(e,t){for(;t<e.length;){if(0!==e[t])return!1;t++}return!0}At.prototype.is=function(e){return"position"===e||"model:position"===e};class St extends pt{constructor(e,t){super(),this.start=At._createAt(e),this.end=t?At._createAt(t):At._createAt(e),this.start.stickiness=this.isCollapsed?"toNone":"toNext",this.end.stickiness=this.isCollapsed?"toNone":"toPrevious"}*[Symbol.iterator](){yield*new kt({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){const e=this.start.getParentPath(),t=this.end.getParentPath();return"same"==(0,n.compareArrays)(e,t)}get root(){return this.start.root}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);const i=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),n=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return i&&n}containsItem(e){const t=At._createBefore(e);return this.containsPosition(t)||this.start.isEqual(t)}isEqual(e){return this.start.isEqual(e.start)&&this.end.isEqual(e.end)}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new St(this.start,e.start)),this.containsPosition(e.end)&&t.push(new St(e.end,this.end))):t.push(new St(this.start,this.end)),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,i=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(i=e.end),new St(t,i)}return null}getJoined(e,t=!1){let i=this.isIntersecting(e);if(i||(i=this.start.isBefore(e.start)?t?this.end.isTouching(e.start):this.end.isEqual(e.start):t?e.end.isTouching(this.start):e.end.isEqual(this.start)),!i)return null;let n=this.start,o=this.end;return e.start.isBefore(n)&&(n=e.start),e.end.isAfter(o)&&(o=e.end),new St(n,o)}getMinimalFlatRanges(){const e=[],t=this.start.getCommonPath(this.end).length,i=At._createAt(this.start);let n=i.parent;for(;i.path.length>t+1;){const t=n.maxOffset-i.offset;0!==t&&e.push(new St(i,i.getShiftedBy(t))),i.path=i.path.slice(0,-1),i.offset++,n=n.parent}for(;i.path.length<=this.end.path.length;){const t=this.end.path[i.path.length-1],n=t-i.offset;0!==n&&e.push(new St(i,i.getShiftedBy(n))),i.offset=t,i.path.push(0)}return e}getWalker(e={}){return e.boundaries=this,new kt(e)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new kt(e);for(const e of t)yield e.item}*getPositions(e={}){e.boundaries=this;const t=new kt(e);yield t.position;for(const e of t)yield e.nextPosition}getTransformedByOperation(e){switch(e.type){case"insert":return this._getTransformedByInsertOperation(e);case"move":case"remove":case"reinsert":return this._getTransformedByMoveOperation(e);case"split":return[this._getTransformedBySplitOperation(e)];case"merge":return[this._getTransformedByMergeOperation(e)]}return[new St(this.start,this.end)]}getTransformedByOperations(e){const t=[new St(this.start,this.end)];for(const i of e)for(let e=0;e<t.length;e++){const n=t[e].getTransformedByOperation(i);t.splice(e,1,...n),e+=n.length-1}for(let e=0;e<t.length;e++){const i=t[e];for(let n=e+1;n<t.length;n++){const e=t[n];(i.containsRange(e)||e.containsRange(i)||i.isEqual(e))&&t.splice(n,1)}}return t}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;const e=this.start.nodeAfter,t=this.end.nodeBefore;return e&&e.is("element")&&e===t?e:null}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}clone(){return new this.constructor(this.start,this.end)}_getTransformedByInsertOperation(e,t=!1){return this._getTransformedByInsertion(e.position,e.howMany,t)}_getTransformedByMoveOperation(e,t=!1){const i=e.sourcePosition,n=e.howMany,o=e.targetPosition;return this._getTransformedByMove(i,o,n,t)}_getTransformedBySplitOperation(e){const t=this.start._getTransformedBySplitOperation(e);let i=this.end._getTransformedBySplitOperation(e);return this.end.isEqual(e.insertionPosition)&&(i=this.end.getShiftedBy(1)),t.root!=i.root&&(i=this.end.getShiftedBy(-1)),new St(t,i)}_getTransformedByMergeOperation(e){if(this.start.isEqual(e.targetPosition)&&this.end.isEqual(e.deletionPosition))return new St(this.start);let t=this.start._getTransformedByMergeOperation(e),i=this.end._getTransformedByMergeOperation(e);return t.root!=i.root&&(i=this.end.getShiftedBy(-1)),t.isAfter(i)?(e.sourcePosition.isBefore(e.targetPosition)?(t=At._createAt(i),t.offset=0):(e.deletionPosition.isEqual(t)||(i=e.deletionPosition),t=e.targetPosition),new St(t,i)):new St(t,i)}_getTransformedByInsertion(e,t,i=!1){if(i&&this.containsPosition(e))return[new St(this.start,e),new St(e.getShiftedBy(t),this.end._getTransformedByInsertion(e,t))];{const i=new St(this.start,this.end);return i.start=i.start._getTransformedByInsertion(e,t),i.end=i.end._getTransformedByInsertion(e,t),[i]}}_getTransformedByMove(e,t,i,n=!1){if(this.isCollapsed){const n=this.start._getTransformedByMove(e,t,i);return[new St(n)]}const o=St._createFromPositionAndShift(e,i),s=t._getTransformedByDeletion(e,i);if(this.containsPosition(t)&&!n&&(o.containsPosition(this.start)||o.containsPosition(this.end))){const n=this.start._getTransformedByMove(e,t,i),o=this.end._getTransformedByMove(e,t,i);return[new St(n,o)]}let r;const a=this.getDifference(o);let l=null;const c=this.getIntersection(o);if(1==a.length?l=new St(a[0].start._getTransformedByDeletion(e,i),a[0].end._getTransformedByDeletion(e,i)):2==a.length&&(l=new St(this.start,this.end._getTransformedByDeletion(e,i))),r=l?l._getTransformedByInsertion(s,i,null!==c||n):[],c){const e=new St(c.start._getCombined(o.start,s),c.end._getCombined(o.start,s));2==r.length?r.splice(1,0,e):r.push(e)}return r}_getTransformedByDeletion(e,t){let i=this.start._getTransformedByDeletion(e,t),n=this.end._getTransformedByDeletion(e,t);return null==i&&null==n?null:(null==i&&(i=e),null==n&&(n=e),new St(i,n))}static _createFromPositionAndShift(e,t){const i=e,n=e.getShiftedBy(t);return t>0?new this(i,n):new this(n,i)}static _createIn(e){return new this(At._createAt(e,0),At._createAt(e,e.maxOffset))}static _createOn(e){return this._createFromPositionAndShift(At._createBefore(e),e.offsetSize)}static _createFromRanges(e){if(0===e.length)throw new n.CKEditorError("range-create-from-ranges-empty-array",null);if(1==e.length)return e[0].clone();const t=e[0];e.sort(((e,t)=>e.start.isAfter(t.start)?1:-1));const i=e.indexOf(t),o=new this(t.start,t.end);if(i>0)for(let t=i-1;e[t].end.isEqual(o.start);t++)o.start=At._createAt(e[t].start);for(let t=i+1;t<e.length&&e[t].start.isEqual(o.end);t++)o.end=At._createAt(e[t].end);return o}static fromJSON(e,t){return new this(At.fromJSON(e.start,t),At.fromJSON(e.end,t))}}St.prototype.is=function(e){return"range"===e||"model:range"===e};class Vt extends((0,n.EmitterMixin)()){constructor(){super(),this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._viewToModelLengthCallbacks=new Map,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._deferredBindingRemovals=new Map,this._unboundMarkerNames=new Set,this.on("modelToViewPosition",((e,t)=>{if(t.viewPosition)return;const i=this._modelToViewMapping.get(t.modelPosition.parent);if(!i)throw new n.CKEditorError("mapping-model-position-view-parent-not-found",this,{modelPosition:t.modelPosition});t.viewPosition=this.findPositionIn(i,t.modelPosition.offset)}),{priority:"low"}),this.on("viewToModelPosition",((e,t)=>{if(t.modelPosition)return;const i=this.findMappedViewAncestor(t.viewPosition),n=this._viewToModelMapping.get(i),o=this._toModelOffset(t.viewPosition.parent,t.viewPosition.offset,i);t.modelPosition=At._createAt(n,o)}),{priority:"low"})}bindElements(e,t){this._modelToViewMapping.set(e,t),this._viewToModelMapping.set(t,e)}unbindViewElement(e,t={}){const i=this.toModelElement(e);if(this._elementToMarkerNames.has(e))for(const t of this._elementToMarkerNames.get(e))this._unboundMarkerNames.add(t);t.defer?this._deferredBindingRemovals.set(e,e.root):(this._viewToModelMapping.delete(e),this._modelToViewMapping.get(i)==e&&this._modelToViewMapping.delete(i))}unbindModelElement(e){const t=this.toViewElement(e);this._modelToViewMapping.delete(e),this._viewToModelMapping.get(t)==e&&this._viewToModelMapping.delete(t)}bindElementToMarker(e,t){const i=this._markerNameToElements.get(t)||new Set;i.add(e);const n=this._elementToMarkerNames.get(e)||new Set;n.add(t),this._markerNameToElements.set(t,i),this._elementToMarkerNames.set(e,n)}unbindElementFromMarkerName(e,t){const i=this._markerNameToElements.get(t);i&&(i.delete(e),0==i.size&&this._markerNameToElements.delete(t));const n=this._elementToMarkerNames.get(e);n&&(n.delete(t),0==n.size&&this._elementToMarkerNames.delete(e))}flushUnboundMarkerNames(){const e=Array.from(this._unboundMarkerNames);return this._unboundMarkerNames.clear(),e}flushDeferredBindings(){for(const[e,t]of this._deferredBindingRemovals)e.root==t&&this.unbindViewElement(e);this._deferredBindingRemovals=new Map}clearBindings(){this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._unboundMarkerNames=new Set,this._deferredBindingRemovals=new Map}toModelElement(e){return this._viewToModelMapping.get(e)}toViewElement(e){return this._modelToViewMapping.get(e)}toModelRange(e){return new St(this.toModelPosition(e.start),this.toModelPosition(e.end))}toViewRange(e){return new G(this.toViewPosition(e.start),this.toViewPosition(e.end))}toModelPosition(e){const t={viewPosition:e,mapper:this};return this.fire("viewToModelPosition",t),t.modelPosition}toViewPosition(e,t={}){const i={modelPosition:e,mapper:this,isPhantom:t.isPhantom};return this.fire("modelToViewPosition",i),i.viewPosition}markerNameToElements(e){const t=this._markerNameToElements.get(e);if(!t)return null;const i=new Set;for(const e of t)if(e.is("attributeElement"))for(const t of e.getElementsWithSameId())i.add(t);else i.add(e);return i}registerViewToModelLength(e,t){this._viewToModelLengthCallbacks.set(e,t)}findMappedViewAncestor(e){let t=e.parent;for(;!this._viewToModelMapping.has(t);)t=t.parent;return t}_toModelOffset(e,t,i){if(i!=e)return this._toModelOffset(e.parent,e.index,i)+this._toModelOffset(e,t,e);if(e.is("$text"))return t;let n=0;for(let i=0;i<t;i++)n+=this.getModelLength(e.getChild(i));return n}getModelLength(e){if(this._viewToModelLengthCallbacks.get(e.name))return this._viewToModelLengthCallbacks.get(e.name)(e);if(this._viewToModelMapping.has(e))return 1;if(e.is("$text"))return e.data.length;if(e.is("uiElement"))return 0;{let t=0;for(const i of e.getChildren())t+=this.getModelLength(i);return t}}findPositionIn(e,t){let i,n=0,o=0,s=0;if(e.is("$text"))return new K(e,t);for(;o<t;)i=e.getChild(s),n=this.getModelLength(i),o+=n,s++;return o==t?this._moveViewPositionToTextNode(new K(e,s)):this.findPositionIn(i,t-(o-n))}_moveViewPositionToTextNode(e){const t=e.nodeBefore,i=e.nodeAfter;return t instanceof w?new K(t,t.data.length):i instanceof w?new K(i,0):e}}class Rt{constructor(){this._consumable=new Map,this._textProxyRegistry=new Map}add(e,t){t=Bt(t),e instanceof _t&&(e=this._getSymbolForTextProxy(e)),this._consumable.has(e)||this._consumable.set(e,new Map),this._consumable.get(e).set(t,!0)}consume(e,t){return t=Bt(t),e instanceof _t&&(e=this._getSymbolForTextProxy(e)),!!this.test(e,t)&&(this._consumable.get(e).set(t,!1),!0)}test(e,t){t=Bt(t),e instanceof _t&&(e=this._getSymbolForTextProxy(e));const i=this._consumable.get(e);if(void 0===i)return null;const n=i.get(t);return void 0===n?null:n}revert(e,t){t=Bt(t),e instanceof _t&&(e=this._getSymbolForTextProxy(e));const i=this.test(e,t);return!1===i?(this._consumable.get(e).set(t,!0),!0):!0!==i&&null}verifyAllConsumed(e){const t=[];for(const[i,n]of this._consumable)for(const[o,s]of n){const n=o.split(":")[0];s&&e==n&&t.push({event:o,item:i.name||i.description})}if(t.length)throw new n.CKEditorError("conversion-model-consumable-not-consumed",null,{items:t})}_getSymbolForTextProxy(e){let t=null;const i=this._textProxyRegistry.get(e.startOffset);if(i){const n=i.get(e.endOffset);n&&(t=n.get(e.parent))}return t||(t=this._addSymbolForTextProxy(e)),t}_addSymbolForTextProxy(e){const t=e.startOffset,i=e.endOffset,n=e.parent,o=Symbol("$textProxy:"+e.data);let s,r;return s=this._textProxyRegistry.get(t),s||(s=new Map,this._textProxyRegistry.set(t,s)),r=s.get(i),r||(r=new Map,s.set(i,r)),r.set(n,o),o}}function Bt(e){const t=e.split(":");return"insert"==t[0]?t[0]:"addMarker"==t[0]||"removeMarker"==t[0]?e:t.length>1?t[0]+":"+t[1]:t[0]}class Mt extends((0,n.EmitterMixin)()){constructor(e){super(),this._conversionApi={dispatcher:this,...e},this._firedEventsMap=new WeakMap}convertChanges(e,t,i){const n=this._createConversionApi(i,e.getRefreshedItems());for(const t of e.getMarkersToRemove())this._convertMarkerRemove(t.name,t.range,n);const o=this._reduceChanges(e.getChanges());for(const e of o)"insert"===e.type?this._convertInsert(St._createFromPositionAndShift(e.position,e.length),n):"reinsert"===e.type?this._convertReinsert(St._createFromPositionAndShift(e.position,e.length),n):"remove"===e.type?this._convertRemove(e.position,e.length,e.name,n):this._convertAttribute(e.range,e.attributeKey,e.attributeOldValue,e.attributeNewValue,n);n.mapper.flushDeferredBindings();for(const e of n.mapper.flushUnboundMarkerNames()){const i=t.get(e).getRange();this._convertMarkerRemove(e,i,n),this._convertMarkerAdd(e,i,n)}for(const t of e.getMarkersToAdd())this._convertMarkerAdd(t.name,t.range,n);n.consumable.verifyAllConsumed("insert")}convert(e,t,i,n={}){const o=this._createConversionApi(i,void 0,n);this._convertInsert(e,o);for(const[e,i]of t)this._convertMarkerAdd(e,i,o);o.consumable.verifyAllConsumed("insert")}convertSelection(e,t,i){const n=this._createConversionApi(i);this.fire("cleanSelection",{selection:e},n);const o=e.getFirstPosition().root;if(!n.mapper.toViewElement(o))return;const s=Array.from(t.getMarkersAtPosition(e.getFirstPosition()));if(this._addConsumablesForSelection(n.consumable,e,s),this.fire("selection",{selection:e},n),e.isCollapsed){for(const t of s)if(n.consumable.test(e,"addMarker:"+t.name)){const i=t.getRange();if(!Ot(e.getFirstPosition(),t,n.mapper))continue;const o={item:e,markerName:t.name,markerRange:i};this.fire(`addMarker:${t.name}`,o,n)}for(const t of e.getAttributeKeys())if(n.consumable.test(e,"attribute:"+t)){const i={item:e,range:e.getFirstRange(),attributeKey:t,attributeOldValue:null,attributeNewValue:e.getAttribute(t)};this.fire(`attribute:${t}:$text`,i,n)}}}_convertInsert(e,t,i={}){i.doNotAddConsumables||this._addConsumablesForInsert(t.consumable,e);for(const i of Array.from(e.getWalker({shallow:!0})).map(Lt))this._testAndFire("insert",i,t)}_convertRemove(e,t,i,n){this.fire(`remove:${i}`,{position:e,length:t},n)}_convertAttribute(e,t,i,n,o){this._addConsumablesForRange(o.consumable,e,`attribute:${t}`);for(const s of e){const e={item:s.item,range:St._createFromPositionAndShift(s.previousPosition,s.length),attributeKey:t,attributeOldValue:i,attributeNewValue:n};this._testAndFire(`attribute:${t}`,e,o)}}_convertReinsert(e,t){const i=Array.from(e.getWalker({shallow:!0}));this._addConsumablesForInsert(t.consumable,i);for(const e of i.map(Lt))this._testAndFire("insert",{...e,reconversion:!0},t)}_convertMarkerAdd(e,t,i){if("$graveyard"==t.root.rootName)return;const n=`addMarker:${e}`;if(i.consumable.add(t,n),this.fire(n,{markerName:e,markerRange:t},i),i.consumable.consume(t,n)){this._addConsumablesForRange(i.consumable,t,n);for(const o of t.getItems()){if(!i.consumable.test(o,n))continue;const s={item:o,range:St._createOn(o),markerName:e,markerRange:t};this.fire(n,s,i)}}}_convertMarkerRemove(e,t,i){"$graveyard"!=t.root.rootName&&this.fire(`removeMarker:${e}`,{markerName:e,markerRange:t},i)}_reduceChanges(e){const t={changes:e};return this.fire("reduceChanges",t),t.changes}_addConsumablesForInsert(e,t){for(const i of t){const t=i.item;if(null===e.test(t,"insert")){e.add(t,"insert");for(const i of t.getAttributeKeys())e.add(t,"attribute:"+i)}}return e}_addConsumablesForRange(e,t,i){for(const n of t.getItems())e.add(n,i);return e}_addConsumablesForSelection(e,t,i){e.add(t,"selection");for(const n of i)e.add(t,"addMarker:"+n.name);for(const i of t.getAttributeKeys())e.add(t,"attribute:"+i);return e}_testAndFire(e,t,i){const n=function(e,t){return`${e}:${t.item.is("element")?t.item.name:"$text"}`}(e,t),o=t.item.is("$textProxy")?i.consumable._getSymbolForTextProxy(t.item):t.item,s=this._firedEventsMap.get(i),r=s.get(o);if(r){if(r.has(n))return;r.add(n)}else s.set(o,new Set([n]));this.fire(n,t,i)}_testAndFireAddAttributes(e,t){const i={item:e,range:St._createOn(e)};for(const e of i.item.getAttributeKeys())i.attributeKey=e,i.attributeOldValue=null,i.attributeNewValue=i.item.getAttribute(e),this._testAndFire(`attribute:${e}`,i,t)}_createConversionApi(e,t=new Set,i={}){const n={...this._conversionApi,consumable:new Rt,writer:e,options:i,convertItem:e=>this._convertInsert(St._createOn(e),n),convertChildren:e=>this._convertInsert(St._createIn(e),n,{doNotAddConsumables:!0}),convertAttributes:e=>this._testAndFireAddAttributes(e,n),canReuseView:e=>!t.has(n.mapper.toModelElement(e))};return this._firedEventsMap.set(n,new Map),n}}function Ot(e,t,i){const n=t.getRange(),o=Array.from(e.getAncestors());return o.shift(),o.reverse(),!o.some((e=>{if(n.containsItem(e))return!!i.toViewElement(e).getCustomProperty("addHighlight")}))}function Lt(e){return{item:e.item,range:St._createFromPositionAndShift(e.previousPosition,e.length)}}class Ft extends((0,n.EmitterMixin)(pt)){constructor(...e){super(),this._lastRangeBackward=!1,this._attrs=new Map,this._ranges=[],e.length&&this.setTo(...e)}get anchor(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.end:e.start}return null}get focus(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.start:e.end}return null}get isCollapsed(){return 1===this._ranges.length&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}isEqual(e){if(this.rangeCount!=e.rangeCount)return!1;if(0===this.rangeCount)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let i=!1;for(const n of e._ranges)if(t.isEqual(n)){i=!0;break}if(!i)return!1}return!0}*getRanges(){for(const e of this._ranges)yield new St(e.start,e.end)}getFirstRange(){let e=null;for(const t of this._ranges)e&&!t.start.isBefore(e.start)||(e=t);return e?new St(e.start,e.end):null}getLastRange(){let e=null;for(const t of this._ranges)e&&!t.end.isAfter(e.end)||(e=t);return e?new St(e.start,e.end):null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}setTo(...e){let[t,i,o]=e;if("object"==typeof i&&(o=i,i=void 0),null===t)this._setRanges([]);else if(t instanceof Ft)this._setRanges(t.getRanges(),t.isBackward);else if(t&&"function"==typeof t.getRanges)this._setRanges(t.getRanges(),t.isBackward);else if(t instanceof St)this._setRanges([t],!!o&&!!o.backward);else if(t instanceof At)this._setRanges([new St(t)]);else if(t instanceof bt){const e=!!o&&!!o.backward;let s;if("in"==i)s=St._createIn(t);else if("on"==i)s=St._createOn(t);else{if(void 0===i)throw new n.CKEditorError("model-selection-setto-required-second-parameter",[this,t]);s=new St(At._createAt(t,i))}this._setRanges([s],e)}else{if(!(0,n.isIterable)(t))throw new n.CKEditorError("model-selection-setto-not-selectable",[this,t]);this._setRanges(t,o&&!!o.backward)}}_setRanges(e,t=!1){const i=Array.from(e),o=i.some((t=>{if(!(t instanceof St))throw new n.CKEditorError("model-selection-set-ranges-not-range",[this,e]);return this._ranges.every((e=>!e.isEqual(t)))}));(i.length!==this._ranges.length||o)&&(this._replaceAllRanges(i),this._lastRangeBackward=!!t,this.fire("change:range",{directChange:!0}))}setFocus(e,t){if(null===this.anchor)throw new n.CKEditorError("model-selection-setfocus-no-ranges",[this,e]);const i=At._createAt(e,t);if("same"==i.compareWith(this.focus))return;const o=this.anchor;this._ranges.length&&this._popRange(),"before"==i.compareWith(o)?(this._pushRange(new St(i,o)),this._lastRangeBackward=!0):(this._pushRange(new St(o,i)),this._lastRangeBackward=!1),this.fire("change:range",{directChange:!0})}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}hasAttribute(e){return this._attrs.has(e)}removeAttribute(e){this.hasAttribute(e)&&(this._attrs.delete(e),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}setAttribute(e,t){this.getAttribute(e)!==t&&(this._attrs.set(e,t),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}*getSelectedBlocks(){const e=new WeakSet;for(const t of this.getRanges()){const i=zt(t.start,e);Ht(i,t)&&(yield i);for(const i of t.getWalker()){const n=i.item;"elementEnd"==i.type&&Dt(n,e,t)&&(yield n)}const n=zt(t.end,e);Ut(n,t)&&(yield n)}}containsEntireContent(e=this.anchor.root){const t=At._createAt(e,0),i=At._createAt(e,"end");return t.isTouching(this.getFirstPosition())&&i.isTouching(this.getLastPosition())}_pushRange(e){this._checkRange(e),this._ranges.push(new St(e.start,e.end))}_checkRange(e){for(let t=0;t<this._ranges.length;t++)if(e.isIntersecting(this._ranges[t]))throw new n.CKEditorError("model-selection-range-intersects",[this,e],{addedRange:e,intersectingRange:this._ranges[t]})}_replaceAllRanges(e){this._removeAllRanges();for(const t of e)this._pushRange(t)}_removeAllRanges(){for(;this._ranges.length>0;)this._popRange()}_popRange(){this._ranges.pop()}}function Nt(e,t){return!t.has(e)&&(t.add(e),e.root.document.model.schema.isBlock(e)&&!!e.parent)}function Dt(e,t,i){return Nt(e,t)&&Wt(e,i)}function zt(e,t){const i=e.parent.root.document.model.schema,n=e.parent.getAncestors({parentFirst:!0,includeSelf:!0});let o=!1;const s=n.find((e=>!o&&(o=i.isLimit(e),!o&&Nt(e,t))));return n.forEach((e=>t.add(e))),s}function Wt(e,t){const i=function(e){const t=e.root.document.model.schema;let i=e.parent;for(;i;){if(t.isBlock(i))return i;i=i.parent}}(e);return!i||!t.containsRange(St._createOn(i),!0)}function Ht(e,t){return!!e&&(!(!t.isCollapsed&&!e.isEmpty)||!t.start.isTouching(At._createAt(e,e.maxOffset))&&Wt(e,t))}function Ut(e,t){return!!e&&(!(!t.isCollapsed&&!e.isEmpty)||!t.end.isTouching(At._createAt(e,0))&&Wt(e,t))}Ft.prototype.is=function(e){return"selection"===e||"model:selection"===e};class $t extends((0,n.EmitterMixin)(St)){constructor(e,t){super(e,t),jt.call(this)}detach(){this.stopListening()}toRange(){return new St(this.start,this.end)}static fromRange(e){return new $t(e.start,e.end)}}function jt(){this.listenTo(this.root.document.model,"applyOperation",((e,t)=>{const i=t[0];i.isDocumentOperation&&qt.call(this,i)}),{priority:"low"})}function qt(e){const t=this.getTransformedByOperation(e),i=St._createFromRanges(t),n=!i.isEqual(this),o=function(e,t){switch(t.type){case"insert":return e.containsPosition(t.position);case"move":case"remove":case"reinsert":case"merge":return e.containsPosition(t.sourcePosition)||e.start.isEqual(t.sourcePosition)||e.containsPosition(t.targetPosition);case"split":return e.containsPosition(t.splitPosition)||e.containsPosition(t.insertionPosition)}return!1}(this,e);let s=null;if(n){"$graveyard"==i.root.rootName&&(s="remove"==e.type?e.sourcePosition:e.deletionPosition);const t=this.toRange();this.start=i.start,this.end=i.end,this.fire("change:range",t,{deletionPosition:s})}else o&&this.fire("change:content",this.toRange(),{deletionPosition:s})}$t.prototype.is=function(e){return"liveRange"===e||"model:liveRange"===e||"range"==e||"model:range"===e};const Kt="selection:";class Gt extends((0,n.EmitterMixin)(pt)){constructor(e){super(),this._selection=new Zt(e),this._selection.delegate("change:range").to(this),this._selection.delegate("change:attribute").to(this),this._selection.delegate("change:marker").to(this)}get isCollapsed(){return this._selection.isCollapsed}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get rangeCount(){return this._selection.rangeCount}get hasOwnRange(){return this._selection.hasOwnRange}get isBackward(){return this._selection.isBackward}get isGravityOverridden(){return this._selection.isGravityOverridden}get markers(){return this._selection.markers}get _ranges(){return this._selection._ranges}getRanges(){return this._selection.getRanges()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getSelectedBlocks(){return this._selection.getSelectedBlocks()}getSelectedElement(){return this._selection.getSelectedElement()}containsEntireContent(e){return this._selection.containsEntireContent(e)}destroy(){this._selection.destroy()}getAttributeKeys(){return this._selection.getAttributeKeys()}getAttributes(){return this._selection.getAttributes()}getAttribute(e){return this._selection.getAttribute(e)}hasAttribute(e){return this._selection.hasAttribute(e)}refresh(){this._selection.updateMarkers(),this._selection._updateAttributes(!1)}observeMarkers(e){this._selection.observeMarkers(e)}_setFocus(e,t){this._selection.setFocus(e,t)}_setTo(...e){this._selection.setTo(...e)}_setAttribute(e,t){this._selection.setAttribute(e,t)}_removeAttribute(e){this._selection.removeAttribute(e)}_getStoredAttributes(){return this._selection.getStoredAttributes()}_overrideGravity(){return this._selection.overrideGravity()}_restoreGravity(e){this._selection.restoreGravity(e)}static _getStoreAttributeKey(e){return Kt+e}static _isStoreAttributeKey(e){return e.startsWith(Kt)}}Gt.prototype.is=function(e){return"selection"===e||"model:selection"==e||"documentSelection"==e||"model:documentSelection"==e};class Zt extends Ft{constructor(e){super(),this.markers=new n.Collection({idProperty:"name"}),this._attributePriority=new Map,this._selectionRestorePosition=null,this._hasChangedRange=!1,this._overriddenGravityRegister=new Set,this._observedMarkers=new Set,this._model=e.model,this._document=e,this.listenTo(this._model,"applyOperation",((e,t)=>{const i=t[0];i.isDocumentOperation&&"marker"!=i.type&&"rename"!=i.type&&"noop"!=i.type&&(0==this._ranges.length&&this._selectionRestorePosition&&this._fixGraveyardSelection(this._selectionRestorePosition),this._selectionRestorePosition=null,this._hasChangedRange&&(this._hasChangedRange=!1,this.fire("change:range",{directChange:!1})))}),{priority:"lowest"}),this.on("change:range",(()=>{this._validateSelectionRanges(this.getRanges())})),this.listenTo(this._model.markers,"update",((e,t,i,n)=>{this._updateMarker(t,n)})),this.listenTo(this._document,"change",((e,t)=>{!function(e,t){const i=e.document.differ;for(const n of i.getChanges()){if("insert"!=n.type)continue;const i=n.position.parent;n.length===i.maxOffset&&e.enqueueChange(t,(e=>{const t=Array.from(i.getAttributeKeys()).filter((e=>e.startsWith(Kt)));for(const n of t)e.removeAttribute(n,i)}))}}(this._model,t)}))}get isCollapsed(){return 0===this._ranges.length?this._document._getDefaultRange().isCollapsed:super.isCollapsed}get anchor(){return super.anchor||this._document._getDefaultRange().start}get focus(){return super.focus||this._document._getDefaultRange().end}get rangeCount(){return this._ranges.length?this._ranges.length:1}get hasOwnRange(){return this._ranges.length>0}get isGravityOverridden(){return!!this._overriddenGravityRegister.size}destroy(){for(let e=0;e<this._ranges.length;e++)this._ranges[e].detach();this.stopListening()}*getRanges(){this._ranges.length?yield*super.getRanges():yield this._document._getDefaultRange()}getFirstRange(){return super.getFirstRange()||this._document._getDefaultRange()}getLastRange(){return super.getLastRange()||this._document._getDefaultRange()}setTo(...e){super.setTo(...e),this._updateAttributes(!0),this.updateMarkers()}setFocus(e,t){super.setFocus(e,t),this._updateAttributes(!0),this.updateMarkers()}setAttribute(e,t){if(this._setAttribute(e,t)){const t=[e];this.fire("change:attribute",{attributeKeys:t,directChange:!0})}}removeAttribute(e){if(this._removeAttribute(e)){const t=[e];this.fire("change:attribute",{attributeKeys:t,directChange:!0})}}overrideGravity(){const e=(0,n.uid)();return this._overriddenGravityRegister.add(e),1===this._overriddenGravityRegister.size&&this._updateAttributes(!0),e}restoreGravity(e){if(!this._overriddenGravityRegister.has(e))throw new n.CKEditorError("document-selection-gravity-wrong-restore",this,{uid:e});this._overriddenGravityRegister.delete(e),this.isGravityOverridden||this._updateAttributes(!0)}observeMarkers(e){this._observedMarkers.add(e),this.updateMarkers()}_replaceAllRanges(e){this._validateSelectionRanges(e),super._replaceAllRanges(e)}_popRange(){this._ranges.pop().detach()}_pushRange(e){const t=this._prepareRange(e);t&&this._ranges.push(t)}_validateSelectionRanges(e){for(const t of e)if(!this._document._validateSelectionRange(t))throw new n.CKEditorError("document-selection-wrong-position",this,{range:t})}_prepareRange(e){if(this._checkRange(e),e.root==this._document.graveyard)return;const t=$t.fromRange(e);return t.on("change:range",((e,i,n)=>{if(this._hasChangedRange=!0,t.root==this._document.graveyard){this._selectionRestorePosition=n.deletionPosition;const e=this._ranges.indexOf(t);this._ranges.splice(e,1),t.detach()}})),t}updateMarkers(){if(!this._observedMarkers.size)return;const e=[];let t=!1;for(const t of this._model.markers){const i=t.name.split(":",1)[0];if(!this._observedMarkers.has(i))continue;const n=t.getRange();for(const i of this.getRanges())n.containsRange(i,!i.isCollapsed)&&e.push(t)}const i=Array.from(this.markers);for(const i of e)this.markers.has(i)||(this.markers.add(i),t=!0);for(const i of Array.from(this.markers))e.includes(i)||(this.markers.remove(i),t=!0);t&&this.fire("change:marker",{oldMarkers:i,directChange:!1})}_updateMarker(e,t){const i=e.name.split(":",1)[0];if(!this._observedMarkers.has(i))return;let n=!1;const o=Array.from(this.markers),s=this.markers.has(e);if(t){let i=!1;for(const e of this.getRanges())if(t.containsRange(e,!e.isCollapsed)){i=!0;break}i&&!s?(this.markers.add(e),n=!0):!i&&s&&(this.markers.remove(e),n=!0)}else s&&(this.markers.remove(e),n=!0);n&&this.fire("change:marker",{oldMarkers:o,directChange:!1})}_updateAttributes(e){const t=(0,n.toMap)(this._getSurroundingAttributes()),i=(0,n.toMap)(this.getAttributes());if(e)this._attributePriority=new Map,this._attrs=new Map;else for(const[e,t]of this._attributePriority)"low"==t&&(this._attrs.delete(e),this._attributePriority.delete(e));this._setAttributesTo(t);const o=[];for(const[e,t]of this.getAttributes())i.has(e)&&i.get(e)===t||o.push(e);for(const[e]of i)this.hasAttribute(e)||o.push(e);o.length>0&&this.fire("change:attribute",{attributeKeys:o,directChange:!1})}_setAttribute(e,t,i=!0){const n=i?"normal":"low";return("low"!=n||"normal"!=this._attributePriority.get(e))&&(super.getAttribute(e)!==t&&(this._attrs.set(e,t),this._attributePriority.set(e,n),!0))}_removeAttribute(e,t=!0){const i=t?"normal":"low";return!("low"==i&&"normal"==this._attributePriority.get(e)||(this._attributePriority.set(e,i),!super.hasAttribute(e)||(this._attrs.delete(e),0)))}_setAttributesTo(e){const t=new Set;for(const[t,i]of this.getAttributes())e.get(t)!==i&&this._removeAttribute(t,!1);for(const[i,n]of e)this._setAttribute(i,n,!1)&&t.add(i);return t}*getStoredAttributes(){const e=this.getFirstPosition().parent;if(this.isCollapsed&&e.isEmpty)for(const t of e.getAttributeKeys())if(t.startsWith(Kt)){const i=t.substr(10);yield[i,e.getAttribute(t)]}}_getSurroundingAttributes(){const e=this.getFirstPosition(),t=this._model.schema;if("$graveyard"==e.root.rootName)return null;let i=null;if(this.isCollapsed){const n=e.textNode?e.textNode:e.nodeBefore,o=e.textNode?e.textNode:e.nodeAfter;if(this.isGravityOverridden||(i=Jt(n,t)),i||(i=Jt(o,t)),!this.isGravityOverridden&&!i){let e=n;for(;e&&!i;)e=e.previousSibling,i=Jt(e,t)}if(!i){let e=o;for(;e&&!i;)e=e.nextSibling,i=Jt(e,t)}i||(i=this.getStoredAttributes())}else{const e=this.getFirstRange();for(const n of e){if(n.item.is("element")&&t.isObject(n.item)){i=Jt(n.item,t);break}if("text"==n.type){i=n.item.getAttributes();break}}}return i}_fixGraveyardSelection(e){const t=this._model.schema.getNearestSelectionRange(e);t&&this._pushRange(t)}}function Jt(e,t){if(!e)return null;if(e instanceof _t||e instanceof vt)return e.getAttributes();if(!t.isInline(e))return null;if(!t.isObject(e))return[];const i=[];for(const[n,o]of e.getAttributes())t.checkAttribute("$text",n)&&!1!==t.getAttributeProperties(n).copyFromObject&&i.push([n,o]);return i}class Qt{constructor(e){this._dispatchers=e}add(e){for(const t of this._dispatchers)e(t);return this}}class Yt extends Qt{elementToElement(e){return this.add(function(e){const t=oi(e.model),i=si(e.view,"container");return t.attributes.length&&(t.children=!0),n=>{n.on(`insert:${t.name}`,ti(i,di(t)),{priority:e.converterPriority||"normal"}),(t.children||t.attributes.length)&&n.on("reduceChanges",ci(t),{priority:"low"})}}(e))}elementToStructure(e){return this.add(function(e){const t=oi(e.model),i=si(e.view,"container");return t.children=!0,o=>{if(o._conversionApi.schema.checkChild(t.name,"$text"))throw new n.CKEditorError("conversion-element-to-structure-disallowed-text",o,{elementName:t.name});var s,r;o.on(`insert:${t.name}`,(s=i,r=di(t),(e,t,i)=>{if(!r(t.item,i.consumable,{preflight:!0}))return;const o=new Map;i.writer._registerSlotFactory(function(e,t,i){return(o,s)=>{const r=o.createContainerElement("$slot");let a=null;if("children"===s)a=Array.from(e.getChildren());else{if("function"!=typeof s)throw new n.CKEditorError("conversion-slot-mode-unknown",i.dispatcher,{modeOrFilter:s});a=Array.from(e.getChildren()).filter((e=>s(e)))}return t.set(r,a),r}}(t.item,o,i));const a=s(t.item,i,t);if(i.writer._clearSlotFactory(),!a)return;!function(e,t,i){const o=Array.from(t.values()).flat(),s=new Set(o);if(s.size!=o.length)throw new n.CKEditorError("conversion-slot-filter-overlap",i.dispatcher,{element:e});if(s.size!=e.childCount)throw new n.CKEditorError("conversion-slot-filter-incomplete",i.dispatcher,{element:e})}(t.item,o,i),r(t.item,i.consumable);const l=i.mapper.toViewPosition(t.range.start);i.mapper.bindElements(t.item,a),i.writer.insert(l,a),i.convertAttributes(t.item),function(e,t,i,n){i.mapper.on("modelToViewPosition",r,{priority:"highest"});let o=null,s=null;for([o,s]of t)ui(e,s,i,n),i.writer.move(i.writer.createRangeIn(o),i.writer.createPositionBefore(o)),i.writer.remove(o);function r(e,t){const i=t.modelPosition.nodeAfter,n=s.indexOf(i);n<0||(t.viewPosition=t.mapper.findPositionIn(o,n))}i.mapper.off("modelToViewPosition",r)}(a,o,i,{reconversion:t.reconversion})}),{priority:e.converterPriority||"normal"}),o.on("reduceChanges",ci(t),{priority:"low"})}}(e))}attributeToElement(e){return this.add(function(e){let t=(e=(0,gt.A)(e)).model;"string"==typeof t&&(t={key:t});let i=`attribute:${t.key}`;if(t.name&&(i+=":"+t.name),t.values)for(const i of t.values)e.view[i]=si(e.view[i],"attribute");else e.view=si(e.view,"attribute");const n=ri(e);return t=>{t.on(i,ei(n),{priority:e.converterPriority||"normal"})}}(e))}attributeToAttribute(e){return this.add(function(e){let t=(e=(0,gt.A)(e)).model;"string"==typeof t&&(t={key:t});let i=`attribute:${t.key}`;if(t.name&&(i+=":"+t.name),t.values)for(const i of t.values)e.view[i]=ai(e.view[i]);else e.view=ai(e.view);const o=ri(e);return t=>{var s;t.on(i,(s=o,(e,t,i)=>{if(!i.consumable.test(t.item,e.name))return;const o=s(t.attributeOldValue,i,t),r=s(t.attributeNewValue,i,t);if(!o&&!r)return;i.consumable.consume(t.item,e.name);const a=i.mapper.toViewElement(t.item),l=i.writer;if(!a)throw new n.CKEditorError("conversion-attribute-to-attribute-on-text",i.dispatcher,t);if(null!==t.attributeOldValue&&o)if("class"==o.key){const e="string"==typeof o.value?o.value.split(/\s+/):o.value;for(const t of e)l.removeClass(t,a)}else if("style"==o.key)if("string"==typeof o.value){const e=new O(l.document.stylesProcessor);e.setTo(o.value);for(const[t]of e.getStylesEntries())l.removeStyle(t,a)}else{const e=Object.keys(o.value);for(const t of e)l.removeStyle(t,a)}else l.removeAttribute(o.key,a);if(null!==t.attributeNewValue&&r)if("class"==r.key){const e="string"==typeof r.value?r.value.split(/\s+/):r.value;for(const t of e)l.addClass(t,a)}else if("style"==r.key)if("string"==typeof r.value){const e=new O(l.document.stylesProcessor);e.setTo(r.value);for(const[t,i]of e.getStylesEntries())l.setStyle(t,i,a)}else{const e=Object.keys(r.value);for(const t of e)l.setStyle(t,r.value[t],a)}else l.setAttribute(r.key,r.value,a)}),{priority:e.converterPriority||"normal"})}}(e))}markerToElement(e){return this.add(function(e){const t=si(e.view,"ui");return i=>{i.on(`addMarker:${e.model}`,ii(t),{priority:e.converterPriority||"normal"}),i.on(`removeMarker:${e.model}`,((e,t,i)=>{const n=i.mapper.markerNameToElements(t.markerName);if(n){for(const e of n)i.mapper.unbindElementFromMarkerName(e,t.markerName),i.writer.clear(i.writer.createRangeOn(e),e);i.writer.clearClonedElementsGroup(t.markerName),e.stop()}}),{priority:e.converterPriority||"normal"})}}(e))}markerToHighlight(e){return this.add(function(e){return t=>{var i;t.on(`addMarker:${e.model}`,(i=e.view,(e,t,n)=>{if(!t.item)return;if(!(t.item instanceof Ft||t.item instanceof Gt||t.item.is("$textProxy")))return;const o=li(i,t,n);if(!o)return;if(!n.consumable.consume(t.item,e.name))return;const s=n.writer,r=Xt(s,o),a=s.document.selection;if(t.item instanceof Ft||t.item instanceof Gt)s.wrap(a.getFirstRange(),r);else{const e=n.mapper.toViewRange(t.range),i=s.wrap(e,r);for(const e of i.getItems())if(e.is("attributeElement")&&e.isSimilar(r)){n.mapper.bindElementToMarker(e,t.markerName);break}}}),{priority:e.converterPriority||"normal"}),t.on(`addMarker:${e.model}`,function(e){return(t,i,n)=>{if(!i.item)return;if(!(i.item instanceof yt))return;const o=li(e,i,n);if(!o)return;if(!n.consumable.test(i.item,t.name))return;const s=n.mapper.toViewElement(i.item);if(s&&s.getCustomProperty("addHighlight")){n.consumable.consume(i.item,t.name);for(const e of St._createIn(i.item))n.consumable.consume(e.item,t.name);s.getCustomProperty("addHighlight")(s,o,n.writer),n.mapper.bindElementToMarker(s,i.markerName)}}}(e.view),{priority:e.converterPriority||"normal"}),t.on(`removeMarker:${e.model}`,function(e){return(t,i,n)=>{if(i.markerRange.isCollapsed)return;const o=li(e,i,n);if(!o)return;const s=Xt(n.writer,o),r=n.mapper.markerNameToElements(i.markerName);if(r){for(const e of r)n.mapper.unbindElementFromMarkerName(e,i.markerName),e.is("attributeElement")?n.writer.unwrap(n.writer.createRangeOn(e),s):e.getCustomProperty("removeHighlight")(e,o.id,n.writer);n.writer.clearClonedElementsGroup(i.markerName),t.stop()}}}(e.view),{priority:e.converterPriority||"normal"})}}(e))}markerToData(e){return this.add(function(e){const t=(e=(0,gt.A)(e)).model;let i=e.view;return i||(i=i=>({group:t,name:i.substr(e.model.length+1)})),n=>{var o;n.on(`addMarker:${t}`,(o=i,(e,t,i)=>{const n=o(t.markerName,i);if(!n)return;const s=t.markerRange;i.consumable.consume(s,e.name)&&(ni(s,!1,i,t,n),ni(s,!0,i,t,n),e.stop())}),{priority:e.converterPriority||"normal"}),n.on(`removeMarker:${t}`,function(e){return(t,i,n)=>{const o=e(i.markerName,n);if(!o)return;const s=n.mapper.markerNameToElements(i.markerName);if(s){for(const e of s)n.mapper.unbindElementFromMarkerName(e,i.markerName),e.is("containerElement")?(r(`data-${o.group}-start-before`,e),r(`data-${o.group}-start-after`,e),r(`data-${o.group}-end-before`,e),r(`data-${o.group}-end-after`,e)):n.writer.clear(n.writer.createRangeOn(e),e);n.writer.clearClonedElementsGroup(i.markerName),t.stop()}function r(e,t){if(t.hasAttribute(e)){const i=new Set(t.getAttribute(e).split(","));i.delete(o.name),0==i.size?n.writer.removeAttribute(e,t):n.writer.setAttribute(e,Array.from(i).join(","),t)}}}}(i),{priority:e.converterPriority||"normal"})}}(e))}}function Xt(e,t){const i=e.createAttributeElement("span",t.attributes);return t.classes&&i._addClass(t.classes),"number"==typeof t.priority&&(i._priority=t.priority),i._id=t.id,i}function ei(e){return(t,i,n)=>{if(!n.consumable.test(i.item,t.name))return;const o=e(i.attributeOldValue,n,i),s=e(i.attributeNewValue,n,i);if(!o&&!s)return;n.consumable.consume(i.item,t.name);const r=n.writer,a=r.document.selection;if(i.item instanceof Ft||i.item instanceof Gt)r.wrap(a.getFirstRange(),s);else{let e=n.mapper.toViewRange(i.range);null!==i.attributeOldValue&&o&&(e=r.unwrap(e,o)),null!==i.attributeNewValue&&s&&r.wrap(e,s)}}}function ti(e,t=mi){return(i,n,o)=>{if(!t(n.item,o.consumable,{preflight:!0}))return;const s=e(n.item,o,n);if(!s)return;t(n.item,o.consumable);const r=o.mapper.toViewPosition(n.range.start);o.mapper.bindElements(n.item,s),o.writer.insert(r,s),o.convertAttributes(n.item),ui(s,n.item.getChildren(),o,{reconversion:n.reconversion})}}function ii(e){return(t,i,n)=>{i.isOpening=!0;const o=e(i,n);i.isOpening=!1;const s=e(i,n);if(!o||!s)return;const r=i.markerRange;if(r.isCollapsed&&!n.consumable.consume(r,t.name))return;for(const e of r)if(!n.consumable.consume(e.item,t.name))return;const a=n.mapper,l=n.writer;l.insert(a.toViewPosition(r.start),o),n.mapper.bindElementToMarker(o,i.markerName),r.isCollapsed||(l.insert(a.toViewPosition(r.end),s),n.mapper.bindElementToMarker(s,i.markerName)),t.stop()}}function ni(e,t,i,n,o){const s=t?e.start:e.end,r=s.nodeAfter&&s.nodeAfter.is("element")?s.nodeAfter:null,a=s.nodeBefore&&s.nodeBefore.is("element")?s.nodeBefore:null;if(r||a){let e,s;t&&r||!t&&!a?(e=r,s=!0):(e=a,s=!1);const l=i.mapper.toViewElement(e);if(l)return void function(e,t,i,n,o,s){const r=`data-${s.group}-${t?"start":"end"}-${i?"before":"after"}`,a=e.hasAttribute(r)?e.getAttribute(r).split(","):[];a.unshift(s.name),n.writer.setAttribute(r,a.join(","),e),n.mapper.bindElementToMarker(e,o.markerName)}(l,t,s,i,n,o)}!function(e,t,i,n,o){const s=`${o.group}-${t?"start":"end"}`,r=o.name?{name:o.name}:null,a=i.writer.createUIElement(s,r);i.writer.insert(e,a),i.mapper.bindElementToMarker(a,n.markerName)}(i.mapper.toViewPosition(s),t,i,n,o)}function oi(e){return"string"==typeof e&&(e={name:e}),{name:e.name,attributes:e.attributes?(0,n.toArray)(e.attributes):[],children:!!e.children}}function si(e,t){return"function"==typeof e?e:(i,n)=>function(e,t,i){let n;"string"==typeof e&&(e={name:e});const o=t.writer,s=Object.assign({},e.attributes);if("container"==i)n=o.createContainerElement(e.name,s);else if("attribute"==i){const t={priority:e.priority||ae.DEFAULT_PRIORITY};n=o.createAttributeElement(e.name,s,t)}else n=o.createUIElement(e.name,s);if(e.styles){const t=Object.keys(e.styles);for(const i of t)o.setStyle(i,e.styles[i],n)}if(e.classes){const t=e.classes;if("string"==typeof t)o.addClass(t,n);else for(const e of t)o.addClass(e,n)}return n}(e,n,t)}function ri(e){return e.model.values?(t,i,n)=>{const o=e.view[t];return o?o(t,i,n):null}:e.view}function ai(e){return"string"==typeof e?t=>({key:e,value:t}):"object"==typeof e?e.value?()=>e:t=>({key:e.key,value:t}):e}function li(e,t,i){const n="function"==typeof e?e(t,i):e;return n?(n.priority||(n.priority=10),n.id||(n.id=t.markerName),n):null}function ci(e){const t=function(e){return(t,i)=>{if(!t.is("element",e.name))return!1;if("attribute"==i.type){if(e.attributes.includes(i.attributeKey))return!0}else if(e.children)return!0;return!1}}(e);return(e,i)=>{const n=[];i.reconvertedElements||(i.reconvertedElements=new Set);for(const e of i.changes){const o="attribute"==e.type?e.range.start.nodeAfter:e.position.parent;if(o&&t(o,e)){if(!i.reconvertedElements.has(o)){i.reconvertedElements.add(o);const e=At._createBefore(o);let t=n.length;for(let i=n.length-1;i>=0;i--){const o=n[i],s=("attribute"==o.type?o.range.start:o.position).compareWith(e);if("before"==s||"remove"==o.type&&"same"==s)break;t=i}n.splice(t,0,{type:"remove",name:o.name,position:e,length:1},{type:"reinsert",name:o.name,position:e,length:1})}}else n.push(e)}i.changes=n}}function di(e){return(t,i,n={})=>{const o=["insert"];for(const i of e.attributes)t.hasAttribute(i)&&o.push(`attribute:${i}`);return!!o.every((e=>i.test(t,e)))&&(n.preflight||o.forEach((e=>i.consume(t,e))),!0)}}function ui(e,t,i,n){for(const o of t)hi(e.root,o,i,n)||i.convertItem(o)}function hi(e,t,i,n){const{writer:o,mapper:s}=i;if(!n.reconversion)return!1;const r=s.toViewElement(t);return!(!r||r.root==e||!i.canReuseView(r)||(o.move(o.createRangeOn(r),s.toViewPosition(At._createBefore(t))),0))}function mi(e,t,{preflight:i}={}){return i?t.test(e,"insert"):t.consume(e,"insert")}function gi(e){const{schema:t,document:i}=e.model;for(const n of i.getRoots())if(n.isEmpty&&!t.checkChild(n,"$text")&&t.checkChild(n,"paragraph"))return e.insertElement("paragraph",n),!0;return!1}function fi(e,t,i){const n=i.createContext(e);return!!i.checkChild(n,"paragraph")&&!!i.checkChild(n.push("paragraph"),t)}function pi(e,t){const i=t.createElement("paragraph");return t.insert(i,e),t.createPositionAt(i,0)}class bi extends Qt{elementToElement(e){return this.add(wi(e))}elementToAttribute(e){return this.add(function(e){yi(e=(0,gt.A)(e));const t=ki(e,!1),i=vi(e.view),n=i?`element:${i}`:"element";return i=>{i.on(n,t,{priority:e.converterPriority||"low"})}}(e))}attributeToAttribute(e){return this.add(function(e){let t=null;("string"==typeof(e=(0,gt.A)(e)).view||e.view.key)&&(t=function(e){"string"==typeof e.view&&(e.view={key:e.view});const t=e.view.key,i=void 0===e.view.value?/[\s\S]*/:e.view.value;let n;return n="class"==t||"style"==t?{["class"==t?"classes":"styles"]:i}:{attributes:{[t]:i}},e.view.name&&(n.name=e.view.name),e.view=n,t}(e)),yi(e,t);const i=ki(e,!0);return t=>{t.on("element",i,{priority:e.converterPriority||"low"})}}(e))}elementToMarker(e){return this.add(function(e){const t=function(e){return(t,i)=>{const n="string"==typeof e?e:e(t,i);return i.writer.createElement("$marker",{"data-name":n})}}(e.model);return wi({...e,model:t})}(e))}dataToMarker(e){return this.add(function(e){(e=(0,gt.A)(e)).model||(e.model=t=>t?e.view+":"+t:e.view);const t={view:e.view,model:e.model},i=_i(Ci(t,"start")),o=_i(Ci(t,"end"));return s=>{s.on(`element:${e.view}-start`,i,{priority:e.converterPriority||"normal"}),s.on(`element:${e.view}-end`,o,{priority:e.converterPriority||"normal"});const r=n.priorities.low,a=n.priorities.highest,l=n.priorities.get(e.converterPriority)/a;s.on("element",function(e){return(t,i,n)=>{const o=`data-${e.view}`;function s(t,o){for(const s of o){const o=e.model(s,n),r=n.writer.createElement("$marker",{"data-name":o});n.writer.insert(r,t),i.modelCursor.isEqual(t)?i.modelCursor=i.modelCursor.getShiftedBy(1):i.modelCursor=i.modelCursor._getTransformedByInsertion(t,1),i.modelRange=i.modelRange._getTransformedByInsertion(t,1)[0]}}(n.consumable.test(i.viewItem,{attributes:o+"-end-after"})||n.consumable.test(i.viewItem,{attributes:o+"-start-after"})||n.consumable.test(i.viewItem,{attributes:o+"-end-before"})||n.consumable.test(i.viewItem,{attributes:o+"-start-before"}))&&(i.modelRange||Object.assign(i,n.convertChildren(i.viewItem,i.modelCursor)),n.consumable.consume(i.viewItem,{attributes:o+"-end-after"})&&s(i.modelRange.end,i.viewItem.getAttribute(o+"-end-after").split(",")),n.consumable.consume(i.viewItem,{attributes:o+"-start-after"})&&s(i.modelRange.end,i.viewItem.getAttribute(o+"-start-after").split(",")),n.consumable.consume(i.viewItem,{attributes:o+"-end-before"})&&s(i.modelRange.start,i.viewItem.getAttribute(o+"-end-before").split(",")),n.consumable.consume(i.viewItem,{attributes:o+"-start-before"})&&s(i.modelRange.start,i.viewItem.getAttribute(o+"-start-before").split(",")))}}(t),{priority:r+l})}}(e))}}function wi(e){const t=_i(e=(0,gt.A)(e)),i=vi(e.view),n=i?`element:${i}`:"element";return i=>{i.on(n,t,{priority:e.converterPriority||"normal"})}}function vi(e){return"string"==typeof e?e:"object"==typeof e&&"string"==typeof e.name?e.name:null}function _i(e){const t=new y(e.view);return(i,n,o)=>{const s=t.match(n.viewItem);if(!s)return;const r=s.match;if(r.name=!0,!o.consumable.test(n.viewItem,r))return;const a=function(e,t,i){return e instanceof Function?e(t,i):i.writer.createElement(e)}(e.model,n.viewItem,o);a&&o.safeInsert(a,n.modelCursor)&&(o.consumable.consume(n.viewItem,r),o.convertChildren(n.viewItem,a),o.updateConversionResult(a,n))}}function yi(e,t=null){const i=null===t||(e=>e.getAttribute(t)),n="object"!=typeof e.model?e.model:e.model.key,o="object"!=typeof e.model||void 0===e.model.value?i:e.model.value;e.model={key:n,value:o}}function ki(e,t){const i=new y(e.view);return(n,o,s)=>{if(!o.modelRange&&t)return;const r=i.match(o.viewItem);if(!r)return;if(function(e,t){const i="function"==typeof e?e(t):e;return!("object"==typeof i&&!vi(i))&&(!i.classes&&!i.attributes&&!i.styles)}(e.view,o.viewItem)?r.match.name=!0:delete r.match.name,!s.consumable.test(o.viewItem,r.match))return;const a=e.model.key,l="function"==typeof e.model.value?e.model.value(o.viewItem,s):e.model.value;if(null===l)return;o.modelRange||Object.assign(o,s.convertChildren(o.viewItem,o.modelCursor));const c=function(e,t,i,n){let o=!1;for(const s of Array.from(e.getItems({shallow:i})))n.schema.checkAttribute(s,t.key)&&(o=!0,s.hasAttribute(t.key)||n.writer.setAttribute(t.key,t.value,s));return o}(o.modelRange,{key:a,value:l},t,s);c&&(s.consumable.test(o.viewItem,{name:!0})&&(r.match.name=!0),s.consumable.consume(o.viewItem,r.match))}}function Ci(e,t){return{view:`${e.view}-${t}`,model:(t,i)=>{const n=t.getAttribute("name"),o=e.model(n,i);return i.writer.createElement("$marker",{"data-name":o})}}}function Ai(e,t){return e.isCollapsed?function(e,t){const i=e.start,n=t.getNearestSelectionRange(i);if(!n){const e=i.getAncestors().reverse().find((e=>t.isObject(e)));return e?St._createOn(e):null}if(!n.isCollapsed)return n;const o=n.start;return i.isEqual(o)?null:new St(o)}(e,t):function(e,t){const{start:i,end:n}=e,o=t.checkChild(i,"$text"),s=t.checkChild(n,"$text"),r=t.getLimitElement(i),a=t.getLimitElement(n);if(r===a){if(o&&s)return null;if(function(e,t,i){const n=e.nodeAfter&&!i.isLimit(e.nodeAfter)||i.checkChild(e,"$text"),o=t.nodeBefore&&!i.isLimit(t.nodeBefore)||i.checkChild(t,"$text");return n||o}(i,n,t)){const e=i.nodeAfter&&t.isSelectable(i.nodeAfter)?null:t.getNearestSelectionRange(i,"forward"),o=n.nodeBefore&&t.isSelectable(n.nodeBefore)?null:t.getNearestSelectionRange(n,"backward"),s=e?e.start:i,r=o?o.end:n;return new St(s,r)}}const l=r&&!r.is("rootElement"),c=a&&!a.is("rootElement");if(l||c){const e=i.nodeAfter&&n.nodeBefore&&i.nodeAfter.parent===n.nodeBefore.parent,o=l&&(!e||!xi(i.nodeAfter,t)),s=c&&(!e||!xi(n.nodeBefore,t));let d=i,u=n;return o&&(d=At._createBefore(Ei(r,t))),s&&(u=At._createAfter(Ei(a,t))),new St(d,u)}return null}(e,t)}function Ei(e,t){let i=e,n=i;for(;t.isLimit(n)&&n.parent;)i=n,n=n.parent;return i}function xi(e,t){return e&&t.isSelectable(e)}class Ti extends((0,n.ObservableMixin)()){constructor(e,t){super(),this.model=e,this.view=new ft(t),this.mapper=new Vt,this.downcastDispatcher=new Mt({mapper:this.mapper,schema:e.schema});const i=this.model.document,o=i.selection,s=this.model.markers;var r,a,l;this.listenTo(this.model,"_beforeChanges",(()=>{this.view._disableRendering(!0)}),{priority:"highest"}),this.listenTo(this.model,"_afterChanges",(()=>{this.view._disableRendering(!1)}),{priority:"lowest"}),this.listenTo(i,"change",(()=>{this.view.change((e=>{this.downcastDispatcher.convertChanges(i.differ,s,e),this.downcastDispatcher.convertSelection(o,s,e)}))}),{priority:"low"}),this.listenTo(this.view.document,"selectionChange",function(e,t){return(i,n)=>{const o=n.newSelection,s=[];for(const e of o.getRanges())s.push(t.toModelRange(e));const r=e.createSelection(s,{backward:o.isBackward});r.isEqual(e.document.selection)||e.change((e=>{e.setSelection(r)}))}}(this.model,this.mapper)),this.listenTo(this.view.document,"beforeinput",(r=this.mapper,a=this.model.schema,l=this.view,(e,t)=>{if(!l.document.isComposing||n.env.isAndroid)for(let e=0;e<t.targetRanges.length;e++){const i=t.targetRanges[e],n=r.toModelRange(i),o=Ai(n,a);o&&!o.isEqual(n)&&(t.targetRanges[e]=r.toViewRange(o))}}),{priority:"high"}),this.downcastDispatcher.on("insert:$text",((e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const n=i.writer,o=i.mapper.toViewPosition(t.range.start),s=n.createText(t.item.data);n.insert(o,s)}),{priority:"lowest"}),this.downcastDispatcher.on("insert",((e,t,i)=>{i.convertAttributes(t.item),t.reconversion||!t.item.is("element")||t.item.isEmpty||i.convertChildren(t.item)}),{priority:"lowest"}),this.downcastDispatcher.on("remove",((e,t,i)=>{const n=i.mapper.toViewPosition(t.position),o=t.position.getShiftedBy(t.length),s=i.mapper.toViewPosition(o,{isPhantom:!0}),r=i.writer.createRange(n,s),a=i.writer.remove(r.getTrimmed());for(const e of i.writer.createRangeIn(a).getItems())i.mapper.unbindViewElement(e,{defer:!0})}),{priority:"low"}),this.downcastDispatcher.on("cleanSelection",((e,t,i)=>{const n=i.writer,o=n.document.selection;for(const e of o.getRanges())e.isCollapsed&&e.end.parent.isAttached()&&i.writer.mergeAttributes(e.start);n.setSelection(null)})),this.downcastDispatcher.on("selection",((e,t,i)=>{const n=t.selection;if(n.isCollapsed)return;if(!i.consumable.consume(n,"selection"))return;const o=[];for(const e of n.getRanges())o.push(i.mapper.toViewRange(e));i.writer.setSelection(o,{backward:n.isBackward})}),{priority:"low"}),this.downcastDispatcher.on("selection",((e,t,i)=>{const n=t.selection;if(!n.isCollapsed)return;if(!i.consumable.consume(n,"selection"))return;const o=i.writer,s=n.getFirstPosition(),r=i.mapper.toViewPosition(s),a=o.breakAttributes(r);o.setSelection(a)}),{priority:"low"}),this.view.document.roots.bindTo(this.model.document.roots).using((e=>{if("$graveyard"==e.rootName)return null;const t=new j(this.view.document,e.name);return t.rootName=e.rootName,this.mapper.bindElements(e,t),t}))}destroy(){this.view.destroy(),this.stopListening()}reconvertMarker(e){const t="string"==typeof e?e:e.name,i=this.model.markers.get(t);if(!i)throw new n.CKEditorError("editingcontroller-reconvertmarker-marker-not-exist",this,{markerName:t});this.model.change((()=>{this.model.markers._refresh(i)}))}reconvertItem(e){this.model.change((()=>{this.model.document.differ._refreshItem(e)}))}}class Pi{constructor(){this._consumables=new Map}add(e,t){let i;e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):(this._consumables.has(e)?i=this._consumables.get(e):(i=new Si(e),this._consumables.set(e,i)),i.add(t))}test(e,t){const i=this._consumables.get(e);return void 0===i?null:e.is("$text")||e.is("documentFragment")?i:i.test(t)}consume(e,t){return!!this.test(e,t)&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!1):this._consumables.get(e).consume(t),!0)}revert(e,t){const i=this._consumables.get(e);void 0!==i&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):i.revert(t))}static consumablesFromElement(e){const t={element:e,name:!0,attributes:[],classes:[],styles:[]},i=e.getAttributeKeys();for(const e of i)"style"!=e&&"class"!=e&&t.attributes.push(e);const n=e.getClassNames();for(const e of n)t.classes.push(e);const o=e.getStyleNames();for(const e of o)t.styles.push(e);return t}static createFrom(e,t){if(t||(t=new Pi),e.is("$text"))return t.add(e),t;e.is("element")&&t.add(e,Pi.consumablesFromElement(e)),e.is("documentFragment")&&t.add(e);for(const i of e.getChildren())t=Pi.createFrom(i,t);return t}}const Ii=["attributes","classes","styles"];class Si{constructor(e){this.element=e,this._canConsumeName=null,this._consumables={attributes:new Map,styles:new Map,classes:new Map}}add(e){e.name&&(this._canConsumeName=!0);for(const t of Ii)t in e&&this._add(t,e[t])}test(e){if(e.name&&!this._canConsumeName)return this._canConsumeName;for(const t of Ii)if(t in e){const i=this._test(t,e[t]);if(!0!==i)return i}return!0}consume(e){e.name&&(this._canConsumeName=!1);for(const t of Ii)t in e&&this._consume(t,e[t])}revert(e){e.name&&(this._canConsumeName=!0);for(const t of Ii)t in e&&this._revert(t,e[t])}_add(e,t){const i=(0,n.toArray)(t),o=this._consumables[e];for(const t of i){if("attributes"===e&&("class"===t||"style"===t))throw new n.CKEditorError("viewconsumable-invalid-attribute",this);if(o.set(t,!0),"styles"===e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(t))o.set(e,!0)}}_test(e,t){const i=(0,n.toArray)(t),o=this._consumables[e];for(const t of i)if("attributes"!==e||"class"!==t&&"style"!==t){const e=o.get(t);if(void 0===e)return null;if(!e)return!1}else{const e="class"==t?"classes":"styles",i=this._test(e,[...this._consumables[e].keys()]);if(!0!==i)return i}return!0}_consume(e,t){const i=(0,n.toArray)(t),o=this._consumables[e];for(const t of i)if("attributes"!==e||"class"!==t&&"style"!==t){if(o.set(t,!1),"styles"==e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(t))o.set(e,!1)}else{const e="class"==t?"classes":"styles";this._consume(e,[...this._consumables[e].keys()])}}_revert(e,t){const i=(0,n.toArray)(t),o=this._consumables[e];for(const t of i)if("attributes"!==e||"class"!==t&&"style"!==t)!1===o.get(t)&&o.set(t,!0);else{const e="class"==t?"classes":"styles";this._revert(e,[...this._consumables[e].keys()])}}}class Vi extends((0,n.ObservableMixin)()){constructor(){super(),this._sourceDefinitions={},this._attributeProperties={},this._customChildChecks=new Map,this._customAttributeChecks=new Map,this._genericCheckSymbol=Symbol("$generic"),this.decorate("checkChild"),this.decorate("checkAttribute"),this.on("checkAttribute",((e,t)=>{t[0]=new Ri(t[0])}),{priority:"highest"}),this.on("checkChild",((e,t)=>{t[0]=new Ri(t[0]),t[1]=this.getDefinition(t[1])}),{priority:"highest"})}register(e,t){if(this._sourceDefinitions[e])throw new n.CKEditorError("schema-cannot-register-item-twice",this,{itemName:e});this._sourceDefinitions[e]=[Object.assign({},t)],this._clearCache()}extend(e,t){if(!this._sourceDefinitions[e])throw new n.CKEditorError("schema-cannot-extend-missing-item",this,{itemName:e});this._sourceDefinitions[e].push(Object.assign({},t)),this._clearCache()}getDefinitions(){return this._compiledDefinitions||this._compile(),this._compiledDefinitions}getDefinition(e){let t;return t="string"==typeof e?e:"is"in e&&(e.is("$text")||e.is("$textProxy"))?"$text":e.name,this.getDefinitions()[t]}isRegistered(e){return!!this.getDefinition(e)}isBlock(e){const t=this.getDefinition(e);return!(!t||!t.isBlock)}isLimit(e){const t=this.getDefinition(e);return!(!t||!t.isLimit&&!t.isObject)}isObject(e){const t=this.getDefinition(e);return!!t&&!!(t.isObject||t.isLimit&&t.isSelectable&&t.isContent)}isInline(e){const t=this.getDefinition(e);return!(!t||!t.isInline)}isSelectable(e){const t=this.getDefinition(e);return!(!t||!t.isSelectable&&!t.isObject)}isContent(e){const t=this.getDefinition(e);return!(!t||!t.isContent&&!t.isObject)}checkChild(e,t){return!!t&&this._checkContextMatch(e,t)}checkAttribute(e,t){const i=this.getDefinition(e.last);if(!i)return!1;const n=this._evaluateAttributeChecks(e,t);return void 0!==n?n:i.allowAttributes.includes(t)}checkMerge(e,t){if(e instanceof At){const t=e.nodeBefore,i=e.nodeAfter;if(!(t instanceof yt))throw new n.CKEditorError("schema-check-merge-no-element-before",this);if(!(i instanceof yt))throw new n.CKEditorError("schema-check-merge-no-element-after",this);return this.checkMerge(t,i)}if(this.isLimit(e)||this.isLimit(t))return!1;for(const i of t.getChildren())if(!this.checkChild(e,i))return!1;return!0}addChildCheck(e,t){const i=void 0!==t?t:this._genericCheckSymbol,n=this._customChildChecks.get(i)||[];n.push(e),this._customChildChecks.set(i,n)}addAttributeCheck(e,t){const i=void 0!==t?t:this._genericCheckSymbol,n=this._customAttributeChecks.get(i)||[];n.push(e),this._customAttributeChecks.set(i,n)}setAttributeProperties(e,t){this._attributeProperties[e]=Object.assign(this.getAttributeProperties(e),t)}getAttributeProperties(e){return this._attributeProperties[e]||{}}getLimitElement(e){let t;for(t=e instanceof At?e.parent:(e instanceof St?[e]:Array.from(e.getRanges())).reduce(((e,t)=>{const i=t.getCommonAncestor();return e?e.getCommonAncestor(i,{includeSelf:!0}):i}),null);!this.isLimit(t)&&t.parent;)t=t.parent;return t}checkAttributeInSelection(e,t){if(e.isCollapsed){const i=[...e.getFirstPosition().getAncestors(),new vt("",e.getAttributes())];return this.checkAttribute(i,t)}{const i=e.getRanges();for(const e of i)for(const i of e)if(this.checkAttribute(i.item,t))return!0}return!1}*getValidRanges(e,t){e=function*(e){for(const t of e)yield*t.getMinimalFlatRanges()}(e);for(const i of e)yield*this._getValidRangesForRange(i,t)}getNearestSelectionRange(e,t="both"){if("$graveyard"==e.root.rootName)return null;if(this.checkChild(e,"$text"))return new St(e);let i,n;const o=e.getAncestors().reverse().find((e=>this.isLimit(e)))||e.root;"both"!=t&&"backward"!=t||(i=new kt({boundaries:St._createIn(o),startPosition:e,direction:"backward"})),"both"!=t&&"forward"!=t||(n=new kt({boundaries:St._createIn(o),startPosition:e}));for(const e of function*(e,t){let i=!1;for(;!i;){if(i=!0,e){const t=e.next();t.done||(i=!1,yield{walker:e,value:t.value})}if(t){const e=t.next();e.done||(i=!1,yield{walker:t,value:e.value})}}}(i,n)){const t=e.walker==i?"elementEnd":"elementStart",n=e.value;if(n.type==t&&this.isObject(n.item))return St._createOn(n.item);if(this.checkChild(n.nextPosition,"$text"))return new St(n.nextPosition)}return null}findAllowedParent(e,t){let i=e.parent;for(;i;){if(this.checkChild(i,t))return i;if(this.isLimit(i))return null;i=i.parent}return null}setAllowedAttributes(e,t,i){const n=i.model;for(const[o,s]of Object.entries(t))n.schema.checkAttribute(e,o)&&i.setAttribute(o,s,e)}removeDisallowedAttributes(e,t){for(const i of e)if(i.is("$text"))ji(this,i,t);else{const e=St._createIn(i).getPositions();for(const i of e)ji(this,i.nodeBefore||i.parent,t)}}getAttributesWithProperty(e,t,i){const n={};for(const[o,s]of e.getAttributes()){const e=this.getAttributeProperties(o);void 0!==e[t]&&(void 0!==i&&i!==e[t]||(n[o]=s))}return n}createContext(e){return new Ri(e)}_clearCache(){this._compiledDefinitions=null}_compile(){const e={},t=this._sourceDefinitions,i=Object.keys(t);for(const n of i)e[n]=Bi(t[n],n);const n=Object.values(e);for(const t of n)Mi(e,t),Oi(e,t),Li(e,t),Fi(e,t);for(const e of n)Ni(0,e);for(const t of n)Di(e,t);for(const t of n)zi(e,t);for(const t of n)Wi(e,t);for(const t of n)Hi(e,t);this._compiledDefinitions=function(e){const t={};for(const i of Object.values(e))t[i.name]={name:i.name,isBlock:!!i.isBlock,isContent:!!i.isContent,isInline:!!i.isInline,isLimit:!!i.isLimit,isObject:!!i.isObject,isSelectable:!!i.isSelectable,allowIn:Array.from(i.allowIn).filter((t=>!!e[t])),allowChildren:Array.from(i.allowChildren).filter((t=>!!e[t])),allowAttributes:Array.from(i.allowAttributes)};return t}(e)}_checkContextMatch(e,t){const i=e.last;let n=this._evaluateChildChecks(e,t);if(n=void 0!==n?n:t.allowIn.includes(i.name),!n)return!1;const o=this.getDefinition(i),s=e.trimLast();return!!o&&(0==s.length||this._checkContextMatch(s,o))}_evaluateChildChecks(e,t){const i=this._customChildChecks.get(this._genericCheckSymbol)||[],n=this._customChildChecks.get(t.name)||[];for(const o of[...i,...n]){const i=o(e,t);if(void 0!==i)return i}}_evaluateAttributeChecks(e,t){const i=this._customAttributeChecks.get(this._genericCheckSymbol)||[],n=this._customAttributeChecks.get(t)||[];for(const o of[...i,...n]){const i=o(e,t);if(void 0!==i)return i}}*_getValidRangesForRange(e,t){let i=e.start,n=e.start;for(const o of e.getItems({shallow:!0}))o.is("element")&&(yield*this._getValidRangesForRange(St._createIn(o),t)),this.checkAttribute(o,t)||(i.isEqual(n)||(yield new St(i,n)),i=At._createAfter(o)),n=At._createAfter(o);i.isEqual(n)||(yield new St(i,n))}findOptimalInsertionRange(e,t){const i=e.getSelectedElement();if(i&&this.isObject(i)&&!this.isInline(i))return"before"==t||"after"==t?new St(At._createAt(i,t)):St._createOn(i);const o=(0,n.first)(e.getSelectedBlocks());if(!o)return new St(e.focus);if(o.isEmpty)return new St(At._createAt(o,0));const s=At._createAfter(o);return e.focus.isTouching(s)?new St(s):new St(At._createBefore(o))}}class Ri{constructor(e){if(e instanceof Ri)return e;let t;t="string"==typeof e?[e]:Array.isArray(e)?e:e.getAncestors({includeSelf:!0}),this._items=t.map($i)}get length(){return this._items.length}get last(){return this._items[this._items.length-1]}[Symbol.iterator](){return this._items[Symbol.iterator]()}push(e){const t=new Ri([e]);return t._items=[...this._items,...t._items],t}trimLast(){const e=new Ri([]);return e._items=this._items.slice(0,-1),e}getItem(e){return this._items[e]}*getNames(){yield*this._items.map((e=>e.name))}endsWith(e){return Array.from(this.getNames()).join(" ").endsWith(e)}startsWith(e){return Array.from(this.getNames()).join(" ").startsWith(e)}}function Bi(e,t){const i={name:t,allowIn:new Set,allowChildren:new Set,disallowIn:new Set,disallowChildren:new Set,allowContentOf:new Set,allowWhere:new Set,allowAttributes:new Set,disallowAttributes:new Set,allowAttributesOf:new Set,inheritTypesFrom:new Set};return function(e,t){for(const i of e){const e=Object.keys(i).filter((e=>e.startsWith("is")));for(const n of e)t[n]=!!i[n]}}(e,i),Ui(e,i,"allowIn"),Ui(e,i,"allowChildren"),Ui(e,i,"disallowIn"),Ui(e,i,"disallowChildren"),Ui(e,i,"allowContentOf"),Ui(e,i,"allowWhere"),Ui(e,i,"allowAttributes"),Ui(e,i,"disallowAttributes"),Ui(e,i,"allowAttributesOf"),Ui(e,i,"inheritTypesFrom"),function(e,t){for(const i of e){const e=i.inheritAllFrom;e&&(t.allowContentOf.add(e),t.allowWhere.add(e),t.allowAttributesOf.add(e),t.inheritTypesFrom.add(e))}}(e,i),i}function Mi(e,t){for(const i of t.allowIn){const n=e[i];n?n.allowChildren.add(t.name):t.allowIn.delete(i)}}function Oi(e,t){for(const i of t.allowChildren){const n=e[i];n?n.allowIn.add(t.name):t.allowChildren.delete(i)}}function Li(e,t){for(const i of t.disallowIn){const n=e[i];n?n.disallowChildren.add(t.name):t.disallowIn.delete(i)}}function Fi(e,t){for(const i of t.disallowChildren){const n=e[i];n?n.disallowIn.add(t.name):t.disallowChildren.delete(i)}}function Ni(e,t){for(const e of t.disallowChildren)t.allowChildren.delete(e);for(const e of t.disallowIn)t.allowIn.delete(e);for(const e of t.disallowAttributes)t.allowAttributes.delete(e)}function Di(e,t){for(const i of t.allowContentOf){const n=e[i];n&&(n.disallowChildren.forEach((i=>{t.allowChildren.has(i)||(t.disallowChildren.add(i),e[i].disallowIn.add(t.name))})),n.allowChildren.forEach((i=>{t.disallowChildren.has(i)||(t.allowChildren.add(i),e[i].allowIn.add(t.name))})))}}function zi(e,t){for(const i of t.allowWhere){const n=e[i];n&&(n.disallowIn.forEach((i=>{t.allowIn.has(i)||(t.disallowIn.add(i),e[i].disallowChildren.add(t.name))})),n.allowIn.forEach((i=>{t.disallowIn.has(i)||(t.allowIn.add(i),e[i].allowChildren.add(t.name))})))}}function Wi(e,t){for(const i of t.allowAttributesOf){const n=e[i];if(!n)return;n.allowAttributes.forEach((e=>{t.disallowAttributes.has(e)||t.allowAttributes.add(e)}))}}function Hi(e,t){for(const i of t.inheritTypesFrom){const n=e[i];if(n){const e=Object.keys(n).filter((e=>e.startsWith("is")));for(const i of e)i in t||(t[i]=n[i])}}}function Ui(e,t,i){for(const n of e){let e=n[i];"string"==typeof e&&(e=[e]),Array.isArray(e)&&e.forEach((e=>t[i].add(e)))}}function $i(e){return"string"==typeof e||e.is("documentFragment")?{name:"string"==typeof e?e:"$documentFragment",*getAttributeKeys(){},getAttribute(){}}:{name:e.is("element")?e.name:"$text",*getAttributeKeys(){yield*e.getAttributeKeys()},getAttribute:t=>e.getAttribute(t)}}function ji(e,t,i){for(const n of t.getAttributeKeys())e.checkAttribute(t,n)||i.removeAttribute(n,t)}class qi extends((0,n.EmitterMixin)()){constructor(e){super(),this._splitParts=new Map,this._cursorParents=new Map,this._modelCursor=null,this._emptyElementsToKeep=new Set,this.conversionApi={...e,consumable:null,writer:null,store:null,convertItem:(e,t)=>this._convertItem(e,t),convertChildren:(e,t)=>this._convertChildren(e,t),safeInsert:(e,t)=>this._safeInsert(e,t),updateConversionResult:(e,t)=>this._updateConversionResult(e,t),splitToAllowedParent:(e,t)=>this._splitToAllowedParent(e,t),getSplitParts:e=>this._getSplitParts(e),keepEmptyElement:e=>this._keepEmptyElement(e)}}convert(e,t,i=["$root"]){this.fire("viewCleanup",e),this._modelCursor=function(e,t){let i;for(const n of new Ri(e)){const e={};for(const t of n.getAttributeKeys())e[t]=n.getAttribute(t);const o=t.createElement(n.name,e);i&&t.insert(o,i),i=At._createAt(o,0)}return i}(i,t),this.conversionApi.writer=t,this.conversionApi.consumable=Pi.createFrom(e),this.conversionApi.store={};const{modelRange:n}=this._convertItem(e,this._modelCursor),o=t.createDocumentFragment();if(n){this._removeEmptyElements();for(const e of Array.from(this._modelCursor.parent.getChildren()))t.append(e,o);o.markers=function(e,t){const i=new Set,n=new Map,o=St._createIn(e).getItems();for(const e of o)e.is("element","$marker")&&i.add(e);for(const e of i){const i=e.getAttribute("data-name"),o=t.createPositionBefore(e);n.has(i)?n.get(i).end=o.clone():n.set(i,new St(o.clone())),t.remove(e)}return n}(o,t)}return this._modelCursor=null,this._splitParts.clear(),this._cursorParents.clear(),this._emptyElementsToKeep.clear(),this.conversionApi.writer=null,this.conversionApi.store=null,o}_convertItem(e,t){const i={viewItem:e,modelCursor:t,modelRange:null};if(e.is("element")?this.fire(`element:${e.name}`,i,this.conversionApi):e.is("$text")?this.fire("text",i,this.conversionApi):this.fire("documentFragment",i,this.conversionApi),i.modelRange&&!(i.modelRange instanceof St))throw new n.CKEditorError("view-conversion-dispatcher-incorrect-result",this);return{modelRange:i.modelRange,modelCursor:i.modelCursor}}_convertChildren(e,t){let i=t.is("position")?t:At._createAt(t,0);const n=new St(i);for(const t of Array.from(e.getChildren())){const e=this._convertItem(t,i);e.modelRange instanceof St&&(n.end=e.modelRange.end,i=e.modelCursor)}return{modelRange:n,modelCursor:i}}_safeInsert(e,t){const i=this._splitToAllowedParent(e,t);return!!i&&(this.conversionApi.writer.insert(e,i.position),!0)}_updateConversionResult(e,t){const i=this._getSplitParts(e),n=this.conversionApi.writer;t.modelRange||(t.modelRange=n.createRange(n.createPositionBefore(e),n.createPositionAfter(i[i.length-1])));const o=this._cursorParents.get(e);t.modelCursor=o?n.createPositionAt(o,0):t.modelRange.end}_splitToAllowedParent(e,t){const{schema:i,writer:n}=this.conversionApi;let o=i.findAllowedParent(t,e);if(o){if(o===t.parent)return{position:t};this._modelCursor.parent.getAncestors().includes(o)&&(o=null)}if(!o)return fi(t,e,i)?{position:pi(t,n)}:null;const s=this.conversionApi.writer.split(t,o),r=[];for(const e of s.range.getWalker())if("elementEnd"==e.type)r.push(e.item);else{const t=r.pop(),i=e.item;this._registerSplitPair(t,i)}const a=s.range.end.parent;return this._cursorParents.set(e,a),{position:s.position,cursorParent:a}}_registerSplitPair(e,t){this._splitParts.has(e)||this._splitParts.set(e,[e]);const i=this._splitParts.get(e);this._splitParts.set(t,i),i.push(t)}_getSplitParts(e){let t;return t=this._splitParts.has(e)?this._splitParts.get(e):[e],t}_keepEmptyElement(e){this._emptyElementsToKeep.add(e)}_removeEmptyElements(){let e=!1;for(const t of this._splitParts.keys())t.isEmpty&&!this._emptyElementsToKeep.has(t)&&(this.conversionApi.writer.remove(t),this._splitParts.delete(t),e=!0);e&&this._removeEmptyElements()}}class Ki{getHtml(e){const t=n.global.document.implementation.createHTMLDocument("").createElement("div");return t.appendChild(e),t.innerHTML}}class Gi{constructor(e){this.skipComments=!0,this.domParser=new DOMParser,this.domConverter=new qe(e,{renderingMode:"data"}),this.htmlWriter=new Ki}toData(e){const t=this.domConverter.viewToDom(e);return this.htmlWriter.getHtml(t)}toView(e){const t=this._toDom(e);return this.domConverter.domToView(t,{skipComments:this.skipComments})}registerRawContentMatcher(e){this.domConverter.registerRawContentMatcher(e)}useFillerType(e){this.domConverter.blockFillerMode="marked"==e?"markedNbsp":"nbsp"}_toDom(e){e.match(/<(?:html|body|head|meta)(?:\s[^>]*)?>/i)||(e=`<body>${e}</body>`);const t=this.domParser.parseFromString(e,"text/html"),i=t.createDocumentFragment(),n=t.body.childNodes;for(;n.length>0;)i.appendChild(n[0]);return i}}class Zi extends((0,n.EmitterMixin)()){constructor(e,t){super(),this.model=e,this.mapper=new Vt,this.downcastDispatcher=new Mt({mapper:this.mapper,schema:e.schema}),this.downcastDispatcher.on("insert:$text",((e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const n=i.writer,o=i.mapper.toViewPosition(t.range.start),s=n.createText(t.item.data);n.insert(o,s)}),{priority:"lowest"}),this.downcastDispatcher.on("insert",((e,t,i)=>{i.convertAttributes(t.item),t.reconversion||!t.item.is("element")||t.item.isEmpty||i.convertChildren(t.item)}),{priority:"lowest"}),this.upcastDispatcher=new qi({schema:e.schema}),this.viewDocument=new se(t),this.stylesProcessor=t,this.htmlProcessor=new Gi(this.viewDocument),this.processor=this.htmlProcessor,this._viewWriter=new be(this.viewDocument),this.upcastDispatcher.on("text",((e,t,{schema:i,consumable:n,writer:o})=>{let s=t.modelCursor;if(!n.test(t.viewItem))return;if(!i.checkChild(s,"$text")){if(!fi(s,"$text",i))return;if(0==t.viewItem.data.trim().length)return;s=pi(s,o)}n.consume(t.viewItem);const r=o.createText(t.viewItem.data);o.insert(r,s),t.modelRange=o.createRange(s,s.getShiftedBy(r.offsetSize)),t.modelCursor=t.modelRange.end}),{priority:"lowest"}),this.upcastDispatcher.on("element",((e,t,i)=>{if(!t.modelRange&&i.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:n}=i.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=n}}),{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",((e,t,i)=>{if(!t.modelRange&&i.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:n}=i.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=n}}),{priority:"lowest"}),(0,n.ObservableMixin)().prototype.decorate.call(this,"init"),(0,n.ObservableMixin)().prototype.decorate.call(this,"set"),(0,n.ObservableMixin)().prototype.decorate.call(this,"get"),(0,n.ObservableMixin)().prototype.decorate.call(this,"toView"),(0,n.ObservableMixin)().prototype.decorate.call(this,"toModel"),this.on("init",(()=>{this.fire("ready")}),{priority:"lowest"}),this.on("ready",(()=>{this.model.enqueueChange({isUndoable:!1},gi)}),{priority:"lowest"})}get(e={}){const{rootName:t="main",trim:i="empty"}=e;if(!this._checkIfRootsExists([t]))throw new n.CKEditorError("datacontroller-get-non-existent-root",this);const o=this.model.document.getRoot(t);return o.isAttached()||(0,n.logWarning)("datacontroller-get-detached-root",this),"empty"!==i||this.model.hasContent(o,{ignoreWhitespaces:!0})?this.stringify(o,e):""}stringify(e,t={}){const i=this.toView(e,t);return this.processor.toData(i)}toView(e,t={}){const i=this.viewDocument,n=this._viewWriter;this.mapper.clearBindings();const o=St._createIn(e),s=new pe(i);this.mapper.bindElements(e,s);const r=e.is("documentFragment")?e.markers:function(e){const t=[],i=e.root.document;if(!i)return new Map;const n=St._createIn(e);for(const e of i.model.markers){const i=e.getRange(),o=i.isCollapsed,s=i.start.isEqual(n.start)||i.end.isEqual(n.end);if(o&&s)t.push([e.name,i]);else{const o=n.getIntersection(i);o&&t.push([e.name,o])}}return t.sort((([e,t],[i,n])=>{if("after"!==t.end.compareWith(n.start))return 1;if("before"!==t.start.compareWith(n.end))return-1;switch(t.start.compareWith(n.start)){case"before":return 1;case"after":return-1;default:switch(t.end.compareWith(n.end)){case"before":return 1;case"after":return-1;default:return i.localeCompare(e)}}})),new Map(t)}(e);return this.downcastDispatcher.convert(o,r,n,t),s}init(e){if(this.model.document.version)throw new n.CKEditorError("datacontroller-init-document-not-empty",this);let t={};if("string"==typeof e?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new n.CKEditorError("datacontroller-init-non-existent-root",this);return this.model.enqueueChange({isUndoable:!1},(e=>{for(const i of Object.keys(t)){const n=this.model.document.getRoot(i);e.insert(this.parse(t[i],n),n,0)}})),Promise.resolve()}set(e,t={}){let i={};if("string"==typeof e?i.main=e:i=e,!this._checkIfRootsExists(Object.keys(i)))throw new n.CKEditorError("datacontroller-set-non-existent-root",this);this.model.enqueueChange(t.batchType||{},(e=>{e.setSelection(null),e.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());for(const t of Object.keys(i)){const n=this.model.document.getRoot(t);e.remove(e.createRangeIn(n)),e.insert(this.parse(i[t],n),n,0)}}))}parse(e,t="$root"){const i=this.processor.toView(e);return this.toModel(i,t)}toModel(e,t="$root"){return this.model.change((i=>this.upcastDispatcher.convert(e,i,t)))}addStyleProcessorRules(e){e(this.stylesProcessor)}registerRawContentMatcher(e){this.processor&&this.processor!==this.htmlProcessor&&this.processor.registerRawContentMatcher(e),this.htmlProcessor.registerRawContentMatcher(e)}destroy(){this.stopListening()}_checkIfRootsExists(e){for(const t of e)if(!this.model.document.getRoot(t))return!1;return!0}}class Ji{constructor(e,t){this._helpers=new Map,this._downcast=(0,n.toArray)(e),this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=(0,n.toArray)(t),this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:!1})}addAlias(e,t){const i=this._downcast.includes(t);if(!this._upcast.includes(t)&&!i)throw new n.CKEditorError("conversion-add-alias-dispatcher-not-registered",this);this._createConversionHelpers({name:e,dispatchers:[t],isDowncast:i})}for(e){if(!this._helpers.has(e))throw new n.CKEditorError("conversion-for-unknown-group",this);return this._helpers.get(e)}elementToElement(e){this.for("downcast").elementToElement(e);for(const{model:t,view:i}of Qi(e))this.for("upcast").elementToElement({model:t,view:i,converterPriority:e.converterPriority})}attributeToElement(e){this.for("downcast").attributeToElement(e);for(const{model:t,view:i}of Qi(e))this.for("upcast").elementToAttribute({view:i,model:t,converterPriority:e.converterPriority})}attributeToAttribute(e){this.for("downcast").attributeToAttribute(e);for(const{model:t,view:i}of Qi(e))this.for("upcast").attributeToAttribute({view:i,model:t})}_createConversionHelpers({name:e,dispatchers:t,isDowncast:i}){if(this._helpers.has(e))throw new n.CKEditorError("conversion-group-exists",this);const o=i?new Yt(t):new bi(t);this._helpers.set(e,o)}}function*Qi(e){if(e.model.values)for(const t of e.model.values){const i={key:e.model.key,value:t},n=e.view[t],o=e.upcastAlso?e.upcastAlso[t]:void 0;yield*Yi(i,n,o)}else yield*Yi(e.model,e.view,e.upcastAlso)}function*Yi(e,t,i){if(yield{model:e,view:t},i)for(const t of(0,n.toArray)(i))yield{model:e,view:t}}class Xi{constructor(e,t={}){this.skipComments=!0,this.namespaces=t.namespaces||[],this.domParser=new DOMParser,this.domConverter=new qe(e,{renderingMode:"data"}),this.htmlWriter=new Ki}toData(e){const t=this.domConverter.viewToDom(e);return this.htmlWriter.getHtml(t)}toView(e){const t=this._toDom(e);return this.domConverter.domToView(t,{keepOriginalCase:!0,skipComments:this.skipComments})}registerRawContentMatcher(e){this.domConverter.registerRawContentMatcher(e)}useFillerType(e){this.domConverter.blockFillerMode="marked"==e?"markedNbsp":"nbsp"}_toDom(e){e=`<xml ${this.namespaces.map((e=>`xmlns:${e}="nsp"`)).join(" ")}>${e}</xml>`;const t=this.domParser.parseFromString(e,"text/xml"),i=t.querySelector("parsererror");if(i)throw new Error("Parse error - "+i.textContent);const n=t.createDocumentFragment(),o=t.documentElement.childNodes;for(;o.length>0;)n.appendChild(o[0]);return n}}class en{constructor(e){this.baseVersion=e,this.isDocumentOperation=null!==this.baseVersion,this.batch=null}_validate(){}toJSON(){const e=Object.assign({},this);return e.__className=this.constructor.className,delete e.batch,delete e.isDocumentOperation,e}static get className(){return"Operation"}static fromJSON(e,t){return new this(e.baseVersion)}}function tn(e,t){const i=sn(t),n=i.reduce(((e,t)=>e+t.offsetSize),0),o=e.parent;an(e);const s=e.index;return o._insertChild(s,i),rn(o,s+i.length),rn(o,s),new St(e,e.getShiftedBy(n))}function nn(e){if(!e.isFlat)throw new n.CKEditorError("operation-utils-remove-range-not-flat",this);const t=e.start.parent;an(e.start),an(e.end);const i=t._removeChildren(e.start.index,e.end.index-e.start.index);return rn(t,e.start.index),i}function on(e,t){if(!e.isFlat)throw new n.CKEditorError("operation-utils-move-range-not-flat",this);const i=nn(e);return tn(t=t._getTransformedByDeletion(e.start,e.end.offset-e.start.offset),i)}function sn(e){const t=[];!function e(i){if("string"==typeof i)t.push(new vt(i));else if(i instanceof _t)t.push(new vt(i.data,i.getAttributes()));else if(i instanceof bt)t.push(i);else if((0,n.isIterable)(i))for(const t of i)e(t)}(e);for(let e=1;e<t.length;e++){const i=t[e],n=t[e-1];i instanceof vt&&n instanceof vt&&ln(i,n)&&(t.splice(e-1,2,new vt(n.data+i.data,n.getAttributes())),e--)}return t}function rn(e,t){const i=e.getChild(t-1),n=e.getChild(t);if(i&&n&&i.is("$text")&&n.is("$text")&&ln(i,n)){const o=new vt(i.data+n.data,i.getAttributes());e._removeChildren(t-1,2),e._insertChild(t-1,o)}}function an(e){const t=e.textNode,i=e.parent;if(t){const n=e.offset-t.startOffset,o=t.index;i._removeChildren(o,1);const s=new vt(t.data.substr(0,n),t.getAttributes()),r=new vt(t.data.substr(n),t.getAttributes());i._insertChild(o,[s,r])}}function ln(e,t){const i=e.getAttributes(),n=t.getAttributes();for(const e of i){if(e[1]!==t.getAttribute(e[0]))return!1;n.next()}return n.next().done}class cn extends en{constructor(e,t,i,n){super(n),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toNext",this.howMany=t,this.targetPosition=i.clone(),this.targetPosition.stickiness="toNone"}get type(){return"$graveyard"==this.targetPosition.root.rootName?"remove":"$graveyard"==this.sourcePosition.root.rootName?"reinsert":"move"}get affectedSelectable(){return[St._createFromPositionAndShift(this.sourcePosition,this.howMany),St._createFromPositionAndShift(this.targetPosition,0)]}clone(){return new cn(this.sourcePosition,this.howMany,this.targetPosition,this.baseVersion)}getMovedRangeStart(){return this.targetPosition._getTransformedByDeletion(this.sourcePosition,this.howMany)}getReversed(){const e=this.sourcePosition._getTransformedByInsertion(this.targetPosition,this.howMany);return new cn(this.getMovedRangeStart(),this.howMany,e,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent,i=this.sourcePosition.offset,o=this.targetPosition.offset;if(i+this.howMany>e.maxOffset)throw new n.CKEditorError("move-operation-nodes-do-not-exist",this);if(e===t&&i<o&&o<i+this.howMany)throw new n.CKEditorError("move-operation-range-into-itself",this);if(this.sourcePosition.root==this.targetPosition.root&&"prefix"==(0,n.compareArrays)(this.sourcePosition.getParentPath(),this.targetPosition.getParentPath())){const e=this.sourcePosition.path.length-1;if(this.targetPosition.path[e]>=i&&this.targetPosition.path[e]<i+this.howMany)throw new n.CKEditorError("move-operation-node-into-itself",this)}}_execute(){on(St._createFromPositionAndShift(this.sourcePosition,this.howMany),this.targetPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e.targetPosition=this.targetPosition.toJSON(),e}static get className(){return"MoveOperation"}static fromJSON(e,t){const i=At.fromJSON(e.sourcePosition,t),n=At.fromJSON(e.targetPosition,t);return new this(i,e.howMany,n,e.baseVersion)}}class dn extends en{constructor(e,t,i){super(i),this.position=e.clone(),this.position.stickiness="toNone",this.nodes=new wt(sn(t)),this.shouldReceiveAttributes=!1}get type(){return"insert"}get howMany(){return this.nodes.maxOffset}get affectedSelectable(){return this.position.clone()}clone(){const e=new wt([...this.nodes].map((e=>e._clone(!0)))),t=new dn(this.position,e,this.baseVersion);return t.shouldReceiveAttributes=this.shouldReceiveAttributes,t}getReversed(){const e=this.position.root.document.graveyard,t=new At(e,[0]);return new cn(this.position,this.nodes.maxOffset,t,this.baseVersion+1)}_validate(){const e=this.position.parent;if(!e||e.maxOffset<this.position.offset)throw new n.CKEditorError("insert-operation-position-invalid",this)}_execute(){const e=this.nodes;this.nodes=new wt([...e].map((e=>e._clone(!0)))),tn(this.position,e)}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e.nodes=this.nodes.toJSON(),e}static get className(){return"InsertOperation"}static fromJSON(e,t){const i=[];for(const t of e.nodes)t.name?i.push(yt.fromJSON(t)):i.push(vt.fromJSON(t));const n=new dn(At.fromJSON(e.position,t),i,e.baseVersion);return n.shouldReceiveAttributes=e.shouldReceiveAttributes,n}}class un extends en{constructor(e,t,i,n,o){super(o),this.splitPosition=e.clone(),this.splitPosition.stickiness="toNext",this.howMany=t,this.insertionPosition=i,this.graveyardPosition=n?n.clone():null,this.graveyardPosition&&(this.graveyardPosition.stickiness="toNext")}get type(){return"split"}get moveTargetPosition(){const e=this.insertionPosition.path.slice();return e.push(0),new At(this.insertionPosition.root,e)}get movedRange(){const e=this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);return new St(this.splitPosition,e)}get affectedSelectable(){const e=[St._createFromPositionAndShift(this.splitPosition,0),St._createFromPositionAndShift(this.insertionPosition,0)];return this.graveyardPosition&&e.push(St._createFromPositionAndShift(this.graveyardPosition,0)),e}clone(){return new un(this.splitPosition,this.howMany,this.insertionPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.splitPosition.root.document.graveyard,t=new At(e,[0]);return new hn(this.moveTargetPosition,this.howMany,this.splitPosition,t,this.baseVersion+1)}_validate(){const e=this.splitPosition.parent,t=this.splitPosition.offset;if(!e||e.maxOffset<t)throw new n.CKEditorError("split-operation-position-invalid",this);if(!e.parent)throw new n.CKEditorError("split-operation-split-in-root",this);if(this.howMany!=e.maxOffset-this.splitPosition.offset)throw new n.CKEditorError("split-operation-how-many-invalid",this);if(this.graveyardPosition&&!this.graveyardPosition.nodeAfter)throw new n.CKEditorError("split-operation-graveyard-position-invalid",this)}_execute(){const e=this.splitPosition.parent;if(this.graveyardPosition)on(St._createFromPositionAndShift(this.graveyardPosition,1),this.insertionPosition);else{const t=e._clone();tn(this.insertionPosition,t)}on(new St(At._createAt(e,this.splitPosition.offset),At._createAt(e,e.maxOffset)),this.moveTargetPosition)}toJSON(){const e=super.toJSON();return e.splitPosition=this.splitPosition.toJSON(),e.insertionPosition=this.insertionPosition.toJSON(),this.graveyardPosition&&(e.graveyardPosition=this.graveyardPosition.toJSON()),e}static get className(){return"SplitOperation"}static getInsertionPosition(e){const t=e.path.slice(0,-1);return t[t.length-1]++,new At(e.root,t,"toPrevious")}static fromJSON(e,t){const i=At.fromJSON(e.splitPosition,t),n=At.fromJSON(e.insertionPosition,t),o=e.graveyardPosition?At.fromJSON(e.graveyardPosition,t):null;return new this(i,e.howMany,n,o,e.baseVersion)}}class hn extends en{constructor(e,t,i,n,o){super(o),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toPrevious",this.howMany=t,this.targetPosition=i.clone(),this.targetPosition.stickiness="toNext",this.graveyardPosition=n.clone()}get type(){return"merge"}get deletionPosition(){return new At(this.sourcePosition.root,this.sourcePosition.path.slice(0,-1))}get movedRange(){const e=this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);return new St(this.sourcePosition,e)}get affectedSelectable(){const e=this.sourcePosition.parent;return[St._createOn(e),St._createFromPositionAndShift(this.targetPosition,0),St._createFromPositionAndShift(this.graveyardPosition,0)]}clone(){return new hn(this.sourcePosition,this.howMany,this.targetPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.targetPosition._getTransformedByMergeOperation(this),t=this.sourcePosition.path.slice(0,-1),i=new At(this.sourcePosition.root,t)._getTransformedByMergeOperation(this);return new un(e,this.howMany,i,this.graveyardPosition,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent;if(!e.parent)throw new n.CKEditorError("merge-operation-source-position-invalid",this);if(!t.parent)throw new n.CKEditorError("merge-operation-target-position-invalid",this);if(this.howMany!=e.maxOffset)throw new n.CKEditorError("merge-operation-how-many-invalid",this)}_execute(){const e=this.sourcePosition.parent;on(St._createIn(e),this.targetPosition),on(St._createOn(e),this.graveyardPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=e.sourcePosition.toJSON(),e.targetPosition=e.targetPosition.toJSON(),e.graveyardPosition=e.graveyardPosition.toJSON(),e}static get className(){return"MergeOperation"}static fromJSON(e,t){const i=At.fromJSON(e.sourcePosition,t),n=At.fromJSON(e.targetPosition,t),o=At.fromJSON(e.graveyardPosition,t);return new this(i,e.howMany,n,o,e.baseVersion)}}class mn extends en{constructor(e,t,i,n,o,s){super(s),this.name=e,this.oldRange=t?t.clone():null,this.newRange=i?i.clone():null,this.affectsData=o,this._markers=n}get type(){return"marker"}get affectedSelectable(){const e=[];return this.oldRange&&e.push(this.oldRange.clone()),this.newRange&&(this.oldRange?e.push(...this.newRange.getDifference(this.oldRange)):e.push(this.newRange.clone())),e}clone(){return new mn(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new mn(this.name,this.newRange,this.oldRange,this._markers,this.affectsData,this.baseVersion+1)}_execute(){this.newRange?this._markers._set(this.name,this.newRange,!0,this.affectsData):this._markers._remove(this.name)}toJSON(){const e=super.toJSON();return this.oldRange&&(e.oldRange=this.oldRange.toJSON()),this.newRange&&(e.newRange=this.newRange.toJSON()),delete e._markers,e}static get className(){return"MarkerOperation"}static fromJSON(e,t){return new mn(e.name,e.oldRange?St.fromJSON(e.oldRange,t):null,e.newRange?St.fromJSON(e.newRange,t):null,t.model.markers,e.affectsData,e.baseVersion)}}var gn=i(6996);class fn extends en{constructor(e,t,i,n,o){super(o),this.range=e.clone(),this.key=t,this.oldValue=void 0===i?null:i,this.newValue=void 0===n?null:n}get type(){return null===this.oldValue?"addAttribute":null===this.newValue?"removeAttribute":"changeAttribute"}get affectedSelectable(){return this.range.clone()}clone(){return new fn(this.range,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new fn(this.range,this.key,this.newValue,this.oldValue,this.baseVersion+1)}toJSON(){const e=super.toJSON();return e.range=this.range.toJSON(),e}_validate(){if(!this.range.isFlat)throw new n.CKEditorError("attribute-operation-range-not-flat",this);for(const e of this.range.getItems({shallow:!0})){if(null!==this.oldValue&&!(0,gn.A)(e.getAttribute(this.key),this.oldValue))throw new n.CKEditorError("attribute-operation-wrong-old-value",this,{item:e,key:this.key,value:this.oldValue});if(null===this.oldValue&&null!==this.newValue&&e.hasAttribute(this.key))throw new n.CKEditorError("attribute-operation-attribute-exists",this,{node:e,key:this.key})}}_execute(){(0,gn.A)(this.oldValue,this.newValue)||function(e,t,i){an(e.start),an(e.end);for(const n of e.getItems({shallow:!0})){const e=n.is("$textProxy")?n.textNode:n;null!==i?e._setAttribute(t,i):e._removeAttribute(t),rn(e.parent,e.index)}rn(e.end.parent,e.end.index)}(this.range,this.key,this.newValue)}static get className(){return"AttributeOperation"}static fromJSON(e,t){return new fn(St.fromJSON(e.range,t),e.key,e.oldValue,e.newValue,e.baseVersion)}}class pn extends en{get type(){return"noop"}get affectedSelectable(){return null}clone(){return new pn(this.baseVersion)}getReversed(){return new pn(this.baseVersion+1)}_execute(){}static get className(){return"NoOperation"}}class bn extends en{constructor(e,t,i,n){super(n),this.position=e,this.position.stickiness="toNext",this.oldName=t,this.newName=i}get type(){return"rename"}get affectedSelectable(){return this.position.nodeAfter}clone(){return new bn(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new bn(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){const e=this.position.nodeAfter;if(!(e instanceof yt))throw new n.CKEditorError("rename-operation-wrong-position",this);if(e.name!==this.oldName)throw new n.CKEditorError("rename-operation-wrong-name",this)}_execute(){this.position.nodeAfter.name=this.newName}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e}static get className(){return"RenameOperation"}static fromJSON(e,t){return new bn(At.fromJSON(e.position,t),e.oldName,e.newName,e.baseVersion)}}class wn extends en{constructor(e,t,i,n,o){super(o),this.root=e,this.key=t,this.oldValue=void 0===i?null:i,this.newValue=void 0===n?null:n}get type(){return null===this.oldValue?"addRootAttribute":null===this.newValue?"removeRootAttribute":"changeRootAttribute"}get affectedSelectable(){return this.root}clone(){return new wn(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new wn(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is("documentFragment"))throw new n.CKEditorError("rootattribute-operation-not-a-root",this,{root:this.root,key:this.key});if(null!==this.oldValue&&this.root.getAttribute(this.key)!==this.oldValue)throw new n.CKEditorError("rootattribute-operation-wrong-old-value",this,{root:this.root,key:this.key});if(null===this.oldValue&&null!==this.newValue&&this.root.hasAttribute(this.key))throw new n.CKEditorError("rootattribute-operation-attribute-exists",this,{root:this.root,key:this.key})}_execute(){null!==this.newValue?this.root._setAttribute(this.key,this.newValue):this.root._removeAttribute(this.key)}toJSON(){const e=super.toJSON();return e.root=this.root.toJSON(),e}static get className(){return"RootAttributeOperation"}static fromJSON(e,t){if(!t.getRoot(e.root))throw new n.CKEditorError("rootattribute-operation-fromjson-no-root",this,{rootName:e.root});return new wn(t.getRoot(e.root),e.key,e.oldValue,e.newValue,e.baseVersion)}}class vn extends en{constructor(e,t,i,n,o){super(o),this.rootName=e,this.elementName=t,this.isAdd=i,this._document=n,this._document.getRoot(this.rootName)||(this._document.createRoot(this.elementName,this.rootName)._isAttached=!1)}get type(){return this.isAdd?"addRoot":"detachRoot"}get affectedSelectable(){return this._document.getRoot(this.rootName)}clone(){return new vn(this.rootName,this.elementName,this.isAdd,this._document,this.baseVersion)}getReversed(){return new vn(this.rootName,this.elementName,!this.isAdd,this._document,this.baseVersion+1)}_execute(){this._document.getRoot(this.rootName)._isAttached=this.isAdd}toJSON(){const e=super.toJSON();return delete e._document,e}static get className(){return"RootOperation"}static fromJSON(e,t){return new vn(e.rootName,e.elementName,e.isAdd,t,e.baseVersion)}}const _n={};_n[fn.className]=fn,_n[dn.className]=dn,_n[mn.className]=mn,_n[cn.className]=cn,_n[pn.className]=pn,_n[en.className]=en,_n[bn.className]=bn,_n[wn.className]=wn,_n[vn.className]=vn,_n[un.className]=un,_n[hn.className]=hn;class yn{static fromJSON(e,t){return _n[e.__className].fromJSON(e,t)}}const kn=new Map;function Cn(e,t,i){let n=kn.get(e);n||(n=new Map,kn.set(e,n)),n.set(t,i)}function An(e){return[e]}function En(e,t,i={}){const n=function(e,t){const i=kn.get(e);return i&&i.has(t)?i.get(t):An}(e.constructor,t.constructor);try{return n(e=e.clone(),t,i)}catch(e){throw e}}function xn(e,t,i){e=e.slice(),t=t.slice();const n=new Tn(i.document,i.useRelations,i.forceWeakRemove);n.setOriginalOperations(e),n.setOriginalOperations(t);const o=n.originalOperations;if(0==e.length||0==t.length)return{operationsA:e,operationsB:t,originalOperations:o};const s=new WeakMap;for(const t of e)s.set(t,0);const r={nextBaseVersionA:e[e.length-1].baseVersion+1,nextBaseVersionB:t[t.length-1].baseVersion+1,originalOperationsACount:e.length,originalOperationsBCount:t.length};let a=0;for(;a<e.length;){const i=e[a],o=s.get(i);if(o==t.length){a++;continue}const r=t[o],l=En(i,r,n.getContext(i,r,!0)),c=En(r,i,n.getContext(r,i,!1));n.updateRelation(i,r),n.setOriginalOperations(l,i),n.setOriginalOperations(c,r);for(const e of l)s.set(e,o+c.length);e.splice(a,1,...l),t.splice(o,1,...c)}if(i.padWithNoOps){const i=e.length-r.originalOperationsACount,n=t.length-r.originalOperationsBCount;In(e,n-i),In(t,i-n)}return Pn(e,r.nextBaseVersionB),Pn(t,r.nextBaseVersionA),{operationsA:e,operationsB:t,originalOperations:o}}class Tn{constructor(e,t,i=!1){this.originalOperations=new Map,this._history=e.history,this._useRelations=t,this._forceWeakRemove=!!i,this._relations=new Map}setOriginalOperations(e,t=null){const i=t?this.originalOperations.get(t):null;for(const t of e)this.originalOperations.set(t,i||t)}updateRelation(e,t){if(e instanceof cn)t instanceof hn?e.targetPosition.isEqual(t.sourcePosition)||t.movedRange.containsPosition(e.targetPosition)?this._setRelation(e,t,"insertAtSource"):e.targetPosition.isEqual(t.deletionPosition)?this._setRelation(e,t,"insertBetween"):e.targetPosition.isAfter(t.sourcePosition)&&this._setRelation(e,t,"moveTargetAfter"):t instanceof cn&&(e.targetPosition.isEqual(t.sourcePosition)||e.targetPosition.isBefore(t.sourcePosition)?this._setRelation(e,t,"insertBefore"):this._setRelation(e,t,"insertAfter"));else if(e instanceof un){if(t instanceof hn)e.splitPosition.isBefore(t.sourcePosition)&&this._setRelation(e,t,"splitBefore");else if(t instanceof cn)if(e.splitPosition.isEqual(t.sourcePosition)||e.splitPosition.isBefore(t.sourcePosition))this._setRelation(e,t,"splitBefore");else{const i=St._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&i.containsPosition(e.splitPosition)){const n=i.end.offset-e.splitPosition.offset,o=e.splitPosition.offset-i.start.offset;this._setRelation(e,t,{howMany:n,offset:o})}}}else if(e instanceof hn)t instanceof hn?(e.targetPosition.isEqual(t.sourcePosition)||this._setRelation(e,t,"mergeTargetNotMoved"),e.sourcePosition.isEqual(t.targetPosition)&&this._setRelation(e,t,"mergeSourceNotMoved"),e.sourcePosition.isEqual(t.sourcePosition)&&this._setRelation(e,t,"mergeSameElement")):t instanceof un?e.sourcePosition.isEqual(t.splitPosition)&&this._setRelation(e,t,"splitAtSource"):t instanceof cn&&t.howMany>0&&(e.sourcePosition.isEqual(t.sourcePosition.getShiftedBy(t.howMany))&&this._setRelation(e,t,"mergeSourceAffected"),e.targetPosition.isEqual(t.sourcePosition)&&this._setRelation(e,t,"mergeTargetWasBefore"));else if(e instanceof mn){const i=e.newRange;if(!i)return;if(t instanceof cn){const n=St._createFromPositionAndShift(t.sourcePosition,t.howMany),o=n.containsPosition(i.start)||n.start.isEqual(i.start),s=n.containsPosition(i.end)||n.end.isEqual(i.end);!o&&!s||n.containsRange(i)||this._setRelation(e,t,{side:o?"left":"right",path:o?i.start.path.slice():i.end.path.slice()})}else if(t instanceof hn){const n=i.start.isEqual(t.targetPosition),o=i.start.isEqual(t.deletionPosition),s=i.end.isEqual(t.deletionPosition),r=i.end.isEqual(t.sourcePosition);(n||o||s||r)&&this._setRelation(e,t,{wasInLeftElement:n,wasStartBeforeMergedElement:o,wasEndBeforeMergedElement:s,wasInRightElement:r})}}}getContext(e,t,i){return{aIsStrong:i,aWasUndone:this._wasUndone(e),bWasUndone:this._wasUndone(t),abRelation:this._useRelations?this._getRelation(e,t):null,baRelation:this._useRelations?this._getRelation(t,e):null,forceWeakRemove:this._forceWeakRemove}}_wasUndone(e){const t=this.originalOperations.get(e);return t.wasUndone||this._history.isUndoneOperation(t)}_getRelation(e,t){const i=this.originalOperations.get(t),n=this._history.getUndoneOperation(i);if(!n)return null;const o=this.originalOperations.get(e),s=this._relations.get(o);return s&&s.get(n)||null}_setRelation(e,t,i){const n=this.originalOperations.get(e),o=this.originalOperations.get(t);let s=this._relations.get(n);s||(s=new Map,this._relations.set(n,s)),s.set(o,i)}}function Pn(e,t){for(const i of e)i.baseVersion=t++}function In(e,t){for(let i=0;i<t;i++)e.push(new pn(0))}function Sn(e,t,i){const n=e.nodes.getNode(0).getAttribute(t);if(n==i)return null;const o=new St(e.position,e.position.getShiftedBy(e.howMany));return new fn(o,t,n,i,0)}function Vn(e,t){return null===e.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany)}function Rn(e,t){const i=[];for(let n=0;n<e.length;n++){const o=e[n],s=new cn(o.start,o.end.offset-o.start.offset,t,0);i.push(s);for(let t=n+1;t<e.length;t++)e[t]=e[t]._getTransformedByMove(s.sourcePosition,s.targetPosition,s.howMany)[0];t=t._getTransformedByMove(s.sourcePosition,s.targetPosition,s.howMany)}return i}Cn(fn,fn,((e,t,i)=>{if(e.key===t.key&&e.range.start.hasSameParentAs(t.range.start)){const n=e.range.getDifference(t.range).map((t=>new fn(t,e.key,e.oldValue,e.newValue,0))),o=e.range.getIntersection(t.range);return o&&i.aIsStrong&&n.push(new fn(o,t.key,t.newValue,e.newValue,0)),0==n.length?[new pn(0)]:n}return[e]})),Cn(fn,dn,((e,t)=>{if(e.range.start.hasSameParentAs(t.position)&&e.range.containsPosition(t.position)){const i=e.range._getTransformedByInsertion(t.position,t.howMany,!t.shouldReceiveAttributes).map((t=>new fn(t,e.key,e.oldValue,e.newValue,e.baseVersion)));if(t.shouldReceiveAttributes){const n=Sn(t,e.key,e.oldValue);n&&i.unshift(n)}return i}return e.range=e.range._getTransformedByInsertion(t.position,t.howMany,!1)[0],[e]})),Cn(fn,hn,((e,t)=>{const i=[];e.range.start.hasSameParentAs(t.deletionPosition)&&(e.range.containsPosition(t.deletionPosition)||e.range.start.isEqual(t.deletionPosition))&&i.push(St._createFromPositionAndShift(t.graveyardPosition,1));const n=e.range._getTransformedByMergeOperation(t);return n.isCollapsed||i.push(n),i.map((t=>new fn(t,e.key,e.oldValue,e.newValue,e.baseVersion)))})),Cn(fn,cn,((e,t)=>function(e,t){const i=St._createFromPositionAndShift(t.sourcePosition,t.howMany);let n=null,o=[];i.containsRange(e,!0)?n=e:e.start.hasSameParentAs(i.start)?(o=e.getDifference(i),n=e.getIntersection(i)):o=[e];const s=[];for(let e of o){e=e._getTransformedByDeletion(t.sourcePosition,t.howMany);const i=t.getMovedRangeStart(),n=e.start.hasSameParentAs(i),o=e._getTransformedByInsertion(i,t.howMany,n);s.push(...o)}return n&&s.push(n._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany,!1)[0]),s}(e.range,t).map((t=>new fn(t,e.key,e.oldValue,e.newValue,e.baseVersion))))),Cn(fn,un,((e,t)=>{if(e.range.end.isEqual(t.insertionPosition))return t.graveyardPosition||e.range.end.offset++,[e];if(e.range.start.hasSameParentAs(t.splitPosition)&&e.range.containsPosition(t.splitPosition)){const i=e.clone();return i.range=new St(t.moveTargetPosition.clone(),e.range.end._getCombined(t.splitPosition,t.moveTargetPosition)),e.range.end=t.splitPosition.clone(),e.range.end.stickiness="toPrevious",[e,i]}return e.range=e.range._getTransformedBySplitOperation(t),[e]})),Cn(dn,fn,((e,t)=>{const i=[e];if(e.shouldReceiveAttributes&&e.position.hasSameParentAs(t.range.start)&&t.range.containsPosition(e.position)){const n=Sn(e,t.key,t.newValue);n&&i.push(n)}return i})),Cn(dn,dn,((e,t,i)=>(e.position.isEqual(t.position)&&i.aIsStrong||(e.position=e.position._getTransformedByInsertOperation(t)),[e]))),Cn(dn,cn,((e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e]))),Cn(dn,un,((e,t)=>(e.position=e.position._getTransformedBySplitOperation(t),[e]))),Cn(dn,hn,((e,t)=>(e.position=e.position._getTransformedByMergeOperation(t),[e]))),Cn(mn,dn,((e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByInsertOperation(t)[0]),e.newRange&&(e.newRange=e.newRange._getTransformedByInsertOperation(t)[0]),[e]))),Cn(mn,mn,((e,t,i)=>{if(e.name==t.name){if(!i.aIsStrong)return[new pn(0)];e.oldRange=t.newRange?t.newRange.clone():null}return[e]})),Cn(mn,hn,((e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByMergeOperation(t)),e.newRange&&(e.newRange=e.newRange._getTransformedByMergeOperation(t)),[e]))),Cn(mn,cn,((e,t,i)=>{if(e.oldRange&&(e.oldRange=St._createFromRanges(e.oldRange._getTransformedByMoveOperation(t))),e.newRange){if(i.abRelation){const n=St._createFromRanges(e.newRange._getTransformedByMoveOperation(t));if("left"==i.abRelation.side&&t.targetPosition.isEqual(e.newRange.start))return e.newRange.end=n.end,e.newRange.start.path=i.abRelation.path,[e];if("right"==i.abRelation.side&&t.targetPosition.isEqual(e.newRange.end))return e.newRange.start=n.start,e.newRange.end.path=i.abRelation.path,[e]}e.newRange=St._createFromRanges(e.newRange._getTransformedByMoveOperation(t))}return[e]})),Cn(mn,un,((e,t,i)=>{if(e.oldRange&&(e.oldRange=e.oldRange._getTransformedBySplitOperation(t)),e.newRange){if(i.abRelation){const n=e.newRange._getTransformedBySplitOperation(t);return e.newRange.start.isEqual(t.splitPosition)&&i.abRelation.wasStartBeforeMergedElement?e.newRange.start=At._createAt(t.insertionPosition):e.newRange.start.isEqual(t.splitPosition)&&!i.abRelation.wasInLeftElement&&(e.newRange.start=At._createAt(t.moveTargetPosition)),e.newRange.end.isEqual(t.splitPosition)&&i.abRelation.wasInRightElement?e.newRange.end=At._createAt(t.moveTargetPosition):e.newRange.end.isEqual(t.splitPosition)&&i.abRelation.wasEndBeforeMergedElement?e.newRange.end=At._createAt(t.insertionPosition):e.newRange.end=n.end,[e]}e.newRange=e.newRange._getTransformedBySplitOperation(t)}return[e]})),Cn(hn,dn,((e,t)=>(e.sourcePosition.hasSameParentAs(t.position)&&(e.howMany+=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByInsertOperation(t),e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t),[e]))),Cn(hn,hn,((e,t,i)=>{if(e.sourcePosition.isEqual(t.sourcePosition)&&e.targetPosition.isEqual(t.targetPosition)){if(i.bWasUndone){const i=t.graveyardPosition.path.slice();return i.push(0),e.sourcePosition=new At(t.graveyardPosition.root,i),e.howMany=0,[e]}return[new pn(0)]}if(e.sourcePosition.isEqual(t.sourcePosition)&&!e.targetPosition.isEqual(t.targetPosition)&&!i.bWasUndone&&"splitAtSource"!=i.abRelation){const n="$graveyard"==e.targetPosition.root.rootName,o="$graveyard"==t.targetPosition.root.rootName;if(o&&!n||(!n||o)&&i.aIsStrong){const i=t.targetPosition._getTransformedByMergeOperation(t),n=e.targetPosition._getTransformedByMergeOperation(t);return[new cn(i,e.howMany,n,0)]}return[new pn(0)]}return e.sourcePosition.hasSameParentAs(t.targetPosition)&&(e.howMany+=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByMergeOperation(t),e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),e.graveyardPosition.isEqual(t.graveyardPosition)&&i.aIsStrong||(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]})),Cn(hn,cn,((e,t,i)=>{const n=St._createFromPositionAndShift(t.sourcePosition,t.howMany);return"remove"==t.type&&!i.bWasUndone&&!i.forceWeakRemove&&e.deletionPosition.hasSameParentAs(t.sourcePosition)&&n.containsPosition(e.sourcePosition)?[new pn(0)]:(t.sourcePosition.getShiftedBy(t.howMany).isEqual(e.sourcePosition)?e.sourcePosition.stickiness="toNone":t.targetPosition.isEqual(e.sourcePosition)&&"mergeSourceAffected"==i.abRelation?e.sourcePosition.stickiness="toNext":t.sourcePosition.isEqual(e.targetPosition)?(e.targetPosition.stickiness="toNone",e.howMany-=t.howMany):t.targetPosition.isEqual(e.targetPosition)&&"mergeTargetWasBefore"==i.abRelation?(e.targetPosition.stickiness="toPrevious",e.howMany+=t.howMany):(e.sourcePosition.hasSameParentAs(t.targetPosition)&&(e.howMany+=t.howMany),e.sourcePosition.hasSameParentAs(t.sourcePosition)&&(e.howMany-=t.howMany)),e.sourcePosition=e.sourcePosition._getTransformedByMoveOperation(t),e.targetPosition=e.targetPosition._getTransformedByMoveOperation(t),e.sourcePosition.stickiness="toPrevious",e.targetPosition.stickiness="toNext",e.graveyardPosition.isEqual(t.targetPosition)||(e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(t)),[e])})),Cn(hn,un,((e,t,i)=>{if(t.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedByDeletion(t.graveyardPosition,1),e.deletionPosition.isEqual(t.graveyardPosition)&&(e.howMany=t.howMany)),e.targetPosition.isEqual(t.splitPosition)){const n=0!=t.howMany,o=t.graveyardPosition&&e.deletionPosition.isEqual(t.graveyardPosition);if(n||o||"mergeTargetNotMoved"==i.abRelation)return e.sourcePosition=e.sourcePosition._getTransformedBySplitOperation(t),[e]}if(e.sourcePosition.isEqual(t.splitPosition)){if("mergeSourceNotMoved"==i.abRelation)return e.howMany=0,e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e];if("mergeSameElement"==i.abRelation||e.sourcePosition.offset>0)return e.sourcePosition=t.moveTargetPosition.clone(),e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e]}return e.sourcePosition.hasSameParentAs(t.splitPosition)&&(e.howMany=t.splitPosition.offset),e.sourcePosition=e.sourcePosition._getTransformedBySplitOperation(t),e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e]})),Cn(cn,dn,((e,t)=>{const i=St._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByInsertOperation(t,!1)[0];return e.sourcePosition=i.start,e.howMany=i.end.offset-i.start.offset,e.targetPosition.isEqual(t.position)||(e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t)),[e]})),Cn(cn,cn,((e,t,i)=>{const o=St._createFromPositionAndShift(e.sourcePosition,e.howMany),s=St._createFromPositionAndShift(t.sourcePosition,t.howMany);let r,a=i.aIsStrong,l=!i.aIsStrong;if("insertBefore"==i.abRelation||"insertAfter"==i.baRelation?l=!0:"insertAfter"!=i.abRelation&&"insertBefore"!=i.baRelation||(l=!1),r=e.targetPosition.isEqual(t.targetPosition)&&l?e.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany):e.targetPosition._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),Vn(e,t)&&Vn(t,e))return[t.getReversed()];if(o.containsPosition(t.targetPosition)&&o.containsRange(s,!0))return o.start=o.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),o.end=o.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),Rn([o],r);if(s.containsPosition(e.targetPosition)&&s.containsRange(o,!0))return o.start=o.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),o.end=o.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),Rn([o],r);const c=(0,n.compareArrays)(e.sourcePosition.getParentPath(),t.sourcePosition.getParentPath());if("prefix"==c||"extension"==c)return o.start=o.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),o.end=o.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),Rn([o],r);"remove"!=e.type||"remove"==t.type||i.aWasUndone||i.forceWeakRemove?"remove"==e.type||"remove"!=t.type||i.bWasUndone||i.forceWeakRemove||(a=!1):a=!0;const d=[],u=o.getDifference(s);for(const e of u){e.start=e.start._getTransformedByDeletion(t.sourcePosition,t.howMany),e.end=e.end._getTransformedByDeletion(t.sourcePosition,t.howMany);const i="same"==(0,n.compareArrays)(e.start.getParentPath(),t.getMovedRangeStart().getParentPath()),o=e._getTransformedByInsertion(t.getMovedRangeStart(),t.howMany,i);d.push(...o)}const h=o.getIntersection(s);return null!==h&&a&&(h.start=h.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),h.end=h.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),0===d.length?d.push(h):1==d.length?s.start.isBefore(o.start)||s.start.isEqual(o.start)?d.unshift(h):d.push(h):d.splice(1,0,h)),0===d.length?[new pn(e.baseVersion)]:Rn(d,r)})),Cn(cn,un,((e,t,i)=>{let n=e.targetPosition.clone();e.targetPosition.isEqual(t.insertionPosition)&&t.graveyardPosition&&"moveTargetAfter"!=i.abRelation||(n=e.targetPosition._getTransformedBySplitOperation(t));const o=St._createFromPositionAndShift(e.sourcePosition,e.howMany);if(o.end.isEqual(t.insertionPosition))return t.graveyardPosition||e.howMany++,e.targetPosition=n,[e];if(o.start.hasSameParentAs(t.splitPosition)&&o.containsPosition(t.splitPosition)){let e=new St(t.splitPosition,o.end);return e=e._getTransformedBySplitOperation(t),Rn([new St(o.start,t.splitPosition),e],n)}e.targetPosition.isEqual(t.splitPosition)&&"insertAtSource"==i.abRelation&&(n=t.moveTargetPosition),e.targetPosition.isEqual(t.insertionPosition)&&"insertBetween"==i.abRelation&&(n=e.targetPosition);const s=[o._getTransformedBySplitOperation(t)];if(t.graveyardPosition){const n=o.start.isEqual(t.graveyardPosition)||o.containsPosition(t.graveyardPosition);e.howMany>1&&n&&!i.aWasUndone&&s.push(St._createFromPositionAndShift(t.insertionPosition,1))}return Rn(s,n)})),Cn(cn,hn,((e,t,i)=>{const n=St._createFromPositionAndShift(e.sourcePosition,e.howMany);if(t.deletionPosition.hasSameParentAs(e.sourcePosition)&&n.containsPosition(t.sourcePosition))if("remove"!=e.type||i.forceWeakRemove){if(1==e.howMany)return i.bWasUndone?(e.sourcePosition=t.graveyardPosition.clone(),e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),[e]):[new pn(0)]}else if(!i.aWasUndone){const i=[];let n=t.graveyardPosition.clone(),o=t.targetPosition._getTransformedByMergeOperation(t);e.howMany>1&&(i.push(new cn(e.sourcePosition,e.howMany-1,e.targetPosition,0)),n=n._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany-1),o=o._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany-1));const s=t.deletionPosition._getCombined(e.sourcePosition,e.targetPosition),r=new cn(n,1,s,0),a=r.getMovedRangeStart().path.slice();a.push(0);const l=new At(r.targetPosition.root,a);o=o._getTransformedByMove(n,s,1);const c=new cn(o,t.howMany,l,0);return i.push(r),i.push(c),i}const o=St._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByMergeOperation(t);return e.sourcePosition=o.start,e.howMany=o.end.offset-o.start.offset,e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),[e]})),Cn(bn,dn,((e,t)=>(e.position=e.position._getTransformedByInsertOperation(t),[e]))),Cn(bn,hn,((e,t)=>e.position.isEqual(t.deletionPosition)?(e.position=t.graveyardPosition.clone(),e.position.stickiness="toNext",[e]):(e.position=e.position._getTransformedByMergeOperation(t),[e]))),Cn(bn,cn,((e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e]))),Cn(bn,bn,((e,t,i)=>{if(e.position.isEqual(t.position)){if(!i.aIsStrong)return[new pn(0)];e.oldName=t.newName}return[e]})),Cn(bn,un,((e,t)=>{const i=e.position.path,o=t.splitPosition.getParentPath();if("same"==(0,n.compareArrays)(i,o)&&!t.graveyardPosition){const t=new bn(e.position.getShiftedBy(1),e.oldName,e.newName,0);return[e,t]}return e.position=e.position._getTransformedBySplitOperation(t),[e]})),Cn(wn,wn,((e,t,i)=>{if(e.root===t.root&&e.key===t.key){if(!i.aIsStrong||e.newValue===t.newValue)return[new pn(0)];e.oldValue=t.newValue}return[e]})),Cn(vn,vn,((e,t)=>e.rootName===t.rootName&&e.isAdd===t.isAdd?[new pn(0)]:[e])),Cn(un,dn,((e,t)=>(e.splitPosition.hasSameParentAs(t.position)&&e.splitPosition.offset<t.position.offset&&(e.howMany+=t.howMany),e.splitPosition=e.splitPosition._getTransformedByInsertOperation(t),e.insertionPosition=e.insertionPosition._getTransformedByInsertOperation(t),[e]))),Cn(un,hn,((e,t,i)=>{if(!e.graveyardPosition&&!i.bWasUndone&&e.splitPosition.hasSameParentAs(t.sourcePosition)){const i=t.graveyardPosition.path.slice();i.push(0);const n=new At(t.graveyardPosition.root,i),o=un.getInsertionPosition(new At(t.graveyardPosition.root,i)),s=new un(n,0,o,null,0);return e.splitPosition=e.splitPosition._getTransformedByMergeOperation(t),e.insertionPosition=un.getInsertionPosition(e.splitPosition),e.graveyardPosition=s.insertionPosition.clone(),e.graveyardPosition.stickiness="toNext",[s,e]}return e.splitPosition.hasSameParentAs(t.deletionPosition)&&!e.splitPosition.isAfter(t.deletionPosition)&&e.howMany--,e.splitPosition.hasSameParentAs(t.targetPosition)&&(e.howMany+=t.howMany),e.splitPosition=e.splitPosition._getTransformedByMergeOperation(t),e.insertionPosition=un.getInsertionPosition(e.splitPosition),e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]})),Cn(un,cn,((e,t,i)=>{const n=St._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.graveyardPosition){const o=n.start.isEqual(e.graveyardPosition)||n.containsPosition(e.graveyardPosition);if(!i.bWasUndone&&o){const i=e.splitPosition._getTransformedByMoveOperation(t),n=e.graveyardPosition._getTransformedByMoveOperation(t),o=n.path.slice();o.push(0);const s=new At(n.root,o);return[new cn(i,e.howMany,s,0)]}e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(t)}const o=e.splitPosition.isEqual(t.targetPosition);if(o&&("insertAtSource"==i.baRelation||"splitBefore"==i.abRelation))return e.howMany+=t.howMany,e.splitPosition=e.splitPosition._getTransformedByDeletion(t.sourcePosition,t.howMany),e.insertionPosition=un.getInsertionPosition(e.splitPosition),[e];if(o&&i.abRelation&&i.abRelation.howMany){const{howMany:t,offset:n}=i.abRelation;return e.howMany+=t,e.splitPosition=e.splitPosition.getShiftedBy(n),[e]}if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&n.containsPosition(e.splitPosition)){const i=t.howMany-(e.splitPosition.offset-t.sourcePosition.offset);return e.howMany-=i,e.splitPosition.hasSameParentAs(t.targetPosition)&&e.splitPosition.offset<t.targetPosition.offset&&(e.howMany+=t.howMany),e.splitPosition=t.sourcePosition.clone(),e.insertionPosition=un.getInsertionPosition(e.splitPosition),[e]}return t.sourcePosition.isEqual(t.targetPosition)||(e.splitPosition.hasSameParentAs(t.sourcePosition)&&e.splitPosition.offset<=t.sourcePosition.offset&&(e.howMany-=t.howMany),e.splitPosition.hasSameParentAs(t.targetPosition)&&e.splitPosition.offset<t.targetPosition.offset&&(e.howMany+=t.howMany)),e.splitPosition.stickiness="toNone",e.splitPosition=e.splitPosition._getTransformedByMoveOperation(t),e.splitPosition.stickiness="toNext",e.graveyardPosition?e.insertionPosition=e.insertionPosition._getTransformedByMoveOperation(t):e.insertionPosition=un.getInsertionPosition(e.splitPosition),[e]})),Cn(un,un,((e,t,i)=>{if(e.splitPosition.isEqual(t.splitPosition)){if(!e.graveyardPosition&&!t.graveyardPosition)return[new pn(0)];if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition))return[new pn(0)];if("splitBefore"==i.abRelation)return e.howMany=0,e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t),[e]}if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition)){const n="$graveyard"==e.splitPosition.root.rootName,o="$graveyard"==t.splitPosition.root.rootName;if(o&&!n||(!n||o)&&i.aIsStrong){const i=[];return t.howMany&&i.push(new cn(t.moveTargetPosition,t.howMany,t.splitPosition,0)),e.howMany&&i.push(new cn(e.splitPosition,e.howMany,e.moveTargetPosition,0)),i}return[new pn(0)]}if(e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t)),e.splitPosition.isEqual(t.insertionPosition)&&"splitBefore"==i.abRelation)return e.howMany++,[e];if(t.splitPosition.isEqual(e.insertionPosition)&&"splitBefore"==i.baRelation){const i=t.insertionPosition.path.slice();i.push(0);const n=new At(t.insertionPosition.root,i);return[e,new cn(e.insertionPosition,1,n,0)]}return e.splitPosition.hasSameParentAs(t.splitPosition)&&e.splitPosition.offset<t.splitPosition.offset&&(e.howMany-=t.howMany),e.splitPosition=e.splitPosition._getTransformedBySplitOperation(t),e.insertionPosition=un.getInsertionPosition(e.splitPosition),[e]}));class Bn extends((0,n.EmitterMixin)(At)){constructor(e,t,i="toNone"){if(super(e,t,i),!this.root.is("rootElement"))throw new n.CKEditorError("model-liveposition-root-not-rootelement",e);Mn.call(this)}detach(){this.stopListening()}toPosition(){return new At(this.root,this.path.slice(),this.stickiness)}static fromPosition(e,t){return new this(e.root,e.path.slice(),t||e.stickiness)}}function Mn(){this.listenTo(this.root.document.model,"applyOperation",((e,t)=>{const i=t[0];i.isDocumentOperation&&On.call(this,i)}),{priority:"low"})}function On(e){const t=this.getTransformedByOperation(e);if(!this.isEqual(t)){const e=this.toPosition();this.path=t.path,this.root=t.root,this.fire("change",e)}}Bn.prototype.is=function(e){return"livePosition"===e||"model:livePosition"===e||"position"==e||"model:position"===e};class Ln{constructor(e={}){"string"==typeof e&&(e="transparent"===e?{isUndoable:!1}:{},(0,n.logWarning)("batch-constructor-deprecated-string-type"));const{isUndoable:t=!0,isLocal:i=!0,isUndo:o=!1,isTyping:s=!1}=e;this.operations=[],this.isUndoable=t,this.isLocal=i,this.isUndo=o,this.isTyping=s}get type(){return(0,n.logWarning)("batch-type-deprecated"),"default"}get baseVersion(){for(const e of this.operations)if(null!==e.baseVersion)return e.baseVersion;return null}addOperation(e){return e.batch=this,this.operations.push(e),e}}class Fn{constructor(e){this._changesInElement=new Map,this._elementsSnapshots=new Map,this._elementChildrenSnapshots=new Map,this._elementState=new Map,this._changedMarkers=new Map,this._changedRoots=new Map,this._changeCount=0,this._cachedChanges=null,this._cachedChangesWithGraveyard=null,this._refreshedItems=new Set,this._markerCollection=e}get isEmpty(){return 0==this._changesInElement.size&&0==this._changedMarkers.size&&0==this._changedRoots.size}bufferOperation(e){const t=e;switch(t.type){case"insert":if(this._isInInsertedElement(t.position.parent))return;this._markInsert(t.position.parent,t.position.offset,t.nodes.maxOffset);break;case"addAttribute":case"removeAttribute":case"changeAttribute":for(const e of t.range.getItems({shallow:!0}))this._isInInsertedElement(e.parent)||this._markAttribute(e);break;case"remove":case"move":case"reinsert":{if(t.sourcePosition.isEqual(t.targetPosition)||t.sourcePosition.getShiftedBy(t.howMany).isEqual(t.targetPosition))return;const e=this._isInInsertedElement(t.sourcePosition.parent),i=this._isInInsertedElement(t.targetPosition.parent);e||this._markRemove(t.sourcePosition.parent,t.sourcePosition.offset,t.howMany),i||this._markInsert(t.targetPosition.parent,t.getMovedRangeStart().offset,t.howMany);const n=St._createFromPositionAndShift(t.sourcePosition,t.howMany);for(const e of n.getItems({shallow:!0}))this._setElementState(e,"move");break}case"rename":{if(this._isInInsertedElement(t.position.parent))return;this._markRemove(t.position.parent,t.position.offset,1),this._markInsert(t.position.parent,t.position.offset,1);const e=St._createFromPositionAndShift(t.position,1);for(const t of this._markerCollection.getMarkersIntersectingRange(e)){const e=t.getData();this.bufferMarkerChange(t.name,e,e)}this._setElementState(t.position.nodeAfter,"rename");break}case"split":{const e=t.splitPosition.parent;if(!this._isInInsertedElement(e)){this._markRemove(e,t.splitPosition.offset,t.howMany);const i=St._createFromPositionAndShift(t.splitPosition,t.howMany);for(const e of i.getItems({shallow:!0}))this._setElementState(e,"move")}this._isInInsertedElement(t.insertionPosition.parent)||this._markInsert(t.insertionPosition.parent,t.insertionPosition.offset,1),t.graveyardPosition&&(this._markRemove(t.graveyardPosition.parent,t.graveyardPosition.offset,1),this._setElementState(t.graveyardPosition.nodeAfter,"move"));break}case"merge":{const e=t.sourcePosition.parent;this._isInInsertedElement(e.parent)||this._markRemove(e.parent,e.startOffset,1);const i=t.graveyardPosition.parent;this._markInsert(i,t.graveyardPosition.offset,1),this._setElementState(e,"move");const n=t.targetPosition.parent;if(!this._isInInsertedElement(n)){this._markInsert(n,t.targetPosition.offset,e.maxOffset);const i=St._createFromPositionAndShift(t.sourcePosition,t.howMany);for(const e of i.getItems({shallow:!0}))this._setElementState(e,"move")}break}case"detachRoot":case"addRoot":{const e=t.affectedSelectable;if(!e._isLoaded)return;if(e.isAttached()==t.isAdd)return;this._bufferRootStateChange(t.rootName,t.isAdd);break}case"addRootAttribute":case"removeRootAttribute":case"changeRootAttribute":{if(!t.root._isLoaded)return;const e=t.root.rootName;this._bufferRootAttributeChange(e,t.key,t.oldValue,t.newValue);break}}this._cachedChanges=null}bufferMarkerChange(e,t,i){t.range&&t.range.root.is("rootElement")&&!t.range.root._isLoaded&&(t.range=null),i.range&&i.range.root.is("rootElement")&&!i.range.root._isLoaded&&(i.range=null);let n=this._changedMarkers.get(e);n?n.newMarkerData=i:(n={newMarkerData:i,oldMarkerData:t},this._changedMarkers.set(e,n)),null==n.oldMarkerData.range&&null==i.range&&this._changedMarkers.delete(e)}getMarkersToRemove(){const e=[];for(const[t,i]of this._changedMarkers)null!=i.oldMarkerData.range&&e.push({name:t,range:i.oldMarkerData.range});return e}getMarkersToAdd(){const e=[];for(const[t,i]of this._changedMarkers)null!=i.newMarkerData.range&&e.push({name:t,range:i.newMarkerData.range});return e}getChangedMarkers(){return Array.from(this._changedMarkers).map((([e,t])=>({name:e,data:{oldRange:t.oldMarkerData.range,newRange:t.newMarkerData.range}})))}hasDataChanges(){if(this.getChanges().length)return!0;if(this._changedRoots.size>0)return!0;for(const{newMarkerData:e,oldMarkerData:t}of this._changedMarkers.values()){if(e.affectsData!==t.affectsData)return!0;if(e.affectsData){const i=e.range&&!t.range,n=!e.range&&t.range,o=e.range&&t.range&&!e.range.isEqual(t.range);if(i||n||o)return!0}}return!1}getChanges(e={}){if(this._cachedChanges)return e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice();let t=[];for(const e of this._changesInElement.keys()){const i=this._changesInElement.get(e).sort(((e,t)=>e.offset===t.offset?e.type!=t.type?"remove"==e.type?-1:1:0:e.offset<t.offset?-1:1)),n=this._elementChildrenSnapshots.get(e),o=zn(e.getChildren()),s=Wn(n.length,i);let r=0,a=0;for(const i of s)if("i"===i){const i=this._getDiffActionForNode(o[r].node,"insert"),n=this._elementsSnapshots.get(o[r].node),s=this._getInsertDiff(e,r,i,o[r],n);t.push(s),r++}else if("r"===i){const i=this._getDiffActionForNode(n[a].node,"remove"),o=this._getRemoveDiff(e,r,i,n[a]);t.push(o),a++}else if("a"===i){const i=n[a].attributes,s=o[r].attributes;let l;if("$text"==o[r].name)l=new St(At._createAt(e,r),At._createAt(e,r+1));else{const t=e.offsetToIndex(r);l=new St(At._createAt(e,r),At._createAt(e.getChild(t),0))}const c=this._getAttributesDiff(l,i,s);t.push(...c),r++,a++}else r++,a++}t.sort(((e,t)=>e.position.root!=t.position.root?e.position.root.rootName<t.position.root.rootName?-1:1:e.position.isEqual(t.position)?e.changeCount-t.changeCount:e.position.isBefore(t.position)?-1:1));for(let e=1,i=0;e<t.length;e++){const n=t[i],o=t[e],s="remove"==n.type&&"remove"==o.type&&"$text"==n.name&&"$text"==o.name&&n.position.isEqual(o.position),r="insert"==n.type&&"insert"==o.type&&"$text"==n.name&&"$text"==o.name&&n.position.parent==o.position.parent&&n.position.offset+n.length==o.position.offset,a="attribute"==n.type&&"attribute"==o.type&&n.position.parent==o.position.parent&&n.range.isFlat&&o.range.isFlat&&n.position.offset+n.length==o.position.offset&&n.attributeKey==o.attributeKey&&n.attributeOldValue==o.attributeOldValue&&n.attributeNewValue==o.attributeNewValue;s||r||a?(n.length++,a&&(n.range.end=n.range.end.getShiftedBy(1)),t[e]=null):i=e}t=t.filter((e=>e));for(const e of t)delete e.changeCount,"attribute"==e.type&&(delete e.position,delete e.length);return this._changeCount=0,this._cachedChangesWithGraveyard=t,this._cachedChanges=t.filter(Hn),e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice()}getChangedRoots(){return Array.from(this._changedRoots.values()).map((e=>{const t={...e};return void 0!==t.state&&delete t.attributes,t}))}getRefreshedItems(){return new Set(this._refreshedItems)}reset(){this._changesInElement.clear(),this._elementChildrenSnapshots.clear(),this._elementsSnapshots.clear(),this._elementState.clear(),this._changedMarkers.clear(),this._changedRoots.clear(),this._refreshedItems.clear(),this._cachedChanges=null}_refreshItem(e){if(this._isInInsertedElement(e.parent))return;this._markRemove(e.parent,e.startOffset,e.offsetSize),this._markInsert(e.parent,e.startOffset,e.offsetSize),this._refreshedItems.add(e),this._setElementState(e,"refresh");const t=St._createOn(e);for(const e of this._markerCollection.getMarkersIntersectingRange(t)){const t=e.getData();this.bufferMarkerChange(e.name,t,t)}this._cachedChanges=null}_bufferRootLoad(e){if(e.isAttached()){this._bufferRootStateChange(e.rootName,!0),this._markInsert(e,0,e.maxOffset);for(const t of e.getAttributeKeys())this._bufferRootAttributeChange(e.rootName,t,null,e.getAttribute(t));for(const t of this._markerCollection)if(t.getRange().root==e){const e=t.getData();this.bufferMarkerChange(t.name,{...e,range:null},e)}}}_bufferRootStateChange(e,t){if(!this._changedRoots.has(e))return void this._changedRoots.set(e,{name:e,state:t?"attached":"detached"});const i=this._changedRoots.get(e);void 0!==i.state?(delete i.state,void 0===i.attributes&&this._changedRoots.delete(e)):i.state=t?"attached":"detached"}_bufferRootAttributeChange(e,t,i,n){const o=this._changedRoots.get(e)||{name:e},s=o.attributes||{};if(s[t]){const e=s[t];n===e.oldValue?delete s[t]:e.newValue=n}else s[t]={oldValue:i,newValue:n};0===Object.entries(s).length?(delete o.attributes,void 0===o.state&&this._changedRoots.delete(e)):(o.attributes=s,this._changedRoots.set(e,o))}_markInsert(e,t,i){if(e.root.is("rootElement")&&!e.root._isLoaded)return;const n={type:"insert",offset:t,howMany:i,count:this._changeCount++};this._markChange(e,n)}_markRemove(e,t,i){if(e.root.is("rootElement")&&!e.root._isLoaded)return;const n={type:"remove",offset:t,howMany:i,count:this._changeCount++};this._markChange(e,n),this._removeAllNestedChanges(e,t,i)}_markAttribute(e){if(e.root.is("rootElement")&&!e.root._isLoaded)return;const t={type:"attribute",offset:e.startOffset,howMany:e.offsetSize,count:this._changeCount++};this._markChange(e.parent,t)}_markChange(e,t){this._makeSnapshots(e);const i=this._getChangesForElement(e);this._handleChange(t,i),i.push(t);for(let e=0;e<i.length;e++)i[e].howMany<1&&(i.splice(e,1),e--)}_setElementState(e,t){if(!e.is("element"))return;const i=Fn._statesPriority.indexOf(this._elementState.get(e));Fn._statesPriority.indexOf(t)>i&&this._elementState.set(e,t)}_getDiffActionForNode(e,t){if(!e.is("element"))return t;if(!this._elementsSnapshots.has(e))return t;const i=this._elementState.get(e);return i&&"move"!=i?i:t}_getChangesForElement(e){let t;return this._changesInElement.has(e)?t=this._changesInElement.get(e):(t=[],this._changesInElement.set(e,t)),t}_makeSnapshots(e){if(this._elementChildrenSnapshots.has(e))return;const t=zn(e.getChildren());this._elementChildrenSnapshots.set(e,t);for(const e of t)this._elementsSnapshots.set(e.node,e)}_handleChange(e,t){e.nodesToHandle=e.howMany;for(const i of t){const n=e.offset+e.howMany,o=i.offset+i.howMany;if("insert"==e.type&&("insert"==i.type&&(e.offset<=i.offset?i.offset+=e.howMany:e.offset<o&&(i.howMany+=e.nodesToHandle,e.nodesToHandle=0)),"remove"==i.type&&e.offset<i.offset&&(i.offset+=e.howMany),"attribute"==i.type))if(e.offset<=i.offset)i.offset+=e.howMany;else if(e.offset<o){const o=i.howMany;i.howMany=e.offset-i.offset,t.unshift({type:"attribute",offset:n,howMany:o-i.howMany,count:this._changeCount++})}if("remove"==e.type){if("insert"==i.type)if(n<=i.offset)i.offset-=e.howMany;else if(n<=o)if(e.offset<i.offset){const t=n-i.offset;i.offset=e.offset,i.howMany-=t,e.nodesToHandle-=t}else i.howMany-=e.nodesToHandle,e.nodesToHandle=0;else if(e.offset<=i.offset)e.nodesToHandle-=i.howMany,i.howMany=0;else if(e.offset<o){const t=o-e.offset;i.howMany-=t,e.nodesToHandle-=t}if("remove"==i.type&&(n<=i.offset?i.offset-=e.howMany:e.offset<i.offset&&(e.nodesToHandle+=i.howMany,i.howMany=0)),"attribute"==i.type)if(n<=i.offset)i.offset-=e.howMany;else if(e.offset<i.offset){const t=n-i.offset;i.offset=e.offset,i.howMany-=t}else if(e.offset<o)if(n<=o){const n=i.howMany;i.howMany=e.offset-i.offset;const o=n-i.howMany-e.nodesToHandle;t.unshift({type:"attribute",offset:e.offset,howMany:o,count:this._changeCount++})}else i.howMany-=o-e.offset}if("attribute"==e.type){if("insert"==i.type)if(e.offset<i.offset&&n>i.offset){if(n>o){const e={type:"attribute",offset:o,howMany:n-o,count:this._changeCount++};this._handleChange(e,t),t.push(e)}e.nodesToHandle=i.offset-e.offset,e.howMany=e.nodesToHandle}else e.offset>=i.offset&&e.offset<o&&(n>o?(e.nodesToHandle=n-o,e.offset=o):e.nodesToHandle=0);if("remove"==i.type&&e.offset<i.offset&&n>i.offset){const o={type:"attribute",offset:i.offset,howMany:n-i.offset,count:this._changeCount++};this._handleChange(o,t),t.push(o),e.nodesToHandle=i.offset-e.offset,e.howMany=e.nodesToHandle}"attribute"==i.type&&(e.offset>=i.offset&&n<=o?(e.nodesToHandle=0,e.howMany=0,e.offset=0):e.offset<=i.offset&&n>=o&&(i.howMany=0))}}e.howMany=e.nodesToHandle,delete e.nodesToHandle}_getInsertDiff(e,t,i,n,o){const s={type:"insert",position:At._createAt(e,t),name:n.name,attributes:new Map(n.attributes),length:1,changeCount:this._changeCount++,action:i};return"insert"!=i&&o&&(s.before={name:o.name,attributes:new Map(o.attributes)}),s}_getRemoveDiff(e,t,i,n){return{type:"remove",action:i,position:At._createAt(e,t),name:n.name,attributes:new Map(n.attributes),length:1,changeCount:this._changeCount++}}_getAttributesDiff(e,t,i){const n=[];i=new Map(i);for(const[o,s]of t){const t=i.has(o)?i.get(o):null;t!==s&&n.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:o,attributeOldValue:s,attributeNewValue:t,changeCount:this._changeCount++}),i.delete(o)}for(const[t,o]of i)n.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:t,attributeOldValue:null,attributeNewValue:o,changeCount:this._changeCount++});return n}_isInInsertedElement(e){const t=e.parent;if(!t)return!1;const i=this._changesInElement.get(t),n=e.startOffset;if(i)for(const e of i)if("insert"==e.type&&n>=e.offset&&n<e.offset+e.howMany)return!0;return this._isInInsertedElement(t)}_removeAllNestedChanges(e,t,i){const n=new St(At._createAt(e,t),At._createAt(e,t+i));for(const e of n.getItems({shallow:!0}))e.is("element")&&(this._changesInElement.delete(e),this._removeAllNestedChanges(e,0,e.maxOffset))}}Fn._statesPriority=[void 0,"refresh","rename","move"];const Nn=Fn;function Dn(e){return{node:e,name:e.is("$text")?"$text":e.name,attributes:new Map(e.getAttributes())}}function zn(e){const t=[];for(const i of e)if(i.is("$text"))for(let e=0;e<i.data.length;++e)t.push(Dn(i));else t.push(Dn(i));return t}function Wn(e,t){const i=[];let n=0,o=0;for(const e of t){if(e.offset>n){for(let t=0;t<e.offset-n;t++)i.push("e");o+=e.offset-n}if("insert"==e.type){for(let t=0;t<e.howMany;t++)i.push("i");n=e.offset+e.howMany}else if("remove"==e.type){for(let t=0;t<e.howMany;t++)i.push("r");n=e.offset,o+=e.howMany}else i.push(..."a".repeat(e.howMany).split("")),n=e.offset+e.howMany,o+=e.howMany}if(o<e)for(let t=0;t<e-o-n;t++)i.push("e");return i}function Hn(e){const t="position"in e&&"$graveyard"==e.position.root.rootName,i="range"in e&&"$graveyard"==e.range.root.rootName;return!t&&!i}class Un{constructor(){this._operations=[],this._undoPairs=new Map,this._undoneOperations=new Set,this._baseVersionToOperationIndex=new Map,this._version=0,this._gaps=new Map}get version(){return this._version}set version(e){this._operations.length&&e>this._version+1&&this._gaps.set(this._version,e),this._version=e}get lastOperation(){return this._operations[this._operations.length-1]}addOperation(e){if(e.baseVersion!==this.version)throw new n.CKEditorError("model-document-history-addoperation-incorrect-version",this,{operation:e,historyVersion:this.version});this._operations.push(e),this._version++,this._baseVersionToOperationIndex.set(e.baseVersion,this._operations.length-1)}getOperations(e,t=this.version){if(!this._operations.length)return[];const i=this._operations[0];void 0===e&&(e=i.baseVersion);let n=t-1;for(const[t,i]of this._gaps)e>t&&e<i&&(e=i),n>t&&n<i&&(n=t-1);if(n<i.baseVersion||e>this.lastOperation.baseVersion)return[];let o=this._baseVersionToOperationIndex.get(e);void 0===o&&(o=0);let s=this._baseVersionToOperationIndex.get(n);return void 0===s&&(s=this._operations.length-1),this._operations.slice(o,s+1)}getOperation(e){const t=this._baseVersionToOperationIndex.get(e);if(void 0!==t)return this._operations[t]}setOperationAsUndone(e,t){this._undoPairs.set(t,e),this._undoneOperations.add(e)}isUndoingOperation(e){return this._undoPairs.has(e)}isUndoneOperation(e){return this._undoneOperations.has(e)}getUndoneOperation(e){return this._undoPairs.get(e)}reset(){this._version=0,this._undoPairs=new Map,this._operations=[],this._undoneOperations=new Set,this._gaps=new Map,this._baseVersionToOperationIndex=new Map}}class $n extends yt{constructor(e,t,i="main"){super(t),this._isAttached=!0,this._isLoaded=!0,this._document=e,this.rootName=i}get document(){return this._document}isAttached(){return this._isAttached}toJSON(){return this.rootName}}$n.prototype.is=function(e,t){return t?t===this.name&&("rootElement"===e||"model:rootElement"===e||"element"===e||"model:element"===e):"rootElement"===e||"model:rootElement"===e||"element"===e||"model:element"===e||"node"===e||"model:node"===e};const jn="$graveyard";class qn extends((0,n.EmitterMixin)()){constructor(e){super(),this.model=e,this.history=new Un,this.selection=new Gt(this),this.roots=new n.Collection({idProperty:"rootName"}),this.differ=new Nn(e.markers),this.isReadOnly=!1,this._postFixers=new Set,this._hasSelectionChangedFromTheLastChangeBlock=!1,this.createRoot("$root",jn),this.listenTo(e,"applyOperation",((e,t)=>{const i=t[0];i.isDocumentOperation&&this.differ.bufferOperation(i)}),{priority:"high"}),this.listenTo(e,"applyOperation",((e,t)=>{const i=t[0];i.isDocumentOperation&&this.history.addOperation(i)}),{priority:"low"}),this.listenTo(this.selection,"change",(()=>{this._hasSelectionChangedFromTheLastChangeBlock=!0})),this.listenTo(e.markers,"update",((e,t,i,n,o)=>{const s={...t.getData(),range:n};this.differ.bufferMarkerChange(t.name,o,s),null===i&&t.on("change",((e,i)=>{const n=t.getData();this.differ.bufferMarkerChange(t.name,{...n,range:i},n)}))})),this.registerPostFixer((e=>{let t=!1;for(const i of this.roots)i.isAttached()||i.isEmpty||(e.remove(e.createRangeIn(i)),t=!0);for(const i of this.model.markers)i.getRange().root.isAttached()||(e.removeMarker(i),t=!0);return t}))}get version(){return this.history.version}set version(e){this.history.version=e}get graveyard(){return this.getRoot(jn)}createRoot(e="$root",t="main"){if(this.roots.get(t))throw new n.CKEditorError("model-document-createroot-name-exists",this,{name:t});const i=new $n(this,e,t);return this.roots.add(i),i}destroy(){this.selection.destroy(),this.stopListening()}getRoot(e="main"){return this.roots.get(e)}getRootNames(e=!1){return this.getRoots(e).map((e=>e.rootName))}getRoots(e=!1){return this.roots.filter((t=>t!=this.graveyard&&(e||t.isAttached())&&t._isLoaded))}registerPostFixer(e){this._postFixers.add(e)}toJSON(){const e=p(this);return e.selection="[engine.model.DocumentSelection]",e.model="[engine.model.Model]",e}_handleChangeBlock(e){this._hasDocumentChangedFromTheLastChangeBlock()&&(this._callPostFixers(e),this.selection.refresh(),this.differ.hasDataChanges()?this.fire("change:data",e.batch):this.fire("change",e.batch),this.selection.refresh(),this.differ.reset()),this._hasSelectionChangedFromTheLastChangeBlock=!1}_hasDocumentChangedFromTheLastChangeBlock(){return!this.differ.isEmpty||this._hasSelectionChangedFromTheLastChangeBlock}_getDefaultRoot(){const e=this.getRoots();return e.length?e[0]:this.graveyard}_getDefaultRange(){const e=this._getDefaultRoot(),t=this.model,i=t.schema,n=t.createPositionFromPath(e,[0]);return i.getNearestSelectionRange(n)||t.createRange(n)}_validateSelectionRange(e){return Kn(e.start)&&Kn(e.end)}_callPostFixers(e){let t=!1;do{for(const i of this._postFixers)if(this.selection.refresh(),t=i(e),t)break}while(t)}}function Kn(e){const t=e.textNode;if(t){const i=t.data,o=e.offset-t.startOffset;return!(0,n.isInsideSurrogatePair)(i,o)&&!(0,n.isInsideCombinedSymbol)(i,o)}return!0}class Gn extends((0,n.EmitterMixin)()){constructor(){super(...arguments),this._markers=new Map}[Symbol.iterator](){return this._markers.values()}has(e){const t=e instanceof Zn?e.name:e;return this._markers.has(t)}get(e){return this._markers.get(e)||null}_set(e,t,i=!1,o=!1){const s=e instanceof Zn?e.name:e;if(s.includes(","))throw new n.CKEditorError("markercollection-incorrect-marker-name",this);const r=this._markers.get(s);if(r){const e=r.getData(),n=r.getRange();let a=!1;return n.isEqual(t)||(r._attachLiveRange($t.fromRange(t)),a=!0),i!=r.managedUsingOperations&&(r._managedUsingOperations=i,a=!0),"boolean"==typeof o&&o!=r.affectsData&&(r._affectsData=o,a=!0),a&&this.fire(`update:${s}`,r,n,t,e),r}const a=$t.fromRange(t),l=new Zn(s,a,i,o);return this._markers.set(s,l),this.fire(`update:${s}`,l,null,t,{...l.getData(),range:null}),l}_remove(e){const t=e instanceof Zn?e.name:e,i=this._markers.get(t);return!!i&&(this._markers.delete(t),this.fire(`update:${t}`,i,i.getRange(),null,i.getData()),this._destroyMarker(i),!0)}_refresh(e){const t=e instanceof Zn?e.name:e,i=this._markers.get(t);if(!i)throw new n.CKEditorError("markercollection-refresh-marker-not-exists",this);const o=i.getRange();this.fire(`update:${t}`,i,o,o,i.getData())}*getMarkersAtPosition(e){for(const t of this)t.getRange().containsPosition(e)&&(yield t)}*getMarkersIntersectingRange(e){for(const t of this)null!==t.getRange().getIntersection(e)&&(yield t)}destroy(){for(const e of this._markers.values())this._destroyMarker(e);this._markers=null,this.stopListening()}*getMarkersGroup(e){for(const t of this._markers.values())t.name.startsWith(e+":")&&(yield t)}_destroyMarker(e){e.stopListening(),e._detachLiveRange()}}class Zn extends((0,n.EmitterMixin)(pt)){constructor(e,t,i,n){super(),this.name=e,this._liveRange=this._attachLiveRange(t),this._managedUsingOperations=i,this._affectsData=n}get managedUsingOperations(){if(!this._liveRange)throw new n.CKEditorError("marker-destroyed",this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new n.CKEditorError("marker-destroyed",this);return this._affectsData}getData(){return{range:this.getRange(),affectsData:this.affectsData,managedUsingOperations:this.managedUsingOperations}}getStart(){if(!this._liveRange)throw new n.CKEditorError("marker-destroyed",this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new n.CKEditorError("marker-destroyed",this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new n.CKEditorError("marker-destroyed",this);return this._liveRange.toRange()}_attachLiveRange(e){return this._liveRange&&this._detachLiveRange(),e.delegate("change:range").to(this),e.delegate("change:content").to(this),this._liveRange=e,e}_detachLiveRange(){this._liveRange.stopDelegating("change:range",this),this._liveRange.stopDelegating("change:content",this),this._liveRange.detach(),this._liveRange=null}}Zn.prototype.is=function(e){return"marker"===e||"model:marker"===e};class Jn extends en{constructor(e,t){super(null),this.sourcePosition=e.clone(),this.howMany=t}get type(){return"detach"}get affectedSelectable(){return null}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e}_validate(){if(this.sourcePosition.root.document)throw new n.CKEditorError("detach-operation-on-document-node",this)}_execute(){nn(St._createFromPositionAndShift(this.sourcePosition,this.howMany))}static get className(){return"DetachOperation"}}class Qn extends pt{constructor(e){super(),this.markers=new Map,this._children=new wt,e&&this._insertChild(0,e)}[Symbol.iterator](){return this.getChildren()}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return 0===this.childCount}get nextSibling(){return null}get previousSibling(){return null}get root(){return this}get parent(){return null}get document(){return null}isAttached(){return!1}getAncestors(){return[]}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}getPath(){return[]}getNodeByPath(e){let t=this;for(const i of e)t=t.getChild(t.offsetToIndex(i));return t}offsetToIndex(e){return this._children.offsetToIndex(e)}toJSON(){const e=[];for(const t of this._children)e.push(t.toJSON());return e}static fromJSON(e){const t=[];for(const i of e)i.name?t.push(yt.fromJSON(i)):t.push(vt.fromJSON(i));return new Qn(t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const i=function(e){return"string"==typeof e?[new vt(e)]:((0,n.isIterable)(e)||(e=[e]),Array.from(e).map((e=>"string"==typeof e?new vt(e):e instanceof _t?new vt(e.data,e.getAttributes()):e)))}(t);for(const e of i)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,i)}_removeChildren(e,t=1){const i=this._children._removeNodes(e,t);for(const e of i)e.parent=null;return i}}Qn.prototype.is=function(e){return"documentFragment"===e||"model:documentFragment"===e};class Yn{constructor(e,t){this.model=e,this.batch=t}createText(e,t){return new vt(e,t)}createElement(e,t){return new yt(e,t)}createDocumentFragment(){return new Qn}cloneElement(e,t=!0){return e._clone(t)}insert(e,t,i=0){if(this._assertWriterUsedCorrectly(),e instanceof vt&&""==e.data)return;const o=At._createAt(t,i);if(e.parent){if(no(e.root,o.root))return void this.move(St._createOn(e),o);if(e.root.document)throw new n.CKEditorError("model-writer-insert-forbidden-move",this);this.remove(e)}const s=o.root.document?o.root.document.version:null,r=new dn(o,e,s);if(e instanceof vt&&(r.shouldReceiveAttributes=!0),this.batch.addOperation(r),this.model.applyOperation(r),e instanceof Qn)for(const[t,i]of e.markers){const e=At._createAt(i.root,0),n={range:new St(i.start._getCombined(e,o),i.end._getCombined(e,o)),usingOperation:!0,affectsData:!0};this.model.markers.has(t)?this.updateMarker(t,n):this.addMarker(t,n)}}insertText(e,t,i,n){t instanceof Qn||t instanceof yt||t instanceof At?this.insert(this.createText(e),t,i):this.insert(this.createText(e,t),i,n)}insertElement(e,t,i,n){t instanceof Qn||t instanceof yt||t instanceof At?this.insert(this.createElement(e),t,i):this.insert(this.createElement(e,t),i,n)}append(e,t){this.insert(e,t,"end")}appendText(e,t,i){t instanceof Qn||t instanceof yt?this.insert(this.createText(e),t,"end"):this.insert(this.createText(e,t),i,"end")}appendElement(e,t,i){t instanceof Qn||t instanceof yt?this.insert(this.createElement(e),t,"end"):this.insert(this.createElement(e,t),i,"end")}setAttribute(e,t,i){if(this._assertWriterUsedCorrectly(),i instanceof St){const n=i.getMinimalFlatRanges();for(const i of n)Xn(this,e,t,i)}else eo(this,e,t,i)}setAttributes(e,t){for(const[i,o]of(0,n.toMap)(e))this.setAttribute(i,o,t)}removeAttribute(e,t){if(this._assertWriterUsedCorrectly(),t instanceof St){const i=t.getMinimalFlatRanges();for(const t of i)Xn(this,e,null,t)}else eo(this,e,null,t)}clearAttributes(e){this._assertWriterUsedCorrectly();const t=e=>{for(const t of e.getAttributeKeys())this.removeAttribute(t,e)};if(e instanceof St)for(const i of e.getItems())t(i);else t(e)}move(e,t,i){if(this._assertWriterUsedCorrectly(),!(e instanceof St))throw new n.CKEditorError("writer-move-invalid-range",this);if(!e.isFlat)throw new n.CKEditorError("writer-move-range-not-flat",this);const o=At._createAt(t,i);if(o.isEqual(e.start))return;if(this._addOperationForAffectedMarkers("move",e),!no(e.root,o.root))throw new n.CKEditorError("writer-move-different-document",this);const s=e.root.document?e.root.document.version:null,r=new cn(e.start,e.end.offset-e.start.offset,o,s);this.batch.addOperation(r),this.model.applyOperation(r)}remove(e){this._assertWriterUsedCorrectly();const t=(e instanceof St?e:St._createOn(e)).getMinimalFlatRanges().reverse();for(const e of t)this._addOperationForAffectedMarkers("move",e),io(e.start,e.end.offset-e.start.offset,this.batch,this.model)}merge(e){this._assertWriterUsedCorrectly();const t=e.nodeBefore,i=e.nodeAfter;if(this._addOperationForAffectedMarkers("merge",e),!(t instanceof yt))throw new n.CKEditorError("writer-merge-no-element-before",this);if(!(i instanceof yt))throw new n.CKEditorError("writer-merge-no-element-after",this);e.root.document?this._merge(e):this._mergeDetached(e)}createPositionFromPath(e,t,i){return this.model.createPositionFromPath(e,t,i)}createPositionAt(e,t){return this.model.createPositionAt(e,t)}createPositionAfter(e){return this.model.createPositionAfter(e)}createPositionBefore(e){return this.model.createPositionBefore(e)}createRange(e,t){return this.model.createRange(e,t)}createRangeIn(e){return this.model.createRangeIn(e)}createRangeOn(e){return this.model.createRangeOn(e)}createSelection(...e){return this.model.createSelection(...e)}_mergeDetached(e){const t=e.nodeBefore,i=e.nodeAfter;this.move(St._createIn(i),At._createAt(t,"end")),this.remove(i)}_merge(e){const t=At._createAt(e.nodeBefore,"end"),i=At._createAt(e.nodeAfter,0),n=e.root.document.graveyard,o=new At(n,[0]),s=e.root.document.version,r=new hn(i,e.nodeAfter.maxOffset,t,o,s);this.batch.addOperation(r),this.model.applyOperation(r)}rename(e,t){if(this._assertWriterUsedCorrectly(),!(e instanceof yt))throw new n.CKEditorError("writer-rename-not-element-instance",this);const i=e.root.document?e.root.document.version:null,o=new bn(At._createBefore(e),e.name,t,i);this.batch.addOperation(o),this.model.applyOperation(o)}split(e,t){this._assertWriterUsedCorrectly();let i,o,s=e.parent;if(!s.parent)throw new n.CKEditorError("writer-split-element-no-parent",this);if(t||(t=s.parent),!e.parent.getAncestors({includeSelf:!0}).includes(t))throw new n.CKEditorError("writer-split-invalid-limit-element",this);do{const t=s.root.document?s.root.document.version:null,n=s.maxOffset-e.offset,r=un.getInsertionPosition(e),a=new un(e,n,r,null,t);this.batch.addOperation(a),this.model.applyOperation(a),i||o||(i=s,o=e.parent.nextSibling),s=(e=this.createPositionAfter(e.parent)).parent}while(s!==t);return{position:e,range:new St(At._createAt(i,"end"),At._createAt(o,0))}}wrap(e,t){if(this._assertWriterUsedCorrectly(),!e.isFlat)throw new n.CKEditorError("writer-wrap-range-not-flat",this);const i=t instanceof yt?t:new yt(t);if(i.childCount>0)throw new n.CKEditorError("writer-wrap-element-not-empty",this);if(null!==i.parent)throw new n.CKEditorError("writer-wrap-element-attached",this);this.insert(i,e.start);const o=new St(e.start.getShiftedBy(1),e.end.getShiftedBy(1));this.move(o,At._createAt(i,0))}unwrap(e){if(this._assertWriterUsedCorrectly(),null===e.parent)throw new n.CKEditorError("writer-unwrap-element-no-parent",this);this.move(St._createIn(e),this.createPositionAfter(e)),this.remove(e)}addMarker(e,t){if(this._assertWriterUsedCorrectly(),!t||"boolean"!=typeof t.usingOperation)throw new n.CKEditorError("writer-addmarker-no-usingoperation",this);const i=t.usingOperation,o=t.range,s=void 0!==t.affectsData&&t.affectsData;if(this.model.markers.has(e))throw new n.CKEditorError("writer-addmarker-marker-exists",this);if(!o)throw new n.CKEditorError("writer-addmarker-no-range",this);return i?(to(this,e,null,o,s),this.model.markers.get(e)):this.model.markers._set(e,o,i,s)}updateMarker(e,t){this._assertWriterUsedCorrectly();const i="string"==typeof e?e:e.name,o=this.model.markers.get(i);if(!o)throw new n.CKEditorError("writer-updatemarker-marker-not-exists",this);if(!t)return(0,n.logWarning)("writer-updatemarker-reconvert-using-editingcontroller",{markerName:i}),void this.model.markers._refresh(o);const s="boolean"==typeof t.usingOperation,r="boolean"==typeof t.affectsData,a=r?t.affectsData:o.affectsData;if(!s&&!t.range&&!r)throw new n.CKEditorError("writer-updatemarker-wrong-options",this);const l=o.getRange(),c=t.range?t.range:l;s&&t.usingOperation!==o.managedUsingOperations?t.usingOperation?to(this,i,null,c,a):(to(this,i,l,null,a),this.model.markers._set(i,c,void 0,a)):o.managedUsingOperations?to(this,i,l,c,a):this.model.markers._set(i,c,void 0,a)}removeMarker(e){this._assertWriterUsedCorrectly();const t="string"==typeof e?e:e.name;if(!this.model.markers.has(t))throw new n.CKEditorError("writer-removemarker-no-marker",this);const i=this.model.markers.get(t);i.managedUsingOperations?to(this,t,i.getRange(),null,i.affectsData):this.model.markers._remove(t)}addRoot(e,t="$root"){this._assertWriterUsedCorrectly();const i=this.model.document.getRoot(e);if(i&&i.isAttached())throw new n.CKEditorError("writer-addroot-root-exists",this);const o=this.model.document,s=new vn(e,t,!0,o,o.version);return this.batch.addOperation(s),this.model.applyOperation(s),this.model.document.getRoot(e)}detachRoot(e){this._assertWriterUsedCorrectly();const t="string"==typeof e?this.model.document.getRoot(e):e;if(!t||!t.isAttached())throw new n.CKEditorError("writer-detachroot-no-root",this);for(const e of this.model.markers)e.getRange().root===t&&this.removeMarker(e);for(const e of t.getAttributeKeys())this.removeAttribute(e,t);this.remove(this.createRangeIn(t));const i=this.model.document,o=new vn(t.rootName,t.name,!1,i,i.version);this.batch.addOperation(o),this.model.applyOperation(o)}setSelection(...e){this._assertWriterUsedCorrectly(),this.model.document.selection._setTo(...e)}setSelectionFocus(e,t){this._assertWriterUsedCorrectly(),this.model.document.selection._setFocus(e,t)}setSelectionAttribute(e,t){if(this._assertWriterUsedCorrectly(),"string"==typeof e)this._setSelectionAttribute(e,t);else for(const[t,i]of(0,n.toMap)(e))this._setSelectionAttribute(t,i)}removeSelectionAttribute(e){if(this._assertWriterUsedCorrectly(),"string"==typeof e)this._removeSelectionAttribute(e);else for(const t of e)this._removeSelectionAttribute(t)}overrideSelectionGravity(){return this.model.document.selection._overrideGravity()}restoreSelectionGravity(e){this.model.document.selection._restoreGravity(e)}_setSelectionAttribute(e,t){const i=this.model.document.selection;if(i.isCollapsed&&i.anchor.parent.isEmpty){const n=Gt._getStoreAttributeKey(e);this.setAttribute(n,t,i.anchor.parent)}i._setAttribute(e,t)}_removeSelectionAttribute(e){const t=this.model.document.selection;if(t.isCollapsed&&t.anchor.parent.isEmpty){const i=Gt._getStoreAttributeKey(e);this.removeAttribute(i,t.anchor.parent)}t._removeAttribute(e)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new n.CKEditorError("writer-incorrect-use",this)}_addOperationForAffectedMarkers(e,t){for(const i of this.model.markers){if(!i.managedUsingOperations)continue;const n=i.getRange();let o=!1;if("move"===e){const e=t;o=e.containsPosition(n.start)||e.start.isEqual(n.start)||e.containsPosition(n.end)||e.end.isEqual(n.end)}else{const e=t,i=e.nodeBefore,s=e.nodeAfter,r=n.start.parent==i&&n.start.isAtEnd,a=n.end.parent==s&&0==n.end.offset,l=n.end.nodeAfter==s,c=n.start.nodeAfter==s;o=r||a||l||c}o&&this.updateMarker(i.name,{range:n})}}}function Xn(e,t,i,n){const o=e.model,s=o.document;let r,a,l,c=n.start;for(const e of n.getWalker({shallow:!0}))l=e.item.getAttribute(t),r&&a!=l&&(a!=i&&d(),c=r),r=e.nextPosition,a=l;function d(){const n=new St(c,r),l=n.root.document?s.version:null,d=new fn(n,t,a,i,l);e.batch.addOperation(d),o.applyOperation(d)}r instanceof At&&r!=c&&a!=i&&d()}function eo(e,t,i,n){const o=e.model,s=o.document,r=n.getAttribute(t);let a,l;if(r!=i){if(n.root===n){const e=n.document?s.version:null;l=new wn(n,t,r,i,e)}else{a=new St(At._createBefore(n),e.createPositionAfter(n));const o=a.root.document?s.version:null;l=new fn(a,t,r,i,o)}e.batch.addOperation(l),o.applyOperation(l)}}function to(e,t,i,n,o){const s=e.model,r=s.document,a=new mn(t,i,n,s.markers,!!o,r.version);e.batch.addOperation(a),s.applyOperation(a)}function io(e,t,i,n){let o;if(e.root.document){const i=n.document,s=new At(i.graveyard,[0]);o=new cn(e,t,s,i.version)}else o=new Jn(e,t);i.addOperation(o),n.applyOperation(o)}function no(e,t){return e===t||e instanceof $n&&t instanceof $n}function oo(e,t,i={}){if(t.isCollapsed)return;const n=t.getFirstRange();if("$graveyard"==n.root.rootName)return;const o=e.schema;e.change((e=>{if(!i.doNotResetEntireContent&&function(e,t){const i=e.getLimitElement(t);if(!t.containsEntireContent(i))return!1;const n=t.getFirstRange();return n.start.parent!=n.end.parent&&e.checkChild(i,"paragraph")}(o,t))return void function(e,t){const i=e.model.schema.getLimitElement(t);e.remove(e.createRangeIn(i)),lo(e,e.createPositionAt(i,0),t)}(e,t);const s={};if(!i.doNotAutoparagraph){const e=t.getSelectedElement();e&&Object.assign(s,o.getAttributesWithProperty(e,"copyOnReplace",!0))}const[r,a]=function(e){const t=e.root.document.model,i=e.start;let n=e.end;if(t.hasContent(e,{ignoreMarkers:!0})){const i=function(e){const t=e.parent,i=t.root.document.model.schema,n=t.getAncestors({parentFirst:!0,includeSelf:!0});for(const e of n){if(i.isLimit(e))return null;if(i.isBlock(e))return e}}(n);if(i&&n.isTouching(t.createPositionAt(i,0))){const i=t.createSelection(e);t.modifySelection(i,{direction:"backward"});const o=i.getLastPosition(),s=t.createRange(o,n);t.hasContent(s,{ignoreMarkers:!0})||(n=o)}}return[Bn.fromPosition(i,"toPrevious"),Bn.fromPosition(n,"toNext")]}(n);r.isTouching(a)||e.remove(e.createRange(r,a)),i.leaveUnmerged||(function(e,t,i){const n=e.model;if(!ao(e.model.schema,t,i))return;const[o,s]=function(e,t){const i=e.getAncestors(),n=t.getAncestors();let o=0;for(;i[o]&&i[o]==n[o];)o++;return[i[o],n[o]]}(t,i);o&&s&&(!n.hasContent(o,{ignoreMarkers:!0})&&n.hasContent(s,{ignoreMarkers:!0})?ro(e,t,i,o.parent):so(e,t,i,o.parent))}(e,r,a),o.removeDisallowedAttributes(r.parent.getChildren(),e)),co(e,t,r),!i.doNotAutoparagraph&&function(e,t){const i=e.checkChild(t,"$text"),n=e.checkChild(t,"paragraph");return!i&&n}(o,r)&&lo(e,r,t,s),r.detach(),a.detach()}))}function so(e,t,i,n){const o=t.parent,s=i.parent;if(o!=n&&s!=n){for(t=e.createPositionAfter(o),(i=e.createPositionBefore(s)).isEqual(t)||e.insert(s,t),e.merge(t);i.parent.isEmpty;){const t=i.parent;i=e.createPositionBefore(t),e.remove(t)}ao(e.model.schema,t,i)&&so(e,t,i,n)}}function ro(e,t,i,n){const o=t.parent,s=i.parent;if(o!=n&&s!=n){for(t=e.createPositionAfter(o),(i=e.createPositionBefore(s)).isEqual(t)||e.insert(o,i);t.parent.isEmpty;){const i=t.parent;t=e.createPositionBefore(i),e.remove(i)}i=e.createPositionBefore(s),function(e,t){const i=t.nodeBefore,n=t.nodeAfter;i.name!=n.name&&e.rename(i,n.name),e.clearAttributes(i),e.setAttributes(Object.fromEntries(n.getAttributes()),i),e.merge(t)}(e,i),ao(e.model.schema,t,i)&&ro(e,t,i,n)}}function ao(e,t,i){const n=t.parent,o=i.parent;return n!=o&&!e.isLimit(n)&&!e.isLimit(o)&&function(e,t,i){const n=new St(e,t);for(const e of n.getWalker())if(i.isLimit(e.item))return!1;return!0}(t,i,e)}function lo(e,t,i,n={}){const o=e.createElement("paragraph");e.model.schema.setAllowedAttributes(o,n,e),e.insert(o,t),co(e,i,e.createPositionAt(o,0))}function co(e,t,i){t instanceof Gt?e.setSelection(i):t.setTo(i)}function uo(e,t){const i=[];Array.from(e.getItems({direction:"backward"})).map((e=>t.createRangeOn(e))).filter((t=>(t.start.isAfter(e.start)||t.start.isEqual(e.start))&&(t.end.isBefore(e.end)||t.end.isEqual(e.end)))).forEach((e=>{i.push(e.start.parent),t.remove(e)})),i.forEach((e=>{let i=e;for(;i.parent&&i.isEmpty;){const e=t.createRangeOn(i);i=i.parent,t.remove(e)}}))}class ho{constructor(e,t,i){this._firstNode=null,this._lastNode=null,this._lastAutoParagraph=null,this._filterAttributesOf=[],this._affectedStart=null,this._affectedEnd=null,this._nodeToSelect=null,this.model=e,this.writer=t,this.position=i,this.canMergeWith=new Set([this.position.parent]),this.schema=e.schema,this._documentFragment=t.createDocumentFragment(),this._documentFragmentPosition=t.createPositionAt(this._documentFragment,0)}handleNodes(e){for(const t of Array.from(e))this._handleNode(t);this._insertPartialFragment(),this._lastAutoParagraph&&this._updateLastNodeFromAutoParagraph(this._lastAutoParagraph),this._mergeOnRight(),this.schema.removeDisallowedAttributes(this._filterAttributesOf,this.writer),this._filterAttributesOf=[]}_updateLastNodeFromAutoParagraph(e){const t=this.writer.createPositionAfter(this._lastNode),i=this.writer.createPositionAfter(e);if(i.isAfter(t)){if(this._lastNode=e,this.position.parent!=e||!this.position.isAtEnd)throw new n.CKEditorError("insertcontent-invalid-insertion-position",this);this.position=i,this._setAffectedBoundaries(this.position)}}getSelectionRange(){return this._nodeToSelect?St._createOn(this._nodeToSelect):this.model.schema.getNearestSelectionRange(this.position)}getAffectedRange(){return this._affectedStart?new St(this._affectedStart,this._affectedEnd):null}destroy(){this._affectedStart&&this._affectedStart.detach(),this._affectedEnd&&this._affectedEnd.detach()}_handleNode(e){this._checkAndSplitToAllowedPosition(e)?(this._appendToFragment(e),this._firstNode||(this._firstNode=e),this._lastNode=e):this.schema.isObject(e)||this._handleDisallowedNode(e)}_insertPartialFragment(){if(this._documentFragment.isEmpty)return;const e=Bn.fromPosition(this.position,"toNext");this._setAffectedBoundaries(this.position),this._documentFragment.getChild(0)==this._firstNode&&(this.writer.insert(this._firstNode,this.position),this._mergeOnLeft(),this.position=e.toPosition()),this._documentFragment.isEmpty||this.writer.insert(this._documentFragment,this.position),this._documentFragmentPosition=this.writer.createPositionAt(this._documentFragment,0),this.position=e.toPosition(),e.detach()}_handleDisallowedNode(e){e.is("element")&&this.handleNodes(e.getChildren())}_appendToFragment(e){if(!this.schema.checkChild(this.position,e))throw new n.CKEditorError("insertcontent-wrong-position",this,{node:e,position:this.position});this.writer.insert(e,this._documentFragmentPosition),this._documentFragmentPosition=this._documentFragmentPosition.getShiftedBy(e.offsetSize),this.schema.isObject(e)&&!this.schema.checkChild(this.position,"$text")?this._nodeToSelect=e:this._nodeToSelect=null,this._filterAttributesOf.push(e)}_setAffectedBoundaries(e){this._affectedStart||(this._affectedStart=Bn.fromPosition(e,"toPrevious")),this._affectedEnd&&!this._affectedEnd.isBefore(e)||(this._affectedEnd&&this._affectedEnd.detach(),this._affectedEnd=Bn.fromPosition(e,"toNext"))}_mergeOnLeft(){const e=this._firstNode;if(!(e instanceof yt))return;if(!this._canMergeLeft(e))return;const t=Bn._createBefore(e);t.stickiness="toNext";const i=Bn.fromPosition(this.position,"toNext");this._affectedStart.isEqual(t)&&(this._affectedStart.detach(),this._affectedStart=Bn._createAt(t.nodeBefore,"end","toPrevious")),this._firstNode===this._lastNode&&(this._firstNode=t.nodeBefore,this._lastNode=t.nodeBefore),this.writer.merge(t),t.isEqual(this._affectedEnd)&&this._firstNode===this._lastNode&&(this._affectedEnd.detach(),this._affectedEnd=Bn._createAt(t.nodeBefore,"end","toNext")),this.position=i.toPosition(),i.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_mergeOnRight(){const e=this._lastNode;if(!(e instanceof yt))return;if(!this._canMergeRight(e))return;const t=Bn._createAfter(e);if(t.stickiness="toNext",!this.position.isEqual(t))throw new n.CKEditorError("insertcontent-invalid-insertion-position",this);this.position=At._createAt(t.nodeBefore,"end");const i=Bn.fromPosition(this.position,"toPrevious");this._affectedEnd.isEqual(t)&&(this._affectedEnd.detach(),this._affectedEnd=Bn._createAt(t.nodeBefore,"end","toNext")),this._firstNode===this._lastNode&&(this._firstNode=t.nodeBefore,this._lastNode=t.nodeBefore),this.writer.merge(t),t.getShiftedBy(-1).isEqual(this._affectedStart)&&this._firstNode===this._lastNode&&(this._affectedStart.detach(),this._affectedStart=Bn._createAt(t.nodeBefore,0,"toPrevious")),this.position=i.toPosition(),i.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_canMergeLeft(e){const t=e.previousSibling;return t instanceof yt&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(t,e)}_canMergeRight(e){const t=e.nextSibling;return t instanceof yt&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(e,t)}_insertAutoParagraph(){this._insertPartialFragment();const e=this.writer.createElement("paragraph");this.writer.insert(e,this.position),this._setAffectedBoundaries(this.position),this._lastAutoParagraph=e,this.position=this.writer.createPositionAt(e,0)}_checkAndSplitToAllowedPosition(e){const t=this._getAllowedIn(this.position.parent,e);if(!t)return!1;for(t!=this.position.parent&&this._insertPartialFragment();t!=this.position.parent;)if(this.position.isAtStart){const e=this.position.parent;this.position=this.writer.createPositionBefore(e),e.isEmpty&&e.parent===t&&this.writer.remove(e)}else if(this.position.isAtEnd)this.position=this.writer.createPositionAfter(this.position.parent);else{const e=this.writer.createPositionAfter(this.position.parent);this._setAffectedBoundaries(this.position),this.writer.split(this.position),this.position=e,this.canMergeWith.add(this.position.nodeAfter)}return this.schema.checkChild(this.position.parent,e)||this._insertAutoParagraph(),!0}_getAllowedIn(e,t){return this.schema.checkChild(e,t)||this.schema.checkChild(e,"paragraph")&&this.schema.checkChild("paragraph",t)?e:this.schema.isLimit(e)?null:this._getAllowedIn(e.parent,t)}}const mo=' ,.?!:;"-()';function go(e,t){const{isForward:i,walker:o,unit:s,schema:r,treatEmojiAsSingleUnit:a}=e,{type:l,item:c,nextPosition:d}=t;if("text"==l)return"word"===e.unit?function(e,t){let i=e.position.textNode;for(i||(i=t?e.position.nodeAfter:e.position.nodeBefore);i&&i.is("$text");){const n=e.position.offset-i.startOffset;if(bo(i,n,t))i=t?e.position.nodeAfter:e.position.nodeBefore;else{if(po(i.data,n,t))break;e.next()}}return e.position}(o,i):function(e,t,i){const o=e.position.textNode;if(o){const s=o.data;let r=e.position.offset-o.startOffset;for(;(0,n.isInsideSurrogatePair)(s,r)||"character"==t&&(0,n.isInsideCombinedSymbol)(s,r)||i&&(0,n.isInsideEmojiSequence)(s,r);)e.next(),r=e.position.offset-o.startOffset}return e.position}(o,s,a);if(l==(i?"elementStart":"elementEnd")){if(r.isSelectable(c))return At._createAt(c,i?"after":"before");if(r.checkChild(d,"$text"))return d}else{if(r.isLimit(c))return void o.skip((()=>!0));if(r.checkChild(d,"$text"))return d}}function fo(e,t){const i=e.root,n=At._createAt(i,t?"end":0);return t?new St(e,n):new St(n,e)}function po(e,t,i){const n=t+(i?0:-1);return mo.includes(e.charAt(n))}function bo(e,t,i){return t===(i?e.offsetSize:0)}class wo extends((0,n.ObservableMixin)()){constructor(){var e;super(),this.markers=new Gn,this.document=new qn(this),this.schema=new Vi,this._pendingChanges=[],this._currentWriter=null,["deleteContent","modifySelection","getSelectedContent","applyOperation"].forEach((e=>this.decorate(e))),this.on("applyOperation",((e,t)=>{t[0]._validate()}),{priority:"highest"}),this.schema.register("$root",{isLimit:!0}),this.schema.register("$container",{allowIn:["$root","$container"]}),this.schema.register("$block",{allowIn:["$root","$container"],isBlock:!0}),this.schema.register("$blockObject",{allowWhere:"$block",isBlock:!0,isObject:!0}),this.schema.register("$inlineObject",{allowWhere:"$text",allowAttributesOf:"$text",isInline:!0,isObject:!0}),this.schema.register("$text",{allowIn:"$block",isInline:!0,isContent:!0}),this.schema.register("$clipboardHolder",{allowContentOf:"$root",allowChildren:"$text",isLimit:!0}),this.schema.register("$documentFragment",{allowContentOf:"$root",allowChildren:"$text",isLimit:!0}),this.schema.register("$marker"),this.schema.addChildCheck((()=>!0),"$marker"),(e=this).document.registerPostFixer((t=>function(e,t){const i=t.document.selection,n=t.schema,o=[];let s=!1;for(const e of i.getRanges()){const t=Ai(e,n);t&&!t.isEqual(e)?(o.push(t),s=!0):o.push(e)}return s&&e.setSelection(function(e){const t=[...e],i=new Set;let n=1;for(;n<t.length;){const e=t[n],o=t.slice(0,n);for(const[s,r]of o.entries())if(!i.has(s))if(e.isEqual(r))i.add(s);else if(e.isIntersecting(r)){i.add(s),i.add(n);const o=e.getJoined(r);t.push(o)}n++}return t.filter(((e,t)=>!i.has(t)))}(o),{backward:i.isBackward}),!1}(t,e))),this.document.registerPostFixer(gi),this.on("insertContent",((e,[t,i])=>{e.return=function(e,t,i){return e.change((n=>{const o=i||e.document.selection;o.isCollapsed||e.deleteContent(o,{doNotAutoparagraph:!0});const s=new ho(e,n,o.anchor),r=[];let a;if(t.is("documentFragment")){if(t.markers.size){const e=[];for(const[i,n]of t.markers){const{start:t,end:o}=n,s=t.isEqual(o);e.push({position:t,name:i,isCollapsed:s},{position:o,name:i,isCollapsed:s})}e.sort((({position:e},{position:t})=>e.isBefore(t)?1:-1));for(const{position:i,name:o,isCollapsed:s}of e){let e=null,a=null;const l=i.parent===t&&i.isAtStart,c=i.parent===t&&i.isAtEnd;l||c?s&&(a=l?"start":"end"):(e=n.createElement("$marker"),n.insert(e,i)),r.push({name:o,element:e,collapsed:a})}}a=t.getChildren()}else a=[t];s.handleNodes(a);let l=s.getSelectionRange();if(t.is("documentFragment")&&r.length){const e=l?$t.fromRange(l):null,t={};for(let e=r.length-1;e>=0;e--){const{name:i,element:o,collapsed:a}=r[e],l=!t[i];if(l&&(t[i]=[]),o){const e=n.createPositionAt(o,"before");t[i].push(e),n.remove(o)}else{const e=s.getAffectedRange();if(!e){a&&t[i].push(s.position);continue}a?t[i].push(e[a]):t[i].push(l?e.start:e.end)}}for(const[e,[i,o]]of Object.entries(t))i&&o&&i.root===o.root&&i.root.document&&!n.model.markers.has(e)&&n.addMarker(e,{usingOperation:!0,affectsData:!0,range:new St(i,o)});e&&(l=e.toRange(),e.detach())}l&&(o instanceof Gt?n.setSelection(l):o.setTo(l));const c=s.getAffectedRange()||e.createRange(o.anchor);return s.destroy(),c}))}(this,t,i)})),this.on("insertObject",((e,[t,i,o])=>{e.return=function(e,t,i,o={}){if(!e.schema.isObject(t))throw new n.CKEditorError("insertobject-element-not-an-object",e,{object:t});const s=i||e.document.selection;let r=s;o.findOptimalPosition&&e.schema.isBlock(t)&&(r=e.createSelection(e.schema.findOptimalInsertionRange(s,o.findOptimalPosition)));const a=(0,n.first)(s.getSelectedBlocks()),l={};return a&&Object.assign(l,e.schema.getAttributesWithProperty(a,"copyOnReplace",!0)),e.change((i=>{r.isCollapsed||e.deleteContent(r,{doNotAutoparagraph:!0});let s=t;const a=r.anchor.parent;!e.schema.checkChild(a,t)&&e.schema.checkChild(a,"paragraph")&&e.schema.checkChild("paragraph",t)&&(s=i.createElement("paragraph"),i.insert(t,s)),e.schema.setAllowedAttributes(s,l,i);const c=e.insertContent(s,r);return c.isCollapsed||o.setSelection&&function(e,t,i,o){const s=e.model;if("on"==i)return void e.setSelection(t,"on");if("after"!=i)throw new n.CKEditorError("insertobject-invalid-place-parameter-value",s);let r=t.nextSibling;s.schema.isInline(t)?e.setSelection(t,"after"):(!(r&&s.schema.checkChild(r,"$text"))&&s.schema.checkChild(t.parent,"paragraph")&&(r=e.createElement("paragraph"),s.schema.setAllowedAttributes(r,o,e),s.insertContent(r,e.createPositionAfter(t))),r&&e.setSelection(r,0))}(i,t,o.setSelection,l),c}))}(this,t,i,o)})),this.on("canEditAt",(e=>{const t=!this.document.isReadOnly;e.return=t,t||e.stop()}))}change(e){try{return 0===this._pendingChanges.length?(this._pendingChanges.push({batch:new Ln,callback:e}),this._runPendingChanges()[0]):e(this._currentWriter)}catch(e){n.CKEditorError.rethrowUnexpectedError(e,this)}}enqueueChange(e,t){try{e?"function"==typeof e?(t=e,e=new Ln):e instanceof Ln||(e=new Ln(e)):e=new Ln,this._pendingChanges.push({batch:e,callback:t}),1==this._pendingChanges.length&&this._runPendingChanges()}catch(e){n.CKEditorError.rethrowUnexpectedError(e,this)}}applyOperation(e){e._execute()}insertContent(e,t,i,...n){const o=vo(t,i);return this.fire("insertContent",[e,o,i,...n])}insertObject(e,t,i,n,...o){const s=vo(t,i);return this.fire("insertObject",[e,s,n,n,...o])}deleteContent(e,t){oo(this,e,t)}modifySelection(e,t){!function(e,t,i={}){const n=e.schema,o="backward"!=i.direction,s=i.unit?i.unit:"character",r=!!i.treatEmojiAsSingleUnit,a=t.focus,l=new kt({boundaries:fo(a,o),singleCharacters:!0,direction:o?"forward":"backward"}),c={walker:l,schema:n,isForward:o,unit:s,treatEmojiAsSingleUnit:r};let d;for(;d=l.next();){if(d.done)return;const i=go(c,d.value);if(i)return void(t instanceof Gt?e.change((e=>{e.setSelectionFocus(i)})):t.setFocus(i))}}(this,e,t)}getSelectedContent(e){return function(e,t){return e.change((e=>{const i=e.createDocumentFragment(),n=t.getFirstRange();if(!n||n.isCollapsed)return i;const o=n.start.root,s=n.start.getCommonPath(n.end),r=o.getNodeByPath(s);let a;a=n.start.parent==n.end.parent?n:e.createRange(e.createPositionAt(r,n.start.path[s.length]),e.createPositionAt(r,n.end.path[s.length]+1));const l=a.end.offset-a.start.offset;for(const t of a.getItems({shallow:!0}))t.is("$textProxy")?e.appendText(t.data,t.getAttributes(),i):e.append(e.cloneElement(t,!0),i);if(a!=n){const t=n._getTransformedByMove(a.start,e.createPositionAt(i,0),l)[0],o=e.createRange(e.createPositionAt(i,0),t.start);uo(e.createRange(t.end,e.createPositionAt(i,"end")),e),uo(o,e)}return i}))}(this,e)}hasContent(e,t={}){const i=e instanceof St?e:St._createIn(e);if(i.isCollapsed)return!1;const{ignoreWhitespaces:n=!1,ignoreMarkers:o=!1}=t;if(!o)for(const e of this.markers.getMarkersIntersectingRange(i))if(e.affectsData)return!0;for(const e of i.getItems())if(this.schema.isContent(e)){if(!e.is("$textProxy"))return!0;if(!n)return!0;if(-1!==e.data.search(/\S/))return!0}return!1}canEditAt(e){const t=vo(e);return this.fire("canEditAt",[t])}createPositionFromPath(e,t,i){return new At(e,t,i)}createPositionAt(e,t){return At._createAt(e,t)}createPositionAfter(e){return At._createAfter(e)}createPositionBefore(e){return At._createBefore(e)}createRange(e,t){return new St(e,t)}createRangeIn(e){return St._createIn(e)}createRangeOn(e){return St._createOn(e)}createSelection(...e){return new Ft(...e)}createBatch(e){return new Ln(e)}createOperationFromJSON(e){return yn.fromJSON(e,this.document)}destroy(){this.document.destroy(),this.stopListening()}_runPendingChanges(){const e=[];this.fire("_beforeChanges");try{for(;this._pendingChanges.length;){const t=this._pendingChanges[0].batch;this._currentWriter=new Yn(this,t);const i=this._pendingChanges[0].callback(this._currentWriter);e.push(i),this.document._handleChangeBlock(this._currentWriter),this._pendingChanges.shift(),this._currentWriter=null}}finally{this._pendingChanges.length=0,this._currentWriter=null,this.fire("_afterChanges")}return e}}function vo(e,t){if(e)return e instanceof Ft||e instanceof Gt?e:e instanceof bt?t||0===t?new Ft(e,t):e.is("rootElement")?new Ft(e,"in"):new Ft(e,"on"):new Ft(e)}class _o extends Xe{constructor(){super(...arguments),this.domEventType="click"}onDomEvent(e){this.fire(e.type,e)}}class yo extends Xe{constructor(){super(...arguments),this.domEventType=["mousedown","mouseup","mouseover","mouseout"]}onDomEvent(e){this.fire(e.type,e)}}class ko{constructor(e){this.document=e}createDocumentFragment(e){return new pe(this.document,e)}createElement(e,t,i){return new D(this.document,e,t,i)}createText(e){return new w(this.document,e)}clone(e,t=!1){return e._clone(t)}appendChild(e,t){return t._appendChild(e)}insertChild(e,t,i){return i._insertChild(e,t)}removeChildren(e,t,i){return i._removeChildren(e,t)}remove(e){const t=e.parent;return t?this.removeChildren(t.getChildIndex(e),1,t):[]}replace(e,t){const i=e.parent;if(i){const n=i.getChildIndex(e);return this.removeChildren(n,1,i),this.insertChild(n,t,i),!0}return!1}unwrapElement(e){const t=e.parent;if(t){const i=t.getChildIndex(e);this.remove(e),this.insertChild(i,e.getChildren(),t)}}rename(e,t){const i=new D(this.document,e,t.getAttributes(),t.getChildren());return this.replace(t,i)?i:null}setAttribute(e,t,i){i._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,i){(0,_.A)(e)&&void 0===i?t._setStyle(e):i._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,i){i._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}createPositionAt(e,t){return K._createAt(e,t)}createPositionAfter(e){return K._createAfter(e)}createPositionBefore(e){return K._createBefore(e)}createRange(e,t){return new G(e,t)}createRangeOn(e){return G._createOn(e)}createRangeIn(e){return G._createIn(e)}createSelection(...e){return new J(...e)}}const Co=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,Ao=/^rgb\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}[0-9]{1,3}[ %]?\)$/i,Eo=/^rgba\([ ]?([0-9]{1,3}[ %]?,[ ]?){3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,xo=/^hsl\([ ]?([0-9]{1,3}[ %]?[,]?[ ]*){3}(1|[0-9]+%|[0]?\.?[0-9]+)?\)$/i,To=/^hsla\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,Po=/\w+\((?:[^()]|\([^()]*\))*\)|\S+/gi,Io=new Set(["black","silver","gray","white","maroon","red","purple","fuchsia","green","lime","olive","yellow","navy","blue","teal","aqua","orange","aliceblue","antiquewhite","aquamarine","azure","beige","bisque","blanchedalmond","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","gainsboro","ghostwhite","gold","goldenrod","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","limegreen","linen","magenta","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","oldlace","olivedrab","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","thistle","tomato","turquoise","violet","wheat","whitesmoke","yellowgreen","activeborder","activecaption","appworkspace","background","buttonface","buttonhighlight","buttonshadow","buttontext","captiontext","graytext","highlight","highlighttext","inactiveborder","inactivecaption","inactivecaptiontext","infobackground","infotext","menu","menutext","scrollbar","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","window","windowframe","windowtext","rebeccapurple","currentcolor","transparent"]);function So(e){return e.startsWith("#")?Co.test(e):e.startsWith("rgb")?Ao.test(e)||Eo.test(e):e.startsWith("hsl")?xo.test(e)||To.test(e):Io.has(e.toLowerCase())}const Vo=["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset"];function Ro(e){return Vo.includes(e)}const Bo=/^([+-]?[0-9]*([.][0-9]+)?(px|cm|mm|in|pc|pt|ch|em|ex|rem|vh|vw|vmin|vmax)|0)$/;function Mo(e){return Bo.test(e)}const Oo=/^[+-]?[0-9]*([.][0-9]+)?%$/;function Lo(e){return Oo.test(e)}const Fo=["repeat-x","repeat-y","repeat","space","round","no-repeat"];function No(e){return Fo.includes(e)}const Do=["center","top","bottom","left","right"];function zo(e){return Do.includes(e)}const Wo=["fixed","scroll","local"];function Ho(e){return Wo.includes(e)}const Uo=/^url\(/;function $o(e){return Uo.test(e)}function jo(e=""){if(""===e)return{top:void 0,right:void 0,bottom:void 0,left:void 0};const t=Zo(e),i=t[0],n=t[2]||i,o=t[1]||i;return{top:i,bottom:n,right:o,left:t[3]||o}}function qo(e){return t=>{const{top:i,right:n,bottom:o,left:s}=t,r=[];return[i,n,s,o].every((e=>!!e))?r.push([e,Ko(t)]):(i&&r.push([e+"-top",i]),n&&r.push([e+"-right",n]),o&&r.push([e+"-bottom",o]),s&&r.push([e+"-left",s])),r}}function Ko({top:e,right:t,bottom:i,left:n}){const o=[];return n!==t?o.push(e,t,i,n):i!==e?o.push(e,t,i):t!==e?o.push(e,t):o.push(e),o.join(" ")}function Go(e){return t=>({path:e,value:jo(t)})}function Zo(e){const t=e.matchAll(Po);return Array.from(t).map((e=>e[0]))}function Jo(e){e.setNormalizer("background",(e=>{const t={},i=Zo(e);for(const e of i)No(e)?(t.repeat=t.repeat||[],t.repeat.push(e)):zo(e)?(t.position=t.position||[],t.position.push(e)):Ho(e)?t.attachment=e:So(e)?t.color=e:$o(e)&&(t.image=e);return{path:"background",value:t}})),e.setNormalizer("background-color",(e=>({path:"background.color",value:e}))),e.setReducer("background",(e=>{const t=[];return t.push(["background-color",e.color]),t})),e.setStyleRelation("background",["background-color"])}function Qo(e){e.setNormalizer("border",(e=>{const{color:t,style:i,width:n}=os(e);return{path:"border",value:{color:jo(t),style:jo(i),width:jo(n)}}})),e.setNormalizer("border-top",Yo("top")),e.setNormalizer("border-right",Yo("right")),e.setNormalizer("border-bottom",Yo("bottom")),e.setNormalizer("border-left",Yo("left")),e.setNormalizer("border-color",Xo("color")),e.setNormalizer("border-width",Xo("width")),e.setNormalizer("border-style",Xo("style")),e.setNormalizer("border-top-color",ts("color","top")),e.setNormalizer("border-top-style",ts("style","top")),e.setNormalizer("border-top-width",ts("width","top")),e.setNormalizer("border-right-color",ts("color","right")),e.setNormalizer("border-right-style",ts("style","right")),e.setNormalizer("border-right-width",ts("width","right")),e.setNormalizer("border-bottom-color",ts("color","bottom")),e.setNormalizer("border-bottom-style",ts("style","bottom")),e.setNormalizer("border-bottom-width",ts("width","bottom")),e.setNormalizer("border-left-color",ts("color","left")),e.setNormalizer("border-left-style",ts("style","left")),e.setNormalizer("border-left-width",ts("width","left")),e.setExtractor("border-top",is("top")),e.setExtractor("border-right",is("right")),e.setExtractor("border-bottom",is("bottom")),e.setExtractor("border-left",is("left")),e.setExtractor("border-top-color","border.color.top"),e.setExtractor("border-right-color","border.color.right"),e.setExtractor("border-bottom-color","border.color.bottom"),e.setExtractor("border-left-color","border.color.left"),e.setExtractor("border-top-width","border.width.top"),e.setExtractor("border-right-width","border.width.right"),e.setExtractor("border-bottom-width","border.width.bottom"),e.setExtractor("border-left-width","border.width.left"),e.setExtractor("border-top-style","border.style.top"),e.setExtractor("border-right-style","border.style.right"),e.setExtractor("border-bottom-style","border.style.bottom"),e.setExtractor("border-left-style","border.style.left"),e.setReducer("border-color",qo("border-color")),e.setReducer("border-style",qo("border-style")),e.setReducer("border-width",qo("border-width")),e.setReducer("border-top",ss("top")),e.setReducer("border-right",ss("right")),e.setReducer("border-bottom",ss("bottom")),e.setReducer("border-left",ss("left")),e.setReducer("border",function(){return t=>{const i=ns(t,"top"),n=ns(t,"right"),o=ns(t,"bottom"),s=ns(t,"left"),r=[i,n,o,s],a={width:e(r,"width"),style:e(r,"style"),color:e(r,"color")},l=rs(a,"all");if(l.length)return l;const c=Object.entries(a).reduce(((e,[t,i])=>(i&&(e.push([`border-${t}`,i]),r.forEach((e=>delete e[t]))),e)),[]);return[...c,...rs(i,"top"),...rs(n,"right"),...rs(o,"bottom"),...rs(s,"left")]};function e(e,t){return e.map((e=>e[t])).reduce(((e,t)=>e==t?e:null))}}()),e.setStyleRelation("border",["border-color","border-style","border-width","border-top","border-right","border-bottom","border-left","border-top-color","border-right-color","border-bottom-color","border-left-color","border-top-style","border-right-style","border-bottom-style","border-left-style","border-top-width","border-right-width","border-bottom-width","border-left-width"]),e.setStyleRelation("border-color",["border-top-color","border-right-color","border-bottom-color","border-left-color"]),e.setStyleRelation("border-style",["border-top-style","border-right-style","border-bottom-style","border-left-style"]),e.setStyleRelation("border-width",["border-top-width","border-right-width","border-bottom-width","border-left-width"]),e.setStyleRelation("border-top",["border-top-color","border-top-style","border-top-width"]),e.setStyleRelation("border-right",["border-right-color","border-right-style","border-right-width"]),e.setStyleRelation("border-bottom",["border-bottom-color","border-bottom-style","border-bottom-width"]),e.setStyleRelation("border-left",["border-left-color","border-left-style","border-left-width"])}function Yo(e){return t=>{const{color:i,style:n,width:o}=os(t),s={};return void 0!==i&&(s.color={[e]:i}),void 0!==n&&(s.style={[e]:n}),void 0!==o&&(s.width={[e]:o}),{path:"border",value:s}}}function Xo(e){return t=>({path:"border",value:es(t,e)})}function es(e,t){return{[t]:jo(e)}}function ts(e,t){return i=>({path:"border",value:{[e]:{[t]:i}}})}function is(e){return(t,i)=>{if(i.border)return ns(i.border,e)}}function ns(e,t){const i={};return e.width&&e.width[t]&&(i.width=e.width[t]),e.style&&e.style[t]&&(i.style=e.style[t]),e.color&&e.color[t]&&(i.color=e.color[t]),i}function os(e){const t={},i=Zo(e);for(const e of i)Mo(e)||/thin|medium|thick/.test(e)?t.width=e:Ro(e)?t.style=e:t.color=e;return t}function ss(e){return t=>rs(t,e)}function rs(e,t){const i=[];if(e&&e.width&&i.push("width"),e&&e.style&&i.push("style"),e&&e.color&&i.push("color"),3==i.length){const n=i.map((t=>e[t])).join(" ");return["all"==t?["border",n]:[`border-${t}`,n]]}return"all"==t?[]:i.map((i=>[`border-${t}-${i}`,e[i]]))}function as(e){e.setNormalizer("margin",Go("margin")),e.setNormalizer("margin-top",(e=>({path:"margin.top",value:e}))),e.setNormalizer("margin-right",(e=>({path:"margin.right",value:e}))),e.setNormalizer("margin-bottom",(e=>({path:"margin.bottom",value:e}))),e.setNormalizer("margin-left",(e=>({path:"margin.left",value:e}))),e.setReducer("margin",qo("margin")),e.setStyleRelation("margin",["margin-top","margin-right","margin-bottom","margin-left"])}function ls(e){e.setNormalizer("padding",Go("padding")),e.setNormalizer("padding-top",(e=>({path:"padding.top",value:e}))),e.setNormalizer("padding-right",(e=>({path:"padding.right",value:e}))),e.setNormalizer("padding-bottom",(e=>({path:"padding.bottom",value:e}))),e.setNormalizer("padding-left",(e=>({path:"padding.left",value:e}))),e.setReducer("padding",qo("padding")),e.setStyleRelation("padding",["padding-top","padding-right","padding-bottom","padding-left"])}const cs="[",ds="]",us="{",hs="}",ms={container:W,attribute:ae,empty:de,ui:he,raw:ge},gs={setContentOf:(e,t)=>{e.innerHTML=t}};function fs(e,t={}){if(!(e instanceof ft))throw new TypeError("View needs to be an instance of module:engine/view/view~View.");const i=e.document,n=!!t.withoutSelection,o=t.rootName||"main",s=i.getRoot(o),r={showType:t.showType,showPriority:t.showPriority,renderUIElements:t.renderUIElements,renderRawElements:t.renderRawElements,ignoreRoot:!0,domConverter:t.domConverter};return n?fs._stringify(s,null,r):fs._stringify(s,i.selection,r)}function ps(e,t,i={}){if(!(e instanceof ft))throw new TypeError("View needs to be an instance of module:engine/view/view~View.");const n=e.document,o=i.rootName||"main",s=n.getRoot(o);e.change((e=>{const i=ps._parse(t,{rootElement:s});i.view&&i.selection&&e.setSelection(i.selection)}))}function bs(e,t=null,i={}){let n;return n=t instanceof K||t instanceof G?new Q(t):t,new _s(e,n,i).stringify()}function ws(e,t={}){const i=new se(new L);t.order=t.order||[];const n=new vs({sameSelectionCharacters:t.sameSelectionCharacters}),o=new Xi(i,{namespaces:Object.keys(ms)});t.inlineObjectElements&&o.domConverter.inlineObjectElements.push(...t.inlineObjectElements);let s=o.toView(e);if(s=ys(s),t.rootElement){const e=t.rootElement,i=s._removeChildren(0,s.childCount);e._removeChildren(0,e.childCount),e._appendChild(i),s=e}const r=n.parse(s,t.order);return s.is("documentFragment")&&1===s.childCount&&(s=s.getChild(0)),r.length?{view:s,selection:new Q(r,{backward:!!t.lastRangeBackward})}:(s.parent&&s._remove(),s)}fs._stringify=bs,ps._parse=ws;class vs{constructor(e){this.sameSelectionCharacters=!!e.sameSelectionCharacters}parse(e,t){this._positions=[],this._getPositions(e);let i=this._createRanges();if(t.length){if(t.length!=i.length)throw new Error(`Parse error - there are ${i.length} ranges found, but ranges order array contains ${t.length} elements.`);i=this._sortRanges(i,t)}return i}_getPositions(e){if(e.is("documentFragment")||e.is("element")){const t=[...e.getChildren()];for(const e of t)this._getPositions(e)}if(e.is("$text")){const t=new RegExp(`[${us}${hs}\\${ds}\\${cs}]`,"g");let i,n=e.data,o=0;const s=[];for(;i=t.exec(n);){const e=i.index,t=i[0];s.push({bracket:t,textOffset:e-o}),o++}n=n.replace(t,""),e._data=n;const r=e.index,a=e.parent;n||e._remove();for(const t of s)if(n)if(this.sameSelectionCharacters||!this.sameSelectionCharacters&&(t.bracket==us||t.bracket==hs))this._positions.push({bracket:t.bracket,position:new K(e,t.textOffset)});else{if(!this.sameSelectionCharacters&&0!==t.textOffset&&t.textOffset!==n.length)throw new Error(`Parse error - range delimiter '${t.bracket}' is placed inside text node.`);const e=0===t.textOffset?r:r+1;this._positions.push({bracket:t.bracket,position:new K(a,e)})}else{if(!this.sameSelectionCharacters&&t.bracket==us||t.bracket==hs)throw new Error(`Parse error - text range delimiter '${t.bracket}' is placed inside empty text node. `);this._positions.push({bracket:t.bracket,position:new K(a,r)})}}}_sortRanges(e,t){const i=[];let n=0;for(const o of t){if(void 0===e[o-1])throw new Error("Parse error - provided ranges order is invalid.");i[o-1]=e[n],n++}return i}_createRanges(){const e=[];let t=null;for(const i of this._positions){if(!t&&(i.bracket==ds||i.bracket==hs))throw new Error(`Parse error - end of range was found '${i.bracket}' but range was not started before.`);if(t&&(i.bracket==cs||i.bracket==us))throw new Error(`Parse error - start of range was found '${i.bracket}' but one range is already started.`);i.bracket==cs||i.bracket==us?t=new G(i.position,i.position):(t.end=i.position,e.push(t),t=null)}if(null!==t)throw new Error("Parse error - range was started but no end delimiter was found.");return e}}class _s{constructor(e,t,i){this.root=e,this.selection=t,this.ranges=[],t&&(this.ranges=[...t.getRanges()]),this.showType=!!i.showType,this.showPriority=!!i.showPriority,this.showAttributeElementId=!!i.showAttributeElementId,this.ignoreRoot=!!i.ignoreRoot,this.sameSelectionCharacters=!!i.sameSelectionCharacters,this.renderUIElements=!!i.renderUIElements,this.renderRawElements=!!i.renderRawElements,this.domConverter=i.domConverter||gs}stringify(){let e="";return this._walkView(this.root,(t=>{e+=t})),e}_walkView(e,t){const i=this.ignoreRoot&&this.root===e;if(e.is("element")||e.is("documentFragment")){if(e.is("element")&&!i&&t(this._stringifyElementOpen(e)),this.renderUIElements&&e.is("uiElement"))t(e.render(document,this.domConverter).innerHTML);else if(this.renderRawElements&&e.is("rawElement")){const i=document.createElement("div");e.render(i,this.domConverter),t(i.innerHTML)}else{let i=0;t(this._stringifyElementRanges(e,i));for(const n of e.getChildren())this._walkView(n,t),i++,t(this._stringifyElementRanges(e,i))}e.is("element")&&!i&&t(this._stringifyElementClose(e))}e.is("$text")&&t(this._stringifyTextRanges(e))}_stringifyElementRanges(e,t){let i="",n="",o="";for(const s of this.ranges)s.start.parent==e&&s.start.offset===t&&(s.isCollapsed?o+=cs+ds:i+=cs),s.end.parent!==e||s.end.offset!==t||s.isCollapsed||(n+=ds);return n+o+i}_stringifyTextRanges(e){const t=e.data.length,i=e.data.split("");let n,o;this.sameSelectionCharacters?(n=cs,o=ds):(n=us,o=hs),i[t]="";const s=i.map((e=>({letter:e,start:"",end:"",collapsed:""})));for(const i of this.ranges){const r=i.start,a=i.end;r.parent==e&&r.offset>=0&&r.offset<=t&&(i.isCollapsed?s[a.offset].collapsed+=n+o:s[r.offset].start+=n),a.parent==e&&a.offset>=0&&a.offset<=t&&!i.isCollapsed&&(s[a.offset].end+=o)}return s.map((e=>e.end+e.collapsed+e.start+e.letter)).join("")}_stringifyElementOpen(e){const t=this._stringifyElementPriority(e),i=this._stringifyElementId(e);return`<${[[this._stringifyElementType(e),e.name].filter((e=>""!==e)).join(":"),t,i,this._stringifyElementAttributes(e)].filter((e=>""!==e)).join(" ")}>`}_stringifyElementClose(e){return`</${[this._stringifyElementType(e),e.name].filter((e=>""!==e)).join(":")}>`}_stringifyElementType(e){if(this.showType)for(const t in ms)if(e instanceof ms[t])return t;return""}_stringifyElementPriority(e){return this.showPriority&&e.is("attributeElement")?`view-priority="${e.priority}"`:""}_stringifyElementId(e){return this.showAttributeElementId&&e.is("attributeElement")&&e.id?`view-id="${e.id}"`:""}_stringifyElementAttributes(e){const t=[],i=[...e.getAttributeKeys()].sort();for(const n of i){let i;i="class"===n?[...e.getClassNames()].sort().join(" "):"style"===n?[...e.getStyleNames()].sort().map((t=>`${t}:${e.getStyle(t).replace(/"/g,"&quot;")}`)).join(";"):e.getAttribute(n),t.push(`${n}="${i}"`)}return t.join(" ")}}function ys(e){if(e.is("element")||e.is("documentFragment")){const t=e.is("documentFragment")?new pe(e.document):function(e,t){const i=function(e){const t=e.name.split(":"),i=function(e){const t=parseInt(e,10);return isNaN(t)?null:t}(e.getAttribute("view-priority")),n=e.hasAttribute("view-id")?e.getAttribute("view-id"):null;if(e._removeAttribute("view-priority"),e._removeAttribute("view-id"),1==t.length)return{name:t[0],type:null!==i?"attribute":null,priority:i,id:n};const o=function(e){return e in ms?e:null}(t[0]);if(o)return{name:t[1],type:o,priority:i,id:n};throw new Error(`Parse error - cannot parse element's name: ${e.name}.`)}(t),n=ms[i.type],o=n?new n(e,i.name):new D(e,i.name);o.is("attributeElement")&&(null!==i.priority&&(o._priority=i.priority),null!==i.id&&(o._id=i.id));for(const e of t.getAttributeKeys())o._setAttribute(e,t.getAttribute(e));return o}(e.document,e);for(const i of[...e.getChildren()]){if(t.is("emptyElement"))throw new Error("Parse error - cannot parse inside EmptyElement.");if(t.is("uiElement"))throw new Error("Parse error - cannot parse inside UIElement.");if(t.is("rawElement"))throw new Error("Parse error - cannot parse inside RawElement.");t._appendChild(ys(i))}return t}return e}function ks(e,t={}){if(!(e instanceof wo))throw new TypeError("Model needs to be an instance of module:engine/model/model~Model.");const i=t.rootName||"main",n=e.document.getRoot(i);return ks._stringify(n,t.withoutSelection?null:e.document.selection,t.convertMarkers?e.markers:null)}function Cs(e,t,i={}){if(!(e instanceof wo))throw new TypeError("Model needs to be an instance of module:engine/model/model~Model.");let n,o=null;const s=e.document.getRoot(i.rootName||"main"),r=Cs._parse(t,e.schema,{lastRangeBackward:i.lastRangeBackward,selectionAttributes:i.selectionAttributes,context:[s.name],inlineObjectElements:i.inlineObjectElements});function a(t){if(t.remove(t.createRangeIn(s)),t.insert(n,s),t.setSelection(null),t.removeSelectionAttribute(e.document.selection.getAttributeKeys()),o){const e=[];for(const t of o.getRanges()){const i=new At(s,t.start.path),n=new At(s,t.end.path);e.push(new St(i,n))}t.setSelection(e,{backward:o.isBackward}),i.selectionAttributes&&t.setSelectionAttribute(o.getAttributes())}}"model"in r?(n=r.model,o=r.selection):n=r,void 0!==i.batchType?e.enqueueChange(i.batchType,a):e.change(a)}function As(e,t=null,i=null){const n=new wo,o=new Vt;let s,r=null;if(e instanceof $n||e instanceof Qn)s=n.createRangeIn(e);else if(e.parent)s=new St(n.createPositionBefore(e),n.createPositionAfter(e));else{const t=new Qn(e);s=n.createRangeIn(t)}t instanceof Ft||t instanceof Gt?r=t:(t instanceof St||t instanceof At)&&(r=new Ft(t));const a=new L,l=new ft(a),c=l.document,d=new j(c,"div");d.rootName="main",c.roots.add(d);const u=new Mt({mapper:o,schema:n.schema});o.bindElements(e.root,d),u.on("insert:$text",((e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const n=i.writer,o=i.mapper.toViewPosition(t.range.start),s=n.createText(t.item.data);n.insert(o,s)})),u.on("insert",((e,t,i)=>{i.convertAttributes(t.item),t.reconversion||!t.item.is("element")||t.item.isEmpty||i.convertChildren(t.item)}),{priority:"lowest"}),u.on("attribute",((e,t,i)=>{if(t.item instanceof Ft||t.item instanceof Gt||t.item.is("$textProxy")){const n=ei(((e,{writer:i})=>i.createAttributeElement("model-text-with-attributes",{[t.attributeKey]:Ps(e)})));n(e,t,i)}})),u.on("insert",ti((e=>{const t=Is(e.getAttributes(),Ps);return new W(c,e.name,t)}))),u.on("selection",((e,t,i)=>{const n=t.selection;if(n.isCollapsed)return;if(!i.consumable.consume(n,"selection"))return;const o=[];for(const e of n.getRanges())o.push(i.mapper.toViewRange(e));i.writer.setSelection(o,{backward:n.isBackward})})),u.on("selection",((e,t,i)=>{const n=t.selection;if(!n.isCollapsed)return;if(!i.consumable.consume(n,"selection"))return;const o=i.writer,s=n.getFirstPosition(),r=i.mapper.toViewPosition(s),a=o.breakAttributes(r);o.setSelection(a)})),u.on("addMarker",ii(((e,{writer:t})=>{const i=e.markerName+":"+(e.isOpening?"start":"end");return t.createUIElement(i)})));const h=new Map;if(i)for(const e of Array.from(i).sort(((e,t)=>e.name<t.name?1:-1)))h.set(e.name,e.getRange());const m=l._writer;u.convert(s,h,m),r&&u.convertSelection(r,i||n.markers,m);let g=bs(d,c.selection,{sameSelectionCharacters:!0});return g=g.substr(5,g.length-11),l.destroy(),g.replace(new RegExp("model-text-with-attributes","g"),"$text")}function Es(e,t,i={}){const o=new Vt,s=ws(e=e.replace(new RegExp("\\$text","g"),"model-text-with-attributes"),{sameSelectionCharacters:!0,lastRangeBackward:!!i.lastRangeBackward,inlineObjectElements:i.inlineObjectElements});let r,a=null,l=null;"view"in s&&"selection"in s?(r=s.view,a=s.selection):r=s;const c=new wo,d=new qi({schema:t});d.on("documentFragment",function(e){return(t,i,n)=>{const o=n.convertChildren(i.viewItem,i.modelCursor);e.bindElements(i.modelCursor.parent,i.viewItem),i=Object.assign(i,o),t.stop()}}(o)),d.on("element:model-text-with-attributes",xs()),d.on("element",function(e){return(t,i,n)=>{const o=i.viewItem.name;if(!n.schema.checkChild(i.modelCursor,o))throw new Error(`Element '${o}' was not allowed in given position.`);const s=Is(i.viewItem.getAttributes(),Ts),r=n.writer.createElement(i.viewItem.name,s);n.writer.insert(r,i.modelCursor),e.bindElements(r,i.viewItem),n.convertChildren(i.viewItem,r),i.modelRange=St._createOn(r),i.modelCursor=i.modelRange.end,t.stop()}}(o)),d.on("text",xs());let u=c.change((e=>d.convert(r.root,e,i.context||"$root")));if(o.bindElements(u,r.root),1==u.childCount&&(u=u.getChild(0)),a){const e=[];for(const t of a.getRanges())e.push(o.toModelRange(t));l=new Ft(e,{backward:a.isBackward});for(const[e,t]of(0,n.toMap)(i.selectionAttributes||[]))l.setAttribute(e,t)}return l?{model:u,selection:l}:u}function xs(){return(e,t,i)=>{if(!i.schema.checkChild(t.modelCursor,"$text"))throw new Error("Text was not allowed in given position.");let n;if(t.viewItem.is("element")){const e=Is(t.viewItem.getAttributes(),Ts),o=t.viewItem.getChild(0);n=i.writer.createText(o.data,e)}else n=i.writer.createText(t.viewItem.data);i.writer.insert(n,t.modelCursor),t.modelRange=St._createFromPositionAndShift(t.modelCursor,n.offsetSize),t.modelCursor=t.modelRange.end,e.stop()}}function Ts(e){try{return JSON.parse(e)}catch(t){return e}}function Ps(e){return(0,_.A)(e)?JSON.stringify(e):e}function*Is(e,t){for(const[i,n]of e)yield[i,t(n)]}ks._stringify=As,Cs._parse=Es},7207:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Enter:()=>u,ShiftEnter:()=>f});var n=i(1024);function*o(e,t){for(const i of t)i&&e.getAttributeProperties(i[0]).copyOnEnter&&(yield i)}class s extends n.Command{execute(){this.editor.model.change((e=>{this.enterBlock(e),this.fire("afterExecute",{writer:e})}))}enterBlock(e){const t=this.editor.model,i=t.document.selection,n=t.schema,s=i.isCollapsed,a=i.getFirstRange(),l=a.start.parent,c=a.end.parent;if(n.isLimit(l)||n.isLimit(c))return s||l!=c||t.deleteContent(i),!1;if(s){const t=o(e.model.schema,i.getAttributes());return r(e,a.start),e.setSelectionAttribute(t),!0}{const n=!(a.start.isAtStart&&a.end.isAtEnd),o=l==c;if(t.deleteContent(i,{leaveUnmerged:n}),n){if(o)return r(e,i.focus),!0;e.setSelection(c,0)}}return!1}}function r(e,t){e.split(t),e.setSelection(t.parent.nextSibling,0)}var a=i(151),l=i(7906);const c={insertParagraph:{isSoft:!1},insertLineBreak:{isSoft:!0}};class d extends a.Observer{constructor(e){super(e);const t=this.document;let i=!1;t.on("keydown",((e,t)=>{i=t.shiftKey})),t.on("beforeinput",((n,o)=>{if(!this.isEnabled)return;let s=o.inputType;l.env.isSafari&&i&&"insertParagraph"==s&&(s="insertLineBreak");const r=o.domEvent,d=c[s];if(!d)return;const u=new a.BubblingEventInfo(t,"enter",o.targetRanges[0]);t.fire(u,new a.DomEventData(e,r,{isSoft:d.isSoft})),u.stop.called&&n.stop()}))}observe(){}stopObserving(){}}class u extends n.Plugin{static get pluginName(){return"Enter"}init(){const e=this.editor,t=e.editing.view,i=t.document,n=this.editor.t;t.addObserver(d),e.commands.add("enter",new s(e)),this.listenTo(i,"enter",((n,o)=>{i.isComposing||o.preventDefault(),o.isSoft||(e.execute("enter"),t.scrollToTheSelection())}),{priority:"low"}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:n("Insert a hard break (a new paragraph)"),keystroke:"Enter"}]})}}class h extends n.Command{execute(){const e=this.editor.model,t=e.document;e.change((i=>{!function(e,t,i){const n=i.isCollapsed,s=i.getFirstRange(),r=s.start.parent,a=s.end.parent,l=r==a;if(n){const n=o(e.schema,i.getAttributes());m(e,t,s.end),t.removeSelectionAttribute(i.getAttributeKeys()),t.setSelectionAttribute(n)}else{const n=!(s.start.isAtStart&&s.end.isAtEnd);e.deleteContent(i,{leaveUnmerged:n}),l?m(e,t,i.focus):n&&t.setSelection(a,0)}}(e,i,t.selection),this.fire("afterExecute",{writer:i})}))}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=function(e,t){if(t.rangeCount>1)return!1;const i=t.anchor;if(!i||!e.checkChild(i,"softBreak"))return!1;const n=t.getFirstRange(),o=n.start.parent,s=n.end.parent;return!g(o,e)&&!g(s,e)||o===s}(e.schema,t.selection)}}function m(e,t,i){const n=t.createElement("softBreak");e.insertContent(n,i),t.setSelection(n,"after")}function g(e,t){return!e.is("rootElement")&&(t.isLimit(e)||g(e.parent,t))}class f extends n.Plugin{static get pluginName(){return"ShiftEnter"}init(){const e=this.editor,t=e.model.schema,i=e.conversion,n=e.editing.view,o=n.document,s=this.editor.t;t.register("softBreak",{allowWhere:"$text",isInline:!0}),i.for("upcast").elementToElement({model:"softBreak",view:"br"}),i.for("downcast").elementToElement({model:"softBreak",view:(e,{writer:t})=>t.createEmptyElement("br")}),n.addObserver(d),e.commands.add("shiftEnter",new h(e)),this.listenTo(o,"enter",((t,i)=>{o.isComposing||i.preventDefault(),i.isSoft&&(e.execute("shiftEnter"),n.scrollToTheSelection())}),{priority:"low"}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:s("Insert a soft break (a <code>&lt;br&gt;</code> element)"),keystroke:"Shift+Enter"}]})}}},708:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Essentials:()=>d});var n=i(1204),o=i(7377),s=i(6449),r=i(6206),a=i(7211),l=i(6417),c=i(949);class d extends n.k_{static get requires(){return[c.KO,o.B0,s.x,r.SelectAll,s.D,a.IG,l.Vn]}static get pluginName(){return"Essentials"}}},6913:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Font:()=>W,FontBackgroundColor:()=>z,FontBackgroundColorEditing:()=>N,FontBackgroundColorUI:()=>D,FontColor:()=>L,FontColorEditing:()=>B,FontColorUI:()=>O,FontFamily:()=>y,FontFamilyEditing:()=>b,FontFamilyUI:()=>_,FontSize:()=>V,FontSizeEditing:()=>P,FontSizeUI:()=>S});var n=i(1204);class o extends n.uB{constructor(e,t){super(e),this.attributeKey=t}refresh(){const e=this.editor.model,t=e.document;this.value=t.selection.getAttribute(this.attributeKey),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){const t=this.editor.model,i=t.document.selection,n=e.value,o=e.batch,s=e=>{if(i.isCollapsed)n?e.setSelectionAttribute(this.attributeKey,n):e.removeSelectionAttribute(this.attributeKey);else{const o=t.schema.getValidRanges(i.getRanges(),this.attributeKey);for(const t of o)n?e.setAttribute(this.attributeKey,n,t):e.removeAttribute(this.attributeKey,t)}};o?t.enqueueChange(o,(e=>{s(e)})):t.change((e=>{s(e)}))}}var s=i(949);const r="fontSize",a="fontFamily",l="fontColor",c="fontBackgroundColor";function d(e,t){const i={model:{key:e,values:[]},view:{},upcastAlso:{}};for(const e of t)i.model.values.push(e.model),i.view[e.model]=e.view,e.upcastAlso&&(i.upcastAlso[e.model]=e.upcastAlso);return i}function u(e){return t=>t.getStyle(e).replace(/\s/g,"")}function h(e){return(t,{writer:i})=>i.createAttributeElement("span",{style:`${e}:${t}`},{priority:7})}class m extends o{constructor(e){super(e,a)}}function g(e){return e.map(f).filter((e=>void 0!==e))}function f(e){return"object"==typeof e?e:"default"===e?{title:"Default",model:void 0}:"string"==typeof e?function(e){const t=e.replace(/"|'/g,"").split(","),i=t[0],n=t.map(p).join(", ");return{title:i,model:n,view:{name:"span",styles:{"font-family":n},priority:7}}}(e):void 0}function p(e){return(e=e.trim()).indexOf(" ")>0&&(e=`'${e}'`),e}class b extends n.k_{static get pluginName(){return"FontFamilyEditing"}constructor(e){super(e),e.config.define(a,{options:["default","Arial, Helvetica, sans-serif","Courier New, Courier, monospace","Georgia, serif","Lucida Sans Unicode, Lucida Grande, sans-serif","Tahoma, Geneva, sans-serif","Times New Roman, Times, serif","Trebuchet MS, Helvetica, sans-serif","Verdana, Geneva, sans-serif"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:a}),e.model.schema.setAttributeProperties(a,{isFormatting:!0,copyOnEnter:!0});const t=g(e.config.get("fontFamily.options")).filter((e=>e.model)),i=d(a,t);e.config.get("fontFamily.supportAllValues")?(this._prepareAnyValueConverters(),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(i),e.commands.add(a,new m(e))}_prepareAnyValueConverters(){const e=this.editor;e.conversion.for("downcast").attributeToElement({model:a,view:(e,{writer:t})=>t.createAttributeElement("span",{style:"font-family:"+e},{priority:7})}),e.conversion.for("upcast").elementToAttribute({model:{key:a,value:e=>e.getStyle("font-family")},view:{name:"span",styles:{"font-family":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{face:/.*/}},model:{key:a,value:e=>e.getAttribute("face")}})}}var w=i(5318);const v='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.03 3h6.149a.75.75 0 1 1 0 1.5h-5.514L11.03 3zm1.27 3h4.879a.75.75 0 1 1 0 1.5h-4.244L12.3 6zm1.27 3h3.609a.75.75 0 1 1 0 1.5h-2.973L13.57 9zm-2.754 2.5L8.038 4.785 5.261 11.5h5.555zm.62 1.5H4.641l-1.666 4.028H1.312l5.789-14h1.875l5.789 14h-1.663L11.436 13z"/></svg>';class _ extends n.k_{static get pluginName(){return"FontFamilyUI"}init(){const e=this.editor,t=e.t,i=this._getLocalizedOptions(),n=e.commands.get(a),o=t("Font Family"),r=function(e,t){const i=new w.pM;for(const n of e){const e={type:"button",model:new s.Jc({commandName:a,commandParam:n.model,label:n.title,role:"menuitemradio",withText:!0})};e.model.bind("isOn").to(t,"value",(e=>e===n.model||!(!e||!n.model)&&e.split(",")[0].replace(/'/g,"").toLowerCase()===n.model.toLowerCase())),n.view&&"string"!=typeof n.view&&n.view.styles&&e.model.set("labelStyle",`font-family: ${n.view.styles["font-family"]}`),i.add(e)}return i}(i,n);e.ui.componentFactory.add(a,(t=>{const i=(0,s.yu)(t);return(0,s.O)(i,r,{role:"menu",ariaLabel:o}),i.buttonView.set({label:o,icon:v,tooltip:!0}),i.extendTemplate({attributes:{class:"ck-font-family-dropdown"}}),i.bind("isEnabled").to(n),this.listenTo(i,"execute",(t=>{e.execute(t.source.commandName,{value:t.source.commandParam}),e.editing.view.focus()})),i})),e.ui.componentFactory.add(`menuBar:${a}`,(t=>{const i=new s.zj(t);i.buttonView.set({label:o,icon:v}),i.bind("isEnabled").to(n);const a=new s.BY(t);for(const n of r){const o=new s.I8(t,i),r=new s.kS(t);r.set({role:"menuitemradio",isToggleable:!0}),r.bind(...Object.keys(n.model)).to(n.model),r.delegate("execute").to(i),r.on("execute",(()=>{e.execute(n.model.commandName,{value:n.model.commandParam}),e.editing.view.focus()})),o.children.add(r),a.items.add(o)}return i.panelView.children.add(a),i}))}_getLocalizedOptions(){const e=this.editor,t=e.t;return g(e.config.get(a).options).map((e=>("Default"===e.title&&(e.title=t("Default")),e)))}}class y extends n.k_{static get requires(){return[b,_]}static get pluginName(){return"FontFamily"}}var k=i(4133);class C extends o{constructor(e){super(e,r)}}function A(e){return e.map((e=>function(e){if("number"==typeof e&&(e=String(e)),"object"==typeof e&&((t=e).title&&t.model&&t.view))return x(e);var t;const i=function(e){return"string"==typeof e?E[e]:E[e.model]}(e);return i?x(i):"default"===e?{model:void 0,title:"Default"}:function(e){let t;if("object"==typeof e){if(!e.model)throw new w.Yb("font-size-invalid-definition",null,e);t=parseFloat(e.model)}else t=parseFloat(e);return isNaN(t)}(e)?void 0:function(e){return"string"==typeof e&&(e={title:e,model:`${parseFloat(e)}px`}),e.view={name:"span",styles:{"font-size":e.model}},x(e)}(e)}(e))).filter((e=>void 0!==e))}const E={get tiny(){return{title:"Tiny",model:"tiny",view:{name:"span",classes:"text-tiny",priority:7}}},get small(){return{title:"Small",model:"small",view:{name:"span",classes:"text-small",priority:7}}},get big(){return{title:"Big",model:"big",view:{name:"span",classes:"text-big",priority:7}}},get huge(){return{title:"Huge",model:"huge",view:{name:"span",classes:"text-huge",priority:7}}}};function x(e){return e.view&&"string"!=typeof e.view&&!e.view.priority&&(e.view.priority=7),e}const T=["x-small","x-small","small","medium","large","x-large","xx-large","xxx-large"];class P extends n.k_{static get pluginName(){return"FontSizeEditing"}constructor(e){super(e),e.config.define(r,{options:["tiny","small","default","big","huge"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:r}),e.model.schema.setAttributeProperties(r,{isFormatting:!0,copyOnEnter:!0});const t=e.config.get("fontSize.supportAllValues"),i=A(this.editor.config.get("fontSize.options")).filter((e=>e.model)),n=d(r,i);t?(this._prepareAnyValueConverters(n),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(n),e.commands.add(r,new C(e))}_prepareAnyValueConverters(e){const t=this.editor,i=e.model.values.filter((e=>!(0,k.Vq)(String(e))&&!(0,k.fp)(String(e))));if(i.length)throw new w.Yb("font-size-invalid-use-of-named-presets",null,{presets:i});t.conversion.for("downcast").attributeToElement({model:r,view:(e,{writer:t})=>{if(e)return t.createAttributeElement("span",{style:"font-size:"+e},{priority:7})}}),t.conversion.for("upcast").elementToAttribute({model:{key:r,value:e=>e.getStyle("font-size")},view:{name:"span",styles:{"font-size":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{size:/^[+-]?\d{1,3}$/}},model:{key:r,value:e=>{const t=e.getAttribute("size"),i="-"===t[0]||"+"===t[0];let n=parseInt(t,10);i&&(n=3+n);const o=T.length-1,s=Math.min(Math.max(n,0),o);return T[s]}}})}}const I='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.816 11.5 7.038 4.785 4.261 11.5h5.555zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663L10.436 13zm7.55 2.279.779-.779.707.707-2.265 2.265-2.193-2.265.707-.707.765.765V4.825c0-.042 0-.083.002-.123l-.77.77-.707-.707L17.207 2.5l2.265 2.265-.707.707-.782-.782c.002.043.003.089.003.135v10.454z"/></svg>';class S extends n.k_{static get pluginName(){return"FontSizeUI"}init(){const e=this.editor,t=e.t,i=this._getLocalizedOptions(),n=e.commands.get(r),o=t("Font Size"),a=function(e,t){const i=new w.pM;for(const n of e){const e={type:"button",model:new s.Jc({commandName:r,commandParam:n.model,label:n.title,class:"ck-fontsize-option",role:"menuitemradio",withText:!0})};n.view&&"string"!=typeof n.view&&(n.view.styles&&e.model.set("labelStyle",`font-size:${n.view.styles["font-size"]}`),n.view.classes&&e.model.set("class",`${e.model.class} ${n.view.classes}`)),e.model.bind("isOn").to(t,"value",(e=>e===n.model)),i.add(e)}return i}(i,n);e.ui.componentFactory.add(r,(t=>{const i=(0,s.yu)(t);return(0,s.O)(i,a,{role:"menu",ariaLabel:o}),i.buttonView.set({label:o,icon:I,tooltip:!0}),i.extendTemplate({attributes:{class:["ck-font-size-dropdown"]}}),i.bind("isEnabled").to(n),this.listenTo(i,"execute",(t=>{e.execute(t.source.commandName,{value:t.source.commandParam}),e.editing.view.focus()})),i})),e.ui.componentFactory.add(`menuBar:${r}`,(t=>{const i=new s.zj(t);i.buttonView.set({label:o,icon:I}),i.bind("isEnabled").to(n);const r=new s.BY(t);for(const n of a){const o=new s.I8(t,i),a=new s.kS(t);a.set({role:"menuitemradio",isToggleable:!0}),a.bind(...Object.keys(n.model)).to(n.model),a.delegate("execute").to(i),a.on("execute",(()=>{e.execute(n.model.commandName,{value:n.model.commandParam}),e.editing.view.focus()})),o.children.add(a),r.items.add(o)}return i.panelView.children.add(r),i}))}_getLocalizedOptions(){const e=this.editor,t=e.t,i={Default:t("Default"),Tiny:t("Tiny"),Small:t("Small"),Big:t("Big"),Huge:t("Huge")};return A(e.config.get(r).options).map((e=>{const t=i[e.title];return t&&t!=e.title&&(e=Object.assign({},e,{title:t})),e}))}}class V extends n.k_{static get requires(){return[P,S]}static get pluginName(){return"FontSize"}normalizeSizeOptions(e){return A(e)}}class R extends o{constructor(e){super(e,l)}}class B extends n.k_{static get pluginName(){return"FontColorEditing"}constructor(e){super(e),e.config.define(l,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{color:/[\s\S]+/}},model:{key:l,value:u("color")}}),e.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{color:/^#?\w+$/}},model:{key:l,value:e=>e.getAttribute("color")}}),e.conversion.for("downcast").attributeToElement({model:l,view:h("color")}),e.commands.add(l,new R(e)),e.model.schema.extend("$text",{allowAttributes:l}),e.model.schema.setAttributeProperties(l,{isFormatting:!0,copyOnEnter:!0})}}class M extends n.k_{constructor(e,{commandName:t,componentName:i,icon:n,dropdownLabel:o}){super(e),this.commandName=t,this.componentName=i,this.icon=n,this.dropdownLabel=o,this.columns=e.config.get(`${this.componentName}.columns`)}init(){const e=this.editor,t=e.locale,i=t.t,n=e.commands.get(this.commandName),o=e.config.get(this.componentName),r=(0,s.lF)(o.colors),a=(0,s.b2)(t,r),l=o.documentColors,c=!1!==o.colorPicker;e.ui.componentFactory.add(this.componentName,(t=>{const r=(0,s.yu)(t);let d=!1;const u=function({dropdownView:e,colors:t,columns:i,removeButtonLabel:n,colorPickerLabel:o,documentColorsLabel:r,documentColorsCount:a,colorPickerViewConfig:l}){const c=e.locale,d=new s.oB(c,{colors:t,columns:i,removeButtonLabel:n,colorPickerLabel:o,documentColorsLabel:r,documentColorsCount:a,colorPickerViewConfig:l});return e.colorSelectorView=d,e.panelView.children.add(d),d}({dropdownView:r,colors:a.map((e=>({label:e.label,color:e.model,options:{hasBorder:e.hasBorder}}))),columns:this.columns,removeButtonLabel:i("Remove color"),colorPickerLabel:i("Color picker"),documentColorsLabel:0!==l?i("Document colors"):"",documentColorsCount:void 0===l?this.columns:l,colorPickerViewConfig:!!c&&(o.colorPicker||{})});return u.bind("selectedColor").to(n,"value"),r.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:!0}),r.extendTemplate({attributes:{class:"ck-color-ui-dropdown"}}),r.bind("isEnabled").to(n),u.on("execute",((t,i)=>{r.isOpen&&e.execute(this.commandName,{value:i.value,batch:this._undoStepBatch}),"colorPicker"!==i.source&&e.editing.view.focus(),"colorPickerSaveButton"===i.source&&(r.isOpen=!1)})),u.on("colorPicker:show",(()=>{this._undoStepBatch=e.model.createBatch()})),u.on("colorPicker:cancel",(()=>{this._undoStepBatch.operations.length&&(r.isOpen=!1,e.execute("undo",this._undoStepBatch)),e.editing.view.focus()})),r.on("change:isOpen",((t,i,n)=>{d||(d=!0,r.colorSelectorView.appendUI()),n&&(0!==l&&u.updateDocumentColors(e.model,this.componentName),u.updateSelectedColors(),u.showColorGridsFragment())})),(0,s.Zn)(r,(()=>r.colorSelectorView.colorGridsFragmentView.staticColorsGrid.items.find((e=>e.isOn)))),r})),e.ui.componentFactory.add(`menuBar:${this.componentName}`,(t=>{const o=new s.zj(t);o.buttonView.set({label:this.dropdownLabel,icon:this.icon}),o.bind("isEnabled").to(n);let r=!1;const c=new s.oB(t,{colors:a.map((e=>({label:e.label,color:e.model,options:{hasBorder:e.hasBorder}}))),columns:this.columns,removeButtonLabel:i("Remove color"),colorPickerLabel:i("Color picker"),documentColorsLabel:0!==l?i("Document colors"):"",documentColorsCount:void 0===l?this.columns:l,colorPickerViewConfig:!1});return c.bind("selectedColor").to(n,"value"),c.delegate("execute").to(o),c.on("execute",((t,i)=>{e.execute(this.commandName,{value:i.value,batch:this._undoStepBatch}),e.editing.view.focus()})),o.on("change:isOpen",((t,i,n)=>{r||(r=!0,c.appendUI()),n&&(0!==l&&c.updateDocumentColors(e.model,this.componentName),c.updateSelectedColors(),c.showColorGridsFragment())})),o.panelView.children.add(c),o}))}}class O extends M{constructor(e){const t=e.locale.t;super(e,{commandName:l,componentName:l,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.4 10.3 10 4.5l-2.4 5.8h4.8zm.5 1.2H7.1L5.7 15H4.2l5-12h1.6l5 12h-1.5L13 11.5zm3.1 7H4a1 1 0 0 1 0-2h12a1 1 0 0 1 0 2z"/></svg>',dropdownLabel:t("Font Color")})}static get pluginName(){return"FontColorUI"}}class L extends n.k_{static get requires(){return[B,O]}static get pluginName(){return"FontColor"}}class F extends o{constructor(e){super(e,c)}}class N extends n.k_{static get pluginName(){return"FontBackgroundColorEditing"}constructor(e){super(e),e.config.define(c,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.data.addStyleProcessorRules(k.D0),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{"background-color":/[\s\S]+/}},model:{key:c,value:u("background-color")}}),e.conversion.for("downcast").attributeToElement({model:c,view:h("background-color")}),e.commands.add(c,new F(e)),e.model.schema.extend("$text",{allowAttributes:c}),e.model.schema.setAttributeProperties(c,{isFormatting:!0,copyOnEnter:!0})}}class D extends M{constructor(e){const t=e.locale.t;super(e,{commandName:c,componentName:c,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M4 2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zm8.38 9.262H7.62L10 5.506l2.38 5.756zm.532 1.285L14.34 16h1.426L10.804 4H9.196L4.234 16H5.66l1.428-3.453h5.824z"/></svg>',dropdownLabel:t("Font Background Color")})}static get pluginName(){return"FontBackgroundColorUI"}}class z extends n.k_{static get requires(){return[N,D]}static get pluginName(){return"FontBackgroundColor"}}class W extends n.k_{static get requires(){return[y,V,L,z]}static get pluginName(){return"Font"}}},9174:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Heading:()=>m,HeadingButtonsUI:()=>f,HeadingEditing:()=>c,HeadingUI:()=>h,Title:()=>w});var n=i(1204),o=i(1980),s=i(5318);class r extends n.uB{constructor(e,t){super(e),this.modelElements=t}refresh(){const e=(0,s.$1)(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some((t=>a(e,t,this.editor.model.schema)))}execute(e){const t=this.editor.model,i=t.document,n=e.value;t.change((e=>{const o=Array.from(i.selection.getSelectedBlocks()).filter((e=>a(e,n,t.schema)));for(const t of o)t.is("element",n)||e.rename(t,n)}))}}function a(e,t,i){return i.checkChild(e.parent,t)&&!i.isObject(e)}const l="paragraph";class c extends n.k_{static get pluginName(){return"HeadingEditing"}constructor(e){super(e),e.config.define("heading",{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading1",view:"h2",title:"Heading 1",class:"ck-heading_heading1"},{model:"heading2",view:"h3",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h4",title:"Heading 3",class:"ck-heading_heading3"}]})}static get requires(){return[o.Paragraph]}init(){const e=this.editor,t=e.config.get("heading.options"),i=[];for(const n of t)"paragraph"!==n.model&&(e.model.schema.register(n.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(n),i.push(n.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new r(e,i))}afterInit(){const e=this.editor,t=e.commands.get("enter"),i=e.config.get("heading.options");t&&this.listenTo(t,"afterExecute",((t,n)=>{const o=e.model.document.selection.getFirstPosition().parent;i.some((e=>o.is("element",e.model)))&&!o.is("element",l)&&0===o.childCount&&n.writer.rename(o,l)}))}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:s.vx.low+1})}}var d=i(949);function u(e){const t=e.t,i={Paragraph:t("Paragraph"),"Heading 1":t("Heading 1"),"Heading 2":t("Heading 2"),"Heading 3":t("Heading 3"),"Heading 4":t("Heading 4"),"Heading 5":t("Heading 5"),"Heading 6":t("Heading 6")};return e.config.get("heading.options").map((e=>{const t=i[e.title];return t&&t!=e.title&&(e.title=t),e}))}class h extends n.k_{static get pluginName(){return"HeadingUI"}init(){const e=this.editor,t=e.t,i=u(e),n=t("Choose heading"),o=t("Heading");e.ui.componentFactory.add("heading",(t=>{const r={},a=new s.pM,l=e.commands.get("heading"),c=e.commands.get("paragraph"),u=[l];for(const e of i){const t={type:"button",model:new d.Jc({label:e.title,class:e.class,role:"menuitemradio",withText:!0})};"paragraph"===e.model?(t.model.bind("isOn").to(c,"value"),t.model.set("commandName","paragraph"),u.push(c)):(t.model.bind("isOn").to(l,"value",(t=>t===e.model)),t.model.set({commandName:"heading",commandValue:e.model})),a.add(t),r[e.model]=e.title}const h=(0,d.yu)(t);return(0,d.O)(h,a,{ariaLabel:o,role:"menu"}),h.buttonView.set({ariaLabel:o,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:o}),h.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),h.bind("isEnabled").toMany(u,"isEnabled",((...e)=>e.some((e=>e)))),h.buttonView.bind("label").to(l,"value",c,"value",((e,t)=>{const i=t?"paragraph":e;return"boolean"==typeof i?n:r[i]?r[i]:n})),h.buttonView.bind("ariaLabel").to(l,"value",c,"value",((e,t)=>{const i=t?"paragraph":e;return"boolean"==typeof i?o:r[i]?`${r[i]}, ${o}`:o})),this.listenTo(h,"execute",(t=>{const{commandName:i,commandValue:n}=t.source;e.execute(i,n?{value:n}:void 0),e.editing.view.focus()})),h})),e.ui.componentFactory.add("menuBar:heading",(n=>{const o=new d.zj(n),s=e.commands.get("heading"),r=e.commands.get("paragraph"),a=[s],l=new d.BY(n);o.set({class:"ck-heading-dropdown"}),l.set({ariaLabel:t("Heading"),role:"menu"}),o.buttonView.set({label:t("Heading")}),o.panelView.children.add(l);for(const t of i){const i=new d.I8(n,o),c=new d.kS(n);i.children.add(c),l.items.add(i),c.set({isToggleable:!0,label:t.title,role:"menuitemradio",class:t.class}),c.delegate("execute").to(o),c.on("execute",(()=>{const i="paragraph"===t.model?"paragraph":"heading";e.execute(i,{value:t.model}),e.editing.view.focus()})),"paragraph"===t.model?(c.bind("isOn").to(r,"value"),a.push(r)):c.bind("isOn").to(s,"value",(e=>e===t.model))}return o.bind("isEnabled").toMany(a,"isEnabled",((...e)=>e.some((e=>e)))),o}))}}class m extends n.k_{static get requires(){return[c,h]}static get pluginName(){return"Heading"}}const g=(()=>({heading1:n.Pt.heading1,heading2:n.Pt.heading2,heading3:n.Pt.heading3,heading4:n.Pt.heading4,heading5:n.Pt.heading5,heading6:n.Pt.heading6}))();class f extends n.k_{init(){u(this.editor).filter((e=>"paragraph"!==e.model)).map((e=>this._createButton(e)))}_createButton(e){const t=this.editor;t.ui.componentFactory.add(e.model,(i=>{const n=new d._(i),o=t.commands.get("heading");return n.label=e.title,n.icon=e.icon||g[e.model],n.tooltip=!0,n.isToggleable=!0,n.bind("isEnabled").to(o),n.bind("isOn").to(o,"value",(t=>t==e.model)),n.on("execute",(()=>{t.execute("heading",{value:e.model}),t.editing.view.focus()})),n}))}}var p=i(4133);const b=new Set(["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"]);class w extends n.k_{constructor(){super(...arguments),this._bodyPlaceholder=new Map}static get pluginName(){return"Title"}static get requires(){return["Paragraph"]}init(){const e=this.editor,t=e.model;t.schema.register("title",{isBlock:!0,allowIn:"$root"}),t.schema.register("title-content",{isBlock:!0,allowIn:"title",allowAttributes:["alignment"]}),t.schema.extend("$text",{allowIn:"title-content"}),t.schema.addAttributeCheck((e=>{if(e.endsWith("title-content $text"))return!1})),e.editing.mapper.on("modelToViewPosition",_(e.editing.view)),e.data.mapper.on("modelToViewPosition",_(e.editing.view)),e.conversion.for("downcast").elementToElement({model:"title-content",view:"h1"}),e.conversion.for("downcast").add((e=>e.on("insert:title",((e,t,i)=>{i.consumable.consume(t.item,e.name)})))),e.data.upcastDispatcher.on("element:h1",v,{priority:"high"}),e.data.upcastDispatcher.on("element:h2",v,{priority:"high"}),e.data.upcastDispatcher.on("element:h3",v,{priority:"high"}),t.document.registerPostFixer((e=>this._fixTitleContent(e))),t.document.registerPostFixer((e=>this._fixTitleElement(e))),t.document.registerPostFixer((e=>this._fixBodyElement(e))),t.document.registerPostFixer((e=>this._fixExtraParagraph(e))),this._attachPlaceholders(),this._attachTabPressHandling()}getTitle(e={}){const t=e.rootName?e.rootName:void 0,i=this._getTitleElement(t).getChild(0);return this.editor.data.stringify(i,e)}getBody(e={}){const t=this.editor,i=t.data,n=t.model,o=e.rootName?e.rootName:void 0,s=t.model.document.getRoot(o),r=t.editing.view,a=new p.zN(r.document),l=n.createRangeIn(s),c=a.createDocumentFragment(),d=n.createPositionAfter(s.getChild(0)),u=n.createRange(d,n.createPositionAt(s,"end")),h=new Map;for(const e of n.markers){const t=u.getIntersection(e.getRange());t&&h.set(e.name,t)}return i.mapper.clearBindings(),i.mapper.bindElements(s,c),i.downcastDispatcher.convert(l,h,a,e),a.remove(a.createRangeOn(c.getChild(0))),t.data.processor.toData(c)}_getTitleElement(e){const t=this.editor.model.document.getRoot(e);for(const e of t.getChildren())if(y(e))return e}_fixTitleContent(e){let t=!1;for(const i of this.editor.model.document.getRootNames()){const n=this._getTitleElement(i);if(!n||1===n.maxOffset)continue;const o=Array.from(n.getChildren());o.shift();for(const t of o)e.move(e.createRangeOn(t),n,"after"),e.rename(t,"paragraph");t=!0}return t}_fixTitleElement(e){let t=!1;const i=this.editor.model;for(const n of this.editor.model.document.getRoots()){const o=Array.from(n.getChildren()).filter(y),s=o[0],r=n.getChild(0);if(r.is("element","title"))o.length>1&&(C(o,e,i),t=!0);else if(s||b.has(r.name))b.has(r.name)?k(r,e,i):e.move(e.createRangeOn(s),n,0),C(o,e,i),t=!0;else{const i=e.createElement("title");e.insert(i,n),e.insertElement("title-content",i),t=!0}}return t}_fixBodyElement(e){let t=!1;for(const i of this.editor.model.document.getRootNames()){const n=this.editor.model.document.getRoot(i);if(n.childCount<2){const o=e.createElement("paragraph");e.insert(o,n,1),this._bodyPlaceholder.set(i,o),t=!0}}return t}_fixExtraParagraph(e){let t=!1;for(const i of this.editor.model.document.getRootNames()){const n=this.editor.model.document.getRoot(i),o=this._bodyPlaceholder.get(i);E(o,n)&&(this._bodyPlaceholder.delete(i),e.remove(o),t=!0)}return t}_attachPlaceholders(){const e=this.editor,t=e.t,i=e.editing.view,n=e.sourceElement,o=e.config.get("title.placeholder")||t("Type your title"),s=e.config.get("placeholder")||n&&"textarea"===n.tagName.toLowerCase()&&n.getAttribute("placeholder")||t("Type or paste your content here.");e.editing.downcastDispatcher.on("insert:title-content",((e,t,n)=>{const s=n.mapper.toViewElement(t.item);s.placeholder=o,(0,p.JT)({view:i,element:s,keepOnFocus:!0})}));const r=new Map;i.document.registerPostFixer((e=>{let t=!1;for(const n of i.document.roots){if(n.isEmpty)continue;const i=n.getChild(1),o=r.get(n.rootName);i!==o&&(o&&((0,p.YU)(e,o),e.removeAttribute("data-placeholder",o)),e.setAttribute("data-placeholder",s,i),r.set(n.rootName,i),t=!0),t=(0,p.$0)(i,!0)&&2===n.childCount&&"p"===i.name?!!(0,p.Zu)(e,i)||t:!!(0,p.YU)(e,i)||t}return t}))}_attachTabPressHandling(){const e=this.editor,t=e.model;e.keystrokes.set("TAB",((e,i)=>{t.change((e=>{const n=t.document.selection,o=Array.from(n.getSelectedBlocks());if(1===o.length&&o[0].is("element","title-content")){const t=n.getFirstPosition().root.getChild(1);e.setSelection(t,0),i()}}))})),e.keystrokes.set("SHIFT + TAB",((i,n)=>{t.change((i=>{const o=t.document.selection;if(!o.isCollapsed)return;const r=(0,s.$1)(o.getSelectedBlocks()),a=o.getFirstPosition(),l=e.model.document.getRoot(a.root.rootName),c=l.getChild(0);r===l.getChild(1)&&a.isAtStart&&(i.setSelection(c.getChild(0),0),n())}))}))}}function v(e,t,i){const n=t.modelCursor,o=t.viewItem;if(!n.isAtStart||!n.parent.is("element","$root"))return;if(!i.consumable.consume(o,{name:!0}))return;const s=i.writer,r=s.createElement("title"),a=s.createElement("title-content");s.append(a,r),s.insert(r,n),i.convertChildren(o,a),i.updateConversionResult(r,t)}function _(e){return(t,i)=>{const n=i.modelPosition.parent;if(!n.is("element","title"))return;const o=n.parent,s=i.mapper.toViewElement(o);i.viewPosition=e.createPositionAt(s,0),t.stop()}}function y(e){return e.is("element","title")}function k(e,t,i){const n=t.createElement("title");t.insert(n,e,"before"),t.insert(e,n,0),t.rename(e,"title-content"),i.schema.removeDisallowedAttributes([e],t)}function C(e,t,i){let n=!1;for(const o of e)0!==o.index&&(A(o,t,i),n=!0);return n}function A(e,t,i){const n=e.getChild(0);n.isEmpty?t.remove(e):(t.move(t.createRangeOn(n),e,"before"),t.rename(n,"paragraph"),t.remove(e),i.schema.removeDisallowedAttributes([n],t))}function E(e,t){return!(!e||!e.is("element","paragraph")||e.childCount||t.childCount<=2||t.getChild(t.childCount-1)!==e)}},174:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Highlight:()=>c,HighlightEditing:()=>s,HighlightUI:()=>a});var n=i(1204);class o extends n.uB{refresh(){const e=this.editor.model,t=e.document;this.value=t.selection.getAttribute("highlight"),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"highlight")}execute(e={}){const t=this.editor.model,i=t.document.selection,n=e.value;t.change((e=>{if(i.isCollapsed){const t=i.getFirstPosition();if(i.hasAttribute("highlight")){const i=e=>e.item.hasAttribute("highlight")&&e.item.getAttribute("highlight")===this.value,o=t.getLastMatchingPosition(i,{direction:"backward"}),s=t.getLastMatchingPosition(i),r=e.createRange(o,s);n&&this.value!==n?(t.isEqual(s)||e.setAttribute("highlight",n,r),e.setSelectionAttribute("highlight",n)):(t.isEqual(s)||e.removeAttribute("highlight",r),e.removeSelectionAttribute("highlight"))}else n&&e.setSelectionAttribute("highlight",n)}else{const o=t.schema.getValidRanges(i.getRanges(),"highlight");for(const t of o)n?e.setAttribute("highlight",n,t):e.removeAttribute("highlight",t)}}))}}class s extends n.k_{static get pluginName(){return"HighlightEditing"}constructor(e){super(e),e.config.define("highlight",{options:[{model:"yellowMarker",class:"marker-yellow",title:"Yellow marker",color:"var(--ck-highlight-marker-yellow)",type:"marker"},{model:"greenMarker",class:"marker-green",title:"Green marker",color:"var(--ck-highlight-marker-green)",type:"marker"},{model:"pinkMarker",class:"marker-pink",title:"Pink marker",color:"var(--ck-highlight-marker-pink)",type:"marker"},{model:"blueMarker",class:"marker-blue",title:"Blue marker",color:"var(--ck-highlight-marker-blue)",type:"marker"},{model:"redPen",class:"pen-red",title:"Red pen",color:"var(--ck-highlight-pen-red)",type:"pen"},{model:"greenPen",class:"pen-green",title:"Green pen",color:"var(--ck-highlight-pen-green)",type:"pen"}]})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"highlight"});const t=e.config.get("highlight.options");e.conversion.attributeToElement(function(e){const t={model:{key:"highlight",values:[]},view:{}};for(const i of e)t.model.values.push(i.model),t.view[i.model]={name:"mark",classes:i.class};return t}(t)),e.commands.add("highlight",new o(e))}}var r=i(949);class a extends n.k_{get localizedOptionTitles(){const e=this.editor.t;return{"Yellow marker":e("Yellow marker"),"Green marker":e("Green marker"),"Pink marker":e("Pink marker"),"Blue marker":e("Blue marker"),"Red pen":e("Red pen"),"Green pen":e("Green pen")}}static get pluginName(){return"HighlightUI"}init(){const e=this.editor.config.get("highlight.options");for(const t of e)this._addHighlighterButton(t);this._addRemoveHighlightButton(),this._addDropdown(e),this._addMenuBarButton(e)}_addRemoveHighlightButton(){const e=this.editor.t,t=this.editor.commands.get("highlight");this._addButton("removeHighlight",e("Remove highlight"),n.Pt.eraser,null,(e=>{e.bind("isEnabled").to(t,"isEnabled")}))}_addHighlighterButton(e){const t=this.editor.commands.get("highlight");this._addButton("highlight:"+e.model,e.title,l(e.type),e.model,(function(i){i.bind("isEnabled").to(t,"isEnabled"),i.bind("isOn").to(t,"value",(t=>t===e.model)),i.iconView.fillColor=e.color,i.isToggleable=!0}))}_addButton(e,t,i,n,o){const s=this.editor;s.ui.componentFactory.add(e,(e=>{const a=new r._(e),l=this.localizedOptionTitles[t]?this.localizedOptionTitles[t]:t;return a.set({label:l,icon:i,tooltip:!0}),a.on("execute",(()=>{s.execute("highlight",{value:n}),s.editing.view.focus()})),o(a),a}))}_addDropdown(e){const t=this.editor,i=t.t,n=t.ui.componentFactory,o=e[0],s=e.reduce(((e,t)=>(e[t.model]=t,e)),{});n.add("highlight",(a=>{const c=t.commands.get("highlight"),d=(0,r.yu)(a,r.AO),u=d.buttonView;function h(e,t){const i=e&&e!==u.lastExecuted?e:u.lastExecuted;return s[i][t]}return u.set({label:i("Highlight"),tooltip:!0,lastExecuted:o.model,commandValue:o.model,isToggleable:!0}),u.bind("icon").to(c,"value",(e=>l(h(e,"type")))),u.bind("color").to(c,"value",(e=>h(e,"color"))),u.bind("commandValue").to(c,"value",(e=>h(e,"model"))),u.bind("isOn").to(c,"value",(e=>!!e)),u.delegate("execute").to(d),d.bind("isEnabled").to(c,"isEnabled"),(0,r.fM)(d,(()=>{const t=e.map((e=>{const t=n.create("highlight:"+e.model);return this.listenTo(t,"execute",(()=>{d.buttonView.set({lastExecuted:e.model})})),t}));return t.push(new r.IY),t.push(n.create("removeHighlight")),t}),{enableActiveItemFocusOnDropdownOpen:!0,ariaLabel:i("Text highlight toolbar")}),function(e){e.buttonView.actionView.iconView.bind("fillColor").to(e.buttonView,"color")}(d),u.on("execute",(()=>{t.execute("highlight",{value:u.commandValue})})),this.listenTo(d,"execute",(()=>{t.editing.view.focus()})),d}))}_addMenuBarButton(e){const t=this.editor,i=t.t,o=t.commands.get("highlight");t.ui.componentFactory.add("menuBar:highlight",(s=>{const a=new r.zj(s);a.buttonView.set({label:i("Highlight"),icon:l("marker")}),a.bind("isEnabled").to(o),a.buttonView.iconView.fillColor="transparent";const c=new r.BY(s);for(const i of e){const e=new r.I8(s,a),n=new r.kS(s);n.set({label:i.title,icon:l(i.type),role:"menuitemradio",isToggleable:!0}),n.iconView.fillColor=i.color,n.delegate("execute").to(a),n.bind("isOn").to(o,"value",(e=>e===i.model)),n.on("execute",(()=>{t.execute("highlight",{value:i.model}),t.editing.view.focus()})),e.children.add(n),c.items.add(e)}c.items.add(new r.Je(s));const d=new r.I8(s,a),u=new r.kS(s);return u.set({label:i("Remove highlight"),icon:n.Pt.eraser}),u.delegate("execute").to(a),u.on("execute",(()=>{t.execute("highlight",{value:null}),t.editing.view.focus()})),d.children.add(u),c.items.add(d),a.panelView.children.add(c),a}))}}function l(e){return"marker"===e?'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path class="ck-icon__fill" d="M10.798 1.59 3.002 12.875l1.895 1.852 2.521 1.402 6.997-12.194z"/><path d="m2.556 16.727.234-.348c-.297-.151-.462-.293-.498-.426-.036-.137.002-.416.115-.837.094-.25.15-.449.169-.595a4.495 4.495 0 0 0 0-.725c-.209-.621-.303-1.041-.284-1.26.02-.218.178-.506.475-.862l6.77-9.414c.539-.91 1.605-.85 3.199.18 1.594 1.032 2.188 1.928 1.784 2.686l-5.877 10.36c-.158.412-.333.673-.526.782-.193.108-.604.179-1.232.21-.362.131-.608.237-.738.318-.13.081-.305.238-.526.47-.293.265-.504.397-.632.397-.096 0-.27-.075-.524-.226l-.31.41-1.6-1.12zm-.279.415 1.575 1.103-.392.515H1.19l1.087-1.618zm8.1-13.656-4.953 6.9L8.75 12.57l4.247-7.574c.175-.25-.188-.647-1.092-1.192-.903-.546-1.412-.652-1.528-.32zM8.244 18.5 9.59 17h9.406v1.5H8.245z"/></svg>':'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path class="ck-icon__fill" d="M10.126 2.268 2.002 13.874l1.895 1.852 2.521 1.402L14.47 5.481l-1.543-2.568-2.801-.645z"/><path d="m4.5 18.088-2.645-1.852-.04-2.95-.006-.005.006-.008v-.025l.011.008L8.73 2.97c.165-.233.356-.417.567-.557l-1.212.308L4.604 7.9l-.83-.558 3.694-5.495 2.708-.69 1.65 1.145.046.018.85-1.216 2.16 1.512-.856 1.222c.828.967 1.144 2.141.432 3.158L7.55 17.286l.006.005-3.055.797H4.5zm-.634.166-1.976.516-.026-1.918 2.002 1.402zM9.968 3.817l-.006-.004-6.123 9.184 3.277 2.294 6.108-9.162.005.003c.317-.452-.16-1.332-1.064-1.966-.891-.624-1.865-.776-2.197-.349zM8.245 18.5 9.59 17h9.406v1.5H8.245z"/></svg>'}class c extends n.k_{static get requires(){return[s,a]}static get pluginName(){return"Highlight"}}},9306:(e,t,i)=>{"use strict";i.r(t),i.d(t,{HorizontalLine:()=>c,HorizontalLineEditing:()=>r,HorizontalLineUI:()=>l});var n=i(1204),o=i(5091);class s extends n.uB{refresh(){const e=this.editor.model,t=e.schema,i=e.document.selection;this.isEnabled=function(e,t,i){const n=function(e,t){const i=(0,o.iB)(e,t).start.parent;return i.isEmpty&&!i.is("element","$root")?i.parent:i}(e,i);return t.checkChild(n,"horizontalLine")}(i,t,e)}execute(){const e=this.editor.model;e.change((t=>{const i=t.createElement("horizontalLine");e.insertObject(i,null,null,{setSelection:"after"})}))}}class r extends n.k_{static get pluginName(){return"HorizontalLineEditing"}init(){const e=this.editor,t=e.model.schema,i=e.t,n=e.conversion;t.register("horizontalLine",{inheritAllFrom:"$blockObject"}),n.for("dataDowncast").elementToElement({model:"horizontalLine",view:(e,{writer:t})=>t.createEmptyElement("hr")}),n.for("editingDowncast").elementToStructure({model:"horizontalLine",view:(e,{writer:t})=>{const n=i("Horizontal line"),s=t.createContainerElement("div",null,t.createEmptyElement("hr"));return t.addClass("ck-horizontal-line",s),t.setCustomProperty("hr",!0,s),function(e,t,i){return t.setCustomProperty("horizontalLine",!0,e),(0,o.Ex)(e,t,{label:i})}(s,t,n)}}),n.for("upcast").elementToElement({view:"hr",model:"horizontalLine"}),e.commands.add("horizontalLine",new s(e))}}var a=i(949);class l extends n.k_{static get pluginName(){return"HorizontalLineUI"}init(){const e=this.editor;e.ui.componentFactory.add("horizontalLine",(()=>{const e=this._createButton(a._);return e.set({tooltip:!0}),e})),e.ui.componentFactory.add("menuBar:horizontalLine",(()=>this._createButton(a.kS)))}_createButton(e){const t=this.editor,i=t.locale,o=t.commands.get("horizontalLine"),s=new e(t.locale),r=i.t;return s.set({label:r("Horizontal line"),icon:n.Pt.horizontalLine}),s.bind("isEnabled").to(o,"isEnabled"),this.listenTo(s,"execute",(()=>{t.execute("horizontalLine"),t.editing.view.focus()})),s}}class c extends n.k_{static get requires(){return[r,l,o.x0]}static get pluginName(){return"HorizontalLine"}}},9090:(e,t,i)=>{"use strict";i.r(t),i.d(t,{HtmlEmbed:()=>h,HtmlEmbedEditing:()=>c,HtmlEmbedUI:()=>u});var n=i(1204),o=i(5091),s=i(949),r=i(5318);class a extends n.uB{refresh(){const e=this.editor.model,t=e.schema,i=e.document.selection,n=l(i);this.isEnabled=function(e,t,i){const n=function(e,t){const i=(0,o.iB)(e,t).start.parent;return i.isEmpty&&!i.is("rootElement")?i.parent:i}(e,i);return t.checkChild(n,"rawHtml")}(i,t,e),this.value=n?n.getAttribute("value")||"":null}execute(e){const t=this.editor.model,i=t.document.selection;t.change((n=>{let o;null!==this.value?o=l(i):(o=n.createElement("rawHtml"),t.insertObject(o,null,null,{setSelection:"on"})),n.setAttribute("value",e,o)}))}}function l(e){const t=e.getSelectedElement();return t&&t.is("element","rawHtml")?t:null}class c extends n.k_{static get pluginName(){return"HtmlEmbedEditing"}constructor(e){super(e),this._widgetButtonViewReferences=new Set;const t=e.config.get("htmlEmbed.sanitizeHtml")||function(e){return(0,r.FF)("html-embed-provide-sanitize-function"),{html:e,hasChanged:!1}};e.config.define("sanitizeHtml",t),e.config.define("htmlEmbed.showPreviews",!1)}init(){const e=this.editor;e.model.schema.register("rawHtml",{inheritAllFrom:"$blockObject",allowAttributes:["value"]}),e.commands.add("htmlEmbed",new a(e)),this._setupConversion()}_setupConversion(){const e=this.editor,t=e.t,i=e.editing.view,n=this._widgetButtonViewReferences,s=e.config.get("htmlEmbed.showPreviews"),a=e.config.get("sanitizeHtml");function l({editor:e,domElement:i,state:o,props:s}){i.textContent="";const a=i.ownerDocument;let l;if(o.isEditable){const e={isDisabled:!1,placeholder:s.textareaPlaceholder};l=c({domDocument:a,state:o,props:e}),i.append(l)}else if(o.showPreviews){const n={sanitizeHtml:s.sanitizeHtml};i.append(function({editor:e,domDocument:i,state:n,props:o}){const s=o.sanitizeHtml(n.getRawHtmlValue()),a=n.getRawHtmlValue().length>0?t("No preview available"):t("Empty snippet content"),l=(0,r.n)(i,"div",{class:"ck ck-reset_all raw-html-embed__preview-placeholder"},a),c=(0,r.n)(i,"div",{class:"raw-html-embed__preview-content",dir:e.locale.contentLanguageDirection}),d=i.createRange().createContextualFragment(s.html);c.appendChild(d);return(0,r.n)(i,"div",{class:"raw-html-embed__preview"},[l,c])}({domDocument:a,state:o,props:n,editor:e}))}else{const e={isDisabled:!0,placeholder:s.textareaPlaceholder};i.append(c({domDocument:a,state:o,props:e}))}const u={onEditClick:s.onEditClick,onSaveClick:()=>{s.onSaveClick(l.value)},onCancelClick:s.onCancelClick};i.prepend(function({editor:e,domDocument:t,state:i,props:o}){const s=(0,r.n)(t,"div",{class:"raw-html-embed__buttons-wrapper"});if(i.isEditable){const t=d(e,"save",o.onSaveClick),i=d(e,"cancel",o.onCancelClick);s.append(t.element,i.element),n.add(t).add(i)}else{const t=d(e,"edit",o.onEditClick);s.append(t.element),n.add(t)}return s}({editor:e,domDocument:a,state:o,props:u}))}function c({domDocument:e,state:t,props:i}){const n=(0,r.n)(e,"textarea",{placeholder:i.placeholder,class:"ck ck-reset ck-input ck-input-text raw-html-embed__source"});return n.disabled=i.isDisabled,n.value=t.getRawHtmlValue(),n}this.editor.editing.view.on("render",(()=>{for(const e of n){if(e.element&&e.element.isConnected)return;e.destroy(),n.delete(e)}}),{priority:"lowest"}),e.data.registerRawContentMatcher({name:"div",classes:"raw-html-embed"}),e.conversion.for("upcast").elementToElement({view:{name:"div",classes:"raw-html-embed"},model:(e,{writer:t})=>t.createElement("rawHtml",{value:e.getCustomProperty("$rawContent")})}),e.conversion.for("dataDowncast").elementToElement({model:"rawHtml",view:(e,{writer:t})=>t.createRawElement("div",{class:"raw-html-embed"},(function(t){t.innerHTML=e.getAttribute("value")||""}))}),e.conversion.for("editingDowncast").elementToStructure({model:{name:"rawHtml",attributes:["value"]},view:(n,{writer:r})=>{let c,d,u;const h=r.createRawElement("div",{class:"raw-html-embed__content-wrapper"},(function(t){c=t,l({editor:e,domElement:t,state:d,props:u}),c.addEventListener("mousedown",(()=>{if(d.isEditable){const t=e.model;t.document.selection.getSelectedElement()!==n&&t.change((e=>e.setSelection(n,"on")))}}),!0)})),m={makeEditable(){d=Object.assign({},d,{isEditable:!0}),l({domElement:c,editor:e,state:d,props:u}),i.change((e=>{e.setAttribute("data-cke-ignore-events","true",h)})),c.querySelector("textarea").focus()},save(t){t!==d.getRawHtmlValue()?(e.execute("htmlEmbed",t),e.editing.view.focus()):this.cancel()},cancel(){d=Object.assign({},d,{isEditable:!1}),l({domElement:c,editor:e,state:d,props:u}),e.editing.view.focus(),i.change((e=>{e.removeAttribute("data-cke-ignore-events",h)}))}};d={showPreviews:s,isEditable:!1,getRawHtmlValue:()=>n.getAttribute("value")||""},u={sanitizeHtml:a,textareaPlaceholder:t("Paste raw HTML here..."),onEditClick(){m.makeEditable()},onSaveClick(e){m.save(e)},onCancelClick(){m.cancel()}};const g=r.createContainerElement("div",{class:"raw-html-embed","data-html-embed-label":t("HTML snippet"),dir:e.locale.uiLanguageDirection},h);return r.setCustomProperty("rawHtmlApi",m,g),r.setCustomProperty("rawHtml",!0,g),(0,o.Ex)(g,r,{label:t("HTML snippet"),hasSelectionHandle:!0})}})}}function d(e,t,i){const{t:o}=e.locale,r=new s._(e.locale),a=e.commands.get("htmlEmbed");return r.set({class:`raw-html-embed__${t}-button`,icon:n.Pt.pencil,tooltip:!0,tooltipPosition:"rtl"===e.locale.uiLanguageDirection?"e":"w"}),r.render(),"edit"===t?(r.set({icon:n.Pt.pencil,label:o("Edit source")}),r.bind("isEnabled").to(a)):"save"===t?(r.set({icon:n.Pt.check,label:o("Save changes")}),r.bind("isEnabled").to(a)):r.set({icon:n.Pt.cancel,label:o("Cancel")}),r.on("execute",i),r}class u extends n.k_{static get pluginName(){return"HtmlEmbedUI"}init(){const e=this.editor,t=e.locale.t;e.ui.componentFactory.add("htmlEmbed",(()=>{const e=this._createButton(s._);return e.set({tooltip:!0,label:t("Insert HTML")}),e})),e.ui.componentFactory.add("menuBar:htmlEmbed",(()=>{const e=this._createButton(s.kS);return e.set({label:t("HTML snippet")}),e}))}_createButton(e){const t=this.editor,i=t.commands.get("htmlEmbed"),o=new e(t.locale);return o.set({icon:n.Pt.html}),o.bind("isEnabled").to(i,"isEnabled"),this.listenTo(o,"execute",(()=>{t.execute("htmlEmbed"),t.editing.view.focus(),t.editing.view.document.selection.getSelectedElement().getCustomProperty("rawHtmlApi").makeEditable()})),o}}class h extends n.k_{static get requires(){return[c,u,o.x0]}static get pluginName(){return"HtmlEmbed"}}},5048:(e,t,i)=>{"use strict";i.r(t),i.d(t,{AutoImage:()=>v,Image:()=>H,ImageBlock:()=>D,ImageBlockEditing:()=>L,ImageCaption:()=>K,ImageCaptionEditing:()=>j,ImageCaptionUI:()=>q,ImageCaptionUtils:()=>U,ImageCustomResizeUI:()=>Me,ImageEditing:()=>R,ImageInline:()=>W,ImageInsert:()=>ue,ImageInsertUI:()=>N,ImageInsertViaUrl:()=>de,ImageResize:()=>Oe,ImageResizeButtons:()=>Ae,ImageResizeEditing:()=>ke,ImageResizeHandles:()=>Ie,ImageSizeAttributes:()=>B,ImageStyle:()=>Je,ImageStyleEditing:()=>Ue,ImageStyleUI:()=>qe,ImageTextAlternative:()=>x,ImageTextAlternativeEditing:()=>y,ImageTextAlternativeUI:()=>E,ImageToolbar:()=>Qe,ImageUpload:()=>ae,ImageUploadEditing:()=>se,ImageUploadProgress:()=>Y,ImageUploadUI:()=>J,ImageUtils:()=>p,PictureEditing:()=>Ye});var n=i(1204),o=i(7377),s=i(4133),r=i(6417),a=i(7211),l=i(5318),c=i(5091);function d(e){return e.createContainerElement("figure",{class:"image"},[e.createEmptyElement("img"),e.createSlot("children")])}function u(e,t){const i=e.plugins.get("ImageUtils"),n=e.plugins.has("ImageInlineEditing")&&e.plugins.has("ImageBlockEditing");return e=>i.isInlineImageView(e)?n&&("block"==e.getStyle("display")||e.findAncestor(i.isBlockImageView)?"imageBlock":"imageInline")!==t?null:o(e):null;function o(e){const t={name:!0};return e.hasAttribute("src")&&(t.attributes=["src"]),t}}function h(e,t){const i=(0,l.$1)(t.getSelectedBlocks());return!i||e.isObject(i)||i.isEmpty&&"listItem"!=i.name?"imageBlock":"imageInline"}function m(e){return e&&e.endsWith("px")?parseInt(e):null}function g(e){const t=m(e.getStyle("width")),i=m(e.getStyle("height"));return!(!t||!i)}const f=/^(image|image-inline)$/;class p extends n.k_{constructor(){super(...arguments),this._domEmitter=new((0,l.c5)())}static get pluginName(){return"ImageUtils"}isImage(e){return this.isInlineImage(e)||this.isBlockImage(e)}isInlineImageView(e){return!!e&&e.is("element","img")}isBlockImageView(e){return!!e&&e.is("element","figure")&&e.hasClass("image")}insertImage(e={},t=null,i=null,n={}){const o=this.editor,s=o.model,r=s.document.selection,a=b(o,t||r,i);e={...Object.fromEntries(r.getAttributes()),...e};for(const t in e)s.schema.checkAttribute(a,t)||delete e[t];return s.change((i=>{const{setImageSizes:o=!0}=n,r=i.createElement(a,e);return s.insertObject(r,t,null,{setSelection:"on",findOptimalPosition:t||"imageInline"==a?void 0:"auto"}),r.parent?(o&&this.setImageNaturalSizeAttributes(r),r):null}))}setImageNaturalSizeAttributes(e){const t=e.getAttribute("src");t&&(e.getAttribute("width")||e.getAttribute("height")||this.editor.model.change((i=>{const n=new l.Sf.window.Image;this._domEmitter.listenTo(n,"load",(()=>{e.getAttribute("width")||e.getAttribute("height")||this.editor.model.enqueueChange(i.batch,(t=>{t.setAttribute("width",n.naturalWidth,e),t.setAttribute("height",n.naturalHeight,e)})),this._domEmitter.stopListening(n,"load")})),n.src=t})))}getClosestSelectedImageWidget(e){const t=e.getFirstPosition();if(!t)return null;const i=e.getSelectedElement();if(i&&this.isImageWidget(i))return i;let n=t.parent;for(;n;){if(n.is("element")&&this.isImageWidget(n))return n;n=n.parent}return null}getClosestSelectedImageElement(e){const t=e.getSelectedElement();return this.isImage(t)?t:e.getFirstPosition().findAncestor("imageBlock")}getImageWidgetFromImageView(e){return e.findAncestor({classes:f})}isImageAllowed(){const e=this.editor.model.document.selection;return function(e,t){if("imageBlock"==b(e,t,null)){const i=function(e,t){const i=(0,c.iB)(e,t).start.parent;return i.isEmpty&&!i.is("element","$root")?i.parent:i}(t,e.model);if(e.model.schema.checkChild(i,"imageBlock"))return!0}else if(e.model.schema.checkChild(t.focus,"imageInline"))return!0;return!1}(this.editor,e)&&function(e){return[...e.focus.getAncestors()].every((e=>!e.is("element","imageBlock")))}(e)}toImageWidget(e,t,i){return t.setCustomProperty("image",!0,e),(0,c.Ex)(e,t,{label:()=>{const t=this.findViewImgElement(e).getAttribute("alt");return t?`${t} ${i}`:i}})}isImageWidget(e){return!!e.getCustomProperty("image")&&(0,c.p4)(e)}isBlockImage(e){return!!e&&e.is("element","imageBlock")}isInlineImage(e){return!!e&&e.is("element","imageInline")}findViewImgElement(e){if(this.isInlineImageView(e))return e;const t=this.editor.editing.view;for(const{item:i}of t.createRangeIn(e))if(this.isInlineImageView(i))return i}destroy(){return this._domEmitter.stopListening(),super.destroy()}}function b(e,t,i){const n=e.model.schema,o=e.config.get("image.insert.type");return e.plugins.has("ImageBlockEditing")?e.plugins.has("ImageInlineEditing")?i||("inline"===o?"imageInline":"auto"!==o?"imageBlock":t.is("selection")?h(n,t):n.checkChild(t,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}const w=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 v extends n.k_{static get requires(){return[o.B0,p,r.Vn,a.ep]}static get pluginName(){return"AutoImage"}constructor(e){super(e),this._timeoutId=null,this._positionToInsert=null}init(){const e=this.editor,t=e.model.document,i=e.plugins.get("ClipboardPipeline");this.listenTo(i,"inputTransformation",(()=>{const e=t.selection.getFirstRange(),i=s.m8.fromPosition(e.start);i.stickiness="toPrevious";const n=s.m8.fromPosition(e.end);n.stickiness="toNext",t.once("change:data",(()=>{this._embedImageBetweenPositions(i,n),i.detach(),n.detach()}),{priority:"high"})})),e.commands.get("undo").on("execute",(()=>{this._timeoutId&&(l.Sf.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)}),{priority:"high"})}_embedImageBetweenPositions(e,t){const i=this.editor,n=new s.Oo(e,t),o=n.getWalker({ignoreElementEnd:!0}),r=Object.fromEntries(i.model.document.selection.getAttributes()),a=this.editor.plugins.get("ImageUtils");let l="";for(const e of o)e.item.is("$textProxy")&&(l+=e.item.data);l=l.trim(),l.match(w)?(this._positionToInsert=s.m8.fromPosition(e),this._timeoutId=setTimeout((()=>{i.commands.get("insertImage").isEnabled?(i.model.change((e=>{let t;this._timeoutId=null,e.remove(n),n.detach(),"$graveyard"!==this._positionToInsert.root.rootName&&(t=this._positionToInsert.toPosition()),a.insertImage({...r,src:l},t),this._positionToInsert.detach(),this._positionToInsert=null})),i.plugins.get("Delete").requestUndoOnBackspace()):n.detach()}),100)):n.detach()}}class _ extends n.uB{refresh(){const e=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!e,this.isEnabled&&e.hasAttribute("alt")?this.value=e.getAttribute("alt"):this.value=!1}execute(e){const t=this.editor,i=t.plugins.get("ImageUtils"),n=t.model,o=i.getClosestSelectedImageElement(n.document.selection);n.change((t=>{t.setAttribute("alt",e.newValue,o)}))}}class y extends n.k_{static get requires(){return[p]}static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new _(this.editor))}}var k=i(949);class C extends k.Ss{constructor(e){super(e);const t=this.locale.t;this.focusTracker=new l.$x,this.keystrokes=new l.EP,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(t("Save"),n.Pt.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(t("Cancel"),n.Pt.cancel,"ck-button-cancel","cancel"),this._focusables=new k.s3,this._focusCycler=new k.H({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),(0,k.Z5)({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(e,t,i,n){const o=new k._(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o.extendTemplate({attributes:{class:i}}),n&&o.delegate("execute").to(this,n),o}_createLabeledInputView(){const e=this.locale.t,t=new k.xE(this.locale,k.Vr);return t.label=e("Text alternative"),t}}function A(e){const t=e.editing.view,i=k.Jr.defaultPositions,n=e.plugins.get("ImageUtils");return{target:t.domConverter.mapViewToDom(n.getClosestSelectedImageWidget(t.document.selection)),positions:[i.northArrowSouth,i.northArrowSouthWest,i.northArrowSouthEast,i.southArrowNorth,i.southArrowNorthWest,i.southArrowNorthEast,i.viewportStickyNorth]}}class E extends n.k_{static get requires(){return[k.pU]}static get pluginName(){return"ImageTextAlternativeUI"}init(){this._createButton()}destroy(){super.destroy(),this._form&&this._form.destroy()}_createButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("imageTextAlternative",(i=>{const o=e.commands.get("imageTextAlternative"),s=new k._(i);return s.set({label:t("Change image text alternative"),icon:n.Pt.textAlternative,tooltip:!0}),s.bind("isEnabled").to(o,"isEnabled"),s.bind("isOn").to(o,"value",(e=>!!e)),this.listenTo(s,"execute",(()=>{this._showForm()})),s}))}_createForm(){const e=this.editor,t=e.editing.view.document,i=e.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new((0,k.wi)(C))(e.locale),this._form.render(),this.listenTo(this._form,"submit",(()=>{e.execute("imageTextAlternative",{newValue:this._form.labeledInput.fieldView.element.value}),this._hideForm(!0)})),this.listenTo(this._form,"cancel",(()=>{this._hideForm(!0)})),this._form.keystrokes.set("Esc",((e,t)=>{this._hideForm(!0),t()})),this.listenTo(e.ui,"update",(()=>{i.getClosestSelectedImageWidget(t.selection)?this._isVisible&&function(e){const t=e.plugins.get("ContextualBalloon");if(e.plugins.get("ImageUtils").getClosestSelectedImageWidget(e.editing.view.document.selection)){const i=A(e);t.updatePosition(i)}}(e):this._hideForm(!0)})),(0,k.wy)({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;this._form||this._createForm();const e=this.editor,t=e.commands.get("imageTextAlternative"),i=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:A(e)}),i.fieldView.value=i.fieldView.element.value=t.value||"",this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(e=!1){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),e&&this.editor.editing.view.focus())}get _isVisible(){return!!this._balloon&&this._balloon.visibleView===this._form}get _isInBalloon(){return!!this._balloon&&this._balloon.hasView(this._form)}}class x extends n.k_{static get requires(){return[y,E]}static get pluginName(){return"ImageTextAlternative"}}function T(e,t){const i=(t,i,n)=>{if(!n.consumable.consume(i.item,t.name))return;const o=n.writer,s=n.mapper.toViewElement(i.item),r=e.findViewImgElement(s);null===i.attributeNewValue?(o.removeAttribute("srcset",r),o.removeAttribute("sizes",r)):i.attributeNewValue&&(o.setAttribute("srcset",i.attributeNewValue,r),o.setAttribute("sizes","100vw",r))};return e=>{e.on(`attribute:srcset:${t}`,i)}}function P(e,t,i){const n=(t,i,n)=>{if(!n.consumable.consume(i.item,t.name))return;const o=n.writer,s=n.mapper.toViewElement(i.item),r=e.findViewImgElement(s);o.setAttribute(i.attributeKey,i.attributeNewValue||"",r)};return e=>{e.on(`attribute:${i}:${t}`,n)}}class I extends s.nu{observe(e){this.listenTo(e,"load",((e,t)=>{const i=t.target;this.checkShouldIgnoreEventFromTarget(i)||"IMG"==i.tagName&&this._fireEvents(t)}),{useCapture:!0})}stopObserving(e){this.stopListening(e)}_fireEvents(e){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",e))}}class S extends n.uB{constructor(e){super(e);const t=e.config.get("image.insert.type");e.plugins.has("ImageBlockEditing")||"block"===t&&(0,l.FF)("image-block-plugin-required"),e.plugins.has("ImageInlineEditing")||"inline"===t&&(0,l.FF)("image-inline-plugin-required")}refresh(){const e=this.editor.plugins.get("ImageUtils");this.isEnabled=e.isImageAllowed()}execute(e){const t=(0,l.$r)(e.source),i=this.editor.model.document.selection,n=this.editor.plugins.get("ImageUtils"),o=Object.fromEntries(i.getAttributes());t.forEach(((e,t)=>{const s=i.getSelectedElement();if("string"==typeof e&&(e={src:e}),t&&s&&n.isImage(s)){const t=this.editor.model.createPositionAfter(s);n.insertImage({...e,...o},t)}else n.insertImage({...e,...o})}))}}class V extends n.uB{constructor(e){super(e),this.decorate("cleanupImage")}refresh(){const e=this.editor.plugins.get("ImageUtils"),t=this.editor.model.document.selection.getSelectedElement();this.isEnabled=e.isImage(t),this.value=this.isEnabled?t.getAttribute("src"):null}execute(e){const t=this.editor.model.document.selection.getSelectedElement(),i=this.editor.plugins.get("ImageUtils");this.editor.model.change((n=>{n.setAttribute("src",e.source,t),this.cleanupImage(n,t),i.setImageNaturalSizeAttributes(t)}))}cleanupImage(e,t){e.removeAttribute("srcset",t),e.removeAttribute("sizes",t),e.removeAttribute("sources",t),e.removeAttribute("width",t),e.removeAttribute("height",t),e.removeAttribute("alt",t)}}class R extends n.k_{static get requires(){return[p]}static get pluginName(){return"ImageEditing"}init(){const e=this.editor,t=e.conversion;e.editing.view.addObserver(I),t.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:"srcset"});const i=new S(e),n=new V(e);e.commands.add("insertImage",i),e.commands.add("replaceImageSource",n),e.commands.add("imageInsert",i)}}class B extends n.k_{static get requires(){return[p]}static get pluginName(){return"ImageSizeAttributes"}afterInit(){this._registerSchema(),this._registerConverters("imageBlock"),this._registerConverters("imageInline")}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:["width","height"]}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:["width","height"]})}_registerConverters(e){const t=this.editor,i=t.plugins.get("ImageUtils"),n="imageBlock"===e?"figure":"img";function o(t,n,o,s){t.on(`attribute:${n}:${e}`,((t,n,r)=>{if(!r.consumable.consume(n.item,t.name))return;const a=r.writer,l=r.mapper.toViewElement(n.item),c=i.findViewImgElement(l);if(null!==n.attributeNewValue?a.setAttribute(o,n.attributeNewValue,c):a.removeAttribute(o,c),n.item.hasAttribute("sources"))return;const d=n.item.hasAttribute("resizedWidth");if("imageInline"===e&&!d&&!s)return;const u=n.item.getAttribute("width"),h=n.item.getAttribute("height");u&&h&&a.setStyle("aspect-ratio",`${u}/${h}`,c)}))}t.conversion.for("upcast").attributeToAttribute({view:{name:n,styles:{width:/.+/}},model:{key:"width",value:e=>g(e)?m(e.getStyle("width")):null}}).attributeToAttribute({view:{name:n,key:"width"},model:"width"}).attributeToAttribute({view:{name:n,styles:{height:/.+/}},model:{key:"height",value:e=>g(e)?m(e.getStyle("height")):null}}).attributeToAttribute({view:{name:n,key:"height"},model:"height"}),t.conversion.for("editingDowncast").add((e=>{o(e,"width","width",!0),o(e,"height","height",!0)})),t.conversion.for("dataDowncast").add((e=>{o(e,"width","width",!1),o(e,"height","height",!1)}))}}class M extends n.uB{constructor(e,t){super(e),this._modelElementName=t}refresh(){const e=this.editor.plugins.get("ImageUtils"),t=e.getClosestSelectedImageElement(this.editor.model.document.selection);"imageBlock"===this._modelElementName?this.isEnabled=e.isInlineImage(t):this.isEnabled=e.isBlockImage(t)}execute(e={}){const t=this.editor,i=this.editor.model,n=t.plugins.get("ImageUtils"),o=n.getClosestSelectedImageElement(i.document.selection),s=Object.fromEntries(o.getAttributes());return s.src||s.uploadId?i.change((t=>{const{setImageSizes:r=!0}=e,a=Array.from(i.markers).filter((e=>e.getRange().containsItem(o))),l=n.insertImage(s,i.createSelection(o,"on"),this._modelElementName,{setImageSizes:r});if(!l)return null;const c=t.createRangeOn(l);for(const e of a){const i=e.getRange(),n="$graveyard"!=i.root.rootName?i.getJoined(c,!0):c;t.updateMarker(e,{range:n})}return{oldElement:o,newElement:l}})):null}}class O extends n.k_{static get requires(){return[p]}static get pluginName(){return"ImagePlaceholder"}afterInit(){this._setupSchema(),this._setupConversion(),this._setupLoadListener()}_setupSchema(){const e=this.editor.model.schema;e.isRegistered("imageBlock")&&e.extend("imageBlock",{allowAttributes:["placeholder"]}),e.isRegistered("imageInline")&&e.extend("imageInline",{allowAttributes:["placeholder"]})}_setupConversion(){const e=this.editor,t=e.conversion,i=e.plugins.get("ImageUtils");t.for("editingDowncast").add((e=>{e.on("attribute:placeholder",((e,t,n)=>{if(!n.consumable.test(t.item,e.name))return;if(!t.item.is("element","imageBlock")&&!t.item.is("element","imageInline"))return;n.consumable.consume(t.item,e.name);const o=n.writer,s=n.mapper.toViewElement(t.item),r=i.findViewImgElement(s);t.attributeNewValue?(o.addClass("image_placeholder",r),o.setStyle("background-image",`url(${t.attributeNewValue})`,r),o.setCustomProperty("editingPipeline:doNotReuseOnce",!0,r)):(o.removeClass("image_placeholder",r),o.removeStyle("background-image",r))}))}))}_setupLoadListener(){const e=this.editor,t=e.model,i=e.editing,n=i.view,o=e.plugins.get("ImageUtils");n.addObserver(I),this.listenTo(n.document,"imageLoaded",((e,s)=>{const r=n.domConverter.mapDomToView(s.target);if(!r)return;const a=o.getImageWidgetFromImageView(r);if(!a)return;const l=i.mapper.toModelElement(a);l&&l.hasAttribute("placeholder")&&t.enqueueChange({isUndoable:!1},(e=>{e.removeAttribute("placeholder",l)}))}))}}class L extends n.k_{static get requires(){return[R,B,p,O,o.xz]}static get pluginName(){return"ImageBlockEditing"}init(){const e=this.editor;e.model.schema.register("imageBlock",{inheritAllFrom:"$blockObject",allowAttributes:["alt","src","srcset"]}),this._setupConversion(),e.plugins.has("ImageInlineEditing")&&(e.commands.add("imageTypeBlock",new M(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,i=e.conversion,n=e.plugins.get("ImageUtils");i.for("dataDowncast").elementToStructure({model:"imageBlock",view:(e,{writer:t})=>d(t)}),i.for("editingDowncast").elementToStructure({model:"imageBlock",view:(e,{writer:i})=>n.toImageWidget(d(i),i,t("image widget"))}),i.for("downcast").add(P(n,"imageBlock","src")).add(P(n,"imageBlock","alt")).add(T(n,"imageBlock")),i.for("upcast").elementToElement({view:u(e,"imageBlock"),model:(e,{writer:t})=>t.createElement("imageBlock",e.hasAttribute("src")?{src:e.getAttribute("src")}:void 0)}).add(function(e){const t=(t,i,n)=>{if(!n.consumable.test(i.viewItem,{name:!0,classes:"image"}))return;const o=e.findViewImgElement(i.viewItem);if(!o||!n.consumable.test(o,{name:!0}))return;n.consumable.consume(i.viewItem,{name:!0,classes:"image"});const s=n.convertItem(o,i.modelCursor),r=(0,l.$1)(s.modelRange.getItems());r?(n.convertChildren(i.viewItem,r),n.updateConversionResult(r,i)):n.consumable.revert(i.viewItem,{name:!0,classes:"image"})};return e=>{e.on("element:figure",t)}}(n))}_setupClipboardIntegration(){const e=this.editor,t=e.model,i=e.editing.view,n=e.plugins.get("ImageUtils"),o=e.plugins.get("ClipboardPipeline");this.listenTo(o,"inputTransformation",((o,r)=>{const a=Array.from(r.content.getChildren());let l;if(!a.every(n.isInlineImageView))return;l=r.targetRanges?e.editing.mapper.toModelRange(r.targetRanges[0]):t.document.selection.getFirstRange();const c=t.createSelection(l);if("imageBlock"===h(t.schema,c)){const e=new s.Wq(i.document),t=a.map((t=>e.createElement("figure",{class:"image"},t)));r.content=e.createDocumentFragment(t)}})),this.listenTo(o,"contentInsertion",((e,i)=>{"paste"===i.method&&t.change((e=>{const t=e.createRangeIn(i.content);for(const e of t.getItems())e.is("element","imageBlock")&&n.setImageNaturalSizeAttributes(e)}))}))}}class F extends k.Ss{constructor(e,t=[]){super(e),this.focusTracker=new l.$x,this.keystrokes=new l.EP,this._focusables=new k.s3,this.children=this.createCollection(),this._focusCycler=new k.H({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});for(const e of t)this.children.add(e),this._focusables.add(e),e instanceof k.Kn&&this._focusables.addMany(e.children);this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-insert-form"],tabindex:-1},children:this.children})}render(){super.render(),(0,k.Z5)({view:this});for(const e of this._focusables)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element);const e=e=>e.stopPropagation();this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}}class N extends n.k_{static get pluginName(){return"ImageInsertUI"}static get requires(){return[p]}constructor(e){super(e),this._integrations=new Map,e.config.define("image.insert.integrations",["upload","assetManager","url"])}init(){const e=this.editor,t=e.model.document.selection,i=e.plugins.get("ImageUtils");this.set("isImageSelected",!1),this.listenTo(e.model.document,"change",(()=>{this.isImageSelected=i.isImage(t.getSelectedElement())}));const n=e=>this._createToolbarComponent(e);e.ui.componentFactory.add("insertImage",n),e.ui.componentFactory.add("imageInsert",n),e.ui.componentFactory.add("menuBar:insertImage",(e=>this._createMenuBarComponent(e)))}registerIntegration({name:e,observable:t,buttonViewCreator:i,formViewCreator:n,menuBarButtonViewCreator:o,requiresForm:s=!1}){this._integrations.has(e)&&(0,l.FF)("image-insert-integration-exists",{name:e}),this._integrations.set(e,{observable:t,buttonViewCreator:i,menuBarButtonViewCreator:o,formViewCreator:n,requiresForm:s})}_createToolbarComponent(e){const t=this.editor,i=e.t,n=this._prepareIntegrations();if(!n.length)return null;let o;const s=n[0];if(1==n.length){if(!s.requiresForm)return s.buttonViewCreator(!0);o=s.buttonViewCreator(!0)}else{const t=s.buttonViewCreator(!1);o=new k.AO(e,t),o.tooltip=!0,o.bind("label").to(this,"isImageSelected",(e=>i(e?"Replace image":"Insert image")))}const r=this.dropdownView=(0,k.yu)(e,o),a=n.map((({observable:e})=>"function"==typeof e?e():e));return r.bind("isEnabled").toMany(a,"isEnabled",((...e)=>e.some((e=>e)))),r.once("change:isOpen",(()=>{const e=n.map((({formViewCreator:e})=>e(1==n.length))),i=new F(t.locale,e);r.panelView.children.add(i)})),r}_createMenuBarComponent(e){const t=e.t,i=this._prepareIntegrations();if(!i.length)return null;let o;const s=i[0];if(1==i.length)o=s.menuBarButtonViewCreator(!0);else{o=new k.zj(e);const s=new k.BY(e);o.panelView.children.add(s),o.buttonView.set({icon:n.Pt.image,label:t("Image")});for(const t of i){const i=new k.I8(e,o),n=t.menuBarButtonViewCreator(!1);i.children.add(n),s.items.add(i)}}return o}_prepareIntegrations(){const e=this.editor.config.get("image.insert.integrations"),t=[];if(!e.length)return(0,l.FF)("image-insert-integrations-not-specified"),t;for(const i of e)this._integrations.has(i)?t.push(this._integrations.get(i)):["upload","assetManager","url"].includes(i)||(0,l.FF)("image-insert-unknown-integration",{item:i});return t.length||(0,l.FF)("image-insert-integrations-not-registered"),t}}class D extends n.k_{static get requires(){return[L,c.x0,x,N]}static get pluginName(){return"ImageBlock"}}class z extends n.k_{static get requires(){return[R,B,p,O,o.xz]}static get pluginName(){return"ImageInlineEditing"}init(){const e=this.editor;e.model.schema.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"],disallowIn:["caption"]}),this._setupConversion(),e.plugins.has("ImageBlockEditing")&&(e.commands.add("imageTypeInline",new M(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,i=e.conversion,n=e.plugins.get("ImageUtils");i.for("dataDowncast").elementToElement({model:"imageInline",view:(e,{writer:t})=>t.createEmptyElement("img")}),i.for("editingDowncast").elementToStructure({model:"imageInline",view:(e,{writer:i})=>n.toImageWidget(function(e){return e.createContainerElement("span",{class:"image-inline"},e.createEmptyElement("img"))}(i),i,t("image widget"))}),i.for("downcast").add(P(n,"imageInline","src")).add(P(n,"imageInline","alt")).add(T(n,"imageInline")),i.for("upcast").elementToElement({view:u(e,"imageInline"),model:(e,{writer:t})=>t.createElement("imageInline",e.hasAttribute("src")?{src:e.getAttribute("src")}:void 0)})}_setupClipboardIntegration(){const e=this.editor,t=e.model,i=e.editing.view,n=e.plugins.get("ImageUtils"),o=e.plugins.get("ClipboardPipeline");this.listenTo(o,"inputTransformation",((o,r)=>{const a=Array.from(r.content.getChildren());let l;if(!a.every(n.isBlockImageView))return;l=r.targetRanges?e.editing.mapper.toModelRange(r.targetRanges[0]):t.document.selection.getFirstRange();const c=t.createSelection(l);if("imageInline"===h(t.schema,c)){const e=new s.Wq(i.document),t=a.map((t=>1===t.childCount?(Array.from(t.getAttributes()).forEach((i=>e.setAttribute(...i,n.findViewImgElement(t)))),t.getChild(0)):t));r.content=e.createDocumentFragment(t)}})),this.listenTo(o,"contentInsertion",((e,i)=>{"paste"===i.method&&t.change((e=>{const t=e.createRangeIn(i.content);for(const e of t.getItems())e.is("element","imageInline")&&n.setImageNaturalSizeAttributes(e)}))}))}}class W extends n.k_{static get requires(){return[z,c.x0,x,N]}static get pluginName(){return"ImageInline"}}class H extends n.k_{static get requires(){return[D,W]}static get pluginName(){return"Image"}}class U extends n.k_{static get pluginName(){return"ImageCaptionUtils"}static get requires(){return[p]}getCaptionFromImageModelElement(e){for(const t of e.getChildren())if(t&&t.is("element","caption"))return t;return null}getCaptionFromModelSelection(e){const t=this.editor.plugins.get("ImageUtils"),i=e.getFirstPosition().findAncestor("caption");return i&&t.isBlockImage(i.parent)?i:null}matchImageCaptionViewElement(e){const t=this.editor.plugins.get("ImageUtils");return"figcaption"==e.name&&t.isBlockImageView(e.parent)?{name:!0}:null}}class $ extends n.uB{refresh(){const e=this.editor,t=e.plugins.get("ImageCaptionUtils"),i=e.plugins.get("ImageUtils");if(!e.plugins.has(L))return this.isEnabled=!1,void(this.value=!1);const n=e.model.document.selection,o=n.getSelectedElement();if(!o){const e=t.getCaptionFromModelSelection(n);return this.isEnabled=!!e,void(this.value=!!e)}this.isEnabled=i.isImage(o),this.isEnabled?this.value=!!t.getCaptionFromImageModelElement(o):this.value=!1}execute(e={}){const{focusCaptionOnShow:t}=e;this.editor.model.change((e=>{this.value?this._hideImageCaption(e):this._showImageCaption(e,t)}))}_showImageCaption(e,t){const i=this.editor.model.document.selection,n=this.editor.plugins.get("ImageCaptionEditing"),o=this.editor.plugins.get("ImageUtils");let s=i.getSelectedElement();const r=n._getSavedCaption(s);o.isInlineImage(s)&&(this.editor.execute("imageTypeBlock"),s=i.getSelectedElement());const a=r||e.createElement("caption");e.append(a,s),t&&e.setSelection(a,"in")}_hideImageCaption(e){const t=this.editor,i=t.model.document.selection,n=t.plugins.get("ImageCaptionEditing"),o=t.plugins.get("ImageCaptionUtils");let s,r=i.getSelectedElement();r?s=o.getCaptionFromImageModelElement(r):(s=o.getCaptionFromModelSelection(i),r=s.parent),n._saveCaption(r,s),e.setSelection(r,"on"),e.remove(s)}}class j extends n.k_{static get requires(){return[p,U]}static get pluginName(){return"ImageCaptionEditing"}constructor(e){super(e),this._savedCaptionsMap=new WeakMap}init(){const e=this.editor,t=e.model.schema;t.isRegistered("caption")?t.extend("caption",{allowIn:"imageBlock"}):t.register("caption",{allowIn:"imageBlock",allowContentOf:"$block",isLimit:!0}),e.commands.add("toggleImageCaption",new $(this.editor)),this._setupConversion(),this._setupImageTypeCommandsIntegration(),this._registerCaptionReconversion()}_setupConversion(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageUtils"),n=e.plugins.get("ImageCaptionUtils"),o=e.t;e.conversion.for("upcast").elementToElement({view:e=>n.matchImageCaptionViewElement(e),model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(e,{writer:t})=>i.isBlockImage(e.parent)?t.createContainerElement("figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(e,{writer:n})=>{if(!i.isBlockImage(e.parent))return null;const r=n.createEditableElement("figcaption");n.setCustomProperty("imageCaption",!0,r),r.placeholder=o("Enter image caption"),(0,s.JT)({view:t,element:r,keepOnFocus:!0});const a=e.parent.getAttribute("alt"),l=a?o("Caption for image: %0",[a]):o("Caption for the image");return(0,c.YN)(r,n,{label:l})}})}_setupImageTypeCommandsIntegration(){const e=this.editor,t=e.plugins.get("ImageUtils"),i=e.plugins.get("ImageCaptionUtils"),n=e.commands.get("imageTypeInline"),o=e.commands.get("imageTypeBlock"),s=e=>{if(!e.return)return;const{oldElement:n,newElement:o}=e.return;if(!n)return;if(t.isBlockImage(n)){const e=i.getCaptionFromImageModelElement(n);if(e)return void this._saveCaption(o,e)}const s=this._getSavedCaption(n);s&&this._saveCaption(o,s)};n&&this.listenTo(n,"execute",s,{priority:"low"}),o&&this.listenTo(o,"execute",s,{priority:"low"})}_getSavedCaption(e){const t=this._savedCaptionsMap.get(e);return t?s.Hg.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON())}_registerCaptionReconversion(){const e=this.editor,t=e.model,i=e.plugins.get("ImageUtils"),n=e.plugins.get("ImageCaptionUtils");t.document.on("change:data",(()=>{const o=t.document.differ.getChanges();for(const t of o){if("alt"!==t.attributeKey)continue;const o=t.range.start.nodeAfter;if(i.isBlockImage(o)){const t=n.getCaptionFromImageModelElement(o);if(!t)return;e.editing.reconvertItem(t)}}}))}}class q extends n.k_{static get requires(){return[U]}static get pluginName(){return"ImageCaptionUI"}init(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageCaptionUtils"),o=e.t;e.ui.componentFactory.add("toggleImageCaption",(s=>{const r=e.commands.get("toggleImageCaption"),a=new k._(s);return a.set({icon:n.Pt.caption,tooltip:!0,isToggleable:!0}),a.bind("isOn","isEnabled").to(r,"value","isEnabled"),a.bind("label").to(r,"value",(e=>o(e?"Toggle caption off":"Toggle caption on"))),this.listenTo(a,"execute",(()=>{e.execute("toggleImageCaption",{focusCaptionOnShow:!0});const n=i.getCaptionFromModelSelection(e.model.document.selection);if(n){const i=e.editing.mapper.toViewElement(n);t.scrollToTheSelection(),t.change((e=>{e.addClass("image__caption_highlighted",i)}))}e.editing.view.focus()})),a}))}}class K extends n.k_{static get requires(){return[j,q]}static get pluginName(){return"ImageCaption"}}function G(e){const t=e.map((e=>e.replace("+","\\+")));return new RegExp(`^image\\/(${t.join("|")})$`)}function Z(e,t){return e.type?e.type:t.match(/data:(image\/\w+);base64/)?t.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}class J extends n.k_{static get pluginName(){return"ImageUploadUI"}init(){const e=this.editor;e.ui.componentFactory.add("uploadImage",(()=>this._createToolbarButton())),e.ui.componentFactory.add("imageUpload",(()=>this._createToolbarButton())),e.ui.componentFactory.add("menuBar:uploadImage",(()=>this._createMenuBarButton("standalone"))),e.plugins.has("ImageInsertUI")&&e.plugins.get("ImageInsertUI").registerIntegration({name:"upload",observable:()=>e.commands.get("uploadImage"),buttonViewCreator:()=>this._createToolbarButton(),formViewCreator:()=>this._createDropdownButton(),menuBarButtonViewCreator:e=>this._createMenuBarButton(e?"insertOnly":"insertNested")})}_createButton(e){const t=this.editor,i=t.locale,o=t.commands.get("uploadImage"),s=t.config.get("image.upload.types"),r=G(s),a=new e(t.locale),l=i.t;return a.set({acceptedType:s.map((e=>`image/${e}`)).join(","),allowMultipleFiles:!0,label:l("Upload from computer"),icon:n.Pt.imageUpload}),a.bind("isEnabled").to(o),a.on("done",((e,i)=>{const n=Array.from(i).filter((e=>r.test(e.type)));n.length&&(t.execute("uploadImage",{file:n}),t.editing.view.focus())})),a}_createToolbarButton(){const e=this.editor.locale.t,t=this.editor.plugins.get("ImageInsertUI"),i=this.editor.commands.get("uploadImage"),n=this._createButton(k.eF);return n.tooltip=!0,n.bind("label").to(t,"isImageSelected",i,"isAccessAllowed",((t,i)=>e(i?t?"Replace image from computer":"Upload image from computer":"You have no image upload permissions."))),n}_createDropdownButton(){const e=this.editor.locale.t,t=this.editor.plugins.get("ImageInsertUI"),i=this._createButton(k.eF);return i.withText=!0,i.bind("label").to(t,"isImageSelected",(t=>e(t?"Replace from computer":"Upload from computer"))),i.on("execute",(()=>{t.dropdownView.isOpen=!1})),i}_createMenuBarButton(e){const t=this.editor.locale.t,i=this._createButton(k.GG);switch(i.withText=!0,e){case"standalone":i.label=t("Image from computer");break;case"insertOnly":i.label=t("Image");break;case"insertNested":i.label=t("From computer")}return i}}var Q=i(4857);class Y extends n.k_{static get pluginName(){return"ImageUploadProgress"}constructor(e){super(e),this.uploadStatusChange=(e,t,i)=>{const n=this.editor,o=t.item,s=o.getAttribute("uploadId");if(!i.consumable.consume(t.item,e.name))return;const r=n.plugins.get("ImageUtils"),a=n.plugins.get(Q.FileRepository),l=s?t.attributeNewValue:null,c=this.placeholder,d=n.editing.mapper.toViewElement(o),u=i.writer;if("reading"==l)return X(d,u),void ee(r,c,d,u);if("uploading"==l){const e=a.loaders.get(s);return X(d,u),void(e?(te(d,u),function(e,t,i,n){const o=function(e){const t=e.createUIElement("div",{class:"ck-progress-bar"});return e.setCustomProperty("progressBar",!0,t),t}(t);t.insert(t.createPositionAt(e,"end"),o),i.on("change:uploadedPercent",((e,t,i)=>{n.change((e=>{e.setStyle("width",i+"%",o)}))}))}(d,u,e,n.editing.view),function(e,t,i,n){if(n.data){const o=e.findViewImgElement(t);i.setAttribute("src",n.data,o)}}(r,d,u,e)):ee(r,c,d,u))}"complete"==l&&a.loaders.get(s)&&function(e,t,i){const n=t.createUIElement("div",{class:"ck-image-upload-complete-icon"});t.insert(t.createPositionAt(e,"end"),n),setTimeout((()=>{i.change((e=>e.remove(e.createRangeOn(n))))}),3e3)}(d,u,n.editing.view),function(e,t){ne(e,t,"progressBar")}(d,u),te(d,u),function(e,t){t.removeClass("ck-appear",e)}(d,u)},this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}init(){const e=this.editor;e.plugins.has("ImageBlockEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageBlock",this.uploadStatusChange),e.plugins.has("ImageInlineEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageInline",this.uploadStatusChange)}}function X(e,t){e.hasClass("ck-appear")||t.addClass("ck-appear",e)}function ee(e,t,i,n){i.hasClass("ck-image-upload-placeholder")||n.addClass("ck-image-upload-placeholder",i);const o=e.findViewImgElement(i);o.getAttribute("src")!==t&&n.setAttribute("src",t,o),ie(i,"placeholder")||n.insert(n.createPositionAfter(o),function(e){const t=e.createUIElement("div",{class:"ck-upload-placeholder-loader"});return e.setCustomProperty("placeholder",!0,t),t}(n))}function te(e,t){e.hasClass("ck-image-upload-placeholder")&&t.removeClass("ck-image-upload-placeholder",e),ne(e,t,"placeholder")}function ie(e,t){for(const i of e.getChildren())if(i.getCustomProperty(t))return i}function ne(e,t,i){const n=ie(e,i);n&&t.remove(t.createRangeOn(n))}class oe extends n.uB{constructor(e){super(e),this.set("isAccessAllowed",!0)}refresh(){const e=this.editor,t=e.plugins.get("ImageUtils"),i=e.model.document.selection.getSelectedElement();this.isEnabled=t.isImageAllowed()||t.isImage(i)}execute(e){const t=(0,l.$r)(e.file),i=this.editor.model.document.selection,n=this.editor.plugins.get("ImageUtils"),o=Object.fromEntries(i.getAttributes());t.forEach(((e,t)=>{const s=i.getSelectedElement();if(t&&s&&n.isImage(s)){const t=this.editor.model.createPositionAfter(s);this._uploadImage(e,o,t)}else this._uploadImage(e,o)}))}_uploadImage(e,t,i){const n=this.editor,o=n.plugins.get(Q.FileRepository).createLoader(e),s=n.plugins.get("ImageUtils");o&&s.insertImage({...t,uploadId:o.id},i)}}class se extends n.k_{static get requires(){return[Q.FileRepository,k.Eg,o.xz,p]}static get pluginName(){return"ImageUploadEditing"}constructor(e){super(e),e.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}init(){const e=this.editor,t=e.model.document,i=e.conversion,n=e.plugins.get(Q.FileRepository),o=e.plugins.get("ImageUtils"),r=e.plugins.get("ClipboardPipeline"),a=G(e.config.get("image.upload.types")),c=new oe(e);e.commands.add("uploadImage",c),e.commands.add("imageUpload",c),i.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(e.editing.view.document,"clipboardInput",((t,i)=>{if(n=i.dataTransfer,Array.from(n.types).includes("text/html")&&""!==n.getData("text/html"))return;var n;const o=Array.from(i.dataTransfer.files).filter((e=>!!e&&a.test(e.type)));if(o.length&&(t.stop(),e.model.change((t=>{i.targetRanges&&t.setSelection(i.targetRanges.map((t=>e.editing.mapper.toModelRange(t)))),e.execute("uploadImage",{file:o})})),!e.commands.get("uploadImage").isAccessAllowed)){const t=e.plugins.get("Notification"),i=e.locale.t;t.showWarning(i("You have no image upload permissions."),{namespace:"image"})}})),this.listenTo(r,"inputTransformation",((t,i)=>{const r=Array.from(e.editing.view.createRangeIn(i.content)).map((e=>e.item)).filter((e=>function(e,t){return!(!e.isInlineImageView(t)||!t.getAttribute("src")||!t.getAttribute("src").match(/^data:image\/\w+;base64,/g)&&!t.getAttribute("src").match(/^blob:/g))}(o,e)&&!e.getAttribute("uploadProcessed"))).map((e=>{return{promise:(t=e,new Promise(((e,i)=>{const n=t.getAttribute("src");fetch(n).then((e=>e.blob())).then((t=>{const i=Z(t,n),o=i.replace("image/",""),s=new File([t],`image.${o}`,{type:i});e(s)})).catch((t=>t&&"TypeError"===t.name?function(e){return function(e){return new Promise(((t,i)=>{const n=l.Sf.document.createElement("img");n.addEventListener("load",(()=>{const e=l.Sf.document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0),e.toBlob((e=>e?t(e):i()))})),n.addEventListener("error",(()=>i())),n.src=e}))}(e).then((t=>{const i=Z(t,e),n=i.replace("image/","");return new File([t],`image.${n}`,{type:i})}))}(n).then(e).catch(i):i(t)))}))),imageElement:e};var t}));if(!r.length)return;const a=new s.Wq(e.editing.view.document);for(const e of r){a.setAttribute("uploadProcessed",!0,e.imageElement);const t=n.createLoader(e.promise);t&&(a.setAttribute("src","",e.imageElement),a.setAttribute("uploadId",t.id,e.imageElement))}})),e.editing.view.document.on("dragover",((e,t)=>{t.preventDefault()})),t.on("change",(()=>{const i=t.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),o=new Set;for(const t of i)if("insert"==t.type&&"$text"!=t.name){const i=t.position.nodeAfter,s="$graveyard"==t.position.root.rootName;for(const t of re(e,i)){const e=t.getAttribute("uploadId");if(!e)continue;const i=n.loaders.get(e);i&&(s?o.has(e)||i.abort():(o.add(e),this._uploadImageElements.set(e,t),"idle"==i.status&&this._readAndUpload(i)))}}})),this.on("uploadComplete",((e,{imageElement:t,data:i})=>{const n=i.urls?i.urls:i;this.editor.model.change((e=>{e.setAttribute("src",n.default,t),this._parseAndSetSrcsetAttributeOnImage(n,t,e),o.setImageNaturalSizeAttributes(t)}))}),{priority:"low"})}afterInit(){const e=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&e.extend("imageBlock",{allowAttributes:["uploadId","uploadStatus"]}),this.editor.plugins.has("ImageInlineEditing")&&e.extend("imageInline",{allowAttributes:["uploadId","uploadStatus"]})}_readAndUpload(e){const t=this.editor,i=t.model,n=t.locale.t,o=t.plugins.get(Q.FileRepository),s=t.plugins.get(k.Eg),r=t.plugins.get("ImageUtils"),a=this._uploadImageElements;return i.enqueueChange({isUndoable:!1},(t=>{t.setAttribute("uploadStatus","reading",a.get(e.id))})),e.read().then((()=>{const o=e.upload(),s=a.get(e.id);if(l._K.isSafari){const e=t.editing.mapper.toViewElement(s),i=r.findViewImgElement(e);t.editing.view.once("render",(()=>{if(!i.parent)return;const e=t.editing.view.domConverter.mapViewToDom(i.parent);if(!e)return;const n=e.style.display;e.style.display="none",e._ckHack=e.offsetHeight,e.style.display=n}))}return t.ui&&t.ui.ariaLiveAnnouncer.announce(n("Uploading image")),i.enqueueChange({isUndoable:!1},(e=>{e.setAttribute("uploadStatus","uploading",s)})),o})).then((o=>{i.enqueueChange({isUndoable:!1},(i=>{const s=a.get(e.id);i.setAttribute("uploadStatus","complete",s),t.ui&&t.ui.ariaLiveAnnouncer.announce(n("Image upload complete")),this.fire("uploadComplete",{data:o,imageElement:s})})),c()})).catch((o=>{if(t.ui&&t.ui.ariaLiveAnnouncer.announce(n("Error during image upload")),"error"!==e.status&&"aborted"!==e.status)throw o;"error"==e.status&&o&&s.showWarning(o,{title:n("Upload failed"),namespace:"upload"}),i.enqueueChange({isUndoable:!1},(t=>{t.remove(a.get(e.id))})),c()}));function c(){i.enqueueChange({isUndoable:!1},(t=>{const i=a.get(e.id);t.removeAttribute("uploadId",i),t.removeAttribute("uploadStatus",i),a.delete(e.id)})),o.destroyLoader(e)}}_parseAndSetSrcsetAttributeOnImage(e,t,i){let n=0;const o=Object.keys(e).filter((e=>{const t=parseInt(e,10);if(!isNaN(t))return n=Math.max(n,t),!0})).map((t=>`${e[t]} ${t}w`)).join(", ");if(""!=o){const e={srcset:o};t.hasAttribute("width")||t.hasAttribute("height")||(e.width=n),i.setAttributes(e,t)}}}function re(e,t){const i=e.plugins.get("ImageUtils");return Array.from(e.model.createRangeOn(t)).filter((e=>i.isImage(e.item))).map((e=>e.item))}class ae extends n.k_{static get pluginName(){return"ImageUpload"}static get requires(){return[se,J,Y]}}class le extends k.Ss{constructor(e){super(e),this.set("imageURLInputValue",""),this.set("isImageSelected",!1),this.set("isEnabled",!0),this.keystrokes=new l.EP,this.urlInputView=this._createUrlInputView(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-image-insert-url"]},children:[this.urlInputView,{tag:"div",attributes:{class:["ck","ck-image-insert-url__action-row"]}}]})}render(){super.render(),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.keystrokes.destroy()}_createUrlInputView(){const e=this.locale,t=e.t,i=new k.xE(e,k.Vr);return i.bind("label").to(this,"isImageSelected",(e=>t(e?"Update image URL":"Insert image via URL"))),i.bind("isEnabled").to(this),i.fieldView.inputMode="url",i.fieldView.placeholder="https://example.com/image.png",i.fieldView.bind("value").to(this,"imageURLInputValue",(e=>e||"")),i.fieldView.on("input",(()=>{this.imageURLInputValue=i.fieldView.element.value.trim()})),i}focus(){this.urlInputView.focus()}}class ce extends n.k_{static get pluginName(){return"ImageInsertViaUrlUI"}static get requires(){return[N,k.lG]}init(){this.editor.ui.componentFactory.add("insertImageViaUrl",(()=>this._createToolbarButton())),this.editor.ui.componentFactory.add("menuBar:insertImageViaUrl",(()=>this._createMenuBarButton("standalone")))}afterInit(){this._imageInsertUI=this.editor.plugins.get("ImageInsertUI"),this._imageInsertUI.registerIntegration({name:"url",observable:()=>this.editor.commands.get("insertImage"),buttonViewCreator:()=>this._createToolbarButton(),formViewCreator:()=>this._createDropdownButton(),menuBarButtonViewCreator:e=>this._createMenuBarButton(e?"insertOnly":"insertNested")})}_createInsertUrlButton(e){const t=new e(this.editor.locale);return t.icon=n.Pt.imageUrl,t.on("execute",(()=>{this._showModal()})),t}_createToolbarButton(){const e=this.editor.locale.t,t=this._createInsertUrlButton(k._);return t.tooltip=!0,t.bind("label").to(this._imageInsertUI,"isImageSelected",(t=>e(t?"Update image URL":"Insert image via URL"))),t}_createDropdownButton(){const e=this.editor.locale.t,t=this._createInsertUrlButton(k._);return t.withText=!0,t.bind("label").to(this._imageInsertUI,"isImageSelected",(t=>e(t?"Update image URL":"Insert via URL"))),t}_createMenuBarButton(e){const t=this.editor.locale.t,i=this._createInsertUrlButton(k.kS);switch(i.withText=!0,e){case"standalone":i.label=t("Image via URL");break;case"insertOnly":i.label=t("Image");break;case"insertNested":i.label=t("Via URL")}return i}_createInsertUrlView(){const e=this.editor,t=e.locale,i=e.commands.get("replaceImageSource"),n=e.commands.get("insertImage"),o=new le(t);return o.bind("isImageSelected").to(this._imageInsertUI),o.bind("isEnabled").toMany([n,i],"isEnabled",((...e)=>e.some((e=>e)))),o}_showModal(){const e=this.editor,t=e.locale.t,i=e.plugins.get("Dialog");this._formView||(this._formView=this._createInsertUrlView(),this._formView.on("submit",(()=>this._handleSave())));const n=e.commands.get("replaceImageSource");this._formView.imageURLInputValue=n.value||"",i.show({id:"insertImageViaUrl",title:this._imageInsertUI.isImageSelected?t("Update image URL"):t("Insert image via URL"),isModal:!0,content:this._formView,actionButtons:[{label:t("Cancel"),withText:!0,onExecute:()=>i.hide()},{label:t("Accept"),class:"ck-button-action",withText:!0,onExecute:()=>this._handleSave()}]})}_handleSave(){this.editor.commands.get("replaceImageSource").isEnabled?this.editor.execute("replaceImageSource",{source:this._formView.imageURLInputValue}):this.editor.execute("insertImage",{source:this._formView.imageURLInputValue}),this.editor.plugins.get("Dialog").hide()}}class de extends n.k_{static get pluginName(){return"ImageInsertViaUrl"}static get requires(){return[ce,N]}}class ue extends n.k_{static get pluginName(){return"ImageInsert"}static get requires(){return[ae,de,N]}}var he=i(5572),me=i(5396),ge=i(9841),fe=i(8446);const pe=(be=ge.A,function(e,t){if(null==e)return e;if(!(0,fe.A)(e))return be(e,t);for(var i=e.length,n=-1,o=Object(e);++n<i&&!1!==t(o[n],n,o););return e});var be;const we=function(e,t){var i=-1,n=(0,fe.A)(e)?Array(e.length):[];return pe(e,(function(e,o,s){n[++i]=t(e,o,s)})),n};var ve=i(2049);const _e=function(e,t){return((0,ve.A)(e)?he.A:we)(e,(0,me.A)(t,3))};class ye extends n.uB{refresh(){const e=this.editor,t=e.plugins.get("ImageUtils").getClosestSelectedImageElement(e.model.document.selection);this.isEnabled=!!t,t&&t.hasAttribute("resizedWidth")?this.value={width:t.getAttribute("resizedWidth"),height:null}:this.value=null}execute(e){const t=this.editor,i=t.model,n=t.plugins.get("ImageUtils"),o=n.getClosestSelectedImageElement(i.document.selection);this.value={width:e.width,height:null},o&&i.change((t=>{t.setAttribute("resizedWidth",e.width,o),t.removeAttribute("resizedHeight",o),n.setImageNaturalSizeAttributes(o)}))}}class ke extends n.k_{static get requires(){return[p]}static get pluginName(){return"ImageResizeEditing"}constructor(e){super(e),e.config.define("image",{resizeUnit:"%",resizeOptions:[{name:"resizeImage:original",value:null,icon:"original"},{name:"resizeImage:custom",value:"custom",icon:"custom"},{name:"resizeImage:25",value:"25",icon:"small"},{name:"resizeImage:50",value:"50",icon:"medium"},{name:"resizeImage:75",value:"75",icon:"large"}]})}init(){const e=this.editor,t=new ye(e);this._registerConverters("imageBlock"),this._registerConverters("imageInline"),e.commands.add("resizeImage",t),e.commands.add("imageResize",t)}afterInit(){this._registerSchema()}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:["resizedWidth","resizedHeight"]}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:["resizedWidth","resizedHeight"]})}_registerConverters(e){const t=this.editor,i=t.plugins.get("ImageUtils");t.conversion.for("downcast").add((t=>t.on(`attribute:resizedWidth:${e}`,((e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const n=i.writer,o=i.mapper.toViewElement(t.item);null!==t.attributeNewValue?(n.setStyle("width",t.attributeNewValue,o),n.addClass("image_resized",o)):(n.removeStyle("width",o),n.removeClass("image_resized",o))})))),t.conversion.for("dataDowncast").attributeToAttribute({model:{name:e,key:"resizedHeight"},view:e=>({key:"style",value:{height:e}})}),t.conversion.for("editingDowncast").add((t=>t.on(`attribute:resizedHeight:${e}`,((t,n,o)=>{if(!o.consumable.consume(n.item,t.name))return;const s=o.writer,r=o.mapper.toViewElement(n.item),a="imageInline"===e?i.findViewImgElement(r):r;null!==n.attributeNewValue?s.setStyle("height",n.attributeNewValue,a):s.removeStyle("height",a)})))),t.conversion.for("upcast").attributeToAttribute({view:{name:"imageBlock"===e?"figure":"img",styles:{width:/.+/}},model:{key:"resizedWidth",value:e=>g(e)?null:e.getStyle("width")}}),t.conversion.for("upcast").attributeToAttribute({view:{name:"imageBlock"===e?"figure":"img",styles:{height:/.+/}},model:{key:"resizedHeight",value:e=>g(e)?null:e.getStyle("height")}})}}const Ce=(()=>({small:n.Pt.objectSizeSmall,medium:n.Pt.objectSizeMedium,large:n.Pt.objectSizeLarge,custom:n.Pt.objectSizeCustom,original:n.Pt.objectSizeFull}))();class Ae extends n.k_{static get requires(){return[ke]}static get pluginName(){return"ImageResizeButtons"}constructor(e){super(e),this._resizeUnit=e.config.get("image.resizeUnit")}init(){const e=this.editor,t=e.config.get("image.resizeOptions"),i=e.commands.get("resizeImage");this.bind("isEnabled").to(i);for(const e of t)this._registerImageResizeButton(e);this._registerImageResizeDropdown(t)}_registerImageResizeButton(e){const t=this.editor,{name:i,value:n,icon:o}=e;t.ui.componentFactory.add(i,(i=>{const s=new k._(i),r=t.commands.get("resizeImage"),a=this._getOptionLabelValue(e,!0);if(!Ce[o])throw new l.Yb("imageresizebuttons-missing-icon",t,e);if(s.set({label:a,icon:Ce[o],tooltip:a,isToggleable:!0}),s.bind("isEnabled").to(this),t.plugins.has("ImageCustomResizeUI")&&Ee(e)){const e=t.plugins.get("ImageCustomResizeUI");this.listenTo(s,"execute",(()=>{e._showForm(this._resizeUnit)}))}else{const e=n?n+this._resizeUnit:null;s.bind("isOn").to(r,"value",xe(e)),this.listenTo(s,"execute",(()=>{t.execute("resizeImage",{width:e})}))}return s}))}_registerImageResizeDropdown(e){const t=this.editor,i=t.t,n=e.find((e=>!e.value)),o=o=>{const s=t.commands.get("resizeImage"),r=(0,k.yu)(o,k.lU),a=r.buttonView,l=i("Resize image");return a.set({tooltip:l,commandValue:n.value,icon:Ce.medium,isToggleable:!0,label:this._getOptionLabelValue(n),withText:!0,class:"ck-resize-image-button",ariaLabel:l,ariaLabelledBy:void 0}),a.bind("label").to(s,"value",(e=>e&&e.width?e.width:this._getOptionLabelValue(n))),r.bind("isEnabled").to(this),(0,k.O)(r,(()=>this._getResizeDropdownListItemDefinitions(e,s)),{ariaLabel:i("Image resize list"),role:"menu"}),this.listenTo(r,"execute",(e=>{"onClick"in e.source?e.source.onClick():(t.execute(e.source.commandName,{width:e.source.commandValue}),t.editing.view.focus())})),r};t.ui.componentFactory.add("resizeImage",o),t.ui.componentFactory.add("imageResize",o)}_getOptionLabelValue(e,t=!1){const i=this.editor.t;return e.label?e.label:t?Ee(e)?i("Custom image size"):e.value?i("Resize image to %0",e.value+this._resizeUnit):i("Resize image to the original size"):Ee(e)?i("Custom"):e.value?e.value+this._resizeUnit:i("Original")}_getResizeDropdownListItemDefinitions(e,t){const{editor:i}=this,n=new l.pM,o=e.map((e=>Ee(e)?{...e,valueWithUnits:"custom"}:e.value?{...e,valueWithUnits:`${e.value}${this._resizeUnit}`}:{...e,valueWithUnits:null}));for(const e of o){let s=null;if(i.plugins.has("ImageCustomResizeUI")&&Ee(e)){const n=i.plugins.get("ImageCustomResizeUI");s={type:"button",model:new k.Jc({label:this._getOptionLabelValue(e),role:"menuitemradio",withText:!0,icon:null,onClick:()=>{n._showForm(this._resizeUnit)}})};const r=_e(o,"valueWithUnits");s.model.bind("isOn").to(t,"value",Te(r))}else s={type:"button",model:new k.Jc({commandName:"resizeImage",commandValue:e.valueWithUnits,label:this._getOptionLabelValue(e),role:"menuitemradio",withText:!0,icon:null})},s.model.bind("isOn").to(t,"value",xe(e.valueWithUnits));s.model.bind("isEnabled").to(t,"isEnabled"),n.add(s)}return n}}function Ee(e){return"custom"===e.value}function xe(e){return t=>null===e&&t===e||null!==t&&t.width===e}function Te(e){return t=>!e.some((e=>xe(e)(t)))}const Pe="image_resized";class Ie extends n.k_{static get requires(){return[c.VE,p]}static get pluginName(){return"ImageResizeHandles"}init(){const e=this.editor.commands.get("resizeImage");this.bind("isEnabled").to(e),this._setupResizerCreator()}_setupResizerCreator(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageUtils");t.addObserver(I),this.listenTo(t.document,"imageLoaded",((n,o)=>{if(!o.target.matches("figure.image.ck-widget > img,figure.image.ck-widget > picture > img,figure.image.ck-widget > a > img,figure.image.ck-widget > a > picture > img,span.image-inline.ck-widget > img,span.image-inline.ck-widget > picture > img"))return;const s=e.editing.view.domConverter,r=s.domToView(o.target),a=i.getImageWidgetFromImageView(r);let l=this.editor.plugins.get(c.VE).getResizerByViewElement(a);if(l)return void l.redraw();const d=e.editing.mapper,u=d.toModelElement(a);l=e.plugins.get(c.VE).attachTo({unit:e.config.get("image.resizeUnit"),modelElement:u,viewElement:a,editor:e,getHandleHost:e=>e.querySelector("img"),getResizeHost:()=>s.mapViewToDom(d.toViewElement(u)),isCentered:()=>"alignCenter"==u.getAttribute("imageStyle"),onCommit(i){t.change((e=>{e.removeClass(Pe,a)})),e.execute("resizeImage",{width:i})}}),l.on("updateSize",(()=>{a.hasClass(Pe)||t.change((e=>{e.addClass(Pe,a)}));const e="imageInline"===u.name?r:a;e.getStyle("height")&&t.change((t=>{t.removeStyle("height",e)}))})),l.bind("isEnabled").to(this)}))}}function Se(e){if(!e)return null;const[,t,i]=e.trim().match(/([.,\d]+)(%|px)$/)||[],n=Number.parseFloat(t);return Number.isNaN(n)?null:{value:n,unit:i}}function Ve(e,t,i){return"px"===i?{value:t.value,unit:"px"}:{value:t.value/e*100,unit:"%"}}function Re(e){const{editing:t}=e,i=e.plugins.get("ImageUtils").getClosestSelectedImageElement(e.model.document.selection);if(!i)return null;const n=t.mapper.toViewElement(i);return{model:i,view:n,dom:t.view.domConverter.mapViewToDom(n)}}class Be extends k.Ss{constructor(e,t,i){super(e);const o=this.locale.t;this.focusTracker=new l.$x,this.keystrokes=new l.EP,this.unit=t,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(o("Save"),n.Pt.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(o("Cancel"),n.Pt.cancel,"ck-button-cancel","cancel"),this._focusables=new k.s3,this._validators=i,this._focusCycler=new k.H({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-custom-resize-form","ck-responsive-form"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),this.keystrokes.listenTo(this.element),(0,k.Z5)({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(e,t,i,n){const o=new k._(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o.extendTemplate({attributes:{class:i}}),n&&o.delegate("execute").to(this,n),o}_createLabeledInputView(){const e=this.locale.t,t=new k.xE(this.locale,k.F_);return t.label=e("Resize image (in %0)",this.unit),t.fieldView.set({step:.1}),t}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.labeledInput.errorText=t,!1}return!0}resetFormStatus(){this.labeledInput.errorText=null}get rawSize(){const{element:e}=this.labeledInput.fieldView;return e?e.value:null}get parsedSize(){const{rawSize:e}=this;if(null===e)return null;const t=Number.parseFloat(e);return Number.isNaN(t)?null:t}get sizeWithUnits(){const{parsedSize:e,unit:t}=this;return null===e?null:`${e}${t}`}}class Me extends n.k_{static get requires(){return[k.pU]}static get pluginName(){return"ImageCustomResizeUI"}destroy(){super.destroy(),this._form&&this._form.destroy()}_createForm(e){const t=this.editor;this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new((0,k.wi)(Be))(t.locale,e,function(e){const t=e.t;return[e=>""===e.rawSize.trim()?t("The value must not be empty."):null===e.parsedSize?t("The value should be a plain number."):void 0]}(t)),this._form.render(),this.listenTo(this._form,"submit",(()=>{this._form.isValid()&&(t.execute("resizeImage",{width:this._form.sizeWithUnits}),this._hideForm(!0))})),this.listenTo(this._form.labeledInput,"change:errorText",(()=>{t.ui.update()})),this.listenTo(this._form,"cancel",(()=>{this._hideForm(!0)})),this._form.keystrokes.set("Esc",((e,t)=>{this._hideForm(!0),t()})),(0,k.wy)({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(e){if(this._isVisible)return;this._form||this._createForm(e);const t=this.editor,i=this._form.labeledInput;this._form.disableCssTransitions(),this._form.resetFormStatus(),this._isInBalloon||this._balloon.add({view:this._form,position:A(t)});const n=function(e,t){const i=Re(e);if(!i)return null;const n=Se(i.model.getAttribute("resizedWidth")||null);return n?n.unit===t?n:Ve((0,c.Wu)(i.dom),{unit:"px",value:new l.rw(i.dom).width},t):null}(t,e),o=n?n.value.toFixed(1):"",s=function(e,t){const i=Re(e);if(!i)return null;const n=(0,c.Wu)(i.dom),o=Se(window.getComputedStyle(i.dom).minWidth)||{value:1,unit:"px"};return{unit:t,lower:Math.max(.1,Ve(n,o,t).value),upper:"px"===t?n:100}}(t,e);i.fieldView.value=i.fieldView.element.value=o,s&&Object.assign(i.fieldView,{min:s.lower.toFixed(1),max:Math.ceil(s.upper).toFixed(1)}),this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(e=!1){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),e&&this.editor.editing.view.focus())}get _isVisible(){return!!this._balloon&&this._balloon.visibleView===this._form}get _isInBalloon(){return!!this._balloon&&this._balloon.hasView(this._form)}}class Oe extends n.k_{static get requires(){return[ke,Ie,Me,Ae]}static get pluginName(){return"ImageResize"}}class Le extends n.uB{constructor(e,t){super(e),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(t.map((e=>{if(e.isDefault)for(const t of e.modelElements)this._defaultStyles[t]=e.name;return[e.name,e]})))}refresh(){const e=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!e,this.isEnabled?e.hasAttribute("imageStyle")?this.value=e.getAttribute("imageStyle"):this.value=this._defaultStyles[e.name]:this.value=!1}execute(e={}){const t=this.editor,i=t.model,n=t.plugins.get("ImageUtils");i.change((t=>{const o=e.value,{setImageSizes:s=!0}=e;let r=n.getClosestSelectedImageElement(i.document.selection);o&&this.shouldConvertImageType(o,r)&&(this.editor.execute(n.isBlockImage(r)?"imageTypeInline":"imageTypeBlock",{setImageSizes:s}),r=n.getClosestSelectedImageElement(i.document.selection)),!o||this._styles.get(o).isDefault?t.removeAttribute("imageStyle",r):t.setAttribute("imageStyle",o,r),s&&n.setImageNaturalSizeAttributes(r)}))}shouldConvertImageType(e,t){return!this._styles.get(e).modelElements.includes(t.name)}}const Fe={get inline(){return{name:"inline",title:"In line",icon:n.Pt.objectInline,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:n.Pt.objectLeft,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:n.Pt.objectBlockLeft,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:n.Pt.objectCenter,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:n.Pt.objectRight,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:n.Pt.objectBlockRight,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:n.Pt.objectCenter,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:n.Pt.objectRight,modelElements:["imageBlock"],className:"image-style-side"}}},Ne=(()=>({full:n.Pt.objectFullWidth,left:n.Pt.objectBlockLeft,right:n.Pt.objectBlockRight,center:n.Pt.objectCenter,inlineLeft:n.Pt.objectLeft,inlineRight:n.Pt.objectRight,inline:n.Pt.objectInline}))(),De=[{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 ze(e){(0,l.FF)("image-style-configuration-definition-invalid",e)}const We={normalizeStyles:function(e){return(e.configuredStyles.options||[]).map((e=>{return"string"==typeof(t="string"==typeof(t=e)?Fe[t]?{...Fe[t]}:{name:t}:function(e,t){const i={...t};for(const n in e)Object.prototype.hasOwnProperty.call(t,n)||(i[n]=e[n]);return i}(Fe[t.name],t)).icon&&(t.icon=Ne[t.icon]||t.icon),t;var t})).filter((t=>function(e,{isBlockPluginLoaded:t,isInlinePluginLoaded:i}){const{modelElements:n,name:o}=e;if(!(n&&n.length&&o))return ze({style:e}),!1;{const o=[t?"imageBlock":null,i?"imageInline":null];if(!n.some((e=>o.includes(e))))return(0,l.FF)("image-style-missing-dependency",{style:e,missingPlugins:n.map((e=>"imageBlock"===e?"ImageBlockEditing":"ImageInlineEditing"))}),!1}return!0}(t,e)))},getDefaultStylesConfiguration:function(e,t){return e&&t?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:e?{options:["block","side"]}:t?{options:["inline","alignLeft","alignRight"]}:{}},getDefaultDropdownDefinitions:function(e){return e.has("ImageBlockEditing")&&e.has("ImageInlineEditing")?[...De]:[]},warnInvalidStyle:ze,DEFAULT_OPTIONS:Fe,DEFAULT_ICONS:Ne,DEFAULT_DROPDOWN_DEFINITIONS:De};function He(e,t){for(const i of t)if(i.name===e)return i}class Ue extends n.k_{static get pluginName(){return"ImageStyleEditing"}static get requires(){return[p]}init(){const{normalizeStyles:e,getDefaultStylesConfiguration:t}=We,i=this.editor,n=i.plugins.has("ImageBlockEditing"),o=i.plugins.has("ImageInlineEditing");i.config.define("image.styles",t(n,o)),this.normalizedStyles=e({configuredStyles:i.config.get("image.styles"),isBlockPluginLoaded:n,isInlinePluginLoaded:o}),this._setupConversion(n,o),this._setupPostFixer(),i.commands.add("imageStyle",new Le(i,this.normalizedStyles))}_setupConversion(e,t){const i=this.editor,n=i.model.schema,o=(s=this.normalizedStyles,(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const n=He(t.attributeNewValue,s),o=He(t.attributeOldValue,s),r=i.mapper.toViewElement(t.item),a=i.writer;o&&a.removeClass(o.className,r),n&&a.addClass(n.className,r)});var s;const r=function(e){const t={imageInline:e.filter((e=>!e.isDefault&&e.modelElements.includes("imageInline"))),imageBlock:e.filter((e=>!e.isDefault&&e.modelElements.includes("imageBlock")))};return(e,i,n)=>{if(!i.modelRange)return;const o=i.viewItem,s=(0,l.$1)(i.modelRange.getItems());if(s&&n.schema.checkAttribute(s,"imageStyle"))for(const e of t[s.name])n.consumable.consume(o,{classes:e.className})&&n.writer.setAttribute("imageStyle",e.name,s)}}(this.normalizedStyles);i.editing.downcastDispatcher.on("attribute:imageStyle",o),i.data.downcastDispatcher.on("attribute:imageStyle",o),e&&(n.extend("imageBlock",{allowAttributes:"imageStyle"}),i.data.upcastDispatcher.on("element:figure",r,{priority:"low"})),t&&(n.extend("imageInline",{allowAttributes:"imageStyle"}),i.data.upcastDispatcher.on("element:img",r,{priority:"low"}))}_setupPostFixer(){const e=this.editor,t=e.model.document,i=e.plugins.get(p),n=new Map(this.normalizedStyles.map((e=>[e.name,e])));t.registerPostFixer((e=>{let o=!1;for(const s of t.differ.getChanges())if("insert"==s.type||"attribute"==s.type&&"imageStyle"==s.attributeKey){let t="insert"==s.type?s.position.nodeAfter:s.range.start.nodeAfter;if(t&&t.is("element","paragraph")&&t.childCount>0&&(t=t.getChild(0)),!i.isImage(t))continue;const r=t.getAttribute("imageStyle");if(!r)continue;const a=n.get(r);a&&a.modelElements.includes(t.name)||(e.removeAttribute("imageStyle",t),o=!0)}return o}))}}var $e=i(3149),je=i(9008);class qe extends n.k_{static get requires(){return[Ue]}static get pluginName(){return"ImageStyleUI"}get localizedDefaultStylesTitles(){const e=this.editor.t;return{"Wrap text":e("Wrap text"),"Break text":e("Break text"),"In line":e("In line"),"Full size image":e("Full size image"),"Side image":e("Side image"),"Left aligned image":e("Left aligned image"),"Centered image":e("Centered image"),"Right aligned image":e("Right aligned image")}}init(){const e=this.editor.plugins,t=this.editor.config.get("image.toolbar")||[],i=Ke(e.get("ImageStyleEditing").normalizedStyles,this.localizedDefaultStylesTitles);for(const e of i)this._createButton(e);const n=Ke([...t.filter($e.A),...We.getDefaultDropdownDefinitions(e)],this.localizedDefaultStylesTitles);for(const e of n)this._createDropdown(e,i)}_createDropdown(e,t){const i=this.editor.ui.componentFactory;i.add(e.name,(n=>{let o;const{defaultItem:s,items:r,title:a}=e,l=r.filter((e=>t.find((({name:t})=>Ge(t)===e)))).map((e=>{const t=i.create(e);return e===s&&(o=t),t}));r.length!==l.length&&We.warnInvalidStyle({dropdown:e});const c=(0,k.yu)(n,k.AO),d=c.buttonView,u=d.arrowView;return(0,k.fM)(c,l,{enableActiveItemFocusOnDropdownOpen:!0}),d.set({label:Ze(a,o.label),class:null,tooltip:!0}),u.unbind("label"),u.set({label:a}),d.bind("icon").toMany(l,"isOn",((...e)=>{const t=e.findIndex(je.A);return t<0?o.icon:l[t].icon})),d.bind("label").toMany(l,"isOn",((...e)=>{const t=e.findIndex(je.A);return Ze(a,t<0?o.label:l[t].label)})),d.bind("isOn").toMany(l,"isOn",((...e)=>e.some(je.A))),d.bind("class").toMany(l,"isOn",((...e)=>e.some(je.A)?"ck-splitbutton_flatten":void 0)),d.on("execute",(()=>{l.some((({isOn:e})=>e))?c.isOpen=!c.isOpen:o.fire("execute")})),c.bind("isEnabled").toMany(l,"isEnabled",((...e)=>e.some(je.A))),this.listenTo(c,"execute",(()=>{this.editor.editing.view.focus()})),c}))}_createButton(e){const t=e.name;this.editor.ui.componentFactory.add(Ge(t),(i=>{const n=this.editor.commands.get("imageStyle"),o=new k._(i);return o.set({label:e.title,icon:e.icon,tooltip:!0,isToggleable:!0}),o.bind("isEnabled").to(n,"isEnabled"),o.bind("isOn").to(n,"value",(e=>e===t)),o.on("execute",this._executeCommand.bind(this,t)),o}))}_executeCommand(e){this.editor.execute("imageStyle",{value:e}),this.editor.editing.view.focus()}}function Ke(e,t){for(const i of e)t[i.title]&&(i.title=t[i.title]);return e}function Ge(e){return`imageStyle:${e}`}function Ze(e,t){return(e?e+": ":"")+t}class Je extends n.k_{static get requires(){return[Ue,qe]}static get pluginName(){return"ImageStyle"}}class Qe extends n.k_{static get requires(){return[c.oP,p]}static get pluginName(){return"ImageToolbar"}afterInit(){const e=this.editor,t=e.t,i=e.plugins.get(c.oP),n=e.plugins.get("ImageUtils");var o;i.register("image",{ariaLabel:t("Image toolbar"),items:(o=e.config.get("image.toolbar")||[],o.map((e=>(0,$e.A)(e)?e.name:e))),getRelatedElement:e=>n.getClosestSelectedImageWidget(e)})}}class Ye extends n.k_{static get requires(){return[R,p]}static get pluginName(){return"PictureEditing"}afterInit(){const e=this.editor;e.plugins.has("ImageBlockEditing")&&e.model.schema.extend("imageBlock",{allowAttributes:["sources"]}),e.plugins.has("ImageInlineEditing")&&e.model.schema.extend("imageInline",{allowAttributes:["sources"]}),this._setupConversion(),this._setupImageUploadEditingIntegration()}_setupConversion(){const e=this.editor,t=e.conversion,i=e.plugins.get("ImageUtils");t.for("upcast").add(function(e){const t=["srcset","media","type","sizes"],i=(i,n,o)=>{const s=n.viewItem;if(!o.consumable.test(s,{name:!0}))return;const r=new Map;for(const e of s.getChildren())if(e.is("element","source")){const i={};for(const n of t)e.hasAttribute(n)&&o.consumable.test(e,{attributes:n})&&(i[n]=e.getAttribute(n));Object.keys(i).length&&r.set(e,i)}const a=e.findViewImgElement(s);if(!a)return;let c=n.modelCursor.parent;if(!c.is("element","imageBlock")){const e=o.convertItem(a,n.modelCursor);n.modelRange=e.modelRange,n.modelCursor=e.modelCursor,c=(0,l.$1)(e.modelRange.getItems())}o.consumable.consume(s,{name:!0});for(const[e,t]of r)o.consumable.consume(e,{attributes:Object.keys(t)});r.size&&o.writer.setAttribute("sources",Array.from(r.values()),c),o.convertChildren(s,c)};return e=>{e.on("element:picture",i)}}(i)),t.for("downcast").add(function(e){const t=(t,i,n)=>{if(!n.consumable.consume(i.item,t.name))return;const o=n.writer,s=n.mapper.toViewElement(i.item),r=e.findViewImgElement(s),a=i.attributeNewValue;if(a&&a.length){const e=o.createContainerElement("picture",null,a.map((e=>o.createEmptyElement("source",e)))),t=[];let i=r.parent;for(;i&&i.is("attributeElement");){const e=i.parent;o.unwrap(o.createRangeOn(r),i),t.unshift(i),i=e}o.insert(o.createPositionBefore(r),e),o.move(o.createRangeOn(r),o.createPositionAt(e,"end"));for(const i of t)o.wrap(o.createRangeOn(e),i)}else if(r.parent.is("element","picture")){const e=r.parent;o.move(o.createRangeOn(r),o.createPositionBefore(e)),o.remove(e)}};return e=>{e.on("attribute:sources:imageBlock",t),e.on("attribute:sources:imageInline",t)}}(i))}_setupImageUploadEditingIntegration(){const e=this.editor;if(!e.plugins.has("ImageUploadEditing"))return;const t=e.plugins.get("ImageUploadEditing");this.listenTo(t,"uploadComplete",((t,{imageElement:i,data:n})=>{const o=n.sources;o&&e.model.change((e=>{e.setAttributes({sources:o},i)}))}))}}},2016:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Indent:()=>a,IndentBlock:()=>g,IndentEditing:()=>o,IndentUI:()=>r});var n=i(1204);class o extends n.k_{static get pluginName(){return"IndentEditing"}init(){const e=this.editor;e.commands.add("indent",new n.fE(e)),e.commands.add("outdent",new n.fE(e))}}var s=i(949);class r extends n.k_{static get pluginName(){return"IndentUI"}init(){const e=this.editor,t=e.locale,i=e.t,o="ltr"==t.uiLanguageDirection?n.Pt.indent:n.Pt.outdent,s="ltr"==t.uiLanguageDirection?n.Pt.outdent:n.Pt.indent;this._defineButton("indent",i("Increase indent"),o),this._defineButton("outdent",i("Decrease indent"),s)}_defineButton(e,t,i){const n=this.editor;n.ui.componentFactory.add(e,(()=>{const n=this._createButton(s._,e,t,i);return n.set({tooltip:!0}),n})),n.ui.componentFactory.add("menuBar:"+e,(()=>this._createButton(s.kS,e,t,i)))}_createButton(e,t,i,n){const o=this.editor,s=o.commands.get(t),r=new e(o.locale);return r.set({label:i,icon:n}),r.bind("isEnabled").to(s,"isEnabled"),this.listenTo(r,"execute",(()=>{o.execute(t),o.editing.view.focus()})),r}}class a extends n.k_{static get pluginName(){return"Indent"}static get requires(){return[o,r]}}var l=i(4133),c=i(5318);class d extends n.uB{constructor(e,t){super(e),this._indentBehavior=t}refresh(){const e=this.editor.model,t=(0,c.$1)(e.document.selection.getSelectedBlocks());t&&this._isIndentationChangeAllowed(t)?this.isEnabled=this._indentBehavior.checkEnabled(t.getAttribute("blockIndent")):this.isEnabled=!1}execute(){const e=this.editor.model,t=this._getBlocksToChange();e.change((e=>{for(const i of t){const t=i.getAttribute("blockIndent"),n=this._indentBehavior.getNextIndent(t);n?e.setAttribute("blockIndent",n,i):e.removeAttribute("blockIndent",i)}}))}_getBlocksToChange(){const e=this.editor.model.document.selection;return Array.from(e.getSelectedBlocks()).filter((e=>this._isIndentationChangeAllowed(e)))}_isIndentationChangeAllowed(e){const t=this.editor;return!!t.model.schema.checkAttribute(e,"blockIndent")&&(!t.plugins.has("ListUtils")||(!this._indentBehavior.isForward||!t.plugins.get("ListUtils").isListItemBlock(e)))}}class u{constructor(e){this.isForward="forward"===e.direction,this.offset=e.offset,this.unit=e.unit}checkEnabled(e){const t=parseFloat(e||"0");return this.isForward||t>0}getNextIndent(e){const t=parseFloat(e||"0");if(e&&!e.endsWith(this.unit))return this.isForward?this.offset+this.unit:void 0;const i=t+(this.isForward?this.offset:-this.offset);return i>0?i+this.unit:void 0}}class h{constructor(e){this.isForward="forward"===e.direction,this.classes=e.classes}checkEnabled(e){const t=this.classes.indexOf(e);return this.isForward?t<this.classes.length-1:t>=0}getNextIndent(e){const t=this.classes.indexOf(e),i=this.isForward?1:-1;return this.classes[t+i]}}const m=["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"];class g extends n.k_{constructor(e){super(e),e.config.define("indentBlock",{offset:40,unit:"px"})}static get pluginName(){return"IndentBlock"}init(){const e=this.editor,t=e.config.get("indentBlock");t.classes&&t.classes.length?(this._setupConversionUsingClasses(t.classes),e.commands.add("indentBlock",new d(e,new h({direction:"forward",classes:t.classes}))),e.commands.add("outdentBlock",new d(e,new h({direction:"backward",classes:t.classes})))):(e.data.addStyleProcessorRules(l.vt),this._setupConversionUsingOffset(),e.commands.add("indentBlock",new d(e,new u({direction:"forward",offset:t.offset,unit:t.unit}))),e.commands.add("outdentBlock",new d(e,new u({direction:"backward",offset:t.offset,unit:t.unit}))))}afterInit(){const e=this.editor,t=e.model.schema,i=e.commands.get("indent"),n=e.commands.get("outdent"),o=e.config.get("heading.options");(o&&o.map((e=>e.model))||m).forEach((e=>{t.isRegistered(e)&&t.extend(e,{allowAttributes:"blockIndent"})})),t.setAttributeProperties("blockIndent",{isFormatting:!0}),i.registerChildCommand(e.commands.get("indentBlock")),n.registerChildCommand(e.commands.get("outdentBlock"))}_setupConversionUsingOffset(){const e=this.editor.conversion,t="rtl"===this.editor.locale.contentLanguageDirection?"margin-right":"margin-left";e.for("upcast").attributeToAttribute({view:{styles:{[t]:/[\s\S]+/}},model:{key:"blockIndent",value:e=>{if(!e.is("element","li"))return e.getStyle(t)}}}),e.for("downcast").attributeToAttribute({model:"blockIndent",view:e=>({key:"style",value:{[t]:e}})})}_setupConversionUsingClasses(e){const t={model:{key:"blockIndent",values:[]},view:{}};for(const i of e)t.model.values.push(i),t.view[i]={key:"class",value:[i]};this.editor.conversion.attributeToAttribute(t)}}},2685:(e,t,i)=>{"use strict";i.r(t),i.d(t,{TextPartLanguage:()=>d,TextPartLanguageEditing:()=>a,TextPartLanguageUI:()=>c});var n=i(1204),o=i(5318);function s(e,t){return`${e}:${t=t||(0,o.iJ)(e)}`}class r extends n.uB{refresh(){const e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"language")}execute({languageCode:e,textDirection:t}={}){const i=this.editor.model,n=i.document.selection,o=!!e&&s(e,t);i.change((e=>{if(n.isCollapsed)o?e.setSelectionAttribute("language",o):e.removeSelectionAttribute("language");else{const t=i.schema.getValidRanges(n.getRanges(),"language");for(const i of t)o?e.setAttribute("language",o,i):e.removeAttribute("language",i)}}))}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,i=e.document.selection;if(i.isCollapsed)return i.getAttribute("language")||!1;for(const e of i.getRanges())for(const i of e.getItems())if(t.checkAttribute(i,"language"))return i.getAttribute("language")||!1;return!1}}class a extends n.k_{static get pluginName(){return"TextPartLanguageEditing"}constructor(e){super(e),e.config.define("language",{textPartLanguage:[{title:"Arabic",languageCode:"ar"},{title:"French",languageCode:"fr"},{title:"Spanish",languageCode:"es"}]})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"language"}),e.model.schema.setAttributeProperties("language",{copyOnEnter:!0}),this._defineConverters(),e.commands.add("textPartLanguage",new r(e))}_defineConverters(){const e=this.editor.conversion;e.for("upcast").elementToAttribute({model:{key:"language",value:e=>s(e.getAttribute("lang"),e.getAttribute("dir"))},view:{name:"span",attributes:{lang:/[\s\S]+/}}}),e.for("downcast").attributeToElement({model:"language",view:(e,{writer:t},i)=>{if(!e)return;if(!i.item.is("$textProxy")&&!i.item.is("documentSelection"))return;const{languageCode:n,textDirection:o}=function(e){const[t,i]=e.split(":");return{languageCode:t,textDirection:i}}(e);return t.createAttributeElement("span",{lang:n,dir:o})}})}}var l=i(949);class c extends n.k_{static get pluginName(){return"TextPartLanguageUI"}init(){const e=this.editor,t=e.t,i=t("Choose language"),n=t("Language");e.ui.componentFactory.add("textPartLanguage",(t=>{const{definitions:o,titles:s}=this._getItemMetadata(),r=e.commands.get("textPartLanguage"),a=(0,l.yu)(t);return(0,l.O)(a,o,{ariaLabel:n,role:"menu"}),a.buttonView.set({ariaLabel:n,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:n}),a.extendTemplate({attributes:{class:["ck-text-fragment-language-dropdown"]}}),a.bind("isEnabled").to(r,"isEnabled"),a.buttonView.bind("label").to(r,"value",(e=>e&&s[e]||i)),a.buttonView.bind("ariaLabel").to(r,"value",(e=>{const t=e&&s[e];return t?`${t}, ${n}`:n})),this.listenTo(a,"execute",(t=>{r.execute({languageCode:t.source.languageCode,textDirection:t.source.textDirection}),e.editing.view.focus()})),a})),e.ui.componentFactory.add("menuBar:textPartLanguage",(i=>{const{definitions:o}=this._getItemMetadata(),s=e.commands.get("textPartLanguage"),r=new l.zj(i);r.buttonView.set({label:n});const a=new l.BY(i);a.set({ariaLabel:t("Language"),role:"menu"});for(const e of o){if("button"!=e.type){a.items.add(new l.Je(i));continue}const t=new l.I8(i,r),n=new l.kS(i);n.set({role:"menuitemradio",isToggleable:!0}),n.bind(...Object.keys(e.model)).to(e.model),n.delegate("execute").to(r),t.children.add(n),a.items.add(t)}return r.bind("isEnabled").to(s,"isEnabled"),r.panelView.children.add(a),r.on("execute",(t=>{s.execute({languageCode:t.source.languageCode,textDirection:t.source.textDirection}),e.editing.view.focus()})),r}))}_getItemMetadata(){const e=this.editor,t=new o.pM,i={},n=e.commands.get("textPartLanguage"),r=e.config.get("language.textPartLanguage"),a=(0,e.locale.t)("Remove language");t.add({type:"button",model:new l.Jc({label:a,languageCode:!1,withText:!0})}),t.add({type:"separator"});for(const e of r){const o={type:"button",model:new l.Jc({label:e.title,languageCode:e.languageCode,role:"menuitemradio",textDirection:e.textDirection,withText:!0})},r=s(e.languageCode,e.textDirection);o.model.bind("isOn").to(n,"value",(e=>e===r)),t.add(o),i[r]=e.title}return{definitions:t,titles:i}}}class d extends n.k_{static get requires(){return[a,c]}static get pluginName(){return"TextPartLanguage"}}},4608:(e,t,i)=>{"use strict";i.r(t),i.d(t,{AutoLink:()=>ee,Link:()=>ie,LinkCommand:()=>F,LinkEditing:()=>U,LinkImage:()=>ae,LinkImageEditing:()=>ne,LinkImageUI:()=>re,LinkUI:()=>Q,UnlinkCommand:()=>D});var n=i(1204),o=i(7211),s=i(7377),r=i(5318);class a{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(e){Array.isArray(e)?e.forEach((e=>this._definitions.add(e))):this._definitions.add(e)}getDispatcher(){return e=>{e.on("attribute:linkHref",((e,t,i)=>{if(!i.consumable.test(t.item,"attribute:linkHref"))return;if(!t.item.is("selection")&&!i.schema.isInline(t.item))return;const n=i.writer,o=n.document.selection;for(const e of this._definitions){const s=n.createAttributeElement("a",e.attributes,{priority:5});e.classes&&n.addClass(e.classes,s);for(const t in e.styles)n.setStyle(t,e.styles[t],s);n.setCustomProperty("link",!0,s),e.callback(t.attributeNewValue)?t.item.is("selection")?n.wrap(o.getFirstRange(),s):n.wrap(i.mapper.toViewRange(t.range),s):n.unwrap(i.mapper.toViewRange(t.range),s)}}),{priority:"high"})}}getDispatcherForLinkedImage(){return e=>{e.on("attribute:linkHref:imageBlock",((e,t,{writer:i,mapper:n})=>{const o=n.toViewElement(t.item),s=Array.from(o.getChildren()).find((e=>e.is("element","a")));for(const e of this._definitions){const n=(0,r.av)(e.attributes);if(e.callback(t.attributeNewValue)){for(const[e,t]of n)"class"===e?i.addClass(t,s):i.setAttribute(e,t,s);e.classes&&i.addClass(e.classes,s);for(const t in e.styles)i.setStyle(t,e.styles[t],s)}else{for(const[e,t]of n)"class"===e?i.removeClass(t,s):i.removeAttribute(e,s);e.classes&&i.removeClass(e.classes,s);for(const t in e.styles)i.removeStyle(t,s)}}}))}}}var l=i(7688);var c=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");const d=function(e){return c.test(e)};var u="\\ud800-\\udfff",h="["+u+"]",m="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",g="\\ud83c[\\udffb-\\udfff]",f="[^"+u+"]",p="(?:\\ud83c[\\udde6-\\uddff]){2}",b="[\\ud800-\\udbff][\\udc00-\\udfff]",w="(?:"+m+"|"+g+")?",v="[\\ufe0e\\ufe0f]?",_=v+w+"(?:\\u200d(?:"+[f,p,b].join("|")+")"+v+w+")*",y="(?:"+[f+m+"?",m,p,b,h].join("|")+")",k=RegExp(g+"(?="+g+")|"+y+_,"g");const C=function(e){return d(e)?function(e){return e.match(k)||[]}(e):function(e){return e.split("")}(e)};var A=i(3456);const E=function(e){e=(0,A.A)(e);var t,i,n,o,s=d(e)?C(e):void 0,r=s?s[0]:e.charAt(0),a=s?(t=s,i=1,o=t.length,n=void 0===n?o:n,!i&&n>=o?t:(0,l.A)(t,i,n)).join(""):e.slice(1);return r.toUpperCase()+a},x=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,T=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,P=/^((\w+:(\/{2,})?)|(\W))/i,I=["https?","ftps?","mailto"],S="Ctrl+K";function V(e,{writer:t}){const i=t.createAttributeElement("a",{href:e},{priority:5});return t.setCustomProperty("link",!0,i),i}function R(e,t=I){const i=String(e),n=t.join("|");return function(e,t){return!!e.replace(x,"").match(t)}(i,new RegExp(`${"^(?:(?:<protocols>):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))".replace("<protocols>",n)}`,"i"))?i:"#"}function B(e,t){return!!e&&t.checkAttribute(e.name,"linkHref")}function M(e,t){const i=(n=e,T.test(n)?"mailto:":t);var n;const o=!!i&&!O(e);return e&&o?i+e:e}function O(e){return P.test(e)}function L(e){window.open(e,"_blank","noopener")}class F extends n.uB{constructor(){super(...arguments),this.manualDecorators=new r.pM,this.automaticDecorators=new a}restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement()||(0,r.$1)(t.getSelectedBlocks());B(i,e.schema)?(this.value=i.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(i,"linkHref")):(this.value=t.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref"));for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}execute(e,t={}){const i=this.editor.model,n=i.document.selection,s=[],a=[];for(const e in t)t[e]?s.push(e):a.push(e);i.change((t=>{if(n.isCollapsed){const l=n.getFirstPosition();if(n.hasAttribute("linkHref")){const r=N(n);let c=(0,o.Py)(l,"linkHref",n.getAttribute("linkHref"),i);n.getAttribute("linkHref")===r&&(c=this._updateLinkContent(i,t,c,e)),t.setAttribute("linkHref",e,c),s.forEach((e=>{t.setAttribute(e,!0,c)})),a.forEach((e=>{t.removeAttribute(e,c)})),t.setSelection(t.createPositionAfter(c.end.nodeBefore))}else if(""!==e){const o=(0,r.av)(n.getAttributes());o.set("linkHref",e),s.forEach((e=>{o.set(e,!0)}));const{end:a}=i.insertContent(t.createText(e,o),l);t.setSelection(a)}["linkHref",...s,...a].forEach((e=>{t.removeSelectionAttribute(e)}))}else{const o=i.schema.getValidRanges(n.getRanges(),"linkHref"),r=[];for(const e of n.getSelectedBlocks())i.schema.checkAttribute(e,"linkHref")&&r.push(t.createRangeOn(e));const l=r.slice();for(const e of o)this._isRangeToUpdate(e,r)&&l.push(e);for(const o of l){let r=o;if(1===l.length){const s=N(n);n.getAttribute("linkHref")===s&&(r=this._updateLinkContent(i,t,o,e),t.setSelection(t.createSelection(r)))}t.setAttribute("linkHref",e,r),s.forEach((e=>{t.setAttribute(e,!0,r)})),a.forEach((e=>{t.removeAttribute(e,r)}))}}}))}_getDecoratorStateFromModel(e){const t=this.editor.model,i=t.document.selection,n=i.getSelectedElement();return B(n,t.schema)?n.getAttribute(e):i.getAttribute(e)}_isRangeToUpdate(e,t){for(const i of t)if(i.containsRange(e))return!1;return!0}_updateLinkContent(e,t,i,n){const o=t.createText(n,{linkHref:n});return e.insertContent(o,i)}}function N(e){if(e.isCollapsed){const t=e.getFirstPosition();return t.textNode&&t.textNode.data}{const t=Array.from(e.getFirstRange().getItems());if(t.length>1)return null;const i=t[0];return i.is("$text")||i.is("$textProxy")?i.data:null}}class D extends n.uB{refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement();B(i,e.schema)?this.isEnabled=e.schema.checkAttribute(i,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref")}execute(){const e=this.editor,t=this.editor.model,i=t.document.selection,n=e.commands.get("link");t.change((e=>{const s=i.isCollapsed?[(0,o.Py)(i.getFirstPosition(),"linkHref",i.getAttribute("linkHref"),t)]:t.schema.getValidRanges(i.getRanges(),"linkHref");for(const t of s)if(e.removeAttribute("linkHref",t),n)for(const i of n.manualDecorators)e.removeAttribute(i.id,t)}))}}class z extends((0,r.VM)()){constructor({id:e,label:t,attributes:i,classes:n,styles:o,defaultValue:s}){super(),this.id=e,this.set("value",void 0),this.defaultValue=s,this.label=t,this.attributes=i,this.classes=n,this.styles=o}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}const W="automatic",H=/^(https?:)?\/\//;class U extends n.k_{static get pluginName(){return"LinkEditing"}static get requires(){return[o.Vp,o.pd,s.xz]}constructor(e){super(e),e.config.define("link",{allowCreatingEmptyLinks:!1,addTargetToExternalLinks:!1})}init(){const e=this.editor,t=this.editor.config.get("link.allowedProtocols");e.model.schema.extend("$text",{allowAttributes:"linkHref"}),e.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:V}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(e,i)=>V(R(e,t),i)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:e=>e.getAttribute("href")}}),e.commands.add("link",new F(e)),e.commands.add("unlink",new D(e));const i=function(e,t){const i={"Open in a new tab":e("Open in a new tab"),Downloadable:e("Downloadable")};return t.forEach((e=>("label"in e&&i[e.label]&&(e.label=i[e.label]),e))),t}(e.t,function(e){const t=[];if(e)for(const[i,n]of Object.entries(e)){const e=Object.assign({},n,{id:`link${E(i)}`});t.push(e)}return t}(e.config.get("link.decorators")));this._enableAutomaticDecorators(i.filter((e=>e.mode===W))),this._enableManualDecorators(i.filter((e=>"manual"===e.mode))),e.plugins.get(o.Vp).registerAttribute("linkHref"),(0,o.Il)(e,"linkHref","a","ck-link_selected"),this._enableLinkOpen(),this._enableSelectionAttributesFixer(),this._enableClipboardIntegration()}_enableAutomaticDecorators(e){const t=this.editor,i=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&i.add({id:"linkIsExternal",mode:W,callback:e=>!!e&&H.test(e),attributes:{target:"_blank",rel:"noopener noreferrer"}}),i.add(e),i.length&&t.conversion.for("downcast").add(i.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,i=t.commands.get("link").manualDecorators;e.forEach((e=>{t.model.schema.extend("$text",{allowAttributes:e.id});const n=new z(e);i.add(n),t.conversion.for("downcast").attributeToElement({model:n.id,view:(e,{writer:t,schema:i},{item:o})=>{if((o.is("selection")||i.isInline(o))&&e){const e=t.createAttributeElement("a",n.attributes,{priority:5});n.classes&&t.addClass(n.classes,e);for(const i in n.styles)t.setStyle(i,n.styles[i],e);return t.setCustomProperty("link",!0,e),e}}}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",...n._createPattern()},model:{key:n.id}})}))}_enableLinkOpen(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",((e,t)=>{if(!(r._K.isMac?t.domEvent.metaKey:t.domEvent.ctrlKey))return;let i=t.domTarget;if("a"!=i.tagName.toLowerCase()&&(i=i.closest("a")),!i)return;const n=i.getAttribute("href");n&&(e.stop(),t.preventDefault(),L(n))}),{context:"$capture"}),this.listenTo(t,"keydown",((t,i)=>{const n=e.commands.get("link").value;n&&i.keyCode===r.uP.enter&&i.altKey&&(t.stop(),L(n))}))}_enableSelectionAttributesFixer(){const e=this.editor.model,t=e.document.selection;this.listenTo(t,"change:attribute",((i,{attributeKeys:n})=>{n.includes("linkHref")&&!t.hasAttribute("linkHref")&&e.change((t=>{var i;!function(e,t){e.removeSelectionAttribute("linkHref");for(const i of t)e.removeSelectionAttribute(i)}(t,(i=e.schema,i.getDefinition("$text").allowAttributes.filter((e=>e.startsWith("link")))))}))}))}_enableClipboardIntegration(){const e=this.editor,t=e.model,i=this.editor.config.get("link.defaultProtocol");i&&this.listenTo(e.plugins.get("ClipboardPipeline"),"contentInsertion",((e,n)=>{t.change((e=>{const t=e.createRangeIn(n.content);for(const n of t.getItems())if(n.hasAttribute("linkHref")){const t=M(n.getAttribute("linkHref"),i);e.setAttribute("linkHref",t,n)}}))}))}}var $=i(4133),j=i(949),q=i(5091);class K extends j.Ss{constructor(e,t,i){super(e),this.focusTracker=new r.$x,this.keystrokes=new r.EP,this._focusables=new j.s3;const o=e.t;this._validators=i,this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(o("Save"),n.Pt.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(o("Cancel"),n.Pt.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(t),this.children=this._createFormChildren(t.manualDecorators),this._focusCycler=new j.H({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const s=["ck","ck-link-form","ck-responsive-form"];t.manualDecorators.length&&s.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:s,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce(((e,t)=>(e[t.name]=t.isOn,e)),{})}render(){super.render(),(0,j.Z5)({view:this}),[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.urlInputView.errorText=t,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null}_createUrlInput(){const e=this.locale.t,t=new j.xE(this.locale,j.Vr);return t.fieldView.inputMode="url",t.label=e("Link URL"),t}_createButton(e,t,i,n){const o=new j._(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o.extendTemplate({attributes:{class:i}}),n&&o.delegate("execute").to(this,n),o}_createManualDecoratorSwitches(e){const t=this.createCollection();for(const i of e.manualDecorators){const n=new j.Wm(this.locale);n.set({name:i.id,label:i.label,withText:!0}),n.bind("isOn").toMany([i,e],"value",((e,t)=>void 0===t&&void 0===e?!!i.defaultValue:!!e)),n.on("execute",(()=>{i.set("value",!n.isOn)})),t.add(n)}return t}_createFormChildren(e){const t=this.createCollection();if(t.add(this.urlInputView),e.length){const e=new j.Ss;e.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map((e=>({tag:"li",children:[e],attributes:{class:["ck","ck-list__item"]}}))),attributes:{class:["ck","ck-reset","ck-list"]}}),t.add(e)}return t.add(this.saveButtonView),t.add(this.cancelButtonView),t}get url(){const{element:e}=this.urlInputView.fieldView;return e?e.value.trim():null}}class G extends j.Ss{constructor(e,t={}){super(e),this.focusTracker=new r.$x,this.keystrokes=new r.EP,this._focusables=new j.s3;const i=e.t;this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(i("Unlink"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184zm4.919 10.562-1.414 1.414a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.061-1.06l1.414 1.414 1.414-1.415a.75.75 0 0 1 1.061 1.061l-1.414 1.414 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414z"/></svg>',"unlink"),this.editButtonView=this._createButton(i("Edit link"),n.Pt.pencil,"edit"),this.set("href",void 0),this._linkConfig=t,this._focusCycler=new j.H({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((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createButton(e,t,i){const n=new j._(this.locale);return n.set({label:e,icon:t,tooltip:!0}),n.delegate("execute").to(this,i),n}_createPreviewButton(){const e=new j._(this.locale),t=this.bindTemplate,i=this.t;return e.set({withText:!0,tooltip:i("Open link in new tab")}),e.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:t.to("href",(e=>e&&R(e,this._linkConfig.allowedProtocols))),target:"_blank",rel:"noopener noreferrer"}}),e.bind("label").to(this,"href",(e=>e||i("This link has no URL"))),e.bind("isEnabled").to(this,"href",(e=>!!e)),e.template.tag="a",e.template.eventListeners={},e}}const Z='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184z"/></svg>',J="link-ui";class Q extends n.k_{constructor(){super(...arguments),this.actionsView=null,this.formView=null}static get requires(){return[j.pU]}static get pluginName(){return"LinkUI"}init(){const e=this.editor,t=this.editor.t;e.editing.view.addObserver($.Re),this._balloon=e.plugins.get(j.pU),this._createToolbarLinkButton(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:J,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:J,view:(e,{writer:t})=>{if(!e.markerRange.isCollapsed)return null;const i=t.createUIElement("span");return t.addClass(["ck-fake-link-selection","ck-fake-link-selection_collapsed"],i),i}}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Create link"),keystroke:S},{label:t("Move out of a link"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}destroy(){super.destroy(),this.formView&&this.formView.destroy(),this.actionsView&&this.actionsView.destroy()}_createViews(){this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._enableUserBalloonInteractions()}_createActionsView(){const e=this.editor,t=new G(e.locale,e.config.get("link")),i=e.commands.get("link"),n=e.commands.get("unlink");return t.bind("href").to(i,"value"),t.editButtonView.bind("isEnabled").to(i),t.unlinkButtonView.bind("isEnabled").to(n),this.listenTo(t,"edit",(()=>{this._addFormView()})),this.listenTo(t,"unlink",(()=>{e.execute("unlink"),this._hideUI()})),t.keystrokes.set("Esc",((e,t)=>{this._hideUI(),t()})),t.keystrokes.set(S,((e,t)=>{this._addFormView(),t()})),t}_createFormView(){const e=this.editor,t=e.commands.get("link"),i=e.config.get("link.defaultProtocol"),n=new((0,j.wi)(K))(e.locale,t,function(e){const t=e.t,i=e.config.get("link.allowCreatingEmptyLinks");return[e=>{if(!i&&!e.url.length)return t("Link URL must not be empty.")}]}(e));return n.urlInputView.fieldView.bind("value").to(t,"value"),n.urlInputView.bind("isEnabled").to(t,"isEnabled"),n.saveButtonView.bind("isEnabled").to(t,"isEnabled"),this.listenTo(n,"submit",(()=>{if(n.isValid()){const{value:t}=n.urlInputView.fieldView.element,o=M(t,i);e.execute("link",o,n.getDecoratorSwitchesState()),this._closeFormView()}})),this.listenTo(n.urlInputView,"change:errorText",(()=>{e.ui.update()})),this.listenTo(n,"cancel",(()=>{this._closeFormView()})),n.keystrokes.set("Esc",((e,t)=>{this._closeFormView(),t()})),n}_createToolbarLinkButton(){const e=this.editor;e.ui.componentFactory.add("link",(()=>{const e=this._createButton(j._);return e.set({tooltip:!0}),e})),e.ui.componentFactory.add("menuBar:link",(()=>{const e=this._createButton(j.kS);return e.set({role:"menuitemcheckbox"}),e}))}_createButton(e){const t=this.editor,i=t.locale,n=t.commands.get("link"),o=new e(t.locale),s=i.t;return o.set({label:s("Link"),icon:Z,keystroke:S,isToggleable:!0}),o.bind("isEnabled").to(n,"isEnabled"),o.bind("isOn").to(n,"value",(e=>!!e)),this.listenTo(o,"execute",(()=>this._showUI(!0))),o}_enableBalloonActivators(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",(()=>{this._getSelectedLinkElement()&&this._showUI()})),e.keystrokes.set(S,((t,i)=>{i(),e.commands.get("link").isEnabled&&this._showUI(!0)}))}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",((e,t)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),t())}),{priority:"high"}),this.editor.keystrokes.set("Esc",((e,t)=>{this._isUIVisible&&(this._hideUI(),t())})),(0,j.wy)({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 e=this.editor.commands.get("link");this.formView.disableCssTransitions(),this.formView.resetFormStatus(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this.formView.urlInputView.fieldView.value=e.value||"",this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions()}_closeFormView(){const e=this.editor.commands.get("link");e.restoreManualDecoratorStates(),void 0!==e.value?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this.formView.urlInputView.fieldView.reset(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(e=!1){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const e=this.editor;this.stopListening(e.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const e=this.editor,t=e.editing.view.document;let i=this._getSelectedLinkElement(),n=s();const o=()=>{const e=this._getSelectedLinkElement(),t=s();i&&!e||!i&&t!==n?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),i=e,n=t};function s(){return t.selection.focus.getAncestors().reverse().find((e=>e.is("element")))}this.listenTo(e.ui,"update",o),this.listenTo(this._balloon,"change:visibleView",o)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _areActionsInPanel(){return!!this.actionsView&&this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return!!this.actionsView&&this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){const e=this._balloon.visibleView;return!!this.formView&&e==this.formView||this._areActionsVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=this.editor.model,i=e.document;let n;if(t.markers.has(J)){const t=Array.from(this.editor.editing.mapper.markerNameToElements(J)),i=e.createRange(e.createPositionBefore(t[0]),e.createPositionAfter(t[t.length-1]));n=e.domConverter.viewRangeToDom(i)}else n=()=>{const t=this._getSelectedLinkElement();return t?e.domConverter.mapViewToDom(t):e.domConverter.viewRangeToDom(i.selection.getFirstRange())};return{target:n}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection,i=t.getSelectedElement();if(t.isCollapsed||i&&(0,q.p4)(i))return Y(t.getFirstPosition());{const i=t.getFirstRange().getTrimmed(),n=Y(i.start),o=Y(i.end);return n&&n==o&&e.createRangeIn(n).getTrimmed().isEqual(i)?n:null}}_showFakeVisualSelection(){const e=this.editor.model;e.change((t=>{const i=e.document.selection.getFirstRange();if(e.markers.has(J))t.updateMarker(J,{range:i});else if(i.start.isAtEnd){const n=i.start.getLastMatchingPosition((({item:t})=>!e.schema.isContent(t)),{boundaries:i});t.addMarker(J,{usingOperation:!1,affectsData:!1,range:t.createRange(n,i.end)})}else t.addMarker(J,{usingOperation:!1,affectsData:!1,range:i})}))}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(J)&&e.change((e=>{e.removeMarker(J)}))}}function Y(e){return e.getAncestors().find((e=>{return(t=e).is("attributeElement")&&!!t.getCustomProperty("link");var t}))||null}const X=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 ee extends n.k_{static get requires(){return[o.ep,U]}static get pluginName(){return"AutoLink"}init(){const e=this.editor.model.document.selection;e.on("change:range",(()=>{this.isEnabled=!e.anchor.parent.is("element","codeBlock")})),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling(),this._enablePasteLinking()}_expandLinkRange(e,t){return t.textNode&&t.textNode.hasAttribute("linkHref")?(0,o.Py)(t,"linkHref",t.textNode.getAttribute("linkHref"),e):null}_selectEntireLinks(e,t){const i=this.editor.model,n=i.document.selection,o=n.getFirstPosition(),s=n.getLastPosition();let r=t.getJoined(this._expandLinkRange(i,o)||t);r&&(r=r.getJoined(this._expandLinkRange(i,s)||t)),r&&(r.start.isBefore(o)||r.end.isAfter(s))&&e.setSelection(r)}_enablePasteLinking(){const e=this.editor,t=e.model,i=t.document.selection,n=e.plugins.get("ClipboardPipeline"),o=e.commands.get("link");n.on("inputTransformation",((e,n)=>{if(!this.isEnabled||!o.isEnabled||i.isCollapsed||"paste"!==n.method)return;if(i.rangeCount>1)return;const s=i.getFirstRange(),r=n.dataTransfer.getData("text/plain");if(!r)return;const a=r.match(X);a&&a[2]===r&&(t.change((e=>{this._selectEntireLinks(e,s),o.execute(r)})),e.stop())}),{priority:"high"})}_enableTypingHandling(){const e=this.editor,t=new o.qV(e.model,(e=>{if(!function(e){return e.length>4&&" "===e[e.length-1]&&" "!==e[e.length-2]}(e))return;const t=te(e.substr(0,e.length-1));return t?{url:t}:void 0}));t.on("matched:data",((t,i)=>{const{batch:n,range:o,url:s}=i;if(!n.isTyping)return;const r=o.end.getShiftedBy(-1),a=r.getShiftedBy(-s.length),l=e.model.createRange(a,r);this._applyAutoLink(s,l)})),t.bind("isEnabled").to(this)}_enableEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("enter");i&&i.on("execute",(()=>{const e=t.document.selection.getFirstPosition();if(!e.parent.previousSibling)return;const i=t.createRangeIn(e.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(i)}))}_enableShiftEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("shiftEnter");i&&i.on("execute",(()=>{const e=t.document.selection.getFirstPosition(),i=t.createRange(t.createPositionAt(e.parent,0),e.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(i)}))}_checkAndApplyAutoLinkOnRange(e){const t=this.editor.model,{text:i,range:n}=(0,o.ex)(e,t),s=te(i);if(s){const e=t.createRange(n.end.getShiftedBy(-s.length),n.end);this._applyAutoLink(s,e)}}_applyAutoLink(e,t){const i=this.editor.model,n=M(e,this.editor.config.get("link.defaultProtocol"));this.isEnabled&&function(e,t){return t.schema.checkAttributeInSelection(t.createSelection(e),"linkHref")}(t,i)&&O(n)&&!function(e){const t=e.start.nodeAfter;return!!t&&t.hasAttribute("linkHref")}(t)&&this._persistAutoLink(n,t)}_persistAutoLink(e,t){const i=this.editor.model,n=this.editor.plugins.get("Delete");i.enqueueChange((o=>{o.setAttribute("linkHref",e,t),i.enqueueChange((()=>{n.requestUndoOnBackspace()}))}))}}function te(e){const t=X.exec(e);return t?t[2]:null}class ie extends n.k_{static get requires(){return[U,Q,ee]}static get pluginName(){return"Link"}}class ne extends n.k_{static get requires(){return["ImageEditing","ImageUtils",U]}static get pluginName(){return"LinkImageEditing"}afterInit(){const e=this.editor,t=e.model.schema;e.plugins.has("ImageBlockEditing")&&t.extend("imageBlock",{allowAttributes:["linkHref"]}),e.conversion.for("upcast").add(function(e){const t=e.plugins.has("ImageInlineEditing"),i=e.plugins.get("ImageUtils");return e=>{e.on("element:a",((e,n,o)=>{const s=n.viewItem,r=i.findViewImgElement(s);if(!r)return;const a=r.findAncestor((e=>i.isBlockImageView(e)));if(t&&!a)return;if(!o.consumable.consume(s,{attributes:["href"]}))return;const l=s.getAttribute("href");if(!l)return;let c=n.modelCursor.parent;if(!c.is("element","imageBlock")){const e=o.convertItem(r,n.modelCursor);n.modelRange=e.modelRange,n.modelCursor=e.modelCursor,c=n.modelCursor.nodeBefore}c&&c.is("element","imageBlock")&&o.writer.setAttribute("linkHref",l,c)}),{priority:"high"})}}(e)),e.conversion.for("downcast").add(function(e){const t=e.plugins.get("ImageUtils");return e=>{e.on("attribute:linkHref:imageBlock",((e,i,n)=>{if(!n.consumable.consume(i.item,e.name))return;const o=n.mapper.toViewElement(i.item),s=n.writer,r=Array.from(o.getChildren()).find((e=>e.is("element","a"))),a=t.findViewImgElement(o),l=a.parent.is("element","picture")?a.parent:a;if(r)i.attributeNewValue?s.setAttribute("href",i.attributeNewValue,r):(s.move(s.createRangeOn(l),s.createPositionAt(o,0)),s.remove(r));else{const e=s.createContainerElement("a",{href:i.attributeNewValue});s.insert(s.createPositionAt(o,0),e),s.move(s.createRangeOn(l),s.createPositionAt(e,0))}}),{priority:"high"})}}(e)),this._enableAutomaticDecorators(),this._enableManualDecorators()}_enableAutomaticDecorators(){const e=this.editor,t=e.commands.get("link").automaticDecorators;t.length&&e.conversion.for("downcast").add(t.getDispatcherForLinkedImage())}_enableManualDecorators(){const e=this.editor,t=e.commands.get("link");for(const i of t.manualDecorators)e.plugins.has("ImageBlockEditing")&&e.model.schema.extend("imageBlock",{allowAttributes:i.id}),e.plugins.has("ImageInlineEditing")&&e.model.schema.extend("imageInline",{allowAttributes:i.id}),e.conversion.for("downcast").add(oe(i)),e.conversion.for("upcast").add(se(e,i))}}function oe(e){return t=>{t.on(`attribute:${e.id}:imageBlock`,((t,i,n)=>{const o=n.mapper.toViewElement(i.item),s=Array.from(o.getChildren()).find((e=>e.is("element","a")));if(s){for(const[t,i]of(0,r.av)(e.attributes))n.writer.setAttribute(t,i,s);e.classes&&n.writer.addClass(e.classes,s);for(const t in e.styles)n.writer.setStyle(t,e.styles[t],s)}}))}}function se(e,t){const i=e.plugins.has("ImageInlineEditing"),n=e.plugins.get("ImageUtils");return e=>{e.on("element:a",((e,o,s)=>{const r=o.viewItem,a=n.findViewImgElement(r);if(!a)return;const l=a.findAncestor((e=>n.isBlockImageView(e)));if(i&&!l)return;const c=new $.PN(t._createPattern()).match(r);if(!c)return;if(!s.consumable.consume(r,c.match))return;const d=o.modelCursor.nodeBefore||o.modelCursor.parent;s.writer.setAttribute(t.id,!0,d)}),{priority:"high"})}}class re extends n.k_{static get requires(){return[U,Q,"ImageBlockEditing"]}static get pluginName(){return"LinkImageUI"}init(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",((t,i)=>{this._isSelectedLinkedImage(e.model.document.selection)&&(i.preventDefault(),t.stop())}),{priority:"high"}),this._createToolbarLinkImageButton()}_createToolbarLinkImageButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("linkImage",(i=>{const n=new j._(i),o=e.plugins.get("LinkUI"),s=e.commands.get("link");return n.set({isEnabled:!0,label:t("Link image"),icon:Z,keystroke:S,tooltip:!0,isToggleable:!0}),n.bind("isEnabled").to(s,"isEnabled"),n.bind("isOn").to(s,"value",(e=>!!e)),this.listenTo(n,"execute",(()=>{this._isSelectedLinkedImage(e.model.document.selection)?o._addActionsView():o._showUI(!0)})),n}))}_isSelectedLinkedImage(e){const t=e.getSelectedElement();return this.editor.plugins.get("ImageUtils").isImage(t)&&t.hasAttribute("linkHref")}}class ae extends n.k_{static get requires(){return[ne,re]}static get pluginName(){return"LinkImage"}}},3312:(e,t,i)=>{"use strict";i.r(t),i.d(t,{AdjacentListsSupport:()=>Lt,DocumentList:()=>Nt,DocumentListProperties:()=>Dt,LegacyIndentCommand:()=>De,LegacyList:()=>gt,LegacyListEditing:()=>ht,LegacyListProperties:()=>Et,LegacyListPropertiesEditing:()=>vt,LegacyListUtils:()=>Ye,LegacyTodoList:()=>Ot,LegacyTodoListEditing:()=>Bt,List:()=>ee,ListCommand:()=>V,ListEditing:()=>G,ListIndentCommand:()=>I,ListProperties:()=>Ae,ListPropertiesEditing:()=>be,ListPropertiesUI:()=>ve,ListPropertiesUtils:()=>me,ListUI:()=>X,ListUtils:()=>M,TodoDocumentList:()=>zt,TodoList:()=>Oe,TodoListEditing:()=>Ie,TodoListUI:()=>Me});var n=i(1204),o=i(7211),s=i(6449),r=i(5318);class a{constructor(e,t){this._startElement=e,this._referenceIndent=e.getAttribute("listIndent"),this._isForward="forward"==t.direction,this._includeSelf=!!t.includeSelf,this._sameAttributes=(0,r.$r)(t.sameAttributes||[]),this._sameIndent=!!t.sameIndent,this._lowerIndent=!!t.lowerIndent,this._higherIndent=!!t.higherIndent}static first(e,t){const i=new this(e,t)[Symbol.iterator]();return(0,r.$1)(i)}*[Symbol.iterator](){const e=[];for(const{node:t}of l(this._getStartNode(),this._isForward?"forward":"backward")){const i=t.getAttribute("listIndent");if(i<this._referenceIndent){if(!this._lowerIndent)break;this._referenceIndent=i}else if(i>this._referenceIndent){if(!this._higherIndent)continue;if(!this._isForward){e.push(t);continue}}else{if(!this._sameIndent){if(this._higherIndent){e.length&&(yield*e,e.length=0);break}continue}if(this._sameAttributes.some((e=>t.getAttribute(e)!==this._startElement.getAttribute(e))))break}e.length&&(yield*e,e.length=0),yield t}}_getStartNode(){return this._includeSelf?this._startElement:this._isForward?this._startElement.nextSibling:this._startElement.previousSibling}}function*l(e,t="forward"){const i="forward"==t,n=[];let o=null;for(;u(e);){let t=null;if(o){const i=e.getAttribute("listIndent"),s=o.getAttribute("listIndent");i>s?n[s]=o:i<s?(t=n[i],n.length=i):t=o}yield{node:e,previous:o,previousNodeInList:t},o=e,e=i?e.nextSibling:e.previousSibling}}class c{constructor(e){this._listHead=e}[Symbol.iterator](){return l(this._listHead,"forward")}}class d{static next(){return(0,r.Ld)()}}function u(e){return!!e&&e.is("element")&&e.hasAttribute("listItemId")}function h(e,t={}){return[...m(e,{...t,direction:"backward"}),...m(e,{...t,direction:"forward"})]}function m(e,t={}){const i="forward"==t.direction,n=Array.from(new a(e,{...t,includeSelf:i,sameIndent:!0,sameAttributes:"listItemId"}));return i?n:n.reverse()}function g(e,t){const i=new a(e,{sameIndent:!0,sameAttributes:"listType",...t}),n=new a(e,{sameIndent:!0,sameAttributes:"listType",includeSelf:!0,direction:"forward",...t});return[...Array.from(i).reverse(),...n]}function f(e){return!a.first(e,{sameIndent:!0,sameAttributes:"listItemId"})}function p(e){return!a.first(e,{direction:"forward",sameIndent:!0,sameAttributes:"listItemId"})}function b(e,t={}){e=(0,r.$r)(e);const i=!1!==t.withNested,n=new Set;for(const t of e)for(const e of h(t,{higherIndent:i}))n.add(e);return A(n)}function w(e){e=(0,r.$r)(e);const t=new Set;for(const i of e)for(const e of g(i))t.add(e);return A(t)}function v(e,t){const i=m(e,{direction:"forward"}),n=d.next();for(const e of i)t.setAttribute("listItemId",n,e);return i}function _(e,t,i){const n={};for(const[e,i]of t.getAttributes())e.startsWith("list")&&(n[e]=i);const o=m(e,{direction:"forward"});for(const e of o)i.setAttributes(n,e);return o}function y(e,t,{expand:i,indentBy:n=1}={}){e=(0,r.$r)(e);const o=i?b(e):e;for(const e of o){const i=e.getAttribute("listIndent")+n;i<0?k(e,t):t.setAttribute("listIndent",i,e)}return o}function k(e,t){e=(0,r.$r)(e);for(const i of e)i.is("element","listItem")&&t.rename(i,"paragraph");for(const i of e)for(const e of i.getAttributeKeys())e.startsWith("list")&&t.removeAttribute(e,i);return e}function C(e){if(!e.length)return!1;const t=e[0].getAttribute("listItemId");return!!t&&!e.some((e=>e.getAttribute("listItemId")!=t))}function A(e){return Array.from(e).filter((e=>"$graveyard"!==e.root.rootName)).sort(((e,t)=>e.index-t.index))}function E(e){const t=e.document.selection.getSelectedElement();return t&&e.schema.isObject(t)&&e.schema.isBlock(t)?t:null}function x(e,t){return t.checkChild(e.parent,"listItem")&&t.checkChild(e,"$text")&&!t.isObject(e)}function T(e){return"numbered"==e||"customNumbered"==e}function P(e,t,i){return m(t,{direction:"forward"}).pop().index>e.index?_(e,t,i):[]}class I extends n.uB{constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model,t=S(e.document.selection);e.change((e=>{const i=[];C(t)&&!f(t[0])?("forward"==this._direction&&i.push(...y(t,e)),i.push(...v(t[0],e))):"forward"==this._direction?i.push(...y(t,e,{expand:!0})):i.push(...function(e,t){const i=b(e=(0,r.$r)(e)),n=new Set,o=Math.min(...i.map((e=>e.getAttribute("listIndent")))),s=new Map;for(const e of i)s.set(e,a.first(e,{lowerIndent:!0}));for(const e of i){if(n.has(e))continue;n.add(e);const i=e.getAttribute("listIndent")-1;if(i<0)k(e,t);else{if(e.getAttribute("listIndent")==o){const i=P(e,s.get(e),t);for(const e of i)n.add(e);if(i.length)continue}t.setAttribute("listIndent",i,e)}}return A(n)}(t,e));for(const t of i){if(!t.hasAttribute("listType"))continue;const i=a.first(t,{sameIndent:!0});i&&e.setAttribute("listType",i.getAttribute("listType"),t)}this._fireAfterExecute(i)}))}_fireAfterExecute(e){this.fire("afterExecute",A(new Set(e)))}_checkEnabled(){let e=S(this.editor.model.document.selection),t=e[0];if(!t)return!1;if("backward"==this._direction)return!0;if(C(e)&&!f(e[0]))return!0;e=b(e),t=e[0];const i=a.first(t,{sameIndent:!0});return!!i&&i.getAttribute("listType")==t.getAttribute("listType")}}function S(e){const t=Array.from(e.getSelectedBlocks()),i=t.findIndex((e=>!u(e)));return-1!=i&&(t.length=i),t}class V extends n.uB{constructor(e,t,i={}){super(e),this.type=t,this._listWalkerOptions=i.multiLevel?{higherIndent:!0,lowerIndent:!0,sameAttributes:[]}:void 0}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,i=t.document,n=E(t),o=Array.from(i.selection.getSelectedBlocks()).filter((e=>t.schema.checkAttribute(e,"listType")||x(e,t.schema))),s=void 0!==e.forceValue?!e.forceValue:this.value;t.change((r=>{if(s){const e=o[o.length-1],t=m(e,{direction:"forward"}),i=[];t.length>1&&i.push(...v(t[1],r)),i.push(...k(o,r)),i.push(...function(e,t){const i=[];let n=Number.POSITIVE_INFINITY;for(const{node:o}of l(e.nextSibling,"forward")){const e=o.getAttribute("listIndent");if(0==e)break;e<n&&(n=e);const s=e-n;t.setAttribute("listIndent",s,o),i.push(o)}return i}(e,r)),this._fireAfterExecute(i)}else if((n||i.selection.isCollapsed)&&u(o[0])){const t=g(n||o[0],this._listWalkerOptions);for(const i of t)r.setAttributes({...e.additionalAttributes,listType:this.type},i);this._fireAfterExecute(t)}else{const i=[];for(const n of o)if(n.hasAttribute("listType"))for(const t of b(n,{withNested:!1}))t.getAttribute("listType")!=this.type&&(r.setAttributes({...e.additionalAttributes,listType:this.type},t),i.push(t));else!n.is("element","listItem")&&x(n,t.schema)&&r.rename(n,"listItem"),r.setAttributes({...e.additionalAttributes,listIndent:0,listItemId:d.next(),listType:this.type},n),i.push(n);this._fireAfterExecute(i)}}))}_fireAfterExecute(e){this.fire("afterExecute",A(new Set(e)))}_getValue(){const e=this.editor.model.document.selection,t=Array.from(e.getSelectedBlocks());if(!t.length)return!1;for(const e of t)if(e.getAttribute("listType")!=this.type)return!1;return!0}_checkEnabled(){const e=this.editor.model,t=e.schema,i=e.document.selection,n=Array.from(i.getSelectedBlocks());if(!n.length)return!1;if(this.value)return!0;for(const e of n)if(t.checkAttribute(e,"listType")||x(e,t))return!0;return!1}}class R extends n.uB{constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute({shouldMergeOnBlocksContentLevel:e=!1}={}){const t=this.editor.model,i=t.document.selection,n=[];t.change((o=>{const{firstElement:s,lastElement:r}=this._getMergeSubjectElements(i,e),l=s.getAttribute("listIndent")||0,c=r.getAttribute("listIndent"),d=r.getAttribute("listItemId");if(l!=c){const e=(u=r,Array.from(new a(u,{direction:"forward",higherIndent:!0})));n.push(...y([r,...e],o,{indentBy:l-c,expand:l<c}))}var u;if(e){let e=i;i.isCollapsed&&(e=o.createSelection(o.createRange(o.createPositionAt(s,"end"),o.createPositionAt(r,0)))),t.deleteContent(e,{doNotResetEntireContent:i.isCollapsed});const a=e.getLastPosition().parent,l=a.nextSibling;n.push(a),l&&l!==r&&l.getAttribute("listItemId")==d&&n.push(..._(l,a,o))}else n.push(..._(r,s,o));this._fireAfterExecute(n)}))}_fireAfterExecute(e){this.fire("afterExecute",A(new Set(e)))}_checkEnabled(){const e=this.editor.model,t=e.document.selection,i=E(e);if(t.isCollapsed||i){const e=i||t.getFirstPosition().parent;if(!u(e))return!1;const n="backward"==this._direction?e.previousSibling:e.nextSibling;if(!n)return!1;if(C([e,n]))return!1}else{const e=t.getLastPosition(),i=t.getFirstPosition();if(e.parent===i.parent)return!1;if(!u(e.parent))return!1}return!0}_getMergeSubjectElements(e,t){const i=E(this.editor.model);let n,o;if(e.isCollapsed||i){const s=i||e.getFirstPosition().parent,r=f(s);"backward"==this._direction?(o=s,n=r&&!t?a.first(s,{sameIndent:!0,lowerIndent:!0}):s.previousSibling):(n=s,o=s.nextSibling)}else n=e.getFirstPosition().parent,o=e.getLastPosition().parent;return{firstElement:n,lastElement:o}}}class B extends n.uB{constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute(){this.editor.model.change((e=>{const t=v(this._getStartBlock(),e);this._fireAfterExecute(t)}))}_fireAfterExecute(e){this.fire("afterExecute",A(new Set(e)))}_checkEnabled(){const e=this.editor.model.document.selection,t=this._getStartBlock();return e.isCollapsed&&u(t)&&!f(t)}_getStartBlock(){const e=this.editor.model.document.selection.getFirstPosition().parent;return"before"==this._direction?e:e.nextSibling}}class M extends n.k_{static get pluginName(){return"ListUtils"}expandListBlocksToCompleteList(e){return w(e)}isFirstBlockOfListItem(e){return f(e)}isListItemBlock(e){return u(e)}expandListBlocksToCompleteItems(e,t={}){return b(e,t)}isNumberedListType(e){return T(e)}}function O(e){return e.is("element","ol")||e.is("element","ul")}function L(e){return e.is("element","li")}function F(e,t,i,n=z(i,t)){return e.createAttributeElement(D(i),null,{priority:2*t/100-100,id:n})}function N(e,t,i){return e.createAttributeElement("li",null,{priority:(2*t+1)/100-100,id:i})}function D(e){return"numbered"==e||"customNumbered"==e?"ol":"ul"}function z(e,t){return`list-${e}-${t}`}function W(e,t){const i=e.nodeBefore;if(u(i)){let e=i;for(const{node:i}of l(e,"backward"))if(e=i,t.has(e))return;t.set(i,e)}else{const i=e.nodeAfter;u(i)&&t.set(i,i)}}function H(e,t,i,{dataPipeline:n}={}){const o=function(e){return(t,i)=>{const n=[];for(const i of e)t.hasAttribute(i)&&n.push(`attribute:${i}`);return!!n.every((e=>!1!==i.test(t,e)))&&(n.forEach((e=>i.consume(t,e))),!0)}}(e);return(s,r,l)=>{const{writer:c,mapper:d,consumable:u}=l,h=r.item;if(!e.includes(r.attributeKey))return;if(!o(h,u))return;const m=function(e,t,i){const n=i.createRangeOn(e);return t.toViewRange(n).getTrimmed().end.nodeBefore}(h,d,i);$(m,c,d),function(e,t){let i=e.parent;for(;i.is("attributeElement")&&["ul","ol","li"].includes(i.name);){const n=i.parent;t.unwrap(t.createRangeOn(e),i),i=n}}(m,c);const g=function(e,t,i,n,{dataPipeline:o}){let s=n.createRangeOn(t);if(!f(e))return s;for(const r of i){if("itemMarker"!=r.scope)continue;const i=r.createElement(n,e,{dataPipeline:o});if(!i)continue;if(n.setCustomProperty("listItemMarker",!0,i),r.canInjectMarkerIntoElement&&r.canInjectMarkerIntoElement(e)?n.insert(n.createPositionAt(t,0),i):(n.insert(s.start,i),s=n.createRange(n.createPositionBefore(i),n.createPositionAfter(t))),!r.createWrapperElement||!r.canWrapElement)continue;const a=r.createWrapperElement(n,e,{dataPipeline:o});n.setCustomProperty("listItemWrapper",!0,a),r.canWrapElement(e)?s=n.wrap(s,a):(s=n.wrap(n.createRangeOn(i),a),s=n.createRange(s.start,n.createPositionAfter(t)))}return s}(h,m,t,c,{dataPipeline:n});!function(e,t,i,n){if(!e.hasAttribute("listIndent"))return;const o=e.getAttribute("listIndent");let s=e;for(let e=o;e>=0;e--){const o=N(n,e,s.getAttribute("listItemId")),r=F(n,e,s.getAttribute("listType"));for(const e of i)"list"!=e.scope&&"item"!=e.scope||!s.hasAttribute(e.attributeName)||e.setAttributeOnDowncast(n,s.getAttribute(e.attributeName),"list"==e.scope?r:o);if(t=n.wrap(t,o),t=n.wrap(t,r),0==e)break;if(s=a.first(s,{lowerIndent:!0}),!s)break}}(h,g,t,c)}}function U(e,{dataPipeline:t}={}){return(i,{writer:n})=>{if(!j(i,e))return null;if(!t)return n.createContainerElement("span",{class:"ck-list-bogus-paragraph"});const o=n.createContainerElement("p");return n.setCustomProperty("dataPipeline:transparentRendering",!0,o),o}}function $(e,t,i){for(;e.parent.is("attributeElement")&&e.parent.getCustomProperty("listItemWrapper");)t.unwrap(t.createRangeOn(e),e.parent);const n=[];o(t.createPositionBefore(e).getWalker({direction:"backward"})),o(t.createRangeIn(e).getWalker());for(const e of n)t.remove(e);function o(e){for(const{item:t}of e){if(t.is("element")&&i.toModelElement(t))break;t.is("element")&&t.getCustomProperty("listItemMarker")&&n.push(t)}}}function j(e,t,i=h(e)){if(!u(e))return!1;for(const i of e.getAttributeKeys())if(!i.startsWith("selection:")&&!t.includes(i))return!1;return i.length<2}var q=i(7377);const K=["listType","listIndent","listItemId"];class G extends n.k_{static get pluginName(){return"ListEditing"}static get requires(){return[s.x,o.ep,M,q.xz]}constructor(e){super(e),this._downcastStrategies=[],e.config.define("list.multiBlock",!0)}init(){const e=this.editor,t=e.model,i=e.config.get("list.multiBlock");if(e.plugins.has("LegacyListEditing"))throw new r.Yb("list-feature-conflict",this,{conflictPlugin:"LegacyListEditing"});t.schema.register("$listItem",{allowAttributes:K}),i?(t.schema.extend("$container",{allowAttributesOf:"$listItem"}),t.schema.extend("$block",{allowAttributesOf:"$listItem"}),t.schema.extend("$blockObject",{allowAttributesOf:"$listItem"})):t.schema.register("listItem",{inheritAllFrom:"$block",allowAttributesOf:"$listItem"});for(const e of K)t.schema.setAttributeProperties(e,{copyOnReplace:!0});e.commands.add("numberedList",new V(e,"numbered")),e.commands.add("bulletedList",new V(e,"bulleted")),e.commands.add("customNumberedList",new V(e,"customNumbered",{multiLevel:!0})),e.commands.add("customBulletedList",new V(e,"customBulleted",{multiLevel:!0})),e.commands.add("indentList",new I(e,"forward")),e.commands.add("outdentList",new I(e,"backward")),e.commands.add("splitListItemBefore",new B(e,"before")),e.commands.add("splitListItemAfter",new B(e,"after")),i&&(e.commands.add("mergeListItemBackward",new R(e,"backward")),e.commands.add("mergeListItemForward",new R(e,"forward"))),this._setupDeleteIntegration(),this._setupEnterIntegration(),this._setupTabIntegration(),this._setupClipboardIntegration(),this._setupAccessibilityIntegration()}afterInit(){const e=this.editor.commands,t=e.get("indent"),i=e.get("outdent");t&&t.registerChildCommand(e.get("indentList"),{priority:"high"}),i&&i.registerChildCommand(e.get("outdentList"),{priority:"lowest"}),this._setupModelPostFixing(),this._setupConversion()}registerDowncastStrategy(e){this._downcastStrategies.push(e)}getListAttributeNames(){return[...K,...this._downcastStrategies.map((e=>e.attributeName))]}_setupDeleteIntegration(){const e=this.editor,t=e.commands.get("mergeListItemBackward"),i=e.commands.get("mergeListItemForward");this.listenTo(e.editing.view.document,"delete",((n,o)=>{const s=e.model.document.selection;E(e.model)||e.model.change((()=>{const r=s.getFirstPosition();if(s.isCollapsed&&"backward"==o.direction){if(!r.isAtStart)return;const i=r.parent;if(!u(i))return;if(a.first(i,{sameAttributes:"listType",sameIndent:!0})||0!==i.getAttribute("listIndent")){if(!t||!t.isEnabled)return;t.execute({shouldMergeOnBlocksContentLevel:Z(e.model,"backward")})}else p(i)||e.execute("splitListItemAfter"),e.execute("outdentList");o.preventDefault(),n.stop()}else{if(s.isCollapsed&&!s.getLastPosition().isAtEnd)return;if(!i||!i.isEnabled)return;i.execute({shouldMergeOnBlocksContentLevel:Z(e.model,"forward")}),o.preventDefault(),n.stop()}}))}),{context:"li"})}_setupEnterIntegration(){const e=this.editor,t=e.model,i=e.commands,n=i.get("enter");this.listenTo(e.editing.view.document,"enter",((i,n)=>{const o=t.document,s=o.selection.getFirstPosition().parent;if(o.selection.isCollapsed&&u(s)&&s.isEmpty&&!n.isSoft){const t=f(s),o=p(s);t&&o?(e.execute("outdentList"),n.preventDefault(),i.stop()):t&&!o?(e.execute("splitListItemAfter"),n.preventDefault(),i.stop()):o&&(e.execute("splitListItemBefore"),n.preventDefault(),i.stop())}}),{context:"li"}),this.listenTo(n,"afterExecute",(()=>{const t=i.get("splitListItemBefore");t.refresh(),t.isEnabled&&2===h(e.model.document.selection.getLastPosition().parent).length&&t.execute()}))}_setupTabIntegration(){const e=this.editor;this.listenTo(e.editing.view.document,"tab",((t,i)=>{const n=i.shiftKey?"outdentList":"indentList";this.editor.commands.get(n).isEnabled&&(e.execute(n),i.stopPropagation(),i.preventDefault(),t.stop())}),{context:"li"})}_setupConversion(){const e=this.editor,t=e.model,i=this.getListAttributeNames(),n=e.config.get("list.multiBlock"),o=n?"paragraph":"listItem";e.conversion.for("upcast").elementToElement({view:"li",model:(e,{writer:t})=>t.createElement(o,{listType:""})}).elementToElement({view:"p",model:(e,{writer:t})=>e.parent&&e.parent.is("element","li")?t.createElement(o,{listType:""}):null,converterPriority:"high"}).add((e=>{e.on("element:li",((e,t,i)=>{const{writer:n,schema:o}=i;if(!t.modelRange)return;const s=Array.from(t.modelRange.getItems({shallow:!0})).filter((e=>o.checkAttribute(e,"listItemId")));if(!s.length)return;const r=d.next(),a=function(e){let t=0,i=e.parent;for(;i;){if(L(i))t++;else{const e=i.previousSibling;e&&L(e)&&t++}i=i.parent}return t}(t.viewItem);let l=t.viewItem.parent&&t.viewItem.parent.is("element","ol")?"numbered":"bulleted";const c=s[0].getAttribute("listType");c&&(l=c);const u={listItemId:r,listIndent:a,listType:l};for(const e of s)e.hasAttribute("listItemId")||n.setAttributes(u,e);s.length>1&&s[1].getAttribute("listItemId")!=u.listItemId&&i.keepEmptyElement(s[0])}))})),n||e.conversion.for("downcast").elementToElement({model:"listItem",view:"p"}),e.conversion.for("editingDowncast").elementToElement({model:o,view:U(i),converterPriority:"high"}).add((e=>{var n;e.on("attribute",H(i,this._downcastStrategies,t)),e.on("remove",(n=t.schema,(e,t,i)=>{const{writer:o,mapper:s}=i,r=e.name.split(":")[1];if(!n.checkAttribute(r,"listItemId"))return;const a=s.toViewPosition(t.position),l=t.position.getShiftedBy(t.length),c=s.toViewPosition(l,{isPhantom:!0}),d=o.createRange(a,c).getTrimmed().end.nodeBefore;d&&$(d,o,s)}))})),e.conversion.for("dataDowncast").elementToElement({model:o,view:U(i,{dataPipeline:!0}),converterPriority:"high"}).add((e=>{e.on("attribute",H(i,this._downcastStrategies,t,{dataPipeline:!0}))}));const s=(r=this._downcastStrategies,a=e.editing.view,(e,t)=>{if(t.modelPosition.offset>0)return;const i=t.modelPosition.parent;if(!u(i))return;if(!r.some((e=>"itemMarker"==e.scope&&e.canInjectMarkerIntoElement&&e.canInjectMarkerIntoElement(i))))return;const n=t.mapper.toViewElement(i),o=a.createRangeIn(n),s=o.getWalker();let l=o.start;for(const{item:e}of s){if(e.is("element")&&t.mapper.toModelElement(e)||e.is("$textProxy"))break;e.is("element")&&e.getCustomProperty("listItemMarker")&&(l=a.createPositionAfter(e),s.skip((({previousPosition:e})=>!e.isEqual(l))))}t.viewPosition=l});var r,a;e.editing.mapper.on("modelToViewPosition",s),e.data.mapper.on("modelToViewPosition",s),this.listenTo(t.document,"change:data",function(e,t,i,n){return()=>{const n=e.document.differ.getChanges(),r=[],a=new Map,l=new Set;for(const e of n)if("insert"==e.type&&"$text"!=e.name)W(e.position,a),e.attributes.has("listItemId")?l.add(e.position.nodeAfter):W(e.position.getShiftedBy(e.length),a);else if("remove"==e.type&&e.attributes.has("listItemId"))W(e.position,a);else if("attribute"==e.type){const t=e.range.start.nodeAfter;i.includes(e.attributeKey)?(W(e.range.start,a),null===e.attributeNewValue?(W(e.range.start.getShiftedBy(1),a),s(t)&&r.push(t)):l.add(t)):u(t)&&s(t)&&r.push(t)}for(const e of a.values())r.push(...o(e,l));for(const e of new Set(r))t.reconvertItem(e)};function o(e,t){const n=[],o=new Set,a=[];for(const{node:c,previous:d}of l(e,"forward")){if(o.has(c))continue;const e=c.getAttribute("listIndent");d&&e<d.getAttribute("listIndent")&&(a.length=e+1),a[e]=Object.fromEntries(Array.from(c.getAttributes()).filter((([e])=>i.includes(e))));const l=m(c,{direction:"forward"});for(const e of l)o.add(e),(s(e,l)||r(e,a,t))&&n.push(e)}return n}function s(e,o){const s=t.mapper.toViewElement(e);if(!s)return!1;if(n.fire("checkElement",{modelElement:e,viewElement:s}))return!0;if(!e.is("element","paragraph")&&!e.is("element","listItem"))return!1;const r=j(e,i,o);return!(!r||!s.is("element","p"))||!(r||!s.is("element","span"))}function r(e,i,o){if(o.has(e))return!1;const s=t.mapper.toViewElement(e);let r=i.length-1;for(let e=s.parent;!e.is("editableElement");e=e.parent){const t=L(e),o=O(e);if(!o&&!t)continue;const s="checkAttributes:"+(t?"item":"list");if(n.fire(s,{viewElement:e,modelAttributes:i[r]}))break;if(o&&(r--,r<0))return!1}return!0}}(t,e.editing,i,this),{priority:"high"}),this.on("checkAttributes:item",((e,{viewElement:t,modelAttributes:i})=>{t.id!=i.listItemId&&(e.return=!0,e.stop())})),this.on("checkAttributes:list",((e,{viewElement:t,modelAttributes:i})=>{t.name==D(i.listType)&&t.id==z(i.listType,i.listIndent)||(e.return=!0,e.stop())}))}_setupModelPostFixing(){const e=this.editor.model,t=this.getListAttributeNames();e.document.registerPostFixer((i=>function(e,t,i,n){const o=e.document.differ.getChanges(),s=new Map,r=n.editor.config.get("list.multiBlock");let a=!1;for(const n of o){if("insert"==n.type&&"$text"!=n.name){const o=n.position.nodeAfter;if(!e.schema.checkAttribute(o,"listItemId"))for(const e of Array.from(o.getAttributeKeys()))i.includes(e)&&(t.removeAttribute(e,o),a=!0);W(n.position,s),n.attributes.has("listItemId")||W(n.position.getShiftedBy(n.length),s);for(const{item:t,previousPosition:i}of e.createRangeIn(o))u(t)&&W(i,s)}else"remove"==n.type?W(n.position,s):"attribute"==n.type&&i.includes(n.attributeKey)&&(W(n.range.start,s),null===n.attributeNewValue&&W(n.range.start.getShiftedBy(1),s));if(!r&&"attribute"==n.type&&K.includes(n.attributeKey)){const e=n.range.start.nodeAfter;null===n.attributeNewValue&&e&&e.is("element","listItem")?(t.rename(e,"paragraph"),a=!0):null===n.attributeOldValue&&e&&e.is("element")&&"listItem"!=e.name&&(t.rename(e,"listItem"),a=!0)}}const l=new Set;for(const e of s.values())a=n.fire("postFixer",{listNodes:new c(e),listHead:e,writer:t,seenIds:l})||a;return a}(e,i,t,this))),this.on("postFixer",((e,{listNodes:t,writer:i})=>{e.return=function(e,t){let i=0,n=-1,o=null,s=!1;for(const{node:r}of e){const e=r.getAttribute("listIndent");if(e>i){let a;null===o?(o=e-i,a=i):(o>e&&(o=e),a=e-o),a>n+1&&(a=n+1),t.setAttribute("listIndent",a,r),s=!0,n=a}else o=null,i=e+1,n=e}return s}(t,i)||e.return}),{priority:"high"}),this.on("postFixer",((e,{listNodes:t,writer:i,seenIds:n})=>{e.return=function(e,t,i){const n=new Set;let o=!1;for(const{node:s}of e){if(n.has(s))continue;let e=s.getAttribute("listType"),r=s.getAttribute("listItemId");if(t.has(r)&&(r=d.next()),t.add(r),s.is("element","listItem"))s.getAttribute("listItemId")!=r&&(i.setAttribute("listItemId",r,s),o=!0);else for(const t of m(s,{direction:"forward"}))n.add(t),t.getAttribute("listType")!=e&&(r=d.next(),e=t.getAttribute("listType")),t.getAttribute("listItemId")!=r&&(i.setAttribute("listItemId",r,t),o=!0)}return o}(t,n,i)||e.return}),{priority:"high"})}_setupClipboardIntegration(){const e=this.editor.model,t=this.editor.plugins.get("ClipboardPipeline");this.listenTo(e,"insertContent",function(e){return(t,[i,n])=>{const o=i.is("documentFragment")?Array.from(i.getChildren()):[i];if(!o.length)return;const s=(n?e.createSelection(n):e.document.selection).getFirstPosition();let r;if(u(s.parent))r=s.parent;else{if(!u(s.nodeBefore))return;r=s.nodeBefore}e.change((e=>{const t=r.getAttribute("listType"),i=r.getAttribute("listIndent"),n=o[0].getAttribute("listIndent")||0,s=Math.max(i-n,0);for(const i of o){const n=u(i);r.is("element","listItem")&&i.is("element","paragraph")&&e.rename(i,"listItem"),e.setAttributes({listIndent:(n?i.getAttribute("listIndent"):0)+s,listItemId:n?i.getAttribute("listItemId"):d.next(),listType:t},i)}}))}}(e),{priority:"high"}),this.listenTo(t,"outputTransformation",((t,i)=>{e.change((e=>{const t=Array.from(i.content.getChildren()),n=t[t.length-1];if(t.length>1&&n.is("element")&&n.isEmpty&&t.slice(0,-1).every(u)&&e.remove(n),"copy"==i.method||"cut"==i.method){const t=Array.from(i.content.getChildren());C(t)&&k(t,e)}}))}))}_setupAccessibilityIntegration(){const e=this.editor,t=e.t;e.accessibility.addKeystrokeInfoGroup({id:"list",label:t("Keystrokes that can be used in a list"),keystrokes:[{label:t("Increase list item indent"),keystroke:"Tab"},{label:t("Decrease list item indent"),keystroke:"Shift+Tab"}]})}}function Z(e,t){const i=e.document.selection;if(!i.isCollapsed)return!E(e);if("forward"===t)return!0;const n=i.getFirstPosition().parent,o=n.previousSibling;return!e.schema.isObject(o)&&(!!o.isEmpty||C([n,o]))}var J=i(949);function Q(e,t,i,n){e.ui.componentFactory.add(t,(()=>{const o=Y(J._,e,t,i,n);return o.set({tooltip:!0,isToggleable:!0}),o})),e.ui.componentFactory.add(`menuBar:${t}`,(()=>{const o=Y(J.kS,e,t,i,n);return o.set({role:"menuitemcheckbox",isToggleable:!0}),o}))}function Y(e,t,i,n,o){const s=t.commands.get(i),r=new e(t.locale);return r.set({label:n,icon:o}),r.bind("isOn","isEnabled").to(s,"value","isEnabled"),r.on("execute",(()=>{t.execute(i),t.editing.view.focus()})),r}class X extends n.k_{static get pluginName(){return"ListUI"}init(){const e=this.editor.t;this.editor.ui.componentFactory.has("numberedList")||Q(this.editor,"numberedList",e("Numbered List"),n.Pt.numberedList),this.editor.ui.componentFactory.has("bulletedList")||Q(this.editor,"bulletedList",e("Bulleted List"),n.Pt.bulletedList)}}class ee extends n.k_{static get requires(){return[G,X]}static get pluginName(){return"List"}}class te extends n.uB{refresh(){const e=this._getValue();this.value=e,this.isEnabled=null!=e}execute({startIndex:e=1}={}){const t=this.editor.model,i=t.document;let n=Array.from(i.selection.getSelectedBlocks()).filter((e=>u(e)&&T(e.getAttribute("listType"))));n=w(n),t.change((t=>{for(const i of n)t.setAttribute("listStart",e>=0?e:1,i)}))}_getValue(){const e=this.editor.model.document,t=(0,r.$1)(e.selection.getSelectedBlocks());return t&&u(t)&&T(t.getAttribute("listType"))?t.getAttribute("listStart"):null}}const ie={},ne={},oe={},se=[{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:e,typeAttribute:t,listType:i}of se)ie[e]=i,ne[e]=t,t&&(oe[t]=e);function re(){return se.map((e=>e.listStyle))}function ae(e){return ie[e]||null}function le(e){return oe[e]||null}function ce(e){return ne[e]||null}class de extends n.uB{constructor(e,t,i){super(e),this.defaultType=t,this._supportedTypes=i}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,i=t.document;t.change((t=>{this._tryToConvertItemsToList(e);let n=Array.from(i.selection.getSelectedBlocks()).filter((e=>e.hasAttribute("listType")));if(n.length){n=w(n);for(const i of n)t.setAttribute("listStyle",e.type||this.defaultType,i)}}))}isStyleTypeSupported(e){return!this._supportedTypes||this._supportedTypes.includes(e)}_getValue(){const e=(0,r.$1)(this.editor.model.document.selection.getSelectedBlocks());return u(e)?e.getAttribute("listStyle"):null}_checkEnabled(){const e=this.editor,t=e.commands.get("numberedList"),i=e.commands.get("bulletedList");return t.isEnabled||i.isEnabled}_tryToConvertItemsToList(e){if(!e.type)return;const t=ae(e.type);if(!t)return;const i=this.editor,n=`${t}List`;i.commands.get(n).value||i.execute(n)}}class ue extends n.uB{refresh(){const e=this._getValue();this.value=e,this.isEnabled=null!=e}execute(e={}){const t=this.editor.model,i=t.document;let n=Array.from(i.selection.getSelectedBlocks()).filter((e=>u(e)&&"numbered"==e.getAttribute("listType")));n=w(n),t.change((t=>{for(const i of n)t.setAttribute("listReversed",!!e.reversed,i)}))}_getValue(){const e=this.editor.model.document,t=(0,r.$1)(e.selection.getSelectedBlocks());return u(t)&&"numbered"==t.getAttribute("listType")?t.getAttribute("listReversed"):null}}function he(e){return(t,i,n)=>{const{writer:o,schema:s,consumable:r}=n;if(!1===r.test(i.viewItem,e.viewConsumables))return;i.modelRange||Object.assign(i,n.convertChildren(i.viewItem,i.modelCursor));let a=!1;for(const t of i.modelRange.getItems({shallow:!0}))s.checkAttribute(t,e.attributeName)&&e.appliesToListItem(t)&&(t.hasAttribute(e.attributeName)||(o.setAttribute(e.attributeName,e.getAttributeOnUpcast(i.viewItem),t),a=!0));a&&r.consume(i.viewItem,e.viewConsumables)}}class me extends n.k_{static get pluginName(){return"ListPropertiesUtils"}getAllSupportedStyleTypes(){return re()}getListTypeFromListStyleType(e){return ae(e)}getListStyleTypeFromTypeAttribute(e){return le(e)}getTypeAttributeFromListStyleType(e){return ce(e)}}function ge(e){const{startIndex:t,reversed:i,styles:n}=e;return{styles:fe(n),startIndex:t||!1,reversed:i||!1}}function fe(e){const t={listTypes:["bulleted","numbered"],useAttribute:!1};return!0===e||(e?Array.isArray(e)||"string"==typeof e?t.listTypes=(0,r.$r)(e):(t.listTypes=e.listTypes?(0,r.$r)(e.listTypes):t.listTypes,t.useAttribute=!!e.useAttribute):t.listTypes=[]),t}const pe="default";class be extends n.k_{static get requires(){return[G,me]}static get pluginName(){return"ListPropertiesEditing"}constructor(e){super(e),e.config.define("list.properties",{styles:!0,startIndex:!1,reversed:!1})}init(){const e=this.editor,t=e.model,i=e.plugins.get(G),n=function(e){const t=[],i=ge(e);if(e.styles){const e=i.styles.useAttribute;t.push({attributeName:"listStyle",defaultValue:pe,viewConsumables:{styles:"list-style-type"},addCommand(t){let i=re();e&&(i=i.filter((e=>!!ce(e)))),t.commands.add("listStyle",new de(t,pe,i))},appliesToListItem:e=>"numbered"==e.getAttribute("listType")||"bulleted"==e.getAttribute("listType"),hasValidAttribute(e){if(!this.appliesToListItem(e))return!e.hasAttribute("listStyle");if(!e.hasAttribute("listStyle"))return!1;const t=e.getAttribute("listStyle");return t==pe||ae(t)==e.getAttribute("listType")},setAttributeOnDowncast(t,i,n){if(i&&i!==pe){if(!e)return void t.setStyle("list-style-type",i,n);{const e=ce(i);if(e)return void t.setAttribute("type",e,n)}}t.removeStyle("list-style-type",n),t.removeAttribute("type",n)},getAttributeOnUpcast(e){const t=e.getStyle("list-style-type");if(t)return t;const i=e.getAttribute("type");return i?le(i):pe}})}return e.reversed&&t.push({attributeName:"listReversed",defaultValue:!1,viewConsumables:{attributes:"reversed"},addCommand(e){e.commands.add("listReversed",new ue(e))},appliesToListItem:e=>"numbered"==e.getAttribute("listType"),hasValidAttribute(e){return this.appliesToListItem(e)==e.hasAttribute("listReversed")},setAttributeOnDowncast(e,t,i){t?e.setAttribute("reversed","reversed",i):e.removeAttribute("reversed",i)},getAttributeOnUpcast:e=>e.hasAttribute("reversed")}),e.startIndex&&t.push({attributeName:"listStart",defaultValue:1,viewConsumables:{attributes:"start"},addCommand(e){e.commands.add("listStart",new te(e))},appliesToListItem:e=>T(e.getAttribute("listType")),hasValidAttribute(e){return this.appliesToListItem(e)==e.hasAttribute("listStart")},setAttributeOnDowncast(e,t,i){0==t||t>1?e.setAttribute("start",t,i):e.removeAttribute("start",i)},getAttributeOnUpcast(e){const t=e.getAttribute("start");return t>=0?t:1}}),t}(e.config.get("list.properties"));for(const o of n)o.addCommand(e),t.schema.extend("$listItem",{allowAttributes:o.attributeName}),i.registerDowncastStrategy({scope:"list",attributeName:o.attributeName,setAttributeOnDowncast(e,t,i){o.setAttributeOnDowncast(e,t,i)}});e.conversion.for("upcast").add((e=>{for(const t of n)e.on("element:ol",he(t)),e.on("element:ul",he(t))})),i.on("checkAttributes:list",((e,{viewElement:t,modelAttributes:i})=>{for(const o of n)o.getAttributeOnUpcast(t)!=i[o.attributeName]&&(e.return=!0,e.stop())})),this.listenTo(e.commands.get("indentList"),"afterExecute",((e,i)=>{t.change((e=>{for(const t of i)for(const i of n)i.appliesToListItem(t)&&e.setAttribute(i.attributeName,i.defaultValue,t)}))})),i.on("postFixer",((e,{listNodes:t,writer:i})=>{for(const{node:o}of t)for(const t of n)t.hasValidAttribute(o)||(t.appliesToListItem(o)?i.setAttribute(t.attributeName,t.defaultValue,o):i.removeAttribute(t.attributeName,o),e.return=!0)})),i.on("postFixer",((e,{listNodes:t,writer:i})=>{for(const{node:o,previousNodeInList:s}of t)if(s&&s.getAttribute("listType")==o.getAttribute("listType"))for(const t of n){const{attributeName:n}=t;if(!t.appliesToListItem(o))continue;const r=s.getAttribute(n);o.getAttribute(n)!=r&&(i.setAttribute(n,r,o),e.return=!0)}}))}}class we extends J.Ss{constructor(e,{enabledProperties:t,styleButtonViews:i,styleGridAriaLabel:n}){super(e),this.stylesView=null,this.additionalPropertiesCollapsibleView=null,this.startIndexFieldView=null,this.reversedSwitchButtonView=null,this.focusTracker=new r.$x,this.keystrokes=new r.EP,this.focusables=new J.s3;const o=["ck","ck-list-properties"];this.children=this.createCollection(),this.focusCycler=new J.H({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),i&&i.length?(this.stylesView=this._createStylesView(i,n),this.children.add(this.stylesView)):o.push("ck-list-properties_without-styles"),(t.startIndex||t.reversed)&&(this._addNumberedListPropertyViews(t),o.push("ck-list-properties_with-numbered-properties")),this.setTemplate({tag:"div",attributes:{class:o},children:this.children})}render(){if(super.render(),this.stylesView){this.focusables.add(this.stylesView),this.focusTracker.add(this.stylesView.element),(this.startIndexFieldView||this.reversedSwitchButtonView)&&(this.focusables.add(this.children.last.buttonView),this.focusTracker.add(this.children.last.buttonView.element));for(const e of this.stylesView.children)this.stylesView.focusTracker.add(e.element);(0,J.l1)({keystrokeHandler:this.stylesView.keystrokes,focusTracker:this.stylesView.focusTracker,gridItems:this.stylesView.children,numberOfColumns:()=>r.Sf.window.getComputedStyle(this.stylesView.element).getPropertyValue("grid-template-columns").split(" ").length,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}if(this.startIndexFieldView){this.focusables.add(this.startIndexFieldView),this.focusTracker.add(this.startIndexFieldView.element);const e=e=>e.stopPropagation();this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}this.reversedSwitchButtonView&&(this.focusables.add(this.reversedSwitchButtonView),this.focusTracker.add(this.reversedSwitchButtonView.element)),this.keystrokes.listenTo(this.element)}focus(){this.focusCycler.focusFirst()}focusLast(){this.focusCycler.focusLast()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createStylesView(e,t){const i=new J.Ss(this.locale);return i.children=i.createCollection(),i.children.addMany(e),i.setTemplate({tag:"div",attributes:{"aria-label":t,class:["ck","ck-list-styles-list"]},children:i.children}),i.children.delegate("execute").to(this),i.focus=function(){this.children.first.focus()},i.focusTracker=new r.$x,i.keystrokes=new r.EP,i.render(),i.keystrokes.listenTo(i.element),i}_addNumberedListPropertyViews(e){const t=this.locale.t,i=[];e.startIndex&&(this.startIndexFieldView=this._createStartIndexField(),i.push(this.startIndexFieldView)),e.reversed&&(this.reversedSwitchButtonView=this._createReversedSwitchButton(),i.push(this.reversedSwitchButtonView)),this.stylesView?(this.additionalPropertiesCollapsibleView=new J.Kn(this.locale,i),this.additionalPropertiesCollapsibleView.set({label:t("List properties"),isCollapsed:!0}),this.additionalPropertiesCollapsibleView.buttonView.bind("isEnabled").toMany(i,"isEnabled",((...e)=>e.some((e=>e)))),this.additionalPropertiesCollapsibleView.buttonView.on("change:isEnabled",((e,t,i)=>{i||(this.additionalPropertiesCollapsibleView.isCollapsed=!0)})),this.children.add(this.additionalPropertiesCollapsibleView)):this.children.addMany(i)}_createStartIndexField(){const e=this.locale.t,t=new J.xE(this.locale,J.F_);return t.set({label:e("Start at"),class:"ck-numbered-list-properties__start-index"}),t.fieldView.set({min:0,step:1,value:1,inputMode:"numeric"}),t.fieldView.on("input",(()=>{const i=t.fieldView.element,n=i.valueAsNumber;Number.isNaN(n)?t.errorText=e("Invalid start index value."):i.checkValidity()?this.fire("listStart",{startIndex:n}):t.errorText=e("Start index must be greater than 0.")})),t}_createReversedSwitchButton(){const e=this.locale.t,t=new J.Wm(this.locale);return t.set({withText:!0,label:e("Reversed order"),class:"ck-numbered-list-properties__reversed-order"}),t.delegate("execute").to(this,"listReversed"),t}}class ve extends n.k_{static get pluginName(){return"ListPropertiesUI"}init(){const e=this.editor,t=e.locale.t,i=e.config.get("list.properties"),o=ge(i),s=o.styles.listTypes;if(s.includes("bulleted")){const i=[{label:t("Toggle the disc list style"),tooltip:t("Disc"),type:"disc",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M11 27a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0-9a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0-9a3 3 0 1 1 0 6 3 3 0 0 1 0-6z"/></svg>'},{label:t("Toggle the circle list style"),tooltip:t("Circle"),type:"circle",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M11 27a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0 1a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm0-10a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0 1a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm0-10a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0 1a2 2 0 1 0 0 4 2 2 0 0 0 0-4z"/></svg>'},{label:t("Toggle the square list style"),tooltip:t("Square"),type:"square",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M14 27v6H8v-6h6zm0-9v6H8v-6h6zm0-9v6H8V9h6z"/></svg>'}],s=t("Bulleted List"),r=t("Bulleted list styles toolbar"),a="bulletedList";e.ui.componentFactory.add(a,_e({editor:e,normalizedConfig:o,parentCommandName:a,buttonLabel:s,buttonIcon:n.Pt.bulletedList,styleGridAriaLabel:r,styleDefinitions:i})),e.ui.componentFactory.add(`menuBar:${a}`,ke({editor:e,normalizedConfig:o,parentCommandName:a,buttonLabel:s,styleGridAriaLabel:r,styleDefinitions:i}))}if(s.includes("numbered")||i.startIndex||i.reversed){const i=[{label:t("Toggle the decimal list style"),tooltip:t("Decimal"),type:"decimal",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M10.29 15V8.531H9.286c-.14.393-.4.736-.778 1.03-.378.295-.728.495-1.05.6v1.121a4.257 4.257 0 0 0 1.595-.936V15h1.235zm3.343 0v-1.235h-1.235V15h1.235zM11.3 24v-1.147H8.848c.064-.111.148-.226.252-.343.104-.117.351-.354.74-.712.39-.357.66-.631.81-.821.225-.288.39-.562.494-.824.104-.263.156-.539.156-.829 0-.51-.182-.936-.545-1.279-.363-.342-.863-.514-1.499-.514-.58 0-1.063.148-1.45.444-.387.296-.617.784-.69 1.463l1.23.124c.024-.36.112-.619.264-.774.153-.155.358-.233.616-.233.26 0 .465.074.613.222.148.148.222.36.222.635 0 .25-.085.501-.255.756-.126.185-.468.536-1.024 1.055-.692.641-1.155 1.156-1.389 1.544-.234.389-.375.8-.422 1.233H11.3zm2.333 0v-1.235h-1.235V24h1.235zM9.204 34.11c.615 0 1.129-.2 1.542-.598.413-.398.62-.88.62-1.446 0-.39-.11-.722-.332-.997a1.5 1.5 0 0 0-.886-.532c.619-.337.928-.788.928-1.353 0-.399-.151-.756-.453-1.073-.366-.386-.852-.58-1.459-.58a2.25 2.25 0 0 0-.96.2 1.617 1.617 0 0 0-.668.55c-.16.232-.28.544-.358.933l1.138.194c.032-.282.123-.495.272-.642.15-.146.33-.22.54-.22.215 0 .386.065.515.194s.193.302.193.518c0 .255-.087.46-.263.613-.176.154-.43.227-.765.218l-.136 1.006c.22-.061.409-.092.567-.092.24 0 .444.09.61.272.168.182.251.428.251.739 0 .328-.087.589-.261.782a.833.833 0 0 1-.644.29.841.841 0 0 1-.607-.242c-.167-.16-.27-.394-.307-.698l-1.196.145c.062.542.285.98.668 1.316.384.335.868.503 1.45.503zm4.43-.11v-1.235h-1.236V34h1.235z"/></svg>'},{label:t("Toggle the decimal with leading zero list style"),tooltip:t("Decimal with leading zero"),type:"decimal-leading-zero",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M5.714 15.11c.624 0 1.11-.22 1.46-.66.421-.533.632-1.408.632-2.627 0-1.222-.21-2.096-.629-2.624-.351-.445-.839-.668-1.463-.668-.624 0-1.11.22-1.459.66-.422.533-.633 1.406-.633 2.619 0 1.236.192 2.095.576 2.577.384.482.89.723 1.516.723zm0-1.024a.614.614 0 0 1-.398-.14c-.115-.094-.211-.283-.287-.565-.077-.283-.115-.802-.115-1.558s.043-1.294.128-1.613c.064-.246.155-.417.272-.512a.617.617 0 0 1 .4-.143.61.61 0 0 1 .398.143c.116.095.211.284.288.567.076.283.114.802.114 1.558s-.043 1.292-.128 1.608c-.064.246-.155.417-.272.512a.617.617 0 0 1-.4.143zm6.078.914V8.531H10.79c-.14.393-.4.736-.778 1.03-.378.295-.728.495-1.05.6v1.121a4.257 4.257 0 0 0 1.595-.936V15h1.235zm3.344 0v-1.235h-1.235V15h1.235zm-9.422 9.11c.624 0 1.11-.22 1.46-.66.421-.533.632-1.408.632-2.627 0-1.222-.21-2.096-.629-2.624-.351-.445-.839-.668-1.463-.668-.624 0-1.11.22-1.459.66-.422.533-.633 1.406-.633 2.619 0 1.236.192 2.095.576 2.577.384.482.89.723 1.516.723zm0-1.024a.614.614 0 0 1-.398-.14c-.115-.094-.211-.283-.287-.565-.077-.283-.115-.802-.115-1.558s.043-1.294.128-1.613c.064-.246.155-.417.272-.512a.617.617 0 0 1 .4-.143.61.61 0 0 1 .398.143c.116.095.211.284.288.567.076.283.114.802.114 1.558s-.043 1.292-.128 1.608c-.064.246-.155.417-.272.512a.617.617 0 0 1-.4.143zm7.088.914v-1.147H10.35c.065-.111.149-.226.253-.343.104-.117.35-.354.74-.712.39-.357.66-.631.81-.821.225-.288.39-.562.493-.824.104-.263.156-.539.156-.829 0-.51-.181-.936-.544-1.279-.364-.342-.863-.514-1.499-.514-.58 0-1.063.148-1.45.444-.387.296-.617.784-.69 1.463l1.23.124c.024-.36.112-.619.264-.774.152-.155.357-.233.615-.233.261 0 .465.074.613.222.148.148.222.36.222.635 0 .25-.085.501-.255.756-.126.185-.467.536-1.024 1.055-.691.641-1.154 1.156-1.388 1.544-.235.389-.375.8-.422 1.233h4.328zm2.334 0v-1.235h-1.235V24h1.235zM5.714 34.11c.624 0 1.11-.22 1.46-.66.421-.533.632-1.408.632-2.627 0-1.222-.21-2.096-.629-2.624-.351-.445-.839-.668-1.463-.668-.624 0-1.11.22-1.459.66-.422.533-.633 1.406-.633 2.619 0 1.236.192 2.095.576 2.577.384.482.89.723 1.516.723zm0-1.024a.614.614 0 0 1-.398-.14c-.115-.094-.211-.283-.287-.565-.077-.283-.115-.802-.115-1.558s.043-1.294.128-1.613c.064-.246.155-.417.272-.512a.617.617 0 0 1 .4-.143.61.61 0 0 1 .398.143c.116.095.211.284.288.567.076.283.114.802.114 1.558s-.043 1.292-.128 1.608c-.064.246-.155.417-.272.512a.617.617 0 0 1-.4.143zm4.992 1.024c.616 0 1.13-.2 1.543-.598.413-.398.62-.88.62-1.446 0-.39-.111-.722-.332-.997a1.5 1.5 0 0 0-.886-.532c.618-.337.927-.788.927-1.353 0-.399-.15-.756-.452-1.073-.366-.386-.853-.58-1.46-.58a2.25 2.25 0 0 0-.96.2 1.617 1.617 0 0 0-.667.55c-.16.232-.28.544-.359.933l1.139.194c.032-.282.123-.495.272-.642.15-.146.33-.22.54-.22.214 0 .386.065.515.194s.193.302.193.518c0 .255-.088.46-.264.613-.175.154-.43.227-.764.218l-.136 1.006c.22-.061.408-.092.566-.092.24 0 .444.09.611.272.167.182.25.428.25.739 0 .328-.086.589-.26.782a.833.833 0 0 1-.644.29.841.841 0 0 1-.607-.242c-.167-.16-.27-.394-.308-.698l-1.195.145c.062.542.284.98.668 1.316.384.335.867.503 1.45.503zm4.43-.11v-1.235h-1.235V34h1.235z"/></svg>'},{label:t("Toggle the lower–roman list style"),tooltip:t("Lower–roman"),type:"lower-roman",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M11.88 8.7V7.558h-1.234V8.7h1.234zm0 5.3V9.333h-1.234V14h1.234zm2.5 0v-1.235h-1.234V14h1.235zm-4.75 4.7v-1.142H8.395V18.7H9.63zm0 5.3v-4.667H8.395V24H9.63zm2.5-5.3v-1.142h-1.234V18.7h1.235zm0 5.3v-4.667h-1.234V24h1.235zm2.501 0v-1.235h-1.235V24h1.235zM7.38 28.7v-1.142H6.145V28.7H7.38zm0 5.3v-4.667H6.145V34H7.38zm2.5-5.3v-1.142H8.646V28.7H9.88zm0 5.3v-4.667H8.646V34H9.88zm2.5-5.3v-1.142h-1.234V28.7h1.235zm0 5.3v-4.667h-1.234V34h1.235zm2.501 0v-1.235h-1.235V34h1.235z"/></svg>'},{label:t("Toggle the upper–roman list style"),tooltip:t("Upper-roman"),type:"upper-roman",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M11.916 15V8.558h-1.301V15h1.3zm2.465 0v-1.235h-1.235V15h1.235zM9.665 25v-6.442h-1.3V25h1.3zm2.5 0v-6.442h-1.3V25h1.3zm2.466 0v-1.235h-1.235V25h1.235zm-7.216 9v-6.442h-1.3V34h1.3zm2.5 0v-6.442h-1.3V34h1.3zm2.501 0v-6.442h-1.3V34h1.3zm2.465 0v-1.235h-1.235V34h1.235z"/></svg>'},{label:t("Toggle the lower–latin list style"),tooltip:t("Lower-latin"),type:"lower-latin",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M9.62 14.105c.272 0 .528-.05.768-.153s.466-.257.677-.462c.009.024.023.072.044.145.047.161.086.283.119.365h1.221a2.649 2.649 0 0 1-.222-.626c-.04-.195-.059-.498-.059-.908l.013-1.441c0-.536-.055-.905-.165-1.105-.11-.201-.3-.367-.569-.497-.27-.13-.68-.195-1.23-.195-.607 0-1.064.108-1.371.325-.308.217-.525.55-.65 1.002l1.12.202c.076-.217.176-.369.299-.455.123-.086.294-.13.514-.13.325 0 .546.05.663.152.118.101.176.27.176.508v.123c-.222.093-.622.194-1.2.303-.427.082-.755.178-.982.288-.227.11-.403.268-.53.474a1.327 1.327 0 0 0-.188.706c0 .398.138.728.415.988.277.261.656.391 1.136.391zm.368-.87a.675.675 0 0 1-.492-.189.606.606 0 0 1-.193-.448c0-.176.08-.32.241-.435.106-.07.33-.142.673-.215a7.19 7.19 0 0 0 .751-.19v.247c0 .296-.016.496-.048.602a.773.773 0 0 1-.295.409 1.07 1.07 0 0 1-.637.22zm4.645.765v-1.235h-1.235V14h1.235zM10.2 25.105c.542 0 1.003-.215 1.382-.646.38-.43.57-1.044.57-1.84 0-.771-.187-1.362-.559-1.774a1.82 1.82 0 0 0-1.41-.617c-.522 0-.973.216-1.354.65v-2.32H7.594V25h1.147v-.686a1.9 1.9 0 0 0 .67.592c.26.133.523.2.79.2zm-.299-.975c-.354 0-.638-.164-.852-.492-.153-.232-.229-.59-.229-1.073 0-.468.098-.818.295-1.048a.93.93 0 0 1 .738-.345c.302 0 .55.118.743.354.193.236.29.62.29 1.154 0 .5-.096.868-.288 1.1-.192.233-.424.35-.697.35zm4.478.87v-1.235h-1.234V25h1.234zm-4.017 9.105c.6 0 1.08-.142 1.437-.426.357-.284.599-.704.725-1.261l-1.213-.207c-.061.326-.167.555-.316.688a.832.832 0 0 1-.576.2.916.916 0 0 1-.75-.343c-.185-.228-.278-.62-.278-1.173 0-.498.091-.853.274-1.066.183-.212.429-.318.736-.318.232 0 .42.061.565.184.145.123.238.306.28.55l1.216-.22c-.146-.501-.387-.874-.722-1.119-.336-.244-.788-.366-1.356-.366-.695 0-1.245.214-1.653.643-.407.43-.61 1.03-.61 1.8 0 .762.202 1.358.608 1.788.406.431.95.646 1.633.646zM14.633 34v-1.235h-1.235V34h1.235z"/></svg>'},{label:t("Toggle the upper–latin list style"),tooltip:t("Upper-latin"),type:"upper-latin",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="m7.88 15 .532-1.463h2.575L11.549 15h1.415l-2.58-6.442H9.01L6.5 15h1.38zm2.69-2.549H8.811l.87-2.39.887 2.39zM14.88 15v-1.235h-1.234V15h1.234zM9.352 25c.83-.006 1.352-.02 1.569-.044.346-.038.636-.14.872-.305.236-.166.422-.387.558-.664.137-.277.205-.562.205-.855 0-.372-.106-.695-.317-.97-.21-.276-.512-.471-.905-.585a1.51 1.51 0 0 0 .661-.567 1.5 1.5 0 0 0 .244-.83c0-.28-.066-.53-.197-.754a1.654 1.654 0 0 0-.495-.539 1.676 1.676 0 0 0-.672-.266c-.25-.042-.63-.063-1.14-.063H7.158V25h2.193zm.142-3.88H8.46v-1.49h.747c.612 0 .983.007 1.112.022.217.026.38.102.49.226.11.125.165.287.165.486a.68.68 0 0 1-.192.503.86.86 0 0 1-.525.23 11.47 11.47 0 0 1-.944.023h.18zm.17 2.795H8.46v-1.723h1.05c.592 0 .977.03 1.154.092.177.062.313.16.406.295a.84.84 0 0 1 .14.492c0 .228-.06.41-.181.547a.806.806 0 0 1-.473.257c-.126.026-.423.04-.892.04zM14.88 25v-1.235h-1.234V25h1.234zm-5.018 9.11c.691 0 1.262-.17 1.711-.512.45-.341.772-.864.965-1.567l-1.261-.4c-.109.472-.287.818-.536 1.037-.25.22-.547.33-.892.33-.47 0-.85-.173-1.143-.519-.293-.345-.44-.925-.44-1.74 0-.767.15-1.322.447-1.665.297-.343.684-.514 1.162-.514.346 0 .64.096.881.29.242.193.4.457.477.79l1.288-.307c-.147-.516-.367-.911-.66-1.187-.492-.465-1.132-.698-1.92-.698-.902 0-1.63.296-2.184.89-.554.593-.83 1.426-.83 2.498 0 1.014.275 1.813.825 2.397.551.585 1.254.877 2.11.877zM14.88 34v-1.235h-1.234V34h1.234z"/></svg>'}],r=t("Numbered List"),a=t("Numbered list styles toolbar"),l="numberedList";e.ui.componentFactory.add(l,_e({editor:e,normalizedConfig:o,parentCommandName:l,buttonLabel:r,buttonIcon:n.Pt.numberedList,styleGridAriaLabel:a,styleDefinitions:i})),s.includes("numbered")&&e.ui.componentFactory.add(`menuBar:${l}`,ke({editor:e,normalizedConfig:o,parentCommandName:l,buttonLabel:r,styleGridAriaLabel:a,styleDefinitions:i}))}}}function _e({editor:e,normalizedConfig:t,parentCommandName:i,buttonLabel:n,buttonIcon:o,styleGridAriaLabel:s,styleDefinitions:r}){const a=e.commands.get(i);return l=>{const c=(0,J.yu)(l,J.AO),d=c.buttonView;return c.bind("isEnabled").to(a),c.class="ck-list-styles-dropdown",d.on("execute",(()=>{e.execute(i),e.editing.view.focus()})),d.set({label:n,icon:o,tooltip:!0,isToggleable:!0}),d.bind("isOn").to(a,"value",(e=>!!e)),c.once("change:isOpen",(()=>{const n=function({editor:e,normalizedConfig:t,dropdownView:i,parentCommandName:n,styleDefinitions:o,styleGridAriaLabel:s}){const r=e.locale,a={...t,..."numberedList"!=n?{startIndex:!1,reversed:!1}:null},l=n.replace("List","");let c=null;if(t.styles.listTypes.includes(l)){const t=e.commands.get("listStyle"),i=ye({editor:e,parentCommandName:n,listStyleCommand:t}),s=Ce(t);c=o.filter(s).map(i)}const d=new we(r,{styleGridAriaLabel:s,enabledProperties:a,styleButtonViews:c});if(t.styles.listTypes.includes(l)&&(0,J.Zn)(i,(()=>d.stylesView.children.find((e=>e.isOn)))),a.startIndex){const t=e.commands.get("listStart");d.startIndexFieldView.bind("isEnabled").to(t),d.startIndexFieldView.fieldView.bind("value").to(t),d.on("listStart",((t,i)=>e.execute("listStart",i)))}if(a.reversed){const t=e.commands.get("listReversed");d.reversedSwitchButtonView.bind("isEnabled").to(t),d.reversedSwitchButtonView.bind("isOn").to(t,"value",(e=>!!e)),d.on("listReversed",(()=>{const i=t.value;e.execute("listReversed",{reversed:!i})}))}return d.delegate("execute").to(i),d}({editor:e,normalizedConfig:t,dropdownView:c,parentCommandName:i,styleGridAriaLabel:s,styleDefinitions:r});c.panelView.children.add(n)})),c.on("execute",(()=>{e.editing.view.focus()})),c}}function ye({editor:e,listStyleCommand:t,parentCommandName:i}){const n=e.locale,o=e.commands.get(i);return({label:s,type:r,icon:a,tooltip:l})=>{const c=new J._(n);return c.set({label:s,icon:a,tooltip:l}),t.on("change:value",(()=>{c.isOn=t.value===r})),c.on("execute",(()=>{o.value?t.value===r?e.execute(i):t.value!==r&&e.execute("listStyle",{type:r}):e.model.change((()=>{e.execute("listStyle",{type:r})}))})),c}}function ke({editor:e,normalizedConfig:t,parentCommandName:i,buttonLabel:o,styleGridAriaLabel:s,styleDefinitions:r}){return a=>{const l=new J.zj(a),c=e.commands.get(i),d=e.commands.get("listStyle"),u=Ce(d),h=ye({editor:e,parentCommandName:i,listStyleCommand:d}),m=r.filter(u).map(h),g=new we(a,{styleGridAriaLabel:s,enabledProperties:{...t,startIndex:!1,reversed:!1},styleButtonViews:m});return g.delegate("execute").to(l),l.buttonView.set({label:o,icon:n.Pt[i]}),l.panelView.children.add(g),l.bind("isEnabled").to(c,"isEnabled"),l.on("execute",(()=>{e.editing.view.focus()})),l}}function Ce(e){return"function"==typeof e.isStyleTypeSupported?t=>e.isStyleTypeSupported(t.type):()=>!0}class Ae extends n.k_{static get requires(){return[be,ve]}static get pluginName(){return"ListProperties"}}var Ee=i(4133);class xe extends n.uB{constructor(e){super(e),this.on("execute",(()=>{this.refresh()}),{priority:"highest"})}refresh(){const e=this._getSelectedItems();this.value=this._getValue(e),this.isEnabled=!!e.length}execute(e={}){this.editor.model.change((t=>{const i=this._getSelectedItems(),n=void 0===e.forceValue?!this._getValue(i):e.forceValue;for(const e of i)n?t.setAttribute("todoListChecked",!0,e):t.removeAttribute("todoListChecked",e)}))}_getValue(e){return e.every((e=>e.getAttribute("todoListChecked")))}_getSelectedItems(){const e=this.editor.model,t=e.schema,i=e.document.selection.getFirstRange(),n=i.start.parent,o=[];t.checkAttribute(n,"todoListChecked")&&o.push(...h(n));for(const e of i.getItems({shallow:!0}))t.checkAttribute(e,"todoListChecked")&&!o.includes(e)&&o.push(...h(e));return o}}class Te extends Ee.$A{constructor(){super(...arguments),this.domEventType=["change"]}onDomEvent(e){if(e.target){const t=this.view.domConverter.mapDomToView(e.target);t&&t.is("element","input")&&"checkbox"==t.getAttribute("type")&&t.findAncestor({classes:"todo-list__label"})&&this.fire("todoCheckboxChange",e)}}}const Pe=(0,r.ZX)("Ctrl+Enter");class Ie extends n.k_{static get pluginName(){return"TodoListEditing"}static get requires(){return[G]}init(){const e=this.editor,t=e.model,i=e.editing,n=e.plugins.get(G),o=e.config.get("list.multiBlock")?"paragraph":"listItem";e.commands.add("todoList",new V(e,"todo")),e.commands.add("checkTodoList",new xe(e)),i.view.addObserver(Te),t.schema.extend("$listItem",{allowAttributes:"todoListChecked"}),t.schema.addAttributeCheck((e=>{const t=e.last;if(!t.getAttribute("listItemId")||"todo"!=t.getAttribute("listType"))return!1}),"todoListChecked"),e.conversion.for("upcast").add((e=>{e.on("element:input",((e,t,i)=>{const n=t.modelCursor,o=n.parent,s=t.viewItem;if(!i.consumable.test(s,{name:!0}))return;if("checkbox"!=s.getAttribute("type")||!n.isAtStart||!o.hasAttribute("listType"))return;i.consumable.consume(s,{name:!0});const r=i.writer;r.setAttribute("listType","todo",o),t.viewItem.hasAttribute("checked")&&r.setAttribute("todoListChecked",!0,o),t.modelRange=r.createRange(n)})),e.on("element:label",Se({name:"label",classes:"todo-list__label"})),e.on("element:label",Se({name:"label",classes:["todo-list__label","todo-list__label_without-description"]})),e.on("element:span",Se({name:"span",classes:"todo-list__label__description"})),e.on("element:ul",function(e){const t=new Ee.PN({name:"ul",classes:"todo-list"});return(e,i,n)=>{const o=t.match(i.viewItem);if(!o)return;const s=o.match;s.name=!1,n.consumable.consume(i.viewItem,s)}}())})),e.conversion.for("downcast").elementToElement({model:o,view:(e,{writer:t})=>{if(Ve(e,n.getListAttributeNames()))return t.createContainerElement("span",{class:"todo-list__label__description"})},converterPriority:"highest"}),n.registerDowncastStrategy({scope:"list",attributeName:"listType",setAttributeOnDowncast(e,t,i){"todo"==t?e.addClass("todo-list",i):e.removeClass("todo-list",i)}}),n.registerDowncastStrategy({scope:"itemMarker",attributeName:"todoListChecked",createElement(e,t,{dataPipeline:i}){if("todo"!=t.getAttribute("listType"))return null;const n=e.createUIElement("input",{type:"checkbox",...t.getAttribute("todoListChecked")?{checked:"checked"}:null,...i?{disabled:"disabled"}:{tabindex:"-1"}});if(i)return n;const o=e.createContainerElement("span",{contenteditable:"false"},n);return o.getFillerOffset=()=>null,o},canWrapElement:e=>Ve(e,n.getListAttributeNames()),createWrapperElement(e,t,{dataPipeline:i}){const o=["todo-list__label"];return Ve(t,n.getListAttributeNames())||o.push("todo-list__label_without-description"),e.createAttributeElement(i?"label":"span",{class:o.join(" ")})}}),n.on("checkElement",((e,{modelElement:t,viewElement:i})=>{const o=Ve(t,n.getListAttributeNames());i.hasClass("todo-list__label__description")!=o&&(e.return=!0,e.stop())})),n.on("checkElement",((t,{modelElement:i,viewElement:n})=>{const o="todo"==i.getAttribute("listType")&&f(i);let s=!1;const r=e.editing.view.createPositionBefore(n).getWalker({direction:"backward"});for(const{item:t}of r){if(t.is("element")&&e.editing.mapper.toModelElement(t))break;t.is("element","input")&&"checkbox"==t.getAttribute("type")&&(s=!0)}s!=o&&(t.return=!0,t.stop())})),n.on("postFixer",((e,{listNodes:t,writer:i})=>{for(const{node:n,previousNodeInList:o}of t){if(!o)continue;if(o.getAttribute("listItemId")!=n.getAttribute("listItemId"))continue;const t=o.hasAttribute("todoListChecked"),s=n.hasAttribute("todoListChecked");s&&!t?(i.removeAttribute("todoListChecked",n),e.return=!0):!s&&t&&(i.setAttribute("todoListChecked",!0,n),e.return=!0)}})),t.document.registerPostFixer((e=>{const i=t.document.differ.getChanges();let n=!1;for(const t of i)if("attribute"==t.type&&"listType"==t.attributeKey){const i=t.range.start.nodeAfter;"todo"==t.attributeOldValue&&i.hasAttribute("todoListChecked")&&(e.removeAttribute("todoListChecked",i),n=!0)}else if("insert"==t.type&&"$text"!=t.name)for(const{item:i}of e.createRangeOn(t.position.nodeAfter))i.is("element")&&"todo"!=i.getAttribute("listType")&&i.hasAttribute("todoListChecked")&&(e.removeAttribute("todoListChecked",i),n=!0);return n})),this.listenTo(i.view.document,"keydown",((t,i)=>{(0,r.QC)(i)===Pe&&(e.execute("checkTodoList"),t.stop())}),{priority:"high"}),this.listenTo(i.view.document,"todoCheckboxChange",((e,t)=>{const n=t.target;if(!n||!n.is("element","input"))return;const o=i.view.createPositionAfter(n),s=i.mapper.toModelPosition(o).parent;s&&u(s)&&"todo"==s.getAttribute("listType")&&this._handleCheckmarkChange(s)})),this.listenTo(i.view.document,"arrowKey",function(e,t){return(i,n)=>{const o=(0,r.Kf)(n.keyCode,t.contentLanguageDirection),s=e.schema,a=e.document.selection;if(!a.isCollapsed)return;const l=a.getFirstPosition(),c=l.parent;if("right"==o&&l.isAtEnd){const t=s.getNearestSelectionRange(e.createPositionAfter(c),"forward");if(!t)return;const o=t.start.parent;o&&u(o)&&"todo"==o.getAttribute("listType")&&(e.change((e=>e.setSelection(t))),n.preventDefault(),n.stopPropagation(),i.stop())}else if("left"==o&&l.isAtStart&&u(c)&&"todo"==c.getAttribute("listType")){const t=s.getNearestSelectionRange(e.createPositionBefore(c),"backward");if(!t)return;e.change((e=>e.setSelection(t))),n.preventDefault(),n.stopPropagation(),i.stop()}}}(t,e.locale),{context:"$text"}),this.listenTo(i.mapper,"viewToModelPosition",((e,i)=>{const n=i.viewPosition.parent,o=n.is("attributeElement","li")&&0==i.viewPosition.offset,s=Re(n)&&i.viewPosition.offset<=1,r=n.is("element","span")&&"false"==n.getAttribute("contenteditable")&&Re(n.parent);if(!o&&!s&&!r)return;const a=i.modelPosition.nodeAfter;a&&"todo"==a.getAttribute("listType")&&(i.modelPosition=t.createPositionAt(a,0))}),{priority:"low"}),this._initAriaAnnouncements()}_handleCheckmarkChange(e){const t=this.editor,i=t.model,n=Array.from(i.document.selection.getRanges());i.change((i=>{i.setSelection(e,"end"),t.execute("checkTodoList"),i.setSelection(n)}))}_initAriaAnnouncements(){const{model:e,ui:t,t:i}=this.editor;let n=null;t&&e.document.selection.on("change:range",(()=>{const o=e.document.selection.focus.parent,s=Be(n),r=Be(o);s&&!r?t.ariaLiveAnnouncer.announce(i("Leaving a to-do list")):!s&&r&&t.ariaLiveAnnouncer.announce(i("Entering a to-do list")),n=o}))}}function Se(e){const t=new Ee.PN(e);return(e,i,n)=>{const o=t.match(i.viewItem);o&&n.consumable.consume(i.viewItem,o.match)&&Object.assign(i,n.convertChildren(i.viewItem,i.modelCursor))}}function Ve(e,t){return(e.is("element","paragraph")||e.is("element","listItem"))&&"todo"==e.getAttribute("listType")&&f(e)&&function(e,t){for(const i of e.getAttributeKeys())if(!i.startsWith("selection:")&&!t.includes(i))return!1;return!0}(e,t)}function Re(e){return!!e&&e.is("attributeElement")&&e.hasClass("todo-list__label")}function Be(e){return!(!e||!e.is("element","paragraph")&&!e.is("element","listItem")||"todo"!=e.getAttribute("listType"))}class Me extends n.k_{static get pluginName(){return"TodoListUI"}init(){const e=this.editor.t;Q(this.editor,"todoList",e("To-do List"),n.Pt.todoList)}}class Oe extends n.k_{static get requires(){return[Ie,Me]}static get pluginName(){return"TodoList"}}class Le extends n.uB{constructor(e,t){super(e),this.type=t}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,i=t.document,n=Array.from(i.selection.getSelectedBlocks()).filter((e=>Ne(e,t.schema))),o=void 0!==e.forceValue?!e.forceValue:this.value;t.change((e=>{if(o){let t=n[n.length-1].nextSibling,i=Number.POSITIVE_INFINITY,o=[];for(;t&&"listItem"==t.name&&0!==t.getAttribute("listIndent");){const e=t.getAttribute("listIndent");e<i&&(i=e);const n=e-i;o.push({element:t,listIndent:n}),t=t.nextSibling}o=o.reverse();for(const t of o)e.setAttribute("listIndent",t.listIndent,t.element)}if(!o){let e=Number.POSITIVE_INFINITY;for(const t of n)t.is("element","listItem")&&t.getAttribute("listIndent")<e&&(e=t.getAttribute("listIndent"));e=0===e?1:e,Fe(n,!0,e),Fe(n,!1,e)}for(const t of n.reverse())o&&"listItem"==t.name?e.rename(t,"paragraph"):o||"listItem"==t.name?o||"listItem"!=t.name||t.getAttribute("listType")==this.type||e.setAttribute("listType",this.type,t):(e.setAttributes({listType:this.type,listIndent:0},t),e.rename(t,"listItem"));this.fire("_executeCleanup",n)}))}_getValue(){const e=(0,r.$1)(this.editor.model.document.selection.getSelectedBlocks());return!!e&&e.is("element","listItem")&&e.getAttribute("listType")==this.type}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,i=(0,r.$1)(e.getSelectedBlocks());return!!i&&Ne(i,t)}}function Fe(e,t,i){const n=t?e[0]:e[e.length-1];if(n.is("element","listItem")){let o=n[t?"previousSibling":"nextSibling"],s=n.getAttribute("listIndent");for(;o&&o.is("element","listItem")&&o.getAttribute("listIndent")>=i;)s>o.getAttribute("listIndent")&&(s=o.getAttribute("listIndent")),o.getAttribute("listIndent")==s&&e[t?"unshift":"push"](o),o=o[t?"previousSibling":"nextSibling"]}}function Ne(e,t){return t.checkChild(e.parent,"listItem")&&!t.isObject(e)}class De extends n.uB{constructor(e,t){super(e),this._indentBy="forward"==t?1:-1}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model,t=e.document;let i=Array.from(t.selection.getSelectedBlocks());e.change((e=>{const t=i[i.length-1];let n=t.nextSibling;for(;n&&"listItem"==n.name&&n.getAttribute("listIndent")>t.getAttribute("listIndent");)i.push(n),n=n.nextSibling;this._indentBy<0&&(i=i.reverse());for(const t of i){const i=t.getAttribute("listIndent")+this._indentBy;i<0?e.rename(t,"paragraph"):e.setAttribute("listIndent",i,t)}this.fire("_executeCleanup",i)}))}_checkEnabled(){const e=(0,r.$1)(this.editor.model.document.selection.getSelectedBlocks());if(!e||!e.is("element","listItem"))return!1;if(this._indentBy>0){const t=e.getAttribute("listIndent"),i=e.getAttribute("listType");let n=e.previousSibling;for(;n&&n.is("element","listItem")&&n.getAttribute("listIndent")>=t;){if(n.getAttribute("listIndent")==t)return n.getAttribute("listType")==i;n=n.previousSibling}return!1}return!0}}function ze(e,t){const i=t.mapper,n=t.writer,o="numbered"==e.getAttribute("listType")?"ol":"ul",s=function(e){const t=e.createContainerElement("li");return t.getFillerOffset=Qe,t}(n),r=n.createContainerElement(o,null);return n.insert(n.createPositionAt(r,0),s),i.bindElements(e,s),s}function We(e,t,i,n){const o=t.parent,s=i.mapper,r=i.writer;let a=s.toViewPosition(n.createPositionBefore(e));const l=$e(e.previousSibling,{sameIndent:!0,smallerIndent:!0,listIndent:e.getAttribute("listIndent")}),c=e.previousSibling;if(l&&l.getAttribute("listIndent")==e.getAttribute("listIndent")){const e=s.toViewElement(l);a=r.breakContainer(r.createPositionAfter(e))}else if(c&&"listItem"==c.name){a=s.toViewPosition(n.createPositionAt(c,"end"));const e=s.findMappedViewAncestor(a),t=je(e);a=t?r.createPositionBefore(t):r.createPositionAt(e,"end")}else a=s.toViewPosition(n.createPositionBefore(e));if(a=Ue(a),r.insert(a,o),c&&"listItem"==c.name){const e=s.toViewElement(c),i=r.createRange(r.createPositionAt(e,0),a).getWalker({ignoreElementEnd:!0});for(const e of i)if(e.item.is("element","li")){const n=r.breakContainer(r.createPositionBefore(e.item)),o=e.item.parent,s=r.createPositionAt(t,"end");He(r,s.nodeBefore,s.nodeAfter),r.move(r.createRangeOn(o),s),i._position=n}}else{const i=o.nextSibling;if(i&&(i.is("element","ul")||i.is("element","ol"))){let n=null;for(const t of i.getChildren()){const i=s.toModelElement(t);if(!(i&&i.getAttribute("listIndent")>e.getAttribute("listIndent")))break;n=t}n&&(r.breakContainer(r.createPositionAfter(n)),r.move(r.createRangeOn(n.parent),r.createPositionAt(t,"end")))}}He(r,o,o.nextSibling),He(r,o.previousSibling,o)}function He(e,t,i){return!t||!i||"ul"!=t.name&&"ol"!=t.name||t.name!=i.name||t.getAttribute("class")!==i.getAttribute("class")?null:e.mergeContainers(e.createPositionAfter(t))}function Ue(e){return e.getLastMatchingPosition((e=>e.item.is("uiElement")))}function $e(e,t){const i=!!t.sameIndent,n=!!t.smallerIndent,o=t.listIndent;let s=e;for(;s&&"listItem"==s.name;){const e=s.getAttribute("listIndent");if(i&&o==e||n&&o>e)return s;s="forward"===t.direction?s.nextSibling:s.previousSibling}return null}function je(e){for(const t of e.getChildren())if("ul"==t.name||"ol"==t.name)return t;return null}function qe(e,t){const i=[],n=e.parent,o={ignoreElementEnd:!1,startPosition:e,shallow:!0,direction:t},s=n.getAttribute("listIndent"),r=[...new Ee.rU(o)].filter((e=>e.item.is("element"))).map((e=>e.item));for(const e of r){if(!e.is("element","listItem"))break;if(e.getAttribute("listIndent")<s)break;if(!(e.getAttribute("listIndent")>s)){if(e.getAttribute("listType")!==n.getAttribute("listType"))break;if(e.getAttribute("listStyle")!==n.getAttribute("listStyle"))break;if(e.getAttribute("listReversed")!==n.getAttribute("listReversed"))break;if(e.getAttribute("listStart")!==n.getAttribute("listStart"))break;"backward"===t?i.unshift(e):i.push(e)}}return i}function Ke(e){let t=[...e.document.selection.getSelectedBlocks()].filter((e=>e.is("element","listItem"))).map((t=>{const i=e.change((e=>e.createPositionAt(t,0)));return[...qe(i,"backward"),...qe(i,"forward")]})).flat();return t=[...new Set(t)],t}const Ge=["disc","circle","square"],Ze=["decimal","decimal-leading-zero","lower-roman","upper-roman","lower-latin","upper-latin"];function Je(e){return Ge.includes(e)?"bulleted":Ze.includes(e)?"numbered":null}function Qe(){const e=!this.isEmpty&&("ul"==this.getChild(0).name||"ol"==this.getChild(0).name);return this.isEmpty||e?0:Ee.SH.call(this)}class Ye extends n.k_{static get pluginName(){return"LegacyListUtils"}getListTypeFromListStyleType(e){return Je(e)}getSelectedListItems(e){return Ke(e)}getSiblingNodes(e,t){return qe(e,t)}}function Xe(e){return(t,i,n)=>{const o=n.consumable;if(!o.test(i.item,"insert")||!o.test(i.item,"attribute:listType")||!o.test(i.item,"attribute:listIndent"))return;o.consume(i.item,"insert"),o.consume(i.item,"attribute:listType"),o.consume(i.item,"attribute:listIndent");const s=i.item;We(s,ze(s,n),n,e)}}const et=(e,t,i)=>{if(!i.consumable.test(t.item,e.name))return;const n=i.mapper.toViewElement(t.item),o=i.writer;o.breakContainer(o.createPositionBefore(n)),o.breakContainer(o.createPositionAfter(n));const s=n.parent,r="numbered"==t.attributeNewValue?"ol":"ul";o.rename(r,s)},tt=(e,t,i)=>{i.consumable.consume(t.item,e.name);const n=i.mapper.toViewElement(t.item).parent,o=i.writer;He(o,n,n.nextSibling),He(o,n.previousSibling,n)},it=(e,t,i)=>{if(i.consumable.test(t.item,e.name)&&"listItem"!=t.item.name){let e=i.mapper.toViewPosition(t.range.start);const n=i.writer,o=[];for(;("ul"==e.parent.name||"ol"==e.parent.name)&&(e=n.breakContainer(e),"li"==e.parent.name);){const t=e,i=n.createPositionAt(e.parent,"end");if(!t.isEqual(i)){const e=n.remove(n.createRange(t,i));o.push(e)}e=n.createPositionAfter(e.parent)}if(o.length>0){for(let t=0;t<o.length;t++){const i=e.nodeBefore;if(e=n.insert(e,o[t]).end,t>0){const t=He(n,i,i.nextSibling);t&&t.parent==i&&e.offset--}}He(n,e.nodeBefore,e.nodeAfter)}}},nt=(e,t,i)=>{const n=i.mapper.toViewPosition(t.position),o=n.nodeBefore,s=n.nodeAfter;He(i.writer,o,s)},ot=(e,t,i)=>{if(i.consumable.consume(t.viewItem,{name:!0})){const e=i.writer,n=e.createElement("listItem"),o=function(e){let t=0,i=e.parent;for(;i;){if(i.is("element","li"))t++;else{const e=i.previousSibling;e&&e.is("element","li")&&t++}i=i.parent}return t}(t.viewItem);e.setAttribute("listIndent",o,n);const s=t.viewItem.parent&&"ol"==t.viewItem.parent.name?"numbered":"bulleted";if(e.setAttribute("listType",s,n),!i.safeInsert(n,t.modelCursor))return;const r=function(e,t,i){const{writer:n,schema:o}=i;let s=n.createPositionAfter(e);for(const r of t)if("ul"==r.name||"ol"==r.name)s=i.convertItem(r,s).modelCursor;else{const t=i.convertItem(r,n.createPositionAt(e,"end")),a=t.modelRange.start.nodeAfter;a&&a.is("element")&&!o.checkChild(e,a.name)&&(e=t.modelCursor.parent.is("element","listItem")?t.modelCursor.parent:ct(t.modelCursor),s=n.createPositionAfter(e))}return s}(n,t.viewItem.getChildren(),i);t.modelRange=e.createRange(t.modelCursor,r),i.updateConversionResult(n,t)}},st=(e,t,i)=>{if(i.consumable.test(t.viewItem,{name:!0})){const e=Array.from(t.viewItem.getChildren());for(const t of e)!t.is("element","li")&&!ut(t)&&t._remove()}},rt=(e,t,i)=>{if(i.consumable.test(t.viewItem,{name:!0})){if(0===t.viewItem.childCount)return;const e=[...t.viewItem.getChildren()];let i=!1;for(const t of e)i&&!ut(t)&&t._remove(),ut(t)&&(i=!0)}};function at(e){return(t,i)=>{if(i.isPhantom)return;const n=i.modelPosition.nodeBefore;if(n&&n.is("element","listItem")){const t=i.mapper.toViewElement(n),o=t.getAncestors().find(ut),s=e.createPositionAt(t,0).getWalker();for(const e of s){if("elementStart"==e.type&&e.item.is("element","li")){i.viewPosition=e.previousPosition;break}if("elementEnd"==e.type&&e.item==o){i.viewPosition=e.nextPosition;break}}}}}const lt=function(e,[t,i]){let n,o=t.is("documentFragment")?t.getChild(0):t;if(n=i?this.createSelection(i):this.document.selection,o&&o.is("element","listItem")){const e=n.getFirstPosition();let t=null;if(e.parent.is("element","listItem")?t=e.parent:e.nodeBefore&&e.nodeBefore.is("element","listItem")&&(t=e.nodeBefore),t){const e=t.getAttribute("listIndent");if(e>0)for(;o&&o.is("element","listItem");)o._setAttribute("listIndent",o.getAttribute("listIndent")+e),o=o.nextSibling}}};function ct(e){const t=new Ee.rU({startPosition:e});let i;do{i=t.next()}while(!i.value.item.is("element","listItem"));return i.value.item}function dt(e,t,i,n,o,s){const r=$e(t.nodeBefore,{sameIndent:!0,smallerIndent:!0,listIndent:e}),a=o.mapper,l=o.writer,c=r?r.getAttribute("listIndent"):null;let d;if(r)if(c==e){const e=a.toViewElement(r).parent;d=l.createPositionAfter(e)}else{const e=s.createPositionAt(r,"end");d=a.toViewPosition(e)}else d=i;d=Ue(d);for(const e of[...n.getChildren()])ut(e)&&(d=l.move(l.createRangeOn(e),d).end,He(l,e,e.nextSibling),He(l,e.previousSibling,e))}function ut(e){return e.is("element","ol")||e.is("element","ul")}class ht extends n.k_{static get pluginName(){return"LegacyListEditing"}static get requires(){return[s.x,o.ep,Ye]}init(){const e=this.editor;e.model.schema.register("listItem",{inheritAllFrom:"$block",allowAttributes:["listType","listIndent"]});const t=e.data,i=e.editing;var n;e.model.document.registerPostFixer((t=>function(e,t){const i=e.document.differ.getChanges(),n=new Map;let o=!1;for(const n of i)if("insert"==n.type&&"listItem"==n.name)s(n.position);else if("insert"==n.type&&"listItem"!=n.name){if("$text"!=n.name){const i=n.position.nodeAfter;i.hasAttribute("listIndent")&&(t.removeAttribute("listIndent",i),o=!0),i.hasAttribute("listType")&&(t.removeAttribute("listType",i),o=!0),i.hasAttribute("listStyle")&&(t.removeAttribute("listStyle",i),o=!0),i.hasAttribute("listReversed")&&(t.removeAttribute("listReversed",i),o=!0),i.hasAttribute("listStart")&&(t.removeAttribute("listStart",i),o=!0);for(const t of Array.from(e.createRangeIn(i)).filter((e=>e.item.is("element","listItem"))))s(t.previousPosition)}s(n.position.getShiftedBy(n.length))}else"remove"==n.type&&"listItem"==n.name?s(n.position):("attribute"==n.type&&"listIndent"==n.attributeKey||"attribute"==n.type&&"listType"==n.attributeKey)&&s(n.range.start);for(const e of n.values())r(e),a(e);return o;function s(e){const t=e.nodeBefore;if(t&&t.is("element","listItem")){let e=t;if(n.has(e))return;for(let t=e.previousSibling;t&&t.is("element","listItem");t=e.previousSibling)if(e=t,n.has(e))return;n.set(t,e)}else{const t=e.nodeAfter;t&&t.is("element","listItem")&&n.set(t,t)}}function r(e){let i=0,n=null;for(;e&&e.is("element","listItem");){const s=e.getAttribute("listIndent");if(s>i){let r;null===n?(n=s-i,r=i):(n>s&&(n=s),r=s-n),t.setAttribute("listIndent",r,e),o=!0}else n=null,i=e.getAttribute("listIndent")+1;e=e.nextSibling}}function a(e){let i=[],n=null;for(;e&&e.is("element","listItem");){const s=e.getAttribute("listIndent");if(n&&n.getAttribute("listIndent")>s&&(i=i.slice(0,s+1)),0!=s)if(i[s]){const n=i[s];e.getAttribute("listType")!=n&&(t.setAttribute("listType",n,e),o=!0)}else i[s]=e.getAttribute("listType");n=e,e=e.nextSibling}}}(e.model,t))),i.mapper.registerViewToModelLength("li",mt),t.mapper.registerViewToModelLength("li",mt),i.mapper.on("modelToViewPosition",at(i.view)),i.mapper.on("viewToModelPosition",(n=e.model,(e,t)=>{const i=t.viewPosition,o=i.parent,s=t.mapper;if("ul"==o.name||"ol"==o.name){if(i.isAtEnd){const e=s.toModelElement(i.nodeBefore),o=s.getModelLength(i.nodeBefore);t.modelPosition=n.createPositionBefore(e).getShiftedBy(o)}else{const e=s.toModelElement(i.nodeAfter);t.modelPosition=n.createPositionBefore(e)}e.stop()}else if("li"==o.name&&i.nodeBefore&&("ul"==i.nodeBefore.name||"ol"==i.nodeBefore.name)){const r=s.toModelElement(o);let a=1,l=i.nodeBefore;for(;l&&ut(l);)a+=s.getModelLength(l),l=l.previousSibling;t.modelPosition=n.createPositionBefore(r).getShiftedBy(a),e.stop()}})),t.mapper.on("modelToViewPosition",at(i.view)),e.conversion.for("editingDowncast").add((t=>{t.on("insert",it,{priority:"high"}),t.on("insert:listItem",Xe(e.model)),t.on("attribute:listType:listItem",et,{priority:"high"}),t.on("attribute:listType:listItem",tt,{priority:"low"}),t.on("attribute:listIndent:listItem",function(e){return(t,i,n)=>{if(!n.consumable.consume(i.item,"attribute:listIndent"))return;const o=n.mapper.toViewElement(i.item),s=n.writer;s.breakContainer(s.createPositionBefore(o)),s.breakContainer(s.createPositionAfter(o));const r=o.parent,a=r.previousSibling,l=s.createRangeOn(r);s.remove(l),a&&a.nextSibling&&He(s,a,a.nextSibling),dt(i.attributeOldValue+1,i.range.start,l.start,o,n,e),We(i.item,o,n,e);for(const e of i.item.getChildren())n.consumable.consume(e,"insert")}}(e.model)),t.on("remove:listItem",function(e){return(t,i,n)=>{const o=n.mapper.toViewPosition(i.position).getLastMatchingPosition((e=>!e.item.is("element","li"))).nodeAfter,s=n.writer;s.breakContainer(s.createPositionBefore(o)),s.breakContainer(s.createPositionAfter(o));const r=o.parent,a=r.previousSibling,l=s.createRangeOn(r),c=s.remove(l);a&&a.nextSibling&&He(s,a,a.nextSibling),dt(n.mapper.toModelElement(o).getAttribute("listIndent")+1,i.position,l.start,o,n,e);for(const e of s.createRangeIn(c).getItems())n.mapper.unbindViewElement(e);t.stop()}}(e.model)),t.on("remove",nt,{priority:"low"})})),e.conversion.for("dataDowncast").add((t=>{t.on("insert",it,{priority:"high"}),t.on("insert:listItem",Xe(e.model))})),e.conversion.for("upcast").add((e=>{e.on("element:ul",st,{priority:"high"}),e.on("element:ol",st,{priority:"high"}),e.on("element:li",rt,{priority:"high"}),e.on("element:li",ot)})),e.model.on("insertContent",lt,{priority:"high"}),e.commands.add("numberedList",new Le(e,"numbered")),e.commands.add("bulletedList",new Le(e,"bulleted")),e.commands.add("indentList",new De(e,"forward")),e.commands.add("outdentList",new De(e,"backward"));const o=i.view.document;this.listenTo(o,"enter",((e,t)=>{const i=this.editor.model.document,n=i.selection.getLastPosition().parent;i.selection.isCollapsed&&"listItem"==n.name&&n.isEmpty&&(this.editor.execute("outdentList"),t.preventDefault(),e.stop())}),{context:"li"}),this.listenTo(o,"delete",((e,t)=>{if("backward"!==t.direction)return;const i=this.editor.model.document.selection;if(!i.isCollapsed)return;const n=i.getFirstPosition();if(!n.isAtStart)return;const o=n.parent;"listItem"===o.name&&(o.previousSibling&&"listItem"===o.previousSibling.name||(this.editor.execute("outdentList"),t.preventDefault(),e.stop()))}),{context:"li"}),this.listenTo(e.editing.view.document,"tab",((t,i)=>{const n=i.shiftKey?"outdentList":"indentList";this.editor.commands.get(n).isEnabled&&(e.execute(n),i.stopPropagation(),i.preventDefault(),t.stop())}),{context:"li"})}afterInit(){const e=this.editor.commands,t=e.get("indent"),i=e.get("outdent");t&&t.registerChildCommand(e.get("indentList")),i&&i.registerChildCommand(e.get("outdentList"))}}function mt(e){let t=1;for(const i of e.getChildren())if("ul"==i.name||"ol"==i.name)for(const e of i.getChildren())t+=mt(e);return t}class gt extends n.k_{static get requires(){return[ht,X]}static get pluginName(){return"LegacyList"}}class ft extends n.uB{constructor(e,t){super(e),this.defaultType=t}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){this._tryToConvertItemsToList(e);const t=this.editor.model,i=Ke(t);i.length&&t.change((t=>{for(const n of i)t.setAttribute("listStyle",e.type||this.defaultType,n)}))}_getValue(){const e=this.editor.model.document.selection.getFirstPosition().parent;return e&&e.is("element","listItem")?e.getAttribute("listStyle"):null}_checkEnabled(){const e=this.editor,t=e.commands.get("numberedList"),i=e.commands.get("bulletedList");return t.isEnabled||i.isEnabled}_tryToConvertItemsToList(e){if(!e.type)return;const t=Je(e.type);if(!t)return;const i=this.editor,n=`${t}List`;i.commands.get(n).value||i.execute(n)}}class pt extends n.uB{refresh(){const e=this._getValue();this.value=e,this.isEnabled=null!=e}execute(e={}){const t=this.editor.model,i=Ke(t).filter((e=>"numbered"==e.getAttribute("listType")));t.change((t=>{for(const n of i)t.setAttribute("listReversed",!!e.reversed,n)}))}_getValue(){const e=this.editor.model.document.selection.getFirstPosition().parent;return e&&e.is("element","listItem")&&"numbered"==e.getAttribute("listType")?e.getAttribute("listReversed"):null}}class bt extends n.uB{refresh(){const e=this._getValue();this.value=e,this.isEnabled=null!=e}execute({startIndex:e=1}={}){const t=this.editor.model,i=Ke(t).filter((e=>"numbered"==e.getAttribute("listType")));t.change((t=>{for(const n of i)t.setAttribute("listStart",e>=0?e:1,n)}))}_getValue(){const e=this.editor.model.document.selection.getFirstPosition().parent;return e&&e.is("element","listItem")&&"numbered"==e.getAttribute("listType")?e.getAttribute("listStart"):null}}const wt="default";class vt extends n.k_{static get requires(){return[ht]}static get pluginName(){return"LegacyListPropertiesEditing"}constructor(e){super(e),e.config.define("list",{properties:{styles:!0,startIndex:!1,reversed:!1}})}init(){const e=this.editor,t=e.model,i=function(e){const t=[];return e.styles&&t.push({attributeName:"listStyle",defaultValue:wt,addCommand(e){e.commands.add("listStyle",new ft(e,wt))},appliesToListItem:()=>!0,setAttributeOnDowncast(e,t,i){t&&t!==wt?e.setStyle("list-style-type",t,i):e.removeStyle("list-style-type",i)},getAttributeOnUpcast:e=>e.getStyle("list-style-type")||wt}),e.reversed&&t.push({attributeName:"listReversed",defaultValue:!1,addCommand(e){e.commands.add("listReversed",new pt(e))},appliesToListItem:e=>"numbered"==e.getAttribute("listType"),setAttributeOnDowncast(e,t,i){t?e.setAttribute("reversed","reversed",i):e.removeAttribute("reversed",i)},getAttributeOnUpcast:e=>e.hasAttribute("reversed")}),e.startIndex&&t.push({attributeName:"listStart",defaultValue:1,addCommand(e){e.commands.add("listStart",new bt(e))},appliesToListItem:e=>"numbered"==e.getAttribute("listType"),setAttributeOnDowncast(e,t,i){0==t||t>1?e.setAttribute("start",t,i):e.removeAttribute("start",i)},getAttributeOnUpcast(e){const t=e.getAttribute("start");return t>=0?t:1}}),t}(e.config.get("list.properties"));t.schema.extend("listItem",{allowAttributes:i.map((e=>e.attributeName))});for(const t of i)t.addCommand(e);var n;this.listenTo(e.commands.get("indentList"),"_executeCleanup",function(e,t){return(i,n)=>{const o=n[0],s=o.getAttribute("listIndent"),r=n.filter((e=>e.getAttribute("listIndent")===s));let a=null;o.previousSibling.getAttribute("listIndent")+1!==s&&(a=$e(o.previousSibling,{sameIndent:!0,direction:"backward",listIndent:s})),e.model.change((e=>{for(const i of r)for(const n of t)if(n.appliesToListItem(i)){const t=null==a?n.defaultValue:a.getAttribute(n.attributeName);e.setAttribute(n.attributeName,t,i)}}))}}(e,i)),this.listenTo(e.commands.get("outdentList"),"_executeCleanup",function(e,t){return(i,n)=>{if(!(n=n.reverse().filter((e=>e.is("element","listItem")))).length)return;const o=n[0].getAttribute("listIndent"),s=n[0].getAttribute("listType");let r=n[0].previousSibling;if(r.is("element","listItem"))for(;r.getAttribute("listIndent")!==o;)r=r.previousSibling;else r=null;r||(r=n[n.length-1].nextSibling),r&&r.is("element","listItem")&&r.getAttribute("listType")===s&&e.model.change((e=>{const i=n.filter((e=>e.getAttribute("listIndent")===o));for(const n of i)for(const i of t)if(i.appliesToListItem(n)){const t=i.attributeName,o=r.getAttribute(t);e.setAttribute(t,o,n)}}))}}(e,i)),this.listenTo(e.commands.get("bulletedList"),"_executeCleanup",kt(e)),this.listenTo(e.commands.get("numberedList"),"_executeCleanup",kt(e)),t.document.registerPostFixer(function(e,t){return i=>{let n=!1;const o=Ct(e.model.document.differ.getChanges()).filter((e=>"todo"!==e.getAttribute("listType")));if(!o.length)return n;let s=o[o.length-1].nextSibling;if((!s||!s.is("element","listItem"))&&(s=o[0].previousSibling,s)){const e=o[0].getAttribute("listIndent");for(;s.is("element","listItem")&&s.getAttribute("listIndent")!==e&&(s=s.previousSibling,s););}for(const e of t){const t=e.attributeName;for(const r of o)if(e.appliesToListItem(r))if(r.hasAttribute(t)){const o=r.previousSibling;yt(o,r,e.attributeName)&&(i.setAttribute(t,o.getAttribute(t),r),n=!0)}else _t(s,r,e)?i.setAttribute(t,s.getAttribute(t),r):i.setAttribute(t,e.defaultValue,r),n=!0;else i.removeAttribute(t,r)}return n}}(e,i)),e.conversion.for("upcast").add((n=i,e=>{e.on("element:li",((e,t,i)=>{if(!t.modelRange)return;const o=t.viewItem.parent,s=t.modelRange.start.nodeAfter||t.modelRange.end.nodeBefore;for(const e of n)if(e.appliesToListItem(s)){const t=e.getAttributeOnUpcast(o);i.writer.setAttribute(e.attributeName,t,s)}}),{priority:"low"})})),e.conversion.for("downcast").add(function(e){return t=>{for(const i of e)t.on(`attribute:${i.attributeName}:listItem`,((e,t,n)=>{const o=n.writer,s=t.item,r=$e(s.previousSibling,{sameIndent:!0,listIndent:s.getAttribute("listIndent"),direction:"backward"}),a=n.mapper.toViewElement(s);var l,c;l=s,(c=r)&&l.getAttribute("listType")===c.getAttribute("listType")&&l.getAttribute("listIndent")===c.getAttribute("listIndent")&&l.getAttribute("listStyle")===c.getAttribute("listStyle")&&l.getAttribute("listReversed")===c.getAttribute("listReversed")&&l.getAttribute("listStart")===c.getAttribute("listStart")||o.breakContainer(o.createPositionBefore(a)),i.setAttributeOnDowncast(o,t.attributeNewValue,a.parent)}),{priority:"low"})}}(i)),this._mergeListAttributesWhileMergingLists(i)}afterInit(){const e=this.editor;e.commands.get("todoList")&&e.model.document.registerPostFixer(function(e){return t=>{const i=Ct(e.model.document.differ.getChanges()).filter((e=>"todo"===e.getAttribute("listType")&&(e.hasAttribute("listStyle")||e.hasAttribute("listReversed")||e.hasAttribute("listStart"))));if(!i.length)return!1;for(const e of i)t.removeAttribute("listStyle",e),t.removeAttribute("listReversed",e),t.removeAttribute("listStart",e);return!0}}(e))}_mergeListAttributesWhileMergingLists(e){const t=this.editor.model;let i;this.listenTo(t,"deleteContent",((e,[t])=>{const n=t.getFirstPosition(),o=t.getLastPosition();if(n.parent===o.parent)return;if(!n.parent.is("element","listItem"))return;const s=o.parent.nextSibling;if(!s||!s.is("element","listItem"))return;const r=$e(n.parent,{sameIndent:!0,listIndent:s.getAttribute("listIndent")});r&&r.getAttribute("listType")===s.getAttribute("listType")&&(i=r)}),{priority:"high"}),this.listenTo(t,"deleteContent",(()=>{i&&(t.change((t=>{const n=$e(i.nextSibling,{sameIndent:!0,listIndent:i.getAttribute("listIndent"),direction:"forward"});if(!n)return void(i=null);const o=[n,...qe(t.createPositionAt(n,0),"forward")];for(const n of o)for(const o of e)if(o.appliesToListItem(n)){const e=o.attributeName,s=i.getAttribute(e);t.setAttribute(e,s,n)}})),i=null)}),{priority:"low"})}}function _t(e,t,i){if(!e)return!1;const n=e.getAttribute(i.attributeName);return!!n&&n!=i.defaultValue&&e.getAttribute("listType")===t.getAttribute("listType")}function yt(e,t,i){if(!e||!e.is("element","listItem"))return!1;if(t.getAttribute("listType")!==e.getAttribute("listType"))return!1;const n=e.getAttribute("listIndent");if(n<1||n!==t.getAttribute("listIndent"))return!1;const o=e.getAttribute(i);return!(!o||o===t.getAttribute(i))}function kt(e){return(t,i)=>{i=i.filter((e=>e.is("element","listItem"))),e.model.change((e=>{for(const t of i)e.removeAttribute("listStyle",t)}))}}function Ct(e){const t=[];for(const i of e){const e=At(i);e&&e.is("element","listItem")&&t.push(e)}return t}function At(e){return"attribute"===e.type?e.range.start.nodeAfter:"insert"===e.type?e.position.nodeAfter:null}class Et extends n.k_{static get requires(){return[vt,ve]}static get pluginName(){return"LegacyListProperties"}}const xt="todoListChecked";class Tt extends n.uB{constructor(e){super(e),this._selectedElements=[],this.on("execute",(()=>{this.refresh()}),{priority:"highest"})}refresh(){this._selectedElements=this._getSelectedItems(),this.value=this._selectedElements.every((e=>!!e.getAttribute(xt))),this.isEnabled=!!this._selectedElements.length}_getSelectedItems(){const e=this.editor.model,t=e.schema,i=e.document.selection.getFirstRange(),n=i.start.parent,o=[];t.checkAttribute(n,xt)&&o.push(n);for(const e of i.getItems())t.checkAttribute(e,xt)&&!o.includes(e)&&o.push(e);return o}execute(e={}){this.editor.model.change((t=>{for(const i of this._selectedElements)(void 0===e.forceValue?!this.value:e.forceValue)?t.setAttribute(xt,!0,i):t.removeAttribute(xt,i)}))}}const Pt=(e,t,i)=>{const n=t.modelCursor,o=n.parent,s=t.viewItem;if("checkbox"!=s.getAttribute("type")||"listItem"!=o.name||!n.isAtStart)return;if(!i.consumable.consume(s,{name:!0}))return;const r=i.writer;r.setAttribute("listType","todo",o),t.viewItem.hasAttribute("checked")&&r.setAttribute("todoListChecked",!0,o),t.modelRange=r.createRange(n)};function It(e){return(t,i)=>{const n=i.modelPosition,o=n.parent;if(!o.is("element","listItem")||"todo"!=o.getAttribute("listType"))return;const s=Vt(i.mapper.toViewElement(o),e);s&&(i.viewPosition=i.mapper.findPositionIn(s,n.offset))}}function St(e,t,i,n){return t.createUIElement("label",{class:"todo-list__label",contenteditable:!1},(function(t){const o=(0,r.n)(document,"input",{type:"checkbox",tabindex:"-1"});i&&o.setAttribute("checked","checked"),o.addEventListener("change",(()=>n(e)));const s=this.toDomElement(t);return s.appendChild(o),s}))}function Vt(e,t){const i=t.createRangeIn(e);for(const e of i)if(e.item.is("containerElement","span")&&e.item.hasClass("todo-list__label__description"))return e.item}const Rt=(0,r.ZX)("Ctrl+Enter");class Bt extends n.k_{static get pluginName(){return"LegacyTodoListEditing"}static get requires(){return[ht]}init(){const e=this.editor,{editing:t,data:i,model:n}=e;n.schema.extend("listItem",{allowAttributes:["todoListChecked"]}),n.schema.addAttributeCheck(((e,t)=>{const i=e.last;if("todoListChecked"==t&&"listItem"==i.name&&"todo"!=i.getAttribute("listType"))return!1})),e.commands.add("todoList",new Le(e,"todo"));const o=new Tt(e);var s,a;e.commands.add("checkTodoList",o),e.commands.add("todoListCheck",o),i.downcastDispatcher.on("insert:listItem",function(e){return(t,i,n)=>{const o=n.consumable;if(!o.test(i.item,"insert")||!o.test(i.item,"attribute:listType")||!o.test(i.item,"attribute:listIndent"))return;if("todo"!=i.item.getAttribute("listType"))return;const s=i.item;o.consume(s,"insert"),o.consume(s,"attribute:listType"),o.consume(s,"attribute:listIndent"),o.consume(s,"attribute:todoListChecked");const r=n.writer,a=ze(s,n);r.addClass("todo-list",a.parent);const l=r.createContainerElement("label",{class:"todo-list__label"}),c=r.createEmptyElement("input",{type:"checkbox",disabled:"disabled"}),d=r.createContainerElement("span",{class:"todo-list__label__description"});s.getAttribute("todoListChecked")&&r.setAttribute("checked","checked",c),r.insert(r.createPositionAt(a,0),l),r.insert(r.createPositionAt(l,0),c),r.insert(r.createPositionAfter(c),d),We(s,a,n,e)}}(n),{priority:"high"}),i.upcastDispatcher.on("element:input",Pt,{priority:"high"}),t.downcastDispatcher.on("insert:listItem",function(e,t){return(i,n,o)=>{const s=o.consumable;if(!s.test(n.item,"insert")||!s.test(n.item,"attribute:listType")||!s.test(n.item,"attribute:listIndent"))return;if("todo"!=n.item.getAttribute("listType"))return;const r=n.item;s.consume(r,"insert"),s.consume(r,"attribute:listType"),s.consume(r,"attribute:listIndent"),s.consume(r,"attribute:todoListChecked");const a=o.writer,l=ze(r,o),c=!!r.getAttribute("todoListChecked"),d=St(r,a,c,t),u=a.createContainerElement("span",{class:"todo-list__label__description"});a.addClass("todo-list",l.parent),a.insert(a.createPositionAt(l,0),d),a.insert(a.createPositionAfter(d),u),We(r,l,o,e)}}(n,(e=>this._handleCheckmarkChange(e))),{priority:"high"}),t.downcastDispatcher.on("attribute:listType:listItem",(s=e=>this._handleCheckmarkChange(e),a=t.view,(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const n=i.mapper.toViewElement(t.item),o=i.writer,r=function(e,t){const i=t.createRangeIn(e);for(const e of i)if(e.item.is("uiElement","label"))return e.item}(n,a);if("todo"==t.attributeNewValue){const e=!!t.item.getAttribute("todoListChecked"),i=St(t.item,o,e,s),r=o.createContainerElement("span",{class:"todo-list__label__description"}),a=o.createRangeIn(n),l=je(n),c=Ue(a.start),d=l?o.createPositionBefore(l):a.end,u=o.createRange(c,d);o.addClass("todo-list",n.parent),o.move(u,o.createPositionAt(r,0)),o.insert(o.createPositionAt(n,0),i),o.insert(o.createPositionAfter(i),r)}else if("todo"==t.attributeOldValue){const e=Vt(n,a);o.removeClass("todo-list",n.parent),o.remove(r),o.move(o.createRangeIn(e),o.createPositionBefore(e)),o.remove(e)}})),t.downcastDispatcher.on("attribute:todoListChecked:listItem",function(e){return(t,i,n)=>{if("todo"!=i.item.getAttribute("listType"))return;if(!n.consumable.consume(i.item,"attribute:todoListChecked"))return;const{mapper:o,writer:s}=n,r=!!i.item.getAttribute("todoListChecked"),a=o.toViewElement(i.item).getChild(0),l=St(i.item,s,r,e);s.insert(s.createPositionAfter(a),l),s.remove(a)}}((e=>this._handleCheckmarkChange(e)))),t.mapper.on("modelToViewPosition",It(t.view)),i.mapper.on("modelToViewPosition",It(t.view)),this.listenTo(t.view.document,"arrowKey",function(e,t){return(i,n)=>{if("left"!=(0,r.Kf)(n.keyCode,t.contentLanguageDirection))return;const o=e.schema,s=e.document.selection;if(!s.isCollapsed)return;const a=s.getFirstPosition(),l=a.parent;if("listItem"===l.name&&"todo"==l.getAttribute("listType")&&a.isAtStart){const t=o.getNearestSelectionRange(e.createPositionBefore(l),"backward");t&&e.change((e=>e.setSelection(t))),n.preventDefault(),n.stopPropagation(),i.stop()}}}(n,e.locale),{context:"li"}),this.listenTo(t.view.document,"keydown",((t,i)=>{(0,r.QC)(i)===Rt&&(e.execute("checkTodoList"),t.stop())}),{priority:"high"});const l=new Set;this.listenTo(n,"applyOperation",((e,t)=>{const i=t[0];if("rename"==i.type&&"listItem"==i.oldName){const e=i.position.nodeAfter;e.hasAttribute("todoListChecked")&&l.add(e)}else if("changeAttribute"==i.type&&"listType"==i.key&&"todo"===i.oldValue)for(const e of i.range.getItems())e.hasAttribute("todoListChecked")&&"todo"!==e.getAttribute("listType")&&l.add(e)})),n.document.registerPostFixer((e=>{let t=!1;for(const i of l)e.removeAttribute("todoListChecked",i),t=!0;return l.clear(),t})),this._initAriaAnnouncements()}_handleCheckmarkChange(e){const t=this.editor,i=t.model,n=Array.from(i.document.selection.getRanges());i.change((i=>{i.setSelection(e,"end"),t.execute("checkTodoList"),i.setSelection(n)}))}_initAriaAnnouncements(){const{model:e,ui:t,t:i}=this.editor;let n=null;t&&e.document.selection.on("change:range",(()=>{const o=e.document.selection.focus.parent,s=Mt(n),r=Mt(o);s&&!r?t.ariaLiveAnnouncer.announce(i("Leaving a to-do list")):!s&&r&&t.ariaLiveAnnouncer.announce(i("Entering a to-do list")),n=o}))}}function Mt(e){return!!e&&e.is("element","listItem")&&"todo"===e.getAttribute("listType")}class Ot extends n.k_{static get requires(){return[Bt,Me]}static get pluginName(){return"LegacyTodoList"}}class Lt extends n.k_{static get pluginName(){return"AdjacentListsSupport"}init(){const e=this.editor;e.model.schema.register("listSeparator",{allowWhere:"$block",isBlock:!0}),e.conversion.for("upcast").add((e=>{e.on("element:ol",Ft()),e.on("element:ul",Ft())})).elementToElement({model:"listSeparator",view:"ck-list-separator"}),e.conversion.for("editingDowncast").elementToElement({model:"listSeparator",view:{name:"div",classes:["ck-list-separator","ck-hidden"]}}),e.conversion.for("dataDowncast").elementToElement({model:"listSeparator",view:(e,t)=>{const i=t.writer.createContainerElement("ck-list-separator");return t.writer.setCustomProperty("dataPipeline:transparentRendering",!0,i),i.getFillerOffset=()=>null,i}})}}function Ft(){return(e,t,i)=>{const n=t.viewItem,o=n.nextSibling;if(!o)return;if(n.name!==o.name)return;t.modelRange||Object.assign(t,i.convertChildren(t.viewItem,t.modelCursor));const s=i.writer,r=s.createElement("listSeparator");if(!i.safeInsert(r,t.modelCursor))return;const a=i.getSplitParts(r);t.modelRange=s.createRange(t.modelRange.start,s.createPositionAfter(a[a.length-1])),i.updateConversionResult(r,t)}}class Nt extends n.k_{static get requires(){return[ee]}static get pluginName(){return"DocumentList"}constructor(e){super(e),(0,r.FF)("plugin-obsolete-documentlist",{pluginName:"DocumentList"})}}class Dt extends n.k_{static get requires(){return[Ae]}static get pluginName(){return"DocumentListProperties"}constructor(e){super(e),(0,r.FF)("plugin-obsolete-documentlistproperties",{pluginName:"DocumentListProperties"})}}class zt extends n.k_{static get requires(){return[Oe]}static get pluginName(){return"TodoDocumentList"}constructor(e){super(e),(0,r.FF)("plugin-obsolete-tododocumentlist",{pluginName:"TodoDocumentList"})}}},2801:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DomWrapperView:()=>w,Mention:()=>I,MentionEditing:()=>a,MentionListItemView:()=>v,MentionUI:()=>k,MentionsView:()=>b});var n=i(1204),o=i(5318);const s={"(":")","[":"]","{":"}"};class r extends n.uB{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"mention")}execute(e){const t=this.editor.model,i=t.document.selection,n="string"==typeof e.mention?{id:e.mention}:e.mention,r=n.id,a=e.range||i.getFirstRange();if(!t.canEditAt(a))return;const c=e.text||r,d=l({_text:c,id:r},n);if(1!=e.marker.length)throw new o.Yb("mentioncommand-incorrect-marker",this);if(r.charAt(0)!=e.marker)throw new o.Yb("mentioncommand-incorrect-id",this);t.change((e=>{const n=(0,o.av)(i.getAttributes()),r=new Map(n.entries());r.set("mention",d);const l=t.insertContent(e.createText(c,r),a),u=l.start.nodeBefore,h=l.end.nodeAfter,m=h&&h.is("$text")&&h.data.startsWith(" ");let g=!1;if(u&&h&&u.is("$text")&&h.is("$text")){const e=u.data.slice(-1),t=e in s,i=t&&h.data.startsWith(s[e]);g=t&&i}g||m||t.insertContent(e.createText(" ",n),a.start.getShiftedBy(c.length))}))}}class a extends n.k_{static get pluginName(){return"MentionEditing"}init(){const e=this.editor,t=e.model,i=t.document;t.schema.extend("$text",{allowAttributes:"mention"}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",key:"data-mention",classes:"mention"},model:{key:"mention",value:e=>c(e)}}),e.conversion.for("downcast").attributeToElement({model:"mention",view:u}),e.conversion.for("downcast").add(d),i.registerPostFixer((e=>function(e,t,i){const n=t.differ.getChanges();let o=!1;for(const t of n){if("attribute"==t.type)continue;const n=t.position;if("$text"==t.name){const t=n.textNode&&n.textNode.nextSibling;o=m(n.textNode,e)||o,o=m(t,e)||o,o=m(n.nodeBefore,e)||o,o=m(n.nodeAfter,e)||o}if("$text"!=t.name&&"insert"==t.type){const t=n.nodeAfter;for(const i of e.createRangeIn(t).getItems())o=m(i,e)||o}if("insert"==t.type&&i.isInline(t.name)){const t=n.nodeAfter&&n.nodeAfter.nextSibling;o=m(n.nodeBefore,e)||o,o=m(t,e)||o}}return o}(e,i,t.schema))),i.registerPostFixer((e=>function(e,t){const i=t.differ.getChanges();let n=!1;for(const t of i)if("attribute"===t.type&&"mention"!=t.attributeKey){const i=t.range.start.nodeBefore,o=t.range.end.nodeAfter;for(const s of[i,o])h(s)&&s.getAttribute(t.attributeKey)!=t.attributeNewValue&&(e.setAttribute(t.attributeKey,t.attributeNewValue,s),n=!0)}return n}(e,i))),i.registerPostFixer((e=>function(e,t){const i=t.selection,n=i.focus;return!!(i.isCollapsed&&i.hasAttribute("mention")&&function(e){const t=e.isAtStart;return e.nodeBefore&&e.nodeBefore.is("$text")||t}(n))&&(e.removeSelectionAttribute("mention"),!0)}(e,i))),e.commands.add("mention",new r(e))}}function l(e,t){return Object.assign({uid:(0,o.Ld)()},e,t||{})}function c(e,t){const i=e.getAttribute("data-mention"),n=e.getChild(0);if(n)return l({id:i,_text:n.data},t)}function d(e){e.on("attribute:mention",((e,t,i)=>{const n=t.attributeNewValue;if(!t.item.is("$textProxy")||!n)return;const o=t.range.start;(o.textNode||o.nodeAfter).data!=n._text&&i.consumable.consume(t.item,e.name)}),{priority:"highest"})}function u(e,{writer:t}){if(!e)return;const i={class:"mention","data-mention":e.id},n={id:e.uid,priority:20};return t.createAttributeElement("span",i,n)}function h(e){return!(!e||!e.is("$text")&&!e.is("$textProxy")||!e.hasAttribute("mention"))&&e.data!=e.getAttribute("mention")._text}function m(e,t){return!!h(e)&&(t.removeAttribute("mention",e),!0)}var g=i(949),f=i(7211),p=i(2223);class b extends g.uO{constructor(e){super(e),this.extendTemplate({attributes:{class:["ck-mentions"],tabindex:"-1"}})}selectFirst(){this.select(0)}selectNext(){const e=this.selected,t=this.items.getIndex(e);this.select(t+1)}selectPrevious(){const e=this.selected,t=this.items.getIndex(e);this.select(t-1)}select(e){let t=0;e>0&&e<this.items.length?t=e:e<0&&(t=this.items.length-1);const i=this.items.get(t);this.selected!==i&&(this.selected&&this.selected.removeHighlight(),i.highlight(),this.selected=i,this._isItemVisibleInScrolledArea(i)||(this.element.scrollTop=i.element.offsetTop))}executeSelected(){this.selected.fire("execute")}_isItemVisibleInScrolledArea(e){return new o.rw(this.element).contains(new o.rw(e.element))}}class w extends g.Ss{constructor(e,t){super(e),this.template=void 0,this.domElement=t,this.domElement.classList.add("ck-button"),this.set("isOn",!1),this.on("change:isOn",((e,t,i)=>{i?(this.domElement.classList.add("ck-on"),this.domElement.classList.remove("ck-off")):(this.domElement.classList.add("ck-off"),this.domElement.classList.remove("ck-on"))})),this.listenTo(this.domElement,"click",(()=>{this.fire("execute")}))}render(){super.render(),this.element=this.domElement}focus(){this.domElement.focus()}}class v extends g.BD{highlight(){this.children.first.isOn=!0}removeHighlight(){this.children.first.isOn=!1}}const _=[o.uP.arrowup,o.uP.arrowdown,o.uP.esc],y=[o.uP.enter,o.uP.tab];class k extends n.k_{static get pluginName(){return"MentionUI"}static get requires(){return[g.pU]}constructor(e){super(e),this._items=new o.pM,this._mentionsView=this._createMentionView(),this._mentionsConfigurations=new Map,this._requestFeedDebounced=(0,p.A)(this._requestFeed,100),e.config.define("mention",{feeds:[]})}init(){const e=this.editor,t=e.config.get("mention.commitKeys")||y,i=_.concat(t);this._balloon=e.plugins.get(g.pU),e.editing.view.document.on("keydown",((e,n)=>{var s;s=n.keyCode,i.includes(s)&&this._isUIVisible&&(n.preventDefault(),e.stop(),n.keyCode==o.uP.arrowdown&&this._mentionsView.selectNext(),n.keyCode==o.uP.arrowup&&this._mentionsView.selectPrevious(),t.includes(n.keyCode)&&this._mentionsView.executeSelected(),n.keyCode==o.uP.esc&&this._hideUIAndRemoveMarker())}),{priority:"highest"}),(0,g.wy)({emitter:this._mentionsView,activator:()=>this._isUIVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUIAndRemoveMarker()});const n=e.config.get("mention.feeds");for(const e of n){const{feed:t,marker:i,dropdownLimit:n}=e;if(!T(i))throw new o.Yb("mentionconfig-incorrect-marker",null,{marker:i});const s={marker:i,feedCallback:"function"==typeof t?t.bind(this.editor):x(t),itemRenderer:e.itemRenderer,dropdownLimit:n};this._mentionsConfigurations.set(i,s)}this._setupTextWatcher(n),this.listenTo(e,"change:isReadOnly",(()=>{this._hideUIAndRemoveMarker()})),this.on("requestFeed:response",((e,t)=>this._handleFeedResponse(t))),this.on("requestFeed:error",(()=>this._hideUIAndRemoveMarker()))}destroy(){super.destroy(),this._mentionsView.destroy()}get _isUIVisible(){return this._balloon.visibleView===this._mentionsView}_createMentionView(){const e=this.editor.locale,t=new b(e);return t.items.bindTo(this._items).using((i=>{const{item:n,marker:o}=i,{dropdownLimit:s}=this._mentionsConfigurations.get(o),r=s||this.editor.config.get("mention.dropdownLimit")||10;if(t.items.length>=r)return null;const a=new v(e),l=this._renderItem(n,o);return l.delegate("execute").to(a),a.children.add(l),a.item=n,a.marker=o,a.on("execute",(()=>{t.fire("execute",{item:n,marker:o})})),a})),t.on("execute",((e,t)=>{const i=this.editor,n=i.model,o=t.item,s=t.marker,r=i.model.markers.get("mention"),a=n.createPositionAt(n.document.selection.focus),l=n.createPositionAt(r.getStart()),c=n.createRange(l,a);this._hideUIAndRemoveMarker(),i.execute("mention",{mention:o,text:o.text,marker:s,range:c}),i.editing.view.focus()})),t}_getItemRenderer(e){const{itemRenderer:t}=this._mentionsConfigurations.get(e);return t}_requestFeed(e,t){this._lastRequested=t;const{feedCallback:i}=this._mentionsConfigurations.get(e),n=i(t);n instanceof Promise?n.then((i=>{this._lastRequested==t?this.fire("requestFeed:response",{feed:i,marker:e,feedText:t}):this.fire("requestFeed:discarded",{feed:i,marker:e,feedText:t})})).catch((t=>{this.fire("requestFeed:error",{error:t}),(0,o.FF)("mention-feed-callback-error",{marker:e})})):this.fire("requestFeed:response",{feed:n,marker:e,feedText:t})}_setupTextWatcher(e){const t=this.editor,i=e.map((e=>({...e,pattern:E(e.marker,e.minimumCharacters||0)}))),n=new f.qV(t.model,function(e){return t=>{const i=A(e,t);if(!i)return!1;let n=0;0!==i.position&&(n=i.position-1);const o=t.substring(n);return i.pattern.test(o)}}(i));n.on("matched",((e,n)=>{const o=A(i,n.text),s=t.model.document.selection.focus,r=t.model.createPositionAt(s.parent,o.position);if(function(e){const t=e.textNode&&e.textNode.hasAttribute("mention"),i=e.nodeBefore;return t||i&&i.is("$text")&&i.hasAttribute("mention")}(s)||function(e){const t=e.nodeAfter;return t&&t.is("$text")&&t.hasAttribute("mention")}(r))return void this._hideUIAndRemoveMarker();const a=function(e,t){let i=0;0!==e.position&&(i=e.position-1);const n=E(e.marker,0);return t.substring(i).match(n)[2]}(o,n.text),l=o.marker.length+a.length,c=s.getShiftedBy(-l),d=s.getShiftedBy(-a.length),u=t.model.createRange(c,d);if(P(t)){const e=t.model.markers.get("mention");t.model.change((t=>{t.updateMarker(e,{range:u})}))}else t.model.change((e=>{e.addMarker("mention",{range:u,usingOperation:!1,affectsData:!1})}));this._requestFeedDebounced(o.marker,a)})),n.on("unmatched",(()=>{this._hideUIAndRemoveMarker()}));const o=t.commands.get("mention");return n.bind("isEnabled").to(o),n}_handleFeedResponse(e){const{feed:t,marker:i}=e;if(!P(this.editor))return;this._items.clear();for(const e of t){const t="object"!=typeof e?{id:e,text:e}:e;this._items.add({item:t,marker:i})}const n=this.editor.model.markers.get("mention");this._items.length?this._showOrUpdateUI(n):this._hideUIAndRemoveMarker()}_showOrUpdateUI(e){this._isUIVisible?this._balloon.updatePosition(this._getBalloonPanelPositionData(e,this._mentionsView.position)):this._balloon.add({view:this._mentionsView,position:this._getBalloonPanelPositionData(e,this._mentionsView.position),singleViewMode:!0}),this._mentionsView.position=this._balloon.view.position,this._mentionsView.selectFirst()}_hideUIAndRemoveMarker(){this._balloon.hasView(this._mentionsView)&&this._balloon.remove(this._mentionsView),P(this.editor)&&this.editor.model.change((e=>e.removeMarker("mention"))),this._mentionsView.position=void 0}_renderItem(e,t){const i=this.editor;let n,o=e.id;const s=this._getItemRenderer(t);if(s){const t=s(e);"string"!=typeof t?n=new w(i.locale,t):o=t}if(!n){const e=new g._(i.locale);e.label=o,e.withText=!0,n=e}return n}_getBalloonPanelPositionData(e,t){const i=this.editor,n=i.editing,s=n.view.domConverter,r=n.mapper;return{target:()=>{let t=e.getRange();"$graveyard"==t.start.root.rootName&&(t=i.model.document.selection.getFirstRange());const n=r.toViewRange(t);return o.rw.getDomRangeRects(s.viewRangeToDom(n)).pop()},limiter:()=>{const e=this.editor.editing.view,t=e.document.selection.editableElement;return t?e.domConverter.mapViewToDom(t.root):null},positions:C(t,i.locale.uiLanguageDirection)}}}function C(e,t){const i={caret_se:e=>({top:e.bottom+3,left:e.right,name:"caret_se",config:{withArrow:!1}}),caret_ne:(e,t)=>({top:e.top-t.height-3,left:e.right,name:"caret_ne",config:{withArrow:!1}}),caret_sw:(e,t)=>({top:e.bottom+3,left:e.right-t.width,name:"caret_sw",config:{withArrow:!1}}),caret_nw:(e,t)=>({top:e.top-t.height-3,left:e.right-t.width,name:"caret_nw",config:{withArrow:!1}})};return Object.prototype.hasOwnProperty.call(i,e)?[i[e]]:"rtl"!==t?[i.caret_se,i.caret_sw,i.caret_ne,i.caret_nw]:[i.caret_sw,i.caret_se,i.caret_nw,i.caret_ne]}function A(e,t){let i;for(const n of e){const e=t.lastIndexOf(n.marker);e>0&&!t.substring(e-1).match(n.pattern)||(!i||e>=i.position)&&(i={marker:n.marker,position:e,minimumCharacters:n.minimumCharacters,pattern:n.pattern})}return i}function E(e,t){const i=0==t?"*":`{${t},}`,n=o._K.features.isRegExpUnicodePropertySupported?"\\p{Ps}\\p{Pi}\"'":"\\(\\[{\"'";return e=e.replace(/[.*+?^${}()\-|[\]\\]/g,"\\$&"),new RegExp(`(?:^|[ ${n}])([${e}])(.${i})$`,"u")}function x(e){return t=>e.filter((e=>("string"==typeof e?e:String(e.id)).toLowerCase().includes(t.toLowerCase())))}function T(e){return e&&1==e.length}function P(e){return e.model.markers.has("mention")}class I extends n.k_{toMentionAttribute(e,t){return c(e,t)}static get pluginName(){return"Mention"}static get requires(){return[a,k]}}},1980:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Paragraph:()=>c,ParagraphButtonUI:()=>u});var n=i(1024),o=i(7906);class s extends n.Command{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}refresh(){const e=this.editor.model,t=e.document,i=(0,o.first)(t.selection.getSelectedBlocks());this.value=!!i&&i.is("element","paragraph"),this.isEnabled=!!i&&r(i,e.schema)}execute(e={}){const t=this.editor.model,i=t.document,n=e.selection||i.selection;t.canEditAt(n)&&t.change((e=>{const i=n.getSelectedBlocks();for(const n of i)!n.is("element","paragraph")&&r(n,t.schema)&&e.rename(n,"paragraph")}))}}function r(e,t){return t.checkChild(e.parent,"paragraph")&&!t.isObject(e)}class a extends n.Command{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}execute(e){const t=this.editor.model,i=e.attributes;let n=e.position;t.canEditAt(n)&&t.change((e=>{if(n=this._findPositionToInsertParagraph(n,e),!n)return;const o=e.createElement("paragraph");i&&t.schema.setAllowedAttributes(o,i,e),t.insertContent(o,n),e.setSelection(o,"in")}))}_findPositionToInsertParagraph(e,t){const i=this.editor.model;if(i.schema.checkChild(e,"paragraph"))return e;const n=i.schema.findAllowedParent(e,"paragraph");if(!n)return null;const o=e.parent,s=i.schema.checkChild(o,"$text");return o.isEmpty||s&&e.isAtEnd?i.createPositionAfter(o):!o.isEmpty&&s&&e.isAtStart?i.createPositionBefore(o):t.split(e,n).position}}class l extends n.Plugin{static get pluginName(){return"Paragraph"}init(){const e=this.editor,t=e.model;e.commands.add("paragraph",new s(e)),e.commands.add("insertParagraph",new a(e)),t.schema.register("paragraph",{inheritAllFrom:"$block"}),e.conversion.elementToElement({model:"paragraph",view:"p"}),e.conversion.for("upcast").elementToElement({model:(e,{writer:t})=>l.paragraphLikeElements.has(e.name)?e.isEmpty?null:t.createElement("paragraph"):null,view:/.+/,converterPriority:"low"})}}l.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]);const c=l;var d=i(7243);class u extends n.Plugin{static get requires(){return[c]}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("paragraph",(i=>{const o=new d.ButtonView(i),s=e.commands.get("paragraph");return o.label=t("Paragraph"),o.icon=n.icons.paragraph,o.tooltip=!0,o.isToggleable=!0,o.bind("isEnabled").to(s),o.bind("isOn").to(s,"value"),o.on("execute",(()=>{e.execute("paragraph")})),o}))}}},9448:(e,t,i)=>{"use strict";i.r(t),i.d(t,{MSWordNormalizer:()=>b,PasteFromOffice:()=>x,parseHtml:()=>E});var n=i(1204),o=i(7377),s=i(4133);function r(e){return void 0!==e&&e.endsWith("px")}function a(e){return e.toFixed(2).replace(/\.?0+$/,"")+"px"}function l(e){const t=e.element.previousSibling;return(i=t||e.element.parent).is("element","ol")||i.is("element","ul");var i}function c(e,t){const i=new RegExp(`@list l${e.id}:level${e.indent}\\s*({[^}]*)`,"gi"),n=/mso-level-number-format:([^;]{0,100});/gi,o=/mso-level-start-at:\s{0,100}([0-9]{0,10})\s{0,100};/gi,s=new RegExp(`@list\\s+l${e.id}:level\\d\\s*{[^{]*mso-level-text:"%\\d\\\\.`,"gi"),r=new RegExp(`@list l${e.id}:level\\d\\s*{[^{]*mso-level-number-format:`,"gi"),a=s.exec(t),l=r.exec(t),c=a&&!l,u=i.exec(t);let h="decimal",m="ol",g=null;if(u&&u[1]){const t=n.exec(u[1]);if(t&&t[1]&&(h=t[1].trim(),m="bullet"!==h&&"image"!==h?"ol":"ul"),"bullet"===h){const t=function(e){if("li"==e.name&&"ul"==e.parent.name&&e.parent.hasAttribute("type"))return e.parent.getAttribute("type");const t=function(e){if(e.getChild(0).is("$text"))return null;for(const t of e.getChildren()){if(!t.is("element","span"))continue;const e=t.getChild(0);if(e)return e.is("$text")?e:e.getChild(0)}return null}(e);if(!t)return null;const i=t._data;return"o"===i?"circle":"·"===i?"disc":"§"===i?"square":null}(e.element);t&&(h=t)}else{const e=o.exec(u[1]);e&&e[1]&&(g=parseInt(e[1]))}c&&(m="ol")}return{type:m,startIndex:g,style:d(h),isLegalStyleList:c}}function d(e){if(e.startsWith("arabic-leading-zero"))return"decimal-leading-zero";switch(e){case"alpha-upper":return"upper-alpha";case"alpha-lower":return"lower-alpha";case"roman-upper":return"upper-roman";case"roman-lower":return"lower-roman";case"circle":case"disc":case"square":return e;default:return null}}function u(e,t,i){const n=t.createElement(e.type);return e.style&&t.setStyle("list-style-type",e.style,n),e.startIndex&&e.startIndex>1&&t.setAttribute("start",e.startIndex,n),e.isLegalStyleList&&i&&t.addClass("legal-list",n),n}function h(e){const t=e.getStyle("mso-list");if(void 0===t)return{};const i=t.match(/(^|\s{1,100})l(\d+)/i),n=t.match(/\s{0,100}lfo(\d+)/i),o=t.match(/\s{0,100}level(\d+)/i);return i&&n&&o?{id:i[2],order:n[1],indent:parseInt(o[1])}:{indent:1}}function m(e,t){const i=new s.PN({name:"span",styles:{"mso-list":"Ignore"}}),n=t.createRangeIn(e);for(const e of n)"elementStart"===e.type&&i.match(e.item)&&t.remove(e.item)}function g(e){const t=e.getStyle("margin-left");return void 0===t||t.endsWith("px")?t:function(e){const t=parseFloat(e);return e.endsWith("pt")?a(96*t/72):e.endsWith("pc")?a(12*t*96/72):e.endsWith("in")?a(96*t):e.endsWith("cm")?a(96*t/2.54):e.endsWith("mm")?a(t/10*96/2.54):e}(t)}const f=/<meta\s*name="?generator"?\s*content="?microsoft\s*word\s*\d+"?\/?>/i,p=/xmlns:o="urn:schemas-microsoft-com/i;class b{constructor(e,t=!1){this.document=e,this.hasMultiLevelListPlugin=t}isActive(e){return f.test(e)||p.test(e)}execute(e){const{body:t,stylesString:i}=e._parsedData;(function(e,t,i){if(!e.childCount)return;const n=new s.Wq(e.document),o=function(e,t){const i=t.createRangeIn(e),n=[],o=new Set;for(const e of i.getItems()){if(!e.is("element")||!e.name.match(/^(p|h\d+|li|div)$/))continue;let t=g(e);if(void 0===t||0!=parseFloat(t)||Array.from(e.getClassNames()).find((e=>e.startsWith("MsoList")))||(t=void 0),e.hasStyle("mso-list")||void 0!==t&&o.has(t)){const i=h(e);n.push({element:e,id:i.id,order:i.order,indent:i.indent,marginLeft:t}),void 0!==t&&o.add(t)}else o.clear()}return n}(e,n);if(!o.length)return;const d={},f=[];for(const e of o)if(void 0!==e.indent){l(e)||(f.length=0);const o=`${e.id}:${e.indent}`,s=Math.min(e.indent-1,f.length);if(s<f.length&&f[s].id!==e.id&&(f.length=s),s<f.length-1)f.length=s+1;else{const l=c(e,t);if(s>f.length-1||f[s].listElement.name!=l.type){0==s&&"ol"==l.type&&void 0!==e.id&&d[o]&&(l.startIndex=d[o]);const t=u(l,n,i);if(r(e.marginLeft)&&(0==s||r(f[s-1].marginLeft))){let i=e.marginLeft;s>0&&(i=a(parseFloat(i)-parseFloat(f[s-1].marginLeft))),n.setStyle("padding-left",i,t)}if(0==f.length){const i=e.element.parent,o=i.getChildIndex(e.element)+1;n.insertChild(o,t,i)}else{const e=f[s-1].listItemElements;n.appendChild(t,e[e.length-1])}f[s]={...e,listElement:t,listItemElements:[]},0==s&&void 0!==e.id&&(d[o]=l.startIndex||1)}}const h="li"==e.element.name?e.element:n.createElement("li");n.appendChild(h,f[s].listElement),f[s].listItemElements.push(h),0==s&&void 0!==e.id&&d[o]++,e.element!=h&&n.appendChild(e.element,h),m(e.element,n),n.removeStyle("text-indent",e.element),n.removeStyle("margin-left",e.element)}else{const t=f.find((t=>t.marginLeft==e.marginLeft));if(t){const i=t.listItemElements;n.appendChild(e.element,i[i.length-1]),n.removeStyle("margin-left",e.element)}else f.length=0}})(t,i,this.hasMultiLevelListPlugin),function(e,t){if(!e.childCount)return;const i=new s.Wq(e.document),n=function(e,t){const i=t.createRangeIn(e),n=new s.PN({name:/v:(.+)/}),o=[];for(const e of i){if("elementStart"!=e.type)continue;const t=e.item,i=t.previousSibling,s=i&&i.is("element")?i.name:null,r=["Chart"],a=n.match(t),l=t.getAttribute("o:gfxdata"),c="v:shapetype"===s,d=l&&r.some((e=>t.getAttribute("id").includes(e)));a&&l&&!c&&!d&&o.push(e.item.getAttribute("id"))}return o}(e,i);!function(e,t,i){const n=i.createRangeIn(t),o=new s.PN({name:"img"}),r=[];for(const t of n)if(t.item.is("element")&&o.match(t.item)){const i=t.item,n=i.getAttribute("v:shapes")?i.getAttribute("v:shapes").split(" "):[];n.length&&n.every((t=>e.indexOf(t)>-1))?r.push(i):i.getAttribute("src")||r.push(i)}for(const e of r)i.remove(e)}(n,e,i),function(e,t,i){const n=i.createRangeIn(t),o=[];for(const t of n)if("elementStart"==t.type&&t.item.is("element","v:shape")){const i=t.item.getAttribute("id");if(e.includes(i))continue;s(t.item.parent.getChildren(),i)||o.push(t.item)}for(const e of o){const t={src:r(e)};e.hasAttribute("alt")&&(t.alt=e.getAttribute("alt"));const n=i.createElement("img",t);i.insertChild(e.index+1,n,e.parent)}function s(e,t){for(const i of e)if(i.is("element")){if("img"==i.name&&i.getAttribute("v:shapes")==t)return!0;if(s(i.getChildren(),t))return!0}return!1}function r(e){for(const t of e.getChildren())if(t.is("element")&&t.getAttribute("src"))return t.getAttribute("src")}}(n,e,i),function(e,t){const i=t.createRangeIn(e),n=new s.PN({name:/v:(.+)/}),o=[];for(const e of i)"elementStart"==e.type&&n.match(e.item)&&o.push(e.item);for(const e of o)t.remove(e)}(e,i);const o=function(e,t){const i=t.createRangeIn(e),n=new s.PN({name:"img"}),o=[];for(const e of i)e.item.is("element")&&n.match(e.item)&&e.item.getAttribute("src").startsWith("file://")&&o.push(e.item);return o}(e,i);o.length&&function(e,t,i){if(e.length===t.length)for(let o=0;o<e.length;o++){const s=`data:${t[o].type};base64,${n=t[o].hex,btoa(n.match(/\w{2}/g).map((e=>String.fromCharCode(parseInt(e,16)))).join(""))}`;i.setAttribute("src",s,e[o])}var n}(o,function(e){if(!e)return[];const t=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,i=new RegExp("(?:("+t.source+"))([\\da-fA-F\\s]+)\\}","g"),n=e.match(i),o=[];if(n)for(const e of n){let i=!1;e.includes("\\pngblip")?i="image/png":e.includes("\\jpegblip")&&(i="image/jpeg"),i&&o.push({hex:e.replace(t,"").replace(/[^\da-fA-F]/g,""),type:i})}return o}(t),i)}(t,e.dataTransfer.getData("text/rtf")),function(e){const t=[],i=new s.Wq(e.document);for(const{item:n}of i.createRangeIn(e))if(n.is("element")){for(const e of n.getClassNames())/\bmso/gi.exec(e)&&i.removeClass(e,n);for(const e of n.getStyleNames())/\bmso/gi.exec(e)&&i.removeStyle(e,n);(n.is("element","w:sdt")||n.is("element","w:sdtpr")&&n.isEmpty||n.is("element","o:p")&&n.isEmpty)&&t.push(n)}for(const e of t){const t=e.parent,n=t.getChildIndex(e);i.insertChild(n,e.getChildren(),t),i.remove(e)}}(t),e.content=t}}function w(e,t,i,{blockElements:n,inlineObjectElements:o}){let s=i.createPositionAt(e,"forward"==t?"after":"before");return s=s.getLastMatchingPosition((({item:e})=>e.is("element")&&!n.includes(e.name)&&!o.includes(e.name)),{direction:t}),"forward"==t?s.nodeAfter:s.nodeBefore}function v(e,t){return!!e&&e.is("element")&&t.includes(e.name)}const _=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class y{constructor(e){this.document=e}isActive(e){return _.test(e)}execute(e){const t=new s.Wq(this.document),{body:i}=e._parsedData;!function(e,t){for(const i of e.getChildren())if(i.is("element","b")&&"normal"===i.getStyle("font-weight")){const n=e.getChildIndex(i);t.remove(i),t.insertChild(n,i.getChildren(),e)}}(i,t),function(e,t){for(const i of t.createRangeIn(e)){const e=i.item;if(e.is("element","li")){const i=e.getChild(0);i&&i.is("element","p")&&t.unwrapElement(i)}}}(i,t),function(e,t){const i=new s.Vg(t.document.stylesProcessor),n=new s.P$(i,{renderingMode:"data"}),o=n.blockElements,r=n.inlineObjectElements,a=[];for(const i of t.createRangeIn(e)){const e=i.item;if(e.is("element","br")){const i=w(e,"forward",t,{blockElements:o,inlineObjectElements:r}),n=w(e,"backward",t,{blockElements:o,inlineObjectElements:r}),s=v(i,o);(v(n,o)||s)&&a.push(e)}}for(const e of a)e.hasClass("Apple-interchange-newline")?t.remove(e):t.replace(e,t.createElement("p"))}(i,t),e.content=i}}const k=/<google-sheets-html-origin/i;class C{constructor(e){this.document=e}isActive(e){return k.test(e)}execute(e){const t=new s.Wq(this.document),{body:i}=e._parsedData;!function(e,t){for(const i of e.getChildren())if(i.is("element","google-sheets-html-origin")){const n=e.getChildIndex(i);t.remove(i),t.insertChild(n,i.getChildren(),e)}}(i,t),function(e,t){for(const i of e.getChildren())i.is("element","table")&&i.hasAttribute("xmlns")&&t.removeAttribute("xmlns",i)}(i,t),function(e,t){for(const i of e.getChildren())i.is("element","table")&&"0px"===i.getStyle("width")&&t.removeStyle("width",i)}(i,t),function(e,t){for(const i of Array.from(e.getChildren()))i.is("element","style")&&t.remove(i)}(i,t),e.content=i}}function A(e){return e.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,((e,t)=>1===t.length?" ":Array(t.length+1).join("  ").substr(0,t.length)))}function E(e,t){const i=new DOMParser,n=function(e){return A(A(e)).replace(/(<span\s+style=['"]mso-spacerun:yes['"]>[^\S\r\n]*?)[\r\n]+([^\S\r\n]*<\/span>)/g,"$1$2").replace(/<span\s+style=['"]mso-spacerun:yes['"]><\/span>/g,"").replace(/(<span\s+style=['"]letter-spacing:[^'"]+?['"]>)[\r\n]+(<\/span>)/g,"$1 $2").replace(/ <\//g," </").replace(/ <o:p><\/o:p>/g," <o:p></o:p>").replace(/<o:p>(&nbsp;|\u00A0)<\/o:p>/g,"").replace(/>([^\S\r\n]*[\r\n]\s*)</g,"><")}(function(e){const t="</body>",i=e.indexOf(t);if(i<0)return e;const n=e.indexOf("</html>",i+7);return e.substring(0,i+7)+(n>=0?e.substring(n):"")}(e=(e=e.replace(/<!--\[if gte vml 1]>/g,"")).replace(/<o:SmartTagType(?:\s+[^\s>=]+(?:="[^"]*")?)*\s*\/?>/gi,""))),o=i.parseFromString(n,"text/html");!function(e){e.querySelectorAll("span[style*=spacerun]").forEach((e=>{const t=e,i=t.innerText.length||0;t.innerText=Array(i+1).join("  ").substr(0,i)}))}(o);const r=o.body.innerHTML,a=function(e,t){const i=new s.Vg(t),n=new s.P$(i,{renderingMode:"data"}),o=e.createDocumentFragment(),r=e.body.childNodes;for(;r.length>0;)o.appendChild(r[0]);return n.domToView(o,{skipComments:!0})}(o,t),l=function(e){const t=[],i=[],n=Array.from(e.getElementsByTagName("style"));for(const e of n)e.sheet&&e.sheet.cssRules&&e.sheet.cssRules.length&&(t.push(e.sheet),i.push(e.innerHTML));return{styles:t,stylesString:i.join(" ")}}(o);return{body:a,bodyString:r,styles:l.styles,stylesString:l.stylesString}}class x extends n.k_{static get pluginName(){return"PasteFromOffice"}static get requires(){return[o.xz]}init(){const e=this.editor,t=e.plugins.get("ClipboardPipeline"),i=e.editing.view.document,n=[],o=this.editor.plugins.has("MultiLevelList");n.push(new b(i,o)),n.push(new y(i)),n.push(new C(i)),t.on("inputTransformation",((t,o)=>{if(o._isTransformedWithPasteFromOffice)return;if(e.model.document.selection.getFirstPosition().parent.is("element","codeBlock"))return;const s=o.dataTransfer.getData("text/html"),r=n.find((e=>e.isActive(s)));r&&(o._parsedData||(o._parsedData=E(s,i.stylesProcessor)),r.execute(o),o._isTransformedWithPasteFromOffice=!0)}),{priority:"high"})}}},8368:(e,t,i)=>{"use strict";i.r(t),i.d(t,{RemoveFormat:()=>d,RemoveFormatEditing:()=>c,RemoveFormatUI:()=>r});var n=i(1204),o=i(949);const s="removeFormat";class r extends n.k_{static get pluginName(){return"RemoveFormatUI"}init(){const e=this.editor;e.ui.componentFactory.add(s,(()=>{const e=this._createButton(o._);return e.set({tooltip:!0}),e})),e.ui.componentFactory.add(`menuBar:${s}`,(()=>this._createButton(o.kS)))}_createButton(e){const t=this.editor,i=t.locale,n=t.commands.get(s),o=new e(t.locale),r=i.t;return o.set({label:r("Remove Format"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8.69 14.915c.053.052.173.083.36.093a.366.366 0 0 1 .345.485l-.003.01a.738.738 0 0 1-.697.497h-2.67a.374.374 0 0 1-.353-.496l.013-.038a.681.681 0 0 1 .644-.458c.197-.012.325-.043.386-.093a.28.28 0 0 0 .072-.11L9.592 4.5H6.269c-.359-.017-.609.013-.75.09-.142.078-.289.265-.442.563-.192.29-.516.464-.864.464H4.17a.43.43 0 0 1-.407-.569L4.46 3h13.08l-.62 2.043a.81.81 0 0 1-.775.574h-.114a.486.486 0 0 1-.486-.486c.001-.284-.054-.464-.167-.54-.112-.076-.367-.106-.766-.091h-3.28l-2.68 10.257c-.006.074.007.127.038.158zM3 17h8a.5.5 0 1 1 0 1H3a.5.5 0 1 1 0-1zm11.299 1.17a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.06-1.06l1.415 1.414 1.414-1.415a.75.75 0 1 1 1.06 1.06l-1.413 1.415 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414-1.414 1.414z"/></svg>'}),o.bind("isEnabled").to(n,"isEnabled"),this.listenTo(o,"execute",(()=>{t.execute(s),t.editing.view.focus()})),o}}var a=i(5318);class l extends n.uB{refresh(){const e=this.editor.model;this.isEnabled=!!(0,a.$1)(this._getFormattingItems(e.document.selection,e.schema))}execute(){const e=this.editor.model,t=e.schema;e.change((i=>{for(const n of this._getFormattingItems(e.document.selection,t))if(n.is("selection"))for(const e of this._getFormattingAttributes(n,t))i.removeSelectionAttribute(e);else{const e=i.createRangeOn(n);for(const o of this._getFormattingAttributes(n,t))i.removeAttribute(o,e)}}))}*_getFormattingItems(e,t){const i=e=>!!(0,a.$1)(this._getFormattingAttributes(e,t));for(const n of e.getRanges())for(const e of n.getItems())!t.isBlock(e)&&i(e)&&(yield e);for(const t of e.getSelectedBlocks())i(t)&&(yield t);i(e)&&(yield e)}*_getFormattingAttributes(e,t){for(const[i]of e.getAttributes()){const e=t.getAttributeProperties(i);e&&e.isFormatting&&(yield i)}}}class c extends n.k_{static get pluginName(){return"RemoveFormatEditing"}init(){const e=this.editor;e.commands.add("removeFormat",new l(e))}}class d extends n.k_{static get requires(){return[c,r]}static get pluginName(){return"RemoveFormat"}}},6206:(e,t,i)=>{"use strict";i.r(t),i.d(t,{SelectAll:()=>u,SelectAllEditing:()=>l,SelectAllUI:()=>d});var n=i(1024),o=i(7906);class s extends n.Command{constructor(e){super(e),this.affectsData=!1}execute(){const e=this.editor.model,t=e.document.selection;let i=e.schema.getLimitElement(t);if(t.containsEntireContent(i)||!r(e.schema,i))do{if(i=i.parent,!i)return}while(!r(e.schema,i));e.change((e=>{e.setSelection(i,"in")}))}}function r(e,t){return e.isLimit(t)&&(e.checkChild(t,"$text")||e.checkChild(t,"paragraph"))}const a=(0,o.parseKeystroke)("Ctrl+A");class l extends n.Plugin{static get pluginName(){return"SelectAllEditing"}init(){const e=this.editor,t=e.t,i=e.editing.view.document;e.commands.add("selectAll",new s(e)),this.listenTo(i,"keydown",((t,i)=>{(0,o.getCode)(i)===a&&(e.execute("selectAll"),i.preventDefault())})),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Select all"),keystroke:"CTRL+A"}]})}}var c=i(7243);class d extends n.Plugin{static get pluginName(){return"SelectAllUI"}init(){const e=this.editor;e.ui.componentFactory.add("selectAll",(()=>{const e=this._createButton(c.ButtonView);return e.set({tooltip:!0}),e})),e.ui.componentFactory.add("menuBar:selectAll",(()=>this._createButton(c.MenuBarMenuListItemButtonView)))}_createButton(e){const t=this.editor,i=t.locale,n=t.commands.get("selectAll"),o=new e(t.locale),s=i.t;return o.set({label:s("Select all"),icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M.75 15.5a.75.75 0 0 1 .75.75V18l.008.09A.5.5 0 0 0 2 18.5h1.75a.75.75 0 1 1 0 1.5H1.5l-.144-.007a1.5 1.5 0 0 1-1.35-1.349L0 18.5v-2.25a.75.75 0 0 1 .75-.75zm18.5 0a.75.75 0 0 1 .75.75v2.25l-.007.144a1.5 1.5 0 0 1-1.349 1.35L18.5 20h-2.25a.75.75 0 1 1 0-1.5H18a.5.5 0 0 0 .492-.41L18.5 18v-1.75a.75.75 0 0 1 .75-.75zm-10.45 3c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2H7.2a.2.2 0 0 1-.2-.2v-1.1c0-.11.09-.2.2-.2h1.6zm4 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2h-1.6a.2.2 0 0 1-.2-.2v-1.1c0-.11.09-.2.2-.2h1.6zm.45-5.5a.75.75 0 1 1 0 1.5h-8.5a.75.75 0 1 1 0-1.5h8.5zM1.3 11c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2H.2a.2.2 0 0 1-.2-.2v-1.6c0-.11.09-.2.2-.2h1.1zm18.5 0c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2h-1.1a.2.2 0 0 1-.2-.2v-1.6c0-.11.09-.2.2-.2h1.1zm-4.55-2a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.5h10.5zM1.3 7c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2H.2a.2.2 0 0 1-.2-.2V7.2c0-.11.09-.2.2-.2h1.1zm18.5 0c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2h-1.1a.2.2 0 0 1-.2-.2V7.2c0-.11.09-.2.2-.2h1.1zm-4.55-2a.75.75 0 1 1 0 1.5h-2.5a.75.75 0 1 1 0-1.5h2.5zm-5 0a.75.75 0 1 1 0 1.5h-5.5a.75.75 0 0 1 0-1.5h5.5zm-6.5-5a.75.75 0 0 1 0 1.5H2a.5.5 0 0 0-.492.41L1.5 2v1.75a.75.75 0 0 1-1.5 0V1.5l.007-.144A1.5 1.5 0 0 1 1.356.006L1.5 0h2.25zM18.5 0l.144.007a1.5 1.5 0 0 1 1.35 1.349L20 1.5v2.25a.75.75 0 1 1-1.5 0V2l-.008-.09A.5.5 0 0 0 18 1.5h-1.75a.75.75 0 1 1 0-1.5h2.25zM8.8 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2H7.2a.2.2 0 0 1-.2-.2V.2c0-.11.09-.2.2-.2h1.6zm4 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2h-1.6a.2.2 0 0 1-.2-.2V.2c0-.11.09-.2.2-.2h1.6z"/></svg>',keystroke:"Ctrl+A"}),o.bind("isEnabled").to(n,"isEnabled"),this.listenTo(o,"execute",(()=>{t.execute("selectAll"),t.editing.view.focus()})),o}}class u extends n.Plugin{static get requires(){return[l,d]}static get pluginName(){return"SelectAll"}}},478:(e,t,i)=>{"use strict";i.r(t),i.d(t,{PlainTableOutput:()=>ze,Table:()=>De,TableCaption:()=>ri,TableCaptionEditing:()=>oi,TableCaptionUI:()=>si,TableCellProperties:()=>Lt,TableCellPropertiesEditing:()=>Ot,TableCellPropertiesUI:()=>yt,TableCellWidthEditing:()=>At,TableClipboard:()=>Se,TableColumnResize:()=>ui,TableColumnResizeEditing:()=>di,TableEditing:()=>ke,TableKeyboard:()=>Me,TableMouse:()=>Fe,TableProperties:()=>Xt,TablePropertiesEditing:()=>Kt,TablePropertiesUI:()=>Yt,TableSelection:()=>Pe,TableToolbar:()=>qe,TableUI:()=>xe,TableUtils:()=>ne});var n=i(1204),o=i(5091);function s(e,t){const{modelAttribute:i,styleName:n,viewElement:o,defaultValue:s,reduceBoxSides:r=!1,shouldUpcast:a=(()=>!0)}=t;e.for("upcast").attributeToAttribute({view:{name:o,styles:{[n]:/[\s\S]+/}},model:{key:i,value:e=>{if(!a(e))return;const t=e.getNormalizedStyle(n),i=r?c(t):t;return s!==i?i:void 0}}})}function r(e,t,i,n){e.for("upcast").add((e=>e.on("element:"+t,((e,t,o)=>{if(!t.modelRange)return;const s=["border-top-width","border-top-color","border-top-style","border-bottom-width","border-bottom-color","border-bottom-style","border-right-width","border-right-color","border-right-style","border-left-width","border-left-color","border-left-style"].filter((e=>t.viewItem.hasStyle(e)));if(!s.length)return;const r={styles:s};if(!o.consumable.test(t.viewItem,r))return;const a=[...t.modelRange.getItems({shallow:!0})].pop();o.consumable.consume(t.viewItem,r);const l={style:t.viewItem.getNormalizedStyle("border-style"),color:t.viewItem.getNormalizedStyle("border-color"),width:t.viewItem.getNormalizedStyle("border-width")},d={style:c(l.style),color:c(l.color),width:c(l.width)};d.style!==n.style&&o.writer.setAttribute(i.style,d.style,a),d.color!==n.color&&o.writer.setAttribute(i.color,d.color,a),d.width!==n.width&&o.writer.setAttribute(i.width,d.width,a)}))))}function a(e,t){const{modelElement:i,modelAttribute:n,styleName:o}=t;e.for("downcast").attributeToAttribute({model:{name:i,key:n},view:e=>({key:"style",value:{[o]:e}})})}function l(e,t){const{modelAttribute:i,styleName:n}=t;e.for("downcast").add((e=>e.on(`attribute:${i}:table`,((e,t,i)=>{const{item:o,attributeNewValue:s}=t,{mapper:r,writer:a}=i;if(!i.consumable.consume(t.item,e.name))return;const l=[...r.toViewElement(o).getChildren()].find((e=>e.is("element","table")));s?a.setStyle(n,s,l):a.removeStyle(n,l)}))))}function c(e){if(!e)return;const t=["top","right","bottom","left"];if(!t.every((t=>e[t])))return e;const i=e.top;return t.every((t=>e[t]===i))?i:e}function d(e,t,i,n,o=1){null!=t&&null!=o&&t>o?n.setAttribute(e,t,i):n.removeAttribute(e,i)}function u(e,t,i={}){const n=e.createElement("tableCell",i);return e.insertElement("paragraph",n),e.insert(n,t),n}function h(e,t){const i=t.parent.parent,n=parseInt(i.getAttribute("headingColumns")||"0"),{column:o}=e.getCellLocation(t);return!!n&&o<n}function m(e,t,i){const{modelAttribute:n}=i;e.extend("tableCell",{allowAttributes:[n]}),s(t,{viewElement:/^(td|th)$/,...i}),a(t,{modelElement:"tableCell",...i})}function g(e){const t=e.getSelectedElement();return t&&t.is("element","table")?t:e.getFirstPosition().findAncestor("table")}var f=i(5318);function p(e){return t=>{t.on(`element:${e}`,((e,t,{writer:i})=>{if(!t.modelRange)return;const n=t.modelRange.start.nodeAfter,o=i.createPositionAt(n,0);if(t.viewItem.isEmpty)return void i.insertElement("paragraph",o);const s=Array.from(n.getChildren());if(s.every((e=>e.is("element","$marker")))){const e=i.createElement("paragraph");i.insert(e,i.createPositionAt(n,0));for(const t of s)i.move(i.createRangeOn(t),i.createPositionAt(e,"end"))}}),{priority:"low"})}}function b(e){let t=0,i=0;const n=Array.from(e.getChildren()).filter((e=>"th"===e.name||"td"===e.name));for(;i<n.length&&"th"===n[i].name;){const e=n[i];t+=parseInt(e.getAttribute("colspan")||"1"),i++}return t}class w{constructor(e,t={}){this._jumpedToStartRow=!1,this._table=e,this._startRow=void 0!==t.row?t.row:t.startRow||0,this._endRow=void 0!==t.row?t.row:t.endRow,this._startColumn=void 0!==t.column?t.column:t.startColumn||0,this._endColumn=void 0!==t.column?t.column:t.endColumn,this._includeAllSlots=!!t.includeAllSlots,this._skipRows=new Set,this._row=0,this._rowIndex=0,this._column=0,this._cellIndex=0,this._spannedCells=new Map,this._nextCellAtColumn=-1}[Symbol.iterator](){return this}next(){this._canJumpToStartRow()&&this._jumpToNonSpannedRowClosestToStartRow();const e=this._table.getChild(this._rowIndex);if(!e||this._isOverEndRow())return{done:!0,value:void 0};if(!e.is("element","tableRow"))return this._rowIndex++,this.next();if(this._isOverEndColumn())return this._advanceToNextRow();let t=null;const i=this._getSpanned();if(i)this._includeAllSlots&&!this._shouldSkipSlot()&&(t=this._formatOutValue(i.cell,i.row,i.column));else{const i=e.getChild(this._cellIndex);if(!i)return this._advanceToNextRow();const n=parseInt(i.getAttribute("colspan")||"1"),o=parseInt(i.getAttribute("rowspan")||"1");(n>1||o>1)&&this._recordSpans(i,o,n),this._shouldSkipSlot()||(t=this._formatOutValue(i)),this._nextCellAtColumn=this._column+n}return this._column++,this._column==this._nextCellAtColumn&&this._cellIndex++,t||this.next()}skipRow(e){this._skipRows.add(e)}_advanceToNextRow(){return this._row++,this._rowIndex++,this._column=0,this._cellIndex=0,this._nextCellAtColumn=-1,this.next()}_isOverEndRow(){return void 0!==this._endRow&&this._row>this._endRow}_isOverEndColumn(){return void 0!==this._endColumn&&this._column>this._endColumn}_formatOutValue(e,t=this._row,i=this._column){return{done:!1,value:new v(this,e,t,i)}}_shouldSkipSlot(){const e=this._skipRows.has(this._row),t=this._row<this._startRow,i=this._column<this._startColumn,n=void 0!==this._endColumn&&this._column>this._endColumn;return e||t||i||n}_getSpanned(){const e=this._spannedCells.get(this._row);return e&&e.get(this._column)||null}_recordSpans(e,t,i){const n={cell:e,row:this._row,column:this._column};for(let e=this._row;e<this._row+t;e++)for(let t=this._column;t<this._column+i;t++)e==this._row&&t==this._column||this._markSpannedCell(e,t,n)}_markSpannedCell(e,t,i){this._spannedCells.has(e)||this._spannedCells.set(e,new Map),this._spannedCells.get(e).set(t,i)}_canJumpToStartRow(){return!!this._startRow&&this._startRow>0&&!this._jumpedToStartRow}_jumpToNonSpannedRowClosestToStartRow(){const e=this._getRowLength(0);for(let t=this._startRow;!this._jumpedToStartRow;t--)e===this._getRowLength(t)&&(this._row=t,this._rowIndex=t,this._jumpedToStartRow=!0)}_getRowLength(e){return[...this._table.getChild(e).getChildren()].reduce(((e,t)=>e+parseInt(t.getAttribute("colspan")||"1")),0)}}class v{constructor(e,t,i,n){this.cell=t,this.row=e._row,this.column=e._column,this.cellAnchorRow=i,this.cellAnchorColumn=n,this._cellIndex=e._cellIndex,this._rowIndex=e._rowIndex,this._table=e._table}get isAnchor(){return this.row===this.cellAnchorRow&&this.column===this.cellAnchorColumn}get cellWidth(){return parseInt(this.cell.getAttribute("colspan")||"1")}get cellHeight(){return parseInt(this.cell.getAttribute("rowspan")||"1")}get rowIndex(){return this._rowIndex}getPositionBefore(){return this._table.root.document.model.createPositionAt(this._table.getChild(this.row),this._cellIndex)}}function _(e,t){return(i,{writer:n})=>{const s=i.getAttribute("headingRows")||0,r=n.createContainerElement("table",null,[]),a=n.createContainerElement("figure",{class:"table"},r);s>0&&n.insert(n.createPositionAt(r,"end"),n.createContainerElement("thead",null,n.createSlot((e=>e.is("element","tableRow")&&e.index<s)))),s<e.getRows(i)&&n.insert(n.createPositionAt(r,"end"),n.createContainerElement("tbody",null,n.createSlot((e=>e.is("element","tableRow")&&e.index>=s))));for(const{positionOffset:e,filter:i}of t.additionalSlots)n.insert(n.createPositionAt(r,e),n.createSlot(i));return n.insert(n.createPositionAt(r,"after"),n.createSlot((e=>!e.is("element","tableRow")&&!t.additionalSlots.some((({filter:t})=>t(e)))))),t.asWidget?function(e,t){return t.setCustomProperty("table",!0,e),(0,o.Ex)(e,t,{hasSelectionHandle:!0})}(a,n):a}}function y(e={}){return(t,{writer:i})=>{const n=t.parent,s=n.parent,r=s.getChildIndex(n),a=new w(s,{row:r}),l=s.getAttribute("headingRows")||0,c=s.getAttribute("headingColumns")||0;let d=null;for(const n of a)if(n.cell==t){const t=n.row<l||n.column<c?"th":"td";d=e.asWidget?(0,o.YN)(i.createEditableElement(t),i):i.createContainerElement(t);break}return d}}function k(e={}){return(t,{writer:i})=>{if(!t.parent.is("element","tableCell"))return null;if(!C(t))return null;if(e.asWidget)return i.createContainerElement("span",{class:"ck-table-bogus-paragraph"});{const e=i.createContainerElement("p");return i.setCustomProperty("dataPipeline:transparentRendering",!0,e),e}}}function C(e){return 1==e.parent.childCount&&!!e.getAttributeKeys().next().done}class A extends n.uB{refresh(){const e=this.editor.model,t=e.document.selection,i=e.schema;this.isEnabled=function(e,t){const i=e.getFirstPosition().parent,n=i===i.root?i:i.parent;return t.checkChild(n,"table")}(t,i)}execute(e={}){const t=this.editor,i=t.model,n=t.plugins.get("TableUtils"),o=t.config.get("table.defaultHeadings.rows"),s=t.config.get("table.defaultHeadings.columns");void 0===e.headingRows&&o&&(e.headingRows=o),void 0===e.headingColumns&&s&&(e.headingColumns=s),i.change((t=>{const o=n.createTable(t,e);i.insertObject(o,null,null,{findOptimalPosition:"auto"}),t.setSelection(t.createPositionAt(o.getNodeByPath([0,0,0]),0))}))}}class E extends n.uB{constructor(e,t={}){super(e),this.order=t.order||"below"}refresh(){const e=this.editor.model.document.selection,t=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=t}execute(){const e=this.editor,t=e.model.document.selection,i=e.plugins.get("TableUtils"),n="above"===this.order,o=i.getSelectionAffectedTableCells(t),s=i.getRowIndexes(o),r=n?s.first:s.last,a=o[0].findAncestor("table");i.insertRows(a,{at:n?r:r+1,copyStructureFromAbove:!n})}}class x extends n.uB{constructor(e,t={}){super(e),this.order=t.order||"right"}refresh(){const e=this.editor.model.document.selection,t=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=t}execute(){const e=this.editor,t=e.model.document.selection,i=e.plugins.get("TableUtils"),n="left"===this.order,o=i.getSelectionAffectedTableCells(t),s=i.getColumnIndexes(o),r=n?s.first:s.last,a=o[0].findAncestor("table");i.insertColumns(a,{columns:1,at:n?r:r+1})}}class T extends n.uB{constructor(e,t={}){super(e),this.direction=t.direction||"horizontally"}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=1===e.length}execute(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection)[0];"horizontally"===this.direction?e.splitCellHorizontally(t,2):e.splitCellVertically(t,2)}}function P(e,t,i){const{startRow:n,startColumn:o,endRow:s,endColumn:r}=t,a=i.createElement("table"),l=s-n+1;for(let e=0;e<l;e++)i.insertElement("tableRow",a,"end");const c=[...new w(e,{startRow:n,endRow:s,startColumn:o,endColumn:r,includeAllSlots:!0})];for(const{row:e,column:t,cell:l,isAnchor:d,cellAnchorRow:h,cellAnchorColumn:m}of c){const c=e-n,g=a.getChild(c);if(d){const n=i.cloneElement(l);i.append(n,g),B(n,e,t,s,r,i)}else(h<n||m<o)&&u(i,i.createPositionAt(g,"end"))}return function(e,t,i,n,o){const s=parseInt(t.getAttribute("headingRows")||"0");s>0&&d("headingRows",s-i,e,o,0);const r=parseInt(t.getAttribute("headingColumns")||"0");r>0&&d("headingColumns",r-n,e,o,0)}(a,e,n,o,i),a}function I(e,t,i=0){const n=[],o=new w(e,{startRow:i,endRow:t-1});for(const e of o){const{row:i,cellHeight:o}=e;i<t&&t<=i+o-1&&n.push(e)}return n}function S(e,t,i){const n=e.parent,o=n.parent,s=n.index,r=t-s,a={},l=parseInt(e.getAttribute("rowspan"))-r;l>1&&(a.rowspan=l);const c=parseInt(e.getAttribute("colspan")||"1");c>1&&(a.colspan=c);const h=s+r,m=[...new w(o,{startRow:s,endRow:h,includeAllSlots:!0})];let g,f=null;for(const t of m){const{row:n,column:o,cell:s}=t;s===e&&void 0===g&&(g=o),void 0!==g&&g===o&&n===h&&(f=u(i,t.getPositionBefore(),a))}return d("rowspan",r,e,i),f}function V(e,t){const i=[],n=new w(e);for(const e of n){const{column:n,cellWidth:o}=e;n<t&&t<=n+o-1&&i.push(e)}return i}function R(e,t,i,n){const o=i-t,s={},r=parseInt(e.getAttribute("colspan"))-o;r>1&&(s.colspan=r);const a=parseInt(e.getAttribute("rowspan")||"1");a>1&&(s.rowspan=a);const l=u(n,n.createPositionAfter(e),s);return d("colspan",o,e,n),l}function B(e,t,i,n,o,s){const r=parseInt(e.getAttribute("colspan")||"1"),a=parseInt(e.getAttribute("rowspan")||"1");i+r-1>o&&d("colspan",o-i+1,e,s,1),t+a-1>n&&d("rowspan",n-t+1,e,s,1)}function M(e,t){const i=t.getColumns(e),n=new Array(i).fill(0);for(const{column:t}of new w(e))n[t]++;const o=n.reduce(((e,t,i)=>t?e:[...e,i]),[]);if(o.length>0){const i=o[o.length-1];return t.removeColumns(e,{at:i}),!0}return!1}function O(e,t){const i=[],n=t.getRows(e);for(let t=0;t<n;t++)e.getChild(t).isEmpty&&i.push(t);if(i.length>0){const n=i[i.length-1];return t.removeRows(e,{at:n}),!0}return!1}function L(e,t){M(e,t)||O(e,t)}function F(e,t){const i=Array.from(new w(e,{startColumn:t.firstColumn,endColumn:t.lastColumn,row:t.lastRow}));if(i.every((({cellHeight:e})=>1===e)))return t.lastRow;const n=i[0].cellHeight-1;return t.lastRow+n}function N(e,t){const i=Array.from(new w(e,{startRow:t.firstRow,endRow:t.lastRow,column:t.lastColumn}));if(i.every((({cellWidth:e})=>1===e)))return t.lastColumn;const n=i[0].cellWidth-1;return t.lastColumn+n}class D extends n.uB{constructor(e,t){super(e),this.direction=t.direction,this.isHorizontal="right"==this.direction||"left"==this.direction}refresh(){const e=this._getMergeableCell();this.value=e,this.isEnabled=!!e}execute(){const e=this.editor.model,t=e.document,i=this.editor.plugins.get("TableUtils").getTableCellsContainingSelection(t.selection)[0],n=this.value,o=this.direction;e.change((e=>{const t="right"==o||"down"==o,s=t?i:n,r=t?n:i,a=r.parent;!function(e,t,i){z(e)||(z(t)&&i.remove(i.createRangeIn(t)),i.move(i.createRangeIn(e),i.createPositionAt(t,"end"))),i.remove(e)}(r,s,e);const l=this.isHorizontal?"colspan":"rowspan",c=parseInt(i.getAttribute(l)||"1"),d=parseInt(n.getAttribute(l)||"1");e.setAttribute(l,c+d,s),e.setSelection(e.createRangeIn(s));const u=this.editor.plugins.get("TableUtils");L(a.findAncestor("table"),u)}))}_getMergeableCell(){const e=this.editor.model.document,t=this.editor.plugins.get("TableUtils"),i=t.getTableCellsContainingSelection(e.selection)[0];if(!i)return;const n=this.isHorizontal?function(e,t,i){const n=e.parent.parent,o="right"==t?e.nextSibling:e.previousSibling,s=(n.getAttribute("headingColumns")||0)>0;if(!o)return;const r="right"==t?e:o,a="right"==t?o:e,{column:l}=i.getCellLocation(r),{column:c}=i.getCellLocation(a),d=parseInt(r.getAttribute("colspan")||"1"),u=h(i,r),m=h(i,a);return s&&u!=m?void 0:l+d===c?o:void 0}(i,this.direction,t):function(e,t,i){const n=e.parent,o=n.parent,s=o.getChildIndex(n);if("down"==t&&s===i.getRows(o)-1||"up"==t&&0===s)return null;const r=parseInt(e.getAttribute("rowspan")||"1"),a=o.getAttribute("headingRows")||0;if(a&&("down"==t&&s+r===a||"up"==t&&s===a))return null;const l=parseInt(e.getAttribute("rowspan")||"1"),c="down"==t?s+l:s,d=[...new w(o,{endRow:c})],u=d.find((t=>t.cell===e)).column,h=d.find((({row:e,cellHeight:i,column:n})=>n===u&&("down"==t?e===c:c===e+i)));return h&&h.cell?h.cell:null}(i,this.direction,t);if(!n)return;const o=this.isHorizontal?"rowspan":"colspan",s=parseInt(i.getAttribute(o)||"1");return parseInt(n.getAttribute(o)||"1")===s?n:void 0}}function z(e){const t=e.getChild(0);return 1==e.childCount&&t.is("element","paragraph")&&t.isEmpty}class W extends n.uB{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),i=t[0];if(i){const n=i.findAncestor("table"),o=e.getRows(n)-1,s=e.getRowIndexes(t),r=0===s.first&&s.last===o;this.isEnabled=!r}else this.isEnabled=!1}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),i=t.getSelectionAffectedTableCells(e.document.selection),n=t.getRowIndexes(i),o=i[0],s=o.findAncestor("table"),r=t.getCellLocation(o).column;e.change((e=>{const i=n.last-n.first+1;t.removeRows(s,{at:n.first,rows:i});const o=function(e,t,i,n){const o=e.getChild(Math.min(t,n-1));let s=o.getChild(0),r=0;for(const e of o.getChildren()){if(r>i)return s;s=e,r+=parseInt(e.getAttribute("colspan")||"1")}return s}(s,n.first,r,t.getRows(s));e.setSelection(e.createPositionAt(o,0))}))}}class H extends n.uB{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),i=t[0];if(i){const n=i.findAncestor("table"),o=e.getColumns(n),{first:s,last:r}=e.getColumnIndexes(t);this.isEnabled=r-s<o-1}else this.isEnabled=!1}execute(){const e=this.editor.plugins.get("TableUtils"),[t,i]=function(e,t){const i=t.getSelectionAffectedTableCells(e),n=i[0],o=i.pop(),s=[n,o];return n.isBefore(o)?s:s.reverse()}(this.editor.model.document.selection,e),n=t.parent.parent,o=[...new w(n)],s={first:o.find((e=>e.cell===t)).column,last:o.find((e=>e.cell===i)).column},r=function(e,t,i,n){return parseInt(i.getAttribute("colspan")||"1")>1?i:t.previousSibling||i.nextSibling?i.nextSibling||t.previousSibling:n.first?e.reverse().find((({column:e})=>e<n.first)).cell:e.reverse().find((({column:e})=>e>n.last)).cell}(o,t,i,s);this.editor.model.change((t=>{const i=s.last-s.first+1;e.removeColumns(n,{at:s.first,columns:i}),t.setSelection(t.createPositionAt(r,0))}))}}class U extends n.uB{refresh(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,i=e.getSelectionAffectedTableCells(t.document.selection),n=i.length>0;this.isEnabled=n,this.value=n&&i.every((e=>this._isInHeading(e,e.parent.parent)))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),i=this.editor.model,n=t.getSelectionAffectedTableCells(i.document.selection),o=n[0].findAncestor("table"),{first:s,last:r}=t.getRowIndexes(n),a=this.value?s:r+1,l=o.getAttribute("headingRows")||0;i.change((e=>{if(a){const t=I(o,a,a>l?l:0);for(const{cell:i}of t)S(i,a,e)}d("headingRows",a,o,e,0)}))}_isInHeading(e,t){const i=parseInt(t.getAttribute("headingRows")||"0");return!!i&&e.parent.index<i}}class $ extends n.uB{refresh(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),i=t.getSelectionAffectedTableCells(e.document.selection),n=i.length>0;this.isEnabled=n,this.value=n&&i.every((e=>h(t,e)))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),i=this.editor.model,n=t.getSelectionAffectedTableCells(i.document.selection),o=n[0].findAncestor("table"),{first:s,last:r}=t.getColumnIndexes(n),a=this.value?s:r+1;i.change((e=>{if(a){const t=V(o,a);for(const{cell:i,column:n}of t)R(i,n,a,e)}d("headingColumns",a,o,e,0)}))}}const j=5,q=2;function K(e,t){const i=G(e,"tbody",t)||G(e,"thead",t);return Z(t.editing.view.domConverter.mapViewToDom(i))}function G(e,t,i){return[...[...i.editing.mapper.toViewElement(e).getChildren()].find((e=>e.is("element","table"))).getChildren()].find((e=>e.is("element",t)))}function Z(e){const t=f.Sf.window.getComputedStyle(e);return"border-box"===t.boxSizing?parseFloat(t.width)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight)-parseFloat(t.borderLeftWidth)-parseFloat(t.borderRightWidth):parseFloat(t.width)}function J(e){const t=Math.pow(10,q),i="number"==typeof e?e:parseFloat(e);return Math.round(i*t)/t}function Q(e){return e.map((e=>"number"==typeof e?e:parseFloat(e))).filter((e=>!Number.isNaN(e))).reduce(((e,t)=>e+t),0)}function Y(e){let t=function(e){const t=e.filter((e=>"auto"===e)).length;if(0===t)return e.map((e=>J(e)));const i=Q(e),n=Math.max((100-i)/t,j);return e.map((e=>"auto"===e?n:e)).map((e=>J(e)))}(e.map((e=>"auto"===e?e:parseFloat(e.replace("%","")))));const i=Q(t);return 100!==i&&(t=t.map((e=>J(100*e/i))).map(((e,t,i)=>t!==i.length-1?e:J(e+100-Q(i))))),t.map((e=>e+"%"))}function X(e){const t=f.Sf.window.getComputedStyle(e);return"border-box"===t.boxSizing?parseInt(t.width):parseFloat(t.width)+parseFloat(t.paddingLeft)+parseFloat(t.paddingRight)+parseFloat(t.borderWidth)}function ee(e,t,i,n){for(let o=0;o<Math.max(i.length,e.length);o++){const s=e[o],r=i[o];r?s?n.setAttribute("columnWidth",r,s):n.appendElement("tableColumn",{columnWidth:r},t):n.remove(s)}}function te(e){if(e.is("element","tableColumnGroup"))return e;const t=e.getChildren();return Array.from(t).find((e=>e.is("element","tableColumnGroup")))}function ie(e){const t=te(e);return t?Array.from(t.getChildren()):[]}class ne extends n.k_{static get pluginName(){return"TableUtils"}init(){this.decorate("insertColumns"),this.decorate("insertRows")}getCellLocation(e){const t=e.parent,i=t.parent,n=i.getChildIndex(t),o=new w(i,{row:n});for(const{cell:t,row:i,column:n}of o)if(t===e)return{row:i,column:n}}createTable(e,t){const i=e.createElement("table"),n=t.rows||2,o=t.columns||2;return oe(e,i,0,n,o),t.headingRows&&d("headingRows",Math.min(t.headingRows,n),i,e,0),t.headingColumns&&d("headingColumns",Math.min(t.headingColumns,o),i,e,0),i}insertRows(e,t={}){const i=this.editor.model,n=t.at||0,o=t.rows||1,s=void 0!==t.copyStructureFromAbove,r=t.copyStructureFromAbove?n-1:n,a=this.getRows(e),l=this.getColumns(e);if(n>a)throw new f.Yb("tableutils-insertrows-insert-out-of-range",this,{options:t});i.change((t=>{const i=e.getAttribute("headingRows")||0;if(i>n&&d("headingRows",i+o,e,t,0),!s&&(0===n||n===a))return void oe(t,e,n,o,l);const c=s?Math.max(n,r):n,h=new w(e,{endRow:c}),m=new Array(l).fill(1);for(const{row:e,column:i,cellHeight:a,cellWidth:l,cell:c}of h){const d=e+a-1,u=e<=r&&r<=d;e<n&&n<=d?(t.setAttribute("rowspan",a+o,c),m[i]=-l):s&&u&&(m[i]=l)}for(let i=0;i<o;i++){const i=t.createElement("tableRow");t.insert(i,e,n);for(let e=0;e<m.length;e++){const n=m[e],o=t.createPositionAt(i,"end");n>0&&u(t,o,n>1?{colspan:n}:void 0),e+=Math.abs(n)-1}}}))}insertColumns(e,t={}){const i=this.editor.model,n=t.at||0,o=t.columns||1;i.change((t=>{const i=e.getAttribute("headingColumns");n<i&&t.setAttribute("headingColumns",i+o,e);const s=this.getColumns(e);if(0===n||s===n){for(const i of e.getChildren())i.is("element","tableRow")&&se(o,t,t.createPositionAt(i,n?"end":0));return}const r=new w(e,{column:n,includeAllSlots:!0});for(const e of r){const{row:i,cell:s,cellAnchorColumn:a,cellAnchorRow:l,cellWidth:c,cellHeight:d}=e;if(a<n){t.setAttribute("colspan",c+o,s);const e=l+d-1;for(let t=i;t<=e;t++)r.skipRow(t)}else se(o,t,e.getPositionBefore())}}))}removeRows(e,t){const i=this.editor.model,n=t.rows||1,o=this.getRows(e),s=t.at,r=s+n-1;if(r>o-1)throw new f.Yb("tableutils-removerows-row-index-out-of-range",this,{table:e,options:t});i.change((t=>{const i={first:s,last:r},{cellsToMove:n,cellsToTrim:o}=function(e,{first:t,last:i}){const n=new Map,o=[];for(const{row:s,column:r,cellHeight:a,cell:l}of new w(e,{endRow:i})){const e=s+a-1;if(s>=t&&s<=i&&e>i){const e=a-(i-s+1);n.set(r,{cell:l,rowspan:e})}if(s<t&&e>=t){let n;n=e>=i?i-t+1:e-t+1,o.push({cell:l,rowspan:a-n})}}return{cellsToMove:n,cellsToTrim:o}}(e,i);n.size&&function(e,t,i,n){const o=[...new w(e,{includeAllSlots:!0,row:t})],s=e.getChild(t);let r;for(const{column:e,cell:t,isAnchor:a}of o)if(i.has(e)){const{cell:t,rowspan:o}=i.get(e),a=r?n.createPositionAfter(r):n.createPositionAt(s,0);n.move(n.createRangeOn(t),a),d("rowspan",o,t,n),r=t}else a&&(r=t)}(e,r+1,n,t);for(let i=r;i>=s;i--)t.remove(e.getChild(i));for(const{rowspan:e,cell:i}of o)d("rowspan",e,i,t);!function(e,{first:t,last:i},n){const o=e.getAttribute("headingRows")||0;t<o&&d("headingRows",i<o?o-(i-t+1):t,e,n,0)}(e,i,t),M(e,this)||O(e,this)}))}removeColumns(e,t){const i=this.editor.model,n=t.at,o=t.columns||1,s=t.at+o-1;i.change((t=>{!function(e,t,i){const n=e.getAttribute("headingColumns")||0;if(n&&t.first<n){const o=Math.min(n-1,t.last)-t.first+1;i.setAttribute("headingColumns",n-o,e)}}(e,{first:n,last:s},t);const i=ie(e);for(let o=s;o>=n;o--){for(const{cell:i,column:n,cellWidth:s}of[...new w(e)])n<=o&&s>1&&n+s>o?d("colspan",s-1,i,t):n===o&&t.remove(i);if(i[o]){const e=0===o?i[1]:i[o-1],n=parseFloat(i[o].getAttribute("columnWidth")),s=parseFloat(e.getAttribute("columnWidth"));t.remove(i[o]),t.setAttribute("columnWidth",n+s+"%",e)}}O(e,this)||M(e,this)}))}splitCellVertically(e,t=2){const i=this.editor.model,n=e.parent.parent,o=parseInt(e.getAttribute("rowspan")||"1"),s=parseInt(e.getAttribute("colspan")||"1");i.change((i=>{if(s>1){const{newCellsSpan:n,updatedSpan:r}=re(s,t);d("colspan",r,e,i);const a={};n>1&&(a.colspan=n),o>1&&(a.rowspan=o),se(s>t?t-1:s-1,i,i.createPositionAfter(e),a)}if(s<t){const r=t-s,a=[...new w(n)],{column:l}=a.find((({cell:t})=>t===e)),c=a.filter((({cell:t,cellWidth:i,column:n})=>t!==e&&n===l||n<l&&n+i>l));for(const{cell:e,cellWidth:t}of c)i.setAttribute("colspan",t+r,e);const u={};o>1&&(u.rowspan=o),se(r,i,i.createPositionAfter(e),u);const h=n.getAttribute("headingColumns")||0;h>l&&d("headingColumns",h+r,n,i)}}))}splitCellHorizontally(e,t=2){const i=this.editor.model,n=e.parent,o=n.parent,s=o.getChildIndex(n),r=parseInt(e.getAttribute("rowspan")||"1"),a=parseInt(e.getAttribute("colspan")||"1");i.change((i=>{if(r>1){const n=[...new w(o,{startRow:s,endRow:s+r-1,includeAllSlots:!0})],{newCellsSpan:l,updatedSpan:c}=re(r,t);d("rowspan",c,e,i);const{column:u}=n.find((({cell:t})=>t===e)),h={};l>1&&(h.rowspan=l),a>1&&(h.colspan=a);let m=0;for(const e of n){const{column:t,row:n}=e,o=t===u;m>=l&&o&&(m=0),n>=s+c&&o&&(m||se(1,i,e.getPositionBefore(),h),m++)}}if(r<t){const n=t-r,l=[...new w(o,{startRow:0,endRow:s})];for(const{cell:t,cellHeight:o,row:r}of l)if(t!==e&&r+o>s){const e=o+n;i.setAttribute("rowspan",e,t)}const c={};a>1&&(c.colspan=a),oe(i,o,s+1,n,1,c);const u=o.getAttribute("headingRows")||0;u>s&&d("headingRows",u+n,o,i)}}))}getColumns(e){return[...e.getChild(0).getChildren()].filter((e=>e.is("element","tableCell"))).reduce(((e,t)=>e+parseInt(t.getAttribute("colspan")||"1")),0)}getRows(e){return Array.from(e.getChildren()).reduce(((e,t)=>t.is("element","tableRow")?e+1:e),0)}createTableWalker(e,t={}){return new w(e,t)}getSelectedTableCells(e){const t=[];for(const i of this.sortRanges(e.getRanges())){const e=i.getContainedElement();e&&e.is("element","tableCell")&&t.push(e)}return t}getTableCellsContainingSelection(e){const t=[];for(const i of e.getRanges()){const e=i.start.findAncestor("tableCell");e&&t.push(e)}return t}getSelectionAffectedTableCells(e){const t=this.getSelectedTableCells(e);return t.length?t:this.getTableCellsContainingSelection(e)}getRowIndexes(e){const t=e.map((e=>e.parent.index));return this._getFirstLastIndexesObject(t)}getColumnIndexes(e){const t=e[0].findAncestor("table"),i=[...new w(t)].filter((t=>e.includes(t.cell))).map((e=>e.column));return this._getFirstLastIndexesObject(i)}isSelectionRectangular(e){if(e.length<2||!this._areCellInTheSameTableSection(e))return!1;const t=new Set,i=new Set;let n=0;for(const o of e){const{row:e,column:s}=this.getCellLocation(o),r=parseInt(o.getAttribute("rowspan"))||1,a=parseInt(o.getAttribute("colspan"))||1;t.add(e),i.add(s),r>1&&t.add(e+r-1),a>1&&i.add(s+a-1),n+=r*a}const o=function(e,t){const i=Array.from(e.values()),n=Array.from(t.values());return(Math.max(...i)-Math.min(...i)+1)*(Math.max(...n)-Math.min(...n)+1)}(t,i);return o==n}sortRanges(e){return Array.from(e).sort(ae)}_getFirstLastIndexesObject(e){const t=e.sort(((e,t)=>e-t));return{first:t[0],last:t[t.length-1]}}_areCellInTheSameTableSection(e){const t=e[0].findAncestor("table"),i=this.getRowIndexes(e),n=parseInt(t.getAttribute("headingRows"))||0;if(!this._areIndexesInSameSection(i,n))return!1;const o=this.getColumnIndexes(e),s=parseInt(t.getAttribute("headingColumns"))||0;return this._areIndexesInSameSection(o,s)}_areIndexesInSameSection({first:e,last:t},i){return e<i==t<i}}function oe(e,t,i,n,o,s={}){for(let r=0;r<n;r++){const n=e.createElement("tableRow");e.insert(n,t,i),se(o,e,e.createPositionAt(n,"end"),s)}}function se(e,t,i,n={}){for(let o=0;o<e;o++)u(t,i,n)}function re(e,t){if(e<t)return{newCellsSpan:1,updatedSpan:1};const i=Math.floor(e/t);return{newCellsSpan:i,updatedSpan:e-i*t+i}}function ae(e,t){const i=e.start,n=t.start;return i.isBefore(n)?-1:1}class le extends n.uB{refresh(){const e=this.editor.plugins.get(ne),t=e.getSelectedTableCells(this.editor.model.document.selection);this.isEnabled=e.isSelectionRectangular(t)}execute(){const e=this.editor.model,t=this.editor.plugins.get(ne);e.change((i=>{const n=t.getSelectedTableCells(e.document.selection),o=n.shift(),{mergeWidth:s,mergeHeight:r}=function(e,t,i){let n=0,o=0;for(const e of t){const{row:t,column:s}=i.getCellLocation(e);n=ue(e,s,n,"colspan"),o=ue(e,t,o,"rowspan")}const{row:s,column:r}=i.getCellLocation(e);return{mergeWidth:n-r,mergeHeight:o-s}}(o,n,t);d("colspan",s,o,i),d("rowspan",r,o,i);for(const e of n)ce(e,o,i);L(o.findAncestor("table"),t),i.setSelection(o,"in")}))}}function ce(e,t,i){de(e)||(de(t)&&i.remove(i.createRangeIn(t)),i.move(i.createRangeIn(e),i.createPositionAt(t,"end"))),i.remove(e)}function de(e){const t=e.getChild(0);return 1==e.childCount&&t.is("element","paragraph")&&t.isEmpty}function ue(e,t,i,n){const o=parseInt(e.getAttribute(n)||"1");return Math.max(i,t+o)}class he extends n.uB{constructor(e){super(e),this.affectsData=!1}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),i=t.getSelectionAffectedTableCells(e.document.selection),n=t.getRowIndexes(i),o=i[0].findAncestor("table"),s=[];for(let t=n.first;t<=n.last;t++)for(const i of o.getChild(t).getChildren())s.push(e.createRangeOn(i));e.change((e=>{e.setSelection(s)}))}}class me extends n.uB{constructor(e){super(e),this.affectsData=!1}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,i=e.getSelectionAffectedTableCells(t.document.selection),n=i[0],o=i.pop(),s=n.findAncestor("table"),r=e.getCellLocation(n),a=e.getCellLocation(o),l=Math.min(r.column,a.column),c=Math.max(r.column,a.column),d=[];for(const e of new w(s,{startColumn:l,endColumn:c}))d.push(t.createRangeOn(e.cell));t.change((e=>{e.setSelection(d)}))}}function ge(e,t){let i=!1;const n=function(e){const t=parseInt(e.getAttribute("headingRows")||"0"),i=Array.from(e.getChildren()).reduce(((e,t)=>t.is("element","tableRow")?e+1:e),0),n=[];for(const{row:o,cell:s,cellHeight:r}of new w(e)){if(r<2)continue;const e=o<t?t:i;if(o+r>e){const t=e-o;n.push({cell:s,rowspan:t})}}return n}(e);if(n.length){i=!0;for(const e of n)d("rowspan",e.rowspan,e.cell,t,1)}return i}function fe(e,t){let i=!1;const n=function(e){const t=new Array(e.childCount).fill(0);for(const{rowIndex:i}of new w(e,{includeAllSlots:!0}))t[i]++;return t}(e),o=[];for(const[t,i]of n.entries())!i&&e.getChild(t).is("element","tableRow")&&o.push(t);if(o.length){i=!0;for(const i of o.reverse())t.remove(e.getChild(i)),n.splice(i,1)}const s=n.filter(((t,i)=>e.getChild(i).is("element","tableRow"))),r=s[0];if(!s.every((e=>e===r))){const n=s.reduce(((e,t)=>t>e?t:e),0);for(const[o,r]of s.entries()){const s=n-r;if(s){for(let i=0;i<s;i++)u(t,t.createPositionAt(e.getChild(o),"end"));i=!0}}}return i}function pe(e){if("attribute"!==e.type)return!1;const t=e.attributeKey;return"headingRows"===t||"colspan"===t||"rowspan"===t}function be(e,t){let i=!1;for(const n of e.getChildren())n.is("element","tableRow")&&(i=we(n,t)||i);return i}function we(e,t){let i=!1;for(const n of e.getChildren())i=ve(n,t)||i;return i}function ve(e,t){if(0==e.childCount)return t.insertElement("paragraph",e),!0;const i=Array.from(e.getChildren()).filter((e=>e.is("$text")));for(const e of i)t.wrap(t.createRangeOn(e),"paragraph");return!!i.length}function _e(e){return!!e.position.parent.is("element","tableCell")&&("insert"==e.type&&"$text"==e.name||"remove"==e.type)}function ye(e,t){if(!e.is("element","paragraph"))return!1;const i=t.toViewElement(e);return!!i&&C(e)!==i.is("element","span")}class ke extends n.k_{static get pluginName(){return"TableEditing"}static get requires(){return[ne]}constructor(e){super(e),this._additionalSlots=[]}init(){const e=this.editor,t=e.model,i=t.schema,n=e.conversion,o=e.plugins.get(ne);i.register("table",{inheritAllFrom:"$blockObject",allowAttributes:["headingRows","headingColumns"]}),i.register("tableRow",{allowIn:"table",isLimit:!0}),i.register("tableCell",{allowContentOf:"$container",allowIn:"tableRow",allowAttributes:["colspan","rowspan"],isLimit:!0,isSelectable:!0}),n.for("upcast").add((e=>{e.on("element:figure",((e,t,i)=>{if(!i.consumable.test(t.viewItem,{name:!0,classes:"table"}))return;const n=function(e){for(const t of e.getChildren())if(t.is("element","table"))return t}(t.viewItem);if(!n||!i.consumable.test(n,{name:!0}))return;i.consumable.consume(t.viewItem,{name:!0,classes:"table"});const o=i.convertItem(n,t.modelCursor),s=(0,f.$1)(o.modelRange.getItems());s?(i.convertChildren(t.viewItem,i.writer.createPositionAt(s,"end")),i.updateConversionResult(s,t)):i.consumable.revert(t.viewItem,{name:!0,classes:"table"})}))})),n.for("upcast").add((e=>{e.on("element:table",((e,t,i)=>{const n=t.viewItem;if(!i.consumable.test(n,{name:!0}))return;const{rows:o,headingRows:s,headingColumns:r}=function(e){let t,i=0;const n=[],o=[];let s;for(const r of Array.from(e.getChildren())){if("tbody"!==r.name&&"thead"!==r.name&&"tfoot"!==r.name)continue;"thead"!==r.name||s||(s=r);const e=Array.from(r.getChildren()).filter((e=>e.is("element","tr")));for(const a of e)if(s&&r===s||"tbody"===r.name&&Array.from(a.getChildren()).length&&Array.from(a.getChildren()).every((e=>e.is("element","th"))))i++,n.push(a);else{o.push(a);const e=b(a);(!t||e<t)&&(t=e)}}return{headingRows:i,headingColumns:t||0,rows:[...n,...o]}}(n),a={};r&&(a.headingColumns=r),s&&(a.headingRows=s);const l=i.writer.createElement("table",a);if(i.safeInsert(l,t.modelCursor)){if(i.consumable.consume(n,{name:!0}),o.forEach((e=>i.convertItem(e,i.writer.createPositionAt(l,"end")))),i.convertChildren(n,i.writer.createPositionAt(l,"end")),l.isEmpty){const e=i.writer.createElement("tableRow");i.writer.insert(e,i.writer.createPositionAt(l,"end")),u(i.writer,i.writer.createPositionAt(e,"end"))}i.updateConversionResult(l,t)}}))})),n.for("editingDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:_(o,{asWidget:!0,additionalSlots:this._additionalSlots})}),n.for("dataDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:_(o,{additionalSlots:this._additionalSlots})}),n.for("upcast").elementToElement({model:"tableRow",view:"tr"}),n.for("upcast").add((e=>{e.on("element:tr",((e,t)=>{t.viewItem.isEmpty&&0==t.modelCursor.index&&e.stop()}),{priority:"high"})})),n.for("downcast").elementToElement({model:"tableRow",view:(e,{writer:t})=>e.isEmpty?t.createEmptyElement("tr"):t.createContainerElement("tr")}),n.for("upcast").elementToElement({model:"tableCell",view:"td"}),n.for("upcast").elementToElement({model:"tableCell",view:"th"}),n.for("upcast").add(p("td")),n.for("upcast").add(p("th")),n.for("editingDowncast").elementToElement({model:"tableCell",view:y({asWidget:!0})}),n.for("dataDowncast").elementToElement({model:"tableCell",view:y()}),n.for("editingDowncast").elementToElement({model:"paragraph",view:k({asWidget:!0}),converterPriority:"high"}),n.for("dataDowncast").elementToElement({model:"paragraph",view:k(),converterPriority:"high"}),n.for("downcast").attributeToAttribute({model:"colspan",view:"colspan"}),n.for("upcast").attributeToAttribute({model:{key:"colspan",value:Ce("colspan")},view:"colspan"}),n.for("downcast").attributeToAttribute({model:"rowspan",view:"rowspan"}),n.for("upcast").attributeToAttribute({model:{key:"rowspan",value:Ce("rowspan")},view:"rowspan"}),e.config.define("table.defaultHeadings.rows",0),e.config.define("table.defaultHeadings.columns",0),e.commands.add("insertTable",new A(e)),e.commands.add("insertTableRowAbove",new E(e,{order:"above"})),e.commands.add("insertTableRowBelow",new E(e,{order:"below"})),e.commands.add("insertTableColumnLeft",new x(e,{order:"left"})),e.commands.add("insertTableColumnRight",new x(e,{order:"right"})),e.commands.add("removeTableRow",new W(e)),e.commands.add("removeTableColumn",new H(e)),e.commands.add("splitTableCellVertically",new T(e,{direction:"vertically"})),e.commands.add("splitTableCellHorizontally",new T(e,{direction:"horizontally"})),e.commands.add("mergeTableCells",new le(e)),e.commands.add("mergeTableCellRight",new D(e,{direction:"right"})),e.commands.add("mergeTableCellLeft",new D(e,{direction:"left"})),e.commands.add("mergeTableCellDown",new D(e,{direction:"down"})),e.commands.add("mergeTableCellUp",new D(e,{direction:"up"})),e.commands.add("setTableColumnHeader",new $(e)),e.commands.add("setTableRowHeader",new U(e)),e.commands.add("selectTableRow",new he(e)),e.commands.add("selectTableColumn",new me(e)),function(e){e.document.registerPostFixer((t=>function(e,t){const i=t.document.differ.getChanges();let n=!1;const o=new Set;for(const t of i){let i=null;"insert"==t.type&&"table"==t.name&&(i=t.position.nodeAfter),"insert"!=t.type&&"remove"!=t.type||"tableRow"!=t.name&&"tableCell"!=t.name||(i=t.position.findAncestor("table")),pe(t)&&(i=t.range.start.findAncestor("table")),i&&!o.has(i)&&(n=ge(i,e)||n,n=fe(i,e)||n,o.add(i))}return n}(t,e)))}(t),function(e){e.document.registerPostFixer((t=>function(e,t){const i=t.document.differ.getChanges();let n=!1;for(const t of i)"insert"==t.type&&"table"==t.name&&(n=be(t.position.nodeAfter,e)||n),"insert"==t.type&&"tableRow"==t.name&&(n=we(t.position.nodeAfter,e)||n),"insert"==t.type&&"tableCell"==t.name&&(n=ve(t.position.nodeAfter,e)||n),"remove"!=t.type&&"insert"!=t.type||!_e(t)||(n=ve(t.position.parent,e)||n);return n}(t,e)))}(t),this.listenTo(t.document,"change:data",(()=>{!function(e,t){const i=e.document.differ;for(const e of i.getChanges()){let i,n=!1;if("attribute"==e.type){const t=e.range.start.nodeAfter;if(!t||!t.is("element","table"))continue;if("headingRows"!=e.attributeKey&&"headingColumns"!=e.attributeKey)continue;i=t,n="headingRows"==e.attributeKey}else"tableRow"!=e.name&&"tableCell"!=e.name||(i=e.position.findAncestor("table"),n="tableRow"==e.name);if(!i)continue;const o=i.getAttribute("headingRows")||0,s=i.getAttribute("headingColumns")||0,r=new w(i);for(const e of r){const i=e.row<o||e.column<s?"th":"td",r=t.mapper.toViewElement(e.cell);r&&r.is("element")&&r.name!=i&&t.reconvertItem(n?e.cell.parent:e.cell)}}}(t,e.editing),function(e,t){const i=e.document.differ,n=new Set;for(const e of i.getChanges()){const t="attribute"==e.type?e.range.start.parent:e.position.parent;t.is("element","tableCell")&&n.add(t)}for(const e of n.values()){const i=Array.from(e.getChildren()).filter((e=>ye(e,t.mapper)));for(const e of i)t.reconvertItem(e)}}(t,e.editing)}))}registerAdditionalSlot(e){this._additionalSlots.push(e)}}function Ce(e){return t=>{const i=parseInt(t.getAttribute(e));return Number.isNaN(i)||i<=0?null:i}}var Ae=i(949);class Ee extends Ae.Ss{constructor(e){super(e);const t=this.bindTemplate;this.items=this._createGridCollection(),this.keystrokes=new f.EP,this.focusTracker=new f.$x,this.set("rows",0),this.set("columns",0),this.bind("label").to(this,"columns",this,"rows",((e,t)=>`${t} × ${e}`)),this.setTemplate({tag:"div",attributes:{class:["ck"]},children:[{tag:"div",attributes:{class:["ck-insert-table-dropdown__grid"]},on:{"mouseover@.ck-insert-table-dropdown-grid-box":t.to("boxover")},children:this.items},{tag:"div",attributes:{class:["ck","ck-insert-table-dropdown__label"],"aria-hidden":!0},children:[{text:t.to("label")}]}],on:{mousedown:t.to((e=>{e.preventDefault()})),click:t.to((()=>{this.fire("execute")}))}}),this.on("boxover",((e,t)=>{const{row:i,column:n}=t.target.dataset;this.items.get(10*(parseInt(i,10)-1)+(parseInt(n,10)-1)).focus()})),this.focusTracker.on("change:focusedElement",((e,t,i)=>{if(!i)return;const{row:n,column:o}=i.dataset;this.set({rows:parseInt(n),columns:parseInt(o)})})),this.on("change:columns",(()=>this._highlightGridBoxes())),this.on("change:rows",(()=>this._highlightGridBoxes()))}render(){super.render(),(0,Ae.l1)({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:10,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection});for(const e of this.items)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element)}reset(){this.set({rows:1,columns:1})}focus(){this.items.get(0).focus()}focusLast(){this.items.get(0).focus()}_highlightGridBoxes(){const e=this.rows,t=this.columns;this.items.map(((i,n)=>{const o=Math.floor(n/10)<e&&n%10<t;i.set("isOn",o)}))}_createGridButton(e,t,i,n){const o=new Ae._(e);return o.set({label:n,class:"ck-insert-table-dropdown-grid-box"}),o.extendTemplate({attributes:{"data-row":t,"data-column":i}}),o}_createGridCollection(){const e=[];for(let t=0;t<100;t++){const i=Math.floor(t/10),n=t%10,o=`${i+1} × ${n+1}`;e.push(this._createGridButton(this.locale,i+1,n+1,o))}return this.createCollection(e)}}class xe extends n.k_{static get pluginName(){return"TableUI"}init(){const e=this.editor,t=this.editor.t,i="ltr"===e.locale.contentLanguageDirection;e.ui.componentFactory.add("insertTable",(i=>{const o=e.commands.get("insertTable"),s=(0,Ae.yu)(i);let r;return s.bind("isEnabled").to(o),s.buttonView.set({icon:n.Pt.table,label:t("Insert table"),tooltip:!0}),s.on("change:isOpen",(()=>{r||(r=new Ee(i),s.panelView.children.add(r),r.delegate("execute").to(s),s.on("execute",(()=>{e.execute("insertTable",{rows:r.rows,columns:r.columns}),e.editing.view.focus()})))})),s})),e.ui.componentFactory.add("menuBar:insertTable",(i=>{const o=e.commands.get("insertTable"),s=new Ae.zj(i),r=new Ee(i);return r.delegate("execute").to(s),s.on("change:isOpen",((e,t,i)=>{i||r.reset()})),r.on("execute",(()=>{e.execute("insertTable",{rows:r.rows,columns:r.columns}),e.editing.view.focus()})),s.buttonView.set({label:t("Table"),icon:n.Pt.table}),s.panelView.children.add(r),s.bind("isEnabled").to(o),s})),e.ui.componentFactory.add("tableColumn",(e=>{const n=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:t("Header column"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:i?"insertTableColumnLeft":"insertTableColumnRight",label:t("Insert column left")}},{type:"button",model:{commandName:i?"insertTableColumnRight":"insertTableColumnLeft",label:t("Insert column right")}},{type:"button",model:{commandName:"removeTableColumn",label:t("Delete column")}},{type:"button",model:{commandName:"selectTableColumn",label:t("Select column")}}];return this._prepareDropdown(t("Column"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M18 7v1H2V7h16zm0 5v1H2v-1h16z" opacity=".6"/><path d="M14 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1zm-2 1H8v4h4V2zm0 6H8v4h4V8zm0 6H8v4h4v-4z"/></svg>',n,e)})),e.ui.componentFactory.add("tableRow",(e=>{const i=[{type:"switchbutton",model:{commandName:"setTableRowHeader",label:t("Header row"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:"insertTableRowAbove",label:t("Insert row above")}},{type:"button",model:{commandName:"insertTableRowBelow",label:t("Insert row below")}},{type:"button",model:{commandName:"removeTableRow",label:t("Delete row")}},{type:"button",model:{commandName:"selectTableRow",label:t("Select row")}}];return this._prepareDropdown(t("Row"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v16h-1V2z" opacity=".6"/><path d="M1 6h18a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm1 2v4h4V8H2zm6 0v4h4V8H8zm6 0v4h4V8h-4z"/></svg>',i,e)})),e.ui.componentFactory.add("mergeTableCells",(e=>{const n=[{type:"button",model:{commandName:"mergeTableCellUp",label:t("Merge cell up")}},{type:"button",model:{commandName:i?"mergeTableCellRight":"mergeTableCellLeft",label:t("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:t("Merge cell down")}},{type:"button",model:{commandName:i?"mergeTableCellLeft":"mergeTableCellRight",label:t("Merge cell left")}},{type:"separator"},{type:"button",model:{commandName:"splitTableCellVertically",label:t("Split cell vertically")}},{type:"button",model:{commandName:"splitTableCellHorizontally",label:t("Split cell horizontally")}}];return this._prepareMergeSplitButtonDropdown(t("Merge cells"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v7h-1V2zm6 5v1H2V7h16zM8 12v1H2v-1h6z" opacity=".6"/><path d="M7 7h12a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1zm1 2v9h10V9H8z"/></svg>',n,e)}))}_prepareDropdown(e,t,i,n){const o=this.editor,s=(0,Ae.yu)(n),r=this._fillDropdownWithListOptions(s,i);return s.buttonView.set({label:e,icon:t,tooltip:!0}),s.bind("isEnabled").toMany(r,"isEnabled",((...e)=>e.some((e=>e)))),this.listenTo(s,"execute",(e=>{o.execute(e.source.commandName),e.source instanceof Ae.Wm||o.editing.view.focus()})),s}_prepareMergeSplitButtonDropdown(e,t,i,n){const o=this.editor,s=(0,Ae.yu)(n,Ae.AO),r="mergeTableCells",a=o.commands.get(r),l=this._fillDropdownWithListOptions(s,i);return s.buttonView.set({label:e,icon:t,tooltip:!0,isEnabled:!0}),s.bind("isEnabled").toMany([a,...l],"isEnabled",((...e)=>e.some((e=>e)))),this.listenTo(s.buttonView,"execute",(()=>{o.execute(r),o.editing.view.focus()})),this.listenTo(s,"execute",(e=>{o.execute(e.source.commandName),o.editing.view.focus()})),s}_fillDropdownWithListOptions(e,t){const i=this.editor,n=[],o=new f.pM;for(const e of t)Te(e,i,n,o);return(0,Ae.O)(e,o),n}}function Te(e,t,i,n){if("button"===e.type||"switchbutton"===e.type){const n=e.model=new Ae.Jc(e.model),{commandName:o,bindIsOn:s}=e.model,r=t.commands.get(o);i.push(r),n.set({commandName:o}),n.bind("isEnabled").to(r),s&&n.bind("isOn").to(r,"value"),n.set({withText:!0})}n.add(e)}class Pe extends n.k_{static get pluginName(){return"TableSelection"}static get requires(){return[ne,ne]}init(){const e=this.editor,t=e.model,i=e.editing.view;this.listenTo(t,"deleteContent",((e,t)=>this._handleDeleteContent(e,t)),{priority:"high"}),this.listenTo(i.document,"insertText",((e,t)=>this._handleInsertTextEvent(e,t)),{priority:"high"}),this._defineSelectionConverter(),this._enablePluginDisabling()}getSelectedTableCells(){const e=this.editor.plugins.get(ne),t=this.editor.model.document.selection,i=e.getSelectedTableCells(t);return 0==i.length?null:i}getSelectionAsFragment(){const e=this.editor.plugins.get(ne),t=this.getSelectedTableCells();return t?this.editor.model.change((i=>{const n=i.createDocumentFragment(),{first:o,last:s}=e.getColumnIndexes(t),{first:r,last:a}=e.getRowIndexes(t),l=t[0].findAncestor("table");let c=a,d=s;if(e.isSelectionRectangular(t)){const e={firstColumn:o,lastColumn:s,firstRow:r,lastRow:a};c=F(l,e),d=N(l,e)}const u=P(l,{startRow:r,startColumn:o,endRow:c,endColumn:d},i);return i.insert(u,n,0),n})):null}setCellSelection(e,t){const i=this._getCellsToSelect(e,t);this.editor.model.change((e=>{e.setSelection(i.cells.map((t=>e.createRangeOn(t))),{backward:i.backward})}))}getFocusCell(){const e=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return e&&e.is("element","tableCell")?e:null}getAnchorCell(){const e=this.editor.model.document.selection,t=(0,f.$1)(e.getRanges()).getContainedElement();return t&&t.is("element","tableCell")?t:null}_defineSelectionConverter(){const e=this.editor,t=new Set;e.conversion.for("editingDowncast").add((e=>e.on("selection",((e,i,n)=>{const o=n.writer;!function(e){for(const i of t)e.removeClass("ck-editor__editable_selected",i);t.clear()}(o);const s=this.getSelectedTableCells();if(!s)return;for(const e of s){const i=n.mapper.toViewElement(e);o.addClass("ck-editor__editable_selected",i),t.add(i)}const r=n.mapper.toViewElement(s[s.length-1]);o.setSelection(r,0)}),{priority:"lowest"})))}_enablePluginDisabling(){const e=this.editor;this.on("change:isEnabled",(()=>{if(!this.isEnabled){const t=this.getSelectedTableCells();if(!t)return;e.model.change((i=>{const n=i.createPositionAt(t[0],0),o=e.model.schema.getNearestSelectionRange(n);i.setSelection(o)}))}}))}_handleDeleteContent(e,t){const i=this.editor.plugins.get(ne),n=t[0],o=t[1],s=this.editor.model,r=!o||"backward"==o.direction,a=i.getSelectedTableCells(n);a.length&&(e.stop(),s.change((e=>{const t=a[r?a.length-1:0];s.change((e=>{for(const t of a)s.deleteContent(e.createSelection(t,"in"))}));const i=s.schema.getNearestSelectionRange(e.createPositionAt(t,0));n.is("documentSelection")?e.setSelection(i):n.setTo(i)})))}_handleInsertTextEvent(e,t){const i=this.editor,n=this.getSelectedTableCells();if(!n)return;const o=i.editing.view,s=i.editing.mapper,r=n.map((e=>o.createRangeOn(s.toViewElement(e))));t.selection=o.createSelection(r)}_getCellsToSelect(e,t){const i=this.editor.plugins.get("TableUtils"),n=i.getCellLocation(e),o=i.getCellLocation(t),s=Math.min(n.row,o.row),r=Math.max(n.row,o.row),a=Math.min(n.column,o.column),l=Math.max(n.column,o.column),c=new Array(r-s+1).fill(null).map((()=>[])),d={startRow:s,endRow:r,startColumn:a,endColumn:l};for(const{row:t,cell:i}of new w(e.findAncestor("table"),d))c[t-s].push(i);const u=o.row<n.row,h=o.column<n.column;return u&&c.reverse(),h&&c.forEach((e=>e.reverse())),{cells:c.flat(),backward:u||h}}}var Ie=i(7377);class Se extends n.k_{static get pluginName(){return"TableClipboard"}static get requires(){return[Ie.$J,Ie.xz,Pe,ne]}init(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"copy",((e,t)=>this._onCopyCut(e,t))),this.listenTo(t,"cut",((e,t)=>this._onCopyCut(e,t))),this.listenTo(e.model,"insertContent",((e,[t,i])=>this._onInsertContent(e,t,i)),{priority:"high"}),this.decorate("_replaceTableSlotCell")}_onCopyCut(e,t){const i=this.editor.editing.view,n=this.editor.plugins.get(Pe),o=this.editor.plugins.get(Ie.$J);n.getSelectedTableCells()&&("cut"!=e.name||this.editor.model.canEditAt(this.editor.model.document.selection))&&(t.preventDefault(),e.stop(),this.editor.model.enqueueChange({isUndoable:"cut"===e.name},(()=>{const s=o._copySelectedFragmentWithMarkers(e.name,this.editor.model.document.selection,(()=>n.getSelectionAsFragment()));i.document.fire("clipboardOutput",{dataTransfer:t.dataTransfer,content:this.editor.data.toView(s),method:e.name})})))}_onInsertContent(e,t,i){if(i&&!i.is("documentSelection"))return;const n=this.editor.model,o=this.editor.plugins.get(ne),s=this.editor.plugins.get(Ie.$J),r=this.getTableIfOnlyTableInContent(t,n);if(!r)return;const a=o.getSelectionAffectedTableCells(n.document.selection);a.length?(e.stop(),t.is("documentFragment")?s._pasteMarkersIntoTransformedElement(t.markers,(e=>this._replaceSelectedCells(r,a,e))):this.editor.model.change((e=>{this._replaceSelectedCells(r,a,e)}))):L(r,o)}_replaceSelectedCells(e,t,i){const n=this.editor.plugins.get(ne),o={width:n.getColumns(e),height:n.getRows(e)},s=function(e,t,i,n){const o=e[0].findAncestor("table"),s=n.getColumnIndexes(e),r=n.getRowIndexes(e),a={firstColumn:s.first,lastColumn:s.last,firstRow:r.first,lastRow:r.last},l=1===e.length;return l&&(a.lastRow+=t.height-1,a.lastColumn+=t.width-1,function(e,t,i,n){const o=n.getColumns(e),s=n.getRows(e);i>o&&n.insertColumns(e,{at:o,columns:i-o}),t>s&&n.insertRows(e,{at:s,rows:t-s})}(o,a.lastRow+1,a.lastColumn+1,n)),l||!n.isSelectionRectangular(e)?function(e,t,i){const{firstRow:n,lastRow:o,firstColumn:s,lastColumn:r}=t,a={first:n,last:o},l={first:s,last:r};Re(e,s,a,i),Re(e,r+1,a,i),Ve(e,n,l,i),Ve(e,o+1,l,i,n)}(o,a,i):(a.lastRow=F(o,a),a.lastColumn=N(o,a)),a}(t,o,i,n),r=s.lastRow-s.firstRow+1,a=s.lastColumn-s.firstColumn+1;e=P(e,{startRow:0,startColumn:0,endRow:Math.min(r,o.height)-1,endColumn:Math.min(a,o.width)-1},i);const l=t[0].findAncestor("table"),c=this._replaceSelectedCellsWithPasted(e,o,l,s,i);if(this.editor.plugins.get("TableSelection").isEnabled){const e=n.sortRanges(c.map((e=>i.createRangeOn(e))));i.setSelection(e)}else i.setSelection(c[0],0);return l}_replaceSelectedCellsWithPasted(e,t,i,n,o){const{width:s,height:r}=t,a=function(e,t,i){const n=new Array(i).fill(null).map((()=>new Array(t).fill(null)));for(const{column:t,row:i,cell:o}of new w(e))n[i][t]=o;return n}(e,s,r),l=[...new w(i,{startRow:n.firstRow,endRow:n.lastRow,startColumn:n.firstColumn,endColumn:n.lastColumn,includeAllSlots:!0})],c=[];let d;for(const e of l){const{row:t,column:i}=e;i===n.firstColumn&&(d=e.getPositionBefore());const l=t-n.firstRow,u=i-n.firstColumn,h=a[l%r][u%s],m=h?o.cloneElement(h):null,g=this._replaceTableSlotCell(e,m,d,o);g&&(B(g,t,i,n.lastRow,n.lastColumn,o),c.push(g),d=o.createPositionAfter(g))}const u=parseInt(i.getAttribute("headingRows")||"0"),h=parseInt(i.getAttribute("headingColumns")||"0"),m=n.firstRow<u&&u<=n.lastRow,g=n.firstColumn<h&&h<=n.lastColumn;if(m){const e=Ve(i,u,{first:n.firstColumn,last:n.lastColumn},o,n.firstRow);c.push(...e)}if(g){const e=Re(i,h,{first:n.firstRow,last:n.lastRow},o);c.push(...e)}return c}_replaceTableSlotCell(e,t,i,n){const{cell:o,isAnchor:s}=e;return s&&n.remove(o),t?(n.insert(t,i),t):null}getTableIfOnlyTableInContent(e,t){if(!e.is("documentFragment")&&!e.is("element"))return null;if(e.is("element","table"))return e;if(1==e.childCount&&e.getChild(0).is("element","table"))return e.getChild(0);const i=t.createRangeIn(e);for(const e of i.getItems())if(e.is("element","table")){const n=t.createRange(i.start,t.createPositionBefore(e));if(t.hasContent(n,{ignoreWhitespaces:!0}))return null;const o=t.createRange(t.createPositionAfter(e),i.end);return t.hasContent(o,{ignoreWhitespaces:!0})?null:e}return null}}function Ve(e,t,i,n,o=0){if(!(t<1))return I(e,t,o).filter((({column:e,cellWidth:t})=>Be(e,t,i))).map((({cell:e})=>S(e,t,n)))}function Re(e,t,i,n){if(!(t<1))return V(e,t).filter((({row:e,cellHeight:t})=>Be(e,t,i))).map((({cell:e,column:i})=>R(e,i,t,n)))}function Be(e,t,i){const n=e+t-1,{first:o,last:s}=i;return e>=o&&e<=s||e<o&&n>=o}class Me extends n.k_{static get pluginName(){return"TableKeyboard"}static get requires(){return[Pe,ne]}init(){const e=this.editor,t=e.editing.view.document,i=e.t;this.listenTo(t,"arrowKey",((...e)=>this._onArrowKey(...e)),{context:"table"}),this.listenTo(t,"tab",((...e)=>this._handleTabOnSelectedTable(...e)),{context:"figure"}),this.listenTo(t,"tab",((...e)=>this._handleTab(...e)),{context:["th","td"]}),e.accessibility.addKeystrokeInfoGroup({id:"table",label:i("Keystrokes that can be used in a table cell"),keystrokes:[{label:i("Move the selection to the next cell"),keystroke:"Tab"},{label:i("Move the selection to the previous cell"),keystroke:"Shift+Tab"},{label:i("Insert a new table row (when in the last cell of a table)"),keystroke:"Tab"},{label:i("Navigate through the table"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]}]})}_handleTabOnSelectedTable(e,t){const i=this.editor,n=i.model.document.selection.getSelectedElement();n&&n.is("element","table")&&(t.preventDefault(),t.stopPropagation(),e.stop(),i.model.change((e=>{e.setSelection(e.createRangeIn(n.getChild(0).getChild(0)))})))}_handleTab(e,t){const i=this.editor,n=this.editor.plugins.get(ne),o=this.editor.plugins.get("TableSelection"),s=i.model.document.selection,r=!t.shiftKey;let a=n.getTableCellsContainingSelection(s)[0];if(a||(a=o.getFocusCell()),!a)return;t.preventDefault(),t.stopPropagation(),e.stop();const l=a.parent,c=l.parent,d=c.getChildIndex(l),u=l.getChildIndex(a),h=0===u;if(!r&&h&&0===d)return void i.model.change((e=>{e.setSelection(e.createRangeOn(c))}));const m=u===l.childCount-1,g=d===n.getRows(c)-1;if(r&&g&&m&&(i.execute("insertTableRowBelow"),d===n.getRows(c)-1))return void i.model.change((e=>{e.setSelection(e.createRangeOn(c))}));let f;if(r&&m){const e=c.getChild(d+1);f=e.getChild(0)}else if(!r&&h){const e=c.getChild(d-1);f=e.getChild(e.childCount-1)}else f=l.getChild(u+(r?1:-1));i.model.change((e=>{e.setSelection(e.createRangeIn(f))}))}_onArrowKey(e,t){const i=this.editor,n=t.keyCode,o=(0,f.Kf)(n,i.locale.contentLanguageDirection);this._handleArrowKeys(o,t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),e.stop())}_handleArrowKeys(e,t){const i=this.editor.plugins.get(ne),n=this.editor.plugins.get("TableSelection"),o=this.editor.model,s=o.document.selection,r=["right","down"].includes(e),a=i.getSelectedTableCells(s);if(a.length){let i;return i=t?n.getFocusCell():r?a[a.length-1]:a[0],this._navigateFromCellInDirection(i,e,t),!0}const l=s.focus.findAncestor("tableCell");if(!l)return!1;if(!s.isCollapsed)if(t){if(s.isBackward==r&&!s.containsEntireContent(l))return!1}else{const e=s.getSelectedElement();if(!e||!o.schema.isObject(e))return!1}return!!this._isSelectionAtCellEdge(s,l,r)&&(this._navigateFromCellInDirection(l,e,t),!0)}_isSelectionAtCellEdge(e,t,i){const n=this.editor.model,o=this.editor.model.schema,s=i?e.getLastPosition():e.getFirstPosition();if(!o.getLimitElement(s).is("element","tableCell"))return n.createPositionAt(t,i?"end":0).isTouching(s);const r=n.createSelection(s);return n.modifySelection(r,{direction:i?"forward":"backward"}),s.isEqual(r.focus)}_navigateFromCellInDirection(e,t,i=!1){const n=this.editor.model,o=e.findAncestor("table"),s=[...new w(o,{includeAllSlots:!0})],{row:r,column:a}=s[s.length-1],l=s.find((({cell:t})=>t==e));let{row:c,column:d}=l;switch(t){case"left":d--;break;case"up":c--;break;case"right":d+=l.cellWidth;break;case"down":c+=l.cellHeight}if(c<0||c>r||d<0&&c<=0||d>a&&c>=r)return void n.change((e=>{e.setSelection(e.createRangeOn(o))}));d<0?(d=i?0:a,c--):d>a&&(d=i?a:0,c++);const u=s.find((e=>e.row==c&&e.column==d)).cell,h=["right","down"].includes(t),m=this.editor.plugins.get("TableSelection");if(i&&m.isEnabled){const t=m.getAnchorCell()||e;m.setCellSelection(t,u)}else{const e=n.createPositionAt(u,h?0:"end");n.change((t=>{t.setSelection(e)}))}}}var Oe=i(4133);class Le extends Oe.$A{constructor(){super(...arguments),this.domEventType=["mousemove","mouseleave"]}onDomEvent(e){this.fire(e.type,e)}}class Fe extends n.k_{static get pluginName(){return"TableMouse"}static get requires(){return[Pe,ne]}init(){this.editor.editing.view.addObserver(Le),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){const e=this.editor,t=e.plugins.get(ne);let i=!1;const n=e.plugins.get(Pe);this.listenTo(e.editing.view.document,"mousedown",((o,s)=>{const r=e.model.document.selection;if(!this.isEnabled||!n.isEnabled)return;if(!s.domEvent.shiftKey)return;const a=n.getAnchorCell()||t.getTableCellsContainingSelection(r)[0];if(!a)return;const l=this._getModelTableCellFromDomEvent(s);l&&Ne(a,l)&&(i=!0,n.setCellSelection(a,l),s.preventDefault())})),this.listenTo(e.editing.view.document,"mouseup",(()=>{i=!1})),this.listenTo(e.editing.view.document,"selectionChange",(e=>{i&&e.stop()}),{priority:"highest"})}_enableMouseDragSelection(){const e=this.editor;let t,i,n=!1,o=!1;const s=e.plugins.get(Pe);this.listenTo(e.editing.view.document,"mousedown",((e,i)=>{this.isEnabled&&s.isEnabled&&(i.domEvent.shiftKey||i.domEvent.ctrlKey||i.domEvent.altKey||(t=this._getModelTableCellFromDomEvent(i)))})),this.listenTo(e.editing.view.document,"mousemove",((e,r)=>{if(!r.domEvent.buttons)return;if(!t)return;const a=this._getModelTableCellFromDomEvent(r);a&&Ne(t,a)&&(i=a,n||i==t||(n=!0)),n&&(o=!0,s.setCellSelection(t,i),r.preventDefault())})),this.listenTo(e.editing.view.document,"mouseup",(()=>{n=!1,o=!1,t=null,i=null})),this.listenTo(e.editing.view.document,"selectionChange",(e=>{o&&e.stop()}),{priority:"highest"})}_getModelTableCellFromDomEvent(e){const t=e.target,i=this.editor.editing.view.createPositionAt(t,0);return this.editor.editing.mapper.toModelPosition(i).parent.findAncestor("tableCell",{includeSelf:!0})}}function Ne(e,t){return e.parent.parent==t.parent.parent}class De extends n.k_{static get requires(){return[ke,xe,Pe,Fe,Me,Se,o.x0]}static get pluginName(){return"Table"}}class ze extends n.k_{static get pluginName(){return"PlainTableOutput"}static get requires(){return[De]}init(){const e=this.editor;e.conversion.for("dataDowncast").elementToStructure({model:"table",view:We,converterPriority:"high"}),e.plugins.has("TableCaption")&&e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(e,{writer:t})=>{if("table"===e.parent.name)return t.createContainerElement("caption")},converterPriority:"high"}),e.plugins.has("TableProperties")&&function(e){const t={"border-width":"tableBorderWidth","border-color":"tableBorderColor","border-style":"tableBorderStyle","background-color":"tableBackgroundColor"};for(const[i,n]of Object.entries(t))e.conversion.for("dataDowncast").add((e=>e.on(`attribute:${n}:table`,((e,t,n)=>{const{item:o,attributeNewValue:s}=t,{mapper:r,writer:a}=n;if(!n.consumable.consume(o,e.name))return;const l=r.toViewElement(o);s?a.setStyle(i,s,l):a.removeStyle(i,l)}),{priority:"high"})))}(e)}}function We(e,{writer:t}){const i=e.getAttribute("headingRows")||0,n=t.createSlot((e=>e.is("element","tableRow")&&e.index<i)),o=t.createSlot((e=>e.is("element","tableRow")&&e.index>=i)),s=t.createSlot((e=>!e.is("element","tableRow"))),r=t.createContainerElement("thead",null,n),a=t.createContainerElement("tbody",null,o),l=[];return i&&l.push(r),i<e.childCount&&l.push(a),t.createContainerElement("table",null,[s,...l])}function He(e){return Ue(e)||$e(e)}function Ue(e){const t=e.getSelectedElement();return t&&je(t)?t:null}function $e(e){const t=e.getFirstPosition();if(!t)return null;let i=t.parent;for(;i;){if(i.is("element")&&je(i))return i;i=i.parent}return null}function je(e){return!!e.getCustomProperty("table")&&(0,o.p4)(e)}class qe extends n.k_{static get requires(){return[o.oP]}static get pluginName(){return"TableToolbar"}afterInit(){const e=this.editor,t=e.t,i=e.plugins.get(o.oP),n=e.config.get("table.contentToolbar"),s=e.config.get("table.tableToolbar");n&&i.register("tableContent",{ariaLabel:t("Table toolbar"),items:n,getRelatedElement:$e}),s&&i.register("table",{ariaLabel:t("Table toolbar"),items:s,getRelatedElement:Ue})}}class Ke extends Ae.Ss{constructor(e,t){super(e),this.set("value",""),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isEmpty",!0),this.options=t,this.focusTracker=new f.$x,this._focusables=new Ae.s3,this.dropdownView=this._createDropdownView(),this.inputView=this._createInputTextView(),this.keystrokes=new f.EP,this._stillTyping=!1,this.focusCycler=new Ae.H({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-input-color"]},children:[this.dropdownView,this.inputView]}),this.on("change:value",((e,t,i)=>this._setInputValue(i)))}render(){super.render(),[this.inputView,this.dropdownView.buttonView].forEach((e=>{this.focusTracker.add(e.element),this._focusables.add(e)})),this.keystrokes.listenTo(this.element)}focus(e){-1===e?this.focusCycler.focusLast():this.focusCycler.focusFirst()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createDropdownView(){const e=this.locale,t=e.t,i=this.bindTemplate,n=this._createColorSelector(e),o=(0,Ae.yu)(e),s=new Ae.Ss;return s.setTemplate({tag:"span",attributes:{class:["ck","ck-input-color__button__preview"],style:{backgroundColor:i.to("value")}},children:[{tag:"span",attributes:{class:["ck","ck-input-color__button__preview__no-color-indicator",i.if("value","ck-hidden",(e=>""!=e))]}}]}),o.buttonView.extendTemplate({attributes:{class:"ck-input-color__button"}}),o.buttonView.children.add(s),o.buttonView.label=t("Color picker"),o.buttonView.tooltip=!0,o.panelPosition="rtl"===e.uiLanguageDirection?"se":"sw",o.panelView.children.add(n),o.bind("isEnabled").to(this,"isReadOnly",(e=>!e)),o.on("change:isOpen",((e,t,i)=>{i&&(n.updateSelectedColors(),n.showColorGridsFragment())})),o}_createInputTextView(){const e=this.locale,t=new Ae.hK(e);return t.extendTemplate({on:{blur:t.bindTemplate.to("blur")}}),t.value=this.value,t.bind("isReadOnly","hasError").to(this),this.bind("isFocused","isEmpty").to(t),t.on("input",(()=>{const e=t.element.value,i=this.options.colorDefinitions.find((t=>e===t.label));this._stillTyping=!0,this.value=i&&i.color||e})),t.on("blur",(()=>{this._stillTyping=!1,this._setInputValue(t.element.value)})),t.delegate("input").to(this),t}_createColorSelector(e){const t=e.t,i=this.options.defaultColorValue||"",n=t(i?"Restore default":"Remove color"),o=new Ae.oB(e,{colors:this.options.colorDefinitions,columns:this.options.columns,removeButtonLabel:n,colorPickerLabel:t("Color picker"),colorPickerViewConfig:!1!==this.options.colorPickerConfig&&{...this.options.colorPickerConfig,hideInput:!0}});o.appendUI(),o.on("execute",((e,t)=>{"colorPickerSaveButton"!==t.source?(this.value=t.value||i,this.fire("input"),"colorPicker"!==t.source&&(this.dropdownView.isOpen=!1)):this.dropdownView.isOpen=!1}));let s=this.value;return o.on("colorPicker:cancel",(()=>{this.value=s,this.fire("input"),this.dropdownView.isOpen=!1})),o.colorGridsFragmentView.colorPickerButtonView.on("execute",(()=>{s=this.value})),o.bind("selectedColor").to(this,"value"),o}_setInputValue(e){if(!this._stillTyping){const t=Ge(e),i=this.options.colorDefinitions.find((e=>t===Ge(e.color)));this.inputView.value=i?i.label:e||""}}}function Ge(e){return e.replace(/([(,])\s+/g,"$1").replace(/^\s+|\s+(?=[),\s]|$)/g,"").replace(/,|\s/g," ")}const Ze=e=>""===e;function Je(e){return{none:e("None"),solid:e("Solid"),dotted:e("Dotted"),dashed:e("Dashed"),double:e("Double"),groove:e("Groove"),ridge:e("Ridge"),inset:e("Inset"),outset:e("Outset")}}function Qe(e){return e('The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".')}function Ye(e){return e('The value is invalid. Try "10px" or "2em" or simply "2".')}function Xe(e){return e=e.trim().toLowerCase(),Ze(e)||(0,Oe._o)(e)}function et(e){return e=e.trim(),Ze(e)||rt(e)||(0,Oe.Vq)(e)||(0,Oe.fp)(e)}function tt(e){return e=e.trim(),Ze(e)||rt(e)||(0,Oe.Vq)(e)}function it(e,t){const i=new f.pM,n=Je(e.t);for(const o in n){const s={type:"button",model:new Ae.Jc({_borderStyleValue:o,label:n[o],role:"menuitemradio",withText:!0})};"none"===o?s.model.bind("isOn").to(e,"borderStyle",(e=>"none"===t?!e:e===o)):s.model.bind("isOn").to(e,"borderStyle",(e=>e===o)),i.add(s)}return i}function nt(e){const{view:t,icons:i,toolbar:n,labels:o,propertyName:s,nameToValue:r,defaultValue:a}=e;for(const e in o){const l=new Ae._(t.locale);l.set({label:o[e],icon:i[e],tooltip:o[e]});const c=r?r(e):e;l.bind("isOn").to(t,s,(e=>{let t=e;return""===e&&a&&(t=a),c===t})),l.on("execute",(()=>{t[s]=c})),n.items.add(l)}}const ot=[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}];function st(e){return(t,i,n)=>{const o=new Ke(t.locale,{colorDefinitions:(s=e.colorConfig,s.map((e=>({color:e.model,label:e.label,options:{hasBorder:e.hasBorder}})))),columns:e.columns,defaultColorValue:e.defaultColorValue,colorPickerConfig:e.colorPickerConfig});var s;return o.inputView.set({id:i,ariaDescribedById:n}),o.bind("isReadOnly").to(t,"isEnabled",(e=>!e)),o.bind("hasError").to(t,"errorText",(e=>!!e)),o.on("input",(()=>{t.errorText=null})),t.bind("isEmpty","isFocused").to(o),o}}function rt(e){const t=parseFloat(e);return!Number.isNaN(t)&&e===String(t)}class at extends Ae.Ss{constructor(e,t={}){super(e);const i=this.bindTemplate;this.set("class",t.class||null),this.children=this.createCollection(),t.children&&t.children.forEach((e=>this.children.add(e))),this.set("_role",null),this.set("_ariaLabelledBy",null),t.labelView&&this.set({_role:"group",_ariaLabelledBy:t.labelView.id}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__row",i.to("class")],role:i.to("_role"),"aria-labelledby":i.to("_ariaLabelledBy")},children:this.children})}}class lt extends Ae.Ss{constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",padding:"",backgroundColor:"",width:"",height:"",horizontalAlignment:"",verticalAlignment:""}),this.options=t;const{borderStyleDropdown:i,borderWidthInput:n,borderColorInput:o,borderRowLabel:s}=this._createBorderFields(),{backgroundRowLabel:r,backgroundInput:a}=this._createBackgroundFields(),{widthInput:l,operatorLabel:c,heightInput:d,dimensionsLabel:u}=this._createDimensionFields(),{horizontalAlignmentToolbar:h,verticalAlignmentToolbar:m,alignmentLabel:g}=this._createAlignmentFields();this.focusTracker=new f.$x,this.keystrokes=new f.EP,this.children=this.createCollection(),this.borderStyleDropdown=i,this.borderWidthInput=n,this.borderColorInput=o,this.backgroundInput=a,this.paddingInput=this._createPaddingField(),this.widthInput=l,this.heightInput=d,this.horizontalAlignmentToolbar=h,this.verticalAlignmentToolbar=m;const{saveButtonView:p,cancelButtonView:b}=this._createActionButtons();this.saveButtonView=p,this.cancelButtonView=b,this._focusables=new Ae.s3,this._focusCycler=new Ae.H({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Ae.Dy(e,{label:this.t("Cell properties")})),this.children.add(new at(e,{labelView:s,children:[s,i,o,n],class:"ck-table-form__border-row"})),this.children.add(new at(e,{labelView:r,children:[r,a],class:"ck-table-form__background-row"})),this.children.add(new at(e,{children:[new at(e,{labelView:u,children:[u,l,c,d],class:"ck-table-form__dimensions-row"}),new at(e,{children:[this.paddingInput],class:"ck-table-cell-properties-form__padding-row"})]})),this.children.add(new at(e,{labelView:g,children:[g,h,m],class:"ck-table-cell-properties-form__alignment-row"})),this.children.add(new at(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-cell-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),(0,Ae.Z5)({view:this}),[this.borderColorInput,this.backgroundInput].forEach((e=>{this._focusCycler.chain(e.fieldView.focusCycler)})),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.paddingInput,this.horizontalAlignmentToolbar,this.verticalAlignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){const e=this.options.defaultTableCellProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},i=st({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),n=this.locale,o=this.t,s=o("Style"),r=new Ae.y0(n);r.text=o("Border");const a=Je(o),l=new Ae.xE(n,Ae.By);l.set({label:s,class:"ck-table-form__border-style"}),l.fieldView.buttonView.set({ariaLabel:s,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:s}),l.fieldView.buttonView.bind("label").to(this,"borderStyle",(e=>a[e||"none"])),l.fieldView.on("execute",(e=>{this.borderStyle=e.source._borderStyleValue})),l.bind("isEmpty").to(this,"borderStyle",(e=>!e)),(0,Ae.O)(l.fieldView,it(this,t.style),{role:"menu",ariaLabel:s});const c=new Ae.xE(n,Ae.Vr);c.set({label:o("Width"),class:"ck-table-form__border-width"}),c.fieldView.bind("value").to(this,"borderWidth"),c.bind("isEnabled").to(this,"borderStyle",ct),c.fieldView.on("input",(()=>{this.borderWidth=c.fieldView.element.value}));const d=new Ae.xE(n,i);return d.set({label:o("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",ct),d.fieldView.on("input",(()=>{this.borderColor=d.fieldView.value})),this.on("change:borderStyle",((e,i,n,o)=>{ct(n)||(this.borderColor="",this.borderWidth=""),ct(o)||(this.borderColor=t.color,this.borderWidth=t.width)})),{borderRowLabel:r,borderStyleDropdown:l,borderColorInput:d,borderWidthInput:c}}_createBackgroundFields(){const e=this.locale,t=this.t,i=new Ae.y0(e);i.text=t("Background");const n=st({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableCellProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),o=new Ae.xE(e,n);return o.set({label:t("Color"),class:"ck-table-cell-properties-form__background"}),o.fieldView.bind("value").to(this,"backgroundColor"),o.fieldView.on("input",(()=>{this.backgroundColor=o.fieldView.value})),{backgroundRowLabel:i,backgroundInput:o}}_createDimensionFields(){const e=this.locale,t=this.t,i=new Ae.y0(e);i.text=t("Dimensions");const n=new Ae.xE(e,Ae.Vr);n.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),n.fieldView.bind("value").to(this,"width"),n.fieldView.on("input",(()=>{this.width=n.fieldView.element.value}));const o=new Ae.Ss(e);o.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const s=new Ae.xE(e,Ae.Vr);return s.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),s.fieldView.bind("value").to(this,"height"),s.fieldView.on("input",(()=>{this.height=s.fieldView.element.value})),{dimensionsLabel:i,widthInput:n,operatorLabel:o,heightInput:s}}_createPaddingField(){const e=this.locale,t=this.t,i=new Ae.xE(e,Ae.Vr);return i.set({label:t("Padding"),class:"ck-table-cell-properties-form__padding"}),i.fieldView.bind("value").to(this,"padding"),i.fieldView.on("input",(()=>{this.padding=i.fieldView.element.value})),i}_createAlignmentFields(){const e=this.locale,t=this.t,i=new Ae.y0(e),o={left:n.Pt.alignLeft,center:n.Pt.alignCenter,right:n.Pt.alignRight,justify:n.Pt.alignJustify,top:n.Pt.alignTop,middle:n.Pt.alignMiddle,bottom:n.Pt.alignBottom};i.text=t("Table cell text alignment");const s=new Ae.X3(e),r="rtl"===e.contentLanguageDirection;s.set({isCompact:!0,ariaLabel:t("Horizontal text alignment toolbar")}),nt({view:this,icons:o,toolbar:s,labels:this._horizontalAlignmentLabels,propertyName:"horizontalAlignment",nameToValue:e=>{if(r){if("left"===e)return"right";if("right"===e)return"left"}return e},defaultValue:this.options.defaultTableCellProperties.horizontalAlignment});const a=new Ae.X3(e);return a.set({isCompact:!0,ariaLabel:t("Vertical text alignment toolbar")}),nt({view:this,icons:o,toolbar:a,labels:this._verticalAlignmentLabels,propertyName:"verticalAlignment",defaultValue:this.options.defaultTableCellProperties.verticalAlignment}),{horizontalAlignmentToolbar:s,verticalAlignmentToolbar:a,alignmentLabel:i}}_createActionButtons(){const e=this.locale,t=this.t,i=new Ae._(e),o=new Ae._(e),s=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return i.set({label:t("Save"),icon:n.Pt.check,class:"ck-button-save",type:"submit",withText:!0}),i.bind("isEnabled").toMany(s,"errorText",((...e)=>e.every((e=>!e)))),o.set({label:t("Cancel"),icon:n.Pt.cancel,class:"ck-button-cancel",withText:!0}),o.delegate("execute").to(this,"cancel"),{saveButtonView:i,cancelButtonView:o}}get _horizontalAlignmentLabels(){const e=this.locale,t=this.t,i=t("Align cell text to the left"),n=t("Align cell text to the center"),o=t("Align cell text to the right"),s=t("Justify cell text");return"rtl"===e.uiLanguageDirection?{right:o,center:n,left:i,justify:s}:{left:i,center:n,right:o,justify:s}}get _verticalAlignmentLabels(){const e=this.t;return{top:e("Align cell text to the top"),middle:e("Align cell text to the middle"),bottom:e("Align cell text to the bottom")}}}function ct(e){return"none"!==e}var dt=i(2223);const ut=(()=>[Ae.Jr.defaultPositions.northArrowSouth,Ae.Jr.defaultPositions.northArrowSouthWest,Ae.Jr.defaultPositions.northArrowSouthEast,Ae.Jr.defaultPositions.southArrowNorth,Ae.Jr.defaultPositions.southArrowNorthWest,Ae.Jr.defaultPositions.southArrowNorthEast,Ae.Jr.defaultPositions.viewportStickyNorth])();function ht(e,t){const i=e.plugins.get("ContextualBalloon"),n=e.editing.view.document.selection;let o;"cell"===t?$e(n)&&(o=gt(e)):He(n)&&(o=mt(e)),o&&i.updatePosition(o)}function mt(e){const t=g(e.model.document.selection),i=e.editing.mapper.toViewElement(t);return{target:e.editing.view.domConverter.mapViewToDom(i),positions:ut}}function gt(e){const t=e.editing.mapper,i=e.editing.view.domConverter,n=e.model.document.selection;if(n.rangeCount>1)return{target:()=>function(e,t){const i=t.editing.mapper,n=t.editing.view.domConverter,o=Array.from(e).map((e=>{const t=ft(e.start),o=i.toViewElement(t);return new f.rw(n.mapViewToDom(o))}));return f.rw.getBoundingRect(o)}(n.getRanges(),e),positions:ut};const o=ft(n.getFirstPosition()),s=t.toViewElement(o);return{target:i.mapViewToDom(s),positions:ut}}function ft(e){return e.nodeAfter&&e.nodeAfter.is("element","tableCell")?e.nodeAfter:e.findAncestor("tableCell")}var pt=i(3149);function bt(e){if(!e||!(0,pt.A)(e))return e;const{top:t,right:i,bottom:n,left:o}=e;return t==i&&i==n&&n==o?t:void 0}function wt(e,t){const i=parseFloat(e);return Number.isNaN(i)||String(i)!==String(e)?e:`${i}${t}`}function vt(e,t={}){const i={borderStyle:"none",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",...e};return t.includeAlignmentProperty&&!i.alignment&&(i.alignment="center"),t.includePaddingProperty&&!i.padding&&(i.padding=""),t.includeVerticalAlignmentProperty&&!i.verticalAlignment&&(i.verticalAlignment="middle"),t.includeHorizontalAlignmentProperty&&!i.horizontalAlignment&&(i.horizontalAlignment=t.isRightToLeftContent?"right":"left"),i}const _t={borderStyle:"tableCellBorderStyle",borderColor:"tableCellBorderColor",borderWidth:"tableCellBorderWidth",height:"tableCellHeight",width:"tableCellWidth",padding:"tableCellPadding",backgroundColor:"tableCellBackgroundColor",horizontalAlignment:"tableCellHorizontalAlignment",verticalAlignment:"tableCellVerticalAlignment"};class yt extends n.k_{static get requires(){return[Ae.pU]}static get pluginName(){return"TableCellPropertiesUI"}constructor(e){super(e),e.config.define("table.tableCellProperties",{borderColors:ot,backgroundColors:ot})}init(){const e=this.editor,t=e.t;this._defaultTableCellProperties=vt(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection}),this._balloon=e.plugins.get(Ae.pU),this.view=null,this._isReady=!1,e.ui.componentFactory.add("tableCellProperties",(i=>{const n=new Ae._(i);n.set({label:t("Cell properties"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.105 18-.17 1H2.5A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1h15A1.5 1.5 0 0 1 19 2.5v9.975l-.85-.124-.15-.302V8h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5h3.105zM2 12h5V8H2v4zm10-4H8v4h4V8zM2 2v5h5V2H2zm0 16h5v-5H2v5zM13 7h5V2h-5v5zM8 2v5h4V2H8z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM13 6a1 1 0 0 1 1 1v3.172a2.047 2.047 0 0 0-.293.443l-.858 1.736-1.916.28-.151.027A1.976 1.976 0 0 0 9.315 14H7a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h6zm-1 2H8v4h4V8z"/></svg>',tooltip:!0}),this.listenTo(n,"execute",(()=>this._showView()));const o=Object.values(_t).map((t=>e.commands.get(t)));return n.bind("isEnabled").toMany(o,"isEnabled",((...e)=>e.some((e=>e)))),n}))}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(){const e=this.editor,t=e.config.get("table.tableCellProperties"),i=(0,Ae.lF)(t.borderColors),n=(0,Ae.b2)(e.locale,i),o=(0,Ae.lF)(t.backgroundColors),s=(0,Ae.b2)(e.locale,o),r=!1!==t.colorPicker,a=new lt(e.locale,{borderColors:n,backgroundColors:s,defaultTableCellProperties:this._defaultTableCellProperties,colorPickerConfig:!!r&&(t.colorPicker||{})}),l=e.t;a.render(),this.listenTo(a,"submit",(()=>{this._hideView()})),this.listenTo(a,"cancel",(()=>{this._undoStepBatch.operations.length&&e.execute("undo",this._undoStepBatch),this._hideView()})),a.keystrokes.set("Esc",((e,t)=>{this._hideView(),t()})),(0,Ae.wy)({emitter:a,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const c=Qe(l),d=Ye(l);return a.on("change:borderStyle",this._getPropertyChangeCallback("tableCellBorderStyle")),a.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:a.borderColorInput,commandName:"tableCellBorderColor",errorText:c,validator:Xe})),a.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:a.borderWidthInput,commandName:"tableCellBorderWidth",errorText:d,validator:tt})),a.on("change:padding",this._getValidatedPropertyChangeCallback({viewField:a.paddingInput,commandName:"tableCellPadding",errorText:d,validator:et})),a.on("change:width",this._getValidatedPropertyChangeCallback({viewField:a.widthInput,commandName:"tableCellWidth",errorText:d,validator:et})),a.on("change:height",this._getValidatedPropertyChangeCallback({viewField:a.heightInput,commandName:"tableCellHeight",errorText:d,validator:et})),a.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:a.backgroundInput,commandName:"tableCellBackgroundColor",errorText:c,validator:Xe})),a.on("change:horizontalAlignment",this._getPropertyChangeCallback("tableCellHorizontalAlignment")),a.on("change:verticalAlignment",this._getPropertyChangeCallback("tableCellVerticalAlignment")),a}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableCellBorderStyle");Object.entries(_t).map((([t,i])=>{const n=this._defaultTableCellProperties[t]||"";return[t,e.get(i).value||n]})).forEach((([e,i])=>{("borderColor"!==e&&"borderWidth"!==e||"none"!==t.value)&&this.view.set(e,i)})),this._isReady=!0}_showView(){const e=this.editor;this.view||(this.view=this._createPropertiesView()),this.listenTo(e.ui,"update",(()=>{this._updateView()})),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:gt(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){const e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){const e=this.editor;$e(e.editing.view.document.selection)?this._isViewVisible&&ht(e,"cell"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,i,n)=>{this._isReady&&this.editor.execute(e,{value:n,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:i,validator:n,errorText:o}=e,s=(0,dt.A)((()=>{i.errorText=o}),500);return(e,o,r)=>{s.cancel(),this._isReady&&(n(r)?(this.editor.execute(t,{value:r,batch:this._undoStepBatch}),i.errorText=null):s())}}}class kt extends n.uB{constructor(e,t,i){super(e),this.attributeName=t,this._defaultValue=i}refresh(){const e=this.editor,t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e.model.document.selection);this.isEnabled=!!t.length,this.value=this._getSingleValue(t)}execute(e={}){const{value:t,batch:i}=e,n=this.editor.model,o=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(n.document.selection),s=this._getValueToSet(t);n.enqueueChange(i,(e=>{s?o.forEach((t=>e.setAttribute(this.attributeName,s,t))):o.forEach((t=>e.removeAttribute(this.attributeName,t)))}))}_getAttribute(e){if(!e)return;const t=e.getAttribute(this.attributeName);return t!==this._defaultValue?t:void 0}_getValueToSet(e){if(e!==this._defaultValue)return e}_getSingleValue(e){const t=this._getAttribute(e[0]);return e.every((e=>this._getAttribute(e)===t))?t:void 0}}class Ct extends kt{constructor(e,t){super(e,"tableCellWidth",t)}_getValueToSet(e){if((e=wt(e,"px"))!==this._defaultValue)return e}}class At extends n.k_{static get pluginName(){return"TableCellWidthEditing"}static get requires(){return[ke]}init(){const e=this.editor,t=vt(e.config.get("table.tableCellProperties.defaultProperties"));m(e.model.schema,e.conversion,{modelAttribute:"tableCellWidth",styleName:"width",defaultValue:t.width}),e.commands.add("tableCellWidth",new Ct(e,t.width))}}class Et extends kt{constructor(e,t){super(e,"tableCellPadding",t)}_getAttribute(e){if(!e)return;const t=bt(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){const t=wt(e,"px");if(t!==this._defaultValue)return t}}class xt extends kt{constructor(e,t){super(e,"tableCellHeight",t)}_getValueToSet(e){const t=wt(e,"px");if(t!==this._defaultValue)return t}}class Tt extends kt{constructor(e,t){super(e,"tableCellBackgroundColor",t)}}class Pt extends kt{constructor(e,t){super(e,"tableCellVerticalAlignment",t)}}class It extends kt{constructor(e,t){super(e,"tableCellHorizontalAlignment",t)}}class St extends kt{constructor(e,t){super(e,"tableCellBorderStyle",t)}_getAttribute(e){if(!e)return;const t=bt(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class Vt extends kt{constructor(e,t){super(e,"tableCellBorderColor",t)}_getAttribute(e){if(!e)return;const t=bt(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class Rt extends kt{constructor(e,t){super(e,"tableCellBorderWidth",t)}_getAttribute(e){if(!e)return;const t=bt(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){const t=wt(e,"px");if(t!==this._defaultValue)return t}}const Bt=/^(top|middle|bottom)$/,Mt=/^(left|center|right|justify)$/;class Ot extends n.k_{static get pluginName(){return"TableCellPropertiesEditing"}static get requires(){return[ke,At]}init(){const e=this.editor,t=e.model.schema,i=e.conversion;e.config.define("table.tableCellProperties.defaultProperties",{});const n=vt(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection});e.data.addStyleProcessorRules(Oe.v7),function(e,t,i){const n={width:"tableCellBorderWidth",color:"tableCellBorderColor",style:"tableCellBorderStyle"};e.extend("tableCell",{allowAttributes:Object.values(n)}),r(t,"td",n,i),r(t,"th",n,i),a(t,{modelElement:"tableCell",modelAttribute:n.style,styleName:"border-style"}),a(t,{modelElement:"tableCell",modelAttribute:n.color,styleName:"border-color"}),a(t,{modelElement:"tableCell",modelAttribute:n.width,styleName:"border-width"})}(t,i,{color:n.borderColor,style:n.borderStyle,width:n.borderWidth}),e.commands.add("tableCellBorderStyle",new St(e,n.borderStyle)),e.commands.add("tableCellBorderColor",new Vt(e,n.borderColor)),e.commands.add("tableCellBorderWidth",new Rt(e,n.borderWidth)),m(t,i,{modelAttribute:"tableCellHeight",styleName:"height",defaultValue:n.height}),e.commands.add("tableCellHeight",new xt(e,n.height)),e.data.addStyleProcessorRules(Oe.mC),m(t,i,{modelAttribute:"tableCellPadding",styleName:"padding",reduceBoxSides:!0,defaultValue:n.padding}),e.commands.add("tableCellPadding",new Et(e,n.padding)),e.data.addStyleProcessorRules(Oe.D0),m(t,i,{modelAttribute:"tableCellBackgroundColor",styleName:"background-color",defaultValue:n.backgroundColor}),e.commands.add("tableCellBackgroundColor",new Tt(e,n.backgroundColor)),function(e,t,i){e.extend("tableCell",{allowAttributes:["tableCellHorizontalAlignment"]}),t.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellHorizontalAlignment"},view:e=>({key:"style",value:{"text-align":e}})}),t.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"text-align":Mt}},model:{key:"tableCellHorizontalAlignment",value:e=>{const t=e.getStyle("text-align");return t===i?null:t}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{align:Mt}},model:{key:"tableCellHorizontalAlignment",value:e=>{const t=e.getAttribute("align");return t===i?null:t}}})}(t,i,n.horizontalAlignment),e.commands.add("tableCellHorizontalAlignment",new It(e,n.horizontalAlignment)),function(e,t,i){e.extend("tableCell",{allowAttributes:["tableCellVerticalAlignment"]}),t.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellVerticalAlignment"},view:e=>({key:"style",value:{"vertical-align":e}})}),t.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"vertical-align":Bt}},model:{key:"tableCellVerticalAlignment",value:e=>{const t=e.getStyle("vertical-align");return t===i?null:t}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{valign:Bt}},model:{key:"tableCellVerticalAlignment",value:e=>{const t=e.getAttribute("valign");return t===i?null:t}}})}(t,i,n.verticalAlignment),e.commands.add("tableCellVerticalAlignment",new Pt(e,n.verticalAlignment))}}class Lt extends n.k_{static get pluginName(){return"TableCellProperties"}static get requires(){return[Ot,yt]}}class Ft extends n.uB{constructor(e,t,i){super(e),this.attributeName=t,this._defaultValue=i}refresh(){const e=g(this.editor.model.document.selection);this.isEnabled=!!e,this.value=this._getValue(e)}execute(e={}){const t=this.editor.model,i=t.document.selection,{value:n,batch:o}=e,s=g(i),r=this._getValueToSet(n);t.enqueueChange(o,(e=>{r?e.setAttribute(this.attributeName,r,s):e.removeAttribute(this.attributeName,s)}))}_getValue(e){if(!e)return;const t=e.getAttribute(this.attributeName);return t!==this._defaultValue?t:void 0}_getValueToSet(e){if(e!==this._defaultValue)return e}}class Nt extends Ft{constructor(e,t){super(e,"tableBackgroundColor",t)}}class Dt extends Ft{constructor(e,t){super(e,"tableBorderColor",t)}_getValue(e){if(!e)return;const t=bt(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class zt extends Ft{constructor(e,t){super(e,"tableBorderStyle",t)}_getValue(e){if(!e)return;const t=bt(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class Wt extends Ft{constructor(e,t){super(e,"tableBorderWidth",t)}_getValue(e){if(!e)return;const t=bt(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){const t=wt(e,"px");if(t!==this._defaultValue)return t}}class Ht extends Ft{constructor(e,t){super(e,"tableWidth",t)}_getValueToSet(e){if((e=wt(e,"px"))!==this._defaultValue)return e}}class Ut extends Ft{constructor(e,t){super(e,"tableHeight",t)}_getValueToSet(e){if((e=wt(e,"px"))!==this._defaultValue)return e}}class $t extends Ft{constructor(e,t){super(e,"tableAlignment",t)}}const jt=/^(left|center|right)$/,qt=/^(left|none|right)$/;class Kt extends n.k_{static get pluginName(){return"TablePropertiesEditing"}static get requires(){return[ke]}init(){const e=this.editor,t=e.model.schema,i=e.conversion;e.config.define("table.tableProperties.defaultProperties",{});const n=vt(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0});e.data.addStyleProcessorRules(Oe.v7),function(e,t,i){const n={width:"tableBorderWidth",color:"tableBorderColor",style:"tableBorderStyle"};e.extend("table",{allowAttributes:Object.values(n)}),r(t,"table",n,i),l(t,{modelAttribute:n.color,styleName:"border-color"}),l(t,{modelAttribute:n.style,styleName:"border-style"}),l(t,{modelAttribute:n.width,styleName:"border-width"})}(t,i,{color:n.borderColor,style:n.borderStyle,width:n.borderWidth}),e.commands.add("tableBorderColor",new Dt(e,n.borderColor)),e.commands.add("tableBorderStyle",new zt(e,n.borderStyle)),e.commands.add("tableBorderWidth",new Wt(e,n.borderWidth)),function(e,t,i){e.extend("table",{allowAttributes:["tableAlignment"]}),t.for("downcast").attributeToAttribute({model:{name:"table",key:"tableAlignment"},view:e=>({key:"style",value:{float:"center"===e?"none":e}}),converterPriority:"high"}),t.for("upcast").attributeToAttribute({view:{name:/^(table|figure)$/,styles:{float:qt}},model:{key:"tableAlignment",value:e=>{let t=e.getStyle("float");return"none"===t&&(t="center"),t===i?null:t}}}).attributeToAttribute({view:{attributes:{align:jt}},model:{name:"table",key:"tableAlignment",value:e=>{const t=e.getAttribute("align");return t===i?null:t}}})}(t,i,n.alignment),e.commands.add("tableAlignment",new $t(e,n.alignment)),Gt(t,i,{modelAttribute:"tableWidth",styleName:"width",defaultValue:n.width}),e.commands.add("tableWidth",new Ht(e,n.width)),Gt(t,i,{modelAttribute:"tableHeight",styleName:"height",defaultValue:n.height}),e.commands.add("tableHeight",new Ut(e,n.height)),e.data.addStyleProcessorRules(Oe.D0),function(e,t,i){const{modelAttribute:n}=i;e.extend("table",{allowAttributes:[n]}),s(t,{viewElement:"table",...i}),l(t,i)}(t,i,{modelAttribute:"tableBackgroundColor",styleName:"background-color",defaultValue:n.backgroundColor}),e.commands.add("tableBackgroundColor",new Nt(e,n.backgroundColor))}}function Gt(e,t,i){const{modelAttribute:n}=i;e.extend("table",{allowAttributes:[n]}),s(t,{viewElement:/^(table|figure)$/,shouldUpcast:e=>!("table"==e.name&&"figure"==e.parent.name),...i}),a(t,{modelElement:"table",...i})}class Zt extends Ae.Ss{constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",alignment:""}),this.options=t;const{borderStyleDropdown:i,borderWidthInput:n,borderColorInput:o,borderRowLabel:s}=this._createBorderFields(),{backgroundRowLabel:r,backgroundInput:a}=this._createBackgroundFields(),{widthInput:l,operatorLabel:c,heightInput:d,dimensionsLabel:u}=this._createDimensionFields(),{alignmentToolbar:h,alignmentLabel:m}=this._createAlignmentFields();this.focusTracker=new f.$x,this.keystrokes=new f.EP,this.children=this.createCollection(),this.borderStyleDropdown=i,this.borderWidthInput=n,this.borderColorInput=o,this.backgroundInput=a,this.widthInput=l,this.heightInput=d,this.alignmentToolbar=h;const{saveButtonView:g,cancelButtonView:p}=this._createActionButtons();this.saveButtonView=g,this.cancelButtonView=p,this._focusables=new Ae.s3,this._focusCycler=new Ae.H({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Ae.Dy(e,{label:this.t("Table properties")})),this.children.add(new at(e,{labelView:s,children:[s,i,o,n],class:"ck-table-form__border-row"})),this.children.add(new at(e,{labelView:r,children:[r,a],class:"ck-table-form__background-row"})),this.children.add(new at(e,{children:[new at(e,{labelView:u,children:[u,l,c,d],class:"ck-table-form__dimensions-row"}),new at(e,{labelView:m,children:[m,h],class:"ck-table-properties-form__alignment-row"})]})),this.children.add(new at(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),(0,Ae.Z5)({view:this}),[this.borderColorInput,this.backgroundInput].forEach((e=>{this._focusCycler.chain(e.fieldView.focusCycler)})),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.alignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){const e=this.options.defaultTableProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},i=st({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),n=this.locale,o=this.t,s=o("Style"),r=new Ae.y0(n);r.text=o("Border");const a=Je(o),l=new Ae.xE(n,Ae.By);l.set({label:s,class:"ck-table-form__border-style"}),l.fieldView.buttonView.set({ariaLabel:s,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:s}),l.fieldView.buttonView.bind("label").to(this,"borderStyle",(e=>a[e||"none"])),l.fieldView.on("execute",(e=>{this.borderStyle=e.source._borderStyleValue})),l.bind("isEmpty").to(this,"borderStyle",(e=>!e)),(0,Ae.O)(l.fieldView,it(this,t.style),{role:"menu",ariaLabel:s});const c=new Ae.xE(n,Ae.Vr);c.set({label:o("Width"),class:"ck-table-form__border-width"}),c.fieldView.bind("value").to(this,"borderWidth"),c.bind("isEnabled").to(this,"borderStyle",Jt),c.fieldView.on("input",(()=>{this.borderWidth=c.fieldView.element.value}));const d=new Ae.xE(n,i);return d.set({label:o("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",Jt),d.fieldView.on("input",(()=>{this.borderColor=d.fieldView.value})),this.on("change:borderStyle",((e,i,n,o)=>{Jt(n)||(this.borderColor="",this.borderWidth=""),Jt(o)||(this.borderColor=t.color,this.borderWidth=t.width)})),{borderRowLabel:r,borderStyleDropdown:l,borderColorInput:d,borderWidthInput:c}}_createBackgroundFields(){const e=this.locale,t=this.t,i=new Ae.y0(e);i.text=t("Background");const n=st({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),o=new Ae.xE(e,n);return o.set({label:t("Color"),class:"ck-table-properties-form__background"}),o.fieldView.bind("value").to(this,"backgroundColor"),o.fieldView.on("input",(()=>{this.backgroundColor=o.fieldView.value})),{backgroundRowLabel:i,backgroundInput:o}}_createDimensionFields(){const e=this.locale,t=this.t,i=new Ae.y0(e);i.text=t("Dimensions");const n=new Ae.xE(e,Ae.Vr);n.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),n.fieldView.bind("value").to(this,"width"),n.fieldView.on("input",(()=>{this.width=n.fieldView.element.value}));const o=new Ae.Ss(e);o.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const s=new Ae.xE(e,Ae.Vr);return s.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),s.fieldView.bind("value").to(this,"height"),s.fieldView.on("input",(()=>{this.height=s.fieldView.element.value})),{dimensionsLabel:i,widthInput:n,operatorLabel:o,heightInput:s}}_createAlignmentFields(){const e=this.locale,t=this.t,i=new Ae.y0(e);i.text=t("Alignment");const o=new Ae.X3(e);return o.set({isCompact:!0,ariaLabel:t("Table alignment toolbar")}),nt({view:this,icons:{left:n.Pt.objectLeft,center:n.Pt.objectCenter,right:n.Pt.objectRight},toolbar:o,labels:this._alignmentLabels,propertyName:"alignment",defaultValue:this.options.defaultTableProperties.alignment}),{alignmentLabel:i,alignmentToolbar:o}}_createActionButtons(){const e=this.locale,t=this.t,i=new Ae._(e),o=new Ae._(e),s=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return i.set({label:t("Save"),icon:n.Pt.check,class:"ck-button-save",type:"submit",withText:!0}),i.bind("isEnabled").toMany(s,"errorText",((...e)=>e.every((e=>!e)))),o.set({label:t("Cancel"),icon:n.Pt.cancel,class:"ck-button-cancel",withText:!0}),o.delegate("execute").to(this,"cancel"),{saveButtonView:i,cancelButtonView:o}}get _alignmentLabels(){const e=this.locale,t=this.t,i=t("Align table to the left"),n=t("Center table"),o=t("Align table to the right");return"rtl"===e.uiLanguageDirection?{right:o,center:n,left:i}:{left:i,center:n,right:o}}}function Jt(e){return"none"!==e}const Qt={borderStyle:"tableBorderStyle",borderColor:"tableBorderColor",borderWidth:"tableBorderWidth",backgroundColor:"tableBackgroundColor",width:"tableWidth",height:"tableHeight",alignment:"tableAlignment"};class Yt extends n.k_{static get requires(){return[Ae.pU]}static get pluginName(){return"TablePropertiesUI"}constructor(e){super(e),this.view=null,e.config.define("table.tableProperties",{borderColors:ot,backgroundColors:ot})}init(){const e=this.editor,t=e.t;this._defaultTableProperties=vt(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),this._balloon=e.plugins.get(Ae.pU),e.ui.componentFactory.add("tableProperties",(i=>{const n=new Ae._(i);n.set({label:t("Table properties"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8 2v5h4V2h1v5h5v1h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5H7v-5H2v-1h5V8H2V7h5V2h1zm4 6H8v4h4V8z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM17 1a2 2 0 0 1 2 2v9.475l-.85-.124-.857-1.736a2.048 2.048 0 0 0-.292-.44L17 3H3v14h7.808l.402.392L10.935 19H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h14z"/></svg>',tooltip:!0}),this.listenTo(n,"execute",(()=>this._showView()));const o=Object.values(Qt).map((t=>e.commands.get(t)));return n.bind("isEnabled").toMany(o,"isEnabled",((...e)=>e.some((e=>e)))),n}))}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(){const e=this.editor,t=e.config.get("table.tableProperties"),i=(0,Ae.lF)(t.borderColors),n=(0,Ae.b2)(e.locale,i),o=(0,Ae.lF)(t.backgroundColors),s=(0,Ae.b2)(e.locale,o),r=!1!==t.colorPicker,a=new Zt(e.locale,{borderColors:n,backgroundColors:s,defaultTableProperties:this._defaultTableProperties,colorPickerConfig:!!r&&(t.colorPicker||{})}),l=e.t;a.render(),this.listenTo(a,"submit",(()=>{this._hideView()})),this.listenTo(a,"cancel",(()=>{this._undoStepBatch.operations.length&&e.execute("undo",this._undoStepBatch),this._hideView()})),a.keystrokes.set("Esc",((e,t)=>{this._hideView(),t()})),(0,Ae.wy)({emitter:a,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const c=Qe(l),d=Ye(l);return a.on("change:borderStyle",this._getPropertyChangeCallback("tableBorderStyle")),a.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:a.borderColorInput,commandName:"tableBorderColor",errorText:c,validator:Xe})),a.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:a.borderWidthInput,commandName:"tableBorderWidth",errorText:d,validator:tt})),a.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:a.backgroundInput,commandName:"tableBackgroundColor",errorText:c,validator:Xe})),a.on("change:width",this._getValidatedPropertyChangeCallback({viewField:a.widthInput,commandName:"tableWidth",errorText:d,validator:et})),a.on("change:height",this._getValidatedPropertyChangeCallback({viewField:a.heightInput,commandName:"tableHeight",errorText:d,validator:et})),a.on("change:alignment",this._getPropertyChangeCallback("tableAlignment")),a}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableBorderStyle");Object.entries(Qt).map((([t,i])=>{const n=t,o=this._defaultTableProperties[n]||"";return[n,e.get(i).value||o]})).forEach((([e,i])=>{("borderColor"!==e&&"borderWidth"!==e||"none"!==t.value)&&this.view.set(e,i)})),this._isReady=!0}_showView(){const e=this.editor;this.view||(this.view=this._createPropertiesView()),this.listenTo(e.ui,"update",(()=>{this._updateView()})),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:mt(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){const e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){const e=this.editor;He(e.editing.view.document.selection)?this._isViewVisible&&ht(e,"table"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,i,n)=>{this._isReady&&this.editor.execute(e,{value:n,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:i,validator:n,errorText:o}=e,s=(0,dt.A)((()=>{i.errorText=o}),500);return(e,o,r)=>{s.cancel(),this._isReady&&(n(r)?(this.editor.execute(t,{value:r,batch:this._undoStepBatch}),i.errorText=null):s())}}}class Xt extends n.k_{static get pluginName(){return"TableProperties"}static get requires(){return[Kt,Yt]}}function ei(e){return!!e&&e.is("element","table")}function ti(e){for(const t of e.getChildren())if(t.is("element","caption"))return t;return null}function ii(e){const t=e.parent;return"figcaption"==e.name&&t&&t.is("element","figure")&&t.hasClass("table")||"caption"==e.name&&t&&t.is("element","table")?{name:!0}:null}class ni extends n.uB{refresh(){const e=g(this.editor.model.document.selection);this.isEnabled=!!e,this.isEnabled?this.value=!!ti(e):this.value=!1}execute({focusCaptionOnShow:e=!1}={}){this.editor.model.change((t=>{this.value?this._hideTableCaption(t):this._showTableCaption(t,e)}))}_showTableCaption(e,t){const i=this.editor.model,n=g(i.document.selection),o=this.editor.plugins.get("TableCaptionEditing")._getSavedCaption(n)||e.createElement("caption");i.insertContent(o,n,"end"),t&&e.setSelection(o,"in")}_hideTableCaption(e){const t=this.editor.model,i=g(t.document.selection),n=this.editor.plugins.get("TableCaptionEditing"),o=ti(i);n._saveCaption(i,o),t.deleteContent(e.createSelection(o,"on"))}}class oi extends n.k_{static get pluginName(){return"TableCaptionEditing"}constructor(e){super(e),this._savedCaptionsMap=new WeakMap}init(){const e=this.editor,t=e.model.schema,i=e.editing.view,n=e.t;var s;t.isRegistered("caption")?t.extend("caption",{allowIn:"table"}):t.register("caption",{allowIn:"table",allowContentOf:"$block",isLimit:!0}),e.commands.add("toggleTableCaption",new ni(this.editor)),e.conversion.for("upcast").elementToElement({view:ii,model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(e,{writer:t})=>ei(e.parent)?t.createContainerElement("figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(e,{writer:t})=>{if(!ei(e.parent))return null;const s=t.createEditableElement("figcaption");return t.setCustomProperty("tableCaption",!0,s),s.placeholder=n("Enter table caption"),(0,Oe.JT)({view:i,element:s,keepOnFocus:!0}),(0,o.YN)(s,t)}}),(s=e.model).document.registerPostFixer((e=>function(e,t){const i=t.document.differ.getChanges();let n=!1;for(const t of i){if("insert"!=t.type)continue;const i=t.position.parent;if(i.is("element","table")||"table"==t.name){const o="table"==t.name?t.position.nodeAfter:i,s=Array.from(o.getChildren()).filter((e=>e.is("element","caption"))),r=s.shift();if(!r)continue;for(const t of s)e.move(e.createRangeIn(t),r,"end"),e.remove(t);r.nextSibling&&(e.move(e.createRangeOn(r),o,"end"),n=!0),n=!!s.length||n}}return n}(e,s)))}_getSavedCaption(e){const t=this._savedCaptionsMap.get(e);return t?Oe.Hg.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON())}}class si extends n.k_{static get pluginName(){return"TableCaptionUI"}init(){const e=this.editor,t=e.editing.view,i=e.t;e.ui.componentFactory.add("toggleTableCaption",(o=>{const s=e.commands.get("toggleTableCaption"),r=new Ae._(o);return r.set({icon:n.Pt.caption,tooltip:!0,isToggleable:!0}),r.bind("isOn","isEnabled").to(s,"value","isEnabled"),r.bind("label").to(s,"value",(e=>i(e?"Toggle caption off":"Toggle caption on"))),this.listenTo(r,"execute",(()=>{if(e.execute("toggleTableCaption",{focusCaptionOnShow:!0}),s.value){const i=function(e){const t=g(e);return t?ti(t):null}(e.model.document.selection),n=e.editing.mapper.toViewElement(i);if(!n)return;t.scrollToTheSelection(),t.change((e=>{e.addClass("table__caption_highlighted",n)}))}e.editing.view.focus()})),r}))}}class ri extends n.k_{static get pluginName(){return"TableCaption"}static get requires(){return[oi,si]}}var ai=i(6996),li=i(4022);class ci extends n.uB{refresh(){this.isEnabled=!0}execute(e={}){const{model:t,plugins:i}=this.editor;let{table:n=t.document.selection.getSelectedElement(),columnWidths:o,tableWidth:s}=e;o&&(o=Array.isArray(o)?o:o.split(",")),t.change((e=>{s?e.setAttribute("tableWidth",s,n):e.removeAttribute("tableWidth",n);const t=i.get("TableColumnResizeEditing").getColumnGroupElement(n);if(!o&&!t)return;if(!o)return e.remove(t);const r=Y(o);if(t)Array.from(t.getChildren()).forEach(((t,i)=>e.setAttribute("columnWidth",r[i],t)));else{const t=e.createElement("tableColumnGroup");r.forEach((i=>e.appendElement("tableColumn",{columnWidth:i},t))),e.append(t,n)}}))}}class di extends n.k_{static get requires(){return[ke,ne]}static get pluginName(){return"TableColumnResizeEditing"}constructor(e){super(e),this._isResizingActive=!1,this.set("_isResizingAllowed",!0),this._resizingData=null,this._domEmitter=new((0,f.c5)()),this._tableUtilsPlugin=e.plugins.get("TableUtils"),this.on("change:_isResizingAllowed",((t,i,n)=>{const o=n?"removeClass":"addClass";e.editing.view.change((t=>{for(const i of e.editing.view.document.roots)t[o]("ck-column-resize_disabled",e.editing.view.document.getRoot(i.rootName))}))}))}init(){this._extendSchema(),this._registerPostFixer(),this._registerConverters(),this._registerResizingListeners(),this._registerResizerInserter();const e=this.editor,t=e.plugins.get("TableColumnResize");e.plugins.get("TableEditing").registerAdditionalSlot({filter:e=>e.is("element","tableColumnGroup"),positionOffset:0});const i=new ci(e);e.commands.add("resizeTableWidth",i),e.commands.add("resizeColumnWidths",i),this.bind("_isResizingAllowed").to(e,"isReadOnly",t,"isEnabled",i,"isEnabled",((e,t,i)=>!e&&t&&i))}destroy(){this._domEmitter.stopListening(),super.destroy()}getColumnGroupElement(e){return te(e)}getTableColumnElements(e){return ie(e)}getTableColumnsWidths(e){return function(e){return ie(e).map((e=>e.getAttribute("columnWidth")))}(e)}_extendSchema(){this.editor.model.schema.extend("table",{allowAttributes:["tableWidth"]}),this.editor.model.schema.register("tableColumnGroup",{allowIn:"table",isLimit:!0}),this.editor.model.schema.register("tableColumn",{allowIn:"tableColumnGroup",allowAttributes:["columnWidth","colSpan"],isLimit:!0})}_registerPostFixer(){const e=this.editor.model;function t(e,t,i){const n=i._tableUtilsPlugin.getColumns(t);if(0==n-e.length)return e;const o=e.map((e=>Number(e.replace("%","")))),s=function(e,t){const i=new Set;for(const n of e.getChanges())if("insert"==n.type&&n.position.nodeAfter&&"tableCell"==n.position.nodeAfter.name&&n.position.nodeAfter.getAncestors().includes(t))i.add(n.position.nodeAfter);else if("remove"==n.type){const e=n.position.nodeBefore||n.position.nodeAfter;"tableCell"==e.name&&e.getAncestors().includes(t)&&i.add(e)}return i}(i.editor.model.document.differ,t);for(const e of s){const s=n-o.length;if(0===s)continue;const c=s>0,d=i._tableUtilsPlugin.getCellLocation(e).column;if(c){const e=(l=(r=t,a=i.editor,4e3/K(r,a)),Array(s).fill(l));o.splice(d,0,...e)}else{const e=o.splice(d,Math.abs(s));o[d]+=Q(e)}}var r,a,l;return o.map((e=>e+"%"))}e.document.registerPostFixer((i=>{let n=!1;for(const o of function(e){const t=new Set;for(const i of e.document.differ.getChanges()){let n=null;switch(i.type){case"insert":n=["table","tableRow","tableCell"].includes(i.name)?i.position:null;break;case"remove":n=["tableRow","tableCell"].includes(i.name)?i.position:null;break;case"attribute":i.range.start.nodeAfter&&(n=["table","tableRow","tableCell"].includes(i.range.start.nodeAfter.name)?i.range.start:null)}if(!n)continue;const o=n.nodeAfter&&n.nodeAfter.is("element","table")?n.nodeAfter:n.findAncestor("table");for(const i of e.createRangeOn(o).getItems())i.is("element","table")&&te(i)&&t.add(i)}return t}(e)){const e=this.getColumnGroupElement(o),s=this.getTableColumnElements(e),r=this.getTableColumnsWidths(e);let a=Y(r);a=t(a,o,this),(0,ai.A)(r,a)||(ee(s,e,a,i),n=!0)}return n}))}_registerConverters(){const e=this.editor.conversion;var t;e.for("upcast").attributeToAttribute({view:{name:"figure",key:"style",value:{width:/[\s\S]+/}},model:{name:"table",key:"tableWidth",value:e=>e.getStyle("width")}}),e.for("downcast").attributeToAttribute({model:{name:"table",key:"tableWidth"},view:e=>({name:"figure",key:"style",value:{width:e}})}),e.elementToElement({model:"tableColumnGroup",view:"colgroup"}),e.elementToElement({model:"tableColumn",view:"col"}),e.for("downcast").add((e=>e.on("insert:table",((e,t,i)=>{const n=i.writer,o=t.item,s=i.mapper.toViewElement(o),r=s.is("element","table")?s:Array.from(s.getChildren()).find((e=>e.is("element","table")));te(o)?n.addClass("ck-table-resized",r):n.removeClass("ck-table-resized",r)}),{priority:"low"}))),e.for("upcast").add((t=this._tableUtilsPlugin,e=>e.on("element:colgroup",((e,i,n)=>{const o=i.modelCursor.findAncestor("table"),s=te(o);if(!s)return;const r=ie(s),a=t.getColumns(o);let l=(c=s,d=n.writer,ie(c).reduce(((e,t)=>{const i=t.getAttribute("columnWidth"),n=t.getAttribute("colSpan");if(!n)return e.push(i),e;for(let t=0;t<n;t++)e.push(i);return d.removeAttribute("colSpan",t),e}),[]));var c,d;l=Array.from({length:a},((e,t)=>l[t]||"auto")),(l.length!=r.length||l.includes("auto"))&&ee(r,s,Y(l),n.writer)}),{priority:"low"}))),e.for("upcast").attributeToAttribute({view:{name:"col",styles:{width:/.*/}},model:{key:"columnWidth",value:e=>{const t=e.getStyle("width");return t&&(t.endsWith("%")||t.endsWith("pt"))?t:"auto"}}}),e.for("upcast").attributeToAttribute({view:{name:"col",key:"span"},model:"colSpan"}),e.for("downcast").attributeToAttribute({model:{name:"tableColumn",key:"columnWidth"},view:e=>({key:"style",value:{width:e}})})}_registerResizingListeners(){const e=this.editor.editing.view;e.addObserver(Le),e.document.on("mousedown",this._onMouseDownHandler.bind(this),{priority:"high"}),this._domEmitter.listenTo(f.Sf.window.document,"mousemove",(0,li.A)(this._onMouseMoveHandler.bind(this),50)),this._domEmitter.listenTo(f.Sf.window.document,"mouseup",this._onMouseUpHandler.bind(this))}_onMouseDownHandler(e,t){const i=t.target;if(!i.hasClass("ck-table-column-resizer"))return;if(!this._isResizingAllowed)return;const n=this.editor,o=n.editing.mapper.toModelElement(i.findAncestor("figure"));if(!n.model.canEditAt(o))return;t.preventDefault(),e.stop();const s=function(e,t,i){const n=Array(t.getColumns(e)),o=new w(e);for(const e of o){const t=i.editing.mapper.toViewElement(e.cell),o=X(i.editing.view.domConverter.mapViewToDom(t));(!n[e.column]||o<n[e.column])&&(n[e.column]=J(o))}return n}(o,this._tableUtilsPlugin,n),r=i.findAncestor("table"),a=n.editing.view;Array.from(r.getChildren()).find((e=>e.is("element","colgroup")))||a.change((e=>{!function(e,t,i){const n=e.createContainerElement("colgroup");for(let i=0;i<t.length;i++){const o=e.createEmptyElement("col"),s=`${J(t[i]/Q(t)*100)}%`;e.setStyle("width",s,o),e.insert(e.createPositionAt(n,"end"),o)}e.insert(e.createPositionAt(i,0),n)}(e,s,r)})),this._isResizingActive=!0,this._resizingData=this._getResizingData(t,s),a.change((e=>function(e,t,i){const n=i.widths.viewFigureWidth/i.widths.viewFigureParentWidth;e.addClass("ck-table-resized",t),e.addClass("ck-table-column-resizer__active",i.elements.viewResizer),e.setStyle("width",`${J(100*n)}%`,t.findAncestor("figure"))}(e,r,this._resizingData)))}_onMouseMoveHandler(e,t){if(!this._isResizingActive)return;if(!this._isResizingAllowed)return void this._onMouseUpHandler();const{columnPosition:i,flags:{isRightEdge:n,isTableCentered:o,isLtrContent:s},elements:{viewFigure:r,viewLeftColumn:a,viewRightColumn:l},widths:{viewFigureParentWidth:c,tableWidth:d,leftColumnWidth:u,rightColumnWidth:h}}=this._resizingData,m=40-u,g=n?c-d:h-40,f=(s?1:-1)*(n&&o?2:1),p=(b=(t.clientX-i)*f,w=Math.min(m,0),v=Math.max(g,0),J(b<=w?w:b>=v?v:b));var b,w,v;0!==p&&this.editor.editing.view.change((e=>{const t=J(100*(u+p)/d);if(e.setStyle("width",`${t}%`,a),n){const t=J(100*(d+p)/c);e.setStyle("width",`${t}%`,r)}else{const t=J(100*(h-p)/d);e.setStyle("width",`${t}%`,l)}}))}_onMouseUpHandler(){if(!this._isResizingActive)return;const{viewResizer:e,modelTable:t,viewFigure:i,viewColgroup:n}=this._resizingData.elements,o=this.editor,s=o.editing.view,r=this.getColumnGroupElement(t),a=Array.from(n.getChildren()).filter((e=>e.is("view:element"))),l=r?this.getTableColumnsWidths(r):null,c=a.map((e=>e.getStyle("width"))),d=!(0,ai.A)(l,c),u=t.getAttribute("tableWidth"),h=i.getStyle("width"),m=u!==h;(d||m)&&(this._isResizingAllowed?o.execute("resizeTableWidth",{table:t,tableWidth:`${J(h)}%`,columnWidths:c}):s.change((e=>{if(l)for(const t of a)e.setStyle("width",l.shift(),t);else e.remove(n);m&&(u?e.setStyle("width",u,i):e.removeStyle("width",i)),l||u||e.removeClass("ck-table-resized",[...i.getChildren()].find((e=>"table"===e.name)))}))),s.change((t=>{t.removeClass("ck-table-column-resizer__active",e)})),this._isResizingActive=!1,this._resizingData=null}_getResizingData(e,t){const i=this.editor,n=e.domEvent.clientX,o=e.target,s=o.findAncestor("td")||o.findAncestor("th"),r=i.editing.mapper.toModelElement(s),a=r.findAncestor("table"),l=function(e,t){const i=t.getCellLocation(e).column;return{leftEdge:i,rightEdge:i+(e.getAttribute("colspan")||1)-1}}(r,this._tableUtilsPlugin).rightEdge,c=l===this._tableUtilsPlugin.getColumns(a)-1,d=!a.hasAttribute("tableAlignment"),u="rtl"!==i.locale.contentLanguageDirection,h=s.findAncestor("table"),m=h.findAncestor("figure"),g=[...h.getChildren()].find((e=>e.is("element","colgroup"))),f=g.getChild(l),p=c?void 0:g.getChild(l+1);return{columnPosition:n,flags:{isRightEdge:c,isTableCentered:d,isLtrContent:u},elements:{viewResizer:o,modelTable:a,viewFigure:m,viewColgroup:g,viewLeftColumn:f,viewRightColumn:p},widths:{viewFigureParentWidth:Z(i.editing.view.domConverter.mapViewToDom(m.parent)),viewFigureWidth:Z(i.editing.view.domConverter.mapViewToDom(m)),tableWidth:K(a,i),leftColumnWidth:t[l],rightColumnWidth:c?void 0:t[l+1]}}}_registerResizerInserter(){this.editor.conversion.for("editingDowncast").add((e=>{e.on("insert:tableCell",((e,t,i)=>{const n=t.item,o=i.mapper.toViewElement(n),s=i.writer;s.insert(s.createPositionAt(o,"end"),s.createUIElement("div",{class:"ck-table-column-resizer"}))}),{priority:"lowest"})}))}}class ui extends n.k_{static get requires(){return[di,At]}static get pluginName(){return"TableColumnResize"}}},6192:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Delete:()=>C,Input:()=>h,InsertTextCommand:()=>r,TextTransformation:()=>N,TextWatcher:()=>x,TwoStepCaretMovement:()=>T,Typing:()=>A,findAttributeRange:()=>z,findAttributeRangeBound:()=>W,getLastTextLine:()=>E,inlineHighlight:()=>H});var n=i(1024),o=i(7906);class s{constructor(e,t=20){this._batch=null,this.model=e,this._size=0,this.limit=t,this._isLocked=!1,this._changeCallback=(e,t)=>{t.isLocal&&t.isUndoable&&t!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch({isTyping:!0})),this._batch}get size(){return this._size}input(e){this._size+=e,this._size>=this.limit&&this._reset(!0)}get isLocked(){return this._isLocked}lock(){this._isLocked=!0}unlock(){this._isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(e=!1){this.isLocked&&!e||(this._batch=null,this._size=0)}}class r extends n.Command{constructor(e,t){super(e),this._buffer=new s(e.model,t),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){const t=this.editor.model,i=t.document,n=e.text||"",o=n.length;let s=i.selection;if(e.selection?s=e.selection:e.range&&(s=t.createSelection(e.range)),!t.canEditAt(s))return;const r=e.resultRange;t.enqueueChange(this._buffer.batch,(e=>{this._buffer.lock();const a=Array.from(i.selection.getAttributes());t.deleteContent(s),n&&t.insertContent(e.createText(n,a),s),r?e.setSelection(r):s.is("documentSelection")||e.setSelection(s),this._buffer.unlock(),this._buffer.input(o)}))}}var a=i(151);const l=["insertText","insertReplacementText"],c=[...l,"insertCompositionText"];class d extends a.Observer{constructor(e){super(e),this.focusObserver=e.getObserver(a.FocusObserver);const t=o.env.isAndroid?c:l,i=e.document;i.on("beforeinput",((n,s)=>{if(!this.isEnabled)return;const{data:r,targetRanges:l,inputType:c,domEvent:d}=s;if(!t.includes(c))return;this.focusObserver.flush();const u=new o.EventInfo(i,"insertText");i.fire(u,new a.DomEventData(e,d,{text:r,selection:e.createSelection(l)})),u.stop.called&&n.stop()})),o.env.isAndroid||i.on("compositionend",((t,{data:n,domEvent:o})=>{this.isEnabled&&n&&i.fire("insertText",new a.DomEventData(e,o,{text:n}))}),{priority:"lowest"})}observe(){}stopObserving(){}}var u=i(2223);class h extends n.Plugin{static get pluginName(){return"Input"}init(){const e=this.editor,t=e.model,i=e.editing.view,n=e.editing.mapper,s=t.document.selection;this._compositionQueue=new m(e),i.addObserver(d);const a=new r(e,e.config.get("typing.undoStep")||20);e.commands.add("insertText",a),e.commands.add("input",a),this.listenTo(i.document,"insertText",((r,a)=>{i.document.isComposing||a.preventDefault(),o.env.isAndroid&&i.document.isComposing&&this._compositionQueue.flush("next beforeinput");const{text:l,selection:c}=a;let d;d=c?Array.from(c.getRanges()).map((e=>n.toModelRange(e))):Array.from(s.getRanges());let u=l;if(o.env.isAndroid){const e=Array.from(d[0].getItems()).reduce(((e,t)=>e+(t.is("$textProxy")?t.data:"")),"");if(e&&(e.length<=u.length?u.startsWith(e)&&(u=u.substring(e.length),d[0].start=d[0].start.getShiftedBy(e.length)):e.startsWith(u)&&(d[0].start=d[0].start.getShiftedBy(u.length),u="")),0==u.length&&d[0].isCollapsed)return}const h={text:u,selection:t.createSelection(d)};o.env.isAndroid&&i.document.isComposing?this._compositionQueue.push(h):(e.execute("insertText",h),i.scrollToTheSelection())})),o.env.isAndroid?this.listenTo(i.document,"keydown",((e,n)=>{!s.isCollapsed&&229==n.keyCode&&i.document.isComposing&&g(t,a)})):this.listenTo(i.document,"compositionstart",(()=>{s.isCollapsed||g(t,a)})),o.env.isAndroid?(this.listenTo(i.document,"mutations",((e,{mutations:t})=>{if(i.document.isComposing)for(const{node:e}of t){const t=f(e,n),i=n.toModelElement(t);if(this._compositionQueue.isComposedElement(i))return void this._compositionQueue.flush("mutations")}})),this.listenTo(i.document,"compositionend",(()=>{this._compositionQueue.flush("composition end")})),this.listenTo(i.document,"compositionend",(()=>{const e=[];for(const t of this._compositionQueue.flushComposedElements()){const i=n.toViewElement(t);i&&e.push({type:"children",node:i})}e.length&&i.document.fire("mutations",{mutations:e})}),{priority:"lowest"})):this.listenTo(i.document,"compositionend",(()=>{i.document.fire("mutations",{mutations:[]})}),{priority:"lowest"})}destroy(){super.destroy(),this._compositionQueue.destroy()}}class m{constructor(e){this.flushDebounced=(0,u.A)((()=>this.flush("timeout")),50),this._queue=[],this._compositionElements=new Set,this.editor=e}destroy(){for(this.flushDebounced.cancel(),this._compositionElements.clear();this._queue.length;)this.shift()}get length(){return this._queue.length}push(e){const t={text:e.text};if(e.selection){t.selectionRanges=[];for(const i of e.selection.getRanges())t.selectionRanges.push(a.LiveRange.fromRange(i)),this._compositionElements.add(i.start.parent)}this._queue.push(t),this.flushDebounced()}shift(){const e=this._queue.shift(),t={text:e.text};if(e.selectionRanges){const i=e.selectionRanges.map((e=>function(e){const t=e.toRange();return e.detach(),"$graveyard"==t.root.rootName?null:t}(e))).filter((e=>!!e));i.length&&(t.selection=this.editor.model.createSelection(i))}return t}flush(e){const t=this.editor,i=t.model,n=t.editing.view;if(this.flushDebounced.cancel(),!this._queue.length)return;const o=t.commands.get("insertText").buffer;i.enqueueChange(o.batch,(()=>{for(o.lock();this._queue.length;){const e=this.shift();t.execute("insertText",e)}o.unlock()})),n.scrollToTheSelection()}isComposedElement(e){return this._compositionElements.has(e)}flushComposedElements(){const e=Array.from(this._compositionElements);return this._compositionElements.clear(),e}}function g(e,t){if(!t.isEnabled)return;const i=t.buffer;i.lock(),e.enqueueChange(i.batch,(()=>{e.deleteContent(e.document.selection)})),i.unlock()}function f(e,t){let i=e.is("$text")?e.parent:e;for(;!t.toModelElement(i);)i=i.parent;return i}class p extends n.Command{constructor(e,t){super(e),this.direction=t,this._buffer=new s(e.model,e.config.get("typing.undoStep")),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}execute(e={}){const t=this.editor.model,i=t.document;t.enqueueChange(this._buffer.batch,(n=>{this._buffer.lock();const s=n.createSelection(e.selection||i.selection);if(!t.canEditAt(s))return;const r=e.sequence||1,a=s.isCollapsed;if(s.isCollapsed&&t.modifySelection(s,{direction:this.direction,unit:e.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(r))return void this._replaceEntireContentWithParagraph(n);if(this._shouldReplaceFirstBlockWithParagraph(s,r))return void this.editor.execute("paragraph",{selection:s});if(s.isCollapsed)return;let l=0;s.getFirstRange().getMinimalFlatRanges().forEach((e=>{l+=(0,o.count)(e.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))})),t.deleteContent(s,{doNotResetEntireContent:a,direction:this.direction}),this._buffer.input(l),n.setSelection(s),this._buffer.unlock()}))}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;const t=this.editor.model,i=t.document.selection,n=t.schema.getLimitElement(i);if(!i.isCollapsed||!i.containsEntireContent(n))return!1;if(!t.schema.checkChild(n,"paragraph"))return!1;const o=n.getChild(0);return!o||!o.is("element","paragraph")}_replaceEntireContentWithParagraph(e){const t=this.editor.model,i=t.document.selection,n=t.schema.getLimitElement(i),o=e.createElement("paragraph");e.remove(e.createRangeIn(n)),e.insert(o,n),e.setSelection(o,0)}_shouldReplaceFirstBlockWithParagraph(e,t){const i=this.editor.model;if(t>1||"backward"!=this.direction)return!1;if(!e.isCollapsed)return!1;const n=e.getFirstPosition(),o=i.schema.getLimitElement(n),s=o.getChild(0);return n.parent==s&&!!e.containsEntireContent(s)&&!!i.schema.checkChild(o,"paragraph")&&"paragraph"!=s.name}}const b="word",w="selection",v="backward",_="forward",y={deleteContent:{unit:w,direction:v},deleteContentBackward:{unit:"codePoint",direction:v},deleteWordBackward:{unit:b,direction:v},deleteHardLineBackward:{unit:w,direction:v},deleteSoftLineBackward:{unit:w,direction:v},deleteContentForward:{unit:"character",direction:_},deleteWordForward:{unit:b,direction:_},deleteHardLineForward:{unit:w,direction:_},deleteSoftLineForward:{unit:w,direction:_}};class k extends a.Observer{constructor(e){super(e);const t=e.document;let i=0;t.on("keydown",(()=>{i++})),t.on("keyup",(()=>{i=0})),t.on("beforeinput",((n,s)=>{if(!this.isEnabled)return;const{targetRanges:r,domEvent:l,inputType:c}=s,d=y[c];if(!d)return;const u={direction:d.direction,unit:d.unit,sequence:i};u.unit==w&&(u.selectionToRemove=e.createSelection(r[0])),"deleteContentBackward"===c&&(o.env.isAndroid&&(u.sequence=1),function(e){if(1!=e.length||e[0].isCollapsed)return!1;const t=e[0].getWalker({direction:"backward",singleCharacters:!0,ignoreElementEnd:!0});let i=0;for(const{nextPosition:e,item:n}of t){if(e.parent.is("$text")){const t=e.parent.data,n=e.offset;if((0,o.isInsideSurrogatePair)(t,n)||(0,o.isInsideCombinedSymbol)(t,n)||(0,o.isInsideEmojiSequence)(t,n))continue;i++}else(n.is("containerElement")||n.is("emptyElement"))&&i++;if(i>1)return!0}return!1}(r)&&(u.unit=w,u.selectionToRemove=e.createSelection(r)));const h=new a.BubblingEventInfo(t,"delete",r[0]);t.fire(h,new a.DomEventData(e,l,u)),h.stop.called&&n.stop()})),o.env.isBlink&&function(e){const t=e.view,i=t.document;let n=null,s=!1;function r(e){return e==o.keyCodes.backspace||e==o.keyCodes.delete}function l(e){return e==o.keyCodes.backspace?v:_}i.on("keydown",((e,{keyCode:t})=>{n=t,s=!1})),i.on("keyup",((o,{keyCode:c,domEvent:d})=>{const u=i.selection,h=e.isEnabled&&c==n&&r(c)&&!u.isCollapsed&&!s;if(n=null,h){const e=u.getFirstRange(),n=new a.BubblingEventInfo(i,"delete",e),o={unit:w,direction:l(c),selectionToRemove:u};i.fire(n,new a.DomEventData(t,d,o))}})),i.on("beforeinput",((e,{inputType:t})=>{const i=y[t];r(n)&&i&&i.direction==l(n)&&(s=!0)}),{priority:"high"}),i.on("beforeinput",((e,{inputType:t,data:i})=>{n==o.keyCodes.delete&&"insertText"==t&&"\7f"==i&&e.stop()}),{priority:"high"})}(this)}observe(){}stopObserving(){}}class C extends n.Plugin{static get pluginName(){return"Delete"}init(){const e=this.editor,t=e.editing.view,i=t.document,n=e.model.document;t.addObserver(k),this._undoOnBackspace=!1;const o=new p(e,"forward");e.commands.add("deleteForward",o),e.commands.add("forwardDelete",o),e.commands.add("delete",new p(e,"backward")),this.listenTo(i,"delete",((n,o)=>{i.isComposing||o.preventDefault();const{direction:s,sequence:r,selectionToRemove:a,unit:l}=o,c="forward"===s?"deleteForward":"delete",d={sequence:r};if("selection"==l){const t=Array.from(a.getRanges()).map((t=>e.editing.mapper.toModelRange(t)));d.selection=e.model.createSelection(t)}else d.unit=l;e.execute(c,d),t.scrollToTheSelection()}),{priority:"low"}),this.editor.plugins.has("UndoEditing")&&(this.listenTo(i,"delete",((t,i)=>{this._undoOnBackspace&&"backward"==i.direction&&1==i.sequence&&"codePoint"==i.unit&&(this._undoOnBackspace=!1,e.execute("undo"),i.preventDefault(),t.stop())}),{context:"$capture"}),this.listenTo(n,"change",(()=>{this._undoOnBackspace=!1})))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}class A extends n.Plugin{static get requires(){return[h,C]}static get pluginName(){return"Typing"}}function E(e,t){let i=e.start;return{text:Array.from(e.getWalker({ignoreElementEnd:!1})).reduce(((e,{item:n})=>n.is("$text")||n.is("$textProxy")?e+n.data:(i=t.createPositionAfter(n),"")),""),range:t.createRange(i,e.end)}}class x extends((0,o.ObservableMixin)()){constructor(e,t){super(),this.model=e,this.testCallback=t,this._hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",(()=>{this.isEnabled?this._startListening():(this.stopListening(e.document.selection),this.stopListening(e.document))})),this._startListening()}get hasMatch(){return this._hasMatch}_startListening(){const e=this.model.document;this.listenTo(e.selection,"change:range",((t,{directChange:i})=>{i&&(e.selection.isCollapsed?this._evaluateTextBeforeSelection("selection"):this.hasMatch&&(this.fire("unmatched"),this._hasMatch=!1))})),this.listenTo(e,"change:data",((e,t)=>{!t.isUndo&&t.isLocal&&this._evaluateTextBeforeSelection("data",{batch:t})}))}_evaluateTextBeforeSelection(e,t={}){const i=this.model,n=i.document.selection,o=i.createRange(i.createPositionAt(n.focus.parent,0),n.focus),{text:s,range:r}=E(o,i),a=this.testCallback(s);if(!a&&this.hasMatch&&this.fire("unmatched"),this._hasMatch=!!a,a){const i=Object.assign(t,{text:s,range:r});"object"==typeof a&&Object.assign(i,a),this.fire(`matched:${e}`,i)}}}class T extends n.Plugin{static get pluginName(){return"TwoStepCaretMovement"}constructor(e){super(e),this._isNextGravityRestorationSkipped=!1,this.attributes=new Set,this._overrideUid=null}init(){const e=this.editor,t=e.model,i=e.editing.view,n=e.locale,s=t.document.selection;this.listenTo(i.document,"arrowKey",((e,t)=>{if(!s.isCollapsed)return;if(t.shiftKey||t.altKey||t.ctrlKey)return;const i=t.keyCode==o.keyCodes.arrowright,r=t.keyCode==o.keyCodes.arrowleft;if(!i&&!r)return;const a=n.contentLanguageDirection;let l=!1;l="ltr"===a&&i||"rtl"===a&&r?this._handleForwardMovement(t):this._handleBackwardMovement(t),!0===l&&e.stop()}),{context:"$text",priority:"highest"}),this.listenTo(s,"change:range",((e,t)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!t.directChange&&B(s.getFirstPosition(),this.attributes)||this._restoreGravity())})),this._enableClickingAfterNode(),this._enableInsertContentSelectionAttributesFixer(),this._handleDeleteContentAfterNode()}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){const t=this.attributes,i=this.editor.model,n=i.document.selection,o=n.getFirstPosition();return!(this._isGravityOverridden||o.isAtStart&&P(n,t)||!B(o,t)||(V(e),P(n,t)&&B(o,t,!0)?S(i,t):this._overrideGravity(),0))}_handleBackwardMovement(e){const t=this.attributes,i=this.editor.model,n=i.document.selection,o=n.getFirstPosition();return this._isGravityOverridden?(V(e),this._restoreGravity(),B(o,t,!0)?S(i,t):I(i,t,o),!0):o.isAtStart?!!P(n,t)&&(V(e),I(i,t,o),!0):!P(n,t)&&B(o,t,!0)?(V(e),I(i,t,o),!0):!!R(o,t)&&(o.isAtEnd&&!P(n,t)&&B(o,t)?(V(e),I(i,t,o),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1))}_enableClickingAfterNode(){const e=this.editor,t=e.model,i=t.document.selection,n=e.editing.view.document;e.editing.view.addObserver(a.MouseObserver);let o=!1;this.listenTo(n,"mousedown",(()=>{o=!0})),this.listenTo(n,"selectionChange",(()=>{const e=this.attributes;if(!o)return;if(o=!1,!i.isCollapsed)return;if(!P(i,e))return;const n=i.getFirstPosition();B(n,e)&&(n.isAtStart||B(n,e,!0)?S(t,e):this._isGravityOverridden||this._overrideGravity())}))}_enableInsertContentSelectionAttributesFixer(){const e=this.editor.model,t=e.document.selection,i=this.attributes;this.listenTo(e,"insertContent",(()=>{const n=t.getFirstPosition();P(t,i)&&B(n,i)&&S(e,i)}),{priority:"low"})}_handleDeleteContentAfterNode(){const e=this.editor,t=e.model,i=t.document.selection,n=e.editing.view;let o=!1,s=!1;this.listenTo(n.document,"delete",((e,t)=>{o="backward"===t.direction}),{priority:"high"}),this.listenTo(t,"deleteContent",(()=>{if(!o)return;const e=i.getFirstPosition();s=P(i,this.attributes)&&!R(e,this.attributes)}),{priority:"high"}),this.listenTo(t,"deleteContent",(()=>{o&&(o=!1,s||e.model.enqueueChange((()=>{const e=i.getFirstPosition();P(i,this.attributes)&&B(e,this.attributes)&&(e.isAtStart||B(e,this.attributes,!0)?S(t,this.attributes):this._isGravityOverridden||this._overrideGravity())})))}),{priority:"low"})}get _isGravityOverridden(){return!!this._overrideUid}_overrideGravity(){this._overrideUid=this.editor.model.change((e=>e.overrideSelectionGravity()))}_restoreGravity(){this.editor.model.change((e=>{e.restoreSelectionGravity(this._overrideUid),this._overrideUid=null}))}}function P(e,t){for(const i of t)if(e.hasAttribute(i))return!0;return!1}function I(e,t,i){const n=i.nodeBefore;e.change((i=>{if(n){const t=[],o=e.schema.isObject(n)&&e.schema.isInline(n);for(const[i,s]of n.getAttributes())!e.schema.checkAttribute("$text",i)||o&&!1===e.schema.getAttributeProperties(i).copyFromObject||t.push([i,s]);i.setSelectionAttribute(t)}else i.removeSelectionAttribute(t)}))}function S(e,t){e.change((e=>{e.removeSelectionAttribute(t)}))}function V(e){e.preventDefault()}function R(e,t){return B(e.getShiftedBy(-1),t)}function B(e,t,i=!1){const{nodeBefore:n,nodeAfter:o}=e;for(const e of t){const t=n?n.getAttribute(e):void 0,s=o?o.getAttribute(e):void 0;if((!i||void 0!==t&&void 0!==s)&&s!==t)return!0}return!1}var M=i(3224);const O={copyright:{from:"(c)",to:"©"},registeredTrademark:{from:"(r)",to:"®"},trademark:{from:"(tm)",to:"™"},oneHalf:{from:/(^|[^/a-z0-9])(1\/2)([^/a-z0-9])$/i,to:[null,"½",null]},oneThird:{from:/(^|[^/a-z0-9])(1\/3)([^/a-z0-9])$/i,to:[null,"⅓",null]},twoThirds:{from:/(^|[^/a-z0-9])(2\/3)([^/a-z0-9])$/i,to:[null,"⅔",null]},oneForth:{from:/(^|[^/a-z0-9])(1\/4)([^/a-z0-9])$/i,to:[null,"¼",null]},threeQuarters:{from:/(^|[^/a-z0-9])(3\/4)([^/a-z0-9])$/i,to:[null,"¾",null]},lessThanOrEqual:{from:"<=",to:"≤"},greaterThanOrEqual:{from:">=",to:"≥"},notEqual:{from:"!=",to:"≠"},arrowLeft:{from:"<-",to:"←"},arrowRight:{from:"->",to:"→"},horizontalEllipsis:{from:"...",to:"…"},enDash:{from:/(^| )(--)( )$/,to:[null,"–",null]},emDash:{from:/(^| )(---)( )$/,to:[null,"—",null]},quotesPrimary:{from:D('"'),to:[null,"“",null,"”"]},quotesSecondary:{from:D("'"),to:[null,"‘",null,"’"]},quotesPrimaryEnGb:{from:D("'"),to:[null,"‘",null,"’"]},quotesSecondaryEnGb:{from:D('"'),to:[null,"“",null,"”"]},quotesPrimaryPl:{from:D('"'),to:[null,"„",null,"”"]},quotesSecondaryPl:{from:D("'"),to:[null,"‚",null,"’"]}},L={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},F=["symbols","mathematical","typography","quotes"];class N extends n.Plugin{static get requires(){return["Delete","Input"]}static get pluginName(){return"TextTransformation"}constructor(e){super(e),e.config.define("typing",{transformations:{include:F}})}init(){const e=this.editor.model.document.selection;e.on("change:range",(()=>{this.isEnabled=!e.anchor.parent.is("element","codeBlock")})),this._enableTransformationWatchers()}_enableTransformationWatchers(){const e=this.editor,t=e.model,i=e.plugins.get("Delete"),n=function(e){const t=e.extra||[],i=e.remove||[],n=e=>!i.includes(e);return function(e){const t=new Set;for(const i of e)if("string"==typeof i&&L[i])for(const e of L[i])t.add(e);else t.add(i);return Array.from(t)}(e.include.concat(t).filter(n)).filter(n).map((e=>"string"==typeof e&&O[e]?O[e]:e)).filter((e=>"object"==typeof e)).map((e=>{return{from:(i=e.from,"string"==typeof i?new RegExp(`(${(0,M.A)(i)})$`):i),to:(t=e.to,"string"==typeof t?()=>[t]:t instanceof Array?()=>t:t)};var t,i}))}(e.config.get("typing.transformations")),o=new x(e.model,(e=>{for(const t of n)if(t.from.test(e))return{normalizedTransformation:t}}));o.on("matched:data",((e,n)=>{if(!n.batch.isTyping)return;const{from:o,to:s}=n.normalizedTransformation,r=o.exec(n.text),a=s(r.slice(1)),l=n.range;let c=r.index;t.enqueueChange((e=>{for(let i=1;i<r.length;i++){const o=r[i],s=a[i-1];if(null==s){c+=o.length;continue}const d=l.start.getShiftedBy(c),u=t.createRange(d,d.getShiftedBy(o.length)),h=((n=d).textNode?n.textNode:n.nodeAfter).getAttributes();t.insertContent(e.createText(s,h),u),c+=s.length}var n;t.enqueueChange((()=>{i.requestUndoOnBackspace()}))}))})),o.bind("isEnabled").to(this)}}function D(e){return new RegExp(`(^|\\s)(${e})([^${e}]*)(${e})$`)}function z(e,t,i,n){return n.createRange(W(e,t,i,!0,n),W(e,t,i,!1,n))}function W(e,t,i,n,o){let s=e.textNode||(n?e.nodeBefore:e.nodeAfter),r=null;for(;s&&s.getAttribute(t)==i;)r=s,s=n?s.previousSibling:s.nextSibling;return r?o.createPositionAt(r,n?"before":"after"):e}function H(e,t,i,n){const o=e.editing.view,s=new Set;o.document.registerPostFixer((o=>{const r=e.model.document.selection;let a=!1;if(r.hasAttribute(t)){const l=z(r.getFirstPosition(),t,r.getAttribute(t),e.model),c=e.editing.mapper.toViewRange(l);for(const e of c.getItems())e.is("element",i)&&!e.hasClass(n)&&(o.addClass(n,e),s.add(e),a=!0)}return a})),e.conversion.for("editingDowncast").add((e=>{function t(){o.change((e=>{for(const t of s.values())e.removeClass(n,t),s.delete(t)}))}e.on("insert",t,{priority:"highest"}),e.on("remove",t,{priority:"highest"}),e.on("attribute",t,{priority:"highest"}),e.on("selection",t,{priority:"highest"})}))}},7243:(e,t,i)=>{"use strict";i.r(t),i.d(t,{AccessibilityHelp:()=>re,AutocompleteView:()=>Yi,BalloonPanelView:()=>Jt,BalloonToolbar:()=>un,BlockToolbar:()=>fn,BodyCollection:()=>ae,BoxedEditorUIView:()=>Ri,ButtonLabelView:()=>F,ButtonLabelWithHighlightView:()=>an,ButtonView:()=>N,CollapsibleView:()=>ge,ColorGridView:()=>ve,ColorPickerView:()=>Mt,ColorSelectorView:()=>Ut,ColorTileView:()=>we,ComponentFactory:()=>$t,ContextualBalloon:()=>Wi,CssTransitionDisablerMixin:()=>V,DefaultMenuBarItems:()=>bi,Dialog:()=>Y,DialogView:()=>Q,DialogViewPosition:()=>G,DropdownButtonView:()=>Ne,DropdownPanelView:()=>Oe,DropdownView:()=>Fe,EditorUI:()=>Ii,EditorUIView:()=>Vi,FileDialogButtonView:()=>ce,FileDialogListItemButtonView:()=>de,FocusCycler:()=>W,FormHeaderView:()=>z,HighlightedTextView:()=>rn,IconView:()=>L,IframeView:()=>Oi,InlineEditableUIView:()=>Mi,InputNumberView:()=>Re,InputTextView:()=>Ve,InputView:()=>Se,LabelView:()=>ie,LabelWithHighlightView:()=>ln,LabeledFieldView:()=>Pe,ListItemButtonView:()=>X,ListItemGroupView:()=>Ze,ListItemView:()=>Ke,ListSeparatorView:()=>Ge,ListView:()=>Je,MenuBarMenuListItemButtonView:()=>te,MenuBarMenuListItemFileDialogButtonView:()=>kn,MenuBarMenuListItemView:()=>hi,MenuBarMenuListView:()=>_n,MenuBarMenuView:()=>vn,MenuBarView:()=>An,Notification:()=>Fi,SearchInfoView:()=>Ki,SearchTextView:()=>Ji,SpinnerView:()=>cn,SplitButtonView:()=>Qe,StickyPanelView:()=>ji,SwitchButtonView:()=>le,Template:()=>a,TextareaView:()=>Be,ToolbarLineBreakView:()=>ze,ToolbarSeparatorView:()=>De,ToolbarView:()=>Ue,TooltipManager:()=>ei,View:()=>P,ViewCollection:()=>o,ViewModel:()=>Di,addKeyboardHandlingForGrid:()=>B,addListToDropdown:()=>tt,addToolbarToDropdown:()=>Xe,clickOutsideHandler:()=>I,createDropdown:()=>Ye,createLabeledDropdown:()=>lt,createLabeledInputNumber:()=>rt,createLabeledInputText:()=>st,createLabeledTextarea:()=>at,filterGroupAndItemNames:()=>Li,focusChildOnDropdownOpen:()=>nt,getLocalizedColorOptions:()=>fe,injectCssTransitionDisabler:()=>S,isFocusable:()=>U,isViewWithFocusCycler:()=>$,normalizeColorOptions:()=>pe,normalizeMenuBarConfig:()=>wi,normalizeSingleColorDefinition:()=>be,normalizeToolbarConfig:()=>We,submitHandler:()=>R});var n=i(7906);class o extends n.Collection{constructor(e=[]){super(e,{idProperty:"viewUid"}),this.on("add",((e,t,i)=>{this._renderViewIntoCollectionParent(t,i)})),this.on("remove",((e,t)=>{t.element&&this._parentElement&&t.element.remove()})),this._parentElement=null}destroy(){this.map((e=>e.destroy()))}setParent(e){this._parentElement=e;for(const e of this)this._renderViewIntoCollectionParent(e)}delegate(...e){if(!e.length||!e.every((e=>"string"==typeof e)))throw new n.CKEditorError("ui-viewcollection-delegate-wrong-events",this);return{to:t=>{for(const i of this)for(const n of e)i.delegate(n).to(t);this.on("add",((i,n)=>{for(const i of e)n.delegate(i).to(t)})),this.on("remove",((i,n)=>{for(const i of e)n.stopDelegating(i,t)}))}}}_renderViewIntoCollectionParent(e,t){e.isRendered||e.render(),e.element&&this._parentElement&&this._parentElement.insertBefore(e.element,this._parentElement.children[t])}remove(e){return super.remove(e)}}var s=i(3967),r=i(3149);class a extends((0,n.EmitterMixin)()){constructor(e){super(),Object.assign(this,b(p(e))),this._isRendered=!1,this._revertData=null}render(){const e=this._renderNode({intoFragment:!0});return this._isRendered=!0,e}apply(e){return this._revertData={children:[],bindings:[],attributes:{}},this._renderNode({node:e,intoFragment:!1,isApplying:!0,revertData:this._revertData}),e}revert(e){if(!this._revertData)throw new n.CKEditorError("ui-template-revert-not-applied",[this,e]);this._revertTemplateFromNode(e,this._revertData)}*getViews(){yield*function*e(t){if(t.children)for(const i of t.children)C(i)?yield i:A(i)&&(yield*e(i))}(this)}static bind(e,t){return{to:(i,n)=>new c({eventNameOrFunction:i,attribute:i,observable:e,emitter:t,callback:n}),if:(i,n,o)=>new d({observable:e,emitter:t,attribute:i,valueIfTrue:n,callback:o})}}static extend(e,t){if(e._isRendered)throw new n.CKEditorError("template-extend-render",[this,e]);y(e,b(p(t)))}_renderNode(e){let t;if(t=e.node?this.tag&&this.text:this.tag?this.text:!this.text,t)throw new n.CKEditorError("ui-template-wrong-syntax",this);return this.text?this._renderText(e):this._renderElement(e)}_renderElement(e){let t=e.node;return t||(t=e.node=document.createElementNS(this.ns||"http://www.w3.org/1999/xhtml",this.tag)),this._renderAttributes(e),this._renderElementChildren(e),this._setUpListeners(e),t}_renderText(e){let t=e.node;return t?e.revertData.text=t.textContent:t=e.node=document.createTextNode(""),u(this.text)?this._bindToObservable({schema:this.text,updater:m(t),data:e}):t.textContent=this.text.join(""),t}_renderAttributes(e){if(!this.attributes)return;const t=e.node,i=e.revertData;for(const n in this.attributes){const o=t.getAttribute(n),s=this.attributes[n];i&&(i.attributes[n]=o);const r=x(s)?s[0].ns:null;if(u(s)){const a=x(s)?s[0].value:s;i&&T(n)&&a.unshift(o),this._bindToObservable({schema:a,updater:g(t,n,r),data:e})}else if("style"==n&&"string"!=typeof s[0])this._renderStyleAttribute(s[0],e);else{i&&o&&T(n)&&s.unshift(o);const e=s.map((e=>e&&e.value||e)).reduce(((e,t)=>e.concat(t)),[]).reduce(v,"");k(e)||t.setAttributeNS(r,n,e)}}}_renderStyleAttribute(e,t){const i=t.node;for(const n in e){const o=e[n];u(o)?this._bindToObservable({schema:[o],updater:f(i,n),data:t}):i.style[n]=o}}_renderElementChildren(e){const t=e.node,i=e.intoFragment?document.createDocumentFragment():t,o=e.isApplying;let s=0;for(const r of this.children)if(E(r)){if(!o){r.setParent(t);for(const e of r)i.appendChild(e.element)}}else if(C(r))o||(r.isRendered||r.render(),i.appendChild(r.element));else if((0,n.isNode)(r))i.appendChild(r);else if(o){const t={children:[],bindings:[],attributes:{}};e.revertData.children.push(t),r._renderNode({intoFragment:!1,node:i.childNodes[s++],isApplying:!0,revertData:t})}else i.appendChild(r.render());e.intoFragment&&t.appendChild(i)}_setUpListeners(e){if(this.eventListeners)for(const t in this.eventListeners){const i=this.eventListeners[t].map((i=>{const[n,o]=t.split("@");return i.activateDomEventListener(n,o,e)}));e.revertData&&e.revertData.bindings.push(i)}}_bindToObservable({schema:e,updater:t,data:i}){const n=i.revertData;h(e,t,i);const o=e.filter((e=>!k(e))).filter((e=>e.observable)).map((n=>n.activateAttributeListener(e,t,i)));n&&n.bindings.push(o)}_revertTemplateFromNode(e,t){for(const e of t.bindings)for(const t of e)t();if(t.text)return void(e.textContent=t.text);const i=e;for(const e in t.attributes){const n=t.attributes[e];null===n?i.removeAttribute(e):i.setAttribute(e,n)}for(let e=0;e<t.children.length;++e)this._revertTemplateFromNode(i.childNodes[e],t.children[e])}}class l{constructor(e){this.attribute=e.attribute,this.observable=e.observable,this.emitter=e.emitter,this.callback=e.callback}getValue(e){const t=this.observable[this.attribute];return this.callback?this.callback(t,e):t}activateAttributeListener(e,t,i){const n=()=>h(e,t,i);return this.emitter.listenTo(this.observable,`change:${this.attribute}`,n),()=>{this.emitter.stopListening(this.observable,`change:${this.attribute}`,n)}}}class c extends l{constructor(e){super(e),this.eventNameOrFunction=e.eventNameOrFunction}activateDomEventListener(e,t,i){const n=(e,i)=>{t&&!i.target.matches(t)||("function"==typeof this.eventNameOrFunction?this.eventNameOrFunction(i):this.observable.fire(this.eventNameOrFunction,i))};return this.emitter.listenTo(i.node,e,n),()=>{this.emitter.stopListening(i.node,e,n)}}}class d extends l{constructor(e){super(e),this.valueIfTrue=e.valueIfTrue}getValue(e){return!k(super.getValue(e))&&(this.valueIfTrue||!0)}}function u(e){return!!e&&(e.value&&(e=e.value),Array.isArray(e)?e.some(u):e instanceof l)}function h(e,t,{node:i}){const n=function(e,t){return e.map((e=>e instanceof l?e.getValue(t):e))}(e,i);let o;o=1==e.length&&e[0]instanceof d?n[0]:n.reduce(v,""),k(o)?t.remove():t.set(o)}function m(e){return{set(t){e.textContent=t},remove(){e.textContent=""}}}function g(e,t,i){return{set(n){e.setAttributeNS(i,t,n)},remove(){e.removeAttributeNS(i,t)}}}function f(e,t){return{set(i){e.style[t]=i},remove(){e.style[t]=null}}}function p(e){return(0,s.A)(e,(e=>{if(e&&(e instanceof l||A(e)||C(e)||E(e)))return e}))}function b(e){if("string"==typeof e?e=function(e){return{text:[e]}}(e):e.text&&function(e){e.text=(0,n.toArray)(e.text)}(e),e.on&&(e.eventListeners=function(e){for(const t in e)w(e,t);return e}(e.on),delete e.on),!e.text){e.attributes&&function(e){for(const t in e)e[t].value&&(e[t].value=(0,n.toArray)(e[t].value)),w(e,t)}(e.attributes);const t=[];if(e.children)if(E(e.children))t.push(e.children);else for(const i of e.children)A(i)||C(i)||(0,n.isNode)(i)?t.push(i):t.push(new a(i));e.children=t}return e}function w(e,t){e[t]=(0,n.toArray)(e[t])}function v(e,t){return k(t)?e:k(e)?t:`${e} ${t}`}function _(e,t){for(const i in t)e[i]?e[i].push(...t[i]):e[i]=t[i]}function y(e,t){if(t.attributes&&(e.attributes||(e.attributes={}),_(e.attributes,t.attributes)),t.eventListeners&&(e.eventListeners||(e.eventListeners={}),_(e.eventListeners,t.eventListeners)),t.text&&e.text.push(...t.text),t.children&&t.children.length){if(e.children.length!=t.children.length)throw new n.CKEditorError("ui-template-extend-children-mismatch",e);let i=0;for(const n of t.children)y(e.children[i++],n)}}function k(e){return!e&&0!==e}function C(e){return e instanceof P}function A(e){return e instanceof a}function E(e){return e instanceof o}function x(e){return(0,r.A)(e[0])&&e[0].ns}function T(e){return"class"==e||"style"==e}class P extends((0,n.DomEmitterMixin)((0,n.ObservableMixin)())){constructor(e){super(),this.element=null,this.isRendered=!1,this.locale=e,this.t=e&&e.t,this._viewCollections=new n.Collection,this._unboundChildren=this.createCollection(),this._viewCollections.on("add",((t,i)=>{i.locale=e,i.t=e&&e.t})),this.decorate("render")}get bindTemplate(){return this._bindTemplate?this._bindTemplate:this._bindTemplate=a.bind(this,this)}createCollection(e){const t=new o(e);return this._viewCollections.add(t),t}registerChild(e){(0,n.isIterable)(e)||(e=[e]);for(const t of e)this._unboundChildren.add(t)}deregisterChild(e){(0,n.isIterable)(e)||(e=[e]);for(const t of e)this._unboundChildren.remove(t)}setTemplate(e){this.template=new a(e)}extendTemplate(e){a.extend(this.template,e)}render(){if(this.isRendered)throw new n.CKEditorError("ui-view-render-already-rendered",this);this.template&&(this.element=this.template.render(),this.registerChild(this.template.getViews())),this.isRendered=!0}destroy(){this.stopListening(),this._viewCollections.map((e=>e.destroy())),this.template&&this.template._revertData&&this.template.revert(this.element)}}function I({emitter:e,activator:t,callback:i,contextElements:n}){e.listenTo(document,"mousedown",((e,o)=>{if(!t())return;const s="function"==typeof o.composedPath?o.composedPath():[],r="function"==typeof n?n():n;for(const e of r)if(e.contains(o.target)||s.includes(e))return;i()}))}function S(e){const t=e;t.set("_isCssTransitionsDisabled",!1),t.disableCssTransitions=()=>{t._isCssTransitionsDisabled=!0},t.enableCssTransitions=()=>{t._isCssTransitionsDisabled=!1},t.extendTemplate({attributes:{class:[t.bindTemplate.if("_isCssTransitionsDisabled","ck-transitions-disabled")]}})}function V(e){return class extends e{disableCssTransitions(){this._isCssTransitionsDisabled=!0}enableCssTransitions(){this._isCssTransitionsDisabled=!1}constructor(...e){super(...e),this.set("_isCssTransitionsDisabled",!1),this.initializeCssTransitionDisablerMixin()}initializeCssTransitionDisablerMixin(){this.extendTemplate({attributes:{class:[this.bindTemplate.if("_isCssTransitionsDisabled","ck-transitions-disabled")]}})}}}function R({view:e}){e.listenTo(e.element,"submit",((t,i)=>{i.preventDefault(),e.fire("submit")}),{useCapture:!0})}function B({keystrokeHandler:e,focusTracker:t,gridItems:i,numberOfColumns:n,uiLanguageDirection:o}){const s="number"==typeof n?()=>n:n;function r(e){return n=>{const o=i.find((e=>e.element===t.focusedElement)),s=i.getIndex(o),r=e(s,i);i.get(r).focus(),n.stopPropagation(),n.preventDefault()}}function a(e,t){return e===t-1?0:e+1}function l(e,t){return 0===e?t-1:e-1}e.set("arrowright",r(((e,t)=>"rtl"===o?l(e,t.length):a(e,t.length)))),e.set("arrowleft",r(((e,t)=>"rtl"===o?a(e,t.length):l(e,t.length)))),e.set("arrowup",r(((e,t)=>{let i=e-s();return i<0&&(i=e+s()*Math.floor(t.length/s()),i>t.length-1&&(i-=s())),i}))),e.set("arrowdown",r(((e,t)=>{let i=e+s();return i>t.length-1&&(i=e%s()),i})))}var M=i(1024);class O extends P{constructor(){super();const e=this.bindTemplate;this.set("content",""),this.set("viewBox","0 0 20 20"),this.set("fillColor",""),this.set("isColorInherited",!0),this.set("isVisible",!0),this.setTemplate({tag:"svg",ns:"http://www.w3.org/2000/svg",attributes:{class:["ck","ck-icon",e.if("isVisible","ck-hidden",(e=>!e)),"ck-reset_all-excluded",e.if("isColorInherited","ck-icon_inherit-color")],viewBox:e.to("viewBox")}})}render(){super.render(),this._updateXMLContent(),this._colorFillPaths(),this.on("change:content",(()=>{this._updateXMLContent(),this._colorFillPaths()})),this.on("change:fillColor",(()=>{this._colorFillPaths()}))}_updateXMLContent(){if(this.content){const e=(new DOMParser).parseFromString(this.content.trim(),"image/svg+xml").querySelector("svg"),t=e.getAttribute("viewBox");t&&(this.viewBox=t);for(const{name:t,value:i}of Array.from(e.attributes))O.presentationalAttributeNames.includes(t)&&this.element.setAttribute(t,i);for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);for(;e.childNodes.length>0;)this.element.appendChild(e.childNodes[0])}}_colorFillPaths(){this.fillColor&&this.element.querySelectorAll(".ck-icon__fill").forEach((e=>{e.style.fill=this.fillColor}))}}O.presentationalAttributeNames=["alignment-baseline","baseline-shift","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-rendering","cursor","direction","display","dominant-baseline","fill","fill-opacity","fill-rule","filter","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","mask","opacity","overflow","paint-order","pointer-events","shape-rendering","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-overflow","text-rendering","transform","unicode-bidi","vector-effect","visibility","white-space","word-spacing","writing-mode"];const L=O;class F extends P{constructor(){super(),this.set({style:void 0,text:void 0,id:void 0});const e=this.bindTemplate;this.setTemplate({tag:"span",attributes:{class:["ck","ck-button__label"],style:e.to("style"),id:e.to("id")},children:[{text:e.to("text")}]})}}class N extends P{constructor(e,t=new F){super(e),this._focusDelayed=null;const i=this.bindTemplate,o=(0,n.uid)();this.set("_ariaPressed",!1),this.set("_ariaChecked",!1),this.set("ariaLabel",void 0),this.set("ariaLabelledBy",`ck-editor__aria-label_${o}`),this.set("class",void 0),this.set("labelStyle",void 0),this.set("icon",void 0),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isVisible",!0),this.set("isToggleable",!1),this.set("keystroke",void 0),this.set("label",void 0),this.set("role",void 0),this.set("tabindex",-1),this.set("tooltip",!1),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.set("withKeystroke",!1),this.children=this.createCollection(),this.labelView=this._setupLabelView(t),this.iconView=new L,this.iconView.extendTemplate({attributes:{class:"ck-button__icon"}}),this.keystrokeView=this._createKeystrokeView(),this.bind("_tooltipString").to(this,"tooltip",this,"label",this,"keystroke",this._getTooltipString.bind(this));const s={tag:"button",attributes:{class:["ck","ck-button",i.to("class"),i.if("isEnabled","ck-disabled",(e=>!e)),i.if("isVisible","ck-hidden",(e=>!e)),i.to("isOn",(e=>e?"ck-on":"ck-off")),i.if("withText","ck-button_with-text"),i.if("withKeystroke","ck-button_with-keystroke")],role:i.to("role"),type:i.to("type",(e=>e||"button")),tabindex:i.to("tabindex"),"aria-checked":i.to("_ariaChecked"),"aria-pressed":i.to("_ariaPressed"),"aria-label":i.to("ariaLabel"),"aria-labelledby":i.to("ariaLabelledBy"),"aria-disabled":i.if("isEnabled",!0,(e=>!e)),"data-cke-tooltip-text":i.to("_tooltipString"),"data-cke-tooltip-position":i.to("tooltipPosition")},children:this.children,on:{click:i.to((e=>{this.isEnabled?this.fire("execute"):e.preventDefault()}))}};this.bind("_ariaPressed").to(this,"isOn",this,"isToggleable",this,"role",((e,t,i)=>!(!t||D(i))&&String(!!e))),this.bind("_ariaChecked").to(this,"isOn",this,"isToggleable",this,"role",((e,t,i)=>!(!t||!D(i))&&String(!!e))),n.env.isSafari&&(this._focusDelayed||(this._focusDelayed=(0,n.delay)((()=>this.focus()),0)),s.on.mousedown=i.to((()=>{this._focusDelayed()})),s.on.mouseup=i.to((()=>{this._focusDelayed.cancel()}))),this.setTemplate(s)}render(){super.render(),this.icon&&(this.iconView.bind("content").to(this,"icon"),this.children.add(this.iconView)),this.children.add(this.labelView),this.withKeystroke&&this.keystroke&&this.children.add(this.keystrokeView)}focus(){this.element.focus()}destroy(){this._focusDelayed&&this._focusDelayed.cancel(),super.destroy()}_setupLabelView(e){return e.bind("text","style","id").to(this,"label","labelStyle","ariaLabelledBy"),e}_createKeystrokeView(){const e=new P;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__keystroke"]},children:[{text:this.bindTemplate.to("keystroke",(e=>(0,n.getEnvKeystrokeText)(e)))}]}),e}_getTooltipString(e,t,i){return e?"string"==typeof e?e:(i&&(i=(0,n.getEnvKeystrokeText)(i)),e instanceof Function?e(t,i):`${t}${i?` (${i})`:""}`):""}}function D(e){switch(e){case"radio":case"checkbox":case"option":case"switch":case"menuitemcheckbox":case"menuitemradio":return!0;default:return!1}}class z extends P{constructor(e,t={}){super(e);const i=this.bindTemplate;this.set("label",t.label||""),this.set("class",t.class||null),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__header",i.to("class")]},children:this.children}),t.icon&&(this.iconView=new L,this.iconView.content=t.icon,this.children.add(this.iconView));const n=new P(e);n.setTemplate({tag:"h2",attributes:{class:["ck","ck-form__header__label"],role:"presentation"},children:[{text:i.to("label")}]}),this.children.add(n)}}class W extends((0,n.EmitterMixin)()){constructor(e){if(super(),this.focusables=e.focusables,this.focusTracker=e.focusTracker,this.keystrokeHandler=e.keystrokeHandler,this.actions=e.actions,e.actions&&e.keystrokeHandler)for(const t in e.actions){let i=e.actions[t];"string"==typeof i&&(i=[i]);for(const n of i)e.keystrokeHandler.set(n,((e,i)=>{this[t](),i()}),e.keystrokeHandlerOptions)}this.on("forwardCycle",(()=>this.focusFirst()),{priority:"low"}),this.on("backwardCycle",(()=>this.focusLast()),{priority:"low"})}get first(){return this.focusables.find(H)||null}get last(){return this.focusables.filter(H).slice(-1)[0]||null}get next(){return this._getDomFocusableItem(1)}get previous(){return this._getDomFocusableItem(-1)}get current(){let e=null;return null===this.focusTracker.focusedElement?null:(this.focusables.find(((t,i)=>{const n=t.element===this.focusTracker.focusedElement;return n&&(e=i),n})),e)}focusFirst(){this._focus(this.first,1)}focusLast(){this._focus(this.last,-1)}focusNext(){const e=this.next;e&&this.focusables.getIndex(e)===this.current||e===this.first?this.fire("forwardCycle"):this._focus(e,1)}focusPrevious(){const e=this.previous;e&&this.focusables.getIndex(e)===this.current||e===this.last?this.fire("backwardCycle"):this._focus(e,-1)}chain(e){const t=()=>null===this.current?null:this.focusables.get(this.current);this.listenTo(e,"forwardCycle",(e=>{const i=t();this.focusNext(),i!==t()&&e.stop()}),{priority:"low"}),this.listenTo(e,"backwardCycle",(e=>{const i=t();this.focusPrevious(),i!==t()&&e.stop()}),{priority:"low"})}unchain(e){this.stopListening(e)}_focus(e,t){e&&this.focusTracker.focusedElement!==e.element&&e.focus(t)}_getDomFocusableItem(e){const t=this.focusables.length;if(!t)return null;const i=this.current;if(null===i)return this[1===e?"first":"last"];let n=this.focusables.get(i),o=(i+t+e)%t;do{const i=this.focusables.get(o);if(H(i)){n=i;break}o=(o+t+e)%t}while(o!==i);return n}}function H(e){return U(e)&&(0,n.isVisible)(e.element)}function U(e){return!(!("focus"in e)||"function"!=typeof e.focus)}function $(e){return U(e)&&"focusCycler"in e&&e.focusCycler instanceof W}function j(e){return class extends e{constructor(...e){super(...e),this._onDragBound=this._onDrag.bind(this),this._onDragEndBound=this._onDragEnd.bind(this),this._lastDraggingCoordinates={x:0,y:0},this.on("render",(()=>{this._attachListeners()})),this.set("isDragging",!1)}_attachListeners(){this.listenTo(this.element,"mousedown",this._onDragStart.bind(this)),this.listenTo(this.element,"touchstart",this._onDragStart.bind(this))}_attachDragListeners(){this.listenTo(n.global.document,"mouseup",this._onDragEndBound),this.listenTo(n.global.document,"touchend",this._onDragEndBound),this.listenTo(n.global.document,"mousemove",this._onDragBound),this.listenTo(n.global.document,"touchmove",this._onDragBound)}_detachDragListeners(){this.stopListening(n.global.document,"mouseup",this._onDragEndBound),this.stopListening(n.global.document,"touchend",this._onDragEndBound),this.stopListening(n.global.document,"mousemove",this._onDragBound),this.stopListening(n.global.document,"touchmove",this._onDragBound)}_onDragStart(e,t){if(!this._isHandleElementPressed(t))return;this._attachDragListeners();let i=0,n=0;t instanceof MouseEvent?(i=t.clientX,n=t.clientY):(i=t.touches[0].clientX,n=t.touches[0].clientY),this._lastDraggingCoordinates={x:i,y:n},this.isDragging=!0}_onDrag(e,t){if(!this.isDragging)return void this._detachDragListeners();let i=0,n=0;t instanceof MouseEvent?(i=t.clientX,n=t.clientY):(i=t.touches[0].clientX,n=t.touches[0].clientY),t.preventDefault(),this.fire("drag",{deltaX:Math.round(i-this._lastDraggingCoordinates.x),deltaY:Math.round(n-this._lastDraggingCoordinates.y)}),this._lastDraggingCoordinates={x:i,y:n}}_onDragEnd(){this._detachDragListeners(),this.isDragging=!1}_isHandleElementPressed(e){return!!this.dragHandleElement&&(this.dragHandleElement===e.target||e.target instanceof HTMLElement&&this.dragHandleElement.contains(e.target))}}}class q extends P{constructor(e){super(e),this.children=this.createCollection(),this.keystrokes=new n.KeystrokeHandler,this._focusTracker=new n.FocusTracker,this._focusables=new o,this.focusCycler=new W({focusables:this._focusables,focusTracker:this._focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-dialog__actions"]},children:this.children})}render(){super.render(),this.keystrokes.listenTo(this.element)}setButtons(e){for(const t of e){const e=new N(this.locale);let i;for(i in e.on("execute",(()=>t.onExecute())),t.onCreate&&t.onCreate(e),t)"onExecute"!=i&&"onCreate"!=i&&e.set(i,t[i]);this.children.add(e)}this._updateFocusCyclableItems()}focus(e){-1===e?this.focusCycler.focusLast():this.focusCycler.focusFirst()}_updateFocusCyclableItems(){Array.from(this.children).forEach((e=>{this._focusables.add(e),this._focusTracker.add(e.element)}))}}class K extends P{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-dialog__content"]},children:this.children})}reset(){for(;this.children.length;)this.children.remove(0)}}const G={SCREEN_CENTER:"screen-center",EDITOR_CENTER:"editor-center",EDITOR_TOP_SIDE:"editor-top-side",EDITOR_TOP_CENTER:"editor-top-center",EDITOR_BOTTOM_CENTER:"editor-bottom-center",EDITOR_ABOVE_CENTER:"editor-above-center",EDITOR_BELOW_CENTER:"editor-below-center"},Z=(0,n.toUnit)("px");class J extends(j(P)){constructor(e,{getCurrentDomRoot:t,getViewportOffset:i}){super(e),this.wasMoved=!1;const s=this.bindTemplate,r=e.t;this.set("className",""),this.set("ariaLabel",r("Editor dialog")),this.set("isModal",!1),this.set("position",G.SCREEN_CENTER),this.set("_isVisible",!1),this.set("_isTransparent",!1),this.set("_top",0),this.set("_left",0),this._getCurrentDomRoot=t,this._getViewportOffset=i,this.decorate("moveTo"),this.parts=this.createCollection(),this.keystrokes=new n.KeystrokeHandler,this.focusTracker=new n.FocusTracker,this._focusables=new o,this._focusCycler=new W({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-dialog-overlay",s.if("isModal","ck-dialog-overlay__transparent",(e=>!e)),s.if("_isVisible","ck-hidden",(e=>!e))],tabindex:"-1"},children:[{tag:"div",attributes:{tabindex:"-1",class:["ck","ck-dialog",s.to("className")],role:"dialog","aria-label":s.to("ariaLabel"),style:{top:s.to("_top",(e=>Z(e))),left:s.to("_left",(e=>Z(e))),visibility:s.if("_isTransparent","hidden")}},children:this.parts}]})}render(){super.render(),this.keystrokes.set("Esc",((e,t)=>{this.fire("close",{source:"escKeyPress"}),t()})),this.on("drag",((e,{deltaX:t,deltaY:i})=>{this.wasMoved=!0,this.moveBy(t,i)})),this.listenTo(n.global.window,"resize",(()=>{this._isVisible&&!this.wasMoved&&this.updatePosition()})),this.listenTo(n.global.document,"scroll",(()=>{this._isVisible&&!this.wasMoved&&this.updatePosition()})),this.on("change:_isVisible",((e,t,i)=>{i&&(this._isTransparent=!0,setTimeout((()=>{this.updatePosition(),this._isTransparent=!1,this.focus()}),10))})),this.keystrokes.listenTo(this.element)}get dragHandleElement(){return this.headerView?this.headerView.element:null}setupParts({icon:e,title:t,hasCloseButton:i=!0,content:n,actionButtons:o}){t&&(this.headerView=new z(this.locale,{icon:e}),i&&(this.closeButtonView=this._createCloseButton(),this.headerView.children.add(this.closeButtonView)),this.headerView.label=t,this.ariaLabel=t,this.parts.add(this.headerView,0)),n&&(n instanceof P&&(n=[n]),this.contentView=new K(this.locale),this.contentView.children.addMany(n),this.parts.add(this.contentView)),o&&(this.actionsView=new q(this.locale),this.actionsView.setButtons(o),this.parts.add(this.actionsView)),this._updateFocusCyclableItems()}focus(){this._focusCycler.focusFirst()}moveTo(e,t){const i=this._getViewportRect(),n=this._getDialogRect();e+n.width>i.right&&(e=i.right-n.width),e<i.left&&(e=i.left),t<i.top&&(t=i.top),this._moveTo(e,t)}_moveTo(e,t){this._left=e,this._top=t}moveBy(e,t){this.moveTo(this._left+e,this._top+t)}_moveOffScreen(){this._moveTo(-9999,-9999)}updatePosition(){if(!this.element||!this.element.parentNode)return;const e=this._getViewportRect();let t,i=this.position;this._getCurrentDomRoot()?t=this._getVisibleDomRootRect(e):i=G.SCREEN_CENTER;const n=J.defaultOffset,o=this._getDialogRect();switch(i){case G.EDITOR_TOP_SIDE:if(t){const e="ltr"===this.locale.contentLanguageDirection?t.right-o.width-n:t.left+n;this.moveTo(e,t.top+n)}else this._moveOffScreen();break;case G.EDITOR_CENTER:t?this.moveTo(Math.round(t.left+t.width/2-o.width/2),Math.round(t.top+t.height/2-o.height/2)):this._moveOffScreen();break;case G.SCREEN_CENTER:this.moveTo(Math.round((e.width-o.width)/2),Math.round((e.height-o.height)/2));break;case G.EDITOR_TOP_CENTER:t?this.moveTo(Math.round(t.left+t.width/2-o.width/2),t.top+n):this._moveOffScreen();break;case G.EDITOR_BOTTOM_CENTER:t?this.moveTo(Math.round(t.left+t.width/2-o.width/2),t.bottom-o.height-n):this._moveOffScreen();break;case G.EDITOR_ABOVE_CENTER:t?this.moveTo(Math.round(t.left+t.width/2-o.width/2),t.top-o.height-n):this._moveOffScreen();break;case G.EDITOR_BELOW_CENTER:t?this.moveTo(Math.round(t.left+t.width/2-o.width/2),t.bottom+n):this._moveOffScreen()}}_getVisibleDomRootRect(e){let t=new n.Rect(this._getCurrentDomRoot()).getVisible();return t?(t=e.getIntersection(t),t||null):null}_getDialogRect(){return new n.Rect(this.element.firstElementChild)}_getViewportRect(){return function(e){e=Object.assign({top:0,bottom:0,left:0,right:0},e);const t=new n.Rect(n.global.window);return t.top+=e.top,t.height-=e.top,t.bottom-=e.bottom,t.height-=e.bottom,t.left+=e.left,t.right-=e.right,t.width-=e.left+e.right,t}(this._getViewportOffset())}_updateFocusCyclableItems(){const e=[];if(this.contentView)for(const t of this.contentView.children)U(t)&&e.push(t);this.actionsView&&e.push(this.actionsView),this.closeButtonView&&e.push(this.closeButtonView),e.forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element),$(e)&&this._focusCycler.chain(e.focusCycler)}))}_createCloseButton(){const e=new N(this.locale),t=this.locale.t;return e.set({label:t("Close"),tooltip:!0,icon:M.icons.cancel}),e.on("execute",(()=>this.fire("close",{source:"closeButton"}))),e}}J.defaultOffset=15;const Q=J;class Y extends M.Plugin{static get pluginName(){return"Dialog"}constructor(e){super(e);const t=e.t;this._initShowHideListeners(),this._initFocusToggler(),this._initMultiRootIntegration(),this.set({id:null,isOpen:!1}),e.accessibility.addKeystrokeInfos({categoryId:"navigation",keystrokes:[{label:t("Move focus in and out of an active dialog window"),keystroke:"Ctrl+F6",mayRequireFn:!0}]})}_initShowHideListeners(){this.on("show",((e,t)=>{this._show(t)})),this.on("show",((e,t)=>{t.onShow&&t.onShow(this)}),{priority:"low"}),this.on("hide",(()=>{Y._visibleDialogPlugin&&Y._visibleDialogPlugin._hide()})),this.on("hide",(()=>{this._onHide&&(this._onHide(this),this._onHide=void 0)}),{priority:"low"})}_initFocusToggler(){const e=this.editor;e.keystrokes.set("Ctrl+F6",((t,i)=>{this.isOpen&&!this.view.isModal&&(this.view.focusTracker.isFocused?e.editing.view.focus():this.view.focus(),i())}))}_initMultiRootIntegration(){const e=this.editor.model;e.document.on("change:data",(()=>{if(!this.view)return;const t=e.document.differ.getChangedRoots();for(const e of t)e.state&&this.view.updatePosition()}))}show(e){this.hide(),this.fire(`show:${e.id}`,e)}_show({id:e,icon:t,title:i,hasCloseButton:n=!0,content:o,actionButtons:s,className:r,isModal:a,position:l,onHide:c}){const d=this.editor;this.view=new Q(d.locale,{getCurrentDomRoot:()=>d.editing.view.getDomRoot(d.model.document.selection.anchor.root.rootName),getViewportOffset:()=>d.ui.viewportOffset});const u=this.view;u.on("close",(()=>{this.hide()})),d.ui.view.body.add(u),d.ui.focusTracker.add(u.element),d.keystrokes.listenTo(u.element),l||(l=a?G.SCREEN_CENTER:G.EDITOR_CENTER),u.set({position:l,_isVisible:!0,className:r,isModal:a}),u.setupParts({icon:t,title:i,hasCloseButton:n,content:o,actionButtons:s}),this.id=e,c&&(this._onHide=c),this.isOpen=!0,Y._visibleDialogPlugin=this}hide(){Y._visibleDialogPlugin&&Y._visibleDialogPlugin.fire(`hide:${Y._visibleDialogPlugin.id}`)}_hide(){if(!this.view)return;const e=this.editor,t=this.view;t.contentView&&t.contentView.reset(),e.ui.view.body.remove(t),e.ui.focusTracker.remove(t.element),e.keystrokes.stopListening(t.element),t.destroy(),e.editing.view.focus(),this.id=null,this.isOpen=!1,Y._visibleDialogPlugin=null}}class X extends N{constructor(e,t=new F){super(e,t),this._checkIconHolderView=new ee,this.set({hasCheckSpace:!1,_hasCheck:this.isToggleable});const i=this.bindTemplate;this.extendTemplate({attributes:{class:["ck-list-item-button",i.if("isToggleable","ck-list-item-button_toggleable")]}}),this.bind("_hasCheck").to(this,"hasCheckSpace",this,"isToggleable",((e,t)=>e||t))}render(){super.render(),this._hasCheck&&this.children.add(this._checkIconHolderView,0),this._watchCheckIconHolderMount()}_watchCheckIconHolderMount(){this._checkIconHolderView.bind("isOn").to(this,"isOn",(e=>this.isToggleable&&e)),this.on("change:_hasCheck",((e,t,i)=>{const{children:n,_checkIconHolderView:o}=this;i?n.add(o,0):n.remove(o)}))}}class ee extends P{constructor(){super(),this._checkIconView=this._createCheckIconView();const e=this.bindTemplate;this.children=this.createCollection(),this.set("isOn",!1),this.setTemplate({tag:"span",children:this.children,attributes:{class:["ck","ck-list-item-button__check-holder",e.to("isOn",(e=>e?"ck-on":"ck-off"))]}})}render(){super.render(),this.isOn&&this.children.add(this._checkIconView,0),this._watchCheckIconMount()}_watchCheckIconMount(){this.on("change:isOn",((e,t,i)=>{const{children:n,_checkIconView:o}=this;i&&!n.has(o)?n.add(o):!i&&n.has(o)&&n.remove(o)}))}_createCheckIconView(){const e=new L;return e.content=M.icons.check,e.extendTemplate({attributes:{class:"ck-list-item-button__check-icon"}}),e}}class te extends X{constructor(e){super(e),this.set({withText:!0,withKeystroke:!0,tooltip:!1,role:"menuitem"}),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item__button"]}})}}class ie extends P{constructor(e){super(e),this.set("text",void 0),this.set("for",void 0),this.id=`ck-editor__label_${(0,n.uid)()}`;const t=this.bindTemplate;this.setTemplate({tag:"label",attributes:{class:["ck","ck-label"],id:this.id,for:t.to("for")},children:[{text:t.to("text")}]})}}class ne extends P{constructor(e,t){super(e);const i=e.t,o=new ie;o.text=i("Help Contents. To close this dialog press ESC."),this.setTemplate({tag:"div",attributes:{class:["ck","ck-accessibility-help-dialog__content"],"aria-labelledby":o.id,role:"document",tabindex:-1},children:[(0,n.createElement)(document,"p",{},i("Below, you can find a list of keyboard shortcuts that can be used in the editor.")),...this._createCategories(Array.from(t.values())),o]})}focus(){this.element.focus()}_createCategories(e){return e.map((e=>{const t=[(0,n.createElement)(document,"h3",{},e.label),...Array.from(e.groups.values()).map((e=>this._createGroup(e))).flat()];return e.description&&t.splice(1,0,(0,n.createElement)(document,"p",{},e.description)),(0,n.createElement)(document,"section",{},t)}))}_createGroup(e){const t=e.keystrokes.sort(((e,t)=>e.label.localeCompare(t.label))).map((e=>this._createGroupRow(e))).flat(),i=[(0,n.createElement)(document,"dl",{},t)];return e.label&&i.unshift((0,n.createElement)(document,"h4",{},e.label)),i}_createGroupRow(e){const t=this.locale.t,i=(0,n.createElement)(document,"dt"),o=(0,n.createElement)(document,"dd"),s="string"==typeof(a=e.keystroke)?[[a]]:"string"==typeof a[0]?[a]:a,r=[];var a;for(const e of s)r.push(e.map(oe).join(""));return i.innerHTML=e.label,o.innerHTML=r.join(", ")+(e.mayRequireFn&&n.env.isMac?` ${t("(may require <kbd>Fn</kbd>)")}`:""),[i,o]}}function oe(e){return(0,n.getEnvKeystrokeText)(e).split("+").map((e=>`<kbd>${e}</kbd>`)).join("+")}const se='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10 6.628a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"/><path d="M8.5 9.125a.3.3 0 0 0-.253-.296L5.11 8.327a.75.75 0 1 1 .388-1.449l4.04.716c.267.072.624.08.893.009l4.066-.724a.75.75 0 1 1 .388 1.45l-3.132.5a.3.3 0 0 0-.253.296v1.357a.3.3 0 0 0 .018.102l1.615 4.438a.75.75 0 0 1-1.41.513l-1.35-3.71a.3.3 0 0 0-.281-.197h-.209a.3.3 0 0 0-.282.198l-1.35 3.711a.75.75 0 0 1-1.41-.513l1.64-4.509a.3.3 0 0 0 .019-.103V9.125Z"/><path clip-rule="evenodd" d="M10 18.5a8.5 8.5 0 1 1 0-17 8.5 8.5 0 0 1 0 17Zm0 1.5c5.523 0 10-4.477 10-10S15.523 0 10 0 0 4.477 0 10s4.477 10 10 10Z"/></svg>';class re extends M.Plugin{constructor(){super(...arguments),this.contentView=null}static get requires(){return[Y]}static get pluginName(){return"AccessibilityHelp"}init(){const e=this.editor,t=e.locale.t;e.ui.componentFactory.add("accessibilityHelp",(()=>{const e=this._createButton(N);return e.set({tooltip:!0,withText:!1,label:t("Accessibility help")}),e})),e.ui.componentFactory.add("menuBar:accessibilityHelp",(()=>{const e=this._createButton(te);return e.label=t("Accessibility"),e})),e.keystrokes.set("Alt+0",((e,t)=>{this._toggleDialog(),t()})),this._setupRootLabels()}_createButton(e){const t=this.editor,i=t.plugins.get("Dialog"),n=new e(t.locale);return n.set({keystroke:"Alt+0",icon:se,isToggleable:!0}),n.on("execute",(()=>this._toggleDialog())),n.bind("isOn").to(i,"id",(e=>"accessibilityHelp"===e)),n}_setupRootLabels(){const e=this.editor,t=e.editing.view,i=e.t;function o(e,t){const o=`${t.getAttribute("aria-label")}. ${i("Press %0 for help.",[(0,n.getEnvKeystrokeText)("Alt+0")])}`;e.setAttribute("aria-label",o,t)}e.ui.on("ready",(()=>{t.change((e=>{for(const i of t.document.roots)o(e,i)})),e.on("addRoot",((i,n)=>{const s=e.editing.view.document.getRoot(n.rootName);t.change((e=>o(e,s)))}),{priority:"low"})}))}_toggleDialog(){const e=this.editor,t=e.plugins.get("Dialog"),i=e.locale.t;this.contentView||(this.contentView=new ne(e.locale,e.accessibility.keystrokeInfos)),"accessibilityHelp"===t.id?t.hide():t.show({id:"accessibilityHelp",className:"ck-accessibility-help-dialog",title:i("Accessibility help"),icon:se,hasCloseButton:!0,content:this.contentView})}}class ae extends o{constructor(e,t=[]){super(t),this.locale=e}get bodyCollectionContainer(){return this._bodyCollectionContainer}attachToDom(){this._bodyCollectionContainer=new a({tag:"div",attributes:{class:["ck","ck-reset_all","ck-body","ck-rounded-corners"],dir:this.locale.uiLanguageDirection,role:"application"},children:this}).render();let e=document.querySelector(".ck-body-wrapper");e||(e=(0,n.createElement)(document,"div",{class:"ck-body-wrapper"}),document.body.appendChild(e)),e.appendChild(this._bodyCollectionContainer)}detachFromDom(){super.destroy(),this._bodyCollectionContainer&&this._bodyCollectionContainer.remove();const e=document.querySelector(".ck-body-wrapper");e&&0==e.childElementCount&&e.remove()}}class le extends N{constructor(e){super(e),this.isToggleable=!0,this.toggleSwitchView=this._createToggleView(),this.extendTemplate({attributes:{class:"ck-switchbutton"}})}render(){super.render(),this.children.add(this.toggleSwitchView)}_createToggleView(){const e=new P;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),e}}class ce extends(ue(N)){}class de extends(ue(X)){}function ue(e){return class extends e{constructor(...e){super(...e),this.buttonView=this,this._fileInputView=new he(this.locale),this._fileInputView.bind("acceptedType").to(this),this._fileInputView.bind("allowMultipleFiles").to(this),this._fileInputView.delegate("done").to(this),this.on("execute",(()=>{this._fileInputView.open()})),this.extendTemplate({attributes:{class:"ck-file-dialog-button"}})}render(){super.render(),this.children.add(this._fileInputView)}}}class he extends P{constructor(e){super(e),this.set("acceptedType",void 0),this.set("allowMultipleFiles",!1);const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:t.to("acceptedType"),multiple:t.to("allowMultipleFiles")},on:{change:t.to((()=>{this.element&&this.element.files&&this.element.files.length&&this.fire("done",this.element.files),this.element.value=""}))}})}open(){this.element.click()}}const me='<svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"><path d="M.941 4.523a.75.75 0 1 1 1.06-1.06l3.006 3.005 3.005-3.005a.75.75 0 1 1 1.06 1.06l-3.549 3.55a.75.75 0 0 1-1.168-.136L.941 4.523z"/></svg>';class ge extends P{constructor(e,t){super(e);const i=this.bindTemplate;this.set("isCollapsed",!1),this.set("label",""),this.buttonView=this._createButtonView(),this.children=this.createCollection(),this.set("_collapsibleAriaLabelUid",void 0),t&&this.children.addMany(t),this.setTemplate({tag:"div",attributes:{class:["ck","ck-collapsible",i.if("isCollapsed","ck-collapsible_collapsed")]},children:[this.buttonView,{tag:"div",attributes:{class:["ck","ck-collapsible__children"],role:"region",hidden:i.if("isCollapsed","hidden"),"aria-labelledby":i.to("_collapsibleAriaLabelUid")},children:this.children}]})}render(){super.render(),this._collapsibleAriaLabelUid=this.buttonView.labelView.element.id}focus(){this.buttonView.focus()}_createButtonView(){const e=new N(this.locale),t=e.bindTemplate;return e.set({withText:!0,icon:me}),e.extendTemplate({attributes:{"aria-expanded":t.to("isOn",(e=>String(e)))}}),e.bind("label").to(this),e.bind("isOn").to(this,"isCollapsed",(e=>!e)),e.on("execute",(()=>{this.isCollapsed=!this.isCollapsed})),e}}function fe(e,t){const i=e.t,n={Black:i("Black"),"Dim grey":i("Dim grey"),Grey:i("Grey"),"Light grey":i("Light grey"),White:i("White"),Red:i("Red"),Orange:i("Orange"),Yellow:i("Yellow"),"Light green":i("Light green"),Green:i("Green"),Aquamarine:i("Aquamarine"),Turquoise:i("Turquoise"),"Light blue":i("Light blue"),Blue:i("Blue"),Purple:i("Purple")};return t.map((e=>{const t=n[e.label];return t&&t!=e.label&&(e.label=t),e}))}function pe(e){return e.map(be).filter((e=>!!e))}function be(e){return"string"==typeof e?{model:e,label:e,hasBorder:!1,view:{name:"span",styles:{color:e}}}:{model:e.color,label:e.label||e.color,hasBorder:void 0!==e.hasBorder&&e.hasBorder,view:{name:"span",styles:{color:`${e.color}`}}}}class we extends N{constructor(e){super(e);const t=this.bindTemplate;this.set("color",void 0),this.set("hasBorder",!1),this.icon='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path class="ck-icon__fill" d="M16.935 5.328a2 2 0 0 1 0 2.829l-7.778 7.778a2 2 0 0 1-2.829 0L3.5 13.107a1.999 1.999 0 1 1 2.828-2.829l.707.707a1 1 0 0 0 1.414 0l5.658-5.657a2 2 0 0 1 2.828 0z"/><path d="M14.814 6.035 8.448 12.4a1 1 0 0 1-1.414 0l-1.413-1.415A1 1 0 1 0 4.207 12.4l2.829 2.829a1 1 0 0 0 1.414 0l7.778-7.778a1 1 0 1 0-1.414-1.415z"/></svg>',this.extendTemplate({attributes:{style:{backgroundColor:t.to("color",(e=>n.env.isMediaForcedColors?null:e))},class:["ck","ck-color-grid__tile",t.if("hasBorder","ck-color-selector__color-tile_bordered")]}})}render(){super.render(),this.iconView.fillColor="hsl(0, 0%, 100%)"}}class ve extends P{constructor(e,t){super(e);const i=t&&t.colorDefinitions?t.colorDefinitions:[];this.columns=t&&t.columns?t.columns:5;const o={gridTemplateColumns:`repeat( ${this.columns}, 1fr)`};this.set("selectedColor",void 0),this.items=this.createCollection(),this.focusTracker=new n.FocusTracker,this.keystrokes=new n.KeystrokeHandler,this.items.on("add",((e,t)=>{t.isOn=t.color===this.selectedColor})),i.forEach((e=>{const t=new we;t.set({color:e.color,label:e.label,tooltip:!0,hasBorder:e.options.hasBorder}),t.on("execute",(()=>{this.fire("execute",{value:e.color,hasBorder:e.options.hasBorder,label:e.label})})),this.items.add(t)})),this.setTemplate({tag:"div",children:this.items,attributes:{class:["ck","ck-color-grid"],style:o}}),this.on("change:selectedColor",((e,t,i)=>{for(const e of this.items)e.isOn=e.color===i}))}focus(){this.items.length&&this.items.first.focus()}focusLast(){this.items.length&&this.items.last.focus()}render(){super.render();for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",((e,t)=>{this.focusTracker.add(t.element)})),this.items.on("remove",((e,t)=>{this.focusTracker.remove(t.element)})),this.keystrokes.listenTo(this.element),B({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:this.columns,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}}var _e=i(8156);const ye=function(e){var t,i,n=[],o=1;if("string"==typeof e)if(_e[e])n=_e[e].slice(),i="rgb";else if("transparent"===e)o=0,i="rgb",n=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(e)){var s=e.slice(1);o=1,(l=s.length)<=4?(n=[parseInt(s[0]+s[0],16),parseInt(s[1]+s[1],16),parseInt(s[2]+s[2],16)],4===l&&(o=parseInt(s[3]+s[3],16)/255)):(n=[parseInt(s[0]+s[1],16),parseInt(s[2]+s[3],16),parseInt(s[4]+s[5],16)],8===l&&(o=parseInt(s[6]+s[7],16)/255)),n[0]||(n[0]=0),n[1]||(n[1]=0),n[2]||(n[2]=0),i="rgb"}else if(t=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(e)){var r=t[1],a="rgb"===r;i=s=r.replace(/a$/,"");var l="cmyk"===s?4:"gray"===s?1:3;n=t[2].trim().split(/\s*[,\/]\s*|\s+/).map((function(e,t){if(/%$/.test(e))return t===l?parseFloat(e)/100:"rgb"===s?255*parseFloat(e)/100:parseFloat(e);if("h"===s[t]){if(/deg$/.test(e))return parseFloat(e);if(void 0!==ke[e])return ke[e]}return parseFloat(e)})),r===s&&n.push(1),o=a||void 0===n[l]?1:n[l],n=n.slice(0,l)}else e.length>10&&/[0-9](?:\s|\/)/.test(e)&&(n=e.match(/([0-9]+)/g).map((function(e){return parseFloat(e)})),i=e.match(/([a-z])/gi).join("").toLowerCase());else isNaN(e)?Array.isArray(e)||e.length?(n=[e[0],e[1],e[2]],i="rgb",o=4===e.length?e[3]:1):e instanceof Object&&(null!=e.r||null!=e.red||null!=e.R?(i="rgb",n=[e.r||e.red||e.R||0,e.g||e.green||e.G||0,e.b||e.blue||e.B||0]):(i="hsl",n=[e.h||e.hue||e.H||0,e.s||e.saturation||e.S||0,e.l||e.lightness||e.L||e.b||e.brightness]),o=e.a||e.alpha||e.opacity||1,null!=e.opacity&&(o/=100)):(i="rgb",n=[e>>>16,(65280&e)>>>8,255&e]);return{space:i,values:n,alpha:o}};var ke={red:0,orange:60,yellow:120,green:180,blue:240,purple:300},Ce=i(734),Ae=i.t(Ce,2);function Ee(e,t){if(!e)return"";const i=xe(e);if(!i)return"";if(i.space===t)return e;if(n=i,!Object.keys(Ae).includes(n.space))return"";var n;const o=Ae[i.space][t];return o?function(e,t){switch(t){case"hex":return`#${e}`;case"rgb":return`rgb( ${e[0]}, ${e[1]}, ${e[2]} )`;case"hsl":return`hsl( ${e[0]}, ${e[1]}%, ${e[2]}% )`;case"hwb":return`hwb( ${e[0]}, ${e[1]}, ${e[2]} )`;case"lab":return`lab( ${e[0]}% ${e[1]} ${e[2]} )`;case"lch":return`lch( ${e[0]}% ${e[1]} ${e[2]} )`;default:return""}}(o("hex"===i.space?i.hexValue:i.values),t):""}function xe(e){if(e.startsWith("#")){const t=ye(e);return{space:"hex",values:t.values,hexValue:e,alpha:t.alpha}}const t=ye(e);return t.space?t:null}var Te=i(2223);class Pe extends P{constructor(e,t){super(e);const i=`ck-labeled-field-view-${(0,n.uid)()}`,o=`ck-labeled-field-view-status-${(0,n.uid)()}`;this.fieldView=t(this,i,o),this.set("label",void 0),this.set("isEnabled",!0),this.set("isEmpty",!0),this.set("isFocused",!1),this.set("errorText",null),this.set("infoText",null),this.set("class",void 0),this.set("placeholder",void 0),this.labelView=this._createLabelView(i),this.statusView=this._createStatusView(o),this.fieldWrapperChildren=this.createCollection([this.fieldView,this.labelView]),this.bind("_statusText").to(this,"errorText",this,"infoText",((e,t)=>e||t));const s=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view",s.to("class"),s.if("isEnabled","ck-disabled",(e=>!e)),s.if("isEmpty","ck-labeled-field-view_empty"),s.if("isFocused","ck-labeled-field-view_focused"),s.if("placeholder","ck-labeled-field-view_placeholder"),s.if("errorText","ck-error")]},children:[{tag:"div",attributes:{class:["ck","ck-labeled-field-view__input-wrapper"]},children:this.fieldWrapperChildren},this.statusView]})}_createLabelView(e){const t=new ie(this.locale);return t.for=e,t.bind("text").to(this,"label"),t}_createStatusView(e){const t=new P(this.locale),i=this.bindTemplate;return t.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view__status",i.if("errorText","ck-labeled-field-view__status_error"),i.if("_statusText","ck-hidden",(e=>!e))],id:e,role:i.if("errorText","alert")},children:[{text:i.to("_statusText")}]}),t}focus(e){this.fieldView.focus(e)}}class Ie extends P{constructor(e){super(e),this.set("value",void 0),this.set("id",void 0),this.set("placeholder",void 0),this.set("tabIndex",void 0),this.set("isReadOnly",!1),this.set("hasError",!1),this.set("ariaDescribedById",void 0),this.set("ariaLabel",void 0),this.focusTracker=new n.FocusTracker,this.bind("isFocused").to(this.focusTracker),this.set("isEmpty",!0);const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck","ck-input",t.if("isFocused","ck-input_focused"),t.if("isEmpty","ck-input-text_empty"),t.if("hasError","ck-error")],id:t.to("id"),placeholder:t.to("placeholder"),tabindex:t.to("tabIndex"),readonly:t.to("isReadOnly"),"aria-invalid":t.if("hasError",!0),"aria-describedby":t.to("ariaDescribedById"),"aria-label":t.to("ariaLabel")},on:{input:t.to(((...e)=>{this.fire("input",...e),this._updateIsEmpty()})),change:t.to(this._updateIsEmpty.bind(this))}})}render(){super.render(),this.focusTracker.add(this.element),this._setDomElementValue(this.value),this._updateIsEmpty(),this.on("change:value",((e,t,i)=>{this._setDomElementValue(i),this._updateIsEmpty()}))}destroy(){super.destroy(),this.focusTracker.destroy()}select(){this.element.select()}focus(){this.element.focus()}reset(){this.value=this.element.value="",this._updateIsEmpty()}_updateIsEmpty(){this.isEmpty=!this.element.value}_setDomElementValue(e){this.element.value=e||0===e?e:""}}class Se extends Ie{constructor(e){super(e),this.set("inputMode","text");const t=this.bindTemplate;this.extendTemplate({attributes:{inputmode:t.to("inputMode")}})}}class Ve extends Se{constructor(e){super(e),this.extendTemplate({attributes:{type:"text",class:["ck-input-text"]}})}}class Re extends Se{constructor(e,{min:t,max:i,step:n}={}){super(e);const o=this.bindTemplate;this.set("min",t),this.set("max",i),this.set("step",n),this.extendTemplate({attributes:{type:"number",class:["ck-input-number"],min:o.to("min"),max:o.to("max"),step:o.to("step")}})}}class Be extends Ie{constructor(e){super(e),this._isUpdateAutoGrowHeightPending=!1;const t=(0,n.toUnit)("px");this.set("minRows",2),this.set("maxRows",5),this.set("_height",null),this.set("resize","none"),this._resizeObserver=null,this.on("change:minRows",this._validateMinMaxRows.bind(this)),this.on("change:maxRows",this._validateMinMaxRows.bind(this));const i=this.bindTemplate;this.template.tag="textarea",this.extendTemplate({attributes:{class:["ck-textarea"],style:{height:i.to("_height",(e=>e?t(e):null)),resize:i.to("resize")},rows:i.to("minRows")}})}render(){super.render();let e=!1;this.on("input",(()=>{this._updateAutoGrowHeight(!0),this.fire("update")})),this.on("change:value",(()=>{n.global.window.requestAnimationFrame((()=>{(0,n.isVisible)(this.element)?(this._updateAutoGrowHeight(),this.fire("update")):this._isUpdateAutoGrowHeightPending=!0}))})),this._resizeObserver=new n.ResizeObserver(this.element,(t=>{const i=!!t.contentRect.width&&!!t.contentRect.height;!e&&i&&this._isUpdateAutoGrowHeightPending&&n.global.window.requestAnimationFrame((()=>{this._updateAutoGrowHeight(),this.fire("update")})),e=i}))}destroy(){this._resizeObserver&&this._resizeObserver.destroy()}reset(){super.reset(),this._updateAutoGrowHeight(),this.fire("update")}_updateAutoGrowHeight(e){const t=this.element;if(!t.offsetParent)return void(this._isUpdateAutoGrowHeightPending=!0);this._isUpdateAutoGrowHeightPending=!1;const i=Me(t,"1"),o=Me(t,t.value),s=i.ownerDocument.defaultView.getComputedStyle(i),r=parseFloat(s.paddingTop)+parseFloat(s.paddingBottom),a=(0,n.getBorderWidths)(i),l=parseFloat(s.lineHeight),c=a.top+a.bottom,d=new n.Rect(i).height,u=Math.round((o.scrollHeight-r)/l),h=this.maxRows*l+r+c,m=1===u?d:this.minRows*l+r+c;this._height=Math.min(Math.max(Math.max(u,this.minRows)*l+r+c,m),h),e&&(t.scrollTop=t.scrollHeight),i.remove(),o.remove()}_validateMinMaxRows(){if(this.minRows>this.maxRows)throw new n.CKEditorError("ui-textarea-view-min-rows-greater-than-max-rows",{textareaView:this,minRows:this.minRows,maxRows:this.maxRows})}}function Me(e,t){const i=e.cloneNode();return i.style.position="absolute",i.style.top="-99999px",i.style.left="-99999px",i.style.height="auto",i.style.overflow="hidden",i.style.width=e.ownerDocument.defaultView.getComputedStyle(e).width,i.tabIndex=-1,i.rows=1,i.value=t,e.parentNode.insertBefore(i,e),i}class Oe extends P{constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!1),this.set("position","se"),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-dropdown__panel",t.to("position",(e=>`ck-dropdown__panel_${e}`)),t.if("isVisible","ck-dropdown__panel-visible")],tabindex:"-1"},children:this.children,on:{selectstart:t.to((e=>{"input"!==e.target.tagName.toLocaleLowerCase()&&e.preventDefault()}))}})}focus(){if(this.children.length){const e=this.children.first;"function"==typeof e.focus?e.focus():(0,n.logWarning)("ui-dropdown-panel-focus-child-missing-focus",{childView:this.children.first,dropdownPanel:this})}}focusLast(){if(this.children.length){const e=this.children.last;"function"==typeof e.focusLast?e.focusLast():e.focus()}}}class Le extends P{constructor(e,t,i){super(e);const o=this.bindTemplate;this.buttonView=t,this.panelView=i,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("class",void 0),this.set("id",void 0),this.set("panelPosition","auto"),this.panelView.bind("isVisible").to(this,"isOpen"),this.keystrokes=new n.KeystrokeHandler,this.focusTracker=new n.FocusTracker,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",o.to("class"),o.if("isEnabled","ck-disabled",(e=>!e))],id:o.to("id"),"aria-describedby":o.to("ariaDescribedById")},children:[t,i]}),t.extendTemplate({attributes:{class:["ck-dropdown__button"],"data-cke-tooltip-disabled":o.to("isOpen")}})}render(){super.render(),this.focusTracker.add(this.buttonView.element),this.focusTracker.add(this.panelView.element),this.listenTo(this.buttonView,"open",(()=>{this.isOpen=!this.isOpen})),this.on("change:isOpen",((e,t,i)=>{if(i)if("auto"===this.panelPosition){const e=Le._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions});this.panelView.position=e?e.name:this._panelPositions[0].name}else this.panelView.position=this.panelPosition})),this.keystrokes.listenTo(this.element);const e=(e,t)=>{this.isOpen&&(this.isOpen=!1,t())};this.keystrokes.set("arrowdown",((e,t)=>{this.buttonView.isEnabled&&!this.isOpen&&(this.isOpen=!0,t())})),this.keystrokes.set("arrowright",((e,t)=>{this.isOpen&&t()})),this.keystrokes.set("arrowleft",e),this.keystrokes.set("esc",e)}focus(){this.buttonView.focus()}get _panelPositions(){const{south:e,north:t,southEast:i,southWest:n,northEast:o,northWest:s,southMiddleEast:r,southMiddleWest:a,northMiddleEast:l,northMiddleWest:c}=Le.defaultPanelPositions;return"rtl"!==this.locale.uiLanguageDirection?[i,n,r,a,e,o,s,l,c,t]:[n,i,a,r,e,s,o,c,l,t]}}Le.defaultPanelPositions={south:(e,t)=>({top:e.bottom,left:e.left-(t.width-e.width)/2,name:"s"}),southEast:e=>({top:e.bottom,left:e.left,name:"se"}),southWest:(e,t)=>({top:e.bottom,left:e.left-t.width+e.width,name:"sw"}),southMiddleEast:(e,t)=>({top:e.bottom,left:e.left-(t.width-e.width)/4,name:"sme"}),southMiddleWest:(e,t)=>({top:e.bottom,left:e.left-3*(t.width-e.width)/4,name:"smw"}),north:(e,t)=>({top:e.top-t.height,left:e.left-(t.width-e.width)/2,name:"n"}),northEast:(e,t)=>({top:e.top-t.height,left:e.left,name:"ne"}),northWest:(e,t)=>({top:e.top-t.height,left:e.left-t.width+e.width,name:"nw"}),northMiddleEast:(e,t)=>({top:e.top-t.height,left:e.left-(t.width-e.width)/4,name:"nme"}),northMiddleWest:(e,t)=>({top:e.top-t.height,left:e.left-3*(t.width-e.width)/4,name:"nmw"})},Le._getOptimalPosition=n.getOptimalPosition;const Fe=Le;class Ne extends N{constructor(e){super(e),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{"aria-haspopup":!0,"aria-expanded":this.bindTemplate.to("isOn",(e=>String(e)))}}),this.delegate("execute").to(this,"open")}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new L;return e.content=me,e.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),e}}class De extends P{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}})}}class ze extends P{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__line-break"]}})}}function We(e){if(Array.isArray(e))return{items:e,removeItems:[]};const t={items:[],removeItems:[]};return e?{...t,...e}:t}const He=(()=>({alignLeft:M.icons.alignLeft,bold:M.icons.bold,importExport:M.icons.importExport,paragraph:M.icons.paragraph,plus:M.icons.plus,text:M.icons.text,threeVerticalDots:M.icons.threeVerticalDots,pilcrow:M.icons.pilcrow,dragIndicator:M.icons.dragIndicator}))();class Ue extends P{constructor(e,t){super(e);const i=this.bindTemplate,o=this.t;this.options=t||{},this.set("ariaLabel",o("Editor toolbar")),this.set("maxWidth","auto"),this.items=this.createCollection(),this.focusTracker=new n.FocusTracker,this.keystrokes=new n.KeystrokeHandler,this.set("class",void 0),this.set("isCompact",!1),this.itemsView=new $e(e),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection();const s="rtl"===e.uiLanguageDirection;this._focusCycler=new W({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:[s?"arrowright":"arrowleft","arrowup"],focusNext:[s?"arrowleft":"arrowright","arrowdown"]}});const r=["ck","ck-toolbar",i.to("class"),i.if("isCompact","ck-toolbar_compact")];var a;this.options.shouldGroupWhenFull&&this.options.isFloating&&r.push("ck-toolbar_floating"),this.setTemplate({tag:"div",attributes:{class:r,role:"toolbar","aria-label":i.to("ariaLabel"),style:{maxWidth:i.to("maxWidth")},tabindex:-1},children:this.children,on:{mousedown:(a=this,a.bindTemplate.to((e=>{e.target===a.element&&e.preventDefault()})))}}),this._behavior=this.options.shouldGroupWhenFull?new qe(this):new je(this)}render(){super.render(),this.focusTracker.add(this.element);for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",((e,t)=>{this.focusTracker.add(t.element)})),this.items.on("remove",((e,t)=>{this.focusTracker.remove(t.element)})),this.keystrokes.listenTo(this.element),this._behavior.render(this)}destroy(){return this._behavior.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy(),super.destroy()}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}fillFromConfig(e,t,i){this.items.addMany(this._buildItemsFromConfig(e,t,i))}_buildItemsFromConfig(e,t,i){const n=We(e),o=i||n.removeItems;return this._cleanItemsConfiguration(n.items,t,o).map((e=>(0,r.A)(e)?this._createNestedToolbarDropdown(e,t,o):"|"===e?new De:"-"===e?new ze:t.create(e))).filter((e=>!!e))}_cleanItemsConfiguration(e,t,i){const o=e.filter(((e,o,s)=>"|"===e||-1===i.indexOf(e)&&("-"===e?!this.options.shouldGroupWhenFull||((0,n.logWarning)("toolbarview-line-break-ignored-when-grouping-items",s),!1):!(!(0,r.A)(e)&&!t.has(e)&&((0,n.logWarning)("toolbarview-item-unavailable",{item:e}),1)))));return this._cleanSeparatorsAndLineBreaks(o)}_cleanSeparatorsAndLineBreaks(e){const t=e=>"-"!==e&&"|"!==e,i=e.length,n=e.findIndex(t);if(-1===n)return[];const o=i-e.slice().reverse().findIndex(t);return e.slice(n,o).filter(((e,i,n)=>!!t(e)||!(i>0&&n[i-1]===e)))}_createNestedToolbarDropdown(e,t,i){let{label:o,icon:s,items:r,tooltip:a=!0,withText:l=!1}=e;if(r=this._cleanItemsConfiguration(r,t,i),!r.length)return null;const c=Ye(this.locale);return o||(0,n.logWarning)("toolbarview-nested-toolbar-dropdown-missing-label",e),c.class="ck-toolbar__nested-toolbar-dropdown",c.buttonView.set({label:o,tooltip:a,withText:!!l}),!1!==s?c.buttonView.icon=He[s]||s||M.icons.threeVerticalDots:c.buttonView.withText=!0,Xe(c,(()=>c.toolbarView._buildItemsFromConfig(r,t,i))),c}}class $e extends P{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children})}}class je{constructor(e){const t=e.bindTemplate;e.set("isVertical",!1),e.itemsView.children.bindTo(e.items).using((e=>e)),e.focusables.bindTo(e.items).using((e=>U(e)?e:null)),e.extendTemplate({attributes:{class:[t.if("isVertical","ck-toolbar_vertical")]}})}render(){}destroy(){}}class qe{constructor(e){this.resizeObserver=null,this.cachedPadding=null,this.shouldUpdateGroupingOnNextResize=!1,this.view=e,this.viewChildren=e.children,this.viewFocusables=e.focusables,this.viewItemsView=e.itemsView,this.viewFocusTracker=e.focusTracker,this.viewLocale=e.locale,this.ungroupedItems=e.createCollection(),this.groupedItems=e.createCollection(),this.groupedItemsDropdown=this._createGroupedItemsDropdown(),e.itemsView.children.bindTo(this.ungroupedItems).using((e=>e)),this.ungroupedItems.on("change",this._updateFocusCyclableItems.bind(this)),e.children.on("change",this._updateFocusCyclableItems.bind(this)),e.items.on("change",((e,t)=>{const i=t.index,n=Array.from(t.added);for(const e of t.removed)i>=this.ungroupedItems.length?this.groupedItems.remove(e):this.ungroupedItems.remove(e);for(let e=i;e<i+n.length;e++){const t=n[e-i];e>this.ungroupedItems.length?this.groupedItems.add(t,e-this.ungroupedItems.length):this.ungroupedItems.add(t,e)}this._updateGrouping()})),e.extendTemplate({attributes:{class:["ck-toolbar_grouping"]}})}render(e){this.viewElement=e.element,this._enableGroupingOnResize(),this._enableGroupingOnMaxWidthChange(e)}destroy(){this.groupedItemsDropdown.destroy(),this.resizeObserver.destroy()}_updateGrouping(){if(!this.viewElement.ownerDocument.body.contains(this.viewElement))return;if(!(0,n.isVisible)(this.viewElement))return void(this.shouldUpdateGroupingOnNextResize=!0);const e=this.groupedItems.length;let t;for(;this._areItemsOverflowing;)this._groupLastItem(),t=!0;if(!t&&this.groupedItems.length){for(;this.groupedItems.length&&!this._areItemsOverflowing;)this._ungroupFirstItem();this._areItemsOverflowing&&this._groupLastItem()}this.groupedItems.length!==e&&this.view.fire("groupedItemsUpdate")}get _areItemsOverflowing(){if(!this.ungroupedItems.length)return!1;const e=this.viewElement,t=this.viewLocale.uiLanguageDirection,i=new n.Rect(e.lastChild),o=new n.Rect(e);if(!this.cachedPadding){const i=n.global.window.getComputedStyle(e),o="ltr"===t?"paddingRight":"paddingLeft";this.cachedPadding=Number.parseInt(i[o])}return"ltr"===t?i.right>o.right-this.cachedPadding:i.left<o.left+this.cachedPadding}_enableGroupingOnResize(){let e;this.resizeObserver=new n.ResizeObserver(this.viewElement,(t=>{e&&e===t.contentRect.width&&!this.shouldUpdateGroupingOnNextResize||(this.shouldUpdateGroupingOnNextResize=!1,this._updateGrouping(),e=t.contentRect.width)})),this._updateGrouping()}_enableGroupingOnMaxWidthChange(e){e.on("change:maxWidth",(()=>{this._updateGrouping()}))}_groupLastItem(){this.groupedItems.length||(this.viewChildren.add(new De),this.viewChildren.add(this.groupedItemsDropdown),this.viewFocusTracker.add(this.groupedItemsDropdown.element)),this.groupedItems.add(this.ungroupedItems.remove(this.ungroupedItems.last),0)}_ungroupFirstItem(){this.ungroupedItems.add(this.groupedItems.remove(this.groupedItems.first)),this.groupedItems.length||(this.viewChildren.remove(this.groupedItemsDropdown),this.viewChildren.remove(this.viewChildren.last),this.viewFocusTracker.remove(this.groupedItemsDropdown.element))}_createGroupedItemsDropdown(){const e=this.viewLocale,t=e.t,i=Ye(e);return i.class="ck-toolbar__grouped-dropdown",i.panelPosition="ltr"===e.uiLanguageDirection?"sw":"se",Xe(i,this.groupedItems),i.buttonView.set({label:t("Show more items"),tooltip:!0,tooltipPosition:"rtl"===e.uiLanguageDirection?"se":"sw",icon:M.icons.threeVerticalDots}),i}_updateFocusCyclableItems(){this.viewFocusables.clear(),this.ungroupedItems.map((e=>{U(e)&&this.viewFocusables.add(e)})),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}}class Ke extends P{constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!0),this.children=this.createCollection(),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__item",t.if("isVisible","ck-hidden",(e=>!e))],role:"presentation"},children:this.children})}focus(){this.children.first&&this.children.first.focus()}}class Ge extends P{constructor(e){super(e),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}})}}class Ze extends P{constructor(e,t=new ie){super(e);const i=this.bindTemplate,n=new Je(e);this.set({label:"",isVisible:!0}),this.labelView=t,this.labelView.bind("text").to(this,"label"),this.children=this.createCollection(),this.children.addMany([this.labelView,n]),n.set({role:"group",ariaLabelledBy:t.id}),n.focusTracker.destroy(),n.keystrokes.destroy(),this.items=n.items,this.setTemplate({tag:"li",attributes:{role:"presentation",class:["ck","ck-list__group",i.if("isVisible","ck-hidden",(e=>!e))]},children:this.children})}focus(){if(this.items){const e=this.items.find((e=>!(e instanceof Ge)));e&&e.focus()}}}class Je extends P{constructor(e){super(e),this._listItemGroupToChangeListeners=new WeakMap;const t=this.bindTemplate;this.focusables=new o,this.items=this.createCollection(),this.focusTracker=new n.FocusTracker,this.keystrokes=new n.KeystrokeHandler,this._focusCycler=new W({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowup",focusNext:"arrowdown"}}),this.set("ariaLabel",void 0),this.set("ariaLabelledBy",void 0),this.set("role",void 0),this.setTemplate({tag:"ul",attributes:{class:["ck","ck-reset","ck-list"],role:t.to("role"),"aria-label":t.to("ariaLabel"),"aria-labelledby":t.to("ariaLabelledBy")},children:this.items})}render(){super.render();for(const e of this.items)e instanceof Ze?this._registerFocusableItemsGroup(e):e instanceof Ke&&this._registerFocusableListItem(e);this.items.on("change",((e,t)=>{for(const e of t.removed)e instanceof Ze?this._deregisterFocusableItemsGroup(e):e instanceof Ke&&this._deregisterFocusableListItem(e);for(const e of Array.from(t.added).reverse())e instanceof Ze?this._registerFocusableItemsGroup(e,t.index):this._registerFocusableListItem(e,t.index)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}focusFirst(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}_registerFocusableListItem(e,t){this.focusTracker.add(e.element),this.focusables.add(e,t)}_deregisterFocusableListItem(e){this.focusTracker.remove(e.element),this.focusables.remove(e)}_getOnGroupItemsChangeCallback(e){return(t,i)=>{for(const e of i.removed)this._deregisterFocusableListItem(e);for(const t of Array.from(i.added).reverse())this._registerFocusableListItem(t,this.items.getIndex(e)+i.index)}}_registerFocusableItemsGroup(e,t){Array.from(e.items).forEach(((e,i)=>{const n=void 0!==t?t+i:void 0;this._registerFocusableListItem(e,n)}));const i=this._getOnGroupItemsChangeCallback(e);this._listItemGroupToChangeListeners.set(e,i),e.items.on("change",i)}_deregisterFocusableItemsGroup(e){for(const t of e.items)this._deregisterFocusableListItem(t);e.items.off("change",this._listItemGroupToChangeListeners.get(e)),this._listItemGroupToChangeListeners.delete(e)}}class Qe extends P{constructor(e,t){super(e);const i=this.bindTemplate;this.set("class",void 0),this.set("labelStyle",void 0),this.set("icon",void 0),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isToggleable",!1),this.set("isVisible",!0),this.set("keystroke",void 0),this.set("withKeystroke",!1),this.set("label",void 0),this.set("tabindex",-1),this.set("tooltip",!1),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.children=this.createCollection(),this.actionView=this._createActionView(t),this.arrowView=this._createArrowView(),this.keystrokes=new n.KeystrokeHandler,this.focusTracker=new n.FocusTracker,this.setTemplate({tag:"div",attributes:{class:["ck","ck-splitbutton",i.to("class"),i.if("isVisible","ck-hidden",(e=>!e)),this.arrowView.bindTemplate.if("isOn","ck-splitbutton_open")]},children:this.children})}render(){super.render(),this.children.add(this.actionView),this.children.add(this.arrowView),this.focusTracker.add(this.actionView.element),this.focusTracker.add(this.arrowView.element),this.keystrokes.listenTo(this.element),this.keystrokes.set("arrowright",((e,t)=>{this.focusTracker.focusedElement===this.actionView.element&&(this.arrowView.focus(),t())})),this.keystrokes.set("arrowleft",((e,t)=>{this.focusTracker.focusedElement===this.arrowView.element&&(this.actionView.focus(),t())}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.actionView.focus()}_createActionView(e){const t=e||new N;return e||t.bind("icon","isEnabled","isOn","isToggleable","keystroke","label","tabindex","tooltip","tooltipPosition","type","withText").to(this),t.extendTemplate({attributes:{class:"ck-splitbutton__action"}}),t.delegate("execute").to(this),t}_createArrowView(){const e=new N,t=e.bindTemplate;return e.icon=me,e.extendTemplate({attributes:{class:["ck-splitbutton__arrow"],"data-cke-tooltip-disabled":t.to("isOn"),"aria-haspopup":!0,"aria-expanded":t.to("isOn",(e=>String(e)))}}),e.bind("isEnabled").to(this),e.bind("label").to(this),e.bind("tooltip").to(this),e.delegate("execute").to(this,"open"),e}}function Ye(e,t=Ne){const i="function"==typeof t?new t(e):t,o=new Oe(e),s=new Fe(e,i,o);return i.bind("isEnabled").to(s),i instanceof Qe?i.arrowView.bind("isOn").to(s,"isOpen"):i.bind("isOn").to(s,"isOpen"),function(e){(function(e){e.on("render",(()=>{I({emitter:e,activator:()=>e.isOpen,callback:()=>{e.isOpen=!1},contextElements:()=>[e.element,...e.focusTracker._elements]})}))})(e),function(e){e.on("execute",(t=>{t.source instanceof le||(e.isOpen=!1)}))}(e),function(e){e.focusTracker.on("change:isFocused",((t,i,n)=>{e.isOpen&&!n&&(e.isOpen=!1)}))}(e),function(e){e.keystrokes.set("arrowdown",((t,i)=>{e.isOpen&&(e.panelView.focus(),i())})),e.keystrokes.set("arrowup",((t,i)=>{e.isOpen&&(e.panelView.focusLast(),i())}))}(e),function(e){e.on("change:isOpen",((t,i,o)=>{if(o)return;const s=e.panelView.element;s&&s.contains(n.global.document.activeElement)&&e.buttonView.focus()}))}(e),function(e){e.on("change:isOpen",((t,i,n)=>{n&&e.panelView.focus()}),{priority:"low"})}(e)}(s),s}function Xe(e,t,i={}){e.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),e.isOpen?et(e,t,i):e.once("change:isOpen",(()=>et(e,t,i)),{priority:"highest"}),i.enableActiveItemFocusOnDropdownOpen&&nt(e,(()=>e.toolbarView.items.find((e=>e.isOn))))}function et(e,t,i){const n=e.locale,s=n.t,r=e.toolbarView=new Ue(n),a="function"==typeof t?t():t;r.ariaLabel=i.ariaLabel||s("Dropdown toolbar"),i.maxWidth&&(r.maxWidth=i.maxWidth),i.class&&(r.class=i.class),i.isCompact&&(r.isCompact=i.isCompact),i.isVertical&&(r.isVertical=!0),a instanceof o?r.items.bindTo(a).using((e=>e)):r.items.addMany(a),e.panelView.children.add(r),r.items.delegate("execute").to(e)}function tt(e,t,i={}){e.isOpen?it(e,t,i):e.once("change:isOpen",(()=>it(e,t,i)),{priority:"highest"}),nt(e,(()=>e.listView.items.find((e=>e instanceof Ke&&e.children.first.isOn))))}function it(e,t,i){const n=e.locale,o=e.listView=new Je(n),s="function"==typeof t?t():t;o.ariaLabel=i.ariaLabel,o.role=i.role,ot(e,o.items,s,n),e.panelView.children.add(o),o.items.delegate("execute").to(e)}function nt(e,t){e.on("change:isOpen",(()=>{if(!e.isOpen)return;const i=t();i&&("function"==typeof i.focus?i.focus():(0,n.logWarning)("ui-dropdown-focus-child-on-open-child-missing-focus",{view:i}))}),{priority:n.priorities.low-10})}function ot(e,t,i,n){t.on("change",(()=>{const e=[...t].reduce(((e,t)=>(t instanceof Ke&&t.children.first instanceof X&&e.push(t.children.first),e)),[]),i=e.some((e=>e.isToggleable));e.forEach((e=>{e.hasCheckSpace=i}))})),t.bindTo(i).using((t=>{if("separator"===t.type)return new Ge(n);if("group"===t.type){const i=new Ze(n);return i.set({label:t.label}),ot(e,i.items,t.items,n),i.items.delegate("execute").to(e),i}if("button"===t.type||"switchbutton"===t.type){const e="menuitemcheckbox"===t.model.role||"menuitemradio"===t.model.role,i=new Ke(n);let o;return"button"===t.type?(o=new X(n),o.set({isToggleable:e})):o=new le(n),o.bind(...Object.keys(t.model)).to(t.model),o.delegate("execute").to(i),i.children.add(o),i}return null}))}const st=(e,t,i)=>{const n=new Ve(e.locale);return n.set({id:t,ariaDescribedById:i}),n.bind("isReadOnly").to(e,"isEnabled",(e=>!e)),n.bind("hasError").to(e,"errorText",(e=>!!e)),n.on("input",(()=>{e.errorText=null})),e.bind("isEmpty","isFocused","placeholder").to(n),n},rt=(e,t,i)=>{const n=new Re(e.locale);return n.set({id:t,ariaDescribedById:i,inputMode:"numeric"}),n.bind("isReadOnly").to(e,"isEnabled",(e=>!e)),n.bind("hasError").to(e,"errorText",(e=>!!e)),n.on("input",(()=>{e.errorText=null})),e.bind("isEmpty","isFocused","placeholder").to(n),n},at=(e,t,i)=>{const n=new Be(e.locale);return n.set({id:t,ariaDescribedById:i}),n.bind("isReadOnly").to(e,"isEnabled",(e=>!e)),n.bind("hasError").to(e,"errorText",(e=>!!e)),n.on("input",(()=>{e.errorText=null})),e.bind("isEmpty","isFocused","placeholder").to(n),n},lt=(e,t,i)=>{const n=Ye(e.locale);return n.set({id:t,ariaDescribedById:i}),n.bind("isEnabled").to(e),n},ct=(e,t=0,i=1)=>e>i?i:e<t?t:e,dt=(e,t=0,i=Math.pow(10,t))=>Math.round(i*e)/i,ut=(Math.PI,e=>("#"===e[0]&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?dt(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?dt(parseInt(e.substring(6,8),16)/255,2):1})),ht=e=>{const{h:t,s:i,l:n}=(({h:e,s:t,v:i,a:n})=>{const o=(200-t)*i/100;return{h:dt(e),s:dt(o>0&&o<200?t*i/100/(o<=100?o:200-o)*100:0),l:dt(o/2),a:dt(n,2)}})(e);return`hsl(${t}, ${i}%, ${n}%)`},mt=e=>{const t=e.toString(16);return t.length<2?"0"+t:t},gt=(e,t)=>{if(e===t)return!0;for(const i in e)if(e[i]!==t[i])return!1;return!0},ft={},pt=e=>{let t=ft[e];return t||(t=document.createElement("template"),t.innerHTML=e,ft[e]=t),t},bt=(e,t,i)=>{e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:i}))};let wt=!1;const vt=e=>"touches"in e,_t=(e,t)=>{const i=vt(t)?t.touches[0]:t,n=e.el.getBoundingClientRect();bt(e.el,"move",e.getMove({x:ct((i.pageX-(n.left+window.pageXOffset))/n.width),y:ct((i.pageY-(n.top+window.pageYOffset))/n.height)}))};class yt{constructor(e,t,i,n){const o=pt(`<div role="slider" tabindex="0" part="${t}" ${i}><div part="${t}-pointer"></div></div>`);e.appendChild(o.content.cloneNode(!0));const s=e.querySelector(`[part=${t}]`);s.addEventListener("mousedown",this),s.addEventListener("touchstart",this),s.addEventListener("keydown",this),this.el=s,this.xy=n,this.nodes=[s.firstChild,s]}set dragging(e){const t=e?document.addEventListener:document.removeEventListener;t(wt?"touchmove":"mousemove",this),t(wt?"touchend":"mouseup",this)}handleEvent(e){switch(e.type){case"mousedown":case"touchstart":if(e.preventDefault(),!(e=>!(wt&&!vt(e)||(wt||(wt=vt(e)),0)))(e)||!wt&&0!=e.button)return;this.el.focus(),_t(this,e),this.dragging=!0;break;case"mousemove":case"touchmove":e.preventDefault(),_t(this,e);break;case"mouseup":case"touchend":this.dragging=!1;break;case"keydown":((e,t)=>{const i=t.keyCode;i>40||e.xy&&i<37||i<33||(t.preventDefault(),bt(e.el,"move",e.getMove({x:39===i?.01:37===i?-.01:34===i?.05:33===i?-.05:35===i?1:36===i?-1:0,y:40===i?.01:38===i?-.01:0},!0)))})(this,e)}}style(e){e.forEach(((e,t)=>{for(const i in e)this.nodes[t].style.setProperty(i,e[i])}))}}class kt extends yt{constructor(e){super(e,"hue",'aria-label="Hue" aria-valuemin="0" aria-valuemax="360"',!1)}update({h:e}){this.h=e,this.style([{left:e/360*100+"%",color:ht({h:e,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuenow",`${dt(e)}`)}getMove(e,t){return{h:t?ct(this.h+360*e.x,0,360):360*e.x}}}class Ct extends yt{constructor(e){super(e,"saturation",'aria-label="Color"',!0)}update(e){this.hsva=e,this.style([{top:100-e.v+"%",left:`${e.s}%`,color:ht(e)},{"background-color":ht({h:e.h,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuetext",`Saturation ${dt(e.s)}%, Brightness ${dt(e.v)}%`)}getMove(e,t){return{s:t?ct(this.hsva.s+100*e.x,0,100):100*e.x,v:t?ct(this.hsva.v-100*e.y,0,100):Math.round(100-100*e.y)}}}const At=Symbol("same"),Et=Symbol("color"),xt=Symbol("hsva"),Tt=Symbol("update"),Pt=Symbol("parts"),It=Symbol("css"),St=Symbol("sliders");class Vt extends HTMLElement{static get observedAttributes(){return["color"]}get[It](){return[':host{display:flex;flex-direction:column;position:relative;width:200px;height:200px;user-select:none;-webkit-user-select:none;cursor:default}:host([hidden]){display:none!important}[role=slider]{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;outline:0}[role=slider]:last-child{border-radius:0 0 8px 8px}[part$=pointer]{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;display:flex;place-content:center center;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}[part$=pointer]::after{content:"";width:100%;height:100%;border-radius:inherit;background-color:currentColor}[role=slider]:focus [part$=pointer]{transform:translate(-50%,-50%) scale(1.1)}',"[part=hue]{flex:0 0 24px;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}[part=hue-pointer]{top:50%;z-index:2}","[part=saturation]{flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,rgba(255,255,255,0));box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}[part=saturation-pointer]{z-index:3}"]}get[St](){return[Ct,kt]}get color(){return this[Et]}set color(e){if(!this[At](e)){const t=this.colorModel.toHsva(e);this[Tt](t),this[Et]=e}}constructor(){super();const e=pt(`<style>${this[It].join("")}</style>`),t=this.attachShadow({mode:"open"});t.appendChild(e.content.cloneNode(!0)),t.addEventListener("move",this),this[Pt]=this[St].map((e=>new e(t)))}connectedCallback(){if(this.hasOwnProperty("color")){const e=this.color;delete this.color,this.color=e}else this.color||(this.color=this.colorModel.defaultColor)}attributeChangedCallback(e,t,i){const n=this.colorModel.fromAttr(i);this[At](n)||(this.color=n)}handleEvent(e){const t=this[xt],i={...t,...e.detail};let n;this[Tt](i),gt(i,t)||this[At](n=this.colorModel.fromHsva(i))||(this[Et]=n,bt(this,"color-changed",{value:n}))}[At](e){return this.color&&this.colorModel.equal(e,this.color)}[Tt](e){this[xt]=e,this[Pt].forEach((t=>t.update(e)))}}const Rt={defaultColor:"#000",toHsva:e=>(({r:e,g:t,b:i,a:n})=>{const o=Math.max(e,t,i),s=o-Math.min(e,t,i),r=s?o===e?(t-i)/s:o===t?2+(i-e)/s:4+(e-t)/s:0;return{h:dt(60*(r<0?r+6:r)),s:dt(o?s/o*100:0),v:dt(o/255*100),a:n}})(ut(e)),fromHsva:({h:e,s:t,v:i})=>(({r:e,g:t,b:i,a:n})=>{const o=n<1?mt(dt(255*n)):"";return"#"+mt(e)+mt(t)+mt(i)+o})((({h:e,s:t,v:i,a:n})=>{e=e/360*6,t/=100,i/=100;const o=Math.floor(e),s=i*(1-t),r=i*(1-(e-o)*t),a=i*(1-(1-e+o)*t),l=o%6;return{r:dt(255*[i,r,s,s,a,i][l]),g:dt(255*[a,i,i,r,s,s][l]),b:dt(255*[s,s,a,i,i,r][l]),a:dt(n,2)}})({h:e,s:t,v:i,a:1})),equal:(e,t)=>e.toLowerCase()===t.toLowerCase()||gt(ut(e),ut(t)),fromAttr:e=>e};class Bt extends Vt{get colorModel(){return Rt}}class Mt extends P{constructor(e,t={}){super(e),this.set({color:"",_hexColor:""}),this.hexInputRow=this._createInputRow();const i=this.createCollection();t.hideInput||i.add(this.hexInputRow),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker"],tabindex:-1},children:i}),this._config=t,this._debounceColorPickerEvent=(0,Te.A)((e=>{this.set("color",e),this.fire("colorSelected",{color:this.color})}),150,{leading:!0}),this.on("set:color",((e,t,i)=>{e.return=Ee(i,this._config.format||"hsl")})),this.on("change:color",(()=>{this._hexColor=Ot(this.color)})),this.on("change:_hexColor",(()=>{document.activeElement!==this.picker&&this.picker.setAttribute("color",this._hexColor),Ot(this.color)!=Ot(this._hexColor)&&(this.color=this._hexColor)}))}render(){var e,t;if(super.render(),e="hex-color-picker",t=Bt,void 0===customElements.get(e)&&customElements.define(e,t),this.picker=n.global.document.createElement("hex-color-picker"),this.picker.setAttribute("class","hex-color-picker"),this.picker.setAttribute("tabindex","-1"),this._createSlidersView(),this.element){this.hexInputRow.element?this.element.insertBefore(this.picker,this.hexInputRow.element):this.element.appendChild(this.picker);const e=document.createElement("style");e.textContent='[role="slider"]:focus [part$="pointer"] {border: 1px solid #fff;outline: 1px solid var(--ck-color-focus-border);box-shadow: 0 0 0 2px #fff;}',this.picker.shadowRoot.appendChild(e)}this.picker.addEventListener("color-changed",(e=>{const t=e.detail.value;this._debounceColorPickerEvent(t)}))}focus(){!this._config.hideInput&&(n.env.isGecko||n.env.isiOS||n.env.isSafari)&&this.hexInputRow.children.get(1).focus(),this.slidersView.first.focus()}_createSlidersView(){const e=[...this.picker.shadowRoot.children].filter((e=>"slider"===e.getAttribute("role"))).map((e=>new Lt(e)));this.slidersView=this.createCollection(),e.forEach((e=>{this.slidersView.add(e)}))}_createInputRow(){const e=this._createColorInput();return new Nt(this.locale,e)}_createColorInput(){const e=new Pe(this.locale,st),{t}=this.locale;return e.set({label:t("HEX"),class:"color-picker-hex-input"}),e.fieldView.bind("value").to(this,"_hexColor",(t=>e.isFocused?e.fieldView.value:t.startsWith("#")?t.substring(1):t)),e.fieldView.on("input",(()=>{const t=e.fieldView.element.value;if(t){const e=Dt(t);e&&this._debounceColorPickerEvent(e)}})),e}isValid(){const{t:e}=this.locale;return!!this._config.hideInput||(this.resetValidationStatus(),!!this.hexInputRow.getParsedColor()||(this.hexInputRow.inputView.errorText=e('Please enter a valid color (e.g. "ff0000").'),!1))}resetValidationStatus(){this.hexInputRow.inputView.errorText=null}}function Ot(e){let t=function(e){if(!e)return"";const t=xe(e);return t?"hex"===t.space?t.hexValue:Ee(e,"hex"):"#000"}(e);return t||(t="#000"),4===t.length&&(t="#"+[t[1],t[1],t[2],t[2],t[3],t[3]].join("")),t.toLowerCase()}class Lt extends P{constructor(e){super(),this.element=e}focus(){this.element.focus()}}class Ft extends P{constructor(e){super(e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker__hash-view"]},children:"#"})}}class Nt extends P{constructor(e,t){super(e),this.inputView=t,this.children=this.createCollection([new Ft,this.inputView]),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker__row"]},children:this.children})}getParsedColor(){return Dt(this.inputView.fieldView.element.value)}}function Dt(e){if(!e)return null;const t=e.trim().replace(/^#/,"");return[3,4,6,8].includes(t.length)&&/^(([0-9a-fA-F]{2}){3,4}|([0-9a-fA-F]){3,4})$/.test(t)?`#${t}`:null}class zt extends((0,n.ObservableMixin)(n.Collection)){constructor(e){super(e),this.set("isEmpty",!0),this.on("change",(()=>{this.set("isEmpty",0===this.length)}))}add(e,t){return this.find((t=>t.color===e.color))?this:super.add(e,t)}hasColor(e){return!!this.find((t=>t.color===e))}}class Wt extends P{constructor(e,{colors:t,columns:i,removeButtonLabel:n,documentColorsLabel:o,documentColorsCount:s,colorPickerLabel:r,focusTracker:a,focusables:l}){super(e);const c=this.bindTemplate;this.set("isVisible",!0),this.focusTracker=a,this.items=this.createCollection(),this.colorDefinitions=t,this.columns=i,this.documentColors=new zt,this.documentColorsCount=s,this._focusables=l,this._removeButtonLabel=n,this._colorPickerLabel=r,this._documentColorsLabel=o,this.setTemplate({tag:"div",attributes:{class:["ck-color-grids-fragment",c.if("isVisible","ck-hidden",(e=>!e))]},children:this.items}),this.removeColorButtonView=this._createRemoveColorButton(),this.items.add(this.removeColorButtonView)}updateDocumentColors(e,t){const i=e.document,n=this.documentColorsCount;this.documentColors.clear();for(const o of i.getRoots()){const i=e.createRangeIn(o);for(const e of i.getItems())if(e.is("$textProxy")&&e.hasAttribute(t)&&(this._addColorToDocumentColors(e.getAttribute(t)),this.documentColors.length>=n))return}}updateSelectedColors(){const e=this.documentColorsGrid,t=this.staticColorsGrid,i=this.selectedColor;t.selectedColor=i,e&&(e.selectedColor=i)}render(){if(super.render(),this.staticColorsGrid=this._createStaticColorsGrid(),this.items.add(this.staticColorsGrid),this.documentColorsCount){const e=a.bind(this.documentColors,this.documentColors),t=new P(this.locale);t.setTemplate({tag:"span",attributes:{class:["ck","ck-color-grid__label",e.if("isEmpty","ck-hidden")]},children:[{text:this._documentColorsLabel}]}),this.items.add(t),this.documentColorsGrid=this._createDocumentColorsGrid(),this.items.add(this.documentColorsGrid)}this._createColorPickerButton(),this._addColorSelectorElementsToFocusTracker()}focus(){this.removeColorButtonView.focus()}destroy(){super.destroy()}addColorPickerButton(){this.colorPickerButtonView&&(this.items.add(this.colorPickerButtonView),this.focusTracker.add(this.colorPickerButtonView.element),this._focusables.add(this.colorPickerButtonView))}_addColorSelectorElementsToFocusTracker(){this.focusTracker.add(this.removeColorButtonView.element),this._focusables.add(this.removeColorButtonView),this.staticColorsGrid&&(this.focusTracker.add(this.staticColorsGrid.element),this._focusables.add(this.staticColorsGrid)),this.documentColorsGrid&&(this.focusTracker.add(this.documentColorsGrid.element),this._focusables.add(this.documentColorsGrid))}_createColorPickerButton(){this.colorPickerButtonView=new N,this.colorPickerButtonView.set({label:this._colorPickerLabel,withText:!0,icon:M.icons.colorPalette,class:"ck-color-selector__color-picker"}),this.colorPickerButtonView.on("execute",(()=>{this.fire("colorPicker:show")}))}_createRemoveColorButton(){const e=new N;return e.set({withText:!0,icon:M.icons.eraser,label:this._removeButtonLabel}),e.class="ck-color-selector__remove-color",e.on("execute",(()=>{this.fire("execute",{value:null,source:"removeColorButton"})})),e.render(),e}_createStaticColorsGrid(){const e=new ve(this.locale,{colorDefinitions:this.colorDefinitions,columns:this.columns});return e.on("execute",((e,t)=>{this.fire("execute",{value:t.value,source:"staticColorsGrid"})})),e}_createDocumentColorsGrid(){const e=a.bind(this.documentColors,this.documentColors),t=new ve(this.locale,{columns:this.columns});return t.extendTemplate({attributes:{class:e.if("isEmpty","ck-hidden")}}),t.items.bindTo(this.documentColors).using((e=>{const t=new we;return t.set({color:e.color,hasBorder:e.options&&e.options.hasBorder}),e.label&&t.set({label:e.label,tooltip:!0}),t.on("execute",(()=>{this.fire("execute",{value:e.color,source:"documentColorsGrid"})})),t})),this.documentColors.on("change:isEmpty",((e,i,n)=>{n&&(t.selectedColor=null)})),t}_addColorToDocumentColors(e){const t=this.colorDefinitions.find((t=>t.color===e));t?this.documentColors.add(Object.assign({},t)):this.documentColors.add({color:e,label:e,options:{hasBorder:!1}})}}class Ht extends P{constructor(e,{focusTracker:t,focusables:i,keystrokes:n,colorPickerViewConfig:o}){super(e),this.items=this.createCollection(),this.focusTracker=t,this.keystrokes=n,this.set("isVisible",!1),this.set("selectedColor",void 0),this._focusables=i,this._colorPickerViewConfig=o;const s=this.bindTemplate,{saveButtonView:r,cancelButtonView:a}=this._createActionButtons();this.saveButtonView=r,this.cancelButtonView=a,this.actionBarView=this._createActionBarView({saveButtonView:r,cancelButtonView:a}),this.setTemplate({tag:"div",attributes:{class:["ck-color-picker-fragment",s.if("isVisible","ck-hidden",(e=>!e))]},children:this.items})}render(){super.render();const e=new Mt(this.locale,{...this._colorPickerViewConfig});this.colorPickerView=e,this.colorPickerView.render(),this.selectedColor&&(e.color=this.selectedColor),this.listenTo(this,"change:selectedColor",((t,i,n)=>{e.color=n})),this.items.add(this.colorPickerView),this.items.add(this.actionBarView),this._addColorPickersElementsToFocusTracker(),this._stopPropagationOnArrowsKeys(),this._executeOnEnterPress(),this._executeUponColorChange()}destroy(){super.destroy()}focus(){this.colorPickerView.focus()}resetValidationStatus(){this.colorPickerView.resetValidationStatus()}_executeOnEnterPress(){this.keystrokes.set("enter",(e=>{this.isVisible&&this.focusTracker.focusedElement!==this.cancelButtonView.element&&this.colorPickerView.isValid()&&(this.fire("execute",{value:this.selectedColor}),e.stopPropagation(),e.preventDefault())}))}_stopPropagationOnArrowsKeys(){const e=e=>e.stopPropagation();this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}_addColorPickersElementsToFocusTracker(){for(const e of this.colorPickerView.slidersView)this.focusTracker.add(e.element),this._focusables.add(e);const e=this.colorPickerView.hexInputRow.children.get(1);e.element&&(this.focusTracker.add(e.element),this._focusables.add(e)),this.focusTracker.add(this.saveButtonView.element),this._focusables.add(this.saveButtonView),this.focusTracker.add(this.cancelButtonView.element),this._focusables.add(this.cancelButtonView)}_createActionBarView({saveButtonView:e,cancelButtonView:t}){const i=new P,n=this.createCollection();return n.add(e),n.add(t),i.setTemplate({tag:"div",attributes:{class:["ck","ck-color-selector_action-bar"]},children:n}),i}_createActionButtons(){const e=this.locale,t=e.t,i=new N(e),n=new N(e);return i.set({icon:M.icons.check,class:"ck-button-save",type:"button",withText:!1,label:t("Accept")}),n.set({icon:M.icons.cancel,class:"ck-button-cancel",type:"button",withText:!1,label:t("Cancel")}),i.on("execute",(()=>{this.colorPickerView.isValid()&&this.fire("execute",{source:"colorPickerSaveButton",value:this.selectedColor})})),n.on("execute",(()=>{this.fire("colorPicker:cancel")})),{saveButtonView:i,cancelButtonView:n}}_executeUponColorChange(){this.colorPickerView.on("colorSelected",((e,t)=>{this.fire("execute",{value:t.color,source:"colorPicker"}),this.set("selectedColor",t.color)}))}}class Ut extends P{constructor(e,{colors:t,columns:i,removeButtonLabel:s,documentColorsLabel:r,documentColorsCount:a,colorPickerLabel:l,colorPickerViewConfig:c}){super(e),this.items=this.createCollection(),this.focusTracker=new n.FocusTracker,this.keystrokes=new n.KeystrokeHandler,this._focusables=new o,this._colorPickerViewConfig=c,this._focusCycler=new W({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.colorGridsFragmentView=new Wt(e,{colors:t,columns:i,removeButtonLabel:s,documentColorsLabel:r,documentColorsCount:a,colorPickerLabel:l,focusTracker:this.focusTracker,focusables:this._focusables}),this.colorPickerFragmentView=new Ht(e,{focusables:this._focusables,focusTracker:this.focusTracker,keystrokes:this.keystrokes,colorPickerViewConfig:c}),this.set("_isColorGridsFragmentVisible",!0),this.set("_isColorPickerFragmentVisible",!1),this.set("selectedColor",void 0),this.colorGridsFragmentView.bind("isVisible").to(this,"_isColorGridsFragmentVisible"),this.colorPickerFragmentView.bind("isVisible").to(this,"_isColorPickerFragmentVisible"),this.on("change:selectedColor",((e,t,i)=>{this.colorGridsFragmentView.set("selectedColor",i),this.colorPickerFragmentView.set("selectedColor",i)})),this.colorGridsFragmentView.on("change:selectedColor",((e,t,i)=>{this.set("selectedColor",i)})),this.colorPickerFragmentView.on("change:selectedColor",((e,t,i)=>{this.set("selectedColor",i)})),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-selector"]},children:this.items})}render(){super.render(),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}appendUI(){this._appendColorGridsFragment(),this._colorPickerViewConfig&&this._appendColorPickerFragment()}showColorPickerFragment(){this.colorPickerFragmentView.colorPickerView&&!this._isColorPickerFragmentVisible&&(this._isColorPickerFragmentVisible=!0,this.colorPickerFragmentView.focus(),this.colorPickerFragmentView.resetValidationStatus(),this._isColorGridsFragmentVisible=!1)}showColorGridsFragment(){this._isColorGridsFragmentVisible||(this._isColorGridsFragmentVisible=!0,this.colorGridsFragmentView.focus(),this._isColorPickerFragmentVisible=!1)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}updateDocumentColors(e,t){this.colorGridsFragmentView.updateDocumentColors(e,t)}updateSelectedColors(){this.colorGridsFragmentView.updateSelectedColors()}_appendColorGridsFragment(){this.items.length||(this.items.add(this.colorGridsFragmentView),this.colorGridsFragmentView.delegate("execute").to(this),this.colorGridsFragmentView.delegate("colorPicker:show").to(this))}_appendColorPickerFragment(){2!==this.items.length&&(this.items.add(this.colorPickerFragmentView),this.colorGridsFragmentView.colorPickerButtonView&&this.colorGridsFragmentView.colorPickerButtonView.on("execute",(()=>{this.showColorPickerFragment()})),this.colorGridsFragmentView.addColorPickerButton(),this.colorPickerFragmentView.delegate("execute").to(this),this.colorPickerFragmentView.delegate("colorPicker:cancel").to(this))}}class $t{constructor(e){this._components=new Map,this.editor=e}*names(){for(const e of this._components.values())yield e.originalName}add(e,t){this._components.set(jt(e),{callback:t,originalName:e})}create(e){if(!this.has(e))throw new n.CKEditorError("componentfactory-item-missing",this,{name:e});return this._components.get(jt(e)).callback(this.editor.locale)}has(e){return this._components.has(jt(e))}}function jt(e){return String(e).toLowerCase()}var qt=i(1500);const Kt=(0,n.toUnit)("px"),Gt={top:-99999,left:-99999,name:"arrowless",config:{withArrow:!1}};class Zt extends P{constructor(e){super(e);const t=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("position","arrow_nw"),this.set("isVisible",!1),this.set("withArrow",!0),this.set("class",void 0),this._pinWhenIsVisibleCallback=null,this._resizeObserver=null,this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-panel",t.to("position",(e=>`ck-balloon-panel_${e}`)),t.if("isVisible","ck-balloon-panel_visible"),t.if("withArrow","ck-balloon-panel_with-arrow"),t.to("class")],style:{top:t.to("top",Kt),left:t.to("left",Kt)}},children:this.content})}destroy(){this.hide(),super.destroy()}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(e){const t=Qt(e.target);if(t&&!(0,n.isVisible)(t))return!1;this.show();const i=Zt.defaultPositions,o=Object.assign({},{element:this.element,positions:[i.southArrowNorth,i.southArrowNorthMiddleWest,i.southArrowNorthMiddleEast,i.southArrowNorthWest,i.southArrowNorthEast,i.northArrowSouth,i.northArrowSouthMiddleWest,i.northArrowSouthMiddleEast,i.northArrowSouthWest,i.northArrowSouthEast,i.viewportStickyNorth],limiter:n.global.document.body,fitInViewport:!0},e),s=Zt._getOptimalPosition(o)||Gt,r=parseInt(s.left),a=parseInt(s.top),l=s.name,c=s.config||{},{withArrow:d=!0}=c;return this.top=a,this.left=r,this.position=l,this.withArrow=d,!0}pin(e){this.unpin(),this._startPinning(e)&&(this._pinWhenIsVisibleCallback=()=>{this.isVisible?this._startPinning(e):this._stopPinning()},this.listenTo(this,"change:isVisible",this._pinWhenIsVisibleCallback))}unpin(){this._pinWhenIsVisibleCallback&&(this._stopPinning(),this.stopListening(this,"change:isVisible",this._pinWhenIsVisibleCallback),this._pinWhenIsVisibleCallback=null,this.hide())}_startPinning(e){if(!this.attachTo(e))return!1;const t=Qt(e.target),i=e.limiter?Qt(e.limiter):n.global.document.body;if(this.listenTo(n.global.document,"scroll",((n,o)=>{const s=o.target,r=t&&s.contains(t),a=i&&s.contains(i);!r&&!a&&t&&i||this.attachTo(e)}),{useCapture:!0}),this.listenTo(n.global.window,"resize",(()=>{this.attachTo(e)})),t&&!this._resizeObserver){const e=()=>{(0,n.isVisible)(t)||this.unpin()};this._resizeObserver=new n.ResizeObserver(t,e)}return!0}_stopPinning(){this.stopListening(n.global.document,"scroll"),this.stopListening(n.global.window,"resize"),this._resizeObserver&&(this._resizeObserver.destroy(),this._resizeObserver=null)}static generatePositions(e={}){const{sideOffset:t=Zt.arrowSideOffset,heightOffset:i=Zt.arrowHeightOffset,stickyVerticalOffset:n=Zt.stickyVerticalOffset,config:o}=e;return{northWestArrowSouthWest:(e,i)=>({top:s(e,i),left:e.left-t,name:"arrow_sw",...o&&{config:o}}),northWestArrowSouthMiddleWest:(e,i)=>({top:s(e,i),left:e.left-.25*i.width-t,name:"arrow_smw",...o&&{config:o}}),northWestArrowSouth:(e,t)=>({top:s(e,t),left:e.left-t.width/2,name:"arrow_s",...o&&{config:o}}),northWestArrowSouthMiddleEast:(e,i)=>({top:s(e,i),left:e.left-.75*i.width+t,name:"arrow_sme",...o&&{config:o}}),northWestArrowSouthEast:(e,i)=>({top:s(e,i),left:e.left-i.width+t,name:"arrow_se",...o&&{config:o}}),northArrowSouthWest:(e,i)=>({top:s(e,i),left:e.left+e.width/2-t,name:"arrow_sw",...o&&{config:o}}),northArrowSouthMiddleWest:(e,i)=>({top:s(e,i),left:e.left+e.width/2-.25*i.width-t,name:"arrow_smw",...o&&{config:o}}),northArrowSouth:(e,t)=>({top:s(e,t),left:e.left+e.width/2-t.width/2,name:"arrow_s",...o&&{config:o}}),northArrowSouthMiddleEast:(e,i)=>({top:s(e,i),left:e.left+e.width/2-.75*i.width+t,name:"arrow_sme",...o&&{config:o}}),northArrowSouthEast:(e,i)=>({top:s(e,i),left:e.left+e.width/2-i.width+t,name:"arrow_se",...o&&{config:o}}),northEastArrowSouthWest:(e,i)=>({top:s(e,i),left:e.right-t,name:"arrow_sw",...o&&{config:o}}),northEastArrowSouthMiddleWest:(e,i)=>({top:s(e,i),left:e.right-.25*i.width-t,name:"arrow_smw",...o&&{config:o}}),northEastArrowSouth:(e,t)=>({top:s(e,t),left:e.right-t.width/2,name:"arrow_s",...o&&{config:o}}),northEastArrowSouthMiddleEast:(e,i)=>({top:s(e,i),left:e.right-.75*i.width+t,name:"arrow_sme",...o&&{config:o}}),northEastArrowSouthEast:(e,i)=>({top:s(e,i),left:e.right-i.width+t,name:"arrow_se",...o&&{config:o}}),southWestArrowNorthWest:e=>({top:r(e),left:e.left-t,name:"arrow_nw",...o&&{config:o}}),southWestArrowNorthMiddleWest:(e,i)=>({top:r(e),left:e.left-.25*i.width-t,name:"arrow_nmw",...o&&{config:o}}),southWestArrowNorth:(e,t)=>({top:r(e),left:e.left-t.width/2,name:"arrow_n",...o&&{config:o}}),southWestArrowNorthMiddleEast:(e,i)=>({top:r(e),left:e.left-.75*i.width+t,name:"arrow_nme",...o&&{config:o}}),southWestArrowNorthEast:(e,i)=>({top:r(e),left:e.left-i.width+t,name:"arrow_ne",...o&&{config:o}}),southArrowNorthWest:e=>({top:r(e),left:e.left+e.width/2-t,name:"arrow_nw",...o&&{config:o}}),southArrowNorthMiddleWest:(e,i)=>({top:r(e),left:e.left+e.width/2-.25*i.width-t,name:"arrow_nmw",...o&&{config:o}}),southArrowNorth:(e,t)=>({top:r(e),left:e.left+e.width/2-t.width/2,name:"arrow_n",...o&&{config:o}}),southArrowNorthMiddleEast:(e,i)=>({top:r(e),left:e.left+e.width/2-.75*i.width+t,name:"arrow_nme",...o&&{config:o}}),southArrowNorthEast:(e,i)=>({top:r(e),left:e.left+e.width/2-i.width+t,name:"arrow_ne",...o&&{config:o}}),southEastArrowNorthWest:e=>({top:r(e),left:e.right-t,name:"arrow_nw",...o&&{config:o}}),southEastArrowNorthMiddleWest:(e,i)=>({top:r(e),left:e.right-.25*i.width-t,name:"arrow_nmw",...o&&{config:o}}),southEastArrowNorth:(e,t)=>({top:r(e),left:e.right-t.width/2,name:"arrow_n",...o&&{config:o}}),southEastArrowNorthMiddleEast:(e,i)=>({top:r(e),left:e.right-.75*i.width+t,name:"arrow_nme",...o&&{config:o}}),southEastArrowNorthEast:(e,i)=>({top:r(e),left:e.right-i.width+t,name:"arrow_ne",...o&&{config:o}}),westArrowEast:(e,t)=>({top:e.top+e.height/2-t.height/2,left:e.left-t.width-i,name:"arrow_e",...o&&{config:o}}),eastArrowWest:(e,t)=>({top:e.top+e.height/2-t.height/2,left:e.right+i,name:"arrow_w",...o&&{config:o}}),viewportStickyNorth:(e,t,i,s)=>{const r=s||i;return e.getIntersection(r)?r.height-e.height>n?null:{top:r.top+n,left:e.left+e.width/2-t.width/2,name:"arrowless",config:{withArrow:!1,...o}}:null}};function s(e,t){return e.top-t.height-i}function r(e){return e.bottom+i}}}Zt.arrowSideOffset=25,Zt.arrowHeightOffset=10,Zt.stickyVerticalOffset=20,Zt._getOptimalPosition=n.getOptimalPosition,Zt.defaultPositions=Zt.generatePositions();const Jt=Zt;function Qt(e){return(0,qt.A)(e)?e:(0,n.isRange)(e)?e.commonAncestorContainer:"function"==typeof e?Qt(e()):null}const Yt="ck-tooltip";class Xt extends((0,n.DomEmitterMixin)()){constructor(e){if(super(),this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this._mutationObserver=null,Xt._editors.add(e),Xt._instance)return Xt._instance;Xt._instance=this,this.tooltipTextView=new P(e.locale),this.tooltipTextView.set("text",""),this.tooltipTextView.setTemplate({tag:"span",attributes:{class:["ck","ck-tooltip__text"]},children:[{text:this.tooltipTextView.bindTemplate.to("text")}]}),this.balloonPanelView=new Jt(e.locale),this.balloonPanelView.class=Yt,this.balloonPanelView.content.add(this.tooltipTextView),this._mutationObserver=function(e){const t=new MutationObserver((()=>{e()}));return{attach(e){t.observe(e,{attributes:!0,attributeFilter:["data-cke-tooltip-text","data-cke-tooltip-position"]})},detach(){t.disconnect()}}}((()=>{this._updateTooltipPosition()})),this._pinTooltipDebounced=(0,Te.A)(this._pinTooltip,600),this._unpinTooltipDebounced=(0,Te.A)(this._unpinTooltip,400),this.listenTo(n.global.document,"keydown",this._onKeyDown.bind(this),{useCapture:!0}),this.listenTo(n.global.document,"mouseenter",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(n.global.document,"mouseleave",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(n.global.document,"focus",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(n.global.document,"blur",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(n.global.document,"scroll",this._onScroll.bind(this),{useCapture:!0}),this._watchdogExcluded=!0}destroy(e){const t=e.ui.view&&e.ui.view.body;Xt._editors.delete(e),this.stopListening(e.ui),t&&t.has(this.balloonPanelView)&&t.remove(this.balloonPanelView),Xt._editors.size||(this._unpinTooltip(),this.balloonPanelView.destroy(),this.stopListening(),Xt._instance=null)}static getPositioningFunctions(e){const t=Xt.defaultBalloonPositions;return{s:[t.southArrowNorth,t.southArrowNorthEast,t.southArrowNorthWest],n:[t.northArrowSouth],e:[t.eastArrowWest],w:[t.westArrowEast],sw:[t.southArrowNorthEast],se:[t.southArrowNorthWest]}[e]}_onKeyDown(e,t){"Escape"===t.key&&this._currentElementWithTooltip&&(this._unpinTooltip(),t.stopPropagation())}_onEnterOrFocus(e,{target:t}){const i=ti(t);i?i!==this._currentElementWithTooltip&&(this._unpinTooltip(),"focus"!==e.name||i.matches(":hover")?this._pinTooltipDebounced(i,ii(i)):this._pinTooltip(i,ii(i))):"focus"===e.name&&this._unpinTooltip()}_onLeaveOrBlur(e,{target:t,relatedTarget:i}){if("mouseleave"===e.name){if(!(0,qt.A)(t))return;const e=this.balloonPanelView.element,n=e&&(e===i||e.contains(i)),o=!n&&t===e;if(n)return void this._unpinTooltipDebounced.cancel();if(!o&&this._currentElementWithTooltip&&t!==this._currentElementWithTooltip)return;const s=ti(t),r=ti(i);(o||s&&s!==r)&&this._unpinTooltipDebounced()}else{if(this._currentElementWithTooltip&&t!==this._currentElementWithTooltip)return;this._unpinTooltipDebounced()}}_onScroll(e,{target:t}){this._currentElementWithTooltip&&(t.contains(this.balloonPanelView.element)&&t.contains(this._currentElementWithTooltip)||this._unpinTooltip())}_pinTooltip(e,{text:t,position:i,cssClass:o}){this._unpinTooltip();const s=(0,n.first)(Xt._editors.values()).ui.view.body;s.has(this.balloonPanelView)||s.add(this.balloonPanelView),this.tooltipTextView.text=t,this.balloonPanelView.class=[Yt,o].filter((e=>e)).join(" "),this.balloonPanelView.pin({target:e,positions:Xt.getPositioningFunctions(i)}),this._mutationObserver.attach(e);for(const e of Xt._editors)this.listenTo(e.ui,"update",this._updateTooltipPosition.bind(this),{priority:"low"});this._currentElementWithTooltip=e,this._currentTooltipPosition=i}_unpinTooltip(){this._unpinTooltipDebounced.cancel(),this._pinTooltipDebounced.cancel(),this.balloonPanelView.unpin();for(const e of Xt._editors)this.stopListening(e.ui,"update");this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this.tooltipTextView.text="",this._mutationObserver.detach()}_updateTooltipPosition(){if(!this._currentElementWithTooltip)return;const e=ii(this._currentElementWithTooltip);(0,n.isVisible)(this._currentElementWithTooltip)&&e.text?this.balloonPanelView.pin({target:this._currentElementWithTooltip,positions:Xt.getPositioningFunctions(e.position)}):this._unpinTooltip()}}Xt.defaultBalloonPositions=Jt.generatePositions({heightOffset:5,sideOffset:13}),Xt._editors=new Set,Xt._instance=null;const ei=Xt;function ti(e){return(0,qt.A)(e)?e.closest("[data-cke-tooltip-text]:not([data-cke-tooltip-disabled])"):null}function ii(e){return{text:e.dataset.ckeTooltipText,position:e.dataset.ckeTooltipPosition||"s",cssClass:e.dataset.ckeTooltipClass||""}}var ni=i(4022);class oi extends((0,n.DomEmitterMixin)()){constructor(e){super(),this.editor=e,this._balloonView=null,this._lastFocusedEditableElement=null,this._showBalloonThrottled=(0,ni.A)(this._showBalloon.bind(this),50,{leading:!0}),e.on("ready",this._handleEditorReady.bind(this))}destroy(){const e=this._balloonView;e&&(e.unpin(),this._balloonView=null),this._showBalloonThrottled.cancel(),this.stopListening()}_handleEditorReady(){const e=this.editor;(e.config.get("ui.poweredBy.forceVisible")||"VALID"!==(0,n.verifyLicense)(e.config.get("licenseKey")))&&e.ui.view&&(e.ui.focusTracker.on("change:isFocused",((e,t,i)=>{this._updateLastFocusedEditableElement(),i?this._showBalloon():this._hideBalloon()})),e.ui.focusTracker.on("change:focusedElement",((e,t,i)=>{this._updateLastFocusedEditableElement(),i&&this._showBalloon()})),e.ui.on("update",(()=>{this._showBalloonThrottled()})))}_createBalloonView(){const e=this.editor,t=this._balloonView=new Jt,i=ai(e),n=new si(e.locale,i.label);t.content.add(n),t.set({class:"ck-powered-by-balloon"}),e.ui.view.body.add(t),e.ui.focusTracker.add(t.element),this._balloonView=t}_showBalloon(){if(!this._lastFocusedEditableElement)return;const e=function(e,t){const i=ai(e),n="right"===i.side?function(e,t){return ri(e,t,((e,i)=>e.left+e.width-i.width-t.horizontalOffset))}(t,i):function(e,t){return ri(e,t,(e=>e.left+t.horizontalOffset))}(t,i);return{target:t,positions:[n]}}(this.editor,this._lastFocusedEditableElement);e&&(this._balloonView||this._createBalloonView(),this._balloonView.pin(e))}_hideBalloon(){this._balloonView&&this._balloonView.unpin()}_updateLastFocusedEditableElement(){const e=this.editor,t=e.ui.focusTracker.isFocused,i=e.ui.focusTracker.focusedElement;if(!t||!i)return void(this._lastFocusedEditableElement=null);const n=Array.from(e.ui.getEditableElementsNames()).map((t=>e.ui.getEditableElement(t)));n.includes(i)?this._lastFocusedEditableElement=i:this._lastFocusedEditableElement=n[0]}}class si extends P{constructor(e,t){super(e);const i=new L,n=this.bindTemplate;i.set({content:'<svg xmlns="http://www.w3.org/2000/svg" width="53" height="10" viewBox="0 0 53 10"><path fill="#1C2331" d="M31.724 1.492a15.139 15.139 0 0 0 .045 1.16 2.434 2.434 0 0 0-.687-.34 3.68 3.68 0 0 0-1.103-.166 2.332 2.332 0 0 0-1.14.255 1.549 1.549 0 0 0-.686.87c-.15.41-.225.98-.225 1.712 0 .939.148 1.659.444 2.161.297.503.792.754 1.487.754.452.015.9-.094 1.294-.316.296-.174.557-.4.771-.669l.14.852h1.282V.007h-1.623v1.485ZM31 6.496a1.77 1.77 0 0 1-.494.061.964.964 0 0 1-.521-.127.758.758 0 0 1-.296-.466 3.984 3.984 0 0 1-.093-.992 4.208 4.208 0 0 1 .098-1.052.753.753 0 0 1 .307-.477 1.08 1.08 0 0 1 .55-.122c.233-.004.466.026.69.089l.483.144v2.553c-.11.076-.213.143-.307.2a1.73 1.73 0 0 1-.417.189ZM35.68 0l-.702.004c-.322.002-.482.168-.48.497l.004.581c.002.33.164.493.486.49l.702-.004c.322-.002.481-.167.48-.496L36.165.49c-.002-.33-.164-.493-.486-.491ZM36.145 2.313l-1.612.01.034 5.482 1.613-.01-.035-5.482ZM39.623.79 37.989.8 38 2.306l-.946.056.006 1.009.949-.006.024 2.983c.003.476.143.844.419 1.106.275.26.658.39 1.148.387.132 0 .293-.01.483-.03.19-.02.38-.046.57-.08.163-.028.324-.068.482-.119l-.183-1.095-.702.004a.664.664 0 0 1-.456-.123.553.553 0 0 1-.14-.422l-.016-2.621 1.513-.01-.006-1.064-1.514.01-.01-1.503ZM46.226 2.388c-.41-.184-.956-.274-1.636-.27-.673.004-1.215.101-1.627.29-.402.179-.72.505-.888.91-.18.419-.268.979-.264 1.68.004.688.1 1.24.285 1.655.172.404.495.724.9.894.414.18.957.268 1.63.264.68-.004 1.224-.099 1.632-.284.4-.176.714-.501.878-.905.176-.418.263-.971.258-1.658-.004-.702-.097-1.261-.28-1.677a1.696 1.696 0 0 0-.888-.9Zm-.613 3.607a.77.77 0 0 1-.337.501 1.649 1.649 0 0 1-1.317.009.776.776 0 0 1-.343-.497 4.066 4.066 0 0 1-.105-1.02 4.136 4.136 0 0 1 .092-1.03.786.786 0 0 1 .337-.507 1.59 1.59 0 0 1 1.316-.008.79.79 0 0 1 .344.502c.078.337.113.683.105 1.03.012.343-.019.685-.092 1.02ZM52.114 2.07a2.67 2.67 0 0 0-1.128.278c-.39.191-.752.437-1.072.73l-.157-.846-1.273.008.036 5.572 1.623-.01-.024-3.78c.35-.124.646-.22.887-.286.26-.075.53-.114.8-.118l.45-.003.144-1.546-.286.001ZM22.083 7.426l-1.576-2.532a2.137 2.137 0 0 0-.172-.253 1.95 1.95 0 0 0-.304-.29.138.138 0 0 1 .042-.04 1.7 1.7 0 0 0 .328-.374l1.75-2.71c.01-.015.025-.028.024-.048-.01-.01-.021-.007-.031-.007L20.49 1.17a.078.078 0 0 0-.075.045l-.868 1.384c-.23.366-.46.732-.688 1.099a.108.108 0 0 1-.112.06c-.098-.005-.196-.001-.294-.002-.018 0-.038.006-.055-.007.002-.02.002-.039.005-.058a4.6 4.6 0 0 0 .046-.701V1.203c0-.02-.009-.032-.03-.03h-.033L16.93 1.17c-.084 0-.073-.01-.073.076v6.491c-.001.018.006.028.025.027h1.494c.083 0 .072.007.072-.071v-2.19c0-.055-.003-.11-.004-.166a3.366 3.366 0 0 0-.05-.417h.06c.104 0 .209.002.313-.002a.082.082 0 0 1 .084.05c.535.913 1.07 1.824 1.607 2.736a.104.104 0 0 0 .103.062c.554-.003 1.107-.002 1.66-.002l.069-.003-.019-.032-.188-.304ZM27.112 6.555c-.005-.08-.004-.08-.082-.08h-2.414c-.053 0-.106-.003-.159-.011a.279.279 0 0 1-.246-.209.558.558 0 0 1-.022-.15c0-.382 0-.762-.002-1.143 0-.032.007-.049.042-.044h2.504c.029.003.037-.012.034-.038V3.814c0-.089.013-.078-.076-.078h-2.44c-.07 0-.062.003-.062-.06v-.837c0-.047.004-.093.013-.14a.283.283 0 0 1 .241-.246.717.717 0 0 1 .146-.011h2.484c.024.002.035-.009.036-.033l.003-.038.03-.496c.01-.183.024-.365.034-.548.005-.085.003-.087-.082-.094-.218-.018-.437-.038-.655-.05a17.845 17.845 0 0 0-.657-.026 72.994 72.994 0 0 0-1.756-.016 1.7 1.7 0 0 0-.471.064 1.286 1.286 0 0 0-.817.655c-.099.196-.149.413-.145.633v3.875c0 .072.003.144.011.216a1.27 1.27 0 0 0 .711 1.029c.228.113.48.167.734.158.757-.005 1.515.002 2.272-.042.274-.016.548-.034.82-.053.03-.002.043-.008.04-.041-.008-.104-.012-.208-.019-.312a69.964 69.964 0 0 1-.05-.768ZM16.14 7.415l-.127-1.075c-.004-.03-.014-.04-.044-.037a13.125 13.125 0 0 1-.998.073c-.336.01-.672.02-1.008.016-.116-.001-.233-.014-.347-.039a.746.746 0 0 1-.45-.262c-.075-.1-.132-.211-.167-.33a3.324 3.324 0 0 1-.126-.773 9.113 9.113 0 0 1-.015-.749c0-.285.022-.57.065-.852.023-.158.066-.312.127-.46a.728.728 0 0 1 .518-.443 1.64 1.64 0 0 1 .397-.048c.628-.001 1.255.003 1.882.05.022.001.033-.006.036-.026l.003-.031.06-.55c.019-.177.036-.355.057-.532.004-.034-.005-.046-.04-.056a5.595 5.595 0 0 0-1.213-.21 10.783 10.783 0 0 0-.708-.02c-.24-.003-.48.01-.719.041a3.477 3.477 0 0 0-.625.14 1.912 1.912 0 0 0-.807.497c-.185.2-.33.433-.424.688a4.311 4.311 0 0 0-.24 1.096c-.031.286-.045.572-.042.86-.006.43.024.86.091 1.286.04.25.104.497.193.734.098.279.26.53.473.734.214.205.473.358.756.446.344.11.702.17 1.063.177a8.505 8.505 0 0 0 1.578-.083 6.11 6.11 0 0 0 .766-.18c.03-.008.047-.023.037-.057a.157.157 0 0 1-.003-.025Z"/><path fill="#AFE229" d="M6.016 6.69a1.592 1.592 0 0 0-.614.21c-.23.132-.422.32-.56.546-.044.072-.287.539-.287.539l-.836 1.528.009.006c.038.025.08.046.123.063.127.046.26.07.395.073.505.023 1.011-.007 1.517-.003.29.009.58.002.869-.022a.886.886 0 0 0 .395-.116.962.962 0 0 0 .312-.286c.056-.083.114-.163.164-.249.24-.408.48-.816.718-1.226.075-.128.148-.257.222-.386l.112-.192a1.07 1.07 0 0 0 .153-.518l-1.304.023s-1.258-.005-1.388.01Z"/><path fill="#771BFF" d="m2.848 9.044.76-1.39.184-.352c-.124-.067-.245-.14-.367-.21-.346-.204-.706-.384-1.045-.6a.984.984 0 0 1-.244-.207c-.108-.134-.136-.294-.144-.46-.021-.409-.002-.818-.009-1.227-.003-.195 0-.39.003-.585.004-.322.153-.553.427-.713l.833-.488c.22-.13.44-.257.662-.385.05-.029.105-.052.158-.077.272-.128.519-.047.76.085l.044.028c.123.06.242.125.358.196.318.178.635.357.952.537.095.056.187.117.275.184.194.144.254.35.266.578.016.284.007.569.006.853-.001.28.004.558 0 .838.592-.003 1.259 0 1.259 0l.723-.013c-.003-.292-.007-.584-.007-.876 0-.524.015-1.048-.016-1.571-.024-.42-.135-.8-.492-1.067a5.02 5.02 0 0 0-.506-.339A400.52 400.52 0 0 0 5.94.787C5.722.664 5.513.524 5.282.423 5.255.406 5.228.388 5.2.373 4.758.126 4.305-.026 3.807.21c-.097.046-.197.087-.29.14A699.896 699.896 0 0 0 .783 1.948c-.501.294-.773.717-.778 1.31-.004.36-.009.718-.001 1.077.016.754-.017 1.508.024 2.261.016.304.07.6.269.848.127.15.279.28.448.382.622.4 1.283.734 1.92 1.11l.183.109Z"/></svg>\n',isColorInherited:!1}),i.extendTemplate({attributes:{style:{width:"53px",height:"10px"}}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-powered-by"],"aria-hidden":!0},children:[{tag:"a",attributes:{href:"https://ckeditor.com/?utm_source=ckeditor&utm_medium=referral&utm_campaign=701Dn000000hVgmIAE_powered_by_ckeditor_logo",target:"_blank",tabindex:"-1"},children:[...t?[{tag:"span",attributes:{class:["ck","ck-powered-by__label"]},children:[t]}]:[],i],on:{dragstart:n.to((e=>e.preventDefault()))}}]})}}function ri(e,t,i){return(o,s)=>{const r=new n.Rect(e);if(r.width<350||r.height<50)return null;let a;a="inside"===t.position?r.bottom-s.height:r.bottom-s.height/2,a-=t.verticalOffset;const l=i(r,s),c=o.clone().moveTo(l,a).getIntersection(s.clone().moveTo(l,a)).getVisible();return!c||c.getArea()<s.getArea()?null:{top:a,left:l,name:`position_${t.position}-side_${t.side}`,config:{withArrow:!1}}}}function ai(e){const t=e.config.get("ui.poweredBy"),i=t&&t.position||"border";return{position:i,label:"Powered by",verticalOffset:"inside"===i?5:0,horizontalOffset:5,side:"ltr"===e.locale.contentLanguageDirection?"right":"left",...t}}const li={POLITE:"polite",ASSERTIVE:"assertive"};class ci{constructor(e){this.editor=e,e.once("ready",(()=>{for(const e of Object.values(li))this.announce("",e)}))}announce(e,t=li.POLITE){const i=this.editor;if(!i.ui.view)return;this.view||(this.view=new di(i.locale),i.ui.view.body.add(this.view));const{politeness:n,isUnsafeHTML:o}="string"==typeof t?{politeness:t}:t;let s=this.view.regionViews.find((e=>e.politeness===n));s||(s=new ui(i,n),this.view.regionViews.add(s)),s.announce({announcement:e,isUnsafeHTML:o})}}class di extends P{constructor(e){super(e),this.regionViews=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-aria-live-announcer"]},children:this.regionViews})}}class ui extends P{constructor(e,t){super(e.locale),this.setTemplate({tag:"div",attributes:{"aria-live":t,"aria-relevant":"additions"},children:[{tag:"ul",attributes:{class:["ck","ck-aria-live-region-list"]}}]}),e.on("destroy",(()=>{null!==this._pruneAnnouncementsInterval&&(clearInterval(this._pruneAnnouncementsInterval),this._pruneAnnouncementsInterval=null)})),this.politeness=t,this._domConverter=e.data.htmlProcessor.domConverter,this._pruneAnnouncementsInterval=setInterval((()=>{this.element&&this._listElement.firstChild&&this._listElement.firstChild.remove()}),5e3)}announce({announcement:e,isUnsafeHTML:t}){if(!e.trim().length)return;const i=document.createElement("li");t?this._domConverter.setContentOf(i,e):i.innerText=e,this._listElement.appendChild(i)}get _listElement(){return this.element.querySelector("ul")}}class hi extends Ke{constructor(e,t){super(e);const i=this.bindTemplate;this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item"]},on:{mouseenter:i.to("mouseenter")}}),this.delegate("mouseenter").to(t)}}var mi=i(903);const gi={toggleMenusAndFocusItemsOnHover(e){e.on("menu:mouseenter",(t=>{if(e.isFocusBorderEnabled||e.isOpen){if(e.isOpen)for(const i of e.menus){const e=t.path[0],n=e instanceof hi&&e.children.first===i;i.isOpen=(t.path.includes(i)||n)&&i.isEnabled}t.source.focus()}}))},focusCycleMenusOnArrows(e){const t="rtl"===e.locale.uiLanguageDirection;function i(t,i){const n=e.children.getIndex(t),o=t.isOpen,s=e.children.length,r=e.children.get((n+s+i)%s);t.isOpen=!1,o&&(r.isOpen=!0),r.buttonView.focus()}e.on("menu:arrowright",(e=>{i(e.source,t?-1:1)})),e.on("menu:arrowleft",(e=>{i(e.source,t?1:-1)}))},closeMenusWhenTheBarCloses(e){e.on("change:isOpen",(()=>{e.isOpen||e.menus.forEach((e=>{e.isOpen=!1}))}))},closeMenuWhenAnotherOnTheSameLevelOpens(e){e.on("menu:change:isOpen",((t,i,n)=>{n&&e.menus.filter((e=>t.source.parentMenuView===e.parentMenuView&&t.source!==e&&e.isOpen)).forEach((e=>{e.isOpen=!1}))}))},closeOnClickOutside(e){I({emitter:e,activator:()=>e.isOpen,callback:()=>e.close(),contextElements:()=>e.children.map((e=>e.element))})},enableFocusHighlightOnInteraction(e){let t=!1;e.on("change:isOpen",((i,n,o)=>{o||(e.isFocusBorderEnabled=!1,t=!1)})),e.listenTo(e.element,"click",(()=>{e.isOpen&&e.element.matches(":focus-within")&&(e.isFocusBorderEnabled=!0)}),{useCapture:!0}),e.listenTo(e.element,"keydown",(()=>{t=!0}),{useCapture:!0}),e.listenTo(e.element,"keyup",(()=>{t=!1}),{useCapture:!0}),e.listenTo(e.element,"focus",(()=>{t&&(e.isFocusBorderEnabled=!0)}),{useCapture:!0})}},fi={openAndFocusPanelOnArrowDownKey(e){e.keystrokes.set("arrowdown",((t,i)=>{e.focusTracker.focusedElement===e.buttonView.element&&(e.isOpen||(e.isOpen=!0),e.panelView.focus(),i())}))},openOnArrowRightKey(e){const t="rtl"===e.locale.uiLanguageDirection?"arrowleft":"arrowright";e.keystrokes.set(t,((t,i)=>{e.focusTracker.focusedElement===e.buttonView.element&&e.isEnabled&&(e.isOpen||(e.isOpen=!0),e.panelView.focus(),i())}))},openOnButtonClick(e){e.buttonView.on("execute",(()=>{e.isOpen=!0,e.parentMenuView&&e.panelView.focus()}))},toggleOnButtonClick(e){e.buttonView.on("execute",(()=>{e.isOpen=!e.isOpen}))},closeOnArrowLeftKey(e){const t="rtl"===e.locale.uiLanguageDirection?"arrowright":"arrowleft";e.keystrokes.set(t,((t,i)=>{e.isOpen&&(e.isOpen=!1,e.focus(),i())}))},closeOnEscKey(e){e.keystrokes.set("esc",((t,i)=>{e.isOpen&&(e.isOpen=!1,e.focus(),i())}))},closeOnParentClose(e){e.parentMenuView.on("change:isOpen",((t,i,n)=>{n||t.source!==e.parentMenuView||(e.isOpen=!1)}))}},pi={southEast:e=>({top:e.bottom,left:e.left,name:"se"}),southWest:(e,t)=>({top:e.bottom,left:e.left-t.width+e.width,name:"sw"}),northEast:(e,t)=>({top:e.top-t.height,left:e.left,name:"ne"}),northWest:(e,t)=>({top:e.top-t.height,left:e.left-t.width+e.width,name:"nw"}),eastSouth:e=>({top:e.top,left:e.right-5,name:"es"}),eastNorth:(e,t)=>({top:e.top-t.height,left:e.right-5,name:"en"}),westSouth:(e,t)=>({top:e.top,left:e.left-t.width+5,name:"ws"}),westNorth:(e,t)=>({top:e.top-t.height,left:e.left-t.width+5,name:"wn"})},bi=[{menuId:"file",label:"File",groups:[{groupId:"export",items:["menuBar:exportPdf","menuBar:exportWord"]},{groupId:"import",items:["menuBar:importWord"]},{groupId:"revisionHistory",items:["menuBar:revisionHistory"]}]},{menuId:"edit",label:"Edit",groups:[{groupId:"undo",items:["menuBar:undo","menuBar:redo"]},{groupId:"selectAll",items:["menuBar:selectAll"]},{groupId:"findAndReplace",items:["menuBar:findAndReplace"]}]},{menuId:"view",label:"View",groups:[{groupId:"sourceEditing",items:["menuBar:sourceEditing"]},{groupId:"showBlocks",items:["menuBar:showBlocks"]},{groupId:"previewMergeFields",items:["menuBar:previewMergeFields"]},{groupId:"restrictedEditing",items:["menuBar:restrictedEditing"]}]},{menuId:"insert",label:"Insert",groups:[{groupId:"insertMainWidgets",items:["menuBar:insertImage","menuBar:ckbox","menuBar:ckfinder","menuBar:insertTable"]},{groupId:"insertInline",items:["menuBar:link","menuBar:comment","menuBar:insertMergeField"]},{groupId:"insertMinorWidgets",items:["menuBar:mediaEmbed","menuBar:insertTemplate","menuBar:specialCharacters","menuBar:blockQuote","menuBar:codeBlock","menuBar:htmlEmbed"]},{groupId:"insertStructureWidgets",items:["menuBar:horizontalLine","menuBar:pageBreak","menuBar:tableOfContents"]},{groupId:"restrictedEditingException",items:["menuBar:restrictedEditingException"]}]},{menuId:"format",label:"Format",groups:[{groupId:"textAndFont",items:[{menuId:"text",label:"Text",groups:[{groupId:"basicStyles",items:["menuBar:bold","menuBar:italic","menuBar:underline","menuBar:strikethrough","menuBar:superscript","menuBar:subscript","menuBar:code"]},{groupId:"textPartLanguage",items:["menuBar:textPartLanguage"]}]},{menuId:"font",label:"Font",groups:[{groupId:"fontProperties",items:["menuBar:fontSize","menuBar:fontFamily"]},{groupId:"fontColors",items:["menuBar:fontColor","menuBar:fontBackgroundColor"]},{groupId:"highlight",items:["menuBar:highlight"]}]},"menuBar:heading"]},{groupId:"list",items:["menuBar:bulletedList","menuBar:numberedList","menuBar:multiLevelList","menuBar:todoList"]},{groupId:"indent",items:["menuBar:alignment","menuBar:indent","menuBar:outdent"]},{groupId:"caseChange",items:["menuBar:caseChange"]},{groupId:"removeFormat",items:["menuBar:removeFormat"]}]},{menuId:"tools",label:"Tools",groups:[{groupId:"aiTools",items:["menuBar:aiAssistant","menuBar:aiCommands"]},{groupId:"tools",items:["menuBar:trackChanges","menuBar:commentsArchive"]}]},{menuId:"help",label:"Help",groups:[{groupId:"help",items:["menuBar:accessibilityHelp"]}]}];function wi(e){let t;return t="items"in e&&e.items?{items:e.items,removeItems:[],addItems:[],isVisible:!0,isUsingDefaultConfig:!1,...e}:{items:(0,mi.A)(bi),addItems:[],removeItems:[],isVisible:!0,isUsingDefaultConfig:!0,...e},t}function vi({normalizedConfig:e,locale:t,componentFactory:i,extraItems:o}){const s=(0,mi.A)(e);return _i(e,s,o),function(e,t){const i=t.removeItems,o=[];t.items=t.items.filter((({menuId:e})=>!i.includes(e)||(o.push(e),!1))),Ai(t.items,(e=>{e.groups=e.groups.filter((({groupId:e})=>!i.includes(e)||(o.push(e),!1)));for(const t of e.groups)t.items=t.items.filter((e=>{const t=Ti(e);return!i.includes(t)||(o.push(t),!1)}))}));for(const t of i)o.includes(t)||(0,n.logWarning)("menu-bar-item-could-not-be-removed",{menuBarConfig:e,itemName:t})}(e,s),_i(e,s,s.addItems),function(e,t,i){Ai(t.items,(o=>{for(const s of o.groups)s.items=s.items.filter((s=>{const r="string"==typeof s&&!i.has(s);return r&&!t.isUsingDefaultConfig&&(0,n.logWarning)("menu-bar-item-unavailable",{menuBarConfig:e,parentMenuConfig:(0,mi.A)(o),componentName:s}),!r}))}))}(e,s,i),ki(e,s),function(e,t){const i=t.t,n={File:i({string:"File",id:"MENU_BAR_MENU_FILE"}),Edit:i({string:"Edit",id:"MENU_BAR_MENU_EDIT"}),View:i({string:"View",id:"MENU_BAR_MENU_VIEW"}),Insert:i({string:"Insert",id:"MENU_BAR_MENU_INSERT"}),Format:i({string:"Format",id:"MENU_BAR_MENU_FORMAT"}),Tools:i({string:"Tools",id:"MENU_BAR_MENU_TOOLS"}),Help:i({string:"Help",id:"MENU_BAR_MENU_HELP"}),Text:i({string:"Text",id:"MENU_BAR_MENU_TEXT"}),Font:i({string:"Font",id:"MENU_BAR_MENU_FONT"})};Ai(e.items,(e=>{e.label in n&&(e.label=n[e.label])}))}(s,t),s}function _i(e,t,i){const o=[];if(0!=i.length){for(const e of i){const i=(r=e.position).startsWith("start")?"start":r.startsWith("end")?"end":r.startsWith("after")?"after":"before",n=xi(e.position);if("object"==typeof(s=e)&&"menu"in s)if(n){const s=t.items.findIndex((e=>e.menuId===n));-1!=s?"before"===i?(t.items.splice(s,0,e.menu),o.push(e)):"after"===i&&(t.items.splice(s+1,0,e.menu),o.push(e)):yi(t,e.menu,n,i)&&o.push(e)}else"start"===i?(t.items.unshift(e.menu),o.push(e)):"end"===i&&(t.items.push(e.menu),o.push(e));else Ei(e)?Ai(t.items,(t=>{if(t.menuId===n)"start"===i?(t.groups.unshift(e.group),o.push(e)):"end"===i&&(t.groups.push(e.group),o.push(e));else{const s=t.groups.findIndex((e=>e.groupId===n));-1!==s&&("before"===i?(t.groups.splice(s,0,e.group),o.push(e)):"after"===i&&(t.groups.splice(s+1,0,e.group),o.push(e)))}})):yi(t,e.item,n,i)&&o.push(e)}var s;for(const t of i)o.includes(t)||(0,n.logWarning)("menu-bar-item-could-not-be-added",{menuBarConfig:e,addedItemConfig:t})}var r}function yi(e,t,i,n){let o=!1;return Ai(e.items,(e=>{for(const{groupId:s,items:r}of e.groups){if(o)return;if(s===i)"start"===n?(r.unshift(t),o=!0):"end"===n&&(r.push(t),o=!0);else{const e=r.findIndex((e=>Ti(e)===i));-1!==e&&("before"===n?(r.splice(e,0,t),o=!0):"after"===n&&(r.splice(e+1,0,t),o=!0))}}})),o}function ki(e,t){const i=t.isUsingDefaultConfig;let n=!1;t.items=t.items.filter((t=>!!t.groups.length||(Ci(e,t,i),!1))),t.items.length?(Ai(t.items,(t=>{t.groups=t.groups.filter((e=>!!e.items.length||(n=!0,!1)));for(const o of t.groups)o.items=o.items.filter((t=>!(Pi(t)&&!t.groups.length&&(Ci(e,t,i),n=!0,1))))})),n&&ki(e,t)):Ci(e,e,i)}function Ci(e,t,i){i||(0,n.logWarning)("menu-bar-menu-empty",{menuBarConfig:e,emptyMenuConfig:t})}function Ai(e,t){if(Array.isArray(e))for(const t of e)i(t);function i(e){t(e);for(const t of e.groups)for(const e of t.items)Pi(e)&&i(e)}}function Ei(e){return"object"==typeof e&&"group"in e}function xi(e){const t=e.match(/^[^:]+:(.+)/);return t?t[1]:null}function Ti(e){return"string"==typeof e?e:e.menuId}function Pi(e){return"object"==typeof e&&"menuId"in e}class Ii extends((0,n.ObservableMixin)()){constructor(e){super(),this.isReady=!1,this._editableElementsMap=new Map,this._focusableToolbarDefinitions=[],this._extraMenuBarElements=[],this._lastFocusedForeignElement=null;const t=e.editing.view;this.editor=e,this.componentFactory=new $t(e),this.focusTracker=new n.FocusTracker,this.tooltipManager=new ei(e),this.poweredBy=new oi(e),this.ariaLiveAnnouncer=new ci(e),this.set("viewportOffset",this._readViewportOffsetFromConfig()),this.once("ready",(()=>{this.isReady=!0})),this.listenTo(t.document,"layoutChanged",this.update.bind(this)),this.listenTo(t,"scrollToTheSelection",this._handleScrollToTheSelection.bind(this)),this._initFocusTracking()}get element(){return null}update(){this.fire("update")}destroy(){this.stopListening(),this.focusTracker.destroy(),this.tooltipManager.destroy(this.editor),this.poweredBy.destroy();for(const e of this._editableElementsMap.values())e.ckeditorInstance=null,this.editor.keystrokes.stopListening(e);this._editableElementsMap=new Map,this._focusableToolbarDefinitions=[]}setEditableElement(e,t){this._editableElementsMap.set(e,t),t.ckeditorInstance||(t.ckeditorInstance=this.editor),this.focusTracker.add(t);const i=()=>{this.editor.editing.view.getDomRoot(e)||this.editor.keystrokes.listenTo(t)};this.isReady?i():this.once("ready",i)}removeEditableElement(e){const t=this._editableElementsMap.get(e);t&&(this._editableElementsMap.delete(e),this.editor.keystrokes.stopListening(t),this.focusTracker.remove(t),t.ckeditorInstance=null)}getEditableElement(e="main"){return this._editableElementsMap.get(e)}getEditableElementsNames(){return this._editableElementsMap.keys()}addToolbar(e,t={}){e.isRendered?(this.focusTracker.add(e.element),this.editor.keystrokes.listenTo(e.element)):e.once("render",(()=>{this.focusTracker.add(e.element),this.editor.keystrokes.listenTo(e.element)})),this._focusableToolbarDefinitions.push({toolbarView:e,options:t})}extendMenuBar(e){this._extraMenuBarElements.push(e)}get _editableElements(){return console.warn("editor-ui-deprecated-editable-elements: The EditorUI#_editableElements property has been deprecated and will be removed in the near future.",{editorUI:this}),this._editableElementsMap}_initMenuBar(e){const t=e.element;this.focusTracker.add(t),this.editor.keystrokes.listenTo(t);const i=wi(this.editor.config.get("menuBar")||{});e.fillFromConfig(i,this.componentFactory,this._extraMenuBarElements),this.editor.keystrokes.set("Esc",((e,i)=>{t.contains(this.editor.ui.focusTracker.focusedElement)&&(this._lastFocusedForeignElement?(this._lastFocusedForeignElement.focus(),this._lastFocusedForeignElement=null):this.editor.editing.view.focus(),i())})),this.editor.keystrokes.set("Alt+F9",((i,n)=>{t.contains(this.editor.ui.focusTracker.focusedElement)||(this._saveLastFocusedForeignElement(),e.isFocusBorderEnabled=!0,e.focus(),n())}))}_readViewportOffsetFromConfig(){const e=this.editor,t=e.config.get("ui.viewportOffset");if(t)return t;const i=e.config.get("toolbar.viewportTopOffset");return i?(console.warn("editor-ui-deprecated-viewport-offset-config: The `toolbar.vieportTopOffset` configuration option is deprecated. It will be removed from future CKEditor versions. Use `ui.viewportOffset.top` instead."),{top:i}):{top:0}}_initFocusTracking(){const e=this.editor;let t;e.editing.view,e.keystrokes.set("Alt+F10",((e,i)=>{this._saveLastFocusedForeignElement();const n=this._getCurrentFocusedToolbarDefinition();n&&t||(t=this._getFocusableCandidateToolbarDefinitions());for(let e=0;e<t.length;e++){const e=t.shift();if(t.push(e),e!==n&&this._focusFocusableCandidateToolbar(e)){n&&n.options.afterBlur&&n.options.afterBlur();break}}i()})),e.keystrokes.set("Esc",((t,i)=>{const n=this._getCurrentFocusedToolbarDefinition();n&&(this._lastFocusedForeignElement?(this._lastFocusedForeignElement.focus(),this._lastFocusedForeignElement=null):e.editing.view.focus(),n.options.afterBlur&&n.options.afterBlur(),i())}))}_saveLastFocusedForeignElement(){const e=this.focusTracker.focusedElement;Array.from(this._editableElementsMap.values()).includes(e)&&!Array.from(this.editor.editing.view.domRoots.values()).includes(e)&&(this._lastFocusedForeignElement=e)}_getFocusableCandidateToolbarDefinitions(){const e=[];for(const t of this._focusableToolbarDefinitions){const{toolbarView:i,options:o}=t;((0,n.isVisible)(i.element)||o.beforeFocus)&&e.push(t)}return e.sort(((e,t)=>Si(e)-Si(t))),e}_getCurrentFocusedToolbarDefinition(){for(const e of this._focusableToolbarDefinitions)if(e.toolbarView.element&&e.toolbarView.element.contains(this.focusTracker.focusedElement))return e;return null}_focusFocusableCandidateToolbar(e){const{toolbarView:t,options:{beforeFocus:i}}=e;return i&&i(),!!(0,n.isVisible)(t.element)&&(t.focus(),!0)}_handleScrollToTheSelection(e,t){const i={top:0,bottom:0,left:0,right:0,...this.viewportOffset};t.viewportOffset.top+=i.top,t.viewportOffset.bottom+=i.bottom,t.viewportOffset.left+=i.left,t.viewportOffset.right+=i.right}}function Si(e){const{toolbarView:t,options:i}=e;let o=10;return(0,n.isVisible)(t.element)&&o--,i.isContextual&&o--,o}class Vi extends P{constructor(e){super(e),this.body=new ae(e)}render(){super.render(),this.body.attachToDom()}destroy(){return this.body.detachFromDom(),super.destroy()}}class Ri extends Vi{constructor(e){super(e),this.top=this.createCollection(),this.main=this.createCollection(),this._voiceLabelView=this._createVoiceLabel(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-editor","ck-rounded-corners"],role:"application",dir:e.uiLanguageDirection,lang:e.uiLanguage,"aria-labelledby":this._voiceLabelView.id},children:[this._voiceLabelView,{tag:"div",attributes:{class:["ck","ck-editor__top","ck-reset_all"],role:"presentation"},children:this.top},{tag:"div",attributes:{class:["ck","ck-editor__main"],role:"presentation"},children:this.main}]})}_createVoiceLabel(){const e=this.t,t=new ie;return t.text=e("Rich Text Editor"),t.extendTemplate({attributes:{class:"ck-voice-label"}}),t}}class Bi extends P{constructor(e,t,i){super(e),this.name=null,this.setTemplate({tag:"div",attributes:{class:["ck","ck-content","ck-editor__editable","ck-rounded-corners"],lang:e.contentLanguage,dir:e.contentLanguageDirection}}),this.set("isFocused",!1),this._editableElement=i,this._hasExternalElement=!!this._editableElement,this._editingView=t}render(){super.render(),this._hasExternalElement?this.template.apply(this.element=this._editableElement):this._editableElement=this.element,this.on("change:isFocused",(()=>this._updateIsFocusedClasses())),this._updateIsFocusedClasses()}destroy(){this._hasExternalElement&&this.template.revert(this._editableElement),super.destroy()}get hasExternalElement(){return this._hasExternalElement}_updateIsFocusedClasses(){const e=this._editingView;function t(t){e.change((i=>{const n=e.document.getRoot(t.name);i.addClass(t.isFocused?"ck-focused":"ck-blurred",n),i.removeClass(t.isFocused?"ck-blurred":"ck-focused",n)}))}e.isRenderingInProgress?function i(n){e.once("change:isRenderingInProgress",((e,o,s)=>{s?i(n):t(n)}))}(this):t(this)}}class Mi extends Bi{constructor(e,t,i,n={}){super(e,t,i);const o=e.t;this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}}),this._generateLabel=n.label||(()=>o("Editor editing area: %0",this.name))}render(){super.render();const e=this._editingView;e.change((t=>{const i=e.document.getRoot(this.name);t.setAttribute("aria-label",this._generateLabel(this),i)}))}}class Oi extends P{constructor(e){super(e);const t=this.bindTemplate;this.setTemplate({tag:"iframe",attributes:{class:["ck","ck-reset_all"],sandbox:"allow-same-origin allow-scripts"},on:{load:t.to("loaded")}})}render(){return new Promise((e=>(this.on("loaded",e),super.render())))}}function Li(e,t){let i=0,n=0;for(const o of t){const t=o,s=t.items,r=e&&!!t.label.match(e);t.labelView.highlightText(r?e:null);for(const t of s){const i=t.children.first,n=i.labelView;if(e){const o=!!i.label.match(e);n.highlightText(o?e:null),t.isVisible=r||o}else t.isVisible=!0,n.highlightText(null)}const a=s.filter((e=>e.isVisible)).length;i+=t.items.length,n+=r?t.items.length:a,t.isVisible=r||!!a}return{resultsCount:n,totalItemsCount:i}}class Fi extends M.ContextPlugin{static get pluginName(){return"Notification"}init(){this.on("show:warning",((e,t)=>{window.alert(t.message)}),{priority:"lowest"})}showSuccess(e,t={}){this._showNotification({message:e,type:"success",namespace:t.namespace,title:t.title})}showInfo(e,t={}){this._showNotification({message:e,type:"info",namespace:t.namespace,title:t.title})}showWarning(e,t={}){this._showNotification({message:e,type:"warning",namespace:t.namespace,title:t.title})}_showNotification(e){const t=e.namespace?`show:${e.type}:${e.namespace}`:`show:${e.type}`;this.fire(t,{message:e.message,type:e.type,title:e.title||""})}}var Ni=i(6232);class Di extends((0,n.ObservableMixin)()){constructor(e,t){super(),t&&(0,Ni.A)(this,t),e&&this.set(e)}}const zi=(0,n.toUnit)("px");class Wi extends M.Plugin{static get pluginName(){return"ContextualBalloon"}constructor(e){super(e),this._viewToStack=new Map,this._idToStack=new Map,this._view=null,this._rotatorView=null,this._fakePanelsView=null,this.positionLimiter=()=>{const e=this.editor.editing.view,t=e.document.selection.editableElement;return t?e.domConverter.mapViewToDom(t.root):null},this.set("visibleView",null),this.set("_numberOfStacks",0),this.set("_singleViewMode",!1)}destroy(){super.destroy(),this._view&&this._view.destroy(),this._rotatorView&&this._rotatorView.destroy(),this._fakePanelsView&&this._fakePanelsView.destroy()}get view(){return this._view||this._createPanelView(),this._view}hasView(e){return Array.from(this._viewToStack.keys()).includes(e)}add(e){if(this._view||this._createPanelView(),this.hasView(e.view))throw new n.CKEditorError("contextualballoon-add-view-exist",[this,e]);const t=e.stackId||"main";if(!this._idToStack.has(t))return this._idToStack.set(t,new Map([[e.view,e]])),this._viewToStack.set(e.view,this._idToStack.get(t)),this._numberOfStacks=this._idToStack.size,void(this._visibleStack&&!e.singleViewMode||this.showStack(t));const i=this._idToStack.get(t);e.singleViewMode&&this.showStack(t),i.set(e.view,e),this._viewToStack.set(e.view,i),i===this._visibleStack&&this._showView(e)}remove(e){if(!this.hasView(e))throw new n.CKEditorError("contextualballoon-remove-view-not-exist",[this,e]);const t=this._viewToStack.get(e);this._singleViewMode&&this.visibleView===e&&(this._singleViewMode=!1),this.visibleView===e&&(1===t.size?this._idToStack.size>1?this._showNextStack():(this.view.hide(),this.visibleView=null,this._rotatorView.hideView()):this._showView(Array.from(t.values())[t.size-2])),1===t.size?(this._idToStack.delete(this._getStackId(t)),this._numberOfStacks=this._idToStack.size):t.delete(e),this._viewToStack.delete(e)}updatePosition(e){e&&(this._visibleStack.get(this.visibleView).position=e),this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition()}showStack(e){this.visibleStack=e;const t=this._idToStack.get(e);if(!t)throw new n.CKEditorError("contextualballoon-showstack-stack-not-exist",this);this._visibleStack!==t&&this._showView(Array.from(t.values()).pop())}_createPanelView(){this._view=new Jt(this.editor.locale),this.editor.ui.view.body.add(this._view),this.editor.ui.focusTracker.add(this._view.element),this._rotatorView=this._createRotatorView(),this._fakePanelsView=this._createFakePanelsView()}get _visibleStack(){return this._viewToStack.get(this.visibleView)}_getStackId(e){return Array.from(this._idToStack.entries()).find((t=>t[1]===e))[0]}_showNextStack(){const e=Array.from(this._idToStack.values());let t=e.indexOf(this._visibleStack)+1;e[t]||(t=0),this.showStack(this._getStackId(e[t]))}_showPrevStack(){const e=Array.from(this._idToStack.values());let t=e.indexOf(this._visibleStack)-1;e[t]||(t=e.length-1),this.showStack(this._getStackId(e[t]))}_createRotatorView(){const e=new Hi(this.editor.locale),t=this.editor.locale.t;return this.view.content.add(e),e.bind("isNavigationVisible").to(this,"_numberOfStacks",this,"_singleViewMode",((e,t)=>!t&&e>1)),e.on("change:isNavigationVisible",(()=>this.updatePosition()),{priority:"low"}),e.bind("counter").to(this,"visibleView",this,"_numberOfStacks",((e,i)=>{if(i<2)return"";const n=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return t("%0 of %1",[n,i])})),e.buttonNextView.on("execute",(()=>{e.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showNextStack()})),e.buttonPrevView.on("execute",(()=>{e.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showPrevStack()})),e}_createFakePanelsView(){const e=new Ui(this.editor.locale,this.view);return e.bind("numberOfPanels").to(this,"_numberOfStacks",this,"_singleViewMode",((e,t)=>!t&&e>=2?Math.min(e-1,2):0)),e.listenTo(this.view,"change:top",(()=>e.updatePosition())),e.listenTo(this.view,"change:left",(()=>e.updatePosition())),this.editor.ui.view.body.add(e),e}_showView({view:e,balloonClassName:t="",withArrow:i=!0,singleViewMode:n=!1}){this.view.class=t,this.view.withArrow=i,this._rotatorView.showView(e),this.visibleView=e,this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition(),n&&(this._singleViewMode=!0)}_getBalloonPosition(){let e=Array.from(this._visibleStack.values()).pop().position;return e&&(e.limiter||(e=Object.assign({},e,{limiter:this.positionLimiter})),e=Object.assign({},e,{viewportOffsetConfig:this.editor.ui.viewportOffset})),e}}class Hi extends P{constructor(e){super(e);const t=e.t,i=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new n.FocusTracker,this.buttonPrevView=this._createButtonView(t("Previous"),M.icons.previousArrow),this.buttonNextView=this._createButtonView(t("Next"),M.icons.nextArrow),this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-rotator"],"z-index":"-1"},children:[{tag:"div",attributes:{class:["ck-balloon-rotator__navigation",i.to("isNavigationVisible",(e=>e?"":"ck-hidden"))]},children:[this.buttonPrevView,{tag:"span",attributes:{class:["ck-balloon-rotator__counter"]},children:[{text:i.to("counter")}]},this.buttonNextView]},{tag:"div",attributes:{class:"ck-balloon-rotator__content"},children:this.content}]})}render(){super.render(),this.focusTracker.add(this.element)}destroy(){super.destroy(),this.focusTracker.destroy()}showView(e){this.hideView(),this.content.add(e)}hideView(){this.content.clear()}_createButtonView(e,t){const i=new N(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i}}class Ui extends P{constructor(e,t){super(e);const i=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("height",0),this.set("width",0),this.set("numberOfPanels",0),this.content=this.createCollection(),this._balloonPanelView=t,this.setTemplate({tag:"div",attributes:{class:["ck-fake-panel",i.to("numberOfPanels",(e=>e?"":"ck-hidden"))],style:{top:i.to("top",zi),left:i.to("left",zi),width:i.to("width",zi),height:i.to("height",zi)}},children:this.content}),this.on("change:numberOfPanels",((e,t,i,n)=>{i>n?this._addPanels(i-n):this._removePanels(n-i),this.updatePosition()}))}_addPanels(e){for(;e--;){const e=new P;e.setTemplate({tag:"div"}),this.content.add(e),this.registerChild(e)}}_removePanels(e){for(;e--;){const e=this.content.last;this.content.remove(e),this.deregisterChild(e),e.destroy()}}updatePosition(){if(this.numberOfPanels){const{top:e,left:t}=this._balloonPanelView,{width:i,height:o}=new n.Rect(this._balloonPanelView.element);Object.assign(this,{top:e,left:t,width:i,height:o})}}}const $i=(0,n.toUnit)("px");class ji extends P{constructor(e){super(e);const t=this.bindTemplate;this.set("isActive",!1),this.set("isSticky",!1),this.set("limiterElement",null),this.set("limiterBottomOffset",50),this.set("viewportTopOffset",0),this.set("_marginLeft",null),this.set("_isStickyToTheBottomOfLimiter",!1),this.set("_stickyTopOffset",null),this.set("_stickyBottomOffset",null),this.content=this.createCollection(),this._contentPanelPlaceholder=new a({tag:"div",attributes:{class:["ck","ck-sticky-panel__placeholder"],style:{display:t.to("isSticky",(e=>e?"block":"none")),height:t.to("isSticky",(e=>e?$i(this._contentPanelRect.height):null))}}}).render(),this.contentPanelElement=new a({tag:"div",attributes:{class:["ck","ck-sticky-panel__content",t.if("isSticky","ck-sticky-panel__content_sticky"),t.if("_isStickyToTheBottomOfLimiter","ck-sticky-panel__content_sticky_bottom-limit")],style:{width:t.to("isSticky",(e=>e?$i(this._contentPanelPlaceholder.getBoundingClientRect().width):null)),top:t.to("_stickyTopOffset",(e=>e?$i(e):e)),bottom:t.to("_stickyBottomOffset",(e=>e?$i(e):e)),marginLeft:t.to("_marginLeft")}},children:this.content}).render(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-sticky-panel"]},children:[this._contentPanelPlaceholder,this.contentPanelElement]})}render(){super.render(),this.checkIfShouldBeSticky(),this.listenTo(n.global.document,"scroll",(()=>{this.checkIfShouldBeSticky()}),{useCapture:!0}),this.listenTo(this,"change:isActive",(()=>{this.checkIfShouldBeSticky()}))}checkIfShouldBeSticky(){if(!this.limiterElement||!this.isActive)return void this._unstick();const e=new n.Rect(this.limiterElement);let t=e.getVisible();if(t){const e=new n.Rect(n.global.window);e.top+=this.viewportTopOffset,e.height-=this.viewportTopOffset,t=t.getIntersection(e)}if(t&&e.top<t.top){const i=t.top;if(i+this._contentPanelRect.height+this.limiterBottomOffset>t.bottom){const i=Math.max(e.bottom-t.bottom,0)+this.limiterBottomOffset;e.bottom-i>e.top+this._contentPanelRect.height?this._stickToBottomOfLimiter(i):this._unstick()}else this._contentPanelRect.height+this.limiterBottomOffset<e.height?this._stickToTopOfAncestors(i):this._unstick()}else this._unstick()}_stickToTopOfAncestors(e){this.isSticky=!0,this._isStickyToTheBottomOfLimiter=!1,this._stickyTopOffset=e,this._stickyBottomOffset=null,this._marginLeft=$i(-n.global.window.scrollX)}_stickToBottomOfLimiter(e){this.isSticky=!0,this._isStickyToTheBottomOfLimiter=!0,this._stickyTopOffset=null,this._stickyBottomOffset=e,this._marginLeft=$i(-n.global.window.scrollX)}_unstick(){this.isSticky=!1,this._isStickyToTheBottomOfLimiter=!1,this._stickyTopOffset=null,this._stickyBottomOffset=null,this._marginLeft=null}get _contentPanelRect(){return new n.Rect(this.contentPanelElement)}}class qi extends Pe{constructor(e,t){const i=e.t,n=Object.assign({},{showResetButton:!0,showIcon:!0,creator:st},t);super(e,n.creator),this.label=t.label,this._viewConfig=n,this._viewConfig.showIcon&&(this.iconView=new L,this.iconView.content=M.icons.loupe,this.fieldWrapperChildren.add(this.iconView,0),this.extendTemplate({attributes:{class:"ck-search__query_with-icon"}})),this._viewConfig.showResetButton&&(this.resetButtonView=new N(e),this.resetButtonView.set({label:i("Clear"),icon:M.icons.cancel,class:"ck-search__reset",isVisible:!1,tooltip:!0}),this.resetButtonView.on("execute",(()=>{this.reset(),this.focus(),this.fire("reset")})),this.resetButtonView.bind("isVisible").to(this.fieldView,"isEmpty",(e=>!e)),this.fieldWrapperChildren.add(this.resetButtonView),this.extendTemplate({attributes:{class:"ck-search__query_with-reset"}}))}reset(){this.fieldView.reset(),this._viewConfig.showResetButton&&(this.resetButtonView.isVisible=!1)}}class Ki extends P{constructor(){super();const e=this.bindTemplate;this.set({isVisible:!1,primaryText:"",secondaryText:""}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-search__info",e.if("isVisible","ck-hidden",(e=>!e))],tabindex:-1},children:[{tag:"span",children:[{text:[e.to("primaryText")]}]},{tag:"span",children:[{text:[e.to("secondaryText")]}]}]})}focus(){this.element.focus()}}class Gi extends P{constructor(e){super(e),this.children=this.createCollection(),this.focusTracker=new n.FocusTracker,this.setTemplate({tag:"div",attributes:{class:["ck","ck-search__results"],tabindex:-1},children:this.children}),this._focusCycler=new W({focusables:this.children,focusTracker:this.focusTracker})}render(){super.render();for(const e of this.children)this.focusTracker.add(e.element)}focus(){this._focusCycler.focusFirst()}focusFirst(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}var Zi=i(3224);class Ji extends P{constructor(e,t){super(e),this._config=t,this.filteredView=t.filteredView,this.queryView=this._createSearchTextQueryView(),this.focusTracker=new n.FocusTracker,this.keystrokes=new n.KeystrokeHandler,this.resultsView=new Gi(e),this.children=this.createCollection(),this.focusableChildren=this.createCollection([this.queryView,this.resultsView]),this.set("isEnabled",!0),this.set("resultsCount",0),this.set("totalItemsCount",0),t.infoView&&t.infoView.instance?this.infoView=t.infoView.instance:(this.infoView=new Ki,this._enableDefaultInfoViewBehavior(),this.on("render",(()=>{this.search("")}))),this.resultsView.children.addMany([this.infoView,this.filteredView]),this.focusCycler=new W({focusables:this.focusableChildren,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.on("search",((e,{resultsCount:t,totalItemsCount:i})=>{this.resultsCount=t,this.totalItemsCount=i})),this.setTemplate({tag:"div",attributes:{class:["ck","ck-search",t.class||null],tabindex:"-1"},children:this.children})}render(){super.render(),this.children.addMany([this.queryView,this.resultsView]);const e=e=>e.stopPropagation();for(const e of this.focusableChildren)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element),this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}focus(){this.queryView.focus()}reset(){this.queryView.reset(),this.search(""),this.filteredView.element.scrollTo(0,0)}search(e){const t=e?new RegExp((0,Zi.A)(e),"ig"):null,i=this.filteredView.filter(t);this.fire("search",{query:e,...i})}_createSearchTextQueryView(){const e=new qi(this.locale,this._config.queryView);return this.listenTo(e.fieldView,"input",(()=>{this.search(e.fieldView.element.value)})),e.on("reset",(()=>this.reset())),e.bind("isEnabled").to(this),e}_enableDefaultInfoViewBehavior(){const e=this.locale.t,t=this.infoView;function i(e,{query:t,resultsCount:i,totalItemsCount:n}){return"function"==typeof e?e(t,i,n):e}this.on("search",((n,o)=>{if(o.resultsCount)t.set({isVisible:!1});else{const n=this._config.infoView&&this._config.infoView.text;let s,r;o.totalItemsCount?n&&n.notFound?(s=n.notFound.primary,r=n.notFound.secondary):(s=e("No results found"),r=""):n&&n.noSearchableItems?(s=n.noSearchableItems.primary,r=n.noSearchableItems.secondary):(s=e("No searchable items"),r=""),t.set({primaryText:i(s,o),secondaryText:i(r,o),isVisible:!0})}}))}}class Qi extends Ji{constructor(e,t){super(e,t),this._config=t;const i=(0,n.toUnit)("px");this.extendTemplate({attributes:{class:["ck-autocomplete"]}});const o=this.resultsView.bindTemplate;this.resultsView.set("isVisible",!1),this.resultsView.set("_position","s"),this.resultsView.set("_width",0),this.resultsView.extendTemplate({attributes:{class:[o.if("isVisible","ck-hidden",(e=>!e)),o.to("_position",(e=>`ck-search__results_${e}`))],style:{width:o.to("_width",i)}}}),this.focusTracker.on("change:isFocused",((e,i,n)=>{this._updateResultsVisibility(),n?this.resultsView.element.scrollTop=0:t.resetOnBlur&&this.queryView.reset()})),this.on("search",(()=>{this._updateResultsVisibility(),this._updateResultsViewWidthAndPosition()})),this.keystrokes.set("esc",((e,t)=>{this.resultsView.isVisible&&(this.queryView.focus(),this.resultsView.isVisible=!1,t())})),this.listenTo(n.global.document,"scroll",(()=>{this._updateResultsViewWidthAndPosition()})),this.on("change:isEnabled",(()=>{this._updateResultsVisibility()})),this.filteredView.on("execute",((e,{value:t})=>{this.focus(),this.reset(),this.queryView.fieldView.value=this.queryView.fieldView.element.value=t,this.resultsView.isVisible=!1})),this.resultsView.on("change:isVisible",(()=>{this._updateResultsViewWidthAndPosition()}))}_updateResultsViewWidthAndPosition(){if(!this.resultsView.isVisible)return;this.resultsView._width=new n.Rect(this.queryView.fieldView.element).width;const e=Qi._getOptimalPosition({element:this.resultsView.element,target:this.queryView.element,fitInViewport:!0,positions:Qi.defaultResultsPositions});this.resultsView._position=e?e.name:"s"}_updateResultsVisibility(){const e=void 0===this._config.queryMinChars?0:this._config.queryMinChars,t=this.queryView.fieldView.element.value.length;this.resultsView.isVisible=this.focusTracker.isFocused&&this.isEnabled&&t>=e}}Qi.defaultResultsPositions=[e=>({top:e.bottom,left:e.left,name:"s"}),(e,t)=>({top:e.top-t.height,left:e.left,name:"n"})],Qi._getOptimalPosition=n.getOptimalPosition;const Yi=Qi,Xi=(en={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},function(e){return null==en?void 0:en[e]});var en,tn=i(3456),nn=/[&<>"']/g,on=RegExp(nn.source);const sn=function(e){return(e=(0,tn.A)(e))&&on.test(e)?e.replace(nn,Xi):e};class rn extends P{constructor(){super(),this.set("text",void 0),this.setTemplate({tag:"span",attributes:{class:["ck","ck-highlighted-text"]}}),this.on("render",(()=>{this.on("change:text",(()=>{this._updateInnerHTML(this.text)})),this._updateInnerHTML(this.text)}))}highlightText(e){this._updateInnerHTML(function(e,t){if(!t)return sn(e);const i=[];let n=0,o=t.exec(e);for(;null!==o;){const s=o.index;s!==n&&i.push({text:e.substring(n,s),isMatch:!1}),i.push({text:o[0],isMatch:!0}),n=t.lastIndex,o=t.exec(e)}return n!==e.length&&i.push({text:e.substring(n),isMatch:!1}),i.map((e=>(e.text=sn(e.text),e))).map((e=>e.isMatch?`<mark>${e.text}</mark>`:e.text)).join("")}(this.text||"",e))}_updateInnerHTML(e){this.element.innerHTML=e||""}}class an extends rn{constructor(){super(),this.set({style:void 0,text:void 0,id:void 0});const e=this.bindTemplate;this.extendTemplate({attributes:{class:["ck-button__label"],style:e.to("style"),id:e.to("id")}})}}class ln extends rn{constructor(){super(),this.set("for",void 0);const e=this.bindTemplate;this.id=`ck-editor__label_${(0,n.uid)()}`,this.extendTemplate({attributes:{class:["ck","ck-label"],id:this.id,for:e.to("for")}})}}class cn extends P{constructor(){super(),this.set("isVisible",!1);const e=this.bindTemplate;this.setTemplate({tag:"span",attributes:{class:["ck","ck-spinner-container",e.if("isVisible","ck-hidden",(e=>!e))]},children:[{tag:"span",attributes:{class:["ck","ck-spinner"]}}]})}}const dn=(0,n.toUnit)("px");class un extends M.Plugin{static get pluginName(){return"BalloonToolbar"}static get requires(){return[Wi]}constructor(e){super(e),this._resizeObserver=null,this._balloonConfig=We(e.config.get("balloonToolbar")),this.toolbarView=this._createToolbarView(),this.focusTracker=new n.FocusTracker,e.ui.once("ready",(()=>{this.focusTracker.add(e.ui.getEditableElement()),this.focusTracker.add(this.toolbarView.element)})),e.ui.addToolbar(this.toolbarView,{beforeFocus:()=>this.show(!0),afterBlur:()=>this.hide(),isContextual:!0}),this._balloon=e.plugins.get(Wi),this._fireSelectionChangeDebounced=(0,Te.A)((()=>this.fire("_selectionChangeDebounced")),200),this.decorate("show")}init(){const e=this.editor,t=e.model.document.selection;this.listenTo(this.focusTracker,"change:isFocused",((e,t,i)=>{const n=this._balloon.visibleView===this.toolbarView;!i&&n?this.hide():i&&this.show()})),this.listenTo(t,"change:range",((e,i)=>{(i.directChange||t.isCollapsed)&&this.hide(),this._fireSelectionChangeDebounced()})),this.listenTo(this,"_selectionChangeDebounced",(()=>{this.editor.editing.view.document.isFocused&&this.show()})),this._balloonConfig.shouldNotGroupWhenFull||this.listenTo(e,"ready",(()=>{const t=e.ui.view.editable.element;this._resizeObserver=new n.ResizeObserver(t,(e=>{this.toolbarView.maxWidth=dn(.9*e.contentRect.width)}))})),this.listenTo(this.toolbarView,"groupedItemsUpdate",(()=>{this._updatePosition()})),e.ui.once("ready",(()=>{this.toolbarView.fillFromConfig(this._balloonConfig,this.editor.ui.componentFactory)}))}_createToolbarView(){const e=this.editor.locale.t,t=!this._balloonConfig.shouldNotGroupWhenFull,i=new Ue(this.editor.locale,{shouldGroupWhenFull:t,isFloating:!0});return i.ariaLabel=e("Editor contextual toolbar"),i.render(),i}show(e=!1){const t=this.editor,i=t.model.document.selection,n=t.model.schema;this._balloon.hasView(this.toolbarView)||i.isCollapsed&&!e||function(e,t){return 1!==e.rangeCount&&[...e.getRanges()].every((e=>{const i=e.getContainedElement();return i&&t.isSelectable(i)}))}(i,n)||Array.from(this.toolbarView.items).every((e=>void 0!==e.isEnabled&&!e.isEnabled))||(this.listenTo(this.editor.ui,"update",(()=>{this._updatePosition()})),this._balloon.add({view:this.toolbarView,position:this._getBalloonPositionData(),balloonClassName:"ck-toolbar-container"}))}hide(){this._balloon.hasView(this.toolbarView)&&(this.stopListening(this.editor.ui,"update"),this._balloon.remove(this.toolbarView))}_getBalloonPositionData(){const e=this.editor.editing.view,t=e.document,i=t.selection,o=t.selection.isBackward;return{target:()=>{const t=o?i.getFirstRange():i.getLastRange(),s=n.Rect.getDomRangeRects(e.domConverter.viewRangeToDom(t));return o?s[0]:(s.length>1&&0===s[s.length-1].width&&s.pop(),s[s.length-1])},positions:this._getBalloonPositions(o)}}_updatePosition(){this._balloon.updatePosition(this._getBalloonPositionData())}destroy(){super.destroy(),this.stopListening(),this._fireSelectionChangeDebounced.cancel(),this.toolbarView.destroy(),this.focusTracker.destroy(),this._resizeObserver&&this._resizeObserver.destroy()}_getBalloonPositions(e){const t=n.env.isSafari&&n.env.isiOS?Jt.generatePositions({heightOffset:Math.max(Jt.arrowHeightOffset,Math.round(20/n.global.window.visualViewport.scale))}):Jt.defaultPositions;return e?[t.northWestArrowSouth,t.northWestArrowSouthWest,t.northWestArrowSouthEast,t.northWestArrowSouthMiddleEast,t.northWestArrowSouthMiddleWest,t.southWestArrowNorth,t.southWestArrowNorthWest,t.southWestArrowNorthEast,t.southWestArrowNorthMiddleWest,t.southWestArrowNorthMiddleEast]:[t.southEastArrowNorth,t.southEastArrowNorthEast,t.southEastArrowNorthWest,t.southEastArrowNorthMiddleEast,t.southEastArrowNorthMiddleWest,t.northEastArrowSouth,t.northEastArrowSouthEast,t.northEastArrowSouthWest,t.northEastArrowSouthMiddleEast,t.northEastArrowSouthMiddleWest]}}const hn=(0,n.toUnit)("px");class mn extends N{constructor(e){super(e);const t=this.bindTemplate;this.isVisible=!1,this.isToggleable=!0,this.set("top",0),this.set("left",0),this.extendTemplate({attributes:{class:"ck-block-toolbar-button",style:{top:t.to("top",(e=>hn(e))),left:t.to("left",(e=>hn(e)))}}})}}const gn=(0,n.toUnit)("px");class fn extends M.Plugin{static get pluginName(){return"BlockToolbar"}constructor(e){super(e),this._resizeObserver=null,this._blockToolbarConfig=We(this.editor.config.get("blockToolbar")),this.toolbarView=this._createToolbarView(),this.panelView=this._createPanelView(),this.buttonView=this._createButtonView(),I({emitter:this.panelView,contextElements:[this.panelView.element,this.buttonView.element],activator:()=>this.panelView.isVisible,callback:()=>this._hidePanel()})}init(){const e=this.editor,t=e.t,i=t("Click to edit block"),n=t("Drag to move"),o=t("Edit block"),s=e.plugins.has("DragDropBlockToolbar"),r=s?`${i}\n${n}`:o;this.buttonView.label=r,s&&(this.buttonView.element.dataset.ckeTooltipClass="ck-tooltip_multi-line"),this.listenTo(e.model.document.selection,"change:range",((e,t)=>{t.directChange&&this._hidePanel()})),this.listenTo(e.ui,"update",(()=>this._updateButton())),this.listenTo(e,"change:isReadOnly",(()=>this._updateButton()),{priority:"low"}),this.listenTo(e.ui.focusTracker,"change:isFocused",(()=>this._updateButton())),this.listenTo(this.buttonView,"change:isVisible",((e,t,i)=>{i?this.buttonView.listenTo(window,"resize",(()=>this._updateButton())):(this.buttonView.stopListening(window,"resize"),this._hidePanel())})),this._repositionButtonOnScroll(),e.ui.addToolbar(this.toolbarView,{beforeFocus:()=>this._showPanel(),afterBlur:()=>this._hidePanel()}),e.ui.once("ready",(()=>{this.toolbarView.fillFromConfig(this._blockToolbarConfig,this.editor.ui.componentFactory);for(const e of this.toolbarView.items)e.on("execute",(()=>this._hidePanel(!0)),{priority:"high"})}))}destroy(){super.destroy(),this.panelView.destroy(),this.buttonView.destroy(),this.toolbarView.destroy(),this._resizeObserver&&this._resizeObserver.destroy()}_createToolbarView(){const e=this.editor.locale.t,t=!this._blockToolbarConfig.shouldNotGroupWhenFull,i=new Ue(this.editor.locale,{shouldGroupWhenFull:t,isFloating:!0});return i.ariaLabel=e("Editor block content toolbar"),i}_createPanelView(){const e=this.editor,t=new Jt(e.locale);return t.content.add(this.toolbarView),t.class="ck-toolbar-container",e.ui.view.body.add(t),e.ui.focusTracker.add(t.element),this.toolbarView.keystrokes.set("Esc",((e,t)=>{this._hidePanel(!0),t()})),t}_createButtonView(){const e=this.editor,t=e.t,i=new mn(e.locale),n=this._blockToolbarConfig.icon,o=He[n]||n||He.dragIndicator;return i.set({label:t("Edit block"),icon:o,withText:!1}),i.bind("isOn").to(this.panelView,"isVisible"),i.bind("tooltip").to(this.panelView,"isVisible",(e=>!e)),this.listenTo(i,"execute",(()=>{this.panelView.isVisible?this._hidePanel(!0):this._showPanel()})),e.ui.view.body.add(i),e.ui.focusTracker.add(i.element),i}_updateButton(){const e=this.editor,t=e.model,i=e.editing.view;if(!e.ui.focusTracker.isFocused)return void this._hideButton();if(!e.model.canEditAt(e.model.document.selection))return void this._hideButton();const n=Array.from(t.document.selection.getSelectedBlocks())[0];if(!n||Array.from(this.toolbarView.items).every((e=>!e.isEnabled)))return void this._hideButton();const o=i.domConverter.mapViewToDom(e.editing.mapper.toViewElement(n));this.buttonView.isVisible=!0,this._setupToolbarResize(),this._attachButtonToElement(o),this.panelView.isVisible&&this._showPanel()}_hideButton(){this.buttonView.isVisible=!1}_showPanel(){if(!this.buttonView.isVisible)return;const e=this.panelView.isVisible;this.panelView.show();const t=this._getSelectedEditableElement();this.toolbarView.maxWidth=this._getToolbarMaxWidth(t),this.panelView.pin({target:this.buttonView.element,limiter:t}),e||this.toolbarView.items.get(0).focus()}_getSelectedEditableElement(){const e=this.editor.model.document.selection.getFirstRange().root.rootName;return this.editor.ui.getEditableElement(e)}_hidePanel(e){this.panelView.isVisible=!1,e&&this.editor.editing.view.focus()}_repositionButtonOnScroll(){const{buttonView:e}=this;let t=!1;const i=()=>{t||(t=!0,n.global.window.requestAnimationFrame((()=>{this._updateButton(),t=!1})))};e.on("change:isVisible",((t,o,s)=>{s?e.listenTo(n.global.document,"scroll",i,{useCapture:!0,usePassive:!0}):e.stopListening(n.global.document,"scroll",i)}))}_attachButtonToElement(e){const t=this.buttonView.element,i=this._getSelectedEditableElement(),o=window.getComputedStyle(e),s=new n.Rect(i),r=parseInt(o.paddingTop,10),a=parseInt(o.lineHeight,10)||1.2*parseInt(o.fontSize,10),l=new n.Rect(t),c=new n.Rect(e);let d;d="ltr"===this.editor.locale.uiLanguageDirection?s.left-l.width:s.right;const u=c.top+r+(a-l.height)/2;l.moveTo(d,u);const h=l.toAbsoluteRect();this.buttonView.top=h.top,this.buttonView.left=h.left,this._clipButtonToViewport(this.buttonView,i)}_clipButtonToViewport(e,t){const i=new n.Rect(e.element),o=new n.Rect(t).getVisible(),s=(...t)=>{e.element.style.clipPath=t.length?`polygon(${t.join(",")})`:""},r=t=>{e.isEnabled=!t,e.element.style.pointerEvents=t?"none":""};if(o&&o.bottom<i.bottom){const e=Math.min(i.height,i.bottom-o.bottom);r(e>=i.height),s("0 0","100% 0",`100% calc(100% - ${gn(e)})`,`0 calc(100% - ${gn(e)}`)}else if(o&&o.top>i.top){const e=Math.min(i.height,o.top-i.top);r(e>=i.height),s(`0 ${gn(e)}`,`100% ${gn(e)}`,"100% 100%","0 100%")}else r(!1),s()}_setupToolbarResize(){const e=this._getSelectedEditableElement();this._blockToolbarConfig.shouldNotGroupWhenFull||(this._resizeObserver&&this._resizeObserver.element!==e&&(this._resizeObserver.destroy(),this._resizeObserver=null),this._resizeObserver||(this._resizeObserver=new n.ResizeObserver(e,(()=>{this.toolbarView.maxWidth=this._getToolbarMaxWidth(e)}))))}_getToolbarMaxWidth(e){const t=new n.Rect(e),i=new n.Rect(this.buttonView.element),o="rtl"===this.editor.locale.uiLanguageDirection?i.left-t.right+i.width:t.left-i.left;return gn(t.width+o)}}class pn extends X{constructor(e){super(e);const t=this.bindTemplate;this.set({withText:!0,role:"menuitem"}),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__button"],"aria-haspopup":!0,"aria-expanded":this.bindTemplate.to("isOn",(e=>String(e))),"data-cke-tooltip-disabled":t.to("isOn")},on:{mouseenter:t.to("mouseenter")}})}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new L;return e.content=me,e.extendTemplate({attributes:{class:"ck-menu-bar__menu__button__arrow"}}),e}}class bn extends P{constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!1),this.set("position","se"),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-menu-bar__menu__panel",t.to("position",(e=>`ck-menu-bar__menu__panel_position_${e}`)),t.if("isVisible","ck-hidden",(e=>!e))],tabindex:"-1"},children:this.children,on:{selectstart:t.to((e=>{"input"!==e.target.tagName.toLocaleLowerCase()&&e.preventDefault()}))}})}focus(e=1){this.children.length&&(1===e?this.children.first.focus():this.children.last.focus())}}class wn extends P{constructor(e){super(e);const t=this.bindTemplate;this.buttonView=new pn(e),this.buttonView.delegate("mouseenter").to(this),this.buttonView.bind("isOn","isEnabled").to(this,"isOpen","isEnabled"),this.panelView=new bn(e),this.panelView.bind("isVisible").to(this,"isOpen"),this.keystrokes=new n.KeystrokeHandler,this.focusTracker=new n.FocusTracker,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("panelPosition","w"),this.set("class",void 0),this.set("parentMenuView",null),this.setTemplate({tag:"div",attributes:{class:["ck","ck-menu-bar__menu",t.to("class"),t.if("isEnabled","ck-disabled",(e=>!e)),t.if("parentMenuView","ck-menu-bar__menu_top-level",(e=>!e))]},children:[this.buttonView,this.panelView]})}render(){super.render(),this.focusTracker.add(this.buttonView.element),this.focusTracker.add(this.panelView.element),this.keystrokes.listenTo(this.element),fi.closeOnEscKey(this),this._repositionPanelOnOpen()}_attachBehaviors(){this.parentMenuView?(fi.openOnButtonClick(this),fi.openOnArrowRightKey(this),fi.closeOnArrowLeftKey(this),fi.closeOnParentClose(this)):(this._propagateArrowKeystrokeEvents(),fi.openAndFocusPanelOnArrowDownKey(this),fi.toggleOnButtonClick(this))}_propagateArrowKeystrokeEvents(){this.keystrokes.set("arrowright",((e,t)=>{this.fire("arrowright"),t()})),this.keystrokes.set("arrowleft",((e,t)=>{this.fire("arrowleft"),t()}))}_repositionPanelOnOpen(){this.on("change:isOpen",((e,t,i)=>{if(!i)return;const n=wn._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions});this.panelView.position=n?n.name:this._panelPositions[0].name}))}focus(){this.buttonView.focus()}get _panelPositions(){const{southEast:e,southWest:t,northEast:i,northWest:n,westSouth:o,eastSouth:s,westNorth:r,eastNorth:a}=pi;return"ltr"===this.locale.uiLanguageDirection?this.parentMenuView?[s,a,o,r]:[e,t,i,n]:this.parentMenuView?[o,r,s,a]:[t,e,n,i]}}wn._getOptimalPosition=n.getOptimalPosition;const vn=wn;class _n extends Je{constructor(e){super(e),this.role="menu",this.items.on("change",this._setItemsCheckSpace.bind(this))}_setItemsCheckSpace(){const e=Array.from(this.items).some((e=>{const t=yn(e);return t&&t.isToggleable}));this.items.forEach((t=>{const i=yn(t);i&&(i.hasCheckSpace=e)}))}}function yn(e){return e instanceof Ke?e.children.map((e=>function(e){return"object"==typeof e&&"buttonView"in e&&e.buttonView instanceof N}(e)?e.buttonView:e)).find((e=>e instanceof X)):null}class kn extends de{constructor(e){super(e),this.set({withText:!0,withKeystroke:!0,tooltip:!1,role:"menuitem"}),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item__button"]}})}}const Cn=["mouseenter","arrowleft","arrowright","change:isOpen"];class An extends P{constructor(e){super(e),this.menus=[];const t=e.t,i=this.bindTemplate;this.set({isOpen:!1,isFocusBorderEnabled:!1}),this._setupIsOpenUpdater(),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-menu-bar",i.if("isFocusBorderEnabled","ck-menu-bar_focus-border-enabled")],"aria-label":t("Editor menu bar"),role:"menubar"},children:this.children})}fillFromConfig(e,t,i=[]){const n=vi({normalizedConfig:e,locale:this.locale,componentFactory:t,extraItems:i}).items.map((e=>this._createMenu({componentFactory:t,menuDefinition:e})));this.children.addMany(n)}render(){super.render(),gi.toggleMenusAndFocusItemsOnHover(this),gi.closeMenusWhenTheBarCloses(this),gi.closeMenuWhenAnotherOnTheSameLevelOpens(this),gi.focusCycleMenusOnArrows(this),gi.closeOnClickOutside(this),gi.enableFocusHighlightOnInteraction(this)}focus(){this.children.first&&this.children.first.focus()}close(){for(const e of this.children)e.isOpen=!1}registerMenu(e,t=null){t?(e.delegate(...Cn).to(t),e.parentMenuView=t):e.delegate(...Cn).to(this,(e=>"menu:"+e)),e._attachBehaviors(),this.menus.push(e)}_createMenu({componentFactory:e,menuDefinition:t,parentMenuView:i}){const n=this.locale,o=new vn(n);return this.registerMenu(o,i),o.buttonView.set({label:t.label}),o.once("change:isOpen",(()=>{const i=new _n(n);i.ariaLabel=t.label,o.panelView.children.add(i),i.items.addMany(this._createMenuItems({menuDefinition:t,parentMenuView:o,componentFactory:e}))})),o}_createMenuItems({menuDefinition:e,parentMenuView:t,componentFactory:i}){const n=this.locale,o=[];for(const s of e.groups){for(const e of s.items){const s=new hi(n,t);if((0,r.A)(e))s.children.add(this._createMenu({componentFactory:i,menuDefinition:e,parentMenuView:t}));else{const n=this._createMenuItemContentFromFactory({componentName:e,componentFactory:i,parentMenuView:t});if(!n)continue;s.children.add(n)}o.push(s)}s!==e.groups[e.groups.length-1]&&o.push(new Ge(n))}return o}_createMenuItemContentFromFactory({componentName:e,parentMenuView:t,componentFactory:i}){const o=i.create(e);return o instanceof vn||o instanceof te||o instanceof kn?(this._registerMenuTree(o,t),o.on("execute",(()=>{this.close()})),o):((0,n.logWarning)("menu-bar-component-unsupported",{componentName:e,componentView:o}),null)}_registerMenuTree(e,t){if(!(e instanceof vn))return void e.delegate("mouseenter").to(t);this.registerMenu(e,t);const i=e.panelView.children.filter((e=>e instanceof _n))[0];if(!i)return void e.delegate("mouseenter").to(t);const n=i.items.filter((e=>e instanceof Ke));for(const t of n)this._registerMenuTree(t.children.get(0),e)}_setupIsOpenUpdater(){let e;this.on("menu:change:isOpen",((t,i,n)=>{clearTimeout(e),n?this.isOpen=!0:e=setTimeout((()=>{this.isOpen=Array.from(this.children).some((e=>e.isOpen))}),0)}))}}},8511:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Undo:()=>m,UndoEditing:()=>d,UndoUI:()=>h});var n=i(1024),o=i(151);class s extends n.Command{constructor(e){super(e),this._stack=[],this._createdBatches=new WeakSet,this.refresh(),this._isEnabledBasedOnSelection=!1,this.listenTo(e.data,"set",((e,t)=>{t[1]={...t[1]};const i=t[1];i.batchType||(i.batchType={isUndoable:!1})}),{priority:"high"}),this.listenTo(e.data,"set",((e,t)=>{t[1].batchType.isUndoable||this.clearStack()}))}refresh(){this.isEnabled=this._stack.length>0}get createdBatches(){return this._createdBatches}addBatch(e){const t=this.editor.model.document.selection,i={ranges:t.hasOwnRange?Array.from(t.getRanges()):[],isBackward:t.isBackward};this._stack.push({batch:e,selection:i}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(e,t,i){const n=this.editor.model,o=n.document,s=[],l=e.map((e=>e.getTransformedByOperations(i))),c=l.flat();for(const e of l){const t=e.filter((e=>e.root!=o.graveyard)).filter((e=>!a(e,c)));t.length&&(r(t),s.push(t[0]))}s.length&&n.change((e=>{e.setSelection(s,{backward:t})}))}_undo(e,t){const i=this.editor.model,n=i.document;this._createdBatches.add(t);const s=e.operations.slice().filter((e=>e.isDocumentOperation));s.reverse();for(const e of s){const s=e.baseVersion+1,r=Array.from(n.history.getOperations(s)),a=(0,o.transformSets)([e.getReversed()],r,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(let s of a){const r=s.affectedSelectable;r&&!i.canEditAt(r)&&(s=new o.NoOperation(s.baseVersion)),t.addOperation(s),i.applyOperation(s),n.history.setOperationAsUndone(e,s)}}}}function r(e){e.sort(((e,t)=>e.start.isBefore(t.start)?-1:1));for(let t=1;t<e.length;t++){const i=e[t-1].getJoined(e[t],!0);i&&(t--,e.splice(t,2,i))}}function a(e,t){return t.some((t=>t!==e&&t.containsRange(e,!0)))}class l extends s{execute(e=null){const t=e?this._stack.findIndex((t=>t.batch==e)):this._stack.length-1,i=this._stack.splice(t,1)[0],n=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(n,(()=>{this._undo(i.batch,n);const e=this.editor.model.document.history.getOperations(i.batch.baseVersion);this._restoreSelection(i.selection.ranges,i.selection.isBackward,e)})),this.fire("revert",i.batch,n),this.refresh()}}class c extends s{execute(){const e=this._stack.pop(),t=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(t,(()=>{const i=e.batch.operations[e.batch.operations.length-1].baseVersion+1,n=this.editor.model.document.history.getOperations(i);this._restoreSelection(e.selection.ranges,e.selection.isBackward,n),this._undo(e.batch,t)})),this.refresh()}}class d extends n.Plugin{constructor(){super(...arguments),this._batchRegistry=new WeakSet}static get pluginName(){return"UndoEditing"}init(){const e=this.editor,t=e.t;this._undoCommand=new l(e),this._redoCommand=new c(e),e.commands.add("undo",this._undoCommand),e.commands.add("redo",this._redoCommand),this.listenTo(e.model,"applyOperation",((e,t)=>{const i=t[0];if(!i.isDocumentOperation)return;const n=i.batch,o=this._redoCommand.createdBatches.has(n),s=this._undoCommand.createdBatches.has(n);this._batchRegistry.has(n)||(this._batchRegistry.add(n),n.isUndoable&&(o?this._undoCommand.addBatch(n):s||(this._undoCommand.addBatch(n),this._redoCommand.clearStack())))}),{priority:"highest"}),this.listenTo(this._undoCommand,"revert",((e,t,i)=>{this._redoCommand.addBatch(i)})),e.keystrokes.set("CTRL+Z","undo"),e.keystrokes.set("CTRL+Y","redo"),e.keystrokes.set("CTRL+SHIFT+Z","redo"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Undo"),keystroke:"CTRL+Z"},{label:t("Redo"),keystroke:[["CTRL+Y"],["CTRL+SHIFT+Z"]]}]})}}var u=i(7243);class h extends n.Plugin{static get pluginName(){return"UndoUI"}init(){const e=this.editor,t=e.locale,i=e.t,o="ltr"==t.uiLanguageDirection?n.icons.undo:n.icons.redo,s="ltr"==t.uiLanguageDirection?n.icons.redo:n.icons.undo;this._addButtonsToFactory("undo",i("Undo"),"CTRL+Z",o),this._addButtonsToFactory("redo",i("Redo"),"CTRL+Y",s)}_addButtonsToFactory(e,t,i,n){const o=this.editor;o.ui.componentFactory.add(e,(()=>{const o=this._createButton(u.ButtonView,e,t,i,n);return o.set({tooltip:!0}),o})),o.ui.componentFactory.add("menuBar:"+e,(()=>this._createButton(u.MenuBarMenuListItemButtonView,e,t,i,n)))}_createButton(e,t,i,n,o){const s=this.editor,r=s.locale,a=s.commands.get(t),l=new e(r);return l.set({label:i,icon:o,keystroke:n}),l.bind("isEnabled").to(a,"isEnabled"),this.listenTo(l,"execute",(()=>{s.execute(t),s.editing.view.focus()})),l}}class m extends n.Plugin{static get requires(){return[d,h]}static get pluginName(){return"Undo"}}},4857:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Base64UploadAdapter:()=>l,FileRepository:()=>r,SimpleUploadAdapter:()=>d});var n=i(1024),o=i(7906);class s extends((0,o.ObservableMixin)()){constructor(){super();const e=new window.FileReader;this._reader=e,this._data=void 0,this.set("loaded",0),e.onprogress=e=>{this.loaded=e.loaded}}get error(){return this._reader.error}get data(){return this._data}read(e){const t=this._reader;return this.total=e.size,new Promise(((i,n)=>{t.onload=()=>{const e=t.result;this._data=e,i(e)},t.onerror=()=>{n("error")},t.onabort=()=>{n("aborted")},this._reader.readAsDataURL(e)}))}abort(){this._reader.abort()}}class r extends n.Plugin{constructor(){super(...arguments),this.loaders=new o.Collection,this._loadersMap=new Map,this._pendingAction=null}static get pluginName(){return"FileRepository"}static get requires(){return[n.PendingActions]}init(){this.loaders.on("change",(()=>this._updatePendingAction())),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",((e,t)=>t?e/t*100:0))}getLoader(e){return this._loadersMap.get(e)||null}createLoader(e){if(!this.createUploadAdapter)return(0,o.logWarning)("filerepository-no-upload-adapter"),null;const t=new a(Promise.resolve(e),this.createUploadAdapter);return this.loaders.add(t),this._loadersMap.set(e,t),e instanceof Promise&&t.file.then((e=>{this._loadersMap.set(e,t)})).catch((()=>{})),t.on("change:uploaded",(()=>{let e=0;for(const t of this.loaders)e+=t.uploaded;this.uploaded=e})),t.on("change:uploadTotal",(()=>{let e=0;for(const t of this.loaders)t.uploadTotal&&(e+=t.uploadTotal);this.uploadTotal=e})),t}destroyLoader(e){const t=e instanceof a?e:this.getLoader(e);t._destroy(),this.loaders.remove(t),this._loadersMap.forEach(((e,i)=>{e===t&&this._loadersMap.delete(i)}))}_updatePendingAction(){const e=this.editor.plugins.get(n.PendingActions);if(this.loaders.length){if(!this._pendingAction){const t=this.editor.t,i=e=>`${t("Upload in progress")} ${parseInt(e)}%.`;this._pendingAction=e.add(i(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",i)}}else e.remove(this._pendingAction),this._pendingAction=null}}class a extends((0,o.ObservableMixin)()){constructor(e,t){super(),this.id=(0,o.uid)(),this._filePromiseWrapper=this._createFilePromiseWrapper(e),this._adapter=t(this),this._reader=new s,this.set("status","idle"),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",((e,t)=>t?e/t*100:0)),this.set("uploadResponse",null)}get file(){return this._filePromiseWrapper?this._filePromiseWrapper.promise.then((e=>this._filePromiseWrapper?e:null)):Promise.resolve(null)}get data(){return this._reader.data}read(){if("idle"!=this.status)throw new o.CKEditorError("filerepository-read-wrong-status",this);return this.status="reading",this.file.then((e=>this._reader.read(e))).then((e=>{if("reading"!==this.status)throw this.status;return this.status="idle",e})).catch((e=>{if("aborted"===e)throw this.status="aborted","aborted";throw this.status="error",this._reader.error?this._reader.error:e}))}upload(){if("idle"!=this.status)throw new o.CKEditorError("filerepository-upload-wrong-status",this);return this.status="uploading",this.file.then((()=>this._adapter.upload())).then((e=>(this.uploadResponse=e,this.status="idle",e))).catch((e=>{if("aborted"===this.status)throw"aborted";throw this.status="error",e}))}abort(){const e=this.status;this.status="aborted",this._filePromiseWrapper.isFulfilled?"reading"==e?this._reader.abort():"uploading"==e&&this._adapter.abort&&this._adapter.abort():(this._filePromiseWrapper.promise.catch((()=>{})),this._filePromiseWrapper.rejecter("aborted")),this._destroy()}_destroy(){this._filePromiseWrapper=void 0,this._reader=void 0,this._adapter=void 0,this.uploadResponse=void 0}_createFilePromiseWrapper(e){const t={};return t.promise=new Promise(((i,n)=>{t.rejecter=n,t.isFulfilled=!1,e.then((e=>{t.isFulfilled=!0,i(e)})).catch((e=>{t.isFulfilled=!0,n(e)}))})),t}}class l extends n.Plugin{static get requires(){return[r]}static get pluginName(){return"Base64UploadAdapter"}init(){this.editor.plugins.get(r).createUploadAdapter=e=>new c(e)}}class c{constructor(e){this.loader=e}upload(){return new Promise(((e,t)=>{const i=this.reader=new window.FileReader;i.addEventListener("load",(()=>{e({default:i.result})})),i.addEventListener("error",(e=>{t(e)})),i.addEventListener("abort",(()=>{t()})),this.loader.file.then((e=>{i.readAsDataURL(e)}))}))}abort(){this.reader.abort()}}class d extends n.Plugin{static get requires(){return[r]}static get pluginName(){return"SimpleUploadAdapter"}init(){const e=this.editor.config.get("simpleUpload");e&&(e.uploadUrl?this.editor.plugins.get(r).createUploadAdapter=t=>new u(t,e):(0,o.logWarning)("simple-upload-adapter-missing-uploadurl"))}}class u{constructor(e,t){this.loader=e,this.options=t}upload(){return this.loader.file.then((e=>new Promise(((t,i)=>{this._initRequest(),this._initListeners(t,i,e),this._sendRequest(e)}))))}abort(){this.xhr&&this.xhr.abort()}_initRequest(){const e=this.xhr=new XMLHttpRequest;e.open("POST",this.options.uploadUrl,!0),e.responseType="json"}_initListeners(e,t,i){const n=this.xhr,o=this.loader,s=`Couldn't upload file: ${i.name}.`;n.addEventListener("error",(()=>t(s))),n.addEventListener("abort",(()=>t())),n.addEventListener("load",(()=>{const i=n.response;if(!i||i.error)return t(i&&i.error&&i.error.message?i.error.message:s);const o=i.url?{default:i.url}:i.urls;e({...i,urls:o})})),n.upload&&n.upload.addEventListener("progress",(e=>{e.lengthComputable&&(o.uploadTotal=e.total,o.uploaded=e.loaded)}))}_sendRequest(e){const t=this.options.headers||{},i=this.options.withCredentials||!1;for(const e of Object.keys(t))this.xhr.setRequestHeader(e,t[e]);this.xhr.withCredentials=i;const n=new FormData;n.append("upload",e),this.xhr.send(n)}}},7906:(e,t,i)=>{"use strict";let n;i.r(t),i.d(t,{CKEditorError:()=>P,Collection:()=>St,Config:()=>_e,DomEmitterMixin:()=>xe,ElementReplacer:()=>ae,EmitterMixin:()=>z,EventInfo:()=>k,FocusTracker:()=>Rt,KeystrokeHandler:()=>Bt,Locale:()=>It,ObservableMixin:()=>te,Rect:()=>Fe,ResizeObserver:()=>Ue,abortableDebounce:()=>le,compareArrays:()=>de,count:()=>ce,createElement:()=>pe,delay:()=>zt,diff:()=>v,diffToChanges:()=>_,env:()=>a,exponentialDelay:()=>Ft,fastDiff:()=>p,findClosestScrollableAncestor:()=>Ie,first:()=>Vt,getAncestors:()=>Se,getBorderWidths:()=>Re,getCode:()=>wt,getDataFromElement:()=>Ve,getEnvKeystrokeText:()=>_t,getLanguageDirection:()=>xt,getLocalizedArrowKeyCodeDirection:()=>kt,getOptimalPosition:()=>Ye,global:()=>o,indexOf:()=>qe,insertAt:()=>Ke,insertToPriorityArray:()=>x,isArrowKeyCode:()=>yt,isCombiningMark:()=>Ht,isComment:()=>Ge,isForwardArrowKeyCode:()=>Ct,isHighSurrogateHalf:()=>Ut,isInsideCombinedSymbol:()=>qt,isInsideEmojiSequence:()=>Gt,isInsideSurrogatePair:()=>jt,isIterable:()=>ue,isLowSurrogateHalf:()=>$t,isNode:()=>Ce,isRange:()=>Me,isText:()=>Be,isValidAttributeName:()=>Ze,isVisible:()=>Je,keyCodes:()=>pt,logError:()=>S,logWarning:()=>I,mix:()=>y,parseKeystroke:()=>vt,priorities:()=>E,releaseDate:()=>O,remove:()=>tt,retry:()=>Lt,scrollAncestorsToShowTarget:()=>nt,scrollViewportToShowTarget:()=>it,setDataInElement:()=>$e,spliceArray:()=>Dt,toArray:()=>Tt,toMap:()=>Mt,toUnit:()=>je,uid:()=>A,verifyLicense:()=>Wt,version:()=>M,wait:()=>Ot});try{n={window,document}}catch(e){n={window:{},document:{}}}const o=n;function s(){try{return navigator.userAgent.toLowerCase()}catch(e){return""}}const r=s(),a={isMac:l(r),isWindows:c(r),isGecko:d(r),isSafari:u(r),isiOS:h(r),isAndroid:m(r),isBlink:g(r),get isMediaForcedColors(){return!!o.window.matchMedia&&o.window.matchMedia("(forced-colors: active)").matches},get isMotionReduced(){return!!o.window.matchMedia&&o.window.matchMedia("(prefers-reduced-motion)").matches},features:{isRegExpUnicodePropertySupported:f()}};function l(e){return e.indexOf("macintosh")>-1}function c(e){return e.indexOf("windows")>-1}function d(e){return!!e.match(/gecko\/\d+/)}function u(e){return e.indexOf(" applewebkit/")>-1&&-1===e.indexOf("chrome")}function h(e){return!!e.match(/iphone|ipad/i)||l(e)&&navigator.maxTouchPoints>0}function m(e){return e.indexOf("android")>-1}function g(e){return e.indexOf("chrome/")>-1&&e.indexOf("edge/")<0}function f(){let e=!1;try{e=0==="ć".search(new RegExp("[\\p{L}]","u"))}catch(e){}return e}function p(e,t,i,n){i=i||function(e,t){return e===t};const o=Array.isArray(e)?e:Array.prototype.slice.call(e),s=Array.isArray(t)?t:Array.prototype.slice.call(t),r=function(e,t,i){const n=b(e,t,i);if(-1===n)return{firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};const o=b(w(e,n),w(t,n),i);return{firstIndex:n,lastIndexOld:e.length-o,lastIndexNew:t.length-o}}(o,s,i),a=n?function(e,t){const{firstIndex:i,lastIndexOld:n,lastIndexNew:o}=e;if(-1===i)return Array(t).fill("equal");let s=[];return i>0&&(s=s.concat(Array(i).fill("equal"))),o-i>0&&(s=s.concat(Array(o-i).fill("insert"))),n-i>0&&(s=s.concat(Array(n-i).fill("delete"))),o<t&&(s=s.concat(Array(t-o).fill("equal"))),s}(r,s.length):function(e,t){const i=[],{firstIndex:n,lastIndexOld:o,lastIndexNew:s}=t;return s-n>0&&i.push({index:n,type:"insert",values:e.slice(n,s)}),o-n>0&&i.push({index:n+(s-n),type:"delete",howMany:o-n}),i}(s,r);return a}function b(e,t,i){for(let n=0;n<Math.max(e.length,t.length);n++)if(void 0===e[n]||void 0===t[n]||!i(e[n],t[n]))return n;return-1}function w(e,t){return e.slice(t).reverse()}function v(e,t,i){i=i||function(e,t){return e===t};const n=e.length,o=t.length;if(n>200||o>200||n+o>300)return v.fastDiff(e,t,i,!0);let s,r;if(o<n){const i=e;e=t,t=i,s="delete",r="insert"}else s="insert",r="delete";const a=e.length,l=t.length,c=l-a,d={},u={};function h(n){const o=(void 0!==u[n-1]?u[n-1]:-1)+1,c=void 0!==u[n+1]?u[n+1]:-1,h=o>c?-1:1;d[n+h]&&(d[n]=d[n+h].slice(0)),d[n]||(d[n]=[]),d[n].push(o>c?s:r);let m=Math.max(o,c),g=m-n;for(;g<a&&m<l&&i(e[g],t[m]);)g++,m++,d[n].push("equal");return m}let m,g=0;do{for(m=-g;m<c;m++)u[m]=h(m);for(m=c+g;m>c;m--)u[m]=h(m);u[c]=h(c),g++}while(u[c]!==l);return d[c].slice(1)}function _(e,t){const i=[];let n=0,o=null;return e.forEach((e=>{"equal"==e?(s(),n++):"insert"==e?(o&&"insert"==o.type?o.values.push(t[n]):(s(),o={type:"insert",index:n,values:[t[n]]}),n++):o&&"delete"==o.type?o.howMany++:(s(),o={type:"delete",index:n,howMany:1})})),s(),i;function s(){o&&(i.push(o),o=null)}}function y(e,...t){t.forEach((t=>{const i=Object.getOwnPropertyNames(t),n=Object.getOwnPropertySymbols(t);i.concat(n).forEach((i=>{if(i in e.prototype)return;if("function"==typeof t&&("length"==i||"name"==i||"prototype"==i))return;const n=Object.getOwnPropertyDescriptor(t,i);n.enumerable=!1,Object.defineProperty(e.prototype,i,n)}))}))}v.fastDiff=p;class k{constructor(e,t){this.source=e,this.name=t,this.path=[],this.stop=function e(){e.called=!0},this.off=function e(){e.called=!0}}}const C=new Array(256).fill("").map(((e,t)=>("0"+t.toString(16)).slice(-2)));function A(){const e=4294967296*Math.random()>>>0,t=4294967296*Math.random()>>>0,i=4294967296*Math.random()>>>0,n=4294967296*Math.random()>>>0;return"e"+C[e>>0&255]+C[e>>8&255]+C[e>>16&255]+C[e>>24&255]+C[t>>0&255]+C[t>>8&255]+C[t>>16&255]+C[t>>24&255]+C[i>>0&255]+C[i>>8&255]+C[i>>16&255]+C[i>>24&255]+C[n>>0&255]+C[n>>8&255]+C[n>>16&255]+C[n>>24&255]}const E={get(e="normal"){return"number"!=typeof e?this[e]||this.normal:e},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5};function x(e,t){const i=E.get(t.priority);for(let n=0;n<e.length;n++)if(E.get(e[n].priority)<i)return void e.splice(n,0,t);e.push(t)}const T="https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html";class P extends Error{constructor(e,t,i){super(function(e,t){const i=new WeakSet;return e+(t?` ${JSON.stringify(t,((e,t)=>{if("object"==typeof t&&null!==t){if(i.has(t))return`[object ${t.constructor.name}]`;i.add(t)}return t}))}`:"")+V(e)}(e,i)),this.name="CKEditorError",this.context=t,this.data=i}is(e){return"CKEditorError"===e}static rethrowUnexpectedError(e,t){if(e.is&&e.is("CKEditorError"))throw e;const i=new P(e.message,t);throw i.stack=e.stack,i}}function I(e,t){console.warn(...R(e,t))}function S(e,t){console.error(...R(e,t))}function V(e){return`\nRead more: ${T}#error-${e}`}function R(e,t){const i=V(e);return t?[e,t,i]:[e,i]}const B="43.0.0",M=B,O=new Date(2024,7,7);if(globalThis.CKEDITOR_VERSION)throw new P("ckeditor-duplicated-modules",null);globalThis.CKEDITOR_VERSION=B;const L=Symbol("listeningTo"),F=Symbol("emitterId"),N=Symbol("delegations"),D=z(Object);function z(e){return e?class extends e{on(e,t,i){this.listenTo(this,e,t,i)}once(e,t,i){let n=!1;this.listenTo(this,e,((e,...i)=>{n||(n=!0,e.off(),t.call(this,e,...i))}),i)}off(e,t){this.stopListening(this,e,t)}listenTo(e,t,i,n={}){let o,s;this[L]||(this[L]={});const r=this[L];H(e)||W(e);const a=H(e);(o=r[a])||(o=r[a]={emitter:e,callbacks:{}}),(s=o.callbacks[t])||(s=o.callbacks[t]=[]),s.push(i),function(e,t,i,n,o){t._addEventListener?t._addEventListener(i,n,o):e._addEventListener.call(t,i,n,o)}(this,e,t,i,n)}stopListening(e,t,i){const n=this[L];let o=e&&H(e);const s=n&&o?n[o]:void 0,r=s&&t?s.callbacks[t]:void 0;if(!(!n||e&&!s||t&&!r))if(i)K(this,e,t,i),-1!==r.indexOf(i)&&(1===r.length?delete s.callbacks[t]:K(this,e,t,i));else if(r){for(;i=r.pop();)K(this,e,t,i);delete s.callbacks[t]}else if(s){for(t in s.callbacks)this.stopListening(e,t);delete n[o]}else{for(o in n)this.stopListening(n[o].emitter);delete this[L]}}fire(e,...t){try{const i=e instanceof k?e:new k(this,e),n=i.name;let o=j(this,n);if(i.path.push(this),o){const e=[i,...t];o=Array.from(o);for(let t=0;t<o.length&&(o[t].callback.apply(this,e),i.off.called&&(delete i.off.called,this._removeEventListener(n,o[t].callback)),!i.stop.called);t++);}const s=this[N];if(s){const e=s.get(n),o=s.get("*");e&&q(e,i,t),o&&q(o,i,t)}return i.return}catch(e){P.rethrowUnexpectedError(e,this)}}delegate(...e){return{to:(t,i)=>{this[N]||(this[N]=new Map),e.forEach((e=>{const n=this[N].get(e);n?n.set(t,i):this[N].set(e,new Map([[t,i]]))}))}}}stopDelegating(e,t){if(this[N])if(e)if(t){const i=this[N].get(e);i&&i.delete(t)}else this[N].delete(e);else this[N].clear()}_addEventListener(e,t,i){!function(e,t){const i=U(e);if(i[t])return;let n=t,o=null;const s=[];for(;""!==n&&!i[n];)i[n]={callbacks:[],childEvents:[]},s.push(i[n]),o&&i[n].childEvents.push(o),o=n,n=n.substr(0,n.lastIndexOf(":"));if(""!==n){for(const e of s)e.callbacks=i[n].callbacks.slice();i[n].childEvents.push(o)}}(this,e);const n=$(this,e),o={callback:t,priority:E.get(i.priority)};for(const e of n)x(e,o)}_removeEventListener(e,t){const i=$(this,e);for(const e of i)for(let i=0;i<e.length;i++)e[i].callback==t&&(e.splice(i,1),i--)}}:D}function W(e,t){e[F]||(e[F]=t||A())}function H(e){return e[F]}function U(e){return e._events||Object.defineProperty(e,"_events",{value:{}}),e._events}function $(e,t){const i=U(e)[t];if(!i)return[];let n=[i.callbacks];for(let t=0;t<i.childEvents.length;t++){const o=$(e,i.childEvents[t]);n=n.concat(o)}return n}function j(e,t){let i;return e._events&&(i=e._events[t])&&i.callbacks.length?i.callbacks:t.indexOf(":")>-1?j(e,t.substr(0,t.lastIndexOf(":"))):null}function q(e,t,i){for(let[n,o]of e){o?"function"==typeof o&&(o=o(t.name)):o=t.name;const e=new k(t.source,o);e.path=[...t.path],n.fire(e,...i)}}function K(e,t,i,n){t._removeEventListener?t._removeEventListener(i,n):e._removeEventListener.call(t,i,n)}["on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach((e=>{z[e]=D.prototype[e]}));var G=i(3149);const Z=Symbol("observableProperties"),J=Symbol("boundObservables"),Q=Symbol("boundProperties"),Y=Symbol("decoratedMethods"),X=Symbol("decoratedOriginal"),ee=te(z());function te(e){return e?class extends e{set(e,t){if((0,G.A)(e))return void Object.keys(e).forEach((t=>{this.set(t,e[t])}),this);ie(this);const i=this[Z];if(e in this&&!i.has(e))throw new P("observable-set-cannot-override",this);Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>i.get(e),set(t){const n=i.get(e);let o=this.fire(`set:${e}`,e,t,n);void 0===o&&(o=t),n===o&&i.has(e)||(i.set(e,o),this.fire(`change:${e}`,e,o,n))}}),this[e]=t}bind(...e){if(!e.length||!se(e))throw new P("observable-bind-wrong-properties",this);if(new Set(e).size!==e.length)throw new P("observable-bind-duplicate-properties",this);ie(this);const t=this[Q];e.forEach((e=>{if(t.has(e))throw new P("observable-bind-rebind",this)}));const i=new Map;return e.forEach((e=>{const n={property:e,to:[]};t.set(e,n),i.set(e,n)})),{to:ne,toMany:oe,_observable:this,_bindProperties:e,_to:[],_bindings:i}}unbind(...e){if(!this[Z])return;const t=this[Q],i=this[J];if(e.length){if(!se(e))throw new P("observable-unbind-wrong-properties",this);e.forEach((e=>{const n=t.get(e);n&&(n.to.forEach((([e,t])=>{const o=i.get(e),s=o[t];s.delete(n),s.size||delete o[t],Object.keys(o).length||(i.delete(e),this.stopListening(e,"change"))})),t.delete(e))}))}else i.forEach(((e,t)=>{this.stopListening(t,"change")})),i.clear(),t.clear()}decorate(e){ie(this);const t=this[e];if(!t)throw new P("observablemixin-cannot-decorate-undefined",this,{object:this,methodName:e});this.on(e,((e,i)=>{e.return=t.apply(this,i)})),this[e]=function(...t){return this.fire(e,t)},this[e][X]=t,this[Y]||(this[Y]=[]),this[Y].push(e)}stopListening(e,t,i){if(!e&&this[Y]){for(const e of this[Y])this[e]=this[e][X];delete this[Y]}super.stopListening(e,t,i)}}:ee}function ie(e){e[Z]||(Object.defineProperty(e,Z,{value:new Map}),Object.defineProperty(e,J,{value:new Map}),Object.defineProperty(e,Q,{value:new Map}))}function ne(...e){const t=function(...e){if(!e.length)throw new P("observable-bind-to-parse-error",null);const t={to:[]};let i;return"function"==typeof e[e.length-1]&&(t.callback=e.pop()),e.forEach((e=>{if("string"==typeof e)i.properties.push(e);else{if("object"!=typeof e)throw new P("observable-bind-to-parse-error",null);i={observable:e,properties:[]},t.to.push(i)}})),t}(...e),i=Array.from(this._bindings.keys()),n=i.length;if(!t.callback&&t.to.length>1)throw new P("observable-bind-to-no-callback",this);if(n>1&&t.callback)throw new P("observable-bind-to-extra-callback",this);var o;t.to.forEach((e=>{if(e.properties.length&&e.properties.length!==n)throw new P("observable-bind-to-properties-length",this);e.properties.length||(e.properties=this._bindProperties)})),this._to=t.to,t.callback&&(this._bindings.get(i[0]).callback=t.callback),o=this._observable,this._to.forEach((e=>{const t=o[J];let i;t.get(e.observable)||o.listenTo(e.observable,"change",((n,s)=>{i=t.get(e.observable)[s],i&&i.forEach((e=>{re(o,e.property)}))}))})),function(e){let t;e._bindings.forEach(((i,n)=>{e._to.forEach((o=>{t=o.properties[i.callback?0:e._bindProperties.indexOf(n)],i.to.push([o.observable,t]),function(e,t,i,n){const o=e[J],s=o.get(i),r=s||{};r[n]||(r[n]=new Set),r[n].add(t),s||o.set(i,r)}(e._observable,i,o.observable,t)}))}))}(this),this._bindProperties.forEach((e=>{re(this._observable,e)}))}function oe(e,t,i){if(this._bindings.size>1)throw new P("observable-bind-to-many-not-one-binding",this);this.to(...function(e,t){const i=e.map((e=>[e,t]));return Array.prototype.concat.apply([],i)}(e,t),i)}function se(e){return e.every((e=>"string"==typeof e))}function re(e,t){const i=e[Q].get(t);let n;i.callback?n=i.callback.apply(e,i.to.map((e=>e[0][e[1]]))):(n=i.to[0],n=n[0][n[1]]),Object.prototype.hasOwnProperty.call(e,t)?e[t]=n:e.set(t,n)}["set","bind","unbind","decorate","on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach((e=>{te[e]=ee.prototype[e]}));class ae{constructor(){this._replacedElements=[]}replace(e,t){this._replacedElements.push({element:e,newElement:t}),e.style.display="none",t&&e.parentNode.insertBefore(t,e.nextSibling)}restore(){this._replacedElements.forEach((({element:e,newElement:t})=>{e.style.display="",t&&t.remove()})),this._replacedElements=[]}}function le(e){let t=new AbortController;function i(...i){return t.abort(),t=new AbortController,e(t.signal,...i)}return i.abort=()=>t.abort(),i}function ce(e){let t=0;for(const i of e)t++;return t}function de(e,t){const i=Math.min(e.length,t.length);for(let n=0;n<i;n++)if(e[n]!=t[n])return n;return e.length==t.length?"same":e.length<t.length?"prefix":"extension"}function ue(e){return!(!e||!e[Symbol.iterator])}var he=i(2383),me=i(2049),ge=i(3098);const fe=function(e){return"string"==typeof e||!(0,me.A)(e)&&(0,ge.A)(e)&&"[object String]"==(0,he.A)(e)};function pe(e,t,i={},n=[]){const o=i&&i.xmlns,s=o?e.createElementNS(o,t):e.createElement(t);for(const e in i)s.setAttribute(e,i[e]);!fe(n)&&ue(n)||(n=[n]);for(let t of n)fe(t)&&(t=e.createTextNode(t)),s.appendChild(t);return s}var be=i(4963),we=i(3967),ve=i(1500);class _e{constructor(e,t){this._config={},t&&this.define(ye(t)),e&&this._setObjectToTarget(this._config,e)}set(e,t){this._setToTarget(this._config,e,t)}define(e,t){this._setToTarget(this._config,e,t,!0)}get(e){return this._getFromSource(this._config,e)}*names(){for(const e of Object.keys(this._config))yield e}_setToTarget(e,t,i,n=!1){if((0,be.A)(t))return void this._setObjectToTarget(e,t,n);const o=t.split(".");t=o.pop();for(const t of o)(0,be.A)(e[t])||(e[t]={}),e=e[t];if((0,be.A)(i))return(0,be.A)(e[t])||(e[t]={}),e=e[t],void this._setObjectToTarget(e,i,n);n&&void 0!==e[t]||(e[t]=i)}_getFromSource(e,t){const i=t.split(".");t=i.pop();for(const t of i){if(!(0,be.A)(e[t])){e=null;break}e=e[t]}return e?ye(e[t]):void 0}_setObjectToTarget(e,t,i){Object.keys(t).forEach((n=>{this._setToTarget(e,n,t[n],i)}))}}function ye(e){return(0,we.A)(e,ke)}function ke(e){return(0,ve.A)(e)||"function"==typeof e?e:void 0}function Ce(e){if(e){if(e.defaultView)return e instanceof e.defaultView.Document;if(e.ownerDocument&&e.ownerDocument.defaultView)return e instanceof e.ownerDocument.defaultView.Node}return!1}function Ae(e){const t=Object.prototype.toString.apply(e);return"[object Window]"==t||"[object global]"==t}const Ee=xe(z());function xe(e){return e?class extends e{listenTo(e,t,i,n={}){if(Ce(e)||Ae(e)){const o={capture:!!n.useCapture,passive:!!n.usePassive},s=this._getProxyEmitter(e,o)||new Te(e,o);this.listenTo(s,t,i,n)}else super.listenTo(e,t,i,n)}stopListening(e,t,i){if(Ce(e)||Ae(e)){const n=this._getAllProxyEmitters(e);for(const e of n)this.stopListening(e,t,i)}else super.stopListening(e,t,i)}_getProxyEmitter(e,t){return function(e,t){const i=e[L];return i&&i[t]?i[t].emitter:null}(this,Pe(e,t))}_getAllProxyEmitters(e){return[{capture:!1,passive:!1},{capture:!1,passive:!0},{capture:!0,passive:!1},{capture:!0,passive:!0}].map((t=>this._getProxyEmitter(e,t))).filter((e=>!!e))}}:Ee}["_getProxyEmitter","_getAllProxyEmitters","on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach((e=>{xe[e]=Ee.prototype[e]}));class Te extends(z()){constructor(e,t){super(),W(this,Pe(e,t)),this._domNode=e,this._options=t}attach(e){if(this._domListeners&&this._domListeners[e])return;const t=this._createDomListener(e);this._domNode.addEventListener(e,t,this._options),this._domListeners||(this._domListeners={}),this._domListeners[e]=t}detach(e){let t;!this._domListeners[e]||(t=this._events[e])&&t.callbacks.length||this._domListeners[e].removeListener()}_addEventListener(e,t,i){this.attach(e),z().prototype._addEventListener.call(this,e,t,i)}_removeEventListener(e,t){z().prototype._removeEventListener.call(this,e,t),this.detach(e)}_createDomListener(e){const t=t=>{this.fire(e,t)};return t.removeListener=()=>{this._domNode.removeEventListener(e,t,this._options),delete this._domListeners[e]},t}}function Pe(e,t){let i=function(e){return e["data-ck-expando"]||(e["data-ck-expando"]=A())}(e);for(const e of Object.keys(t).sort())t[e]&&(i+="-"+e);return i}function Ie(e){let t=e.parentElement;if(!t)return null;for(;"BODY"!=t.tagName;){const e=t.style.overflowY||o.window.getComputedStyle(t).overflowY;if("auto"===e||"scroll"===e)break;if(t=t.parentElement,!t)return null}return t}function Se(e){const t=[];let i=e;for(;i&&i.nodeType!=Node.DOCUMENT_NODE;)t.unshift(i),i=i.parentNode;return t}function Ve(e){return e instanceof HTMLTextAreaElement?e.value:e.innerHTML}function Re(e){const t=e.ownerDocument.defaultView.getComputedStyle(e);return{top:parseInt(t.borderTopWidth,10),right:parseInt(t.borderRightWidth,10),bottom:parseInt(t.borderBottomWidth,10),left:parseInt(t.borderLeftWidth,10)}}function Be(e){return"[object Text]"==Object.prototype.toString.call(e)}function Me(e){return"[object Range]"==Object.prototype.toString.apply(e)}function Oe(e){return e&&e.parentNode?e.offsetParent===o.document.body?null:e.offsetParent:null}const Le=["top","right","bottom","left","width","height"];class Fe{constructor(e){const t=Me(e);if(Object.defineProperty(this,"_source",{value:e._source||e,writable:!0,enumerable:!1}),ze(e)||t)if(t){const t=Fe.getDomRangeRects(e);Ne(this,Fe.getBoundingRect(t))}else Ne(this,e.getBoundingClientRect());else if(Ae(e)){const{innerWidth:t,innerHeight:i}=e;Ne(this,{top:0,right:t,bottom:i,left:0,width:t,height:i})}else Ne(this,e)}clone(){return new Fe(this)}moveTo(e,t){return this.top=t,this.right=e+this.width,this.bottom=t+this.height,this.left=e,this}moveBy(e,t){return this.top+=t,this.right+=e,this.left+=e,this.bottom+=t,this}getIntersection(e){const t={top:Math.max(this.top,e.top),right:Math.min(this.right,e.right),bottom:Math.min(this.bottom,e.bottom),left:Math.max(this.left,e.left),width:0,height:0};if(t.width=t.right-t.left,t.height=t.bottom-t.top,t.width<0||t.height<0)return null;{const e=new Fe(t);return e._source=this._source,e}}getIntersectionArea(e){const t=this.getIntersection(e);return t?t.getArea():0}getArea(){return this.width*this.height}getVisible(){const e=this._source;let t=this.clone();if(De(e))return t;let i,n=e,o=e.parentNode||e.commonAncestorContainer;for(;o&&!De(o);){const e="visible"===((s=o)instanceof HTMLElement?s.ownerDocument.defaultView.getComputedStyle(s).overflow:"visible");n instanceof HTMLElement&&"absolute"===We(n)&&(i=n);const r=We(o);if(e||i&&("relative"===r&&e||"relative"!==r)){n=o,o=o.parentNode;continue}const a=new Fe(o),l=t.getIntersection(a);if(!l)return null;l.getArea()<t.getArea()&&(t=l),n=o,o=o.parentNode}var s;return t}isEqual(e){for(const t of Le)if(this[t]!==e[t])return!1;return!0}contains(e){const t=this.getIntersection(e);return!(!t||!t.isEqual(e))}toAbsoluteRect(){const{scrollX:e,scrollY:t}=o.window,i=this.clone().moveBy(e,t);if(ze(i._source)){const e=Oe(i._source);e&&function(e,t){const i=new Fe(t),n=Re(t);let o=0,s=0;o-=i.left,s-=i.top,o+=t.scrollLeft,s+=t.scrollTop,o-=n.left,s-=n.top,e.moveBy(o,s)}(i,e)}return i}excludeScrollbarsAndBorders(){const e=this._source;let t,i,n;if(Ae(e))t=e.innerWidth-e.document.documentElement.clientWidth,i=e.innerHeight-e.document.documentElement.clientHeight,n=e.getComputedStyle(e.document.documentElement).direction;else{const o=Re(e);t=e.offsetWidth-e.clientWidth-o.left-o.right,i=e.offsetHeight-e.clientHeight-o.top-o.bottom,n=e.ownerDocument.defaultView.getComputedStyle(e).direction,this.left+=o.left,this.top+=o.top,this.right-=o.right,this.bottom-=o.bottom,this.width=this.right-this.left,this.height=this.bottom-this.top}return this.width-=t,"ltr"===n?this.right-=t:this.left+=t,this.height-=i,this.bottom-=i,this}static getDomRangeRects(e){const t=[],i=Array.from(e.getClientRects());if(i.length)for(const e of i)t.push(new Fe(e));else{let i=e.startContainer;Be(i)&&(i=i.parentNode);const n=new Fe(i.getBoundingClientRect());n.right=n.left,n.width=0,t.push(n)}return t}static getBoundingRect(e){const t={left:Number.POSITIVE_INFINITY,top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,width:0,height:0};let i=0;for(const n of e)i++,t.left=Math.min(t.left,n.left),t.top=Math.min(t.top,n.top),t.right=Math.max(t.right,n.right),t.bottom=Math.max(t.bottom,n.bottom);return 0==i?null:(t.width=t.right-t.left,t.height=t.bottom-t.top,new Fe(t))}}function Ne(e,t){for(const i of Le)e[i]=t[i]}function De(e){return!!ze(e)&&e===e.ownerDocument.body}function ze(e){return null!==e&&"object"==typeof e&&1===e.nodeType&&"function"==typeof e.getBoundingClientRect}function We(e){return e instanceof HTMLElement?e.ownerDocument.defaultView.getComputedStyle(e).position:"static"}class He{constructor(e,t){He._observerInstance||He._createObserver(),this._element=e,this._callback=t,He._addElementCallback(e,t),He._observerInstance.observe(e)}get element(){return this._element}destroy(){He._deleteElementCallback(this._element,this._callback)}static _addElementCallback(e,t){He._elementCallbacks||(He._elementCallbacks=new Map);let i=He._elementCallbacks.get(e);i||(i=new Set,He._elementCallbacks.set(e,i)),i.add(t)}static _deleteElementCallback(e,t){const i=He._getElementCallbacks(e);i&&(i.delete(t),i.size||(He._elementCallbacks.delete(e),He._observerInstance.unobserve(e))),He._elementCallbacks&&!He._elementCallbacks.size&&(He._observerInstance=null,He._elementCallbacks=null)}static _getElementCallbacks(e){return He._elementCallbacks?He._elementCallbacks.get(e):null}static _createObserver(){He._observerInstance=new o.window.ResizeObserver((e=>{for(const t of e){const e=He._getElementCallbacks(t.target);if(e)for(const i of e)i(t)}}))}}He._observerInstance=null,He._elementCallbacks=null;const Ue=He;function $e(e,t){e instanceof HTMLTextAreaElement&&(e.value=t),e.innerHTML=t}function je(e){return t=>t+e}function qe(e){let t=0;for(;e.previousSibling;)e=e.previousSibling,t++;return t}function Ke(e,t,i){e.insertBefore(i,e.childNodes[t]||null)}function Ge(e){return e&&e.nodeType===Node.COMMENT_NODE}function Ze(e){try{o.document.createAttribute(e)}catch(e){return!1}return!0}function Je(e){return!!(e&&e.getClientRects&&e.getClientRects().length)}var Qe=i(9610);function Ye({element:e,target:t,positions:i,limiter:n,fitInViewport:s,viewportOffsetConfig:r}){(0,Qe.A)(t)&&(t=t()),(0,Qe.A)(n)&&(n=n());const a=Oe(e),l=function(e){e=Object.assign({top:0,bottom:0,left:0,right:0},e);const t=new Fe(o.window);return t.top+=e.top,t.height-=e.top,t.bottom-=e.bottom,t.height-=e.bottom,t}(r),c=new Fe(e),d=Xe(t,l);let u;if(!d||!l.getIntersection(d))return null;const h={targetRect:d,elementRect:c,positionedElementAncestor:a,viewportRect:l};if(n||s){if(n){const e=Xe(n,l);e&&(h.limiterRect=e)}u=function(e,t){const{elementRect:i}=t,n=i.getArea(),o=e.map((e=>new et(e,t))).filter((e=>!!e.name));let s=0,r=null;for(const e of o){const{limiterIntersectionArea:t,viewportIntersectionArea:i}=e;if(t===n)return e;const o=i**2+t**2;o>s&&(s=o,r=e)}return r}(i,h)}else u=new et(i[0],h);return u}function Xe(e,t){const i=new Fe(e).getVisible();return i?i.getIntersection(t):null}class et{constructor(e,t){const i=e(t.targetRect,t.elementRect,t.viewportRect,t.limiterRect);if(!i)return;const{left:n,top:o,name:s,config:r}=i;this.name=s,this.config=r,this._positioningFunctionCoordinates={left:n,top:o},this._options=t}get left(){return this._absoluteRect.left}get top(){return this._absoluteRect.top}get limiterIntersectionArea(){const e=this._options.limiterRect;return e?e.getIntersectionArea(this._rect):0}get viewportIntersectionArea(){return this._options.viewportRect.getIntersectionArea(this._rect)}get _rect(){return this._cachedRect||(this._cachedRect=this._options.elementRect.clone().moveTo(this._positioningFunctionCoordinates.left,this._positioningFunctionCoordinates.top)),this._cachedRect}get _absoluteRect(){return this._cachedAbsoluteRect||(this._cachedAbsoluteRect=this._rect.toAbsoluteRect()),this._cachedAbsoluteRect}}function tt(e){const t=e.parentNode;t&&t.removeChild(e)}function it({target:e,viewportOffset:t=0,ancestorOffset:i=0,alignToTop:n,forceScroll:o}){const s=dt(e);let r=s,a=null;for(t=function(e){return"number"==typeof e?{top:e,bottom:e,left:e,right:e}:e}(t);r;){let l;l=ut(r==s?e:a),st({parent:l,getRect:()=>ht(e,r),alignToTop:n,ancestorOffset:i,forceScroll:o});const c=ht(e,r);if(ot({window:r,rect:c,viewportOffset:t,alignToTop:n,forceScroll:o}),r.parent!=r){if(a=r.frameElement,r=r.parent,!a)return}else r=null}}function nt(e,t,i){st({parent:ut(e),getRect:()=>new Fe(e),ancestorOffset:t,limiterElement:i})}function ot({window:e,rect:t,alignToTop:i,forceScroll:n,viewportOffset:o}){const s=t.clone().moveBy(0,o.bottom),r=t.clone().moveBy(0,-o.top),a=new Fe(e).excludeScrollbarsAndBorders(),l=i&&n,c=[r,s].every((e=>a.contains(e)));let{scrollX:d,scrollY:u}=e;const h=d,m=u;l?u-=a.top-t.top+o.top:c||(at(r,a)?u-=a.top-t.top+o.top:rt(s,a)&&(u+=i?t.top-a.top-o.top:t.bottom-a.bottom+o.bottom)),c||(lt(t,a)?d-=a.left-t.left+o.left:ct(t,a)&&(d+=t.right-a.right+o.right)),d==h&&u===m||e.scrollTo(d,u)}function st({parent:e,getRect:t,alignToTop:i,forceScroll:n,ancestorOffset:o=0,limiterElement:s}){const r=dt(e),a=i&&n;let l,c,d;const u=s||r.document.body;for(;e!=u;)c=t(),l=new Fe(e).excludeScrollbarsAndBorders(),d=l.contains(c),a?e.scrollTop-=l.top-c.top+o:d||(at(c,l)?e.scrollTop-=l.top-c.top+o:rt(c,l)&&(e.scrollTop+=i?c.top-l.top-o:c.bottom-l.bottom+o)),d||(lt(c,l)?e.scrollLeft-=l.left-c.left+o:ct(c,l)&&(e.scrollLeft+=c.right-l.right+o)),e=e.parentNode}function rt(e,t){return e.bottom>t.bottom}function at(e,t){return e.top<t.top}function lt(e,t){return e.left<t.left}function ct(e,t){return e.right>t.right}function dt(e){return Me(e)?e.startContainer.ownerDocument.defaultView:e.ownerDocument.defaultView}function ut(e){if(Me(e)){let t=e.commonAncestorContainer;return Be(t)&&(t=t.parentNode),t}return e.parentNode}function ht(e,t){const i=dt(e),n=new Fe(e);if(i===t)return n;{let e=i;for(;e!=t;){const t=e.frameElement,i=new Fe(t).excludeScrollbarsAndBorders();n.moveBy(i.left,i.top),e=e.parent}}return n}const mt={ctrl:"⌃",cmd:"⌘",alt:"⌥",shift:"⇧"},gt={ctrl:"Ctrl+",alt:"Alt+",shift:"Shift+"},ft={37:"←",38:"↑",39:"→",40:"↓",9:"⇥",33:"Page Up",34:"Page Down"},pt=At(),bt=Object.fromEntries(Object.entries(pt).map((([e,t])=>{let i;return i=t in ft?ft[t]:e.charAt(0).toUpperCase()+e.slice(1),[t,i]})));function wt(e){let t;if("string"==typeof e){if(t=pt[e.toLowerCase()],!t)throw new P("keyboard-unknown-key",null,{key:e})}else t=e.keyCode+(e.altKey?pt.alt:0)+(e.ctrlKey?pt.ctrl:0)+(e.shiftKey?pt.shift:0)+(e.metaKey?pt.cmd:0);return t}function vt(e){return"string"==typeof e&&(e=function(e){return e.split("+").map((e=>e.trim()))}(e)),e.map((e=>"string"==typeof e?function(e){if(e.endsWith("!"))return wt(e.slice(0,-1));const t=wt(e);return(a.isMac||a.isiOS)&&t==pt.ctrl?pt.cmd:t}(e):e)).reduce(((e,t)=>t+e),0)}function _t(e){let t=vt(e);return Object.entries(a.isMac||a.isiOS?mt:gt).reduce(((e,[i,n])=>(0!=(t&pt[i])&&(t&=~pt[i],e+=n),e)),"")+(t?bt[t]:"")}function yt(e){return e==pt.arrowright||e==pt.arrowleft||e==pt.arrowup||e==pt.arrowdown}function kt(e,t){const i="ltr"===t;switch(e){case pt.arrowleft:return i?"left":"right";case pt.arrowright:return i?"right":"left";case pt.arrowup:return"up";case pt.arrowdown:return"down"}}function Ct(e,t){const i=kt(e,t);return"down"===i||"right"===i}function At(){const e={pageup:33,pagedown:34,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,backspace:8,delete:46,enter:13,space:32,esc:27,tab:9,ctrl:1114112,shift:2228224,alt:4456448,cmd:8912896};for(let t=65;t<=90;t++)e[String.fromCharCode(t).toLowerCase()]=t;for(let t=48;t<=57;t++)e[t-48]=t;for(let t=112;t<=123;t++)e["f"+(t-111)]=t;return Object.assign(e,{"'":222,",":108,"-":109,".":110,"/":111,";":186,"=":187,"[":219,"\\":220,"]":221,"`":223}),e}const Et=["ar","ara","dv","div","fa","per","fas","he","heb","ku","kur","ug","uig"];function xt(e){return Et.includes(e)?"rtl":"ltr"}function Tt(e){return Array.isArray(e)?e:[e]}var Pt=i(6248);o.window.CKEDITOR_TRANSLATIONS||(o.window.CKEDITOR_TRANSLATIONS={});class It{constructor({uiLanguage:e="en",contentLanguage:t,translations:i}={}){this.uiLanguage=e,this.contentLanguage=t||this.uiLanguage,this.uiLanguageDirection=xt(this.uiLanguage),this.contentLanguageDirection=xt(this.contentLanguage),this.translations=function(e){return Array.isArray(e)?e.reduce(((e,t)=>(0,Pt.A)(e,t))):e}(i),this.t=(e,t)=>this._t(e,t)}get language(){return console.warn("locale-deprecated-language-property: The Locale#language property has been deprecated and will be removed in the near future. Please use #uiLanguage and #contentLanguage properties instead."),this.uiLanguage}_t(e,t=[]){t=Tt(t),"string"==typeof e&&(e={string:e});const i=e.plural?t[0]:1;return function(e,t){return e.replace(/%(\d+)/g,((e,i)=>i<t.length?t[i]:e))}(function(e,t,i=1,n){if("number"!=typeof i)throw new P("translation-service-quantity-not-a-number",null,{quantity:i});const s=n||o.window.CKEDITOR_TRANSLATIONS,r=function(e){return Object.keys(e).length}(s);1===r&&(e=Object.keys(s)[0]);const a=t.id||t.string;if(0===r||!function(e,t,i){return!!i[e]&&!!i[e].dictionary[t]}(e,a,s))return 1!==i?t.plural:t.string;const l=s[e].dictionary,c=s[e].getPluralForm||(e=>1===e?0:1),d=l[a];return"string"==typeof d?d:d[Number(c(i))]}(this.uiLanguage,e,i,this.translations),t)}}class St extends(z()){constructor(e={},t={}){super();const i=ue(e);if(i||(t=e),this._items=[],this._itemMap=new Map,this._idProperty=t.idProperty||"id",this._bindToExternalToInternalMap=new WeakMap,this._bindToInternalToExternalMap=new WeakMap,this._skippedIndexesFromExternal=[],i)for(const t of e)this._items.push(t),this._itemMap.set(this._getItemIdBeforeAdding(t),t)}get length(){return this._items.length}get first(){return this._items[0]||null}get last(){return this._items[this.length-1]||null}add(e,t){return this.addMany([e],t)}addMany(e,t){if(void 0===t)t=this._items.length;else if(t>this._items.length||t<0)throw new P("collection-add-item-invalid-index",this);let i=0;for(const n of e){const e=this._getItemIdBeforeAdding(n),o=t+i;this._items.splice(o,0,n),this._itemMap.set(e,n),this.fire("add",n,o),i++}return this.fire("change",{added:e,removed:[],index:t}),this}get(e){let t;if("string"==typeof e)t=this._itemMap.get(e);else{if("number"!=typeof e)throw new P("collection-get-invalid-arg",this);t=this._items[e]}return t||null}has(e){if("string"==typeof e)return this._itemMap.has(e);{const t=e[this._idProperty];return t&&this._itemMap.has(t)}}getIndex(e){let t;return t="string"==typeof e?this._itemMap.get(e):e,t?this._items.indexOf(t):-1}remove(e){const[t,i]=this._remove(e);return this.fire("change",{added:[],removed:[t],index:i}),t}map(e,t){return this._items.map(e,t)}forEach(e,t){this._items.forEach(e,t)}find(e,t){return this._items.find(e,t)}filter(e,t){return this._items.filter(e,t)}clear(){this._bindToCollection&&(this.stopListening(this._bindToCollection),this._bindToCollection=null);const e=Array.from(this._items);for(;this.length;)this._remove(0);this.fire("change",{added:[],removed:e,index:0})}bindTo(e){if(this._bindToCollection)throw new P("collection-bind-to-rebind",this);return this._bindToCollection=e,{as:e=>{this._setUpBindToBinding((t=>new e(t)))},using:e=>{"function"==typeof e?this._setUpBindToBinding(e):this._setUpBindToBinding((t=>t[e]))}}}_setUpBindToBinding(e){const t=this._bindToCollection,i=(i,n,o)=>{const s=t._bindToCollection==this,r=t._bindToInternalToExternalMap.get(n);if(s&&r)this._bindToExternalToInternalMap.set(n,r),this._bindToInternalToExternalMap.set(r,n);else{const i=e(n);if(!i)return void this._skippedIndexesFromExternal.push(o);let s=o;for(const e of this._skippedIndexesFromExternal)o>e&&s--;for(const e of t._skippedIndexesFromExternal)s>=e&&s++;this._bindToExternalToInternalMap.set(n,i),this._bindToInternalToExternalMap.set(i,n),this.add(i,s);for(let e=0;e<t._skippedIndexesFromExternal.length;e++)s<=t._skippedIndexesFromExternal[e]&&t._skippedIndexesFromExternal[e]++}};for(const e of t)i(0,e,t.getIndex(e));this.listenTo(t,"add",i),this.listenTo(t,"remove",((e,t,i)=>{const n=this._bindToExternalToInternalMap.get(t);n&&this.remove(n),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce(((e,t)=>(i<t&&e.push(t-1),i>t&&e.push(t),e)),[])}))}_getItemIdBeforeAdding(e){const t=this._idProperty;let i;if(t in e){if(i=e[t],"string"!=typeof i)throw new P("collection-add-invalid-id",this);if(this.get(i))throw new P("collection-add-item-already-exists",this)}else e[t]=i=A();return i}_remove(e){let t,i,n,o=!1;const s=this._idProperty;if("string"==typeof e?(i=e,n=this._itemMap.get(i),o=!n,n&&(t=this._items.indexOf(n))):"number"==typeof e?(t=e,n=this._items[t],o=!n,n&&(i=n[s])):(n=e,i=n[s],t=this._items.indexOf(n),o=-1==t||!this._itemMap.get(i)),o)throw new P("collection-remove-404",this);this._items.splice(t,1),this._itemMap.delete(i);const r=this._bindToInternalToExternalMap.get(n);return this._bindToInternalToExternalMap.delete(n),this._bindToExternalToInternalMap.delete(r),this.fire("remove",n,t),[n,t]}[Symbol.iterator](){return this._items[Symbol.iterator]()}}function Vt(e){const t=e.next();return t.done?null:t.value}class Rt extends(xe(te())){constructor(){super(),this._elements=new Set,this._nextEventLoopTimeout=null,this.set("isFocused",!1),this.set("focusedElement",null)}add(e){if(this._elements.has(e))throw new P("focustracker-add-element-already-exist",this);this.listenTo(e,"focus",(()=>this._focus(e)),{useCapture:!0}),this.listenTo(e,"blur",(()=>this._blur()),{useCapture:!0}),this._elements.add(e)}remove(e){e===this.focusedElement&&this._blur(),this._elements.has(e)&&(this.stopListening(e),this._elements.delete(e))}destroy(){this.stopListening()}_focus(e){clearTimeout(this._nextEventLoopTimeout),this.focusedElement=e,this.isFocused=!0}_blur(){clearTimeout(this._nextEventLoopTimeout),this._nextEventLoopTimeout=setTimeout((()=>{this.focusedElement=null,this.isFocused=!1}),0)}}class Bt{constructor(){this._listener=new(xe())}listenTo(e){this._listener.listenTo(e,"keydown",((e,t)=>{this._listener.fire("_keydown:"+wt(t),t)}))}set(e,t,i={}){const n=vt(e),o=i.priority;this._listener.listenTo(this._listener,"_keydown:"+n,((e,n)=>{i.filter&&!i.filter(n)||(t(n,(()=>{n.preventDefault(),n.stopPropagation(),e.stop()})),e.return=!0)}),{priority:o})}press(e){return!!this._listener.fire("_keydown:"+wt(e),e)}stopListening(e){this._listener.stopListening(e)}destroy(){this.stopListening()}}function Mt(e){return ue(e)?new Map(e):function(e){const t=new Map;for(const i in e)t.set(i,e[i]);return t}(e)}function Ot(e,t={}){return new Promise(((i,n)=>{const o=t.signal||(new AbortController).signal;o.throwIfAborted();const s=setTimeout((function(){o.removeEventListener("abort",r),i()}),e);function r(){clearTimeout(s),n(o.reason)}o.addEventListener("abort",r,{once:!0})}))}async function Lt(e,t={}){const{maxAttempts:i=4,retryDelay:n=Ft(),signal:o=(new AbortController).signal}=t;o.throwIfAborted();for(let t=0;;t++){try{return await e()}catch(e){if(t+1>=i)throw e}await Ot(n(t),{signal:o})}}function Ft(e={}){const{delay:t=1e3,factor:i=2,maxDelay:n=1e4}=e;return e=>Math.min(i**e*t,n)}const Nt=1e4;function Dt(e,t,i,n){if(Math.max(t.length,e.length)>Nt)return e.slice(0,i).concat(t).concat(e.slice(i+n,e.length));{const o=Array.from(e);return o.splice(i,n,...t),o}}function zt(e,t){let i;function n(...o){n.cancel(),i=setTimeout((()=>e(...o)),t)}return n.cancel=()=>{clearTimeout(i)},n}function Wt(e){function t(e){return e.length>=40&&e.length<=255?"VALID":"INVALID"}if(!e)return"INVALID";let i="";try{i=atob(e)}catch(e){return"INVALID"}const n=i.split("-"),o=n[0],s=n[1];if(!s)return t(e);try{atob(s)}catch(i){try{if(atob(o),!atob(o).length)return t(e)}catch(i){return t(e)}}if(o.length<40||o.length>255)return"INVALID";let r="";try{atob(o),r=atob(s)}catch(e){return"INVALID"}if(8!==r.length)return"INVALID";const a=Number(r.substring(0,4)),l=Number(r.substring(4,6))-1,c=Number(r.substring(6,8)),d=new Date(a,l,c);return d<O||isNaN(Number(d))?"INVALID":"VALID"}function Ht(e){return!!e&&1==e.length&&/[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/.test(e)}function Ut(e){return!!e&&1==e.length&&/[\ud800-\udbff]/.test(e)}function $t(e){return!!e&&1==e.length&&/[\udc00-\udfff]/.test(e)}function jt(e,t){return Ut(e.charAt(t-1))&&$t(e.charAt(t))}function qt(e,t){return Ht(e.charAt(t))}const Kt=Zt();function Gt(e,t){const i=String(e).matchAll(Kt);return Array.from(i).some((e=>e.index<t&&t<e.index+e[0].length))}function Zt(){const e=/\p{Regional_Indicator}{2}/u.source,t="(?:"+[/\p{Emoji}[\u{E0020}-\u{E007E}]+\u{E007F}/u,/\p{Emoji}\u{FE0F}?\u{20E3}/u,/\p{Emoji}\u{FE0F}/u,/(?=\p{General_Category=Other_Symbol})\p{Emoji}\p{Emoji_Modifier}*/u].map((e=>e.source)).join("|")+")";return new RegExp(`${e}|${t}(?:‍${t})*`,"ug")}},3906:(e,t,i)=>{"use strict";i.r(t),i.d(t,{WIDGET_CLASS_NAME:()=>m,WIDGET_SELECTED_CLASS_NAME:()=>g,Widget:()=>F,WidgetResize:()=>j,WidgetToolbarRepository:()=>N,WidgetTypeAround:()=>M,calculateResizeHostAncestorWidth:()=>x,calculateResizeHostPercentageWidth:()=>T,findOptimalInsertionRange:()=>C,getLabel:()=>y,isWidget:()=>f,setHighlightHandling:()=>v,setLabel:()=>_,toWidget:()=>p,toWidgetEditable:()=>k,viewToModelPositionOutsideModelElement:()=>A});var n=i(1024),o=i(151),s=i(6192),r=i(7906),a=i(7243),l=i(7207);class c extends((0,r.EmitterMixin)()){constructor(){super(...arguments),this._stack=[]}add(e,t){const i=this._stack,n=i[0];this._insertDescriptor(e);const o=i[0];n===o||d(n,o)||this.fire("change:top",{oldDescriptor:n,newDescriptor:o,writer:t})}remove(e,t){const i=this._stack,n=i[0];this._removeDescriptor(e);const o=i[0];n===o||d(n,o)||this.fire("change:top",{oldDescriptor:n,newDescriptor:o,writer:t})}_insertDescriptor(e){const t=this._stack,i=t.findIndex((t=>t.id===e.id));if(d(e,t[i]))return;i>-1&&t.splice(i,1);let n=0;for(;t[n]&&(o=t[n],s=e,o.priority>s.priority||!(o.priority<s.priority)&&u(o.classes)>u(s.classes));)n++;var o,s;t.splice(n,0,e)}_removeDescriptor(e){const t=this._stack,i=t.findIndex((t=>t.id===e));i>-1&&t.splice(i,1)}}function d(e,t){return e&&t&&e.priority==t.priority&&u(e.classes)==u(t.classes)}function u(e){return Array.isArray(e)?e.sort().join(","):e}const h='<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M4 0v1H1v3H0V.5A.5.5 0 0 1 .5 0H4zm8 0h3.5a.5.5 0 0 1 .5.5V4h-1V1h-3V0zM4 16H.5a.5.5 0 0 1-.5-.5V12h1v3h3v1zm8 0v-1h3v-3h1v3.5a.5.5 0 0 1-.5.5H12z"/><path fill-opacity=".256" d="M1 1h14v14H1z"/><g class="ck-icon__selected-indicator"><path d="M7 0h2v1H7V0zM0 7h1v2H0V7zm15 0h1v2h-1V7zm-8 8h2v1H7v-1z"/><path fill-opacity=".254" d="M1 1h14v14H1z"/></g></svg>',m="ck-widget",g="ck-widget_selected";function f(e){return!!e.is("element")&&!!e.getCustomProperty("widget")}function p(e,t,i={}){if(!e.is("containerElement"))throw new r.CKEditorError("widget-to-widget-wrong-element-type",null,{element:e});return t.setAttribute("contenteditable","false",e),t.addClass(m,e),t.setCustomProperty("widget",!0,e),e.getFillerOffset=E,t.setCustomProperty("widgetLabel",[],e),i.label&&_(e,i.label),i.hasSelectionHandle&&function(e,t){const i=t.createUIElement("div",{class:"ck ck-widget__selection-handle"},(function(e){const t=this.toDomElement(e),i=new a.IconView;return i.set("content",h),i.render(),t.appendChild(i.element),t}));t.insert(t.createPositionAt(e,0),i),t.addClass(["ck-widget_with-selection-handle"],e)}(e,t),v(e,t),e}function b(e,t,i){if(t.classes&&i.addClass((0,r.toArray)(t.classes),e),t.attributes)for(const n in t.attributes)i.setAttribute(n,t.attributes[n],e)}function w(e,t,i){if(t.classes&&i.removeClass((0,r.toArray)(t.classes),e),t.attributes)for(const n in t.attributes)i.removeAttribute(n,e)}function v(e,t,i=b,n=w){const o=new c;o.on("change:top",((t,o)=>{o.oldDescriptor&&n(e,o.oldDescriptor,o.writer),o.newDescriptor&&i(e,o.newDescriptor,o.writer)})),t.setCustomProperty("addHighlight",((e,t,i)=>o.add(t,i)),e),t.setCustomProperty("removeHighlight",((e,t,i)=>o.remove(t,i)),e)}function _(e,t){e.getCustomProperty("widgetLabel").push(t)}function y(e){return e.getCustomProperty("widgetLabel").reduce(((e,t)=>"function"==typeof t?e?e+". "+t():t():e?e+". "+t:t),"")}function k(e,t,i={}){return t.addClass(["ck-editor__editable","ck-editor__nested-editable"],e),t.setAttribute("role","textbox",e),t.setAttribute("tabindex","-1",e),i.label&&t.setAttribute("aria-label",i.label,e),t.setAttribute("contenteditable",e.isReadOnly?"false":"true",e),e.on("change:isReadOnly",((i,n,o)=>{t.setAttribute("contenteditable",o?"false":"true",e)})),e.on("change:isFocused",((i,n,o)=>{o?t.addClass("ck-editor__nested-editable_focused",e):t.removeClass("ck-editor__nested-editable_focused",e)})),v(e,t),e}function C(e,t){const i=e.getSelectedElement();if(i){const n=S(e);if(n)return t.createRange(t.createPositionAt(i,n))}return t.schema.findOptimalInsertionRange(e)}function A(e,t){return(i,n)=>{const{mapper:o,viewPosition:s}=n,r=o.findMappedViewAncestor(s);if(!t(r))return;const a=o.toModelElement(r);n.modelPosition=e.createPositionAt(a,s.isAtStart?"before":"after")}}function E(){return null}function x(e){const t=e=>{const{width:t,paddingLeft:i,paddingRight:n}=e.ownerDocument.defaultView.getComputedStyle(e);return parseFloat(t)-(parseFloat(i)||0)-(parseFloat(n)||0)},i=e.parentElement;if(!i)return 0;let n=t(i),o=0,s=i;for(;isNaN(n);){if(s=s.parentElement,++o>5)return 0;n=t(s)}return n}function T(e,t=new r.Rect(e)){const i=x(e);return i?t.width/i*100:0}const P="widget-type-around";function I(e,t,i){return!!e&&f(e)&&!i.isInline(t)}function S(e){return e.getAttribute(P)}const V=["before","after"],R=(new DOMParser).parseFromString('<svg viewBox="0 0 10 8" xmlns="http://www.w3.org/2000/svg"><path d="M9.055.263v3.972h-6.77M1 4.216l2-2.038m-2 2 2 2.038"/></svg>',"image/svg+xml").firstChild,B="ck-widget__type-around_disabled";class M extends n.Plugin{constructor(){super(...arguments),this._currentFakeCaretModelElement=null}static get pluginName(){return"WidgetTypeAround"}static get requires(){return[l.Enter,s.Delete]}init(){const e=this.editor,t=e.editing.view;this.on("change:isEnabled",((i,n,o)=>{t.change((e=>{for(const i of t.document.roots)o?e.removeClass(B,i):e.addClass(B,i)})),o||e.model.change((e=>{e.removeSelectionAttribute(P)}))})),this._enableTypeAroundUIInjection(),this._enableInsertingParagraphsOnButtonClick(),this._enableInsertingParagraphsOnEnterKeypress(),this._enableInsertingParagraphsOnTypingKeystroke(),this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(),this._enableDeleteIntegration(),this._enableInsertContentIntegration(),this._enableInsertObjectIntegration(),this._enableDeleteContentIntegration()}destroy(){super.destroy(),this._currentFakeCaretModelElement=null}_insertParagraph(e,t){const i=this.editor,n=i.editing.view,o=i.model.schema.getAttributesWithProperty(e,"copyOnReplace",!0);i.execute("insertParagraph",{position:i.model.createPositionAt(e,t),attributes:o}),n.focus(),n.scrollToTheSelection()}_listenToIfEnabled(e,t,i,n){this.listenTo(e,t,((...e)=>{this.isEnabled&&i(...e)}),n)}_insertParagraphAccordingToFakeCaretPosition(){const e=this.editor.model.document.selection,t=S(e);if(!t)return!1;const i=e.getSelectedElement();return this._insertParagraph(i,t),!0}_enableTypeAroundUIInjection(){const e=this.editor,t=e.model.schema,i=e.locale.t,n={before:i("Insert paragraph before block"),after:i("Insert paragraph after block")};e.editing.downcastDispatcher.on("insert",((e,o,s)=>{const r=s.mapper.toViewElement(o.item);r&&I(r,o.item,t)&&(!function(e,t,i){const n=e.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},(function(e){const i=this.toDomElement(e);return function(e,t){for(const i of V){const n=new a.Template({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${i}`],title:t[i],"aria-hidden":"true"},children:[e.ownerDocument.importNode(R,!0)]});e.appendChild(n.render())}}(i,t),function(e){const t=new a.Template({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});e.appendChild(t.render())}(i),i}));e.insert(e.createPositionAt(i,"end"),n)}(s.writer,n,r),r.getCustomProperty("widgetLabel").push((()=>this.isEnabled?i("Press Enter to type after or press Shift + Enter to type before the widget"):"")))}),{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const e=this.editor,t=e.model,i=t.document.selection,n=t.schema,o=e.editing.view;function s(e){return`ck-widget_type-around_show-fake-caret_${e}`}this._listenToIfEnabled(o.document,"arrowKey",((e,t)=>{this._handleArrowKeyPress(e,t)}),{context:[f,"$text"],priority:"high"}),this._listenToIfEnabled(i,"change:range",((t,i)=>{i.directChange&&e.model.change((e=>{e.removeSelectionAttribute(P)}))})),this._listenToIfEnabled(t.document,"change:data",(()=>{const t=i.getSelectedElement();t&&I(e.editing.mapper.toViewElement(t),t,n)||e.model.change((e=>{e.removeSelectionAttribute(P)}))})),this._listenToIfEnabled(e.editing.downcastDispatcher,"selection",((e,t,i)=>{const o=i.writer;if(this._currentFakeCaretModelElement){const e=i.mapper.toViewElement(this._currentFakeCaretModelElement);e&&(o.removeClass(V.map(s),e),this._currentFakeCaretModelElement=null)}const r=t.selection.getSelectedElement();if(!r)return;const a=i.mapper.toViewElement(r);if(!I(a,r,n))return;const l=S(t.selection);l&&(o.addClass(s(l),a),this._currentFakeCaretModelElement=r)})),this._listenToIfEnabled(e.ui.focusTracker,"change:isFocused",((t,i,n)=>{n||e.model.change((e=>{e.removeSelectionAttribute(P)}))}))}_handleArrowKeyPress(e,t){const i=this.editor,n=i.model,o=n.document.selection,s=n.schema,a=i.editing.view,l=t.keyCode,c=(0,r.isForwardArrowKeyCode)(l,i.locale.contentLanguageDirection),d=a.document.selection.getSelectedElement();let u;I(d,i.editing.mapper.toModelElement(d),s)?u=this._handleArrowKeyPressOnSelectedWidget(c):o.isCollapsed?u=this._handleArrowKeyPressWhenSelectionNextToAWidget(c):t.shiftKey||(u=this._handleArrowKeyPressWhenNonCollapsedSelection(c)),u&&(t.preventDefault(),e.stop())}_handleArrowKeyPressOnSelectedWidget(e){const t=this.editor.model,i=S(t.document.selection);return t.change((t=>i?i!==(e?"after":"before")&&(t.removeSelectionAttribute(P),!0):(t.setSelectionAttribute(P,e?"after":"before"),!0)))}_handleArrowKeyPressWhenSelectionNextToAWidget(e){const t=this.editor,i=t.model,n=i.schema,o=t.plugins.get("Widget"),s=o._getObjectElementNextToSelection(e);return!!I(t.editing.mapper.toViewElement(s),s,n)&&(i.change((t=>{o._setSelectionOverElement(s),t.setSelectionAttribute(P,e?"before":"after")})),!0)}_handleArrowKeyPressWhenNonCollapsedSelection(e){const t=this.editor,i=t.model,n=i.schema,o=t.editing.mapper,s=i.document.selection,r=e?s.getLastPosition().nodeBefore:s.getFirstPosition().nodeAfter;return!!I(o.toViewElement(r),r,n)&&(i.change((t=>{t.setSelection(r,"on"),t.setSelectionAttribute(P,e?"after":"before")})),!0)}_enableInsertingParagraphsOnButtonClick(){const e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,"mousedown",((i,n)=>{const o=n.domTarget.closest(".ck-widget__type-around__button");if(!o)return;const s=o.classList.contains("ck-widget__type-around__button_before")?"before":"after",r=function(e,t){const i=e.closest(".ck-widget");return t.mapDomToView(i)}(o,t.domConverter),a=e.editing.mapper.toModelElement(r);this._insertParagraph(a,s),n.preventDefault(),i.stop()}))}_enableInsertingParagraphsOnEnterKeypress(){const e=this.editor,t=e.model.document.selection,i=e.editing.view;this._listenToIfEnabled(i.document,"enter",((i,n)=>{if("atTarget"!=i.eventPhase)return;const o=t.getSelectedElement(),s=e.editing.mapper.toViewElement(o),r=e.model.schema;let a;this._insertParagraphAccordingToFakeCaretPosition()?a=!0:I(s,o,r)&&(this._insertParagraph(o,n.isSoft?"before":"after"),a=!0),a&&(n.preventDefault(),i.stop())}),{context:f})}_enableInsertingParagraphsOnTypingKeystroke(){const e=this.editor.editing.view.document;this._listenToIfEnabled(e,"insertText",((t,i)=>{this._insertParagraphAccordingToFakeCaretPosition()&&(i.selection=e.selection)}),{priority:"high"}),r.env.isAndroid?this._listenToIfEnabled(e,"keydown",((e,t)=>{229==t.keyCode&&this._insertParagraphAccordingToFakeCaretPosition()})):this._listenToIfEnabled(e,"compositionstart",(()=>{this._insertParagraphAccordingToFakeCaretPosition()}),{priority:"high"})}_enableDeleteIntegration(){const e=this.editor,t=e.editing.view,i=e.model,n=i.schema;this._listenToIfEnabled(t.document,"delete",((t,o)=>{if("atTarget"!=t.eventPhase)return;const s=S(i.document.selection);if(!s)return;const r=o.direction,a=i.document.selection.getSelectedElement(),l="forward"==r;if("before"===s===l)e.execute("delete",{selection:i.createSelection(a,"on")});else{const t=n.getNearestSelectionRange(i.createPositionAt(a,s),r);if(t)if(t.isCollapsed){const o=i.createSelection(t.start);if(i.modifySelection(o,{direction:r}),o.focus.isEqual(t.start)){const e=function(e,t){let i=t;for(const n of t.getAncestors({parentFirst:!0})){if(n.childCount>1||e.isLimit(n))break;i=n}return i}(n,t.start.parent);i.deleteContent(i.createSelection(e,"on"),{doNotAutoparagraph:!0})}else i.change((i=>{i.setSelection(t),e.execute(l?"deleteForward":"delete")}))}else i.change((i=>{i.setSelection(t),e.execute(l?"deleteForward":"delete")}))}o.preventDefault(),t.stop()}),{context:f})}_enableInsertContentIntegration(){const e=this.editor,t=this.editor.model,i=t.document.selection;this._listenToIfEnabled(e.model,"insertContent",((e,[n,o])=>{if(o&&!o.is("documentSelection"))return;const s=S(i);return s?(e.stop(),t.change((e=>{const o=i.getSelectedElement(),r=t.createPositionAt(o,s),a=e.createSelection(r),l=t.insertContent(n,a);return e.setSelection(a),l}))):void 0}),{priority:"high"})}_enableInsertObjectIntegration(){const e=this.editor,t=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"insertObject",((e,i)=>{const[,n,o={}]=i;if(n&&!n.is("documentSelection"))return;const s=S(t);s&&(o.findOptimalPosition=s,i[3]=o)}),{priority:"high"})}_enableDeleteContentIntegration(){const e=this.editor,t=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"deleteContent",((e,[i])=>{i&&!i.is("documentSelection")||S(t)&&e.stop()}),{priority:"high"})}}function O(e,t,i){const n=e.schema,o=e.createRangeIn(t.root),s="forward"==i?"elementStart":"elementEnd";for(const{previousPosition:e,item:r,type:a}of o.getWalker({startPosition:t,direction:i})){if(n.isLimit(r)&&!n.isInline(r))return e;if(a==s&&n.isBlock(r))return null}return null}function L(e,t,i){const n="backward"==i?t.end:t.start;if(e.checkChild(n,"$text"))return n;for(const{nextPosition:n}of t.getWalker({direction:i}))if(e.checkChild(n,"$text"))return n;return null}class F extends n.Plugin{constructor(){super(...arguments),this._previouslySelected=new Set}static get pluginName(){return"Widget"}static get requires(){return[M,s.Delete]}init(){const e=this.editor,t=e.editing.view,i=t.document,n=e.t;this.editor.editing.downcastDispatcher.on("selection",((t,i,n)=>{const o=n.writer,s=i.selection;if(s.isCollapsed)return;const r=s.getSelectedElement();if(!r)return;const a=e.editing.mapper.toViewElement(r);f(a)&&n.consumable.consume(s,"selection")&&o.setSelection(o.createRangeOn(a),{fake:!0,label:y(a)})})),this.editor.editing.downcastDispatcher.on("selection",((e,t,i)=>{this._clearPreviouslySelectedWidgets(i.writer);const n=i.writer,o=n.document.selection;let s=null;for(const e of o.getRanges())for(const t of e){const e=t.item;f(e)&&(r=e,!(a=s)||!Array.from(r.getAncestors()).includes(a))&&(n.addClass(g,e),this._previouslySelected.add(e),s=e)}var r,a}),{priority:"low"}),t.addObserver(o.MouseObserver),this.listenTo(i,"mousedown",((...e)=>this._onMousedown(...e))),this.listenTo(i,"arrowKey",((...e)=>{this._handleSelectionChangeOnArrowKeyPress(...e)}),{context:[f,"$text"]}),this.listenTo(i,"arrowKey",((...e)=>{this._preventDefaultOnArrowKeyPress(...e)}),{context:"$root"}),this.listenTo(i,"arrowKey",function(e){const t=e.model;return(i,n)=>{const o=n.keyCode==r.keyCodes.arrowup,s=n.keyCode==r.keyCodes.arrowdown,a=n.shiftKey,l=t.document.selection;if(!o&&!s)return;const c=s;if(a&&function(e,t){return!e.isCollapsed&&e.isBackward==t}(l,c))return;const d=function(e,t,i){const n=e.model;if(i){const e=t.isCollapsed?t.focus:t.getLastPosition(),i=O(n,e,"forward");if(!i)return null;const o=n.createRange(e,i),s=L(n.schema,o,"backward");return s?n.createRange(e,s):null}{const e=t.isCollapsed?t.focus:t.getFirstPosition(),i=O(n,e,"backward");if(!i)return null;const o=n.createRange(i,e),s=L(n.schema,o,"forward");return s?n.createRange(s,e):null}}(e,l,c);if(d){if(d.isCollapsed){if(l.isCollapsed)return;if(a)return}(d.isCollapsed||function(e,t,i){const n=e.model,o=e.view.domConverter;if(i){const e=n.createSelection(t.start);n.modifySelection(e),e.focus.isAtEnd||t.start.isEqual(e.focus)||(t=n.createRange(e.focus,t.end))}const s=e.mapper.toViewRange(t),a=o.viewRangeToDom(s),l=r.Rect.getDomRangeRects(a);let c;for(const e of l)if(void 0!==c){if(Math.round(e.top)>=c)return!1;c=Math.max(c,Math.round(e.bottom))}else c=Math.round(e.bottom);return!0}(e,d,c))&&(t.change((e=>{const i=c?d.end:d.start;if(a){const n=t.createSelection(l.anchor);n.setFocus(i),e.setSelection(n)}else e.setSelection(i)})),i.stop(),n.preventDefault(),n.stopPropagation())}}}(this.editor.editing),{context:"$text"}),this.listenTo(i,"delete",((e,t)=>{this._handleDelete("forward"==t.direction)&&(t.preventDefault(),e.stop())}),{context:"$root"}),this.listenTo(i,"tab",((e,t)=>{"atTarget"==e.eventPhase&&(t.shiftKey||this._selectFirstNestedEditable()&&(t.preventDefault(),e.stop()))}),{context:f,priority:"low"}),this.listenTo(i,"tab",((e,t)=>{t.shiftKey&&this._selectAncestorWidget()&&(t.preventDefault(),e.stop())}),{priority:"low"}),this.listenTo(i,"keydown",((e,t)=>{t.keystroke==r.keyCodes.esc&&this._selectAncestorWidget()&&(t.preventDefault(),e.stop())}),{priority:"low"}),e.accessibility.addKeystrokeInfoGroup({id:"widget",label:n("Keystrokes that can be used when a widget is selected (for example: image, table, etc.)"),keystrokes:[{label:n("Move focus from an editable area back to the parent widget"),keystroke:"Esc"},{label:n("Insert a new paragraph directly after a widget"),keystroke:"Enter"},{label:n("Insert a new paragraph directly before a widget"),keystroke:"Shift+Enter"},{label:n("Move the caret to allow typing directly before a widget"),keystroke:[["arrowup"],["arrowleft"]]},{label:n("Move the caret to allow typing directly after a widget"),keystroke:[["arrowdown"],["arrowright"]]}]})}_onMousedown(e,t){const i=this.editor,n=i.editing.view,o=n.document;let s=t.target;if(t.domEvent.detail>=3)return void(this._selectBlockContent(s)&&t.preventDefault());if(function(e){let t=e;for(;t;){if(t.is("editableElement")&&!t.is("rootElement"))return!0;if(f(t))return!1;t=t.parent}return!1}(s))return;if(!f(s)&&(s=s.findAncestor(f),!s))return;r.env.isAndroid&&t.preventDefault(),o.isFocused||n.focus();const a=i.editing.mapper.toModelElement(s);this._setSelectionOverElement(a)}_selectBlockContent(e){const t=this.editor,i=t.model,n=t.editing.mapper,s=i.schema,r=n.findMappedViewAncestor(this.editor.editing.view.createPositionAt(e,0)),a=function(e,t){for(const i of e.getAncestors({includeSelf:!0,parentFirst:!0})){if(t.checkChild(i,"$text"))return i;if(t.isLimit(i)&&!t.isObject(i))break}return null}(n.toModelElement(r),i.schema);return!!a&&(i.change((e=>{const t=s.isLimit(a)?null:function(e,t){const i=new o.TreeWalker({startPosition:e});for(const{item:e}of i){if(t.isLimit(e)||!e.is("element"))return null;if(t.checkChild(e,"$text"))return e}return null}(e.createPositionAfter(a),s),i=e.createPositionAt(a,0),n=t?e.createPositionAt(t,0):e.createPositionAt(a,"end");e.setSelection(e.createRange(i,n))})),!0)}_handleSelectionChangeOnArrowKeyPress(e,t){const i=t.keyCode,n=this.editor.model,o=n.schema,s=n.document.selection,a=s.getSelectedElement(),l=(0,r.getLocalizedArrowKeyCodeDirection)(i,this.editor.locale.contentLanguageDirection),c="down"==l||"right"==l,d="up"==l||"down"==l;if(a&&o.isObject(a)){const i=c?s.getLastPosition():s.getFirstPosition(),r=o.getNearestSelectionRange(i,c?"forward":"backward");return void(r&&(n.change((e=>{e.setSelection(r)})),t.preventDefault(),e.stop()))}if(!s.isCollapsed&&!t.shiftKey){const i=s.getFirstPosition(),r=s.getLastPosition(),a=i.nodeAfter,l=r.nodeBefore;return void((a&&o.isObject(a)||l&&o.isObject(l))&&(n.change((e=>{e.setSelection(c?r:i)})),t.preventDefault(),e.stop()))}if(!s.isCollapsed)return;const u=this._getObjectElementNextToSelection(c);if(u&&o.isObject(u)){if(o.isInline(u)&&d)return;this._setSelectionOverElement(u),t.preventDefault(),e.stop()}}_preventDefaultOnArrowKeyPress(e,t){const i=this.editor.model,n=i.schema,o=i.document.selection.getSelectedElement();o&&n.isObject(o)&&(t.preventDefault(),e.stop())}_handleDelete(e){const t=this.editor.model.document.selection;if(!this.editor.model.canEditAt(t))return;if(!t.isCollapsed)return;const i=this._getObjectElementNextToSelection(e);return i?(this.editor.model.change((e=>{let n=t.anchor.parent;for(;n.isEmpty;){const t=n;n=t.parent,e.remove(t)}this._setSelectionOverElement(i)})),!0):void 0}_setSelectionOverElement(e){this.editor.model.change((t=>{t.setSelection(t.createRangeOn(e))}))}_getObjectElementNextToSelection(e){const t=this.editor.model,i=t.schema,n=t.document.selection,o=t.createSelection(n);if(t.modifySelection(o,{direction:e?"forward":"backward"}),o.isEqual(n))return null;const s=e?o.focus.nodeBefore:o.focus.nodeAfter;return s&&i.isObject(s)?s:null}_clearPreviouslySelectedWidgets(e){for(const t of this._previouslySelected)e.removeClass(g,t);this._previouslySelected.clear()}_selectFirstNestedEditable(){const e=this.editor,t=this.editor.editing.view.document;for(const i of t.selection.getFirstRange().getItems())if(i.is("editableElement")){const t=e.editing.mapper.toModelElement(i);if(!t)continue;const n=e.model.createPositionAt(t,0),o=e.model.schema.getNearestSelectionRange(n,"forward");return e.model.change((e=>{e.setSelection(o)})),!0}return!1}_selectAncestorWidget(){const e=this.editor,t=e.editing.mapper,i=e.editing.view.document.selection.getFirstPosition().parent,n=(i.is("$text")?i.parent:i).findAncestor(f);if(!n)return!1;const o=t.toModelElement(n);return!!o&&(e.model.change((e=>{e.setSelection(o,"on")})),!0)}}class N extends n.Plugin{constructor(){super(...arguments),this._toolbarDefinitions=new Map}static get requires(){return[a.ContextualBalloon]}static get pluginName(){return"WidgetToolbarRepository"}init(){const e=this.editor;if(e.plugins.has("BalloonToolbar")){const t=e.plugins.get("BalloonToolbar");this.listenTo(t,"show",(t=>{(function(e){const t=e.getSelectedElement();return!(!t||!f(t))})(e.editing.view.document.selection)&&t.stop()}),{priority:"high"})}this._balloon=this.editor.plugins.get("ContextualBalloon"),this.on("change:isEnabled",(()=>{this._updateToolbarsVisibility()})),this.listenTo(e.ui,"update",(()=>{this._updateToolbarsVisibility()})),this.listenTo(e.ui.focusTracker,"change:isFocused",(()=>{this._updateToolbarsVisibility()}),{priority:"low"})}destroy(){super.destroy();for(const e of this._toolbarDefinitions.values())e.view.destroy()}register(e,{ariaLabel:t,items:i,getRelatedElement:n,balloonClassName:o="ck-toolbar-container"}){if(!i.length)return void(0,r.logWarning)("widget-toolbar-no-items",{toolbarId:e});const s=this.editor,l=s.t,c=new a.ToolbarView(s.locale);if(c.ariaLabel=t||l("Widget toolbar"),this._toolbarDefinitions.has(e))throw new r.CKEditorError("widget-toolbar-duplicated",this,{toolbarId:e});const d={view:c,getRelatedElement:n,balloonClassName:o,itemsConfig:i,initialized:!1};s.ui.addToolbar(c,{isContextual:!0,beforeFocus:()=>{const e=n(s.editing.view.document.selection);e&&this._showToolbar(d,e)},afterBlur:()=>{this._hideToolbar(d)}}),this._toolbarDefinitions.set(e,d)}_updateToolbarsVisibility(){let e=0,t=null,i=null;for(const n of this._toolbarDefinitions.values()){const o=n.getRelatedElement(this.editor.editing.view.document.selection);if(this.isEnabled&&o)if(this.editor.ui.focusTracker.isFocused){const s=o.getAncestors().length;s>e&&(e=s,t=o,i=n)}else this._isToolbarVisible(n)&&this._hideToolbar(n);else this._isToolbarInBalloon(n)&&this._hideToolbar(n)}i&&this._showToolbar(i,t)}_hideToolbar(e){this._balloon.remove(e.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(e,t){this._isToolbarVisible(e)?D(this.editor,t):this._isToolbarInBalloon(e)||(e.initialized||(e.initialized=!0,e.view.fillFromConfig(e.itemsConfig,this.editor.ui.componentFactory)),this._balloon.add({view:e.view,position:z(this.editor,t),balloonClassName:e.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",(()=>{for(const e of this._toolbarDefinitions.values())if(this._isToolbarVisible(e)){const t=e.getRelatedElement(this.editor.editing.view.document.selection);D(this.editor,t)}})))}_isToolbarVisible(e){return this._balloon.visibleView===e.view}_isToolbarInBalloon(e){return this._balloon.hasView(e.view)}}function D(e,t){const i=e.plugins.get("ContextualBalloon"),n=z(e,t);i.updatePosition(n)}function z(e,t){const i=e.editing.view,n=a.BalloonPanelView.defaultPositions;return{target:i.domConverter.mapViewToDom(t),positions:[n.northArrowSouth,n.northArrowSouthWest,n.northArrowSouthEast,n.southArrowNorth,n.southArrowNorthWest,n.southArrowNorthEast,n.viewportStickyNorth]}}class W extends((0,r.ObservableMixin)()){constructor(e){super(),this.set("activeHandlePosition",null),this.set("proposedWidthPercents",null),this.set("proposedWidth",null),this.set("proposedHeight",null),this.set("proposedHandleHostWidth",null),this.set("proposedHandleHostHeight",null),this._options=e,this._referenceCoordinates=null}get originalWidth(){return this._originalWidth}get originalHeight(){return this._originalHeight}get originalWidthPercents(){return this._originalWidthPercents}get aspectRatio(){return this._aspectRatio}begin(e,t,i){const n=new r.Rect(t);this.activeHandlePosition=function(e){const t=["top-left","top-right","bottom-right","bottom-left"];for(const i of t)if(e.classList.contains(`ck-widget__resizer__handle-${i}`))return i}(e),this._referenceCoordinates=function(e,t){const i=new r.Rect(e),n=t.split("-"),o={x:"right"==n[1]?i.right:i.left,y:"bottom"==n[0]?i.bottom:i.top};return o.x+=e.ownerDocument.defaultView.scrollX,o.y+=e.ownerDocument.defaultView.scrollY,o}(t,function(e){const t=e.split("-"),i={top:"bottom",bottom:"top",left:"right",right:"left"};return`${i[t[0]]}-${i[t[1]]}`}(this.activeHandlePosition)),this._originalWidth=n.width,this._originalHeight=n.height,this._aspectRatio=n.width/n.height;const o=i.style.width;o&&o.match(/^\d+(\.\d*)?%$/)?this._originalWidthPercents=parseFloat(o):this._originalWidthPercents=T(i,n)}update(e){this.proposedWidth=e.width,this.proposedHeight=e.height,this.proposedWidthPercents=e.widthPercents,this.proposedHandleHostWidth=e.handleHostWidth,this.proposedHandleHostHeight=e.handleHostHeight}}class H extends a.View{constructor(){super();const e=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-size-view",e.to("_viewPosition",(e=>e?`ck-orientation-${e}`:""))],style:{display:e.if("_isVisible","none",(e=>!e))}},children:[{text:e.to("_label")}]})}_bindToState(e,t){this.bind("_isVisible").to(t,"proposedWidth",t,"proposedHeight",((e,t)=>null!==e&&null!==t)),this.bind("_label").to(t,"proposedHandleHostWidth",t,"proposedHandleHostHeight",t,"proposedWidthPercents",((t,i,n)=>"px"===e.unit?`${t}×${i}`:`${n}%`)),this.bind("_viewPosition").to(t,"activeHandlePosition",t,"proposedHandleHostWidth",t,"proposedHandleHostHeight",((e,t,i)=>t<50||i<50?"above-center":e))}_dismiss(){this.unbind(),this._isVisible=!1}}class U extends((0,r.ObservableMixin)()){constructor(e){super(),this._viewResizerWrapper=null,this._options=e,this.set("isEnabled",!0),this.set("isSelected",!1),this.bind("isVisible").to(this,"isEnabled",this,"isSelected",((e,t)=>e&&t)),this.decorate("begin"),this.decorate("cancel"),this.decorate("commit"),this.decorate("updateSize"),this.on("commit",(e=>{this.state.proposedWidth||this.state.proposedWidthPercents||(this._cleanup(),e.stop())}),{priority:"high"})}get state(){return this._state}show(){this._options.editor.editing.view.change((e=>{e.removeClass("ck-hidden",this._viewResizerWrapper)}))}hide(){this._options.editor.editing.view.change((e=>{e.addClass("ck-hidden",this._viewResizerWrapper)}))}attach(){const e=this,t=this._options.viewElement;this._options.editor.editing.view.change((i=>{const n=i.createUIElement("div",{class:"ck ck-reset_all ck-widget__resizer"},(function(t){const i=this.toDomElement(t);return e._appendHandles(i),e._appendSizeUI(i),i}));i.insert(i.createPositionAt(t,"end"),n),i.addClass("ck-widget_with-resizer",t),this._viewResizerWrapper=n,this.isVisible||this.hide()})),this.on("change:isVisible",(()=>{this.isVisible?(this.show(),this.redraw()):this.hide()}))}begin(e){this._state=new W(this._options),this._sizeView._bindToState(this._options,this.state),this._initialViewWidth=this._options.viewElement.getStyle("width"),this.state.begin(e,this._getHandleHost(),this._getResizeHost())}updateSize(e){const t=this._proposeNewSize(e);this._options.editor.editing.view.change((e=>{const i=this._options.unit||"%",n=("%"===i?t.widthPercents:t.width)+i;e.setStyle("width",n,this._options.viewElement)}));const i=this._getHandleHost(),n=new r.Rect(i),o=Math.round(n.width),s=Math.round(n.height),a=new r.Rect(i);t.width=Math.round(a.width),t.height=Math.round(a.height),this.redraw(n),this.state.update({...t,handleHostWidth:o,handleHostHeight:s})}commit(){const e=this._options.unit||"%",t=("%"===e?this.state.proposedWidthPercents:this.state.proposedWidth)+e;this._options.editor.editing.view.change((()=>{this._cleanup(),this._options.onCommit(t)}))}cancel(){this._cleanup()}destroy(){this.cancel()}redraw(e){const t=this._domResizerWrapper;if(!((i=t)&&i.ownerDocument&&i.ownerDocument.contains(i)))return;var i;const n=t.parentElement,o=this._getHandleHost(),s=this._viewResizerWrapper,a=[s.getStyle("width"),s.getStyle("height"),s.getStyle("left"),s.getStyle("top")];let l;if(n.isSameNode(o)){const t=e||new r.Rect(o);l=[t.width+"px",t.height+"px",void 0,void 0]}else l=[o.offsetWidth+"px",o.offsetHeight+"px",o.offsetLeft+"px",o.offsetTop+"px"];"same"!==(0,r.compareArrays)(a,l)&&this._options.editor.editing.view.change((e=>{e.setStyle({width:l[0],height:l[1],left:l[2],top:l[3]},s)}))}containsHandle(e){return this._domResizerWrapper.contains(e)}static isResizeHandle(e){return e.classList.contains("ck-widget__resizer__handle")}_cleanup(){this._sizeView._dismiss(),this._options.editor.editing.view.change((e=>{e.setStyle("width",this._initialViewWidth,this._options.viewElement)}))}_proposeNewSize(e){const t=this.state,i=(o=e).pageX,n=o.pageY;var o;const s=!this._options.isCentered||this._options.isCentered(this),r={x:t._referenceCoordinates.x-(i+t.originalWidth),y:n-t.originalHeight-t._referenceCoordinates.y};s&&t.activeHandlePosition.endsWith("-right")&&(r.x=i-(t._referenceCoordinates.x+t.originalWidth)),s&&(r.x*=2);let a=Math.abs(t.originalWidth+r.x),l=Math.abs(t.originalHeight+r.y);return"width"==(a/t.aspectRatio>l?"width":"height")?l=a/t.aspectRatio:a=l*t.aspectRatio,{width:Math.round(a),height:Math.round(l),widthPercents:Math.min(Math.round(t.originalWidthPercents/t.originalWidth*a*100)/100,100)}}_getResizeHost(){const e=this._domResizerWrapper.parentElement;return this._options.getResizeHost(e)}_getHandleHost(){const e=this._domResizerWrapper.parentElement;return this._options.getHandleHost(e)}get _domResizerWrapper(){return this._options.editor.editing.view.domConverter.mapViewToDom(this._viewResizerWrapper)}_appendHandles(e){const t=["top-left","top-right","bottom-right","bottom-left"];for(const n of t)e.appendChild(new a.Template({tag:"div",attributes:{class:"ck-widget__resizer__handle "+(i=n,`ck-widget__resizer__handle-${i}`)}}).render());var i}_appendSizeUI(e){this._sizeView=new H,this._sizeView.render(),e.appendChild(this._sizeView.element)}}var $=i(4022);class j extends n.Plugin{constructor(){super(...arguments),this._resizers=new Map}static get pluginName(){return"WidgetResize"}init(){const e=this.editor.editing,t=r.global.window.document;this.set("selectedResizer",null),this.set("_activeResizer",null),e.view.addObserver(o.MouseObserver),this._observer=new((0,r.DomEmitterMixin)()),this.listenTo(e.view.document,"mousedown",this._mouseDownListener.bind(this),{priority:"high"}),this._observer.listenTo(t,"mousemove",this._mouseMoveListener.bind(this)),this._observer.listenTo(t,"mouseup",this._mouseUpListener.bind(this)),this._redrawSelectedResizerThrottled=(0,$.A)((()=>this.redrawSelectedResizer()),200),this.editor.ui.on("update",this._redrawSelectedResizerThrottled),this.editor.model.document.on("change",(()=>{for(const[e,t]of this._resizers)e.isAttached()||(this._resizers.delete(e),t.destroy())}),{priority:"lowest"}),this._observer.listenTo(r.global.window,"resize",this._redrawSelectedResizerThrottled);const i=this.editor.editing.view.document.selection;i.on("change",(()=>{const e=i.getSelectedElement(),t=this.getResizerByViewElement(e)||null;t?this.select(t):this.deselect()}))}redrawSelectedResizer(){this.selectedResizer&&this.selectedResizer.isVisible&&this.selectedResizer.redraw()}destroy(){super.destroy(),this._observer.stopListening();for(const e of this._resizers.values())e.destroy();this._redrawSelectedResizerThrottled.cancel()}select(e){this.deselect(),this.selectedResizer=e,this.selectedResizer.isSelected=!0}deselect(){this.selectedResizer&&(this.selectedResizer.isSelected=!1),this.selectedResizer=null}attachTo(e){const t=new U(e),i=this.editor.plugins;if(t.attach(),i.has("WidgetToolbarRepository")){const e=i.get("WidgetToolbarRepository");t.on("begin",(()=>{e.forceDisabled("resize")}),{priority:"lowest"}),t.on("cancel",(()=>{e.clearForceDisabled("resize")}),{priority:"highest"}),t.on("commit",(()=>{e.clearForceDisabled("resize")}),{priority:"highest"})}this._resizers.set(e.viewElement,t);const n=this.editor.editing.view.document.selection.getSelectedElement();return this.getResizerByViewElement(n)==t&&this.select(t),t}getResizerByViewElement(e){return this._resizers.get(e)}_getResizerByHandle(e){for(const t of this._resizers.values())if(t.containsHandle(e))return t}_mouseDownListener(e,t){const i=t.domTarget;U.isResizeHandle(i)&&(this._activeResizer=this._getResizerByHandle(i)||null,this._activeResizer&&(this._activeResizer.begin(i),e.stop(),t.preventDefault()))}_mouseMoveListener(e,t){this._activeResizer&&this._activeResizer.updateSize(t)}_mouseUpListener(){this._activeResizer&&(this._activeResizer.commit(),this._activeResizer=null)}}},7377:(e,t,i)=>{"use strict";i.d(t,{$J:()=>n.ClipboardMarkersUtils,B0:()=>n.Clipboard,xz:()=>n.ClipboardPipeline});var n=i(6034)},1204:(e,t,i)=>{"use strict";i.d(t,{JF:()=>n.attachToForm,KE:()=>n.Editor,Pt:()=>n.icons,TS:()=>n.PendingActions,fE:()=>n.MultiCommand,k_:()=>n.Plugin,mJ:()=>n.ElementApiMixin,uB:()=>n.Command});var n=i(1024)},4133:(e,t,i)=>{"use strict";i.d(t,{$0:()=>n.needsPlaceholder,$A:()=>n.DomEventObserver,D0:()=>n.addBackgroundRules,Hg:()=>n.Element,JT:()=>n.enablePlaceholder,Oo:()=>n.LiveRange,P$:()=>n.DomConverter,PN:()=>n.Matcher,Re:()=>n.ClickObserver,SH:()=>n.getFillerOffset,Vg:()=>n.ViewDocument,Vq:()=>n.isLength,Wq:()=>n.UpcastWriter,YU:()=>n.hidePlaceholder,Zu:()=>n.showPlaceholder,_o:()=>n.isColor,fp:()=>n.isPercentage,m8:()=>n.LivePosition,mC:()=>n.addPaddingRules,nu:()=>n.Observer,rU:()=>n.TreeWalker,v7:()=>n.addBorderRules,vt:()=>n.addMarginRules,zN:()=>n.DowncastWriter});var n=i(151)},6449:(e,t,i)=>{"use strict";i.d(t,{D:()=>n.ShiftEnter,x:()=>n.Enter});var n=i(7207)},7211:(e,t,i)=>{"use strict";i.d(t,{IG:()=>n.Typing,Il:()=>n.inlineHighlight,Py:()=>n.findAttributeRange,Vp:()=>n.TwoStepCaretMovement,ep:()=>n.Delete,ex:()=>n.getLastTextLine,pd:()=>n.Input,qV:()=>n.TextWatcher});var n=i(6192)},949:(e,t,i)=>{"use strict";i.d(t,{AO:()=>n.SplitButtonView,BD:()=>n.ListItemView,BY:()=>n.MenuBarMenuListView,By:()=>n.createLabeledDropdown,Dy:()=>n.FormHeaderView,Eg:()=>n.Notification,F_:()=>n.createLabeledInputNumber,GG:()=>n.MenuBarMenuListItemFileDialogButtonView,Gn:()=>n.EditorUI,H:()=>n.FocusCycler,I8:()=>n.MenuBarMenuListItemView,IY:()=>n.ToolbarSeparatorView,Jc:()=>n.ViewModel,Je:()=>n.ListSeparatorView,Jr:()=>n.BalloonPanelView,KO:()=>n.AccessibilityHelp,Kn:()=>n.CollapsibleView,LU:()=>n.InlineEditableUIView,O:()=>n.addListToDropdown,Ss:()=>n.View,Vr:()=>n.createLabeledInputText,Wm:()=>n.SwitchButtonView,X3:()=>n.ToolbarView,Xt:()=>n.BoxedEditorUIView,Z5:()=>n.submitHandler,Zn:()=>n.focusChildOnDropdownOpen,_:()=>n.ButtonView,_m:()=>n.DialogView,b2:()=>n.getLocalizedColorOptions,eF:()=>n.FileDialogButtonView,fM:()=>n.addToolbarToDropdown,fl:()=>n.normalizeToolbarConfig,hK:()=>n.InputTextView,kS:()=>n.MenuBarMenuListItemButtonView,l1:()=>n.addKeyboardHandlingForGrid,lF:()=>n.normalizeColorOptions,lG:()=>n.Dialog,lU:()=>n.DropdownButtonView,oB:()=>n.ColorSelectorView,pU:()=>n.ContextualBalloon,s3:()=>n.ViewCollection,uO:()=>n.ListView,wi:()=>n.CssTransitionDisablerMixin,wy:()=>n.clickOutsideHandler,xE:()=>n.LabeledFieldView,xw:()=>n.StickyPanelView,y0:()=>n.LabelView,yJ:()=>n.MenuBarView,yu:()=>n.createDropdown,zj:()=>n.MenuBarMenuView});var n=i(7243)},6417:(e,t,i)=>{"use strict";i.d(t,{Vn:()=>n.Undo});var n=i(8511)},5318:(e,t,i)=>{"use strict";i.d(t,{$1:()=>n.first,$r:()=>n.toArray,$x:()=>n.FocusTracker,EP:()=>n.KeystrokeHandler,FF:()=>n.logWarning,Kf:()=>n.getLocalizedArrowKeyCodeDirection,Ld:()=>n.uid,PZ:()=>n.ElementReplacer,QC:()=>n.getCode,Sf:()=>n.global,VM:()=>n.ObservableMixin,Yb:()=>n.CKEditorError,ZX:()=>n.parseKeystroke,_K:()=>n.env,av:()=>n.toMap,c5:()=>n.DomEmitterMixin,iJ:()=>n.getLanguageDirection,n:()=>n.createElement,pG:()=>n.getDataFromElement,pM:()=>n.Collection,rw:()=>n.Rect,uP:()=>n.keyCodes,vx:()=>n.priorities});var n=i(7906)},5091:(e,t,i)=>{"use strict";i.d(t,{Ex:()=>n.toWidget,VE:()=>n.WidgetResize,Wu:()=>n.calculateResizeHostAncestorWidth,YN:()=>n.toWidgetEditable,iB:()=>n.findOptimalInsertionRange,oP:()=>n.WidgetToolbarRepository,p4:()=>n.isWidget,x0:()=>n.Widget});var n=i(3906)},9469:(e,t,i)=>{"use strict";i.d(t,{A:()=>a});var n=i(6984);const o=function(e,t){for(var i=e.length;i--;)if((0,n.A)(e[i][0],t))return i;return-1};var s=Array.prototype.splice;function r(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}r.prototype.clear=function(){this.__data__=[],this.size=0},r.prototype.delete=function(e){var t=this.__data__,i=o(t,e);return!(i<0||(i==t.length-1?t.pop():s.call(t,i,1),--this.size,0))},r.prototype.get=function(e){var t=this.__data__,i=o(t,e);return i<0?void 0:t[i][1]},r.prototype.has=function(e){return o(this.__data__,e)>-1},r.prototype.set=function(e,t){var i=this.__data__,n=o(i,e);return n<0?(++this.size,i.push([e,t])):i[n][1]=t,this};const a=r},8335:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var n=i(8562),o=i(1917);const s=(0,n.A)(o.A,"Map")},2050:(e,t,i)=>{"use strict";i.d(t,{A:()=>h});const n=(0,i(8562).A)(Object,"create");var o=Object.prototype.hasOwnProperty;var s=Object.prototype.hasOwnProperty;function r(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}r.prototype.clear=function(){this.__data__=n?n(null):{},this.size=0},r.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},r.prototype.get=function(e){var t=this.__data__;if(n){var i=t[e];return"__lodash_hash_undefined__"===i?void 0:i}return o.call(t,e)?t[e]:void 0},r.prototype.has=function(e){var t=this.__data__;return n?void 0!==t[e]:s.call(t,e)},r.prototype.set=function(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=n&&void 0===t?"__lodash_hash_undefined__":t,this};const a=r;var l=i(9469),c=i(8335);const d=function(e,t){var i,n,o=e.__data__;return("string"==(n=typeof(i=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==i:null===i)?o["string"==typeof t?"string":"hash"]:o.map};function u(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}u.prototype.clear=function(){this.size=0,this.__data__={hash:new a,map:new(c.A||l.A),string:new a}},u.prototype.delete=function(e){var t=d(this,e).delete(e);return this.size-=t?1:0,t},u.prototype.get=function(e){return d(this,e).get(e)},u.prototype.has=function(e){return d(this,e).has(e)},u.prototype.set=function(e,t){var i=d(this,e),n=i.size;return i.set(e,t),this.size+=i.size==n?0:1,this};const h=u},2080:(e,t,i)=>{"use strict";i.d(t,{A:()=>a});var n=i(9469);var o=i(8335),s=i(2050);function r(e){var t=this.__data__=new n.A(e);this.size=t.size}r.prototype.clear=function(){this.__data__=new n.A,this.size=0},r.prototype.delete=function(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i},r.prototype.get=function(e){return this.__data__.get(e)},r.prototype.has=function(e){return this.__data__.has(e)},r.prototype.set=function(e,t){var i=this.__data__;if(i instanceof n.A){var r=i.__data__;if(!o.A||r.length<199)return r.push([e,t]),this.size=++i.size,this;i=this.__data__=new s.A(r)}return i.set(e,t),this.size=i.size,this};const a=r},241:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=i(1917).A.Symbol},3988:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=i(1917).A.Uint8Array},2505:(e,t,i)=>{"use strict";i.d(t,{A:()=>c});var n=i(5175),o=i(2049),s=i(1200),r=i(5353),a=i(4749),l=Object.prototype.hasOwnProperty;const c=function(e,t){var i=(0,o.A)(e),c=!i&&(0,n.A)(e),d=!i&&!c&&(0,s.A)(e),u=!i&&!c&&!d&&(0,a.A)(e),h=i||c||d||u,m=h?function(e,t){for(var i=-1,n=Array(e);++i<e;)n[i]=t(i);return n}(e.length,String):[],g=m.length;for(var f in e)!t&&!l.call(e,f)||h&&("length"==f||d&&("offset"==f||"parent"==f)||u&&("buffer"==f||"byteLength"==f||"byteOffset"==f)||(0,r.A)(f,g))||m.push(f);return m}},5572:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(e,t){for(var i=-1,n=null==e?0:e.length,o=Array(n);++i<n;)o[i]=t(e[i],i,e);return o}},6912:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(e,t){for(var i=-1,n=t.length,o=e.length;++i<n;)e[o+i]=t[i];return e}},2851:(e,t,i)=>{"use strict";i.d(t,{A:()=>r});var n=i(2528),o=i(6984),s=Object.prototype.hasOwnProperty;const r=function(e,t,i){var r=e[t];s.call(e,t)&&(0,o.A)(r,i)&&(void 0!==i||t in e)||(0,n.A)(e,t,i)}},2528:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=i(4171);const o=function(e,t,i){"__proto__"==t&&n.A?(0,n.A)(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i}},9592:(e,t,i)=>{"use strict";i.d(t,{A:()=>H});var n=i(2080);var o=i(2851),s=i(2031),r=i(7405);var a=i(9999);var l=i(154),c=i(9759),d=i(6489);var u=i(6912),h=i(5647),m=i(3153);const g=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)(0,u.A)(t,(0,d.A)(e)),e=(0,h.A)(e);return t}:m.A;var f=i(9042),p=i(3831);const b=function(e){return(0,p.A)(e,a.A,g)};var w=i(2434),v=Object.prototype.hasOwnProperty;var _=i(565);var y=/\w*$/;var k=i(241),C=k.A?k.A.prototype:void 0,A=C?C.valueOf:void 0;var E=i(1801);const x=function(e,t,i){var n,o,s,r=e.constructor;switch(t){case"[object ArrayBuffer]":return(0,_.A)(e);case"[object Boolean]":case"[object Date]":return new r(+e);case"[object DataView]":return function(e,t){var i=t?(0,_.A)(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)}(e,i);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return(0,E.A)(e,i);case"[object Map]":case"[object Set]":return new r;case"[object Number]":case"[object String]":return new r(e);case"[object RegExp]":return(s=new(o=e).constructor(o.source,y.exec(o))).lastIndex=o.lastIndex,s;case"[object Symbol]":return n=e,A?Object(A.call(n)):{}}};var T=i(407),P=i(2049),I=i(1200),S=i(3098);var V=i(2789),R=i(4841),B=R.A&&R.A.isMap;const M=B?(0,V.A)(B):function(e){return(0,S.A)(e)&&"[object Map]"==(0,w.A)(e)};var O=i(3149);var L=R.A&&R.A.isSet;const F=L?(0,V.A)(L):function(e){return(0,S.A)(e)&&"[object Set]"==(0,w.A)(e)};var N="[object Arguments]",D="[object Function]",z="[object Object]",W={};W[N]=W["[object Array]"]=W["[object ArrayBuffer]"]=W["[object DataView]"]=W["[object Boolean]"]=W["[object Date]"]=W["[object Float32Array]"]=W["[object Float64Array]"]=W["[object Int8Array]"]=W["[object Int16Array]"]=W["[object Int32Array]"]=W["[object Map]"]=W["[object Number]"]=W[z]=W["[object RegExp]"]=W["[object Set]"]=W["[object String]"]=W["[object Symbol]"]=W["[object Uint8Array]"]=W["[object Uint8ClampedArray]"]=W["[object Uint16Array]"]=W["[object Uint32Array]"]=!0,W["[object Error]"]=W[D]=W["[object WeakMap]"]=!1;const H=function e(t,i,u,h,m,p){var _,y=1&i,k=2&i,C=4&i;if(u&&(_=m?u(t,h,m,p):u(t)),void 0!==_)return _;if(!(0,O.A)(t))return t;var A=(0,P.A)(t);if(A){if(_=function(e){var t=e.length,i=new e.constructor(t);return t&&"string"==typeof e[0]&&v.call(e,"index")&&(i.index=e.index,i.input=e.input),i}(t),!y)return(0,c.A)(t,_)}else{var E=(0,w.A)(t),S=E==D||"[object GeneratorFunction]"==E;if((0,I.A)(t))return(0,l.A)(t,y);if(E==z||E==N||S&&!m){if(_=k||S?{}:(0,T.A)(t),!y)return k?function(e,t){return(0,s.A)(e,g(e),t)}(t,function(e,t){return e&&(0,s.A)(t,(0,a.A)(t),e)}(_,t)):function(e,t){return(0,s.A)(e,(0,d.A)(e),t)}(t,function(e,t){return e&&(0,s.A)(t,(0,r.A)(t),e)}(_,t))}else{if(!W[E])return m?t:{};_=x(t,E,y)}}p||(p=new n.A);var V=p.get(t);if(V)return V;p.set(t,_),F(t)?t.forEach((function(n){_.add(e(n,i,u,n,t,p))})):M(t)&&t.forEach((function(n,o){_.set(o,e(n,i,u,o,t,p))}));var R=C?k?b:f.A:k?a.A:r.A,B=A?void 0:R(t);return function(e,t){for(var i=-1,n=null==e?0:e.length;++i<n&&!1!==t(e[i],i,e););}(B||t,(function(n,s){B&&(n=t[s=n]),(0,o.A)(_,s,e(n,i,u,s,t,p))})),_}},7132:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(e,t,i){for(var n=-1,o=Object(e),s=i(e),r=s.length;r--;){var a=s[++n];if(!1===t(o[a],a,o))break}return e}},9841:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var n=i(7132),o=i(7405);const s=function(e,t){return e&&(0,n.A)(e,t,o.A)}},6318:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var n=i(4878),o=i(901);const s=function(e,t){for(var i=0,s=(t=(0,n.A)(t,e)).length;null!=e&&i<s;)e=e[(0,o.A)(t[i++])];return i&&i==s?e:void 0}},3831:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var n=i(6912),o=i(2049);const s=function(e,t,i){var s=t(e);return(0,o.A)(e)?s:(0,n.A)(s,i(e))}},2383:(e,t,i)=>{"use strict";i.d(t,{A:()=>d});var n=i(241),o=Object.prototype,s=o.hasOwnProperty,r=o.toString,a=n.A?n.A.toStringTag:void 0;var l=Object.prototype.toString;var c=n.A?n.A.toStringTag:void 0;const d=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":c&&c in Object(e)?function(e){var t=s.call(e,a),i=e[a];try{e[a]=void 0;var n=!0}catch(e){}var o=r.call(e);return n&&(t?e[a]=i:delete e[a]),o}(e):function(e){return l.call(e)}(e)}},5407:(e,t,i)=>{"use strict";i.d(t,{A:()=>P});var n=i(2080),o=i(2050);function s(e){var t=-1,i=null==e?0:e.length;for(this.__data__=new o.A;++t<i;)this.add(e[t])}s.prototype.add=s.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},s.prototype.has=function(e){return this.__data__.has(e)};const r=s,a=function(e,t){for(var i=-1,n=null==e?0:e.length;++i<n;)if(t(e[i],i,e))return!0;return!1},l=function(e,t,i,n,o,s){var l=1&i,c=e.length,d=t.length;if(c!=d&&!(l&&d>c))return!1;var u=s.get(e),h=s.get(t);if(u&&h)return u==t&&h==e;var m=-1,g=!0,f=2&i?new r:void 0;for(s.set(e,t),s.set(t,e);++m<c;){var p=e[m],b=t[m];if(n)var w=l?n(b,p,m,t,e,s):n(p,b,m,e,t,s);if(void 0!==w){if(w)continue;g=!1;break}if(f){if(!a(t,(function(e,t){if(r=t,!f.has(r)&&(p===e||o(p,e,i,n,s)))return f.push(t);var r}))){g=!1;break}}else if(p!==b&&!o(p,b,i,n,s)){g=!1;break}}return s.delete(e),s.delete(t),g};var c=i(241),d=i(3988),u=i(6984);const h=function(e){var t=-1,i=Array(e.size);return e.forEach((function(e,n){i[++t]=[n,e]})),i},m=function(e){var t=-1,i=Array(e.size);return e.forEach((function(e){i[++t]=e})),i};var g=c.A?c.A.prototype:void 0,f=g?g.valueOf:void 0;var p=i(9042),b=Object.prototype.hasOwnProperty;var w=i(2434),v=i(2049),_=i(1200),y=i(4749),k="[object Arguments]",C="[object Array]",A="[object Object]",E=Object.prototype.hasOwnProperty;const x=function(e,t,i,o,s,r){var a=(0,v.A)(e),c=(0,v.A)(t),g=a?C:(0,w.A)(e),x=c?C:(0,w.A)(t),T=(g=g==k?A:g)==A,P=(x=x==k?A:x)==A,I=g==x;if(I&&(0,_.A)(e)){if(!(0,_.A)(t))return!1;a=!0,T=!1}if(I&&!T)return r||(r=new n.A),a||(0,y.A)(e)?l(e,t,i,o,s,r):function(e,t,i,n,o,s,r){switch(i){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!s(new d.A(e),new d.A(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return(0,u.A)(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=h;case"[object Set]":var c=1&n;if(a||(a=m),e.size!=t.size&&!c)return!1;var g=r.get(e);if(g)return g==t;n|=2,r.set(e,t);var p=l(a(e),a(t),n,o,s,r);return r.delete(e),p;case"[object Symbol]":if(f)return f.call(e)==f.call(t)}return!1}(e,t,g,i,o,s,r);if(!(1&i)){var S=T&&E.call(e,"__wrapped__"),V=P&&E.call(t,"__wrapped__");if(S||V){var R=S?e.value():e,B=V?t.value():t;return r||(r=new n.A),s(R,B,i,o,r)}}return!!I&&(r||(r=new n.A),function(e,t,i,n,o,s){var r=1&i,a=(0,p.A)(e),l=a.length;if(l!=(0,p.A)(t).length&&!r)return!1;for(var c=l;c--;){var d=a[c];if(!(r?d in t:b.call(t,d)))return!1}var u=s.get(e),h=s.get(t);if(u&&h)return u==t&&h==e;var m=!0;s.set(e,t),s.set(t,e);for(var g=r;++c<l;){var f=e[d=a[c]],w=t[d];if(n)var v=r?n(w,f,d,t,e,s):n(f,w,d,e,t,s);if(!(void 0===v?f===w||o(f,w,i,n,s):v)){m=!1;break}g||(g="constructor"==d)}if(m&&!g){var _=e.constructor,y=t.constructor;_==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof _&&_ instanceof _&&"function"==typeof y&&y instanceof y||(m=!1)}return s.delete(e),s.delete(t),m}(e,t,i,o,s,r))};var T=i(3098);const P=function e(t,i,n,o,s){return t===i||(null==t||null==i||!(0,T.A)(t)&&!(0,T.A)(i)?t!=t&&i!=i:x(t,i,n,o,e,s))}},5396:(e,t,i)=>{"use strict";i.d(t,{A:()=>C});var n=i(2080),o=i(5407);var s=i(3149);const r=function(e){return e==e&&!(0,s.A)(e)};var a=i(7405);const l=function(e,t){return function(i){return null!=i&&i[e]===t&&(void 0!==t||e in Object(i))}},c=function(e){var t=function(e){for(var t=(0,a.A)(e),i=t.length;i--;){var n=t[i],o=e[n];t[i]=[n,o,r(o)]}return t}(e);return 1==t.length&&t[0][2]?l(t[0][0],t[0][1]):function(i){return i===e||function(e,t,i,s){var r=i.length,a=r,l=!s;if(null==e)return!a;for(e=Object(e);r--;){var c=i[r];if(l&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++r<a;){var d=(c=i[r])[0],u=e[d],h=c[1];if(l&&c[2]){if(void 0===u&&!(d in e))return!1}else{var m=new n.A;if(s)var g=s(u,h,d,e,t,m);if(!(void 0===g?(0,o.A)(h,u,3,s,m):g))return!1}}return!0}(i,e,t)}};var d=i(7500);const u=function(e,t){return null!=e&&t in Object(e)};var h=i(4878),m=i(5175),g=i(2049),f=i(5353),p=i(5254),b=i(901);const w=function(e,t){return null!=e&&function(e,t,i){for(var n=-1,o=(t=(0,h.A)(t,e)).length,s=!1;++n<o;){var r=(0,b.A)(t[n]);if(!(s=null!=e&&i(e,r)))break;e=e[r]}return s||++n!=o?s:!!(o=null==e?0:e.length)&&(0,p.A)(o)&&(0,f.A)(r,o)&&((0,g.A)(e)||(0,m.A)(e))}(e,t,u)};var v=i(6586);var _=i(9008);var y=i(6318);const k=function(e){return(0,v.A)(e)?(t=(0,b.A)(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return(0,y.A)(t,e)}}(e);var t},C=function(e){return"function"==typeof e?e:null==e?_.A:"object"==typeof e?(0,g.A)(e)?(t=e[0],i=e[1],(0,v.A)(t)&&r(i)?l((0,b.A)(t),i):function(e){var n=(0,d.A)(e,t);return void 0===n&&n===i?w(e,t):(0,o.A)(i,n,3)}):c(e):k(e);var t,i}},7688:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(e,t,i){var n=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(i=i>o?o:i)<0&&(i+=o),o=t>i?0:i-t>>>0,t>>>=0;for(var s=Array(o);++n<o;)s[n]=e[n+t];return s}},2789:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(e){return function(t){return e(t)}}},4878:(e,t,i)=>{"use strict";i.d(t,{A:()=>m});var n=i(2049),o=i(6586),s=i(2050);function r(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var i=function(){var n=arguments,o=t?t.apply(this,n):n[0],s=i.cache;if(s.has(o))return s.get(o);var r=e.apply(this,n);return i.cache=s.set(o,r)||s,r};return i.cache=new(r.Cache||s.A),i}r.Cache=s.A;var a=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,l=/\\(\\)?/g;const c=(d=r((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(a,(function(e,i,n,o){t.push(n?o.replace(l,"$1"):i||e)})),t}),(function(e){return 500===u.size&&u.clear(),e})),u=d.cache,d);var d,u,h=i(3456);const m=function(e,t){return(0,n.A)(e)?e:(0,o.A)(e,t)?[e]:c((0,h.A)(e))}},565:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=i(3988);const o=function(e){var t=new e.constructor(e.byteLength);return new n.A(t).set(new n.A(e)),t}},154:(e,t,i)=>{"use strict";i.d(t,{A:()=>l});var n=i(1917),o="object"==typeof exports&&exports&&!exports.nodeType&&exports,s=o&&"object"==typeof module&&module&&!module.nodeType&&module,r=s&&s.exports===o?n.A.Buffer:void 0,a=r?r.allocUnsafe:void 0;const l=function(e,t){if(t)return e.slice();var i=e.length,n=a?a(i):new e.constructor(i);return e.copy(n),n}},1801:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=i(565);const o=function(e,t){var i=t?(0,n.A)(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}},9759:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(e,t){var i=-1,n=e.length;for(t||(t=Array(n));++i<n;)t[i]=e[i];return t}},2031:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var n=i(2851),o=i(2528);const s=function(e,t,i,s){var r=!i;i||(i={});for(var a=-1,l=t.length;++a<l;){var c=t[a],d=s?s(i[c],e[c],c,i,e):void 0;void 0===d&&(d=e[c]),r?(0,o.A)(i,c,d):(0,n.A)(i,c,d)}return i}},5988:(e,t,i)=>{"use strict";i.d(t,{A:()=>b});var n=i(9008);var o=Math.max;var s=i(4171);const r=s.A?function(e,t){return(0,s.A)(e,"toString",{configurable:!0,enumerable:!1,value:(i=t,function(){return i}),writable:!0});var i}:n.A;var a=Date.now;const l=(c=r,d=0,u=0,function(){var e=a(),t=16-(e-u);if(u=e,t>0){if(++d>=800)return arguments[0]}else d=0;return c.apply(void 0,arguments)});var c,d,u;const h=function(e,t){return l(function(e,t,i){return t=o(void 0===t?e.length-1:t,0),function(){for(var n=arguments,s=-1,r=o(n.length-t,0),a=Array(r);++s<r;)a[s]=n[t+s];s=-1;for(var l=Array(t+1);++s<t;)l[s]=n[s];return l[t]=i(a),function(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)}(e,this,l)}}(e,t,n.A),e+"")};var m=i(6984),g=i(8446),f=i(5353),p=i(3149);const b=function(e){return h((function(t,i){var n=-1,o=i.length,s=o>1?i[o-1]:void 0,r=o>2?i[2]:void 0;for(s=e.length>3&&"function"==typeof s?(o--,s):void 0,r&&function(e,t,i){if(!(0,p.A)(i))return!1;var n=typeof t;return!!("number"==n?(0,g.A)(i)&&(0,f.A)(t,i.length):"string"==n&&t in i)&&(0,m.A)(i[t],e)}(i[0],i[1],r)&&(s=o<3?void 0:s,o=1),t=Object(t);++n<o;){var a=i[n];a&&e(t,a,n,s)}return t}))}},4171:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=i(8562);const o=function(){try{var e=(0,n.A)(Object,"defineProperty");return e({},"",{}),e}catch(e){}}()},2136:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n="object"==typeof global&&global&&global.Object===Object&&global},9042:(e,t,i)=>{"use strict";i.d(t,{A:()=>r});var n=i(3831),o=i(6489),s=i(7405);const r=function(e){return(0,n.A)(e,s.A,o.A)}},8562:(e,t,i)=>{"use strict";i.d(t,{A:()=>p});var n=i(9610);const o=i(1917).A["__core-js_shared__"];var s,r=(s=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+s:"";var a=i(3149),l=i(1121),c=/^\[object .+?Constructor\]$/,d=Function.prototype,u=Object.prototype,h=d.toString,m=u.hasOwnProperty,g=RegExp("^"+h.call(m).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const f=function(e){return!(!(0,a.A)(e)||(t=e,r&&r in t))&&((0,n.A)(e)?g:c).test((0,l.A)(e));var t},p=function(e,t){var i=function(e,t){return null==e?void 0:e[t]}(e,t);return f(i)?i:void 0}},5647:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=(0,i(367).A)(Object.getPrototypeOf,Object)},6489:(e,t,i)=>{"use strict";i.d(t,{A:()=>r});var n=i(3153),o=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols;const r=s?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var i=-1,n=null==e?0:e.length,o=0,s=[];++i<n;){var r=e[i];t(r,i,e)&&(s[o++]=r)}return s}(s(e),(function(t){return o.call(e,t)})))}:n.A},2434:(e,t,i)=>{"use strict";i.d(t,{A:()=>C});var n=i(8562),o=i(1917);const s=(0,n.A)(o.A,"DataView");var r=i(8335);const a=(0,n.A)(o.A,"Promise"),l=(0,n.A)(o.A,"Set"),c=(0,n.A)(o.A,"WeakMap");var d=i(2383),u=i(1121),h="[object Map]",m="[object Promise]",g="[object Set]",f="[object WeakMap]",p="[object DataView]",b=(0,u.A)(s),w=(0,u.A)(r.A),v=(0,u.A)(a),_=(0,u.A)(l),y=(0,u.A)(c),k=d.A;(s&&k(new s(new ArrayBuffer(1)))!=p||r.A&&k(new r.A)!=h||a&&k(a.resolve())!=m||l&&k(new l)!=g||c&&k(new c)!=f)&&(k=function(e){var t=(0,d.A)(e),i="[object Object]"==t?e.constructor:void 0,n=i?(0,u.A)(i):"";if(n)switch(n){case b:return p;case w:return h;case v:return m;case _:return g;case y:return f}return t});const C=k},407:(e,t,i)=>{"use strict";i.d(t,{A:()=>l});var n=i(3149),o=Object.create;const s=function(){function e(){}return function(t){if(!(0,n.A)(t))return{};if(o)return o(t);e.prototype=t;var i=new e;return e.prototype=void 0,i}}();var r=i(5647),a=i(7271);const l=function(e){return"function"!=typeof e.constructor||(0,a.A)(e)?{}:s((0,r.A)(e))}},5353:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=/^(?:0|[1-9]\d*)$/;const o=function(e,t){var i=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==i||"symbol"!=i&&n.test(e))&&e>-1&&e%1==0&&e<t}},6586:(e,t,i)=>{"use strict";i.d(t,{A:()=>a});var n=i(2049),o=i(1882),s=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;const a=function(e,t){if((0,n.A)(e))return!1;var i=typeof e;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=e&&!(0,o.A)(e))||r.test(e)||!s.test(e)||null!=t&&e in Object(t)}},7271:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=Object.prototype;const o=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||n)}},4841:(e,t,i)=>{"use strict";i.d(t,{A:()=>a});var n=i(2136),o="object"==typeof exports&&exports&&!exports.nodeType&&exports,s=o&&"object"==typeof module&&module&&!module.nodeType&&module,r=s&&s.exports===o&&n.A.process;const a=function(){try{return s&&s.require&&s.require("util").types||r&&r.binding&&r.binding("util")}catch(e){}}()},367:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(e,t){return function(i){return e(t(i))}}},1917:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var n=i(2136),o="object"==typeof self&&self&&self.Object===Object&&self;const s=n.A||o||Function("return this")()},901:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=i(1882);const o=function(e){if("string"==typeof e||(0,n.A)(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}},1121:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=Function.prototype.toString;const o=function(e){if(null!=e){try{return n.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},6232:(e,t,i)=>{"use strict";i.d(t,{A:()=>r});var n=i(2031),o=i(5988),s=i(9999);const r=(0,o.A)((function(e,t){(0,n.A)(t,(0,s.A)(t),e)}))},903:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=i(9592);const o=function(e){return(0,n.A)(e,5)}},3967:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=i(9592);const o=function(e,t){return t="function"==typeof t?t:void 0,(0,n.A)(e,5,t)}},2223:(e,t,i)=>{"use strict";i.d(t,{A:()=>b});var n=i(3149),o=i(1917);const s=function(){return o.A.Date.now()};var r=/\s/;var a=/^\s+/;const l=function(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&r.test(e.charAt(t)););return t}(e)+1).replace(a,""):e};var c=i(1882),d=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,h=/^0o[0-7]+$/i,m=parseInt;const g=function(e){if("number"==typeof e)return e;if((0,c.A)(e))return NaN;if((0,n.A)(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=(0,n.A)(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=l(e);var i=u.test(e);return i||h.test(e)?m(e.slice(2),i?2:8):d.test(e)?NaN:+e};var f=Math.max,p=Math.min;const b=function(e,t,i){var o,r,a,l,c,d,u=0,h=!1,m=!1,b=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function w(t){var i=o,n=r;return o=r=void 0,u=t,l=e.apply(n,i)}function v(e){var i=e-d;return void 0===d||i>=t||i<0||m&&e-u>=a}function _(){var e=s();if(v(e))return y(e);c=setTimeout(_,function(e){var i=t-(e-d);return m?p(i,a-(e-u)):i}(e))}function y(e){return c=void 0,b&&o?w(e):(o=r=void 0,l)}function k(){var e=s(),i=v(e);if(o=arguments,r=this,d=e,i){if(void 0===c)return function(e){return u=e,c=setTimeout(_,t),h?w(e):l}(d);if(m)return clearTimeout(c),c=setTimeout(_,t),w(d)}return void 0===c&&(c=setTimeout(_,t)),l}return t=g(t)||0,(0,n.A)(i)&&(h=!!i.leading,a=(m="maxWait"in i)?f(g(i.maxWait)||0,t):a,b="trailing"in i?!!i.trailing:b),k.cancel=function(){void 0!==c&&clearTimeout(c),u=0,o=d=r=c=void 0},k.flush=function(){return void 0===c?l:y(s())},k}},6984:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(e,t){return e===t||e!=e&&t!=t}},3224:(e,t,i)=>{"use strict";i.d(t,{A:()=>r});var n=i(3456),o=/[\\^$.*+?()[\]{}|]/g,s=RegExp(o.source);const r=function(e){return(e=(0,n.A)(e))&&s.test(e)?e.replace(o,"\\$&"):e}},7500:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=i(6318);const o=function(e,t,i){var o=null==e?void 0:(0,n.A)(e,t);return void 0===o?i:o}},9008:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(e){return e}},5175:(e,t,i)=>{"use strict";i.d(t,{A:()=>c});var n=i(2383),o=i(3098);const s=function(e){return(0,o.A)(e)&&"[object Arguments]"==(0,n.A)(e)};var r=Object.prototype,a=r.hasOwnProperty,l=r.propertyIsEnumerable;const c=s(function(){return arguments}())?s:function(e){return(0,o.A)(e)&&a.call(e,"callee")&&!l.call(e,"callee")}},2049:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=Array.isArray},8446:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var n=i(9610),o=i(5254);const s=function(e){return null!=e&&(0,o.A)(e.length)&&!(0,n.A)(e)}},1200:(e,t,i)=>{"use strict";i.d(t,{A:()=>a});var n=i(1917);var o="object"==typeof exports&&exports&&!exports.nodeType&&exports,s=o&&"object"==typeof module&&module&&!module.nodeType&&module,r=s&&s.exports===o?n.A.Buffer:void 0;const a=(r?r.isBuffer:void 0)||function(){return!1}},1500:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var n=i(3098),o=i(4963);const s=function(e){return(0,n.A)(e)&&1===e.nodeType&&!(0,o.A)(e)}},6996:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=i(5407);const o=function(e,t){return(0,n.A)(e,t)}},9610:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var n=i(2383),o=i(3149);const s=function(e){if(!(0,o.A)(e))return!1;var t=(0,n.A)(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},5254:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},3149:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},3098:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(e){return null!=e&&"object"==typeof e}},4963:(e,t,i)=>{"use strict";i.d(t,{A:()=>u});var n=i(2383),o=i(5647),s=i(3098),r=Function.prototype,a=Object.prototype,l=r.toString,c=a.hasOwnProperty,d=l.call(Object);const u=function(e){if(!(0,s.A)(e)||"[object Object]"!=(0,n.A)(e))return!1;var t=(0,o.A)(e);if(null===t)return!0;var i=c.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&l.call(i)==d}},1882:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var n=i(2383),o=i(3098);const s=function(e){return"symbol"==typeof e||(0,o.A)(e)&&"[object Symbol]"==(0,n.A)(e)}},4749:(e,t,i)=>{"use strict";i.d(t,{A:()=>d});var n=i(2383),o=i(5254),s=i(3098),r={};r["[object Float32Array]"]=r["[object Float64Array]"]=r["[object Int8Array]"]=r["[object Int16Array]"]=r["[object Int32Array]"]=r["[object Uint8Array]"]=r["[object Uint8ClampedArray]"]=r["[object Uint16Array]"]=r["[object Uint32Array]"]=!0,r["[object Arguments]"]=r["[object Array]"]=r["[object ArrayBuffer]"]=r["[object Boolean]"]=r["[object DataView]"]=r["[object Date]"]=r["[object Error]"]=r["[object Function]"]=r["[object Map]"]=r["[object Number]"]=r["[object Object]"]=r["[object RegExp]"]=r["[object Set]"]=r["[object String]"]=r["[object WeakMap]"]=!1;var a=i(2789),l=i(4841),c=l.A&&l.A.isTypedArray;const d=c?(0,a.A)(c):function(e){return(0,s.A)(e)&&(0,o.A)(e.length)&&!!r[(0,n.A)(e)]}},7405:(e,t,i)=>{"use strict";i.d(t,{A:()=>l});var n=i(2505),o=i(7271);const s=(0,i(367).A)(Object.keys,Object);var r=Object.prototype.hasOwnProperty;var a=i(8446);const l=function(e){return(0,a.A)(e)?(0,n.A)(e):function(e){if(!(0,o.A)(e))return s(e);var t=[];for(var i in Object(e))r.call(e,i)&&"constructor"!=i&&t.push(i);return t}(e)}},9999:(e,t,i)=>{"use strict";i.d(t,{A:()=>c});var n=i(2505),o=i(3149),s=i(7271);var r=Object.prototype.hasOwnProperty;const a=function(e){if(!(0,o.A)(e))return function(e){var t=[];if(null!=e)for(var i in Object(e))t.push(i);return t}(e);var t=(0,s.A)(e),i=[];for(var n in e)("constructor"!=n||!t&&r.call(e,n))&&i.push(n);return i};var l=i(8446);const c=function(e){return(0,l.A)(e)?(0,n.A)(e,!0):a(e)}},6248:(e,t,i)=>{"use strict";i.d(t,{A:()=>x});var n=i(2080),o=i(2528),s=i(6984);const r=function(e,t,i){(void 0!==i&&!(0,s.A)(e[t],i)||void 0===i&&!(t in e))&&(0,o.A)(e,t,i)};var a=i(7132),l=i(154),c=i(1801),d=i(9759),u=i(407),h=i(5175),m=i(2049),g=i(8446),f=i(3098);var p=i(1200),b=i(9610),w=i(3149),v=i(4963),_=i(4749);const y=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]};var k=i(2031),C=i(9999);const A=function(e,t,i,n,o,s,a){var A,E=y(e,i),x=y(t,i),T=a.get(x);if(T)r(e,i,T);else{var P=s?s(E,x,i+"",e,t,a):void 0,I=void 0===P;if(I){var S=(0,m.A)(x),V=!S&&(0,p.A)(x),R=!S&&!V&&(0,_.A)(x);P=x,S||V||R?(0,m.A)(E)?P=E:(A=E,(0,f.A)(A)&&(0,g.A)(A)?P=(0,d.A)(E):V?(I=!1,P=(0,l.A)(x,!0)):R?(I=!1,P=(0,c.A)(x,!0)):P=[]):(0,v.A)(x)||(0,h.A)(x)?(P=E,(0,h.A)(E)?P=function(e){return(0,k.A)(e,(0,C.A)(e))}(E):(0,w.A)(E)&&!(0,b.A)(E)||(P=(0,u.A)(x))):I=!1}I&&(a.set(x,P),o(P,x,n,s,a),a.delete(x)),r(e,i,P)}},E=function e(t,i,o,s,l){t!==i&&(0,a.A)(i,(function(a,c){if(l||(l=new n.A),(0,w.A)(a))A(t,i,c,o,e,s,l);else{var d=s?s(y(t,c),a,c+"",t,i,l):void 0;void 0===d&&(d=a),r(t,c,d)}}),C.A)},x=(0,i(5988).A)((function(e,t,i){E(e,t,i)}))},3153:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(){return[]}},4022:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var n=i(2223),o=i(3149);const s=function(e,t,i){var s=!0,r=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return(0,o.A)(i)&&(s="leading"in i?!!i.leading:s,r="trailing"in i?!!i.trailing:r),(0,n.A)(e,t,{leading:s,maxWait:t,trailing:r})}},3456:(e,t,i)=>{"use strict";i.d(t,{A:()=>d});var n=i(241),o=i(5572),s=i(2049),r=i(1882),a=n.A?n.A.prototype:void 0,l=a?a.toString:void 0;const c=function e(t){if("string"==typeof t)return t;if((0,s.A)(t))return(0,o.A)(t,e)+"";if((0,r.A)(t))return l?l.call(t):"";var i=t+"";return"0"==i&&1/t==-1/0?"-0":i},d=function(e){return null==e?"":c(e)}}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var s=n[e]={exports:{}};return i[e](s,s.exports,o),s.exports}return t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(i,n){if(1&n&&(i=this(i)),8&n)return i;if("object"==typeof i&&i){if(4&n&&i.__esModule)return i;if(16&n&&"function"==typeof i.then)return i}var s=Object.create(null);o.r(s);var r={};e=e||[null,t({}),t([]),t(t)];for(var a=2&n&&i;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((e=>r[e]=()=>i[e]));return r.default=()=>i,o.d(s,r),s},o.d=(e,t)=>{for(var i in t)o.o(t,i)&&!o.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o(73)})()));
\ No newline at end of file
+!function(e){const t=e.en=e.en||{};t.dictionary=Object.assign(t.dictionary||{},{"(may require <kbd>Fn</kbd>)":"(may require <kbd>Fn</kbd>)","%0 of %1":"%0 of %1",Accept:"Accept",Accessibility:"Accessibility","Accessibility help":"Accessibility help","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 center":"Align center","Align left":"Align left","Align right":"Align right","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","Below, you can find a list of keyboard shortcuts that can be used in the editor.":"Below, you can find a list of keyboard shortcuts that can be used in the editor.",Big:"Big",Black:"Black","Block quote":"Block quote",Blue:"Blue","Blue marker":"Blue marker",Bold:"Bold","Bold text":"Bold text",Border:"Border","Break text":"Break text","Bulleted List":"Bulleted List","Bulleted list styles toolbar":"Bulleted list styles toolbar",Cancel:"Cancel","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","Choose language":"Choose language",Circle:"Circle",Clear:"Clear","Click to edit block":"Click to edit block",Close:"Close","Close contextual balloons, dropdowns, and dialogs":"Close contextual balloons, dropdowns, and dialogs",Code:"Code","Code block":"Code block",Color:"Color","Color picker":"Color picker",Column:"Column","Content editing keystrokes":"Content editing keystrokes","Copy selected content":"Copy selected content","Create link":"Create link",Custom:"Custom","Custom image size":"Custom image size",Dashed:"Dashed",Decimal:"Decimal","Decimal with leading zero":"Decimal with leading zero","Decrease indent":"Decrease indent","Decrease list item indent":"Decrease list item indent",Default:"Default","Delete column":"Delete column","Delete row":"Delete row","Dim grey":"Dim grey",Dimensions:"Dimensions",Disc:"Disc","Document colors":"Document colors",Dotted:"Dotted",Double:"Double",Downloadable:"Downloadable","Drag to move":"Drag to move","Dropdown toolbar":"Dropdown toolbar","Edit block":"Edit block","Edit link":"Edit link","Edit source":"Edit source","Editor block content toolbar":"Editor block content toolbar","Editor contextual toolbar":"Editor contextual toolbar","Editor dialog":"Editor dialog","Editor editing area: %0":"Editor editing area: %0","Editor menu bar":"Editor menu bar","Editor toolbar":"Editor toolbar","Empty snippet content":"Empty snippet content","Enter image caption":"Enter image caption","Enter table caption":"Enter table caption","Entering %0 code snippet":"Entering %0 code snippet","Entering a to-do list":"Entering a to-do list","Entering code snippet":"Entering code snippet","Error during image upload":"Error during image upload","Execute the currently focused button. Executing buttons that interact with the editor content moves the focus back to the content.":"Execute the currently focused button. Executing buttons that interact with the editor content moves the focus back to the content.","Font Background Color":"Font Background Color","Font Color":"Font Color","Font Family":"Font Family","Font Size":"Font Size","From computer":"From computer","Full size image":"Full size image",Green:"Green","Green marker":"Green marker","Green pen":"Green pen",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","Help Contents. To close this dialog press ESC.":"Help Contents. To close this dialog press ESC.",HEX:"HEX",Highlight:"Highlight","Horizontal line":"Horizontal line","Horizontal text alignment toolbar":"Horizontal text alignment toolbar","HTML snippet":"HTML snippet",Huge:"Huge",Image:"Image","Image from computer":"Image from computer","Image resize list":"Image resize list","Image toolbar":"Image toolbar","Image upload complete":"Image upload complete","Image via URL":"Image via URL","image widget":"image widget","In line":"In line","Increase indent":"Increase indent","Increase list item indent":"Increase list item indent","Insert a hard break (a new paragraph)":"Insert a hard break (a new paragraph)","Insert a new paragraph directly after a widget":"Insert a new paragraph directly after a widget","Insert a new paragraph directly before a widget":"Insert a new paragraph directly before a widget","Insert a new table row (when in the last cell of a table)":"Insert a new table row (when in the last cell of a table)","Insert a soft break (a <code>&lt;br&gt;</code> element)":"Insert a soft break (a <code>&lt;br&gt;</code> element)","Insert code block":"Insert code block","Insert column left":"Insert column left","Insert column right":"Insert column right","Insert HTML":"Insert HTML","Insert image":"Insert image","Insert image via URL":"Insert image via URL","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","Insert via URL":"Insert via URL",Inset:"Inset","Invalid start index value.":"Invalid start index value.",Italic:"Italic","Italic text":"Italic text",Justify:"Justify","Justify cell text":"Justify cell text","Keystrokes that can be used in a list":"Keystrokes that can be used in a list","Keystrokes that can be used in a table cell":"Keystrokes that can be used in a table cell","Keystrokes that can be used when a widget is selected (for example: image, table, etc.)":"Keystrokes that can be used when a widget is selected (for example: image, table, etc.)",Language:"Language","Leaving %0 code snippet":"Leaving %0 code snippet","Leaving a to-do list":"Leaving a to-do list","Leaving code snippet":"Leaving code snippet","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","Link URL must not be empty.":"Link URL must not be empty.","List properties":"List properties","Lower-latin":"Lower-latin","Lower–roman":"Lower–roman",MENU_BAR_MENU_EDIT:"Edit",MENU_BAR_MENU_FILE:"File",MENU_BAR_MENU_FONT:"Font",MENU_BAR_MENU_FORMAT:"Format",MENU_BAR_MENU_HELP:"Help",MENU_BAR_MENU_INSERT:"Insert",MENU_BAR_MENU_TEXT:"Text",MENU_BAR_MENU_TOOLS:"Tools",MENU_BAR_MENU_VIEW:"View","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","Move focus between form fields (inputs, buttons, etc.)":"Move focus between form fields (inputs, buttons, etc.)","Move focus from an editable area back to the parent widget":"Move focus from an editable area back to the parent widget","Move focus in and out of an active dialog window":"Move focus in and out of an active dialog window","Move focus to the menu bar, navigate between menu bars":"Move focus to the menu bar, navigate between menu bars","Move focus to the toolbar, navigate between toolbars":"Move focus to the toolbar, navigate between toolbars","Move out of a link":"Move out of a link","Move out of an inline code style":"Move out of an inline code style","Move the caret to allow typing directly after a widget":"Move the caret to allow typing directly after a widget","Move the caret to allow typing directly before a widget":"Move the caret to allow typing directly before a widget","Move the selection to the next cell":"Move the selection to the next cell","Move the selection to the previous cell":"Move the selection to the previous cell","Navigate through the table":"Navigate through the table","Navigate through the toolbar or menu bar":"Navigate through the toolbar or menu bar",Next:"Next","No preview available":"No preview available","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 in a new tab":"Open in a new tab","Open link in new tab":"Open link in new tab","Open the accessibility help dialog":"Open the accessibility help dialog",Orange:"Orange",Original:"Original",Outset:"Outset",Padding:"Padding",Paragraph:"Paragraph","Paste content":"Paste content","Paste content as plain text":"Paste content as plain text","Paste raw HTML here...":"Paste raw HTML here...","Pink marker":"Pink marker","Plain text":"Plain text",'Please enter a valid color (e.g. "ff0000").':'Please enter a valid color (e.g. "ff0000").',"Press %0 for help.":"Press %0 for help.","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","Red pen":"Red pen",Redo:"Redo","Remove color":"Remove color","Remove Format":"Remove Format","Remove highlight":"Remove highlight","Remove language":"Remove language","Replace from computer":"Replace from computer","Replace image":"Replace image","Replace image from computer":"Replace image from computer","Resize image":"Resize image","Resize image (in %0)":"Resize image (in %0)","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","Save changes":"Save changes","Saving changes":"Saving changes","Select all":"Select all","Select column":"Select column","Select row":"Select row","Show more items":"Show more items","Side image":"Side image",Small:"Small",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","Strikethrough text":"Strikethrough text",Style:"Style",Subscript:"Subscript",Superscript:"Superscript",Table:"Table","Table alignment toolbar":"Table alignment toolbar","Table cell text alignment":"Table cell text alignment","Table properties":"Table properties","Table toolbar":"Table toolbar","Text alignment":"Text alignment","Text alignment toolbar":"Text alignment toolbar","Text alternative":"Text alternative","Text highlight toolbar":"Text highlight toolbar",'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 value is invalid. Try "10px" or "2em" or simply "2".':'The value is invalid. Try "10px" or "2em" or simply "2".',"The value must not be empty.":"The value must not be empty.","The value should be a plain number.":"The value should be a plain number.","These keyboard shortcuts allow for quick access to content editing features.":"These keyboard shortcuts allow for quick access to content editing features.","This link has no URL":"This link has no URL",Tiny:"Tiny","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–latin list style":"Toggle the lower–latin list style","Toggle the lower–roman list style":"Toggle the lower–roman list style","Toggle the square list style":"Toggle the square list style","Toggle the upper–latin list style":"Toggle the upper–latin list style","Toggle the upper–roman list style":"Toggle the upper–roman list style",Turquoise:"Turquoise","Type or paste your content here.":"Type or paste your content here.","Type your title":"Type your title",Underline:"Underline","Underline text":"Underline text",Undo:"Undo",Unlink:"Unlink","Update image URL":"Update image URL","Upload failed":"Upload failed","Upload from computer":"Upload from computer","Upload image from computer":"Upload image from computer","Upload in progress":"Upload in progress","Uploading image":"Uploading image","Upper-latin":"Upper-latin","Upper-roman":"Upper-roman","Use the following keystrokes for more efficient navigation in the CKEditor 5 user interface.":"Use the following keystrokes for more efficient navigation in the CKEditor 5 user interface.","User interface and content navigation keystrokes":"User interface and content navigation keystrokes","Vertical text alignment toolbar":"Vertical text alignment toolbar","Via URL":"Via URL",White:"White","Widget toolbar":"Widget toolbar",Width:"Width","Wrap text":"Wrap text",Yellow:"Yellow","Yellow marker":"Yellow marker","You have no image upload permissions.":"You have no image upload permissions."})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),define("@woltlab/editor",[],(()=>(()=>{var e,t,i={5659:(e,t,i)=>{const n=i(8156),o={};for(const e of Object.keys(n))o[n[e]]=e;const s={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};e.exports=s;for(const e of Object.keys(s)){if(!("channels"in s[e]))throw new Error("missing channels property: "+e);if(!("labels"in s[e]))throw new Error("missing channel labels property: "+e);if(s[e].labels.length!==s[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:i}=s[e];delete s[e].channels,delete s[e].labels,Object.defineProperty(s[e],"channels",{value:t}),Object.defineProperty(s[e],"labels",{value:i})}s.rgb.hsl=function(e){const t=e[0]/255,i=e[1]/255,n=e[2]/255,o=Math.min(t,i,n),s=Math.max(t,i,n),r=s-o;let a,l;s===o?a=0:t===s?a=(i-n)/r:i===s?a=2+(n-t)/r:n===s&&(a=4+(t-i)/r),a=Math.min(60*a,360),a<0&&(a+=360);const c=(o+s)/2;return l=s===o?0:c<=.5?r/(s+o):r/(2-s-o),[a,100*l,100*c]},s.rgb.hsv=function(e){let t,i,n,o,s;const r=e[0]/255,a=e[1]/255,l=e[2]/255,c=Math.max(r,a,l),d=c-Math.min(r,a,l),u=function(e){return(c-e)/6/d+.5};return 0===d?(o=0,s=0):(s=d/c,t=u(r),i=u(a),n=u(l),r===c?o=n-i:a===c?o=1/3+t-n:l===c&&(o=2/3+i-t),o<0?o+=1:o>1&&(o-=1)),[360*o,100*s,100*c]},s.rgb.hwb=function(e){const t=e[0],i=e[1];let n=e[2];const o=s.rgb.hsl(e)[0],r=1/255*Math.min(t,Math.min(i,n));return n=1-1/255*Math.max(t,Math.max(i,n)),[o,100*r,100*n]},s.rgb.cmyk=function(e){const t=e[0]/255,i=e[1]/255,n=e[2]/255,o=Math.min(1-t,1-i,1-n);return[100*((1-t-o)/(1-o)||0),100*((1-i-o)/(1-o)||0),100*((1-n-o)/(1-o)||0),100*o]},s.rgb.keyword=function(e){const t=o[e];if(t)return t;let i,s=1/0;for(const t of Object.keys(n)){const o=(a=n[t],((r=e)[0]-a[0])**2+(r[1]-a[1])**2+(r[2]-a[2])**2);o<s&&(s=o,i=t)}var r,a;return i},s.keyword.rgb=function(e){return n[e]},s.rgb.xyz=function(e){let t=e[0]/255,i=e[1]/255,n=e[2]/255;return t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,[100*(.4124*t+.3576*i+.1805*n),100*(.2126*t+.7152*i+.0722*n),100*(.0193*t+.1192*i+.9505*n)]},s.rgb.lab=function(e){const t=s.rgb.xyz(e);let i=t[0],n=t[1],o=t[2];return i/=95.047,n/=100,o/=108.883,i=i>.008856?i**(1/3):7.787*i+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,o=o>.008856?o**(1/3):7.787*o+16/116,[116*n-16,500*(i-n),200*(n-o)]},s.hsl.rgb=function(e){const t=e[0]/360,i=e[1]/100,n=e[2]/100;let o,s,r;if(0===i)return r=255*n,[r,r,r];o=n<.5?n*(1+i):n+i-n*i;const a=2*n-o,l=[0,0,0];for(let e=0;e<3;e++)s=t+1/3*-(e-1),s<0&&s++,s>1&&s--,r=6*s<1?a+6*(o-a)*s:2*s<1?o:3*s<2?a+(o-a)*(2/3-s)*6:a,l[e]=255*r;return l},s.hsl.hsv=function(e){const t=e[0];let i=e[1]/100,n=e[2]/100,o=i;const s=Math.max(n,.01);return n*=2,i*=n<=1?n:2-n,o*=s<=1?s:2-s,[t,100*(0===n?2*o/(s+o):2*i/(n+i)),(n+i)/2*100]},s.hsv.rgb=function(e){const t=e[0]/60,i=e[1]/100;let n=e[2]/100;const o=Math.floor(t)%6,s=t-Math.floor(t),r=255*n*(1-i),a=255*n*(1-i*s),l=255*n*(1-i*(1-s));switch(n*=255,o){case 0:return[n,l,r];case 1:return[a,n,r];case 2:return[r,n,l];case 3:return[r,a,n];case 4:return[l,r,n];case 5:return[n,r,a]}},s.hsv.hsl=function(e){const t=e[0],i=e[1]/100,n=e[2]/100,o=Math.max(n,.01);let s,r;r=(2-i)*n;const a=(2-i)*o;return s=i*o,s/=a<=1?a:2-a,s=s||0,r/=2,[t,100*s,100*r]},s.hwb.rgb=function(e){const t=e[0]/360;let i=e[1]/100,n=e[2]/100;const o=i+n;let s;o>1&&(i/=o,n/=o);const r=Math.floor(6*t),a=1-n;s=6*t-r,0!=(1&r)&&(s=1-s);const l=i+s*(a-i);let c,d,u;switch(r){default:case 6:case 0:c=a,d=l,u=i;break;case 1:c=l,d=a,u=i;break;case 2:c=i,d=a,u=l;break;case 3:c=i,d=l,u=a;break;case 4:c=l,d=i,u=a;break;case 5:c=a,d=i,u=l}return[255*c,255*d,255*u]},s.cmyk.rgb=function(e){const t=e[0]/100,i=e[1]/100,n=e[2]/100,o=e[3]/100;return[255*(1-Math.min(1,t*(1-o)+o)),255*(1-Math.min(1,i*(1-o)+o)),255*(1-Math.min(1,n*(1-o)+o))]},s.xyz.rgb=function(e){const t=e[0]/100,i=e[1]/100,n=e[2]/100;let o,s,r;return o=3.2406*t+-1.5372*i+-.4986*n,s=-.9689*t+1.8758*i+.0415*n,r=.0557*t+-.204*i+1.057*n,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,o=Math.min(Math.max(0,o),1),s=Math.min(Math.max(0,s),1),r=Math.min(Math.max(0,r),1),[255*o,255*s,255*r]},s.xyz.lab=function(e){let t=e[0],i=e[1],n=e[2];return t/=95.047,i/=100,n/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,[116*i-16,500*(t-i),200*(i-n)]},s.lab.xyz=function(e){let t,i,n;i=(e[0]+16)/116,t=e[1]/500+i,n=i-e[2]/200;const o=i**3,s=t**3,r=n**3;return i=o>.008856?o:(i-16/116)/7.787,t=s>.008856?s:(t-16/116)/7.787,n=r>.008856?r:(n-16/116)/7.787,t*=95.047,i*=100,n*=108.883,[t,i,n]},s.lab.lch=function(e){const t=e[0],i=e[1],n=e[2];let o;return o=360*Math.atan2(n,i)/2/Math.PI,o<0&&(o+=360),[t,Math.sqrt(i*i+n*n),o]},s.lch.lab=function(e){const t=e[0],i=e[1],n=e[2]/360*2*Math.PI;return[t,i*Math.cos(n),i*Math.sin(n)]},s.rgb.ansi16=function(e,t=null){const[i,n,o]=e;let r=null===t?s.rgb.hsv(e)[2]:t;if(r=Math.round(r/50),0===r)return 30;let a=30+(Math.round(o/255)<<2|Math.round(n/255)<<1|Math.round(i/255));return 2===r&&(a+=60),a},s.hsv.ansi16=function(e){return s.rgb.ansi16(s.hsv.rgb(e),e[2])},s.rgb.ansi256=function(e){const t=e[0],i=e[1],n=e[2];return t===i&&i===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(i/255*5)+Math.round(n/255*5)},s.ansi16.rgb=function(e){let t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const i=.5*(1+~~(e>50));return[(1&t)*i*255,(t>>1&1)*i*255,(t>>2&1)*i*255]},s.ansi256.rgb=function(e){if(e>=232){const t=10*(e-232)+8;return[t,t,t]}let t;return e-=16,[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},s.rgb.hex=function(e){const t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},s.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let i=t[0];3===t[0].length&&(i=i.split("").map((e=>e+e)).join(""));const n=parseInt(i,16);return[n>>16&255,n>>8&255,255&n]},s.rgb.hcg=function(e){const t=e[0]/255,i=e[1]/255,n=e[2]/255,o=Math.max(Math.max(t,i),n),s=Math.min(Math.min(t,i),n),r=o-s;let a,l;return a=r<1?s/(1-r):0,l=r<=0?0:o===t?(i-n)/r%6:o===i?2+(n-t)/r:4+(t-i)/r,l/=6,l%=1,[360*l,100*r,100*a]},s.hsl.hcg=function(e){const t=e[1]/100,i=e[2]/100,n=i<.5?2*t*i:2*t*(1-i);let o=0;return n<1&&(o=(i-.5*n)/(1-n)),[e[0],100*n,100*o]},s.hsv.hcg=function(e){const t=e[1]/100,i=e[2]/100,n=t*i;let o=0;return n<1&&(o=(i-n)/(1-n)),[e[0],100*n,100*o]},s.hcg.rgb=function(e){const t=e[0]/360,i=e[1]/100,n=e[2]/100;if(0===i)return[255*n,255*n,255*n];const o=[0,0,0],s=t%1*6,r=s%1,a=1-r;let l=0;switch(Math.floor(s)){case 0:o[0]=1,o[1]=r,o[2]=0;break;case 1:o[0]=a,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=r;break;case 3:o[0]=0,o[1]=a,o[2]=1;break;case 4:o[0]=r,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=a}return l=(1-i)*n,[255*(i*o[0]+l),255*(i*o[1]+l),255*(i*o[2]+l)]},s.hcg.hsv=function(e){const t=e[1]/100,i=t+e[2]/100*(1-t);let n=0;return i>0&&(n=t/i),[e[0],100*n,100*i]},s.hcg.hsl=function(e){const t=e[1]/100,i=e[2]/100*(1-t)+.5*t;let n=0;return i>0&&i<.5?n=t/(2*i):i>=.5&&i<1&&(n=t/(2*(1-i))),[e[0],100*n,100*i]},s.hcg.hwb=function(e){const t=e[1]/100,i=t+e[2]/100*(1-t);return[e[0],100*(i-t),100*(1-i)]},s.hwb.hcg=function(e){const t=e[1]/100,i=1-e[2]/100,n=i-t;let o=0;return n<1&&(o=(i-n)/(1-n)),[e[0],100*n,100*o]},s.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},s.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},s.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},s.gray.hsl=function(e){return[0,0,e[0]]},s.gray.hsv=s.gray.hsl,s.gray.hwb=function(e){return[0,100,e[0]]},s.gray.cmyk=function(e){return[0,0,0,e[0]]},s.gray.lab=function(e){return[e[0],0,0]},s.gray.hex=function(e){const t=255&Math.round(e[0]/100*255),i=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(i.length)+i},s.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}},734:(e,t,i)=>{const n=i(5659),o=i(8507),s={};Object.keys(n).forEach((e=>{s[e]={},Object.defineProperty(s[e],"channels",{value:n[e].channels}),Object.defineProperty(s[e],"labels",{value:n[e].labels});const t=o(e);Object.keys(t).forEach((i=>{const n=t[i];s[e][i]=function(e){const t=function(...t){const i=t[0];if(null==i)return i;i.length>1&&(t=i);const n=e(t);if("object"==typeof n)for(let e=n.length,t=0;t<e;t++)n[t]=Math.round(n[t]);return n};return"conversion"in e&&(t.conversion=e.conversion),t}(n),s[e][i].raw=function(e){const t=function(...t){const i=t[0];return null==i?i:(i.length>1&&(t=i),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(n)}))})),e.exports=s},8507:(e,t,i)=>{const n=i(5659);function o(e,t){return function(i){return t(e(i))}}function s(e,t){const i=[t[e].parent,e];let s=n[t[e].parent][e],r=t[e].parent;for(;t[r].parent;)i.unshift(t[r].parent),s=o(n[t[r].parent][r],s),r=t[r].parent;return s.conversion=i,s}e.exports=function(e){const t=function(e){const t=function(){const e={},t=Object.keys(n);for(let i=t.length,n=0;n<i;n++)e[t[n]]={distance:-1,parent:null};return e}(),i=[e];for(t[e].distance=0;i.length;){const e=i.pop(),o=Object.keys(n[e]);for(let n=o.length,s=0;s<n;s++){const n=o[s],r=t[n];-1===r.distance&&(r.distance=t[e].distance+1,r.parent=e,i.unshift(n))}}return t}(e),i={},o=Object.keys(t);for(let e=o.length,n=0;n<e;n++){const e=o[n];null!==t[e].parent&&(i[e]=s(e,t))}return i}},8156:e=>{"use strict";e.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]}},7833:(e,t,i)=>{"use strict";i.r(t)},6856:(e,t,i)=>{"use strict";i.r(t)},6474:(e,t,i)=>{"use strict";i.r(t)},6734:(e,t,i)=>{"use strict";i.r(t)},1278:(e,t,i)=>{"use strict";i.r(t)},2486:(e,t,i)=>{var n,o;n=[i,t,i(1948)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.create=async function(e,t){const o=(t=Object.assign(t,n)).removePlugins||[];if(!o.includes("Image")){const e=["url"];o.includes("WoltlabAttachment")||e.unshift("upload"),t.image={insert:{integrations:e,type:"inline"},toolbar:["imageStyle:inline","imageStyle:sideLeft","imageStyle:block","imageStyle:side"],resizeUnit:"px",styles:{options:["inline",{name:"sideLeft",title:"Left aligned image",icon:i.Core.icons.objectLeft,modelElements:["imageBlock"],className:"image-style-side-left"},"block","side"]}},o.includes("Link")||t.image.toolbar.push("|","linkImage")}return o.includes("Table")||(t.table={contentToolbar:["tableColumn","tableRow","mergeTableCells"]}),await i.ClassicEditor.ClassicEditor.create(e,t)};const n={plugins:[i.Autosave.Autosave,i.Essentials.Essentials,i.Indent.Indent,i.Mention.Mention,i.Paragraph.Paragraph,i.PasteFromOffice.PasteFromOffice,i.Undo.Undo,i.Alignment.Alignment,i.BasicStyles.Bold,i.BasicStyles.Code,i.Font.FontColor,i.Font.FontFamily,i.Font.FontSize,i.Heading.Heading,i.Highlight.Highlight,i.BasicStyles.Italic,i.RemoveFormat.RemoveFormat,i.BasicStyles.Strikethrough,i.BasicStyles.Subscript,i.BasicStyles.Superscript,i.BasicStyles.Underline,i.BlockQuote.BlockQuote,i.CodeBlock.CodeBlock,i.HtmlEmbed.HtmlEmbed,i.HorizontalLine.HorizontalLine,i.Image.Image,i.Image.ImageInsertUI,i.Image.ImageInsertViaUrl,i.Image.ImageToolbar,i.Image.ImageResizeEditing,i.Image.ImageResizeHandles,i.Image.ImageStyle,i.Image.ImageUpload,i.Image.ImageUploadUI,i.Link.Link,i.Link.LinkImage,i.List.List,i.Table.Table,i.Table.TableToolbar,i.WoltlabAttachment.WoltlabAttachment,i.WoltlabAutoLink.WoltlabAutoLink,i.WoltlabAutosave.WoltlabAutosave,i.WoltlabBlockQuote.WoltlabBlockQuote,i.WoltlabBbcode.WoltlabBbcode,i.WoltlabCode.WoltlabCode,i.WoltlabCodeBlock.WoltlabCodeBlock,i.WoltlabHtmlEmbed.WoltlabHtmlEmbed,i.WoltlabImage.WoltlabImage,i.WoltlabMagicParagraph.WoltlabMagicParagraph,i.WoltlabMedia.WoltlabMedia,i.WoltlabMention.WoltlabMention,i.WoltlabMetacode.WoltlabMetacode,i.WoltlabSmiley.WoltlabSmiley,i.WoltlabSpoiler.WoltlabSpoiler,i.WoltlabToolbarGroup.WoltlabToolbarGroup,i.WoltlabUpload.WoltlabUpload,i.WoltlabFontSize.WoltlabFontSize]}}.apply(t,n),void 0===o||(e.exports=o)},73:(e,t,i)=>{var n,o;n=[i,t,i(2486),i(1948)],o=function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CKEditor5=t.create=void 0,Object.defineProperty(t,"create",{enumerable:!0,get:function(){return i.create}}),t.CKEditor5=n}.apply(t,n),void 0===o||(e.exports=o)},1948:(e,t,i)=>{var n,o;n=[i,t,i(7109),i(7933),i(6191),i(8839),i(5247),i(6034),i(1703),i(1024),i(5247),i(151),i(7207),i(708),i(6913),i(9174),i(174),i(9306),i(9090),i(5048),i(2016),i(2685),i(4608),i(3312),i(2801),i(1980),i(9448),i(8368),i(6206),i(478),i(6192),i(7243),i(8511),i(4857),i(7906),i(3906),i(4182),i(4751),i(105),i(4138),i(7223),i(4814),i(3546),i(9374),i(9897),i(1151),i(5107),i(2473),i(5123),i(6976),i(6153),i(3806),i(5842),i(1266)],o=function(e,t,i,n,o,s,r,a,l,c,d,u,h,m,g,f,p,b,w,v,_,y,k,C,A,E,x,T,P,I,S,V,R,B,M,O,L,F,N,D,z,W,H,U,$,j,q,K,G,Z,J,Q,Y,X){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabFontSize=t.WoltlabUpload=t.WoltlabToolbarGroup=t.WoltlabSpoiler=t.WoltlabSmiley=t.WoltlabMetacode=t.WoltlabMention=t.WoltlabMedia=t.WoltlabMagicParagraph=t.WoltlabImage=t.WoltlabHtmlEmbed=t.WoltlabCodeBlock=t.WoltlabCode=t.WoltlabBlockQuote=t.WoltlabBbcode=t.WoltlabAutosave=t.WoltlabAutoLink=t.WoltlabAttachment=t.Widget=t.Utils=t.Upload=t.Undo=t.Ui=t.Typing=t.Table=t.SelectAll=t.RemoveFormat=t.PasteFromOffice=t.Paragraph=t.Mention=t.List=t.Link=t.Language=t.Indent=t.Image=t.HtmlEmbed=t.HorizontalLine=t.Highlight=t.Heading=t.Font=t.Essentials=t.Enter=t.Engine=t.Editor=t.Core=t.CodeBlock=t.Clipboard=t.ClassicEditor=t.BlockQuote=t.BasicStyles=t.Autosave=t.Alignment=void 0,t.Alignment=i,t.Autosave=n,t.BasicStyles=o,t.BlockQuote=s,t.ClassicEditor=r,t.Clipboard=a,t.CodeBlock=l,t.Core=c,t.Editor=d,t.Engine=u,t.Enter=h,t.Essentials=m,t.Font=g,t.Heading=f,t.Highlight=p,t.HorizontalLine=b,t.HtmlEmbed=w,t.Image=v,t.Indent=_,t.Language=y,t.Link=k,t.List=C,t.Mention=A,t.Paragraph=E,t.PasteFromOffice=x,t.RemoveFormat=T,t.SelectAll=P,t.Table=I,t.Typing=S,t.Ui=V,t.Undo=R,t.Upload=B,t.Utils=M,t.Widget=O,t.WoltlabAttachment=L,t.WoltlabAutoLink=F,t.WoltlabAutosave=N,t.WoltlabBbcode=D,t.WoltlabBlockQuote=z,t.WoltlabCode=W,t.WoltlabCodeBlock=H,t.WoltlabHtmlEmbed=U,t.WoltlabImage=$,t.WoltlabMagicParagraph=j,t.WoltlabMedia=q,t.WoltlabMention=K,t.WoltlabMetacode=G,t.WoltlabSmiley=Z,t.WoltlabSpoiler=J,t.WoltlabToolbarGroup=Q,t.WoltlabUpload=Y,t.WoltlabFontSize=X}.apply(t,n),void 0===o||(e.exports=o)},4182:(e,t,i)=>{var n,o;n=[i,t,i(1146)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabAttachment=void 0,Object.defineProperty(t,"WoltlabAttachment",{enumerable:!0,get:function(){return i.WoltlabAttachment}})}.apply(t,n),void 0===o||(e.exports=o)},1146:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(5048)],o=function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabAttachment=void 0;class o extends i.Plugin{static get pluginName(){return"WoltlabAttachment"}static get requires(){return[n.Image,n.ImageUtils]}init(){const{conversion:e,model:t,plugins:i}=this.editor,{schema:n}=t,o=["imageBlock","imageInline"];o.forEach((t=>{n.extend(t,{allowAttributes:["attachmentId"]}),e.attributeToAttribute({model:{key:"classList",values:["woltlabAttachment"]},view:{woltlabAttachment:{name:"imageBlock"===t?"figure":"img",key:"class",value:"woltlabAttachment"}}})}));const s=new Map([["attachmentId","data-attachment-id"]]),r=this.editor.plugins.get("ImageUtils");Array.from(s.entries()).forEach((([t,i])=>{e.for("upcast").attributeToAttribute({view:i,model:t}),e.for("downcast").add((e=>{o.forEach((n=>{e.on(`attribute:${t}:${n}`,((e,t,n)=>{if(!n.consumable.consume(t.item,e.name))return;const o=n.writer,s=r.findViewImgElement(n.mapper.toViewElement(t.item));null!==t.attributeNewValue?(o.setAttribute(i,t.attributeNewValue,s),o.addClass("woltlabAttachment",s)):o.removeAttribute(i,s)}))}))}))})),i.get("ImageUploadEditing").on("uploadComplete",((e,{data:i,imageElement:n})=>{t.change((e=>{e.setAttribute("attachmentId",i["data-attachment-id"],n)}))}))}}t.WoltlabAttachment=o,t.default=o}.apply(t,n),void 0===o||(e.exports=o)},4751:(e,t,i)=>{var n,o;n=[i,t,i(2502)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabAutoLink=void 0,Object.defineProperty(t,"WoltlabAutoLink",{enumerable:!0,get:function(){return i.WoltlabAutoLink}})}.apply(t,n),void 0===o||(e.exports=o)},2502:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(4608)],o=function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabAutoLink=void 0;class o extends i.Plugin{#e="WoltlabAutoLink";static get pluginName(){return"WoltlabAutoLink"}static get requires(){return[n.AutoLink]}init(){if(!this.editor.plugins.has(n.AutoLink))return;const e=this.editor.plugins.get(n.AutoLink);e.forceDisabled(this.#e);const t=this.editor.plugins.get("ClipboardPipeline");t.on("inputTransformation",(()=>{e.clearForceDisabled(this.#e)}),{priority:"highest"}),t.on("inputTransformation",(()=>{e.forceDisabled(this.#e)}),{priority:"normal"})}}t.WoltlabAutoLink=o,t.default=o}.apply(t,n),void 0===o||(e.exports=o)},105:(e,t,i)=>{var n,o;n=[i,t,i(2278)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabAutosave=void 0,Object.defineProperty(t,"WoltlabAutosave",{enumerable:!0,get:function(){return i.WoltlabAutosave}})}.apply(t,n),void 0===o||(e.exports=o)},2278:(e,t,i)=>{var n,o;n=[i,t,i(7933),i(1024)],o=function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabAutosave=void 0;class o extends n.Plugin{static get pluginName(){return"WoltlabAutosave"}static get requires(){return[i.Autosave]}init(){const e=this.editor.plugins.get("PendingActions");e.hasAny=!1,e.on("set:hasAny",(e=>{e.return=!1,e.stop()}),{priority:"highest"})}}t.WoltlabAutosave=o,t.default=o}.apply(t,n),void 0===o||(e.exports=o)},4138:(e,t,i)=>{var n,o;n=[i,t,i(9514),i(4129)],o=function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabBbcodeCommand=t.WoltlabBbcode=void 0,Object.defineProperty(t,"WoltlabBbcode",{enumerable:!0,get:function(){return i.WoltlabBbcode}}),Object.defineProperty(t,"WoltlabBbcodeCommand",{enumerable:!0,get:function(){return n.WoltlabBbcodeCommand}})}.apply(t,n),void 0===o||(e.exports=o)},9514:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(7243),i(4129)],o=function(e,t,i,n,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabBbcode=void 0;class s extends i.Plugin{static get pluginName(){return"WoltlabBbcode"}init(){const{componentFactory:e}=this.editor.ui,t=this.editor.config.get("woltlabBbcode");if(!t)return;const i=new o.default(this.editor);this.editor.commands.add("insertBbcode",i);for(const n of t)this.#t(n,e,i)}#t(e,t,i){const{icon:o,name:s,label:r}=e;t.add(`woltlabBbcode_${s}`,(()=>{const e=new n.ButtonView;if(e.label=r,e.tooltip=!0,e.withText=!0,o)if(o.includes(";")){const[t,i]=o.split(";",2);let n={name:t};"true"===i&&(n.solid="true"),e.labelView.setTemplate({tag:"fa-icon",attributes:n})}else e.labelView.setTemplate({tag:"img",attributes:{src:o}});return e.bind("isEnabled").to(i,"isEnabled"),this.listenTo(e,"execute",(()=>{this.editor.execute("insertBbcode",s)})),e}))}}t.WoltlabBbcode=s,t.default=s}.apply(t,n),void 0===o||(e.exports=o)},4129:(e,t,i)=>{var n,o;n=[i,t,i(1024)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabBbcodeCommand=void 0;class n extends i.Command{execute(e){const{editing:t,model:i}=this.editor,n=this.editor.sourceElement,o=new CustomEvent("ckeditor5:bbcode",{cancelable:!0,detail:{bbcode:e}});n.dispatchEvent(o),o.defaultPrevented||i.change((n=>{const o=i.document.selection,s=n.createText(`[${e}]`),r=i.insertContent(s,o.getFirstPosition()),a=i.insertContent(n.createText(`[/${e}]`),o.isCollapsed?r.end:o.getLastPosition()),l=n.createRange(a.start);n.setSelection(l),t.view.focus()}))}refresh(){this.isEnabled=this.#i()}#i(){const{document:e,schema:t}=this.editor.model,{selection:i}=e;return t.checkAttributeInSelection(i,"bold")}}t.WoltlabBbcodeCommand=n,t.default=n}.apply(t,n),void 0===o||(e.exports=o)},7223:(e,t,i)=>{var n,o;n=[i,t,i(5765)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabBlockQuote=void 0,Object.defineProperty(t,"WoltlabBlockQuote",{enumerable:!0,get:function(){return i.WoltlabBlockQuote}})}.apply(t,n),void 0===o||(e.exports=o)},1545:(e,t,i)=>{var n,o;n=[i,t,i(7243),i(6856)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabBlockQuoteFormRowView=void 0;class n extends i.View{children;constructor(e,t={}){super(e);const i=this.bindTemplate;this.set("class",t.class||""),this.children=this.createCollection(),t.children&&t.children.forEach((e=>this.children.add(e))),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__row",i.to("class")]},children:this.children})}}t.WoltlabBlockQuoteFormRowView=n,t.default=n}.apply(t,n),void 0===o||(e.exports=o)},7209:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(7243),i(7906),i(1545)],o=function(e,t,i,n,o,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabBlockQuotePanelView=void 0;class r extends n.View{#n;#o;#s;#r;focusTracker;keystrokes;#a;#l;constructor(e){const{locale:t}=e;super(t),this.set("author",""),this.set("link",""),this.focusTracker=new o.FocusTracker,this.keystrokes=new o.KeystrokeHandler,this.#a=new n.ViewCollection,this.#l=this.#c();const i=this.#d(t);this.#s=i.fieldView;const s=this.#u(t);this.#r=s.fieldView,this.#n=this.#h(t),this.#o=this.#m(t),this.#g(t,i,s)}render(){super.render(),(0,n.submitHandler)({view:this});const e=[this.#s,this.#r,this.#n,this.#o];e.forEach((e=>{this.#a.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element),this.keystrokes.set("arrowright",(e=>e.stopPropagation())),this.keystrokes.set("arrowleft",(e=>e.stopPropagation())),this.keystrokes.set("arrowup",(e=>e.stopPropagation())),this.keystrokes.set("arrowdown",(e=>e.stopPropagation())),this.listenTo(e[0].element,"selectstart",((e,t)=>{t.stopPropagation()}),{priority:"high"}),this.on("submit",(()=>{this.fire("execute")}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.#l.focusFirst()}#d(e){const t=e.t,i=new n.LabeledFieldView(e,n.createLabeledInputText);return i.label=t("Author"),i.fieldView.bind("value").to(this,"author",(e=>e||"")),i.fieldView.on("input",(()=>{this.author=i.fieldView.element.value})),i}#u(e){const t=e.t,i=new n.LabeledFieldView(e,n.createLabeledInputText);return i.label=t("Link"),i.fieldView.bind("value").to(this,"link",(e=>e||"")),i.fieldView.on("input",(()=>{this.link=i.fieldView.element.value})),i}#h(e){const t=e.t,o=new n.ButtonView(e);return o.set({label:t("Insert"),icon:i.icons.check,class:"ck-button-save",type:"submit",withText:!0,isEnabled:!0}),o}#m(e){const t=e.t,o=new n.ButtonView(e);return o.set({label:t("Cancel"),icon:i.icons.cancel,class:"ck-button-cancel",withText:!0}),o.delegate("execute").to(this,"cancel"),o}#g(e,t,i){this.setTemplate({tag:"form",attributes:{class:["ck","ck-vertical-form","ck-woltlabblockquote-insert-form"],tabindex:"-1"},children:[t,i,new s.default(e,{children:[this.#n,this.#o],class:"ck-woltlabblockquote-insert-form__action-row"})]})}#c(){return new n.FocusCycler({focusables:this.#a,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}})}}t.WoltlabBlockQuotePanelView=r,t.default=r}.apply(t,n),void 0===o||(e.exports=o)},5765:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(7243),i(7906),i(7209),i(7833)],o=function(e,t,i,n,o,s){"use strict";function r(e){switch(typeof e){case"string":return e;case"number":case"boolean":return e.toString();default:return""}}Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabBlockQuote=void 0;class a extends i.Plugin{#f=void 0;static get pluginName(){return"WoltlabBlockQuote"}init(){const e=this.editor;e.model.schema.extend("blockQuote",{allowAttributes:["author","link"]});const t=e.commands.get("blockQuote");this.#p(t),this.#b(),this.#w(),this.#v(),this.listenTo(t,"execute",(()=>{this.#_(this.#f)}))}#p(e){const t=this.editor,o=t.t;this.editor.ui.componentFactory.add("blockQuote",(a=>{const l=(0,n.createDropdown)(a,n.SplitButtonView),c=l.buttonView;c.set({label:o("Block quote"),tooltip:!0,icon:i.icons.quote,isToggleable:!0}),c.bind("isOn").to(e,"value",(e=>!!e)),c.on("execute",(()=>{t.execute("blockQuote"),t.editing.view.focus()})),l.on("submit",(e=>{const i=e.path.find((e=>e instanceof s.WoltlabBlockQuotePanelView));i instanceof s.WoltlabBlockQuotePanelView&&(this.#f=i,t.execute("blockQuote",{forceValue:!0}),this.#f=void 0,t.editing.view.focus(),l.isOpen=!1)})),l.on("cancel",(()=>{t.editing.view.focus(),l.isOpen=!1})),l.bind("isEnabled").to(e);const d=new s.WoltlabBlockQuotePanelView(t);return l.on("change:isOpen",(()=>{if(l.isOpen){const e=this.#y();e?(d.author=r(e.getAttribute("author")),d.link=r(e.getAttribute("link"))):(d.author="",d.link="")}})),l.panelView.children.add(d),d.delegate("submit","cancel").to(l),l}))}#b(){this.editor.data.upcastDispatcher.on("element:woltlab-quote",((e,t,i)=>{const{viewItem:n}=t,{consumable:o,writer:s}=i,r=s.createElement("blockQuote");s.setAttributes({author:n.getAttribute("data-author")||"",link:n.getAttribute("data-link")||""},r),i.convertChildren(n,r),i.safeInsert(r,t.modelCursor)&&(o.consume(n,{name:!0}),i.updateConversionResult(r,t))}),{priority:"high"})}#v(){this.editor.editing.downcastDispatcher.on("insert:blockQuote",((e,t,i)=>{const{writer:n,mapper:o,consumable:s}=i;if(!s.consume(t.item,"insert"))return;const a=r(t.item.getAttribute("author")),l=r(t.item.getAttribute("link")),c=this.getSource(a,l),d={};""!==c&&(d["data-source"]=c);const u=n.createContainerElement("blockquote",d),h=o.toViewPosition(this.editor.model.createPositionBefore(t.item));n.insert(h,u),o.bindElements(t.item,u)}),{priority:"high"}),this.editor.editing.downcastDispatcher.on("attribute:author:blockQuote",((e,t,i)=>{const{writer:n,mapper:o}=i,s=r(t.attributeNewValue),a=r(t.item.getAttribute("link")),l=this.getSource(s,a),c=o.toViewElement(t.item);""===l?n.removeAttribute("data-source",c):n.setAttribute("data-source",l,c)})),this.editor.editing.downcastDispatcher.on("attribute:link:blockQuote",((e,t,i)=>{const{writer:n,mapper:o}=i,s=r(t.item.getAttribute("author")),a=r(t.attributeNewValue),l=this.getSource(s,a),c=o.toViewElement(t.item);""===l?n.removeAttribute("data-source",c):n.setAttribute("data-source",l,c)}))}#w(){this.editor.data.downcastDispatcher.on("insert:blockQuote",((e,t,i)=>{const{writer:n,mapper:o,consumable:s}=i;if(!s.consume(t.item,"insert"))return;const a=r(t.item.getAttribute("author")),l=r(t.item.getAttribute("link")),c=o.toViewPosition(this.editor.model.createPositionBefore(t.item)),d=n.createContainerElement("woltlab-quote",{"data-author":a,"data-link":l});n.insert(c,d),o.bindElements(t.item,d)}),{priority:"high"})}#_(e){const t=this.#y();t&&void 0!==e&&this.editor.model.change((i=>{i.setAttribute("author",e.author,t),i.setAttribute("link",e.link,t)}))}#y(){const e=this.editor.model.document.selection,t=(0,o.first)(e.getSelectedBlocks());return this.#k(t)}#k(e){return e.is("element","blockQuote")?e:e.parent&&!e.parent.is("element","$root")?this.#k(e.parent):null}getSource(e,t){const{t:i}=this.editor;return e?i("Quote from %0",e):i("Quote")}}t.WoltlabBlockQuote=a,t.default=a}.apply(t,n),void 0===o||(e.exports=o)},3546:(e,t,i)=>{var n,o;n=[i,t,i(1401)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabCodeBlock=void 0,Object.defineProperty(t,"WoltlabCodeBlock",{enumerable:!0,get:function(){return i.WoltlabCodeBlock}})}.apply(t,n),void 0===o||(e.exports=o)},5685:(e,t,i)=>{var n,o;n=[i,t,i(7243),i(6474)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabCodeBlockFormRowView=void 0;class n extends i.View{children;constructor(e,t={}){super(e);const i=this.bindTemplate;this.set("class",t.class||""),this.children=this.createCollection(),t.children&&t.children.forEach((e=>this.children.add(e))),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__row",i.to("class")]},children:this.children})}}t.WoltlabCodeBlockFormRowView=n,t.default=n}.apply(t,n),void 0===o||(e.exports=o)},9061:(e,t,i)=>{var n,o;n=[i,t,i(2148),i(1024),i(7243),i(7906),i(5685)],o=function(e,t,i,n,o,s,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabCodeBlockPanelView=void 0;class a extends o.View{#n;#o;#C;#A;#E;focusTracker;keystrokes;#a;#l;constructor(e){const{locale:t}=e;super(t),this.set("file",""),this.set("highlighter",""),this.set("line",""),this.focusTracker=new s.FocusTracker,this.keystrokes=new s.KeystrokeHandler,this.#a=new o.ViewCollection,this.#l=this.#c();const n=(0,i.getNormalizedAndLocalizedLanguageDefinitions)(e);this.#C=this.#x(t,n);const r=this.#T(t);this.#A=r.fieldView;const a=this.#u(t);this.#E=a.fieldView,this.#n=this.#h(t),this.#o=this.#m(t),this.#g(t,r,a)}render(){super.render(),(0,o.submitHandler)({view:this});const e=[this.#C,this.#A,this.#E,this.#n,this.#o];e.forEach((e=>{this.#a.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element),this.keystrokes.set("arrowright",(e=>e.stopPropagation())),this.keystrokes.set("arrowleft",(e=>e.stopPropagation())),this.keystrokes.set("arrowup",(e=>e.stopPropagation())),this.keystrokes.set("arrowdown",(e=>e.stopPropagation())),this.listenTo(e[0].element,"selectstart",((e,t)=>{t.stopPropagation()}),{priority:"high"}),this.on("submit",(()=>{this.fire("execute")}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.#l.focusFirst()}set insertButtonLabel(e){this.#n.label=e}#x(e,t){const i=e.t,n=(0,o.createDropdown)(e),s=this.#P(t);return this.highlighter=s.first.model._codeBlockLanguage,n.buttonView.bind("label").to(this,"highlighter",(e=>{const i=e?e.toString():"";return t.find((e=>e.language==i)).label})),n.buttonView.set({isOn:!1,withText:!0,tooltip:i("Language"),class:["ck-dropdown__button_label-width_auto"]}),n.on("execute",(e=>{this.highlighter=e.source._codeBlockLanguage})),(0,o.addListToDropdown)(n,s),n}#T(e){const t=e.t,i=new o.LabeledFieldView(e,o.createLabeledInputNumber);i.label=t("Line number");const{fieldView:n}=i;return n.min=0,n.bind("value").to(this,"line",(e=>e||"")),n.on("input",(()=>{this.line=n.element.value})),i}#u(e){const t=e.t,i=new o.LabeledFieldView(e,o.createLabeledInputText);return i.label=t("Filename"),i.fieldView.bind("value").to(this,"file",(e=>e||"")),i.fieldView.on("input",(()=>{this.file=i.fieldView.element.value})),i}#P(e){const t=new s.Collection;for(const i of e){const e={type:"button",model:new o.ViewModel({_codeBlockLanguage:i.language,label:i.label,withText:!0})};e.model.bind("isOn").to(this,"highlighter",(t=>t===e.model._codeBlockLanguage)),t.add(e)}return t}#h(e){const t=e.t,i=new o.ButtonView(e);return i.set({label:t("Insert"),icon:n.icons.check,class:"ck-button-save",type:"submit",withText:!0,isEnabled:!0}),i}#m(e){const t=e.t,i=new o.ButtonView(e);return i.set({label:t("Cancel"),icon:n.icons.cancel,class:"ck-button-cancel",withText:!0}),i.delegate("execute").to(this,"cancel"),i}#g(e,t,i){this.setTemplate({tag:"form",attributes:{class:["ck","ck-vertical-form","ck-woltlabcodeblock-insert-form"],tabindex:"-1"},children:[this.#C,t,i,new r.default(e,{children:[this.#n,this.#o],class:"ck-woltlabcodeblock-insert-form__action-row"})]})}#c(){return new o.FocusCycler({focusables:this.#a,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}})}}t.WoltlabCodeBlockPanelView=a,t.default=a}.apply(t,n),void 0===o||(e.exports=o)},1401:(e,t,i)=>{var n,o;n=[i,t,i(2148),i(1024),i(7243),i(7906),i(9061)],o=function(e,t,i,n,o,s,r){"use strict";function a(e){switch(typeof e){case"string":return e;case"number":case"boolean":return e.toString();default:return""}}Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabCodeBlock=void 0;class l extends n.Plugin{#I;#f=void 0;static get pluginName(){return"WoltlabCodeBlock"}init(){const e=this.editor;this.#I=e.commands.get("codeBlock"),e.model.schema.extend("codeBlock",{allowAttributes:["file","line"]}),this.#S(),this.#b(),this.#w(),this.#v(),this.#V(),this.listenTo(this.#I,"execute",(()=>{this.#_(this.#f)}))}#S(){const e=this.editor,t=e.t;e.ui.componentFactory.add("codeBlock",(i=>{const n=(0,o.createDropdown)(i,o.SplitButtonView),s=n.buttonView;s.set({label:t("Insert code block"),tooltip:!0,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.87 12.61a.75.75 0 0 1-.089.976l-.085.07-3.154 2.254 3.412 2.414a.75.75 0 0 1 .237.95l-.057.095a.75.75 0 0 1-.95.237l-.096-.058-4.272-3.022-.003-1.223 4.01-2.867a.75.75 0 0 1 1.047.174zm2.795-.231.095.057 4.011 2.867-.003 1.223-4.272 3.022-.095.058a.75.75 0 0 1-.88-.151l-.07-.086-.058-.095a.75.75 0 0 1 .15-.88l.087-.07 3.412-2.414-3.154-2.253-.085-.071a.75.75 0 0 1 .862-1.207zM16 0a2 2 0 0 1 2 2v9.354l-.663-.492-.837-.001V2a.5.5 0 0 0-.5-.5H2a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h3.118L7.156 19H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h14zM5.009 15l.003 1H3v-1h2.009zm2.188-2-1.471 1H5v-1h2.197zM10 11v.095L8.668 12H7v-1h3zm4-2v1H7V9h7zm0-2v1H7V7h7zm-4-2v1H5V5h5zM6 3v1H3V3h3z"/></svg>',isToggleable:!0}),s.bind("isOn").to(this.#I,"value",(e=>"string"==typeof e)),s.on("execute",(()=>{const t={usePreviousLanguageChoice:!1};""===this.#I.value&&(t.forceValue=!1),e.execute("codeBlock",t),e.editing.view.focus()})),n.on("submit",(t=>{const i=t.path.find((e=>e instanceof r.WoltlabCodeBlockPanelView));i instanceof r.WoltlabCodeBlockPanelView&&(this.#f=i,e.execute("codeBlock",{language:i.highlighter,forceValue:!0}),this.#f=void 0,e.editing.view.focus(),n.isOpen=!1)})),n.on("cancel",(()=>{e.editing.view.focus(),n.isOpen=!1})),n.bind("isEnabled").to(this.#I);const l=new r.WoltlabCodeBlockPanelView(e);return n.on("change:isOpen",(()=>{if(n.isOpen){const e=this.#R();e?(l.file=a(e.getAttribute("file")),l.highlighter=a(e.getAttribute("language")),l.line=a(e.getAttribute("line")),l.insertButtonLabel=t("Update")):(l.file="",l.highlighter="",l.line="",l.insertButtonLabel=t("Insert"))}})),n.panelView.children.add(l),l.delegate("submit","cancel").to(n),n}))}#b(){this.editor.data.upcastDispatcher.on("element:pre",((e,t,i)=>{const{viewItem:n}=t,{consumable:o,writer:s}=i;if(n.hasClass("woltlabHtml"))return;const r=s.createElement("codeBlock");s.setAttributes({file:n.getAttribute("data-file")||"",language:n.getAttribute("data-highlighter")||"",line:n.getAttribute("data-line")||""},r),i.convertChildren(n,r),i.safeInsert(r,t.modelCursor)&&(o.consume(n,{name:!0}),i.updateConversionResult(r,t))}),{priority:"high"})}#v(){const e=(0,i.getNormalizedAndLocalizedLanguageDefinitions)(this.editor);this.editor.editing.downcastDispatcher.on("insert:codeBlock",((t,i,n)=>{const{writer:o,mapper:s,consumable:r}=n;if(!r.consume(i.item,"insert"))return;const l=a(i.item.getAttribute("file")),c=a(i.item.getAttribute("language")),d=a(i.item.getAttribute("line")),u=o.createContainerElement("code",{class:`language-${c}`});let h="";const m=e.find((e=>e.language===c));h+=m?m.label:`Unknown (${c})`,(l||d)&&(h+=" (",l&&(h+=l),d&&(l&&(h+=" "),h+=`@ ${d}`),h+=")");const g=o.createContainerElement("pre",{"data-language":h,spellcheck:"false"},u),f=s.toViewPosition(this.editor.model.createPositionBefore(i.item));o.insert(f,g),s.bindElements(i.item,u)}),{priority:"high"})}#w(){this.editor.data.downcastDispatcher.on("insert:codeBlock",((e,t,i)=>{const{writer:n,mapper:o,consumable:s}=i;if(!s.consume(t.item,"insert"))return;const r=a(t.item.getAttribute("file")),l=a(t.item.getAttribute("language")),c=a(t.item.getAttribute("line")),d=o.toViewPosition(this.editor.model.createPositionBefore(t.item)),u=n.createContainerElement("pre",{"data-file":r,"data-highlighter":l,"data-line":c});n.insert(d,u),o.bindElements(t.item,u)}),{priority:"high"})}#_(e){const t=this.#R();t&&void 0!==e&&this.editor.model.change((i=>{i.setAttribute("file",e.file,t),i.setAttribute("line",e.line,t)}))}#V(){const e=(0,i.getNormalizedAndLocalizedLanguageDefinitions)(this.editor),t=["file","line"];for(const i of t)this.editor.editing.downcastDispatcher.on(`attribute:${i}:codeBlock`,((t,i,n)=>{const{mapper:o}=n,s=o.toViewElement(i.item);if(void 0===s)return;const r=s.getAncestors(),l=r[r.length-1];if(!l.is("element","pre"))return;const c=a(i.item.getAttribute("file")),d=a(i.item.getAttribute("language")),u=a(i.item.getAttribute("line"));let h="";const m=e.find((e=>e.language===d));h+=m?m.label:`Unknown (${d})`,(c||u)&&(h+=" (",c&&(h+=c),u&&(c&&(h+=" "),h+=`@ ${u}`),h+=")"),this.editor.editing.view.change((e=>{e.setAttribute("data-language",h,l)}))}))}#R(){const e=this.editor.model.document.selection,t=(0,s.first)(e.getSelectedBlocks());return t&&t.is("element","codeBlock")?t:null}}t.WoltlabCodeBlock=l,t.default=l}.apply(t,n),void 0===o||(e.exports=o)},4814:(e,t,i)=>{var n,o;n=[i,t,i(7274)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabCode=void 0,Object.defineProperty(t,"WoltlabCode",{enumerable:!0,get:function(){return i.WoltlabCode}})}.apply(t,n),void 0===o||(e.exports=o)},7274:(e,t,i)=>{var n,o;n=[i,t,i(6191),i(1024)],o=function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabCode=void 0;class o extends n.Plugin{static get pluginName(){return"WoltlabCode"}static get requires(){return[i.Code]}init(){const{conversion:e}=this.editor;e.for("upcast").elementToAttribute({view:"kbd",model:"code",converterPriority:"high"}),e.for("dataDowncast").attributeToElement({model:"code",view:"kbd",converterPriority:"high"})}}t.WoltlabCode=o,t.default=o}.apply(t,n),void 0===o||(e.exports=o)},1266:(e,t,i)=>{var n,o;n=[i,t,i(2443)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabFontSize=void 0,Object.defineProperty(t,"WoltlabFontSize",{enumerable:!0,get:function(){return i.WoltlabFontSize}})}.apply(t,n),void 0===o||(e.exports=o)},2443:(e,t,i)=>{var n,o;n=[i,t,i(1024)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabFontSize=void 0;class n extends i.Plugin{static defaultFontSize=15;static get pluginName(){return"WoltlabFontSize"}init(){if(!this.editor.plugins.has("FontSize"))return;const e=this.editor.config.get("fontSize").options.map((e=>"default"===e?n.defaultFontSize:e));this.editor.conversion.for("upcast").elementToAttribute({model:{key:"fontSize",value:t=>{const i=this.convertFontSizeToPx(t.getStyle("font-size"));if(void 0!==i)return e.reduce(((e,t)=>Math.abs(t-i)<Math.abs(e-i)?t:e))+"px"}},view:{name:"span",styles:{"font-size":/.*/}},converterPriority:"highest"})}convertFontSizeToPx(e){if(void 0===e)return;const t=e.match(/^(\d*\.?\d+)(px|pt|em|%)$/);if(!t)return;const i=parseFloat(t[1]);switch(t[2]){case"px":return i;case"pt":return 1.33*i;case"em":return 16*i;case"%":return i/100*n.defaultFontSize}}}t.WoltlabFontSize=n,t.default=n}.apply(t,n),void 0===o||(e.exports=o)},9374:(e,t,i)=>{var n,o;n=[i,t,i(2373)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabHtmlEmbed=void 0,Object.defineProperty(t,"WoltlabHtmlEmbed",{enumerable:!0,get:function(){return i.WoltlabHtmlEmbed}})}.apply(t,n),void 0===o||(e.exports=o)},2373:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(9090)],o=function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabHtmlEmbed=void 0;class o extends i.Plugin{static get pluginName(){return"WoltlabHtmlEmbed"}static get requires(){return[n.HtmlEmbed]}init(){const{conversion:e,data:t}=this.editor;t.registerRawContentMatcher({name:"pre",classes:"woltlabHtml"}),e.for("upcast").elementToElement({view:{name:"pre",classes:"woltlabHtml"},model:(e,{writer:t})=>{let i=e.getCustomProperty("$rawContent");return i="string"==typeof i?this.#B(i):"",t.createElement("rawHtml",{value:i})},converterPriority:"high"}),e.for("dataDowncast").elementToElement({model:"rawHtml",view:(e,{writer:t})=>t.createRawElement("pre",{class:"woltlabHtml"},(function(t){t.textContent=e.getAttribute("value")||""})),converterPriority:"high"})}#B(e){return String(e).replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}}t.WoltlabHtmlEmbed=o,t.default=o}.apply(t,n),void 0===o||(e.exports=o)},9897:(e,t,i)=>{var n,o;n=[i,t,i(3490)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabImage=void 0,Object.defineProperty(t,"WoltlabImage",{enumerable:!0,get:function(){return i.WoltlabImage}})}.apply(t,n),void 0===o||(e.exports=o)},3490:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(5048)],o=function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabImage=void 0;class o extends i.Plugin{static get pluginName(){return"WoltlabImage"}static get requires(){return[n.ImageUtils]}init(){this.#M(this.editor.commands.get("uploadImage")),this.#M(this.editor.commands.get("insertImage")),this.#M(this.editor.commands.get("replaceImageSource"));const{conversion:e}=this.editor,t=["imageBlock","imageInline"],i=this.editor.plugins.get("ImageUtils");for(const n of t)e.for("dataDowncast").attributeToAttribute({model:{name:n,key:"data-width"},view:"data-width"}),e.for("upcast").attributeToAttribute({view:{name:"imageBlock"===n?"figure":"img",key:"data-width"},model:"data-width"}),e.for("dataDowncast").add((e=>{e.on(`attribute:resizedWidth:${n}`,((e,t,i)=>{this.#O(t.item,t.attributeNewValue,i)}),{priority:"lowest"})})),e.for("editingDowncast").add((e=>{e.on(`insert:${n}`,((e,{item:t},n)=>{const{mapper:o}=n,{domConverter:s}=this.editor.editing.view,r=o.toViewElement(t);if(!r||!r.is("containerElement")||1!==r.childCount)return;const a=r.getChild(0);if(!a.is("element"))return;const l=s.viewToDom(i.findViewImgElement(a));if(!(l instanceof HTMLImageElement))return;const c=()=>{this.editor.editing.view.change((e=>{e.setStyle("max-width",`${l.naturalWidth}px`,r)}))};l.complete&&0!==l.naturalHeight?c():l.addEventListener("load",(()=>c()),{once:!0})})),e.on(`attribute:resizedWidth:${n}`,((e,t,i)=>{this.#O(t.item,t.attributeNewValue,i)}),{priority:"lowest"})}))}#O(e,t,i){if(!e.is("element"))return;if("string"!=typeof t)return;const{mapper:n,writer:o}=i,s=n.toViewElement(e);if(void 0===s)return;const r=this.editor.plugins.get("ImageUtils");o.setAttribute("data-width",t,r.findViewImgElement(s))}#M(e){const t=this.editor.plugins.get("ImageUtils");e?.on("set:isEnabled",((e,i,n)=>{if(!n)return;const o=this.editor.model.document.selection,s=t.getClosestSelectedImageElement(o);s&&(e.return=!(this.#L(s)||this.#F(s)))}),{priority:"high"})}#L(e){return"woltlabAttachment"===e.getAttribute("classList")||e.hasAttribute("attachmentId")}#F(e){return"woltlabSuiteMedia"===e.getAttribute("classList")||e.hasAttribute("mediaId")}}t.WoltlabImage=o,t.default=o}.apply(t,n),void 0===o||(e.exports=o)},1151:(e,t,i)=>{var n,o;n=[i,t,i(2222)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabMagicParagraph=void 0,Object.defineProperty(t,"WoltlabMagicParagraph",{enumerable:!0,get:function(){return i.WoltlabMagicParagraph}})}.apply(t,n),void 0===o||(e.exports=o)},2222:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(151)],o=function(e,t,i,n){"use strict";var o;Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabMagicParagraph=void 0;class s extends i.Plugin{static blockModels=["blockQuote","codeBlock","spoiler","table"];static get pluginName(){return"WoltlabMagicParagraph"}init(){const{mapper:e,view:t}=this.editor.editing,{document:i,domConverter:s}=t;t.addObserver(n.ClickObserver),this.listenTo(i,"click",((t,n)=>{const{domEvent:r,target:a}=n;if(void 0===a)return;const l=a.getAncestors();l.push(a);for(const e of l)if(e.is("element","p")||e.is("element","li"))return;const{clientY:c}=r,d=i.getRoot(),u=d.getChild(0);if(void 0!==u){if(u.is("containerElement")){let i=u,n=e.toModelElement(i);if(void 0===n&&i.childCount>0){const t=i.getChild(0);t.is("containerElement")&&(i=t,n=e.toModelElement(i))}if(n&&o.blockModels.includes(n.name)){const e=s.mapViewToDom(i),{top:n}=e.getBoundingClientRect();if(c<=n)return t.stop(),void this.#N(i)}}if(0!==d.childCount){const i=d.getChild(d.childCount-1);if(i.is("containerElement")){let n=i,r=e.toModelElement(n);if(void 0===r&&n.childCount>0){const t=n.getChild(n.childCount-1);t.is("containerElement")&&(n=t,r=e.toModelElement(n))}if(r&&o.blockModels.includes(r.name)){const e=s.mapViewToDom(n),{bottom:i}=e.getBoundingClientRect();if(c>=i)return t.stop(),void this.#D(n)}}}for(const e of this.#z()){const i=s.mapViewToDom(e),{bottom:n,top:o}=i.getBoundingClientRect(),{marginBottom:r,marginTop:a}=window.getComputedStyle(i),l=o-parseInt(a),d=n+parseInt(r);if(c<l)return;if(c>=l&&c<=o)return this.#N(e),void t.stop();if(c>=n&&c<=d)return this.#D(e),void t.stop()}}}))}#N(e){const{mapper:t}=this.editor.editing;let i;i=e.previousSibling&&e.previousSibling.is("element","p")?t.toModelElement(e.previousSibling):void 0,this.editor.model.change((n=>{if(void 0===i){i=n.createElement("paragraph");const o=n.createPositionBefore(t.toModelElement(e));n.insert(i,o)}n.setSelection(i,"end")}))}#D(e){const{mapper:t}=this.editor.editing;let i;i=e.nextSibling&&e.nextSibling.is("element","p")?t.toModelElement(e.nextSibling):void 0,this.editor.model.change((n=>{if(void 0===i){i=n.createElement("paragraph");const o=n.createPositionAfter(t.toModelElement(e));n.insert(i,o)}n.setSelection(i,"end")}))}*#z(){const{mapper:e,view:t}=this.editor.editing,i=t.document.getRoot(),n=t.createRangeIn(i);for(const t of n.getWalker({ignoreElementEnd:!0})){const i=t.item;if(!i.is("containerElement"))continue;const n=e.toModelElement(i);void 0!==n&&o.blockModels.includes(n.name)&&(yield i)}}}t.WoltlabMagicParagraph=s,o=s,t.default=s}.apply(t,n),void 0===o||(e.exports=o)},5107:(e,t,i)=>{var n,o;n=[i,t,i(2196)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabMedia=void 0,Object.defineProperty(t,"WoltlabMedia",{enumerable:!0,get:function(){return i.WoltlabMedia}})}.apply(t,n),void 0===o||(e.exports=o)},2196:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(5048),i(5123)],o=function(e,t,i,n,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabMedia=void 0;class s extends i.Plugin{static get pluginName(){return"WoltlabMedia"}static get requires(){return[n.Image,o.WoltlabMetacode,n.ImageUtils]}init(){this.#W()}#W(){const{conversion:e,model:t}=this.editor,{schema:i}=t,n=["imageBlock","imageInline"];n.forEach((t=>{i.extend(t,{allowAttributes:["mediaId","mediaSize"]}),e.attributeToAttribute({model:{key:"classList",values:["woltlabSuiteMedia"]},view:{woltlabSuiteMedia:{name:"imageBlock"===t?"figure":"img",key:"class",value:"woltlabSuiteMedia"}}})}));const o=new Map([["mediaId","data-media-id"],["mediaSize","data-media-size"]]),s=this.editor.plugins.get("ImageUtils");Array.from(o.entries()).forEach((([t,i])=>{e.for("upcast").attributeToAttribute({view:i,model:t}),e.for("downcast").add((e=>{n.forEach((n=>{e.on(`attribute:${t}:${n}`,((e,t,n)=>{if(!n.consumable.consume(t.item,e.name))return;const o=n.writer,r=s.findViewImgElement(n.mapper.toViewElement(t.item));null!==t.attributeNewValue?o.setAttribute(i,t.attributeNewValue,r):o.removeAttribute(i,r)}))}))}))}))}}t.WoltlabMedia=s,t.default=s}.apply(t,n),void 0===o||(e.exports=o)},2473:(e,t,i)=>{var n,o;n=[i,t,i(6296)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabMention=void 0,Object.defineProperty(t,"WoltlabMention",{enumerable:!0,get:function(){return i.WoltlabMention}})}.apply(t,n),void 0===o||(e.exports=o)},6296:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(2801),i(5123),i(7906)],o=function(e,t,i,n,o,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabMention=void 0;class r extends i.Plugin{static get pluginName(){return"WoltlabMention"}static get requires(){return[n.Mention,o.WoltlabMetacode]}init(){this.editor.plugins.get("WoltlabMetacode").on("upcast",((e,t)=>{"user"===t.name&&1===t.attributes.length&&(Number.isNaN(parseInt(t.attributes[0].toString()))||(e.stop(),this.#H(t)))})),this.#w()}#H(e){const{attributes:t,conversionApi:i,data:n,name:o}=e,{writer:r}=i,{viewItem:a}=n,l=a.getChild(0);Object.assign(n,i.convertChildren(n.viewItem,n.modelCursor));for(const e of Array.from(n.modelRange.getItems()))(e.is("$text")||e.is("$textProxy"))&&r.setAttribute("mention",{id:t[0].toString(),objectId:t[0],type:o,uid:(0,s.uid)(),_text:l.data},e)}#w(){this.editor.conversion.for("dataDowncast").attributeToElement({model:"mention",view:(e,{writer:t})=>{if(!e)return;const i=e.objectId;return t.createAttributeElement("woltlab-metacode",{"data-name":e.type,"data-attributes":btoa(JSON.stringify([i]))},{priority:20,id:e.uid})},converterPriority:"high"})}}t.WoltlabMention=r,t.default=r}.apply(t,n),void 0===o||(e.exports=o)},5123:(e,t,i)=>{var n,o;n=[i,t,i(6178)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabMetacode=void 0,Object.defineProperty(t,"WoltlabMetacode",{enumerable:!0,get:function(){return i.WoltlabMetacode}})}.apply(t,n),void 0===o||(e.exports=o)},6178:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(7906)],o=function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabMetacode=void 0;class o extends i.Plugin{static get pluginName(){return"WoltlabMetacode"}init(){this.editor.data.htmlProcessor.domConverter.inlineObjectElements.push("woltlab-metacode"),this.editor.editing.view.domConverter.inlineObjectElements.push("woltlab-metacode"),this.#U()}#U(){this.editor.conversion.for("upcast").add((e=>{e.on("element:woltlab-metacode",((e,t,i)=>{const{consumable:o,convertChildren:s,writer:r}=i,{viewItem:a}=t;if(!o.test(a,{name:!0}))return;const l=a.getAttribute("data-name");if(void 0===l)return;const c=this.#$(a.getAttribute("data-attributes")||""),d=new n.EventInfo(this,"upcast"),u={attributes:c,conversionApi:i,data:t,name:l};if(this.fire(d,u),d.stop.called)return;let{modelCursor:h}=t;const m=this.#j(c),g=r.createText(`[${l}${m}]`),f=r.createText(`[/${l}]`),p=h.parent;let b=!1;const w=h.getAncestors();if("$root"===w[w.length-1].name)b=!0;else if("blockQuote"===p.name)b=!0;else for(const e of a.getChildren())if(e.is("containerElement")){b=!0;break}if(b){let e=r.createElement("paragraph");r.insert(g,e),r.insert(e,h),h=r.createPositionAfter(e);const i=s(a,h);e=r.createElement("paragraph"),r.insert(f,e),r.insert(e,i.modelCursor),t.modelCursor=r.createPositionAfter(e)}else{r.insert(g,h),h=h.getShiftedBy(g.offsetSize);const e=s(a,h);r.insert(f,e.modelCursor),t.modelCursor=e.modelCursor.getShiftedBy(f.offsetSize)}}))}))}#$(e){if(""===e)return[];const t=atob(e);let i;try{i=JSON.parse(t)}catch(e){return[]}return i}#j(e){return 0===e.length?"":"="+e.map((e=>"number"==typeof e?e.toString():`'${e}'`)).join(",")}}t.WoltlabMetacode=o,t.default=o}.apply(t,n),void 0===o||(e.exports=o)},6976:(e,t,i)=>{var n,o;n=[i,t,i(2286),i(7701)],o=function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabSmileyCommand=t.WoltlabSmiley=void 0,Object.defineProperty(t,"WoltlabSmiley",{enumerable:!0,get:function(){return i.WoltlabSmiley}}),Object.defineProperty(t,"WoltlabSmileyCommand",{enumerable:!0,get:function(){return n.default}})}.apply(t,n),void 0===o||(e.exports=o)},2286:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(5048),i(1092),i(6734)],o=function(e,t,i,n,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabSmiley=void 0;class s extends i.Plugin{static get pluginName(){return"WoltlabSmiley"}static get requires(){return[n.Image,o.WoltlabSmileyUi]}init(){const{conversion:e,model:t}=this.editor,i=["imageBlock","imageInline"];for(const e of i)t.schema.extend(e,{allowAttributes:["classList"]});e.attributeToAttribute({model:{key:"classList",values:["smiley"]},view:{smiley:{name:"img",key:"class",value:"smiley"}}}),e.for("editingDowncast").add((e=>{e.on("insert:imageInline",((e,t,i)=>{const{item:n}=t;if("smiley"!==n.getAttribute("classList"))return;if(!n.is("element"))return;const{consumable:o,mapper:s,writer:r}=i;if(!o.test(n,"insert"))return;o.consume(n,"insert");const a=r.createEmptyElement("img");r.setAttribute("translate","no",a);const l=s.toViewPosition(this.editor.model.createPositionBefore(n));r.insert(l,a),s.bindElements(n,a)}),{priority:"high"})}))}}t.WoltlabSmiley=s,t.default=s}.apply(t,n),void 0===o||(e.exports=o)},7701:(e,t,i)=>{var n,o;n=[i,t,i(1024)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class n extends i.Command{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}execute(e){const t=this.editor.model,i=t.document.selection,n=("string"==typeof e.smiley?{id:e.smiley}:e.smiley).id,o=e.range||i.getFirstRange();if(!t.canEditAt(o))return;const s=e.html||n;t.change((e=>{const i=this.editor.data.processor.toView(s),n=this.editor.data.toModel(i),r=t.insertContent(n,o);e.setSelection(t.insertContent(e.createText(" "),r.end).end)}))}}t.default=n}.apply(t,n),void 0===o||(e.exports=o)},1092:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(7243),i(6192),i(7906),i(2801),i(7701)],o=function(e,t,i,n,o,s,r,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabSmileyUi=void 0,t.getRegexExp=f;const l="smiley",c=[s.keyCodes.enter,s.keyCodes.tab],d=[s.keyCodes.arrowup,s.keyCodes.arrowdown,s.keyCodes.esc,...c];class u extends i.Plugin{#q;#K;#G=new s.Collection;constructor(e){super(e),this.#K=this.#Z()}static get pluginName(){return"WoltlabSmileyUI"}static get requires(){return[n.ContextualBalloon]}get#J(){return this.#q.visibleView===this.#K}init(){this.#q=this.editor.plugins.get(n.ContextualBalloon),this.editor.commands.add("smiley",new a.default(this.editor)),this.editor.editing.view.document.on("keydown",((e,t)=>{var i;i=t.keyCode,d.includes(i)&&this.#J&&(t.preventDefault(),e.stop(),t.keyCode==s.keyCodes.arrowdown&&this.#K.selectNext(),t.keyCode==s.keyCodes.arrowup&&this.#K.selectPrevious(),c.includes(t.keyCode)&&this.#K.executeSelected(),t.keyCode==s.keyCodes.esc&&this.#Q())}),{priority:"highest"}),this.#Y(),(0,n.clickOutsideHandler)({emitter:this.#K,activator:()=>this.#J,contextElements:()=>[this.#q.view.element],callback:()=>this.#Q()}),this.listenTo(this.editor,"change:isReadOnly",(()=>{this.#Q()}))}destroy(){super.destroy(),this.#K?.destroy()}#Z(){const e=new r.MentionsView(this.editor.locale);return e.items.bindTo(this.#G).using((t=>{const{item:i,marker:n}=t;if(e.items.length>=10)return null;const o=new r.MentionListItemView(this.editor.locale),s=this.#X(i);return s.delegate("execute").to(o),o.children.add(s),o.item=i,o.marker=n,o.on("execute",(()=>{e.fire("execute",{item:i,marker:n})})),o})),e.on("execute",((e,t)=>{const i=this.editor,n=i.model,o=t.item,s=i.model.markers.get(l),r=n.createPositionAt(n.document.selection.focus),a=n.createPositionAt(s.getStart()),c=n.createRange(a,r);this.#Q(),i.execute("smiley",{smiley:o,html:o.text,range:c}),i.editing.view.focus()})),e}#X(e){const t=this.editor,i=document.createElement("span");return i.classList.add("ckeditor5__mention","ckeditor5__smiley"),i.innerHTML=`${e.text} ${e.id}`,new r.DomWrapperView(t.locale,i)}#Y(){const e=this.editor,t=new o.TextWatcher(e.model,(e=>void 0!==h(e)));t.on("matched",((t,i)=>{const n=h(i.text),o=i.text.substring(n).match(f())[0],s=i.range.start.getShiftedBy(n),r=e.model.createRange(s,s.getShiftedBy(1));if(m(e)){const t=e.model.markers.get(l);e.model.change((e=>{e.updateMarker(t,{range:r})}))}else e.model.change((e=>{e.addMarker(l,{range:r,usingOperation:!1,affectsData:!1})}));this.#G.clear(),(e.config.get("woltlabSmileys")||[]).filter((e=>e.code.startsWith(o))).forEach((e=>{this.#G.add({item:{id:e.code,text:e.html},marker:l})})),this.#G.length?this.#ee():this.#Q()})),t.on("unmatched",(()=>{this.#Q()}));const i=e.commands.get("smiley");t.bind("isEnabled").to(i)}#Q(){this.#q.hasView(this.#K)&&this.#q.remove(this.#K),m(this.editor)&&this.editor.model.change((e=>e.removeMarker(l)))}#ee(){const e=this.editor.model.markers.get(l);e?(this.#J?this.#q.updatePosition(this._getBalloonPanelPositionData(e,this.#K.position)):this.#q.add({view:this.#K,position:this._getBalloonPanelPositionData(e,this.#K.position),singleViewMode:!0}),this.#K.position=this.#q.view.position,this.#K.selectFirst()):this.#Q()}_getBalloonPanelPositionData(e,t){const i=this.editor,n=i.editing,o=n.view.domConverter,r=n.mapper;return{target:()=>{let t=e.getRange();"$graveyard"==t.start.root.rootName&&(t=i.model.document.selection.getFirstRange());const n=r.toViewRange(t);return s.Rect.getDomRangeRects(o.viewRangeToDom(n)).pop()},limiter:()=>{const e=this.editor.editing.view,t=e.document.selection.editableElement;return t?e.domConverter.mapViewToDom(t.root):null},positions:g(t,i.locale.uiLanguageDirection)}}}function h(e){const t=e.lastIndexOf(":");if(-1!==t&&e.substring(t-1).match(f()))return t}function m(e){return e.model.markers.has(l)}function g(e,t){const i={caret_se:e=>({top:e.bottom+3,left:e.right,name:"caret_se",config:{withArrow:!1}}),caret_ne:(e,t)=>({top:e.top-t.height-3,left:e.right,name:"caret_ne",config:{withArrow:!1}}),caret_sw:(e,t)=>({top:e.bottom+3,left:e.right-t.width,name:"caret_sw",config:{withArrow:!1}}),caret_nw:(e,t)=>({top:e.top-t.height-3,left:e.right-t.width,name:"caret_nw",config:{withArrow:!1}})};return Object.prototype.hasOwnProperty.call(i,e)?[i[e]]:"rtl"!==t?[i.caret_se,i.caret_sw,i.caret_ne,i.caret_nw]:[i.caret_sw,i.caret_se,i.caret_nw,i.caret_ne]}function f(){const e=s.env.features.isRegExpUnicodePropertySupported?"\\p{Ps}\\p{Pi}\"'":"\\(\\[{\"'";return new RegExp(`(?:^|[ ${e}])(:)([a-z]+(?:_[a-z]+)*)$`,"u")}t.WoltlabSmileyUi=u}.apply(t,n),void 0===o||(e.exports=o)},6153:(e,t,i)=>{var n,o;n=[i,t,i(772),i(1315)],o=function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabSpoilerCommand=t.WoltlabSpoiler=void 0,Object.defineProperty(t,"WoltlabSpoiler",{enumerable:!0,get:function(){return i.WoltlabSpoiler}}),Object.defineProperty(t,"WoltlabSpoilerCommand",{enumerable:!0,get:function(){return n.WoltlabSpoilerCommand}})}.apply(t,n),void 0===o||(e.exports=o)},772:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(254)],o=function(e,t,i,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabSpoiler=void 0;class o extends i.Plugin{static get requires(){return[n.default]}static get pluginName(){return"WoltlabSpoiler"}}t.WoltlabSpoiler=o,t.default=o}.apply(t,n),void 0===o||(e.exports=o)},1315:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(151),i(7906)],o=function(e,t,i,n,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabSpoilerCommand=void 0;class s extends i.Command{execute(){const{model:e}=this.editor,{schema:t}=e,{selection:i}=e.document,n=Array.from(i.getSelectedBlocks());e.change((e=>{if(this.value)this.#te(e,n);else{const i=n.filter((e=>this.#ie(e)||this.#ne(t,e)));this.#oe(e,i)}}))}refresh(){this.value=this.#se(),this.isEnabled=this.#i()}#te(e,t){for(const i of t){const t=this.#ie(i);if(null===t)continue;const o=t.previousSibling;if(null===o||!o.is("element","spoilerTitle"))throw new Error("Invalid structure, expected a `<spoilerTitle>` adjacent to `<spoilerContent>`",{cause:{spoilerTitle:o}});const s=t.parent;if(!(s instanceof n.Element&&s.is("element","spoiler")))throw new Error("Invalid structure, expected a `<spoiler>` as the parent of a `<spoilerContent>`",{cause:{spoiler:s}});e.remove(o),e.unwrap(s),e.unwrap(t)}}#oe(e,t){const i=[];this.#re(e,t).reverse().forEach((t=>{let n=this.#ie(t.start);n||(n=this.#ae(e,t)),i.push(n.parent)})),i.reverse().reduce(((t,i)=>{if(t.nextSibling===i){const n=t.getChild(1),o=i.getChild(1);return e.move(e.createRangeIn(o),e.createPositionAt(n,"end")),e.remove(i),t}return i}))}#re(e,t){let i=null,n=0;const o=[];for(;n<t.length;){const s=t[n],r=t[n+1];i||(i=e.createPositionBefore(s)),r&&s.nextSibling===r||(o.push(e.createRange(i,e.createPositionAfter(s))),i=null),n++}return o}#i(){if(this.value)return!0;const{selection:e}=this.editor.model.document,t=(0,o.first)(e.getSelectedBlocks());if(!t)return!1;const{schema:i}=this.editor.model;return this.#ne(i,t)}#se(){const{selection:e}=this.editor.model.document,t=(0,o.first)(e.getSelectedBlocks());return!(!t||!this.#ie(t))}#ie(e){return e.parent instanceof n.Element?"spoilerContent"===e.parent.name?e.parent:this.#ie(e.parent):null}#ne(e,t){const i=e.checkChild(t.parent,"spoiler"),n=e.checkChild("spoilerContent",t);return i&&n}#ae(e,t){const i=e.createElement("spoilerContent");e.wrap(t,i);const n=e.createElement("spoiler");e.wrap(e.createRangeOn(i),n);const o=e.createElement("spoilerTitle");return e.insert(o,n,0),i}}t.WoltlabSpoilerCommand=s,t.default=s}.apply(t,n),void 0===o||(e.exports=o)},254:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(3906),i(151),i(7243),i(1315),i(1278)],o=function(e,t,i,n,o,s,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabSpoilerEditing=void 0;class a extends i.Plugin{static get pluginName(){return"WoltlabSpoilerEditing"}static get requires(){return[n.Widget]}init(){this.#le(),this.#U(),this.editor.commands.add("insertSpoiler",new r.default(this.editor)),this.#ce()}#ce(){const{t:e}=this.editor.locale;this.editor.ui.componentFactory.add("spoiler",(t=>{const i=this.editor.commands.get("insertSpoiler"),n=new s.ButtonView(t);return n.set({label:e("Spoiler"),tooltip:!0,withText:!0}),n.labelView.setTemplate({tag:"fa-icon",attributes:{name:"eye-slash"}}),n.bind("isOn").to(i,"value"),n.bind("isEnabled").to(i,"isEnabled"),this.listenTo(n,"execute",(()=>this.editor.execute("insertSpoiler"))),n}))}#le(){const{schema:e}=this.editor.model;e.register("spoiler",{allowWhere:"$block",isObject:!0}),e.register("spoilerTitle",{allowChildren:"$text",allowIn:"spoiler",isLimit:!0}),e.register("spoilerContent",{allowContentOf:"$root",allowIn:"spoiler",isLimit:!0}),e.addChildCheck(((e,t)=>("spoiler"!==t.name||!Array.from(e.getNames()).includes("spoiler"))&&(!e.endsWith("spoilerContent")||"spoiler"!==t.name)&&(!e.endsWith("spoilerTitle")||"$text"===t.name)&&void 0)),e.addAttributeCheck((e=>{if(e.endsWith("spoilerTitle $text"))return!1}))}#U(){const{conversion:e}=this.editor,{t}=this.editor.locale;e.for("upcast").add((e=>{e.on("element:woltlab-spoiler",((e,t,i)=>{const{consumable:n,writer:o,safeInsert:s,convertChildren:r,updateConversionResult:a}=i,{viewItem:l}=t,c={name:!0};if(!n.test(l,c))return;const d=o.createElement("spoiler"),u=o.createElement("spoilerTitle");o.append(u,d);const h=(l.getAttribute("data-label")||"").trim();o.appendText(h,u);const m=o.createElement("spoilerContent");o.append(m,d),s(d,t.modelCursor)&&(n.consume(l,c),r(l,m),a(d,t))}))})),e.for("dataDowncast").add((e=>{e.on("insert:spoiler",((e,t,i)=>{const{item:n}=t,{consumable:o,mapper:s,writer:r}=i;if(2!==n.childCount)return null;const a=n.getChild(0);if(!a.is("element","spoilerTitle"))return null;if(!o.consume(n,"insert"))return;o.consume(a,"insert");let l="";if(1===a.childCount){const e=a.getChild(0);e.is("$text")&&(l=e.data)}const c=r.createContainerElement("woltlab-spoiler",{"data-label":l}),d=s.toViewPosition(this.editor.model.createPositionBefore(n));r.insert(d,c),s.bindElements(n,c),s.bindElements(a,c);const u=n.getChild(1);u.is("element","spoilerContent")&&(s.bindElements(u,c),o.consume(u,"insert"))})),e.on("insert:$text",((e,t,i)=>{const n=t.item.parent;n&&n.is("element","spoilerTitle")&&i.consumable.consume(t.item,"insert")}))})),e.for("editingDowncast").elementToElement({model:"spoiler",view:(e,{writer:t})=>{const i=t.createContainerElement("div",{class:"ck-woltlabspoiler"});return(0,n.toWidget)(i,t,{hasSelectionHandle:!0,label:"spoiler widget"})}}).elementToElement({model:"spoilerTitle",view:(e,{writer:i})=>{const s=i.createEditableElement("div",{class:"ck-woltlabspoiler__title","data-label":t("Spoiler")});return s.placeholder=t("Type your title"),(0,o.enablePlaceholder)({view:this.editor.editing.view,element:s,keepOnFocus:!0}),(0,n.toWidgetEditable)(s,i)}}).elementToElement({model:"spoilerContent",view:(e,{writer:t})=>{const i=t.createEditableElement("div",{class:"ck-woltlabspoiler__content"});return(0,n.toWidgetEditable)(i,t)}})}}t.WoltlabSpoilerEditing=a,t.default=a}.apply(t,n),void 0===o||(e.exports=o)},3806:(e,t,i)=>{var n,o;n=[i,t,i(4565)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabToolbarGroup=void 0,Object.defineProperty(t,"WoltlabToolbarGroup",{enumerable:!0,get:function(){return i.WoltlabToolbarGroup}})}.apply(t,n),void 0===o||(e.exports=o)},4565:(e,t,i)=>{var n,o;n=[i,t,i(1024)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabToolbarGroup=void 0;class n extends i.Plugin{static get pluginName(){return"WoltlabToolbarGroup"}init(){const e=this.editor.config.get("woltlabToolbarGroup");e&&this.editor.once("ready",(()=>{const t=this.editor.ui.view.toolbar.items;Object.entries(e).forEach((([e,i])=>{const n=t.find((t=>null!==t.element?.querySelector(`[data-cke-tooltip-text="woltlabToolbarGroup_${e}"]`))),o=n.element.querySelector(".ck-button__icon"),[s,r]=i.icon.split(";",2),a=document.createElement("fa-icon");a.setIcon(s,"true"===r),o.replaceWith(a),n.buttonView.label=i.label}))}))}}t.WoltlabToolbarGroup=n,t.default=n}.apply(t,n),void 0===o||(e.exports=o)},5842:(e,t,i)=>{var n,o;n=[i,t,i(7873)],o=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabUpload=void 0,Object.defineProperty(t,"WoltlabUpload",{enumerable:!0,get:function(){return i.WoltlabUpload}})}.apply(t,n),void 0===o||(e.exports=o)},7873:(e,t,i)=>{var n,o;n=[i,t,i(1024),i(4857),i(135)],o=function(e,t,i,n,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabUpload=void 0;class s extends i.Plugin{static get pluginName(){return"WoltlabUpload"}static get requires(){return[n.FileRepository]}init(){const{config:e,editing:t,plugins:i}=this.editor,s=e.get("woltlabUpload");s&&"function"==typeof s.uploadImage&&(i.get(n.FileRepository).createUploadAdapter=e=>new o.WoltlabUploadAdapter(e,s),"function"==typeof s.uploadOther&&this.listenTo(t.view.document,"clipboardInput",((e,t)=>{if(e.stop.called)return;const{dataTransfer:i,method:n}=t;if("drop"===n){for(const e of i.files)null!==e&&s.uploadOther(e);e.stop()}}),{priority:"lowest"}))}}t.WoltlabUpload=s,t.default=s}.apply(t,n),void 0===o||(e.exports=o)},135:(e,t,i)=>{var n;n=function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WoltlabUploadAdapter=void 0;class i{#de;#ue;#he;constructor(e,t){this.#de=e,this.#ue=t}abort(){this.#he?.abort()}async upload(){const e=await this.#de.file;return this.#he=new AbortController,this.#ue.uploadImage(e,this.#he)}}t.WoltlabUploadAdapter=i,t.default=i}.apply(t,[i,t]),void 0===n||(e.exports=n)},7109:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Alignment:()=>f,AlignmentEditing:()=>u,AlignmentUI:()=>g});var n=i(1204),o=i(5318);const s=["left","right","center","justify"];function r(e){return s.includes(e)}function a(e,t){return"rtl"==t.contentLanguageDirection?"right"===e:"left"===e}function l(e){const t=e.map((e=>{let t;return t="string"==typeof e?{name:e}:e,t})).filter((e=>{const t=s.includes(e.name);return t||(0,o.FF)("alignment-config-name-not-recognized",{option:e}),t})),i=t.filter((e=>Boolean(e.className))).length;if(i&&i<t.length)throw new o.Yb("alignment-config-classnames-are-missing",{configuredOptions:e});return t.forEach(((t,i,n)=>{const s=n.slice(i+1);if(s.some((e=>e.name==t.name)))throw new o.Yb("alignment-config-name-already-defined",{option:t,configuredOptions:e});if(t.className&&s.some((e=>e.className==t.className)))throw new o.Yb("alignment-config-classname-already-defined",{option:t,configuredOptions:e})})),t}const c="alignment";class d extends n.uB{refresh(){const e=this.editor.locale,t=(0,o.$1)(this.editor.model.document.selection.getSelectedBlocks());this.isEnabled=Boolean(t)&&this._canBeAligned(t),this.isEnabled&&t.hasAttribute("alignment")?this.value=t.getAttribute("alignment"):this.value="rtl"===e.contentLanguageDirection?"right":"left"}execute(e={}){const t=this.editor,i=t.locale,n=t.model,o=n.document,s=e.value;n.change((e=>{const t=Array.from(o.selection.getSelectedBlocks()).filter((e=>this._canBeAligned(e))),n=t[0].getAttribute("alignment");a(s,i)||n===s||!s?function(e,t){for(const i of e)t.removeAttribute(c,i)}(t,e):function(e,t,i){for(const n of e)t.setAttribute(c,i,n)}(t,e,s)}))}_canBeAligned(e){return this.editor.model.schema.checkAttribute(e,c)}}class u extends n.k_{static get pluginName(){return"AlignmentEditing"}constructor(e){super(e),e.config.define("alignment",{options:s.map((e=>({name:e})))})}init(){const e=this.editor,t=e.locale,i=e.model.schema,n=l(e.config.get("alignment.options")).filter((e=>r(e.name)&&!a(e.name,t))),o=n.some((e=>!!e.className));i.extend("$block",{allowAttributes:"alignment"}),e.model.schema.setAttributeProperties("alignment",{isFormatting:!0}),o?e.conversion.attributeToAttribute(function(e){const t={};for(const i of e)t[i.name]={key:"class",value:i.className};return{model:{key:"alignment",values:e.map((e=>e.name))},view:t}}(n)):e.conversion.for("downcast").attributeToAttribute(function(e){const t={};for(const{name:i}of e)t[i]={key:"style",value:{"text-align":i}};return{model:{key:"alignment",values:e.map((e=>e.name))},view:t}}(n));const s=function(e){const t=[];for(const{name:i}of e)t.push({view:{key:"style",value:{"text-align":i}},model:{key:"alignment",value:i}});return t}(n);for(const t of s)e.conversion.for("upcast").attributeToAttribute(t);const c=function(e){const t=[];for(const{name:i}of e)t.push({view:{key:"align",value:i},model:{key:"alignment",value:i}});return t}(n);for(const t of c)e.conversion.for("upcast").attributeToAttribute(t);e.commands.add("alignment",new d(e))}}var h=i(949);const m=(()=>new Map([["left",n.Pt.alignLeft],["right",n.Pt.alignRight],["center",n.Pt.alignCenter],["justify",n.Pt.alignJustify]]))();class g extends n.k_{get localizedOptionTitles(){const e=this.editor.t;return{left:e("Align left"),right:e("Align right"),center:e("Align center"),justify:e("Justify")}}static get pluginName(){return"AlignmentUI"}init(){const e=l(this.editor.config.get("alignment.options"));e.map((e=>e.name)).filter(r).forEach((e=>this._addButton(e))),this._addToolbarDropdown(e),this._addMenuBarMenu(e)}_addButton(e){this.editor.ui.componentFactory.add(`alignment:${e}`,(t=>this._createButton(t,e)))}_createButton(e,t,i={}){const n=this.editor,o=n.commands.get("alignment"),s=new h._(e);return s.set({label:this.localizedOptionTitles[t],icon:m.get(t),tooltip:!0,isToggleable:!0,...i}),s.bind("isEnabled").to(o),s.bind("isOn").to(o,"value",(e=>e===t)),this.listenTo(s,"execute",(()=>{n.execute("alignment",{value:t}),n.editing.view.focus()})),s}_addToolbarDropdown(e){const t=this.editor;t.ui.componentFactory.add("alignment",(i=>{const n=(0,h.yu)(i),o="rtl"===i.uiLanguageDirection?"w":"e",s=i.t;(0,h.fM)(n,(()=>e.map((e=>this._createButton(i,e.name,{tooltipPosition:o})))),{enableActiveItemFocusOnDropdownOpen:!0,isVertical:!0,ariaLabel:s("Text alignment toolbar")}),n.buttonView.set({label:s("Text alignment"),tooltip:!0}),n.extendTemplate({attributes:{class:"ck-alignment-dropdown"}});const r="rtl"===i.contentLanguageDirection?m.get("right"):m.get("left"),a=t.commands.get("alignment");return n.buttonView.bind("icon").to(a,"value",(e=>m.get(e)||r)),n.bind("isEnabled").to(a,"isEnabled"),this.listenTo(n,"execute",(()=>{t.editing.view.focus()})),n}))}_addMenuBarMenu(e){const t=this.editor;t.ui.componentFactory.add("menuBar:alignment",(i=>{const n=t.commands.get("alignment"),o=i.t,s=new h.zj(i),r=new h.BY(i);s.bind("isEnabled").to(n),r.set({ariaLabel:o("Text alignment"),role:"menu"}),s.buttonView.set({label:o("Text alignment")});for(const o of e){const e=new h.I8(i,s),a=new h.kS(i);a.delegate("execute").to(s),a.set({label:this.localizedOptionTitles[o.name],icon:m.get(o.name),role:"menuitemcheckbox",isToggleable:!0}),a.on("execute",(()=>{t.execute("alignment",{value:o.name}),t.editing.view.focus()})),a.bind("isOn").to(n,"value",(e=>e===o.name)),a.bind("isEnabled").to(n,"isEnabled"),e.children.add(a),r.items.add(e)}return s.panelView.children.add(r),s}))}}class f extends n.k_{static get requires(){return[u,g]}static get pluginName(){return"Alignment"}}},7933:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Autosave:()=>r});var n=i(1204),o=i(5318),s=i(2223);class r extends n.k_{static get pluginName(){return"Autosave"}static get requires(){return[n.TS]}constructor(e){super(e),this._action=null;const t=e.config.get("autosave")||{},i=t.waitingTime||1e3;this.set("state","synchronized"),this._debouncedSave=(0,s.A)(this._save.bind(this),i),this._lastDocumentVersion=e.model.document.version,this._savePromise=null,this._domEmitter=new((0,o.c5)()),this._config=t,this._pendingActions=e.plugins.get(n.TS),this._makeImmediateSave=!1}init(){const e=this.editor,t=e.model.document;this.listenTo(e,"ready",(()=>{this.listenTo(t,"change:data",((e,t)=>{this._saveCallbacks.length&&t.isLocal&&("synchronized"===this.state&&(this.state="waiting",this._setPendingAction()),"waiting"===this.state&&this._debouncedSave())}))})),this.listenTo(e,"destroy",(()=>this._flush()),{priority:"highest"}),this._domEmitter.listenTo(window,"beforeunload",((e,t)=>{this._pendingActions.hasAny&&(t.returnValue=this._pendingActions.first.message)}))}destroy(){this._domEmitter.stopListening(),super.destroy()}save(){return this._debouncedSave.cancel(),this._save()}_flush(){this._debouncedSave.flush()}_save(){return this._savePromise?(this._makeImmediateSave=this.editor.model.document.version>this._lastDocumentVersion,this._savePromise):(this._setPendingAction(),this.state="saving",this._lastDocumentVersion=this.editor.model.document.version,this._savePromise=Promise.resolve().then((()=>Promise.all(this._saveCallbacks.map((e=>e(this.editor)))))).finally((()=>{this._savePromise=null})).then((()=>{if(this._makeImmediateSave)return this._makeImmediateSave=!1,this._save();this.editor.model.document.version>this._lastDocumentVersion?(this.state="waiting",this._debouncedSave()):(this.state="synchronized",this._pendingActions.remove(this._action),this._action=null)})).catch((e=>{throw this.state="error",this.state="saving",this._debouncedSave(),e})),this._savePromise)}_setPendingAction(){const e=this.editor.t;this._action||(this._action=this._pendingActions.add(e("Saving changes")))}get _saveCallbacks(){const e=[];return this.adapter&&this.adapter.save&&e.push(this.adapter.save),this._config.save&&e.push(this._config.save),e}}},6191:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Bold:()=>u,BoldEditing:()=>r,BoldUI:()=>d,Code:()=>b,CodeEditing:()=>g,CodeUI:()=>p,Italic:()=>k,ItalicEditing:()=>v,ItalicUI:()=>y,Strikethrough:()=>T,StrikethroughEditing:()=>A,StrikethroughUI:()=>x,Subscript:()=>R,SubscriptEditing:()=>I,SubscriptUI:()=>V,Superscript:()=>F,SuperscriptEditing:()=>M,SuperscriptUI:()=>L,Underline:()=>H,UnderlineEditing:()=>D,UnderlineUI:()=>W});var n=i(1204);class o extends n.uB{constructor(e,t){super(e),this.attributeKey=t}refresh(){const e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){const t=this.editor.model,i=t.document.selection,n=void 0===e.forceValue?!this.value:e.forceValue;t.change((e=>{if(i.isCollapsed)n?e.setSelectionAttribute(this.attributeKey,!0):e.removeSelectionAttribute(this.attributeKey);else{const o=t.schema.getValidRanges(i.getRanges(),this.attributeKey);for(const t of o)n?e.setAttribute(this.attributeKey,n,t):e.removeAttribute(this.attributeKey,t)}}))}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,i=e.document.selection;if(i.isCollapsed)return i.hasAttribute(this.attributeKey);for(const e of i.getRanges())for(const i of e.getItems())if(t.checkAttribute(i,this.attributeKey))return i.hasAttribute(this.attributeKey);return!1}}const s="bold";class r extends n.k_{static get pluginName(){return"BoldEditing"}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:s}),e.model.schema.setAttributeProperties(s,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:s,view:"strong",upcastAlso:["b",e=>{const t=e.getStyle("font-weight");return t&&("bold"==t||Number(t)>=600)?{name:!0,styles:["font-weight"]}:null}]}),e.commands.add(s,new o(e,s)),e.keystrokes.set("CTRL+B",s),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Bold text"),keystroke:"CTRL+B"}]})}}var a=i(949);function l({editor:e,commandName:t,plugin:i,icon:n,label:o,keystroke:s}){return r=>{const l=e.commands.get(t),c=new r(e.locale);return c.set({label:o,icon:n,keystroke:s,isToggleable:!0}),c.bind("isEnabled").to(l,"isEnabled"),c.bind("isOn").to(l,"value"),c instanceof a.kS?c.set({role:"menuitemcheckbox"}):c.set({tooltip:!0}),i.listenTo(c,"execute",(()=>{e.execute(t),e.editing.view.focus()})),c}}const c="bold";class d extends n.k_{static get pluginName(){return"BoldUI"}init(){const e=this.editor,t=e.locale.t,i=l({editor:e,commandName:c,plugin:this,icon:n.Pt.bold,label:t("Bold"),keystroke:"CTRL+B"});e.ui.componentFactory.add(c,(()=>i(a._))),e.ui.componentFactory.add("menuBar:"+c,(()=>i(a.kS)))}}class u extends n.k_{static get requires(){return[r,d]}static get pluginName(){return"Bold"}}var h=i(7211);const m="code";class g extends n.k_{static get pluginName(){return"CodeEditing"}static get requires(){return[h.Vp]}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:m}),e.model.schema.setAttributeProperties(m,{isFormatting:!0,copyOnEnter:!1}),e.conversion.attributeToElement({model:m,view:"code",upcastAlso:{styles:{"word-wrap":"break-word"}}}),e.commands.add(m,new o(e,m)),e.plugins.get(h.Vp).registerAttribute(m),(0,h.Il)(e,m,"code","ck-code_selected"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Move out of an inline code style"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}}const f="code";class p extends n.k_{static get pluginName(){return"CodeUI"}init(){const e=this.editor,t=e.locale.t,i=l({editor:e,commandName:f,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m12.5 5.7 5.2 3.9v1.3l-5.6 4c-.1.2-.3.2-.5.2-.3-.1-.6-.7-.6-1l.3-.4 4.7-3.5L11.5 7l-.2-.2c-.1-.3-.1-.6 0-.8.2-.2.5-.4.8-.4a.8.8 0 0 1 .4.1zm-5.2 0L2 9.6v1.3l5.6 4c.1.2.3.2.5.2.3-.1.7-.7.6-1 0-.1 0-.3-.2-.4l-5-3.5L8.2 7l.2-.2c.1-.3.1-.6 0-.8-.2-.2-.5-.4-.8-.4a.8.8 0 0 0-.3.1z"/></svg>',label:t("Code")});e.ui.componentFactory.add(f,(()=>i(a._))),e.ui.componentFactory.add("menuBar:"+f,(()=>i(a.kS)))}}class b extends n.k_{static get requires(){return[g,p]}static get pluginName(){return"Code"}}const w="italic";class v extends n.k_{static get pluginName(){return"ItalicEditing"}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:w}),e.model.schema.setAttributeProperties(w,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:w,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),e.commands.add(w,new o(e,w)),e.keystrokes.set("CTRL+I",w),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Italic text"),keystroke:"CTRL+I"}]})}}const _="italic";class y extends n.k_{static get pluginName(){return"ItalicUI"}init(){const e=this.editor,t=e.locale.t,i=l({editor:e,commandName:_,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m9.586 14.633.021.004c-.036.335.095.655.393.962.082.083.173.15.274.201h1.474a.6.6 0 1 1 0 1.2H5.304a.6.6 0 0 1 0-1.2h1.15c.474-.07.809-.182 1.005-.334.157-.122.291-.32.404-.597l2.416-9.55a1.053 1.053 0 0 0-.281-.823 1.12 1.12 0 0 0-.442-.296H8.15a.6.6 0 0 1 0-1.2h6.443a.6.6 0 1 1 0 1.2h-1.195c-.376.056-.65.155-.823.296-.215.175-.423.439-.623.79l-2.366 9.347z"/></svg>',keystroke:"CTRL+I",label:t("Italic")});e.ui.componentFactory.add(_,(()=>i(a._))),e.ui.componentFactory.add("menuBar:"+_,(()=>i(a.kS)))}}class k extends n.k_{static get requires(){return[v,y]}static get pluginName(){return"Italic"}}const C="strikethrough";class A extends n.k_{static get pluginName(){return"StrikethroughEditing"}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:C}),e.model.schema.setAttributeProperties(C,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:C,view:"s",upcastAlso:["del","strike",{styles:{"text-decoration":"line-through"}}]}),e.commands.add(C,new o(e,C)),e.keystrokes.set("CTRL+SHIFT+X","strikethrough"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Strikethrough text"),keystroke:"CTRL+SHIFT+X"}]})}}const E="strikethrough";class x extends n.k_{static get pluginName(){return"StrikethroughUI"}init(){const e=this.editor,t=e.locale.t,i=l({editor:e,commandName:E,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 16.4c-.8-.4-1.5-.9-2.2-1.5a.6.6 0 0 1-.2-.5l.3-.6h1c1 1.2 2.1 1.7 3.7 1.7 1 0 1.8-.3 2.3-.6.6-.4.6-1.2.6-1.3.2-1.2-.9-2.1-.9-2.1h2.1c.3.7.4 1.2.4 1.7v.8l-.6 1.2c-.6.8-1.1 1-1.6 1.2a6 6 0 0 1-2.4.6c-1 0-1.8-.3-2.5-.6zM6.8 9 6 8.3c-.4-.5-.5-.8-.5-1.6 0-.7.1-1.3.5-1.8.4-.6 1-1 1.6-1.3a6.3 6.3 0 0 1 4.7 0 4 4 0 0 1 1.7 1l.3.7c0 .1.2.4-.2.7-.4.2-.9.1-1 0a3 3 0 0 0-1.2-1c-.4-.2-1-.3-2-.4-.7 0-1.4.2-2 .6-.8.6-1 .8-1 1.5 0 .8.5 1 1.2 1.5.6.4 1.1.7 1.9 1H6.8z"/><path d="M3 10.5V9h14v1.5z"/></svg>',keystroke:"CTRL+SHIFT+X",label:t("Strikethrough")});e.ui.componentFactory.add(E,(()=>i(a._))),e.ui.componentFactory.add("menuBar:"+E,(()=>i(a.kS)))}}class T extends n.k_{static get requires(){return[A,x]}static get pluginName(){return"Strikethrough"}}const P="subscript";class I extends n.k_{static get pluginName(){return"SubscriptEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:P}),e.model.schema.setAttributeProperties(P,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:P,view:"sub",upcastAlso:[{styles:{"vertical-align":"sub"}}]}),e.commands.add(P,new o(e,P))}}const S="subscript";class V extends n.k_{static get pluginName(){return"SubscriptUI"}init(){const e=this.editor,t=e.locale.t,i=l({editor:e,commandName:S,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m7.03 10.349 3.818-3.819a.8.8 0 1 1 1.132 1.132L8.16 11.48l3.819 3.818a.8.8 0 1 1-1.132 1.132L7.03 12.61l-3.818 3.82a.8.8 0 1 1-1.132-1.132L5.9 11.48 2.08 7.662A.8.8 0 1 1 3.212 6.53l3.818 3.82zm8.147 7.829h2.549c.254 0 .447.05.58.152a.49.49 0 0 1 .201.413.54.54 0 0 1-.159.393c-.105.108-.266.162-.48.162h-3.594c-.245 0-.435-.066-.572-.197a.621.621 0 0 1-.205-.463c0-.114.044-.265.132-.453a1.62 1.62 0 0 1 .288-.444c.433-.436.824-.81 1.172-1.122.348-.312.597-.517.747-.615.267-.183.49-.368.667-.553.177-.185.312-.375.405-.57.093-.194.139-.384.139-.57a1.008 1.008 0 0 0-.554-.917 1.197 1.197 0 0 0-.56-.133c-.426 0-.761.182-1.005.546a2.332 2.332 0 0 0-.164.39 1.609 1.609 0 0 1-.258.488c-.096.114-.237.17-.423.17a.558.558 0 0 1-.405-.156.568.568 0 0 1-.161-.427c0-.218.05-.446.151-.683.101-.238.252-.453.452-.646s.454-.349.762-.467a2.998 2.998 0 0 1 1.081-.178c.498 0 .923.076 1.274.228a1.916 1.916 0 0 1 1.004 1.032 1.984 1.984 0 0 1-.156 1.794c-.2.32-.405.572-.613.754-.208.182-.558.468-1.048.857-.49.39-.826.691-1.008.906a2.703 2.703 0 0 0-.24.309z"/></svg>',label:t("Subscript")});e.ui.componentFactory.add(S,(()=>i(a._))),e.ui.componentFactory.add("menuBar:"+S,(()=>i(a.kS)))}}class R extends n.k_{static get requires(){return[I,V]}static get pluginName(){return"Subscript"}}const B="superscript";class M extends n.k_{static get pluginName(){return"SuperscriptEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:B}),e.model.schema.setAttributeProperties(B,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:B,view:"sup",upcastAlso:[{styles:{"vertical-align":"super"}}]}),e.commands.add(B,new o(e,B))}}const O="superscript";class L extends n.k_{static get pluginName(){return"SuperscriptUI"}init(){const e=this.editor,t=e.locale.t,i=l({editor:e,commandName:O,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M15.677 8.678h2.549c.254 0 .447.05.58.152a.49.49 0 0 1 .201.413.54.54 0 0 1-.159.393c-.105.108-.266.162-.48.162h-3.594c-.245 0-.435-.066-.572-.197a.621.621 0 0 1-.205-.463c0-.114.044-.265.132-.453a1.62 1.62 0 0 1 .288-.444c.433-.436.824-.81 1.172-1.122.348-.312.597-.517.747-.615.267-.183.49-.368.667-.553.177-.185.312-.375.405-.57.093-.194.139-.384.139-.57a1.008 1.008 0 0 0-.554-.917 1.197 1.197 0 0 0-.56-.133c-.426 0-.761.182-1.005.546a2.332 2.332 0 0 0-.164.39 1.609 1.609 0 0 1-.258.488c-.096.114-.237.17-.423.17a.558.558 0 0 1-.405-.156.568.568 0 0 1-.161-.427c0-.218.05-.446.151-.683.101-.238.252-.453.452-.646s.454-.349.762-.467a2.998 2.998 0 0 1 1.081-.178c.498 0 .923.076 1.274.228a1.916 1.916 0 0 1 1.004 1.032 1.984 1.984 0 0 1-.156 1.794c-.2.32-.405.572-.613.754-.208.182-.558.468-1.048.857-.49.39-.826.691-1.008.906a2.703 2.703 0 0 0-.24.309zM7.03 10.349l3.818-3.819a.8.8 0 1 1 1.132 1.132L8.16 11.48l3.819 3.818a.8.8 0 1 1-1.132 1.132L7.03 12.61l-3.818 3.82a.8.8 0 1 1-1.132-1.132L5.9 11.48 2.08 7.662A.8.8 0 1 1 3.212 6.53l3.818 3.82z"/></svg>',label:t("Superscript")});e.ui.componentFactory.add(O,(()=>i(a._))),e.ui.componentFactory.add("menuBar:"+O,(()=>i(a.kS)))}}class F extends n.k_{static get requires(){return[M,L]}static get pluginName(){return"Superscript"}}const N="underline";class D extends n.k_{static get pluginName(){return"UnderlineEditing"}init(){const e=this.editor,t=this.editor.t;e.model.schema.extend("$text",{allowAttributes:N}),e.model.schema.setAttributeProperties(N,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:N,view:"u",upcastAlso:{styles:{"text-decoration":"underline"}}}),e.commands.add(N,new o(e,N)),e.keystrokes.set("CTRL+U","underline"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Underline text"),keystroke:"CTRL+U"}]})}}const z="underline";class W extends n.k_{static get pluginName(){return"UnderlineUI"}init(){const e=this.editor,t=e.locale.t,i=l({editor:e,commandName:z,plugin:this,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 18v-1.5h14V18zm2.2-8V3.6c0-.4.4-.6.8-.6.3 0 .7.2.7.6v6.2c0 2 1.3 2.8 3.2 2.8 1.9 0 3.4-.9 3.4-2.9V3.6c0-.3.4-.5.8-.5.3 0 .7.2.7.5V10c0 2.7-2.2 4-4.9 4-2.6 0-4.7-1.2-4.7-4z"/></svg>',label:t("Underline"),keystroke:"CTRL+U"});e.ui.componentFactory.add(z,(()=>i(a._))),e.ui.componentFactory.add("menuBar:"+z,(()=>i(a.kS)))}}class H extends n.k_{static get requires(){return[D,W]}static get pluginName(){return"Underline"}}},8839:(e,t,i)=>{"use strict";i.r(t),i.d(t,{BlockQuote:()=>g,BlockQuoteEditing:()=>u,BlockQuoteUI:()=>m});var n=i(1204),o=i(6449),s=i(7211),r=i(5318);class a extends n.uB{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,i=t.schema,n=t.document.selection,o=Array.from(n.getSelectedBlocks()),s=void 0===e.forceValue?!this.value:e.forceValue;t.change((e=>{if(s){const t=o.filter((e=>l(e)||d(i,e)));this._applyQuote(e,t)}else this._removeQuote(e,o.filter(l))}))}_getValue(){const e=this.editor.model.document.selection,t=(0,r.$1)(e.getSelectedBlocks());return!(!t||!l(t))}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,i=(0,r.$1)(e.getSelectedBlocks());return!!i&&d(t,i)}_removeQuote(e,t){c(e,t).reverse().forEach((t=>{if(t.start.isAtStart&&t.end.isAtEnd)return void e.unwrap(t.start.parent);if(t.start.isAtStart){const i=e.createPositionBefore(t.start.parent);return void e.move(t,i)}t.end.isAtEnd||e.split(t.end);const i=e.createPositionAfter(t.end.parent);e.move(t,i)}))}_applyQuote(e,t){const i=[];c(e,t).reverse().forEach((t=>{let n=l(t.start);n||(n=e.createElement("blockQuote"),e.wrap(t,n)),i.push(n)})),i.reverse().reduce(((t,i)=>t.nextSibling==i?(e.merge(e.createPositionAfter(t)),t):i))}}function l(e){return"blockQuote"==e.parent.name?e.parent:null}function c(e,t){let i,n=0;const o=[];for(;n<t.length;){const s=t[n],r=t[n+1];i||(i=e.createPositionBefore(s)),r&&s.nextSibling==r||(o.push(e.createRange(i,e.createPositionAfter(s))),i=null),n++}return o}function d(e,t){const i=e.checkChild(t.parent,"blockQuote"),n=e.checkChild(["$root","blockQuote"],t);return i&&n}class u extends n.k_{static get pluginName(){return"BlockQuoteEditing"}static get requires(){return[o.x,s.ep]}init(){const e=this.editor,t=e.model.schema;e.commands.add("blockQuote",new a(e)),t.register("blockQuote",{inheritAllFrom:"$container"}),e.conversion.elementToElement({model:"blockQuote",view:"blockquote"}),e.model.document.registerPostFixer((i=>{const n=e.model.document.differ.getChanges();for(const e of n)if("insert"==e.type){const n=e.position.nodeAfter;if(!n)continue;if(n.is("element","blockQuote")&&n.isEmpty)return i.remove(n),!0;if(n.is("element","blockQuote")&&!t.checkChild(e.position,n))return i.unwrap(n),!0;if(n.is("element")){const e=i.createRangeIn(n);for(const n of e.getItems())if(n.is("element","blockQuote")&&!t.checkChild(i.createPositionBefore(n),n))return i.unwrap(n),!0}}else if("remove"==e.type){const t=e.position.parent;if(t.is("element","blockQuote")&&t.isEmpty)return i.remove(t),!0}return!1}));const i=this.editor.editing.view.document,n=e.model.document.selection,o=e.commands.get("blockQuote");this.listenTo(i,"enter",((t,i)=>{n.isCollapsed&&o.value&&n.getLastPosition().parent.isEmpty&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),i.preventDefault(),t.stop())}),{context:"blockquote"}),this.listenTo(i,"delete",((t,i)=>{if("backward"!=i.direction||!n.isCollapsed||!o.value)return;const s=n.getLastPosition().parent;s.isEmpty&&!s.previousSibling&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),i.preventDefault(),t.stop())}),{context:"blockquote"})}}var h=i(949);class m extends n.k_{static get pluginName(){return"BlockQuoteUI"}init(){const e=this.editor;e.ui.componentFactory.add("blockQuote",(()=>{const e=this._createButton(h._);return e.set({tooltip:!0}),e})),e.ui.componentFactory.add("menuBar:blockQuote",(()=>{const e=this._createButton(h.kS);return e.set({role:"menuitemcheckbox"}),e}))}_createButton(e){const t=this.editor,i=t.locale,o=t.commands.get("blockQuote"),s=new e(t.locale),r=i.t;return s.set({label:r("Block quote"),icon:n.Pt.quote,isToggleable:!0}),s.bind("isEnabled").to(o,"isEnabled"),s.bind("isOn").to(o,"value"),this.listenTo(s,"execute",(()=>{t.execute("blockQuote"),t.editing.view.focus()})),s}}class g extends n.k_{static get requires(){return[u,m]}static get pluginName(){return"BlockQuote"}}},6034:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Clipboard:()=>R,ClipboardMarkersUtils:()=>m,ClipboardPipeline:()=>g,DragDrop:()=>T,DragDropBlockToolbar:()=>x,DragDropTarget:()=>_,PastePlainText:()=>V});var n=i(1024),o=i(7906),s=i(151);class r extends s.DomEventObserver{constructor(e){super(e),this.domEventType=["paste","copy","cut","drop","dragover","dragstart","dragend","dragenter","dragleave"];const t=this.document;function i(e){return(i,n)=>{n.preventDefault();const s=n.dropRange?[n.dropRange]:null,r=new o.EventInfo(t,e);t.fire(r,{dataTransfer:n.dataTransfer,method:i.name,targetRanges:s,target:n.target,domEvent:n.domEvent}),r.stop.called&&n.stopPropagation()}}this.listenTo(t,"paste",i("clipboardInput"),{priority:"low"}),this.listenTo(t,"drop",i("clipboardInput"),{priority:"low"}),this.listenTo(t,"dragover",i("dragging"),{priority:"low"})}onDomEvent(e){const t="clipboardData"in e?e.clipboardData:e.dataTransfer,i="drop"==e.type||"paste"==e.type,n={dataTransfer:new s.DataTransfer(t,{cacheFiles:i})};"drop"!=e.type&&"dragover"!=e.type||(n.dropRange=function(e,t){const i=t.target.ownerDocument,n=t.clientX,o=t.clientY;let s;return i.caretRangeFromPoint&&i.caretRangeFromPoint(n,o)?s=i.caretRangeFromPoint(n,o):t.rangeParent&&(s=i.createRange(),s.setStart(t.rangeParent,t.rangeOffset),s.collapse(!0)),s?e.domConverter.domRangeToView(s):null}(this.view,e)),this.fire(e.type,e,n)}}const a=["figcaption","li"],l=["ol","ul"];function c(e){if(e.is("$text")||e.is("$textProxy"))return e.data;if(e.is("element","img")&&e.hasAttribute("alt"))return e.getAttribute("alt");if(e.is("element","br"))return"\n";let t="",i=null;for(const s of e.getChildren())t+=(n=s,((o=i)?n.is("element","li")&&!n.isEmpty&&n.getChild(0).is("containerElement")||l.includes(n.name)&&l.includes(o.name)?"\n\n":n.is("containerElement")||o.is("containerElement")?a.includes(n.name)||a.includes(o.name)?"\n":n.is("element")&&n.getCustomProperty("dataPipeline:transparentRendering")||o.is("element")&&o.getCustomProperty("dataPipeline:transparentRendering")?"":"\n\n":"":"")+c(s)),i=s;var n,o;return t}var d=i(2528),u=i(9841),h=i(5396);class m extends n.Plugin{constructor(){super(...arguments),this._markersToCopy=new Map}static get pluginName(){return"ClipboardMarkersUtils"}_registerMarkerToCopy(e,t){this._markersToCopy.set(e,t)}_copySelectedFragmentWithMarkers(e,t,i=(e=>e.model.getSelectedContent(e.model.document.selection))){return this.editor.model.change((n=>{const o=n.model.document.selection;n.setSelection(t);const s=this._insertFakeMarkersIntoSelection(n,n.model.document.selection,e),r=i(n),a=this._removeFakeMarkersInsideElement(n,r);for(const[e,t]of Object.entries(s)){a[e]||(a[e]=n.createRangeIn(r));for(const e of t)n.remove(e)}r.markers.clear();for(const[e,t]of Object.entries(a))r.markers.set(e,t);return n.setSelection(o),r}))}_pasteMarkersIntoTransformedElement(e,t){const i=this._getPasteMarkersFromRangeMap(e);return this.editor.model.change((e=>{const n=this._insertFakeMarkersElements(e,i),o=t(e),s=this._removeFakeMarkersInsideElement(e,o);for(const t of Object.values(n).flat())e.remove(t);for(const[t,i]of Object.entries(s))e.model.markers.has(t)||e.addMarker(t,{usingOperation:!0,affectsData:!0,range:i});return o}))}_pasteFragmentWithMarkers(e){const t=this._getPasteMarkersFromRangeMap(e.markers);e.markers.clear();for(const i of t)e.markers.set(i.name,i.range);return this.editor.model.insertContent(e)}_forceMarkersCopy(e,t,i={allowedActions:"all",copyPartiallySelected:!0,duplicateOnPaste:!0}){const n=this._markersToCopy.get(e);this._markersToCopy.set(e,i),t(),n?this._markersToCopy.set(e,n):this._markersToCopy.delete(e)}_isMarkerCopyable(e,t){const i=this._getMarkerClipboardConfig(e);if(!i)return!1;if(!t)return!0;const{allowedActions:n}=i;return"all"===n||n.includes(t)}_hasMarkerConfiguration(e){return!!this._getMarkerClipboardConfig(e)}_getMarkerClipboardConfig(e){const[t]=e.split(":");return this._markersToCopy.get(t)||null}_insertFakeMarkersIntoSelection(e,t,i){const n=this._getCopyableMarkersFromSelection(e,t,i);return this._insertFakeMarkersElements(e,n)}_getCopyableMarkersFromSelection(e,t,i){const n=Array.from(t.getRanges()),o=new Set(n.flatMap((t=>Array.from(e.model.markers.getMarkersIntersectingRange(t)))));return Array.from(o).filter((e=>{if(!this._isMarkerCopyable(e.name,i))return!1;const{copyPartiallySelected:t}=this._getMarkerClipboardConfig(e.name);if(!t){const t=e.getRange();return n.some((e=>e.containsRange(t,!0)))}return!0})).map((e=>({name:"dragstart"===i?this._getUniqueMarkerName(e.name):e.name,range:e.getRange()})))}_getPasteMarkersFromRangeMap(e,t=null){const{model:i}=this.editor;return(e instanceof Map?Array.from(e.entries()):Object.entries(e)).flatMap((([e,n])=>{if(!this._hasMarkerConfiguration(e))return[{name:e,range:n}];if(this._isMarkerCopyable(e,t)){const t=this._getMarkerClipboardConfig(e),o=i.markers.has(e)&&"$graveyard"===i.markers.get(e).getRange().root.rootName;return(t.duplicateOnPaste||o)&&(e=this._getUniqueMarkerName(e)),[{name:e,range:n}]}return[]}))}_insertFakeMarkersElements(e,t){const i={},n=t.flatMap((e=>{const{start:t,end:i}=e.range;return[{position:t,marker:e,type:"start"},{position:i,marker:e,type:"end"}]})).sort((({position:e},{position:t})=>e.isBefore(t)?1:-1));for(const{position:t,marker:o,type:s}of n){const n=e.createElement("$marker",{"data-name":o.name,"data-type":s});i[o.name]||(i[o.name]=[]),i[o.name].push(n),e.insert(n,t)}return i}_removeFakeMarkersInsideElement(e,t){const i=this._getAllFakeMarkersFromElement(e,t).reduce(((t,i)=>{const n=i.markerElement&&e.createPositionBefore(i.markerElement);let o=t[i.name],s=!1;return o&&o.start&&o.end&&(this._getMarkerClipboardConfig(i.name).duplicateOnPaste?t[this._getUniqueMarkerName(i.name)]=t[i.name]:s=!0,o=null),s||(t[i.name]={...o,[i.type]:n}),i.markerElement&&e.remove(i.markerElement),t}),{});return n=i,o=i=>new s.Range(i.start||e.createPositionFromPath(t,[0]),i.end||e.createPositionAt(t,"end")),r={},o=(0,h.A)(o,3),(0,u.A)(n,(function(e,t,i){(0,d.A)(r,t,o(e,t,i))})),r;var n,o,r}_getAllFakeMarkersFromElement(e,t){const i=Array.from(e.createRangeIn(t)).flatMap((({item:e})=>{if(!e.is("element","$marker"))return[];const t=e.getAttribute("data-name"),i=e.getAttribute("data-type");return[{markerElement:e,name:t,type:i}]})),n=[],o=[];for(const e of i)"end"===e.type&&(i.some((t=>t.name===e.name&&"start"===t.type))||n.push({markerElement:null,name:e.name,type:"start"})),"start"===e.type&&(i.some((t=>t.name===e.name&&"end"===t.type))||o.unshift({markerElement:null,name:e.name,type:"end"}));return[...n,...i,...o]}_getUniqueMarkerName(e){const t=e.split(":"),i=(0,o.uid)().substring(1,6);return 3===t.length?`${t.slice(0,2).join(":")}:${i}`:`${t.join(":")}:${i}`}}class g extends n.Plugin{static get pluginName(){return"ClipboardPipeline"}static get requires(){return[m]}init(){this.editor.editing.view.addObserver(r),this._setupPasteDrop(),this._setupCopyCut()}_fireOutputTransformationEvent(e,t,i){const n=this.editor.plugins.get("ClipboardMarkersUtils");this.editor.model.enqueueChange({isUndoable:"cut"===i},(()=>{const o=n._copySelectedFragmentWithMarkers(i,t);this.fire("outputTransformation",{dataTransfer:e,content:o,method:i})}))}_setupPasteDrop(){const e=this.editor,t=e.model,i=e.editing.view,n=i.document,s=this.editor.plugins.get("ClipboardMarkersUtils");this.listenTo(n,"clipboardInput",((t,i)=>{"paste"!=i.method||e.model.canEditAt(e.model.document.selection)||t.stop()}),{priority:"highest"}),this.listenTo(n,"clipboardInput",((e,t)=>{const n=t.dataTransfer;let s;if(t.content)s=t.content;else{let e="";n.getData("text/html")?e=function(e){return e.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,((e,t)=>1==t.length?" ":t)).replace(/<!--[\s\S]*?-->/g,"")}(n.getData("text/html")):n.getData("text/plain")&&(((r=(r=n.getData("text/plain")).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r?\n\r?\n/g,"</p><p>").replace(/\r?\n/g,"<br>").replace(/\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;").replace(/^\s/,"&nbsp;").replace(/\s$/,"&nbsp;").replace(/\s\s/g," &nbsp;")).includes("</p><p>")||r.includes("<br>"))&&(r=`<p>${r}</p>`),e=r),s=this.editor.data.htmlProcessor.toView(e)}var r;const a=new o.EventInfo(this,"inputTransformation");this.fire(a,{content:s,dataTransfer:n,targetRanges:t.targetRanges,method:t.method}),a.stop.called&&e.stop(),i.scrollToTheSelection()}),{priority:"low"}),this.listenTo(this,"inputTransformation",((e,i)=>{if(i.content.isEmpty)return;const n=this.editor.data.toModel(i.content,"$clipboardHolder");0!=n.childCount&&(e.stop(),t.change((()=>{this.fire("contentInsertion",{content:n,method:i.method,dataTransfer:i.dataTransfer,targetRanges:i.targetRanges})})))}),{priority:"low"}),this.listenTo(this,"contentInsertion",((e,t)=>{t.resultRange=s._pasteFragmentWithMarkers(t.content)}),{priority:"low"})}_setupCopyCut(){const e=this.editor,t=e.model.document,i=e.editing.view.document,n=(e,i)=>{const n=i.dataTransfer;i.preventDefault(),this._fireOutputTransformationEvent(n,t.selection,e.name)};this.listenTo(i,"copy",n,{priority:"low"}),this.listenTo(i,"cut",((t,i)=>{e.model.canEditAt(e.model.document.selection)?n(t,i):i.preventDefault()}),{priority:"low"}),this.listenTo(this,"outputTransformation",((t,n)=>{const o=e.data.toView(n.content);i.fire("clipboardOutput",{dataTransfer:n.dataTransfer,content:o,method:n.method})}),{priority:"low"}),this.listenTo(i,"clipboardOutput",((i,n)=>{n.content.isEmpty||(n.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(n.content)),n.dataTransfer.setData("text/plain",c(n.content))),"cut"==n.method&&e.model.deleteContent(t.selection)}),{priority:"low"})}}var f=i(3906),p=i(7243);const b=(0,o.toUnit)("px");class w extends p.View{constructor(){super();const e=this.bindTemplate;this.set({isVisible:!1,left:null,top:null,width:null}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-clipboard-drop-target-line",e.if("isVisible","ck-hidden",(e=>!e))],style:{left:e.to("left",(e=>b(e))),top:e.to("top",(e=>b(e))),width:e.to("width",(e=>b(e)))}}})}}var v=i(4022);class _ extends n.Plugin{constructor(){super(...arguments),this.removeDropMarkerDelayed=(0,o.delay)((()=>this.removeDropMarker()),40),this._updateDropMarkerThrottled=(0,v.A)((e=>this._updateDropMarker(e)),40),this._reconvertMarkerThrottled=(0,v.A)((()=>{this.editor.model.markers.has("drop-target")&&this.editor.editing.reconvertMarker("drop-target")}),0),this._dropTargetLineView=new w,this._domEmitter=new((0,o.DomEmitterMixin)()),this._scrollables=new Map}static get pluginName(){return"DragDropTarget"}init(){this._setupDropMarker()}destroy(){this._domEmitter.stopListening();for(const{resizeObserver:e}of this._scrollables.values())e.destroy();return this._updateDropMarkerThrottled.cancel(),this.removeDropMarkerDelayed.cancel(),this._reconvertMarkerThrottled.cancel(),super.destroy()}updateDropMarker(e,t,i,n,o,s){this.removeDropMarkerDelayed.cancel();const r=y(this.editor,e,t,i,n,o,s);if(r)return s&&s.containsRange(r)?this.removeDropMarker():void this._updateDropMarkerThrottled(r)}getFinalDropRange(e,t,i,n,o,s){const r=y(this.editor,e,t,i,n,o,s);return this.removeDropMarker(),r}removeDropMarker(){const e=this.editor.model;this.removeDropMarkerDelayed.cancel(),this._updateDropMarkerThrottled.cancel(),this._dropTargetLineView.isVisible=!1,e.markers.has("drop-target")&&e.change((e=>{e.removeMarker("drop-target")}))}_setupDropMarker(){const e=this.editor;e.ui.view.body.add(this._dropTargetLineView),e.conversion.for("editingDowncast").markerToHighlight({model:"drop-target",view:{classes:["ck-clipboard-drop-target-range"]}}),e.conversion.for("editingDowncast").markerToElement({model:"drop-target",view:(t,{writer:i})=>{if(e.model.schema.checkChild(t.markerRange.start,"$text"))return this._dropTargetLineView.isVisible=!1,this._createDropTargetPosition(i);t.markerRange.isCollapsed?this._updateDropTargetLine(t.markerRange):this._dropTargetLineView.isVisible=!1}})}_updateDropMarker(e){const t=this.editor,i=t.model.markers;t.model.change((t=>{i.has("drop-target")?i.get("drop-target").getRange().isEqual(e)||t.updateMarker("drop-target",{range:e}):t.addMarker("drop-target",{range:e,usingOperation:!1,affectsData:!1})}))}_createDropTargetPosition(e){return e.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},(function(e){const t=this.toDomElement(e);return t.append("⁠",e.createElement("span"),"⁠"),t}))}_updateDropTargetLine(e){const t=this.editor.editing,i=e.start.nodeBefore,n=e.start.nodeAfter,s=e.start.parent,r=i?t.mapper.toViewElement(i):null,a=r?t.view.domConverter.mapViewToDom(r):null,l=n?t.mapper.toViewElement(n):null,c=l?t.view.domConverter.mapViewToDom(l):null,d=t.mapper.toViewElement(s);if(!d)return;const u=t.view.domConverter.mapViewToDom(d),h=this._getScrollableRect(d),{scrollX:m,scrollY:g}=o.global.window,f=a?new o.Rect(a):null,p=c?new o.Rect(c):null,b=new o.Rect(u).excludeScrollbarsAndBorders(),w=f?f.bottom:b.top,v=p?p.top:b.bottom,_=o.global.window.getComputedStyle(u),y=w<=v?(w+v)/2:v;if(h.top<y&&y<h.bottom){const e=b.left+parseFloat(_.paddingLeft),t=b.right-parseFloat(_.paddingRight),i=Math.max(e+m,h.left),n=Math.min(t+m,h.right);this._dropTargetLineView.set({isVisible:!0,left:i,top:y+g,width:n-i})}else this._dropTargetLineView.isVisible=!1}_getScrollableRect(e){const t=e.root.rootName;let i;if(this._scrollables.has(t))i=this._scrollables.get(t).domElement;else{i=function(e){let t=e;do{t=t.parentElement;const e=o.global.window.getComputedStyle(t).overflowY;if("auto"==e||"scroll"==e)break}while("BODY"!=t.tagName);return t}(this.editor.editing.view.domConverter.mapViewToDom(e)),this._domEmitter.listenTo(i,"scroll",this._reconvertMarkerThrottled,{usePassive:!0});const n=new o.ResizeObserver(i,this._reconvertMarkerThrottled);this._scrollables.set(t,{domElement:i,resizeObserver:n})}return new o.Rect(i).excludeScrollbarsAndBorders()}}function y(e,t,i,n,o,s,r){const a=e.model,l=e.editing.mapper;let c=E(e,t);for(;c;){if(!s)if(a.schema.checkChild(c,"$text")){if(i){const t=i[0].start,s=l.toModelPosition(t);if(!r||Array.from(r.getItems()).every((e=>a.schema.checkChild(s,e)))){if(a.schema.checkChild(s,"$text"))return a.createRange(s);if(t)return C(e,E(e,t.parent),n,o)}}}else if(a.schema.isInline(c))return C(e,c,n,o);if(a.schema.isBlock(c))return C(e,c,n,o);if(a.schema.checkChild(c,"$block")){const t=Array.from(c.getChildren()).filter((t=>t.is("element")&&!k(e,t)));let i=0,s=t.length;if(0==s)return a.createRange(a.createPositionAt(c,"end"));for(;i<s-1;){const r=Math.floor((i+s)/2);"before"==A(e,t[r],n,o)?s=r:i=r}return C(e,t[i],n,o)}c=c.parent}return null}function k(e,t){const i=e.editing.mapper,n=e.editing.view.domConverter,s=i.toViewElement(t);if(!s)return!0;const r=n.mapViewToDom(s);return"none"!=o.global.window.getComputedStyle(r).float}function C(e,t,i,n){const o=e.model;return o.createRange(o.createPositionAt(t,A(e,t,i,n)))}function A(e,t,i,n){const s=e.editing.mapper,r=e.editing.view.domConverter,a=s.toViewElement(t),l=r.mapViewToDom(a),c=new o.Rect(l);return e.model.schema.isInline(t)?i<(c.left+c.right)/2?"before":"after":n<(c.top+c.bottom)/2?"before":"after"}function E(e,t){const i=e.editing.mapper,n=e.editing.view,o=i.toModelElement(t);if(o)return o;const s=n.createPositionBefore(t),r=i.findMappedViewAncestor(s);return i.toModelElement(r)}class x extends n.Plugin{constructor(){super(...arguments),this._isBlockDragging=!1,this._domEmitter=new((0,o.DomEmitterMixin)())}static get pluginName(){return"DragDropBlockToolbar"}init(){const e=this.editor;if(this.listenTo(e,"change:isReadOnly",((e,t,i)=>{i?(this.forceDisabled("readOnlyMode"),this._isBlockDragging=!1):this.clearForceDisabled("readOnlyMode")})),o.env.isAndroid&&this.forceDisabled("noAndroidSupport"),e.plugins.has("BlockToolbar")){const t=e.plugins.get("BlockToolbar").buttonView.element;this._domEmitter.listenTo(t,"dragstart",((e,t)=>this._handleBlockDragStart(t))),this._domEmitter.listenTo(o.global.document,"dragover",((e,t)=>this._handleBlockDragging(t))),this._domEmitter.listenTo(o.global.document,"drop",((e,t)=>this._handleBlockDragging(t))),this._domEmitter.listenTo(o.global.document,"dragend",(()=>this._handleBlockDragEnd()),{useCapture:!0}),this.isEnabled&&t.setAttribute("draggable","true"),this.on("change:isEnabled",((e,i,n)=>{t.setAttribute("draggable",n?"true":"false")}))}}destroy(){return this._domEmitter.stopListening(),super.destroy()}_handleBlockDragStart(e){if(!this.isEnabled)return;const t=this.editor.model,i=t.document.selection,n=this.editor.editing.view,o=Array.from(i.getSelectedBlocks()),s=t.createRange(t.createPositionBefore(o[0]),t.createPositionAfter(o[o.length-1]));t.change((e=>e.setSelection(s))),this._isBlockDragging=!0,n.focus(),n.getObserver(r).onDomEvent(e)}_handleBlockDragging(e){if(!this.isEnabled||!this._isBlockDragging)return;const t=e.clientX+("ltr"==this.editor.locale.contentLanguageDirection?100:-100),i=e.clientY,n=document.elementFromPoint(t,i),o=this.editor.editing.view;n&&n.closest(".ck-editor__editable")&&o.getObserver(r).onDomEvent({...e,type:e.type,dataTransfer:e.dataTransfer,target:n,clientX:t,clientY:i,preventDefault:()=>e.preventDefault(),stopPropagation:()=>e.stopPropagation()})}_handleBlockDragEnd(){this._isBlockDragging=!1}}class T extends n.Plugin{constructor(){super(...arguments),this._clearDraggableAttributesDelayed=(0,o.delay)((()=>this._clearDraggableAttributes()),40),this._blockMode=!1,this._domEmitter=new((0,o.DomEmitterMixin)())}static get pluginName(){return"DragDrop"}static get requires(){return[g,f.Widget,_,x]}init(){const e=this.editor,t=e.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,t.addObserver(r),t.addObserver(s.MouseObserver),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDraggableAttributeHandling(),this.listenTo(e,"change:isReadOnly",((e,t,i)=>{i?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")})),this.on("change:isEnabled",((e,t,i)=>{i||this._finalizeDragging(!1)})),o.env.isAndroid&&this.forceDisabled("noAndroidSupport")}destroy(){return this._draggedRange&&(this._draggedRange.detach(),this._draggedRange=null),this._previewContainer&&this._previewContainer.remove(),this._domEmitter.stopListening(),this._clearDraggableAttributesDelayed.cancel(),super.destroy()}_setupDragging(){const e=this.editor,t=e.model,i=e.editing.view,n=i.document,s=e.plugins.get(_);this.listenTo(n,"dragstart",((e,i)=>{if(i.target&&i.target.is("editableElement"))return void i.preventDefault();if(this._prepareDraggedRange(i.target),!this._draggedRange)return void i.preventDefault();this._draggingUid=(0,o.uid)(),i.dataTransfer.effectAllowed=this.isEnabled?"copyMove":"copy",i.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const n=t.createSelection(this._draggedRange.toRange());this.editor.plugins.get("ClipboardPipeline")._fireOutputTransformationEvent(i.dataTransfer,n,"dragstart");const{dataTransfer:s,domTarget:r,domEvent:a}=i,{clientX:l}=a;this._updatePreview({dataTransfer:s,domTarget:r,clientX:l}),i.stopPropagation(),this.isEnabled||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")}),{priority:"low"}),this.listenTo(n,"dragend",((e,t)=>{this._finalizeDragging(!t.dataTransfer.isCanceled&&"move"==t.dataTransfer.dropEffect)}),{priority:"low"}),this._domEmitter.listenTo(o.global.document,"dragend",(()=>{this._blockMode=!1}),{useCapture:!0}),this.listenTo(n,"dragenter",(()=>{this.isEnabled&&i.focus()})),this.listenTo(n,"dragleave",(()=>{s.removeDropMarkerDelayed()})),this.listenTo(n,"dragging",((e,t)=>{if(!this.isEnabled)return void(t.dataTransfer.dropEffect="none");const{clientX:i,clientY:n}=t.domEvent;s.updateDropMarker(t.target,t.targetRanges,i,n,this._blockMode,this._draggedRange),this._draggedRange||(t.dataTransfer.dropEffect="copy"),o.env.isGecko||("copy"==t.dataTransfer.effectAllowed?t.dataTransfer.dropEffect="copy":["all","copyMove"].includes(t.dataTransfer.effectAllowed)&&(t.dataTransfer.dropEffect="move")),e.stop()}),{priority:"low"})}_setupClipboardInputIntegration(){const e=this.editor,t=e.editing.view.document,i=e.plugins.get(_);this.listenTo(t,"clipboardInput",((t,n)=>{if("drop"!=n.method)return;const{clientX:o,clientY:s}=n.domEvent,r=i.getFinalDropRange(n.target,n.targetRanges,o,s,this._blockMode,this._draggedRange);return r?(this._draggedRange&&this._draggingUid!=n.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid=""),"move"==P(n.dataTransfer)&&this._draggedRange&&this._draggedRange.containsRange(r,!0)?(this._finalizeDragging(!1),void t.stop()):void(n.targetRanges=[e.editing.mapper.toViewRange(r)])):(this._finalizeDragging(!1),void t.stop())}),{priority:"high"})}_setupContentInsertionIntegration(){const e=this.editor.plugins.get(g);e.on("contentInsertion",((e,t)=>{if(!this.isEnabled||"drop"!==t.method)return;const i=t.targetRanges.map((e=>this.editor.editing.mapper.toModelRange(e)));this.editor.model.change((e=>e.setSelection(i)))}),{priority:"high"}),e.on("contentInsertion",((e,t)=>{if(!this.isEnabled||"drop"!==t.method)return;const i="move"==P(t.dataTransfer),n=!t.resultRange||!t.resultRange.isCollapsed;this._finalizeDragging(n&&i)}),{priority:"lowest"})}_setupDraggableAttributeHandling(){const e=this.editor,t=e.editing.view,i=t.document;this.listenTo(i,"mousedown",((n,s)=>{if(o.env.isAndroid||!s)return;this._clearDraggableAttributesDelayed.cancel();let r=I(s.target);if(o.env.isBlink&&!e.isReadOnly&&!r&&!i.selection.isCollapsed){const e=i.selection.getSelectedElement();e&&(0,f.isWidget)(e)||(r=i.selection.editableElement)}r&&(t.change((e=>{e.setAttribute("draggable","true",r)})),this._draggableElement=e.editing.mapper.toModelElement(r))})),this.listenTo(i,"mouseup",(()=>{o.env.isAndroid||this._clearDraggableAttributesDelayed()}))}_clearDraggableAttributes(){const e=this.editor.editing;e.view.change((t=>{this._draggableElement&&"$graveyard"!=this._draggableElement.root.rootName&&t.removeAttribute("draggable",e.mapper.toViewElement(this._draggableElement)),this._draggableElement=null}))}_finalizeDragging(e){const t=this.editor,i=t.model;t.plugins.get(_).removeDropMarker(),this._clearDraggableAttributes(),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._previewContainer&&(this._previewContainer.remove(),this._previewContainer=void 0),this._draggedRange&&(e&&this.isEnabled&&i.change((e=>{const t=i.createSelection(this._draggedRange);i.deleteContent(t,{doNotAutoparagraph:!0});const n=t.getFirstPosition().parent;n.isEmpty&&!i.schema.checkChild(n,"$text")&&i.schema.checkChild(n,"paragraph")&&e.insertElement("paragraph",n,0)})),this._draggedRange.detach(),this._draggedRange=null)}_prepareDraggedRange(e){const t=this.editor,i=t.model,n=i.document.selection,o=e?I(e):null;if(o){const e=t.editing.mapper.toModelElement(o);return this._draggedRange=s.LiveRange.fromRange(i.createRangeOn(e)),this._blockMode=i.schema.isBlock(e),void(t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop"))}if(n.isCollapsed&&!n.getFirstPosition().parent.isEmpty)return;const r=Array.from(n.getSelectedBlocks()),a=n.getFirstRange();if(0==r.length)return void(this._draggedRange=s.LiveRange.fromRange(a));const l=S(i,r);if(r.length>1)this._draggedRange=s.LiveRange.fromRange(l),this._blockMode=!0;else if(1==r.length){const e=a.start.isTouching(l.start)&&a.end.isTouching(l.end);this._draggedRange=s.LiveRange.fromRange(e?l:a),this._blockMode=e}i.change((e=>e.setSelection(this._draggedRange.toRange())))}_updatePreview({dataTransfer:e,domTarget:t,clientX:i}){const n=this.editor.editing.view,s=n.document.selection.editableElement,r=n.domConverter.mapViewToDom(s),a=o.global.window.getComputedStyle(r);this._previewContainer?this._previewContainer.firstElementChild&&this._previewContainer.removeChild(this._previewContainer.firstElementChild):(this._previewContainer=(0,o.createElement)(o.global.document,"div",{style:"position: fixed; left: -999999px;"}),o.global.document.body.appendChild(this._previewContainer));const l=new o.Rect(r);if(r.contains(t))return;const c=parseFloat(a.paddingLeft),d=(0,o.createElement)(o.global.document,"div");d.className="ck ck-content",d.style.width=a.width,d.style.paddingLeft=`${l.left-i+c}px`,o.env.isiOS&&(d.style.backgroundColor="white"),d.innerHTML=e.getData("text/html"),e.setDragImage(d,0,0),this._previewContainer.appendChild(d)}}function P(e){return o.env.isGecko?e.dropEffect:["all","copyMove"].includes(e.effectAllowed)?"move":"copy"}function I(e){if(e.is("editableElement"))return null;if(e.hasClass("ck-widget__selection-handle"))return e.findAncestor(f.isWidget);if((0,f.isWidget)(e))return e;const t=e.findAncestor((e=>(0,f.isWidget)(e)||e.is("editableElement")));return(0,f.isWidget)(t)?t:null}function S(e,t){const i=t[0],n=t[t.length-1],o=i.getCommonAncestor(n),s=e.createPositionBefore(i),r=e.createPositionAfter(n);if(o&&o.is("element")&&!e.schema.isLimit(o)){const t=e.createRangeOn(o),i=s.isTouching(t.start),n=r.isTouching(t.end);if(i&&n)return S(e,[o])}return e.createRange(s,r)}class V extends n.Plugin{static get pluginName(){return"PastePlainText"}static get requires(){return[g]}init(){const e=this.editor,t=e.model,i=e.editing.view,n=t.document.selection;i.addObserver(r),e.plugins.get(g).on("contentInsertion",((e,i)=>{(function(e,t){let i=t.createRangeIn(e);if(1==e.childCount){const n=e.getChild(0);n.is("element")&&t.schema.isBlock(n)&&!t.schema.isObject(n)&&!t.schema.isLimit(n)&&(i=t.createRangeIn(n))}for(const e of i.getItems()){if(!t.schema.isInline(e))return!1;if(Array.from(e.getAttributeKeys()).find((e=>t.schema.getAttributeProperties(e).isFormatting)))return!1}return!0})(i.content,t)&&t.change((e=>{const o=Array.from(n.getAttributes()).filter((([e])=>t.schema.getAttributeProperties(e).isFormatting));n.isCollapsed||t.deleteContent(n,{doNotAutoparagraph:!0}),o.push(...n.getAttributes());const s=e.createRangeIn(i.content);for(const i of s.getItems())for(const n of o)t.schema.checkAttribute(i,n[0])&&e.setAttribute(n[0],n[1],i)}))}))}}class R extends n.Plugin{static get pluginName(){return"Clipboard"}static get requires(){return[m,g,T,V]}init(){const e=this.editor,t=this.editor.t;e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Copy selected content"),keystroke:"CTRL+C"},{label:t("Paste content"),keystroke:"CTRL+V"},{label:t("Paste content as plain text"),keystroke:"CTRL+SHIFT+V"}]})}}},1703:(e,t,i)=>{"use strict";i.r(t),i.d(t,{CodeBlock:()=>_,CodeBlockEditing:()=>f,CodeBlockUI:()=>v});var n=i(1204),o=i(6449),s=i(4133),r=i(7377),a=i(5318),l=i(2148);class c extends n.uB{constructor(e){super(e),this._lastLanguage=null}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor,i=t.model,n=i.document.selection,o=(0,l.getNormalizedAndLocalizedLanguageDefinitions)(t)[0],s=Array.from(n.getSelectedBlocks()),r=null==e.forceValue?!this.value:e.forceValue,a=function(e,t,i){return e.language?e.language:e.usePreviousLanguageChoice&&t?t:i}(e,this._lastLanguage,o.language);i.change((e=>{r?this._applyCodeBlock(e,s,a):this._removeCodeBlock(e,s)}))}_getValue(){const e=this.editor.model.document.selection,t=(0,a.$1)(e.getSelectedBlocks());return!(!t||!t.is("element","codeBlock"))&&t.getAttribute("language")}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,i=(0,a.$1)(e.getSelectedBlocks());return!!i&&(0,l.canBeCodeBlock)(t,i)}_applyCodeBlock(e,t,i){this._lastLanguage=i;const n=this.editor.model.schema,o=t.filter((e=>(0,l.canBeCodeBlock)(n,e)));for(const t of o)e.rename(t,"codeBlock"),e.setAttribute("language",i,t),n.removeDisallowedAttributes([t],e),Array.from(t.getChildren()).filter((e=>!n.checkChild(t,e))).forEach((t=>e.remove(t)));o.reverse().forEach(((t,i)=>{const n=o[i+1];t.previousSibling===n&&(e.appendElement("softBreak",n),e.merge(e.createPositionBefore(t)))}))}_removeCodeBlock(e,t){const i=t.filter((e=>e.is("element","codeBlock")));for(const t of i){const i=e.createRangeOn(t);for(const t of Array.from(i.getItems()).reverse())if(t.is("element","softBreak")&&t.parent.is("element","codeBlock")){const{position:i}=e.split(e.createPositionBefore(t)),n=i.nodeAfter;e.rename(n,"paragraph"),e.removeAttribute("language",n),e.remove(t)}e.rename(t,"paragraph"),e.removeAttribute("language",t)}}}class d extends n.uB{constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model;e.change((t=>{const i=(0,l.getIndentOutdentPositions)(e);for(const n of i){const i=t.createText(this._indentSequence);e.insertContent(i,n)}}))}_checkEnabled(){return!!this._indentSequence&&(0,l.isModelSelectionInCodeBlock)(this.editor.model.document.selection)}}class u extends n.uB{constructor(e){super(e),this._indentSequence=e.config.get("codeBlock.indentSequence")}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model;e.change((()=>{const t=(0,l.getIndentOutdentPositions)(e);for(const i of t){const t=h(e,i,this._indentSequence);t&&e.deleteContent(e.createSelection(t))}}))}_checkEnabled(){if(!this._indentSequence)return!1;const e=this.editor.model;return!!(0,l.isModelSelectionInCodeBlock)(e.document.selection)&&(0,l.getIndentOutdentPositions)(e).some((t=>h(e,t,this._indentSequence)))}}function h(e,t,i){const n=(0,l.getTextNodeAtLineStart)(t,e);if(!n)return null;const o=(0,l.getLeadingWhiteSpaces)(n),s=o.lastIndexOf(i);if(s+i.length!==o.length)return null;if(-1===s)return null;const{parent:r,startOffset:a}=n;return e.createRange(e.createPositionAt(r,a+s),e.createPositionAt(r,a+s+i.length))}function m(e,t,i=!1){const n=(0,l.getPropertyAssociation)(t,"language","class"),o=(0,l.getPropertyAssociation)(t,"language","label");return(t,s,r)=>{const{writer:a,mapper:l,consumable:c}=r;if(!c.consume(s.item,"insert"))return;const d=s.item.getAttribute("language"),u=l.toViewPosition(e.createPositionBefore(s.item)),h={};i&&(h["data-language"]=o[d],h.spellcheck="false");const m=n[d]?{class:n[d]}:void 0,g=a.createContainerElement("code",m),f=a.createContainerElement("pre",h,g);a.insert(u,f),l.bindElements(s.item,g)}}const g="paragraph";class f extends n.k_{static get pluginName(){return"CodeBlockEditing"}static get requires(){return[o.D]}constructor(e){super(e),e.config.define("codeBlock",{languages:[{language:"plaintext",label:"Plain text"},{language:"c",label:"C"},{language:"cs",label:"C#"},{language:"cpp",label:"C++"},{language:"css",label:"CSS"},{language:"diff",label:"Diff"},{language:"html",label:"HTML"},{language:"java",label:"Java"},{language:"javascript",label:"JavaScript"},{language:"php",label:"PHP"},{language:"python",label:"Python"},{language:"ruby",label:"Ruby"},{language:"typescript",label:"TypeScript"},{language:"xml",label:"XML"}],indentSequence:"\t"})}init(){const e=this.editor,t=e.model.schema,i=e.model,n=e.editing.view,o=(0,l.getNormalizedAndLocalizedLanguageDefinitions)(e);e.commands.add("codeBlock",new c(e)),e.commands.add("indentCodeBlock",new d(e)),e.commands.add("outdentCodeBlock",new u(e)),this.listenTo(n.document,"tab",((t,i)=>{const n=i.shiftKey?"outdentCodeBlock":"indentCodeBlock";e.commands.get(n).isEnabled&&(e.execute(n),i.stopPropagation(),i.preventDefault(),t.stop())}),{context:"pre"}),t.register("codeBlock",{allowWhere:"$block",allowChildren:"$text",disallowChildren:"$inlineObject",allowAttributes:["language"],allowAttributesOf:"$listItem",isBlock:!0}),t.addAttributeCheck(((e,i)=>{const n=e.getItem(e.length-2);if(t.getAttributeProperties(i).isFormatting&&n&&"codeBlock"==n.name)return!1})),e.editing.downcastDispatcher.on("insert:codeBlock",m(i,o,!0)),e.data.downcastDispatcher.on("insert:codeBlock",m(i,o)),e.data.downcastDispatcher.on("insert:softBreak",function(e){return(t,i,n)=>{if("codeBlock"!==i.item.parent.name)return;const{writer:o,mapper:s,consumable:r}=n;if(!r.consume(i.item,"insert"))return;const a=s.toViewPosition(e.createPositionBefore(i.item));o.insert(a,o.createText("\n"))}}(i),{priority:"high"}),e.data.upcastDispatcher.on("element:code",function(e,t){const i=(0,l.getPropertyAssociation)(t,"class","language"),n=t[0].language;return(e,t,o)=>{const s=t.viewItem,r=s.parent;if(!r||!r.is("element","pre"))return;if(t.modelCursor.findAncestor("codeBlock"))return;const{consumable:a,writer:l}=o;if(!a.test(s,{name:!0}))return;const c=l.createElement("codeBlock"),d=[...s.getClassNames()];d.length||d.push("");for(const e of d){const t=i[e];if(t){l.setAttribute("language",t,c);break}}c.hasAttribute("language")||l.setAttribute("language",n,c),o.convertChildren(s,c),o.safeInsert(c,t.modelCursor)&&(a.consume(s,{name:!0}),o.updateConversionResult(c,t))}}(0,o)),e.data.upcastDispatcher.on("text",((e,t,{consumable:i,writer:n})=>{let o=t.modelCursor;if(!i.test(t.viewItem))return;if(!o.findAncestor("codeBlock"))return;i.consume(t.viewItem);const s=t.viewItem.data.split("\n").map((e=>n.createText(e))),r=s[s.length-1];for(const e of s)if(n.insert(e,o),o=o.getShiftedBy(e.offsetSize),e!==r){const e=n.createElement("softBreak");n.insert(e,o),o=n.createPositionAfter(e)}t.modelRange=n.createRange(t.modelCursor,o),t.modelCursor=o})),e.data.upcastDispatcher.on("element:pre",((e,t,{consumable:i})=>{const n=t.viewItem;if(n.findAncestor("pre"))return;const o=Array.from(n.getChildren()),s=o.find((e=>e.is("element","code")));if(s)for(const e of o)e!==s&&e.is("$text")&&i.consume(e,{name:!0})}),{priority:"high"}),this.listenTo(e.editing.view.document,"clipboardInput",((t,n)=>{let o=i.createRange(i.document.selection.anchor);if(n.targetRanges&&(o=e.editing.mapper.toModelRange(n.targetRanges[0])),!o.start.parent.is("element","codeBlock"))return;const r=n.dataTransfer.getData("text/plain"),a=new s.Wq(e.editing.view.document);n.content=(0,l.rawSnippetTextToViewDocumentFragment)(a,r)})),e.plugins.has("ClipboardPipeline")&&e.plugins.get(r.xz).on("contentInsertion",((i,n)=>{const o=e.model,s=o.document.selection;s.anchor.parent.is("element","codeBlock")&&o.change((e=>{const i=e.createRangeIn(n.content);for(const n of[...i.getItems()])n.is("node")&&!t.checkChild(s.anchor,n)&&e.remove(n)}))})),this.listenTo(i,"getSelectedContent",((e,[n])=>{const o=n.anchor;!n.isCollapsed&&o.parent.is("element","codeBlock")&&o.hasSameParentAs(n.focus)&&i.change((i=>{const s=e.return;if(o.parent.is("element")&&(s.childCount>1||n.containsEntireContent(o.parent))){const t=i.createElement("codeBlock",o.parent.getAttributes());i.append(s,t);const n=i.createDocumentFragment();return i.append(t,n),void(e.return=n)}const r=s.getChild(0);t.checkAttribute(r,"code")&&i.setAttribute("code",!0,r)}))}))}afterInit(){const e=this.editor,t=e.commands,i=t.get("indent"),n=t.get("outdent");i&&i.registerChildCommand(t.get("indentCodeBlock"),{priority:"highest"}),n&&n.registerChildCommand(t.get("outdentCodeBlock")),this.listenTo(e.editing.view.document,"enter",((t,i)=>{e.model.document.selection.getLastPosition().parent.is("element","codeBlock")&&(function(e,t){const i=e.model.document,n=e.editing.view,o=i.selection.getLastPosition(),s=o.nodeAfter;return!(t||!i.selection.isCollapsed||!o.isAtStart)&&(!!b(s)&&(e.model.change((t=>{e.execute("enter");const n=i.selection.anchor.parent.previousSibling;t.rename(n,g),t.setSelection(n,"in"),e.model.schema.removeDisallowedAttributes([n],t),t.remove(s)})),n.scrollToTheSelection(),!0))}(e,i.isSoft)||function(e,t){const i=e.model,n=i.document,o=e.editing.view,s=n.selection.getLastPosition(),r=s.nodeBefore;let a;if(t||!n.selection.isCollapsed||!s.isAtEnd||!r||!r.previousSibling)return!1;if(b(r)&&b(r.previousSibling))a=i.createRange(i.createPositionBefore(r.previousSibling),i.createPositionAfter(r));else if(p(r)&&b(r.previousSibling)&&b(r.previousSibling.previousSibling))a=i.createRange(i.createPositionBefore(r.previousSibling.previousSibling),i.createPositionAfter(r));else{if(!(p(r)&&b(r.previousSibling)&&p(r.previousSibling.previousSibling)&&r.previousSibling.previousSibling&&b(r.previousSibling.previousSibling.previousSibling)))return!1;a=i.createRange(i.createPositionBefore(r.previousSibling.previousSibling.previousSibling),i.createPositionAfter(r))}return e.model.change((t=>{t.remove(a),e.execute("enter");const i=n.selection.anchor.parent;t.rename(i,g),e.model.schema.removeDisallowedAttributes([i],t)})),o.scrollToTheSelection(),!0}(e,i.isSoft)||function(e){const t=e.model,i=t.document,n=i.selection.getLastPosition();let o;const s=(0,l.getTextNodeAtLineStart)(n,t);s&&s.is("$text")&&(o=(0,l.getLeadingWhiteSpaces)(s)),e.model.change((t=>{e.execute("shiftEnter"),o&&t.insertText(o,i.selection.anchor)}))}(e),i.preventDefault(),t.stop())}),{context:"pre"}),this._initAriaAnnouncements()}_initAriaAnnouncements(){const{model:e,ui:t,t:i}=this.editor,n=(0,l.getNormalizedAndLocalizedLanguageDefinitions)(this.editor);let o=null;e.document.selection.on("change:range",(()=>{const s=e.document.selection.focus.parent;t&&o!==s&&s.is("element")&&(o&&o.is("element","codeBlock")&&t.ariaLiveAnnouncer.announce((0,l.getCodeBlockAriaAnnouncement)(i,n,o,"leave")),s.is("element","codeBlock")&&t.ariaLiveAnnouncer.announce((0,l.getCodeBlockAriaAnnouncement)(i,n,s,"enter")),o=s)}))}}function p(e){return e&&e.is("$text")&&!e.data.match(/\S/)}function b(e){return e&&e.is("element","softBreak")}var w=i(949);class v extends n.k_{static get pluginName(){return"CodeBlockUI"}init(){const e=this.editor,t=e.t,i=e.ui.componentFactory,o=(0,l.getNormalizedAndLocalizedLanguageDefinitions)(e),s=this._getLanguageListItemDefinitions(o),r=e.commands.get("codeBlock");i.add("codeBlock",(i=>{const o=(0,w.yu)(i,w.AO),a=o.buttonView,l=t("Insert code block");return a.set({label:l,tooltip:!0,icon:n.Pt.codeBlock,isToggleable:!0}),a.bind("isOn").to(r,"value",(e=>!!e)),a.on("execute",(()=>{e.execute("codeBlock",{usePreviousLanguageChoice:!0}),e.editing.view.focus()})),o.on("execute",(t=>{e.execute("codeBlock",{language:t.source._codeBlockLanguage,forceValue:!0}),e.editing.view.focus()})),o.class="ck-code-block-dropdown",o.bind("isEnabled").to(r),(0,w.O)(o,s,{role:"menu",ariaLabel:l}),o})),i.add("menuBar:codeBlock",(i=>{const o=new w.zj(i);o.buttonView.set({role:"menuitem",label:t("Code block"),icon:n.Pt.codeBlock}),o.bind("isEnabled").to(r);const a=new w.BY(i);a.set({ariaLabel:t("Insert code block")});for(const t of s){const n=new w.I8(i,o),s=new w.kS(i);s.bind(...Object.keys(t.model)).to(t.model),s.set({isToggleable:!0,role:"menuitemcheckbox"}),s.delegate("execute").to(o),s.on("execute",(()=>{e.execute("codeBlock",{language:t.model._codeBlockLanguage,forceValue:r.value!=t.model._codeBlockLanguage}),e.editing.view.focus()})),n.children.add(s),a.items.add(n)}return o.panelView.children.add(a),o}))}_getLanguageListItemDefinitions(e){const t=this.editor.commands.get("codeBlock"),i=new a.pM;for(const n of e){const e={type:"button",model:new w.Jc({_codeBlockLanguage:n.language,label:n.label,role:"menuitemradio",withText:!0})};e.model.bind("isOn").to(t,"value",(t=>t===e.model._codeBlockLanguage)),i.add(e)}return i}}class _ extends n.k_{static get requires(){return[f,v]}static get pluginName(){return"CodeBlock"}}},2148:(e,t,i)=>{"use strict";i.r(t),i.d(t,{canBeCodeBlock:()=>d,getCodeBlockAriaAnnouncement:()=>u,getIndentOutdentPositions:()=>l,getLeadingWhiteSpaces:()=>r,getNormalizedAndLocalizedLanguageDefinitions:()=>o,getPropertyAssociation:()=>s,getTextNodeAtLineStart:()=>h,isModelSelectionInCodeBlock:()=>c,rawSnippetTextToViewDocumentFragment:()=>a});var n=i(5318);function o(e){const t=e.t,i=e.config.get("codeBlock.languages");for(const e of i)"Plain text"===e.label&&(e.label=t("Plain text")),void 0===e.class&&(e.class=`language-${e.language}`);return i}function s(e,t,i){const n={};for(const o of e)"class"===t?n[o[t].split(" ").shift()]=o[i]:n[o[t]]=o[i];return n}function r(e){return e.data.match(/^(\s*)/)[0]}function a(e,t){const i=e.createDocumentFragment(),n=t.split("\n"),o=n.reduce(((t,i,o)=>(t.push(i),o<n.length-1&&t.push(e.createElement("br")),t)),[]);return e.appendChild(o,i),i}function l(e){const t=e.document.selection,i=[];if(t.isCollapsed)return[t.anchor];const n=t.getFirstRange().getWalker({ignoreElementEnd:!0,direction:"backward"});for(const{item:t}of n){let n=t.is("$textProxy")?t.textNode:t;const o=n.parent;if(!o.is("element","codeBlock")||n.is("element","softBreak"))continue;for(;n.previousSibling&&!n.previousSibling.is("element","softBreak");)n=n.previousSibling;const s=n.is("$text")?n.startOffset+r(n).length:n.startOffset,a=e.createPositionAt(o,s);i.every((e=>!e.isEqual(a)))&&i.push(a)}return i}function c(e){const t=(0,n.$1)(e.getSelectedBlocks());return!!t&&t.is("element","codeBlock")}function d(e,t){return!t.is("rootElement")&&!e.isLimit(t)&&e.checkChild(t.parent,"codeBlock")}function u(e,t,i,n){const o=s(t,"language","label"),r=i.getAttribute("language");if(r in o){return e("enter"===n?"Entering %0 code snippet":"Leaving %0 code snippet",o[r])}return e("enter"===n?"Entering code snippet":"Leaving code snippet")}function h(e,t){for(e.textNode&&(e=t.createPositionBefore(e.textNode));e.nodeBefore&&!e.nodeBefore.is("element","softBreak");)e=t.createPositionBefore(e.nodeBefore);const i=e.nodeAfter;return i&&i.is("$text")?i:null}},1024:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Command:()=>r,Context:()=>d,ContextPlugin:()=>u,DataApiMixin:()=>M,Editor:()=>V,ElementApiMixin:()=>O,MultiCommand:()=>l,PendingActions:()=>F,Plugin:()=>o,attachToForm:()=>B,icons:()=>N,secureSourceElement:()=>L});var n=i(7906);class o extends((0,n.ObservableMixin)()){constructor(e){super(),this._disableStack=new Set,this.editor=e,this.set("isEnabled",!0)}forceDisabled(e){this._disableStack.add(e),1==this._disableStack.size&&(this.on("set:isEnabled",s,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",s),this.isEnabled=!0)}destroy(){this.stopListening()}static get isContextPlugin(){return!1}}function s(e){e.return=!1,e.stop()}class r extends((0,n.ObservableMixin)()){constructor(e){super(),this.editor=e,this.set("value",void 0),this.set("isEnabled",!1),this._affectsData=!0,this._isEnabledBasedOnSelection=!0,this._disableStack=new Set,this.decorate("execute"),this.listenTo(this.editor.model.document,"change",(()=>{this.refresh()})),this.listenTo(e,"change:isReadOnly",(()=>{this.refresh()})),this.on("set:isEnabled",(t=>{if(!this.affectsData)return;const i=e.model.document.selection,n=!("$graveyard"==i.getFirstPosition().root.rootName)&&e.model.canEditAt(i);(e.isReadOnly||this._isEnabledBasedOnSelection&&!n)&&(t.return=!1,t.stop())}),{priority:"highest"}),this.on("execute",(e=>{this.isEnabled||e.stop()}),{priority:"high"})}get affectsData(){return this._affectsData}set affectsData(e){this._affectsData=e}refresh(){this.isEnabled=!0}forceDisabled(e){this._disableStack.add(e),1==this._disableStack.size&&(this.on("set:isEnabled",a,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",a),this.refresh())}execute(...e){}destroy(){this.stopListening()}}function a(e){e.return=!1,e.stop()}class l extends r{constructor(){super(...arguments),this._childCommandsDefinitions=[]}refresh(){}execute(...e){const t=this._getFirstEnabledCommand();return!!t&&t.execute(e)}registerChildCommand(e,t={}){(0,n.insertToPriorityArray)(this._childCommandsDefinitions,{command:e,priority:t.priority||"normal"}),e.on("change:isEnabled",(()=>this._checkEnabled())),this._checkEnabled()}_checkEnabled(){this.isEnabled=!!this._getFirstEnabledCommand()}_getFirstEnabledCommand(){const e=this._childCommandsDefinitions.find((({command:e})=>e.isEnabled));return e&&e.command}}class c extends((0,n.EmitterMixin)()){constructor(e,t=[],i=[]){super(),this._plugins=new Map,this._context=e,this._availablePlugins=new Map;for(const e of t)e.pluginName&&this._availablePlugins.set(e.pluginName,e);this._contextPlugins=new Map;for(const[e,t]of i)this._contextPlugins.set(e,t),this._contextPlugins.set(t,e),e.pluginName&&this._availablePlugins.set(e.pluginName,e)}*[Symbol.iterator](){for(const e of this._plugins)"function"==typeof e[0]&&(yield e)}get(e){const t=this._plugins.get(e);if(!t){let t=e;throw"function"==typeof e&&(t=e.pluginName||e.name),new n.CKEditorError("plugincollection-plugin-not-loaded",this._context,{plugin:t})}return t}has(e){return this._plugins.has(e)}init(e,t=[],i=[]){const o=this,s=this._context;!function e(t,i=new Set){t.forEach((t=>{l(t)&&(i.has(t)||(i.add(t),t.pluginName&&!o._availablePlugins.has(t.pluginName)&&o._availablePlugins.set(t.pluginName,t),t.requires&&e(t.requires,i)))}))}(e),h(e);const r=[...function e(t,i=new Set){return t.map((e=>l(e)?e:o._availablePlugins.get(e))).reduce(((t,n)=>i.has(n)?t:(i.add(n),n.requires&&(h(n.requires,n),e(n.requires,i).forEach((e=>t.add(e)))),t.add(n))),new Set)}(e.filter((e=>!d(e,t))))];!function(e,t){for(const i of t){if("function"!=typeof i)throw new n.CKEditorError("plugincollection-replace-plugin-invalid-type",null,{pluginItem:i});const t=i.pluginName;if(!t)throw new n.CKEditorError("plugincollection-replace-plugin-missing-name",null,{pluginItem:i});if(i.requires&&i.requires.length)throw new n.CKEditorError("plugincollection-plugin-for-replacing-cannot-have-dependencies",null,{pluginName:t});const s=o._availablePlugins.get(t);if(!s)throw new n.CKEditorError("plugincollection-plugin-for-replacing-not-exist",null,{pluginName:t});const r=e.indexOf(s);if(-1===r){if(o._contextPlugins.has(s))return;throw new n.CKEditorError("plugincollection-plugin-for-replacing-not-loaded",null,{pluginName:t})}if(s.requires&&s.requires.length)throw new n.CKEditorError("plugincollection-replaced-plugin-cannot-have-dependencies",null,{pluginName:t});e.splice(r,1,i),o._availablePlugins.set(t,i)}}(r,i);const a=function(e){return e.map((e=>{let t=o._contextPlugins.get(e);return t=t||new e(s),o._add(e,t),t}))}(r);return m(a,"init").then((()=>m(a,"afterInit"))).then((()=>a));function l(e){return"function"==typeof e}function c(e){return l(e)&&!!e.isContextPlugin}function d(e,t){return t.some((t=>t===e||u(e)===t||u(t)===e))}function u(e){return l(e)?e.pluginName||e.name:e}function h(e,i=null){e.map((e=>l(e)?e:o._availablePlugins.get(e)||e)).forEach((e=>{!function(e,t){if(!l(e)){if(t)throw new n.CKEditorError("plugincollection-soft-required",s,{missingPlugin:e,requiredBy:u(t)});throw new n.CKEditorError("plugincollection-plugin-not-found",s,{plugin:e})}}(e,i),function(e,t){if(c(t)&&!c(e))throw new n.CKEditorError("plugincollection-context-required",s,{plugin:u(e),requiredBy:u(t)})}(e,i),function(e,i){if(i&&d(e,t))throw new n.CKEditorError("plugincollection-required",s,{plugin:u(e),requiredBy:u(i)})}(e,i)}))}function m(e,t){return e.reduce(((e,i)=>i[t]?o._contextPlugins.has(i)?e:e.then(i[t].bind(i)):e),Promise.resolve())}}destroy(){const e=[];for(const[,t]of this)"function"!=typeof t.destroy||this._contextPlugins.has(t)||e.push(t.destroy());return Promise.all(e)}_add(e,t){this._plugins.set(e,t);const i=e.pluginName;if(i){if(this._plugins.has(i))throw new n.CKEditorError("plugincollection-plugin-name-conflict",null,{pluginName:i,plugin1:this._plugins.get(i).constructor,plugin2:e});this._plugins.set(i,t)}}}class d{constructor(e){this._contextOwner=null;const{translations:t,...i}=e||{};this.config=new n.Config(i,this.constructor.defaultConfig);const o=this.constructor.builtinPlugins;this.config.define("plugins",o),this.plugins=new c(this,o);const s=this.config.get("language")||{};this.locale=new n.Locale({uiLanguage:"string"==typeof s?s:s.ui,contentLanguage:this.config.get("language.content"),translations:t}),this.t=this.locale.t,this.editors=new n.Collection}initPlugins(){const e=this.config.get("plugins")||[],t=this.config.get("substitutePlugins")||[];for(const i of e.concat(t)){if("function"!=typeof i)throw new n.CKEditorError("context-initplugins-constructor-only",null,{Plugin:i});if(!0!==i.isContextPlugin)throw new n.CKEditorError("context-initplugins-invalid-plugin",null,{Plugin:i})}return this.plugins.init(e,[],t)}destroy(){return Promise.all(Array.from(this.editors,(e=>e.destroy()))).then((()=>this.plugins.destroy()))}_addEditor(e,t){if(this._contextOwner)throw new n.CKEditorError("context-addeditor-private-context");this.editors.add(e),t&&(this._contextOwner=e)}_removeEditor(e){return this.editors.has(e)&&this.editors.remove(e),this._contextOwner===e?this.destroy():Promise.resolve()}_getEditorConfig(){const e={};for(const t of this.config.names())["plugins","removePlugins","extraPlugins"].includes(t)||(e[t]=this.config.get(t));return e}static create(e){return new Promise((t=>{const i=new this(e);t(i.initPlugins().then((()=>i)))}))}}class u extends((0,n.ObservableMixin)()){constructor(e){super(),this.context=e}destroy(){this.stopListening()}static get isContextPlugin(){return!0}}var h=i(151);class m{constructor(e){if(this.crashes=[],this.state="initializing",this._now=Date.now,this.crashes=[],this._crashNumberLimit="number"==typeof e.crashNumberLimit?e.crashNumberLimit:3,this._minimumNonErrorTimePeriod="number"==typeof e.minimumNonErrorTimePeriod?e.minimumNonErrorTimePeriod:5e3,this._boundErrorHandler=e=>{const t="error"in e?e.error:e.reason;t instanceof Error&&this._handleError(t,e)},this._listeners={},!this._restart)throw new Error("The Watchdog class was split into the abstract `Watchdog` class and the `EditorWatchdog` class. Please, use `EditorWatchdog` if you have used the `Watchdog` class previously.")}destroy(){this._stopErrorHandling(),this._listeners={}}on(e,t){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t)}off(e,t){this._listeners[e]=this._listeners[e].filter((e=>e!==t))}_fire(e,...t){const i=this._listeners[e]||[];for(const e of i)e.apply(this,[null,...t])}_startErrorHandling(){window.addEventListener("error",this._boundErrorHandler),window.addEventListener("unhandledrejection",this._boundErrorHandler)}_stopErrorHandling(){window.removeEventListener("error",this._boundErrorHandler),window.removeEventListener("unhandledrejection",this._boundErrorHandler)}_handleError(e,t){if(this._shouldReactToError(e)){this.crashes.push({message:e.message,stack:e.stack,filename:t instanceof ErrorEvent?t.filename:void 0,lineno:t instanceof ErrorEvent?t.lineno:void 0,colno:t instanceof ErrorEvent?t.colno:void 0,date:this._now()});const i=this._shouldRestart();this.state="crashed",this._fire("stateChange"),this._fire("error",{error:e,causesRestart:i}),i?this._restart():(this.state="crashedPermanently",this._fire("stateChange"))}}_shouldReactToError(e){return e.is&&e.is("CKEditorError")&&void 0!==e.context&&null!==e.context&&"ready"===this.state&&this._isErrorComingFromThisItem(e)}_shouldRestart(){return this.crashes.length<=this._crashNumberLimit||(this.crashes[this.crashes.length-1].date-this.crashes[this.crashes.length-1-this._crashNumberLimit].date)/this._crashNumberLimit>this._minimumNonErrorTimePeriod}}function g(e,t=new Set){const i=[e],n=new Set;let o=0;for(;i.length>o;){const e=i[o++];if(!n.has(e)&&f(e)&&!t.has(e))if(n.add(e),Symbol.iterator in e)try{for(const t of e)i.push(t)}catch(e){}else for(const t in e)"defaultValue"!==t&&i.push(e[t])}return n}function f(e){const t=Object.prototype.toString.call(e),i=typeof e;return!("number"===i||"boolean"===i||"string"===i||"symbol"===i||"function"===i||"[object Date]"===t||"[object RegExp]"===t||"[object Module]"===t||null==e||e._watchdogExcluded||e instanceof EventTarget||e instanceof Event)}function p(e,t,i=new Set){if(e===t&&"object"==typeof(n=e)&&null!==n)return!0;var n;const o=g(e,i),s=g(t,i);for(const e of o)if(s.has(e))return!0;return!1}var b=i(4022),w=i(1500),v=i(3967);class _ extends m{constructor(e,t={}){super(t),this._editor=null,this._lifecyclePromise=null,this._initUsingData=!0,this._editables={},this._throttledSave=(0,b.A)(this._save.bind(this),"number"==typeof t.saveInterval?t.saveInterval:5e3),e&&(this._creator=(t,i)=>e.create(t,i)),this._destructor=e=>e.destroy()}get editor(){return this._editor}get _item(){return this._editor}setCreator(e){this._creator=e}setDestructor(e){this._destructor=e}_restart(){return Promise.resolve().then((()=>(this.state="initializing",this._fire("stateChange"),this._destroy()))).catch((e=>{console.error("An error happened during the editor destroying.",e)})).then((()=>{const e={},t=[],i=this._config.rootsAttributes||{},n={};for(const[o,s]of Object.entries(this._data.roots))s.isLoaded?(e[o]="",n[o]=i[o]||{}):t.push(o);const o={...this._config,extraPlugins:this._config.extraPlugins||[],lazyRoots:t,rootsAttributes:n,_watchdogInitialData:this._data};return delete o.initialData,o.extraPlugins.push(y),this._initUsingData?this.create(e,o,o.context):(0,w.A)(this._elementOrData)?this.create(this._elementOrData,o,o.context):this.create(this._editables,o,o.context)})).then((()=>{this._fire("restart")}))}create(e=this._elementOrData,t=this._config,i){return this._lifecyclePromise=Promise.resolve(this._lifecyclePromise).then((()=>(super._startErrorHandling(),this._elementOrData=e,this._initUsingData="string"==typeof e||Object.keys(e).length>0&&"string"==typeof Object.values(e)[0],this._config=this._cloneEditorConfiguration(t)||{},this._config.context=i,this._creator(e,this._config)))).then((e=>{this._editor=e,e.model.document.on("change:data",this._throttledSave),this._lastDocumentVersion=e.model.document.version,this._data=this._getData(),this._initUsingData||(this._editables=this._getEditables()),this.state="ready",this._fire("stateChange")})).finally((()=>{this._lifecyclePromise=null})),this._lifecyclePromise}destroy(){return this._lifecyclePromise=Promise.resolve(this._lifecyclePromise).then((()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy()))).finally((()=>{this._lifecyclePromise=null})),this._lifecyclePromise}_destroy(){return Promise.resolve().then((()=>{this._stopErrorHandling(),this._throttledSave.cancel();const e=this._editor;return this._editor=null,e.model.document.off("change:data",this._throttledSave),this._destructor(e)}))}_save(){const e=this._editor.model.document.version;try{this._data=this._getData(),this._initUsingData||(this._editables=this._getEditables()),this._lastDocumentVersion=e}catch(e){console.error(e,"An error happened during restoring editor data. Editor will be restored from the previously saved data.")}}_setExcludedProperties(e){this._excludedProps=e}_getData(){const e=this._editor,t=e.model.document.roots.filter((e=>e.isAttached()&&"$graveyard"!=e.rootName)),{plugins:i}=e,n=i.has("CommentsRepository")&&i.get("CommentsRepository"),o=i.has("TrackChanges")&&i.get("TrackChanges"),s={roots:{},markers:{},commentThreads:JSON.stringify([]),suggestions:JSON.stringify([])};t.forEach((e=>{s.roots[e.rootName]={content:JSON.stringify(Array.from(e.getChildren())),attributes:JSON.stringify(Array.from(e.getAttributes())),isLoaded:e._isLoaded}}));for(const t of e.model.markers)t._affectsData&&(s.markers[t.name]={rangeJSON:t.getRange().toJSON(),usingOperation:t._managedUsingOperations,affectsData:t._affectsData});return n&&(s.commentThreads=JSON.stringify(n.getCommentThreads({toJSON:!0,skipNotAttached:!0}))),o&&(s.suggestions=JSON.stringify(o.getSuggestions({toJSON:!0,skipNotAttached:!0}))),s}_getEditables(){const e={};for(const t of this.editor.model.document.getRootNames()){const i=this.editor.ui.getEditableElement(t);i&&(e[t]=i)}return e}_isErrorComingFromThisItem(e){return p(this._editor,e.context,this._excludedProps)}_cloneEditorConfiguration(e){return(0,v.A)(e,((e,t)=>(0,w.A)(e)||"context"===t?e:void 0))}}class y{constructor(e){this.editor=e,this._data=e.config.get("_watchdogInitialData")}init(){this.editor.data.on("init",(e=>{e.stop(),this.editor.model.enqueueChange({isUndoable:!1},(e=>{this._restoreCollaborationData(),this._restoreEditorData(e)})),this.editor.data.fire("ready")}),{priority:999})}_createNode(e,t){if("name"in t){const i=e.createElement(t.name,t.attributes);if(t.children)for(const n of t.children)i._appendChild(this._createNode(e,n));return i}return e.createText(t.data,t.attributes)}_restoreEditorData(e){const t=this.editor;Object.entries(this._data.roots).forEach((([i,{content:n,attributes:o}])=>{const s=JSON.parse(n),r=JSON.parse(o),a=t.model.document.getRoot(i);for(const[t,i]of r)e.setAttribute(t,i,a);for(const t of s){const i=this._createNode(e,t);e.insert(i,a,"end")}})),Object.entries(this._data.markers).forEach((([i,n])=>{const{document:o}=t.model,{rangeJSON:{start:s,end:r},...a}=n,l=o.getRoot(s.root),c=e.createPositionFromPath(l,s.path,s.stickiness),d=e.createPositionFromPath(l,r.path,r.stickiness),u=e.createRange(c,d);e.addMarker(i,{range:u,...a})}))}_restoreCollaborationData(){const e=JSON.parse(this._data.commentThreads),t=JSON.parse(this._data.suggestions);e.forEach((e=>{const t=this.editor.config.get("collaboration.channelId"),i=this.editor.plugins.get("CommentsRepository");i.hasCommentThread(e.threadId)&&i.getCommentThread(e.threadId).remove(),i.addCommentThread({channelId:t,...e})})),t.forEach((e=>{const t=this.editor.plugins.get("TrackChangesEditing");t.hasSuggestion(e.id)?t.getSuggestion(e.id).attributes=e.attributes:t.addSuggestionData(e)}))}}const k=Symbol("MainQueueId");class C{constructor(){this._onEmptyCallbacks=[],this._queues=new Map,this._activeActions=0}onEmpty(e){this._onEmptyCallbacks.push(e)}enqueue(e,t){const i=e===k;this._activeActions++,this._queues.get(e)||this._queues.set(e,Promise.resolve());const n=(i?Promise.all(this._queues.values()):Promise.all([this._queues.get(k),this._queues.get(e)])).then(t),o=n.catch((()=>{}));return this._queues.set(e,o),n.finally((()=>{this._activeActions--,this._queues.get(e)===o&&0===this._activeActions&&this._onEmptyCallbacks.forEach((e=>e()))}))}}function A(e){return Array.isArray(e)?e:[e]}class E{constructor(){this._commands=new Map}add(e,t){this._commands.set(e,t)}get(e){return this._commands.get(e)}execute(e,...t){const i=this.get(e);if(!i)throw new n.CKEditorError("commandcollection-command-not-found",this,{commandName:e});return i.execute(...t)}*names(){yield*this._commands.keys()}*commands(){yield*this._commands.values()}[Symbol.iterator](){return this._commands[Symbol.iterator]()}destroy(){for(const e of this.commands())e.destroy()}}class x extends n.KeystrokeHandler{constructor(e){super(),this.editor=e}set(e,t,i={}){if("string"==typeof t){const e=t;t=(t,i)=>{this.editor.execute(e),i()}}super.set(e,t,i)}}const T="contentEditing",P="common";class I{constructor(e){this.keystrokeInfos=new Map,this._editor=e;const t=e.config.get("menuBar.isVisible"),i=e.locale.t;this.addKeystrokeInfoCategory({id:T,label:i("Content editing keystrokes"),description:i("These keyboard shortcuts allow for quick access to content editing features.")});const n=[{label:i("Close contextual balloons, dropdowns, and dialogs"),keystroke:"Esc"},{label:i("Open the accessibility help dialog"),keystroke:"Alt+0"},{label:i("Move focus between form fields (inputs, buttons, etc.)"),keystroke:[["Tab"],["Shift+Tab"]]},{label:i("Move focus to the toolbar, navigate between toolbars"),keystroke:"Alt+F10",mayRequireFn:!0},{label:i("Navigate through the toolbar or menu bar"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]},{label:i("Execute the currently focused button. Executing buttons that interact with the editor content moves the focus back to the content."),keystroke:[["Enter"],["Space"]]}];t&&n.push({label:i("Move focus to the menu bar, navigate between menu bars"),keystroke:"Alt+F9",mayRequireFn:!0}),this.addKeystrokeInfoCategory({id:"navigation",label:i("User interface and content navigation keystrokes"),description:i("Use the following keystrokes for more efficient navigation in the CKEditor 5 user interface."),groups:[{id:"common",keystrokes:n}]})}addKeystrokeInfoCategory({id:e,label:t,description:i,groups:n}){this.keystrokeInfos.set(e,{id:e,label:t,description:i,groups:new Map}),this.addKeystrokeInfoGroup({categoryId:e,id:P}),n&&n.forEach((t=>{this.addKeystrokeInfoGroup({categoryId:e,...t})}))}addKeystrokeInfoGroup({categoryId:e=T,id:t,label:i,keystrokes:o}){const s=this.keystrokeInfos.get(e);if(!s)throw new n.CKEditorError("accessibility-unknown-keystroke-info-category",this._editor,{groupId:t,categoryId:e});s.groups.set(t,{id:t,label:i,keystrokes:o||[]})}addKeystrokeInfos({categoryId:e=T,groupId:t=P,keystrokes:i}){if(!this.keystrokeInfos.has(e))throw new n.CKEditorError("accessibility-unknown-keystroke-info-category",this._editor,{categoryId:e,keystrokes:i});const o=this.keystrokeInfos.get(e);if(!o.groups.has(t))throw new n.CKEditorError("accessibility-unknown-keystroke-info-group",this._editor,{groupId:t,categoryId:e,keystrokes:i});o.groups.get(t).keystrokes.push(...i)}}class S extends((0,n.ObservableMixin)()){constructor(e={}){super();const t=this.constructor,{translations:i,...o}=t.defaultConfig||{},{translations:s=i,...r}=e,a=e.language||o.language;this._context=e.context||new d({language:a,translations:s}),this._context._addEditor(this,!e.context);const l=Array.from(t.builtinPlugins||[]);this.config=new n.Config(r,o),this.config.define("plugins",l),this.config.define(this._context._getEditorConfig()),this.plugins=new c(this,l,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this._readOnlyLocks=new Set,this.commands=new E,this.set("state","initializing"),this.once("ready",(()=>this.state="ready"),{priority:"high"}),this.once("destroy",(()=>this.state="destroyed"),{priority:"high"}),this.model=new h.Model,this.on("change:isReadOnly",(()=>{this.model.document.isReadOnly=this.isReadOnly}));const u=new h.StylesProcessor;this.data=new h.DataController(this.model,u),this.editing=new h.EditingController(this.model,u),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new h.Conversion([this.editing.downcastDispatcher,this.data.downcastDispatcher],this.data.upcastDispatcher),this.conversion.addAlias("dataDowncast",this.data.downcastDispatcher),this.conversion.addAlias("editingDowncast",this.editing.downcastDispatcher),this.keystrokes=new x(this),this.keystrokes.listenTo(this.editing.view.document),this.accessibility=new I(this)}get isReadOnly(){return this._readOnlyLocks.size>0}set isReadOnly(e){throw new n.CKEditorError("editor-isreadonly-has-no-setter")}enableReadOnlyMode(e){if("string"!=typeof e&&"symbol"!=typeof e)throw new n.CKEditorError("editor-read-only-lock-id-invalid",null,{lockId:e});this._readOnlyLocks.has(e)||(this._readOnlyLocks.add(e),1===this._readOnlyLocks.size&&this.fire("change:isReadOnly","isReadOnly",!0,!1))}disableReadOnlyMode(e){if("string"!=typeof e&&"symbol"!=typeof e)throw new n.CKEditorError("editor-read-only-lock-id-invalid",null,{lockId:e});this._readOnlyLocks.has(e)&&(this._readOnlyLocks.delete(e),0===this._readOnlyLocks.size&&this.fire("change:isReadOnly","isReadOnly",!1,!0))}setData(e){this.data.set(e)}getData(e){return this.data.get(e)}initPlugins(){const e=this.config,t=e.get("plugins"),i=e.get("removePlugins")||[],n=e.get("extraPlugins")||[],o=e.get("substitutePlugins")||[];return this.plugins.init(t.concat(n),i,o)}destroy(){let e=Promise.resolve();return"initializing"==this.state&&(e=new Promise((e=>this.once("ready",e)))),e.then((()=>{this.fire("destroy"),this.stopListening(),this.commands.destroy()})).then((()=>this.plugins.destroy())).then((()=>{this.model.destroy(),this.data.destroy(),this.editing.destroy(),this.keystrokes.destroy()})).then((()=>this._context._removeEditor(this)))}execute(e,...t){try{return this.commands.execute(e,...t)}catch(e){n.CKEditorError.rethrowUnexpectedError(e,this)}}focus(){this.editing.view.focus()}static create(...e){throw new Error("This is an abstract method.")}}S.Context=d,S.EditorWatchdog=_,S.ContextWatchdog=class extends m{constructor(e,t={}){super(t),this._watchdogs=new Map,this._context=null,this._contextProps=new Set,this._actionQueues=new C,this._watchdogConfig=t,this._creator=t=>e.create(t),this._destructor=e=>e.destroy(),this._actionQueues.onEmpty((()=>{"initializing"===this.state&&(this.state="ready",this._fire("stateChange"))}))}setCreator(e){this._creator=e}setDestructor(e){this._destructor=e}get context(){return this._context}create(e={}){return this._actionQueues.enqueue(k,(()=>(this._contextConfig=e,this._create())))}getItem(e){return this._getWatchdog(e)._item}getItemState(e){return this._getWatchdog(e).state}add(e){const t=A(e);return Promise.all(t.map((e=>this._actionQueues.enqueue(e.id,(()=>{if("destroyed"===this.state)throw new Error("Cannot add items to destroyed watchdog.");if(!this._context)throw new Error("Context was not created yet. You should call the `ContextWatchdog#create()` method first.");let t;if(this._watchdogs.has(e.id))throw new Error(`Item with the given id is already added: '${e.id}'.`);if("editor"===e.type)return t=new _(null,this._watchdogConfig),t.setCreator(e.creator),t._setExcludedProperties(this._contextProps),e.destructor&&t.setDestructor(e.destructor),this._watchdogs.set(e.id,t),t.on("error",((i,{error:n,causesRestart:o})=>{this._fire("itemError",{itemId:e.id,error:n}),o&&this._actionQueues.enqueue(e.id,(()=>new Promise((i=>{const n=()=>{t.off("restart",n),this._fire("itemRestart",{itemId:e.id}),i()};t.on("restart",n)}))))})),t.create(e.sourceElementOrData,e.config,this._context);throw new Error(`Not supported item type: '${e.type}'.`)})))))}remove(e){const t=A(e);return Promise.all(t.map((e=>this._actionQueues.enqueue(e,(()=>{const t=this._getWatchdog(e);return this._watchdogs.delete(e),t.destroy()})))))}destroy(){return this._actionQueues.enqueue(k,(()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy())))}_restart(){return this._actionQueues.enqueue(k,(()=>(this.state="initializing",this._fire("stateChange"),this._destroy().catch((e=>{console.error("An error happened during destroying the context or items.",e)})).then((()=>this._create())).then((()=>this._fire("restart"))))))}_create(){return Promise.resolve().then((()=>(this._startErrorHandling(),this._creator(this._contextConfig)))).then((e=>(this._context=e,this._contextProps=g(this._context),Promise.all(Array.from(this._watchdogs.values()).map((e=>(e._setExcludedProperties(this._contextProps),e.create(void 0,void 0,this._context))))))))}_destroy(){return Promise.resolve().then((()=>{this._stopErrorHandling();const e=this._context;return this._context=null,this._contextProps=new Set,Promise.all(Array.from(this._watchdogs.values()).map((e=>e.destroy()))).then((()=>this._destructor(e)))}))}_getWatchdog(e){const t=this._watchdogs.get(e);if(!t)throw new Error(`Item with the given id was not registered: ${e}.`);return t}_isErrorComingFromThisItem(e){for(const t of this._watchdogs.values())if(t._isErrorComingFromThisItem(e))return!1;return p(this._context,e.context)}};const V=S;var R=i(9610);function B(e){if(!(0,R.A)(e.updateSourceElement))throw new n.CKEditorError("attachtoform-missing-elementapi-interface",e);const t=e.sourceElement;if(function(e){return!!e&&"textarea"===e.tagName.toLowerCase()}(t)&&t.form){let i;const n=t.form,o=()=>e.updateSourceElement();(0,R.A)(n.submit)&&(i=n.submit,n.submit=()=>{o(),i.apply(n)}),n.addEventListener("submit",o),e.on("destroy",(()=>{n.removeEventListener("submit",o),i&&(n.submit=i)}))}}function M(e){return e}function O(e){return class extends e{updateSourceElement(e){if(!this.sourceElement)throw new n.CKEditorError("editor-missing-sourceelement",this);const t=this.config.get("updateSourceElementOnDestroy"),i=this.sourceElement instanceof HTMLTextAreaElement;if(!t&&!i)return void(0,n.setDataInElement)(this.sourceElement,"");const o="string"==typeof e?e:this.data.get();(0,n.setDataInElement)(this.sourceElement,o)}}}function L(e,t){if(t.ckeditorInstance)throw new n.CKEditorError("editor-source-element-already-used",e);t.ckeditorInstance=e,e.once("destroy",(()=>{delete t.ckeditorInstance}))}O.updateSourceElement=O(Object).prototype.updateSourceElement;class F extends u{static get pluginName(){return"PendingActions"}init(){this.set("hasAny",!1),this._actions=new n.Collection({idProperty:"_id"}),this._actions.delegate("add","remove").to(this)}add(e){if("string"!=typeof e)throw new n.CKEditorError("pendingactions-add-invalid-message",this);const t=new((0,n.ObservableMixin)());return t.set("message",e),this._actions.add(t),this.hasAny=!0,t}remove(e){this._actions.remove(e),this.hasAny=!!this._actions.length}get first(){return this._actions.get(0)}[Symbol.iterator](){return this._actions[Symbol.iterator]()}}const N={bold:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.187 17H5.773c-.637 0-1.092-.138-1.364-.415-.273-.277-.409-.718-.409-1.323V4.738c0-.617.14-1.062.419-1.332.279-.27.73-.406 1.354-.406h4.68c.69 0 1.288.041 1.793.124.506.083.96.242 1.36.478.341.197.644.447.906.75a3.262 3.262 0 0 1 .808 2.162c0 1.401-.722 2.426-2.167 3.075C15.05 10.175 16 11.315 16 13.01a3.756 3.756 0 0 1-2.296 3.504 6.1 6.1 0 0 1-1.517.377c-.571.073-1.238.11-2 .11zm-.217-6.217H7v4.087h3.069c1.977 0 2.965-.69 2.965-2.072 0-.707-.256-1.22-.768-1.537-.512-.319-1.277-.478-2.296-.478zM7 5.13v3.619h2.606c.729 0 1.292-.067 1.69-.2a1.6 1.6 0 0 0 .91-.765c.165-.267.247-.566.247-.897 0-.707-.26-1.176-.778-1.409-.519-.232-1.31-.348-2.375-.348H7z"/></svg>',cancel:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.591 10.177 4.243 4.242a1 1 0 0 1-1.415 1.415l-4.242-4.243-4.243 4.243a1 1 0 0 1-1.414-1.415l4.243-4.242L4.52 5.934A1 1 0 0 1 5.934 4.52l4.243 4.243 4.242-4.243a1 1 0 1 1 1.415 1.414l-4.243 4.243z"/></svg>',caption:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 16h9a1 1 0 0 1 0 2H2a1 1 0 0 1 0-2z"/><path d="M17 1a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h14zm0 1.5H3a.5.5 0 0 0-.492.41L2.5 3v9a.5.5 0 0 0 .41.492L3 12.5h14a.5.5 0 0 0 .492-.41L17.5 12V3a.5.5 0 0 0-.41-.492L17 2.5z" fill-opacity=".6"/></svg>',check:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.972 16.615a.997.997 0 0 1-.744-.292l-4.596-4.596a1 1 0 1 1 1.414-1.414l3.926 3.926 9.937-9.937a1 1 0 0 1 1.414 1.415L7.717 16.323a.997.997 0 0 1-.745.292z"/></svg>',cog:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.333 2 .19 2.263a5.899 5.899 0 0 1 1.458.604L14.714 3.4 16.6 5.286l-1.467 1.733c.263.452.468.942.605 1.46L18 8.666v2.666l-2.263.19a5.899 5.899 0 0 1-.604 1.458l1.467 1.733-1.886 1.886-1.733-1.467a5.899 5.899 0 0 1-1.46.605L11.334 18H8.667l-.19-2.263a5.899 5.899 0 0 1-1.458-.604L5.286 16.6 3.4 14.714l1.467-1.733a5.899 5.899 0 0 1-.604-1.458L2 11.333V8.667l2.262-.189a5.899 5.899 0 0 1 .605-1.459L3.4 5.286 5.286 3.4l1.733 1.467a5.899 5.899 0 0 1 1.46-.605L8.666 2h2.666zM10 6.267a3.733 3.733 0 1 0 0 7.466 3.733 3.733 0 0 0 0-7.466z"/></svg>',colorPalette:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.209 18.717A8.5 8.5 0 1 1 18.686 9.6h-.008l.002.12a3 3 0 0 1-2.866 2.997h-.268l-.046-.002v.002h-4.791a2 2 0 1 0 0 4 1 1 0 1 1-.128 1.992 8.665 8.665 0 0 1-.372.008Zm-3.918-7.01a1.25 1.25 0 1 0-2.415-.648 1.25 1.25 0 0 0 2.415.647ZM5.723 8.18a1.25 1.25 0 1 0 .647-2.414 1.25 1.25 0 0 0-.647 2.414ZM9.76 6.155a1.25 1.25 0 1 0 .647-2.415 1.25 1.25 0 0 0-.647 2.415Zm4.028 1.759a1.25 1.25 0 1 0 .647-2.415 1.25 1.25 0 0 0-.647 2.415Z"/></svg>',eraser:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m8.636 9.531-2.758 3.94a.5.5 0 0 0 .122.696l3.224 2.284h1.314l2.636-3.736L8.636 9.53zm.288 8.451L5.14 15.396a2 2 0 0 1-.491-2.786l6.673-9.53a2 2 0 0 1 2.785-.49l3.742 2.62a2 2 0 0 1 .491 2.785l-7.269 10.053-2.147-.066z"/><path d="M4 18h5.523v-1H4zm-2 0h1v-1H2z"/></svg>',history:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11 1a9 9 0 1 1-8.027 13.075l1.128-1.129A7.502 7.502 0 0 0 18.5 10a7.5 7.5 0 1 0-14.962.759l-.745-.746-.76.76A9 9 0 0 1 11 1z"/><path d="M.475 8.17a.75.75 0 0 1 .978.047l.075.082 1.284 1.643 1.681-1.284a.75.75 0 0 1 .978.057l.073.083a.75.75 0 0 1-.057.978l-.083.073-2.27 1.737a.75.75 0 0 1-.973-.052l-.074-.082-1.741-2.23a.75.75 0 0 1 .13-1.052z"/><path d="M11.5 5v4.999l3.196 3.196-1.06 1.06L10.1 10.72l-.1-.113V5z"/></svg>',image:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.66 9.118a.693.693 0 0 1 .956.032l3.65 3.411 2.422-2.238a.695.695 0 0 1 .945 0L17.5 13.6V2.5h-15v11.1l4.16-4.482ZM17.8 1c.652 0 1.2.47 1.2 1.1v14.362c0 .64-.532 1.038-1.184 1.038H2.184C1.532 17.5 1 17.103 1 16.462V2.1C1 1.47 1.537 1 2.2 1h15.6Zm-5.655 6a2.128 2.128 0 0 1 .157-2.364A2.133 2.133 0 1 1 12.145 7Z"/></svg>',imageUpload:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M1.201 1C.538 1 0 1.47 0 2.1v14.363c0 .64.534 1.037 1.186 1.037h9.494a2.97 2.97 0 0 1-.414-.287 2.998 2.998 0 0 1-1.055-2.03 3.003 3.003 0 0 1 .693-2.185l.383-.455-.02.018-3.65-3.41a.695.695 0 0 0-.957-.034L1.5 13.6V2.5h15v5.535a2.97 2.97 0 0 1 1.412.932l.088.105V2.1c0-.63-.547-1.1-1.2-1.1H1.202Zm11.713 2.803a2.146 2.146 0 0 0-2.049 1.992 2.14 2.14 0 0 0 1.28 2.096 2.13 2.13 0 0 0 2.644-3.11 2.134 2.134 0 0 0-1.875-.978Z"/><path d="M15.522 19.1a.79.79 0 0 0 .79-.79v-5.373l2.059 2.455a.79.79 0 1 0 1.211-1.015l-3.352-3.995a.79.79 0 0 0-.995-.179.784.784 0 0 0-.299.221l-3.35 3.99a.79.79 0 1 0 1.21 1.017l1.936-2.306v5.185c0 .436.353.79.79.79Z"/><path d="M15.522 19.1a.79.79 0 0 0 .79-.79v-5.373l2.059 2.455a.79.79 0 1 0 1.211-1.015l-3.352-3.995a.79.79 0 0 0-.995-.179.784.784 0 0 0-.299.221l-3.35 3.99a.79.79 0 1 0 1.21 1.017l1.936-2.306v5.185c0 .436.353.79.79.79Z"/></svg>',imageAssetManager:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M1.201 1c-.662 0-1.2.47-1.2 1.1v14.248c0 .64.533 1.152 1.185 1.152h6.623v-7.236L6.617 9.15a.694.694 0 0 0-.957-.033L1.602 13.55V2.553l14.798.003V9.7H18V2.1c0-.63-.547-1.1-1.2-1.1H1.202Zm11.723 2.805a2.094 2.094 0 0 0-1.621.832 2.127 2.127 0 0 0 1.136 3.357 2.13 2.13 0 0 0 2.611-1.506 2.133 2.133 0 0 0-.76-2.244 2.13 2.13 0 0 0-1.366-.44Z"/><path clip-rule="evenodd" d="M19.898 12.369v6.187a.844.844 0 0 1-.844.844h-8.719a.844.844 0 0 1-.843-.844v-7.312a.844.844 0 0 1 .843-.844h2.531a.843.843 0 0 1 .597.248l.838.852h4.75c.223 0 .441.114.6.272a.844.844 0 0 1 .247.597Zm-1.52.654-4.377.02-1.1-1.143H11v6h7.4l-.023-4.877Z"/></svg>',imageUrl:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M1.201 1C.538 1 0 1.47 0 2.1v14.363c0 .64.534 1.037 1.186 1.037h7.029a5.401 5.401 0 0 1 .615-4.338l.762-1.232-2.975-2.78a.696.696 0 0 0-.957-.033L1.5 13.6V2.5h15v6.023c.449.131.887.32 1.307.573l.058.033c.046.028.09.057.135.086V2.1c0-.63-.547-1.1-1.2-1.1H1.202Zm11.713 2.803a2.15 2.15 0 0 0-1.611.834 2.118 2.118 0 0 0-.438 1.158 2.14 2.14 0 0 0 1.277 2.096 2.132 2.132 0 0 0 2.645-3.11 2.13 2.13 0 0 0-1.873-.978Z"/><path d="M16.63 10.294a3.003 3.003 0 0 0-4.142.887l-.117.177a.647.647 0 0 0-.096.492.664.664 0 0 0 .278.418.7.7 0 0 0 .944-.234 1.741 1.741 0 0 1 2.478-.463 1.869 1.869 0 0 1 .476 2.55.637.637 0 0 0-.071.5.646.646 0 0 0 .309.396.627.627 0 0 0 .869-.19l.027-.041a3.226 3.226 0 0 0-.956-4.492Zm-6.061 3.78-.044.066a3.228 3.228 0 0 0 .82 4.403 3.005 3.005 0 0 0 4.275-.798l.13-.197a.626.626 0 0 0 .092-.475.638.638 0 0 0-.268-.402.713.713 0 0 0-.99.26l-.018.029a1.741 1.741 0 0 1-2.477.461 1.87 1.87 0 0 1-.475-2.55l.029-.047a.647.647 0 0 0 .086-.485.66.66 0 0 0-.275-.408l-.04-.027a.609.609 0 0 0-.845.17Z"/><path d="M15.312 13.925c.24-.36.154-.838-.19-1.067-.346-.23-.82-.124-1.059.236l-1.268 1.907c-.239.36-.153.838.192 1.067.345.23.818.123 1.057-.236l1.268-1.907Z"/></svg>',lowVision:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5.085 6.22 2.943 4.078a.75.75 0 1 1 1.06-1.06l2.592 2.59A11.094 11.094 0 0 1 10 5.068c4.738 0 8.578 3.101 8.578 5.083 0 1.197-1.401 2.803-3.555 3.887l1.714 1.713a.75.75 0 0 1-.09 1.138.488.488 0 0 1-.15.084.75.75 0 0 1-.821-.16L6.17 7.304c-.258.11-.51.233-.757.365l6.239 6.24-.006.005.78.78c-.388.094-.78.166-1.174.215l-1.11-1.11h.011L4.55 8.197a7.2 7.2 0 0 0-.665.514l-.112.098 4.897 4.897-.005.006 1.276 1.276a10.164 10.164 0 0 1-1.477-.117l-.479-.479-.009.009-4.863-4.863-.022.031a2.563 2.563 0 0 0-.124.2c-.043.077-.08.158-.108.241a.534.534 0 0 0-.028.133.29.29 0 0 0 .008.072.927.927 0 0 0 .082.226c.067.133.145.26.234.379l3.242 3.365.025.01.59.623c-3.265-.918-5.59-3.155-5.59-4.668 0-1.194 1.448-2.838 3.663-3.93zm7.07.531a4.632 4.632 0 0 1 1.108 5.992l.345.344.046-.018a9.313 9.313 0 0 0 2-1.112c.256-.187.5-.392.727-.613.137-.134.27-.277.392-.431.072-.091.141-.185.203-.286.057-.093.107-.19.148-.292a.72.72 0 0 0 .036-.12.29.29 0 0 0 .008-.072.492.492 0 0 0-.028-.133.999.999 0 0 0-.036-.096 2.165 2.165 0 0 0-.071-.145 2.917 2.917 0 0 0-.125-.2 3.592 3.592 0 0 0-.263-.335 5.444 5.444 0 0 0-.53-.523 7.955 7.955 0 0 0-1.054-.768 9.766 9.766 0 0 0-1.879-.891c-.337-.118-.68-.219-1.027-.301zm-2.85.21-.069.002a.508.508 0 0 0-.254.097.496.496 0 0 0-.104.679.498.498 0 0 0 .326.199l.045.005c.091.003.181.003.272.012a2.45 2.45 0 0 1 2.017 1.513c.024.061.043.125.069.185a.494.494 0 0 0 .45.287h.008a.496.496 0 0 0 .35-.158.482.482 0 0 0 .13-.335.638.638 0 0 0-.048-.219 3.379 3.379 0 0 0-.36-.723 3.438 3.438 0 0 0-2.791-1.543l-.028-.001h-.013z"/></svg>',textAlternative:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.035 1C2.446 1 2 1.54 2 2.098V10.5h1.5v-8h13v8H18V2.098C18 1.539 17.48 1 16.9 1H3.035Zm10.453 2.61a1.885 1.885 0 0 0-1.442.736 1.89 1.89 0 0 0 1.011 2.976 1.903 1.903 0 0 0 2.253-1.114 1.887 1.887 0 0 0-1.822-2.598ZM7.463 8.163a.611.611 0 0 0-.432.154L5.071 10.5h5.119L7.88 8.348a.628.628 0 0 0-.417-.185Zm6.236 1.059a.62.62 0 0 0-.42.164L12.07 10.5h2.969l-.92-1.113a.618.618 0 0 0-.42-.165ZM.91 11.5a.91.91 0 0 0-.91.912v6.877c0 .505.405.91.91.91h18.178a.91.91 0 0 0 .912-.91v-6.877a.908.908 0 0 0-.912-.912H.91ZM3.668 13h1.947l2.135 5.7H5.898l-.28-.946H3.601l-.278.945H1.516L3.668 13Zm4.947 0h1.801v4.3h2.7v1.4h-4.5V13h-.001Zm4.5 0h5.4v1.4h-1.798v4.3h-1.701v-4.3h-1.9V13h-.001Zm-8.517 1.457-.614 2.059h1.262l-.648-2.059Z"/></svg>',loupe:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.68 13.74h-.001l4.209 4.208a1 1 0 1 0 1.414-1.414l-4.267-4.268a6 6 0 1 0-1.355 1.474ZM13 9a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z"/></svg>',previousArrow:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.463 5.187a.888.888 0 1 1 1.254 1.255L9.16 10l3.557 3.557a.888.888 0 1 1-1.254 1.255L7.26 10.61a.888.888 0 0 1 .16-1.382l4.043-4.042z"/></svg>',nextArrow:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8.537 14.813a.888.888 0 1 1-1.254-1.255L10.84 10 7.283 6.442a.888.888 0 1 1 1.254-1.255L12.74 9.39a.888.888 0 0 1-.16 1.382l-4.043 4.042z"/></svg>',importExport:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M19 4.5 14 0H3v12.673l.868-1.041c.185-.222.4-.402.632-.54V1.5h8v5h5v7.626a2.24 2.24 0 0 1 1.5.822V4.5ZM14 5V2l3.3 3H14Zm-3.692 12.5c.062.105.133.206.213.303L11.52 19H8v-.876a2.243 2.243 0 0 0 1.82-.624h.488Zm7.518-.657a.75.75 0 0 0-1.152-.96L15.5 17.29V12H14v5.29l-1.174-1.408a.75.75 0 0 0-1.152.96l2.346 2.816a.95.95 0 0 0 1.46 0l2.346-2.815Zm-15.056-.38a.75.75 0 0 1-.096-1.056l2.346-2.815a.95.95 0 0 1 1.46 0l2.346 2.815a.75.75 0 1 1-1.152.96L6.5 14.96V20H5v-5.04l-1.174 1.408a.75.75 0 0 1-1.056.096Z"/></svg>',paragraph:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.5 5.5H7v5h3.5a2.5 2.5 0 1 0 0-5zM5 3h6.5v.025a5 5 0 0 1 0 9.95V13H7v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z"/></svg>',plus:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10 2a1 1 0 0 0-1 1v6H3a1 1 0 1 0 0 2h6v6a1 1 0 1 0 2 0v-6h6a1 1 0 1 0 0-2h-6V3a1 1 0 0 0-1-1Z"/></svg>',text:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.816 11.5 7.038 4.785 4.261 11.5h5.555Zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663L10.436 13Z"/><path d="m12.09 17-.534-1.292.848-1.971.545 1.319L12.113 17h-.023Zm1.142-5.187.545 1.319L15.5 9.13l1.858 4.316h-3.45l.398.965h3.467L18.887 17H20l-3.873-9h-1.254l-1.641 3.813Z"/></svg>',alignBottom:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m9.239 13.938-2.88-1.663a.75.75 0 0 1 .75-1.3L9 12.067V4.75a.75.75 0 1 1 1.5 0v7.318l1.89-1.093a.75.75 0 0 1 .75 1.3l-2.879 1.663a.752.752 0 0 1-.511.187.752.752 0 0 1-.511-.187zM4.25 17a.75.75 0 1 1 0-1.5h10.5a.75.75 0 0 1 0 1.5H4.25z"/></svg>',alignMiddle:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.75 11.875a.752.752 0 0 1 .508.184l2.883 1.666a.75.75 0 0 1-.659 1.344l-.091-.044-1.892-1.093.001 4.318a.75.75 0 1 1-1.5 0v-4.317l-1.89 1.092a.75.75 0 0 1-.75-1.3l2.879-1.663a.752.752 0 0 1 .51-.187zM15.25 9a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.5h10.5zM9.75.375a.75.75 0 0 1 .75.75v4.318l1.89-1.093.092-.045a.75.75 0 0 1 .659 1.344l-2.883 1.667a.752.752 0 0 1-.508.184.752.752 0 0 1-.511-.187L6.359 5.65a.75.75 0 0 1 .75-1.299L9 5.442V1.125a.75.75 0 0 1 .75-.75z"/></svg>',alignTop:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m10.261 7.062 2.88 1.663a.75.75 0 0 1-.75 1.3L10.5 8.933v7.317a.75.75 0 1 1-1.5 0V8.932l-1.89 1.093a.75.75 0 0 1-.75-1.3l2.879-1.663a.752.752 0 0 1 .511-.187.752.752 0 0 1 .511.187zM15.25 4a.75.75 0 1 1 0 1.5H4.75a.75.75 0 0 1 0-1.5h10.5z"/></svg>',alignLeft:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75z"/></svg>',alignCenter:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm2.286 4c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h9.928a.75.75 0 1 0 0-1.5H5.036a.75.75 0 0 0-.75.75z"/></svg>',alignRight:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M18 3.75a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75zm0 8a.75.75 0 0 1-.75.75H2.75a.75.75 0 1 1 0-1.5h14.5a.75.75 0 0 1 .75.75zm0 4a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75zm0-8a.75.75 0 0 1-.75.75H7.321a.75.75 0 1 1 0-1.5h9.929a.75.75 0 0 1 .75.75z"/></svg>',alignJustify:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0 4c0 .414.336.75.75.75h9.929a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm0-8c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75z"/></svg>',objectLeft:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zm0-3H18v1.5h-4.5zm0-3H18v1.5h-4.5zM2 15h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',objectCenter:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M15.003 7v5.5a1 1 0 0 1-1 1H5.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H6.5V12h6.997V7.5z"/></svg>',objectRight:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2zm0-9h5v1.5H2zm0 3h5v1.5H2zm0 3h5v1.5H2z"/><path d="M18.003 7v5.5a1 1 0 0 1-1 1H8.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H9.5V12h6.997V7.5z"/></svg>',objectFullWidth:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M18 7v5.5a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1zm-1.505.5H3.504V12h12.991V7.5z"/></svg>',objectInline:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm11.5 9H18v1.5h-4.5zM2 15h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',objectBlockLeft:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M12.003 7v5.5a1 1 0 0 1-1 1H2.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H3.5V12h6.997V7.5z"/></svg>',objectBlockRight:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path opacity=".5" d="M2 3h16v1.5H2zm0 12h16v1.5H2z"/><path d="M18.003 7v5.5a1 1 0 0 1-1 1H8.996a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h8.007a1 1 0 0 1 1 1zm-1.506.5H9.5V12h6.997V7.5z"/></svg>',objectSizeCustom:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:v="https://vecta.io/nano" viewBox="0 0 20 20"><path d="M.95 1.43a.95.95 0 0 0-.95.95v3.1a.95.95 0 0 0 .95.95h.75v6.3H.95a.95.95 0 0 0-.95.95v3.1a.95.95 0 0 0 .95.95h3.1a.95.95 0 0 0 .95-.95v-.65h1.932l1.539-1.5H5v-.95a.95.95 0 0 0-.95-.95H3.2v-6.3h.85A.95.95 0 0 0 5 5.48v-.55h10v.55a.95.95 0 0 0 .95.95h3.1a.95.95 0 0 0 .95-.95v-3.1a.95.95 0 0 0-.95-.95h-3.1a.95.95 0 0 0-.95.95v1.05H5V2.38a.95.95 0 0 0-.95-.95H.95zm.55 3.5v-2h2v2h-2zm0 9.3v2h2v-2h-2zm15-11.3v2h2v-2h-2z"/><path d="M8.139 20.004v-2.388l7.045-7.048 2.391 2.391-7.046 7.046h-2.39zm11.421-9.101a.64.64 0 0 1-.138.206l-1.165 1.168-2.391-2.391 1.167-1.163a.63.63 0 0 1 .206-.138.635.635 0 0 1 .243-.049.63.63 0 0 1 .449.187l1.491 1.488c.059.059.108.129.138.206s.049.16.049.243a.6.6 0 0 1-.049.243z"/></svg>',objectSizeFull:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.5 17v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zm2 0v1h-1v-1h1zM1 15.5v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm-19-2v1H0v-1h1zm19 0v1h-1v-1h1zm0-2v1h-1v-1h1zm-19 0v1H0v-1h1zM14.5 2v1h-1V2h1zm2 0v1h-1V2h1zm2 0v1h-1V2h1zm-8 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm-2 0v1h-1V2h1zm8 0v1h-1V2h1zm-10 0v1h-1V2h1z"/><path d="M18.095 2H1.905C.853 2 0 2.895 0 4v12c0 1.105.853 2 1.905 2h16.19C19.147 18 20 17.105 20 16V4c0-1.105-.853-2-1.905-2zm0 1.5c.263 0 .476.224.476.5v12c0 .276-.213.5-.476.5H1.905a.489.489 0 0 1-.476-.5V4c0-.276.213-.5.476-.5h16.19z"/></svg>',objectSizeLarge:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 16.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1ZM1 15v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 13v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 11v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 9v1H0V9h1Zm19 0v1h-1V9h1ZM1 7v1H0V7h1Zm19 0v1h-1V7h1ZM1 5v1H0V5h1Zm19 0v1h-1V5h1Zm0-2v1h-1V3h1ZM1 3v1H0V3h1Zm13.5-1.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm-8 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm8 0v1h-1v-1h1Zm-10 0v1h-1v-1h1Z"/><path d="M13 5.5H2a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-8a2 2 0 0 0-2-2ZM13 7a.5.5 0 0 1 .5.5v8a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-8A.5.5 0 0 1 2 7h11Z"/></svg>',objectSizeSmall:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 16.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1ZM1 15v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 13v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 11v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 9v1H0V9h1Zm19 0v1h-1V9h1ZM1 7v1H0V7h1Zm19 0v1h-1V7h1ZM1 5v1H0V5h1Zm19 0v1h-1V5h1Zm0-2v1h-1V3h1ZM1 3v1H0V3h1Zm13.5-1.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm-8 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm8 0v1h-1v-1h1Zm-10 0v1h-1v-1h1Z"/><path d="M7 9.5H2a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h5a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2ZM7 11a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-4A.5.5 0 0 1 2 11h5Z"/></svg>',objectSizeMedium:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 16.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1ZM1 15v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 13v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 11v1H0v-1h1Zm19 0v1h-1v-1h1ZM1 9v1H0V9h1Zm19 0v1h-1V9h1ZM1 7v1H0V7h1Zm19 0v1h-1V7h1ZM1 5v1H0V5h1Zm19 0v1h-1V5h1Zm0-2v1h-1V3h1ZM1 3v1H0V3h1Zm13.5-1.5v1h-1v-1h1Zm2 0v1h-1v-1h1Zm2 0v1h-1v-1h1Zm-8 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm-2 0v1h-1v-1h1Zm8 0v1h-1v-1h1Zm-10 0v1h-1v-1h1Z"/><path d="M10 7.5H2a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2ZM10 9a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5v-6A.5.5 0 0 1 2 9h8Z"/></svg>',pencil:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m7.3 17.37-.061.088a1.518 1.518 0 0 1-.934.535l-4.178.663-.806-4.153a1.495 1.495 0 0 1 .187-1.058l.056-.086L8.77 2.639c.958-1.351 2.803-1.076 4.296-.03 1.497 1.047 2.387 2.693 1.433 4.055L7.3 17.37zM9.14 4.728l-5.545 8.346 3.277 2.294 5.544-8.346L9.14 4.728zM6.07 16.512l-3.276-2.295.53 2.73 2.746-.435zM9.994 3.506 13.271 5.8c.316-.452-.16-1.333-1.065-1.966-.905-.634-1.895-.78-2.212-.328zM8 18.5 9.375 17H19v1.5H8z"/></svg>',pilcrow:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.999 2H15a1 1 0 0 1 0 2h-1.004v13a1 1 0 1 1-2 0V4H8.999v13a1 1 0 1 1-2 0v-7A4 4 0 0 1 3 6a4 4 0 0 1 3.999-4z"/></svg>',quote:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 10.423a6.5 6.5 0 0 1 6.056-6.408l.038.67C6.448 5.423 5.354 7.663 5.22 10H9c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003v-4.574zm8 0a6.5 6.5 0 0 1 6.056-6.408l.038.67c-2.646.739-3.74 2.979-3.873 5.315H17c.552 0 .5.432.5.986v4.511c0 .554-.448.503-1 .503h-5c-.552 0-.5-.449-.5-1.003v-4.574z"/></svg>',threeVerticalDots:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><circle cx="9.5" cy="4.5" r="1.5"/><circle cx="9.5" cy="10.5" r="1.5"/><circle cx="9.5" cy="16.5" r="1.5"/></svg>',dragIndicator:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5 3.25a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M12 3.25a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M12 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M5 16.75a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/><path d="M12 16.75a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0"/></svg>',redo:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m14.958 9.367-2.189 1.837a.75.75 0 0 0 .965 1.149l3.788-3.18a.747.747 0 0 0 .21-.284.75.75 0 0 0-.17-.945L13.77 4.762a.75.75 0 1 0-.964 1.15l2.331 1.955H6.22A.75.75 0 0 0 6 7.9a4 4 0 1 0 1.477 7.718l-.344-1.489A2.5 2.5 0 1 1 6.039 9.4l-.008-.032h8.927z"/></svg>',undo:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m5.042 9.367 2.189 1.837a.75.75 0 0 1-.965 1.149l-3.788-3.18a.747.747 0 0 1-.21-.284.75.75 0 0 1 .17-.945L6.23 4.762a.75.75 0 1 1 .964 1.15L4.863 7.866h8.917A.75.75 0 0 1 14 7.9a4 4 0 1 1-1.477 7.718l.344-1.489a2.5 2.5 0 1 0 1.094-4.73l.008-.032H5.042z"/></svg>',bulletedList:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zm-6 0C1 4.784 1.777 4 2.75 4c.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75C1.784 7.5 1 6.723 1 5.75zm6 9c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zm-6 0c0-.966.777-1.75 1.75-1.75.966 0 1.75.777 1.75 1.75 0 .966-.777 1.75-1.75 1.75-.966 0-1.75-.777-1.75-1.75z"/></svg>',numberedList:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7 5.75c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM3.5 3v5H2V3.7H1v-1h2.5V3zM.343 17.857l2.59-3.257H2.92a.6.6 0 1 0-1.04 0H.302a2 2 0 1 1 3.995 0h-.001c-.048.405-.16.734-.333.988-.175.254-.59.692-1.244 1.312H4.3v1h-4l.043-.043zM7 14.75a.75.75 0 0 1 .75-.75h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75z"/></svg>',todoList:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m2.315 14.705 2.224-2.24a.689.689 0 0 1 .963 0 .664.664 0 0 1 0 .949L2.865 16.07a.682.682 0 0 1-.112.089.647.647 0 0 1-.852-.051L.688 14.886a.635.635 0 0 1 0-.903.647.647 0 0 1 .91 0l.717.722zm5.185.045a.75.75 0 0 1 .75-.75h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75zM2.329 5.745l2.21-2.226a.689.689 0 0 1 .963 0 .664.664 0 0 1 0 .95L2.865 7.125a.685.685 0 0 1-.496.196.644.644 0 0 1-.468-.187L.688 5.912a.635.635 0 0 1 0-.903.647.647 0 0 1 .91 0l.73.736zM7.5 5.75A.75.75 0 0 1 8.25 5h9.5a.75.75 0 1 1 0 1.5h-9.5a.75.75 0 0 1-.75-.75z"/></svg>',codeBlock:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.87 12.61a.75.75 0 0 1-.089.976l-.085.07-3.154 2.254 3.412 2.414a.75.75 0 0 1 .237.95l-.057.095a.75.75 0 0 1-.95.237l-.096-.058-4.272-3.022-.003-1.223 4.01-2.867a.75.75 0 0 1 1.047.174zm2.795-.231.095.057 4.011 2.867-.003 1.223-4.272 3.022-.095.058a.75.75 0 0 1-.88-.151l-.07-.086-.058-.095a.75.75 0 0 1 .15-.88l.087-.07 3.412-2.414-3.154-2.253-.085-.071a.75.75 0 0 1 .862-1.207zM16 0a2 2 0 0 1 2 2v9.354l-.663-.492-.837-.001V2a.5.5 0 0 0-.5-.5H2a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h3.118L7.156 19H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h14zM5.009 15l.003 1H3v-1h2.009zm2.188-2-1.471 1H5v-1h2.197zM10 11v.095L8.668 12H7v-1h3zm4-2v1H7V9h7zm0-2v1H7V7h7zm-4-2v1H5V5h5zM6 3v1H3V3h3z"/></svg>',browseFiles:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.627 16.5zm5.873-.196zm0-7.001V8h-13v8.5h4.341c.191.54.457 1.044.785 1.5H2a1.5 1.5 0 0 1-1.5-1.5v-13A1.5 1.5 0 0 1 2 2h4.5a1.5 1.5 0 0 1 1.06.44L9.122 4H16a1.5 1.5 0 0 1 1.5 1.5v1A1.5 1.5 0 0 1 19 8v2.531a6.027 6.027 0 0 0-1.5-1.228zM16 6.5v-1H8.5l-2-2H2v13h1V8a1.5 1.5 0 0 1 1.5-1.5H16z"/><path d="M14.5 19.5a5 5 0 1 1 0-10 5 5 0 0 1 0 10zM15 14v-2h-1v2h-2v1h2v2h1v-2h2v-1h-2z"/></svg>',heading1:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M19 9v10h-2v-8h-2V9h4zM4 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1H10a1 1 0 0 1-1-1V11H4v4.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1H3a1 1 0 0 1 1 1v4.5z"/></svg>',heading2:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V11H3v4.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1H2a1 1 0 0 1 1 1v4.5zm16.076 8.343V18.5h-6.252c.067-.626.27-1.22.61-1.78.338-.561 1.006-1.305 2.005-2.232.804-.749 1.297-1.257 1.479-1.523.245-.368.368-.732.368-1.092 0-.398-.107-.703-.32-.917-.214-.214-.51-.32-.886-.32-.372 0-.669.111-.889.336-.22.224-.347.596-.38 1.117l-1.778-.178c.106-.982.438-1.686.997-2.114.558-.427 1.257-.64 2.095-.64.918 0 1.64.247 2.164.742.525.495.787 1.11.787 1.847 0 .419-.075.818-.225 1.197-.15.378-.388.775-.714 1.19-.216.275-.605.67-1.168 1.187-.563.516-.92.859-1.07 1.028a3.11 3.11 0 0 0-.365.495h3.542z"/></svg>',heading3:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V11H3v4.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1H2a1 1 0 0 1 1 1v4.5zm9.989 7.53 1.726-.209c.055.44.203.777.445 1.01.24.232.533.349.876.349.368 0 .678-.14.93-.42.251-.279.377-.655.377-1.13 0-.448-.12-.803-.362-1.066a1.153 1.153 0 0 0-.882-.393c-.228 0-.501.044-.819.133l.197-1.453c.482.012.85-.092 1.105-.315.253-.222.38-.517.38-.885 0-.313-.093-.563-.279-.75-.186-.185-.434-.278-.743-.278a1.07 1.07 0 0 0-.78.317c-.216.212-.347.52-.394.927l-1.644-.28c.114-.562.287-1.012.517-1.348.231-.337.553-.601.965-.794a3.24 3.24 0 0 1 1.387-.289c.876 0 1.579.28 2.108.838.436.457.653.973.653 1.549 0 .817-.446 1.468-1.339 1.955.533.114.96.37 1.28.768.319.398.478.878.478 1.441 0 .817-.298 1.513-.895 2.088-.596.576-1.339.864-2.228.864-.842 0-1.54-.243-2.094-.727-.555-.485-.876-1.118-.965-1.901z"/></svg>',heading4:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.5 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V11h-5v4.5a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v4.5zm13.55 10v-1.873h-3.81v-1.561l4.037-5.91h1.498v5.904h1.156v1.567h-1.156V18.5H17.05zm0-3.44v-3.18l-2.14 3.18h2.14z"/></svg>',heading5:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.5 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V11h-5v4.5a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v4.5zm9.578 7.607 1.777-.184c.05.402.201.72.45.955a1.223 1.223 0 0 0 1.81-.101c.258-.303.387-.759.387-1.368 0-.572-.128-1-.384-1.286-.256-.285-.59-.428-1-.428-.512 0-.971.226-1.377.679l-1.448-.21.915-4.843h4.716v1.67H15.56l-.28 1.58a2.697 2.697 0 0 1 1.219-.298 2.68 2.68 0 0 1 2.012.863c.55.576.825 1.323.825 2.241a3.36 3.36 0 0 1-.666 2.05c-.605.821-1.445 1.232-2.52 1.232-.86 0-1.56-.23-2.101-.692-.542-.461-.866-1.081-.971-1.86z"/></svg>',heading6:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3.5 8.5h5V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v11.5a1 1 0 0 1-1 1h-.5a1 1 0 0 1-1-1V11h-5v4.5a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h.5a1 1 0 0 1 1 1v4.5zm15.595 2.973-1.726.19c-.043-.355-.153-.617-.33-.787-.178-.169-.409-.253-.692-.253-.377 0-.695.169-.956.507-.26.339-.424 1.043-.492 2.114.445-.525.997-.787 1.657-.787.745 0 1.383.284 1.914.85.531.568.797 1.3.797 2.197 0 .952-.28 1.716-.838 2.291-.559.576-1.276.864-2.152.864-.94 0-1.712-.365-2.317-1.095-.605-.73-.908-1.927-.908-3.59 0-1.705.316-2.935.946-3.688.63-.753 1.45-1.13 2.457-1.13.706 0 1.291.198 1.755.594.463.395.758.97.885 1.723zm-4.043 3.891c0 .58.133 1.028.4 1.343.266.315.57.473.914.473.33 0 .605-.13.825-.388.22-.258.33-.68.33-1.27 0-.604-.118-1.047-.355-1.329a1.115 1.115 0 0 0-.89-.422c-.342 0-.632.134-.869.403s-.355.666-.355 1.19z"/></svg>',horizontalLine:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 9h16v2H2z"/></svg>',html:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M17 0a2 2 0 0 1 2 2v7a1 1 0 0 1 1 1v5a1 1 0 0 1-.883.993l-.118.006L19 17a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2l-.001-1.001-.116-.006A1 1 0 0 1 0 15v-5a1 1 0 0 1 .999-1L1 2a2 2 0 0 1 2-2h14zm.499 15.999h-15L2.5 17a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5l-.001-1.001zm-3.478-6.013-.014.014H14v.007l-1.525 1.525-1.46-1.46-.015.013V10h-1v5h1v-3.53l1.428 1.43.048.043.131-.129L14 11.421V15h1v-5h-.965l-.014-.014zM2 10H1v5h1v-2h2v2h1v-5H4v2H2v-2zm7 0H6v1h1v4h1v-4h1v-1zm8 0h-1v5h3v-1h-2v-4zm0-8.5H3a.5.5 0 0 0-.5.5l-.001 6.999h15L17.5 2a.5.5 0 0 0-.5-.5zM10 7v1H4V7h6zm3-2v1H4V5h9zm-3-2v1H4V3h6z"/></svg>',indent:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5zM1.632 6.95 5.02 9.358a.4.4 0 0 1-.013.661l-3.39 2.207A.4.4 0 0 1 1 11.892V7.275a.4.4 0 0 1 .632-.326z"/></svg>',outdent:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 3.75c0 .414.336.75.75.75h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 0 0-.75.75zm5 6c0 .414.336.75.75.75h9.5a.75.75 0 1 0 0-1.5h-9.5a.75.75 0 0 0-.75.75zM2.75 16.5h14.5a.75.75 0 1 0 0-1.5H2.75a.75.75 0 1 0 0 1.5zm1.618-9.55L.98 9.358a.4.4 0 0 0 .013.661l3.39 2.207A.4.4 0 0 0 5 11.892V7.275a.4.4 0 0 0-.632-.326z"/></svg>',table:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 5.5v3h4v-3H3Zm0 4v3h4v-3H3Zm0 4v3h4v-3H3Zm5 3h4v-3H8v3Zm5 0h4v-3h-4v3Zm4-4v-3h-4v3h4Zm0-4v-3h-4v3h4Zm1.5 8A1.5 1.5 0 0 1 17 18H3a1.5 1.5 0 0 1-1.5-1.5V3c.222-.863 1.068-1.5 2-1.5h13c.932 0 1.778.637 2 1.5v13.5Zm-6.5-4v-3H8v3h4Zm0-4v-3H8v3h4Z"/></svg>'}},5247:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ClassicEditor:()=>d});var n=i(949),o=i(4133),s=i(5318);class r extends n.Gn{constructor(e,t){super(e),this.view=t,this._toolbarConfig=(0,n.fl)(e.config.get("toolbar")),this._elementReplacer=new s.PZ,this.listenTo(e.editing.view,"scrollToTheSelection",this._handleScrollToTheSelectionWithStickyPanel.bind(this))}get element(){return this.view.element}init(e){const t=this.editor,i=this.view,n=t.editing.view,o=i.editable,s=n.document.getRoot();o.name=s.rootName,i.render();const r=o.element;this.setEditableElement(o.name,r),i.editable.bind("isFocused").to(this.focusTracker),n.attachDomRoot(r),e&&this._elementReplacer.replace(e,this.element),this._initPlaceholder(),this._initToolbar(),i.menuBarView&&this._initMenuBar(i.menuBarView),this._initDialogPluginIntegration(),this.fire("ready")}destroy(){super.destroy();const e=this.view,t=this.editor.editing.view;this._elementReplacer.restore(),t.detachDomRoot(e.editable.name),e.destroy()}_initToolbar(){const e=this.view;e.stickyPanel.bind("isActive").to(this.focusTracker,"isFocused"),e.stickyPanel.limiterElement=e.element,e.stickyPanel.bind("viewportTopOffset").to(this,"viewportOffset",(({top:e})=>e||0)),e.toolbar.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(e.toolbar)}_initPlaceholder(){const e=this.editor,t=e.editing.view,i=t.document.getRoot(),n=e.sourceElement;let s;const r=e.config.get("placeholder");r&&(s="string"==typeof r?r:r[this.view.editable.name]),!s&&n&&"textarea"===n.tagName.toLowerCase()&&(s=n.getAttribute("placeholder")),s&&(i.placeholder=s),(0,o.JT)({view:t,element:i,isDirectHost:!1,keepOnFocus:!0})}_handleScrollToTheSelectionWithStickyPanel(e,t,i){const n=this.view.stickyPanel;if(n.isSticky){const e=new s.rw(n.element).height;t.viewportOffset.top+=e}else{const e=()=>{this.editor.editing.view.scrollToTheSelection(i)};this.listenTo(n,"change:isSticky",e),setTimeout((()=>{this.stopListening(n,"change:isSticky",e)}),20)}}_initDialogPluginIntegration(){if(!this.editor.plugins.has("Dialog"))return;const e=this.view.stickyPanel,t=this.editor.plugins.get("Dialog");t.on("show",(()=>{const i=t.view;i.on("moveTo",((t,o)=>{if(!e.isSticky||i.wasMoved)return;const r=new s.rw(e.contentPanelElement);o[1]<r.bottom+n._m.defaultOffset&&(o[1]=r.bottom+n._m.defaultOffset)}),{priority:"high"})}),{priority:"low"})}}class a extends n.Xt{constructor(e,t,i={}){super(e),this.stickyPanel=new n.xw(e),this.toolbar=new n.X3(e,{shouldGroupWhenFull:i.shouldToolbarGroupWhenFull}),i.useMenuBar&&(this.menuBarView=new n.yJ(e)),this.editable=new n.LU(e,t)}render(){super.render(),this.menuBarView?this.stickyPanel.content.addMany([this.menuBarView,this.toolbar]):this.stickyPanel.content.add(this.toolbar),this.top.add(this.stickyPanel),this.main.add(this.editable)}}var l=i(1204),c=i(1500);class d extends((0,l.mJ)(l.KE)){constructor(e,t={}){if(!u(e)&&void 0!==t.initialData)throw new s.Yb("editor-create-initial-data",null);super(t),this.config.define("menuBar.isVisible",!1),void 0===this.config.get("initialData")&&this.config.set("initialData",function(e){return u(e)?(0,s.pG)(e):e}(e)),u(e)&&(this.sourceElement=e),this.model.document.createRoot();const i=!this.config.get("toolbar.shouldNotGroupWhenFull"),n=this.config.get("menuBar"),o=new a(this.locale,this.editing.view,{shouldToolbarGroupWhenFull:i,useMenuBar:n.isVisible});this.ui=new r(this,o),(0,l.JF)(this)}destroy(){return this.sourceElement&&this.updateSourceElement(),this.ui.destroy(),super.destroy()}static create(e,t={}){return new Promise((i=>{const n=new this(e,t);i(n.initPlugins().then((()=>n.ui.init(u(e)?e:null))).then((()=>n.data.init(n.config.get("initialData")))).then((()=>n.fire("ready"))).then((()=>n)))}))}}function u(e){return(0,c.A)(e)}},151:(e,t,i)=>{"use strict";i.r(t),i.d(t,{AttributeElement:()=>ae,AttributeOperation:()=>fn,BubblingEventInfo:()=>Y,ClickObserver:()=>_o,Conversion:()=>Ji,DataController:()=>Zi,DataTransfer:()=>ct,DocumentFragment:()=>Qn,DocumentSelection:()=>Gt,DomConverter:()=>qe,DomEventData:()=>Ye,DomEventObserver:()=>Xe,DowncastWriter:()=>be,EditingController:()=>Ti,EditingView:()=>ft,Element:()=>yt,FocusObserver:()=>rt,History:()=>Un,HtmlDataProcessor:()=>Gi,InsertOperation:()=>dn,LivePosition:()=>Bn,LiveRange:()=>$t,MarkerOperation:()=>mn,Matcher:()=>y,MergeOperation:()=>hn,Model:()=>wo,MouseObserver:()=>yo,MoveOperation:()=>cn,NoOperation:()=>pn,Observer:()=>Je,OperationFactory:()=>yn,Position:()=>At,Range:()=>St,RenameOperation:()=>bn,Renderer:()=>Le,RootAttributeOperation:()=>wn,RootOperation:()=>vn,SplitOperation:()=>un,StylesMap:()=>O,StylesProcessor:()=>L,TabObserver:()=>mt,Text:()=>vt,TextProxy:()=>_t,TreeWalker:()=>kt,UpcastWriter:()=>ko,ViewAttributeElement:()=>ae,ViewContainerElement:()=>W,ViewDocument:()=>se,ViewDocumentFragment:()=>pe,ViewEditableElement:()=>U,ViewElement:()=>D,ViewEmptyElement:()=>de,ViewRawElement:()=>ge,ViewRootEditableElement:()=>j,ViewText:()=>w,ViewTreeWalker:()=>q,ViewUIElement:()=>he,XmlDataProcessor:()=>Xi,_getModelData:()=>ks,_getViewData:()=>fs,_parseModel:()=>Es,_parseView:()=>ws,_setModelData:()=>Cs,_setViewData:()=>ps,_stringifyModel:()=>As,_stringifyView:()=>bs,addBackgroundRules:()=>Jo,addBorderRules:()=>Qo,addMarginRules:()=>as,addPaddingRules:()=>ls,autoParagraphEmptyRoots:()=>gi,disablePlaceholder:()=>a,enablePlaceholder:()=>r,getBoxSidesShorthandValue:()=>Ko,getBoxSidesValueReducer:()=>qo,getBoxSidesValues:()=>jo,getFillerOffset:()=>H,getPositionShorthandNormalizer:()=>Go,getShorthandValues:()=>Zo,hidePlaceholder:()=>c,isAttachment:()=>Ho,isColor:()=>So,isLength:()=>Mo,isLineStyle:()=>Ro,isParagraphable:()=>fi,isPercentage:()=>Lo,isPosition:()=>zo,isRepeat:()=>No,isURL:()=>$o,needsPlaceholder:()=>d,showPlaceholder:()=>l,transformSets:()=>xn,wrapInParagraph:()=>pi});var n=i(7906);const o=new WeakMap;let s=!1;function r({view:e,element:t,text:i,isDirectHost:r=!0,keepOnFocus:a=!1}){const l=e.document;function c(i){o.get(l).set(t,{text:i,isDirectHost:r,keepOnFocus:a,hostElement:r?t:null}),e.change((e=>u(l,e)))}o.has(l)||(o.set(l,new Map),l.registerPostFixer((e=>u(l,e))),l.on("change:isComposing",(()=>{e.change((e=>u(l,e)))}),{priority:"high"})),t.is("editableElement")&&t.on("change:placeholder",((e,t,i)=>{c(i)})),t.placeholder?c(t.placeholder):i&&c(i),i&&(s||(0,n.logWarning)("enableplaceholder-deprecated-text-option"),s=!0)}function a(e,t){const i=t.document;o.has(i)&&e.change((e=>{const n=o.get(i),s=n.get(t);e.removeAttribute("data-placeholder",s.hostElement),c(e,s.hostElement),n.delete(t)}))}function l(e,t){return!t.hasClass("ck-placeholder")&&(e.addClass("ck-placeholder",t),!0)}function c(e,t){return!!t.hasClass("ck-placeholder")&&(e.removeClass("ck-placeholder",t),!0)}function d(e,t){if(!e.isAttached())return!1;const i=Array.from(e.getChildren()).some((e=>!e.is("uiElement")));if(i)return!1;const n=e.document,o=n.selection.anchor;return!(n.isComposing&&o&&o.parent===e||!t&&n.isFocused&&(!o||o.parent===e))}function u(e,t){const i=o.get(e),n=[];let s=!1;for(const[e,o]of i)o.isDirectHost&&(n.push(e),h(t,e,o)&&(s=!0));for(const[e,o]of i){if(o.isDirectHost)continue;const i=m(e);i&&(n.includes(i)||(o.hostElement=i,h(t,e,o)&&(s=!0)))}return s}function h(e,t,i){const{text:n,isDirectHost:o,hostElement:s}=i;let r=!1;return s.getAttribute("data-placeholder")!==n&&(e.setAttribute("data-placeholder",n,s),r=!0),(o||1==t.childCount)&&d(s,i.keepOnFocus)?l(e,s)&&(r=!0):c(e,s)&&(r=!0),r}function m(e){if(e.childCount){const t=e.getChild(0);if(t.is("element")&&!t.is("uiElement")&&!t.is("attributeElement"))return t}return null}class g{is(){throw new Error("is() method is abstract")}}var f=i(9592);const p=function(e){return(0,f.A)(e,4)};class b extends((0,n.EmitterMixin)(g)){constructor(e){super(),this.document=e,this.parent=null}get index(){let e;if(!this.parent)return null;if(-1==(e=this.parent.getChildIndex(this)))throw new n.CKEditorError("view-node-not-found-in-parent",this);return e}get nextSibling(){const e=this.index;return null!==e&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return null!==e&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.root.is("rootElement")}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.index),t=t.parent;return e}getAncestors(e={}){const t=[];let i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}getCommonAncestor(e,t={}){const i=this.getAncestors(t),n=e.getAncestors(t);let o=0;for(;i[o]==n[o]&&i[o];)o++;return 0===o?null:i[o-1]}isBefore(e){if(this==e)return!1;if(this.root!==e.root)return!1;const t=this.getPath(),i=e.getPath(),o=(0,n.compareArrays)(t,i);switch(o){case"prefix":return!0;case"extension":return!1;default:return t[o]<i[o]}}isAfter(e){return this!=e&&this.root===e.root&&!this.isBefore(e)}_remove(){this.parent._removeChildren(this.index)}_fireChange(e,t){this.fire(`change:${e}`,t),this.parent&&this.parent._fireChange(e,t)}toJSON(){const e=p(this);return delete e.parent,e}}b.prototype.is=function(e){return"node"===e||"view:node"===e};class w extends b{constructor(e,t){super(e),this._textData=t}get data(){return this._textData}get _data(){return this.data}set _data(e){this._fireChange("text",this),this._textData=e}isSimilar(e){return e instanceof w&&(this===e||this.data===e.data)}_clone(){return new w(this.document,this.data)}}w.prototype.is=function(e){return"$text"===e||"view:$text"===e||"text"===e||"view:text"===e||"node"===e||"view:node"===e};class v extends g{constructor(e,t,i){if(super(),this.textNode=e,t<0||t>e.data.length)throw new n.CKEditorError("view-textproxy-wrong-offsetintext",this);if(i<0||t+i>e.data.length)throw new n.CKEditorError("view-textproxy-wrong-length",this);this.data=e.data.substring(t,t+i),this.offsetInText=t}get offsetSize(){return this.data.length}get isPartial(){return this.data.length!==this.textNode.data.length}get parent(){return this.textNode.parent}get root(){return this.textNode.root}get document(){return this.textNode.document}getAncestors(e={}){const t=[];let i=e.includeSelf?this.textNode:this.parent;for(;null!==i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}}v.prototype.is=function(e){return"$textProxy"===e||"view:$textProxy"===e||"textProxy"===e||"view:textProxy"===e};var _=i(4963);class y{constructor(...e){this._patterns=[],this.add(...e)}add(...e){for(let t of e)("string"==typeof t||t instanceof RegExp)&&(t={name:t}),this._patterns.push(t)}match(...e){for(const t of e)for(const e of this._patterns){const i=k(t,e);if(i)return{element:t,pattern:e,match:i}}return null}matchAll(...e){const t=[];for(const i of e)for(const e of this._patterns){const n=k(i,e);n&&t.push({element:i,pattern:e,match:n})}return t.length>0?t:null}getElementName(){if(1!==this._patterns.length)return null;const e=this._patterns[0],t=e.name;return"function"==typeof e||!t||t instanceof RegExp?null:t}}function k(e,t){if("function"==typeof t)return t(e);const i={};return t.name&&(i.name=function(e,t){return e instanceof RegExp?!!t.match(e):e===t}(t.name,e.name),!i.name)||t.attributes&&(i.attributes=function(e,t){const i=new Set(t.getAttributeKeys());return(0,_.A)(e)?(void 0!==e.style&&(0,n.logWarning)("matcher-pattern-deprecated-attributes-style-key",e),void 0!==e.class&&(0,n.logWarning)("matcher-pattern-deprecated-attributes-class-key",e)):(i.delete("style"),i.delete("class")),C(e,i,(e=>t.getAttribute(e)))}(t.attributes,e),!i.attributes)||t.classes&&(i.classes=function(e,t){return C(e,t.getClassNames(),(()=>{}))}(t.classes,e),!i.classes)||t.styles&&(i.styles=function(e,t){return C(e,t.getStyleNames(!0),(e=>t.getStyle(e)))}(t.styles,e),!i.styles)?null:i}function C(e,t,i){const o=function(e){return Array.isArray(e)?e.map((e=>(0,_.A)(e)?(void 0!==e.key&&void 0!==e.value||(0,n.logWarning)("matcher-pattern-missing-key-or-value",e),[e.key,e.value]):[e,!0])):(0,_.A)(e)?Object.entries(e):[[e,!0]]}(e),s=Array.from(t),r=[];if(o.forEach((([e,t])=>{s.forEach((n=>{(function(e,t){return!0===e||e===t||e instanceof RegExp&&t.match(e)})(e,n)&&function(e,t,i){if(!0===e)return!0;const n=i(t);return e===n||e instanceof RegExp&&!!String(n).match(e)}(t,n,i)&&r.push(n)}))})),o.length&&!(r.length<o.length))return r}var A=i(3149),E=i(4878);var x=i(6318),T=i(7688);var P=i(901);const I=function(e,t){return null==(e=function(e,t){return t.length<2?e:(0,x.A)(e,(0,T.A)(t,0,-1))}(e,t=(0,E.A)(t,e)))||delete e[(0,P.A)((i=t,n=null==i?0:i.length,n?i[n-1]:void 0))];var i,n};var S=i(7500),V=i(6248),R=i(2851),B=i(5353);const M=function(e,t,i){return null==e?e:function(e,t,i,n){if(!(0,A.A)(e))return e;for(var o=-1,s=(t=(0,E.A)(t,e)).length,r=s-1,a=e;null!=a&&++o<s;){var l=(0,P.A)(t[o]),c=i;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(o!=r){var d=a[l];void 0===(c=n?n(d,l,a):void 0)&&(c=(0,A.A)(d)?d:(0,B.A)(t[o+1])?[]:{})}(0,R.A)(a,l,c),a=a[l]}return e}(e,t,i)};class O{constructor(e){this._styles={},this._styleProcessor=e}get isEmpty(){return!Object.entries(this._styles).length}get size(){return this.isEmpty?0:this.getStyleNames().length}setTo(e){this.clear();const t=function(e){let t=null,i=0,n=0,o=null;const s=new Map;if(""===e)return s;";"!=e.charAt(e.length-1)&&(e+=";");for(let r=0;r<e.length;r++){const a=e.charAt(r);if(null===t)switch(a){case":":o||(o=e.substr(i,r-i),n=r+1);break;case'"':case"'":t=a;break;case";":{const t=e.substr(n,r-n);o&&s.set(o.trim(),t.trim()),o=null,i=r+1;break}}else a===t&&(t=null)}return s}(e);for(const[e,i]of t)this._styleProcessor.toNormalizedForm(e,i,this._styles)}has(e){if(this.isEmpty)return!1;const t=this._styleProcessor.getReducedForm(e,this._styles).find((([t])=>t===e));return Array.isArray(t)}set(e,t){if((0,A.A)(e))for(const[t,i]of Object.entries(e))this._styleProcessor.toNormalizedForm(t,i,this._styles);else this._styleProcessor.toNormalizedForm(e,t,this._styles)}remove(e){const t=F(e);(function(e,t){null==e||I(e,t)})(this._styles,t),delete this._styles[e],this._cleanEmptyObjectsOnPath(t)}getNormalized(e){return this._styleProcessor.getNormalized(e,this._styles)}toString(){return this.isEmpty?"":this.getStylesEntries().map((e=>e.join(":"))).sort().join(";")+";"}getAsString(e){if(this.isEmpty)return;if(this._styles[e]&&!(0,A.A)(this._styles[e]))return this._styles[e];const t=this._styleProcessor.getReducedForm(e,this._styles).find((([t])=>t===e));return Array.isArray(t)?t[1]:void 0}getStyleNames(e=!1){return this.isEmpty?[]:e?this._styleProcessor.getStyleNames(this._styles):this.getStylesEntries().map((([e])=>e))}clear(){this._styles={}}getStylesEntries(){const e=[],t=Object.keys(this._styles);for(const i of t)e.push(...this._styleProcessor.getReducedForm(i,this._styles));return e}_cleanEmptyObjectsOnPath(e){const t=e.split(".");if(!(t.length>1))return;const i=t.splice(0,t.length-1).join("."),n=(0,S.A)(this._styles,i);n&&!Object.keys(n).length&&this.remove(i)}}class L{constructor(){this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(e,t,i){if((0,A.A)(t))N(i,F(e),t);else if(this._normalizers.has(e)){const n=this._normalizers.get(e),{path:o,value:s}=n(t);N(i,o,s)}else N(i,e,t)}getNormalized(e,t){if(!e)return(0,V.A)({},t);if(void 0!==t[e])return t[e];if(this._extractors.has(e)){const i=this._extractors.get(e);if("string"==typeof i)return(0,S.A)(t,i);const n=i(e,t);if(n)return n}return(0,S.A)(t,F(e))}getReducedForm(e,t){const i=this.getNormalized(e,t);return void 0===i?[]:this._reducers.has(e)?this._reducers.get(e)(i):[[e,i]]}getStyleNames(e){const t=Array.from(this._consumables.keys()).filter((t=>{const i=this.getNormalized(t,e);return i&&"object"==typeof i?Object.keys(i).length:i})),i=new Set([...t,...Object.keys(e)]);return Array.from(i)}getRelatedStyles(e){return this._consumables.get(e)||[]}setNormalizer(e,t){this._normalizers.set(e,t)}setExtractor(e,t){this._extractors.set(e,t)}setReducer(e,t){this._reducers.set(e,t)}setStyleRelation(e,t){this._mapStyleNames(e,t);for(const i of t)this._mapStyleNames(i,[e])}_mapStyleNames(e,t){this._consumables.has(e)||this._consumables.set(e,[]),this._consumables.get(e).push(...t)}}function F(e){return e.replace("-",".")}function N(e,t,i){let n=i;(0,A.A)(i)&&(n=(0,V.A)({},(0,S.A)(e,t),i)),M(e,t,n)}class D extends b{constructor(e,t,i,o){if(super(e),this._unsafeAttributesToRender=[],this._customProperties=new Map,this.name=t,this._attrs=function(e){const t=(0,n.toMap)(e);for(const[e,i]of t)null===i?t.delete(e):"string"!=typeof i&&t.set(e,String(i));return t}(i),this._children=[],o&&this._insertChild(0,o),this._classes=new Set,this._attrs.has("class")){const e=this._attrs.get("class");z(this._classes,e),this._attrs.delete("class")}this._styles=new O(this.document.stylesProcessor),this._attrs.has("style")&&(this._styles.setTo(this._attrs.get("style")),this._attrs.delete("style"))}get childCount(){return this._children.length}get isEmpty(){return 0===this._children.length}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}*getAttributeKeys(){this._classes.size>0&&(yield"class"),this._styles.isEmpty||(yield"style"),yield*this._attrs.keys()}*getAttributes(){yield*this._attrs.entries(),this._classes.size>0&&(yield["class",this.getAttribute("class")]),this._styles.isEmpty||(yield["style",this.getAttribute("style")])}getAttribute(e){if("class"==e)return this._classes.size>0?[...this._classes].join(" "):void 0;if("style"==e){const e=this._styles.toString();return""==e?void 0:e}return this._attrs.get(e)}hasAttribute(e){return"class"==e?this._classes.size>0:"style"==e?!this._styles.isEmpty:this._attrs.has(e)}isSimilar(e){if(!(e instanceof D))return!1;if(this===e)return!0;if(this.name!=e.name)return!1;if(this._attrs.size!==e._attrs.size||this._classes.size!==e._classes.size||this._styles.size!==e._styles.size)return!1;for(const[t,i]of this._attrs)if(!e._attrs.has(t)||e._attrs.get(t)!==i)return!1;for(const t of this._classes)if(!e._classes.has(t))return!1;for(const t of this._styles.getStyleNames())if(!e._styles.has(t)||e._styles.getAsString(t)!==this._styles.getAsString(t))return!1;return!0}hasClass(...e){for(const t of e)if(!this._classes.has(t))return!1;return!0}getClassNames(){return this._classes.keys()}getStyle(e){return this._styles.getAsString(e)}getNormalizedStyle(e){return this._styles.getNormalized(e)}getStyleNames(e){return this._styles.getStyleNames(e)}hasStyle(...e){for(const t of e)if(!this._styles.has(t))return!1;return!0}findAncestor(...e){const t=new y(...e);let i=this.parent;for(;i&&!i.is("documentFragment");){if(t.match(i))return i;i=i.parent}return null}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}getIdentity(){const e=Array.from(this._classes).sort().join(","),t=this._styles.toString(),i=Array.from(this._attrs).map((e=>`${e[0]}="${e[1]}"`)).sort().join(" ");return this.name+(""==e?"":` class="${e}"`)+(t?` style="${t}"`:"")+(""==i?"":` ${i}`)}shouldRenderUnsafeAttribute(e){return this._unsafeAttributesToRender.includes(e)}_clone(e=!1){const t=[];if(e)for(const i of this.getChildren())t.push(i._clone(e));const i=new this.constructor(this.document,this.name,this._attrs,t);return i._classes=new Set(this._classes),i._styles.set(this._styles.getNormalized()),i._customProperties=new Map(this._customProperties),i.getFillerOffset=this.getFillerOffset,i._unsafeAttributesToRender=this._unsafeAttributesToRender,i}_appendChild(e){return this._insertChild(this.childCount,e)}_insertChild(e,t){this._fireChange("children",this);let i=0;const o=function(e,t){return"string"==typeof t?[new w(e,t)]:((0,n.isIterable)(t)||(t=[t]),Array.from(t).map((t=>"string"==typeof t?new w(e,t):t instanceof v?new w(e,t.data):t)))}(this.document,t);for(const t of o)null!==t.parent&&t._remove(),t.parent=this,t.document=this.document,this._children.splice(e,0,t),e++,i++;return i}_removeChildren(e,t=1){this._fireChange("children",this);for(let i=e;i<e+t;i++)this._children[i].parent=null;return this._children.splice(e,t)}_setAttribute(e,t){const i=String(t);this._fireChange("attributes",this),"class"==e?z(this._classes,i):"style"==e?this._styles.setTo(i):this._attrs.set(e,i)}_removeAttribute(e){return this._fireChange("attributes",this),"class"==e?this._classes.size>0&&(this._classes.clear(),!0):"style"==e?!this._styles.isEmpty&&(this._styles.clear(),!0):this._attrs.delete(e)}_addClass(e){this._fireChange("attributes",this);for(const t of(0,n.toArray)(e))this._classes.add(t)}_removeClass(e){this._fireChange("attributes",this);for(const t of(0,n.toArray)(e))this._classes.delete(t)}_setStyle(e,t){this._fireChange("attributes",this),"string"!=typeof e?this._styles.set(e):this._styles.set(e,t)}_removeStyle(e){this._fireChange("attributes",this);for(const t of(0,n.toArray)(e))this._styles.remove(t)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}}function z(e,t){const i=t.split(/\s+/);e.clear(),i.forEach((t=>e.add(t)))}D.prototype.is=function(e,t){return t?t===this.name&&("element"===e||"view:element"===e):"element"===e||"view:element"===e||"node"===e||"view:node"===e};class W extends D{constructor(e,t,i,n){super(e,t,i,n),this.getFillerOffset=H}}function H(){const e=[...this.getChildren()],t=e[this.childCount-1];if(t&&t.is("element","br"))return this.childCount;for(const t of e)if(!t.is("uiElement"))return null;return this.childCount}W.prototype.is=function(e,t){return t?t===this.name&&("containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e):"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e};class U extends((0,n.ObservableMixin)(W)){constructor(e,t,i,n){super(e,t,i,n),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("placeholder",void 0),this.bind("isReadOnly").to(e),this.bind("isFocused").to(e,"isFocused",(t=>t&&e.selection.editableElement==this)),this.listenTo(e.selection,"change",(()=>{this.isFocused=e.isFocused&&e.selection.editableElement==this}))}destroy(){this.stopListening()}}U.prototype.is=function(e,t){return t?t===this.name&&("editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e):"editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e};const $=Symbol("rootName");class j extends U{constructor(e,t){super(e,t),this.rootName="main"}get rootName(){return this.getCustomProperty($)}set rootName(e){this._setCustomProperty($,e)}set _name(e){this.name=e}}j.prototype.is=function(e,t){return t?t===this.name&&("rootElement"===e||"view:rootElement"===e||"editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e):"rootElement"===e||"view:rootElement"===e||"editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e};class q{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new n.CKEditorError("view-tree-walker-no-start-position",null);if(e.direction&&"forward"!=e.direction&&"backward"!=e.direction)throw new n.CKEditorError("view-tree-walker-unknown-direction",e.startPosition,{direction:e.direction});this.boundaries=e.boundaries||null,e.startPosition?this._position=K._createAt(e.startPosition):this._position=K._createAt(e.boundaries["backward"==e.direction?"end":"start"]),this.direction=e.direction||"forward",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null}[Symbol.iterator](){return this}get position(){return this._position}skip(e){let t,i;do{i=this.position,t=this.next()}while(!t.done&&e(t.value));t.done||(this._position=i)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){let e=this.position.clone();const t=this.position,i=e.parent;if(null===i.parent&&e.offset===i.childCount)return{done:!0,value:void 0};if(i===this._boundaryEndParent&&e.offset==this.boundaries.end.offset)return{done:!0,value:void 0};let n;if(i instanceof w){if(e.isAtEnd)return this._position=K._createAfter(i),this._next();n=i.data[e.offset]}else n=i.getChild(e.offset);if(n instanceof D){if(this.shallow){if(this.boundaries&&this.boundaries.end.isBefore(e))return{done:!0,value:void 0};e.offset++}else e=new K(n,0);return this._position=e,this._formatReturnValue("elementStart",n,t,e,1)}if(n instanceof w){if(this.singleCharacters)return e=new K(n,0),this._position=e,this._next();let i,o=n.data.length;return n==this._boundaryEndParent?(o=this.boundaries.end.offset,i=new v(n,0,o),e=K._createAfter(i)):(i=new v(n,0,n.data.length),e.offset++),this._position=e,this._formatReturnValue("text",i,t,e,o)}if("string"==typeof n){let n;n=this.singleCharacters?1:(i===this._boundaryEndParent?this.boundaries.end.offset:i.data.length)-e.offset;const o=new v(i,e.offset,n);return e.offset+=n,this._position=e,this._formatReturnValue("text",o,t,e,n)}return e=K._createAfter(i),this._position=e,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",i,t,e)}_previous(){let e=this.position.clone();const t=this.position,i=e.parent;if(null===i.parent&&0===e.offset)return{done:!0,value:void 0};if(i==this._boundaryStartParent&&e.offset==this.boundaries.start.offset)return{done:!0,value:void 0};let n;if(i instanceof w){if(e.isAtStart)return this._position=K._createBefore(i),this._previous();n=i.data[e.offset-1]}else n=i.getChild(e.offset-1);if(n instanceof D)return this.shallow?(e.offset--,this._position=e,this._formatReturnValue("elementStart",n,t,e,1)):(e=new K(n,n.childCount),this._position=e,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",n,t,e));if(n instanceof w){if(this.singleCharacters)return e=new K(n,n.data.length),this._position=e,this._previous();let i,o=n.data.length;if(n==this._boundaryStartParent){const t=this.boundaries.start.offset;i=new v(n,t,n.data.length-t),o=i.data.length,e=K._createBefore(i)}else i=new v(n,0,n.data.length),e.offset--;return this._position=e,this._formatReturnValue("text",i,t,e,o)}if("string"==typeof n){let n;if(this.singleCharacters)n=1;else{const t=i===this._boundaryStartParent?this.boundaries.start.offset:0;n=e.offset-t}e.offset-=n;const o=new v(i,e.offset,n);return this._position=e,this._formatReturnValue("text",o,t,e,n)}return e=K._createBefore(i),this._position=e,this._formatReturnValue("elementStart",i,t,e,1)}_formatReturnValue(e,t,i,n,o){return t instanceof v&&(t.offsetInText+t.data.length==t.textNode.data.length&&("forward"!=this.direction||this.boundaries&&this.boundaries.end.isEqual(this.position)?i=K._createAfter(t.textNode):(n=K._createAfter(t.textNode),this._position=n)),0===t.offsetInText&&("backward"!=this.direction||this.boundaries&&this.boundaries.start.isEqual(this.position)?i=K._createBefore(t.textNode):(n=K._createBefore(t.textNode),this._position=n))),{done:!1,value:{type:e,item:t,previousPosition:i,nextPosition:n,length:o}}}}class K extends g{constructor(e,t){super(),this.parent=e,this.offset=t}get nodeAfter(){return this.parent.is("$text")?null:this.parent.getChild(this.offset)||null}get nodeBefore(){return this.parent.is("$text")?null:this.parent.getChild(this.offset-1)||null}get isAtStart(){return 0===this.offset}get isAtEnd(){const e=this.parent.is("$text")?this.parent.data.length:this.parent.childCount;return this.offset===e}get root(){return this.parent.root}get editableElement(){let e=this.parent;for(;!(e instanceof U);){if(!e.parent)return null;e=e.parent}return e}getShiftedBy(e){const t=K._createAt(this),i=t.offset+e;return t.offset=i<0?0:i,t}getLastMatchingPosition(e,t={}){t.startPosition=this;const i=new q(t);return i.skip(e),i.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(e){const t=this.getAncestors(),i=e.getAncestors();let n=0;for(;t[n]==i[n]&&t[n];)n++;return 0===n?null:t[n-1]}isEqual(e){return this.parent==e.parent&&this.offset==e.offset}isBefore(e){return"before"==this.compareWith(e)}isAfter(e){return"after"==this.compareWith(e)}compareWith(e){if(this.root!==e.root)return"different";if(this.isEqual(e))return"same";const t=this.parent.is("node")?this.parent.getPath():[],i=e.parent.is("node")?e.parent.getPath():[];t.push(this.offset),i.push(e.offset);const o=(0,n.compareArrays)(t,i);switch(o){case"prefix":return"before";case"extension":return"after";default:return t[o]<i[o]?"before":"after"}}getWalker(e={}){return e.startPosition=this,new q(e)}clone(){return new K(this.parent,this.offset)}static _createAt(e,t){if(e instanceof K)return new this(e.parent,e.offset);{const i=e;if("end"==t)t=i.is("$text")?i.data.length:i.childCount;else{if("before"==t)return this._createBefore(i);if("after"==t)return this._createAfter(i);if(0!==t&&!t)throw new n.CKEditorError("view-createpositionat-offset-required",i)}return new K(i,t)}}static _createAfter(e){if(e.is("$textProxy"))return new K(e.textNode,e.offsetInText+e.data.length);if(!e.parent)throw new n.CKEditorError("view-position-after-root",e,{root:e});return new K(e.parent,e.index+1)}static _createBefore(e){if(e.is("$textProxy"))return new K(e.textNode,e.offsetInText);if(!e.parent)throw new n.CKEditorError("view-position-before-root",e,{root:e});return new K(e.parent,e.index)}}K.prototype.is=function(e){return"position"===e||"view:position"===e};class G extends g{constructor(e,t=null){super(),this.start=e.clone(),this.end=t?t.clone():e.clone()}*[Symbol.iterator](){yield*new q({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return this.start.parent===this.end.parent}get root(){return this.start.root}getEnlarged(){let e=this.start.getLastMatchingPosition(Z,{direction:"backward"}),t=this.end.getLastMatchingPosition(Z);return e.parent.is("$text")&&e.isAtStart&&(e=K._createBefore(e.parent)),t.parent.is("$text")&&t.isAtEnd&&(t=K._createAfter(t.parent)),new G(e,t)}getTrimmed(){let e=this.start.getLastMatchingPosition(Z);if(e.isAfter(this.end)||e.isEqual(this.end))return new G(e,e);let t=this.end.getLastMatchingPosition(Z,{direction:"backward"});const i=e.nodeAfter,n=t.nodeBefore;return i&&i.is("$text")&&(e=new K(i,0)),n&&n.is("$text")&&(t=new K(n,n.data.length)),new G(e,t)}isEqual(e){return this==e||this.start.isEqual(e.start)&&this.end.isEqual(e.end)}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);const i=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),n=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return i&&n}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new G(this.start,e.start)),this.containsPosition(e.end)&&t.push(new G(e.end,this.end))):t.push(this.clone()),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,i=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(i=e.end),new G(t,i)}return null}getWalker(e={}){return e.boundaries=this,new q(e)}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;let e=this.start.nodeAfter,t=this.end.nodeBefore;return this.start.parent.is("$text")&&this.start.isAtEnd&&this.start.parent.nextSibling&&(e=this.start.parent.nextSibling),this.end.parent.is("$text")&&this.end.isAtStart&&this.end.parent.previousSibling&&(t=this.end.parent.previousSibling),e&&e.is("element")&&e===t?e:null}clone(){return new G(this.start,this.end)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new q(e);for(const e of t)yield e.item}*getPositions(e={}){e.boundaries=this;const t=new q(e);yield t.position;for(const e of t)yield e.nextPosition}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}static _createFromParentsAndOffsets(e,t,i,n){return new this(new K(e,t),new K(i,n))}static _createFromPositionAndShift(e,t){const i=e,n=e.getShiftedBy(t);return t>0?new this(i,n):new this(n,i)}static _createIn(e){return this._createFromParentsAndOffsets(e,0,e,e.childCount)}static _createOn(e){const t=e.is("$textProxy")?e.offsetSize:1;return this._createFromPositionAndShift(K._createBefore(e),t)}}function Z(e){return!(!e.item.is("attributeElement")&&!e.item.is("uiElement"))}G.prototype.is=function(e){return"range"===e||"view:range"===e};class J extends((0,n.EmitterMixin)(g)){constructor(...e){super(),this._ranges=[],this._lastRangeBackward=!1,this._isFake=!1,this._fakeSelectionLabel="",e.length&&this.setTo(...e)}get isFake(){return this._isFake}get fakeSelectionLabel(){return this._fakeSelectionLabel}get anchor(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.end:e.start).clone()}get focus(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.start:e.end).clone()}get isCollapsed(){return 1===this.rangeCount&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}get editableElement(){return this.anchor?this.anchor.editableElement:null}*getRanges(){for(const e of this._ranges)yield e.clone()}getFirstRange(){let e=null;for(const t of this._ranges)e&&!t.start.isBefore(e.start)||(e=t);return e?e.clone():null}getLastRange(){let e=null;for(const t of this._ranges)e&&!t.end.isAfter(e.end)||(e=t);return e?e.clone():null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}isEqual(e){if(this.isFake!=e.isFake)return!1;if(this.isFake&&this.fakeSelectionLabel!=e.fakeSelectionLabel)return!1;if(this.rangeCount!=e.rangeCount)return!1;if(0===this.rangeCount)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let i=!1;for(const n of e._ranges)if(t.isEqual(n)){i=!0;break}if(!i)return!1}return!0}isSimilar(e){if(this.isBackward!=e.isBackward)return!1;const t=(0,n.count)(this.getRanges());if(t!=(0,n.count)(e.getRanges()))return!1;if(0==t)return!0;for(let t of this.getRanges()){t=t.getTrimmed();let i=!1;for(let n of e.getRanges())if(n=n.getTrimmed(),t.start.isEqual(n.start)&&t.end.isEqual(n.end)){i=!0;break}if(!i)return!1}return!0}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}setTo(...e){let[t,i,o]=e;if("object"==typeof i&&(o=i,i=void 0),null===t)this._setRanges([]),this._setFakeOptions(o);else if(t instanceof J||t instanceof Q)this._setRanges(t.getRanges(),t.isBackward),this._setFakeOptions({fake:t.isFake,label:t.fakeSelectionLabel});else if(t instanceof G)this._setRanges([t],o&&o.backward),this._setFakeOptions(o);else if(t instanceof K)this._setRanges([new G(t)]),this._setFakeOptions(o);else if(t instanceof b){const e=!!o&&!!o.backward;let s;if(void 0===i)throw new n.CKEditorError("view-selection-setto-required-second-parameter",this);s="in"==i?G._createIn(t):"on"==i?G._createOn(t):new G(K._createAt(t,i)),this._setRanges([s],e),this._setFakeOptions(o)}else{if(!(0,n.isIterable)(t))throw new n.CKEditorError("view-selection-setto-not-selectable",this);this._setRanges(t,o&&o.backward),this._setFakeOptions(o)}this.fire("change")}setFocus(e,t){if(null===this.anchor)throw new n.CKEditorError("view-selection-setfocus-no-ranges",this);const i=K._createAt(e,t);if("same"==i.compareWith(this.focus))return;const o=this.anchor;this._ranges.pop(),"before"==i.compareWith(o)?this._addRange(new G(i,o),!0):this._addRange(new G(o,i)),this.fire("change")}_setRanges(e,t=!1){e=Array.from(e),this._ranges=[];for(const t of e)this._addRange(t);this._lastRangeBackward=!!t}_setFakeOptions(e={}){this._isFake=!!e.fake,this._fakeSelectionLabel=e.fake&&e.label||""}_addRange(e,t=!1){if(!(e instanceof G))throw new n.CKEditorError("view-selection-add-range-not-range",this);this._pushRange(e),this._lastRangeBackward=!!t}_pushRange(e){for(const t of this._ranges)if(e.isIntersecting(t))throw new n.CKEditorError("view-selection-range-intersects",this,{addedRange:e,intersectingRange:t});this._ranges.push(new G(e.start,e.end))}}J.prototype.is=function(e){return"selection"===e||"view:selection"===e};class Q extends((0,n.EmitterMixin)(g)){constructor(...e){super(),this._selection=new J,this._selection.delegate("change").to(this),e.length&&this._selection.setTo(...e)}get isFake(){return this._selection.isFake}get fakeSelectionLabel(){return this._selection.fakeSelectionLabel}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get isCollapsed(){return this._selection.isCollapsed}get rangeCount(){return this._selection.rangeCount}get isBackward(){return this._selection.isBackward}get editableElement(){return this._selection.editableElement}get _ranges(){return this._selection._ranges}*getRanges(){yield*this._selection.getRanges()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getSelectedElement(){return this._selection.getSelectedElement()}isEqual(e){return this._selection.isEqual(e)}isSimilar(e){return this._selection.isSimilar(e)}_setTo(...e){this._selection.setTo(...e)}_setFocus(e,t){this._selection.setFocus(e,t)}}Q.prototype.is=function(e){return"selection"===e||"documentSelection"==e||"view:selection"==e||"view:documentSelection"==e};class Y extends n.EventInfo{constructor(e,t,i){super(e,t),this.startRange=i,this._eventPhase="none",this._currentTarget=null}get eventPhase(){return this._eventPhase}get currentTarget(){return this._currentTarget}}const X=Symbol("bubbling contexts");function ee(e){return class extends e{fire(e,...t){try{const i=e instanceof n.EventInfo?e:new n.EventInfo(this,e),o=oe(this);if(!o.size)return;if(te(i,"capturing",this),ie(o,"$capture",i,...t))return i.return;const s=i.startRange||this.selection.getFirstRange(),r=s?s.getContainedElement():null,a=!!r&&Boolean(ne(o,r));let l=r||function(e){if(!e)return null;const t=e.start.parent,i=e.end.parent,n=t.getPath(),o=i.getPath();return n.length>o.length?t:i}(s);if(te(i,"atTarget",l),!a){if(ie(o,"$text",i,...t))return i.return;te(i,"bubbling",l)}for(;l;){if(l.is("rootElement")){if(ie(o,"$root",i,...t))return i.return}else if(l.is("element")&&ie(o,l.name,i,...t))return i.return;if(ie(o,l,i,...t))return i.return;l=l.parent,te(i,"bubbling",l)}return te(i,"bubbling",this),ie(o,"$document",i,...t),i.return}catch(e){n.CKEditorError.rethrowUnexpectedError(e,this)}}_addEventListener(e,t,i){const o=(0,n.toArray)(i.context||"$document"),s=oe(this);for(const r of o){let o=s.get(r);o||(o=new((0,n.EmitterMixin)()),s.set(r,o)),this.listenTo(o,e,t,i)}}_removeEventListener(e,t){const i=oe(this);for(const n of i.values())this.stopListening(n,e,t)}}}{const e=ee(Object);["fire","_addEventListener","_removeEventListener"].forEach((t=>{ee[t]=e.prototype[t]}))}function te(e,t,i){e instanceof Y&&(e._eventPhase=t,e._currentTarget=i)}function ie(e,t,i,...n){const o="string"==typeof t?e.get(t):ne(e,t);return!!o&&(o.fire(i,...n),i.stop.called)}function ne(e,t){for(const[i,n]of e)if("function"==typeof i&&i(t))return n;return null}function oe(e){return e[X]||(e[X]=new Map),e[X]}class se extends(ee((0,n.ObservableMixin)())){constructor(e){super(),this._postFixers=new Set,this.selection=new Q,this.roots=new n.Collection({idProperty:"rootName"}),this.stylesProcessor=e,this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isSelecting",!1),this.set("isComposing",!1)}getRoot(e="main"){return this.roots.get(e)}registerPostFixer(e){this._postFixers.add(e)}destroy(){this.roots.forEach((e=>e.destroy())),this.stopListening()}_callPostFixers(e){let t=!1;do{for(const i of this._postFixers)if(t=i(e),t)break}while(t)}}class re extends D{constructor(e,t,i,n){super(e,t,i,n),this._priority=10,this._id=null,this._clonesGroup=null,this.getFillerOffset=le}get priority(){return this._priority}get id(){return this._id}getElementsWithSameId(){if(null===this.id)throw new n.CKEditorError("attribute-element-get-elements-with-same-id-no-id",this);return new Set(this._clonesGroup)}isSimilar(e){return null!==this.id||null!==e.id?this.id===e.id:super.isSimilar(e)&&this.priority==e.priority}_clone(e=!1){const t=super._clone(e);return t._priority=this._priority,t._id=this._id,t}}re.DEFAULT_PRIORITY=10;const ae=re;function le(){if(ce(this))return null;let e=this.parent;for(;e&&e.is("attributeElement");){if(ce(e)>1)return null;e=e.parent}return!e||ce(e)>1?null:this.childCount}function ce(e){return Array.from(e.getChildren()).filter((e=>!e.is("uiElement"))).length}re.prototype.is=function(e,t){return t?t===this.name&&("attributeElement"===e||"view:attributeElement"===e||"element"===e||"view:element"===e):"attributeElement"===e||"view:attributeElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e};class de extends D{constructor(e,t,i,n){super(e,t,i,n),this.getFillerOffset=ue}_insertChild(e,t){if(t&&(t instanceof b||Array.from(t).length>0))throw new n.CKEditorError("view-emptyelement-cannot-add",[this,t]);return 0}}function ue(){return null}de.prototype.is=function(e,t){return t?t===this.name&&("emptyElement"===e||"view:emptyElement"===e||"element"===e||"view:element"===e):"emptyElement"===e||"view:emptyElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e};class he extends D{constructor(e,t,i,n){super(e,t,i,n),this.getFillerOffset=me}_insertChild(e,t){if(t&&(t instanceof b||Array.from(t).length>0))throw new n.CKEditorError("view-uielement-cannot-add",[this,t]);return 0}render(e,t){return this.toDomElement(e)}toDomElement(e){const t=e.createElement(this.name);for(const e of this.getAttributeKeys())t.setAttribute(e,this.getAttribute(e));return t}}function me(){return null}he.prototype.is=function(e,t){return t?t===this.name&&("uiElement"===e||"view:uiElement"===e||"element"===e||"view:element"===e):"uiElement"===e||"view:uiElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e};class ge extends D{constructor(e,t,i,n){super(e,t,i,n),this.getFillerOffset=fe}_insertChild(e,t){if(t&&(t instanceof b||Array.from(t).length>0))throw new n.CKEditorError("view-rawelement-cannot-add",[this,t]);return 0}render(e,t){}}function fe(){return null}ge.prototype.is=function(e,t){return t?t===this.name&&("rawElement"===e||"view:rawElement"===e||"element"===e||"view:element"===e):"rawElement"===e||"view:rawElement"===e||e===this.name||e==="view:"+this.name||"element"===e||"view:element"===e||"node"===e||"view:node"===e};class pe extends((0,n.EmitterMixin)(g)){constructor(e,t){super(),this._children=[],this._customProperties=new Map,this.document=e,t&&this._insertChild(0,t)}[Symbol.iterator](){return this._children[Symbol.iterator]()}get childCount(){return this._children.length}get isEmpty(){return 0===this.childCount}get root(){return this}get parent(){return null}get name(){}get getFillerOffset(){}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}_appendChild(e){return this._insertChild(this.childCount,e)}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}_insertChild(e,t){this._fireChange("children",this);let i=0;const o=function(e,t){return"string"==typeof t?[new w(e,t)]:((0,n.isIterable)(t)||(t=[t]),Array.from(t).map((t=>"string"==typeof t?new w(e,t):t instanceof v?new w(e,t.data):t)))}(this.document,t);for(const t of o)null!==t.parent&&t._remove(),t.parent=this,this._children.splice(e,0,t),e++,i++;return i}_removeChildren(e,t=1){this._fireChange("children",this);for(let i=e;i<e+t;i++)this._children[i].parent=null;return this._children.splice(e,t)}_fireChange(e,t){this.fire("change:"+e,t)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}}pe.prototype.is=function(e){return"documentFragment"===e||"view:documentFragment"===e};class be{constructor(e){this._cloneGroups=new Map,this._slotFactory=null,this.document=e}setSelection(...e){this.document.selection._setTo(...e)}setSelectionFocus(e,t){this.document.selection._setFocus(e,t)}createDocumentFragment(e){return new pe(this.document,e)}createText(e){return new w(this.document,e)}createAttributeElement(e,t,i={}){const n=new ae(this.document,e,t);return"number"==typeof i.priority&&(n._priority=i.priority),i.id&&(n._id=i.id),i.renderUnsafeAttributes&&n._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),n}createContainerElement(e,t,i={},n={}){let o=null;(0,_.A)(i)?n=i:o=i;const s=new W(this.document,e,t,o);return n.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),s}createEditableElement(e,t,i={}){const n=new U(this.document,e,t);return i.renderUnsafeAttributes&&n._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),n}createEmptyElement(e,t,i={}){const n=new de(this.document,e,t);return i.renderUnsafeAttributes&&n._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),n}createUIElement(e,t,i){const n=new he(this.document,e,t);return i&&(n.render=i),n}createRawElement(e,t,i,n={}){const o=new ge(this.document,e,t);return i&&(o.render=i),n.renderUnsafeAttributes&&o._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),o}setAttribute(e,t,i){i._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,i){(0,_.A)(e)&&void 0===i?t._setStyle(e):i._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,i){i._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}breakAttributes(e){return e instanceof K?this._breakAttributes(e):this._breakAttributesRange(e)}breakContainer(e){const t=e.parent;if(!t.is("containerElement"))throw new n.CKEditorError("view-writer-break-non-container-element",this.document);if(!t.parent)throw new n.CKEditorError("view-writer-break-root",this.document);if(e.isAtStart)return K._createBefore(t);if(!e.isAtEnd){const i=t._clone(!1);this.insert(K._createAfter(t),i);const n=new G(e,K._createAt(t,"end")),o=new K(i,0);this.move(n,o)}return K._createAfter(t)}mergeAttributes(e){const t=e.offset,i=e.parent;if(i.is("$text"))return e;if(i.is("attributeElement")&&0===i.childCount){const e=i.parent,t=i.index;return i._remove(),this._removeFromClonedElementsGroup(i),this.mergeAttributes(new K(e,t))}const n=i.getChild(t-1),o=i.getChild(t);if(!n||!o)return e;if(n.is("$text")&&o.is("$text"))return ye(n,o);if(n.is("attributeElement")&&o.is("attributeElement")&&n.isSimilar(o)){const e=n.childCount;return n._appendChild(o.getChildren()),o._remove(),this._removeFromClonedElementsGroup(o),this.mergeAttributes(new K(n,e))}return e}mergeContainers(e){const t=e.nodeBefore,i=e.nodeAfter;if(!(t&&i&&t.is("containerElement")&&i.is("containerElement")))throw new n.CKEditorError("view-writer-merge-containers-invalid-position",this.document);const o=t.getChild(t.childCount-1),s=o instanceof w?K._createAt(o,"end"):K._createAt(t,"end");return this.move(G._createIn(i),K._createAt(t,"end")),this.remove(G._createOn(i)),s}insert(e,t){Ce(t=(0,n.isIterable)(t)?[...t]:[t],this.document);const i=t.reduce(((e,t)=>{const i=e[e.length-1],n=!t.is("uiElement");return i&&i.breakAttributes==n?i.nodes.push(t):e.push({breakAttributes:n,nodes:[t]}),e}),[]);let o=null,s=e;for(const{nodes:e,breakAttributes:t}of i){const i=this._insertNodes(s,e,t);o||(o=i.start),s=i.end}return o?new G(o,s):new G(e)}remove(e){const t=e instanceof G?e:G._createOn(e);if(Ee(t,this.document),t.isCollapsed)return new pe(this.document);const{start:i,end:n}=this._breakAttributesRange(t,!0),o=i.parent,s=n.offset-i.offset,r=o._removeChildren(i.offset,s);for(const e of r)this._removeFromClonedElementsGroup(e);const a=this.mergeAttributes(i);return t.start=a,t.end=a.clone(),new pe(this.document,r)}clear(e,t){Ee(e,this.document);const i=e.getWalker({direction:"backward",ignoreElementEnd:!0});for(const n of i){const i=n.item;let o;if(i.is("element")&&t.isSimilar(i))o=G._createOn(i);else if(!n.nextPosition.isAfter(e.start)&&i.is("$textProxy")){const e=i.getAncestors().find((e=>e.is("element")&&t.isSimilar(e)));e&&(o=G._createIn(e))}o&&(o.end.isAfter(e.end)&&(o.end=e.end),o.start.isBefore(e.start)&&(o.start=e.start),this.remove(o))}}move(e,t){let i;if(t.isAfter(e.end)){const n=(t=this._breakAttributes(t,!0)).parent,o=n.childCount;e=this._breakAttributesRange(e,!0),i=this.remove(e),t.offset+=n.childCount-o}else i=this.remove(e);return this.insert(t,i)}wrap(e,t){if(!(t instanceof ae))throw new n.CKEditorError("view-writer-wrap-invalid-attribute",this.document);if(Ee(e,this.document),e.isCollapsed){let n=e.start;n.parent.is("element")&&(i=n.parent,!Array.from(i.getChildren()).some((e=>!e.is("uiElement"))))&&(n=n.getLastMatchingPosition((e=>e.item.is("uiElement")))),n=this._wrapPosition(n,t);const o=this.document.selection;return o.isCollapsed&&o.getFirstPosition().isEqual(e.start)&&this.setSelection(n),new G(n)}return this._wrapRange(e,t);var i}unwrap(e,t){if(!(t instanceof ae))throw new n.CKEditorError("view-writer-unwrap-invalid-attribute",this.document);if(Ee(e,this.document),e.isCollapsed)return e;const{start:i,end:o}=this._breakAttributesRange(e,!0),s=i.parent,r=this._unwrapChildren(s,i.offset,o.offset,t),a=this.mergeAttributes(r.start);a.isEqual(r.start)||r.end.offset--;const l=this.mergeAttributes(r.end);return new G(a,l)}rename(e,t){const i=new W(this.document,e,t.getAttributes());return this.insert(K._createAfter(t),i),this.move(G._createIn(t),K._createAt(i,0)),this.remove(G._createOn(t)),i}clearClonedElementsGroup(e){this._cloneGroups.delete(e)}createPositionAt(e,t){return K._createAt(e,t)}createPositionAfter(e){return K._createAfter(e)}createPositionBefore(e){return K._createBefore(e)}createRange(e,t){return new G(e,t)}createRangeOn(e){return G._createOn(e)}createRangeIn(e){return G._createIn(e)}createSelection(...e){return new J(...e)}createSlot(e="children"){if(!this._slotFactory)throw new n.CKEditorError("view-writer-invalid-create-slot-context",this.document);return this._slotFactory(this,e)}_registerSlotFactory(e){this._slotFactory=e}_clearSlotFactory(){this._slotFactory=null}_insertNodes(e,t,i){let o,s;if(o=i?we(e):e.parent.is("$text")?e.parent.parent:e.parent,!o)throw new n.CKEditorError("view-writer-invalid-position-container",this.document);s=i?this._breakAttributes(e,!0):e.parent.is("$text")?_e(e):e;const r=o._insertChild(s.offset,t);for(const e of t)this._addToClonedElementsGroup(e);const a=s.getShiftedBy(r),l=this.mergeAttributes(s);l.isEqual(s)||a.offset--;const c=this.mergeAttributes(a);return new G(l,c)}_wrapChildren(e,t,i,n){let o=t;const s=[];for(;o<i;){const t=e.getChild(o),i=t.is("$text"),l=t.is("attributeElement");if(l&&this._wrapAttributeElement(n,t))s.push(new K(e,o));else if(i||!l||(a=t,(r=n).priority<a.priority||!(r.priority>a.priority)&&r.getIdentity()<a.getIdentity())){const i=n._clone();t._remove(),i._appendChild(t),e._insertChild(o,i),this._addToClonedElementsGroup(i),s.push(new K(e,o))}else this._wrapChildren(t,0,t.childCount,n);o++}var r,a;let l=0;for(const e of s)e.offset-=l,e.offset!=t&&(this.mergeAttributes(e).isEqual(e)||(l++,i--));return G._createFromParentsAndOffsets(e,t,e,i)}_unwrapChildren(e,t,i,n){let o=t;const s=[];for(;o<i;){const t=e.getChild(o);if(t.is("attributeElement"))if(t.isSimilar(n)){const n=t.getChildren(),r=t.childCount;t._remove(),e._insertChild(o,n),this._removeFromClonedElementsGroup(t),s.push(new K(e,o),new K(e,o+r)),o+=r,i+=r-1}else this._unwrapAttributeElement(n,t)?(s.push(new K(e,o),new K(e,o+1)),o++):(this._unwrapChildren(t,0,t.childCount,n),o++);else o++}let r=0;for(const e of s)e.offset-=r,e.offset!=t&&e.offset!=i&&(this.mergeAttributes(e).isEqual(e)||(r++,i--));return G._createFromParentsAndOffsets(e,t,e,i)}_wrapRange(e,t){const{start:i,end:n}=this._breakAttributesRange(e,!0),o=i.parent,s=this._wrapChildren(o,i.offset,n.offset,t),r=this.mergeAttributes(s.start);r.isEqual(s.start)||s.end.offset--;const a=this.mergeAttributes(s.end);return new G(r,a)}_wrapPosition(e,t){if(t.isSimilar(e.parent))return ve(e.clone());e.parent.is("$text")&&(e=_e(e));const i=this.createAttributeElement("_wrapPosition-fake-element");i._priority=Number.POSITIVE_INFINITY,i.isSimilar=()=>!1,e.parent._insertChild(e.offset,i);const n=new G(e,e.getShiftedBy(1));this.wrap(n,t);const o=new K(i.parent,i.index);i._remove();const s=o.nodeBefore,r=o.nodeAfter;return s instanceof w&&r instanceof w?ye(s,r):ve(o)}_wrapAttributeElement(e,t){if(!xe(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const i of e.getAttributeKeys())if("class"!==i&&"style"!==i&&t.hasAttribute(i)&&t.getAttribute(i)!==e.getAttribute(i))return!1;for(const i of e.getStyleNames())if(t.hasStyle(i)&&t.getStyle(i)!==e.getStyle(i))return!1;for(const i of e.getAttributeKeys())"class"!==i&&"style"!==i&&(t.hasAttribute(i)||this.setAttribute(i,e.getAttribute(i),t));for(const i of e.getStyleNames())t.hasStyle(i)||this.setStyle(i,e.getStyle(i),t);for(const i of e.getClassNames())t.hasClass(i)||this.addClass(i,t);return!0}_unwrapAttributeElement(e,t){if(!xe(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const i of e.getAttributeKeys())if("class"!==i&&"style"!==i&&(!t.hasAttribute(i)||t.getAttribute(i)!==e.getAttribute(i)))return!1;if(!t.hasClass(...e.getClassNames()))return!1;for(const i of e.getStyleNames())if(!t.hasStyle(i)||t.getStyle(i)!==e.getStyle(i))return!1;for(const i of e.getAttributeKeys())"class"!==i&&"style"!==i&&this.removeAttribute(i,t);return this.removeClass(Array.from(e.getClassNames()),t),this.removeStyle(Array.from(e.getStyleNames()),t),!0}_breakAttributesRange(e,t=!1){const i=e.start,n=e.end;if(Ee(e,this.document),e.isCollapsed){const i=this._breakAttributes(e.start,t);return new G(i,i)}const o=this._breakAttributes(n,t),s=o.parent.childCount,r=this._breakAttributes(i,t);return o.offset+=o.parent.childCount-s,new G(r,o)}_breakAttributes(e,t=!1){const i=e.offset,o=e.parent;if(e.parent.is("emptyElement"))throw new n.CKEditorError("view-writer-cannot-break-empty-element",this.document);if(e.parent.is("uiElement"))throw new n.CKEditorError("view-writer-cannot-break-ui-element",this.document);if(e.parent.is("rawElement"))throw new n.CKEditorError("view-writer-cannot-break-raw-element",this.document);if(!t&&o.is("$text")&&Ae(o.parent))return e.clone();if(Ae(o))return e.clone();if(o.is("$text"))return this._breakAttributes(_e(e),t);if(i==o.childCount){const e=new K(o.parent,o.index+1);return this._breakAttributes(e,t)}if(0===i){const e=new K(o.parent,o.index);return this._breakAttributes(e,t)}{const e=o.index+1,n=o._clone();o.parent._insertChild(e,n),this._addToClonedElementsGroup(n);const s=o.childCount-i,r=o._removeChildren(i,s);n._appendChild(r);const a=new K(o.parent,e);return this._breakAttributes(a,t)}}_addToClonedElementsGroup(e){if(!e.root.is("rootElement"))return;if(e.is("element"))for(const t of e.getChildren())this._addToClonedElementsGroup(t);const t=e.id;if(!t)return;let i=this._cloneGroups.get(t);i||(i=new Set,this._cloneGroups.set(t,i)),i.add(e),e._clonesGroup=i}_removeFromClonedElementsGroup(e){if(e.is("element"))for(const t of e.getChildren())this._removeFromClonedElementsGroup(t);const t=e.id;if(!t)return;const i=this._cloneGroups.get(t);i&&i.delete(e)}}function we(e){let t=e.parent;for(;!Ae(t);){if(!t)return;t=t.parent}return t}function ve(e){const t=e.nodeBefore;if(t&&t.is("$text"))return new K(t,t.data.length);const i=e.nodeAfter;return i&&i.is("$text")?new K(i,0):e}function _e(e){if(e.offset==e.parent.data.length)return new K(e.parent.parent,e.parent.index+1);if(0===e.offset)return new K(e.parent.parent,e.parent.index);const t=e.parent.data.slice(e.offset);return e.parent._data=e.parent.data.slice(0,e.offset),e.parent.parent._insertChild(e.parent.index+1,new w(e.root.document,t)),new K(e.parent.parent,e.parent.index+1)}function ye(e,t){const i=e.data.length;return e._data+=t.data,t._remove(),new K(e,i)}const ke=[w,ae,W,de,ge,he];function Ce(e,t){for(const i of e){if(!ke.some((e=>i instanceof e)))throw new n.CKEditorError("view-writer-insert-invalid-node-type",t);i.is("$text")||Ce(i.getChildren(),t)}}function Ae(e){return e&&(e.is("containerElement")||e.is("documentFragment"))}function Ee(e,t){const i=we(e.start),o=we(e.end);if(!i||!o||i!==o)throw new n.CKEditorError("view-writer-invalid-range-container",t)}function xe(e,t){return null===e.id&&null===t.id}const Te=e=>e.createTextNode(" "),Pe=e=>{const t=e.createElement("span");return t.dataset.ckeFiller="true",t.innerText=" ",t},Ie=e=>{const t=e.createElement("br");return t.dataset.ckeFiller="true",t},Se=7,Ve="⁠".repeat(Se);function Re(e){return"string"==typeof e?e.substr(0,Se)===Ve:(0,n.isText)(e)&&e.data.substr(0,Se)===Ve}function Be(e){return e.data.length==Se&&Re(e)}function Me(e){const t="string"==typeof e?e:e.data;return Re(e)?t.slice(Se):t}function Oe(e,t){if(t.keyCode==n.keyCodes.arrowleft){const e=t.domTarget.ownerDocument.defaultView.getSelection();if(1==e.rangeCount&&e.getRangeAt(0).collapsed){const t=e.getRangeAt(0).startContainer,i=e.getRangeAt(0).startOffset;Re(t)&&i<=Se&&e.collapse(t,0)}}}class Le extends((0,n.ObservableMixin)()){constructor(e,t){super(),this.domDocuments=new Set,this.markedAttributes=new Set,this.markedChildren=new Set,this.markedTexts=new Set,this._inlineFiller=null,this._fakeSelectionContainer=null,this.domConverter=e,this.selection=t,this.set("isFocused",!1),this.set("isSelecting",!1),this.set("isComposing",!1),n.env.isBlink&&!n.env.isAndroid&&this.on("change:isSelecting",(()=>{this.isSelecting||this.render()}))}markToSync(e,t){if("text"===e)this.domConverter.mapViewToDom(t.parent)&&this.markedTexts.add(t);else{if(!this.domConverter.mapViewToDom(t))return;if("attributes"===e)this.markedAttributes.add(t);else{if("children"!==e)throw new n.CKEditorError("view-renderer-unknown-type",this);this.markedChildren.add(t)}}}render(){if(this.isComposing&&!n.env.isAndroid)return;let e=null;const t=!(n.env.isBlink&&!n.env.isAndroid&&this.isSelecting);for(const e of this.markedChildren)this._updateChildrenMappings(e);t?(this._inlineFiller&&!this._isSelectionInInlineFiller()&&this._removeInlineFiller(),this._inlineFiller?e=this._getInlineFillerPosition():this._needsInlineFillerAtSelection()&&(e=this.selection.getFirstPosition(),this.markedChildren.add(e.parent))):this._inlineFiller&&this._inlineFiller.parentNode&&(e=this.domConverter.domPositionToView(this._inlineFiller),e&&e.parent.is("$text")&&(e=K._createBefore(e.parent)));for(const e of this.markedAttributes)this._updateAttrs(e);for(const t of this.markedChildren)this._updateChildren(t,{inlineFillerPosition:e});for(const t of this.markedTexts)!this.markedChildren.has(t.parent)&&this.domConverter.mapViewToDom(t.parent)&&this._updateText(t,{inlineFillerPosition:e});if(t)if(e){const t=this.domConverter.viewPositionToDom(e),i=t.parent.ownerDocument;Re(t.parent)?this._inlineFiller=t.parent:this._inlineFiller=Fe(i,t.parent,t.offset)}else this._inlineFiller=null;this._updateFocus(),this._updateSelection(),this.domConverter._clearTemporaryCustomProperties(),this.markedTexts.clear(),this.markedAttributes.clear(),this.markedChildren.clear()}_updateChildrenMappings(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const i=Array.from(t.childNodes),o=Array.from(this.domConverter.viewChildrenToDom(e,{withChildren:!1})),s=this._diffNodeLists(i,o),r=this._findUpdateActions(s,i,o,Ne);if(-1!==r.indexOf("update")){const t={equal:0,insert:0,delete:0};for(const s of r)if("update"===s){const s=t.equal+t.insert,r=t.equal+t.delete,a=e.getChild(s);!a||a.is("uiElement")||a.is("rawElement")||this._updateElementMappings(a,i[r]),(0,n.remove)(o[s]),t.equal++}else t[s]++}}_updateElementMappings(e,t){this.domConverter.unbindDomElement(t),this.domConverter.bindElements(t,e),this.markedChildren.add(e),this.markedAttributes.add(e)}_getInlineFillerPosition(){const e=this.selection.getFirstPosition();return e.parent.is("$text")?K._createBefore(e.parent):e}_isSelectionInInlineFiller(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=this.domConverter.viewPositionToDom(e);return!!(t&&(0,n.isText)(t.parent)&&Re(t.parent))}_removeInlineFiller(){const e=this._inlineFiller;if(!Re(e))throw new n.CKEditorError("view-renderer-filler-was-lost",this);Be(e)?e.remove():e.data=e.data.substr(Se),this._inlineFiller=null}_needsInlineFillerAtSelection(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=e.parent,i=e.offset;if(!this.domConverter.mapViewToDom(t.root))return!1;if(!t.is("element"))return!1;if(!function(e){if("false"==e.getAttribute("contenteditable"))return!1;const t=e.findAncestor((e=>e.hasAttribute("contenteditable")));return!t||"true"==t.getAttribute("contenteditable")}(t))return!1;const o=e.nodeBefore,s=e.nodeAfter;return!(o instanceof w||s instanceof w||!(i!==t.getFillerOffset()||o&&o.is("element","br"))||n.env.isAndroid&&(o||s))}_updateText(e,t){const i=this.domConverter.findCorrespondingDomText(e);let n=this.domConverter.viewToDom(e).data;const o=t.inlineFillerPosition;o&&o.parent==e.parent&&o.offset==e.index&&(n=Ve+n),this._updateTextNode(i,n)}_updateAttrs(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const i=Array.from(t.attributes).map((e=>e.name)),n=e.getAttributeKeys();for(const i of n)this.domConverter.setDomElementAttribute(t,i,e.getAttribute(i),e);for(const n of i)e.hasAttribute(n)||this.domConverter.removeDomElementAttribute(t,n)}_updateChildren(e,t){const i=this.domConverter.mapViewToDom(e);if(!i)return;if(n.env.isAndroid){let e=null;for(const t of Array.from(i.childNodes)){if(e&&(0,n.isText)(e)&&(0,n.isText)(t)){i.normalize();break}e=t}}const o=t.inlineFillerPosition,s=i.childNodes,r=Array.from(this.domConverter.viewChildrenToDom(e,{bind:!0}));o&&o.parent===e&&Fe(i.ownerDocument,r,o.offset);const a=this._diffNodeLists(s,r),l=this._findUpdateActions(a,s,r,De);let c=0;const d=new Set;for(const e of l)"delete"===e?(d.add(s[c]),(0,n.remove)(s[c])):"equal"!==e&&"update"!==e||c++;c=0;for(const e of l)"insert"===e?((0,n.insertAt)(i,c,r[c]),c++):"update"===e?(this._updateTextNode(s[c],r[c].data),c++):"equal"===e&&(this._markDescendantTextToSync(this.domConverter.domToView(r[c])),c++);for(const e of d)e.parentNode||this.domConverter.unbindDomElement(e)}_diffNodeLists(e,t){return e=function(e,t){const i=Array.from(e);if(0==i.length||!t)return i;return i[i.length-1]==t&&i.pop(),i}(e,this._fakeSelectionContainer),(0,n.diff)(e,t,ze.bind(null,this.domConverter))}_findUpdateActions(e,t,i,o){if(-1===e.indexOf("insert")||-1===e.indexOf("delete"))return e;let s=[],r=[],a=[];const l={equal:0,insert:0,delete:0};for(const c of e)"insert"===c?a.push(i[l.equal+l.insert]):"delete"===c?r.push(t[l.equal+l.delete]):(s=s.concat((0,n.diff)(r,a,o).map((e=>"equal"===e?"update":e))),s.push("equal"),r=[],a=[]),l[c]++;return s.concat((0,n.diff)(r,a,o).map((e=>"equal"===e?"update":e)))}_updateTextNode(e,t){const i=e.data;i!=t&&(n.env.isAndroid&&this.isComposing&&i.replace(/\u00A0/g," ")==t.replace(/\u00A0/g," ")||this._updateTextNodeInternal(e,t))}_updateTextNodeInternal(e,t){const i=(0,n.fastDiff)(e.data,t);for(const t of i)"insert"===t.type?e.insertData(t.index,t.values.join("")):e.deleteData(t.index,t.howMany)}_markDescendantTextToSync(e){if(e)if(e.is("$text"))this.markedTexts.add(e);else if(e.is("element"))for(const t of e.getChildren())this._markDescendantTextToSync(t)}_updateSelection(){if(n.env.isBlink&&!n.env.isAndroid&&this.isSelecting&&!this.markedChildren.size)return;if(0===this.selection.rangeCount)return this._removeDomSelection(),void this._removeFakeSelection();const e=this.domConverter.mapViewToDom(this.selection.editableElement);this.isFocused&&e&&(this.selection.isFake?this._updateFakeSelection(e):this._fakeSelectionContainer&&this._fakeSelectionContainer.isConnected?(this._removeFakeSelection(),this._updateDomSelection(e)):this.isComposing&&n.env.isAndroid||this._updateDomSelection(e))}_updateFakeSelection(e){const t=e.ownerDocument;this._fakeSelectionContainer||(this._fakeSelectionContainer=function(e){const t=e.createElement("div");return t.className="ck-fake-selection-container",Object.assign(t.style,{position:"fixed",top:0,left:"-9999px",width:"42px"}),t.textContent=" ",t}(t));const i=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(i,this.selection),!this._fakeSelectionNeedsUpdate(e))return;i.parentElement&&i.parentElement==e||e.appendChild(i),i.textContent=this.selection.fakeSelectionLabel||" ";const n=t.getSelection(),o=t.createRange();n.removeAllRanges(),o.selectNodeContents(i),n.addRange(o)}_updateDomSelection(e){const t=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(t))return;const i=this.domConverter.viewPositionToDom(this.selection.anchor),o=this.domConverter.viewPositionToDom(this.selection.focus);t.setBaseAndExtent(i.parent,i.offset,o.parent,o.offset),n.env.isGecko&&function(e,t){let i=e.parent,o=e.offset;if((0,n.isText)(i)&&Be(i)&&(o=(0,n.indexOf)(i)+1,i=i.parentNode),i.nodeType!=Node.ELEMENT_NODE||o!=i.childNodes.length-1)return;const s=i.childNodes[o];s&&"BR"==s.tagName&&t.addRange(t.getRangeAt(0))}(o,t)}_domSelectionNeedsUpdate(e){if(!this.domConverter.isDomSelectionCorrect(e))return!0;const t=e&&this.domConverter.domSelectionToView(e);return!(t&&this.selection.isEqual(t)||!this.selection.isCollapsed&&this.selection.isSimilar(t))}_fakeSelectionNeedsUpdate(e){const t=this._fakeSelectionContainer,i=e.ownerDocument.getSelection();return!t||t.parentElement!==e||i.anchorNode!==t&&!t.contains(i.anchorNode)||t.textContent!==this.selection.fakeSelectionLabel}_removeDomSelection(){for(const e of this.domDocuments){const t=e.getSelection();if(t.rangeCount){const i=e.activeElement,n=this.domConverter.mapDomToView(i);i&&n&&t.removeAllRanges()}}}_removeFakeSelection(){const e=this._fakeSelectionContainer;e&&e.remove()}_updateFocus(){if(this.isFocused){const e=this.selection.editableElement;e&&this.domConverter.focus(e)}}}function Fe(e,t,i){const o=t instanceof Array?t:t.childNodes,s=o[i];if((0,n.isText)(s))return s.data=Ve+s.data,s;{const s=e.createTextNode(Ve);return Array.isArray(t)?o.splice(i,0,s):(0,n.insertAt)(t,i,s),s}}function Ne(e,t){return(0,n.isNode)(e)&&(0,n.isNode)(t)&&!(0,n.isText)(e)&&!(0,n.isText)(t)&&!(0,n.isComment)(e)&&!(0,n.isComment)(t)&&e.tagName.toLowerCase()===t.tagName.toLowerCase()}function De(e,t){return(0,n.isNode)(e)&&(0,n.isNode)(t)&&(0,n.isText)(e)&&(0,n.isText)(t)}function ze(e,t,i){return t===i||((0,n.isText)(t)&&(0,n.isText)(i)?t.data===i.data:!(!e.isBlockFiller(t)||!e.isBlockFiller(i)))}const We=Ie(n.global.document),He=Te(n.global.document),Ue=Pe(n.global.document),$e="data-ck-unsafe-attribute-",je="data-ck-unsafe-element";class qe{constructor(e,{blockFillerMode:t,renderingMode:i="editing"}={}){this._domToViewMapping=new WeakMap,this._viewToDomMapping=new WeakMap,this._fakeSelectionMapping=new WeakMap,this._rawContentElementMatcher=new y,this._inlineObjectElementMatcher=new y,this._elementsWithTemporaryCustomProperties=new Set,this.document=e,this.renderingMode=i,this.blockFillerMode=t||("editing"===i?"br":"nbsp"),this.preElements=["pre"],this.blockElements=["address","article","aside","blockquote","caption","center","dd","details","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","legend","li","main","menu","nav","ol","p","pre","section","summary","table","tbody","td","tfoot","th","thead","tr","ul"],this.inlineObjectElements=["object","iframe","input","button","textarea","select","option","video","embed","audio","img","canvas"],this.unsafeElements=["script","style"],this._domDocument="editing"===this.renderingMode?n.global.document:n.global.document.implementation.createHTMLDocument("")}bindFakeSelection(e,t){this._fakeSelectionMapping.set(e,new J(t))}fakeSelectionToView(e){return this._fakeSelectionMapping.get(e)}bindElements(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}unbindDomElement(e){const t=this._domToViewMapping.get(e);if(t){this._domToViewMapping.delete(e),this._viewToDomMapping.delete(t);for(const t of Array.from(e.children))this.unbindDomElement(t)}}bindDocumentFragments(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}shouldRenderAttribute(e,t,i){return"data"===this.renderingMode||!(e=e.toLowerCase()).startsWith("on")&&("srcdoc"!==e||!t.match(/\bon\S+\s*=|javascript:|<\s*\/*script/i))&&("img"===i&&("src"===e||"srcset"===e)||"source"===i&&"srcset"===e||!t.match(/^\s*(javascript:|data:(image\/svg|text\/x?html))/i))}setContentOf(e,t){if("data"===this.renderingMode)return void(e.innerHTML=t);const i=(new DOMParser).parseFromString(t,"text/html"),n=i.createDocumentFragment(),o=i.body.childNodes;for(;o.length>0;)n.appendChild(o[0]);const s=i.createTreeWalker(n,NodeFilter.SHOW_ELEMENT),r=[];let a;for(;a=s.nextNode();)r.push(a);for(const e of r){for(const t of e.getAttributeNames())this.setDomElementAttribute(e,t,e.getAttribute(t));const t=e.tagName.toLowerCase();this._shouldRenameElement(t)&&(Ze(t),e.replaceWith(this._createReplacementDomElement(t,e)))}for(;e.firstChild;)e.firstChild.remove();e.append(n)}viewToDom(e,t={}){if(e.is("$text")){const t=this._processDataFromViewText(e);return this._domDocument.createTextNode(t)}{const i=e;if(this.mapViewToDom(i)){if(!i.getCustomProperty("editingPipeline:doNotReuseOnce"))return this.mapViewToDom(i);this._elementsWithTemporaryCustomProperties.add(i)}let n;if(i.is("documentFragment"))n=this._domDocument.createDocumentFragment(),t.bind&&this.bindDocumentFragments(n,i);else{if(i.is("uiElement"))return n="$comment"===i.name?this._domDocument.createComment(i.getCustomProperty("$rawContent")):i.render(this._domDocument,this),t.bind&&this.bindElements(n,i),n;this._shouldRenameElement(i.name)?(Ze(i.name),n=this._createReplacementDomElement(i.name)):n=i.hasAttribute("xmlns")?this._domDocument.createElementNS(i.getAttribute("xmlns"),i.name):this._domDocument.createElement(i.name),i.is("rawElement")&&i.render(n,this),t.bind&&this.bindElements(n,i);for(const e of i.getAttributeKeys())this.setDomElementAttribute(n,e,i.getAttribute(e),i)}if(!1!==t.withChildren)for(const e of this.viewChildrenToDom(i,t))n instanceof HTMLTemplateElement?n.content.appendChild(e):n.appendChild(e);return n}}setDomElementAttribute(e,t,i,o){const s=this.shouldRenderAttribute(t,i,e.tagName.toLowerCase())||o&&o.shouldRenderUnsafeAttribute(t);s||(0,n.logWarning)("domconverter-unsafe-attribute-detected",{domElement:e,key:t,value:i}),(0,n.isValidAttributeName)(t)?(e.hasAttribute(t)&&!s?e.removeAttribute(t):e.hasAttribute($e+t)&&s&&e.removeAttribute($e+t),e.setAttribute(s?t:$e+t,i)):(0,n.logWarning)("domconverter-invalid-attribute-detected",{domElement:e,key:t,value:i})}removeDomElementAttribute(e,t){t!=je&&(e.removeAttribute(t),e.removeAttribute($e+t))}*viewChildrenToDom(e,t={}){const i=e.getFillerOffset&&e.getFillerOffset();let o=0;for(const s of e.getChildren()){i===o&&(yield this._getBlockFiller());const e=s.is("element")&&!!s.getCustomProperty("dataPipeline:transparentRendering")&&!(0,n.first)(s.getAttributes());if(e&&"data"==this.renderingMode)if(s.is("rawElement")){const e=this._domDocument.createElement(s.name);s.render(e,this),yield*[...e.childNodes]}else yield*this.viewChildrenToDom(s,t);else e&&(0,n.logWarning)("domconverter-transparent-rendering-unsupported-in-editing-pipeline",{viewElement:s}),yield this.viewToDom(s,t);o++}i===o&&(yield this._getBlockFiller())}viewRangeToDom(e){const t=this.viewPositionToDom(e.start),i=this.viewPositionToDom(e.end),n=this._domDocument.createRange();return n.setStart(t.parent,t.offset),n.setEnd(i.parent,i.offset),n}viewPositionToDom(e){const t=e.parent;if(t.is("$text")){const i=this.findCorrespondingDomText(t);if(!i)return null;let n=e.offset;return Re(i)&&(n+=Se),{parent:i,offset:n}}{let i,o,s;if(0===e.offset){if(i=this.mapViewToDom(t),!i)return null;s=i.childNodes[0]}else{const t=e.nodeBefore;if(o=t.is("$text")?this.findCorrespondingDomText(t):this.mapViewToDom(t),!o)return null;i=o.parentNode,s=o.nextSibling}return(0,n.isText)(s)&&Re(s)?{parent:s,offset:Se}:{parent:i,offset:o?(0,n.indexOf)(o)+1:0}}}domToView(e,t={}){const i=[],n=this._domToView(e,t,i),o=n.next().value;return o?(n.next(),this._processDomInlineNodes(null,i,t),o.is("$text")&&0==o.data.length?null:o):null}*domChildrenToView(e,t={},i=[]){let n=[];n=e instanceof HTMLTemplateElement?[...e.content.childNodes]:[...e.childNodes];for(let o=0;o<n.length;o++){const s=n[o],r=this._domToView(s,t,i),a=r.next().value;null!==a&&(this._isBlockViewElement(a)&&this._processDomInlineNodes(e,i,t),yield a,r.next())}this._processDomInlineNodes(e,i,t)}domSelectionToView(e){if(function(e){if(!n.env.isGecko)return!1;if(!e.rangeCount)return!1;const t=e.getRangeAt(0).startContainer;try{Object.prototype.toString.call(t)}catch(e){return!0}return!1}(e))return new J([]);if(1===e.rangeCount){let t=e.getRangeAt(0).startContainer;(0,n.isText)(t)&&(t=t.parentNode);const i=this.fakeSelectionToView(t);if(i)return i}const t=this.isDomSelectionBackward(e),i=[];for(let t=0;t<e.rangeCount;t++){const n=e.getRangeAt(t),o=this.domRangeToView(n);o&&i.push(o)}return new J(i,{backward:t})}domRangeToView(e){const t=this.domPositionToView(e.startContainer,e.startOffset),i=this.domPositionToView(e.endContainer,e.endOffset);return t&&i?new G(t,i):null}domPositionToView(e,t=0){if(this.isBlockFiller(e))return this.domPositionToView(e.parentNode,(0,n.indexOf)(e));const i=this.mapDomToView(e);if(i&&(i.is("uiElement")||i.is("rawElement")))return K._createBefore(i);if((0,n.isText)(e)){if(Be(e))return this.domPositionToView(e.parentNode,(0,n.indexOf)(e));const i=this.findCorrespondingViewText(e);let o=t;return i?(Re(e)&&(o-=Se,o=o<0?0:o),new K(i,o)):null}if(0===t){const t=this.mapDomToView(e);if(t)return new K(t,0)}else{const i=e.childNodes[t-1];if((0,n.isText)(i)&&Be(i)||i&&this.isBlockFiller(i))return this.domPositionToView(i.parentNode,(0,n.indexOf)(i));const o=(0,n.isText)(i)?this.findCorrespondingViewText(i):this.mapDomToView(i);if(o&&o.parent)return new K(o.parent,o.index+1)}return null}mapDomToView(e){return this.getHostViewElement(e)||this._domToViewMapping.get(e)}findCorrespondingViewText(e){if(Be(e))return null;const t=this.getHostViewElement(e);if(t)return t;const i=e.previousSibling;if(i){if(!this.isElement(i))return null;const e=this.mapDomToView(i);if(e){const t=e.nextSibling;return t instanceof w?t:null}}else{const t=this.mapDomToView(e.parentNode);if(t){const e=t.getChild(0);return e instanceof w?e:null}}return null}mapViewToDom(e){return this._viewToDomMapping.get(e)}findCorrespondingDomText(e){const t=e.previousSibling;return t&&this.mapViewToDom(t)?this.mapViewToDom(t).nextSibling:!t&&e.parent&&this.mapViewToDom(e.parent)?this.mapViewToDom(e.parent).childNodes[0]:null}focus(e){const t=this.mapViewToDom(e);if(t&&t.ownerDocument.activeElement!==t){const{scrollX:e,scrollY:i}=n.global.window,o=[];Ke(t,(e=>{const{scrollLeft:t,scrollTop:i}=e;o.push([t,i])})),t.focus(),Ke(t,(e=>{const[t,i]=o.shift();e.scrollLeft=t,e.scrollTop=i})),n.global.window.scrollTo(e,i)}}_clearDomSelection(){const e=this.mapViewToDom(this.document.selection.editableElement);if(!e)return;const t=e.ownerDocument.defaultView.getSelection(),i=this.domSelectionToView(t);i&&i.rangeCount>0&&t.removeAllRanges()}isElement(e){return e&&e.nodeType==Node.ELEMENT_NODE}isDocumentFragment(e){return e&&e.nodeType==Node.DOCUMENT_FRAGMENT_NODE}isBlockFiller(e){return"br"==this.blockFillerMode?e.isEqualNode(We):!("BR"!==e.tagName||!Ge(e,this.blockElements)||1!==e.parentNode.childNodes.length)||e.isEqualNode(Ue)||function(e,t){return e.isEqualNode(He)&&Ge(e,t)&&1===e.parentNode.childNodes.length}(e,this.blockElements)}isDomSelectionBackward(e){if(e.isCollapsed)return!1;const t=this._domDocument.createRange();try{t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset)}catch(e){return!1}const i=t.collapsed;return t.detach(),i}getHostViewElement(e){const t=(0,n.getAncestors)(e);for(t.pop();t.length;){const e=t.pop(),i=this._domToViewMapping.get(e);if(i&&(i.is("uiElement")||i.is("rawElement")))return i}return null}isDomSelectionCorrect(e){return this._isDomSelectionPositionCorrect(e.anchorNode,e.anchorOffset)&&this._isDomSelectionPositionCorrect(e.focusNode,e.focusOffset)}registerRawContentMatcher(e){this._rawContentElementMatcher.add(e)}registerInlineObjectMatcher(e){this._inlineObjectElementMatcher.add(e)}_clearTemporaryCustomProperties(){for(const e of this._elementsWithTemporaryCustomProperties)e._removeCustomProperty("editingPipeline:doNotReuseOnce");this._elementsWithTemporaryCustomProperties.clear()}_getBlockFiller(){switch(this.blockFillerMode){case"nbsp":return Te(this._domDocument);case"markedNbsp":return Pe(this._domDocument);case"br":return Ie(this._domDocument)}}_isDomSelectionPositionCorrect(e,t){if((0,n.isText)(e)&&Re(e)&&t<Se)return!1;if(this.isElement(e)&&Re(e.childNodes[t]))return!1;const i=this.mapDomToView(e);return!i||!i.is("uiElement")&&!i.is("rawElement")}*_domToView(e,t,i){if(this.isBlockFiller(e))return null;const o=this.getHostViewElement(e);if(o)return o;if((0,n.isComment)(e)&&t.skipComments)return null;if((0,n.isText)(e)){if(Be(e))return null;{const t=e.data;if(""===t)return null;const n=new w(this.document,t);return i.push(n),n}}{let o=this.mapDomToView(e);if(o)return this._isInlineObjectElement(o)&&i.push(o),o;if(this.isDocumentFragment(e))o=new pe(this.document),t.bind&&this.bindDocumentFragments(e,o);else{o=this._createViewElement(e,t),t.bind&&this.bindElements(e,o);const s=e.attributes;if(s)for(let e=s.length,t=0;t<e;t++)o._setAttribute(s[t].name,s[t].value);if(this._isViewElementWithRawContent(o,t))return o._setCustomProperty("$rawContent",e.innerHTML),this._isBlockViewElement(o)||i.push(o),o;if((0,n.isComment)(e))return o._setCustomProperty("$rawContent",e.data),o}yield o;const s=[];if(!1!==t.withChildren)for(const i of this.domChildrenToView(e,t,s))o._appendChild(i);if(this._isInlineObjectElement(o))i.push(o);else for(const e of s)i.push(e)}}_processDomInlineNodes(e,t,i){if(!t.length)return;if(e&&!this.isDocumentFragment(e)&&!this._isBlockDomElement(e))return;let n=!1;for(let e=0;e<t.length;e++){const o=t[e];if(!o.is("$text")){n=!1;continue}let s,r=!1;if(this._isPreFormatted(o))s=Me(o.data);else{s=o.data.replace(/[ \n\t\r]{1,}/g," "),r=/[^\S\u00A0]/.test(s.charAt(s.length-1));const a=e>0?t[e-1]:null,l=e+1<t.length?t[e+1]:null,c=!a||a.is("element")&&"br"==a.name||n,d=!l&&!Re(o.data);!1!==i.withChildren&&(c&&(s=s.replace(/^ /,"")),d&&(s=s.replace(/ $/,""))),s=Me(s),s=s.replace(/ \u00A0/g,"  ");const u=l&&l.is("element")&&"br"!=l.name,h=l&&l.is("$text")&&" "==l.data.charAt(0);(/[ \u00A0]\u00A0$/.test(s)||!l||u||h)&&(s=s.replace(/\u00A0$/," ")),(c||a&&a.is("element")&&"br"!=a.name)&&(s=s.replace(/^\u00A0/," "))}0==s.length&&o.parent?(o._remove(),t.splice(e,1),e--):(o._data=s,n=r)}t.length=0}_processDataFromViewText(e){let t=e.data;if(this._isPreFormatted(e))return t;if(" "==t.charAt(0)){const i=this._getTouchingInlineViewNode(e,!1);!(i&&i.is("$textProxy")&&this._nodeEndsWithSpace(i))&&i||(t=" "+t.substr(1))}if(" "==t.charAt(t.length-1)){const i=this._getTouchingInlineViewNode(e,!0),n=i&&i.is("$textProxy")&&" "==i.data.charAt(0);" "!=t.charAt(t.length-2)&&i&&!n||(t=t.substr(0,t.length-1)+" ")}return t.replace(/ {2}/g,"  ")}_nodeEndsWithSpace(e){if(this._isPreFormatted(e))return!1;const t=this._processDataFromViewText(e);return" "==t.charAt(t.length-1)}_isPreFormatted(e){if(function(e,t){return e.getAncestors().some((e=>e.is("element")&&t.includes(e.name)))}(e,this.preElements))return!0;for(const t of e.getAncestors({parentFirst:!0}))if(t.is("element")&&t.hasStyle("white-space")&&"inherit"!==t.getStyle("white-space"))return["pre","pre-wrap","break-spaces"].includes(t.getStyle("white-space"));return!1}_getTouchingInlineViewNode(e,t){const i=new q({startPosition:t?K._createAfter(e):K._createBefore(e),direction:t?"forward":"backward"});for(const{item:e}of i){if(e.is("$textProxy"))return e;if(!e.is("element")||!e.getCustomProperty("dataPipeline:transparentRendering")){if(e.is("element","br"))return null;if(this._isInlineObjectElement(e))return e;if(e.is("containerElement"))return null}}return null}_isBlockDomElement(e){return this.isElement(e)&&this.blockElements.includes(e.tagName.toLowerCase())}_isBlockViewElement(e){return e.is("element")&&this.blockElements.includes(e.name)}_isInlineObjectElement(e){return!!e.is("element")&&("br"==e.name||this.inlineObjectElements.includes(e.name)||!!this._inlineObjectElementMatcher.match(e))}_createViewElement(e,t){if((0,n.isComment)(e))return new he(this.document,"$comment");const i=t.keepOriginalCase?e.tagName:e.tagName.toLowerCase();return new D(this.document,i)}_isViewElementWithRawContent(e,t){return!1!==t.withChildren&&e.is("element")&&!!this._rawContentElementMatcher.match(e)}_shouldRenameElement(e){const t=e.toLowerCase();return"editing"===this.renderingMode&&this.unsafeElements.includes(t)}_createReplacementDomElement(e,t){const i=this._domDocument.createElement("span");if(i.setAttribute(je,e),t){for(;t.firstChild;)i.appendChild(t.firstChild);for(const e of t.getAttributeNames())i.setAttribute(e,t.getAttribute(e))}return i}}function Ke(e,t){let i=e;for(;i;)t(i),i=i.parentElement}function Ge(e,t){const i=e.parentNode;return!!i&&!!i.tagName&&t.includes(i.tagName.toLowerCase())}function Ze(e){"script"===e&&(0,n.logWarning)("domconverter-unsafe-script-element-detected"),"style"===e&&(0,n.logWarning)("domconverter-unsafe-style-element-detected")}class Je extends((0,n.DomEmitterMixin)()){constructor(e){super(),this._isEnabled=!1,this.view=e,this.document=e.document}get isEnabled(){return this._isEnabled}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}destroy(){this.disable(),this.stopListening()}checkShouldIgnoreEventFromTarget(e){return e&&3===e.nodeType&&(e=e.parentNode),!(!e||1!==e.nodeType)&&e.matches("[data-cke-ignore-events], [data-cke-ignore-events] *")}}var Qe=i(6232);class Ye{constructor(e,t,i){this.view=e,this.document=e.document,this.domEvent=t,this.domTarget=t.target,(0,Qe.A)(this,i)}get target(){return this.view.domConverter.mapDomToView(this.domTarget)}preventDefault(){this.domEvent.preventDefault()}stopPropagation(){this.domEvent.stopPropagation()}}class Xe extends Je{constructor(){super(...arguments),this.useCapture=!1}observe(e){("string"==typeof this.domEventType?[this.domEventType]:this.domEventType).forEach((t=>{this.listenTo(e,t,((e,t)=>{this.isEnabled&&!this.checkShouldIgnoreEventFromTarget(t.target)&&this.onDomEvent(t)}),{useCapture:this.useCapture})}))}stopObserving(e){this.stopListening(e)}fire(e,t,i){this.isEnabled&&this.document.fire(e,new Ye(this.view,t,i))}}class et extends Xe{constructor(){super(...arguments),this.domEventType=["keydown","keyup"]}onDomEvent(e){const t={keyCode:e.keyCode,altKey:e.altKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,metaKey:e.metaKey,get keystroke(){return(0,n.getCode)(this)}};this.fire(e.type,e,t)}}var tt=i(2223);class it extends Je{constructor(e){super(e),this._fireSelectionChangeDoneDebounced=(0,tt.A)((e=>{this.document.fire("selectionChangeDone",e)}),200)}observe(){const e=this.document;e.on("arrowKey",((t,i)=>{e.selection.isFake&&this.isEnabled&&i.preventDefault()}),{context:"$capture"}),e.on("arrowKey",((t,i)=>{e.selection.isFake&&this.isEnabled&&this._handleSelectionMove(i.keyCode)}),{priority:"lowest"})}stopObserving(){}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(e){const t=this.document.selection,i=new J(t.getRanges(),{backward:t.isBackward,fake:!1});e!=n.keyCodes.arrowleft&&e!=n.keyCodes.arrowup||i.setTo(i.getFirstPosition()),e!=n.keyCodes.arrowright&&e!=n.keyCodes.arrowdown||i.setTo(i.getLastPosition());const o={oldSelection:t,newSelection:i,domSelection:null};this.document.fire("selectionChange",o),this._fireSelectionChangeDoneDebounced(o)}}var nt=i(5407);class ot extends Je{constructor(e){super(e),this._config={childList:!0,characterData:!0,subtree:!0},this.domConverter=e.domConverter,this._domElements=new Set,this._mutationObserver=new window.MutationObserver(this._onMutations.bind(this))}flush(){this._onMutations(this._mutationObserver.takeRecords())}observe(e){this._domElements.add(e),this.isEnabled&&this._mutationObserver.observe(e,this._config)}stopObserving(e){if(this._domElements.delete(e),this.isEnabled){this._mutationObserver.disconnect();for(const e of this._domElements)this._mutationObserver.observe(e,this._config)}}enable(){super.enable();for(const e of this._domElements)this._mutationObserver.observe(e,this._config)}disable(){super.disable(),this._mutationObserver.disconnect()}destroy(){super.destroy(),this._mutationObserver.disconnect()}_onMutations(e){if(0===e.length)return;const t=this.domConverter,i=new Set,n=new Set;for(const i of e){const e=t.mapDomToView(i.target);e&&(e.is("uiElement")||e.is("rawElement")||"childList"!==i.type||this._isBogusBrMutation(i)||n.add(e))}for(const o of e){const e=t.mapDomToView(o.target);if((!e||!e.is("uiElement")&&!e.is("rawElement"))&&"characterData"===o.type){const e=t.findCorrespondingViewText(o.target);e&&!n.has(e.parent)?i.add(e):!e&&Re(o.target)&&n.add(t.mapDomToView(o.target.parentNode))}}const o=[];for(const e of i)o.push({type:"text",node:e});for(const e of n){const i=t.mapViewToDom(e),n=Array.from(e.getChildren()),c=Array.from(t.domChildrenToView(i,{withChildren:!1}));s=n,r=c,l=void 0,(void 0===(l=(a="function"==typeof(a=st)?a:void 0)?a(s,r):void 0)?(0,nt.A)(s,r,void 0,a):l)||o.push({type:"children",node:e})}var s,r,a,l;o.length&&this.document.fire("mutations",{mutations:o})}_isBogusBrMutation(e){let t=null;return null===e.nextSibling&&0===e.removedNodes.length&&1==e.addedNodes.length&&(t=this.domConverter.domToView(e.addedNodes[0],{withChildren:!1})),t&&t.is("element","br")}}function st(e,t){if(!Array.isArray(e))return e===t||!(!e.is("$text")||!t.is("$text"))&&e.data===t.data}class rt extends Xe{constructor(e){super(e),this._renderTimeoutId=null,this._isFocusChanging=!1,this.domEventType=["focus","blur"],this.useCapture=!0;const t=this.document;t.on("focus",(()=>this._handleFocus())),t.on("blur",((e,t)=>this._handleBlur(t))),t.on("beforeinput",(()=>{t.isFocused||this._handleFocus()}),{priority:"highest"})}flush(){this._isFocusChanging&&(this._isFocusChanging=!1,this.document.isFocused=!0)}onDomEvent(e){this.fire(e.type,e)}destroy(){this._clearTimeout(),super.destroy()}_handleFocus(){this._clearTimeout(),this._isFocusChanging=!0,this._renderTimeoutId=setTimeout((()=>{this._renderTimeoutId=null,this.flush(),this.view.change((()=>{}))}),50)}_handleBlur(e){const t=this.document.selection.editableElement;null!==t&&t!==e.target||(this.document.isFocused=!1,this._isFocusChanging=!1,this.view.change((()=>{})))}_clearTimeout(){this._renderTimeoutId&&(clearTimeout(this._renderTimeoutId),this._renderTimeoutId=null)}}class at extends Je{constructor(e){super(e),this.mutationObserver=e.getObserver(ot),this.focusObserver=e.getObserver(rt),this.selection=this.document.selection,this.domConverter=e.domConverter,this._documents=new WeakSet,this._fireSelectionChangeDoneDebounced=(0,tt.A)((e=>{this.document.fire("selectionChangeDone",e)}),200),this._clearInfiniteLoopInterval=setInterval((()=>this._clearInfiniteLoop()),1e3),this._documentIsSelectingInactivityTimeoutDebounced=(0,tt.A)((()=>this.document.isSelecting=!1),5e3),this._loopbackCounter=0}observe(e){const t=e.ownerDocument,i=()=>{this.document.isSelecting&&(this._handleSelectionChange(t),this.document.isSelecting=!1,this._documentIsSelectingInactivityTimeoutDebounced.cancel())};this.listenTo(e,"selectstart",(()=>{this.document.isSelecting=!0,this._documentIsSelectingInactivityTimeoutDebounced()}),{priority:"highest"}),this.listenTo(e,"keydown",i,{priority:"highest",useCapture:!0}),this.listenTo(e,"keyup",i,{priority:"highest",useCapture:!0}),this._documents.has(t)||(this.listenTo(t,"mouseup",i,{priority:"highest",useCapture:!0}),this.listenTo(t,"selectionchange",((e,i)=>{this.document.isComposing&&!n.env.isAndroid||(this._handleSelectionChange(t),this._documentIsSelectingInactivityTimeoutDebounced())})),this.listenTo(this.view.document,"compositionstart",(()=>{this._handleSelectionChange(t)}),{priority:"lowest"}),this._documents.add(t))}stopObserving(e){this.stopListening(e)}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel(),this._documentIsSelectingInactivityTimeoutDebounced.cancel()}_reportInfiniteLoop(){}_handleSelectionChange(e){if(!this.isEnabled)return;const t=e.defaultView.getSelection();if(this.checkShouldIgnoreEventFromTarget(t.anchorNode))return;this.mutationObserver.flush();const i=this.domConverter.domSelectionToView(t);if(0!=i.rangeCount){if(this.view.hasDomSelection=!0,this.focusObserver.flush(),!this.selection.isEqual(i)||!this.domConverter.isDomSelectionCorrect(t))if(++this._loopbackCounter>60)this._reportInfiniteLoop();else if(this.selection.isSimilar(i))this.view.forceRender();else{const e={oldSelection:this.selection,newSelection:i,domSelection:t};this.document.fire("selectionChange",e),this._fireSelectionChangeDoneDebounced(e)}}else this.view.hasDomSelection=!1}_clearInfiniteLoop(){this._loopbackCounter=0}}class lt extends Xe{constructor(e){super(e),this.domEventType=["compositionstart","compositionupdate","compositionend"];const t=this.document;t.on("compositionstart",(()=>{t.isComposing=!0}),{priority:"low"}),t.on("compositionend",(()=>{t.isComposing=!1}),{priority:"low"})}onDomEvent(e){this.fire(e.type,e,{data:e.data})}}class ct{constructor(e,t={}){this._files=t.cacheFiles?dt(e):null,this._native=e}get files(){return this._files||(this._files=dt(this._native)),this._files}get types(){return this._native.types}getData(e){return this._native.getData(e)}setData(e,t){this._native.setData(e,t)}set effectAllowed(e){this._native.effectAllowed=e}get effectAllowed(){return this._native.effectAllowed}set dropEffect(e){this._native.dropEffect=e}get dropEffect(){return this._native.dropEffect}setDragImage(e,t,i){this._native.setDragImage(e,t,i)}get isCanceled(){return"none"==this._native.dropEffect||!!this._native.mozUserCancelled}}function dt(e){const t=Array.from(e.files||[]),i=Array.from(e.items||[]);return t.length?t:i.filter((e=>"file"===e.kind)).map((e=>e.getAsFile()))}class ut extends Xe{constructor(){super(...arguments),this.domEventType="beforeinput"}onDomEvent(e){const t=e.getTargetRanges(),i=this.view,o=i.document;let s=null,r=null,a=[];if(e.dataTransfer&&(s=new ct(e.dataTransfer)),null!==e.data?r=e.data:s&&(r=s.getData("text/plain")),o.selection.isFake)a=Array.from(o.selection.getRanges());else if(t.length)a=t.map((e=>{const t=i.domConverter.domPositionToView(e.startContainer,e.startOffset),n=i.domConverter.domPositionToView(e.endContainer,e.endOffset);return t?i.createRange(t,n):n?i.createRange(n):void 0})).filter((e=>!!e));else if(n.env.isAndroid){const t=e.target.ownerDocument.defaultView.getSelection();a=Array.from(i.domConverter.domSelectionToView(t).getRanges())}if(n.env.isAndroid&&"insertCompositionText"==e.inputType&&r&&r.endsWith("\n"))this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:[i.createRange(a[0].end)]});else if("insertText"==e.inputType&&r&&r.includes("\n")){const t=r.split(/\n{1,2}/g);let i=a;for(let n=0;n<t.length;n++){const r=t[n];""!=r&&(this.fire(e.type,e,{data:r,dataTransfer:s,targetRanges:i,inputType:e.inputType,isComposing:e.isComposing}),i=[o.selection.getFirstRange()]),n+1<t.length&&(this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:i}),i=[o.selection.getFirstRange()])}}else this.fire(e.type,e,{data:r,dataTransfer:s,targetRanges:a,inputType:e.inputType,isComposing:e.isComposing})}}class ht extends Je{constructor(e){super(e),this.document.on("keydown",((e,t)=>{if(this.isEnabled&&(0,n.isArrowKeyCode)(t.keyCode)){const i=new Y(this.document,"arrowKey",this.document.selection.getFirstRange());this.document.fire(i,t),i.stop.called&&e.stop()}}))}observe(){}stopObserving(){}}class mt extends Je{constructor(e){super(e);const t=this.document;t.on("keydown",((e,i)=>{if(!this.isEnabled||i.keyCode!=n.keyCodes.tab||i.ctrlKey)return;const o=new Y(t,"tab",t.selection.getFirstRange());t.fire(o,i),o.stop.called&&e.stop()}))}observe(){}stopObserving(){}}var gt=i(903);class ft extends((0,n.ObservableMixin)()){constructor(e){var t;super(),this.domRoots=new Map,this._initialDomRootAttributes=new WeakMap,this._observers=new Map,this._ongoingChange=!1,this._postFixersInProgress=!1,this._renderingDisabled=!1,this._hasChangedSinceTheLastRendering=!1,this.document=new se(e),this.domConverter=new qe(this.document),this.set("isRenderingInProgress",!1),this.set("hasDomSelection",!1),this._renderer=new Le(this.domConverter,this.document.selection),this._renderer.bind("isFocused","isSelecting","isComposing").to(this.document,"isFocused","isSelecting","isComposing"),this._writer=new be(this.document),this.addObserver(ot),this.addObserver(rt),this.addObserver(at),this.addObserver(et),this.addObserver(it),this.addObserver(lt),this.addObserver(ht),this.addObserver(ut),this.addObserver(mt),this.document.on("arrowKey",Oe,{priority:"low"}),(t=this).document.on("arrowKey",((e,i)=>function(e,t,i){if(t.keyCode==n.keyCodes.arrowright){const e=t.domTarget.ownerDocument.defaultView.getSelection(),n=1==e.rangeCount&&e.getRangeAt(0).collapsed;if(n||t.shiftKey){const t=e.focusNode,o=e.focusOffset,s=i.domPositionToView(t,o);if(null===s)return;let r=!1;const a=s.getLastMatchingPosition((e=>(e.item.is("uiElement")&&(r=!0),!(!e.item.is("uiElement")&&!e.item.is("attributeElement")))));if(r){const t=i.viewPositionToDom(a);n?e.collapse(t.parent,t.offset):e.extend(t.parent,t.offset)}}}}(0,i,t.domConverter)),{priority:"low"}),this.on("render",(()=>{this._render(),this.document.fire("layoutChanged"),this._hasChangedSinceTheLastRendering=!1})),this.listenTo(this.document.selection,"change",(()=>{this._hasChangedSinceTheLastRendering=!0})),this.listenTo(this.document,"change:isFocused",(()=>{this._hasChangedSinceTheLastRendering=!0})),n.env.isiOS&&this.listenTo(this.document,"blur",((e,t)=>{this.domConverter.mapDomToView(t.domEvent.relatedTarget)||this.domConverter._clearDomSelection()})),this.listenTo(this.document,"mutations",((e,{mutations:t})=>{t.forEach((e=>this._renderer.markToSync(e.type,e.node)))}),{priority:"low"}),this.listenTo(this.document,"mutations",(()=>{this.forceRender()}),{priority:"lowest"})}attachDomRoot(e,t="main"){const i=this.document.getRoot(t);i._name=e.tagName.toLowerCase();const n={};for(const{name:t,value:o}of Array.from(e.attributes))n[t]=o,"class"===t?this._writer.addClass(o.split(" "),i):this._writer.setAttribute(t,o,i);this._initialDomRootAttributes.set(e,n);const o=()=>{this._writer.setAttribute("contenteditable",(!i.isReadOnly).toString(),i),i.isReadOnly?this._writer.addClass("ck-read-only",i):this._writer.removeClass("ck-read-only",i)};o(),this.domRoots.set(t,e),this.domConverter.bindElements(e,i),this._renderer.markToSync("children",i),this._renderer.markToSync("attributes",i),this._renderer.domDocuments.add(e.ownerDocument),i.on("change:children",((e,t)=>this._renderer.markToSync("children",t))),i.on("change:attributes",((e,t)=>this._renderer.markToSync("attributes",t))),i.on("change:text",((e,t)=>this._renderer.markToSync("text",t))),i.on("change:isReadOnly",(()=>this.change(o))),i.on("change",(()=>{this._hasChangedSinceTheLastRendering=!0}));for(const i of this._observers.values())i.observe(e,t)}detachDomRoot(e){const t=this.domRoots.get(e);Array.from(t.attributes).forEach((({name:e})=>t.removeAttribute(e)));const i=this._initialDomRootAttributes.get(t);for(const e in i)t.setAttribute(e,i[e]);this.domRoots.delete(e),this.domConverter.unbindDomElement(t);for(const e of this._observers.values())e.stopObserving(t)}getDomRoot(e="main"){return this.domRoots.get(e)}addObserver(e){let t=this._observers.get(e);if(t)return t;t=new e(this),this._observers.set(e,t);for(const[e,i]of this.domRoots)t.observe(i,e);return t.enable(),t}getObserver(e){return this._observers.get(e)}disableObservers(){for(const e of this._observers.values())e.disable()}enableObservers(){for(const e of this._observers.values())e.enable()}scrollToTheSelection({alignToTop:e,forceScroll:t,viewportOffset:i=20,ancestorOffset:o=20}={}){const s=this.document.selection.getFirstRange();if(!s)return;const r=(0,gt.A)({alignToTop:e,forceScroll:t,viewportOffset:i,ancestorOffset:o});"number"==typeof i&&(i={top:i,bottom:i,left:i,right:i});const a={target:this.domConverter.viewRangeToDom(s),viewportOffset:i,ancestorOffset:o,alignToTop:e,forceScroll:t};this.fire("scrollToTheSelection",a,r),(0,n.scrollViewportToShowTarget)(a)}focus(){if(!this.document.isFocused){const e=this.document.selection.editableElement;e&&(this.domConverter.focus(e),this.forceRender())}}change(e){if(this.isRenderingInProgress||this._postFixersInProgress)throw new n.CKEditorError("cannot-change-view-tree",this);try{if(this._ongoingChange)return e(this._writer);this._ongoingChange=!0;const t=e(this._writer);return this._ongoingChange=!1,!this._renderingDisabled&&this._hasChangedSinceTheLastRendering&&(this._postFixersInProgress=!0,this.document._callPostFixers(this._writer),this._postFixersInProgress=!1,this.fire("render")),t}catch(e){n.CKEditorError.rethrowUnexpectedError(e,this)}}forceRender(){this._hasChangedSinceTheLastRendering=!0,this.getObserver(rt).flush(),this.change((()=>{}))}destroy(){for(const e of this._observers.values())e.destroy();this.document.destroy(),this.stopListening()}createPositionAt(e,t){return K._createAt(e,t)}createPositionAfter(e){return K._createAfter(e)}createPositionBefore(e){return K._createBefore(e)}createRange(e,t){return new G(e,t)}createRangeOn(e){return G._createOn(e)}createRangeIn(e){return G._createIn(e)}createSelection(...e){return new J(...e)}_disableRendering(e){this._renderingDisabled=e,0==e&&this.change((()=>{}))}_render(){this.isRenderingInProgress=!0,this.disableObservers(),this._renderer.render(),this.enableObservers(),this.isRenderingInProgress=!1}}class pt{is(){throw new Error("is() method is abstract")}}class bt extends pt{constructor(e){super(),this.parent=null,this._attrs=(0,n.toMap)(e)}get document(){return null}get index(){let e;if(!this.parent)return null;if(null===(e=this.parent.getChildIndex(this)))throw new n.CKEditorError("model-node-not-found-in-parent",this);return e}get startOffset(){let e;if(!this.parent)return null;if(null===(e=this.parent.getChildStartOffset(this)))throw new n.CKEditorError("model-node-not-found-in-parent",this);return e}get offsetSize(){return 1}get endOffset(){return this.parent?this.startOffset+this.offsetSize:null}get nextSibling(){const e=this.index;return null!==e&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return null!==e&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return null!==this.parent&&this.root.isAttached()}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.startOffset),t=t.parent;return e}getAncestors(e={}){const t=[];let i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}getCommonAncestor(e,t={}){const i=this.getAncestors(t),n=e.getAncestors(t);let o=0;for(;i[o]==n[o]&&i[o];)o++;return 0===o?null:i[o-1]}isBefore(e){if(this==e)return!1;if(this.root!==e.root)return!1;const t=this.getPath(),i=e.getPath(),o=(0,n.compareArrays)(t,i);switch(o){case"prefix":return!0;case"extension":return!1;default:return t[o]<i[o]}}isAfter(e){return this!=e&&this.root===e.root&&!this.isBefore(e)}hasAttribute(e){return this._attrs.has(e)}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}toJSON(){const e={};return this._attrs.size&&(e.attributes=Array.from(this._attrs).reduce(((e,t)=>(e[t[0]]=t[1],e)),{})),e}_clone(e){return new this.constructor(this._attrs)}_remove(){this.parent._removeChildren(this.index)}_setAttribute(e,t){this._attrs.set(e,t)}_setAttributesTo(e){this._attrs=(0,n.toMap)(e)}_removeAttribute(e){return this._attrs.delete(e)}_clearAttributes(){this._attrs.clear()}}bt.prototype.is=function(e){return"node"===e||"model:node"===e};class wt{constructor(e){this._nodes=[],e&&this._insertNodes(0,e)}[Symbol.iterator](){return this._nodes[Symbol.iterator]()}get length(){return this._nodes.length}get maxOffset(){return this._nodes.reduce(((e,t)=>e+t.offsetSize),0)}getNode(e){return this._nodes[e]||null}getNodeIndex(e){const t=this._nodes.indexOf(e);return-1==t?null:t}getNodeStartOffset(e){const t=this.getNodeIndex(e);return null===t?null:this._nodes.slice(0,t).reduce(((e,t)=>e+t.offsetSize),0)}indexToOffset(e){if(e==this._nodes.length)return this.maxOffset;const t=this._nodes[e];if(!t)throw new n.CKEditorError("model-nodelist-index-out-of-bounds",this);return this.getNodeStartOffset(t)}offsetToIndex(e){let t=0;for(const i of this._nodes){if(e>=t&&e<t+i.offsetSize)return this.getNodeIndex(i);t+=i.offsetSize}if(t!=e)throw new n.CKEditorError("model-nodelist-offset-out-of-bounds",this,{offset:e,nodeList:this});return this.length}_insertNodes(e,t){for(const e of t)if(!(e instanceof bt))throw new n.CKEditorError("model-nodelist-insertnodes-not-node",this);this._nodes=(0,n.spliceArray)(this._nodes,Array.from(t),e,0)}_removeNodes(e,t=1){return this._nodes.splice(e,t)}toJSON(){return this._nodes.map((e=>e.toJSON()))}}class vt extends bt{constructor(e,t){super(t),this._data=e||""}get offsetSize(){return this.data.length}get data(){return this._data}toJSON(){const e=super.toJSON();return e.data=this.data,e}_clone(){return new vt(this.data,this.getAttributes())}static fromJSON(e){return new vt(e.data,e.attributes)}}vt.prototype.is=function(e){return"$text"===e||"model:$text"===e||"text"===e||"model:text"===e||"node"===e||"model:node"===e};class _t extends pt{constructor(e,t,i){if(super(),this.textNode=e,t<0||t>e.offsetSize)throw new n.CKEditorError("model-textproxy-wrong-offsetintext",this);if(i<0||t+i>e.offsetSize)throw new n.CKEditorError("model-textproxy-wrong-length",this);this.data=e.data.substring(t,t+i),this.offsetInText=t}get startOffset(){return null!==this.textNode.startOffset?this.textNode.startOffset+this.offsetInText:null}get offsetSize(){return this.data.length}get endOffset(){return null!==this.startOffset?this.startOffset+this.offsetSize:null}get isPartial(){return this.offsetSize!==this.textNode.offsetSize}get parent(){return this.textNode.parent}get root(){return this.textNode.root}getPath(){const e=this.textNode.getPath();return e.length>0&&(e[e.length-1]+=this.offsetInText),e}getAncestors(e={}){const t=[];let i=e.includeSelf?this:this.parent;for(;i;)t[e.parentFirst?"push":"unshift"](i),i=i.parent;return t}hasAttribute(e){return this.textNode.hasAttribute(e)}getAttribute(e){return this.textNode.getAttribute(e)}getAttributes(){return this.textNode.getAttributes()}getAttributeKeys(){return this.textNode.getAttributeKeys()}}_t.prototype.is=function(e){return"$textProxy"===e||"model:$textProxy"===e||"textProxy"===e||"model:textProxy"===e};class yt extends bt{constructor(e,t,i){super(t),this._children=new wt,this.name=e,i&&this._insertChild(0,i)}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return 0===this.childCount}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}offsetToIndex(e){return this._children.offsetToIndex(e)}getNodeByPath(e){let t=this;for(const i of e)t=t.getChild(t.offsetToIndex(i));return t}findAncestor(e,t={}){let i=t.includeSelf?this:this.parent;for(;i;){if(i.name===e)return i;i=i.parent}return null}toJSON(){const e=super.toJSON();if(e.name=this.name,this._children.length>0){e.children=[];for(const t of this._children)e.children.push(t.toJSON())}return e}_clone(e=!1){const t=e?Array.from(this._children).map((e=>e._clone(!0))):void 0;return new yt(this.name,this.getAttributes(),t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const i=function(e){return"string"==typeof e?[new vt(e)]:((0,n.isIterable)(e)||(e=[e]),Array.from(e).map((e=>"string"==typeof e?new vt(e):e instanceof _t?new vt(e.data,e.getAttributes()):e)))}(t);for(const e of i)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,i)}_removeChildren(e,t=1){const i=this._children._removeNodes(e,t);for(const e of i)e.parent=null;return i}static fromJSON(e){let t;if(e.children){t=[];for(const i of e.children)i.name?t.push(yt.fromJSON(i)):t.push(vt.fromJSON(i))}return new yt(e.name,e.attributes,t)}}yt.prototype.is=function(e,t){return t?t===this.name&&("element"===e||"model:element"===e):"element"===e||"model:element"===e||"node"===e||"model:node"===e};class kt{constructor(e){if(!e||!e.boundaries&&!e.startPosition)throw new n.CKEditorError("model-tree-walker-no-start-position",null);const t=e.direction||"forward";if("forward"!=t&&"backward"!=t)throw new n.CKEditorError("model-tree-walker-unknown-direction",e,{direction:t});this.direction=t,this.boundaries=e.boundaries||null,e.startPosition?this._position=e.startPosition.clone():this._position=At._createAt(this.boundaries["backward"==this.direction?"end":"start"]),this.position.stickiness="toNone",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null,this._visitedParent=this.position.parent}[Symbol.iterator](){return this}get position(){return this._position}skip(e){let t,i,n,o;do{n=this.position,o=this._visitedParent,({done:t,value:i}=this.next())}while(!t&&e(i));t||(this._position=n,this._visitedParent=o)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){const e=this.position,t=this.position.clone(),i=this._visitedParent;if(null===i.parent&&t.offset===i.maxOffset)return{done:!0,value:void 0};if(i===this._boundaryEndParent&&t.offset==this.boundaries.end.offset)return{done:!0,value:void 0};const n=Et(t,i),o=n||xt(t,i,n);if(o instanceof yt){if(this.shallow){if(this.boundaries&&this.boundaries.end.isBefore(t))return{done:!0,value:void 0};t.offset++}else t.path.push(0),this._visitedParent=o;return this._position=t,Ct("elementStart",o,e,t,1)}if(o instanceof vt){let n;if(this.singleCharacters)n=1;else{let e=o.endOffset;this._boundaryEndParent==i&&this.boundaries.end.offset<e&&(e=this.boundaries.end.offset),n=e-t.offset}const s=t.offset-o.startOffset,r=new _t(o,s,n);return t.offset+=n,this._position=t,Ct("text",r,e,t,n)}return t.path.pop(),t.offset++,this._position=t,this._visitedParent=i.parent,this.ignoreElementEnd?this._next():Ct("elementEnd",i,e,t)}_previous(){const e=this.position,t=this.position.clone(),i=this._visitedParent;if(null===i.parent&&0===t.offset)return{done:!0,value:void 0};if(i==this._boundaryStartParent&&t.offset==this.boundaries.start.offset)return{done:!0,value:void 0};const n=t.parent,o=Et(t,n),s=o||Tt(t,n,o);if(s instanceof yt)return t.offset--,this.shallow?(this._position=t,Ct("elementStart",s,e,t,1)):(t.path.push(s.maxOffset),this._position=t,this._visitedParent=s,this.ignoreElementEnd?this._previous():Ct("elementEnd",s,e,t));if(s instanceof vt){let n;if(this.singleCharacters)n=1;else{let e=s.startOffset;this._boundaryStartParent==i&&this.boundaries.start.offset>e&&(e=this.boundaries.start.offset),n=t.offset-e}const o=t.offset-s.startOffset,r=new _t(s,o-n,n);return t.offset-=n,this._position=t,Ct("text",r,e,t,n)}return t.path.pop(),this._position=t,this._visitedParent=i.parent,Ct("elementStart",i,e,t,1)}}function Ct(e,t,i,n,o){return{done:!1,value:{type:e,item:t,previousPosition:i,nextPosition:n,length:o}}}class At extends pt{constructor(e,t,i="toNone"){if(super(),!e.is("element")&&!e.is("documentFragment"))throw new n.CKEditorError("model-position-root-invalid",e);if(!(t instanceof Array)||0===t.length)throw new n.CKEditorError("model-position-path-incorrect-format",e,{path:t});e.is("rootElement")?t=t.slice():(t=[...e.getPath(),...t],e=e.root),this.root=e,this.path=t,this.stickiness=i}get offset(){return this.path[this.path.length-1]}set offset(e){this.path[this.path.length-1]=e}get parent(){let e=this.root;for(let t=0;t<this.path.length-1;t++)if(e=e.getChild(e.offsetToIndex(this.path[t])),!e)throw new n.CKEditorError("model-position-path-incorrect",this,{position:this});if(e.is("$text"))throw new n.CKEditorError("model-position-path-incorrect",this,{position:this});return e}get index(){return this.parent.offsetToIndex(this.offset)}get textNode(){return Et(this,this.parent)}get nodeAfter(){const e=this.parent;return xt(this,e,Et(this,e))}get nodeBefore(){const e=this.parent;return Tt(this,e,Et(this,e))}get isAtStart(){return 0===this.offset}get isAtEnd(){return this.offset==this.parent.maxOffset}compareWith(e){if(this.root!=e.root)return"different";const t=(0,n.compareArrays)(this.path,e.path);switch(t){case"same":return"same";case"prefix":return"before";case"extension":return"after";default:return this.path[t]<e.path[t]?"before":"after"}}getLastMatchingPosition(e,t={}){t.startPosition=this;const i=new kt(t);return i.skip(e),i.position}getParentPath(){return this.path.slice(0,-1)}getAncestors(){const e=this.parent;return e.is("documentFragment")?[e]:e.getAncestors({includeSelf:!0})}findAncestor(e){const t=this.parent;return t.is("element")?t.findAncestor(e,{includeSelf:!0}):null}getCommonPath(e){if(this.root!=e.root)return[];const t=(0,n.compareArrays)(this.path,e.path),i="string"==typeof t?Math.min(this.path.length,e.path.length):t;return this.path.slice(0,i)}getCommonAncestor(e){const t=this.getAncestors(),i=e.getAncestors();let n=0;for(;t[n]==i[n]&&t[n];)n++;return 0===n?null:t[n-1]}getShiftedBy(e){const t=this.clone(),i=t.offset+e;return t.offset=i<0?0:i,t}isAfter(e){return"after"==this.compareWith(e)}isBefore(e){return"before"==this.compareWith(e)}isEqual(e){return"same"==this.compareWith(e)}isTouching(e){if(this.root!==e.root)return!1;const t=Math.min(this.path.length,e.path.length);for(let i=0;i<t;i++){const t=this.path[i]-e.path[i];if(t<-1||t>1)return!1;if(1===t)return Pt(e,this,i);if(-1===t)return Pt(this,e,i)}return this.path.length===e.path.length||(this.path.length>e.path.length?It(this.path,t):It(e.path,t))}hasSameParentAs(e){if(this.root!==e.root)return!1;const t=this.getParentPath(),i=e.getParentPath();return"same"==(0,n.compareArrays)(t,i)}getTransformedByOperation(e){let t;switch(e.type){case"insert":t=this._getTransformedByInsertOperation(e);break;case"move":case"remove":case"reinsert":t=this._getTransformedByMoveOperation(e);break;case"split":t=this._getTransformedBySplitOperation(e);break;case"merge":t=this._getTransformedByMergeOperation(e);break;default:t=At._createAt(this)}return t}_getTransformedByInsertOperation(e){return this._getTransformedByInsertion(e.position,e.howMany)}_getTransformedByMoveOperation(e){return this._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany)}_getTransformedBySplitOperation(e){const t=e.movedRange;return t.containsPosition(this)||t.start.isEqual(this)&&"toNext"==this.stickiness?this._getCombined(e.splitPosition,e.moveTargetPosition):e.graveyardPosition?this._getTransformedByMove(e.graveyardPosition,e.insertionPosition,1):this._getTransformedByInsertion(e.insertionPosition,1)}_getTransformedByMergeOperation(e){const t=e.movedRange;let i;return t.containsPosition(this)||t.start.isEqual(this)?(i=this._getCombined(e.sourcePosition,e.targetPosition),e.sourcePosition.isBefore(e.targetPosition)&&(i=i._getTransformedByDeletion(e.deletionPosition,1))):i=this.isEqual(e.deletionPosition)?At._createAt(e.deletionPosition):this._getTransformedByMove(e.deletionPosition,e.graveyardPosition,1),i}_getTransformedByDeletion(e,t){const i=At._createAt(this);if(this.root!=e.root)return i;if("same"==(0,n.compareArrays)(e.getParentPath(),this.getParentPath())){if(e.offset<this.offset){if(e.offset+t>this.offset)return null;i.offset-=t}}else if("prefix"==(0,n.compareArrays)(e.getParentPath(),this.getParentPath())){const n=e.path.length-1;if(e.offset<=this.path[n]){if(e.offset+t>this.path[n])return null;i.path[n]-=t}}return i}_getTransformedByInsertion(e,t){const i=At._createAt(this);if(this.root!=e.root)return i;if("same"==(0,n.compareArrays)(e.getParentPath(),this.getParentPath()))(e.offset<this.offset||e.offset==this.offset&&"toPrevious"!=this.stickiness)&&(i.offset+=t);else if("prefix"==(0,n.compareArrays)(e.getParentPath(),this.getParentPath())){const n=e.path.length-1;e.offset<=this.path[n]&&(i.path[n]+=t)}return i}_getTransformedByMove(e,t,i){if(t=t._getTransformedByDeletion(e,i),e.isEqual(t))return At._createAt(this);const n=this._getTransformedByDeletion(e,i);return null===n||e.isEqual(this)&&"toNext"==this.stickiness||e.getShiftedBy(i).isEqual(this)&&"toPrevious"==this.stickiness?this._getCombined(e,t):n._getTransformedByInsertion(t,i)}_getCombined(e,t){const i=e.path.length-1,n=At._createAt(t);return n.stickiness=this.stickiness,n.offset=n.offset+this.path[i]-e.offset,n.path=[...n.path,...this.path.slice(i+1)],n}toJSON(){return{root:this.root.toJSON(),path:Array.from(this.path),stickiness:this.stickiness}}clone(){return new this.constructor(this.root,this.path,this.stickiness)}static _createAt(e,t,i="toNone"){if(e instanceof At)return new At(e.root,e.path,e.stickiness);{const o=e;if("end"==t)t=o.maxOffset;else{if("before"==t)return this._createBefore(o,i);if("after"==t)return this._createAfter(o,i);if(0!==t&&!t)throw new n.CKEditorError("model-createpositionat-offset-required",[this,e])}if(!o.is("element")&&!o.is("documentFragment"))throw new n.CKEditorError("model-position-parent-incorrect",[this,e]);const s=o.getPath();return s.push(t),new this(o.root,s,i)}}static _createAfter(e,t){if(!e.parent)throw new n.CKEditorError("model-position-after-root",[this,e],{root:e});return this._createAt(e.parent,e.endOffset,t)}static _createBefore(e,t){if(!e.parent)throw new n.CKEditorError("model-position-before-root",e,{root:e});return this._createAt(e.parent,e.startOffset,t)}static fromJSON(e,t){if("$graveyard"===e.root){const i=new At(t.graveyard,e.path);return i.stickiness=e.stickiness,i}if(!t.getRoot(e.root))throw new n.CKEditorError("model-position-fromjson-no-root",t,{rootName:e.root});return new At(t.getRoot(e.root),e.path,e.stickiness)}}function Et(e,t){const i=t.getChild(t.offsetToIndex(e.offset));return i&&i.is("$text")&&i.startOffset<e.offset?i:null}function xt(e,t,i){return null!==i?null:t.getChild(t.offsetToIndex(e.offset))}function Tt(e,t,i){return null!==i?null:t.getChild(t.offsetToIndex(e.offset)-1)}function Pt(e,t,i){return i+1!==e.path.length&&!!It(t.path,i+1)&&!!function(e,t){let i=e.parent,n=e.path.length-1,o=0;for(;n>=t;){if(e.path[n]+o!==i.maxOffset)return!1;o=1,n--,i=i.parent}return!0}(e,i+1)}function It(e,t){for(;t<e.length;){if(0!==e[t])return!1;t++}return!0}At.prototype.is=function(e){return"position"===e||"model:position"===e};class St extends pt{constructor(e,t){super(),this.start=At._createAt(e),this.end=t?At._createAt(t):At._createAt(e),this.start.stickiness=this.isCollapsed?"toNone":"toNext",this.end.stickiness=this.isCollapsed?"toNone":"toPrevious"}*[Symbol.iterator](){yield*new kt({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){const e=this.start.getParentPath(),t=this.end.getParentPath();return"same"==(0,n.compareArrays)(e,t)}get root(){return this.start.root}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);const i=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),n=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return i&&n}containsItem(e){const t=At._createBefore(e);return this.containsPosition(t)||this.start.isEqual(t)}isEqual(e){return this.start.isEqual(e.start)&&this.end.isEqual(e.end)}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new St(this.start,e.start)),this.containsPosition(e.end)&&t.push(new St(e.end,this.end))):t.push(new St(this.start,this.end)),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,i=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(i=e.end),new St(t,i)}return null}getJoined(e,t=!1){let i=this.isIntersecting(e);if(i||(i=this.start.isBefore(e.start)?t?this.end.isTouching(e.start):this.end.isEqual(e.start):t?e.end.isTouching(this.start):e.end.isEqual(this.start)),!i)return null;let n=this.start,o=this.end;return e.start.isBefore(n)&&(n=e.start),e.end.isAfter(o)&&(o=e.end),new St(n,o)}getMinimalFlatRanges(){const e=[],t=this.start.getCommonPath(this.end).length,i=At._createAt(this.start);let n=i.parent;for(;i.path.length>t+1;){const t=n.maxOffset-i.offset;0!==t&&e.push(new St(i,i.getShiftedBy(t))),i.path=i.path.slice(0,-1),i.offset++,n=n.parent}for(;i.path.length<=this.end.path.length;){const t=this.end.path[i.path.length-1],n=t-i.offset;0!==n&&e.push(new St(i,i.getShiftedBy(n))),i.offset=t,i.path.push(0)}return e}getWalker(e={}){return e.boundaries=this,new kt(e)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new kt(e);for(const e of t)yield e.item}*getPositions(e={}){e.boundaries=this;const t=new kt(e);yield t.position;for(const e of t)yield e.nextPosition}getTransformedByOperation(e){switch(e.type){case"insert":return this._getTransformedByInsertOperation(e);case"move":case"remove":case"reinsert":return this._getTransformedByMoveOperation(e);case"split":return[this._getTransformedBySplitOperation(e)];case"merge":return[this._getTransformedByMergeOperation(e)]}return[new St(this.start,this.end)]}getTransformedByOperations(e){const t=[new St(this.start,this.end)];for(const i of e)for(let e=0;e<t.length;e++){const n=t[e].getTransformedByOperation(i);t.splice(e,1,...n),e+=n.length-1}for(let e=0;e<t.length;e++){const i=t[e];for(let n=e+1;n<t.length;n++){const e=t[n];(i.containsRange(e)||e.containsRange(i)||i.isEqual(e))&&t.splice(n,1)}}return t}getCommonAncestor(){return this.start.getCommonAncestor(this.end)}getContainedElement(){if(this.isCollapsed)return null;const e=this.start.nodeAfter,t=this.end.nodeBefore;return e&&e.is("element")&&e===t?e:null}toJSON(){return{start:this.start.toJSON(),end:this.end.toJSON()}}clone(){return new this.constructor(this.start,this.end)}_getTransformedByInsertOperation(e,t=!1){return this._getTransformedByInsertion(e.position,e.howMany,t)}_getTransformedByMoveOperation(e,t=!1){const i=e.sourcePosition,n=e.howMany,o=e.targetPosition;return this._getTransformedByMove(i,o,n,t)}_getTransformedBySplitOperation(e){const t=this.start._getTransformedBySplitOperation(e);let i=this.end._getTransformedBySplitOperation(e);return this.end.isEqual(e.insertionPosition)&&(i=this.end.getShiftedBy(1)),t.root!=i.root&&(i=this.end.getShiftedBy(-1)),new St(t,i)}_getTransformedByMergeOperation(e){if(this.start.isEqual(e.targetPosition)&&this.end.isEqual(e.deletionPosition))return new St(this.start);let t=this.start._getTransformedByMergeOperation(e),i=this.end._getTransformedByMergeOperation(e);return t.root!=i.root&&(i=this.end.getShiftedBy(-1)),t.isAfter(i)?(e.sourcePosition.isBefore(e.targetPosition)?(t=At._createAt(i),t.offset=0):(e.deletionPosition.isEqual(t)||(i=e.deletionPosition),t=e.targetPosition),new St(t,i)):new St(t,i)}_getTransformedByInsertion(e,t,i=!1){if(i&&this.containsPosition(e))return[new St(this.start,e),new St(e.getShiftedBy(t),this.end._getTransformedByInsertion(e,t))];{const i=new St(this.start,this.end);return i.start=i.start._getTransformedByInsertion(e,t),i.end=i.end._getTransformedByInsertion(e,t),[i]}}_getTransformedByMove(e,t,i,n=!1){if(this.isCollapsed){const n=this.start._getTransformedByMove(e,t,i);return[new St(n)]}const o=St._createFromPositionAndShift(e,i),s=t._getTransformedByDeletion(e,i);if(this.containsPosition(t)&&!n&&(o.containsPosition(this.start)||o.containsPosition(this.end))){const n=this.start._getTransformedByMove(e,t,i),o=this.end._getTransformedByMove(e,t,i);return[new St(n,o)]}let r;const a=this.getDifference(o);let l=null;const c=this.getIntersection(o);if(1==a.length?l=new St(a[0].start._getTransformedByDeletion(e,i),a[0].end._getTransformedByDeletion(e,i)):2==a.length&&(l=new St(this.start,this.end._getTransformedByDeletion(e,i))),r=l?l._getTransformedByInsertion(s,i,null!==c||n):[],c){const e=new St(c.start._getCombined(o.start,s),c.end._getCombined(o.start,s));2==r.length?r.splice(1,0,e):r.push(e)}return r}_getTransformedByDeletion(e,t){let i=this.start._getTransformedByDeletion(e,t),n=this.end._getTransformedByDeletion(e,t);return null==i&&null==n?null:(null==i&&(i=e),null==n&&(n=e),new St(i,n))}static _createFromPositionAndShift(e,t){const i=e,n=e.getShiftedBy(t);return t>0?new this(i,n):new this(n,i)}static _createIn(e){return new this(At._createAt(e,0),At._createAt(e,e.maxOffset))}static _createOn(e){return this._createFromPositionAndShift(At._createBefore(e),e.offsetSize)}static _createFromRanges(e){if(0===e.length)throw new n.CKEditorError("range-create-from-ranges-empty-array",null);if(1==e.length)return e[0].clone();const t=e[0];e.sort(((e,t)=>e.start.isAfter(t.start)?1:-1));const i=e.indexOf(t),o=new this(t.start,t.end);if(i>0)for(let t=i-1;e[t].end.isEqual(o.start);t++)o.start=At._createAt(e[t].start);for(let t=i+1;t<e.length&&e[t].start.isEqual(o.end);t++)o.end=At._createAt(e[t].end);return o}static fromJSON(e,t){return new this(At.fromJSON(e.start,t),At.fromJSON(e.end,t))}}St.prototype.is=function(e){return"range"===e||"model:range"===e};class Vt extends((0,n.EmitterMixin)()){constructor(){super(),this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._viewToModelLengthCallbacks=new Map,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._deferredBindingRemovals=new Map,this._unboundMarkerNames=new Set,this.on("modelToViewPosition",((e,t)=>{if(t.viewPosition)return;const i=this._modelToViewMapping.get(t.modelPosition.parent);if(!i)throw new n.CKEditorError("mapping-model-position-view-parent-not-found",this,{modelPosition:t.modelPosition});t.viewPosition=this.findPositionIn(i,t.modelPosition.offset)}),{priority:"low"}),this.on("viewToModelPosition",((e,t)=>{if(t.modelPosition)return;const i=this.findMappedViewAncestor(t.viewPosition),n=this._viewToModelMapping.get(i),o=this._toModelOffset(t.viewPosition.parent,t.viewPosition.offset,i);t.modelPosition=At._createAt(n,o)}),{priority:"low"})}bindElements(e,t){this._modelToViewMapping.set(e,t),this._viewToModelMapping.set(t,e)}unbindViewElement(e,t={}){const i=this.toModelElement(e);if(this._elementToMarkerNames.has(e))for(const t of this._elementToMarkerNames.get(e))this._unboundMarkerNames.add(t);t.defer?this._deferredBindingRemovals.set(e,e.root):(this._viewToModelMapping.delete(e),this._modelToViewMapping.get(i)==e&&this._modelToViewMapping.delete(i))}unbindModelElement(e){const t=this.toViewElement(e);this._modelToViewMapping.delete(e),this._viewToModelMapping.get(t)==e&&this._viewToModelMapping.delete(t)}bindElementToMarker(e,t){const i=this._markerNameToElements.get(t)||new Set;i.add(e);const n=this._elementToMarkerNames.get(e)||new Set;n.add(t),this._markerNameToElements.set(t,i),this._elementToMarkerNames.set(e,n)}unbindElementFromMarkerName(e,t){const i=this._markerNameToElements.get(t);i&&(i.delete(e),0==i.size&&this._markerNameToElements.delete(t));const n=this._elementToMarkerNames.get(e);n&&(n.delete(t),0==n.size&&this._elementToMarkerNames.delete(e))}flushUnboundMarkerNames(){const e=Array.from(this._unboundMarkerNames);return this._unboundMarkerNames.clear(),e}flushDeferredBindings(){for(const[e,t]of this._deferredBindingRemovals)e.root==t&&this.unbindViewElement(e);this._deferredBindingRemovals=new Map}clearBindings(){this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._unboundMarkerNames=new Set,this._deferredBindingRemovals=new Map}toModelElement(e){return this._viewToModelMapping.get(e)}toViewElement(e){return this._modelToViewMapping.get(e)}toModelRange(e){return new St(this.toModelPosition(e.start),this.toModelPosition(e.end))}toViewRange(e){return new G(this.toViewPosition(e.start),this.toViewPosition(e.end))}toModelPosition(e){const t={viewPosition:e,mapper:this};return this.fire("viewToModelPosition",t),t.modelPosition}toViewPosition(e,t={}){const i={modelPosition:e,mapper:this,isPhantom:t.isPhantom};return this.fire("modelToViewPosition",i),i.viewPosition}markerNameToElements(e){const t=this._markerNameToElements.get(e);if(!t)return null;const i=new Set;for(const e of t)if(e.is("attributeElement"))for(const t of e.getElementsWithSameId())i.add(t);else i.add(e);return i}registerViewToModelLength(e,t){this._viewToModelLengthCallbacks.set(e,t)}findMappedViewAncestor(e){let t=e.parent;for(;!this._viewToModelMapping.has(t);)t=t.parent;return t}_toModelOffset(e,t,i){if(i!=e)return this._toModelOffset(e.parent,e.index,i)+this._toModelOffset(e,t,e);if(e.is("$text"))return t;let n=0;for(let i=0;i<t;i++)n+=this.getModelLength(e.getChild(i));return n}getModelLength(e){if(this._viewToModelLengthCallbacks.get(e.name))return this._viewToModelLengthCallbacks.get(e.name)(e);if(this._viewToModelMapping.has(e))return 1;if(e.is("$text"))return e.data.length;if(e.is("uiElement"))return 0;{let t=0;for(const i of e.getChildren())t+=this.getModelLength(i);return t}}findPositionIn(e,t){let i,n=0,o=0,s=0;if(e.is("$text"))return new K(e,t);for(;o<t;)i=e.getChild(s),n=this.getModelLength(i),o+=n,s++;return o==t?this._moveViewPositionToTextNode(new K(e,s)):this.findPositionIn(i,t-(o-n))}_moveViewPositionToTextNode(e){const t=e.nodeBefore,i=e.nodeAfter;return t instanceof w?new K(t,t.data.length):i instanceof w?new K(i,0):e}}class Rt{constructor(){this._consumable=new Map,this._textProxyRegistry=new Map}add(e,t){t=Bt(t),e instanceof _t&&(e=this._getSymbolForTextProxy(e)),this._consumable.has(e)||this._consumable.set(e,new Map),this._consumable.get(e).set(t,!0)}consume(e,t){return t=Bt(t),e instanceof _t&&(e=this._getSymbolForTextProxy(e)),!!this.test(e,t)&&(this._consumable.get(e).set(t,!1),!0)}test(e,t){t=Bt(t),e instanceof _t&&(e=this._getSymbolForTextProxy(e));const i=this._consumable.get(e);if(void 0===i)return null;const n=i.get(t);return void 0===n?null:n}revert(e,t){t=Bt(t),e instanceof _t&&(e=this._getSymbolForTextProxy(e));const i=this.test(e,t);return!1===i?(this._consumable.get(e).set(t,!0),!0):!0!==i&&null}verifyAllConsumed(e){const t=[];for(const[i,n]of this._consumable)for(const[o,s]of n){const n=o.split(":")[0];s&&e==n&&t.push({event:o,item:i.name||i.description})}if(t.length)throw new n.CKEditorError("conversion-model-consumable-not-consumed",null,{items:t})}_getSymbolForTextProxy(e){let t=null;const i=this._textProxyRegistry.get(e.startOffset);if(i){const n=i.get(e.endOffset);n&&(t=n.get(e.parent))}return t||(t=this._addSymbolForTextProxy(e)),t}_addSymbolForTextProxy(e){const t=e.startOffset,i=e.endOffset,n=e.parent,o=Symbol("$textProxy:"+e.data);let s,r;return s=this._textProxyRegistry.get(t),s||(s=new Map,this._textProxyRegistry.set(t,s)),r=s.get(i),r||(r=new Map,s.set(i,r)),r.set(n,o),o}}function Bt(e){const t=e.split(":");return"insert"==t[0]?t[0]:"addMarker"==t[0]||"removeMarker"==t[0]?e:t.length>1?t[0]+":"+t[1]:t[0]}class Mt extends((0,n.EmitterMixin)()){constructor(e){super(),this._conversionApi={dispatcher:this,...e},this._firedEventsMap=new WeakMap}convertChanges(e,t,i){const n=this._createConversionApi(i,e.getRefreshedItems());for(const t of e.getMarkersToRemove())this._convertMarkerRemove(t.name,t.range,n);const o=this._reduceChanges(e.getChanges());for(const e of o)"insert"===e.type?this._convertInsert(St._createFromPositionAndShift(e.position,e.length),n):"reinsert"===e.type?this._convertReinsert(St._createFromPositionAndShift(e.position,e.length),n):"remove"===e.type?this._convertRemove(e.position,e.length,e.name,n):this._convertAttribute(e.range,e.attributeKey,e.attributeOldValue,e.attributeNewValue,n);n.mapper.flushDeferredBindings();for(const e of n.mapper.flushUnboundMarkerNames()){const i=t.get(e).getRange();this._convertMarkerRemove(e,i,n),this._convertMarkerAdd(e,i,n)}for(const t of e.getMarkersToAdd())this._convertMarkerAdd(t.name,t.range,n);n.consumable.verifyAllConsumed("insert")}convert(e,t,i,n={}){const o=this._createConversionApi(i,void 0,n);this._convertInsert(e,o);for(const[e,i]of t)this._convertMarkerAdd(e,i,o);o.consumable.verifyAllConsumed("insert")}convertSelection(e,t,i){const n=this._createConversionApi(i);this.fire("cleanSelection",{selection:e},n);const o=e.getFirstPosition().root;if(!n.mapper.toViewElement(o))return;const s=Array.from(t.getMarkersAtPosition(e.getFirstPosition()));if(this._addConsumablesForSelection(n.consumable,e,s),this.fire("selection",{selection:e},n),e.isCollapsed){for(const t of s)if(n.consumable.test(e,"addMarker:"+t.name)){const i=t.getRange();if(!Ot(e.getFirstPosition(),t,n.mapper))continue;const o={item:e,markerName:t.name,markerRange:i};this.fire(`addMarker:${t.name}`,o,n)}for(const t of e.getAttributeKeys())if(n.consumable.test(e,"attribute:"+t)){const i={item:e,range:e.getFirstRange(),attributeKey:t,attributeOldValue:null,attributeNewValue:e.getAttribute(t)};this.fire(`attribute:${t}:$text`,i,n)}}}_convertInsert(e,t,i={}){i.doNotAddConsumables||this._addConsumablesForInsert(t.consumable,e);for(const i of Array.from(e.getWalker({shallow:!0})).map(Lt))this._testAndFire("insert",i,t)}_convertRemove(e,t,i,n){this.fire(`remove:${i}`,{position:e,length:t},n)}_convertAttribute(e,t,i,n,o){this._addConsumablesForRange(o.consumable,e,`attribute:${t}`);for(const s of e){const e={item:s.item,range:St._createFromPositionAndShift(s.previousPosition,s.length),attributeKey:t,attributeOldValue:i,attributeNewValue:n};this._testAndFire(`attribute:${t}`,e,o)}}_convertReinsert(e,t){const i=Array.from(e.getWalker({shallow:!0}));this._addConsumablesForInsert(t.consumable,i);for(const e of i.map(Lt))this._testAndFire("insert",{...e,reconversion:!0},t)}_convertMarkerAdd(e,t,i){if("$graveyard"==t.root.rootName)return;const n=`addMarker:${e}`;if(i.consumable.add(t,n),this.fire(n,{markerName:e,markerRange:t},i),i.consumable.consume(t,n)){this._addConsumablesForRange(i.consumable,t,n);for(const o of t.getItems()){if(!i.consumable.test(o,n))continue;const s={item:o,range:St._createOn(o),markerName:e,markerRange:t};this.fire(n,s,i)}}}_convertMarkerRemove(e,t,i){"$graveyard"!=t.root.rootName&&this.fire(`removeMarker:${e}`,{markerName:e,markerRange:t},i)}_reduceChanges(e){const t={changes:e};return this.fire("reduceChanges",t),t.changes}_addConsumablesForInsert(e,t){for(const i of t){const t=i.item;if(null===e.test(t,"insert")){e.add(t,"insert");for(const i of t.getAttributeKeys())e.add(t,"attribute:"+i)}}return e}_addConsumablesForRange(e,t,i){for(const n of t.getItems())e.add(n,i);return e}_addConsumablesForSelection(e,t,i){e.add(t,"selection");for(const n of i)e.add(t,"addMarker:"+n.name);for(const i of t.getAttributeKeys())e.add(t,"attribute:"+i);return e}_testAndFire(e,t,i){const n=function(e,t){return`${e}:${t.item.is("element")?t.item.name:"$text"}`}(e,t),o=t.item.is("$textProxy")?i.consumable._getSymbolForTextProxy(t.item):t.item,s=this._firedEventsMap.get(i),r=s.get(o);if(r){if(r.has(n))return;r.add(n)}else s.set(o,new Set([n]));this.fire(n,t,i)}_testAndFireAddAttributes(e,t){const i={item:e,range:St._createOn(e)};for(const e of i.item.getAttributeKeys())i.attributeKey=e,i.attributeOldValue=null,i.attributeNewValue=i.item.getAttribute(e),this._testAndFire(`attribute:${e}`,i,t)}_createConversionApi(e,t=new Set,i={}){const n={...this._conversionApi,consumable:new Rt,writer:e,options:i,convertItem:e=>this._convertInsert(St._createOn(e),n),convertChildren:e=>this._convertInsert(St._createIn(e),n,{doNotAddConsumables:!0}),convertAttributes:e=>this._testAndFireAddAttributes(e,n),canReuseView:e=>!t.has(n.mapper.toModelElement(e))};return this._firedEventsMap.set(n,new Map),n}}function Ot(e,t,i){const n=t.getRange(),o=Array.from(e.getAncestors());return o.shift(),o.reverse(),!o.some((e=>{if(n.containsItem(e))return!!i.toViewElement(e).getCustomProperty("addHighlight")}))}function Lt(e){return{item:e.item,range:St._createFromPositionAndShift(e.previousPosition,e.length)}}class Ft extends((0,n.EmitterMixin)(pt)){constructor(...e){super(),this._lastRangeBackward=!1,this._attrs=new Map,this._ranges=[],e.length&&this.setTo(...e)}get anchor(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.end:e.start}return null}get focus(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.start:e.end}return null}get isCollapsed(){return 1===this._ranges.length&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}isEqual(e){if(this.rangeCount!=e.rangeCount)return!1;if(0===this.rangeCount)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let i=!1;for(const n of e._ranges)if(t.isEqual(n)){i=!0;break}if(!i)return!1}return!0}*getRanges(){for(const e of this._ranges)yield new St(e.start,e.end)}getFirstRange(){let e=null;for(const t of this._ranges)e&&!t.start.isBefore(e.start)||(e=t);return e?new St(e.start,e.end):null}getLastRange(){let e=null;for(const t of this._ranges)e&&!t.end.isAfter(e.end)||(e=t);return e?new St(e.start,e.end):null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}setTo(...e){let[t,i,o]=e;if("object"==typeof i&&(o=i,i=void 0),null===t)this._setRanges([]);else if(t instanceof Ft)this._setRanges(t.getRanges(),t.isBackward);else if(t&&"function"==typeof t.getRanges)this._setRanges(t.getRanges(),t.isBackward);else if(t instanceof St)this._setRanges([t],!!o&&!!o.backward);else if(t instanceof At)this._setRanges([new St(t)]);else if(t instanceof bt){const e=!!o&&!!o.backward;let s;if("in"==i)s=St._createIn(t);else if("on"==i)s=St._createOn(t);else{if(void 0===i)throw new n.CKEditorError("model-selection-setto-required-second-parameter",[this,t]);s=new St(At._createAt(t,i))}this._setRanges([s],e)}else{if(!(0,n.isIterable)(t))throw new n.CKEditorError("model-selection-setto-not-selectable",[this,t]);this._setRanges(t,o&&!!o.backward)}}_setRanges(e,t=!1){const i=Array.from(e),o=i.some((t=>{if(!(t instanceof St))throw new n.CKEditorError("model-selection-set-ranges-not-range",[this,e]);return this._ranges.every((e=>!e.isEqual(t)))}));(i.length!==this._ranges.length||o)&&(this._replaceAllRanges(i),this._lastRangeBackward=!!t,this.fire("change:range",{directChange:!0}))}setFocus(e,t){if(null===this.anchor)throw new n.CKEditorError("model-selection-setfocus-no-ranges",[this,e]);const i=At._createAt(e,t);if("same"==i.compareWith(this.focus))return;const o=this.anchor;this._ranges.length&&this._popRange(),"before"==i.compareWith(o)?(this._pushRange(new St(i,o)),this._lastRangeBackward=!0):(this._pushRange(new St(o,i)),this._lastRangeBackward=!1),this.fire("change:range",{directChange:!0})}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}hasAttribute(e){return this._attrs.has(e)}removeAttribute(e){this.hasAttribute(e)&&(this._attrs.delete(e),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}setAttribute(e,t){this.getAttribute(e)!==t&&(this._attrs.set(e,t),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}*getSelectedBlocks(){const e=new WeakSet;for(const t of this.getRanges()){const i=zt(t.start,e);Ht(i,t)&&(yield i);for(const i of t.getWalker()){const n=i.item;"elementEnd"==i.type&&Dt(n,e,t)&&(yield n)}const n=zt(t.end,e);Ut(n,t)&&(yield n)}}containsEntireContent(e=this.anchor.root){const t=At._createAt(e,0),i=At._createAt(e,"end");return t.isTouching(this.getFirstPosition())&&i.isTouching(this.getLastPosition())}_pushRange(e){this._checkRange(e),this._ranges.push(new St(e.start,e.end))}_checkRange(e){for(let t=0;t<this._ranges.length;t++)if(e.isIntersecting(this._ranges[t]))throw new n.CKEditorError("model-selection-range-intersects",[this,e],{addedRange:e,intersectingRange:this._ranges[t]})}_replaceAllRanges(e){this._removeAllRanges();for(const t of e)this._pushRange(t)}_removeAllRanges(){for(;this._ranges.length>0;)this._popRange()}_popRange(){this._ranges.pop()}}function Nt(e,t){return!t.has(e)&&(t.add(e),e.root.document.model.schema.isBlock(e)&&!!e.parent)}function Dt(e,t,i){return Nt(e,t)&&Wt(e,i)}function zt(e,t){const i=e.parent.root.document.model.schema,n=e.parent.getAncestors({parentFirst:!0,includeSelf:!0});let o=!1;const s=n.find((e=>!o&&(o=i.isLimit(e),!o&&Nt(e,t))));return n.forEach((e=>t.add(e))),s}function Wt(e,t){const i=function(e){const t=e.root.document.model.schema;let i=e.parent;for(;i;){if(t.isBlock(i))return i;i=i.parent}}(e);return!i||!t.containsRange(St._createOn(i),!0)}function Ht(e,t){return!!e&&(!(!t.isCollapsed&&!e.isEmpty)||!t.start.isTouching(At._createAt(e,e.maxOffset))&&Wt(e,t))}function Ut(e,t){return!!e&&(!(!t.isCollapsed&&!e.isEmpty)||!t.end.isTouching(At._createAt(e,0))&&Wt(e,t))}Ft.prototype.is=function(e){return"selection"===e||"model:selection"===e};class $t extends((0,n.EmitterMixin)(St)){constructor(e,t){super(e,t),jt.call(this)}detach(){this.stopListening()}toRange(){return new St(this.start,this.end)}static fromRange(e){return new $t(e.start,e.end)}}function jt(){this.listenTo(this.root.document.model,"applyOperation",((e,t)=>{const i=t[0];i.isDocumentOperation&&qt.call(this,i)}),{priority:"low"})}function qt(e){const t=this.getTransformedByOperation(e),i=St._createFromRanges(t),n=!i.isEqual(this),o=function(e,t){switch(t.type){case"insert":return e.containsPosition(t.position);case"move":case"remove":case"reinsert":case"merge":return e.containsPosition(t.sourcePosition)||e.start.isEqual(t.sourcePosition)||e.containsPosition(t.targetPosition);case"split":return e.containsPosition(t.splitPosition)||e.containsPosition(t.insertionPosition)}return!1}(this,e);let s=null;if(n){"$graveyard"==i.root.rootName&&(s="remove"==e.type?e.sourcePosition:e.deletionPosition);const t=this.toRange();this.start=i.start,this.end=i.end,this.fire("change:range",t,{deletionPosition:s})}else o&&this.fire("change:content",this.toRange(),{deletionPosition:s})}$t.prototype.is=function(e){return"liveRange"===e||"model:liveRange"===e||"range"==e||"model:range"===e};const Kt="selection:";class Gt extends((0,n.EmitterMixin)(pt)){constructor(e){super(),this._selection=new Zt(e),this._selection.delegate("change:range").to(this),this._selection.delegate("change:attribute").to(this),this._selection.delegate("change:marker").to(this)}get isCollapsed(){return this._selection.isCollapsed}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get rangeCount(){return this._selection.rangeCount}get hasOwnRange(){return this._selection.hasOwnRange}get isBackward(){return this._selection.isBackward}get isGravityOverridden(){return this._selection.isGravityOverridden}get markers(){return this._selection.markers}get _ranges(){return this._selection._ranges}getRanges(){return this._selection.getRanges()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getSelectedBlocks(){return this._selection.getSelectedBlocks()}getSelectedElement(){return this._selection.getSelectedElement()}containsEntireContent(e){return this._selection.containsEntireContent(e)}destroy(){this._selection.destroy()}getAttributeKeys(){return this._selection.getAttributeKeys()}getAttributes(){return this._selection.getAttributes()}getAttribute(e){return this._selection.getAttribute(e)}hasAttribute(e){return this._selection.hasAttribute(e)}refresh(){this._selection.updateMarkers(),this._selection._updateAttributes(!1)}observeMarkers(e){this._selection.observeMarkers(e)}_setFocus(e,t){this._selection.setFocus(e,t)}_setTo(...e){this._selection.setTo(...e)}_setAttribute(e,t){this._selection.setAttribute(e,t)}_removeAttribute(e){this._selection.removeAttribute(e)}_getStoredAttributes(){return this._selection.getStoredAttributes()}_overrideGravity(){return this._selection.overrideGravity()}_restoreGravity(e){this._selection.restoreGravity(e)}static _getStoreAttributeKey(e){return Kt+e}static _isStoreAttributeKey(e){return e.startsWith(Kt)}}Gt.prototype.is=function(e){return"selection"===e||"model:selection"==e||"documentSelection"==e||"model:documentSelection"==e};class Zt extends Ft{constructor(e){super(),this.markers=new n.Collection({idProperty:"name"}),this._attributePriority=new Map,this._selectionRestorePosition=null,this._hasChangedRange=!1,this._overriddenGravityRegister=new Set,this._observedMarkers=new Set,this._model=e.model,this._document=e,this.listenTo(this._model,"applyOperation",((e,t)=>{const i=t[0];i.isDocumentOperation&&"marker"!=i.type&&"rename"!=i.type&&"noop"!=i.type&&(0==this._ranges.length&&this._selectionRestorePosition&&this._fixGraveyardSelection(this._selectionRestorePosition),this._selectionRestorePosition=null,this._hasChangedRange&&(this._hasChangedRange=!1,this.fire("change:range",{directChange:!1})))}),{priority:"lowest"}),this.on("change:range",(()=>{this._validateSelectionRanges(this.getRanges())})),this.listenTo(this._model.markers,"update",((e,t,i,n)=>{this._updateMarker(t,n)})),this.listenTo(this._document,"change",((e,t)=>{!function(e,t){const i=e.document.differ;for(const n of i.getChanges()){if("insert"!=n.type)continue;const i=n.position.parent;n.length===i.maxOffset&&e.enqueueChange(t,(e=>{const t=Array.from(i.getAttributeKeys()).filter((e=>e.startsWith(Kt)));for(const n of t)e.removeAttribute(n,i)}))}}(this._model,t)}))}get isCollapsed(){return 0===this._ranges.length?this._document._getDefaultRange().isCollapsed:super.isCollapsed}get anchor(){return super.anchor||this._document._getDefaultRange().start}get focus(){return super.focus||this._document._getDefaultRange().end}get rangeCount(){return this._ranges.length?this._ranges.length:1}get hasOwnRange(){return this._ranges.length>0}get isGravityOverridden(){return!!this._overriddenGravityRegister.size}destroy(){for(let e=0;e<this._ranges.length;e++)this._ranges[e].detach();this.stopListening()}*getRanges(){this._ranges.length?yield*super.getRanges():yield this._document._getDefaultRange()}getFirstRange(){return super.getFirstRange()||this._document._getDefaultRange()}getLastRange(){return super.getLastRange()||this._document._getDefaultRange()}setTo(...e){super.setTo(...e),this._updateAttributes(!0),this.updateMarkers()}setFocus(e,t){super.setFocus(e,t),this._updateAttributes(!0),this.updateMarkers()}setAttribute(e,t){if(this._setAttribute(e,t)){const t=[e];this.fire("change:attribute",{attributeKeys:t,directChange:!0})}}removeAttribute(e){if(this._removeAttribute(e)){const t=[e];this.fire("change:attribute",{attributeKeys:t,directChange:!0})}}overrideGravity(){const e=(0,n.uid)();return this._overriddenGravityRegister.add(e),1===this._overriddenGravityRegister.size&&this._updateAttributes(!0),e}restoreGravity(e){if(!this._overriddenGravityRegister.has(e))throw new n.CKEditorError("document-selection-gravity-wrong-restore",this,{uid:e});this._overriddenGravityRegister.delete(e),this.isGravityOverridden||this._updateAttributes(!0)}observeMarkers(e){this._observedMarkers.add(e),this.updateMarkers()}_replaceAllRanges(e){this._validateSelectionRanges(e),super._replaceAllRanges(e)}_popRange(){this._ranges.pop().detach()}_pushRange(e){const t=this._prepareRange(e);t&&this._ranges.push(t)}_validateSelectionRanges(e){for(const t of e)if(!this._document._validateSelectionRange(t))throw new n.CKEditorError("document-selection-wrong-position",this,{range:t})}_prepareRange(e){if(this._checkRange(e),e.root==this._document.graveyard)return;const t=$t.fromRange(e);return t.on("change:range",((e,i,n)=>{if(this._hasChangedRange=!0,t.root==this._document.graveyard){this._selectionRestorePosition=n.deletionPosition;const e=this._ranges.indexOf(t);this._ranges.splice(e,1),t.detach()}})),t}updateMarkers(){if(!this._observedMarkers.size)return;const e=[];let t=!1;for(const t of this._model.markers){const i=t.name.split(":",1)[0];if(!this._observedMarkers.has(i))continue;const n=t.getRange();for(const i of this.getRanges())n.containsRange(i,!i.isCollapsed)&&e.push(t)}const i=Array.from(this.markers);for(const i of e)this.markers.has(i)||(this.markers.add(i),t=!0);for(const i of Array.from(this.markers))e.includes(i)||(this.markers.remove(i),t=!0);t&&this.fire("change:marker",{oldMarkers:i,directChange:!1})}_updateMarker(e,t){const i=e.name.split(":",1)[0];if(!this._observedMarkers.has(i))return;let n=!1;const o=Array.from(this.markers),s=this.markers.has(e);if(t){let i=!1;for(const e of this.getRanges())if(t.containsRange(e,!e.isCollapsed)){i=!0;break}i&&!s?(this.markers.add(e),n=!0):!i&&s&&(this.markers.remove(e),n=!0)}else s&&(this.markers.remove(e),n=!0);n&&this.fire("change:marker",{oldMarkers:o,directChange:!1})}_updateAttributes(e){const t=(0,n.toMap)(this._getSurroundingAttributes()),i=(0,n.toMap)(this.getAttributes());if(e)this._attributePriority=new Map,this._attrs=new Map;else for(const[e,t]of this._attributePriority)"low"==t&&(this._attrs.delete(e),this._attributePriority.delete(e));this._setAttributesTo(t);const o=[];for(const[e,t]of this.getAttributes())i.has(e)&&i.get(e)===t||o.push(e);for(const[e]of i)this.hasAttribute(e)||o.push(e);o.length>0&&this.fire("change:attribute",{attributeKeys:o,directChange:!1})}_setAttribute(e,t,i=!0){const n=i?"normal":"low";return("low"!=n||"normal"!=this._attributePriority.get(e))&&(super.getAttribute(e)!==t&&(this._attrs.set(e,t),this._attributePriority.set(e,n),!0))}_removeAttribute(e,t=!0){const i=t?"normal":"low";return!("low"==i&&"normal"==this._attributePriority.get(e)||(this._attributePriority.set(e,i),!super.hasAttribute(e)||(this._attrs.delete(e),0)))}_setAttributesTo(e){const t=new Set;for(const[t,i]of this.getAttributes())e.get(t)!==i&&this._removeAttribute(t,!1);for(const[i,n]of e)this._setAttribute(i,n,!1)&&t.add(i);return t}*getStoredAttributes(){const e=this.getFirstPosition().parent;if(this.isCollapsed&&e.isEmpty)for(const t of e.getAttributeKeys())if(t.startsWith(Kt)){const i=t.substr(10);yield[i,e.getAttribute(t)]}}_getSurroundingAttributes(){const e=this.getFirstPosition(),t=this._model.schema;if("$graveyard"==e.root.rootName)return null;let i=null;if(this.isCollapsed){const n=e.textNode?e.textNode:e.nodeBefore,o=e.textNode?e.textNode:e.nodeAfter;if(this.isGravityOverridden||(i=Jt(n,t)),i||(i=Jt(o,t)),!this.isGravityOverridden&&!i){let e=n;for(;e&&!i;)e=e.previousSibling,i=Jt(e,t)}if(!i){let e=o;for(;e&&!i;)e=e.nextSibling,i=Jt(e,t)}i||(i=this.getStoredAttributes())}else{const e=this.getFirstRange();for(const n of e){if(n.item.is("element")&&t.isObject(n.item)){i=Jt(n.item,t);break}if("text"==n.type){i=n.item.getAttributes();break}}}return i}_fixGraveyardSelection(e){const t=this._model.schema.getNearestSelectionRange(e);t&&this._pushRange(t)}}function Jt(e,t){if(!e)return null;if(e instanceof _t||e instanceof vt)return e.getAttributes();if(!t.isInline(e))return null;if(!t.isObject(e))return[];const i=[];for(const[n,o]of e.getAttributes())t.checkAttribute("$text",n)&&!1!==t.getAttributeProperties(n).copyFromObject&&i.push([n,o]);return i}class Qt{constructor(e){this._dispatchers=e}add(e){for(const t of this._dispatchers)e(t);return this}}class Yt extends Qt{elementToElement(e){return this.add(function(e){const t=oi(e.model),i=si(e.view,"container");return t.attributes.length&&(t.children=!0),n=>{n.on(`insert:${t.name}`,ti(i,di(t)),{priority:e.converterPriority||"normal"}),(t.children||t.attributes.length)&&n.on("reduceChanges",ci(t),{priority:"low"})}}(e))}elementToStructure(e){return this.add(function(e){const t=oi(e.model),i=si(e.view,"container");return t.children=!0,o=>{if(o._conversionApi.schema.checkChild(t.name,"$text"))throw new n.CKEditorError("conversion-element-to-structure-disallowed-text",o,{elementName:t.name});var s,r;o.on(`insert:${t.name}`,(s=i,r=di(t),(e,t,i)=>{if(!r(t.item,i.consumable,{preflight:!0}))return;const o=new Map;i.writer._registerSlotFactory(function(e,t,i){return(o,s)=>{const r=o.createContainerElement("$slot");let a=null;if("children"===s)a=Array.from(e.getChildren());else{if("function"!=typeof s)throw new n.CKEditorError("conversion-slot-mode-unknown",i.dispatcher,{modeOrFilter:s});a=Array.from(e.getChildren()).filter((e=>s(e)))}return t.set(r,a),r}}(t.item,o,i));const a=s(t.item,i,t);if(i.writer._clearSlotFactory(),!a)return;!function(e,t,i){const o=Array.from(t.values()).flat(),s=new Set(o);if(s.size!=o.length)throw new n.CKEditorError("conversion-slot-filter-overlap",i.dispatcher,{element:e});if(s.size!=e.childCount)throw new n.CKEditorError("conversion-slot-filter-incomplete",i.dispatcher,{element:e})}(t.item,o,i),r(t.item,i.consumable);const l=i.mapper.toViewPosition(t.range.start);i.mapper.bindElements(t.item,a),i.writer.insert(l,a),i.convertAttributes(t.item),function(e,t,i,n){i.mapper.on("modelToViewPosition",r,{priority:"highest"});let o=null,s=null;for([o,s]of t)ui(e,s,i,n),i.writer.move(i.writer.createRangeIn(o),i.writer.createPositionBefore(o)),i.writer.remove(o);function r(e,t){const i=t.modelPosition.nodeAfter,n=s.indexOf(i);n<0||(t.viewPosition=t.mapper.findPositionIn(o,n))}i.mapper.off("modelToViewPosition",r)}(a,o,i,{reconversion:t.reconversion})}),{priority:e.converterPriority||"normal"}),o.on("reduceChanges",ci(t),{priority:"low"})}}(e))}attributeToElement(e){return this.add(function(e){let t=(e=(0,gt.A)(e)).model;"string"==typeof t&&(t={key:t});let i=`attribute:${t.key}`;if(t.name&&(i+=":"+t.name),t.values)for(const i of t.values)e.view[i]=si(e.view[i],"attribute");else e.view=si(e.view,"attribute");const n=ri(e);return t=>{t.on(i,ei(n),{priority:e.converterPriority||"normal"})}}(e))}attributeToAttribute(e){return this.add(function(e){let t=(e=(0,gt.A)(e)).model;"string"==typeof t&&(t={key:t});let i=`attribute:${t.key}`;if(t.name&&(i+=":"+t.name),t.values)for(const i of t.values)e.view[i]=ai(e.view[i]);else e.view=ai(e.view);const o=ri(e);return t=>{var s;t.on(i,(s=o,(e,t,i)=>{if(!i.consumable.test(t.item,e.name))return;const o=s(t.attributeOldValue,i,t),r=s(t.attributeNewValue,i,t);if(!o&&!r)return;i.consumable.consume(t.item,e.name);const a=i.mapper.toViewElement(t.item),l=i.writer;if(!a)throw new n.CKEditorError("conversion-attribute-to-attribute-on-text",i.dispatcher,t);if(null!==t.attributeOldValue&&o)if("class"==o.key){const e="string"==typeof o.value?o.value.split(/\s+/):o.value;for(const t of e)l.removeClass(t,a)}else if("style"==o.key)if("string"==typeof o.value){const e=new O(l.document.stylesProcessor);e.setTo(o.value);for(const[t]of e.getStylesEntries())l.removeStyle(t,a)}else{const e=Object.keys(o.value);for(const t of e)l.removeStyle(t,a)}else l.removeAttribute(o.key,a);if(null!==t.attributeNewValue&&r)if("class"==r.key){const e="string"==typeof r.value?r.value.split(/\s+/):r.value;for(const t of e)l.addClass(t,a)}else if("style"==r.key)if("string"==typeof r.value){const e=new O(l.document.stylesProcessor);e.setTo(r.value);for(const[t,i]of e.getStylesEntries())l.setStyle(t,i,a)}else{const e=Object.keys(r.value);for(const t of e)l.setStyle(t,r.value[t],a)}else l.setAttribute(r.key,r.value,a)}),{priority:e.converterPriority||"normal"})}}(e))}markerToElement(e){return this.add(function(e){const t=si(e.view,"ui");return i=>{i.on(`addMarker:${e.model}`,ii(t),{priority:e.converterPriority||"normal"}),i.on(`removeMarker:${e.model}`,((e,t,i)=>{const n=i.mapper.markerNameToElements(t.markerName);if(n){for(const e of n)i.mapper.unbindElementFromMarkerName(e,t.markerName),i.writer.clear(i.writer.createRangeOn(e),e);i.writer.clearClonedElementsGroup(t.markerName),e.stop()}}),{priority:e.converterPriority||"normal"})}}(e))}markerToHighlight(e){return this.add(function(e){return t=>{var i;t.on(`addMarker:${e.model}`,(i=e.view,(e,t,n)=>{if(!t.item)return;if(!(t.item instanceof Ft||t.item instanceof Gt||t.item.is("$textProxy")))return;const o=li(i,t,n);if(!o)return;if(!n.consumable.consume(t.item,e.name))return;const s=n.writer,r=Xt(s,o),a=s.document.selection;if(t.item instanceof Ft||t.item instanceof Gt)s.wrap(a.getFirstRange(),r);else{const e=n.mapper.toViewRange(t.range),i=s.wrap(e,r);for(const e of i.getItems())if(e.is("attributeElement")&&e.isSimilar(r)){n.mapper.bindElementToMarker(e,t.markerName);break}}}),{priority:e.converterPriority||"normal"}),t.on(`addMarker:${e.model}`,function(e){return(t,i,n)=>{if(!i.item)return;if(!(i.item instanceof yt))return;const o=li(e,i,n);if(!o)return;if(!n.consumable.test(i.item,t.name))return;const s=n.mapper.toViewElement(i.item);if(s&&s.getCustomProperty("addHighlight")){n.consumable.consume(i.item,t.name);for(const e of St._createIn(i.item))n.consumable.consume(e.item,t.name);s.getCustomProperty("addHighlight")(s,o,n.writer),n.mapper.bindElementToMarker(s,i.markerName)}}}(e.view),{priority:e.converterPriority||"normal"}),t.on(`removeMarker:${e.model}`,function(e){return(t,i,n)=>{if(i.markerRange.isCollapsed)return;const o=li(e,i,n);if(!o)return;const s=Xt(n.writer,o),r=n.mapper.markerNameToElements(i.markerName);if(r){for(const e of r)n.mapper.unbindElementFromMarkerName(e,i.markerName),e.is("attributeElement")?n.writer.unwrap(n.writer.createRangeOn(e),s):e.getCustomProperty("removeHighlight")(e,o.id,n.writer);n.writer.clearClonedElementsGroup(i.markerName),t.stop()}}}(e.view),{priority:e.converterPriority||"normal"})}}(e))}markerToData(e){return this.add(function(e){const t=(e=(0,gt.A)(e)).model;let i=e.view;return i||(i=i=>({group:t,name:i.substr(e.model.length+1)})),n=>{var o;n.on(`addMarker:${t}`,(o=i,(e,t,i)=>{const n=o(t.markerName,i);if(!n)return;const s=t.markerRange;i.consumable.consume(s,e.name)&&(ni(s,!1,i,t,n),ni(s,!0,i,t,n),e.stop())}),{priority:e.converterPriority||"normal"}),n.on(`removeMarker:${t}`,function(e){return(t,i,n)=>{const o=e(i.markerName,n);if(!o)return;const s=n.mapper.markerNameToElements(i.markerName);if(s){for(const e of s)n.mapper.unbindElementFromMarkerName(e,i.markerName),e.is("containerElement")?(r(`data-${o.group}-start-before`,e),r(`data-${o.group}-start-after`,e),r(`data-${o.group}-end-before`,e),r(`data-${o.group}-end-after`,e)):n.writer.clear(n.writer.createRangeOn(e),e);n.writer.clearClonedElementsGroup(i.markerName),t.stop()}function r(e,t){if(t.hasAttribute(e)){const i=new Set(t.getAttribute(e).split(","));i.delete(o.name),0==i.size?n.writer.removeAttribute(e,t):n.writer.setAttribute(e,Array.from(i).join(","),t)}}}}(i),{priority:e.converterPriority||"normal"})}}(e))}}function Xt(e,t){const i=e.createAttributeElement("span",t.attributes);return t.classes&&i._addClass(t.classes),"number"==typeof t.priority&&(i._priority=t.priority),i._id=t.id,i}function ei(e){return(t,i,n)=>{if(!n.consumable.test(i.item,t.name))return;const o=e(i.attributeOldValue,n,i),s=e(i.attributeNewValue,n,i);if(!o&&!s)return;n.consumable.consume(i.item,t.name);const r=n.writer,a=r.document.selection;if(i.item instanceof Ft||i.item instanceof Gt)r.wrap(a.getFirstRange(),s);else{let e=n.mapper.toViewRange(i.range);null!==i.attributeOldValue&&o&&(e=r.unwrap(e,o)),null!==i.attributeNewValue&&s&&r.wrap(e,s)}}}function ti(e,t=mi){return(i,n,o)=>{if(!t(n.item,o.consumable,{preflight:!0}))return;const s=e(n.item,o,n);if(!s)return;t(n.item,o.consumable);const r=o.mapper.toViewPosition(n.range.start);o.mapper.bindElements(n.item,s),o.writer.insert(r,s),o.convertAttributes(n.item),ui(s,n.item.getChildren(),o,{reconversion:n.reconversion})}}function ii(e){return(t,i,n)=>{i.isOpening=!0;const o=e(i,n);i.isOpening=!1;const s=e(i,n);if(!o||!s)return;const r=i.markerRange;if(r.isCollapsed&&!n.consumable.consume(r,t.name))return;for(const e of r)if(!n.consumable.consume(e.item,t.name))return;const a=n.mapper,l=n.writer;l.insert(a.toViewPosition(r.start),o),n.mapper.bindElementToMarker(o,i.markerName),r.isCollapsed||(l.insert(a.toViewPosition(r.end),s),n.mapper.bindElementToMarker(s,i.markerName)),t.stop()}}function ni(e,t,i,n,o){const s=t?e.start:e.end,r=s.nodeAfter&&s.nodeAfter.is("element")?s.nodeAfter:null,a=s.nodeBefore&&s.nodeBefore.is("element")?s.nodeBefore:null;if(r||a){let e,s;t&&r||!t&&!a?(e=r,s=!0):(e=a,s=!1);const l=i.mapper.toViewElement(e);if(l)return void function(e,t,i,n,o,s){const r=`data-${s.group}-${t?"start":"end"}-${i?"before":"after"}`,a=e.hasAttribute(r)?e.getAttribute(r).split(","):[];a.unshift(s.name),n.writer.setAttribute(r,a.join(","),e),n.mapper.bindElementToMarker(e,o.markerName)}(l,t,s,i,n,o)}!function(e,t,i,n,o){const s=`${o.group}-${t?"start":"end"}`,r=o.name?{name:o.name}:null,a=i.writer.createUIElement(s,r);i.writer.insert(e,a),i.mapper.bindElementToMarker(a,n.markerName)}(i.mapper.toViewPosition(s),t,i,n,o)}function oi(e){return"string"==typeof e&&(e={name:e}),{name:e.name,attributes:e.attributes?(0,n.toArray)(e.attributes):[],children:!!e.children}}function si(e,t){return"function"==typeof e?e:(i,n)=>function(e,t,i){let n;"string"==typeof e&&(e={name:e});const o=t.writer,s=Object.assign({},e.attributes);if("container"==i)n=o.createContainerElement(e.name,s);else if("attribute"==i){const t={priority:e.priority||ae.DEFAULT_PRIORITY};n=o.createAttributeElement(e.name,s,t)}else n=o.createUIElement(e.name,s);if(e.styles){const t=Object.keys(e.styles);for(const i of t)o.setStyle(i,e.styles[i],n)}if(e.classes){const t=e.classes;if("string"==typeof t)o.addClass(t,n);else for(const e of t)o.addClass(e,n)}return n}(e,n,t)}function ri(e){return e.model.values?(t,i,n)=>{const o=e.view[t];return o?o(t,i,n):null}:e.view}function ai(e){return"string"==typeof e?t=>({key:e,value:t}):"object"==typeof e?e.value?()=>e:t=>({key:e.key,value:t}):e}function li(e,t,i){const n="function"==typeof e?e(t,i):e;return n?(n.priority||(n.priority=10),n.id||(n.id=t.markerName),n):null}function ci(e){const t=function(e){return(t,i)=>{if(!t.is("element",e.name))return!1;if("attribute"==i.type){if(e.attributes.includes(i.attributeKey))return!0}else if(e.children)return!0;return!1}}(e);return(e,i)=>{const n=[];i.reconvertedElements||(i.reconvertedElements=new Set);for(const e of i.changes){const o="attribute"==e.type?e.range.start.nodeAfter:e.position.parent;if(o&&t(o,e)){if(!i.reconvertedElements.has(o)){i.reconvertedElements.add(o);const e=At._createBefore(o);let t=n.length;for(let i=n.length-1;i>=0;i--){const o=n[i],s=("attribute"==o.type?o.range.start:o.position).compareWith(e);if("before"==s||"remove"==o.type&&"same"==s)break;t=i}n.splice(t,0,{type:"remove",name:o.name,position:e,length:1},{type:"reinsert",name:o.name,position:e,length:1})}}else n.push(e)}i.changes=n}}function di(e){return(t,i,n={})=>{const o=["insert"];for(const i of e.attributes)t.hasAttribute(i)&&o.push(`attribute:${i}`);return!!o.every((e=>i.test(t,e)))&&(n.preflight||o.forEach((e=>i.consume(t,e))),!0)}}function ui(e,t,i,n){for(const o of t)hi(e.root,o,i,n)||i.convertItem(o)}function hi(e,t,i,n){const{writer:o,mapper:s}=i;if(!n.reconversion)return!1;const r=s.toViewElement(t);return!(!r||r.root==e||!i.canReuseView(r)||(o.move(o.createRangeOn(r),s.toViewPosition(At._createBefore(t))),0))}function mi(e,t,{preflight:i}={}){return i?t.test(e,"insert"):t.consume(e,"insert")}function gi(e){const{schema:t,document:i}=e.model;for(const n of i.getRoots())if(n.isEmpty&&!t.checkChild(n,"$text")&&t.checkChild(n,"paragraph"))return e.insertElement("paragraph",n),!0;return!1}function fi(e,t,i){const n=i.createContext(e);return!!i.checkChild(n,"paragraph")&&!!i.checkChild(n.push("paragraph"),t)}function pi(e,t){const i=t.createElement("paragraph");return t.insert(i,e),t.createPositionAt(i,0)}class bi extends Qt{elementToElement(e){return this.add(wi(e))}elementToAttribute(e){return this.add(function(e){yi(e=(0,gt.A)(e));const t=ki(e,!1),i=vi(e.view),n=i?`element:${i}`:"element";return i=>{i.on(n,t,{priority:e.converterPriority||"low"})}}(e))}attributeToAttribute(e){return this.add(function(e){let t=null;("string"==typeof(e=(0,gt.A)(e)).view||e.view.key)&&(t=function(e){"string"==typeof e.view&&(e.view={key:e.view});const t=e.view.key,i=void 0===e.view.value?/[\s\S]*/:e.view.value;let n;return n="class"==t||"style"==t?{["class"==t?"classes":"styles"]:i}:{attributes:{[t]:i}},e.view.name&&(n.name=e.view.name),e.view=n,t}(e)),yi(e,t);const i=ki(e,!0);return t=>{t.on("element",i,{priority:e.converterPriority||"low"})}}(e))}elementToMarker(e){return this.add(function(e){const t=function(e){return(t,i)=>{const n="string"==typeof e?e:e(t,i);return i.writer.createElement("$marker",{"data-name":n})}}(e.model);return wi({...e,model:t})}(e))}dataToMarker(e){return this.add(function(e){(e=(0,gt.A)(e)).model||(e.model=t=>t?e.view+":"+t:e.view);const t={view:e.view,model:e.model},i=_i(Ci(t,"start")),o=_i(Ci(t,"end"));return s=>{s.on(`element:${e.view}-start`,i,{priority:e.converterPriority||"normal"}),s.on(`element:${e.view}-end`,o,{priority:e.converterPriority||"normal"});const r=n.priorities.low,a=n.priorities.highest,l=n.priorities.get(e.converterPriority)/a;s.on("element",function(e){return(t,i,n)=>{const o=`data-${e.view}`;function s(t,o){for(const s of o){const o=e.model(s,n),r=n.writer.createElement("$marker",{"data-name":o});n.writer.insert(r,t),i.modelCursor.isEqual(t)?i.modelCursor=i.modelCursor.getShiftedBy(1):i.modelCursor=i.modelCursor._getTransformedByInsertion(t,1),i.modelRange=i.modelRange._getTransformedByInsertion(t,1)[0]}}(n.consumable.test(i.viewItem,{attributes:o+"-end-after"})||n.consumable.test(i.viewItem,{attributes:o+"-start-after"})||n.consumable.test(i.viewItem,{attributes:o+"-end-before"})||n.consumable.test(i.viewItem,{attributes:o+"-start-before"}))&&(i.modelRange||Object.assign(i,n.convertChildren(i.viewItem,i.modelCursor)),n.consumable.consume(i.viewItem,{attributes:o+"-end-after"})&&s(i.modelRange.end,i.viewItem.getAttribute(o+"-end-after").split(",")),n.consumable.consume(i.viewItem,{attributes:o+"-start-after"})&&s(i.modelRange.end,i.viewItem.getAttribute(o+"-start-after").split(",")),n.consumable.consume(i.viewItem,{attributes:o+"-end-before"})&&s(i.modelRange.start,i.viewItem.getAttribute(o+"-end-before").split(",")),n.consumable.consume(i.viewItem,{attributes:o+"-start-before"})&&s(i.modelRange.start,i.viewItem.getAttribute(o+"-start-before").split(",")))}}(t),{priority:r+l})}}(e))}}function wi(e){const t=_i(e=(0,gt.A)(e)),i=vi(e.view),n=i?`element:${i}`:"element";return i=>{i.on(n,t,{priority:e.converterPriority||"normal"})}}function vi(e){return"string"==typeof e?e:"object"==typeof e&&"string"==typeof e.name?e.name:null}function _i(e){const t=new y(e.view);return(i,n,o)=>{const s=t.match(n.viewItem);if(!s)return;const r=s.match;if(r.name=!0,!o.consumable.test(n.viewItem,r))return;const a=function(e,t,i){return e instanceof Function?e(t,i):i.writer.createElement(e)}(e.model,n.viewItem,o);a&&o.safeInsert(a,n.modelCursor)&&(o.consumable.consume(n.viewItem,r),o.convertChildren(n.viewItem,a),o.updateConversionResult(a,n))}}function yi(e,t=null){const i=null===t||(e=>e.getAttribute(t)),n="object"!=typeof e.model?e.model:e.model.key,o="object"!=typeof e.model||void 0===e.model.value?i:e.model.value;e.model={key:n,value:o}}function ki(e,t){const i=new y(e.view);return(n,o,s)=>{if(!o.modelRange&&t)return;const r=i.match(o.viewItem);if(!r)return;if(function(e,t){const i="function"==typeof e?e(t):e;return!("object"==typeof i&&!vi(i))&&(!i.classes&&!i.attributes&&!i.styles)}(e.view,o.viewItem)?r.match.name=!0:delete r.match.name,!s.consumable.test(o.viewItem,r.match))return;const a=e.model.key,l="function"==typeof e.model.value?e.model.value(o.viewItem,s):e.model.value;if(null===l)return;o.modelRange||Object.assign(o,s.convertChildren(o.viewItem,o.modelCursor));const c=function(e,t,i,n){let o=!1;for(const s of Array.from(e.getItems({shallow:i})))n.schema.checkAttribute(s,t.key)&&(o=!0,s.hasAttribute(t.key)||n.writer.setAttribute(t.key,t.value,s));return o}(o.modelRange,{key:a,value:l},t,s);c&&(s.consumable.test(o.viewItem,{name:!0})&&(r.match.name=!0),s.consumable.consume(o.viewItem,r.match))}}function Ci(e,t){return{view:`${e.view}-${t}`,model:(t,i)=>{const n=t.getAttribute("name"),o=e.model(n,i);return i.writer.createElement("$marker",{"data-name":o})}}}function Ai(e,t){return e.isCollapsed?function(e,t){const i=e.start,n=t.getNearestSelectionRange(i);if(!n){const e=i.getAncestors().reverse().find((e=>t.isObject(e)));return e?St._createOn(e):null}if(!n.isCollapsed)return n;const o=n.start;return i.isEqual(o)?null:new St(o)}(e,t):function(e,t){const{start:i,end:n}=e,o=t.checkChild(i,"$text"),s=t.checkChild(n,"$text"),r=t.getLimitElement(i),a=t.getLimitElement(n);if(r===a){if(o&&s)return null;if(function(e,t,i){const n=e.nodeAfter&&!i.isLimit(e.nodeAfter)||i.checkChild(e,"$text"),o=t.nodeBefore&&!i.isLimit(t.nodeBefore)||i.checkChild(t,"$text");return n||o}(i,n,t)){const e=i.nodeAfter&&t.isSelectable(i.nodeAfter)?null:t.getNearestSelectionRange(i,"forward"),o=n.nodeBefore&&t.isSelectable(n.nodeBefore)?null:t.getNearestSelectionRange(n,"backward"),s=e?e.start:i,r=o?o.end:n;return new St(s,r)}}const l=r&&!r.is("rootElement"),c=a&&!a.is("rootElement");if(l||c){const e=i.nodeAfter&&n.nodeBefore&&i.nodeAfter.parent===n.nodeBefore.parent,o=l&&(!e||!xi(i.nodeAfter,t)),s=c&&(!e||!xi(n.nodeBefore,t));let d=i,u=n;return o&&(d=At._createBefore(Ei(r,t))),s&&(u=At._createAfter(Ei(a,t))),new St(d,u)}return null}(e,t)}function Ei(e,t){let i=e,n=i;for(;t.isLimit(n)&&n.parent;)i=n,n=n.parent;return i}function xi(e,t){return e&&t.isSelectable(e)}class Ti extends((0,n.ObservableMixin)()){constructor(e,t){super(),this.model=e,this.view=new ft(t),this.mapper=new Vt,this.downcastDispatcher=new Mt({mapper:this.mapper,schema:e.schema});const i=this.model.document,o=i.selection,s=this.model.markers;var r,a,l;this.listenTo(this.model,"_beforeChanges",(()=>{this.view._disableRendering(!0)}),{priority:"highest"}),this.listenTo(this.model,"_afterChanges",(()=>{this.view._disableRendering(!1)}),{priority:"lowest"}),this.listenTo(i,"change",(()=>{this.view.change((e=>{this.downcastDispatcher.convertChanges(i.differ,s,e),this.downcastDispatcher.convertSelection(o,s,e)}))}),{priority:"low"}),this.listenTo(this.view.document,"selectionChange",function(e,t){return(i,n)=>{const o=n.newSelection,s=[];for(const e of o.getRanges())s.push(t.toModelRange(e));const r=e.createSelection(s,{backward:o.isBackward});r.isEqual(e.document.selection)||e.change((e=>{e.setSelection(r)}))}}(this.model,this.mapper)),this.listenTo(this.view.document,"beforeinput",(r=this.mapper,a=this.model.schema,l=this.view,(e,t)=>{if(!l.document.isComposing||n.env.isAndroid)for(let e=0;e<t.targetRanges.length;e++){const i=t.targetRanges[e],n=r.toModelRange(i),o=Ai(n,a);o&&!o.isEqual(n)&&(t.targetRanges[e]=r.toViewRange(o))}}),{priority:"high"}),this.downcastDispatcher.on("insert:$text",((e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const n=i.writer,o=i.mapper.toViewPosition(t.range.start),s=n.createText(t.item.data);n.insert(o,s)}),{priority:"lowest"}),this.downcastDispatcher.on("insert",((e,t,i)=>{i.convertAttributes(t.item),t.reconversion||!t.item.is("element")||t.item.isEmpty||i.convertChildren(t.item)}),{priority:"lowest"}),this.downcastDispatcher.on("remove",((e,t,i)=>{const n=i.mapper.toViewPosition(t.position),o=t.position.getShiftedBy(t.length),s=i.mapper.toViewPosition(o,{isPhantom:!0}),r=i.writer.createRange(n,s),a=i.writer.remove(r.getTrimmed());for(const e of i.writer.createRangeIn(a).getItems())i.mapper.unbindViewElement(e,{defer:!0})}),{priority:"low"}),this.downcastDispatcher.on("cleanSelection",((e,t,i)=>{const n=i.writer,o=n.document.selection;for(const e of o.getRanges())e.isCollapsed&&e.end.parent.isAttached()&&i.writer.mergeAttributes(e.start);n.setSelection(null)})),this.downcastDispatcher.on("selection",((e,t,i)=>{const n=t.selection;if(n.isCollapsed)return;if(!i.consumable.consume(n,"selection"))return;const o=[];for(const e of n.getRanges())o.push(i.mapper.toViewRange(e));i.writer.setSelection(o,{backward:n.isBackward})}),{priority:"low"}),this.downcastDispatcher.on("selection",((e,t,i)=>{const n=t.selection;if(!n.isCollapsed)return;if(!i.consumable.consume(n,"selection"))return;const o=i.writer,s=n.getFirstPosition(),r=i.mapper.toViewPosition(s),a=o.breakAttributes(r);o.setSelection(a)}),{priority:"low"}),this.view.document.roots.bindTo(this.model.document.roots).using((e=>{if("$graveyard"==e.rootName)return null;const t=new j(this.view.document,e.name);return t.rootName=e.rootName,this.mapper.bindElements(e,t),t}))}destroy(){this.view.destroy(),this.stopListening()}reconvertMarker(e){const t="string"==typeof e?e:e.name,i=this.model.markers.get(t);if(!i)throw new n.CKEditorError("editingcontroller-reconvertmarker-marker-not-exist",this,{markerName:t});this.model.change((()=>{this.model.markers._refresh(i)}))}reconvertItem(e){this.model.change((()=>{this.model.document.differ._refreshItem(e)}))}}class Pi{constructor(){this._consumables=new Map}add(e,t){let i;e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):(this._consumables.has(e)?i=this._consumables.get(e):(i=new Si(e),this._consumables.set(e,i)),i.add(t))}test(e,t){const i=this._consumables.get(e);return void 0===i?null:e.is("$text")||e.is("documentFragment")?i:i.test(t)}consume(e,t){return!!this.test(e,t)&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!1):this._consumables.get(e).consume(t),!0)}revert(e,t){const i=this._consumables.get(e);void 0!==i&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):i.revert(t))}static consumablesFromElement(e){const t={element:e,name:!0,attributes:[],classes:[],styles:[]},i=e.getAttributeKeys();for(const e of i)"style"!=e&&"class"!=e&&t.attributes.push(e);const n=e.getClassNames();for(const e of n)t.classes.push(e);const o=e.getStyleNames();for(const e of o)t.styles.push(e);return t}static createFrom(e,t){if(t||(t=new Pi),e.is("$text"))return t.add(e),t;e.is("element")&&t.add(e,Pi.consumablesFromElement(e)),e.is("documentFragment")&&t.add(e);for(const i of e.getChildren())t=Pi.createFrom(i,t);return t}}const Ii=["attributes","classes","styles"];class Si{constructor(e){this.element=e,this._canConsumeName=null,this._consumables={attributes:new Map,styles:new Map,classes:new Map}}add(e){e.name&&(this._canConsumeName=!0);for(const t of Ii)t in e&&this._add(t,e[t])}test(e){if(e.name&&!this._canConsumeName)return this._canConsumeName;for(const t of Ii)if(t in e){const i=this._test(t,e[t]);if(!0!==i)return i}return!0}consume(e){e.name&&(this._canConsumeName=!1);for(const t of Ii)t in e&&this._consume(t,e[t])}revert(e){e.name&&(this._canConsumeName=!0);for(const t of Ii)t in e&&this._revert(t,e[t])}_add(e,t){const i=(0,n.toArray)(t),o=this._consumables[e];for(const t of i){if("attributes"===e&&("class"===t||"style"===t))throw new n.CKEditorError("viewconsumable-invalid-attribute",this);if(o.set(t,!0),"styles"===e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(t))o.set(e,!0)}}_test(e,t){const i=(0,n.toArray)(t),o=this._consumables[e];for(const t of i)if("attributes"!==e||"class"!==t&&"style"!==t){const e=o.get(t);if(void 0===e)return null;if(!e)return!1}else{const e="class"==t?"classes":"styles",i=this._test(e,[...this._consumables[e].keys()]);if(!0!==i)return i}return!0}_consume(e,t){const i=(0,n.toArray)(t),o=this._consumables[e];for(const t of i)if("attributes"!==e||"class"!==t&&"style"!==t){if(o.set(t,!1),"styles"==e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(t))o.set(e,!1)}else{const e="class"==t?"classes":"styles";this._consume(e,[...this._consumables[e].keys()])}}_revert(e,t){const i=(0,n.toArray)(t),o=this._consumables[e];for(const t of i)if("attributes"!==e||"class"!==t&&"style"!==t)!1===o.get(t)&&o.set(t,!0);else{const e="class"==t?"classes":"styles";this._revert(e,[...this._consumables[e].keys()])}}}class Vi extends((0,n.ObservableMixin)()){constructor(){super(),this._sourceDefinitions={},this._attributeProperties={},this._customChildChecks=new Map,this._customAttributeChecks=new Map,this._genericCheckSymbol=Symbol("$generic"),this.decorate("checkChild"),this.decorate("checkAttribute"),this.on("checkAttribute",((e,t)=>{t[0]=new Ri(t[0])}),{priority:"highest"}),this.on("checkChild",((e,t)=>{t[0]=new Ri(t[0]),t[1]=this.getDefinition(t[1])}),{priority:"highest"})}register(e,t){if(this._sourceDefinitions[e])throw new n.CKEditorError("schema-cannot-register-item-twice",this,{itemName:e});this._sourceDefinitions[e]=[Object.assign({},t)],this._clearCache()}extend(e,t){if(!this._sourceDefinitions[e])throw new n.CKEditorError("schema-cannot-extend-missing-item",this,{itemName:e});this._sourceDefinitions[e].push(Object.assign({},t)),this._clearCache()}getDefinitions(){return this._compiledDefinitions||this._compile(),this._compiledDefinitions}getDefinition(e){let t;return t="string"==typeof e?e:"is"in e&&(e.is("$text")||e.is("$textProxy"))?"$text":e.name,this.getDefinitions()[t]}isRegistered(e){return!!this.getDefinition(e)}isBlock(e){const t=this.getDefinition(e);return!(!t||!t.isBlock)}isLimit(e){const t=this.getDefinition(e);return!(!t||!t.isLimit&&!t.isObject)}isObject(e){const t=this.getDefinition(e);return!!t&&!!(t.isObject||t.isLimit&&t.isSelectable&&t.isContent)}isInline(e){const t=this.getDefinition(e);return!(!t||!t.isInline)}isSelectable(e){const t=this.getDefinition(e);return!(!t||!t.isSelectable&&!t.isObject)}isContent(e){const t=this.getDefinition(e);return!(!t||!t.isContent&&!t.isObject)}checkChild(e,t){return!!t&&this._checkContextMatch(e,t)}checkAttribute(e,t){const i=this.getDefinition(e.last);if(!i)return!1;const n=this._evaluateAttributeChecks(e,t);return void 0!==n?n:i.allowAttributes.includes(t)}checkMerge(e,t){if(e instanceof At){const t=e.nodeBefore,i=e.nodeAfter;if(!(t instanceof yt))throw new n.CKEditorError("schema-check-merge-no-element-before",this);if(!(i instanceof yt))throw new n.CKEditorError("schema-check-merge-no-element-after",this);return this.checkMerge(t,i)}if(this.isLimit(e)||this.isLimit(t))return!1;for(const i of t.getChildren())if(!this.checkChild(e,i))return!1;return!0}addChildCheck(e,t){const i=void 0!==t?t:this._genericCheckSymbol,n=this._customChildChecks.get(i)||[];n.push(e),this._customChildChecks.set(i,n)}addAttributeCheck(e,t){const i=void 0!==t?t:this._genericCheckSymbol,n=this._customAttributeChecks.get(i)||[];n.push(e),this._customAttributeChecks.set(i,n)}setAttributeProperties(e,t){this._attributeProperties[e]=Object.assign(this.getAttributeProperties(e),t)}getAttributeProperties(e){return this._attributeProperties[e]||{}}getLimitElement(e){let t;for(t=e instanceof At?e.parent:(e instanceof St?[e]:Array.from(e.getRanges())).reduce(((e,t)=>{const i=t.getCommonAncestor();return e?e.getCommonAncestor(i,{includeSelf:!0}):i}),null);!this.isLimit(t)&&t.parent;)t=t.parent;return t}checkAttributeInSelection(e,t){if(e.isCollapsed){const i=[...e.getFirstPosition().getAncestors(),new vt("",e.getAttributes())];return this.checkAttribute(i,t)}{const i=e.getRanges();for(const e of i)for(const i of e)if(this.checkAttribute(i.item,t))return!0}return!1}*getValidRanges(e,t){e=function*(e){for(const t of e)yield*t.getMinimalFlatRanges()}(e);for(const i of e)yield*this._getValidRangesForRange(i,t)}getNearestSelectionRange(e,t="both"){if("$graveyard"==e.root.rootName)return null;if(this.checkChild(e,"$text"))return new St(e);let i,n;const o=e.getAncestors().reverse().find((e=>this.isLimit(e)))||e.root;"both"!=t&&"backward"!=t||(i=new kt({boundaries:St._createIn(o),startPosition:e,direction:"backward"})),"both"!=t&&"forward"!=t||(n=new kt({boundaries:St._createIn(o),startPosition:e}));for(const e of function*(e,t){let i=!1;for(;!i;){if(i=!0,e){const t=e.next();t.done||(i=!1,yield{walker:e,value:t.value})}if(t){const e=t.next();e.done||(i=!1,yield{walker:t,value:e.value})}}}(i,n)){const t=e.walker==i?"elementEnd":"elementStart",n=e.value;if(n.type==t&&this.isObject(n.item))return St._createOn(n.item);if(this.checkChild(n.nextPosition,"$text"))return new St(n.nextPosition)}return null}findAllowedParent(e,t){let i=e.parent;for(;i;){if(this.checkChild(i,t))return i;if(this.isLimit(i))return null;i=i.parent}return null}setAllowedAttributes(e,t,i){const n=i.model;for(const[o,s]of Object.entries(t))n.schema.checkAttribute(e,o)&&i.setAttribute(o,s,e)}removeDisallowedAttributes(e,t){for(const i of e)if(i.is("$text"))ji(this,i,t);else{const e=St._createIn(i).getPositions();for(const i of e)ji(this,i.nodeBefore||i.parent,t)}}getAttributesWithProperty(e,t,i){const n={};for(const[o,s]of e.getAttributes()){const e=this.getAttributeProperties(o);void 0!==e[t]&&(void 0!==i&&i!==e[t]||(n[o]=s))}return n}createContext(e){return new Ri(e)}_clearCache(){this._compiledDefinitions=null}_compile(){const e={},t=this._sourceDefinitions,i=Object.keys(t);for(const n of i)e[n]=Bi(t[n],n);const n=Object.values(e);for(const t of n)Mi(e,t),Oi(e,t),Li(e,t),Fi(e,t);for(const e of n)Ni(0,e);for(const t of n)Di(e,t);for(const t of n)zi(e,t);for(const t of n)Wi(e,t);for(const t of n)Hi(e,t);this._compiledDefinitions=function(e){const t={};for(const i of Object.values(e))t[i.name]={name:i.name,isBlock:!!i.isBlock,isContent:!!i.isContent,isInline:!!i.isInline,isLimit:!!i.isLimit,isObject:!!i.isObject,isSelectable:!!i.isSelectable,allowIn:Array.from(i.allowIn).filter((t=>!!e[t])),allowChildren:Array.from(i.allowChildren).filter((t=>!!e[t])),allowAttributes:Array.from(i.allowAttributes)};return t}(e)}_checkContextMatch(e,t){const i=e.last;let n=this._evaluateChildChecks(e,t);if(n=void 0!==n?n:t.allowIn.includes(i.name),!n)return!1;const o=this.getDefinition(i),s=e.trimLast();return!!o&&(0==s.length||this._checkContextMatch(s,o))}_evaluateChildChecks(e,t){const i=this._customChildChecks.get(this._genericCheckSymbol)||[],n=this._customChildChecks.get(t.name)||[];for(const o of[...i,...n]){const i=o(e,t);if(void 0!==i)return i}}_evaluateAttributeChecks(e,t){const i=this._customAttributeChecks.get(this._genericCheckSymbol)||[],n=this._customAttributeChecks.get(t)||[];for(const o of[...i,...n]){const i=o(e,t);if(void 0!==i)return i}}*_getValidRangesForRange(e,t){let i=e.start,n=e.start;for(const o of e.getItems({shallow:!0}))o.is("element")&&(yield*this._getValidRangesForRange(St._createIn(o),t)),this.checkAttribute(o,t)||(i.isEqual(n)||(yield new St(i,n)),i=At._createAfter(o)),n=At._createAfter(o);i.isEqual(n)||(yield new St(i,n))}findOptimalInsertionRange(e,t){const i=e.getSelectedElement();if(i&&this.isObject(i)&&!this.isInline(i))return"before"==t||"after"==t?new St(At._createAt(i,t)):St._createOn(i);const o=(0,n.first)(e.getSelectedBlocks());if(!o)return new St(e.focus);if(o.isEmpty)return new St(At._createAt(o,0));const s=At._createAfter(o);return e.focus.isTouching(s)?new St(s):new St(At._createBefore(o))}}class Ri{constructor(e){if(e instanceof Ri)return e;let t;t="string"==typeof e?[e]:Array.isArray(e)?e:e.getAncestors({includeSelf:!0}),this._items=t.map($i)}get length(){return this._items.length}get last(){return this._items[this._items.length-1]}[Symbol.iterator](){return this._items[Symbol.iterator]()}push(e){const t=new Ri([e]);return t._items=[...this._items,...t._items],t}trimLast(){const e=new Ri([]);return e._items=this._items.slice(0,-1),e}getItem(e){return this._items[e]}*getNames(){yield*this._items.map((e=>e.name))}endsWith(e){return Array.from(this.getNames()).join(" ").endsWith(e)}startsWith(e){return Array.from(this.getNames()).join(" ").startsWith(e)}}function Bi(e,t){const i={name:t,allowIn:new Set,allowChildren:new Set,disallowIn:new Set,disallowChildren:new Set,allowContentOf:new Set,allowWhere:new Set,allowAttributes:new Set,disallowAttributes:new Set,allowAttributesOf:new Set,inheritTypesFrom:new Set};return function(e,t){for(const i of e){const e=Object.keys(i).filter((e=>e.startsWith("is")));for(const n of e)t[n]=!!i[n]}}(e,i),Ui(e,i,"allowIn"),Ui(e,i,"allowChildren"),Ui(e,i,"disallowIn"),Ui(e,i,"disallowChildren"),Ui(e,i,"allowContentOf"),Ui(e,i,"allowWhere"),Ui(e,i,"allowAttributes"),Ui(e,i,"disallowAttributes"),Ui(e,i,"allowAttributesOf"),Ui(e,i,"inheritTypesFrom"),function(e,t){for(const i of e){const e=i.inheritAllFrom;e&&(t.allowContentOf.add(e),t.allowWhere.add(e),t.allowAttributesOf.add(e),t.inheritTypesFrom.add(e))}}(e,i),i}function Mi(e,t){for(const i of t.allowIn){const n=e[i];n?n.allowChildren.add(t.name):t.allowIn.delete(i)}}function Oi(e,t){for(const i of t.allowChildren){const n=e[i];n?n.allowIn.add(t.name):t.allowChildren.delete(i)}}function Li(e,t){for(const i of t.disallowIn){const n=e[i];n?n.disallowChildren.add(t.name):t.disallowIn.delete(i)}}function Fi(e,t){for(const i of t.disallowChildren){const n=e[i];n?n.disallowIn.add(t.name):t.disallowChildren.delete(i)}}function Ni(e,t){for(const e of t.disallowChildren)t.allowChildren.delete(e);for(const e of t.disallowIn)t.allowIn.delete(e);for(const e of t.disallowAttributes)t.allowAttributes.delete(e)}function Di(e,t){for(const i of t.allowContentOf){const n=e[i];n&&(n.disallowChildren.forEach((i=>{t.allowChildren.has(i)||(t.disallowChildren.add(i),e[i].disallowIn.add(t.name))})),n.allowChildren.forEach((i=>{t.disallowChildren.has(i)||(t.allowChildren.add(i),e[i].allowIn.add(t.name))})))}}function zi(e,t){for(const i of t.allowWhere){const n=e[i];n&&(n.disallowIn.forEach((i=>{t.allowIn.has(i)||(t.disallowIn.add(i),e[i].disallowChildren.add(t.name))})),n.allowIn.forEach((i=>{t.disallowIn.has(i)||(t.allowIn.add(i),e[i].allowChildren.add(t.name))})))}}function Wi(e,t){for(const i of t.allowAttributesOf){const n=e[i];if(!n)return;n.allowAttributes.forEach((e=>{t.disallowAttributes.has(e)||t.allowAttributes.add(e)}))}}function Hi(e,t){for(const i of t.inheritTypesFrom){const n=e[i];if(n){const e=Object.keys(n).filter((e=>e.startsWith("is")));for(const i of e)i in t||(t[i]=n[i])}}}function Ui(e,t,i){for(const n of e){let e=n[i];"string"==typeof e&&(e=[e]),Array.isArray(e)&&e.forEach((e=>t[i].add(e)))}}function $i(e){return"string"==typeof e||e.is("documentFragment")?{name:"string"==typeof e?e:"$documentFragment",*getAttributeKeys(){},getAttribute(){}}:{name:e.is("element")?e.name:"$text",*getAttributeKeys(){yield*e.getAttributeKeys()},getAttribute:t=>e.getAttribute(t)}}function ji(e,t,i){for(const n of t.getAttributeKeys())e.checkAttribute(t,n)||i.removeAttribute(n,t)}class qi extends((0,n.EmitterMixin)()){constructor(e){super(),this._splitParts=new Map,this._cursorParents=new Map,this._modelCursor=null,this._emptyElementsToKeep=new Set,this.conversionApi={...e,consumable:null,writer:null,store:null,convertItem:(e,t)=>this._convertItem(e,t),convertChildren:(e,t)=>this._convertChildren(e,t),safeInsert:(e,t)=>this._safeInsert(e,t),updateConversionResult:(e,t)=>this._updateConversionResult(e,t),splitToAllowedParent:(e,t)=>this._splitToAllowedParent(e,t),getSplitParts:e=>this._getSplitParts(e),keepEmptyElement:e=>this._keepEmptyElement(e)}}convert(e,t,i=["$root"]){this.fire("viewCleanup",e),this._modelCursor=function(e,t){let i;for(const n of new Ri(e)){const e={};for(const t of n.getAttributeKeys())e[t]=n.getAttribute(t);const o=t.createElement(n.name,e);i&&t.insert(o,i),i=At._createAt(o,0)}return i}(i,t),this.conversionApi.writer=t,this.conversionApi.consumable=Pi.createFrom(e),this.conversionApi.store={};const{modelRange:n}=this._convertItem(e,this._modelCursor),o=t.createDocumentFragment();if(n){this._removeEmptyElements();for(const e of Array.from(this._modelCursor.parent.getChildren()))t.append(e,o);o.markers=function(e,t){const i=new Set,n=new Map,o=St._createIn(e).getItems();for(const e of o)e.is("element","$marker")&&i.add(e);for(const e of i){const i=e.getAttribute("data-name"),o=t.createPositionBefore(e);n.has(i)?n.get(i).end=o.clone():n.set(i,new St(o.clone())),t.remove(e)}return n}(o,t)}return this._modelCursor=null,this._splitParts.clear(),this._cursorParents.clear(),this._emptyElementsToKeep.clear(),this.conversionApi.writer=null,this.conversionApi.store=null,o}_convertItem(e,t){const i={viewItem:e,modelCursor:t,modelRange:null};if(e.is("element")?this.fire(`element:${e.name}`,i,this.conversionApi):e.is("$text")?this.fire("text",i,this.conversionApi):this.fire("documentFragment",i,this.conversionApi),i.modelRange&&!(i.modelRange instanceof St))throw new n.CKEditorError("view-conversion-dispatcher-incorrect-result",this);return{modelRange:i.modelRange,modelCursor:i.modelCursor}}_convertChildren(e,t){let i=t.is("position")?t:At._createAt(t,0);const n=new St(i);for(const t of Array.from(e.getChildren())){const e=this._convertItem(t,i);e.modelRange instanceof St&&(n.end=e.modelRange.end,i=e.modelCursor)}return{modelRange:n,modelCursor:i}}_safeInsert(e,t){const i=this._splitToAllowedParent(e,t);return!!i&&(this.conversionApi.writer.insert(e,i.position),!0)}_updateConversionResult(e,t){const i=this._getSplitParts(e),n=this.conversionApi.writer;t.modelRange||(t.modelRange=n.createRange(n.createPositionBefore(e),n.createPositionAfter(i[i.length-1])));const o=this._cursorParents.get(e);t.modelCursor=o?n.createPositionAt(o,0):t.modelRange.end}_splitToAllowedParent(e,t){const{schema:i,writer:n}=this.conversionApi;let o=i.findAllowedParent(t,e);if(o){if(o===t.parent)return{position:t};this._modelCursor.parent.getAncestors().includes(o)&&(o=null)}if(!o)return fi(t,e,i)?{position:pi(t,n)}:null;const s=this.conversionApi.writer.split(t,o),r=[];for(const e of s.range.getWalker())if("elementEnd"==e.type)r.push(e.item);else{const t=r.pop(),i=e.item;this._registerSplitPair(t,i)}const a=s.range.end.parent;return this._cursorParents.set(e,a),{position:s.position,cursorParent:a}}_registerSplitPair(e,t){this._splitParts.has(e)||this._splitParts.set(e,[e]);const i=this._splitParts.get(e);this._splitParts.set(t,i),i.push(t)}_getSplitParts(e){let t;return t=this._splitParts.has(e)?this._splitParts.get(e):[e],t}_keepEmptyElement(e){this._emptyElementsToKeep.add(e)}_removeEmptyElements(){let e=!1;for(const t of this._splitParts.keys())t.isEmpty&&!this._emptyElementsToKeep.has(t)&&(this.conversionApi.writer.remove(t),this._splitParts.delete(t),e=!0);e&&this._removeEmptyElements()}}class Ki{getHtml(e){const t=n.global.document.implementation.createHTMLDocument("").createElement("div");return t.appendChild(e),t.innerHTML}}class Gi{constructor(e){this.skipComments=!0,this.domParser=new DOMParser,this.domConverter=new qe(e,{renderingMode:"data"}),this.htmlWriter=new Ki}toData(e){const t=this.domConverter.viewToDom(e);return this.htmlWriter.getHtml(t)}toView(e){const t=this._toDom(e);return this.domConverter.domToView(t,{skipComments:this.skipComments})}registerRawContentMatcher(e){this.domConverter.registerRawContentMatcher(e)}useFillerType(e){this.domConverter.blockFillerMode="marked"==e?"markedNbsp":"nbsp"}_toDom(e){e.match(/<(?:html|body|head|meta)(?:\s[^>]*)?>/i)||(e=`<body>${e}</body>`);const t=this.domParser.parseFromString(e,"text/html"),i=t.createDocumentFragment(),n=t.body.childNodes;for(;n.length>0;)i.appendChild(n[0]);return i}}class Zi extends((0,n.EmitterMixin)()){constructor(e,t){super(),this.model=e,this.mapper=new Vt,this.downcastDispatcher=new Mt({mapper:this.mapper,schema:e.schema}),this.downcastDispatcher.on("insert:$text",((e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const n=i.writer,o=i.mapper.toViewPosition(t.range.start),s=n.createText(t.item.data);n.insert(o,s)}),{priority:"lowest"}),this.downcastDispatcher.on("insert",((e,t,i)=>{i.convertAttributes(t.item),t.reconversion||!t.item.is("element")||t.item.isEmpty||i.convertChildren(t.item)}),{priority:"lowest"}),this.upcastDispatcher=new qi({schema:e.schema}),this.viewDocument=new se(t),this.stylesProcessor=t,this.htmlProcessor=new Gi(this.viewDocument),this.processor=this.htmlProcessor,this._viewWriter=new be(this.viewDocument),this.upcastDispatcher.on("text",((e,t,{schema:i,consumable:n,writer:o})=>{let s=t.modelCursor;if(!n.test(t.viewItem))return;if(!i.checkChild(s,"$text")){if(!fi(s,"$text",i))return;if(0==t.viewItem.data.trim().length)return;s=pi(s,o)}n.consume(t.viewItem);const r=o.createText(t.viewItem.data);o.insert(r,s),t.modelRange=o.createRange(s,s.getShiftedBy(r.offsetSize)),t.modelCursor=t.modelRange.end}),{priority:"lowest"}),this.upcastDispatcher.on("element",((e,t,i)=>{if(!t.modelRange&&i.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:n}=i.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=n}}),{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",((e,t,i)=>{if(!t.modelRange&&i.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:n}=i.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=n}}),{priority:"lowest"}),(0,n.ObservableMixin)().prototype.decorate.call(this,"init"),(0,n.ObservableMixin)().prototype.decorate.call(this,"set"),(0,n.ObservableMixin)().prototype.decorate.call(this,"get"),(0,n.ObservableMixin)().prototype.decorate.call(this,"toView"),(0,n.ObservableMixin)().prototype.decorate.call(this,"toModel"),this.on("init",(()=>{this.fire("ready")}),{priority:"lowest"}),this.on("ready",(()=>{this.model.enqueueChange({isUndoable:!1},gi)}),{priority:"lowest"})}get(e={}){const{rootName:t="main",trim:i="empty"}=e;if(!this._checkIfRootsExists([t]))throw new n.CKEditorError("datacontroller-get-non-existent-root",this);const o=this.model.document.getRoot(t);return o.isAttached()||(0,n.logWarning)("datacontroller-get-detached-root",this),"empty"!==i||this.model.hasContent(o,{ignoreWhitespaces:!0})?this.stringify(o,e):""}stringify(e,t={}){const i=this.toView(e,t);return this.processor.toData(i)}toView(e,t={}){const i=this.viewDocument,n=this._viewWriter;this.mapper.clearBindings();const o=St._createIn(e),s=new pe(i);this.mapper.bindElements(e,s);const r=e.is("documentFragment")?e.markers:function(e){const t=[],i=e.root.document;if(!i)return new Map;const n=St._createIn(e);for(const e of i.model.markers){const i=e.getRange(),o=i.isCollapsed,s=i.start.isEqual(n.start)||i.end.isEqual(n.end);if(o&&s)t.push([e.name,i]);else{const o=n.getIntersection(i);o&&t.push([e.name,o])}}return t.sort((([e,t],[i,n])=>{if("after"!==t.end.compareWith(n.start))return 1;if("before"!==t.start.compareWith(n.end))return-1;switch(t.start.compareWith(n.start)){case"before":return 1;case"after":return-1;default:switch(t.end.compareWith(n.end)){case"before":return 1;case"after":return-1;default:return i.localeCompare(e)}}})),new Map(t)}(e);return this.downcastDispatcher.convert(o,r,n,t),s}init(e){if(this.model.document.version)throw new n.CKEditorError("datacontroller-init-document-not-empty",this);let t={};if("string"==typeof e?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new n.CKEditorError("datacontroller-init-non-existent-root",this);return this.model.enqueueChange({isUndoable:!1},(e=>{for(const i of Object.keys(t)){const n=this.model.document.getRoot(i);e.insert(this.parse(t[i],n),n,0)}})),Promise.resolve()}set(e,t={}){let i={};if("string"==typeof e?i.main=e:i=e,!this._checkIfRootsExists(Object.keys(i)))throw new n.CKEditorError("datacontroller-set-non-existent-root",this);this.model.enqueueChange(t.batchType||{},(e=>{e.setSelection(null),e.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());for(const t of Object.keys(i)){const n=this.model.document.getRoot(t);e.remove(e.createRangeIn(n)),e.insert(this.parse(i[t],n),n,0)}}))}parse(e,t="$root"){const i=this.processor.toView(e);return this.toModel(i,t)}toModel(e,t="$root"){return this.model.change((i=>this.upcastDispatcher.convert(e,i,t)))}addStyleProcessorRules(e){e(this.stylesProcessor)}registerRawContentMatcher(e){this.processor&&this.processor!==this.htmlProcessor&&this.processor.registerRawContentMatcher(e),this.htmlProcessor.registerRawContentMatcher(e)}destroy(){this.stopListening()}_checkIfRootsExists(e){for(const t of e)if(!this.model.document.getRoot(t))return!1;return!0}}class Ji{constructor(e,t){this._helpers=new Map,this._downcast=(0,n.toArray)(e),this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=(0,n.toArray)(t),this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:!1})}addAlias(e,t){const i=this._downcast.includes(t);if(!this._upcast.includes(t)&&!i)throw new n.CKEditorError("conversion-add-alias-dispatcher-not-registered",this);this._createConversionHelpers({name:e,dispatchers:[t],isDowncast:i})}for(e){if(!this._helpers.has(e))throw new n.CKEditorError("conversion-for-unknown-group",this);return this._helpers.get(e)}elementToElement(e){this.for("downcast").elementToElement(e);for(const{model:t,view:i}of Qi(e))this.for("upcast").elementToElement({model:t,view:i,converterPriority:e.converterPriority})}attributeToElement(e){this.for("downcast").attributeToElement(e);for(const{model:t,view:i}of Qi(e))this.for("upcast").elementToAttribute({view:i,model:t,converterPriority:e.converterPriority})}attributeToAttribute(e){this.for("downcast").attributeToAttribute(e);for(const{model:t,view:i}of Qi(e))this.for("upcast").attributeToAttribute({view:i,model:t})}_createConversionHelpers({name:e,dispatchers:t,isDowncast:i}){if(this._helpers.has(e))throw new n.CKEditorError("conversion-group-exists",this);const o=i?new Yt(t):new bi(t);this._helpers.set(e,o)}}function*Qi(e){if(e.model.values)for(const t of e.model.values){const i={key:e.model.key,value:t},n=e.view[t],o=e.upcastAlso?e.upcastAlso[t]:void 0;yield*Yi(i,n,o)}else yield*Yi(e.model,e.view,e.upcastAlso)}function*Yi(e,t,i){if(yield{model:e,view:t},i)for(const t of(0,n.toArray)(i))yield{model:e,view:t}}class Xi{constructor(e,t={}){this.skipComments=!0,this.namespaces=t.namespaces||[],this.domParser=new DOMParser,this.domConverter=new qe(e,{renderingMode:"data"}),this.htmlWriter=new Ki}toData(e){const t=this.domConverter.viewToDom(e);return this.htmlWriter.getHtml(t)}toView(e){const t=this._toDom(e);return this.domConverter.domToView(t,{keepOriginalCase:!0,skipComments:this.skipComments})}registerRawContentMatcher(e){this.domConverter.registerRawContentMatcher(e)}useFillerType(e){this.domConverter.blockFillerMode="marked"==e?"markedNbsp":"nbsp"}_toDom(e){e=`<xml ${this.namespaces.map((e=>`xmlns:${e}="nsp"`)).join(" ")}>${e}</xml>`;const t=this.domParser.parseFromString(e,"text/xml"),i=t.querySelector("parsererror");if(i)throw new Error("Parse error - "+i.textContent);const n=t.createDocumentFragment(),o=t.documentElement.childNodes;for(;o.length>0;)n.appendChild(o[0]);return n}}class en{constructor(e){this.baseVersion=e,this.isDocumentOperation=null!==this.baseVersion,this.batch=null}_validate(){}toJSON(){const e=Object.assign({},this);return e.__className=this.constructor.className,delete e.batch,delete e.isDocumentOperation,e}static get className(){return"Operation"}static fromJSON(e,t){return new this(e.baseVersion)}}function tn(e,t){const i=sn(t),n=i.reduce(((e,t)=>e+t.offsetSize),0),o=e.parent;an(e);const s=e.index;return o._insertChild(s,i),rn(o,s+i.length),rn(o,s),new St(e,e.getShiftedBy(n))}function nn(e){if(!e.isFlat)throw new n.CKEditorError("operation-utils-remove-range-not-flat",this);const t=e.start.parent;an(e.start),an(e.end);const i=t._removeChildren(e.start.index,e.end.index-e.start.index);return rn(t,e.start.index),i}function on(e,t){if(!e.isFlat)throw new n.CKEditorError("operation-utils-move-range-not-flat",this);const i=nn(e);return tn(t=t._getTransformedByDeletion(e.start,e.end.offset-e.start.offset),i)}function sn(e){const t=[];!function e(i){if("string"==typeof i)t.push(new vt(i));else if(i instanceof _t)t.push(new vt(i.data,i.getAttributes()));else if(i instanceof bt)t.push(i);else if((0,n.isIterable)(i))for(const t of i)e(t)}(e);for(let e=1;e<t.length;e++){const i=t[e],n=t[e-1];i instanceof vt&&n instanceof vt&&ln(i,n)&&(t.splice(e-1,2,new vt(n.data+i.data,n.getAttributes())),e--)}return t}function rn(e,t){const i=e.getChild(t-1),n=e.getChild(t);if(i&&n&&i.is("$text")&&n.is("$text")&&ln(i,n)){const o=new vt(i.data+n.data,i.getAttributes());e._removeChildren(t-1,2),e._insertChild(t-1,o)}}function an(e){const t=e.textNode,i=e.parent;if(t){const n=e.offset-t.startOffset,o=t.index;i._removeChildren(o,1);const s=new vt(t.data.substr(0,n),t.getAttributes()),r=new vt(t.data.substr(n),t.getAttributes());i._insertChild(o,[s,r])}}function ln(e,t){const i=e.getAttributes(),n=t.getAttributes();for(const e of i){if(e[1]!==t.getAttribute(e[0]))return!1;n.next()}return n.next().done}class cn extends en{constructor(e,t,i,n){super(n),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toNext",this.howMany=t,this.targetPosition=i.clone(),this.targetPosition.stickiness="toNone"}get type(){return"$graveyard"==this.targetPosition.root.rootName?"remove":"$graveyard"==this.sourcePosition.root.rootName?"reinsert":"move"}get affectedSelectable(){return[St._createFromPositionAndShift(this.sourcePosition,this.howMany),St._createFromPositionAndShift(this.targetPosition,0)]}clone(){return new cn(this.sourcePosition,this.howMany,this.targetPosition,this.baseVersion)}getMovedRangeStart(){return this.targetPosition._getTransformedByDeletion(this.sourcePosition,this.howMany)}getReversed(){const e=this.sourcePosition._getTransformedByInsertion(this.targetPosition,this.howMany);return new cn(this.getMovedRangeStart(),this.howMany,e,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent,i=this.sourcePosition.offset,o=this.targetPosition.offset;if(i+this.howMany>e.maxOffset)throw new n.CKEditorError("move-operation-nodes-do-not-exist",this);if(e===t&&i<o&&o<i+this.howMany)throw new n.CKEditorError("move-operation-range-into-itself",this);if(this.sourcePosition.root==this.targetPosition.root&&"prefix"==(0,n.compareArrays)(this.sourcePosition.getParentPath(),this.targetPosition.getParentPath())){const e=this.sourcePosition.path.length-1;if(this.targetPosition.path[e]>=i&&this.targetPosition.path[e]<i+this.howMany)throw new n.CKEditorError("move-operation-node-into-itself",this)}}_execute(){on(St._createFromPositionAndShift(this.sourcePosition,this.howMany),this.targetPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e.targetPosition=this.targetPosition.toJSON(),e}static get className(){return"MoveOperation"}static fromJSON(e,t){const i=At.fromJSON(e.sourcePosition,t),n=At.fromJSON(e.targetPosition,t);return new this(i,e.howMany,n,e.baseVersion)}}class dn extends en{constructor(e,t,i){super(i),this.position=e.clone(),this.position.stickiness="toNone",this.nodes=new wt(sn(t)),this.shouldReceiveAttributes=!1}get type(){return"insert"}get howMany(){return this.nodes.maxOffset}get affectedSelectable(){return this.position.clone()}clone(){const e=new wt([...this.nodes].map((e=>e._clone(!0)))),t=new dn(this.position,e,this.baseVersion);return t.shouldReceiveAttributes=this.shouldReceiveAttributes,t}getReversed(){const e=this.position.root.document.graveyard,t=new At(e,[0]);return new cn(this.position,this.nodes.maxOffset,t,this.baseVersion+1)}_validate(){const e=this.position.parent;if(!e||e.maxOffset<this.position.offset)throw new n.CKEditorError("insert-operation-position-invalid",this)}_execute(){const e=this.nodes;this.nodes=new wt([...e].map((e=>e._clone(!0)))),tn(this.position,e)}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e.nodes=this.nodes.toJSON(),e}static get className(){return"InsertOperation"}static fromJSON(e,t){const i=[];for(const t of e.nodes)t.name?i.push(yt.fromJSON(t)):i.push(vt.fromJSON(t));const n=new dn(At.fromJSON(e.position,t),i,e.baseVersion);return n.shouldReceiveAttributes=e.shouldReceiveAttributes,n}}class un extends en{constructor(e,t,i,n,o){super(o),this.splitPosition=e.clone(),this.splitPosition.stickiness="toNext",this.howMany=t,this.insertionPosition=i,this.graveyardPosition=n?n.clone():null,this.graveyardPosition&&(this.graveyardPosition.stickiness="toNext")}get type(){return"split"}get moveTargetPosition(){const e=this.insertionPosition.path.slice();return e.push(0),new At(this.insertionPosition.root,e)}get movedRange(){const e=this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);return new St(this.splitPosition,e)}get affectedSelectable(){const e=[St._createFromPositionAndShift(this.splitPosition,0),St._createFromPositionAndShift(this.insertionPosition,0)];return this.graveyardPosition&&e.push(St._createFromPositionAndShift(this.graveyardPosition,0)),e}clone(){return new un(this.splitPosition,this.howMany,this.insertionPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.splitPosition.root.document.graveyard,t=new At(e,[0]);return new hn(this.moveTargetPosition,this.howMany,this.splitPosition,t,this.baseVersion+1)}_validate(){const e=this.splitPosition.parent,t=this.splitPosition.offset;if(!e||e.maxOffset<t)throw new n.CKEditorError("split-operation-position-invalid",this);if(!e.parent)throw new n.CKEditorError("split-operation-split-in-root",this);if(this.howMany!=e.maxOffset-this.splitPosition.offset)throw new n.CKEditorError("split-operation-how-many-invalid",this);if(this.graveyardPosition&&!this.graveyardPosition.nodeAfter)throw new n.CKEditorError("split-operation-graveyard-position-invalid",this)}_execute(){const e=this.splitPosition.parent;if(this.graveyardPosition)on(St._createFromPositionAndShift(this.graveyardPosition,1),this.insertionPosition);else{const t=e._clone();tn(this.insertionPosition,t)}on(new St(At._createAt(e,this.splitPosition.offset),At._createAt(e,e.maxOffset)),this.moveTargetPosition)}toJSON(){const e=super.toJSON();return e.splitPosition=this.splitPosition.toJSON(),e.insertionPosition=this.insertionPosition.toJSON(),this.graveyardPosition&&(e.graveyardPosition=this.graveyardPosition.toJSON()),e}static get className(){return"SplitOperation"}static getInsertionPosition(e){const t=e.path.slice(0,-1);return t[t.length-1]++,new At(e.root,t,"toPrevious")}static fromJSON(e,t){const i=At.fromJSON(e.splitPosition,t),n=At.fromJSON(e.insertionPosition,t),o=e.graveyardPosition?At.fromJSON(e.graveyardPosition,t):null;return new this(i,e.howMany,n,o,e.baseVersion)}}class hn extends en{constructor(e,t,i,n,o){super(o),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toPrevious",this.howMany=t,this.targetPosition=i.clone(),this.targetPosition.stickiness="toNext",this.graveyardPosition=n.clone()}get type(){return"merge"}get deletionPosition(){return new At(this.sourcePosition.root,this.sourcePosition.path.slice(0,-1))}get movedRange(){const e=this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);return new St(this.sourcePosition,e)}get affectedSelectable(){const e=this.sourcePosition.parent;return[St._createOn(e),St._createFromPositionAndShift(this.targetPosition,0),St._createFromPositionAndShift(this.graveyardPosition,0)]}clone(){return new hn(this.sourcePosition,this.howMany,this.targetPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.targetPosition._getTransformedByMergeOperation(this),t=this.sourcePosition.path.slice(0,-1),i=new At(this.sourcePosition.root,t)._getTransformedByMergeOperation(this);return new un(e,this.howMany,i,this.graveyardPosition,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent;if(!e.parent)throw new n.CKEditorError("merge-operation-source-position-invalid",this);if(!t.parent)throw new n.CKEditorError("merge-operation-target-position-invalid",this);if(this.howMany!=e.maxOffset)throw new n.CKEditorError("merge-operation-how-many-invalid",this)}_execute(){const e=this.sourcePosition.parent;on(St._createIn(e),this.targetPosition),on(St._createOn(e),this.graveyardPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=e.sourcePosition.toJSON(),e.targetPosition=e.targetPosition.toJSON(),e.graveyardPosition=e.graveyardPosition.toJSON(),e}static get className(){return"MergeOperation"}static fromJSON(e,t){const i=At.fromJSON(e.sourcePosition,t),n=At.fromJSON(e.targetPosition,t),o=At.fromJSON(e.graveyardPosition,t);return new this(i,e.howMany,n,o,e.baseVersion)}}class mn extends en{constructor(e,t,i,n,o,s){super(s),this.name=e,this.oldRange=t?t.clone():null,this.newRange=i?i.clone():null,this.affectsData=o,this._markers=n}get type(){return"marker"}get affectedSelectable(){const e=[];return this.oldRange&&e.push(this.oldRange.clone()),this.newRange&&(this.oldRange?e.push(...this.newRange.getDifference(this.oldRange)):e.push(this.newRange.clone())),e}clone(){return new mn(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new mn(this.name,this.newRange,this.oldRange,this._markers,this.affectsData,this.baseVersion+1)}_execute(){this.newRange?this._markers._set(this.name,this.newRange,!0,this.affectsData):this._markers._remove(this.name)}toJSON(){const e=super.toJSON();return this.oldRange&&(e.oldRange=this.oldRange.toJSON()),this.newRange&&(e.newRange=this.newRange.toJSON()),delete e._markers,e}static get className(){return"MarkerOperation"}static fromJSON(e,t){return new mn(e.name,e.oldRange?St.fromJSON(e.oldRange,t):null,e.newRange?St.fromJSON(e.newRange,t):null,t.model.markers,e.affectsData,e.baseVersion)}}var gn=i(6996);class fn extends en{constructor(e,t,i,n,o){super(o),this.range=e.clone(),this.key=t,this.oldValue=void 0===i?null:i,this.newValue=void 0===n?null:n}get type(){return null===this.oldValue?"addAttribute":null===this.newValue?"removeAttribute":"changeAttribute"}get affectedSelectable(){return this.range.clone()}clone(){return new fn(this.range,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new fn(this.range,this.key,this.newValue,this.oldValue,this.baseVersion+1)}toJSON(){const e=super.toJSON();return e.range=this.range.toJSON(),e}_validate(){if(!this.range.isFlat)throw new n.CKEditorError("attribute-operation-range-not-flat",this);for(const e of this.range.getItems({shallow:!0})){if(null!==this.oldValue&&!(0,gn.A)(e.getAttribute(this.key),this.oldValue))throw new n.CKEditorError("attribute-operation-wrong-old-value",this,{item:e,key:this.key,value:this.oldValue});if(null===this.oldValue&&null!==this.newValue&&e.hasAttribute(this.key))throw new n.CKEditorError("attribute-operation-attribute-exists",this,{node:e,key:this.key})}}_execute(){(0,gn.A)(this.oldValue,this.newValue)||function(e,t,i){an(e.start),an(e.end);for(const n of e.getItems({shallow:!0})){const e=n.is("$textProxy")?n.textNode:n;null!==i?e._setAttribute(t,i):e._removeAttribute(t),rn(e.parent,e.index)}rn(e.end.parent,e.end.index)}(this.range,this.key,this.newValue)}static get className(){return"AttributeOperation"}static fromJSON(e,t){return new fn(St.fromJSON(e.range,t),e.key,e.oldValue,e.newValue,e.baseVersion)}}class pn extends en{get type(){return"noop"}get affectedSelectable(){return null}clone(){return new pn(this.baseVersion)}getReversed(){return new pn(this.baseVersion+1)}_execute(){}static get className(){return"NoOperation"}}class bn extends en{constructor(e,t,i,n){super(n),this.position=e,this.position.stickiness="toNext",this.oldName=t,this.newName=i}get type(){return"rename"}get affectedSelectable(){return this.position.nodeAfter}clone(){return new bn(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new bn(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){const e=this.position.nodeAfter;if(!(e instanceof yt))throw new n.CKEditorError("rename-operation-wrong-position",this);if(e.name!==this.oldName)throw new n.CKEditorError("rename-operation-wrong-name",this)}_execute(){this.position.nodeAfter.name=this.newName}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e}static get className(){return"RenameOperation"}static fromJSON(e,t){return new bn(At.fromJSON(e.position,t),e.oldName,e.newName,e.baseVersion)}}class wn extends en{constructor(e,t,i,n,o){super(o),this.root=e,this.key=t,this.oldValue=void 0===i?null:i,this.newValue=void 0===n?null:n}get type(){return null===this.oldValue?"addRootAttribute":null===this.newValue?"removeRootAttribute":"changeRootAttribute"}get affectedSelectable(){return this.root}clone(){return new wn(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new wn(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is("documentFragment"))throw new n.CKEditorError("rootattribute-operation-not-a-root",this,{root:this.root,key:this.key});if(null!==this.oldValue&&this.root.getAttribute(this.key)!==this.oldValue)throw new n.CKEditorError("rootattribute-operation-wrong-old-value",this,{root:this.root,key:this.key});if(null===this.oldValue&&null!==this.newValue&&this.root.hasAttribute(this.key))throw new n.CKEditorError("rootattribute-operation-attribute-exists",this,{root:this.root,key:this.key})}_execute(){null!==this.newValue?this.root._setAttribute(this.key,this.newValue):this.root._removeAttribute(this.key)}toJSON(){const e=super.toJSON();return e.root=this.root.toJSON(),e}static get className(){return"RootAttributeOperation"}static fromJSON(e,t){if(!t.getRoot(e.root))throw new n.CKEditorError("rootattribute-operation-fromjson-no-root",this,{rootName:e.root});return new wn(t.getRoot(e.root),e.key,e.oldValue,e.newValue,e.baseVersion)}}class vn extends en{constructor(e,t,i,n,o){super(o),this.rootName=e,this.elementName=t,this.isAdd=i,this._document=n,this._document.getRoot(this.rootName)||(this._document.createRoot(this.elementName,this.rootName)._isAttached=!1)}get type(){return this.isAdd?"addRoot":"detachRoot"}get affectedSelectable(){return this._document.getRoot(this.rootName)}clone(){return new vn(this.rootName,this.elementName,this.isAdd,this._document,this.baseVersion)}getReversed(){return new vn(this.rootName,this.elementName,!this.isAdd,this._document,this.baseVersion+1)}_execute(){this._document.getRoot(this.rootName)._isAttached=this.isAdd}toJSON(){const e=super.toJSON();return delete e._document,e}static get className(){return"RootOperation"}static fromJSON(e,t){return new vn(e.rootName,e.elementName,e.isAdd,t,e.baseVersion)}}const _n={};_n[fn.className]=fn,_n[dn.className]=dn,_n[mn.className]=mn,_n[cn.className]=cn,_n[pn.className]=pn,_n[en.className]=en,_n[bn.className]=bn,_n[wn.className]=wn,_n[vn.className]=vn,_n[un.className]=un,_n[hn.className]=hn;class yn{static fromJSON(e,t){return _n[e.__className].fromJSON(e,t)}}const kn=new Map;function Cn(e,t,i){let n=kn.get(e);n||(n=new Map,kn.set(e,n)),n.set(t,i)}function An(e){return[e]}function En(e,t,i={}){const n=function(e,t){const i=kn.get(e);return i&&i.has(t)?i.get(t):An}(e.constructor,t.constructor);try{return n(e=e.clone(),t,i)}catch(e){throw e}}function xn(e,t,i){e=e.slice(),t=t.slice();const n=new Tn(i.document,i.useRelations,i.forceWeakRemove);n.setOriginalOperations(e),n.setOriginalOperations(t);const o=n.originalOperations;if(0==e.length||0==t.length)return{operationsA:e,operationsB:t,originalOperations:o};const s=new WeakMap;for(const t of e)s.set(t,0);const r={nextBaseVersionA:e[e.length-1].baseVersion+1,nextBaseVersionB:t[t.length-1].baseVersion+1,originalOperationsACount:e.length,originalOperationsBCount:t.length};let a=0;for(;a<e.length;){const i=e[a],o=s.get(i);if(o==t.length){a++;continue}const r=t[o],l=En(i,r,n.getContext(i,r,!0)),c=En(r,i,n.getContext(r,i,!1));n.updateRelation(i,r),n.setOriginalOperations(l,i),n.setOriginalOperations(c,r);for(const e of l)s.set(e,o+c.length);e.splice(a,1,...l),t.splice(o,1,...c)}if(i.padWithNoOps){const i=e.length-r.originalOperationsACount,n=t.length-r.originalOperationsBCount;In(e,n-i),In(t,i-n)}return Pn(e,r.nextBaseVersionB),Pn(t,r.nextBaseVersionA),{operationsA:e,operationsB:t,originalOperations:o}}class Tn{constructor(e,t,i=!1){this.originalOperations=new Map,this._history=e.history,this._useRelations=t,this._forceWeakRemove=!!i,this._relations=new Map}setOriginalOperations(e,t=null){const i=t?this.originalOperations.get(t):null;for(const t of e)this.originalOperations.set(t,i||t)}updateRelation(e,t){if(e instanceof cn)t instanceof hn?e.targetPosition.isEqual(t.sourcePosition)||t.movedRange.containsPosition(e.targetPosition)?this._setRelation(e,t,"insertAtSource"):e.targetPosition.isEqual(t.deletionPosition)?this._setRelation(e,t,"insertBetween"):e.targetPosition.isAfter(t.sourcePosition)&&this._setRelation(e,t,"moveTargetAfter"):t instanceof cn&&(e.targetPosition.isEqual(t.sourcePosition)||e.targetPosition.isBefore(t.sourcePosition)?this._setRelation(e,t,"insertBefore"):this._setRelation(e,t,"insertAfter"));else if(e instanceof un){if(t instanceof hn)e.splitPosition.isBefore(t.sourcePosition)&&this._setRelation(e,t,"splitBefore");else if(t instanceof cn)if(e.splitPosition.isEqual(t.sourcePosition)||e.splitPosition.isBefore(t.sourcePosition))this._setRelation(e,t,"splitBefore");else{const i=St._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&i.containsPosition(e.splitPosition)){const n=i.end.offset-e.splitPosition.offset,o=e.splitPosition.offset-i.start.offset;this._setRelation(e,t,{howMany:n,offset:o})}}}else if(e instanceof hn)t instanceof hn?(e.targetPosition.isEqual(t.sourcePosition)||this._setRelation(e,t,"mergeTargetNotMoved"),e.sourcePosition.isEqual(t.targetPosition)&&this._setRelation(e,t,"mergeSourceNotMoved"),e.sourcePosition.isEqual(t.sourcePosition)&&this._setRelation(e,t,"mergeSameElement")):t instanceof un?e.sourcePosition.isEqual(t.splitPosition)&&this._setRelation(e,t,"splitAtSource"):t instanceof cn&&t.howMany>0&&(e.sourcePosition.isEqual(t.sourcePosition.getShiftedBy(t.howMany))&&this._setRelation(e,t,"mergeSourceAffected"),e.targetPosition.isEqual(t.sourcePosition)&&this._setRelation(e,t,"mergeTargetWasBefore"));else if(e instanceof mn){const i=e.newRange;if(!i)return;if(t instanceof cn){const n=St._createFromPositionAndShift(t.sourcePosition,t.howMany),o=n.containsPosition(i.start)||n.start.isEqual(i.start),s=n.containsPosition(i.end)||n.end.isEqual(i.end);!o&&!s||n.containsRange(i)||this._setRelation(e,t,{side:o?"left":"right",path:o?i.start.path.slice():i.end.path.slice()})}else if(t instanceof hn){const n=i.start.isEqual(t.targetPosition),o=i.start.isEqual(t.deletionPosition),s=i.end.isEqual(t.deletionPosition),r=i.end.isEqual(t.sourcePosition);(n||o||s||r)&&this._setRelation(e,t,{wasInLeftElement:n,wasStartBeforeMergedElement:o,wasEndBeforeMergedElement:s,wasInRightElement:r})}}}getContext(e,t,i){return{aIsStrong:i,aWasUndone:this._wasUndone(e),bWasUndone:this._wasUndone(t),abRelation:this._useRelations?this._getRelation(e,t):null,baRelation:this._useRelations?this._getRelation(t,e):null,forceWeakRemove:this._forceWeakRemove}}_wasUndone(e){const t=this.originalOperations.get(e);return t.wasUndone||this._history.isUndoneOperation(t)}_getRelation(e,t){const i=this.originalOperations.get(t),n=this._history.getUndoneOperation(i);if(!n)return null;const o=this.originalOperations.get(e),s=this._relations.get(o);return s&&s.get(n)||null}_setRelation(e,t,i){const n=this.originalOperations.get(e),o=this.originalOperations.get(t);let s=this._relations.get(n);s||(s=new Map,this._relations.set(n,s)),s.set(o,i)}}function Pn(e,t){for(const i of e)i.baseVersion=t++}function In(e,t){for(let i=0;i<t;i++)e.push(new pn(0))}function Sn(e,t,i){const n=e.nodes.getNode(0).getAttribute(t);if(n==i)return null;const o=new St(e.position,e.position.getShiftedBy(e.howMany));return new fn(o,t,n,i,0)}function Vn(e,t){return null===e.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany)}function Rn(e,t){const i=[];for(let n=0;n<e.length;n++){const o=e[n],s=new cn(o.start,o.end.offset-o.start.offset,t,0);i.push(s);for(let t=n+1;t<e.length;t++)e[t]=e[t]._getTransformedByMove(s.sourcePosition,s.targetPosition,s.howMany)[0];t=t._getTransformedByMove(s.sourcePosition,s.targetPosition,s.howMany)}return i}Cn(fn,fn,((e,t,i)=>{if(e.key===t.key&&e.range.start.hasSameParentAs(t.range.start)){const n=e.range.getDifference(t.range).map((t=>new fn(t,e.key,e.oldValue,e.newValue,0))),o=e.range.getIntersection(t.range);return o&&i.aIsStrong&&n.push(new fn(o,t.key,t.newValue,e.newValue,0)),0==n.length?[new pn(0)]:n}return[e]})),Cn(fn,dn,((e,t)=>{if(e.range.start.hasSameParentAs(t.position)&&e.range.containsPosition(t.position)){const i=e.range._getTransformedByInsertion(t.position,t.howMany,!t.shouldReceiveAttributes).map((t=>new fn(t,e.key,e.oldValue,e.newValue,e.baseVersion)));if(t.shouldReceiveAttributes){const n=Sn(t,e.key,e.oldValue);n&&i.unshift(n)}return i}return e.range=e.range._getTransformedByInsertion(t.position,t.howMany,!1)[0],[e]})),Cn(fn,hn,((e,t)=>{const i=[];e.range.start.hasSameParentAs(t.deletionPosition)&&(e.range.containsPosition(t.deletionPosition)||e.range.start.isEqual(t.deletionPosition))&&i.push(St._createFromPositionAndShift(t.graveyardPosition,1));const n=e.range._getTransformedByMergeOperation(t);return n.isCollapsed||i.push(n),i.map((t=>new fn(t,e.key,e.oldValue,e.newValue,e.baseVersion)))})),Cn(fn,cn,((e,t)=>function(e,t){const i=St._createFromPositionAndShift(t.sourcePosition,t.howMany);let n=null,o=[];i.containsRange(e,!0)?n=e:e.start.hasSameParentAs(i.start)?(o=e.getDifference(i),n=e.getIntersection(i)):o=[e];const s=[];for(let e of o){e=e._getTransformedByDeletion(t.sourcePosition,t.howMany);const i=t.getMovedRangeStart(),n=e.start.hasSameParentAs(i),o=e._getTransformedByInsertion(i,t.howMany,n);s.push(...o)}return n&&s.push(n._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany,!1)[0]),s}(e.range,t).map((t=>new fn(t,e.key,e.oldValue,e.newValue,e.baseVersion))))),Cn(fn,un,((e,t)=>{if(e.range.end.isEqual(t.insertionPosition))return t.graveyardPosition||e.range.end.offset++,[e];if(e.range.start.hasSameParentAs(t.splitPosition)&&e.range.containsPosition(t.splitPosition)){const i=e.clone();return i.range=new St(t.moveTargetPosition.clone(),e.range.end._getCombined(t.splitPosition,t.moveTargetPosition)),e.range.end=t.splitPosition.clone(),e.range.end.stickiness="toPrevious",[e,i]}return e.range=e.range._getTransformedBySplitOperation(t),[e]})),Cn(dn,fn,((e,t)=>{const i=[e];if(e.shouldReceiveAttributes&&e.position.hasSameParentAs(t.range.start)&&t.range.containsPosition(e.position)){const n=Sn(e,t.key,t.newValue);n&&i.push(n)}return i})),Cn(dn,dn,((e,t,i)=>(e.position.isEqual(t.position)&&i.aIsStrong||(e.position=e.position._getTransformedByInsertOperation(t)),[e]))),Cn(dn,cn,((e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e]))),Cn(dn,un,((e,t)=>(e.position=e.position._getTransformedBySplitOperation(t),[e]))),Cn(dn,hn,((e,t)=>(e.position=e.position._getTransformedByMergeOperation(t),[e]))),Cn(mn,dn,((e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByInsertOperation(t)[0]),e.newRange&&(e.newRange=e.newRange._getTransformedByInsertOperation(t)[0]),[e]))),Cn(mn,mn,((e,t,i)=>{if(e.name==t.name){if(!i.aIsStrong)return[new pn(0)];e.oldRange=t.newRange?t.newRange.clone():null}return[e]})),Cn(mn,hn,((e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByMergeOperation(t)),e.newRange&&(e.newRange=e.newRange._getTransformedByMergeOperation(t)),[e]))),Cn(mn,cn,((e,t,i)=>{if(e.oldRange&&(e.oldRange=St._createFromRanges(e.oldRange._getTransformedByMoveOperation(t))),e.newRange){if(i.abRelation){const n=St._createFromRanges(e.newRange._getTransformedByMoveOperation(t));if("left"==i.abRelation.side&&t.targetPosition.isEqual(e.newRange.start))return e.newRange.end=n.end,e.newRange.start.path=i.abRelation.path,[e];if("right"==i.abRelation.side&&t.targetPosition.isEqual(e.newRange.end))return e.newRange.start=n.start,e.newRange.end.path=i.abRelation.path,[e]}e.newRange=St._createFromRanges(e.newRange._getTransformedByMoveOperation(t))}return[e]})),Cn(mn,un,((e,t,i)=>{if(e.oldRange&&(e.oldRange=e.oldRange._getTransformedBySplitOperation(t)),e.newRange){if(i.abRelation){const n=e.newRange._getTransformedBySplitOperation(t);return e.newRange.start.isEqual(t.splitPosition)&&i.abRelation.wasStartBeforeMergedElement?e.newRange.start=At._createAt(t.insertionPosition):e.newRange.start.isEqual(t.splitPosition)&&!i.abRelation.wasInLeftElement&&(e.newRange.start=At._createAt(t.moveTargetPosition)),e.newRange.end.isEqual(t.splitPosition)&&i.abRelation.wasInRightElement?e.newRange.end=At._createAt(t.moveTargetPosition):e.newRange.end.isEqual(t.splitPosition)&&i.abRelation.wasEndBeforeMergedElement?e.newRange.end=At._createAt(t.insertionPosition):e.newRange.end=n.end,[e]}e.newRange=e.newRange._getTransformedBySplitOperation(t)}return[e]})),Cn(hn,dn,((e,t)=>(e.sourcePosition.hasSameParentAs(t.position)&&(e.howMany+=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByInsertOperation(t),e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t),[e]))),Cn(hn,hn,((e,t,i)=>{if(e.sourcePosition.isEqual(t.sourcePosition)&&e.targetPosition.isEqual(t.targetPosition)){if(i.bWasUndone){const i=t.graveyardPosition.path.slice();return i.push(0),e.sourcePosition=new At(t.graveyardPosition.root,i),e.howMany=0,[e]}return[new pn(0)]}if(e.sourcePosition.isEqual(t.sourcePosition)&&!e.targetPosition.isEqual(t.targetPosition)&&!i.bWasUndone&&"splitAtSource"!=i.abRelation){const n="$graveyard"==e.targetPosition.root.rootName,o="$graveyard"==t.targetPosition.root.rootName;if(o&&!n||(!n||o)&&i.aIsStrong){const i=t.targetPosition._getTransformedByMergeOperation(t),n=e.targetPosition._getTransformedByMergeOperation(t);return[new cn(i,e.howMany,n,0)]}return[new pn(0)]}return e.sourcePosition.hasSameParentAs(t.targetPosition)&&(e.howMany+=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByMergeOperation(t),e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),e.graveyardPosition.isEqual(t.graveyardPosition)&&i.aIsStrong||(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]})),Cn(hn,cn,((e,t,i)=>{const n=St._createFromPositionAndShift(t.sourcePosition,t.howMany);return"remove"==t.type&&!i.bWasUndone&&!i.forceWeakRemove&&e.deletionPosition.hasSameParentAs(t.sourcePosition)&&n.containsPosition(e.sourcePosition)?[new pn(0)]:(t.sourcePosition.getShiftedBy(t.howMany).isEqual(e.sourcePosition)?e.sourcePosition.stickiness="toNone":t.targetPosition.isEqual(e.sourcePosition)&&"mergeSourceAffected"==i.abRelation?e.sourcePosition.stickiness="toNext":t.sourcePosition.isEqual(e.targetPosition)?(e.targetPosition.stickiness="toNone",e.howMany-=t.howMany):t.targetPosition.isEqual(e.targetPosition)&&"mergeTargetWasBefore"==i.abRelation?(e.targetPosition.stickiness="toPrevious",e.howMany+=t.howMany):(e.sourcePosition.hasSameParentAs(t.targetPosition)&&(e.howMany+=t.howMany),e.sourcePosition.hasSameParentAs(t.sourcePosition)&&(e.howMany-=t.howMany)),e.sourcePosition=e.sourcePosition._getTransformedByMoveOperation(t),e.targetPosition=e.targetPosition._getTransformedByMoveOperation(t),e.sourcePosition.stickiness="toPrevious",e.targetPosition.stickiness="toNext",e.graveyardPosition.isEqual(t.targetPosition)||(e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(t)),[e])})),Cn(hn,un,((e,t,i)=>{if(t.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedByDeletion(t.graveyardPosition,1),e.deletionPosition.isEqual(t.graveyardPosition)&&(e.howMany=t.howMany)),e.targetPosition.isEqual(t.splitPosition)){const n=0!=t.howMany,o=t.graveyardPosition&&e.deletionPosition.isEqual(t.graveyardPosition);if(n||o||"mergeTargetNotMoved"==i.abRelation)return e.sourcePosition=e.sourcePosition._getTransformedBySplitOperation(t),[e]}if(e.sourcePosition.isEqual(t.splitPosition)){if("mergeSourceNotMoved"==i.abRelation)return e.howMany=0,e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e];if("mergeSameElement"==i.abRelation||e.sourcePosition.offset>0)return e.sourcePosition=t.moveTargetPosition.clone(),e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e]}return e.sourcePosition.hasSameParentAs(t.splitPosition)&&(e.howMany=t.splitPosition.offset),e.sourcePosition=e.sourcePosition._getTransformedBySplitOperation(t),e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e]})),Cn(cn,dn,((e,t)=>{const i=St._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByInsertOperation(t,!1)[0];return e.sourcePosition=i.start,e.howMany=i.end.offset-i.start.offset,e.targetPosition.isEqual(t.position)||(e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t)),[e]})),Cn(cn,cn,((e,t,i)=>{const o=St._createFromPositionAndShift(e.sourcePosition,e.howMany),s=St._createFromPositionAndShift(t.sourcePosition,t.howMany);let r,a=i.aIsStrong,l=!i.aIsStrong;if("insertBefore"==i.abRelation||"insertAfter"==i.baRelation?l=!0:"insertAfter"!=i.abRelation&&"insertBefore"!=i.baRelation||(l=!1),r=e.targetPosition.isEqual(t.targetPosition)&&l?e.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany):e.targetPosition._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),Vn(e,t)&&Vn(t,e))return[t.getReversed()];if(o.containsPosition(t.targetPosition)&&o.containsRange(s,!0))return o.start=o.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),o.end=o.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),Rn([o],r);if(s.containsPosition(e.targetPosition)&&s.containsRange(o,!0))return o.start=o.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),o.end=o.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),Rn([o],r);const c=(0,n.compareArrays)(e.sourcePosition.getParentPath(),t.sourcePosition.getParentPath());if("prefix"==c||"extension"==c)return o.start=o.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),o.end=o.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),Rn([o],r);"remove"!=e.type||"remove"==t.type||i.aWasUndone||i.forceWeakRemove?"remove"==e.type||"remove"!=t.type||i.bWasUndone||i.forceWeakRemove||(a=!1):a=!0;const d=[],u=o.getDifference(s);for(const e of u){e.start=e.start._getTransformedByDeletion(t.sourcePosition,t.howMany),e.end=e.end._getTransformedByDeletion(t.sourcePosition,t.howMany);const i="same"==(0,n.compareArrays)(e.start.getParentPath(),t.getMovedRangeStart().getParentPath()),o=e._getTransformedByInsertion(t.getMovedRangeStart(),t.howMany,i);d.push(...o)}const h=o.getIntersection(s);return null!==h&&a&&(h.start=h.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),h.end=h.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),0===d.length?d.push(h):1==d.length?s.start.isBefore(o.start)||s.start.isEqual(o.start)?d.unshift(h):d.push(h):d.splice(1,0,h)),0===d.length?[new pn(e.baseVersion)]:Rn(d,r)})),Cn(cn,un,((e,t,i)=>{let n=e.targetPosition.clone();e.targetPosition.isEqual(t.insertionPosition)&&t.graveyardPosition&&"moveTargetAfter"!=i.abRelation||(n=e.targetPosition._getTransformedBySplitOperation(t));const o=St._createFromPositionAndShift(e.sourcePosition,e.howMany);if(o.end.isEqual(t.insertionPosition))return t.graveyardPosition||e.howMany++,e.targetPosition=n,[e];if(o.start.hasSameParentAs(t.splitPosition)&&o.containsPosition(t.splitPosition)){let e=new St(t.splitPosition,o.end);return e=e._getTransformedBySplitOperation(t),Rn([new St(o.start,t.splitPosition),e],n)}e.targetPosition.isEqual(t.splitPosition)&&"insertAtSource"==i.abRelation&&(n=t.moveTargetPosition),e.targetPosition.isEqual(t.insertionPosition)&&"insertBetween"==i.abRelation&&(n=e.targetPosition);const s=[o._getTransformedBySplitOperation(t)];if(t.graveyardPosition){const n=o.start.isEqual(t.graveyardPosition)||o.containsPosition(t.graveyardPosition);e.howMany>1&&n&&!i.aWasUndone&&s.push(St._createFromPositionAndShift(t.insertionPosition,1))}return Rn(s,n)})),Cn(cn,hn,((e,t,i)=>{const n=St._createFromPositionAndShift(e.sourcePosition,e.howMany);if(t.deletionPosition.hasSameParentAs(e.sourcePosition)&&n.containsPosition(t.sourcePosition))if("remove"!=e.type||i.forceWeakRemove){if(1==e.howMany)return i.bWasUndone?(e.sourcePosition=t.graveyardPosition.clone(),e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),[e]):[new pn(0)]}else if(!i.aWasUndone){const i=[];let n=t.graveyardPosition.clone(),o=t.targetPosition._getTransformedByMergeOperation(t);e.howMany>1&&(i.push(new cn(e.sourcePosition,e.howMany-1,e.targetPosition,0)),n=n._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany-1),o=o._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany-1));const s=t.deletionPosition._getCombined(e.sourcePosition,e.targetPosition),r=new cn(n,1,s,0),a=r.getMovedRangeStart().path.slice();a.push(0);const l=new At(r.targetPosition.root,a);o=o._getTransformedByMove(n,s,1);const c=new cn(o,t.howMany,l,0);return i.push(r),i.push(c),i}const o=St._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByMergeOperation(t);return e.sourcePosition=o.start,e.howMany=o.end.offset-o.start.offset,e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),[e]})),Cn(bn,dn,((e,t)=>(e.position=e.position._getTransformedByInsertOperation(t),[e]))),Cn(bn,hn,((e,t)=>e.position.isEqual(t.deletionPosition)?(e.position=t.graveyardPosition.clone(),e.position.stickiness="toNext",[e]):(e.position=e.position._getTransformedByMergeOperation(t),[e]))),Cn(bn,cn,((e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e]))),Cn(bn,bn,((e,t,i)=>{if(e.position.isEqual(t.position)){if(!i.aIsStrong)return[new pn(0)];e.oldName=t.newName}return[e]})),Cn(bn,un,((e,t)=>{const i=e.position.path,o=t.splitPosition.getParentPath();if("same"==(0,n.compareArrays)(i,o)&&!t.graveyardPosition){const t=new bn(e.position.getShiftedBy(1),e.oldName,e.newName,0);return[e,t]}return e.position=e.position._getTransformedBySplitOperation(t),[e]})),Cn(wn,wn,((e,t,i)=>{if(e.root===t.root&&e.key===t.key){if(!i.aIsStrong||e.newValue===t.newValue)return[new pn(0)];e.oldValue=t.newValue}return[e]})),Cn(vn,vn,((e,t)=>e.rootName===t.rootName&&e.isAdd===t.isAdd?[new pn(0)]:[e])),Cn(un,dn,((e,t)=>(e.splitPosition.hasSameParentAs(t.position)&&e.splitPosition.offset<t.position.offset&&(e.howMany+=t.howMany),e.splitPosition=e.splitPosition._getTransformedByInsertOperation(t),e.insertionPosition=e.insertionPosition._getTransformedByInsertOperation(t),[e]))),Cn(un,hn,((e,t,i)=>{if(!e.graveyardPosition&&!i.bWasUndone&&e.splitPosition.hasSameParentAs(t.sourcePosition)){const i=t.graveyardPosition.path.slice();i.push(0);const n=new At(t.graveyardPosition.root,i),o=un.getInsertionPosition(new At(t.graveyardPosition.root,i)),s=new un(n,0,o,null,0);return e.splitPosition=e.splitPosition._getTransformedByMergeOperation(t),e.insertionPosition=un.getInsertionPosition(e.splitPosition),e.graveyardPosition=s.insertionPosition.clone(),e.graveyardPosition.stickiness="toNext",[s,e]}return e.splitPosition.hasSameParentAs(t.deletionPosition)&&!e.splitPosition.isAfter(t.deletionPosition)&&e.howMany--,e.splitPosition.hasSameParentAs(t.targetPosition)&&(e.howMany+=t.howMany),e.splitPosition=e.splitPosition._getTransformedByMergeOperation(t),e.insertionPosition=un.getInsertionPosition(e.splitPosition),e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]})),Cn(un,cn,((e,t,i)=>{const n=St._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.graveyardPosition){const o=n.start.isEqual(e.graveyardPosition)||n.containsPosition(e.graveyardPosition);if(!i.bWasUndone&&o){const i=e.splitPosition._getTransformedByMoveOperation(t),n=e.graveyardPosition._getTransformedByMoveOperation(t),o=n.path.slice();o.push(0);const s=new At(n.root,o);return[new cn(i,e.howMany,s,0)]}e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(t)}const o=e.splitPosition.isEqual(t.targetPosition);if(o&&("insertAtSource"==i.baRelation||"splitBefore"==i.abRelation))return e.howMany+=t.howMany,e.splitPosition=e.splitPosition._getTransformedByDeletion(t.sourcePosition,t.howMany),e.insertionPosition=un.getInsertionPosition(e.splitPosition),[e];if(o&&i.abRelation&&i.abRelation.howMany){const{howMany:t,offset:n}=i.abRelation;return e.howMany+=t,e.splitPosition=e.splitPosition.getShiftedBy(n),[e]}if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&n.containsPosition(e.splitPosition)){const i=t.howMany-(e.splitPosition.offset-t.sourcePosition.offset);return e.howMany-=i,e.splitPosition.hasSameParentAs(t.targetPosition)&&e.splitPosition.offset<t.targetPosition.offset&&(e.howMany+=t.howMany),e.splitPosition=t.sourcePosition.clone(),e.insertionPosition=un.getInsertionPosition(e.splitPosition),[e]}return t.sourcePosition.isEqual(t.targetPosition)||(e.splitPosition.hasSameParentAs(t.sourcePosition)&&e.splitPosition.offset<=t.sourcePosition.offset&&(e.howMany-=t.howMany),e.splitPosition.hasSameParentAs(t.targetPosition)&&e.splitPosition.offset<t.targetPosition.offset&&(e.howMany+=t.howMany)),e.splitPosition.stickiness="toNone",e.splitPosition=e.splitPosition._getTransformedByMoveOperation(t),e.splitPosition.stickiness="toNext",e.graveyardPosition?e.insertionPosition=e.insertionPosition._getTransformedByMoveOperation(t):e.insertionPosition=un.getInsertionPosition(e.splitPosition),[e]})),Cn(un,un,((e,t,i)=>{if(e.splitPosition.isEqual(t.splitPosition)){if(!e.graveyardPosition&&!t.graveyardPosition)return[new pn(0)];if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition))return[new pn(0)];if("splitBefore"==i.abRelation)return e.howMany=0,e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t),[e]}if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition)){const n="$graveyard"==e.splitPosition.root.rootName,o="$graveyard"==t.splitPosition.root.rootName;if(o&&!n||(!n||o)&&i.aIsStrong){const i=[];return t.howMany&&i.push(new cn(t.moveTargetPosition,t.howMany,t.splitPosition,0)),e.howMany&&i.push(new cn(e.splitPosition,e.howMany,e.moveTargetPosition,0)),i}return[new pn(0)]}if(e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t)),e.splitPosition.isEqual(t.insertionPosition)&&"splitBefore"==i.abRelation)return e.howMany++,[e];if(t.splitPosition.isEqual(e.insertionPosition)&&"splitBefore"==i.baRelation){const i=t.insertionPosition.path.slice();i.push(0);const n=new At(t.insertionPosition.root,i);return[e,new cn(e.insertionPosition,1,n,0)]}return e.splitPosition.hasSameParentAs(t.splitPosition)&&e.splitPosition.offset<t.splitPosition.offset&&(e.howMany-=t.howMany),e.splitPosition=e.splitPosition._getTransformedBySplitOperation(t),e.insertionPosition=un.getInsertionPosition(e.splitPosition),[e]}));class Bn extends((0,n.EmitterMixin)(At)){constructor(e,t,i="toNone"){if(super(e,t,i),!this.root.is("rootElement"))throw new n.CKEditorError("model-liveposition-root-not-rootelement",e);Mn.call(this)}detach(){this.stopListening()}toPosition(){return new At(this.root,this.path.slice(),this.stickiness)}static fromPosition(e,t){return new this(e.root,e.path.slice(),t||e.stickiness)}}function Mn(){this.listenTo(this.root.document.model,"applyOperation",((e,t)=>{const i=t[0];i.isDocumentOperation&&On.call(this,i)}),{priority:"low"})}function On(e){const t=this.getTransformedByOperation(e);if(!this.isEqual(t)){const e=this.toPosition();this.path=t.path,this.root=t.root,this.fire("change",e)}}Bn.prototype.is=function(e){return"livePosition"===e||"model:livePosition"===e||"position"==e||"model:position"===e};class Ln{constructor(e={}){"string"==typeof e&&(e="transparent"===e?{isUndoable:!1}:{},(0,n.logWarning)("batch-constructor-deprecated-string-type"));const{isUndoable:t=!0,isLocal:i=!0,isUndo:o=!1,isTyping:s=!1}=e;this.operations=[],this.isUndoable=t,this.isLocal=i,this.isUndo=o,this.isTyping=s}get type(){return(0,n.logWarning)("batch-type-deprecated"),"default"}get baseVersion(){for(const e of this.operations)if(null!==e.baseVersion)return e.baseVersion;return null}addOperation(e){return e.batch=this,this.operations.push(e),e}}class Fn{constructor(e){this._changesInElement=new Map,this._elementsSnapshots=new Map,this._elementChildrenSnapshots=new Map,this._elementState=new Map,this._changedMarkers=new Map,this._changedRoots=new Map,this._changeCount=0,this._cachedChanges=null,this._cachedChangesWithGraveyard=null,this._refreshedItems=new Set,this._markerCollection=e}get isEmpty(){return 0==this._changesInElement.size&&0==this._changedMarkers.size&&0==this._changedRoots.size}bufferOperation(e){const t=e;switch(t.type){case"insert":if(this._isInInsertedElement(t.position.parent))return;this._markInsert(t.position.parent,t.position.offset,t.nodes.maxOffset);break;case"addAttribute":case"removeAttribute":case"changeAttribute":for(const e of t.range.getItems({shallow:!0}))this._isInInsertedElement(e.parent)||this._markAttribute(e);break;case"remove":case"move":case"reinsert":{if(t.sourcePosition.isEqual(t.targetPosition)||t.sourcePosition.getShiftedBy(t.howMany).isEqual(t.targetPosition))return;const e=this._isInInsertedElement(t.sourcePosition.parent),i=this._isInInsertedElement(t.targetPosition.parent);e||this._markRemove(t.sourcePosition.parent,t.sourcePosition.offset,t.howMany),i||this._markInsert(t.targetPosition.parent,t.getMovedRangeStart().offset,t.howMany);const n=St._createFromPositionAndShift(t.sourcePosition,t.howMany);for(const e of n.getItems({shallow:!0}))this._setElementState(e,"move");break}case"rename":{if(this._isInInsertedElement(t.position.parent))return;this._markRemove(t.position.parent,t.position.offset,1),this._markInsert(t.position.parent,t.position.offset,1);const e=St._createFromPositionAndShift(t.position,1);for(const t of this._markerCollection.getMarkersIntersectingRange(e)){const e=t.getData();this.bufferMarkerChange(t.name,e,e)}this._setElementState(t.position.nodeAfter,"rename");break}case"split":{const e=t.splitPosition.parent;if(!this._isInInsertedElement(e)){this._markRemove(e,t.splitPosition.offset,t.howMany);const i=St._createFromPositionAndShift(t.splitPosition,t.howMany);for(const e of i.getItems({shallow:!0}))this._setElementState(e,"move")}this._isInInsertedElement(t.insertionPosition.parent)||this._markInsert(t.insertionPosition.parent,t.insertionPosition.offset,1),t.graveyardPosition&&(this._markRemove(t.graveyardPosition.parent,t.graveyardPosition.offset,1),this._setElementState(t.graveyardPosition.nodeAfter,"move"));break}case"merge":{const e=t.sourcePosition.parent;this._isInInsertedElement(e.parent)||this._markRemove(e.parent,e.startOffset,1);const i=t.graveyardPosition.parent;this._markInsert(i,t.graveyardPosition.offset,1),this._setElementState(e,"move");const n=t.targetPosition.parent;if(!this._isInInsertedElement(n)){this._markInsert(n,t.targetPosition.offset,e.maxOffset);const i=St._createFromPositionAndShift(t.sourcePosition,t.howMany);for(const e of i.getItems({shallow:!0}))this._setElementState(e,"move")}break}case"detachRoot":case"addRoot":{const e=t.affectedSelectable;if(!e._isLoaded)return;if(e.isAttached()==t.isAdd)return;this._bufferRootStateChange(t.rootName,t.isAdd);break}case"addRootAttribute":case"removeRootAttribute":case"changeRootAttribute":{if(!t.root._isLoaded)return;const e=t.root.rootName;this._bufferRootAttributeChange(e,t.key,t.oldValue,t.newValue);break}}this._cachedChanges=null}bufferMarkerChange(e,t,i){t.range&&t.range.root.is("rootElement")&&!t.range.root._isLoaded&&(t.range=null),i.range&&i.range.root.is("rootElement")&&!i.range.root._isLoaded&&(i.range=null);let n=this._changedMarkers.get(e);n?n.newMarkerData=i:(n={newMarkerData:i,oldMarkerData:t},this._changedMarkers.set(e,n)),null==n.oldMarkerData.range&&null==i.range&&this._changedMarkers.delete(e)}getMarkersToRemove(){const e=[];for(const[t,i]of this._changedMarkers)null!=i.oldMarkerData.range&&e.push({name:t,range:i.oldMarkerData.range});return e}getMarkersToAdd(){const e=[];for(const[t,i]of this._changedMarkers)null!=i.newMarkerData.range&&e.push({name:t,range:i.newMarkerData.range});return e}getChangedMarkers(){return Array.from(this._changedMarkers).map((([e,t])=>({name:e,data:{oldRange:t.oldMarkerData.range,newRange:t.newMarkerData.range}})))}hasDataChanges(){if(this.getChanges().length)return!0;if(this._changedRoots.size>0)return!0;for(const{newMarkerData:e,oldMarkerData:t}of this._changedMarkers.values()){if(e.affectsData!==t.affectsData)return!0;if(e.affectsData){const i=e.range&&!t.range,n=!e.range&&t.range,o=e.range&&t.range&&!e.range.isEqual(t.range);if(i||n||o)return!0}}return!1}getChanges(e={}){if(this._cachedChanges)return e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice();let t=[];for(const e of this._changesInElement.keys()){const i=this._changesInElement.get(e).sort(((e,t)=>e.offset===t.offset?e.type!=t.type?"remove"==e.type?-1:1:0:e.offset<t.offset?-1:1)),n=this._elementChildrenSnapshots.get(e),o=zn(e.getChildren()),s=Wn(n.length,i);let r=0,a=0;for(const i of s)if("i"===i){const i=this._getDiffActionForNode(o[r].node,"insert"),n=this._elementsSnapshots.get(o[r].node),s=this._getInsertDiff(e,r,i,o[r],n);t.push(s),r++}else if("r"===i){const i=this._getDiffActionForNode(n[a].node,"remove"),o=this._getRemoveDiff(e,r,i,n[a]);t.push(o),a++}else if("a"===i){const i=n[a].attributes,s=o[r].attributes;let l;if("$text"==o[r].name)l=new St(At._createAt(e,r),At._createAt(e,r+1));else{const t=e.offsetToIndex(r);l=new St(At._createAt(e,r),At._createAt(e.getChild(t),0))}const c=this._getAttributesDiff(l,i,s);t.push(...c),r++,a++}else r++,a++}t.sort(((e,t)=>e.position.root!=t.position.root?e.position.root.rootName<t.position.root.rootName?-1:1:e.position.isEqual(t.position)?e.changeCount-t.changeCount:e.position.isBefore(t.position)?-1:1));for(let e=1,i=0;e<t.length;e++){const n=t[i],o=t[e],s="remove"==n.type&&"remove"==o.type&&"$text"==n.name&&"$text"==o.name&&n.position.isEqual(o.position),r="insert"==n.type&&"insert"==o.type&&"$text"==n.name&&"$text"==o.name&&n.position.parent==o.position.parent&&n.position.offset+n.length==o.position.offset,a="attribute"==n.type&&"attribute"==o.type&&n.position.parent==o.position.parent&&n.range.isFlat&&o.range.isFlat&&n.position.offset+n.length==o.position.offset&&n.attributeKey==o.attributeKey&&n.attributeOldValue==o.attributeOldValue&&n.attributeNewValue==o.attributeNewValue;s||r||a?(n.length++,a&&(n.range.end=n.range.end.getShiftedBy(1)),t[e]=null):i=e}t=t.filter((e=>e));for(const e of t)delete e.changeCount,"attribute"==e.type&&(delete e.position,delete e.length);return this._changeCount=0,this._cachedChangesWithGraveyard=t,this._cachedChanges=t.filter(Hn),e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice()}getChangedRoots(){return Array.from(this._changedRoots.values()).map((e=>{const t={...e};return void 0!==t.state&&delete t.attributes,t}))}getRefreshedItems(){return new Set(this._refreshedItems)}reset(){this._changesInElement.clear(),this._elementChildrenSnapshots.clear(),this._elementsSnapshots.clear(),this._elementState.clear(),this._changedMarkers.clear(),this._changedRoots.clear(),this._refreshedItems.clear(),this._cachedChanges=null}_refreshItem(e){if(this._isInInsertedElement(e.parent))return;this._markRemove(e.parent,e.startOffset,e.offsetSize),this._markInsert(e.parent,e.startOffset,e.offsetSize),this._refreshedItems.add(e),this._setElementState(e,"refresh");const t=St._createOn(e);for(const e of this._markerCollection.getMarkersIntersectingRange(t)){const t=e.getData();this.bufferMarkerChange(e.name,t,t)}this._cachedChanges=null}_bufferRootLoad(e){if(e.isAttached()){this._bufferRootStateChange(e.rootName,!0),this._markInsert(e,0,e.maxOffset);for(const t of e.getAttributeKeys())this._bufferRootAttributeChange(e.rootName,t,null,e.getAttribute(t));for(const t of this._markerCollection)if(t.getRange().root==e){const e=t.getData();this.bufferMarkerChange(t.name,{...e,range:null},e)}}}_bufferRootStateChange(e,t){if(!this._changedRoots.has(e))return void this._changedRoots.set(e,{name:e,state:t?"attached":"detached"});const i=this._changedRoots.get(e);void 0!==i.state?(delete i.state,void 0===i.attributes&&this._changedRoots.delete(e)):i.state=t?"attached":"detached"}_bufferRootAttributeChange(e,t,i,n){const o=this._changedRoots.get(e)||{name:e},s=o.attributes||{};if(s[t]){const e=s[t];n===e.oldValue?delete s[t]:e.newValue=n}else s[t]={oldValue:i,newValue:n};0===Object.entries(s).length?(delete o.attributes,void 0===o.state&&this._changedRoots.delete(e)):(o.attributes=s,this._changedRoots.set(e,o))}_markInsert(e,t,i){if(e.root.is("rootElement")&&!e.root._isLoaded)return;const n={type:"insert",offset:t,howMany:i,count:this._changeCount++};this._markChange(e,n)}_markRemove(e,t,i){if(e.root.is("rootElement")&&!e.root._isLoaded)return;const n={type:"remove",offset:t,howMany:i,count:this._changeCount++};this._markChange(e,n),this._removeAllNestedChanges(e,t,i)}_markAttribute(e){if(e.root.is("rootElement")&&!e.root._isLoaded)return;const t={type:"attribute",offset:e.startOffset,howMany:e.offsetSize,count:this._changeCount++};this._markChange(e.parent,t)}_markChange(e,t){this._makeSnapshots(e);const i=this._getChangesForElement(e);this._handleChange(t,i),i.push(t);for(let e=0;e<i.length;e++)i[e].howMany<1&&(i.splice(e,1),e--)}_setElementState(e,t){if(!e.is("element"))return;const i=Fn._statesPriority.indexOf(this._elementState.get(e));Fn._statesPriority.indexOf(t)>i&&this._elementState.set(e,t)}_getDiffActionForNode(e,t){if(!e.is("element"))return t;if(!this._elementsSnapshots.has(e))return t;const i=this._elementState.get(e);return i&&"move"!=i?i:t}_getChangesForElement(e){let t;return this._changesInElement.has(e)?t=this._changesInElement.get(e):(t=[],this._changesInElement.set(e,t)),t}_makeSnapshots(e){if(this._elementChildrenSnapshots.has(e))return;const t=zn(e.getChildren());this._elementChildrenSnapshots.set(e,t);for(const e of t)this._elementsSnapshots.set(e.node,e)}_handleChange(e,t){e.nodesToHandle=e.howMany;for(const i of t){const n=e.offset+e.howMany,o=i.offset+i.howMany;if("insert"==e.type&&("insert"==i.type&&(e.offset<=i.offset?i.offset+=e.howMany:e.offset<o&&(i.howMany+=e.nodesToHandle,e.nodesToHandle=0)),"remove"==i.type&&e.offset<i.offset&&(i.offset+=e.howMany),"attribute"==i.type))if(e.offset<=i.offset)i.offset+=e.howMany;else if(e.offset<o){const o=i.howMany;i.howMany=e.offset-i.offset,t.unshift({type:"attribute",offset:n,howMany:o-i.howMany,count:this._changeCount++})}if("remove"==e.type){if("insert"==i.type)if(n<=i.offset)i.offset-=e.howMany;else if(n<=o)if(e.offset<i.offset){const t=n-i.offset;i.offset=e.offset,i.howMany-=t,e.nodesToHandle-=t}else i.howMany-=e.nodesToHandle,e.nodesToHandle=0;else if(e.offset<=i.offset)e.nodesToHandle-=i.howMany,i.howMany=0;else if(e.offset<o){const t=o-e.offset;i.howMany-=t,e.nodesToHandle-=t}if("remove"==i.type&&(n<=i.offset?i.offset-=e.howMany:e.offset<i.offset&&(e.nodesToHandle+=i.howMany,i.howMany=0)),"attribute"==i.type)if(n<=i.offset)i.offset-=e.howMany;else if(e.offset<i.offset){const t=n-i.offset;i.offset=e.offset,i.howMany-=t}else if(e.offset<o)if(n<=o){const n=i.howMany;i.howMany=e.offset-i.offset;const o=n-i.howMany-e.nodesToHandle;t.unshift({type:"attribute",offset:e.offset,howMany:o,count:this._changeCount++})}else i.howMany-=o-e.offset}if("attribute"==e.type){if("insert"==i.type)if(e.offset<i.offset&&n>i.offset){if(n>o){const e={type:"attribute",offset:o,howMany:n-o,count:this._changeCount++};this._handleChange(e,t),t.push(e)}e.nodesToHandle=i.offset-e.offset,e.howMany=e.nodesToHandle}else e.offset>=i.offset&&e.offset<o&&(n>o?(e.nodesToHandle=n-o,e.offset=o):e.nodesToHandle=0);if("remove"==i.type&&e.offset<i.offset&&n>i.offset){const o={type:"attribute",offset:i.offset,howMany:n-i.offset,count:this._changeCount++};this._handleChange(o,t),t.push(o),e.nodesToHandle=i.offset-e.offset,e.howMany=e.nodesToHandle}"attribute"==i.type&&(e.offset>=i.offset&&n<=o?(e.nodesToHandle=0,e.howMany=0,e.offset=0):e.offset<=i.offset&&n>=o&&(i.howMany=0))}}e.howMany=e.nodesToHandle,delete e.nodesToHandle}_getInsertDiff(e,t,i,n,o){const s={type:"insert",position:At._createAt(e,t),name:n.name,attributes:new Map(n.attributes),length:1,changeCount:this._changeCount++,action:i};return"insert"!=i&&o&&(s.before={name:o.name,attributes:new Map(o.attributes)}),s}_getRemoveDiff(e,t,i,n){return{type:"remove",action:i,position:At._createAt(e,t),name:n.name,attributes:new Map(n.attributes),length:1,changeCount:this._changeCount++}}_getAttributesDiff(e,t,i){const n=[];i=new Map(i);for(const[o,s]of t){const t=i.has(o)?i.get(o):null;t!==s&&n.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:o,attributeOldValue:s,attributeNewValue:t,changeCount:this._changeCount++}),i.delete(o)}for(const[t,o]of i)n.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:t,attributeOldValue:null,attributeNewValue:o,changeCount:this._changeCount++});return n}_isInInsertedElement(e){const t=e.parent;if(!t)return!1;const i=this._changesInElement.get(t),n=e.startOffset;if(i)for(const e of i)if("insert"==e.type&&n>=e.offset&&n<e.offset+e.howMany)return!0;return this._isInInsertedElement(t)}_removeAllNestedChanges(e,t,i){const n=new St(At._createAt(e,t),At._createAt(e,t+i));for(const e of n.getItems({shallow:!0}))e.is("element")&&(this._changesInElement.delete(e),this._removeAllNestedChanges(e,0,e.maxOffset))}}Fn._statesPriority=[void 0,"refresh","rename","move"];const Nn=Fn;function Dn(e){return{node:e,name:e.is("$text")?"$text":e.name,attributes:new Map(e.getAttributes())}}function zn(e){const t=[];for(const i of e)if(i.is("$text"))for(let e=0;e<i.data.length;++e)t.push(Dn(i));else t.push(Dn(i));return t}function Wn(e,t){const i=[];let n=0,o=0;for(const e of t){if(e.offset>n){for(let t=0;t<e.offset-n;t++)i.push("e");o+=e.offset-n}if("insert"==e.type){for(let t=0;t<e.howMany;t++)i.push("i");n=e.offset+e.howMany}else if("remove"==e.type){for(let t=0;t<e.howMany;t++)i.push("r");n=e.offset,o+=e.howMany}else i.push(..."a".repeat(e.howMany).split("")),n=e.offset+e.howMany,o+=e.howMany}if(o<e)for(let t=0;t<e-o-n;t++)i.push("e");return i}function Hn(e){const t="position"in e&&"$graveyard"==e.position.root.rootName,i="range"in e&&"$graveyard"==e.range.root.rootName;return!t&&!i}class Un{constructor(){this._operations=[],this._undoPairs=new Map,this._undoneOperations=new Set,this._baseVersionToOperationIndex=new Map,this._version=0,this._gaps=new Map}get version(){return this._version}set version(e){this._operations.length&&e>this._version+1&&this._gaps.set(this._version,e),this._version=e}get lastOperation(){return this._operations[this._operations.length-1]}addOperation(e){if(e.baseVersion!==this.version)throw new n.CKEditorError("model-document-history-addoperation-incorrect-version",this,{operation:e,historyVersion:this.version});this._operations.push(e),this._version++,this._baseVersionToOperationIndex.set(e.baseVersion,this._operations.length-1)}getOperations(e,t=this.version){if(!this._operations.length)return[];const i=this._operations[0];void 0===e&&(e=i.baseVersion);let n=t-1;for(const[t,i]of this._gaps)e>t&&e<i&&(e=i),n>t&&n<i&&(n=t-1);if(n<i.baseVersion||e>this.lastOperation.baseVersion)return[];let o=this._baseVersionToOperationIndex.get(e);void 0===o&&(o=0);let s=this._baseVersionToOperationIndex.get(n);return void 0===s&&(s=this._operations.length-1),this._operations.slice(o,s+1)}getOperation(e){const t=this._baseVersionToOperationIndex.get(e);if(void 0!==t)return this._operations[t]}setOperationAsUndone(e,t){this._undoPairs.set(t,e),this._undoneOperations.add(e)}isUndoingOperation(e){return this._undoPairs.has(e)}isUndoneOperation(e){return this._undoneOperations.has(e)}getUndoneOperation(e){return this._undoPairs.get(e)}reset(){this._version=0,this._undoPairs=new Map,this._operations=[],this._undoneOperations=new Set,this._gaps=new Map,this._baseVersionToOperationIndex=new Map}}class $n extends yt{constructor(e,t,i="main"){super(t),this._isAttached=!0,this._isLoaded=!0,this._document=e,this.rootName=i}get document(){return this._document}isAttached(){return this._isAttached}toJSON(){return this.rootName}}$n.prototype.is=function(e,t){return t?t===this.name&&("rootElement"===e||"model:rootElement"===e||"element"===e||"model:element"===e):"rootElement"===e||"model:rootElement"===e||"element"===e||"model:element"===e||"node"===e||"model:node"===e};const jn="$graveyard";class qn extends((0,n.EmitterMixin)()){constructor(e){super(),this.model=e,this.history=new Un,this.selection=new Gt(this),this.roots=new n.Collection({idProperty:"rootName"}),this.differ=new Nn(e.markers),this.isReadOnly=!1,this._postFixers=new Set,this._hasSelectionChangedFromTheLastChangeBlock=!1,this.createRoot("$root",jn),this.listenTo(e,"applyOperation",((e,t)=>{const i=t[0];i.isDocumentOperation&&this.differ.bufferOperation(i)}),{priority:"high"}),this.listenTo(e,"applyOperation",((e,t)=>{const i=t[0];i.isDocumentOperation&&this.history.addOperation(i)}),{priority:"low"}),this.listenTo(this.selection,"change",(()=>{this._hasSelectionChangedFromTheLastChangeBlock=!0})),this.listenTo(e.markers,"update",((e,t,i,n,o)=>{const s={...t.getData(),range:n};this.differ.bufferMarkerChange(t.name,o,s),null===i&&t.on("change",((e,i)=>{const n=t.getData();this.differ.bufferMarkerChange(t.name,{...n,range:i},n)}))})),this.registerPostFixer((e=>{let t=!1;for(const i of this.roots)i.isAttached()||i.isEmpty||(e.remove(e.createRangeIn(i)),t=!0);for(const i of this.model.markers)i.getRange().root.isAttached()||(e.removeMarker(i),t=!0);return t}))}get version(){return this.history.version}set version(e){this.history.version=e}get graveyard(){return this.getRoot(jn)}createRoot(e="$root",t="main"){if(this.roots.get(t))throw new n.CKEditorError("model-document-createroot-name-exists",this,{name:t});const i=new $n(this,e,t);return this.roots.add(i),i}destroy(){this.selection.destroy(),this.stopListening()}getRoot(e="main"){return this.roots.get(e)}getRootNames(e=!1){return this.getRoots(e).map((e=>e.rootName))}getRoots(e=!1){return this.roots.filter((t=>t!=this.graveyard&&(e||t.isAttached())&&t._isLoaded))}registerPostFixer(e){this._postFixers.add(e)}toJSON(){const e=p(this);return e.selection="[engine.model.DocumentSelection]",e.model="[engine.model.Model]",e}_handleChangeBlock(e){this._hasDocumentChangedFromTheLastChangeBlock()&&(this._callPostFixers(e),this.selection.refresh(),this.differ.hasDataChanges()?this.fire("change:data",e.batch):this.fire("change",e.batch),this.selection.refresh(),this.differ.reset()),this._hasSelectionChangedFromTheLastChangeBlock=!1}_hasDocumentChangedFromTheLastChangeBlock(){return!this.differ.isEmpty||this._hasSelectionChangedFromTheLastChangeBlock}_getDefaultRoot(){const e=this.getRoots();return e.length?e[0]:this.graveyard}_getDefaultRange(){const e=this._getDefaultRoot(),t=this.model,i=t.schema,n=t.createPositionFromPath(e,[0]);return i.getNearestSelectionRange(n)||t.createRange(n)}_validateSelectionRange(e){return Kn(e.start)&&Kn(e.end)}_callPostFixers(e){let t=!1;do{for(const i of this._postFixers)if(this.selection.refresh(),t=i(e),t)break}while(t)}}function Kn(e){const t=e.textNode;if(t){const i=t.data,o=e.offset-t.startOffset;return!(0,n.isInsideSurrogatePair)(i,o)&&!(0,n.isInsideCombinedSymbol)(i,o)}return!0}class Gn extends((0,n.EmitterMixin)()){constructor(){super(...arguments),this._markers=new Map}[Symbol.iterator](){return this._markers.values()}has(e){const t=e instanceof Zn?e.name:e;return this._markers.has(t)}get(e){return this._markers.get(e)||null}_set(e,t,i=!1,o=!1){const s=e instanceof Zn?e.name:e;if(s.includes(","))throw new n.CKEditorError("markercollection-incorrect-marker-name",this);const r=this._markers.get(s);if(r){const e=r.getData(),n=r.getRange();let a=!1;return n.isEqual(t)||(r._attachLiveRange($t.fromRange(t)),a=!0),i!=r.managedUsingOperations&&(r._managedUsingOperations=i,a=!0),"boolean"==typeof o&&o!=r.affectsData&&(r._affectsData=o,a=!0),a&&this.fire(`update:${s}`,r,n,t,e),r}const a=$t.fromRange(t),l=new Zn(s,a,i,o);return this._markers.set(s,l),this.fire(`update:${s}`,l,null,t,{...l.getData(),range:null}),l}_remove(e){const t=e instanceof Zn?e.name:e,i=this._markers.get(t);return!!i&&(this._markers.delete(t),this.fire(`update:${t}`,i,i.getRange(),null,i.getData()),this._destroyMarker(i),!0)}_refresh(e){const t=e instanceof Zn?e.name:e,i=this._markers.get(t);if(!i)throw new n.CKEditorError("markercollection-refresh-marker-not-exists",this);const o=i.getRange();this.fire(`update:${t}`,i,o,o,i.getData())}*getMarkersAtPosition(e){for(const t of this)t.getRange().containsPosition(e)&&(yield t)}*getMarkersIntersectingRange(e){for(const t of this)null!==t.getRange().getIntersection(e)&&(yield t)}destroy(){for(const e of this._markers.values())this._destroyMarker(e);this._markers=null,this.stopListening()}*getMarkersGroup(e){for(const t of this._markers.values())t.name.startsWith(e+":")&&(yield t)}_destroyMarker(e){e.stopListening(),e._detachLiveRange()}}class Zn extends((0,n.EmitterMixin)(pt)){constructor(e,t,i,n){super(),this.name=e,this._liveRange=this._attachLiveRange(t),this._managedUsingOperations=i,this._affectsData=n}get managedUsingOperations(){if(!this._liveRange)throw new n.CKEditorError("marker-destroyed",this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new n.CKEditorError("marker-destroyed",this);return this._affectsData}getData(){return{range:this.getRange(),affectsData:this.affectsData,managedUsingOperations:this.managedUsingOperations}}getStart(){if(!this._liveRange)throw new n.CKEditorError("marker-destroyed",this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new n.CKEditorError("marker-destroyed",this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new n.CKEditorError("marker-destroyed",this);return this._liveRange.toRange()}_attachLiveRange(e){return this._liveRange&&this._detachLiveRange(),e.delegate("change:range").to(this),e.delegate("change:content").to(this),this._liveRange=e,e}_detachLiveRange(){this._liveRange.stopDelegating("change:range",this),this._liveRange.stopDelegating("change:content",this),this._liveRange.detach(),this._liveRange=null}}Zn.prototype.is=function(e){return"marker"===e||"model:marker"===e};class Jn extends en{constructor(e,t){super(null),this.sourcePosition=e.clone(),this.howMany=t}get type(){return"detach"}get affectedSelectable(){return null}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e}_validate(){if(this.sourcePosition.root.document)throw new n.CKEditorError("detach-operation-on-document-node",this)}_execute(){nn(St._createFromPositionAndShift(this.sourcePosition,this.howMany))}static get className(){return"DetachOperation"}}class Qn extends pt{constructor(e){super(),this.markers=new Map,this._children=new wt,e&&this._insertChild(0,e)}[Symbol.iterator](){return this.getChildren()}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return 0===this.childCount}get nextSibling(){return null}get previousSibling(){return null}get root(){return this}get parent(){return null}get document(){return null}isAttached(){return!1}getAncestors(){return[]}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}getPath(){return[]}getNodeByPath(e){let t=this;for(const i of e)t=t.getChild(t.offsetToIndex(i));return t}offsetToIndex(e){return this._children.offsetToIndex(e)}toJSON(){const e=[];for(const t of this._children)e.push(t.toJSON());return e}static fromJSON(e){const t=[];for(const i of e)i.name?t.push(yt.fromJSON(i)):t.push(vt.fromJSON(i));return new Qn(t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const i=function(e){return"string"==typeof e?[new vt(e)]:((0,n.isIterable)(e)||(e=[e]),Array.from(e).map((e=>"string"==typeof e?new vt(e):e instanceof _t?new vt(e.data,e.getAttributes()):e)))}(t);for(const e of i)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,i)}_removeChildren(e,t=1){const i=this._children._removeNodes(e,t);for(const e of i)e.parent=null;return i}}Qn.prototype.is=function(e){return"documentFragment"===e||"model:documentFragment"===e};class Yn{constructor(e,t){this.model=e,this.batch=t}createText(e,t){return new vt(e,t)}createElement(e,t){return new yt(e,t)}createDocumentFragment(){return new Qn}cloneElement(e,t=!0){return e._clone(t)}insert(e,t,i=0){if(this._assertWriterUsedCorrectly(),e instanceof vt&&""==e.data)return;const o=At._createAt(t,i);if(e.parent){if(no(e.root,o.root))return void this.move(St._createOn(e),o);if(e.root.document)throw new n.CKEditorError("model-writer-insert-forbidden-move",this);this.remove(e)}const s=o.root.document?o.root.document.version:null,r=new dn(o,e,s);if(e instanceof vt&&(r.shouldReceiveAttributes=!0),this.batch.addOperation(r),this.model.applyOperation(r),e instanceof Qn)for(const[t,i]of e.markers){const e=At._createAt(i.root,0),n={range:new St(i.start._getCombined(e,o),i.end._getCombined(e,o)),usingOperation:!0,affectsData:!0};this.model.markers.has(t)?this.updateMarker(t,n):this.addMarker(t,n)}}insertText(e,t,i,n){t instanceof Qn||t instanceof yt||t instanceof At?this.insert(this.createText(e),t,i):this.insert(this.createText(e,t),i,n)}insertElement(e,t,i,n){t instanceof Qn||t instanceof yt||t instanceof At?this.insert(this.createElement(e),t,i):this.insert(this.createElement(e,t),i,n)}append(e,t){this.insert(e,t,"end")}appendText(e,t,i){t instanceof Qn||t instanceof yt?this.insert(this.createText(e),t,"end"):this.insert(this.createText(e,t),i,"end")}appendElement(e,t,i){t instanceof Qn||t instanceof yt?this.insert(this.createElement(e),t,"end"):this.insert(this.createElement(e,t),i,"end")}setAttribute(e,t,i){if(this._assertWriterUsedCorrectly(),i instanceof St){const n=i.getMinimalFlatRanges();for(const i of n)Xn(this,e,t,i)}else eo(this,e,t,i)}setAttributes(e,t){for(const[i,o]of(0,n.toMap)(e))this.setAttribute(i,o,t)}removeAttribute(e,t){if(this._assertWriterUsedCorrectly(),t instanceof St){const i=t.getMinimalFlatRanges();for(const t of i)Xn(this,e,null,t)}else eo(this,e,null,t)}clearAttributes(e){this._assertWriterUsedCorrectly();const t=e=>{for(const t of e.getAttributeKeys())this.removeAttribute(t,e)};if(e instanceof St)for(const i of e.getItems())t(i);else t(e)}move(e,t,i){if(this._assertWriterUsedCorrectly(),!(e instanceof St))throw new n.CKEditorError("writer-move-invalid-range",this);if(!e.isFlat)throw new n.CKEditorError("writer-move-range-not-flat",this);const o=At._createAt(t,i);if(o.isEqual(e.start))return;if(this._addOperationForAffectedMarkers("move",e),!no(e.root,o.root))throw new n.CKEditorError("writer-move-different-document",this);const s=e.root.document?e.root.document.version:null,r=new cn(e.start,e.end.offset-e.start.offset,o,s);this.batch.addOperation(r),this.model.applyOperation(r)}remove(e){this._assertWriterUsedCorrectly();const t=(e instanceof St?e:St._createOn(e)).getMinimalFlatRanges().reverse();for(const e of t)this._addOperationForAffectedMarkers("move",e),io(e.start,e.end.offset-e.start.offset,this.batch,this.model)}merge(e){this._assertWriterUsedCorrectly();const t=e.nodeBefore,i=e.nodeAfter;if(this._addOperationForAffectedMarkers("merge",e),!(t instanceof yt))throw new n.CKEditorError("writer-merge-no-element-before",this);if(!(i instanceof yt))throw new n.CKEditorError("writer-merge-no-element-after",this);e.root.document?this._merge(e):this._mergeDetached(e)}createPositionFromPath(e,t,i){return this.model.createPositionFromPath(e,t,i)}createPositionAt(e,t){return this.model.createPositionAt(e,t)}createPositionAfter(e){return this.model.createPositionAfter(e)}createPositionBefore(e){return this.model.createPositionBefore(e)}createRange(e,t){return this.model.createRange(e,t)}createRangeIn(e){return this.model.createRangeIn(e)}createRangeOn(e){return this.model.createRangeOn(e)}createSelection(...e){return this.model.createSelection(...e)}_mergeDetached(e){const t=e.nodeBefore,i=e.nodeAfter;this.move(St._createIn(i),At._createAt(t,"end")),this.remove(i)}_merge(e){const t=At._createAt(e.nodeBefore,"end"),i=At._createAt(e.nodeAfter,0),n=e.root.document.graveyard,o=new At(n,[0]),s=e.root.document.version,r=new hn(i,e.nodeAfter.maxOffset,t,o,s);this.batch.addOperation(r),this.model.applyOperation(r)}rename(e,t){if(this._assertWriterUsedCorrectly(),!(e instanceof yt))throw new n.CKEditorError("writer-rename-not-element-instance",this);const i=e.root.document?e.root.document.version:null,o=new bn(At._createBefore(e),e.name,t,i);this.batch.addOperation(o),this.model.applyOperation(o)}split(e,t){this._assertWriterUsedCorrectly();let i,o,s=e.parent;if(!s.parent)throw new n.CKEditorError("writer-split-element-no-parent",this);if(t||(t=s.parent),!e.parent.getAncestors({includeSelf:!0}).includes(t))throw new n.CKEditorError("writer-split-invalid-limit-element",this);do{const t=s.root.document?s.root.document.version:null,n=s.maxOffset-e.offset,r=un.getInsertionPosition(e),a=new un(e,n,r,null,t);this.batch.addOperation(a),this.model.applyOperation(a),i||o||(i=s,o=e.parent.nextSibling),s=(e=this.createPositionAfter(e.parent)).parent}while(s!==t);return{position:e,range:new St(At._createAt(i,"end"),At._createAt(o,0))}}wrap(e,t){if(this._assertWriterUsedCorrectly(),!e.isFlat)throw new n.CKEditorError("writer-wrap-range-not-flat",this);const i=t instanceof yt?t:new yt(t);if(i.childCount>0)throw new n.CKEditorError("writer-wrap-element-not-empty",this);if(null!==i.parent)throw new n.CKEditorError("writer-wrap-element-attached",this);this.insert(i,e.start);const o=new St(e.start.getShiftedBy(1),e.end.getShiftedBy(1));this.move(o,At._createAt(i,0))}unwrap(e){if(this._assertWriterUsedCorrectly(),null===e.parent)throw new n.CKEditorError("writer-unwrap-element-no-parent",this);this.move(St._createIn(e),this.createPositionAfter(e)),this.remove(e)}addMarker(e,t){if(this._assertWriterUsedCorrectly(),!t||"boolean"!=typeof t.usingOperation)throw new n.CKEditorError("writer-addmarker-no-usingoperation",this);const i=t.usingOperation,o=t.range,s=void 0!==t.affectsData&&t.affectsData;if(this.model.markers.has(e))throw new n.CKEditorError("writer-addmarker-marker-exists",this);if(!o)throw new n.CKEditorError("writer-addmarker-no-range",this);return i?(to(this,e,null,o,s),this.model.markers.get(e)):this.model.markers._set(e,o,i,s)}updateMarker(e,t){this._assertWriterUsedCorrectly();const i="string"==typeof e?e:e.name,o=this.model.markers.get(i);if(!o)throw new n.CKEditorError("writer-updatemarker-marker-not-exists",this);if(!t)return(0,n.logWarning)("writer-updatemarker-reconvert-using-editingcontroller",{markerName:i}),void this.model.markers._refresh(o);const s="boolean"==typeof t.usingOperation,r="boolean"==typeof t.affectsData,a=r?t.affectsData:o.affectsData;if(!s&&!t.range&&!r)throw new n.CKEditorError("writer-updatemarker-wrong-options",this);const l=o.getRange(),c=t.range?t.range:l;s&&t.usingOperation!==o.managedUsingOperations?t.usingOperation?to(this,i,null,c,a):(to(this,i,l,null,a),this.model.markers._set(i,c,void 0,a)):o.managedUsingOperations?to(this,i,l,c,a):this.model.markers._set(i,c,void 0,a)}removeMarker(e){this._assertWriterUsedCorrectly();const t="string"==typeof e?e:e.name;if(!this.model.markers.has(t))throw new n.CKEditorError("writer-removemarker-no-marker",this);const i=this.model.markers.get(t);i.managedUsingOperations?to(this,t,i.getRange(),null,i.affectsData):this.model.markers._remove(t)}addRoot(e,t="$root"){this._assertWriterUsedCorrectly();const i=this.model.document.getRoot(e);if(i&&i.isAttached())throw new n.CKEditorError("writer-addroot-root-exists",this);const o=this.model.document,s=new vn(e,t,!0,o,o.version);return this.batch.addOperation(s),this.model.applyOperation(s),this.model.document.getRoot(e)}detachRoot(e){this._assertWriterUsedCorrectly();const t="string"==typeof e?this.model.document.getRoot(e):e;if(!t||!t.isAttached())throw new n.CKEditorError("writer-detachroot-no-root",this);for(const e of this.model.markers)e.getRange().root===t&&this.removeMarker(e);for(const e of t.getAttributeKeys())this.removeAttribute(e,t);this.remove(this.createRangeIn(t));const i=this.model.document,o=new vn(t.rootName,t.name,!1,i,i.version);this.batch.addOperation(o),this.model.applyOperation(o)}setSelection(...e){this._assertWriterUsedCorrectly(),this.model.document.selection._setTo(...e)}setSelectionFocus(e,t){this._assertWriterUsedCorrectly(),this.model.document.selection._setFocus(e,t)}setSelectionAttribute(e,t){if(this._assertWriterUsedCorrectly(),"string"==typeof e)this._setSelectionAttribute(e,t);else for(const[t,i]of(0,n.toMap)(e))this._setSelectionAttribute(t,i)}removeSelectionAttribute(e){if(this._assertWriterUsedCorrectly(),"string"==typeof e)this._removeSelectionAttribute(e);else for(const t of e)this._removeSelectionAttribute(t)}overrideSelectionGravity(){return this.model.document.selection._overrideGravity()}restoreSelectionGravity(e){this.model.document.selection._restoreGravity(e)}_setSelectionAttribute(e,t){const i=this.model.document.selection;if(i.isCollapsed&&i.anchor.parent.isEmpty){const n=Gt._getStoreAttributeKey(e);this.setAttribute(n,t,i.anchor.parent)}i._setAttribute(e,t)}_removeSelectionAttribute(e){const t=this.model.document.selection;if(t.isCollapsed&&t.anchor.parent.isEmpty){const i=Gt._getStoreAttributeKey(e);this.removeAttribute(i,t.anchor.parent)}t._removeAttribute(e)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new n.CKEditorError("writer-incorrect-use",this)}_addOperationForAffectedMarkers(e,t){for(const i of this.model.markers){if(!i.managedUsingOperations)continue;const n=i.getRange();let o=!1;if("move"===e){const e=t;o=e.containsPosition(n.start)||e.start.isEqual(n.start)||e.containsPosition(n.end)||e.end.isEqual(n.end)}else{const e=t,i=e.nodeBefore,s=e.nodeAfter,r=n.start.parent==i&&n.start.isAtEnd,a=n.end.parent==s&&0==n.end.offset,l=n.end.nodeAfter==s,c=n.start.nodeAfter==s;o=r||a||l||c}o&&this.updateMarker(i.name,{range:n})}}}function Xn(e,t,i,n){const o=e.model,s=o.document;let r,a,l,c=n.start;for(const e of n.getWalker({shallow:!0}))l=e.item.getAttribute(t),r&&a!=l&&(a!=i&&d(),c=r),r=e.nextPosition,a=l;function d(){const n=new St(c,r),l=n.root.document?s.version:null,d=new fn(n,t,a,i,l);e.batch.addOperation(d),o.applyOperation(d)}r instanceof At&&r!=c&&a!=i&&d()}function eo(e,t,i,n){const o=e.model,s=o.document,r=n.getAttribute(t);let a,l;if(r!=i){if(n.root===n){const e=n.document?s.version:null;l=new wn(n,t,r,i,e)}else{a=new St(At._createBefore(n),e.createPositionAfter(n));const o=a.root.document?s.version:null;l=new fn(a,t,r,i,o)}e.batch.addOperation(l),o.applyOperation(l)}}function to(e,t,i,n,o){const s=e.model,r=s.document,a=new mn(t,i,n,s.markers,!!o,r.version);e.batch.addOperation(a),s.applyOperation(a)}function io(e,t,i,n){let o;if(e.root.document){const i=n.document,s=new At(i.graveyard,[0]);o=new cn(e,t,s,i.version)}else o=new Jn(e,t);i.addOperation(o),n.applyOperation(o)}function no(e,t){return e===t||e instanceof $n&&t instanceof $n}function oo(e,t,i={}){if(t.isCollapsed)return;const n=t.getFirstRange();if("$graveyard"==n.root.rootName)return;const o=e.schema;e.change((e=>{if(!i.doNotResetEntireContent&&function(e,t){const i=e.getLimitElement(t);if(!t.containsEntireContent(i))return!1;const n=t.getFirstRange();return n.start.parent!=n.end.parent&&e.checkChild(i,"paragraph")}(o,t))return void function(e,t){const i=e.model.schema.getLimitElement(t);e.remove(e.createRangeIn(i)),lo(e,e.createPositionAt(i,0),t)}(e,t);const s={};if(!i.doNotAutoparagraph){const e=t.getSelectedElement();e&&Object.assign(s,o.getAttributesWithProperty(e,"copyOnReplace",!0))}const[r,a]=function(e){const t=e.root.document.model,i=e.start;let n=e.end;if(t.hasContent(e,{ignoreMarkers:!0})){const i=function(e){const t=e.parent,i=t.root.document.model.schema,n=t.getAncestors({parentFirst:!0,includeSelf:!0});for(const e of n){if(i.isLimit(e))return null;if(i.isBlock(e))return e}}(n);if(i&&n.isTouching(t.createPositionAt(i,0))){const i=t.createSelection(e);t.modifySelection(i,{direction:"backward"});const o=i.getLastPosition(),s=t.createRange(o,n);t.hasContent(s,{ignoreMarkers:!0})||(n=o)}}return[Bn.fromPosition(i,"toPrevious"),Bn.fromPosition(n,"toNext")]}(n);r.isTouching(a)||e.remove(e.createRange(r,a)),i.leaveUnmerged||(function(e,t,i){const n=e.model;if(!ao(e.model.schema,t,i))return;const[o,s]=function(e,t){const i=e.getAncestors(),n=t.getAncestors();let o=0;for(;i[o]&&i[o]==n[o];)o++;return[i[o],n[o]]}(t,i);o&&s&&(!n.hasContent(o,{ignoreMarkers:!0})&&n.hasContent(s,{ignoreMarkers:!0})?ro(e,t,i,o.parent):so(e,t,i,o.parent))}(e,r,a),o.removeDisallowedAttributes(r.parent.getChildren(),e)),co(e,t,r),!i.doNotAutoparagraph&&function(e,t){const i=e.checkChild(t,"$text"),n=e.checkChild(t,"paragraph");return!i&&n}(o,r)&&lo(e,r,t,s),r.detach(),a.detach()}))}function so(e,t,i,n){const o=t.parent,s=i.parent;if(o!=n&&s!=n){for(t=e.createPositionAfter(o),(i=e.createPositionBefore(s)).isEqual(t)||e.insert(s,t),e.merge(t);i.parent.isEmpty;){const t=i.parent;i=e.createPositionBefore(t),e.remove(t)}ao(e.model.schema,t,i)&&so(e,t,i,n)}}function ro(e,t,i,n){const o=t.parent,s=i.parent;if(o!=n&&s!=n){for(t=e.createPositionAfter(o),(i=e.createPositionBefore(s)).isEqual(t)||e.insert(o,i);t.parent.isEmpty;){const i=t.parent;t=e.createPositionBefore(i),e.remove(i)}i=e.createPositionBefore(s),function(e,t){const i=t.nodeBefore,n=t.nodeAfter;i.name!=n.name&&e.rename(i,n.name),e.clearAttributes(i),e.setAttributes(Object.fromEntries(n.getAttributes()),i),e.merge(t)}(e,i),ao(e.model.schema,t,i)&&ro(e,t,i,n)}}function ao(e,t,i){const n=t.parent,o=i.parent;return n!=o&&!e.isLimit(n)&&!e.isLimit(o)&&function(e,t,i){const n=new St(e,t);for(const e of n.getWalker())if(i.isLimit(e.item))return!1;return!0}(t,i,e)}function lo(e,t,i,n={}){const o=e.createElement("paragraph");e.model.schema.setAllowedAttributes(o,n,e),e.insert(o,t),co(e,i,e.createPositionAt(o,0))}function co(e,t,i){t instanceof Gt?e.setSelection(i):t.setTo(i)}function uo(e,t){const i=[];Array.from(e.getItems({direction:"backward"})).map((e=>t.createRangeOn(e))).filter((t=>(t.start.isAfter(e.start)||t.start.isEqual(e.start))&&(t.end.isBefore(e.end)||t.end.isEqual(e.end)))).forEach((e=>{i.push(e.start.parent),t.remove(e)})),i.forEach((e=>{let i=e;for(;i.parent&&i.isEmpty;){const e=t.createRangeOn(i);i=i.parent,t.remove(e)}}))}class ho{constructor(e,t,i){this._firstNode=null,this._lastNode=null,this._lastAutoParagraph=null,this._filterAttributesOf=[],this._affectedStart=null,this._affectedEnd=null,this._nodeToSelect=null,this.model=e,this.writer=t,this.position=i,this.canMergeWith=new Set([this.position.parent]),this.schema=e.schema,this._documentFragment=t.createDocumentFragment(),this._documentFragmentPosition=t.createPositionAt(this._documentFragment,0)}handleNodes(e){for(const t of Array.from(e))this._handleNode(t);this._insertPartialFragment(),this._lastAutoParagraph&&this._updateLastNodeFromAutoParagraph(this._lastAutoParagraph),this._mergeOnRight(),this.schema.removeDisallowedAttributes(this._filterAttributesOf,this.writer),this._filterAttributesOf=[]}_updateLastNodeFromAutoParagraph(e){const t=this.writer.createPositionAfter(this._lastNode),i=this.writer.createPositionAfter(e);if(i.isAfter(t)){if(this._lastNode=e,this.position.parent!=e||!this.position.isAtEnd)throw new n.CKEditorError("insertcontent-invalid-insertion-position",this);this.position=i,this._setAffectedBoundaries(this.position)}}getSelectionRange(){return this._nodeToSelect?St._createOn(this._nodeToSelect):this.model.schema.getNearestSelectionRange(this.position)}getAffectedRange(){return this._affectedStart?new St(this._affectedStart,this._affectedEnd):null}destroy(){this._affectedStart&&this._affectedStart.detach(),this._affectedEnd&&this._affectedEnd.detach()}_handleNode(e){this._checkAndSplitToAllowedPosition(e)?(this._appendToFragment(e),this._firstNode||(this._firstNode=e),this._lastNode=e):this.schema.isObject(e)||this._handleDisallowedNode(e)}_insertPartialFragment(){if(this._documentFragment.isEmpty)return;const e=Bn.fromPosition(this.position,"toNext");this._setAffectedBoundaries(this.position),this._documentFragment.getChild(0)==this._firstNode&&(this.writer.insert(this._firstNode,this.position),this._mergeOnLeft(),this.position=e.toPosition()),this._documentFragment.isEmpty||this.writer.insert(this._documentFragment,this.position),this._documentFragmentPosition=this.writer.createPositionAt(this._documentFragment,0),this.position=e.toPosition(),e.detach()}_handleDisallowedNode(e){e.is("element")&&this.handleNodes(e.getChildren())}_appendToFragment(e){if(!this.schema.checkChild(this.position,e))throw new n.CKEditorError("insertcontent-wrong-position",this,{node:e,position:this.position});this.writer.insert(e,this._documentFragmentPosition),this._documentFragmentPosition=this._documentFragmentPosition.getShiftedBy(e.offsetSize),this.schema.isObject(e)&&!this.schema.checkChild(this.position,"$text")?this._nodeToSelect=e:this._nodeToSelect=null,this._filterAttributesOf.push(e)}_setAffectedBoundaries(e){this._affectedStart||(this._affectedStart=Bn.fromPosition(e,"toPrevious")),this._affectedEnd&&!this._affectedEnd.isBefore(e)||(this._affectedEnd&&this._affectedEnd.detach(),this._affectedEnd=Bn.fromPosition(e,"toNext"))}_mergeOnLeft(){const e=this._firstNode;if(!(e instanceof yt))return;if(!this._canMergeLeft(e))return;const t=Bn._createBefore(e);t.stickiness="toNext";const i=Bn.fromPosition(this.position,"toNext");this._affectedStart.isEqual(t)&&(this._affectedStart.detach(),this._affectedStart=Bn._createAt(t.nodeBefore,"end","toPrevious")),this._firstNode===this._lastNode&&(this._firstNode=t.nodeBefore,this._lastNode=t.nodeBefore),this.writer.merge(t),t.isEqual(this._affectedEnd)&&this._firstNode===this._lastNode&&(this._affectedEnd.detach(),this._affectedEnd=Bn._createAt(t.nodeBefore,"end","toNext")),this.position=i.toPosition(),i.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_mergeOnRight(){const e=this._lastNode;if(!(e instanceof yt))return;if(!this._canMergeRight(e))return;const t=Bn._createAfter(e);if(t.stickiness="toNext",!this.position.isEqual(t))throw new n.CKEditorError("insertcontent-invalid-insertion-position",this);this.position=At._createAt(t.nodeBefore,"end");const i=Bn.fromPosition(this.position,"toPrevious");this._affectedEnd.isEqual(t)&&(this._affectedEnd.detach(),this._affectedEnd=Bn._createAt(t.nodeBefore,"end","toNext")),this._firstNode===this._lastNode&&(this._firstNode=t.nodeBefore,this._lastNode=t.nodeBefore),this.writer.merge(t),t.getShiftedBy(-1).isEqual(this._affectedStart)&&this._firstNode===this._lastNode&&(this._affectedStart.detach(),this._affectedStart=Bn._createAt(t.nodeBefore,0,"toPrevious")),this.position=i.toPosition(),i.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_canMergeLeft(e){const t=e.previousSibling;return t instanceof yt&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(t,e)}_canMergeRight(e){const t=e.nextSibling;return t instanceof yt&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(e,t)}_insertAutoParagraph(){this._insertPartialFragment();const e=this.writer.createElement("paragraph");this.writer.insert(e,this.position),this._setAffectedBoundaries(this.position),this._lastAutoParagraph=e,this.position=this.writer.createPositionAt(e,0)}_checkAndSplitToAllowedPosition(e){const t=this._getAllowedIn(this.position.parent,e);if(!t)return!1;for(t!=this.position.parent&&this._insertPartialFragment();t!=this.position.parent;)if(this.position.isAtStart){const e=this.position.parent;this.position=this.writer.createPositionBefore(e),e.isEmpty&&e.parent===t&&this.writer.remove(e)}else if(this.position.isAtEnd)this.position=this.writer.createPositionAfter(this.position.parent);else{const e=this.writer.createPositionAfter(this.position.parent);this._setAffectedBoundaries(this.position),this.writer.split(this.position),this.position=e,this.canMergeWith.add(this.position.nodeAfter)}return this.schema.checkChild(this.position.parent,e)||this._insertAutoParagraph(),!0}_getAllowedIn(e,t){return this.schema.checkChild(e,t)||this.schema.checkChild(e,"paragraph")&&this.schema.checkChild("paragraph",t)?e:this.schema.isLimit(e)?null:this._getAllowedIn(e.parent,t)}}const mo=' ,.?!:;"-()';function go(e,t){const{isForward:i,walker:o,unit:s,schema:r,treatEmojiAsSingleUnit:a}=e,{type:l,item:c,nextPosition:d}=t;if("text"==l)return"word"===e.unit?function(e,t){let i=e.position.textNode;for(i||(i=t?e.position.nodeAfter:e.position.nodeBefore);i&&i.is("$text");){const n=e.position.offset-i.startOffset;if(bo(i,n,t))i=t?e.position.nodeAfter:e.position.nodeBefore;else{if(po(i.data,n,t))break;e.next()}}return e.position}(o,i):function(e,t,i){const o=e.position.textNode;if(o){const s=o.data;let r=e.position.offset-o.startOffset;for(;(0,n.isInsideSurrogatePair)(s,r)||"character"==t&&(0,n.isInsideCombinedSymbol)(s,r)||i&&(0,n.isInsideEmojiSequence)(s,r);)e.next(),r=e.position.offset-o.startOffset}return e.position}(o,s,a);if(l==(i?"elementStart":"elementEnd")){if(r.isSelectable(c))return At._createAt(c,i?"after":"before");if(r.checkChild(d,"$text"))return d}else{if(r.isLimit(c))return void o.skip((()=>!0));if(r.checkChild(d,"$text"))return d}}function fo(e,t){const i=e.root,n=At._createAt(i,t?"end":0);return t?new St(e,n):new St(n,e)}function po(e,t,i){const n=t+(i?0:-1);return mo.includes(e.charAt(n))}function bo(e,t,i){return t===(i?e.offsetSize:0)}class wo extends((0,n.ObservableMixin)()){constructor(){var e;super(),this.markers=new Gn,this.document=new qn(this),this.schema=new Vi,this._pendingChanges=[],this._currentWriter=null,["deleteContent","modifySelection","getSelectedContent","applyOperation"].forEach((e=>this.decorate(e))),this.on("applyOperation",((e,t)=>{t[0]._validate()}),{priority:"highest"}),this.schema.register("$root",{isLimit:!0}),this.schema.register("$container",{allowIn:["$root","$container"]}),this.schema.register("$block",{allowIn:["$root","$container"],isBlock:!0}),this.schema.register("$blockObject",{allowWhere:"$block",isBlock:!0,isObject:!0}),this.schema.register("$inlineObject",{allowWhere:"$text",allowAttributesOf:"$text",isInline:!0,isObject:!0}),this.schema.register("$text",{allowIn:"$block",isInline:!0,isContent:!0}),this.schema.register("$clipboardHolder",{allowContentOf:"$root",allowChildren:"$text",isLimit:!0}),this.schema.register("$documentFragment",{allowContentOf:"$root",allowChildren:"$text",isLimit:!0}),this.schema.register("$marker"),this.schema.addChildCheck((()=>!0),"$marker"),(e=this).document.registerPostFixer((t=>function(e,t){const i=t.document.selection,n=t.schema,o=[];let s=!1;for(const e of i.getRanges()){const t=Ai(e,n);t&&!t.isEqual(e)?(o.push(t),s=!0):o.push(e)}return s&&e.setSelection(function(e){const t=[...e],i=new Set;let n=1;for(;n<t.length;){const e=t[n],o=t.slice(0,n);for(const[s,r]of o.entries())if(!i.has(s))if(e.isEqual(r))i.add(s);else if(e.isIntersecting(r)){i.add(s),i.add(n);const o=e.getJoined(r);t.push(o)}n++}return t.filter(((e,t)=>!i.has(t)))}(o),{backward:i.isBackward}),!1}(t,e))),this.document.registerPostFixer(gi),this.on("insertContent",((e,[t,i])=>{e.return=function(e,t,i){return e.change((n=>{const o=i||e.document.selection;o.isCollapsed||e.deleteContent(o,{doNotAutoparagraph:!0});const s=new ho(e,n,o.anchor),r=[];let a;if(t.is("documentFragment")){if(t.markers.size){const e=[];for(const[i,n]of t.markers){const{start:t,end:o}=n,s=t.isEqual(o);e.push({position:t,name:i,isCollapsed:s},{position:o,name:i,isCollapsed:s})}e.sort((({position:e},{position:t})=>e.isBefore(t)?1:-1));for(const{position:i,name:o,isCollapsed:s}of e){let e=null,a=null;const l=i.parent===t&&i.isAtStart,c=i.parent===t&&i.isAtEnd;l||c?s&&(a=l?"start":"end"):(e=n.createElement("$marker"),n.insert(e,i)),r.push({name:o,element:e,collapsed:a})}}a=t.getChildren()}else a=[t];s.handleNodes(a);let l=s.getSelectionRange();if(t.is("documentFragment")&&r.length){const e=l?$t.fromRange(l):null,t={};for(let e=r.length-1;e>=0;e--){const{name:i,element:o,collapsed:a}=r[e],l=!t[i];if(l&&(t[i]=[]),o){const e=n.createPositionAt(o,"before");t[i].push(e),n.remove(o)}else{const e=s.getAffectedRange();if(!e){a&&t[i].push(s.position);continue}a?t[i].push(e[a]):t[i].push(l?e.start:e.end)}}for(const[e,[i,o]]of Object.entries(t))i&&o&&i.root===o.root&&i.root.document&&!n.model.markers.has(e)&&n.addMarker(e,{usingOperation:!0,affectsData:!0,range:new St(i,o)});e&&(l=e.toRange(),e.detach())}l&&(o instanceof Gt?n.setSelection(l):o.setTo(l));const c=s.getAffectedRange()||e.createRange(o.anchor);return s.destroy(),c}))}(this,t,i)})),this.on("insertObject",((e,[t,i,o])=>{e.return=function(e,t,i,o={}){if(!e.schema.isObject(t))throw new n.CKEditorError("insertobject-element-not-an-object",e,{object:t});const s=i||e.document.selection;let r=s;o.findOptimalPosition&&e.schema.isBlock(t)&&(r=e.createSelection(e.schema.findOptimalInsertionRange(s,o.findOptimalPosition)));const a=(0,n.first)(s.getSelectedBlocks()),l={};return a&&Object.assign(l,e.schema.getAttributesWithProperty(a,"copyOnReplace",!0)),e.change((i=>{r.isCollapsed||e.deleteContent(r,{doNotAutoparagraph:!0});let s=t;const a=r.anchor.parent;!e.schema.checkChild(a,t)&&e.schema.checkChild(a,"paragraph")&&e.schema.checkChild("paragraph",t)&&(s=i.createElement("paragraph"),i.insert(t,s)),e.schema.setAllowedAttributes(s,l,i);const c=e.insertContent(s,r);return c.isCollapsed||o.setSelection&&function(e,t,i,o){const s=e.model;if("on"==i)return void e.setSelection(t,"on");if("after"!=i)throw new n.CKEditorError("insertobject-invalid-place-parameter-value",s);let r=t.nextSibling;s.schema.isInline(t)?e.setSelection(t,"after"):(!(r&&s.schema.checkChild(r,"$text"))&&s.schema.checkChild(t.parent,"paragraph")&&(r=e.createElement("paragraph"),s.schema.setAllowedAttributes(r,o,e),s.insertContent(r,e.createPositionAfter(t))),r&&e.setSelection(r,0))}(i,t,o.setSelection,l),c}))}(this,t,i,o)})),this.on("canEditAt",(e=>{const t=!this.document.isReadOnly;e.return=t,t||e.stop()}))}change(e){try{return 0===this._pendingChanges.length?(this._pendingChanges.push({batch:new Ln,callback:e}),this._runPendingChanges()[0]):e(this._currentWriter)}catch(e){n.CKEditorError.rethrowUnexpectedError(e,this)}}enqueueChange(e,t){try{e?"function"==typeof e?(t=e,e=new Ln):e instanceof Ln||(e=new Ln(e)):e=new Ln,this._pendingChanges.push({batch:e,callback:t}),1==this._pendingChanges.length&&this._runPendingChanges()}catch(e){n.CKEditorError.rethrowUnexpectedError(e,this)}}applyOperation(e){e._execute()}insertContent(e,t,i,...n){const o=vo(t,i);return this.fire("insertContent",[e,o,i,...n])}insertObject(e,t,i,n,...o){const s=vo(t,i);return this.fire("insertObject",[e,s,n,n,...o])}deleteContent(e,t){oo(this,e,t)}modifySelection(e,t){!function(e,t,i={}){const n=e.schema,o="backward"!=i.direction,s=i.unit?i.unit:"character",r=!!i.treatEmojiAsSingleUnit,a=t.focus,l=new kt({boundaries:fo(a,o),singleCharacters:!0,direction:o?"forward":"backward"}),c={walker:l,schema:n,isForward:o,unit:s,treatEmojiAsSingleUnit:r};let d;for(;d=l.next();){if(d.done)return;const i=go(c,d.value);if(i)return void(t instanceof Gt?e.change((e=>{e.setSelectionFocus(i)})):t.setFocus(i))}}(this,e,t)}getSelectedContent(e){return function(e,t){return e.change((e=>{const i=e.createDocumentFragment(),n=t.getFirstRange();if(!n||n.isCollapsed)return i;const o=n.start.root,s=n.start.getCommonPath(n.end),r=o.getNodeByPath(s);let a;a=n.start.parent==n.end.parent?n:e.createRange(e.createPositionAt(r,n.start.path[s.length]),e.createPositionAt(r,n.end.path[s.length]+1));const l=a.end.offset-a.start.offset;for(const t of a.getItems({shallow:!0}))t.is("$textProxy")?e.appendText(t.data,t.getAttributes(),i):e.append(e.cloneElement(t,!0),i);if(a!=n){const t=n._getTransformedByMove(a.start,e.createPositionAt(i,0),l)[0],o=e.createRange(e.createPositionAt(i,0),t.start);uo(e.createRange(t.end,e.createPositionAt(i,"end")),e),uo(o,e)}return i}))}(this,e)}hasContent(e,t={}){const i=e instanceof St?e:St._createIn(e);if(i.isCollapsed)return!1;const{ignoreWhitespaces:n=!1,ignoreMarkers:o=!1}=t;if(!o)for(const e of this.markers.getMarkersIntersectingRange(i))if(e.affectsData)return!0;for(const e of i.getItems())if(this.schema.isContent(e)){if(!e.is("$textProxy"))return!0;if(!n)return!0;if(-1!==e.data.search(/\S/))return!0}return!1}canEditAt(e){const t=vo(e);return this.fire("canEditAt",[t])}createPositionFromPath(e,t,i){return new At(e,t,i)}createPositionAt(e,t){return At._createAt(e,t)}createPositionAfter(e){return At._createAfter(e)}createPositionBefore(e){return At._createBefore(e)}createRange(e,t){return new St(e,t)}createRangeIn(e){return St._createIn(e)}createRangeOn(e){return St._createOn(e)}createSelection(...e){return new Ft(...e)}createBatch(e){return new Ln(e)}createOperationFromJSON(e){return yn.fromJSON(e,this.document)}destroy(){this.document.destroy(),this.stopListening()}_runPendingChanges(){const e=[];this.fire("_beforeChanges");try{for(;this._pendingChanges.length;){const t=this._pendingChanges[0].batch;this._currentWriter=new Yn(this,t);const i=this._pendingChanges[0].callback(this._currentWriter);e.push(i),this.document._handleChangeBlock(this._currentWriter),this._pendingChanges.shift(),this._currentWriter=null}}finally{this._pendingChanges.length=0,this._currentWriter=null,this.fire("_afterChanges")}return e}}function vo(e,t){if(e)return e instanceof Ft||e instanceof Gt?e:e instanceof bt?t||0===t?new Ft(e,t):e.is("rootElement")?new Ft(e,"in"):new Ft(e,"on"):new Ft(e)}class _o extends Xe{constructor(){super(...arguments),this.domEventType="click"}onDomEvent(e){this.fire(e.type,e)}}class yo extends Xe{constructor(){super(...arguments),this.domEventType=["mousedown","mouseup","mouseover","mouseout"]}onDomEvent(e){this.fire(e.type,e)}}class ko{constructor(e){this.document=e}createDocumentFragment(e){return new pe(this.document,e)}createElement(e,t,i){return new D(this.document,e,t,i)}createText(e){return new w(this.document,e)}clone(e,t=!1){return e._clone(t)}appendChild(e,t){return t._appendChild(e)}insertChild(e,t,i){return i._insertChild(e,t)}removeChildren(e,t,i){return i._removeChildren(e,t)}remove(e){const t=e.parent;return t?this.removeChildren(t.getChildIndex(e),1,t):[]}replace(e,t){const i=e.parent;if(i){const n=i.getChildIndex(e);return this.removeChildren(n,1,i),this.insertChild(n,t,i),!0}return!1}unwrapElement(e){const t=e.parent;if(t){const i=t.getChildIndex(e);this.remove(e),this.insertChild(i,e.getChildren(),t)}}rename(e,t){const i=new D(this.document,e,t.getAttributes(),t.getChildren());return this.replace(t,i)?i:null}setAttribute(e,t,i){i._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,i){(0,_.A)(e)&&void 0===i?t._setStyle(e):i._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,i){i._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}createPositionAt(e,t){return K._createAt(e,t)}createPositionAfter(e){return K._createAfter(e)}createPositionBefore(e){return K._createBefore(e)}createRange(e,t){return new G(e,t)}createRangeOn(e){return G._createOn(e)}createRangeIn(e){return G._createIn(e)}createSelection(...e){return new J(...e)}}const Co=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,Ao=/^rgb\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}[0-9]{1,3}[ %]?\)$/i,Eo=/^rgba\([ ]?([0-9]{1,3}[ %]?,[ ]?){3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,xo=/^hsl\([ ]?([0-9]{1,3}[ %]?[,]?[ ]*){3}(1|[0-9]+%|[0]?\.?[0-9]+)?\)$/i,To=/^hsla\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,Po=/\w+\((?:[^()]|\([^()]*\))*\)|\S+/gi,Io=new Set(["black","silver","gray","white","maroon","red","purple","fuchsia","green","lime","olive","yellow","navy","blue","teal","aqua","orange","aliceblue","antiquewhite","aquamarine","azure","beige","bisque","blanchedalmond","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","gainsboro","ghostwhite","gold","goldenrod","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","limegreen","linen","magenta","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","oldlace","olivedrab","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","thistle","tomato","turquoise","violet","wheat","whitesmoke","yellowgreen","activeborder","activecaption","appworkspace","background","buttonface","buttonhighlight","buttonshadow","buttontext","captiontext","graytext","highlight","highlighttext","inactiveborder","inactivecaption","inactivecaptiontext","infobackground","infotext","menu","menutext","scrollbar","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","window","windowframe","windowtext","rebeccapurple","currentcolor","transparent"]);function So(e){return e.startsWith("#")?Co.test(e):e.startsWith("rgb")?Ao.test(e)||Eo.test(e):e.startsWith("hsl")?xo.test(e)||To.test(e):Io.has(e.toLowerCase())}const Vo=["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset"];function Ro(e){return Vo.includes(e)}const Bo=/^([+-]?[0-9]*([.][0-9]+)?(px|cm|mm|in|pc|pt|ch|em|ex|rem|vh|vw|vmin|vmax)|0)$/;function Mo(e){return Bo.test(e)}const Oo=/^[+-]?[0-9]*([.][0-9]+)?%$/;function Lo(e){return Oo.test(e)}const Fo=["repeat-x","repeat-y","repeat","space","round","no-repeat"];function No(e){return Fo.includes(e)}const Do=["center","top","bottom","left","right"];function zo(e){return Do.includes(e)}const Wo=["fixed","scroll","local"];function Ho(e){return Wo.includes(e)}const Uo=/^url\(/;function $o(e){return Uo.test(e)}function jo(e=""){if(""===e)return{top:void 0,right:void 0,bottom:void 0,left:void 0};const t=Zo(e),i=t[0],n=t[2]||i,o=t[1]||i;return{top:i,bottom:n,right:o,left:t[3]||o}}function qo(e){return t=>{const{top:i,right:n,bottom:o,left:s}=t,r=[];return[i,n,s,o].every((e=>!!e))?r.push([e,Ko(t)]):(i&&r.push([e+"-top",i]),n&&r.push([e+"-right",n]),o&&r.push([e+"-bottom",o]),s&&r.push([e+"-left",s])),r}}function Ko({top:e,right:t,bottom:i,left:n}){const o=[];return n!==t?o.push(e,t,i,n):i!==e?o.push(e,t,i):t!==e?o.push(e,t):o.push(e),o.join(" ")}function Go(e){return t=>({path:e,value:jo(t)})}function Zo(e){const t=e.matchAll(Po);return Array.from(t).map((e=>e[0]))}function Jo(e){e.setNormalizer("background",(e=>{const t={},i=Zo(e);for(const e of i)No(e)?(t.repeat=t.repeat||[],t.repeat.push(e)):zo(e)?(t.position=t.position||[],t.position.push(e)):Ho(e)?t.attachment=e:So(e)?t.color=e:$o(e)&&(t.image=e);return{path:"background",value:t}})),e.setNormalizer("background-color",(e=>({path:"background.color",value:e}))),e.setReducer("background",(e=>{const t=[];return t.push(["background-color",e.color]),t})),e.setStyleRelation("background",["background-color"])}function Qo(e){e.setNormalizer("border",(e=>{const{color:t,style:i,width:n}=os(e);return{path:"border",value:{color:jo(t),style:jo(i),width:jo(n)}}})),e.setNormalizer("border-top",Yo("top")),e.setNormalizer("border-right",Yo("right")),e.setNormalizer("border-bottom",Yo("bottom")),e.setNormalizer("border-left",Yo("left")),e.setNormalizer("border-color",Xo("color")),e.setNormalizer("border-width",Xo("width")),e.setNormalizer("border-style",Xo("style")),e.setNormalizer("border-top-color",ts("color","top")),e.setNormalizer("border-top-style",ts("style","top")),e.setNormalizer("border-top-width",ts("width","top")),e.setNormalizer("border-right-color",ts("color","right")),e.setNormalizer("border-right-style",ts("style","right")),e.setNormalizer("border-right-width",ts("width","right")),e.setNormalizer("border-bottom-color",ts("color","bottom")),e.setNormalizer("border-bottom-style",ts("style","bottom")),e.setNormalizer("border-bottom-width",ts("width","bottom")),e.setNormalizer("border-left-color",ts("color","left")),e.setNormalizer("border-left-style",ts("style","left")),e.setNormalizer("border-left-width",ts("width","left")),e.setExtractor("border-top",is("top")),e.setExtractor("border-right",is("right")),e.setExtractor("border-bottom",is("bottom")),e.setExtractor("border-left",is("left")),e.setExtractor("border-top-color","border.color.top"),e.setExtractor("border-right-color","border.color.right"),e.setExtractor("border-bottom-color","border.color.bottom"),e.setExtractor("border-left-color","border.color.left"),e.setExtractor("border-top-width","border.width.top"),e.setExtractor("border-right-width","border.width.right"),e.setExtractor("border-bottom-width","border.width.bottom"),e.setExtractor("border-left-width","border.width.left"),e.setExtractor("border-top-style","border.style.top"),e.setExtractor("border-right-style","border.style.right"),e.setExtractor("border-bottom-style","border.style.bottom"),e.setExtractor("border-left-style","border.style.left"),e.setReducer("border-color",qo("border-color")),e.setReducer("border-style",qo("border-style")),e.setReducer("border-width",qo("border-width")),e.setReducer("border-top",ss("top")),e.setReducer("border-right",ss("right")),e.setReducer("border-bottom",ss("bottom")),e.setReducer("border-left",ss("left")),e.setReducer("border",function(){return t=>{const i=ns(t,"top"),n=ns(t,"right"),o=ns(t,"bottom"),s=ns(t,"left"),r=[i,n,o,s],a={width:e(r,"width"),style:e(r,"style"),color:e(r,"color")},l=rs(a,"all");if(l.length)return l;const c=Object.entries(a).reduce(((e,[t,i])=>(i&&(e.push([`border-${t}`,i]),r.forEach((e=>delete e[t]))),e)),[]);return[...c,...rs(i,"top"),...rs(n,"right"),...rs(o,"bottom"),...rs(s,"left")]};function e(e,t){return e.map((e=>e[t])).reduce(((e,t)=>e==t?e:null))}}()),e.setStyleRelation("border",["border-color","border-style","border-width","border-top","border-right","border-bottom","border-left","border-top-color","border-right-color","border-bottom-color","border-left-color","border-top-style","border-right-style","border-bottom-style","border-left-style","border-top-width","border-right-width","border-bottom-width","border-left-width"]),e.setStyleRelation("border-color",["border-top-color","border-right-color","border-bottom-color","border-left-color"]),e.setStyleRelation("border-style",["border-top-style","border-right-style","border-bottom-style","border-left-style"]),e.setStyleRelation("border-width",["border-top-width","border-right-width","border-bottom-width","border-left-width"]),e.setStyleRelation("border-top",["border-top-color","border-top-style","border-top-width"]),e.setStyleRelation("border-right",["border-right-color","border-right-style","border-right-width"]),e.setStyleRelation("border-bottom",["border-bottom-color","border-bottom-style","border-bottom-width"]),e.setStyleRelation("border-left",["border-left-color","border-left-style","border-left-width"])}function Yo(e){return t=>{const{color:i,style:n,width:o}=os(t),s={};return void 0!==i&&(s.color={[e]:i}),void 0!==n&&(s.style={[e]:n}),void 0!==o&&(s.width={[e]:o}),{path:"border",value:s}}}function Xo(e){return t=>({path:"border",value:es(t,e)})}function es(e,t){return{[t]:jo(e)}}function ts(e,t){return i=>({path:"border",value:{[e]:{[t]:i}}})}function is(e){return(t,i)=>{if(i.border)return ns(i.border,e)}}function ns(e,t){const i={};return e.width&&e.width[t]&&(i.width=e.width[t]),e.style&&e.style[t]&&(i.style=e.style[t]),e.color&&e.color[t]&&(i.color=e.color[t]),i}function os(e){const t={},i=Zo(e);for(const e of i)Mo(e)||/thin|medium|thick/.test(e)?t.width=e:Ro(e)?t.style=e:t.color=e;return t}function ss(e){return t=>rs(t,e)}function rs(e,t){const i=[];if(e&&e.width&&i.push("width"),e&&e.style&&i.push("style"),e&&e.color&&i.push("color"),3==i.length){const n=i.map((t=>e[t])).join(" ");return["all"==t?["border",n]:[`border-${t}`,n]]}return"all"==t?[]:i.map((i=>[`border-${t}-${i}`,e[i]]))}function as(e){e.setNormalizer("margin",Go("margin")),e.setNormalizer("margin-top",(e=>({path:"margin.top",value:e}))),e.setNormalizer("margin-right",(e=>({path:"margin.right",value:e}))),e.setNormalizer("margin-bottom",(e=>({path:"margin.bottom",value:e}))),e.setNormalizer("margin-left",(e=>({path:"margin.left",value:e}))),e.setReducer("margin",qo("margin")),e.setStyleRelation("margin",["margin-top","margin-right","margin-bottom","margin-left"])}function ls(e){e.setNormalizer("padding",Go("padding")),e.setNormalizer("padding-top",(e=>({path:"padding.top",value:e}))),e.setNormalizer("padding-right",(e=>({path:"padding.right",value:e}))),e.setNormalizer("padding-bottom",(e=>({path:"padding.bottom",value:e}))),e.setNormalizer("padding-left",(e=>({path:"padding.left",value:e}))),e.setReducer("padding",qo("padding")),e.setStyleRelation("padding",["padding-top","padding-right","padding-bottom","padding-left"])}const cs="[",ds="]",us="{",hs="}",ms={container:W,attribute:ae,empty:de,ui:he,raw:ge},gs={setContentOf:(e,t)=>{e.innerHTML=t}};function fs(e,t={}){if(!(e instanceof ft))throw new TypeError("View needs to be an instance of module:engine/view/view~View.");const i=e.document,n=!!t.withoutSelection,o=t.rootName||"main",s=i.getRoot(o),r={showType:t.showType,showPriority:t.showPriority,renderUIElements:t.renderUIElements,renderRawElements:t.renderRawElements,ignoreRoot:!0,domConverter:t.domConverter};return n?fs._stringify(s,null,r):fs._stringify(s,i.selection,r)}function ps(e,t,i={}){if(!(e instanceof ft))throw new TypeError("View needs to be an instance of module:engine/view/view~View.");const n=e.document,o=i.rootName||"main",s=n.getRoot(o);e.change((e=>{const i=ps._parse(t,{rootElement:s});i.view&&i.selection&&e.setSelection(i.selection)}))}function bs(e,t=null,i={}){let n;return n=t instanceof K||t instanceof G?new Q(t):t,new _s(e,n,i).stringify()}function ws(e,t={}){const i=new se(new L);t.order=t.order||[];const n=new vs({sameSelectionCharacters:t.sameSelectionCharacters}),o=new Xi(i,{namespaces:Object.keys(ms)});t.inlineObjectElements&&o.domConverter.inlineObjectElements.push(...t.inlineObjectElements);let s=o.toView(e);if(s=ys(s),t.rootElement){const e=t.rootElement,i=s._removeChildren(0,s.childCount);e._removeChildren(0,e.childCount),e._appendChild(i),s=e}const r=n.parse(s,t.order);return s.is("documentFragment")&&1===s.childCount&&(s=s.getChild(0)),r.length?{view:s,selection:new Q(r,{backward:!!t.lastRangeBackward})}:(s.parent&&s._remove(),s)}fs._stringify=bs,ps._parse=ws;class vs{constructor(e){this.sameSelectionCharacters=!!e.sameSelectionCharacters}parse(e,t){this._positions=[],this._getPositions(e);let i=this._createRanges();if(t.length){if(t.length!=i.length)throw new Error(`Parse error - there are ${i.length} ranges found, but ranges order array contains ${t.length} elements.`);i=this._sortRanges(i,t)}return i}_getPositions(e){if(e.is("documentFragment")||e.is("element")){const t=[...e.getChildren()];for(const e of t)this._getPositions(e)}if(e.is("$text")){const t=new RegExp(`[${us}${hs}\\${ds}\\${cs}]`,"g");let i,n=e.data,o=0;const s=[];for(;i=t.exec(n);){const e=i.index,t=i[0];s.push({bracket:t,textOffset:e-o}),o++}n=n.replace(t,""),e._data=n;const r=e.index,a=e.parent;n||e._remove();for(const t of s)if(n)if(this.sameSelectionCharacters||!this.sameSelectionCharacters&&(t.bracket==us||t.bracket==hs))this._positions.push({bracket:t.bracket,position:new K(e,t.textOffset)});else{if(!this.sameSelectionCharacters&&0!==t.textOffset&&t.textOffset!==n.length)throw new Error(`Parse error - range delimiter '${t.bracket}' is placed inside text node.`);const e=0===t.textOffset?r:r+1;this._positions.push({bracket:t.bracket,position:new K(a,e)})}else{if(!this.sameSelectionCharacters&&t.bracket==us||t.bracket==hs)throw new Error(`Parse error - text range delimiter '${t.bracket}' is placed inside empty text node. `);this._positions.push({bracket:t.bracket,position:new K(a,r)})}}}_sortRanges(e,t){const i=[];let n=0;for(const o of t){if(void 0===e[o-1])throw new Error("Parse error - provided ranges order is invalid.");i[o-1]=e[n],n++}return i}_createRanges(){const e=[];let t=null;for(const i of this._positions){if(!t&&(i.bracket==ds||i.bracket==hs))throw new Error(`Parse error - end of range was found '${i.bracket}' but range was not started before.`);if(t&&(i.bracket==cs||i.bracket==us))throw new Error(`Parse error - start of range was found '${i.bracket}' but one range is already started.`);i.bracket==cs||i.bracket==us?t=new G(i.position,i.position):(t.end=i.position,e.push(t),t=null)}if(null!==t)throw new Error("Parse error - range was started but no end delimiter was found.");return e}}class _s{constructor(e,t,i){this.root=e,this.selection=t,this.ranges=[],t&&(this.ranges=[...t.getRanges()]),this.showType=!!i.showType,this.showPriority=!!i.showPriority,this.showAttributeElementId=!!i.showAttributeElementId,this.ignoreRoot=!!i.ignoreRoot,this.sameSelectionCharacters=!!i.sameSelectionCharacters,this.renderUIElements=!!i.renderUIElements,this.renderRawElements=!!i.renderRawElements,this.domConverter=i.domConverter||gs}stringify(){let e="";return this._walkView(this.root,(t=>{e+=t})),e}_walkView(e,t){const i=this.ignoreRoot&&this.root===e;if(e.is("element")||e.is("documentFragment")){if(e.is("element")&&!i&&t(this._stringifyElementOpen(e)),this.renderUIElements&&e.is("uiElement"))t(e.render(document,this.domConverter).innerHTML);else if(this.renderRawElements&&e.is("rawElement")){const i=document.createElement("div");e.render(i,this.domConverter),t(i.innerHTML)}else{let i=0;t(this._stringifyElementRanges(e,i));for(const n of e.getChildren())this._walkView(n,t),i++,t(this._stringifyElementRanges(e,i))}e.is("element")&&!i&&t(this._stringifyElementClose(e))}e.is("$text")&&t(this._stringifyTextRanges(e))}_stringifyElementRanges(e,t){let i="",n="",o="";for(const s of this.ranges)s.start.parent==e&&s.start.offset===t&&(s.isCollapsed?o+=cs+ds:i+=cs),s.end.parent!==e||s.end.offset!==t||s.isCollapsed||(n+=ds);return n+o+i}_stringifyTextRanges(e){const t=e.data.length,i=e.data.split("");let n,o;this.sameSelectionCharacters?(n=cs,o=ds):(n=us,o=hs),i[t]="";const s=i.map((e=>({letter:e,start:"",end:"",collapsed:""})));for(const i of this.ranges){const r=i.start,a=i.end;r.parent==e&&r.offset>=0&&r.offset<=t&&(i.isCollapsed?s[a.offset].collapsed+=n+o:s[r.offset].start+=n),a.parent==e&&a.offset>=0&&a.offset<=t&&!i.isCollapsed&&(s[a.offset].end+=o)}return s.map((e=>e.end+e.collapsed+e.start+e.letter)).join("")}_stringifyElementOpen(e){const t=this._stringifyElementPriority(e),i=this._stringifyElementId(e);return`<${[[this._stringifyElementType(e),e.name].filter((e=>""!==e)).join(":"),t,i,this._stringifyElementAttributes(e)].filter((e=>""!==e)).join(" ")}>`}_stringifyElementClose(e){return`</${[this._stringifyElementType(e),e.name].filter((e=>""!==e)).join(":")}>`}_stringifyElementType(e){if(this.showType)for(const t in ms)if(e instanceof ms[t])return t;return""}_stringifyElementPriority(e){return this.showPriority&&e.is("attributeElement")?`view-priority="${e.priority}"`:""}_stringifyElementId(e){return this.showAttributeElementId&&e.is("attributeElement")&&e.id?`view-id="${e.id}"`:""}_stringifyElementAttributes(e){const t=[],i=[...e.getAttributeKeys()].sort();for(const n of i){let i;i="class"===n?[...e.getClassNames()].sort().join(" "):"style"===n?[...e.getStyleNames()].sort().map((t=>`${t}:${e.getStyle(t).replace(/"/g,"&quot;")}`)).join(";"):e.getAttribute(n),t.push(`${n}="${i}"`)}return t.join(" ")}}function ys(e){if(e.is("element")||e.is("documentFragment")){const t=e.is("documentFragment")?new pe(e.document):function(e,t){const i=function(e){const t=e.name.split(":"),i=function(e){const t=parseInt(e,10);return isNaN(t)?null:t}(e.getAttribute("view-priority")),n=e.hasAttribute("view-id")?e.getAttribute("view-id"):null;if(e._removeAttribute("view-priority"),e._removeAttribute("view-id"),1==t.length)return{name:t[0],type:null!==i?"attribute":null,priority:i,id:n};const o=function(e){return e in ms?e:null}(t[0]);if(o)return{name:t[1],type:o,priority:i,id:n};throw new Error(`Parse error - cannot parse element's name: ${e.name}.`)}(t),n=ms[i.type],o=n?new n(e,i.name):new D(e,i.name);o.is("attributeElement")&&(null!==i.priority&&(o._priority=i.priority),null!==i.id&&(o._id=i.id));for(const e of t.getAttributeKeys())o._setAttribute(e,t.getAttribute(e));return o}(e.document,e);for(const i of[...e.getChildren()]){if(t.is("emptyElement"))throw new Error("Parse error - cannot parse inside EmptyElement.");if(t.is("uiElement"))throw new Error("Parse error - cannot parse inside UIElement.");if(t.is("rawElement"))throw new Error("Parse error - cannot parse inside RawElement.");t._appendChild(ys(i))}return t}return e}function ks(e,t={}){if(!(e instanceof wo))throw new TypeError("Model needs to be an instance of module:engine/model/model~Model.");const i=t.rootName||"main",n=e.document.getRoot(i);return ks._stringify(n,t.withoutSelection?null:e.document.selection,t.convertMarkers?e.markers:null)}function Cs(e,t,i={}){if(!(e instanceof wo))throw new TypeError("Model needs to be an instance of module:engine/model/model~Model.");let n,o=null;const s=e.document.getRoot(i.rootName||"main"),r=Cs._parse(t,e.schema,{lastRangeBackward:i.lastRangeBackward,selectionAttributes:i.selectionAttributes,context:[s.name],inlineObjectElements:i.inlineObjectElements});function a(t){if(t.remove(t.createRangeIn(s)),t.insert(n,s),t.setSelection(null),t.removeSelectionAttribute(e.document.selection.getAttributeKeys()),o){const e=[];for(const t of o.getRanges()){const i=new At(s,t.start.path),n=new At(s,t.end.path);e.push(new St(i,n))}t.setSelection(e,{backward:o.isBackward}),i.selectionAttributes&&t.setSelectionAttribute(o.getAttributes())}}"model"in r?(n=r.model,o=r.selection):n=r,void 0!==i.batchType?e.enqueueChange(i.batchType,a):e.change(a)}function As(e,t=null,i=null){const n=new wo,o=new Vt;let s,r=null;if(e instanceof $n||e instanceof Qn)s=n.createRangeIn(e);else if(e.parent)s=new St(n.createPositionBefore(e),n.createPositionAfter(e));else{const t=new Qn(e);s=n.createRangeIn(t)}t instanceof Ft||t instanceof Gt?r=t:(t instanceof St||t instanceof At)&&(r=new Ft(t));const a=new L,l=new ft(a),c=l.document,d=new j(c,"div");d.rootName="main",c.roots.add(d);const u=new Mt({mapper:o,schema:n.schema});o.bindElements(e.root,d),u.on("insert:$text",((e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const n=i.writer,o=i.mapper.toViewPosition(t.range.start),s=n.createText(t.item.data);n.insert(o,s)})),u.on("insert",((e,t,i)=>{i.convertAttributes(t.item),t.reconversion||!t.item.is("element")||t.item.isEmpty||i.convertChildren(t.item)}),{priority:"lowest"}),u.on("attribute",((e,t,i)=>{if(t.item instanceof Ft||t.item instanceof Gt||t.item.is("$textProxy")){const n=ei(((e,{writer:i})=>i.createAttributeElement("model-text-with-attributes",{[t.attributeKey]:Ps(e)})));n(e,t,i)}})),u.on("insert",ti((e=>{const t=Is(e.getAttributes(),Ps);return new W(c,e.name,t)}))),u.on("selection",((e,t,i)=>{const n=t.selection;if(n.isCollapsed)return;if(!i.consumable.consume(n,"selection"))return;const o=[];for(const e of n.getRanges())o.push(i.mapper.toViewRange(e));i.writer.setSelection(o,{backward:n.isBackward})})),u.on("selection",((e,t,i)=>{const n=t.selection;if(!n.isCollapsed)return;if(!i.consumable.consume(n,"selection"))return;const o=i.writer,s=n.getFirstPosition(),r=i.mapper.toViewPosition(s),a=o.breakAttributes(r);o.setSelection(a)})),u.on("addMarker",ii(((e,{writer:t})=>{const i=e.markerName+":"+(e.isOpening?"start":"end");return t.createUIElement(i)})));const h=new Map;if(i)for(const e of Array.from(i).sort(((e,t)=>e.name<t.name?1:-1)))h.set(e.name,e.getRange());const m=l._writer;u.convert(s,h,m),r&&u.convertSelection(r,i||n.markers,m);let g=bs(d,c.selection,{sameSelectionCharacters:!0});return g=g.substr(5,g.length-11),l.destroy(),g.replace(new RegExp("model-text-with-attributes","g"),"$text")}function Es(e,t,i={}){const o=new Vt,s=ws(e=e.replace(new RegExp("\\$text","g"),"model-text-with-attributes"),{sameSelectionCharacters:!0,lastRangeBackward:!!i.lastRangeBackward,inlineObjectElements:i.inlineObjectElements});let r,a=null,l=null;"view"in s&&"selection"in s?(r=s.view,a=s.selection):r=s;const c=new wo,d=new qi({schema:t});d.on("documentFragment",function(e){return(t,i,n)=>{const o=n.convertChildren(i.viewItem,i.modelCursor);e.bindElements(i.modelCursor.parent,i.viewItem),i=Object.assign(i,o),t.stop()}}(o)),d.on("element:model-text-with-attributes",xs()),d.on("element",function(e){return(t,i,n)=>{const o=i.viewItem.name;if(!n.schema.checkChild(i.modelCursor,o))throw new Error(`Element '${o}' was not allowed in given position.`);const s=Is(i.viewItem.getAttributes(),Ts),r=n.writer.createElement(i.viewItem.name,s);n.writer.insert(r,i.modelCursor),e.bindElements(r,i.viewItem),n.convertChildren(i.viewItem,r),i.modelRange=St._createOn(r),i.modelCursor=i.modelRange.end,t.stop()}}(o)),d.on("text",xs());let u=c.change((e=>d.convert(r.root,e,i.context||"$root")));if(o.bindElements(u,r.root),1==u.childCount&&(u=u.getChild(0)),a){const e=[];for(const t of a.getRanges())e.push(o.toModelRange(t));l=new Ft(e,{backward:a.isBackward});for(const[e,t]of(0,n.toMap)(i.selectionAttributes||[]))l.setAttribute(e,t)}return l?{model:u,selection:l}:u}function xs(){return(e,t,i)=>{if(!i.schema.checkChild(t.modelCursor,"$text"))throw new Error("Text was not allowed in given position.");let n;if(t.viewItem.is("element")){const e=Is(t.viewItem.getAttributes(),Ts),o=t.viewItem.getChild(0);n=i.writer.createText(o.data,e)}else n=i.writer.createText(t.viewItem.data);i.writer.insert(n,t.modelCursor),t.modelRange=St._createFromPositionAndShift(t.modelCursor,n.offsetSize),t.modelCursor=t.modelRange.end,e.stop()}}function Ts(e){try{return JSON.parse(e)}catch(t){return e}}function Ps(e){return(0,_.A)(e)?JSON.stringify(e):e}function*Is(e,t){for(const[i,n]of e)yield[i,t(n)]}ks._stringify=As,Cs._parse=Es},7207:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Enter:()=>u,ShiftEnter:()=>f});var n=i(1024);function*o(e,t){for(const i of t)i&&e.getAttributeProperties(i[0]).copyOnEnter&&(yield i)}class s extends n.Command{execute(){this.editor.model.change((e=>{this.enterBlock(e),this.fire("afterExecute",{writer:e})}))}enterBlock(e){const t=this.editor.model,i=t.document.selection,n=t.schema,s=i.isCollapsed,a=i.getFirstRange(),l=a.start.parent,c=a.end.parent;if(n.isLimit(l)||n.isLimit(c))return s||l!=c||t.deleteContent(i),!1;if(s){const t=o(e.model.schema,i.getAttributes());return r(e,a.start),e.setSelectionAttribute(t),!0}{const n=!(a.start.isAtStart&&a.end.isAtEnd),o=l==c;if(t.deleteContent(i,{leaveUnmerged:n}),n){if(o)return r(e,i.focus),!0;e.setSelection(c,0)}}return!1}}function r(e,t){e.split(t),e.setSelection(t.parent.nextSibling,0)}var a=i(151),l=i(7906);const c={insertParagraph:{isSoft:!1},insertLineBreak:{isSoft:!0}};class d extends a.Observer{constructor(e){super(e);const t=this.document;let i=!1;t.on("keydown",((e,t)=>{i=t.shiftKey})),t.on("beforeinput",((n,o)=>{if(!this.isEnabled)return;let s=o.inputType;l.env.isSafari&&i&&"insertParagraph"==s&&(s="insertLineBreak");const r=o.domEvent,d=c[s];if(!d)return;const u=new a.BubblingEventInfo(t,"enter",o.targetRanges[0]);t.fire(u,new a.DomEventData(e,r,{isSoft:d.isSoft})),u.stop.called&&n.stop()}))}observe(){}stopObserving(){}}class u extends n.Plugin{static get pluginName(){return"Enter"}init(){const e=this.editor,t=e.editing.view,i=t.document,n=this.editor.t;t.addObserver(d),e.commands.add("enter",new s(e)),this.listenTo(i,"enter",((n,o)=>{i.isComposing||o.preventDefault(),o.isSoft||(e.execute("enter"),t.scrollToTheSelection())}),{priority:"low"}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:n("Insert a hard break (a new paragraph)"),keystroke:"Enter"}]})}}class h extends n.Command{execute(){const e=this.editor.model,t=e.document;e.change((i=>{!function(e,t,i){const n=i.isCollapsed,s=i.getFirstRange(),r=s.start.parent,a=s.end.parent,l=r==a;if(n){const n=o(e.schema,i.getAttributes());m(e,t,s.end),t.removeSelectionAttribute(i.getAttributeKeys()),t.setSelectionAttribute(n)}else{const n=!(s.start.isAtStart&&s.end.isAtEnd);e.deleteContent(i,{leaveUnmerged:n}),l?m(e,t,i.focus):n&&t.setSelection(a,0)}}(e,i,t.selection),this.fire("afterExecute",{writer:i})}))}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=function(e,t){if(t.rangeCount>1)return!1;const i=t.anchor;if(!i||!e.checkChild(i,"softBreak"))return!1;const n=t.getFirstRange(),o=n.start.parent,s=n.end.parent;return!g(o,e)&&!g(s,e)||o===s}(e.schema,t.selection)}}function m(e,t,i){const n=t.createElement("softBreak");e.insertContent(n,i),t.setSelection(n,"after")}function g(e,t){return!e.is("rootElement")&&(t.isLimit(e)||g(e.parent,t))}class f extends n.Plugin{static get pluginName(){return"ShiftEnter"}init(){const e=this.editor,t=e.model.schema,i=e.conversion,n=e.editing.view,o=n.document,s=this.editor.t;t.register("softBreak",{allowWhere:"$text",isInline:!0}),i.for("upcast").elementToElement({model:"softBreak",view:"br"}),i.for("downcast").elementToElement({model:"softBreak",view:(e,{writer:t})=>t.createEmptyElement("br")}),n.addObserver(d),e.commands.add("shiftEnter",new h(e)),this.listenTo(o,"enter",((t,i)=>{o.isComposing||i.preventDefault(),i.isSoft&&(e.execute("shiftEnter"),n.scrollToTheSelection())}),{priority:"low"}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:s("Insert a soft break (a <code>&lt;br&gt;</code> element)"),keystroke:"Shift+Enter"}]})}}},708:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Essentials:()=>d});var n=i(1204),o=i(7377),s=i(6449),r=i(6206),a=i(7211),l=i(6417),c=i(949);class d extends n.k_{static get requires(){return[c.KO,o.B0,s.x,r.SelectAll,s.D,a.IG,l.Vn]}static get pluginName(){return"Essentials"}}},6913:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Font:()=>W,FontBackgroundColor:()=>z,FontBackgroundColorEditing:()=>N,FontBackgroundColorUI:()=>D,FontColor:()=>L,FontColorEditing:()=>B,FontColorUI:()=>O,FontFamily:()=>y,FontFamilyEditing:()=>b,FontFamilyUI:()=>_,FontSize:()=>V,FontSizeEditing:()=>P,FontSizeUI:()=>S});var n=i(1204);class o extends n.uB{constructor(e,t){super(e),this.attributeKey=t}refresh(){const e=this.editor.model,t=e.document;this.value=t.selection.getAttribute(this.attributeKey),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,this.attributeKey)}execute(e={}){const t=this.editor.model,i=t.document.selection,n=e.value,o=e.batch,s=e=>{if(i.isCollapsed)n?e.setSelectionAttribute(this.attributeKey,n):e.removeSelectionAttribute(this.attributeKey);else{const o=t.schema.getValidRanges(i.getRanges(),this.attributeKey);for(const t of o)n?e.setAttribute(this.attributeKey,n,t):e.removeAttribute(this.attributeKey,t)}};o?t.enqueueChange(o,(e=>{s(e)})):t.change((e=>{s(e)}))}}var s=i(949);const r="fontSize",a="fontFamily",l="fontColor",c="fontBackgroundColor";function d(e,t){const i={model:{key:e,values:[]},view:{},upcastAlso:{}};for(const e of t)i.model.values.push(e.model),i.view[e.model]=e.view,e.upcastAlso&&(i.upcastAlso[e.model]=e.upcastAlso);return i}function u(e){return t=>t.getStyle(e).replace(/\s/g,"")}function h(e){return(t,{writer:i})=>i.createAttributeElement("span",{style:`${e}:${t}`},{priority:7})}class m extends o{constructor(e){super(e,a)}}function g(e){return e.map(f).filter((e=>void 0!==e))}function f(e){return"object"==typeof e?e:"default"===e?{title:"Default",model:void 0}:"string"==typeof e?function(e){const t=e.replace(/"|'/g,"").split(","),i=t[0],n=t.map(p).join(", ");return{title:i,model:n,view:{name:"span",styles:{"font-family":n},priority:7}}}(e):void 0}function p(e){return(e=e.trim()).indexOf(" ")>0&&(e=`'${e}'`),e}class b extends n.k_{static get pluginName(){return"FontFamilyEditing"}constructor(e){super(e),e.config.define(a,{options:["default","Arial, Helvetica, sans-serif","Courier New, Courier, monospace","Georgia, serif","Lucida Sans Unicode, Lucida Grande, sans-serif","Tahoma, Geneva, sans-serif","Times New Roman, Times, serif","Trebuchet MS, Helvetica, sans-serif","Verdana, Geneva, sans-serif"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:a}),e.model.schema.setAttributeProperties(a,{isFormatting:!0,copyOnEnter:!0});const t=g(e.config.get("fontFamily.options")).filter((e=>e.model)),i=d(a,t);e.config.get("fontFamily.supportAllValues")?(this._prepareAnyValueConverters(),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(i),e.commands.add(a,new m(e))}_prepareAnyValueConverters(){const e=this.editor;e.conversion.for("downcast").attributeToElement({model:a,view:(e,{writer:t})=>t.createAttributeElement("span",{style:"font-family:"+e},{priority:7})}),e.conversion.for("upcast").elementToAttribute({model:{key:a,value:e=>e.getStyle("font-family")},view:{name:"span",styles:{"font-family":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{face:/.*/}},model:{key:a,value:e=>e.getAttribute("face")}})}}var w=i(5318);const v='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.03 3h6.149a.75.75 0 1 1 0 1.5h-5.514L11.03 3zm1.27 3h4.879a.75.75 0 1 1 0 1.5h-4.244L12.3 6zm1.27 3h3.609a.75.75 0 1 1 0 1.5h-2.973L13.57 9zm-2.754 2.5L8.038 4.785 5.261 11.5h5.555zm.62 1.5H4.641l-1.666 4.028H1.312l5.789-14h1.875l5.789 14h-1.663L11.436 13z"/></svg>';class _ extends n.k_{static get pluginName(){return"FontFamilyUI"}init(){const e=this.editor,t=e.t,i=this._getLocalizedOptions(),n=e.commands.get(a),o=t("Font Family"),r=function(e,t){const i=new w.pM;for(const n of e){const e={type:"button",model:new s.Jc({commandName:a,commandParam:n.model,label:n.title,role:"menuitemradio",withText:!0})};e.model.bind("isOn").to(t,"value",(e=>e===n.model||!(!e||!n.model)&&e.split(",")[0].replace(/'/g,"").toLowerCase()===n.model.toLowerCase())),n.view&&"string"!=typeof n.view&&n.view.styles&&e.model.set("labelStyle",`font-family: ${n.view.styles["font-family"]}`),i.add(e)}return i}(i,n);e.ui.componentFactory.add(a,(t=>{const i=(0,s.yu)(t);return(0,s.O)(i,r,{role:"menu",ariaLabel:o}),i.buttonView.set({label:o,icon:v,tooltip:!0}),i.extendTemplate({attributes:{class:"ck-font-family-dropdown"}}),i.bind("isEnabled").to(n),this.listenTo(i,"execute",(t=>{e.execute(t.source.commandName,{value:t.source.commandParam}),e.editing.view.focus()})),i})),e.ui.componentFactory.add(`menuBar:${a}`,(t=>{const i=new s.zj(t);i.buttonView.set({label:o,icon:v}),i.bind("isEnabled").to(n);const a=new s.BY(t);for(const n of r){const o=new s.I8(t,i),r=new s.kS(t);r.set({role:"menuitemradio",isToggleable:!0}),r.bind(...Object.keys(n.model)).to(n.model),r.delegate("execute").to(i),r.on("execute",(()=>{e.execute(n.model.commandName,{value:n.model.commandParam}),e.editing.view.focus()})),o.children.add(r),a.items.add(o)}return i.panelView.children.add(a),i}))}_getLocalizedOptions(){const e=this.editor,t=e.t;return g(e.config.get(a).options).map((e=>("Default"===e.title&&(e.title=t("Default")),e)))}}class y extends n.k_{static get requires(){return[b,_]}static get pluginName(){return"FontFamily"}}var k=i(4133);class C extends o{constructor(e){super(e,r)}}function A(e){return e.map((e=>function(e){if("number"==typeof e&&(e=String(e)),"object"==typeof e&&((t=e).title&&t.model&&t.view))return x(e);var t;const i=function(e){return"string"==typeof e?E[e]:E[e.model]}(e);return i?x(i):"default"===e?{model:void 0,title:"Default"}:function(e){let t;if("object"==typeof e){if(!e.model)throw new w.Yb("font-size-invalid-definition",null,e);t=parseFloat(e.model)}else t=parseFloat(e);return isNaN(t)}(e)?void 0:function(e){return"string"==typeof e&&(e={title:e,model:`${parseFloat(e)}px`}),e.view={name:"span",styles:{"font-size":e.model}},x(e)}(e)}(e))).filter((e=>void 0!==e))}const E={get tiny(){return{title:"Tiny",model:"tiny",view:{name:"span",classes:"text-tiny",priority:7}}},get small(){return{title:"Small",model:"small",view:{name:"span",classes:"text-small",priority:7}}},get big(){return{title:"Big",model:"big",view:{name:"span",classes:"text-big",priority:7}}},get huge(){return{title:"Huge",model:"huge",view:{name:"span",classes:"text-huge",priority:7}}}};function x(e){return e.view&&"string"!=typeof e.view&&!e.view.priority&&(e.view.priority=7),e}const T=["x-small","x-small","small","medium","large","x-large","xx-large","xxx-large"];class P extends n.k_{static get pluginName(){return"FontSizeEditing"}constructor(e){super(e),e.config.define(r,{options:["tiny","small","default","big","huge"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:r}),e.model.schema.setAttributeProperties(r,{isFormatting:!0,copyOnEnter:!0});const t=e.config.get("fontSize.supportAllValues"),i=A(this.editor.config.get("fontSize.options")).filter((e=>e.model)),n=d(r,i);t?(this._prepareAnyValueConverters(n),this._prepareCompatibilityConverter()):e.conversion.attributeToElement(n),e.commands.add(r,new C(e))}_prepareAnyValueConverters(e){const t=this.editor,i=e.model.values.filter((e=>!(0,k.Vq)(String(e))&&!(0,k.fp)(String(e))));if(i.length)throw new w.Yb("font-size-invalid-use-of-named-presets",null,{presets:i});t.conversion.for("downcast").attributeToElement({model:r,view:(e,{writer:t})=>{if(e)return t.createAttributeElement("span",{style:"font-size:"+e},{priority:7})}}),t.conversion.for("upcast").elementToAttribute({model:{key:r,value:e=>e.getStyle("font-size")},view:{name:"span",styles:{"font-size":/.*/}}})}_prepareCompatibilityConverter(){this.editor.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{size:/^[+-]?\d{1,3}$/}},model:{key:r,value:e=>{const t=e.getAttribute("size"),i="-"===t[0]||"+"===t[0];let n=parseInt(t,10);i&&(n=3+n);const o=T.length-1,s=Math.min(Math.max(n,0),o);return T[s]}}})}}const I='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.816 11.5 7.038 4.785 4.261 11.5h5.555zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663L10.436 13zm7.55 2.279.779-.779.707.707-2.265 2.265-2.193-2.265.707-.707.765.765V4.825c0-.042 0-.083.002-.123l-.77.77-.707-.707L17.207 2.5l2.265 2.265-.707.707-.782-.782c.002.043.003.089.003.135v10.454z"/></svg>';class S extends n.k_{static get pluginName(){return"FontSizeUI"}init(){const e=this.editor,t=e.t,i=this._getLocalizedOptions(),n=e.commands.get(r),o=t("Font Size"),a=function(e,t){const i=new w.pM;for(const n of e){const e={type:"button",model:new s.Jc({commandName:r,commandParam:n.model,label:n.title,class:"ck-fontsize-option",role:"menuitemradio",withText:!0})};n.view&&"string"!=typeof n.view&&(n.view.styles&&e.model.set("labelStyle",`font-size:${n.view.styles["font-size"]}`),n.view.classes&&e.model.set("class",`${e.model.class} ${n.view.classes}`)),e.model.bind("isOn").to(t,"value",(e=>e===n.model)),i.add(e)}return i}(i,n);e.ui.componentFactory.add(r,(t=>{const i=(0,s.yu)(t);return(0,s.O)(i,a,{role:"menu",ariaLabel:o}),i.buttonView.set({label:o,icon:I,tooltip:!0}),i.extendTemplate({attributes:{class:["ck-font-size-dropdown"]}}),i.bind("isEnabled").to(n),this.listenTo(i,"execute",(t=>{e.execute(t.source.commandName,{value:t.source.commandParam}),e.editing.view.focus()})),i})),e.ui.componentFactory.add(`menuBar:${r}`,(t=>{const i=new s.zj(t);i.buttonView.set({label:o,icon:I}),i.bind("isEnabled").to(n);const r=new s.BY(t);for(const n of a){const o=new s.I8(t,i),a=new s.kS(t);a.set({role:"menuitemradio",isToggleable:!0}),a.bind(...Object.keys(n.model)).to(n.model),a.delegate("execute").to(i),a.on("execute",(()=>{e.execute(n.model.commandName,{value:n.model.commandParam}),e.editing.view.focus()})),o.children.add(a),r.items.add(o)}return i.panelView.children.add(r),i}))}_getLocalizedOptions(){const e=this.editor,t=e.t,i={Default:t("Default"),Tiny:t("Tiny"),Small:t("Small"),Big:t("Big"),Huge:t("Huge")};return A(e.config.get(r).options).map((e=>{const t=i[e.title];return t&&t!=e.title&&(e=Object.assign({},e,{title:t})),e}))}}class V extends n.k_{static get requires(){return[P,S]}static get pluginName(){return"FontSize"}normalizeSizeOptions(e){return A(e)}}class R extends o{constructor(e){super(e,l)}}class B extends n.k_{static get pluginName(){return"FontColorEditing"}constructor(e){super(e),e.config.define(l,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{color:/[\s\S]+/}},model:{key:l,value:u("color")}}),e.conversion.for("upcast").elementToAttribute({view:{name:"font",attributes:{color:/^#?\w+$/}},model:{key:l,value:e=>e.getAttribute("color")}}),e.conversion.for("downcast").attributeToElement({model:l,view:h("color")}),e.commands.add(l,new R(e)),e.model.schema.extend("$text",{allowAttributes:l}),e.model.schema.setAttributeProperties(l,{isFormatting:!0,copyOnEnter:!0})}}class M extends n.k_{constructor(e,{commandName:t,componentName:i,icon:n,dropdownLabel:o}){super(e),this.commandName=t,this.componentName=i,this.icon=n,this.dropdownLabel=o,this.columns=e.config.get(`${this.componentName}.columns`)}init(){const e=this.editor,t=e.locale,i=t.t,n=e.commands.get(this.commandName),o=e.config.get(this.componentName),r=(0,s.lF)(o.colors),a=(0,s.b2)(t,r),l=o.documentColors,c=!1!==o.colorPicker;e.ui.componentFactory.add(this.componentName,(t=>{const r=(0,s.yu)(t);let d=!1;const u=function({dropdownView:e,colors:t,columns:i,removeButtonLabel:n,colorPickerLabel:o,documentColorsLabel:r,documentColorsCount:a,colorPickerViewConfig:l}){const c=e.locale,d=new s.oB(c,{colors:t,columns:i,removeButtonLabel:n,colorPickerLabel:o,documentColorsLabel:r,documentColorsCount:a,colorPickerViewConfig:l});return e.colorSelectorView=d,e.panelView.children.add(d),d}({dropdownView:r,colors:a.map((e=>({label:e.label,color:e.model,options:{hasBorder:e.hasBorder}}))),columns:this.columns,removeButtonLabel:i("Remove color"),colorPickerLabel:i("Color picker"),documentColorsLabel:0!==l?i("Document colors"):"",documentColorsCount:void 0===l?this.columns:l,colorPickerViewConfig:!!c&&(o.colorPicker||{})});return u.bind("selectedColor").to(n,"value"),r.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:!0}),r.extendTemplate({attributes:{class:"ck-color-ui-dropdown"}}),r.bind("isEnabled").to(n),u.on("execute",((t,i)=>{r.isOpen&&e.execute(this.commandName,{value:i.value,batch:this._undoStepBatch}),"colorPicker"!==i.source&&e.editing.view.focus(),"colorPickerSaveButton"===i.source&&(r.isOpen=!1)})),u.on("colorPicker:show",(()=>{this._undoStepBatch=e.model.createBatch()})),u.on("colorPicker:cancel",(()=>{this._undoStepBatch.operations.length&&(r.isOpen=!1,e.execute("undo",this._undoStepBatch)),e.editing.view.focus()})),r.on("change:isOpen",((t,i,n)=>{d||(d=!0,r.colorSelectorView.appendUI()),n&&(0!==l&&u.updateDocumentColors(e.model,this.componentName),u.updateSelectedColors(),u.showColorGridsFragment())})),(0,s.Zn)(r,(()=>r.colorSelectorView.colorGridsFragmentView.staticColorsGrid.items.find((e=>e.isOn)))),r})),e.ui.componentFactory.add(`menuBar:${this.componentName}`,(t=>{const o=new s.zj(t);o.buttonView.set({label:this.dropdownLabel,icon:this.icon}),o.bind("isEnabled").to(n);let r=!1;const c=new s.oB(t,{colors:a.map((e=>({label:e.label,color:e.model,options:{hasBorder:e.hasBorder}}))),columns:this.columns,removeButtonLabel:i("Remove color"),colorPickerLabel:i("Color picker"),documentColorsLabel:0!==l?i("Document colors"):"",documentColorsCount:void 0===l?this.columns:l,colorPickerViewConfig:!1});return c.bind("selectedColor").to(n,"value"),c.delegate("execute").to(o),c.on("execute",((t,i)=>{e.execute(this.commandName,{value:i.value,batch:this._undoStepBatch}),e.editing.view.focus()})),o.on("change:isOpen",((t,i,n)=>{r||(r=!0,c.appendUI()),n&&(0!==l&&c.updateDocumentColors(e.model,this.componentName),c.updateSelectedColors(),c.showColorGridsFragment())})),o.panelView.children.add(c),o}))}}class O extends M{constructor(e){const t=e.locale.t;super(e,{commandName:l,componentName:l,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.4 10.3 10 4.5l-2.4 5.8h4.8zm.5 1.2H7.1L5.7 15H4.2l5-12h1.6l5 12h-1.5L13 11.5zm3.1 7H4a1 1 0 0 1 0-2h12a1 1 0 0 1 0 2z"/></svg>',dropdownLabel:t("Font Color")})}static get pluginName(){return"FontColorUI"}}class L extends n.k_{static get requires(){return[B,O]}static get pluginName(){return"FontColor"}}class F extends o{constructor(e){super(e,c)}}class N extends n.k_{static get pluginName(){return"FontBackgroundColorEditing"}constructor(e){super(e),e.config.define(c,{colors:[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}],columns:5}),e.data.addStyleProcessorRules(k.D0),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{"background-color":/[\s\S]+/}},model:{key:c,value:u("background-color")}}),e.conversion.for("downcast").attributeToElement({model:c,view:h("background-color")}),e.commands.add(c,new F(e)),e.model.schema.extend("$text",{allowAttributes:c}),e.model.schema.setAttributeProperties(c,{isFormatting:!0,copyOnEnter:!0})}}class D extends M{constructor(e){const t=e.locale.t;super(e,{commandName:c,componentName:c,icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M4 2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zm8.38 9.262H7.62L10 5.506l2.38 5.756zm.532 1.285L14.34 16h1.426L10.804 4H9.196L4.234 16H5.66l1.428-3.453h5.824z"/></svg>',dropdownLabel:t("Font Background Color")})}static get pluginName(){return"FontBackgroundColorUI"}}class z extends n.k_{static get requires(){return[N,D]}static get pluginName(){return"FontBackgroundColor"}}class W extends n.k_{static get requires(){return[y,V,L,z]}static get pluginName(){return"Font"}}},9174:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Heading:()=>m,HeadingButtonsUI:()=>f,HeadingEditing:()=>c,HeadingUI:()=>h,Title:()=>w});var n=i(1204),o=i(1980),s=i(5318);class r extends n.uB{constructor(e,t){super(e),this.modelElements=t}refresh(){const e=(0,s.$1)(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some((t=>a(e,t,this.editor.model.schema)))}execute(e){const t=this.editor.model,i=t.document,n=e.value;t.change((e=>{const o=Array.from(i.selection.getSelectedBlocks()).filter((e=>a(e,n,t.schema)));for(const t of o)t.is("element",n)||e.rename(t,n)}))}}function a(e,t,i){return i.checkChild(e.parent,t)&&!i.isObject(e)}const l="paragraph";class c extends n.k_{static get pluginName(){return"HeadingEditing"}constructor(e){super(e),e.config.define("heading",{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading1",view:"h2",title:"Heading 1",class:"ck-heading_heading1"},{model:"heading2",view:"h3",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h4",title:"Heading 3",class:"ck-heading_heading3"}]})}static get requires(){return[o.Paragraph]}init(){const e=this.editor,t=e.config.get("heading.options"),i=[];for(const n of t)"paragraph"!==n.model&&(e.model.schema.register(n.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(n),i.push(n.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new r(e,i))}afterInit(){const e=this.editor,t=e.commands.get("enter"),i=e.config.get("heading.options");t&&this.listenTo(t,"afterExecute",((t,n)=>{const o=e.model.document.selection.getFirstPosition().parent;i.some((e=>o.is("element",e.model)))&&!o.is("element",l)&&0===o.childCount&&n.writer.rename(o,l)}))}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:s.vx.low+1})}}var d=i(949);function u(e){const t=e.t,i={Paragraph:t("Paragraph"),"Heading 1":t("Heading 1"),"Heading 2":t("Heading 2"),"Heading 3":t("Heading 3"),"Heading 4":t("Heading 4"),"Heading 5":t("Heading 5"),"Heading 6":t("Heading 6")};return e.config.get("heading.options").map((e=>{const t=i[e.title];return t&&t!=e.title&&(e.title=t),e}))}class h extends n.k_{static get pluginName(){return"HeadingUI"}init(){const e=this.editor,t=e.t,i=u(e),n=t("Choose heading"),o=t("Heading");e.ui.componentFactory.add("heading",(t=>{const r={},a=new s.pM,l=e.commands.get("heading"),c=e.commands.get("paragraph"),u=[l];for(const e of i){const t={type:"button",model:new d.Jc({label:e.title,class:e.class,role:"menuitemradio",withText:!0})};"paragraph"===e.model?(t.model.bind("isOn").to(c,"value"),t.model.set("commandName","paragraph"),u.push(c)):(t.model.bind("isOn").to(l,"value",(t=>t===e.model)),t.model.set({commandName:"heading",commandValue:e.model})),a.add(t),r[e.model]=e.title}const h=(0,d.yu)(t);return(0,d.O)(h,a,{ariaLabel:o,role:"menu"}),h.buttonView.set({ariaLabel:o,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:o}),h.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),h.bind("isEnabled").toMany(u,"isEnabled",((...e)=>e.some((e=>e)))),h.buttonView.bind("label").to(l,"value",c,"value",((e,t)=>{const i=t?"paragraph":e;return"boolean"==typeof i?n:r[i]?r[i]:n})),h.buttonView.bind("ariaLabel").to(l,"value",c,"value",((e,t)=>{const i=t?"paragraph":e;return"boolean"==typeof i?o:r[i]?`${r[i]}, ${o}`:o})),this.listenTo(h,"execute",(t=>{const{commandName:i,commandValue:n}=t.source;e.execute(i,n?{value:n}:void 0),e.editing.view.focus()})),h})),e.ui.componentFactory.add("menuBar:heading",(n=>{const o=new d.zj(n),s=e.commands.get("heading"),r=e.commands.get("paragraph"),a=[s],l=new d.BY(n);o.set({class:"ck-heading-dropdown"}),l.set({ariaLabel:t("Heading"),role:"menu"}),o.buttonView.set({label:t("Heading")}),o.panelView.children.add(l);for(const t of i){const i=new d.I8(n,o),c=new d.kS(n);i.children.add(c),l.items.add(i),c.set({isToggleable:!0,label:t.title,role:"menuitemradio",class:t.class}),c.delegate("execute").to(o),c.on("execute",(()=>{const i="paragraph"===t.model?"paragraph":"heading";e.execute(i,{value:t.model}),e.editing.view.focus()})),"paragraph"===t.model?(c.bind("isOn").to(r,"value"),a.push(r)):c.bind("isOn").to(s,"value",(e=>e===t.model))}return o.bind("isEnabled").toMany(a,"isEnabled",((...e)=>e.some((e=>e)))),o}))}}class m extends n.k_{static get requires(){return[c,h]}static get pluginName(){return"Heading"}}const g=(()=>({heading1:n.Pt.heading1,heading2:n.Pt.heading2,heading3:n.Pt.heading3,heading4:n.Pt.heading4,heading5:n.Pt.heading5,heading6:n.Pt.heading6}))();class f extends n.k_{init(){u(this.editor).filter((e=>"paragraph"!==e.model)).map((e=>this._createButton(e)))}_createButton(e){const t=this.editor;t.ui.componentFactory.add(e.model,(i=>{const n=new d._(i),o=t.commands.get("heading");return n.label=e.title,n.icon=e.icon||g[e.model],n.tooltip=!0,n.isToggleable=!0,n.bind("isEnabled").to(o),n.bind("isOn").to(o,"value",(t=>t==e.model)),n.on("execute",(()=>{t.execute("heading",{value:e.model}),t.editing.view.focus()})),n}))}}var p=i(4133);const b=new Set(["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"]);class w extends n.k_{constructor(){super(...arguments),this._bodyPlaceholder=new Map}static get pluginName(){return"Title"}static get requires(){return["Paragraph"]}init(){const e=this.editor,t=e.model;t.schema.register("title",{isBlock:!0,allowIn:"$root"}),t.schema.register("title-content",{isBlock:!0,allowIn:"title",allowAttributes:["alignment"]}),t.schema.extend("$text",{allowIn:"title-content"}),t.schema.addAttributeCheck((e=>{if(e.endsWith("title-content $text"))return!1})),e.editing.mapper.on("modelToViewPosition",_(e.editing.view)),e.data.mapper.on("modelToViewPosition",_(e.editing.view)),e.conversion.for("downcast").elementToElement({model:"title-content",view:"h1"}),e.conversion.for("downcast").add((e=>e.on("insert:title",((e,t,i)=>{i.consumable.consume(t.item,e.name)})))),e.data.upcastDispatcher.on("element:h1",v,{priority:"high"}),e.data.upcastDispatcher.on("element:h2",v,{priority:"high"}),e.data.upcastDispatcher.on("element:h3",v,{priority:"high"}),t.document.registerPostFixer((e=>this._fixTitleContent(e))),t.document.registerPostFixer((e=>this._fixTitleElement(e))),t.document.registerPostFixer((e=>this._fixBodyElement(e))),t.document.registerPostFixer((e=>this._fixExtraParagraph(e))),this._attachPlaceholders(),this._attachTabPressHandling()}getTitle(e={}){const t=e.rootName?e.rootName:void 0,i=this._getTitleElement(t).getChild(0);return this.editor.data.stringify(i,e)}getBody(e={}){const t=this.editor,i=t.data,n=t.model,o=e.rootName?e.rootName:void 0,s=t.model.document.getRoot(o),r=t.editing.view,a=new p.zN(r.document),l=n.createRangeIn(s),c=a.createDocumentFragment(),d=n.createPositionAfter(s.getChild(0)),u=n.createRange(d,n.createPositionAt(s,"end")),h=new Map;for(const e of n.markers){const t=u.getIntersection(e.getRange());t&&h.set(e.name,t)}return i.mapper.clearBindings(),i.mapper.bindElements(s,c),i.downcastDispatcher.convert(l,h,a,e),a.remove(a.createRangeOn(c.getChild(0))),t.data.processor.toData(c)}_getTitleElement(e){const t=this.editor.model.document.getRoot(e);for(const e of t.getChildren())if(y(e))return e}_fixTitleContent(e){let t=!1;for(const i of this.editor.model.document.getRootNames()){const n=this._getTitleElement(i);if(!n||1===n.maxOffset)continue;const o=Array.from(n.getChildren());o.shift();for(const t of o)e.move(e.createRangeOn(t),n,"after"),e.rename(t,"paragraph");t=!0}return t}_fixTitleElement(e){let t=!1;const i=this.editor.model;for(const n of this.editor.model.document.getRoots()){const o=Array.from(n.getChildren()).filter(y),s=o[0],r=n.getChild(0);if(r.is("element","title"))o.length>1&&(C(o,e,i),t=!0);else if(s||b.has(r.name))b.has(r.name)?k(r,e,i):e.move(e.createRangeOn(s),n,0),C(o,e,i),t=!0;else{const i=e.createElement("title");e.insert(i,n),e.insertElement("title-content",i),t=!0}}return t}_fixBodyElement(e){let t=!1;for(const i of this.editor.model.document.getRootNames()){const n=this.editor.model.document.getRoot(i);if(n.childCount<2){const o=e.createElement("paragraph");e.insert(o,n,1),this._bodyPlaceholder.set(i,o),t=!0}}return t}_fixExtraParagraph(e){let t=!1;for(const i of this.editor.model.document.getRootNames()){const n=this.editor.model.document.getRoot(i),o=this._bodyPlaceholder.get(i);E(o,n)&&(this._bodyPlaceholder.delete(i),e.remove(o),t=!0)}return t}_attachPlaceholders(){const e=this.editor,t=e.t,i=e.editing.view,n=e.sourceElement,o=e.config.get("title.placeholder")||t("Type your title"),s=e.config.get("placeholder")||n&&"textarea"===n.tagName.toLowerCase()&&n.getAttribute("placeholder")||t("Type or paste your content here.");e.editing.downcastDispatcher.on("insert:title-content",((e,t,n)=>{const s=n.mapper.toViewElement(t.item);s.placeholder=o,(0,p.JT)({view:i,element:s,keepOnFocus:!0})}));const r=new Map;i.document.registerPostFixer((e=>{let t=!1;for(const n of i.document.roots){if(n.isEmpty)continue;const i=n.getChild(1),o=r.get(n.rootName);i!==o&&(o&&((0,p.YU)(e,o),e.removeAttribute("data-placeholder",o)),e.setAttribute("data-placeholder",s,i),r.set(n.rootName,i),t=!0),t=(0,p.$0)(i,!0)&&2===n.childCount&&"p"===i.name?!!(0,p.Zu)(e,i)||t:!!(0,p.YU)(e,i)||t}return t}))}_attachTabPressHandling(){const e=this.editor,t=e.model;e.keystrokes.set("TAB",((e,i)=>{t.change((e=>{const n=t.document.selection,o=Array.from(n.getSelectedBlocks());if(1===o.length&&o[0].is("element","title-content")){const t=n.getFirstPosition().root.getChild(1);e.setSelection(t,0),i()}}))})),e.keystrokes.set("SHIFT + TAB",((i,n)=>{t.change((i=>{const o=t.document.selection;if(!o.isCollapsed)return;const r=(0,s.$1)(o.getSelectedBlocks()),a=o.getFirstPosition(),l=e.model.document.getRoot(a.root.rootName),c=l.getChild(0);r===l.getChild(1)&&a.isAtStart&&(i.setSelection(c.getChild(0),0),n())}))}))}}function v(e,t,i){const n=t.modelCursor,o=t.viewItem;if(!n.isAtStart||!n.parent.is("element","$root"))return;if(!i.consumable.consume(o,{name:!0}))return;const s=i.writer,r=s.createElement("title"),a=s.createElement("title-content");s.append(a,r),s.insert(r,n),i.convertChildren(o,a),i.updateConversionResult(r,t)}function _(e){return(t,i)=>{const n=i.modelPosition.parent;if(!n.is("element","title"))return;const o=n.parent,s=i.mapper.toViewElement(o);i.viewPosition=e.createPositionAt(s,0),t.stop()}}function y(e){return e.is("element","title")}function k(e,t,i){const n=t.createElement("title");t.insert(n,e,"before"),t.insert(e,n,0),t.rename(e,"title-content"),i.schema.removeDisallowedAttributes([e],t)}function C(e,t,i){let n=!1;for(const o of e)0!==o.index&&(A(o,t,i),n=!0);return n}function A(e,t,i){const n=e.getChild(0);n.isEmpty?t.remove(e):(t.move(t.createRangeOn(n),e,"before"),t.rename(n,"paragraph"),t.remove(e),i.schema.removeDisallowedAttributes([n],t))}function E(e,t){return!(!e||!e.is("element","paragraph")||e.childCount||t.childCount<=2||t.getChild(t.childCount-1)!==e)}},174:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Highlight:()=>c,HighlightEditing:()=>s,HighlightUI:()=>a});var n=i(1204);class o extends n.uB{refresh(){const e=this.editor.model,t=e.document;this.value=t.selection.getAttribute("highlight"),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"highlight")}execute(e={}){const t=this.editor.model,i=t.document.selection,n=e.value;t.change((e=>{if(i.isCollapsed){const t=i.getFirstPosition();if(i.hasAttribute("highlight")){const i=e=>e.item.hasAttribute("highlight")&&e.item.getAttribute("highlight")===this.value,o=t.getLastMatchingPosition(i,{direction:"backward"}),s=t.getLastMatchingPosition(i),r=e.createRange(o,s);n&&this.value!==n?(t.isEqual(s)||e.setAttribute("highlight",n,r),e.setSelectionAttribute("highlight",n)):(t.isEqual(s)||e.removeAttribute("highlight",r),e.removeSelectionAttribute("highlight"))}else n&&e.setSelectionAttribute("highlight",n)}else{const o=t.schema.getValidRanges(i.getRanges(),"highlight");for(const t of o)n?e.setAttribute("highlight",n,t):e.removeAttribute("highlight",t)}}))}}class s extends n.k_{static get pluginName(){return"HighlightEditing"}constructor(e){super(e),e.config.define("highlight",{options:[{model:"yellowMarker",class:"marker-yellow",title:"Yellow marker",color:"var(--ck-highlight-marker-yellow)",type:"marker"},{model:"greenMarker",class:"marker-green",title:"Green marker",color:"var(--ck-highlight-marker-green)",type:"marker"},{model:"pinkMarker",class:"marker-pink",title:"Pink marker",color:"var(--ck-highlight-marker-pink)",type:"marker"},{model:"blueMarker",class:"marker-blue",title:"Blue marker",color:"var(--ck-highlight-marker-blue)",type:"marker"},{model:"redPen",class:"pen-red",title:"Red pen",color:"var(--ck-highlight-pen-red)",type:"pen"},{model:"greenPen",class:"pen-green",title:"Green pen",color:"var(--ck-highlight-pen-green)",type:"pen"}]})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"highlight"});const t=e.config.get("highlight.options");e.conversion.attributeToElement(function(e){const t={model:{key:"highlight",values:[]},view:{}};for(const i of e)t.model.values.push(i.model),t.view[i.model]={name:"mark",classes:i.class};return t}(t)),e.commands.add("highlight",new o(e))}}var r=i(949);class a extends n.k_{get localizedOptionTitles(){const e=this.editor.t;return{"Yellow marker":e("Yellow marker"),"Green marker":e("Green marker"),"Pink marker":e("Pink marker"),"Blue marker":e("Blue marker"),"Red pen":e("Red pen"),"Green pen":e("Green pen")}}static get pluginName(){return"HighlightUI"}init(){const e=this.editor.config.get("highlight.options");for(const t of e)this._addHighlighterButton(t);this._addRemoveHighlightButton(),this._addDropdown(e),this._addMenuBarButton(e)}_addRemoveHighlightButton(){const e=this.editor.t,t=this.editor.commands.get("highlight");this._addButton("removeHighlight",e("Remove highlight"),n.Pt.eraser,null,(e=>{e.bind("isEnabled").to(t,"isEnabled")}))}_addHighlighterButton(e){const t=this.editor.commands.get("highlight");this._addButton("highlight:"+e.model,e.title,l(e.type),e.model,(function(i){i.bind("isEnabled").to(t,"isEnabled"),i.bind("isOn").to(t,"value",(t=>t===e.model)),i.iconView.fillColor=e.color,i.isToggleable=!0}))}_addButton(e,t,i,n,o){const s=this.editor;s.ui.componentFactory.add(e,(e=>{const a=new r._(e),l=this.localizedOptionTitles[t]?this.localizedOptionTitles[t]:t;return a.set({label:l,icon:i,tooltip:!0}),a.on("execute",(()=>{s.execute("highlight",{value:n}),s.editing.view.focus()})),o(a),a}))}_addDropdown(e){const t=this.editor,i=t.t,n=t.ui.componentFactory,o=e[0],s=e.reduce(((e,t)=>(e[t.model]=t,e)),{});n.add("highlight",(a=>{const c=t.commands.get("highlight"),d=(0,r.yu)(a,r.AO),u=d.buttonView;function h(e,t){const i=e&&e!==u.lastExecuted?e:u.lastExecuted;return s[i][t]}return u.set({label:i("Highlight"),tooltip:!0,lastExecuted:o.model,commandValue:o.model,isToggleable:!0}),u.bind("icon").to(c,"value",(e=>l(h(e,"type")))),u.bind("color").to(c,"value",(e=>h(e,"color"))),u.bind("commandValue").to(c,"value",(e=>h(e,"model"))),u.bind("isOn").to(c,"value",(e=>!!e)),u.delegate("execute").to(d),d.bind("isEnabled").to(c,"isEnabled"),(0,r.fM)(d,(()=>{const t=e.map((e=>{const t=n.create("highlight:"+e.model);return this.listenTo(t,"execute",(()=>{d.buttonView.set({lastExecuted:e.model})})),t}));return t.push(new r.IY),t.push(n.create("removeHighlight")),t}),{enableActiveItemFocusOnDropdownOpen:!0,ariaLabel:i("Text highlight toolbar")}),function(e){e.buttonView.actionView.iconView.bind("fillColor").to(e.buttonView,"color")}(d),u.on("execute",(()=>{t.execute("highlight",{value:u.commandValue})})),this.listenTo(d,"execute",(()=>{t.editing.view.focus()})),d}))}_addMenuBarButton(e){const t=this.editor,i=t.t,o=t.commands.get("highlight");t.ui.componentFactory.add("menuBar:highlight",(s=>{const a=new r.zj(s);a.buttonView.set({label:i("Highlight"),icon:l("marker")}),a.bind("isEnabled").to(o),a.buttonView.iconView.fillColor="transparent";const c=new r.BY(s);for(const i of e){const e=new r.I8(s,a),n=new r.kS(s);n.set({label:i.title,icon:l(i.type),role:"menuitemradio",isToggleable:!0}),n.iconView.fillColor=i.color,n.delegate("execute").to(a),n.bind("isOn").to(o,"value",(e=>e===i.model)),n.on("execute",(()=>{t.execute("highlight",{value:i.model}),t.editing.view.focus()})),e.children.add(n),c.items.add(e)}c.items.add(new r.Je(s));const d=new r.I8(s,a),u=new r.kS(s);return u.set({label:i("Remove highlight"),icon:n.Pt.eraser}),u.delegate("execute").to(a),u.on("execute",(()=>{t.execute("highlight",{value:null}),t.editing.view.focus()})),d.children.add(u),c.items.add(d),a.panelView.children.add(c),a}))}}function l(e){return"marker"===e?'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path class="ck-icon__fill" d="M10.798 1.59 3.002 12.875l1.895 1.852 2.521 1.402 6.997-12.194z"/><path d="m2.556 16.727.234-.348c-.297-.151-.462-.293-.498-.426-.036-.137.002-.416.115-.837.094-.25.15-.449.169-.595a4.495 4.495 0 0 0 0-.725c-.209-.621-.303-1.041-.284-1.26.02-.218.178-.506.475-.862l6.77-9.414c.539-.91 1.605-.85 3.199.18 1.594 1.032 2.188 1.928 1.784 2.686l-5.877 10.36c-.158.412-.333.673-.526.782-.193.108-.604.179-1.232.21-.362.131-.608.237-.738.318-.13.081-.305.238-.526.47-.293.265-.504.397-.632.397-.096 0-.27-.075-.524-.226l-.31.41-1.6-1.12zm-.279.415 1.575 1.103-.392.515H1.19l1.087-1.618zm8.1-13.656-4.953 6.9L8.75 12.57l4.247-7.574c.175-.25-.188-.647-1.092-1.192-.903-.546-1.412-.652-1.528-.32zM8.244 18.5 9.59 17h9.406v1.5H8.245z"/></svg>':'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path class="ck-icon__fill" d="M10.126 2.268 2.002 13.874l1.895 1.852 2.521 1.402L14.47 5.481l-1.543-2.568-2.801-.645z"/><path d="m4.5 18.088-2.645-1.852-.04-2.95-.006-.005.006-.008v-.025l.011.008L8.73 2.97c.165-.233.356-.417.567-.557l-1.212.308L4.604 7.9l-.83-.558 3.694-5.495 2.708-.69 1.65 1.145.046.018.85-1.216 2.16 1.512-.856 1.222c.828.967 1.144 2.141.432 3.158L7.55 17.286l.006.005-3.055.797H4.5zm-.634.166-1.976.516-.026-1.918 2.002 1.402zM9.968 3.817l-.006-.004-6.123 9.184 3.277 2.294 6.108-9.162.005.003c.317-.452-.16-1.332-1.064-1.966-.891-.624-1.865-.776-2.197-.349zM8.245 18.5 9.59 17h9.406v1.5H8.245z"/></svg>'}class c extends n.k_{static get requires(){return[s,a]}static get pluginName(){return"Highlight"}}},9306:(e,t,i)=>{"use strict";i.r(t),i.d(t,{HorizontalLine:()=>c,HorizontalLineEditing:()=>r,HorizontalLineUI:()=>l});var n=i(1204),o=i(5091);class s extends n.uB{refresh(){const e=this.editor.model,t=e.schema,i=e.document.selection;this.isEnabled=function(e,t,i){const n=function(e,t){const i=(0,o.iB)(e,t).start.parent;return i.isEmpty&&!i.is("element","$root")?i.parent:i}(e,i);return t.checkChild(n,"horizontalLine")}(i,t,e)}execute(){const e=this.editor.model;e.change((t=>{const i=t.createElement("horizontalLine");e.insertObject(i,null,null,{setSelection:"after"})}))}}class r extends n.k_{static get pluginName(){return"HorizontalLineEditing"}init(){const e=this.editor,t=e.model.schema,i=e.t,n=e.conversion;t.register("horizontalLine",{inheritAllFrom:"$blockObject"}),n.for("dataDowncast").elementToElement({model:"horizontalLine",view:(e,{writer:t})=>t.createEmptyElement("hr")}),n.for("editingDowncast").elementToStructure({model:"horizontalLine",view:(e,{writer:t})=>{const n=i("Horizontal line"),s=t.createContainerElement("div",null,t.createEmptyElement("hr"));return t.addClass("ck-horizontal-line",s),t.setCustomProperty("hr",!0,s),function(e,t,i){return t.setCustomProperty("horizontalLine",!0,e),(0,o.Ex)(e,t,{label:i})}(s,t,n)}}),n.for("upcast").elementToElement({view:"hr",model:"horizontalLine"}),e.commands.add("horizontalLine",new s(e))}}var a=i(949);class l extends n.k_{static get pluginName(){return"HorizontalLineUI"}init(){const e=this.editor;e.ui.componentFactory.add("horizontalLine",(()=>{const e=this._createButton(a._);return e.set({tooltip:!0}),e})),e.ui.componentFactory.add("menuBar:horizontalLine",(()=>this._createButton(a.kS)))}_createButton(e){const t=this.editor,i=t.locale,o=t.commands.get("horizontalLine"),s=new e(t.locale),r=i.t;return s.set({label:r("Horizontal line"),icon:n.Pt.horizontalLine}),s.bind("isEnabled").to(o,"isEnabled"),this.listenTo(s,"execute",(()=>{t.execute("horizontalLine"),t.editing.view.focus()})),s}}class c extends n.k_{static get requires(){return[r,l,o.x0]}static get pluginName(){return"HorizontalLine"}}},9090:(e,t,i)=>{"use strict";i.r(t),i.d(t,{HtmlEmbed:()=>h,HtmlEmbedEditing:()=>c,HtmlEmbedUI:()=>u});var n=i(1204),o=i(5091),s=i(949),r=i(5318);class a extends n.uB{refresh(){const e=this.editor.model,t=e.schema,i=e.document.selection,n=l(i);this.isEnabled=function(e,t,i){const n=function(e,t){const i=(0,o.iB)(e,t).start.parent;return i.isEmpty&&!i.is("rootElement")?i.parent:i}(e,i);return t.checkChild(n,"rawHtml")}(i,t,e),this.value=n?n.getAttribute("value")||"":null}execute(e){const t=this.editor.model,i=t.document.selection;t.change((n=>{let o;null!==this.value?o=l(i):(o=n.createElement("rawHtml"),t.insertObject(o,null,null,{setSelection:"on"})),n.setAttribute("value",e,o)}))}}function l(e){const t=e.getSelectedElement();return t&&t.is("element","rawHtml")?t:null}class c extends n.k_{static get pluginName(){return"HtmlEmbedEditing"}constructor(e){super(e),this._widgetButtonViewReferences=new Set;const t=e.config.get("htmlEmbed.sanitizeHtml")||function(e){return(0,r.FF)("html-embed-provide-sanitize-function"),{html:e,hasChanged:!1}};e.config.define("sanitizeHtml",t),e.config.define("htmlEmbed.showPreviews",!1)}init(){const e=this.editor;e.model.schema.register("rawHtml",{inheritAllFrom:"$blockObject",allowAttributes:["value"]}),e.commands.add("htmlEmbed",new a(e)),this._setupConversion()}_setupConversion(){const e=this.editor,t=e.t,i=e.editing.view,n=this._widgetButtonViewReferences,s=e.config.get("htmlEmbed.showPreviews"),a=e.config.get("sanitizeHtml");function l({editor:e,domElement:i,state:o,props:s}){i.textContent="";const a=i.ownerDocument;let l;if(o.isEditable){const e={isDisabled:!1,placeholder:s.textareaPlaceholder};l=c({domDocument:a,state:o,props:e}),i.append(l)}else if(o.showPreviews){const n={sanitizeHtml:s.sanitizeHtml};i.append(function({editor:e,domDocument:i,state:n,props:o}){const s=o.sanitizeHtml(n.getRawHtmlValue()),a=n.getRawHtmlValue().length>0?t("No preview available"):t("Empty snippet content"),l=(0,r.n)(i,"div",{class:"ck ck-reset_all raw-html-embed__preview-placeholder"},a),c=(0,r.n)(i,"div",{class:"raw-html-embed__preview-content",dir:e.locale.contentLanguageDirection}),d=i.createRange().createContextualFragment(s.html);c.appendChild(d);return(0,r.n)(i,"div",{class:"raw-html-embed__preview"},[l,c])}({domDocument:a,state:o,props:n,editor:e}))}else{const e={isDisabled:!0,placeholder:s.textareaPlaceholder};i.append(c({domDocument:a,state:o,props:e}))}const u={onEditClick:s.onEditClick,onSaveClick:()=>{s.onSaveClick(l.value)},onCancelClick:s.onCancelClick};i.prepend(function({editor:e,domDocument:t,state:i,props:o}){const s=(0,r.n)(t,"div",{class:"raw-html-embed__buttons-wrapper"});if(i.isEditable){const t=d(e,"save",o.onSaveClick),i=d(e,"cancel",o.onCancelClick);s.append(t.element,i.element),n.add(t).add(i)}else{const t=d(e,"edit",o.onEditClick);s.append(t.element),n.add(t)}return s}({editor:e,domDocument:a,state:o,props:u}))}function c({domDocument:e,state:t,props:i}){const n=(0,r.n)(e,"textarea",{placeholder:i.placeholder,class:"ck ck-reset ck-input ck-input-text raw-html-embed__source"});return n.disabled=i.isDisabled,n.value=t.getRawHtmlValue(),n}this.editor.editing.view.on("render",(()=>{for(const e of n){if(e.element&&e.element.isConnected)return;e.destroy(),n.delete(e)}}),{priority:"lowest"}),e.data.registerRawContentMatcher({name:"div",classes:"raw-html-embed"}),e.conversion.for("upcast").elementToElement({view:{name:"div",classes:"raw-html-embed"},model:(e,{writer:t})=>t.createElement("rawHtml",{value:e.getCustomProperty("$rawContent")})}),e.conversion.for("dataDowncast").elementToElement({model:"rawHtml",view:(e,{writer:t})=>t.createRawElement("div",{class:"raw-html-embed"},(function(t){t.innerHTML=e.getAttribute("value")||""}))}),e.conversion.for("editingDowncast").elementToStructure({model:{name:"rawHtml",attributes:["value"]},view:(n,{writer:r})=>{let c,d,u;const h=r.createRawElement("div",{class:"raw-html-embed__content-wrapper"},(function(t){c=t,l({editor:e,domElement:t,state:d,props:u}),c.addEventListener("mousedown",(()=>{if(d.isEditable){const t=e.model;t.document.selection.getSelectedElement()!==n&&t.change((e=>e.setSelection(n,"on")))}}),!0)})),m={makeEditable(){d=Object.assign({},d,{isEditable:!0}),l({domElement:c,editor:e,state:d,props:u}),i.change((e=>{e.setAttribute("data-cke-ignore-events","true",h)})),c.querySelector("textarea").focus()},save(t){t!==d.getRawHtmlValue()?(e.execute("htmlEmbed",t),e.editing.view.focus()):this.cancel()},cancel(){d=Object.assign({},d,{isEditable:!1}),l({domElement:c,editor:e,state:d,props:u}),e.editing.view.focus(),i.change((e=>{e.removeAttribute("data-cke-ignore-events",h)}))}};d={showPreviews:s,isEditable:!1,getRawHtmlValue:()=>n.getAttribute("value")||""},u={sanitizeHtml:a,textareaPlaceholder:t("Paste raw HTML here..."),onEditClick(){m.makeEditable()},onSaveClick(e){m.save(e)},onCancelClick(){m.cancel()}};const g=r.createContainerElement("div",{class:"raw-html-embed","data-html-embed-label":t("HTML snippet"),dir:e.locale.uiLanguageDirection},h);return r.setCustomProperty("rawHtmlApi",m,g),r.setCustomProperty("rawHtml",!0,g),(0,o.Ex)(g,r,{label:t("HTML snippet"),hasSelectionHandle:!0})}})}}function d(e,t,i){const{t:o}=e.locale,r=new s._(e.locale),a=e.commands.get("htmlEmbed");return r.set({class:`raw-html-embed__${t}-button`,icon:n.Pt.pencil,tooltip:!0,tooltipPosition:"rtl"===e.locale.uiLanguageDirection?"e":"w"}),r.render(),"edit"===t?(r.set({icon:n.Pt.pencil,label:o("Edit source")}),r.bind("isEnabled").to(a)):"save"===t?(r.set({icon:n.Pt.check,label:o("Save changes")}),r.bind("isEnabled").to(a)):r.set({icon:n.Pt.cancel,label:o("Cancel")}),r.on("execute",i),r}class u extends n.k_{static get pluginName(){return"HtmlEmbedUI"}init(){const e=this.editor,t=e.locale.t;e.ui.componentFactory.add("htmlEmbed",(()=>{const e=this._createButton(s._);return e.set({tooltip:!0,label:t("Insert HTML")}),e})),e.ui.componentFactory.add("menuBar:htmlEmbed",(()=>{const e=this._createButton(s.kS);return e.set({label:t("HTML snippet")}),e}))}_createButton(e){const t=this.editor,i=t.commands.get("htmlEmbed"),o=new e(t.locale);return o.set({icon:n.Pt.html}),o.bind("isEnabled").to(i,"isEnabled"),this.listenTo(o,"execute",(()=>{t.execute("htmlEmbed"),t.editing.view.focus(),t.editing.view.document.selection.getSelectedElement().getCustomProperty("rawHtmlApi").makeEditable()})),o}}class h extends n.k_{static get requires(){return[c,u,o.x0]}static get pluginName(){return"HtmlEmbed"}}},5048:(e,t,i)=>{"use strict";i.r(t),i.d(t,{AutoImage:()=>v,Image:()=>H,ImageBlock:()=>D,ImageBlockEditing:()=>L,ImageCaption:()=>K,ImageCaptionEditing:()=>j,ImageCaptionUI:()=>q,ImageCaptionUtils:()=>U,ImageCustomResizeUI:()=>Me,ImageEditing:()=>R,ImageInline:()=>W,ImageInsert:()=>ue,ImageInsertUI:()=>N,ImageInsertViaUrl:()=>de,ImageResize:()=>Oe,ImageResizeButtons:()=>Ae,ImageResizeEditing:()=>ke,ImageResizeHandles:()=>Ie,ImageSizeAttributes:()=>B,ImageStyle:()=>Je,ImageStyleEditing:()=>Ue,ImageStyleUI:()=>qe,ImageTextAlternative:()=>x,ImageTextAlternativeEditing:()=>y,ImageTextAlternativeUI:()=>E,ImageToolbar:()=>Qe,ImageUpload:()=>ae,ImageUploadEditing:()=>se,ImageUploadProgress:()=>Y,ImageUploadUI:()=>J,ImageUtils:()=>p,PictureEditing:()=>Ye});var n=i(1204),o=i(7377),s=i(4133),r=i(6417),a=i(7211),l=i(5318),c=i(5091);function d(e){return e.createContainerElement("figure",{class:"image"},[e.createEmptyElement("img"),e.createSlot("children")])}function u(e,t){const i=e.plugins.get("ImageUtils"),n=e.plugins.has("ImageInlineEditing")&&e.plugins.has("ImageBlockEditing");return e=>i.isInlineImageView(e)?n&&("block"==e.getStyle("display")||e.findAncestor(i.isBlockImageView)?"imageBlock":"imageInline")!==t?null:o(e):null;function o(e){const t={name:!0};return e.hasAttribute("src")&&(t.attributes=["src"]),t}}function h(e,t){const i=(0,l.$1)(t.getSelectedBlocks());return!i||e.isObject(i)||i.isEmpty&&"listItem"!=i.name?"imageBlock":"imageInline"}function m(e){return e&&e.endsWith("px")?parseInt(e):null}function g(e){const t=m(e.getStyle("width")),i=m(e.getStyle("height"));return!(!t||!i)}const f=/^(image|image-inline)$/;class p extends n.k_{constructor(){super(...arguments),this._domEmitter=new((0,l.c5)())}static get pluginName(){return"ImageUtils"}isImage(e){return this.isInlineImage(e)||this.isBlockImage(e)}isInlineImageView(e){return!!e&&e.is("element","img")}isBlockImageView(e){return!!e&&e.is("element","figure")&&e.hasClass("image")}insertImage(e={},t=null,i=null,n={}){const o=this.editor,s=o.model,r=s.document.selection,a=b(o,t||r,i);e={...Object.fromEntries(r.getAttributes()),...e};for(const t in e)s.schema.checkAttribute(a,t)||delete e[t];return s.change((i=>{const{setImageSizes:o=!0}=n,r=i.createElement(a,e);return s.insertObject(r,t,null,{setSelection:"on",findOptimalPosition:t||"imageInline"==a?void 0:"auto"}),r.parent?(o&&this.setImageNaturalSizeAttributes(r),r):null}))}setImageNaturalSizeAttributes(e){const t=e.getAttribute("src");t&&(e.getAttribute("width")||e.getAttribute("height")||this.editor.model.change((i=>{const n=new l.Sf.window.Image;this._domEmitter.listenTo(n,"load",(()=>{e.getAttribute("width")||e.getAttribute("height")||this.editor.model.enqueueChange(i.batch,(t=>{t.setAttribute("width",n.naturalWidth,e),t.setAttribute("height",n.naturalHeight,e)})),this._domEmitter.stopListening(n,"load")})),n.src=t})))}getClosestSelectedImageWidget(e){const t=e.getFirstPosition();if(!t)return null;const i=e.getSelectedElement();if(i&&this.isImageWidget(i))return i;let n=t.parent;for(;n;){if(n.is("element")&&this.isImageWidget(n))return n;n=n.parent}return null}getClosestSelectedImageElement(e){const t=e.getSelectedElement();return this.isImage(t)?t:e.getFirstPosition().findAncestor("imageBlock")}getImageWidgetFromImageView(e){return e.findAncestor({classes:f})}isImageAllowed(){const e=this.editor.model.document.selection;return function(e,t){if("imageBlock"==b(e,t,null)){const i=function(e,t){const i=(0,c.iB)(e,t).start.parent;return i.isEmpty&&!i.is("element","$root")?i.parent:i}(t,e.model);if(e.model.schema.checkChild(i,"imageBlock"))return!0}else if(e.model.schema.checkChild(t.focus,"imageInline"))return!0;return!1}(this.editor,e)&&function(e){return[...e.focus.getAncestors()].every((e=>!e.is("element","imageBlock")))}(e)}toImageWidget(e,t,i){return t.setCustomProperty("image",!0,e),(0,c.Ex)(e,t,{label:()=>{const t=this.findViewImgElement(e).getAttribute("alt");return t?`${t} ${i}`:i}})}isImageWidget(e){return!!e.getCustomProperty("image")&&(0,c.p4)(e)}isBlockImage(e){return!!e&&e.is("element","imageBlock")}isInlineImage(e){return!!e&&e.is("element","imageInline")}findViewImgElement(e){if(this.isInlineImageView(e))return e;const t=this.editor.editing.view;for(const{item:i}of t.createRangeIn(e))if(this.isInlineImageView(i))return i}destroy(){return this._domEmitter.stopListening(),super.destroy()}}function b(e,t,i){const n=e.model.schema,o=e.config.get("image.insert.type");return e.plugins.has("ImageBlockEditing")?e.plugins.has("ImageInlineEditing")?i||("inline"===o?"imageInline":"auto"!==o?"imageBlock":t.is("selection")?h(n,t):n.checkChild(t,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}const w=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 v extends n.k_{static get requires(){return[o.B0,p,r.Vn,a.ep]}static get pluginName(){return"AutoImage"}constructor(e){super(e),this._timeoutId=null,this._positionToInsert=null}init(){const e=this.editor,t=e.model.document,i=e.plugins.get("ClipboardPipeline");this.listenTo(i,"inputTransformation",(()=>{const e=t.selection.getFirstRange(),i=s.m8.fromPosition(e.start);i.stickiness="toPrevious";const n=s.m8.fromPosition(e.end);n.stickiness="toNext",t.once("change:data",(()=>{this._embedImageBetweenPositions(i,n),i.detach(),n.detach()}),{priority:"high"})})),e.commands.get("undo").on("execute",(()=>{this._timeoutId&&(l.Sf.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)}),{priority:"high"})}_embedImageBetweenPositions(e,t){const i=this.editor,n=new s.Oo(e,t),o=n.getWalker({ignoreElementEnd:!0}),r=Object.fromEntries(i.model.document.selection.getAttributes()),a=this.editor.plugins.get("ImageUtils");let l="";for(const e of o)e.item.is("$textProxy")&&(l+=e.item.data);l=l.trim(),l.match(w)?(this._positionToInsert=s.m8.fromPosition(e),this._timeoutId=setTimeout((()=>{i.commands.get("insertImage").isEnabled?(i.model.change((e=>{let t;this._timeoutId=null,e.remove(n),n.detach(),"$graveyard"!==this._positionToInsert.root.rootName&&(t=this._positionToInsert.toPosition()),a.insertImage({...r,src:l},t),this._positionToInsert.detach(),this._positionToInsert=null})),i.plugins.get("Delete").requestUndoOnBackspace()):n.detach()}),100)):n.detach()}}class _ extends n.uB{refresh(){const e=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!e,this.isEnabled&&e.hasAttribute("alt")?this.value=e.getAttribute("alt"):this.value=!1}execute(e){const t=this.editor,i=t.plugins.get("ImageUtils"),n=t.model,o=i.getClosestSelectedImageElement(n.document.selection);n.change((t=>{t.setAttribute("alt",e.newValue,o)}))}}class y extends n.k_{static get requires(){return[p]}static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new _(this.editor))}}var k=i(949);class C extends k.Ss{constructor(e){super(e);const t=this.locale.t;this.focusTracker=new l.$x,this.keystrokes=new l.EP,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(t("Save"),n.Pt.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(t("Cancel"),n.Pt.cancel,"ck-button-cancel","cancel"),this._focusables=new k.s3,this._focusCycler=new k.H({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),(0,k.Z5)({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(e,t,i,n){const o=new k._(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o.extendTemplate({attributes:{class:i}}),n&&o.delegate("execute").to(this,n),o}_createLabeledInputView(){const e=this.locale.t,t=new k.xE(this.locale,k.Vr);return t.label=e("Text alternative"),t}}function A(e){const t=e.editing.view,i=k.Jr.defaultPositions,n=e.plugins.get("ImageUtils");return{target:t.domConverter.mapViewToDom(n.getClosestSelectedImageWidget(t.document.selection)),positions:[i.northArrowSouth,i.northArrowSouthWest,i.northArrowSouthEast,i.southArrowNorth,i.southArrowNorthWest,i.southArrowNorthEast,i.viewportStickyNorth]}}class E extends n.k_{static get requires(){return[k.pU]}static get pluginName(){return"ImageTextAlternativeUI"}init(){this._createButton()}destroy(){super.destroy(),this._form&&this._form.destroy()}_createButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("imageTextAlternative",(i=>{const o=e.commands.get("imageTextAlternative"),s=new k._(i);return s.set({label:t("Change image text alternative"),icon:n.Pt.textAlternative,tooltip:!0}),s.bind("isEnabled").to(o,"isEnabled"),s.bind("isOn").to(o,"value",(e=>!!e)),this.listenTo(s,"execute",(()=>{this._showForm()})),s}))}_createForm(){const e=this.editor,t=e.editing.view.document,i=e.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new((0,k.wi)(C))(e.locale),this._form.render(),this.listenTo(this._form,"submit",(()=>{e.execute("imageTextAlternative",{newValue:this._form.labeledInput.fieldView.element.value}),this._hideForm(!0)})),this.listenTo(this._form,"cancel",(()=>{this._hideForm(!0)})),this._form.keystrokes.set("Esc",((e,t)=>{this._hideForm(!0),t()})),this.listenTo(e.ui,"update",(()=>{i.getClosestSelectedImageWidget(t.selection)?this._isVisible&&function(e){const t=e.plugins.get("ContextualBalloon");if(e.plugins.get("ImageUtils").getClosestSelectedImageWidget(e.editing.view.document.selection)){const i=A(e);t.updatePosition(i)}}(e):this._hideForm(!0)})),(0,k.wy)({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;this._form||this._createForm();const e=this.editor,t=e.commands.get("imageTextAlternative"),i=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:A(e)}),i.fieldView.value=i.fieldView.element.value=t.value||"",this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(e=!1){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),e&&this.editor.editing.view.focus())}get _isVisible(){return!!this._balloon&&this._balloon.visibleView===this._form}get _isInBalloon(){return!!this._balloon&&this._balloon.hasView(this._form)}}class x extends n.k_{static get requires(){return[y,E]}static get pluginName(){return"ImageTextAlternative"}}function T(e,t){const i=(t,i,n)=>{if(!n.consumable.consume(i.item,t.name))return;const o=n.writer,s=n.mapper.toViewElement(i.item),r=e.findViewImgElement(s);null===i.attributeNewValue?(o.removeAttribute("srcset",r),o.removeAttribute("sizes",r)):i.attributeNewValue&&(o.setAttribute("srcset",i.attributeNewValue,r),o.setAttribute("sizes","100vw",r))};return e=>{e.on(`attribute:srcset:${t}`,i)}}function P(e,t,i){const n=(t,i,n)=>{if(!n.consumable.consume(i.item,t.name))return;const o=n.writer,s=n.mapper.toViewElement(i.item),r=e.findViewImgElement(s);o.setAttribute(i.attributeKey,i.attributeNewValue||"",r)};return e=>{e.on(`attribute:${i}:${t}`,n)}}class I extends s.nu{observe(e){this.listenTo(e,"load",((e,t)=>{const i=t.target;this.checkShouldIgnoreEventFromTarget(i)||"IMG"==i.tagName&&this._fireEvents(t)}),{useCapture:!0})}stopObserving(e){this.stopListening(e)}_fireEvents(e){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",e))}}class S extends n.uB{constructor(e){super(e);const t=e.config.get("image.insert.type");e.plugins.has("ImageBlockEditing")||"block"===t&&(0,l.FF)("image-block-plugin-required"),e.plugins.has("ImageInlineEditing")||"inline"===t&&(0,l.FF)("image-inline-plugin-required")}refresh(){const e=this.editor.plugins.get("ImageUtils");this.isEnabled=e.isImageAllowed()}execute(e){const t=(0,l.$r)(e.source),i=this.editor.model.document.selection,n=this.editor.plugins.get("ImageUtils"),o=Object.fromEntries(i.getAttributes());t.forEach(((e,t)=>{const s=i.getSelectedElement();if("string"==typeof e&&(e={src:e}),t&&s&&n.isImage(s)){const t=this.editor.model.createPositionAfter(s);n.insertImage({...e,...o},t)}else n.insertImage({...e,...o})}))}}class V extends n.uB{constructor(e){super(e),this.decorate("cleanupImage")}refresh(){const e=this.editor.plugins.get("ImageUtils"),t=this.editor.model.document.selection.getSelectedElement();this.isEnabled=e.isImage(t),this.value=this.isEnabled?t.getAttribute("src"):null}execute(e){const t=this.editor.model.document.selection.getSelectedElement(),i=this.editor.plugins.get("ImageUtils");this.editor.model.change((n=>{n.setAttribute("src",e.source,t),this.cleanupImage(n,t),i.setImageNaturalSizeAttributes(t)}))}cleanupImage(e,t){e.removeAttribute("srcset",t),e.removeAttribute("sizes",t),e.removeAttribute("sources",t),e.removeAttribute("width",t),e.removeAttribute("height",t),e.removeAttribute("alt",t)}}class R extends n.k_{static get requires(){return[p]}static get pluginName(){return"ImageEditing"}init(){const e=this.editor,t=e.conversion;e.editing.view.addObserver(I),t.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:"srcset"});const i=new S(e),n=new V(e);e.commands.add("insertImage",i),e.commands.add("replaceImageSource",n),e.commands.add("imageInsert",i)}}class B extends n.k_{static get requires(){return[p]}static get pluginName(){return"ImageSizeAttributes"}afterInit(){this._registerSchema(),this._registerConverters("imageBlock"),this._registerConverters("imageInline")}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:["width","height"]}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:["width","height"]})}_registerConverters(e){const t=this.editor,i=t.plugins.get("ImageUtils"),n="imageBlock"===e?"figure":"img";function o(t,n,o,s){t.on(`attribute:${n}:${e}`,((t,n,r)=>{if(!r.consumable.consume(n.item,t.name))return;const a=r.writer,l=r.mapper.toViewElement(n.item),c=i.findViewImgElement(l);if(null!==n.attributeNewValue?a.setAttribute(o,n.attributeNewValue,c):a.removeAttribute(o,c),n.item.hasAttribute("sources"))return;const d=n.item.hasAttribute("resizedWidth");if("imageInline"===e&&!d&&!s)return;const u=n.item.getAttribute("width"),h=n.item.getAttribute("height");u&&h&&a.setStyle("aspect-ratio",`${u}/${h}`,c)}))}t.conversion.for("upcast").attributeToAttribute({view:{name:n,styles:{width:/.+/}},model:{key:"width",value:e=>g(e)?m(e.getStyle("width")):null}}).attributeToAttribute({view:{name:n,key:"width"},model:"width"}).attributeToAttribute({view:{name:n,styles:{height:/.+/}},model:{key:"height",value:e=>g(e)?m(e.getStyle("height")):null}}).attributeToAttribute({view:{name:n,key:"height"},model:"height"}),t.conversion.for("editingDowncast").add((e=>{o(e,"width","width",!0),o(e,"height","height",!0)})),t.conversion.for("dataDowncast").add((e=>{o(e,"width","width",!1),o(e,"height","height",!1)}))}}class M extends n.uB{constructor(e,t){super(e),this._modelElementName=t}refresh(){const e=this.editor.plugins.get("ImageUtils"),t=e.getClosestSelectedImageElement(this.editor.model.document.selection);"imageBlock"===this._modelElementName?this.isEnabled=e.isInlineImage(t):this.isEnabled=e.isBlockImage(t)}execute(e={}){const t=this.editor,i=this.editor.model,n=t.plugins.get("ImageUtils"),o=n.getClosestSelectedImageElement(i.document.selection),s=Object.fromEntries(o.getAttributes());return s.src||s.uploadId?i.change((t=>{const{setImageSizes:r=!0}=e,a=Array.from(i.markers).filter((e=>e.getRange().containsItem(o))),l=n.insertImage(s,i.createSelection(o,"on"),this._modelElementName,{setImageSizes:r});if(!l)return null;const c=t.createRangeOn(l);for(const e of a){const i=e.getRange(),n="$graveyard"!=i.root.rootName?i.getJoined(c,!0):c;t.updateMarker(e,{range:n})}return{oldElement:o,newElement:l}})):null}}class O extends n.k_{static get requires(){return[p]}static get pluginName(){return"ImagePlaceholder"}afterInit(){this._setupSchema(),this._setupConversion(),this._setupLoadListener()}_setupSchema(){const e=this.editor.model.schema;e.isRegistered("imageBlock")&&e.extend("imageBlock",{allowAttributes:["placeholder"]}),e.isRegistered("imageInline")&&e.extend("imageInline",{allowAttributes:["placeholder"]})}_setupConversion(){const e=this.editor,t=e.conversion,i=e.plugins.get("ImageUtils");t.for("editingDowncast").add((e=>{e.on("attribute:placeholder",((e,t,n)=>{if(!n.consumable.test(t.item,e.name))return;if(!t.item.is("element","imageBlock")&&!t.item.is("element","imageInline"))return;n.consumable.consume(t.item,e.name);const o=n.writer,s=n.mapper.toViewElement(t.item),r=i.findViewImgElement(s);t.attributeNewValue?(o.addClass("image_placeholder",r),o.setStyle("background-image",`url(${t.attributeNewValue})`,r),o.setCustomProperty("editingPipeline:doNotReuseOnce",!0,r)):(o.removeClass("image_placeholder",r),o.removeStyle("background-image",r))}))}))}_setupLoadListener(){const e=this.editor,t=e.model,i=e.editing,n=i.view,o=e.plugins.get("ImageUtils");n.addObserver(I),this.listenTo(n.document,"imageLoaded",((e,s)=>{const r=n.domConverter.mapDomToView(s.target);if(!r)return;const a=o.getImageWidgetFromImageView(r);if(!a)return;const l=i.mapper.toModelElement(a);l&&l.hasAttribute("placeholder")&&t.enqueueChange({isUndoable:!1},(e=>{e.removeAttribute("placeholder",l)}))}))}}class L extends n.k_{static get requires(){return[R,B,p,O,o.xz]}static get pluginName(){return"ImageBlockEditing"}init(){const e=this.editor;e.model.schema.register("imageBlock",{inheritAllFrom:"$blockObject",allowAttributes:["alt","src","srcset"]}),this._setupConversion(),e.plugins.has("ImageInlineEditing")&&(e.commands.add("imageTypeBlock",new M(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,i=e.conversion,n=e.plugins.get("ImageUtils");i.for("dataDowncast").elementToStructure({model:"imageBlock",view:(e,{writer:t})=>d(t)}),i.for("editingDowncast").elementToStructure({model:"imageBlock",view:(e,{writer:i})=>n.toImageWidget(d(i),i,t("image widget"))}),i.for("downcast").add(P(n,"imageBlock","src")).add(P(n,"imageBlock","alt")).add(T(n,"imageBlock")),i.for("upcast").elementToElement({view:u(e,"imageBlock"),model:(e,{writer:t})=>t.createElement("imageBlock",e.hasAttribute("src")?{src:e.getAttribute("src")}:void 0)}).add(function(e){const t=(t,i,n)=>{if(!n.consumable.test(i.viewItem,{name:!0,classes:"image"}))return;const o=e.findViewImgElement(i.viewItem);if(!o||!n.consumable.test(o,{name:!0}))return;n.consumable.consume(i.viewItem,{name:!0,classes:"image"});const s=n.convertItem(o,i.modelCursor),r=(0,l.$1)(s.modelRange.getItems());r?(n.convertChildren(i.viewItem,r),n.updateConversionResult(r,i)):n.consumable.revert(i.viewItem,{name:!0,classes:"image"})};return e=>{e.on("element:figure",t)}}(n))}_setupClipboardIntegration(){const e=this.editor,t=e.model,i=e.editing.view,n=e.plugins.get("ImageUtils"),o=e.plugins.get("ClipboardPipeline");this.listenTo(o,"inputTransformation",((o,r)=>{const a=Array.from(r.content.getChildren());let l;if(!a.every(n.isInlineImageView))return;l=r.targetRanges?e.editing.mapper.toModelRange(r.targetRanges[0]):t.document.selection.getFirstRange();const c=t.createSelection(l);if("imageBlock"===h(t.schema,c)){const e=new s.Wq(i.document),t=a.map((t=>e.createElement("figure",{class:"image"},t)));r.content=e.createDocumentFragment(t)}})),this.listenTo(o,"contentInsertion",((e,i)=>{"paste"===i.method&&t.change((e=>{const t=e.createRangeIn(i.content);for(const e of t.getItems())e.is("element","imageBlock")&&n.setImageNaturalSizeAttributes(e)}))}))}}class F extends k.Ss{constructor(e,t=[]){super(e),this.focusTracker=new l.$x,this.keystrokes=new l.EP,this._focusables=new k.s3,this.children=this.createCollection(),this._focusCycler=new k.H({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});for(const e of t)this.children.add(e),this._focusables.add(e),e instanceof k.Kn&&this._focusables.addMany(e.children);this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-insert-form"],tabindex:-1},children:this.children})}render(){super.render(),(0,k.Z5)({view:this});for(const e of this._focusables)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element);const e=e=>e.stopPropagation();this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}}class N extends n.k_{static get pluginName(){return"ImageInsertUI"}static get requires(){return[p]}constructor(e){super(e),this._integrations=new Map,e.config.define("image.insert.integrations",["upload","assetManager","url"])}init(){const e=this.editor,t=e.model.document.selection,i=e.plugins.get("ImageUtils");this.set("isImageSelected",!1),this.listenTo(e.model.document,"change",(()=>{this.isImageSelected=i.isImage(t.getSelectedElement())}));const n=e=>this._createToolbarComponent(e);e.ui.componentFactory.add("insertImage",n),e.ui.componentFactory.add("imageInsert",n),e.ui.componentFactory.add("menuBar:insertImage",(e=>this._createMenuBarComponent(e)))}registerIntegration({name:e,observable:t,buttonViewCreator:i,formViewCreator:n,menuBarButtonViewCreator:o,requiresForm:s=!1}){this._integrations.has(e)&&(0,l.FF)("image-insert-integration-exists",{name:e}),this._integrations.set(e,{observable:t,buttonViewCreator:i,menuBarButtonViewCreator:o,formViewCreator:n,requiresForm:s})}_createToolbarComponent(e){const t=this.editor,i=e.t,n=this._prepareIntegrations();if(!n.length)return null;let o;const s=n[0];if(1==n.length){if(!s.requiresForm)return s.buttonViewCreator(!0);o=s.buttonViewCreator(!0)}else{const t=s.buttonViewCreator(!1);o=new k.AO(e,t),o.tooltip=!0,o.bind("label").to(this,"isImageSelected",(e=>i(e?"Replace image":"Insert image")))}const r=this.dropdownView=(0,k.yu)(e,o),a=n.map((({observable:e})=>"function"==typeof e?e():e));return r.bind("isEnabled").toMany(a,"isEnabled",((...e)=>e.some((e=>e)))),r.once("change:isOpen",(()=>{const e=n.map((({formViewCreator:e})=>e(1==n.length))),i=new F(t.locale,e);r.panelView.children.add(i)})),r}_createMenuBarComponent(e){const t=e.t,i=this._prepareIntegrations();if(!i.length)return null;let o;const s=i[0];if(1==i.length)o=s.menuBarButtonViewCreator(!0);else{o=new k.zj(e);const s=new k.BY(e);o.panelView.children.add(s),o.buttonView.set({icon:n.Pt.image,label:t("Image")});for(const t of i){const i=new k.I8(e,o),n=t.menuBarButtonViewCreator(!1);i.children.add(n),s.items.add(i)}}return o}_prepareIntegrations(){const e=this.editor.config.get("image.insert.integrations"),t=[];if(!e.length)return(0,l.FF)("image-insert-integrations-not-specified"),t;for(const i of e)this._integrations.has(i)?t.push(this._integrations.get(i)):["upload","assetManager","url"].includes(i)||(0,l.FF)("image-insert-unknown-integration",{item:i});return t.length||(0,l.FF)("image-insert-integrations-not-registered"),t}}class D extends n.k_{static get requires(){return[L,c.x0,x,N]}static get pluginName(){return"ImageBlock"}}class z extends n.k_{static get requires(){return[R,B,p,O,o.xz]}static get pluginName(){return"ImageInlineEditing"}init(){const e=this.editor;e.model.schema.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"],disallowIn:["caption"]}),this._setupConversion(),e.plugins.has("ImageBlockEditing")&&(e.commands.add("imageTypeInline",new M(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,i=e.conversion,n=e.plugins.get("ImageUtils");i.for("dataDowncast").elementToElement({model:"imageInline",view:(e,{writer:t})=>t.createEmptyElement("img")}),i.for("editingDowncast").elementToStructure({model:"imageInline",view:(e,{writer:i})=>n.toImageWidget(function(e){return e.createContainerElement("span",{class:"image-inline"},e.createEmptyElement("img"))}(i),i,t("image widget"))}),i.for("downcast").add(P(n,"imageInline","src")).add(P(n,"imageInline","alt")).add(T(n,"imageInline")),i.for("upcast").elementToElement({view:u(e,"imageInline"),model:(e,{writer:t})=>t.createElement("imageInline",e.hasAttribute("src")?{src:e.getAttribute("src")}:void 0)})}_setupClipboardIntegration(){const e=this.editor,t=e.model,i=e.editing.view,n=e.plugins.get("ImageUtils"),o=e.plugins.get("ClipboardPipeline");this.listenTo(o,"inputTransformation",((o,r)=>{const a=Array.from(r.content.getChildren());let l;if(!a.every(n.isBlockImageView))return;l=r.targetRanges?e.editing.mapper.toModelRange(r.targetRanges[0]):t.document.selection.getFirstRange();const c=t.createSelection(l);if("imageInline"===h(t.schema,c)){const e=new s.Wq(i.document),t=a.map((t=>1===t.childCount?(Array.from(t.getAttributes()).forEach((i=>e.setAttribute(...i,n.findViewImgElement(t)))),t.getChild(0)):t));r.content=e.createDocumentFragment(t)}})),this.listenTo(o,"contentInsertion",((e,i)=>{"paste"===i.method&&t.change((e=>{const t=e.createRangeIn(i.content);for(const e of t.getItems())e.is("element","imageInline")&&n.setImageNaturalSizeAttributes(e)}))}))}}class W extends n.k_{static get requires(){return[z,c.x0,x,N]}static get pluginName(){return"ImageInline"}}class H extends n.k_{static get requires(){return[D,W]}static get pluginName(){return"Image"}}class U extends n.k_{static get pluginName(){return"ImageCaptionUtils"}static get requires(){return[p]}getCaptionFromImageModelElement(e){for(const t of e.getChildren())if(t&&t.is("element","caption"))return t;return null}getCaptionFromModelSelection(e){const t=this.editor.plugins.get("ImageUtils"),i=e.getFirstPosition().findAncestor("caption");return i&&t.isBlockImage(i.parent)?i:null}matchImageCaptionViewElement(e){const t=this.editor.plugins.get("ImageUtils");return"figcaption"==e.name&&t.isBlockImageView(e.parent)?{name:!0}:null}}class $ extends n.uB{refresh(){const e=this.editor,t=e.plugins.get("ImageCaptionUtils"),i=e.plugins.get("ImageUtils");if(!e.plugins.has(L))return this.isEnabled=!1,void(this.value=!1);const n=e.model.document.selection,o=n.getSelectedElement();if(!o){const e=t.getCaptionFromModelSelection(n);return this.isEnabled=!!e,void(this.value=!!e)}this.isEnabled=i.isImage(o),this.isEnabled?this.value=!!t.getCaptionFromImageModelElement(o):this.value=!1}execute(e={}){const{focusCaptionOnShow:t}=e;this.editor.model.change((e=>{this.value?this._hideImageCaption(e):this._showImageCaption(e,t)}))}_showImageCaption(e,t){const i=this.editor.model.document.selection,n=this.editor.plugins.get("ImageCaptionEditing"),o=this.editor.plugins.get("ImageUtils");let s=i.getSelectedElement();const r=n._getSavedCaption(s);o.isInlineImage(s)&&(this.editor.execute("imageTypeBlock"),s=i.getSelectedElement());const a=r||e.createElement("caption");e.append(a,s),t&&e.setSelection(a,"in")}_hideImageCaption(e){const t=this.editor,i=t.model.document.selection,n=t.plugins.get("ImageCaptionEditing"),o=t.plugins.get("ImageCaptionUtils");let s,r=i.getSelectedElement();r?s=o.getCaptionFromImageModelElement(r):(s=o.getCaptionFromModelSelection(i),r=s.parent),n._saveCaption(r,s),e.setSelection(r,"on"),e.remove(s)}}class j extends n.k_{static get requires(){return[p,U]}static get pluginName(){return"ImageCaptionEditing"}constructor(e){super(e),this._savedCaptionsMap=new WeakMap}init(){const e=this.editor,t=e.model.schema;t.isRegistered("caption")?t.extend("caption",{allowIn:"imageBlock"}):t.register("caption",{allowIn:"imageBlock",allowContentOf:"$block",isLimit:!0}),e.commands.add("toggleImageCaption",new $(this.editor)),this._setupConversion(),this._setupImageTypeCommandsIntegration(),this._registerCaptionReconversion()}_setupConversion(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageUtils"),n=e.plugins.get("ImageCaptionUtils"),o=e.t;e.conversion.for("upcast").elementToElement({view:e=>n.matchImageCaptionViewElement(e),model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(e,{writer:t})=>i.isBlockImage(e.parent)?t.createContainerElement("figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(e,{writer:n})=>{if(!i.isBlockImage(e.parent))return null;const r=n.createEditableElement("figcaption");n.setCustomProperty("imageCaption",!0,r),r.placeholder=o("Enter image caption"),(0,s.JT)({view:t,element:r,keepOnFocus:!0});const a=e.parent.getAttribute("alt"),l=a?o("Caption for image: %0",[a]):o("Caption for the image");return(0,c.YN)(r,n,{label:l})}})}_setupImageTypeCommandsIntegration(){const e=this.editor,t=e.plugins.get("ImageUtils"),i=e.plugins.get("ImageCaptionUtils"),n=e.commands.get("imageTypeInline"),o=e.commands.get("imageTypeBlock"),s=e=>{if(!e.return)return;const{oldElement:n,newElement:o}=e.return;if(!n)return;if(t.isBlockImage(n)){const e=i.getCaptionFromImageModelElement(n);if(e)return void this._saveCaption(o,e)}const s=this._getSavedCaption(n);s&&this._saveCaption(o,s)};n&&this.listenTo(n,"execute",s,{priority:"low"}),o&&this.listenTo(o,"execute",s,{priority:"low"})}_getSavedCaption(e){const t=this._savedCaptionsMap.get(e);return t?s.Hg.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON())}_registerCaptionReconversion(){const e=this.editor,t=e.model,i=e.plugins.get("ImageUtils"),n=e.plugins.get("ImageCaptionUtils");t.document.on("change:data",(()=>{const o=t.document.differ.getChanges();for(const t of o){if("alt"!==t.attributeKey)continue;const o=t.range.start.nodeAfter;if(i.isBlockImage(o)){const t=n.getCaptionFromImageModelElement(o);if(!t)return;e.editing.reconvertItem(t)}}}))}}class q extends n.k_{static get requires(){return[U]}static get pluginName(){return"ImageCaptionUI"}init(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageCaptionUtils"),o=e.t;e.ui.componentFactory.add("toggleImageCaption",(s=>{const r=e.commands.get("toggleImageCaption"),a=new k._(s);return a.set({icon:n.Pt.caption,tooltip:!0,isToggleable:!0}),a.bind("isOn","isEnabled").to(r,"value","isEnabled"),a.bind("label").to(r,"value",(e=>o(e?"Toggle caption off":"Toggle caption on"))),this.listenTo(a,"execute",(()=>{e.execute("toggleImageCaption",{focusCaptionOnShow:!0});const n=i.getCaptionFromModelSelection(e.model.document.selection);if(n){const i=e.editing.mapper.toViewElement(n);t.scrollToTheSelection(),t.change((e=>{e.addClass("image__caption_highlighted",i)}))}e.editing.view.focus()})),a}))}}class K extends n.k_{static get requires(){return[j,q]}static get pluginName(){return"ImageCaption"}}function G(e){const t=e.map((e=>e.replace("+","\\+")));return new RegExp(`^image\\/(${t.join("|")})$`)}function Z(e,t){return e.type?e.type:t.match(/data:(image\/\w+);base64/)?t.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}class J extends n.k_{static get pluginName(){return"ImageUploadUI"}init(){const e=this.editor;e.ui.componentFactory.add("uploadImage",(()=>this._createToolbarButton())),e.ui.componentFactory.add("imageUpload",(()=>this._createToolbarButton())),e.ui.componentFactory.add("menuBar:uploadImage",(()=>this._createMenuBarButton("standalone"))),e.plugins.has("ImageInsertUI")&&e.plugins.get("ImageInsertUI").registerIntegration({name:"upload",observable:()=>e.commands.get("uploadImage"),buttonViewCreator:()=>this._createToolbarButton(),formViewCreator:()=>this._createDropdownButton(),menuBarButtonViewCreator:e=>this._createMenuBarButton(e?"insertOnly":"insertNested")})}_createButton(e){const t=this.editor,i=t.locale,o=t.commands.get("uploadImage"),s=t.config.get("image.upload.types"),r=G(s),a=new e(t.locale),l=i.t;return a.set({acceptedType:s.map((e=>`image/${e}`)).join(","),allowMultipleFiles:!0,label:l("Upload from computer"),icon:n.Pt.imageUpload}),a.bind("isEnabled").to(o),a.on("done",((e,i)=>{const n=Array.from(i).filter((e=>r.test(e.type)));n.length&&(t.execute("uploadImage",{file:n}),t.editing.view.focus())})),a}_createToolbarButton(){const e=this.editor.locale.t,t=this.editor.plugins.get("ImageInsertUI"),i=this.editor.commands.get("uploadImage"),n=this._createButton(k.eF);return n.tooltip=!0,n.bind("label").to(t,"isImageSelected",i,"isAccessAllowed",((t,i)=>e(i?t?"Replace image from computer":"Upload image from computer":"You have no image upload permissions."))),n}_createDropdownButton(){const e=this.editor.locale.t,t=this.editor.plugins.get("ImageInsertUI"),i=this._createButton(k.eF);return i.withText=!0,i.bind("label").to(t,"isImageSelected",(t=>e(t?"Replace from computer":"Upload from computer"))),i.on("execute",(()=>{t.dropdownView.isOpen=!1})),i}_createMenuBarButton(e){const t=this.editor.locale.t,i=this._createButton(k.GG);switch(i.withText=!0,e){case"standalone":i.label=t("Image from computer");break;case"insertOnly":i.label=t("Image");break;case"insertNested":i.label=t("From computer")}return i}}var Q=i(4857);class Y extends n.k_{static get pluginName(){return"ImageUploadProgress"}constructor(e){super(e),this.uploadStatusChange=(e,t,i)=>{const n=this.editor,o=t.item,s=o.getAttribute("uploadId");if(!i.consumable.consume(t.item,e.name))return;const r=n.plugins.get("ImageUtils"),a=n.plugins.get(Q.FileRepository),l=s?t.attributeNewValue:null,c=this.placeholder,d=n.editing.mapper.toViewElement(o),u=i.writer;if("reading"==l)return X(d,u),void ee(r,c,d,u);if("uploading"==l){const e=a.loaders.get(s);return X(d,u),void(e?(te(d,u),function(e,t,i,n){const o=function(e){const t=e.createUIElement("div",{class:"ck-progress-bar"});return e.setCustomProperty("progressBar",!0,t),t}(t);t.insert(t.createPositionAt(e,"end"),o),i.on("change:uploadedPercent",((e,t,i)=>{n.change((e=>{e.setStyle("width",i+"%",o)}))}))}(d,u,e,n.editing.view),function(e,t,i,n){if(n.data){const o=e.findViewImgElement(t);i.setAttribute("src",n.data,o)}}(r,d,u,e)):ee(r,c,d,u))}"complete"==l&&a.loaders.get(s)&&function(e,t,i){const n=t.createUIElement("div",{class:"ck-image-upload-complete-icon"});t.insert(t.createPositionAt(e,"end"),n),setTimeout((()=>{i.change((e=>e.remove(e.createRangeOn(n))))}),3e3)}(d,u,n.editing.view),function(e,t){ne(e,t,"progressBar")}(d,u),te(d,u),function(e,t){t.removeClass("ck-appear",e)}(d,u)},this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}init(){const e=this.editor;e.plugins.has("ImageBlockEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageBlock",this.uploadStatusChange),e.plugins.has("ImageInlineEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageInline",this.uploadStatusChange)}}function X(e,t){e.hasClass("ck-appear")||t.addClass("ck-appear",e)}function ee(e,t,i,n){i.hasClass("ck-image-upload-placeholder")||n.addClass("ck-image-upload-placeholder",i);const o=e.findViewImgElement(i);o.getAttribute("src")!==t&&n.setAttribute("src",t,o),ie(i,"placeholder")||n.insert(n.createPositionAfter(o),function(e){const t=e.createUIElement("div",{class:"ck-upload-placeholder-loader"});return e.setCustomProperty("placeholder",!0,t),t}(n))}function te(e,t){e.hasClass("ck-image-upload-placeholder")&&t.removeClass("ck-image-upload-placeholder",e),ne(e,t,"placeholder")}function ie(e,t){for(const i of e.getChildren())if(i.getCustomProperty(t))return i}function ne(e,t,i){const n=ie(e,i);n&&t.remove(t.createRangeOn(n))}class oe extends n.uB{constructor(e){super(e),this.set("isAccessAllowed",!0)}refresh(){const e=this.editor,t=e.plugins.get("ImageUtils"),i=e.model.document.selection.getSelectedElement();this.isEnabled=t.isImageAllowed()||t.isImage(i)}execute(e){const t=(0,l.$r)(e.file),i=this.editor.model.document.selection,n=this.editor.plugins.get("ImageUtils"),o=Object.fromEntries(i.getAttributes());t.forEach(((e,t)=>{const s=i.getSelectedElement();if(t&&s&&n.isImage(s)){const t=this.editor.model.createPositionAfter(s);this._uploadImage(e,o,t)}else this._uploadImage(e,o)}))}_uploadImage(e,t,i){const n=this.editor,o=n.plugins.get(Q.FileRepository).createLoader(e),s=n.plugins.get("ImageUtils");o&&s.insertImage({...t,uploadId:o.id},i)}}class se extends n.k_{static get requires(){return[Q.FileRepository,k.Eg,o.xz,p]}static get pluginName(){return"ImageUploadEditing"}constructor(e){super(e),e.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}init(){const e=this.editor,t=e.model.document,i=e.conversion,n=e.plugins.get(Q.FileRepository),o=e.plugins.get("ImageUtils"),r=e.plugins.get("ClipboardPipeline"),a=G(e.config.get("image.upload.types")),c=new oe(e);e.commands.add("uploadImage",c),e.commands.add("imageUpload",c),i.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(e.editing.view.document,"clipboardInput",((t,i)=>{if(n=i.dataTransfer,Array.from(n.types).includes("text/html")&&""!==n.getData("text/html"))return;var n;const o=Array.from(i.dataTransfer.files).filter((e=>!!e&&a.test(e.type)));if(o.length&&(t.stop(),e.model.change((t=>{i.targetRanges&&t.setSelection(i.targetRanges.map((t=>e.editing.mapper.toModelRange(t)))),e.execute("uploadImage",{file:o})})),!e.commands.get("uploadImage").isAccessAllowed)){const t=e.plugins.get("Notification"),i=e.locale.t;t.showWarning(i("You have no image upload permissions."),{namespace:"image"})}})),this.listenTo(r,"inputTransformation",((t,i)=>{const r=Array.from(e.editing.view.createRangeIn(i.content)).map((e=>e.item)).filter((e=>function(e,t){return!(!e.isInlineImageView(t)||!t.getAttribute("src")||!t.getAttribute("src").match(/^data:image\/\w+;base64,/g)&&!t.getAttribute("src").match(/^blob:/g))}(o,e)&&!e.getAttribute("uploadProcessed"))).map((e=>{return{promise:(t=e,new Promise(((e,i)=>{const n=t.getAttribute("src");fetch(n).then((e=>e.blob())).then((t=>{const i=Z(t,n),o=i.replace("image/",""),s=new File([t],`image.${o}`,{type:i});e(s)})).catch((t=>t&&"TypeError"===t.name?function(e){return function(e){return new Promise(((t,i)=>{const n=l.Sf.document.createElement("img");n.addEventListener("load",(()=>{const e=l.Sf.document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0),e.toBlob((e=>e?t(e):i()))})),n.addEventListener("error",(()=>i())),n.src=e}))}(e).then((t=>{const i=Z(t,e),n=i.replace("image/","");return new File([t],`image.${n}`,{type:i})}))}(n).then(e).catch(i):i(t)))}))),imageElement:e};var t}));if(!r.length)return;const a=new s.Wq(e.editing.view.document);for(const e of r){a.setAttribute("uploadProcessed",!0,e.imageElement);const t=n.createLoader(e.promise);t&&(a.setAttribute("src","",e.imageElement),a.setAttribute("uploadId",t.id,e.imageElement))}})),e.editing.view.document.on("dragover",((e,t)=>{t.preventDefault()})),t.on("change",(()=>{const i=t.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),o=new Set;for(const t of i)if("insert"==t.type&&"$text"!=t.name){const i=t.position.nodeAfter,s="$graveyard"==t.position.root.rootName;for(const t of re(e,i)){const e=t.getAttribute("uploadId");if(!e)continue;const i=n.loaders.get(e);i&&(s?o.has(e)||i.abort():(o.add(e),this._uploadImageElements.set(e,t),"idle"==i.status&&this._readAndUpload(i)))}}})),this.on("uploadComplete",((e,{imageElement:t,data:i})=>{const n=i.urls?i.urls:i;this.editor.model.change((e=>{e.setAttribute("src",n.default,t),this._parseAndSetSrcsetAttributeOnImage(n,t,e),o.setImageNaturalSizeAttributes(t)}))}),{priority:"low"})}afterInit(){const e=this.editor.model.schema;this.editor.plugins.has("ImageBlockEditing")&&e.extend("imageBlock",{allowAttributes:["uploadId","uploadStatus"]}),this.editor.plugins.has("ImageInlineEditing")&&e.extend("imageInline",{allowAttributes:["uploadId","uploadStatus"]})}_readAndUpload(e){const t=this.editor,i=t.model,n=t.locale.t,o=t.plugins.get(Q.FileRepository),s=t.plugins.get(k.Eg),r=t.plugins.get("ImageUtils"),a=this._uploadImageElements;return i.enqueueChange({isUndoable:!1},(t=>{t.setAttribute("uploadStatus","reading",a.get(e.id))})),e.read().then((()=>{const o=e.upload(),s=a.get(e.id);if(l._K.isSafari){const e=t.editing.mapper.toViewElement(s),i=r.findViewImgElement(e);t.editing.view.once("render",(()=>{if(!i.parent)return;const e=t.editing.view.domConverter.mapViewToDom(i.parent);if(!e)return;const n=e.style.display;e.style.display="none",e._ckHack=e.offsetHeight,e.style.display=n}))}return t.ui&&t.ui.ariaLiveAnnouncer.announce(n("Uploading image")),i.enqueueChange({isUndoable:!1},(e=>{e.setAttribute("uploadStatus","uploading",s)})),o})).then((o=>{i.enqueueChange({isUndoable:!1},(i=>{const s=a.get(e.id);i.setAttribute("uploadStatus","complete",s),t.ui&&t.ui.ariaLiveAnnouncer.announce(n("Image upload complete")),this.fire("uploadComplete",{data:o,imageElement:s})})),c()})).catch((o=>{if(t.ui&&t.ui.ariaLiveAnnouncer.announce(n("Error during image upload")),"error"!==e.status&&"aborted"!==e.status)throw o;"error"==e.status&&o&&s.showWarning(o,{title:n("Upload failed"),namespace:"upload"}),i.enqueueChange({isUndoable:!1},(t=>{t.remove(a.get(e.id))})),c()}));function c(){i.enqueueChange({isUndoable:!1},(t=>{const i=a.get(e.id);t.removeAttribute("uploadId",i),t.removeAttribute("uploadStatus",i),a.delete(e.id)})),o.destroyLoader(e)}}_parseAndSetSrcsetAttributeOnImage(e,t,i){let n=0;const o=Object.keys(e).filter((e=>{const t=parseInt(e,10);if(!isNaN(t))return n=Math.max(n,t),!0})).map((t=>`${e[t]} ${t}w`)).join(", ");if(""!=o){const e={srcset:o};t.hasAttribute("width")||t.hasAttribute("height")||(e.width=n),i.setAttributes(e,t)}}}function re(e,t){const i=e.plugins.get("ImageUtils");return Array.from(e.model.createRangeOn(t)).filter((e=>i.isImage(e.item))).map((e=>e.item))}class ae extends n.k_{static get pluginName(){return"ImageUpload"}static get requires(){return[se,J,Y]}}class le extends k.Ss{constructor(e){super(e),this.set("imageURLInputValue",""),this.set("isImageSelected",!1),this.set("isEnabled",!0),this.keystrokes=new l.EP,this.urlInputView=this._createUrlInputView(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-image-insert-url"]},children:[this.urlInputView,{tag:"div",attributes:{class:["ck","ck-image-insert-url__action-row"]}}]})}render(){super.render(),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.keystrokes.destroy()}_createUrlInputView(){const e=this.locale,t=e.t,i=new k.xE(e,k.Vr);return i.bind("label").to(this,"isImageSelected",(e=>t(e?"Update image URL":"Insert image via URL"))),i.bind("isEnabled").to(this),i.fieldView.inputMode="url",i.fieldView.placeholder="https://example.com/image.png",i.fieldView.bind("value").to(this,"imageURLInputValue",(e=>e||"")),i.fieldView.on("input",(()=>{this.imageURLInputValue=i.fieldView.element.value.trim()})),i}focus(){this.urlInputView.focus()}}class ce extends n.k_{static get pluginName(){return"ImageInsertViaUrlUI"}static get requires(){return[N,k.lG]}init(){this.editor.ui.componentFactory.add("insertImageViaUrl",(()=>this._createToolbarButton())),this.editor.ui.componentFactory.add("menuBar:insertImageViaUrl",(()=>this._createMenuBarButton("standalone")))}afterInit(){this._imageInsertUI=this.editor.plugins.get("ImageInsertUI"),this._imageInsertUI.registerIntegration({name:"url",observable:()=>this.editor.commands.get("insertImage"),buttonViewCreator:()=>this._createToolbarButton(),formViewCreator:()=>this._createDropdownButton(),menuBarButtonViewCreator:e=>this._createMenuBarButton(e?"insertOnly":"insertNested")})}_createInsertUrlButton(e){const t=new e(this.editor.locale);return t.icon=n.Pt.imageUrl,t.on("execute",(()=>{this._showModal()})),t}_createToolbarButton(){const e=this.editor.locale.t,t=this._createInsertUrlButton(k._);return t.tooltip=!0,t.bind("label").to(this._imageInsertUI,"isImageSelected",(t=>e(t?"Update image URL":"Insert image via URL"))),t}_createDropdownButton(){const e=this.editor.locale.t,t=this._createInsertUrlButton(k._);return t.withText=!0,t.bind("label").to(this._imageInsertUI,"isImageSelected",(t=>e(t?"Update image URL":"Insert via URL"))),t}_createMenuBarButton(e){const t=this.editor.locale.t,i=this._createInsertUrlButton(k.kS);switch(i.withText=!0,e){case"standalone":i.label=t("Image via URL");break;case"insertOnly":i.label=t("Image");break;case"insertNested":i.label=t("Via URL")}return i}_createInsertUrlView(){const e=this.editor,t=e.locale,i=e.commands.get("replaceImageSource"),n=e.commands.get("insertImage"),o=new le(t);return o.bind("isImageSelected").to(this._imageInsertUI),o.bind("isEnabled").toMany([n,i],"isEnabled",((...e)=>e.some((e=>e)))),o}_showModal(){const e=this.editor,t=e.locale.t,i=e.plugins.get("Dialog");this._formView||(this._formView=this._createInsertUrlView(),this._formView.on("submit",(()=>this._handleSave())));const n=e.commands.get("replaceImageSource");this._formView.imageURLInputValue=n.value||"",i.show({id:"insertImageViaUrl",title:this._imageInsertUI.isImageSelected?t("Update image URL"):t("Insert image via URL"),isModal:!0,content:this._formView,actionButtons:[{label:t("Cancel"),withText:!0,onExecute:()=>i.hide()},{label:t("Accept"),class:"ck-button-action",withText:!0,onExecute:()=>this._handleSave()}]})}_handleSave(){this.editor.commands.get("replaceImageSource").isEnabled?this.editor.execute("replaceImageSource",{source:this._formView.imageURLInputValue}):this.editor.execute("insertImage",{source:this._formView.imageURLInputValue}),this.editor.plugins.get("Dialog").hide()}}class de extends n.k_{static get pluginName(){return"ImageInsertViaUrl"}static get requires(){return[ce,N]}}class ue extends n.k_{static get pluginName(){return"ImageInsert"}static get requires(){return[ae,de,N]}}var he=i(5572),me=i(5396),ge=i(9841),fe=i(8446);const pe=(be=ge.A,function(e,t){if(null==e)return e;if(!(0,fe.A)(e))return be(e,t);for(var i=e.length,n=-1,o=Object(e);++n<i&&!1!==t(o[n],n,o););return e});var be;const we=function(e,t){var i=-1,n=(0,fe.A)(e)?Array(e.length):[];return pe(e,(function(e,o,s){n[++i]=t(e,o,s)})),n};var ve=i(2049);const _e=function(e,t){return((0,ve.A)(e)?he.A:we)(e,(0,me.A)(t,3))};class ye extends n.uB{refresh(){const e=this.editor,t=e.plugins.get("ImageUtils").getClosestSelectedImageElement(e.model.document.selection);this.isEnabled=!!t,t&&t.hasAttribute("resizedWidth")?this.value={width:t.getAttribute("resizedWidth"),height:null}:this.value=null}execute(e){const t=this.editor,i=t.model,n=t.plugins.get("ImageUtils"),o=n.getClosestSelectedImageElement(i.document.selection);this.value={width:e.width,height:null},o&&i.change((t=>{t.setAttribute("resizedWidth",e.width,o),t.removeAttribute("resizedHeight",o),n.setImageNaturalSizeAttributes(o)}))}}class ke extends n.k_{static get requires(){return[p]}static get pluginName(){return"ImageResizeEditing"}constructor(e){super(e),e.config.define("image",{resizeUnit:"%",resizeOptions:[{name:"resizeImage:original",value:null,icon:"original"},{name:"resizeImage:custom",value:"custom",icon:"custom"},{name:"resizeImage:25",value:"25",icon:"small"},{name:"resizeImage:50",value:"50",icon:"medium"},{name:"resizeImage:75",value:"75",icon:"large"}]})}init(){const e=this.editor,t=new ye(e);this._registerConverters("imageBlock"),this._registerConverters("imageInline"),e.commands.add("resizeImage",t),e.commands.add("imageResize",t)}afterInit(){this._registerSchema()}_registerSchema(){this.editor.plugins.has("ImageBlockEditing")&&this.editor.model.schema.extend("imageBlock",{allowAttributes:["resizedWidth","resizedHeight"]}),this.editor.plugins.has("ImageInlineEditing")&&this.editor.model.schema.extend("imageInline",{allowAttributes:["resizedWidth","resizedHeight"]})}_registerConverters(e){const t=this.editor,i=t.plugins.get("ImageUtils");t.conversion.for("downcast").add((t=>t.on(`attribute:resizedWidth:${e}`,((e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const n=i.writer,o=i.mapper.toViewElement(t.item);null!==t.attributeNewValue?(n.setStyle("width",t.attributeNewValue,o),n.addClass("image_resized",o)):(n.removeStyle("width",o),n.removeClass("image_resized",o))})))),t.conversion.for("dataDowncast").attributeToAttribute({model:{name:e,key:"resizedHeight"},view:e=>({key:"style",value:{height:e}})}),t.conversion.for("editingDowncast").add((t=>t.on(`attribute:resizedHeight:${e}`,((t,n,o)=>{if(!o.consumable.consume(n.item,t.name))return;const s=o.writer,r=o.mapper.toViewElement(n.item),a="imageInline"===e?i.findViewImgElement(r):r;null!==n.attributeNewValue?s.setStyle("height",n.attributeNewValue,a):s.removeStyle("height",a)})))),t.conversion.for("upcast").attributeToAttribute({view:{name:"imageBlock"===e?"figure":"img",styles:{width:/.+/}},model:{key:"resizedWidth",value:e=>g(e)?null:e.getStyle("width")}}),t.conversion.for("upcast").attributeToAttribute({view:{name:"imageBlock"===e?"figure":"img",styles:{height:/.+/}},model:{key:"resizedHeight",value:e=>g(e)?null:e.getStyle("height")}})}}const Ce=(()=>({small:n.Pt.objectSizeSmall,medium:n.Pt.objectSizeMedium,large:n.Pt.objectSizeLarge,custom:n.Pt.objectSizeCustom,original:n.Pt.objectSizeFull}))();class Ae extends n.k_{static get requires(){return[ke]}static get pluginName(){return"ImageResizeButtons"}constructor(e){super(e),this._resizeUnit=e.config.get("image.resizeUnit")}init(){const e=this.editor,t=e.config.get("image.resizeOptions"),i=e.commands.get("resizeImage");this.bind("isEnabled").to(i);for(const e of t)this._registerImageResizeButton(e);this._registerImageResizeDropdown(t)}_registerImageResizeButton(e){const t=this.editor,{name:i,value:n,icon:o}=e;t.ui.componentFactory.add(i,(i=>{const s=new k._(i),r=t.commands.get("resizeImage"),a=this._getOptionLabelValue(e,!0);if(!Ce[o])throw new l.Yb("imageresizebuttons-missing-icon",t,e);if(s.set({label:a,icon:Ce[o],tooltip:a,isToggleable:!0}),s.bind("isEnabled").to(this),t.plugins.has("ImageCustomResizeUI")&&Ee(e)){const e=t.plugins.get("ImageCustomResizeUI");this.listenTo(s,"execute",(()=>{e._showForm(this._resizeUnit)}))}else{const e=n?n+this._resizeUnit:null;s.bind("isOn").to(r,"value",xe(e)),this.listenTo(s,"execute",(()=>{t.execute("resizeImage",{width:e})}))}return s}))}_registerImageResizeDropdown(e){const t=this.editor,i=t.t,n=e.find((e=>!e.value)),o=o=>{const s=t.commands.get("resizeImage"),r=(0,k.yu)(o,k.lU),a=r.buttonView,l=i("Resize image");return a.set({tooltip:l,commandValue:n.value,icon:Ce.medium,isToggleable:!0,label:this._getOptionLabelValue(n),withText:!0,class:"ck-resize-image-button",ariaLabel:l,ariaLabelledBy:void 0}),a.bind("label").to(s,"value",(e=>e&&e.width?e.width:this._getOptionLabelValue(n))),r.bind("isEnabled").to(this),(0,k.O)(r,(()=>this._getResizeDropdownListItemDefinitions(e,s)),{ariaLabel:i("Image resize list"),role:"menu"}),this.listenTo(r,"execute",(e=>{"onClick"in e.source?e.source.onClick():(t.execute(e.source.commandName,{width:e.source.commandValue}),t.editing.view.focus())})),r};t.ui.componentFactory.add("resizeImage",o),t.ui.componentFactory.add("imageResize",o)}_getOptionLabelValue(e,t=!1){const i=this.editor.t;return e.label?e.label:t?Ee(e)?i("Custom image size"):e.value?i("Resize image to %0",e.value+this._resizeUnit):i("Resize image to the original size"):Ee(e)?i("Custom"):e.value?e.value+this._resizeUnit:i("Original")}_getResizeDropdownListItemDefinitions(e,t){const{editor:i}=this,n=new l.pM,o=e.map((e=>Ee(e)?{...e,valueWithUnits:"custom"}:e.value?{...e,valueWithUnits:`${e.value}${this._resizeUnit}`}:{...e,valueWithUnits:null}));for(const e of o){let s=null;if(i.plugins.has("ImageCustomResizeUI")&&Ee(e)){const n=i.plugins.get("ImageCustomResizeUI");s={type:"button",model:new k.Jc({label:this._getOptionLabelValue(e),role:"menuitemradio",withText:!0,icon:null,onClick:()=>{n._showForm(this._resizeUnit)}})};const r=_e(o,"valueWithUnits");s.model.bind("isOn").to(t,"value",Te(r))}else s={type:"button",model:new k.Jc({commandName:"resizeImage",commandValue:e.valueWithUnits,label:this._getOptionLabelValue(e),role:"menuitemradio",withText:!0,icon:null})},s.model.bind("isOn").to(t,"value",xe(e.valueWithUnits));s.model.bind("isEnabled").to(t,"isEnabled"),n.add(s)}return n}}function Ee(e){return"custom"===e.value}function xe(e){return t=>null===e&&t===e||null!==t&&t.width===e}function Te(e){return t=>!e.some((e=>xe(e)(t)))}const Pe="image_resized";class Ie extends n.k_{static get requires(){return[c.VE,p]}static get pluginName(){return"ImageResizeHandles"}init(){const e=this.editor.commands.get("resizeImage");this.bind("isEnabled").to(e),this._setupResizerCreator()}_setupResizerCreator(){const e=this.editor,t=e.editing.view,i=e.plugins.get("ImageUtils");t.addObserver(I),this.listenTo(t.document,"imageLoaded",((n,o)=>{if(!o.target.matches("figure.image.ck-widget > img,figure.image.ck-widget > picture > img,figure.image.ck-widget > a > img,figure.image.ck-widget > a > picture > img,span.image-inline.ck-widget > img,span.image-inline.ck-widget > picture > img"))return;const s=e.editing.view.domConverter,r=s.domToView(o.target),a=i.getImageWidgetFromImageView(r);let l=this.editor.plugins.get(c.VE).getResizerByViewElement(a);if(l)return void l.redraw();const d=e.editing.mapper,u=d.toModelElement(a);l=e.plugins.get(c.VE).attachTo({unit:e.config.get("image.resizeUnit"),modelElement:u,viewElement:a,editor:e,getHandleHost:e=>e.querySelector("img"),getResizeHost:()=>s.mapViewToDom(d.toViewElement(u)),isCentered:()=>"alignCenter"==u.getAttribute("imageStyle"),onCommit(i){t.change((e=>{e.removeClass(Pe,a)})),e.execute("resizeImage",{width:i})}}),l.on("updateSize",(()=>{a.hasClass(Pe)||t.change((e=>{e.addClass(Pe,a)}));const e="imageInline"===u.name?r:a;e.getStyle("height")&&t.change((t=>{t.removeStyle("height",e)}))})),l.bind("isEnabled").to(this)}))}}function Se(e){if(!e)return null;const[,t,i]=e.trim().match(/([.,\d]+)(%|px)$/)||[],n=Number.parseFloat(t);return Number.isNaN(n)?null:{value:n,unit:i}}function Ve(e,t,i){return"px"===i?{value:t.value,unit:"px"}:{value:t.value/e*100,unit:"%"}}function Re(e){const{editing:t}=e,i=e.plugins.get("ImageUtils").getClosestSelectedImageElement(e.model.document.selection);if(!i)return null;const n=t.mapper.toViewElement(i);return{model:i,view:n,dom:t.view.domConverter.mapViewToDom(n)}}class Be extends k.Ss{constructor(e,t,i){super(e);const o=this.locale.t;this.focusTracker=new l.$x,this.keystrokes=new l.EP,this.unit=t,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(o("Save"),n.Pt.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(o("Cancel"),n.Pt.cancel,"ck-button-cancel","cancel"),this._focusables=new k.s3,this._validators=i,this._focusCycler=new k.H({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-custom-resize-form","ck-responsive-form"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),this.keystrokes.listenTo(this.element),(0,k.Z5)({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(e,t,i,n){const o=new k._(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o.extendTemplate({attributes:{class:i}}),n&&o.delegate("execute").to(this,n),o}_createLabeledInputView(){const e=this.locale.t,t=new k.xE(this.locale,k.F_);return t.label=e("Resize image (in %0)",this.unit),t.fieldView.set({step:.1}),t}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.labeledInput.errorText=t,!1}return!0}resetFormStatus(){this.labeledInput.errorText=null}get rawSize(){const{element:e}=this.labeledInput.fieldView;return e?e.value:null}get parsedSize(){const{rawSize:e}=this;if(null===e)return null;const t=Number.parseFloat(e);return Number.isNaN(t)?null:t}get sizeWithUnits(){const{parsedSize:e,unit:t}=this;return null===e?null:`${e}${t}`}}class Me extends n.k_{static get requires(){return[k.pU]}static get pluginName(){return"ImageCustomResizeUI"}destroy(){super.destroy(),this._form&&this._form.destroy()}_createForm(e){const t=this.editor;this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new((0,k.wi)(Be))(t.locale,e,function(e){const t=e.t;return[e=>""===e.rawSize.trim()?t("The value must not be empty."):null===e.parsedSize?t("The value should be a plain number."):void 0]}(t)),this._form.render(),this.listenTo(this._form,"submit",(()=>{this._form.isValid()&&(t.execute("resizeImage",{width:this._form.sizeWithUnits}),this._hideForm(!0))})),this.listenTo(this._form.labeledInput,"change:errorText",(()=>{t.ui.update()})),this.listenTo(this._form,"cancel",(()=>{this._hideForm(!0)})),this._form.keystrokes.set("Esc",((e,t)=>{this._hideForm(!0),t()})),(0,k.wy)({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(e){if(this._isVisible)return;this._form||this._createForm(e);const t=this.editor,i=this._form.labeledInput;this._form.disableCssTransitions(),this._form.resetFormStatus(),this._isInBalloon||this._balloon.add({view:this._form,position:A(t)});const n=function(e,t){const i=Re(e);if(!i)return null;const n=Se(i.model.getAttribute("resizedWidth")||null);return n?n.unit===t?n:Ve((0,c.Wu)(i.dom),{unit:"px",value:new l.rw(i.dom).width},t):null}(t,e),o=n?n.value.toFixed(1):"",s=function(e,t){const i=Re(e);if(!i)return null;const n=(0,c.Wu)(i.dom),o=Se(window.getComputedStyle(i.dom).minWidth)||{value:1,unit:"px"};return{unit:t,lower:Math.max(.1,Ve(n,o,t).value),upper:"px"===t?n:100}}(t,e);i.fieldView.value=i.fieldView.element.value=o,s&&Object.assign(i.fieldView,{min:s.lower.toFixed(1),max:Math.ceil(s.upper).toFixed(1)}),this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(e=!1){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),e&&this.editor.editing.view.focus())}get _isVisible(){return!!this._balloon&&this._balloon.visibleView===this._form}get _isInBalloon(){return!!this._balloon&&this._balloon.hasView(this._form)}}class Oe extends n.k_{static get requires(){return[ke,Ie,Me,Ae]}static get pluginName(){return"ImageResize"}}class Le extends n.uB{constructor(e,t){super(e),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(t.map((e=>{if(e.isDefault)for(const t of e.modelElements)this._defaultStyles[t]=e.name;return[e.name,e]})))}refresh(){const e=this.editor.plugins.get("ImageUtils").getClosestSelectedImageElement(this.editor.model.document.selection);this.isEnabled=!!e,this.isEnabled?e.hasAttribute("imageStyle")?this.value=e.getAttribute("imageStyle"):this.value=this._defaultStyles[e.name]:this.value=!1}execute(e={}){const t=this.editor,i=t.model,n=t.plugins.get("ImageUtils");i.change((t=>{const o=e.value,{setImageSizes:s=!0}=e;let r=n.getClosestSelectedImageElement(i.document.selection);o&&this.shouldConvertImageType(o,r)&&(this.editor.execute(n.isBlockImage(r)?"imageTypeInline":"imageTypeBlock",{setImageSizes:s}),r=n.getClosestSelectedImageElement(i.document.selection)),!o||this._styles.get(o).isDefault?t.removeAttribute("imageStyle",r):t.setAttribute("imageStyle",o,r),s&&n.setImageNaturalSizeAttributes(r)}))}shouldConvertImageType(e,t){return!this._styles.get(e).modelElements.includes(t.name)}}const Fe={get inline(){return{name:"inline",title:"In line",icon:n.Pt.objectInline,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:n.Pt.objectLeft,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:n.Pt.objectBlockLeft,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:n.Pt.objectCenter,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:n.Pt.objectRight,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:n.Pt.objectBlockRight,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:n.Pt.objectCenter,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:n.Pt.objectRight,modelElements:["imageBlock"],className:"image-style-side"}}},Ne=(()=>({full:n.Pt.objectFullWidth,left:n.Pt.objectBlockLeft,right:n.Pt.objectBlockRight,center:n.Pt.objectCenter,inlineLeft:n.Pt.objectLeft,inlineRight:n.Pt.objectRight,inline:n.Pt.objectInline}))(),De=[{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 ze(e){(0,l.FF)("image-style-configuration-definition-invalid",e)}const We={normalizeStyles:function(e){return(e.configuredStyles.options||[]).map((e=>{return"string"==typeof(t="string"==typeof(t=e)?Fe[t]?{...Fe[t]}:{name:t}:function(e,t){const i={...t};for(const n in e)Object.prototype.hasOwnProperty.call(t,n)||(i[n]=e[n]);return i}(Fe[t.name],t)).icon&&(t.icon=Ne[t.icon]||t.icon),t;var t})).filter((t=>function(e,{isBlockPluginLoaded:t,isInlinePluginLoaded:i}){const{modelElements:n,name:o}=e;if(!(n&&n.length&&o))return ze({style:e}),!1;{const o=[t?"imageBlock":null,i?"imageInline":null];if(!n.some((e=>o.includes(e))))return(0,l.FF)("image-style-missing-dependency",{style:e,missingPlugins:n.map((e=>"imageBlock"===e?"ImageBlockEditing":"ImageInlineEditing"))}),!1}return!0}(t,e)))},getDefaultStylesConfiguration:function(e,t){return e&&t?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:e?{options:["block","side"]}:t?{options:["inline","alignLeft","alignRight"]}:{}},getDefaultDropdownDefinitions:function(e){return e.has("ImageBlockEditing")&&e.has("ImageInlineEditing")?[...De]:[]},warnInvalidStyle:ze,DEFAULT_OPTIONS:Fe,DEFAULT_ICONS:Ne,DEFAULT_DROPDOWN_DEFINITIONS:De};function He(e,t){for(const i of t)if(i.name===e)return i}class Ue extends n.k_{static get pluginName(){return"ImageStyleEditing"}static get requires(){return[p]}init(){const{normalizeStyles:e,getDefaultStylesConfiguration:t}=We,i=this.editor,n=i.plugins.has("ImageBlockEditing"),o=i.plugins.has("ImageInlineEditing");i.config.define("image.styles",t(n,o)),this.normalizedStyles=e({configuredStyles:i.config.get("image.styles"),isBlockPluginLoaded:n,isInlinePluginLoaded:o}),this._setupConversion(n,o),this._setupPostFixer(),i.commands.add("imageStyle",new Le(i,this.normalizedStyles))}_setupConversion(e,t){const i=this.editor,n=i.model.schema,o=(s=this.normalizedStyles,(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const n=He(t.attributeNewValue,s),o=He(t.attributeOldValue,s),r=i.mapper.toViewElement(t.item),a=i.writer;o&&a.removeClass(o.className,r),n&&a.addClass(n.className,r)});var s;const r=function(e){const t={imageInline:e.filter((e=>!e.isDefault&&e.modelElements.includes("imageInline"))),imageBlock:e.filter((e=>!e.isDefault&&e.modelElements.includes("imageBlock")))};return(e,i,n)=>{if(!i.modelRange)return;const o=i.viewItem,s=(0,l.$1)(i.modelRange.getItems());if(s&&n.schema.checkAttribute(s,"imageStyle"))for(const e of t[s.name])n.consumable.consume(o,{classes:e.className})&&n.writer.setAttribute("imageStyle",e.name,s)}}(this.normalizedStyles);i.editing.downcastDispatcher.on("attribute:imageStyle",o),i.data.downcastDispatcher.on("attribute:imageStyle",o),e&&(n.extend("imageBlock",{allowAttributes:"imageStyle"}),i.data.upcastDispatcher.on("element:figure",r,{priority:"low"})),t&&(n.extend("imageInline",{allowAttributes:"imageStyle"}),i.data.upcastDispatcher.on("element:img",r,{priority:"low"}))}_setupPostFixer(){const e=this.editor,t=e.model.document,i=e.plugins.get(p),n=new Map(this.normalizedStyles.map((e=>[e.name,e])));t.registerPostFixer((e=>{let o=!1;for(const s of t.differ.getChanges())if("insert"==s.type||"attribute"==s.type&&"imageStyle"==s.attributeKey){let t="insert"==s.type?s.position.nodeAfter:s.range.start.nodeAfter;if(t&&t.is("element","paragraph")&&t.childCount>0&&(t=t.getChild(0)),!i.isImage(t))continue;const r=t.getAttribute("imageStyle");if(!r)continue;const a=n.get(r);a&&a.modelElements.includes(t.name)||(e.removeAttribute("imageStyle",t),o=!0)}return o}))}}var $e=i(3149),je=i(9008);class qe extends n.k_{static get requires(){return[Ue]}static get pluginName(){return"ImageStyleUI"}get localizedDefaultStylesTitles(){const e=this.editor.t;return{"Wrap text":e("Wrap text"),"Break text":e("Break text"),"In line":e("In line"),"Full size image":e("Full size image"),"Side image":e("Side image"),"Left aligned image":e("Left aligned image"),"Centered image":e("Centered image"),"Right aligned image":e("Right aligned image")}}init(){const e=this.editor.plugins,t=this.editor.config.get("image.toolbar")||[],i=Ke(e.get("ImageStyleEditing").normalizedStyles,this.localizedDefaultStylesTitles);for(const e of i)this._createButton(e);const n=Ke([...t.filter($e.A),...We.getDefaultDropdownDefinitions(e)],this.localizedDefaultStylesTitles);for(const e of n)this._createDropdown(e,i)}_createDropdown(e,t){const i=this.editor.ui.componentFactory;i.add(e.name,(n=>{let o;const{defaultItem:s,items:r,title:a}=e,l=r.filter((e=>t.find((({name:t})=>Ge(t)===e)))).map((e=>{const t=i.create(e);return e===s&&(o=t),t}));r.length!==l.length&&We.warnInvalidStyle({dropdown:e});const c=(0,k.yu)(n,k.AO),d=c.buttonView,u=d.arrowView;return(0,k.fM)(c,l,{enableActiveItemFocusOnDropdownOpen:!0}),d.set({label:Ze(a,o.label),class:null,tooltip:!0}),u.unbind("label"),u.set({label:a}),d.bind("icon").toMany(l,"isOn",((...e)=>{const t=e.findIndex(je.A);return t<0?o.icon:l[t].icon})),d.bind("label").toMany(l,"isOn",((...e)=>{const t=e.findIndex(je.A);return Ze(a,t<0?o.label:l[t].label)})),d.bind("isOn").toMany(l,"isOn",((...e)=>e.some(je.A))),d.bind("class").toMany(l,"isOn",((...e)=>e.some(je.A)?"ck-splitbutton_flatten":void 0)),d.on("execute",(()=>{l.some((({isOn:e})=>e))?c.isOpen=!c.isOpen:o.fire("execute")})),c.bind("isEnabled").toMany(l,"isEnabled",((...e)=>e.some(je.A))),this.listenTo(c,"execute",(()=>{this.editor.editing.view.focus()})),c}))}_createButton(e){const t=e.name;this.editor.ui.componentFactory.add(Ge(t),(i=>{const n=this.editor.commands.get("imageStyle"),o=new k._(i);return o.set({label:e.title,icon:e.icon,tooltip:!0,isToggleable:!0}),o.bind("isEnabled").to(n,"isEnabled"),o.bind("isOn").to(n,"value",(e=>e===t)),o.on("execute",this._executeCommand.bind(this,t)),o}))}_executeCommand(e){this.editor.execute("imageStyle",{value:e}),this.editor.editing.view.focus()}}function Ke(e,t){for(const i of e)t[i.title]&&(i.title=t[i.title]);return e}function Ge(e){return`imageStyle:${e}`}function Ze(e,t){return(e?e+": ":"")+t}class Je extends n.k_{static get requires(){return[Ue,qe]}static get pluginName(){return"ImageStyle"}}class Qe extends n.k_{static get requires(){return[c.oP,p]}static get pluginName(){return"ImageToolbar"}afterInit(){const e=this.editor,t=e.t,i=e.plugins.get(c.oP),n=e.plugins.get("ImageUtils");var o;i.register("image",{ariaLabel:t("Image toolbar"),items:(o=e.config.get("image.toolbar")||[],o.map((e=>(0,$e.A)(e)?e.name:e))),getRelatedElement:e=>n.getClosestSelectedImageWidget(e)})}}class Ye extends n.k_{static get requires(){return[R,p]}static get pluginName(){return"PictureEditing"}afterInit(){const e=this.editor;e.plugins.has("ImageBlockEditing")&&e.model.schema.extend("imageBlock",{allowAttributes:["sources"]}),e.plugins.has("ImageInlineEditing")&&e.model.schema.extend("imageInline",{allowAttributes:["sources"]}),this._setupConversion(),this._setupImageUploadEditingIntegration()}_setupConversion(){const e=this.editor,t=e.conversion,i=e.plugins.get("ImageUtils");t.for("upcast").add(function(e){const t=["srcset","media","type","sizes"],i=(i,n,o)=>{const s=n.viewItem;if(!o.consumable.test(s,{name:!0}))return;const r=new Map;for(const e of s.getChildren())if(e.is("element","source")){const i={};for(const n of t)e.hasAttribute(n)&&o.consumable.test(e,{attributes:n})&&(i[n]=e.getAttribute(n));Object.keys(i).length&&r.set(e,i)}const a=e.findViewImgElement(s);if(!a)return;let c=n.modelCursor.parent;if(!c.is("element","imageBlock")){const e=o.convertItem(a,n.modelCursor);n.modelRange=e.modelRange,n.modelCursor=e.modelCursor,c=(0,l.$1)(e.modelRange.getItems())}o.consumable.consume(s,{name:!0});for(const[e,t]of r)o.consumable.consume(e,{attributes:Object.keys(t)});r.size&&o.writer.setAttribute("sources",Array.from(r.values()),c),o.convertChildren(s,c)};return e=>{e.on("element:picture",i)}}(i)),t.for("downcast").add(function(e){const t=(t,i,n)=>{if(!n.consumable.consume(i.item,t.name))return;const o=n.writer,s=n.mapper.toViewElement(i.item),r=e.findViewImgElement(s),a=i.attributeNewValue;if(a&&a.length){const e=o.createContainerElement("picture",null,a.map((e=>o.createEmptyElement("source",e)))),t=[];let i=r.parent;for(;i&&i.is("attributeElement");){const e=i.parent;o.unwrap(o.createRangeOn(r),i),t.unshift(i),i=e}o.insert(o.createPositionBefore(r),e),o.move(o.createRangeOn(r),o.createPositionAt(e,"end"));for(const i of t)o.wrap(o.createRangeOn(e),i)}else if(r.parent.is("element","picture")){const e=r.parent;o.move(o.createRangeOn(r),o.createPositionBefore(e)),o.remove(e)}};return e=>{e.on("attribute:sources:imageBlock",t),e.on("attribute:sources:imageInline",t)}}(i))}_setupImageUploadEditingIntegration(){const e=this.editor;if(!e.plugins.has("ImageUploadEditing"))return;const t=e.plugins.get("ImageUploadEditing");this.listenTo(t,"uploadComplete",((t,{imageElement:i,data:n})=>{const o=n.sources;o&&e.model.change((e=>{e.setAttributes({sources:o},i)}))}))}}},2016:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Indent:()=>a,IndentBlock:()=>g,IndentEditing:()=>o,IndentUI:()=>r});var n=i(1204);class o extends n.k_{static get pluginName(){return"IndentEditing"}init(){const e=this.editor;e.commands.add("indent",new n.fE(e)),e.commands.add("outdent",new n.fE(e))}}var s=i(949);class r extends n.k_{static get pluginName(){return"IndentUI"}init(){const e=this.editor,t=e.locale,i=e.t,o="ltr"==t.uiLanguageDirection?n.Pt.indent:n.Pt.outdent,s="ltr"==t.uiLanguageDirection?n.Pt.outdent:n.Pt.indent;this._defineButton("indent",i("Increase indent"),o),this._defineButton("outdent",i("Decrease indent"),s)}_defineButton(e,t,i){const n=this.editor;n.ui.componentFactory.add(e,(()=>{const n=this._createButton(s._,e,t,i);return n.set({tooltip:!0}),n})),n.ui.componentFactory.add("menuBar:"+e,(()=>this._createButton(s.kS,e,t,i)))}_createButton(e,t,i,n){const o=this.editor,s=o.commands.get(t),r=new e(o.locale);return r.set({label:i,icon:n}),r.bind("isEnabled").to(s,"isEnabled"),this.listenTo(r,"execute",(()=>{o.execute(t),o.editing.view.focus()})),r}}class a extends n.k_{static get pluginName(){return"Indent"}static get requires(){return[o,r]}}var l=i(4133),c=i(5318);class d extends n.uB{constructor(e,t){super(e),this._indentBehavior=t}refresh(){const e=this.editor.model,t=(0,c.$1)(e.document.selection.getSelectedBlocks());t&&this._isIndentationChangeAllowed(t)?this.isEnabled=this._indentBehavior.checkEnabled(t.getAttribute("blockIndent")):this.isEnabled=!1}execute(){const e=this.editor.model,t=this._getBlocksToChange();e.change((e=>{for(const i of t){const t=i.getAttribute("blockIndent"),n=this._indentBehavior.getNextIndent(t);n?e.setAttribute("blockIndent",n,i):e.removeAttribute("blockIndent",i)}}))}_getBlocksToChange(){const e=this.editor.model.document.selection;return Array.from(e.getSelectedBlocks()).filter((e=>this._isIndentationChangeAllowed(e)))}_isIndentationChangeAllowed(e){const t=this.editor;return!!t.model.schema.checkAttribute(e,"blockIndent")&&(!t.plugins.has("ListUtils")||(!this._indentBehavior.isForward||!t.plugins.get("ListUtils").isListItemBlock(e)))}}class u{constructor(e){this.isForward="forward"===e.direction,this.offset=e.offset,this.unit=e.unit}checkEnabled(e){const t=parseFloat(e||"0");return this.isForward||t>0}getNextIndent(e){const t=parseFloat(e||"0");if(e&&!e.endsWith(this.unit))return this.isForward?this.offset+this.unit:void 0;const i=t+(this.isForward?this.offset:-this.offset);return i>0?i+this.unit:void 0}}class h{constructor(e){this.isForward="forward"===e.direction,this.classes=e.classes}checkEnabled(e){const t=this.classes.indexOf(e);return this.isForward?t<this.classes.length-1:t>=0}getNextIndent(e){const t=this.classes.indexOf(e),i=this.isForward?1:-1;return this.classes[t+i]}}const m=["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"];class g extends n.k_{constructor(e){super(e),e.config.define("indentBlock",{offset:40,unit:"px"})}static get pluginName(){return"IndentBlock"}init(){const e=this.editor,t=e.config.get("indentBlock");t.classes&&t.classes.length?(this._setupConversionUsingClasses(t.classes),e.commands.add("indentBlock",new d(e,new h({direction:"forward",classes:t.classes}))),e.commands.add("outdentBlock",new d(e,new h({direction:"backward",classes:t.classes})))):(e.data.addStyleProcessorRules(l.vt),this._setupConversionUsingOffset(),e.commands.add("indentBlock",new d(e,new u({direction:"forward",offset:t.offset,unit:t.unit}))),e.commands.add("outdentBlock",new d(e,new u({direction:"backward",offset:t.offset,unit:t.unit}))))}afterInit(){const e=this.editor,t=e.model.schema,i=e.commands.get("indent"),n=e.commands.get("outdent"),o=e.config.get("heading.options");(o&&o.map((e=>e.model))||m).forEach((e=>{t.isRegistered(e)&&t.extend(e,{allowAttributes:"blockIndent"})})),t.setAttributeProperties("blockIndent",{isFormatting:!0}),i.registerChildCommand(e.commands.get("indentBlock")),n.registerChildCommand(e.commands.get("outdentBlock"))}_setupConversionUsingOffset(){const e=this.editor.conversion,t="rtl"===this.editor.locale.contentLanguageDirection?"margin-right":"margin-left";e.for("upcast").attributeToAttribute({view:{styles:{[t]:/[\s\S]+/}},model:{key:"blockIndent",value:e=>{if(!e.is("element","li"))return e.getStyle(t)}}}),e.for("downcast").attributeToAttribute({model:"blockIndent",view:e=>({key:"style",value:{[t]:e}})})}_setupConversionUsingClasses(e){const t={model:{key:"blockIndent",values:[]},view:{}};for(const i of e)t.model.values.push(i),t.view[i]={key:"class",value:[i]};this.editor.conversion.attributeToAttribute(t)}}},2685:(e,t,i)=>{"use strict";i.r(t),i.d(t,{TextPartLanguage:()=>d,TextPartLanguageEditing:()=>a,TextPartLanguageUI:()=>c});var n=i(1204),o=i(5318);function s(e,t){return`${e}:${t=t||(0,o.iJ)(e)}`}class r extends n.uB{refresh(){const e=this.editor.model,t=e.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"language")}execute({languageCode:e,textDirection:t}={}){const i=this.editor.model,n=i.document.selection,o=!!e&&s(e,t);i.change((e=>{if(n.isCollapsed)o?e.setSelectionAttribute("language",o):e.removeSelectionAttribute("language");else{const t=i.schema.getValidRanges(n.getRanges(),"language");for(const i of t)o?e.setAttribute("language",o,i):e.removeAttribute("language",i)}}))}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,i=e.document.selection;if(i.isCollapsed)return i.getAttribute("language")||!1;for(const e of i.getRanges())for(const i of e.getItems())if(t.checkAttribute(i,"language"))return i.getAttribute("language")||!1;return!1}}class a extends n.k_{static get pluginName(){return"TextPartLanguageEditing"}constructor(e){super(e),e.config.define("language",{textPartLanguage:[{title:"Arabic",languageCode:"ar"},{title:"French",languageCode:"fr"},{title:"Spanish",languageCode:"es"}]})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"language"}),e.model.schema.setAttributeProperties("language",{copyOnEnter:!0}),this._defineConverters(),e.commands.add("textPartLanguage",new r(e))}_defineConverters(){const e=this.editor.conversion;e.for("upcast").elementToAttribute({model:{key:"language",value:e=>s(e.getAttribute("lang"),e.getAttribute("dir"))},view:{name:"span",attributes:{lang:/[\s\S]+/}}}),e.for("downcast").attributeToElement({model:"language",view:(e,{writer:t},i)=>{if(!e)return;if(!i.item.is("$textProxy")&&!i.item.is("documentSelection"))return;const{languageCode:n,textDirection:o}=function(e){const[t,i]=e.split(":");return{languageCode:t,textDirection:i}}(e);return t.createAttributeElement("span",{lang:n,dir:o})}})}}var l=i(949);class c extends n.k_{static get pluginName(){return"TextPartLanguageUI"}init(){const e=this.editor,t=e.t,i=t("Choose language"),n=t("Language");e.ui.componentFactory.add("textPartLanguage",(t=>{const{definitions:o,titles:s}=this._getItemMetadata(),r=e.commands.get("textPartLanguage"),a=(0,l.yu)(t);return(0,l.O)(a,o,{ariaLabel:n,role:"menu"}),a.buttonView.set({ariaLabel:n,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:n}),a.extendTemplate({attributes:{class:["ck-text-fragment-language-dropdown"]}}),a.bind("isEnabled").to(r,"isEnabled"),a.buttonView.bind("label").to(r,"value",(e=>e&&s[e]||i)),a.buttonView.bind("ariaLabel").to(r,"value",(e=>{const t=e&&s[e];return t?`${t}, ${n}`:n})),this.listenTo(a,"execute",(t=>{r.execute({languageCode:t.source.languageCode,textDirection:t.source.textDirection}),e.editing.view.focus()})),a})),e.ui.componentFactory.add("menuBar:textPartLanguage",(i=>{const{definitions:o}=this._getItemMetadata(),s=e.commands.get("textPartLanguage"),r=new l.zj(i);r.buttonView.set({label:n});const a=new l.BY(i);a.set({ariaLabel:t("Language"),role:"menu"});for(const e of o){if("button"!=e.type){a.items.add(new l.Je(i));continue}const t=new l.I8(i,r),n=new l.kS(i);n.set({role:"menuitemradio",isToggleable:!0}),n.bind(...Object.keys(e.model)).to(e.model),n.delegate("execute").to(r),t.children.add(n),a.items.add(t)}return r.bind("isEnabled").to(s,"isEnabled"),r.panelView.children.add(a),r.on("execute",(t=>{s.execute({languageCode:t.source.languageCode,textDirection:t.source.textDirection}),e.editing.view.focus()})),r}))}_getItemMetadata(){const e=this.editor,t=new o.pM,i={},n=e.commands.get("textPartLanguage"),r=e.config.get("language.textPartLanguage"),a=(0,e.locale.t)("Remove language");t.add({type:"button",model:new l.Jc({label:a,languageCode:!1,withText:!0})}),t.add({type:"separator"});for(const e of r){const o={type:"button",model:new l.Jc({label:e.title,languageCode:e.languageCode,role:"menuitemradio",textDirection:e.textDirection,withText:!0})},r=s(e.languageCode,e.textDirection);o.model.bind("isOn").to(n,"value",(e=>e===r)),t.add(o),i[r]=e.title}return{definitions:t,titles:i}}}class d extends n.k_{static get requires(){return[a,c]}static get pluginName(){return"TextPartLanguage"}}},4608:(e,t,i)=>{"use strict";i.r(t),i.d(t,{AutoLink:()=>ee,Link:()=>ie,LinkCommand:()=>F,LinkEditing:()=>U,LinkImage:()=>ae,LinkImageEditing:()=>ne,LinkImageUI:()=>re,LinkUI:()=>Q,UnlinkCommand:()=>D});var n=i(1204),o=i(7211),s=i(7377),r=i(5318);class a{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(e){Array.isArray(e)?e.forEach((e=>this._definitions.add(e))):this._definitions.add(e)}getDispatcher(){return e=>{e.on("attribute:linkHref",((e,t,i)=>{if(!i.consumable.test(t.item,"attribute:linkHref"))return;if(!t.item.is("selection")&&!i.schema.isInline(t.item))return;const n=i.writer,o=n.document.selection;for(const e of this._definitions){const s=n.createAttributeElement("a",e.attributes,{priority:5});e.classes&&n.addClass(e.classes,s);for(const t in e.styles)n.setStyle(t,e.styles[t],s);n.setCustomProperty("link",!0,s),e.callback(t.attributeNewValue)?t.item.is("selection")?n.wrap(o.getFirstRange(),s):n.wrap(i.mapper.toViewRange(t.range),s):n.unwrap(i.mapper.toViewRange(t.range),s)}}),{priority:"high"})}}getDispatcherForLinkedImage(){return e=>{e.on("attribute:linkHref:imageBlock",((e,t,{writer:i,mapper:n})=>{const o=n.toViewElement(t.item),s=Array.from(o.getChildren()).find((e=>e.is("element","a")));for(const e of this._definitions){const n=(0,r.av)(e.attributes);if(e.callback(t.attributeNewValue)){for(const[e,t]of n)"class"===e?i.addClass(t,s):i.setAttribute(e,t,s);e.classes&&i.addClass(e.classes,s);for(const t in e.styles)i.setStyle(t,e.styles[t],s)}else{for(const[e,t]of n)"class"===e?i.removeClass(t,s):i.removeAttribute(e,s);e.classes&&i.removeClass(e.classes,s);for(const t in e.styles)i.removeStyle(t,s)}}}))}}}var l=i(7688);var c=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");const d=function(e){return c.test(e)};var u="\\ud800-\\udfff",h="["+u+"]",m="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",g="\\ud83c[\\udffb-\\udfff]",f="[^"+u+"]",p="(?:\\ud83c[\\udde6-\\uddff]){2}",b="[\\ud800-\\udbff][\\udc00-\\udfff]",w="(?:"+m+"|"+g+")?",v="[\\ufe0e\\ufe0f]?",_=v+w+"(?:\\u200d(?:"+[f,p,b].join("|")+")"+v+w+")*",y="(?:"+[f+m+"?",m,p,b,h].join("|")+")",k=RegExp(g+"(?="+g+")|"+y+_,"g");const C=function(e){return d(e)?function(e){return e.match(k)||[]}(e):function(e){return e.split("")}(e)};var A=i(3456);const E=function(e){e=(0,A.A)(e);var t,i,n,o,s=d(e)?C(e):void 0,r=s?s[0]:e.charAt(0),a=s?(t=s,i=1,o=t.length,n=void 0===n?o:n,!i&&n>=o?t:(0,l.A)(t,i,n)).join(""):e.slice(1);return r.toUpperCase()+a},x=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,T=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,P=/^((\w+:(\/{2,})?)|(\W))/i,I=["https?","ftps?","mailto"],S="Ctrl+K";function V(e,{writer:t}){const i=t.createAttributeElement("a",{href:e},{priority:5});return t.setCustomProperty("link",!0,i),i}function R(e,t=I){const i=String(e),n=t.join("|");return function(e,t){return!!e.replace(x,"").match(t)}(i,new RegExp(`${"^(?:(?:<protocols>):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))".replace("<protocols>",n)}`,"i"))?i:"#"}function B(e,t){return!!e&&t.checkAttribute(e.name,"linkHref")}function M(e,t){const i=(n=e,T.test(n)?"mailto:":t);var n;const o=!!i&&!O(e);return e&&o?i+e:e}function O(e){return P.test(e)}function L(e){window.open(e,"_blank","noopener")}class F extends n.uB{constructor(){super(...arguments),this.manualDecorators=new r.pM,this.automaticDecorators=new a}restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement()||(0,r.$1)(t.getSelectedBlocks());B(i,e.schema)?(this.value=i.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(i,"linkHref")):(this.value=t.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref"));for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}execute(e,t={}){const i=this.editor.model,n=i.document.selection,s=[],a=[];for(const e in t)t[e]?s.push(e):a.push(e);i.change((t=>{if(n.isCollapsed){const l=n.getFirstPosition();if(n.hasAttribute("linkHref")){const r=N(n);let c=(0,o.Py)(l,"linkHref",n.getAttribute("linkHref"),i);n.getAttribute("linkHref")===r&&(c=this._updateLinkContent(i,t,c,e)),t.setAttribute("linkHref",e,c),s.forEach((e=>{t.setAttribute(e,!0,c)})),a.forEach((e=>{t.removeAttribute(e,c)})),t.setSelection(t.createPositionAfter(c.end.nodeBefore))}else if(""!==e){const o=(0,r.av)(n.getAttributes());o.set("linkHref",e),s.forEach((e=>{o.set(e,!0)}));const{end:a}=i.insertContent(t.createText(e,o),l);t.setSelection(a)}["linkHref",...s,...a].forEach((e=>{t.removeSelectionAttribute(e)}))}else{const o=i.schema.getValidRanges(n.getRanges(),"linkHref"),r=[];for(const e of n.getSelectedBlocks())i.schema.checkAttribute(e,"linkHref")&&r.push(t.createRangeOn(e));const l=r.slice();for(const e of o)this._isRangeToUpdate(e,r)&&l.push(e);for(const o of l){let r=o;if(1===l.length){const s=N(n);n.getAttribute("linkHref")===s&&(r=this._updateLinkContent(i,t,o,e),t.setSelection(t.createSelection(r)))}t.setAttribute("linkHref",e,r),s.forEach((e=>{t.setAttribute(e,!0,r)})),a.forEach((e=>{t.removeAttribute(e,r)}))}}}))}_getDecoratorStateFromModel(e){const t=this.editor.model,i=t.document.selection,n=i.getSelectedElement();return B(n,t.schema)?n.getAttribute(e):i.getAttribute(e)}_isRangeToUpdate(e,t){for(const i of t)if(i.containsRange(e))return!1;return!0}_updateLinkContent(e,t,i,n){const o=t.createText(n,{linkHref:n});return e.insertContent(o,i)}}function N(e){if(e.isCollapsed){const t=e.getFirstPosition();return t.textNode&&t.textNode.data}{const t=Array.from(e.getFirstRange().getItems());if(t.length>1)return null;const i=t[0];return i.is("$text")||i.is("$textProxy")?i.data:null}}class D extends n.uB{refresh(){const e=this.editor.model,t=e.document.selection,i=t.getSelectedElement();B(i,e.schema)?this.isEnabled=e.schema.checkAttribute(i,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref")}execute(){const e=this.editor,t=this.editor.model,i=t.document.selection,n=e.commands.get("link");t.change((e=>{const s=i.isCollapsed?[(0,o.Py)(i.getFirstPosition(),"linkHref",i.getAttribute("linkHref"),t)]:t.schema.getValidRanges(i.getRanges(),"linkHref");for(const t of s)if(e.removeAttribute("linkHref",t),n)for(const i of n.manualDecorators)e.removeAttribute(i.id,t)}))}}class z extends((0,r.VM)()){constructor({id:e,label:t,attributes:i,classes:n,styles:o,defaultValue:s}){super(),this.id=e,this.set("value",void 0),this.defaultValue=s,this.label=t,this.attributes=i,this.classes=n,this.styles=o}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}const W="automatic",H=/^(https?:)?\/\//;class U extends n.k_{static get pluginName(){return"LinkEditing"}static get requires(){return[o.Vp,o.pd,s.xz]}constructor(e){super(e),e.config.define("link",{allowCreatingEmptyLinks:!1,addTargetToExternalLinks:!1})}init(){const e=this.editor,t=this.editor.config.get("link.allowedProtocols");e.model.schema.extend("$text",{allowAttributes:"linkHref"}),e.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:V}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(e,i)=>V(R(e,t),i)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:e=>e.getAttribute("href")}}),e.commands.add("link",new F(e)),e.commands.add("unlink",new D(e));const i=function(e,t){const i={"Open in a new tab":e("Open in a new tab"),Downloadable:e("Downloadable")};return t.forEach((e=>("label"in e&&i[e.label]&&(e.label=i[e.label]),e))),t}(e.t,function(e){const t=[];if(e)for(const[i,n]of Object.entries(e)){const e=Object.assign({},n,{id:`link${E(i)}`});t.push(e)}return t}(e.config.get("link.decorators")));this._enableAutomaticDecorators(i.filter((e=>e.mode===W))),this._enableManualDecorators(i.filter((e=>"manual"===e.mode))),e.plugins.get(o.Vp).registerAttribute("linkHref"),(0,o.Il)(e,"linkHref","a","ck-link_selected"),this._enableLinkOpen(),this._enableSelectionAttributesFixer(),this._enableClipboardIntegration()}_enableAutomaticDecorators(e){const t=this.editor,i=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&i.add({id:"linkIsExternal",mode:W,callback:e=>!!e&&H.test(e),attributes:{target:"_blank",rel:"noopener noreferrer"}}),i.add(e),i.length&&t.conversion.for("downcast").add(i.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,i=t.commands.get("link").manualDecorators;e.forEach((e=>{t.model.schema.extend("$text",{allowAttributes:e.id});const n=new z(e);i.add(n),t.conversion.for("downcast").attributeToElement({model:n.id,view:(e,{writer:t,schema:i},{item:o})=>{if((o.is("selection")||i.isInline(o))&&e){const e=t.createAttributeElement("a",n.attributes,{priority:5});n.classes&&t.addClass(n.classes,e);for(const i in n.styles)t.setStyle(i,n.styles[i],e);return t.setCustomProperty("link",!0,e),e}}}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",...n._createPattern()},model:{key:n.id}})}))}_enableLinkOpen(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",((e,t)=>{if(!(r._K.isMac?t.domEvent.metaKey:t.domEvent.ctrlKey))return;let i=t.domTarget;if("a"!=i.tagName.toLowerCase()&&(i=i.closest("a")),!i)return;const n=i.getAttribute("href");n&&(e.stop(),t.preventDefault(),L(n))}),{context:"$capture"}),this.listenTo(t,"keydown",((t,i)=>{const n=e.commands.get("link").value;n&&i.keyCode===r.uP.enter&&i.altKey&&(t.stop(),L(n))}))}_enableSelectionAttributesFixer(){const e=this.editor.model,t=e.document.selection;this.listenTo(t,"change:attribute",((i,{attributeKeys:n})=>{n.includes("linkHref")&&!t.hasAttribute("linkHref")&&e.change((t=>{var i;!function(e,t){e.removeSelectionAttribute("linkHref");for(const i of t)e.removeSelectionAttribute(i)}(t,(i=e.schema,i.getDefinition("$text").allowAttributes.filter((e=>e.startsWith("link")))))}))}))}_enableClipboardIntegration(){const e=this.editor,t=e.model,i=this.editor.config.get("link.defaultProtocol");i&&this.listenTo(e.plugins.get("ClipboardPipeline"),"contentInsertion",((e,n)=>{t.change((e=>{const t=e.createRangeIn(n.content);for(const n of t.getItems())if(n.hasAttribute("linkHref")){const t=M(n.getAttribute("linkHref"),i);e.setAttribute("linkHref",t,n)}}))}))}}var $=i(4133),j=i(949),q=i(5091);class K extends j.Ss{constructor(e,t,i){super(e),this.focusTracker=new r.$x,this.keystrokes=new r.EP,this._focusables=new j.s3;const o=e.t;this._validators=i,this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(o("Save"),n.Pt.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(o("Cancel"),n.Pt.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(t),this.children=this._createFormChildren(t.manualDecorators),this._focusCycler=new j.H({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const s=["ck","ck-link-form","ck-responsive-form"];t.manualDecorators.length&&s.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:s,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce(((e,t)=>(e[t.name]=t.isOn,e)),{})}render(){super.render(),(0,j.Z5)({view:this}),[this.urlInputView,...this._manualDecoratorSwitches,this.saveButtonView,this.cancelButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}isValid(){this.resetFormStatus();for(const e of this._validators){const t=e(this);if(t)return this.urlInputView.errorText=t,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null}_createUrlInput(){const e=this.locale.t,t=new j.xE(this.locale,j.Vr);return t.fieldView.inputMode="url",t.label=e("Link URL"),t}_createButton(e,t,i,n){const o=new j._(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o.extendTemplate({attributes:{class:i}}),n&&o.delegate("execute").to(this,n),o}_createManualDecoratorSwitches(e){const t=this.createCollection();for(const i of e.manualDecorators){const n=new j.Wm(this.locale);n.set({name:i.id,label:i.label,withText:!0}),n.bind("isOn").toMany([i,e],"value",((e,t)=>void 0===t&&void 0===e?!!i.defaultValue:!!e)),n.on("execute",(()=>{i.set("value",!n.isOn)})),t.add(n)}return t}_createFormChildren(e){const t=this.createCollection();if(t.add(this.urlInputView),e.length){const e=new j.Ss;e.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map((e=>({tag:"li",children:[e],attributes:{class:["ck","ck-list__item"]}}))),attributes:{class:["ck","ck-reset","ck-list"]}}),t.add(e)}return t.add(this.saveButtonView),t.add(this.cancelButtonView),t}get url(){const{element:e}=this.urlInputView.fieldView;return e?e.value.trim():null}}class G extends j.Ss{constructor(e,t={}){super(e),this.focusTracker=new r.$x,this.keystrokes=new r.EP,this._focusables=new j.s3;const i=e.t;this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(i("Unlink"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184zm4.919 10.562-1.414 1.414a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.061-1.06l1.414 1.414 1.414-1.415a.75.75 0 0 1 1.061 1.061l-1.414 1.414 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414z"/></svg>',"unlink"),this.editButtonView=this._createButton(i("Edit link"),n.Pt.pencil,"edit"),this.set("href",void 0),this._linkConfig=t,this._focusCycler=new j.H({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((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createButton(e,t,i){const n=new j._(this.locale);return n.set({label:e,icon:t,tooltip:!0}),n.delegate("execute").to(this,i),n}_createPreviewButton(){const e=new j._(this.locale),t=this.bindTemplate,i=this.t;return e.set({withText:!0,tooltip:i("Open link in new tab")}),e.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:t.to("href",(e=>e&&R(e,this._linkConfig.allowedProtocols))),target:"_blank",rel:"noopener noreferrer"}}),e.bind("label").to(this,"href",(e=>e||i("This link has no URL"))),e.bind("isEnabled").to(this,"href",(e=>!!e)),e.template.tag="a",e.template.eventListeners={},e}}const Z='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.077 15 .991-1.416a.75.75 0 1 1 1.229.86l-1.148 1.64a.748.748 0 0 1-.217.206 5.251 5.251 0 0 1-8.503-5.955.741.741 0 0 1 .12-.274l1.147-1.639a.75.75 0 1 1 1.228.86L4.933 10.7l.006.003a3.75 3.75 0 0 0 6.132 4.294l.006.004zm5.494-5.335a.748.748 0 0 1-.12.274l-1.147 1.639a.75.75 0 1 1-1.228-.86l.86-1.23a3.75 3.75 0 0 0-6.144-4.301l-.86 1.229a.75.75 0 0 1-1.229-.86l1.148-1.64a.748.748 0 0 1 .217-.206 5.251 5.251 0 0 1 8.503 5.955zm-4.563-2.532a.75.75 0 0 1 .184 1.045l-3.155 4.505a.75.75 0 1 1-1.229-.86l3.155-4.506a.75.75 0 0 1 1.045-.184z"/></svg>',J="link-ui";class Q extends n.k_{constructor(){super(...arguments),this.actionsView=null,this.formView=null}static get requires(){return[j.pU]}static get pluginName(){return"LinkUI"}init(){const e=this.editor,t=this.editor.t;e.editing.view.addObserver($.Re),this._balloon=e.plugins.get(j.pU),this._createToolbarLinkButton(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:J,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:J,view:(e,{writer:t})=>{if(!e.markerRange.isCollapsed)return null;const i=t.createUIElement("span");return t.addClass(["ck-fake-link-selection","ck-fake-link-selection_collapsed"],i),i}}),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Create link"),keystroke:S},{label:t("Move out of a link"),keystroke:[["arrowleft","arrowleft"],["arrowright","arrowright"]]}]})}destroy(){super.destroy(),this.formView&&this.formView.destroy(),this.actionsView&&this.actionsView.destroy()}_createViews(){this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._enableUserBalloonInteractions()}_createActionsView(){const e=this.editor,t=new G(e.locale,e.config.get("link")),i=e.commands.get("link"),n=e.commands.get("unlink");return t.bind("href").to(i,"value"),t.editButtonView.bind("isEnabled").to(i),t.unlinkButtonView.bind("isEnabled").to(n),this.listenTo(t,"edit",(()=>{this._addFormView()})),this.listenTo(t,"unlink",(()=>{e.execute("unlink"),this._hideUI()})),t.keystrokes.set("Esc",((e,t)=>{this._hideUI(),t()})),t.keystrokes.set(S,((e,t)=>{this._addFormView(),t()})),t}_createFormView(){const e=this.editor,t=e.commands.get("link"),i=e.config.get("link.defaultProtocol"),n=new((0,j.wi)(K))(e.locale,t,function(e){const t=e.t,i=e.config.get("link.allowCreatingEmptyLinks");return[e=>{if(!i&&!e.url.length)return t("Link URL must not be empty.")}]}(e));return n.urlInputView.fieldView.bind("value").to(t,"value"),n.urlInputView.bind("isEnabled").to(t,"isEnabled"),n.saveButtonView.bind("isEnabled").to(t,"isEnabled"),this.listenTo(n,"submit",(()=>{if(n.isValid()){const{value:t}=n.urlInputView.fieldView.element,o=M(t,i);e.execute("link",o,n.getDecoratorSwitchesState()),this._closeFormView()}})),this.listenTo(n.urlInputView,"change:errorText",(()=>{e.ui.update()})),this.listenTo(n,"cancel",(()=>{this._closeFormView()})),n.keystrokes.set("Esc",((e,t)=>{this._closeFormView(),t()})),n}_createToolbarLinkButton(){const e=this.editor;e.ui.componentFactory.add("link",(()=>{const e=this._createButton(j._);return e.set({tooltip:!0}),e})),e.ui.componentFactory.add("menuBar:link",(()=>{const e=this._createButton(j.kS);return e.set({role:"menuitemcheckbox"}),e}))}_createButton(e){const t=this.editor,i=t.locale,n=t.commands.get("link"),o=new e(t.locale),s=i.t;return o.set({label:s("Link"),icon:Z,keystroke:S,isToggleable:!0}),o.bind("isEnabled").to(n,"isEnabled"),o.bind("isOn").to(n,"value",(e=>!!e)),this.listenTo(o,"execute",(()=>this._showUI(!0))),o}_enableBalloonActivators(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",(()=>{this._getSelectedLinkElement()&&this._showUI()})),e.keystrokes.set(S,((t,i)=>{i(),e.commands.get("link").isEnabled&&this._showUI(!0)}))}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",((e,t)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),t())}),{priority:"high"}),this.editor.keystrokes.set("Esc",((e,t)=>{this._isUIVisible&&(this._hideUI(),t())})),(0,j.wy)({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 e=this.editor.commands.get("link");this.formView.disableCssTransitions(),this.formView.resetFormStatus(),this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this.formView.urlInputView.fieldView.value=e.value||"",this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.enableCssTransitions()}_closeFormView(){const e=this.editor.commands.get("link");e.restoreManualDecoratorStates(),void 0!==e.value?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this.formView.urlInputView.fieldView.reset(),this._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(e=!1){this.formView||this._createViews(),this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const e=this.editor;this.stopListening(e.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const e=this.editor,t=e.editing.view.document;let i=this._getSelectedLinkElement(),n=s();const o=()=>{const e=this._getSelectedLinkElement(),t=s();i&&!e||!i&&t!==n?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),i=e,n=t};function s(){return t.selection.focus.getAncestors().reverse().find((e=>e.is("element")))}this.listenTo(e.ui,"update",o),this.listenTo(this._balloon,"change:visibleView",o)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _areActionsInPanel(){return!!this.actionsView&&this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return!!this.actionsView&&this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){const e=this._balloon.visibleView;return!!this.formView&&e==this.formView||this._areActionsVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=this.editor.model,i=e.document;let n;if(t.markers.has(J)){const t=Array.from(this.editor.editing.mapper.markerNameToElements(J)),i=e.createRange(e.createPositionBefore(t[0]),e.createPositionAfter(t[t.length-1]));n=e.domConverter.viewRangeToDom(i)}else n=()=>{const t=this._getSelectedLinkElement();return t?e.domConverter.mapViewToDom(t):e.domConverter.viewRangeToDom(i.selection.getFirstRange())};return{target:n}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection,i=t.getSelectedElement();if(t.isCollapsed||i&&(0,q.p4)(i))return Y(t.getFirstPosition());{const i=t.getFirstRange().getTrimmed(),n=Y(i.start),o=Y(i.end);return n&&n==o&&e.createRangeIn(n).getTrimmed().isEqual(i)?n:null}}_showFakeVisualSelection(){const e=this.editor.model;e.change((t=>{const i=e.document.selection.getFirstRange();if(e.markers.has(J))t.updateMarker(J,{range:i});else if(i.start.isAtEnd){const n=i.start.getLastMatchingPosition((({item:t})=>!e.schema.isContent(t)),{boundaries:i});t.addMarker(J,{usingOperation:!1,affectsData:!1,range:t.createRange(n,i.end)})}else t.addMarker(J,{usingOperation:!1,affectsData:!1,range:i})}))}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(J)&&e.change((e=>{e.removeMarker(J)}))}}function Y(e){return e.getAncestors().find((e=>{return(t=e).is("attributeElement")&&!!t.getCustomProperty("link");var t}))||null}const X=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 ee extends n.k_{static get requires(){return[o.ep,U]}static get pluginName(){return"AutoLink"}init(){const e=this.editor.model.document.selection;e.on("change:range",(()=>{this.isEnabled=!e.anchor.parent.is("element","codeBlock")})),this._enableTypingHandling()}afterInit(){this._enableEnterHandling(),this._enableShiftEnterHandling(),this._enablePasteLinking()}_expandLinkRange(e,t){return t.textNode&&t.textNode.hasAttribute("linkHref")?(0,o.Py)(t,"linkHref",t.textNode.getAttribute("linkHref"),e):null}_selectEntireLinks(e,t){const i=this.editor.model,n=i.document.selection,o=n.getFirstPosition(),s=n.getLastPosition();let r=t.getJoined(this._expandLinkRange(i,o)||t);r&&(r=r.getJoined(this._expandLinkRange(i,s)||t)),r&&(r.start.isBefore(o)||r.end.isAfter(s))&&e.setSelection(r)}_enablePasteLinking(){const e=this.editor,t=e.model,i=t.document.selection,n=e.plugins.get("ClipboardPipeline"),o=e.commands.get("link");n.on("inputTransformation",((e,n)=>{if(!this.isEnabled||!o.isEnabled||i.isCollapsed||"paste"!==n.method)return;if(i.rangeCount>1)return;const s=i.getFirstRange(),r=n.dataTransfer.getData("text/plain");if(!r)return;const a=r.match(X);a&&a[2]===r&&(t.change((e=>{this._selectEntireLinks(e,s),o.execute(r)})),e.stop())}),{priority:"high"})}_enableTypingHandling(){const e=this.editor,t=new o.qV(e.model,(e=>{if(!function(e){return e.length>4&&" "===e[e.length-1]&&" "!==e[e.length-2]}(e))return;const t=te(e.substr(0,e.length-1));return t?{url:t}:void 0}));t.on("matched:data",((t,i)=>{const{batch:n,range:o,url:s}=i;if(!n.isTyping)return;const r=o.end.getShiftedBy(-1),a=r.getShiftedBy(-s.length),l=e.model.createRange(a,r);this._applyAutoLink(s,l)})),t.bind("isEnabled").to(this)}_enableEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("enter");i&&i.on("execute",(()=>{const e=t.document.selection.getFirstPosition();if(!e.parent.previousSibling)return;const i=t.createRangeIn(e.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(i)}))}_enableShiftEnterHandling(){const e=this.editor,t=e.model,i=e.commands.get("shiftEnter");i&&i.on("execute",(()=>{const e=t.document.selection.getFirstPosition(),i=t.createRange(t.createPositionAt(e.parent,0),e.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(i)}))}_checkAndApplyAutoLinkOnRange(e){const t=this.editor.model,{text:i,range:n}=(0,o.ex)(e,t),s=te(i);if(s){const e=t.createRange(n.end.getShiftedBy(-s.length),n.end);this._applyAutoLink(s,e)}}_applyAutoLink(e,t){const i=this.editor.model,n=M(e,this.editor.config.get("link.defaultProtocol"));this.isEnabled&&function(e,t){return t.schema.checkAttributeInSelection(t.createSelection(e),"linkHref")}(t,i)&&O(n)&&!function(e){const t=e.start.nodeAfter;return!!t&&t.hasAttribute("linkHref")}(t)&&this._persistAutoLink(n,t)}_persistAutoLink(e,t){const i=this.editor.model,n=this.editor.plugins.get("Delete");i.enqueueChange((o=>{o.setAttribute("linkHref",e,t),i.enqueueChange((()=>{n.requestUndoOnBackspace()}))}))}}function te(e){const t=X.exec(e);return t?t[2]:null}class ie extends n.k_{static get requires(){return[U,Q,ee]}static get pluginName(){return"Link"}}class ne extends n.k_{static get requires(){return["ImageEditing","ImageUtils",U]}static get pluginName(){return"LinkImageEditing"}afterInit(){const e=this.editor,t=e.model.schema;e.plugins.has("ImageBlockEditing")&&t.extend("imageBlock",{allowAttributes:["linkHref"]}),e.conversion.for("upcast").add(function(e){const t=e.plugins.has("ImageInlineEditing"),i=e.plugins.get("ImageUtils");return e=>{e.on("element:a",((e,n,o)=>{const s=n.viewItem,r=i.findViewImgElement(s);if(!r)return;const a=r.findAncestor((e=>i.isBlockImageView(e)));if(t&&!a)return;if(!o.consumable.consume(s,{attributes:["href"]}))return;const l=s.getAttribute("href");if(!l)return;let c=n.modelCursor.parent;if(!c.is("element","imageBlock")){const e=o.convertItem(r,n.modelCursor);n.modelRange=e.modelRange,n.modelCursor=e.modelCursor,c=n.modelCursor.nodeBefore}c&&c.is("element","imageBlock")&&o.writer.setAttribute("linkHref",l,c)}),{priority:"high"})}}(e)),e.conversion.for("downcast").add(function(e){const t=e.plugins.get("ImageUtils");return e=>{e.on("attribute:linkHref:imageBlock",((e,i,n)=>{if(!n.consumable.consume(i.item,e.name))return;const o=n.mapper.toViewElement(i.item),s=n.writer,r=Array.from(o.getChildren()).find((e=>e.is("element","a"))),a=t.findViewImgElement(o),l=a.parent.is("element","picture")?a.parent:a;if(r)i.attributeNewValue?s.setAttribute("href",i.attributeNewValue,r):(s.move(s.createRangeOn(l),s.createPositionAt(o,0)),s.remove(r));else{const e=s.createContainerElement("a",{href:i.attributeNewValue});s.insert(s.createPositionAt(o,0),e),s.move(s.createRangeOn(l),s.createPositionAt(e,0))}}),{priority:"high"})}}(e)),this._enableAutomaticDecorators(),this._enableManualDecorators()}_enableAutomaticDecorators(){const e=this.editor,t=e.commands.get("link").automaticDecorators;t.length&&e.conversion.for("downcast").add(t.getDispatcherForLinkedImage())}_enableManualDecorators(){const e=this.editor,t=e.commands.get("link");for(const i of t.manualDecorators)e.plugins.has("ImageBlockEditing")&&e.model.schema.extend("imageBlock",{allowAttributes:i.id}),e.plugins.has("ImageInlineEditing")&&e.model.schema.extend("imageInline",{allowAttributes:i.id}),e.conversion.for("downcast").add(oe(i)),e.conversion.for("upcast").add(se(e,i))}}function oe(e){return t=>{t.on(`attribute:${e.id}:imageBlock`,((t,i,n)=>{const o=n.mapper.toViewElement(i.item),s=Array.from(o.getChildren()).find((e=>e.is("element","a")));if(s){for(const[t,i]of(0,r.av)(e.attributes))n.writer.setAttribute(t,i,s);e.classes&&n.writer.addClass(e.classes,s);for(const t in e.styles)n.writer.setStyle(t,e.styles[t],s)}}))}}function se(e,t){const i=e.plugins.has("ImageInlineEditing"),n=e.plugins.get("ImageUtils");return e=>{e.on("element:a",((e,o,s)=>{const r=o.viewItem,a=n.findViewImgElement(r);if(!a)return;const l=a.findAncestor((e=>n.isBlockImageView(e)));if(i&&!l)return;const c=new $.PN(t._createPattern()).match(r);if(!c)return;if(!s.consumable.consume(r,c.match))return;const d=o.modelCursor.nodeBefore||o.modelCursor.parent;s.writer.setAttribute(t.id,!0,d)}),{priority:"high"})}}class re extends n.k_{static get requires(){return[U,Q,"ImageBlockEditing"]}static get pluginName(){return"LinkImageUI"}init(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",((t,i)=>{this._isSelectedLinkedImage(e.model.document.selection)&&(i.preventDefault(),t.stop())}),{priority:"high"}),this._createToolbarLinkImageButton()}_createToolbarLinkImageButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("linkImage",(i=>{const n=new j._(i),o=e.plugins.get("LinkUI"),s=e.commands.get("link");return n.set({isEnabled:!0,label:t("Link image"),icon:Z,keystroke:S,tooltip:!0,isToggleable:!0}),n.bind("isEnabled").to(s,"isEnabled"),n.bind("isOn").to(s,"value",(e=>!!e)),this.listenTo(n,"execute",(()=>{this._isSelectedLinkedImage(e.model.document.selection)?o._addActionsView():o._showUI(!0)})),n}))}_isSelectedLinkedImage(e){const t=e.getSelectedElement();return this.editor.plugins.get("ImageUtils").isImage(t)&&t.hasAttribute("linkHref")}}class ae extends n.k_{static get requires(){return[ne,re]}static get pluginName(){return"LinkImage"}}},3312:(e,t,i)=>{"use strict";i.r(t),i.d(t,{AdjacentListsSupport:()=>Lt,DocumentList:()=>Nt,DocumentListProperties:()=>Dt,LegacyIndentCommand:()=>De,LegacyList:()=>gt,LegacyListEditing:()=>ht,LegacyListProperties:()=>Et,LegacyListPropertiesEditing:()=>vt,LegacyListUtils:()=>Ye,LegacyTodoList:()=>Ot,LegacyTodoListEditing:()=>Bt,List:()=>ee,ListCommand:()=>V,ListEditing:()=>G,ListIndentCommand:()=>I,ListProperties:()=>Ae,ListPropertiesEditing:()=>be,ListPropertiesUI:()=>ve,ListPropertiesUtils:()=>me,ListUI:()=>X,ListUtils:()=>M,TodoDocumentList:()=>zt,TodoList:()=>Oe,TodoListEditing:()=>Ie,TodoListUI:()=>Me});var n=i(1204),o=i(7211),s=i(6449),r=i(5318);class a{constructor(e,t){this._startElement=e,this._referenceIndent=e.getAttribute("listIndent"),this._isForward="forward"==t.direction,this._includeSelf=!!t.includeSelf,this._sameAttributes=(0,r.$r)(t.sameAttributes||[]),this._sameIndent=!!t.sameIndent,this._lowerIndent=!!t.lowerIndent,this._higherIndent=!!t.higherIndent}static first(e,t){const i=new this(e,t)[Symbol.iterator]();return(0,r.$1)(i)}*[Symbol.iterator](){const e=[];for(const{node:t}of l(this._getStartNode(),this._isForward?"forward":"backward")){const i=t.getAttribute("listIndent");if(i<this._referenceIndent){if(!this._lowerIndent)break;this._referenceIndent=i}else if(i>this._referenceIndent){if(!this._higherIndent)continue;if(!this._isForward){e.push(t);continue}}else{if(!this._sameIndent){if(this._higherIndent){e.length&&(yield*e,e.length=0);break}continue}if(this._sameAttributes.some((e=>t.getAttribute(e)!==this._startElement.getAttribute(e))))break}e.length&&(yield*e,e.length=0),yield t}}_getStartNode(){return this._includeSelf?this._startElement:this._isForward?this._startElement.nextSibling:this._startElement.previousSibling}}function*l(e,t="forward"){const i="forward"==t,n=[];let o=null;for(;u(e);){let t=null;if(o){const i=e.getAttribute("listIndent"),s=o.getAttribute("listIndent");i>s?n[s]=o:i<s?(t=n[i],n.length=i):t=o}yield{node:e,previous:o,previousNodeInList:t},o=e,e=i?e.nextSibling:e.previousSibling}}class c{constructor(e){this._listHead=e}[Symbol.iterator](){return l(this._listHead,"forward")}}class d{static next(){return(0,r.Ld)()}}function u(e){return!!e&&e.is("element")&&e.hasAttribute("listItemId")}function h(e,t={}){return[...m(e,{...t,direction:"backward"}),...m(e,{...t,direction:"forward"})]}function m(e,t={}){const i="forward"==t.direction,n=Array.from(new a(e,{...t,includeSelf:i,sameIndent:!0,sameAttributes:"listItemId"}));return i?n:n.reverse()}function g(e,t){const i=new a(e,{sameIndent:!0,sameAttributes:"listType",...t}),n=new a(e,{sameIndent:!0,sameAttributes:"listType",includeSelf:!0,direction:"forward",...t});return[...Array.from(i).reverse(),...n]}function f(e){return!a.first(e,{sameIndent:!0,sameAttributes:"listItemId"})}function p(e){return!a.first(e,{direction:"forward",sameIndent:!0,sameAttributes:"listItemId"})}function b(e,t={}){e=(0,r.$r)(e);const i=!1!==t.withNested,n=new Set;for(const t of e)for(const e of h(t,{higherIndent:i}))n.add(e);return A(n)}function w(e){e=(0,r.$r)(e);const t=new Set;for(const i of e)for(const e of g(i))t.add(e);return A(t)}function v(e,t){const i=m(e,{direction:"forward"}),n=d.next();for(const e of i)t.setAttribute("listItemId",n,e);return i}function _(e,t,i){const n={};for(const[e,i]of t.getAttributes())e.startsWith("list")&&(n[e]=i);const o=m(e,{direction:"forward"});for(const e of o)i.setAttributes(n,e);return o}function y(e,t,{expand:i,indentBy:n=1}={}){e=(0,r.$r)(e);const o=i?b(e):e;for(const e of o){const i=e.getAttribute("listIndent")+n;i<0?k(e,t):t.setAttribute("listIndent",i,e)}return o}function k(e,t){e=(0,r.$r)(e);for(const i of e)i.is("element","listItem")&&t.rename(i,"paragraph");for(const i of e)for(const e of i.getAttributeKeys())e.startsWith("list")&&t.removeAttribute(e,i);return e}function C(e){if(!e.length)return!1;const t=e[0].getAttribute("listItemId");return!!t&&!e.some((e=>e.getAttribute("listItemId")!=t))}function A(e){return Array.from(e).filter((e=>"$graveyard"!==e.root.rootName)).sort(((e,t)=>e.index-t.index))}function E(e){const t=e.document.selection.getSelectedElement();return t&&e.schema.isObject(t)&&e.schema.isBlock(t)?t:null}function x(e,t){return t.checkChild(e.parent,"listItem")&&t.checkChild(e,"$text")&&!t.isObject(e)}function T(e){return"numbered"==e||"customNumbered"==e}function P(e,t,i){return m(t,{direction:"forward"}).pop().index>e.index?_(e,t,i):[]}class I extends n.uB{constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model,t=S(e.document.selection);e.change((e=>{const i=[];C(t)&&!f(t[0])?("forward"==this._direction&&i.push(...y(t,e)),i.push(...v(t[0],e))):"forward"==this._direction?i.push(...y(t,e,{expand:!0})):i.push(...function(e,t){const i=b(e=(0,r.$r)(e)),n=new Set,o=Math.min(...i.map((e=>e.getAttribute("listIndent")))),s=new Map;for(const e of i)s.set(e,a.first(e,{lowerIndent:!0}));for(const e of i){if(n.has(e))continue;n.add(e);const i=e.getAttribute("listIndent")-1;if(i<0)k(e,t);else{if(e.getAttribute("listIndent")==o){const i=P(e,s.get(e),t);for(const e of i)n.add(e);if(i.length)continue}t.setAttribute("listIndent",i,e)}}return A(n)}(t,e));for(const t of i){if(!t.hasAttribute("listType"))continue;const i=a.first(t,{sameIndent:!0});i&&e.setAttribute("listType",i.getAttribute("listType"),t)}this._fireAfterExecute(i)}))}_fireAfterExecute(e){this.fire("afterExecute",A(new Set(e)))}_checkEnabled(){let e=S(this.editor.model.document.selection),t=e[0];if(!t)return!1;if("backward"==this._direction)return!0;if(C(e)&&!f(e[0]))return!0;e=b(e),t=e[0];const i=a.first(t,{sameIndent:!0});return!!i&&i.getAttribute("listType")==t.getAttribute("listType")}}function S(e){const t=Array.from(e.getSelectedBlocks()),i=t.findIndex((e=>!u(e)));return-1!=i&&(t.length=i),t}class V extends n.uB{constructor(e,t,i={}){super(e),this.type=t,this._listWalkerOptions=i.multiLevel?{higherIndent:!0,lowerIndent:!0,sameAttributes:[]}:void 0}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,i=t.document,n=E(t),o=Array.from(i.selection.getSelectedBlocks()).filter((e=>t.schema.checkAttribute(e,"listType")||x(e,t.schema))),s=void 0!==e.forceValue?!e.forceValue:this.value;t.change((r=>{if(s){const e=o[o.length-1],t=m(e,{direction:"forward"}),i=[];t.length>1&&i.push(...v(t[1],r)),i.push(...k(o,r)),i.push(...function(e,t){const i=[];let n=Number.POSITIVE_INFINITY;for(const{node:o}of l(e.nextSibling,"forward")){const e=o.getAttribute("listIndent");if(0==e)break;e<n&&(n=e);const s=e-n;t.setAttribute("listIndent",s,o),i.push(o)}return i}(e,r)),this._fireAfterExecute(i)}else if((n||i.selection.isCollapsed)&&u(o[0])){const t=g(n||o[0],this._listWalkerOptions);for(const i of t)r.setAttributes({...e.additionalAttributes,listType:this.type},i);this._fireAfterExecute(t)}else{const i=[];for(const n of o)if(n.hasAttribute("listType"))for(const t of b(n,{withNested:!1}))t.getAttribute("listType")!=this.type&&(r.setAttributes({...e.additionalAttributes,listType:this.type},t),i.push(t));else!n.is("element","listItem")&&x(n,t.schema)&&r.rename(n,"listItem"),r.setAttributes({...e.additionalAttributes,listIndent:0,listItemId:d.next(),listType:this.type},n),i.push(n);this._fireAfterExecute(i)}}))}_fireAfterExecute(e){this.fire("afterExecute",A(new Set(e)))}_getValue(){const e=this.editor.model.document.selection,t=Array.from(e.getSelectedBlocks());if(!t.length)return!1;for(const e of t)if(e.getAttribute("listType")!=this.type)return!1;return!0}_checkEnabled(){const e=this.editor.model,t=e.schema,i=e.document.selection,n=Array.from(i.getSelectedBlocks());if(!n.length)return!1;if(this.value)return!0;for(const e of n)if(t.checkAttribute(e,"listType")||x(e,t))return!0;return!1}}class R extends n.uB{constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute({shouldMergeOnBlocksContentLevel:e=!1}={}){const t=this.editor.model,i=t.document.selection,n=[];t.change((o=>{const{firstElement:s,lastElement:r}=this._getMergeSubjectElements(i,e),l=s.getAttribute("listIndent")||0,c=r.getAttribute("listIndent"),d=r.getAttribute("listItemId");if(l!=c){const e=(u=r,Array.from(new a(u,{direction:"forward",higherIndent:!0})));n.push(...y([r,...e],o,{indentBy:l-c,expand:l<c}))}var u;if(e){let e=i;i.isCollapsed&&(e=o.createSelection(o.createRange(o.createPositionAt(s,"end"),o.createPositionAt(r,0)))),t.deleteContent(e,{doNotResetEntireContent:i.isCollapsed});const a=e.getLastPosition().parent,l=a.nextSibling;n.push(a),l&&l!==r&&l.getAttribute("listItemId")==d&&n.push(..._(l,a,o))}else n.push(..._(r,s,o));this._fireAfterExecute(n)}))}_fireAfterExecute(e){this.fire("afterExecute",A(new Set(e)))}_checkEnabled(){const e=this.editor.model,t=e.document.selection,i=E(e);if(t.isCollapsed||i){const e=i||t.getFirstPosition().parent;if(!u(e))return!1;const n="backward"==this._direction?e.previousSibling:e.nextSibling;if(!n)return!1;if(C([e,n]))return!1}else{const e=t.getLastPosition(),i=t.getFirstPosition();if(e.parent===i.parent)return!1;if(!u(e.parent))return!1}return!0}_getMergeSubjectElements(e,t){const i=E(this.editor.model);let n,o;if(e.isCollapsed||i){const s=i||e.getFirstPosition().parent,r=f(s);"backward"==this._direction?(o=s,n=r&&!t?a.first(s,{sameIndent:!0,lowerIndent:!0}):s.previousSibling):(n=s,o=s.nextSibling)}else n=e.getFirstPosition().parent,o=e.getLastPosition().parent;return{firstElement:n,lastElement:o}}}class B extends n.uB{constructor(e,t){super(e),this._direction=t}refresh(){this.isEnabled=this._checkEnabled()}execute(){this.editor.model.change((e=>{const t=v(this._getStartBlock(),e);this._fireAfterExecute(t)}))}_fireAfterExecute(e){this.fire("afterExecute",A(new Set(e)))}_checkEnabled(){const e=this.editor.model.document.selection,t=this._getStartBlock();return e.isCollapsed&&u(t)&&!f(t)}_getStartBlock(){const e=this.editor.model.document.selection.getFirstPosition().parent;return"before"==this._direction?e:e.nextSibling}}class M extends n.k_{static get pluginName(){return"ListUtils"}expandListBlocksToCompleteList(e){return w(e)}isFirstBlockOfListItem(e){return f(e)}isListItemBlock(e){return u(e)}expandListBlocksToCompleteItems(e,t={}){return b(e,t)}isNumberedListType(e){return T(e)}}function O(e){return e.is("element","ol")||e.is("element","ul")}function L(e){return e.is("element","li")}function F(e,t,i,n=z(i,t)){return e.createAttributeElement(D(i),null,{priority:2*t/100-100,id:n})}function N(e,t,i){return e.createAttributeElement("li",null,{priority:(2*t+1)/100-100,id:i})}function D(e){return"numbered"==e||"customNumbered"==e?"ol":"ul"}function z(e,t){return`list-${e}-${t}`}function W(e,t){const i=e.nodeBefore;if(u(i)){let e=i;for(const{node:i}of l(e,"backward"))if(e=i,t.has(e))return;t.set(i,e)}else{const i=e.nodeAfter;u(i)&&t.set(i,i)}}function H(e,t,i,{dataPipeline:n}={}){const o=function(e){return(t,i)=>{const n=[];for(const i of e)t.hasAttribute(i)&&n.push(`attribute:${i}`);return!!n.every((e=>!1!==i.test(t,e)))&&(n.forEach((e=>i.consume(t,e))),!0)}}(e);return(s,r,l)=>{const{writer:c,mapper:d,consumable:u}=l,h=r.item;if(!e.includes(r.attributeKey))return;if(!o(h,u))return;const m=function(e,t,i){const n=i.createRangeOn(e);return t.toViewRange(n).getTrimmed().end.nodeBefore}(h,d,i);$(m,c,d),function(e,t){let i=e.parent;for(;i.is("attributeElement")&&["ul","ol","li"].includes(i.name);){const n=i.parent;t.unwrap(t.createRangeOn(e),i),i=n}}(m,c);const g=function(e,t,i,n,{dataPipeline:o}){let s=n.createRangeOn(t);if(!f(e))return s;for(const r of i){if("itemMarker"!=r.scope)continue;const i=r.createElement(n,e,{dataPipeline:o});if(!i)continue;if(n.setCustomProperty("listItemMarker",!0,i),r.canInjectMarkerIntoElement&&r.canInjectMarkerIntoElement(e)?n.insert(n.createPositionAt(t,0),i):(n.insert(s.start,i),s=n.createRange(n.createPositionBefore(i),n.createPositionAfter(t))),!r.createWrapperElement||!r.canWrapElement)continue;const a=r.createWrapperElement(n,e,{dataPipeline:o});n.setCustomProperty("listItemWrapper",!0,a),r.canWrapElement(e)?s=n.wrap(s,a):(s=n.wrap(n.createRangeOn(i),a),s=n.createRange(s.start,n.createPositionAfter(t)))}return s}(h,m,t,c,{dataPipeline:n});!function(e,t,i,n){if(!e.hasAttribute("listIndent"))return;const o=e.getAttribute("listIndent");let s=e;for(let e=o;e>=0;e--){const o=N(n,e,s.getAttribute("listItemId")),r=F(n,e,s.getAttribute("listType"));for(const e of i)"list"!=e.scope&&"item"!=e.scope||!s.hasAttribute(e.attributeName)||e.setAttributeOnDowncast(n,s.getAttribute(e.attributeName),"list"==e.scope?r:o);if(t=n.wrap(t,o),t=n.wrap(t,r),0==e)break;if(s=a.first(s,{lowerIndent:!0}),!s)break}}(h,g,t,c)}}function U(e,{dataPipeline:t}={}){return(i,{writer:n})=>{if(!j(i,e))return null;if(!t)return n.createContainerElement("span",{class:"ck-list-bogus-paragraph"});const o=n.createContainerElement("p");return n.setCustomProperty("dataPipeline:transparentRendering",!0,o),o}}function $(e,t,i){for(;e.parent.is("attributeElement")&&e.parent.getCustomProperty("listItemWrapper");)t.unwrap(t.createRangeOn(e),e.parent);const n=[];o(t.createPositionBefore(e).getWalker({direction:"backward"})),o(t.createRangeIn(e).getWalker());for(const e of n)t.remove(e);function o(e){for(const{item:t}of e){if(t.is("element")&&i.toModelElement(t))break;t.is("element")&&t.getCustomProperty("listItemMarker")&&n.push(t)}}}function j(e,t,i=h(e)){if(!u(e))return!1;for(const i of e.getAttributeKeys())if(!i.startsWith("selection:")&&!t.includes(i))return!1;return i.length<2}var q=i(7377);const K=["listType","listIndent","listItemId"];class G extends n.k_{static get pluginName(){return"ListEditing"}static get requires(){return[s.x,o.ep,M,q.xz]}constructor(e){super(e),this._downcastStrategies=[],e.config.define("list.multiBlock",!0)}init(){const e=this.editor,t=e.model,i=e.config.get("list.multiBlock");if(e.plugins.has("LegacyListEditing"))throw new r.Yb("list-feature-conflict",this,{conflictPlugin:"LegacyListEditing"});t.schema.register("$listItem",{allowAttributes:K}),i?(t.schema.extend("$container",{allowAttributesOf:"$listItem"}),t.schema.extend("$block",{allowAttributesOf:"$listItem"}),t.schema.extend("$blockObject",{allowAttributesOf:"$listItem"})):t.schema.register("listItem",{inheritAllFrom:"$block",allowAttributesOf:"$listItem"});for(const e of K)t.schema.setAttributeProperties(e,{copyOnReplace:!0});e.commands.add("numberedList",new V(e,"numbered")),e.commands.add("bulletedList",new V(e,"bulleted")),e.commands.add("customNumberedList",new V(e,"customNumbered",{multiLevel:!0})),e.commands.add("customBulletedList",new V(e,"customBulleted",{multiLevel:!0})),e.commands.add("indentList",new I(e,"forward")),e.commands.add("outdentList",new I(e,"backward")),e.commands.add("splitListItemBefore",new B(e,"before")),e.commands.add("splitListItemAfter",new B(e,"after")),i&&(e.commands.add("mergeListItemBackward",new R(e,"backward")),e.commands.add("mergeListItemForward",new R(e,"forward"))),this._setupDeleteIntegration(),this._setupEnterIntegration(),this._setupTabIntegration(),this._setupClipboardIntegration(),this._setupAccessibilityIntegration()}afterInit(){const e=this.editor.commands,t=e.get("indent"),i=e.get("outdent");t&&t.registerChildCommand(e.get("indentList"),{priority:"high"}),i&&i.registerChildCommand(e.get("outdentList"),{priority:"lowest"}),this._setupModelPostFixing(),this._setupConversion()}registerDowncastStrategy(e){this._downcastStrategies.push(e)}getListAttributeNames(){return[...K,...this._downcastStrategies.map((e=>e.attributeName))]}_setupDeleteIntegration(){const e=this.editor,t=e.commands.get("mergeListItemBackward"),i=e.commands.get("mergeListItemForward");this.listenTo(e.editing.view.document,"delete",((n,o)=>{const s=e.model.document.selection;E(e.model)||e.model.change((()=>{const r=s.getFirstPosition();if(s.isCollapsed&&"backward"==o.direction){if(!r.isAtStart)return;const i=r.parent;if(!u(i))return;if(a.first(i,{sameAttributes:"listType",sameIndent:!0})||0!==i.getAttribute("listIndent")){if(!t||!t.isEnabled)return;t.execute({shouldMergeOnBlocksContentLevel:Z(e.model,"backward")})}else p(i)||e.execute("splitListItemAfter"),e.execute("outdentList");o.preventDefault(),n.stop()}else{if(s.isCollapsed&&!s.getLastPosition().isAtEnd)return;if(!i||!i.isEnabled)return;i.execute({shouldMergeOnBlocksContentLevel:Z(e.model,"forward")}),o.preventDefault(),n.stop()}}))}),{context:"li"})}_setupEnterIntegration(){const e=this.editor,t=e.model,i=e.commands,n=i.get("enter");this.listenTo(e.editing.view.document,"enter",((i,n)=>{const o=t.document,s=o.selection.getFirstPosition().parent;if(o.selection.isCollapsed&&u(s)&&s.isEmpty&&!n.isSoft){const t=f(s),o=p(s);t&&o?(e.execute("outdentList"),n.preventDefault(),i.stop()):t&&!o?(e.execute("splitListItemAfter"),n.preventDefault(),i.stop()):o&&(e.execute("splitListItemBefore"),n.preventDefault(),i.stop())}}),{context:"li"}),this.listenTo(n,"afterExecute",(()=>{const t=i.get("splitListItemBefore");t.refresh(),t.isEnabled&&2===h(e.model.document.selection.getLastPosition().parent).length&&t.execute()}))}_setupTabIntegration(){const e=this.editor;this.listenTo(e.editing.view.document,"tab",((t,i)=>{const n=i.shiftKey?"outdentList":"indentList";this.editor.commands.get(n).isEnabled&&(e.execute(n),i.stopPropagation(),i.preventDefault(),t.stop())}),{context:"li"})}_setupConversion(){const e=this.editor,t=e.model,i=this.getListAttributeNames(),n=e.config.get("list.multiBlock"),o=n?"paragraph":"listItem";e.conversion.for("upcast").elementToElement({view:"li",model:(e,{writer:t})=>t.createElement(o,{listType:""})}).elementToElement({view:"p",model:(e,{writer:t})=>e.parent&&e.parent.is("element","li")?t.createElement(o,{listType:""}):null,converterPriority:"high"}).add((e=>{e.on("element:li",((e,t,i)=>{const{writer:n,schema:o}=i;if(!t.modelRange)return;const s=Array.from(t.modelRange.getItems({shallow:!0})).filter((e=>o.checkAttribute(e,"listItemId")));if(!s.length)return;const r=d.next(),a=function(e){let t=0,i=e.parent;for(;i;){if(L(i))t++;else{const e=i.previousSibling;e&&L(e)&&t++}i=i.parent}return t}(t.viewItem);let l=t.viewItem.parent&&t.viewItem.parent.is("element","ol")?"numbered":"bulleted";const c=s[0].getAttribute("listType");c&&(l=c);const u={listItemId:r,listIndent:a,listType:l};for(const e of s)e.hasAttribute("listItemId")||n.setAttributes(u,e);s.length>1&&s[1].getAttribute("listItemId")!=u.listItemId&&i.keepEmptyElement(s[0])}))})),n||e.conversion.for("downcast").elementToElement({model:"listItem",view:"p"}),e.conversion.for("editingDowncast").elementToElement({model:o,view:U(i),converterPriority:"high"}).add((e=>{var n;e.on("attribute",H(i,this._downcastStrategies,t)),e.on("remove",(n=t.schema,(e,t,i)=>{const{writer:o,mapper:s}=i,r=e.name.split(":")[1];if(!n.checkAttribute(r,"listItemId"))return;const a=s.toViewPosition(t.position),l=t.position.getShiftedBy(t.length),c=s.toViewPosition(l,{isPhantom:!0}),d=o.createRange(a,c).getTrimmed().end.nodeBefore;d&&$(d,o,s)}))})),e.conversion.for("dataDowncast").elementToElement({model:o,view:U(i,{dataPipeline:!0}),converterPriority:"high"}).add((e=>{e.on("attribute",H(i,this._downcastStrategies,t,{dataPipeline:!0}))}));const s=(r=this._downcastStrategies,a=e.editing.view,(e,t)=>{if(t.modelPosition.offset>0)return;const i=t.modelPosition.parent;if(!u(i))return;if(!r.some((e=>"itemMarker"==e.scope&&e.canInjectMarkerIntoElement&&e.canInjectMarkerIntoElement(i))))return;const n=t.mapper.toViewElement(i),o=a.createRangeIn(n),s=o.getWalker();let l=o.start;for(const{item:e}of s){if(e.is("element")&&t.mapper.toModelElement(e)||e.is("$textProxy"))break;e.is("element")&&e.getCustomProperty("listItemMarker")&&(l=a.createPositionAfter(e),s.skip((({previousPosition:e})=>!e.isEqual(l))))}t.viewPosition=l});var r,a;e.editing.mapper.on("modelToViewPosition",s),e.data.mapper.on("modelToViewPosition",s),this.listenTo(t.document,"change:data",function(e,t,i,n){return()=>{const n=e.document.differ.getChanges(),r=[],a=new Map,l=new Set;for(const e of n)if("insert"==e.type&&"$text"!=e.name)W(e.position,a),e.attributes.has("listItemId")?l.add(e.position.nodeAfter):W(e.position.getShiftedBy(e.length),a);else if("remove"==e.type&&e.attributes.has("listItemId"))W(e.position,a);else if("attribute"==e.type){const t=e.range.start.nodeAfter;i.includes(e.attributeKey)?(W(e.range.start,a),null===e.attributeNewValue?(W(e.range.start.getShiftedBy(1),a),s(t)&&r.push(t)):l.add(t)):u(t)&&s(t)&&r.push(t)}for(const e of a.values())r.push(...o(e,l));for(const e of new Set(r))t.reconvertItem(e)};function o(e,t){const n=[],o=new Set,a=[];for(const{node:c,previous:d}of l(e,"forward")){if(o.has(c))continue;const e=c.getAttribute("listIndent");d&&e<d.getAttribute("listIndent")&&(a.length=e+1),a[e]=Object.fromEntries(Array.from(c.getAttributes()).filter((([e])=>i.includes(e))));const l=m(c,{direction:"forward"});for(const e of l)o.add(e),(s(e,l)||r(e,a,t))&&n.push(e)}return n}function s(e,o){const s=t.mapper.toViewElement(e);if(!s)return!1;if(n.fire("checkElement",{modelElement:e,viewElement:s}))return!0;if(!e.is("element","paragraph")&&!e.is("element","listItem"))return!1;const r=j(e,i,o);return!(!r||!s.is("element","p"))||!(r||!s.is("element","span"))}function r(e,i,o){if(o.has(e))return!1;const s=t.mapper.toViewElement(e);let r=i.length-1;for(let e=s.parent;!e.is("editableElement");e=e.parent){const t=L(e),o=O(e);if(!o&&!t)continue;const s="checkAttributes:"+(t?"item":"list");if(n.fire(s,{viewElement:e,modelAttributes:i[r]}))break;if(o&&(r--,r<0))return!1}return!0}}(t,e.editing,i,this),{priority:"high"}),this.on("checkAttributes:item",((e,{viewElement:t,modelAttributes:i})=>{t.id!=i.listItemId&&(e.return=!0,e.stop())})),this.on("checkAttributes:list",((e,{viewElement:t,modelAttributes:i})=>{t.name==D(i.listType)&&t.id==z(i.listType,i.listIndent)||(e.return=!0,e.stop())}))}_setupModelPostFixing(){const e=this.editor.model,t=this.getListAttributeNames();e.document.registerPostFixer((i=>function(e,t,i,n){const o=e.document.differ.getChanges(),s=new Map,r=n.editor.config.get("list.multiBlock");let a=!1;for(const n of o){if("insert"==n.type&&"$text"!=n.name){const o=n.position.nodeAfter;if(!e.schema.checkAttribute(o,"listItemId"))for(const e of Array.from(o.getAttributeKeys()))i.includes(e)&&(t.removeAttribute(e,o),a=!0);W(n.position,s),n.attributes.has("listItemId")||W(n.position.getShiftedBy(n.length),s);for(const{item:t,previousPosition:i}of e.createRangeIn(o))u(t)&&W(i,s)}else"remove"==n.type?W(n.position,s):"attribute"==n.type&&i.includes(n.attributeKey)&&(W(n.range.start,s),null===n.attributeNewValue&&W(n.range.start.getShiftedBy(1),s));if(!r&&"attribute"==n.type&&K.includes(n.attributeKey)){const e=n.range.start.nodeAfter;null===n.attributeNewValue&&e&&e.is("element","listItem")?(t.rename(e,"paragraph"),a=!0):null===n.attributeOldValue&&e&&e.is("element")&&"listItem"!=e.name&&(t.rename(e,"listItem"),a=!0)}}const l=new Set;for(const e of s.values())a=n.fire("postFixer",{listNodes:new c(e),listHead:e,writer:t,seenIds:l})||a;return a}(e,i,t,this))),this.on("postFixer",((e,{listNodes:t,writer:i})=>{e.return=function(e,t){let i=0,n=-1,o=null,s=!1;for(const{node:r}of e){const e=r.getAttribute("listIndent");if(e>i){let a;null===o?(o=e-i,a=i):(o>e&&(o=e),a=e-o),a>n+1&&(a=n+1),t.setAttribute("listIndent",a,r),s=!0,n=a}else o=null,i=e+1,n=e}return s}(t,i)||e.return}),{priority:"high"}),this.on("postFixer",((e,{listNodes:t,writer:i,seenIds:n})=>{e.return=function(e,t,i){const n=new Set;let o=!1;for(const{node:s}of e){if(n.has(s))continue;let e=s.getAttribute("listType"),r=s.getAttribute("listItemId");if(t.has(r)&&(r=d.next()),t.add(r),s.is("element","listItem"))s.getAttribute("listItemId")!=r&&(i.setAttribute("listItemId",r,s),o=!0);else for(const t of m(s,{direction:"forward"}))n.add(t),t.getAttribute("listType")!=e&&(r=d.next(),e=t.getAttribute("listType")),t.getAttribute("listItemId")!=r&&(i.setAttribute("listItemId",r,t),o=!0)}return o}(t,n,i)||e.return}),{priority:"high"})}_setupClipboardIntegration(){const e=this.editor.model,t=this.editor.plugins.get("ClipboardPipeline");this.listenTo(e,"insertContent",function(e){return(t,[i,n])=>{const o=i.is("documentFragment")?Array.from(i.getChildren()):[i];if(!o.length)return;const s=(n?e.createSelection(n):e.document.selection).getFirstPosition();let r;if(u(s.parent))r=s.parent;else{if(!u(s.nodeBefore))return;r=s.nodeBefore}e.change((e=>{const t=r.getAttribute("listType"),i=r.getAttribute("listIndent"),n=o[0].getAttribute("listIndent")||0,s=Math.max(i-n,0);for(const i of o){const n=u(i);r.is("element","listItem")&&i.is("element","paragraph")&&e.rename(i,"listItem"),e.setAttributes({listIndent:(n?i.getAttribute("listIndent"):0)+s,listItemId:n?i.getAttribute("listItemId"):d.next(),listType:t},i)}}))}}(e),{priority:"high"}),this.listenTo(t,"outputTransformation",((t,i)=>{e.change((e=>{const t=Array.from(i.content.getChildren()),n=t[t.length-1];if(t.length>1&&n.is("element")&&n.isEmpty&&t.slice(0,-1).every(u)&&e.remove(n),"copy"==i.method||"cut"==i.method){const t=Array.from(i.content.getChildren());C(t)&&k(t,e)}}))}))}_setupAccessibilityIntegration(){const e=this.editor,t=e.t;e.accessibility.addKeystrokeInfoGroup({id:"list",label:t("Keystrokes that can be used in a list"),keystrokes:[{label:t("Increase list item indent"),keystroke:"Tab"},{label:t("Decrease list item indent"),keystroke:"Shift+Tab"}]})}}function Z(e,t){const i=e.document.selection;if(!i.isCollapsed)return!E(e);if("forward"===t)return!0;const n=i.getFirstPosition().parent,o=n.previousSibling;return!e.schema.isObject(o)&&(!!o.isEmpty||C([n,o]))}var J=i(949);function Q(e,t,i,n){e.ui.componentFactory.add(t,(()=>{const o=Y(J._,e,t,i,n);return o.set({tooltip:!0,isToggleable:!0}),o})),e.ui.componentFactory.add(`menuBar:${t}`,(()=>{const o=Y(J.kS,e,t,i,n);return o.set({role:"menuitemcheckbox",isToggleable:!0}),o}))}function Y(e,t,i,n,o){const s=t.commands.get(i),r=new e(t.locale);return r.set({label:n,icon:o}),r.bind("isOn","isEnabled").to(s,"value","isEnabled"),r.on("execute",(()=>{t.execute(i),t.editing.view.focus()})),r}class X extends n.k_{static get pluginName(){return"ListUI"}init(){const e=this.editor.t;this.editor.ui.componentFactory.has("numberedList")||Q(this.editor,"numberedList",e("Numbered List"),n.Pt.numberedList),this.editor.ui.componentFactory.has("bulletedList")||Q(this.editor,"bulletedList",e("Bulleted List"),n.Pt.bulletedList)}}class ee extends n.k_{static get requires(){return[G,X]}static get pluginName(){return"List"}}class te extends n.uB{refresh(){const e=this._getValue();this.value=e,this.isEnabled=null!=e}execute({startIndex:e=1}={}){const t=this.editor.model,i=t.document;let n=Array.from(i.selection.getSelectedBlocks()).filter((e=>u(e)&&T(e.getAttribute("listType"))));n=w(n),t.change((t=>{for(const i of n)t.setAttribute("listStart",e>=0?e:1,i)}))}_getValue(){const e=this.editor.model.document,t=(0,r.$1)(e.selection.getSelectedBlocks());return t&&u(t)&&T(t.getAttribute("listType"))?t.getAttribute("listStart"):null}}const ie={},ne={},oe={},se=[{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:e,typeAttribute:t,listType:i}of se)ie[e]=i,ne[e]=t,t&&(oe[t]=e);function re(){return se.map((e=>e.listStyle))}function ae(e){return ie[e]||null}function le(e){return oe[e]||null}function ce(e){return ne[e]||null}class de extends n.uB{constructor(e,t,i){super(e),this.defaultType=t,this._supportedTypes=i}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,i=t.document;t.change((t=>{this._tryToConvertItemsToList(e);let n=Array.from(i.selection.getSelectedBlocks()).filter((e=>e.hasAttribute("listType")));if(n.length){n=w(n);for(const i of n)t.setAttribute("listStyle",e.type||this.defaultType,i)}}))}isStyleTypeSupported(e){return!this._supportedTypes||this._supportedTypes.includes(e)}_getValue(){const e=(0,r.$1)(this.editor.model.document.selection.getSelectedBlocks());return u(e)?e.getAttribute("listStyle"):null}_checkEnabled(){const e=this.editor,t=e.commands.get("numberedList"),i=e.commands.get("bulletedList");return t.isEnabled||i.isEnabled}_tryToConvertItemsToList(e){if(!e.type)return;const t=ae(e.type);if(!t)return;const i=this.editor,n=`${t}List`;i.commands.get(n).value||i.execute(n)}}class ue extends n.uB{refresh(){const e=this._getValue();this.value=e,this.isEnabled=null!=e}execute(e={}){const t=this.editor.model,i=t.document;let n=Array.from(i.selection.getSelectedBlocks()).filter((e=>u(e)&&"numbered"==e.getAttribute("listType")));n=w(n),t.change((t=>{for(const i of n)t.setAttribute("listReversed",!!e.reversed,i)}))}_getValue(){const e=this.editor.model.document,t=(0,r.$1)(e.selection.getSelectedBlocks());return u(t)&&"numbered"==t.getAttribute("listType")?t.getAttribute("listReversed"):null}}function he(e){return(t,i,n)=>{const{writer:o,schema:s,consumable:r}=n;if(!1===r.test(i.viewItem,e.viewConsumables))return;i.modelRange||Object.assign(i,n.convertChildren(i.viewItem,i.modelCursor));let a=!1;for(const t of i.modelRange.getItems({shallow:!0}))s.checkAttribute(t,e.attributeName)&&e.appliesToListItem(t)&&(t.hasAttribute(e.attributeName)||(o.setAttribute(e.attributeName,e.getAttributeOnUpcast(i.viewItem),t),a=!0));a&&r.consume(i.viewItem,e.viewConsumables)}}class me extends n.k_{static get pluginName(){return"ListPropertiesUtils"}getAllSupportedStyleTypes(){return re()}getListTypeFromListStyleType(e){return ae(e)}getListStyleTypeFromTypeAttribute(e){return le(e)}getTypeAttributeFromListStyleType(e){return ce(e)}}function ge(e){const{startIndex:t,reversed:i,styles:n}=e;return{styles:fe(n),startIndex:t||!1,reversed:i||!1}}function fe(e){const t={listTypes:["bulleted","numbered"],useAttribute:!1};return!0===e||(e?Array.isArray(e)||"string"==typeof e?t.listTypes=(0,r.$r)(e):(t.listTypes=e.listTypes?(0,r.$r)(e.listTypes):t.listTypes,t.useAttribute=!!e.useAttribute):t.listTypes=[]),t}const pe="default";class be extends n.k_{static get requires(){return[G,me]}static get pluginName(){return"ListPropertiesEditing"}constructor(e){super(e),e.config.define("list.properties",{styles:!0,startIndex:!1,reversed:!1})}init(){const e=this.editor,t=e.model,i=e.plugins.get(G),n=function(e){const t=[],i=ge(e);if(e.styles){const e=i.styles.useAttribute;t.push({attributeName:"listStyle",defaultValue:pe,viewConsumables:{styles:"list-style-type"},addCommand(t){let i=re();e&&(i=i.filter((e=>!!ce(e)))),t.commands.add("listStyle",new de(t,pe,i))},appliesToListItem:e=>"numbered"==e.getAttribute("listType")||"bulleted"==e.getAttribute("listType"),hasValidAttribute(e){if(!this.appliesToListItem(e))return!e.hasAttribute("listStyle");if(!e.hasAttribute("listStyle"))return!1;const t=e.getAttribute("listStyle");return t==pe||ae(t)==e.getAttribute("listType")},setAttributeOnDowncast(t,i,n){if(i&&i!==pe){if(!e)return void t.setStyle("list-style-type",i,n);{const e=ce(i);if(e)return void t.setAttribute("type",e,n)}}t.removeStyle("list-style-type",n),t.removeAttribute("type",n)},getAttributeOnUpcast(e){const t=e.getStyle("list-style-type");if(t)return t;const i=e.getAttribute("type");return i?le(i):pe}})}return e.reversed&&t.push({attributeName:"listReversed",defaultValue:!1,viewConsumables:{attributes:"reversed"},addCommand(e){e.commands.add("listReversed",new ue(e))},appliesToListItem:e=>"numbered"==e.getAttribute("listType"),hasValidAttribute(e){return this.appliesToListItem(e)==e.hasAttribute("listReversed")},setAttributeOnDowncast(e,t,i){t?e.setAttribute("reversed","reversed",i):e.removeAttribute("reversed",i)},getAttributeOnUpcast:e=>e.hasAttribute("reversed")}),e.startIndex&&t.push({attributeName:"listStart",defaultValue:1,viewConsumables:{attributes:"start"},addCommand(e){e.commands.add("listStart",new te(e))},appliesToListItem:e=>T(e.getAttribute("listType")),hasValidAttribute(e){return this.appliesToListItem(e)==e.hasAttribute("listStart")},setAttributeOnDowncast(e,t,i){0==t||t>1?e.setAttribute("start",t,i):e.removeAttribute("start",i)},getAttributeOnUpcast(e){const t=e.getAttribute("start");return t>=0?t:1}}),t}(e.config.get("list.properties"));for(const o of n)o.addCommand(e),t.schema.extend("$listItem",{allowAttributes:o.attributeName}),i.registerDowncastStrategy({scope:"list",attributeName:o.attributeName,setAttributeOnDowncast(e,t,i){o.setAttributeOnDowncast(e,t,i)}});e.conversion.for("upcast").add((e=>{for(const t of n)e.on("element:ol",he(t)),e.on("element:ul",he(t))})),i.on("checkAttributes:list",((e,{viewElement:t,modelAttributes:i})=>{for(const o of n)o.getAttributeOnUpcast(t)!=i[o.attributeName]&&(e.return=!0,e.stop())})),this.listenTo(e.commands.get("indentList"),"afterExecute",((e,i)=>{t.change((e=>{for(const t of i)for(const i of n)i.appliesToListItem(t)&&e.setAttribute(i.attributeName,i.defaultValue,t)}))})),i.on("postFixer",((e,{listNodes:t,writer:i})=>{for(const{node:o}of t)for(const t of n)t.hasValidAttribute(o)||(t.appliesToListItem(o)?i.setAttribute(t.attributeName,t.defaultValue,o):i.removeAttribute(t.attributeName,o),e.return=!0)})),i.on("postFixer",((e,{listNodes:t,writer:i})=>{for(const{node:o,previousNodeInList:s}of t)if(s&&s.getAttribute("listType")==o.getAttribute("listType"))for(const t of n){const{attributeName:n}=t;if(!t.appliesToListItem(o))continue;const r=s.getAttribute(n);o.getAttribute(n)!=r&&(i.setAttribute(n,r,o),e.return=!0)}}))}}class we extends J.Ss{constructor(e,{enabledProperties:t,styleButtonViews:i,styleGridAriaLabel:n}){super(e),this.stylesView=null,this.additionalPropertiesCollapsibleView=null,this.startIndexFieldView=null,this.reversedSwitchButtonView=null,this.focusTracker=new r.$x,this.keystrokes=new r.EP,this.focusables=new J.s3;const o=["ck","ck-list-properties"];this.children=this.createCollection(),this.focusCycler=new J.H({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),i&&i.length?(this.stylesView=this._createStylesView(i,n),this.children.add(this.stylesView)):o.push("ck-list-properties_without-styles"),(t.startIndex||t.reversed)&&(this._addNumberedListPropertyViews(t),o.push("ck-list-properties_with-numbered-properties")),this.setTemplate({tag:"div",attributes:{class:o},children:this.children})}render(){if(super.render(),this.stylesView){this.focusables.add(this.stylesView),this.focusTracker.add(this.stylesView.element),(this.startIndexFieldView||this.reversedSwitchButtonView)&&(this.focusables.add(this.children.last.buttonView),this.focusTracker.add(this.children.last.buttonView.element));for(const e of this.stylesView.children)this.stylesView.focusTracker.add(e.element);(0,J.l1)({keystrokeHandler:this.stylesView.keystrokes,focusTracker:this.stylesView.focusTracker,gridItems:this.stylesView.children,numberOfColumns:()=>r.Sf.window.getComputedStyle(this.stylesView.element).getPropertyValue("grid-template-columns").split(" ").length,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}if(this.startIndexFieldView){this.focusables.add(this.startIndexFieldView),this.focusTracker.add(this.startIndexFieldView.element);const e=e=>e.stopPropagation();this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}this.reversedSwitchButtonView&&(this.focusables.add(this.reversedSwitchButtonView),this.focusTracker.add(this.reversedSwitchButtonView.element)),this.keystrokes.listenTo(this.element)}focus(){this.focusCycler.focusFirst()}focusLast(){this.focusCycler.focusLast()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createStylesView(e,t){const i=new J.Ss(this.locale);return i.children=i.createCollection(),i.children.addMany(e),i.setTemplate({tag:"div",attributes:{"aria-label":t,class:["ck","ck-list-styles-list"]},children:i.children}),i.children.delegate("execute").to(this),i.focus=function(){this.children.first.focus()},i.focusTracker=new r.$x,i.keystrokes=new r.EP,i.render(),i.keystrokes.listenTo(i.element),i}_addNumberedListPropertyViews(e){const t=this.locale.t,i=[];e.startIndex&&(this.startIndexFieldView=this._createStartIndexField(),i.push(this.startIndexFieldView)),e.reversed&&(this.reversedSwitchButtonView=this._createReversedSwitchButton(),i.push(this.reversedSwitchButtonView)),this.stylesView?(this.additionalPropertiesCollapsibleView=new J.Kn(this.locale,i),this.additionalPropertiesCollapsibleView.set({label:t("List properties"),isCollapsed:!0}),this.additionalPropertiesCollapsibleView.buttonView.bind("isEnabled").toMany(i,"isEnabled",((...e)=>e.some((e=>e)))),this.additionalPropertiesCollapsibleView.buttonView.on("change:isEnabled",((e,t,i)=>{i||(this.additionalPropertiesCollapsibleView.isCollapsed=!0)})),this.children.add(this.additionalPropertiesCollapsibleView)):this.children.addMany(i)}_createStartIndexField(){const e=this.locale.t,t=new J.xE(this.locale,J.F_);return t.set({label:e("Start at"),class:"ck-numbered-list-properties__start-index"}),t.fieldView.set({min:0,step:1,value:1,inputMode:"numeric"}),t.fieldView.on("input",(()=>{const i=t.fieldView.element,n=i.valueAsNumber;Number.isNaN(n)?t.errorText=e("Invalid start index value."):i.checkValidity()?this.fire("listStart",{startIndex:n}):t.errorText=e("Start index must be greater than 0.")})),t}_createReversedSwitchButton(){const e=this.locale.t,t=new J.Wm(this.locale);return t.set({withText:!0,label:e("Reversed order"),class:"ck-numbered-list-properties__reversed-order"}),t.delegate("execute").to(this,"listReversed"),t}}class ve extends n.k_{static get pluginName(){return"ListPropertiesUI"}init(){const e=this.editor,t=e.locale.t,i=e.config.get("list.properties"),o=ge(i),s=o.styles.listTypes;if(s.includes("bulleted")){const i=[{label:t("Toggle the disc list style"),tooltip:t("Disc"),type:"disc",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M11 27a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0-9a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0-9a3 3 0 1 1 0 6 3 3 0 0 1 0-6z"/></svg>'},{label:t("Toggle the circle list style"),tooltip:t("Circle"),type:"circle",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M11 27a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0 1a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm0-10a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0 1a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm0-10a3 3 0 1 1 0 6 3 3 0 0 1 0-6zm0 1a2 2 0 1 0 0 4 2 2 0 0 0 0-4z"/></svg>'},{label:t("Toggle the square list style"),tooltip:t("Square"),type:"square",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M14 27v6H8v-6h6zm0-9v6H8v-6h6zm0-9v6H8V9h6z"/></svg>'}],s=t("Bulleted List"),r=t("Bulleted list styles toolbar"),a="bulletedList";e.ui.componentFactory.add(a,_e({editor:e,normalizedConfig:o,parentCommandName:a,buttonLabel:s,buttonIcon:n.Pt.bulletedList,styleGridAriaLabel:r,styleDefinitions:i})),e.ui.componentFactory.add(`menuBar:${a}`,ke({editor:e,normalizedConfig:o,parentCommandName:a,buttonLabel:s,styleGridAriaLabel:r,styleDefinitions:i}))}if(s.includes("numbered")||i.startIndex||i.reversed){const i=[{label:t("Toggle the decimal list style"),tooltip:t("Decimal"),type:"decimal",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M10.29 15V8.531H9.286c-.14.393-.4.736-.778 1.03-.378.295-.728.495-1.05.6v1.121a4.257 4.257 0 0 0 1.595-.936V15h1.235zm3.343 0v-1.235h-1.235V15h1.235zM11.3 24v-1.147H8.848c.064-.111.148-.226.252-.343.104-.117.351-.354.74-.712.39-.357.66-.631.81-.821.225-.288.39-.562.494-.824.104-.263.156-.539.156-.829 0-.51-.182-.936-.545-1.279-.363-.342-.863-.514-1.499-.514-.58 0-1.063.148-1.45.444-.387.296-.617.784-.69 1.463l1.23.124c.024-.36.112-.619.264-.774.153-.155.358-.233.616-.233.26 0 .465.074.613.222.148.148.222.36.222.635 0 .25-.085.501-.255.756-.126.185-.468.536-1.024 1.055-.692.641-1.155 1.156-1.389 1.544-.234.389-.375.8-.422 1.233H11.3zm2.333 0v-1.235h-1.235V24h1.235zM9.204 34.11c.615 0 1.129-.2 1.542-.598.413-.398.62-.88.62-1.446 0-.39-.11-.722-.332-.997a1.5 1.5 0 0 0-.886-.532c.619-.337.928-.788.928-1.353 0-.399-.151-.756-.453-1.073-.366-.386-.852-.58-1.459-.58a2.25 2.25 0 0 0-.96.2 1.617 1.617 0 0 0-.668.55c-.16.232-.28.544-.358.933l1.138.194c.032-.282.123-.495.272-.642.15-.146.33-.22.54-.22.215 0 .386.065.515.194s.193.302.193.518c0 .255-.087.46-.263.613-.176.154-.43.227-.765.218l-.136 1.006c.22-.061.409-.092.567-.092.24 0 .444.09.61.272.168.182.251.428.251.739 0 .328-.087.589-.261.782a.833.833 0 0 1-.644.29.841.841 0 0 1-.607-.242c-.167-.16-.27-.394-.307-.698l-1.196.145c.062.542.285.98.668 1.316.384.335.868.503 1.45.503zm4.43-.11v-1.235h-1.236V34h1.235z"/></svg>'},{label:t("Toggle the decimal with leading zero list style"),tooltip:t("Decimal with leading zero"),type:"decimal-leading-zero",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M5.714 15.11c.624 0 1.11-.22 1.46-.66.421-.533.632-1.408.632-2.627 0-1.222-.21-2.096-.629-2.624-.351-.445-.839-.668-1.463-.668-.624 0-1.11.22-1.459.66-.422.533-.633 1.406-.633 2.619 0 1.236.192 2.095.576 2.577.384.482.89.723 1.516.723zm0-1.024a.614.614 0 0 1-.398-.14c-.115-.094-.211-.283-.287-.565-.077-.283-.115-.802-.115-1.558s.043-1.294.128-1.613c.064-.246.155-.417.272-.512a.617.617 0 0 1 .4-.143.61.61 0 0 1 .398.143c.116.095.211.284.288.567.076.283.114.802.114 1.558s-.043 1.292-.128 1.608c-.064.246-.155.417-.272.512a.617.617 0 0 1-.4.143zm6.078.914V8.531H10.79c-.14.393-.4.736-.778 1.03-.378.295-.728.495-1.05.6v1.121a4.257 4.257 0 0 0 1.595-.936V15h1.235zm3.344 0v-1.235h-1.235V15h1.235zm-9.422 9.11c.624 0 1.11-.22 1.46-.66.421-.533.632-1.408.632-2.627 0-1.222-.21-2.096-.629-2.624-.351-.445-.839-.668-1.463-.668-.624 0-1.11.22-1.459.66-.422.533-.633 1.406-.633 2.619 0 1.236.192 2.095.576 2.577.384.482.89.723 1.516.723zm0-1.024a.614.614 0 0 1-.398-.14c-.115-.094-.211-.283-.287-.565-.077-.283-.115-.802-.115-1.558s.043-1.294.128-1.613c.064-.246.155-.417.272-.512a.617.617 0 0 1 .4-.143.61.61 0 0 1 .398.143c.116.095.211.284.288.567.076.283.114.802.114 1.558s-.043 1.292-.128 1.608c-.064.246-.155.417-.272.512a.617.617 0 0 1-.4.143zm7.088.914v-1.147H10.35c.065-.111.149-.226.253-.343.104-.117.35-.354.74-.712.39-.357.66-.631.81-.821.225-.288.39-.562.493-.824.104-.263.156-.539.156-.829 0-.51-.181-.936-.544-1.279-.364-.342-.863-.514-1.499-.514-.58 0-1.063.148-1.45.444-.387.296-.617.784-.69 1.463l1.23.124c.024-.36.112-.619.264-.774.152-.155.357-.233.615-.233.261 0 .465.074.613.222.148.148.222.36.222.635 0 .25-.085.501-.255.756-.126.185-.467.536-1.024 1.055-.691.641-1.154 1.156-1.388 1.544-.235.389-.375.8-.422 1.233h4.328zm2.334 0v-1.235h-1.235V24h1.235zM5.714 34.11c.624 0 1.11-.22 1.46-.66.421-.533.632-1.408.632-2.627 0-1.222-.21-2.096-.629-2.624-.351-.445-.839-.668-1.463-.668-.624 0-1.11.22-1.459.66-.422.533-.633 1.406-.633 2.619 0 1.236.192 2.095.576 2.577.384.482.89.723 1.516.723zm0-1.024a.614.614 0 0 1-.398-.14c-.115-.094-.211-.283-.287-.565-.077-.283-.115-.802-.115-1.558s.043-1.294.128-1.613c.064-.246.155-.417.272-.512a.617.617 0 0 1 .4-.143.61.61 0 0 1 .398.143c.116.095.211.284.288.567.076.283.114.802.114 1.558s-.043 1.292-.128 1.608c-.064.246-.155.417-.272.512a.617.617 0 0 1-.4.143zm4.992 1.024c.616 0 1.13-.2 1.543-.598.413-.398.62-.88.62-1.446 0-.39-.111-.722-.332-.997a1.5 1.5 0 0 0-.886-.532c.618-.337.927-.788.927-1.353 0-.399-.15-.756-.452-1.073-.366-.386-.853-.58-1.46-.58a2.25 2.25 0 0 0-.96.2 1.617 1.617 0 0 0-.667.55c-.16.232-.28.544-.359.933l1.139.194c.032-.282.123-.495.272-.642.15-.146.33-.22.54-.22.214 0 .386.065.515.194s.193.302.193.518c0 .255-.088.46-.264.613-.175.154-.43.227-.764.218l-.136 1.006c.22-.061.408-.092.566-.092.24 0 .444.09.611.272.167.182.25.428.25.739 0 .328-.086.589-.26.782a.833.833 0 0 1-.644.29.841.841 0 0 1-.607-.242c-.167-.16-.27-.394-.308-.698l-1.195.145c.062.542.284.98.668 1.316.384.335.867.503 1.45.503zm4.43-.11v-1.235h-1.235V34h1.235z"/></svg>'},{label:t("Toggle the lower–roman list style"),tooltip:t("Lower–roman"),type:"lower-roman",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M11.88 8.7V7.558h-1.234V8.7h1.234zm0 5.3V9.333h-1.234V14h1.234zm2.5 0v-1.235h-1.234V14h1.235zm-4.75 4.7v-1.142H8.395V18.7H9.63zm0 5.3v-4.667H8.395V24H9.63zm2.5-5.3v-1.142h-1.234V18.7h1.235zm0 5.3v-4.667h-1.234V24h1.235zm2.501 0v-1.235h-1.235V24h1.235zM7.38 28.7v-1.142H6.145V28.7H7.38zm0 5.3v-4.667H6.145V34H7.38zm2.5-5.3v-1.142H8.646V28.7H9.88zm0 5.3v-4.667H8.646V34H9.88zm2.5-5.3v-1.142h-1.234V28.7h1.235zm0 5.3v-4.667h-1.234V34h1.235zm2.501 0v-1.235h-1.235V34h1.235z"/></svg>'},{label:t("Toggle the upper–roman list style"),tooltip:t("Upper-roman"),type:"upper-roman",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M11.916 15V8.558h-1.301V15h1.3zm2.465 0v-1.235h-1.235V15h1.235zM9.665 25v-6.442h-1.3V25h1.3zm2.5 0v-6.442h-1.3V25h1.3zm2.466 0v-1.235h-1.235V25h1.235zm-7.216 9v-6.442h-1.3V34h1.3zm2.5 0v-6.442h-1.3V34h1.3zm2.501 0v-6.442h-1.3V34h1.3zm2.465 0v-1.235h-1.235V34h1.235z"/></svg>'},{label:t("Toggle the lower–latin list style"),tooltip:t("Lower-latin"),type:"lower-latin",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="M9.62 14.105c.272 0 .528-.05.768-.153s.466-.257.677-.462c.009.024.023.072.044.145.047.161.086.283.119.365h1.221a2.649 2.649 0 0 1-.222-.626c-.04-.195-.059-.498-.059-.908l.013-1.441c0-.536-.055-.905-.165-1.105-.11-.201-.3-.367-.569-.497-.27-.13-.68-.195-1.23-.195-.607 0-1.064.108-1.371.325-.308.217-.525.55-.65 1.002l1.12.202c.076-.217.176-.369.299-.455.123-.086.294-.13.514-.13.325 0 .546.05.663.152.118.101.176.27.176.508v.123c-.222.093-.622.194-1.2.303-.427.082-.755.178-.982.288-.227.11-.403.268-.53.474a1.327 1.327 0 0 0-.188.706c0 .398.138.728.415.988.277.261.656.391 1.136.391zm.368-.87a.675.675 0 0 1-.492-.189.606.606 0 0 1-.193-.448c0-.176.08-.32.241-.435.106-.07.33-.142.673-.215a7.19 7.19 0 0 0 .751-.19v.247c0 .296-.016.496-.048.602a.773.773 0 0 1-.295.409 1.07 1.07 0 0 1-.637.22zm4.645.765v-1.235h-1.235V14h1.235zM10.2 25.105c.542 0 1.003-.215 1.382-.646.38-.43.57-1.044.57-1.84 0-.771-.187-1.362-.559-1.774a1.82 1.82 0 0 0-1.41-.617c-.522 0-.973.216-1.354.65v-2.32H7.594V25h1.147v-.686a1.9 1.9 0 0 0 .67.592c.26.133.523.2.79.2zm-.299-.975c-.354 0-.638-.164-.852-.492-.153-.232-.229-.59-.229-1.073 0-.468.098-.818.295-1.048a.93.93 0 0 1 .738-.345c.302 0 .55.118.743.354.193.236.29.62.29 1.154 0 .5-.096.868-.288 1.1-.192.233-.424.35-.697.35zm4.478.87v-1.235h-1.234V25h1.234zm-4.017 9.105c.6 0 1.08-.142 1.437-.426.357-.284.599-.704.725-1.261l-1.213-.207c-.061.326-.167.555-.316.688a.832.832 0 0 1-.576.2.916.916 0 0 1-.75-.343c-.185-.228-.278-.62-.278-1.173 0-.498.091-.853.274-1.066.183-.212.429-.318.736-.318.232 0 .42.061.565.184.145.123.238.306.28.55l1.216-.22c-.146-.501-.387-.874-.722-1.119-.336-.244-.788-.366-1.356-.366-.695 0-1.245.214-1.653.643-.407.43-.61 1.03-.61 1.8 0 .762.202 1.358.608 1.788.406.431.95.646 1.633.646zM14.633 34v-1.235h-1.235V34h1.235z"/></svg>'},{label:t("Toggle the upper–latin list style"),tooltip:t("Upper-latin"),type:"upper-latin",icon:'<svg viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg"><path d="M35 29a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17zm0-9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H18a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h17z" fill-opacity=".163"/><path d="m7.88 15 .532-1.463h2.575L11.549 15h1.415l-2.58-6.442H9.01L6.5 15h1.38zm2.69-2.549H8.811l.87-2.39.887 2.39zM14.88 15v-1.235h-1.234V15h1.234zM9.352 25c.83-.006 1.352-.02 1.569-.044.346-.038.636-.14.872-.305.236-.166.422-.387.558-.664.137-.277.205-.562.205-.855 0-.372-.106-.695-.317-.97-.21-.276-.512-.471-.905-.585a1.51 1.51 0 0 0 .661-.567 1.5 1.5 0 0 0 .244-.83c0-.28-.066-.53-.197-.754a1.654 1.654 0 0 0-.495-.539 1.676 1.676 0 0 0-.672-.266c-.25-.042-.63-.063-1.14-.063H7.158V25h2.193zm.142-3.88H8.46v-1.49h.747c.612 0 .983.007 1.112.022.217.026.38.102.49.226.11.125.165.287.165.486a.68.68 0 0 1-.192.503.86.86 0 0 1-.525.23 11.47 11.47 0 0 1-.944.023h.18zm.17 2.795H8.46v-1.723h1.05c.592 0 .977.03 1.154.092.177.062.313.16.406.295a.84.84 0 0 1 .14.492c0 .228-.06.41-.181.547a.806.806 0 0 1-.473.257c-.126.026-.423.04-.892.04zM14.88 25v-1.235h-1.234V25h1.234zm-5.018 9.11c.691 0 1.262-.17 1.711-.512.45-.341.772-.864.965-1.567l-1.261-.4c-.109.472-.287.818-.536 1.037-.25.22-.547.33-.892.33-.47 0-.85-.173-1.143-.519-.293-.345-.44-.925-.44-1.74 0-.767.15-1.322.447-1.665.297-.343.684-.514 1.162-.514.346 0 .64.096.881.29.242.193.4.457.477.79l1.288-.307c-.147-.516-.367-.911-.66-1.187-.492-.465-1.132-.698-1.92-.698-.902 0-1.63.296-2.184.89-.554.593-.83 1.426-.83 2.498 0 1.014.275 1.813.825 2.397.551.585 1.254.877 2.11.877zM14.88 34v-1.235h-1.234V34h1.234z"/></svg>'}],r=t("Numbered List"),a=t("Numbered list styles toolbar"),l="numberedList";e.ui.componentFactory.add(l,_e({editor:e,normalizedConfig:o,parentCommandName:l,buttonLabel:r,buttonIcon:n.Pt.numberedList,styleGridAriaLabel:a,styleDefinitions:i})),s.includes("numbered")&&e.ui.componentFactory.add(`menuBar:${l}`,ke({editor:e,normalizedConfig:o,parentCommandName:l,buttonLabel:r,styleGridAriaLabel:a,styleDefinitions:i}))}}}function _e({editor:e,normalizedConfig:t,parentCommandName:i,buttonLabel:n,buttonIcon:o,styleGridAriaLabel:s,styleDefinitions:r}){const a=e.commands.get(i);return l=>{const c=(0,J.yu)(l,J.AO),d=c.buttonView;return c.bind("isEnabled").to(a),c.class="ck-list-styles-dropdown",d.on("execute",(()=>{e.execute(i),e.editing.view.focus()})),d.set({label:n,icon:o,tooltip:!0,isToggleable:!0}),d.bind("isOn").to(a,"value",(e=>!!e)),c.once("change:isOpen",(()=>{const n=function({editor:e,normalizedConfig:t,dropdownView:i,parentCommandName:n,styleDefinitions:o,styleGridAriaLabel:s}){const r=e.locale,a={...t,..."numberedList"!=n?{startIndex:!1,reversed:!1}:null},l=n.replace("List","");let c=null;if(t.styles.listTypes.includes(l)){const t=e.commands.get("listStyle"),i=ye({editor:e,parentCommandName:n,listStyleCommand:t}),s=Ce(t);c=o.filter(s).map(i)}const d=new we(r,{styleGridAriaLabel:s,enabledProperties:a,styleButtonViews:c});if(t.styles.listTypes.includes(l)&&(0,J.Zn)(i,(()=>d.stylesView.children.find((e=>e.isOn)))),a.startIndex){const t=e.commands.get("listStart");d.startIndexFieldView.bind("isEnabled").to(t),d.startIndexFieldView.fieldView.bind("value").to(t),d.on("listStart",((t,i)=>e.execute("listStart",i)))}if(a.reversed){const t=e.commands.get("listReversed");d.reversedSwitchButtonView.bind("isEnabled").to(t),d.reversedSwitchButtonView.bind("isOn").to(t,"value",(e=>!!e)),d.on("listReversed",(()=>{const i=t.value;e.execute("listReversed",{reversed:!i})}))}return d.delegate("execute").to(i),d}({editor:e,normalizedConfig:t,dropdownView:c,parentCommandName:i,styleGridAriaLabel:s,styleDefinitions:r});c.panelView.children.add(n)})),c.on("execute",(()=>{e.editing.view.focus()})),c}}function ye({editor:e,listStyleCommand:t,parentCommandName:i}){const n=e.locale,o=e.commands.get(i);return({label:s,type:r,icon:a,tooltip:l})=>{const c=new J._(n);return c.set({label:s,icon:a,tooltip:l}),t.on("change:value",(()=>{c.isOn=t.value===r})),c.on("execute",(()=>{o.value?t.value===r?e.execute(i):t.value!==r&&e.execute("listStyle",{type:r}):e.model.change((()=>{e.execute("listStyle",{type:r})}))})),c}}function ke({editor:e,normalizedConfig:t,parentCommandName:i,buttonLabel:o,styleGridAriaLabel:s,styleDefinitions:r}){return a=>{const l=new J.zj(a),c=e.commands.get(i),d=e.commands.get("listStyle"),u=Ce(d),h=ye({editor:e,parentCommandName:i,listStyleCommand:d}),m=r.filter(u).map(h),g=new we(a,{styleGridAriaLabel:s,enabledProperties:{...t,startIndex:!1,reversed:!1},styleButtonViews:m});return g.delegate("execute").to(l),l.buttonView.set({label:o,icon:n.Pt[i]}),l.panelView.children.add(g),l.bind("isEnabled").to(c,"isEnabled"),l.on("execute",(()=>{e.editing.view.focus()})),l}}function Ce(e){return"function"==typeof e.isStyleTypeSupported?t=>e.isStyleTypeSupported(t.type):()=>!0}class Ae extends n.k_{static get requires(){return[be,ve]}static get pluginName(){return"ListProperties"}}var Ee=i(4133);class xe extends n.uB{constructor(e){super(e),this.on("execute",(()=>{this.refresh()}),{priority:"highest"})}refresh(){const e=this._getSelectedItems();this.value=this._getValue(e),this.isEnabled=!!e.length}execute(e={}){this.editor.model.change((t=>{const i=this._getSelectedItems(),n=void 0===e.forceValue?!this._getValue(i):e.forceValue;for(const e of i)n?t.setAttribute("todoListChecked",!0,e):t.removeAttribute("todoListChecked",e)}))}_getValue(e){return e.every((e=>e.getAttribute("todoListChecked")))}_getSelectedItems(){const e=this.editor.model,t=e.schema,i=e.document.selection.getFirstRange(),n=i.start.parent,o=[];t.checkAttribute(n,"todoListChecked")&&o.push(...h(n));for(const e of i.getItems({shallow:!0}))t.checkAttribute(e,"todoListChecked")&&!o.includes(e)&&o.push(...h(e));return o}}class Te extends Ee.$A{constructor(){super(...arguments),this.domEventType=["change"]}onDomEvent(e){if(e.target){const t=this.view.domConverter.mapDomToView(e.target);t&&t.is("element","input")&&"checkbox"==t.getAttribute("type")&&t.findAncestor({classes:"todo-list__label"})&&this.fire("todoCheckboxChange",e)}}}const Pe=(0,r.ZX)("Ctrl+Enter");class Ie extends n.k_{static get pluginName(){return"TodoListEditing"}static get requires(){return[G]}init(){const e=this.editor,t=e.model,i=e.editing,n=e.plugins.get(G),o=e.config.get("list.multiBlock")?"paragraph":"listItem";e.commands.add("todoList",new V(e,"todo")),e.commands.add("checkTodoList",new xe(e)),i.view.addObserver(Te),t.schema.extend("$listItem",{allowAttributes:"todoListChecked"}),t.schema.addAttributeCheck((e=>{const t=e.last;if(!t.getAttribute("listItemId")||"todo"!=t.getAttribute("listType"))return!1}),"todoListChecked"),e.conversion.for("upcast").add((e=>{e.on("element:input",((e,t,i)=>{const n=t.modelCursor,o=n.parent,s=t.viewItem;if(!i.consumable.test(s,{name:!0}))return;if("checkbox"!=s.getAttribute("type")||!n.isAtStart||!o.hasAttribute("listType"))return;i.consumable.consume(s,{name:!0});const r=i.writer;r.setAttribute("listType","todo",o),t.viewItem.hasAttribute("checked")&&r.setAttribute("todoListChecked",!0,o),t.modelRange=r.createRange(n)})),e.on("element:label",Se({name:"label",classes:"todo-list__label"})),e.on("element:label",Se({name:"label",classes:["todo-list__label","todo-list__label_without-description"]})),e.on("element:span",Se({name:"span",classes:"todo-list__label__description"})),e.on("element:ul",function(e){const t=new Ee.PN({name:"ul",classes:"todo-list"});return(e,i,n)=>{const o=t.match(i.viewItem);if(!o)return;const s=o.match;s.name=!1,n.consumable.consume(i.viewItem,s)}}())})),e.conversion.for("downcast").elementToElement({model:o,view:(e,{writer:t})=>{if(Ve(e,n.getListAttributeNames()))return t.createContainerElement("span",{class:"todo-list__label__description"})},converterPriority:"highest"}),n.registerDowncastStrategy({scope:"list",attributeName:"listType",setAttributeOnDowncast(e,t,i){"todo"==t?e.addClass("todo-list",i):e.removeClass("todo-list",i)}}),n.registerDowncastStrategy({scope:"itemMarker",attributeName:"todoListChecked",createElement(e,t,{dataPipeline:i}){if("todo"!=t.getAttribute("listType"))return null;const n=e.createUIElement("input",{type:"checkbox",...t.getAttribute("todoListChecked")?{checked:"checked"}:null,...i?{disabled:"disabled"}:{tabindex:"-1"}});if(i)return n;const o=e.createContainerElement("span",{contenteditable:"false"},n);return o.getFillerOffset=()=>null,o},canWrapElement:e=>Ve(e,n.getListAttributeNames()),createWrapperElement(e,t,{dataPipeline:i}){const o=["todo-list__label"];return Ve(t,n.getListAttributeNames())||o.push("todo-list__label_without-description"),e.createAttributeElement(i?"label":"span",{class:o.join(" ")})}}),n.on("checkElement",((e,{modelElement:t,viewElement:i})=>{const o=Ve(t,n.getListAttributeNames());i.hasClass("todo-list__label__description")!=o&&(e.return=!0,e.stop())})),n.on("checkElement",((t,{modelElement:i,viewElement:n})=>{const o="todo"==i.getAttribute("listType")&&f(i);let s=!1;const r=e.editing.view.createPositionBefore(n).getWalker({direction:"backward"});for(const{item:t}of r){if(t.is("element")&&e.editing.mapper.toModelElement(t))break;t.is("element","input")&&"checkbox"==t.getAttribute("type")&&(s=!0)}s!=o&&(t.return=!0,t.stop())})),n.on("postFixer",((e,{listNodes:t,writer:i})=>{for(const{node:n,previousNodeInList:o}of t){if(!o)continue;if(o.getAttribute("listItemId")!=n.getAttribute("listItemId"))continue;const t=o.hasAttribute("todoListChecked"),s=n.hasAttribute("todoListChecked");s&&!t?(i.removeAttribute("todoListChecked",n),e.return=!0):!s&&t&&(i.setAttribute("todoListChecked",!0,n),e.return=!0)}})),t.document.registerPostFixer((e=>{const i=t.document.differ.getChanges();let n=!1;for(const t of i)if("attribute"==t.type&&"listType"==t.attributeKey){const i=t.range.start.nodeAfter;"todo"==t.attributeOldValue&&i.hasAttribute("todoListChecked")&&(e.removeAttribute("todoListChecked",i),n=!0)}else if("insert"==t.type&&"$text"!=t.name)for(const{item:i}of e.createRangeOn(t.position.nodeAfter))i.is("element")&&"todo"!=i.getAttribute("listType")&&i.hasAttribute("todoListChecked")&&(e.removeAttribute("todoListChecked",i),n=!0);return n})),this.listenTo(i.view.document,"keydown",((t,i)=>{(0,r.QC)(i)===Pe&&(e.execute("checkTodoList"),t.stop())}),{priority:"high"}),this.listenTo(i.view.document,"todoCheckboxChange",((e,t)=>{const n=t.target;if(!n||!n.is("element","input"))return;const o=i.view.createPositionAfter(n),s=i.mapper.toModelPosition(o).parent;s&&u(s)&&"todo"==s.getAttribute("listType")&&this._handleCheckmarkChange(s)})),this.listenTo(i.view.document,"arrowKey",function(e,t){return(i,n)=>{const o=(0,r.Kf)(n.keyCode,t.contentLanguageDirection),s=e.schema,a=e.document.selection;if(!a.isCollapsed)return;const l=a.getFirstPosition(),c=l.parent;if("right"==o&&l.isAtEnd){const t=s.getNearestSelectionRange(e.createPositionAfter(c),"forward");if(!t)return;const o=t.start.parent;o&&u(o)&&"todo"==o.getAttribute("listType")&&(e.change((e=>e.setSelection(t))),n.preventDefault(),n.stopPropagation(),i.stop())}else if("left"==o&&l.isAtStart&&u(c)&&"todo"==c.getAttribute("listType")){const t=s.getNearestSelectionRange(e.createPositionBefore(c),"backward");if(!t)return;e.change((e=>e.setSelection(t))),n.preventDefault(),n.stopPropagation(),i.stop()}}}(t,e.locale),{context:"$text"}),this.listenTo(i.mapper,"viewToModelPosition",((e,i)=>{const n=i.viewPosition.parent,o=n.is("attributeElement","li")&&0==i.viewPosition.offset,s=Re(n)&&i.viewPosition.offset<=1,r=n.is("element","span")&&"false"==n.getAttribute("contenteditable")&&Re(n.parent);if(!o&&!s&&!r)return;const a=i.modelPosition.nodeAfter;a&&"todo"==a.getAttribute("listType")&&(i.modelPosition=t.createPositionAt(a,0))}),{priority:"low"}),this._initAriaAnnouncements()}_handleCheckmarkChange(e){const t=this.editor,i=t.model,n=Array.from(i.document.selection.getRanges());i.change((i=>{i.setSelection(e,"end"),t.execute("checkTodoList"),i.setSelection(n)}))}_initAriaAnnouncements(){const{model:e,ui:t,t:i}=this.editor;let n=null;t&&e.document.selection.on("change:range",(()=>{const o=e.document.selection.focus.parent,s=Be(n),r=Be(o);s&&!r?t.ariaLiveAnnouncer.announce(i("Leaving a to-do list")):!s&&r&&t.ariaLiveAnnouncer.announce(i("Entering a to-do list")),n=o}))}}function Se(e){const t=new Ee.PN(e);return(e,i,n)=>{const o=t.match(i.viewItem);o&&n.consumable.consume(i.viewItem,o.match)&&Object.assign(i,n.convertChildren(i.viewItem,i.modelCursor))}}function Ve(e,t){return(e.is("element","paragraph")||e.is("element","listItem"))&&"todo"==e.getAttribute("listType")&&f(e)&&function(e,t){for(const i of e.getAttributeKeys())if(!i.startsWith("selection:")&&!t.includes(i))return!1;return!0}(e,t)}function Re(e){return!!e&&e.is("attributeElement")&&e.hasClass("todo-list__label")}function Be(e){return!(!e||!e.is("element","paragraph")&&!e.is("element","listItem")||"todo"!=e.getAttribute("listType"))}class Me extends n.k_{static get pluginName(){return"TodoListUI"}init(){const e=this.editor.t;Q(this.editor,"todoList",e("To-do List"),n.Pt.todoList)}}class Oe extends n.k_{static get requires(){return[Ie,Me]}static get pluginName(){return"TodoList"}}class Le extends n.uB{constructor(e,t){super(e),this.type=t}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,i=t.document,n=Array.from(i.selection.getSelectedBlocks()).filter((e=>Ne(e,t.schema))),o=void 0!==e.forceValue?!e.forceValue:this.value;t.change((e=>{if(o){let t=n[n.length-1].nextSibling,i=Number.POSITIVE_INFINITY,o=[];for(;t&&"listItem"==t.name&&0!==t.getAttribute("listIndent");){const e=t.getAttribute("listIndent");e<i&&(i=e);const n=e-i;o.push({element:t,listIndent:n}),t=t.nextSibling}o=o.reverse();for(const t of o)e.setAttribute("listIndent",t.listIndent,t.element)}if(!o){let e=Number.POSITIVE_INFINITY;for(const t of n)t.is("element","listItem")&&t.getAttribute("listIndent")<e&&(e=t.getAttribute("listIndent"));e=0===e?1:e,Fe(n,!0,e),Fe(n,!1,e)}for(const t of n.reverse())o&&"listItem"==t.name?e.rename(t,"paragraph"):o||"listItem"==t.name?o||"listItem"!=t.name||t.getAttribute("listType")==this.type||e.setAttribute("listType",this.type,t):(e.setAttributes({listType:this.type,listIndent:0},t),e.rename(t,"listItem"));this.fire("_executeCleanup",n)}))}_getValue(){const e=(0,r.$1)(this.editor.model.document.selection.getSelectedBlocks());return!!e&&e.is("element","listItem")&&e.getAttribute("listType")==this.type}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,i=(0,r.$1)(e.getSelectedBlocks());return!!i&&Ne(i,t)}}function Fe(e,t,i){const n=t?e[0]:e[e.length-1];if(n.is("element","listItem")){let o=n[t?"previousSibling":"nextSibling"],s=n.getAttribute("listIndent");for(;o&&o.is("element","listItem")&&o.getAttribute("listIndent")>=i;)s>o.getAttribute("listIndent")&&(s=o.getAttribute("listIndent")),o.getAttribute("listIndent")==s&&e[t?"unshift":"push"](o),o=o[t?"previousSibling":"nextSibling"]}}function Ne(e,t){return t.checkChild(e.parent,"listItem")&&!t.isObject(e)}class De extends n.uB{constructor(e,t){super(e),this._indentBy="forward"==t?1:-1}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model,t=e.document;let i=Array.from(t.selection.getSelectedBlocks());e.change((e=>{const t=i[i.length-1];let n=t.nextSibling;for(;n&&"listItem"==n.name&&n.getAttribute("listIndent")>t.getAttribute("listIndent");)i.push(n),n=n.nextSibling;this._indentBy<0&&(i=i.reverse());for(const t of i){const i=t.getAttribute("listIndent")+this._indentBy;i<0?e.rename(t,"paragraph"):e.setAttribute("listIndent",i,t)}this.fire("_executeCleanup",i)}))}_checkEnabled(){const e=(0,r.$1)(this.editor.model.document.selection.getSelectedBlocks());if(!e||!e.is("element","listItem"))return!1;if(this._indentBy>0){const t=e.getAttribute("listIndent"),i=e.getAttribute("listType");let n=e.previousSibling;for(;n&&n.is("element","listItem")&&n.getAttribute("listIndent")>=t;){if(n.getAttribute("listIndent")==t)return n.getAttribute("listType")==i;n=n.previousSibling}return!1}return!0}}function ze(e,t){const i=t.mapper,n=t.writer,o="numbered"==e.getAttribute("listType")?"ol":"ul",s=function(e){const t=e.createContainerElement("li");return t.getFillerOffset=Qe,t}(n),r=n.createContainerElement(o,null);return n.insert(n.createPositionAt(r,0),s),i.bindElements(e,s),s}function We(e,t,i,n){const o=t.parent,s=i.mapper,r=i.writer;let a=s.toViewPosition(n.createPositionBefore(e));const l=$e(e.previousSibling,{sameIndent:!0,smallerIndent:!0,listIndent:e.getAttribute("listIndent")}),c=e.previousSibling;if(l&&l.getAttribute("listIndent")==e.getAttribute("listIndent")){const e=s.toViewElement(l);a=r.breakContainer(r.createPositionAfter(e))}else if(c&&"listItem"==c.name){a=s.toViewPosition(n.createPositionAt(c,"end"));const e=s.findMappedViewAncestor(a),t=je(e);a=t?r.createPositionBefore(t):r.createPositionAt(e,"end")}else a=s.toViewPosition(n.createPositionBefore(e));if(a=Ue(a),r.insert(a,o),c&&"listItem"==c.name){const e=s.toViewElement(c),i=r.createRange(r.createPositionAt(e,0),a).getWalker({ignoreElementEnd:!0});for(const e of i)if(e.item.is("element","li")){const n=r.breakContainer(r.createPositionBefore(e.item)),o=e.item.parent,s=r.createPositionAt(t,"end");He(r,s.nodeBefore,s.nodeAfter),r.move(r.createRangeOn(o),s),i._position=n}}else{const i=o.nextSibling;if(i&&(i.is("element","ul")||i.is("element","ol"))){let n=null;for(const t of i.getChildren()){const i=s.toModelElement(t);if(!(i&&i.getAttribute("listIndent")>e.getAttribute("listIndent")))break;n=t}n&&(r.breakContainer(r.createPositionAfter(n)),r.move(r.createRangeOn(n.parent),r.createPositionAt(t,"end")))}}He(r,o,o.nextSibling),He(r,o.previousSibling,o)}function He(e,t,i){return!t||!i||"ul"!=t.name&&"ol"!=t.name||t.name!=i.name||t.getAttribute("class")!==i.getAttribute("class")?null:e.mergeContainers(e.createPositionAfter(t))}function Ue(e){return e.getLastMatchingPosition((e=>e.item.is("uiElement")))}function $e(e,t){const i=!!t.sameIndent,n=!!t.smallerIndent,o=t.listIndent;let s=e;for(;s&&"listItem"==s.name;){const e=s.getAttribute("listIndent");if(i&&o==e||n&&o>e)return s;s="forward"===t.direction?s.nextSibling:s.previousSibling}return null}function je(e){for(const t of e.getChildren())if("ul"==t.name||"ol"==t.name)return t;return null}function qe(e,t){const i=[],n=e.parent,o={ignoreElementEnd:!1,startPosition:e,shallow:!0,direction:t},s=n.getAttribute("listIndent"),r=[...new Ee.rU(o)].filter((e=>e.item.is("element"))).map((e=>e.item));for(const e of r){if(!e.is("element","listItem"))break;if(e.getAttribute("listIndent")<s)break;if(!(e.getAttribute("listIndent")>s)){if(e.getAttribute("listType")!==n.getAttribute("listType"))break;if(e.getAttribute("listStyle")!==n.getAttribute("listStyle"))break;if(e.getAttribute("listReversed")!==n.getAttribute("listReversed"))break;if(e.getAttribute("listStart")!==n.getAttribute("listStart"))break;"backward"===t?i.unshift(e):i.push(e)}}return i}function Ke(e){let t=[...e.document.selection.getSelectedBlocks()].filter((e=>e.is("element","listItem"))).map((t=>{const i=e.change((e=>e.createPositionAt(t,0)));return[...qe(i,"backward"),...qe(i,"forward")]})).flat();return t=[...new Set(t)],t}const Ge=["disc","circle","square"],Ze=["decimal","decimal-leading-zero","lower-roman","upper-roman","lower-latin","upper-latin"];function Je(e){return Ge.includes(e)?"bulleted":Ze.includes(e)?"numbered":null}function Qe(){const e=!this.isEmpty&&("ul"==this.getChild(0).name||"ol"==this.getChild(0).name);return this.isEmpty||e?0:Ee.SH.call(this)}class Ye extends n.k_{static get pluginName(){return"LegacyListUtils"}getListTypeFromListStyleType(e){return Je(e)}getSelectedListItems(e){return Ke(e)}getSiblingNodes(e,t){return qe(e,t)}}function Xe(e){return(t,i,n)=>{const o=n.consumable;if(!o.test(i.item,"insert")||!o.test(i.item,"attribute:listType")||!o.test(i.item,"attribute:listIndent"))return;o.consume(i.item,"insert"),o.consume(i.item,"attribute:listType"),o.consume(i.item,"attribute:listIndent");const s=i.item;We(s,ze(s,n),n,e)}}const et=(e,t,i)=>{if(!i.consumable.test(t.item,e.name))return;const n=i.mapper.toViewElement(t.item),o=i.writer;o.breakContainer(o.createPositionBefore(n)),o.breakContainer(o.createPositionAfter(n));const s=n.parent,r="numbered"==t.attributeNewValue?"ol":"ul";o.rename(r,s)},tt=(e,t,i)=>{i.consumable.consume(t.item,e.name);const n=i.mapper.toViewElement(t.item).parent,o=i.writer;He(o,n,n.nextSibling),He(o,n.previousSibling,n)},it=(e,t,i)=>{if(i.consumable.test(t.item,e.name)&&"listItem"!=t.item.name){let e=i.mapper.toViewPosition(t.range.start);const n=i.writer,o=[];for(;("ul"==e.parent.name||"ol"==e.parent.name)&&(e=n.breakContainer(e),"li"==e.parent.name);){const t=e,i=n.createPositionAt(e.parent,"end");if(!t.isEqual(i)){const e=n.remove(n.createRange(t,i));o.push(e)}e=n.createPositionAfter(e.parent)}if(o.length>0){for(let t=0;t<o.length;t++){const i=e.nodeBefore;if(e=n.insert(e,o[t]).end,t>0){const t=He(n,i,i.nextSibling);t&&t.parent==i&&e.offset--}}He(n,e.nodeBefore,e.nodeAfter)}}},nt=(e,t,i)=>{const n=i.mapper.toViewPosition(t.position),o=n.nodeBefore,s=n.nodeAfter;He(i.writer,o,s)},ot=(e,t,i)=>{if(i.consumable.consume(t.viewItem,{name:!0})){const e=i.writer,n=e.createElement("listItem"),o=function(e){let t=0,i=e.parent;for(;i;){if(i.is("element","li"))t++;else{const e=i.previousSibling;e&&e.is("element","li")&&t++}i=i.parent}return t}(t.viewItem);e.setAttribute("listIndent",o,n);const s=t.viewItem.parent&&"ol"==t.viewItem.parent.name?"numbered":"bulleted";if(e.setAttribute("listType",s,n),!i.safeInsert(n,t.modelCursor))return;const r=function(e,t,i){const{writer:n,schema:o}=i;let s=n.createPositionAfter(e);for(const r of t)if("ul"==r.name||"ol"==r.name)s=i.convertItem(r,s).modelCursor;else{const t=i.convertItem(r,n.createPositionAt(e,"end")),a=t.modelRange.start.nodeAfter;a&&a.is("element")&&!o.checkChild(e,a.name)&&(e=t.modelCursor.parent.is("element","listItem")?t.modelCursor.parent:ct(t.modelCursor),s=n.createPositionAfter(e))}return s}(n,t.viewItem.getChildren(),i);t.modelRange=e.createRange(t.modelCursor,r),i.updateConversionResult(n,t)}},st=(e,t,i)=>{if(i.consumable.test(t.viewItem,{name:!0})){const e=Array.from(t.viewItem.getChildren());for(const t of e)!t.is("element","li")&&!ut(t)&&t._remove()}},rt=(e,t,i)=>{if(i.consumable.test(t.viewItem,{name:!0})){if(0===t.viewItem.childCount)return;const e=[...t.viewItem.getChildren()];let i=!1;for(const t of e)i&&!ut(t)&&t._remove(),ut(t)&&(i=!0)}};function at(e){return(t,i)=>{if(i.isPhantom)return;const n=i.modelPosition.nodeBefore;if(n&&n.is("element","listItem")){const t=i.mapper.toViewElement(n),o=t.getAncestors().find(ut),s=e.createPositionAt(t,0).getWalker();for(const e of s){if("elementStart"==e.type&&e.item.is("element","li")){i.viewPosition=e.previousPosition;break}if("elementEnd"==e.type&&e.item==o){i.viewPosition=e.nextPosition;break}}}}}const lt=function(e,[t,i]){let n,o=t.is("documentFragment")?t.getChild(0):t;if(n=i?this.createSelection(i):this.document.selection,o&&o.is("element","listItem")){const e=n.getFirstPosition();let t=null;if(e.parent.is("element","listItem")?t=e.parent:e.nodeBefore&&e.nodeBefore.is("element","listItem")&&(t=e.nodeBefore),t){const e=t.getAttribute("listIndent");if(e>0)for(;o&&o.is("element","listItem");)o._setAttribute("listIndent",o.getAttribute("listIndent")+e),o=o.nextSibling}}};function ct(e){const t=new Ee.rU({startPosition:e});let i;do{i=t.next()}while(!i.value.item.is("element","listItem"));return i.value.item}function dt(e,t,i,n,o,s){const r=$e(t.nodeBefore,{sameIndent:!0,smallerIndent:!0,listIndent:e}),a=o.mapper,l=o.writer,c=r?r.getAttribute("listIndent"):null;let d;if(r)if(c==e){const e=a.toViewElement(r).parent;d=l.createPositionAfter(e)}else{const e=s.createPositionAt(r,"end");d=a.toViewPosition(e)}else d=i;d=Ue(d);for(const e of[...n.getChildren()])ut(e)&&(d=l.move(l.createRangeOn(e),d).end,He(l,e,e.nextSibling),He(l,e.previousSibling,e))}function ut(e){return e.is("element","ol")||e.is("element","ul")}class ht extends n.k_{static get pluginName(){return"LegacyListEditing"}static get requires(){return[s.x,o.ep,Ye]}init(){const e=this.editor;e.model.schema.register("listItem",{inheritAllFrom:"$block",allowAttributes:["listType","listIndent"]});const t=e.data,i=e.editing;var n;e.model.document.registerPostFixer((t=>function(e,t){const i=e.document.differ.getChanges(),n=new Map;let o=!1;for(const n of i)if("insert"==n.type&&"listItem"==n.name)s(n.position);else if("insert"==n.type&&"listItem"!=n.name){if("$text"!=n.name){const i=n.position.nodeAfter;i.hasAttribute("listIndent")&&(t.removeAttribute("listIndent",i),o=!0),i.hasAttribute("listType")&&(t.removeAttribute("listType",i),o=!0),i.hasAttribute("listStyle")&&(t.removeAttribute("listStyle",i),o=!0),i.hasAttribute("listReversed")&&(t.removeAttribute("listReversed",i),o=!0),i.hasAttribute("listStart")&&(t.removeAttribute("listStart",i),o=!0);for(const t of Array.from(e.createRangeIn(i)).filter((e=>e.item.is("element","listItem"))))s(t.previousPosition)}s(n.position.getShiftedBy(n.length))}else"remove"==n.type&&"listItem"==n.name?s(n.position):("attribute"==n.type&&"listIndent"==n.attributeKey||"attribute"==n.type&&"listType"==n.attributeKey)&&s(n.range.start);for(const e of n.values())r(e),a(e);return o;function s(e){const t=e.nodeBefore;if(t&&t.is("element","listItem")){let e=t;if(n.has(e))return;for(let t=e.previousSibling;t&&t.is("element","listItem");t=e.previousSibling)if(e=t,n.has(e))return;n.set(t,e)}else{const t=e.nodeAfter;t&&t.is("element","listItem")&&n.set(t,t)}}function r(e){let i=0,n=null;for(;e&&e.is("element","listItem");){const s=e.getAttribute("listIndent");if(s>i){let r;null===n?(n=s-i,r=i):(n>s&&(n=s),r=s-n),t.setAttribute("listIndent",r,e),o=!0}else n=null,i=e.getAttribute("listIndent")+1;e=e.nextSibling}}function a(e){let i=[],n=null;for(;e&&e.is("element","listItem");){const s=e.getAttribute("listIndent");if(n&&n.getAttribute("listIndent")>s&&(i=i.slice(0,s+1)),0!=s)if(i[s]){const n=i[s];e.getAttribute("listType")!=n&&(t.setAttribute("listType",n,e),o=!0)}else i[s]=e.getAttribute("listType");n=e,e=e.nextSibling}}}(e.model,t))),i.mapper.registerViewToModelLength("li",mt),t.mapper.registerViewToModelLength("li",mt),i.mapper.on("modelToViewPosition",at(i.view)),i.mapper.on("viewToModelPosition",(n=e.model,(e,t)=>{const i=t.viewPosition,o=i.parent,s=t.mapper;if("ul"==o.name||"ol"==o.name){if(i.isAtEnd){const e=s.toModelElement(i.nodeBefore),o=s.getModelLength(i.nodeBefore);t.modelPosition=n.createPositionBefore(e).getShiftedBy(o)}else{const e=s.toModelElement(i.nodeAfter);t.modelPosition=n.createPositionBefore(e)}e.stop()}else if("li"==o.name&&i.nodeBefore&&("ul"==i.nodeBefore.name||"ol"==i.nodeBefore.name)){const r=s.toModelElement(o);let a=1,l=i.nodeBefore;for(;l&&ut(l);)a+=s.getModelLength(l),l=l.previousSibling;t.modelPosition=n.createPositionBefore(r).getShiftedBy(a),e.stop()}})),t.mapper.on("modelToViewPosition",at(i.view)),e.conversion.for("editingDowncast").add((t=>{t.on("insert",it,{priority:"high"}),t.on("insert:listItem",Xe(e.model)),t.on("attribute:listType:listItem",et,{priority:"high"}),t.on("attribute:listType:listItem",tt,{priority:"low"}),t.on("attribute:listIndent:listItem",function(e){return(t,i,n)=>{if(!n.consumable.consume(i.item,"attribute:listIndent"))return;const o=n.mapper.toViewElement(i.item),s=n.writer;s.breakContainer(s.createPositionBefore(o)),s.breakContainer(s.createPositionAfter(o));const r=o.parent,a=r.previousSibling,l=s.createRangeOn(r);s.remove(l),a&&a.nextSibling&&He(s,a,a.nextSibling),dt(i.attributeOldValue+1,i.range.start,l.start,o,n,e),We(i.item,o,n,e);for(const e of i.item.getChildren())n.consumable.consume(e,"insert")}}(e.model)),t.on("remove:listItem",function(e){return(t,i,n)=>{const o=n.mapper.toViewPosition(i.position).getLastMatchingPosition((e=>!e.item.is("element","li"))).nodeAfter,s=n.writer;s.breakContainer(s.createPositionBefore(o)),s.breakContainer(s.createPositionAfter(o));const r=o.parent,a=r.previousSibling,l=s.createRangeOn(r),c=s.remove(l);a&&a.nextSibling&&He(s,a,a.nextSibling),dt(n.mapper.toModelElement(o).getAttribute("listIndent")+1,i.position,l.start,o,n,e);for(const e of s.createRangeIn(c).getItems())n.mapper.unbindViewElement(e);t.stop()}}(e.model)),t.on("remove",nt,{priority:"low"})})),e.conversion.for("dataDowncast").add((t=>{t.on("insert",it,{priority:"high"}),t.on("insert:listItem",Xe(e.model))})),e.conversion.for("upcast").add((e=>{e.on("element:ul",st,{priority:"high"}),e.on("element:ol",st,{priority:"high"}),e.on("element:li",rt,{priority:"high"}),e.on("element:li",ot)})),e.model.on("insertContent",lt,{priority:"high"}),e.commands.add("numberedList",new Le(e,"numbered")),e.commands.add("bulletedList",new Le(e,"bulleted")),e.commands.add("indentList",new De(e,"forward")),e.commands.add("outdentList",new De(e,"backward"));const o=i.view.document;this.listenTo(o,"enter",((e,t)=>{const i=this.editor.model.document,n=i.selection.getLastPosition().parent;i.selection.isCollapsed&&"listItem"==n.name&&n.isEmpty&&(this.editor.execute("outdentList"),t.preventDefault(),e.stop())}),{context:"li"}),this.listenTo(o,"delete",((e,t)=>{if("backward"!==t.direction)return;const i=this.editor.model.document.selection;if(!i.isCollapsed)return;const n=i.getFirstPosition();if(!n.isAtStart)return;const o=n.parent;"listItem"===o.name&&(o.previousSibling&&"listItem"===o.previousSibling.name||(this.editor.execute("outdentList"),t.preventDefault(),e.stop()))}),{context:"li"}),this.listenTo(e.editing.view.document,"tab",((t,i)=>{const n=i.shiftKey?"outdentList":"indentList";this.editor.commands.get(n).isEnabled&&(e.execute(n),i.stopPropagation(),i.preventDefault(),t.stop())}),{context:"li"})}afterInit(){const e=this.editor.commands,t=e.get("indent"),i=e.get("outdent");t&&t.registerChildCommand(e.get("indentList")),i&&i.registerChildCommand(e.get("outdentList"))}}function mt(e){let t=1;for(const i of e.getChildren())if("ul"==i.name||"ol"==i.name)for(const e of i.getChildren())t+=mt(e);return t}class gt extends n.k_{static get requires(){return[ht,X]}static get pluginName(){return"LegacyList"}}class ft extends n.uB{constructor(e,t){super(e),this.defaultType=t}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){this._tryToConvertItemsToList(e);const t=this.editor.model,i=Ke(t);i.length&&t.change((t=>{for(const n of i)t.setAttribute("listStyle",e.type||this.defaultType,n)}))}_getValue(){const e=this.editor.model.document.selection.getFirstPosition().parent;return e&&e.is("element","listItem")?e.getAttribute("listStyle"):null}_checkEnabled(){const e=this.editor,t=e.commands.get("numberedList"),i=e.commands.get("bulletedList");return t.isEnabled||i.isEnabled}_tryToConvertItemsToList(e){if(!e.type)return;const t=Je(e.type);if(!t)return;const i=this.editor,n=`${t}List`;i.commands.get(n).value||i.execute(n)}}class pt extends n.uB{refresh(){const e=this._getValue();this.value=e,this.isEnabled=null!=e}execute(e={}){const t=this.editor.model,i=Ke(t).filter((e=>"numbered"==e.getAttribute("listType")));t.change((t=>{for(const n of i)t.setAttribute("listReversed",!!e.reversed,n)}))}_getValue(){const e=this.editor.model.document.selection.getFirstPosition().parent;return e&&e.is("element","listItem")&&"numbered"==e.getAttribute("listType")?e.getAttribute("listReversed"):null}}class bt extends n.uB{refresh(){const e=this._getValue();this.value=e,this.isEnabled=null!=e}execute({startIndex:e=1}={}){const t=this.editor.model,i=Ke(t).filter((e=>"numbered"==e.getAttribute("listType")));t.change((t=>{for(const n of i)t.setAttribute("listStart",e>=0?e:1,n)}))}_getValue(){const e=this.editor.model.document.selection.getFirstPosition().parent;return e&&e.is("element","listItem")&&"numbered"==e.getAttribute("listType")?e.getAttribute("listStart"):null}}const wt="default";class vt extends n.k_{static get requires(){return[ht]}static get pluginName(){return"LegacyListPropertiesEditing"}constructor(e){super(e),e.config.define("list",{properties:{styles:!0,startIndex:!1,reversed:!1}})}init(){const e=this.editor,t=e.model,i=function(e){const t=[];return e.styles&&t.push({attributeName:"listStyle",defaultValue:wt,addCommand(e){e.commands.add("listStyle",new ft(e,wt))},appliesToListItem:()=>!0,setAttributeOnDowncast(e,t,i){t&&t!==wt?e.setStyle("list-style-type",t,i):e.removeStyle("list-style-type",i)},getAttributeOnUpcast:e=>e.getStyle("list-style-type")||wt}),e.reversed&&t.push({attributeName:"listReversed",defaultValue:!1,addCommand(e){e.commands.add("listReversed",new pt(e))},appliesToListItem:e=>"numbered"==e.getAttribute("listType"),setAttributeOnDowncast(e,t,i){t?e.setAttribute("reversed","reversed",i):e.removeAttribute("reversed",i)},getAttributeOnUpcast:e=>e.hasAttribute("reversed")}),e.startIndex&&t.push({attributeName:"listStart",defaultValue:1,addCommand(e){e.commands.add("listStart",new bt(e))},appliesToListItem:e=>"numbered"==e.getAttribute("listType"),setAttributeOnDowncast(e,t,i){0==t||t>1?e.setAttribute("start",t,i):e.removeAttribute("start",i)},getAttributeOnUpcast(e){const t=e.getAttribute("start");return t>=0?t:1}}),t}(e.config.get("list.properties"));t.schema.extend("listItem",{allowAttributes:i.map((e=>e.attributeName))});for(const t of i)t.addCommand(e);var n;this.listenTo(e.commands.get("indentList"),"_executeCleanup",function(e,t){return(i,n)=>{const o=n[0],s=o.getAttribute("listIndent"),r=n.filter((e=>e.getAttribute("listIndent")===s));let a=null;o.previousSibling.getAttribute("listIndent")+1!==s&&(a=$e(o.previousSibling,{sameIndent:!0,direction:"backward",listIndent:s})),e.model.change((e=>{for(const i of r)for(const n of t)if(n.appliesToListItem(i)){const t=null==a?n.defaultValue:a.getAttribute(n.attributeName);e.setAttribute(n.attributeName,t,i)}}))}}(e,i)),this.listenTo(e.commands.get("outdentList"),"_executeCleanup",function(e,t){return(i,n)=>{if(!(n=n.reverse().filter((e=>e.is("element","listItem")))).length)return;const o=n[0].getAttribute("listIndent"),s=n[0].getAttribute("listType");let r=n[0].previousSibling;if(r.is("element","listItem"))for(;r.getAttribute("listIndent")!==o;)r=r.previousSibling;else r=null;r||(r=n[n.length-1].nextSibling),r&&r.is("element","listItem")&&r.getAttribute("listType")===s&&e.model.change((e=>{const i=n.filter((e=>e.getAttribute("listIndent")===o));for(const n of i)for(const i of t)if(i.appliesToListItem(n)){const t=i.attributeName,o=r.getAttribute(t);e.setAttribute(t,o,n)}}))}}(e,i)),this.listenTo(e.commands.get("bulletedList"),"_executeCleanup",kt(e)),this.listenTo(e.commands.get("numberedList"),"_executeCleanup",kt(e)),t.document.registerPostFixer(function(e,t){return i=>{let n=!1;const o=Ct(e.model.document.differ.getChanges()).filter((e=>"todo"!==e.getAttribute("listType")));if(!o.length)return n;let s=o[o.length-1].nextSibling;if((!s||!s.is("element","listItem"))&&(s=o[0].previousSibling,s)){const e=o[0].getAttribute("listIndent");for(;s.is("element","listItem")&&s.getAttribute("listIndent")!==e&&(s=s.previousSibling,s););}for(const e of t){const t=e.attributeName;for(const r of o)if(e.appliesToListItem(r))if(r.hasAttribute(t)){const o=r.previousSibling;yt(o,r,e.attributeName)&&(i.setAttribute(t,o.getAttribute(t),r),n=!0)}else _t(s,r,e)?i.setAttribute(t,s.getAttribute(t),r):i.setAttribute(t,e.defaultValue,r),n=!0;else i.removeAttribute(t,r)}return n}}(e,i)),e.conversion.for("upcast").add((n=i,e=>{e.on("element:li",((e,t,i)=>{if(!t.modelRange)return;const o=t.viewItem.parent,s=t.modelRange.start.nodeAfter||t.modelRange.end.nodeBefore;for(const e of n)if(e.appliesToListItem(s)){const t=e.getAttributeOnUpcast(o);i.writer.setAttribute(e.attributeName,t,s)}}),{priority:"low"})})),e.conversion.for("downcast").add(function(e){return t=>{for(const i of e)t.on(`attribute:${i.attributeName}:listItem`,((e,t,n)=>{const o=n.writer,s=t.item,r=$e(s.previousSibling,{sameIndent:!0,listIndent:s.getAttribute("listIndent"),direction:"backward"}),a=n.mapper.toViewElement(s);var l,c;l=s,(c=r)&&l.getAttribute("listType")===c.getAttribute("listType")&&l.getAttribute("listIndent")===c.getAttribute("listIndent")&&l.getAttribute("listStyle")===c.getAttribute("listStyle")&&l.getAttribute("listReversed")===c.getAttribute("listReversed")&&l.getAttribute("listStart")===c.getAttribute("listStart")||o.breakContainer(o.createPositionBefore(a)),i.setAttributeOnDowncast(o,t.attributeNewValue,a.parent)}),{priority:"low"})}}(i)),this._mergeListAttributesWhileMergingLists(i)}afterInit(){const e=this.editor;e.commands.get("todoList")&&e.model.document.registerPostFixer(function(e){return t=>{const i=Ct(e.model.document.differ.getChanges()).filter((e=>"todo"===e.getAttribute("listType")&&(e.hasAttribute("listStyle")||e.hasAttribute("listReversed")||e.hasAttribute("listStart"))));if(!i.length)return!1;for(const e of i)t.removeAttribute("listStyle",e),t.removeAttribute("listReversed",e),t.removeAttribute("listStart",e);return!0}}(e))}_mergeListAttributesWhileMergingLists(e){const t=this.editor.model;let i;this.listenTo(t,"deleteContent",((e,[t])=>{const n=t.getFirstPosition(),o=t.getLastPosition();if(n.parent===o.parent)return;if(!n.parent.is("element","listItem"))return;const s=o.parent.nextSibling;if(!s||!s.is("element","listItem"))return;const r=$e(n.parent,{sameIndent:!0,listIndent:s.getAttribute("listIndent")});r&&r.getAttribute("listType")===s.getAttribute("listType")&&(i=r)}),{priority:"high"}),this.listenTo(t,"deleteContent",(()=>{i&&(t.change((t=>{const n=$e(i.nextSibling,{sameIndent:!0,listIndent:i.getAttribute("listIndent"),direction:"forward"});if(!n)return void(i=null);const o=[n,...qe(t.createPositionAt(n,0),"forward")];for(const n of o)for(const o of e)if(o.appliesToListItem(n)){const e=o.attributeName,s=i.getAttribute(e);t.setAttribute(e,s,n)}})),i=null)}),{priority:"low"})}}function _t(e,t,i){if(!e)return!1;const n=e.getAttribute(i.attributeName);return!!n&&n!=i.defaultValue&&e.getAttribute("listType")===t.getAttribute("listType")}function yt(e,t,i){if(!e||!e.is("element","listItem"))return!1;if(t.getAttribute("listType")!==e.getAttribute("listType"))return!1;const n=e.getAttribute("listIndent");if(n<1||n!==t.getAttribute("listIndent"))return!1;const o=e.getAttribute(i);return!(!o||o===t.getAttribute(i))}function kt(e){return(t,i)=>{i=i.filter((e=>e.is("element","listItem"))),e.model.change((e=>{for(const t of i)e.removeAttribute("listStyle",t)}))}}function Ct(e){const t=[];for(const i of e){const e=At(i);e&&e.is("element","listItem")&&t.push(e)}return t}function At(e){return"attribute"===e.type?e.range.start.nodeAfter:"insert"===e.type?e.position.nodeAfter:null}class Et extends n.k_{static get requires(){return[vt,ve]}static get pluginName(){return"LegacyListProperties"}}const xt="todoListChecked";class Tt extends n.uB{constructor(e){super(e),this._selectedElements=[],this.on("execute",(()=>{this.refresh()}),{priority:"highest"})}refresh(){this._selectedElements=this._getSelectedItems(),this.value=this._selectedElements.every((e=>!!e.getAttribute(xt))),this.isEnabled=!!this._selectedElements.length}_getSelectedItems(){const e=this.editor.model,t=e.schema,i=e.document.selection.getFirstRange(),n=i.start.parent,o=[];t.checkAttribute(n,xt)&&o.push(n);for(const e of i.getItems())t.checkAttribute(e,xt)&&!o.includes(e)&&o.push(e);return o}execute(e={}){this.editor.model.change((t=>{for(const i of this._selectedElements)(void 0===e.forceValue?!this.value:e.forceValue)?t.setAttribute(xt,!0,i):t.removeAttribute(xt,i)}))}}const Pt=(e,t,i)=>{const n=t.modelCursor,o=n.parent,s=t.viewItem;if("checkbox"!=s.getAttribute("type")||"listItem"!=o.name||!n.isAtStart)return;if(!i.consumable.consume(s,{name:!0}))return;const r=i.writer;r.setAttribute("listType","todo",o),t.viewItem.hasAttribute("checked")&&r.setAttribute("todoListChecked",!0,o),t.modelRange=r.createRange(n)};function It(e){return(t,i)=>{const n=i.modelPosition,o=n.parent;if(!o.is("element","listItem")||"todo"!=o.getAttribute("listType"))return;const s=Vt(i.mapper.toViewElement(o),e);s&&(i.viewPosition=i.mapper.findPositionIn(s,n.offset))}}function St(e,t,i,n){return t.createUIElement("label",{class:"todo-list__label",contenteditable:!1},(function(t){const o=(0,r.n)(document,"input",{type:"checkbox",tabindex:"-1"});i&&o.setAttribute("checked","checked"),o.addEventListener("change",(()=>n(e)));const s=this.toDomElement(t);return s.appendChild(o),s}))}function Vt(e,t){const i=t.createRangeIn(e);for(const e of i)if(e.item.is("containerElement","span")&&e.item.hasClass("todo-list__label__description"))return e.item}const Rt=(0,r.ZX)("Ctrl+Enter");class Bt extends n.k_{static get pluginName(){return"LegacyTodoListEditing"}static get requires(){return[ht]}init(){const e=this.editor,{editing:t,data:i,model:n}=e;n.schema.extend("listItem",{allowAttributes:["todoListChecked"]}),n.schema.addAttributeCheck(((e,t)=>{const i=e.last;if("todoListChecked"==t&&"listItem"==i.name&&"todo"!=i.getAttribute("listType"))return!1})),e.commands.add("todoList",new Le(e,"todo"));const o=new Tt(e);var s,a;e.commands.add("checkTodoList",o),e.commands.add("todoListCheck",o),i.downcastDispatcher.on("insert:listItem",function(e){return(t,i,n)=>{const o=n.consumable;if(!o.test(i.item,"insert")||!o.test(i.item,"attribute:listType")||!o.test(i.item,"attribute:listIndent"))return;if("todo"!=i.item.getAttribute("listType"))return;const s=i.item;o.consume(s,"insert"),o.consume(s,"attribute:listType"),o.consume(s,"attribute:listIndent"),o.consume(s,"attribute:todoListChecked");const r=n.writer,a=ze(s,n);r.addClass("todo-list",a.parent);const l=r.createContainerElement("label",{class:"todo-list__label"}),c=r.createEmptyElement("input",{type:"checkbox",disabled:"disabled"}),d=r.createContainerElement("span",{class:"todo-list__label__description"});s.getAttribute("todoListChecked")&&r.setAttribute("checked","checked",c),r.insert(r.createPositionAt(a,0),l),r.insert(r.createPositionAt(l,0),c),r.insert(r.createPositionAfter(c),d),We(s,a,n,e)}}(n),{priority:"high"}),i.upcastDispatcher.on("element:input",Pt,{priority:"high"}),t.downcastDispatcher.on("insert:listItem",function(e,t){return(i,n,o)=>{const s=o.consumable;if(!s.test(n.item,"insert")||!s.test(n.item,"attribute:listType")||!s.test(n.item,"attribute:listIndent"))return;if("todo"!=n.item.getAttribute("listType"))return;const r=n.item;s.consume(r,"insert"),s.consume(r,"attribute:listType"),s.consume(r,"attribute:listIndent"),s.consume(r,"attribute:todoListChecked");const a=o.writer,l=ze(r,o),c=!!r.getAttribute("todoListChecked"),d=St(r,a,c,t),u=a.createContainerElement("span",{class:"todo-list__label__description"});a.addClass("todo-list",l.parent),a.insert(a.createPositionAt(l,0),d),a.insert(a.createPositionAfter(d),u),We(r,l,o,e)}}(n,(e=>this._handleCheckmarkChange(e))),{priority:"high"}),t.downcastDispatcher.on("attribute:listType:listItem",(s=e=>this._handleCheckmarkChange(e),a=t.view,(e,t,i)=>{if(!i.consumable.consume(t.item,e.name))return;const n=i.mapper.toViewElement(t.item),o=i.writer,r=function(e,t){const i=t.createRangeIn(e);for(const e of i)if(e.item.is("uiElement","label"))return e.item}(n,a);if("todo"==t.attributeNewValue){const e=!!t.item.getAttribute("todoListChecked"),i=St(t.item,o,e,s),r=o.createContainerElement("span",{class:"todo-list__label__description"}),a=o.createRangeIn(n),l=je(n),c=Ue(a.start),d=l?o.createPositionBefore(l):a.end,u=o.createRange(c,d);o.addClass("todo-list",n.parent),o.move(u,o.createPositionAt(r,0)),o.insert(o.createPositionAt(n,0),i),o.insert(o.createPositionAfter(i),r)}else if("todo"==t.attributeOldValue){const e=Vt(n,a);o.removeClass("todo-list",n.parent),o.remove(r),o.move(o.createRangeIn(e),o.createPositionBefore(e)),o.remove(e)}})),t.downcastDispatcher.on("attribute:todoListChecked:listItem",function(e){return(t,i,n)=>{if("todo"!=i.item.getAttribute("listType"))return;if(!n.consumable.consume(i.item,"attribute:todoListChecked"))return;const{mapper:o,writer:s}=n,r=!!i.item.getAttribute("todoListChecked"),a=o.toViewElement(i.item).getChild(0),l=St(i.item,s,r,e);s.insert(s.createPositionAfter(a),l),s.remove(a)}}((e=>this._handleCheckmarkChange(e)))),t.mapper.on("modelToViewPosition",It(t.view)),i.mapper.on("modelToViewPosition",It(t.view)),this.listenTo(t.view.document,"arrowKey",function(e,t){return(i,n)=>{if("left"!=(0,r.Kf)(n.keyCode,t.contentLanguageDirection))return;const o=e.schema,s=e.document.selection;if(!s.isCollapsed)return;const a=s.getFirstPosition(),l=a.parent;if("listItem"===l.name&&"todo"==l.getAttribute("listType")&&a.isAtStart){const t=o.getNearestSelectionRange(e.createPositionBefore(l),"backward");t&&e.change((e=>e.setSelection(t))),n.preventDefault(),n.stopPropagation(),i.stop()}}}(n,e.locale),{context:"li"}),this.listenTo(t.view.document,"keydown",((t,i)=>{(0,r.QC)(i)===Rt&&(e.execute("checkTodoList"),t.stop())}),{priority:"high"});const l=new Set;this.listenTo(n,"applyOperation",((e,t)=>{const i=t[0];if("rename"==i.type&&"listItem"==i.oldName){const e=i.position.nodeAfter;e.hasAttribute("todoListChecked")&&l.add(e)}else if("changeAttribute"==i.type&&"listType"==i.key&&"todo"===i.oldValue)for(const e of i.range.getItems())e.hasAttribute("todoListChecked")&&"todo"!==e.getAttribute("listType")&&l.add(e)})),n.document.registerPostFixer((e=>{let t=!1;for(const i of l)e.removeAttribute("todoListChecked",i),t=!0;return l.clear(),t})),this._initAriaAnnouncements()}_handleCheckmarkChange(e){const t=this.editor,i=t.model,n=Array.from(i.document.selection.getRanges());i.change((i=>{i.setSelection(e,"end"),t.execute("checkTodoList"),i.setSelection(n)}))}_initAriaAnnouncements(){const{model:e,ui:t,t:i}=this.editor;let n=null;t&&e.document.selection.on("change:range",(()=>{const o=e.document.selection.focus.parent,s=Mt(n),r=Mt(o);s&&!r?t.ariaLiveAnnouncer.announce(i("Leaving a to-do list")):!s&&r&&t.ariaLiveAnnouncer.announce(i("Entering a to-do list")),n=o}))}}function Mt(e){return!!e&&e.is("element","listItem")&&"todo"===e.getAttribute("listType")}class Ot extends n.k_{static get requires(){return[Bt,Me]}static get pluginName(){return"LegacyTodoList"}}class Lt extends n.k_{static get pluginName(){return"AdjacentListsSupport"}init(){const e=this.editor;e.model.schema.register("listSeparator",{allowWhere:"$block",isBlock:!0}),e.conversion.for("upcast").add((e=>{e.on("element:ol",Ft()),e.on("element:ul",Ft())})).elementToElement({model:"listSeparator",view:"ck-list-separator"}),e.conversion.for("editingDowncast").elementToElement({model:"listSeparator",view:{name:"div",classes:["ck-list-separator","ck-hidden"]}}),e.conversion.for("dataDowncast").elementToElement({model:"listSeparator",view:(e,t)=>{const i=t.writer.createContainerElement("ck-list-separator");return t.writer.setCustomProperty("dataPipeline:transparentRendering",!0,i),i.getFillerOffset=()=>null,i}})}}function Ft(){return(e,t,i)=>{const n=t.viewItem,o=n.nextSibling;if(!o)return;if(n.name!==o.name)return;t.modelRange||Object.assign(t,i.convertChildren(t.viewItem,t.modelCursor));const s=i.writer,r=s.createElement("listSeparator");if(!i.safeInsert(r,t.modelCursor))return;const a=i.getSplitParts(r);t.modelRange=s.createRange(t.modelRange.start,s.createPositionAfter(a[a.length-1])),i.updateConversionResult(r,t)}}class Nt extends n.k_{static get requires(){return[ee]}static get pluginName(){return"DocumentList"}constructor(e){super(e),(0,r.FF)("plugin-obsolete-documentlist",{pluginName:"DocumentList"})}}class Dt extends n.k_{static get requires(){return[Ae]}static get pluginName(){return"DocumentListProperties"}constructor(e){super(e),(0,r.FF)("plugin-obsolete-documentlistproperties",{pluginName:"DocumentListProperties"})}}class zt extends n.k_{static get requires(){return[Oe]}static get pluginName(){return"TodoDocumentList"}constructor(e){super(e),(0,r.FF)("plugin-obsolete-tododocumentlist",{pluginName:"TodoDocumentList"})}}},2801:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DomWrapperView:()=>w,Mention:()=>I,MentionEditing:()=>a,MentionListItemView:()=>v,MentionUI:()=>k,MentionsView:()=>b});var n=i(1204),o=i(5318);const s={"(":")","[":"]","{":"}"};class r extends n.uB{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"mention")}execute(e){const t=this.editor.model,i=t.document.selection,n="string"==typeof e.mention?{id:e.mention}:e.mention,r=n.id,a=e.range||i.getFirstRange();if(!t.canEditAt(a))return;const c=e.text||r,d=l({_text:c,id:r},n);if(1!=e.marker.length)throw new o.Yb("mentioncommand-incorrect-marker",this);if(r.charAt(0)!=e.marker)throw new o.Yb("mentioncommand-incorrect-id",this);t.change((e=>{const n=(0,o.av)(i.getAttributes()),r=new Map(n.entries());r.set("mention",d);const l=t.insertContent(e.createText(c,r),a),u=l.start.nodeBefore,h=l.end.nodeAfter,m=h&&h.is("$text")&&h.data.startsWith(" ");let g=!1;if(u&&h&&u.is("$text")&&h.is("$text")){const e=u.data.slice(-1),t=e in s,i=t&&h.data.startsWith(s[e]);g=t&&i}g||m||t.insertContent(e.createText(" ",n),a.start.getShiftedBy(c.length))}))}}class a extends n.k_{static get pluginName(){return"MentionEditing"}init(){const e=this.editor,t=e.model,i=t.document;t.schema.extend("$text",{allowAttributes:"mention"}),e.conversion.for("upcast").elementToAttribute({view:{name:"span",key:"data-mention",classes:"mention"},model:{key:"mention",value:e=>c(e)}}),e.conversion.for("downcast").attributeToElement({model:"mention",view:u}),e.conversion.for("downcast").add(d),i.registerPostFixer((e=>function(e,t,i){const n=t.differ.getChanges();let o=!1;for(const t of n){if("attribute"==t.type)continue;const n=t.position;if("$text"==t.name){const t=n.textNode&&n.textNode.nextSibling;o=m(n.textNode,e)||o,o=m(t,e)||o,o=m(n.nodeBefore,e)||o,o=m(n.nodeAfter,e)||o}if("$text"!=t.name&&"insert"==t.type){const t=n.nodeAfter;for(const i of e.createRangeIn(t).getItems())o=m(i,e)||o}if("insert"==t.type&&i.isInline(t.name)){const t=n.nodeAfter&&n.nodeAfter.nextSibling;o=m(n.nodeBefore,e)||o,o=m(t,e)||o}}return o}(e,i,t.schema))),i.registerPostFixer((e=>function(e,t){const i=t.differ.getChanges();let n=!1;for(const t of i)if("attribute"===t.type&&"mention"!=t.attributeKey){const i=t.range.start.nodeBefore,o=t.range.end.nodeAfter;for(const s of[i,o])h(s)&&s.getAttribute(t.attributeKey)!=t.attributeNewValue&&(e.setAttribute(t.attributeKey,t.attributeNewValue,s),n=!0)}return n}(e,i))),i.registerPostFixer((e=>function(e,t){const i=t.selection,n=i.focus;return!!(i.isCollapsed&&i.hasAttribute("mention")&&function(e){const t=e.isAtStart;return e.nodeBefore&&e.nodeBefore.is("$text")||t}(n))&&(e.removeSelectionAttribute("mention"),!0)}(e,i))),e.commands.add("mention",new r(e))}}function l(e,t){return Object.assign({uid:(0,o.Ld)()},e,t||{})}function c(e,t){const i=e.getAttribute("data-mention"),n=e.getChild(0);if(n)return l({id:i,_text:n.data},t)}function d(e){e.on("attribute:mention",((e,t,i)=>{const n=t.attributeNewValue;if(!t.item.is("$textProxy")||!n)return;const o=t.range.start;(o.textNode||o.nodeAfter).data!=n._text&&i.consumable.consume(t.item,e.name)}),{priority:"highest"})}function u(e,{writer:t}){if(!e)return;const i={class:"mention","data-mention":e.id},n={id:e.uid,priority:20};return t.createAttributeElement("span",i,n)}function h(e){return!(!e||!e.is("$text")&&!e.is("$textProxy")||!e.hasAttribute("mention"))&&e.data!=e.getAttribute("mention")._text}function m(e,t){return!!h(e)&&(t.removeAttribute("mention",e),!0)}var g=i(949),f=i(7211),p=i(2223);class b extends g.uO{constructor(e){super(e),this.extendTemplate({attributes:{class:["ck-mentions"],tabindex:"-1"}})}selectFirst(){this.select(0)}selectNext(){const e=this.selected,t=this.items.getIndex(e);this.select(t+1)}selectPrevious(){const e=this.selected,t=this.items.getIndex(e);this.select(t-1)}select(e){let t=0;e>0&&e<this.items.length?t=e:e<0&&(t=this.items.length-1);const i=this.items.get(t);this.selected!==i&&(this.selected&&this.selected.removeHighlight(),i.highlight(),this.selected=i,this._isItemVisibleInScrolledArea(i)||(this.element.scrollTop=i.element.offsetTop))}executeSelected(){this.selected.fire("execute")}_isItemVisibleInScrolledArea(e){return new o.rw(this.element).contains(new o.rw(e.element))}}class w extends g.Ss{constructor(e,t){super(e),this.template=void 0,this.domElement=t,this.domElement.classList.add("ck-button"),this.set("isOn",!1),this.on("change:isOn",((e,t,i)=>{i?(this.domElement.classList.add("ck-on"),this.domElement.classList.remove("ck-off")):(this.domElement.classList.add("ck-off"),this.domElement.classList.remove("ck-on"))})),this.listenTo(this.domElement,"click",(()=>{this.fire("execute")}))}render(){super.render(),this.element=this.domElement}focus(){this.domElement.focus()}}class v extends g.BD{highlight(){this.children.first.isOn=!0}removeHighlight(){this.children.first.isOn=!1}}const _=[o.uP.arrowup,o.uP.arrowdown,o.uP.esc],y=[o.uP.enter,o.uP.tab];class k extends n.k_{static get pluginName(){return"MentionUI"}static get requires(){return[g.pU]}constructor(e){super(e),this._items=new o.pM,this._mentionsView=this._createMentionView(),this._mentionsConfigurations=new Map,this._requestFeedDebounced=(0,p.A)(this._requestFeed,100),e.config.define("mention",{feeds:[]})}init(){const e=this.editor,t=e.config.get("mention.commitKeys")||y,i=_.concat(t);this._balloon=e.plugins.get(g.pU),e.editing.view.document.on("keydown",((e,n)=>{var s;s=n.keyCode,i.includes(s)&&this._isUIVisible&&(n.preventDefault(),e.stop(),n.keyCode==o.uP.arrowdown&&this._mentionsView.selectNext(),n.keyCode==o.uP.arrowup&&this._mentionsView.selectPrevious(),t.includes(n.keyCode)&&this._mentionsView.executeSelected(),n.keyCode==o.uP.esc&&this._hideUIAndRemoveMarker())}),{priority:"highest"}),(0,g.wy)({emitter:this._mentionsView,activator:()=>this._isUIVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUIAndRemoveMarker()});const n=e.config.get("mention.feeds");for(const e of n){const{feed:t,marker:i,dropdownLimit:n}=e;if(!T(i))throw new o.Yb("mentionconfig-incorrect-marker",null,{marker:i});const s={marker:i,feedCallback:"function"==typeof t?t.bind(this.editor):x(t),itemRenderer:e.itemRenderer,dropdownLimit:n};this._mentionsConfigurations.set(i,s)}this._setupTextWatcher(n),this.listenTo(e,"change:isReadOnly",(()=>{this._hideUIAndRemoveMarker()})),this.on("requestFeed:response",((e,t)=>this._handleFeedResponse(t))),this.on("requestFeed:error",(()=>this._hideUIAndRemoveMarker()))}destroy(){super.destroy(),this._mentionsView.destroy()}get _isUIVisible(){return this._balloon.visibleView===this._mentionsView}_createMentionView(){const e=this.editor.locale,t=new b(e);return t.items.bindTo(this._items).using((i=>{const{item:n,marker:o}=i,{dropdownLimit:s}=this._mentionsConfigurations.get(o),r=s||this.editor.config.get("mention.dropdownLimit")||10;if(t.items.length>=r)return null;const a=new v(e),l=this._renderItem(n,o);return l.delegate("execute").to(a),a.children.add(l),a.item=n,a.marker=o,a.on("execute",(()=>{t.fire("execute",{item:n,marker:o})})),a})),t.on("execute",((e,t)=>{const i=this.editor,n=i.model,o=t.item,s=t.marker,r=i.model.markers.get("mention"),a=n.createPositionAt(n.document.selection.focus),l=n.createPositionAt(r.getStart()),c=n.createRange(l,a);this._hideUIAndRemoveMarker(),i.execute("mention",{mention:o,text:o.text,marker:s,range:c}),i.editing.view.focus()})),t}_getItemRenderer(e){const{itemRenderer:t}=this._mentionsConfigurations.get(e);return t}_requestFeed(e,t){this._lastRequested=t;const{feedCallback:i}=this._mentionsConfigurations.get(e),n=i(t);n instanceof Promise?n.then((i=>{this._lastRequested==t?this.fire("requestFeed:response",{feed:i,marker:e,feedText:t}):this.fire("requestFeed:discarded",{feed:i,marker:e,feedText:t})})).catch((t=>{this.fire("requestFeed:error",{error:t}),(0,o.FF)("mention-feed-callback-error",{marker:e})})):this.fire("requestFeed:response",{feed:n,marker:e,feedText:t})}_setupTextWatcher(e){const t=this.editor,i=e.map((e=>({...e,pattern:E(e.marker,e.minimumCharacters||0)}))),n=new f.qV(t.model,function(e){return t=>{const i=A(e,t);if(!i)return!1;let n=0;0!==i.position&&(n=i.position-1);const o=t.substring(n);return i.pattern.test(o)}}(i));n.on("matched",((e,n)=>{const o=A(i,n.text),s=t.model.document.selection.focus,r=t.model.createPositionAt(s.parent,o.position);if(function(e){const t=e.textNode&&e.textNode.hasAttribute("mention"),i=e.nodeBefore;return t||i&&i.is("$text")&&i.hasAttribute("mention")}(s)||function(e){const t=e.nodeAfter;return t&&t.is("$text")&&t.hasAttribute("mention")}(r))return void this._hideUIAndRemoveMarker();const a=function(e,t){let i=0;0!==e.position&&(i=e.position-1);const n=E(e.marker,0);return t.substring(i).match(n)[2]}(o,n.text),l=o.marker.length+a.length,c=s.getShiftedBy(-l),d=s.getShiftedBy(-a.length),u=t.model.createRange(c,d);if(P(t)){const e=t.model.markers.get("mention");t.model.change((t=>{t.updateMarker(e,{range:u})}))}else t.model.change((e=>{e.addMarker("mention",{range:u,usingOperation:!1,affectsData:!1})}));this._requestFeedDebounced(o.marker,a)})),n.on("unmatched",(()=>{this._hideUIAndRemoveMarker()}));const o=t.commands.get("mention");return n.bind("isEnabled").to(o),n}_handleFeedResponse(e){const{feed:t,marker:i}=e;if(!P(this.editor))return;this._items.clear();for(const e of t){const t="object"!=typeof e?{id:e,text:e}:e;this._items.add({item:t,marker:i})}const n=this.editor.model.markers.get("mention");this._items.length?this._showOrUpdateUI(n):this._hideUIAndRemoveMarker()}_showOrUpdateUI(e){this._isUIVisible?this._balloon.updatePosition(this._getBalloonPanelPositionData(e,this._mentionsView.position)):this._balloon.add({view:this._mentionsView,position:this._getBalloonPanelPositionData(e,this._mentionsView.position),singleViewMode:!0}),this._mentionsView.position=this._balloon.view.position,this._mentionsView.selectFirst()}_hideUIAndRemoveMarker(){this._balloon.hasView(this._mentionsView)&&this._balloon.remove(this._mentionsView),P(this.editor)&&this.editor.model.change((e=>e.removeMarker("mention"))),this._mentionsView.position=void 0}_renderItem(e,t){const i=this.editor;let n,o=e.id;const s=this._getItemRenderer(t);if(s){const t=s(e);"string"!=typeof t?n=new w(i.locale,t):o=t}if(!n){const e=new g._(i.locale);e.label=o,e.withText=!0,n=e}return n}_getBalloonPanelPositionData(e,t){const i=this.editor,n=i.editing,s=n.view.domConverter,r=n.mapper;return{target:()=>{let t=e.getRange();"$graveyard"==t.start.root.rootName&&(t=i.model.document.selection.getFirstRange());const n=r.toViewRange(t);return o.rw.getDomRangeRects(s.viewRangeToDom(n)).pop()},limiter:()=>{const e=this.editor.editing.view,t=e.document.selection.editableElement;return t?e.domConverter.mapViewToDom(t.root):null},positions:C(t,i.locale.uiLanguageDirection)}}}function C(e,t){const i={caret_se:e=>({top:e.bottom+3,left:e.right,name:"caret_se",config:{withArrow:!1}}),caret_ne:(e,t)=>({top:e.top-t.height-3,left:e.right,name:"caret_ne",config:{withArrow:!1}}),caret_sw:(e,t)=>({top:e.bottom+3,left:e.right-t.width,name:"caret_sw",config:{withArrow:!1}}),caret_nw:(e,t)=>({top:e.top-t.height-3,left:e.right-t.width,name:"caret_nw",config:{withArrow:!1}})};return Object.prototype.hasOwnProperty.call(i,e)?[i[e]]:"rtl"!==t?[i.caret_se,i.caret_sw,i.caret_ne,i.caret_nw]:[i.caret_sw,i.caret_se,i.caret_nw,i.caret_ne]}function A(e,t){let i;for(const n of e){const e=t.lastIndexOf(n.marker);e>0&&!t.substring(e-1).match(n.pattern)||(!i||e>=i.position)&&(i={marker:n.marker,position:e,minimumCharacters:n.minimumCharacters,pattern:n.pattern})}return i}function E(e,t){const i=0==t?"*":`{${t},}`,n=o._K.features.isRegExpUnicodePropertySupported?"\\p{Ps}\\p{Pi}\"'":"\\(\\[{\"'";return e=e.replace(/[.*+?^${}()\-|[\]\\]/g,"\\$&"),new RegExp(`(?:^|[ ${n}])([${e}])(.${i})$`,"u")}function x(e){return t=>e.filter((e=>("string"==typeof e?e:String(e.id)).toLowerCase().includes(t.toLowerCase())))}function T(e){return e&&1==e.length}function P(e){return e.model.markers.has("mention")}class I extends n.k_{toMentionAttribute(e,t){return c(e,t)}static get pluginName(){return"Mention"}static get requires(){return[a,k]}}},1980:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Paragraph:()=>c,ParagraphButtonUI:()=>u});var n=i(1024),o=i(7906);class s extends n.Command{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}refresh(){const e=this.editor.model,t=e.document,i=(0,o.first)(t.selection.getSelectedBlocks());this.value=!!i&&i.is("element","paragraph"),this.isEnabled=!!i&&r(i,e.schema)}execute(e={}){const t=this.editor.model,i=t.document,n=e.selection||i.selection;t.canEditAt(n)&&t.change((e=>{const i=n.getSelectedBlocks();for(const n of i)!n.is("element","paragraph")&&r(n,t.schema)&&e.rename(n,"paragraph")}))}}function r(e,t){return t.checkChild(e.parent,"paragraph")&&!t.isObject(e)}class a extends n.Command{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}execute(e){const t=this.editor.model,i=e.attributes;let n=e.position;t.canEditAt(n)&&t.change((e=>{if(n=this._findPositionToInsertParagraph(n,e),!n)return;const o=e.createElement("paragraph");i&&t.schema.setAllowedAttributes(o,i,e),t.insertContent(o,n),e.setSelection(o,"in")}))}_findPositionToInsertParagraph(e,t){const i=this.editor.model;if(i.schema.checkChild(e,"paragraph"))return e;const n=i.schema.findAllowedParent(e,"paragraph");if(!n)return null;const o=e.parent,s=i.schema.checkChild(o,"$text");return o.isEmpty||s&&e.isAtEnd?i.createPositionAfter(o):!o.isEmpty&&s&&e.isAtStart?i.createPositionBefore(o):t.split(e,n).position}}class l extends n.Plugin{static get pluginName(){return"Paragraph"}init(){const e=this.editor,t=e.model;e.commands.add("paragraph",new s(e)),e.commands.add("insertParagraph",new a(e)),t.schema.register("paragraph",{inheritAllFrom:"$block"}),e.conversion.elementToElement({model:"paragraph",view:"p"}),e.conversion.for("upcast").elementToElement({model:(e,{writer:t})=>l.paragraphLikeElements.has(e.name)?e.isEmpty?null:t.createElement("paragraph"):null,view:/.+/,converterPriority:"low"})}}l.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]);const c=l;var d=i(7243);class u extends n.Plugin{static get requires(){return[c]}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("paragraph",(i=>{const o=new d.ButtonView(i),s=e.commands.get("paragraph");return o.label=t("Paragraph"),o.icon=n.icons.paragraph,o.tooltip=!0,o.isToggleable=!0,o.bind("isEnabled").to(s),o.bind("isOn").to(s,"value"),o.on("execute",(()=>{e.execute("paragraph")})),o}))}}},9448:(e,t,i)=>{"use strict";i.r(t),i.d(t,{MSWordNormalizer:()=>b,PasteFromOffice:()=>x,parseHtml:()=>E});var n=i(1204),o=i(7377),s=i(4133);function r(e){return void 0!==e&&e.endsWith("px")}function a(e){return e.toFixed(2).replace(/\.?0+$/,"")+"px"}function l(e){const t=e.element.previousSibling;return(i=t||e.element.parent).is("element","ol")||i.is("element","ul");var i}function c(e,t){const i=new RegExp(`@list l${e.id}:level${e.indent}\\s*({[^}]*)`,"gi"),n=/mso-level-number-format:([^;]{0,100});/gi,o=/mso-level-start-at:\s{0,100}([0-9]{0,10})\s{0,100};/gi,s=new RegExp(`@list\\s+l${e.id}:level\\d\\s*{[^{]*mso-level-text:"%\\d\\\\.`,"gi"),r=new RegExp(`@list l${e.id}:level\\d\\s*{[^{]*mso-level-number-format:`,"gi"),a=s.exec(t),l=r.exec(t),c=a&&!l,u=i.exec(t);let h="decimal",m="ol",g=null;if(u&&u[1]){const t=n.exec(u[1]);if(t&&t[1]&&(h=t[1].trim(),m="bullet"!==h&&"image"!==h?"ol":"ul"),"bullet"===h){const t=function(e){if("li"==e.name&&"ul"==e.parent.name&&e.parent.hasAttribute("type"))return e.parent.getAttribute("type");const t=function(e){if(e.getChild(0).is("$text"))return null;for(const t of e.getChildren()){if(!t.is("element","span"))continue;const e=t.getChild(0);if(e)return e.is("$text")?e:e.getChild(0)}return null}(e);if(!t)return null;const i=t._data;return"o"===i?"circle":"·"===i?"disc":"§"===i?"square":null}(e.element);t&&(h=t)}else{const e=o.exec(u[1]);e&&e[1]&&(g=parseInt(e[1]))}c&&(m="ol")}return{type:m,startIndex:g,style:d(h),isLegalStyleList:c}}function d(e){if(e.startsWith("arabic-leading-zero"))return"decimal-leading-zero";switch(e){case"alpha-upper":return"upper-alpha";case"alpha-lower":return"lower-alpha";case"roman-upper":return"upper-roman";case"roman-lower":return"lower-roman";case"circle":case"disc":case"square":return e;default:return null}}function u(e,t,i){const n=t.createElement(e.type);return e.style&&t.setStyle("list-style-type",e.style,n),e.startIndex&&e.startIndex>1&&t.setAttribute("start",e.startIndex,n),e.isLegalStyleList&&i&&t.addClass("legal-list",n),n}function h(e){const t=e.getStyle("mso-list");if(void 0===t)return{};const i=t.match(/(^|\s{1,100})l(\d+)/i),n=t.match(/\s{0,100}lfo(\d+)/i),o=t.match(/\s{0,100}level(\d+)/i);return i&&n&&o?{id:i[2],order:n[1],indent:parseInt(o[1])}:{indent:1}}function m(e,t){const i=new s.PN({name:"span",styles:{"mso-list":"Ignore"}}),n=t.createRangeIn(e);for(const e of n)"elementStart"===e.type&&i.match(e.item)&&t.remove(e.item)}function g(e){const t=e.getStyle("margin-left");return void 0===t||t.endsWith("px")?t:function(e){const t=parseFloat(e);return e.endsWith("pt")?a(96*t/72):e.endsWith("pc")?a(12*t*96/72):e.endsWith("in")?a(96*t):e.endsWith("cm")?a(96*t/2.54):e.endsWith("mm")?a(t/10*96/2.54):e}(t)}const f=/<meta\s*name="?generator"?\s*content="?microsoft\s*word\s*\d+"?\/?>/i,p=/xmlns:o="urn:schemas-microsoft-com/i;class b{constructor(e,t=!1){this.document=e,this.hasMultiLevelListPlugin=t}isActive(e){return f.test(e)||p.test(e)}execute(e){const{body:t,stylesString:i}=e._parsedData;(function(e,t,i){if(!e.childCount)return;const n=new s.Wq(e.document),o=function(e,t){const i=t.createRangeIn(e),n=[],o=new Set;for(const e of i.getItems()){if(!e.is("element")||!e.name.match(/^(p|h\d+|li|div)$/))continue;let t=g(e);if(void 0===t||0!=parseFloat(t)||Array.from(e.getClassNames()).find((e=>e.startsWith("MsoList")))||(t=void 0),e.hasStyle("mso-list")||void 0!==t&&o.has(t)){const i=h(e);n.push({element:e,id:i.id,order:i.order,indent:i.indent,marginLeft:t}),void 0!==t&&o.add(t)}else o.clear()}return n}(e,n);if(!o.length)return;const d={},f=[];for(const e of o)if(void 0!==e.indent){l(e)||(f.length=0);const o=`${e.id}:${e.indent}`,s=Math.min(e.indent-1,f.length);if(s<f.length&&f[s].id!==e.id&&(f.length=s),s<f.length-1)f.length=s+1;else{const l=c(e,t);if(s>f.length-1||f[s].listElement.name!=l.type){0==s&&"ol"==l.type&&void 0!==e.id&&d[o]&&(l.startIndex=d[o]);const t=u(l,n,i);if(r(e.marginLeft)&&(0==s||r(f[s-1].marginLeft))){let i=e.marginLeft;s>0&&(i=a(parseFloat(i)-parseFloat(f[s-1].marginLeft))),n.setStyle("padding-left",i,t)}if(0==f.length){const i=e.element.parent,o=i.getChildIndex(e.element)+1;n.insertChild(o,t,i)}else{const e=f[s-1].listItemElements;n.appendChild(t,e[e.length-1])}f[s]={...e,listElement:t,listItemElements:[]},0==s&&void 0!==e.id&&(d[o]=l.startIndex||1)}}const h="li"==e.element.name?e.element:n.createElement("li");n.appendChild(h,f[s].listElement),f[s].listItemElements.push(h),0==s&&void 0!==e.id&&d[o]++,e.element!=h&&n.appendChild(e.element,h),m(e.element,n),n.removeStyle("text-indent",e.element),n.removeStyle("margin-left",e.element)}else{const t=f.find((t=>t.marginLeft==e.marginLeft));if(t){const i=t.listItemElements;n.appendChild(e.element,i[i.length-1]),n.removeStyle("margin-left",e.element)}else f.length=0}})(t,i,this.hasMultiLevelListPlugin),function(e,t){if(!e.childCount)return;const i=new s.Wq(e.document),n=function(e,t){const i=t.createRangeIn(e),n=new s.PN({name:/v:(.+)/}),o=[];for(const e of i){if("elementStart"!=e.type)continue;const t=e.item,i=t.previousSibling,s=i&&i.is("element")?i.name:null,r=["Chart"],a=n.match(t),l=t.getAttribute("o:gfxdata"),c="v:shapetype"===s,d=l&&r.some((e=>t.getAttribute("id").includes(e)));a&&l&&!c&&!d&&o.push(e.item.getAttribute("id"))}return o}(e,i);!function(e,t,i){const n=i.createRangeIn(t),o=new s.PN({name:"img"}),r=[];for(const t of n)if(t.item.is("element")&&o.match(t.item)){const i=t.item,n=i.getAttribute("v:shapes")?i.getAttribute("v:shapes").split(" "):[];n.length&&n.every((t=>e.indexOf(t)>-1))?r.push(i):i.getAttribute("src")||r.push(i)}for(const e of r)i.remove(e)}(n,e,i),function(e,t,i){const n=i.createRangeIn(t),o=[];for(const t of n)if("elementStart"==t.type&&t.item.is("element","v:shape")){const i=t.item.getAttribute("id");if(e.includes(i))continue;s(t.item.parent.getChildren(),i)||o.push(t.item)}for(const e of o){const t={src:r(e)};e.hasAttribute("alt")&&(t.alt=e.getAttribute("alt"));const n=i.createElement("img",t);i.insertChild(e.index+1,n,e.parent)}function s(e,t){for(const i of e)if(i.is("element")){if("img"==i.name&&i.getAttribute("v:shapes")==t)return!0;if(s(i.getChildren(),t))return!0}return!1}function r(e){for(const t of e.getChildren())if(t.is("element")&&t.getAttribute("src"))return t.getAttribute("src")}}(n,e,i),function(e,t){const i=t.createRangeIn(e),n=new s.PN({name:/v:(.+)/}),o=[];for(const e of i)"elementStart"==e.type&&n.match(e.item)&&o.push(e.item);for(const e of o)t.remove(e)}(e,i);const o=function(e,t){const i=t.createRangeIn(e),n=new s.PN({name:"img"}),o=[];for(const e of i)e.item.is("element")&&n.match(e.item)&&e.item.getAttribute("src").startsWith("file://")&&o.push(e.item);return o}(e,i);o.length&&function(e,t,i){if(e.length===t.length)for(let o=0;o<e.length;o++){const s=`data:${t[o].type};base64,${n=t[o].hex,btoa(n.match(/\w{2}/g).map((e=>String.fromCharCode(parseInt(e,16)))).join(""))}`;i.setAttribute("src",s,e[o])}var n}(o,function(e){if(!e)return[];const t=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,i=new RegExp("(?:("+t.source+"))([\\da-fA-F\\s]+)\\}","g"),n=e.match(i),o=[];if(n)for(const e of n){let i=!1;e.includes("\\pngblip")?i="image/png":e.includes("\\jpegblip")&&(i="image/jpeg"),i&&o.push({hex:e.replace(t,"").replace(/[^\da-fA-F]/g,""),type:i})}return o}(t),i)}(t,e.dataTransfer.getData("text/rtf")),function(e){const t=[],i=new s.Wq(e.document);for(const{item:n}of i.createRangeIn(e))if(n.is("element")){for(const e of n.getClassNames())/\bmso/gi.exec(e)&&i.removeClass(e,n);for(const e of n.getStyleNames())/\bmso/gi.exec(e)&&i.removeStyle(e,n);(n.is("element","w:sdt")||n.is("element","w:sdtpr")&&n.isEmpty||n.is("element","o:p")&&n.isEmpty)&&t.push(n)}for(const e of t){const t=e.parent,n=t.getChildIndex(e);i.insertChild(n,e.getChildren(),t),i.remove(e)}}(t),e.content=t}}function w(e,t,i,{blockElements:n,inlineObjectElements:o}){let s=i.createPositionAt(e,"forward"==t?"after":"before");return s=s.getLastMatchingPosition((({item:e})=>e.is("element")&&!n.includes(e.name)&&!o.includes(e.name)),{direction:t}),"forward"==t?s.nodeAfter:s.nodeBefore}function v(e,t){return!!e&&e.is("element")&&t.includes(e.name)}const _=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class y{constructor(e){this.document=e}isActive(e){return _.test(e)}execute(e){const t=new s.Wq(this.document),{body:i}=e._parsedData;!function(e,t){for(const i of e.getChildren())if(i.is("element","b")&&"normal"===i.getStyle("font-weight")){const n=e.getChildIndex(i);t.remove(i),t.insertChild(n,i.getChildren(),e)}}(i,t),function(e,t){for(const i of t.createRangeIn(e)){const e=i.item;if(e.is("element","li")){const i=e.getChild(0);i&&i.is("element","p")&&t.unwrapElement(i)}}}(i,t),function(e,t){const i=new s.Vg(t.document.stylesProcessor),n=new s.P$(i,{renderingMode:"data"}),o=n.blockElements,r=n.inlineObjectElements,a=[];for(const i of t.createRangeIn(e)){const e=i.item;if(e.is("element","br")){const i=w(e,"forward",t,{blockElements:o,inlineObjectElements:r}),n=w(e,"backward",t,{blockElements:o,inlineObjectElements:r}),s=v(i,o);(v(n,o)||s)&&a.push(e)}}for(const e of a)e.hasClass("Apple-interchange-newline")?t.remove(e):t.replace(e,t.createElement("p"))}(i,t),e.content=i}}const k=/<google-sheets-html-origin/i;class C{constructor(e){this.document=e}isActive(e){return k.test(e)}execute(e){const t=new s.Wq(this.document),{body:i}=e._parsedData;!function(e,t){for(const i of e.getChildren())if(i.is("element","google-sheets-html-origin")){const n=e.getChildIndex(i);t.remove(i),t.insertChild(n,i.getChildren(),e)}}(i,t),function(e,t){for(const i of e.getChildren())i.is("element","table")&&i.hasAttribute("xmlns")&&t.removeAttribute("xmlns",i)}(i,t),function(e,t){for(const i of e.getChildren())i.is("element","table")&&"0px"===i.getStyle("width")&&t.removeStyle("width",i)}(i,t),function(e,t){for(const i of Array.from(e.getChildren()))i.is("element","style")&&t.remove(i)}(i,t),e.content=i}}function A(e){return e.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,((e,t)=>1===t.length?" ":Array(t.length+1).join("  ").substr(0,t.length)))}function E(e,t){const i=new DOMParser,n=function(e){return A(A(e)).replace(/(<span\s+style=['"]mso-spacerun:yes['"]>[^\S\r\n]*?)[\r\n]+([^\S\r\n]*<\/span>)/g,"$1$2").replace(/<span\s+style=['"]mso-spacerun:yes['"]><\/span>/g,"").replace(/(<span\s+style=['"]letter-spacing:[^'"]+?['"]>)[\r\n]+(<\/span>)/g,"$1 $2").replace(/ <\//g," </").replace(/ <o:p><\/o:p>/g," <o:p></o:p>").replace(/<o:p>(&nbsp;|\u00A0)<\/o:p>/g,"").replace(/>([^\S\r\n]*[\r\n]\s*)</g,"><")}(function(e){const t="</body>",i=e.indexOf(t);if(i<0)return e;const n=e.indexOf("</html>",i+7);return e.substring(0,i+7)+(n>=0?e.substring(n):"")}(e=(e=e.replace(/<!--\[if gte vml 1]>/g,"")).replace(/<o:SmartTagType(?:\s+[^\s>=]+(?:="[^"]*")?)*\s*\/?>/gi,""))),o=i.parseFromString(n,"text/html");!function(e){e.querySelectorAll("span[style*=spacerun]").forEach((e=>{const t=e,i=t.innerText.length||0;t.innerText=Array(i+1).join("  ").substr(0,i)}))}(o);const r=o.body.innerHTML,a=function(e,t){const i=new s.Vg(t),n=new s.P$(i,{renderingMode:"data"}),o=e.createDocumentFragment(),r=e.body.childNodes;for(;r.length>0;)o.appendChild(r[0]);return n.domToView(o,{skipComments:!0})}(o,t),l=function(e){const t=[],i=[],n=Array.from(e.getElementsByTagName("style"));for(const e of n)e.sheet&&e.sheet.cssRules&&e.sheet.cssRules.length&&(t.push(e.sheet),i.push(e.innerHTML));return{styles:t,stylesString:i.join(" ")}}(o);return{body:a,bodyString:r,styles:l.styles,stylesString:l.stylesString}}class x extends n.k_{static get pluginName(){return"PasteFromOffice"}static get requires(){return[o.xz]}init(){const e=this.editor,t=e.plugins.get("ClipboardPipeline"),i=e.editing.view.document,n=[],o=this.editor.plugins.has("MultiLevelList");n.push(new b(i,o)),n.push(new y(i)),n.push(new C(i)),t.on("inputTransformation",((t,o)=>{if(o._isTransformedWithPasteFromOffice)return;if(e.model.document.selection.getFirstPosition().parent.is("element","codeBlock"))return;const s=o.dataTransfer.getData("text/html"),r=n.find((e=>e.isActive(s)));r&&(o._parsedData||(o._parsedData=E(s,i.stylesProcessor)),r.execute(o),o._isTransformedWithPasteFromOffice=!0)}),{priority:"high"})}}},8368:(e,t,i)=>{"use strict";i.r(t),i.d(t,{RemoveFormat:()=>d,RemoveFormatEditing:()=>c,RemoveFormatUI:()=>r});var n=i(1204),o=i(949);const s="removeFormat";class r extends n.k_{static get pluginName(){return"RemoveFormatUI"}init(){const e=this.editor;e.ui.componentFactory.add(s,(()=>{const e=this._createButton(o._);return e.set({tooltip:!0}),e})),e.ui.componentFactory.add(`menuBar:${s}`,(()=>this._createButton(o.kS)))}_createButton(e){const t=this.editor,i=t.locale,n=t.commands.get(s),o=new e(t.locale),r=i.t;return o.set({label:r("Remove Format"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8.69 14.915c.053.052.173.083.36.093a.366.366 0 0 1 .345.485l-.003.01a.738.738 0 0 1-.697.497h-2.67a.374.374 0 0 1-.353-.496l.013-.038a.681.681 0 0 1 .644-.458c.197-.012.325-.043.386-.093a.28.28 0 0 0 .072-.11L9.592 4.5H6.269c-.359-.017-.609.013-.75.09-.142.078-.289.265-.442.563-.192.29-.516.464-.864.464H4.17a.43.43 0 0 1-.407-.569L4.46 3h13.08l-.62 2.043a.81.81 0 0 1-.775.574h-.114a.486.486 0 0 1-.486-.486c.001-.284-.054-.464-.167-.54-.112-.076-.367-.106-.766-.091h-3.28l-2.68 10.257c-.006.074.007.127.038.158zM3 17h8a.5.5 0 1 1 0 1H3a.5.5 0 1 1 0-1zm11.299 1.17a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.06-1.06l1.415 1.414 1.414-1.415a.75.75 0 1 1 1.06 1.06l-1.413 1.415 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414-1.414 1.414z"/></svg>'}),o.bind("isEnabled").to(n,"isEnabled"),this.listenTo(o,"execute",(()=>{t.execute(s),t.editing.view.focus()})),o}}var a=i(5318);class l extends n.uB{refresh(){const e=this.editor.model;this.isEnabled=!!(0,a.$1)(this._getFormattingItems(e.document.selection,e.schema))}execute(){const e=this.editor.model,t=e.schema;e.change((i=>{for(const n of this._getFormattingItems(e.document.selection,t))if(n.is("selection"))for(const e of this._getFormattingAttributes(n,t))i.removeSelectionAttribute(e);else{const e=i.createRangeOn(n);for(const o of this._getFormattingAttributes(n,t))i.removeAttribute(o,e)}}))}*_getFormattingItems(e,t){const i=e=>!!(0,a.$1)(this._getFormattingAttributes(e,t));for(const n of e.getRanges())for(const e of n.getItems())!t.isBlock(e)&&i(e)&&(yield e);for(const t of e.getSelectedBlocks())i(t)&&(yield t);i(e)&&(yield e)}*_getFormattingAttributes(e,t){for(const[i]of e.getAttributes()){const e=t.getAttributeProperties(i);e&&e.isFormatting&&(yield i)}}}class c extends n.k_{static get pluginName(){return"RemoveFormatEditing"}init(){const e=this.editor;e.commands.add("removeFormat",new l(e))}}class d extends n.k_{static get requires(){return[c,r]}static get pluginName(){return"RemoveFormat"}}},6206:(e,t,i)=>{"use strict";i.r(t),i.d(t,{SelectAll:()=>u,SelectAllEditing:()=>l,SelectAllUI:()=>d});var n=i(1024),o=i(7906);class s extends n.Command{constructor(e){super(e),this.affectsData=!1}execute(){const e=this.editor.model,t=e.document.selection;let i=e.schema.getLimitElement(t);if(t.containsEntireContent(i)||!r(e.schema,i))do{if(i=i.parent,!i)return}while(!r(e.schema,i));e.change((e=>{e.setSelection(i,"in")}))}}function r(e,t){return e.isLimit(t)&&(e.checkChild(t,"$text")||e.checkChild(t,"paragraph"))}const a=(0,o.parseKeystroke)("Ctrl+A");class l extends n.Plugin{static get pluginName(){return"SelectAllEditing"}init(){const e=this.editor,t=e.t,i=e.editing.view.document;e.commands.add("selectAll",new s(e)),this.listenTo(i,"keydown",((t,i)=>{(0,o.getCode)(i)===a&&(e.execute("selectAll"),i.preventDefault())})),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Select all"),keystroke:"CTRL+A"}]})}}var c=i(7243);class d extends n.Plugin{static get pluginName(){return"SelectAllUI"}init(){const e=this.editor;e.ui.componentFactory.add("selectAll",(()=>{const e=this._createButton(c.ButtonView);return e.set({tooltip:!0}),e})),e.ui.componentFactory.add("menuBar:selectAll",(()=>this._createButton(c.MenuBarMenuListItemButtonView)))}_createButton(e){const t=this.editor,i=t.locale,n=t.commands.get("selectAll"),o=new e(t.locale),s=i.t;return o.set({label:s("Select all"),icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M.75 15.5a.75.75 0 0 1 .75.75V18l.008.09A.5.5 0 0 0 2 18.5h1.75a.75.75 0 1 1 0 1.5H1.5l-.144-.007a1.5 1.5 0 0 1-1.35-1.349L0 18.5v-2.25a.75.75 0 0 1 .75-.75zm18.5 0a.75.75 0 0 1 .75.75v2.25l-.007.144a1.5 1.5 0 0 1-1.349 1.35L18.5 20h-2.25a.75.75 0 1 1 0-1.5H18a.5.5 0 0 0 .492-.41L18.5 18v-1.75a.75.75 0 0 1 .75-.75zm-10.45 3c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2H7.2a.2.2 0 0 1-.2-.2v-1.1c0-.11.09-.2.2-.2h1.6zm4 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2h-1.6a.2.2 0 0 1-.2-.2v-1.1c0-.11.09-.2.2-.2h1.6zm.45-5.5a.75.75 0 1 1 0 1.5h-8.5a.75.75 0 1 1 0-1.5h8.5zM1.3 11c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2H.2a.2.2 0 0 1-.2-.2v-1.6c0-.11.09-.2.2-.2h1.1zm18.5 0c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2h-1.1a.2.2 0 0 1-.2-.2v-1.6c0-.11.09-.2.2-.2h1.1zm-4.55-2a.75.75 0 1 1 0 1.5H4.75a.75.75 0 1 1 0-1.5h10.5zM1.3 7c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2H.2a.2.2 0 0 1-.2-.2V7.2c0-.11.09-.2.2-.2h1.1zm18.5 0c.11 0 .2.09.2.2v1.6a.2.2 0 0 1-.2.2h-1.1a.2.2 0 0 1-.2-.2V7.2c0-.11.09-.2.2-.2h1.1zm-4.55-2a.75.75 0 1 1 0 1.5h-2.5a.75.75 0 1 1 0-1.5h2.5zm-5 0a.75.75 0 1 1 0 1.5h-5.5a.75.75 0 0 1 0-1.5h5.5zm-6.5-5a.75.75 0 0 1 0 1.5H2a.5.5 0 0 0-.492.41L1.5 2v1.75a.75.75 0 0 1-1.5 0V1.5l.007-.144A1.5 1.5 0 0 1 1.356.006L1.5 0h2.25zM18.5 0l.144.007a1.5 1.5 0 0 1 1.35 1.349L20 1.5v2.25a.75.75 0 1 1-1.5 0V2l-.008-.09A.5.5 0 0 0 18 1.5h-1.75a.75.75 0 1 1 0-1.5h2.25zM8.8 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2H7.2a.2.2 0 0 1-.2-.2V.2c0-.11.09-.2.2-.2h1.6zm4 0c.11 0 .2.09.2.2v1.1a.2.2 0 0 1-.2.2h-1.6a.2.2 0 0 1-.2-.2V.2c0-.11.09-.2.2-.2h1.6z"/></svg>',keystroke:"Ctrl+A"}),o.bind("isEnabled").to(n,"isEnabled"),this.listenTo(o,"execute",(()=>{t.execute("selectAll"),t.editing.view.focus()})),o}}class u extends n.Plugin{static get requires(){return[l,d]}static get pluginName(){return"SelectAll"}}},478:(e,t,i)=>{"use strict";i.r(t),i.d(t,{PlainTableOutput:()=>ze,Table:()=>De,TableCaption:()=>ri,TableCaptionEditing:()=>oi,TableCaptionUI:()=>si,TableCellProperties:()=>Lt,TableCellPropertiesEditing:()=>Ot,TableCellPropertiesUI:()=>yt,TableCellWidthEditing:()=>At,TableClipboard:()=>Se,TableColumnResize:()=>ui,TableColumnResizeEditing:()=>di,TableEditing:()=>ke,TableKeyboard:()=>Me,TableMouse:()=>Fe,TableProperties:()=>Xt,TablePropertiesEditing:()=>Kt,TablePropertiesUI:()=>Yt,TableSelection:()=>Pe,TableToolbar:()=>qe,TableUI:()=>xe,TableUtils:()=>ne});var n=i(1204),o=i(5091);function s(e,t){const{modelAttribute:i,styleName:n,viewElement:o,defaultValue:s,reduceBoxSides:r=!1,shouldUpcast:a=(()=>!0)}=t;e.for("upcast").attributeToAttribute({view:{name:o,styles:{[n]:/[\s\S]+/}},model:{key:i,value:e=>{if(!a(e))return;const t=e.getNormalizedStyle(n),i=r?c(t):t;return s!==i?i:void 0}}})}function r(e,t,i,n){e.for("upcast").add((e=>e.on("element:"+t,((e,t,o)=>{if(!t.modelRange)return;const s=["border-top-width","border-top-color","border-top-style","border-bottom-width","border-bottom-color","border-bottom-style","border-right-width","border-right-color","border-right-style","border-left-width","border-left-color","border-left-style"].filter((e=>t.viewItem.hasStyle(e)));if(!s.length)return;const r={styles:s};if(!o.consumable.test(t.viewItem,r))return;const a=[...t.modelRange.getItems({shallow:!0})].pop();o.consumable.consume(t.viewItem,r);const l={style:t.viewItem.getNormalizedStyle("border-style"),color:t.viewItem.getNormalizedStyle("border-color"),width:t.viewItem.getNormalizedStyle("border-width")},d={style:c(l.style),color:c(l.color),width:c(l.width)};d.style!==n.style&&o.writer.setAttribute(i.style,d.style,a),d.color!==n.color&&o.writer.setAttribute(i.color,d.color,a),d.width!==n.width&&o.writer.setAttribute(i.width,d.width,a)}))))}function a(e,t){const{modelElement:i,modelAttribute:n,styleName:o}=t;e.for("downcast").attributeToAttribute({model:{name:i,key:n},view:e=>({key:"style",value:{[o]:e}})})}function l(e,t){const{modelAttribute:i,styleName:n}=t;e.for("downcast").add((e=>e.on(`attribute:${i}:table`,((e,t,i)=>{const{item:o,attributeNewValue:s}=t,{mapper:r,writer:a}=i;if(!i.consumable.consume(t.item,e.name))return;const l=[...r.toViewElement(o).getChildren()].find((e=>e.is("element","table")));s?a.setStyle(n,s,l):a.removeStyle(n,l)}))))}function c(e){if(!e)return;const t=["top","right","bottom","left"];if(!t.every((t=>e[t])))return e;const i=e.top;return t.every((t=>e[t]===i))?i:e}function d(e,t,i,n,o=1){null!=t&&null!=o&&t>o?n.setAttribute(e,t,i):n.removeAttribute(e,i)}function u(e,t,i={}){const n=e.createElement("tableCell",i);return e.insertElement("paragraph",n),e.insert(n,t),n}function h(e,t){const i=t.parent.parent,n=parseInt(i.getAttribute("headingColumns")||"0"),{column:o}=e.getCellLocation(t);return!!n&&o<n}function m(e,t,i){const{modelAttribute:n}=i;e.extend("tableCell",{allowAttributes:[n]}),s(t,{viewElement:/^(td|th)$/,...i}),a(t,{modelElement:"tableCell",...i})}function g(e){const t=e.getSelectedElement();return t&&t.is("element","table")?t:e.getFirstPosition().findAncestor("table")}var f=i(5318);function p(e){return t=>{t.on(`element:${e}`,((e,t,{writer:i})=>{if(!t.modelRange)return;const n=t.modelRange.start.nodeAfter,o=i.createPositionAt(n,0);if(t.viewItem.isEmpty)return void i.insertElement("paragraph",o);const s=Array.from(n.getChildren());if(s.every((e=>e.is("element","$marker")))){const e=i.createElement("paragraph");i.insert(e,i.createPositionAt(n,0));for(const t of s)i.move(i.createRangeOn(t),i.createPositionAt(e,"end"))}}),{priority:"low"})}}function b(e){let t=0,i=0;const n=Array.from(e.getChildren()).filter((e=>"th"===e.name||"td"===e.name));for(;i<n.length&&"th"===n[i].name;){const e=n[i];t+=parseInt(e.getAttribute("colspan")||"1"),i++}return t}class w{constructor(e,t={}){this._jumpedToStartRow=!1,this._table=e,this._startRow=void 0!==t.row?t.row:t.startRow||0,this._endRow=void 0!==t.row?t.row:t.endRow,this._startColumn=void 0!==t.column?t.column:t.startColumn||0,this._endColumn=void 0!==t.column?t.column:t.endColumn,this._includeAllSlots=!!t.includeAllSlots,this._skipRows=new Set,this._row=0,this._rowIndex=0,this._column=0,this._cellIndex=0,this._spannedCells=new Map,this._nextCellAtColumn=-1}[Symbol.iterator](){return this}next(){this._canJumpToStartRow()&&this._jumpToNonSpannedRowClosestToStartRow();const e=this._table.getChild(this._rowIndex);if(!e||this._isOverEndRow())return{done:!0,value:void 0};if(!e.is("element","tableRow"))return this._rowIndex++,this.next();if(this._isOverEndColumn())return this._advanceToNextRow();let t=null;const i=this._getSpanned();if(i)this._includeAllSlots&&!this._shouldSkipSlot()&&(t=this._formatOutValue(i.cell,i.row,i.column));else{const i=e.getChild(this._cellIndex);if(!i)return this._advanceToNextRow();const n=parseInt(i.getAttribute("colspan")||"1"),o=parseInt(i.getAttribute("rowspan")||"1");(n>1||o>1)&&this._recordSpans(i,o,n),this._shouldSkipSlot()||(t=this._formatOutValue(i)),this._nextCellAtColumn=this._column+n}return this._column++,this._column==this._nextCellAtColumn&&this._cellIndex++,t||this.next()}skipRow(e){this._skipRows.add(e)}_advanceToNextRow(){return this._row++,this._rowIndex++,this._column=0,this._cellIndex=0,this._nextCellAtColumn=-1,this.next()}_isOverEndRow(){return void 0!==this._endRow&&this._row>this._endRow}_isOverEndColumn(){return void 0!==this._endColumn&&this._column>this._endColumn}_formatOutValue(e,t=this._row,i=this._column){return{done:!1,value:new v(this,e,t,i)}}_shouldSkipSlot(){const e=this._skipRows.has(this._row),t=this._row<this._startRow,i=this._column<this._startColumn,n=void 0!==this._endColumn&&this._column>this._endColumn;return e||t||i||n}_getSpanned(){const e=this._spannedCells.get(this._row);return e&&e.get(this._column)||null}_recordSpans(e,t,i){const n={cell:e,row:this._row,column:this._column};for(let e=this._row;e<this._row+t;e++)for(let t=this._column;t<this._column+i;t++)e==this._row&&t==this._column||this._markSpannedCell(e,t,n)}_markSpannedCell(e,t,i){this._spannedCells.has(e)||this._spannedCells.set(e,new Map),this._spannedCells.get(e).set(t,i)}_canJumpToStartRow(){return!!this._startRow&&this._startRow>0&&!this._jumpedToStartRow}_jumpToNonSpannedRowClosestToStartRow(){const e=this._getRowLength(0);for(let t=this._startRow;!this._jumpedToStartRow;t--)e===this._getRowLength(t)&&(this._row=t,this._rowIndex=t,this._jumpedToStartRow=!0)}_getRowLength(e){return[...this._table.getChild(e).getChildren()].reduce(((e,t)=>e+parseInt(t.getAttribute("colspan")||"1")),0)}}class v{constructor(e,t,i,n){this.cell=t,this.row=e._row,this.column=e._column,this.cellAnchorRow=i,this.cellAnchorColumn=n,this._cellIndex=e._cellIndex,this._rowIndex=e._rowIndex,this._table=e._table}get isAnchor(){return this.row===this.cellAnchorRow&&this.column===this.cellAnchorColumn}get cellWidth(){return parseInt(this.cell.getAttribute("colspan")||"1")}get cellHeight(){return parseInt(this.cell.getAttribute("rowspan")||"1")}get rowIndex(){return this._rowIndex}getPositionBefore(){return this._table.root.document.model.createPositionAt(this._table.getChild(this.row),this._cellIndex)}}function _(e,t){return(i,{writer:n})=>{const s=i.getAttribute("headingRows")||0,r=n.createContainerElement("table",null,[]),a=n.createContainerElement("figure",{class:"table"},r);s>0&&n.insert(n.createPositionAt(r,"end"),n.createContainerElement("thead",null,n.createSlot((e=>e.is("element","tableRow")&&e.index<s)))),s<e.getRows(i)&&n.insert(n.createPositionAt(r,"end"),n.createContainerElement("tbody",null,n.createSlot((e=>e.is("element","tableRow")&&e.index>=s))));for(const{positionOffset:e,filter:i}of t.additionalSlots)n.insert(n.createPositionAt(r,e),n.createSlot(i));return n.insert(n.createPositionAt(r,"after"),n.createSlot((e=>!e.is("element","tableRow")&&!t.additionalSlots.some((({filter:t})=>t(e)))))),t.asWidget?function(e,t){return t.setCustomProperty("table",!0,e),(0,o.Ex)(e,t,{hasSelectionHandle:!0})}(a,n):a}}function y(e={}){return(t,{writer:i})=>{const n=t.parent,s=n.parent,r=s.getChildIndex(n),a=new w(s,{row:r}),l=s.getAttribute("headingRows")||0,c=s.getAttribute("headingColumns")||0;let d=null;for(const n of a)if(n.cell==t){const t=n.row<l||n.column<c?"th":"td";d=e.asWidget?(0,o.YN)(i.createEditableElement(t),i):i.createContainerElement(t);break}return d}}function k(e={}){return(t,{writer:i})=>{if(!t.parent.is("element","tableCell"))return null;if(!C(t))return null;if(e.asWidget)return i.createContainerElement("span",{class:"ck-table-bogus-paragraph"});{const e=i.createContainerElement("p");return i.setCustomProperty("dataPipeline:transparentRendering",!0,e),e}}}function C(e){return 1==e.parent.childCount&&!!e.getAttributeKeys().next().done}class A extends n.uB{refresh(){const e=this.editor.model,t=e.document.selection,i=e.schema;this.isEnabled=function(e,t){const i=e.getFirstPosition().parent,n=i===i.root?i:i.parent;return t.checkChild(n,"table")}(t,i)}execute(e={}){const t=this.editor,i=t.model,n=t.plugins.get("TableUtils"),o=t.config.get("table.defaultHeadings.rows"),s=t.config.get("table.defaultHeadings.columns");void 0===e.headingRows&&o&&(e.headingRows=o),void 0===e.headingColumns&&s&&(e.headingColumns=s),i.change((t=>{const o=n.createTable(t,e);i.insertObject(o,null,null,{findOptimalPosition:"auto"}),t.setSelection(t.createPositionAt(o.getNodeByPath([0,0,0]),0))}))}}class E extends n.uB{constructor(e,t={}){super(e),this.order=t.order||"below"}refresh(){const e=this.editor.model.document.selection,t=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=t}execute(){const e=this.editor,t=e.model.document.selection,i=e.plugins.get("TableUtils"),n="above"===this.order,o=i.getSelectionAffectedTableCells(t),s=i.getRowIndexes(o),r=n?s.first:s.last,a=o[0].findAncestor("table");i.insertRows(a,{at:n?r:r+1,copyStructureFromAbove:!n})}}class x extends n.uB{constructor(e,t={}){super(e),this.order=t.order||"right"}refresh(){const e=this.editor.model.document.selection,t=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=t}execute(){const e=this.editor,t=e.model.document.selection,i=e.plugins.get("TableUtils"),n="left"===this.order,o=i.getSelectionAffectedTableCells(t),s=i.getColumnIndexes(o),r=n?s.first:s.last,a=o[0].findAncestor("table");i.insertColumns(a,{columns:1,at:n?r:r+1})}}class T extends n.uB{constructor(e,t={}){super(e),this.direction=t.direction||"horizontally"}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=1===e.length}execute(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection)[0];"horizontally"===this.direction?e.splitCellHorizontally(t,2):e.splitCellVertically(t,2)}}function P(e,t,i){const{startRow:n,startColumn:o,endRow:s,endColumn:r}=t,a=i.createElement("table"),l=s-n+1;for(let e=0;e<l;e++)i.insertElement("tableRow",a,"end");const c=[...new w(e,{startRow:n,endRow:s,startColumn:o,endColumn:r,includeAllSlots:!0})];for(const{row:e,column:t,cell:l,isAnchor:d,cellAnchorRow:h,cellAnchorColumn:m}of c){const c=e-n,g=a.getChild(c);if(d){const n=i.cloneElement(l);i.append(n,g),B(n,e,t,s,r,i)}else(h<n||m<o)&&u(i,i.createPositionAt(g,"end"))}return function(e,t,i,n,o){const s=parseInt(t.getAttribute("headingRows")||"0");s>0&&d("headingRows",s-i,e,o,0);const r=parseInt(t.getAttribute("headingColumns")||"0");r>0&&d("headingColumns",r-n,e,o,0)}(a,e,n,o,i),a}function I(e,t,i=0){const n=[],o=new w(e,{startRow:i,endRow:t-1});for(const e of o){const{row:i,cellHeight:o}=e;i<t&&t<=i+o-1&&n.push(e)}return n}function S(e,t,i){const n=e.parent,o=n.parent,s=n.index,r=t-s,a={},l=parseInt(e.getAttribute("rowspan"))-r;l>1&&(a.rowspan=l);const c=parseInt(e.getAttribute("colspan")||"1");c>1&&(a.colspan=c);const h=s+r,m=[...new w(o,{startRow:s,endRow:h,includeAllSlots:!0})];let g,f=null;for(const t of m){const{row:n,column:o,cell:s}=t;s===e&&void 0===g&&(g=o),void 0!==g&&g===o&&n===h&&(f=u(i,t.getPositionBefore(),a))}return d("rowspan",r,e,i),f}function V(e,t){const i=[],n=new w(e);for(const e of n){const{column:n,cellWidth:o}=e;n<t&&t<=n+o-1&&i.push(e)}return i}function R(e,t,i,n){const o=i-t,s={},r=parseInt(e.getAttribute("colspan"))-o;r>1&&(s.colspan=r);const a=parseInt(e.getAttribute("rowspan")||"1");a>1&&(s.rowspan=a);const l=u(n,n.createPositionAfter(e),s);return d("colspan",o,e,n),l}function B(e,t,i,n,o,s){const r=parseInt(e.getAttribute("colspan")||"1"),a=parseInt(e.getAttribute("rowspan")||"1");i+r-1>o&&d("colspan",o-i+1,e,s,1),t+a-1>n&&d("rowspan",n-t+1,e,s,1)}function M(e,t){const i=t.getColumns(e),n=new Array(i).fill(0);for(const{column:t}of new w(e))n[t]++;const o=n.reduce(((e,t,i)=>t?e:[...e,i]),[]);if(o.length>0){const i=o[o.length-1];return t.removeColumns(e,{at:i}),!0}return!1}function O(e,t){const i=[],n=t.getRows(e);for(let t=0;t<n;t++)e.getChild(t).isEmpty&&i.push(t);if(i.length>0){const n=i[i.length-1];return t.removeRows(e,{at:n}),!0}return!1}function L(e,t){M(e,t)||O(e,t)}function F(e,t){const i=Array.from(new w(e,{startColumn:t.firstColumn,endColumn:t.lastColumn,row:t.lastRow}));if(i.every((({cellHeight:e})=>1===e)))return t.lastRow;const n=i[0].cellHeight-1;return t.lastRow+n}function N(e,t){const i=Array.from(new w(e,{startRow:t.firstRow,endRow:t.lastRow,column:t.lastColumn}));if(i.every((({cellWidth:e})=>1===e)))return t.lastColumn;const n=i[0].cellWidth-1;return t.lastColumn+n}class D extends n.uB{constructor(e,t){super(e),this.direction=t.direction,this.isHorizontal="right"==this.direction||"left"==this.direction}refresh(){const e=this._getMergeableCell();this.value=e,this.isEnabled=!!e}execute(){const e=this.editor.model,t=e.document,i=this.editor.plugins.get("TableUtils").getTableCellsContainingSelection(t.selection)[0],n=this.value,o=this.direction;e.change((e=>{const t="right"==o||"down"==o,s=t?i:n,r=t?n:i,a=r.parent;!function(e,t,i){z(e)||(z(t)&&i.remove(i.createRangeIn(t)),i.move(i.createRangeIn(e),i.createPositionAt(t,"end"))),i.remove(e)}(r,s,e);const l=this.isHorizontal?"colspan":"rowspan",c=parseInt(i.getAttribute(l)||"1"),d=parseInt(n.getAttribute(l)||"1");e.setAttribute(l,c+d,s),e.setSelection(e.createRangeIn(s));const u=this.editor.plugins.get("TableUtils");L(a.findAncestor("table"),u)}))}_getMergeableCell(){const e=this.editor.model.document,t=this.editor.plugins.get("TableUtils"),i=t.getTableCellsContainingSelection(e.selection)[0];if(!i)return;const n=this.isHorizontal?function(e,t,i){const n=e.parent.parent,o="right"==t?e.nextSibling:e.previousSibling,s=(n.getAttribute("headingColumns")||0)>0;if(!o)return;const r="right"==t?e:o,a="right"==t?o:e,{column:l}=i.getCellLocation(r),{column:c}=i.getCellLocation(a),d=parseInt(r.getAttribute("colspan")||"1"),u=h(i,r),m=h(i,a);return s&&u!=m?void 0:l+d===c?o:void 0}(i,this.direction,t):function(e,t,i){const n=e.parent,o=n.parent,s=o.getChildIndex(n);if("down"==t&&s===i.getRows(o)-1||"up"==t&&0===s)return null;const r=parseInt(e.getAttribute("rowspan")||"1"),a=o.getAttribute("headingRows")||0;if(a&&("down"==t&&s+r===a||"up"==t&&s===a))return null;const l=parseInt(e.getAttribute("rowspan")||"1"),c="down"==t?s+l:s,d=[...new w(o,{endRow:c})],u=d.find((t=>t.cell===e)).column,h=d.find((({row:e,cellHeight:i,column:n})=>n===u&&("down"==t?e===c:c===e+i)));return h&&h.cell?h.cell:null}(i,this.direction,t);if(!n)return;const o=this.isHorizontal?"rowspan":"colspan",s=parseInt(i.getAttribute(o)||"1");return parseInt(n.getAttribute(o)||"1")===s?n:void 0}}function z(e){const t=e.getChild(0);return 1==e.childCount&&t.is("element","paragraph")&&t.isEmpty}class W extends n.uB{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),i=t[0];if(i){const n=i.findAncestor("table"),o=e.getRows(n)-1,s=e.getRowIndexes(t),r=0===s.first&&s.last===o;this.isEnabled=!r}else this.isEnabled=!1}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),i=t.getSelectionAffectedTableCells(e.document.selection),n=t.getRowIndexes(i),o=i[0],s=o.findAncestor("table"),r=t.getCellLocation(o).column;e.change((e=>{const i=n.last-n.first+1;t.removeRows(s,{at:n.first,rows:i});const o=function(e,t,i,n){const o=e.getChild(Math.min(t,n-1));let s=o.getChild(0),r=0;for(const e of o.getChildren()){if(r>i)return s;s=e,r+=parseInt(e.getAttribute("colspan")||"1")}return s}(s,n.first,r,t.getRows(s));e.setSelection(e.createPositionAt(o,0))}))}}class H extends n.uB{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),i=t[0];if(i){const n=i.findAncestor("table"),o=e.getColumns(n),{first:s,last:r}=e.getColumnIndexes(t);this.isEnabled=r-s<o-1}else this.isEnabled=!1}execute(){const e=this.editor.plugins.get("TableUtils"),[t,i]=function(e,t){const i=t.getSelectionAffectedTableCells(e),n=i[0],o=i.pop(),s=[n,o];return n.isBefore(o)?s:s.reverse()}(this.editor.model.document.selection,e),n=t.parent.parent,o=[...new w(n)],s={first:o.find((e=>e.cell===t)).column,last:o.find((e=>e.cell===i)).column},r=function(e,t,i,n){return parseInt(i.getAttribute("colspan")||"1")>1?i:t.previousSibling||i.nextSibling?i.nextSibling||t.previousSibling:n.first?e.reverse().find((({column:e})=>e<n.first)).cell:e.reverse().find((({column:e})=>e>n.last)).cell}(o,t,i,s);this.editor.model.change((t=>{const i=s.last-s.first+1;e.removeColumns(n,{at:s.first,columns:i}),t.setSelection(t.createPositionAt(r,0))}))}}class U extends n.uB{refresh(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,i=e.getSelectionAffectedTableCells(t.document.selection),n=i.length>0;this.isEnabled=n,this.value=n&&i.every((e=>this._isInHeading(e,e.parent.parent)))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),i=this.editor.model,n=t.getSelectionAffectedTableCells(i.document.selection),o=n[0].findAncestor("table"),{first:s,last:r}=t.getRowIndexes(n),a=this.value?s:r+1,l=o.getAttribute("headingRows")||0;i.change((e=>{if(a){const t=I(o,a,a>l?l:0);for(const{cell:i}of t)S(i,a,e)}d("headingRows",a,o,e,0)}))}_isInHeading(e,t){const i=parseInt(t.getAttribute("headingRows")||"0");return!!i&&e.parent.index<i}}class $ extends n.uB{refresh(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),i=t.getSelectionAffectedTableCells(e.document.selection),n=i.length>0;this.isEnabled=n,this.value=n&&i.every((e=>h(t,e)))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),i=this.editor.model,n=t.getSelectionAffectedTableCells(i.document.selection),o=n[0].findAncestor("table"),{first:s,last:r}=t.getColumnIndexes(n),a=this.value?s:r+1;i.change((e=>{if(a){const t=V(o,a);for(const{cell:i,column:n}of t)R(i,n,a,e)}d("headingColumns",a,o,e,0)}))}}const j=5,q=2;function K(e,t){const i=G(e,"tbody",t)||G(e,"thead",t);return Z(t.editing.view.domConverter.mapViewToDom(i))}function G(e,t,i){return[...[...i.editing.mapper.toViewElement(e).getChildren()].find((e=>e.is("element","table"))).getChildren()].find((e=>e.is("element",t)))}function Z(e){const t=f.Sf.window.getComputedStyle(e);return"border-box"===t.boxSizing?parseFloat(t.width)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight)-parseFloat(t.borderLeftWidth)-parseFloat(t.borderRightWidth):parseFloat(t.width)}function J(e){const t=Math.pow(10,q),i="number"==typeof e?e:parseFloat(e);return Math.round(i*t)/t}function Q(e){return e.map((e=>"number"==typeof e?e:parseFloat(e))).filter((e=>!Number.isNaN(e))).reduce(((e,t)=>e+t),0)}function Y(e){let t=function(e){const t=e.filter((e=>"auto"===e)).length;if(0===t)return e.map((e=>J(e)));const i=Q(e),n=Math.max((100-i)/t,j);return e.map((e=>"auto"===e?n:e)).map((e=>J(e)))}(e.map((e=>"auto"===e?e:parseFloat(e.replace("%","")))));const i=Q(t);return 100!==i&&(t=t.map((e=>J(100*e/i))).map(((e,t,i)=>t!==i.length-1?e:J(e+100-Q(i))))),t.map((e=>e+"%"))}function X(e){const t=f.Sf.window.getComputedStyle(e);return"border-box"===t.boxSizing?parseInt(t.width):parseFloat(t.width)+parseFloat(t.paddingLeft)+parseFloat(t.paddingRight)+parseFloat(t.borderWidth)}function ee(e,t,i,n){for(let o=0;o<Math.max(i.length,e.length);o++){const s=e[o],r=i[o];r?s?n.setAttribute("columnWidth",r,s):n.appendElement("tableColumn",{columnWidth:r},t):n.remove(s)}}function te(e){if(e.is("element","tableColumnGroup"))return e;const t=e.getChildren();return Array.from(t).find((e=>e.is("element","tableColumnGroup")))}function ie(e){const t=te(e);return t?Array.from(t.getChildren()):[]}class ne extends n.k_{static get pluginName(){return"TableUtils"}init(){this.decorate("insertColumns"),this.decorate("insertRows")}getCellLocation(e){const t=e.parent,i=t.parent,n=i.getChildIndex(t),o=new w(i,{row:n});for(const{cell:t,row:i,column:n}of o)if(t===e)return{row:i,column:n}}createTable(e,t){const i=e.createElement("table"),n=t.rows||2,o=t.columns||2;return oe(e,i,0,n,o),t.headingRows&&d("headingRows",Math.min(t.headingRows,n),i,e,0),t.headingColumns&&d("headingColumns",Math.min(t.headingColumns,o),i,e,0),i}insertRows(e,t={}){const i=this.editor.model,n=t.at||0,o=t.rows||1,s=void 0!==t.copyStructureFromAbove,r=t.copyStructureFromAbove?n-1:n,a=this.getRows(e),l=this.getColumns(e);if(n>a)throw new f.Yb("tableutils-insertrows-insert-out-of-range",this,{options:t});i.change((t=>{const i=e.getAttribute("headingRows")||0;if(i>n&&d("headingRows",i+o,e,t,0),!s&&(0===n||n===a))return void oe(t,e,n,o,l);const c=s?Math.max(n,r):n,h=new w(e,{endRow:c}),m=new Array(l).fill(1);for(const{row:e,column:i,cellHeight:a,cellWidth:l,cell:c}of h){const d=e+a-1,u=e<=r&&r<=d;e<n&&n<=d?(t.setAttribute("rowspan",a+o,c),m[i]=-l):s&&u&&(m[i]=l)}for(let i=0;i<o;i++){const i=t.createElement("tableRow");t.insert(i,e,n);for(let e=0;e<m.length;e++){const n=m[e],o=t.createPositionAt(i,"end");n>0&&u(t,o,n>1?{colspan:n}:void 0),e+=Math.abs(n)-1}}}))}insertColumns(e,t={}){const i=this.editor.model,n=t.at||0,o=t.columns||1;i.change((t=>{const i=e.getAttribute("headingColumns");n<i&&t.setAttribute("headingColumns",i+o,e);const s=this.getColumns(e);if(0===n||s===n){for(const i of e.getChildren())i.is("element","tableRow")&&se(o,t,t.createPositionAt(i,n?"end":0));return}const r=new w(e,{column:n,includeAllSlots:!0});for(const e of r){const{row:i,cell:s,cellAnchorColumn:a,cellAnchorRow:l,cellWidth:c,cellHeight:d}=e;if(a<n){t.setAttribute("colspan",c+o,s);const e=l+d-1;for(let t=i;t<=e;t++)r.skipRow(t)}else se(o,t,e.getPositionBefore())}}))}removeRows(e,t){const i=this.editor.model,n=t.rows||1,o=this.getRows(e),s=t.at,r=s+n-1;if(r>o-1)throw new f.Yb("tableutils-removerows-row-index-out-of-range",this,{table:e,options:t});i.change((t=>{const i={first:s,last:r},{cellsToMove:n,cellsToTrim:o}=function(e,{first:t,last:i}){const n=new Map,o=[];for(const{row:s,column:r,cellHeight:a,cell:l}of new w(e,{endRow:i})){const e=s+a-1;if(s>=t&&s<=i&&e>i){const e=a-(i-s+1);n.set(r,{cell:l,rowspan:e})}if(s<t&&e>=t){let n;n=e>=i?i-t+1:e-t+1,o.push({cell:l,rowspan:a-n})}}return{cellsToMove:n,cellsToTrim:o}}(e,i);n.size&&function(e,t,i,n){const o=[...new w(e,{includeAllSlots:!0,row:t})],s=e.getChild(t);let r;for(const{column:e,cell:t,isAnchor:a}of o)if(i.has(e)){const{cell:t,rowspan:o}=i.get(e),a=r?n.createPositionAfter(r):n.createPositionAt(s,0);n.move(n.createRangeOn(t),a),d("rowspan",o,t,n),r=t}else a&&(r=t)}(e,r+1,n,t);for(let i=r;i>=s;i--)t.remove(e.getChild(i));for(const{rowspan:e,cell:i}of o)d("rowspan",e,i,t);!function(e,{first:t,last:i},n){const o=e.getAttribute("headingRows")||0;t<o&&d("headingRows",i<o?o-(i-t+1):t,e,n,0)}(e,i,t),M(e,this)||O(e,this)}))}removeColumns(e,t){const i=this.editor.model,n=t.at,o=t.columns||1,s=t.at+o-1;i.change((t=>{!function(e,t,i){const n=e.getAttribute("headingColumns")||0;if(n&&t.first<n){const o=Math.min(n-1,t.last)-t.first+1;i.setAttribute("headingColumns",n-o,e)}}(e,{first:n,last:s},t);const i=ie(e);for(let o=s;o>=n;o--){for(const{cell:i,column:n,cellWidth:s}of[...new w(e)])n<=o&&s>1&&n+s>o?d("colspan",s-1,i,t):n===o&&t.remove(i);if(i[o]){const e=0===o?i[1]:i[o-1],n=parseFloat(i[o].getAttribute("columnWidth")),s=parseFloat(e.getAttribute("columnWidth"));t.remove(i[o]),t.setAttribute("columnWidth",n+s+"%",e)}}O(e,this)||M(e,this)}))}splitCellVertically(e,t=2){const i=this.editor.model,n=e.parent.parent,o=parseInt(e.getAttribute("rowspan")||"1"),s=parseInt(e.getAttribute("colspan")||"1");i.change((i=>{if(s>1){const{newCellsSpan:n,updatedSpan:r}=re(s,t);d("colspan",r,e,i);const a={};n>1&&(a.colspan=n),o>1&&(a.rowspan=o),se(s>t?t-1:s-1,i,i.createPositionAfter(e),a)}if(s<t){const r=t-s,a=[...new w(n)],{column:l}=a.find((({cell:t})=>t===e)),c=a.filter((({cell:t,cellWidth:i,column:n})=>t!==e&&n===l||n<l&&n+i>l));for(const{cell:e,cellWidth:t}of c)i.setAttribute("colspan",t+r,e);const u={};o>1&&(u.rowspan=o),se(r,i,i.createPositionAfter(e),u);const h=n.getAttribute("headingColumns")||0;h>l&&d("headingColumns",h+r,n,i)}}))}splitCellHorizontally(e,t=2){const i=this.editor.model,n=e.parent,o=n.parent,s=o.getChildIndex(n),r=parseInt(e.getAttribute("rowspan")||"1"),a=parseInt(e.getAttribute("colspan")||"1");i.change((i=>{if(r>1){const n=[...new w(o,{startRow:s,endRow:s+r-1,includeAllSlots:!0})],{newCellsSpan:l,updatedSpan:c}=re(r,t);d("rowspan",c,e,i);const{column:u}=n.find((({cell:t})=>t===e)),h={};l>1&&(h.rowspan=l),a>1&&(h.colspan=a);let m=0;for(const e of n){const{column:t,row:n}=e,o=t===u;m>=l&&o&&(m=0),n>=s+c&&o&&(m||se(1,i,e.getPositionBefore(),h),m++)}}if(r<t){const n=t-r,l=[...new w(o,{startRow:0,endRow:s})];for(const{cell:t,cellHeight:o,row:r}of l)if(t!==e&&r+o>s){const e=o+n;i.setAttribute("rowspan",e,t)}const c={};a>1&&(c.colspan=a),oe(i,o,s+1,n,1,c);const u=o.getAttribute("headingRows")||0;u>s&&d("headingRows",u+n,o,i)}}))}getColumns(e){return[...e.getChild(0).getChildren()].filter((e=>e.is("element","tableCell"))).reduce(((e,t)=>e+parseInt(t.getAttribute("colspan")||"1")),0)}getRows(e){return Array.from(e.getChildren()).reduce(((e,t)=>t.is("element","tableRow")?e+1:e),0)}createTableWalker(e,t={}){return new w(e,t)}getSelectedTableCells(e){const t=[];for(const i of this.sortRanges(e.getRanges())){const e=i.getContainedElement();e&&e.is("element","tableCell")&&t.push(e)}return t}getTableCellsContainingSelection(e){const t=[];for(const i of e.getRanges()){const e=i.start.findAncestor("tableCell");e&&t.push(e)}return t}getSelectionAffectedTableCells(e){const t=this.getSelectedTableCells(e);return t.length?t:this.getTableCellsContainingSelection(e)}getRowIndexes(e){const t=e.map((e=>e.parent.index));return this._getFirstLastIndexesObject(t)}getColumnIndexes(e){const t=e[0].findAncestor("table"),i=[...new w(t)].filter((t=>e.includes(t.cell))).map((e=>e.column));return this._getFirstLastIndexesObject(i)}isSelectionRectangular(e){if(e.length<2||!this._areCellInTheSameTableSection(e))return!1;const t=new Set,i=new Set;let n=0;for(const o of e){const{row:e,column:s}=this.getCellLocation(o),r=parseInt(o.getAttribute("rowspan"))||1,a=parseInt(o.getAttribute("colspan"))||1;t.add(e),i.add(s),r>1&&t.add(e+r-1),a>1&&i.add(s+a-1),n+=r*a}const o=function(e,t){const i=Array.from(e.values()),n=Array.from(t.values());return(Math.max(...i)-Math.min(...i)+1)*(Math.max(...n)-Math.min(...n)+1)}(t,i);return o==n}sortRanges(e){return Array.from(e).sort(ae)}_getFirstLastIndexesObject(e){const t=e.sort(((e,t)=>e-t));return{first:t[0],last:t[t.length-1]}}_areCellInTheSameTableSection(e){const t=e[0].findAncestor("table"),i=this.getRowIndexes(e),n=parseInt(t.getAttribute("headingRows"))||0;if(!this._areIndexesInSameSection(i,n))return!1;const o=this.getColumnIndexes(e),s=parseInt(t.getAttribute("headingColumns"))||0;return this._areIndexesInSameSection(o,s)}_areIndexesInSameSection({first:e,last:t},i){return e<i==t<i}}function oe(e,t,i,n,o,s={}){for(let r=0;r<n;r++){const n=e.createElement("tableRow");e.insert(n,t,i),se(o,e,e.createPositionAt(n,"end"),s)}}function se(e,t,i,n={}){for(let o=0;o<e;o++)u(t,i,n)}function re(e,t){if(e<t)return{newCellsSpan:1,updatedSpan:1};const i=Math.floor(e/t);return{newCellsSpan:i,updatedSpan:e-i*t+i}}function ae(e,t){const i=e.start,n=t.start;return i.isBefore(n)?-1:1}class le extends n.uB{refresh(){const e=this.editor.plugins.get(ne),t=e.getSelectedTableCells(this.editor.model.document.selection);this.isEnabled=e.isSelectionRectangular(t)}execute(){const e=this.editor.model,t=this.editor.plugins.get(ne);e.change((i=>{const n=t.getSelectedTableCells(e.document.selection),o=n.shift(),{mergeWidth:s,mergeHeight:r}=function(e,t,i){let n=0,o=0;for(const e of t){const{row:t,column:s}=i.getCellLocation(e);n=ue(e,s,n,"colspan"),o=ue(e,t,o,"rowspan")}const{row:s,column:r}=i.getCellLocation(e);return{mergeWidth:n-r,mergeHeight:o-s}}(o,n,t);d("colspan",s,o,i),d("rowspan",r,o,i);for(const e of n)ce(e,o,i);L(o.findAncestor("table"),t),i.setSelection(o,"in")}))}}function ce(e,t,i){de(e)||(de(t)&&i.remove(i.createRangeIn(t)),i.move(i.createRangeIn(e),i.createPositionAt(t,"end"))),i.remove(e)}function de(e){const t=e.getChild(0);return 1==e.childCount&&t.is("element","paragraph")&&t.isEmpty}function ue(e,t,i,n){const o=parseInt(e.getAttribute(n)||"1");return Math.max(i,t+o)}class he extends n.uB{constructor(e){super(e),this.affectsData=!1}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),i=t.getSelectionAffectedTableCells(e.document.selection),n=t.getRowIndexes(i),o=i[0].findAncestor("table"),s=[];for(let t=n.first;t<=n.last;t++)for(const i of o.getChild(t).getChildren())s.push(e.createRangeOn(i));e.change((e=>{e.setSelection(s)}))}}class me extends n.uB{constructor(e){super(e),this.affectsData=!1}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,i=e.getSelectionAffectedTableCells(t.document.selection),n=i[0],o=i.pop(),s=n.findAncestor("table"),r=e.getCellLocation(n),a=e.getCellLocation(o),l=Math.min(r.column,a.column),c=Math.max(r.column,a.column),d=[];for(const e of new w(s,{startColumn:l,endColumn:c}))d.push(t.createRangeOn(e.cell));t.change((e=>{e.setSelection(d)}))}}function ge(e,t){let i=!1;const n=function(e){const t=parseInt(e.getAttribute("headingRows")||"0"),i=Array.from(e.getChildren()).reduce(((e,t)=>t.is("element","tableRow")?e+1:e),0),n=[];for(const{row:o,cell:s,cellHeight:r}of new w(e)){if(r<2)continue;const e=o<t?t:i;if(o+r>e){const t=e-o;n.push({cell:s,rowspan:t})}}return n}(e);if(n.length){i=!0;for(const e of n)d("rowspan",e.rowspan,e.cell,t,1)}return i}function fe(e,t){let i=!1;const n=function(e){const t=new Array(e.childCount).fill(0);for(const{rowIndex:i}of new w(e,{includeAllSlots:!0}))t[i]++;return t}(e),o=[];for(const[t,i]of n.entries())!i&&e.getChild(t).is("element","tableRow")&&o.push(t);if(o.length){i=!0;for(const i of o.reverse())t.remove(e.getChild(i)),n.splice(i,1)}const s=n.filter(((t,i)=>e.getChild(i).is("element","tableRow"))),r=s[0];if(!s.every((e=>e===r))){const n=s.reduce(((e,t)=>t>e?t:e),0);for(const[o,r]of s.entries()){const s=n-r;if(s){for(let i=0;i<s;i++)u(t,t.createPositionAt(e.getChild(o),"end"));i=!0}}}return i}function pe(e){if("attribute"!==e.type)return!1;const t=e.attributeKey;return"headingRows"===t||"colspan"===t||"rowspan"===t}function be(e,t){let i=!1;for(const n of e.getChildren())n.is("element","tableRow")&&(i=we(n,t)||i);return i}function we(e,t){let i=!1;for(const n of e.getChildren())i=ve(n,t)||i;return i}function ve(e,t){if(0==e.childCount)return t.insertElement("paragraph",e),!0;const i=Array.from(e.getChildren()).filter((e=>e.is("$text")));for(const e of i)t.wrap(t.createRangeOn(e),"paragraph");return!!i.length}function _e(e){return!!e.position.parent.is("element","tableCell")&&("insert"==e.type&&"$text"==e.name||"remove"==e.type)}function ye(e,t){if(!e.is("element","paragraph"))return!1;const i=t.toViewElement(e);return!!i&&C(e)!==i.is("element","span")}class ke extends n.k_{static get pluginName(){return"TableEditing"}static get requires(){return[ne]}constructor(e){super(e),this._additionalSlots=[]}init(){const e=this.editor,t=e.model,i=t.schema,n=e.conversion,o=e.plugins.get(ne);i.register("table",{inheritAllFrom:"$blockObject",allowAttributes:["headingRows","headingColumns"]}),i.register("tableRow",{allowIn:"table",isLimit:!0}),i.register("tableCell",{allowContentOf:"$container",allowIn:"tableRow",allowAttributes:["colspan","rowspan"],isLimit:!0,isSelectable:!0}),n.for("upcast").add((e=>{e.on("element:figure",((e,t,i)=>{if(!i.consumable.test(t.viewItem,{name:!0,classes:"table"}))return;const n=function(e){for(const t of e.getChildren())if(t.is("element","table"))return t}(t.viewItem);if(!n||!i.consumable.test(n,{name:!0}))return;i.consumable.consume(t.viewItem,{name:!0,classes:"table"});const o=i.convertItem(n,t.modelCursor),s=(0,f.$1)(o.modelRange.getItems());s?(i.convertChildren(t.viewItem,i.writer.createPositionAt(s,"end")),i.updateConversionResult(s,t)):i.consumable.revert(t.viewItem,{name:!0,classes:"table"})}))})),n.for("upcast").add((e=>{e.on("element:table",((e,t,i)=>{const n=t.viewItem;if(!i.consumable.test(n,{name:!0}))return;const{rows:o,headingRows:s,headingColumns:r}=function(e){let t,i=0;const n=[],o=[];let s;for(const r of Array.from(e.getChildren())){if("tbody"!==r.name&&"thead"!==r.name&&"tfoot"!==r.name)continue;"thead"!==r.name||s||(s=r);const e=Array.from(r.getChildren()).filter((e=>e.is("element","tr")));for(const a of e)if(s&&r===s||"tbody"===r.name&&Array.from(a.getChildren()).length&&Array.from(a.getChildren()).every((e=>e.is("element","th"))))i++,n.push(a);else{o.push(a);const e=b(a);(!t||e<t)&&(t=e)}}return{headingRows:i,headingColumns:t||0,rows:[...n,...o]}}(n),a={};r&&(a.headingColumns=r),s&&(a.headingRows=s);const l=i.writer.createElement("table",a);if(i.safeInsert(l,t.modelCursor)){if(i.consumable.consume(n,{name:!0}),o.forEach((e=>i.convertItem(e,i.writer.createPositionAt(l,"end")))),i.convertChildren(n,i.writer.createPositionAt(l,"end")),l.isEmpty){const e=i.writer.createElement("tableRow");i.writer.insert(e,i.writer.createPositionAt(l,"end")),u(i.writer,i.writer.createPositionAt(e,"end"))}i.updateConversionResult(l,t)}}))})),n.for("editingDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:_(o,{asWidget:!0,additionalSlots:this._additionalSlots})}),n.for("dataDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:_(o,{additionalSlots:this._additionalSlots})}),n.for("upcast").elementToElement({model:"tableRow",view:"tr"}),n.for("upcast").add((e=>{e.on("element:tr",((e,t)=>{t.viewItem.isEmpty&&0==t.modelCursor.index&&e.stop()}),{priority:"high"})})),n.for("downcast").elementToElement({model:"tableRow",view:(e,{writer:t})=>e.isEmpty?t.createEmptyElement("tr"):t.createContainerElement("tr")}),n.for("upcast").elementToElement({model:"tableCell",view:"td"}),n.for("upcast").elementToElement({model:"tableCell",view:"th"}),n.for("upcast").add(p("td")),n.for("upcast").add(p("th")),n.for("editingDowncast").elementToElement({model:"tableCell",view:y({asWidget:!0})}),n.for("dataDowncast").elementToElement({model:"tableCell",view:y()}),n.for("editingDowncast").elementToElement({model:"paragraph",view:k({asWidget:!0}),converterPriority:"high"}),n.for("dataDowncast").elementToElement({model:"paragraph",view:k(),converterPriority:"high"}),n.for("downcast").attributeToAttribute({model:"colspan",view:"colspan"}),n.for("upcast").attributeToAttribute({model:{key:"colspan",value:Ce("colspan")},view:"colspan"}),n.for("downcast").attributeToAttribute({model:"rowspan",view:"rowspan"}),n.for("upcast").attributeToAttribute({model:{key:"rowspan",value:Ce("rowspan")},view:"rowspan"}),e.config.define("table.defaultHeadings.rows",0),e.config.define("table.defaultHeadings.columns",0),e.commands.add("insertTable",new A(e)),e.commands.add("insertTableRowAbove",new E(e,{order:"above"})),e.commands.add("insertTableRowBelow",new E(e,{order:"below"})),e.commands.add("insertTableColumnLeft",new x(e,{order:"left"})),e.commands.add("insertTableColumnRight",new x(e,{order:"right"})),e.commands.add("removeTableRow",new W(e)),e.commands.add("removeTableColumn",new H(e)),e.commands.add("splitTableCellVertically",new T(e,{direction:"vertically"})),e.commands.add("splitTableCellHorizontally",new T(e,{direction:"horizontally"})),e.commands.add("mergeTableCells",new le(e)),e.commands.add("mergeTableCellRight",new D(e,{direction:"right"})),e.commands.add("mergeTableCellLeft",new D(e,{direction:"left"})),e.commands.add("mergeTableCellDown",new D(e,{direction:"down"})),e.commands.add("mergeTableCellUp",new D(e,{direction:"up"})),e.commands.add("setTableColumnHeader",new $(e)),e.commands.add("setTableRowHeader",new U(e)),e.commands.add("selectTableRow",new he(e)),e.commands.add("selectTableColumn",new me(e)),function(e){e.document.registerPostFixer((t=>function(e,t){const i=t.document.differ.getChanges();let n=!1;const o=new Set;for(const t of i){let i=null;"insert"==t.type&&"table"==t.name&&(i=t.position.nodeAfter),"insert"!=t.type&&"remove"!=t.type||"tableRow"!=t.name&&"tableCell"!=t.name||(i=t.position.findAncestor("table")),pe(t)&&(i=t.range.start.findAncestor("table")),i&&!o.has(i)&&(n=ge(i,e)||n,n=fe(i,e)||n,o.add(i))}return n}(t,e)))}(t),function(e){e.document.registerPostFixer((t=>function(e,t){const i=t.document.differ.getChanges();let n=!1;for(const t of i)"insert"==t.type&&"table"==t.name&&(n=be(t.position.nodeAfter,e)||n),"insert"==t.type&&"tableRow"==t.name&&(n=we(t.position.nodeAfter,e)||n),"insert"==t.type&&"tableCell"==t.name&&(n=ve(t.position.nodeAfter,e)||n),"remove"!=t.type&&"insert"!=t.type||!_e(t)||(n=ve(t.position.parent,e)||n);return n}(t,e)))}(t),this.listenTo(t.document,"change:data",(()=>{!function(e,t){const i=e.document.differ;for(const e of i.getChanges()){let i,n=!1;if("attribute"==e.type){const t=e.range.start.nodeAfter;if(!t||!t.is("element","table"))continue;if("headingRows"!=e.attributeKey&&"headingColumns"!=e.attributeKey)continue;i=t,n="headingRows"==e.attributeKey}else"tableRow"!=e.name&&"tableCell"!=e.name||(i=e.position.findAncestor("table"),n="tableRow"==e.name);if(!i)continue;const o=i.getAttribute("headingRows")||0,s=i.getAttribute("headingColumns")||0,r=new w(i);for(const e of r){const i=e.row<o||e.column<s?"th":"td",r=t.mapper.toViewElement(e.cell);r&&r.is("element")&&r.name!=i&&t.reconvertItem(n?e.cell.parent:e.cell)}}}(t,e.editing),function(e,t){const i=e.document.differ,n=new Set;for(const e of i.getChanges()){const t="attribute"==e.type?e.range.start.parent:e.position.parent;t.is("element","tableCell")&&n.add(t)}for(const e of n.values()){const i=Array.from(e.getChildren()).filter((e=>ye(e,t.mapper)));for(const e of i)t.reconvertItem(e)}}(t,e.editing)}))}registerAdditionalSlot(e){this._additionalSlots.push(e)}}function Ce(e){return t=>{const i=parseInt(t.getAttribute(e));return Number.isNaN(i)||i<=0?null:i}}var Ae=i(949);class Ee extends Ae.Ss{constructor(e){super(e);const t=this.bindTemplate;this.items=this._createGridCollection(),this.keystrokes=new f.EP,this.focusTracker=new f.$x,this.set("rows",0),this.set("columns",0),this.bind("label").to(this,"columns",this,"rows",((e,t)=>`${t} × ${e}`)),this.setTemplate({tag:"div",attributes:{class:["ck"]},children:[{tag:"div",attributes:{class:["ck-insert-table-dropdown__grid"]},on:{"mouseover@.ck-insert-table-dropdown-grid-box":t.to("boxover")},children:this.items},{tag:"div",attributes:{class:["ck","ck-insert-table-dropdown__label"],"aria-hidden":!0},children:[{text:t.to("label")}]}],on:{mousedown:t.to((e=>{e.preventDefault()})),click:t.to((()=>{this.fire("execute")}))}}),this.on("boxover",((e,t)=>{const{row:i,column:n}=t.target.dataset;this.items.get(10*(parseInt(i,10)-1)+(parseInt(n,10)-1)).focus()})),this.focusTracker.on("change:focusedElement",((e,t,i)=>{if(!i)return;const{row:n,column:o}=i.dataset;this.set({rows:parseInt(n),columns:parseInt(o)})})),this.on("change:columns",(()=>this._highlightGridBoxes())),this.on("change:rows",(()=>this._highlightGridBoxes()))}render(){super.render(),(0,Ae.l1)({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:10,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection});for(const e of this.items)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element)}reset(){this.set({rows:1,columns:1})}focus(){this.items.get(0).focus()}focusLast(){this.items.get(0).focus()}_highlightGridBoxes(){const e=this.rows,t=this.columns;this.items.map(((i,n)=>{const o=Math.floor(n/10)<e&&n%10<t;i.set("isOn",o)}))}_createGridButton(e,t,i,n){const o=new Ae._(e);return o.set({label:n,class:"ck-insert-table-dropdown-grid-box"}),o.extendTemplate({attributes:{"data-row":t,"data-column":i}}),o}_createGridCollection(){const e=[];for(let t=0;t<100;t++){const i=Math.floor(t/10),n=t%10,o=`${i+1} × ${n+1}`;e.push(this._createGridButton(this.locale,i+1,n+1,o))}return this.createCollection(e)}}class xe extends n.k_{static get pluginName(){return"TableUI"}init(){const e=this.editor,t=this.editor.t,i="ltr"===e.locale.contentLanguageDirection;e.ui.componentFactory.add("insertTable",(i=>{const o=e.commands.get("insertTable"),s=(0,Ae.yu)(i);let r;return s.bind("isEnabled").to(o),s.buttonView.set({icon:n.Pt.table,label:t("Insert table"),tooltip:!0}),s.on("change:isOpen",(()=>{r||(r=new Ee(i),s.panelView.children.add(r),r.delegate("execute").to(s),s.on("execute",(()=>{e.execute("insertTable",{rows:r.rows,columns:r.columns}),e.editing.view.focus()})))})),s})),e.ui.componentFactory.add("menuBar:insertTable",(i=>{const o=e.commands.get("insertTable"),s=new Ae.zj(i),r=new Ee(i);return r.delegate("execute").to(s),s.on("change:isOpen",((e,t,i)=>{i||r.reset()})),r.on("execute",(()=>{e.execute("insertTable",{rows:r.rows,columns:r.columns}),e.editing.view.focus()})),s.buttonView.set({label:t("Table"),icon:n.Pt.table}),s.panelView.children.add(r),s.bind("isEnabled").to(o),s})),e.ui.componentFactory.add("tableColumn",(e=>{const n=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:t("Header column"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:i?"insertTableColumnLeft":"insertTableColumnRight",label:t("Insert column left")}},{type:"button",model:{commandName:i?"insertTableColumnRight":"insertTableColumnLeft",label:t("Insert column right")}},{type:"button",model:{commandName:"removeTableColumn",label:t("Delete column")}},{type:"button",model:{commandName:"selectTableColumn",label:t("Select column")}}];return this._prepareDropdown(t("Column"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M18 7v1H2V7h16zm0 5v1H2v-1h16z" opacity=".6"/><path d="M14 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1zm-2 1H8v4h4V2zm0 6H8v4h4V8zm0 6H8v4h4v-4z"/></svg>',n,e)})),e.ui.componentFactory.add("tableRow",(e=>{const i=[{type:"switchbutton",model:{commandName:"setTableRowHeader",label:t("Header row"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:"insertTableRowAbove",label:t("Insert row above")}},{type:"button",model:{commandName:"insertTableRowBelow",label:t("Insert row below")}},{type:"button",model:{commandName:"removeTableRow",label:t("Delete row")}},{type:"button",model:{commandName:"selectTableRow",label:t("Select row")}}];return this._prepareDropdown(t("Row"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v16h-1V2z" opacity=".6"/><path d="M1 6h18a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm1 2v4h4V8H2zm6 0v4h4V8H8zm6 0v4h4V8h-4z"/></svg>',i,e)})),e.ui.componentFactory.add("mergeTableCells",(e=>{const n=[{type:"button",model:{commandName:"mergeTableCellUp",label:t("Merge cell up")}},{type:"button",model:{commandName:i?"mergeTableCellRight":"mergeTableCellLeft",label:t("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:t("Merge cell down")}},{type:"button",model:{commandName:i?"mergeTableCellLeft":"mergeTableCellRight",label:t("Merge cell left")}},{type:"separator"},{type:"button",model:{commandName:"splitTableCellVertically",label:t("Split cell vertically")}},{type:"button",model:{commandName:"splitTableCellHorizontally",label:t("Split cell horizontally")}}];return this._prepareMergeSplitButtonDropdown(t("Merge cells"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1h15A1.5 1.5 0 0 1 19 2.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1zM2 2v16h16V2H2z" opacity=".6"/><path d="M7 2h1v16H7V2zm5 0h1v7h-1V2zm6 5v1H2V7h16zM8 12v1H2v-1h6z" opacity=".6"/><path d="M7 7h12a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1zm1 2v9h10V9H8z"/></svg>',n,e)}))}_prepareDropdown(e,t,i,n){const o=this.editor,s=(0,Ae.yu)(n),r=this._fillDropdownWithListOptions(s,i);return s.buttonView.set({label:e,icon:t,tooltip:!0}),s.bind("isEnabled").toMany(r,"isEnabled",((...e)=>e.some((e=>e)))),this.listenTo(s,"execute",(e=>{o.execute(e.source.commandName),e.source instanceof Ae.Wm||o.editing.view.focus()})),s}_prepareMergeSplitButtonDropdown(e,t,i,n){const o=this.editor,s=(0,Ae.yu)(n,Ae.AO),r="mergeTableCells",a=o.commands.get(r),l=this._fillDropdownWithListOptions(s,i);return s.buttonView.set({label:e,icon:t,tooltip:!0,isEnabled:!0}),s.bind("isEnabled").toMany([a,...l],"isEnabled",((...e)=>e.some((e=>e)))),this.listenTo(s.buttonView,"execute",(()=>{o.execute(r),o.editing.view.focus()})),this.listenTo(s,"execute",(e=>{o.execute(e.source.commandName),o.editing.view.focus()})),s}_fillDropdownWithListOptions(e,t){const i=this.editor,n=[],o=new f.pM;for(const e of t)Te(e,i,n,o);return(0,Ae.O)(e,o),n}}function Te(e,t,i,n){if("button"===e.type||"switchbutton"===e.type){const n=e.model=new Ae.Jc(e.model),{commandName:o,bindIsOn:s}=e.model,r=t.commands.get(o);i.push(r),n.set({commandName:o}),n.bind("isEnabled").to(r),s&&n.bind("isOn").to(r,"value"),n.set({withText:!0})}n.add(e)}class Pe extends n.k_{static get pluginName(){return"TableSelection"}static get requires(){return[ne,ne]}init(){const e=this.editor,t=e.model,i=e.editing.view;this.listenTo(t,"deleteContent",((e,t)=>this._handleDeleteContent(e,t)),{priority:"high"}),this.listenTo(i.document,"insertText",((e,t)=>this._handleInsertTextEvent(e,t)),{priority:"high"}),this._defineSelectionConverter(),this._enablePluginDisabling()}getSelectedTableCells(){const e=this.editor.plugins.get(ne),t=this.editor.model.document.selection,i=e.getSelectedTableCells(t);return 0==i.length?null:i}getSelectionAsFragment(){const e=this.editor.plugins.get(ne),t=this.getSelectedTableCells();return t?this.editor.model.change((i=>{const n=i.createDocumentFragment(),{first:o,last:s}=e.getColumnIndexes(t),{first:r,last:a}=e.getRowIndexes(t),l=t[0].findAncestor("table");let c=a,d=s;if(e.isSelectionRectangular(t)){const e={firstColumn:o,lastColumn:s,firstRow:r,lastRow:a};c=F(l,e),d=N(l,e)}const u=P(l,{startRow:r,startColumn:o,endRow:c,endColumn:d},i);return i.insert(u,n,0),n})):null}setCellSelection(e,t){const i=this._getCellsToSelect(e,t);this.editor.model.change((e=>{e.setSelection(i.cells.map((t=>e.createRangeOn(t))),{backward:i.backward})}))}getFocusCell(){const e=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return e&&e.is("element","tableCell")?e:null}getAnchorCell(){const e=this.editor.model.document.selection,t=(0,f.$1)(e.getRanges()).getContainedElement();return t&&t.is("element","tableCell")?t:null}_defineSelectionConverter(){const e=this.editor,t=new Set;e.conversion.for("editingDowncast").add((e=>e.on("selection",((e,i,n)=>{const o=n.writer;!function(e){for(const i of t)e.removeClass("ck-editor__editable_selected",i);t.clear()}(o);const s=this.getSelectedTableCells();if(!s)return;for(const e of s){const i=n.mapper.toViewElement(e);o.addClass("ck-editor__editable_selected",i),t.add(i)}const r=n.mapper.toViewElement(s[s.length-1]);o.setSelection(r,0)}),{priority:"lowest"})))}_enablePluginDisabling(){const e=this.editor;this.on("change:isEnabled",(()=>{if(!this.isEnabled){const t=this.getSelectedTableCells();if(!t)return;e.model.change((i=>{const n=i.createPositionAt(t[0],0),o=e.model.schema.getNearestSelectionRange(n);i.setSelection(o)}))}}))}_handleDeleteContent(e,t){const i=this.editor.plugins.get(ne),n=t[0],o=t[1],s=this.editor.model,r=!o||"backward"==o.direction,a=i.getSelectedTableCells(n);a.length&&(e.stop(),s.change((e=>{const t=a[r?a.length-1:0];s.change((e=>{for(const t of a)s.deleteContent(e.createSelection(t,"in"))}));const i=s.schema.getNearestSelectionRange(e.createPositionAt(t,0));n.is("documentSelection")?e.setSelection(i):n.setTo(i)})))}_handleInsertTextEvent(e,t){const i=this.editor,n=this.getSelectedTableCells();if(!n)return;const o=i.editing.view,s=i.editing.mapper,r=n.map((e=>o.createRangeOn(s.toViewElement(e))));t.selection=o.createSelection(r)}_getCellsToSelect(e,t){const i=this.editor.plugins.get("TableUtils"),n=i.getCellLocation(e),o=i.getCellLocation(t),s=Math.min(n.row,o.row),r=Math.max(n.row,o.row),a=Math.min(n.column,o.column),l=Math.max(n.column,o.column),c=new Array(r-s+1).fill(null).map((()=>[])),d={startRow:s,endRow:r,startColumn:a,endColumn:l};for(const{row:t,cell:i}of new w(e.findAncestor("table"),d))c[t-s].push(i);const u=o.row<n.row,h=o.column<n.column;return u&&c.reverse(),h&&c.forEach((e=>e.reverse())),{cells:c.flat(),backward:u||h}}}var Ie=i(7377);class Se extends n.k_{static get pluginName(){return"TableClipboard"}static get requires(){return[Ie.$J,Ie.xz,Pe,ne]}init(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"copy",((e,t)=>this._onCopyCut(e,t))),this.listenTo(t,"cut",((e,t)=>this._onCopyCut(e,t))),this.listenTo(e.model,"insertContent",((e,[t,i])=>this._onInsertContent(e,t,i)),{priority:"high"}),this.decorate("_replaceTableSlotCell")}_onCopyCut(e,t){const i=this.editor.editing.view,n=this.editor.plugins.get(Pe),o=this.editor.plugins.get(Ie.$J);n.getSelectedTableCells()&&("cut"!=e.name||this.editor.model.canEditAt(this.editor.model.document.selection))&&(t.preventDefault(),e.stop(),this.editor.model.enqueueChange({isUndoable:"cut"===e.name},(()=>{const s=o._copySelectedFragmentWithMarkers(e.name,this.editor.model.document.selection,(()=>n.getSelectionAsFragment()));i.document.fire("clipboardOutput",{dataTransfer:t.dataTransfer,content:this.editor.data.toView(s),method:e.name})})))}_onInsertContent(e,t,i){if(i&&!i.is("documentSelection"))return;const n=this.editor.model,o=this.editor.plugins.get(ne),s=this.editor.plugins.get(Ie.$J),r=this.getTableIfOnlyTableInContent(t,n);if(!r)return;const a=o.getSelectionAffectedTableCells(n.document.selection);a.length?(e.stop(),t.is("documentFragment")?s._pasteMarkersIntoTransformedElement(t.markers,(e=>this._replaceSelectedCells(r,a,e))):this.editor.model.change((e=>{this._replaceSelectedCells(r,a,e)}))):L(r,o)}_replaceSelectedCells(e,t,i){const n=this.editor.plugins.get(ne),o={width:n.getColumns(e),height:n.getRows(e)},s=function(e,t,i,n){const o=e[0].findAncestor("table"),s=n.getColumnIndexes(e),r=n.getRowIndexes(e),a={firstColumn:s.first,lastColumn:s.last,firstRow:r.first,lastRow:r.last},l=1===e.length;return l&&(a.lastRow+=t.height-1,a.lastColumn+=t.width-1,function(e,t,i,n){const o=n.getColumns(e),s=n.getRows(e);i>o&&n.insertColumns(e,{at:o,columns:i-o}),t>s&&n.insertRows(e,{at:s,rows:t-s})}(o,a.lastRow+1,a.lastColumn+1,n)),l||!n.isSelectionRectangular(e)?function(e,t,i){const{firstRow:n,lastRow:o,firstColumn:s,lastColumn:r}=t,a={first:n,last:o},l={first:s,last:r};Re(e,s,a,i),Re(e,r+1,a,i),Ve(e,n,l,i),Ve(e,o+1,l,i,n)}(o,a,i):(a.lastRow=F(o,a),a.lastColumn=N(o,a)),a}(t,o,i,n),r=s.lastRow-s.firstRow+1,a=s.lastColumn-s.firstColumn+1;e=P(e,{startRow:0,startColumn:0,endRow:Math.min(r,o.height)-1,endColumn:Math.min(a,o.width)-1},i);const l=t[0].findAncestor("table"),c=this._replaceSelectedCellsWithPasted(e,o,l,s,i);if(this.editor.plugins.get("TableSelection").isEnabled){const e=n.sortRanges(c.map((e=>i.createRangeOn(e))));i.setSelection(e)}else i.setSelection(c[0],0);return l}_replaceSelectedCellsWithPasted(e,t,i,n,o){const{width:s,height:r}=t,a=function(e,t,i){const n=new Array(i).fill(null).map((()=>new Array(t).fill(null)));for(const{column:t,row:i,cell:o}of new w(e))n[i][t]=o;return n}(e,s,r),l=[...new w(i,{startRow:n.firstRow,endRow:n.lastRow,startColumn:n.firstColumn,endColumn:n.lastColumn,includeAllSlots:!0})],c=[];let d;for(const e of l){const{row:t,column:i}=e;i===n.firstColumn&&(d=e.getPositionBefore());const l=t-n.firstRow,u=i-n.firstColumn,h=a[l%r][u%s],m=h?o.cloneElement(h):null,g=this._replaceTableSlotCell(e,m,d,o);g&&(B(g,t,i,n.lastRow,n.lastColumn,o),c.push(g),d=o.createPositionAfter(g))}const u=parseInt(i.getAttribute("headingRows")||"0"),h=parseInt(i.getAttribute("headingColumns")||"0"),m=n.firstRow<u&&u<=n.lastRow,g=n.firstColumn<h&&h<=n.lastColumn;if(m){const e=Ve(i,u,{first:n.firstColumn,last:n.lastColumn},o,n.firstRow);c.push(...e)}if(g){const e=Re(i,h,{first:n.firstRow,last:n.lastRow},o);c.push(...e)}return c}_replaceTableSlotCell(e,t,i,n){const{cell:o,isAnchor:s}=e;return s&&n.remove(o),t?(n.insert(t,i),t):null}getTableIfOnlyTableInContent(e,t){if(!e.is("documentFragment")&&!e.is("element"))return null;if(e.is("element","table"))return e;if(1==e.childCount&&e.getChild(0).is("element","table"))return e.getChild(0);const i=t.createRangeIn(e);for(const e of i.getItems())if(e.is("element","table")){const n=t.createRange(i.start,t.createPositionBefore(e));if(t.hasContent(n,{ignoreWhitespaces:!0}))return null;const o=t.createRange(t.createPositionAfter(e),i.end);return t.hasContent(o,{ignoreWhitespaces:!0})?null:e}return null}}function Ve(e,t,i,n,o=0){if(!(t<1))return I(e,t,o).filter((({column:e,cellWidth:t})=>Be(e,t,i))).map((({cell:e})=>S(e,t,n)))}function Re(e,t,i,n){if(!(t<1))return V(e,t).filter((({row:e,cellHeight:t})=>Be(e,t,i))).map((({cell:e,column:i})=>R(e,i,t,n)))}function Be(e,t,i){const n=e+t-1,{first:o,last:s}=i;return e>=o&&e<=s||e<o&&n>=o}class Me extends n.k_{static get pluginName(){return"TableKeyboard"}static get requires(){return[Pe,ne]}init(){const e=this.editor,t=e.editing.view.document,i=e.t;this.listenTo(t,"arrowKey",((...e)=>this._onArrowKey(...e)),{context:"table"}),this.listenTo(t,"tab",((...e)=>this._handleTabOnSelectedTable(...e)),{context:"figure"}),this.listenTo(t,"tab",((...e)=>this._handleTab(...e)),{context:["th","td"]}),e.accessibility.addKeystrokeInfoGroup({id:"table",label:i("Keystrokes that can be used in a table cell"),keystrokes:[{label:i("Move the selection to the next cell"),keystroke:"Tab"},{label:i("Move the selection to the previous cell"),keystroke:"Shift+Tab"},{label:i("Insert a new table row (when in the last cell of a table)"),keystroke:"Tab"},{label:i("Navigate through the table"),keystroke:[["arrowup"],["arrowright"],["arrowdown"],["arrowleft"]]}]})}_handleTabOnSelectedTable(e,t){const i=this.editor,n=i.model.document.selection.getSelectedElement();n&&n.is("element","table")&&(t.preventDefault(),t.stopPropagation(),e.stop(),i.model.change((e=>{e.setSelection(e.createRangeIn(n.getChild(0).getChild(0)))})))}_handleTab(e,t){const i=this.editor,n=this.editor.plugins.get(ne),o=this.editor.plugins.get("TableSelection"),s=i.model.document.selection,r=!t.shiftKey;let a=n.getTableCellsContainingSelection(s)[0];if(a||(a=o.getFocusCell()),!a)return;t.preventDefault(),t.stopPropagation(),e.stop();const l=a.parent,c=l.parent,d=c.getChildIndex(l),u=l.getChildIndex(a),h=0===u;if(!r&&h&&0===d)return void i.model.change((e=>{e.setSelection(e.createRangeOn(c))}));const m=u===l.childCount-1,g=d===n.getRows(c)-1;if(r&&g&&m&&(i.execute("insertTableRowBelow"),d===n.getRows(c)-1))return void i.model.change((e=>{e.setSelection(e.createRangeOn(c))}));let f;if(r&&m){const e=c.getChild(d+1);f=e.getChild(0)}else if(!r&&h){const e=c.getChild(d-1);f=e.getChild(e.childCount-1)}else f=l.getChild(u+(r?1:-1));i.model.change((e=>{e.setSelection(e.createRangeIn(f))}))}_onArrowKey(e,t){const i=this.editor,n=t.keyCode,o=(0,f.Kf)(n,i.locale.contentLanguageDirection);this._handleArrowKeys(o,t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),e.stop())}_handleArrowKeys(e,t){const i=this.editor.plugins.get(ne),n=this.editor.plugins.get("TableSelection"),o=this.editor.model,s=o.document.selection,r=["right","down"].includes(e),a=i.getSelectedTableCells(s);if(a.length){let i;return i=t?n.getFocusCell():r?a[a.length-1]:a[0],this._navigateFromCellInDirection(i,e,t),!0}const l=s.focus.findAncestor("tableCell");if(!l)return!1;if(!s.isCollapsed)if(t){if(s.isBackward==r&&!s.containsEntireContent(l))return!1}else{const e=s.getSelectedElement();if(!e||!o.schema.isObject(e))return!1}return!!this._isSelectionAtCellEdge(s,l,r)&&(this._navigateFromCellInDirection(l,e,t),!0)}_isSelectionAtCellEdge(e,t,i){const n=this.editor.model,o=this.editor.model.schema,s=i?e.getLastPosition():e.getFirstPosition();if(!o.getLimitElement(s).is("element","tableCell"))return n.createPositionAt(t,i?"end":0).isTouching(s);const r=n.createSelection(s);return n.modifySelection(r,{direction:i?"forward":"backward"}),s.isEqual(r.focus)}_navigateFromCellInDirection(e,t,i=!1){const n=this.editor.model,o=e.findAncestor("table"),s=[...new w(o,{includeAllSlots:!0})],{row:r,column:a}=s[s.length-1],l=s.find((({cell:t})=>t==e));let{row:c,column:d}=l;switch(t){case"left":d--;break;case"up":c--;break;case"right":d+=l.cellWidth;break;case"down":c+=l.cellHeight}if(c<0||c>r||d<0&&c<=0||d>a&&c>=r)return void n.change((e=>{e.setSelection(e.createRangeOn(o))}));d<0?(d=i?0:a,c--):d>a&&(d=i?a:0,c++);const u=s.find((e=>e.row==c&&e.column==d)).cell,h=["right","down"].includes(t),m=this.editor.plugins.get("TableSelection");if(i&&m.isEnabled){const t=m.getAnchorCell()||e;m.setCellSelection(t,u)}else{const e=n.createPositionAt(u,h?0:"end");n.change((t=>{t.setSelection(e)}))}}}var Oe=i(4133);class Le extends Oe.$A{constructor(){super(...arguments),this.domEventType=["mousemove","mouseleave"]}onDomEvent(e){this.fire(e.type,e)}}class Fe extends n.k_{static get pluginName(){return"TableMouse"}static get requires(){return[Pe,ne]}init(){this.editor.editing.view.addObserver(Le),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){const e=this.editor,t=e.plugins.get(ne);let i=!1;const n=e.plugins.get(Pe);this.listenTo(e.editing.view.document,"mousedown",((o,s)=>{const r=e.model.document.selection;if(!this.isEnabled||!n.isEnabled)return;if(!s.domEvent.shiftKey)return;const a=n.getAnchorCell()||t.getTableCellsContainingSelection(r)[0];if(!a)return;const l=this._getModelTableCellFromDomEvent(s);l&&Ne(a,l)&&(i=!0,n.setCellSelection(a,l),s.preventDefault())})),this.listenTo(e.editing.view.document,"mouseup",(()=>{i=!1})),this.listenTo(e.editing.view.document,"selectionChange",(e=>{i&&e.stop()}),{priority:"highest"})}_enableMouseDragSelection(){const e=this.editor;let t,i,n=!1,o=!1;const s=e.plugins.get(Pe);this.listenTo(e.editing.view.document,"mousedown",((e,i)=>{this.isEnabled&&s.isEnabled&&(i.domEvent.shiftKey||i.domEvent.ctrlKey||i.domEvent.altKey||(t=this._getModelTableCellFromDomEvent(i)))})),this.listenTo(e.editing.view.document,"mousemove",((e,r)=>{if(!r.domEvent.buttons)return;if(!t)return;const a=this._getModelTableCellFromDomEvent(r);a&&Ne(t,a)&&(i=a,n||i==t||(n=!0)),n&&(o=!0,s.setCellSelection(t,i),r.preventDefault())})),this.listenTo(e.editing.view.document,"mouseup",(()=>{n=!1,o=!1,t=null,i=null})),this.listenTo(e.editing.view.document,"selectionChange",(e=>{o&&e.stop()}),{priority:"highest"})}_getModelTableCellFromDomEvent(e){const t=e.target,i=this.editor.editing.view.createPositionAt(t,0);return this.editor.editing.mapper.toModelPosition(i).parent.findAncestor("tableCell",{includeSelf:!0})}}function Ne(e,t){return e.parent.parent==t.parent.parent}class De extends n.k_{static get requires(){return[ke,xe,Pe,Fe,Me,Se,o.x0]}static get pluginName(){return"Table"}}class ze extends n.k_{static get pluginName(){return"PlainTableOutput"}static get requires(){return[De]}init(){const e=this.editor;e.conversion.for("dataDowncast").elementToStructure({model:"table",view:We,converterPriority:"high"}),e.plugins.has("TableCaption")&&e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(e,{writer:t})=>{if("table"===e.parent.name)return t.createContainerElement("caption")},converterPriority:"high"}),e.plugins.has("TableProperties")&&function(e){const t={"border-width":"tableBorderWidth","border-color":"tableBorderColor","border-style":"tableBorderStyle","background-color":"tableBackgroundColor"};for(const[i,n]of Object.entries(t))e.conversion.for("dataDowncast").add((e=>e.on(`attribute:${n}:table`,((e,t,n)=>{const{item:o,attributeNewValue:s}=t,{mapper:r,writer:a}=n;if(!n.consumable.consume(o,e.name))return;const l=r.toViewElement(o);s?a.setStyle(i,s,l):a.removeStyle(i,l)}),{priority:"high"})))}(e)}}function We(e,{writer:t}){const i=e.getAttribute("headingRows")||0,n=t.createSlot((e=>e.is("element","tableRow")&&e.index<i)),o=t.createSlot((e=>e.is("element","tableRow")&&e.index>=i)),s=t.createSlot((e=>!e.is("element","tableRow"))),r=t.createContainerElement("thead",null,n),a=t.createContainerElement("tbody",null,o),l=[];return i&&l.push(r),i<e.childCount&&l.push(a),t.createContainerElement("table",null,[s,...l])}function He(e){return Ue(e)||$e(e)}function Ue(e){const t=e.getSelectedElement();return t&&je(t)?t:null}function $e(e){const t=e.getFirstPosition();if(!t)return null;let i=t.parent;for(;i;){if(i.is("element")&&je(i))return i;i=i.parent}return null}function je(e){return!!e.getCustomProperty("table")&&(0,o.p4)(e)}class qe extends n.k_{static get requires(){return[o.oP]}static get pluginName(){return"TableToolbar"}afterInit(){const e=this.editor,t=e.t,i=e.plugins.get(o.oP),n=e.config.get("table.contentToolbar"),s=e.config.get("table.tableToolbar");n&&i.register("tableContent",{ariaLabel:t("Table toolbar"),items:n,getRelatedElement:$e}),s&&i.register("table",{ariaLabel:t("Table toolbar"),items:s,getRelatedElement:Ue})}}class Ke extends Ae.Ss{constructor(e,t){super(e),this.set("value",""),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isEmpty",!0),this.options=t,this.focusTracker=new f.$x,this._focusables=new Ae.s3,this.dropdownView=this._createDropdownView(),this.inputView=this._createInputTextView(),this.keystrokes=new f.EP,this._stillTyping=!1,this.focusCycler=new Ae.H({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-input-color"]},children:[this.dropdownView,this.inputView]}),this.on("change:value",((e,t,i)=>this._setInputValue(i)))}render(){super.render(),[this.inputView,this.dropdownView.buttonView].forEach((e=>{this.focusTracker.add(e.element),this._focusables.add(e)})),this.keystrokes.listenTo(this.element)}focus(e){-1===e?this.focusCycler.focusLast():this.focusCycler.focusFirst()}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createDropdownView(){const e=this.locale,t=e.t,i=this.bindTemplate,n=this._createColorSelector(e),o=(0,Ae.yu)(e),s=new Ae.Ss;return s.setTemplate({tag:"span",attributes:{class:["ck","ck-input-color__button__preview"],style:{backgroundColor:i.to("value")}},children:[{tag:"span",attributes:{class:["ck","ck-input-color__button__preview__no-color-indicator",i.if("value","ck-hidden",(e=>""!=e))]}}]}),o.buttonView.extendTemplate({attributes:{class:"ck-input-color__button"}}),o.buttonView.children.add(s),o.buttonView.label=t("Color picker"),o.buttonView.tooltip=!0,o.panelPosition="rtl"===e.uiLanguageDirection?"se":"sw",o.panelView.children.add(n),o.bind("isEnabled").to(this,"isReadOnly",(e=>!e)),o.on("change:isOpen",((e,t,i)=>{i&&(n.updateSelectedColors(),n.showColorGridsFragment())})),o}_createInputTextView(){const e=this.locale,t=new Ae.hK(e);return t.extendTemplate({on:{blur:t.bindTemplate.to("blur")}}),t.value=this.value,t.bind("isReadOnly","hasError").to(this),this.bind("isFocused","isEmpty").to(t),t.on("input",(()=>{const e=t.element.value,i=this.options.colorDefinitions.find((t=>e===t.label));this._stillTyping=!0,this.value=i&&i.color||e})),t.on("blur",(()=>{this._stillTyping=!1,this._setInputValue(t.element.value)})),t.delegate("input").to(this),t}_createColorSelector(e){const t=e.t,i=this.options.defaultColorValue||"",n=t(i?"Restore default":"Remove color"),o=new Ae.oB(e,{colors:this.options.colorDefinitions,columns:this.options.columns,removeButtonLabel:n,colorPickerLabel:t("Color picker"),colorPickerViewConfig:!1!==this.options.colorPickerConfig&&{...this.options.colorPickerConfig,hideInput:!0}});o.appendUI(),o.on("execute",((e,t)=>{"colorPickerSaveButton"!==t.source?(this.value=t.value||i,this.fire("input"),"colorPicker"!==t.source&&(this.dropdownView.isOpen=!1)):this.dropdownView.isOpen=!1}));let s=this.value;return o.on("colorPicker:cancel",(()=>{this.value=s,this.fire("input"),this.dropdownView.isOpen=!1})),o.colorGridsFragmentView.colorPickerButtonView.on("execute",(()=>{s=this.value})),o.bind("selectedColor").to(this,"value"),o}_setInputValue(e){if(!this._stillTyping){const t=Ge(e),i=this.options.colorDefinitions.find((e=>t===Ge(e.color)));this.inputView.value=i?i.label:e||""}}}function Ge(e){return e.replace(/([(,])\s+/g,"$1").replace(/^\s+|\s+(?=[),\s]|$)/g,"").replace(/,|\s/g," ")}const Ze=e=>""===e;function Je(e){return{none:e("None"),solid:e("Solid"),dotted:e("Dotted"),dashed:e("Dashed"),double:e("Double"),groove:e("Groove"),ridge:e("Ridge"),inset:e("Inset"),outset:e("Outset")}}function Qe(e){return e('The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".')}function Ye(e){return e('The value is invalid. Try "10px" or "2em" or simply "2".')}function Xe(e){return e=e.trim().toLowerCase(),Ze(e)||(0,Oe._o)(e)}function et(e){return e=e.trim(),Ze(e)||rt(e)||(0,Oe.Vq)(e)||(0,Oe.fp)(e)}function tt(e){return e=e.trim(),Ze(e)||rt(e)||(0,Oe.Vq)(e)}function it(e,t){const i=new f.pM,n=Je(e.t);for(const o in n){const s={type:"button",model:new Ae.Jc({_borderStyleValue:o,label:n[o],role:"menuitemradio",withText:!0})};"none"===o?s.model.bind("isOn").to(e,"borderStyle",(e=>"none"===t?!e:e===o)):s.model.bind("isOn").to(e,"borderStyle",(e=>e===o)),i.add(s)}return i}function nt(e){const{view:t,icons:i,toolbar:n,labels:o,propertyName:s,nameToValue:r,defaultValue:a}=e;for(const e in o){const l=new Ae._(t.locale);l.set({label:o[e],icon:i[e],tooltip:o[e]});const c=r?r(e):e;l.bind("isOn").to(t,s,(e=>{let t=e;return""===e&&a&&(t=a),c===t})),l.on("execute",(()=>{t[s]=c})),n.items.add(l)}}const ot=[{color:"hsl(0, 0%, 0%)",label:"Black"},{color:"hsl(0, 0%, 30%)",label:"Dim grey"},{color:"hsl(0, 0%, 60%)",label:"Grey"},{color:"hsl(0, 0%, 90%)",label:"Light grey"},{color:"hsl(0, 0%, 100%)",label:"White",hasBorder:!0},{color:"hsl(0, 75%, 60%)",label:"Red"},{color:"hsl(30, 75%, 60%)",label:"Orange"},{color:"hsl(60, 75%, 60%)",label:"Yellow"},{color:"hsl(90, 75%, 60%)",label:"Light green"},{color:"hsl(120, 75%, 60%)",label:"Green"},{color:"hsl(150, 75%, 60%)",label:"Aquamarine"},{color:"hsl(180, 75%, 60%)",label:"Turquoise"},{color:"hsl(210, 75%, 60%)",label:"Light blue"},{color:"hsl(240, 75%, 60%)",label:"Blue"},{color:"hsl(270, 75%, 60%)",label:"Purple"}];function st(e){return(t,i,n)=>{const o=new Ke(t.locale,{colorDefinitions:(s=e.colorConfig,s.map((e=>({color:e.model,label:e.label,options:{hasBorder:e.hasBorder}})))),columns:e.columns,defaultColorValue:e.defaultColorValue,colorPickerConfig:e.colorPickerConfig});var s;return o.inputView.set({id:i,ariaDescribedById:n}),o.bind("isReadOnly").to(t,"isEnabled",(e=>!e)),o.bind("hasError").to(t,"errorText",(e=>!!e)),o.on("input",(()=>{t.errorText=null})),t.bind("isEmpty","isFocused").to(o),o}}function rt(e){const t=parseFloat(e);return!Number.isNaN(t)&&e===String(t)}class at extends Ae.Ss{constructor(e,t={}){super(e);const i=this.bindTemplate;this.set("class",t.class||null),this.children=this.createCollection(),t.children&&t.children.forEach((e=>this.children.add(e))),this.set("_role",null),this.set("_ariaLabelledBy",null),t.labelView&&this.set({_role:"group",_ariaLabelledBy:t.labelView.id}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__row",i.to("class")],role:i.to("_role"),"aria-labelledby":i.to("_ariaLabelledBy")},children:this.children})}}class lt extends Ae.Ss{constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",padding:"",backgroundColor:"",width:"",height:"",horizontalAlignment:"",verticalAlignment:""}),this.options=t;const{borderStyleDropdown:i,borderWidthInput:n,borderColorInput:o,borderRowLabel:s}=this._createBorderFields(),{backgroundRowLabel:r,backgroundInput:a}=this._createBackgroundFields(),{widthInput:l,operatorLabel:c,heightInput:d,dimensionsLabel:u}=this._createDimensionFields(),{horizontalAlignmentToolbar:h,verticalAlignmentToolbar:m,alignmentLabel:g}=this._createAlignmentFields();this.focusTracker=new f.$x,this.keystrokes=new f.EP,this.children=this.createCollection(),this.borderStyleDropdown=i,this.borderWidthInput=n,this.borderColorInput=o,this.backgroundInput=a,this.paddingInput=this._createPaddingField(),this.widthInput=l,this.heightInput=d,this.horizontalAlignmentToolbar=h,this.verticalAlignmentToolbar=m;const{saveButtonView:p,cancelButtonView:b}=this._createActionButtons();this.saveButtonView=p,this.cancelButtonView=b,this._focusables=new Ae.s3,this._focusCycler=new Ae.H({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Ae.Dy(e,{label:this.t("Cell properties")})),this.children.add(new at(e,{labelView:s,children:[s,i,o,n],class:"ck-table-form__border-row"})),this.children.add(new at(e,{labelView:r,children:[r,a],class:"ck-table-form__background-row"})),this.children.add(new at(e,{children:[new at(e,{labelView:u,children:[u,l,c,d],class:"ck-table-form__dimensions-row"}),new at(e,{children:[this.paddingInput],class:"ck-table-cell-properties-form__padding-row"})]})),this.children.add(new at(e,{labelView:g,children:[g,h,m],class:"ck-table-cell-properties-form__alignment-row"})),this.children.add(new at(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-cell-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),(0,Ae.Z5)({view:this}),[this.borderColorInput,this.backgroundInput].forEach((e=>{this._focusCycler.chain(e.fieldView.focusCycler)})),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.paddingInput,this.horizontalAlignmentToolbar,this.verticalAlignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){const e=this.options.defaultTableCellProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},i=st({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),n=this.locale,o=this.t,s=o("Style"),r=new Ae.y0(n);r.text=o("Border");const a=Je(o),l=new Ae.xE(n,Ae.By);l.set({label:s,class:"ck-table-form__border-style"}),l.fieldView.buttonView.set({ariaLabel:s,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:s}),l.fieldView.buttonView.bind("label").to(this,"borderStyle",(e=>a[e||"none"])),l.fieldView.on("execute",(e=>{this.borderStyle=e.source._borderStyleValue})),l.bind("isEmpty").to(this,"borderStyle",(e=>!e)),(0,Ae.O)(l.fieldView,it(this,t.style),{role:"menu",ariaLabel:s});const c=new Ae.xE(n,Ae.Vr);c.set({label:o("Width"),class:"ck-table-form__border-width"}),c.fieldView.bind("value").to(this,"borderWidth"),c.bind("isEnabled").to(this,"borderStyle",ct),c.fieldView.on("input",(()=>{this.borderWidth=c.fieldView.element.value}));const d=new Ae.xE(n,i);return d.set({label:o("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",ct),d.fieldView.on("input",(()=>{this.borderColor=d.fieldView.value})),this.on("change:borderStyle",((e,i,n,o)=>{ct(n)||(this.borderColor="",this.borderWidth=""),ct(o)||(this.borderColor=t.color,this.borderWidth=t.width)})),{borderRowLabel:r,borderStyleDropdown:l,borderColorInput:d,borderWidthInput:c}}_createBackgroundFields(){const e=this.locale,t=this.t,i=new Ae.y0(e);i.text=t("Background");const n=st({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableCellProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),o=new Ae.xE(e,n);return o.set({label:t("Color"),class:"ck-table-cell-properties-form__background"}),o.fieldView.bind("value").to(this,"backgroundColor"),o.fieldView.on("input",(()=>{this.backgroundColor=o.fieldView.value})),{backgroundRowLabel:i,backgroundInput:o}}_createDimensionFields(){const e=this.locale,t=this.t,i=new Ae.y0(e);i.text=t("Dimensions");const n=new Ae.xE(e,Ae.Vr);n.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),n.fieldView.bind("value").to(this,"width"),n.fieldView.on("input",(()=>{this.width=n.fieldView.element.value}));const o=new Ae.Ss(e);o.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const s=new Ae.xE(e,Ae.Vr);return s.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),s.fieldView.bind("value").to(this,"height"),s.fieldView.on("input",(()=>{this.height=s.fieldView.element.value})),{dimensionsLabel:i,widthInput:n,operatorLabel:o,heightInput:s}}_createPaddingField(){const e=this.locale,t=this.t,i=new Ae.xE(e,Ae.Vr);return i.set({label:t("Padding"),class:"ck-table-cell-properties-form__padding"}),i.fieldView.bind("value").to(this,"padding"),i.fieldView.on("input",(()=>{this.padding=i.fieldView.element.value})),i}_createAlignmentFields(){const e=this.locale,t=this.t,i=new Ae.y0(e),o={left:n.Pt.alignLeft,center:n.Pt.alignCenter,right:n.Pt.alignRight,justify:n.Pt.alignJustify,top:n.Pt.alignTop,middle:n.Pt.alignMiddle,bottom:n.Pt.alignBottom};i.text=t("Table cell text alignment");const s=new Ae.X3(e),r="rtl"===e.contentLanguageDirection;s.set({isCompact:!0,ariaLabel:t("Horizontal text alignment toolbar")}),nt({view:this,icons:o,toolbar:s,labels:this._horizontalAlignmentLabels,propertyName:"horizontalAlignment",nameToValue:e=>{if(r){if("left"===e)return"right";if("right"===e)return"left"}return e},defaultValue:this.options.defaultTableCellProperties.horizontalAlignment});const a=new Ae.X3(e);return a.set({isCompact:!0,ariaLabel:t("Vertical text alignment toolbar")}),nt({view:this,icons:o,toolbar:a,labels:this._verticalAlignmentLabels,propertyName:"verticalAlignment",defaultValue:this.options.defaultTableCellProperties.verticalAlignment}),{horizontalAlignmentToolbar:s,verticalAlignmentToolbar:a,alignmentLabel:i}}_createActionButtons(){const e=this.locale,t=this.t,i=new Ae._(e),o=new Ae._(e),s=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return i.set({label:t("Save"),icon:n.Pt.check,class:"ck-button-save",type:"submit",withText:!0}),i.bind("isEnabled").toMany(s,"errorText",((...e)=>e.every((e=>!e)))),o.set({label:t("Cancel"),icon:n.Pt.cancel,class:"ck-button-cancel",withText:!0}),o.delegate("execute").to(this,"cancel"),{saveButtonView:i,cancelButtonView:o}}get _horizontalAlignmentLabels(){const e=this.locale,t=this.t,i=t("Align cell text to the left"),n=t("Align cell text to the center"),o=t("Align cell text to the right"),s=t("Justify cell text");return"rtl"===e.uiLanguageDirection?{right:o,center:n,left:i,justify:s}:{left:i,center:n,right:o,justify:s}}get _verticalAlignmentLabels(){const e=this.t;return{top:e("Align cell text to the top"),middle:e("Align cell text to the middle"),bottom:e("Align cell text to the bottom")}}}function ct(e){return"none"!==e}var dt=i(2223);const ut=(()=>[Ae.Jr.defaultPositions.northArrowSouth,Ae.Jr.defaultPositions.northArrowSouthWest,Ae.Jr.defaultPositions.northArrowSouthEast,Ae.Jr.defaultPositions.southArrowNorth,Ae.Jr.defaultPositions.southArrowNorthWest,Ae.Jr.defaultPositions.southArrowNorthEast,Ae.Jr.defaultPositions.viewportStickyNorth])();function ht(e,t){const i=e.plugins.get("ContextualBalloon"),n=e.editing.view.document.selection;let o;"cell"===t?$e(n)&&(o=gt(e)):He(n)&&(o=mt(e)),o&&i.updatePosition(o)}function mt(e){const t=g(e.model.document.selection),i=e.editing.mapper.toViewElement(t);return{target:e.editing.view.domConverter.mapViewToDom(i),positions:ut}}function gt(e){const t=e.editing.mapper,i=e.editing.view.domConverter,n=e.model.document.selection;if(n.rangeCount>1)return{target:()=>function(e,t){const i=t.editing.mapper,n=t.editing.view.domConverter,o=Array.from(e).map((e=>{const t=ft(e.start),o=i.toViewElement(t);return new f.rw(n.mapViewToDom(o))}));return f.rw.getBoundingRect(o)}(n.getRanges(),e),positions:ut};const o=ft(n.getFirstPosition()),s=t.toViewElement(o);return{target:i.mapViewToDom(s),positions:ut}}function ft(e){return e.nodeAfter&&e.nodeAfter.is("element","tableCell")?e.nodeAfter:e.findAncestor("tableCell")}var pt=i(3149);function bt(e){if(!e||!(0,pt.A)(e))return e;const{top:t,right:i,bottom:n,left:o}=e;return t==i&&i==n&&n==o?t:void 0}function wt(e,t){const i=parseFloat(e);return Number.isNaN(i)||String(i)!==String(e)?e:`${i}${t}`}function vt(e,t={}){const i={borderStyle:"none",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",...e};return t.includeAlignmentProperty&&!i.alignment&&(i.alignment="center"),t.includePaddingProperty&&!i.padding&&(i.padding=""),t.includeVerticalAlignmentProperty&&!i.verticalAlignment&&(i.verticalAlignment="middle"),t.includeHorizontalAlignmentProperty&&!i.horizontalAlignment&&(i.horizontalAlignment=t.isRightToLeftContent?"right":"left"),i}const _t={borderStyle:"tableCellBorderStyle",borderColor:"tableCellBorderColor",borderWidth:"tableCellBorderWidth",height:"tableCellHeight",width:"tableCellWidth",padding:"tableCellPadding",backgroundColor:"tableCellBackgroundColor",horizontalAlignment:"tableCellHorizontalAlignment",verticalAlignment:"tableCellVerticalAlignment"};class yt extends n.k_{static get requires(){return[Ae.pU]}static get pluginName(){return"TableCellPropertiesUI"}constructor(e){super(e),e.config.define("table.tableCellProperties",{borderColors:ot,backgroundColors:ot})}init(){const e=this.editor,t=e.t;this._defaultTableCellProperties=vt(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection}),this._balloon=e.plugins.get(Ae.pU),this.view=null,this._isReady=!1,e.ui.componentFactory.add("tableCellProperties",(i=>{const n=new Ae._(i);n.set({label:t("Cell properties"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m11.105 18-.17 1H2.5A1.5 1.5 0 0 1 1 17.5v-15A1.5 1.5 0 0 1 2.5 1h15A1.5 1.5 0 0 1 19 2.5v9.975l-.85-.124-.15-.302V8h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5h3.105zM2 12h5V8H2v4zm10-4H8v4h4V8zM2 2v5h5V2H2zm0 16h5v-5H2v5zM13 7h5V2h-5v5zM8 2v5h4V2H8z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM13 6a1 1 0 0 1 1 1v3.172a2.047 2.047 0 0 0-.293.443l-.858 1.736-1.916.28-.151.027A1.976 1.976 0 0 0 9.315 14H7a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h6zm-1 2H8v4h4V8z"/></svg>',tooltip:!0}),this.listenTo(n,"execute",(()=>this._showView()));const o=Object.values(_t).map((t=>e.commands.get(t)));return n.bind("isEnabled").toMany(o,"isEnabled",((...e)=>e.some((e=>e)))),n}))}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(){const e=this.editor,t=e.config.get("table.tableCellProperties"),i=(0,Ae.lF)(t.borderColors),n=(0,Ae.b2)(e.locale,i),o=(0,Ae.lF)(t.backgroundColors),s=(0,Ae.b2)(e.locale,o),r=!1!==t.colorPicker,a=new lt(e.locale,{borderColors:n,backgroundColors:s,defaultTableCellProperties:this._defaultTableCellProperties,colorPickerConfig:!!r&&(t.colorPicker||{})}),l=e.t;a.render(),this.listenTo(a,"submit",(()=>{this._hideView()})),this.listenTo(a,"cancel",(()=>{this._undoStepBatch.operations.length&&e.execute("undo",this._undoStepBatch),this._hideView()})),a.keystrokes.set("Esc",((e,t)=>{this._hideView(),t()})),(0,Ae.wy)({emitter:a,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const c=Qe(l),d=Ye(l);return a.on("change:borderStyle",this._getPropertyChangeCallback("tableCellBorderStyle")),a.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:a.borderColorInput,commandName:"tableCellBorderColor",errorText:c,validator:Xe})),a.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:a.borderWidthInput,commandName:"tableCellBorderWidth",errorText:d,validator:tt})),a.on("change:padding",this._getValidatedPropertyChangeCallback({viewField:a.paddingInput,commandName:"tableCellPadding",errorText:d,validator:et})),a.on("change:width",this._getValidatedPropertyChangeCallback({viewField:a.widthInput,commandName:"tableCellWidth",errorText:d,validator:et})),a.on("change:height",this._getValidatedPropertyChangeCallback({viewField:a.heightInput,commandName:"tableCellHeight",errorText:d,validator:et})),a.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:a.backgroundInput,commandName:"tableCellBackgroundColor",errorText:c,validator:Xe})),a.on("change:horizontalAlignment",this._getPropertyChangeCallback("tableCellHorizontalAlignment")),a.on("change:verticalAlignment",this._getPropertyChangeCallback("tableCellVerticalAlignment")),a}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableCellBorderStyle");Object.entries(_t).map((([t,i])=>{const n=this._defaultTableCellProperties[t]||"";return[t,e.get(i).value||n]})).forEach((([e,i])=>{("borderColor"!==e&&"borderWidth"!==e||"none"!==t.value)&&this.view.set(e,i)})),this._isReady=!0}_showView(){const e=this.editor;this.view||(this.view=this._createPropertiesView()),this.listenTo(e.ui,"update",(()=>{this._updateView()})),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:gt(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){const e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){const e=this.editor;$e(e.editing.view.document.selection)?this._isViewVisible&&ht(e,"cell"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,i,n)=>{this._isReady&&this.editor.execute(e,{value:n,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:i,validator:n,errorText:o}=e,s=(0,dt.A)((()=>{i.errorText=o}),500);return(e,o,r)=>{s.cancel(),this._isReady&&(n(r)?(this.editor.execute(t,{value:r,batch:this._undoStepBatch}),i.errorText=null):s())}}}class kt extends n.uB{constructor(e,t,i){super(e),this.attributeName=t,this._defaultValue=i}refresh(){const e=this.editor,t=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e.model.document.selection);this.isEnabled=!!t.length,this.value=this._getSingleValue(t)}execute(e={}){const{value:t,batch:i}=e,n=this.editor.model,o=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(n.document.selection),s=this._getValueToSet(t);n.enqueueChange(i,(e=>{s?o.forEach((t=>e.setAttribute(this.attributeName,s,t))):o.forEach((t=>e.removeAttribute(this.attributeName,t)))}))}_getAttribute(e){if(!e)return;const t=e.getAttribute(this.attributeName);return t!==this._defaultValue?t:void 0}_getValueToSet(e){if(e!==this._defaultValue)return e}_getSingleValue(e){const t=this._getAttribute(e[0]);return e.every((e=>this._getAttribute(e)===t))?t:void 0}}class Ct extends kt{constructor(e,t){super(e,"tableCellWidth",t)}_getValueToSet(e){if((e=wt(e,"px"))!==this._defaultValue)return e}}class At extends n.k_{static get pluginName(){return"TableCellWidthEditing"}static get requires(){return[ke]}init(){const e=this.editor,t=vt(e.config.get("table.tableCellProperties.defaultProperties"));m(e.model.schema,e.conversion,{modelAttribute:"tableCellWidth",styleName:"width",defaultValue:t.width}),e.commands.add("tableCellWidth",new Ct(e,t.width))}}class Et extends kt{constructor(e,t){super(e,"tableCellPadding",t)}_getAttribute(e){if(!e)return;const t=bt(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){const t=wt(e,"px");if(t!==this._defaultValue)return t}}class xt extends kt{constructor(e,t){super(e,"tableCellHeight",t)}_getValueToSet(e){const t=wt(e,"px");if(t!==this._defaultValue)return t}}class Tt extends kt{constructor(e,t){super(e,"tableCellBackgroundColor",t)}}class Pt extends kt{constructor(e,t){super(e,"tableCellVerticalAlignment",t)}}class It extends kt{constructor(e,t){super(e,"tableCellHorizontalAlignment",t)}}class St extends kt{constructor(e,t){super(e,"tableCellBorderStyle",t)}_getAttribute(e){if(!e)return;const t=bt(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class Vt extends kt{constructor(e,t){super(e,"tableCellBorderColor",t)}_getAttribute(e){if(!e)return;const t=bt(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class Rt extends kt{constructor(e,t){super(e,"tableCellBorderWidth",t)}_getAttribute(e){if(!e)return;const t=bt(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){const t=wt(e,"px");if(t!==this._defaultValue)return t}}const Bt=/^(top|middle|bottom)$/,Mt=/^(left|center|right|justify)$/;class Ot extends n.k_{static get pluginName(){return"TableCellPropertiesEditing"}static get requires(){return[ke,At]}init(){const e=this.editor,t=e.model.schema,i=e.conversion;e.config.define("table.tableCellProperties.defaultProperties",{});const n=vt(e.config.get("table.tableCellProperties.defaultProperties"),{includeVerticalAlignmentProperty:!0,includeHorizontalAlignmentProperty:!0,includePaddingProperty:!0,isRightToLeftContent:"rtl"===e.locale.contentLanguageDirection});e.data.addStyleProcessorRules(Oe.v7),function(e,t,i){const n={width:"tableCellBorderWidth",color:"tableCellBorderColor",style:"tableCellBorderStyle"};e.extend("tableCell",{allowAttributes:Object.values(n)}),r(t,"td",n,i),r(t,"th",n,i),a(t,{modelElement:"tableCell",modelAttribute:n.style,styleName:"border-style"}),a(t,{modelElement:"tableCell",modelAttribute:n.color,styleName:"border-color"}),a(t,{modelElement:"tableCell",modelAttribute:n.width,styleName:"border-width"})}(t,i,{color:n.borderColor,style:n.borderStyle,width:n.borderWidth}),e.commands.add("tableCellBorderStyle",new St(e,n.borderStyle)),e.commands.add("tableCellBorderColor",new Vt(e,n.borderColor)),e.commands.add("tableCellBorderWidth",new Rt(e,n.borderWidth)),m(t,i,{modelAttribute:"tableCellHeight",styleName:"height",defaultValue:n.height}),e.commands.add("tableCellHeight",new xt(e,n.height)),e.data.addStyleProcessorRules(Oe.mC),m(t,i,{modelAttribute:"tableCellPadding",styleName:"padding",reduceBoxSides:!0,defaultValue:n.padding}),e.commands.add("tableCellPadding",new Et(e,n.padding)),e.data.addStyleProcessorRules(Oe.D0),m(t,i,{modelAttribute:"tableCellBackgroundColor",styleName:"background-color",defaultValue:n.backgroundColor}),e.commands.add("tableCellBackgroundColor",new Tt(e,n.backgroundColor)),function(e,t,i){e.extend("tableCell",{allowAttributes:["tableCellHorizontalAlignment"]}),t.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellHorizontalAlignment"},view:e=>({key:"style",value:{"text-align":e}})}),t.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"text-align":Mt}},model:{key:"tableCellHorizontalAlignment",value:e=>{const t=e.getStyle("text-align");return t===i?null:t}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{align:Mt}},model:{key:"tableCellHorizontalAlignment",value:e=>{const t=e.getAttribute("align");return t===i?null:t}}})}(t,i,n.horizontalAlignment),e.commands.add("tableCellHorizontalAlignment",new It(e,n.horizontalAlignment)),function(e,t,i){e.extend("tableCell",{allowAttributes:["tableCellVerticalAlignment"]}),t.for("downcast").attributeToAttribute({model:{name:"tableCell",key:"tableCellVerticalAlignment"},view:e=>({key:"style",value:{"vertical-align":e}})}),t.for("upcast").attributeToAttribute({view:{name:/^(td|th)$/,styles:{"vertical-align":Bt}},model:{key:"tableCellVerticalAlignment",value:e=>{const t=e.getStyle("vertical-align");return t===i?null:t}}}).attributeToAttribute({view:{name:/^(td|th)$/,attributes:{valign:Bt}},model:{key:"tableCellVerticalAlignment",value:e=>{const t=e.getAttribute("valign");return t===i?null:t}}})}(t,i,n.verticalAlignment),e.commands.add("tableCellVerticalAlignment",new Pt(e,n.verticalAlignment))}}class Lt extends n.k_{static get pluginName(){return"TableCellProperties"}static get requires(){return[Ot,yt]}}class Ft extends n.uB{constructor(e,t,i){super(e),this.attributeName=t,this._defaultValue=i}refresh(){const e=g(this.editor.model.document.selection);this.isEnabled=!!e,this.value=this._getValue(e)}execute(e={}){const t=this.editor.model,i=t.document.selection,{value:n,batch:o}=e,s=g(i),r=this._getValueToSet(n);t.enqueueChange(o,(e=>{r?e.setAttribute(this.attributeName,r,s):e.removeAttribute(this.attributeName,s)}))}_getValue(e){if(!e)return;const t=e.getAttribute(this.attributeName);return t!==this._defaultValue?t:void 0}_getValueToSet(e){if(e!==this._defaultValue)return e}}class Nt extends Ft{constructor(e,t){super(e,"tableBackgroundColor",t)}}class Dt extends Ft{constructor(e,t){super(e,"tableBorderColor",t)}_getValue(e){if(!e)return;const t=bt(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class zt extends Ft{constructor(e,t){super(e,"tableBorderStyle",t)}_getValue(e){if(!e)return;const t=bt(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}}class Wt extends Ft{constructor(e,t){super(e,"tableBorderWidth",t)}_getValue(e){if(!e)return;const t=bt(e.getAttribute(this.attributeName));return t!==this._defaultValue?t:void 0}_getValueToSet(e){const t=wt(e,"px");if(t!==this._defaultValue)return t}}class Ht extends Ft{constructor(e,t){super(e,"tableWidth",t)}_getValueToSet(e){if((e=wt(e,"px"))!==this._defaultValue)return e}}class Ut extends Ft{constructor(e,t){super(e,"tableHeight",t)}_getValueToSet(e){if((e=wt(e,"px"))!==this._defaultValue)return e}}class $t extends Ft{constructor(e,t){super(e,"tableAlignment",t)}}const jt=/^(left|center|right)$/,qt=/^(left|none|right)$/;class Kt extends n.k_{static get pluginName(){return"TablePropertiesEditing"}static get requires(){return[ke]}init(){const e=this.editor,t=e.model.schema,i=e.conversion;e.config.define("table.tableProperties.defaultProperties",{});const n=vt(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0});e.data.addStyleProcessorRules(Oe.v7),function(e,t,i){const n={width:"tableBorderWidth",color:"tableBorderColor",style:"tableBorderStyle"};e.extend("table",{allowAttributes:Object.values(n)}),r(t,"table",n,i),l(t,{modelAttribute:n.color,styleName:"border-color"}),l(t,{modelAttribute:n.style,styleName:"border-style"}),l(t,{modelAttribute:n.width,styleName:"border-width"})}(t,i,{color:n.borderColor,style:n.borderStyle,width:n.borderWidth}),e.commands.add("tableBorderColor",new Dt(e,n.borderColor)),e.commands.add("tableBorderStyle",new zt(e,n.borderStyle)),e.commands.add("tableBorderWidth",new Wt(e,n.borderWidth)),function(e,t,i){e.extend("table",{allowAttributes:["tableAlignment"]}),t.for("downcast").attributeToAttribute({model:{name:"table",key:"tableAlignment"},view:e=>({key:"style",value:{float:"center"===e?"none":e}}),converterPriority:"high"}),t.for("upcast").attributeToAttribute({view:{name:/^(table|figure)$/,styles:{float:qt}},model:{key:"tableAlignment",value:e=>{let t=e.getStyle("float");return"none"===t&&(t="center"),t===i?null:t}}}).attributeToAttribute({view:{attributes:{align:jt}},model:{name:"table",key:"tableAlignment",value:e=>{const t=e.getAttribute("align");return t===i?null:t}}})}(t,i,n.alignment),e.commands.add("tableAlignment",new $t(e,n.alignment)),Gt(t,i,{modelAttribute:"tableWidth",styleName:"width",defaultValue:n.width}),e.commands.add("tableWidth",new Ht(e,n.width)),Gt(t,i,{modelAttribute:"tableHeight",styleName:"height",defaultValue:n.height}),e.commands.add("tableHeight",new Ut(e,n.height)),e.data.addStyleProcessorRules(Oe.D0),function(e,t,i){const{modelAttribute:n}=i;e.extend("table",{allowAttributes:[n]}),s(t,{viewElement:"table",...i}),l(t,i)}(t,i,{modelAttribute:"tableBackgroundColor",styleName:"background-color",defaultValue:n.backgroundColor}),e.commands.add("tableBackgroundColor",new Nt(e,n.backgroundColor))}}function Gt(e,t,i){const{modelAttribute:n}=i;e.extend("table",{allowAttributes:[n]}),s(t,{viewElement:/^(table|figure)$/,shouldUpcast:e=>!("table"==e.name&&"figure"==e.parent.name),...i}),a(t,{modelElement:"table",...i})}class Zt extends Ae.Ss{constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",alignment:""}),this.options=t;const{borderStyleDropdown:i,borderWidthInput:n,borderColorInput:o,borderRowLabel:s}=this._createBorderFields(),{backgroundRowLabel:r,backgroundInput:a}=this._createBackgroundFields(),{widthInput:l,operatorLabel:c,heightInput:d,dimensionsLabel:u}=this._createDimensionFields(),{alignmentToolbar:h,alignmentLabel:m}=this._createAlignmentFields();this.focusTracker=new f.$x,this.keystrokes=new f.EP,this.children=this.createCollection(),this.borderStyleDropdown=i,this.borderWidthInput=n,this.borderColorInput=o,this.backgroundInput=a,this.widthInput=l,this.heightInput=d,this.alignmentToolbar=h;const{saveButtonView:g,cancelButtonView:p}=this._createActionButtons();this.saveButtonView=g,this.cancelButtonView=p,this._focusables=new Ae.s3,this._focusCycler=new Ae.H({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new Ae.Dy(e,{label:this.t("Table properties")})),this.children.add(new at(e,{labelView:s,children:[s,i,o,n],class:"ck-table-form__border-row"})),this.children.add(new at(e,{labelView:r,children:[r,a],class:"ck-table-form__background-row"})),this.children.add(new at(e,{children:[new at(e,{labelView:u,children:[u,l,c,d],class:"ck-table-form__dimensions-row"}),new at(e,{labelView:m,children:[m,h],class:"ck-table-properties-form__alignment-row"})]})),this.children.add(new at(e,{children:[this.saveButtonView,this.cancelButtonView],class:"ck-table-form__action-row"})),this.setTemplate({tag:"form",attributes:{class:["ck","ck-form","ck-table-form","ck-table-properties-form"],tabindex:"-1"},children:this.children})}render(){super.render(),(0,Ae.Z5)({view:this}),[this.borderColorInput,this.backgroundInput].forEach((e=>{this._focusCycler.chain(e.fieldView.focusCycler)})),[this.borderStyleDropdown,this.borderColorInput,this.borderWidthInput,this.backgroundInput,this.widthInput,this.heightInput,this.alignmentToolbar,this.saveButtonView,this.cancelButtonView].forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createBorderFields(){const e=this.options.defaultTableProperties,t={style:e.borderStyle,width:e.borderWidth,color:e.borderColor},i=st({colorConfig:this.options.borderColors,columns:5,defaultColorValue:t.color,colorPickerConfig:this.options.colorPickerConfig}),n=this.locale,o=this.t,s=o("Style"),r=new Ae.y0(n);r.text=o("Border");const a=Je(o),l=new Ae.xE(n,Ae.By);l.set({label:s,class:"ck-table-form__border-style"}),l.fieldView.buttonView.set({ariaLabel:s,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:s}),l.fieldView.buttonView.bind("label").to(this,"borderStyle",(e=>a[e||"none"])),l.fieldView.on("execute",(e=>{this.borderStyle=e.source._borderStyleValue})),l.bind("isEmpty").to(this,"borderStyle",(e=>!e)),(0,Ae.O)(l.fieldView,it(this,t.style),{role:"menu",ariaLabel:s});const c=new Ae.xE(n,Ae.Vr);c.set({label:o("Width"),class:"ck-table-form__border-width"}),c.fieldView.bind("value").to(this,"borderWidth"),c.bind("isEnabled").to(this,"borderStyle",Jt),c.fieldView.on("input",(()=>{this.borderWidth=c.fieldView.element.value}));const d=new Ae.xE(n,i);return d.set({label:o("Color"),class:"ck-table-form__border-color"}),d.fieldView.bind("value").to(this,"borderColor"),d.bind("isEnabled").to(this,"borderStyle",Jt),d.fieldView.on("input",(()=>{this.borderColor=d.fieldView.value})),this.on("change:borderStyle",((e,i,n,o)=>{Jt(n)||(this.borderColor="",this.borderWidth=""),Jt(o)||(this.borderColor=t.color,this.borderWidth=t.width)})),{borderRowLabel:r,borderStyleDropdown:l,borderColorInput:d,borderWidthInput:c}}_createBackgroundFields(){const e=this.locale,t=this.t,i=new Ae.y0(e);i.text=t("Background");const n=st({colorConfig:this.options.backgroundColors,columns:5,defaultColorValue:this.options.defaultTableProperties.backgroundColor,colorPickerConfig:this.options.colorPickerConfig}),o=new Ae.xE(e,n);return o.set({label:t("Color"),class:"ck-table-properties-form__background"}),o.fieldView.bind("value").to(this,"backgroundColor"),o.fieldView.on("input",(()=>{this.backgroundColor=o.fieldView.value})),{backgroundRowLabel:i,backgroundInput:o}}_createDimensionFields(){const e=this.locale,t=this.t,i=new Ae.y0(e);i.text=t("Dimensions");const n=new Ae.xE(e,Ae.Vr);n.set({label:t("Width"),class:"ck-table-form__dimensions-row__width"}),n.fieldView.bind("value").to(this,"width"),n.fieldView.on("input",(()=>{this.width=n.fieldView.element.value}));const o=new Ae.Ss(e);o.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const s=new Ae.xE(e,Ae.Vr);return s.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),s.fieldView.bind("value").to(this,"height"),s.fieldView.on("input",(()=>{this.height=s.fieldView.element.value})),{dimensionsLabel:i,widthInput:n,operatorLabel:o,heightInput:s}}_createAlignmentFields(){const e=this.locale,t=this.t,i=new Ae.y0(e);i.text=t("Alignment");const o=new Ae.X3(e);return o.set({isCompact:!0,ariaLabel:t("Table alignment toolbar")}),nt({view:this,icons:{left:n.Pt.objectLeft,center:n.Pt.objectCenter,right:n.Pt.objectRight},toolbar:o,labels:this._alignmentLabels,propertyName:"alignment",defaultValue:this.options.defaultTableProperties.alignment}),{alignmentLabel:i,alignmentToolbar:o}}_createActionButtons(){const e=this.locale,t=this.t,i=new Ae._(e),o=new Ae._(e),s=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return i.set({label:t("Save"),icon:n.Pt.check,class:"ck-button-save",type:"submit",withText:!0}),i.bind("isEnabled").toMany(s,"errorText",((...e)=>e.every((e=>!e)))),o.set({label:t("Cancel"),icon:n.Pt.cancel,class:"ck-button-cancel",withText:!0}),o.delegate("execute").to(this,"cancel"),{saveButtonView:i,cancelButtonView:o}}get _alignmentLabels(){const e=this.locale,t=this.t,i=t("Align table to the left"),n=t("Center table"),o=t("Align table to the right");return"rtl"===e.uiLanguageDirection?{right:o,center:n,left:i}:{left:i,center:n,right:o}}}function Jt(e){return"none"!==e}const Qt={borderStyle:"tableBorderStyle",borderColor:"tableBorderColor",borderWidth:"tableBorderWidth",backgroundColor:"tableBackgroundColor",width:"tableWidth",height:"tableHeight",alignment:"tableAlignment"};class Yt extends n.k_{static get requires(){return[Ae.pU]}static get pluginName(){return"TablePropertiesUI"}constructor(e){super(e),this.view=null,e.config.define("table.tableProperties",{borderColors:ot,backgroundColors:ot})}init(){const e=this.editor,t=e.t;this._defaultTableProperties=vt(e.config.get("table.tableProperties.defaultProperties"),{includeAlignmentProperty:!0}),this._balloon=e.plugins.get(Ae.pU),e.ui.componentFactory.add("tableProperties",(i=>{const n=new Ae._(i);n.set({label:t("Table properties"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8 2v5h4V2h1v5h5v1h-5v4h.021l-.172.351-1.916.28-.151.027c-.287.063-.54.182-.755.341L8 13v5H7v-5H2v-1h5V8H2V7h5V2h1zm4 6H8v4h4V8z" opacity=".6"/><path d="m15.5 11.5 1.323 2.68 2.957.43-2.14 2.085.505 2.946L15.5 18.25l-2.645 1.39.505-2.945-2.14-2.086 2.957-.43L15.5 11.5zM17 1a2 2 0 0 1 2 2v9.475l-.85-.124-.857-1.736a2.048 2.048 0 0 0-.292-.44L17 3H3v14h7.808l.402.392L10.935 19H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h14z"/></svg>',tooltip:!0}),this.listenTo(n,"execute",(()=>this._showView()));const o=Object.values(Qt).map((t=>e.commands.get(t)));return n.bind("isEnabled").toMany(o,"isEnabled",((...e)=>e.some((e=>e)))),n}))}destroy(){super.destroy(),this.view&&this.view.destroy()}_createPropertiesView(){const e=this.editor,t=e.config.get("table.tableProperties"),i=(0,Ae.lF)(t.borderColors),n=(0,Ae.b2)(e.locale,i),o=(0,Ae.lF)(t.backgroundColors),s=(0,Ae.b2)(e.locale,o),r=!1!==t.colorPicker,a=new Zt(e.locale,{borderColors:n,backgroundColors:s,defaultTableProperties:this._defaultTableProperties,colorPickerConfig:!!r&&(t.colorPicker||{})}),l=e.t;a.render(),this.listenTo(a,"submit",(()=>{this._hideView()})),this.listenTo(a,"cancel",(()=>{this._undoStepBatch.operations.length&&e.execute("undo",this._undoStepBatch),this._hideView()})),a.keystrokes.set("Esc",((e,t)=>{this._hideView(),t()})),(0,Ae.wy)({emitter:a,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const c=Qe(l),d=Ye(l);return a.on("change:borderStyle",this._getPropertyChangeCallback("tableBorderStyle")),a.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:a.borderColorInput,commandName:"tableBorderColor",errorText:c,validator:Xe})),a.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:a.borderWidthInput,commandName:"tableBorderWidth",errorText:d,validator:tt})),a.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:a.backgroundInput,commandName:"tableBackgroundColor",errorText:c,validator:Xe})),a.on("change:width",this._getValidatedPropertyChangeCallback({viewField:a.widthInput,commandName:"tableWidth",errorText:d,validator:et})),a.on("change:height",this._getValidatedPropertyChangeCallback({viewField:a.heightInput,commandName:"tableHeight",errorText:d,validator:et})),a.on("change:alignment",this._getPropertyChangeCallback("tableAlignment")),a}_fillViewFormFromCommandValues(){const e=this.editor.commands,t=e.get("tableBorderStyle");Object.entries(Qt).map((([t,i])=>{const n=t,o=this._defaultTableProperties[n]||"";return[n,e.get(i).value||o]})).forEach((([e,i])=>{("borderColor"!==e&&"borderWidth"!==e||"none"!==t.value)&&this.view.set(e,i)})),this._isReady=!0}_showView(){const e=this.editor;this.view||(this.view=this._createPropertiesView()),this.listenTo(e.ui,"update",(()=>{this._updateView()})),this._fillViewFormFromCommandValues(),this._balloon.add({view:this.view,position:mt(e)}),this._undoStepBatch=e.model.createBatch(),this.view.focus()}_hideView(){const e=this.editor;this.stopListening(e.ui,"update"),this._isReady=!1,this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}_updateView(){const e=this.editor;He(e.editing.view.document.selection)?this._isViewVisible&&ht(e,"table"):this._hideView()}get _isViewVisible(){return!!this.view&&this._balloon.visibleView===this.view}get _isViewInBalloon(){return!!this.view&&this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,i,n)=>{this._isReady&&this.editor.execute(e,{value:n,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback(e){const{commandName:t,viewField:i,validator:n,errorText:o}=e,s=(0,dt.A)((()=>{i.errorText=o}),500);return(e,o,r)=>{s.cancel(),this._isReady&&(n(r)?(this.editor.execute(t,{value:r,batch:this._undoStepBatch}),i.errorText=null):s())}}}class Xt extends n.k_{static get pluginName(){return"TableProperties"}static get requires(){return[Kt,Yt]}}function ei(e){return!!e&&e.is("element","table")}function ti(e){for(const t of e.getChildren())if(t.is("element","caption"))return t;return null}function ii(e){const t=e.parent;return"figcaption"==e.name&&t&&t.is("element","figure")&&t.hasClass("table")||"caption"==e.name&&t&&t.is("element","table")?{name:!0}:null}class ni extends n.uB{refresh(){const e=g(this.editor.model.document.selection);this.isEnabled=!!e,this.isEnabled?this.value=!!ti(e):this.value=!1}execute({focusCaptionOnShow:e=!1}={}){this.editor.model.change((t=>{this.value?this._hideTableCaption(t):this._showTableCaption(t,e)}))}_showTableCaption(e,t){const i=this.editor.model,n=g(i.document.selection),o=this.editor.plugins.get("TableCaptionEditing")._getSavedCaption(n)||e.createElement("caption");i.insertContent(o,n,"end"),t&&e.setSelection(o,"in")}_hideTableCaption(e){const t=this.editor.model,i=g(t.document.selection),n=this.editor.plugins.get("TableCaptionEditing"),o=ti(i);n._saveCaption(i,o),t.deleteContent(e.createSelection(o,"on"))}}class oi extends n.k_{static get pluginName(){return"TableCaptionEditing"}constructor(e){super(e),this._savedCaptionsMap=new WeakMap}init(){const e=this.editor,t=e.model.schema,i=e.editing.view,n=e.t;var s;t.isRegistered("caption")?t.extend("caption",{allowIn:"table"}):t.register("caption",{allowIn:"table",allowContentOf:"$block",isLimit:!0}),e.commands.add("toggleTableCaption",new ni(this.editor)),e.conversion.for("upcast").elementToElement({view:ii,model:"caption"}),e.conversion.for("dataDowncast").elementToElement({model:"caption",view:(e,{writer:t})=>ei(e.parent)?t.createContainerElement("figcaption"):null}),e.conversion.for("editingDowncast").elementToElement({model:"caption",view:(e,{writer:t})=>{if(!ei(e.parent))return null;const s=t.createEditableElement("figcaption");return t.setCustomProperty("tableCaption",!0,s),s.placeholder=n("Enter table caption"),(0,Oe.JT)({view:i,element:s,keepOnFocus:!0}),(0,o.YN)(s,t)}}),(s=e.model).document.registerPostFixer((e=>function(e,t){const i=t.document.differ.getChanges();let n=!1;for(const t of i){if("insert"!=t.type)continue;const i=t.position.parent;if(i.is("element","table")||"table"==t.name){const o="table"==t.name?t.position.nodeAfter:i,s=Array.from(o.getChildren()).filter((e=>e.is("element","caption"))),r=s.shift();if(!r)continue;for(const t of s)e.move(e.createRangeIn(t),r,"end"),e.remove(t);r.nextSibling&&(e.move(e.createRangeOn(r),o,"end"),n=!0),n=!!s.length||n}}return n}(e,s)))}_getSavedCaption(e){const t=this._savedCaptionsMap.get(e);return t?Oe.Hg.fromJSON(t):null}_saveCaption(e,t){this._savedCaptionsMap.set(e,t.toJSON())}}class si extends n.k_{static get pluginName(){return"TableCaptionUI"}init(){const e=this.editor,t=e.editing.view,i=e.t;e.ui.componentFactory.add("toggleTableCaption",(o=>{const s=e.commands.get("toggleTableCaption"),r=new Ae._(o);return r.set({icon:n.Pt.caption,tooltip:!0,isToggleable:!0}),r.bind("isOn","isEnabled").to(s,"value","isEnabled"),r.bind("label").to(s,"value",(e=>i(e?"Toggle caption off":"Toggle caption on"))),this.listenTo(r,"execute",(()=>{if(e.execute("toggleTableCaption",{focusCaptionOnShow:!0}),s.value){const i=function(e){const t=g(e);return t?ti(t):null}(e.model.document.selection),n=e.editing.mapper.toViewElement(i);if(!n)return;t.scrollToTheSelection(),t.change((e=>{e.addClass("table__caption_highlighted",n)}))}e.editing.view.focus()})),r}))}}class ri extends n.k_{static get pluginName(){return"TableCaption"}static get requires(){return[oi,si]}}var ai=i(6996),li=i(4022);class ci extends n.uB{refresh(){this.isEnabled=!0}execute(e={}){const{model:t,plugins:i}=this.editor;let{table:n=t.document.selection.getSelectedElement(),columnWidths:o,tableWidth:s}=e;o&&(o=Array.isArray(o)?o:o.split(",")),t.change((e=>{s?e.setAttribute("tableWidth",s,n):e.removeAttribute("tableWidth",n);const t=i.get("TableColumnResizeEditing").getColumnGroupElement(n);if(!o&&!t)return;if(!o)return e.remove(t);const r=Y(o);if(t)Array.from(t.getChildren()).forEach(((t,i)=>e.setAttribute("columnWidth",r[i],t)));else{const t=e.createElement("tableColumnGroup");r.forEach((i=>e.appendElement("tableColumn",{columnWidth:i},t))),e.append(t,n)}}))}}class di extends n.k_{static get requires(){return[ke,ne]}static get pluginName(){return"TableColumnResizeEditing"}constructor(e){super(e),this._isResizingActive=!1,this.set("_isResizingAllowed",!0),this._resizingData=null,this._domEmitter=new((0,f.c5)()),this._tableUtilsPlugin=e.plugins.get("TableUtils"),this.on("change:_isResizingAllowed",((t,i,n)=>{const o=n?"removeClass":"addClass";e.editing.view.change((t=>{for(const i of e.editing.view.document.roots)t[o]("ck-column-resize_disabled",e.editing.view.document.getRoot(i.rootName))}))}))}init(){this._extendSchema(),this._registerPostFixer(),this._registerConverters(),this._registerResizingListeners(),this._registerResizerInserter();const e=this.editor,t=e.plugins.get("TableColumnResize");e.plugins.get("TableEditing").registerAdditionalSlot({filter:e=>e.is("element","tableColumnGroup"),positionOffset:0});const i=new ci(e);e.commands.add("resizeTableWidth",i),e.commands.add("resizeColumnWidths",i),this.bind("_isResizingAllowed").to(e,"isReadOnly",t,"isEnabled",i,"isEnabled",((e,t,i)=>!e&&t&&i))}destroy(){this._domEmitter.stopListening(),super.destroy()}getColumnGroupElement(e){return te(e)}getTableColumnElements(e){return ie(e)}getTableColumnsWidths(e){return function(e){return ie(e).map((e=>e.getAttribute("columnWidth")))}(e)}_extendSchema(){this.editor.model.schema.extend("table",{allowAttributes:["tableWidth"]}),this.editor.model.schema.register("tableColumnGroup",{allowIn:"table",isLimit:!0}),this.editor.model.schema.register("tableColumn",{allowIn:"tableColumnGroup",allowAttributes:["columnWidth","colSpan"],isLimit:!0})}_registerPostFixer(){const e=this.editor.model;function t(e,t,i){const n=i._tableUtilsPlugin.getColumns(t);if(0==n-e.length)return e;const o=e.map((e=>Number(e.replace("%","")))),s=function(e,t){const i=new Set;for(const n of e.getChanges())if("insert"==n.type&&n.position.nodeAfter&&"tableCell"==n.position.nodeAfter.name&&n.position.nodeAfter.getAncestors().includes(t))i.add(n.position.nodeAfter);else if("remove"==n.type){const e=n.position.nodeBefore||n.position.nodeAfter;"tableCell"==e.name&&e.getAncestors().includes(t)&&i.add(e)}return i}(i.editor.model.document.differ,t);for(const e of s){const s=n-o.length;if(0===s)continue;const c=s>0,d=i._tableUtilsPlugin.getCellLocation(e).column;if(c){const e=(l=(r=t,a=i.editor,4e3/K(r,a)),Array(s).fill(l));o.splice(d,0,...e)}else{const e=o.splice(d,Math.abs(s));o[d]+=Q(e)}}var r,a,l;return o.map((e=>e+"%"))}e.document.registerPostFixer((i=>{let n=!1;for(const o of function(e){const t=new Set;for(const i of e.document.differ.getChanges()){let n=null;switch(i.type){case"insert":n=["table","tableRow","tableCell"].includes(i.name)?i.position:null;break;case"remove":n=["tableRow","tableCell"].includes(i.name)?i.position:null;break;case"attribute":i.range.start.nodeAfter&&(n=["table","tableRow","tableCell"].includes(i.range.start.nodeAfter.name)?i.range.start:null)}if(!n)continue;const o=n.nodeAfter&&n.nodeAfter.is("element","table")?n.nodeAfter:n.findAncestor("table");for(const i of e.createRangeOn(o).getItems())i.is("element","table")&&te(i)&&t.add(i)}return t}(e)){const e=this.getColumnGroupElement(o),s=this.getTableColumnElements(e),r=this.getTableColumnsWidths(e);let a=Y(r);a=t(a,o,this),(0,ai.A)(r,a)||(ee(s,e,a,i),n=!0)}return n}))}_registerConverters(){const e=this.editor.conversion;var t;e.for("upcast").attributeToAttribute({view:{name:"figure",key:"style",value:{width:/[\s\S]+/}},model:{name:"table",key:"tableWidth",value:e=>e.getStyle("width")}}),e.for("downcast").attributeToAttribute({model:{name:"table",key:"tableWidth"},view:e=>({name:"figure",key:"style",value:{width:e}})}),e.elementToElement({model:"tableColumnGroup",view:"colgroup"}),e.elementToElement({model:"tableColumn",view:"col"}),e.for("downcast").add((e=>e.on("insert:table",((e,t,i)=>{const n=i.writer,o=t.item,s=i.mapper.toViewElement(o),r=s.is("element","table")?s:Array.from(s.getChildren()).find((e=>e.is("element","table")));te(o)?n.addClass("ck-table-resized",r):n.removeClass("ck-table-resized",r)}),{priority:"low"}))),e.for("upcast").add((t=this._tableUtilsPlugin,e=>e.on("element:colgroup",((e,i,n)=>{const o=i.modelCursor.findAncestor("table"),s=te(o);if(!s)return;const r=ie(s),a=t.getColumns(o);let l=(c=s,d=n.writer,ie(c).reduce(((e,t)=>{const i=t.getAttribute("columnWidth"),n=t.getAttribute("colSpan");if(!n)return e.push(i),e;for(let t=0;t<n;t++)e.push(i);return d.removeAttribute("colSpan",t),e}),[]));var c,d;l=Array.from({length:a},((e,t)=>l[t]||"auto")),(l.length!=r.length||l.includes("auto"))&&ee(r,s,Y(l),n.writer)}),{priority:"low"}))),e.for("upcast").attributeToAttribute({view:{name:"col",styles:{width:/.*/}},model:{key:"columnWidth",value:e=>{const t=e.getStyle("width");return t&&(t.endsWith("%")||t.endsWith("pt"))?t:"auto"}}}),e.for("upcast").attributeToAttribute({view:{name:"col",key:"span"},model:"colSpan"}),e.for("downcast").attributeToAttribute({model:{name:"tableColumn",key:"columnWidth"},view:e=>({key:"style",value:{width:e}})})}_registerResizingListeners(){const e=this.editor.editing.view;e.addObserver(Le),e.document.on("mousedown",this._onMouseDownHandler.bind(this),{priority:"high"}),this._domEmitter.listenTo(f.Sf.window.document,"mousemove",(0,li.A)(this._onMouseMoveHandler.bind(this),50)),this._domEmitter.listenTo(f.Sf.window.document,"mouseup",this._onMouseUpHandler.bind(this))}_onMouseDownHandler(e,t){const i=t.target;if(!i.hasClass("ck-table-column-resizer"))return;if(!this._isResizingAllowed)return;const n=this.editor,o=n.editing.mapper.toModelElement(i.findAncestor("figure"));if(!n.model.canEditAt(o))return;t.preventDefault(),e.stop();const s=function(e,t,i){const n=Array(t.getColumns(e)),o=new w(e);for(const e of o){const t=i.editing.mapper.toViewElement(e.cell),o=X(i.editing.view.domConverter.mapViewToDom(t));(!n[e.column]||o<n[e.column])&&(n[e.column]=J(o))}return n}(o,this._tableUtilsPlugin,n),r=i.findAncestor("table"),a=n.editing.view;Array.from(r.getChildren()).find((e=>e.is("element","colgroup")))||a.change((e=>{!function(e,t,i){const n=e.createContainerElement("colgroup");for(let i=0;i<t.length;i++){const o=e.createEmptyElement("col"),s=`${J(t[i]/Q(t)*100)}%`;e.setStyle("width",s,o),e.insert(e.createPositionAt(n,"end"),o)}e.insert(e.createPositionAt(i,0),n)}(e,s,r)})),this._isResizingActive=!0,this._resizingData=this._getResizingData(t,s),a.change((e=>function(e,t,i){const n=i.widths.viewFigureWidth/i.widths.viewFigureParentWidth;e.addClass("ck-table-resized",t),e.addClass("ck-table-column-resizer__active",i.elements.viewResizer),e.setStyle("width",`${J(100*n)}%`,t.findAncestor("figure"))}(e,r,this._resizingData)))}_onMouseMoveHandler(e,t){if(!this._isResizingActive)return;if(!this._isResizingAllowed)return void this._onMouseUpHandler();const{columnPosition:i,flags:{isRightEdge:n,isTableCentered:o,isLtrContent:s},elements:{viewFigure:r,viewLeftColumn:a,viewRightColumn:l},widths:{viewFigureParentWidth:c,tableWidth:d,leftColumnWidth:u,rightColumnWidth:h}}=this._resizingData,m=40-u,g=n?c-d:h-40,f=(s?1:-1)*(n&&o?2:1),p=(b=(t.clientX-i)*f,w=Math.min(m,0),v=Math.max(g,0),J(b<=w?w:b>=v?v:b));var b,w,v;0!==p&&this.editor.editing.view.change((e=>{const t=J(100*(u+p)/d);if(e.setStyle("width",`${t}%`,a),n){const t=J(100*(d+p)/c);e.setStyle("width",`${t}%`,r)}else{const t=J(100*(h-p)/d);e.setStyle("width",`${t}%`,l)}}))}_onMouseUpHandler(){if(!this._isResizingActive)return;const{viewResizer:e,modelTable:t,viewFigure:i,viewColgroup:n}=this._resizingData.elements,o=this.editor,s=o.editing.view,r=this.getColumnGroupElement(t),a=Array.from(n.getChildren()).filter((e=>e.is("view:element"))),l=r?this.getTableColumnsWidths(r):null,c=a.map((e=>e.getStyle("width"))),d=!(0,ai.A)(l,c),u=t.getAttribute("tableWidth"),h=i.getStyle("width"),m=u!==h;(d||m)&&(this._isResizingAllowed?o.execute("resizeTableWidth",{table:t,tableWidth:`${J(h)}%`,columnWidths:c}):s.change((e=>{if(l)for(const t of a)e.setStyle("width",l.shift(),t);else e.remove(n);m&&(u?e.setStyle("width",u,i):e.removeStyle("width",i)),l||u||e.removeClass("ck-table-resized",[...i.getChildren()].find((e=>"table"===e.name)))}))),s.change((t=>{t.removeClass("ck-table-column-resizer__active",e)})),this._isResizingActive=!1,this._resizingData=null}_getResizingData(e,t){const i=this.editor,n=e.domEvent.clientX,o=e.target,s=o.findAncestor("td")||o.findAncestor("th"),r=i.editing.mapper.toModelElement(s),a=r.findAncestor("table"),l=function(e,t){const i=t.getCellLocation(e).column;return{leftEdge:i,rightEdge:i+(e.getAttribute("colspan")||1)-1}}(r,this._tableUtilsPlugin).rightEdge,c=l===this._tableUtilsPlugin.getColumns(a)-1,d=!a.hasAttribute("tableAlignment"),u="rtl"!==i.locale.contentLanguageDirection,h=s.findAncestor("table"),m=h.findAncestor("figure"),g=[...h.getChildren()].find((e=>e.is("element","colgroup"))),f=g.getChild(l),p=c?void 0:g.getChild(l+1);return{columnPosition:n,flags:{isRightEdge:c,isTableCentered:d,isLtrContent:u},elements:{viewResizer:o,modelTable:a,viewFigure:m,viewColgroup:g,viewLeftColumn:f,viewRightColumn:p},widths:{viewFigureParentWidth:Z(i.editing.view.domConverter.mapViewToDom(m.parent)),viewFigureWidth:Z(i.editing.view.domConverter.mapViewToDom(m)),tableWidth:K(a,i),leftColumnWidth:t[l],rightColumnWidth:c?void 0:t[l+1]}}}_registerResizerInserter(){this.editor.conversion.for("editingDowncast").add((e=>{e.on("insert:tableCell",((e,t,i)=>{const n=t.item,o=i.mapper.toViewElement(n),s=i.writer;s.insert(s.createPositionAt(o,"end"),s.createUIElement("div",{class:"ck-table-column-resizer"}))}),{priority:"lowest"})}))}}class ui extends n.k_{static get requires(){return[di,At]}static get pluginName(){return"TableColumnResize"}}},6192:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Delete:()=>C,Input:()=>h,InsertTextCommand:()=>r,TextTransformation:()=>N,TextWatcher:()=>x,TwoStepCaretMovement:()=>T,Typing:()=>A,findAttributeRange:()=>z,findAttributeRangeBound:()=>W,getLastTextLine:()=>E,inlineHighlight:()=>H});var n=i(1024),o=i(7906);class s{constructor(e,t=20){this._batch=null,this.model=e,this._size=0,this.limit=t,this._isLocked=!1,this._changeCallback=(e,t)=>{t.isLocal&&t.isUndoable&&t!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch({isTyping:!0})),this._batch}get size(){return this._size}input(e){this._size+=e,this._size>=this.limit&&this._reset(!0)}get isLocked(){return this._isLocked}lock(){this._isLocked=!0}unlock(){this._isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(e=!1){this.isLocked&&!e||(this._batch=null,this._size=0)}}class r extends n.Command{constructor(e,t){super(e),this._buffer=new s(e.model,t),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){const t=this.editor.model,i=t.document,n=e.text||"",o=n.length;let s=i.selection;if(e.selection?s=e.selection:e.range&&(s=t.createSelection(e.range)),!t.canEditAt(s))return;const r=e.resultRange;t.enqueueChange(this._buffer.batch,(e=>{this._buffer.lock();const a=Array.from(i.selection.getAttributes());t.deleteContent(s),n&&t.insertContent(e.createText(n,a),s),r?e.setSelection(r):s.is("documentSelection")||e.setSelection(s),this._buffer.unlock(),this._buffer.input(o)}))}}var a=i(151);const l=["insertText","insertReplacementText"],c=[...l,"insertCompositionText"];class d extends a.Observer{constructor(e){super(e),this.focusObserver=e.getObserver(a.FocusObserver);const t=o.env.isAndroid?c:l,i=e.document;i.on("beforeinput",((n,s)=>{if(!this.isEnabled)return;const{data:r,targetRanges:l,inputType:c,domEvent:d}=s;if(!t.includes(c))return;this.focusObserver.flush();const u=new o.EventInfo(i,"insertText");i.fire(u,new a.DomEventData(e,d,{text:r,selection:e.createSelection(l)})),u.stop.called&&n.stop()})),o.env.isAndroid||i.on("compositionend",((t,{data:n,domEvent:o})=>{this.isEnabled&&n&&i.fire("insertText",new a.DomEventData(e,o,{text:n}))}),{priority:"lowest"})}observe(){}stopObserving(){}}var u=i(2223);class h extends n.Plugin{static get pluginName(){return"Input"}init(){const e=this.editor,t=e.model,i=e.editing.view,n=e.editing.mapper,s=t.document.selection;this._compositionQueue=new m(e),i.addObserver(d);const a=new r(e,e.config.get("typing.undoStep")||20);e.commands.add("insertText",a),e.commands.add("input",a),this.listenTo(i.document,"insertText",((r,a)=>{i.document.isComposing||a.preventDefault(),o.env.isAndroid&&i.document.isComposing&&this._compositionQueue.flush("next beforeinput");const{text:l,selection:c}=a;let d;d=c?Array.from(c.getRanges()).map((e=>n.toModelRange(e))):Array.from(s.getRanges());let u=l;if(o.env.isAndroid){const e=Array.from(d[0].getItems()).reduce(((e,t)=>e+(t.is("$textProxy")?t.data:"")),"");if(e&&(e.length<=u.length?u.startsWith(e)&&(u=u.substring(e.length),d[0].start=d[0].start.getShiftedBy(e.length)):e.startsWith(u)&&(d[0].start=d[0].start.getShiftedBy(u.length),u="")),0==u.length&&d[0].isCollapsed)return}const h={text:u,selection:t.createSelection(d)};o.env.isAndroid&&i.document.isComposing?this._compositionQueue.push(h):(e.execute("insertText",h),i.scrollToTheSelection())})),o.env.isAndroid?this.listenTo(i.document,"keydown",((e,n)=>{!s.isCollapsed&&229==n.keyCode&&i.document.isComposing&&g(t,a)})):this.listenTo(i.document,"compositionstart",(()=>{s.isCollapsed||g(t,a)})),o.env.isAndroid?(this.listenTo(i.document,"mutations",((e,{mutations:t})=>{if(i.document.isComposing)for(const{node:e}of t){const t=f(e,n),i=n.toModelElement(t);if(this._compositionQueue.isComposedElement(i))return void this._compositionQueue.flush("mutations")}})),this.listenTo(i.document,"compositionend",(()=>{this._compositionQueue.flush("composition end")})),this.listenTo(i.document,"compositionend",(()=>{const e=[];for(const t of this._compositionQueue.flushComposedElements()){const i=n.toViewElement(t);i&&e.push({type:"children",node:i})}e.length&&i.document.fire("mutations",{mutations:e})}),{priority:"lowest"})):this.listenTo(i.document,"compositionend",(()=>{i.document.fire("mutations",{mutations:[]})}),{priority:"lowest"})}destroy(){super.destroy(),this._compositionQueue.destroy()}}class m{constructor(e){this.flushDebounced=(0,u.A)((()=>this.flush("timeout")),50),this._queue=[],this._compositionElements=new Set,this.editor=e}destroy(){for(this.flushDebounced.cancel(),this._compositionElements.clear();this._queue.length;)this.shift()}get length(){return this._queue.length}push(e){const t={text:e.text};if(e.selection){t.selectionRanges=[];for(const i of e.selection.getRanges())t.selectionRanges.push(a.LiveRange.fromRange(i)),this._compositionElements.add(i.start.parent)}this._queue.push(t),this.flushDebounced()}shift(){const e=this._queue.shift(),t={text:e.text};if(e.selectionRanges){const i=e.selectionRanges.map((e=>function(e){const t=e.toRange();return e.detach(),"$graveyard"==t.root.rootName?null:t}(e))).filter((e=>!!e));i.length&&(t.selection=this.editor.model.createSelection(i))}return t}flush(e){const t=this.editor,i=t.model,n=t.editing.view;if(this.flushDebounced.cancel(),!this._queue.length)return;const o=t.commands.get("insertText").buffer;i.enqueueChange(o.batch,(()=>{for(o.lock();this._queue.length;){const e=this.shift();t.execute("insertText",e)}o.unlock()})),n.scrollToTheSelection()}isComposedElement(e){return this._compositionElements.has(e)}flushComposedElements(){const e=Array.from(this._compositionElements);return this._compositionElements.clear(),e}}function g(e,t){if(!t.isEnabled)return;const i=t.buffer;i.lock(),e.enqueueChange(i.batch,(()=>{e.deleteContent(e.document.selection)})),i.unlock()}function f(e,t){let i=e.is("$text")?e.parent:e;for(;!t.toModelElement(i);)i=i.parent;return i}class p extends n.Command{constructor(e,t){super(e),this.direction=t,this._buffer=new s(e.model,e.config.get("typing.undoStep")),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}execute(e={}){const t=this.editor.model,i=t.document;t.enqueueChange(this._buffer.batch,(n=>{this._buffer.lock();const s=n.createSelection(e.selection||i.selection);if(!t.canEditAt(s))return;const r=e.sequence||1,a=s.isCollapsed;if(s.isCollapsed&&t.modifySelection(s,{direction:this.direction,unit:e.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(r))return void this._replaceEntireContentWithParagraph(n);if(this._shouldReplaceFirstBlockWithParagraph(s,r))return void this.editor.execute("paragraph",{selection:s});if(s.isCollapsed)return;let l=0;s.getFirstRange().getMinimalFlatRanges().forEach((e=>{l+=(0,o.count)(e.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))})),t.deleteContent(s,{doNotResetEntireContent:a,direction:this.direction}),this._buffer.input(l),n.setSelection(s),this._buffer.unlock()}))}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;const t=this.editor.model,i=t.document.selection,n=t.schema.getLimitElement(i);if(!i.isCollapsed||!i.containsEntireContent(n))return!1;if(!t.schema.checkChild(n,"paragraph"))return!1;const o=n.getChild(0);return!o||!o.is("element","paragraph")}_replaceEntireContentWithParagraph(e){const t=this.editor.model,i=t.document.selection,n=t.schema.getLimitElement(i),o=e.createElement("paragraph");e.remove(e.createRangeIn(n)),e.insert(o,n),e.setSelection(o,0)}_shouldReplaceFirstBlockWithParagraph(e,t){const i=this.editor.model;if(t>1||"backward"!=this.direction)return!1;if(!e.isCollapsed)return!1;const n=e.getFirstPosition(),o=i.schema.getLimitElement(n),s=o.getChild(0);return n.parent==s&&!!e.containsEntireContent(s)&&!!i.schema.checkChild(o,"paragraph")&&"paragraph"!=s.name}}const b="word",w="selection",v="backward",_="forward",y={deleteContent:{unit:w,direction:v},deleteContentBackward:{unit:"codePoint",direction:v},deleteWordBackward:{unit:b,direction:v},deleteHardLineBackward:{unit:w,direction:v},deleteSoftLineBackward:{unit:w,direction:v},deleteContentForward:{unit:"character",direction:_},deleteWordForward:{unit:b,direction:_},deleteHardLineForward:{unit:w,direction:_},deleteSoftLineForward:{unit:w,direction:_}};class k extends a.Observer{constructor(e){super(e);const t=e.document;let i=0;t.on("keydown",(()=>{i++})),t.on("keyup",(()=>{i=0})),t.on("beforeinput",((n,s)=>{if(!this.isEnabled)return;const{targetRanges:r,domEvent:l,inputType:c}=s,d=y[c];if(!d)return;const u={direction:d.direction,unit:d.unit,sequence:i};u.unit==w&&(u.selectionToRemove=e.createSelection(r[0])),"deleteContentBackward"===c&&(o.env.isAndroid&&(u.sequence=1),function(e){if(1!=e.length||e[0].isCollapsed)return!1;const t=e[0].getWalker({direction:"backward",singleCharacters:!0,ignoreElementEnd:!0});let i=0;for(const{nextPosition:e,item:n}of t){if(e.parent.is("$text")){const t=e.parent.data,n=e.offset;if((0,o.isInsideSurrogatePair)(t,n)||(0,o.isInsideCombinedSymbol)(t,n)||(0,o.isInsideEmojiSequence)(t,n))continue;i++}else(n.is("containerElement")||n.is("emptyElement"))&&i++;if(i>1)return!0}return!1}(r)&&(u.unit=w,u.selectionToRemove=e.createSelection(r)));const h=new a.BubblingEventInfo(t,"delete",r[0]);t.fire(h,new a.DomEventData(e,l,u)),h.stop.called&&n.stop()})),o.env.isBlink&&function(e){const t=e.view,i=t.document;let n=null,s=!1;function r(e){return e==o.keyCodes.backspace||e==o.keyCodes.delete}function l(e){return e==o.keyCodes.backspace?v:_}i.on("keydown",((e,{keyCode:t})=>{n=t,s=!1})),i.on("keyup",((o,{keyCode:c,domEvent:d})=>{const u=i.selection,h=e.isEnabled&&c==n&&r(c)&&!u.isCollapsed&&!s;if(n=null,h){const e=u.getFirstRange(),n=new a.BubblingEventInfo(i,"delete",e),o={unit:w,direction:l(c),selectionToRemove:u};i.fire(n,new a.DomEventData(t,d,o))}})),i.on("beforeinput",((e,{inputType:t})=>{const i=y[t];r(n)&&i&&i.direction==l(n)&&(s=!0)}),{priority:"high"}),i.on("beforeinput",((e,{inputType:t,data:i})=>{n==o.keyCodes.delete&&"insertText"==t&&"\7f"==i&&e.stop()}),{priority:"high"})}(this)}observe(){}stopObserving(){}}class C extends n.Plugin{static get pluginName(){return"Delete"}init(){const e=this.editor,t=e.editing.view,i=t.document,n=e.model.document;t.addObserver(k),this._undoOnBackspace=!1;const o=new p(e,"forward");e.commands.add("deleteForward",o),e.commands.add("forwardDelete",o),e.commands.add("delete",new p(e,"backward")),this.listenTo(i,"delete",((n,o)=>{i.isComposing||o.preventDefault();const{direction:s,sequence:r,selectionToRemove:a,unit:l}=o,c="forward"===s?"deleteForward":"delete",d={sequence:r};if("selection"==l){const t=Array.from(a.getRanges()).map((t=>e.editing.mapper.toModelRange(t)));d.selection=e.model.createSelection(t)}else d.unit=l;e.execute(c,d),t.scrollToTheSelection()}),{priority:"low"}),this.editor.plugins.has("UndoEditing")&&(this.listenTo(i,"delete",((t,i)=>{this._undoOnBackspace&&"backward"==i.direction&&1==i.sequence&&"codePoint"==i.unit&&(this._undoOnBackspace=!1,e.execute("undo"),i.preventDefault(),t.stop())}),{context:"$capture"}),this.listenTo(n,"change",(()=>{this._undoOnBackspace=!1})))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}class A extends n.Plugin{static get requires(){return[h,C]}static get pluginName(){return"Typing"}}function E(e,t){let i=e.start;return{text:Array.from(e.getWalker({ignoreElementEnd:!1})).reduce(((e,{item:n})=>n.is("$text")||n.is("$textProxy")?e+n.data:(i=t.createPositionAfter(n),"")),""),range:t.createRange(i,e.end)}}class x extends((0,o.ObservableMixin)()){constructor(e,t){super(),this.model=e,this.testCallback=t,this._hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",(()=>{this.isEnabled?this._startListening():(this.stopListening(e.document.selection),this.stopListening(e.document))})),this._startListening()}get hasMatch(){return this._hasMatch}_startListening(){const e=this.model.document;this.listenTo(e.selection,"change:range",((t,{directChange:i})=>{i&&(e.selection.isCollapsed?this._evaluateTextBeforeSelection("selection"):this.hasMatch&&(this.fire("unmatched"),this._hasMatch=!1))})),this.listenTo(e,"change:data",((e,t)=>{!t.isUndo&&t.isLocal&&this._evaluateTextBeforeSelection("data",{batch:t})}))}_evaluateTextBeforeSelection(e,t={}){const i=this.model,n=i.document.selection,o=i.createRange(i.createPositionAt(n.focus.parent,0),n.focus),{text:s,range:r}=E(o,i),a=this.testCallback(s);if(!a&&this.hasMatch&&this.fire("unmatched"),this._hasMatch=!!a,a){const i=Object.assign(t,{text:s,range:r});"object"==typeof a&&Object.assign(i,a),this.fire(`matched:${e}`,i)}}}class T extends n.Plugin{static get pluginName(){return"TwoStepCaretMovement"}constructor(e){super(e),this._isNextGravityRestorationSkipped=!1,this.attributes=new Set,this._overrideUid=null}init(){const e=this.editor,t=e.model,i=e.editing.view,n=e.locale,s=t.document.selection;this.listenTo(i.document,"arrowKey",((e,t)=>{if(!s.isCollapsed)return;if(t.shiftKey||t.altKey||t.ctrlKey)return;const i=t.keyCode==o.keyCodes.arrowright,r=t.keyCode==o.keyCodes.arrowleft;if(!i&&!r)return;const a=n.contentLanguageDirection;let l=!1;l="ltr"===a&&i||"rtl"===a&&r?this._handleForwardMovement(t):this._handleBackwardMovement(t),!0===l&&e.stop()}),{context:"$text",priority:"highest"}),this.listenTo(s,"change:range",((e,t)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!t.directChange&&B(s.getFirstPosition(),this.attributes)||this._restoreGravity())})),this._enableClickingAfterNode(),this._enableInsertContentSelectionAttributesFixer(),this._handleDeleteContentAfterNode()}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){const t=this.attributes,i=this.editor.model,n=i.document.selection,o=n.getFirstPosition();return!(this._isGravityOverridden||o.isAtStart&&P(n,t)||!B(o,t)||(V(e),P(n,t)&&B(o,t,!0)?S(i,t):this._overrideGravity(),0))}_handleBackwardMovement(e){const t=this.attributes,i=this.editor.model,n=i.document.selection,o=n.getFirstPosition();return this._isGravityOverridden?(V(e),this._restoreGravity(),B(o,t,!0)?S(i,t):I(i,t,o),!0):o.isAtStart?!!P(n,t)&&(V(e),I(i,t,o),!0):!P(n,t)&&B(o,t,!0)?(V(e),I(i,t,o),!0):!!R(o,t)&&(o.isAtEnd&&!P(n,t)&&B(o,t)?(V(e),I(i,t,o),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1))}_enableClickingAfterNode(){const e=this.editor,t=e.model,i=t.document.selection,n=e.editing.view.document;e.editing.view.addObserver(a.MouseObserver);let o=!1;this.listenTo(n,"mousedown",(()=>{o=!0})),this.listenTo(n,"selectionChange",(()=>{const e=this.attributes;if(!o)return;if(o=!1,!i.isCollapsed)return;if(!P(i,e))return;const n=i.getFirstPosition();B(n,e)&&(n.isAtStart||B(n,e,!0)?S(t,e):this._isGravityOverridden||this._overrideGravity())}))}_enableInsertContentSelectionAttributesFixer(){const e=this.editor.model,t=e.document.selection,i=this.attributes;this.listenTo(e,"insertContent",(()=>{const n=t.getFirstPosition();P(t,i)&&B(n,i)&&S(e,i)}),{priority:"low"})}_handleDeleteContentAfterNode(){const e=this.editor,t=e.model,i=t.document.selection,n=e.editing.view;let o=!1,s=!1;this.listenTo(n.document,"delete",((e,t)=>{o="backward"===t.direction}),{priority:"high"}),this.listenTo(t,"deleteContent",(()=>{if(!o)return;const e=i.getFirstPosition();s=P(i,this.attributes)&&!R(e,this.attributes)}),{priority:"high"}),this.listenTo(t,"deleteContent",(()=>{o&&(o=!1,s||e.model.enqueueChange((()=>{const e=i.getFirstPosition();P(i,this.attributes)&&B(e,this.attributes)&&(e.isAtStart||B(e,this.attributes,!0)?S(t,this.attributes):this._isGravityOverridden||this._overrideGravity())})))}),{priority:"low"})}get _isGravityOverridden(){return!!this._overrideUid}_overrideGravity(){this._overrideUid=this.editor.model.change((e=>e.overrideSelectionGravity()))}_restoreGravity(){this.editor.model.change((e=>{e.restoreSelectionGravity(this._overrideUid),this._overrideUid=null}))}}function P(e,t){for(const i of t)if(e.hasAttribute(i))return!0;return!1}function I(e,t,i){const n=i.nodeBefore;e.change((i=>{if(n){const t=[],o=e.schema.isObject(n)&&e.schema.isInline(n);for(const[i,s]of n.getAttributes())!e.schema.checkAttribute("$text",i)||o&&!1===e.schema.getAttributeProperties(i).copyFromObject||t.push([i,s]);i.setSelectionAttribute(t)}else i.removeSelectionAttribute(t)}))}function S(e,t){e.change((e=>{e.removeSelectionAttribute(t)}))}function V(e){e.preventDefault()}function R(e,t){return B(e.getShiftedBy(-1),t)}function B(e,t,i=!1){const{nodeBefore:n,nodeAfter:o}=e;for(const e of t){const t=n?n.getAttribute(e):void 0,s=o?o.getAttribute(e):void 0;if((!i||void 0!==t&&void 0!==s)&&s!==t)return!0}return!1}var M=i(3224);const O={copyright:{from:"(c)",to:"©"},registeredTrademark:{from:"(r)",to:"®"},trademark:{from:"(tm)",to:"™"},oneHalf:{from:/(^|[^/a-z0-9])(1\/2)([^/a-z0-9])$/i,to:[null,"½",null]},oneThird:{from:/(^|[^/a-z0-9])(1\/3)([^/a-z0-9])$/i,to:[null,"⅓",null]},twoThirds:{from:/(^|[^/a-z0-9])(2\/3)([^/a-z0-9])$/i,to:[null,"⅔",null]},oneForth:{from:/(^|[^/a-z0-9])(1\/4)([^/a-z0-9])$/i,to:[null,"¼",null]},threeQuarters:{from:/(^|[^/a-z0-9])(3\/4)([^/a-z0-9])$/i,to:[null,"¾",null]},lessThanOrEqual:{from:"<=",to:"≤"},greaterThanOrEqual:{from:">=",to:"≥"},notEqual:{from:"!=",to:"≠"},arrowLeft:{from:"<-",to:"←"},arrowRight:{from:"->",to:"→"},horizontalEllipsis:{from:"...",to:"…"},enDash:{from:/(^| )(--)( )$/,to:[null,"–",null]},emDash:{from:/(^| )(---)( )$/,to:[null,"—",null]},quotesPrimary:{from:D('"'),to:[null,"“",null,"”"]},quotesSecondary:{from:D("'"),to:[null,"‘",null,"’"]},quotesPrimaryEnGb:{from:D("'"),to:[null,"‘",null,"’"]},quotesSecondaryEnGb:{from:D('"'),to:[null,"“",null,"”"]},quotesPrimaryPl:{from:D('"'),to:[null,"„",null,"”"]},quotesSecondaryPl:{from:D("'"),to:[null,"‚",null,"’"]}},L={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},F=["symbols","mathematical","typography","quotes"];class N extends n.Plugin{static get requires(){return["Delete","Input"]}static get pluginName(){return"TextTransformation"}constructor(e){super(e),e.config.define("typing",{transformations:{include:F}})}init(){const e=this.editor.model.document.selection;e.on("change:range",(()=>{this.isEnabled=!e.anchor.parent.is("element","codeBlock")})),this._enableTransformationWatchers()}_enableTransformationWatchers(){const e=this.editor,t=e.model,i=e.plugins.get("Delete"),n=function(e){const t=e.extra||[],i=e.remove||[],n=e=>!i.includes(e);return function(e){const t=new Set;for(const i of e)if("string"==typeof i&&L[i])for(const e of L[i])t.add(e);else t.add(i);return Array.from(t)}(e.include.concat(t).filter(n)).filter(n).map((e=>"string"==typeof e&&O[e]?O[e]:e)).filter((e=>"object"==typeof e)).map((e=>{return{from:(i=e.from,"string"==typeof i?new RegExp(`(${(0,M.A)(i)})$`):i),to:(t=e.to,"string"==typeof t?()=>[t]:t instanceof Array?()=>t:t)};var t,i}))}(e.config.get("typing.transformations")),o=new x(e.model,(e=>{for(const t of n)if(t.from.test(e))return{normalizedTransformation:t}}));o.on("matched:data",((e,n)=>{if(!n.batch.isTyping)return;const{from:o,to:s}=n.normalizedTransformation,r=o.exec(n.text),a=s(r.slice(1)),l=n.range;let c=r.index;t.enqueueChange((e=>{for(let i=1;i<r.length;i++){const o=r[i],s=a[i-1];if(null==s){c+=o.length;continue}const d=l.start.getShiftedBy(c),u=t.createRange(d,d.getShiftedBy(o.length)),h=((n=d).textNode?n.textNode:n.nodeAfter).getAttributes();t.insertContent(e.createText(s,h),u),c+=s.length}var n;t.enqueueChange((()=>{i.requestUndoOnBackspace()}))}))})),o.bind("isEnabled").to(this)}}function D(e){return new RegExp(`(^|\\s)(${e})([^${e}]*)(${e})$`)}function z(e,t,i,n){return n.createRange(W(e,t,i,!0,n),W(e,t,i,!1,n))}function W(e,t,i,n,o){let s=e.textNode||(n?e.nodeBefore:e.nodeAfter),r=null;for(;s&&s.getAttribute(t)==i;)r=s,s=n?s.previousSibling:s.nextSibling;return r?o.createPositionAt(r,n?"before":"after"):e}function H(e,t,i,n){const o=e.editing.view,s=new Set;o.document.registerPostFixer((o=>{const r=e.model.document.selection;let a=!1;if(r.hasAttribute(t)){const l=z(r.getFirstPosition(),t,r.getAttribute(t),e.model),c=e.editing.mapper.toViewRange(l);for(const e of c.getItems())e.is("element",i)&&!e.hasClass(n)&&(o.addClass(n,e),s.add(e),a=!0)}return a})),e.conversion.for("editingDowncast").add((e=>{function t(){o.change((e=>{for(const t of s.values())e.removeClass(n,t),s.delete(t)}))}e.on("insert",t,{priority:"highest"}),e.on("remove",t,{priority:"highest"}),e.on("attribute",t,{priority:"highest"}),e.on("selection",t,{priority:"highest"})}))}},7243:(e,t,i)=>{"use strict";i.r(t),i.d(t,{AccessibilityHelp:()=>re,AutocompleteView:()=>Yi,BalloonPanelView:()=>Jt,BalloonToolbar:()=>un,BlockToolbar:()=>fn,BodyCollection:()=>ae,BoxedEditorUIView:()=>Ri,ButtonLabelView:()=>F,ButtonLabelWithHighlightView:()=>an,ButtonView:()=>N,CollapsibleView:()=>ge,ColorGridView:()=>ve,ColorPickerView:()=>Mt,ColorSelectorView:()=>Ut,ColorTileView:()=>we,ComponentFactory:()=>$t,ContextualBalloon:()=>Wi,CssTransitionDisablerMixin:()=>V,DefaultMenuBarItems:()=>bi,Dialog:()=>Y,DialogView:()=>Q,DialogViewPosition:()=>G,DropdownButtonView:()=>Ne,DropdownPanelView:()=>Oe,DropdownView:()=>Fe,EditorUI:()=>Ii,EditorUIView:()=>Vi,FileDialogButtonView:()=>ce,FileDialogListItemButtonView:()=>de,FocusCycler:()=>W,FormHeaderView:()=>z,HighlightedTextView:()=>rn,IconView:()=>L,IframeView:()=>Oi,InlineEditableUIView:()=>Mi,InputNumberView:()=>Re,InputTextView:()=>Ve,InputView:()=>Se,LabelView:()=>ie,LabelWithHighlightView:()=>ln,LabeledFieldView:()=>Pe,ListItemButtonView:()=>X,ListItemGroupView:()=>Ze,ListItemView:()=>Ke,ListSeparatorView:()=>Ge,ListView:()=>Je,MenuBarMenuListItemButtonView:()=>te,MenuBarMenuListItemFileDialogButtonView:()=>kn,MenuBarMenuListItemView:()=>hi,MenuBarMenuListView:()=>_n,MenuBarMenuView:()=>vn,MenuBarView:()=>An,Notification:()=>Fi,SearchInfoView:()=>Ki,SearchTextView:()=>Ji,SpinnerView:()=>cn,SplitButtonView:()=>Qe,StickyPanelView:()=>ji,SwitchButtonView:()=>le,Template:()=>a,TextareaView:()=>Be,ToolbarLineBreakView:()=>ze,ToolbarSeparatorView:()=>De,ToolbarView:()=>Ue,TooltipManager:()=>ei,View:()=>P,ViewCollection:()=>o,ViewModel:()=>Di,addKeyboardHandlingForGrid:()=>B,addListToDropdown:()=>tt,addToolbarToDropdown:()=>Xe,clickOutsideHandler:()=>I,createDropdown:()=>Ye,createLabeledDropdown:()=>lt,createLabeledInputNumber:()=>rt,createLabeledInputText:()=>st,createLabeledTextarea:()=>at,filterGroupAndItemNames:()=>Li,focusChildOnDropdownOpen:()=>nt,getLocalizedColorOptions:()=>fe,injectCssTransitionDisabler:()=>S,isFocusable:()=>U,isViewWithFocusCycler:()=>$,normalizeColorOptions:()=>pe,normalizeMenuBarConfig:()=>wi,normalizeSingleColorDefinition:()=>be,normalizeToolbarConfig:()=>We,submitHandler:()=>R});var n=i(7906);class o extends n.Collection{constructor(e=[]){super(e,{idProperty:"viewUid"}),this.on("add",((e,t,i)=>{this._renderViewIntoCollectionParent(t,i)})),this.on("remove",((e,t)=>{t.element&&this._parentElement&&t.element.remove()})),this._parentElement=null}destroy(){this.map((e=>e.destroy()))}setParent(e){this._parentElement=e;for(const e of this)this._renderViewIntoCollectionParent(e)}delegate(...e){if(!e.length||!e.every((e=>"string"==typeof e)))throw new n.CKEditorError("ui-viewcollection-delegate-wrong-events",this);return{to:t=>{for(const i of this)for(const n of e)i.delegate(n).to(t);this.on("add",((i,n)=>{for(const i of e)n.delegate(i).to(t)})),this.on("remove",((i,n)=>{for(const i of e)n.stopDelegating(i,t)}))}}}_renderViewIntoCollectionParent(e,t){e.isRendered||e.render(),e.element&&this._parentElement&&this._parentElement.insertBefore(e.element,this._parentElement.children[t])}remove(e){return super.remove(e)}}var s=i(3967),r=i(3149);class a extends((0,n.EmitterMixin)()){constructor(e){super(),Object.assign(this,b(p(e))),this._isRendered=!1,this._revertData=null}render(){const e=this._renderNode({intoFragment:!0});return this._isRendered=!0,e}apply(e){return this._revertData={children:[],bindings:[],attributes:{}},this._renderNode({node:e,intoFragment:!1,isApplying:!0,revertData:this._revertData}),e}revert(e){if(!this._revertData)throw new n.CKEditorError("ui-template-revert-not-applied",[this,e]);this._revertTemplateFromNode(e,this._revertData)}*getViews(){yield*function*e(t){if(t.children)for(const i of t.children)C(i)?yield i:A(i)&&(yield*e(i))}(this)}static bind(e,t){return{to:(i,n)=>new c({eventNameOrFunction:i,attribute:i,observable:e,emitter:t,callback:n}),if:(i,n,o)=>new d({observable:e,emitter:t,attribute:i,valueIfTrue:n,callback:o})}}static extend(e,t){if(e._isRendered)throw new n.CKEditorError("template-extend-render",[this,e]);y(e,b(p(t)))}_renderNode(e){let t;if(t=e.node?this.tag&&this.text:this.tag?this.text:!this.text,t)throw new n.CKEditorError("ui-template-wrong-syntax",this);return this.text?this._renderText(e):this._renderElement(e)}_renderElement(e){let t=e.node;return t||(t=e.node=document.createElementNS(this.ns||"http://www.w3.org/1999/xhtml",this.tag)),this._renderAttributes(e),this._renderElementChildren(e),this._setUpListeners(e),t}_renderText(e){let t=e.node;return t?e.revertData.text=t.textContent:t=e.node=document.createTextNode(""),u(this.text)?this._bindToObservable({schema:this.text,updater:m(t),data:e}):t.textContent=this.text.join(""),t}_renderAttributes(e){if(!this.attributes)return;const t=e.node,i=e.revertData;for(const n in this.attributes){const o=t.getAttribute(n),s=this.attributes[n];i&&(i.attributes[n]=o);const r=x(s)?s[0].ns:null;if(u(s)){const a=x(s)?s[0].value:s;i&&T(n)&&a.unshift(o),this._bindToObservable({schema:a,updater:g(t,n,r),data:e})}else if("style"==n&&"string"!=typeof s[0])this._renderStyleAttribute(s[0],e);else{i&&o&&T(n)&&s.unshift(o);const e=s.map((e=>e&&e.value||e)).reduce(((e,t)=>e.concat(t)),[]).reduce(v,"");k(e)||t.setAttributeNS(r,n,e)}}}_renderStyleAttribute(e,t){const i=t.node;for(const n in e){const o=e[n];u(o)?this._bindToObservable({schema:[o],updater:f(i,n),data:t}):i.style[n]=o}}_renderElementChildren(e){const t=e.node,i=e.intoFragment?document.createDocumentFragment():t,o=e.isApplying;let s=0;for(const r of this.children)if(E(r)){if(!o){r.setParent(t);for(const e of r)i.appendChild(e.element)}}else if(C(r))o||(r.isRendered||r.render(),i.appendChild(r.element));else if((0,n.isNode)(r))i.appendChild(r);else if(o){const t={children:[],bindings:[],attributes:{}};e.revertData.children.push(t),r._renderNode({intoFragment:!1,node:i.childNodes[s++],isApplying:!0,revertData:t})}else i.appendChild(r.render());e.intoFragment&&t.appendChild(i)}_setUpListeners(e){if(this.eventListeners)for(const t in this.eventListeners){const i=this.eventListeners[t].map((i=>{const[n,o]=t.split("@");return i.activateDomEventListener(n,o,e)}));e.revertData&&e.revertData.bindings.push(i)}}_bindToObservable({schema:e,updater:t,data:i}){const n=i.revertData;h(e,t,i);const o=e.filter((e=>!k(e))).filter((e=>e.observable)).map((n=>n.activateAttributeListener(e,t,i)));n&&n.bindings.push(o)}_revertTemplateFromNode(e,t){for(const e of t.bindings)for(const t of e)t();if(t.text)return void(e.textContent=t.text);const i=e;for(const e in t.attributes){const n=t.attributes[e];null===n?i.removeAttribute(e):i.setAttribute(e,n)}for(let e=0;e<t.children.length;++e)this._revertTemplateFromNode(i.childNodes[e],t.children[e])}}class l{constructor(e){this.attribute=e.attribute,this.observable=e.observable,this.emitter=e.emitter,this.callback=e.callback}getValue(e){const t=this.observable[this.attribute];return this.callback?this.callback(t,e):t}activateAttributeListener(e,t,i){const n=()=>h(e,t,i);return this.emitter.listenTo(this.observable,`change:${this.attribute}`,n),()=>{this.emitter.stopListening(this.observable,`change:${this.attribute}`,n)}}}class c extends l{constructor(e){super(e),this.eventNameOrFunction=e.eventNameOrFunction}activateDomEventListener(e,t,i){const n=(e,i)=>{t&&!i.target.matches(t)||("function"==typeof this.eventNameOrFunction?this.eventNameOrFunction(i):this.observable.fire(this.eventNameOrFunction,i))};return this.emitter.listenTo(i.node,e,n),()=>{this.emitter.stopListening(i.node,e,n)}}}class d extends l{constructor(e){super(e),this.valueIfTrue=e.valueIfTrue}getValue(e){return!k(super.getValue(e))&&(this.valueIfTrue||!0)}}function u(e){return!!e&&(e.value&&(e=e.value),Array.isArray(e)?e.some(u):e instanceof l)}function h(e,t,{node:i}){const n=function(e,t){return e.map((e=>e instanceof l?e.getValue(t):e))}(e,i);let o;o=1==e.length&&e[0]instanceof d?n[0]:n.reduce(v,""),k(o)?t.remove():t.set(o)}function m(e){return{set(t){e.textContent=t},remove(){e.textContent=""}}}function g(e,t,i){return{set(n){e.setAttributeNS(i,t,n)},remove(){e.removeAttributeNS(i,t)}}}function f(e,t){return{set(i){e.style[t]=i},remove(){e.style[t]=null}}}function p(e){return(0,s.A)(e,(e=>{if(e&&(e instanceof l||A(e)||C(e)||E(e)))return e}))}function b(e){if("string"==typeof e?e=function(e){return{text:[e]}}(e):e.text&&function(e){e.text=(0,n.toArray)(e.text)}(e),e.on&&(e.eventListeners=function(e){for(const t in e)w(e,t);return e}(e.on),delete e.on),!e.text){e.attributes&&function(e){for(const t in e)e[t].value&&(e[t].value=(0,n.toArray)(e[t].value)),w(e,t)}(e.attributes);const t=[];if(e.children)if(E(e.children))t.push(e.children);else for(const i of e.children)A(i)||C(i)||(0,n.isNode)(i)?t.push(i):t.push(new a(i));e.children=t}return e}function w(e,t){e[t]=(0,n.toArray)(e[t])}function v(e,t){return k(t)?e:k(e)?t:`${e} ${t}`}function _(e,t){for(const i in t)e[i]?e[i].push(...t[i]):e[i]=t[i]}function y(e,t){if(t.attributes&&(e.attributes||(e.attributes={}),_(e.attributes,t.attributes)),t.eventListeners&&(e.eventListeners||(e.eventListeners={}),_(e.eventListeners,t.eventListeners)),t.text&&e.text.push(...t.text),t.children&&t.children.length){if(e.children.length!=t.children.length)throw new n.CKEditorError("ui-template-extend-children-mismatch",e);let i=0;for(const n of t.children)y(e.children[i++],n)}}function k(e){return!e&&0!==e}function C(e){return e instanceof P}function A(e){return e instanceof a}function E(e){return e instanceof o}function x(e){return(0,r.A)(e[0])&&e[0].ns}function T(e){return"class"==e||"style"==e}class P extends((0,n.DomEmitterMixin)((0,n.ObservableMixin)())){constructor(e){super(),this.element=null,this.isRendered=!1,this.locale=e,this.t=e&&e.t,this._viewCollections=new n.Collection,this._unboundChildren=this.createCollection(),this._viewCollections.on("add",((t,i)=>{i.locale=e,i.t=e&&e.t})),this.decorate("render")}get bindTemplate(){return this._bindTemplate?this._bindTemplate:this._bindTemplate=a.bind(this,this)}createCollection(e){const t=new o(e);return this._viewCollections.add(t),t}registerChild(e){(0,n.isIterable)(e)||(e=[e]);for(const t of e)this._unboundChildren.add(t)}deregisterChild(e){(0,n.isIterable)(e)||(e=[e]);for(const t of e)this._unboundChildren.remove(t)}setTemplate(e){this.template=new a(e)}extendTemplate(e){a.extend(this.template,e)}render(){if(this.isRendered)throw new n.CKEditorError("ui-view-render-already-rendered",this);this.template&&(this.element=this.template.render(),this.registerChild(this.template.getViews())),this.isRendered=!0}destroy(){this.stopListening(),this._viewCollections.map((e=>e.destroy())),this.template&&this.template._revertData&&this.template.revert(this.element)}}function I({emitter:e,activator:t,callback:i,contextElements:n}){e.listenTo(document,"mousedown",((e,o)=>{if(!t())return;const s="function"==typeof o.composedPath?o.composedPath():[],r="function"==typeof n?n():n;for(const e of r)if(e.contains(o.target)||s.includes(e))return;i()}))}function S(e){const t=e;t.set("_isCssTransitionsDisabled",!1),t.disableCssTransitions=()=>{t._isCssTransitionsDisabled=!0},t.enableCssTransitions=()=>{t._isCssTransitionsDisabled=!1},t.extendTemplate({attributes:{class:[t.bindTemplate.if("_isCssTransitionsDisabled","ck-transitions-disabled")]}})}function V(e){return class extends e{disableCssTransitions(){this._isCssTransitionsDisabled=!0}enableCssTransitions(){this._isCssTransitionsDisabled=!1}constructor(...e){super(...e),this.set("_isCssTransitionsDisabled",!1),this.initializeCssTransitionDisablerMixin()}initializeCssTransitionDisablerMixin(){this.extendTemplate({attributes:{class:[this.bindTemplate.if("_isCssTransitionsDisabled","ck-transitions-disabled")]}})}}}function R({view:e}){e.listenTo(e.element,"submit",((t,i)=>{i.preventDefault(),e.fire("submit")}),{useCapture:!0})}function B({keystrokeHandler:e,focusTracker:t,gridItems:i,numberOfColumns:n,uiLanguageDirection:o}){const s="number"==typeof n?()=>n:n;function r(e){return n=>{const o=i.find((e=>e.element===t.focusedElement)),s=i.getIndex(o),r=e(s,i);i.get(r).focus(),n.stopPropagation(),n.preventDefault()}}function a(e,t){return e===t-1?0:e+1}function l(e,t){return 0===e?t-1:e-1}e.set("arrowright",r(((e,t)=>"rtl"===o?l(e,t.length):a(e,t.length)))),e.set("arrowleft",r(((e,t)=>"rtl"===o?a(e,t.length):l(e,t.length)))),e.set("arrowup",r(((e,t)=>{let i=e-s();return i<0&&(i=e+s()*Math.floor(t.length/s()),i>t.length-1&&(i-=s())),i}))),e.set("arrowdown",r(((e,t)=>{let i=e+s();return i>t.length-1&&(i=e%s()),i})))}var M=i(1024);class O extends P{constructor(){super();const e=this.bindTemplate;this.set("content",""),this.set("viewBox","0 0 20 20"),this.set("fillColor",""),this.set("isColorInherited",!0),this.set("isVisible",!0),this.setTemplate({tag:"svg",ns:"http://www.w3.org/2000/svg",attributes:{class:["ck","ck-icon",e.if("isVisible","ck-hidden",(e=>!e)),"ck-reset_all-excluded",e.if("isColorInherited","ck-icon_inherit-color")],viewBox:e.to("viewBox")}})}render(){super.render(),this._updateXMLContent(),this._colorFillPaths(),this.on("change:content",(()=>{this._updateXMLContent(),this._colorFillPaths()})),this.on("change:fillColor",(()=>{this._colorFillPaths()}))}_updateXMLContent(){if(this.content){const e=(new DOMParser).parseFromString(this.content.trim(),"image/svg+xml").querySelector("svg"),t=e.getAttribute("viewBox");t&&(this.viewBox=t);for(const{name:t,value:i}of Array.from(e.attributes))O.presentationalAttributeNames.includes(t)&&this.element.setAttribute(t,i);for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);for(;e.childNodes.length>0;)this.element.appendChild(e.childNodes[0])}}_colorFillPaths(){this.fillColor&&this.element.querySelectorAll(".ck-icon__fill").forEach((e=>{e.style.fill=this.fillColor}))}}O.presentationalAttributeNames=["alignment-baseline","baseline-shift","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-rendering","cursor","direction","display","dominant-baseline","fill","fill-opacity","fill-rule","filter","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","mask","opacity","overflow","paint-order","pointer-events","shape-rendering","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-overflow","text-rendering","transform","unicode-bidi","vector-effect","visibility","white-space","word-spacing","writing-mode"];const L=O;class F extends P{constructor(){super(),this.set({style:void 0,text:void 0,id:void 0});const e=this.bindTemplate;this.setTemplate({tag:"span",attributes:{class:["ck","ck-button__label"],style:e.to("style"),id:e.to("id")},children:[{text:e.to("text")}]})}}class N extends P{constructor(e,t=new F){super(e),this._focusDelayed=null;const i=this.bindTemplate,o=(0,n.uid)();this.set("_ariaPressed",!1),this.set("_ariaChecked",!1),this.set("ariaLabel",void 0),this.set("ariaLabelledBy",`ck-editor__aria-label_${o}`),this.set("class",void 0),this.set("labelStyle",void 0),this.set("icon",void 0),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isVisible",!0),this.set("isToggleable",!1),this.set("keystroke",void 0),this.set("label",void 0),this.set("role",void 0),this.set("tabindex",-1),this.set("tooltip",!1),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.set("withKeystroke",!1),this.children=this.createCollection(),this.labelView=this._setupLabelView(t),this.iconView=new L,this.iconView.extendTemplate({attributes:{class:"ck-button__icon"}}),this.keystrokeView=this._createKeystrokeView(),this.bind("_tooltipString").to(this,"tooltip",this,"label",this,"keystroke",this._getTooltipString.bind(this));const s={tag:"button",attributes:{class:["ck","ck-button",i.to("class"),i.if("isEnabled","ck-disabled",(e=>!e)),i.if("isVisible","ck-hidden",(e=>!e)),i.to("isOn",(e=>e?"ck-on":"ck-off")),i.if("withText","ck-button_with-text"),i.if("withKeystroke","ck-button_with-keystroke")],role:i.to("role"),type:i.to("type",(e=>e||"button")),tabindex:i.to("tabindex"),"aria-checked":i.to("_ariaChecked"),"aria-pressed":i.to("_ariaPressed"),"aria-label":i.to("ariaLabel"),"aria-labelledby":i.to("ariaLabelledBy"),"aria-disabled":i.if("isEnabled",!0,(e=>!e)),"data-cke-tooltip-text":i.to("_tooltipString"),"data-cke-tooltip-position":i.to("tooltipPosition")},children:this.children,on:{click:i.to((e=>{this.isEnabled?this.fire("execute"):e.preventDefault()}))}};this.bind("_ariaPressed").to(this,"isOn",this,"isToggleable",this,"role",((e,t,i)=>!(!t||D(i))&&String(!!e))),this.bind("_ariaChecked").to(this,"isOn",this,"isToggleable",this,"role",((e,t,i)=>!(!t||!D(i))&&String(!!e))),n.env.isSafari&&(this._focusDelayed||(this._focusDelayed=(0,n.delay)((()=>this.focus()),0)),s.on.mousedown=i.to((()=>{this._focusDelayed()})),s.on.mouseup=i.to((()=>{this._focusDelayed.cancel()}))),this.setTemplate(s)}render(){super.render(),this.icon&&(this.iconView.bind("content").to(this,"icon"),this.children.add(this.iconView)),this.children.add(this.labelView),this.withKeystroke&&this.keystroke&&this.children.add(this.keystrokeView)}focus(){this.element.focus()}destroy(){this._focusDelayed&&this._focusDelayed.cancel(),super.destroy()}_setupLabelView(e){return e.bind("text","style","id").to(this,"label","labelStyle","ariaLabelledBy"),e}_createKeystrokeView(){const e=new P;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__keystroke"]},children:[{text:this.bindTemplate.to("keystroke",(e=>(0,n.getEnvKeystrokeText)(e)))}]}),e}_getTooltipString(e,t,i){return e?"string"==typeof e?e:(i&&(i=(0,n.getEnvKeystrokeText)(i)),e instanceof Function?e(t,i):`${t}${i?` (${i})`:""}`):""}}function D(e){switch(e){case"radio":case"checkbox":case"option":case"switch":case"menuitemcheckbox":case"menuitemradio":return!0;default:return!1}}class z extends P{constructor(e,t={}){super(e);const i=this.bindTemplate;this.set("label",t.label||""),this.set("class",t.class||null),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-form__header",i.to("class")]},children:this.children}),t.icon&&(this.iconView=new L,this.iconView.content=t.icon,this.children.add(this.iconView));const n=new P(e);n.setTemplate({tag:"h2",attributes:{class:["ck","ck-form__header__label"],role:"presentation"},children:[{text:i.to("label")}]}),this.children.add(n)}}class W extends((0,n.EmitterMixin)()){constructor(e){if(super(),this.focusables=e.focusables,this.focusTracker=e.focusTracker,this.keystrokeHandler=e.keystrokeHandler,this.actions=e.actions,e.actions&&e.keystrokeHandler)for(const t in e.actions){let i=e.actions[t];"string"==typeof i&&(i=[i]);for(const n of i)e.keystrokeHandler.set(n,((e,i)=>{this[t](),i()}),e.keystrokeHandlerOptions)}this.on("forwardCycle",(()=>this.focusFirst()),{priority:"low"}),this.on("backwardCycle",(()=>this.focusLast()),{priority:"low"})}get first(){return this.focusables.find(H)||null}get last(){return this.focusables.filter(H).slice(-1)[0]||null}get next(){return this._getDomFocusableItem(1)}get previous(){return this._getDomFocusableItem(-1)}get current(){let e=null;return null===this.focusTracker.focusedElement?null:(this.focusables.find(((t,i)=>{const n=t.element===this.focusTracker.focusedElement;return n&&(e=i),n})),e)}focusFirst(){this._focus(this.first,1)}focusLast(){this._focus(this.last,-1)}focusNext(){const e=this.next;e&&this.focusables.getIndex(e)===this.current||e===this.first?this.fire("forwardCycle"):this._focus(e,1)}focusPrevious(){const e=this.previous;e&&this.focusables.getIndex(e)===this.current||e===this.last?this.fire("backwardCycle"):this._focus(e,-1)}chain(e){const t=()=>null===this.current?null:this.focusables.get(this.current);this.listenTo(e,"forwardCycle",(e=>{const i=t();this.focusNext(),i!==t()&&e.stop()}),{priority:"low"}),this.listenTo(e,"backwardCycle",(e=>{const i=t();this.focusPrevious(),i!==t()&&e.stop()}),{priority:"low"})}unchain(e){this.stopListening(e)}_focus(e,t){e&&this.focusTracker.focusedElement!==e.element&&e.focus(t)}_getDomFocusableItem(e){const t=this.focusables.length;if(!t)return null;const i=this.current;if(null===i)return this[1===e?"first":"last"];let n=this.focusables.get(i),o=(i+t+e)%t;do{const i=this.focusables.get(o);if(H(i)){n=i;break}o=(o+t+e)%t}while(o!==i);return n}}function H(e){return U(e)&&(0,n.isVisible)(e.element)}function U(e){return!(!("focus"in e)||"function"!=typeof e.focus)}function $(e){return U(e)&&"focusCycler"in e&&e.focusCycler instanceof W}function j(e){return class extends e{constructor(...e){super(...e),this._onDragBound=this._onDrag.bind(this),this._onDragEndBound=this._onDragEnd.bind(this),this._lastDraggingCoordinates={x:0,y:0},this.on("render",(()=>{this._attachListeners()})),this.set("isDragging",!1)}_attachListeners(){this.listenTo(this.element,"mousedown",this._onDragStart.bind(this)),this.listenTo(this.element,"touchstart",this._onDragStart.bind(this))}_attachDragListeners(){this.listenTo(n.global.document,"mouseup",this._onDragEndBound),this.listenTo(n.global.document,"touchend",this._onDragEndBound),this.listenTo(n.global.document,"mousemove",this._onDragBound),this.listenTo(n.global.document,"touchmove",this._onDragBound)}_detachDragListeners(){this.stopListening(n.global.document,"mouseup",this._onDragEndBound),this.stopListening(n.global.document,"touchend",this._onDragEndBound),this.stopListening(n.global.document,"mousemove",this._onDragBound),this.stopListening(n.global.document,"touchmove",this._onDragBound)}_onDragStart(e,t){if(!this._isHandleElementPressed(t))return;this._attachDragListeners();let i=0,n=0;t instanceof MouseEvent?(i=t.clientX,n=t.clientY):(i=t.touches[0].clientX,n=t.touches[0].clientY),this._lastDraggingCoordinates={x:i,y:n},this.isDragging=!0}_onDrag(e,t){if(!this.isDragging)return void this._detachDragListeners();let i=0,n=0;t instanceof MouseEvent?(i=t.clientX,n=t.clientY):(i=t.touches[0].clientX,n=t.touches[0].clientY),t.preventDefault(),this.fire("drag",{deltaX:Math.round(i-this._lastDraggingCoordinates.x),deltaY:Math.round(n-this._lastDraggingCoordinates.y)}),this._lastDraggingCoordinates={x:i,y:n}}_onDragEnd(){this._detachDragListeners(),this.isDragging=!1}_isHandleElementPressed(e){return!!this.dragHandleElement&&(this.dragHandleElement===e.target||e.target instanceof HTMLElement&&this.dragHandleElement.contains(e.target))}}}class q extends P{constructor(e){super(e),this.children=this.createCollection(),this.keystrokes=new n.KeystrokeHandler,this._focusTracker=new n.FocusTracker,this._focusables=new o,this.focusCycler=new W({focusables:this._focusables,focusTracker:this._focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-dialog__actions"]},children:this.children})}render(){super.render(),this.keystrokes.listenTo(this.element)}setButtons(e){for(const t of e){const e=new N(this.locale);let i;for(i in e.on("execute",(()=>t.onExecute())),t.onCreate&&t.onCreate(e),t)"onExecute"!=i&&"onCreate"!=i&&e.set(i,t[i]);this.children.add(e)}this._updateFocusCyclableItems()}focus(e){-1===e?this.focusCycler.focusLast():this.focusCycler.focusFirst()}_updateFocusCyclableItems(){Array.from(this.children).forEach((e=>{this._focusables.add(e),this._focusTracker.add(e.element)}))}}class K extends P{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-dialog__content"]},children:this.children})}reset(){for(;this.children.length;)this.children.remove(0)}}const G={SCREEN_CENTER:"screen-center",EDITOR_CENTER:"editor-center",EDITOR_TOP_SIDE:"editor-top-side",EDITOR_TOP_CENTER:"editor-top-center",EDITOR_BOTTOM_CENTER:"editor-bottom-center",EDITOR_ABOVE_CENTER:"editor-above-center",EDITOR_BELOW_CENTER:"editor-below-center"},Z=(0,n.toUnit)("px");class J extends(j(P)){constructor(e,{getCurrentDomRoot:t,getViewportOffset:i}){super(e),this.wasMoved=!1;const s=this.bindTemplate,r=e.t;this.set("className",""),this.set("ariaLabel",r("Editor dialog")),this.set("isModal",!1),this.set("position",G.SCREEN_CENTER),this.set("_isVisible",!1),this.set("_isTransparent",!1),this.set("_top",0),this.set("_left",0),this._getCurrentDomRoot=t,this._getViewportOffset=i,this.decorate("moveTo"),this.parts=this.createCollection(),this.keystrokes=new n.KeystrokeHandler,this.focusTracker=new n.FocusTracker,this._focusables=new o,this._focusCycler=new W({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-dialog-overlay",s.if("isModal","ck-dialog-overlay__transparent",(e=>!e)),s.if("_isVisible","ck-hidden",(e=>!e))],tabindex:"-1"},children:[{tag:"div",attributes:{tabindex:"-1",class:["ck","ck-dialog",s.to("className")],role:"dialog","aria-label":s.to("ariaLabel"),style:{top:s.to("_top",(e=>Z(e))),left:s.to("_left",(e=>Z(e))),visibility:s.if("_isTransparent","hidden")}},children:this.parts}]})}render(){super.render(),this.keystrokes.set("Esc",((e,t)=>{this.fire("close",{source:"escKeyPress"}),t()})),this.on("drag",((e,{deltaX:t,deltaY:i})=>{this.wasMoved=!0,this.moveBy(t,i)})),this.listenTo(n.global.window,"resize",(()=>{this._isVisible&&!this.wasMoved&&this.updatePosition()})),this.listenTo(n.global.document,"scroll",(()=>{this._isVisible&&!this.wasMoved&&this.updatePosition()})),this.on("change:_isVisible",((e,t,i)=>{i&&(this._isTransparent=!0,setTimeout((()=>{this.updatePosition(),this._isTransparent=!1,this.focus()}),10))})),this.keystrokes.listenTo(this.element)}get dragHandleElement(){return this.headerView?this.headerView.element:null}setupParts({icon:e,title:t,hasCloseButton:i=!0,content:n,actionButtons:o}){t&&(this.headerView=new z(this.locale,{icon:e}),i&&(this.closeButtonView=this._createCloseButton(),this.headerView.children.add(this.closeButtonView)),this.headerView.label=t,this.ariaLabel=t,this.parts.add(this.headerView,0)),n&&(n instanceof P&&(n=[n]),this.contentView=new K(this.locale),this.contentView.children.addMany(n),this.parts.add(this.contentView)),o&&(this.actionsView=new q(this.locale),this.actionsView.setButtons(o),this.parts.add(this.actionsView)),this._updateFocusCyclableItems()}focus(){this._focusCycler.focusFirst()}moveTo(e,t){const i=this._getViewportRect(),n=this._getDialogRect();e+n.width>i.right&&(e=i.right-n.width),e<i.left&&(e=i.left),t<i.top&&(t=i.top),this._moveTo(e,t)}_moveTo(e,t){this._left=e,this._top=t}moveBy(e,t){this.moveTo(this._left+e,this._top+t)}_moveOffScreen(){this._moveTo(-9999,-9999)}updatePosition(){if(!this.element||!this.element.parentNode)return;const e=this._getViewportRect();let t,i=this.position;this._getCurrentDomRoot()?t=this._getVisibleDomRootRect(e):i=G.SCREEN_CENTER;const n=J.defaultOffset,o=this._getDialogRect();switch(i){case G.EDITOR_TOP_SIDE:if(t){const e="ltr"===this.locale.contentLanguageDirection?t.right-o.width-n:t.left+n;this.moveTo(e,t.top+n)}else this._moveOffScreen();break;case G.EDITOR_CENTER:t?this.moveTo(Math.round(t.left+t.width/2-o.width/2),Math.round(t.top+t.height/2-o.height/2)):this._moveOffScreen();break;case G.SCREEN_CENTER:this.moveTo(Math.round((e.width-o.width)/2),Math.round((e.height-o.height)/2));break;case G.EDITOR_TOP_CENTER:t?this.moveTo(Math.round(t.left+t.width/2-o.width/2),t.top+n):this._moveOffScreen();break;case G.EDITOR_BOTTOM_CENTER:t?this.moveTo(Math.round(t.left+t.width/2-o.width/2),t.bottom-o.height-n):this._moveOffScreen();break;case G.EDITOR_ABOVE_CENTER:t?this.moveTo(Math.round(t.left+t.width/2-o.width/2),t.top-o.height-n):this._moveOffScreen();break;case G.EDITOR_BELOW_CENTER:t?this.moveTo(Math.round(t.left+t.width/2-o.width/2),t.bottom+n):this._moveOffScreen()}}_getVisibleDomRootRect(e){let t=new n.Rect(this._getCurrentDomRoot()).getVisible();return t?(t=e.getIntersection(t),t||null):null}_getDialogRect(){return new n.Rect(this.element.firstElementChild)}_getViewportRect(){return function(e){e=Object.assign({top:0,bottom:0,left:0,right:0},e);const t=new n.Rect(n.global.window);return t.top+=e.top,t.height-=e.top,t.bottom-=e.bottom,t.height-=e.bottom,t.left+=e.left,t.right-=e.right,t.width-=e.left+e.right,t}(this._getViewportOffset())}_updateFocusCyclableItems(){const e=[];if(this.contentView)for(const t of this.contentView.children)U(t)&&e.push(t);this.actionsView&&e.push(this.actionsView),this.closeButtonView&&e.push(this.closeButtonView),e.forEach((e=>{this._focusables.add(e),this.focusTracker.add(e.element),$(e)&&this._focusCycler.chain(e.focusCycler)}))}_createCloseButton(){const e=new N(this.locale),t=this.locale.t;return e.set({label:t("Close"),tooltip:!0,icon:M.icons.cancel}),e.on("execute",(()=>this.fire("close",{source:"closeButton"}))),e}}J.defaultOffset=15;const Q=J;class Y extends M.Plugin{static get pluginName(){return"Dialog"}constructor(e){super(e);const t=e.t;this._initShowHideListeners(),this._initFocusToggler(),this._initMultiRootIntegration(),this.set({id:null,isOpen:!1}),e.accessibility.addKeystrokeInfos({categoryId:"navigation",keystrokes:[{label:t("Move focus in and out of an active dialog window"),keystroke:"Ctrl+F6",mayRequireFn:!0}]})}_initShowHideListeners(){this.on("show",((e,t)=>{this._show(t)})),this.on("show",((e,t)=>{t.onShow&&t.onShow(this)}),{priority:"low"}),this.on("hide",(()=>{Y._visibleDialogPlugin&&Y._visibleDialogPlugin._hide()})),this.on("hide",(()=>{this._onHide&&(this._onHide(this),this._onHide=void 0)}),{priority:"low"})}_initFocusToggler(){const e=this.editor;e.keystrokes.set("Ctrl+F6",((t,i)=>{this.isOpen&&!this.view.isModal&&(this.view.focusTracker.isFocused?e.editing.view.focus():this.view.focus(),i())}))}_initMultiRootIntegration(){const e=this.editor.model;e.document.on("change:data",(()=>{if(!this.view)return;const t=e.document.differ.getChangedRoots();for(const e of t)e.state&&this.view.updatePosition()}))}show(e){this.hide(),this.fire(`show:${e.id}`,e)}_show({id:e,icon:t,title:i,hasCloseButton:n=!0,content:o,actionButtons:s,className:r,isModal:a,position:l,onHide:c}){const d=this.editor;this.view=new Q(d.locale,{getCurrentDomRoot:()=>d.editing.view.getDomRoot(d.model.document.selection.anchor.root.rootName),getViewportOffset:()=>d.ui.viewportOffset});const u=this.view;u.on("close",(()=>{this.hide()})),d.ui.view.body.add(u),d.ui.focusTracker.add(u.element),d.keystrokes.listenTo(u.element),l||(l=a?G.SCREEN_CENTER:G.EDITOR_CENTER),u.set({position:l,_isVisible:!0,className:r,isModal:a}),u.setupParts({icon:t,title:i,hasCloseButton:n,content:o,actionButtons:s}),this.id=e,c&&(this._onHide=c),this.isOpen=!0,Y._visibleDialogPlugin=this}hide(){Y._visibleDialogPlugin&&Y._visibleDialogPlugin.fire(`hide:${Y._visibleDialogPlugin.id}`)}_hide(){if(!this.view)return;const e=this.editor,t=this.view;t.contentView&&t.contentView.reset(),e.ui.view.body.remove(t),e.ui.focusTracker.remove(t.element),e.keystrokes.stopListening(t.element),t.destroy(),e.editing.view.focus(),this.id=null,this.isOpen=!1,Y._visibleDialogPlugin=null}}class X extends N{constructor(e,t=new F){super(e,t),this._checkIconHolderView=new ee,this.set({hasCheckSpace:!1,_hasCheck:this.isToggleable});const i=this.bindTemplate;this.extendTemplate({attributes:{class:["ck-list-item-button",i.if("isToggleable","ck-list-item-button_toggleable")]}}),this.bind("_hasCheck").to(this,"hasCheckSpace",this,"isToggleable",((e,t)=>e||t))}render(){super.render(),this._hasCheck&&this.children.add(this._checkIconHolderView,0),this._watchCheckIconHolderMount()}_watchCheckIconHolderMount(){this._checkIconHolderView.bind("isOn").to(this,"isOn",(e=>this.isToggleable&&e)),this.on("change:_hasCheck",((e,t,i)=>{const{children:n,_checkIconHolderView:o}=this;i?n.add(o,0):n.remove(o)}))}}class ee extends P{constructor(){super(),this._checkIconView=this._createCheckIconView();const e=this.bindTemplate;this.children=this.createCollection(),this.set("isOn",!1),this.setTemplate({tag:"span",children:this.children,attributes:{class:["ck","ck-list-item-button__check-holder",e.to("isOn",(e=>e?"ck-on":"ck-off"))]}})}render(){super.render(),this.isOn&&this.children.add(this._checkIconView,0),this._watchCheckIconMount()}_watchCheckIconMount(){this.on("change:isOn",((e,t,i)=>{const{children:n,_checkIconView:o}=this;i&&!n.has(o)?n.add(o):!i&&n.has(o)&&n.remove(o)}))}_createCheckIconView(){const e=new L;return e.content=M.icons.check,e.extendTemplate({attributes:{class:"ck-list-item-button__check-icon"}}),e}}class te extends X{constructor(e){super(e),this.set({withText:!0,withKeystroke:!0,tooltip:!1,role:"menuitem"}),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item__button"]}})}}class ie extends P{constructor(e){super(e),this.set("text",void 0),this.set("for",void 0),this.id=`ck-editor__label_${(0,n.uid)()}`;const t=this.bindTemplate;this.setTemplate({tag:"label",attributes:{class:["ck","ck-label"],id:this.id,for:t.to("for")},children:[{text:t.to("text")}]})}}class ne extends P{constructor(e,t){super(e);const i=e.t,o=new ie;o.text=i("Help Contents. To close this dialog press ESC."),this.setTemplate({tag:"div",attributes:{class:["ck","ck-accessibility-help-dialog__content"],"aria-labelledby":o.id,role:"document",tabindex:-1},children:[(0,n.createElement)(document,"p",{},i("Below, you can find a list of keyboard shortcuts that can be used in the editor.")),...this._createCategories(Array.from(t.values())),o]})}focus(){this.element.focus()}_createCategories(e){return e.map((e=>{const t=[(0,n.createElement)(document,"h3",{},e.label),...Array.from(e.groups.values()).map((e=>this._createGroup(e))).flat()];return e.description&&t.splice(1,0,(0,n.createElement)(document,"p",{},e.description)),(0,n.createElement)(document,"section",{},t)}))}_createGroup(e){const t=e.keystrokes.sort(((e,t)=>e.label.localeCompare(t.label))).map((e=>this._createGroupRow(e))).flat(),i=[(0,n.createElement)(document,"dl",{},t)];return e.label&&i.unshift((0,n.createElement)(document,"h4",{},e.label)),i}_createGroupRow(e){const t=this.locale.t,i=(0,n.createElement)(document,"dt"),o=(0,n.createElement)(document,"dd"),s="string"==typeof(a=e.keystroke)?[[a]]:"string"==typeof a[0]?[a]:a,r=[];var a;for(const e of s)r.push(e.map(oe).join(""));return i.innerHTML=e.label,o.innerHTML=r.join(", ")+(e.mayRequireFn&&n.env.isMac?` ${t("(may require <kbd>Fn</kbd>)")}`:""),[i,o]}}function oe(e){return(0,n.getEnvKeystrokeText)(e).split("+").map((e=>`<kbd>${e}</kbd>`)).join("+")}const se='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10 6.628a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"/><path d="M8.5 9.125a.3.3 0 0 0-.253-.296L5.11 8.327a.75.75 0 1 1 .388-1.449l4.04.716c.267.072.624.08.893.009l4.066-.724a.75.75 0 1 1 .388 1.45l-3.132.5a.3.3 0 0 0-.253.296v1.357a.3.3 0 0 0 .018.102l1.615 4.438a.75.75 0 0 1-1.41.513l-1.35-3.71a.3.3 0 0 0-.281-.197h-.209a.3.3 0 0 0-.282.198l-1.35 3.711a.75.75 0 0 1-1.41-.513l1.64-4.509a.3.3 0 0 0 .019-.103V9.125Z"/><path clip-rule="evenodd" d="M10 18.5a8.5 8.5 0 1 1 0-17 8.5 8.5 0 0 1 0 17Zm0 1.5c5.523 0 10-4.477 10-10S15.523 0 10 0 0 4.477 0 10s4.477 10 10 10Z"/></svg>';class re extends M.Plugin{constructor(){super(...arguments),this.contentView=null}static get requires(){return[Y]}static get pluginName(){return"AccessibilityHelp"}init(){const e=this.editor,t=e.locale.t;e.ui.componentFactory.add("accessibilityHelp",(()=>{const e=this._createButton(N);return e.set({tooltip:!0,withText:!1,label:t("Accessibility help")}),e})),e.ui.componentFactory.add("menuBar:accessibilityHelp",(()=>{const e=this._createButton(te);return e.label=t("Accessibility"),e})),e.keystrokes.set("Alt+0",((e,t)=>{this._toggleDialog(),t()})),this._setupRootLabels()}_createButton(e){const t=this.editor,i=t.plugins.get("Dialog"),n=new e(t.locale);return n.set({keystroke:"Alt+0",icon:se,isToggleable:!0}),n.on("execute",(()=>this._toggleDialog())),n.bind("isOn").to(i,"id",(e=>"accessibilityHelp"===e)),n}_setupRootLabels(){const e=this.editor,t=e.editing.view,i=e.t;function o(e,t){const o=`${t.getAttribute("aria-label")}. ${i("Press %0 for help.",[(0,n.getEnvKeystrokeText)("Alt+0")])}`;e.setAttribute("aria-label",o,t)}e.ui.on("ready",(()=>{t.change((e=>{for(const i of t.document.roots)o(e,i)})),e.on("addRoot",((i,n)=>{const s=e.editing.view.document.getRoot(n.rootName);t.change((e=>o(e,s)))}),{priority:"low"})}))}_toggleDialog(){const e=this.editor,t=e.plugins.get("Dialog"),i=e.locale.t;this.contentView||(this.contentView=new ne(e.locale,e.accessibility.keystrokeInfos)),"accessibilityHelp"===t.id?t.hide():t.show({id:"accessibilityHelp",className:"ck-accessibility-help-dialog",title:i("Accessibility help"),icon:se,hasCloseButton:!0,content:this.contentView})}}class ae extends o{constructor(e,t=[]){super(t),this.locale=e}get bodyCollectionContainer(){return this._bodyCollectionContainer}attachToDom(){this._bodyCollectionContainer=new a({tag:"div",attributes:{class:["ck","ck-reset_all","ck-body","ck-rounded-corners"],dir:this.locale.uiLanguageDirection,role:"application"},children:this}).render();let e=document.querySelector(".ck-body-wrapper");e||(e=(0,n.createElement)(document,"div",{class:"ck-body-wrapper"}),document.body.appendChild(e)),e.appendChild(this._bodyCollectionContainer)}detachFromDom(){super.destroy(),this._bodyCollectionContainer&&this._bodyCollectionContainer.remove();const e=document.querySelector(".ck-body-wrapper");e&&0==e.childElementCount&&e.remove()}}class le extends N{constructor(e){super(e),this.isToggleable=!0,this.toggleSwitchView=this._createToggleView(),this.extendTemplate({attributes:{class:"ck-switchbutton"}})}render(){super.render(),this.children.add(this.toggleSwitchView)}_createToggleView(){const e=new P;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),e}}class ce extends(ue(N)){}class de extends(ue(X)){}function ue(e){return class extends e{constructor(...e){super(...e),this.buttonView=this,this._fileInputView=new he(this.locale),this._fileInputView.bind("acceptedType").to(this),this._fileInputView.bind("allowMultipleFiles").to(this),this._fileInputView.delegate("done").to(this),this.on("execute",(()=>{this._fileInputView.open()})),this.extendTemplate({attributes:{class:"ck-file-dialog-button"}})}render(){super.render(),this.children.add(this._fileInputView)}}}class he extends P{constructor(e){super(e),this.set("acceptedType",void 0),this.set("allowMultipleFiles",!1);const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:t.to("acceptedType"),multiple:t.to("allowMultipleFiles")},on:{change:t.to((()=>{this.element&&this.element.files&&this.element.files.length&&this.fire("done",this.element.files),this.element.value=""}))}})}open(){this.element.click()}}const me='<svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"><path d="M.941 4.523a.75.75 0 1 1 1.06-1.06l3.006 3.005 3.005-3.005a.75.75 0 1 1 1.06 1.06l-3.549 3.55a.75.75 0 0 1-1.168-.136L.941 4.523z"/></svg>';class ge extends P{constructor(e,t){super(e);const i=this.bindTemplate;this.set("isCollapsed",!1),this.set("label",""),this.buttonView=this._createButtonView(),this.children=this.createCollection(),this.set("_collapsibleAriaLabelUid",void 0),t&&this.children.addMany(t),this.setTemplate({tag:"div",attributes:{class:["ck","ck-collapsible",i.if("isCollapsed","ck-collapsible_collapsed")]},children:[this.buttonView,{tag:"div",attributes:{class:["ck","ck-collapsible__children"],role:"region",hidden:i.if("isCollapsed","hidden"),"aria-labelledby":i.to("_collapsibleAriaLabelUid")},children:this.children}]})}render(){super.render(),this._collapsibleAriaLabelUid=this.buttonView.labelView.element.id}focus(){this.buttonView.focus()}_createButtonView(){const e=new N(this.locale),t=e.bindTemplate;return e.set({withText:!0,icon:me}),e.extendTemplate({attributes:{"aria-expanded":t.to("isOn",(e=>String(e)))}}),e.bind("label").to(this),e.bind("isOn").to(this,"isCollapsed",(e=>!e)),e.on("execute",(()=>{this.isCollapsed=!this.isCollapsed})),e}}function fe(e,t){const i=e.t,n={Black:i("Black"),"Dim grey":i("Dim grey"),Grey:i("Grey"),"Light grey":i("Light grey"),White:i("White"),Red:i("Red"),Orange:i("Orange"),Yellow:i("Yellow"),"Light green":i("Light green"),Green:i("Green"),Aquamarine:i("Aquamarine"),Turquoise:i("Turquoise"),"Light blue":i("Light blue"),Blue:i("Blue"),Purple:i("Purple")};return t.map((e=>{const t=n[e.label];return t&&t!=e.label&&(e.label=t),e}))}function pe(e){return e.map(be).filter((e=>!!e))}function be(e){return"string"==typeof e?{model:e,label:e,hasBorder:!1,view:{name:"span",styles:{color:e}}}:{model:e.color,label:e.label||e.color,hasBorder:void 0!==e.hasBorder&&e.hasBorder,view:{name:"span",styles:{color:`${e.color}`}}}}class we extends N{constructor(e){super(e);const t=this.bindTemplate;this.set("color",void 0),this.set("hasBorder",!1),this.icon='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path class="ck-icon__fill" d="M16.935 5.328a2 2 0 0 1 0 2.829l-7.778 7.778a2 2 0 0 1-2.829 0L3.5 13.107a1.999 1.999 0 1 1 2.828-2.829l.707.707a1 1 0 0 0 1.414 0l5.658-5.657a2 2 0 0 1 2.828 0z"/><path d="M14.814 6.035 8.448 12.4a1 1 0 0 1-1.414 0l-1.413-1.415A1 1 0 1 0 4.207 12.4l2.829 2.829a1 1 0 0 0 1.414 0l7.778-7.778a1 1 0 1 0-1.414-1.415z"/></svg>',this.extendTemplate({attributes:{style:{backgroundColor:t.to("color",(e=>n.env.isMediaForcedColors?null:e))},class:["ck","ck-color-grid__tile",t.if("hasBorder","ck-color-selector__color-tile_bordered")]}})}render(){super.render(),this.iconView.fillColor="hsl(0, 0%, 100%)"}}class ve extends P{constructor(e,t){super(e);const i=t&&t.colorDefinitions?t.colorDefinitions:[];this.columns=t&&t.columns?t.columns:5;const o={gridTemplateColumns:`repeat( ${this.columns}, 1fr)`};this.set("selectedColor",void 0),this.items=this.createCollection(),this.focusTracker=new n.FocusTracker,this.keystrokes=new n.KeystrokeHandler,this.items.on("add",((e,t)=>{t.isOn=t.color===this.selectedColor})),i.forEach((e=>{const t=new we;t.set({color:e.color,label:e.label,tooltip:!0,hasBorder:e.options.hasBorder}),t.on("execute",(()=>{this.fire("execute",{value:e.color,hasBorder:e.options.hasBorder,label:e.label})})),this.items.add(t)})),this.setTemplate({tag:"div",children:this.items,attributes:{class:["ck","ck-color-grid"],style:o}}),this.on("change:selectedColor",((e,t,i)=>{for(const e of this.items)e.isOn=e.color===i}))}focus(){this.items.length&&this.items.first.focus()}focusLast(){this.items.length&&this.items.last.focus()}render(){super.render();for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",((e,t)=>{this.focusTracker.add(t.element)})),this.items.on("remove",((e,t)=>{this.focusTracker.remove(t.element)})),this.keystrokes.listenTo(this.element),B({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:this.columns,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}}var _e=i(8156);const ye=function(e){var t,i,n=[],o=1;if("string"==typeof e)if(_e[e])n=_e[e].slice(),i="rgb";else if("transparent"===e)o=0,i="rgb",n=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(e)){var s=e.slice(1);o=1,(l=s.length)<=4?(n=[parseInt(s[0]+s[0],16),parseInt(s[1]+s[1],16),parseInt(s[2]+s[2],16)],4===l&&(o=parseInt(s[3]+s[3],16)/255)):(n=[parseInt(s[0]+s[1],16),parseInt(s[2]+s[3],16),parseInt(s[4]+s[5],16)],8===l&&(o=parseInt(s[6]+s[7],16)/255)),n[0]||(n[0]=0),n[1]||(n[1]=0),n[2]||(n[2]=0),i="rgb"}else if(t=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(e)){var r=t[1],a="rgb"===r;i=s=r.replace(/a$/,"");var l="cmyk"===s?4:"gray"===s?1:3;n=t[2].trim().split(/\s*[,\/]\s*|\s+/).map((function(e,t){if(/%$/.test(e))return t===l?parseFloat(e)/100:"rgb"===s?255*parseFloat(e)/100:parseFloat(e);if("h"===s[t]){if(/deg$/.test(e))return parseFloat(e);if(void 0!==ke[e])return ke[e]}return parseFloat(e)})),r===s&&n.push(1),o=a||void 0===n[l]?1:n[l],n=n.slice(0,l)}else e.length>10&&/[0-9](?:\s|\/)/.test(e)&&(n=e.match(/([0-9]+)/g).map((function(e){return parseFloat(e)})),i=e.match(/([a-z])/gi).join("").toLowerCase());else isNaN(e)?Array.isArray(e)||e.length?(n=[e[0],e[1],e[2]],i="rgb",o=4===e.length?e[3]:1):e instanceof Object&&(null!=e.r||null!=e.red||null!=e.R?(i="rgb",n=[e.r||e.red||e.R||0,e.g||e.green||e.G||0,e.b||e.blue||e.B||0]):(i="hsl",n=[e.h||e.hue||e.H||0,e.s||e.saturation||e.S||0,e.l||e.lightness||e.L||e.b||e.brightness]),o=e.a||e.alpha||e.opacity||1,null!=e.opacity&&(o/=100)):(i="rgb",n=[e>>>16,(65280&e)>>>8,255&e]);return{space:i,values:n,alpha:o}};var ke={red:0,orange:60,yellow:120,green:180,blue:240,purple:300},Ce=i(734),Ae=i.t(Ce,2);function Ee(e,t){if(!e)return"";const i=xe(e);if(!i)return"";if(i.space===t)return e;if(n=i,!Object.keys(Ae).includes(n.space))return"";var n;const o=Ae[i.space][t];return o?function(e,t){switch(t){case"hex":return`#${e}`;case"rgb":return`rgb( ${e[0]}, ${e[1]}, ${e[2]} )`;case"hsl":return`hsl( ${e[0]}, ${e[1]}%, ${e[2]}% )`;case"hwb":return`hwb( ${e[0]}, ${e[1]}, ${e[2]} )`;case"lab":return`lab( ${e[0]}% ${e[1]} ${e[2]} )`;case"lch":return`lch( ${e[0]}% ${e[1]} ${e[2]} )`;default:return""}}(o("hex"===i.space?i.hexValue:i.values),t):""}function xe(e){if(e.startsWith("#")){const t=ye(e);return{space:"hex",values:t.values,hexValue:e,alpha:t.alpha}}const t=ye(e);return t.space?t:null}var Te=i(2223);class Pe extends P{constructor(e,t){super(e);const i=`ck-labeled-field-view-${(0,n.uid)()}`,o=`ck-labeled-field-view-status-${(0,n.uid)()}`;this.fieldView=t(this,i,o),this.set("label",void 0),this.set("isEnabled",!0),this.set("isEmpty",!0),this.set("isFocused",!1),this.set("errorText",null),this.set("infoText",null),this.set("class",void 0),this.set("placeholder",void 0),this.labelView=this._createLabelView(i),this.statusView=this._createStatusView(o),this.fieldWrapperChildren=this.createCollection([this.fieldView,this.labelView]),this.bind("_statusText").to(this,"errorText",this,"infoText",((e,t)=>e||t));const s=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view",s.to("class"),s.if("isEnabled","ck-disabled",(e=>!e)),s.if("isEmpty","ck-labeled-field-view_empty"),s.if("isFocused","ck-labeled-field-view_focused"),s.if("placeholder","ck-labeled-field-view_placeholder"),s.if("errorText","ck-error")]},children:[{tag:"div",attributes:{class:["ck","ck-labeled-field-view__input-wrapper"]},children:this.fieldWrapperChildren},this.statusView]})}_createLabelView(e){const t=new ie(this.locale);return t.for=e,t.bind("text").to(this,"label"),t}_createStatusView(e){const t=new P(this.locale),i=this.bindTemplate;return t.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view__status",i.if("errorText","ck-labeled-field-view__status_error"),i.if("_statusText","ck-hidden",(e=>!e))],id:e,role:i.if("errorText","alert")},children:[{text:i.to("_statusText")}]}),t}focus(e){this.fieldView.focus(e)}}class Ie extends P{constructor(e){super(e),this.set("value",void 0),this.set("id",void 0),this.set("placeholder",void 0),this.set("tabIndex",void 0),this.set("isReadOnly",!1),this.set("hasError",!1),this.set("ariaDescribedById",void 0),this.set("ariaLabel",void 0),this.focusTracker=new n.FocusTracker,this.bind("isFocused").to(this.focusTracker),this.set("isEmpty",!0);const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck","ck-input",t.if("isFocused","ck-input_focused"),t.if("isEmpty","ck-input-text_empty"),t.if("hasError","ck-error")],id:t.to("id"),placeholder:t.to("placeholder"),tabindex:t.to("tabIndex"),readonly:t.to("isReadOnly"),"aria-invalid":t.if("hasError",!0),"aria-describedby":t.to("ariaDescribedById"),"aria-label":t.to("ariaLabel")},on:{input:t.to(((...e)=>{this.fire("input",...e),this._updateIsEmpty()})),change:t.to(this._updateIsEmpty.bind(this))}})}render(){super.render(),this.focusTracker.add(this.element),this._setDomElementValue(this.value),this._updateIsEmpty(),this.on("change:value",((e,t,i)=>{this._setDomElementValue(i),this._updateIsEmpty()}))}destroy(){super.destroy(),this.focusTracker.destroy()}select(){this.element.select()}focus(){this.element.focus()}reset(){this.value=this.element.value="",this._updateIsEmpty()}_updateIsEmpty(){this.isEmpty=!this.element.value}_setDomElementValue(e){this.element.value=e||0===e?e:""}}class Se extends Ie{constructor(e){super(e),this.set("inputMode","text");const t=this.bindTemplate;this.extendTemplate({attributes:{inputmode:t.to("inputMode")}})}}class Ve extends Se{constructor(e){super(e),this.extendTemplate({attributes:{type:"text",class:["ck-input-text"]}})}}class Re extends Se{constructor(e,{min:t,max:i,step:n}={}){super(e);const o=this.bindTemplate;this.set("min",t),this.set("max",i),this.set("step",n),this.extendTemplate({attributes:{type:"number",class:["ck-input-number"],min:o.to("min"),max:o.to("max"),step:o.to("step")}})}}class Be extends Ie{constructor(e){super(e),this._isUpdateAutoGrowHeightPending=!1;const t=(0,n.toUnit)("px");this.set("minRows",2),this.set("maxRows",5),this.set("_height",null),this.set("resize","none"),this._resizeObserver=null,this.on("change:minRows",this._validateMinMaxRows.bind(this)),this.on("change:maxRows",this._validateMinMaxRows.bind(this));const i=this.bindTemplate;this.template.tag="textarea",this.extendTemplate({attributes:{class:["ck-textarea"],style:{height:i.to("_height",(e=>e?t(e):null)),resize:i.to("resize")},rows:i.to("minRows")}})}render(){super.render();let e=!1;this.on("input",(()=>{this._updateAutoGrowHeight(!0),this.fire("update")})),this.on("change:value",(()=>{n.global.window.requestAnimationFrame((()=>{(0,n.isVisible)(this.element)?(this._updateAutoGrowHeight(),this.fire("update")):this._isUpdateAutoGrowHeightPending=!0}))})),this._resizeObserver=new n.ResizeObserver(this.element,(t=>{const i=!!t.contentRect.width&&!!t.contentRect.height;!e&&i&&this._isUpdateAutoGrowHeightPending&&n.global.window.requestAnimationFrame((()=>{this._updateAutoGrowHeight(),this.fire("update")})),e=i}))}destroy(){this._resizeObserver&&this._resizeObserver.destroy()}reset(){super.reset(),this._updateAutoGrowHeight(),this.fire("update")}_updateAutoGrowHeight(e){const t=this.element;if(!t.offsetParent)return void(this._isUpdateAutoGrowHeightPending=!0);this._isUpdateAutoGrowHeightPending=!1;const i=Me(t,"1"),o=Me(t,t.value),s=i.ownerDocument.defaultView.getComputedStyle(i),r=parseFloat(s.paddingTop)+parseFloat(s.paddingBottom),a=(0,n.getBorderWidths)(i),l=parseFloat(s.lineHeight),c=a.top+a.bottom,d=new n.Rect(i).height,u=Math.round((o.scrollHeight-r)/l),h=this.maxRows*l+r+c,m=1===u?d:this.minRows*l+r+c;this._height=Math.min(Math.max(Math.max(u,this.minRows)*l+r+c,m),h),e&&(t.scrollTop=t.scrollHeight),i.remove(),o.remove()}_validateMinMaxRows(){if(this.minRows>this.maxRows)throw new n.CKEditorError("ui-textarea-view-min-rows-greater-than-max-rows",{textareaView:this,minRows:this.minRows,maxRows:this.maxRows})}}function Me(e,t){const i=e.cloneNode();return i.style.position="absolute",i.style.top="-99999px",i.style.left="-99999px",i.style.height="auto",i.style.overflow="hidden",i.style.width=e.ownerDocument.defaultView.getComputedStyle(e).width,i.tabIndex=-1,i.rows=1,i.value=t,e.parentNode.insertBefore(i,e),i}class Oe extends P{constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!1),this.set("position","se"),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-dropdown__panel",t.to("position",(e=>`ck-dropdown__panel_${e}`)),t.if("isVisible","ck-dropdown__panel-visible")],tabindex:"-1"},children:this.children,on:{selectstart:t.to((e=>{"input"!==e.target.tagName.toLocaleLowerCase()&&e.preventDefault()}))}})}focus(){if(this.children.length){const e=this.children.first;"function"==typeof e.focus?e.focus():(0,n.logWarning)("ui-dropdown-panel-focus-child-missing-focus",{childView:this.children.first,dropdownPanel:this})}}focusLast(){if(this.children.length){const e=this.children.last;"function"==typeof e.focusLast?e.focusLast():e.focus()}}}class Le extends P{constructor(e,t,i){super(e);const o=this.bindTemplate;this.buttonView=t,this.panelView=i,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("class",void 0),this.set("id",void 0),this.set("panelPosition","auto"),this.panelView.bind("isVisible").to(this,"isOpen"),this.keystrokes=new n.KeystrokeHandler,this.focusTracker=new n.FocusTracker,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",o.to("class"),o.if("isEnabled","ck-disabled",(e=>!e))],id:o.to("id"),"aria-describedby":o.to("ariaDescribedById")},children:[t,i]}),t.extendTemplate({attributes:{class:["ck-dropdown__button"],"data-cke-tooltip-disabled":o.to("isOpen")}})}render(){super.render(),this.focusTracker.add(this.buttonView.element),this.focusTracker.add(this.panelView.element),this.listenTo(this.buttonView,"open",(()=>{this.isOpen=!this.isOpen})),this.on("change:isOpen",((e,t,i)=>{if(i)if("auto"===this.panelPosition){const e=Le._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions});this.panelView.position=e?e.name:this._panelPositions[0].name}else this.panelView.position=this.panelPosition})),this.keystrokes.listenTo(this.element);const e=(e,t)=>{this.isOpen&&(this.isOpen=!1,t())};this.keystrokes.set("arrowdown",((e,t)=>{this.buttonView.isEnabled&&!this.isOpen&&(this.isOpen=!0,t())})),this.keystrokes.set("arrowright",((e,t)=>{this.isOpen&&t()})),this.keystrokes.set("arrowleft",e),this.keystrokes.set("esc",e)}focus(){this.buttonView.focus()}get _panelPositions(){const{south:e,north:t,southEast:i,southWest:n,northEast:o,northWest:s,southMiddleEast:r,southMiddleWest:a,northMiddleEast:l,northMiddleWest:c}=Le.defaultPanelPositions;return"rtl"!==this.locale.uiLanguageDirection?[i,n,r,a,e,o,s,l,c,t]:[n,i,a,r,e,s,o,c,l,t]}}Le.defaultPanelPositions={south:(e,t)=>({top:e.bottom,left:e.left-(t.width-e.width)/2,name:"s"}),southEast:e=>({top:e.bottom,left:e.left,name:"se"}),southWest:(e,t)=>({top:e.bottom,left:e.left-t.width+e.width,name:"sw"}),southMiddleEast:(e,t)=>({top:e.bottom,left:e.left-(t.width-e.width)/4,name:"sme"}),southMiddleWest:(e,t)=>({top:e.bottom,left:e.left-3*(t.width-e.width)/4,name:"smw"}),north:(e,t)=>({top:e.top-t.height,left:e.left-(t.width-e.width)/2,name:"n"}),northEast:(e,t)=>({top:e.top-t.height,left:e.left,name:"ne"}),northWest:(e,t)=>({top:e.top-t.height,left:e.left-t.width+e.width,name:"nw"}),northMiddleEast:(e,t)=>({top:e.top-t.height,left:e.left-(t.width-e.width)/4,name:"nme"}),northMiddleWest:(e,t)=>({top:e.top-t.height,left:e.left-3*(t.width-e.width)/4,name:"nmw"})},Le._getOptimalPosition=n.getOptimalPosition;const Fe=Le;class Ne extends N{constructor(e){super(e),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{"aria-haspopup":!0,"aria-expanded":this.bindTemplate.to("isOn",(e=>String(e)))}}),this.delegate("execute").to(this,"open")}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new L;return e.content=me,e.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),e}}class De extends P{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}})}}class ze extends P{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__line-break"]}})}}function We(e){if(Array.isArray(e))return{items:e,removeItems:[]};const t={items:[],removeItems:[]};return e?{...t,...e}:t}const He=(()=>({alignLeft:M.icons.alignLeft,bold:M.icons.bold,importExport:M.icons.importExport,paragraph:M.icons.paragraph,plus:M.icons.plus,text:M.icons.text,threeVerticalDots:M.icons.threeVerticalDots,pilcrow:M.icons.pilcrow,dragIndicator:M.icons.dragIndicator}))();class Ue extends P{constructor(e,t){super(e);const i=this.bindTemplate,o=this.t;this.options=t||{},this.set("ariaLabel",o("Editor toolbar")),this.set("maxWidth","auto"),this.items=this.createCollection(),this.focusTracker=new n.FocusTracker,this.keystrokes=new n.KeystrokeHandler,this.set("class",void 0),this.set("isCompact",!1),this.itemsView=new $e(e),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection();const s="rtl"===e.uiLanguageDirection;this._focusCycler=new W({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:[s?"arrowright":"arrowleft","arrowup"],focusNext:[s?"arrowleft":"arrowright","arrowdown"]}});const r=["ck","ck-toolbar",i.to("class"),i.if("isCompact","ck-toolbar_compact")];var a;this.options.shouldGroupWhenFull&&this.options.isFloating&&r.push("ck-toolbar_floating"),this.setTemplate({tag:"div",attributes:{class:r,role:"toolbar","aria-label":i.to("ariaLabel"),style:{maxWidth:i.to("maxWidth")},tabindex:-1},children:this.children,on:{mousedown:(a=this,a.bindTemplate.to((e=>{e.target===a.element&&e.preventDefault()})))}}),this._behavior=this.options.shouldGroupWhenFull?new qe(this):new je(this)}render(){super.render(),this.focusTracker.add(this.element);for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",((e,t)=>{this.focusTracker.add(t.element)})),this.items.on("remove",((e,t)=>{this.focusTracker.remove(t.element)})),this.keystrokes.listenTo(this.element),this._behavior.render(this)}destroy(){return this._behavior.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy(),super.destroy()}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}fillFromConfig(e,t,i){this.items.addMany(this._buildItemsFromConfig(e,t,i))}_buildItemsFromConfig(e,t,i){const n=We(e),o=i||n.removeItems;return this._cleanItemsConfiguration(n.items,t,o).map((e=>(0,r.A)(e)?this._createNestedToolbarDropdown(e,t,o):"|"===e?new De:"-"===e?new ze:t.create(e))).filter((e=>!!e))}_cleanItemsConfiguration(e,t,i){const o=e.filter(((e,o,s)=>"|"===e||-1===i.indexOf(e)&&("-"===e?!this.options.shouldGroupWhenFull||((0,n.logWarning)("toolbarview-line-break-ignored-when-grouping-items",s),!1):!(!(0,r.A)(e)&&!t.has(e)&&((0,n.logWarning)("toolbarview-item-unavailable",{item:e}),1)))));return this._cleanSeparatorsAndLineBreaks(o)}_cleanSeparatorsAndLineBreaks(e){const t=e=>"-"!==e&&"|"!==e,i=e.length,n=e.findIndex(t);if(-1===n)return[];const o=i-e.slice().reverse().findIndex(t);return e.slice(n,o).filter(((e,i,n)=>!!t(e)||!(i>0&&n[i-1]===e)))}_createNestedToolbarDropdown(e,t,i){let{label:o,icon:s,items:r,tooltip:a=!0,withText:l=!1}=e;if(r=this._cleanItemsConfiguration(r,t,i),!r.length)return null;const c=Ye(this.locale);return o||(0,n.logWarning)("toolbarview-nested-toolbar-dropdown-missing-label",e),c.class="ck-toolbar__nested-toolbar-dropdown",c.buttonView.set({label:o,tooltip:a,withText:!!l}),!1!==s?c.buttonView.icon=He[s]||s||M.icons.threeVerticalDots:c.buttonView.withText=!0,Xe(c,(()=>c.toolbarView._buildItemsFromConfig(r,t,i))),c}}class $e extends P{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children})}}class je{constructor(e){const t=e.bindTemplate;e.set("isVertical",!1),e.itemsView.children.bindTo(e.items).using((e=>e)),e.focusables.bindTo(e.items).using((e=>U(e)?e:null)),e.extendTemplate({attributes:{class:[t.if("isVertical","ck-toolbar_vertical")]}})}render(){}destroy(){}}class qe{constructor(e){this.resizeObserver=null,this.cachedPadding=null,this.shouldUpdateGroupingOnNextResize=!1,this.view=e,this.viewChildren=e.children,this.viewFocusables=e.focusables,this.viewItemsView=e.itemsView,this.viewFocusTracker=e.focusTracker,this.viewLocale=e.locale,this.ungroupedItems=e.createCollection(),this.groupedItems=e.createCollection(),this.groupedItemsDropdown=this._createGroupedItemsDropdown(),e.itemsView.children.bindTo(this.ungroupedItems).using((e=>e)),this.ungroupedItems.on("change",this._updateFocusCyclableItems.bind(this)),e.children.on("change",this._updateFocusCyclableItems.bind(this)),e.items.on("change",((e,t)=>{const i=t.index,n=Array.from(t.added);for(const e of t.removed)i>=this.ungroupedItems.length?this.groupedItems.remove(e):this.ungroupedItems.remove(e);for(let e=i;e<i+n.length;e++){const t=n[e-i];e>this.ungroupedItems.length?this.groupedItems.add(t,e-this.ungroupedItems.length):this.ungroupedItems.add(t,e)}this._updateGrouping()})),e.extendTemplate({attributes:{class:["ck-toolbar_grouping"]}})}render(e){this.viewElement=e.element,this._enableGroupingOnResize(),this._enableGroupingOnMaxWidthChange(e)}destroy(){this.groupedItemsDropdown.destroy(),this.resizeObserver.destroy()}_updateGrouping(){if(!this.viewElement.ownerDocument.body.contains(this.viewElement))return;if(!(0,n.isVisible)(this.viewElement))return void(this.shouldUpdateGroupingOnNextResize=!0);const e=this.groupedItems.length;let t;for(;this._areItemsOverflowing;)this._groupLastItem(),t=!0;if(!t&&this.groupedItems.length){for(;this.groupedItems.length&&!this._areItemsOverflowing;)this._ungroupFirstItem();this._areItemsOverflowing&&this._groupLastItem()}this.groupedItems.length!==e&&this.view.fire("groupedItemsUpdate")}get _areItemsOverflowing(){if(!this.ungroupedItems.length)return!1;const e=this.viewElement,t=this.viewLocale.uiLanguageDirection,i=new n.Rect(e.lastChild),o=new n.Rect(e);if(!this.cachedPadding){const i=n.global.window.getComputedStyle(e),o="ltr"===t?"paddingRight":"paddingLeft";this.cachedPadding=Number.parseInt(i[o])}return"ltr"===t?i.right>o.right-this.cachedPadding:i.left<o.left+this.cachedPadding}_enableGroupingOnResize(){let e;this.resizeObserver=new n.ResizeObserver(this.viewElement,(t=>{e&&e===t.contentRect.width&&!this.shouldUpdateGroupingOnNextResize||(this.shouldUpdateGroupingOnNextResize=!1,this._updateGrouping(),e=t.contentRect.width)})),this._updateGrouping()}_enableGroupingOnMaxWidthChange(e){e.on("change:maxWidth",(()=>{this._updateGrouping()}))}_groupLastItem(){this.groupedItems.length||(this.viewChildren.add(new De),this.viewChildren.add(this.groupedItemsDropdown),this.viewFocusTracker.add(this.groupedItemsDropdown.element)),this.groupedItems.add(this.ungroupedItems.remove(this.ungroupedItems.last),0)}_ungroupFirstItem(){this.ungroupedItems.add(this.groupedItems.remove(this.groupedItems.first)),this.groupedItems.length||(this.viewChildren.remove(this.groupedItemsDropdown),this.viewChildren.remove(this.viewChildren.last),this.viewFocusTracker.remove(this.groupedItemsDropdown.element))}_createGroupedItemsDropdown(){const e=this.viewLocale,t=e.t,i=Ye(e);return i.class="ck-toolbar__grouped-dropdown",i.panelPosition="ltr"===e.uiLanguageDirection?"sw":"se",Xe(i,this.groupedItems),i.buttonView.set({label:t("Show more items"),tooltip:!0,tooltipPosition:"rtl"===e.uiLanguageDirection?"se":"sw",icon:M.icons.threeVerticalDots}),i}_updateFocusCyclableItems(){this.viewFocusables.clear(),this.ungroupedItems.map((e=>{U(e)&&this.viewFocusables.add(e)})),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}}class Ke extends P{constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!0),this.children=this.createCollection(),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__item",t.if("isVisible","ck-hidden",(e=>!e))],role:"presentation"},children:this.children})}focus(){this.children.first&&this.children.first.focus()}}class Ge extends P{constructor(e){super(e),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}})}}class Ze extends P{constructor(e,t=new ie){super(e);const i=this.bindTemplate,n=new Je(e);this.set({label:"",isVisible:!0}),this.labelView=t,this.labelView.bind("text").to(this,"label"),this.children=this.createCollection(),this.children.addMany([this.labelView,n]),n.set({role:"group",ariaLabelledBy:t.id}),n.focusTracker.destroy(),n.keystrokes.destroy(),this.items=n.items,this.setTemplate({tag:"li",attributes:{role:"presentation",class:["ck","ck-list__group",i.if("isVisible","ck-hidden",(e=>!e))]},children:this.children})}focus(){if(this.items){const e=this.items.find((e=>!(e instanceof Ge)));e&&e.focus()}}}class Je extends P{constructor(e){super(e),this._listItemGroupToChangeListeners=new WeakMap;const t=this.bindTemplate;this.focusables=new o,this.items=this.createCollection(),this.focusTracker=new n.FocusTracker,this.keystrokes=new n.KeystrokeHandler,this._focusCycler=new W({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowup",focusNext:"arrowdown"}}),this.set("ariaLabel",void 0),this.set("ariaLabelledBy",void 0),this.set("role",void 0),this.setTemplate({tag:"ul",attributes:{class:["ck","ck-reset","ck-list"],role:t.to("role"),"aria-label":t.to("ariaLabel"),"aria-labelledby":t.to("ariaLabelledBy")},children:this.items})}render(){super.render();for(const e of this.items)e instanceof Ze?this._registerFocusableItemsGroup(e):e instanceof Ke&&this._registerFocusableListItem(e);this.items.on("change",((e,t)=>{for(const e of t.removed)e instanceof Ze?this._deregisterFocusableItemsGroup(e):e instanceof Ke&&this._deregisterFocusableListItem(e);for(const e of Array.from(t.added).reverse())e instanceof Ze?this._registerFocusableItemsGroup(e,t.index):this._registerFocusableListItem(e,t.index)})),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}focusFirst(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}_registerFocusableListItem(e,t){this.focusTracker.add(e.element),this.focusables.add(e,t)}_deregisterFocusableListItem(e){this.focusTracker.remove(e.element),this.focusables.remove(e)}_getOnGroupItemsChangeCallback(e){return(t,i)=>{for(const e of i.removed)this._deregisterFocusableListItem(e);for(const t of Array.from(i.added).reverse())this._registerFocusableListItem(t,this.items.getIndex(e)+i.index)}}_registerFocusableItemsGroup(e,t){Array.from(e.items).forEach(((e,i)=>{const n=void 0!==t?t+i:void 0;this._registerFocusableListItem(e,n)}));const i=this._getOnGroupItemsChangeCallback(e);this._listItemGroupToChangeListeners.set(e,i),e.items.on("change",i)}_deregisterFocusableItemsGroup(e){for(const t of e.items)this._deregisterFocusableListItem(t);e.items.off("change",this._listItemGroupToChangeListeners.get(e)),this._listItemGroupToChangeListeners.delete(e)}}class Qe extends P{constructor(e,t){super(e);const i=this.bindTemplate;this.set("class",void 0),this.set("labelStyle",void 0),this.set("icon",void 0),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isToggleable",!1),this.set("isVisible",!0),this.set("keystroke",void 0),this.set("withKeystroke",!1),this.set("label",void 0),this.set("tabindex",-1),this.set("tooltip",!1),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.children=this.createCollection(),this.actionView=this._createActionView(t),this.arrowView=this._createArrowView(),this.keystrokes=new n.KeystrokeHandler,this.focusTracker=new n.FocusTracker,this.setTemplate({tag:"div",attributes:{class:["ck","ck-splitbutton",i.to("class"),i.if("isVisible","ck-hidden",(e=>!e)),this.arrowView.bindTemplate.if("isOn","ck-splitbutton_open")]},children:this.children})}render(){super.render(),this.children.add(this.actionView),this.children.add(this.arrowView),this.focusTracker.add(this.actionView.element),this.focusTracker.add(this.arrowView.element),this.keystrokes.listenTo(this.element),this.keystrokes.set("arrowright",((e,t)=>{this.focusTracker.focusedElement===this.actionView.element&&(this.arrowView.focus(),t())})),this.keystrokes.set("arrowleft",((e,t)=>{this.focusTracker.focusedElement===this.arrowView.element&&(this.actionView.focus(),t())}))}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.actionView.focus()}_createActionView(e){const t=e||new N;return e||t.bind("icon","isEnabled","isOn","isToggleable","keystroke","label","tabindex","tooltip","tooltipPosition","type","withText").to(this),t.extendTemplate({attributes:{class:"ck-splitbutton__action"}}),t.delegate("execute").to(this),t}_createArrowView(){const e=new N,t=e.bindTemplate;return e.icon=me,e.extendTemplate({attributes:{class:["ck-splitbutton__arrow"],"data-cke-tooltip-disabled":t.to("isOn"),"aria-haspopup":!0,"aria-expanded":t.to("isOn",(e=>String(e)))}}),e.bind("isEnabled").to(this),e.bind("label").to(this),e.bind("tooltip").to(this),e.delegate("execute").to(this,"open"),e}}function Ye(e,t=Ne){const i="function"==typeof t?new t(e):t,o=new Oe(e),s=new Fe(e,i,o);return i.bind("isEnabled").to(s),i instanceof Qe?i.arrowView.bind("isOn").to(s,"isOpen"):i.bind("isOn").to(s,"isOpen"),function(e){(function(e){e.on("render",(()=>{I({emitter:e,activator:()=>e.isOpen,callback:()=>{e.isOpen=!1},contextElements:()=>[e.element,...e.focusTracker._elements]})}))})(e),function(e){e.on("execute",(t=>{t.source instanceof le||(e.isOpen=!1)}))}(e),function(e){e.focusTracker.on("change:isFocused",((t,i,n)=>{e.isOpen&&!n&&(e.isOpen=!1)}))}(e),function(e){e.keystrokes.set("arrowdown",((t,i)=>{e.isOpen&&(e.panelView.focus(),i())})),e.keystrokes.set("arrowup",((t,i)=>{e.isOpen&&(e.panelView.focusLast(),i())}))}(e),function(e){e.on("change:isOpen",((t,i,o)=>{if(o)return;const s=e.panelView.element;s&&s.contains(n.global.document.activeElement)&&e.buttonView.focus()}))}(e),function(e){e.on("change:isOpen",((t,i,n)=>{n&&e.panelView.focus()}),{priority:"low"})}(e)}(s),s}function Xe(e,t,i={}){e.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),e.isOpen?et(e,t,i):e.once("change:isOpen",(()=>et(e,t,i)),{priority:"highest"}),i.enableActiveItemFocusOnDropdownOpen&&nt(e,(()=>e.toolbarView.items.find((e=>e.isOn))))}function et(e,t,i){const n=e.locale,s=n.t,r=e.toolbarView=new Ue(n),a="function"==typeof t?t():t;r.ariaLabel=i.ariaLabel||s("Dropdown toolbar"),i.maxWidth&&(r.maxWidth=i.maxWidth),i.class&&(r.class=i.class),i.isCompact&&(r.isCompact=i.isCompact),i.isVertical&&(r.isVertical=!0),a instanceof o?r.items.bindTo(a).using((e=>e)):r.items.addMany(a),e.panelView.children.add(r),r.items.delegate("execute").to(e)}function tt(e,t,i={}){e.isOpen?it(e,t,i):e.once("change:isOpen",(()=>it(e,t,i)),{priority:"highest"}),nt(e,(()=>e.listView.items.find((e=>e instanceof Ke&&e.children.first.isOn))))}function it(e,t,i){const n=e.locale,o=e.listView=new Je(n),s="function"==typeof t?t():t;o.ariaLabel=i.ariaLabel,o.role=i.role,ot(e,o.items,s,n),e.panelView.children.add(o),o.items.delegate("execute").to(e)}function nt(e,t){e.on("change:isOpen",(()=>{if(!e.isOpen)return;const i=t();i&&("function"==typeof i.focus?i.focus():(0,n.logWarning)("ui-dropdown-focus-child-on-open-child-missing-focus",{view:i}))}),{priority:n.priorities.low-10})}function ot(e,t,i,n){t.on("change",(()=>{const e=[...t].reduce(((e,t)=>(t instanceof Ke&&t.children.first instanceof X&&e.push(t.children.first),e)),[]),i=e.some((e=>e.isToggleable));e.forEach((e=>{e.hasCheckSpace=i}))})),t.bindTo(i).using((t=>{if("separator"===t.type)return new Ge(n);if("group"===t.type){const i=new Ze(n);return i.set({label:t.label}),ot(e,i.items,t.items,n),i.items.delegate("execute").to(e),i}if("button"===t.type||"switchbutton"===t.type){const e="menuitemcheckbox"===t.model.role||"menuitemradio"===t.model.role,i=new Ke(n);let o;return"button"===t.type?(o=new X(n),o.set({isToggleable:e})):o=new le(n),o.bind(...Object.keys(t.model)).to(t.model),o.delegate("execute").to(i),i.children.add(o),i}return null}))}const st=(e,t,i)=>{const n=new Ve(e.locale);return n.set({id:t,ariaDescribedById:i}),n.bind("isReadOnly").to(e,"isEnabled",(e=>!e)),n.bind("hasError").to(e,"errorText",(e=>!!e)),n.on("input",(()=>{e.errorText=null})),e.bind("isEmpty","isFocused","placeholder").to(n),n},rt=(e,t,i)=>{const n=new Re(e.locale);return n.set({id:t,ariaDescribedById:i,inputMode:"numeric"}),n.bind("isReadOnly").to(e,"isEnabled",(e=>!e)),n.bind("hasError").to(e,"errorText",(e=>!!e)),n.on("input",(()=>{e.errorText=null})),e.bind("isEmpty","isFocused","placeholder").to(n),n},at=(e,t,i)=>{const n=new Be(e.locale);return n.set({id:t,ariaDescribedById:i}),n.bind("isReadOnly").to(e,"isEnabled",(e=>!e)),n.bind("hasError").to(e,"errorText",(e=>!!e)),n.on("input",(()=>{e.errorText=null})),e.bind("isEmpty","isFocused","placeholder").to(n),n},lt=(e,t,i)=>{const n=Ye(e.locale);return n.set({id:t,ariaDescribedById:i}),n.bind("isEnabled").to(e),n},ct=(e,t=0,i=1)=>e>i?i:e<t?t:e,dt=(e,t=0,i=Math.pow(10,t))=>Math.round(i*e)/i,ut=(Math.PI,e=>("#"===e[0]&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?dt(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?dt(parseInt(e.substring(6,8),16)/255,2):1})),ht=e=>{const{h:t,s:i,l:n}=(({h:e,s:t,v:i,a:n})=>{const o=(200-t)*i/100;return{h:dt(e),s:dt(o>0&&o<200?t*i/100/(o<=100?o:200-o)*100:0),l:dt(o/2),a:dt(n,2)}})(e);return`hsl(${t}, ${i}%, ${n}%)`},mt=e=>{const t=e.toString(16);return t.length<2?"0"+t:t},gt=(e,t)=>{if(e===t)return!0;for(const i in e)if(e[i]!==t[i])return!1;return!0},ft={},pt=e=>{let t=ft[e];return t||(t=document.createElement("template"),t.innerHTML=e,ft[e]=t),t},bt=(e,t,i)=>{e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:i}))};let wt=!1;const vt=e=>"touches"in e,_t=(e,t)=>{const i=vt(t)?t.touches[0]:t,n=e.el.getBoundingClientRect();bt(e.el,"move",e.getMove({x:ct((i.pageX-(n.left+window.pageXOffset))/n.width),y:ct((i.pageY-(n.top+window.pageYOffset))/n.height)}))};class yt{constructor(e,t,i,n){const o=pt(`<div role="slider" tabindex="0" part="${t}" ${i}><div part="${t}-pointer"></div></div>`);e.appendChild(o.content.cloneNode(!0));const s=e.querySelector(`[part=${t}]`);s.addEventListener("mousedown",this),s.addEventListener("touchstart",this),s.addEventListener("keydown",this),this.el=s,this.xy=n,this.nodes=[s.firstChild,s]}set dragging(e){const t=e?document.addEventListener:document.removeEventListener;t(wt?"touchmove":"mousemove",this),t(wt?"touchend":"mouseup",this)}handleEvent(e){switch(e.type){case"mousedown":case"touchstart":if(e.preventDefault(),!(e=>!(wt&&!vt(e)||(wt||(wt=vt(e)),0)))(e)||!wt&&0!=e.button)return;this.el.focus(),_t(this,e),this.dragging=!0;break;case"mousemove":case"touchmove":e.preventDefault(),_t(this,e);break;case"mouseup":case"touchend":this.dragging=!1;break;case"keydown":((e,t)=>{const i=t.keyCode;i>40||e.xy&&i<37||i<33||(t.preventDefault(),bt(e.el,"move",e.getMove({x:39===i?.01:37===i?-.01:34===i?.05:33===i?-.05:35===i?1:36===i?-1:0,y:40===i?.01:38===i?-.01:0},!0)))})(this,e)}}style(e){e.forEach(((e,t)=>{for(const i in e)this.nodes[t].style.setProperty(i,e[i])}))}}class kt extends yt{constructor(e){super(e,"hue",'aria-label="Hue" aria-valuemin="0" aria-valuemax="360"',!1)}update({h:e}){this.h=e,this.style([{left:e/360*100+"%",color:ht({h:e,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuenow",`${dt(e)}`)}getMove(e,t){return{h:t?ct(this.h+360*e.x,0,360):360*e.x}}}class Ct extends yt{constructor(e){super(e,"saturation",'aria-label="Color"',!0)}update(e){this.hsva=e,this.style([{top:100-e.v+"%",left:`${e.s}%`,color:ht(e)},{"background-color":ht({h:e.h,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuetext",`Saturation ${dt(e.s)}%, Brightness ${dt(e.v)}%`)}getMove(e,t){return{s:t?ct(this.hsva.s+100*e.x,0,100):100*e.x,v:t?ct(this.hsva.v-100*e.y,0,100):Math.round(100-100*e.y)}}}const At=Symbol("same"),Et=Symbol("color"),xt=Symbol("hsva"),Tt=Symbol("update"),Pt=Symbol("parts"),It=Symbol("css"),St=Symbol("sliders");class Vt extends HTMLElement{static get observedAttributes(){return["color"]}get[It](){return[':host{display:flex;flex-direction:column;position:relative;width:200px;height:200px;user-select:none;-webkit-user-select:none;cursor:default}:host([hidden]){display:none!important}[role=slider]{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;outline:0}[role=slider]:last-child{border-radius:0 0 8px 8px}[part$=pointer]{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;display:flex;place-content:center center;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}[part$=pointer]::after{content:"";width:100%;height:100%;border-radius:inherit;background-color:currentColor}[role=slider]:focus [part$=pointer]{transform:translate(-50%,-50%) scale(1.1)}',"[part=hue]{flex:0 0 24px;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}[part=hue-pointer]{top:50%;z-index:2}","[part=saturation]{flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,rgba(255,255,255,0));box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}[part=saturation-pointer]{z-index:3}"]}get[St](){return[Ct,kt]}get color(){return this[Et]}set color(e){if(!this[At](e)){const t=this.colorModel.toHsva(e);this[Tt](t),this[Et]=e}}constructor(){super();const e=pt(`<style>${this[It].join("")}</style>`),t=this.attachShadow({mode:"open"});t.appendChild(e.content.cloneNode(!0)),t.addEventListener("move",this),this[Pt]=this[St].map((e=>new e(t)))}connectedCallback(){if(this.hasOwnProperty("color")){const e=this.color;delete this.color,this.color=e}else this.color||(this.color=this.colorModel.defaultColor)}attributeChangedCallback(e,t,i){const n=this.colorModel.fromAttr(i);this[At](n)||(this.color=n)}handleEvent(e){const t=this[xt],i={...t,...e.detail};let n;this[Tt](i),gt(i,t)||this[At](n=this.colorModel.fromHsva(i))||(this[Et]=n,bt(this,"color-changed",{value:n}))}[At](e){return this.color&&this.colorModel.equal(e,this.color)}[Tt](e){this[xt]=e,this[Pt].forEach((t=>t.update(e)))}}const Rt={defaultColor:"#000",toHsva:e=>(({r:e,g:t,b:i,a:n})=>{const o=Math.max(e,t,i),s=o-Math.min(e,t,i),r=s?o===e?(t-i)/s:o===t?2+(i-e)/s:4+(e-t)/s:0;return{h:dt(60*(r<0?r+6:r)),s:dt(o?s/o*100:0),v:dt(o/255*100),a:n}})(ut(e)),fromHsva:({h:e,s:t,v:i})=>(({r:e,g:t,b:i,a:n})=>{const o=n<1?mt(dt(255*n)):"";return"#"+mt(e)+mt(t)+mt(i)+o})((({h:e,s:t,v:i,a:n})=>{e=e/360*6,t/=100,i/=100;const o=Math.floor(e),s=i*(1-t),r=i*(1-(e-o)*t),a=i*(1-(1-e+o)*t),l=o%6;return{r:dt(255*[i,r,s,s,a,i][l]),g:dt(255*[a,i,i,r,s,s][l]),b:dt(255*[s,s,a,i,i,r][l]),a:dt(n,2)}})({h:e,s:t,v:i,a:1})),equal:(e,t)=>e.toLowerCase()===t.toLowerCase()||gt(ut(e),ut(t)),fromAttr:e=>e};class Bt extends Vt{get colorModel(){return Rt}}class Mt extends P{constructor(e,t={}){super(e),this.set({color:"",_hexColor:""}),this.hexInputRow=this._createInputRow();const i=this.createCollection();t.hideInput||i.add(this.hexInputRow),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker"],tabindex:-1},children:i}),this._config=t,this._debounceColorPickerEvent=(0,Te.A)((e=>{this.set("color",e),this.fire("colorSelected",{color:this.color})}),150,{leading:!0}),this.on("set:color",((e,t,i)=>{e.return=Ee(i,this._config.format||"hsl")})),this.on("change:color",(()=>{this._hexColor=Ot(this.color)})),this.on("change:_hexColor",(()=>{document.activeElement!==this.picker&&this.picker.setAttribute("color",this._hexColor),Ot(this.color)!=Ot(this._hexColor)&&(this.color=this._hexColor)}))}render(){var e,t;if(super.render(),e="hex-color-picker",t=Bt,void 0===customElements.get(e)&&customElements.define(e,t),this.picker=n.global.document.createElement("hex-color-picker"),this.picker.setAttribute("class","hex-color-picker"),this.picker.setAttribute("tabindex","-1"),this._createSlidersView(),this.element){this.hexInputRow.element?this.element.insertBefore(this.picker,this.hexInputRow.element):this.element.appendChild(this.picker);const e=document.createElement("style");e.textContent='[role="slider"]:focus [part$="pointer"] {border: 1px solid #fff;outline: 1px solid var(--ck-color-focus-border);box-shadow: 0 0 0 2px #fff;}',this.picker.shadowRoot.appendChild(e)}this.picker.addEventListener("color-changed",(e=>{const t=e.detail.value;this._debounceColorPickerEvent(t)}))}focus(){!this._config.hideInput&&(n.env.isGecko||n.env.isiOS||n.env.isSafari)&&this.hexInputRow.children.get(1).focus(),this.slidersView.first.focus()}_createSlidersView(){const e=[...this.picker.shadowRoot.children].filter((e=>"slider"===e.getAttribute("role"))).map((e=>new Lt(e)));this.slidersView=this.createCollection(),e.forEach((e=>{this.slidersView.add(e)}))}_createInputRow(){const e=this._createColorInput();return new Nt(this.locale,e)}_createColorInput(){const e=new Pe(this.locale,st),{t}=this.locale;return e.set({label:t("HEX"),class:"color-picker-hex-input"}),e.fieldView.bind("value").to(this,"_hexColor",(t=>e.isFocused?e.fieldView.value:t.startsWith("#")?t.substring(1):t)),e.fieldView.on("input",(()=>{const t=e.fieldView.element.value;if(t){const e=Dt(t);e&&this._debounceColorPickerEvent(e)}})),e}isValid(){const{t:e}=this.locale;return!!this._config.hideInput||(this.resetValidationStatus(),!!this.hexInputRow.getParsedColor()||(this.hexInputRow.inputView.errorText=e('Please enter a valid color (e.g. "ff0000").'),!1))}resetValidationStatus(){this.hexInputRow.inputView.errorText=null}}function Ot(e){let t=function(e){if(!e)return"";const t=xe(e);return t?"hex"===t.space?t.hexValue:Ee(e,"hex"):"#000"}(e);return t||(t="#000"),4===t.length&&(t="#"+[t[1],t[1],t[2],t[2],t[3],t[3]].join("")),t.toLowerCase()}class Lt extends P{constructor(e){super(),this.element=e}focus(){this.element.focus()}}class Ft extends P{constructor(e){super(e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker__hash-view"]},children:"#"})}}class Nt extends P{constructor(e,t){super(e),this.inputView=t,this.children=this.createCollection([new Ft,this.inputView]),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-picker__row"]},children:this.children})}getParsedColor(){return Dt(this.inputView.fieldView.element.value)}}function Dt(e){if(!e)return null;const t=e.trim().replace(/^#/,"");return[3,4,6,8].includes(t.length)&&/^(([0-9a-fA-F]{2}){3,4}|([0-9a-fA-F]){3,4})$/.test(t)?`#${t}`:null}class zt extends((0,n.ObservableMixin)(n.Collection)){constructor(e){super(e),this.set("isEmpty",!0),this.on("change",(()=>{this.set("isEmpty",0===this.length)}))}add(e,t){return this.find((t=>t.color===e.color))?this:super.add(e,t)}hasColor(e){return!!this.find((t=>t.color===e))}}class Wt extends P{constructor(e,{colors:t,columns:i,removeButtonLabel:n,documentColorsLabel:o,documentColorsCount:s,colorPickerLabel:r,focusTracker:a,focusables:l}){super(e);const c=this.bindTemplate;this.set("isVisible",!0),this.focusTracker=a,this.items=this.createCollection(),this.colorDefinitions=t,this.columns=i,this.documentColors=new zt,this.documentColorsCount=s,this._focusables=l,this._removeButtonLabel=n,this._colorPickerLabel=r,this._documentColorsLabel=o,this.setTemplate({tag:"div",attributes:{class:["ck-color-grids-fragment",c.if("isVisible","ck-hidden",(e=>!e))]},children:this.items}),this.removeColorButtonView=this._createRemoveColorButton(),this.items.add(this.removeColorButtonView)}updateDocumentColors(e,t){const i=e.document,n=this.documentColorsCount;this.documentColors.clear();for(const o of i.getRoots()){const i=e.createRangeIn(o);for(const e of i.getItems())if(e.is("$textProxy")&&e.hasAttribute(t)&&(this._addColorToDocumentColors(e.getAttribute(t)),this.documentColors.length>=n))return}}updateSelectedColors(){const e=this.documentColorsGrid,t=this.staticColorsGrid,i=this.selectedColor;t.selectedColor=i,e&&(e.selectedColor=i)}render(){if(super.render(),this.staticColorsGrid=this._createStaticColorsGrid(),this.items.add(this.staticColorsGrid),this.documentColorsCount){const e=a.bind(this.documentColors,this.documentColors),t=new P(this.locale);t.setTemplate({tag:"span",attributes:{class:["ck","ck-color-grid__label",e.if("isEmpty","ck-hidden")]},children:[{text:this._documentColorsLabel}]}),this.items.add(t),this.documentColorsGrid=this._createDocumentColorsGrid(),this.items.add(this.documentColorsGrid)}this._createColorPickerButton(),this._addColorSelectorElementsToFocusTracker()}focus(){this.removeColorButtonView.focus()}destroy(){super.destroy()}addColorPickerButton(){this.colorPickerButtonView&&(this.items.add(this.colorPickerButtonView),this.focusTracker.add(this.colorPickerButtonView.element),this._focusables.add(this.colorPickerButtonView))}_addColorSelectorElementsToFocusTracker(){this.focusTracker.add(this.removeColorButtonView.element),this._focusables.add(this.removeColorButtonView),this.staticColorsGrid&&(this.focusTracker.add(this.staticColorsGrid.element),this._focusables.add(this.staticColorsGrid)),this.documentColorsGrid&&(this.focusTracker.add(this.documentColorsGrid.element),this._focusables.add(this.documentColorsGrid))}_createColorPickerButton(){this.colorPickerButtonView=new N,this.colorPickerButtonView.set({label:this._colorPickerLabel,withText:!0,icon:M.icons.colorPalette,class:"ck-color-selector__color-picker"}),this.colorPickerButtonView.on("execute",(()=>{this.fire("colorPicker:show")}))}_createRemoveColorButton(){const e=new N;return e.set({withText:!0,icon:M.icons.eraser,label:this._removeButtonLabel}),e.class="ck-color-selector__remove-color",e.on("execute",(()=>{this.fire("execute",{value:null,source:"removeColorButton"})})),e.render(),e}_createStaticColorsGrid(){const e=new ve(this.locale,{colorDefinitions:this.colorDefinitions,columns:this.columns});return e.on("execute",((e,t)=>{this.fire("execute",{value:t.value,source:"staticColorsGrid"})})),e}_createDocumentColorsGrid(){const e=a.bind(this.documentColors,this.documentColors),t=new ve(this.locale,{columns:this.columns});return t.extendTemplate({attributes:{class:e.if("isEmpty","ck-hidden")}}),t.items.bindTo(this.documentColors).using((e=>{const t=new we;return t.set({color:e.color,hasBorder:e.options&&e.options.hasBorder}),e.label&&t.set({label:e.label,tooltip:!0}),t.on("execute",(()=>{this.fire("execute",{value:e.color,source:"documentColorsGrid"})})),t})),this.documentColors.on("change:isEmpty",((e,i,n)=>{n&&(t.selectedColor=null)})),t}_addColorToDocumentColors(e){const t=this.colorDefinitions.find((t=>t.color===e));t?this.documentColors.add(Object.assign({},t)):this.documentColors.add({color:e,label:e,options:{hasBorder:!1}})}}class Ht extends P{constructor(e,{focusTracker:t,focusables:i,keystrokes:n,colorPickerViewConfig:o}){super(e),this.items=this.createCollection(),this.focusTracker=t,this.keystrokes=n,this.set("isVisible",!1),this.set("selectedColor",void 0),this._focusables=i,this._colorPickerViewConfig=o;const s=this.bindTemplate,{saveButtonView:r,cancelButtonView:a}=this._createActionButtons();this.saveButtonView=r,this.cancelButtonView=a,this.actionBarView=this._createActionBarView({saveButtonView:r,cancelButtonView:a}),this.setTemplate({tag:"div",attributes:{class:["ck-color-picker-fragment",s.if("isVisible","ck-hidden",(e=>!e))]},children:this.items})}render(){super.render();const e=new Mt(this.locale,{...this._colorPickerViewConfig});this.colorPickerView=e,this.colorPickerView.render(),this.selectedColor&&(e.color=this.selectedColor),this.listenTo(this,"change:selectedColor",((t,i,n)=>{e.color=n})),this.items.add(this.colorPickerView),this.items.add(this.actionBarView),this._addColorPickersElementsToFocusTracker(),this._stopPropagationOnArrowsKeys(),this._executeOnEnterPress(),this._executeUponColorChange()}destroy(){super.destroy()}focus(){this.colorPickerView.focus()}resetValidationStatus(){this.colorPickerView.resetValidationStatus()}_executeOnEnterPress(){this.keystrokes.set("enter",(e=>{this.isVisible&&this.focusTracker.focusedElement!==this.cancelButtonView.element&&this.colorPickerView.isValid()&&(this.fire("execute",{value:this.selectedColor}),e.stopPropagation(),e.preventDefault())}))}_stopPropagationOnArrowsKeys(){const e=e=>e.stopPropagation();this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}_addColorPickersElementsToFocusTracker(){for(const e of this.colorPickerView.slidersView)this.focusTracker.add(e.element),this._focusables.add(e);const e=this.colorPickerView.hexInputRow.children.get(1);e.element&&(this.focusTracker.add(e.element),this._focusables.add(e)),this.focusTracker.add(this.saveButtonView.element),this._focusables.add(this.saveButtonView),this.focusTracker.add(this.cancelButtonView.element),this._focusables.add(this.cancelButtonView)}_createActionBarView({saveButtonView:e,cancelButtonView:t}){const i=new P,n=this.createCollection();return n.add(e),n.add(t),i.setTemplate({tag:"div",attributes:{class:["ck","ck-color-selector_action-bar"]},children:n}),i}_createActionButtons(){const e=this.locale,t=e.t,i=new N(e),n=new N(e);return i.set({icon:M.icons.check,class:"ck-button-save",type:"button",withText:!1,label:t("Accept")}),n.set({icon:M.icons.cancel,class:"ck-button-cancel",type:"button",withText:!1,label:t("Cancel")}),i.on("execute",(()=>{this.colorPickerView.isValid()&&this.fire("execute",{source:"colorPickerSaveButton",value:this.selectedColor})})),n.on("execute",(()=>{this.fire("colorPicker:cancel")})),{saveButtonView:i,cancelButtonView:n}}_executeUponColorChange(){this.colorPickerView.on("colorSelected",((e,t)=>{this.fire("execute",{value:t.color,source:"colorPicker"}),this.set("selectedColor",t.color)}))}}class Ut extends P{constructor(e,{colors:t,columns:i,removeButtonLabel:s,documentColorsLabel:r,documentColorsCount:a,colorPickerLabel:l,colorPickerViewConfig:c}){super(e),this.items=this.createCollection(),this.focusTracker=new n.FocusTracker,this.keystrokes=new n.KeystrokeHandler,this._focusables=new o,this._colorPickerViewConfig=c,this._focusCycler=new W({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.colorGridsFragmentView=new Wt(e,{colors:t,columns:i,removeButtonLabel:s,documentColorsLabel:r,documentColorsCount:a,colorPickerLabel:l,focusTracker:this.focusTracker,focusables:this._focusables}),this.colorPickerFragmentView=new Ht(e,{focusables:this._focusables,focusTracker:this.focusTracker,keystrokes:this.keystrokes,colorPickerViewConfig:c}),this.set("_isColorGridsFragmentVisible",!0),this.set("_isColorPickerFragmentVisible",!1),this.set("selectedColor",void 0),this.colorGridsFragmentView.bind("isVisible").to(this,"_isColorGridsFragmentVisible"),this.colorPickerFragmentView.bind("isVisible").to(this,"_isColorPickerFragmentVisible"),this.on("change:selectedColor",((e,t,i)=>{this.colorGridsFragmentView.set("selectedColor",i),this.colorPickerFragmentView.set("selectedColor",i)})),this.colorGridsFragmentView.on("change:selectedColor",((e,t,i)=>{this.set("selectedColor",i)})),this.colorPickerFragmentView.on("change:selectedColor",((e,t,i)=>{this.set("selectedColor",i)})),this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-selector"]},children:this.items})}render(){super.render(),this.keystrokes.listenTo(this.element)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}appendUI(){this._appendColorGridsFragment(),this._colorPickerViewConfig&&this._appendColorPickerFragment()}showColorPickerFragment(){this.colorPickerFragmentView.colorPickerView&&!this._isColorPickerFragmentVisible&&(this._isColorPickerFragmentVisible=!0,this.colorPickerFragmentView.focus(),this.colorPickerFragmentView.resetValidationStatus(),this._isColorGridsFragmentVisible=!1)}showColorGridsFragment(){this._isColorGridsFragmentVisible||(this._isColorGridsFragmentVisible=!0,this.colorGridsFragmentView.focus(),this._isColorPickerFragmentVisible=!1)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}updateDocumentColors(e,t){this.colorGridsFragmentView.updateDocumentColors(e,t)}updateSelectedColors(){this.colorGridsFragmentView.updateSelectedColors()}_appendColorGridsFragment(){this.items.length||(this.items.add(this.colorGridsFragmentView),this.colorGridsFragmentView.delegate("execute").to(this),this.colorGridsFragmentView.delegate("colorPicker:show").to(this))}_appendColorPickerFragment(){2!==this.items.length&&(this.items.add(this.colorPickerFragmentView),this.colorGridsFragmentView.colorPickerButtonView&&this.colorGridsFragmentView.colorPickerButtonView.on("execute",(()=>{this.showColorPickerFragment()})),this.colorGridsFragmentView.addColorPickerButton(),this.colorPickerFragmentView.delegate("execute").to(this),this.colorPickerFragmentView.delegate("colorPicker:cancel").to(this))}}class $t{constructor(e){this._components=new Map,this.editor=e}*names(){for(const e of this._components.values())yield e.originalName}add(e,t){this._components.set(jt(e),{callback:t,originalName:e})}create(e){if(!this.has(e))throw new n.CKEditorError("componentfactory-item-missing",this,{name:e});return this._components.get(jt(e)).callback(this.editor.locale)}has(e){return this._components.has(jt(e))}}function jt(e){return String(e).toLowerCase()}var qt=i(1500);const Kt=(0,n.toUnit)("px"),Gt={top:-99999,left:-99999,name:"arrowless",config:{withArrow:!1}};class Zt extends P{constructor(e){super(e);const t=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("position","arrow_nw"),this.set("isVisible",!1),this.set("withArrow",!0),this.set("class",void 0),this._pinWhenIsVisibleCallback=null,this._resizeObserver=null,this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-panel",t.to("position",(e=>`ck-balloon-panel_${e}`)),t.if("isVisible","ck-balloon-panel_visible"),t.if("withArrow","ck-balloon-panel_with-arrow"),t.to("class")],style:{top:t.to("top",Kt),left:t.to("left",Kt)}},children:this.content})}destroy(){this.hide(),super.destroy()}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(e){const t=Qt(e.target);if(t&&!(0,n.isVisible)(t))return!1;this.show();const i=Zt.defaultPositions,o=Object.assign({},{element:this.element,positions:[i.southArrowNorth,i.southArrowNorthMiddleWest,i.southArrowNorthMiddleEast,i.southArrowNorthWest,i.southArrowNorthEast,i.northArrowSouth,i.northArrowSouthMiddleWest,i.northArrowSouthMiddleEast,i.northArrowSouthWest,i.northArrowSouthEast,i.viewportStickyNorth],limiter:n.global.document.body,fitInViewport:!0},e),s=Zt._getOptimalPosition(o)||Gt,r=parseInt(s.left),a=parseInt(s.top),l=s.name,c=s.config||{},{withArrow:d=!0}=c;return this.top=a,this.left=r,this.position=l,this.withArrow=d,!0}pin(e){this.unpin(),this._startPinning(e)&&(this._pinWhenIsVisibleCallback=()=>{this.isVisible?this._startPinning(e):this._stopPinning()},this.listenTo(this,"change:isVisible",this._pinWhenIsVisibleCallback))}unpin(){this._pinWhenIsVisibleCallback&&(this._stopPinning(),this.stopListening(this,"change:isVisible",this._pinWhenIsVisibleCallback),this._pinWhenIsVisibleCallback=null,this.hide())}_startPinning(e){if(!this.attachTo(e))return!1;const t=Qt(e.target),i=e.limiter?Qt(e.limiter):n.global.document.body;if(this.listenTo(n.global.document,"scroll",((n,o)=>{const s=o.target,r=t&&s.contains(t),a=i&&s.contains(i);!r&&!a&&t&&i||this.attachTo(e)}),{useCapture:!0}),this.listenTo(n.global.window,"resize",(()=>{this.attachTo(e)})),t&&!this._resizeObserver){const e=()=>{(0,n.isVisible)(t)||this.unpin()};this._resizeObserver=new n.ResizeObserver(t,e)}return!0}_stopPinning(){this.stopListening(n.global.document,"scroll"),this.stopListening(n.global.window,"resize"),this._resizeObserver&&(this._resizeObserver.destroy(),this._resizeObserver=null)}static generatePositions(e={}){const{sideOffset:t=Zt.arrowSideOffset,heightOffset:i=Zt.arrowHeightOffset,stickyVerticalOffset:n=Zt.stickyVerticalOffset,config:o}=e;return{northWestArrowSouthWest:(e,i)=>({top:s(e,i),left:e.left-t,name:"arrow_sw",...o&&{config:o}}),northWestArrowSouthMiddleWest:(e,i)=>({top:s(e,i),left:e.left-.25*i.width-t,name:"arrow_smw",...o&&{config:o}}),northWestArrowSouth:(e,t)=>({top:s(e,t),left:e.left-t.width/2,name:"arrow_s",...o&&{config:o}}),northWestArrowSouthMiddleEast:(e,i)=>({top:s(e,i),left:e.left-.75*i.width+t,name:"arrow_sme",...o&&{config:o}}),northWestArrowSouthEast:(e,i)=>({top:s(e,i),left:e.left-i.width+t,name:"arrow_se",...o&&{config:o}}),northArrowSouthWest:(e,i)=>({top:s(e,i),left:e.left+e.width/2-t,name:"arrow_sw",...o&&{config:o}}),northArrowSouthMiddleWest:(e,i)=>({top:s(e,i),left:e.left+e.width/2-.25*i.width-t,name:"arrow_smw",...o&&{config:o}}),northArrowSouth:(e,t)=>({top:s(e,t),left:e.left+e.width/2-t.width/2,name:"arrow_s",...o&&{config:o}}),northArrowSouthMiddleEast:(e,i)=>({top:s(e,i),left:e.left+e.width/2-.75*i.width+t,name:"arrow_sme",...o&&{config:o}}),northArrowSouthEast:(e,i)=>({top:s(e,i),left:e.left+e.width/2-i.width+t,name:"arrow_se",...o&&{config:o}}),northEastArrowSouthWest:(e,i)=>({top:s(e,i),left:e.right-t,name:"arrow_sw",...o&&{config:o}}),northEastArrowSouthMiddleWest:(e,i)=>({top:s(e,i),left:e.right-.25*i.width-t,name:"arrow_smw",...o&&{config:o}}),northEastArrowSouth:(e,t)=>({top:s(e,t),left:e.right-t.width/2,name:"arrow_s",...o&&{config:o}}),northEastArrowSouthMiddleEast:(e,i)=>({top:s(e,i),left:e.right-.75*i.width+t,name:"arrow_sme",...o&&{config:o}}),northEastArrowSouthEast:(e,i)=>({top:s(e,i),left:e.right-i.width+t,name:"arrow_se",...o&&{config:o}}),southWestArrowNorthWest:e=>({top:r(e),left:e.left-t,name:"arrow_nw",...o&&{config:o}}),southWestArrowNorthMiddleWest:(e,i)=>({top:r(e),left:e.left-.25*i.width-t,name:"arrow_nmw",...o&&{config:o}}),southWestArrowNorth:(e,t)=>({top:r(e),left:e.left-t.width/2,name:"arrow_n",...o&&{config:o}}),southWestArrowNorthMiddleEast:(e,i)=>({top:r(e),left:e.left-.75*i.width+t,name:"arrow_nme",...o&&{config:o}}),southWestArrowNorthEast:(e,i)=>({top:r(e),left:e.left-i.width+t,name:"arrow_ne",...o&&{config:o}}),southArrowNorthWest:e=>({top:r(e),left:e.left+e.width/2-t,name:"arrow_nw",...o&&{config:o}}),southArrowNorthMiddleWest:(e,i)=>({top:r(e),left:e.left+e.width/2-.25*i.width-t,name:"arrow_nmw",...o&&{config:o}}),southArrowNorth:(e,t)=>({top:r(e),left:e.left+e.width/2-t.width/2,name:"arrow_n",...o&&{config:o}}),southArrowNorthMiddleEast:(e,i)=>({top:r(e),left:e.left+e.width/2-.75*i.width+t,name:"arrow_nme",...o&&{config:o}}),southArrowNorthEast:(e,i)=>({top:r(e),left:e.left+e.width/2-i.width+t,name:"arrow_ne",...o&&{config:o}}),southEastArrowNorthWest:e=>({top:r(e),left:e.right-t,name:"arrow_nw",...o&&{config:o}}),southEastArrowNorthMiddleWest:(e,i)=>({top:r(e),left:e.right-.25*i.width-t,name:"arrow_nmw",...o&&{config:o}}),southEastArrowNorth:(e,t)=>({top:r(e),left:e.right-t.width/2,name:"arrow_n",...o&&{config:o}}),southEastArrowNorthMiddleEast:(e,i)=>({top:r(e),left:e.right-.75*i.width+t,name:"arrow_nme",...o&&{config:o}}),southEastArrowNorthEast:(e,i)=>({top:r(e),left:e.right-i.width+t,name:"arrow_ne",...o&&{config:o}}),westArrowEast:(e,t)=>({top:e.top+e.height/2-t.height/2,left:e.left-t.width-i,name:"arrow_e",...o&&{config:o}}),eastArrowWest:(e,t)=>({top:e.top+e.height/2-t.height/2,left:e.right+i,name:"arrow_w",...o&&{config:o}}),viewportStickyNorth:(e,t,i,s)=>{const r=s||i;return e.getIntersection(r)?r.height-e.height>n?null:{top:r.top+n,left:e.left+e.width/2-t.width/2,name:"arrowless",config:{withArrow:!1,...o}}:null}};function s(e,t){return e.top-t.height-i}function r(e){return e.bottom+i}}}Zt.arrowSideOffset=25,Zt.arrowHeightOffset=10,Zt.stickyVerticalOffset=20,Zt._getOptimalPosition=n.getOptimalPosition,Zt.defaultPositions=Zt.generatePositions();const Jt=Zt;function Qt(e){return(0,qt.A)(e)?e:(0,n.isRange)(e)?e.commonAncestorContainer:"function"==typeof e?Qt(e()):null}const Yt="ck-tooltip";class Xt extends((0,n.DomEmitterMixin)()){constructor(e){if(super(),this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this._mutationObserver=null,Xt._editors.add(e),Xt._instance)return Xt._instance;Xt._instance=this,this.tooltipTextView=new P(e.locale),this.tooltipTextView.set("text",""),this.tooltipTextView.setTemplate({tag:"span",attributes:{class:["ck","ck-tooltip__text"]},children:[{text:this.tooltipTextView.bindTemplate.to("text")}]}),this.balloonPanelView=new Jt(e.locale),this.balloonPanelView.class=Yt,this.balloonPanelView.content.add(this.tooltipTextView),this._mutationObserver=function(e){const t=new MutationObserver((()=>{e()}));return{attach(e){t.observe(e,{attributes:!0,attributeFilter:["data-cke-tooltip-text","data-cke-tooltip-position"]})},detach(){t.disconnect()}}}((()=>{this._updateTooltipPosition()})),this._pinTooltipDebounced=(0,Te.A)(this._pinTooltip,600),this._unpinTooltipDebounced=(0,Te.A)(this._unpinTooltip,400),this.listenTo(n.global.document,"keydown",this._onKeyDown.bind(this),{useCapture:!0}),this.listenTo(n.global.document,"mouseenter",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(n.global.document,"mouseleave",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(n.global.document,"focus",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(n.global.document,"blur",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(n.global.document,"scroll",this._onScroll.bind(this),{useCapture:!0}),this._watchdogExcluded=!0}destroy(e){const t=e.ui.view&&e.ui.view.body;Xt._editors.delete(e),this.stopListening(e.ui),t&&t.has(this.balloonPanelView)&&t.remove(this.balloonPanelView),Xt._editors.size||(this._unpinTooltip(),this.balloonPanelView.destroy(),this.stopListening(),Xt._instance=null)}static getPositioningFunctions(e){const t=Xt.defaultBalloonPositions;return{s:[t.southArrowNorth,t.southArrowNorthEast,t.southArrowNorthWest],n:[t.northArrowSouth],e:[t.eastArrowWest],w:[t.westArrowEast],sw:[t.southArrowNorthEast],se:[t.southArrowNorthWest]}[e]}_onKeyDown(e,t){"Escape"===t.key&&this._currentElementWithTooltip&&(this._unpinTooltip(),t.stopPropagation())}_onEnterOrFocus(e,{target:t}){const i=ti(t);i?i!==this._currentElementWithTooltip&&(this._unpinTooltip(),"focus"!==e.name||i.matches(":hover")?this._pinTooltipDebounced(i,ii(i)):this._pinTooltip(i,ii(i))):"focus"===e.name&&this._unpinTooltip()}_onLeaveOrBlur(e,{target:t,relatedTarget:i}){if("mouseleave"===e.name){if(!(0,qt.A)(t))return;const e=this.balloonPanelView.element,n=e&&(e===i||e.contains(i)),o=!n&&t===e;if(n)return void this._unpinTooltipDebounced.cancel();if(!o&&this._currentElementWithTooltip&&t!==this._currentElementWithTooltip)return;const s=ti(t),r=ti(i);(o||s&&s!==r)&&this._unpinTooltipDebounced()}else{if(this._currentElementWithTooltip&&t!==this._currentElementWithTooltip)return;this._unpinTooltipDebounced()}}_onScroll(e,{target:t}){this._currentElementWithTooltip&&(t.contains(this.balloonPanelView.element)&&t.contains(this._currentElementWithTooltip)||this._unpinTooltip())}_pinTooltip(e,{text:t,position:i,cssClass:o}){this._unpinTooltip();const s=(0,n.first)(Xt._editors.values()).ui.view.body;s.has(this.balloonPanelView)||s.add(this.balloonPanelView),this.tooltipTextView.text=t,this.balloonPanelView.class=[Yt,o].filter((e=>e)).join(" "),this.balloonPanelView.pin({target:e,positions:Xt.getPositioningFunctions(i)}),this._mutationObserver.attach(e);for(const e of Xt._editors)this.listenTo(e.ui,"update",this._updateTooltipPosition.bind(this),{priority:"low"});this._currentElementWithTooltip=e,this._currentTooltipPosition=i}_unpinTooltip(){this._unpinTooltipDebounced.cancel(),this._pinTooltipDebounced.cancel(),this.balloonPanelView.unpin();for(const e of Xt._editors)this.stopListening(e.ui,"update");this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this.tooltipTextView.text="",this._mutationObserver.detach()}_updateTooltipPosition(){if(!this._currentElementWithTooltip)return;const e=ii(this._currentElementWithTooltip);(0,n.isVisible)(this._currentElementWithTooltip)&&e.text?this.balloonPanelView.pin({target:this._currentElementWithTooltip,positions:Xt.getPositioningFunctions(e.position)}):this._unpinTooltip()}}Xt.defaultBalloonPositions=Jt.generatePositions({heightOffset:5,sideOffset:13}),Xt._editors=new Set,Xt._instance=null;const ei=Xt;function ti(e){return(0,qt.A)(e)?e.closest("[data-cke-tooltip-text]:not([data-cke-tooltip-disabled])"):null}function ii(e){return{text:e.dataset.ckeTooltipText,position:e.dataset.ckeTooltipPosition||"s",cssClass:e.dataset.ckeTooltipClass||""}}var ni=i(4022);class oi extends((0,n.DomEmitterMixin)()){constructor(e){super(),this.editor=e,this._balloonView=null,this._lastFocusedEditableElement=null,this._showBalloonThrottled=(0,ni.A)(this._showBalloon.bind(this),50,{leading:!0}),e.on("ready",this._handleEditorReady.bind(this))}destroy(){const e=this._balloonView;e&&(e.unpin(),this._balloonView=null),this._showBalloonThrottled.cancel(),this.stopListening()}_handleEditorReady(){const e=this.editor;(e.config.get("ui.poweredBy.forceVisible")||"VALID"!==(0,n.verifyLicense)(e.config.get("licenseKey")))&&e.ui.view&&(e.ui.focusTracker.on("change:isFocused",((e,t,i)=>{this._updateLastFocusedEditableElement(),i?this._showBalloon():this._hideBalloon()})),e.ui.focusTracker.on("change:focusedElement",((e,t,i)=>{this._updateLastFocusedEditableElement(),i&&this._showBalloon()})),e.ui.on("update",(()=>{this._showBalloonThrottled()})))}_createBalloonView(){const e=this.editor,t=this._balloonView=new Jt,i=ai(e),n=new si(e.locale,i.label);t.content.add(n),t.set({class:"ck-powered-by-balloon"}),e.ui.view.body.add(t),e.ui.focusTracker.add(t.element),this._balloonView=t}_showBalloon(){if(!this._lastFocusedEditableElement)return;const e=function(e,t){const i=ai(e),n="right"===i.side?function(e,t){return ri(e,t,((e,i)=>e.left+e.width-i.width-t.horizontalOffset))}(t,i):function(e,t){return ri(e,t,(e=>e.left+t.horizontalOffset))}(t,i);return{target:t,positions:[n]}}(this.editor,this._lastFocusedEditableElement);e&&(this._balloonView||this._createBalloonView(),this._balloonView.pin(e))}_hideBalloon(){this._balloonView&&this._balloonView.unpin()}_updateLastFocusedEditableElement(){const e=this.editor,t=e.ui.focusTracker.isFocused,i=e.ui.focusTracker.focusedElement;if(!t||!i)return void(this._lastFocusedEditableElement=null);const n=Array.from(e.ui.getEditableElementsNames()).map((t=>e.ui.getEditableElement(t)));n.includes(i)?this._lastFocusedEditableElement=i:this._lastFocusedEditableElement=n[0]}}class si extends P{constructor(e,t){super(e);const i=new L,n=this.bindTemplate;i.set({content:'<svg xmlns="http://www.w3.org/2000/svg" width="53" height="10" viewBox="0 0 53 10"><path fill="#1C2331" d="M31.724 1.492a15.139 15.139 0 0 0 .045 1.16 2.434 2.434 0 0 0-.687-.34 3.68 3.68 0 0 0-1.103-.166 2.332 2.332 0 0 0-1.14.255 1.549 1.549 0 0 0-.686.87c-.15.41-.225.98-.225 1.712 0 .939.148 1.659.444 2.161.297.503.792.754 1.487.754.452.015.9-.094 1.294-.316.296-.174.557-.4.771-.669l.14.852h1.282V.007h-1.623v1.485ZM31 6.496a1.77 1.77 0 0 1-.494.061.964.964 0 0 1-.521-.127.758.758 0 0 1-.296-.466 3.984 3.984 0 0 1-.093-.992 4.208 4.208 0 0 1 .098-1.052.753.753 0 0 1 .307-.477 1.08 1.08 0 0 1 .55-.122c.233-.004.466.026.69.089l.483.144v2.553c-.11.076-.213.143-.307.2a1.73 1.73 0 0 1-.417.189ZM35.68 0l-.702.004c-.322.002-.482.168-.48.497l.004.581c.002.33.164.493.486.49l.702-.004c.322-.002.481-.167.48-.496L36.165.49c-.002-.33-.164-.493-.486-.491ZM36.145 2.313l-1.612.01.034 5.482 1.613-.01-.035-5.482ZM39.623.79 37.989.8 38 2.306l-.946.056.006 1.009.949-.006.024 2.983c.003.476.143.844.419 1.106.275.26.658.39 1.148.387.132 0 .293-.01.483-.03.19-.02.38-.046.57-.08.163-.028.324-.068.482-.119l-.183-1.095-.702.004a.664.664 0 0 1-.456-.123.553.553 0 0 1-.14-.422l-.016-2.621 1.513-.01-.006-1.064-1.514.01-.01-1.503ZM46.226 2.388c-.41-.184-.956-.274-1.636-.27-.673.004-1.215.101-1.627.29-.402.179-.72.505-.888.91-.18.419-.268.979-.264 1.68.004.688.1 1.24.285 1.655.172.404.495.724.9.894.414.18.957.268 1.63.264.68-.004 1.224-.099 1.632-.284.4-.176.714-.501.878-.905.176-.418.263-.971.258-1.658-.004-.702-.097-1.261-.28-1.677a1.696 1.696 0 0 0-.888-.9Zm-.613 3.607a.77.77 0 0 1-.337.501 1.649 1.649 0 0 1-1.317.009.776.776 0 0 1-.343-.497 4.066 4.066 0 0 1-.105-1.02 4.136 4.136 0 0 1 .092-1.03.786.786 0 0 1 .337-.507 1.59 1.59 0 0 1 1.316-.008.79.79 0 0 1 .344.502c.078.337.113.683.105 1.03.012.343-.019.685-.092 1.02ZM52.114 2.07a2.67 2.67 0 0 0-1.128.278c-.39.191-.752.437-1.072.73l-.157-.846-1.273.008.036 5.572 1.623-.01-.024-3.78c.35-.124.646-.22.887-.286.26-.075.53-.114.8-.118l.45-.003.144-1.546-.286.001ZM22.083 7.426l-1.576-2.532a2.137 2.137 0 0 0-.172-.253 1.95 1.95 0 0 0-.304-.29.138.138 0 0 1 .042-.04 1.7 1.7 0 0 0 .328-.374l1.75-2.71c.01-.015.025-.028.024-.048-.01-.01-.021-.007-.031-.007L20.49 1.17a.078.078 0 0 0-.075.045l-.868 1.384c-.23.366-.46.732-.688 1.099a.108.108 0 0 1-.112.06c-.098-.005-.196-.001-.294-.002-.018 0-.038.006-.055-.007.002-.02.002-.039.005-.058a4.6 4.6 0 0 0 .046-.701V1.203c0-.02-.009-.032-.03-.03h-.033L16.93 1.17c-.084 0-.073-.01-.073.076v6.491c-.001.018.006.028.025.027h1.494c.083 0 .072.007.072-.071v-2.19c0-.055-.003-.11-.004-.166a3.366 3.366 0 0 0-.05-.417h.06c.104 0 .209.002.313-.002a.082.082 0 0 1 .084.05c.535.913 1.07 1.824 1.607 2.736a.104.104 0 0 0 .103.062c.554-.003 1.107-.002 1.66-.002l.069-.003-.019-.032-.188-.304ZM27.112 6.555c-.005-.08-.004-.08-.082-.08h-2.414c-.053 0-.106-.003-.159-.011a.279.279 0 0 1-.246-.209.558.558 0 0 1-.022-.15c0-.382 0-.762-.002-1.143 0-.032.007-.049.042-.044h2.504c.029.003.037-.012.034-.038V3.814c0-.089.013-.078-.076-.078h-2.44c-.07 0-.062.003-.062-.06v-.837c0-.047.004-.093.013-.14a.283.283 0 0 1 .241-.246.717.717 0 0 1 .146-.011h2.484c.024.002.035-.009.036-.033l.003-.038.03-.496c.01-.183.024-.365.034-.548.005-.085.003-.087-.082-.094-.218-.018-.437-.038-.655-.05a17.845 17.845 0 0 0-.657-.026 72.994 72.994 0 0 0-1.756-.016 1.7 1.7 0 0 0-.471.064 1.286 1.286 0 0 0-.817.655c-.099.196-.149.413-.145.633v3.875c0 .072.003.144.011.216a1.27 1.27 0 0 0 .711 1.029c.228.113.48.167.734.158.757-.005 1.515.002 2.272-.042.274-.016.548-.034.82-.053.03-.002.043-.008.04-.041-.008-.104-.012-.208-.019-.312a69.964 69.964 0 0 1-.05-.768ZM16.14 7.415l-.127-1.075c-.004-.03-.014-.04-.044-.037a13.125 13.125 0 0 1-.998.073c-.336.01-.672.02-1.008.016-.116-.001-.233-.014-.347-.039a.746.746 0 0 1-.45-.262c-.075-.1-.132-.211-.167-.33a3.324 3.324 0 0 1-.126-.773 9.113 9.113 0 0 1-.015-.749c0-.285.022-.57.065-.852.023-.158.066-.312.127-.46a.728.728 0 0 1 .518-.443 1.64 1.64 0 0 1 .397-.048c.628-.001 1.255.003 1.882.05.022.001.033-.006.036-.026l.003-.031.06-.55c.019-.177.036-.355.057-.532.004-.034-.005-.046-.04-.056a5.595 5.595 0 0 0-1.213-.21 10.783 10.783 0 0 0-.708-.02c-.24-.003-.48.01-.719.041a3.477 3.477 0 0 0-.625.14 1.912 1.912 0 0 0-.807.497c-.185.2-.33.433-.424.688a4.311 4.311 0 0 0-.24 1.096c-.031.286-.045.572-.042.86-.006.43.024.86.091 1.286.04.25.104.497.193.734.098.279.26.53.473.734.214.205.473.358.756.446.344.11.702.17 1.063.177a8.505 8.505 0 0 0 1.578-.083 6.11 6.11 0 0 0 .766-.18c.03-.008.047-.023.037-.057a.157.157 0 0 1-.003-.025Z"/><path fill="#AFE229" d="M6.016 6.69a1.592 1.592 0 0 0-.614.21c-.23.132-.422.32-.56.546-.044.072-.287.539-.287.539l-.836 1.528.009.006c.038.025.08.046.123.063.127.046.26.07.395.073.505.023 1.011-.007 1.517-.003.29.009.58.002.869-.022a.886.886 0 0 0 .395-.116.962.962 0 0 0 .312-.286c.056-.083.114-.163.164-.249.24-.408.48-.816.718-1.226.075-.128.148-.257.222-.386l.112-.192a1.07 1.07 0 0 0 .153-.518l-1.304.023s-1.258-.005-1.388.01Z"/><path fill="#771BFF" d="m2.848 9.044.76-1.39.184-.352c-.124-.067-.245-.14-.367-.21-.346-.204-.706-.384-1.045-.6a.984.984 0 0 1-.244-.207c-.108-.134-.136-.294-.144-.46-.021-.409-.002-.818-.009-1.227-.003-.195 0-.39.003-.585.004-.322.153-.553.427-.713l.833-.488c.22-.13.44-.257.662-.385.05-.029.105-.052.158-.077.272-.128.519-.047.76.085l.044.028c.123.06.242.125.358.196.318.178.635.357.952.537.095.056.187.117.275.184.194.144.254.35.266.578.016.284.007.569.006.853-.001.28.004.558 0 .838.592-.003 1.259 0 1.259 0l.723-.013c-.003-.292-.007-.584-.007-.876 0-.524.015-1.048-.016-1.571-.024-.42-.135-.8-.492-1.067a5.02 5.02 0 0 0-.506-.339A400.52 400.52 0 0 0 5.94.787C5.722.664 5.513.524 5.282.423 5.255.406 5.228.388 5.2.373 4.758.126 4.305-.026 3.807.21c-.097.046-.197.087-.29.14A699.896 699.896 0 0 0 .783 1.948c-.501.294-.773.717-.778 1.31-.004.36-.009.718-.001 1.077.016.754-.017 1.508.024 2.261.016.304.07.6.269.848.127.15.279.28.448.382.622.4 1.283.734 1.92 1.11l.183.109Z"/></svg>\n',isColorInherited:!1}),i.extendTemplate({attributes:{style:{width:"53px",height:"10px"}}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-powered-by"],"aria-hidden":!0},children:[{tag:"a",attributes:{href:"https://ckeditor.com/?utm_source=ckeditor&utm_medium=referral&utm_campaign=701Dn000000hVgmIAE_powered_by_ckeditor_logo",target:"_blank",tabindex:"-1"},children:[...t?[{tag:"span",attributes:{class:["ck","ck-powered-by__label"]},children:[t]}]:[],i],on:{dragstart:n.to((e=>e.preventDefault()))}}]})}}function ri(e,t,i){return(o,s)=>{const r=new n.Rect(e);if(r.width<350||r.height<50)return null;let a;a="inside"===t.position?r.bottom-s.height:r.bottom-s.height/2,a-=t.verticalOffset;const l=i(r,s),c=o.clone().moveTo(l,a).getIntersection(s.clone().moveTo(l,a)).getVisible();return!c||c.getArea()<s.getArea()?null:{top:a,left:l,name:`position_${t.position}-side_${t.side}`,config:{withArrow:!1}}}}function ai(e){const t=e.config.get("ui.poweredBy"),i=t&&t.position||"border";return{position:i,label:"Powered by",verticalOffset:"inside"===i?5:0,horizontalOffset:5,side:"ltr"===e.locale.contentLanguageDirection?"right":"left",...t}}const li={POLITE:"polite",ASSERTIVE:"assertive"};class ci{constructor(e){this.editor=e,e.once("ready",(()=>{for(const e of Object.values(li))this.announce("",e)}))}announce(e,t=li.POLITE){const i=this.editor;if(!i.ui.view)return;this.view||(this.view=new di(i.locale),i.ui.view.body.add(this.view));const{politeness:n,isUnsafeHTML:o}="string"==typeof t?{politeness:t}:t;let s=this.view.regionViews.find((e=>e.politeness===n));s||(s=new ui(i,n),this.view.regionViews.add(s)),s.announce({announcement:e,isUnsafeHTML:o})}}class di extends P{constructor(e){super(e),this.regionViews=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-aria-live-announcer"]},children:this.regionViews})}}class ui extends P{constructor(e,t){super(e.locale),this.setTemplate({tag:"div",attributes:{"aria-live":t,"aria-relevant":"additions"},children:[{tag:"ul",attributes:{class:["ck","ck-aria-live-region-list"]}}]}),e.on("destroy",(()=>{null!==this._pruneAnnouncementsInterval&&(clearInterval(this._pruneAnnouncementsInterval),this._pruneAnnouncementsInterval=null)})),this.politeness=t,this._domConverter=e.data.htmlProcessor.domConverter,this._pruneAnnouncementsInterval=setInterval((()=>{this.element&&this._listElement.firstChild&&this._listElement.firstChild.remove()}),5e3)}announce({announcement:e,isUnsafeHTML:t}){if(!e.trim().length)return;const i=document.createElement("li");t?this._domConverter.setContentOf(i,e):i.innerText=e,this._listElement.appendChild(i)}get _listElement(){return this.element.querySelector("ul")}}class hi extends Ke{constructor(e,t){super(e);const i=this.bindTemplate;this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item"]},on:{mouseenter:i.to("mouseenter")}}),this.delegate("mouseenter").to(t)}}var mi=i(903);const gi={toggleMenusAndFocusItemsOnHover(e){e.on("menu:mouseenter",(t=>{if(e.isFocusBorderEnabled||e.isOpen){if(e.isOpen)for(const i of e.menus){const e=t.path[0],n=e instanceof hi&&e.children.first===i;i.isOpen=(t.path.includes(i)||n)&&i.isEnabled}t.source.focus()}}))},focusCycleMenusOnArrows(e){const t="rtl"===e.locale.uiLanguageDirection;function i(t,i){const n=e.children.getIndex(t),o=t.isOpen,s=e.children.length,r=e.children.get((n+s+i)%s);t.isOpen=!1,o&&(r.isOpen=!0),r.buttonView.focus()}e.on("menu:arrowright",(e=>{i(e.source,t?-1:1)})),e.on("menu:arrowleft",(e=>{i(e.source,t?1:-1)}))},closeMenusWhenTheBarCloses(e){e.on("change:isOpen",(()=>{e.isOpen||e.menus.forEach((e=>{e.isOpen=!1}))}))},closeMenuWhenAnotherOnTheSameLevelOpens(e){e.on("menu:change:isOpen",((t,i,n)=>{n&&e.menus.filter((e=>t.source.parentMenuView===e.parentMenuView&&t.source!==e&&e.isOpen)).forEach((e=>{e.isOpen=!1}))}))},closeOnClickOutside(e){I({emitter:e,activator:()=>e.isOpen,callback:()=>e.close(),contextElements:()=>e.children.map((e=>e.element))})},enableFocusHighlightOnInteraction(e){let t=!1;e.on("change:isOpen",((i,n,o)=>{o||(e.isFocusBorderEnabled=!1,t=!1)})),e.listenTo(e.element,"click",(()=>{e.isOpen&&e.element.matches(":focus-within")&&(e.isFocusBorderEnabled=!0)}),{useCapture:!0}),e.listenTo(e.element,"keydown",(()=>{t=!0}),{useCapture:!0}),e.listenTo(e.element,"keyup",(()=>{t=!1}),{useCapture:!0}),e.listenTo(e.element,"focus",(()=>{t&&(e.isFocusBorderEnabled=!0)}),{useCapture:!0})}},fi={openAndFocusPanelOnArrowDownKey(e){e.keystrokes.set("arrowdown",((t,i)=>{e.focusTracker.focusedElement===e.buttonView.element&&(e.isOpen||(e.isOpen=!0),e.panelView.focus(),i())}))},openOnArrowRightKey(e){const t="rtl"===e.locale.uiLanguageDirection?"arrowleft":"arrowright";e.keystrokes.set(t,((t,i)=>{e.focusTracker.focusedElement===e.buttonView.element&&e.isEnabled&&(e.isOpen||(e.isOpen=!0),e.panelView.focus(),i())}))},openOnButtonClick(e){e.buttonView.on("execute",(()=>{e.isOpen=!0,e.parentMenuView&&e.panelView.focus()}))},toggleOnButtonClick(e){e.buttonView.on("execute",(()=>{e.isOpen=!e.isOpen}))},closeOnArrowLeftKey(e){const t="rtl"===e.locale.uiLanguageDirection?"arrowright":"arrowleft";e.keystrokes.set(t,((t,i)=>{e.isOpen&&(e.isOpen=!1,e.focus(),i())}))},closeOnEscKey(e){e.keystrokes.set("esc",((t,i)=>{e.isOpen&&(e.isOpen=!1,e.focus(),i())}))},closeOnParentClose(e){e.parentMenuView.on("change:isOpen",((t,i,n)=>{n||t.source!==e.parentMenuView||(e.isOpen=!1)}))}},pi={southEast:e=>({top:e.bottom,left:e.left,name:"se"}),southWest:(e,t)=>({top:e.bottom,left:e.left-t.width+e.width,name:"sw"}),northEast:(e,t)=>({top:e.top-t.height,left:e.left,name:"ne"}),northWest:(e,t)=>({top:e.top-t.height,left:e.left-t.width+e.width,name:"nw"}),eastSouth:e=>({top:e.top,left:e.right-5,name:"es"}),eastNorth:(e,t)=>({top:e.top-t.height,left:e.right-5,name:"en"}),westSouth:(e,t)=>({top:e.top,left:e.left-t.width+5,name:"ws"}),westNorth:(e,t)=>({top:e.top-t.height,left:e.left-t.width+5,name:"wn"})},bi=[{menuId:"file",label:"File",groups:[{groupId:"export",items:["menuBar:exportPdf","menuBar:exportWord"]},{groupId:"import",items:["menuBar:importWord"]},{groupId:"revisionHistory",items:["menuBar:revisionHistory"]}]},{menuId:"edit",label:"Edit",groups:[{groupId:"undo",items:["menuBar:undo","menuBar:redo"]},{groupId:"selectAll",items:["menuBar:selectAll"]},{groupId:"findAndReplace",items:["menuBar:findAndReplace"]}]},{menuId:"view",label:"View",groups:[{groupId:"sourceEditing",items:["menuBar:sourceEditing"]},{groupId:"showBlocks",items:["menuBar:showBlocks"]},{groupId:"previewMergeFields",items:["menuBar:previewMergeFields"]},{groupId:"restrictedEditing",items:["menuBar:restrictedEditing"]}]},{menuId:"insert",label:"Insert",groups:[{groupId:"insertMainWidgets",items:["menuBar:insertImage","menuBar:ckbox","menuBar:ckfinder","menuBar:insertTable"]},{groupId:"insertInline",items:["menuBar:link","menuBar:comment","menuBar:insertMergeField"]},{groupId:"insertMinorWidgets",items:["menuBar:mediaEmbed","menuBar:insertTemplate","menuBar:specialCharacters","menuBar:blockQuote","menuBar:codeBlock","menuBar:htmlEmbed"]},{groupId:"insertStructureWidgets",items:["menuBar:horizontalLine","menuBar:pageBreak","menuBar:tableOfContents"]},{groupId:"restrictedEditingException",items:["menuBar:restrictedEditingException"]}]},{menuId:"format",label:"Format",groups:[{groupId:"textAndFont",items:[{menuId:"text",label:"Text",groups:[{groupId:"basicStyles",items:["menuBar:bold","menuBar:italic","menuBar:underline","menuBar:strikethrough","menuBar:superscript","menuBar:subscript","menuBar:code"]},{groupId:"textPartLanguage",items:["menuBar:textPartLanguage"]}]},{menuId:"font",label:"Font",groups:[{groupId:"fontProperties",items:["menuBar:fontSize","menuBar:fontFamily"]},{groupId:"fontColors",items:["menuBar:fontColor","menuBar:fontBackgroundColor"]},{groupId:"highlight",items:["menuBar:highlight"]}]},"menuBar:heading"]},{groupId:"list",items:["menuBar:bulletedList","menuBar:numberedList","menuBar:multiLevelList","menuBar:todoList"]},{groupId:"indent",items:["menuBar:alignment","menuBar:indent","menuBar:outdent"]},{groupId:"caseChange",items:["menuBar:caseChange"]},{groupId:"removeFormat",items:["menuBar:removeFormat"]}]},{menuId:"tools",label:"Tools",groups:[{groupId:"aiTools",items:["menuBar:aiAssistant","menuBar:aiCommands"]},{groupId:"tools",items:["menuBar:trackChanges","menuBar:commentsArchive"]}]},{menuId:"help",label:"Help",groups:[{groupId:"help",items:["menuBar:accessibilityHelp"]}]}];function wi(e){let t;return t="items"in e&&e.items?{items:e.items,removeItems:[],addItems:[],isVisible:!0,isUsingDefaultConfig:!1,...e}:{items:(0,mi.A)(bi),addItems:[],removeItems:[],isVisible:!0,isUsingDefaultConfig:!0,...e},t}function vi({normalizedConfig:e,locale:t,componentFactory:i,extraItems:o}){const s=(0,mi.A)(e);return _i(e,s,o),function(e,t){const i=t.removeItems,o=[];t.items=t.items.filter((({menuId:e})=>!i.includes(e)||(o.push(e),!1))),Ai(t.items,(e=>{e.groups=e.groups.filter((({groupId:e})=>!i.includes(e)||(o.push(e),!1)));for(const t of e.groups)t.items=t.items.filter((e=>{const t=Ti(e);return!i.includes(t)||(o.push(t),!1)}))}));for(const t of i)o.includes(t)||(0,n.logWarning)("menu-bar-item-could-not-be-removed",{menuBarConfig:e,itemName:t})}(e,s),_i(e,s,s.addItems),function(e,t,i){Ai(t.items,(o=>{for(const s of o.groups)s.items=s.items.filter((s=>{const r="string"==typeof s&&!i.has(s);return r&&!t.isUsingDefaultConfig&&(0,n.logWarning)("menu-bar-item-unavailable",{menuBarConfig:e,parentMenuConfig:(0,mi.A)(o),componentName:s}),!r}))}))}(e,s,i),ki(e,s),function(e,t){const i=t.t,n={File:i({string:"File",id:"MENU_BAR_MENU_FILE"}),Edit:i({string:"Edit",id:"MENU_BAR_MENU_EDIT"}),View:i({string:"View",id:"MENU_BAR_MENU_VIEW"}),Insert:i({string:"Insert",id:"MENU_BAR_MENU_INSERT"}),Format:i({string:"Format",id:"MENU_BAR_MENU_FORMAT"}),Tools:i({string:"Tools",id:"MENU_BAR_MENU_TOOLS"}),Help:i({string:"Help",id:"MENU_BAR_MENU_HELP"}),Text:i({string:"Text",id:"MENU_BAR_MENU_TEXT"}),Font:i({string:"Font",id:"MENU_BAR_MENU_FONT"})};Ai(e.items,(e=>{e.label in n&&(e.label=n[e.label])}))}(s,t),s}function _i(e,t,i){const o=[];if(0!=i.length){for(const e of i){const i=(r=e.position).startsWith("start")?"start":r.startsWith("end")?"end":r.startsWith("after")?"after":"before",n=xi(e.position);if("object"==typeof(s=e)&&"menu"in s)if(n){const s=t.items.findIndex((e=>e.menuId===n));-1!=s?"before"===i?(t.items.splice(s,0,e.menu),o.push(e)):"after"===i&&(t.items.splice(s+1,0,e.menu),o.push(e)):yi(t,e.menu,n,i)&&o.push(e)}else"start"===i?(t.items.unshift(e.menu),o.push(e)):"end"===i&&(t.items.push(e.menu),o.push(e));else Ei(e)?Ai(t.items,(t=>{if(t.menuId===n)"start"===i?(t.groups.unshift(e.group),o.push(e)):"end"===i&&(t.groups.push(e.group),o.push(e));else{const s=t.groups.findIndex((e=>e.groupId===n));-1!==s&&("before"===i?(t.groups.splice(s,0,e.group),o.push(e)):"after"===i&&(t.groups.splice(s+1,0,e.group),o.push(e)))}})):yi(t,e.item,n,i)&&o.push(e)}var s;for(const t of i)o.includes(t)||(0,n.logWarning)("menu-bar-item-could-not-be-added",{menuBarConfig:e,addedItemConfig:t})}var r}function yi(e,t,i,n){let o=!1;return Ai(e.items,(e=>{for(const{groupId:s,items:r}of e.groups){if(o)return;if(s===i)"start"===n?(r.unshift(t),o=!0):"end"===n&&(r.push(t),o=!0);else{const e=r.findIndex((e=>Ti(e)===i));-1!==e&&("before"===n?(r.splice(e,0,t),o=!0):"after"===n&&(r.splice(e+1,0,t),o=!0))}}})),o}function ki(e,t){const i=t.isUsingDefaultConfig;let n=!1;t.items=t.items.filter((t=>!!t.groups.length||(Ci(e,t,i),!1))),t.items.length?(Ai(t.items,(t=>{t.groups=t.groups.filter((e=>!!e.items.length||(n=!0,!1)));for(const o of t.groups)o.items=o.items.filter((t=>!(Pi(t)&&!t.groups.length&&(Ci(e,t,i),n=!0,1))))})),n&&ki(e,t)):Ci(e,e,i)}function Ci(e,t,i){i||(0,n.logWarning)("menu-bar-menu-empty",{menuBarConfig:e,emptyMenuConfig:t})}function Ai(e,t){if(Array.isArray(e))for(const t of e)i(t);function i(e){t(e);for(const t of e.groups)for(const e of t.items)Pi(e)&&i(e)}}function Ei(e){return"object"==typeof e&&"group"in e}function xi(e){const t=e.match(/^[^:]+:(.+)/);return t?t[1]:null}function Ti(e){return"string"==typeof e?e:e.menuId}function Pi(e){return"object"==typeof e&&"menuId"in e}class Ii extends((0,n.ObservableMixin)()){constructor(e){super(),this.isReady=!1,this._editableElementsMap=new Map,this._focusableToolbarDefinitions=[],this._extraMenuBarElements=[],this._lastFocusedForeignElement=null;const t=e.editing.view;this.editor=e,this.componentFactory=new $t(e),this.focusTracker=new n.FocusTracker,this.tooltipManager=new ei(e),this.poweredBy=new oi(e),this.ariaLiveAnnouncer=new ci(e),this.set("viewportOffset",this._readViewportOffsetFromConfig()),this.once("ready",(()=>{this.isReady=!0})),this.listenTo(t.document,"layoutChanged",this.update.bind(this)),this.listenTo(t,"scrollToTheSelection",this._handleScrollToTheSelection.bind(this)),this._initFocusTracking()}get element(){return null}update(){this.fire("update")}destroy(){this.stopListening(),this.focusTracker.destroy(),this.tooltipManager.destroy(this.editor),this.poweredBy.destroy();for(const e of this._editableElementsMap.values())e.ckeditorInstance=null,this.editor.keystrokes.stopListening(e);this._editableElementsMap=new Map,this._focusableToolbarDefinitions=[]}setEditableElement(e,t){this._editableElementsMap.set(e,t),t.ckeditorInstance||(t.ckeditorInstance=this.editor),this.focusTracker.add(t);const i=()=>{this.editor.editing.view.getDomRoot(e)||this.editor.keystrokes.listenTo(t)};this.isReady?i():this.once("ready",i)}removeEditableElement(e){const t=this._editableElementsMap.get(e);t&&(this._editableElementsMap.delete(e),this.editor.keystrokes.stopListening(t),this.focusTracker.remove(t),t.ckeditorInstance=null)}getEditableElement(e="main"){return this._editableElementsMap.get(e)}getEditableElementsNames(){return this._editableElementsMap.keys()}addToolbar(e,t={}){e.isRendered?(this.focusTracker.add(e.element),this.editor.keystrokes.listenTo(e.element)):e.once("render",(()=>{this.focusTracker.add(e.element),this.editor.keystrokes.listenTo(e.element)})),this._focusableToolbarDefinitions.push({toolbarView:e,options:t})}extendMenuBar(e){this._extraMenuBarElements.push(e)}get _editableElements(){return console.warn("editor-ui-deprecated-editable-elements: The EditorUI#_editableElements property has been deprecated and will be removed in the near future.",{editorUI:this}),this._editableElementsMap}_initMenuBar(e){const t=e.element;this.focusTracker.add(t),this.editor.keystrokes.listenTo(t);const i=wi(this.editor.config.get("menuBar")||{});e.fillFromConfig(i,this.componentFactory,this._extraMenuBarElements),this.editor.keystrokes.set("Esc",((e,i)=>{t.contains(this.editor.ui.focusTracker.focusedElement)&&(this._lastFocusedForeignElement?(this._lastFocusedForeignElement.focus(),this._lastFocusedForeignElement=null):this.editor.editing.view.focus(),i())})),this.editor.keystrokes.set("Alt+F9",((i,n)=>{t.contains(this.editor.ui.focusTracker.focusedElement)||(this._saveLastFocusedForeignElement(),e.isFocusBorderEnabled=!0,e.focus(),n())}))}_readViewportOffsetFromConfig(){const e=this.editor,t=e.config.get("ui.viewportOffset");if(t)return t;const i=e.config.get("toolbar.viewportTopOffset");return i?(console.warn("editor-ui-deprecated-viewport-offset-config: The `toolbar.vieportTopOffset` configuration option is deprecated. It will be removed from future CKEditor versions. Use `ui.viewportOffset.top` instead."),{top:i}):{top:0}}_initFocusTracking(){const e=this.editor;let t;e.editing.view,e.keystrokes.set("Alt+F10",((e,i)=>{this._saveLastFocusedForeignElement();const n=this._getCurrentFocusedToolbarDefinition();n&&t||(t=this._getFocusableCandidateToolbarDefinitions());for(let e=0;e<t.length;e++){const e=t.shift();if(t.push(e),e!==n&&this._focusFocusableCandidateToolbar(e)){n&&n.options.afterBlur&&n.options.afterBlur();break}}i()})),e.keystrokes.set("Esc",((t,i)=>{const n=this._getCurrentFocusedToolbarDefinition();n&&(this._lastFocusedForeignElement?(this._lastFocusedForeignElement.focus(),this._lastFocusedForeignElement=null):e.editing.view.focus(),n.options.afterBlur&&n.options.afterBlur(),i())}))}_saveLastFocusedForeignElement(){const e=this.focusTracker.focusedElement;Array.from(this._editableElementsMap.values()).includes(e)&&!Array.from(this.editor.editing.view.domRoots.values()).includes(e)&&(this._lastFocusedForeignElement=e)}_getFocusableCandidateToolbarDefinitions(){const e=[];for(const t of this._focusableToolbarDefinitions){const{toolbarView:i,options:o}=t;((0,n.isVisible)(i.element)||o.beforeFocus)&&e.push(t)}return e.sort(((e,t)=>Si(e)-Si(t))),e}_getCurrentFocusedToolbarDefinition(){for(const e of this._focusableToolbarDefinitions)if(e.toolbarView.element&&e.toolbarView.element.contains(this.focusTracker.focusedElement))return e;return null}_focusFocusableCandidateToolbar(e){const{toolbarView:t,options:{beforeFocus:i}}=e;return i&&i(),!!(0,n.isVisible)(t.element)&&(t.focus(),!0)}_handleScrollToTheSelection(e,t){const i={top:0,bottom:0,left:0,right:0,...this.viewportOffset};t.viewportOffset.top+=i.top,t.viewportOffset.bottom+=i.bottom,t.viewportOffset.left+=i.left,t.viewportOffset.right+=i.right}}function Si(e){const{toolbarView:t,options:i}=e;let o=10;return(0,n.isVisible)(t.element)&&o--,i.isContextual&&o--,o}class Vi extends P{constructor(e){super(e),this.body=new ae(e)}render(){super.render(),this.body.attachToDom()}destroy(){return this.body.detachFromDom(),super.destroy()}}class Ri extends Vi{constructor(e){super(e),this.top=this.createCollection(),this.main=this.createCollection(),this._voiceLabelView=this._createVoiceLabel(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-editor","ck-rounded-corners"],role:"application",dir:e.uiLanguageDirection,lang:e.uiLanguage,"aria-labelledby":this._voiceLabelView.id},children:[this._voiceLabelView,{tag:"div",attributes:{class:["ck","ck-editor__top","ck-reset_all"],role:"presentation"},children:this.top},{tag:"div",attributes:{class:["ck","ck-editor__main"],role:"presentation"},children:this.main}]})}_createVoiceLabel(){const e=this.t,t=new ie;return t.text=e("Rich Text Editor"),t.extendTemplate({attributes:{class:"ck-voice-label"}}),t}}class Bi extends P{constructor(e,t,i){super(e),this.name=null,this.setTemplate({tag:"div",attributes:{class:["ck","ck-content","ck-editor__editable","ck-rounded-corners"],lang:e.contentLanguage,dir:e.contentLanguageDirection}}),this.set("isFocused",!1),this._editableElement=i,this._hasExternalElement=!!this._editableElement,this._editingView=t}render(){super.render(),this._hasExternalElement?this.template.apply(this.element=this._editableElement):this._editableElement=this.element,this.on("change:isFocused",(()=>this._updateIsFocusedClasses())),this._updateIsFocusedClasses()}destroy(){this._hasExternalElement&&this.template.revert(this._editableElement),super.destroy()}get hasExternalElement(){return this._hasExternalElement}_updateIsFocusedClasses(){const e=this._editingView;function t(t){e.change((i=>{const n=e.document.getRoot(t.name);i.addClass(t.isFocused?"ck-focused":"ck-blurred",n),i.removeClass(t.isFocused?"ck-blurred":"ck-focused",n)}))}e.isRenderingInProgress?function i(n){e.once("change:isRenderingInProgress",((e,o,s)=>{s?i(n):t(n)}))}(this):t(this)}}class Mi extends Bi{constructor(e,t,i,n={}){super(e,t,i);const o=e.t;this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}}),this._generateLabel=n.label||(()=>o("Editor editing area: %0",this.name))}render(){super.render();const e=this._editingView;e.change((t=>{const i=e.document.getRoot(this.name);t.setAttribute("aria-label",this._generateLabel(this),i)}))}}class Oi extends P{constructor(e){super(e);const t=this.bindTemplate;this.setTemplate({tag:"iframe",attributes:{class:["ck","ck-reset_all"],sandbox:"allow-same-origin allow-scripts"},on:{load:t.to("loaded")}})}render(){return new Promise((e=>(this.on("loaded",e),super.render())))}}function Li(e,t){let i=0,n=0;for(const o of t){const t=o,s=t.items,r=e&&!!t.label.match(e);t.labelView.highlightText(r?e:null);for(const t of s){const i=t.children.first,n=i.labelView;if(e){const o=!!i.label.match(e);n.highlightText(o?e:null),t.isVisible=r||o}else t.isVisible=!0,n.highlightText(null)}const a=s.filter((e=>e.isVisible)).length;i+=t.items.length,n+=r?t.items.length:a,t.isVisible=r||!!a}return{resultsCount:n,totalItemsCount:i}}class Fi extends M.ContextPlugin{static get pluginName(){return"Notification"}init(){this.on("show:warning",((e,t)=>{window.alert(t.message)}),{priority:"lowest"})}showSuccess(e,t={}){this._showNotification({message:e,type:"success",namespace:t.namespace,title:t.title})}showInfo(e,t={}){this._showNotification({message:e,type:"info",namespace:t.namespace,title:t.title})}showWarning(e,t={}){this._showNotification({message:e,type:"warning",namespace:t.namespace,title:t.title})}_showNotification(e){const t=e.namespace?`show:${e.type}:${e.namespace}`:`show:${e.type}`;this.fire(t,{message:e.message,type:e.type,title:e.title||""})}}var Ni=i(6232);class Di extends((0,n.ObservableMixin)()){constructor(e,t){super(),t&&(0,Ni.A)(this,t),e&&this.set(e)}}const zi=(0,n.toUnit)("px");class Wi extends M.Plugin{static get pluginName(){return"ContextualBalloon"}constructor(e){super(e),this._viewToStack=new Map,this._idToStack=new Map,this._view=null,this._rotatorView=null,this._fakePanelsView=null,this.positionLimiter=()=>{const e=this.editor.editing.view,t=e.document.selection.editableElement;return t?e.domConverter.mapViewToDom(t.root):null},this.set("visibleView",null),this.set("_numberOfStacks",0),this.set("_singleViewMode",!1)}destroy(){super.destroy(),this._view&&this._view.destroy(),this._rotatorView&&this._rotatorView.destroy(),this._fakePanelsView&&this._fakePanelsView.destroy()}get view(){return this._view||this._createPanelView(),this._view}hasView(e){return Array.from(this._viewToStack.keys()).includes(e)}add(e){if(this._view||this._createPanelView(),this.hasView(e.view))throw new n.CKEditorError("contextualballoon-add-view-exist",[this,e]);const t=e.stackId||"main";if(!this._idToStack.has(t))return this._idToStack.set(t,new Map([[e.view,e]])),this._viewToStack.set(e.view,this._idToStack.get(t)),this._numberOfStacks=this._idToStack.size,void(this._visibleStack&&!e.singleViewMode||this.showStack(t));const i=this._idToStack.get(t);e.singleViewMode&&this.showStack(t),i.set(e.view,e),this._viewToStack.set(e.view,i),i===this._visibleStack&&this._showView(e)}remove(e){if(!this.hasView(e))throw new n.CKEditorError("contextualballoon-remove-view-not-exist",[this,e]);const t=this._viewToStack.get(e);this._singleViewMode&&this.visibleView===e&&(this._singleViewMode=!1),this.visibleView===e&&(1===t.size?this._idToStack.size>1?this._showNextStack():(this.view.hide(),this.visibleView=null,this._rotatorView.hideView()):this._showView(Array.from(t.values())[t.size-2])),1===t.size?(this._idToStack.delete(this._getStackId(t)),this._numberOfStacks=this._idToStack.size):t.delete(e),this._viewToStack.delete(e)}updatePosition(e){e&&(this._visibleStack.get(this.visibleView).position=e),this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition()}showStack(e){this.visibleStack=e;const t=this._idToStack.get(e);if(!t)throw new n.CKEditorError("contextualballoon-showstack-stack-not-exist",this);this._visibleStack!==t&&this._showView(Array.from(t.values()).pop())}_createPanelView(){this._view=new Jt(this.editor.locale),this.editor.ui.view.body.add(this._view),this.editor.ui.focusTracker.add(this._view.element),this._rotatorView=this._createRotatorView(),this._fakePanelsView=this._createFakePanelsView()}get _visibleStack(){return this._viewToStack.get(this.visibleView)}_getStackId(e){return Array.from(this._idToStack.entries()).find((t=>t[1]===e))[0]}_showNextStack(){const e=Array.from(this._idToStack.values());let t=e.indexOf(this._visibleStack)+1;e[t]||(t=0),this.showStack(this._getStackId(e[t]))}_showPrevStack(){const e=Array.from(this._idToStack.values());let t=e.indexOf(this._visibleStack)-1;e[t]||(t=e.length-1),this.showStack(this._getStackId(e[t]))}_createRotatorView(){const e=new Hi(this.editor.locale),t=this.editor.locale.t;return this.view.content.add(e),e.bind("isNavigationVisible").to(this,"_numberOfStacks",this,"_singleViewMode",((e,t)=>!t&&e>1)),e.on("change:isNavigationVisible",(()=>this.updatePosition()),{priority:"low"}),e.bind("counter").to(this,"visibleView",this,"_numberOfStacks",((e,i)=>{if(i<2)return"";const n=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return t("%0 of %1",[n,i])})),e.buttonNextView.on("execute",(()=>{e.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showNextStack()})),e.buttonPrevView.on("execute",(()=>{e.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showPrevStack()})),e}_createFakePanelsView(){const e=new Ui(this.editor.locale,this.view);return e.bind("numberOfPanels").to(this,"_numberOfStacks",this,"_singleViewMode",((e,t)=>!t&&e>=2?Math.min(e-1,2):0)),e.listenTo(this.view,"change:top",(()=>e.updatePosition())),e.listenTo(this.view,"change:left",(()=>e.updatePosition())),this.editor.ui.view.body.add(e),e}_showView({view:e,balloonClassName:t="",withArrow:i=!0,singleViewMode:n=!1}){this.view.class=t,this.view.withArrow=i,this._rotatorView.showView(e),this.visibleView=e,this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition(),n&&(this._singleViewMode=!0)}_getBalloonPosition(){let e=Array.from(this._visibleStack.values()).pop().position;return e&&(e.limiter||(e=Object.assign({},e,{limiter:this.positionLimiter})),e=Object.assign({},e,{viewportOffsetConfig:this.editor.ui.viewportOffset})),e}}class Hi extends P{constructor(e){super(e);const t=e.t,i=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new n.FocusTracker,this.buttonPrevView=this._createButtonView(t("Previous"),M.icons.previousArrow),this.buttonNextView=this._createButtonView(t("Next"),M.icons.nextArrow),this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-rotator"],"z-index":"-1"},children:[{tag:"div",attributes:{class:["ck-balloon-rotator__navigation",i.to("isNavigationVisible",(e=>e?"":"ck-hidden"))]},children:[this.buttonPrevView,{tag:"span",attributes:{class:["ck-balloon-rotator__counter"]},children:[{text:i.to("counter")}]},this.buttonNextView]},{tag:"div",attributes:{class:"ck-balloon-rotator__content"},children:this.content}]})}render(){super.render(),this.focusTracker.add(this.element)}destroy(){super.destroy(),this.focusTracker.destroy()}showView(e){this.hideView(),this.content.add(e)}hideView(){this.content.clear()}_createButtonView(e,t){const i=new N(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i}}class Ui extends P{constructor(e,t){super(e);const i=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("height",0),this.set("width",0),this.set("numberOfPanels",0),this.content=this.createCollection(),this._balloonPanelView=t,this.setTemplate({tag:"div",attributes:{class:["ck-fake-panel",i.to("numberOfPanels",(e=>e?"":"ck-hidden"))],style:{top:i.to("top",zi),left:i.to("left",zi),width:i.to("width",zi),height:i.to("height",zi)}},children:this.content}),this.on("change:numberOfPanels",((e,t,i,n)=>{i>n?this._addPanels(i-n):this._removePanels(n-i),this.updatePosition()}))}_addPanels(e){for(;e--;){const e=new P;e.setTemplate({tag:"div"}),this.content.add(e),this.registerChild(e)}}_removePanels(e){for(;e--;){const e=this.content.last;this.content.remove(e),this.deregisterChild(e),e.destroy()}}updatePosition(){if(this.numberOfPanels){const{top:e,left:t}=this._balloonPanelView,{width:i,height:o}=new n.Rect(this._balloonPanelView.element);Object.assign(this,{top:e,left:t,width:i,height:o})}}}const $i=(0,n.toUnit)("px");class ji extends P{constructor(e){super(e);const t=this.bindTemplate;this.set("isActive",!1),this.set("isSticky",!1),this.set("limiterElement",null),this.set("limiterBottomOffset",50),this.set("viewportTopOffset",0),this.set("_marginLeft",null),this.set("_isStickyToTheBottomOfLimiter",!1),this.set("_stickyTopOffset",null),this.set("_stickyBottomOffset",null),this.content=this.createCollection(),this._contentPanelPlaceholder=new a({tag:"div",attributes:{class:["ck","ck-sticky-panel__placeholder"],style:{display:t.to("isSticky",(e=>e?"block":"none")),height:t.to("isSticky",(e=>e?$i(this._contentPanelRect.height):null))}}}).render(),this.contentPanelElement=new a({tag:"div",attributes:{class:["ck","ck-sticky-panel__content",t.if("isSticky","ck-sticky-panel__content_sticky"),t.if("_isStickyToTheBottomOfLimiter","ck-sticky-panel__content_sticky_bottom-limit")],style:{width:t.to("isSticky",(e=>e?$i(this._contentPanelPlaceholder.getBoundingClientRect().width):null)),top:t.to("_stickyTopOffset",(e=>e?$i(e):e)),bottom:t.to("_stickyBottomOffset",(e=>e?$i(e):e)),marginLeft:t.to("_marginLeft")}},children:this.content}).render(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-sticky-panel"]},children:[this._contentPanelPlaceholder,this.contentPanelElement]})}render(){super.render(),this.checkIfShouldBeSticky(),this.listenTo(n.global.document,"scroll",(()=>{this.checkIfShouldBeSticky()}),{useCapture:!0}),this.listenTo(this,"change:isActive",(()=>{this.checkIfShouldBeSticky()}))}checkIfShouldBeSticky(){if(!this.limiterElement||!this.isActive)return void this._unstick();const e=new n.Rect(this.limiterElement);let t=e.getVisible();if(t){const e=new n.Rect(n.global.window);e.top+=this.viewportTopOffset,e.height-=this.viewportTopOffset,t=t.getIntersection(e)}if(t&&e.top<t.top){const i=t.top;if(i+this._contentPanelRect.height+this.limiterBottomOffset>t.bottom){const i=Math.max(e.bottom-t.bottom,0)+this.limiterBottomOffset;e.bottom-i>e.top+this._contentPanelRect.height?this._stickToBottomOfLimiter(i):this._unstick()}else this._contentPanelRect.height+this.limiterBottomOffset<e.height?this._stickToTopOfAncestors(i):this._unstick()}else this._unstick()}_stickToTopOfAncestors(e){this.isSticky=!0,this._isStickyToTheBottomOfLimiter=!1,this._stickyTopOffset=e,this._stickyBottomOffset=null,this._marginLeft=$i(-n.global.window.scrollX)}_stickToBottomOfLimiter(e){this.isSticky=!0,this._isStickyToTheBottomOfLimiter=!0,this._stickyTopOffset=null,this._stickyBottomOffset=e,this._marginLeft=$i(-n.global.window.scrollX)}_unstick(){this.isSticky=!1,this._isStickyToTheBottomOfLimiter=!1,this._stickyTopOffset=null,this._stickyBottomOffset=null,this._marginLeft=null}get _contentPanelRect(){return new n.Rect(this.contentPanelElement)}}class qi extends Pe{constructor(e,t){const i=e.t,n=Object.assign({},{showResetButton:!0,showIcon:!0,creator:st},t);super(e,n.creator),this.label=t.label,this._viewConfig=n,this._viewConfig.showIcon&&(this.iconView=new L,this.iconView.content=M.icons.loupe,this.fieldWrapperChildren.add(this.iconView,0),this.extendTemplate({attributes:{class:"ck-search__query_with-icon"}})),this._viewConfig.showResetButton&&(this.resetButtonView=new N(e),this.resetButtonView.set({label:i("Clear"),icon:M.icons.cancel,class:"ck-search__reset",isVisible:!1,tooltip:!0}),this.resetButtonView.on("execute",(()=>{this.reset(),this.focus(),this.fire("reset")})),this.resetButtonView.bind("isVisible").to(this.fieldView,"isEmpty",(e=>!e)),this.fieldWrapperChildren.add(this.resetButtonView),this.extendTemplate({attributes:{class:"ck-search__query_with-reset"}}))}reset(){this.fieldView.reset(),this._viewConfig.showResetButton&&(this.resetButtonView.isVisible=!1)}}class Ki extends P{constructor(){super();const e=this.bindTemplate;this.set({isVisible:!1,primaryText:"",secondaryText:""}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-search__info",e.if("isVisible","ck-hidden",(e=>!e))],tabindex:-1},children:[{tag:"span",children:[{text:[e.to("primaryText")]}]},{tag:"span",children:[{text:[e.to("secondaryText")]}]}]})}focus(){this.element.focus()}}class Gi extends P{constructor(e){super(e),this.children=this.createCollection(),this.focusTracker=new n.FocusTracker,this.setTemplate({tag:"div",attributes:{class:["ck","ck-search__results"],tabindex:-1},children:this.children}),this._focusCycler=new W({focusables:this.children,focusTracker:this.focusTracker})}render(){super.render();for(const e of this.children)this.focusTracker.add(e.element)}focus(){this._focusCycler.focusFirst()}focusFirst(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}var Zi=i(3224);class Ji extends P{constructor(e,t){super(e),this._config=t,this.filteredView=t.filteredView,this.queryView=this._createSearchTextQueryView(),this.focusTracker=new n.FocusTracker,this.keystrokes=new n.KeystrokeHandler,this.resultsView=new Gi(e),this.children=this.createCollection(),this.focusableChildren=this.createCollection([this.queryView,this.resultsView]),this.set("isEnabled",!0),this.set("resultsCount",0),this.set("totalItemsCount",0),t.infoView&&t.infoView.instance?this.infoView=t.infoView.instance:(this.infoView=new Ki,this._enableDefaultInfoViewBehavior(),this.on("render",(()=>{this.search("")}))),this.resultsView.children.addMany([this.infoView,this.filteredView]),this.focusCycler=new W({focusables:this.focusableChildren,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.on("search",((e,{resultsCount:t,totalItemsCount:i})=>{this.resultsCount=t,this.totalItemsCount=i})),this.setTemplate({tag:"div",attributes:{class:["ck","ck-search",t.class||null],tabindex:"-1"},children:this.children})}render(){super.render(),this.children.addMany([this.queryView,this.resultsView]);const e=e=>e.stopPropagation();for(const e of this.focusableChildren)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element),this.keystrokes.set("arrowright",e),this.keystrokes.set("arrowleft",e),this.keystrokes.set("arrowup",e),this.keystrokes.set("arrowdown",e)}focus(){this.queryView.focus()}reset(){this.queryView.reset(),this.search(""),this.filteredView.element.scrollTo(0,0)}search(e){const t=e?new RegExp((0,Zi.A)(e),"ig"):null,i=this.filteredView.filter(t);this.fire("search",{query:e,...i})}_createSearchTextQueryView(){const e=new qi(this.locale,this._config.queryView);return this.listenTo(e.fieldView,"input",(()=>{this.search(e.fieldView.element.value)})),e.on("reset",(()=>this.reset())),e.bind("isEnabled").to(this),e}_enableDefaultInfoViewBehavior(){const e=this.locale.t,t=this.infoView;function i(e,{query:t,resultsCount:i,totalItemsCount:n}){return"function"==typeof e?e(t,i,n):e}this.on("search",((n,o)=>{if(o.resultsCount)t.set({isVisible:!1});else{const n=this._config.infoView&&this._config.infoView.text;let s,r;o.totalItemsCount?n&&n.notFound?(s=n.notFound.primary,r=n.notFound.secondary):(s=e("No results found"),r=""):n&&n.noSearchableItems?(s=n.noSearchableItems.primary,r=n.noSearchableItems.secondary):(s=e("No searchable items"),r=""),t.set({primaryText:i(s,o),secondaryText:i(r,o),isVisible:!0})}}))}}class Qi extends Ji{constructor(e,t){super(e,t),this._config=t;const i=(0,n.toUnit)("px");this.extendTemplate({attributes:{class:["ck-autocomplete"]}});const o=this.resultsView.bindTemplate;this.resultsView.set("isVisible",!1),this.resultsView.set("_position","s"),this.resultsView.set("_width",0),this.resultsView.extendTemplate({attributes:{class:[o.if("isVisible","ck-hidden",(e=>!e)),o.to("_position",(e=>`ck-search__results_${e}`))],style:{width:o.to("_width",i)}}}),this.focusTracker.on("change:isFocused",((e,i,n)=>{this._updateResultsVisibility(),n?this.resultsView.element.scrollTop=0:t.resetOnBlur&&this.queryView.reset()})),this.on("search",(()=>{this._updateResultsVisibility(),this._updateResultsViewWidthAndPosition()})),this.keystrokes.set("esc",((e,t)=>{this.resultsView.isVisible&&(this.queryView.focus(),this.resultsView.isVisible=!1,t())})),this.listenTo(n.global.document,"scroll",(()=>{this._updateResultsViewWidthAndPosition()})),this.on("change:isEnabled",(()=>{this._updateResultsVisibility()})),this.filteredView.on("execute",((e,{value:t})=>{this.focus(),this.reset(),this.queryView.fieldView.value=this.queryView.fieldView.element.value=t,this.resultsView.isVisible=!1})),this.resultsView.on("change:isVisible",(()=>{this._updateResultsViewWidthAndPosition()}))}_updateResultsViewWidthAndPosition(){if(!this.resultsView.isVisible)return;this.resultsView._width=new n.Rect(this.queryView.fieldView.element).width;const e=Qi._getOptimalPosition({element:this.resultsView.element,target:this.queryView.element,fitInViewport:!0,positions:Qi.defaultResultsPositions});this.resultsView._position=e?e.name:"s"}_updateResultsVisibility(){const e=void 0===this._config.queryMinChars?0:this._config.queryMinChars,t=this.queryView.fieldView.element.value.length;this.resultsView.isVisible=this.focusTracker.isFocused&&this.isEnabled&&t>=e}}Qi.defaultResultsPositions=[e=>({top:e.bottom,left:e.left,name:"s"}),(e,t)=>({top:e.top-t.height,left:e.left,name:"n"})],Qi._getOptimalPosition=n.getOptimalPosition;const Yi=Qi,Xi=(en={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},function(e){return null==en?void 0:en[e]});var en,tn=i(3456),nn=/[&<>"']/g,on=RegExp(nn.source);const sn=function(e){return(e=(0,tn.A)(e))&&on.test(e)?e.replace(nn,Xi):e};class rn extends P{constructor(){super(),this.set("text",void 0),this.setTemplate({tag:"span",attributes:{class:["ck","ck-highlighted-text"]}}),this.on("render",(()=>{this.on("change:text",(()=>{this._updateInnerHTML(this.text)})),this._updateInnerHTML(this.text)}))}highlightText(e){this._updateInnerHTML(function(e,t){if(!t)return sn(e);const i=[];let n=0,o=t.exec(e);for(;null!==o;){const s=o.index;s!==n&&i.push({text:e.substring(n,s),isMatch:!1}),i.push({text:o[0],isMatch:!0}),n=t.lastIndex,o=t.exec(e)}return n!==e.length&&i.push({text:e.substring(n),isMatch:!1}),i.map((e=>(e.text=sn(e.text),e))).map((e=>e.isMatch?`<mark>${e.text}</mark>`:e.text)).join("")}(this.text||"",e))}_updateInnerHTML(e){this.element.innerHTML=e||""}}class an extends rn{constructor(){super(),this.set({style:void 0,text:void 0,id:void 0});const e=this.bindTemplate;this.extendTemplate({attributes:{class:["ck-button__label"],style:e.to("style"),id:e.to("id")}})}}class ln extends rn{constructor(){super(),this.set("for",void 0);const e=this.bindTemplate;this.id=`ck-editor__label_${(0,n.uid)()}`,this.extendTemplate({attributes:{class:["ck","ck-label"],id:this.id,for:e.to("for")}})}}class cn extends P{constructor(){super(),this.set("isVisible",!1);const e=this.bindTemplate;this.setTemplate({tag:"span",attributes:{class:["ck","ck-spinner-container",e.if("isVisible","ck-hidden",(e=>!e))]},children:[{tag:"span",attributes:{class:["ck","ck-spinner"]}}]})}}const dn=(0,n.toUnit)("px");class un extends M.Plugin{static get pluginName(){return"BalloonToolbar"}static get requires(){return[Wi]}constructor(e){super(e),this._resizeObserver=null,this._balloonConfig=We(e.config.get("balloonToolbar")),this.toolbarView=this._createToolbarView(),this.focusTracker=new n.FocusTracker,e.ui.once("ready",(()=>{this.focusTracker.add(e.ui.getEditableElement()),this.focusTracker.add(this.toolbarView.element)})),e.ui.addToolbar(this.toolbarView,{beforeFocus:()=>this.show(!0),afterBlur:()=>this.hide(),isContextual:!0}),this._balloon=e.plugins.get(Wi),this._fireSelectionChangeDebounced=(0,Te.A)((()=>this.fire("_selectionChangeDebounced")),200),this.decorate("show")}init(){const e=this.editor,t=e.model.document.selection;this.listenTo(this.focusTracker,"change:isFocused",((e,t,i)=>{const n=this._balloon.visibleView===this.toolbarView;!i&&n?this.hide():i&&this.show()})),this.listenTo(t,"change:range",((e,i)=>{(i.directChange||t.isCollapsed)&&this.hide(),this._fireSelectionChangeDebounced()})),this.listenTo(this,"_selectionChangeDebounced",(()=>{this.editor.editing.view.document.isFocused&&this.show()})),this._balloonConfig.shouldNotGroupWhenFull||this.listenTo(e,"ready",(()=>{const t=e.ui.view.editable.element;this._resizeObserver=new n.ResizeObserver(t,(e=>{this.toolbarView.maxWidth=dn(.9*e.contentRect.width)}))})),this.listenTo(this.toolbarView,"groupedItemsUpdate",(()=>{this._updatePosition()})),e.ui.once("ready",(()=>{this.toolbarView.fillFromConfig(this._balloonConfig,this.editor.ui.componentFactory)}))}_createToolbarView(){const e=this.editor.locale.t,t=!this._balloonConfig.shouldNotGroupWhenFull,i=new Ue(this.editor.locale,{shouldGroupWhenFull:t,isFloating:!0});return i.ariaLabel=e("Editor contextual toolbar"),i.render(),i}show(e=!1){const t=this.editor,i=t.model.document.selection,n=t.model.schema;this._balloon.hasView(this.toolbarView)||i.isCollapsed&&!e||function(e,t){return 1!==e.rangeCount&&[...e.getRanges()].every((e=>{const i=e.getContainedElement();return i&&t.isSelectable(i)}))}(i,n)||Array.from(this.toolbarView.items).every((e=>void 0!==e.isEnabled&&!e.isEnabled))||(this.listenTo(this.editor.ui,"update",(()=>{this._updatePosition()})),this._balloon.add({view:this.toolbarView,position:this._getBalloonPositionData(),balloonClassName:"ck-toolbar-container"}))}hide(){this._balloon.hasView(this.toolbarView)&&(this.stopListening(this.editor.ui,"update"),this._balloon.remove(this.toolbarView))}_getBalloonPositionData(){const e=this.editor.editing.view,t=e.document,i=t.selection,o=t.selection.isBackward;return{target:()=>{const t=o?i.getFirstRange():i.getLastRange(),s=n.Rect.getDomRangeRects(e.domConverter.viewRangeToDom(t));return o?s[0]:(s.length>1&&0===s[s.length-1].width&&s.pop(),s[s.length-1])},positions:this._getBalloonPositions(o)}}_updatePosition(){this._balloon.updatePosition(this._getBalloonPositionData())}destroy(){super.destroy(),this.stopListening(),this._fireSelectionChangeDebounced.cancel(),this.toolbarView.destroy(),this.focusTracker.destroy(),this._resizeObserver&&this._resizeObserver.destroy()}_getBalloonPositions(e){const t=n.env.isSafari&&n.env.isiOS?Jt.generatePositions({heightOffset:Math.max(Jt.arrowHeightOffset,Math.round(20/n.global.window.visualViewport.scale))}):Jt.defaultPositions;return e?[t.northWestArrowSouth,t.northWestArrowSouthWest,t.northWestArrowSouthEast,t.northWestArrowSouthMiddleEast,t.northWestArrowSouthMiddleWest,t.southWestArrowNorth,t.southWestArrowNorthWest,t.southWestArrowNorthEast,t.southWestArrowNorthMiddleWest,t.southWestArrowNorthMiddleEast]:[t.southEastArrowNorth,t.southEastArrowNorthEast,t.southEastArrowNorthWest,t.southEastArrowNorthMiddleEast,t.southEastArrowNorthMiddleWest,t.northEastArrowSouth,t.northEastArrowSouthEast,t.northEastArrowSouthWest,t.northEastArrowSouthMiddleEast,t.northEastArrowSouthMiddleWest]}}const hn=(0,n.toUnit)("px");class mn extends N{constructor(e){super(e);const t=this.bindTemplate;this.isVisible=!1,this.isToggleable=!0,this.set("top",0),this.set("left",0),this.extendTemplate({attributes:{class:"ck-block-toolbar-button",style:{top:t.to("top",(e=>hn(e))),left:t.to("left",(e=>hn(e)))}}})}}const gn=(0,n.toUnit)("px");class fn extends M.Plugin{static get pluginName(){return"BlockToolbar"}constructor(e){super(e),this._resizeObserver=null,this._blockToolbarConfig=We(this.editor.config.get("blockToolbar")),this.toolbarView=this._createToolbarView(),this.panelView=this._createPanelView(),this.buttonView=this._createButtonView(),I({emitter:this.panelView,contextElements:[this.panelView.element,this.buttonView.element],activator:()=>this.panelView.isVisible,callback:()=>this._hidePanel()})}init(){const e=this.editor,t=e.t,i=t("Click to edit block"),n=t("Drag to move"),o=t("Edit block"),s=e.plugins.has("DragDropBlockToolbar"),r=s?`${i}\n${n}`:o;this.buttonView.label=r,s&&(this.buttonView.element.dataset.ckeTooltipClass="ck-tooltip_multi-line"),this.listenTo(e.model.document.selection,"change:range",((e,t)=>{t.directChange&&this._hidePanel()})),this.listenTo(e.ui,"update",(()=>this._updateButton())),this.listenTo(e,"change:isReadOnly",(()=>this._updateButton()),{priority:"low"}),this.listenTo(e.ui.focusTracker,"change:isFocused",(()=>this._updateButton())),this.listenTo(this.buttonView,"change:isVisible",((e,t,i)=>{i?this.buttonView.listenTo(window,"resize",(()=>this._updateButton())):(this.buttonView.stopListening(window,"resize"),this._hidePanel())})),this._repositionButtonOnScroll(),e.ui.addToolbar(this.toolbarView,{beforeFocus:()=>this._showPanel(),afterBlur:()=>this._hidePanel()}),e.ui.once("ready",(()=>{this.toolbarView.fillFromConfig(this._blockToolbarConfig,this.editor.ui.componentFactory);for(const e of this.toolbarView.items)e.on("execute",(()=>this._hidePanel(!0)),{priority:"high"})}))}destroy(){super.destroy(),this.panelView.destroy(),this.buttonView.destroy(),this.toolbarView.destroy(),this._resizeObserver&&this._resizeObserver.destroy()}_createToolbarView(){const e=this.editor.locale.t,t=!this._blockToolbarConfig.shouldNotGroupWhenFull,i=new Ue(this.editor.locale,{shouldGroupWhenFull:t,isFloating:!0});return i.ariaLabel=e("Editor block content toolbar"),i}_createPanelView(){const e=this.editor,t=new Jt(e.locale);return t.content.add(this.toolbarView),t.class="ck-toolbar-container",e.ui.view.body.add(t),e.ui.focusTracker.add(t.element),this.toolbarView.keystrokes.set("Esc",((e,t)=>{this._hidePanel(!0),t()})),t}_createButtonView(){const e=this.editor,t=e.t,i=new mn(e.locale),n=this._blockToolbarConfig.icon,o=He[n]||n||He.dragIndicator;return i.set({label:t("Edit block"),icon:o,withText:!1}),i.bind("isOn").to(this.panelView,"isVisible"),i.bind("tooltip").to(this.panelView,"isVisible",(e=>!e)),this.listenTo(i,"execute",(()=>{this.panelView.isVisible?this._hidePanel(!0):this._showPanel()})),e.ui.view.body.add(i),e.ui.focusTracker.add(i.element),i}_updateButton(){const e=this.editor,t=e.model,i=e.editing.view;if(!e.ui.focusTracker.isFocused)return void this._hideButton();if(!e.model.canEditAt(e.model.document.selection))return void this._hideButton();const n=Array.from(t.document.selection.getSelectedBlocks())[0];if(!n||Array.from(this.toolbarView.items).every((e=>!e.isEnabled)))return void this._hideButton();const o=i.domConverter.mapViewToDom(e.editing.mapper.toViewElement(n));this.buttonView.isVisible=!0,this._setupToolbarResize(),this._attachButtonToElement(o),this.panelView.isVisible&&this._showPanel()}_hideButton(){this.buttonView.isVisible=!1}_showPanel(){if(!this.buttonView.isVisible)return;const e=this.panelView.isVisible;this.panelView.show();const t=this._getSelectedEditableElement();this.toolbarView.maxWidth=this._getToolbarMaxWidth(t),this.panelView.pin({target:this.buttonView.element,limiter:t}),e||this.toolbarView.items.get(0).focus()}_getSelectedEditableElement(){const e=this.editor.model.document.selection.getFirstRange().root.rootName;return this.editor.ui.getEditableElement(e)}_hidePanel(e){this.panelView.isVisible=!1,e&&this.editor.editing.view.focus()}_repositionButtonOnScroll(){const{buttonView:e}=this;let t=!1;const i=()=>{t||(t=!0,n.global.window.requestAnimationFrame((()=>{this._updateButton(),t=!1})))};e.on("change:isVisible",((t,o,s)=>{s?e.listenTo(n.global.document,"scroll",i,{useCapture:!0,usePassive:!0}):e.stopListening(n.global.document,"scroll",i)}))}_attachButtonToElement(e){const t=this.buttonView.element,i=this._getSelectedEditableElement(),o=window.getComputedStyle(e),s=new n.Rect(i),r=parseInt(o.paddingTop,10),a=parseInt(o.lineHeight,10)||1.2*parseInt(o.fontSize,10),l=new n.Rect(t),c=new n.Rect(e);let d;d="ltr"===this.editor.locale.uiLanguageDirection?s.left-l.width:s.right;const u=c.top+r+(a-l.height)/2;l.moveTo(d,u);const h=l.toAbsoluteRect();this.buttonView.top=h.top,this.buttonView.left=h.left,this._clipButtonToViewport(this.buttonView,i)}_clipButtonToViewport(e,t){const i=new n.Rect(e.element),o=new n.Rect(t).getVisible(),s=(...t)=>{e.element.style.clipPath=t.length?`polygon(${t.join(",")})`:""},r=t=>{e.isEnabled=!t,e.element.style.pointerEvents=t?"none":""};if(o&&o.bottom<i.bottom){const e=Math.min(i.height,i.bottom-o.bottom);r(e>=i.height),s("0 0","100% 0",`100% calc(100% - ${gn(e)})`,`0 calc(100% - ${gn(e)}`)}else if(o&&o.top>i.top){const e=Math.min(i.height,o.top-i.top);r(e>=i.height),s(`0 ${gn(e)}`,`100% ${gn(e)}`,"100% 100%","0 100%")}else r(!1),s()}_setupToolbarResize(){const e=this._getSelectedEditableElement();this._blockToolbarConfig.shouldNotGroupWhenFull||(this._resizeObserver&&this._resizeObserver.element!==e&&(this._resizeObserver.destroy(),this._resizeObserver=null),this._resizeObserver||(this._resizeObserver=new n.ResizeObserver(e,(()=>{this.toolbarView.maxWidth=this._getToolbarMaxWidth(e)}))))}_getToolbarMaxWidth(e){const t=new n.Rect(e),i=new n.Rect(this.buttonView.element),o="rtl"===this.editor.locale.uiLanguageDirection?i.left-t.right+i.width:t.left-i.left;return gn(t.width+o)}}class pn extends X{constructor(e){super(e);const t=this.bindTemplate;this.set({withText:!0,role:"menuitem"}),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__button"],"aria-haspopup":!0,"aria-expanded":this.bindTemplate.to("isOn",(e=>String(e))),"data-cke-tooltip-disabled":t.to("isOn")},on:{mouseenter:t.to("mouseenter")}})}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new L;return e.content=me,e.extendTemplate({attributes:{class:"ck-menu-bar__menu__button__arrow"}}),e}}class bn extends P{constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!1),this.set("position","se"),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-menu-bar__menu__panel",t.to("position",(e=>`ck-menu-bar__menu__panel_position_${e}`)),t.if("isVisible","ck-hidden",(e=>!e))],tabindex:"-1"},children:this.children,on:{selectstart:t.to((e=>{"input"!==e.target.tagName.toLocaleLowerCase()&&e.preventDefault()}))}})}focus(e=1){this.children.length&&(1===e?this.children.first.focus():this.children.last.focus())}}class wn extends P{constructor(e){super(e);const t=this.bindTemplate;this.buttonView=new pn(e),this.buttonView.delegate("mouseenter").to(this),this.buttonView.bind("isOn","isEnabled").to(this,"isOpen","isEnabled"),this.panelView=new bn(e),this.panelView.bind("isVisible").to(this,"isOpen"),this.keystrokes=new n.KeystrokeHandler,this.focusTracker=new n.FocusTracker,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("panelPosition","w"),this.set("class",void 0),this.set("parentMenuView",null),this.setTemplate({tag:"div",attributes:{class:["ck","ck-menu-bar__menu",t.to("class"),t.if("isEnabled","ck-disabled",(e=>!e)),t.if("parentMenuView","ck-menu-bar__menu_top-level",(e=>!e))]},children:[this.buttonView,this.panelView]})}render(){super.render(),this.focusTracker.add(this.buttonView.element),this.focusTracker.add(this.panelView.element),this.keystrokes.listenTo(this.element),fi.closeOnEscKey(this),this._repositionPanelOnOpen()}_attachBehaviors(){this.parentMenuView?(fi.openOnButtonClick(this),fi.openOnArrowRightKey(this),fi.closeOnArrowLeftKey(this),fi.closeOnParentClose(this)):(this._propagateArrowKeystrokeEvents(),fi.openAndFocusPanelOnArrowDownKey(this),fi.toggleOnButtonClick(this))}_propagateArrowKeystrokeEvents(){this.keystrokes.set("arrowright",((e,t)=>{this.fire("arrowright"),t()})),this.keystrokes.set("arrowleft",((e,t)=>{this.fire("arrowleft"),t()}))}_repositionPanelOnOpen(){this.on("change:isOpen",((e,t,i)=>{if(!i)return;const n=wn._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions});this.panelView.position=n?n.name:this._panelPositions[0].name}))}focus(){this.buttonView.focus()}get _panelPositions(){const{southEast:e,southWest:t,northEast:i,northWest:n,westSouth:o,eastSouth:s,westNorth:r,eastNorth:a}=pi;return"ltr"===this.locale.uiLanguageDirection?this.parentMenuView?[s,a,o,r]:[e,t,i,n]:this.parentMenuView?[o,r,s,a]:[t,e,n,i]}}wn._getOptimalPosition=n.getOptimalPosition;const vn=wn;class _n extends Je{constructor(e){super(e),this.role="menu",this.items.on("change",this._setItemsCheckSpace.bind(this))}_setItemsCheckSpace(){const e=Array.from(this.items).some((e=>{const t=yn(e);return t&&t.isToggleable}));this.items.forEach((t=>{const i=yn(t);i&&(i.hasCheckSpace=e)}))}}function yn(e){return e instanceof Ke?e.children.map((e=>function(e){return"object"==typeof e&&"buttonView"in e&&e.buttonView instanceof N}(e)?e.buttonView:e)).find((e=>e instanceof X)):null}class kn extends de{constructor(e){super(e),this.set({withText:!0,withKeystroke:!0,tooltip:!1,role:"menuitem"}),this.extendTemplate({attributes:{class:["ck-menu-bar__menu__item__button"]}})}}const Cn=["mouseenter","arrowleft","arrowright","change:isOpen"];class An extends P{constructor(e){super(e),this.menus=[];const t=e.t,i=this.bindTemplate;this.set({isOpen:!1,isFocusBorderEnabled:!1}),this._setupIsOpenUpdater(),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-menu-bar",i.if("isFocusBorderEnabled","ck-menu-bar_focus-border-enabled")],"aria-label":t("Editor menu bar"),role:"menubar"},children:this.children})}fillFromConfig(e,t,i=[]){const n=vi({normalizedConfig:e,locale:this.locale,componentFactory:t,extraItems:i}).items.map((e=>this._createMenu({componentFactory:t,menuDefinition:e})));this.children.addMany(n)}render(){super.render(),gi.toggleMenusAndFocusItemsOnHover(this),gi.closeMenusWhenTheBarCloses(this),gi.closeMenuWhenAnotherOnTheSameLevelOpens(this),gi.focusCycleMenusOnArrows(this),gi.closeOnClickOutside(this),gi.enableFocusHighlightOnInteraction(this)}focus(){this.children.first&&this.children.first.focus()}close(){for(const e of this.children)e.isOpen=!1}registerMenu(e,t=null){t?(e.delegate(...Cn).to(t),e.parentMenuView=t):e.delegate(...Cn).to(this,(e=>"menu:"+e)),e._attachBehaviors(),this.menus.push(e)}_createMenu({componentFactory:e,menuDefinition:t,parentMenuView:i}){const n=this.locale,o=new vn(n);return this.registerMenu(o,i),o.buttonView.set({label:t.label}),o.once("change:isOpen",(()=>{const i=new _n(n);i.ariaLabel=t.label,o.panelView.children.add(i),i.items.addMany(this._createMenuItems({menuDefinition:t,parentMenuView:o,componentFactory:e}))})),o}_createMenuItems({menuDefinition:e,parentMenuView:t,componentFactory:i}){const n=this.locale,o=[];for(const s of e.groups){for(const e of s.items){const s=new hi(n,t);if((0,r.A)(e))s.children.add(this._createMenu({componentFactory:i,menuDefinition:e,parentMenuView:t}));else{const n=this._createMenuItemContentFromFactory({componentName:e,componentFactory:i,parentMenuView:t});if(!n)continue;s.children.add(n)}o.push(s)}s!==e.groups[e.groups.length-1]&&o.push(new Ge(n))}return o}_createMenuItemContentFromFactory({componentName:e,parentMenuView:t,componentFactory:i}){const o=i.create(e);return o instanceof vn||o instanceof te||o instanceof kn?(this._registerMenuTree(o,t),o.on("execute",(()=>{this.close()})),o):((0,n.logWarning)("menu-bar-component-unsupported",{componentName:e,componentView:o}),null)}_registerMenuTree(e,t){if(!(e instanceof vn))return void e.delegate("mouseenter").to(t);this.registerMenu(e,t);const i=e.panelView.children.filter((e=>e instanceof _n))[0];if(!i)return void e.delegate("mouseenter").to(t);const n=i.items.filter((e=>e instanceof Ke));for(const t of n)this._registerMenuTree(t.children.get(0),e)}_setupIsOpenUpdater(){let e;this.on("menu:change:isOpen",((t,i,n)=>{clearTimeout(e),n?this.isOpen=!0:e=setTimeout((()=>{this.isOpen=Array.from(this.children).some((e=>e.isOpen))}),0)}))}}},8511:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Undo:()=>m,UndoEditing:()=>d,UndoUI:()=>h});var n=i(1024),o=i(151);class s extends n.Command{constructor(e){super(e),this._stack=[],this._createdBatches=new WeakSet,this.refresh(),this._isEnabledBasedOnSelection=!1,this.listenTo(e.data,"set",((e,t)=>{t[1]={...t[1]};const i=t[1];i.batchType||(i.batchType={isUndoable:!1})}),{priority:"high"}),this.listenTo(e.data,"set",((e,t)=>{t[1].batchType.isUndoable||this.clearStack()}))}refresh(){this.isEnabled=this._stack.length>0}get createdBatches(){return this._createdBatches}addBatch(e){const t=this.editor.model.document.selection,i={ranges:t.hasOwnRange?Array.from(t.getRanges()):[],isBackward:t.isBackward};this._stack.push({batch:e,selection:i}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(e,t,i){const n=this.editor.model,o=n.document,s=[],l=e.map((e=>e.getTransformedByOperations(i))),c=l.flat();for(const e of l){const t=e.filter((e=>e.root!=o.graveyard)).filter((e=>!a(e,c)));t.length&&(r(t),s.push(t[0]))}s.length&&n.change((e=>{e.setSelection(s,{backward:t})}))}_undo(e,t){const i=this.editor.model,n=i.document;this._createdBatches.add(t);const s=e.operations.slice().filter((e=>e.isDocumentOperation));s.reverse();for(const e of s){const s=e.baseVersion+1,r=Array.from(n.history.getOperations(s)),a=(0,o.transformSets)([e.getReversed()],r,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(let s of a){const r=s.affectedSelectable;r&&!i.canEditAt(r)&&(s=new o.NoOperation(s.baseVersion)),t.addOperation(s),i.applyOperation(s),n.history.setOperationAsUndone(e,s)}}}}function r(e){e.sort(((e,t)=>e.start.isBefore(t.start)?-1:1));for(let t=1;t<e.length;t++){const i=e[t-1].getJoined(e[t],!0);i&&(t--,e.splice(t,2,i))}}function a(e,t){return t.some((t=>t!==e&&t.containsRange(e,!0)))}class l extends s{execute(e=null){const t=e?this._stack.findIndex((t=>t.batch==e)):this._stack.length-1,i=this._stack.splice(t,1)[0],n=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(n,(()=>{this._undo(i.batch,n);const e=this.editor.model.document.history.getOperations(i.batch.baseVersion);this._restoreSelection(i.selection.ranges,i.selection.isBackward,e)})),this.fire("revert",i.batch,n),this.refresh()}}class c extends s{execute(){const e=this._stack.pop(),t=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(t,(()=>{const i=e.batch.operations[e.batch.operations.length-1].baseVersion+1,n=this.editor.model.document.history.getOperations(i);this._restoreSelection(e.selection.ranges,e.selection.isBackward,n),this._undo(e.batch,t)})),this.refresh()}}class d extends n.Plugin{constructor(){super(...arguments),this._batchRegistry=new WeakSet}static get pluginName(){return"UndoEditing"}init(){const e=this.editor,t=e.t;this._undoCommand=new l(e),this._redoCommand=new c(e),e.commands.add("undo",this._undoCommand),e.commands.add("redo",this._redoCommand),this.listenTo(e.model,"applyOperation",((e,t)=>{const i=t[0];if(!i.isDocumentOperation)return;const n=i.batch,o=this._redoCommand.createdBatches.has(n),s=this._undoCommand.createdBatches.has(n);this._batchRegistry.has(n)||(this._batchRegistry.add(n),n.isUndoable&&(o?this._undoCommand.addBatch(n):s||(this._undoCommand.addBatch(n),this._redoCommand.clearStack())))}),{priority:"highest"}),this.listenTo(this._undoCommand,"revert",((e,t,i)=>{this._redoCommand.addBatch(i)})),e.keystrokes.set("CTRL+Z","undo"),e.keystrokes.set("CTRL+Y","redo"),e.keystrokes.set("CTRL+SHIFT+Z","redo"),e.accessibility.addKeystrokeInfos({keystrokes:[{label:t("Undo"),keystroke:"CTRL+Z"},{label:t("Redo"),keystroke:[["CTRL+Y"],["CTRL+SHIFT+Z"]]}]})}}var u=i(7243);class h extends n.Plugin{static get pluginName(){return"UndoUI"}init(){const e=this.editor,t=e.locale,i=e.t,o="ltr"==t.uiLanguageDirection?n.icons.undo:n.icons.redo,s="ltr"==t.uiLanguageDirection?n.icons.redo:n.icons.undo;this._addButtonsToFactory("undo",i("Undo"),"CTRL+Z",o),this._addButtonsToFactory("redo",i("Redo"),"CTRL+Y",s)}_addButtonsToFactory(e,t,i,n){const o=this.editor;o.ui.componentFactory.add(e,(()=>{const o=this._createButton(u.ButtonView,e,t,i,n);return o.set({tooltip:!0}),o})),o.ui.componentFactory.add("menuBar:"+e,(()=>this._createButton(u.MenuBarMenuListItemButtonView,e,t,i,n)))}_createButton(e,t,i,n,o){const s=this.editor,r=s.locale,a=s.commands.get(t),l=new e(r);return l.set({label:i,icon:o,keystroke:n}),l.bind("isEnabled").to(a,"isEnabled"),this.listenTo(l,"execute",(()=>{s.execute(t),s.editing.view.focus()})),l}}class m extends n.Plugin{static get requires(){return[d,h]}static get pluginName(){return"Undo"}}},4857:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Base64UploadAdapter:()=>l,FileRepository:()=>r,SimpleUploadAdapter:()=>d});var n=i(1024),o=i(7906);class s extends((0,o.ObservableMixin)()){constructor(){super();const e=new window.FileReader;this._reader=e,this._data=void 0,this.set("loaded",0),e.onprogress=e=>{this.loaded=e.loaded}}get error(){return this._reader.error}get data(){return this._data}read(e){const t=this._reader;return this.total=e.size,new Promise(((i,n)=>{t.onload=()=>{const e=t.result;this._data=e,i(e)},t.onerror=()=>{n("error")},t.onabort=()=>{n("aborted")},this._reader.readAsDataURL(e)}))}abort(){this._reader.abort()}}class r extends n.Plugin{constructor(){super(...arguments),this.loaders=new o.Collection,this._loadersMap=new Map,this._pendingAction=null}static get pluginName(){return"FileRepository"}static get requires(){return[n.PendingActions]}init(){this.loaders.on("change",(()=>this._updatePendingAction())),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",((e,t)=>t?e/t*100:0))}getLoader(e){return this._loadersMap.get(e)||null}createLoader(e){if(!this.createUploadAdapter)return(0,o.logWarning)("filerepository-no-upload-adapter"),null;const t=new a(Promise.resolve(e),this.createUploadAdapter);return this.loaders.add(t),this._loadersMap.set(e,t),e instanceof Promise&&t.file.then((e=>{this._loadersMap.set(e,t)})).catch((()=>{})),t.on("change:uploaded",(()=>{let e=0;for(const t of this.loaders)e+=t.uploaded;this.uploaded=e})),t.on("change:uploadTotal",(()=>{let e=0;for(const t of this.loaders)t.uploadTotal&&(e+=t.uploadTotal);this.uploadTotal=e})),t}destroyLoader(e){const t=e instanceof a?e:this.getLoader(e);t._destroy(),this.loaders.remove(t),this._loadersMap.forEach(((e,i)=>{e===t&&this._loadersMap.delete(i)}))}_updatePendingAction(){const e=this.editor.plugins.get(n.PendingActions);if(this.loaders.length){if(!this._pendingAction){const t=this.editor.t,i=e=>`${t("Upload in progress")} ${parseInt(e)}%.`;this._pendingAction=e.add(i(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",i)}}else e.remove(this._pendingAction),this._pendingAction=null}}class a extends((0,o.ObservableMixin)()){constructor(e,t){super(),this.id=(0,o.uid)(),this._filePromiseWrapper=this._createFilePromiseWrapper(e),this._adapter=t(this),this._reader=new s,this.set("status","idle"),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",((e,t)=>t?e/t*100:0)),this.set("uploadResponse",null)}get file(){return this._filePromiseWrapper?this._filePromiseWrapper.promise.then((e=>this._filePromiseWrapper?e:null)):Promise.resolve(null)}get data(){return this._reader.data}read(){if("idle"!=this.status)throw new o.CKEditorError("filerepository-read-wrong-status",this);return this.status="reading",this.file.then((e=>this._reader.read(e))).then((e=>{if("reading"!==this.status)throw this.status;return this.status="idle",e})).catch((e=>{if("aborted"===e)throw this.status="aborted","aborted";throw this.status="error",this._reader.error?this._reader.error:e}))}upload(){if("idle"!=this.status)throw new o.CKEditorError("filerepository-upload-wrong-status",this);return this.status="uploading",this.file.then((()=>this._adapter.upload())).then((e=>(this.uploadResponse=e,this.status="idle",e))).catch((e=>{if("aborted"===this.status)throw"aborted";throw this.status="error",e}))}abort(){const e=this.status;this.status="aborted",this._filePromiseWrapper.isFulfilled?"reading"==e?this._reader.abort():"uploading"==e&&this._adapter.abort&&this._adapter.abort():(this._filePromiseWrapper.promise.catch((()=>{})),this._filePromiseWrapper.rejecter("aborted")),this._destroy()}_destroy(){this._filePromiseWrapper=void 0,this._reader=void 0,this._adapter=void 0,this.uploadResponse=void 0}_createFilePromiseWrapper(e){const t={};return t.promise=new Promise(((i,n)=>{t.rejecter=n,t.isFulfilled=!1,e.then((e=>{t.isFulfilled=!0,i(e)})).catch((e=>{t.isFulfilled=!0,n(e)}))})),t}}class l extends n.Plugin{static get requires(){return[r]}static get pluginName(){return"Base64UploadAdapter"}init(){this.editor.plugins.get(r).createUploadAdapter=e=>new c(e)}}class c{constructor(e){this.loader=e}upload(){return new Promise(((e,t)=>{const i=this.reader=new window.FileReader;i.addEventListener("load",(()=>{e({default:i.result})})),i.addEventListener("error",(e=>{t(e)})),i.addEventListener("abort",(()=>{t()})),this.loader.file.then((e=>{i.readAsDataURL(e)}))}))}abort(){this.reader.abort()}}class d extends n.Plugin{static get requires(){return[r]}static get pluginName(){return"SimpleUploadAdapter"}init(){const e=this.editor.config.get("simpleUpload");e&&(e.uploadUrl?this.editor.plugins.get(r).createUploadAdapter=t=>new u(t,e):(0,o.logWarning)("simple-upload-adapter-missing-uploadurl"))}}class u{constructor(e,t){this.loader=e,this.options=t}upload(){return this.loader.file.then((e=>new Promise(((t,i)=>{this._initRequest(),this._initListeners(t,i,e),this._sendRequest(e)}))))}abort(){this.xhr&&this.xhr.abort()}_initRequest(){const e=this.xhr=new XMLHttpRequest;e.open("POST",this.options.uploadUrl,!0),e.responseType="json"}_initListeners(e,t,i){const n=this.xhr,o=this.loader,s=`Couldn't upload file: ${i.name}.`;n.addEventListener("error",(()=>t(s))),n.addEventListener("abort",(()=>t())),n.addEventListener("load",(()=>{const i=n.response;if(!i||i.error)return t(i&&i.error&&i.error.message?i.error.message:s);const o=i.url?{default:i.url}:i.urls;e({...i,urls:o})})),n.upload&&n.upload.addEventListener("progress",(e=>{e.lengthComputable&&(o.uploadTotal=e.total,o.uploaded=e.loaded)}))}_sendRequest(e){const t=this.options.headers||{},i=this.options.withCredentials||!1;for(const e of Object.keys(t))this.xhr.setRequestHeader(e,t[e]);this.xhr.withCredentials=i;const n=new FormData;n.append("upload",e),this.xhr.send(n)}}},7906:(e,t,i)=>{"use strict";let n;i.r(t),i.d(t,{CKEditorError:()=>P,Collection:()=>St,Config:()=>_e,DomEmitterMixin:()=>xe,ElementReplacer:()=>ae,EmitterMixin:()=>z,EventInfo:()=>k,FocusTracker:()=>Rt,KeystrokeHandler:()=>Bt,Locale:()=>It,ObservableMixin:()=>te,Rect:()=>Fe,ResizeObserver:()=>Ue,abortableDebounce:()=>le,compareArrays:()=>de,count:()=>ce,createElement:()=>pe,delay:()=>zt,diff:()=>v,diffToChanges:()=>_,env:()=>a,exponentialDelay:()=>Ft,fastDiff:()=>p,findClosestScrollableAncestor:()=>Ie,first:()=>Vt,getAncestors:()=>Se,getBorderWidths:()=>Re,getCode:()=>wt,getDataFromElement:()=>Ve,getEnvKeystrokeText:()=>_t,getLanguageDirection:()=>xt,getLocalizedArrowKeyCodeDirection:()=>kt,getOptimalPosition:()=>Ye,global:()=>o,indexOf:()=>qe,insertAt:()=>Ke,insertToPriorityArray:()=>x,isArrowKeyCode:()=>yt,isCombiningMark:()=>Ht,isComment:()=>Ge,isForwardArrowKeyCode:()=>Ct,isHighSurrogateHalf:()=>Ut,isInsideCombinedSymbol:()=>qt,isInsideEmojiSequence:()=>Gt,isInsideSurrogatePair:()=>jt,isIterable:()=>ue,isLowSurrogateHalf:()=>$t,isNode:()=>Ce,isRange:()=>Me,isText:()=>Be,isValidAttributeName:()=>Ze,isVisible:()=>Je,keyCodes:()=>pt,logError:()=>S,logWarning:()=>I,mix:()=>y,parseKeystroke:()=>vt,priorities:()=>E,releaseDate:()=>O,remove:()=>tt,retry:()=>Lt,scrollAncestorsToShowTarget:()=>nt,scrollViewportToShowTarget:()=>it,setDataInElement:()=>$e,spliceArray:()=>Dt,toArray:()=>Tt,toMap:()=>Mt,toUnit:()=>je,uid:()=>A,verifyLicense:()=>Wt,version:()=>M,wait:()=>Ot});try{n={window,document}}catch(e){n={window:{},document:{}}}const o=n;function s(){try{return navigator.userAgent.toLowerCase()}catch(e){return""}}const r=s(),a={isMac:l(r),isWindows:c(r),isGecko:d(r),isSafari:u(r),isiOS:h(r),isAndroid:m(r),isBlink:g(r),get isMediaForcedColors(){return!!o.window.matchMedia&&o.window.matchMedia("(forced-colors: active)").matches},get isMotionReduced(){return!!o.window.matchMedia&&o.window.matchMedia("(prefers-reduced-motion)").matches},features:{isRegExpUnicodePropertySupported:f()}};function l(e){return e.indexOf("macintosh")>-1}function c(e){return e.indexOf("windows")>-1}function d(e){return!!e.match(/gecko\/\d+/)}function u(e){return e.indexOf(" applewebkit/")>-1&&-1===e.indexOf("chrome")}function h(e){return!!e.match(/iphone|ipad/i)||l(e)&&navigator.maxTouchPoints>0}function m(e){return e.indexOf("android")>-1}function g(e){return e.indexOf("chrome/")>-1&&e.indexOf("edge/")<0}function f(){let e=!1;try{e=0==="ć".search(new RegExp("[\\p{L}]","u"))}catch(e){}return e}function p(e,t,i,n){i=i||function(e,t){return e===t};const o=Array.isArray(e)?e:Array.prototype.slice.call(e),s=Array.isArray(t)?t:Array.prototype.slice.call(t),r=function(e,t,i){const n=b(e,t,i);if(-1===n)return{firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};const o=b(w(e,n),w(t,n),i);return{firstIndex:n,lastIndexOld:e.length-o,lastIndexNew:t.length-o}}(o,s,i),a=n?function(e,t){const{firstIndex:i,lastIndexOld:n,lastIndexNew:o}=e;if(-1===i)return Array(t).fill("equal");let s=[];return i>0&&(s=s.concat(Array(i).fill("equal"))),o-i>0&&(s=s.concat(Array(o-i).fill("insert"))),n-i>0&&(s=s.concat(Array(n-i).fill("delete"))),o<t&&(s=s.concat(Array(t-o).fill("equal"))),s}(r,s.length):function(e,t){const i=[],{firstIndex:n,lastIndexOld:o,lastIndexNew:s}=t;return s-n>0&&i.push({index:n,type:"insert",values:e.slice(n,s)}),o-n>0&&i.push({index:n+(s-n),type:"delete",howMany:o-n}),i}(s,r);return a}function b(e,t,i){for(let n=0;n<Math.max(e.length,t.length);n++)if(void 0===e[n]||void 0===t[n]||!i(e[n],t[n]))return n;return-1}function w(e,t){return e.slice(t).reverse()}function v(e,t,i){i=i||function(e,t){return e===t};const n=e.length,o=t.length;if(n>200||o>200||n+o>300)return v.fastDiff(e,t,i,!0);let s,r;if(o<n){const i=e;e=t,t=i,s="delete",r="insert"}else s="insert",r="delete";const a=e.length,l=t.length,c=l-a,d={},u={};function h(n){const o=(void 0!==u[n-1]?u[n-1]:-1)+1,c=void 0!==u[n+1]?u[n+1]:-1,h=o>c?-1:1;d[n+h]&&(d[n]=d[n+h].slice(0)),d[n]||(d[n]=[]),d[n].push(o>c?s:r);let m=Math.max(o,c),g=m-n;for(;g<a&&m<l&&i(e[g],t[m]);)g++,m++,d[n].push("equal");return m}let m,g=0;do{for(m=-g;m<c;m++)u[m]=h(m);for(m=c+g;m>c;m--)u[m]=h(m);u[c]=h(c),g++}while(u[c]!==l);return d[c].slice(1)}function _(e,t){const i=[];let n=0,o=null;return e.forEach((e=>{"equal"==e?(s(),n++):"insert"==e?(o&&"insert"==o.type?o.values.push(t[n]):(s(),o={type:"insert",index:n,values:[t[n]]}),n++):o&&"delete"==o.type?o.howMany++:(s(),o={type:"delete",index:n,howMany:1})})),s(),i;function s(){o&&(i.push(o),o=null)}}function y(e,...t){t.forEach((t=>{const i=Object.getOwnPropertyNames(t),n=Object.getOwnPropertySymbols(t);i.concat(n).forEach((i=>{if(i in e.prototype)return;if("function"==typeof t&&("length"==i||"name"==i||"prototype"==i))return;const n=Object.getOwnPropertyDescriptor(t,i);n.enumerable=!1,Object.defineProperty(e.prototype,i,n)}))}))}v.fastDiff=p;class k{constructor(e,t){this.source=e,this.name=t,this.path=[],this.stop=function e(){e.called=!0},this.off=function e(){e.called=!0}}}const C=new Array(256).fill("").map(((e,t)=>("0"+t.toString(16)).slice(-2)));function A(){const e=4294967296*Math.random()>>>0,t=4294967296*Math.random()>>>0,i=4294967296*Math.random()>>>0,n=4294967296*Math.random()>>>0;return"e"+C[e>>0&255]+C[e>>8&255]+C[e>>16&255]+C[e>>24&255]+C[t>>0&255]+C[t>>8&255]+C[t>>16&255]+C[t>>24&255]+C[i>>0&255]+C[i>>8&255]+C[i>>16&255]+C[i>>24&255]+C[n>>0&255]+C[n>>8&255]+C[n>>16&255]+C[n>>24&255]}const E={get(e="normal"){return"number"!=typeof e?this[e]||this.normal:e},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5};function x(e,t){const i=E.get(t.priority);for(let n=0;n<e.length;n++)if(E.get(e[n].priority)<i)return void e.splice(n,0,t);e.push(t)}const T="https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html";class P extends Error{constructor(e,t,i){super(function(e,t){const i=new WeakSet;return e+(t?` ${JSON.stringify(t,((e,t)=>{if("object"==typeof t&&null!==t){if(i.has(t))return`[object ${t.constructor.name}]`;i.add(t)}return t}))}`:"")+V(e)}(e,i)),this.name="CKEditorError",this.context=t,this.data=i}is(e){return"CKEditorError"===e}static rethrowUnexpectedError(e,t){if(e.is&&e.is("CKEditorError"))throw e;const i=new P(e.message,t);throw i.stack=e.stack,i}}function I(e,t){console.warn(...R(e,t))}function S(e,t){console.error(...R(e,t))}function V(e){return`\nRead more: ${T}#error-${e}`}function R(e,t){const i=V(e);return t?[e,t,i]:[e,i]}const B="43.0.0",M=B,O=new Date(2024,7,7);if(globalThis.CKEDITOR_VERSION)throw new P("ckeditor-duplicated-modules",null);globalThis.CKEDITOR_VERSION=B;const L=Symbol("listeningTo"),F=Symbol("emitterId"),N=Symbol("delegations"),D=z(Object);function z(e){return e?class extends e{on(e,t,i){this.listenTo(this,e,t,i)}once(e,t,i){let n=!1;this.listenTo(this,e,((e,...i)=>{n||(n=!0,e.off(),t.call(this,e,...i))}),i)}off(e,t){this.stopListening(this,e,t)}listenTo(e,t,i,n={}){let o,s;this[L]||(this[L]={});const r=this[L];H(e)||W(e);const a=H(e);(o=r[a])||(o=r[a]={emitter:e,callbacks:{}}),(s=o.callbacks[t])||(s=o.callbacks[t]=[]),s.push(i),function(e,t,i,n,o){t._addEventListener?t._addEventListener(i,n,o):e._addEventListener.call(t,i,n,o)}(this,e,t,i,n)}stopListening(e,t,i){const n=this[L];let o=e&&H(e);const s=n&&o?n[o]:void 0,r=s&&t?s.callbacks[t]:void 0;if(!(!n||e&&!s||t&&!r))if(i)K(this,e,t,i),-1!==r.indexOf(i)&&(1===r.length?delete s.callbacks[t]:K(this,e,t,i));else if(r){for(;i=r.pop();)K(this,e,t,i);delete s.callbacks[t]}else if(s){for(t in s.callbacks)this.stopListening(e,t);delete n[o]}else{for(o in n)this.stopListening(n[o].emitter);delete this[L]}}fire(e,...t){try{const i=e instanceof k?e:new k(this,e),n=i.name;let o=j(this,n);if(i.path.push(this),o){const e=[i,...t];o=Array.from(o);for(let t=0;t<o.length&&(o[t].callback.apply(this,e),i.off.called&&(delete i.off.called,this._removeEventListener(n,o[t].callback)),!i.stop.called);t++);}const s=this[N];if(s){const e=s.get(n),o=s.get("*");e&&q(e,i,t),o&&q(o,i,t)}return i.return}catch(e){P.rethrowUnexpectedError(e,this)}}delegate(...e){return{to:(t,i)=>{this[N]||(this[N]=new Map),e.forEach((e=>{const n=this[N].get(e);n?n.set(t,i):this[N].set(e,new Map([[t,i]]))}))}}}stopDelegating(e,t){if(this[N])if(e)if(t){const i=this[N].get(e);i&&i.delete(t)}else this[N].delete(e);else this[N].clear()}_addEventListener(e,t,i){!function(e,t){const i=U(e);if(i[t])return;let n=t,o=null;const s=[];for(;""!==n&&!i[n];)i[n]={callbacks:[],childEvents:[]},s.push(i[n]),o&&i[n].childEvents.push(o),o=n,n=n.substr(0,n.lastIndexOf(":"));if(""!==n){for(const e of s)e.callbacks=i[n].callbacks.slice();i[n].childEvents.push(o)}}(this,e);const n=$(this,e),o={callback:t,priority:E.get(i.priority)};for(const e of n)x(e,o)}_removeEventListener(e,t){const i=$(this,e);for(const e of i)for(let i=0;i<e.length;i++)e[i].callback==t&&(e.splice(i,1),i--)}}:D}function W(e,t){e[F]||(e[F]=t||A())}function H(e){return e[F]}function U(e){return e._events||Object.defineProperty(e,"_events",{value:{}}),e._events}function $(e,t){const i=U(e)[t];if(!i)return[];let n=[i.callbacks];for(let t=0;t<i.childEvents.length;t++){const o=$(e,i.childEvents[t]);n=n.concat(o)}return n}function j(e,t){let i;return e._events&&(i=e._events[t])&&i.callbacks.length?i.callbacks:t.indexOf(":")>-1?j(e,t.substr(0,t.lastIndexOf(":"))):null}function q(e,t,i){for(let[n,o]of e){o?"function"==typeof o&&(o=o(t.name)):o=t.name;const e=new k(t.source,o);e.path=[...t.path],n.fire(e,...i)}}function K(e,t,i,n){t._removeEventListener?t._removeEventListener(i,n):e._removeEventListener.call(t,i,n)}["on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach((e=>{z[e]=D.prototype[e]}));var G=i(3149);const Z=Symbol("observableProperties"),J=Symbol("boundObservables"),Q=Symbol("boundProperties"),Y=Symbol("decoratedMethods"),X=Symbol("decoratedOriginal"),ee=te(z());function te(e){return e?class extends e{set(e,t){if((0,G.A)(e))return void Object.keys(e).forEach((t=>{this.set(t,e[t])}),this);ie(this);const i=this[Z];if(e in this&&!i.has(e))throw new P("observable-set-cannot-override",this);Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>i.get(e),set(t){const n=i.get(e);let o=this.fire(`set:${e}`,e,t,n);void 0===o&&(o=t),n===o&&i.has(e)||(i.set(e,o),this.fire(`change:${e}`,e,o,n))}}),this[e]=t}bind(...e){if(!e.length||!se(e))throw new P("observable-bind-wrong-properties",this);if(new Set(e).size!==e.length)throw new P("observable-bind-duplicate-properties",this);ie(this);const t=this[Q];e.forEach((e=>{if(t.has(e))throw new P("observable-bind-rebind",this)}));const i=new Map;return e.forEach((e=>{const n={property:e,to:[]};t.set(e,n),i.set(e,n)})),{to:ne,toMany:oe,_observable:this,_bindProperties:e,_to:[],_bindings:i}}unbind(...e){if(!this[Z])return;const t=this[Q],i=this[J];if(e.length){if(!se(e))throw new P("observable-unbind-wrong-properties",this);e.forEach((e=>{const n=t.get(e);n&&(n.to.forEach((([e,t])=>{const o=i.get(e),s=o[t];s.delete(n),s.size||delete o[t],Object.keys(o).length||(i.delete(e),this.stopListening(e,"change"))})),t.delete(e))}))}else i.forEach(((e,t)=>{this.stopListening(t,"change")})),i.clear(),t.clear()}decorate(e){ie(this);const t=this[e];if(!t)throw new P("observablemixin-cannot-decorate-undefined",this,{object:this,methodName:e});this.on(e,((e,i)=>{e.return=t.apply(this,i)})),this[e]=function(...t){return this.fire(e,t)},this[e][X]=t,this[Y]||(this[Y]=[]),this[Y].push(e)}stopListening(e,t,i){if(!e&&this[Y]){for(const e of this[Y])this[e]=this[e][X];delete this[Y]}super.stopListening(e,t,i)}}:ee}function ie(e){e[Z]||(Object.defineProperty(e,Z,{value:new Map}),Object.defineProperty(e,J,{value:new Map}),Object.defineProperty(e,Q,{value:new Map}))}function ne(...e){const t=function(...e){if(!e.length)throw new P("observable-bind-to-parse-error",null);const t={to:[]};let i;return"function"==typeof e[e.length-1]&&(t.callback=e.pop()),e.forEach((e=>{if("string"==typeof e)i.properties.push(e);else{if("object"!=typeof e)throw new P("observable-bind-to-parse-error",null);i={observable:e,properties:[]},t.to.push(i)}})),t}(...e),i=Array.from(this._bindings.keys()),n=i.length;if(!t.callback&&t.to.length>1)throw new P("observable-bind-to-no-callback",this);if(n>1&&t.callback)throw new P("observable-bind-to-extra-callback",this);var o;t.to.forEach((e=>{if(e.properties.length&&e.properties.length!==n)throw new P("observable-bind-to-properties-length",this);e.properties.length||(e.properties=this._bindProperties)})),this._to=t.to,t.callback&&(this._bindings.get(i[0]).callback=t.callback),o=this._observable,this._to.forEach((e=>{const t=o[J];let i;t.get(e.observable)||o.listenTo(e.observable,"change",((n,s)=>{i=t.get(e.observable)[s],i&&i.forEach((e=>{re(o,e.property)}))}))})),function(e){let t;e._bindings.forEach(((i,n)=>{e._to.forEach((o=>{t=o.properties[i.callback?0:e._bindProperties.indexOf(n)],i.to.push([o.observable,t]),function(e,t,i,n){const o=e[J],s=o.get(i),r=s||{};r[n]||(r[n]=new Set),r[n].add(t),s||o.set(i,r)}(e._observable,i,o.observable,t)}))}))}(this),this._bindProperties.forEach((e=>{re(this._observable,e)}))}function oe(e,t,i){if(this._bindings.size>1)throw new P("observable-bind-to-many-not-one-binding",this);this.to(...function(e,t){const i=e.map((e=>[e,t]));return Array.prototype.concat.apply([],i)}(e,t),i)}function se(e){return e.every((e=>"string"==typeof e))}function re(e,t){const i=e[Q].get(t);let n;i.callback?n=i.callback.apply(e,i.to.map((e=>e[0][e[1]]))):(n=i.to[0],n=n[0][n[1]]),Object.prototype.hasOwnProperty.call(e,t)?e[t]=n:e.set(t,n)}["set","bind","unbind","decorate","on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach((e=>{te[e]=ee.prototype[e]}));class ae{constructor(){this._replacedElements=[]}replace(e,t){this._replacedElements.push({element:e,newElement:t}),e.style.display="none",t&&e.parentNode.insertBefore(t,e.nextSibling)}restore(){this._replacedElements.forEach((({element:e,newElement:t})=>{e.style.display="",t&&t.remove()})),this._replacedElements=[]}}function le(e){let t=new AbortController;function i(...i){return t.abort(),t=new AbortController,e(t.signal,...i)}return i.abort=()=>t.abort(),i}function ce(e){let t=0;for(const i of e)t++;return t}function de(e,t){const i=Math.min(e.length,t.length);for(let n=0;n<i;n++)if(e[n]!=t[n])return n;return e.length==t.length?"same":e.length<t.length?"prefix":"extension"}function ue(e){return!(!e||!e[Symbol.iterator])}var he=i(2383),me=i(2049),ge=i(3098);const fe=function(e){return"string"==typeof e||!(0,me.A)(e)&&(0,ge.A)(e)&&"[object String]"==(0,he.A)(e)};function pe(e,t,i={},n=[]){const o=i&&i.xmlns,s=o?e.createElementNS(o,t):e.createElement(t);for(const e in i)s.setAttribute(e,i[e]);!fe(n)&&ue(n)||(n=[n]);for(let t of n)fe(t)&&(t=e.createTextNode(t)),s.appendChild(t);return s}var be=i(4963),we=i(3967),ve=i(1500);class _e{constructor(e,t){this._config={},t&&this.define(ye(t)),e&&this._setObjectToTarget(this._config,e)}set(e,t){this._setToTarget(this._config,e,t)}define(e,t){this._setToTarget(this._config,e,t,!0)}get(e){return this._getFromSource(this._config,e)}*names(){for(const e of Object.keys(this._config))yield e}_setToTarget(e,t,i,n=!1){if((0,be.A)(t))return void this._setObjectToTarget(e,t,n);const o=t.split(".");t=o.pop();for(const t of o)(0,be.A)(e[t])||(e[t]={}),e=e[t];if((0,be.A)(i))return(0,be.A)(e[t])||(e[t]={}),e=e[t],void this._setObjectToTarget(e,i,n);n&&void 0!==e[t]||(e[t]=i)}_getFromSource(e,t){const i=t.split(".");t=i.pop();for(const t of i){if(!(0,be.A)(e[t])){e=null;break}e=e[t]}return e?ye(e[t]):void 0}_setObjectToTarget(e,t,i){Object.keys(t).forEach((n=>{this._setToTarget(e,n,t[n],i)}))}}function ye(e){return(0,we.A)(e,ke)}function ke(e){return(0,ve.A)(e)||"function"==typeof e?e:void 0}function Ce(e){if(e){if(e.defaultView)return e instanceof e.defaultView.Document;if(e.ownerDocument&&e.ownerDocument.defaultView)return e instanceof e.ownerDocument.defaultView.Node}return!1}function Ae(e){const t=Object.prototype.toString.apply(e);return"[object Window]"==t||"[object global]"==t}const Ee=xe(z());function xe(e){return e?class extends e{listenTo(e,t,i,n={}){if(Ce(e)||Ae(e)){const o={capture:!!n.useCapture,passive:!!n.usePassive},s=this._getProxyEmitter(e,o)||new Te(e,o);this.listenTo(s,t,i,n)}else super.listenTo(e,t,i,n)}stopListening(e,t,i){if(Ce(e)||Ae(e)){const n=this._getAllProxyEmitters(e);for(const e of n)this.stopListening(e,t,i)}else super.stopListening(e,t,i)}_getProxyEmitter(e,t){return function(e,t){const i=e[L];return i&&i[t]?i[t].emitter:null}(this,Pe(e,t))}_getAllProxyEmitters(e){return[{capture:!1,passive:!1},{capture:!1,passive:!0},{capture:!0,passive:!1},{capture:!0,passive:!0}].map((t=>this._getProxyEmitter(e,t))).filter((e=>!!e))}}:Ee}["_getProxyEmitter","_getAllProxyEmitters","on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach((e=>{xe[e]=Ee.prototype[e]}));class Te extends(z()){constructor(e,t){super(),W(this,Pe(e,t)),this._domNode=e,this._options=t}attach(e){if(this._domListeners&&this._domListeners[e])return;const t=this._createDomListener(e);this._domNode.addEventListener(e,t,this._options),this._domListeners||(this._domListeners={}),this._domListeners[e]=t}detach(e){let t;!this._domListeners[e]||(t=this._events[e])&&t.callbacks.length||this._domListeners[e].removeListener()}_addEventListener(e,t,i){this.attach(e),z().prototype._addEventListener.call(this,e,t,i)}_removeEventListener(e,t){z().prototype._removeEventListener.call(this,e,t),this.detach(e)}_createDomListener(e){const t=t=>{this.fire(e,t)};return t.removeListener=()=>{this._domNode.removeEventListener(e,t,this._options),delete this._domListeners[e]},t}}function Pe(e,t){let i=function(e){return e["data-ck-expando"]||(e["data-ck-expando"]=A())}(e);for(const e of Object.keys(t).sort())t[e]&&(i+="-"+e);return i}function Ie(e){let t=e.parentElement;if(!t)return null;for(;"BODY"!=t.tagName;){const e=t.style.overflowY||o.window.getComputedStyle(t).overflowY;if("auto"===e||"scroll"===e)break;if(t=t.parentElement,!t)return null}return t}function Se(e){const t=[];let i=e;for(;i&&i.nodeType!=Node.DOCUMENT_NODE;)t.unshift(i),i=i.parentNode;return t}function Ve(e){return e instanceof HTMLTextAreaElement?e.value:e.innerHTML}function Re(e){const t=e.ownerDocument.defaultView.getComputedStyle(e);return{top:parseInt(t.borderTopWidth,10),right:parseInt(t.borderRightWidth,10),bottom:parseInt(t.borderBottomWidth,10),left:parseInt(t.borderLeftWidth,10)}}function Be(e){return"[object Text]"==Object.prototype.toString.call(e)}function Me(e){return"[object Range]"==Object.prototype.toString.apply(e)}function Oe(e){return e&&e.parentNode?e.offsetParent===o.document.body?null:e.offsetParent:null}const Le=["top","right","bottom","left","width","height"];class Fe{constructor(e){const t=Me(e);if(Object.defineProperty(this,"_source",{value:e._source||e,writable:!0,enumerable:!1}),ze(e)||t)if(t){const t=Fe.getDomRangeRects(e);Ne(this,Fe.getBoundingRect(t))}else Ne(this,e.getBoundingClientRect());else if(Ae(e)){const{innerWidth:t,innerHeight:i}=e;Ne(this,{top:0,right:t,bottom:i,left:0,width:t,height:i})}else Ne(this,e)}clone(){return new Fe(this)}moveTo(e,t){return this.top=t,this.right=e+this.width,this.bottom=t+this.height,this.left=e,this}moveBy(e,t){return this.top+=t,this.right+=e,this.left+=e,this.bottom+=t,this}getIntersection(e){const t={top:Math.max(this.top,e.top),right:Math.min(this.right,e.right),bottom:Math.min(this.bottom,e.bottom),left:Math.max(this.left,e.left),width:0,height:0};if(t.width=t.right-t.left,t.height=t.bottom-t.top,t.width<0||t.height<0)return null;{const e=new Fe(t);return e._source=this._source,e}}getIntersectionArea(e){const t=this.getIntersection(e);return t?t.getArea():0}getArea(){return this.width*this.height}getVisible(){const e=this._source;let t=this.clone();if(De(e))return t;let i,n=e,o=e.parentNode||e.commonAncestorContainer;for(;o&&!De(o);){const e="visible"===((s=o)instanceof HTMLElement?s.ownerDocument.defaultView.getComputedStyle(s).overflow:"visible");n instanceof HTMLElement&&"absolute"===We(n)&&(i=n);const r=We(o);if(e||i&&("relative"===r&&e||"relative"!==r)){n=o,o=o.parentNode;continue}const a=new Fe(o),l=t.getIntersection(a);if(!l)return null;l.getArea()<t.getArea()&&(t=l),n=o,o=o.parentNode}var s;return t}isEqual(e){for(const t of Le)if(this[t]!==e[t])return!1;return!0}contains(e){const t=this.getIntersection(e);return!(!t||!t.isEqual(e))}toAbsoluteRect(){const{scrollX:e,scrollY:t}=o.window,i=this.clone().moveBy(e,t);if(ze(i._source)){const e=Oe(i._source);e&&function(e,t){const i=new Fe(t),n=Re(t);let o=0,s=0;o-=i.left,s-=i.top,o+=t.scrollLeft,s+=t.scrollTop,o-=n.left,s-=n.top,e.moveBy(o,s)}(i,e)}return i}excludeScrollbarsAndBorders(){const e=this._source;let t,i,n;if(Ae(e))t=e.innerWidth-e.document.documentElement.clientWidth,i=e.innerHeight-e.document.documentElement.clientHeight,n=e.getComputedStyle(e.document.documentElement).direction;else{const o=Re(e);t=e.offsetWidth-e.clientWidth-o.left-o.right,i=e.offsetHeight-e.clientHeight-o.top-o.bottom,n=e.ownerDocument.defaultView.getComputedStyle(e).direction,this.left+=o.left,this.top+=o.top,this.right-=o.right,this.bottom-=o.bottom,this.width=this.right-this.left,this.height=this.bottom-this.top}return this.width-=t,"ltr"===n?this.right-=t:this.left+=t,this.height-=i,this.bottom-=i,this}static getDomRangeRects(e){const t=[],i=Array.from(e.getClientRects());if(i.length)for(const e of i)t.push(new Fe(e));else{let i=e.startContainer;Be(i)&&(i=i.parentNode);const n=new Fe(i.getBoundingClientRect());n.right=n.left,n.width=0,t.push(n)}return t}static getBoundingRect(e){const t={left:Number.POSITIVE_INFINITY,top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,width:0,height:0};let i=0;for(const n of e)i++,t.left=Math.min(t.left,n.left),t.top=Math.min(t.top,n.top),t.right=Math.max(t.right,n.right),t.bottom=Math.max(t.bottom,n.bottom);return 0==i?null:(t.width=t.right-t.left,t.height=t.bottom-t.top,new Fe(t))}}function Ne(e,t){for(const i of Le)e[i]=t[i]}function De(e){return!!ze(e)&&e===e.ownerDocument.body}function ze(e){return null!==e&&"object"==typeof e&&1===e.nodeType&&"function"==typeof e.getBoundingClientRect}function We(e){return e instanceof HTMLElement?e.ownerDocument.defaultView.getComputedStyle(e).position:"static"}class He{constructor(e,t){He._observerInstance||He._createObserver(),this._element=e,this._callback=t,He._addElementCallback(e,t),He._observerInstance.observe(e)}get element(){return this._element}destroy(){He._deleteElementCallback(this._element,this._callback)}static _addElementCallback(e,t){He._elementCallbacks||(He._elementCallbacks=new Map);let i=He._elementCallbacks.get(e);i||(i=new Set,He._elementCallbacks.set(e,i)),i.add(t)}static _deleteElementCallback(e,t){const i=He._getElementCallbacks(e);i&&(i.delete(t),i.size||(He._elementCallbacks.delete(e),He._observerInstance.unobserve(e))),He._elementCallbacks&&!He._elementCallbacks.size&&(He._observerInstance=null,He._elementCallbacks=null)}static _getElementCallbacks(e){return He._elementCallbacks?He._elementCallbacks.get(e):null}static _createObserver(){He._observerInstance=new o.window.ResizeObserver((e=>{for(const t of e){const e=He._getElementCallbacks(t.target);if(e)for(const i of e)i(t)}}))}}He._observerInstance=null,He._elementCallbacks=null;const Ue=He;function $e(e,t){e instanceof HTMLTextAreaElement&&(e.value=t),e.innerHTML=t}function je(e){return t=>t+e}function qe(e){let t=0;for(;e.previousSibling;)e=e.previousSibling,t++;return t}function Ke(e,t,i){e.insertBefore(i,e.childNodes[t]||null)}function Ge(e){return e&&e.nodeType===Node.COMMENT_NODE}function Ze(e){try{o.document.createAttribute(e)}catch(e){return!1}return!0}function Je(e){return!!(e&&e.getClientRects&&e.getClientRects().length)}var Qe=i(9610);function Ye({element:e,target:t,positions:i,limiter:n,fitInViewport:s,viewportOffsetConfig:r}){(0,Qe.A)(t)&&(t=t()),(0,Qe.A)(n)&&(n=n());const a=Oe(e),l=function(e){e=Object.assign({top:0,bottom:0,left:0,right:0},e);const t=new Fe(o.window);return t.top+=e.top,t.height-=e.top,t.bottom-=e.bottom,t.height-=e.bottom,t}(r),c=new Fe(e),d=Xe(t,l);let u;if(!d||!l.getIntersection(d))return null;const h={targetRect:d,elementRect:c,positionedElementAncestor:a,viewportRect:l};if(n||s){if(n){const e=Xe(n,l);e&&(h.limiterRect=e)}u=function(e,t){const{elementRect:i}=t,n=i.getArea(),o=e.map((e=>new et(e,t))).filter((e=>!!e.name));let s=0,r=null;for(const e of o){const{limiterIntersectionArea:t,viewportIntersectionArea:i}=e;if(t===n)return e;const o=i**2+t**2;o>s&&(s=o,r=e)}return r}(i,h)}else u=new et(i[0],h);return u}function Xe(e,t){const i=new Fe(e).getVisible();return i?i.getIntersection(t):null}class et{constructor(e,t){const i=e(t.targetRect,t.elementRect,t.viewportRect,t.limiterRect);if(!i)return;const{left:n,top:o,name:s,config:r}=i;this.name=s,this.config=r,this._positioningFunctionCoordinates={left:n,top:o},this._options=t}get left(){return this._absoluteRect.left}get top(){return this._absoluteRect.top}get limiterIntersectionArea(){const e=this._options.limiterRect;return e?e.getIntersectionArea(this._rect):0}get viewportIntersectionArea(){return this._options.viewportRect.getIntersectionArea(this._rect)}get _rect(){return this._cachedRect||(this._cachedRect=this._options.elementRect.clone().moveTo(this._positioningFunctionCoordinates.left,this._positioningFunctionCoordinates.top)),this._cachedRect}get _absoluteRect(){return this._cachedAbsoluteRect||(this._cachedAbsoluteRect=this._rect.toAbsoluteRect()),this._cachedAbsoluteRect}}function tt(e){const t=e.parentNode;t&&t.removeChild(e)}function it({target:e,viewportOffset:t=0,ancestorOffset:i=0,alignToTop:n,forceScroll:o}){const s=dt(e);let r=s,a=null;for(t=function(e){return"number"==typeof e?{top:e,bottom:e,left:e,right:e}:e}(t);r;){let l;l=ut(r==s?e:a),st({parent:l,getRect:()=>ht(e,r),alignToTop:n,ancestorOffset:i,forceScroll:o});const c=ht(e,r);if(ot({window:r,rect:c,viewportOffset:t,alignToTop:n,forceScroll:o}),r.parent!=r){if(a=r.frameElement,r=r.parent,!a)return}else r=null}}function nt(e,t,i){st({parent:ut(e),getRect:()=>new Fe(e),ancestorOffset:t,limiterElement:i})}function ot({window:e,rect:t,alignToTop:i,forceScroll:n,viewportOffset:o}){const s=t.clone().moveBy(0,o.bottom),r=t.clone().moveBy(0,-o.top),a=new Fe(e).excludeScrollbarsAndBorders(),l=i&&n,c=[r,s].every((e=>a.contains(e)));let{scrollX:d,scrollY:u}=e;const h=d,m=u;l?u-=a.top-t.top+o.top:c||(at(r,a)?u-=a.top-t.top+o.top:rt(s,a)&&(u+=i?t.top-a.top-o.top:t.bottom-a.bottom+o.bottom)),c||(lt(t,a)?d-=a.left-t.left+o.left:ct(t,a)&&(d+=t.right-a.right+o.right)),d==h&&u===m||e.scrollTo(d,u)}function st({parent:e,getRect:t,alignToTop:i,forceScroll:n,ancestorOffset:o=0,limiterElement:s}){const r=dt(e),a=i&&n;let l,c,d;const u=s||r.document.body;for(;e!=u;)c=t(),l=new Fe(e).excludeScrollbarsAndBorders(),d=l.contains(c),a?e.scrollTop-=l.top-c.top+o:d||(at(c,l)?e.scrollTop-=l.top-c.top+o:rt(c,l)&&(e.scrollTop+=i?c.top-l.top-o:c.bottom-l.bottom+o)),d||(lt(c,l)?e.scrollLeft-=l.left-c.left+o:ct(c,l)&&(e.scrollLeft+=c.right-l.right+o)),e=e.parentNode}function rt(e,t){return e.bottom>t.bottom}function at(e,t){return e.top<t.top}function lt(e,t){return e.left<t.left}function ct(e,t){return e.right>t.right}function dt(e){return Me(e)?e.startContainer.ownerDocument.defaultView:e.ownerDocument.defaultView}function ut(e){if(Me(e)){let t=e.commonAncestorContainer;return Be(t)&&(t=t.parentNode),t}return e.parentNode}function ht(e,t){const i=dt(e),n=new Fe(e);if(i===t)return n;{let e=i;for(;e!=t;){const t=e.frameElement,i=new Fe(t).excludeScrollbarsAndBorders();n.moveBy(i.left,i.top),e=e.parent}}return n}const mt={ctrl:"⌃",cmd:"⌘",alt:"⌥",shift:"⇧"},gt={ctrl:"Ctrl+",alt:"Alt+",shift:"Shift+"},ft={37:"←",38:"↑",39:"→",40:"↓",9:"⇥",33:"Page Up",34:"Page Down"},pt=At(),bt=Object.fromEntries(Object.entries(pt).map((([e,t])=>{let i;return i=t in ft?ft[t]:e.charAt(0).toUpperCase()+e.slice(1),[t,i]})));function wt(e){let t;if("string"==typeof e){if(t=pt[e.toLowerCase()],!t)throw new P("keyboard-unknown-key",null,{key:e})}else t=e.keyCode+(e.altKey?pt.alt:0)+(e.ctrlKey?pt.ctrl:0)+(e.shiftKey?pt.shift:0)+(e.metaKey?pt.cmd:0);return t}function vt(e){return"string"==typeof e&&(e=function(e){return e.split("+").map((e=>e.trim()))}(e)),e.map((e=>"string"==typeof e?function(e){if(e.endsWith("!"))return wt(e.slice(0,-1));const t=wt(e);return(a.isMac||a.isiOS)&&t==pt.ctrl?pt.cmd:t}(e):e)).reduce(((e,t)=>t+e),0)}function _t(e){let t=vt(e);return Object.entries(a.isMac||a.isiOS?mt:gt).reduce(((e,[i,n])=>(0!=(t&pt[i])&&(t&=~pt[i],e+=n),e)),"")+(t?bt[t]:"")}function yt(e){return e==pt.arrowright||e==pt.arrowleft||e==pt.arrowup||e==pt.arrowdown}function kt(e,t){const i="ltr"===t;switch(e){case pt.arrowleft:return i?"left":"right";case pt.arrowright:return i?"right":"left";case pt.arrowup:return"up";case pt.arrowdown:return"down"}}function Ct(e,t){const i=kt(e,t);return"down"===i||"right"===i}function At(){const e={pageup:33,pagedown:34,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,backspace:8,delete:46,enter:13,space:32,esc:27,tab:9,ctrl:1114112,shift:2228224,alt:4456448,cmd:8912896};for(let t=65;t<=90;t++)e[String.fromCharCode(t).toLowerCase()]=t;for(let t=48;t<=57;t++)e[t-48]=t;for(let t=112;t<=123;t++)e["f"+(t-111)]=t;return Object.assign(e,{"'":222,",":108,"-":109,".":110,"/":111,";":186,"=":187,"[":219,"\\":220,"]":221,"`":223}),e}const Et=["ar","ara","dv","div","fa","per","fas","he","heb","ku","kur","ug","uig"];function xt(e){return Et.includes(e)?"rtl":"ltr"}function Tt(e){return Array.isArray(e)?e:[e]}var Pt=i(6248);o.window.CKEDITOR_TRANSLATIONS||(o.window.CKEDITOR_TRANSLATIONS={});class It{constructor({uiLanguage:e="en",contentLanguage:t,translations:i}={}){this.uiLanguage=e,this.contentLanguage=t||this.uiLanguage,this.uiLanguageDirection=xt(this.uiLanguage),this.contentLanguageDirection=xt(this.contentLanguage),this.translations=function(e){return Array.isArray(e)?e.reduce(((e,t)=>(0,Pt.A)(e,t))):e}(i),this.t=(e,t)=>this._t(e,t)}get language(){return console.warn("locale-deprecated-language-property: The Locale#language property has been deprecated and will be removed in the near future. Please use #uiLanguage and #contentLanguage properties instead."),this.uiLanguage}_t(e,t=[]){t=Tt(t),"string"==typeof e&&(e={string:e});const i=e.plural?t[0]:1;return function(e,t){return e.replace(/%(\d+)/g,((e,i)=>i<t.length?t[i]:e))}(function(e,t,i=1,n){if("number"!=typeof i)throw new P("translation-service-quantity-not-a-number",null,{quantity:i});const s=n||o.window.CKEDITOR_TRANSLATIONS,r=function(e){return Object.keys(e).length}(s);1===r&&(e=Object.keys(s)[0]);const a=t.id||t.string;if(0===r||!function(e,t,i){return!!i[e]&&!!i[e].dictionary[t]}(e,a,s))return 1!==i?t.plural:t.string;const l=s[e].dictionary,c=s[e].getPluralForm||(e=>1===e?0:1),d=l[a];return"string"==typeof d?d:d[Number(c(i))]}(this.uiLanguage,e,i,this.translations),t)}}class St extends(z()){constructor(e={},t={}){super();const i=ue(e);if(i||(t=e),this._items=[],this._itemMap=new Map,this._idProperty=t.idProperty||"id",this._bindToExternalToInternalMap=new WeakMap,this._bindToInternalToExternalMap=new WeakMap,this._skippedIndexesFromExternal=[],i)for(const t of e)this._items.push(t),this._itemMap.set(this._getItemIdBeforeAdding(t),t)}get length(){return this._items.length}get first(){return this._items[0]||null}get last(){return this._items[this.length-1]||null}add(e,t){return this.addMany([e],t)}addMany(e,t){if(void 0===t)t=this._items.length;else if(t>this._items.length||t<0)throw new P("collection-add-item-invalid-index",this);let i=0;for(const n of e){const e=this._getItemIdBeforeAdding(n),o=t+i;this._items.splice(o,0,n),this._itemMap.set(e,n),this.fire("add",n,o),i++}return this.fire("change",{added:e,removed:[],index:t}),this}get(e){let t;if("string"==typeof e)t=this._itemMap.get(e);else{if("number"!=typeof e)throw new P("collection-get-invalid-arg",this);t=this._items[e]}return t||null}has(e){if("string"==typeof e)return this._itemMap.has(e);{const t=e[this._idProperty];return t&&this._itemMap.has(t)}}getIndex(e){let t;return t="string"==typeof e?this._itemMap.get(e):e,t?this._items.indexOf(t):-1}remove(e){const[t,i]=this._remove(e);return this.fire("change",{added:[],removed:[t],index:i}),t}map(e,t){return this._items.map(e,t)}forEach(e,t){this._items.forEach(e,t)}find(e,t){return this._items.find(e,t)}filter(e,t){return this._items.filter(e,t)}clear(){this._bindToCollection&&(this.stopListening(this._bindToCollection),this._bindToCollection=null);const e=Array.from(this._items);for(;this.length;)this._remove(0);this.fire("change",{added:[],removed:e,index:0})}bindTo(e){if(this._bindToCollection)throw new P("collection-bind-to-rebind",this);return this._bindToCollection=e,{as:e=>{this._setUpBindToBinding((t=>new e(t)))},using:e=>{"function"==typeof e?this._setUpBindToBinding(e):this._setUpBindToBinding((t=>t[e]))}}}_setUpBindToBinding(e){const t=this._bindToCollection,i=(i,n,o)=>{const s=t._bindToCollection==this,r=t._bindToInternalToExternalMap.get(n);if(s&&r)this._bindToExternalToInternalMap.set(n,r),this._bindToInternalToExternalMap.set(r,n);else{const i=e(n);if(!i)return void this._skippedIndexesFromExternal.push(o);let s=o;for(const e of this._skippedIndexesFromExternal)o>e&&s--;for(const e of t._skippedIndexesFromExternal)s>=e&&s++;this._bindToExternalToInternalMap.set(n,i),this._bindToInternalToExternalMap.set(i,n),this.add(i,s);for(let e=0;e<t._skippedIndexesFromExternal.length;e++)s<=t._skippedIndexesFromExternal[e]&&t._skippedIndexesFromExternal[e]++}};for(const e of t)i(0,e,t.getIndex(e));this.listenTo(t,"add",i),this.listenTo(t,"remove",((e,t,i)=>{const n=this._bindToExternalToInternalMap.get(t);n&&this.remove(n),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce(((e,t)=>(i<t&&e.push(t-1),i>t&&e.push(t),e)),[])}))}_getItemIdBeforeAdding(e){const t=this._idProperty;let i;if(t in e){if(i=e[t],"string"!=typeof i)throw new P("collection-add-invalid-id",this);if(this.get(i))throw new P("collection-add-item-already-exists",this)}else e[t]=i=A();return i}_remove(e){let t,i,n,o=!1;const s=this._idProperty;if("string"==typeof e?(i=e,n=this._itemMap.get(i),o=!n,n&&(t=this._items.indexOf(n))):"number"==typeof e?(t=e,n=this._items[t],o=!n,n&&(i=n[s])):(n=e,i=n[s],t=this._items.indexOf(n),o=-1==t||!this._itemMap.get(i)),o)throw new P("collection-remove-404",this);this._items.splice(t,1),this._itemMap.delete(i);const r=this._bindToInternalToExternalMap.get(n);return this._bindToInternalToExternalMap.delete(n),this._bindToExternalToInternalMap.delete(r),this.fire("remove",n,t),[n,t]}[Symbol.iterator](){return this._items[Symbol.iterator]()}}function Vt(e){const t=e.next();return t.done?null:t.value}class Rt extends(xe(te())){constructor(){super(),this._elements=new Set,this._nextEventLoopTimeout=null,this.set("isFocused",!1),this.set("focusedElement",null)}add(e){if(this._elements.has(e))throw new P("focustracker-add-element-already-exist",this);this.listenTo(e,"focus",(()=>this._focus(e)),{useCapture:!0}),this.listenTo(e,"blur",(()=>this._blur()),{useCapture:!0}),this._elements.add(e)}remove(e){e===this.focusedElement&&this._blur(),this._elements.has(e)&&(this.stopListening(e),this._elements.delete(e))}destroy(){this.stopListening()}_focus(e){clearTimeout(this._nextEventLoopTimeout),this.focusedElement=e,this.isFocused=!0}_blur(){clearTimeout(this._nextEventLoopTimeout),this._nextEventLoopTimeout=setTimeout((()=>{this.focusedElement=null,this.isFocused=!1}),0)}}class Bt{constructor(){this._listener=new(xe())}listenTo(e){this._listener.listenTo(e,"keydown",((e,t)=>{this._listener.fire("_keydown:"+wt(t),t)}))}set(e,t,i={}){const n=vt(e),o=i.priority;this._listener.listenTo(this._listener,"_keydown:"+n,((e,n)=>{i.filter&&!i.filter(n)||(t(n,(()=>{n.preventDefault(),n.stopPropagation(),e.stop()})),e.return=!0)}),{priority:o})}press(e){return!!this._listener.fire("_keydown:"+wt(e),e)}stopListening(e){this._listener.stopListening(e)}destroy(){this.stopListening()}}function Mt(e){return ue(e)?new Map(e):function(e){const t=new Map;for(const i in e)t.set(i,e[i]);return t}(e)}function Ot(e,t={}){return new Promise(((i,n)=>{const o=t.signal||(new AbortController).signal;o.throwIfAborted();const s=setTimeout((function(){o.removeEventListener("abort",r),i()}),e);function r(){clearTimeout(s),n(o.reason)}o.addEventListener("abort",r,{once:!0})}))}async function Lt(e,t={}){const{maxAttempts:i=4,retryDelay:n=Ft(),signal:o=(new AbortController).signal}=t;o.throwIfAborted();for(let t=0;;t++){try{return await e()}catch(e){if(t+1>=i)throw e}await Ot(n(t),{signal:o})}}function Ft(e={}){const{delay:t=1e3,factor:i=2,maxDelay:n=1e4}=e;return e=>Math.min(i**e*t,n)}const Nt=1e4;function Dt(e,t,i,n){if(Math.max(t.length,e.length)>Nt)return e.slice(0,i).concat(t).concat(e.slice(i+n,e.length));{const o=Array.from(e);return o.splice(i,n,...t),o}}function zt(e,t){let i;function n(...o){n.cancel(),i=setTimeout((()=>e(...o)),t)}return n.cancel=()=>{clearTimeout(i)},n}function Wt(e){function t(e){return e.length>=40&&e.length<=255?"VALID":"INVALID"}if(!e)return"INVALID";let i="";try{i=atob(e)}catch(e){return"INVALID"}const n=i.split("-"),o=n[0],s=n[1];if(!s)return t(e);try{atob(s)}catch(i){try{if(atob(o),!atob(o).length)return t(e)}catch(i){return t(e)}}if(o.length<40||o.length>255)return"INVALID";let r="";try{atob(o),r=atob(s)}catch(e){return"INVALID"}if(8!==r.length)return"INVALID";const a=Number(r.substring(0,4)),l=Number(r.substring(4,6))-1,c=Number(r.substring(6,8)),d=new Date(a,l,c);return d<O||isNaN(Number(d))?"INVALID":"VALID"}function Ht(e){return!!e&&1==e.length&&/[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/.test(e)}function Ut(e){return!!e&&1==e.length&&/[\ud800-\udbff]/.test(e)}function $t(e){return!!e&&1==e.length&&/[\udc00-\udfff]/.test(e)}function jt(e,t){return Ut(e.charAt(t-1))&&$t(e.charAt(t))}function qt(e,t){return Ht(e.charAt(t))}const Kt=Zt();function Gt(e,t){const i=String(e).matchAll(Kt);return Array.from(i).some((e=>e.index<t&&t<e.index+e[0].length))}function Zt(){const e=/\p{Regional_Indicator}{2}/u.source,t="(?:"+[/\p{Emoji}[\u{E0020}-\u{E007E}]+\u{E007F}/u,/\p{Emoji}\u{FE0F}?\u{20E3}/u,/\p{Emoji}\u{FE0F}/u,/(?=\p{General_Category=Other_Symbol})\p{Emoji}\p{Emoji_Modifier}*/u].map((e=>e.source)).join("|")+")";return new RegExp(`${e}|${t}(?:‍${t})*`,"ug")}},3906:(e,t,i)=>{"use strict";i.r(t),i.d(t,{WIDGET_CLASS_NAME:()=>m,WIDGET_SELECTED_CLASS_NAME:()=>g,Widget:()=>F,WidgetResize:()=>j,WidgetToolbarRepository:()=>N,WidgetTypeAround:()=>M,calculateResizeHostAncestorWidth:()=>x,calculateResizeHostPercentageWidth:()=>T,findOptimalInsertionRange:()=>C,getLabel:()=>y,isWidget:()=>f,setHighlightHandling:()=>v,setLabel:()=>_,toWidget:()=>p,toWidgetEditable:()=>k,viewToModelPositionOutsideModelElement:()=>A});var n=i(1024),o=i(151),s=i(6192),r=i(7906),a=i(7243),l=i(7207);class c extends((0,r.EmitterMixin)()){constructor(){super(...arguments),this._stack=[]}add(e,t){const i=this._stack,n=i[0];this._insertDescriptor(e);const o=i[0];n===o||d(n,o)||this.fire("change:top",{oldDescriptor:n,newDescriptor:o,writer:t})}remove(e,t){const i=this._stack,n=i[0];this._removeDescriptor(e);const o=i[0];n===o||d(n,o)||this.fire("change:top",{oldDescriptor:n,newDescriptor:o,writer:t})}_insertDescriptor(e){const t=this._stack,i=t.findIndex((t=>t.id===e.id));if(d(e,t[i]))return;i>-1&&t.splice(i,1);let n=0;for(;t[n]&&(o=t[n],s=e,o.priority>s.priority||!(o.priority<s.priority)&&u(o.classes)>u(s.classes));)n++;var o,s;t.splice(n,0,e)}_removeDescriptor(e){const t=this._stack,i=t.findIndex((t=>t.id===e));i>-1&&t.splice(i,1)}}function d(e,t){return e&&t&&e.priority==t.priority&&u(e.classes)==u(t.classes)}function u(e){return Array.isArray(e)?e.sort().join(","):e}const h='<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M4 0v1H1v3H0V.5A.5.5 0 0 1 .5 0H4zm8 0h3.5a.5.5 0 0 1 .5.5V4h-1V1h-3V0zM4 16H.5a.5.5 0 0 1-.5-.5V12h1v3h3v1zm8 0v-1h3v-3h1v3.5a.5.5 0 0 1-.5.5H12z"/><path fill-opacity=".256" d="M1 1h14v14H1z"/><g class="ck-icon__selected-indicator"><path d="M7 0h2v1H7V0zM0 7h1v2H0V7zm15 0h1v2h-1V7zm-8 8h2v1H7v-1z"/><path fill-opacity=".254" d="M1 1h14v14H1z"/></g></svg>',m="ck-widget",g="ck-widget_selected";function f(e){return!!e.is("element")&&!!e.getCustomProperty("widget")}function p(e,t,i={}){if(!e.is("containerElement"))throw new r.CKEditorError("widget-to-widget-wrong-element-type",null,{element:e});return t.setAttribute("contenteditable","false",e),t.addClass(m,e),t.setCustomProperty("widget",!0,e),e.getFillerOffset=E,t.setCustomProperty("widgetLabel",[],e),i.label&&_(e,i.label),i.hasSelectionHandle&&function(e,t){const i=t.createUIElement("div",{class:"ck ck-widget__selection-handle"},(function(e){const t=this.toDomElement(e),i=new a.IconView;return i.set("content",h),i.render(),t.appendChild(i.element),t}));t.insert(t.createPositionAt(e,0),i),t.addClass(["ck-widget_with-selection-handle"],e)}(e,t),v(e,t),e}function b(e,t,i){if(t.classes&&i.addClass((0,r.toArray)(t.classes),e),t.attributes)for(const n in t.attributes)i.setAttribute(n,t.attributes[n],e)}function w(e,t,i){if(t.classes&&i.removeClass((0,r.toArray)(t.classes),e),t.attributes)for(const n in t.attributes)i.removeAttribute(n,e)}function v(e,t,i=b,n=w){const o=new c;o.on("change:top",((t,o)=>{o.oldDescriptor&&n(e,o.oldDescriptor,o.writer),o.newDescriptor&&i(e,o.newDescriptor,o.writer)})),t.setCustomProperty("addHighlight",((e,t,i)=>o.add(t,i)),e),t.setCustomProperty("removeHighlight",((e,t,i)=>o.remove(t,i)),e)}function _(e,t){e.getCustomProperty("widgetLabel").push(t)}function y(e){return e.getCustomProperty("widgetLabel").reduce(((e,t)=>"function"==typeof t?e?e+". "+t():t():e?e+". "+t:t),"")}function k(e,t,i={}){return t.addClass(["ck-editor__editable","ck-editor__nested-editable"],e),t.setAttribute("role","textbox",e),t.setAttribute("tabindex","-1",e),i.label&&t.setAttribute("aria-label",i.label,e),t.setAttribute("contenteditable",e.isReadOnly?"false":"true",e),e.on("change:isReadOnly",((i,n,o)=>{t.setAttribute("contenteditable",o?"false":"true",e)})),e.on("change:isFocused",((i,n,o)=>{o?t.addClass("ck-editor__nested-editable_focused",e):t.removeClass("ck-editor__nested-editable_focused",e)})),v(e,t),e}function C(e,t){const i=e.getSelectedElement();if(i){const n=S(e);if(n)return t.createRange(t.createPositionAt(i,n))}return t.schema.findOptimalInsertionRange(e)}function A(e,t){return(i,n)=>{const{mapper:o,viewPosition:s}=n,r=o.findMappedViewAncestor(s);if(!t(r))return;const a=o.toModelElement(r);n.modelPosition=e.createPositionAt(a,s.isAtStart?"before":"after")}}function E(){return null}function x(e){const t=e=>{const{width:t,paddingLeft:i,paddingRight:n}=e.ownerDocument.defaultView.getComputedStyle(e);return parseFloat(t)-(parseFloat(i)||0)-(parseFloat(n)||0)},i=e.parentElement;if(!i)return 0;let n=t(i),o=0,s=i;for(;isNaN(n);){if(s=s.parentElement,++o>5)return 0;n=t(s)}return n}function T(e,t=new r.Rect(e)){const i=x(e);return i?t.width/i*100:0}const P="widget-type-around";function I(e,t,i){return!!e&&f(e)&&!i.isInline(t)}function S(e){return e.getAttribute(P)}const V=["before","after"],R=(new DOMParser).parseFromString('<svg viewBox="0 0 10 8" xmlns="http://www.w3.org/2000/svg"><path d="M9.055.263v3.972h-6.77M1 4.216l2-2.038m-2 2 2 2.038"/></svg>',"image/svg+xml").firstChild,B="ck-widget__type-around_disabled";class M extends n.Plugin{constructor(){super(...arguments),this._currentFakeCaretModelElement=null}static get pluginName(){return"WidgetTypeAround"}static get requires(){return[l.Enter,s.Delete]}init(){const e=this.editor,t=e.editing.view;this.on("change:isEnabled",((i,n,o)=>{t.change((e=>{for(const i of t.document.roots)o?e.removeClass(B,i):e.addClass(B,i)})),o||e.model.change((e=>{e.removeSelectionAttribute(P)}))})),this._enableTypeAroundUIInjection(),this._enableInsertingParagraphsOnButtonClick(),this._enableInsertingParagraphsOnEnterKeypress(),this._enableInsertingParagraphsOnTypingKeystroke(),this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(),this._enableDeleteIntegration(),this._enableInsertContentIntegration(),this._enableInsertObjectIntegration(),this._enableDeleteContentIntegration()}destroy(){super.destroy(),this._currentFakeCaretModelElement=null}_insertParagraph(e,t){const i=this.editor,n=i.editing.view,o=i.model.schema.getAttributesWithProperty(e,"copyOnReplace",!0);i.execute("insertParagraph",{position:i.model.createPositionAt(e,t),attributes:o}),n.focus(),n.scrollToTheSelection()}_listenToIfEnabled(e,t,i,n){this.listenTo(e,t,((...e)=>{this.isEnabled&&i(...e)}),n)}_insertParagraphAccordingToFakeCaretPosition(){const e=this.editor.model.document.selection,t=S(e);if(!t)return!1;const i=e.getSelectedElement();return this._insertParagraph(i,t),!0}_enableTypeAroundUIInjection(){const e=this.editor,t=e.model.schema,i=e.locale.t,n={before:i("Insert paragraph before block"),after:i("Insert paragraph after block")};e.editing.downcastDispatcher.on("insert",((e,o,s)=>{const r=s.mapper.toViewElement(o.item);r&&I(r,o.item,t)&&(!function(e,t,i){const n=e.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},(function(e){const i=this.toDomElement(e);return function(e,t){for(const i of V){const n=new a.Template({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${i}`],title:t[i],"aria-hidden":"true"},children:[e.ownerDocument.importNode(R,!0)]});e.appendChild(n.render())}}(i,t),function(e){const t=new a.Template({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});e.appendChild(t.render())}(i),i}));e.insert(e.createPositionAt(i,"end"),n)}(s.writer,n,r),r.getCustomProperty("widgetLabel").push((()=>this.isEnabled?i("Press Enter to type after or press Shift + Enter to type before the widget"):"")))}),{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const e=this.editor,t=e.model,i=t.document.selection,n=t.schema,o=e.editing.view;function s(e){return`ck-widget_type-around_show-fake-caret_${e}`}this._listenToIfEnabled(o.document,"arrowKey",((e,t)=>{this._handleArrowKeyPress(e,t)}),{context:[f,"$text"],priority:"high"}),this._listenToIfEnabled(i,"change:range",((t,i)=>{i.directChange&&e.model.change((e=>{e.removeSelectionAttribute(P)}))})),this._listenToIfEnabled(t.document,"change:data",(()=>{const t=i.getSelectedElement();t&&I(e.editing.mapper.toViewElement(t),t,n)||e.model.change((e=>{e.removeSelectionAttribute(P)}))})),this._listenToIfEnabled(e.editing.downcastDispatcher,"selection",((e,t,i)=>{const o=i.writer;if(this._currentFakeCaretModelElement){const e=i.mapper.toViewElement(this._currentFakeCaretModelElement);e&&(o.removeClass(V.map(s),e),this._currentFakeCaretModelElement=null)}const r=t.selection.getSelectedElement();if(!r)return;const a=i.mapper.toViewElement(r);if(!I(a,r,n))return;const l=S(t.selection);l&&(o.addClass(s(l),a),this._currentFakeCaretModelElement=r)})),this._listenToIfEnabled(e.ui.focusTracker,"change:isFocused",((t,i,n)=>{n||e.model.change((e=>{e.removeSelectionAttribute(P)}))}))}_handleArrowKeyPress(e,t){const i=this.editor,n=i.model,o=n.document.selection,s=n.schema,a=i.editing.view,l=t.keyCode,c=(0,r.isForwardArrowKeyCode)(l,i.locale.contentLanguageDirection),d=a.document.selection.getSelectedElement();let u;I(d,i.editing.mapper.toModelElement(d),s)?u=this._handleArrowKeyPressOnSelectedWidget(c):o.isCollapsed?u=this._handleArrowKeyPressWhenSelectionNextToAWidget(c):t.shiftKey||(u=this._handleArrowKeyPressWhenNonCollapsedSelection(c)),u&&(t.preventDefault(),e.stop())}_handleArrowKeyPressOnSelectedWidget(e){const t=this.editor.model,i=S(t.document.selection);return t.change((t=>i?i!==(e?"after":"before")&&(t.removeSelectionAttribute(P),!0):(t.setSelectionAttribute(P,e?"after":"before"),!0)))}_handleArrowKeyPressWhenSelectionNextToAWidget(e){const t=this.editor,i=t.model,n=i.schema,o=t.plugins.get("Widget"),s=o._getObjectElementNextToSelection(e);return!!I(t.editing.mapper.toViewElement(s),s,n)&&(i.change((t=>{o._setSelectionOverElement(s),t.setSelectionAttribute(P,e?"before":"after")})),!0)}_handleArrowKeyPressWhenNonCollapsedSelection(e){const t=this.editor,i=t.model,n=i.schema,o=t.editing.mapper,s=i.document.selection,r=e?s.getLastPosition().nodeBefore:s.getFirstPosition().nodeAfter;return!!I(o.toViewElement(r),r,n)&&(i.change((t=>{t.setSelection(r,"on"),t.setSelectionAttribute(P,e?"after":"before")})),!0)}_enableInsertingParagraphsOnButtonClick(){const e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,"mousedown",((i,n)=>{const o=n.domTarget.closest(".ck-widget__type-around__button");if(!o)return;const s=o.classList.contains("ck-widget__type-around__button_before")?"before":"after",r=function(e,t){const i=e.closest(".ck-widget");return t.mapDomToView(i)}(o,t.domConverter),a=e.editing.mapper.toModelElement(r);this._insertParagraph(a,s),n.preventDefault(),i.stop()}))}_enableInsertingParagraphsOnEnterKeypress(){const e=this.editor,t=e.model.document.selection,i=e.editing.view;this._listenToIfEnabled(i.document,"enter",((i,n)=>{if("atTarget"!=i.eventPhase)return;const o=t.getSelectedElement(),s=e.editing.mapper.toViewElement(o),r=e.model.schema;let a;this._insertParagraphAccordingToFakeCaretPosition()?a=!0:I(s,o,r)&&(this._insertParagraph(o,n.isSoft?"before":"after"),a=!0),a&&(n.preventDefault(),i.stop())}),{context:f})}_enableInsertingParagraphsOnTypingKeystroke(){const e=this.editor.editing.view.document;this._listenToIfEnabled(e,"insertText",((t,i)=>{this._insertParagraphAccordingToFakeCaretPosition()&&(i.selection=e.selection)}),{priority:"high"}),r.env.isAndroid?this._listenToIfEnabled(e,"keydown",((e,t)=>{229==t.keyCode&&this._insertParagraphAccordingToFakeCaretPosition()})):this._listenToIfEnabled(e,"compositionstart",(()=>{this._insertParagraphAccordingToFakeCaretPosition()}),{priority:"high"})}_enableDeleteIntegration(){const e=this.editor,t=e.editing.view,i=e.model,n=i.schema;this._listenToIfEnabled(t.document,"delete",((t,o)=>{if("atTarget"!=t.eventPhase)return;const s=S(i.document.selection);if(!s)return;const r=o.direction,a=i.document.selection.getSelectedElement(),l="forward"==r;if("before"===s===l)e.execute("delete",{selection:i.createSelection(a,"on")});else{const t=n.getNearestSelectionRange(i.createPositionAt(a,s),r);if(t)if(t.isCollapsed){const o=i.createSelection(t.start);if(i.modifySelection(o,{direction:r}),o.focus.isEqual(t.start)){const e=function(e,t){let i=t;for(const n of t.getAncestors({parentFirst:!0})){if(n.childCount>1||e.isLimit(n))break;i=n}return i}(n,t.start.parent);i.deleteContent(i.createSelection(e,"on"),{doNotAutoparagraph:!0})}else i.change((i=>{i.setSelection(t),e.execute(l?"deleteForward":"delete")}))}else i.change((i=>{i.setSelection(t),e.execute(l?"deleteForward":"delete")}))}o.preventDefault(),t.stop()}),{context:f})}_enableInsertContentIntegration(){const e=this.editor,t=this.editor.model,i=t.document.selection;this._listenToIfEnabled(e.model,"insertContent",((e,[n,o])=>{if(o&&!o.is("documentSelection"))return;const s=S(i);return s?(e.stop(),t.change((e=>{const o=i.getSelectedElement(),r=t.createPositionAt(o,s),a=e.createSelection(r),l=t.insertContent(n,a);return e.setSelection(a),l}))):void 0}),{priority:"high"})}_enableInsertObjectIntegration(){const e=this.editor,t=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"insertObject",((e,i)=>{const[,n,o={}]=i;if(n&&!n.is("documentSelection"))return;const s=S(t);s&&(o.findOptimalPosition=s,i[3]=o)}),{priority:"high"})}_enableDeleteContentIntegration(){const e=this.editor,t=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"deleteContent",((e,[i])=>{i&&!i.is("documentSelection")||S(t)&&e.stop()}),{priority:"high"})}}function O(e,t,i){const n=e.schema,o=e.createRangeIn(t.root),s="forward"==i?"elementStart":"elementEnd";for(const{previousPosition:e,item:r,type:a}of o.getWalker({startPosition:t,direction:i})){if(n.isLimit(r)&&!n.isInline(r))return e;if(a==s&&n.isBlock(r))return null}return null}function L(e,t,i){const n="backward"==i?t.end:t.start;if(e.checkChild(n,"$text"))return n;for(const{nextPosition:n}of t.getWalker({direction:i}))if(e.checkChild(n,"$text"))return n;return null}class F extends n.Plugin{constructor(){super(...arguments),this._previouslySelected=new Set}static get pluginName(){return"Widget"}static get requires(){return[M,s.Delete]}init(){const e=this.editor,t=e.editing.view,i=t.document,n=e.t;this.editor.editing.downcastDispatcher.on("selection",((t,i,n)=>{const o=n.writer,s=i.selection;if(s.isCollapsed)return;const r=s.getSelectedElement();if(!r)return;const a=e.editing.mapper.toViewElement(r);f(a)&&n.consumable.consume(s,"selection")&&o.setSelection(o.createRangeOn(a),{fake:!0,label:y(a)})})),this.editor.editing.downcastDispatcher.on("selection",((e,t,i)=>{this._clearPreviouslySelectedWidgets(i.writer);const n=i.writer,o=n.document.selection;let s=null;for(const e of o.getRanges())for(const t of e){const e=t.item;f(e)&&(r=e,!(a=s)||!Array.from(r.getAncestors()).includes(a))&&(n.addClass(g,e),this._previouslySelected.add(e),s=e)}var r,a}),{priority:"low"}),t.addObserver(o.MouseObserver),this.listenTo(i,"mousedown",((...e)=>this._onMousedown(...e))),this.listenTo(i,"arrowKey",((...e)=>{this._handleSelectionChangeOnArrowKeyPress(...e)}),{context:[f,"$text"]}),this.listenTo(i,"arrowKey",((...e)=>{this._preventDefaultOnArrowKeyPress(...e)}),{context:"$root"}),this.listenTo(i,"arrowKey",function(e){const t=e.model;return(i,n)=>{const o=n.keyCode==r.keyCodes.arrowup,s=n.keyCode==r.keyCodes.arrowdown,a=n.shiftKey,l=t.document.selection;if(!o&&!s)return;const c=s;if(a&&function(e,t){return!e.isCollapsed&&e.isBackward==t}(l,c))return;const d=function(e,t,i){const n=e.model;if(i){const e=t.isCollapsed?t.focus:t.getLastPosition(),i=O(n,e,"forward");if(!i)return null;const o=n.createRange(e,i),s=L(n.schema,o,"backward");return s?n.createRange(e,s):null}{const e=t.isCollapsed?t.focus:t.getFirstPosition(),i=O(n,e,"backward");if(!i)return null;const o=n.createRange(i,e),s=L(n.schema,o,"forward");return s?n.createRange(s,e):null}}(e,l,c);if(d){if(d.isCollapsed){if(l.isCollapsed)return;if(a)return}(d.isCollapsed||function(e,t,i){const n=e.model,o=e.view.domConverter;if(i){const e=n.createSelection(t.start);n.modifySelection(e),e.focus.isAtEnd||t.start.isEqual(e.focus)||(t=n.createRange(e.focus,t.end))}const s=e.mapper.toViewRange(t),a=o.viewRangeToDom(s),l=r.Rect.getDomRangeRects(a);let c;for(const e of l)if(void 0!==c){if(Math.round(e.top)>=c)return!1;c=Math.max(c,Math.round(e.bottom))}else c=Math.round(e.bottom);return!0}(e,d,c))&&(t.change((e=>{const i=c?d.end:d.start;if(a){const n=t.createSelection(l.anchor);n.setFocus(i),e.setSelection(n)}else e.setSelection(i)})),i.stop(),n.preventDefault(),n.stopPropagation())}}}(this.editor.editing),{context:"$text"}),this.listenTo(i,"delete",((e,t)=>{this._handleDelete("forward"==t.direction)&&(t.preventDefault(),e.stop())}),{context:"$root"}),this.listenTo(i,"tab",((e,t)=>{"atTarget"==e.eventPhase&&(t.shiftKey||this._selectFirstNestedEditable()&&(t.preventDefault(),e.stop()))}),{context:f,priority:"low"}),this.listenTo(i,"tab",((e,t)=>{t.shiftKey&&this._selectAncestorWidget()&&(t.preventDefault(),e.stop())}),{priority:"low"}),this.listenTo(i,"keydown",((e,t)=>{t.keystroke==r.keyCodes.esc&&this._selectAncestorWidget()&&(t.preventDefault(),e.stop())}),{priority:"low"}),e.accessibility.addKeystrokeInfoGroup({id:"widget",label:n("Keystrokes that can be used when a widget is selected (for example: image, table, etc.)"),keystrokes:[{label:n("Move focus from an editable area back to the parent widget"),keystroke:"Esc"},{label:n("Insert a new paragraph directly after a widget"),keystroke:"Enter"},{label:n("Insert a new paragraph directly before a widget"),keystroke:"Shift+Enter"},{label:n("Move the caret to allow typing directly before a widget"),keystroke:[["arrowup"],["arrowleft"]]},{label:n("Move the caret to allow typing directly after a widget"),keystroke:[["arrowdown"],["arrowright"]]}]})}_onMousedown(e,t){const i=this.editor,n=i.editing.view,o=n.document;let s=t.target;if(t.domEvent.detail>=3)return void(this._selectBlockContent(s)&&t.preventDefault());if(function(e){let t=e;for(;t;){if(t.is("editableElement")&&!t.is("rootElement"))return!0;if(f(t))return!1;t=t.parent}return!1}(s))return;if(!f(s)&&(s=s.findAncestor(f),!s))return;r.env.isAndroid&&t.preventDefault(),o.isFocused||n.focus();const a=i.editing.mapper.toModelElement(s);this._setSelectionOverElement(a)}_selectBlockContent(e){const t=this.editor,i=t.model,n=t.editing.mapper,s=i.schema,r=n.findMappedViewAncestor(this.editor.editing.view.createPositionAt(e,0)),a=function(e,t){for(const i of e.getAncestors({includeSelf:!0,parentFirst:!0})){if(t.checkChild(i,"$text"))return i;if(t.isLimit(i)&&!t.isObject(i))break}return null}(n.toModelElement(r),i.schema);return!!a&&(i.change((e=>{const t=s.isLimit(a)?null:function(e,t){const i=new o.TreeWalker({startPosition:e});for(const{item:e}of i){if(t.isLimit(e)||!e.is("element"))return null;if(t.checkChild(e,"$text"))return e}return null}(e.createPositionAfter(a),s),i=e.createPositionAt(a,0),n=t?e.createPositionAt(t,0):e.createPositionAt(a,"end");e.setSelection(e.createRange(i,n))})),!0)}_handleSelectionChangeOnArrowKeyPress(e,t){const i=t.keyCode,n=this.editor.model,o=n.schema,s=n.document.selection,a=s.getSelectedElement(),l=(0,r.getLocalizedArrowKeyCodeDirection)(i,this.editor.locale.contentLanguageDirection),c="down"==l||"right"==l,d="up"==l||"down"==l;if(a&&o.isObject(a)){const i=c?s.getLastPosition():s.getFirstPosition(),r=o.getNearestSelectionRange(i,c?"forward":"backward");return void(r&&(n.change((e=>{e.setSelection(r)})),t.preventDefault(),e.stop()))}if(!s.isCollapsed&&!t.shiftKey){const i=s.getFirstPosition(),r=s.getLastPosition(),a=i.nodeAfter,l=r.nodeBefore;return void((a&&o.isObject(a)||l&&o.isObject(l))&&(n.change((e=>{e.setSelection(c?r:i)})),t.preventDefault(),e.stop()))}if(!s.isCollapsed)return;const u=this._getObjectElementNextToSelection(c);if(u&&o.isObject(u)){if(o.isInline(u)&&d)return;this._setSelectionOverElement(u),t.preventDefault(),e.stop()}}_preventDefaultOnArrowKeyPress(e,t){const i=this.editor.model,n=i.schema,o=i.document.selection.getSelectedElement();o&&n.isObject(o)&&(t.preventDefault(),e.stop())}_handleDelete(e){const t=this.editor.model.document.selection;if(!this.editor.model.canEditAt(t))return;if(!t.isCollapsed)return;const i=this._getObjectElementNextToSelection(e);return i?(this.editor.model.change((e=>{let n=t.anchor.parent;for(;n.isEmpty;){const t=n;n=t.parent,e.remove(t)}this._setSelectionOverElement(i)})),!0):void 0}_setSelectionOverElement(e){this.editor.model.change((t=>{t.setSelection(t.createRangeOn(e))}))}_getObjectElementNextToSelection(e){const t=this.editor.model,i=t.schema,n=t.document.selection,o=t.createSelection(n);if(t.modifySelection(o,{direction:e?"forward":"backward"}),o.isEqual(n))return null;const s=e?o.focus.nodeBefore:o.focus.nodeAfter;return s&&i.isObject(s)?s:null}_clearPreviouslySelectedWidgets(e){for(const t of this._previouslySelected)e.removeClass(g,t);this._previouslySelected.clear()}_selectFirstNestedEditable(){const e=this.editor,t=this.editor.editing.view.document;for(const i of t.selection.getFirstRange().getItems())if(i.is("editableElement")){const t=e.editing.mapper.toModelElement(i);if(!t)continue;const n=e.model.createPositionAt(t,0),o=e.model.schema.getNearestSelectionRange(n,"forward");return e.model.change((e=>{e.setSelection(o)})),!0}return!1}_selectAncestorWidget(){const e=this.editor,t=e.editing.mapper,i=e.editing.view.document.selection.getFirstPosition().parent,n=(i.is("$text")?i.parent:i).findAncestor(f);if(!n)return!1;const o=t.toModelElement(n);return!!o&&(e.model.change((e=>{e.setSelection(o,"on")})),!0)}}class N extends n.Plugin{constructor(){super(...arguments),this._toolbarDefinitions=new Map}static get requires(){return[a.ContextualBalloon]}static get pluginName(){return"WidgetToolbarRepository"}init(){const e=this.editor;if(e.plugins.has("BalloonToolbar")){const t=e.plugins.get("BalloonToolbar");this.listenTo(t,"show",(t=>{(function(e){const t=e.getSelectedElement();return!(!t||!f(t))})(e.editing.view.document.selection)&&t.stop()}),{priority:"high"})}this._balloon=this.editor.plugins.get("ContextualBalloon"),this.on("change:isEnabled",(()=>{this._updateToolbarsVisibility()})),this.listenTo(e.ui,"update",(()=>{this._updateToolbarsVisibility()})),this.listenTo(e.ui.focusTracker,"change:isFocused",(()=>{this._updateToolbarsVisibility()}),{priority:"low"})}destroy(){super.destroy();for(const e of this._toolbarDefinitions.values())e.view.destroy()}register(e,{ariaLabel:t,items:i,getRelatedElement:n,balloonClassName:o="ck-toolbar-container"}){if(!i.length)return void(0,r.logWarning)("widget-toolbar-no-items",{toolbarId:e});const s=this.editor,l=s.t,c=new a.ToolbarView(s.locale);if(c.ariaLabel=t||l("Widget toolbar"),this._toolbarDefinitions.has(e))throw new r.CKEditorError("widget-toolbar-duplicated",this,{toolbarId:e});const d={view:c,getRelatedElement:n,balloonClassName:o,itemsConfig:i,initialized:!1};s.ui.addToolbar(c,{isContextual:!0,beforeFocus:()=>{const e=n(s.editing.view.document.selection);e&&this._showToolbar(d,e)},afterBlur:()=>{this._hideToolbar(d)}}),this._toolbarDefinitions.set(e,d)}_updateToolbarsVisibility(){let e=0,t=null,i=null;for(const n of this._toolbarDefinitions.values()){const o=n.getRelatedElement(this.editor.editing.view.document.selection);if(this.isEnabled&&o)if(this.editor.ui.focusTracker.isFocused){const s=o.getAncestors().length;s>e&&(e=s,t=o,i=n)}else this._isToolbarVisible(n)&&this._hideToolbar(n);else this._isToolbarInBalloon(n)&&this._hideToolbar(n)}i&&this._showToolbar(i,t)}_hideToolbar(e){this._balloon.remove(e.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(e,t){this._isToolbarVisible(e)?D(this.editor,t):this._isToolbarInBalloon(e)||(e.initialized||(e.initialized=!0,e.view.fillFromConfig(e.itemsConfig,this.editor.ui.componentFactory)),this._balloon.add({view:e.view,position:z(this.editor,t),balloonClassName:e.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",(()=>{for(const e of this._toolbarDefinitions.values())if(this._isToolbarVisible(e)){const t=e.getRelatedElement(this.editor.editing.view.document.selection);D(this.editor,t)}})))}_isToolbarVisible(e){return this._balloon.visibleView===e.view}_isToolbarInBalloon(e){return this._balloon.hasView(e.view)}}function D(e,t){const i=e.plugins.get("ContextualBalloon"),n=z(e,t);i.updatePosition(n)}function z(e,t){const i=e.editing.view,n=a.BalloonPanelView.defaultPositions;return{target:i.domConverter.mapViewToDom(t),positions:[n.northArrowSouth,n.northArrowSouthWest,n.northArrowSouthEast,n.southArrowNorth,n.southArrowNorthWest,n.southArrowNorthEast,n.viewportStickyNorth]}}class W extends((0,r.ObservableMixin)()){constructor(e){super(),this.set("activeHandlePosition",null),this.set("proposedWidthPercents",null),this.set("proposedWidth",null),this.set("proposedHeight",null),this.set("proposedHandleHostWidth",null),this.set("proposedHandleHostHeight",null),this._options=e,this._referenceCoordinates=null}get originalWidth(){return this._originalWidth}get originalHeight(){return this._originalHeight}get originalWidthPercents(){return this._originalWidthPercents}get aspectRatio(){return this._aspectRatio}begin(e,t,i){const n=new r.Rect(t);this.activeHandlePosition=function(e){const t=["top-left","top-right","bottom-right","bottom-left"];for(const i of t)if(e.classList.contains(`ck-widget__resizer__handle-${i}`))return i}(e),this._referenceCoordinates=function(e,t){const i=new r.Rect(e),n=t.split("-"),o={x:"right"==n[1]?i.right:i.left,y:"bottom"==n[0]?i.bottom:i.top};return o.x+=e.ownerDocument.defaultView.scrollX,o.y+=e.ownerDocument.defaultView.scrollY,o}(t,function(e){const t=e.split("-"),i={top:"bottom",bottom:"top",left:"right",right:"left"};return`${i[t[0]]}-${i[t[1]]}`}(this.activeHandlePosition)),this._originalWidth=n.width,this._originalHeight=n.height,this._aspectRatio=n.width/n.height;const o=i.style.width;o&&o.match(/^\d+(\.\d*)?%$/)?this._originalWidthPercents=parseFloat(o):this._originalWidthPercents=T(i,n)}update(e){this.proposedWidth=e.width,this.proposedHeight=e.height,this.proposedWidthPercents=e.widthPercents,this.proposedHandleHostWidth=e.handleHostWidth,this.proposedHandleHostHeight=e.handleHostHeight}}class H extends a.View{constructor(){super();const e=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-size-view",e.to("_viewPosition",(e=>e?`ck-orientation-${e}`:""))],style:{display:e.if("_isVisible","none",(e=>!e))}},children:[{text:e.to("_label")}]})}_bindToState(e,t){this.bind("_isVisible").to(t,"proposedWidth",t,"proposedHeight",((e,t)=>null!==e&&null!==t)),this.bind("_label").to(t,"proposedHandleHostWidth",t,"proposedHandleHostHeight",t,"proposedWidthPercents",((t,i,n)=>"px"===e.unit?`${t}×${i}`:`${n}%`)),this.bind("_viewPosition").to(t,"activeHandlePosition",t,"proposedHandleHostWidth",t,"proposedHandleHostHeight",((e,t,i)=>t<50||i<50?"above-center":e))}_dismiss(){this.unbind(),this._isVisible=!1}}class U extends((0,r.ObservableMixin)()){constructor(e){super(),this._viewResizerWrapper=null,this._options=e,this.set("isEnabled",!0),this.set("isSelected",!1),this.bind("isVisible").to(this,"isEnabled",this,"isSelected",((e,t)=>e&&t)),this.decorate("begin"),this.decorate("cancel"),this.decorate("commit"),this.decorate("updateSize"),this.on("commit",(e=>{this.state.proposedWidth||this.state.proposedWidthPercents||(this._cleanup(),e.stop())}),{priority:"high"})}get state(){return this._state}show(){this._options.editor.editing.view.change((e=>{e.removeClass("ck-hidden",this._viewResizerWrapper)}))}hide(){this._options.editor.editing.view.change((e=>{e.addClass("ck-hidden",this._viewResizerWrapper)}))}attach(){const e=this,t=this._options.viewElement;this._options.editor.editing.view.change((i=>{const n=i.createUIElement("div",{class:"ck ck-reset_all ck-widget__resizer"},(function(t){const i=this.toDomElement(t);return e._appendHandles(i),e._appendSizeUI(i),i}));i.insert(i.createPositionAt(t,"end"),n),i.addClass("ck-widget_with-resizer",t),this._viewResizerWrapper=n,this.isVisible||this.hide()})),this.on("change:isVisible",(()=>{this.isVisible?(this.show(),this.redraw()):this.hide()}))}begin(e){this._state=new W(this._options),this._sizeView._bindToState(this._options,this.state),this._initialViewWidth=this._options.viewElement.getStyle("width"),this.state.begin(e,this._getHandleHost(),this._getResizeHost())}updateSize(e){const t=this._proposeNewSize(e);this._options.editor.editing.view.change((e=>{const i=this._options.unit||"%",n=("%"===i?t.widthPercents:t.width)+i;e.setStyle("width",n,this._options.viewElement)}));const i=this._getHandleHost(),n=new r.Rect(i),o=Math.round(n.width),s=Math.round(n.height),a=new r.Rect(i);t.width=Math.round(a.width),t.height=Math.round(a.height),this.redraw(n),this.state.update({...t,handleHostWidth:o,handleHostHeight:s})}commit(){const e=this._options.unit||"%",t=("%"===e?this.state.proposedWidthPercents:this.state.proposedWidth)+e;this._options.editor.editing.view.change((()=>{this._cleanup(),this._options.onCommit(t)}))}cancel(){this._cleanup()}destroy(){this.cancel()}redraw(e){const t=this._domResizerWrapper;if(!((i=t)&&i.ownerDocument&&i.ownerDocument.contains(i)))return;var i;const n=t.parentElement,o=this._getHandleHost(),s=this._viewResizerWrapper,a=[s.getStyle("width"),s.getStyle("height"),s.getStyle("left"),s.getStyle("top")];let l;if(n.isSameNode(o)){const t=e||new r.Rect(o);l=[t.width+"px",t.height+"px",void 0,void 0]}else l=[o.offsetWidth+"px",o.offsetHeight+"px",o.offsetLeft+"px",o.offsetTop+"px"];"same"!==(0,r.compareArrays)(a,l)&&this._options.editor.editing.view.change((e=>{e.setStyle({width:l[0],height:l[1],left:l[2],top:l[3]},s)}))}containsHandle(e){return this._domResizerWrapper.contains(e)}static isResizeHandle(e){return e.classList.contains("ck-widget__resizer__handle")}_cleanup(){this._sizeView._dismiss(),this._options.editor.editing.view.change((e=>{e.setStyle("width",this._initialViewWidth,this._options.viewElement)}))}_proposeNewSize(e){const t=this.state,i=(o=e).pageX,n=o.pageY;var o;const s=!this._options.isCentered||this._options.isCentered(this),r={x:t._referenceCoordinates.x-(i+t.originalWidth),y:n-t.originalHeight-t._referenceCoordinates.y};s&&t.activeHandlePosition.endsWith("-right")&&(r.x=i-(t._referenceCoordinates.x+t.originalWidth)),s&&(r.x*=2);let a=Math.abs(t.originalWidth+r.x),l=Math.abs(t.originalHeight+r.y);return"width"==(a/t.aspectRatio>l?"width":"height")?l=a/t.aspectRatio:a=l*t.aspectRatio,{width:Math.round(a),height:Math.round(l),widthPercents:Math.min(Math.round(t.originalWidthPercents/t.originalWidth*a*100)/100,100)}}_getResizeHost(){const e=this._domResizerWrapper.parentElement;return this._options.getResizeHost(e)}_getHandleHost(){const e=this._domResizerWrapper.parentElement;return this._options.getHandleHost(e)}get _domResizerWrapper(){return this._options.editor.editing.view.domConverter.mapViewToDom(this._viewResizerWrapper)}_appendHandles(e){const t=["top-left","top-right","bottom-right","bottom-left"];for(const n of t)e.appendChild(new a.Template({tag:"div",attributes:{class:"ck-widget__resizer__handle "+(i=n,`ck-widget__resizer__handle-${i}`)}}).render());var i}_appendSizeUI(e){this._sizeView=new H,this._sizeView.render(),e.appendChild(this._sizeView.element)}}var $=i(4022);class j extends n.Plugin{constructor(){super(...arguments),this._resizers=new Map}static get pluginName(){return"WidgetResize"}init(){const e=this.editor.editing,t=r.global.window.document;this.set("selectedResizer",null),this.set("_activeResizer",null),e.view.addObserver(o.MouseObserver),this._observer=new((0,r.DomEmitterMixin)()),this.listenTo(e.view.document,"mousedown",this._mouseDownListener.bind(this),{priority:"high"}),this._observer.listenTo(t,"mousemove",this._mouseMoveListener.bind(this)),this._observer.listenTo(t,"mouseup",this._mouseUpListener.bind(this)),this._redrawSelectedResizerThrottled=(0,$.A)((()=>this.redrawSelectedResizer()),200),this.editor.ui.on("update",this._redrawSelectedResizerThrottled),this.editor.model.document.on("change",(()=>{for(const[e,t]of this._resizers)e.isAttached()||(this._resizers.delete(e),t.destroy())}),{priority:"lowest"}),this._observer.listenTo(r.global.window,"resize",this._redrawSelectedResizerThrottled);const i=this.editor.editing.view.document.selection;i.on("change",(()=>{const e=i.getSelectedElement(),t=this.getResizerByViewElement(e)||null;t?this.select(t):this.deselect()}))}redrawSelectedResizer(){this.selectedResizer&&this.selectedResizer.isVisible&&this.selectedResizer.redraw()}destroy(){super.destroy(),this._observer.stopListening();for(const e of this._resizers.values())e.destroy();this._redrawSelectedResizerThrottled.cancel()}select(e){this.deselect(),this.selectedResizer=e,this.selectedResizer.isSelected=!0}deselect(){this.selectedResizer&&(this.selectedResizer.isSelected=!1),this.selectedResizer=null}attachTo(e){const t=new U(e),i=this.editor.plugins;if(t.attach(),i.has("WidgetToolbarRepository")){const e=i.get("WidgetToolbarRepository");t.on("begin",(()=>{e.forceDisabled("resize")}),{priority:"lowest"}),t.on("cancel",(()=>{e.clearForceDisabled("resize")}),{priority:"highest"}),t.on("commit",(()=>{e.clearForceDisabled("resize")}),{priority:"highest"})}this._resizers.set(e.viewElement,t);const n=this.editor.editing.view.document.selection.getSelectedElement();return this.getResizerByViewElement(n)==t&&this.select(t),t}getResizerByViewElement(e){return this._resizers.get(e)}_getResizerByHandle(e){for(const t of this._resizers.values())if(t.containsHandle(e))return t}_mouseDownListener(e,t){const i=t.domTarget;U.isResizeHandle(i)&&(this._activeResizer=this._getResizerByHandle(i)||null,this._activeResizer&&(this._activeResizer.begin(i),e.stop(),t.preventDefault()))}_mouseMoveListener(e,t){this._activeResizer&&this._activeResizer.updateSize(t)}_mouseUpListener(){this._activeResizer&&(this._activeResizer.commit(),this._activeResizer=null)}}},7377:(e,t,i)=>{"use strict";i.d(t,{$J:()=>n.ClipboardMarkersUtils,B0:()=>n.Clipboard,xz:()=>n.ClipboardPipeline});var n=i(6034)},1204:(e,t,i)=>{"use strict";i.d(t,{JF:()=>n.attachToForm,KE:()=>n.Editor,Pt:()=>n.icons,TS:()=>n.PendingActions,fE:()=>n.MultiCommand,k_:()=>n.Plugin,mJ:()=>n.ElementApiMixin,uB:()=>n.Command});var n=i(1024)},4133:(e,t,i)=>{"use strict";i.d(t,{$0:()=>n.needsPlaceholder,$A:()=>n.DomEventObserver,D0:()=>n.addBackgroundRules,Hg:()=>n.Element,JT:()=>n.enablePlaceholder,Oo:()=>n.LiveRange,P$:()=>n.DomConverter,PN:()=>n.Matcher,Re:()=>n.ClickObserver,SH:()=>n.getFillerOffset,Vg:()=>n.ViewDocument,Vq:()=>n.isLength,Wq:()=>n.UpcastWriter,YU:()=>n.hidePlaceholder,Zu:()=>n.showPlaceholder,_o:()=>n.isColor,fp:()=>n.isPercentage,m8:()=>n.LivePosition,mC:()=>n.addPaddingRules,nu:()=>n.Observer,rU:()=>n.TreeWalker,v7:()=>n.addBorderRules,vt:()=>n.addMarginRules,zN:()=>n.DowncastWriter});var n=i(151)},6449:(e,t,i)=>{"use strict";i.d(t,{D:()=>n.ShiftEnter,x:()=>n.Enter});var n=i(7207)},7211:(e,t,i)=>{"use strict";i.d(t,{IG:()=>n.Typing,Il:()=>n.inlineHighlight,Py:()=>n.findAttributeRange,Vp:()=>n.TwoStepCaretMovement,ep:()=>n.Delete,ex:()=>n.getLastTextLine,pd:()=>n.Input,qV:()=>n.TextWatcher});var n=i(6192)},949:(e,t,i)=>{"use strict";i.d(t,{AO:()=>n.SplitButtonView,BD:()=>n.ListItemView,BY:()=>n.MenuBarMenuListView,By:()=>n.createLabeledDropdown,Dy:()=>n.FormHeaderView,Eg:()=>n.Notification,F_:()=>n.createLabeledInputNumber,GG:()=>n.MenuBarMenuListItemFileDialogButtonView,Gn:()=>n.EditorUI,H:()=>n.FocusCycler,I8:()=>n.MenuBarMenuListItemView,IY:()=>n.ToolbarSeparatorView,Jc:()=>n.ViewModel,Je:()=>n.ListSeparatorView,Jr:()=>n.BalloonPanelView,KO:()=>n.AccessibilityHelp,Kn:()=>n.CollapsibleView,LU:()=>n.InlineEditableUIView,O:()=>n.addListToDropdown,Ss:()=>n.View,Vr:()=>n.createLabeledInputText,Wm:()=>n.SwitchButtonView,X3:()=>n.ToolbarView,Xt:()=>n.BoxedEditorUIView,Z5:()=>n.submitHandler,Zn:()=>n.focusChildOnDropdownOpen,_:()=>n.ButtonView,_m:()=>n.DialogView,b2:()=>n.getLocalizedColorOptions,eF:()=>n.FileDialogButtonView,fM:()=>n.addToolbarToDropdown,fl:()=>n.normalizeToolbarConfig,hK:()=>n.InputTextView,kS:()=>n.MenuBarMenuListItemButtonView,l1:()=>n.addKeyboardHandlingForGrid,lF:()=>n.normalizeColorOptions,lG:()=>n.Dialog,lU:()=>n.DropdownButtonView,oB:()=>n.ColorSelectorView,pU:()=>n.ContextualBalloon,s3:()=>n.ViewCollection,uO:()=>n.ListView,wi:()=>n.CssTransitionDisablerMixin,wy:()=>n.clickOutsideHandler,xE:()=>n.LabeledFieldView,xw:()=>n.StickyPanelView,y0:()=>n.LabelView,yJ:()=>n.MenuBarView,yu:()=>n.createDropdown,zj:()=>n.MenuBarMenuView});var n=i(7243)},6417:(e,t,i)=>{"use strict";i.d(t,{Vn:()=>n.Undo});var n=i(8511)},5318:(e,t,i)=>{"use strict";i.d(t,{$1:()=>n.first,$r:()=>n.toArray,$x:()=>n.FocusTracker,EP:()=>n.KeystrokeHandler,FF:()=>n.logWarning,Kf:()=>n.getLocalizedArrowKeyCodeDirection,Ld:()=>n.uid,PZ:()=>n.ElementReplacer,QC:()=>n.getCode,Sf:()=>n.global,VM:()=>n.ObservableMixin,Yb:()=>n.CKEditorError,ZX:()=>n.parseKeystroke,_K:()=>n.env,av:()=>n.toMap,c5:()=>n.DomEmitterMixin,iJ:()=>n.getLanguageDirection,n:()=>n.createElement,pG:()=>n.getDataFromElement,pM:()=>n.Collection,rw:()=>n.Rect,uP:()=>n.keyCodes,vx:()=>n.priorities});var n=i(7906)},5091:(e,t,i)=>{"use strict";i.d(t,{Ex:()=>n.toWidget,VE:()=>n.WidgetResize,Wu:()=>n.calculateResizeHostAncestorWidth,YN:()=>n.toWidgetEditable,iB:()=>n.findOptimalInsertionRange,oP:()=>n.WidgetToolbarRepository,p4:()=>n.isWidget,x0:()=>n.Widget});var n=i(3906)},9469:(e,t,i)=>{"use strict";i.d(t,{A:()=>a});var n=i(6984);const o=function(e,t){for(var i=e.length;i--;)if((0,n.A)(e[i][0],t))return i;return-1};var s=Array.prototype.splice;function r(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}r.prototype.clear=function(){this.__data__=[],this.size=0},r.prototype.delete=function(e){var t=this.__data__,i=o(t,e);return!(i<0||(i==t.length-1?t.pop():s.call(t,i,1),--this.size,0))},r.prototype.get=function(e){var t=this.__data__,i=o(t,e);return i<0?void 0:t[i][1]},r.prototype.has=function(e){return o(this.__data__,e)>-1},r.prototype.set=function(e,t){var i=this.__data__,n=o(i,e);return n<0?(++this.size,i.push([e,t])):i[n][1]=t,this};const a=r},8335:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var n=i(8562),o=i(1917);const s=(0,n.A)(o.A,"Map")},2050:(e,t,i)=>{"use strict";i.d(t,{A:()=>h});const n=(0,i(8562).A)(Object,"create");var o=Object.prototype.hasOwnProperty;var s=Object.prototype.hasOwnProperty;function r(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}r.prototype.clear=function(){this.__data__=n?n(null):{},this.size=0},r.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},r.prototype.get=function(e){var t=this.__data__;if(n){var i=t[e];return"__lodash_hash_undefined__"===i?void 0:i}return o.call(t,e)?t[e]:void 0},r.prototype.has=function(e){var t=this.__data__;return n?void 0!==t[e]:s.call(t,e)},r.prototype.set=function(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=n&&void 0===t?"__lodash_hash_undefined__":t,this};const a=r;var l=i(9469),c=i(8335);const d=function(e,t){var i,n,o=e.__data__;return("string"==(n=typeof(i=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==i:null===i)?o["string"==typeof t?"string":"hash"]:o.map};function u(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var n=e[t];this.set(n[0],n[1])}}u.prototype.clear=function(){this.size=0,this.__data__={hash:new a,map:new(c.A||l.A),string:new a}},u.prototype.delete=function(e){var t=d(this,e).delete(e);return this.size-=t?1:0,t},u.prototype.get=function(e){return d(this,e).get(e)},u.prototype.has=function(e){return d(this,e).has(e)},u.prototype.set=function(e,t){var i=d(this,e),n=i.size;return i.set(e,t),this.size+=i.size==n?0:1,this};const h=u},2080:(e,t,i)=>{"use strict";i.d(t,{A:()=>a});var n=i(9469);var o=i(8335),s=i(2050);function r(e){var t=this.__data__=new n.A(e);this.size=t.size}r.prototype.clear=function(){this.__data__=new n.A,this.size=0},r.prototype.delete=function(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i},r.prototype.get=function(e){return this.__data__.get(e)},r.prototype.has=function(e){return this.__data__.has(e)},r.prototype.set=function(e,t){var i=this.__data__;if(i instanceof n.A){var r=i.__data__;if(!o.A||r.length<199)return r.push([e,t]),this.size=++i.size,this;i=this.__data__=new s.A(r)}return i.set(e,t),this.size=i.size,this};const a=r},241:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=i(1917).A.Symbol},3988:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=i(1917).A.Uint8Array},2505:(e,t,i)=>{"use strict";i.d(t,{A:()=>c});var n=i(5175),o=i(2049),s=i(1200),r=i(5353),a=i(4749),l=Object.prototype.hasOwnProperty;const c=function(e,t){var i=(0,o.A)(e),c=!i&&(0,n.A)(e),d=!i&&!c&&(0,s.A)(e),u=!i&&!c&&!d&&(0,a.A)(e),h=i||c||d||u,m=h?function(e,t){for(var i=-1,n=Array(e);++i<e;)n[i]=t(i);return n}(e.length,String):[],g=m.length;for(var f in e)!t&&!l.call(e,f)||h&&("length"==f||d&&("offset"==f||"parent"==f)||u&&("buffer"==f||"byteLength"==f||"byteOffset"==f)||(0,r.A)(f,g))||m.push(f);return m}},5572:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(e,t){for(var i=-1,n=null==e?0:e.length,o=Array(n);++i<n;)o[i]=t(e[i],i,e);return o}},6912:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(e,t){for(var i=-1,n=t.length,o=e.length;++i<n;)e[o+i]=t[i];return e}},2851:(e,t,i)=>{"use strict";i.d(t,{A:()=>r});var n=i(2528),o=i(6984),s=Object.prototype.hasOwnProperty;const r=function(e,t,i){var r=e[t];s.call(e,t)&&(0,o.A)(r,i)&&(void 0!==i||t in e)||(0,n.A)(e,t,i)}},2528:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=i(4171);const o=function(e,t,i){"__proto__"==t&&n.A?(0,n.A)(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i}},9592:(e,t,i)=>{"use strict";i.d(t,{A:()=>H});var n=i(2080);var o=i(2851),s=i(2031),r=i(7405);var a=i(9999);var l=i(154),c=i(9759),d=i(6489);var u=i(6912),h=i(5647),m=i(3153);const g=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)(0,u.A)(t,(0,d.A)(e)),e=(0,h.A)(e);return t}:m.A;var f=i(9042),p=i(3831);const b=function(e){return(0,p.A)(e,a.A,g)};var w=i(2434),v=Object.prototype.hasOwnProperty;var _=i(565);var y=/\w*$/;var k=i(241),C=k.A?k.A.prototype:void 0,A=C?C.valueOf:void 0;var E=i(1801);const x=function(e,t,i){var n,o,s,r=e.constructor;switch(t){case"[object ArrayBuffer]":return(0,_.A)(e);case"[object Boolean]":case"[object Date]":return new r(+e);case"[object DataView]":return function(e,t){var i=t?(0,_.A)(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)}(e,i);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return(0,E.A)(e,i);case"[object Map]":case"[object Set]":return new r;case"[object Number]":case"[object String]":return new r(e);case"[object RegExp]":return(s=new(o=e).constructor(o.source,y.exec(o))).lastIndex=o.lastIndex,s;case"[object Symbol]":return n=e,A?Object(A.call(n)):{}}};var T=i(407),P=i(2049),I=i(1200),S=i(3098);var V=i(2789),R=i(4841),B=R.A&&R.A.isMap;const M=B?(0,V.A)(B):function(e){return(0,S.A)(e)&&"[object Map]"==(0,w.A)(e)};var O=i(3149);var L=R.A&&R.A.isSet;const F=L?(0,V.A)(L):function(e){return(0,S.A)(e)&&"[object Set]"==(0,w.A)(e)};var N="[object Arguments]",D="[object Function]",z="[object Object]",W={};W[N]=W["[object Array]"]=W["[object ArrayBuffer]"]=W["[object DataView]"]=W["[object Boolean]"]=W["[object Date]"]=W["[object Float32Array]"]=W["[object Float64Array]"]=W["[object Int8Array]"]=W["[object Int16Array]"]=W["[object Int32Array]"]=W["[object Map]"]=W["[object Number]"]=W[z]=W["[object RegExp]"]=W["[object Set]"]=W["[object String]"]=W["[object Symbol]"]=W["[object Uint8Array]"]=W["[object Uint8ClampedArray]"]=W["[object Uint16Array]"]=W["[object Uint32Array]"]=!0,W["[object Error]"]=W[D]=W["[object WeakMap]"]=!1;const H=function e(t,i,u,h,m,p){var _,y=1&i,k=2&i,C=4&i;if(u&&(_=m?u(t,h,m,p):u(t)),void 0!==_)return _;if(!(0,O.A)(t))return t;var A=(0,P.A)(t);if(A){if(_=function(e){var t=e.length,i=new e.constructor(t);return t&&"string"==typeof e[0]&&v.call(e,"index")&&(i.index=e.index,i.input=e.input),i}(t),!y)return(0,c.A)(t,_)}else{var E=(0,w.A)(t),S=E==D||"[object GeneratorFunction]"==E;if((0,I.A)(t))return(0,l.A)(t,y);if(E==z||E==N||S&&!m){if(_=k||S?{}:(0,T.A)(t),!y)return k?function(e,t){return(0,s.A)(e,g(e),t)}(t,function(e,t){return e&&(0,s.A)(t,(0,a.A)(t),e)}(_,t)):function(e,t){return(0,s.A)(e,(0,d.A)(e),t)}(t,function(e,t){return e&&(0,s.A)(t,(0,r.A)(t),e)}(_,t))}else{if(!W[E])return m?t:{};_=x(t,E,y)}}p||(p=new n.A);var V=p.get(t);if(V)return V;p.set(t,_),F(t)?t.forEach((function(n){_.add(e(n,i,u,n,t,p))})):M(t)&&t.forEach((function(n,o){_.set(o,e(n,i,u,o,t,p))}));var R=C?k?b:f.A:k?a.A:r.A,B=A?void 0:R(t);return function(e,t){for(var i=-1,n=null==e?0:e.length;++i<n&&!1!==t(e[i],i,e););}(B||t,(function(n,s){B&&(n=t[s=n]),(0,o.A)(_,s,e(n,i,u,s,t,p))})),_}},7132:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(e,t,i){for(var n=-1,o=Object(e),s=i(e),r=s.length;r--;){var a=s[++n];if(!1===t(o[a],a,o))break}return e}},9841:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var n=i(7132),o=i(7405);const s=function(e,t){return e&&(0,n.A)(e,t,o.A)}},6318:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var n=i(4878),o=i(901);const s=function(e,t){for(var i=0,s=(t=(0,n.A)(t,e)).length;null!=e&&i<s;)e=e[(0,o.A)(t[i++])];return i&&i==s?e:void 0}},3831:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var n=i(6912),o=i(2049);const s=function(e,t,i){var s=t(e);return(0,o.A)(e)?s:(0,n.A)(s,i(e))}},2383:(e,t,i)=>{"use strict";i.d(t,{A:()=>d});var n=i(241),o=Object.prototype,s=o.hasOwnProperty,r=o.toString,a=n.A?n.A.toStringTag:void 0;var l=Object.prototype.toString;var c=n.A?n.A.toStringTag:void 0;const d=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":c&&c in Object(e)?function(e){var t=s.call(e,a),i=e[a];try{e[a]=void 0;var n=!0}catch(e){}var o=r.call(e);return n&&(t?e[a]=i:delete e[a]),o}(e):function(e){return l.call(e)}(e)}},5407:(e,t,i)=>{"use strict";i.d(t,{A:()=>P});var n=i(2080),o=i(2050);function s(e){var t=-1,i=null==e?0:e.length;for(this.__data__=new o.A;++t<i;)this.add(e[t])}s.prototype.add=s.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},s.prototype.has=function(e){return this.__data__.has(e)};const r=s,a=function(e,t){for(var i=-1,n=null==e?0:e.length;++i<n;)if(t(e[i],i,e))return!0;return!1},l=function(e,t,i,n,o,s){var l=1&i,c=e.length,d=t.length;if(c!=d&&!(l&&d>c))return!1;var u=s.get(e),h=s.get(t);if(u&&h)return u==t&&h==e;var m=-1,g=!0,f=2&i?new r:void 0;for(s.set(e,t),s.set(t,e);++m<c;){var p=e[m],b=t[m];if(n)var w=l?n(b,p,m,t,e,s):n(p,b,m,e,t,s);if(void 0!==w){if(w)continue;g=!1;break}if(f){if(!a(t,(function(e,t){if(r=t,!f.has(r)&&(p===e||o(p,e,i,n,s)))return f.push(t);var r}))){g=!1;break}}else if(p!==b&&!o(p,b,i,n,s)){g=!1;break}}return s.delete(e),s.delete(t),g};var c=i(241),d=i(3988),u=i(6984);const h=function(e){var t=-1,i=Array(e.size);return e.forEach((function(e,n){i[++t]=[n,e]})),i},m=function(e){var t=-1,i=Array(e.size);return e.forEach((function(e){i[++t]=e})),i};var g=c.A?c.A.prototype:void 0,f=g?g.valueOf:void 0;var p=i(9042),b=Object.prototype.hasOwnProperty;var w=i(2434),v=i(2049),_=i(1200),y=i(4749),k="[object Arguments]",C="[object Array]",A="[object Object]",E=Object.prototype.hasOwnProperty;const x=function(e,t,i,o,s,r){var a=(0,v.A)(e),c=(0,v.A)(t),g=a?C:(0,w.A)(e),x=c?C:(0,w.A)(t),T=(g=g==k?A:g)==A,P=(x=x==k?A:x)==A,I=g==x;if(I&&(0,_.A)(e)){if(!(0,_.A)(t))return!1;a=!0,T=!1}if(I&&!T)return r||(r=new n.A),a||(0,y.A)(e)?l(e,t,i,o,s,r):function(e,t,i,n,o,s,r){switch(i){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!s(new d.A(e),new d.A(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return(0,u.A)(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=h;case"[object Set]":var c=1&n;if(a||(a=m),e.size!=t.size&&!c)return!1;var g=r.get(e);if(g)return g==t;n|=2,r.set(e,t);var p=l(a(e),a(t),n,o,s,r);return r.delete(e),p;case"[object Symbol]":if(f)return f.call(e)==f.call(t)}return!1}(e,t,g,i,o,s,r);if(!(1&i)){var S=T&&E.call(e,"__wrapped__"),V=P&&E.call(t,"__wrapped__");if(S||V){var R=S?e.value():e,B=V?t.value():t;return r||(r=new n.A),s(R,B,i,o,r)}}return!!I&&(r||(r=new n.A),function(e,t,i,n,o,s){var r=1&i,a=(0,p.A)(e),l=a.length;if(l!=(0,p.A)(t).length&&!r)return!1;for(var c=l;c--;){var d=a[c];if(!(r?d in t:b.call(t,d)))return!1}var u=s.get(e),h=s.get(t);if(u&&h)return u==t&&h==e;var m=!0;s.set(e,t),s.set(t,e);for(var g=r;++c<l;){var f=e[d=a[c]],w=t[d];if(n)var v=r?n(w,f,d,t,e,s):n(f,w,d,e,t,s);if(!(void 0===v?f===w||o(f,w,i,n,s):v)){m=!1;break}g||(g="constructor"==d)}if(m&&!g){var _=e.constructor,y=t.constructor;_==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof _&&_ instanceof _&&"function"==typeof y&&y instanceof y||(m=!1)}return s.delete(e),s.delete(t),m}(e,t,i,o,s,r))};var T=i(3098);const P=function e(t,i,n,o,s){return t===i||(null==t||null==i||!(0,T.A)(t)&&!(0,T.A)(i)?t!=t&&i!=i:x(t,i,n,o,e,s))}},5396:(e,t,i)=>{"use strict";i.d(t,{A:()=>C});var n=i(2080),o=i(5407);var s=i(3149);const r=function(e){return e==e&&!(0,s.A)(e)};var a=i(7405);const l=function(e,t){return function(i){return null!=i&&i[e]===t&&(void 0!==t||e in Object(i))}},c=function(e){var t=function(e){for(var t=(0,a.A)(e),i=t.length;i--;){var n=t[i],o=e[n];t[i]=[n,o,r(o)]}return t}(e);return 1==t.length&&t[0][2]?l(t[0][0],t[0][1]):function(i){return i===e||function(e,t,i,s){var r=i.length,a=r,l=!s;if(null==e)return!a;for(e=Object(e);r--;){var c=i[r];if(l&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++r<a;){var d=(c=i[r])[0],u=e[d],h=c[1];if(l&&c[2]){if(void 0===u&&!(d in e))return!1}else{var m=new n.A;if(s)var g=s(u,h,d,e,t,m);if(!(void 0===g?(0,o.A)(h,u,3,s,m):g))return!1}}return!0}(i,e,t)}};var d=i(7500);const u=function(e,t){return null!=e&&t in Object(e)};var h=i(4878),m=i(5175),g=i(2049),f=i(5353),p=i(5254),b=i(901);const w=function(e,t){return null!=e&&function(e,t,i){for(var n=-1,o=(t=(0,h.A)(t,e)).length,s=!1;++n<o;){var r=(0,b.A)(t[n]);if(!(s=null!=e&&i(e,r)))break;e=e[r]}return s||++n!=o?s:!!(o=null==e?0:e.length)&&(0,p.A)(o)&&(0,f.A)(r,o)&&((0,g.A)(e)||(0,m.A)(e))}(e,t,u)};var v=i(6586);var _=i(9008);var y=i(6318);const k=function(e){return(0,v.A)(e)?(t=(0,b.A)(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return(0,y.A)(t,e)}}(e);var t},C=function(e){return"function"==typeof e?e:null==e?_.A:"object"==typeof e?(0,g.A)(e)?(t=e[0],i=e[1],(0,v.A)(t)&&r(i)?l((0,b.A)(t),i):function(e){var n=(0,d.A)(e,t);return void 0===n&&n===i?w(e,t):(0,o.A)(i,n,3)}):c(e):k(e);var t,i}},7688:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(e,t,i){var n=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(i=i>o?o:i)<0&&(i+=o),o=t>i?0:i-t>>>0,t>>>=0;for(var s=Array(o);++n<o;)s[n]=e[n+t];return s}},2789:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(e){return function(t){return e(t)}}},4878:(e,t,i)=>{"use strict";i.d(t,{A:()=>m});var n=i(2049),o=i(6586),s=i(2050);function r(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var i=function(){var n=arguments,o=t?t.apply(this,n):n[0],s=i.cache;if(s.has(o))return s.get(o);var r=e.apply(this,n);return i.cache=s.set(o,r)||s,r};return i.cache=new(r.Cache||s.A),i}r.Cache=s.A;var a=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,l=/\\(\\)?/g;const c=(d=r((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(a,(function(e,i,n,o){t.push(n?o.replace(l,"$1"):i||e)})),t}),(function(e){return 500===u.size&&u.clear(),e})),u=d.cache,d);var d,u,h=i(3456);const m=function(e,t){return(0,n.A)(e)?e:(0,o.A)(e,t)?[e]:c((0,h.A)(e))}},565:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=i(3988);const o=function(e){var t=new e.constructor(e.byteLength);return new n.A(t).set(new n.A(e)),t}},154:(e,t,i)=>{"use strict";i.d(t,{A:()=>l});var n=i(1917),o="object"==typeof exports&&exports&&!exports.nodeType&&exports,s=o&&"object"==typeof module&&module&&!module.nodeType&&module,r=s&&s.exports===o?n.A.Buffer:void 0,a=r?r.allocUnsafe:void 0;const l=function(e,t){if(t)return e.slice();var i=e.length,n=a?a(i):new e.constructor(i);return e.copy(n),n}},1801:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=i(565);const o=function(e,t){var i=t?(0,n.A)(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}},9759:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(e,t){var i=-1,n=e.length;for(t||(t=Array(n));++i<n;)t[i]=e[i];return t}},2031:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var n=i(2851),o=i(2528);const s=function(e,t,i,s){var r=!i;i||(i={});for(var a=-1,l=t.length;++a<l;){var c=t[a],d=s?s(i[c],e[c],c,i,e):void 0;void 0===d&&(d=e[c]),r?(0,o.A)(i,c,d):(0,n.A)(i,c,d)}return i}},5988:(e,t,i)=>{"use strict";i.d(t,{A:()=>b});var n=i(9008);var o=Math.max;var s=i(4171);const r=s.A?function(e,t){return(0,s.A)(e,"toString",{configurable:!0,enumerable:!1,value:(i=t,function(){return i}),writable:!0});var i}:n.A;var a=Date.now;const l=(c=r,d=0,u=0,function(){var e=a(),t=16-(e-u);if(u=e,t>0){if(++d>=800)return arguments[0]}else d=0;return c.apply(void 0,arguments)});var c,d,u;const h=function(e,t){return l(function(e,t,i){return t=o(void 0===t?e.length-1:t,0),function(){for(var n=arguments,s=-1,r=o(n.length-t,0),a=Array(r);++s<r;)a[s]=n[t+s];s=-1;for(var l=Array(t+1);++s<t;)l[s]=n[s];return l[t]=i(a),function(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)}(e,this,l)}}(e,t,n.A),e+"")};var m=i(6984),g=i(8446),f=i(5353),p=i(3149);const b=function(e){return h((function(t,i){var n=-1,o=i.length,s=o>1?i[o-1]:void 0,r=o>2?i[2]:void 0;for(s=e.length>3&&"function"==typeof s?(o--,s):void 0,r&&function(e,t,i){if(!(0,p.A)(i))return!1;var n=typeof t;return!!("number"==n?(0,g.A)(i)&&(0,f.A)(t,i.length):"string"==n&&t in i)&&(0,m.A)(i[t],e)}(i[0],i[1],r)&&(s=o<3?void 0:s,o=1),t=Object(t);++n<o;){var a=i[n];a&&e(t,a,n,s)}return t}))}},4171:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=i(8562);const o=function(){try{var e=(0,n.A)(Object,"defineProperty");return e({},"",{}),e}catch(e){}}()},2136:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n="object"==typeof global&&global&&global.Object===Object&&global},9042:(e,t,i)=>{"use strict";i.d(t,{A:()=>r});var n=i(3831),o=i(6489),s=i(7405);const r=function(e){return(0,n.A)(e,s.A,o.A)}},8562:(e,t,i)=>{"use strict";i.d(t,{A:()=>p});var n=i(9610);const o=i(1917).A["__core-js_shared__"];var s,r=(s=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+s:"";var a=i(3149),l=i(1121),c=/^\[object .+?Constructor\]$/,d=Function.prototype,u=Object.prototype,h=d.toString,m=u.hasOwnProperty,g=RegExp("^"+h.call(m).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const f=function(e){return!(!(0,a.A)(e)||(t=e,r&&r in t))&&((0,n.A)(e)?g:c).test((0,l.A)(e));var t},p=function(e,t){var i=function(e,t){return null==e?void 0:e[t]}(e,t);return f(i)?i:void 0}},5647:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=(0,i(367).A)(Object.getPrototypeOf,Object)},6489:(e,t,i)=>{"use strict";i.d(t,{A:()=>r});var n=i(3153),o=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols;const r=s?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var i=-1,n=null==e?0:e.length,o=0,s=[];++i<n;){var r=e[i];t(r,i,e)&&(s[o++]=r)}return s}(s(e),(function(t){return o.call(e,t)})))}:n.A},2434:(e,t,i)=>{"use strict";i.d(t,{A:()=>C});var n=i(8562),o=i(1917);const s=(0,n.A)(o.A,"DataView");var r=i(8335);const a=(0,n.A)(o.A,"Promise"),l=(0,n.A)(o.A,"Set"),c=(0,n.A)(o.A,"WeakMap");var d=i(2383),u=i(1121),h="[object Map]",m="[object Promise]",g="[object Set]",f="[object WeakMap]",p="[object DataView]",b=(0,u.A)(s),w=(0,u.A)(r.A),v=(0,u.A)(a),_=(0,u.A)(l),y=(0,u.A)(c),k=d.A;(s&&k(new s(new ArrayBuffer(1)))!=p||r.A&&k(new r.A)!=h||a&&k(a.resolve())!=m||l&&k(new l)!=g||c&&k(new c)!=f)&&(k=function(e){var t=(0,d.A)(e),i="[object Object]"==t?e.constructor:void 0,n=i?(0,u.A)(i):"";if(n)switch(n){case b:return p;case w:return h;case v:return m;case _:return g;case y:return f}return t});const C=k},407:(e,t,i)=>{"use strict";i.d(t,{A:()=>l});var n=i(3149),o=Object.create;const s=function(){function e(){}return function(t){if(!(0,n.A)(t))return{};if(o)return o(t);e.prototype=t;var i=new e;return e.prototype=void 0,i}}();var r=i(5647),a=i(7271);const l=function(e){return"function"!=typeof e.constructor||(0,a.A)(e)?{}:s((0,r.A)(e))}},5353:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=/^(?:0|[1-9]\d*)$/;const o=function(e,t){var i=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==i||"symbol"!=i&&n.test(e))&&e>-1&&e%1==0&&e<t}},6586:(e,t,i)=>{"use strict";i.d(t,{A:()=>a});var n=i(2049),o=i(1882),s=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;const a=function(e,t){if((0,n.A)(e))return!1;var i=typeof e;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=e&&!(0,o.A)(e))||r.test(e)||!s.test(e)||null!=t&&e in Object(t)}},7271:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=Object.prototype;const o=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||n)}},4841:(e,t,i)=>{"use strict";i.d(t,{A:()=>a});var n=i(2136),o="object"==typeof exports&&exports&&!exports.nodeType&&exports,s=o&&"object"==typeof module&&module&&!module.nodeType&&module,r=s&&s.exports===o&&n.A.process;const a=function(){try{return s&&s.require&&s.require("util").types||r&&r.binding&&r.binding("util")}catch(e){}}()},367:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(e,t){return function(i){return e(t(i))}}},1917:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var n=i(2136),o="object"==typeof self&&self&&self.Object===Object&&self;const s=n.A||o||Function("return this")()},901:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=i(1882);const o=function(e){if("string"==typeof e||(0,n.A)(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}},1121:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=Function.prototype.toString;const o=function(e){if(null!=e){try{return n.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},6232:(e,t,i)=>{"use strict";i.d(t,{A:()=>r});var n=i(2031),o=i(5988),s=i(9999);const r=(0,o.A)((function(e,t){(0,n.A)(t,(0,s.A)(t),e)}))},903:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=i(9592);const o=function(e){return(0,n.A)(e,5)}},3967:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=i(9592);const o=function(e,t){return t="function"==typeof t?t:void 0,(0,n.A)(e,5,t)}},2223:(e,t,i)=>{"use strict";i.d(t,{A:()=>b});var n=i(3149),o=i(1917);const s=function(){return o.A.Date.now()};var r=/\s/;var a=/^\s+/;const l=function(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&r.test(e.charAt(t)););return t}(e)+1).replace(a,""):e};var c=i(1882),d=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,h=/^0o[0-7]+$/i,m=parseInt;const g=function(e){if("number"==typeof e)return e;if((0,c.A)(e))return NaN;if((0,n.A)(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=(0,n.A)(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=l(e);var i=u.test(e);return i||h.test(e)?m(e.slice(2),i?2:8):d.test(e)?NaN:+e};var f=Math.max,p=Math.min;const b=function(e,t,i){var o,r,a,l,c,d,u=0,h=!1,m=!1,b=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function w(t){var i=o,n=r;return o=r=void 0,u=t,l=e.apply(n,i)}function v(e){var i=e-d;return void 0===d||i>=t||i<0||m&&e-u>=a}function _(){var e=s();if(v(e))return y(e);c=setTimeout(_,function(e){var i=t-(e-d);return m?p(i,a-(e-u)):i}(e))}function y(e){return c=void 0,b&&o?w(e):(o=r=void 0,l)}function k(){var e=s(),i=v(e);if(o=arguments,r=this,d=e,i){if(void 0===c)return function(e){return u=e,c=setTimeout(_,t),h?w(e):l}(d);if(m)return clearTimeout(c),c=setTimeout(_,t),w(d)}return void 0===c&&(c=setTimeout(_,t)),l}return t=g(t)||0,(0,n.A)(i)&&(h=!!i.leading,a=(m="maxWait"in i)?f(g(i.maxWait)||0,t):a,b="trailing"in i?!!i.trailing:b),k.cancel=function(){void 0!==c&&clearTimeout(c),u=0,o=d=r=c=void 0},k.flush=function(){return void 0===c?l:y(s())},k}},6984:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(e,t){return e===t||e!=e&&t!=t}},3224:(e,t,i)=>{"use strict";i.d(t,{A:()=>r});var n=i(3456),o=/[\\^$.*+?()[\]{}|]/g,s=RegExp(o.source);const r=function(e){return(e=(0,n.A)(e))&&s.test(e)?e.replace(o,"\\$&"):e}},7500:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=i(6318);const o=function(e,t,i){var o=null==e?void 0:(0,n.A)(e,t);return void 0===o?i:o}},9008:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(e){return e}},5175:(e,t,i)=>{"use strict";i.d(t,{A:()=>c});var n=i(2383),o=i(3098);const s=function(e){return(0,o.A)(e)&&"[object Arguments]"==(0,n.A)(e)};var r=Object.prototype,a=r.hasOwnProperty,l=r.propertyIsEnumerable;const c=s(function(){return arguments}())?s:function(e){return(0,o.A)(e)&&a.call(e,"callee")&&!l.call(e,"callee")}},2049:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=Array.isArray},8446:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var n=i(9610),o=i(5254);const s=function(e){return null!=e&&(0,o.A)(e.length)&&!(0,n.A)(e)}},1200:(e,t,i)=>{"use strict";i.d(t,{A:()=>a});var n=i(1917);var o="object"==typeof exports&&exports&&!exports.nodeType&&exports,s=o&&"object"==typeof module&&module&&!module.nodeType&&module,r=s&&s.exports===o?n.A.Buffer:void 0;const a=(r?r.isBuffer:void 0)||function(){return!1}},1500:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var n=i(3098),o=i(4963);const s=function(e){return(0,n.A)(e)&&1===e.nodeType&&!(0,o.A)(e)}},6996:(e,t,i)=>{"use strict";i.d(t,{A:()=>o});var n=i(5407);const o=function(e,t){return(0,n.A)(e,t)}},9610:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var n=i(2383),o=i(3149);const s=function(e){if(!(0,o.A)(e))return!1;var t=(0,n.A)(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},5254:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},3149:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},3098:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(e){return null!=e&&"object"==typeof e}},4963:(e,t,i)=>{"use strict";i.d(t,{A:()=>u});var n=i(2383),o=i(5647),s=i(3098),r=Function.prototype,a=Object.prototype,l=r.toString,c=a.hasOwnProperty,d=l.call(Object);const u=function(e){if(!(0,s.A)(e)||"[object Object]"!=(0,n.A)(e))return!1;var t=(0,o.A)(e);if(null===t)return!0;var i=c.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&l.call(i)==d}},1882:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var n=i(2383),o=i(3098);const s=function(e){return"symbol"==typeof e||(0,o.A)(e)&&"[object Symbol]"==(0,n.A)(e)}},4749:(e,t,i)=>{"use strict";i.d(t,{A:()=>d});var n=i(2383),o=i(5254),s=i(3098),r={};r["[object Float32Array]"]=r["[object Float64Array]"]=r["[object Int8Array]"]=r["[object Int16Array]"]=r["[object Int32Array]"]=r["[object Uint8Array]"]=r["[object Uint8ClampedArray]"]=r["[object Uint16Array]"]=r["[object Uint32Array]"]=!0,r["[object Arguments]"]=r["[object Array]"]=r["[object ArrayBuffer]"]=r["[object Boolean]"]=r["[object DataView]"]=r["[object Date]"]=r["[object Error]"]=r["[object Function]"]=r["[object Map]"]=r["[object Number]"]=r["[object Object]"]=r["[object RegExp]"]=r["[object Set]"]=r["[object String]"]=r["[object WeakMap]"]=!1;var a=i(2789),l=i(4841),c=l.A&&l.A.isTypedArray;const d=c?(0,a.A)(c):function(e){return(0,s.A)(e)&&(0,o.A)(e.length)&&!!r[(0,n.A)(e)]}},7405:(e,t,i)=>{"use strict";i.d(t,{A:()=>l});var n=i(2505),o=i(7271);const s=(0,i(367).A)(Object.keys,Object);var r=Object.prototype.hasOwnProperty;var a=i(8446);const l=function(e){return(0,a.A)(e)?(0,n.A)(e):function(e){if(!(0,o.A)(e))return s(e);var t=[];for(var i in Object(e))r.call(e,i)&&"constructor"!=i&&t.push(i);return t}(e)}},9999:(e,t,i)=>{"use strict";i.d(t,{A:()=>c});var n=i(2505),o=i(3149),s=i(7271);var r=Object.prototype.hasOwnProperty;const a=function(e){if(!(0,o.A)(e))return function(e){var t=[];if(null!=e)for(var i in Object(e))t.push(i);return t}(e);var t=(0,s.A)(e),i=[];for(var n in e)("constructor"!=n||!t&&r.call(e,n))&&i.push(n);return i};var l=i(8446);const c=function(e){return(0,l.A)(e)?(0,n.A)(e,!0):a(e)}},6248:(e,t,i)=>{"use strict";i.d(t,{A:()=>x});var n=i(2080),o=i(2528),s=i(6984);const r=function(e,t,i){(void 0!==i&&!(0,s.A)(e[t],i)||void 0===i&&!(t in e))&&(0,o.A)(e,t,i)};var a=i(7132),l=i(154),c=i(1801),d=i(9759),u=i(407),h=i(5175),m=i(2049),g=i(8446),f=i(3098);var p=i(1200),b=i(9610),w=i(3149),v=i(4963),_=i(4749);const y=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]};var k=i(2031),C=i(9999);const A=function(e,t,i,n,o,s,a){var A,E=y(e,i),x=y(t,i),T=a.get(x);if(T)r(e,i,T);else{var P=s?s(E,x,i+"",e,t,a):void 0,I=void 0===P;if(I){var S=(0,m.A)(x),V=!S&&(0,p.A)(x),R=!S&&!V&&(0,_.A)(x);P=x,S||V||R?(0,m.A)(E)?P=E:(A=E,(0,f.A)(A)&&(0,g.A)(A)?P=(0,d.A)(E):V?(I=!1,P=(0,l.A)(x,!0)):R?(I=!1,P=(0,c.A)(x,!0)):P=[]):(0,v.A)(x)||(0,h.A)(x)?(P=E,(0,h.A)(E)?P=function(e){return(0,k.A)(e,(0,C.A)(e))}(E):(0,w.A)(E)&&!(0,b.A)(E)||(P=(0,u.A)(x))):I=!1}I&&(a.set(x,P),o(P,x,n,s,a),a.delete(x)),r(e,i,P)}},E=function e(t,i,o,s,l){t!==i&&(0,a.A)(i,(function(a,c){if(l||(l=new n.A),(0,w.A)(a))A(t,i,c,o,e,s,l);else{var d=s?s(y(t,c),a,c+"",t,i,l):void 0;void 0===d&&(d=a),r(t,c,d)}}),C.A)},x=(0,i(5988).A)((function(e,t,i){E(e,t,i)}))},3153:(e,t,i)=>{"use strict";i.d(t,{A:()=>n});const n=function(){return[]}},4022:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var n=i(2223),o=i(3149);const s=function(e,t,i){var s=!0,r=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return(0,o.A)(i)&&(s="leading"in i?!!i.leading:s,r="trailing"in i?!!i.trailing:r),(0,n.A)(e,t,{leading:s,maxWait:t,trailing:r})}},3456:(e,t,i)=>{"use strict";i.d(t,{A:()=>d});var n=i(241),o=i(5572),s=i(2049),r=i(1882),a=n.A?n.A.prototype:void 0,l=a?a.toString:void 0;const c=function e(t){if("string"==typeof t)return t;if((0,s.A)(t))return(0,o.A)(t,e)+"";if((0,r.A)(t))return l?l.call(t):"";var i=t+"";return"0"==i&&1/t==-1/0?"-0":i},d=function(e){return null==e?"":c(e)}}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var s=n[e]={exports:{}};return i[e](s,s.exports,o),s.exports}return t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(i,n){if(1&n&&(i=this(i)),8&n)return i;if("object"==typeof i&&i){if(4&n&&i.__esModule)return i;if(16&n&&"function"==typeof i.then)return i}var s=Object.create(null);o.r(s);var r={};e=e||[null,t({}),t([]),t(t)];for(var a=2&n&&i;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((e=>r[e]=()=>i[e]));return r.default=()=>i,o.d(s,r),s},o.d=(e,t)=>{for(var i in t)o.o(t,i)&&!o.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o(73)})()));
\ No newline at end of file