trilium/libraries/ckeditor/ckeditor.js
2020-09-21 22:08:54 +02:00

6 lines
803 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*!
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md.
*/
!function(e){const t=e.en=e.en||{};t.dictionary=Object.assign(t.dictionary||{},{"%0 of %1":"%0 of %1","Align cell text to the bottom":"Align cell text to the bottom","Align cell text to the center":"Align cell text to the center","Align cell text to the left":"Align cell text to the left","Align cell text to the middle":"Align cell text to the middle","Align cell text to the right":"Align cell text to the right","Align cell text to the top":"Align cell text to the top","Align table to the left":"Align table to the left","Align table to the right":"Align table to the right",Alignment:"Alignment",Aquamarine:"Aquamarine",Background:"Background",Big:"Big",Black:"Black","Block quote":"Block quote",Blue:"Blue",Bold:"Bold",Border:"Border","Bulleted List":"Bulleted List",Cancel:"Cancel","Cannot upload file:":"Cannot upload file:","Cell properties":"Cell properties","Center table":"Center table","Centered image":"Centered image","Change image text alternative":"Change image text alternative","Choose heading":"Choose heading",Code:"Code",Color:"Color","Color picker":"Color picker",Column:"Column",Dashed:"Dashed","Decrease indent":"Decrease indent",Default:"Default","Delete column":"Delete column","Delete row":"Delete row","Dim grey":"Dim grey",Dimensions:"Dimensions","Document colors":"Document colors",Dotted:"Dotted",Double:"Double",Downloadable:"Downloadable","Dropdown toolbar":"Dropdown toolbar","Edit block":"Edit block","Edit link":"Edit link","Editor toolbar":"Editor toolbar","Enter image caption":"Enter image caption","Font Background Color":"Font Background Color","Font Color":"Font Color","Font Family":"Font Family","Font Size":"Font Size","Full size image":"Full size image",Green:"Green",Grey:"Grey",Groove:"Groove","Header column":"Header column","Header row":"Header row",Heading:"Heading","Heading 1":"Heading 1","Heading 2":"Heading 2","Heading 3":"Heading 3","Heading 4":"Heading 4","Heading 5":"Heading 5","Heading 6":"Heading 6",Height:"Height","Horizontal line":"Horizontal line","Horizontal text alignment toolbar":"Horizontal text alignment toolbar",Huge:"Huge","Image resize list":"Image resize list","Image toolbar":"Image toolbar","image widget":"image widget","Increase indent":"Increase indent",Insert:"Insert","Insert code block":"Insert code block","Insert column left":"Insert column left","Insert column right":"Insert column right","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",Inset:"Inset",Italic:"Italic","Justify cell text":"Justify cell text","Left aligned image":"Left aligned image","Light blue":"Light blue","Light green":"Light green","Light grey":"Light grey",Link:"Link","Link URL":"Link URL","Merge cell down":"Merge cell down","Merge cell left":"Merge cell left","Merge cell right":"Merge cell right","Merge cell up":"Merge cell up","Merge cells":"Merge cells",Next:"Next",None:"None","Numbered List":"Numbered List","Open in a new tab":"Open in a new tab","Open link in new tab":"Open link in new tab",Orange:"Orange",Original:"Original",Outset:"Outset",Padding:"Padding",Paragraph:"Paragraph","Paste the image source URL.":"Paste the image source URL.","Plain text":"Plain text",Previous:"Previous",Purple:"Purple",Red:"Red",Redo:"Redo","Remove color":"Remove color","Remove Format":"Remove Format","Resize image":"Resize image","Resize image to %0":"Resize image to %0","Resize image to the original size":"Resize image to the original size","Rich Text Editor, %0":"Rich Text Editor, %0",Ridge:"Ridge","Right aligned image":"Right aligned image",Row:"Row",Save:"Save","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",Strikethrough:"Strikethrough",Style:"Style",Subscript:"Subscript",Superscript:"Superscript","Table alignment toolbar":"Table alignment toolbar","Table cell text alignment":"Table cell text alignment","Table properties":"Table properties","Table toolbar":"Table toolbar","Text alternative":"Text alternative",'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".':'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".','The value is invalid. Try "10px" or "2em" or simply "2".':'The value is invalid. Try "10px" or "2em" or simply "2".',"This link has no URL":"This link has no URL",Tiny:"Tiny","To-do List":"To-do List",Turquoise:"Turquoise",Underline:"Underline",Undo:"Undo",Unlink:"Unlink",Update:"Update","Upload failed":"Upload failed","Upload in progress":"Upload in progress","Vertical text alignment toolbar":"Vertical text alignment toolbar",White:"White","Widget toolbar":"Widget toolbar",Width:"Width",Yellow:"Yellow"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.BalloonEditor=t():e.BalloonEditor=t()}(window,(function(){return function(e){var t={};function o(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,o),i.l=!0,i.exports}return o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(n,i,function(t){return e[t]}.bind(null,i));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=128)}([function(e,t,o){"use strict";o.d(t,"b",(function(){return n})),o.d(t,"a",(function(){return i}));class n extends Error{constructor(e,t,o){e=i(e),o&&(e+=" "+JSON.stringify(o)),super(e),this.name="CKEditorError",this.context=t,this.data=o}is(e){return"CKEditorError"===e}static rethrowUnexpectedError(e,t){if(e.is&&e.is("CKEditorError"))throw e;const o=new n(e.message,t);throw o.stack=e.stack,o}}function i(e){const t=e.match(/^([^:]+):/);return t?e+` Read more: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-${t[1]}\n`:e}},function(e,t,o){"use strict";var n,i=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},r=function(){var e={};return function(t){if(void 0===e[t]){var o=document.querySelector(t);if(window.HTMLIFrameElement&&o instanceof window.HTMLIFrameElement)try{o=o.contentDocument.head}catch(e){o=null}e[t]=o}return e[t]}}(),s=[];function a(e){for(var t=-1,o=0;o<s.length;o++)if(s[o].identifier===e){t=o;break}return t}function l(e,t){for(var o={},n=[],i=0;i<e.length;i++){var r=e[i],l=t.base?r[0]+t.base:r[0],c=o[l]||0,d="".concat(l," ").concat(c);o[l]=c+1;var h=a(d),u={css:r[1],media:r[2],sourceMap:r[3]};-1!==h?(s[h].references++,s[h].updater(u)):s.push({identifier:d,updater:p(u,t),references:1}),n.push(d)}return n}function c(e){var t=document.createElement("style"),n=e.attributes||{};if(void 0===n.nonce){var i=o.nc;i&&(n.nonce=i)}if(Object.keys(n).forEach((function(e){t.setAttribute(e,n[e])})),"function"==typeof e.insert)e.insert(t);else{var s=r(e.insert||"head");if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(t)}return t}var d,h=(d=[],function(e,t){return d[e]=t,d.filter(Boolean).join("\n")});function u(e,t,o,n){var i=o?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(e.styleSheet)e.styleSheet.cssText=h(t,i);else{var r=document.createTextNode(i),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(r,s[t]):e.appendChild(r)}}function m(e,t,o){var n=o.css,i=o.media,r=o.sourceMap;if(i?e.setAttribute("media",i):e.removeAttribute("media"),r&&btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var g=null,f=0;function p(e,t){var o,n,i;if(t.singleton){var r=f++;o=g||(g=c(t)),n=u.bind(null,o,r,!1),i=u.bind(null,o,r,!0)}else o=c(t),n=m.bind(null,o,t),i=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(o)};return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else i()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=i());var o=l(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var n=0;n<o.length;n++){var i=a(o[n]);s[i].references--}for(var r=l(e,t),c=0;c<o.length;c++){var d=a(o[c]);0===s[d].references&&(s[d].updater(),s.splice(d,1))}o=r}}}},,function(e,t,o){"use strict";var n=o(7),i="object"==typeof self&&self&&self.Object===Object&&self,r=n.a||i||Function("return this")();t.a=r},function(e,t,o){"use strict";(function(e){var n=o(3),i=o(15),r="object"==typeof exports&&exports&&!exports.nodeType&&exports,s=r&&"object"==typeof e&&e&&!e.nodeType&&e,a=s&&s.exports===r?n.a.Buffer:void 0,l=(a?a.isBuffer:void 0)||i.a;t.a=l}).call(this,o(9)(e))},function(e,t,o){"use strict";(function(e){var n=o(7),i="object"==typeof exports&&exports&&!exports.nodeType&&exports,r=i&&"object"==typeof e&&e&&!e.nodeType&&e,s=r&&r.exports===i&&n.a.process,a=function(){try{var e=r&&r.require&&r.require("util").types;return e||s&&s.binding&&s.binding("util")}catch(e){}}();t.a=a}).call(this,o(9)(e))},function(e,t,o){"use strict";(function(e){var t=o(0);const n="object"==typeof window?window:e;if(n.CKEDITOR_VERSION)throw new t.b("ckeditor-duplicated-modules: Some CKEditor 5 modules are duplicated.",null);n.CKEDITOR_VERSION="22.0.0"}).call(this,o(10))},function(e,t,o){"use strict";(function(e){var o="object"==typeof e&&e&&e.Object===Object&&e;t.a=o}).call(this,o(10))},function(e,t,o){"use strict";(function(e){var n=o(3),i="object"==typeof exports&&exports&&!exports.nodeType&&exports,r=i&&"object"==typeof e&&e&&!e.nodeType&&e,s=r&&r.exports===i?n.a.Buffer:void 0,a=s?s.allocUnsafe:void 0;t.a=function(e,t){if(t)return e.slice();var o=e.length,n=a?a(o):new e.constructor(o);return e.copy(n),n}}).call(this,o(9)(e))},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(e,t){var o;o=function(){return this}();try{o=o||new Function("return this")()}catch(e){"object"==typeof window&&(o=window)}e.exports=o},function(e,t,o){var n=o(1),i=o(46);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t,o){var n=o(1),i=o(49);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t,o){var n=o(1),i=o(108);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t,o){var n=o(1),i=o(109);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t,o){"use strict";t.a=function(){return!1}},function(e,t,o){var n=o(1),i=o(17);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck-hidden{display:none!important}.ck.ck-reset,.ck.ck-reset_all,.ck.ck-reset_all *{box-sizing:border-box;width:auto;height:auto;position:static}:root{--ck-z-default:1;--ck-z-modal:calc(var(--ck-z-default) + 999);--ck-color-base-foreground:#fafafa;--ck-color-base-background:#fff;--ck-color-base-border:#c4c4c4;--ck-color-base-action:#61b045;--ck-color-base-focus:#6cb5f9;--ck-color-base-text:#333;--ck-color-base-active:#198cf0;--ck-color-base-active-focus:#0e7fe1;--ck-color-base-error:#db3700;--ck-color-focus-border-coordinates:208,79%,51%;--ck-color-focus-border:hsl(var(--ck-color-focus-border-coordinates));--ck-color-focus-outer-shadow:#bcdefb;--ck-color-focus-disabled-shadow:rgba(119,186,248,0.3);--ck-color-focus-error-shadow:rgba(255,64,31,0.3);--ck-color-text:var(--ck-color-base-text);--ck-color-shadow-drop:rgba(0,0,0,0.15);--ck-color-shadow-drop-active:rgba(0,0,0,0.2);--ck-color-shadow-inner:rgba(0,0,0,0.1);--ck-color-button-default-background:transparent;--ck-color-button-default-hover-background:#e6e6e6;--ck-color-button-default-active-background:#d9d9d9;--ck-color-button-default-active-shadow:#bfbfbf;--ck-color-button-default-disabled-background:transparent;--ck-color-button-on-background:#dedede;--ck-color-button-on-hover-background:#c4c4c4;--ck-color-button-on-active-background:#bababa;--ck-color-button-on-active-shadow:#a1a1a1;--ck-color-button-on-disabled-background:#dedede;--ck-color-button-action-background:var(--ck-color-base-action);--ck-color-button-action-hover-background:#579e3d;--ck-color-button-action-active-background:#53973b;--ck-color-button-action-active-shadow:#498433;--ck-color-button-action-disabled-background:#7ec365;--ck-color-button-action-text:var(--ck-color-base-background);--ck-color-button-save:#008a00;--ck-color-button-cancel:#db3700;--ck-color-switch-button-off-background:#b0b0b0;--ck-color-switch-button-off-hover-background:#a3a3a3;--ck-color-switch-button-on-background:var(--ck-color-button-action-background);--ck-color-switch-button-on-hover-background:#579e3d;--ck-color-switch-button-inner-background:var(--ck-color-base-background);--ck-color-switch-button-inner-shadow:rgba(0,0,0,0.1);--ck-color-dropdown-panel-background:var(--ck-color-base-background);--ck-color-dropdown-panel-border:var(--ck-color-base-border);--ck-color-input-background:var(--ck-color-base-background);--ck-color-input-border:#c7c7c7;--ck-color-input-error-border:var(--ck-color-base-error);--ck-color-input-text:var(--ck-color-base-text);--ck-color-input-disabled-background:#f2f2f2;--ck-color-input-disabled-border:#c7c7c7;--ck-color-input-disabled-text:#5c5c5c;--ck-color-list-background:var(--ck-color-base-background);--ck-color-list-button-hover-background:var(--ck-color-button-default-hover-background);--ck-color-list-button-on-background:var(--ck-color-base-active);--ck-color-list-button-on-background-focus:var(--ck-color-base-active-focus);--ck-color-list-button-on-text:var(--ck-color-base-background);--ck-color-panel-background:var(--ck-color-base-background);--ck-color-panel-border:var(--ck-color-base-border);--ck-color-toolbar-background:var(--ck-color-base-foreground);--ck-color-toolbar-border:var(--ck-color-base-border);--ck-color-tooltip-background:var(--ck-color-base-text);--ck-color-tooltip-text:var(--ck-color-base-background);--ck-color-engine-placeholder-text:#707070;--ck-color-upload-bar-background:#6cb5f9;--ck-color-link-default:#0000f0;--ck-color-link-selected-background:rgba(31,177,255,0.1);--ck-color-link-fake-selection:rgba(31,177,255,0.3);--ck-disabled-opacity:.5;--ck-focus-outer-shadow-geometry:0 0 0 3px;--ck-focus-outer-shadow:var(--ck-focus-outer-shadow-geometry) var(--ck-color-focus-outer-shadow);--ck-focus-disabled-outer-shadow:var(--ck-focus-outer-shadow-geometry) var(--ck-color-focus-disabled-shadow);--ck-focus-error-outer-shadow:var(--ck-focus-outer-shadow-geometry) var(--ck-color-focus-error-shadow);--ck-focus-ring:1px solid var(--ck-color-focus-border);--ck-font-size-base:13px;--ck-line-height-base:1.84615;--ck-font-face:Helvetica,Arial,Tahoma,Verdana,Sans-Serif;--ck-font-size-tiny:0.7em;--ck-font-size-small:0.75em;--ck-font-size-normal:1em;--ck-font-size-big:1.4em;--ck-font-size-large:1.8em;--ck-ui-component-min-height:2.3em}.ck.ck-reset,.ck.ck-reset_all,.ck.ck-reset_all *{margin:0;padding:0;border:0;background:transparent;text-decoration:none;vertical-align:middle;transition:none;word-wrap:break-word}.ck.ck-reset_all,.ck.ck-reset_all *{border-collapse:collapse;font:normal normal normal var(--ck-font-size-base)/var(--ck-line-height-base) var(--ck-font-face);color:var(--ck-color-text);text-align:left;white-space:nowrap;cursor:auto;float:none}.ck.ck-reset_all .ck-rtl *{text-align:right}.ck.ck-reset_all iframe{vertical-align:inherit}.ck.ck-reset_all textarea{white-space:pre-wrap}.ck.ck-reset_all input[type=password],.ck.ck-reset_all input[type=text],.ck.ck-reset_all textarea{cursor:text}.ck.ck-reset_all input[type=password][disabled],.ck.ck-reset_all input[type=text][disabled],.ck.ck-reset_all textarea[disabled]{cursor:default}.ck.ck-reset_all fieldset{padding:10px;border:2px groove #dfdee3}.ck.ck-reset_all button::-moz-focus-inner{padding:0;border:0}.ck[dir=rtl],.ck[dir=rtl] .ck{text-align:right}:root{--ck-border-radius:2px;--ck-inner-shadow:2px 2px 3px var(--ck-color-shadow-inner) inset;--ck-drop-shadow:0 1px 2px 1px var(--ck-color-shadow-drop);--ck-drop-shadow-active:0 3px 6px 1px var(--ck-color-shadow-drop-active);--ck-spacing-unit:0.6em;--ck-spacing-large:calc(var(--ck-spacing-unit)*1.5);--ck-spacing-standard:var(--ck-spacing-unit);--ck-spacing-medium:calc(var(--ck-spacing-unit)*0.8);--ck-spacing-small:calc(var(--ck-spacing-unit)*0.5);--ck-spacing-tiny:calc(var(--ck-spacing-unit)*0.3);--ck-spacing-extra-tiny:calc(var(--ck-spacing-unit)*0.16)}"},function(e,t,o){var n=o(1),i=o(19);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=':root{--ck-balloon-panel-arrow-z-index:calc(var(--ck-z-default) - 3)}.ck.ck-balloon-panel{display:none;position:absolute;z-index:var(--ck-z-modal)}.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:after,.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:before{content:"";position:absolute}.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:before{z-index:var(--ck-balloon-panel-arrow-z-index)}.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:after{z-index:calc(var(--ck-balloon-panel-arrow-z-index) + 1)}.ck.ck-balloon-panel[class*=arrow_n]:before{z-index:var(--ck-balloon-panel-arrow-z-index)}.ck.ck-balloon-panel[class*=arrow_n]:after{z-index:calc(var(--ck-balloon-panel-arrow-z-index) + 1)}.ck.ck-balloon-panel[class*=arrow_s]:before{z-index:var(--ck-balloon-panel-arrow-z-index)}.ck.ck-balloon-panel[class*=arrow_s]:after{z-index:calc(var(--ck-balloon-panel-arrow-z-index) + 1)}.ck.ck-balloon-panel.ck-balloon-panel_visible{display:block}:root{--ck-balloon-arrow-offset:2px;--ck-balloon-arrow-height:10px;--ck-balloon-arrow-half-width:8px}.ck.ck-balloon-panel{border-radius:0}.ck-rounded-corners .ck.ck-balloon-panel,.ck.ck-balloon-panel.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-balloon-panel{box-shadow:var(--ck-drop-shadow),0 0;min-height:15px;background:var(--ck-color-panel-background);border:1px solid var(--ck-color-panel-border)}.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:after,.ck.ck-balloon-panel.ck-balloon-panel_with-arrow:before{width:0;height:0;border-style:solid}.ck.ck-balloon-panel[class*=arrow_n]:after,.ck.ck-balloon-panel[class*=arrow_n]:before{border-left-width:var(--ck-balloon-arrow-half-width);border-bottom-width:var(--ck-balloon-arrow-height);border-right-width:var(--ck-balloon-arrow-half-width);border-top-width:0}.ck.ck-balloon-panel[class*=arrow_n]:before{border-bottom-color:var(--ck-color-panel-border)}.ck.ck-balloon-panel[class*=arrow_n]:after,.ck.ck-balloon-panel[class*=arrow_n]:before{border-left-color:transparent;border-right-color:transparent;border-top-color:transparent}.ck.ck-balloon-panel[class*=arrow_n]:after{border-bottom-color:var(--ck-color-panel-background);margin-top:var(--ck-balloon-arrow-offset)}.ck.ck-balloon-panel[class*=arrow_s]:after,.ck.ck-balloon-panel[class*=arrow_s]:before{border-left-width:var(--ck-balloon-arrow-half-width);border-bottom-width:0;border-right-width:var(--ck-balloon-arrow-half-width);border-top-width:var(--ck-balloon-arrow-height)}.ck.ck-balloon-panel[class*=arrow_s]:before{border-top-color:var(--ck-color-panel-border)}.ck.ck-balloon-panel[class*=arrow_s]:after,.ck.ck-balloon-panel[class*=arrow_s]:before{border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent}.ck.ck-balloon-panel[class*=arrow_s]:after{border-top-color:var(--ck-color-panel-background);margin-bottom:var(--ck-balloon-arrow-offset)}.ck.ck-balloon-panel.ck-balloon-panel_arrow_n:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_n:before{left:50%;margin-left:calc(-1*var(--ck-balloon-arrow-half-width));top:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_nw:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_nw:before{left:calc(2*var(--ck-balloon-arrow-half-width));top:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_ne:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_ne:before{right:calc(2*var(--ck-balloon-arrow-half-width));top:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_s:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_s:before{left:50%;margin-left:calc(-1*var(--ck-balloon-arrow-half-width));bottom:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_sw:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_sw:before{left:calc(2*var(--ck-balloon-arrow-half-width));bottom:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_se:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_se:before{right:calc(2*var(--ck-balloon-arrow-half-width));bottom:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_sme:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_sme:before{right:25%;margin-right:calc(2*var(--ck-balloon-arrow-half-width));bottom:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_smw:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_smw:before{left:25%;margin-left:calc(2*var(--ck-balloon-arrow-half-width));bottom:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_nme:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_nme:before{right:25%;margin-right:calc(2*var(--ck-balloon-arrow-half-width));top:calc(-1*var(--ck-balloon-arrow-height))}.ck.ck-balloon-panel.ck-balloon-panel_arrow_nmw:after,.ck.ck-balloon-panel.ck-balloon-panel_arrow_nmw:before{left:25%;margin-left:calc(2*var(--ck-balloon-arrow-half-width));top:calc(-1*var(--ck-balloon-arrow-height))}'},function(e,t,o){var n=o(1),i=o(21);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-icon{vertical-align:middle}:root{--ck-icon-size:calc(var(--ck-line-height-base)*var(--ck-font-size-normal))}.ck.ck-icon{width:var(--ck-icon-size);height:var(--ck-icon-size);font-size:.8333350694em;will-change:transform}.ck.ck-icon,.ck.ck-icon *{color:inherit;cursor:inherit}.ck.ck-icon :not([fill]){fill:currentColor}"},function(e,t,o){var n=o(1),i=o(23);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports='.ck.ck-tooltip,.ck.ck-tooltip .ck-tooltip__text:after{position:absolute;pointer-events:none;-webkit-backface-visibility:hidden}.ck.ck-tooltip{visibility:hidden;opacity:0;display:none;z-index:var(--ck-z-modal)}.ck.ck-tooltip .ck-tooltip__text{display:inline-block}.ck.ck-tooltip .ck-tooltip__text:after{content:"";width:0;height:0}:root{--ck-tooltip-arrow-size:5px}.ck.ck-tooltip{left:50%;top:0;transition:opacity .2s ease-in-out .2s}.ck.ck-tooltip .ck-tooltip__text{border-radius:0}.ck-rounded-corners .ck.ck-tooltip .ck-tooltip__text,.ck.ck-tooltip .ck-tooltip__text.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-tooltip .ck-tooltip__text{font-size:.9em;line-height:1.5;color:var(--ck-color-tooltip-text);padding:var(--ck-spacing-small) var(--ck-spacing-medium);background:var(--ck-color-tooltip-background);position:relative;left:-50%}.ck.ck-tooltip .ck-tooltip__text:after{transition:opacity .2s ease-in-out .2s;border-style:solid;left:50%}.ck.ck-tooltip.ck-tooltip_s{bottom:calc(-1*var(--ck-tooltip-arrow-size));transform:translateY(100%)}.ck.ck-tooltip.ck-tooltip_s .ck-tooltip__text:after{top:calc(-1*var(--ck-tooltip-arrow-size));transform:translateX(-50%);border-left-color:transparent;border-bottom-color:var(--ck-color-tooltip-background);border-right-color:transparent;border-top-color:transparent;border-left-width:var(--ck-tooltip-arrow-size);border-bottom-width:var(--ck-tooltip-arrow-size);border-right-width:var(--ck-tooltip-arrow-size);border-top-width:0}.ck.ck-tooltip.ck-tooltip_n{top:calc(-1*var(--ck-tooltip-arrow-size));transform:translateY(-100%)}.ck.ck-tooltip.ck-tooltip_n .ck-tooltip__text:after{bottom:calc(-1*var(--ck-tooltip-arrow-size));transform:translateX(-50%);border-left-color:transparent;border-bottom-color:transparent;border-right-color:transparent;border-top-color:var(--ck-color-tooltip-background);border-left-width:var(--ck-tooltip-arrow-size);border-bottom-width:0;border-right-width:var(--ck-tooltip-arrow-size);border-top-width:var(--ck-tooltip-arrow-size)}'},function(e,t,o){var n=o(1),i=o(25);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-button,a.ck.ck-button{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.ck.ck-button .ck-tooltip,a.ck.ck-button .ck-tooltip{display:block}@media (hover:none){.ck.ck-button .ck-tooltip,a.ck.ck-button .ck-tooltip{display:none}}.ck.ck-button,a.ck.ck-button{position:relative;display:inline-flex;align-items:center;justify-content:left}.ck.ck-button .ck-button__label,a.ck.ck-button .ck-button__label{display:none}.ck.ck-button.ck-button_with-text .ck-button__label,a.ck.ck-button.ck-button_with-text .ck-button__label{display:inline-block}.ck.ck-button:not(.ck-button_with-text),a.ck.ck-button:not(.ck-button_with-text){justify-content:center}.ck.ck-button:hover .ck-tooltip,a.ck.ck-button:hover .ck-tooltip{visibility:visible;opacity:1}.ck.ck-button:focus:not(:hover) .ck-tooltip,a.ck.ck-button:focus:not(:hover) .ck-tooltip{display:none}.ck.ck-button,a.ck.ck-button{background:var(--ck-color-button-default-background)}.ck.ck-button:not(.ck-disabled):hover,a.ck.ck-button:not(.ck-disabled):hover{background:var(--ck-color-button-default-hover-background)}.ck.ck-button:not(.ck-disabled):active,a.ck.ck-button:not(.ck-disabled):active{background:var(--ck-color-button-default-active-background);box-shadow:inset 0 2px 2px var(--ck-color-button-default-active-shadow)}.ck.ck-button.ck-disabled,a.ck.ck-button.ck-disabled{background:var(--ck-color-button-default-disabled-background)}.ck.ck-button,a.ck.ck-button{border-radius:0}.ck-rounded-corners .ck.ck-button,.ck-rounded-corners a.ck.ck-button,.ck.ck-button.ck-rounded-corners,a.ck.ck-button.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-button,a.ck.ck-button{white-space:nowrap;cursor:default;vertical-align:middle;padding:var(--ck-spacing-tiny);text-align:center;min-width:var(--ck-ui-component-min-height);min-height:var(--ck-ui-component-min-height);line-height:1;font-size:inherit;border:1px solid transparent;transition:box-shadow .2s ease-in-out,border .2s ease-in-out;-webkit-appearance:none}.ck.ck-button:active,.ck.ck-button:focus,a.ck.ck-button:active,a.ck.ck-button:focus{outline:none;border:var(--ck-focus-ring);box-shadow:var(--ck-focus-outer-shadow),0 0}.ck.ck-button .ck-button__icon use,.ck.ck-button .ck-button__icon use *,a.ck.ck-button .ck-button__icon use,a.ck.ck-button .ck-button__icon use *{color:inherit}.ck.ck-button .ck-button__label,a.ck.ck-button .ck-button__label{font-size:inherit;font-weight:inherit;color:inherit;cursor:inherit;vertical-align:middle}[dir=ltr] .ck.ck-button .ck-button__label,[dir=ltr] a.ck.ck-button .ck-button__label{text-align:left}[dir=rtl] .ck.ck-button .ck-button__label,[dir=rtl] a.ck.ck-button .ck-button__label{text-align:right}.ck.ck-button .ck-button__keystroke,a.ck.ck-button .ck-button__keystroke{color:inherit}[dir=ltr] .ck.ck-button .ck-button__keystroke,[dir=ltr] a.ck.ck-button .ck-button__keystroke{margin-left:var(--ck-spacing-large)}[dir=rtl] .ck.ck-button .ck-button__keystroke,[dir=rtl] a.ck.ck-button .ck-button__keystroke{margin-right:var(--ck-spacing-large)}.ck.ck-button .ck-button__keystroke,a.ck.ck-button .ck-button__keystroke{font-weight:700;opacity:.7}.ck.ck-button.ck-disabled:active,.ck.ck-button.ck-disabled:focus,a.ck.ck-button.ck-disabled:active,a.ck.ck-button.ck-disabled:focus{box-shadow:var(--ck-focus-disabled-outer-shadow),0 0}.ck.ck-button.ck-disabled .ck-button__icon,a.ck.ck-button.ck-disabled .ck-button__icon{opacity:var(--ck-disabled-opacity)}.ck.ck-button.ck-disabled .ck-button__label,a.ck.ck-button.ck-disabled .ck-button__label{opacity:var(--ck-disabled-opacity)}.ck.ck-button.ck-disabled .ck-button__keystroke,a.ck.ck-button.ck-disabled .ck-button__keystroke{opacity:.3}.ck.ck-button.ck-button_with-text,a.ck.ck-button.ck-button_with-text{padding:var(--ck-spacing-tiny) var(--ck-spacing-standard)}[dir=ltr] .ck.ck-button.ck-button_with-text .ck-button__icon,[dir=ltr] a.ck.ck-button.ck-button_with-text .ck-button__icon{margin-left:calc(-1*var(--ck-spacing-small));margin-right:var(--ck-spacing-small)}[dir=rtl] .ck.ck-button.ck-button_with-text .ck-button__icon,[dir=rtl] a.ck.ck-button.ck-button_with-text .ck-button__icon{margin-right:calc(-1*var(--ck-spacing-small));margin-left:var(--ck-spacing-small)}.ck.ck-button.ck-button_with-keystroke .ck-button__label,a.ck.ck-button.ck-button_with-keystroke .ck-button__label{flex-grow:1}.ck.ck-button.ck-on,a.ck.ck-button.ck-on{background:var(--ck-color-button-on-background)}.ck.ck-button.ck-on:not(.ck-disabled):hover,a.ck.ck-button.ck-on:not(.ck-disabled):hover{background:var(--ck-color-button-on-hover-background)}.ck.ck-button.ck-on:not(.ck-disabled):active,a.ck.ck-button.ck-on:not(.ck-disabled):active{background:var(--ck-color-button-on-active-background);box-shadow:inset 0 2px 2px var(--ck-color-button-on-active-shadow)}.ck.ck-button.ck-on.ck-disabled,a.ck.ck-button.ck-on.ck-disabled{background:var(--ck-color-button-on-disabled-background)}.ck.ck-button.ck-button-save,a.ck.ck-button.ck-button-save{color:var(--ck-color-button-save)}.ck.ck-button.ck-button-cancel,a.ck.ck-button.ck-button-cancel{color:var(--ck-color-button-cancel)}.ck.ck-button-action,a.ck.ck-button-action{background:var(--ck-color-button-action-background)}.ck.ck-button-action:not(.ck-disabled):hover,a.ck.ck-button-action:not(.ck-disabled):hover{background:var(--ck-color-button-action-hover-background)}.ck.ck-button-action:not(.ck-disabled):active,a.ck.ck-button-action:not(.ck-disabled):active{background:var(--ck-color-button-action-active-background);box-shadow:inset 0 2px 2px var(--ck-color-button-action-active-shadow)}.ck.ck-button-action.ck-disabled,a.ck.ck-button-action.ck-disabled{background:var(--ck-color-button-action-disabled-background)}.ck.ck-button-action,a.ck.ck-button-action{color:var(--ck-color-button-action-text)}.ck.ck-button-bold,a.ck.ck-button-bold{font-weight:700}"},function(e,t,o){var n=o(1),i=o(27);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck .ck-balloon-rotator__navigation{display:flex;align-items:center;justify-content:center}.ck .ck-balloon-rotator__content .ck-toolbar{justify-content:center}.ck .ck-balloon-rotator__navigation{background:var(--ck-color-toolbar-background);border-bottom:1px solid var(--ck-color-toolbar-border);padding:0 var(--ck-spacing-small)}.ck .ck-balloon-rotator__navigation>*{margin-right:var(--ck-spacing-small);margin-top:var(--ck-spacing-small);margin-bottom:var(--ck-spacing-small)}.ck .ck-balloon-rotator__navigation .ck-balloon-rotator__counter{margin-right:var(--ck-spacing-standard);margin-left:var(--ck-spacing-small)}.ck .ck-balloon-rotator__content .ck.ck-annotation-wrapper{box-shadow:none}"},function(e,t,o){var n=o(1),i=o(29);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck .ck-fake-panel{position:absolute;z-index:calc(var(--ck-z-modal) - 1)}.ck .ck-fake-panel div{position:absolute}.ck .ck-fake-panel div:first-child{z-index:2}.ck .ck-fake-panel div:nth-child(2){z-index:1}:root{--ck-balloon-fake-panel-offset-horizontal:6px;--ck-balloon-fake-panel-offset-vertical:6px}.ck .ck-fake-panel div{box-shadow:var(--ck-drop-shadow),0 0;min-height:15px;background:var(--ck-color-panel-background);border:1px solid var(--ck-color-panel-border);border-radius:var(--ck-border-radius);width:100%;height:100%}.ck .ck-fake-panel div:first-child{margin-left:var(--ck-balloon-fake-panel-offset-horizontal);margin-top:var(--ck-balloon-fake-panel-offset-vertical)}.ck .ck-fake-panel div:nth-child(2){margin-left:calc(var(--ck-balloon-fake-panel-offset-horizontal)*2);margin-top:calc(var(--ck-balloon-fake-panel-offset-vertical)*2)}.ck .ck-fake-panel div:nth-child(3){margin-left:calc(var(--ck-balloon-fake-panel-offset-horizontal)*3);margin-top:calc(var(--ck-balloon-fake-panel-offset-vertical)*3)}.ck .ck-balloon-panel_arrow_s+.ck-fake-panel,.ck .ck-balloon-panel_arrow_se+.ck-fake-panel,.ck .ck-balloon-panel_arrow_sw+.ck-fake-panel{--ck-balloon-fake-panel-offset-vertical:-6px}"},function(e,t,o){var n=o(1),i=o(31);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-dropdown{display:inline-block;position:relative}.ck.ck-dropdown .ck-dropdown__arrow{pointer-events:none;z-index:var(--ck-z-default)}.ck.ck-dropdown .ck-button.ck-dropdown__button{width:100%}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-on .ck-tooltip{display:none}.ck.ck-dropdown .ck-dropdown__panel{-webkit-backface-visibility:hidden;display:none;z-index:var(--ck-z-modal);position:absolute}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel-visible{display:inline-block}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_ne,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nw{bottom:100%}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_se,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sw{top:100%;bottom:auto}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_ne,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_se{left:0}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nw,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sw{right:0}.ck.ck-toolbar .ck-dropdown__panel{z-index:calc(var(--ck-z-modal) + 1)}:root{--ck-dropdown-arrow-size:calc(0.5*var(--ck-icon-size))}.ck.ck-dropdown{font-size:inherit}.ck.ck-dropdown .ck-dropdown__arrow{width:var(--ck-dropdown-arrow-size)}[dir=ltr] .ck.ck-dropdown .ck-dropdown__arrow{right:var(--ck-spacing-standard);margin-left:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-dropdown .ck-dropdown__arrow{left:var(--ck-spacing-standard);margin-right:var(--ck-spacing-small)}.ck.ck-dropdown.ck-disabled .ck-dropdown__arrow{opacity:var(--ck-disabled-opacity)}[dir=ltr] .ck.ck-dropdown .ck-button.ck-dropdown__button:not(.ck-button_with-text){padding-left:var(--ck-spacing-small)}[dir=rtl] .ck.ck-dropdown .ck-button.ck-dropdown__button:not(.ck-button_with-text){padding-right:var(--ck-spacing-small)}.ck.ck-dropdown .ck-button.ck-dropdown__button .ck-button__label{width:7em;overflow:hidden;text-overflow:ellipsis}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-disabled .ck-button__label{opacity:var(--ck-disabled-opacity)}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-on{border-bottom-left-radius:0;border-bottom-right-radius:0}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-dropdown__button_label-width_auto .ck-button__label{width:auto}.ck.ck-dropdown__panel{border-radius:0}.ck-rounded-corners .ck.ck-dropdown__panel,.ck.ck-dropdown__panel.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-dropdown__panel{box-shadow:var(--ck-drop-shadow),0 0;background:var(--ck-color-dropdown-panel-background);border:1px solid var(--ck-color-dropdown-panel-border);bottom:0;min-width:100%}.ck.ck-dropdown__panel.ck-dropdown__panel_se{border-top-left-radius:0}.ck.ck-dropdown__panel.ck-dropdown__panel_sw{border-top-right-radius:0}.ck.ck-dropdown__panel.ck-dropdown__panel_ne{border-bottom-left-radius:0}.ck.ck-dropdown__panel.ck-dropdown__panel_nw{border-bottom-right-radius:0}"},function(e,t,o){var n=o(1),i=o(33);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-list{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-direction:column}.ck.ck-list .ck-list__item,.ck.ck-list .ck-list__separator{display:block}.ck.ck-list .ck-list__item>:focus{position:relative;z-index:var(--ck-z-default)}.ck.ck-list{border-radius:0}.ck-rounded-corners .ck.ck-list,.ck.ck-list.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-list{list-style-type:none;background:var(--ck-color-list-background)}.ck.ck-list__item{cursor:default;min-width:12em}.ck.ck-list__item .ck-button{min-height:unset;width:100%;text-align:left;border-radius:0;padding:calc(0.2*var(--ck-line-height-base)*var(--ck-font-size-base)) calc(0.4*var(--ck-line-height-base)*var(--ck-font-size-base))}.ck.ck-list__item .ck-button .ck-button__label{line-height:calc(1.2*var(--ck-line-height-base)*var(--ck-font-size-base))}.ck.ck-list__item .ck-button:active{box-shadow:none}.ck.ck-list__item .ck-button.ck-on{background:var(--ck-color-list-button-on-background);color:var(--ck-color-list-button-on-text)}.ck.ck-list__item .ck-button.ck-on:active{box-shadow:none}.ck.ck-list__item .ck-button.ck-on:hover:not(.ck-disabled){background:var(--ck-color-list-button-on-background-focus)}.ck.ck-list__item .ck-button.ck-on:focus:not(.ck-disabled){border-color:var(--ck-color-base-background)}.ck.ck-list__item .ck-button:hover:not(.ck-disabled){background:var(--ck-color-list-button-hover-background)}.ck.ck-list__item .ck-switchbutton.ck-on{background:var(--ck-color-list-background);color:inherit}.ck.ck-list__item .ck-switchbutton.ck-on:hover:not(.ck-disabled){background:var(--ck-color-list-button-hover-background);color:inherit}.ck.ck-list__separator{height:1px;width:100%;background:var(--ck-color-base-border)}"},function(e,t,o){var n=o(1),i=o(35);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-button.ck-switchbutton .ck-button__toggle,.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner{display:block}:root{--ck-switch-button-toggle-width:2.6153846154em;--ck-switch-button-toggle-inner-size:1.0769230769em;--ck-switch-button-toggle-spacing:1px;--ck-switch-button-translation:calc(var(--ck-switch-button-toggle-width) - var(--ck-switch-button-toggle-inner-size) - 2*var(--ck-switch-button-toggle-spacing))}[dir=ltr] .ck.ck-button.ck-switchbutton .ck-button__label{margin-right:calc(2*var(--ck-spacing-large))}[dir=rtl] .ck.ck-button.ck-switchbutton .ck-button__label{margin-left:calc(2*var(--ck-spacing-large))}.ck.ck-button.ck-switchbutton .ck-button__toggle{border-radius:0}.ck-rounded-corners .ck.ck-button.ck-switchbutton .ck-button__toggle,.ck.ck-button.ck-switchbutton .ck-button__toggle.ck-rounded-corners{border-radius:var(--ck-border-radius)}[dir=ltr] .ck.ck-button.ck-switchbutton .ck-button__toggle{margin-left:auto}[dir=rtl] .ck.ck-button.ck-switchbutton .ck-button__toggle{margin-right:auto}.ck.ck-button.ck-switchbutton .ck-button__toggle{transition:background .4s ease;width:var(--ck-switch-button-toggle-width);background:var(--ck-color-switch-button-off-background)}.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner{border-radius:0}.ck-rounded-corners .ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner,.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner.ck-rounded-corners{border-radius:var(--ck-border-radius);border-radius:calc(0.5*var(--ck-border-radius))}.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner{margin:var(--ck-switch-button-toggle-spacing);width:var(--ck-switch-button-toggle-inner-size);height:var(--ck-switch-button-toggle-inner-size);background:var(--ck-color-switch-button-inner-background);transition:all .3s ease}.ck.ck-button.ck-switchbutton .ck-button__toggle:hover{background:var(--ck-color-switch-button-off-hover-background)}.ck.ck-button.ck-switchbutton .ck-button__toggle:hover .ck-button__toggle__inner{box-shadow:0 0 0 5px var(--ck-color-switch-button-inner-shadow)}.ck.ck-button.ck-switchbutton.ck-disabled .ck-button__toggle{opacity:var(--ck-disabled-opacity)}.ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle{background:var(--ck-color-switch-button-on-background)}.ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle:hover{background:var(--ck-color-switch-button-on-hover-background)}[dir=ltr] .ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle .ck-button__toggle__inner{transform:translateX(var(--ck-switch-button-translation))}[dir=rtl] .ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle .ck-button__toggle__inner{transform:translateX(calc(-1*var(--ck-switch-button-translation)))}"},function(e,t,o){var n=o(1),i=o(37);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-toolbar-dropdown .ck.ck-toolbar .ck.ck-toolbar__items{flex-wrap:nowrap}.ck.ck-toolbar-dropdown .ck-dropdown__panel .ck-button:focus{z-index:calc(var(--ck-z-default) + 1)}.ck.ck-toolbar-dropdown .ck-toolbar{border:0}"},function(e,t,o){var n=o(1),i=o(39);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-dropdown .ck-dropdown__panel .ck-list{border-radius:0}.ck-rounded-corners .ck.ck-dropdown .ck-dropdown__panel .ck-list,.ck.ck-dropdown .ck-dropdown__panel .ck-list.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0}.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:first-child .ck-button{border-radius:0}.ck-rounded-corners .ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:first-child .ck-button,.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:first-child .ck-button.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0;border-bottom-left-radius:0;border-bottom-right-radius:0}.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:last-child .ck-button{border-radius:0}.ck-rounded-corners .ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:last-child .ck-button,.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:last-child .ck-button.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0;border-top-right-radius:0}"},function(e,t,o){var n=o(1),i=o(41);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-toolbar{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-flow:row nowrap;align-items:center}.ck.ck-toolbar>.ck-toolbar__items{display:flex;flex-flow:row wrap;align-items:center;flex-grow:1}.ck.ck-toolbar .ck.ck-toolbar__separator{display:inline-block}.ck.ck-toolbar .ck.ck-toolbar__separator:first-child,.ck.ck-toolbar .ck.ck-toolbar__separator:last-child{display:none}.ck.ck-toolbar.ck-toolbar_grouping>.ck-toolbar__items{flex-wrap:nowrap}.ck.ck-toolbar.ck-toolbar_vertical>.ck-toolbar__items{flex-direction:column}.ck.ck-toolbar.ck-toolbar_floating>.ck-toolbar__items{flex-wrap:nowrap}.ck.ck-toolbar>.ck.ck-toolbar__grouped-dropdown>.ck-dropdown__button .ck-dropdown__arrow{display:none}.ck.ck-toolbar{border-radius:0}.ck-rounded-corners .ck.ck-toolbar,.ck.ck-toolbar.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-toolbar{background:var(--ck-color-toolbar-background);padding:0 var(--ck-spacing-small);border:1px solid var(--ck-color-toolbar-border)}.ck.ck-toolbar .ck.ck-toolbar__separator{align-self:stretch;width:1px;min-width:1px;background:var(--ck-color-toolbar-border);margin-top:var(--ck-spacing-small);margin-bottom:var(--ck-spacing-small)}.ck.ck-toolbar>.ck-toolbar__items>*{margin-top:var(--ck-spacing-small);margin-bottom:var(--ck-spacing-small);margin-right:var(--ck-spacing-small)}.ck.ck-toolbar>.ck-toolbar__items:empty+.ck.ck-toolbar__separator{display:none}.ck.ck-toolbar>.ck-toolbar__items>*,.ck.ck-toolbar>.ck.ck-toolbar__grouped-dropdown{margin-top:var(--ck-spacing-small);margin-bottom:var(--ck-spacing-small)}.ck.ck-toolbar.ck-toolbar_vertical{padding:0}.ck.ck-toolbar.ck-toolbar_vertical>.ck-toolbar__items>.ck{width:100%;margin:0;border-radius:0;border:0}.ck.ck-toolbar.ck-toolbar_compact{padding:0}.ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>*{margin:0}.ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>:not(:first-child):not(:last-child){border-radius:0}.ck.ck-toolbar>.ck.ck-toolbar__grouped-dropdown>.ck.ck-button.ck-dropdown__button{padding-left:var(--ck-spacing-tiny)}.ck-toolbar-container .ck.ck-toolbar{border:0}.ck.ck-toolbar[dir=rtl]>.ck-toolbar__items>.ck,[dir=rtl] .ck.ck-toolbar>.ck-toolbar__items>.ck{margin-right:0}.ck.ck-toolbar[dir=rtl]:not(.ck-toolbar_compact)>.ck-toolbar__items>.ck,[dir=rtl] .ck.ck-toolbar:not(.ck-toolbar_compact)>.ck-toolbar__items>.ck{margin-left:var(--ck-spacing-small)}.ck.ck-toolbar[dir=rtl]>.ck-toolbar__items>.ck:last-child,[dir=rtl] .ck.ck-toolbar>.ck-toolbar__items>.ck:last-child{margin-left:0}.ck.ck-toolbar[dir=rtl].ck-toolbar_compact>.ck-toolbar__items>.ck:first-child,[dir=rtl] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.ck.ck-toolbar[dir=rtl].ck-toolbar_compact>.ck-toolbar__items>.ck:last-child,[dir=rtl] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:last-child{border-top-right-radius:0;border-bottom-right-radius:0}.ck.ck-toolbar[dir=rtl]>.ck.ck-toolbar__separator,[dir=rtl] .ck.ck-toolbar>.ck.ck-toolbar__separator{margin-left:var(--ck-spacing-small)}.ck.ck-toolbar[dir=rtl].ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child),[dir=rtl] .ck.ck-toolbar.ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child){margin-left:var(--ck-spacing-small)}.ck.ck-toolbar[dir=ltr]>.ck-toolbar__items>.ck:last-child,[dir=ltr] .ck.ck-toolbar>.ck-toolbar__items>.ck:last-child{margin-right:0}.ck.ck-toolbar[dir=ltr].ck-toolbar_compact>.ck-toolbar__items>.ck:first-child,[dir=ltr] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:first-child{border-top-right-radius:0;border-bottom-right-radius:0}.ck.ck-toolbar[dir=ltr].ck-toolbar_compact>.ck-toolbar__items>.ck:last-child,[dir=ltr] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:last-child{border-top-left-radius:0;border-bottom-left-radius:0}.ck.ck-toolbar[dir=ltr]>.ck.ck-toolbar__separator,[dir=ltr] .ck.ck-toolbar>.ck.ck-toolbar__separator{margin-right:var(--ck-spacing-small)}.ck.ck-toolbar[dir=ltr].ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child),[dir=ltr] .ck.ck-toolbar.ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child){margin-right:var(--ck-spacing-small)}"},function(e,t,o){var n=o(1),i=o(43);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-placeholder:before,.ck .ck-placeholder:before{content:attr(data-placeholder);pointer-events:none}.ck.ck-read-only .ck-placeholder:before{display:none}.ck.ck-placeholder:before,.ck .ck-placeholder:before{cursor:text;color:var(--ck-color-engine-placeholder-text)}"},function(e,t,o){var n=o(1),i=o(45);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=":root{--ck-color-editable-blur-selection:#d9d9d9}.ck.ck-editor__editable:not(.ck-editor__nested-editable){border-radius:0}.ck-rounded-corners .ck.ck-editor__editable:not(.ck-editor__nested-editable),.ck.ck-editor__editable:not(.ck-editor__nested-editable).ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-editor__editable:not(.ck-editor__nested-editable).ck-focused{outline:none;border:var(--ck-focus-ring);box-shadow:var(--ck-inner-shadow),0 0}.ck.ck-editor__editable_inline{overflow:auto;padding:0 var(--ck-spacing-standard);border:1px solid transparent}.ck.ck-editor__editable_inline[dir=ltr]{text-align:left}.ck.ck-editor__editable_inline[dir=rtl]{text-align:right}.ck.ck-editor__editable_inline>:first-child{margin-top:var(--ck-spacing-large)}.ck.ck-editor__editable_inline>:last-child{margin-bottom:var(--ck-spacing-large)}.ck.ck-editor__editable_inline.ck-blurred ::selection{background:var(--ck-color-editable-blur-selection)}.ck.ck-balloon-panel.ck-toolbar-container[class*=arrow_n]:after{border-bottom-color:var(--ck-color-base-foreground)}.ck.ck-balloon-panel.ck-toolbar-container[class*=arrow_s]:after{border-top-color:var(--ck-color-base-foreground)}"},function(e,t){e.exports=".ck-content code{background-color:hsla(0,0%,78%,.3);padding:.15em;border-radius:2px}.ck.ck-editor__editable .ck-code_selected{background-color:hsla(0,0%,78%,.5)}"},function(e,t,o){var n=o(1),i=o(48);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck-content blockquote{overflow:hidden;padding-right:1.5em;padding-left:1.5em;margin-left:0;margin-right:0;font-style:italic;border-left:5px solid #ccc}.ck-content[dir=rtl] blockquote{border-left:0;border-right:5px solid #ccc}"},function(e,t){e.exports=".ck.ck-heading_heading1{font-size:20px}.ck.ck-heading_heading2{font-size:17px}.ck.ck-heading_heading3{font-size:14px}.ck[class*=ck-heading_heading]{font-weight:700}.ck.ck-dropdown.ck-heading-dropdown .ck-dropdown__button .ck-button__label{width:8em}.ck.ck-dropdown.ck-heading-dropdown .ck-dropdown__panel .ck-list__item{min-width:18em}"},function(e,t,o){var n=o(1),i=o(51);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports='.ck .ck-widget .ck-widget__type-around__button{display:block;position:absolute;overflow:hidden;z-index:var(--ck-z-default)}.ck .ck-widget .ck-widget__type-around__button svg{position:absolute;top:50%;left:50%;z-index:calc(var(--ck-z-default) + 2)}.ck .ck-widget .ck-widget__type-around__button.ck-widget__type-around__button_before{top:calc(-0.5*var(--ck-widget-outline-thickness));left:min(10%,30px);transform:translateY(-50%)}.ck .ck-widget .ck-widget__type-around__button.ck-widget__type-around__button_after{bottom:calc(-0.5*var(--ck-widget-outline-thickness));right:min(10%,30px);transform:translateY(50%)}.ck .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button:after,.ck .ck-widget>.ck-widget__type-around>.ck-widget__type-around__button:hover:after{content:"";display:block;position:absolute;top:1px;left:1px;z-index:calc(var(--ck-z-default) + 1)}.ck .ck-widget>.ck-widget__type-around>.ck-widget__type-around__fake-caret{display:none;position:absolute;left:0;right:0}.ck .ck-widget:hover>.ck-widget__type-around>.ck-widget__type-around__fake-caret{left:calc(-1*var(--ck-widget-outline-thickness));right:calc(-1*var(--ck-widget-outline-thickness))}.ck .ck-widget.ck-widget_type-around_show-fake-caret_before>.ck-widget__type-around>.ck-widget__type-around__fake-caret{top:calc(-1*var(--ck-widget-outline-thickness) - 1px);display:block}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after>.ck-widget__type-around>.ck-widget__type-around__fake-caret{bottom:calc(-1*var(--ck-widget-outline-thickness) - 1px);display:block}.ck.ck-editor__editable.ck-read-only .ck-widget__type-around,.ck.ck-editor__editable.ck-restricted-editing_mode_restricted .ck-widget__type-around,.ck.ck-editor__editable.ck-widget__type-around_disabled .ck-widget__type-around{display:none}:root{--ck-widget-type-around-button-size:20px;--ck-color-widget-type-around-button-active:var(--ck-color-focus-border);--ck-color-widget-type-around-button-hover:var(--ck-color-widget-hover-border);--ck-color-widget-type-around-button-blurred-editable:var(--ck-color-widget-blurred-border);--ck-color-widget-type-around-button-radar-start-alpha:0;--ck-color-widget-type-around-button-radar-end-alpha:.3;--ck-color-widget-type-around-button-icon:var(--ck-color-base-background)}.ck .ck-widget .ck-widget__type-around__button{width:var(--ck-widget-type-around-button-size);height:var(--ck-widget-type-around-button-size);background:var(--ck-color-widget-type-around-button);border-radius:100px;transition:opacity var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve),background var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve);opacity:0;pointer-events:none}.ck .ck-widget .ck-widget__type-around__button svg{width:10px;height:8px;transform:translate(-50%,-50%);transition:transform .5s ease;margin-top:1px}.ck .ck-widget .ck-widget__type-around__button svg *{stroke-dasharray:10;stroke-dashoffset:0;fill:none;stroke:var(--ck-color-widget-type-around-button-icon);stroke-width:1.5px;stroke-linecap:round;stroke-linejoin:round}.ck .ck-widget .ck-widget__type-around__button svg line{stroke-dasharray:7}.ck .ck-widget .ck-widget__type-around__button:hover{animation:ck-widget-type-around-button-sonar 1s ease infinite}.ck .ck-widget .ck-widget__type-around__button:hover svg polyline{animation:ck-widget-type-around-arrow-dash 2s linear}.ck .ck-widget .ck-widget__type-around__button:hover svg line{animation:ck-widget-type-around-arrow-tip-dash 2s linear}.ck .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button,.ck .ck-widget:hover>.ck-widget__type-around>.ck-widget__type-around__button{opacity:1;pointer-events:auto}.ck .ck-widget:not(.ck-widget_selected)>.ck-widget__type-around>.ck-widget__type-around__button{background:var(--ck-color-widget-type-around-button-hover)}.ck .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button,.ck .ck-widget>.ck-widget__type-around>.ck-widget__type-around__button:hover{background:var(--ck-color-widget-type-around-button-active)}.ck .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button:after,.ck .ck-widget>.ck-widget__type-around>.ck-widget__type-around__button:hover:after{width:calc(var(--ck-widget-type-around-button-size) - 2px);height:calc(var(--ck-widget-type-around-button-size) - 2px);border-radius:100px;background:linear-gradient(135deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.3))}.ck .ck-widget.ck-widget_with-selection-handle>.ck-widget__type-around>.ck-widget__type-around__button_before{margin-left:20px}.ck .ck-widget .ck-widget__type-around__fake-caret{pointer-events:none;height:1px;animation:ck-widget-type-around-fake-caret-pulse 1s linear infinite normal forwards;outline:1px solid hsla(0,0%,100%,.5);background:var(--ck-color-base-text)}.ck .ck-widget.ck-widget_selected.ck-widget_type-around_show-fake-caret_after,.ck .ck-widget.ck-widget_selected.ck-widget_type-around_show-fake-caret_before{outline-color:transparent}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after.ck-widget_selected:hover,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before.ck-widget_selected:hover{outline-color:var(--ck-color-widget-hover-border)}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after>.ck-widget__type-around>.ck-widget__type-around__button,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before>.ck-widget__type-around>.ck-widget__type-around__button{opacity:0;pointer-events:none}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after.ck-widget_with-selection-handle.ck-widget_selected:hover>.ck-widget__selection-handle,.ck .ck-widget.ck-widget_type-around_show-fake-caret_after.ck-widget_with-selection-handle.ck-widget_selected>.ck-widget__selection-handle,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before.ck-widget_with-selection-handle.ck-widget_selected:hover>.ck-widget__selection-handle,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before.ck-widget_with-selection-handle.ck-widget_selected>.ck-widget__selection-handle{opacity:0}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after.ck-widget_selected.ck-widget_with-resizer>.ck-widget__resizer,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before.ck-widget_selected.ck-widget_with-resizer>.ck-widget__resizer{opacity:0}.ck-editor__nested-editable.ck-editor__editable_selected .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button,.ck-editor__nested-editable.ck-editor__editable_selected .ck-widget:hover>.ck-widget__type-around>.ck-widget__type-around__button{opacity:0;pointer-events:none}.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button:not(:hover){background:var(--ck-color-widget-type-around-button-blurred-editable)}.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button:not(:hover) svg *{stroke:#999}@keyframes ck-widget-type-around-arrow-dash{0%{stroke-dashoffset:10}20%,to{stroke-dashoffset:0}}@keyframes ck-widget-type-around-arrow-tip-dash{0%,20%{stroke-dashoffset:7}40%,to{stroke-dashoffset:0}}@keyframes ck-widget-type-around-button-sonar{0%{box-shadow:0 0 0 0 hsla(var(--ck-color-focus-border-coordinates),var(--ck-color-widget-type-around-button-radar-start-alpha))}50%{box-shadow:0 0 0 5px hsla(var(--ck-color-focus-border-coordinates),var(--ck-color-widget-type-around-button-radar-end-alpha))}to{box-shadow:0 0 0 5px hsla(var(--ck-color-focus-border-coordinates),var(--ck-color-widget-type-around-button-radar-start-alpha))}}@keyframes ck-widget-type-around-fake-caret-pulse{0%{opacity:1}49%{opacity:1}50%{opacity:0}99%{opacity:0}to{opacity:1}}'},function(e,t,o){var n=o(1),i=o(53);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=":root{--ck-color-resizer:var(--ck-color-focus-border);--ck-resizer-size:10px;--ck-resizer-border-width:1px;--ck-resizer-border-radius:2px;--ck-resizer-offset:calc(var(--ck-resizer-size)/-2 - 2px);--ck-resizer-tooltip-offset:10px;--ck-color-resizer-tooltip-background:#262626;--ck-color-resizer-tooltip-text:#f2f2f2}.ck .ck-widget,.ck .ck-widget.ck-widget_with-selection-handle{position:relative}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle{position:absolute}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle .ck-icon{display:block}.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected .ck-widget__selection-handle,.ck .ck-widget.ck-widget_with-selection-handle:hover .ck-widget__selection-handle{visibility:visible}.ck .ck-size-view{background:var(--ck-color-resizer-tooltip-background);color:var(--ck-color-resizer-tooltip-text);border:1px solid var(--ck-color-resizer-tooltip-text);border-radius:var(--ck-resizer-border-radius);font-size:var(--ck-font-size-tiny);display:block;padding:var(--ck-spacing-small)}.ck .ck-size-view.ck-orientation-bottom-left,.ck .ck-size-view.ck-orientation-bottom-right,.ck .ck-size-view.ck-orientation-top-left,.ck .ck-size-view.ck-orientation-top-right{position:absolute}.ck .ck-size-view.ck-orientation-top-left{top:var(--ck-resizer-tooltip-offset);left:var(--ck-resizer-tooltip-offset)}.ck .ck-size-view.ck-orientation-top-right{top:var(--ck-resizer-tooltip-offset);right:var(--ck-resizer-tooltip-offset)}.ck .ck-size-view.ck-orientation-bottom-right{bottom:var(--ck-resizer-tooltip-offset);right:var(--ck-resizer-tooltip-offset)}.ck .ck-size-view.ck-orientation-bottom-left{bottom:var(--ck-resizer-tooltip-offset);left:var(--ck-resizer-tooltip-offset)}:root{--ck-widget-outline-thickness:3px;--ck-widget-handler-icon-size:16px;--ck-widget-handler-animation-duration:200ms;--ck-widget-handler-animation-curve:ease;--ck-color-widget-blurred-border:#dedede;--ck-color-widget-hover-border:#ffc83d;--ck-color-widget-editable-focus-background:var(--ck-color-base-background);--ck-color-widget-drag-handler-icon-color:var(--ck-color-base-background)}.ck .ck-widget{outline-width:var(--ck-widget-outline-thickness);outline-style:solid;outline-color:transparent;transition:outline-color var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve)}.ck .ck-widget.ck-widget_selected,.ck .ck-widget.ck-widget_selected:hover{outline:var(--ck-widget-outline-thickness) solid var(--ck-color-focus-border)}.ck .ck-widget:hover{outline-color:var(--ck-color-widget-hover-border)}.ck .ck-editor__nested-editable{border:1px solid transparent}.ck .ck-editor__nested-editable.ck-editor__nested-editable_focused,.ck .ck-editor__nested-editable:focus{outline:none;border:var(--ck-focus-ring);box-shadow:var(--ck-inner-shadow),0 0;background-color:var(--ck-color-widget-editable-focus-background)}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle{padding:4px;box-sizing:border-box;background-color:transparent;opacity:0;transition:background-color var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve),visibility var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve),opacity var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve);border-radius:var(--ck-border-radius) var(--ck-border-radius) 0 0;transform:translateY(-100%);left:calc(0px - var(--ck-widget-outline-thickness))}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle .ck-icon{width:var(--ck-widget-handler-icon-size);height:var(--ck-widget-handler-icon-size);color:var(--ck-color-widget-drag-handler-icon-color)}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle .ck-icon .ck-icon__selected-indicator{opacity:0;transition:opacity .3s var(--ck-widget-handler-animation-curve)}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle:hover .ck-icon .ck-icon__selected-indicator{opacity:1}.ck .ck-widget.ck-widget_with-selection-handle:hover .ck-widget__selection-handle{opacity:1;background-color:var(--ck-color-widget-hover-border)}.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected .ck-widget__selection-handle,.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected:hover .ck-widget__selection-handle{opacity:1;background-color:var(--ck-color-focus-border)}.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected .ck-widget__selection-handle .ck-icon .ck-icon__selected-indicator,.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected:hover .ck-widget__selection-handle .ck-icon .ck-icon__selected-indicator{opacity:1}.ck[dir=rtl] .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle{left:auto;right:calc(0px - var(--ck-widget-outline-thickness))}.ck.ck-editor__editable.ck-read-only .ck-widget{transition:none}.ck.ck-editor__editable.ck-read-only .ck-widget:not(.ck-widget_selected){--ck-widget-outline-thickness:0px}.ck.ck-editor__editable.ck-read-only .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle,.ck.ck-editor__editable.ck-read-only .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle:hover{background:var(--ck-color-widget-blurred-border)}.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected,.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover{outline-color:var(--ck-color-widget-blurred-border)}.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected.ck-widget_with-selection-handle .ck-widget__selection-handle,.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected.ck-widget_with-selection-handle .ck-widget__selection-handle:hover,.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover.ck-widget_with-selection-handle .ck-widget__selection-handle,.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover.ck-widget_with-selection-handle .ck-widget__selection-handle:hover{background:var(--ck-color-widget-blurred-border)}.ck.ck-editor__editable>.ck-widget.ck-widget_with-selection-handle:first-child,.ck.ck-editor__editable blockquote>.ck-widget.ck-widget_with-selection-handle:first-child{margin-top:calc(1em + var(--ck-widget-handler-icon-size))}"},function(e,t,o){var n=o(1),i=o(55);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-label{display:block}.ck.ck-voice-label{display:none}.ck.ck-label{font-weight:700}"},function(e,t,o){var n=o(1),i=o(57);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-labeled-field-view .ck-labeled-field-view__status{font-size:var(--ck-font-size-small);margin-top:var(--ck-spacing-small);white-space:normal}.ck.ck-labeled-field-view .ck-labeled-field-view__status_error{color:var(--ck-color-base-error)}.ck.ck-labeled-field-view>.ck.ck-label{width:100%;text-overflow:ellipsis;overflow:hidden}"},function(e,t,o){var n=o(1),i=o(59);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=":root{--ck-input-text-width:18em}.ck.ck-input-text{border-radius:0}.ck-rounded-corners .ck.ck-input-text,.ck.ck-input-text.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-input-text{box-shadow:var(--ck-inner-shadow),0 0;background:var(--ck-color-input-background);border:1px solid var(--ck-color-input-border);padding:var(--ck-spacing-extra-tiny) var(--ck-spacing-medium);min-width:var(--ck-input-text-width);min-height:var(--ck-ui-component-min-height);transition:box-shadow .2s ease-in-out,border .2s ease-in-out}.ck.ck-input-text:focus{outline:none;border:var(--ck-focus-ring);box-shadow:var(--ck-focus-outer-shadow),var(--ck-inner-shadow)}.ck.ck-input-text[readonly]{border:1px solid var(--ck-color-input-disabled-border);background:var(--ck-color-input-disabled-background);color:var(--ck-color-input-disabled-text)}.ck.ck-input-text[readonly]:focus{box-shadow:var(--ck-focus-disabled-outer-shadow),var(--ck-inner-shadow)}.ck.ck-input-text.ck-error{border-color:var(--ck-color-input-error-border);animation:ck-text-input-shake .3s ease both}.ck.ck-input-text.ck-error:focus{box-shadow:var(--ck-focus-error-outer-shadow),var(--ck-inner-shadow)}@keyframes ck-text-input-shake{20%{transform:translateX(-2px)}40%{transform:translateX(2px)}60%{transform:translateX(-1px)}80%{transform:translateX(1px)}}"},function(e,t,o){var n=o(1),i=o(61);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-text-alternative-form{display:flex;flex-direction:row;flex-wrap:nowrap}.ck.ck-text-alternative-form .ck-labeled-field-view{display:inline-block}.ck.ck-text-alternative-form .ck-label{display:none}@media screen and (max-width:600px){.ck.ck-text-alternative-form{flex-wrap:wrap}.ck.ck-text-alternative-form .ck-labeled-field-view{flex-basis:100%}.ck.ck-text-alternative-form .ck-button{flex-basis:50%}}.ck.ck-text-alternative-form{padding:var(--ck-spacing-standard)}.ck.ck-text-alternative-form:focus{outline:none}[dir=ltr] .ck.ck-text-alternative-form>:not(:first-child),[dir=rtl] .ck.ck-text-alternative-form>:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-text-alternative-form{padding:0;width:calc(0.8*var(--ck-input-text-width))}.ck.ck-text-alternative-form .ck-labeled-field-view{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-text-alternative-form .ck-labeled-field-view .ck-input-text{min-width:0;width:100%}.ck.ck-text-alternative-form .ck-button{padding:var(--ck-spacing-standard);margin-top:var(--ck-spacing-standard);border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border)}[dir=ltr] .ck.ck-text-alternative-form .ck-button{margin-left:0}[dir=ltr] .ck.ck-text-alternative-form .ck-button:first-of-type{border-right:1px solid var(--ck-color-base-border)}[dir=rtl] .ck.ck-text-alternative-form .ck-button{margin-left:0}[dir=rtl] .ck.ck-text-alternative-form .ck-button:last-of-type{border-right:1px solid var(--ck-color-base-border)}}"},function(e,t,o){var n=o(1),i=o(63);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck-content .image{display:table;clear:both;text-align:center;margin:1em auto}.ck-content .image img{display:block;margin:0 auto;max-width:100%;min-width:50px}"},function(e,t,o){var n=o(1),i=o(65);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck-content .image>figcaption{display:table-caption;caption-side:bottom;word-break:break-word;color:#333;background-color:#f7f7f7;padding:.6em;font-size:.75em;outline-offset:-1px}"},function(e,t,o){var n=o(1),i=o(67);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=":root{--ck-image-style-spacing:1.5em}.ck-content .image-style-side{float:right;margin-left:var(--ck-image-style-spacing);max-width:50%}.ck-content .image-style-align-left{float:left;margin-right:var(--ck-image-style-spacing)}.ck-content .image-style-align-center{margin-left:auto;margin-right:auto}.ck-content .image-style-align-right{float:right;margin-left:var(--ck-image-style-spacing)}"},function(e,t,o){var n=o(1),i=o(69);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-splitbutton{font-size:inherit}.ck.ck-splitbutton .ck-splitbutton__action:focus{z-index:calc(var(--ck-z-default) + 1)}.ck.ck-splitbutton.ck-splitbutton_open>.ck-button .ck-tooltip{display:none}:root{--ck-color-split-button-hover-background:#ebebeb;--ck-color-split-button-hover-border:#b3b3b3}[dir=ltr] .ck.ck-splitbutton>.ck-splitbutton__action{border-top-right-radius:unset;border-bottom-right-radius:unset}[dir=rtl] .ck.ck-splitbutton>.ck-splitbutton__action{border-top-left-radius:unset;border-bottom-left-radius:unset}.ck.ck-splitbutton>.ck-splitbutton__arrow{min-width:unset}[dir=ltr] .ck.ck-splitbutton>.ck-splitbutton__arrow{border-radius:0}.ck-rounded-corners [dir=ltr] .ck.ck-splitbutton>.ck-splitbutton__arrow,[dir=ltr] .ck.ck-splitbutton>.ck-splitbutton__arrow.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:unset;border-bottom-left-radius:unset}[dir=rtl] .ck.ck-splitbutton>.ck-splitbutton__arrow{border-top-right-radius:unset;border-bottom-right-radius:unset}.ck.ck-splitbutton>.ck-splitbutton__arrow svg{width:var(--ck-dropdown-arrow-size)}.ck.ck-splitbutton.ck-splitbutton_open>.ck-button:not(.ck-on):not(.ck-disabled):not(:hover),.ck.ck-splitbutton:hover>.ck-button:not(.ck-on):not(.ck-disabled):not(:hover){background:var(--ck-color-split-button-hover-background)}[dir=ltr] .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled),[dir=ltr] .ck.ck-splitbutton:hover>.ck-splitbutton__arrow:not(.ck-disabled){border-left-color:var(--ck-color-split-button-hover-border)}[dir=rtl] .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled),[dir=rtl] .ck.ck-splitbutton:hover>.ck-splitbutton__arrow:not(.ck-disabled){border-right-color:var(--ck-color-split-button-hover-border)}.ck.ck-splitbutton.ck-splitbutton_open{border-radius:0}.ck-rounded-corners .ck.ck-splitbutton.ck-splitbutton_open,.ck.ck-splitbutton.ck-splitbutton_open.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck-rounded-corners .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__action,.ck.ck-splitbutton.ck-splitbutton_open.ck-rounded-corners>.ck-splitbutton__action{border-bottom-left-radius:0}.ck-rounded-corners .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__arrow,.ck.ck-splitbutton.ck-splitbutton_open.ck-rounded-corners>.ck-splitbutton__arrow{border-bottom-right-radius:0}"},function(e,t,o){var n=o(1),i=o(71);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-form__row{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between}.ck.ck-form__row>:not(.ck-label){flex-grow:1}.ck.ck-form__row.ck-image-upload-form__action-row{margin-top:var(--ck-spacing-standard)}.ck.ck-form__row.ck-image-upload-form__action-row .ck-button-cancel,.ck.ck-form__row.ck-image-upload-form__action-row .ck-button-save{justify-content:center}.ck.ck-form__row.ck-image-upload-form__action-row .ck-button .ck-button__label{color:var(--ck-color-text)}"},function(e,t,o){var n=o(1),i=o(73);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-image-upload__panel{padding:var(--ck-spacing-standard)}.ck.ck-image-upload__ck-finder-button{display:block;width:100%;margin:var(--ck-spacing-standard) auto;border:1px solid #ccc;border-radius:var(--ck-border-radius)}"},function(e,t,o){var n=o(1),i=o(75);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-editor__editable .image{position:relative}.ck.ck-editor__editable .image .ck-progress-bar{position:absolute;top:0;left:0}.ck.ck-editor__editable .image.ck-appear{animation:fadeIn .7s}.ck.ck-editor__editable .image .ck-progress-bar{height:2px;width:0;background:var(--ck-color-upload-bar-background);transition:width .1s}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}"},function(e,t,o){var n=o(1),i=o(77);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports='.ck-image-upload-complete-icon{display:block;position:absolute;top:10px;right:10px;border-radius:50%}.ck-image-upload-complete-icon:after{content:"";position:absolute}:root{--ck-color-image-upload-icon:#fff;--ck-color-image-upload-icon-background:#008a00;--ck-image-upload-icon-size:20px;--ck-image-upload-icon-width:2px}.ck-image-upload-complete-icon{width:var(--ck-image-upload-icon-size);height:var(--ck-image-upload-icon-size);opacity:0;background:var(--ck-color-image-upload-icon-background);animation-name:ck-upload-complete-icon-show,ck-upload-complete-icon-hide;animation-fill-mode:forwards,forwards;animation-duration:.5s,.5s;font-size:var(--ck-image-upload-icon-size);animation-delay:0ms,3s}.ck-image-upload-complete-icon:after{left:25%;top:50%;opacity:0;height:0;width:0;transform:scaleX(-1) rotate(135deg);transform-origin:left top;border-top:var(--ck-image-upload-icon-width) solid var(--ck-color-image-upload-icon);border-right:var(--ck-image-upload-icon-width) solid var(--ck-color-image-upload-icon);animation-name:ck-upload-complete-icon-check;animation-duration:.5s;animation-delay:.5s;animation-fill-mode:forwards;box-sizing:border-box}@keyframes ck-upload-complete-icon-show{0%{opacity:0}to{opacity:1}}@keyframes ck-upload-complete-icon-hide{0%{opacity:1}to{opacity:0}}@keyframes ck-upload-complete-icon-check{0%{opacity:1;width:0;height:0}33%{width:.3em;height:0}to{opacity:1;width:.3em;height:.45em}}'},function(e,t,o){var n=o(1),i=o(79);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports='.ck .ck-upload-placeholder-loader{position:absolute;display:flex;align-items:center;justify-content:center;top:0;left:0}.ck .ck-upload-placeholder-loader:before{content:"";position:relative}:root{--ck-color-upload-placeholder-loader:#b3b3b3;--ck-upload-placeholder-loader-size:32px}.ck .ck-image-upload-placeholder{width:100%;margin:0}.ck .ck-upload-placeholder-loader{width:100%;height:100%}.ck .ck-upload-placeholder-loader:before{width:var(--ck-upload-placeholder-loader-size);height:var(--ck-upload-placeholder-loader-size);border-radius:50%;border-top:3px solid var(--ck-color-upload-placeholder-loader);border-right:2px solid transparent;animation:ck-upload-placeholder-loader 1s linear infinite}@keyframes ck-upload-placeholder-loader{to{transform:rotate(1turn)}}'},function(e,t,o){var n=o(1),i=o(81);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck .ck-widget_with-resizer{position:relative}.ck .ck-widget__resizer{display:none;position:absolute;pointer-events:none;left:0;top:0;outline:1px solid var(--ck-color-resizer)}.ck-focused .ck-widget_with-resizer.ck-widget_selected>.ck-widget__resizer{display:block}.ck .ck-widget__resizer__handle{position:absolute;pointer-events:all;width:var(--ck-resizer-size);height:var(--ck-resizer-size);background:var(--ck-color-focus-border);border:var(--ck-resizer-border-width) solid #fff;border-radius:var(--ck-resizer-border-radius)}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-top-left{top:var(--ck-resizer-offset);left:var(--ck-resizer-offset);cursor:nwse-resize}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-top-right{top:var(--ck-resizer-offset);right:var(--ck-resizer-offset);cursor:nesw-resize}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-bottom-right{bottom:var(--ck-resizer-offset);right:var(--ck-resizer-offset);cursor:nwse-resize}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-bottom-left{bottom:var(--ck-resizer-offset);left:var(--ck-resizer-offset);cursor:nesw-resize}"},function(e,t,o){var n=o(1),i=o(83);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck-content .image.image_resized{max-width:100%;display:block;box-sizing:border-box}.ck-content .image.image_resized img{width:100%}.ck-content .image.image_resized>figcaption{display:block}[dir=ltr] .ck.ck-button.ck-button_with-text.ck-resize-image-button .ck-button__icon{margin-right:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-button.ck-button_with-text.ck-resize-image-button .ck-button__icon{margin-left:var(--ck-spacing-standard)}.ck.ck-dropdown .ck-button.ck-resize-image-button .ck-button__label{width:4em}"},function(e,t,o){var n=o(1),i=o(85);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck .ck-link_selected{background:var(--ck-color-link-selected-background)}.ck .ck-fake-link-selection{background:var(--ck-color-link-fake-selection)}.ck .ck-fake-link-selection_collapsed{height:100%;border-right:1px solid var(--ck-color-base-text);margin-right:-1px;outline:1px solid hsla(0,0%,100%,.5)}"},function(e,t,o){var n=o(1),i=o(87);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-link-form{display:flex}.ck.ck-link-form .ck-label{display:none}@media screen and (max-width:600px){.ck.ck-link-form{flex-wrap:wrap}.ck.ck-link-form .ck-labeled-field-view{flex-basis:100%}.ck.ck-link-form .ck-button{flex-basis:50%}}.ck.ck-link-form_layout-vertical{display:block}.ck.ck-link-form{padding:var(--ck-spacing-standard)}.ck.ck-link-form:focus{outline:none}[dir=ltr] .ck.ck-link-form>:not(:first-child),[dir=rtl] .ck.ck-link-form>:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-link-form{padding:0;width:calc(0.8*var(--ck-input-text-width))}.ck.ck-link-form .ck-labeled-field-view{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-link-form .ck-labeled-field-view .ck-input-text{min-width:0;width:100%}.ck.ck-link-form .ck-button{padding:var(--ck-spacing-standard);margin-top:var(--ck-spacing-standard);border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border)}[dir=ltr] .ck.ck-link-form .ck-button{margin-left:0}[dir=ltr] .ck.ck-link-form .ck-button:first-of-type{border-right:1px solid var(--ck-color-base-border)}[dir=rtl] .ck.ck-link-form .ck-button{margin-left:0}[dir=rtl] .ck.ck-link-form .ck-button:last-of-type{border-right:1px solid var(--ck-color-base-border)}}.ck.ck-link-form_layout-vertical{padding:0;min-width:var(--ck-input-text-width)}.ck.ck-link-form_layout-vertical .ck-labeled-field-view{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) var(--ck-spacing-small)}.ck.ck-link-form_layout-vertical .ck-labeled-field-view .ck-input-text{min-width:0;width:100%}.ck.ck-link-form_layout-vertical .ck-button{padding:var(--ck-spacing-standard);margin:0;border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border);width:50%}[dir=ltr] .ck.ck-link-form_layout-vertical .ck-button{margin-left:0}[dir=ltr] .ck.ck-link-form_layout-vertical .ck-button:first-of-type{border-right:1px solid var(--ck-color-base-border)}[dir=rtl] .ck.ck-link-form_layout-vertical .ck-button{margin-left:0}[dir=rtl] .ck.ck-link-form_layout-vertical .ck-button:last-of-type{border-right:1px solid var(--ck-color-base-border)}.ck.ck-link-form_layout-vertical .ck.ck-list{margin-left:0}.ck.ck-link-form_layout-vertical .ck.ck-list .ck-button.ck-switchbutton{border:0;width:100%}.ck.ck-link-form_layout-vertical .ck.ck-list .ck-button.ck-switchbutton:hover{background:none}"},function(e,t,o){var n=o(1),i=o(89);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-link-actions{display:flex;flex-direction:row;flex-wrap:nowrap}.ck.ck-link-actions .ck-link-actions__preview{display:inline-block}.ck.ck-link-actions .ck-link-actions__preview .ck-button__label{overflow:hidden}@media screen and (max-width:600px){.ck.ck-link-actions{flex-wrap:wrap}.ck.ck-link-actions .ck-link-actions__preview{flex-basis:100%}.ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){flex-basis:50%}}.ck.ck-link-actions{padding:var(--ck-spacing-standard)}.ck.ck-link-actions .ck-button.ck-link-actions__preview{padding-left:0;padding-right:0}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label{padding:0 var(--ck-spacing-medium);color:var(--ck-color-link-default);text-overflow:ellipsis;cursor:pointer;max-width:var(--ck-input-text-width);min-width:3em;text-align:center}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label:hover{text-decoration:underline}.ck.ck-link-actions .ck-button.ck-link-actions__preview,.ck.ck-link-actions .ck-button.ck-link-actions__preview:active,.ck.ck-link-actions .ck-button.ck-link-actions__preview:focus,.ck.ck-link-actions .ck-button.ck-link-actions__preview:hover{background:none}.ck.ck-link-actions .ck-button.ck-link-actions__preview:active{box-shadow:none}.ck.ck-link-actions .ck-button.ck-link-actions__preview:focus .ck-button__label{text-decoration:underline}.ck.ck-link-actions:focus{outline:none}[dir=ltr] .ck.ck-link-actions .ck-button:not(:first-child),[dir=rtl] .ck.ck-link-actions .ck-button:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-link-actions{padding:0;width:calc(0.8*var(--ck-input-text-width))}.ck.ck-link-actions .ck-button.ck-link-actions__preview{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label{min-width:0;max-width:100%}.ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){padding:var(--ck-spacing-standard);margin-top:var(--ck-spacing-standard);border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border)}[dir=ltr] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){margin-left:0}[dir=ltr] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview):first-of-type{border-right:1px solid var(--ck-color-base-border)}[dir=rtl] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){margin-left:0}[dir=rtl] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview):last-of-type{border-right:1px solid var(--ck-color-base-border)}}"},function(e,t,o){var n=o(1),i=o(91);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=':root{--ck-todo-list-checkmark-size:16px}.ck-content .todo-list{list-style:none}.ck-content .todo-list li{margin-bottom:5px}.ck-content .todo-list li .todo-list{margin-top:5px}.ck-content .todo-list .todo-list__label>input{-webkit-appearance:none;display:inline-block;position:relative;width:var(--ck-todo-list-checkmark-size);height:var(--ck-todo-list-checkmark-size);vertical-align:middle;border:0;left:-25px;margin-right:-15px;right:0;margin-left:0}.ck-content .todo-list .todo-list__label>input:before{display:block;position:absolute;box-sizing:border-box;content:"";width:100%;height:100%;border:1px solid #333;border-radius:2px;transition:box-shadow .25s ease-in-out,background .25s ease-in-out,border .25s ease-in-out}.ck-content .todo-list .todo-list__label>input:after{display:block;position:absolute;box-sizing:content-box;pointer-events:none;content:"";left:calc(var(--ck-todo-list-checkmark-size)/3);top:calc(var(--ck-todo-list-checkmark-size)/5.3);width:calc(var(--ck-todo-list-checkmark-size)/5.3);height:calc(var(--ck-todo-list-checkmark-size)/2.6);border-left:0 solid transparent;border-bottom:calc(var(--ck-todo-list-checkmark-size)/8) solid transparent;border-right:calc(var(--ck-todo-list-checkmark-size)/8) solid transparent;border-top:0 solid transparent;transform:rotate(45deg)}.ck-content .todo-list .todo-list__label>input[checked]:before{background:#26ab33;border-color:#26ab33}.ck-content .todo-list .todo-list__label>input[checked]:after{border-color:#fff}.ck-content .todo-list .todo-list__label .todo-list__label__description{vertical-align:middle}[dir=rtl] .todo-list .todo-list__label>input{left:0;margin-right:0;right:-25px;margin-left:-15px}.ck-editor__editable .todo-list .todo-list__label>input{cursor:pointer}.ck-editor__editable .todo-list .todo-list__label>input:hover:before{box-shadow:0 0 0 5px rgba(0,0,0,.1)}'},function(e,t,o){var n=o(1),i=o(93);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=":root{--ck-color-table-focused-cell-background:rgba(158,207,250,0.3)}.ck-widget.table td.ck-editor__nested-editable.ck-editor__nested-editable_focused,.ck-widget.table td.ck-editor__nested-editable:focus,.ck-widget.table th.ck-editor__nested-editable.ck-editor__nested-editable_focused,.ck-widget.table th.ck-editor__nested-editable:focus{background:var(--ck-color-table-focused-cell-background);border-style:none;outline:1px solid var(--ck-color-focus-border);outline-offset:-1px}"},function(e,t,o){var n=o(1),i=o(95);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck .ck-insert-table-dropdown__grid{display:flex;flex-direction:row;flex-wrap:wrap}:root{--ck-insert-table-dropdown-padding:10px;--ck-insert-table-dropdown-box-height:11px;--ck-insert-table-dropdown-box-width:12px;--ck-insert-table-dropdown-box-margin:1px}.ck .ck-insert-table-dropdown__grid{width:calc(var(--ck-insert-table-dropdown-box-width)*10 + var(--ck-insert-table-dropdown-box-margin)*20 + var(--ck-insert-table-dropdown-padding)*2);padding:var(--ck-insert-table-dropdown-padding) var(--ck-insert-table-dropdown-padding) 0}.ck .ck-insert-table-dropdown__label{text-align:center}.ck .ck-insert-table-dropdown-grid-box{width:var(--ck-insert-table-dropdown-box-width);height:var(--ck-insert-table-dropdown-box-height);margin:var(--ck-insert-table-dropdown-box-margin);border:1px solid var(--ck-color-base-border);border-radius:1px}.ck .ck-insert-table-dropdown-grid-box.ck-on{border-color:var(--ck-color-focus-border);background:var(--ck-color-focus-outer-shadow)}"},function(e,t,o){var n=o(1),i=o(97);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=':root{--ck-table-selected-cell-background:rgba(158,207,250,0.3)}.ck.ck-editor__editable .table table td.ck-editor__editable_selected,.ck.ck-editor__editable .table table th.ck-editor__editable_selected{position:relative;caret-color:transparent;outline:unset;box-shadow:unset}.ck.ck-editor__editable .table table td.ck-editor__editable_selected:after,.ck.ck-editor__editable .table table th.ck-editor__editable_selected:after{content:"";pointer-events:none;background-color:var(--ck-table-selected-cell-background);position:absolute;top:0;left:0;right:0;bottom:0}.ck.ck-editor__editable .table table td.ck-editor__editable_selected ::selection,.ck.ck-editor__editable .table table td.ck-editor__editable_selected:focus,.ck.ck-editor__editable .table table th.ck-editor__editable_selected ::selection,.ck.ck-editor__editable .table table th.ck-editor__editable_selected:focus{background-color:transparent}.ck.ck-editor__editable .table table td.ck-editor__editable_selected .ck-widget_selected,.ck.ck-editor__editable .table table th.ck-editor__editable_selected .ck-widget_selected{outline:unset}'},function(e,t,o){var n=o(1),i=o(99);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck-content .table{margin:1em auto;display:table}.ck-content .table table{border-collapse:collapse;border-spacing:0;width:100%;height:100%;border:1px double #b3b3b3}.ck-content .table table td,.ck-content .table table th{min-width:2em;padding:.4em;border:1px solid #bfbfbf}.ck-content .table table th{font-weight:700;background:hsla(0,0%,0%,5%)}.ck-content[dir=rtl] .table th{text-align:right}.ck-content[dir=ltr] .table th{text-align:left}"},function(e,t,o){var n=o(1),i=o(101);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-color-grid{display:grid}:root{--ck-color-grid-tile-size:24px;--ck-color-color-grid-check-icon:#000}.ck.ck-color-grid{grid-gap:5px;padding:8px}.ck.ck-color-grid__tile{width:var(--ck-color-grid-tile-size);height:var(--ck-color-grid-tile-size);min-width:var(--ck-color-grid-tile-size);min-height:var(--ck-color-grid-tile-size);padding:0;transition:box-shadow .2s ease;border:0}.ck.ck-color-grid__tile.ck-disabled{cursor:unset;transition:unset}.ck.ck-color-grid__tile.ck-color-table__color-tile_bordered{box-shadow:0 0 0 1px var(--ck-color-base-border)}.ck.ck-color-grid__tile .ck.ck-icon{display:none;color:var(--ck-color-color-grid-check-icon)}.ck.ck-color-grid__tile.ck-on{box-shadow:inset 0 0 0 1px var(--ck-color-base-background),0 0 0 2px var(--ck-color-base-text)}.ck.ck-color-grid__tile.ck-on .ck.ck-icon{display:block}.ck.ck-color-grid__tile.ck-on,.ck.ck-color-grid__tile:focus:not(.ck-disabled),.ck.ck-color-grid__tile:hover:not(.ck-disabled){border:0}.ck.ck-color-grid__tile:focus:not(.ck-disabled),.ck.ck-color-grid__tile:hover:not(.ck-disabled){box-shadow:inset 0 0 0 1px var(--ck-color-base-background),0 0 0 2px var(--ck-color-focus-border)}.ck.ck-color-grid__label{padding:0 var(--ck-spacing-standard)}"},function(e,t,o){var n=o(1),i=o(103);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-input-color{width:100%;display:flex}.ck.ck-input-color>input.ck.ck-input-text{min-width:auto;flex-grow:1}.ck.ck-input-color>input.ck.ck-input-text:active,.ck.ck-input-color>input.ck.ck-input-text:focus{z-index:var(--ck-z-default)}.ck.ck-input-color>div.ck.ck-dropdown{min-width:auto}.ck.ck-input-color>div.ck.ck-dropdown>.ck-input-color__button .ck-dropdown__arrow{display:none}.ck.ck-input-color .ck.ck-input-color__button .ck.ck-input-color__button__preview{position:relative;overflow:hidden}.ck.ck-input-color .ck.ck-input-color__button .ck.ck-input-color__button__preview>.ck.ck-input-color__button__preview__no-color-indicator{position:absolute;display:block}[dir=ltr] .ck.ck-input-color>.ck.ck-input-text{border-top-right-radius:0;border-bottom-right-radius:0}[dir=rtl] .ck.ck-input-color>.ck.ck-input-text{border-top-left-radius:0;border-bottom-left-radius:0}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button{padding:0}[dir=ltr] .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button{border-top-left-radius:0;border-bottom-left-radius:0;margin-left:-1px}[dir=rtl] .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button{border-top-right-radius:0;border-bottom-right-radius:0;margin-right:-1px}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button.ck-disabled{background:var(--ck-color-input-disabled-background)}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button>.ck.ck-input-color__button__preview{border-radius:0}.ck-rounded-corners .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button>.ck.ck-input-color__button__preview,.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button>.ck.ck-input-color__button__preview.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button>.ck.ck-input-color__button__preview{width:20px;height:20px;border:1px solid var(--ck-color-input-border)}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button>.ck.ck-input-color__button__preview>.ck.ck-input-color__button__preview__no-color-indicator{top:-30%;left:50%;height:150%;width:8%;background:red;border-radius:2px;transform:rotate(45deg);transform-origin:50%}.ck.ck-input-color .ck.ck-input-color__remove-color{width:100%;border-bottom:1px solid var(--ck-color-input-border);padding:calc(var(--ck-spacing-standard)/2) var(--ck-spacing-standard);border-bottom-left-radius:0;border-bottom-right-radius:0}[dir=ltr] .ck.ck-input-color .ck.ck-input-color__remove-color{border-top-right-radius:0}[dir=rtl] .ck.ck-input-color .ck.ck-input-color__remove-color{border-top-left-radius:0}.ck.ck-input-color .ck.ck-input-color__remove-color .ck.ck-icon{margin-right:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-input-color .ck.ck-input-color__remove-color .ck.ck-icon{margin-right:0;margin-left:var(--ck-spacing-standard)}"},function(e,t,o){var n=o(1),i=o(105);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-form__row{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between}.ck.ck-form__row>:not(.ck-label){flex-grow:1}.ck.ck-form__row.ck-table-form__action-row .ck-button-cancel,.ck.ck-form__row.ck-table-form__action-row .ck-button-save{justify-content:center}.ck.ck-form__row{padding:var(--ck-spacing-standard) var(--ck-spacing-large) 0}[dir=ltr] .ck.ck-form__row>:not(.ck-label)+*{margin-left:var(--ck-spacing-large)}[dir=rtl] .ck.ck-form__row>:not(.ck-label)+*{margin-right:var(--ck-spacing-large)}.ck.ck-form__row>.ck-label{width:100%;min-width:100%}.ck.ck-form__row.ck-table-form__action-row{margin-top:var(--ck-spacing-large)}.ck.ck-form__row.ck-table-form__action-row .ck-button .ck-button__label{color:var(--ck-color-text)}"},function(e,t,o){var n=o(1),i=o(107);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-form__header{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:center;justify-content:space-between}:root{--ck-form-header-height:38px}.ck.ck-form__header{padding:var(--ck-spacing-small) var(--ck-spacing-large);height:var(--ck-form-header-height);line-height:var(--ck-form-header-height);border-bottom:1px solid var(--ck-color-base-border)}.ck.ck-form__header .ck-form__header__label{font-weight:700}"},function(e,t){e.exports=".ck.ck-form{padding:0 0 var(--ck-spacing-large)}.ck.ck-form:focus{outline:none}.ck.ck-form .ck.ck-input-text{min-width:100%;width:0}.ck.ck-form .ck.ck-dropdown{min-width:100%}.ck.ck-form .ck.ck-dropdown .ck-dropdown__button:not(:focus){border:1px solid var(--ck-color-base-border)}.ck.ck-form .ck.ck-dropdown .ck-dropdown__button .ck-button__label{width:100%}"},function(e,t){e.exports='.ck.ck-table-form .ck-form__row.ck-table-form__border-row{flex-wrap:wrap}.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-labeled-field-view{display:flex;flex-direction:column-reverse}.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-labeled-field-view .ck.ck-dropdown,.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-table-form__border-style,.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-table-form__border-width{flex-grow:0}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row{flex-wrap:wrap;align-items:center}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-labeled-field-view{display:flex;flex-direction:column-reverse;align-items:center}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-labeled-field-view .ck.ck-dropdown,.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimension-operator{flex-grow:0}.ck.ck-table-form .ck.ck-labeled-field-view{position:relative}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{position:absolute;left:50%;bottom:calc(-1*var(--ck-table-properties-error-arrow-size));transform:translate(-50%,100%);z-index:1}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status:after{content:"";position:absolute;top:calc(-1*var(--ck-table-properties-error-arrow-size));left:50%;transform:translateX(-50%)}:root{--ck-table-properties-error-arrow-size:6px;--ck-table-properties-min-error-width:150px}.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-labeled-field-view>.ck-label{font-size:var(--ck-font-size-tiny);text-align:center}.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-table-form__border-style{width:80px;min-width:80px}.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-table-form__border-width{width:50px;min-width:50px}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row{padding:0}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-labeled-field-view>.ck-label{font-size:10px;text-align:center}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimensions-row__height,.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimensions-row__width{margin:0}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimension-operator{align-self:start;display:inline-block;height:var(--ck-ui-component-min-height);line-height:var(--ck-ui-component-min-height);margin:0 var(--ck-spacing-small)}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{border-radius:0}.ck-rounded-corners .ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status,.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{background:var(--ck-color-base-error);color:var(--ck-color-base-background);padding:var(--ck-spacing-small) var(--ck-spacing-medium);min-width:var(--ck-table-properties-min-error-width);text-align:center}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status:after{border-left:var(--ck-table-properties-error-arrow-size) solid transparent;border-bottom:var(--ck-table-properties-error-arrow-size) solid var(--ck-color-base-error);border-right:var(--ck-table-properties-error-arrow-size) solid transparent;border-top:0 solid transparent}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{animation:ck-table-form-labeled-view-status-appear .15s ease both}.ck.ck-table-form .ck.ck-labeled-field-view .ck-input.ck-error:not(:focus)+.ck.ck-labeled-field-view__status{display:none}@keyframes ck-table-form-labeled-view-status-appear{0%{opacity:0}to{opacity:1}}'},function(e,t,o){var n=o(1),i=o(111);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row{flex-wrap:wrap;flex-basis:0;align-content:baseline}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar .ck-toolbar__items{flex-wrap:nowrap}.ck.ck-table-properties-form{width:320px}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row{padding:0}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar{background:none}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar .ck-toolbar__items>*{width:40px}"},function(e,t,o){var n=o(1),i=o(113);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row{flex-wrap:wrap}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row .ck.ck-toolbar{flex-grow:0}.ck.ck-table-cell-properties-form{width:320px}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__padding-row{padding:0;width:35%}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row .ck.ck-toolbar{background:none}"},function(e,t,o){var n=o(1),i=o(115);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-block-toolbar-button{position:absolute;z-index:var(--ck-z-default)}:root{--ck-color-block-toolbar-button:var(--ck-color-text);--ck-block-toolbar-button-size:var(--ck-font-size-normal)}.ck.ck-block-toolbar-button{color:var(--ck-color-block-toolbar-button);font-size:var(--ck-block-toolbar-size)}"},function(e,t,o){var n=o(1),i=o(117);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck .ck-button.ck-color-table__remove-color{display:flex;align-items:center;width:100%}label.ck.ck-color-grid__label{font-weight:unset}.ck .ck-button.ck-color-table__remove-color{padding:calc(var(--ck-spacing-standard)/2) var(--ck-spacing-standard);border-bottom-left-radius:0;border-bottom-right-radius:0}.ck .ck-button.ck-color-table__remove-color:not(:focus){border-bottom:1px solid var(--ck-color-base-border)}[dir=ltr] .ck .ck-button.ck-color-table__remove-color .ck.ck-icon{margin-right:var(--ck-spacing-standard)}[dir=rtl] .ck .ck-button.ck-color-table__remove-color .ck.ck-icon{margin-left:var(--ck-spacing-standard)}"},function(e,t,o){var n=o(1),i=o(119);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck-content .text-tiny{font-size:.7em}.ck-content .text-small{font-size:.85em}.ck-content .text-big{font-size:1.4em}.ck-content .text-huge{font-size:1.8em}"},function(e,t,o){var n=o(1),i=o(121);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck-content pre{padding:1em;color:#353535;background:hsla(0,0%,78%,.3);border:1px solid #c4c4c4;border-radius:2px;text-align:left;direction:ltr;tab-size:4;white-space:pre-wrap;font-style:normal;min-width:200px}.ck-content pre code{background:unset;padding:0;border-radius:0}.ck.ck-editor__editable pre{position:relative}.ck.ck-editor__editable pre[data-language]:after{content:attr(data-language);position:absolute}:root{--ck-color-code-block-label-background:#757575}.ck.ck-editor__editable pre[data-language]:after{top:-1px;right:10px;background:var(--ck-color-code-block-label-background);font-size:10px;font-family:var(--ck-font-face);line-height:16px;padding:var(--ck-spacing-tiny) var(--ck-spacing-medium);color:#fff;white-space:nowrap}.ck.ck-code-block-dropdown .ck-dropdown__panel{max-height:250px;overflow-y:auto;overflow-x:hidden}"},function(e,t,o){var n=o(1),i=o(123);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=":root{--ck-mention-list-max-height:300px}.ck.ck-mentions{max-height:var(--ck-mention-list-max-height);overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain}.ck.ck-mentions>.ck-list__item{overflow:hidden;flex-shrink:0}"},function(e,t,o){var n=o(1),i=o(125);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=":root{--ck-color-mention-background:rgba(153,0,48,0.1);--ck-color-mention-text:#990030}.ck-content .mention{background:var(--ck-color-mention-background);color:var(--ck-color-mention-text)}"},function(e,t,o){var n=o(1),i=o(127);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck-editor__editable .ck-horizontal-line{display:flow-root}.ck-content hr{margin:15px 0;height:4px;background:#dedede;border:0}"},function(e,t,o){"use strict";o.r(t),o.d(t,"default",(function(){return mv}));var n=o(3),i=n.a.Symbol,r=Object.prototype,s=r.hasOwnProperty,a=r.toString,l=i?i.toStringTag:void 0;var c=function(e){var t=s.call(e,l),o=e[l];try{e[l]=void 0;var n=!0}catch(e){}var i=a.call(e);return n&&(t?e[l]=o:delete e[l]),i},d=Object.prototype.toString;var h=function(e){return d.call(e)},u=i?i.toStringTag:void 0;var m=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":u&&u in Object(e)?c(e):h(e)};var g=function(e,t){return function(o){return e(t(o))}},f=g(Object.getPrototypeOf,Object);var p=function(e){return null!=e&&"object"==typeof e},b=Function.prototype,w=Object.prototype,k=b.toString,_=w.hasOwnProperty,v=k.call(Object);var y=function(e){if(!p(e)||"[object Object]"!=m(e))return!1;var t=f(e);if(null===t)return!0;var o=_.call(t,"constructor")&&t.constructor;return"function"==typeof o&&o instanceof o&&k.call(o)==v};var x=function(){this.__data__=[],this.size=0};var C=function(e,t){return e===t||e!=e&&t!=t};var A=function(e,t){for(var o=e.length;o--;)if(C(e[o][0],t))return o;return-1},T=Array.prototype.splice;var P=function(e){var t=this.__data__,o=A(t,e);return!(o<0)&&(o==t.length-1?t.pop():T.call(t,o,1),--this.size,!0)};var S=function(e){var t=this.__data__,o=A(t,e);return o<0?void 0:t[o][1]};var E=function(e){return A(this.__data__,e)>-1};var R=function(e,t){var o=this.__data__,n=A(o,e);return n<0?(++this.size,o.push([e,t])):o[n][1]=t,this};function I(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t<o;){var n=e[t];this.set(n[0],n[1])}}I.prototype.clear=x,I.prototype.delete=P,I.prototype.get=S,I.prototype.has=E,I.prototype.set=R;var V=I;var O=function(){this.__data__=new V,this.size=0};var M=function(e){var t=this.__data__,o=t.delete(e);return this.size=t.size,o};var N=function(e){return this.__data__.get(e)};var z=function(e){return this.__data__.has(e)};var B=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var F,D=function(e){if(!B(e))return!1;var t=m(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},L=n.a["__core-js_shared__"],H=(F=/[^.]+$/.exec(L&&L.keys&&L.keys.IE_PROTO||""))?"Symbol(src)_1."+F:"";var j=function(e){return!!H&&H in e},W=Function.prototype.toString;var q=function(e){if(null!=e){try{return W.call(e)}catch(e){}try{return e+""}catch(e){}}return""},U=/^\[object .+?Constructor\]$/,G=Function.prototype,K=Object.prototype,J=G.toString,Y=K.hasOwnProperty,Q=RegExp("^"+J.call(Y).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var X=function(e){return!(!B(e)||j(e))&&(D(e)?Q:U).test(q(e))};var Z=function(e,t){return null==e?void 0:e[t]};var ee=function(e,t){var o=Z(e,t);return X(o)?o:void 0},te=ee(n.a,"Map"),oe=ee(Object,"create");var ne=function(){this.__data__=oe?oe(null):{},this.size=0};var ie=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},re=Object.prototype.hasOwnProperty;var se=function(e){var t=this.__data__;if(oe){var o=t[e];return"__lodash_hash_undefined__"===o?void 0:o}return re.call(t,e)?t[e]:void 0},ae=Object.prototype.hasOwnProperty;var le=function(e){var t=this.__data__;return oe?void 0!==t[e]:ae.call(t,e)};var ce=function(e,t){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=oe&&void 0===t?"__lodash_hash_undefined__":t,this};function de(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t<o;){var n=e[t];this.set(n[0],n[1])}}de.prototype.clear=ne,de.prototype.delete=ie,de.prototype.get=se,de.prototype.has=le,de.prototype.set=ce;var he=de;var ue=function(){this.size=0,this.__data__={hash:new he,map:new(te||V),string:new he}};var me=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var ge=function(e,t){var o=e.__data__;return me(t)?o["string"==typeof t?"string":"hash"]:o.map};var fe=function(e){var t=ge(this,e).delete(e);return this.size-=t?1:0,t};var pe=function(e){return ge(this,e).get(e)};var be=function(e){return ge(this,e).has(e)};var we=function(e,t){var o=ge(this,e),n=o.size;return o.set(e,t),this.size+=o.size==n?0:1,this};function ke(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t<o;){var n=e[t];this.set(n[0],n[1])}}ke.prototype.clear=ue,ke.prototype.delete=fe,ke.prototype.get=pe,ke.prototype.has=be,ke.prototype.set=we;var _e=ke;var ve=function(e,t){var o=this.__data__;if(o instanceof V){var n=o.__data__;if(!te||n.length<199)return n.push([e,t]),this.size=++o.size,this;o=this.__data__=new _e(n)}return o.set(e,t),this.size=o.size,this};function ye(e){var t=this.__data__=new V(e);this.size=t.size}ye.prototype.clear=O,ye.prototype.delete=M,ye.prototype.get=N,ye.prototype.has=z,ye.prototype.set=ve;var xe=ye;var Ce=function(e,t){for(var o=-1,n=null==e?0:e.length;++o<n&&!1!==t(e[o],o,e););return e},Ae=function(){try{var e=ee(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var Te=function(e,t,o){"__proto__"==t&&Ae?Ae(e,t,{configurable:!0,enumerable:!0,value:o,writable:!0}):e[t]=o},Pe=Object.prototype.hasOwnProperty;var Se=function(e,t,o){var n=e[t];Pe.call(e,t)&&C(n,o)&&(void 0!==o||t in e)||Te(e,t,o)};var Ee=function(e,t,o,n){var i=!o;o||(o={});for(var r=-1,s=t.length;++r<s;){var a=t[r],l=n?n(o[a],e[a],a,o,e):void 0;void 0===l&&(l=e[a]),i?Te(o,a,l):Se(o,a,l)}return o};var Re=function(e,t){for(var o=-1,n=Array(e);++o<e;)n[o]=t(o);return n};var Ie=function(e){return p(e)&&"[object Arguments]"==m(e)},Ve=Object.prototype,Oe=Ve.hasOwnProperty,Me=Ve.propertyIsEnumerable,Ne=Ie(function(){return arguments}())?Ie:function(e){return p(e)&&Oe.call(e,"callee")&&!Me.call(e,"callee")},ze=Array.isArray,Be=o(4),Fe=/^(?:0|[1-9]\d*)$/;var De=function(e,t){var o=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==o||"symbol"!=o&&Fe.test(e))&&e>-1&&e%1==0&&e<t};var Le=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},He={};He["[object Float32Array]"]=He["[object Float64Array]"]=He["[object Int8Array]"]=He["[object Int16Array]"]=He["[object Int32Array]"]=He["[object Uint8Array]"]=He["[object Uint8ClampedArray]"]=He["[object Uint16Array]"]=He["[object Uint32Array]"]=!0,He["[object Arguments]"]=He["[object Array]"]=He["[object ArrayBuffer]"]=He["[object Boolean]"]=He["[object DataView]"]=He["[object Date]"]=He["[object Error]"]=He["[object Function]"]=He["[object Map]"]=He["[object Number]"]=He["[object Object]"]=He["[object RegExp]"]=He["[object Set]"]=He["[object String]"]=He["[object WeakMap]"]=!1;var je=function(e){return p(e)&&Le(e.length)&&!!He[m(e)]};var We=function(e){return function(t){return e(t)}},qe=o(5),$e=qe.a&&qe.a.isTypedArray,Ue=$e?We($e):je,Ge=Object.prototype.hasOwnProperty;var Ke=function(e,t){var o=ze(e),n=!o&&Ne(e),i=!o&&!n&&Object(Be.a)(e),r=!o&&!n&&!i&&Ue(e),s=o||n||i||r,a=s?Re(e.length,String):[],l=a.length;for(var c in e)!t&&!Ge.call(e,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||De(c,l))||a.push(c);return a},Je=Object.prototype;var Ye=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Je)},Qe=g(Object.keys,Object),Xe=Object.prototype.hasOwnProperty;var Ze=function(e){if(!Ye(e))return Qe(e);var t=[];for(var o in Object(e))Xe.call(e,o)&&"constructor"!=o&&t.push(o);return t};var et=function(e){return null!=e&&Le(e.length)&&!D(e)};var tt=function(e){return et(e)?Ke(e):Ze(e)};var ot=function(e,t){return e&&Ee(t,tt(t),e)};var nt=function(e){var t=[];if(null!=e)for(var o in Object(e))t.push(o);return t},it=Object.prototype.hasOwnProperty;var rt=function(e){if(!B(e))return nt(e);var t=Ye(e),o=[];for(var n in e)("constructor"!=n||!t&&it.call(e,n))&&o.push(n);return o};var st=function(e){return et(e)?Ke(e,!0):rt(e)};var at=function(e,t){return e&&Ee(t,st(t),e)},lt=o(8);var ct=function(e,t){var o=-1,n=e.length;for(t||(t=Array(n));++o<n;)t[o]=e[o];return t};var dt=function(e,t){for(var o=-1,n=null==e?0:e.length,i=0,r=[];++o<n;){var s=e[o];t(s,o,e)&&(r[i++]=s)}return r};var ht=function(){return[]},ut=Object.prototype.propertyIsEnumerable,mt=Object.getOwnPropertySymbols,gt=mt?function(e){return null==e?[]:(e=Object(e),dt(mt(e),(function(t){return ut.call(e,t)})))}:ht;var ft=function(e,t){return Ee(e,gt(e),t)};var pt=function(e,t){for(var o=-1,n=t.length,i=e.length;++o<n;)e[i+o]=t[o];return e},bt=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)pt(t,gt(e)),e=f(e);return t}:ht;var wt=function(e,t){return Ee(e,bt(e),t)};var kt=function(e,t,o){var n=t(e);return ze(e)?n:pt(n,o(e))};var _t=function(e){return kt(e,tt,gt)};var vt=function(e){return kt(e,st,bt)},yt=ee(n.a,"DataView"),xt=ee(n.a,"Promise"),Ct=ee(n.a,"Set"),At=ee(n.a,"WeakMap"),Tt=q(yt),Pt=q(te),St=q(xt),Et=q(Ct),Rt=q(At),It=m;(yt&&"[object DataView]"!=It(new yt(new ArrayBuffer(1)))||te&&"[object Map]"!=It(new te)||xt&&"[object Promise]"!=It(xt.resolve())||Ct&&"[object Set]"!=It(new Ct)||At&&"[object WeakMap]"!=It(new At))&&(It=function(e){var t=m(e),o="[object Object]"==t?e.constructor:void 0,n=o?q(o):"";if(n)switch(n){case Tt:return"[object DataView]";case Pt:return"[object Map]";case St:return"[object Promise]";case Et:return"[object Set]";case Rt:return"[object WeakMap]"}return t});var Vt=It,Ot=Object.prototype.hasOwnProperty;var Mt=function(e){var t=e.length,o=new e.constructor(t);return t&&"string"==typeof e[0]&&Ot.call(e,"index")&&(o.index=e.index,o.input=e.input),o},Nt=n.a.Uint8Array;var zt=function(e){var t=new e.constructor(e.byteLength);return new Nt(t).set(new Nt(e)),t};var Bt=function(e,t){var o=t?zt(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.byteLength)},Ft=/\w*$/;var Dt=function(e){var t=new e.constructor(e.source,Ft.exec(e));return t.lastIndex=e.lastIndex,t},Lt=i?i.prototype:void 0,Ht=Lt?Lt.valueOf:void 0;var jt=function(e){return Ht?Object(Ht.call(e)):{}};var Wt=function(e,t){var o=t?zt(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.length)};var qt=function(e,t,o){var n=e.constructor;switch(t){case"[object ArrayBuffer]":return zt(e);case"[object Boolean]":case"[object Date]":return new n(+e);case"[object DataView]":return Bt(e,o);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 Wt(e,o);case"[object Map]":return new n;case"[object Number]":case"[object String]":return new n(e);case"[object RegExp]":return Dt(e);case"[object Set]":return new n;case"[object Symbol]":return jt(e)}},$t=Object.create,Ut=function(){function e(){}return function(t){if(!B(t))return{};if($t)return $t(t);e.prototype=t;var o=new e;return e.prototype=void 0,o}}();var Gt=function(e){return"function"!=typeof e.constructor||Ye(e)?{}:Ut(f(e))};var Kt=function(e){return p(e)&&"[object Map]"==Vt(e)},Jt=qe.a&&qe.a.isMap,Yt=Jt?We(Jt):Kt;var Qt=function(e){return p(e)&&"[object Set]"==Vt(e)},Xt=qe.a&&qe.a.isSet,Zt=Xt?We(Xt):Qt,eo={};eo["[object Arguments]"]=eo["[object Array]"]=eo["[object ArrayBuffer]"]=eo["[object DataView]"]=eo["[object Boolean]"]=eo["[object Date]"]=eo["[object Float32Array]"]=eo["[object Float64Array]"]=eo["[object Int8Array]"]=eo["[object Int16Array]"]=eo["[object Int32Array]"]=eo["[object Map]"]=eo["[object Number]"]=eo["[object Object]"]=eo["[object RegExp]"]=eo["[object Set]"]=eo["[object String]"]=eo["[object Symbol]"]=eo["[object Uint8Array]"]=eo["[object Uint8ClampedArray]"]=eo["[object Uint16Array]"]=eo["[object Uint32Array]"]=!0,eo["[object Error]"]=eo["[object Function]"]=eo["[object WeakMap]"]=!1;var to=function e(t,o,n,i,r,s){var a,l=1&o,c=2&o,d=4&o;if(n&&(a=r?n(t,i,r,s):n(t)),void 0!==a)return a;if(!B(t))return t;var h=ze(t);if(h){if(a=Mt(t),!l)return ct(t,a)}else{var u=Vt(t),m="[object Function]"==u||"[object GeneratorFunction]"==u;if(Object(Be.a)(t))return Object(lt.a)(t,l);if("[object Object]"==u||"[object Arguments]"==u||m&&!r){if(a=c||m?{}:Gt(t),!l)return c?wt(t,at(a,t)):ft(t,ot(a,t))}else{if(!eo[u])return r?t:{};a=qt(t,u,l)}}s||(s=new xe);var g=s.get(t);if(g)return g;s.set(t,a),Zt(t)?t.forEach((function(i){a.add(e(i,o,n,i,t,s))})):Yt(t)&&t.forEach((function(i,r){a.set(r,e(i,o,n,r,t,s))}));var f=d?c?vt:_t:c?keysIn:tt,p=h?void 0:f(t);return Ce(p||t,(function(i,r){p&&(i=t[r=i]),Se(a,r,e(i,o,n,r,t,s))})),a};var oo=function(e,t){return to(e,5,t="function"==typeof t?t:void 0)};var no=function(e){return p(e)&&1===e.nodeType&&!y(e)};class io{constructor(e,t){this._config={},t&&this.define(ro(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,o,n=!1){if(y(t))return void this._setObjectToTarget(e,t,n);const i=t.split(".");t=i.pop();for(const t of i)y(e[t])||(e[t]={}),e=e[t];if(y(o))return y(e[t])||(e[t]={}),e=e[t],void this._setObjectToTarget(e,o,n);n&&void 0!==e[t]||(e[t]=o)}_getFromSource(e,t){const o=t.split(".");t=o.pop();for(const t of o){if(!y(e[t])){e=null;break}e=e[t]}return e?ro(e[t]):void 0}_setObjectToTarget(e,t,o){Object.keys(t).forEach(n=>{this._setToTarget(e,n,t[n],o)})}}function ro(e){return oo(e,so)}function so(e){return no(e)?e:void 0}var ao=function(){return function e(){e.called=!0}};class lo{constructor(e,t){this.source=e,this.name=t,this.path=[],this.stop=ao(),this.off=ao()}}const co=new Array(256).fill().map((e,t)=>("0"+t.toString(16)).slice(-2));function ho(){const e=4294967296*Math.random()>>>0,t=4294967296*Math.random()>>>0,o=4294967296*Math.random()>>>0,n=4294967296*Math.random()>>>0;return"e"+co[e>>0&255]+co[e>>8&255]+co[e>>16&255]+co[e>>24&255]+co[t>>0&255]+co[t>>8&255]+co[t>>16&255]+co[t>>24&255]+co[o>>0&255]+co[o>>8&255]+co[o>>16&255]+co[o>>24&255]+co[n>>0&255]+co[n>>8&255]+co[n>>16&255]+co[n>>24&255]}var uo={get(e){return"number"!=typeof e?this[e]||this.normal:e},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5},mo=(o(6),o(0));const go=Symbol("listeningTo"),fo=Symbol("emitterId");var po={on(e,t,o={}){this.listenTo(this,e,t,o)},once(e,t,o){let n=!1;this.listenTo(this,e,(function(e,...o){n||(n=!0,e.off(),t.call(this,e,...o))}),o)},off(e,t){this.stopListening(this,e,t)},listenTo(e,t,o,n={}){let i,r;this[go]||(this[go]={});const s=this[go];wo(e)||bo(e);const a=wo(e);(i=s[a])||(i=s[a]={emitter:e,callbacks:{}}),(r=i.callbacks[t])||(r=i.callbacks[t]=[]),r.push(o),function(e,t){const o=ko(e);if(o[t])return;let n=t,i=null;const r=[];for(;""!==n&&!o[n];)o[n]={callbacks:[],childEvents:[]},r.push(o[n]),i&&o[n].childEvents.push(i),i=n,n=n.substr(0,n.lastIndexOf(":"));if(""!==n){for(const e of r)e.callbacks=o[n].callbacks.slice();o[n].childEvents.push(i)}}(e,t);const l=_o(e,t),c=uo.get(n.priority),d={callback:o,priority:c};for(const e of l){let t=!1;for(let o=0;o<e.length;o++)if(e[o].priority<c){e.splice(o,0,d),t=!0;break}t||e.push(d)}},stopListening(e,t,o){const n=this[go];let i=e&&wo(e);const r=n&&i&&n[i],s=r&&t&&r.callbacks[t];if(!(!n||e&&!r||t&&!s))if(o)yo(e,t,o);else if(s){for(;o=s.pop();)yo(e,t,o);delete r.callbacks[t]}else if(r){for(t in r.callbacks)this.stopListening(e,t);delete n[i]}else{for(i in n)this.stopListening(n[i].emitter);delete this[go]}},fire(e,...t){try{const o=e instanceof lo?e:new lo(this,e),n=o.name;let i=function e(t,o){let n;if(!t._events||!(n=t._events[o])||!n.callbacks.length)return o.indexOf(":")>-1?e(t,o.substr(0,o.lastIndexOf(":"))):null;return n.callbacks}(this,n);if(o.path.push(this),i){const e=[o,...t];i=Array.from(i);for(let t=0;t<i.length&&(i[t].callback.apply(this,e),o.off.called&&(delete o.off.called,yo(this,n,i[t].callback)),!o.stop.called);t++);}if(this._delegations){const e=this._delegations.get(n),i=this._delegations.get("*");e&&vo(e,o,t),i&&vo(i,o,t)}return o.return}catch(e){mo.b.rethrowUnexpectedError(e,this)}},delegate(...e){return{to:(t,o)=>{this._delegations||(this._delegations=new Map),e.forEach(e=>{const n=this._delegations.get(e);n?n.set(t,o):this._delegations.set(e,new Map([[t,o]]))})}}},stopDelegating(e,t){if(this._delegations)if(e)if(t){const o=this._delegations.get(e);o&&o.delete(t)}else this._delegations.delete(e);else this._delegations.clear()}};function bo(e,t){e[fo]||(e[fo]=t||ho())}function wo(e){return e[fo]}function ko(e){return e._events||Object.defineProperty(e,"_events",{value:{}}),e._events}function _o(e,t){const o=ko(e)[t];if(!o)return[];let n=[o.callbacks];for(let t=0;t<o.childEvents.length;t++){const i=_o(e,o.childEvents[t]);n=n.concat(i)}return n}function vo(e,t,o){for(let[n,i]of e){i?"function"==typeof i&&(i=i(t.name)):i=t.name;const e=new lo(t.source,i);e.path=[...t.path],n.fire(e,...o)}}function yo(e,t,o){const n=_o(e,t);for(const e of n)for(let t=0;t<e.length;t++)e[t].callback==o&&(e.splice(t,1),t--)}function xo(e){return!(!e||!e[Symbol.iterator])}function Co(e,...t){t.forEach(t=>{Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t)).forEach(o=>{if(o in e.prototype)return;const n=Object.getOwnPropertyDescriptor(t,o);n.enumerable=!1,Object.defineProperty(e.prototype,o,n)})})}class Ao{constructor(e={},t={}){const o=xo(e);if(o||(t=e),this._items=[],this._itemMap=new Map,this._idProperty=t.idProperty||"id",this._bindToExternalToInternalMap=new WeakMap,this._bindToInternalToExternalMap=new WeakMap,this._skippedIndexesFromExternal=[],o)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 mo.b("collection-add-item-invalid-index: The index passed to Collection#addMany() is invalid.",this);for(let o=0;o<e.length;o++){const n=e[o],i=this._getItemIdBeforeAdding(n),r=t+o;this._items.splice(r,0,n),this._itemMap.set(i,n),this.fire("add",n,r)}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 mo.b("collection-get-invalid-arg: Index or id must be given.",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 this._itemMap.has(t)}}getIndex(e){let t;return t="string"==typeof e?this._itemMap.get(e):e,this._items.indexOf(t)}remove(e){const[t,o]=this._remove(e);return this.fire("change",{added:[],removed:[t],index:o}),t}map(e,t){return this._items.map(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 mo.b("collection-bind-to-rebind: The collection cannot be bound more than once.",this);return this._bindToCollection=e,{as:e=>{this._setUpBindToBinding(t=>new e(t))},using:e=>{"function"==typeof e?this._setUpBindToBinding(t=>e(t)):this._setUpBindToBinding(t=>t[e])}}}_setUpBindToBinding(e){const t=this._bindToCollection,o=(o,n,i)=>{const r=t._bindToCollection==this,s=t._bindToInternalToExternalMap.get(n);if(r&&s)this._bindToExternalToInternalMap.set(n,s),this._bindToInternalToExternalMap.set(s,n);else{const o=e(n);if(!o)return void this._skippedIndexesFromExternal.push(i);let r=i;for(const e of this._skippedIndexesFromExternal)i>e&&r--;for(const e of t._skippedIndexesFromExternal)r>=e&&r++;this._bindToExternalToInternalMap.set(n,o),this._bindToInternalToExternalMap.set(o,n),this.add(o,r);for(let e=0;e<t._skippedIndexesFromExternal.length;e++)r<=t._skippedIndexesFromExternal[e]&&t._skippedIndexesFromExternal[e]++}};for(const e of t)o(0,e,t.getIndex(e));this.listenTo(t,"add",o),this.listenTo(t,"remove",(e,t,o)=>{const n=this._bindToExternalToInternalMap.get(t);n&&this.remove(n),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce((e,t)=>(o<t&&e.push(t-1),o>t&&e.push(t),e),[])})}_getItemIdBeforeAdding(e){const t=this._idProperty;let o;if(t in e){if(o=e[t],"string"!=typeof o)throw new mo.b("collection-add-invalid-id: This item's id should be a string.",this);if(this.get(o))throw new mo.b("collection-add-item-already-exists: This item already exists in the collection.",this)}else e[t]=o=ho();return o}_remove(e){let t,o,n,i=!1;const r=this._idProperty;if("string"==typeof e?(o=e,n=this._itemMap.get(o),i=!n,n&&(t=this._items.indexOf(n))):"number"==typeof e?(t=e,n=this._items[t],i=!n,n&&(o=n[r])):(n=e,o=n[r],t=this._items.indexOf(n),i=-1==t||!this._itemMap.get(o)),i)throw new mo.b("collection-remove-404: Item not found.",this);this._items.splice(t,1),this._itemMap.delete(o);const s=this._bindToInternalToExternalMap.get(n);return this._bindToInternalToExternalMap.delete(n),this._bindToExternalToInternalMap.delete(s),this.fire("remove",n,t),[n,t]}[Symbol.iterator](){return this._items[Symbol.iterator]()}}Co(Ao,po);class To{constructor(e,t=[],o=[]){this._context=e,this._plugins=new Map,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 o)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){const t="plugincollection-plugin-not-loaded: The requested plugin is not loaded.";let o=e;throw"function"==typeof e&&(o=e.pluginName||e.name),new mo.b(t,this._context,{plugin:o})}return t}has(e){return this._plugins.has(e)}init(e,t=[]){const o=this,n=this._context,i=new Set,r=[],s=u(e),a=u(t),l=function(e){const t=[];for(const o of e)h(o)||t.push(o);return t.length?t:null}(e);if(l){const e="plugincollection-plugin-not-found: Some plugins are not available and could not be loaded.";return console.error(Object(mo.a)(e),{plugins:l}),Promise.reject(new mo.b(e,n,{plugins:l}))}return Promise.all(s.map(c)).then(()=>d(r,"init")).then(()=>d(r,"afterInit")).then(()=>r);function c(e){if(!a.includes(e)&&!o._plugins.has(e)&&!i.has(e))return function(e){return new Promise(s=>{i.add(e),e.requires&&e.requires.forEach(o=>{const i=h(o);if(e.isContextPlugin&&!i.isContextPlugin)throw new mo.b("plugincollection-context-required: Context plugin can not require plugin which is not a context plugin",null,{plugin:i.name,requiredBy:e.name});if(t.includes(i))throw new mo.b("plugincollection-required: Cannot load a plugin because one of its dependencies is listed inthe `removePlugins` option.",n,{plugin:i.name,requiredBy:e.name});c(i)});const a=o._contextPlugins.get(e)||new e(n);o._add(e,a),r.push(a),s()})}(e).catch(t=>{throw console.error(Object(mo.a)("plugincollection-load: It was not possible to load the plugin."),{plugin:e}),t})}function d(e,t){return e.reduce((e,n)=>n[t]?o._contextPlugins.has(n)?e:e.then(n[t].bind(n)):e,Promise.resolve())}function h(e){return"function"==typeof e?e:o._availablePlugins.get(e)}function u(e){return e.map(e=>h(e)).filter(e=>!!e)}}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 o=e.pluginName;if(o){if(this._plugins.has(o))throw new mo.b("plugincollection-plugin-name-conflict: Two plugins with the same name were loaded.",null,{pluginName:o,plugin1:this._plugins.get(o).constructor,plugin2:e});this._plugins.set(o,t)}}}function Po(e,t,o=1){if("number"!=typeof o)throw new mo.b("translation-service-quantity-not-a-number: Expecting `quantity` to be a number.",null,{quantity:o});const n=Object.keys(window.CKEDITOR_TRANSLATIONS).length;1===n&&(e=Object.keys(window.CKEDITOR_TRANSLATIONS)[0]);const i=t.id||t.string;if(0===n||!function(e,t){return!!window.CKEDITOR_TRANSLATIONS[e]&&!!window.CKEDITOR_TRANSLATIONS[e].dictionary[t]}(e,i))return 1!==o?t.plural:t.string;const r=window.CKEDITOR_TRANSLATIONS[e].dictionary,s=window.CKEDITOR_TRANSLATIONS[e].getPluralForm||(e=>1===e?0:1);if("string"==typeof r[i])return r[i];const a=Number(s(o));return r[i][a]}Co(To,po),window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={});const So=["ar","fa","he","ku","ug"];class Eo{constructor(e={}){this.uiLanguage=e.uiLanguage||"en",this.contentLanguage=e.contentLanguage||this.uiLanguage,this.uiLanguageDirection=Ro(this.uiLanguage),this.contentLanguageDirection=Ro(this.contentLanguage),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=[]){Array.isArray(t)||(t=[t]),"string"==typeof e&&(e={string:e});const o=!!e.plural?t[0]:1;return function(e,t){return e.replace(/%(\d+)/g,(e,o)=>o<t.length?t[o]:e)}(Po(this.uiLanguage,e,o),t)}}function Ro(e){return So.includes(e)?"rtl":"ltr"}class Io{constructor(e){this.config=new io(e,this.constructor.defaultConfig);const t=this.constructor.builtinPlugins;this.config.define("plugins",t),this.plugins=new To(this,t);const o=this.config.get("language")||{};this.locale=new Eo({uiLanguage:"string"==typeof o?o:o.ui,contentLanguage:this.config.get("language.content")}),this.t=this.locale.t,this.editors=new Ao,this._contextOwner=null}initPlugins(){const e=this.config.get("plugins")||[];for(const t of e){if("function"!=typeof t)throw new mo.b("context-initplugins-constructor-only: Only a constructor function is allowed as a context plugin.",null,{Plugin:t});if(!0!==t.isContextPlugin)throw new mo.b("context-initplugins-invalid-plugin: Only a plugin marked as a context plugin is allowed to be used with a context.",null,{Plugin:t})}return this.plugins.init(e)}destroy(){return Promise.all(Array.from(this.editors,e=>e.destroy())).then(()=>this.plugins.destroy())}_addEditor(e,t){if(this._contextOwner)throw new mo.b("context-addEditor-private-context: Cannot add multiple editors to the context which is created by the editor.");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 o=new this(e);t(o.initPlugins().then(()=>o))})}}function Vo(e,t){const o=Math.min(e.length,t.length);for(let n=0;n<o;n++)if(e[n]!=t[n])return n;return e.length==t.length?"same":e.length<t.length?"prefix":"extension"}var Oo=function(e){return to(e,4)};class Mo{constructor(e){this.document=e,this.parent=null}get index(){let e;if(!this.parent)return null;if(-1==(e=this.parent.getChildIndex(this)))throw new mo.b("view-node-not-found-in-parent: The node's parent does not contain this node.",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={includeSelf:!1,parentFirst:!1}){const t=[];let o=e.includeSelf?this:this.parent;for(;o;)t[e.parentFirst?"push":"unshift"](o),o=o.parent;return t}getCommonAncestor(e,t={}){const o=this.getAncestors(t),n=e.getAncestors(t);let i=0;for(;o[i]==n[i]&&o[i];)i++;return 0===i?null:o[i-1]}isBefore(e){if(this==e)return!1;if(this.root!==e.root)return!1;const t=this.getPath(),o=e.getPath(),n=Vo(t,o);switch(n){case"prefix":return!0;case"extension":return!1;default:return t[n]<o[n]}}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=Oo(this);return delete e.parent,e}is(e){return"node"===e||"view:node"===e}}Co(Mo,po);class No extends Mo{constructor(e,t){super(e),this._textData=t}is(e){return"$text"===e||"view:$text"===e||"text"===e||"view:text"===e||"node"===e||"view:node"===e}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 No&&(this===e||this.data===e.data)}_clone(){return new No(this.document,this.data)}}class zo{constructor(e,t,o){if(this.textNode=e,t<0||t>e.data.length)throw new mo.b("view-textproxy-wrong-offsetintext: Given offsetInText value is incorrect.",this);if(o<0||t+o>e.data.length)throw new mo.b("view-textproxy-wrong-length: Given length value is incorrect.",this);this.data=e.data.substring(t,t+o),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}is(e){return"$textProxy"===e||"view:$textProxy"===e||"textProxy"===e||"view:textProxy"===e}getAncestors(e={includeSelf:!1,parentFirst:!1}){const t=[];let o=e.includeSelf?this.textNode:this.parent;for(;null!==o;)t[e.parentFirst?"push":"unshift"](o),o=o.parent;return t}}function Bo(e){return xo(e)?new Map(e):function(e){const t=new Map;for(const o in e)t.set(o,e[o]);return t}(e)}class Fo{constructor(...e){this._patterns=[],this.add(...e)}add(...e){for(let t of e)("string"==typeof t||t instanceof RegExp)&&(t={name:t}),t.classes&&("string"==typeof t.classes||t.classes instanceof RegExp)&&(t.classes=[t.classes]),this._patterns.push(t)}match(...e){for(const t of e)for(const e of this._patterns){const o=Do(t,e);if(o)return{element:t,pattern:e,match:o}}return null}matchAll(...e){const t=[];for(const o of e)for(const e of this._patterns){const n=Do(o,e);n&&t.push({element:o,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 Do(e,t){if("function"==typeof t)return t(e);const o={};return t.name&&(o.name=function(e,t){if(e instanceof RegExp)return e.test(t);return e===t}(t.name,e.name),!o.name)||t.attributes&&(o.attributes=function(e,t){const o=[];for(const n in e){const i=e[n];if(!t.hasAttribute(n))return null;{const e=t.getAttribute(n);if(!0===i)o.push(n);else if(i instanceof RegExp){if(!i.test(e))return null;o.push(n)}else{if(e!==i)return null;o.push(n)}}}return o}(t.attributes,e),!o.attributes)?null:!(t.classes&&(o.classes=function(e,t){const o=[];for(const n of e)if(n instanceof RegExp){const e=t.getClassNames();for(const t of e)n.test(t)&&o.push(t);if(0===o.length)return null}else{if(!t.hasClass(n))return null;o.push(n)}return o}(t.classes,e),!o.classes))&&(!(t.styles&&(o.styles=function(e,t){const o=[];for(const n in e){const i=e[n];if(!t.hasStyle(n))return null;{const e=t.getStyle(n);if(i instanceof RegExp){if(!i.test(e))return null;o.push(n)}else{if(e!==i)return null;o.push(n)}}}return o}(t.styles,e),!o.styles))&&o)}var Lo=function(e){return"symbol"==typeof e||p(e)&&"[object Symbol]"==m(e)},Ho=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,jo=/^\w*$/;var Wo=function(e,t){if(ze(e))return!1;var o=typeof e;return!("number"!=o&&"symbol"!=o&&"boolean"!=o&&null!=e&&!Lo(e))||(jo.test(e)||!Ho.test(e)||null!=t&&e in Object(t))};function qo(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var o=function(){var n=arguments,i=t?t.apply(this,n):n[0],r=o.cache;if(r.has(i))return r.get(i);var s=e.apply(this,n);return o.cache=r.set(i,s)||r,s};return o.cache=new(qo.Cache||_e),o}qo.Cache=_e;var $o=qo;var Uo=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Go=/\\(\\)?/g,Ko=function(e){var t=$o(e,(function(e){return 500===o.size&&o.clear(),e})),o=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Uo,(function(e,o,n,i){t.push(n?i.replace(Go,"$1"):o||e)})),t}));var Jo=function(e,t){for(var o=-1,n=null==e?0:e.length,i=Array(n);++o<n;)i[o]=t(e[o],o,e);return i},Yo=i?i.prototype:void 0,Qo=Yo?Yo.toString:void 0;var Xo=function e(t){if("string"==typeof t)return t;if(ze(t))return Jo(t,e)+"";if(Lo(t))return Qo?Qo.call(t):"";var o=t+"";return"0"==o&&1/t==-1/0?"-0":o};var Zo=function(e){return null==e?"":Xo(e)};var en=function(e,t){return ze(e)?e:Wo(e,t)?[e]:Ko(Zo(e))};var tn=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0};var on=function(e){if("string"==typeof e||Lo(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};var nn=function(e,t){for(var o=0,n=(t=en(t,e)).length;null!=e&&o<n;)e=e[on(t[o++])];return o&&o==n?e:void 0};var rn=function(e,t,o){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(o=o>i?i:o)<0&&(o+=i),i=t>o?0:o-t>>>0,t>>>=0;for(var r=Array(i);++n<i;)r[n]=e[n+t];return r};var sn=function(e,t){return t.length<2?e:nn(e,rn(t,0,-1))};var an=function(e,t){return t=en(t,e),null==(e=sn(e,t))||delete e[on(tn(t))]};var ln=function(e,t){return null==e||an(e,t)};var cn=function(e,t,o){var n=null==e?void 0:nn(e,t);return void 0===n?o:n};var dn=function(e,t,o){(void 0!==o&&!C(e[t],o)||void 0===o&&!(t in e))&&Te(e,t,o)};var hn=function(e){return function(t,o,n){for(var i=-1,r=Object(t),s=n(t),a=s.length;a--;){var l=s[e?a:++i];if(!1===o(r[l],l,r))break}return t}}();var un=function(e){return p(e)&&et(e)};var mn=function(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]};var gn=function(e){return Ee(e,st(e))};var fn=function(e,t,o,n,i,r,s){var a=mn(e,o),l=mn(t,o),c=s.get(l);if(c)dn(e,o,c);else{var d=r?r(a,l,o+"",e,t,s):void 0,h=void 0===d;if(h){var u=ze(l),m=!u&&Object(Be.a)(l),g=!u&&!m&&Ue(l);d=l,u||m||g?ze(a)?d=a:un(a)?d=ct(a):m?(h=!1,d=Object(lt.a)(l,!0)):g?(h=!1,d=Wt(l,!0)):d=[]:y(l)||Ne(l)?(d=a,Ne(a)?d=gn(a):B(a)&&!D(a)||(d=Gt(l))):h=!1}h&&(s.set(l,d),i(d,l,n,r,s),s.delete(l)),dn(e,o,d)}};var pn=function e(t,o,n,i,r){t!==o&&hn(o,(function(s,a){if(r||(r=new xe),B(s))fn(t,o,a,n,e,i,r);else{var l=i?i(mn(t,a),s,a+"",t,o,r):void 0;void 0===l&&(l=s),dn(t,a,l)}}),st)};var bn=function(e){return e};var wn=function(e,t,o){switch(o.length){case 0:return e.call(t);case 1:return e.call(t,o[0]);case 2:return e.call(t,o[0],o[1]);case 3:return e.call(t,o[0],o[1],o[2])}return e.apply(t,o)},kn=Math.max;var _n=function(e,t,o){return t=kn(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,r=kn(n.length-t,0),s=Array(r);++i<r;)s[i]=n[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=n[i];return a[t]=o(s),wn(e,this,a)}};var vn=function(e){return function(){return e}},yn=Ae?function(e,t){return Ae(e,"toString",{configurable:!0,enumerable:!1,value:vn(t),writable:!0})}:bn,xn=Date.now;var Cn=function(e){var t=0,o=0;return function(){var n=xn(),i=16-(n-o);if(o=n,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(yn);var An=function(e,t){return Cn(_n(e,t,bn),e+"")};var Tn=function(e,t,o){if(!B(o))return!1;var n=typeof t;return!!("number"==n?et(o)&&De(t,o.length):"string"==n&&t in o)&&C(o[t],e)};var Pn=function(e){return An((function(t,o){var n=-1,i=o.length,r=i>1?o[i-1]:void 0,s=i>2?o[2]:void 0;for(r=e.length>3&&"function"==typeof r?(i--,r):void 0,s&&Tn(o[0],o[1],s)&&(r=i<3?void 0:r,i=1),t=Object(t);++n<i;){var a=o[n];a&&e(t,a,n,r)}return t}))},Sn=Pn((function(e,t,o){pn(e,t,o)}));var En=function(e,t,o,n){if(!B(e))return e;for(var i=-1,r=(t=en(t,e)).length,s=r-1,a=e;null!=a&&++i<r;){var l=on(t[i]),c=o;if(i!=s){var d=a[l];void 0===(c=n?n(d,l,a):void 0)&&(c=B(d)?d:De(t[i+1])?[]:{})}Se(a,l,c),a=a[l]}return e};var Rn=function(e,t,o){return null==e?e:En(e,t,o)};class In{constructor(e){this._styles={},this._styleProcessor=e}get isEmpty(){const e=Object.entries(this._styles);return!Array.from(e).length}get size(){return this.isEmpty?0:this.getStyleNames().length}setTo(e){this.clear();const t=Array.from(function(e){let t=null,o=0,n=0,i=null;const r=new Map;if(""===e)return r;";"!=e.charAt(e.length-1)&&(e+=";");for(let s=0;s<e.length;s++){const a=e.charAt(s);if(null===t)switch(a){case":":i||(i=e.substr(o,s-o),n=s+1);break;case'"':case"'":t=a;break;case";":{const t=e.substr(n,s-n);i&&r.set(i.trim(),t.trim()),i=null,o=s+1;break}}else a===t&&(t=null)}return r}(e).entries());for(const[e,o]of t)this._styleProcessor.toNormalizedForm(e,o,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(B(e))for(const[t,o]of Object.entries(e))this._styleProcessor.toNormalizedForm(t,o,this._styles);else this._styleProcessor.toNormalizedForm(e,t,this._styles)}remove(e){const t=On(e);ln(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]&&!B(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(){if(this.isEmpty)return[];return this._getStylesEntries().map(([e])=>e)}clear(){this._styles={}}_getStylesEntries(){const e=[],t=Object.keys(this._styles);for(const o of t)e.push(...this._styleProcessor.getReducedForm(o,this._styles));return e}_cleanEmptyObjectsOnPath(e){const t=e.split(".");if(!(t.length>1))return;const o=t.splice(0,t.length-1).join("."),n=cn(this._styles,o);if(!n)return;!Array.from(Object.keys(n)).length&&this.remove(o)}}class Vn{constructor(){this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(e,t,o){if(B(t))Mn(o,On(e),t);else if(this._normalizers.has(e)){const n=this._normalizers.get(e),{path:i,value:r}=n(t);Mn(o,i,r)}else Mn(o,e,t)}getNormalized(e,t){if(!e)return Sn({},t);if(void 0!==t[e])return t[e];if(this._extractors.has(e)){const o=this._extractors.get(e);if("string"==typeof o)return cn(t,o);const n=o(e,t);if(n)return n}return cn(t,On(e))}getReducedForm(e,t){const o=this.getNormalized(e,t);if(void 0===o)return[];if(this._reducers.has(e)){return this._reducers.get(e)(o)}return[[e,o]]}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 o of t)this._mapStyleNames(o,[e])}_mapStyleNames(e,t){this._consumables.has(e)||this._consumables.set(e,[]),this._consumables.get(e).push(...t)}}function On(e){return e.replace("-",".")}function Mn(e,t,o){let n=o;B(o)&&(n=Sn({},cn(e,t),o)),Rn(e,t,n)}class Nn extends Mo{constructor(e,t,o,n){if(super(e),this.name=t,this._attrs=function(e){e=Bo(e);for(const[t,o]of e)null===o?e.delete(t):"string"!=typeof o&&e.set(t,String(o));return e}(o),this._children=[],n&&this._insertChild(0,n),this._classes=new Set,this._attrs.has("class")){const e=this._attrs.get("class");zn(this._classes,e),this._attrs.delete("class")}this._styles=new In(this.document.stylesProcessor),this._attrs.has("style")&&(this._styles.setTo(this._attrs.get("style")),this._attrs.delete("style")),this._customProperties=new Map}get childCount(){return this._children.length}get isEmpty(){return 0===this._children.length}is(e,t=null){return t?t===this.name&&("element"===e||"view:element"===e):"element"===e||"view:element"===e||"node"===e||"view:node"===e}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 Nn))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,o]of this._attrs)if(!e._attrs.has(t)||e._attrs.get(t)!==o)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(){return this._styles.getStyleNames()}hasStyle(...e){for(const t of e)if(!this._styles.has(t))return!1;return!0}findAncestor(...e){const t=new Fo(...e);let o=this.parent;for(;o;){if(t.match(o))return o;o=o.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(),o=Array.from(this._attrs).map(e=>`${e[0]}="${e[1]}"`).sort().join(" ");return this.name+(""==e?"":` class="${e}"`)+(t?` style="${t}"`:"")+(""==o?"":" "+o)}_clone(e=!1){const t=[];if(e)for(const o of this.getChildren())t.push(o._clone(e));const o=new this.constructor(this.document,this.name,this._attrs,t);return o._classes=new Set(this._classes),o._styles.set(this._styles.getNormalized()),o._customProperties=new Map(this._customProperties),o.getFillerOffset=this.getFillerOffset,o}_appendChild(e){return this._insertChild(this.childCount,e)}_insertChild(e,t){this._fireChange("children",this);let o=0;const n=function(e,t){if("string"==typeof t)return[new No(e,t)];xo(t)||(t=[t]);return Array.from(t).map(t=>"string"==typeof t?new No(e,t):t instanceof zo?new No(e,t.data):t)}(this.document,t);for(const t of n)null!==t.parent&&t._remove(),t.parent=this,t.document=this.document,this._children.splice(e,0,t),e++,o++;return o}_removeChildren(e,t=1){this._fireChange("children",this);for(let o=e;o<e+t;o++)this._children[o].parent=null;return this._children.splice(e,t)}_setAttribute(e,t){t=String(t),this._fireChange("attributes",this),"class"==e?zn(this._classes,t):"style"==e?this._styles.setTo(t):this._attrs.set(e,t)}_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),(e=Array.isArray(e)?e:[e]).forEach(e=>this._classes.add(e))}_removeClass(e){this._fireChange("attributes",this),(e=Array.isArray(e)?e:[e]).forEach(e=>this._classes.delete(e))}_setStyle(e,t){this._fireChange("attributes",this),this._styles.set(e,t)}_removeStyle(e){this._fireChange("attributes",this),(e=Array.isArray(e)?e:[e]).forEach(e=>this._styles.remove(e))}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}}function zn(e,t){const o=t.split(/\s+/);e.clear(),o.forEach(t=>e.add(t))}class Bn extends Nn{constructor(e,t,o,n){super(e,t,o,n),this.getFillerOffset=Fn}is(e,t=null){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}}function Fn(){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}var Dn=Pn((function(e,t){Ee(t,st(t),e)}));const Ln=Symbol("observableProperties"),Hn=Symbol("boundObservables"),jn=Symbol("boundProperties"),Wn={set(e,t){if(B(e))return void Object.keys(e).forEach(t=>{this.set(t,e[t])},this);$n(this);const o=this[Ln];if(e in this&&!o.has(e))throw new mo.b("observable-set-cannot-override: Cannot override an existing property.",this);Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>o.get(e),set(t){const n=o.get(e);let i=this.fire("set:"+e,e,t,n);void 0===i&&(i=t),n===i&&o.has(e)||(o.set(e,i),this.fire("change:"+e,e,i,n))}}),this[e]=t},bind(...e){if(!e.length||!Kn(e))throw new mo.b("observable-bind-wrong-properties: All properties must be strings.",this);if(new Set(e).size!==e.length)throw new mo.b("observable-bind-duplicate-properties: Properties must be unique.",this);$n(this);const t=this[jn];e.forEach(e=>{if(t.has(e))throw new mo.b("observable-bind-rebind: Cannot bind the same property more than once.",this)});const o=new Map;return e.forEach(e=>{const n={property:e,to:[]};t.set(e,n),o.set(e,n)}),{to:Un,toMany:Gn,_observable:this,_bindProperties:e,_to:[],_bindings:o}},unbind(...e){if(!this[Ln])return;const t=this[jn],o=this[Hn];if(e.length){if(!Kn(e))throw new mo.b("observable-unbind-wrong-properties: Properties must be strings.",this);e.forEach(e=>{const n=t.get(e);if(!n)return;let i,r,s,a;n.to.forEach(e=>{i=e[0],r=e[1],s=o.get(i),a=s[r],a.delete(n),a.size||delete s[r],Object.keys(s).length||(o.delete(i),this.stopListening(i,"change"))}),t.delete(e)})}else o.forEach((e,t)=>{this.stopListening(t,"change")}),o.clear(),t.clear()},decorate(e){const t=this[e];if(!t)throw new mo.b("observablemixin-cannot-decorate-undefined: Cannot decorate an undefined method.",this,{object:this,methodName:e});this.on(e,(e,o)=>{e.return=t.apply(this,o)}),this[e]=function(...t){return this.fire(e,t)}}};Dn(Wn,po);var qn=Wn;function $n(e){e[Ln]||(Object.defineProperty(e,Ln,{value:new Map}),Object.defineProperty(e,Hn,{value:new Map}),Object.defineProperty(e,jn,{value:new Map}))}function Un(...e){const t=function(...e){if(!e.length)throw new mo.b("observable-bind-to-parse-error: Invalid argument syntax in `to()`.",null);const t={to:[]};let o;"function"==typeof e[e.length-1]&&(t.callback=e.pop());return e.forEach(e=>{if("string"==typeof e)o.properties.push(e);else{if("object"!=typeof e)throw new mo.b("observable-bind-to-parse-error: Invalid argument syntax in `to()`.",null);o={observable:e,properties:[]},t.to.push(o)}}),t}(...e),o=Array.from(this._bindings.keys()),n=o.length;if(!t.callback&&t.to.length>1)throw new mo.b("observable-bind-to-no-callback: Binding multiple observables only possible with callback.",this);if(n>1&&t.callback)throw new mo.b("observable-bind-to-extra-callback: Cannot bind multiple properties and use a callback in one binding.",this);var i;t.to.forEach(e=>{if(e.properties.length&&e.properties.length!==n)throw new mo.b("observable-bind-to-properties-length: The number of properties must match.",this);e.properties.length||(e.properties=this._bindProperties)}),this._to=t.to,t.callback&&(this._bindings.get(o[0]).callback=t.callback),i=this._observable,this._to.forEach(e=>{const t=i[Hn];let o;t.get(e.observable)||i.listenTo(e.observable,"change",(n,r)=>{o=t.get(e.observable)[r],o&&o.forEach(e=>{Jn(i,e.property)})})}),function(e){let t;e._bindings.forEach((o,n)=>{e._to.forEach(i=>{t=i.properties[o.callback?0:e._bindProperties.indexOf(n)],o.to.push([i.observable,t]),function(e,t,o,n){const i=e[Hn],r=i.get(o),s=r||{};s[n]||(s[n]=new Set);s[n].add(t),r||i.set(o,s)}(e._observable,o,i.observable,t)})})}(this),this._bindProperties.forEach(e=>{Jn(this._observable,e)})}function Gn(e,t,o){if(this._bindings.size>1)throw new mo.b("observable-bind-to-many-not-one-binding: Cannot bind multiple properties with toMany().",this);this.to(...function(e,t){const o=e.map(e=>[e,t]);return Array.prototype.concat.apply([],o)}(e,t),o)}function Kn(e){return e.every(e=>"string"==typeof e)}function Jn(e,t){const o=e[jn].get(t);let n;o.callback?n=o.callback.apply(e,o.to.map(e=>e[0][e[1]])):(n=o.to[0],n=n[0][n[1]]),Object.prototype.hasOwnProperty.call(e,t)?e[t]=n:e.set(t,n)}class Yn extends Bn{constructor(e,t,o,n){super(e,t,o,n),this.set("isReadOnly",!1),this.set("isFocused",!1),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})}is(e,t=null){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}destroy(){this.stopListening()}}Co(Yn,qn);const Qn=Symbol("rootName");class Xn extends Yn{constructor(e,t){super(e,t),this.rootName="main"}is(e,t=null){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}get rootName(){return this.getCustomProperty(Qn)}set rootName(e){this._setCustomProperty(Qn,e)}set _name(e){this.name=e}}class Zn{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new mo.b("view-tree-walker-no-start-position: Neither boundaries nor starting position have been defined.",null);if(e.direction&&"forward"!=e.direction&&"backward"!=e.direction)throw new mo.b("view-tree-walker-unknown-direction: Only `backward` and `forward` direction allowed.",e.startPosition,{direction:e.direction});this.boundaries=e.boundaries||null,e.startPosition?this.position=ei._createAt(e.startPosition):this.position=ei._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}skip(e){let t,o,n;do{n=this.position,({done:t,value:o}=this.next())}while(!t&&e(o));t||(this.position=n)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){let e=this.position.clone();const t=this.position,o=e.parent;if(null===o.parent&&e.offset===o.childCount)return{done:!0};if(o===this._boundaryEndParent&&e.offset==this.boundaries.end.offset)return{done:!0};let n;if(o instanceof No){if(e.isAtEnd)return this.position=ei._createAfter(o),this._next();n=o.data[e.offset]}else n=o.getChild(e.offset);if(n instanceof Nn)return this.shallow?e.offset++:e=new ei(n,0),this.position=e,this._formatReturnValue("elementStart",n,t,e,1);if(n instanceof No){if(this.singleCharacters)return e=new ei(n,0),this.position=e,this._next();{let o,i=n.data.length;return n==this._boundaryEndParent?(i=this.boundaries.end.offset,o=new zo(n,0,i),e=ei._createAfter(o)):(o=new zo(n,0,n.data.length),e.offset++),this.position=e,this._formatReturnValue("text",o,t,e,i)}}if("string"==typeof n){let n;if(this.singleCharacters)n=1;else{n=(o===this._boundaryEndParent?this.boundaries.end.offset:o.data.length)-e.offset}const i=new zo(o,e.offset,n);return e.offset+=n,this.position=e,this._formatReturnValue("text",i,t,e,n)}return e=ei._createAfter(o),this.position=e,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",o,t,e)}_previous(){let e=this.position.clone();const t=this.position,o=e.parent;if(null===o.parent&&0===e.offset)return{done:!0};if(o==this._boundaryStartParent&&e.offset==this.boundaries.start.offset)return{done:!0};let n;if(o instanceof No){if(e.isAtStart)return this.position=ei._createBefore(o),this._previous();n=o.data[e.offset-1]}else n=o.getChild(e.offset-1);if(n instanceof Nn)return this.shallow?(e.offset--,this.position=e,this._formatReturnValue("elementStart",n,t,e,1)):(e=new ei(n,n.childCount),this.position=e,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",n,t,e));if(n instanceof No){if(this.singleCharacters)return e=new ei(n,n.data.length),this.position=e,this._previous();{let o,i=n.data.length;if(n==this._boundaryStartParent){const t=this.boundaries.start.offset;o=new zo(n,t,n.data.length-t),i=o.data.length,e=ei._createBefore(o)}else o=new zo(n,0,n.data.length),e.offset--;return this.position=e,this._formatReturnValue("text",o,t,e,i)}}if("string"==typeof n){let n;if(this.singleCharacters)n=1;else{const t=o===this._boundaryStartParent?this.boundaries.start.offset:0;n=e.offset-t}e.offset-=n;const i=new zo(o,e.offset,n);return this.position=e,this._formatReturnValue("text",i,t,e,n)}return e=ei._createBefore(o),this.position=e,this._formatReturnValue("elementStart",o,t,e,1)}_formatReturnValue(e,t,o,n,i){return t instanceof zo&&(t.offsetInText+t.data.length==t.textNode.data.length&&("forward"!=this.direction||this.boundaries&&this.boundaries.end.isEqual(this.position)?o=ei._createAfter(t.textNode):(n=ei._createAfter(t.textNode),this.position=n)),0===t.offsetInText&&("backward"!=this.direction||this.boundaries&&this.boundaries.start.isEqual(this.position)?o=ei._createBefore(t.textNode):(n=ei._createBefore(t.textNode),this.position=n))),{done:!1,value:{type:e,item:t,previousPosition:o,nextPosition:n,length:i}}}}class ei{constructor(e,t){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 Yn);){if(!e.parent)return null;e=e.parent}return e}getShiftedBy(e){const t=ei._createAt(this),o=t.offset+e;return t.offset=o<0?0:o,t}getLastMatchingPosition(e,t={}){t.startPosition=this;const o=new Zn(t);return o.skip(e),o.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(e){const t=this.getAncestors(),o=e.getAncestors();let n=0;for(;t[n]==o[n]&&t[n];)n++;return 0===n?null:t[n-1]}is(e){return"position"===e||"view:position"===e}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():[],o=e.parent.is("node")?e.parent.getPath():[];t.push(this.offset),o.push(e.offset);const n=Vo(t,o);switch(n){case"prefix":return"before";case"extension":return"after";default:return t[n]<o[n]?"before":"after"}}getWalker(e={}){return e.startPosition=this,new Zn(e)}clone(){return new ei(this.parent,this.offset)}static _createAt(e,t){if(e instanceof ei)return new this(e.parent,e.offset);{const o=e;if("end"==t)t=o.is("$text")?o.data.length:o.childCount;else{if("before"==t)return this._createBefore(o);if("after"==t)return this._createAfter(o);if(0!==t&&!t)throw new mo.b("view-createPositionAt-offset-required: View#createPositionAt() requires the offset when the first parameter is a view item.",o)}return new ei(o,t)}}static _createAfter(e){if(e.is("$textProxy"))return new ei(e.textNode,e.offsetInText+e.data.length);if(!e.parent)throw new mo.b("view-position-after-root: You can not make position after root.",e,{root:e});return new ei(e.parent,e.index+1)}static _createBefore(e){if(e.is("$textProxy"))return new ei(e.textNode,e.offsetInText);if(!e.parent)throw new mo.b("view-position-before-root: You can not make position before root.",e,{root:e});return new ei(e.parent,e.index)}}class ti{constructor(e,t=null){this.start=e.clone(),this.end=t?t.clone():e.clone()}*[Symbol.iterator](){yield*new Zn({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(oi,{direction:"backward"}),t=this.end.getLastMatchingPosition(oi);return e.parent.is("$text")&&e.isAtStart&&(e=ei._createBefore(e.parent)),t.parent.is("$text")&&t.isAtEnd&&(t=ei._createAfter(t.parent)),new ti(e,t)}getTrimmed(){let e=this.start.getLastMatchingPosition(oi);if(e.isAfter(this.end)||e.isEqual(this.end))return new ti(e,e);let t=this.end.getLastMatchingPosition(oi,{direction:"backward"});const o=e.nodeAfter,n=t.nodeBefore;return o&&o.is("$text")&&(e=new ei(o,0)),n&&n.is("$text")&&(t=new ei(n,n.data.length)),new ti(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 o=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),n=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return o&&n}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new ti(this.start,e.start)),this.containsPosition(e.end)&&t.push(new ti(e.end,this.end))):t.push(this.clone()),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,o=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(o=e.end),new ti(t,o)}return null}getWalker(e={}){return e.boundaries=this,new Zn(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 ti(this.start,this.end)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new Zn(e);for(const e of t)yield e.item}*getPositions(e={}){e.boundaries=this;const t=new Zn(e);yield t.position;for(const e of t)yield e.nextPosition}is(e){return"range"===e||"view:range"===e}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}static _createFromParentsAndOffsets(e,t,o,n){return new this(new ei(e,t),new ei(o,n))}static _createFromPositionAndShift(e,t){const o=e,n=e.getShiftedBy(t);return t>0?new this(o,n):new this(n,o)}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(ei._createBefore(e),t)}}function oi(e){return!(!e.item.is("attributeElement")&&!e.item.is("uiElement"))}function ni(e){let t=0;for(const o of e)t++;return t}class ii{constructor(e=null,t,o){this._ranges=[],this._lastRangeBackward=!1,this._isFake=!1,this._fakeSelectionLabel="",this.setTo(e,t,o)}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 o=!1;for(const n of e._ranges)if(t.isEqual(n)){o=!0;break}if(!o)return!1}return!0}isSimilar(e){if(this.isBackward!=e.isBackward)return!1;const t=ni(this.getRanges());if(t!=ni(e.getRanges()))return!1;if(0==t)return!0;for(let t of this.getRanges()){t=t.getTrimmed();let o=!1;for(let n of e.getRanges())if(n=n.getTrimmed(),t.start.isEqual(n.start)&&t.end.isEqual(n.end)){o=!0;break}if(!o)return!1}return!0}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}setTo(e,t,o){if(null===e)this._setRanges([]),this._setFakeOptions(t);else if(e instanceof ii||e instanceof ri)this._setRanges(e.getRanges(),e.isBackward),this._setFakeOptions({fake:e.isFake,label:e.fakeSelectionLabel});else if(e instanceof ti)this._setRanges([e],t&&t.backward),this._setFakeOptions(t);else if(e instanceof ei)this._setRanges([new ti(e)]),this._setFakeOptions(t);else if(e instanceof Mo){const n=!!o&&!!o.backward;let i;if(void 0===t)throw new mo.b("view-selection-setTo-required-second-parameter: selection.setTo requires the second parameter when the first parameter is a node.",this);i="in"==t?ti._createIn(e):"on"==t?ti._createOn(e):new ti(ei._createAt(e,t)),this._setRanges([i],n),this._setFakeOptions(o)}else{if(!xo(e))throw new mo.b("view-selection-setTo-not-selectable: Cannot set selection to given place.",this);this._setRanges(e,t&&t.backward),this._setFakeOptions(t)}this.fire("change")}setFocus(e,t){if(null===this.anchor)throw new mo.b("view-selection-setFocus-no-ranges: Cannot set selection focus if there are no ranges in selection.",this);const o=ei._createAt(e,t);if("same"==o.compareWith(this.focus))return;const n=this.anchor;this._ranges.pop(),"before"==o.compareWith(n)?this._addRange(new ti(o,n),!0):this._addRange(new ti(n,o)),this.fire("change")}is(e){return"selection"===e||"view:selection"===e}_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 ti))throw new mo.b("view-selection-add-range-not-range: Selection range set to an object that is not an instance of view.Range",this);this._pushRange(e),this._lastRangeBackward=!!t}_pushRange(e){for(const t of this._ranges)if(e.isIntersecting(t))throw new mo.b("view-selection-range-intersects: Trying to add a range that intersects with another range from selection.",this,{addedRange:e,intersectingRange:t});this._ranges.push(new ti(e.start,e.end))}}Co(ii,po);class ri{constructor(e=null,t,o){this._selection=new ii,this._selection.delegate("change").to(this),this._selection.setTo(e,t,o)}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)}is(e){return"selection"===e||"documentSelection"==e||"view:selection"==e||"view:documentSelection"==e}_setTo(e,t,o){this._selection.setTo(e,t,o)}_setFocus(e,t){this._selection.setFocus(e,t)}}Co(ri,po);class si{constructor(e){this.selection=new ri,this.roots=new Ao({idProperty:"rootName"}),this.stylesProcessor=e,this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isComposing",!1),this._postFixers=new Set}getRoot(e="main"){return this.roots.get(e)}registerPostFixer(e){this._postFixers.add(e)}destroy(){this.roots.map(e=>e.destroy()),this.stopListening()}_callPostFixers(e){let t=!1;do{for(const o of this._postFixers)if(t=o(e),t)break}while(t)}}Co(si,qn);class ai extends Nn{constructor(e,t,o,n){super(e,t,o,n),this.getFillerOffset=li,this._priority=10,this._id=null,this._clonesGroup=null}get priority(){return this._priority}get id(){return this._id}getElementsWithSameId(){if(null===this.id)throw new mo.b("attribute-element-get-elements-with-same-id-no-id: Cannot get elements with the same id for an attribute element without id.",this);return new Set(this._clonesGroup)}is(e,t=null){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}isSimilar(e){return null!==this.id||null!==e.id?this.id===e.id:super.isSimilar(e)&&this.priority==e.priority}_clone(e){const t=super._clone(e);return t._priority=this._priority,t._id=this._id,t}}function li(){if(ci(this))return null;let e=this.parent;for(;e&&e.is("attributeElement");){if(ci(e)>1)return null;e=e.parent}return!e||ci(e)>1?null:this.childCount}function ci(e){return Array.from(e.getChildren()).filter(e=>!e.is("uiElement")).length}ai.DEFAULT_PRIORITY=10;class di extends Nn{constructor(e,t,o,n){super(e,t,o,n),this.getFillerOffset=hi}is(e,t=null){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}_insertChild(e,t){if(t&&(t instanceof Mo||Array.from(t).length>0))throw new mo.b("view-emptyelement-cannot-add: Cannot add child nodes to EmptyElement instance.",[this,t])}}function hi(){return null}const ui=navigator.userAgent.toLowerCase();var mi={isMac:function(e){return e.indexOf("macintosh")>-1}(ui),isGecko:function(e){return!!e.match(/gecko\/\d+/)}(ui),isSafari:function(e){return e.indexOf(" applewebkit/")>-1&&-1===e.indexOf("chrome")}(ui),isAndroid:function(e){return e.indexOf("android")>-1}(ui),features:{isRegExpUnicodePropertySupported:function(){let e=!1;try{e=0==="ć".search(new RegExp("[\\p{L}]","u"))}catch(e){}return e}()}};const gi={"⌘":"ctrl","⇧":"shift","⌥":"alt"},fi={ctrl:"⌘",shift:"⇧",alt:"⌥"},pi=function(){const e={arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,backspace:8,delete:46,enter:13,space:32,esc:27,tab:9,ctrl:1114112,cmd:1114112,shift:2228224,alt:4456448};for(let t=65;t<=90;t++){const o=String.fromCharCode(t);e[o.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 e}();function bi(e){let t;if("string"==typeof e){if(t=pi[e.toLowerCase()],!t)throw new mo.b("keyboard-unknown-key: Unknown key name.",null,{key:e})}else t=e.keyCode+(e.altKey?pi.alt:0)+(e.ctrlKey?pi.ctrl:0)+(e.shiftKey?pi.shift:0);return t}function wi(e){return"string"==typeof e&&(e=xi(e)),e.map(e=>"string"==typeof e?bi(e):e).reduce((e,t)=>t+e,0)}function ki(e){return mi.isMac?xi(e).map(e=>fi[e.toLowerCase()]||e).reduce((e,t)=>e.slice(-1)in gi?e+t:e+"+"+t):e}function _i(e){return e==pi.arrowright||e==pi.arrowleft||e==pi.arrowup||e==pi.arrowdown}function vi(e,t){const o="ltr"===t;switch(e){case pi.arrowleft:return o?"left":"right";case pi.arrowright:return o?"right":"left";case pi.arrowup:return"up";case pi.arrowdown:return"down"}}function yi(e,t){const o=vi(e,t);return"down"===o||"right"===o}function xi(e){return e.split(/\s*\+\s*/)}class Ci extends Nn{constructor(e,t,o,n){super(e,t,o,n),this.getFillerOffset=Ti}is(e,t=null){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}_insertChild(e,t){if(t&&(t instanceof Mo||Array.from(t).length>0))throw new mo.b("view-uielement-cannot-add: Cannot add child nodes to UIElement instance.",this)}render(e){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 Ai(e){e.document.on("keydown",(t,o)=>function(e,t,o){if(t.keyCode==pi.arrowright){const e=t.domTarget.ownerDocument.defaultView.getSelection(),n=1==e.rangeCount&&e.getRangeAt(0).collapsed;if(n||t.shiftKey){const t=e.focusNode,i=e.focusOffset,r=o.domPositionToView(t,i);if(null===r)return;let s=!1;const a=r.getLastMatchingPosition(e=>(e.item.is("uiElement")&&(s=!0),!(!e.item.is("uiElement")&&!e.item.is("attributeElement"))));if(s){const t=o.viewPositionToDom(a);n?e.collapse(t.parent,t.offset):e.extend(t.parent,t.offset)}}}}(0,o,e.domConverter))}function Ti(){return null}class Pi extends Nn{constructor(e,t,o,n){super(e,t,o,n),this.getFillerOffset=Si}is(e,t=null){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}_insertChild(e,t){if(t&&(t instanceof Mo||Array.from(t).length>0))throw new mo.b("view-rawelement-cannot-add: Cannot add child nodes to a RawElement instance.",[this,t])}}function Si(){return null}class Ei{constructor(e,t){this.document=e,this._children=[],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}is(e){return"documentFragment"===e||"view:documentFragment"===e}_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 o=0;const n=function(e,t){if("string"==typeof t)return[new No(e,t)];xo(t)||(t=[t]);return Array.from(t).map(t=>"string"==typeof t?new No(e,t):t instanceof zo?new No(e,t.data):t)}(this.document,t);for(const t of n)null!==t.parent&&t._remove(),t.parent=this,this._children.splice(e,0,t),e++,o++;return o}_removeChildren(e,t=1){this._fireChange("children",this);for(let o=e;o<e+t;o++)this._children[o].parent=null;return this._children.splice(e,t)}_fireChange(e,t){this.fire("change:"+e,t)}}Co(Ei,po);class Ri{constructor(e){this.document=e,this._cloneGroups=new Map}setSelection(e,t,o){this.document.selection._setTo(e,t,o)}setSelectionFocus(e,t){this.document.selection._setFocus(e,t)}createText(e){return new No(this.document,e)}createAttributeElement(e,t,o={}){const n=new ai(this.document,e,t);return o.priority&&(n._priority=o.priority),o.id&&(n._id=o.id),n}createContainerElement(e,t){return new Bn(this.document,e,t)}createEditableElement(e,t){const o=new Yn(this.document,e,t);return o._document=this.document,o}createEmptyElement(e,t){return new di(this.document,e,t)}createUIElement(e,t,o){const n=new Ci(this.document,e,t);return o&&(n.render=o),n}createRawElement(e,t,o){const n=new Pi(this.document,e,t);return n.render=o||(()=>{}),n}setAttribute(e,t,o){o._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,o){y(e)&&void 0===o&&(o=t),o._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,o){o._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}breakAttributes(e){return e instanceof ei?this._breakAttributes(e):this._breakAttributesRange(e)}breakContainer(e){const t=e.parent;if(!t.is("containerElement"))throw new mo.b("view-writer-break-non-container-element: Trying to break an element which is not a container element.",this.document);if(!t.parent)throw new mo.b("view-writer-break-root: Trying to break root element.",this.document);if(e.isAtStart)return ei._createBefore(t);if(!e.isAtEnd){const o=t._clone(!1);this.insert(ei._createAfter(t),o);const n=new ti(e,ei._createAt(t,"end")),i=new ei(o,0);this.move(n,i)}return ei._createAfter(t)}mergeAttributes(e){const t=e.offset,o=e.parent;if(o.is("$text"))return e;if(o.is("attributeElement")&&0===o.childCount){const e=o.parent,t=o.index;return o._remove(),this._removeFromClonedElementsGroup(o),this.mergeAttributes(new ei(e,t))}const n=o.getChild(t-1),i=o.getChild(t);if(!n||!i)return e;if(n.is("$text")&&i.is("$text"))return Ni(n,i);if(n.is("attributeElement")&&i.is("attributeElement")&&n.isSimilar(i)){const e=n.childCount;return n._appendChild(i.getChildren()),i._remove(),this._removeFromClonedElementsGroup(i),this.mergeAttributes(new ei(n,e))}return e}mergeContainers(e){const t=e.nodeBefore,o=e.nodeAfter;if(!(t&&o&&t.is("containerElement")&&o.is("containerElement")))throw new mo.b("view-writer-merge-containers-invalid-position: Element before and after given position cannot be merged.",this.document);const n=t.getChild(t.childCount-1),i=n instanceof No?ei._createAt(n,"end"):ei._createAt(t,"end");return this.move(ti._createIn(o),ei._createAt(t,"end")),this.remove(ti._createOn(o)),i}insert(e,t){(function e(t,o){for(const n of t){if(!zi.some(e=>n instanceof e))throw new mo.b("view-writer-insert-invalid-node-type: One of the nodes to be inserted is of invalid type.",o);n.is("$text")||e(n.getChildren(),o)}})(t=xo(t)?[...t]:[t],this.document);const o=Ii(e);if(!o)throw new mo.b("view-writer-invalid-position-container: Position's parent container cannot be found.",this.document);const n=this._breakAttributes(e,!0),i=o._insertChild(n.offset,t);for(const e of t)this._addToClonedElementsGroup(e);const r=n.getShiftedBy(i),s=this.mergeAttributes(n);if(0===i)return new ti(s,s);{s.isEqual(n)||r.offset--;const e=this.mergeAttributes(r);return new ti(s,e)}}remove(e){const t=e instanceof ti?e:ti._createOn(e);if(Fi(t,this.document),t.isCollapsed)return new Ei(this.document);const{start:o,end:n}=this._breakAttributesRange(t,!0),i=o.parent,r=n.offset-o.offset,s=i._removeChildren(o.offset,r);for(const e of s)this._removeFromClonedElementsGroup(e);const a=this.mergeAttributes(o);return t.start=a,t.end=a.clone(),new Ei(this.document,s)}clear(e,t){Fi(e,this.document);const o=e.getWalker({direction:"backward",ignoreElementEnd:!0});for(const n of o){const o=n.item;let i;if(o.is("element")&&t.isSimilar(o))i=ti._createOn(o);else if(!n.nextPosition.isAfter(e.start)&&o.is("$textProxy")){const e=o.getAncestors().find(e=>e.is("element")&&t.isSimilar(e));e&&(i=ti._createIn(e))}i&&(i.end.isAfter(e.end)&&(i.end=e.end),i.start.isBefore(e.start)&&(i.start=e.start),this.remove(i))}}move(e,t){let o;if(t.isAfter(e.end)){const n=(t=this._breakAttributes(t,!0)).parent,i=n.childCount;e=this._breakAttributesRange(e,!0),o=this.remove(e),t.offset+=n.childCount-i}else o=this.remove(e);return this.insert(t,o)}wrap(e,t){if(!(t instanceof ai))throw new mo.b("view-writer-wrap-invalid-attribute: DowncastWriter#wrap() must be called with an attribute element.",this.document);if(Fi(e,this.document),e.isCollapsed){let n=e.start;n.parent.is("element")&&(o=n.parent,!Array.from(o.getChildren()).some(e=>!e.is("uiElement")))&&(n=n.getLastMatchingPosition(e=>e.item.is("uiElement"))),n=this._wrapPosition(n,t);const i=this.document.selection;return i.isCollapsed&&i.getFirstPosition().isEqual(e.start)&&this.setSelection(n),new ti(n)}return this._wrapRange(e,t);var o}unwrap(e,t){if(!(t instanceof ai))throw new mo.b("view-writer-unwrap-invalid-attribute: DowncastWriter#unwrap() must be called with an attribute element.",this.document);if(Fi(e,this.document),e.isCollapsed)return e;const{start:o,end:n}=this._breakAttributesRange(e,!0),i=o.parent,r=this._unwrapChildren(i,o.offset,n.offset,t),s=this.mergeAttributes(r.start);s.isEqual(r.start)||r.end.offset--;const a=this.mergeAttributes(r.end);return new ti(s,a)}rename(e,t){const o=new Bn(this.document,e,t.getAttributes());return this.insert(ei._createAfter(t),o),this.move(ti._createIn(t),ei._createAt(o,0)),this.remove(ti._createOn(t)),o}clearClonedElementsGroup(e){this._cloneGroups.delete(e)}createPositionAt(e,t){return ei._createAt(e,t)}createPositionAfter(e){return ei._createAfter(e)}createPositionBefore(e){return ei._createBefore(e)}createRange(e,t){return new ti(e,t)}createRangeOn(e){return ti._createOn(e)}createRangeIn(e){return ti._createIn(e)}createSelection(e,t,o){return new ii(e,t,o)}_wrapChildren(e,t,o,n){let i=t;const r=[];for(;i<o;){const t=e.getChild(i),o=t.is("$text"),s=t.is("attributeElement"),a=t.is("emptyElement"),l=t.is("uiElement"),c=t.is("rawElement");if(s&&this._wrapAttributeElement(n,t))r.push(new ei(e,i));else if(o||a||l||c||s&&Vi(n,t)){const o=n._clone();t._remove(),o._appendChild(t),e._insertChild(i,o),this._addToClonedElementsGroup(o),r.push(new ei(e,i))}else s&&this._wrapChildren(t,0,t.childCount,n);i++}let s=0;for(const e of r){if(e.offset-=s,e.offset==t)continue;this.mergeAttributes(e).isEqual(e)||(s++,o--)}return ti._createFromParentsAndOffsets(e,t,e,o)}_unwrapChildren(e,t,o,n){let i=t;const r=[];for(;i<o;){const t=e.getChild(i);if(t.is("attributeElement"))if(t.isSimilar(n)){const n=t.getChildren(),s=t.childCount;t._remove(),e._insertChild(i,n),this._removeFromClonedElementsGroup(t),r.push(new ei(e,i),new ei(e,i+s)),i+=s,o+=s-1}else this._unwrapAttributeElement(n,t)?(r.push(new ei(e,i),new ei(e,i+1)),i++):(this._unwrapChildren(t,0,t.childCount,n),i++);else i++}let s=0;for(const e of r){if(e.offset-=s,e.offset==t||e.offset==o)continue;this.mergeAttributes(e).isEqual(e)||(s++,o--)}return ti._createFromParentsAndOffsets(e,t,e,o)}_wrapRange(e,t){const{start:o,end:n}=this._breakAttributesRange(e,!0),i=o.parent,r=this._wrapChildren(i,o.offset,n.offset,t),s=this.mergeAttributes(r.start);s.isEqual(r.start)||r.end.offset--;const a=this.mergeAttributes(r.end);return new ti(s,a)}_wrapPosition(e,t){if(t.isSimilar(e.parent))return Oi(e.clone());e.parent.is("$text")&&(e=Mi(e));const o=this.createAttributeElement();o._priority=Number.POSITIVE_INFINITY,o.isSimilar=()=>!1,e.parent._insertChild(e.offset,o);const n=new ti(e,e.getShiftedBy(1));this.wrap(n,t);const i=new ei(o.parent,o.index);o._remove();const r=i.nodeBefore,s=i.nodeAfter;return r instanceof No&&s instanceof No?Ni(r,s):Oi(i)}_wrapAttributeElement(e,t){if(!Di(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const o of e.getAttributeKeys())if("class"!==o&&"style"!==o&&t.hasAttribute(o)&&t.getAttribute(o)!==e.getAttribute(o))return!1;for(const o of e.getStyleNames())if(t.hasStyle(o)&&t.getStyle(o)!==e.getStyle(o))return!1;for(const o of e.getAttributeKeys())"class"!==o&&"style"!==o&&(t.hasAttribute(o)||this.setAttribute(o,e.getAttribute(o),t));for(const o of e.getStyleNames())t.hasStyle(o)||this.setStyle(o,e.getStyle(o),t);for(const o of e.getClassNames())t.hasClass(o)||this.addClass(o,t);return!0}_unwrapAttributeElement(e,t){if(!Di(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const o of e.getAttributeKeys())if("class"!==o&&"style"!==o&&(!t.hasAttribute(o)||t.getAttribute(o)!==e.getAttribute(o)))return!1;if(!t.hasClass(...e.getClassNames()))return!1;for(const o of e.getStyleNames())if(!t.hasStyle(o)||t.getStyle(o)!==e.getStyle(o))return!1;for(const o of e.getAttributeKeys())"class"!==o&&"style"!==o&&this.removeAttribute(o,t);return this.removeClass(Array.from(e.getClassNames()),t),this.removeStyle(Array.from(e.getStyleNames()),t),!0}_breakAttributesRange(e,t=!1){const o=e.start,n=e.end;if(Fi(e,this.document),e.isCollapsed){const o=this._breakAttributes(e.start,t);return new ti(o,o)}const i=this._breakAttributes(n,t),r=i.parent.childCount,s=this._breakAttributes(o,t);return i.offset+=i.parent.childCount-r,new ti(s,i)}_breakAttributes(e,t=!1){const o=e.offset,n=e.parent;if(e.parent.is("emptyElement"))throw new mo.b("view-writer-cannot-break-empty-element: Cannot break an EmptyElement instance.",this.document);if(e.parent.is("uiElement"))throw new mo.b("view-writer-cannot-break-ui-element: Cannot break a UIElement instance.",this.document);if(e.parent.is("rawElement"))throw new mo.b("view-writer-cannot-break-raw-element: Cannot break a RawElement instance.",this.document);if(!t&&n.is("$text")&&Bi(n.parent))return e.clone();if(Bi(n))return e.clone();if(n.is("$text"))return this._breakAttributes(Mi(e),t);if(o==n.childCount){const e=new ei(n.parent,n.index+1);return this._breakAttributes(e,t)}if(0===o){const e=new ei(n.parent,n.index);return this._breakAttributes(e,t)}{const e=n.index+1,i=n._clone();n.parent._insertChild(e,i),this._addToClonedElementsGroup(i);const r=n.childCount-o,s=n._removeChildren(o,r);i._appendChild(s);const a=new ei(n.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 o=this._cloneGroups.get(t);o||(o=new Set,this._cloneGroups.set(t,o)),o.add(e),e._clonesGroup=o}_removeFromClonedElementsGroup(e){if(e.is("element"))for(const t of e.getChildren())this._removeFromClonedElementsGroup(t);const t=e.id;if(!t)return;const o=this._cloneGroups.get(t);o&&o.delete(e)}}function Ii(e){let t=e.parent;for(;!Bi(t);){if(!t)return;t=t.parent}return t}function Vi(e,t){return e.priority<t.priority||!(e.priority>t.priority)&&e.getIdentity()<t.getIdentity()}function Oi(e){const t=e.nodeBefore;if(t&&t.is("$text"))return new ei(t,t.data.length);const o=e.nodeAfter;return o&&o.is("$text")?new ei(o,0):e}function Mi(e){if(e.offset==e.parent.data.length)return new ei(e.parent.parent,e.parent.index+1);if(0===e.offset)return new ei(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 No(e.root.document,t)),new ei(e.parent.parent,e.parent.index+1)}function Ni(e,t){const o=e.data.length;return e._data+=t.data,t._remove(),new ei(e,o)}const zi=[No,ai,Bn,di,Pi,Ci];function Bi(e){return e&&(e.is("containerElement")||e.is("documentFragment"))}function Fi(e,t){const o=Ii(e.start),n=Ii(e.end);if(!o||!n||o!==n)throw new mo.b("view-writer-invalid-range-container: The container of the given range is invalid.",t)}function Di(e,t){return null===e.id&&null===t.id}function Li(e){return"[object Text]"==Object.prototype.toString.call(e)}const Hi=e=>e.createTextNode(" "),ji=e=>{const t=e.createElement("br");return t.dataset.ckeFiller=!0,t},Wi=(()=>{let e="";for(let t=0;t<7;t++)e+="";return e})();function qi(e){return Li(e)&&e.data.substr(0,7)===Wi}function $i(e){return 7==e.data.length&&qi(e)}function Ui(e){return qi(e)?e.data.slice(7):e.data}function Gi(e,t){if(t.keyCode==pi.arrowleft){const e=t.domTarget.ownerDocument.defaultView.getSelection();if(1==e.rangeCount&&e.getRangeAt(0).collapsed){const t=e.getRangeAt(0).startContainer,o=e.getRangeAt(0).startOffset;qi(t)&&o<=7&&e.collapse(t,0)}}}function Ki(e,t,o,n=!1){o=o||function(e,t){return e===t},Array.isArray(e)||(e=Array.prototype.slice.call(e)),Array.isArray(t)||(t=Array.prototype.slice.call(t));const i=function(e,t,o){const n=Ji(e,t,o);if(-1===n)return{firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};const i=Yi(e,n),r=Yi(t,n),s=Ji(i,r,o),a=e.length-s,l=t.length-s;return{firstIndex:n,lastIndexOld:a,lastIndexNew:l}}(e,t,o);return n?function(e,t){const{firstIndex:o,lastIndexOld:n,lastIndexNew:i}=e;if(-1===o)return Array(t).fill("equal");let r=[];o>0&&(r=r.concat(Array(o).fill("equal")));i-o>0&&(r=r.concat(Array(i-o).fill("insert")));n-o>0&&(r=r.concat(Array(n-o).fill("delete")));i<t&&(r=r.concat(Array(t-i).fill("equal")));return r}(i,t.length):function(e,t){const o=[],{firstIndex:n,lastIndexOld:i,lastIndexNew:r}=t;r-n>0&&o.push({index:n,type:"insert",values:e.slice(n,r)});i-n>0&&o.push({index:n+(r-n),type:"delete",howMany:i-n});return o}(t,i)}function Ji(e,t,o){for(let n=0;n<Math.max(e.length,t.length);n++)if(void 0===e[n]||void 0===t[n]||!o(e[n],t[n]))return n;return-1}function Yi(e,t){return e.slice(t).reverse()}function Qi(e,t,o){o=o||function(e,t){return e===t};const n=e.length,i=t.length;if(n>200||i>200||n+i>300)return Qi.fastDiff(e,t,o,!0);let r,s;if(i<n){const o=e;e=t,t=o,r="delete",s="insert"}else r="insert",s="delete";const a=e.length,l=t.length,c=l-a,d={},h={};function u(n){const i=(void 0!==h[n-1]?h[n-1]:-1)+1,c=void 0!==h[n+1]?h[n+1]:-1,u=i>c?-1:1;d[n+u]&&(d[n]=d[n+u].slice(0)),d[n]||(d[n]=[]),d[n].push(i>c?r:s);let m=Math.max(i,c),g=m-n;for(;g<a&&m<l&&o(e[g],t[m]);)g++,m++,d[n].push("equal");return m}let m,g=0;do{for(m=-g;m<c;m++)h[m]=u(m);for(m=c+g;m>c;m--)h[m]=u(m);h[c]=u(c),g++}while(h[c]!==l);return d[c].slice(1)}function Xi(e,t,o){e.insertBefore(o,e.childNodes[t]||null)}function Zi(e){const t=e.parentNode;t&&t.removeChild(e)}function er(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}Qi.fastDiff=Ki;class tr{constructor(e,t){this.domDocuments=new Set,this.domConverter=e,this.markedAttributes=new Set,this.markedChildren=new Set,this.markedTexts=new Set,this.selection=t,this.isFocused=!1,this._inlineFiller=null,this._fakeSelectionContainer=null}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 mo.b("view-renderer-unknown-type: Unknown type passed to Renderer.markToSync.",this);this.markedChildren.add(t)}}}render(){let e;for(const e of this.markedChildren)this._updateChildrenMappings(e);this._inlineFiller&&!this._isSelectionInInlineFiller()&&this._removeInlineFiller(),this._inlineFiller?e=this._getInlineFillerPosition():this._needsInlineFillerAtSelection()&&(e=this.selection.getFirstPosition(),this.markedChildren.add(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(e){const t=this.domConverter.viewPositionToDom(e),o=t.parent.ownerDocument;qi(t.parent)?this._inlineFiller=t.parent:this._inlineFiller=or(o,t.parent,t.offset)}else this._inlineFiller=null;this._updateSelection(),this._updateFocus(),this.markedTexts.clear(),this.markedAttributes.clear(),this.markedChildren.clear()}_updateChildrenMappings(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const o=this.domConverter.mapViewToDom(e).childNodes,n=Array.from(this.domConverter.viewChildrenToDom(e,t.ownerDocument,{withChildren:!1})),i=this._diffNodeLists(o,n),r=this._findReplaceActions(i,o,n);if(-1!==r.indexOf("replace")){const t={equal:0,insert:0,delete:0};for(const i of r)if("replace"===i){const i=t.equal+t.insert,r=t.equal+t.delete,s=e.getChild(i);!s||s.is("uiElement")||s.is("rawElement")||this._updateElementMappings(s,o[r]),Zi(n[i]),t.equal++}else t[i]++}}_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")?ei._createBefore(this.selection.getFirstPosition().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&&Li(t.parent)&&qi(t.parent))}_removeInlineFiller(){const e=this._inlineFiller;if(!qi(e))throw new mo.b("view-renderer-filler-was-lost: The inline filler node was lost.",this);$i(e)?e.parentNode.removeChild(e):e.data=e.data.substr(7),this._inlineFiller=null}_needsInlineFillerAtSelection(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=e.parent,o=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;if(o===t.getFillerOffset())return!1;const n=e.nodeBefore,i=e.nodeAfter;return!(n instanceof No||i instanceof No)}_updateText(e,t){const o=this.domConverter.findCorrespondingDomText(e),n=this.domConverter.viewToDom(e,o.ownerDocument),i=o.data;let r=n.data;const s=t.inlineFillerPosition;if(s&&s.parent==e.parent&&s.offset==e.index&&(r=Wi+r),i!=r){const e=Ki(i,r);for(const t of e)"insert"===t.type?o.insertData(t.index,t.values.join("")):o.deleteData(t.index,t.howMany)}}_updateAttrs(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const o=Array.from(t.attributes).map(e=>e.name),n=e.getAttributeKeys();for(const o of n)t.setAttribute(o,e.getAttribute(o));for(const n of o)e.hasAttribute(n)||t.removeAttribute(n)}_updateChildren(e,t){const o=this.domConverter.mapViewToDom(e);if(!o)return;const n=t.inlineFillerPosition,i=this.domConverter.mapViewToDom(e).childNodes,r=Array.from(this.domConverter.viewChildrenToDom(e,o.ownerDocument,{bind:!0,inlineFillerPosition:n}));n&&n.parent===e&&or(o.ownerDocument,r,n.offset);const s=this._diffNodeLists(i,r);let a=0;const l=new Set;for(const e of s)"delete"===e?(l.add(i[a]),Zi(i[a])):"equal"===e&&a++;a=0;for(const e of s)"insert"===e?(Xi(o,a,r[a]),a++):"equal"===e&&(this._markDescendantTextToSync(this.domConverter.domToView(r[a])),a++);for(const e of l)e.parentNode||this.domConverter.unbindDomElement(e)}_diffNodeLists(e,t){return Qi(e=function(e,t){const o=Array.from(e);if(0==o.length||!t)return o;o[o.length-1]==t&&o.pop();return o}(e,this._fakeSelectionContainer),t,ir.bind(null,this.domConverter))}_findReplaceActions(e,t,o){if(-1===e.indexOf("insert")||-1===e.indexOf("delete"))return e;let n=[],i=[],r=[];const s={equal:0,insert:0,delete:0};for(const a of e)"insert"===a?r.push(o[s.equal+s.insert]):"delete"===a?i.push(t[s.equal+s.delete]):(n=n.concat(Qi(i,r,nr).map(e=>"equal"===e?"replace":e)),n.push("equal"),i=[],r=[]),s[a]++;return n.concat(Qi(i,r,nr).map(e=>"equal"===e?"replace":e))}_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(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._removeFakeSelection(),this._updateDomSelection(e)))}_updateFakeSelection(e){const t=e.ownerDocument;this._fakeSelectionContainer||(this._fakeSelectionContainer=function(e){const t=e.createElement("div");return Object.assign(t.style,{position:"fixed",top:0,left:"-9999px",width:"42px"}),t.textContent=" ",t}(t));const o=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(o,this.selection),!this._fakeSelectionNeedsUpdate(e))return;o.parentElement&&o.parentElement==e||e.appendChild(o),o.textContent=this.selection.fakeSelectionLabel||" ";const n=t.getSelection(),i=t.createRange();n.removeAllRanges(),i.selectNodeContents(o),n.addRange(i)}_updateDomSelection(e){const t=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(t))return;const o=this.domConverter.viewPositionToDom(this.selection.anchor),n=this.domConverter.viewPositionToDom(this.selection.focus);e.focus(),t.collapse(o.parent,o.offset),t.extend(n.parent,n.offset),mi.isGecko&&function(e,t){const o=e.parent;if(o.nodeType!=Node.ELEMENT_NODE||e.offset!=o.childNodes.length-1)return;const n=o.childNodes[e.offset];n&&"BR"==n.tagName&&t.addRange(t.getRangeAt(0))}(n,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,o=e.ownerDocument.getSelection();return!t||t.parentElement!==e||(o.anchorNode!==t&&!t.contains(o.anchorNode)||t.textContent!==this.selection.fakeSelectionLabel)}_removeDomSelection(){for(const e of this.domDocuments){if(e.getSelection().rangeCount){const t=e.activeElement,o=this.domConverter.mapDomToView(t);t&&o&&e.getSelection().removeAllRanges()}}}_removeFakeSelection(){const e=this._fakeSelectionContainer;e&&e.remove()}_updateFocus(){if(this.isFocused){const e=this.selection.editableElement;e&&this.domConverter.focus(e)}}}function or(e,t,o){const n=t instanceof Array?t:t.childNodes,i=n[o];if(Li(i))return i.data=Wi+i.data,i;{const i=e.createTextNode(Wi);return Array.isArray(t)?n.splice(o,0,i):Xi(t,o,i),i}}function nr(e,t){return er(e)&&er(t)&&!Li(e)&&!Li(t)&&e.nodeType!==Node.COMMENT_NODE&&t.nodeType!==Node.COMMENT_NODE&&e.tagName.toLowerCase()===t.tagName.toLowerCase()}function ir(e,t,o){return t===o||(Li(t)&&Li(o)?t.data===o.data:!(!e.isBlockFiller(t)||!e.isBlockFiller(o)))}Co(tr,qn);var rr={window:window,document:document};function sr(e){let t=0;for(;e.previousSibling;)e=e.previousSibling,t++;return t}function ar(e){const t=[];for(;e&&e.nodeType!=Node.DOCUMENT_NODE;)t.unshift(e),e=e.parentNode;return t}const lr=ji(document);class cr{constructor(e,t={}){this.document=e,this.blockFillerMode=t.blockFillerMode||"br",this.preElements=["pre"],this.blockElements=["p","div","h1","h2","h3","h4","h5","h6","li","dd","dt","figcaption","td","th"],this._blockFiller="br"==this.blockFillerMode?ji:Hi,this._domToViewMapping=new WeakMap,this._viewToDomMapping=new WeakMap,this._fakeSelectionMapping=new WeakMap}bindFakeSelection(e,t){this._fakeSelectionMapping.set(e,new ii(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 e.childNodes)this.unbindDomElement(t)}}bindDocumentFragments(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}viewToDom(e,t,o={}){if(e.is("$text")){const o=this._processDataFromViewText(e);return t.createTextNode(o)}{if(this.mapViewToDom(e))return this.mapViewToDom(e);let n;if(e.is("documentFragment"))n=t.createDocumentFragment(),o.bind&&this.bindDocumentFragments(n,e);else{if(e.is("uiElement"))return n=e.render(t),o.bind&&this.bindElements(n,e),n;n=e.hasAttribute("xmlns")?t.createElementNS(e.getAttribute("xmlns"),e.name):t.createElement(e.name),e.is("rawElement")&&e.render(n),o.bind&&this.bindElements(n,e);for(const t of e.getAttributeKeys())n.setAttribute(t,e.getAttribute(t))}if(o.withChildren||void 0===o.withChildren)for(const i of this.viewChildrenToDom(e,t,o))n.appendChild(i);return n}}*viewChildrenToDom(e,t,o={}){const n=e.getFillerOffset&&e.getFillerOffset();let i=0;for(const r of e.getChildren())n===i&&(yield this._blockFiller(t)),yield this.viewToDom(r,t,o),i++;n===i&&(yield this._blockFiller(t))}viewRangeToDom(e){const t=this.viewPositionToDom(e.start),o=this.viewPositionToDom(e.end),n=document.createRange();return n.setStart(t.parent,t.offset),n.setEnd(o.parent,o.offset),n}viewPositionToDom(e){const t=e.parent;if(t.is("$text")){const o=this.findCorrespondingDomText(t);if(!o)return null;let n=e.offset;return qi(o)&&(n+=7),{parent:o,offset:n}}{let o,n,i;if(0===e.offset){if(o=this.mapViewToDom(t),!o)return null;i=o.childNodes[0]}else{const t=e.nodeBefore;if(n=t.is("$text")?this.findCorrespondingDomText(t):this.mapViewToDom(e.nodeBefore),!n)return null;o=n.parentNode,i=n.nextSibling}if(Li(i)&&qi(i))return{parent:i,offset:7};return{parent:o,offset:n?sr(n)+1:0}}}domToView(e,t={}){if(this.isBlockFiller(e,this.blockFillerMode))return null;const o=this.getHostViewElement(e,this._domToViewMapping);if(o)return o;if(Li(e)){if($i(e))return null;{const t=this._processDataFromDomText(e);return""===t?null:new No(this.document,t)}}if(this.isComment(e))return null;{if(this.mapDomToView(e))return this.mapDomToView(e);let o;if(this.isDocumentFragment(e))o=new Ei(this.document),t.bind&&this.bindDocumentFragments(e,o);else{const n=t.keepOriginalCase?e.tagName:e.tagName.toLowerCase();o=new Nn(this.document,n),t.bind&&this.bindElements(e,o);const i=e.attributes;for(let e=i.length-1;e>=0;e--)o._setAttribute(i[e].name,i[e].value)}if(t.withChildren||void 0===t.withChildren)for(const n of this.domChildrenToView(e,t))o._appendChild(n);return o}}*domChildrenToView(e,t={}){for(let o=0;o<e.childNodes.length;o++){const n=e.childNodes[o],i=this.domToView(n,t);null!==i&&(yield i)}}domSelectionToView(e){if(1===e.rangeCount){let t=e.getRangeAt(0).startContainer;Li(t)&&(t=t.parentNode);const o=this.fakeSelectionToView(t);if(o)return o}const t=this.isDomSelectionBackward(e),o=[];for(let t=0;t<e.rangeCount;t++){const n=e.getRangeAt(t),i=this.domRangeToView(n);i&&o.push(i)}return new ii(o,{backward:t})}domRangeToView(e){const t=this.domPositionToView(e.startContainer,e.startOffset),o=this.domPositionToView(e.endContainer,e.endOffset);return t&&o?new ti(t,o):null}domPositionToView(e,t){if(this.isBlockFiller(e,this.blockFillerMode))return this.domPositionToView(e.parentNode,sr(e));const o=this.mapDomToView(e);if(o&&(o.is("uiElement")||o.is("rawElement")))return ei._createBefore(o);if(Li(e)){if($i(e))return this.domPositionToView(e.parentNode,sr(e));const o=this.findCorrespondingViewText(e);let n=t;return o?(qi(e)&&(n-=7,n=n<0?0:n),new ei(o,n)):null}if(0===t){const t=this.mapDomToView(e);if(t)return new ei(t,0)}else{const o=e.childNodes[t-1],n=Li(o)?this.findCorrespondingViewText(o):this.mapDomToView(o);if(n&&n.parent)return new ei(n.parent,n.index+1)}return null}mapDomToView(e){return this.getHostViewElement(e)||this._domToViewMapping.get(e)}findCorrespondingViewText(e){if($i(e))return null;const t=this.getHostViewElement(e);if(t)return t;const o=e.previousSibling;if(o){if(!this.isElement(o))return null;const e=this.mapDomToView(o);if(e){return e.nextSibling instanceof No?e.nextSibling:null}}else{const t=this.mapDomToView(e.parentNode);if(t){const e=t.getChild(0);return e instanceof No?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:o}=rr.window,n=[];hr(t,e=>{const{scrollLeft:t,scrollTop:o}=e;n.push([t,o])}),t.focus(),hr(t,e=>{const[t,o]=n.shift();e.scrollLeft=t,e.scrollTop=o}),rr.window.scrollTo(e,o)}}isElement(e){return e&&e.nodeType==Node.ELEMENT_NODE}isDocumentFragment(e){return e&&e.nodeType==Node.DOCUMENT_FRAGMENT_NODE}isComment(e){return e&&e.nodeType==Node.COMMENT_NODE}isBlockFiller(e){return"br"==this.blockFillerMode?e.isEqualNode(lr):!("BR"!==e.tagName||!ur(e,this.blockElements)||1!==e.parentNode.childNodes.length)||function(e,t){return Li(e)&&" "==e.data&&ur(e,t)&&1===e.parentNode.childNodes.length}(e,this.blockElements)}isDomSelectionBackward(e){if(e.isCollapsed)return!1;const t=document.createRange();t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset);const o=t.collapsed;return t.detach(),o}getHostViewElement(e){const t=ar(e);for(t.pop();t.length;){const e=t.pop(),o=this._domToViewMapping.get(e);if(o&&(o.is("uiElement")||o.is("rawElement")))return o}return null}isDomSelectionCorrect(e){return this._isDomSelectionPositionCorrect(e.anchorNode,e.anchorOffset)&&this._isDomSelectionPositionCorrect(e.focusNode,e.focusOffset)}_isDomSelectionPositionCorrect(e,t){if(Li(e)&&qi(e)&&t<7)return!1;if(this.isElement(e)&&qi(e.childNodes[t]))return!1;const o=this.mapDomToView(e);return!o||!o.is("uiElement")&&!o.is("rawElement")}_processDataFromViewText(e){let t=e.data;if(e.getAncestors().some(e=>this.preElements.includes(e.name)))return t;if(" "==t.charAt(0)){const o=this._getTouchingViewTextNode(e,!1);!(o&&this._nodeEndsWithSpace(o))&&o||(t=" "+t.substr(1))}if(" "==t.charAt(t.length-1)){const o=this._getTouchingViewTextNode(e,!0);" "!=t.charAt(t.length-2)&&o&&" "!=o.data.charAt(0)||(t=t.substr(0,t.length-1)+" ")}return t.replace(/ {2}/g,"  ")}_nodeEndsWithSpace(e){if(e.getAncestors().some(e=>this.preElements.includes(e.name)))return!1;const t=this._processDataFromViewText(e);return" "==t.charAt(t.length-1)}_processDataFromDomText(e){let t=e.data;if(dr(e,this.preElements))return Ui(e);t=t.replace(/[ \n\t\r]{1,}/g," ");const o=this._getTouchingInlineDomNode(e,!1),n=this._getTouchingInlineDomNode(e,!0),i=this._checkShouldLeftTrimDomText(o),r=this._checkShouldRightTrimDomText(e,n);return i&&(t=t.replace(/^ /,"")),r&&(t=t.replace(/ $/,"")),t=Ui(new Text(t)),t=t.replace(/ \u00A0/g," "),(/( |\u00A0)\u00A0$/.test(t)||!n||n.data&&" "==n.data.charAt(0))&&(t=t.replace(/\u00A0$/," ")),i&&(t=t.replace(/^\u00A0/," ")),t}_checkShouldLeftTrimDomText(e){return!e||(!!no(e)||/[^\S\u00A0]/.test(e.data.charAt(e.data.length-1)))}_checkShouldRightTrimDomText(e,t){return!t&&!qi(e)}_getTouchingViewTextNode(e,t){const o=new Zn({startPosition:t?ei._createAfter(e):ei._createBefore(e),direction:t?"forward":"backward"});for(const e of o){if(e.item.is("containerElement"))return null;if(e.item.is("element","br"))return null;if(e.item.is("$textProxy"))return e.item}return null}_getTouchingInlineDomNode(e,t){if(!e.parentNode)return null;const o=t?"nextNode":"previousNode",n=e.ownerDocument,i=ar(e)[0],r=n.createTreeWalker(i,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT,{acceptNode:e=>Li(e)||"BR"==e.tagName?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});r.currentNode=e;const s=r[o]();if(null!==s){const t=function(e,t){const o=ar(e),n=ar(t);let i=0;for(;o[i]==n[i]&&o[i];)i++;return 0===i?null:o[i-1]}(e,s);if(t&&!dr(e,this.blockElements,t)&&!dr(s,this.blockElements,t))return s}return null}}function dr(e,t,o){let n=ar(e);return o&&(n=n.slice(n.indexOf(o)+1)),n.some(e=>e.tagName&&t.includes(e.tagName.toLowerCase()))}function hr(e,t){for(;e&&e!=rr.document;)t(e),e=e.parentNode}function ur(e,t){const o=e.parentNode;return o&&o.tagName&&t.includes(o.tagName.toLowerCase())}function mr(e){const t=Object.prototype.toString.apply(e);return"[object Window]"==t||"[object global]"==t}var gr=Dn({},po,{listenTo(e,...t){if(er(e)||mr(e)){const o=this._getProxyEmitter(e)||new fr(e);o.attach(...t),e=o}po.listenTo.call(this,e,...t)},stopListening(e,t,o){if(er(e)||mr(e)){const t=this._getProxyEmitter(e);if(!t)return;e=t}po.stopListening.call(this,e,t,o),e instanceof fr&&e.detach(t)},_getProxyEmitter(e){return t=this,o=pr(e),t[go]&&t[go][o]?t[go][o].emitter:null;var t,o}});class fr{constructor(e){bo(this,pr(e)),this._domNode=e}}function pr(e){return e["data-ck-expando"]||(e["data-ck-expando"]=ho())}Dn(fr.prototype,po,{attach(e,t,o={}){if(this._domListeners&&this._domListeners[e])return;const n={capture:!!o.useCapture,passive:!!o.usePassive},i=this._createDomListener(e,n);this._domNode.addEventListener(e,i,n),this._domListeners||(this._domListeners={}),this._domListeners[e]=i},detach(e){let t;!this._domListeners[e]||(t=this._events[e])&&t.callbacks.length||this._domListeners[e].removeListener()},_createDomListener(e,t){const o=t=>{this.fire(e,t)};return o.removeListener=()=>{this._domNode.removeEventListener(e,o,t),delete this._domListeners[e]},o}});class br{constructor(e){this.view=e,this.document=e.document,this.isEnabled=!1}enable(){this.isEnabled=!0}disable(){this.isEnabled=!1}destroy(){this.disable(),this.stopListening()}}Co(br,gr);var wr=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};var kr=function(e){return this.__data__.has(e)};function _r(e){var t=-1,o=null==e?0:e.length;for(this.__data__=new _e;++t<o;)this.add(e[t])}_r.prototype.add=_r.prototype.push=wr,_r.prototype.has=kr;var vr=_r;var yr=function(e,t){for(var o=-1,n=null==e?0:e.length;++o<n;)if(t(e[o],o,e))return!0;return!1};var xr=function(e,t){return e.has(t)};var Cr=function(e,t,o,n,i,r){var s=1&o,a=e.length,l=t.length;if(a!=l&&!(s&&l>a))return!1;var c=r.get(e);if(c&&r.get(t))return c==t;var d=-1,h=!0,u=2&o?new vr:void 0;for(r.set(e,t),r.set(t,e);++d<a;){var m=e[d],g=t[d];if(n)var f=s?n(g,m,d,t,e,r):n(m,g,d,e,t,r);if(void 0!==f){if(f)continue;h=!1;break}if(u){if(!yr(t,(function(e,t){if(!xr(u,t)&&(m===e||i(m,e,o,n,r)))return u.push(t)}))){h=!1;break}}else if(m!==g&&!i(m,g,o,n,r)){h=!1;break}}return r.delete(e),r.delete(t),h};var Ar=function(e){var t=-1,o=Array(e.size);return e.forEach((function(e,n){o[++t]=[n,e]})),o};var Tr=function(e){var t=-1,o=Array(e.size);return e.forEach((function(e){o[++t]=e})),o},Pr=i?i.prototype:void 0,Sr=Pr?Pr.valueOf:void 0;var Er=function(e,t,o,n,i,r,s){switch(o){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||!r(new Nt(e),new Nt(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return C(+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=Ar;case"[object Set]":var l=1&n;if(a||(a=Tr),e.size!=t.size&&!l)return!1;var c=s.get(e);if(c)return c==t;n|=2,s.set(e,t);var d=Cr(a(e),a(t),n,i,r,s);return s.delete(e),d;case"[object Symbol]":if(Sr)return Sr.call(e)==Sr.call(t)}return!1},Rr=Object.prototype.hasOwnProperty;var Ir=function(e,t,o,n,i,r){var s=1&o,a=_t(e),l=a.length;if(l!=_t(t).length&&!s)return!1;for(var c=l;c--;){var d=a[c];if(!(s?d in t:Rr.call(t,d)))return!1}var h=r.get(e);if(h&&r.get(t))return h==t;var u=!0;r.set(e,t),r.set(t,e);for(var m=s;++c<l;){var g=e[d=a[c]],f=t[d];if(n)var p=s?n(f,g,d,t,e,r):n(g,f,d,e,t,r);if(!(void 0===p?g===f||i(g,f,o,n,r):p)){u=!1;break}m||(m="constructor"==d)}if(u&&!m){var b=e.constructor,w=t.constructor;b==w||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof w&&w instanceof w||(u=!1)}return r.delete(e),r.delete(t),u},Vr=Object.prototype.hasOwnProperty;var Or=function(e,t,o,n,i,r){var s=ze(e),a=ze(t),l=s?"[object Array]":Vt(e),c=a?"[object Array]":Vt(t),d="[object Object]"==(l="[object Arguments]"==l?"[object Object]":l),h="[object Object]"==(c="[object Arguments]"==c?"[object Object]":c),u=l==c;if(u&&Object(Be.a)(e)){if(!Object(Be.a)(t))return!1;s=!0,d=!1}if(u&&!d)return r||(r=new xe),s||Ue(e)?Cr(e,t,o,n,i,r):Er(e,t,l,o,n,i,r);if(!(1&o)){var m=d&&Vr.call(e,"__wrapped__"),g=h&&Vr.call(t,"__wrapped__");if(m||g){var f=m?e.value():e,p=g?t.value():t;return r||(r=new xe),i(f,p,o,n,r)}}return!!u&&(r||(r=new xe),Ir(e,t,o,n,i,r))};var Mr=function e(t,o,n,i,r){return t===o||(null==t||null==o||!p(t)&&!p(o)?t!=t&&o!=o:Or(t,o,n,i,e,r))};var Nr=function(e,t,o){var n=(o="function"==typeof o?o:void 0)?o(e,t):void 0;return void 0===n?Mr(e,t,void 0,o):!!n};class zr extends br{constructor(e){super(e),this._config={childList:!0,characterData:!0,characterDataOldValue:!0,subtree:!0},this.domConverter=e.domConverter,this.renderer=e._renderer,this._domElements=[],this._mutationObserver=new window.MutationObserver(this._onMutations.bind(this))}flush(){this._onMutations(this._mutationObserver.takeRecords())}observe(e){this._domElements.push(e),this.isEnabled&&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,o=new Map,n=new Set;for(const o of e)if("childList"===o.type){const e=t.mapDomToView(o.target);if(e&&(e.is("uiElement")||e.is("rawElement")))continue;e&&!this._isBogusBrMutation(o)&&n.add(e)}for(const i of e){const e=t.mapDomToView(i.target);if((!e||!e.is("uiElement")&&!e.is("rawElement"))&&"characterData"===i.type){const e=t.findCorrespondingViewText(i.target);e&&!n.has(e.parent)?o.set(e,{type:"text",oldText:e.data,newText:Ui(i.target),node:e}):!e&&qi(i.target)&&n.add(t.mapDomToView(i.target.parentNode))}}const i=[];for(const e of o.values())this.renderer.markToSync("text",e.node),i.push(e);for(const e of n){const o=t.mapViewToDom(e),n=Array.from(e.getChildren()),r=Array.from(t.domChildrenToView(o,{withChildren:!1}));Nr(n,r,a)||(this.renderer.markToSync("children",e),i.push({type:"children",oldChildren:n,newChildren:r,node:e}))}const r=e[0].target.ownerDocument.getSelection();let s=null;if(r&&r.anchorNode){const e=t.domPositionToView(r.anchorNode,r.anchorOffset),o=t.domPositionToView(r.focusNode,r.focusOffset);e&&o&&(s=new ii(e),s.setFocus(o))}function a(e,t){if(!Array.isArray(e))return e===t||!(!e.is("$text")||!t.is("$text"))&&e.data===t.data}i.length&&(this.document.fire("mutations",i,s),this.view.forceRender())}_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")}}class Br{constructor(e,t,o){this.view=e,this.document=e.document,this.domEvent=t,this.domTarget=t.target,Dn(this,o)}get target(){return this.view.domConverter.mapDomToView(this.domTarget)}preventDefault(){this.domEvent.preventDefault()}stopPropagation(){this.domEvent.stopPropagation()}}class Fr extends br{constructor(e){super(e),this.useCapture=!1}observe(e){("string"==typeof this.domEventType?[this.domEventType]:this.domEventType).forEach(t=>{this.listenTo(e,t,(e,t)=>{this.isEnabled&&this.onDomEvent(t)},{useCapture:this.useCapture})})}fire(e,t,o){this.isEnabled&&this.document.fire(e,new Br(this.view,t,o))}}class Dr extends Fr{constructor(e){super(e),this.domEventType=["keydown","keyup"]}onDomEvent(e){this.fire(e.type,e,{keyCode:e.keyCode,altKey:e.altKey,ctrlKey:e.ctrlKey||e.metaKey,shiftKey:e.shiftKey,get keystroke(){return bi(this)}})}}var Lr=function(){return n.a.Date.now()},Hr=/^\s+|\s+$/g,jr=/^[-+]0x[0-9a-f]+$/i,Wr=/^0b[01]+$/i,qr=/^0o[0-7]+$/i,$r=parseInt;var Ur=function(e){if("number"==typeof e)return e;if(Lo(e))return NaN;if(B(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=B(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Hr,"");var o=Wr.test(e);return o||qr.test(e)?$r(e.slice(2),o?2:8):jr.test(e)?NaN:+e},Gr=Math.max,Kr=Math.min;var Jr=function(e,t,o){var n,i,r,s,a,l,c=0,d=!1,h=!1,u=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function m(t){var o=n,r=i;return n=i=void 0,c=t,s=e.apply(r,o)}function g(e){return c=e,a=setTimeout(p,t),d?m(e):s}function f(e){var o=e-l;return void 0===l||o>=t||o<0||h&&e-c>=r}function p(){var e=Lr();if(f(e))return b(e);a=setTimeout(p,function(e){var o=t-(e-l);return h?Kr(o,r-(e-c)):o}(e))}function b(e){return a=void 0,u&&n?m(e):(n=i=void 0,s)}function w(){var e=Lr(),o=f(e);if(n=arguments,i=this,l=e,o){if(void 0===a)return g(l);if(h)return clearTimeout(a),a=setTimeout(p,t),m(l)}return void 0===a&&(a=setTimeout(p,t)),s}return t=Ur(t)||0,B(o)&&(d=!!o.leading,r=(h="maxWait"in o)?Gr(Ur(o.maxWait)||0,t):r,u="trailing"in o?!!o.trailing:u),w.cancel=function(){void 0!==a&&clearTimeout(a),c=0,n=l=i=a=void 0},w.flush=function(){return void 0===a?s:b(Lr())},w};class Yr extends br{constructor(e){super(e),this._fireSelectionChangeDoneDebounced=Jr(e=>this.document.fire("selectionChangeDone",e),200)}observe(){const e=this.document;e.on("keydown",(t,o)=>{var n;e.selection.isFake&&((n=o.keyCode)==pi.arrowright||n==pi.arrowleft||n==pi.arrowup||n==pi.arrowdown)&&this.isEnabled&&(o.preventDefault(),this._handleSelectionMove(o.keyCode))},{priority:"lowest"})}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(e){const t=this.document.selection,o=new ii(t.getRanges(),{backward:t.isBackward,fake:!1});e!=pi.arrowleft&&e!=pi.arrowup||o.setTo(o.getFirstPosition()),e!=pi.arrowright&&e!=pi.arrowdown||o.setTo(o.getLastPosition());const n={oldSelection:t,newSelection:o,domSelection:null};this.document.fire("selectionChange",n),this._fireSelectionChangeDoneDebounced(n)}}class Qr extends br{constructor(e){super(e),this.mutationObserver=e.getObserver(zr),this.selection=this.document.selection,this.domConverter=e.domConverter,this._documents=new WeakSet,this._fireSelectionChangeDoneDebounced=Jr(e=>this.document.fire("selectionChangeDone",e),200),this._clearInfiniteLoopInterval=setInterval(()=>this._clearInfiniteLoop(),1e3),this._loopbackCounter=0}observe(e){const t=e.ownerDocument;this._documents.has(t)||(this.listenTo(t,"selectionchange",()=>{this._handleSelectionChange(t)}),this._documents.add(t))}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionChange(e){if(!this.isEnabled)return;this.mutationObserver.flush();const t=e.defaultView.getSelection(),o=this.domConverter.domSelectionToView(t);if(0!=o.rangeCount){if(this.view.hasDomSelection=!0,!(this.selection.isEqual(o)&&this.domConverter.isDomSelectionCorrect(t)||++this._loopbackCounter>60))if(this.selection.isSimilar(o))this.view.forceRender();else{const e={oldSelection:this.selection,newSelection:o,domSelection:t};this.document.fire("selectionChange",e),this._fireSelectionChangeDoneDebounced(e)}}else this.view.hasDomSelection=!1}_clearInfiniteLoop(){this._loopbackCounter=0}}class Xr extends Fr{constructor(e){super(e),this.domEventType=["focus","blur"],this.useCapture=!0;const t=this.document;t.on("focus",()=>{t.isFocused=!0,this._renderTimeoutId=setTimeout(()=>e.forceRender(),50)}),t.on("blur",(o,n)=>{const i=t.selection.editableElement;null!==i&&i!==n.target||(t.isFocused=!1,e.forceRender())})}onDomEvent(e){this.fire(e.type,e)}destroy(){this._renderTimeoutId&&clearTimeout(this._renderTimeoutId),super.destroy()}}class Zr extends Fr{constructor(e){super(e),this.domEventType=["compositionstart","compositionupdate","compositionend"];const t=this.document;t.on("compositionstart",()=>{t.isComposing=!0}),t.on("compositionend",()=>{t.isComposing=!1})}onDomEvent(e){this.fire(e.type,e)}}class es extends Fr{constructor(e){super(e),this.domEventType=["beforeinput"]}onDomEvent(e){this.fire(e.type,e)}}function ts(e){return"[object Range]"==Object.prototype.toString.apply(e)}function os(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)}}const ns=["top","right","bottom","left","width","height"];class is{constructor(e){const t=ts(e);if(Object.defineProperty(this,"_source",{value:e._source||e,writable:!0,enumerable:!1}),no(e)||t)if(t){const t=is.getDomRangeRects(e);rs(this,is.getBoundingRect(t))}else rs(this,e.getBoundingClientRect());else if(mr(e)){const{innerWidth:t,innerHeight:o}=e;rs(this,{top:0,right:t,bottom:o,left:0,width:t,height:o})}else rs(this,e)}clone(){return new is(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)};return t.width=t.right-t.left,t.height=t.bottom-t.top,t.width<0||t.height<0?null:new is(t)}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(!ss(e)){let o=e.parentNode||e.commonAncestorContainer;for(;o&&!ss(o);){const e=new is(o),n=t.getIntersection(e);if(!n)return null;n.getArea()<t.getArea()&&(t=n),o=o.parentNode}}return t}isEqual(e){for(const t of ns)if(this[t]!==e[t])return!1;return!0}contains(e){const t=this.getIntersection(e);return!(!t||!t.isEqual(e))}excludeScrollbarsAndBorders(){const e=this._source;let t,o,n;if(mr(e))t=e.innerWidth-e.document.documentElement.clientWidth,o=e.innerHeight-e.document.documentElement.clientHeight,n=e.getComputedStyle(e.document.documentElement).direction;else{const i=os(this._source);t=e.offsetWidth-e.clientWidth-i.left-i.right,o=e.offsetHeight-e.clientHeight-i.top-i.bottom,n=e.ownerDocument.defaultView.getComputedStyle(e).direction,this.left+=i.left,this.top+=i.top,this.right-=i.right,this.bottom-=i.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-=o,this.bottom-=o,this}static getDomRangeRects(e){const t=[],o=Array.from(e.getClientRects());if(o.length)for(const e of o)t.push(new is(e));else{let o=e.startContainer;Li(o)&&(o=o.parentNode);const n=new is(o.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};let o=0;for(const n of e)o++,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==o?null:(t.width=t.right-t.left,t.height=t.bottom-t.top,new is(t))}}function rs(e,t){for(const o of ns)e[o]=t[o]}function ss(e){return!!no(e)&&e===e.ownerDocument.body}function as({target:e,viewportOffset:t=0}){const o=gs(e);let n=o,i=null;for(;n;){let r;r=fs(n==o?e:i),cs(r,()=>ps(e,n));const s=ps(e,n);if(ls(n,s,t),n.parent!=n){if(i=n.frameElement,n=n.parent,!i)return}else n=null}}function ls(e,t,o){const n=t.clone().moveBy(0,o),i=t.clone().moveBy(0,-o),r=new is(e).excludeScrollbarsAndBorders();if(![i,n].every(e=>r.contains(e))){let{scrollX:s,scrollY:a}=e;hs(i,r)?a-=r.top-t.top+o:ds(n,r)&&(a+=t.bottom-r.bottom+o),us(t,r)?s-=r.left-t.left+o:ms(t,r)&&(s+=t.right-r.right+o),e.scrollTo(s,a)}}function cs(e,t){const o=gs(e);let n,i;for(;e!=o.document.body;)i=t(),n=new is(e).excludeScrollbarsAndBorders(),n.contains(i)||(hs(i,n)?e.scrollTop-=n.top-i.top:ds(i,n)&&(e.scrollTop+=i.bottom-n.bottom),us(i,n)?e.scrollLeft-=n.left-i.left:ms(i,n)&&(e.scrollLeft+=i.right-n.right)),e=e.parentNode}function ds(e,t){return e.bottom>t.bottom}function hs(e,t){return e.top<t.top}function us(e,t){return e.left<t.left}function ms(e,t){return e.right>t.right}function gs(e){return ts(e)?e.startContainer.ownerDocument.defaultView:e.ownerDocument.defaultView}function fs(e){if(ts(e)){let t=e.commonAncestorContainer;return Li(t)&&(t=t.parentNode),t}return e.parentNode}function ps(e,t){const o=gs(e),n=new is(e);if(o===t)return n;{let e=o;for(;e!=t;){const t=e.frameElement,o=new is(t).excludeScrollbarsAndBorders();n.moveBy(o.left,o.top),e=e.parent}}return n}Object.assign({},{scrollViewportToShowTarget:as,scrollAncestorsToShowTarget:function(e){cs(fs(e),()=>new is(e))}});class bs{constructor(e){this.document=new si(e),this.domConverter=new cr(this.document),this.domRoots=new Map,this.set("isRenderingInProgress",!1),this.set("hasDomSelection",!1),this._renderer=new tr(this.domConverter,this.document.selection),this._renderer.bind("isFocused").to(this.document),this._initialDomRootAttributes=new WeakMap,this._observers=new Map,this._ongoingChange=!1,this._postFixersInProgress=!1,this._renderingDisabled=!1,this._hasChangedSinceTheLastRendering=!1,this._writer=new Ri(this.document),this.addObserver(zr),this.addObserver(Qr),this.addObserver(Xr),this.addObserver(Dr),this.addObserver(Yr),this.addObserver(Zr),mi.isAndroid&&this.addObserver(es),this.document.on("keydown",Gi),Ai(this),this.on("render",()=>{this._render(),this.document.fire("layoutChanged"),this._hasChangedSinceTheLastRendering=!1}),this.listenTo(this.document.selection,"change",()=>{this._hasChangedSinceTheLastRendering=!0})}attachDomRoot(e,t="main"){const o=this.document.getRoot(t);o._name=e.tagName.toLowerCase();const n={};for(const{name:t,value:i}of Array.from(e.attributes))n[t]=i,"class"===t?this._writer.addClass(i.split(" "),o):this._writer.setAttribute(t,i,o);this._initialDomRootAttributes.set(e,n);const i=()=>{this._writer.setAttribute("contenteditable",!o.isReadOnly,o),o.isReadOnly?this._writer.addClass("ck-read-only",o):this._writer.removeClass("ck-read-only",o)};i(),this.domRoots.set(t,e),this.domConverter.bindElements(e,o),this._renderer.markToSync("children",o),this._renderer.markToSync("attributes",o),this._renderer.domDocuments.add(e.ownerDocument),o.on("change:children",(e,t)=>this._renderer.markToSync("children",t)),o.on("change:attributes",(e,t)=>this._renderer.markToSync("attributes",t)),o.on("change:text",(e,t)=>this._renderer.markToSync("text",t)),o.on("change:isReadOnly",()=>this.change(i)),o.on("change",()=>{this._hasChangedSinceTheLastRendering=!0});for(const o of this._observers.values())o.observe(e,t)}detachDomRoot(e){const t=this.domRoots.get(e);Array.from(t.attributes).forEach(({name:e})=>t.removeAttribute(e));const o=this._initialDomRootAttributes.get(t);for(const e in o)t.setAttribute(e,o[e]);this.domRoots.delete(e),this.domConverter.unbindDomElement(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,o]of this.domRoots)t.observe(o,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(){const e=this.document.selection.getFirstRange();e&&as({target:this.domConverter.viewRangeToDom(e),viewportOffset:20})}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 mo.b("cannot-change-view-tree: Attempting to make changes to the view when it is in an incorrect state: rendering or post-fixers are in progress. This may cause some unexpected behavior and inconsistency between the DOM and the view.",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){mo.b.rethrowUnexpectedError(e,this)}}forceRender(){this._hasChangedSinceTheLastRendering=!0,this.change(()=>{})}destroy(){for(const e of this._observers.values())e.destroy();this.document.destroy(),this.stopListening()}createPositionAt(e,t){return ei._createAt(e,t)}createPositionAfter(e){return ei._createAfter(e)}createPositionBefore(e){return ei._createBefore(e)}createRange(e,t){return new ti(e,t)}createRangeOn(e){return ti._createOn(e)}createRangeIn(e){return ti._createIn(e)}createSelection(e,t,o){return new ii(e,t,o)}_disableRendering(e){this._renderingDisabled=e,0==e&&this.change(()=>{})}_render(){this.isRenderingInProgress=!0,this.disableObservers(),this._renderer.render(),this.enableObservers(),this.isRenderingInProgress=!1}}Co(bs,qn);class ws{constructor(e){this.parent=null,this._attrs=Bo(e)}get index(){let e;if(!this.parent)return null;if(null===(e=this.parent.getChildIndex(this)))throw new mo.b("model-node-not-found-in-parent: The node's parent does not contain this node.",this);return e}get startOffset(){let e;if(!this.parent)return null;if(null===(e=this.parent.getChildStartOffset(this)))throw new mo.b("model-node-not-found-in-parent: The node's parent does not contain this node.",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 this.root.is("rootElement")}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.startOffset),t=t.parent;return e}getAncestors(e={includeSelf:!1,parentFirst:!1}){const t=[];let o=e.includeSelf?this:this.parent;for(;o;)t[e.parentFirst?"push":"unshift"](o),o=o.parent;return t}getCommonAncestor(e,t={}){const o=this.getAncestors(t),n=e.getAncestors(t);let i=0;for(;o[i]==n[i]&&o[i];)i++;return 0===i?null:o[i-1]}isBefore(e){if(this==e)return!1;if(this.root!==e.root)return!1;const t=this.getPath(),o=e.getPath(),n=Vo(t,o);switch(n){case"prefix":return!0;case"extension":return!1;default:return t[n]<o[n]}}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}is(e){return"node"===e||"model:node"===e}_clone(){return new ws(this._attrs)}_remove(){this.parent._removeChildren(this.index)}_setAttribute(e,t){this._attrs.set(e,t)}_setAttributesTo(e){this._attrs=Bo(e)}_removeAttribute(e){return this._attrs.delete(e)}_clearAttributes(){this._attrs.clear()}}class ks extends ws{constructor(e,t){super(t),this._data=e||""}get offsetSize(){return this.data.length}get data(){return this._data}is(e){return"$text"===e||"model:$text"===e||"text"===e||"model:text"===e||"node"===e||"model:node"===e}toJSON(){const e=super.toJSON();return e.data=this.data,e}_clone(){return new ks(this.data,this.getAttributes())}static fromJSON(e){return new ks(e.data,e.attributes)}}class _s{constructor(e,t,o){if(this.textNode=e,t<0||t>e.offsetSize)throw new mo.b("model-textproxy-wrong-offsetintext: Given offsetInText value is incorrect.",this);if(o<0||t+o>e.offsetSize)throw new mo.b("model-textproxy-wrong-length: Given length value is incorrect.",this);this.data=e.data.substring(t,t+o),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}is(e){return"$textProxy"===e||"model:$textProxy"===e||"textProxy"===e||"model:textProxy"===e}getPath(){const e=this.textNode.getPath();return e.length>0&&(e[e.length-1]+=this.offsetInText),e}getAncestors(e={includeSelf:!1,parentFirst:!1}){const t=[];let o=e.includeSelf?this:this.parent;for(;o;)t[e.parentFirst?"push":"unshift"](o),o=o.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()}}class vs{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 mo.b("model-nodelist-index-out-of-bounds: Given index cannot be found in the node list.",this);return this.getNodeStartOffset(t)}offsetToIndex(e){let t=0;for(const o of this._nodes){if(e>=t&&e<t+o.offsetSize)return this.getNodeIndex(o);t+=o.offsetSize}if(t!=e)throw new mo.b("model-nodelist-offset-out-of-bounds: Given offset cannot be found in the node list.",this,{offset:e,nodeList:this});return this.length}_insertNodes(e,t){for(const e of t)if(!(e instanceof ws))throw new mo.b("model-nodelist-insertNodes-not-node: Trying to insert an object which is not a Node instance.",this);this._nodes.splice(e,0,...t)}_removeNodes(e,t=1){return this._nodes.splice(e,t)}toJSON(){return this._nodes.map(e=>e.toJSON())}}class ys extends ws{constructor(e,t,o){super(t),this.name=e,this._children=new vs,o&&this._insertChild(0,o)}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return 0===this.childCount}is(e,t=null){return t?t===this.name&&("element"===e||"model:element"===e):"element"===e||"model:element"===e||"node"===e||"model:node"===e}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 o of e)t=t.getChild(t.offsetToIndex(o));return t}findAncestor(e,t={includeSelf:!1}){let o=t.includeSelf?this:this.parent;for(;o;){if(o.name===e)return o;o=o.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)):null;return new ys(this.name,this.getAttributes(),t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const o=function(e){if("string"==typeof e)return[new ks(e)];xo(e)||(e=[e]);return Array.from(e).map(e=>"string"==typeof e?new ks(e):e instanceof _s?new ks(e.data,e.getAttributes()):e)}(t);for(const e of o)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,o)}_removeChildren(e,t=1){const o=this._children._removeNodes(e,t);for(const e of o)e.parent=null;return o}static fromJSON(e){let t=null;if(e.children){t=[];for(const o of e.children)o.name?t.push(ys.fromJSON(o)):t.push(ks.fromJSON(o))}return new ys(e.name,e.attributes,t)}}class xs{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new mo.b("model-tree-walker-no-start-position: Neither boundaries nor starting position have been defined.",null);const t=e.direction||"forward";if("forward"!=t&&"backward"!=t)throw new mo.b("model-tree-walker-unknown-direction: Only `backward` and `forward` direction allowed.",e,{direction:t});this.direction=t,this.boundaries=e.boundaries||null,e.startPosition?this.position=e.startPosition.clone():this.position=As._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}skip(e){let t,o,n,i;do{n=this.position,i=this._visitedParent,({done:t,value:o}=this.next())}while(!t&&e(o));t||(this.position=n,this._visitedParent=i)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){const e=this.position,t=this.position.clone(),o=this._visitedParent;if(null===o.parent&&t.offset===o.maxOffset)return{done:!0};if(o===this._boundaryEndParent&&t.offset==this.boundaries.end.offset)return{done:!0};const n=t.parent,i=Ts(t,n),r=i||Ps(t,n,i);if(r instanceof ys)return this.shallow?t.offset++:(t.path.push(0),this._visitedParent=r),this.position=t,Cs("elementStart",r,e,t,1);if(r instanceof ks){let n;if(this.singleCharacters)n=1;else{let e=r.endOffset;this._boundaryEndParent==o&&this.boundaries.end.offset<e&&(e=this.boundaries.end.offset),n=e-t.offset}const i=t.offset-r.startOffset,s=new _s(r,i,n);return t.offset+=n,this.position=t,Cs("text",s,e,t,n)}return t.path.pop(),t.offset++,this.position=t,this._visitedParent=o.parent,this.ignoreElementEnd?this._next():Cs("elementEnd",o,e,t)}_previous(){const e=this.position,t=this.position.clone(),o=this._visitedParent;if(null===o.parent&&0===t.offset)return{done:!0};if(o==this._boundaryStartParent&&t.offset==this.boundaries.start.offset)return{done:!0};const n=t.parent,i=Ts(t,n),r=i||Ss(t,n,i);if(r instanceof ys)return t.offset--,this.shallow?(this.position=t,Cs("elementStart",r,e,t,1)):(t.path.push(r.maxOffset),this.position=t,this._visitedParent=r,this.ignoreElementEnd?this._previous():Cs("elementEnd",r,e,t));if(r instanceof ks){let n;if(this.singleCharacters)n=1;else{let e=r.startOffset;this._boundaryStartParent==o&&this.boundaries.start.offset>e&&(e=this.boundaries.start.offset),n=t.offset-e}const i=t.offset-r.startOffset,s=new _s(r,i-n,n);return t.offset-=n,this.position=t,Cs("text",s,e,t,n)}return t.path.pop(),this.position=t,this._visitedParent=o.parent,Cs("elementStart",o,e,t,1)}}function Cs(e,t,o,n,i){return{done:!1,value:{type:e,item:t,previousPosition:o,nextPosition:n,length:i}}}class As{constructor(e,t,o="toNone"){if(!e.is("element")&&!e.is("documentFragment"))throw new mo.b("model-position-root-invalid: Position root invalid.",e);if(!(t instanceof Array)||0===t.length)throw new mo.b("model-position-path-incorrect-format: Position path must be an array with at least one item.",e,{path:t});e.is("rootElement")?t=t.slice():(t=[...e.getPath(),...t],e=e.root),this.root=e,this.path=t,this.stickiness=o}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 mo.b("model-position-path-incorrect: The position's path is incorrect.",this,{position:this});if(e.is("$text"))throw new mo.b("model-position-path-incorrect: The position's path is incorrect.",this,{position:this});return e}get index(){return this.parent.offsetToIndex(this.offset)}get textNode(){return Ts(this,this.parent)}get nodeAfter(){const e=this.parent;return Ps(this,e,Ts(this,e))}get nodeBefore(){const e=this.parent;return Ss(this,e,Ts(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=Vo(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 o=new xs(t);return o.skip(e),o.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=Vo(this.path,e.path),o="string"==typeof t?Math.min(this.path.length,e.path.length):t;return this.path.slice(0,o)}getCommonAncestor(e){const t=this.getAncestors(),o=e.getAncestors();let n=0;for(;t[n]==o[n]&&t[n];)n++;return 0===n?null:t[n-1]}getShiftedBy(e){const t=this.clone(),o=t.offset+e;return t.offset=o<0?0:o,t}isAfter(e){return"after"==this.compareWith(e)}isBefore(e){return"before"==this.compareWith(e)}isEqual(e){return"same"==this.compareWith(e)}isTouching(e){let t=null,o=null;switch(this.compareWith(e)){case"same":return!0;case"before":t=As._createAt(this),o=As._createAt(e);break;case"after":t=As._createAt(e),o=As._createAt(this);break;default:return!1}let n=t.parent;for(;t.path.length+o.path.length;){if(t.isEqual(o))return!0;if(t.path.length>o.path.length){if(t.offset!==n.maxOffset)return!1;t.path=t.path.slice(0,-1),n=n.parent,t.offset++}else{if(0!==o.offset)return!1;o.path=o.path.slice(0,-1)}}}is(e){return"position"===e||"model:position"===e}hasSameParentAs(e){if(this.root!==e.root)return!1;return"same"==Vo(this.getParentPath(),e.getParentPath())}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=As._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 o;return t.containsPosition(this)||t.start.isEqual(this)?(o=this._getCombined(e.sourcePosition,e.targetPosition),e.sourcePosition.isBefore(e.targetPosition)&&(o=o._getTransformedByDeletion(e.deletionPosition,1))):o=this.isEqual(e.deletionPosition)?As._createAt(e.deletionPosition):this._getTransformedByMove(e.deletionPosition,e.graveyardPosition,1),o}_getTransformedByDeletion(e,t){const o=As._createAt(this);if(this.root!=e.root)return o;if("same"==Vo(e.getParentPath(),this.getParentPath())){if(e.offset<this.offset){if(e.offset+t>this.offset)return null;o.offset-=t}}else if("prefix"==Vo(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;o.path[n]-=t}}return o}_getTransformedByInsertion(e,t){const o=As._createAt(this);if(this.root!=e.root)return o;if("same"==Vo(e.getParentPath(),this.getParentPath()))(e.offset<this.offset||e.offset==this.offset&&"toPrevious"!=this.stickiness)&&(o.offset+=t);else if("prefix"==Vo(e.getParentPath(),this.getParentPath())){const n=e.path.length-1;e.offset<=this.path[n]&&(o.path[n]+=t)}return o}_getTransformedByMove(e,t,o){if(t=t._getTransformedByDeletion(e,o),e.isEqual(t))return As._createAt(this);const n=this._getTransformedByDeletion(e,o);return null===n||e.isEqual(this)&&"toNext"==this.stickiness||e.getShiftedBy(o).isEqual(this)&&"toPrevious"==this.stickiness?this._getCombined(e,t):n._getTransformedByInsertion(t,o)}_getCombined(e,t){const o=e.path.length-1,n=As._createAt(t);return n.stickiness=this.stickiness,n.offset=n.offset+this.path[o]-e.offset,n.path=[...n.path,...this.path.slice(o+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,o="toNone"){if(e instanceof As)return new As(e.root,e.path,e.stickiness);{const n=e;if("end"==t)t=n.maxOffset;else{if("before"==t)return this._createBefore(n,o);if("after"==t)return this._createAfter(n,o);if(0!==t&&!t)throw new mo.b("model-createPositionAt-offset-required: Model#createPositionAt() requires the offset when the first parameter is a model item.",[this,e])}if(!n.is("element")&&!n.is("documentFragment"))throw new mo.b("model-position-parent-incorrect: Position parent have to be a element or document fragment.",[this,e]);const i=n.getPath();return i.push(t),new this(n.root,i,o)}}static _createAfter(e,t){if(!e.parent)throw new mo.b("model-position-after-root: You cannot make a position after root.",[this,e],{root:e});return this._createAt(e.parent,e.endOffset,t)}static _createBefore(e,t){if(!e.parent)throw new mo.b("model-position-before-root: You cannot make a position before root.",e,{root:e});return this._createAt(e.parent,e.startOffset,t)}static fromJSON(e,t){if("$graveyard"===e.root){const o=new As(t.graveyard,e.path);return o.stickiness=e.stickiness,o}if(!t.getRoot(e.root))throw new mo.b("model-position-fromjson-no-root: Cannot create position for document. Root with specified name does not exist.",t,{rootName:e.root});return new As(t.getRoot(e.root),e.path,e.stickiness)}}function Ts(e,t){const o=t.getChild(t.offsetToIndex(e.offset));return o&&o.is("$text")&&o.startOffset<e.offset?o:null}function Ps(e,t,o){return null!==o?null:t.getChild(t.offsetToIndex(e.offset))}function Ss(e,t,o){return null!==o?null:t.getChild(t.offsetToIndex(e.offset)-1)}class Es{constructor(e,t=null){this.start=As._createAt(e),this.end=t?As._createAt(t):As._createAt(e),this.start.stickiness=this.isCollapsed?"toNone":"toNext",this.end.stickiness=this.isCollapsed?"toNone":"toPrevious"}*[Symbol.iterator](){yield*new xs({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return"same"==Vo(this.start.getParentPath(),this.end.getParentPath())}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 o=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),n=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return o&&n}containsItem(e){const t=As._createBefore(e);return this.containsPosition(t)||this.start.isEqual(t)}is(e){return"range"===e||"model:range"===e}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 Es(this.start,e.start)),this.containsPosition(e.end)&&t.push(new Es(e.end,this.end))):t.push(new Es(this.start,this.end)),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,o=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(o=e.end),new Es(t,o)}return null}getJoined(e,t=!1){let o=this.isIntersecting(e);if(o||(o=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)),!o)return null;let n=this.start,i=this.end;return e.start.isBefore(n)&&(n=e.start),e.end.isAfter(i)&&(i=e.end),new Es(n,i)}getMinimalFlatRanges(){const e=[],t=this.start.getCommonPath(this.end).length,o=As._createAt(this.start);let n=o.parent;for(;o.path.length>t+1;){const t=n.maxOffset-o.offset;0!==t&&e.push(new Es(o,o.getShiftedBy(t))),o.path=o.path.slice(0,-1),o.offset++,n=n.parent}for(;o.path.length<=this.end.path.length;){const t=this.end.path[o.path.length-1],n=t-o.offset;0!==n&&e.push(new Es(o,o.getShiftedBy(n))),o.offset=t,o.path.push(0)}return e}getWalker(e={}){return e.boundaries=this,new xs(e)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new xs(e);for(const e of t)yield e.item}*getPositions(e={}){e.boundaries=this;const t=new xs(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 Es(this.start,this.end)]}getTransformedByOperations(e){const t=[new Es(this.start,this.end)];for(const o of e)for(let e=0;e<t.length;e++){const n=t[e].getTransformedByOperation(o);t.splice(e,1,...n),e+=n.length-1}for(let e=0;e<t.length;e++){const o=t[e];for(let n=e+1;n<t.length;n++){const e=t[n];(o.containsRange(e)||e.containsRange(o)||o.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 o=e.sourcePosition,n=e.howMany,i=e.targetPosition;return this._getTransformedByMove(o,i,n,t)}_getTransformedBySplitOperation(e){const t=this.start._getTransformedBySplitOperation(e);let o=this.end._getTransformedBySplitOperation(e);return this.end.isEqual(e.insertionPosition)&&(o=this.end.getShiftedBy(1)),t.root!=o.root&&(o=this.end.getShiftedBy(-1)),new Es(t,o)}_getTransformedByMergeOperation(e){if(this.start.isEqual(e.targetPosition)&&this.end.isEqual(e.deletionPosition))return new Es(this.start);let t=this.start._getTransformedByMergeOperation(e),o=this.end._getTransformedByMergeOperation(e);return t.root!=o.root&&(o=this.end.getShiftedBy(-1)),t.isAfter(o)?(e.sourcePosition.isBefore(e.targetPosition)?(t=As._createAt(o),t.offset=0):(e.deletionPosition.isEqual(t)||(o=e.deletionPosition),t=e.targetPosition),new Es(t,o)):new Es(t,o)}_getTransformedByInsertion(e,t,o=!1){if(o&&this.containsPosition(e))return[new Es(this.start,e),new Es(e.getShiftedBy(t),this.end._getTransformedByInsertion(e,t))];{const o=new Es(this.start,this.end);return o.start=o.start._getTransformedByInsertion(e,t),o.end=o.end._getTransformedByInsertion(e,t),[o]}}_getTransformedByMove(e,t,o,n=!1){if(this.isCollapsed){const n=this.start._getTransformedByMove(e,t,o);return[new Es(n)]}const i=Es._createFromPositionAndShift(e,o),r=t._getTransformedByDeletion(e,o);if(this.containsPosition(t)&&!n&&(i.containsPosition(this.start)||i.containsPosition(this.end))){const n=this.start._getTransformedByMove(e,t,o),i=this.end._getTransformedByMove(e,t,o);return[new Es(n,i)]}let s;const a=this.getDifference(i);let l=null;const c=this.getIntersection(i);if(1==a.length?l=new Es(a[0].start._getTransformedByDeletion(e,o),a[0].end._getTransformedByDeletion(e,o)):2==a.length&&(l=new Es(this.start,this.end._getTransformedByDeletion(e,o))),s=l?l._getTransformedByInsertion(r,o,null!==c||n):[],c){const e=new Es(c.start._getCombined(i.start,r),c.end._getCombined(i.start,r));2==s.length?s.splice(1,0,e):s.push(e)}return s}_getTransformedByDeletion(e,t){let o=this.start._getTransformedByDeletion(e,t),n=this.end._getTransformedByDeletion(e,t);return null==o&&null==n?null:(null==o&&(o=e),null==n&&(n=e),new Es(o,n))}static _createFromPositionAndShift(e,t){const o=e,n=e.getShiftedBy(t);return t>0?new this(o,n):new this(n,o)}static _createIn(e){return new this(As._createAt(e,0),As._createAt(e,e.maxOffset))}static _createOn(e){return this._createFromPositionAndShift(As._createBefore(e),e.offsetSize)}static _createFromRanges(e){if(0===e.length)throw new mo.b("range-create-from-ranges-empty-array: At least one range has to be passed.",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 o=e.indexOf(t),n=new this(t.start,t.end);if(o>0)for(let t=o-1;e[t].end.isEqual(n.start);t++)n.start=As._createAt(e[t].start);for(let t=o+1;t<e.length&&e[t].start.isEqual(n.end);t++)n.end=As._createAt(e[t].end);return n}static fromJSON(e,t){return new this(As.fromJSON(e.start,t),As.fromJSON(e.end,t))}}class Rs{constructor(){this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._viewToModelLengthCallbacks=new Map,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._unboundMarkerNames=new Set,this.on("modelToViewPosition",(e,t)=>{if(t.viewPosition)return;const o=this._modelToViewMapping.get(t.modelPosition.parent);t.viewPosition=this.findPositionIn(o,t.modelPosition.offset)},{priority:"low"}),this.on("viewToModelPosition",(e,t)=>{if(t.modelPosition)return;const o=this.findMappedViewAncestor(t.viewPosition),n=this._viewToModelMapping.get(o),i=this._toModelOffset(t.viewPosition.parent,t.viewPosition.offset,o);t.modelPosition=As._createAt(n,i)},{priority:"low"})}bindElements(e,t){this._modelToViewMapping.set(e,t),this._viewToModelMapping.set(t,e)}unbindViewElement(e){const t=this.toModelElement(e);if(this._viewToModelMapping.delete(e),this._elementToMarkerNames.has(e))for(const t of this._elementToMarkerNames.get(e))this._unboundMarkerNames.add(t);this._modelToViewMapping.get(t)==e&&this._modelToViewMapping.delete(t)}unbindModelElement(e){const t=this.toViewElement(e);this._modelToViewMapping.delete(e),this._viewToModelMapping.get(t)==e&&this._viewToModelMapping.delete(t)}bindElementToMarker(e,t){const o=this._markerNameToElements.get(t)||new Set;o.add(e);const n=this._elementToMarkerNames.get(e)||new Set;n.add(t),this._markerNameToElements.set(t,o),this._elementToMarkerNames.set(e,n)}unbindElementFromMarkerName(e,t){const o=this._markerNameToElements.get(t);o&&(o.delete(e),0==o.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}clearBindings(){this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._unboundMarkerNames=new Set}toModelElement(e){return this._viewToModelMapping.get(e)}toViewElement(e){return this._modelToViewMapping.get(e)}toModelRange(e){return new Es(this.toModelPosition(e.start),this.toModelPosition(e.end))}toViewRange(e){return new ti(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={isPhantom:!1}){const o={modelPosition:e,mapper:this,isPhantom:t.isPhantom};return this.fire("modelToViewPosition",o),o.viewPosition}markerNameToElements(e){const t=this._markerNameToElements.get(e);if(!t)return null;const o=new Set;for(const e of t)if(e.is("attributeElement"))for(const t of e.getElementsWithSameId())o.add(t);else o.add(e);return o}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,o){if(o!=e){return this._toModelOffset(e.parent,e.index,o)+this._toModelOffset(e,t,e)}if(e.is("$text"))return t;let n=0;for(let o=0;o<t;o++)n+=this.getModelLength(e.getChild(o));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 o of e.getChildren())t+=this.getModelLength(o);return t}}findPositionIn(e,t){let o,n=0,i=0,r=0;if(e.is("$text"))return new ei(e,t);for(;i<t;)o=e.getChild(r),n=this.getModelLength(o),i+=n,r++;return i==t?this._moveViewPositionToTextNode(new ei(e,r)):this.findPositionIn(o,t-(i-n))}_moveViewPositionToTextNode(e){const t=e.nodeBefore,o=e.nodeAfter;return t instanceof No?new ei(t,t.data.length):o instanceof No?new ei(o,0):e}}Co(Rs,po);class Is{constructor(){this._consumable=new Map,this._textProxyRegistry=new Map}add(e,t){t=Vs(t),e instanceof _s&&(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=Vs(t),e instanceof _s&&(e=this._getSymbolForTextProxy(e)),!!this.test(e,t)&&(this._consumable.get(e).set(t,!1),!0)}test(e,t){t=Vs(t),e instanceof _s&&(e=this._getSymbolForTextProxy(e));const o=this._consumable.get(e);if(void 0===o)return null;const n=o.get(t);return void 0===n?null:n}revert(e,t){t=Vs(t),e instanceof _s&&(e=this._getSymbolForTextProxy(e));const o=this.test(e,t);return!1===o?(this._consumable.get(e).set(t,!0),!0):!0!==o&&null}_getSymbolForTextProxy(e){let t=null;const o=this._textProxyRegistry.get(e.startOffset);if(o){const n=o.get(e.endOffset);n&&(t=n.get(e.parent))}return t||(t=this._addSymbolForTextProxy(e.startOffset,e.endOffset,e.parent)),t}_addSymbolForTextProxy(e,t,o){const n=Symbol("textProxySymbol");let i,r;return i=this._textProxyRegistry.get(e),i||(i=new Map,this._textProxyRegistry.set(e,i)),r=i.get(t),r||(r=new Map,i.set(t,r)),r.set(o,n),n}}function Vs(e){const t=e.split(":");return t.length>1?t[0]+":"+t[1]:t[0]}class Os{constructor(e){this.conversionApi=Object.assign({dispatcher:this},e)}convertChanges(e,t,o){for(const t of e.getMarkersToRemove())this.convertMarkerRemove(t.name,t.range,o);for(const t of e.getChanges())"insert"==t.type?this.convertInsert(Es._createFromPositionAndShift(t.position,t.length),o):"remove"==t.type?this.convertRemove(t.position,t.length,t.name,o):this.convertAttribute(t.range,t.attributeKey,t.attributeOldValue,t.attributeNewValue,o);for(const e of this.conversionApi.mapper.flushUnboundMarkerNames()){const n=t.get(e).getRange();this.convertMarkerRemove(e,n,o),this.convertMarkerAdd(e,n,o)}for(const t of e.getMarkersToAdd())this.convertMarkerAdd(t.name,t.range,o)}convertInsert(e,t){this.conversionApi.writer=t,this.conversionApi.consumable=this._createInsertConsumable(e);for(const t of e){const e=t.item,o={item:e,range:Es._createFromPositionAndShift(t.previousPosition,t.length)};this._testAndFire("insert",o);for(const t of e.getAttributeKeys())o.attributeKey=t,o.attributeOldValue=null,o.attributeNewValue=e.getAttribute(t),this._testAndFire("attribute:"+t,o)}this._clearConversionApi()}convertRemove(e,t,o,n){this.conversionApi.writer=n,this.fire("remove:"+o,{position:e,length:t},this.conversionApi),this._clearConversionApi()}convertAttribute(e,t,o,n,i){this.conversionApi.writer=i,this.conversionApi.consumable=this._createConsumableForRange(e,"attribute:"+t);for(const i of e){const e={item:i.item,range:Es._createFromPositionAndShift(i.previousPosition,i.length),attributeKey:t,attributeOldValue:o,attributeNewValue:n};this._testAndFire("attribute:"+t,e)}this._clearConversionApi()}convertSelection(e,t,o){const n=Array.from(t.getMarkersAtPosition(e.getFirstPosition()));if(this.conversionApi.writer=o,this.conversionApi.consumable=this._createSelectionConsumable(e,n),this.fire("selection",{selection:e},this.conversionApi),e.isCollapsed){for(const t of n){const o=t.getRange();if(!Ms(e.getFirstPosition(),t,this.conversionApi.mapper))continue;const n={item:e,markerName:t.name,markerRange:o};this.conversionApi.consumable.test(e,"addMarker:"+t.name)&&this.fire("addMarker:"+t.name,n,this.conversionApi)}for(const t of e.getAttributeKeys()){const o={item:e,range:e.getFirstRange(),attributeKey:t,attributeOldValue:null,attributeNewValue:e.getAttribute(t)};this.conversionApi.consumable.test(e,"attribute:"+o.attributeKey)&&this.fire("attribute:"+o.attributeKey+":$text",o,this.conversionApi)}this._clearConversionApi()}}convertMarkerAdd(e,t,o){if(!t.root.document||"$graveyard"==t.root.rootName)return;this.conversionApi.writer=o;const n="addMarker:"+e,i=new Is;if(i.add(t,n),this.conversionApi.consumable=i,this.fire(n,{markerName:e,markerRange:t},this.conversionApi),i.test(t,n)){this.conversionApi.consumable=this._createConsumableForRange(t,n);for(const o of t.getItems()){if(!this.conversionApi.consumable.test(o,n))continue;const i={item:o,range:Es._createOn(o),markerName:e,markerRange:t};this.fire(n,i,this.conversionApi)}this._clearConversionApi()}}convertMarkerRemove(e,t,o){t.root.document&&"$graveyard"!=t.root.rootName&&(this.conversionApi.writer=o,this.fire("removeMarker:"+e,{markerName:e,markerRange:t},this.conversionApi),this._clearConversionApi())}_createInsertConsumable(e){const t=new Is;for(const o of e){const e=o.item;t.add(e,"insert");for(const o of e.getAttributeKeys())t.add(e,"attribute:"+o)}return t}_createConsumableForRange(e,t){const o=new Is;for(const n of e.getItems())o.add(n,t);return o}_createSelectionConsumable(e,t){const o=new Is;o.add(e,"selection");for(const n of t)o.add(e,"addMarker:"+n.name);for(const t of e.getAttributeKeys())o.add(e,"attribute:"+t);return o}_testAndFire(e,t){if(!this.conversionApi.consumable.test(t.item,e))return;const o=t.item.name||"$text";this.fire(e+":"+o,t,this.conversionApi)}_clearConversionApi(){delete this.conversionApi.writer,delete this.conversionApi.consumable}}function Ms(e,t,o){const n=t.getRange(),i=Array.from(e.getAncestors());i.shift(),i.reverse();return!i.some(e=>{if(n.containsItem(e)){return!!o.toViewElement(e).getCustomProperty("addHighlight")}})}Co(Os,po);class Ns{constructor(e,t,o){this._lastRangeBackward=!1,this._ranges=[],this._attrs=new Map,e&&this.setTo(e,t,o)}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 o=!1;for(const n of e._ranges)if(t.isEqual(n)){o=!0;break}if(!o)return!1}return!0}*getRanges(){for(const e of this._ranges)yield new Es(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 Es(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 Es(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,t,o){if(null===e)this._setRanges([]);else if(e instanceof Ns)this._setRanges(e.getRanges(),e.isBackward);else if(e&&"function"==typeof e.getRanges)this._setRanges(e.getRanges(),e.isBackward);else if(e instanceof Es)this._setRanges([e],!!t&&!!t.backward);else if(e instanceof As)this._setRanges([new Es(e)]);else if(e instanceof ws){const n=!!o&&!!o.backward;let i;if("in"==t)i=Es._createIn(e);else if("on"==t)i=Es._createOn(e);else{if(void 0===t)throw new mo.b("model-selection-setTo-required-second-parameter: selection.setTo requires the second parameter when the first parameter is a node.",[this,e]);i=new Es(As._createAt(e,t))}this._setRanges([i],n)}else{if(!xo(e))throw new mo.b("model-selection-setTo-not-selectable: Cannot set the selection to the given place.",[this,e]);this._setRanges(e,t&&!!t.backward)}}_setRanges(e,t=!1){const o=(e=Array.from(e)).some(t=>{if(!(t instanceof Es))throw new mo.b("model-selection-set-ranges-not-range: Selection range set to an object that is not an instance of model.Range.",[this,e]);return this._ranges.every(e=>!e.isEqual(t))});if(e.length!==this._ranges.length||o){this._removeAllRanges();for(const t of e)this._pushRange(t);this._lastRangeBackward=!!t,this.fire("change:range",{directChange:!0})}}setFocus(e,t){if(null===this.anchor)throw new mo.b("model-selection-setFocus-no-ranges: Cannot set selection focus if there are no ranges in selection.",[this,e]);const o=As._createAt(e,t);if("same"==o.compareWith(this.focus))return;const n=this.anchor;this._ranges.length&&this._popRange(),"before"==o.compareWith(n)?(this._pushRange(new Es(o,n)),this._lastRangeBackward=!0):(this._pushRange(new Es(n,o)),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()}is(e){return"selection"===e||"model:selection"===e}*getSelectedBlocks(){const e=new WeakSet;for(const t of this.getRanges()){const o=Fs(t.start,e);o&&Ds(o,t)&&(yield o);for(const o of t.getWalker()){const n=o.item;"elementEnd"==o.type&&Bs(n,e,t)&&(yield n)}const n=Fs(t.end,e);n&&!t.end.isTouching(As._createAt(n,0))&&Ds(n,t)&&(yield n)}}containsEntireContent(e=this.anchor.root){const t=As._createAt(e,0),o=As._createAt(e,"end");return t.isTouching(this.getFirstPosition())&&o.isTouching(this.getLastPosition())}_pushRange(e){this._checkRange(e),this._ranges.push(new Es(e.start,e.end))}_checkRange(e){for(let t=0;t<this._ranges.length;t++)if(e.isIntersecting(this._ranges[t]))throw new mo.b("model-selection-range-intersects: Trying to add a range that intersects with another range in the selection.",[this,e],{addedRange:e,intersectingRange:this._ranges[t]})}_removeAllRanges(){for(;this._ranges.length>0;)this._popRange()}_popRange(){this._ranges.pop()}}function zs(e,t){return!t.has(e)&&(t.add(e),e.root.document.model.schema.isBlock(e)&&e.parent)}function Bs(e,t,o){return zs(e,t)&&Ds(e,o)}function Fs(e,t){const o=e.parent.root.document.model.schema,n=e.parent.getAncestors({parentFirst:!0,includeSelf:!0});let i=!1;const r=n.find(e=>!i&&(i=o.isLimit(e),!i&&zs(e,t)));return n.forEach(e=>t.add(e)),r}function Ds(e,t){const o=function(e){const t=e.root.document.model.schema;let o=e.parent;for(;o;){if(t.isBlock(o))return o;o=o.parent}}(e);if(!o)return!0;return!t.containsRange(Es._createOn(o),!0)}Co(Ns,po);class Ls extends Es{constructor(e,t){super(e,t),Hs.call(this)}detach(){this.stopListening()}is(e){return"liveRange"===e||"model:liveRange"===e||"range"==e||"model:range"===e}toRange(){return new Es(this.start,this.end)}static fromRange(e){return new Ls(e.start,e.end)}}function Hs(){this.listenTo(this.root.document.model,"applyOperation",(e,t)=>{const o=t[0];o.isDocumentOperation&&js.call(this,o)},{priority:"low"})}function js(e){const t=this.getTransformedByOperation(e),o=Es._createFromRanges(t),n=!o.isEqual(this),i=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 r=null;if(n){"$graveyard"==o.root.rootName&&(r="remove"==e.type?e.sourcePosition:e.deletionPosition);const t=this.toRange();this.start=o.start,this.end=o.end,this.fire("change:range",t,{deletionPosition:r})}else i&&this.fire("change:content",this.toRange(),{deletionPosition:r})}Co(Ls,po);class Ws{constructor(e){this._selection=new qs(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)}is(e){return"selection"===e||"model:selection"==e||"documentSelection"==e||"model:documentSelection"==e}_setFocus(e,t){this._selection.setFocus(e,t)}_setTo(e,t,o){this._selection.setTo(e,t,o)}_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"selection:"+e}static _isStoreAttributeKey(e){return e.startsWith("selection:")}}Co(Ws,po);class qs extends Ns{constructor(e){super(),this.markers=new Ao({idProperty:"name"}),this._model=e.model,this._document=e,this._attributePriority=new Map,this._selectionRestorePosition=null,this._hasChangedRange=!1,this._overriddenGravityRegister=new Set,this.listenTo(this._model,"applyOperation",(e,t)=>{const o=t[0];o.isDocumentOperation&&"marker"!=o.type&&"rename"!=o.type&&"noop"!=o.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",()=>{for(const e of this.getRanges())if(!this._document._validateSelectionRange(e))throw new mo.b("document-selection-wrong-position: Range from document selection starts or ends at incorrect position.",this,{range:e})}),this.listenTo(this._model.markers,"update",()=>this._updateMarkers()),this.listenTo(this._document,"change",(e,t)=>{!function(e,t){const o=e.document.differ;for(const n of o.getChanges()){if("insert"!=n.type)continue;const o=n.position.parent;n.length===o.maxOffset&&e.enqueueChange(t,e=>{const t=Array.from(o.getAttributeKeys()).filter(e=>e.startsWith("selection:"));for(const n of t)e.removeAttribute(n,o)})}}(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,t,o){super.setTo(e,t,o),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=ho();return this._overriddenGravityRegister.add(e),1===this._overriddenGravityRegister.size&&this._updateAttributes(!0),e}restoreGravity(e){if(!this._overriddenGravityRegister.has(e))throw new mo.b("document-selection-gravity-wrong-restore: Attempting to restore the selection gravity for an unknown UID.",this,{uid:e});this._overriddenGravityRegister.delete(e),this.isGravityOverridden||this._updateAttributes(!0)}_popRange(){this._ranges.pop().detach()}_pushRange(e){const t=this._prepareRange(e);t&&this._ranges.push(t)}_prepareRange(e){if(this._checkRange(e),e.root==this._document.graveyard)return;const t=Ls.fromRange(e);return t.on("change:range",(e,o,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(){const e=[];let t=!1;for(const t of this._model.markers){const o=t.getRange();for(const n of this.getRanges())o.containsRange(n,!n.isCollapsed)&&e.push(t)}const o=Array.from(this.markers);for(const o of e)this.markers.has(o)||(this.markers.add(o),t=!0);for(const o of Array.from(this.markers))e.includes(o)||(this.markers.remove(o),t=!0);t&&this.fire("change:marker",{oldMarkers:o,directChange:!1})}_updateAttributes(e){const t=Bo(this._getSurroundingAttributes()),o=Bo(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 n=[];for(const[e,t]of this.getAttributes())o.has(e)&&o.get(e)===t||n.push(e);for(const[e]of o)this.hasAttribute(e)||n.push(e);n.length>0&&this.fire("change:attribute",{attributeKeys:n,directChange:!1})}_setAttribute(e,t,o=!0){const n=o?"normal":"low";if("low"==n&&"normal"==this._attributePriority.get(e))return!1;return super.getAttribute(e)!==t&&(this._attrs.set(e,t),this._attributePriority.set(e,n),!0)}_removeAttribute(e,t=!0){const o=t?"normal":"low";return("low"!=o||"normal"!=this._attributePriority.get(e))&&(this._attributePriority.set(e,o),!!super.hasAttribute(e)&&(this._attrs.delete(e),!0))}_setAttributesTo(e){const t=new Set;for(const[t,o]of this.getAttributes())e.get(t)!==o&&this._removeAttribute(t,!1);for(const[o,n]of e){this._setAttribute(o,n,!1)&&t.add(o)}return t}*_getStoredAttributes(){const e=this.getFirstPosition().parent;if(this.isCollapsed&&e.isEmpty)for(const t of e.getAttributeKeys())if(t.startsWith("selection:")){const o=t.substr("selection:".length);yield[o,e.getAttribute(t)]}}_getSurroundingAttributes(){const e=this.getFirstPosition(),t=this._model.schema;let o=null;if(this.isCollapsed){const n=e.textNode?e.textNode:e.nodeBefore,i=e.textNode?e.textNode:e.nodeAfter;if(this.isGravityOverridden||(o=$s(n)),o||(o=$s(i)),!this.isGravityOverridden&&!o){let e=n;for(;e&&!t.isInline(e)&&!o;)e=e.previousSibling,o=$s(e)}if(!o){let e=i;for(;e&&!t.isInline(e)&&!o;)e=e.nextSibling,o=$s(e)}o||(o=this._getStoredAttributes())}else{const e=this.getFirstRange();for(const n of e){if(n.item.is("element")&&t.isObject(n.item))break;if("text"==n.type){o=n.item.getAttributes();break}}}return o}_fixGraveyardSelection(e){const t=this._model.schema.getNearestSelectionRange(e);t&&this._pushRange(t)}}function $s(e){return e instanceof _s||e instanceof ks?e.getAttributes():null}class Us{constructor(e){this._dispatchers=e}add(e){for(const t of this._dispatchers)e(t);return this}}var Gs=function(e){return to(e,5)};class Ks extends Us{elementToElement(e){return this.add(function(e){return(e=Gs(e)).view=Qs(e.view,"container"),t=>{var o;t.on("insert:"+e.model,(o=e.view,(e,t,n)=>{const i=o(t.item,n);if(!i)return;if(!n.consumable.consume(t.item,"insert"))return;const r=n.mapper.toViewPosition(t.range.start);n.mapper.bindElements(t.item,i),n.writer.insert(r,i)}),{priority:e.converterPriority||"normal"})}}(e))}attributeToElement(e){return this.add(function(e){e=Gs(e);let t="attribute:"+(e.model.key?e.model.key:e.model);e.model.name&&(t+=":"+e.model.name);if(e.model.values)for(const t of e.model.values)e.view[t]=Qs(e.view[t],"attribute");else e.view=Qs(e.view,"attribute");const o=Xs(e);return n=>{n.on(t,function(e){return(t,o,n)=>{const i=e(o.attributeOldValue,n),r=e(o.attributeNewValue,n);if(!i&&!r)return;if(!n.consumable.consume(o.item,t.name))return;const s=n.writer,a=s.document.selection;if(o.item instanceof Ns||o.item instanceof Ws)s.wrap(a.getFirstRange(),r);else{let e=n.mapper.toViewRange(o.range);null!==o.attributeOldValue&&i&&(e=s.unwrap(e,i)),null!==o.attributeNewValue&&r&&s.wrap(e,r)}}}(o),{priority:e.converterPriority||"normal"})}}(e))}attributeToAttribute(e){return this.add(function(e){e=Gs(e);let t="attribute:"+(e.model.key?e.model.key:e.model);e.model.name&&(t+=":"+e.model.name);if(e.model.values)for(const t of e.model.values)e.view[t]=Zs(e.view[t]);else e.view=Zs(e.view);const o=Xs(e);return n=>{var i;n.on(t,(i=o,(e,t,o)=>{const n=i(t.attributeOldValue,o),r=i(t.attributeNewValue,o);if(!n&&!r)return;if(!o.consumable.consume(t.item,e.name))return;const s=o.mapper.toViewElement(t.item),a=o.writer;if(!s)throw new mo.b("conversion-attribute-to-attribute-on-text: Trying to convert text node's attribute with attribute-to-attribute converter.",[t,o]);if(null!==t.attributeOldValue&&n)if("class"==n.key){const e=Array.isArray(n.value)?n.value:[n.value];for(const t of e)a.removeClass(t,s)}else if("style"==n.key){const e=Object.keys(n.value);for(const t of e)a.removeStyle(t,s)}else a.removeAttribute(n.key,s);if(null!==t.attributeNewValue&&r)if("class"==r.key){const e=Array.isArray(r.value)?r.value:[r.value];for(const t of e)a.addClass(t,s)}else if("style"==r.key){const e=Object.keys(r.value);for(const t of e)a.setStyle(t,r.value[t],s)}else a.setAttribute(r.key,r.value,s)}),{priority:e.converterPriority||"normal"})}}(e))}markerToElement(e){return this.add(function(e){return(e=Gs(e)).view=Qs(e.view,"ui"),t=>{var o;t.on("addMarker:"+e.model,(o=e.view,(e,t,n)=>{t.isOpening=!0;const i=o(t,n);t.isOpening=!1;const r=o(t,n);if(!i||!r)return;const s=t.markerRange;if(s.isCollapsed&&!n.consumable.consume(s,e.name))return;for(const t of s)if(!n.consumable.consume(t.item,e.name))return;const a=n.mapper,l=n.writer;l.insert(a.toViewPosition(s.start),i),n.mapper.bindElementToMarker(i,t.markerName),s.isCollapsed||(l.insert(a.toViewPosition(s.end),r),n.mapper.bindElementToMarker(r,t.markerName)),e.stop()}),{priority:e.converterPriority||"normal"}),t.on("removeMarker:"+e.model,(e.view,(e,t,o)=>{const n=o.mapper.markerNameToElements(t.markerName);if(n){for(const e of n)o.mapper.unbindElementFromMarkerName(e,t.markerName),o.writer.clear(o.writer.createRangeOn(e),e);o.writer.clearClonedElementsGroup(t.markerName),e.stop()}}),{priority:e.converterPriority||"normal"})}}(e))}markerToHighlight(e){return this.add(function(e){return t=>{var o;t.on("addMarker:"+e.model,(o=e.view,(e,t,n)=>{if(!t.item)return;if(!(t.item instanceof Ns||t.item instanceof Ws||t.item.is("$textProxy")))return;const i=ea(o,t,n);if(!i)return;if(!n.consumable.consume(t.item,e.name))return;const r=n.writer,s=Js(r,i),a=r.document.selection;if(t.item instanceof Ns||t.item instanceof Ws)r.wrap(a.getFirstRange(),s,a);else{const e=n.mapper.toViewRange(t.range),o=r.wrap(e,s);for(const e of o.getItems())if(e.is("attributeElement")&&e.isSimilar(s)){n.mapper.bindElementToMarker(e,t.markerName);break}}}),{priority:e.converterPriority||"normal"}),t.on("addMarker:"+e.model,function(e){return(t,o,n)=>{if(!o.item)return;if(!(o.item instanceof ys))return;const i=ea(e,o,n);if(!i)return;if(!n.consumable.test(o.item,t.name))return;const r=n.mapper.toViewElement(o.item);if(r&&r.getCustomProperty("addHighlight")){n.consumable.consume(o.item,t.name);for(const e of Es._createIn(o.item))n.consumable.consume(e.item,t.name);r.getCustomProperty("addHighlight")(r,i,n.writer),n.mapper.bindElementToMarker(r,o.markerName)}}}(e.view),{priority:e.converterPriority||"normal"}),t.on("removeMarker:"+e.model,function(e){return(t,o,n)=>{if(o.markerRange.isCollapsed)return;const i=ea(e,o,n);if(!i)return;const r=Js(n.writer,i),s=n.mapper.markerNameToElements(o.markerName);if(s){for(const e of s)n.mapper.unbindElementFromMarkerName(e,o.markerName),e.is("attributeElement")?n.writer.unwrap(n.writer.createRangeOn(e),r):e.getCustomProperty("removeHighlight")(e,i.id,n.writer);n.writer.clearClonedElementsGroup(o.markerName),t.stop()}}}(e.view),{priority:e.converterPriority||"normal"})}}(e))}markerToData(e){return this.add(function(e){const t=(e=Gs(e)).model;e.view||(e.view=o=>({group:t,name:o.substr(e.model.length+1)}));return o=>{var n;o.on("addMarker:"+t,(n=e.view,(e,t,o)=>{const i=n(t.markerName,o);if(!i)return;const r=t.markerRange;o.consumable.consume(r,e.name)&&(Ys(r,!1,o,t,i),Ys(r,!0,o,t,i),e.stop())}),{priority:e.converterPriority||"normal"}),o.on("removeMarker:"+t,function(e){return(t,o,n)=>{const i=e(o.markerName,n);if(!i)return;const r=n.mapper.markerNameToElements(o.markerName);if(r){for(const e of r)n.mapper.unbindElementFromMarkerName(e,o.markerName),e.is("containerElement")?(s(`data-${i.group}-start-before`,e),s(`data-${i.group}-start-after`,e),s(`data-${i.group}-end-before`,e),s(`data-${i.group}-end-after`,e)):n.writer.clear(n.writer.createRangeOn(e),e);n.writer.clearClonedElementsGroup(o.markerName),t.stop()}function s(e,t){if(t.hasAttribute(e)){const o=new Set(t.getAttribute(e).split(","));o.delete(i.name),0==o.size?n.writer.removeAttribute(e,t):n.writer.setAttribute(e,Array.from(o).join(","),t)}}}}(e.view),{priority:e.converterPriority||"normal"})}}(e))}}function Js(e,t){const o=e.createAttributeElement("span",t.attributes);return t.classes&&o._addClass(t.classes),t.priority&&(o._priority=t.priority),o._id=t.id,o}function Ys(e,t,o,n,i){const r=t?e.start:e.end;if(o.schema.checkChild(r,"$text")){!function(e,t,o,n,i){const r=`${i.group}-${t?"start":"end"}`,s=i.name?{name:i.name}:null,a=o.writer.createUIElement(r,s);o.writer.insert(e,a),o.mapper.bindElementToMarker(a,n.markerName)}(o.mapper.toViewPosition(r),t,o,n,i)}else{let e,s;t&&r.nodeAfter||!t&&!r.nodeBefore?(e=r.nodeAfter,s=!0):(e=r.nodeBefore,s=!1);!function(e,t,o,n,i,r){const s=`data-${r.group}-${t?"start":"end"}-${o?"before":"after"}`,a=e.hasAttribute(s)?e.getAttribute(s).split(","):[];a.unshift(r.name),n.writer.setAttribute(s,a.join(","),e),n.mapper.bindElementToMarker(e,i.markerName)}(o.mapper.toViewElement(e),t,s,o,n,i)}}function Qs(e,t){return"function"==typeof e?e:(o,n)=>function(e,t,o){"string"==typeof e&&(e={name:e});let n;const i=t.writer,r=Object.assign({},e.attributes);if("container"==o)n=i.createContainerElement(e.name,r);else if("attribute"==o){const t={priority:e.priority||ai.DEFAULT_PRIORITY};n=i.createAttributeElement(e.name,r,t)}else n=i.createUIElement(e.name,r);if(e.styles){const t=Object.keys(e.styles);for(const o of t)i.setStyle(o,e.styles[o],n)}if(e.classes){const t=e.classes;if("string"==typeof t)i.addClass(t,n);else for(const e of t)i.addClass(e,n)}return n}(e,n,t)}function Xs(e){return e.model.values?(t,o)=>{const n=e.view[t];return n?n(t,o):null}:e.view}function Zs(e){return"string"==typeof e?t=>({key:e,value:t}):"object"==typeof e?e.value?()=>e:t=>({key:e.key,value:t}):e}function ea(e,t,o){const n="function"==typeof e?e(t,o):e;return n?(n.priority||(n.priority=10),n.id||(n.id=t.markerName),n):null}function ta(e){const{schema:t,document:o}=e.model;for(const n of o.getRootNames()){const i=o.getRoot(n);if(i.isEmpty&&!t.checkChild(i,"$text")&&t.checkChild(i,"paragraph"))return e.insertElement("paragraph",i),!0}return!1}function oa(e,t,o){const n=o.createContext(e);return!!o.checkChild(n,"paragraph")&&!!o.checkChild(n.push("paragraph"),t)}function na(e,t){const o=t.createElement("paragraph");return t.insert(o,e),t.createPositionAt(o,0)}class ia extends Us{elementToElement(e){return this.add(ra(e))}elementToAttribute(e){return this.add(function(e){la(e=Gs(e));const t=ca(e,!1),o=sa(e.view),n=o?"element:"+o:"element";return o=>{o.on(n,t,{priority:e.converterPriority||"low"})}}(e))}attributeToAttribute(e){return this.add(function(e){e=Gs(e);let t=null;("string"==typeof e.view||e.view.key)&&(t=function(e){"string"==typeof e.view&&(e.view={key:e.view});const t=e.view.key;let o;if("class"==t||"style"==t){o={["class"==t?"classes":"styles"]:e.view.value}}else{const n=void 0===e.view.value?/[\s\S]*/:e.view.value;o={attributes:{[t]:n}}}e.view.name&&(o.name=e.view.name);return e.view=o,t}(e));la(e,t);const o=ca(e,!0);return t=>{t.on("element",o,{priority:e.converterPriority||"low"})}}(e))}elementToMarker(e){return console.warn(Object(mo.a)("upcast-helpers-element-to-marker-deprecated: The UpcastHelpers#elementToMarker() method was deprecated and will be removed in the near future. Please use UpcastHelpers#dataToMarker() instead.")),this.add(function(e){return function(e){const t=e.model;e.model=(e,o)=>{const n="string"==typeof t?t:t(e,o);return o.writer.createElement("$marker",{"data-name":n})}}(e=Gs(e)),ra(e)}(e))}dataToMarker(e){return this.add(function(e){(e=Gs(e)).model||(e.model=t=>t?e.view+":"+t:e.view);const t=aa(da(e,"start")),o=aa(da(e,"end"));return n=>{n.on("element:"+e.view+"-start",t,{priority:e.converterPriority||"normal"}),n.on("element:"+e.view+"-end",o,{priority:e.converterPriority||"normal"});const i=uo.get("low"),r=uo.get("highest"),s=uo.get(e.converterPriority)/r;n.on("element",function(e){return(t,o,n)=>{const i="data-"+e.view;function r(t,i){for(const r of i){const i=e.model(r,n),s=n.writer.createElement("$marker",{"data-name":i});n.writer.insert(s,t),o.modelCursor.isEqual(t)?o.modelCursor=o.modelCursor.getShiftedBy(1):o.modelCursor=o.modelCursor._getTransformedByInsertion(t,1),o.modelRange=o.modelRange._getTransformedByInsertion(t,1)[0]}}o.modelRange||(o=Object.assign(o,n.convertChildren(o.viewItem,o.modelCursor))),n.consumable.consume(o.viewItem,{attributes:i+"-end-after"})&&r(o.modelRange.end,o.viewItem.getAttribute(i+"-end-after").split(",")),n.consumable.consume(o.viewItem,{attributes:i+"-start-after"})&&r(o.modelRange.end,o.viewItem.getAttribute(i+"-start-after").split(",")),n.consumable.consume(o.viewItem,{attributes:i+"-end-before"})&&r(o.modelRange.start,o.viewItem.getAttribute(i+"-end-before").split(",")),n.consumable.consume(o.viewItem,{attributes:i+"-start-before"})&&r(o.modelRange.start,o.viewItem.getAttribute(i+"-start-before").split(","))}}(e),{priority:i+s})}}(e))}}function ra(e){const t=aa(e=Gs(e)),o=sa(e.view),n=o?"element:"+o:"element";return o=>{o.on(n,t,{priority:e.converterPriority||"normal"})}}function sa(e){return"string"==typeof e?e:"object"==typeof e&&"string"==typeof e.name?e.name:null}function aa(e){const t=new Fo(e.view);return(o,n,i)=>{const r=t.match(n.viewItem);if(!r)return;const s=r.match;if(s.name=!0,!i.consumable.test(n.viewItem,s))return;const a=function(e,t,o){return e instanceof Function?e(t,o):o.writer.createElement(e)}(e.model,n.viewItem,i);a&&i.safeInsert(a,n.modelCursor)&&(i.consumable.consume(n.viewItem,s),i.convertChildren(n.viewItem,a),i.updateConversionResult(a,n))}}function la(e,t=null){const o=null===t||(e=>e.getAttribute(t)),n="object"!=typeof e.model?e.model:e.model.key,i="object"!=typeof e.model||void 0===e.model.value?o:e.model.value;e.model={key:n,value:i}}function ca(e,t){const o=new Fo(e.view);return(n,i,r)=>{const s=o.match(i.viewItem);if(!s)return;const a=e.model.key,l="function"==typeof e.model.value?e.model.value(i.viewItem,r):e.model.value;if(null===l)return;if(!function(e,t){const o="function"==typeof e?e(t):e;if("object"==typeof o&&!sa(o))return!1;return!o.classes&&!o.attributes&&!o.styles}(e.view,i.viewItem)?delete s.match.name:s.match.name=!0,!r.consumable.test(i.viewItem,s.match))return;i.modelRange||(i=Object.assign(i,r.convertChildren(i.viewItem,i.modelCursor)));(function(e,t,o,n){let i=!1;for(const r of Array.from(e.getItems({shallow:o})))n.schema.checkAttribute(r,t.key)&&(n.writer.setAttribute(t.key,t.value,r),i=!0);return i})(i.modelRange,{key:a,value:l},t,r)&&r.consumable.consume(i.viewItem,s.match)}}function da(e,t){const o={};return o.view=e.view+"-"+t,o.model=(t,o)=>{const n=t.getAttribute("name"),i=e.model(n,o);return o.writer.createElement("$marker",{"data-name":i})},o}class ha{constructor(e,t){this.model=e,this.view=new bs(t),this.mapper=new Rs,this.downcastDispatcher=new Os({mapper:this.mapper,schema:e.schema});const o=this.model.document,n=o.selection,i=this.model.markers;this.listenTo(this.model,"_beforeChanges",()=>{this.view._disableRendering(!0)},{priority:"highest"}),this.listenTo(this.model,"_afterChanges",()=>{this.view._disableRendering(!1)},{priority:"lowest"}),this.listenTo(o,"change",()=>{this.view.change(e=>{this.downcastDispatcher.convertChanges(o.differ,i,e),this.downcastDispatcher.convertSelection(n,i,e)})},{priority:"low"}),this.listenTo(this.view.document,"selectionChange",function(e,t){return(o,n)=>{const i=n.newSelection,r=[];for(const e of i.getRanges())r.push(t.toModelRange(e));const s=e.createSelection(r,{backward:i.isBackward});s.isEqual(e.document.selection)||e.change(e=>{e.setSelection(s)})}}(this.model,this.mapper)),this.downcastDispatcher.on("insert:$text",(e,t,o)=>{if(!o.consumable.consume(t.item,"insert"))return;const n=o.writer,i=o.mapper.toViewPosition(t.range.start),r=n.createText(t.item.data);n.insert(i,r)},{priority:"lowest"}),this.downcastDispatcher.on("remove",(e,t,o)=>{const n=o.mapper.toViewPosition(t.position),i=t.position.getShiftedBy(t.length),r=o.mapper.toViewPosition(i,{isPhantom:!0}),s=o.writer.createRange(n,r),a=o.writer.remove(s.getTrimmed());for(const e of o.writer.createRangeIn(a).getItems())o.mapper.unbindViewElement(e)},{priority:"low"}),this.downcastDispatcher.on("selection",(e,t,o)=>{const n=o.writer,i=n.document.selection;for(const e of i.getRanges())e.isCollapsed&&e.end.parent.isAttached()&&o.writer.mergeAttributes(e.start);n.setSelection(null)},{priority:"low"}),this.downcastDispatcher.on("selection",(e,t,o)=>{const n=t.selection;if(n.isCollapsed)return;if(!o.consumable.consume(n,"selection"))return;const i=[];for(const e of n.getRanges()){const t=o.mapper.toViewRange(e);i.push(t)}o.writer.setSelection(i,{backward:n.isBackward})},{priority:"low"}),this.downcastDispatcher.on("selection",(e,t,o)=>{const n=t.selection;if(!n.isCollapsed)return;if(!o.consumable.consume(n,"selection"))return;const i=o.writer,r=n.getFirstPosition(),s=o.mapper.toViewPosition(r),a=i.breakAttributes(s);i.setSelection(a)},{priority:"low"}),this.view.document.roots.bindTo(this.model.document.roots).using(e=>{if("$graveyard"==e.rootName)return null;const t=new Xn(this.view.document,e.name);return t.rootName=e.rootName,this.mapper.bindElements(e,t),t})}destroy(){this.view.destroy(),this.stopListening()}}Co(ha,qn);class ua{constructor(){this._commands=new Map}add(e,t){this._commands.set(e,t)}get(e){return this._commands.get(e)}execute(e,...t){const o=this.get(e);if(!o)throw new mo.b("commandcollection-command-not-found: Command does not exist.",this,{commandName:e});return o.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 ma{constructor(){this._consumables=new Map}add(e,t){let o;e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):(this._consumables.has(e)?o=this._consumables.get(e):(o=new ga(e),this._consumables.set(e,o)),o.add(t))}test(e,t){const o=this._consumables.get(e);return void 0===o?null:e.is("$text")||e.is("documentFragment")?o:o.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 o=this._consumables.get(e);void 0!==o&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):o.revert(t))}static consumablesFromElement(e){const t={element:e,name:!0,attributes:[],classes:[],styles:[]},o=e.getAttributeKeys();for(const e of o)"style"!=e&&"class"!=e&&t.attributes.push(e);const n=e.getClassNames();for(const e of n)t.classes.push(e);const i=e.getStyleNames();for(const e of i)t.styles.push(e);return t}static createFrom(e,t){if(t||(t=new ma(e)),e.is("$text"))return t.add(e),t;e.is("element")&&t.add(e,ma.consumablesFromElement(e)),e.is("documentFragment")&&t.add(e);for(const o of e.getChildren())t=ma.createFrom(o,t);return t}}class ga{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 in this._consumables)t in e&&this._add(t,e[t])}test(e){if(e.name&&!this._canConsumeName)return this._canConsumeName;for(const t in this._consumables)if(t in e){const o=this._test(t,e[t]);if(!0!==o)return o}return!0}consume(e){e.name&&(this._canConsumeName=!1);for(const t in this._consumables)t in e&&this._consume(t,e[t])}revert(e){e.name&&(this._canConsumeName=!0);for(const t in this._consumables)t in e&&this._revert(t,e[t])}_add(e,t){const o=ze(t)?t:[t],n=this._consumables[e];for(const t of o){if("attributes"===e&&("class"===t||"style"===t))throw new mo.b("viewconsumable-invalid-attribute: Classes and styles should be handled separately.",this);if(n.set(t,!0),"styles"===e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(t))n.set(e,!0)}}_test(e,t){const o=ze(t)?t:[t],n=this._consumables[e];for(const t of o)if("attributes"!==e||"class"!==t&&"style"!==t){const e=n.get(t);if(void 0===e)return null;if(!e)return!1}else{const e="class"==t?"classes":"styles",o=this._test(e,[...this._consumables[e].keys()]);if(!0!==o)return o}return!0}_consume(e,t){const o=ze(t)?t:[t],n=this._consumables[e];for(const t of o)if("attributes"!==e||"class"!==t&&"style"!==t){if(n.set(t,!1),"styles"==e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(t))n.set(e,!1)}else{const e="class"==t?"classes":"styles";this._consume(e,[...this._consumables[e].keys()])}}_revert(e,t){const o=ze(t)?t:[t],n=this._consumables[e];for(const t of o)if("attributes"!==e||"class"!==t&&"style"!==t){!1===n.get(t)&&n.set(t,!0)}else{const e="class"==t?"classes":"styles";this._revert(e,[...this._consumables[e].keys()])}}}class fa{constructor(){this._sourceDefinitions={},this._attributeProperties={},this.decorate("checkChild"),this.decorate("checkAttribute"),this.on("checkAttribute",(e,t)=>{t[0]=new pa(t[0])},{priority:"highest"}),this.on("checkChild",(e,t)=>{t[0]=new pa(t[0]),t[1]=this.getDefinition(t[1])},{priority:"highest"})}register(e,t){if(this._sourceDefinitions[e])throw new mo.b("schema-cannot-register-item-twice: A single item cannot be registered twice in the schema.",this,{itemName:e});this._sourceDefinitions[e]=[Object.assign({},t)],this._clearCache()}extend(e,t){if(!this._sourceDefinitions[e])throw new mo.b("schema-cannot-extend-missing-item: Cannot extend an item which was not registered yet.",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:e.is&&(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(t,e)}checkAttribute(e,t){const o=this.getDefinition(e.last);return!!o&&o.allowAttributes.includes(t)}checkMerge(e,t=null){if(e instanceof As){const t=e.nodeBefore,o=e.nodeAfter;if(!(t instanceof ys))throw new mo.b("schema-check-merge-no-element-before: The node before the merge position must be an element.",this);if(!(o instanceof ys))throw new mo.b("schema-check-merge-no-element-after: The node after the merge position must be an element.",this);return this.checkMerge(t,o)}for(const o of t.getChildren())if(!this.checkChild(e,o))return!1;return!0}addChildCheck(e){this.on("checkChild",(t,[o,n])=>{if(!n)return;const i=e(o,n);"boolean"==typeof i&&(t.stop(),t.return=i)},{priority:"high"})}addAttributeCheck(e){this.on("checkAttribute",(t,[o,n])=>{const i=e(o,n);"boolean"==typeof i&&(t.stop(),t.return=i)},{priority:"high"})}setAttributeProperties(e,t){this._attributeProperties[e]=Object.assign(this.getAttributeProperties(e),t)}getAttributeProperties(e){return this._attributeProperties[e]||{}}getLimitElement(e){let t;if(e instanceof As)t=e.parent;else{t=(e instanceof Es?[e]:Array.from(e.getRanges())).reduce((e,t)=>{const o=t.getCommonAncestor();return e?e.getCommonAncestor(o,{includeSelf:!0}):o},null)}for(;!this.isLimit(t)&&t.parent;)t=t.parent;return t}checkAttributeInSelection(e,t){if(e.isCollapsed){const o=[...e.getFirstPosition().getAncestors(),new ks("",e.getAttributes())];return this.checkAttribute(o,t)}{const o=e.getRanges();for(const e of o)for(const o of e)if(this.checkAttribute(o.item,t))return!0}return!1}*getValidRanges(e,t){e=function*(e){for(const t of e)yield*t.getMinimalFlatRanges()}(e);for(const o of e)yield*this._getValidRangesForRange(o,t)}getNearestSelectionRange(e,t="both"){if(this.checkChild(e,"$text"))return new Es(e);let o,n;const i=e.getAncestors().reverse().find(e=>this.isLimit(e))||e.root;"both"!=t&&"backward"!=t||(o=new xs({boundaries:Es._createIn(i),startPosition:e,direction:"backward"})),"both"!=t&&"forward"!=t||(n=new xs({boundaries:Es._createIn(i),startPosition:e}));for(const e of function*(e,t){let o=!1;for(;!o;){if(o=!0,e){const t=e.next();t.done||(o=!1,yield{walker:e,value:t.value})}if(t){const e=t.next();e.done||(o=!1,yield{walker:t,value:e.value})}}}(o,n)){const t=e.walker==o?"elementEnd":"elementStart",n=e.value;if(n.type==t&&this.isObject(n.item))return Es._createOn(n.item);if(this.checkChild(n.nextPosition,"$text"))return new Es(n.nextPosition)}return null}findAllowedParent(e,t){let o=e.parent;for(;o;){if(this.checkChild(o,t))return o;if(this.isLimit(o))return null;o=o.parent}return null}removeDisallowedAttributes(e,t){for(const o of e)if(o.is("$text"))Pa(this,o,t);else{const e=Es._createIn(o).getPositions();for(const o of e){Pa(this,o.nodeBefore||o.parent,t)}}}createContext(e){return new pa(e)}_clearCache(){this._compiledDefinitions=null}_compile(){const e={},t=this._sourceDefinitions,o=Object.keys(t);for(const n of o)e[n]=ba(t[n],n);for(const t of o)wa(e,t);for(const t of o)ka(e,t);for(const t of o)_a(e,t),va(e,t);for(const t of o)ya(e,t),xa(e,t);this._compiledDefinitions=e}_checkContextMatch(e,t,o=t.length-1){const n=t.getItem(o);if(e.allowIn.includes(n.name)){if(0==o)return!0;{const e=this.getDefinition(n);return this._checkContextMatch(e,t,o-1)}}return!1}*_getValidRangesForRange(e,t){let o=e.start,n=e.start;for(const i of e.getItems({shallow:!0}))i.is("element")&&(yield*this._getValidRangesForRange(Es._createIn(i),t)),this.checkAttribute(i,t)||(o.isEqual(n)||(yield new Es(o,n)),o=As._createAfter(i)),n=As._createAfter(i);o.isEqual(n)||(yield new Es(o,n))}}Co(fa,qn);class pa{constructor(e){if(e instanceof pa)return e;"string"==typeof e?e=[e]:Array.isArray(e)||(e=e.getAncestors({includeSelf:!0})),e[0]&&"string"!=typeof e[0]&&e[0].is("documentFragment")&&e.shift(),this._items=e.map(Ta)}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 pa([e]);return t._items=[...this._items,...t._items],t}getItem(e){return this._items[e]}*getNames(){yield*this._items.map(e=>e.name)}endsWith(e){return Array.from(this.getNames()).join(" ").endsWith(e)}startsWith(e){return Array.from(this.getNames()).join(" ").startsWith(e)}}function ba(e,t){const o={name:t,allowIn:[],allowContentOf:[],allowWhere:[],allowAttributes:[],allowAttributesOf:[],inheritTypesFrom:[]};return function(e,t){for(const o of e){const e=Object.keys(o).filter(e=>e.startsWith("is"));for(const n of e)t[n]=o[n]}}(e,o),Ca(e,o,"allowIn"),Ca(e,o,"allowContentOf"),Ca(e,o,"allowWhere"),Ca(e,o,"allowAttributes"),Ca(e,o,"allowAttributesOf"),Ca(e,o,"inheritTypesFrom"),function(e,t){for(const o of e){const e=o.inheritAllFrom;e&&(t.allowContentOf.push(e),t.allowWhere.push(e),t.allowAttributesOf.push(e),t.inheritTypesFrom.push(e))}}(e,o),o}function wa(e,t){for(const o of e[t].allowContentOf)if(e[o]){Aa(e,o).forEach(e=>{e.allowIn.push(t)})}delete e[t].allowContentOf}function ka(e,t){for(const o of e[t].allowWhere){const n=e[o];if(n){const o=n.allowIn;e[t].allowIn.push(...o)}}delete e[t].allowWhere}function _a(e,t){for(const o of e[t].allowAttributesOf){const n=e[o];if(n){const o=n.allowAttributes;e[t].allowAttributes.push(...o)}}delete e[t].allowAttributesOf}function va(e,t){const o=e[t];for(const t of o.inheritTypesFrom){const n=e[t];if(n){const e=Object.keys(n).filter(e=>e.startsWith("is"));for(const t of e)t in o||(o[t]=n[t])}}delete o.inheritTypesFrom}function ya(e,t){const o=e[t],n=o.allowIn.filter(t=>e[t]);o.allowIn=Array.from(new Set(n))}function xa(e,t){const o=e[t];o.allowAttributes=Array.from(new Set(o.allowAttributes))}function Ca(e,t,o){for(const n of e)"string"==typeof n[o]?t[o].push(n[o]):Array.isArray(n[o])&&t[o].push(...n[o])}function Aa(e,t){const o=e[t];return(n=e,Object.keys(n).map(e=>n[e])).filter(e=>e.allowIn.includes(o.name));var n}function Ta(e){return"string"==typeof e?{name:e,*getAttributeKeys(){},getAttribute(){}}:{name:e.is("element")?e.name:"$text",*getAttributeKeys(){yield*e.getAttributeKeys()},getAttribute:t=>e.getAttribute(t)}}function Pa(e,t,o){for(const n of t.getAttributeKeys())e.checkAttribute(t,n)||o.removeAttribute(n,t)}class Sa{constructor(e={}){this._splitParts=new Map,this._cursorParents=new Map,this._modelCursor=null,this.conversionApi=Object.assign({},e),this.conversionApi.convertItem=this._convertItem.bind(this),this.conversionApi.convertChildren=this._convertChildren.bind(this),this.conversionApi.safeInsert=this._safeInsert.bind(this),this.conversionApi.updateConversionResult=this._updateConversionResult.bind(this),this.conversionApi.splitToAllowedParent=this._splitToAllowedParent.bind(this),this.conversionApi.getSplitParts=this._getSplitParts.bind(this)}convert(e,t,o=["$root"]){this.fire("viewCleanup",e),this._modelCursor=function(e,t){let o;for(const n of new pa(e)){const e={};for(const t of n.getAttributeKeys())e[t]=n.getAttribute(t);const i=t.createElement(n.name,e);o&&t.append(i,o),o=As._createAt(i,0)}return o}(o,t),this.conversionApi.writer=t,this.conversionApi.consumable=ma.createFrom(e),this.conversionApi.store={};const{modelRange:n}=this._convertItem(e,this._modelCursor),i=t.createDocumentFragment();if(n){this._removeEmptyElements();for(const e of Array.from(this._modelCursor.parent.getChildren()))t.append(e,i);i.markers=function(e,t){const o=new Set,n=new Map,i=Es._createIn(e).getItems();for(const e of i)"$marker"==e.name&&o.add(e);for(const e of o){const o=e.getAttribute("data-name"),i=t.createPositionBefore(e);n.has(o)?n.get(o).end=i.clone():n.set(o,new Es(i.clone())),t.remove(e)}return n}(i,t)}return this._modelCursor=null,this._splitParts.clear(),this._cursorParents.clear(),this.conversionApi.writer=null,this.conversionApi.store=null,i}_convertItem(e,t){const o=Object.assign({viewItem:e,modelCursor:t,modelRange:null});if(e.is("element")?this.fire("element:"+e.name,o,this.conversionApi):e.is("$text")?this.fire("text",o,this.conversionApi):this.fire("documentFragment",o,this.conversionApi),o.modelRange&&!(o.modelRange instanceof Es))throw new mo.b("view-conversion-dispatcher-incorrect-result: Incorrect conversion result was dropped.",this);return{modelRange:o.modelRange,modelCursor:o.modelCursor}}_convertChildren(e,t){let o=t.is("position")?t:As._createAt(t,0);const n=new Es(o);for(const t of Array.from(e.getChildren())){const e=this._convertItem(t,o);e.modelRange instanceof Es&&(n.end=e.modelRange.end,o=e.modelCursor)}return{modelRange:n,modelCursor:o}}_safeInsert(e,t){const o=this._splitToAllowedParent(e,t);return!!o&&(this.conversionApi.writer.insert(e,o.position),!0)}_updateConversionResult(e,t){const o=this._getSplitParts(e),n=this.conversionApi.writer;t.modelRange||(t.modelRange=n.createRange(n.createPositionBefore(e),n.createPositionAfter(o[o.length-1])));const i=this._cursorParents.get(e);t.modelCursor=i?n.createPositionAt(i,0):t.modelRange.end}_splitToAllowedParent(e,t){const{schema:o,writer:n}=this.conversionApi;let i=o.findAllowedParent(t,e);if(i){if(i===t.parent)return{position:t};this._modelCursor.parent.getAncestors().includes(i)&&(i=null)}if(!i)return oa(t,e,o)?{position:na(t,n)}:null;const r=this.conversionApi.writer.split(t,i),s=[];for(const e of r.range.getWalker())if("elementEnd"==e.type)s.push(e.item);else{const t=s.pop(),o=e.item;this._registerSplitPair(t,o)}const a=r.range.end.parent;return this._cursorParents.set(e,a),{position:r.position,cursorParent:a}}_registerSplitPair(e,t){this._splitParts.has(e)||this._splitParts.set(e,[e]);const o=this._splitParts.get(e);this._splitParts.set(t,o),o.push(t)}_getSplitParts(e){let t;return t=this._splitParts.has(e)?this._splitParts.get(e):[e],t}_removeEmptyElements(){let e=!1;for(const t of this._splitParts.keys())t.isEmpty&&(this.conversionApi.writer.remove(t),this._splitParts.delete(t),e=!0);e&&this._removeEmptyElements()}}Co(Sa,po);class Ea{constructor(e,t){this.model=e,this.stylesProcessor=t,this.processor,this.mapper=new Rs,this.downcastDispatcher=new Os({mapper:this.mapper,schema:e.schema}),this.downcastDispatcher.on("insert:$text",(e,t,o)=>{if(!o.consumable.consume(t.item,"insert"))return;const n=o.writer,i=o.mapper.toViewPosition(t.range.start),r=n.createText(t.item.data);n.insert(i,r)},{priority:"lowest"}),this.upcastDispatcher=new Sa({schema:e.schema}),this.viewDocument=new si(t),this._viewWriter=new Ri(this.viewDocument),this.upcastDispatcher.on("text",(e,t,{schema:o,consumable:n,writer:i})=>{let r=t.modelCursor;if(!n.test(t.viewItem))return;if(!o.checkChild(r,"$text")){if(!oa(r,"$text",o))return;r=na(r,i)}n.consume(t.viewItem);const s=i.createText(t.viewItem.data);i.insert(s,r),t.modelRange=i.createRange(r,r.getShiftedBy(s.offsetSize)),t.modelCursor=t.modelRange.end},{priority:"lowest"}),this.upcastDispatcher.on("element",(e,t,o)=>{if(!t.modelRange&&o.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:n}=o.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=n}},{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",(e,t,o)=>{if(!t.modelRange&&o.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:n}=o.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=n}},{priority:"lowest"}),this.decorate("init"),this.decorate("set"),this.on("init",()=>{this.fire("ready")},{priority:"lowest"}),this.on("ready",()=>{this.model.enqueueChange("transparent",ta)},{priority:"lowest"})}get(e={}){const{rootName:t="main",trim:o="empty"}=e;if(!this._checkIfRootsExists([t]))throw new mo.b("datacontroller-get-non-existent-root: Attempting to get data from a non-existing root.",this);const n=this.model.document.getRoot(t);return"empty"!==o||this.model.hasContent(n,{ignoreWhitespaces:!0})?this.stringify(n,e):""}stringify(e,t){const o=this.toView(e,t);return this.processor.toData(o)}toView(e,t){const o=this.viewDocument,n=this._viewWriter;this.mapper.clearBindings();const i=Es._createIn(e),r=new Ei(o);if(this.mapper.bindElements(e,r),this.downcastDispatcher.conversionApi.options=t,this.downcastDispatcher.convertInsert(i,n),!e.is("documentFragment")){const t=function(e){const t=[],o=e.root.document;if(!o)return[];const n=Es._createIn(e);for(const e of o.model.markers){const o=n.getIntersection(e.getRange());o&&t.push([e.name,o])}return t}(e);for(const[e,o]of t)this.downcastDispatcher.convertMarkerAdd(e,o,n)}return delete this.downcastDispatcher.conversionApi.options,r}init(e){if(this.model.document.version)throw new mo.b("datacontroller-init-document-not-empty: Trying to set initial data to not empty document.",this);let t={};if("string"==typeof e?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new mo.b("datacontroller-init-non-existent-root: Attempting to init data on a non-existing root.",this);return this.model.enqueueChange("transparent",e=>{for(const o of Object.keys(t)){const n=this.model.document.getRoot(o);e.insert(this.parse(t[o],n),n,0)}}),Promise.resolve()}set(e){let t={};if("string"==typeof e?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new mo.b("datacontroller-set-non-existent-root: Attempting to set data on a non-existing root.",this);this.model.enqueueChange("transparent",e=>{e.setSelection(null),e.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());for(const o of Object.keys(t)){const n=this.model.document.getRoot(o);e.remove(e.createRangeIn(n)),e.insert(this.parse(t[o],n),n,0)}})}parse(e,t="$root"){const o=this.processor.toView(e);return this.toModel(o,t)}toModel(e,t="$root"){return this.model.change(o=>this.upcastDispatcher.convert(e,o,t))}addStyleProcessorRules(e){e(this.stylesProcessor)}destroy(){this.stopListening()}_checkIfRootsExists(e){for(const t of e)if(!this.model.document.getRootNames().includes(t))return!1;return!0}}Co(Ea,qn);class Ra{constructor(e,t){this._helpers=new Map,this._downcast=Array.isArray(e)?e:[e],this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=Array.isArray(t)?t:[t],this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:!1})}addAlias(e,t){const o=this._downcast.includes(t);if(!this._upcast.includes(t)&&!o)throw new mo.b("conversion-add-alias-dispatcher-not-registered: Trying to register and alias for a dispatcher that nas not been registered.",this);this._createConversionHelpers({name:e,dispatchers:[t],isDowncast:o})}for(e){if(!this._helpers.has(e))throw new mo.b("conversion-for-unknown-group: Trying to add a converter to an unknown dispatchers group.",this);return this._helpers.get(e)}elementToElement(e){this.for("downcast").elementToElement(e);for(const{model:t,view:o}of Ia(e))this.for("upcast").elementToElement({model:t,view:o,converterPriority:e.converterPriority})}attributeToElement(e){this.for("downcast").attributeToElement(e);for(const{model:t,view:o}of Ia(e))this.for("upcast").elementToAttribute({view:o,model:t,converterPriority:e.converterPriority})}attributeToAttribute(e){this.for("downcast").attributeToAttribute(e);for(const{model:t,view:o}of Ia(e))this.for("upcast").attributeToAttribute({view:o,model:t})}_createConversionHelpers({name:e,dispatchers:t,isDowncast:o}){if(this._helpers.has(e))throw new mo.b("conversion-group-exists: Trying to register a group name that has already been registered.",this);const n=o?new Ks(t):new ia(t);this._helpers.set(e,n)}}function*Ia(e){if(e.model.values)for(const t of e.model.values){const o={key:e.model.key,value:t},n=e.view[t],i=e.upcastAlso?e.upcastAlso[t]:void 0;yield*Va(o,n,i)}else yield*Va(e.model,e.view,e.upcastAlso)}function*Va(e,t,o){if(yield{model:e,view:t},o){o=Array.isArray(o)?o:[o];for(const t of o)yield{model:e,view:t}}}class Oa{constructor(e="default"){this.operations=[],this.type=e}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 Ma{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){return new this(e.baseVersion)}}class Na{constructor(e){this.markers=new Map,this._children=new vs,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 root(){return this}get parent(){return null}is(e){return"documentFragment"===e||"model:documentFragment"===e}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 o of e)t=t.getChild(t.offsetToIndex(o));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 o of e)o.name?t.push(ys.fromJSON(o)):t.push(ks.fromJSON(o));return new Na(t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const o=function(e){if("string"==typeof e)return[new ks(e)];xo(e)||(e=[e]);return Array.from(e).map(e=>"string"==typeof e?new ks(e):e instanceof _s?new ks(e.data,e.getAttributes()):e)}(t);for(const e of o)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,o)}_removeChildren(e,t=1){const o=this._children._removeNodes(e,t);for(const e of o)e.parent=null;return o}}function za(e,t){const o=(t=Da(t)).reduce((e,t)=>e+t.offsetSize,0),n=e.parent;Ha(e);const i=e.index;return n._insertChild(i,t),La(n,i+t.length),La(n,i),new Es(e,e.getShiftedBy(o))}function Ba(e){if(!e.isFlat)throw new mo.b("operation-utils-remove-range-not-flat: Trying to remove a range which starts and ends in different element.",this);const t=e.start.parent;Ha(e.start),Ha(e.end);const o=t._removeChildren(e.start.index,e.end.index-e.start.index);return La(t,e.start.index),o}function Fa(e,t){if(!e.isFlat)throw new mo.b("operation-utils-move-range-not-flat: Trying to move a range which starts and ends in different element.",this);const o=Ba(e);return za(t=t._getTransformedByDeletion(e.start,e.end.offset-e.start.offset),o)}function Da(e){const t=[];e instanceof Array||(e=[e]);for(let o=0;o<e.length;o++)if("string"==typeof e[o])t.push(new ks(e[o]));else if(e[o]instanceof _s)t.push(new ks(e[o].data,e[o].getAttributes()));else if(e[o]instanceof Na||e[o]instanceof vs)for(const n of e[o])t.push(n);else e[o]instanceof ws&&t.push(e[o]);for(let e=1;e<t.length;e++){const o=t[e],n=t[e-1];o instanceof ks&&n instanceof ks&&ja(o,n)&&(t.splice(e-1,2,new ks(n.data+o.data,n.getAttributes())),e--)}return t}function La(e,t){const o=e.getChild(t-1),n=e.getChild(t);if(o&&n&&o.is("$text")&&n.is("$text")&&ja(o,n)){const i=new ks(o.data+n.data,o.getAttributes());e._removeChildren(t-1,2),e._insertChild(t-1,i)}}function Ha(e){const t=e.textNode,o=e.parent;if(t){const n=e.offset-t.startOffset,i=t.index;o._removeChildren(i,1);const r=new ks(t.data.substr(0,n),t.getAttributes()),s=new ks(t.data.substr(n),t.getAttributes());o._insertChild(i,[r,s])}}function ja(e,t){const o=e.getAttributes(),n=t.getAttributes();for(const e of o){if(e[1]!==t.getAttribute(e[0]))return!1;n.next()}return n.next().done}var Wa=function(e,t){return Mr(e,t)};class qa extends Ma{constructor(e,t,o,n,i){super(i),this.range=e.clone(),this.key=t,this.oldValue=void 0===o?null:o,this.newValue=void 0===n?null:n}get type(){return null===this.oldValue?"addAttribute":null===this.newValue?"removeAttribute":"changeAttribute"}clone(){return new qa(this.range,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new qa(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 mo.b("attribute-operation-range-not-flat: The range to change is not flat.",this);for(const e of this.range.getItems({shallow:!0})){if(null!==this.oldValue&&!Wa(e.getAttribute(this.key),this.oldValue))throw new mo.b("attribute-operation-wrong-old-value: Changed node has different attribute value than operation's old attribute value.",this,{item:e,key:this.key,value:this.oldValue});if(null===this.oldValue&&null!==this.newValue&&e.hasAttribute(this.key))throw new mo.b("attribute-operation-attribute-exists: The attribute with given key already exists.",this,{node:e,key:this.key})}}_execute(){Wa(this.oldValue,this.newValue)||function(e,t,o){Ha(e.start),Ha(e.end);for(const n of e.getItems({shallow:!0})){const e=n.is("$textProxy")?n.textNode:n;null!==o?e._setAttribute(t,o):e._removeAttribute(t),La(e.parent,e.index)}La(e.end.parent,e.end.index)}(this.range,this.key,this.newValue)}static get className(){return"AttributeOperation"}static fromJSON(e,t){return new qa(Es.fromJSON(e.range,t),e.key,e.oldValue,e.newValue,e.baseVersion)}}class $a extends Ma{constructor(e,t){super(null),this.sourcePosition=e.clone(),this.howMany=t}get type(){return"detach"}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e}_validate(){if(this.sourcePosition.root.document)throw new mo.b("detach-operation-on-document-node: Cannot detach document node.",this)}_execute(){Ba(Es._createFromPositionAndShift(this.sourcePosition,this.howMany))}static get className(){return"DetachOperation"}}class Ua extends Ma{constructor(e,t,o,n){super(n),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toNext",this.howMany=t,this.targetPosition=o.clone(),this.targetPosition.stickiness="toNone"}get type(){return"$graveyard"==this.targetPosition.root.rootName?"remove":"$graveyard"==this.sourcePosition.root.rootName?"reinsert":"move"}clone(){return new this.constructor(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 this.constructor(this.getMovedRangeStart(),this.howMany,e,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent,o=this.sourcePosition.offset,n=this.targetPosition.offset;if(o+this.howMany>e.maxOffset)throw new mo.b("move-operation-nodes-do-not-exist: The nodes which should be moved do not exist.",this);if(e===t&&o<n&&n<o+this.howMany)throw new mo.b("move-operation-range-into-itself: Trying to move a range of nodes to the inside of that range.",this);if(this.sourcePosition.root==this.targetPosition.root&&"prefix"==Vo(this.sourcePosition.getParentPath(),this.targetPosition.getParentPath())){const e=this.sourcePosition.path.length-1;if(this.targetPosition.path[e]>=o&&this.targetPosition.path[e]<o+this.howMany)throw new mo.b("move-operation-node-into-itself: Trying to move a range of nodes into one of nodes from that range.",this)}}_execute(){Fa(Es._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 o=As.fromJSON(e.sourcePosition,t),n=As.fromJSON(e.targetPosition,t);return new this(o,e.howMany,n,e.baseVersion)}}class Ga extends Ma{constructor(e,t,o){super(o),this.position=e.clone(),this.position.stickiness="toNone",this.nodes=new vs(Da(t)),this.shouldReceiveAttributes=!1}get type(){return"insert"}get howMany(){return this.nodes.maxOffset}clone(){const e=new vs([...this.nodes].map(e=>e._clone(!0))),t=new Ga(this.position,e,this.baseVersion);return t.shouldReceiveAttributes=this.shouldReceiveAttributes,t}getReversed(){const e=this.position.root.document.graveyard,t=new As(e,[0]);return new Ua(this.position,this.nodes.maxOffset,t,this.baseVersion+1)}_validate(){const e=this.position.parent;if(!e||e.maxOffset<this.position.offset)throw new mo.b("insert-operation-position-invalid: Insertion position is invalid.",this)}_execute(){const e=this.nodes;this.nodes=new vs([...e].map(e=>e._clone(!0))),za(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 o=[];for(const t of e.nodes)t.name?o.push(ys.fromJSON(t)):o.push(ks.fromJSON(t));const n=new Ga(As.fromJSON(e.position,t),o,e.baseVersion);return n.shouldReceiveAttributes=e.shouldReceiveAttributes,n}}class Ka extends Ma{constructor(e,t,o,n,i,r){super(r),this.name=e,this.oldRange=t?t.clone():null,this.newRange=o?o.clone():null,this.affectsData=i,this._markers=n}get type(){return"marker"}clone(){return new Ka(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new Ka(this.name,this.newRange,this.oldRange,this._markers,this.affectsData,this.baseVersion+1)}_execute(){const e=this.newRange?"_set":"_remove";this._markers[e](this.name,this.newRange,!0,this.affectsData)}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 Ka(e.name,e.oldRange?Es.fromJSON(e.oldRange,t):null,e.newRange?Es.fromJSON(e.newRange,t):null,t.model.markers,e.affectsData,e.baseVersion)}}class Ja extends Ma{constructor(e,t,o,n){super(n),this.position=e,this.position.stickiness="toNext",this.oldName=t,this.newName=o}get type(){return"rename"}clone(){return new Ja(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new Ja(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){const e=this.position.nodeAfter;if(!(e instanceof ys))throw new mo.b("rename-operation-wrong-position: Given position is invalid or node after it is not an instance of Element.",this);if(e.name!==this.oldName)throw new mo.b("rename-operation-wrong-name: Element to change has different name than operation's old 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 Ja(As.fromJSON(e.position,t),e.oldName,e.newName,e.baseVersion)}}class Ya extends Ma{constructor(e,t,o,n,i){super(i),this.root=e,this.key=t,this.oldValue=o,this.newValue=n}get type(){return null===this.oldValue?"addRootAttribute":null===this.newValue?"removeRootAttribute":"changeRootAttribute"}clone(){return new Ya(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new Ya(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is("documentFragment"))throw new mo.b("rootattribute-operation-not-a-root: The element to change is not a root element.",this,{root:this.root,key:this.key});if(null!==this.oldValue&&this.root.getAttribute(this.key)!==this.oldValue)throw new mo.b("rootattribute-operation-wrong-old-value: Changed node has different attribute value than operation's old attribute value.",this,{root:this.root,key:this.key});if(null===this.oldValue&&null!==this.newValue&&this.root.hasAttribute(this.key))throw new mo.b("rootattribute-operation-attribute-exists: The attribute with given key already 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 mo.b("rootattribute-operation-fromjson-no-root: Cannot create RootAttributeOperation. Root with specified name does not exist.",this,{rootName:e.root});return new Ya(t.getRoot(e.root),e.key,e.oldValue,e.newValue,e.baseVersion)}}class Qa extends Ma{constructor(e,t,o,n,i){super(i),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toPrevious",this.howMany=t,this.targetPosition=o.clone(),this.targetPosition.stickiness="toNext",this.graveyardPosition=n.clone()}get type(){return"merge"}get deletionPosition(){return new As(this.sourcePosition.root,this.sourcePosition.path.slice(0,-1))}get movedRange(){const e=this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);return new Es(this.sourcePosition,e)}clone(){return new this.constructor(this.sourcePosition,this.howMany,this.targetPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.targetPosition._getTransformedByMergeOperation(this),t=this.sourcePosition.path.slice(0,-1),o=new As(this.sourcePosition.root,t)._getTransformedByMergeOperation(this),n=new Xa(e,this.howMany,this.graveyardPosition,this.baseVersion+1);return n.insertionPosition=o,n}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent;if(!e.parent)throw new mo.b("merge-operation-source-position-invalid: Merge source position is invalid.",this);if(!t.parent)throw new mo.b("merge-operation-target-position-invalid: Merge target position is invalid.",this);if(this.howMany!=e.maxOffset)throw new mo.b("merge-operation-how-many-invalid: Merge operation specifies wrong number of nodes to move.",this)}_execute(){const e=this.sourcePosition.parent;Fa(Es._createIn(e),this.targetPosition),Fa(Es._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 o=As.fromJSON(e.sourcePosition,t),n=As.fromJSON(e.targetPosition,t),i=As.fromJSON(e.graveyardPosition,t);return new this(o,e.howMany,n,i,e.baseVersion)}}class Xa extends Ma{constructor(e,t,o,n){super(n),this.splitPosition=e.clone(),this.splitPosition.stickiness="toNext",this.howMany=t,this.insertionPosition=Xa.getInsertionPosition(e),this.insertionPosition.stickiness="toNone",this.graveyardPosition=o?o.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 As(this.insertionPosition.root,e)}get movedRange(){const e=this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);return new Es(this.splitPosition,e)}clone(){const e=new this.constructor(this.splitPosition,this.howMany,this.graveyardPosition,this.baseVersion);return e.insertionPosition=this.insertionPosition,e}getReversed(){const e=this.splitPosition.root.document.graveyard,t=new As(e,[0]);return new Qa(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 mo.b("split-operation-position-invalid: Split position is invalid.",this);if(!e.parent)throw new mo.b("split-operation-split-in-root: Cannot split root element.",this);if(this.howMany!=e.maxOffset-this.splitPosition.offset)throw new mo.b("split-operation-how-many-invalid: Split operation specifies wrong number of nodes to move.",this);if(this.graveyardPosition&&!this.graveyardPosition.nodeAfter)throw new mo.b("split-operation-graveyard-position-invalid: Graveyard position invalid.",this)}_execute(){const e=this.splitPosition.parent;if(this.graveyardPosition)Fa(Es._createFromPositionAndShift(this.graveyardPosition,1),this.insertionPosition);else{const t=e._clone();za(this.insertionPosition,t)}Fa(new Es(As._createAt(e,this.splitPosition.offset),As._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 As(e.root,t)}static fromJSON(e,t){const o=As.fromJSON(e.splitPosition,t),n=As.fromJSON(e.insertionPosition,t),i=e.graveyardPosition?As.fromJSON(e.graveyardPosition,t):null,r=new this(o,e.howMany,i,e.baseVersion);return r.insertionPosition=n,r}}class Za extends ys{constructor(e,t,o="main"){super(t),this._document=e,this.rootName=o}get document(){return this._document}is(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}toJSON(){return this.rootName}}class el{constructor(e,t){this.model=e,this.batch=t}createText(e,t){return new ks(e,t)}createElement(e,t){return new ys(e,t)}createDocumentFragment(){return new Na}cloneElement(e,t=!0){return e._clone(t)}insert(e,t,o=0){if(this._assertWriterUsedCorrectly(),e instanceof ks&&""==e.data)return;const n=As._createAt(t,o);if(e.parent){if(rl(e.root,n.root))return void this.move(Es._createOn(e),n);if(e.root.document)throw new mo.b("model-writer-insert-forbidden-move: Cannot move a node from a document to a different tree. It is forbidden to move a node that was already in a document outside of it.",this);this.remove(e)}const i=n.root.document?n.root.document.version:null,r=new Ga(n,e,i);if(e instanceof ks&&(r.shouldReceiveAttributes=!0),this.batch.addOperation(r),this.model.applyOperation(r),e instanceof Na)for(const[t,o]of e.markers){const e=As._createAt(o.root,0),i={range:new Es(o.start._getCombined(e,n),o.end._getCombined(e,n)),usingOperation:!0,affectsData:!0};this.model.markers.has(t)?this.updateMarker(t,i):this.addMarker(t,i)}}insertText(e,t,o,n){t instanceof Na||t instanceof ys||t instanceof As?this.insert(this.createText(e),t,o):this.insert(this.createText(e,t),o,n)}insertElement(e,t,o,n){t instanceof Na||t instanceof ys||t instanceof As?this.insert(this.createElement(e),t,o):this.insert(this.createElement(e,t),o,n)}append(e,t){this.insert(e,t,"end")}appendText(e,t,o){t instanceof Na||t instanceof ys?this.insert(this.createText(e),t,"end"):this.insert(this.createText(e,t),o,"end")}appendElement(e,t,o){t instanceof Na||t instanceof ys?this.insert(this.createElement(e),t,"end"):this.insert(this.createElement(e,t),o,"end")}setAttribute(e,t,o){if(this._assertWriterUsedCorrectly(),o instanceof Es){const n=o.getMinimalFlatRanges();for(const o of n)tl(this,e,t,o)}else ol(this,e,t,o)}setAttributes(e,t){for(const[o,n]of Bo(e))this.setAttribute(o,n,t)}removeAttribute(e,t){if(this._assertWriterUsedCorrectly(),t instanceof Es){const o=t.getMinimalFlatRanges();for(const t of o)tl(this,e,null,t)}else ol(this,e,null,t)}clearAttributes(e){this._assertWriterUsedCorrectly();const t=e=>{for(const t of e.getAttributeKeys())this.removeAttribute(t,e)};if(e instanceof Es)for(const o of e.getItems())t(o);else t(e)}move(e,t,o){if(this._assertWriterUsedCorrectly(),!(e instanceof Es))throw new mo.b("writer-move-invalid-range: Invalid range to move.",this);if(!e.isFlat)throw new mo.b("writer-move-range-not-flat: Range to move is not flat.",this);const n=As._createAt(t,o);if(n.isEqual(e.start))return;if(this._addOperationForAffectedMarkers("move",e),!rl(e.root,n.root))throw new mo.b("writer-move-different-document: Range is going to be moved between different documents.",this);const i=e.root.document?e.root.document.version:null,r=new Ua(e.start,e.end.offset-e.start.offset,n,i);this.batch.addOperation(r),this.model.applyOperation(r)}remove(e){this._assertWriterUsedCorrectly();const t=(e instanceof Es?e:Es._createOn(e)).getMinimalFlatRanges().reverse();for(const e of t)this._addOperationForAffectedMarkers("move",e),il(e.start,e.end.offset-e.start.offset,this.batch,this.model)}merge(e){this._assertWriterUsedCorrectly();const t=e.nodeBefore,o=e.nodeAfter;if(this._addOperationForAffectedMarkers("merge",e),!(t instanceof ys))throw new mo.b("writer-merge-no-element-before: Node before merge position must be an element.",this);if(!(o instanceof ys))throw new mo.b("writer-merge-no-element-after: Node after merge position must be an element.",this);e.root.document?this._merge(e):this._mergeDetached(e)}createPositionFromPath(e,t,o){return this.model.createPositionFromPath(e,t,o)}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,t,o){return this.model.createSelection(e,t,o)}_mergeDetached(e){const t=e.nodeBefore,o=e.nodeAfter;this.move(Es._createIn(o),As._createAt(t,"end")),this.remove(o)}_merge(e){const t=As._createAt(e.nodeBefore,"end"),o=As._createAt(e.nodeAfter,0),n=e.root.document.graveyard,i=new As(n,[0]),r=e.root.document.version,s=new Qa(o,e.nodeAfter.maxOffset,t,i,r);this.batch.addOperation(s),this.model.applyOperation(s)}rename(e,t){if(this._assertWriterUsedCorrectly(),!(e instanceof ys))throw new mo.b("writer-rename-not-element-instance: Trying to rename an object which is not an instance of Element.",this);const o=e.root.document?e.root.document.version:null,n=new Ja(As._createBefore(e),e.name,t,o);this.batch.addOperation(n),this.model.applyOperation(n)}split(e,t){this._assertWriterUsedCorrectly();let o,n,i=e.parent;if(!i.parent)throw new mo.b("writer-split-element-no-parent: Element with no parent can not be split.",this);if(t||(t=i.parent),!e.parent.getAncestors({includeSelf:!0}).includes(t))throw new mo.b("writer-split-invalid-limit-element: Limit element is not a position ancestor.",this);do{const t=i.root.document?i.root.document.version:null,r=i.maxOffset-e.offset,s=new Xa(e,r,null,t);this.batch.addOperation(s),this.model.applyOperation(s),o||n||(o=i,n=e.parent.nextSibling),i=(e=this.createPositionAfter(e.parent)).parent}while(i!==t);return{position:e,range:new Es(As._createAt(o,"end"),As._createAt(n,0))}}wrap(e,t){if(this._assertWriterUsedCorrectly(),!e.isFlat)throw new mo.b("writer-wrap-range-not-flat: Range to wrap is not flat.",this);const o=t instanceof ys?t:new ys(t);if(o.childCount>0)throw new mo.b("writer-wrap-element-not-empty: Element to wrap with is not empty.",this);if(null!==o.parent)throw new mo.b("writer-wrap-element-attached: Element to wrap with is already attached to tree model.",this);this.insert(o,e.start);const n=new Es(e.start.getShiftedBy(1),e.end.getShiftedBy(1));this.move(n,As._createAt(o,0))}unwrap(e){if(this._assertWriterUsedCorrectly(),null===e.parent)throw new mo.b("writer-unwrap-element-no-parent: Trying to unwrap an element which has no parent.",this);this.move(Es._createIn(e),this.createPositionAfter(e)),this.remove(e)}addMarker(e,t){if(this._assertWriterUsedCorrectly(),!t||"boolean"!=typeof t.usingOperation)throw new mo.b("writer-addMarker-no-usingOperation: The options.usingOperation parameter is required when adding a new marker.",this);const o=t.usingOperation,n=t.range,i=void 0!==t.affectsData&&t.affectsData;if(this.model.markers.has(e))throw new mo.b("writer-addMarker-marker-exists: Marker with provided name already exists.",this);if(!n)throw new mo.b("writer-addMarker-no-range: Range parameter is required when adding a new marker.",this);return o?(nl(this,e,null,n,i),this.model.markers.get(e)):this.model.markers._set(e,n,o,i)}updateMarker(e,t){this._assertWriterUsedCorrectly();const o="string"==typeof e?e:e.name,n=this.model.markers.get(o);if(!n)throw new mo.b("writer-updateMarker-marker-not-exists: Marker with provided name does not exists.",this);if(!t)return void this.model.markers._refresh(n);const i="boolean"==typeof t.usingOperation,r="boolean"==typeof t.affectsData,s=r?t.affectsData:n.affectsData;if(!i&&!t.range&&!r)throw new mo.b("writer-updateMarker-wrong-options: One of the options is required - provide range, usingOperations or affectsData.",this);const a=n.getRange(),l=t.range?t.range:a;i&&t.usingOperation!==n.managedUsingOperations?t.usingOperation?nl(this,o,null,l,s):(nl(this,o,a,null,s),this.model.markers._set(o,l,void 0,s)):n.managedUsingOperations?nl(this,o,a,l,s):this.model.markers._set(o,l,void 0,s)}removeMarker(e){this._assertWriterUsedCorrectly();const t="string"==typeof e?e:e.name;if(!this.model.markers.has(t))throw new mo.b("writer-removeMarker-no-marker: Trying to remove marker which does not exist.",this);const o=this.model.markers.get(t);if(!o.managedUsingOperations)return void this.model.markers._remove(t);nl(this,t,o.getRange(),null,o.affectsData)}setSelection(e,t,o){this._assertWriterUsedCorrectly(),this.model.document.selection._setTo(e,t,o)}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,o]of Bo(e))this._setSelectionAttribute(t,o)}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 o=this.model.document.selection;if(o.isCollapsed&&o.anchor.parent.isEmpty){const n=Ws._getStoreAttributeKey(e);this.setAttribute(n,t,o.anchor.parent)}o._setAttribute(e,t)}_removeSelectionAttribute(e){const t=this.model.document.selection;if(t.isCollapsed&&t.anchor.parent.isEmpty){const o=Ws._getStoreAttributeKey(e);this.removeAttribute(o,t.anchor.parent)}t._removeAttribute(e)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new mo.b("writer-incorrect-use: Trying to use a writer outside the change() block.",this)}_addOperationForAffectedMarkers(e,t){for(const o of this.model.markers){if(!o.managedUsingOperations)continue;const n=o.getRange();let i=!1;if("move"===e)i=t.containsPosition(n.start)||t.start.isEqual(n.start)||t.containsPosition(n.end)||t.end.isEqual(n.end);else{const e=t.nodeBefore,o=t.nodeAfter,r=n.start.parent==e&&n.start.isAtEnd,s=n.end.parent==o&&0==n.end.offset,a=n.end.nodeAfter==o,l=n.start.nodeAfter==o;i=r||s||a||l}i&&this.updateMarker(o.name,{range:n})}}}function tl(e,t,o,n){const i=e.model,r=i.document;let s,a,l,c=n.start;for(const e of n.getWalker({shallow:!0}))l=e.item.getAttribute(t),s&&a!=l&&(a!=o&&d(),c=s),s=e.nextPosition,a=l;function d(){const n=new Es(c,s),l=n.root.document?r.version:null,d=new qa(n,t,a,o,l);e.batch.addOperation(d),i.applyOperation(d)}s instanceof As&&s!=c&&a!=o&&d()}function ol(e,t,o,n){const i=e.model,r=i.document,s=n.getAttribute(t);let a,l;if(s!=o){if(n.root===n){const e=n.document?r.version:null;l=new Ya(n,t,s,o,e)}else{a=new Es(As._createBefore(n),e.createPositionAfter(n));const i=a.root.document?r.version:null;l=new qa(a,t,s,o,i)}e.batch.addOperation(l),i.applyOperation(l)}}function nl(e,t,o,n,i){const r=e.model,s=r.document,a=new Ka(t,o,n,r.markers,i,s.version);e.batch.addOperation(a),r.applyOperation(a)}function il(e,t,o,n){let i;if(e.root.document){const o=n.document,r=new As(o.graveyard,[0]);i=new Ua(e,t,r,o.version)}else i=new $a(e,t);o.addOperation(i),n.applyOperation(i)}function rl(e,t){return e===t||e instanceof Za&&t instanceof Za}class sl{constructor(e){this._markerCollection=e,this._changesInElement=new Map,this._elementSnapshots=new Map,this._changedMarkers=new Map,this._changeCount=0,this._cachedChanges=null,this._cachedChangesWithGraveyard=null}get isEmpty(){return 0==this._changesInElement.size&&0==this._changedMarkers.size}refreshItem(e){if(this._isInInsertedElement(e.parent))return;this._markRemove(e.parent,e.startOffset,e.offsetSize),this._markInsert(e.parent,e.startOffset,e.offsetSize);const t=Es._createOn(e);for(const e of this._markerCollection.getMarkersIntersectingRange(t)){const t=e.getRange();this.bufferMarkerChange(e.name,t,t,e.affectsData)}this._cachedChanges=null}bufferOperation(e){switch(e.type){case"insert":if(this._isInInsertedElement(e.position.parent))return;this._markInsert(e.position.parent,e.position.offset,e.nodes.maxOffset);break;case"addAttribute":case"removeAttribute":case"changeAttribute":for(const t of e.range.getItems({shallow:!0}))this._isInInsertedElement(t.parent)||this._markAttribute(t);break;case"remove":case"move":case"reinsert":{if(e.sourcePosition.isEqual(e.targetPosition)||e.sourcePosition.getShiftedBy(e.howMany).isEqual(e.targetPosition))return;const t=this._isInInsertedElement(e.sourcePosition.parent),o=this._isInInsertedElement(e.targetPosition.parent);t||this._markRemove(e.sourcePosition.parent,e.sourcePosition.offset,e.howMany),o||this._markInsert(e.targetPosition.parent,e.getMovedRangeStart().offset,e.howMany);break}case"rename":{if(this._isInInsertedElement(e.position.parent))return;this._markRemove(e.position.parent,e.position.offset,1),this._markInsert(e.position.parent,e.position.offset,1);const t=Es._createFromPositionAndShift(e.position,1);for(const e of this._markerCollection.getMarkersIntersectingRange(t)){const t=e.getRange();this.bufferMarkerChange(e.name,t,t,e.affectsData)}break}case"split":{const t=e.splitPosition.parent;this._isInInsertedElement(t)||this._markRemove(t,e.splitPosition.offset,e.howMany),this._isInInsertedElement(e.insertionPosition.parent)||this._markInsert(e.insertionPosition.parent,e.insertionPosition.offset,1),e.graveyardPosition&&this._markRemove(e.graveyardPosition.parent,e.graveyardPosition.offset,1);break}case"merge":{const t=e.sourcePosition.parent;this._isInInsertedElement(t.parent)||this._markRemove(t.parent,t.startOffset,1);const o=e.graveyardPosition.parent;this._markInsert(o,e.graveyardPosition.offset,1);const n=e.targetPosition.parent;this._isInInsertedElement(n)||this._markInsert(n,e.targetPosition.offset,t.maxOffset);break}}this._cachedChanges=null}bufferMarkerChange(e,t,o,n){const i=this._changedMarkers.get(e);i?(i.newRange=o,i.affectsData=n,null==i.oldRange&&null==i.newRange&&this._changedMarkers.delete(e)):this._changedMarkers.set(e,{oldRange:t,newRange:o,affectsData:n})}getMarkersToRemove(){const e=[];for(const[t,o]of this._changedMarkers)null!=o.oldRange&&e.push({name:t,range:o.oldRange});return e}getMarkersToAdd(){const e=[];for(const[t,o]of this._changedMarkers)null!=o.newRange&&e.push({name:t,range:o.newRange});return e}getChangedMarkers(){return Array.from(this._changedMarkers).map(e=>({name:e[0],data:{oldRange:e[1].oldRange,newRange:e[1].newRange}}))}hasDataChanges(){for(const[,e]of this._changedMarkers)if(e.affectsData)return!0;return this._changesInElement.size>0}getChanges(e={includeChangesInGraveyard:!1}){if(this._cachedChanges)return e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice();const t=[];for(const e of this._changesInElement.keys()){const o=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._elementSnapshots.get(e),i=al(e.getChildren()),r=ll(n.length,o);let s=0,a=0;for(const o of r)if("i"===o)t.push(this._getInsertDiff(e,s,i[s].name)),s++;else if("r"===o)t.push(this._getRemoveDiff(e,s,n[a].name)),a++;else if("a"===o){const o=i[s].attributes,r=n[a].attributes;let l;if("$text"==i[s].name)l=new Es(As._createAt(e,s),As._createAt(e,s+1));else{const t=e.offsetToIndex(s);l=new Es(As._createAt(e,s),As._createAt(e.getChild(t),0))}t.push(...this._getAttributesDiff(l,r,o)),s++,a++}else s++,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;e<t.length;e++){const o=t[e-1],n=t[e],i="remove"==o.type&&"remove"==n.type&&"$text"==o.name&&"$text"==n.name&&o.position.isEqual(n.position),r="insert"==o.type&&"insert"==n.type&&"$text"==o.name&&"$text"==n.name&&o.position.parent==n.position.parent&&o.position.offset+o.length==n.position.offset,s="attribute"==o.type&&"attribute"==n.type&&o.position.parent==n.position.parent&&o.range.isFlat&&n.range.isFlat&&o.position.offset+o.length==n.position.offset&&o.attributeKey==n.attributeKey&&o.attributeOldValue==n.attributeOldValue&&o.attributeNewValue==n.attributeNewValue;(i||r||s)&&(t[e-1].length++,s&&(t[e-1].range.end=t[e-1].range.end.getShiftedBy(1)),t.splice(e,1),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.slice(),this._cachedChanges=t.slice().filter(cl),e.includeChangesInGraveyard?this._cachedChangesWithGraveyard:this._cachedChanges}reset(){this._changesInElement.clear(),this._elementSnapshots.clear(),this._changedMarkers.clear(),this._cachedChanges=null}_markInsert(e,t,o){const n={type:"insert",offset:t,howMany:o,count:this._changeCount++};this._markChange(e,n)}_markRemove(e,t,o){const n={type:"remove",offset:t,howMany:o,count:this._changeCount++};this._markChange(e,n),this._removeAllNestedChanges(e,t,o)}_markAttribute(e){const t={type:"attribute",offset:e.startOffset,howMany:e.offsetSize,count:this._changeCount++};this._markChange(e.parent,t)}_markChange(e,t){this._makeSnapshot(e);const o=this._getChangesForElement(e);this._handleChange(t,o),o.push(t);for(let e=0;e<o.length;e++)o[e].howMany<1&&(o.splice(e,1),e--)}_getChangesForElement(e){let t;return this._changesInElement.has(e)?t=this._changesInElement.get(e):(t=[],this._changesInElement.set(e,t)),t}_makeSnapshot(e){this._elementSnapshots.has(e)||this._elementSnapshots.set(e,al(e.getChildren()))}_handleChange(e,t){e.nodesToHandle=e.howMany;for(const o of t){const n=e.offset+e.howMany,i=o.offset+o.howMany;if("insert"==e.type&&("insert"==o.type&&(e.offset<=o.offset?o.offset+=e.howMany:e.offset<i&&(o.howMany+=e.nodesToHandle,e.nodesToHandle=0)),"remove"==o.type&&e.offset<o.offset&&(o.offset+=e.howMany),"attribute"==o.type))if(e.offset<=o.offset)o.offset+=e.howMany;else if(e.offset<i){const i=o.howMany;o.howMany=e.offset-o.offset,t.unshift({type:"attribute",offset:n,howMany:i-o.howMany,count:this._changeCount++})}if("remove"==e.type){if("insert"==o.type)if(n<=o.offset)o.offset-=e.howMany;else if(n<=i)if(e.offset<o.offset){const t=n-o.offset;o.offset=e.offset,o.howMany-=t,e.nodesToHandle-=t}else o.howMany-=e.nodesToHandle,e.nodesToHandle=0;else if(e.offset<=o.offset)e.nodesToHandle-=o.howMany,o.howMany=0;else if(e.offset<i){const t=i-e.offset;o.howMany-=t,e.nodesToHandle-=t}if("remove"==o.type&&(n<=o.offset?o.offset-=e.howMany:e.offset<o.offset&&(e.nodesToHandle+=o.howMany,o.howMany=0)),"attribute"==o.type)if(n<=o.offset)o.offset-=e.howMany;else if(e.offset<o.offset){const t=n-o.offset;o.offset=e.offset,o.howMany-=t}else if(e.offset<i)if(n<=i){const n=o.howMany;o.howMany=e.offset-o.offset;const i=n-o.howMany-e.nodesToHandle;t.unshift({type:"attribute",offset:e.offset,howMany:i,count:this._changeCount++})}else o.howMany-=i-e.offset}if("attribute"==e.type){if("insert"==o.type)if(e.offset<o.offset&&n>o.offset){if(n>i){const e={type:"attribute",offset:i,howMany:n-i,count:this._changeCount++};this._handleChange(e,t),t.push(e)}e.nodesToHandle=o.offset-e.offset,e.howMany=e.nodesToHandle}else e.offset>=o.offset&&e.offset<i&&(n>i?(e.nodesToHandle=n-i,e.offset=i):e.nodesToHandle=0);if("remove"==o.type&&e.offset<o.offset&&n>o.offset){const i={type:"attribute",offset:o.offset,howMany:n-o.offset,count:this._changeCount++};this._handleChange(i,t),t.push(i),e.nodesToHandle=o.offset-e.offset,e.howMany=e.nodesToHandle}"attribute"==o.type&&(e.offset>=o.offset&&n<=i?(e.nodesToHandle=0,e.howMany=0,e.offset=0):e.offset<=o.offset&&n>=i&&(o.howMany=0))}}e.howMany=e.nodesToHandle,delete e.nodesToHandle}_getInsertDiff(e,t,o){return{type:"insert",position:As._createAt(e,t),name:o,length:1,changeCount:this._changeCount++}}_getRemoveDiff(e,t,o){return{type:"remove",position:As._createAt(e,t),name:o,length:1,changeCount:this._changeCount++}}_getAttributesDiff(e,t,o){const n=[];o=new Map(o);for(const[i,r]of t){const t=o.has(i)?o.get(i):null;t!==r&&n.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:i,attributeOldValue:r,attributeNewValue:t,changeCount:this._changeCount++}),o.delete(i)}for(const[t,i]of o)n.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:t,attributeOldValue:null,attributeNewValue:i,changeCount:this._changeCount++});return n}_isInInsertedElement(e){const t=e.parent;if(!t)return!1;const o=this._changesInElement.get(t),n=e.startOffset;if(o)for(const e of o)if("insert"==e.type&&n>=e.offset&&n<e.offset+e.howMany)return!0;return this._isInInsertedElement(t)}_removeAllNestedChanges(e,t,o){const n=new Es(As._createAt(e,t),As._createAt(e,t+o));for(const e of n.getItems({shallow:!0}))e.is("element")&&(this._elementSnapshots.delete(e),this._changesInElement.delete(e),this._removeAllNestedChanges(e,0,e.maxOffset))}}function al(e){const t=[];for(const o of e)if(o.is("$text"))for(let e=0;e<o.data.length;e++)t.push({name:"$text",attributes:new Map(o.getAttributes())});else t.push({name:o.name,attributes:new Map(o.getAttributes())});return t}function ll(e,t){const o=[];let n=0,i=0;for(const e of t){if(e.offset>n){for(let t=0;t<e.offset-n;t++)o.push("e");i+=e.offset-n}if("insert"==e.type){for(let t=0;t<e.howMany;t++)o.push("i");n=e.offset+e.howMany}else if("remove"==e.type){for(let t=0;t<e.howMany;t++)o.push("r");n=e.offset,i+=e.howMany}else o.push(..."a".repeat(e.howMany).split("")),n=e.offset+e.howMany,i+=e.howMany}if(i<e)for(let t=0;t<e-i-n;t++)o.push("e");return o}function cl(e){const t=e.position&&"$graveyard"==e.position.root.rootName,o=e.range&&"$graveyard"==e.range.root.rootName;return!t&&!o}class dl{constructor(){this._operations=[],this._undoPairs=new Map,this._undoneOperations=new Set}addOperation(e){this._operations.includes(e)||this._operations.push(e)}getOperations(e=0,t=Number.POSITIVE_INFINITY){return e<0?[]:this._operations.slice(e,t)}getOperation(e){return this._operations[e]}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)}}function hl(e,t){return!!(o=e.charAt(t-1))&&1==o.length&&/[\ud800-\udbff]/.test(o)&&function(e){return!!e&&1==e.length&&/[\udc00-\udfff]/.test(e)}(e.charAt(t));var o}function ul(e,t){return!!(o=e.charAt(t))&&1==o.length&&/[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/.test(o);var o}class ml{constructor(e){this.model=e,this.version=0,this.history=new dl(this),this.selection=new Ws(this),this.roots=new Ao({idProperty:"rootName"}),this.differ=new sl(e.markers),this._postFixers=new Set,this._hasSelectionChangedFromTheLastChangeBlock=!1,this.createRoot("$root","$graveyard"),this.listenTo(e,"applyOperation",(e,t)=>{const o=t[0];if(o.isDocumentOperation&&o.baseVersion!==this.version)throw new mo.b("model-document-applyOperation-wrong-version: Only operations with matching versions can be applied.",this,{operation:o})},{priority:"highest"}),this.listenTo(e,"applyOperation",(e,t)=>{const o=t[0];o.isDocumentOperation&&this.differ.bufferOperation(o)},{priority:"high"}),this.listenTo(e,"applyOperation",(e,t)=>{const o=t[0];o.isDocumentOperation&&(this.version++,this.history.addOperation(o))},{priority:"low"}),this.listenTo(this.selection,"change",()=>{this._hasSelectionChangedFromTheLastChangeBlock=!0}),this.listenTo(e.markers,"update",(e,t,o,n)=>{this.differ.bufferMarkerChange(t.name,o,n,t.affectsData),null===o&&t.on("change",(e,o)=>{this.differ.bufferMarkerChange(t.name,o,t.getRange(),t.affectsData)})})}get graveyard(){return this.getRoot("$graveyard")}createRoot(e="$root",t="main"){if(this.roots.get(t))throw new mo.b("model-document-createRoot-name-exists: Root with specified name already exists.",this,{name:t});const o=new Za(this,e,t);return this.roots.add(o),o}destroy(){this.selection.destroy(),this.stopListening()}getRoot(e="main"){return this.roots.get(e)}getRootNames(){return Array.from(this.roots,e=>e.rootName).filter(e=>"$graveyard"!=e)}registerPostFixer(e){this._postFixers.add(e)}toJSON(){const e=Oo(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(){for(const e of this.roots)if(e!==this.graveyard)return e;return this.graveyard}_getDefaultRange(){const e=this._getDefaultRoot(),t=this.model,o=t.schema,n=t.createPositionFromPath(e,[0]);return o.getNearestSelectionRange(n)||t.createRange(n)}_validateSelectionRange(e){return gl(e.start)&&gl(e.end)}_callPostFixers(e){let t=!1;do{for(const o of this._postFixers)if(this.selection.refresh(),t=o(e),t)break}while(t)}}function gl(e){const t=e.textNode;if(t){const o=t.data,n=e.offset-t.startOffset;return!hl(o,n)&&!ul(o,n)}return!0}Co(ml,po);class fl{constructor(){this._markers=new Map}[Symbol.iterator](){return this._markers.values()}has(e){return this._markers.has(e)}get(e){return this._markers.get(e)||null}_set(e,t,o=!1,n=!1){const i=e instanceof pl?e.name:e;if(i.includes(","))throw new mo.b('markercollection-incorrect-marker-name: Marker name cannot contain the "," character.',this);const r=this._markers.get(i);if(r){const e=r.getRange();let s=!1;return e.isEqual(t)||(r._attachLiveRange(Ls.fromRange(t)),s=!0),o!=r.managedUsingOperations&&(r._managedUsingOperations=o,s=!0),"boolean"==typeof n&&n!=r.affectsData&&(r._affectsData=n,s=!0),s&&this.fire("update:"+i,r,e,t),r}const s=Ls.fromRange(t),a=new pl(i,s,o,n);return this._markers.set(i,a),this.fire("update:"+i,a,null,t),a}_remove(e){const t=e instanceof pl?e.name:e,o=this._markers.get(t);return!!o&&(this._markers.delete(t),this.fire("update:"+t,o,o.getRange(),null),this._destroyMarker(o),!0)}_refresh(e){const t=e instanceof pl?e.name:e,o=this._markers.get(t);if(!o)throw new mo.b("markercollection-refresh-marker-not-exists: Marker with provided name does not exists.",this);const n=o.getRange();this.fire("update:"+t,o,n,n,o.managedUsingOperations,o.affectsData)}*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()}}Co(fl,po);class pl{constructor(e,t,o,n){this.name=e,this._liveRange=this._attachLiveRange(t),this._managedUsingOperations=o,this._affectsData=n}get managedUsingOperations(){if(!this._liveRange)throw new mo.b("marker-destroyed: Cannot use a destroyed marker instance.",this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new mo.b("marker-destroyed: Cannot use a destroyed marker instance.",this);return this._affectsData}getStart(){if(!this._liveRange)throw new mo.b("marker-destroyed: Cannot use a destroyed marker instance.",this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new mo.b("marker-destroyed: Cannot use a destroyed marker instance.",this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new mo.b("marker-destroyed: Cannot use a destroyed marker instance.",this);return this._liveRange.toRange()}is(e){return"marker"===e||"model:marker"===e}_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}}Co(pl,po);class bl extends Ma{get type(){return"noop"}clone(){return new bl(this.baseVersion)}getReversed(){return new bl(this.baseVersion+1)}_execute(){}static get className(){return"NoOperation"}}const wl={};wl[qa.className]=qa,wl[Ga.className]=Ga,wl[Ka.className]=Ka,wl[Ua.className]=Ua,wl[bl.className]=bl,wl[Ma.className]=Ma,wl[Ja.className]=Ja,wl[Ya.className]=Ya,wl[Xa.className]=Xa,wl[Qa.className]=Qa;class kl extends As{constructor(e,t,o="toNone"){if(super(e,t,o),!this.root.is("rootElement"))throw new mo.b("model-liveposition-root-not-rootelement: LivePosition's root has to be an instance of RootElement.",e);_l.call(this)}detach(){this.stopListening()}is(e){return"livePosition"===e||"model:livePosition"===e||"position"==e||"model:position"===e}toPosition(){return new As(this.root,this.path.slice(),this.stickiness)}static fromPosition(e,t){return new this(e.root,e.path.slice(),t||e.stickiness)}}function _l(){this.listenTo(this.root.document.model,"applyOperation",(e,t)=>{const o=t[0];o.isDocumentOperation&&vl.call(this,o)},{priority:"low"})}function vl(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)}}Co(kl,po);class yl{constructor(e,t,o){this.model=e,this.writer=t,this.position=o,this.canMergeWith=new Set([this.position.parent]),this.schema=e.schema,this._filterAttributesOf=[],this._affectedStart=null,this._affectedEnd=null}handleNodes(e,t){e=Array.from(e);for(let o=0;o<e.length;o++){const n=e[o];this._handleNode(n,{isFirst:0===o&&t.isFirst,isLast:o===e.length-1&&t.isLast})}this.schema.removeDisallowedAttributes(this._filterAttributesOf,this.writer),this._filterAttributesOf=[]}getSelectionRange(){return this.nodeToSelect?Es._createOn(this.nodeToSelect):this.model.schema.getNearestSelectionRange(this.position)}getAffectedRange(){return this._affectedStart?new Es(this._affectedStart,this._affectedEnd):null}destroy(){this._affectedStart&&this._affectedStart.detach(),this._affectedEnd&&this._affectedEnd.detach()}_handleNode(e,t){if(this.schema.isObject(e))return void this._handleObject(e,t);this._checkAndSplitToAllowedPosition(e,t)?(this._insert(e),this._mergeSiblingsOf(e,t)):this._handleDisallowedNode(e,t)}_handleObject(e,t){this._checkAndSplitToAllowedPosition(e)?this._insert(e):this._tryAutoparagraphing(e,t)}_handleDisallowedNode(e,t){e.is("element")?this.handleNodes(e.getChildren(),t):this._tryAutoparagraphing(e,t)}_insert(e){if(!this.schema.checkChild(this.position,e))throw new mo.b("insertcontent-wrong-position: Given node cannot be inserted on the given position.",this,{node:e,position:this.position});const t=kl.fromPosition(this.position,"toNext");this._setAffectedBoundaries(this.position),this.writer.insert(e,this.position),this.position=t.toPosition(),t.detach(),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=kl.fromPosition(e,"toPrevious")),this._affectedEnd&&!this._affectedEnd.isBefore(e)||(this._affectedEnd&&this._affectedEnd.detach(),this._affectedEnd=kl.fromPosition(e,"toNext"))}_mergeSiblingsOf(e,t){if(!(e instanceof ys))return;const o=this._canMergeLeft(e,t),n=this._canMergeRight(e,t),i=kl._createBefore(e);i.stickiness="toNext";const r=kl._createAfter(e);if(r.stickiness="toNext",o){const e=kl.fromPosition(this.position);e.stickiness="toNext",this._affectedStart.isEqual(i)&&(this._affectedStart.detach(),this._affectedStart=kl._createAt(i.nodeBefore,"end","toPrevious")),this.writer.merge(i),i.isEqual(this._affectedEnd)&&t.isLast&&(this._affectedEnd.detach(),this._affectedEnd=kl._createAt(i.nodeBefore,"end","toNext")),this.position=e.toPosition(),e.detach()}if(n){if(!this.position.isEqual(r))throw new mo.b("insertcontent-invalid-insertion-position: An internal error occurred during insertContent().",this);this.position=As._createAt(r.nodeBefore,"end");const e=kl.fromPosition(this.position,"toPrevious");this._affectedEnd.isEqual(r)&&(this._affectedEnd.detach(),this._affectedEnd=kl._createAt(r.nodeBefore,"end","toNext")),this.writer.merge(r),r.getShiftedBy(-1).isEqual(this._affectedStart)&&t.isFirst&&(this._affectedStart.detach(),this._affectedStart=kl._createAt(r.nodeBefore,0,"toPrevious")),this.position=e.toPosition(),e.detach()}(o||n)&&this._filterAttributesOf.push(this.position.parent),i.detach(),r.detach()}_canMergeLeft(e,t){const o=e.previousSibling;return t.isFirst&&o instanceof ys&&this.canMergeWith.has(o)&&this.model.schema.checkMerge(o,e)}_canMergeRight(e,t){const o=e.nextSibling;return t.isLast&&o instanceof ys&&this.canMergeWith.has(o)&&this.model.schema.checkMerge(e,o)}_tryAutoparagraphing(e,t){const o=this.writer.createElement("paragraph");this._getAllowedIn(o,this.position.parent)&&this.schema.checkChild(o,e)&&(o._appendChild(e),this._handleNode(o,t))}_checkAndSplitToAllowedPosition(e){const t=this._getAllowedIn(e,this.position.parent);if(!t)return!1;for(;t!=this.position.parent;){if(this.schema.isLimit(this.position.parent))return!1;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!0}_getAllowedIn(e,t){return this.schema.checkChild(t,e)?t:t.parent?this._getAllowedIn(e,t.parent):null}}function xl(e,t,o={}){if(t.isCollapsed)return;const n=t.getFirstRange();if("$graveyard"==n.root.rootName)return;const i=e.schema;e.change(e=>{if(!o.doNotResetEntireContent&&function(e,t){const o=e.getLimitElement(t);if(!t.containsEntireContent(o))return!1;const n=t.getFirstRange();if(n.start.parent==n.end.parent)return!1;return e.checkChild(o,"paragraph")}(i,t))return void function(e,t){const o=e.model.schema.getLimitElement(t);e.remove(e.createRangeIn(o)),Al(e,e.createPositionAt(o,0),t)}(e,t);const[r,s]=function(e){const t=e.root.document.model,o=e.start;let n=e.end;if(t.hasContent(e,{ignoreMarkers:!0})){const o=function(e){const t=e.parent,o=t.root.document.model.schema,n=t.getAncestors({parentFirst:!0,includeSelf:!0});for(const e of n){if(o.isLimit(e))return null;if(o.isBlock(e))return e}}(n);if(o&&n.isTouching(t.createPositionAt(o,0))){const o=t.createSelection(e);t.modifySelection(o,{direction:"backward"}),n=o.getLastPosition()}}return[kl.fromPosition(o,"toPrevious"),kl.fromPosition(n,"toNext")]}(n);n.start.isTouching(n.end)||e.remove(n),o.leaveUnmerged||(!function(e,t,o){const n=e.model;if(!Cl(e.model.schema,t,o))return;const[i,r]=function(e,t){const o=e.getAncestors(),n=t.getAncestors();let i=0;for(;o[i]&&o[i]==n[i];)i++;return[o[i],n[i]]}(t,o);!n.hasContent(i,{ignoreMarkers:!0})&&n.hasContent(r,{ignoreMarkers:!0})?function e(t,o,n,i){const r=o.parent,s=n.parent;if(r==i||s==i)return;o=t.createPositionAfter(r),(n=t.createPositionBefore(s)).isEqual(o)||t.insert(r,n);for(;o.parent.isEmpty;){const e=o.parent;o=t.createPositionBefore(e),t.remove(e)}if(n=t.createPositionBefore(s),function(e,t){const o=t.nodeBefore,n=t.nodeAfter;o.name!=n.name&&e.rename(o,n.name);e.clearAttributes(o),e.setAttributes(Object.fromEntries(n.getAttributes()),o),e.merge(t)}(t,n),!Cl(t.model.schema,o,n))return;e(t,o,n,i)}(e,t,o,i.parent):function e(t,o,n,i){const r=o.parent,s=n.parent;if(r==i||s==i)return;o=t.createPositionAfter(r),(n=t.createPositionBefore(s)).isEqual(o)||t.insert(s,o);t.merge(o);for(;n.parent.isEmpty;){const e=n.parent;n=t.createPositionBefore(e),t.remove(e)}if(!Cl(t.model.schema,o,n))return;e(t,o,n,i)}(e,t,o,i.parent)}(e,r,s),i.removeDisallowedAttributes(r.parent.getChildren(),e)),Tl(e,t,r),!o.doNotAutoparagraph&&function(e,t){const o=e.checkChild(t,"$text"),n=e.checkChild(t,"paragraph");return!o&&n}(i,r)&&Al(e,r,t),r.detach(),s.detach()})}function Cl(e,t,o){const n=t.parent,i=o.parent;return n!=i&&(!e.isLimit(n)&&!e.isLimit(i)&&function(e,t,o){const n=new Es(e,t);for(const e of n.getWalker())if(o.isLimit(e.item))return!1;return!0}(t,o,e))}function Al(e,t,o){const n=e.createElement("paragraph");e.insert(n,t),Tl(e,o,e.createPositionAt(n,0))}function Tl(e,t,o){t instanceof Ws?e.setSelection(o):t.setTo(o)}function Pl(e,t){const{isForward:o,walker:n,unit:i,schema:r}=e,{type:s,item:a,nextPosition:l}=t;if("text"==s)return"word"===e.unit?function(e,t){let o=e.position.textNode;if(o){let n=e.position.offset-o.startOffset;for(;!El(o.data,n,t)&&!Rl(o,n,t);){e.next();const i=t?e.position.nodeAfter:e.position.nodeBefore;if(i&&i.is("$text")){const n=i.data.charAt(t?0:i.data.length-1);' ,.?!:;"-()'.includes(n)||(e.next(),o=e.position.textNode)}n=e.position.offset-o.startOffset}}return e.position}(n,o):function(e,t){const o=e.position.textNode;if(o){const n=o.data;let i=e.position.offset-o.startOffset;for(;hl(n,i)||"character"==t&&ul(n,i);)e.next(),i=e.position.offset-o.startOffset}return e.position}(n,i);if(s==(o?"elementStart":"elementEnd")){if(r.isSelectable(a))return As._createAt(a,o?"after":"before");if(r.checkChild(l,"$text"))return l}else{if(r.isLimit(a))return void n.skip(()=>!0);if(r.checkChild(l,"$text"))return l}}function Sl(e,t){const o=e.root,n=As._createAt(o,t?"end":0);return t?new Es(e,n):new Es(n,e)}function El(e,t,o){const n=t+(o?0:-1);return' ,.?!:;"-()'.includes(e.charAt(n))}function Rl(e,t,o){return t===(o?e.endOffset:0)}function Il(e,t){const o=[];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=>{o.push(e.start.parent),t.remove(e)}),o.forEach(e=>{let o=e;for(;o.parent&&o.isEmpty;){const e=t.createRangeOn(o);o=o.parent,t.remove(e)}})}function Vl(e){e.document.registerPostFixer(t=>function(e,t){const o=t.document.selection,n=t.schema,i=[];let r=!1;for(const e of o.getRanges()){const t=Ol(e,n);t&&!t.isEqual(e)?(i.push(t),r=!0):i.push(e)}r&&e.setSelection(function(e){const t=[];t.push(e.shift());for(const o of e){const e=t.pop();if(o.isIntersecting(e)){const n=e.start.isAfter(o.start)?o.start:e.start,i=e.end.isAfter(o.end)?e.end:o.end,r=new Es(n,i);t.push(r)}else t.push(e),t.push(o)}return t}(i),{backward:o.isBackward})}(t,e))}function Ol(e,t){return e.isCollapsed?function(e,t){const o=e.start,n=t.getNearestSelectionRange(o);if(!n)return null;if(!n.isCollapsed)return n;const i=n.start;if(o.isEqual(i))return null;return new Es(i)}(e,t):function(e,t){const{start:o,end:n}=e,i=t.checkChild(o,"$text"),r=t.checkChild(n,"$text"),s=t.getLimitElement(o),a=t.getLimitElement(n);if(s===a){if(i&&r)return null;if(function(e,t,o){const n=e.nodeAfter&&!o.isLimit(e.nodeAfter)||o.checkChild(e,"$text"),i=t.nodeBefore&&!o.isLimit(t.nodeBefore)||o.checkChild(t,"$text");return n||i}(o,n,t)){const e=o.nodeAfter&&t.isSelectable(o.nodeAfter)?null:t.getNearestSelectionRange(o,"forward"),i=n.nodeBefore&&t.isSelectable(n.nodeBefore)?null:t.getNearestSelectionRange(n,"backward"),r=e?e.start:o,s=i?i.start:n;return new Es(r,s)}}const l=s&&!s.is("rootElement"),c=a&&!a.is("rootElement");if(l||c){const e=o.nodeAfter&&n.nodeBefore&&o.nodeAfter.parent===n.nodeBefore.parent,i=l&&(!e||!Nl(o.nodeAfter,t)),r=c&&(!e||!Nl(n.nodeBefore,t));let d=o,h=n;return i&&(d=As._createBefore(Ml(s,t))),r&&(h=As._createAfter(Ml(a,t))),new Es(d,h)}return null}(e,t)}function Ml(e,t){let o=e,n=o;for(;t.isLimit(n)&&n.parent;)o=n,n=n.parent;return o}function Nl(e,t){return e&&t.isSelectable(e)}class zl{constructor(){this.markers=new fl,this.document=new ml(this),this.schema=new fa,this._pendingChanges=[],this._currentWriter=null,["insertContent","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("$block",{allowIn:"$root",isBlock:!0}),this.schema.register("$text",{allowIn:"$block",isInline:!0,isContent:!0}),this.schema.register("$clipboardHolder",{allowContentOf:"$root",isLimit:!0}),this.schema.extend("$text",{allowIn:"$clipboardHolder"}),this.schema.register("$marker"),this.schema.addChildCheck((e,t)=>{if("$marker"===t.name)return!0}),Vl(this),this.document.registerPostFixer(ta)}change(e){try{return 0===this._pendingChanges.length?(this._pendingChanges.push({batch:new Oa,callback:e}),this._runPendingChanges()[0]):e(this._currentWriter)}catch(e){mo.b.rethrowUnexpectedError(e,this)}}enqueueChange(e,t){try{"string"==typeof e?e=new Oa(e):"function"==typeof e&&(t=e,e=new Oa),this._pendingChanges.push({batch:e,callback:t}),1==this._pendingChanges.length&&this._runPendingChanges()}catch(e){mo.b.rethrowUnexpectedError(e,this)}}applyOperation(e){e._execute()}insertContent(e,t,o){return function(e,t,o,n){return e.change(i=>{let r;r=o?o instanceof Ns||o instanceof Ws?o:i.createSelection(o,n):e.document.selection,r.isCollapsed||e.deleteContent(r,{doNotAutoparagraph:!0});const s=new yl(e,i,r.anchor);let a;a=t.is("documentFragment")?t.getChildren():[t],s.handleNodes(a,{isFirst:!0,isLast:!0});const l=s.getSelectionRange();l&&(r instanceof Ws?i.setSelection(l):r.setTo(l));const c=s.getAffectedRange()||e.createRange(r.anchor);return s.destroy(),c})}(this,e,t,o)}deleteContent(e,t){xl(this,e,t)}modifySelection(e,t){!function(e,t,o={}){const n=e.schema,i="backward"!=o.direction,r=o.unit?o.unit:"character",s=t.focus,a=new xs({boundaries:Sl(s,i),singleCharacters:!0,direction:i?"forward":"backward"}),l={walker:a,schema:n,isForward:i,unit:r};let c;for(;c=a.next();){if(c.done)return;const o=Pl(l,c.value);if(o)return void(t instanceof Ws?e.change(e=>{e.setSelectionFocus(o)}):t.setFocus(o))}}(this,e,t)}getSelectedContent(e){return function(e,t){return e.change(e=>{const o=e.createDocumentFragment(),n=t.getFirstRange();if(!n||n.isCollapsed)return o;const i=n.start.root,r=n.start.getCommonPath(n.end),s=i.getNodeByPath(r);let a;a=n.start.parent==n.end.parent?n:e.createRange(e.createPositionAt(s,n.start.path[r.length]),e.createPositionAt(s,n.end.path[r.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(),o):e.append(e.cloneElement(t,!0),o);if(a!=n){const t=n._getTransformedByMove(a.start,e.createPositionAt(o,0),l)[0],i=e.createRange(e.createPositionAt(o,0),t.start);Il(e.createRange(t.end,e.createPositionAt(o,"end")),e),Il(i,e)}return o})}(this,e)}hasContent(e,t={}){const o=e instanceof ys?Es._createIn(e):e;if(o.isCollapsed)return!1;const{ignoreWhitespaces:n=!1,ignoreMarkers:i=!1}=t;if(!i)for(const e of this.markers.getMarkersIntersectingRange(o))if(e.affectsData)return!0;for(const e of o.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}createPositionFromPath(e,t,o){return new As(e,t,o)}createPositionAt(e,t){return As._createAt(e,t)}createPositionAfter(e){return As._createAfter(e)}createPositionBefore(e){return As._createBefore(e)}createRange(e,t){return new Es(e,t)}createRangeIn(e){return Es._createIn(e)}createRangeOn(e){return Es._createOn(e)}createSelection(e,t,o){return new Ns(e,t,o)}createBatch(e){return new Oa(e)}createOperationFromJSON(e){return class{static fromJSON(e,t){return wl[e.__className].fromJSON(e,t)}}.fromJSON(e,this.document)}destroy(){this.document.destroy(),this.stopListening()}_runPendingChanges(){const e=[];for(this.fire("_beforeChanges");this._pendingChanges.length;){const t=this._pendingChanges[0].batch;this._currentWriter=new el(this,t);const o=this._pendingChanges[0].callback(this._currentWriter);e.push(o),this.document._handleChangeBlock(this._currentWriter),this._pendingChanges.shift(),this._currentWriter=null}return this.fire("_afterChanges"),e}}Co(zl,qn);class Bl{constructor(){this._listener=Object.create(gr)}listenTo(e){this._listener.listenTo(e,"keydown",(e,t)=>{this._listener.fire("_keydown:"+bi(t),t)})}set(e,t,o={}){const n=wi(e),i=o.priority;this._listener.listenTo(this._listener,"_keydown:"+n,(e,o)=>{t(o,()=>{o.preventDefault(),o.stopPropagation(),e.stop()}),e.return=!0},{priority:i})}press(e){return!!this._listener.fire("_keydown:"+bi(e),e)}destroy(){this._listener.stopListening()}}class Fl extends Bl{constructor(e){super(),this.editor=e}set(e,t,o={}){if("string"==typeof t){const e=t;t=(t,o)=>{this.editor.execute(e),o()}}super.set(e,t,o)}}class Dl{constructor(e={}){this._context=e.context||new Io({language:e.language}),this._context._addEditor(this,!e.context);const t=Array.from(this.constructor.builtinPlugins||[]);this.config=new io(e,this.constructor.defaultConfig),this.config.define("plugins",t),this.config.define(this._context._getEditorConfig()),this.plugins=new To(this,t,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this.commands=new ua,this.set("state","initializing"),this.once("ready",()=>this.state="ready",{priority:"high"}),this.once("destroy",()=>this.state="destroyed",{priority:"high"}),this.set("isReadOnly",!1),this.model=new zl;const o=new Vn;this.data=new Ea(this.model,o),this.editing=new ha(this.model,o),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new Ra([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 Fl(this),this.keystrokes.listenTo(this.editing.view.document)}initPlugins(){const e=this.config,t=e.get("plugins"),o=e.get("removePlugins")||[],n=e.get("extraPlugins")||[];return this.plugins.init(t.concat(n),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){try{return this.commands.execute(...e)}catch(e){mo.b.rethrowUnexpectedError(e,this)}}}Co(Dl,qn);class Ll{getHtml(e){const t=document.implementation.createHTMLDocument("").createElement("div");return t.appendChild(e),t.innerHTML}}class Hl{constructor(e){this._domParser=new DOMParser,this._domConverter=new cr(e,{blockFillerMode:"nbsp"}),this._htmlWriter=new Ll}toData(e){const t=this._domConverter.viewToDom(e,document);return this._htmlWriter.getHtml(t)}toView(e){const t=this._toDom(e);return this._domConverter.domToView(t)}_toDom(e){const t=this._domParser.parseFromString(e,"text/html"),o=t.createDocumentFragment(),n=t.body.childNodes;for(;n.length>0;)o.appendChild(n[0]);return o}}class jl{constructor(e){this.editor=e,this.set("isEnabled",!0),this._disableStack=new Set}forceDisabled(e){this._disableStack.add(e),1==this._disableStack.size&&(this.on("set:isEnabled",Wl,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",Wl),this.isEnabled=!0)}destroy(){this.stopListening()}static get isContextPlugin(){return!1}}function Wl(e){e.return=!1,e.stop()}Co(jl,qn);class ql extends Ao{constructor(e=[]){super(e,{idProperty:"viewUid"}),this.on("add",(e,t,o)=>{this._renderViewIntoCollectionParent(t,o)}),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 mo.b("ui-viewcollection-delegate-wrong-events: All event names must be strings.",this);return{to:t=>{for(const o of this)for(const n of e)o.delegate(n).to(t);this.on("add",(o,n)=>{for(const o of e)n.delegate(o).to(t)}),this.on("remove",(o,n)=>{for(const o of e)n.stopDelegating(o,t)})}}}_renderViewIntoCollectionParent(e,t){e.isRendered||e.render(),e.element&&this._parentElement&&this._parentElement.insertBefore(e.element,this._parentElement.children[t])}}class $l{constructor(e){Object.assign(this,tc(ec(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,isApplying:!0,revertData:this._revertData}),e}revert(e){if(!this._revertData)throw new mo.b("ui-template-revert-not-applied: Attempting to revert a template which has not been applied yet.",[this,e]);this._revertTemplateFromNode(e,this._revertData)}*getViews(){yield*function*e(t){if(t.children)for(const o of t.children)sc(o)?yield o:ac(o)&&(yield*e(o))}(this)}static bind(e,t){return{to:(o,n)=>new Gl({eventNameOrFunction:o,attribute:o,observable:e,emitter:t,callback:n}),if:(o,n,i)=>new Kl({observable:e,emitter:t,attribute:o,valueIfTrue:n,callback:i})}}static extend(e,t){if(e._isRendered)throw new mo.b("template-extend-render: Attempting to extend a template which has already been rendered.",[this,e]);!function e(t,o){o.attributes&&(t.attributes||(t.attributes={}),ic(t.attributes,o.attributes));o.eventListeners&&(t.eventListeners||(t.eventListeners={}),ic(t.eventListeners,o.eventListeners));o.text&&t.text.push(...o.text);if(o.children&&o.children.length){if(t.children.length!=o.children.length)throw new mo.b("ui-template-extend-children-mismatch: The number of children in extended definition does not match.",t);let n=0;for(const i of o.children)e(t.children[n++],i)}}(e,tc(ec(t)))}_renderNode(e){let t;if(t=e.node?this.tag&&this.text:this.tag?this.text:!this.text,t)throw new mo.b('ui-template-wrong-syntax: Node definition must have either "tag" or "text" when rendering a new Node.',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(""),Jl(this.text)?this._bindToObservable({schema:this.text,updater:Ql(t),data:e}):t.textContent=this.text.join(""),t}_renderAttributes(e){let t,o,n,i;if(!this.attributes)return;const r=e.node,s=e.revertData;for(t in this.attributes)if(n=r.getAttribute(t),o=this.attributes[t],s&&(s.attributes[t]=n),i=B(o[0])&&o[0].ns?o[0].ns:null,Jl(o)){const a=i?o[0].value:o;s&&cc(t)&&a.unshift(n),this._bindToObservable({schema:a,updater:Xl(r,t,i),data:e})}else"style"==t&&"string"!=typeof o[0]?this._renderStyleAttribute(o[0],e):(s&&n&&cc(t)&&o.unshift(n),o=o.map(e=>e&&e.value||e).reduce((e,t)=>e.concat(t),[]).reduce(nc,""),rc(o)||r.setAttributeNS(i,t,o))}_renderStyleAttribute(e,t){const o=t.node;for(const n in e){const i=e[n];Jl(i)?this._bindToObservable({schema:[i],updater:Zl(o,n),data:t}):o.style[n]=i}}_renderElementChildren(e){const t=e.node,o=e.intoFragment?document.createDocumentFragment():t,n=e.isApplying;let i=0;for(const r of this.children)if(lc(r)){if(!n){r.setParent(t);for(const e of r)o.appendChild(e.element)}}else if(sc(r))n||(r.isRendered||r.render(),o.appendChild(r.element));else if(er(r))o.appendChild(r);else if(n){const t={children:[],bindings:[],attributes:{}};e.revertData.children.push(t),r._renderNode({node:o.childNodes[i++],isApplying:!0,revertData:t})}else o.appendChild(r.render());e.intoFragment&&t.appendChild(o)}_setUpListeners(e){if(this.eventListeners)for(const t in this.eventListeners){const o=this.eventListeners[t].map(o=>{const[n,i]=t.split("@");return o.activateDomEventListener(n,i,e)});e.revertData&&e.revertData.bindings.push(o)}}_bindToObservable({schema:e,updater:t,data:o}){const n=o.revertData;Yl(e,t,o);const i=e.filter(e=>!rc(e)).filter(e=>e.observable).map(n=>n.activateAttributeListener(e,t,o));n&&n.bindings.push(i)}_revertTemplateFromNode(e,t){for(const e of t.bindings)for(const t of e)t();if(t.text)e.textContent=t.text;else{for(const o in t.attributes){const n=t.attributes[o];null===n?e.removeAttribute(o):e.setAttribute(o,n)}for(let o=0;o<t.children.length;++o)this._revertTemplateFromNode(e.childNodes[o],t.children[o])}}}Co($l,po);class Ul{constructor(e){Object.assign(this,e)}getValue(e){const t=this.observable[this.attribute];return this.callback?this.callback(t,e):t}activateAttributeListener(e,t,o){const n=()=>Yl(e,t,o);return this.emitter.listenTo(this.observable,"change:"+this.attribute,n),()=>{this.emitter.stopListening(this.observable,"change:"+this.attribute,n)}}}class Gl extends Ul{activateDomEventListener(e,t,o){const n=(e,o)=>{t&&!o.target.matches(t)||("function"==typeof this.eventNameOrFunction?this.eventNameOrFunction(o):this.observable.fire(this.eventNameOrFunction,o))};return this.emitter.listenTo(o.node,e,n),()=>{this.emitter.stopListening(o.node,e,n)}}}class Kl extends Ul{getValue(e){return!rc(super.getValue(e))&&(this.valueIfTrue||!0)}}function Jl(e){return!!e&&(e.value&&(e=e.value),Array.isArray(e)?e.some(Jl):e instanceof Ul)}function Yl(e,t,{node:o}){let n=function(e,t){return e.map(e=>e instanceof Ul?e.getValue(t):e)}(e,o);n=1==e.length&&e[0]instanceof Kl?n[0]:n.reduce(nc,""),rc(n)?t.remove():t.set(n)}function Ql(e){return{set(t){e.textContent=t},remove(){e.textContent=""}}}function Xl(e,t,o){return{set(n){e.setAttributeNS(o,t,n)},remove(){e.removeAttributeNS(o,t)}}}function Zl(e,t){return{set(o){e.style[t]=o},remove(){e.style[t]=null}}}function ec(e){return oo(e,e=>{if(e&&(e instanceof Ul||ac(e)||sc(e)||lc(e)))return e})}function tc(e){if("string"==typeof e?e=function(e){return{text:[e]}}(e):e.text&&function(e){Array.isArray(e.text)||(e.text=[e.text])}(e),e.on&&(e.eventListeners=function(e){for(const t in e)oc(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=[].concat(e[t].value)),oc(e,t)}(e.attributes);const t=[];if(e.children)if(lc(e.children))t.push(e.children);else for(const o of e.children)ac(o)||sc(o)||er(o)?t.push(o):t.push(new $l(o));e.children=t}return e}function oc(e,t){Array.isArray(e[t])||(e[t]=[e[t]])}function nc(e,t){return rc(t)?e:rc(e)?t:`${e} ${t}`}function ic(e,t){for(const o in t)e[o]?e[o].push(...t[o]):e[o]=t[o]}function rc(e){return!e&&0!==e}function sc(e){return e instanceof dc}function ac(e){return e instanceof $l}function lc(e){return e instanceof ql}function cc(e){return"class"==e||"style"==e}o(16);class dc{constructor(e){this.element=null,this.isRendered=!1,this.locale=e,this.t=e&&e.t,this._viewCollections=new Ao,this._unboundChildren=this.createCollection(),this._viewCollections.on("add",(t,o)=>{o.locale=e}),this.decorate("render")}get bindTemplate(){return this._bindTemplate?this._bindTemplate:this._bindTemplate=$l.bind(this,this)}createCollection(e){const t=new ql(e);return this._viewCollections.add(t),t}registerChild(e){xo(e)||(e=[e]);for(const t of e)this._unboundChildren.add(t)}deregisterChild(e){xo(e)||(e=[e]);for(const t of e)this._unboundChildren.remove(t)}setTemplate(e){this.template=new $l(e)}extendTemplate(e){$l.extend(this.template,e)}render(){if(this.isRendered)throw new mo.b("ui-view-render-already-rendered: This View has already been 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 hc({element:e,target:t,positions:o,limiter:n,fitInViewport:i}){D(t)&&(t=t()),D(n)&&(n=n());const r=function(e){return e&&e.parentNode?e.offsetParent===rr.document.body?null:e.offsetParent:null}(e),s=new is(e),a=new is(t);let l,c;if(n||i){const e=function(e,t){const{elementRect:o,viewportRect:n}=t,i=o.getArea(),r=function(e,{targetRect:t,elementRect:o,limiterRect:n,viewportRect:i}){const r=[],s=o.getArea();for(const a of e){const e=uc(a,t,o);if(!e)continue;const[l,c]=e;let d=0,h=0;if(n)if(i){const e=n.getIntersection(i);e&&(d=e.getIntersectionArea(c))}else d=n.getIntersectionArea(c);i&&(h=i.getIntersectionArea(c));const u={positionName:l,positionRect:c,limiterIntersectArea:d,viewportIntersectArea:h};if(d===s)return[u];r.push(u)}return r}(e,t);if(n){const e=mc(r.filter(({viewportIntersectArea:e})=>e===i),i);if(e)return e}return mc(r,i)}(o,{targetRect:a,elementRect:s,limiterRect:n&&new is(n).getVisible(),viewportRect:i&&new is(rr.window)});[c,l]=e||uc(o[0],a,s)}else[c,l]=uc(o[0],a,s);let d=gc(l);return r&&(d=function({left:e,top:t},o){const n=gc(new is(o)),i=os(o);return e-=n.left,t-=n.top,e+=o.scrollLeft,t+=o.scrollTop,e-=i.left,t-=i.top,{left:e,top:t}}(d,r)),{left:d.left,top:d.top,name:c}}function uc(e,t,o){const n=e(t,o);if(!n)return null;const{left:i,top:r,name:s}=n;return[s,o.clone().moveTo(i,r)]}function mc(e,t){let o,n,i=0;for(const{positionName:r,positionRect:s,limiterIntersectArea:a,viewportIntersectArea:l}of e){if(a===t)return[r,s];const e=l**2+a**2;e>i&&(i=e,o=s,n=r)}return o?[n,o]:null}function gc({left:e,top:t}){const{scrollX:o,scrollY:n}=rr.window;return{left:e+o,top:t+n}}function fc(e){return t=>t+e}Co(dc,gr),Co(dc,qn);o(18);const pc=fc("px"),bc=rr.document.body;class wc extends dc{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"),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",pc),left:t.to("left",pc)}},children:this.content})}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(e){this.show();const t=wc.defaultPositions,o=Object.assign({},{element:this.element,positions:[t.southArrowNorth,t.southArrowNorthMiddleWest,t.southArrowNorthMiddleEast,t.southArrowNorthWest,t.southArrowNorthEast,t.northArrowSouth,t.northArrowSouthMiddleWest,t.northArrowSouthMiddleEast,t.northArrowSouthWest,t.northArrowSouthEast],limiter:bc,fitInViewport:!0},e),n=wc._getOptimalPosition(o),i=parseInt(n.left),r=parseInt(n.top),s=n.name;Object.assign(this,{top:r,left:i,position:s})}pin(e){this.unpin(),this._pinWhenIsVisibleCallback=()=>{this.isVisible?this._startPinning(e):this._stopPinning()},this._startPinning(e),this.listenTo(this,"change:isVisible",this._pinWhenIsVisibleCallback)}unpin(){this._pinWhenIsVisibleCallback&&(this._stopPinning(),this.stopListening(this,"change:isVisible",this._pinWhenIsVisibleCallback),this._pinWhenIsVisibleCallback=null,this.hide())}_startPinning(e){this.attachTo(e);const t=kc(e.target),o=e.limiter?kc(e.limiter):bc;this.listenTo(rr.document,"scroll",(n,i)=>{const r=i.target,s=t&&r.contains(t),a=o&&r.contains(o);!s&&!a&&t&&o||this.attachTo(e)},{useCapture:!0}),this.listenTo(rr.window,"resize",()=>{this.attachTo(e)})}_stopPinning(){this.stopListening(rr.document,"scroll"),this.stopListening(rr.window,"resize")}}function kc(e){return no(e)?e:ts(e)?e.commonAncestorContainer:"function"==typeof e?kc(e()):null}function _c(e,t){return e.top-t.height-wc.arrowVerticalOffset}function vc(e){return e.bottom+wc.arrowVerticalOffset}wc.arrowHorizontalOffset=25,wc.arrowVerticalOffset=10,wc._getOptimalPosition=hc,wc.defaultPositions={northWestArrowSouthWest:(e,t)=>({top:_c(e,t),left:e.left-wc.arrowHorizontalOffset,name:"arrow_sw"}),northWestArrowSouthMiddleWest:(e,t)=>({top:_c(e,t),left:e.left-.25*t.width-wc.arrowHorizontalOffset,name:"arrow_smw"}),northWestArrowSouth:(e,t)=>({top:_c(e,t),left:e.left-t.width/2,name:"arrow_s"}),northWestArrowSouthMiddleEast:(e,t)=>({top:_c(e,t),left:e.left-.75*t.width+wc.arrowHorizontalOffset,name:"arrow_sme"}),northWestArrowSouthEast:(e,t)=>({top:_c(e,t),left:e.left-t.width+wc.arrowHorizontalOffset,name:"arrow_se"}),northArrowSouthWest:(e,t)=>({top:_c(e,t),left:e.left+e.width/2-wc.arrowHorizontalOffset,name:"arrow_sw"}),northArrowSouthMiddleWest:(e,t)=>({top:_c(e,t),left:e.left+e.width/2-.25*t.width-wc.arrowHorizontalOffset,name:"arrow_smw"}),northArrowSouth:(e,t)=>({top:_c(e,t),left:e.left+e.width/2-t.width/2,name:"arrow_s"}),northArrowSouthMiddleEast:(e,t)=>({top:_c(e,t),left:e.left+e.width/2-.75*t.width+wc.arrowHorizontalOffset,name:"arrow_sme"}),northArrowSouthEast:(e,t)=>({top:_c(e,t),left:e.left+e.width/2-t.width+wc.arrowHorizontalOffset,name:"arrow_se"}),northEastArrowSouthWest:(e,t)=>({top:_c(e,t),left:e.right-wc.arrowHorizontalOffset,name:"arrow_sw"}),northEastArrowSouthMiddleWest:(e,t)=>({top:_c(e,t),left:e.right-.25*t.width-wc.arrowHorizontalOffset,name:"arrow_smw"}),northEastArrowSouth:(e,t)=>({top:_c(e,t),left:e.right-t.width/2,name:"arrow_s"}),northEastArrowSouthMiddleEast:(e,t)=>({top:_c(e,t),left:e.right-.75*t.width+wc.arrowHorizontalOffset,name:"arrow_sme"}),northEastArrowSouthEast:(e,t)=>({top:_c(e,t),left:e.right-t.width+wc.arrowHorizontalOffset,name:"arrow_se"}),southWestArrowNorthWest:(e,t)=>({top:vc(e),left:e.left-wc.arrowHorizontalOffset,name:"arrow_nw"}),southWestArrowNorthMiddleWest:(e,t)=>({top:vc(e),left:e.left-.25*t.width-wc.arrowHorizontalOffset,name:"arrow_nmw"}),southWestArrowNorth:(e,t)=>({top:vc(e),left:e.left-t.width/2,name:"arrow_n"}),southWestArrowNorthMiddleEast:(e,t)=>({top:vc(e),left:e.left-.75*t.width+wc.arrowHorizontalOffset,name:"arrow_nme"}),southWestArrowNorthEast:(e,t)=>({top:vc(e),left:e.left-t.width+wc.arrowHorizontalOffset,name:"arrow_ne"}),southArrowNorthWest:(e,t)=>({top:vc(e),left:e.left+e.width/2-wc.arrowHorizontalOffset,name:"arrow_nw"}),southArrowNorthMiddleWest:(e,t)=>({top:vc(e),left:e.left+e.width/2-.25*t.width-wc.arrowHorizontalOffset,name:"arrow_nmw"}),southArrowNorth:(e,t)=>({top:vc(e),left:e.left+e.width/2-t.width/2,name:"arrow_n"}),southArrowNorthMiddleEast:(e,t)=>({top:vc(e),left:e.left+e.width/2-.75*t.width+wc.arrowHorizontalOffset,name:"arrow_nme"}),southArrowNorthEast:(e,t)=>({top:vc(e),left:e.left+e.width/2-t.width+wc.arrowHorizontalOffset,name:"arrow_ne"}),southEastArrowNorthWest:(e,t)=>({top:vc(e),left:e.right-wc.arrowHorizontalOffset,name:"arrow_nw"}),southEastArrowNorthMiddleWest:(e,t)=>({top:vc(e),left:e.right-.25*t.width-wc.arrowHorizontalOffset,name:"arrow_nmw"}),southEastArrowNorth:(e,t)=>({top:vc(e),left:e.right-t.width/2,name:"arrow_n"}),southEastArrowNorthMiddleEast:(e,t)=>({top:vc(e),left:e.right-.75*t.width+wc.arrowHorizontalOffset,name:"arrow_nme"}),southEastArrowNorthEast:(e,t)=>({top:vc(e),left:e.right-t.width+wc.arrowHorizontalOffset,name:"arrow_ne"})};o(20);class yc extends dc{constructor(){super();const e=this.bindTemplate;this.set("content",""),this.set("viewBox","0 0 20 20"),this.set("fillColor",""),this.setTemplate({tag:"svg",ns:"http://www.w3.org/2000/svg",attributes:{class:["ck","ck-icon"],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");for(t&&(this.viewBox=t),this.element.innerHTML="";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(22);class xc extends dc{constructor(e){super(e),this.set("text",""),this.set("position","s");const t=this.bindTemplate;this.setTemplate({tag:"span",attributes:{class:["ck","ck-tooltip",t.to("position",e=>"ck-tooltip_"+e),t.if("text","ck-hidden",e=>!e.trim())]},children:[{tag:"span",attributes:{class:["ck","ck-tooltip__text"]},children:[{text:t.to("text")}]}]})}}o(24);class Cc extends dc{constructor(e){super(e);const t=this.bindTemplate,o=ho();this.set("class"),this.set("labelStyle"),this.set("icon"),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isVisible",!0),this.set("isToggleable",!1),this.set("keystroke"),this.set("label"),this.set("tabindex",-1),this.set("tooltip"),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.set("withKeystroke",!1),this.children=this.createCollection(),this.tooltipView=this._createTooltipView(),this.labelView=this._createLabelView(o),this.iconView=new yc,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)),this.setTemplate({tag:"button",attributes:{class:["ck","ck-button",t.to("class"),t.if("isEnabled","ck-disabled",e=>!e),t.if("isVisible","ck-hidden",e=>!e),t.to("isOn",e=>e?"ck-on":"ck-off"),t.if("withText","ck-button_with-text"),t.if("withKeystroke","ck-button_with-keystroke")],type:t.to("type",e=>e||"button"),tabindex:t.to("tabindex"),"aria-labelledby":"ck-editor__aria-label_"+o,"aria-disabled":t.if("isEnabled",!0,e=>!e),"aria-pressed":t.to("isOn",e=>!!this.isToggleable&&String(e))},children:this.children,on:{mousedown:t.to(e=>{e.preventDefault()}),click:t.to(e=>{this.isEnabled?this.fire("execute"):e.preventDefault()})}})}render(){super.render(),this.icon&&(this.iconView.bind("content").to(this,"icon"),this.children.add(this.iconView)),this.children.add(this.tooltipView),this.children.add(this.labelView),this.withKeystroke&&this.children.add(this.keystrokeView)}focus(){this.element.focus()}_createTooltipView(){const e=new xc;return e.bind("text").to(this,"_tooltipString"),e.bind("position").to(this,"tooltipPosition"),e}_createLabelView(e){const t=new dc,o=this.bindTemplate;return t.setTemplate({tag:"span",attributes:{class:["ck","ck-button__label"],style:o.to("labelStyle"),id:"ck-editor__aria-label_"+e},children:[{text:this.bindTemplate.to("label")}]}),t}_createKeystrokeView(){const e=new dc;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__keystroke"]},children:[{text:this.bindTemplate.to("keystroke",e=>ki(e))}]}),e}_getTooltipString(e,t,o){return e?"string"==typeof e?e:(o&&(o=ki(o)),e instanceof Function?e(t,o):`${t}${o?` (${o})`:""}`):""}}class Ac{constructor(){this.set("isFocused",!1),this.set("focusedElement",null),this._elements=new Set,this._nextEventLoopTimeout=null}add(e){if(this._elements.has(e))throw new mo.b("focusTracker-add-element-already-exist: This element is already tracked by FocusTracker.",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(e),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)}}Co(Ac,gr),Co(Ac,qn);o(26),o(28);const Tc=fc("px");class Pc extends jl{static get pluginName(){return"ContextualBalloon"}constructor(e){super(e),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.view=new wc(e.locale),e.ui.view.body.add(this.view),e.ui.focusTracker.add(this.view.element),this._viewToStack=new Map,this._idToStack=new Map,this.set("_numberOfStacks",0),this.set("_singleViewMode",!1),this._rotatorView=this._createRotatorView(),this._fakePanelsView=this._createFakePanelsView()}hasView(e){return Array.from(this._viewToStack.keys()).includes(e)}add(e){if(this.hasView(e.view))throw new mo.b("contextualballoon-add-view-exist: Cannot add configuration of the same view twice.",[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 o=this._idToStack.get(t);e.singleViewMode&&this.showStack(t),o.set(e.view,e),this._viewToStack.set(e.view,o),o===this._visibleStack&&this._showView(e)}remove(e){if(!this.hasView(e))throw new mo.b("contextualballoon-remove-view-not-exist: Cannot remove the configuration of a non-existent view.",[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 mo.b("contextualballoon-showstack-stack-not-exist: Cannot show a stack that does not exist.",this);this._visibleStack!==t&&this._showView(Array.from(t.values()).pop())}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 Sc(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,o)=>{if(o<2)return"";const n=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return t("%0 of %1",[n,o])}),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 Ec(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:o=!0,singleViewMode:n=!1}){this.view.class=t,this.view.withArrow=o,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}}class Sc extends dc{constructor(e){super(e);const t=e.t,o=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new Ac,this.buttonPrevView=this._createButtonView(t("Previous"),'<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>'),this.buttonNextView=this._createButtonView(t("Next"),'<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>'),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",o.to("isNavigationVisible",e=>e?"":"ck-hidden")]},children:[this.buttonPrevView,{tag:"span",attributes:{class:["ck-balloon-rotator__counter"]},children:[{text:o.to("counter")}]},this.buttonNextView]},{tag:"div",attributes:{class:"ck-balloon-rotator__content"},children:this.content}]})}render(){super.render(),this.focusTracker.add(this.element)}showView(e){this.hideView(),this.content.add(e)}hideView(){this.content.clear()}_createButtonView(e,t){const o=new Cc(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o}}class Ec extends dc{constructor(e,t){super(e);const o=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",o.to("numberOfPanels",e=>e?"":"ck-hidden")],style:{top:o.to("top",Tc),left:o.to("left",Tc),width:o.to("width",Tc),height:o.to("height",Tc)}},children:this.content}),this.on("change:numberOfPanels",(e,t,o,n)=>{o>n?this._addPanels(o-n):this._removePanels(n-o),this.updatePosition()})}_addPanels(e){for(;e--;){const e=new dc;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:o,height:n}=new is(this._balloonPanelView.element);Object.assign(this,{top:e,left:t,width:o,height:n})}}}class Rc{constructor(e){if(Object.assign(this,e),e.actions&&e.keystrokeHandler)for(const t in e.actions){let o=e.actions[t];"string"==typeof o&&(o=[o]);for(const n of o)e.keystrokeHandler.set(n,(e,o)=>{this[t](),o()})}}get first(){return this.focusables.find(Ic)||null}get last(){return this.focusables.filter(Ic).slice(-1)[0]||null}get next(){return this._getFocusableItem(1)}get previous(){return this._getFocusableItem(-1)}get current(){let e=null;return null===this.focusTracker.focusedElement?null:(this.focusables.find((t,o)=>{const n=t.element===this.focusTracker.focusedElement;return n&&(e=o),n}),e)}focusFirst(){this._focus(this.first)}focusLast(){this._focus(this.last)}focusNext(){this._focus(this.next)}focusPrevious(){this._focus(this.previous)}_focus(e){e&&e.focus()}_getFocusableItem(e){const t=this.current,o=this.focusables.length;if(!o)return null;if(null===t)return this[1===e?"first":"last"];let n=(t+o+e)%o;do{const t=this.focusables.get(n);if(Ic(t))return t;n=(n+o+e)%o}while(n!==t);return null}}function Ic(e){return!(!e.focus||"none"==rr.window.getComputedStyle(e.element).display)}class Vc extends dc{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}})}}class Oc{constructor(e,t){Oc._observerInstance||Oc._createObserver(),this._element=e,this._callback=t,Oc._addElementCallback(e,t),Oc._observerInstance.observe(e)}destroy(){Oc._deleteElementCallback(this._element,this._callback)}static _addElementCallback(e,t){Oc._elementCallbacks||(Oc._elementCallbacks=new Map);let o=Oc._elementCallbacks.get(e);o||(o=new Set,Oc._elementCallbacks.set(e,o)),o.add(t)}static _deleteElementCallback(e,t){const o=Oc._getElementCallbacks(e);o&&(o.delete(t),o.size||(Oc._elementCallbacks.delete(e),Oc._observerInstance.unobserve(e))),Oc._elementCallbacks&&!Oc._elementCallbacks.size&&(Oc._observerInstance=null,Oc._elementCallbacks=null)}static _getElementCallbacks(e){return Oc._elementCallbacks?Oc._elementCallbacks.get(e):null}static _createObserver(){let e;e="function"==typeof rr.window.ResizeObserver?rr.window.ResizeObserver:Mc,Oc._observerInstance=new e(e=>{for(const t of e){const e=Oc._getElementCallbacks(t.target);if(e)for(const o of e)o(t)}})}}Oc._observerInstance=null,Oc._elementCallbacks=null;class Mc{constructor(e){this._callback=e,this._elements=new Set,this._previousRects=new Map,this._periodicCheckTimeout=null}observe(e){this._elements.add(e),this._checkElementRectsAndExecuteCallback(),1===this._elements.size&&this._startPeriodicCheck()}unobserve(e){this._elements.delete(e),this._previousRects.delete(e),this._elements.size||this._stopPeriodicCheck()}_startPeriodicCheck(){const e=()=>{this._checkElementRectsAndExecuteCallback(),this._periodicCheckTimeout=setTimeout(e,100)};this.listenTo(rr.window,"resize",()=>{this._checkElementRectsAndExecuteCallback()}),this._periodicCheckTimeout=setTimeout(e,100)}_stopPeriodicCheck(){clearTimeout(this._periodicCheckTimeout),this.stopListening(),this._previousRects.clear()}_checkElementRectsAndExecuteCallback(){const e=[];for(const t of this._elements)this._hasRectChanged(t)&&e.push({target:t,contentRect:this._previousRects.get(t)});e.length&&this._callback(e)}_hasRectChanged(e){if(!e.ownerDocument.body.contains(e))return!1;const t=new is(e),o=this._previousRects.get(e),n=!o||!o.isEqual(t);return this._previousRects.set(e,t),n}}Co(Mc,gr);class Nc extends dc{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")]},children:this.children,on:{selectstart:t.to(e=>e.preventDefault())}})}focus(){this.children.length&&this.children.first.focus()}focusLast(){if(this.children.length){const e=this.children.last;"function"==typeof e.focusLast?e.focusLast():e.focus()}}}o(30);class zc extends dc{constructor(e,t,o){super(e);const n=this.bindTemplate;this.buttonView=t,this.panelView=o,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("class"),this.set("id"),this.set("panelPosition","auto"),this.keystrokes=new Bl,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",n.to("class"),n.if("isEnabled","ck-disabled",e=>!e)],id:n.to("id"),"aria-describedby":n.to("ariaDescribedById")},children:[t,o]}),t.extendTemplate({attributes:{class:["ck-dropdown__button"]}})}render(){super.render(),this.listenTo(this.buttonView,"open",()=>{this.isOpen=!this.isOpen}),this.panelView.bind("isVisible").to(this,"isOpen"),this.on("change:isOpen",()=>{this.isOpen&&("auto"===this.panelPosition?this.panelView.position=zc._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions}).name:this.panelView.position=this.panelPosition)}),this.keystrokes.listenTo(this.element);const e=(e,t)=>{this.isOpen&&(this.buttonView.focus(),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{southEast:e,southWest:t,northEast:o,northWest:n}=zc.defaultPanelPositions;return"ltr"===this.locale.uiLanguageDirection?[e,t,o,n]:[t,e,n,o]}}zc.defaultPanelPositions={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.bottom-t.height,left:e.left-t.width+e.width,name:"nw"})},zc._getOptimalPosition=hc;var Bc='<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 Fc extends Cc{constructor(e){super(e),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{"aria-haspopup":!0}}),this.delegate("execute").to(this,"open")}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new yc;return e.content=Bc,e.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),e}}o(32);class Dc extends dc{constructor(){super(),this.items=this.createCollection(),this.focusTracker=new Ac,this.keystrokes=new Bl,this._focusCycler=new Rc({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowup",focusNext:"arrowdown"}}),this.setTemplate({tag:"ul",attributes:{class:["ck","ck-reset","ck-list"]},children:this.items})}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)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}class Lc extends dc{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__item"]},children:this.children})}focus(){this.children.first.focus()}}class Hc extends dc{constructor(e){super(e),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}})}}o(34);class jc extends Cc{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 dc;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),e}}function Wc({emitter:e,activator:t,callback:o,contextElements:n}){e.listenTo(document,"mousedown",(e,i)=>{if(!t())return;const r="function"==typeof i.composedPath?i.composedPath():[];for(const e of n)if(e.contains(i.target)||r.includes(e))return;o()})}o(36),o(38);function qc(e,t=Fc){const o=new t(e),n=new Nc(e),i=new zc(e,o,n);return o.bind("isEnabled").to(i),o instanceof Fc?o.bind("isOn").to(i,"isOpen"):o.arrowView.bind("isOn").to(i,"isOpen"),function(e){(function(e){e.on("render",()=>{Wc({emitter:e,activator:()=>e.isOpen,callback:()=>{e.isOpen=!1},contextElements:[e.element]})})})(e),function(e){e.on("execute",t=>{t.source instanceof jc||(e.isOpen=!1)})}(e),function(e){e.keystrokes.set("arrowdown",(t,o)=>{e.isOpen&&(e.panelView.focus(),o())}),e.keystrokes.set("arrowup",(t,o)=>{e.isOpen&&(e.panelView.focusLast(),o())})}(e)}(i),i}function $c(e,t){const o=e.locale,n=e.listView=new Dc(o);n.items.bindTo(t).using(({type:e,model:t})=>{if("separator"===e)return new Hc(o);if("button"===e||"switchbutton"===e){const n=new Lc(o);let i;return i="button"===e?new Cc(o):new jc(o),i.bind(...Object.keys(t)).to(t),i.delegate("execute").to(n),n.children.add(i),n}}),e.panelView.children.add(n),n.items.delegate("execute").to(e)}o(40);class Uc extends dc{constructor(e,t){super(e);const o=this.bindTemplate,n=this.t;var i;this.options=t||{},this.set("ariaLabel",n("Editor toolbar")),this.set("maxWidth","auto"),this.items=this.createCollection(),this.focusTracker=new Ac,this.keystrokes=new Bl,this.set("class"),this.set("isCompact",!1),this.itemsView=new Gc(e),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection(),this._focusCycler=new Rc({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:["arrowleft","arrowup"],focusNext:["arrowright","arrowdown"]}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar",o.to("class"),o.if("isCompact","ck-toolbar_compact")],role:"toolbar","aria-label":o.to("ariaLabel"),style:{maxWidth:o.to("maxWidth")}},children:this.children,on:{mousedown:(i=this,i.bindTemplate.to(e=>{e.target===i.element&&e.preventDefault()}))}}),this._behavior=this.options.shouldGroupWhenFull?new Jc(this):new Kc(this)}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),this._behavior.render(this)}destroy(){return this._behavior.destroy(),super.destroy()}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}fillFromConfig(e,t){this.items.addMany(e.map(e=>"|"==e?new Vc:t.has(e)?t.create(e):void console.warn(Object(mo.a)("toolbarview-item-unavailable: The requested toolbar item is unavailable."),{name:e})).filter(e=>void 0!==e))}}class Gc extends dc{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children})}}class Kc{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=>e),e.extendTemplate({attributes:{class:[t.if("isVertical","ck-toolbar_vertical")]}})}render(){}destroy(){}}class Jc{constructor(e){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(),this.resizeObserver=null,this.cachedPadding=null,this.shouldUpdateGroupingOnNextResize=!1,e.itemsView.children.bindTo(this.ungroupedItems).using(e=>e),this.ungroupedItems.on("add",this._updateFocusCycleableItems.bind(this)),this.ungroupedItems.on("remove",this._updateFocusCycleableItems.bind(this)),e.children.on("add",this._updateFocusCycleableItems.bind(this)),e.children.on("remove",this._updateFocusCycleableItems.bind(this)),e.items.on("change",(e,t)=>{const o=t.index;for(const e of t.removed)o>=this.ungroupedItems.length?this.groupedItems.remove(e):this.ungroupedItems.remove(e);for(let e=o;e<o+t.added.length;e++){const n=t.added[e-o];e>this.ungroupedItems.length?this.groupedItems.add(n,e-this.ungroupedItems.length):this.ungroupedItems.add(n,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(!this.viewElement.offsetParent)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,o=new is(e.lastChild),n=new is(e);if(!this.cachedPadding){const o=rr.window.getComputedStyle(e),n="ltr"===t?"paddingRight":"paddingLeft";this.cachedPadding=Number.parseInt(o[n])}return"ltr"===t?o.right>n.right-this.cachedPadding:o.left<n.left+this.cachedPadding}_enableGroupingOnResize(){let e;this.resizeObserver=new Oc(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 Vc),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,o=qc(e);return o.class="ck-toolbar__grouped-dropdown",o.panelPosition="ltr"===e.uiLanguageDirection?"sw":"se",function(e,t){const o=e.locale,n=o.t,i=e.toolbarView=new Uc(o);i.set("ariaLabel",n("Dropdown toolbar")),e.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),t.map(e=>i.items.add(e)),e.panelView.children.add(i),i.items.delegate("execute").to(e)}(o,[]),o.buttonView.set({label:t("Show more items"),tooltip:!0,icon:'<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>'}),o.toolbarView.items.bindTo(this.groupedItems).using(e=>e),o}_updateFocusCycleableItems(){this.viewFocusables.clear(),this.ungroupedItems.map(e=>{this.viewFocusables.add(e)}),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}}function Yc(e){return Array.isArray(e)?{items:e}:e?Object.assign({items:[]},e):{items:[]}}const Qc=fc("px");class Xc extends jl{static get pluginName(){return"BalloonToolbar"}static get requires(){return[Pc]}constructor(e){super(e),this._balloonConfig=Yc(e.config.get("balloonToolbar")),this.toolbarView=this._createToolbarView(),this.focusTracker=new Ac,e.ui.once("ready",()=>{this.focusTracker.add(e.ui.getEditableElement()),this.focusTracker.add(this.toolbarView.element)}),this._resizeObserver=null,this._balloon=e.plugins.get(Pc),this._fireSelectionChangeDebounced=Jr(()=>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,o)=>{const n=this._balloon.visibleView===this.toolbarView;!o&&n?this.hide():o&&this.show()}),this.listenTo(t,"change:range",(e,o)=>{(o.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 Oc(t,()=>{this.toolbarView.maxWidth=Qc(.9*new is(t).width)})}),this.listenTo(this.toolbarView,"groupedItemsUpdate",()=>{this._updatePosition()})}afterInit(){const e=this.editor.ui.componentFactory;this.toolbarView.fillFromConfig(this._balloonConfig.items,e)}_createToolbarView(){const e=!this._balloonConfig.shouldNotGroupWhenFull,t=new Uc(this.editor.locale,{shouldGroupWhenFull:e});return t.extendTemplate({attributes:{class:["ck-toolbar_floating"]}}),t.render(),t}show(){const e=this.editor,t=e.model.document.selection,o=e.model.schema;this._balloon.hasView(this.toolbarView)||t.isCollapsed||function(e,t){if(1===e.rangeCount)return!1;return[...e.getRanges()].every(e=>{const o=e.getContainedElement();return o&&t.isSelectable(o)})}(t,o)||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,o=t.selection,n=t.selection.isBackward;return{target:()=>{const t=n?o.getFirstRange():o.getLastRange(),i=is.getDomRangeRects(e.domConverter.viewRangeToDom(t));return n?i[0]:(i.length>1&&0===i[i.length-1].width&&i.pop(),i[i.length-1])},positions:Zc(n)}}_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()}}function Zc(e){const t=wc.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]}class ed{constructor(e){this.editor=e,this._components=new Map}*names(){for(const e of this._components.values())yield e.originalName}add(e,t){this._components.set(td(e),{callback:t,originalName:e})}create(e){if(!this.has(e))throw new mo.b("componentfactory-item-missing: The required component is not registered in the factory.",this,{name:e});return this._components.get(td(e)).callback(this.editor.locale)}has(e){return this._components.has(td(e))}}function td(e){return String(e).toLowerCase()}class od{constructor(e){this.editor=e,this.componentFactory=new ed(e),this.focusTracker=new Ac,this._editableElementsMap=new Map,this.listenTo(e.editing.view.document,"layoutChanged",()=>this.update())}get element(){return null}update(){this.fire("update")}destroy(){this.stopListening(),this.focusTracker.destroy();for(const e of this._editableElementsMap.values())e.ckeditorInstance=null;this._editableElementsMap=new Map}setEditableElement(e,t){this._editableElementsMap.set(e,t),t.ckeditorInstance||(t.ckeditorInstance=this.editor)}getEditableElement(e="main"){return this._editableElementsMap.get(e)}getEditableElementsNames(){return this._editableElementsMap.keys()}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}}Co(od,po);o(42);const nd=new WeakMap;function id(e){const{view:t,element:o,text:n,isDirectHost:i=!0}=e,r=t.document;nd.has(r)||(nd.set(r,new Map),r.registerPostFixer(e=>sd(r,e))),nd.get(r).set(o,{text:n,isDirectHost:i}),t.change(e=>sd(r,e))}function rd(e,t){return!!t.hasClass("ck-placeholder")&&(e.removeClass("ck-placeholder",t),!0)}function sd(e,t){const o=nd.get(e);let n=!1;for(const[e,i]of o)ad(t,e,i)&&(n=!0);return n}function ad(e,t,o){const{text:n,isDirectHost:i}=o,r=i?t:function(e){if(1===e.childCount){const t=e.getChild(0);if(t.is("element")&&!t.is("uiElement"))return t}return null}(t);let s=!1;return!!r&&(o.hostElement=r,r.getAttribute("data-placeholder")!==n&&(e.setAttribute("data-placeholder",n,r),s=!0),!function(e){if(!e.isAttached())return!1;const t=!Array.from(e.getChildren()).some(e=>!e.is("uiElement")),o=e.document;if(!o.isFocused&&t)return!0;const n=o.selection.anchor;return!(!t||!n||n.parent===e)}(r)?rd(e,r)&&(s=!0):function(e,t){return!t.hasClass("ck-placeholder")&&(e.addClass("ck-placeholder",t),!0)}(e,r)&&(s=!0),s)}class ld extends od{constructor(e,t){super(e),this.view=t}get element(){return this.view.editable.element}init(){const e=this.editor,t=this.view,o=e.plugins.get("BalloonToolbar"),n=e.editing.view,i=t.editable,r=n.document.getRoot();i.name=r.rootName,t.render();const s=i.element;this.setEditableElement(i.name,s),this.focusTracker.add(s),i.bind("isFocused").to(this.focusTracker),n.attachDomRoot(s),function({origin:e,originKeystrokeHandler:t,originFocusTracker:o,toolbar:n,beforeFocus:i,afterBlur:r}){o.add(n.element),t.set("Alt+F10",(e,t)=>{o.isFocused&&!n.focusTracker.isFocused&&(i&&i(),n.focus(),t())}),n.keystrokes.set("Esc",(t,o)=>{n.focusTracker.isFocused&&(e.focus(),r&&r(),o())})}({origin:n,originFocusTracker:this.focusTracker,originKeystrokeHandler:e.keystrokes,toolbar:o.toolbarView,beforeFocus(){o.show()},afterBlur(){o.hide()}}),this._initPlaceholder(),this.fire("ready")}destroy(){const e=this.view;this.editor.editing.view.detachDomRoot(e.editable.name),e.destroy(),super.destroy()}_initPlaceholder(){const e=this.editor,t=e.editing.view,o=t.document.getRoot(),n=e.sourceElement,i=e.config.get("placeholder")||n&&"textarea"===n.tagName.toLowerCase()&&n.getAttribute("placeholder");i&&id({view:t,element:o,text:i,isDirectHost:!1})}}var cd=function(e){return"string"==typeof e||!ze(e)&&p(e)&&"[object String]"==m(e)};function dd(e,t,o={},n=[]){const i=o&&o.xmlns,r=i?e.createElementNS(i,t):e.createElement(t);for(const e in o)r.setAttribute(e,o[e]);!cd(n)&&xo(n)||(n=[n]);for(let t of n)cd(t)&&(t=e.createTextNode(t)),r.appendChild(t);return r}class hd extends ql{constructor(e,t=[]){super(t),this.locale=e}attachToDom(){this._bodyCollectionContainer=new $l({tag:"div",attributes:{class:["ck","ck-reset_all","ck-body","ck-rounded-corners"],dir:this.locale.uiLanguageDirection},children:this}).render();let e=document.querySelector(".ck-body-wrapper");e||(e=dd(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()}}o(44);class ud extends dc{constructor(e){super(e),this.body=new hd(e)}render(){super.render(),this.body.attachToDom()}destroy(){return this.body.detachFromDom(),super.destroy()}}class md extends dc{constructor(e,t,o){super(e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-content","ck-editor__editable","ck-rounded-corners"],lang:e.contentLanguage,dir:e.contentLanguageDirection}}),this.name=null,this.set("isFocused",!1),this._editableElement=o,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()}_updateIsFocusedClasses(){const e=this._editingView;function t(t){e.change(o=>{const n=e.document.getRoot(t.name);o.addClass(t.isFocused?"ck-focused":"ck-blurred",n),o.removeClass(t.isFocused?"ck-blurred":"ck-focused",n)})}e.isRenderingInProgress?function o(n){e.once("change:isRenderingInProgress",(e,i,r)=>{r?o(n):t(n)})}(this):t(this)}}class gd extends md{constructor(e,t,o){super(e,t,o),this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}})}render(){super.render();const e=this._editingView,t=this.t;e.change(o=>{const n=e.document.getRoot(this.name);o.setAttribute("aria-label",t("Rich Text Editor, %0",[this.name]),n)})}}class fd extends ud{constructor(e,t,o){super(e),this.editable=new gd(e,t,o)}render(){super.render(),this.registerChild(this.editable)}}function pd(e,t){e instanceof HTMLTextAreaElement&&(e.value=t),e.innerHTML=t}var bd={setData(e){this.data.set(e)},getData(e){return this.data.get(e)}};var wd={updateSourceElement(){if(!this.sourceElement)throw new mo.b("editor-missing-sourceelement: Cannot update the source element of a detached editor.",this);pd(this.sourceElement,this.data.get())}};class kd extends Dl{constructor(e,t){super(t),no(e)&&(this.sourceElement=e,function(e){const t=e.sourceElement;if(t){if(t.ckeditorInstance)throw new mo.b("editor-source-element-already-used: The DOM element cannot be used to create multiple editor instances.",e);t.ckeditorInstance=e,e.once("destroy",()=>{delete t.ckeditorInstance})}}(this));const o=this.config.get("plugins");o.push(Xc),this.config.set("plugins",o),this.config.define("balloonToolbar",this.config.get("toolbar")),this.data.processor=new Hl(this.data.viewDocument),this.model.document.createRoot();const n=new fd(this.locale,this.editing.view,this.sourceElement);this.ui=new ld(this,n),function(e){if(!D(e.updateSourceElement))throw new mo.b("attachtoform-missing-elementapi-interface: Editor passed to attachToForm() must implement ElementApi.",e);const t=e.sourceElement;if(t&&"textarea"===t.tagName.toLowerCase()&&t.form){let o;const n=t.form,i=()=>e.updateSourceElement();D(n.submit)&&(o=n.submit,n.submit=()=>{i(),o.apply(n)}),n.addEventListener("submit",i),e.on("destroy",()=>{n.removeEventListener("submit",i),o&&(n.submit=o)})}}(this)}destroy(){const e=this.getData();return this.ui.destroy(),super.destroy().then(()=>{this.sourceElement&&pd(this.sourceElement,e)})}static create(e,t={}){return new Promise(o=>{const n=no(e);if(n&&"TEXTAREA"===e.tagName)throw new mo.b("editor-wrong-element: This type of editor cannot be initialized inside <textarea> element.",null);const i=new this(e,t);o(i.initPlugins().then(()=>{i.ui.init()}).then(()=>{if(!n&&t.initialData)throw new mo.b("editor-create-initial-data: The config.initialData option cannot be used together with initial data passed in Editor.create().",null);const o=t.initialData||function(e){return no(e)?(t=e,t instanceof HTMLTextAreaElement?t.value:t.innerHTML):e;var t}(e);return i.data.init(o)}).then(()=>i.fire("ready")).then(()=>i))})}}Co(kd,bd),Co(kd,wd);class _d{constructor(e){this.context=e}destroy(){this.stopListening()}static get isContextPlugin(){return!0}}Co(_d,qn);class vd extends _d{static get pluginName(){return"PendingActions"}init(){this.set("hasAny",!1),this._actions=new Ao({idProperty:"_id"}),this._actions.delegate("add","remove").to(this)}add(e){if("string"!=typeof e)throw new mo.b("pendingactions-add-invalid-message: The message must be a string.",this);const t=Object.create(qn);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]()}}class yd{constructor(){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((o,n)=>{t.onload=()=>{const e=t.result;this._data=e,o(e)},t.onerror=()=>{n("error")},t.onabort=()=>{n("aborted")},this._reader.readAsDataURL(e)})}abort(){this._reader.abort()}}Co(yd,qn);class xd extends jl{static get pluginName(){return"FileRepository"}static get requires(){return[vd]}init(){this.loaders=new Ao,this.loaders.on("add",()=>this._updatePendingAction()),this.loaders.on("remove",()=>this._updatePendingAction()),this._loadersMap=new Map,this._pendingAction=null,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 console.warn(Object(mo.a)("filerepository-no-upload-adapter: Upload adapter is not defined.")),null;const t=new Cd(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 Cd?e:this.getLoader(e);t._destroy(),this.loaders.remove(t),this._loadersMap.forEach((e,o)=>{e===t&&this._loadersMap.delete(o)})}_updatePendingAction(){const e=this.editor.plugins.get(vd);if(this.loaders.length){if(!this._pendingAction){const t=this.editor.t,o=e=>`${t("Upload in progress")} ${parseInt(e)}%.`;this._pendingAction=e.add(o(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",o)}}else e.remove(this._pendingAction),this._pendingAction=null}}Co(xd,qn);class Cd{constructor(e,t){this.id=ho(),this._filePromiseWrapper=this._createFilePromiseWrapper(e),this._adapter=t(this),this._reader=new yd,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 mo.b("filerepository-read-wrong-status: You cannot call read if the status is different than idle.",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 mo.b("filerepository-upload-wrong-status: You cannot call upload if the status is different than idle.",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((o,n)=>{t.rejecter=n,t.isFulfilled=!1,e.then(e=>{t.isFulfilled=!0,o(e)}).catch(e=>{t.isFulfilled=!0,n(e)})}),t}}Co(Cd,qn);function Ad(){let e=function(e){e=e.toLowerCase();const t=document.cookie.split(";");for(const o of t){const t=o.split("=");if(decodeURIComponent(t[0].trim().toLowerCase())===e)return decodeURIComponent(t[1])}return null}("ckCsrfToken");var t,o;return e&&40==e.length||(e=function(e){let t="";const o=new Uint8Array(e);window.crypto.getRandomValues(o);for(let e=0;e<o.length;e++){const n="abcdefghijklmnopqrstuvwxyz0123456789".charAt(o[e]%"abcdefghijklmnopqrstuvwxyz0123456789".length);t+=Math.random()>.5?n.toUpperCase():n}return t}(40),t="ckCsrfToken",o=e,document.cookie=encodeURIComponent(t)+"="+encodeURIComponent(o)+";path=/"),e}class Td{constructor(e,t,o){this.loader=e,this.url=t,this.t=o}upload(){return this.loader.file.then(e=>new Promise((t,o)=>{this._initRequest(),this._initListeners(t,o,e),this._sendRequest(e)}))}abort(){this.xhr&&this.xhr.abort()}_initRequest(){const e=this.xhr=new XMLHttpRequest;e.open("POST",this.url,!0),e.responseType="json"}_initListeners(e,t,o){const n=this.xhr,i=this.loader,r=(0,this.t)("Cannot upload file:")+` ${o.name}.`;n.addEventListener("error",()=>t(r)),n.addEventListener("abort",()=>t()),n.addEventListener("load",()=>{const o=n.response;if(!o||!o.uploaded)return t(o&&o.error&&o.error.message?o.error.message:r);e({default:o.url})}),n.upload&&n.upload.addEventListener("progress",e=>{e.lengthComputable&&(i.uploadTotal=e.total,i.uploaded=e.loaded)})}_sendRequest(e){const t=new FormData;t.append("upload",e),t.append("ckCsrfToken",Ad()),this.xhr.send(t)}}function Pd(e){const t=e.next();return t.done?null:t.value}function Sd(e,t,o,n){let i,r=null;"function"==typeof n?i=n:(r=e.commands.get(n),i=()=>{e.execute(n)}),e.model.document.on("change:data",(n,s)=>{if(r&&!r.isEnabled||!t.isEnabled)return;const a=Pd(e.model.document.selection.getRanges());if(!a.isCollapsed)return;if("transparent"==s.type)return;const l=Array.from(e.model.document.differ.getChanges()),c=l[0];if(1!=l.length||"insert"!==c.type||"$text"!=c.name||1!=c.length)return;const d=c.position.parent;if(d.is("element","codeBlock"))return;if(r&&!0===r.value)return;const h=d.getChild(0),u=e.model.createRangeOn(h);if(!u.containsRange(a)&&!a.end.isEqual(u.end))return;const m=o.exec(h.data.substr(0,a.end.offset));m&&e.model.enqueueChange(e=>{const t=e.createPositionAt(d,0),o=e.createPositionAt(d,m[0].length),n=new Ls(t,o);!1!==i({match:m})&&e.remove(n),n.detach()})})}function Ed(e,t,o,n){let i,r;o instanceof RegExp?i=o:r=o,r=r||(e=>{let t;const o=[],n=[];for(;null!==(t=i.exec(e))&&!(t&&t.length<4);){let{index:e,1:i,2:r,3:s}=t;const a=i+r+s;e+=t[0].length-a.length;const l=[e,e+i.length],c=[e+i.length+r.length,e+i.length+r.length+s.length];o.push(l),o.push(c),n.push([e+i.length,e+i.length+r.length])}return{remove:o,format:n}}),e.model.document.on("change:data",(o,i)=>{if("transparent"==i.type||!t.isEnabled)return;const s=e.model,a=s.document.selection;if(!a.isCollapsed)return;const l=Array.from(s.document.differ.getChanges()),c=l[0];if(1!=l.length||"insert"!==c.type||"$text"!=c.name||1!=c.length)return;const d=a.focus,h=d.parent,{text:u,range:m}=function(e,t){let o=e.start;return{text:Array.from(e.getItems()).reduce((e,n)=>!n.is("$text")&&!n.is("$textProxy")||n.getAttribute("code")?(o=t.createPositionAfter(n),""):e+n.data,""),range:t.createRange(o,e.end)}}(s.createRange(s.createPositionAt(h,0),d),s),g=r(u),f=Rd(m.start,g.format,s),p=Rd(m.start,g.remove,s);f.length&&p.length&&s.enqueueChange(e=>{if(!1!==n(e,f))for(const t of p.reverse())e.remove(t)})})}function Rd(e,t,o){return t.filter(e=>void 0!==e[0]&&void 0!==e[1]).map(t=>o.createRange(e.getShiftedBy(t[0]),e.getShiftedBy(t[1])))}function Id(e,t){return(o,n)=>{if(!e.commands.get(t).isEnabled)return!1;const i=e.model.schema.getValidRanges(n,t);for(const e of i)o.setAttribute(t,!0,e);o.removeSelectionAttribute(t)}}class Vd{constructor(e){this.editor=e,this.set("value",void 0),this.set("isEnabled",!1),this._disableStack=new Set,this.decorate("execute"),this.listenTo(this.editor.model.document,"change",()=>{this.refresh()}),this.on("execute",e=>{this.isEnabled||e.stop()},{priority:"high"}),this.listenTo(e,"change:isReadOnly",(e,t,o)=>{o?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")})}refresh(){this.isEnabled=!0}forceDisabled(e){this._disableStack.add(e),1==this._disableStack.size&&(this.on("set:isEnabled",Od,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",Od),this.refresh())}execute(){}destroy(){this.stopListening()}}function Od(e){e.return=!1,e.stop()}Co(Vd,qn);class Md extends Vd{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,o=t.document.selection,n=void 0===e.forceValue?!this.value:e.forceValue;t.change(e=>{if(o.isCollapsed)n?e.setSelectionAttribute(this.attributeKey,!0):e.removeSelectionAttribute(this.attributeKey);else{const i=t.schema.getValidRanges(o.getRanges(),this.attributeKey);for(const t of i)n?e.setAttribute(this.attributeKey,n,t):e.removeAttribute(this.attributeKey,t)}})}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,o=e.document.selection;if(o.isCollapsed)return o.hasAttribute(this.attributeKey);for(const e of o.getRanges())for(const o of e.getItems())if(t.checkAttribute(o,this.attributeKey))return o.hasAttribute(this.attributeKey);return!1}}class Nd extends jl{static get pluginName(){return"BoldEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"bold"}),e.model.schema.setAttributeProperties("bold",{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:"bold",view:"strong",upcastAlso:["b",e=>{const t=e.getStyle("font-weight");return t?"bold"==t||Number(t)>=600?{name:!0,styles:["font-weight"]}:void 0:null}]}),e.commands.add("bold",new Md(e,"bold")),e.keystrokes.set("CTRL+B","bold")}}class zd extends jl{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("bold",o=>{const n=e.commands.get("bold"),i=new Cc(o);return i.set({label:t("Bold"),icon:'<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>',keystroke:"CTRL+B",tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(n,"value","isEnabled"),this.listenTo(i,"execute",()=>{e.execute("bold"),e.editing.view.focus()}),i})}}class Bd extends jl{static get pluginName(){return"ItalicEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"italic"}),e.model.schema.setAttributeProperties("italic",{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:"italic",view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),e.commands.add("italic",new Md(e,"italic")),e.keystrokes.set("CTRL+I","italic")}}class Fd extends jl{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("italic",o=>{const n=e.commands.get("italic"),i=new Cc(o);return i.set({label:t("Italic"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.586 14.633l.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",tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(n,"value","isEnabled"),this.listenTo(i,"execute",()=>{e.execute("italic"),e.editing.view.focus()}),i})}}class Dd extends jl{static get pluginName(){return"SuperscriptEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"superscript"}),e.model.schema.setAttributeProperties("superscript",{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:"superscript",view:"sup",upcastAlso:[{styles:{"vertical-align":"super"}}]}),e.commands.add("superscript",new Md(e,"superscript"))}}class Ld extends jl{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("superscript",o=>{const n=e.commands.get("superscript"),i=new Cc(o);return i.set({label:t("Superscript"),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>',tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(n,"value","isEnabled"),this.listenTo(i,"execute",()=>{e.execute("superscript"),e.editing.view.focus()}),i})}}class Hd extends jl{static get pluginName(){return"SubscriptEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"subscript"}),e.model.schema.setAttributeProperties("subscript",{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:"subscript",view:"sub",upcastAlso:[{styles:{"vertical-align":"sub"}}]}),e.commands.add("subscript",new Md(e,"subscript"))}}class jd extends jl{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("subscript",o=>{const n=e.commands.get("subscript"),i=new Cc(o);return i.set({label:t("Subscript"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7.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.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>',tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(n,"value","isEnabled"),this.listenTo(i,"execute",()=>{e.execute("subscript"),e.editing.view.focus()}),i})}}class Wd extends jl{static get pluginName(){return"UnderlineEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"underline"}),e.model.schema.setAttributeProperties("underline",{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:"underline",view:"u",upcastAlso:{styles:{"text-decoration":"underline"}}}),e.commands.add("underline",new Md(e,"underline")),e.keystrokes.set("CTRL+U","underline")}}class qd extends jl{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("underline",o=>{const n=e.commands.get("underline"),i=new Cc(o);return i.set({label:t("Underline"),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>',keystroke:"CTRL+U",tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(n,"value","isEnabled"),this.listenTo(i,"execute",()=>{e.execute("underline"),e.editing.view.focus()}),i})}}class $d extends jl{static get pluginName(){return"StrikethroughEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"strikethrough"}),e.model.schema.setAttributeProperties("strikethrough",{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:"strikethrough",view:"s",upcastAlso:["del","strike",{styles:{"text-decoration":"line-through"}}]}),e.commands.add("strikethrough",new Md(e,"strikethrough")),e.keystrokes.set("CTRL+SHIFT+X","strikethrough")}}class Ud extends jl{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("strikethrough",o=>{const n=e.commands.get("strikethrough"),i=new Cc(o);return i.set({label:t("Strikethrough"),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 9L6 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",tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(n,"value","isEnabled"),this.listenTo(i,"execute",()=>{e.execute("strikethrough"),e.editing.view.focus()}),i})}}class Gd extends jl{static get pluginName(){return"TwoStepCaretMovement"}constructor(e){super(e),this.attributes=new Set,this._overrideUid=null}init(){const e=this.editor,t=e.model,o=e.editing.view,n=e.locale,i=t.document.selection;this.listenTo(o.document,"keydown",(e,t)=>{if(!i.isCollapsed)return;if(t.shiftKey||t.altKey||t.ctrlKey)return;const o=t.keyCode==pi.arrowright,r=t.keyCode==pi.arrowleft;if(!o&&!r)return;const s=n.contentLanguageDirection;let a=!1;a="ltr"===s&&o||"rtl"===s&&r?this._handleForwardMovement(t):this._handleBackwardMovement(t),!0===a&&e.stop()},{priority:uo.get("high")+1}),this._isNextGravityRestorationSkipped=!1,this.listenTo(i,"change:range",(e,t)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!t.directChange&&Qd(i.getFirstPosition(),this.attributes)||this._restoreGravity())})}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){const t=this.attributes,o=this.editor.model.document.selection,n=o.getFirstPosition();return!this._isGravityOverridden&&((!n.isAtStart||!Kd(o,t))&&(Qd(n,t)?(Yd(e),this._overrideGravity(),!0):void 0))}_handleBackwardMovement(e){const t=this.attributes,o=this.editor.model,n=o.document.selection,i=n.getFirstPosition();return this._isGravityOverridden?(Yd(e),this._restoreGravity(),Jd(o,t,i),!0):i.isAtStart?!!Kd(n,t)&&(Yd(e),Jd(o,t,i),!0):function(e,t){return Qd(e.getShiftedBy(-1),t)}(i,t)?i.isAtEnd&&!Kd(n,t)&&Qd(i,t)?(Yd(e),Jd(o,t,i),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1):void 0}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 Kd(e,t){for(const o of t)if(e.hasAttribute(o))return!0;return!1}function Jd(e,t,o){const n=o.nodeBefore;e.change(e=>{n?e.setSelectionAttribute(n.getAttributes()):e.removeSelectionAttribute(t)})}function Yd(e){e.preventDefault()}function Qd(e,t){const{nodeBefore:o,nodeAfter:n}=e;for(const e of t){const t=o?o.getAttribute(e):void 0;if((n?n.getAttribute(e):void 0)!==t)return!0}return!1}function Xd(e,t,o,n){return n.createRange(Zd(e,t,o,!0,n),Zd(e,t,o,!1,n))}function Zd(e,t,o,n,i){let r=e.textNode||(n?e.nodeBefore:e.nodeAfter),s=null;for(;r&&r.getAttribute(t)==o;)s=r,r=n?r.previousSibling:r.nextSibling;return s?i.createPositionAt(s,n?"before":"after"):e}function eh(e,t,o,n){const i=e.editing.view,r=new Set;i.document.registerPostFixer(i=>{const s=e.model.document.selection;let a=!1;if(s.hasAttribute(t)){const l=Xd(s.getFirstPosition(),t,s.getAttribute(t),e.model),c=e.editing.mapper.toViewRange(l);for(const e of c.getItems())e.is("element",o)&&!e.hasClass(n)&&(i.addClass(n,e),r.add(e),a=!0)}return a}),e.conversion.for("editingDowncast").add(e=>{function t(){i.change(e=>{for(const t of r.values())e.removeClass(n,t),r.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"})})}const th="code";class oh extends jl{static get pluginName(){return"CodeEditing"}static get requires(){return[Gd]}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:th}),e.model.schema.setAttributeProperties(th,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:th,view:"code",upcastAlso:{styles:{"word-wrap":"break-word"}}}),e.commands.add(th,new Md(e,th)),e.plugins.get(Gd).registerAttribute(th),eh(e,th,"code","ck-code_selected")}}o(11);class nh extends jl{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("code",o=>{const n=e.commands.get("code"),i=new Cc(o);return i.set({label:t("Code"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.5 5.7l5.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>',tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(n,"value","isEnabled"),this.listenTo(i,"execute",()=>{e.execute("code"),e.editing.view.focus()}),i})}}class ih extends Vd{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,o=t.schema,n=t.document.selection,i=Array.from(n.getSelectedBlocks()),r=void 0===e.forceValue?!this.value:e.forceValue;t.change(e=>{if(r){const t=i.filter(e=>rh(e)||ah(o,e));this._applyQuote(e,t)}else this._removeQuote(e,i.filter(rh))})}_getValue(){const e=Pd(this.editor.model.document.selection.getSelectedBlocks());return!(!e||!rh(e))}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,o=Pd(e.getSelectedBlocks());return!!o&&ah(t,o)}_removeQuote(e,t){sh(e,t).reverse().forEach(t=>{if(t.start.isAtStart&&t.end.isAtEnd)return void e.unwrap(t.start.parent);if(t.start.isAtStart){const o=e.createPositionBefore(t.start.parent);return void e.move(t,o)}t.end.isAtEnd||e.split(t.end);const o=e.createPositionAfter(t.end.parent);e.move(t,o)})}_applyQuote(e,t){const o=[];sh(e,t).reverse().forEach(t=>{let n=rh(t.start);n||(n=e.createElement("blockQuote"),e.wrap(t,n)),o.push(n)}),o.reverse().reduce((t,o)=>t.nextSibling==o?(e.merge(e.createPositionAfter(t)),t):o)}}function rh(e){return"blockQuote"==e.parent.name?e.parent:null}function sh(e,t){let o,n=0;const i=[];for(;n<t.length;){const r=t[n],s=t[n+1];o||(o=e.createPositionBefore(r)),s&&r.nextSibling==s||(i.push(e.createRange(o,e.createPositionAfter(r))),o=null),n++}return i}function ah(e,t){const o=e.checkChild(t.parent,"blockQuote"),n=e.checkChild(["$root","blockQuote"],t);return o&&n}class lh extends jl{static get pluginName(){return"BlockQuoteEditing"}init(){const e=this.editor,t=e.model.schema;e.commands.add("blockQuote",new ih(e)),t.register("blockQuote",{allowWhere:"$block",allowContentOf:"$root"}),t.addChildCheck((e,t)=>{if(e.endsWith("blockQuote")&&"blockQuote"==t.name)return!1}),e.conversion.elementToElement({model:"blockQuote",view:"blockquote"}),e.model.document.registerPostFixer(o=>{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 o.remove(n),!0;if(n.is("element","blockQuote")&&!t.checkChild(e.position,n))return o.unwrap(n),!0;if(n.is("element")){const e=o.createRangeIn(n);for(const n of e.getItems())if(n.is("element","blockQuote")&&!t.checkChild(o.createPositionBefore(n),n))return o.unwrap(n),!0}}else if("remove"==e.type){const t=e.position.parent;if(t.is("element","blockQuote")&&t.isEmpty)return o.remove(t),!0}return!1})}afterInit(){const e=this.editor.commands.get("blockQuote");this.listenTo(this.editor.editing.view.document,"enter",(t,o)=>{const n=this.editor.model.document,i=n.selection.getLastPosition().parent;n.selection.isCollapsed&&i.isEmpty&&e.value&&(this.editor.execute("blockQuote"),this.editor.editing.view.scrollToTheSelection(),o.preventDefault(),t.stop())})}}o(47);class ch extends jl{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("blockQuote",o=>{const n=e.commands.get("blockQuote"),i=new Cc(o);return i.set({label:t("Block quote"),icon:'<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>',tooltip:!0,isToggleable:!0}),i.bind("isOn","isEnabled").to(n,"value","isEnabled"),this.listenTo(i,"execute",()=>{e.execute("blockQuote"),e.editing.view.focus()}),i})}}class dh extends Vd{refresh(){const e=this.editor.model,t=Pd(e.document.selection.getSelectedBlocks());this.value=!!t&&t.is("element","paragraph"),this.isEnabled=!!t&&hh(t,e.schema)}execute(e={}){const t=this.editor.model,o=t.document;t.change(n=>{const i=(e.selection||o.selection).getSelectedBlocks();for(const e of i)!e.is("element","paragraph")&&hh(e,t.schema)&&n.rename(e,"paragraph")})}}function hh(e,t){return t.checkChild(e.parent,"paragraph")&&!t.isObject(e)}class uh extends Vd{execute(e){const t=this.editor.model;let o=e.position;t.change(e=>{const n=e.createElement("paragraph");if(!t.schema.checkChild(o.parent,n)){const i=t.schema.findAllowedParent(o,n);if(!i)return;o=e.split(o,i).position}t.insertContent(n,o),e.setSelection(n,"in")})}}class mh extends jl{static get pluginName(){return"Paragraph"}init(){const e=this.editor,t=e.model;e.commands.add("paragraph",new dh(e)),e.commands.add("insertParagraph",new uh(e)),t.schema.register("paragraph",{inheritAllFrom:"$block"}),e.conversion.elementToElement({model:"paragraph",view:"p"}),e.conversion.for("upcast").elementToElement({model:(e,{writer:t})=>mh.paragraphLikeElements.has(e.name)?e.isEmpty?null:t.createElement("paragraph"):null,view:/.+/,converterPriority:"low"})}}mh.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]);class gh extends Vd{constructor(e,t){super(e),this.modelElements=t}refresh(){const e=Pd(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some(t=>fh(e,t,this.editor.model.schema))}execute(e){const t=this.editor.model,o=t.document,n=e.value;t.change(e=>{const i=Array.from(o.selection.getSelectedBlocks()).filter(e=>fh(e,n,t.schema));for(const t of i)t.is("element",n)||e.rename(t,n)})}}function fh(e,t,o){return o.checkChild(e.parent,t)&&!o.isObject(e)}class ph extends jl{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[mh]}init(){const e=this.editor,t=e.config.get("heading.options"),o=[];for(const n of t)"paragraph"!==n.model&&(e.model.schema.register(n.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(n),o.push(n.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new gh(e,o))}afterInit(){const e=this.editor,t=e.commands.get("enter"),o=e.config.get("heading.options");t&&this.listenTo(t,"afterExecute",(t,n)=>{const i=e.model.document.selection.getFirstPosition().parent;o.some(e=>i.is("element",e.model))&&!i.is("element","paragraph")&&0===i.childCount&&n.writer.rename(i,"paragraph")})}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:uo.get("low")+1})}}class bh{constructor(e,t){t&&Dn(this,t),e&&this.set(e)}}function wh(e){const t=e.t,o={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=o[e.title];return t&&t!=e.title&&(e.title=t),e})}Co(bh,qn);o(12);class kh extends jl{init(){const e=this.editor,t=e.t,o=wh(e),n=t("Choose heading"),i=t("Heading");e.ui.componentFactory.add("heading",t=>{const r={},s=new Ao,a=e.commands.get("heading"),l=e.commands.get("paragraph"),c=[a];for(const e of o){const t={type:"button",model:new bh({label:e.title,class:e.class,withText:!0})};"paragraph"===e.model?(t.model.bind("isOn").to(l,"value"),t.model.set("commandName","paragraph"),c.push(l)):(t.model.bind("isOn").to(a,"value",t=>t===e.model),t.model.set({commandName:"heading",commandValue:e.model})),s.add(t),r[e.model]=e.title}const d=qc(t);return $c(d,s),d.buttonView.set({isOn:!1,withText:!0,tooltip:i}),d.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),d.bind("isEnabled").toMany(c,"isEnabled",(...e)=>e.some(e=>e)),d.buttonView.bind("label").to(a,"value",l,"value",(e,t)=>{const o=e||t&&"paragraph";return r[o]?r[o]:n}),this.listenTo(d,"execute",t=>{e.execute(t.source.commandName,t.source.commandValue?{value:t.source.commandValue}:void 0),e.editing.view.focus()}),d})}}class _h extends br{observe(e){this.listenTo(e,"load",(e,t)=>{"IMG"==t.target.tagName&&this._fireEvents(t)},{useCapture:!0})}_fireEvents(e){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",e))}}class vh{constructor(){this._stack=[]}add(e,t){const o=this._stack,n=o[0];this._insertDescriptor(e);const i=o[0];n===i||yh(n,i)||this.fire("change:top",{oldDescriptor:n,newDescriptor:i,writer:t})}remove(e,t){const o=this._stack,n=o[0];this._removeDescriptor(e);const i=o[0];n===i||yh(n,i)||this.fire("change:top",{oldDescriptor:n,newDescriptor:i,writer:t})}_insertDescriptor(e){const t=this._stack,o=t.findIndex(t=>t.id===e.id);if(yh(e,t[o]))return;o>-1&&t.splice(o,1);let n=0;for(;t[n]&&xh(t[n],e);)n++;t.splice(n,0,e)}_removeDescriptor(e){const t=this._stack,o=t.findIndex(t=>t.id===e);o>-1&&t.splice(o,1)}}function yh(e,t){return e&&t&&e.priority==t.priority&&Ch(e.classes)==Ch(t.classes)}function xh(e,t){return e.priority>t.priority||!(e.priority<t.priority)&&Ch(e.classes)>Ch(t.classes)}function Ch(e){return Array.isArray(e)?e.sort().join(","):e}Co(vh,po);function Ah(e,t,o){return e&&Ph(e)&&!o.isInline(t)}function Th(e){return e.getAttribute("widget-type-around")}function Ph(e){return!!e.is("element")&&!!e.getCustomProperty("widget")}function Sh(e,t,o={}){if(!e.is("containerElement"))throw new mo.b("widget-to-widget-wrong-element-type: The element passed to toWidget() must be a container element instance.",null,{element:e});return t.setAttribute("contenteditable","false",e),t.addClass("ck-widget",e),t.setCustomProperty("widget",!0,e),e.getFillerOffset=Mh,o.label&&function(e,t,o){o.setCustomProperty("widgetLabel",t,e)}(e,o.label,t),o.hasSelectionHandle&&function(e,t){const o=t.createUIElement("div",{class:"ck ck-widget__selection-handle"},(function(e){const t=this.toDomElement(e),o=new yc;return o.set("content",'<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>'),o.render(),t.appendChild(o.element),t}));t.insert(t.createPositionAt(e,0),o),t.addClass(["ck-widget_with-selection-handle"],e)}(e,t),Eh(e,t,(e,t,o)=>o.addClass(n(t.classes),e),(e,t,o)=>o.removeClass(n(t.classes),e)),e;function n(e){return Array.isArray(e)?e:[e]}}function Eh(e,t,o,n){const i=new vh;i.on("change:top",(t,i)=>{i.oldDescriptor&&n(e,i.oldDescriptor,i.writer),i.newDescriptor&&o(e,i.newDescriptor,i.writer)}),t.setCustomProperty("addHighlight",(e,t,o)=>i.add(t,o),e),t.setCustomProperty("removeHighlight",(e,t,o)=>i.remove(t,o),e)}function Rh(e){const t=e.getCustomProperty("widgetLabel");return t?"function"==typeof t?t():t:""}function Ih(e,t){return t.addClass(["ck-editor__editable","ck-editor__nested-editable"],e),t.setAttribute("contenteditable",e.isReadOnly?"false":"true",e),e.on("change:isReadOnly",(o,n,i)=>{t.setAttribute("contenteditable",i?"false":"true",e)}),e.on("change:isFocused",(o,n,i)=>{i?t.addClass("ck-editor__nested-editable_focused",e):t.removeClass("ck-editor__nested-editable_focused",e)}),e}function Vh(e,t){const o=e.getSelectedElement();if(o){const n=Th(e);if(n)return t.createPositionAt(o,n);if(t.schema.isBlock(o))return t.createPositionAfter(o)}const n=e.getSelectedBlocks().next().value;if(n){if(n.isEmpty)return t.createPositionAt(n,0);const o=t.createPositionAfter(n);return e.focus.isTouching(o)?o:t.createPositionBefore(n)}return e.focus}function Oh(e,t){const o=new is(rr.window),n=o.getIntersection(e),i=t.height+wc.arrowVerticalOffset;if(e.top-i>o.top||e.bottom+i<o.bottom)return null;const r=n||e,s=r.left+r.width/2-t.width/2;return{top:Math.max(e.top,0)+wc.arrowVerticalOffset,left:s,name:"arrow_n"}}function Mh(){return null}function Nh(e){const t=e.getSelectedElement();return t&&function(e){return!!e.getCustomProperty("image")&&Ph(e)}(t)?t:null}function zh(e){return!!e&&e.is("element","image")}function Bh(e,t,o={}){const n=e.createElement("image",o),i=Vh(t.document.selection,t);t.insertContent(n,i),n.parent&&e.setSelection(n,"on")}function Fh(e){const t=e.schema,o=e.document.selection;return function(e,t,o){const n=function(e,t){const o=Vh(e,t).parent;if(o.isEmpty&&!o.is("element","$root"))return o.parent;return o}(e,o);return t.checkChild(n,"image")}(o,t,e)&&!function(e,t){const o=e.getSelectedElement();return o&&t.isObject(o)}(o,t)&&function(e){return[...e.focus.getAncestors()].every(e=>!e.is("element","image"))}(o)}function Dh(e){const t=[];for(const o of e.getChildren())t.push(o),o.is("element")&&t.push(...o.getChildren());return t.find(e=>e.is("element","img"))}function Lh(e){return o=>{o.on(`attribute:${e}:image`,t)};function t(e,t,o){if(!o.consumable.consume(t.item,e.name))return;const n=o.writer,i=Dh(o.mapper.toViewElement(t.item));n.setAttribute(t.attributeKey,t.attributeNewValue||"",i)}}class Hh extends Vd{refresh(){this.isEnabled=Fh(this.editor.model)}execute(e){const t=this.editor.model;t.change(o=>{const n=Array.isArray(e.source)?e.source:[e.source];for(const e of n)Bh(o,t,{src:e})})}}class jh extends jl{static get pluginName(){return"ImageEditing"}init(){const e=this.editor,t=e.model.schema,o=e.t,n=e.conversion;e.editing.view.addObserver(_h),t.register("image",{isObject:!0,isBlock:!0,allowWhere:"$block",allowAttributes:["alt","src","srcset"]}),n.for("dataDowncast").elementToElement({model:"image",view:(e,{writer:t})=>Wh(t)}),n.for("editingDowncast").elementToElement({model:"image",view:(e,{writer:t})=>function(e,t,o){return t.setCustomProperty("image",!0,e),Sh(e,t,{label:function(){const t=Dh(e).getAttribute("alt");return t?`${t} ${o}`:o}})}(Wh(t),t,o("image widget"))}),n.for("downcast").add(Lh("src")).add(Lh("alt")).add(function(){return t=>{t.on("attribute:srcset:image",e)};function e(e,t,o){if(!o.consumable.consume(t.item,e.name))return;const n=o.writer,i=Dh(o.mapper.toViewElement(t.item));if(null===t.attributeNewValue){const e=t.attributeOldValue;e.data&&(n.removeAttribute("srcset",i),n.removeAttribute("sizes",i),e.width&&n.removeAttribute("width",i))}else{const e=t.attributeNewValue;e.data&&(n.setAttribute("srcset",e.data,i),n.setAttribute("sizes","100vw",i),e.width&&n.setAttribute("width",e.width,i))}}}()),n.for("upcast").elementToElement({view:{name:"img",attributes:{src:!0}},model:(e,{writer:t})=>t.createElement("image",{src:e.getAttribute("src")})}).attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:{key:"srcset",value:e=>{const t={data:e.getAttribute("srcset")};return e.hasAttribute("width")&&(t.width=e.getAttribute("width")),t}}}).add(function(){return t=>{t.on("element:figure",e)};function e(e,t,o){if(!o.consumable.test(t.viewItem,{name:!0,classes:"image"}))return;const n=Dh(t.viewItem);if(!n||!n.hasAttribute("src")||!o.consumable.test(n,{name:!0}))return;const i=Pd(o.convertItem(n,t.modelCursor).modelRange.getItems());i&&(o.convertChildren(t.viewItem,i),o.updateConversionResult(i,t))}}()),e.commands.add("imageInsert",new Hh(e))}}function Wh(e){const t=e.createEmptyElement("img"),o=e.createContainerElement("figure",{class:"image"});return e.insert(e.createPositionAt(o,0),t),o}class qh extends Fr{constructor(e){super(e),this.domEventType="mousedown"}onDomEvent(e){this.fire(e.type,e)}}const $h=[bi("arrowUp"),bi("arrowRight"),bi("arrowDown"),bi("arrowLeft"),9,16,17,18,19,20,27,33,34,35,36,45,91,93,144,145,173,174,175,176,177,178,179,255];for(let e=112;e<=135;e++)$h.push(e);function Uh(e){return!!e.ctrlKey||$h.includes(e.keyCode)}o(50);const Gh=["before","after"],Kh=(new DOMParser).parseFromString('<svg viewBox="0 0 10 8" xmlns="http://www.w3.org/2000/svg"><polyline points="8.05541992 0.263427734 8.05541992 4.23461914 1.28417969 4.23461914" transform="translate(1,0)"></polyline><line x1="0" y1="4.21581031" x2="2" y2="2.17810059" transform="translate(1, 0)"></line><line x1="0" y1="6.21581031" x2="2" y2="4.17810059" transform="translate(2, 5.196955) scale(1, -1) translate(-1, -5.196955)"></line></svg>\n',"image/svg+xml").firstChild;class Jh extends jl{static get pluginName(){return"WidgetTypeAround"}constructor(e){super(e),this._currentFakeCaretModelElement=null}init(){const e=this.editor,t=e.editing.view;this.on("change:isEnabled",(o,n,i)=>{t.change(e=>{for(const o of t.document.roots)i?e.removeClass("ck-widget__type-around_disabled",o):e.addClass("ck-widget__type-around_disabled",o)}),i||e.model.change(e=>{e.removeSelectionAttribute("widget-type-around")})}),this._enableTypeAroundUIInjection(),this._enableInsertingParagraphsOnButtonClick(),this._enableInsertingParagraphsOnEnterKeypress(),this._enableInsertingParagraphsOnTypingKeystroke(),this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(),this._enableDeleteIntegration(),this._enableInsertContentIntegration()}destroy(){this._currentFakeCaretModelElement=null}_insertParagraph(e,t){const o=this.editor,n=o.editing.view;o.execute("insertParagraph",{position:o.model.createPositionAt(e,t)}),n.focus(),n.scrollToTheSelection()}_listenToIfEnabled(e,t,o,n){this.listenTo(e,t,(...e)=>{this.isEnabled&&o(...e)},n)}_insertParagraphAccordingToFakeCaretPosition(){const e=this.editor.model.document.selection,t=Th(e);if(!t)return!1;const o=e.getSelectedElement();return this._insertParagraph(o,t),!0}_enableTypeAroundUIInjection(){const e=this.editor,t=e.model.schema,o=e.locale.t,n={before:o("Insert paragraph before block"),after:o("Insert paragraph after block")};e.editing.downcastDispatcher.on("insert",(e,o,i)=>{const r=i.mapper.toViewElement(o.item);Ah(r,o.item,t)&&function(e,t,o){const n=e.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},(function(e){const o=this.toDomElement(e);return function(e,t){for(const o of Gh){const n=new $l({tag:"div",attributes:{class:["ck","ck-widget__type-around__button","ck-widget__type-around__button_"+o],title:t[o]},children:[e.ownerDocument.importNode(Kh,!0)]});e.appendChild(n.render())}}(o,t),function(e){const t=new $l({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});e.appendChild(t.render())}(o),o}));e.insert(e.createPositionAt(o,"end"),n)}(i.writer,n,r)},{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const e=this.editor,t=e.model,o=t.document.selection,n=t.schema,i=e.editing.view;function r(e){return"ck-widget_type-around_show-fake-caret_"+e}this._listenToIfEnabled(i.document,"keydown",(e,t)=>{_i(t.keyCode)&&this._handleArrowKeyPress(e,t)},{priority:uo.get("high")+10}),this._listenToIfEnabled(o,"change:range",(t,o)=>{o.directChange&&e.model.change(e=>{e.removeSelectionAttribute("widget-type-around")})}),this._listenToIfEnabled(t.document,"change:data",()=>{const t=o.getSelectedElement();if(t){if(Ah(e.editing.mapper.toViewElement(t),t,n))return}e.model.change(e=>{e.removeSelectionAttribute("widget-type-around")})}),this._listenToIfEnabled(e.editing.downcastDispatcher,"selection",(e,t,o)=>{const i=o.writer;if(this._currentFakeCaretModelElement){const e=o.mapper.toViewElement(this._currentFakeCaretModelElement);e&&(i.removeClass(Gh.map(r),e),this._currentFakeCaretModelElement=null)}const s=t.selection.getSelectedElement();if(!s)return;const a=o.mapper.toViewElement(s);if(!Ah(a,s,n))return;const l=Th(t.selection);l&&(i.addClass(r(l),a),this._currentFakeCaretModelElement=s)}),this._listenToIfEnabled(e.ui.focusTracker,"change:isFocused",(t,o,n)=>{n||e.model.change(e=>{e.removeSelectionAttribute("widget-type-around")})})}_handleArrowKeyPress(e,t){const o=this.editor,n=o.model,i=n.document.selection,r=n.schema,s=o.editing.view,a=yi(t.keyCode,o.locale.contentLanguageDirection),l=s.document.selection.getSelectedElement();let c;Ah(l,o.editing.mapper.toModelElement(l),r)?c=this._handleArrowKeyPressOnSelectedWidget(a):i.isCollapsed&&(c=this._handleArrowKeyPressWhenSelectionNextToAWidget(a)),c&&(t.preventDefault(),e.stop())}_handleArrowKeyPressOnSelectedWidget(e){const t=this.editor.model,o=Th(t.document.selection);return t.change(t=>{if(!o)return t.setSelectionAttribute("widget-type-around",e?"after":"before"),!0;if(!(o===(e?"after":"before")))return t.removeSelectionAttribute("widget-type-around"),!0;return!1})}_handleArrowKeyPressWhenSelectionNextToAWidget(e){const t=this.editor,o=t.model,n=o.schema,i=t.plugins.get("Widget"),r=i._getObjectElementNextToSelection(e);return!!Ah(t.editing.mapper.toViewElement(r),r,n)&&(o.change(t=>{i._setSelectionOverElement(r),t.setSelectionAttribute("widget-type-around",e?"before":"after")}),!0)}_enableInsertingParagraphsOnButtonClick(){const e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,"mousedown",(o,n)=>{const i=n.domTarget.closest(".ck-widget__type-around__button");if(!i)return;const r=function(e){return e.classList.contains("ck-widget__type-around__button_before")?"before":"after"}(i),s=function(e,t){const o=e.closest(".ck-widget");return t.mapDomToView(o)}(i,t.domConverter),a=e.editing.mapper.toModelElement(s);this._insertParagraph(a,r),n.preventDefault(),o.stop()})}_enableInsertingParagraphsOnEnterKeypress(){const e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,"enter",(o,n)=>{const i=t.document.selection.getSelectedElement(),r=e.editing.mapper.toModelElement(i),s=e.model.schema;let a;this._insertParagraphAccordingToFakeCaretPosition()?a=!0:Ah(i,r,s)&&(this._insertParagraph(r,n.isSoft?"before":"after"),a=!0),a&&(n.preventDefault(),o.stop())})}_enableInsertingParagraphsOnTypingKeystroke(){const e=this.editor.editing.view,t=[pi.enter,pi.delete,pi.backspace];this._listenToIfEnabled(e.document,"keydown",(e,o)=>{t.includes(o.keyCode)||Uh(o)||this._insertParagraphAccordingToFakeCaretPosition()},{priority:uo.get("high")+1})}_enableDeleteIntegration(){const e=this.editor,t=e.editing.view,o=e.model,n=o.schema;this._listenToIfEnabled(t.document,"delete",(t,i)=>{const r=Th(o.document.selection);if(!r)return;const s=i.direction,a=o.document.selection.getSelectedElement(),l="forward"==s;if("before"===r===l)e.execute("delete",{selection:o.createSelection(a,"on")});else{const t=n.getNearestSelectionRange(o.createPositionAt(a,r),s);if(t)if(t.isCollapsed){const i=o.createSelection(t.start);if(o.modifySelection(i,{direction:s}),i.focus.isEqual(t.start)){const e=function(e,t){let o=t;for(const n of t.getAncestors({parentFirst:!0})){if(n.childCount>1||e.isLimit(n))break;o=n}return o}(n,t.start.parent);o.deleteContent(o.createSelection(e,"on"),{doNotAutoparagraph:!0})}else o.change(o=>{o.setSelection(t),e.execute(l?"forwardDelete":"delete")})}else o.change(o=>{o.setSelection(t),e.execute(l?"forwardDelete":"delete")})}i.preventDefault(),t.stop()},{priority:uo.get("high")+1})}_enableInsertContentIntegration(){const e=this.editor,t=this.editor.model,o=t.document.selection;this._listenToIfEnabled(e.model,"insertContent",(e,[n,i])=>{if(i&&!i.is("documentSelection"))return;const r=Th(o);return r?(e.stop(),t.change(e=>{const i=o.getSelectedElement(),s=t.createPositionAt(i,r),a=e.createSelection(s),l=t.insertContent(n,a);return e.setSelection(a),l})):void 0},{priority:"high"})}}o(52);function Yh(e){const t=e.model;return(o,n)=>{const i=n.keyCode==pi.arrowup,r=n.keyCode==pi.arrowdown,s=n.shiftKey,a=t.document.selection;if(!i&&!r)return;const l=r;if(s&&function(e,t){return!e.isCollapsed&&e.isBackward==t}(a,l))return;const c=function(e,t,o){const n=e.model;if(o){const e=t.isCollapsed?t.focus:t.getLastPosition(),o=Qh(n,e,"forward");if(!o)return null;const i=n.createRange(e,o),r=Xh(n.schema,i,"backward");return r&&e.isBefore(r)?n.createRange(e,r):null}{const e=t.isCollapsed?t.focus:t.getFirstPosition(),o=Qh(n,e,"backward");if(!o)return null;const i=n.createRange(o,e),r=Xh(n.schema,i,"forward");return r&&e.isAfter(r)?n.createRange(r,e):null}}(e,a,l);c&&!c.isCollapsed&&function(e,t,o){const n=e.model,i=e.view.domConverter;if(o){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 r=e.mapper.toViewRange(t),s=i.viewRangeToDom(r),a=is.getDomRangeRects(s);let l;for(const e of a)if(void 0!==l){if(Math.round(e.top)>=l)return!1;l=Math.max(l,Math.round(e.bottom))}else l=Math.round(e.bottom);return!0}(e,c,l)&&(t.change(e=>{const o=l?c.end:c.start;if(s){const n=t.createSelection(a.anchor);n.setFocus(o),e.setSelection(n)}else e.setSelection(o)}),o.stop(),n.preventDefault(),n.stopPropagation())}}function Qh(e,t,o){const n=e.schema,i=e.createRangeIn(t.root),r="forward"==o?"elementStart":"elementEnd";for(const{previousPosition:e,item:s,type:a}of i.getWalker({startPosition:t,direction:o})){if(n.isLimit(s)&&!n.isInline(s))return e;if(a==r&&n.isBlock(s))return null}return null}function Xh(e,t,o){const n="backward"==o?t.end:t.start;if(e.checkChild(n,"$text"))return n;for(const{nextPosition:n}of t.getWalker({direction:o}))if(e.checkChild(n,"$text"))return n}class Zh extends jl{static get pluginName(){return"Widget"}static get requires(){return[Jh]}init(){const e=this.editor.editing.view,t=e.document;this._previouslySelected=new Set,this.editor.editing.downcastDispatcher.on("selection",(e,t,o)=>{this._clearPreviouslySelectedWidgets(o.writer);const n=o.writer,i=n.document.selection,r=i.getSelectedElement();let s=null;for(const e of i.getRanges())for(const t of e){const e=t.item;Ph(e)&&!eu(e,s)&&(n.addClass("ck-widget_selected",e),this._previouslySelected.add(e),s=e,e==r&&n.setSelection(i.getRanges(),{fake:!0,label:Rh(r)}))}},{priority:"low"}),e.addObserver(qh),this.listenTo(t,"mousedown",(...e)=>this._onMousedown(...e)),this.listenTo(t,"keydown",(...e)=>{this._handleSelectionChangeOnArrowKeyPress(...e)},{priority:"high"}),this.listenTo(t,"keydown",(...e)=>{this._preventDefaultOnArrowKeyPress(...e)},{priority:uo.get("high")-20}),this.listenTo(t,"keydown",Yh(this.editor.editing)),this.listenTo(t,"delete",(e,t)=>{this._handleDelete("forward"==t.direction)&&(t.preventDefault(),e.stop())},{priority:"high"})}_onMousedown(e,t){const o=this.editor,n=o.editing.view,i=n.document;let r=t.target;if(function(e){for(;e;){if(e.is("editableElement")&&!e.is("rootElement"))return!0;if(Ph(e))return!1;e=e.parent}return!1}(r)){if((mi.isSafari||mi.isGecko)&&t.domEvent.detail>=3){const e=o.editing.mapper,n=r.is("attributeElement")?r.findAncestor(e=>!e.is("attributeElement")):r,i=e.toModelElement(n);t.preventDefault(),this.editor.model.change(e=>{e.setSelection(i,"in")})}return}if(!Ph(r)&&(r=r.findAncestor(Ph),!r))return;t.preventDefault(),i.isFocused||n.focus();const s=o.editing.mapper.toModelElement(r);this._setSelectionOverElement(s)}_handleSelectionChangeOnArrowKeyPress(e,t){const o=t.keyCode;if(!_i(o))return;const n=this.editor.model,i=n.schema,r=n.document.selection,s=r.getSelectedElement(),a=yi(o,this.editor.locale.contentLanguageDirection);if(s&&i.isObject(s)){const o=a?r.getLastPosition():r.getFirstPosition(),s=i.getNearestSelectionRange(o,a?"forward":"backward");return void(s&&(n.change(e=>{e.setSelection(s)}),t.preventDefault(),e.stop()))}if(!r.isCollapsed)return;const l=this._getObjectElementNextToSelection(a);l&&i.isObject(l)&&(this._setSelectionOverElement(l),t.preventDefault(),e.stop())}_preventDefaultOnArrowKeyPress(e,t){if(!_i(t.keyCode))return;const o=this.editor.model,n=o.schema,i=o.document.selection.getSelectedElement();i&&n.isObject(i)&&(t.preventDefault(),e.stop())}_handleDelete(e){if(this.editor.isReadOnly)return;const t=this.editor.model.document.selection;if(!t.isCollapsed)return;const o=this._getObjectElementNextToSelection(e);return o?(this.editor.model.change(e=>{let n=t.anchor.parent;for(;n.isEmpty;){const t=n;n=t.parent,e.remove(t)}this._setSelectionOverElement(o)}),!0):void 0}_setSelectionOverElement(e){this.editor.model.change(t=>{t.setSelection(t.createRangeOn(e))})}_getObjectElementNextToSelection(e){const t=this.editor.model,o=t.schema,n=t.document.selection,i=t.createSelection(n);t.modifySelection(i,{direction:e?"forward":"backward"});const r=e?i.focus.nodeBefore:i.focus.nodeAfter;return r&&o.isObject(r)?r:null}_clearPreviouslySelectedWidgets(e){for(const t of this._previouslySelected)e.removeClass("ck-widget_selected",t);this._previouslySelected.clear()}}function eu(e,t){return!!t&&Array.from(e.getAncestors()).includes(t)}class tu extends Vd{refresh(){const e=this.editor.model.document.selection.getSelectedElement();this.isEnabled=zh(e),zh(e)&&e.hasAttribute("alt")?this.value=e.getAttribute("alt"):this.value=!1}execute(e){const t=this.editor.model,o=t.document.selection.getSelectedElement();t.change(t=>{t.setAttribute("alt",e.newValue,o)})}}class ou extends jl{static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new tu(this.editor))}}o(54);class nu extends dc{constructor(e){super(e),this.set("text"),this.set("for"),this.id="ck-editor__label_"+ho();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")}]})}}o(56);class iu extends dc{constructor(e,t){super(e);const o="ck-labeled-field-view-"+ho(),n="ck-labeled-field-view-status-"+ho();this.fieldView=t(this,o,n),this.set("label"),this.set("isEnabled",!0),this.set("errorText",null),this.set("infoText",null),this.set("class"),this.labelView=this._createLabelView(o),this.statusView=this._createStatusView(n),this.bind("_statusText").to(this,"errorText",this,"infoText",(e,t)=>e||t);const i=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view",i.to("class"),i.if("isEnabled","ck-disabled",e=>!e)]},children:[this.labelView,this.fieldView,this.statusView]})}_createLabelView(e){const t=new nu(this.locale);return t.for=e,t.bind("text").to(this,"label"),t}_createStatusView(e){const t=new dc(this.locale),o=this.bindTemplate;return t.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view__status",o.if("errorText","ck-labeled-field-view__status_error"),o.if("_statusText","ck-hidden",e=>!e)],id:e,role:o.if("errorText","alert")},children:[{text:o.to("_statusText")}]}),t}focus(){this.fieldView.focus()}}o(58);class ru extends dc{constructor(e){super(e),this.set("value"),this.set("id"),this.set("placeholder"),this.set("isReadOnly",!1),this.set("hasError",!1),this.set("ariaDescribedById");const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{type:"text",class:["ck","ck-input","ck-input-text",t.if("hasError","ck-error")],id:t.to("id"),placeholder:t.to("placeholder"),readonly:t.to("isReadOnly"),"aria-invalid":t.if("hasError",!0),"aria-describedby":t.to("ariaDescribedById")},on:{input:t.to("input")}})}render(){super.render();const e=e=>{this.element.value=e||0===e?e:""};e(this.value),this.on("change:value",(t,o,n)=>{e(n)})}select(){this.element.select()}focus(){this.element.focus()}}function su(e,t,o){const n=new ru(e.locale);return n.set({id:t,ariaDescribedById:o}),n.bind("isReadOnly").to(e,"isEnabled",e=>!e),n.bind("hasError").to(e,"errorText",e=>!!e),n.on("input",()=>{e.errorText=null}),n}function au(e,t,o){const n=qc(e.locale);return n.set({id:t,ariaDescribedById:o}),n.bind("isEnabled").to(e),n}function lu({view:e}){e.listenTo(e.element,"submit",(t,o)=>{o.preventDefault(),e.fire("submit")},{useCapture:!0})}var cu='<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>',du='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.591 10.177l4.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>';o(60);class hu extends dc{constructor(e){super(e);const t=this.locale.t;this.focusTracker=new Ac,this.keystrokes=new Bl,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(t("Save"),cu,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(t("Cancel"),du,"ck-button-cancel","cancel"),this._focusables=new ql,this._focusCycler=new Rc({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"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),this.keystrokes.listenTo(this.element),lu({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)})}_createButton(e,t,o,n){const i=new Cc(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i.extendTemplate({attributes:{class:o}}),n&&i.delegate("execute").to(this,n),i}_createLabeledInputView(){const e=this.locale.t,t=new iu(this.locale,su);return t.label=e("Text alternative"),t.fieldView.placeholder=e("Text alternative"),t}}function uu(e){const t=e.editing.view,o=wc.defaultPositions;return{target:t.domConverter.viewToDom(t.document.selection.getSelectedElement()),positions:[o.northArrowSouth,o.northArrowSouthWest,o.northArrowSouthEast,o.southArrowNorth,o.southArrowNorthWest,o.southArrowNorthEast]}}class mu extends jl{static get requires(){return[Pc]}static get pluginName(){return"ImageTextAlternativeUI"}init(){this._createButton(),this._createForm()}destroy(){super.destroy(),this._form.destroy()}_createButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("imageTextAlternative",o=>{const n=e.commands.get("imageTextAlternative"),i=new Cc(o);return i.set({label:t("Change image text alternative"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5.085 6.22L2.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.21l-.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>',tooltip:!0}),i.bind("isEnabled").to(n,"isEnabled"),this.listenTo(i,"execute",()=>{this._showForm()}),i})}_createForm(){const e=this.editor,t=e.editing.view.document;this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new hu(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",()=>{Nh(t.selection)?this._isVisible&&function(e){const t=e.plugins.get("ContextualBalloon");if(Nh(e.editing.view.document.selection)){const o=uu(e);t.updatePosition(o)}}(e):this._hideForm(!0)}),Wc({emitter:this._form,activator:()=>this._isVisible,contextElements:[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;const e=this.editor,t=e.commands.get("imageTextAlternative"),o=this._form.labeledInput;this._isInBalloon||this._balloon.add({view:this._form,position:uu(e)}),o.fieldView.value=o.fieldView.element.value=t.value||"",this._form.labeledInput.fieldView.select()}_hideForm(e){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.visibleView===this._form}get _isInBalloon(){return this._balloon.hasView(this._form)}}class gu extends jl{static get requires(){return[ou,mu]}static get pluginName(){return"ImageTextAlternative"}}o(62);function fu(e){for(const t of e.getChildren())if(t&&t.is("element","caption"))return t;return null}function pu(e){const t=e.parent;return"figcaption"==e.name&&t&&"figure"==t.name&&t.hasClass("image")?{name:!0}:null}class bu extends jl{static get pluginName(){return"ImageCaptionEditing"}init(){const e=this.editor,t=e.editing.view,o=e.model.schema,n=e.data,i=e.editing,r=e.t;o.register("caption",{allowIn:"image",allowContentOf:"$block",isLimit:!0}),e.model.document.registerPostFixer(e=>this._insertMissingModelCaptionElement(e)),e.conversion.for("upcast").elementToElement({view:pu,model:"caption"});n.downcastDispatcher.on("insert:caption",wu(e=>e.createContainerElement("figcaption"),!1));const s=function(e,t){return o=>{const n=o.createEditableElement("figcaption");return o.setCustomProperty("imageCaption",!0,n),id({view:e,element:n,text:t}),Ih(n,o)}}(t,r("Enter image caption"));i.downcastDispatcher.on("insert:caption",wu(s)),i.downcastDispatcher.on("insert",this._fixCaptionVisibility(e=>e.item),{priority:"high"}),i.downcastDispatcher.on("remove",this._fixCaptionVisibility(e=>e.position.parent),{priority:"high"}),t.document.registerPostFixer(e=>this._updateCaptionVisibility(e))}_updateCaptionVisibility(e){const t=this.editor.editing.mapper,o=this._lastSelectedCaption;let n;const i=this.editor.model.document.selection,r=i.getSelectedElement();if(r&&r.is("element","image")){const e=fu(r);n=t.toViewElement(e)}const s=ku(i.getFirstPosition().parent);if(s&&(n=t.toViewElement(s)),n)return o?(o===n||(_u(o,e),this._lastSelectedCaption=n),vu(n,e)):(this._lastSelectedCaption=n,vu(n,e));if(o){const t=_u(o,e);return this._lastSelectedCaption=null,t}return!1}_fixCaptionVisibility(e){return(t,o,n)=>{const i=ku(e(o)),r=this.editor.editing.mapper,s=n.writer;if(i){const e=r.toViewElement(i);e&&(i.childCount?s.removeClass("ck-hidden",e):s.addClass("ck-hidden",e))}}}_insertMissingModelCaptionElement(e){const t=this.editor.model,o=t.document.differ.getChanges(),n=[];for(const e of o)if("insert"==e.type&&"$text"!=e.name){const o=e.position.nodeAfter;if(o.is("element","image")&&!fu(o)&&n.push(o),!o.is("element","image")&&o.childCount)for(const e of t.createRangeIn(o).getItems())e.is("element","image")&&!fu(e)&&n.push(e)}for(const t of n)e.appendElement("caption",t);return!!n.length}}function wu(e,t=!0){return(o,n,i)=>{const r=n.item;if((r.childCount||t)&&zh(r.parent)){if(!i.consumable.consume(n.item,"insert"))return;const t=i.mapper.toViewElement(n.range.start.parent),o=e(i.writer),s=i.writer;r.childCount||s.addClass("ck-hidden",o),function(e,t,o,n){const i=n.writer.createPositionAt(o,"end");n.writer.insert(i,e),n.mapper.bindElements(t,e)}(o,n.item,t,i)}}}function ku(e){const t=e.getAncestors({includeSelf:!0}).find(e=>"caption"==e.name);return t&&t.parent&&"image"==t.parent.name?t:null}function _u(e,t){return!e.childCount&&!e.hasClass("ck-hidden")&&(t.addClass("ck-hidden",e),!0)}function vu(e,t){return!!e.hasClass("ck-hidden")&&(t.removeClass("ck-hidden",e),!0)}o(64);class yu extends Vd{constructor(e,t){super(e),this.defaultStyle=!1,this.styles=t.reduce((e,t)=>(e[t.name]=t,t.isDefault&&(this.defaultStyle=t.name),e),{})}refresh(){const e=this.editor.model.document.selection.getSelectedElement();if(this.isEnabled=zh(e),e)if(e.hasAttribute("imageStyle")){const t=e.getAttribute("imageStyle");this.value=!!this.styles[t]&&t}else this.value=this.defaultStyle;else this.value=!1}execute(e){const t=e.value,o=this.editor.model,n=o.document.selection.getSelectedElement();o.change(e=>{this.styles[t].isDefault?e.removeAttribute("imageStyle",n):e.setAttribute("imageStyle",t,n)})}}function xu(e,t){for(const o of t)if(o.name===e)return o}var Cu='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 4.5V3h16v1.5zm2.5 3V12h11V7.5h-11zM4.061 6H15.94c.586 0 1.061.407 1.061.91v5.68c0 .503-.475.91-1.061.91H4.06c-.585 0-1.06-.407-1.06-.91V6.91C3 6.406 3.475 6 4.061 6zM2 16.5V15h16v1.5z"/></svg>',Au='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path d="M18 4.5V3H2v1.5h16zm0 3V6h-5.674v1.5H18zm0 3V9h-5.674v1.5H18zm0 3V12h-5.674v1.5H18zm-8.5-6V12h-6V7.5h6zm.818-1.5H2.682C2.305 6 2 6.407 2 6.91v5.68c0 .503.305.91.682.91h7.636c.377 0 .682-.407.682-.91V6.91c0-.503-.305-.91-.682-.91zM18 16.5V15H2v1.5h16z"/></svg>',Tu='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 4.5V3h16v1.5zm4.5 3V12h7V7.5h-7zM5.758 6h8.484c.419 0 .758.407.758.91v5.681c0 .502-.34.909-.758.909H5.758c-.419 0-.758-.407-.758-.91V6.91c0-.503.34-.91.758-.91zM2 16.5V15h16v1.5z"/></svg>',Pu='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 4.5V3h16v1.5zm0 3V6h5.674v1.5zm0 3V9h5.674v1.5zm0 3V12h5.674v1.5zm8.5-6V12h6V7.5h-6zM9.682 6h7.636c.377 0 .682.407.682.91v5.68c0 .503-.305.91-.682.91H9.682c-.377 0-.682-.407-.682-.91V6.91c0-.503.305-.91.682-.91zM2 16.5V15h16v1.5z"/></svg>';const Su={full:{name:"full",title:"Full size image",icon:Cu,isDefault:!0},side:{name:"side",title:"Side image",icon:Pu,className:"image-style-side"},alignLeft:{name:"alignLeft",title:"Left aligned image",icon:Au,className:"image-style-align-left"},alignCenter:{name:"alignCenter",title:"Centered image",icon:Tu,className:"image-style-align-center"},alignRight:{name:"alignRight",title:"Right aligned image",icon:Pu,className:"image-style-align-right"}},Eu={full:Cu,left:Au,right:Pu,center:Tu};function Ru(e=[]){return e.map(Iu)}function Iu(e){if("string"==typeof e){const t=e;Su[t]?e=Object.assign({},Su[t]):(console.warn(Object(mo.a)("image-style-not-found: There is no such image style of given name."),{name:t}),e={name:t})}else if(Su[e.name]){const t=Su[e.name],o=Object.assign({},e);for(const n in t)Object.prototype.hasOwnProperty.call(e,n)||(o[n]=t[n]);e=o}return"string"==typeof e.icon&&Eu[e.icon]&&(e.icon=Eu[e.icon]),e}class Vu extends jl{static get pluginName(){return"ImageStyleEditing"}init(){const e=this.editor,t=e.model.schema,o=e.data,n=e.editing;e.config.define("image.styles",["full","side"]);const i=Ru(e.config.get("image.styles"));t.extend("image",{allowAttributes:"imageStyle"});const r=function(e){return(t,o,n)=>{if(!n.consumable.consume(o.item,t.name))return;const i=xu(o.attributeNewValue,e),r=xu(o.attributeOldValue,e),s=n.mapper.toViewElement(o.item),a=n.writer;r&&a.removeClass(r.className,s),i&&a.addClass(i.className,s)}}(i);n.downcastDispatcher.on("attribute:imageStyle:image",r),o.downcastDispatcher.on("attribute:imageStyle:image",r),o.upcastDispatcher.on("element:figure",function(e){const t=e.filter(e=>!e.isDefault);return(e,o,n)=>{if(!o.modelRange)return;const i=o.viewItem,r=Pd(o.modelRange.getItems());if(n.schema.checkAttribute(r,"imageStyle"))for(const e of t)n.consumable.consume(i,{classes:e.className})&&n.writer.setAttribute("imageStyle",e.name,r)}}(i),{priority:"low"}),e.commands.add("imageStyle",new yu(e,i))}}o(66);class Ou extends jl{static get pluginName(){return"ImageStyleUI"}get localizedDefaultStylesTitles(){const e=this.editor.t;return{"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=function(e,t){for(const o of e)t[o.title]&&(o.title=t[o.title]);return e}(Ru(this.editor.config.get("image.styles")),this.localizedDefaultStylesTitles);for(const t of e)this._createButton(t)}_createButton(e){const t=this.editor,o="imageStyle:"+e.name;t.ui.componentFactory.add(o,o=>{const n=t.commands.get("imageStyle"),i=new Cc(o);return i.set({label:e.title,icon:e.icon,tooltip:!0,isToggleable:!0}),i.bind("isEnabled").to(n,"isEnabled"),i.bind("isOn").to(n,"value",t=>t===e.name),this.listenTo(i,"execute",()=>{t.execute("imageStyle",{value:e.name}),t.editing.view.focus()}),i})}}class Mu extends jl{static get requires(){return[Pc]}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||!Ph(t))})(e.editing.view.document.selection)&&t.stop()},{priority:"high"})}this._toolbarDefinitions=new Map,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:o,getRelatedElement:n,balloonClassName:i="ck-toolbar-container"}){if(!o.length)return void console.warn(Object(mo.a)("widget-toolbar-no-items: Trying to register a toolbar without items."),{toolbarId:e});const r=this.editor,s=r.t,a=new Uc(r.locale);if(a.ariaLabel=t||s("Widget toolbar"),this._toolbarDefinitions.has(e))throw new mo.b("widget-toolbar-duplicated: Toolbar with the given id was already added.",this,{toolbarId:e});a.fillFromConfig(o,r.ui.componentFactory),this._toolbarDefinitions.set(e,{view:a,getRelatedElement:n,balloonClassName:i})}_updateToolbarsVisibility(){let e=0,t=null,o=null;for(const n of this._toolbarDefinitions.values()){const i=n.getRelatedElement(this.editor.editing.view.document.selection);if(this.isEnabled&&i)if(this.editor.ui.focusTracker.isFocused){const r=i.getAncestors().length;r>e&&(e=r,t=i,o=n)}else this._isToolbarVisible(n)&&this._hideToolbar(n);else this._isToolbarInBalloon(n)&&this._hideToolbar(n)}o&&this._showToolbar(o,t)}_hideToolbar(e){this._balloon.remove(e.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(e,t){this._isToolbarVisible(e)?Nu(this.editor,t):this._isToolbarInBalloon(e)||(this._balloon.add({view:e.view,position:zu(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);Nu(this.editor,t)}}))}_isToolbarVisible(e){return this._balloon.visibleView===e.view}_isToolbarInBalloon(e){return this._balloon.hasView(e.view)}}function Nu(e,t){const o=e.plugins.get("ContextualBalloon"),n=zu(e,t);o.updatePosition(n)}function zu(e,t){const o=e.editing.view,n=wc.defaultPositions;return{target:o.domConverter.mapViewToDom(t),positions:[n.northArrowSouth,n.northArrowSouthWest,n.northArrowSouthEast,n.southArrowNorth,n.southArrowNorthWest,n.southArrowNorthEast,Oh]}}o(68);class Bu extends dc{constructor(e){super(e);const t=this.bindTemplate;this.set("icon"),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isToggleable",!1),this.set("isVisible",!0),this.set("keystroke"),this.set("label"),this.set("tabindex",-1),this.set("tooltip"),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.children=this.createCollection(),this.actionView=this._createActionView(),this.arrowView=this._createArrowView(),this.keystrokes=new Bl,this.focusTracker=new Ac,this.setTemplate({tag:"div",attributes:{class:["ck","ck-splitbutton",t.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())})}focus(){this.actionView.focus()}_createActionView(){const e=new Cc;return e.bind("icon","isEnabled","isOn","isToggleable","keystroke","label","tabindex","tooltip","tooltipPosition","type","withText").to(this),e.extendTemplate({attributes:{class:"ck-splitbutton__action"}}),e.delegate("execute").to(this),e}_createArrowView(){const e=new Cc,t=e.bindTemplate;return e.icon=Bc,e.extendTemplate({attributes:{class:"ck-splitbutton__arrow","aria-haspopup":!0,"aria-expanded":t.to("isOn",e=>String(e))}}),e.bind("isEnabled").to(this),e.delegate("execute").to(this,"open"),e}}o(70);class Fu extends dc{constructor(e,t={}){super(e);const o=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",o.to("class")],role:o.to("_role"),"aria-labelledby":o.to("_ariaLabelledBy")},children:this.children})}}var Du='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M6.91 10.54c.26-.23.64-.21.88.03l3.36 3.14 2.23-2.06a.64.64 0 0 1 .87 0l2.52 2.97V4.5H3.2v10.12l3.71-4.08zm10.27-7.51c.6 0 1.09.47 1.09 1.05v11.84c0 .59-.49 1.06-1.09 1.06H2.79c-.6 0-1.09-.47-1.09-1.06V4.08c0-.58.49-1.05 1.1-1.05h14.38zm-5.22 5.56a1.96 1.96 0 1 1 3.4-1.96 1.96 1.96 0 0 1-3.4 1.96z"/></svg>';o(72);class Lu extends dc{constructor(e,t){super(e);const{insertButtonView:o,cancelButtonView:n}=this._createActionButtons(e);if(this.insertButtonView=o,this.cancelButtonView=n,this.dropdownView=this._createDropdownView(e),this.set("imageURLInputValue",""),this.focusTracker=new Ac,this.keystrokes=new Bl,this._focusables=new ql,this._focusCycler=new Rc({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.set("_integrations",new Ao),t)for(const[e,o]of Object.entries(t))"insertImageViaUrl"===e&&(o.fieldView.bind("value").to(this,"imageURLInputValue",e=>e||""),o.fieldView.on("input",()=>{this.imageURLInputValue=o.fieldView.element.value})),this._integrations.add(o);this.setTemplate({tag:"form",attributes:{class:["ck","ck-image-upload-form"],tabindex:"-1"},children:[...this._integrations,new Fu(e,{children:[this.insertButtonView,this.cancelButtonView],class:"ck-image-upload-form__action-row"})]})}render(){super.render(),lu({view:this});const e=[...this._integrations,this.insertButtonView,this.cancelButtonView];e.forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)}),this.keystrokes.listenTo(this.element);const t=e=>e.stopPropagation();this.keystrokes.set("arrowright",t),this.keystrokes.set("arrowleft",t),this.keystrokes.set("arrowup",t),this.keystrokes.set("arrowdown",t),this.listenTo(e[0].element,"selectstart",(e,t)=>{t.stopPropagation()},{priority:"high"})}_createDropdownView(e){const t=e.t,o=qc(e,Bu),n=o.buttonView,i=o.panelView;return n.set({label:t("Insert image"),icon:Du,tooltip:!0}),i.extendTemplate({attributes:{class:"ck-image-upload__panel"}}),o}_createActionButtons(e){const t=e.t,o=new Cc(e),n=new Cc(e);return o.set({label:t("Insert"),icon:cu,class:"ck-button-save",type:"submit",withText:!0,isEnabled:this.imageURLInputValue}),n.set({label:t("Cancel"),icon:du,class:"ck-button-cancel",withText:!0}),o.bind("isEnabled").to(this,"imageURLInputValue"),o.delegate("execute").to(this,"submit"),n.delegate("execute").to(this,"cancel"),{insertButtonView:o,cancelButtonView:n}}focus(){this._focusCycler.focusFirst()}}class Hu extends dc{constructor(e){super(e),this.buttonView=new Cc(e),this._fileInputView=new ju(e),this._fileInputView.bind("acceptedType").to(this),this._fileInputView.bind("allowMultipleFiles").to(this),this._fileInputView.delegate("done").to(this),this.setTemplate({tag:"span",attributes:{class:"ck-file-dialog-button"},children:[this.buttonView,this._fileInputView]}),this.buttonView.on("execute",()=>{this._fileInputView.open()})}focus(){this.buttonView.focus()}}class ju extends dc{constructor(e){super(e),this.set("acceptedType"),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()}}function Wu(e){const t=e.map(e=>e.replace("+","\\+"));return new RegExp(`^image\\/(${t.join("|")})$`)}function qu(e){const t=e.t,o=new iu(e,su);return o.set({label:t("Insert image via URL")}),o.fieldView.placeholder="https://example.com/src/image.png",o.infoText=t("Paste the image source URL."),o}class $u extends jl{static get pluginName(){return"ImageUploadUI"}init(){const e=this.editor,t=!!e.config.get("image.upload.panel.items");e.ui.componentFactory.add("imageUpload",e=>t?this._createDropdownView(e):this._createFileDialogButtonView(e))}_setUpDropdown(e,t,o){const n=this.editor,i=n.t,r=t.insertButtonView;function s(){n.editing.view.focus(),e.isOpen=!1}return e.bind("isEnabled").to(o),e.on("change:isOpen",()=>{const o=n.model.document.selection.getSelectedElement();e.isOpen&&(t.focus(),zh(o)?(t.imageURLInputValue=o.getAttribute("src"),r.label=i("Update")):(t.imageURLInputValue="",r.label=i("Insert")))}),t.delegate("submit","cancel").to(e),this.delegate("cancel").to(e),e.on("submit",()=>{s(),function(){const e=n.model.document.selection.getSelectedElement();zh(e)?n.model.change(o=>{o.setAttribute("src",t.imageURLInputValue,e),o.removeAttribute("srcset",e),o.removeAttribute("sizes",e)}):n.execute("imageInsert",{source:t.imageURLInputValue})}()}),e.on("cancel",()=>{s()}),e}_createDropdownView(e){const t=this.editor,o=new Lu(e,function(e){const t=e.config.get("image.upload.panel.items"),o=e.plugins.get("ImageUploadUI"),n={insertImageViaUrl:qu(e.locale)};if(!t)return n;if(t.find(e=>"openCKFinder"===e)&&e.ui.componentFactory.has("ckfinder")){const t=e.ui.componentFactory.create("ckfinder");t.set({withText:!0,class:"ck-image-upload__ck-finder-button"}),t.delegate("execute").to(o,"cancel"),n.openCKFinder=t}return t.reduce((t,o)=>(n[o]?t[o]=n[o]:e.ui.componentFactory.has(o)&&(t[o]=e.ui.componentFactory.create(o)),t),{})}(t)),n=t.commands.get("imageUpload"),i=o.dropdownView,r=i.panelView;return i.buttonView.actionView=this._createFileDialogButtonView(e),r.children.add(o),this._setUpDropdown(i,o,n)}_createFileDialogButtonView(e){const t=this.editor,o=e.t,n=t.config.get("image.upload.types"),i=new Hu(e),r=Wu(n),s=t.commands.get("imageUpload");return i.set({acceptedType:n.map(e=>"image/"+e).join(","),allowMultipleFiles:!0}),i.buttonView.set({label:o("Insert image"),icon:Du,tooltip:!0}),i.buttonView.bind("isEnabled").to(s),i.on("done",(e,o)=>{const n=Array.from(o).filter(e=>r.test(e.type));n.length&&t.execute("imageUpload",{file:n})}),i}}o(74),o(76),o(78);class Uu extends jl{constructor(e){super(e),this.placeholder="data:image/svg+xml;utf8,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 700 250"><rect rx="4"/></svg>')}init(){this.editor.editing.downcastDispatcher.on("attribute:uploadStatus:image",(...e)=>this.uploadStatusChange(...e))}uploadStatusChange(e,t,o){const n=this.editor,i=t.item,r=i.getAttribute("uploadId");if(!o.consumable.consume(t.item,e.name))return;const s=n.plugins.get(xd),a=r?t.attributeNewValue:null,l=this.placeholder,c=n.editing.mapper.toViewElement(i),d=o.writer;if("reading"==a)return Gu(c,d),void Ku(l,c,d);if("uploading"==a){const e=s.loaders.get(r);return Gu(c,d),void(e?(Ju(c,d),function(e,t,o,n){const i=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"),i),o.on("change:uploadedPercent",(e,t,o)=>{n.change(e=>{e.setStyle("width",o+"%",i)})})}(c,d,e,n.editing.view),function(e,t,o){if(o.data){const n=Dh(e);t.setAttribute("src",o.data,n)}}(c,d,e)):Ku(l,c,d))}"complete"==a&&s.loaders.get(r)&&function(e,t,o){const n=t.createUIElement("div",{class:"ck-image-upload-complete-icon"});t.insert(t.createPositionAt(e,"end"),n),setTimeout(()=>{o.change(e=>e.remove(e.createRangeOn(n)))},3e3)}(c,d,n.editing.view),function(e,t){Qu(e,t,"progressBar")}(c,d),Ju(c,d),function(e,t){t.removeClass("ck-appear",e)}(c,d)}}function Gu(e,t){e.hasClass("ck-appear")||t.addClass("ck-appear",e)}function Ku(e,t,o){t.hasClass("ck-image-upload-placeholder")||o.addClass("ck-image-upload-placeholder",t);const n=Dh(t);n.getAttribute("src")!==e&&o.setAttribute("src",e,n),Yu(t,"placeholder")||o.insert(o.createPositionAfter(n),function(e){const t=e.createUIElement("div",{class:"ck-upload-placeholder-loader"});return e.setCustomProperty("placeholder",!0,t),t}(o))}function Ju(e,t){e.hasClass("ck-image-upload-placeholder")&&t.removeClass("ck-image-upload-placeholder",e),Qu(e,t,"placeholder")}function Yu(e,t){for(const o of e.getChildren())if(o.getCustomProperty(t))return o}function Qu(e,t,o){const n=Yu(e,o);n&&t.remove(t.createRangeOn(n))}class Xu extends _d{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="show:"+e.type+(e.namespace?":"+e.namespace:"");this.fire(t,{message:e.message,type:e.type,title:e.title||""})}}class Zu{constructor(e){this.files=function(e){const t=e.files?Array.from(e.files):[],o=e.items?Array.from(e.items):[];if(t.length)return t;return o.filter(e=>"file"===e.kind).map(e=>e.getAsFile())}(e),this._native=e}get types(){return this._native.types}getData(e){return this._native.getData(e)}setData(e,t){this._native.setData(e,t)}}class em extends Fr{constructor(e){super(e);const t=this.document;function o(e,o){o.preventDefault();const n=o.dropRange?[o.dropRange]:Array.from(t.selection.getRanges()),i=new lo(t,"clipboardInput");t.fire(i,{dataTransfer:o.dataTransfer,targetRanges:n}),i.stop.called&&o.stopPropagation()}this.domEventType=["paste","copy","cut","drop","dragover"],this.listenTo(t,"paste",o,{priority:"low"}),this.listenTo(t,"drop",o,{priority:"low"})}onDomEvent(e){const t={dataTransfer:new Zu(e.clipboardData?e.clipboardData:e.dataTransfer)};"drop"==e.type&&(t.dropRange=function(e,t){const o=t.target.ownerDocument,n=t.clientX,i=t.clientY;let r;o.caretRangeFromPoint&&o.caretRangeFromPoint(n,i)?r=o.caretRangeFromPoint(n,i):t.rangeParent&&(r=o.createRange(),r.setStart(t.rangeParent,t.rangeOffset),r.collapse(!0));return r?e.domConverter.domRangeToView(r):e.document.selection.getFirstRange()}(this.view,e)),this.fire(e.type,e,t)}}const tm=["figcaption","li"];class om extends jl{static get pluginName(){return"Clipboard"}init(){const e=this.editor,t=e.model.document,o=e.editing.view,n=o.document;function i(o,i){const r=i.dataTransfer;i.preventDefault();const s=e.data.toView(e.model.getSelectedContent(t.selection));n.fire("clipboardOutput",{dataTransfer:r,content:s,method:o.name})}this._htmlDataProcessor=new Hl(n),o.addObserver(em),this.listenTo(n,"clipboardInput",t=>{e.isReadOnly&&t.stop()},{priority:"highest"}),this.listenTo(n,"clipboardInput",(e,t)=>{const n=t.dataTransfer;let i="";var r;n.getData("text/html")?i=function(e){return e.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(e,t)=>1==t.length?" ":t)}(n.getData("text/html")):n.getData("text/plain")&&((r=(r=n.getData("text/plain")).replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"</p><p>").replace(/^\s/,"&nbsp;").replace(/\s$/,"&nbsp;").replace(/\s\s/g," &nbsp;")).indexOf("</p><p>")>-1&&(r=`<p>${r}</p>`),i=r),i=this._htmlDataProcessor.toView(i);const s=new lo(this,"inputTransformation");this.fire(s,{content:i,dataTransfer:n}),s.stop.called&&e.stop(),o.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(e,o)=>{if(!o.content.isEmpty){const n=this.editor.data,i=this.editor.model,r=n.toModel(o.content,"$clipboardHolder");if(0==r.childCount)return;if(function(e){if(e.childCount>1)return!1;return 0==[...e.getChild(0).getAttributeKeys()].length}(r)){const e=r.getChild(0);i.change(o=>{o.setAttributes(t.selection.getAttributes(),e)})}i.insertContent(r),e.stop()}},{priority:"low"}),this.listenTo(n,"copy",i,{priority:"low"}),this.listenTo(n,"cut",(t,o)=>{e.isReadOnly?o.preventDefault():i(t,o)},{priority:"low"}),this.listenTo(n,"clipboardOutput",(o,n)=>{n.content.isEmpty||(n.dataTransfer.setData("text/html",this._htmlDataProcessor.toData(n.content)),n.dataTransfer.setData("text/plain",function e(t){let o="";if(t.is("$text")||t.is("$textProxy"))o=t.data;else if(t.is("element","img")&&t.hasAttribute("alt"))o=t.getAttribute("alt");else{let n=null;for(const i of t.getChildren()){const t=e(i);n&&(n.is("containerElement")||i.is("containerElement"))&&(tm.includes(n.name)||tm.includes(i.name)?o+="\n":o+="\n\n"),o+=t,n=i}}return o}(n.content))),"cut"==n.method&&e.model.deleteContent(t.selection)},{priority:"low"})}}class nm{constructor(e){this.document=e}createDocumentFragment(e){return new Ei(this.document,e)}createElement(e,t,o){return new Nn(this.document,e,t,o)}createText(e){return new No(this.document,e)}clone(e,t=!1){return e._clone(t)}appendChild(e,t){return t._appendChild(e)}insertChild(e,t,o){return o._insertChild(e,t)}removeChildren(e,t,o){return o._removeChildren(e,t)}remove(e){const t=e.parent;return t?this.removeChildren(t.getChildIndex(e),1,t):[]}replace(e,t){const o=e.parent;if(o){const n=o.getChildIndex(e);return this.removeChildren(n,1,o),this.insertChild(n,t,o),!0}return!1}unwrapElement(e){const t=e.parent;if(t){const o=t.getChildIndex(e);this.remove(e),this.insertChild(o,e.getChildren(),t)}}rename(e,t){const o=new Nn(this.document,e,t.getAttributes(),t.getChildren());return this.replace(t,o)?o:null}setAttribute(e,t,o){o._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,o){y(e)&&void 0===o&&(o=t),o._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,o){o._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}createPositionAt(e,t){return ei._createAt(e,t)}createPositionAfter(e){return ei._createAfter(e)}createPositionBefore(e){return ei._createBefore(e)}createRange(e,t){return new ti(e,t)}createRangeOn(e){return ti._createOn(e)}createRangeIn(e){return ti._createIn(e)}createSelection(e,t,o){return new ii(e,t,o)}}class im extends Vd{refresh(){const e=this.editor.model.document.selection.getSelectedElement(),t=e&&"image"===e.name||!1;this.isEnabled=Fh(this.editor.model)||t}execute(e){const t=this.editor,o=t.model,n=t.plugins.get(xd);o.change(t=>{const i=Array.isArray(e.file)?e.file:[e.file];for(const e of i)rm(t,o,n,e)})}}function rm(e,t,o,n){const i=o.createLoader(n);i&&Bh(e,t,{uploadId:i.id})}class sm extends jl{static get requires(){return[xd,Xu,om]}static get pluginName(){return"ImageUploadEditing"}constructor(e){super(e),e.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}})}init(){const e=this.editor,t=e.model.document,o=e.model.schema,n=e.conversion,i=e.plugins.get(xd),r=Wu(e.config.get("image.upload.types"));o.extend("image",{allowAttributes:["uploadId","uploadStatus"]}),e.commands.add("imageUpload",new im(e)),n.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(e.editing.view.document,"clipboardInput",(t,o)=>{if(n=o.dataTransfer,Array.from(n.types).includes("text/html")&&""!==n.getData("text/html"))return;var n;const i=Array.from(o.dataTransfer.files).filter(e=>!!e&&r.test(e.type)),s=o.targetRanges.map(t=>e.editing.mapper.toModelRange(t));e.model.change(o=>{o.setSelection(s),i.length&&(t.stop(),e.model.enqueueChange("default",()=>{e.execute("imageUpload",{file:i})}))})}),this.listenTo(e.plugins.get(om),"inputTransformation",(t,o)=>{const n=Array.from(e.editing.view.createRangeIn(o.content)).filter(e=>{return!(!(t=e.item).is("element","img")||!t.getAttribute("src"))&&(t.getAttribute("src").match(/^data:image\/\w+;base64,/g)||t.getAttribute("src").match(/^blob:/g))&&!e.item.getAttribute("uploadProcessed");var t}).map(e=>{return{promise:(t=e.item,new Promise((e,o)=>{const n=t.getAttribute("src");fetch(n).then(e=>e.blob()).then(t=>{const o=function(e,t){return e.type?e.type:t.match(/data:(image\/\w+);base64/)?t.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}(t,n),i=o.replace("image/",""),r=new File([t],"image."+i,{type:o});e(r)}).catch(o)})),imageElement:e.item};var t});if(!n.length)return;const r=new nm(e.editing.view.document);for(const e of n){r.setAttribute("uploadProcessed",!0,e.imageElement);const t=i.createLoader(e.promise);t&&(r.setAttribute("src","",e.imageElement),r.setAttribute("uploadId",t.id,e.imageElement))}}),e.editing.view.document.on("dragover",(e,t)=>{t.preventDefault()}),t.on("change",()=>{const o=t.differ.getChanges({includeChangesInGraveyard:!0});for(const t of o)if("insert"==t.type&&"$text"!=t.name){const o=t.position.nodeAfter,n="$graveyard"==t.position.root.rootName;for(const t of am(e,o)){const e=t.getAttribute("uploadId");if(!e)continue;const o=i.loaders.get(e);o&&(n?o.abort():"idle"==o.status&&this._readAndUpload(o,t))}}})}_readAndUpload(e,t){const o=this.editor,n=o.model,i=o.locale.t,r=o.plugins.get(xd),s=o.plugins.get(Xu);return n.enqueueChange("transparent",e=>{e.setAttribute("uploadStatus","reading",t)}),e.read().then(()=>{const i=e.upload();if(mi.isSafari){const e=Dh(o.editing.mapper.toViewElement(t));o.editing.view.once("render",()=>{if(!e.parent)return;const t=o.editing.view.domConverter.mapViewToDom(e.parent);if(!t)return;const n=t.style.display;t.style.display="none",t._ckHack=t.offsetHeight,t.style.display=n})}return n.enqueueChange("transparent",e=>{e.setAttribute("uploadStatus","uploading",t)}),i}).then(e=>{n.enqueueChange("transparent",o=>{o.setAttributes({uploadStatus:"complete",src:e.default},t),this._parseAndSetSrcsetAttributeOnImage(e,t,o)}),a()}).catch(o=>{if("error"!==e.status&&"aborted"!==e.status)throw o;"error"==e.status&&o&&s.showWarning(o,{title:i("Upload failed"),namespace:"upload"}),a(),n.enqueueChange("transparent",e=>{e.remove(t)})});function a(){n.enqueueChange("transparent",e=>{e.removeAttribute("uploadId",t),e.removeAttribute("uploadStatus",t)}),r.destroyLoader(e)}}_parseAndSetSrcsetAttributeOnImage(e,t,o){let n=0;const i=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(", ");""!=i&&o.setAttribute("srcset",{data:i,width:n},t)}}function am(e,t){return Array.from(e.model.createRangeOn(t)).filter(e=>e.item.is("element","image")).map(e=>e.item)}class lm extends Vd{refresh(){const e=this.editor.model.document.selection.getSelectedElement();this.isEnabled=zh(e),e&&e.hasAttribute("width")?this.value={width:e.getAttribute("width"),height:null}:this.value=null}execute(e){const t=this.editor.model,o=t.document.selection.getSelectedElement();this.value={width:e.width,height:null},o&&t.change(t=>{t.setAttribute("width",e.width,o)})}}class cm extends jl{static get pluginName(){return"ImageResizeEditing"}constructor(e){super(e),e.config.define("image",{resizeUnit:"%",resizeOptions:[{name:"imageResize:original",value:null,icon:"original"},{name:"imageResize:25",value:"25",icon:"small"},{name:"imageResize:50",value:"50",icon:"medium"},{name:"imageResize:75",value:"75",icon:"large"}]})}init(){const e=this.editor,t=new lm(e);this._registerSchema(),this._registerConverters(),e.commands.add("imageResize",t)}_registerSchema(){this.editor.model.schema.extend("image",{allowAttributes:"width"}),this.editor.model.schema.setAttributeProperties("width",{isFormatting:!0})}_registerConverters(){const e=this.editor;e.conversion.for("downcast").add(e=>e.on("attribute:width:image",(e,t,o)=>{if(!o.consumable.consume(t.item,e.name))return;const n=o.writer,i=o.mapper.toViewElement(t.item);null!==t.attributeNewValue?(n.setStyle("width",t.attributeNewValue,i),n.addClass("image_resized",i)):(n.removeStyle("width",i),n.removeClass("image_resized",i))})),e.conversion.for("upcast").attributeToAttribute({view:{name:"figure",styles:{width:/.+/}},model:{key:"width",value:e=>e.getStyle("width")}})}}var dm='<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="M10 8H2a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2zm0 1.5a.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 .5-.5h8z"/></svg>';const hm={small:'<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="M7 10H2a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h5a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2zm0 1.5a.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 .5-.5h5z"/></svg>',medium:dm,large:'<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="M13 6H2a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2zm0 1.5a.5.5 0 0 1 .5.5v8a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5V8a.5.5 0 0 1 .5-.5h11z"/></svg>',original:'<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>'};class um extends jl{static get requires(){return[cm]}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"),o=e.commands.get("imageResize");this.bind("isEnabled").to(o);for(const e of t)this._registerImageResizeButton(e);this._registerImageResizeDropdown(t)}_registerImageResizeButton(e){const t=this.editor,{name:o,value:n,icon:i}=e,r=n?n+this._resizeUnit:null;t.ui.componentFactory.add(o,n=>{const s=new Cc(n),a=t.commands.get("imageResize"),l=this._getOptionLabelValue(e,!0);if(!hm[i])throw new mo.b('imageresizebuttons-missing-icon: The resize option "'+o+'" misses the "icon" property or the property value doesn\'t match any of the available icons.',t,e);return s.set({label:l,icon:hm[i],tooltip:l,isToggleable:!0}),s.bind("isEnabled").to(this),s.bind("isOn").to(a,"value",mm(r)),this.listenTo(s,"execute",()=>{t.execute("imageResize",{width:r})}),s})}_registerImageResizeDropdown(e){const t=this.editor,o=t.t,n=e.find(e=>!e.value);t.ui.componentFactory.add("imageResize",i=>{const r=t.commands.get("imageResize"),s=qc(i,Fc),a=s.buttonView;return a.set({tooltip:o("Resize image"),commandValue:n.value,icon:dm,isToggleable:!0,label:this._getOptionLabelValue(n),withText:!0,class:"ck-resize-image-button"}),a.bind("label").to(r,"value",e=>e&&e.width?e.width:this._getOptionLabelValue(n)),s.bind("isOn").to(r),s.bind("isEnabled").to(this),$c(s,this._getResizeDropdownListItemDefinitions(e,r)),s.listView.ariaLabel=o("Image resize list"),this.listenTo(s,"execute",e=>{t.execute(e.source.commandName,{width:e.source.commandValue}),t.editing.view.focus()}),s})}_getOptionLabelValue(e,t){const o=this.editor.t;return e.label?e.label:t?e.value?o("Resize image to %0",e.value+this._resizeUnit):o("Resize image to the original size"):e.value?e.value+this._resizeUnit:o("Original")}_getResizeDropdownListItemDefinitions(e,t){const o=new Ao;return e.map(e=>{const n=e.value?e.value+this._resizeUnit:null,i={type:"button",model:new bh({commandName:"imageResize",commandValue:n,label:this._getOptionLabelValue(e),withText:!0,icon:null})};i.model.bind("isOn").to(t,"value",mm(n)),o.add(i)}),o}}function mm(e){return t=>null===e&&t===e||t&&t.width===e}class gm{constructor(e){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}begin(e,t,o){const n=new is(t);this.activeHandlePosition=function(e){const t=["top-left","top-right","bottom-right","bottom-left"];for(const o of t)if(e.classList.contains("ck-widget__resizer__handle-"+o))return o}(e),this._referenceCoordinates=function(e,t){const o=new is(e),n=t.split("-"),i={x:"right"==n[1]?o.right:o.left,y:"bottom"==n[0]?o.bottom:o.top};return i.x+=e.ownerDocument.defaultView.scrollX,i.y+=e.ownerDocument.defaultView.scrollY,i}(t,function(e){const t=e.split("-"),o={top:"bottom",bottom:"top",left:"right",right:"left"};return`${o[t[0]]}-${o[t[1]]}`}(this.activeHandlePosition)),this.originalWidth=n.width,this.originalHeight=n.height,this.aspectRatio=n.width/n.height;const i=o.style.width;i&&i.match(/^\d+\.?\d*%$/)?this.originalWidthPercents=parseFloat(i):this.originalWidthPercents=function(e,t){const o=e.parentElement,n=parseFloat(o.ownerDocument.defaultView.getComputedStyle(o).width);return t.width/n*100}(o,n)}update(e){this.proposedWidth=e.width,this.proposedHeight=e.height,this.proposedWidthPercents=e.widthPercents,this.proposedHandleHostWidth=e.handleHostWidth,this.proposedHandleHostHeight=e.handleHostHeight}}Co(gm,qn);class fm{constructor(e){this._options=e,this._domResizerWrapper=null,this._viewResizerWrapper=null,this.set("isEnabled",!0),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"}),this.on("change:isEnabled",()=>{this.isEnabled&&this.redraw()})}attach(){const e=this,t=this._options.viewElement;this._options.editor.editing.view.change(o=>{const n=o.createUIElement("div",{class:"ck ck-reset_all ck-widget__resizer"},(function(t){const o=this.toDomElement(t);return e._appendHandles(o),e._appendSizeUI(o),e._domResizerWrapper=o,e.on("change:isEnabled",(e,t,n)=>{o.style.display=n?"":"none"}),o.style.display=e.isEnabled?"":"none",o}));o.insert(o.createPositionAt(t,"end"),n),o.addClass("ck-widget_with-resizer",t),this._viewResizerWrapper=n})}begin(e){this.state=new gm(this._options),this._sizeUI.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 o=this._options.unit||"%",n=("%"===o?t.widthPercents:t.width)+o;e.setStyle("width",n,this._options.viewElement)});const o=this._getHandleHost(),n=new is(o);t.handleHostWidth=Math.round(n.width),t.handleHostHeight=Math.round(n.height);const i=new is(o);t.width=Math.round(i.width),t.height=Math.round(i.height),this.redraw(n),this.state.update(t)}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(!((o=t)&&o.ownerDocument&&o.ownerDocument.contains(o)))return;var o;const n=t.parentElement,i=this._getHandleHost(),r=this._viewResizerWrapper,s=[r.getStyle("width"),r.getStyle("height"),r.getStyle("left"),r.getStyle("top")];let a;if(n.isSameNode(i)){const t=e||new is(i);a=[t.width+"px",t.height+"px",void 0,void 0]}else a=[i.offsetWidth+"px",i.offsetHeight+"px",i.offsetLeft+"px",i.offsetTop+"px"];"same"!==Vo(s,a)&&this._options.editor.editing.view.change(e=>{e.setStyle({width:a[0],height:a[1],left:a[2],top:a[3]},r)})}containsHandle(e){return this._domResizerWrapper.contains(e)}static isResizeHandle(e){return e.classList.contains("ck-widget__resizer__handle")}_cleanup(){this._sizeUI.dismiss(),this._sizeUI.isVisible=!1;this._options.editor.editing.view.change(e=>{e.setStyle("width",this._initialViewWidth,this._options.viewElement)})}_proposeNewSize(e){const t=this.state,o={x:(n=e).pageX,y:n.pageY};var n;const i=!this._options.isCentered||this._options.isCentered(this),r={x:t._referenceCoordinates.x-(o.x+t.originalWidth),y:o.y-t.originalHeight-t._referenceCoordinates.y};i&&t.activeHandlePosition.endsWith("-right")&&(r.x=o.x-(t._referenceCoordinates.x+t.originalWidth)),i&&(r.x*=2);const s={width:Math.abs(t.originalWidth+r.x),height:Math.abs(t.originalHeight+r.y)};s.dominant=s.width/t.aspectRatio>s.height?"width":"height",s.max=s[s.dominant];const a={width:s.width,height:s.height};return"width"==s.dominant?a.height=a.width/t.aspectRatio:a.width=a.height*t.aspectRatio,{width:Math.round(a.width),height:Math.round(a.height),widthPercents:Math.min(Math.round(t.originalWidthPercents/t.originalWidth*a.width*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)}_appendHandles(e){const t=["top-left","top-right","bottom-right","bottom-left"];for(const n of t)e.appendChild(new $l({tag:"div",attributes:{class:"ck-widget__resizer__handle "+(o=n,"ck-widget__resizer__handle-"+o)}}).render());var o}_appendSizeUI(e){const t=new pm;t.render(),this._sizeUI=t,e.appendChild(t.element)}}Co(fm,qn);class pm extends dc{constructor(){super();const e=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-size-view",e.to("activeHandlePosition",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,o,n)=>"px"===e.unit?`${t}×${o}`:n+"%"),this.bind("activeHandlePosition").to(t)}dismiss(){this.unbind(),this.isVisible=!1}}var bm=function(e,t,o){var n=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return B(o)&&(n="leading"in o?!!o.leading:n,i="trailing"in o?!!o.trailing:i),Jr(e,t,{leading:n,maxWait:t,trailing:i})};o(80);class wm extends jl{static get pluginName(){return"WidgetResize"}init(){this.set("_visibleResizer",null),this.set("_activeResizer",null),this._resizers=new Map;const e=rr.window.document;this.editor.model.schema.setAttributeProperties("width",{isFormatting:!0}),this.editor.editing.view.addObserver(qh),this._observer=Object.create(gr),this.listenTo(this.editor.editing.view.document,"mousedown",this._mouseDownListener.bind(this),{priority:"high"}),this._observer.listenTo(e,"mousemove",this._mouseMoveListener.bind(this)),this._observer.listenTo(e,"mouseup",this._mouseUpListener.bind(this));const t=()=>{this._visibleResizer&&this._visibleResizer.redraw()},o=bm(t,200);this.on("change:_visibleResizer",t),this.editor.ui.on("update",o),this._observer.listenTo(rr.window,"resize",o);const n=this.editor.editing.view.document.selection;n.on("change",()=>{const e=n.getSelectedElement();this._visibleResizer=this._getResizerByViewElement(e)||null})}destroy(){this._observer.stopListening();for(const e of this._resizers.values())e.destroy()}attachTo(e){const t=new fm(e),o=this.editor.plugins;if(t.attach(),o.has("WidgetToolbarRepository")){const e=o.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"})}return this._resizers.set(e.viewElement,t),t}_getResizerByHandle(e){for(const t of this._resizers.values())if(t.containsHandle(e))return t}_getResizerByViewElement(e){return this._resizers.get(e)}_mouseDownListener(e,t){const o=t.domTarget;fm.isResizeHandle(o)&&(this._activeResizer=this._getResizerByHandle(o),this._activeResizer&&(this._activeResizer.begin(o),e.stop(),t.preventDefault()))}_mouseMoveListener(e,t){this._activeResizer&&this._activeResizer.updateSize(t)}_mouseUpListener(){this._activeResizer&&(this._activeResizer.commit(),this._activeResizer=null)}}Co(wm,qn);class km extends jl{static get requires(){return[wm]}static get pluginName(){return"ImageResizeHandles"}init(){const e=this.editor,t=e.commands.get("imageResize");this.bind("isEnabled").to(t),e.editing.downcastDispatcher.on("insert:image",(t,o,n)=>{const i=n.mapper.toViewElement(o.item),r=e.plugins.get(wm).attachTo({unit:e.config.get("image.resizeUnit"),modelElement:o.item,viewElement:i,editor:e,getHandleHost:e=>e.querySelector("img"),getResizeHost:e=>e,isCentered(){const e=o.item.getAttribute("imageStyle");return!e||"full"==e||"alignCenter"==e},onCommit(t){e.execute("imageResize",{width:t})}});r.on("updateSize",()=>{i.hasClass("image_resized")||e.editing.view.change(e=>{e.addClass("image_resized",i)})}),r.bind("isEnabled").to(this)},{priority:"low"})}}o(82);class _m{constructor(e,t=20){this.model=e,this.size=0,this.limit=t,this.isLocked=!1,this._changeCallback=(e,t)=>{"transparent"!=t.type&&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()),this._batch}input(e){this.size+=e,this.size>=this.limit&&this._reset(!0)}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){this.isLocked&&!e||(this._batch=null,this.size=0)}}class vm extends Vd{constructor(e,t){super(e),this._buffer=new _m(e.model,t),this._batches=new WeakSet}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){const t=this.editor.model,o=t.document,n=e.text||"",i=n.length,r=e.range?t.createSelection(e.range):o.selection,s=e.resultRange;t.enqueueChange(this._buffer.batch,e=>{this._buffer.lock(),this._batches.add(this._buffer.batch),t.deleteContent(r),n&&t.insertContent(e.createText(n,o.selection.getAttributes()),r),s?e.setSelection(s):r.is("documentSelection")||e.setSelection(r),this._buffer.unlock(),this._buffer.input(i)})}}function ym(e){if(e.newChildren.length-e.oldChildren.length!=1)return;const t=function(e,t){const o=[];let n,i=0;return e.forEach(e=>{"equal"==e?(r(),i++):"insert"==e?(s("insert")?n.values.push(t[i]):(r(),n={type:"insert",index:i,values:[t[i]]}),i++):s("delete")?n.howMany++:(r(),n={type:"delete",index:i,howMany:1})}),r(),o;function r(){n&&(o.push(n),n=null)}function s(e){return n&&n.type==e}}(Qi(e.oldChildren,e.newChildren,xm),e.newChildren);if(t.length>1)return;const o=t[0];return o.values[0]&&o.values[0].is("$text")?o:void 0}function xm(e,t){return e&&e.is("$text")&&t&&t.is("$text")?e.data===t.data:e===t}class Cm{constructor(e){this.editor=e,this.editing=this.editor.editing}handle(e,t){if(function(e){if(0==e.length)return!1;for(const t of e)if("children"===t.type&&!ym(t))return!0;return!1}(e))this._handleContainerChildrenMutations(e,t);else for(const o of e)this._handleTextMutation(o,t),this._handleTextNodeInsertion(o)}_handleContainerChildrenMutations(e,t){const o=function(e){const t=e.map(e=>e.node).reduce((e,t)=>e.getCommonAncestor(t,{includeSelf:!0}));if(!t)return;return t.getAncestors({includeSelf:!0,parentFirst:!0}).find(e=>e.is("containerElement")||e.is("rootElement"))}(e);if(!o)return;const n=this.editor.editing.view.domConverter.mapViewToDom(o),i=new cr(this.editor.editing.view.document),r=this.editor.data.toModel(i.domToView(n)).getChild(0),s=this.editor.editing.mapper.toModelElement(o);if(!s)return;const a=Array.from(r.getChildren()),l=Array.from(s.getChildren()),c=a[a.length-1],d=l[l.length-1],h=c&&c.is("element","softBreak"),u=d&&!d.is("element","softBreak");h&&u&&a.pop();const m=this.editor.model.schema;if(!Am(a,m)||!Am(l,m))return;const g=a.map(e=>e.is("$text")?e.data:"@").join("").replace(/\u00A0/g," "),f=l.map(e=>e.is("$text")?e.data:"@").join("").replace(/\u00A0/g," ");if(f===g)return;const p=Qi(f,g),{firstChangeAt:b,insertions:w,deletions:k}=Tm(p);let _=null;t&&(_=this.editing.mapper.toModelRange(t.getFirstRange()));const v=g.substr(b,w),y=this.editor.model.createRange(this.editor.model.createPositionAt(s,b),this.editor.model.createPositionAt(s,b+k));this.editor.execute("input",{text:v,range:y,resultRange:_})}_handleTextMutation(e,t){if("text"!=e.type)return;const o=e.newText.replace(/\u00A0/g," "),n=e.oldText.replace(/\u00A0/g," ");if(n===o)return;const i=Qi(n,o),{firstChangeAt:r,insertions:s,deletions:a}=Tm(i);let l=null;t&&(l=this.editing.mapper.toModelRange(t.getFirstRange()));const c=this.editing.view.createPositionAt(e.node,r),d=this.editing.mapper.toModelPosition(c),h=this.editor.model.createRange(d,d.getShiftedBy(a)),u=o.substr(r,s);this.editor.execute("input",{text:u,range:h,resultRange:l})}_handleTextNodeInsertion(e){if("children"!=e.type)return;const t=ym(e),o=this.editing.view.createPositionAt(e.node,t.index),n=this.editing.mapper.toModelPosition(o),i=t.values[0].data;this.editor.execute("input",{text:i.replace(/\u00A0/g," "),range:this.editor.model.createRange(n)})}}function Am(e,t){return e.every(e=>t.isInline(e))}function Tm(e){let t=null,o=null;for(let n=0;n<e.length;n++){"equal"!=e[n]&&(t=null===t?n:t,o=n)}let n=0,i=0;for(let r=t;r<=o;r++)"insert"!=e[r]&&n++,"delete"!=e[r]&&i++;return{insertions:i,deletions:n,firstChangeAt:t}}class Pm extends jl{static get pluginName(){return"Input"}init(){const e=this.editor,t=new vm(e,e.config.get("typing.undoStep")||20);e.commands.add("input",t),function(e){let t=null;const o=e.model,n=e.editing.view,i=e.commands.get("input");function r(e){const r=o.document,a=n.document.isComposing,l=t&&t.isEqual(r.selection);t=null,i.isEnabled&&(Uh(e)||r.selection.isCollapsed||a&&229===e.keyCode||!a&&229===e.keyCode&&l||s())}function s(){const e=i.buffer;e.lock();const t=e.batch;i._batches.add(t),o.enqueueChange(t,()=>{o.deleteContent(o.document.selection)}),e.unlock()}mi.isAndroid?n.document.on("beforeinput",(e,t)=>r(t),{priority:"lowest"}):n.document.on("keydown",(e,t)=>r(t),{priority:"lowest"}),n.document.on("compositionstart",(function(){const e=o.document,t=1!==e.selection.rangeCount||e.selection.getFirstRange().isFlat;if(e.selection.isCollapsed||t)return;s()}),{priority:"lowest"}),n.document.on("compositionend",()=>{t=o.createSelection(o.document.selection)},{priority:"lowest"})}(e),function(e){e.editing.view.document.on("mutations",(t,o,n)=>{new Cm(e).handle(o,n)})}(e)}isInput(e){return this.editor.commands.get("input")._batches.has(e)}}class Sm{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,o)=>{if(!o.consumable.test(t.item,"attribute:linkHref"))return;const n=o.writer,i=n.document.selection;for(const e of this._definitions){const r=n.createAttributeElement("a",e.attributes,{priority:5});n.setCustomProperty("link",!0,r),e.callback(t.attributeNewValue)?t.item.is("selection")?n.wrap(i.getFirstRange(),r):n.wrap(o.mapper.toViewRange(t.range),r):n.unwrap(o.mapper.toViewRange(t.range),r)}},{priority:"high"})}}getDispatcherForLinkedImage(){return e=>{e.on("attribute:linkHref:image",(e,t,o)=>{const n=o.mapper.toViewElement(t.item),i=Array.from(n.getChildren()).find(e=>"a"===e.name);for(const e of this._definitions){const n=Bo(e.attributes);if(e.callback(t.attributeNewValue))for(const[e,t]of n)"class"===e?o.writer.addClass(t,i):o.writer.setAttribute(e,t,i);else for(const[e,t]of n)"class"===e?o.writer.removeClass(t,i):o.writer.removeAttribute(e,i)}})}}}var Em=function(e,t,o){var n=e.length;return o=void 0===o?n:o,!t&&o>=n?e:rn(e,t,o)},Rm=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Im=function(e){return Rm.test(e)};var Vm=function(e){return e.split("")},Om="[\\ud800-\\udfff]",Mm="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Nm="\\ud83c[\\udffb-\\udfff]",zm="[^\\ud800-\\udfff]",Bm="(?:\\ud83c[\\udde6-\\uddff]){2}",Fm="[\\ud800-\\udbff][\\udc00-\\udfff]",Dm="(?:"+Mm+"|"+Nm+")"+"?",Lm="[\\ufe0e\\ufe0f]?"+Dm+("(?:\\u200d(?:"+[zm,Bm,Fm].join("|")+")[\\ufe0e\\ufe0f]?"+Dm+")*"),Hm="(?:"+[zm+Mm+"?",Mm,Bm,Fm,Om].join("|")+")",jm=RegExp(Nm+"(?="+Nm+")|"+Hm+Lm,"g");var Wm=function(e){return e.match(jm)||[]};var qm=function(e){return Im(e)?Wm(e):Vm(e)};var $m=function(e){return function(t){t=Zo(t);var o=Im(t)?qm(t):void 0,n=o?o[0]:t.charAt(0),i=o?Em(o,1).join(""):t.slice(1);return n[e]()+i}}("toUpperCase");const Um=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,Gm=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i;function Km(e,{writer:t}){const o=t.createAttributeElement("a",{href:e},{priority:5});return t.setCustomProperty("link",!0,o),o}function Jm(e){return function(e){return e.replace(Um,"").match(Gm)}(e=String(e))?e:"#"}function Ym(e,t){return!!e&&(e.is("element","image")&&t.checkAttribute("image","linkHref"))}class Qm extends Vd{constructor(e){super(e),this.manualDecorators=new Ao,this.automaticDecorators=new Sm}restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,t=e.document,o=Pd(t.selection.getSelectedBlocks());Ym(o,e.schema)?(this.value=o.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(o,"linkHref")):(this.value=t.selection.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"linkHref"));for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}execute(e,t={}){const o=this.editor.model,n=o.document.selection,i=[],r=[];for(const e in t)t[e]?i.push(e):r.push(e);o.change(t=>{if(n.isCollapsed){const s=n.getFirstPosition();if(n.hasAttribute("linkHref")){const a=Xd(s,"linkHref",n.getAttribute("linkHref"),o);t.setAttribute("linkHref",e,a),i.forEach(e=>{t.setAttribute(e,!0,a)}),r.forEach(e=>{t.removeAttribute(e,a)}),t.setSelection(t.createPositionAfter(a.end.nodeBefore))}else if(""!==e){const r=Bo(n.getAttributes());r.set("linkHref",e),i.forEach(e=>{r.set(e,!0)});const a=t.createText(e,r);o.insertContent(a,s),t.setSelection(t.createPositionAfter(a))}["linkHref",...i,...r].forEach(e=>{t.removeSelectionAttribute(e)})}else{const s=o.schema.getValidRanges(n.getRanges(),"linkHref"),a=[];for(const e of n.getSelectedBlocks())o.schema.checkAttribute(e,"linkHref")&&a.push(t.createRangeOn(e));const l=a.slice();for(const e of s)this._isRangeToUpdate(e,a)&&l.push(e);for(const o of l)t.setAttribute("linkHref",e,o),i.forEach(e=>{t.setAttribute(e,!0,o)}),r.forEach(e=>{t.removeAttribute(e,o)})}})}_getDecoratorStateFromModel(e){const t=this.editor.model,o=t.document,n=Pd(o.selection.getSelectedBlocks());return Ym(n,t.schema)?n.getAttribute(e):o.selection.getAttribute(e)}_isRangeToUpdate(e,t){for(const o of t)if(o.containsRange(e))return!1;return!0}}class Xm extends Vd{refresh(){const e=this.editor.model,t=e.document,o=Pd(t.selection.getSelectedBlocks());Ym(o,e.schema)?this.isEnabled=e.schema.checkAttribute(o,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"linkHref")}execute(){const e=this.editor,t=this.editor.model,o=t.document.selection,n=e.commands.get("link");t.change(e=>{const i=o.isCollapsed?[Xd(o.getFirstPosition(),"linkHref",o.getAttribute("linkHref"),t)]:o.getRanges();for(const t of i)if(e.removeAttribute("linkHref",t),n)for(const o of n.manualDecorators)e.removeAttribute(o.id,t)})}}class Zm{constructor({id:e,label:t,attributes:o,defaultValue:n}){this.id=e,this.set("value"),this.defaultValue=n,this.label=t,this.attributes=o}}Co(Zm,qn);o(84);const eg=/^(https?:)?\/\//;class tg extends jl{static get pluginName(){return"LinkEditing"}static get requires(){return[Gd,Pm,om]}constructor(e){super(e),e.config.define("link",{addTargetToExternalLinks:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"linkHref"}),e.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:Km}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(e,t)=>Km(Jm(e),t)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:e=>e.getAttribute("href")}}),e.commands.add("link",new Qm(e)),e.commands.add("unlink",new Xm(e));const t=function(e,t){const o={"Open in a new tab":e("Open in a new tab"),Downloadable:e("Downloadable")};return t.forEach(e=>(e.label&&o[e.label]&&(e.label=o[e.label]),e)),t}(e.t,function(e){const t=[];if(e)for(const[o,n]of Object.entries(e)){const e=Object.assign({},n,{id:"link"+$m(o)});t.push(e)}return t}(e.config.get("link.decorators")));this._enableAutomaticDecorators(t.filter(e=>"automatic"===e.mode)),this._enableManualDecorators(t.filter(e=>"manual"===e.mode));e.plugins.get(Gd).registerAttribute("linkHref"),eh(e,"linkHref","a","ck-link_selected"),this._enableInsertContentSelectionAttributesFixer(),this._enableClickingAfterLink(),this._enableTypingOverLink(),this._handleDeleteContentAfterLink()}_enableAutomaticDecorators(e){const t=this.editor,o=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&o.add({id:"linkIsExternal",mode:"automatic",callback:e=>eg.test(e),attributes:{target:"_blank",rel:"noopener noreferrer"}}),o.add(e),o.length&&t.conversion.for("downcast").add(o.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,o=t.commands.get("link").manualDecorators;e.forEach(e=>{t.model.schema.extend("$text",{allowAttributes:e.id}),o.add(new Zm(e)),t.conversion.for("downcast").attributeToElement({model:e.id,view:(t,{writer:n})=>{if(t){const t=o.get(e.id).attributes,i=n.createAttributeElement("a",t,{priority:5});return n.setCustomProperty("link",!0,i),i}}}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:o.get(e.id).attributes},model:{key:e.id}})})}_enableInsertContentSelectionAttributesFixer(){const e=this.editor,t=e.model,o=t.document.selection,n=e.commands.get("link");this.listenTo(t,"insertContent",()=>{const e=o.anchor.nodeBefore,i=o.anchor.nodeAfter;o.hasAttribute("linkHref")&&e&&e.hasAttribute("linkHref")&&(i&&i.hasAttribute("linkHref")||t.change(e=>{og(e,n.manualDecorators)}))},{priority:"low"})}_enableClickingAfterLink(){const e=this.editor,t=e.commands.get("link");e.editing.view.addObserver(qh);let o=!1;this.listenTo(e.editing.view.document,"mousedown",()=>{o=!0}),this.listenTo(e.editing.view.document,"selectionChange",()=>{if(!o)return;o=!1;const n=e.model.document.selection;if(!n.isCollapsed)return;if(!n.hasAttribute("linkHref"))return;const i=n.getFirstPosition(),r=Xd(i,"linkHref",n.getAttribute("linkHref"),e.model);(i.isTouching(r.start)||i.isTouching(r.end))&&e.model.change(e=>{og(e,t.manualDecorators)})})}_enableTypingOverLink(){const e=this.editor,t=e.editing.view;let o,n;this.listenTo(t.document,"delete",()=>{n=!0},{priority:"high"}),this.listenTo(e.model,"deleteContent",()=>{const t=e.model.document.selection;t.isCollapsed||(n?n=!1:ng(e)&&function(e){const t=e.document.selection,o=t.getFirstPosition(),n=t.getLastPosition(),i=o.nodeAfter;if(!i)return!1;if(!i.is("$text"))return!1;if(!i.hasAttribute("linkHref"))return!1;const r=n.textNode||n.nodeBefore;if(i===r)return!0;return Xd(o,"linkHref",i.getAttribute("linkHref"),e).containsRange(e.createRange(o,n),!0)}(e.model)&&(o=t.getAttributes()))},{priority:"high"}),this.listenTo(e.model,"insertContent",(t,[i])=>{n=!1,ng(e)&&o&&(e.model.change(e=>{for(const[t,n]of o)e.setAttribute(t,n,i)}),o=null)},{priority:"high"})}_handleDeleteContentAfterLink(){const e=this.editor,t=e.model,o=t.document.selection,n=e.editing.view,i=e.commands.get("link");let r=!1,s=!1;this.listenTo(n.document,"delete",(e,t)=>{s=t.domEvent.keyCode===pi.backspace},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{r=!1;const e=o.getFirstPosition(),n=o.getAttribute("linkHref");if(!n)return;const i=Xd(e,"linkHref",n,t);r=i.containsPosition(e)||i.end.isEqual(e)},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{s&&(s=!1,r||e.model.enqueueChange(e=>{og(e,i.manualDecorators)}))},{priority:"low"})}}function og(e,t){e.removeSelectionAttribute("linkHref");for(const o of t)e.removeSelectionAttribute(o.id)}function ng(e){return e.plugins.get("Input").isInput(e.model.change(e=>e.batch))}class ig extends Fr{constructor(e){super(e),this.domEventType="click"}onDomEvent(e){this.fire(e.type,e)}}o(86);class rg extends dc{constructor(e,t,o){super(e);const n=e.t;this.focusTracker=new Ac,this.keystrokes=new Bl,this.urlInputView=this._createUrlInput(o),this.saveButtonView=this._createButton(n("Save"),cu,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(n("Cancel"),du,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(t),this.children=this._createFormChildren(t.manualDecorators),this._focusables=new ql,this._focusCycler=new Rc({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const i=["ck","ck-link-form"];t.manualDecorators.length&&i.push("ck-link-form_layout-vertical"),this.setTemplate({tag:"form",attributes:{class:i,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce((e,t)=>(e[t.name]=t.isOn,e),{})}render(){super.render(),lu({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)}focus(){this._focusCycler.focusFirst()}_createUrlInput(e="https://"){const t=this.locale.t,o=new iu(this.locale,su);return o.label=t("Link URL"),o.fieldView.placeholder=e+"example.com",o}_createButton(e,t,o,n){const i=new Cc(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i.extendTemplate({attributes:{class:o}}),n&&i.delegate("execute").to(this,n),i}_createManualDecoratorSwitches(e){const t=this.createCollection();for(const o of e.manualDecorators){const n=new jc(this.locale);n.set({name:o.id,label:o.label,withText:!0}),n.bind("isOn").toMany([o,e],"value",(e,t)=>void 0===t&&void 0===e?o.defaultValue:e),n.on("execute",()=>{o.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 dc;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}}o(88);class sg extends dc{constructor(e){super(e);const t=e.t;this.focusTracker=new Ac,this.keystrokes=new Bl,this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(t("Unlink"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.077 15l.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.562l-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(t("Edit link"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7.3 17.37l-.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.506L13.271 5.8c.316-.452-.16-1.333-1.065-1.966-.905-.634-1.895-.78-2.212-.328zM8 18.5L9.375 17H19v1.5H8z"/></svg>',"edit"),this.set("href"),this._focusables=new ql,this._focusCycler=new Rc({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"],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)}focus(){this._focusCycler.focusFirst()}_createButton(e,t,o){const n=new Cc(this.locale);return n.set({label:e,icon:t,tooltip:!0}),n.delegate("execute").to(this,o),n}_createPreviewButton(){const e=new Cc(this.locale),t=this.bindTemplate,o=this.t;return e.set({withText:!0,tooltip:o("Open link in new tab")}),e.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:t.to("href",e=>e&&Jm(e)),target:"_blank",rel:"noopener noreferrer"}}),e.bind("label").to(this,"href",e=>e||o("This link has no URL")),e.bind("isEnabled").to(this,"href",e=>!!e),e.template.tag="a",e.template.eventListeners={},e}}const ag=/^((\w+:(\/{2,})?)|(\W))/i,lg=/[\w-]+@[\w-]+\.+[\w-]+/i;class cg extends jl{static get requires(){return[Pc]}static get pluginName(){return"LinkUI"}init(){const e=this.editor;e.editing.view.addObserver(ig),this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._balloon=e.plugins.get(Pc),this._createToolbarLinkButton(),this._enableUserBalloonInteractions(),e.conversion.for("editingDowncast").markerToHighlight({model:"link-ui",view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:"link-ui",view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}})}destroy(){super.destroy(),this.formView.destroy()}_createActionsView(){const e=this.editor,t=new sg(e.locale),o=e.commands.get("link"),n=e.commands.get("unlink");return t.bind("href").to(o,"value"),t.editButtonView.bind("isEnabled").to(o),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("Ctrl+K",(e,t)=>{this._addFormView(),t()}),t}_createFormView(){const e=this.editor,t=e.commands.get("link"),o=e.config.get("link.defaultProtocol"),n=new rg(e.locale,t,o);return n.urlInputView.fieldView.bind("value").to(t,"value"),n.urlInputView.bind("isReadOnly").to(t,"isEnabled",e=>!e),n.saveButtonView.bind("isEnabled").to(t),this.listenTo(n,"submit",()=>{const{value:t}=n.urlInputView.fieldView.element,i=!!o&&!ag.test(t),r=lg.test(t),s=t&&i?(r?"mailto:":o)+t:t;e.execute("link",s,n.getDecoratorSwitchesState()),this._closeFormView()}),this.listenTo(n,"cancel",()=>{this._closeFormView()}),n.keystrokes.set("Esc",(e,t)=>{this._closeFormView(),t()}),n}_createToolbarLinkButton(){const e=this.editor,t=e.commands.get("link"),o=e.t;e.keystrokes.set("Ctrl+K",(e,t)=>{t(),this._showUI(!0)}),e.ui.componentFactory.add("link",e=>{const n=new Cc(e);return n.isEnabled=!0,n.label=o("Link"),n.icon='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.077 15l.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>',n.keystroke="Ctrl+K",n.tooltip=!0,n.isToggleable=!0,n.bind("isEnabled").to(t,"isEnabled"),n.bind("isOn").to(t,"value",e=>!!e),this.listenTo(n,"execute",()=>this._showUI(!0)),n})}_enableUserBalloonInteractions(){const e=this.editor.editing.view.document;this.listenTo(e,"click",()=>{this._getSelectedLinkElement()&&this._showUI()}),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())}),Wc({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this._isFormInPanel)return;const e=this.editor.commands.get("link");this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this._balloon.visibleView===this.formView&&this.formView.urlInputView.fieldView.select(),this.formView.urlInputView.fieldView.element.value=e.value||""}_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._balloon.remove(this.formView),this.editor.editing.view.focus(),this._hideFakeVisualSelection())}_showUI(e=!1){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 o=this._getSelectedLinkElement(),n=r();const i=()=>{const e=this._getSelectedLinkElement(),t=r();o&&!e||!o&&t!==n?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),o=e,n=t};function r(){return t.selection.focus.getAncestors().reverse().find(e=>e.is("element"))}this.listenTo(e.ui,"update",i),this.listenTo(this._balloon,"change:visibleView",i)}get _isFormInPanel(){return this._balloon.hasView(this.formView)}get _areActionsInPanel(){return this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){return this._balloon.visibleView==this.formView||this._areActionsVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=this.editor.model,o=e.document,n=this._getSelectedLinkElement(),i=t.markers.has("link-ui")?this.editor.editing.mapper.toViewRange(t.markers.get("link-ui").getRange()):o.selection.getFirstRange();return{target:n?e.domConverter.mapViewToDom(n):e.domConverter.viewRangeToDom(i)}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection;if(t.isCollapsed)return dg(t.getFirstPosition());{const o=t.getFirstRange().getTrimmed(),n=dg(o.start),i=dg(o.end);return n&&n==i&&e.createRangeIn(n).getTrimmed().isEqual(o)?n:null}}_showFakeVisualSelection(){const e=this.editor.model;e.change(t=>{e.markers.has("link-ui")?t.updateMarker("link-ui",{range:e.document.selection.getFirstRange()}):t.addMarker("link-ui",{usingOperation:!1,affectsData:!1,range:e.document.selection.getFirstRange()})})}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has("link-ui")&&e.change(e=>{e.removeMarker("link-ui")})}}function dg(e){return e.getAncestors().find(e=>{return(t=e).is("attributeElement")&&!!t.getCustomProperty("link");var t})}function hg(e,t){let o=e.start;return{text:Array.from(e.getItems()).reduce((e,n)=>n.is("$text")||n.is("$textProxy")?e+n.data:(o=t.createPositionAfter(n),""),""),range:t.createRange(o,e.end)}}class ug{constructor(e,t){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()}_startListening(){const e=this.model.document;this.listenTo(e.selection,"change:range",(t,{directChange:o})=>{o&&(e.selection.isCollapsed?this._evaluateTextBeforeSelection("selection"):this.hasMatch&&(this.fire("unmatched"),this.hasMatch=!1))}),this.listenTo(e,"change:data",(e,t)=>{"transparent"!=t.type&&this._evaluateTextBeforeSelection("data",{batch:t})})}_evaluateTextBeforeSelection(e,t={}){const o=this.model,n=o.document.selection,i=o.createRange(o.createPositionAt(n.focus.parent,0),n.focus),{text:r,range:s}=hg(i,o),a=this.testCallback(r);if(!a&&this.hasMatch&&this.fire("unmatched"),this.hasMatch=!!a,a){const o=Object.assign(t,{text:r,range:s});"object"==typeof a&&Object.assign(o,a),this.fire("matched:"+e,o)}}}Co(ug,qn);const mg=new RegExp("(^|\\s)(((?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?![-_])(?:[-\\w\\u00a1-\\uffff]{0,63}[^-_]\\.)+(?:[a-z\\u00a1-\\uffff]{2,}))(?::\\d{2,5})?(?:[/?#]\\S*)?)|((www.|(\\S+@))((?![-_])(?:[-\\w\\u00a1-\\uffff]{0,63}[^-_]\\.))+(?:[a-z\\u00a1-\\uffff]{2,})))$","i"),gg=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i;function fg(e){const t=mg.exec(e);return t?t[2]:null}class pg extends Vd{constructor(e,t){super(e),this.type=t}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model,t=e.document,o=Array.from(t.selection.getSelectedBlocks()).filter(t=>wg(t,e.schema)),n=!0===this.value;e.change(e=>{if(n){let t=o[o.length-1].nextSibling,n=Number.POSITIVE_INFINITY,i=[];for(;t&&"listItem"==t.name&&0!==t.getAttribute("listIndent");){const e=t.getAttribute("listIndent");e<n&&(n=e);const o=e-n;i.push({element:t,listIndent:o}),t=t.nextSibling}i=i.reverse();for(const t of i)e.setAttribute("listIndent",t.listIndent,t.element)}if(!n){let e=Number.POSITIVE_INFINITY;for(const t of o)t.is("element","listItem")&&t.getAttribute("listIndent")<e&&(e=t.getAttribute("listIndent"));e=0===e?1:e,bg(o,!0,e),bg(o,!1,e)}for(const t of o.reverse())n&&"listItem"==t.name?e.rename(t,"paragraph"):n||"listItem"==t.name?n||"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",o)})}_getValue(){const e=Pd(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,o=Pd(e.getSelectedBlocks());return!!o&&wg(o,t)}}function bg(e,t,o){const n=t?e[0]:e[e.length-1];if(n.is("element","listItem")){let i=n[t?"previousSibling":"nextSibling"],r=n.getAttribute("listIndent");for(;i&&i.is("element","listItem")&&i.getAttribute("listIndent")>=o;)r>i.getAttribute("listIndent")&&(r=i.getAttribute("listIndent")),i.getAttribute("listIndent")==r&&e[t?"unshift":"push"](i),i=i[t?"previousSibling":"nextSibling"]}}function wg(e,t){return t.checkChild(e.parent,"listItem")&&!t.isObject(e)}class kg extends Vd{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 o=Array.from(t.selection.getSelectedBlocks());e.change(e=>{const t=o[o.length-1];let n=t.nextSibling;for(;n&&"listItem"==n.name&&n.getAttribute("listIndent")>t.getAttribute("listIndent");)o.push(n),n=n.nextSibling;this._indentBy<0&&(o=o.reverse());for(const t of o){const o=t.getAttribute("listIndent")+this._indentBy;o<0?e.rename(t,"paragraph"):e.setAttribute("listIndent",o,t)}this.fire("_executeCleanup",o)})}_checkEnabled(){const e=Pd(this.editor.model.document.selection.getSelectedBlocks());if(!e||!e.is("element","listItem"))return!1;if(this._indentBy>0){const t=e.getAttribute("listIndent"),o=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")==o;n=n.previousSibling}return!1}return!0}}function _g(e,t){const o=t.mapper,n=t.writer,i="numbered"==e.getAttribute("listType")?"ol":"ul",r=function(e){const t=e.createContainerElement("li");return t.getFillerOffset=Pg,t}(n),s=n.createContainerElement(i,null);return n.insert(n.createPositionAt(s,0),r),o.bindElements(e,r),r}function vg(e,t,o,n){const i=t.parent,r=o.mapper,s=o.writer;let a=r.toViewPosition(n.createPositionBefore(e));const l=Cg(e.previousSibling,{sameIndent:!0,smallerIndent:!0,listIndent:e.getAttribute("listIndent")}),c=e.previousSibling;if(l&&l.getAttribute("listIndent")==e.getAttribute("listIndent")){const e=r.toViewElement(l);a=s.breakContainer(s.createPositionAfter(e))}else if(c&&"listItem"==c.name){a=r.toViewPosition(n.createPositionAt(c,"end"));const e=r.findMappedViewAncestor(a),t=Tg(e);a=t?s.createPositionBefore(t):s.createPositionAt(e,"end")}else a=r.toViewPosition(n.createPositionBefore(e));if(a=xg(a),s.insert(a,i),c&&"listItem"==c.name){const e=r.toViewElement(c),o=s.createRange(s.createPositionAt(e,0),a).getWalker({ignoreElementEnd:!0});for(const e of o)if(e.item.is("element","li")){const n=s.breakContainer(s.createPositionBefore(e.item)),i=e.item.parent,r=s.createPositionAt(t,"end");yg(s,r.nodeBefore,r.nodeAfter),s.move(s.createRangeOn(i),r),o.position=n}}else{const o=i.nextSibling;if(o&&(o.is("element","ul")||o.is("element","ol"))){let n=null;for(const t of o.getChildren()){const o=r.toModelElement(t);if(!(o&&o.getAttribute("listIndent")>e.getAttribute("listIndent")))break;n=t}n&&(s.breakContainer(s.createPositionAfter(n)),s.move(s.createRangeOn(n.parent),s.createPositionAt(t,"end")))}}yg(s,i,i.nextSibling),yg(s,i.previousSibling,i)}function yg(e,t,o){return!t||!o||"ul"!=t.name&&"ol"!=t.name||t.name!=o.name||t.getAttribute("class")!==o.getAttribute("class")?null:e.mergeContainers(e.createPositionAfter(t))}function xg(e){return e.getLastMatchingPosition(e=>e.item.is("uiElement"))}function Cg(e,t){const o=!!t.sameIndent,n=!!t.smallerIndent,i=t.listIndent;let r=e;for(;r&&"listItem"==r.name;){const e=r.getAttribute("listIndent");if(o&&i==e||n&&i>e)return r;r=r.previousSibling}return null}function Ag(e,t,o,n){e.ui.componentFactory.add(t,i=>{const r=e.commands.get(t),s=new Cc(i);return s.set({label:o,icon:n,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.on("execute",()=>{e.execute(t),e.editing.view.focus()}),s})}function Tg(e){for(const t of e.getChildren())if("ul"==t.name||"ol"==t.name)return t;return null}function Pg(){const e=!this.isEmpty&&("ul"==this.getChild(0).name||"ol"==this.getChild(0).name);return this.isEmpty||e?0:Fn.call(this)}function Sg(e){return(t,o,n)=>{const i=n.consumable;if(!i.test(o.item,"insert")||!i.test(o.item,"attribute:listType")||!i.test(o.item,"attribute:listIndent"))return;i.consume(o.item,"insert"),i.consume(o.item,"attribute:listType"),i.consume(o.item,"attribute:listIndent");const r=o.item;vg(r,_g(r,n),n,e)}}function Eg(e,t,o){if(!o.consumable.consume(t.item,"attribute:listType"))return;const n=o.mapper.toViewElement(t.item),i=o.writer;i.breakContainer(i.createPositionBefore(n)),i.breakContainer(i.createPositionAfter(n));const r=n.parent,s="numbered"==t.attributeNewValue?"ol":"ul";i.rename(s,r)}function Rg(e,t,o){const n=o.mapper.toViewElement(t.item).parent,i=o.writer;yg(i,n,n.nextSibling),yg(i,n.previousSibling,n);for(const e of t.item.getChildren())o.consumable.consume(e,"insert")}function Ig(e,t,o){if("listItem"!=t.item.name){let e=o.mapper.toViewPosition(t.range.start);const n=o.writer,i=[];for(;("ul"==e.parent.name||"ol"==e.parent.name)&&(e=n.breakContainer(e),"li"==e.parent.name);){const t=e,o=n.createPositionAt(e.parent,"end");if(!t.isEqual(o)){const e=n.remove(n.createRange(t,o));i.push(e)}e=n.createPositionAfter(e.parent)}if(i.length>0){for(let t=0;t<i.length;t++){const o=e.nodeBefore;if(e=n.insert(e,i[t]).end,t>0){const t=yg(n,o,o.nextSibling);t&&t.parent==o&&e.offset--}}yg(n,e.nodeBefore,e.nodeAfter)}}}function Vg(e,t,o){const n=o.mapper.toViewPosition(t.position),i=n.nodeBefore,r=n.nodeAfter;yg(o.writer,i,r)}function Og(e,t,o){if(o.consumable.consume(t.viewItem,{name:!0})){const e=o.writer,n=e.createElement("listItem"),i=function(e){let t=0,o=e.parent;for(;o;){if(o.is("element","li"))t++;else{const e=o.previousSibling;e&&e.is("element","li")&&t++}o=o.parent}return t}(t.viewItem);e.setAttribute("listIndent",i,n);const r=t.viewItem.parent&&"ol"==t.viewItem.parent.name?"numbered":"bulleted";if(e.setAttribute("listType",r,n),!o.safeInsert(n,t.modelCursor))return;const s=function(e,t,o){const{writer:n,schema:i}=o;let r=n.createPositionAfter(e);for(const s of t)if("ul"==s.name||"ol"==s.name)r=o.convertItem(s,r).modelCursor;else{const t=o.convertItem(s,n.createPositionAt(e,"end")),a=t.modelRange.start.nodeAfter;a&&a.is("element")&&!i.checkChild(e,a.name)&&(e=t.modelCursor.parent.is("element","listItem")?t.modelCursor.parent:Fg(t.modelCursor),r=n.createPositionAfter(e))}return r}(n,t.viewItem.getChildren(),o);t.modelRange=e.createRange(t.modelCursor,s),o.updateConversionResult(n,t)}}function Mg(e,t,o){if(o.consumable.test(t.viewItem,{name:!0})){const e=Array.from(t.viewItem.getChildren());for(const t of e){!(t.is("element","li")||Lg(t))&&t._remove()}}}function Ng(e,t,o){if(o.consumable.test(t.viewItem,{name:!0})){if(0===t.viewItem.childCount)return;const e=[...t.viewItem.getChildren()];let o=!1,n=!0;for(const t of e)o&&!Lg(t)&&t._remove(),t.is("$text")?(n&&(t._data=t.data.replace(/^\s+/,"")),t.nextSibling&&!Lg(t.nextSibling)||(t._data=t.data.replace(/\s+$/,""))):Lg(t)&&(o=!0),n=!1}}function zg(e){return(t,o)=>{if(o.isPhantom)return;const n=o.modelPosition.nodeBefore;if(n&&n.is("element","listItem")){const t=o.mapper.toViewElement(n),i=t.getAncestors().find(Lg),r=e.createPositionAt(t,0).getWalker();for(const e of r){if("elementStart"==e.type&&e.item.is("element","li")){o.viewPosition=e.previousPosition;break}if("elementEnd"==e.type&&e.item==i){o.viewPosition=e.nextPosition;break}}}}}function Bg(e,[t,o]){let n,i=t.is("documentFragment")?t.getChild(0):t;if(n=o?this.createSelection(o):this.document.selection,i&&i.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(;i&&i.is("element","listItem");)i._setAttribute("listIndent",i.getAttribute("listIndent")+e),i=i.nextSibling}}}function Fg(e){const t=new xs({startPosition:e});let o;do{o=t.next()}while(!o.value.item.is("element","listItem"));return o.value.item}function Dg(e,t,o,n,i,r){const s=Cg(t.nodeBefore,{sameIndent:!0,smallerIndent:!0,listIndent:e,foo:"b"}),a=i.mapper,l=i.writer,c=s?s.getAttribute("listIndent"):null;let d;if(s)if(c==e){const e=a.toViewElement(s).parent;d=l.createPositionAfter(e)}else{const e=r.createPositionAt(s,"end");d=a.toViewPosition(e)}else d=o;d=xg(d);for(const e of[...n.getChildren()])Lg(e)&&(d=l.move(l.createRangeOn(e),d).end,yg(l,e,e.nextSibling),yg(l,e.previousSibling,e))}function Lg(e){return e.is("element","ol")||e.is("element","ul")}class Hg extends jl{static get pluginName(){return"ListEditing"}static get requires(){return[mh]}init(){const e=this.editor;e.model.schema.register("listItem",{inheritAllFrom:"$block",allowAttributes:["listType","listIndent"]});const t=e.data,o=e.editing;var n;e.model.document.registerPostFixer(t=>function(e,t){const o=e.document.differ.getChanges(),n=new Map;let i=!1;for(const n of o)if("insert"==n.type&&"listItem"==n.name)r(n.position);else if("insert"==n.type&&"listItem"!=n.name){if("$text"!=n.name){const o=n.position.nodeAfter;o.hasAttribute("listIndent")&&(t.removeAttribute("listIndent",o),i=!0),o.hasAttribute("listType")&&(t.removeAttribute("listType",o),i=!0),o.hasAttribute("listStyle")&&(t.removeAttribute("listStyle",o),i=!0);for(const t of Array.from(e.createRangeIn(o)).filter(e=>e.item.is("element","listItem")))r(t.previousPosition)}r(n.position.getShiftedBy(n.length))}else"remove"==n.type&&"listItem"==n.name?r(n.position):("attribute"==n.type&&"listIndent"==n.attributeKey||"attribute"==n.type&&"listType"==n.attributeKey)&&r(n.range.start);for(const e of n.values())s(e),a(e);return i;function r(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 s(e){let o=0,n=null;for(;e&&e.is("element","listItem");){const r=e.getAttribute("listIndent");if(r>o){let s;null===n?(n=r-o,s=o):(n>r&&(n=r),s=r-n),t.setAttribute("listIndent",s,e),i=!0}else n=null,o=e.getAttribute("listIndent")+1;e=e.nextSibling}}function a(e){let o=[],n=null;for(;e&&e.is("element","listItem");){const r=e.getAttribute("listIndent");if(n&&n.getAttribute("listIndent")>r&&(o=o.slice(0,r+1)),0!=r)if(o[r]){const n=o[r];e.getAttribute("listType")!=n&&(t.setAttribute("listType",n,e),i=!0)}else o[r]=e.getAttribute("listType");n=e,e=e.nextSibling}}}(e.model,t)),o.mapper.registerViewToModelLength("li",jg),t.mapper.registerViewToModelLength("li",jg),o.mapper.on("modelToViewPosition",zg(o.view)),o.mapper.on("viewToModelPosition",(n=e.model,(e,t)=>{const o=t.viewPosition,i=o.parent,r=t.mapper;if("ul"==i.name||"ol"==i.name){if(o.isAtEnd){const e=r.toModelElement(o.nodeBefore),i=r.getModelLength(o.nodeBefore);t.modelPosition=n.createPositionBefore(e).getShiftedBy(i)}else{const e=r.toModelElement(o.nodeAfter);t.modelPosition=n.createPositionBefore(e)}e.stop()}else if("li"==i.name&&o.nodeBefore&&("ul"==o.nodeBefore.name||"ol"==o.nodeBefore.name)){const s=r.toModelElement(i);let a=1,l=o.nodeBefore;for(;l&&Lg(l);)a+=r.getModelLength(l),l=l.previousSibling;t.modelPosition=n.createPositionBefore(s).getShiftedBy(a),e.stop()}})),t.mapper.on("modelToViewPosition",zg(o.view)),e.conversion.for("editingDowncast").add(t=>{t.on("insert",Ig,{priority:"high"}),t.on("insert:listItem",Sg(e.model)),t.on("attribute:listType:listItem",Eg,{priority:"high"}),t.on("attribute:listType:listItem",Rg,{priority:"low"}),t.on("attribute:listIndent:listItem",function(e){return(t,o,n)=>{if(!n.consumable.consume(o.item,"attribute:listIndent"))return;const i=n.mapper.toViewElement(o.item),r=n.writer;r.breakContainer(r.createPositionBefore(i)),r.breakContainer(r.createPositionAfter(i));const s=i.parent,a=s.previousSibling,l=r.createRangeOn(s);r.remove(l),a&&a.nextSibling&&yg(r,a,a.nextSibling),Dg(o.attributeOldValue+1,o.range.start,l.start,i,n,e),vg(o.item,i,n,e);for(const e of o.item.getChildren())n.consumable.consume(e,"insert")}}(e.model)),t.on("remove:listItem",function(e){return(t,o,n)=>{const i=n.mapper.toViewPosition(o.position).getLastMatchingPosition(e=>!e.item.is("element","li")).nodeAfter,r=n.writer;r.breakContainer(r.createPositionBefore(i)),r.breakContainer(r.createPositionAfter(i));const s=i.parent,a=s.previousSibling,l=r.createRangeOn(s),c=r.remove(l);a&&a.nextSibling&&yg(r,a,a.nextSibling);Dg(n.mapper.toModelElement(i).getAttribute("listIndent")+1,o.position,l.start,i,n,e);for(const e of r.createRangeIn(c).getItems())n.mapper.unbindViewElement(e);t.stop()}}(e.model)),t.on("remove",Vg,{priority:"low"})}),e.conversion.for("dataDowncast").add(t=>{t.on("insert",Ig,{priority:"high"}),t.on("insert:listItem",Sg(e.model))}),e.conversion.for("upcast").add(e=>{e.on("element:ul",Mg,{priority:"high"}),e.on("element:ol",Mg,{priority:"high"}),e.on("element:li",Ng,{priority:"high"}),e.on("element:li",Og)}),e.model.on("insertContent",Bg,{priority:"high"}),e.commands.add("numberedList",new pg(e,"numbered")),e.commands.add("bulletedList",new pg(e,"bulleted")),e.commands.add("indentList",new kg(e,"forward")),e.commands.add("outdentList",new kg(e,"backward"));const i=o.view.document;this.listenTo(i,"enter",(e,t)=>{const o=this.editor.model.document,n=o.selection.getLastPosition().parent;o.selection.isCollapsed&&"listItem"==n.name&&n.isEmpty&&(this.editor.execute("outdentList"),t.preventDefault(),e.stop())}),this.listenTo(i,"delete",(e,t)=>{if("backward"!==t.direction)return;const o=this.editor.model.document.selection;if(!o.isCollapsed)return;const n=o.getFirstPosition();if(!n.isAtStart)return;const i=n.parent;if("listItem"!==i.name)return;i.previousSibling&&"listItem"===i.previousSibling.name||(this.editor.execute("outdentList"),t.preventDefault(),e.stop())},{priority:"high"});const r=e=>(t,o)=>{this.editor.commands.get(e).isEnabled&&(this.editor.execute(e),o())};e.keystrokes.set("Tab",r("indentList")),e.keystrokes.set("Shift+Tab",r("outdentList"))}afterInit(){const e=this.editor.commands,t=e.get("indent"),o=e.get("outdent");t&&t.registerChildCommand(e.get("indentList")),o&&o.registerChildCommand(e.get("outdentList"))}}function jg(e){let t=1;for(const o of e.getChildren())if("ul"==o.name||"ol"==o.name)for(const e of o.getChildren())t+=jg(e);return t}class Wg extends jl{init(){const e=this.editor.t;Ag(this.editor,"numberedList",e("Numbered List"),'<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>'),Ag(this.editor,"bulletedList",e("Bulleted List"),'<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>')}}class qg extends Vd{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("todoListChecked")),this.isEnabled=!!this._selectedElements.length}_getSelectedItems(){const e=this.editor.model,t=e.schema,o=e.document.selection.getFirstRange(),n=o.start.parent,i=[];t.checkAttribute(n,"todoListChecked")&&i.push(n);for(const e of o.getItems())t.checkAttribute(e,"todoListChecked")&&!i.includes(e)&&i.push(e);return i}execute(e={}){this.editor.model.change(t=>{for(const o of this._selectedElements){(void 0===e.forceValue?!this.value:e.forceValue)?t.setAttribute("todoListChecked",!0,o):t.removeAttribute("todoListChecked",o)}})}}function $g(e,t,o){const n=t.modelCursor,i=n.parent,r=t.viewItem;if("checkbox"!=r.getAttribute("type")||"listItem"!=i.name||!n.isAtStart)return;if(!o.consumable.consume(r,{name:!0}))return;const s=o.writer;s.setAttribute("listType","todo",i),t.viewItem.hasAttribute("checked")&&s.setAttribute("todoListChecked",!0,i),t.modelRange=s.createRange(n)}function Ug(e){return(t,o)=>{const n=o.modelPosition,i=n.parent;if(!i.is("element","listItem")||"todo"!=i.getAttribute("listType"))return;const r=Kg(o.mapper.toViewElement(i),e);r&&(o.viewPosition=o.mapper.findPositionIn(r,n.offset))}}function Gg(e,t,o,n){return t.createUIElement("label",{class:"todo-list__label",contenteditable:!1},(function(t){const i=dd(document,"input",{type:"checkbox"});o&&i.setAttribute("checked","checked"),i.addEventListener("change",()=>n(e));const r=this.toDomElement(t);return r.appendChild(i),r}))}function Kg(e,t){const o=t.createRangeIn(e);for(const e of o)if(e.item.is("containerElement","span")&&e.item.hasClass("todo-list__label__description"))return e.item}class Jg extends jl{static get pluginName(){return"TodoListEditing"}static get requires(){return[Hg]}init(){const e=this.editor,{editing:t,data:o,model:n}=e;var i,r;n.schema.extend("listItem",{allowAttributes:["todoListChecked"]}),n.schema.addAttributeCheck((e,t)=>{const o=e.last;if("todoListChecked"==t&&"listItem"==o.name&&"todo"!=o.getAttribute("listType"))return!1}),e.commands.add("todoList",new pg(e,"todo")),e.commands.add("todoListCheck",new qg(e)),o.downcastDispatcher.on("insert:listItem",function(e){return(t,o,n)=>{const i=n.consumable;if(!i.test(o.item,"insert")||!i.test(o.item,"attribute:listType")||!i.test(o.item,"attribute:listIndent"))return;if("todo"!=o.item.getAttribute("listType"))return;const r=o.item;i.consume(r,"insert"),i.consume(r,"attribute:listType"),i.consume(r,"attribute:listIndent"),i.consume(r,"attribute:todoListChecked");const s=n.writer,a=_g(r,n);s.addClass("todo-list",a.parent);const l=s.createContainerElement("label",{class:"todo-list__label"}),c=s.createEmptyElement("input",{type:"checkbox",disabled:"disabled"}),d=s.createContainerElement("span",{class:"todo-list__label__description"});r.getAttribute("todoListChecked")&&s.setAttribute("checked","checked",c),s.insert(s.createPositionAt(a,0),l),s.insert(s.createPositionAt(l,0),c),s.insert(s.createPositionAfter(c),d),vg(r,a,n,e)}}(n),{priority:"high"}),o.upcastDispatcher.on("element:input",$g,{priority:"high"}),t.downcastDispatcher.on("insert:listItem",function(e,t){return(o,n,i)=>{const r=i.consumable;if(!r.test(n.item,"insert")||!r.test(n.item,"attribute:listType")||!r.test(n.item,"attribute:listIndent"))return;if("todo"!=n.item.getAttribute("listType"))return;const s=n.item;r.consume(s,"insert"),r.consume(s,"attribute:listType"),r.consume(s,"attribute:listIndent"),r.consume(s,"attribute:todoListChecked");const a=i.writer,l=_g(s,i),c=!!s.getAttribute("todoListChecked"),d=Gg(s,a,c,t),h=a.createContainerElement("span",{class:"todo-list__label__description"});a.addClass("todo-list",l.parent),a.insert(a.createPositionAt(l,0),d),a.insert(a.createPositionAfter(d),h),vg(s,l,i,e)}}(n,e=>this._handleCheckmarkChange(e)),{priority:"high"}),t.downcastDispatcher.on("attribute:listType:listItem",(i=e=>this._handleCheckmarkChange(e),r=t.view,(e,t,o)=>{const n=o.mapper.toViewElement(t.item),s=o.writer,a=function(e,t){const o=t.createRangeIn(e);for(const e of o)if(e.item.is("uiElement","label"))return e.item}(n,r);if("todo"==t.attributeNewValue){const e=!!t.item.getAttribute("todoListChecked"),o=Gg(t.item,s,e,i),r=s.createContainerElement("span",{class:"todo-list__label__description"}),a=s.createRangeIn(n),l=Tg(n),c=xg(a.start),d=l?s.createPositionBefore(l):a.end,h=s.createRange(c,d);s.addClass("todo-list",n.parent),s.move(h,s.createPositionAt(r,0)),s.insert(s.createPositionAt(n,0),o),s.insert(s.createPositionAfter(o),r)}else if("todo"==t.attributeOldValue){const e=Kg(n,r);s.removeClass("todo-list",n.parent),s.remove(a),s.move(s.createRangeIn(e),s.createPositionBefore(e)),s.remove(e)}})),t.downcastDispatcher.on("attribute:todoListChecked:listItem",function(e){return(t,o,n)=>{if("todo"!=o.item.getAttribute("listType"))return;if(!n.consumable.consume(o.item,"attribute:todoListChecked"))return;const{mapper:i,writer:r}=n,s=!!o.item.getAttribute("todoListChecked"),a=i.toViewElement(o.item).getChild(0),l=Gg(o.item,r,s,e);r.insert(r.createPositionAfter(a),l),r.remove(a)}}(e=>this._handleCheckmarkChange(e))),t.mapper.on("modelToViewPosition",Ug(t.view)),o.mapper.on("modelToViewPosition",Ug(t.view)),this.listenTo(t.view.document,"keydown",function(e,t){return(o,n)=>{if("left"!=vi(n.keyCode,t.contentLanguageDirection))return;const i=e.schema,r=e.document.selection;if(!r.isCollapsed)return;const s=r.getFirstPosition(),a=s.parent;if("listItem"===a.name&&"todo"==a.getAttribute("listType")&&s.isAtStart){const t=i.getNearestSelectionRange(e.createPositionBefore(a),"backward");t&&e.change(e=>e.setSelection(t)),n.preventDefault(),n.stopPropagation(),o.stop()}}}(n,e.locale)),e.keystrokes.set("Ctrl+space",()=>e.execute("todoListCheck"));const s=new Set;this.listenTo(n,"applyOperation",(e,t)=>{const o=t[0];if("rename"==o.type&&"listItem"==o.oldName){const e=o.position.nodeAfter;e.hasAttribute("todoListChecked")&&s.add(e)}else if("changeAttribute"==o.type&&"listType"==o.key&&"todo"===o.oldValue)for(const e of o.range.getItems())e.hasAttribute("todoListChecked")&&"todo"!==e.getAttribute("listType")&&s.add(e)}),n.document.registerPostFixer(e=>{let t=!1;for(const o of s)e.removeAttribute("todoListChecked",o),t=!0;return s.clear(),t})}_handleCheckmarkChange(e){const t=this.editor,o=t.model,n=Array.from(o.document.selection.getRanges());o.change(o=>{o.setSelection(e,"end"),t.execute("todoListCheck"),o.setSelection(n)})}}class Yg extends jl{init(){const e=this.editor.t;Ag(this.editor,"todoList",e("To-do List"),'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2.315 14.705l2.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>')}}o(90);function Qg(e,t){if(!e.childCount)return;const o=new nm(e.document),n=function(e,t){const o=t.createRangeIn(e),n=new Fo({name:/^p|h\d+$/,styles:{"mso-list":/.*/}}),i=[];for(const e of o)if("elementStart"===e.type&&n.match(e.item)){const t=Zg(e.item);i.push({element:e.item,id:t.id,order:t.order,indent:t.indent})}return i}(e,o);if(!n.length)return;let i=null,r=1;n.forEach((e,s)=>{const a=function(e,t){if(!e)return!0;if(e.id!==t.id)return!0;const o=t.element.previousSibling;if(!o)return!0;return n=o,!(n.is("element","ol")||n.is("element","ul"));var n}(n[s-1],e),l=a?null:n[s-1],c=(h=e,(d=l)?h.indent-d.indent:h.indent-1);var d,h;if(a&&(i=null,r=1),!i||0!==c){const n=function(e,t){const o=new RegExp(`@list l${e.id}:level${e.indent}\\s*({[^}]*)`,"gi"),n=/mso-level-number-format:([^;]*);/gi,i=o.exec(t);let r="decimal";if(i&&i[1]){const e=n.exec(i[1]);e&&e[1]&&(r=e[1].trim())}return{type:"bullet"!==r&&"image"!==r?"ol":"ul",style:r}}(e,t);if(i){if(e.indent>r){const e=i.getChild(i.childCount-1),t=e.getChild(e.childCount-1);i=Xg(n,t,o),r+=1}else if(e.indent<r){const t=r-e.indent;i=function(e,t){const o=e.getAncestors({parentFirst:!0});let n=null,i=0;for(const e of o)if("ul"!==e.name&&"ol"!==e.name||i++,i===t){n=e;break}return n}(i,t),r=parseInt(e.indent)}}else i=Xg(n,e.element,o);e.indent<=r&&(i.is("element",n.type)||(i=o.rename(n.type,i)))}const u=function(e,t){return function(e,t){const o=new Fo({name:"span",styles:{"mso-list":"Ignore"}}),n=t.createRangeIn(e);for(const e of n)"elementStart"===e.type&&o.match(e.item)&&t.remove(e.item)}(e,t),t.rename("li",e)}(e.element,o);o.appendChild(u,i)})}function Xg(e,t,o){const n=t.parent,i=o.createElement(e.type),r=n.getChildIndex(t)+1;return o.insertChild(r,i,n),i}function Zg(e){const t={},o=e.getStyle("mso-list");if(o){const e=o.match(/(^|\s+)l(\d+)/i),n=o.match(/\s*lfo(\d+)/i),i=o.match(/\s*level(\d+)/i);e&&n&&i&&(t.id=e[2],t.order=n[1],t.indent=i[1])}return t}const ef=/id=("|')docs-internal-guid-[-0-9a-f]+("|')/i;class tf{constructor(e){this.document=e}isActive(e){return ef.test(e)}execute(e){const t=new nm(this.document);!function(e,t){for(const o of e.getChildren())if(o.is("element","b")&&"normal"===o.getStyle("font-weight")){const n=e.getChildIndex(o);t.remove(o),t.insertChild(n,o.getChildren(),e)}}(e.content,t),function(e,t){for(const o of t.createRangeIn(e)){const e=o.item;if(e.is("element","li")){const o=e.getChild(0);o.is("element","p")&&t.unwrapElement(o)}}}(e.content,t)}}function of(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 nf(e,t){const o=new DOMParser,n=function(e){return of(of(e)).replace(/(<span\s+style=['"]mso-spacerun:yes['"]>[\s]*?)[\r\n]+(\s*<\/span>)/g,"$1$2").replace(/<span\s+style=['"]mso-spacerun:yes['"]><\/span>/g,"").replace(/ <\//g," </").replace(/ <o:p><\/o:p>/g," <o:p></o:p>").replace(/<o:p>(&nbsp;|\u00A0)<\/o:p>/g,"").replace(/>(\s*[\r\n]\s*)</g,"><")}(function(e){const t=e.match(/<\/body>(.*?)(<\/html>|$)/);t&&t[1]&&(e=e.slice(0,t.index)+e.slice(t.index).replace(t[1],""));return e}(e=e.replace(/<!--\[if gte vml 1]>/g,""))),i=o.parseFromString(n,"text/html");!function(e){e.querySelectorAll("span[style*=spacerun]").forEach(e=>{const t=e.innerText.length||0;e.innerHTML=Array(t+1).join("  ").substr(0,t)})}(i);const r=i.body.innerHTML,s=function(e,t){const o=new si(t),n=new cr(o,{blockFillerMode:"nbsp"}),i=e.createDocumentFragment(),r=e.body.childNodes;for(;r.length>0;)i.appendChild(r[0]);return n.domToView(i)}(i,t),a=function(e){const t=[],o=[],n=Array.from(e.getElementsByTagName("style"));for(const e of n)e.sheet&&e.sheet.cssRules&&e.sheet.cssRules.length&&(t.push(e.sheet),o.push(e.innerHTML));return{styles:t,stylesString:o.join(" ")}}(i);return{body:s,bodyString:r,styles:a.styles,stylesString:a.stylesString}}function rf(e,t){if(!e.childCount)return;const o=new nm;!function(e,t,o){const n=o.createRangeIn(t),i=new Fo({name:"img"}),r=[];for(const t of n)if(i.match(t.item)){const o=t.item,n=o.getAttribute("v:shapes")?o.getAttribute("v:shapes").split(" "):[];n.length&&n.every(t=>e.indexOf(t)>-1)?r.push(o):o.getAttribute("src")||r.push(o)}for(const e of r)o.remove(e)}(function(e,t){const o=t.createRangeIn(e),n=new Fo({name:/v:(.+)/}),i=[];for(const e of o){const t=e.item,o=t.previousSibling&&t.previousSibling.name||null;n.match(t)&&t.getAttribute("o:gfxdata")&&"v:shapetype"!==o&&i.push(e.item.getAttribute("id"))}return i}(e,o),e,o),function(e,t){const o=t.createRangeIn(e),n=new Fo({name:/v:(.+)/}),i=[];for(const e of o)n.match(e.item)&&i.push(e.item);for(const e of i)t.remove(e)}(e,o);const n=function(e,t){const o=t.createRangeIn(e),n=new Fo({name:"img"}),i=[];for(const e of o)n.match(e.item)&&e.item.getAttribute("src").startsWith("file://")&&i.push(e.item);return i}(e,o);n.length&&function(e,t,o){if(e.length===t.length)for(let i=0;i<e.length;i++){const r=`data:${t[i].type};base64,${n=t[i].hex,btoa(n.match(/\w{2}/g).map(e=>String.fromCharCode(parseInt(e,16))).join(""))}`;o.setAttribute("src",r,e[i])}var n}(n,function(e){if(!e)return[];const t=/{\\pict[\s\S]+?\\bliptag-?\d+(\\blipupi-?\d+)?({\\\*\\blipuid\s?[\da-fA-F]+)?[\s}]*?/,o=new RegExp("(?:("+t.source+"))([\\da-fA-F\\s]+)\\}","g"),n=e.match(o),i=[];if(n)for(const e of n){let o=!1;e.includes("\\pngblip")?o="image/png":e.includes("\\jpegblip")&&(o="image/jpeg"),o&&i.push({hex:e.replace(t,"").replace(/[^\da-fA-F]/g,""),type:o})}return i}(t),o)}const sf=/<meta\s*name="?generator"?\s*content="?microsoft\s*word\s*\d+"?\/?>/i,af=/xmlns:o="urn:schemas-microsoft-com/i;class lf{constructor(e){this.document=e}isActive(e){return sf.test(e)||af.test(e)}execute(e){const{body:t,stylesString:o}=nf(e.dataTransfer.getData("text/html"),this.document.stylesProcessor);Qg(t,o),rf(t,e.dataTransfer.getData("text/rtf")),e.content=t}}function cf(e,t,o,n,i=1){t>i?n.setAttribute(e,t,o):n.removeAttribute(e,o)}function df(e,t,o={}){const n=e.createElement("tableCell",o);return e.insertElement("paragraph",n),e.insert(n,t),n}function hf(e,t){const o=t.parent.parent,n=parseInt(o.getAttribute("headingColumns")||0),{column:i}=e.getCellLocation(t);return!!n&&i<n}function uf(){return e=>{e.on("element:table",(e,t,o)=>{const n=t.viewItem;if(!o.consumable.test(n,{name:!0}))return;const{rows:i,headingRows:r,headingColumns:s}=function(e){const t={headingRows:0,headingColumns:0},o=[],n=[];let i;for(const r of Array.from(e.getChildren()))if("tbody"===r.name||"thead"===r.name||"tfoot"===r.name){"thead"!==r.name||i||(i=r);const e=Array.from(r.getChildren()).filter(e=>e.is("element","tr"));for(const r of e)if("thead"===r.parent.name&&r.parent===i)t.headingRows++,o.push(r);else{n.push(r);const e=gf(r);e>t.headingColumns&&(t.headingColumns=e)}}return t.rows=[...o,...n],t}(n),a={};s&&(a.headingColumns=s),r&&(a.headingRows=r);const l=o.writer.createElement("table",a);if(o.safeInsert(l,t.modelCursor)){if(o.consumable.consume(n,{name:!0}),i.forEach(e=>o.convertItem(e,o.writer.createPositionAt(l,"end"))),l.isEmpty){const e=o.writer.createElement("tableRow");o.writer.insert(e,o.writer.createPositionAt(l,"end")),df(o.writer,o.writer.createPositionAt(e,"end"))}o.updateConversionResult(l,t)}})}}function mf(e){return t=>{t.on("element:"+e,(e,t,o)=>{if(!t.modelRange)return;const n=t.modelRange.start.nodeAfter;if(!n.childCount){const e=o.writer.createPositionAt(n,0);o.writer.insertElement("paragraph",e)}},{priority:"low"})}}function gf(e){let t=0,o=0;const n=Array.from(e.getChildren()).filter(e=>"th"===e.name||"td"===e.name);for(;o<n.length&&"th"===n[o].name;){const e=n[o];t+=parseInt(e.getAttribute("colspan")||1),o++}return t}class ff{constructor(e,t={}){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._column=0,this._cellIndex=0,this._spannedCells=new Map,this._nextCellAtColumn=-1}[Symbol.iterator](){return this}next(){const e=this._table.getChild(this._row);if(!e||this._isOverEndRow())return{done:!0};if(this._isOverEndColumn())return this._advanceToNextRow();let t=null;const o=this._getSpanned();if(o)this._includeAllSlots&&!this._shouldSkipSlot()&&(t=this._formatOutValue(o.cell,o.row,o.column));else{const o=e.getChild(this._cellIndex);if(!o)return this._advanceToNextRow();const n=parseInt(o.getAttribute("colspan")||1),i=parseInt(o.getAttribute("rowspan")||1);(n>1||i>1)&&this._recordSpans(o,i,n),this._shouldSkipSlot()||(t=this._formatOutValue(o)),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._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,o=this._column){return{done:!1,value:new pf(this,e,t,o)}}_shouldSkipSlot(){const e=this._skipRows.has(this._row),t=this._row<this._startRow,o=this._column<this._startColumn,n=void 0!==this._endColumn&&this._column>this._endColumn;return e||t||o||n}_getSpanned(){const e=this._spannedCells.get(this._row);return e&&e.get(this._column)||null}_recordSpans(e,t,o){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+o;t++)e==this._row&&t==this._column||this._markSpannedCell(e,t,n)}_markSpannedCell(e,t,o){this._spannedCells.has(e)||this._spannedCells.set(e,new Map);this._spannedCells.get(e).set(t,o)}}class pf{constructor(e,t,o,n){this.cell=t,this.row=e._row,this.column=e._column,this.cellAnchorRow=o,this.cellAnchorColumn=n,this._cellIndex=e._cellIndex,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)}getPositionBefore(){return this._table.root.document.model.createPositionAt(this._table.getChild(this.row),this._cellIndex)}}function bf(e={}){return t=>t.on("insert:table",(t,o,n)=>{const i=o.item;if(!n.consumable.consume(i,"insert"))return;n.consumable.consume(i,"attribute:headingRows:table"),n.consumable.consume(i,"attribute:headingColumns:table");const r=e&&e.asWidget,s=n.writer.createContainerElement("figure",{class:"table"}),a=n.writer.createContainerElement("table");let l;var c,d;n.writer.insert(n.writer.createPositionAt(s,0),a),r&&(c=s,(d=n.writer).setCustomProperty("table",!0,c),l=Sh(c,d,{hasSelectionHandle:!0}));const h=new ff(i),u={headingRows:i.getAttribute("headingRows")||0,headingColumns:i.getAttribute("headingColumns")||0},m=new Map;for(const t of h){const{row:o,cell:r}=t,s=i.getChild(o),l=m.get(o)||_f(a,s,o,u,n);m.set(o,l),n.consumable.consume(r,"insert");kf(t,u,n.writer.createPositionAt(l,"end"),n,e)}for(const e of i.getChildren()){const t=e.index;m.has(t)||m.set(t,_f(a,e,t,u,n))}const g=n.mapper.toViewPosition(o.range.start);n.mapper.bindElements(i,r?l:s),n.writer.insert(g,r?l:s)})}function wf(e,t,o){const{cell:n}=e,i=vf(e,t),r=o.mapper.toViewElement(n);r&&r.name!==i&&function(e,t,o){const n=o.writer,i=o.mapper.toViewElement(e),r=Ih(n.createEditableElement(t,i.getAttributes()),n);Eh(r,n,(e,t,o)=>o.addClass(Cf(t.classes),e),(e,t,o)=>o.removeClass(Cf(t.classes),e)),n.insert(n.createPositionAfter(i),r),n.move(n.createRangeIn(i),n.createPositionAt(r,0)),n.remove(n.createRangeOn(i)),o.mapper.unbindViewElement(i),o.mapper.bindElements(e,r)}(n,i,o)}function kf(e,t,o,n,i){const r=i&&i.asWidget,s=vf(e,t),a=r?Ih(n.writer.createEditableElement(s),n.writer):n.writer.createContainerElement(s);r&&Eh(a,n.writer,(e,t,o)=>o.addClass(Cf(t.classes),e),(e,t,o)=>o.removeClass(Cf(t.classes),e));const l=e.cell,c=l.getChild(0),d=1===l.childCount&&"paragraph"===c.name;if(n.writer.insert(o,a),d&&![...c.getAttributeKeys()].length){const e=l.getChild(0),t=n.writer.createPositionAt(a,"end");if(n.consumable.consume(e,"insert"),r){const o=n.writer.createContainerElement("span",{style:"display:inline-block"});n.mapper.bindElements(e,o),n.writer.insert(t,o),n.mapper.bindElements(l,a)}else n.mapper.bindElements(l,a),n.mapper.bindElements(e,a)}else n.mapper.bindElements(l,a)}function _f(e,t,o,n,i){i.consumable.consume(t,"insert");const r=t.isEmpty?i.writer.createEmptyElement("tr"):i.writer.createContainerElement("tr");i.mapper.bindElements(t,r);const s=n.headingRows,a=function(e,t,o){const n=yf(e,t);return n||function(e,t,o){const n=o.writer.createContainerElement(e),i=o.writer.createPositionAt(t,"tbody"==e?"end":0);return o.writer.insert(i,n),n}(e,t,o)}(function(e,t){return e<t.headingRows?"thead":"tbody"}(o,n),e,i),l=s>0&&o>=s?o-s:o,c=i.writer.createPositionAt(a,l);return i.writer.insert(c,r),r}function vf(e,t){const{row:o,column:n}=e,{headingColumns:i,headingRows:r}=t;if(r&&r>o)return"th";return i&&i>n?"th":"td"}function yf(e,t){for(const o of t.getChildren())if(o.name==e)return o}function xf(e,t,o){const n=yf(e,t);n&&0===n.childCount&&o.writer.remove(o.writer.createRangeOn(n))}function Cf(e){return Array.isArray(e)?e:[e]}class Af extends Vd{refresh(){const e=this.editor.model,t=e.document.selection,o=e.schema,n=function(e){const t=e.parent;return t===t.root?t:t.parent}(t.getFirstPosition());this.isEnabled=o.checkChild(n,"table")}execute(e={}){const t=this.editor.model,o=t.document.selection,n=this.editor.plugins.get("TableUtils"),i=Vh(o,t);t.change(o=>{const r=n.createTable(o,e);t.insertContent(r,i),o.setSelection(o.createPositionAt(r.getNodeByPath([0,0,0]),0))})}}function Tf(e){const t=[];for(const o of Vf(e.getRanges())){const e=o.getContainedElement();e&&e.is("element","tableCell")&&t.push(e)}return t}function Pf(e){const t=[];for(const o of e.getRanges()){const e=o.start.findAncestor("tableCell");e&&t.push(e)}return t}function Sf(e){const t=Tf(e);return t.length?t:Pf(e)}function Ef(e){return Of(e.map(e=>e.parent.index))}function Rf(e){const t=e[0].findAncestor("table");return Of([...new ff(t)].filter(t=>e.includes(t.cell)).map(e=>e.column))}function If(e,t){if(e.length<2||!function(e){const t=e[0].findAncestor("table"),o=Ef(e),n=parseInt(t.getAttribute("headingRows")||0);if(!Nf(o,n))return!1;const i=parseInt(t.getAttribute("headingColumns")||0);return Nf(Rf(e),i)}(e))return!1;const o=new Set,n=new Set;let i=0;for(const r of e){const{row:e,column:s}=t.getCellLocation(r),a=parseInt(r.getAttribute("rowspan")||1),l=parseInt(r.getAttribute("colspan")||1);o.add(e),n.add(s),a>1&&o.add(e+a-1),l>1&&n.add(s+l-1),i+=a*l}return function(e,t){const o=Array.from(e.values()),n=Array.from(t.values()),i=Math.max(...o),r=Math.min(...o),s=Math.max(...n),a=Math.min(...n);return(i-r+1)*(s-a+1)}(o,n)==i}function Vf(e){return Array.from(e).sort(Mf)}function Of(e){const t=e.sort((e,t)=>e-t);return{first:t[0],last:t[t.length-1]}}function Mf(e,t){const o=e.start,n=t.start;return o.isBefore(n)?-1:1}function Nf({first:e,last:t},o){return e<o===t<o}class zf extends Vd{constructor(e,t={}){super(e),this.order=t.order||"below"}refresh(){const e=this.editor.model.document.selection.getFirstPosition().findAncestor("table");this.isEnabled=!!e}execute(){const e=this.editor,t=e.model.document.selection,o=e.plugins.get("TableUtils"),n="above"===this.order,i=Sf(t),r=Ef(i),s=n?r.first:r.last,a=i[0].findAncestor("table");o.insertRows(a,{at:n?s:s+1,copyStructureFromAbove:!n})}}class Bf extends Vd{constructor(e,t={}){super(e),this.order=t.order||"right"}refresh(){const e=this.editor.model.document.selection.getFirstPosition().findAncestor("table");this.isEnabled=!!e}execute(){const e=this.editor,t=e.model.document.selection,o=e.plugins.get("TableUtils"),n="left"===this.order,i=Sf(t),r=Rf(i),s=n?r.first:r.last,a=i[0].findAncestor("table");o.insertColumns(a,{columns:1,at:n?s:s+1})}}class Ff extends Vd{constructor(e,t={}){super(e),this.direction=t.direction||"horizontally"}refresh(){const e=Sf(this.editor.model.document.selection);this.isEnabled=1===e.length}execute(){const e=Sf(this.editor.model.document.selection)[0],t="horizontally"===this.direction,o=this.editor.plugins.get("TableUtils");t?o.splitCellHorizontally(e,2):o.splitCellVertically(e,2)}}function Df(e,t,o){const{startRow:n,startColumn:i,endRow:r,endColumn:s}=t,a=o.createElement("table"),l=r-n+1;for(let e=0;e<l;e++)o.insertElement("tableRow",a,"end");const c=[...new ff(e,{startRow:n,endRow:r,startColumn:i,endColumn:s,includeAllSlots:!0})];for(const{row:e,column:t,cell:l,isAnchor:d,cellAnchorRow:h,cellAnchorColumn:u}of c){const c=e-n,m=a.getChild(c);if(d){const n=o.cloneElement(l);o.append(n,m),qf(n,e,t,r,s,o)}else(h<n||u<i)&&df(o,o.createPositionAt(m,"end"))}return function(e,t,o,n,i){const r=parseInt(t.getAttribute("headingRows")||0);if(r>0){cf("headingRows",r-o,e,i,0)}const s=parseInt(t.getAttribute("headingColumns")||0);if(s>0){cf("headingColumns",s-n,e,i,0)}}(a,e,n,i,o),a}function Lf(e,t,o=0){const n=[],i=new ff(e,{startRow:o,endRow:t-1});for(const e of i){const{row:o,cellHeight:i}=e,r=o+i-1;o<t&&t<=r&&n.push(e)}return n}function Hf(e,t,o){const n=e.parent,i=n.parent,r=n.index,s=t-r,a={},l=parseInt(e.getAttribute("rowspan"))-s;l>1&&(a.rowspan=l);const c=parseInt(e.getAttribute("colspan")||1);c>1&&(a.colspan=c);const d=r+s,h=[...new ff(i,{startRow:r,endRow:d,includeAllSlots:!0})];let u,m=null;for(const t of h){const{row:n,column:i,cell:r}=t;r===e&&void 0===u&&(u=i),void 0!==u&&u===i&&n===d&&(m=df(o,t.getPositionBefore(),a))}return cf("rowspan",s,e,o),m}function jf(e,t){const o=[],n=new ff(e);for(const e of n){const{column:n,cellWidth:i}=e,r=n+i-1;n<t&&t<=r&&o.push(e)}return o}function Wf(e,t,o,n){const i=o-t,r={},s=parseInt(e.getAttribute("colspan"))-i;s>1&&(r.colspan=s);const a=parseInt(e.getAttribute("rowspan")||1);a>1&&(r.rowspan=a);const l=df(n,n.createPositionAfter(e),r);return cf("colspan",i,e,n),l}function qf(e,t,o,n,i,r){const s=parseInt(e.getAttribute("colspan")||1),a=parseInt(e.getAttribute("rowspan")||1);if(o+s-1>i){cf("colspan",i-o+1,e,r,1)}if(t+a-1>n){cf("rowspan",n-t+1,e,r,1)}}function $f(e,t){const o=t.getColumns(e),n=new Array(o).fill(0);for(const{column:t}of new ff(e))n[t]++;const i=n.reduce((e,t,o)=>t?e:[...e,o],[]);if(i.length>0){const o=i[i.length-1];return t.removeColumns(e,{at:o}),!0}return!1}function Uf(e,t){const o=[];for(let t=0;t<e.childCount;t++){e.getChild(t).isEmpty&&o.push(t)}if(o.length>0){const n=o[o.length-1];return t.removeRows(e,{at:n}),!0}return!1}function Gf(e,t){$f(e,t)||Uf(e,t)}function Kf(e,t){const o=Array.from(new ff(e,{startColumn:t.firstColumn,endColumn:t.lastColumn,row:t.lastRow}));if(o.every(({cellHeight:e})=>1===e))return t.lastRow;const n=o[0].cellHeight-1;return t.lastRow+n}function Jf(e,t){const o=Array.from(new ff(e,{startRow:t.firstRow,endRow:t.lastRow,column:t.lastColumn}));if(o.every(({cellWidth:e})=>1===e))return t.lastColumn;const n=o[0].cellWidth-1;return t.lastColumn+n}class Yf extends Vd{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=Pf(e.document.selection)[0],o=this.value,n=this.direction;e.change(e=>{const i="right"==n||"down"==n,r=i?t:o,s=i?o:t,a=s.parent;!function(e,t,o){Qf(e)||(Qf(t)&&o.remove(o.createRangeIn(t)),o.move(o.createRangeIn(e),o.createPositionAt(t,"end")));o.remove(e)}(s,r,e);const l=this.isHorizontal?"colspan":"rowspan",c=parseInt(t.getAttribute(l)||1),d=parseInt(o.getAttribute(l)||1);e.setAttribute(l,c+d,r),e.setSelection(e.createRangeIn(r));const h=this.editor.plugins.get("TableUtils");Gf(a.findAncestor("table"),h)})}_getMergeableCell(){const e=Pf(this.editor.model.document.selection)[0];if(!e)return;const t=this.editor.plugins.get("TableUtils"),o=this.isHorizontal?function(e,t,o){const n=e.parent.parent,i="right"==t?e.nextSibling:e.previousSibling,r=(n.getAttribute("headingColumns")||0)>0;if(!i)return;const s="right"==t?e:i,a="right"==t?i:e,{column:l}=o.getCellLocation(s),{column:c}=o.getCellLocation(a),d=parseInt(s.getAttribute("colspan")||1),h=hf(o,s),u=hf(o,a);if(r&&h!=u)return;return l+d===c?i:void 0}(e,this.direction,t):function(e,t){const o=e.parent,n=o.parent,i=n.getChildIndex(o);if("down"==t&&i===n.childCount-1||"up"==t&&0===i)return;const r=parseInt(e.getAttribute("rowspan")||1),s=n.getAttribute("headingRows")||0,a="down"==t&&i+r===s,l="up"==t&&i===s;if(s&&(a||l))return;const c=parseInt(e.getAttribute("rowspan")||1),d="down"==t?i+c:i,h=[...new ff(n,{endRow:d})],u=h.find(t=>t.cell===e).column,m=h.find(({row:e,cellHeight:o,column:n})=>n===u&&("down"==t?e===d:d===e+o));return m&&m.cell}(e,this.direction);if(!o)return;const n=this.isHorizontal?"rowspan":"colspan",i=parseInt(e.getAttribute(n)||1);return parseInt(o.getAttribute(n)||1)===i?o:void 0}}function Qf(e){return 1==e.childCount&&e.getChild(0).is("element","paragraph")&&e.getChild(0).isEmpty}class Xf extends Vd{refresh(){const e=Sf(this.editor.model.document.selection),t=e[0];if(t){const o=t.findAncestor("table"),n=this.editor.plugins.get("TableUtils").getRows(o)-1,i=Ef(e),r=0===i.first&&i.last===n;this.isEnabled=!r}else this.isEnabled=!1}execute(){const e=this.editor.model,t=Sf(e.document.selection),o=Ef(t),n=t[0],i=n.findAncestor("table"),r=this.editor.plugins.get("TableUtils").getCellLocation(n).column;e.change(e=>{const t=o.last-o.first+1;this.editor.plugins.get("TableUtils").removeRows(i,{at:o.first,rows:t});const n=function(e,t,o){const n=e.getChild(t)||e.getChild(e.childCount-1);let i=n.getChild(0),r=0;for(const e of n.getChildren()){if(r>o)return i;i=e,r+=parseInt(e.getAttribute("colspan")||1)}return i}(i,o.first,r);e.setSelection(e.createPositionAt(n,0))})}}class Zf extends Vd{refresh(){const e=Sf(this.editor.model.document.selection),t=e[0];if(t){const o=t.findAncestor("table"),n=this.editor.plugins.get("TableUtils").getColumns(o),{first:i,last:r}=Rf(e);this.isEnabled=r-i<n-1}else this.isEnabled=!1}execute(){const[e,t]=function(e){const t=Sf(e),o=t[0],n=t.pop(),i=[o,n];return o.isBefore(n)?i:i.reverse()}(this.editor.model.document.selection),o=e.parent.parent,n=[...new ff(o)],i={first:n.find(t=>t.cell===e).column,last:n.find(e=>e.cell===t).column},r=function(e,t,o,n){return parseInt(o.getAttribute("colspan")||1)>1?o:t.previousSibling||o.nextSibling?o.nextSibling||t.previousSibling:n.first?e.reverse().find(({column:e})=>e<n.first).cell:e.reverse().find(({column:e})=>e>n.last).cell}(n,e,t,i);this.editor.model.change(e=>{const t=i.last-i.first+1;this.editor.plugins.get("TableUtils").removeColumns(o,{at:i.first,columns:t}),e.setSelection(e.createPositionAt(r,0))})}}class ep extends Vd{refresh(){const e=Sf(this.editor.model.document.selection),t=e.length>0;this.isEnabled=t,this.value=t&&e.every(e=>this._isInHeading(e,e.parent.parent))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.model,o=Sf(t.document.selection),n=o[0].findAncestor("table"),{first:i,last:r}=Ef(o),s=this.value?i:r+1,a=n.getAttribute("headingRows")||0;t.change(e=>{if(s){const t=Lf(n,s,s>a?a:0);for(const{cell:o}of t)Hf(o,s,e)}cf("headingRows",s,n,e,0)})}_isInHeading(e,t){const o=parseInt(t.getAttribute("headingRows")||0);return!!o&&e.parent.index<o}}class tp extends Vd{refresh(){const e=Sf(this.editor.model.document.selection),t=this.editor.plugins.get("TableUtils"),o=e.length>0;this.isEnabled=o,this.value=o&&e.every(e=>hf(t,e))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.model,o=Sf(t.document.selection),n=o[0].findAncestor("table"),{first:i,last:r}=Rf(o),s=this.value?i:r+1;t.change(e=>{if(s){const t=jf(n,s);for(const{cell:o,column:n}of t)Wf(o,n,s,e)}cf("headingColumns",s,n,e,0)})}}class op extends jl{static get pluginName(){return"TableUtils"}getCellLocation(e){const t=e.parent,o=t.parent,n=o.getChildIndex(t),i=new ff(o,{row:n});for(const{cell:t,row:o,column:n}of i)if(t===e)return{row:o,column:n}}createTable(e,t){const o=e.createElement("table");return np(e,o,0,parseInt(t.rows)||2,parseInt(t.columns)||2),t.headingRows&&cf("headingRows",t.headingRows,o,e,0),t.headingColumns&&cf("headingColumns",t.headingColumns,o,e,0),o}insertRows(e,t={}){const o=this.editor.model,n=t.at||0,i=t.rows||1,r=void 0!==t.copyStructureFromAbove,s=t.copyStructureFromAbove?n-1:n,a=this.getRows(e),l=this.getColumns(e);o.change(t=>{const o=e.getAttribute("headingRows")||0;if(o>n&&cf("headingRows",o+i,e,t,0),!r&&(0===n||n===a))return void np(t,e,n,i,l);const c=r?Math.max(n,s):n,d=new ff(e,{endRow:c}),h=new Array(l).fill(1);for(const{row:e,column:o,cellHeight:a,cellWidth:l,cell:c}of d){const d=e+a-1,u=e<=s&&s<=d;e<n&&n<=d?(t.setAttribute("rowspan",a+i,c),h[o]=-l):r&&u&&(h[o]=l)}for(let o=0;o<i;o++){const o=t.createElement("tableRow");t.insert(o,e,n);for(let e=0;e<h.length;e++){const n=h[e],i=t.createPositionAt(o,"end");n>0&&df(t,i,n>1?{colspan:n}:null),e+=Math.abs(n)-1}}})}insertColumns(e,t={}){const o=this.editor.model,n=t.at||0,i=t.columns||1;o.change(t=>{const o=e.getAttribute("headingColumns");n<o&&t.setAttribute("headingColumns",o+i,e);const r=this.getColumns(e);if(0===n||r===n){for(const o of e.getChildren())ip(i,t,t.createPositionAt(o,n?"end":0));return}const s=new ff(e,{column:n,includeAllSlots:!0});for(const e of s){const{row:o,cell:r,cellAnchorColumn:a,cellAnchorRow:l,cellWidth:c,cellHeight:d}=e;if(a<n){t.setAttribute("colspan",c+i,r);const e=l+d-1;for(let t=o;t<=e;t++)s.skipRow(t)}else ip(i,t,e.getPositionBefore())}})}removeRows(e,t){const o=this.editor.model,n=t.rows||1,i=t.at,r=i+n-1;o.change(t=>{const{cellsToMove:o,cellsToTrim:n}=function(e,t,o){const n=new Map,i=[];for(const{row:r,column:s,cellHeight:a,cell:l}of new ff(e,{endRow:o})){const e=r+a-1;if(r>=t&&r<=o&&e>o){const e=a-(o-r+1);n.set(s,{cell:l,rowspan:e})}if(r<t&&e>=t){let n;n=e>=o?o-t+1:e-t+1,i.push({cell:l,rowspan:a-n})}}return{cellsToMove:n,cellsToTrim:i}}(e,i,r);if(o.size){!function(e,t,o,n){const i=[...new ff(e,{includeAllSlots:!0,row:t})],r=e.getChild(t);let s;for(const{column:e,cell:t,isAnchor:a}of i)if(o.has(e)){const{cell:t,rowspan:i}=o.get(e),a=s?n.createPositionAfter(s):n.createPositionAt(r,0);n.move(n.createRangeOn(t),a),cf("rowspan",i,t,n),s=t}else a&&(s=t)}(e,r+1,o,t)}for(let o=r;o>=i;o--)t.remove(e.getChild(o));for(const{rowspan:e,cell:o}of n)cf("rowspan",e,o,t);!function(e,t,o,n){const i=e.getAttribute("headingRows")||0;if(t<i){cf("headingRows",o<i?i-(o-t+1):t,e,n,0)}}(e,i,r,t),$f(e,this)||Uf(e,this)})}removeColumns(e,t){const o=this.editor.model,n=t.at,i=t.columns||1,r=t.at+i-1;o.change(t=>{!function(e,t,o){const n=e.getAttribute("headingColumns")||0;if(n&&t.first<n){const i=Math.min(n-1,t.last)-t.first+1;o.setAttribute("headingColumns",n-i,e)}}(e,{first:n,last:r},t);for(let o=r;o>=n;o--)for(const{cell:n,column:i,cellWidth:r}of[...new ff(e)])i<=o&&r>1&&i+r>o?cf("colspan",r-1,n,t):i===o&&t.remove(n);Uf(e,this)||$f(e,this)})}splitCellVertically(e,t=2){const o=this.editor.model,n=e.parent.parent,i=parseInt(e.getAttribute("rowspan")||1),r=parseInt(e.getAttribute("colspan")||1);o.change(o=>{if(r>1){const{newCellsSpan:n,updatedSpan:s}=rp(r,t);cf("colspan",s,e,o);const a={};n>1&&(a.colspan=n),i>1&&(a.rowspan=i);ip(r>t?t-1:r-1,o,o.createPositionAfter(e),a)}if(r<t){const s=t-r,a=[...new ff(n)],{column:l}=a.find(({cell:t})=>t===e),c=a.filter(({cell:t,cellWidth:o,column:n})=>t!==e&&n===l||n<l&&n+o>l);for(const{cell:e,cellWidth:t}of c)o.setAttribute("colspan",t+s,e);const d={};i>1&&(d.rowspan=i),ip(s,o,o.createPositionAfter(e),d);const h=n.getAttribute("headingColumns")||0;h>l&&cf("headingColumns",h+s,n,o)}})}splitCellHorizontally(e,t=2){const o=this.editor.model,n=e.parent,i=n.parent,r=i.getChildIndex(n),s=parseInt(e.getAttribute("rowspan")||1),a=parseInt(e.getAttribute("colspan")||1);o.change(o=>{if(s>1){const n=[...new ff(i,{startRow:r,endRow:r+s-1,includeAllSlots:!0})],{newCellsSpan:l,updatedSpan:c}=rp(s,t);cf("rowspan",c,e,o);const{column:d}=n.find(({cell:t})=>t===e),h={};l>1&&(h.rowspan=l),a>1&&(h.colspan=a);for(const e of n){const{column:t,row:n}=e,i=t===d,s=(n+r+c)%l==0;n>=r+c&&i&&s&&ip(1,o,e.getPositionBefore(),h)}}if(s<t){const n=t-s,l=[...new ff(i,{startRow:0,endRow:r})];for(const{cell:t,cellHeight:i,row:s}of l)if(t!==e&&s+i>r){const e=i+n;o.setAttribute("rowspan",e,t)}const c={};a>1&&(c.colspan=a),np(o,i,r+1,n,1,c);const d=i.getAttribute("headingRows")||0;d>r&&cf("headingRows",d+n,i,o)}})}getColumns(e){return[...e.getChild(0).getChildren()].reduce((e,t)=>e+parseInt(t.getAttribute("colspan")||1),0)}getRows(e){return e.childCount}}function np(e,t,o,n,i,r={}){for(let s=0;s<n;s++){const n=e.createElement("tableRow");e.insert(n,t,o),ip(i,e,e.createPositionAt(n,"end"),r)}}function ip(e,t,o,n={}){for(let i=0;i<e;i++)df(t,o,n)}function rp(e,t){if(e<t)return{newCellsSpan:1,updatedSpan:1};const o=Math.floor(e/t);return{newCellsSpan:o,updatedSpan:e-o*t+o}}class sp extends Vd{refresh(){const e=Tf(this.editor.model.document.selection);this.isEnabled=If(e,this.editor.plugins.get(op))}execute(){const e=this.editor.model,t=this.editor.plugins.get(op);e.change(o=>{const n=Tf(e.document.selection),i=n.shift(),{mergeWidth:r,mergeHeight:s}=function(e,t,o){let n=0,i=0;for(const e of t){const{row:t,column:r}=o.getCellLocation(e);n=cp(e,r,n,"colspan"),i=cp(e,t,i,"rowspan")}const{row:r,column:s}=o.getCellLocation(e);return{mergeWidth:n-s,mergeHeight:i-r}}(i,n,t);cf("colspan",r,i,o),cf("rowspan",s,i,o);for(const e of n)ap(e,i,o);Gf(i.findAncestor("table"),t),o.setSelection(i,"in")})}}function ap(e,t,o){lp(e)||(lp(t)&&o.remove(o.createRangeIn(t)),o.move(o.createRangeIn(e),o.createPositionAt(t,"end"))),o.remove(e)}function lp(e){return 1==e.childCount&&e.getChild(0).is("element","paragraph")&&e.getChild(0).isEmpty}function cp(e,t,o,n){const i=parseInt(e.getAttribute(n)||1);return Math.max(o,t+i)}class dp extends Vd{refresh(){const e=Sf(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const e=this.editor.model,t=Sf(e.document.selection),o=Ef(t),n=t[0].findAncestor("table"),i=[];for(let t=o.first;t<=o.last;t++)for(const o of n.getChild(t).getChildren())i.push(e.createRangeOn(o));e.change(e=>{e.setSelection(i)})}}class hp extends Vd{refresh(){const e=Sf(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const e=this.editor.model,t=Sf(e.document.selection),o=t[0],n=t.pop(),i=o.findAncestor("table"),r=this.editor.plugins.get("TableUtils"),s=r.getCellLocation(o),a=r.getCellLocation(n),l=Math.min(s.column,a.column),c=Math.max(s.column,a.column),d=[];for(const t of new ff(i,{startColumn:l,endColumn:c}))d.push(e.createRangeOn(t.cell));e.change(e=>{e.setSelection(d)})}}function up(e){e.document.registerPostFixer(t=>function(e,t){const o=t.document.differ.getChanges();let n=!1;const i=new Set;for(const t of o){let o;"table"==t.name&&"insert"==t.type&&(o=t.position.nodeAfter),"tableRow"!=t.name&&"tableCell"!=t.name||(o=t.position.findAncestor("table")),fp(t)&&(o=t.range.start.findAncestor("table")),o&&!i.has(o)&&(n=mp(o,e)||n,n=gp(o,e)||n,i.add(o))}return n}(t,e))}function mp(e,t){let o=!1;const n=function(e){const t=parseInt(e.getAttribute("headingRows")||0),o=e.childCount,n=[];for(const{row:i,cell:r,cellHeight:s}of new ff(e)){if(s<2)continue;const e=i<t?t:o;if(i+s>e){const t=e-i;n.push({cell:r,rowspan:t})}}return n}(e);if(n.length){o=!0;for(const e of n)cf("rowspan",e.rowspan,e.cell,t,1)}return o}function gp(e,t){let o=!1;const n=function(e){const t=new Array(e.childCount).fill(0);for(const{row:o}of new ff(e,{includeAllSlots:!0}))t[o]++;return t}(e),i=[];for(const[e,t]of n.entries())t||i.push(e);if(i.length){o=!0;for(const o of i.reverse())t.remove(e.getChild(o)),n.splice(o,1)}const r=n[0];if(!n.every(e=>e===r)){const i=n.reduce((e,t)=>t>e?t:e,0);for(const[r,s]of n.entries()){const n=i-s;if(n){for(let o=0;o<n;o++)df(t,t.createPositionAt(e.getChild(r),"end"));o=!0}}}return o}function fp(e){const t="attribute"===e.type,o=e.attributeKey;return t&&("headingRows"===o||"colspan"===o||"rowspan"===o)}function pp(e){e.document.registerPostFixer(t=>function(e,t){const o=t.document.differ.getChanges();let n=!1;for(const t of o)"insert"==t.type&&"table"==t.name&&(n=bp(t.position.nodeAfter,e)||n),"insert"==t.type&&"tableRow"==t.name&&(n=wp(t.position.nodeAfter,e)||n),"insert"==t.type&&"tableCell"==t.name&&(n=kp(t.position.nodeAfter,e)||n),_p(t)&&(n=kp(t.position.parent,e)||n);return n}(t,e))}function bp(e,t){let o=!1;for(const n of e.getChildren())o=wp(n,t)||o;return o}function wp(e,t){let o=!1;for(const n of e.getChildren())o=kp(n,t)||o;return o}function kp(e,t){if(0==e.childCount)return t.insertElement("paragraph",e),!0;const o=Array.from(e.getChildren()).filter(e=>e.is("$text"));for(const e of o)t.wrap(t.createRangeOn(e),"paragraph");return!!o.length}function _p(e){return!(!e.position||!e.position.parent.is("element","tableCell"))&&("insert"==e.type&&"$text"==e.name||"remove"==e.type)}function vp(e){e.document.registerPostFixer(()=>function(e){const t=e.document.differ,o=new Set;let n=0;for(const e of t.getChanges()){const t="insert"==e.type||"remove"==e.type?e.position.parent:e.range.start.parent;t.is("element","tableCell")&&("insert"==e.type&&n++,yp(t,e.type,n)&&o.add(t))}if(o.size){for(const e of o.values())t.refreshItem(e);return!0}return!1}(e))}function yp(e,t,o){if(!Array.from(e.getChildren()).some(e=>e.is("element","paragraph")))return!1;if("attribute"==t){const t=Array.from(e.getChild(0).getAttributeKeys()).length;return 1===e.childCount&&t<2}return e.childCount<=("insert"==t?o+1:1)}function xp(e){e.document.registerPostFixer(()=>function(e){const t=e.document.differ,o=new Set;for(const e of t.getChanges()){if("attribute"!=e.type)continue;const t=e.range.start.nodeAfter;t&&t.is("element","table")&&"headingRows"==e.attributeKey&&o.add(t)}if(o.size){for(const e of o.values())t.refreshItem(e);return!0}return!1}(e))}o(92);class Cp extends jl{static get pluginName(){return"TableEditing"}init(){const e=this.editor,t=e.model,o=t.schema,n=e.conversion;o.register("table",{allowWhere:"$block",allowAttributes:["headingRows","headingColumns"],isObject:!0,isBlock:!0}),o.register("tableRow",{allowIn:"table",isLimit:!0}),o.register("tableCell",{allowIn:"tableRow",allowAttributes:["colspan","rowspan"],isLimit:!0,isSelectable:!0}),o.extend("$block",{allowIn:"tableCell"}),o.addChildCheck((e,t)=>{if("table"==t.name&&Array.from(e.getNames()).includes("table"))return!1}),n.for("upcast").add(uf()),n.for("editingDowncast").add(bf({asWidget:!0})),n.for("dataDowncast").add(bf()),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("editingDowncast").add(e=>e.on("insert:tableRow",(e,t,o)=>{const n=t.item;if(!o.consumable.consume(n,"insert"))return;const i=n.parent,r=function(e){for(const t of e.getChildren())if("table"===t.name)return t}(o.mapper.toViewElement(i)),s=i.getChildIndex(n),a=new ff(i,{row:s}),l={headingRows:i.getAttribute("headingRows")||0,headingColumns:i.getAttribute("headingColumns")||0},c=new Map;for(const e of a){const t=c.get(s)||_f(r,n,s,l,o);c.set(s,t),o.consumable.consume(e.cell,"insert"),kf(e,l,o.writer.createPositionAt(t,"end"),o,{asWidget:!0})}})),n.for("editingDowncast").add(e=>e.on("remove:tableRow",(e,t,o)=>{e.stop();const n=o.writer,i=o.mapper,r=i.toViewPosition(t.position).getLastMatchingPosition(e=>!e.item.is("element","tr")).nodeAfter,s=r.parent.parent,a=n.createRangeOn(r),l=n.remove(a);for(const e of n.createRangeIn(l).getItems())i.unbindViewElement(e);xf("thead",s,o),xf("tbody",s,o)},{priority:"higher"})),n.for("upcast").elementToElement({model:"tableCell",view:"td"}),n.for("upcast").elementToElement({model:"tableCell",view:"th"}),n.for("upcast").add(mf("td")),n.for("upcast").add(mf("th")),n.for("editingDowncast").add(e=>e.on("insert:tableCell",(e,t,o)=>{const n=t.item;if(!o.consumable.consume(n,"insert"))return;const i=n.parent,r=i.parent,s=r.getChildIndex(i),a=new ff(r,{row:s}),l={headingRows:r.getAttribute("headingRows")||0,headingColumns:r.getAttribute("headingColumns")||0};for(const e of a)if(e.cell===n){const t=o.mapper.toViewElement(i);return void kf(e,l,o.writer.createPositionAt(t,i.getChildIndex(n)),o,{asWidget:!0})}})),n.attributeToAttribute({model:"colspan",view:"colspan"}),n.attributeToAttribute({model:"rowspan",view:"rowspan"}),n.for("editingDowncast").add(e=>e.on("attribute:headingColumns:table",(e,t,o)=>{const n=t.item;if(!o.consumable.consume(t.item,e.name))return;const i={headingRows:n.getAttribute("headingRows")||0,headingColumns:n.getAttribute("headingColumns")||0},r=t.attributeOldValue,s=t.attributeNewValue,a=(r>s?r:s)-1;for(const e of new ff(n,{endColumn:a}))wf(e,i,o)})),e.commands.add("insertTable",new Af(e)),e.commands.add("insertTableRowAbove",new zf(e,{order:"above"})),e.commands.add("insertTableRowBelow",new zf(e,{order:"below"})),e.commands.add("insertTableColumnLeft",new Bf(e,{order:"left"})),e.commands.add("insertTableColumnRight",new Bf(e,{order:"right"})),e.commands.add("removeTableRow",new Xf(e)),e.commands.add("removeTableColumn",new Zf(e)),e.commands.add("splitTableCellVertically",new Ff(e,{direction:"vertically"})),e.commands.add("splitTableCellHorizontally",new Ff(e,{direction:"horizontally"})),e.commands.add("mergeTableCells",new sp(e)),e.commands.add("mergeTableCellRight",new Yf(e,{direction:"right"})),e.commands.add("mergeTableCellLeft",new Yf(e,{direction:"left"})),e.commands.add("mergeTableCellDown",new Yf(e,{direction:"down"})),e.commands.add("mergeTableCellUp",new Yf(e,{direction:"up"})),e.commands.add("setTableColumnHeader",new tp(e)),e.commands.add("setTableRowHeader",new ep(e)),e.commands.add("selectTableRow",new dp(e)),e.commands.add("selectTableColumn",new hp(e)),xp(t),up(t),vp(t),pp(t)}static get requires(){return[op]}}o(94);class Ap extends dc{constructor(e){super(e);const t=this.bindTemplate;this.items=this._createGridCollection(),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-insert-table-dropdown__label"]},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:o,column:n}=t.target.dataset;this.set({rows:parseInt(o),columns:parseInt(n)})}),this.on("change:columns",()=>{this._highlightGridBoxes()}),this.on("change:rows",()=>{this._highlightGridBoxes()})}focus(){}focusLast(){}_highlightGridBoxes(){const e=this.rows,t=this.columns;this.items.map((o,n)=>{const i=Math.floor(n/10)<e&&n%10<t;o.set("isOn",i)})}_createGridCollection(){const e=[];for(let t=0;t<100;t++){const o=Math.floor(t/10),n=t%10;e.push(new Tp(this.locale,o+1,n+1))}return this.createCollection(e)}}class Tp extends dc{constructor(e,t,o){super(e);const n=this.bindTemplate;this.set("isOn",!1),this.setTemplate({tag:"div",attributes:{class:["ck-insert-table-dropdown-grid-box",n.if("isOn","ck-on")],"data-row":t,"data-column":o}})}}class Pp extends jl{init(){const e=this.editor,t=this.editor.t,o="ltr"===e.locale.contentLanguageDirection;e.ui.componentFactory.add("insertTable",o=>{const n=e.commands.get("insertTable"),i=qc(o);let r;return i.bind("isEnabled").to(n),i.buttonView.set({icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 6v3h4V6H3zm0 4v3h4v-3H3zm0 4v3h4v-3H3zm5 3h4v-3H8v3zm5 0h4v-3h-4v3zm4-4v-3h-4v3h4zm0-4V6h-4v3h4zm1.5 8a1.5 1.5 0 0 1-1.5 1.5H3A1.5 1.5 0 0 1 1.5 17V4c.222-.863 1.068-1.5 2-1.5h13c.932 0 1.778.637 2 1.5v13zM12 13v-3H8v3h4zm0-4V6H8v3h4z"/></svg>',label:t("Insert table"),tooltip:!0}),i.on("change:isOpen",()=>{r||(r=new Ap(o),i.panelView.children.add(r),r.delegate("execute").to(i),i.buttonView.on("open",()=>{r.rows=0,r.columns=0}),i.on("execute",()=>{e.execute("insertTable",{rows:r.rows,columns:r.columns}),e.editing.view.focus()}))}),i}),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:o?"insertTableColumnLeft":"insertTableColumnRight",label:t("Insert column left")}},{type:"button",model:{commandName:o?"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 o=[{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>',o,e)}),e.ui.componentFactory.add("mergeTableCells",e=>{const n=[{type:"button",model:{commandName:"mergeTableCellUp",label:t("Merge cell up")}},{type:"button",model:{commandName:o?"mergeTableCellRight":"mergeTableCellLeft",label:t("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:t("Merge cell down")}},{type:"button",model:{commandName:o?"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,o,n){const i=this.editor,r=qc(n),s=this._fillDropdownWithListOptions(r,o);return r.buttonView.set({label:e,icon:t,tooltip:!0}),r.bind("isEnabled").toMany(s,"isEnabled",(...e)=>e.some(e=>e)),this.listenTo(r,"execute",e=>{i.execute(e.source.commandName),i.editing.view.focus()}),r}_prepareMergeSplitButtonDropdown(e,t,o,n){const i=this.editor,r=qc(n,Bu);return this._fillDropdownWithListOptions(r,o),r.buttonView.set({label:e,icon:t,tooltip:!0,isEnabled:!0}),this.listenTo(r.buttonView,"execute",()=>{i.execute("mergeTableCells"),i.editing.view.focus()}),this.listenTo(r,"execute",e=>{i.execute(e.source.commandName),i.editing.view.focus()}),r}_fillDropdownWithListOptions(e,t){const o=this.editor,n=[],i=new Ao;for(const e of t)Sp(e,o,n,i);return $c(e,i,o.ui.componentFactory),n}}function Sp(e,t,o,n){const i=e.model=new bh(e.model),{commandName:r,bindIsOn:s}=e.model;if("button"===e.type||"switchbutton"===e.type){const e=t.commands.get(r);o.push(e),i.set({commandName:r}),i.bind("isEnabled").to(e),s&&i.bind("isOn").to(e,"value")}i.set({withText:!0}),n.add(e)}o(96);class Ep extends jl{static get pluginName(){return"TableSelection"}static get requires(){return[op]}init(){const e=this.editor.model;this.listenTo(e,"deleteContent",(e,t)=>this._handleDeleteContent(e,t),{priority:"high"}),this._defineSelectionConverter(),this._enablePluginDisabling()}getSelectedTableCells(){const e=Tf(this.editor.model.document.selection);return 0==e.length?null:e}getSelectionAsFragment(){const e=this.getSelectedTableCells();return e?this.editor.model.change(t=>{const o=t.createDocumentFragment(),n=this.editor.plugins.get("TableUtils"),{first:i,last:r}=Rf(e),{first:s,last:a}=Ef(e),l=e[0].findAncestor("table");let c=a,d=r;if(If(e,n)){const e={firstColumn:i,lastColumn:r,firstRow:s,lastRow:a};c=Kf(l,e),d=Jf(l,e)}const h=Df(l,{startRow:s,startColumn:i,endRow:c,endColumn:d},t);return t.insert(h,o,0),o}):null}setCellSelection(e,t){const o=this._getCellsToSelect(e,t);this.editor.model.change(e=>{e.setSelection(o.cells.map(t=>e.createRangeOn(t)),{backward:o.backward})})}getFocusCell(){const e=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return e&&e.is("element","tableCell")?e:null}getAnchorCell(){const e=Pd(this.editor.model.document.selection.getRanges()).getContainedElement();return e&&e.is("element","tableCell")?e:null}_defineSelectionConverter(){const e=this.editor,t=new Set;e.conversion.for("editingDowncast").add(e=>e.on("selection",(e,o,n)=>{const i=n.writer;!function(e){for(const o of t)e.removeClass("ck-editor__editable_selected",o);t.clear()}(i);const r=this.getSelectedTableCells();if(!r)return;for(const e of r){const o=n.mapper.toViewElement(e);i.addClass("ck-editor__editable_selected",o),t.add(o)}const s=n.mapper.toViewElement(r[r.length-1]);i.setSelection(s,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(o=>{const n=o.createPositionAt(t[0],0),i=e.model.schema.getNearestSelectionRange(n);o.setSelection(i)})}})}_handleDeleteContent(e,t){const[o,n]=t,i=this.editor.model,r=!n||"backward"==n.direction,s=Tf(o);s.length&&(e.stop(),i.change(e=>{const t=s[r?s.length-1:0];i.change(e=>{for(const t of s)i.deleteContent(e.createSelection(t,"in"))});const n=i.schema.getNearestSelectionRange(e.createPositionAt(t,0));o.is("documentSelection")?e.setSelection(n):o.setTo(n)}))}_getCellsToSelect(e,t){const o=this.editor.plugins.get("TableUtils"),n=o.getCellLocation(e),i=o.getCellLocation(t),r=Math.min(n.row,i.row),s=Math.max(n.row,i.row),a=Math.min(n.column,i.column),l=Math.max(n.column,i.column),c=new Array(s-r+1).fill(null).map(()=>[]),d={startRow:r,endRow:s,startColumn:a,endColumn:l};for(const{row:t,cell:o}of new ff(e.findAncestor("table"),d))c[t-r].push(o);const h=i.row<n.row,u=i.column<n.column;return h&&c.reverse(),u&&c.forEach(e=>e.reverse()),{cells:c.flat(),backward:h||u}}}class Rp extends jl{static get pluginName(){return"TableClipboard"}static get requires(){return[Ep,op]}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)=>this._onInsertContent(e,...t),{priority:"high"})}_onCopyCut(e,t){const o=this.editor.plugins.get(Ep);if(!o.getSelectedTableCells())return;if("cut"==e.name&&this.editor.isReadOnly)return;t.preventDefault(),e.stop();const n=this.editor.data,i=this.editor.editing.view.document,r=n.toView(o.getSelectionAsFragment());i.fire("clipboardOutput",{dataTransfer:t.dataTransfer,content:r,method:e.name})}_onInsertContent(e,t,o){if(o&&!o.is("documentSelection"))return;const n=this.editor.model,i=this.editor.plugins.get(op);let r=function(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 o=t.createRangeIn(e);for(const e of o.getItems())if(e.is("element","table")){const n=t.createRange(o.start,t.createPositionBefore(e));if(t.hasContent(n,{ignoreWhitespaces:!0}))return null;const i=t.createRange(t.createPositionAfter(e),o.end);return t.hasContent(i,{ignoreWhitespaces:!0})?null:e}return null}(t,n);if(!r)return;const s=Sf(n.document.selection);s.length?(e.stop(),n.change(e=>{const t={width:i.getColumns(r),height:i.getRows(r)},o=function(e,t,o,n){const i=e[0].findAncestor("table"),r=Rf(e),s=Ef(e),a={firstColumn:r.first,lastColumn:r.last,firstRow:s.first,lastRow:s.last},l=1===e.length;l&&(a.lastRow+=t.height-1,a.lastColumn+=t.width-1,function(e,t,o,n){const i=n.getColumns(e),r=n.getRows(e);o>i&&n.insertColumns(e,{at:i,columns:o-i});t>r&&n.insertRows(e,{at:r,rows:t-r})}(i,a.lastRow+1,a.lastColumn+1,n));l||!If(e,n)?function(e,t,o){const{firstRow:n,lastRow:i,firstColumn:r,lastColumn:s}=t,a={first:n,last:i},l={first:r,last:s};Vp(e,r,a,o),Vp(e,s+1,a,o),Ip(e,n,l,o),Ip(e,i+1,l,o,n)}(i,a,o):(a.lastRow=Kf(i,a),a.lastColumn=Jf(i,a));return a}(s,t,e,i),n=o.lastRow-o.firstRow+1,a=o.lastColumn-o.firstColumn+1,l={startRow:0,startColumn:0,endRow:Math.min(n,t.height)-1,endColumn:Math.min(a,t.width)-1};r=Df(r,l,e);const c=s[0].findAncestor("table"),d=function(e,t,o,n,i){const{width:r,height:s}=t,a=function(e,t,o){const n=new Array(o).fill(null).map(()=>new Array(t).fill(null));for(const{column:t,row:o,cell:i}of new ff(e))n[o][t]=i;return n}(e,r,s),l=[...new ff(o,{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:o,cell:l,isAnchor:h}=e;o===n.firstColumn&&(d=e.getPositionBefore()),h&&i.remove(l);const u=t-n.firstRow,m=o-n.firstColumn,g=a[u%s][m%r];if(!g)continue;const f=i.cloneElement(g);qf(f,t,o,n.lastRow,n.lastColumn,i),i.insert(f,d),c.push(f),d=i.createPositionAfter(f)}const h=parseInt(o.getAttribute("headingRows")||0),u=parseInt(o.getAttribute("headingColumns")||0),m=n.firstRow<h&&h<=n.lastRow,g=n.firstColumn<u&&u<=n.lastColumn;if(m){const e={first:n.firstColumn,last:n.lastColumn},t=Ip(o,h,e,i,n.firstRow);c.push(...t)}if(g){const e={first:n.firstRow,last:n.lastRow},t=Vp(o,u,e,i);c.push(...t)}return c}(r,t,c,o,e);if(this.editor.plugins.get("TableSelection").isEnabled){const t=Vf(d.map(t=>e.createRangeOn(t)));e.setSelection(t)}else e.setSelection(d[0],0)})):Gf(r,i)}}function Ip(e,t,o,n,i=0){if(t<1)return;return Lf(e,t,i).filter(({column:e,cellWidth:t})=>Op(e,t,o)).map(({cell:e})=>Hf(e,t,n))}function Vp(e,t,o,n){if(t<1)return;return jf(e,t).filter(({row:e,cellHeight:t})=>Op(e,t,o)).map(({cell:e,column:o})=>Wf(e,o,t,n))}function Op(e,t,o){const n=e+t-1,{first:i,last:r}=o;return e>=i&&e<=r||e<i&&n>=i}class Mp extends jl{static get pluginName(){return"TableKeyboard"}static get requires(){return[Ep]}init(){const e=this.editor.editing.view.document;this.editor.keystrokes.set("Tab",(...e)=>this._handleTabOnSelectedTable(...e),{priority:"low"}),this.editor.keystrokes.set("Tab",this._getTabHandler(!0),{priority:"low"}),this.editor.keystrokes.set("Shift+Tab",this._getTabHandler(!1),{priority:"low"}),this.listenTo(e,"keydown",(...e)=>this._onKeydown(...e),{priority:uo.get("high")-10})}_handleTabOnSelectedTable(e,t){const o=this.editor,n=o.model.document.selection.getSelectedElement();n&&n.is("element","table")&&(t(),o.model.change(e=>{e.setSelection(e.createRangeIn(n.getChild(0).getChild(0)))}))}_getTabHandler(e){const t=this.editor;return(o,n)=>{let i=Pf(t.model.document.selection)[0];if(i||(i=this.editor.plugins.get("TableSelection").getFocusCell()),!i)return;n();const r=i.parent,s=r.parent,a=s.getChildIndex(r),l=r.getChildIndex(i),c=0===l;if(!e&&c&&0===a)return void t.model.change(e=>{e.setSelection(e.createRangeOn(s))});const d=l===r.childCount-1,h=a===s.childCount-1;if(e&&h&&d&&(t.execute("insertTableRowBelow"),a===s.childCount-1))return void t.model.change(e=>{e.setSelection(e.createRangeOn(s))});let u;if(e&&d){const e=s.getChild(a+1);u=e.getChild(0)}else if(!e&&c){const e=s.getChild(a-1);u=e.getChild(e.childCount-1)}else u=r.getChild(l+(e?1:-1));t.model.change(e=>{e.setSelection(e.createRangeIn(u))})}}_onKeydown(e,t){const o=this.editor,n=t.keyCode;if(!_i(n))return;const i=vi(n,o.locale.contentLanguageDirection);this._handleArrowKeys(i,t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),e.stop())}_handleArrowKeys(e,t){const o=this.editor.model.document.selection,n=["right","down"].includes(e),i=Tf(o);if(i.length){let o;return o=t?this.editor.plugins.get("TableSelection").getFocusCell():n?i[i.length-1]:i[0],this._navigateFromCellInDirection(o,e,t),!0}const r=o.focus.findAncestor("tableCell");return!!r&&(!(t&&!o.isCollapsed&&o.isBackward==n)&&(!!this._isSelectionAtCellEdge(o,r,n)&&(this._navigateFromCellInDirection(r,e,t),!0)))}_isSelectionAtCellEdge(e,t,o){const n=this.editor.model,i=this.editor.model.schema,r=o?e.getLastPosition():e.getFirstPosition();if(!i.getLimitElement(r).is("element","tableCell")){return n.createPositionAt(t,o?"end":0).isTouching(r)}const s=n.createSelection(r);return n.modifySelection(s,{direction:o?"forward":"backward"}),r.isEqual(s.focus)}_navigateFromCellInDirection(e,t,o=!1){const n=this.editor.model,i=e.findAncestor("table"),r=[...new ff(i,{includeAllSlots:!0})],{row:s,column:a}=r[r.length-1],l=r.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>s||d<0&&c<=0||d>a&&c>=s)return void n.change(e=>{e.setSelection(e.createRangeOn(i))});d<0?(d=o?0:a,c--):d>a&&(d=o?a:0,c++);const h=r.find(e=>e.row==c&&e.column==d).cell,u=["right","down"].includes(t),m=this.editor.plugins.get("TableSelection");if(o&&m.isEnabled){const t=m.getAnchorCell()||e;m.setCellSelection(t,h)}else{const e=n.createPositionAt(h,u?0:"end");n.change(t=>{t.setSelection(e)})}}}class Np extends Fr{constructor(e){super(e),this.domEventType=["mousemove","mouseup","mouseleave"]}onDomEvent(e){this.fire(e.type,e)}}class zp extends jl{static get pluginName(){return"TableMouse"}static get requires(){return[Ep]}init(){this.editor.editing.view.addObserver(Np),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){const e=this.editor;let t=!1;const o=e.plugins.get(Ep);this.listenTo(e.editing.view.document,"mousedown",(n,i)=>{if(!this.isEnabled||!o.isEnabled)return;if(!i.domEvent.shiftKey)return;const r=o.getAnchorCell()||Pf(e.model.document.selection)[0];if(!r)return;const s=this._getModelTableCellFromDomEvent(i);s&&Bp(r,s)&&(t=!0,o.setCellSelection(r,s),i.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{t=!1}),this.listenTo(e.editing.view.document,"selectionChange",e=>{t&&e.stop()},{priority:"highest"})}_enableMouseDragSelection(){const e=this.editor;let t,o,n=!1,i=!1;const r=e.plugins.get(Ep);this.listenTo(e.editing.view.document,"mousedown",(e,o)=>{this.isEnabled&&r.isEnabled&&(o.domEvent.shiftKey||o.domEvent.ctrlKey||o.domEvent.altKey||(t=this._getModelTableCellFromDomEvent(o)))}),this.listenTo(e.editing.view.document,"mousemove",(e,s)=>{if(!s.domEvent.buttons)return;if(!t)return;const a=this._getModelTableCellFromDomEvent(s);a&&Bp(t,a)&&(o=a,n||o==t||(n=!0)),n&&(i=!0,r.setCellSelection(t,o),s.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{n=!1,i=!1,t=null,o=null}),this.listenTo(e.editing.view.document,"selectionChange",e=>{i&&e.stop()},{priority:"highest"})}_getModelTableCellFromDomEvent(e){const t=e.target,o=this.editor.editing.view.createPositionAt(t,0);return this.editor.editing.mapper.toModelPosition(o).parent.findAncestor("tableCell",{includeSelf:!0})}}function Bp(e,t){return e.parent.parent==t.parent.parent}o(98);function Fp(e){const t=e.getSelectedElement();return t&&Lp(t)?t:null}function Dp(e){const t=function(e,t){let o=t.parent;for(;o;){if(o.name===e)return o;o=o.parent}}("table",e.getFirstPosition());return t&&Lp(t.parent)?t.parent:null}function Lp(e){return!!e.getCustomProperty("table")&&Ph(e)}const Hp=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,jp=/^rgb\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}[0-9]{1,3}[ %]?\)$/i,Wp=/^rgba\([ ]?([0-9]{1,3}[ %]?,[ ]?){3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,qp=/^hsl\([ ]?([0-9]{1,3}[ %]?[,]?[ ]*){3}(1|[0-9]+%|[0]?\.?[0-9]+)?\)$/i,$p=/^hsla\([ ]?([0-9]{1,3}[ %]?,[ ]?){2,3}(1|[0-9]+%|[0]?\.?[0-9]+)\)$/i,Up=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","rebeccapurple","currentcolor","transparent"]);function Gp(e){return e.startsWith("#")?Hp.test(e):e.startsWith("rgb")?jp.test(e)||Wp.test(e):e.startsWith("hsl")?qp.test(e)||$p.test(e):Up.has(e.toLowerCase())}const Kp=["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset"];function Jp(e){return Kp.includes(e)}const Yp=/^([+-]?[0-9]*[.]?[0-9]+(px|cm|mm|in|pc|pt|ch|em|ex|rem|vh|vw|vmin|vmax)|0)$/;function Qp(e){return Yp.test(e)}const Xp=/^[+-]?[0-9]*[.]?[0-9]+%$/;const Zp=["repeat-x","repeat-y","repeat","space","round","no-repeat"];const eb=["center","top","bottom","left","right"];function tb(e){return eb.includes(e)}const ob=["fixed","scroll","local"];function nb(e){return ob.includes(e)}const ib=/^url\(/;function rb(e){return ib.test(e)}function sb(e=""){if(""===e)return{top:void 0,right:void 0,bottom:void 0,left:void 0};const t=db(e),o=t[0],n=t[2]||o,i=t[1]||o;return{top:o,bottom:n,right:i,left:t[3]||i}}function ab(e){return t=>{const{top:o,right:n,bottom:i,left:r}=t,s=[];return[o,n,r,i].every(e=>!!e)?s.push([e,lb(t)]):(o&&s.push([e+"-top",o]),n&&s.push([e+"-right",n]),i&&s.push([e+"-bottom",i]),r&&s.push([e+"-left",r])),s}}function lb({top:e,right:t,bottom:o,left:n}){const i=[];return n!==t?i.push(e,t,o,n):o!==e?i.push(e,t,o):t!==e?i.push(e,t):i.push(e),i.join(" ")}function cb(e){return t=>({path:e,value:sb(t)})}function db(e){return e.replace(/, /g,",").split(" ").map(e=>e.replace(/,/g,", "))}function hb(e){e.setNormalizer("border",ub),e.setNormalizer("border-top",mb("top")),e.setNormalizer("border-right",mb("right")),e.setNormalizer("border-bottom",mb("bottom")),e.setNormalizer("border-left",mb("left")),e.setNormalizer("border-color",gb("color")),e.setNormalizer("border-width",gb("width")),e.setNormalizer("border-style",gb("style")),e.setNormalizer("border-top-color",pb("color","top")),e.setNormalizer("border-top-style",pb("style","top")),e.setNormalizer("border-top-width",pb("width","top")),e.setNormalizer("border-right-color",pb("color","right")),e.setNormalizer("border-right-style",pb("style","right")),e.setNormalizer("border-right-width",pb("width","right")),e.setNormalizer("border-bottom-color",pb("color","bottom")),e.setNormalizer("border-bottom-style",pb("style","bottom")),e.setNormalizer("border-bottom-width",pb("width","bottom")),e.setNormalizer("border-left-color",pb("color","left")),e.setNormalizer("border-left-style",pb("style","left")),e.setNormalizer("border-left-width",pb("width","left")),e.setExtractor("border-top",bb("top")),e.setExtractor("border-right",bb("right")),e.setExtractor("border-bottom",bb("bottom")),e.setExtractor("border-left",bb("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",ab("border-color")),e.setReducer("border-style",ab("border-style")),e.setReducer("border-width",ab("border-width")),e.setReducer("border-top",vb("top")),e.setReducer("border-right",vb("right")),e.setReducer("border-bottom",vb("bottom")),e.setReducer("border-left",vb("left")),e.setReducer("border",_b),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 ub(e){const{color:t,style:o,width:n}=kb(e);return{path:"border",value:{color:sb(t),style:sb(o),width:sb(n)}}}function mb(e){return t=>{const{color:o,style:n,width:i}=kb(t),r={};return void 0!==o&&(r.color={[e]:o}),void 0!==n&&(r.style={[e]:n}),void 0!==i&&(r.width={[e]:i}),{path:"border",value:r}}}function gb(e){return t=>({path:"border",value:fb(t,e)})}function fb(e,t){return{[t]:sb(e)}}function pb(e,t){return o=>({path:"border",value:{[e]:{[t]:o}}})}function bb(e){return(t,o)=>{if(o.border)return wb(o.border,e)}}function wb(e,t){const o={};return e.width&&e.width[t]&&(o.width=e.width[t]),e.style&&e.style[t]&&(o.style=e.style[t]),e.color&&e.color[t]&&(o.color=e.color[t]),o}function kb(e){const t={},o=db(e);for(const e of o)Qp(e)||/thin|medium|thick/.test(e)?t.width=e:Jp(e)?t.style=e:t.color=e;return t}function _b(e){const t=[];return t.push(...yb(wb(e,"top"),"top")),t.push(...yb(wb(e,"right"),"right")),t.push(...yb(wb(e,"bottom"),"bottom")),t.push(...yb(wb(e,"left"),"left")),t}function vb(e){return t=>yb(t,e)}function yb(e,t){const o=[];return e&&void 0!==e.width&&o.push(e.width),e&&void 0!==e.style&&o.push(e.style),e&&void 0!==e.color&&o.push(e.color),o.length?[["border-"+t,o.join(" ")]]:[]}function xb(e){e.setNormalizer("background",Cb),e.setNormalizer("background-color",e=>({path:"background.color",value:e})),e.setReducer("background",e=>{const t=[];return t.push(["background-color",e.color]),t})}function Cb(e){const t={},o=db(e);for(const e of o)n=e,Zp.includes(n)?(t.repeat=t.repeat||[],t.repeat.push(e)):tb(e)?(t.position=t.position||[],t.position.push(e)):nb(e)?t.attachment=e:Gp(e)?t.color=e:rb(e)&&(t.image=e);var n;return{path:"background",value:t}}function Ab(e,t,o,n){e.for("upcast").attributeToAttribute({view:{styles:{[n]:/[\s\S]+/}},model:{name:t,key:o,value:e=>e.getNormalizedStyle(n)}})}function Tb(e,t){e.for("upcast").add(e=>e.on("element:"+t,(e,t,o)=>{const n=["border-top","border-right","border-bottom","border-left"].filter(e=>t.viewItem.hasStyle(e));if(!n.length)return;const i={styles:n};if(!o.consumable.test(t.viewItem,i))return;t.modelRange||(t=Object.assign(t,o.convertChildren(t.viewItem,t.modelCursor)));const r=[...t.modelRange.getItems({shallow:!0})].pop();o.consumable.consume(t.viewItem,i),o.writer.setAttribute("borderStyle",t.viewItem.getNormalizedStyle("border-style"),r),o.writer.setAttribute("borderColor",t.viewItem.getNormalizedStyle("border-color"),r),o.writer.setAttribute("borderWidth",t.viewItem.getNormalizedStyle("border-width"),r)}))}function Pb(e,t,o,n){e.for("downcast").attributeToAttribute({model:{name:t,key:o},view:e=>({key:"style",value:{[n]:e}})})}function Sb(e,t,o){e.for("downcast").add(e=>e.on(`attribute:${t}:table`,(e,t,n)=>{const{item:i,attributeNewValue:r}=t,{mapper:s,writer:a}=n;if(!n.consumable.consume(t.item,e.name))return;const l=[...s.toViewElement(i).getChildren()].find(e=>e.is("element","table"));r?a.setStyle(o,r,l):a.removeStyle(o,l)}))}class Eb extends Vd{constructor(e,t){super(e),this.attributeName=t}refresh(){const e=this.editor.model.document.selection.getFirstPosition().findAncestor("table");this.isEnabled=!!e,this.value=this._getValue(e)}execute(e={}){const t=this.editor.model,o=t.document.selection,{value:n,batch:i}=e,r=o.getFirstPosition().findAncestor("table"),s=this._getValueToSet(n);t.enqueueChange(i||"default",e=>{s?e.setAttribute(this.attributeName,s,r):e.removeAttribute(this.attributeName,r)})}_getValue(e){if(e)return e.getAttribute(this.attributeName)}_getValueToSet(e){return e}}class Rb extends Eb{constructor(e){super(e,"backgroundColor")}}function Ib(e){if(!e||!B(e))return e;const{top:t,right:o,bottom:n,left:i}=e;return t==o&&o==n&&n==i?t:void 0}function Vb(e,t){const o=parseFloat(e);return Number.isNaN(o)||String(o)!==String(e)?e:`${o}${t}`}class Ob extends Eb{constructor(e){super(e,"borderColor")}_getValue(e){if(e)return Ib(e.getAttribute(this.attributeName))}}class Mb extends Eb{constructor(e){super(e,"borderStyle")}_getValue(e){if(e)return Ib(e.getAttribute(this.attributeName))}}class Nb extends Eb{constructor(e){super(e,"borderWidth")}_getValue(e){if(e)return Ib(e.getAttribute(this.attributeName))}_getValueToSet(e){return Vb(e,"px")}}class zb extends Eb{constructor(e){super(e,"width")}_getValueToSet(e){return Vb(e,"px")}}class Bb extends Eb{constructor(e){super(e,"height")}_getValueToSet(e){return Vb(e,"px")}}class Fb extends Eb{constructor(e){super(e,"alignment")}}const Db=/^(left|right)$/;class Lb extends jl{static get pluginName(){return"TablePropertiesEditing"}static get requires(){return[Cp]}init(){const e=this.editor,t=e.model.schema,o=e.conversion;e.data.addStyleProcessorRules(hb),function(e,t){e.extend("table",{allowAttributes:["borderWidth","borderColor","borderStyle"]}),Tb(t,"table"),Sb(t,"borderColor","border-color"),Sb(t,"borderStyle","border-style"),Sb(t,"borderWidth","border-width")}(t,o),e.commands.add("tableBorderColor",new Ob(e)),e.commands.add("tableBorderStyle",new Mb(e)),e.commands.add("tableBorderWidth",new Nb(e)),function(e,t){e.extend("table",{allowAttributes:["alignment"]}),t.attributeToAttribute({model:{name:"table",key:"alignment",values:["left","right"]},view:{left:{key:"style",value:{float:"left"}},right:{key:"style",value:{float:"right"}}},converterPriority:"high"}),t.for("upcast").attributeToAttribute({view:{attributes:{align:Db}},model:{name:"table",key:"alignment",value:e=>e.getAttribute("align")}})}(t,o),e.commands.add("tableAlignment",new Fb(e)),Hb(t,o,"width","width"),e.commands.add("tableWidth",new zb(e)),Hb(t,o,"height","height"),e.commands.add("tableHeight",new Bb(e)),e.data.addStyleProcessorRules(xb),function(e,t,o,n){e.extend("table",{allowAttributes:[o]}),Ab(t,"table",o,n),Sb(t,o,n)}(t,o,"backgroundColor","background-color"),e.commands.add("tableBackgroundColor",new Rb(e))}}function Hb(e,t,o,n){e.extend("table",{allowAttributes:[o]}),Ab(t,"table",o,n),Pb(t,"table",o,n)}class jb extends Cc{constructor(e){super(e);const t=this.bindTemplate;this.set("color"),this.set("hasBorder"),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.035L8.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")},class:["ck","ck-color-grid__tile",t.if("hasBorder","ck-color-table__color-tile_bordered")]}})}render(){super.render(),this.iconView.fillColor="hsl(0, 0%, 100%)"}}o(100);class Wb extends dc{constructor(e,t){super(e);const o=t&&t.colorDefinitions||[],n={};t&&t.columns&&(n.gridTemplateColumns=`repeat( ${t.columns}, 1fr)`),this.set("selectedColor"),this.items=this.createCollection(),this.focusTracker=new Ac,this.keystrokes=new Bl,this._focusCycler=new Rc({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowleft",focusNext:"arrowright"}}),this.items.on("add",(e,t)=>{t.isOn=t.color===this.selectedColor}),o.forEach(e=>{const t=new jb;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:n}}),this.on("change:selectedColor",(e,t,o)=>{for(const e of this.items)e.isOn=e.color===o})}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)}}var qb='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8.636 9.531l-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>';o(102);class $b extends dc{constructor(e,t){super(e);const o=this.bindTemplate;this.set("value",""),this.set("id"),this.set("isReadOnly",!1),this.set("hasError",!1),this.set("ariaDescribedById"),this.options=t,this._dropdownView=this._createDropdownView(e),this._inputView=this._createInputTextView(e),this._stillTyping=!1,this.setTemplate({tag:"div",attributes:{class:["ck","ck-input-color",o.if("hasError","ck-error")],id:o.to("id"),"aria-invalid":o.if("hasError",!0),"aria-describedby":o.to("ariaDescribedById")},children:[this._inputView,this._dropdownView]}),this.on("change:value",(e,t,o)=>this._setInputValue(o))}focus(){this._inputView.focus()}_createDropdownView(){const e=this.locale,t=e.t,o=this.bindTemplate,n=this._createColorGrid(e),i=qc(e),r=new dc,s=this._createRemoveColorButton(e);return r.setTemplate({tag:"span",attributes:{class:["ck","ck-input-color__button__preview"],style:{backgroundColor:o.to("value")}},children:[{tag:"span",attributes:{class:["ck","ck-input-color__button__preview__no-color-indicator",o.if("value","ck-hidden",e=>""!=e)]}}]}),i.buttonView.extendTemplate({attributes:{class:"ck-input-color__button"}}),i.buttonView.children.add(r),i.buttonView.tooltip=t("Color picker"),i.panelPosition="rtl"===e.uiLanguageDirection?"se":"sw",i.panelView.children.add(s),i.panelView.children.add(n),i.bind("isEnabled").to(this,"isReadOnly",e=>!e),i}_createInputTextView(){const e=this.locale,t=new ru(e);return t.extendTemplate({on:{blur:t.bindTemplate.to("blur")}}),t.value=this.value,t.bind("isReadOnly").to(this),t.bind("hasError").to(this),t.on("input",()=>{const e=t.element.value,o=this.options.colorDefinitions.find(t=>e===t.label);this._stillTyping=!0,this.value=o&&o.color||e}),t.on("blur",()=>{this._stillTyping=!1,this._setInputValue(t.element.value)}),t.delegate("input").to(this),t}_createRemoveColorButton(){const e=this.locale,t=e.t,o=new Cc(e);return o.class="ck-input-color__remove-color",o.withText=!0,o.icon=qb,o.label=t("Remove color"),o.on("execute",()=>{this.value="",this._dropdownView.isOpen=!1,this.fire("input")}),o}_createColorGrid(e){const t=new Wb(e,{colorDefinitions:this.options.colorDefinitions,columns:this.options.columns});return t.on("execute",(e,t)=>{this.value=t.value,this._dropdownView.isOpen=!1,this.fire("input")}),t.bind("selectedColor").to(this,"value"),t}_setInputValue(e){if(!this._stillTyping){const t=Ub(e),o=this.options.colorDefinitions.find(e=>t===Ub(e.color));this._inputView.value=o?o.label:e||""}}}function Ub(e){return e.replace(/([(,])\s+/g,"$1").replace(/^\s+|\s+(?=[),\s]|$)/g,"").replace(/,|\s/g," ")}const Gb=e=>""===e;function Kb(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 Jb(e){return e('The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".')}function Yb(e){return e('The value is invalid. Try "10px" or "2em" or simply "2".')}function Qb(e){return e=e.trim(),Gb(e)||Gp(e)}function Xb(e){return e=e.trim(),Gb(e)||iw(e)||Qp(e)||(t=e,Xp.test(t));var t}function Zb(e){return e=e.trim(),Gb(e)||iw(e)||Qp(e)}function ew(e){const t=new Ao,o=Kb(e.t);for(const n in o){const i={type:"button",model:new bh({_borderStyleValue:"none"===n?"":n,label:o[n],withText:!0})};"none"===n?i.model.bind("isOn").to(e,"borderStyle",e=>!e):i.model.bind("isOn").to(e,"borderStyle",e=>e===n),t.add(i)}return t}function tw({view:e,icons:t,toolbar:o,labels:n,propertyName:i,nameToValue:r}){for(const s in n){const a=new Cc(e.locale);a.set({label:n[s],icon:t[s],tooltip:n[s]}),a.bind("isOn").to(e,i,e=>e===r(s)),a.on("execute",()=>{e[i]=r(s)}),o.items.add(a)}}const ow=[{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 nw(e){return(t,o,n)=>{const i=new $b(t.locale,{colorDefinitions:(r=e.colorConfig,r.map(e=>({color:e.model,label:e.label,options:{hasBorder:e.hasBorder}}))),columns:e.columns});var r;return i.set({id:o,ariaDescribedById:n}),i.bind("isReadOnly").to(t,"isEnabled",e=>!e),i.bind("errorText").to(t),i.on("input",()=>{t.errorText=null}),i}}function iw(e){const t=parseFloat(e);return!Number.isNaN(t)&&e===String(t)}o(104);class rw extends dc{constructor(e,t={}){super(e);const o=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",o.to("class")],role:o.to("_role"),"aria-labelledby":o.to("_ariaLabelledBy")},children:this.children})}}o(106);class sw extends dc{constructor(e,t={}){super(e);const o=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",o.to("class")]},children:this.children});const n=new dc(e);n.setTemplate({tag:"span",attributes:{class:["ck","ck-form__header__label"]},children:[{text:o.to("label")}]}),this.children.add(n)}}o(13),o(14),o(110);const aw={left:Au,center:Tu,right:Pu};class lw extends dc{constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",backgroundColor:"",width:"",height:"",alignment:""}),this.options=t;const{borderStyleDropdown:o,borderWidthInput:n,borderColorInput:i,borderRowLabel:r}=this._createBorderFields(),{widthInput:s,operatorLabel:a,heightInput:l,dimensionsLabel:c}=this._createDimensionFields(),{alignmentToolbar:d,alignmentLabel:h}=this._createAlignmentFields();this.focusTracker=new Ac,this.keystrokes=new Bl,this.children=this.createCollection(),this.borderStyleDropdown=o,this.borderWidthInput=n,this.borderColorInput=i,this.backgroundInput=this._createBackgroundField(),this.widthInput=s,this.heightInput=l,this.alignmentToolbar=d;const{saveButtonView:u,cancelButtonView:m}=this._createActionButtons();this.saveButtonView=u,this.cancelButtonView=m,this._focusables=new ql,this._focusCycler=new Rc({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new sw(e,{label:this.t("Table properties")})),this.children.add(new rw(e,{labelView:r,children:[r,o,i,n],class:"ck-table-form__border-row"})),this.children.add(new rw(e,{children:[this.backgroundInput]})),this.children.add(new rw(e,{children:[new rw(e,{labelView:c,children:[c,s,a,l],class:"ck-table-form__dimensions-row"}),new rw(e,{labelView:h,children:[h,d],class:"ck-table-properties-form__alignment-row"})]})),this.children.add(new rw(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(),lu({view:this}),[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)}focus(){this._focusCycler.focusFirst()}_createBorderFields(){const e=nw({colorConfig:this.options.borderColors,columns:5}),t=this.locale,o=this.t,n=new nu(t);n.text=o("Border");const i=Kb(this.t),r=new iu(t,au);r.set({label:o("Style"),class:"ck-table-form__border-style"}),r.fieldView.buttonView.set({isOn:!1,withText:!0,tooltip:o("Style")}),r.fieldView.buttonView.bind("label").to(this,"borderStyle",e=>i[e||"none"]),r.fieldView.on("execute",e=>{this.borderStyle=e.source._borderStyleValue}),$c(r.fieldView,ew(this));const s=new iu(t,su);s.set({label:o("Width"),class:"ck-table-form__border-width"}),s.fieldView.bind("value").to(this,"borderWidth"),s.bind("isEnabled").to(this,"borderStyle",cw),s.fieldView.on("input",()=>{this.borderWidth=s.fieldView.element.value});const a=new iu(t,e);return a.set({label:o("Color"),class:"ck-table-form__border-color"}),a.fieldView.bind("value").to(this,"borderColor"),a.bind("isEnabled").to(this,"borderStyle",cw),a.fieldView.on("input",()=>{this.borderColor=a.fieldView.value}),this.on("change:borderStyle",(e,t,o)=>{cw(o)||(this.borderColor="",this.borderWidth="")}),{borderRowLabel:n,borderStyleDropdown:r,borderColorInput:a,borderWidthInput:s}}_createBackgroundField(){const e=nw({colorConfig:this.options.backgroundColors,columns:5}),t=this.locale,o=this.t,n=new iu(t,e);return n.set({label:o("Background"),class:"ck-table-properties-form__background"}),n.fieldView.bind("value").to(this,"backgroundColor"),n.fieldView.on("input",()=>{this.backgroundColor=n.fieldView.value}),n}_createDimensionFields(){const e=this.locale,t=this.t,o=new nu(e);o.text=t("Dimensions");const n=new iu(e,su);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 i=new dc(e);i.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const r=new iu(e,su);return r.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),r.fieldView.bind("value").to(this,"height"),r.fieldView.on("input",()=>{this.height=r.fieldView.element.value}),{dimensionsLabel:o,widthInput:n,operatorLabel:i,heightInput:r}}_createAlignmentFields(){const e=this.locale,t=this.t,o=new nu(e);o.text=t("Alignment");const n=new Uc(e);return n.set({isCompact:!0,ariaLabel:t("Table alignment toolbar")}),tw({view:this,icons:aw,toolbar:n,labels:this._alignmentLabels,propertyName:"alignment",nameToValue:e=>"center"===e?"":e}),{alignmentLabel:o,alignmentToolbar:n}}_createActionButtons(){const e=this.locale,t=this.t,o=new Cc(e),n=new Cc(e),i=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.widthInput,this.heightInput];return o.set({label:t("Save"),icon:cu,class:"ck-button-save",type:"submit",withText:!0}),o.bind("isEnabled").toMany(i,"errorText",(...e)=>e.every(e=>!e)),n.set({label:t("Cancel"),icon:du,class:"ck-button-cancel",type:"cancel",withText:!0}),n.delegate("execute").to(this,"cancel"),{saveButtonView:o,cancelButtonView:n}}get _alignmentLabels(){const e=this.locale,t=this.t,o=t("Align table to the left"),n=t("Center table"),i=t("Align table to the right");return"rtl"===e.uiLanguageDirection?{right:i,center:n,left:o}:{left:o,center:n,right:i}}}function cw(e){return!!e}function dw(e,t){const o=e.t,n={Black:o("Black"),"Dim grey":o("Dim grey"),Grey:o("Grey"),"Light grey":o("Light grey"),White:o("White"),Red:o("Red"),Orange:o("Orange"),Yellow:o("Yellow"),"Light green":o("Light green"),Green:o("Green"),Aquamarine:o("Aquamarine"),Turquoise:o("Turquoise"),"Light blue":o("Light blue"),Blue:o("Blue"),Purple:o("Purple")};return t.map(e=>{const t=n[e.label];return t&&t!=e.label&&(e.label=t),e})}function hw(e){return e.map(uw).filter(e=>!!e)}function uw(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}}}}const mw=wc.defaultPositions,gw=[mw.northArrowSouth,mw.northArrowSouthWest,mw.northArrowSouthEast,mw.southArrowNorth,mw.southArrowNorthWest,mw.southArrowNorthEast],fw=[...gw,Oh];function pw(e,t){const o=e.plugins.get("ContextualBalloon");if(Dp(e.editing.view.document.selection)){let n;n="cell"===t?ww(e):bw(e),o.updatePosition(n)}}function bw(e){const t=e.model.document.selection.getFirstPosition().findAncestor("table"),o=e.editing.mapper.toViewElement(t);return{target:e.editing.view.domConverter.viewToDom(o),positions:fw}}function ww(e){const t=e.editing.mapper,o=e.editing.view.domConverter,n=e.model.document.selection;if(n.rangeCount>1)return{target:()=>function(e,t){const o=t.editing.mapper,n=t.editing.view.domConverter,i=Array.from(e).map(e=>{const t=kw(e.start),i=o.toViewElement(t);return new is(n.viewToDom(i))});return is.getBoundingRect(i)}(n.getRanges(),e),positions:gw};const i=kw(n.getFirstPosition()),r=t.toViewElement(i);return{target:o.viewToDom(r),positions:gw}}function kw(e){return e.nodeAfter&&e.nodeAfter.is("element","tableCell")?e.nodeAfter:e.findAncestor("tableCell")}const _w={borderStyle:"tableBorderStyle",borderColor:"tableBorderColor",borderWidth:"tableBorderWidth",backgroundColor:"tableBackgroundColor",width:"tableWidth",height:"tableHeight",alignment:"tableAlignment"};class vw extends jl{static get requires(){return[Pc]}static get pluginName(){return"TablePropertiesUI"}constructor(e){super(e),e.config.define("table.tableProperties",{borderColors:ow,backgroundColors:ow})}init(){const e=this.editor,t=e.t;this._balloon=e.plugins.get(Pc),this.view=this._createPropertiesView(),this._undoStepBatch=null,e.ui.componentFactory.add("tableProperties",o=>{const n=new Cc(o);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.5l1.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 i=Object.values(_w).map(t=>e.commands.get(t));return n.bind("isEnabled").toMany(i,"isEnabled",(...e)=>e.some(e=>e)),n})}destroy(){super.destroy(),this.view.destroy()}_createPropertiesView(){const e=this.editor,t=e.editing.view.document,o=e.config.get("table.tableProperties"),n=hw(o.borderColors),i=dw(e.locale,n),r=hw(o.backgroundColors),s=dw(e.locale,r),a=new lw(e.locale,{borderColors:i,backgroundColors:s}),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()}),this.listenTo(e.ui,"update",()=>{Dp(t.selection)?this._isViewVisible&&pw(e,"table"):this._hideView()}),Wc({emitter:a,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const c=Jb(l),d=Yb(l);return a.on("change:borderStyle",this._getPropertyChangeCallback("tableBorderStyle")),a.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:a.borderColorInput,commandName:"tableBorderColor",errorText:c,validator:Qb})),a.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:a.borderWidthInput,commandName:"tableBorderWidth",errorText:d,validator:Zb})),a.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:a.backgroundInput,commandName:"tableBackgroundColor",errorText:c,validator:Qb})),a.on("change:width",this._getValidatedPropertyChangeCallback({viewField:a.widthInput,commandName:"tableWidth",errorText:d,validator:Xb})),a.on("change:height",this._getValidatedPropertyChangeCallback({viewField:a.heightInput,commandName:"tableHeight",errorText:d,validator:Xb})),a.on("change:alignment",this._getPropertyChangeCallback("tableAlignment")),a}_fillViewFormFromCommandValues(){const e=this.editor.commands;Object.entries(_w).map(([t,o])=>[t,e.get(o).value||""]).forEach(([e,t])=>this.view.set(e,t))}_showView(){const e=this.editor;this._balloon.add({view:this.view,position:bw(e)}),this._undoStepBatch=e.model.createBatch(),this._fillViewFormFromCommandValues(),this.view.focus()}_hideView(){if(!this._isViewInBalloon)return;const e=this.editor;this.stopListening(e.ui,"update"),this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}get _isViewVisible(){return this._balloon.visibleView===this.view}get _isViewInBalloon(){return this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,o,n)=>{this.editor.execute(e,{value:n,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback({commandName:e,viewField:t,validator:o,errorText:n}){const i=Jr(()=>{t.errorText=n},500);return(n,r,s)=>{i.cancel(),o(s)?(this.editor.execute(e,{value:s,batch:this._undoStepBatch}),t.errorText=null):i()}}}o(112);const yw={left:'<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>',center:'<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>',right:'<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>',justify:'<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>',top:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.261 7.062l2.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>',middle:'<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>',bottom:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.239 13.938l-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>'};class xw extends dc{constructor(e,t){super(e),this.set({borderStyle:"",borderWidth:"",borderColor:"",padding:"",backgroundColor:"",width:"",height:"",horizontalAlignment:"",verticalAlignment:""}),this.options=t;const{borderStyleDropdown:o,borderWidthInput:n,borderColorInput:i,borderRowLabel:r}=this._createBorderFields(),{widthInput:s,operatorLabel:a,heightInput:l,dimensionsLabel:c}=this._createDimensionFields(),{horizontalAlignmentToolbar:d,verticalAlignmentToolbar:h,alignmentLabel:u}=this._createAlignmentFields();this.focusTracker=new Ac,this.keystrokes=new Bl,this.children=this.createCollection(),this.borderStyleDropdown=o,this.borderWidthInput=n,this.borderColorInput=i,this.backgroundInput=this._createBackgroundField(),this.paddingInput=this._createPaddingField(),this.widthInput=s,this.heightInput=l,this.horizontalAlignmentToolbar=d,this.verticalAlignmentToolbar=h;const{saveButtonView:m,cancelButtonView:g}=this._createActionButtons();this.saveButtonView=m,this.cancelButtonView=g,this._focusables=new ql,this._focusCycler=new Rc({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.children.add(new sw(e,{label:this.t("Cell properties")})),this.children.add(new rw(e,{labelView:r,children:[r,o,i,n],class:"ck-table-form__border-row"})),this.children.add(new rw(e,{children:[this.backgroundInput]})),this.children.add(new rw(e,{children:[new rw(e,{labelView:c,children:[c,s,a,l],class:"ck-table-form__dimensions-row"}),new rw(e,{children:[this.paddingInput],class:"ck-table-cell-properties-form__padding-row"})]})),this.children.add(new rw(e,{labelView:u,children:[u,d,h],class:"ck-table-cell-properties-form__alignment-row"})),this.children.add(new rw(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(),lu({view:this}),[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)}focus(){this._focusCycler.focusFirst()}_createBorderFields(){const e=nw({colorConfig:this.options.borderColors,columns:5}),t=this.locale,o=this.t,n=new nu(t);n.text=o("Border");const i=Kb(o),r=new iu(t,au);r.set({label:o("Style"),class:"ck-table-form__border-style"}),r.fieldView.buttonView.set({isOn:!1,withText:!0,tooltip:o("Style")}),r.fieldView.buttonView.bind("label").to(this,"borderStyle",e=>i[e||"none"]),r.fieldView.on("execute",e=>{this.borderStyle=e.source._borderStyleValue}),$c(r.fieldView,ew(this));const s=new iu(t,su);s.set({label:o("Width"),class:"ck-table-form__border-width"}),s.fieldView.bind("value").to(this,"borderWidth"),s.bind("isEnabled").to(this,"borderStyle",Cw),s.fieldView.on("input",()=>{this.borderWidth=s.fieldView.element.value});const a=new iu(t,e);return a.set({label:o("Color"),class:"ck-table-form__border-color"}),a.fieldView.bind("value").to(this,"borderColor"),a.bind("isEnabled").to(this,"borderStyle",Cw),a.fieldView.on("input",()=>{this.borderColor=a.fieldView.value}),this.on("change:borderStyle",(e,t,o)=>{Cw(o)||(this.borderColor="",this.borderWidth="")}),{borderRowLabel:n,borderStyleDropdown:r,borderColorInput:a,borderWidthInput:s}}_createBackgroundField(){const e=this.locale,t=this.t,o=nw({colorConfig:this.options.backgroundColors,columns:5}),n=new iu(e,o);return n.set({label:t("Background"),class:"ck-table-cell-properties-form__background"}),n.fieldView.bind("value").to(this,"backgroundColor"),n.fieldView.on("input",()=>{this.backgroundColor=n.fieldView.value}),n}_createDimensionFields(){const e=this.locale,t=this.t,o=new nu(e);o.text=t("Dimensions");const n=new iu(e,su);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 i=new dc(e);i.setTemplate({tag:"span",attributes:{class:["ck-table-form__dimension-operator"]},children:[{text:"×"}]});const r=new iu(e,su);return r.set({label:t("Height"),class:"ck-table-form__dimensions-row__height"}),r.fieldView.bind("value").to(this,"height"),r.fieldView.on("input",()=>{this.height=r.fieldView.element.value}),{dimensionsLabel:o,widthInput:n,operatorLabel:i,heightInput:r}}_createPaddingField(){const e=this.locale,t=this.t,o=new iu(e,su);return o.set({label:t("Padding"),class:"ck-table-cell-properties-form__padding"}),o.fieldView.bind("value").to(this,"padding"),o.fieldView.on("input",()=>{this.padding=o.fieldView.element.value}),o}_createAlignmentFields(){const e=this.locale,t=this.t,o=new nu(e);o.text=t("Table cell text alignment");const n=new Uc(e),i="rtl"===this.locale.contentLanguageDirection;n.set({isCompact:!0,ariaLabel:t("Horizontal text alignment toolbar")}),tw({view:this,icons:yw,toolbar:n,labels:this._horizontalAlignmentLabels,propertyName:"horizontalAlignment",nameToValue:e=>e===(i?"right":"left")?"":e});const r=new Uc(e);return r.set({isCompact:!0,ariaLabel:t("Vertical text alignment toolbar")}),tw({view:this,icons:yw,toolbar:r,labels:this._verticalAlignmentLabels,propertyName:"verticalAlignment",nameToValue:e=>"middle"===e?"":e}),{horizontalAlignmentToolbar:n,verticalAlignmentToolbar:r,alignmentLabel:o}}_createActionButtons(){const e=this.locale,t=this.t,o=new Cc(e),n=new Cc(e),i=[this.borderWidthInput,this.borderColorInput,this.backgroundInput,this.paddingInput];return o.set({label:t("Save"),icon:cu,class:"ck-button-save",type:"submit",withText:!0}),o.bind("isEnabled").toMany(i,"errorText",(...e)=>e.every(e=>!e)),n.set({label:t("Cancel"),icon:du,class:"ck-button-cancel",type:"cancel",withText:!0}),n.delegate("execute").to(this,"cancel"),{saveButtonView:o,cancelButtonView:n}}get _horizontalAlignmentLabels(){const e=this.locale,t=this.t,o=t("Align cell text to the left"),n=t("Align cell text to the center"),i=t("Align cell text to the right"),r=t("Justify cell text");return"rtl"===e.uiLanguageDirection?{right:i,center:n,left:o,justify:r}:{left:o,center:n,right:i,justify:r}}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 Cw(e){return!!e}const Aw={borderStyle:"tableCellBorderStyle",borderColor:"tableCellBorderColor",borderWidth:"tableCellBorderWidth",width:"tableCellWidth",height:"tableCellHeight",padding:"tableCellPadding",backgroundColor:"tableCellBackgroundColor",horizontalAlignment:"tableCellHorizontalAlignment",verticalAlignment:"tableCellVerticalAlignment"};class Tw extends jl{static get requires(){return[Pc]}static get pluginName(){return"TableCellPropertiesUI"}constructor(e){super(e),e.config.define("table.tableCellProperties",{borderColors:ow,backgroundColors:ow})}init(){const e=this.editor,t=e.t;this._balloon=e.plugins.get(Pc),this.view=this._createPropertiesView(),this._undoStepBatch=null,e.ui.componentFactory.add("tableCellProperties",o=>{const n=new Cc(o);n.set({label:t("Cell properties"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M11.105 18l-.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.5l1.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 i=Object.values(Aw).map(t=>e.commands.get(t));return n.bind("isEnabled").toMany(i,"isEnabled",(...e)=>e.some(e=>e)),n})}destroy(){super.destroy(),this.view.destroy()}_createPropertiesView(){const e=this.editor,t=e.editing.view.document,o=e.config.get("table.tableCellProperties"),n=hw(o.borderColors),i=dw(e.locale,n),r=hw(o.backgroundColors),s=dw(e.locale,r),a=new xw(e.locale,{borderColors:i,backgroundColors:s}),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()}),this.listenTo(e.ui,"update",()=>{Dp(t.selection)?this._isViewVisible&&pw(e,"cell"):this._hideView()}),Wc({emitter:a,activator:()=>this._isViewInBalloon,contextElements:[this._balloon.view.element],callback:()=>this._hideView()});const c=Jb(l),d=Yb(l);return a.on("change:borderStyle",this._getPropertyChangeCallback("tableCellBorderStyle")),a.on("change:borderColor",this._getValidatedPropertyChangeCallback({viewField:a.borderColorInput,commandName:"tableCellBorderColor",errorText:c,validator:Qb})),a.on("change:borderWidth",this._getValidatedPropertyChangeCallback({viewField:a.borderWidthInput,commandName:"tableCellBorderWidth",errorText:d,validator:Zb})),a.on("change:padding",this._getValidatedPropertyChangeCallback({viewField:a.paddingInput,commandName:"tableCellPadding",errorText:d,validator:Xb})),a.on("change:width",this._getValidatedPropertyChangeCallback({viewField:a.widthInput,commandName:"tableCellWidth",errorText:d,validator:Xb})),a.on("change:height",this._getValidatedPropertyChangeCallback({viewField:a.heightInput,commandName:"tableCellHeight",errorText:d,validator:Xb})),a.on("change:backgroundColor",this._getValidatedPropertyChangeCallback({viewField:a.backgroundInput,commandName:"tableCellBackgroundColor",errorText:c,validator:Qb})),a.on("change:horizontalAlignment",this._getPropertyChangeCallback("tableCellHorizontalAlignment")),a.on("change:verticalAlignment",this._getPropertyChangeCallback("tableCellVerticalAlignment")),a}_fillViewFormFromCommandValues(){const e=this.editor.commands;Object.entries(Aw).map(([t,o])=>[t,e.get(o).value||""]).forEach(([e,t])=>this.view.set(e,t))}_showView(){const e=this.editor;this._balloon.add({view:this.view,position:ww(e)}),this._undoStepBatch=e.model.createBatch(),this._fillViewFormFromCommandValues(),this.view.focus()}_hideView(){if(!this._isViewInBalloon)return;const e=this.editor;this.stopListening(e.ui,"update"),this.view.saveButtonView.focus(),this._balloon.remove(this.view),this.editor.editing.view.focus()}get _isViewVisible(){return this._balloon.visibleView===this.view}get _isViewInBalloon(){return this._balloon.hasView(this.view)}_getPropertyChangeCallback(e){return(t,o,n)=>{this.editor.execute(e,{value:n,batch:this._undoStepBatch})}}_getValidatedPropertyChangeCallback({commandName:e,viewField:t,validator:o,errorText:n}){const i=Jr(()=>{t.errorText=n},500);return(n,r,s)=>{i.cancel(),o(s)?(this.editor.execute(e,{value:s,batch:this._undoStepBatch}),t.errorText=null):i()}}}function Pw(e){e.setNormalizer("padding",cb("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",ab("padding")),e.setStyleRelation("padding",["padding-top","padding-right","padding-bottom","padding-left"])}class Sw extends Vd{constructor(e,t){super(e),this.attributeName=t}refresh(){const e=Sf(this.editor.model.document.selection);this.isEnabled=!!e.length,this.value=this._getSingleValue(e)}execute(e={}){const{value:t,batch:o}=e,n=this.editor.model,i=Sf(n.document.selection),r=this._getValueToSet(t);n.enqueueChange(o||"default",e=>{r?i.forEach(t=>e.setAttribute(this.attributeName,r,t)):i.forEach(t=>e.removeAttribute(this.attributeName,t))})}_getAttribute(e){if(e)return e.getAttribute(this.attributeName)}_getValueToSet(e){return e}_getSingleValue(e){const t=this._getAttribute(e[0]);return e.every(e=>this._getAttribute(e)===t)?t:void 0}}class Ew extends Sw{constructor(e){super(e,"padding")}_getAttribute(e){if(e)return Ib(e.getAttribute(this.attributeName))}_getValueToSet(e){return Vb(e,"px")}}class Rw extends Sw{constructor(e){super(e,"width")}_getValueToSet(e){return Vb(e,"px")}}class Iw extends Sw{constructor(e){super(e,"height")}_getValueToSet(e){return Vb(e,"px")}}class Vw extends Sw{constructor(e){super(e,"backgroundColor")}}class Ow extends Sw{constructor(e){super(e,"verticalAlignment")}}class Mw extends Sw{constructor(e){super(e,"horizontalAlignment")}}class Nw extends Sw{constructor(e){super(e,"borderStyle")}_getAttribute(e){if(e)return Ib(e.getAttribute(this.attributeName))}}class zw extends Sw{constructor(e){super(e,"borderColor")}_getAttribute(e){if(e)return Ib(e.getAttribute(this.attributeName))}}class Bw extends Sw{constructor(e){super(e,"borderWidth")}_getAttribute(e){if(e)return Ib(e.getAttribute(this.attributeName))}_getValueToSet(e){return Vb(e,"px")}}const Fw=/^(top|bottom)$/;class Dw extends jl{static get pluginName(){return"TableCellPropertiesEditing"}static get requires(){return[Cp]}init(){const e=this.editor,t=e.model.schema,o=e.conversion,n=e.locale;e.data.addStyleProcessorRules(hb),function(e,t){e.extend("tableCell",{allowAttributes:["borderWidth","borderColor","borderStyle"]}),Tb(t,"td"),Tb(t,"th"),Pb(t,"tableCell","borderStyle","border-style"),Pb(t,"tableCell","borderColor","border-color"),Pb(t,"tableCell","borderWidth","border-width")}(t,o),e.commands.add("tableCellBorderStyle",new Nw(e)),e.commands.add("tableCellBorderColor",new zw(e)),e.commands.add("tableCellBorderWidth",new Bw(e)),function(e,t,o){e.extend("tableCell",{allowAttributes:["horizontalAlignment"]});const n=["rtl"==o.contentLanguageDirection?"left":"right","center","justify"];t.attributeToAttribute({model:{name:"tableCell",key:"horizontalAlignment",values:n},view:n.reduce((e,t)=>({...e,[t]:{key:"style",value:{"text-align":t}}}),{})})}(t,o,n),e.commands.add("tableCellHorizontalAlignment",new Mw(e)),Lw(t,o,"width","width"),e.commands.add("tableCellWidth",new Rw(e)),Lw(t,o,"height","height"),e.commands.add("tableCellHeight",new Iw(e)),e.data.addStyleProcessorRules(Pw),Lw(t,o,"padding","padding"),e.commands.add("tableCellPadding",new Ew(e)),e.data.addStyleProcessorRules(xb),Lw(t,o,"backgroundColor","background-color"),e.commands.add("tableCellBackgroundColor",new Vw(e)),function(e,t){e.extend("tableCell",{allowAttributes:["verticalAlignment"]}),t.attributeToAttribute({model:{name:"tableCell",key:"verticalAlignment",values:["top","bottom"]},view:{top:{key:"style",value:{"vertical-align":"top"}},bottom:{key:"style",value:{"vertical-align":"bottom"}}}}),t.for("upcast").attributeToAttribute({view:{attributes:{valign:Fw}},model:{name:"tableCell",key:"verticalAlignment",value:e=>e.getAttribute("valign")}})}(t,o),e.commands.add("tableCellVerticalAlignment",new Ow(e))}}function Lw(e,t,o,n){e.extend("tableCell",{allowAttributes:[o]}),Ab(t,"tableCell",o,n),Pb(t,"tableCell",o,n)}o(114);const Hw=fc("px");class jw extends Cc{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=>Hw(e)),left:t.to("left",e=>Hw(e))}}})}}const Ww=fc("px");const qw={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.53l1.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.607l1.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.973l-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>'};var $w=/[\\^$.*+?()[\]{}|]/g,Uw=RegExp($w.source);var Gw=function(e){return(e=Zo(e))&&Uw.test(e)?e.replace($w,"\\$&"):e};const Kw={copyright:{from:"(c)",to:"©"},registeredTrademark:{from:"(r)",to:"®"},trademark:{from:"(tm)",to:"™"},oneHalf:{from:"1/2",to:"½"},oneThird:{from:"1/3",to:"⅓"},twoThirds:{from:"2/3",to:"⅔"},oneForth:{from:"1/4",to:"¼"},threeQuarters:{from:"3/4",to:"¾"},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:ek('"'),to:[null,"“",null,"”"]},quotesSecondary:{from:ek("'"),to:[null,"",null,""]},quotesPrimaryEnGb:{from:ek("'"),to:[null,"",null,""]},quotesSecondaryEnGb:{from:ek('"'),to:[null,"“",null,"”"]},quotesPrimaryPl:{from:ek('"'),to:[null,"„",null,"”"]},quotesSecondaryPl:{from:ek("'"),to:[null,"",null,""]}},Jw={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},Yw=["symbols","mathematical","typography","quotes"];function Qw(e){return"string"==typeof e?new RegExp(`(${Gw(e)})$`):e}function Xw(e){return"string"==typeof e?()=>[e]:e instanceof Array?()=>e:e}function Zw(e){return(e.textNode?e.textNode:e.nodeAfter).getAttributes()}function ek(e){return new RegExp(`(^|\\s)(${e})([^${e}]*)(${e})$`)}class tk extends Vd{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,o=t.document.selection,n=e.value;t.change(e=>{if(o.isCollapsed)n?e.setSelectionAttribute(this.attributeKey,n):e.removeSelectionAttribute(this.attributeKey);else{const i=t.schema.getValidRanges(o.getRanges(),this.attributeKey);for(const t of i)n?e.setAttribute(this.attributeKey,n,t):e.removeAttribute(this.attributeKey,t)}})}}class ok extends Ao{constructor(e){super(e),this.set("isEmpty",!0),this.on("change",()=>{this.set("isEmpty",0===this.length)})}add(e,t){this.find(t=>t.color===e.color)||super.add(e,t)}hasColor(e){return!!this.find(t=>t.color===e)}}Co(ok,qn);o(116);class nk extends dc{constructor(e,{colors:t,columns:o,removeButtonLabel:n,documentColorsLabel:i,documentColorsCount:r}){super(e),this.items=this.createCollection(),this.colorDefinitions=t,this.focusTracker=new Ac,this.keystrokes=new Bl,this.set("selectedColor"),this.removeButtonLabel=n,this.columns=o,this.documentColors=new ok,this.documentColorsCount=r,this._focusCycler=new Rc({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowup",focusNext:"arrowdown"}}),this._documentColorsLabel=i,this.setTemplate({tag:"div",attributes:{class:["ck","ck-color-table"]},children:this.items}),this.items.add(this._removeColorButton())}updateDocumentColors(e,t){const o=e.document,n=this.documentColorsCount;this.documentColors.clear();for(const i of o.getRootNames()){const r=o.getRoot(i),s=e.createRangeIn(r);for(const e of s.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,o=this.selectedColor;t.selectedColor=o,e&&(e.selectedColor=o)}render(){super.render();for(const e of this.items)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element)}appendGrids(){if(!this.staticColorsGrid&&(this.staticColorsGrid=this._createStaticColorsGrid(),this.items.add(this.staticColorsGrid),this.documentColorsCount)){const e=$l.bind(this.documentColors,this.documentColors),t=new nu(this.locale);t.text=this._documentColorsLabel,t.extendTemplate({attributes:{class:["ck","ck-color-grid__label",e.if("isEmpty","ck-hidden")]}}),this.items.add(t),this.documentColorsGrid=this._createDocumentColorsGrid(),this.items.add(this.documentColorsGrid)}}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}_removeColorButton(){const e=new Cc;return e.set({withText:!0,icon:qb,tooltip:!0,label:this.removeButtonLabel}),e.class="ck-color-table__remove-color",e.on("execute",()=>{this.fire("execute",{value:null})}),e}_createStaticColorsGrid(){const e=new Wb(this.locale,{colorDefinitions:this.colorDefinitions,columns:this.columns});return e.delegate("execute").to(this),e}_createDocumentColorsGrid(){const e=$l.bind(this.documentColors,this.documentColors),t=new Wb(this.locale,{columns:this.columns});return t.delegate("execute").to(this),t.extendTemplate({attributes:{class:e.if("isEmpty","ck-hidden")}}),t.items.bindTo(this.documentColors).using(e=>{const t=new jb;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})}),t}),this.documentColors.on("change:isEmpty",(e,o,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}})}}function ik(e,t){const o={model:{key:e,values:[]},view:{},upcastAlso:{}};for(const e of t)o.model.values.push(e.model),o.view[e.model]=e.view,e.upcastAlso&&(o.upcastAlso[e.model]=e.upcastAlso);return o}function rk(e){return t=>t.getStyle(e).replace(/\s/g,"")}function sk(e){return(t,{writer:o})=>o.createAttributeElement("span",{style:`${e}:${t}`},{priority:7})}class ak extends tk{constructor(e){super(e,"fontFamily")}}function lk(e){return e.map(ck).filter(e=>!!e)}function ck(e){return"object"==typeof e?e:"default"===e?{title:"Default",model:void 0}:"string"==typeof e?function(e){const t=e.replace(/"|'/g,"").split(","),o=t[0],n=t.map(dk).join(", ");return{title:o,model:n,view:{name:"span",styles:{"font-family":n},priority:7}}}(e):void 0}function dk(e){return(e=e.trim()).indexOf(" ")>0&&(e=`'${e}'`),e}class hk extends jl{static get pluginName(){return"FontFamilyEditing"}constructor(e){super(e),e.config.define("fontFamily",{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:"fontFamily"}),e.model.schema.setAttributeProperties("fontFamily",{isFormatting:!0,copyOnEnter:!0});const t=ik("fontFamily",lk(e.config.get("fontFamily.options")).filter(e=>e.model));e.config.get("fontFamily.supportAllValues")?this._prepareAnyValueConverters():e.conversion.attributeToElement(t),e.commands.add("fontFamily",new ak(e))}_prepareAnyValueConverters(){const e=this.editor;e.conversion.for("downcast").attributeToElement({model:"fontFamily",view:(e,{writer:t})=>t.createAttributeElement("span",{style:"font-family:"+e},{priority:7})}),e.conversion.for("upcast").attributeToAttribute({model:{key:"fontFamily",value:e=>e.getStyle("font-family")},view:{name:"span",styles:{"font-family":/.*/}}})}}class uk extends jl{init(){const e=this.editor,t=e.t,o=this._getLocalizedOptions(),n=e.commands.get("fontFamily");e.ui.componentFactory.add("fontFamily",i=>{const r=qc(i);return $c(r,function(e,t){const o=new Ao;for(const n of e){const e={type:"button",model:new bh({commandName:"fontFamily",commandParam:n.model,label:n.title,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&&n.view.styles&&e.model.set("labelStyle","font-family: "+n.view.styles["font-family"]),o.add(e)}return o}(o,n)),r.buttonView.set({label:t("Font Family"),icon:'<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>',tooltip:!0}),r.extendTemplate({attributes:{class:"ck-font-family-dropdown"}}),r.bind("isEnabled").to(n),this.listenTo(r,"execute",t=>{e.execute(t.source.commandName,{value:t.source.commandParam}),e.editing.view.focus()}),r})}_getLocalizedOptions(){const e=this.editor,t=e.t;return lk(e.config.get("fontFamily").options).map(e=>("Default"===e.title&&(e.title=t("Default")),e))}}class mk extends jl{static get requires(){return[hk,uk]}static get pluginName(){return"FontFamily"}}class gk extends tk{constructor(e){super(e,"fontSize")}}function fk(e){return e.map(e=>function(e){if(t=e,"object"==typeof t&&t.title&&t.model&&t.view)return bk(e);var t;const o=function(e){return pk[e]||pk[e.model]}(e);if(o)return bk(o);if("default"===e)return{model:void 0,title:"Default"};if(function(e){let t;if("object"==typeof e){if(!e.model)throw new mo.b("font-size-invalid-definition: Provided font size definition is invalid.",null,e);t=parseFloat(e.model)}else t=parseFloat(e);return isNaN(t)}(e))return;return function(e){"number"!=typeof e&&"string"!=typeof e||(e={title:String(e),model:parseFloat(e)+"px"});return e.view={name:"span",styles:{"font-size":e.model}},bk(e)}(e)}(e)).filter(e=>!!e)}const pk={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 bk(e){return e.view.priority||(e.view.priority=7),e}class wk extends jl{static get pluginName(){return"FontSizeEditing"}constructor(e){super(e),e.config.define("fontSize",{options:["tiny","small","default","big","huge"],supportAllValues:!1})}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:"fontSize"}),e.model.schema.setAttributeProperties("fontSize",{isFormatting:!0,copyOnEnter:!0});const t=e.config.get("fontSize.supportAllValues"),o=ik("fontSize",fk(this.editor.config.get("fontSize.options")).filter(e=>e.model));t?this._prepareAnyValueConverters(o):e.conversion.attributeToElement(o),e.commands.add("fontSize",new gk(e))}_prepareAnyValueConverters(e){const t=this.editor,o=e.model.values.filter(e=>!String(e).match(/[\d.]+[\w%]+/));if(o.length)throw new mo.b("font-size-invalid-use-of-named-presets: If config.fontSize.supportAllValues is set to true, you need to use numerical values as font size options.",null,{presets:o});t.conversion.for("downcast").attributeToElement({model:"fontSize",view:(e,{writer:t})=>{if(e)return t.createAttributeElement("span",{style:"font-size:"+e},{priority:7})}}),t.conversion.for("upcast").attributeToAttribute({model:{key:"fontSize",value:e=>e.getStyle("font-size")},view:{name:"span"}})}}o(118);class kk extends jl{init(){const e=this.editor,t=e.t,o=this._getLocalizedOptions(),n=e.commands.get("fontSize");e.ui.componentFactory.add("fontSize",i=>{const r=qc(i);return $c(r,function(e,t){const o=new Ao;for(const n of e){const e={type:"button",model:new bh({commandName:"fontSize",commandParam:n.model,label:n.title,class:"ck-fontsize-option",withText:!0})};n.view&&n.view.styles&&e.model.set("labelStyle","font-size:"+n.view.styles["font-size"]),n.view&&n.view.classes&&e.model.set("class",`${e.model.class} ${n.view.classes}`),e.model.bind("isOn").to(t,"value",e=>e===n.model),o.add(e)}return o}(o,n)),r.buttonView.set({label:t("Font Size"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M9.816 11.5L7.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.279l.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>',tooltip:!0}),r.extendTemplate({attributes:{class:["ck-font-size-dropdown"]}}),r.bind("isEnabled").to(n),this.listenTo(r,"execute",t=>{e.execute(t.source.commandName,{value:t.source.commandParam}),e.editing.view.focus()}),r})}_getLocalizedOptions(){const e=this.editor,t=e.t,o={Default:t("Default"),Tiny:t("Tiny"),Small:t("Small"),Big:t("Big"),Huge:t("Huge")};return fk(e.config.get("fontSize").options).map(e=>{const t=o[e.title];return t&&t!=e.title&&(e=Object.assign({},e,{title:t})),e})}}class _k extends jl{static get requires(){return[wk,kk]}static get pluginName(){return"FontSize"}}class vk extends tk{constructor(e){super(e,"fontColor")}}class yk extends jl{static get pluginName(){return"FontColorEditing"}constructor(e){super(e),e.config.define("fontColor",{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:"fontColor",value:rk("color")}}),e.conversion.for("downcast").attributeToElement({model:"fontColor",view:sk("color")}),e.commands.add("fontColor",new vk(e)),e.model.schema.extend("$text",{allowAttributes:"fontColor"}),e.model.schema.setAttributeProperties("fontColor",{isFormatting:!0,copyOnEnter:!0})}}class xk extends jl{constructor(e,{commandName:t,icon:o,componentName:n,dropdownLabel:i}){super(e),this.commandName=t,this.componentName=n,this.icon=o,this.dropdownLabel=i,this.columns=e.config.get(this.componentName+".columns"),this.colorTableView}init(){const e=this.editor,t=e.locale,o=t.t,n=e.commands.get(this.commandName),i=dw(t,hw(e.config.get(this.componentName).colors)),r=e.config.get(this.componentName+".documentColors");e.ui.componentFactory.add(this.componentName,t=>{const s=qc(t);return this.colorTableView=function({dropdownView:e,colors:t,columns:o,removeButtonLabel:n,documentColorsLabel:i,documentColorsCount:r}){const s=e.locale,a=new nk(s,{colors:t,columns:o,removeButtonLabel:n,documentColorsLabel:i,documentColorsCount:r});return e.colorTableView=a,e.panelView.children.add(a),a.delegate("execute").to(e,"execute"),a}({dropdownView:s,colors:i.map(e=>({label:e.label,color:e.model,options:{hasBorder:e.hasBorder}})),columns:this.columns,removeButtonLabel:o("Remove color"),documentColorsLabel:0!==r?o("Document colors"):void 0,documentColorsCount:void 0===r?this.columns:r}),this.colorTableView.bind("selectedColor").to(n,"value"),s.buttonView.set({label:this.dropdownLabel,icon:this.icon,tooltip:!0}),s.extendTemplate({attributes:{class:"ck-color-ui-dropdown"}}),s.bind("isEnabled").to(n),s.on("execute",(t,o)=>{e.execute(this.commandName,o),e.editing.view.focus()}),s.on("change:isOpen",(t,o,n)=>{s.colorTableView.appendGrids(),n&&(0!==r&&this.colorTableView.updateDocumentColors(e.model,this.componentName),this.colorTableView.updateSelectedColors())}),s})}}class Ck extends xk{constructor(e){super(e,{commandName:"fontColor",componentName:"fontColor",icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M12.4 10.3L10 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:(0,e.locale.t)("Font Color")})}static get pluginName(){return"FontColorUI"}}class Ak extends jl{static get requires(){return[yk,Ck]}static get pluginName(){return"FontColor"}}class Tk extends tk{constructor(e){super(e,"fontBackgroundColor")}}class Pk extends jl{static get pluginName(){return"FontBackgroundColorEditing"}constructor(e){super(e),e.config.define("fontBackgroundColor",{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(xb),e.conversion.for("upcast").elementToAttribute({view:{name:"span",styles:{"background-color":/[\s\S]+/}},model:{key:"fontBackgroundColor",value:rk("background-color")}}),e.conversion.for("downcast").attributeToElement({model:"fontBackgroundColor",view:sk("background-color")}),e.commands.add("fontBackgroundColor",new Tk(e)),e.model.schema.extend("$text",{allowAttributes:"fontBackgroundColor"}),e.model.schema.setAttributeProperties("fontBackgroundColor",{isFormatting:!0,copyOnEnter:!0})}}class Sk extends xk{constructor(e){super(e,{commandName:"fontBackgroundColor",componentName:"fontBackgroundColor",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:(0,e.locale.t)("Font Background Color")})}static get pluginName(){return"FontBackgroundColorUI"}}class Ek extends jl{static get requires(){return[Pk,Sk]}static get pluginName(){return"FontBackgroundColor"}}function*Rk(e,t){for(const o of t)o&&e.getAttributeProperties(o[0]).copyOnEnter&&(yield o)}class Ik extends Vd{execute(){const e=this.editor.model,t=e.document;e.change(o=>{!function(e,t,o){const n=o.isCollapsed,i=o.getFirstRange(),r=i.start.parent,s=i.end.parent,a=r==s;if(n){const n=Rk(e.schema,o.getAttributes());Vk(e,t,i.end),t.removeSelectionAttribute(o.getAttributeKeys()),t.setSelectionAttribute(n)}else{const n=!(i.start.isAtStart&&i.end.isAtEnd);e.deleteContent(o,{leaveUnmerged:n}),a?Vk(e,t,o.focus):n&&t.setSelection(s,0)}}(e,o,t.selection),this.fire("afterExecute",{writer:o})})}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=function(e,t){if(t.rangeCount>1)return!1;const o=t.anchor;if(!o||!e.checkChild(o,"softBreak"))return!1;const n=t.getFirstRange(),i=n.start.parent,r=n.end.parent;if((Ok(i,e)||Ok(r,e))&&i!==r)return!1;return!0}(e.schema,t.selection)}}function Vk(e,t,o){const n=t.createElement("softBreak");e.insertContent(n,o),t.setSelection(n,"after")}function Ok(e,t){return!e.is("rootElement")&&(t.isLimit(e)||Ok(e.parent,t))}class Mk extends br{constructor(e){super(e);const t=this.document;t.on("keydown",(e,o)=>{if(this.isEnabled&&o.keyCode==pi.enter){let n;t.once("enter",e=>n=e,{priority:"highest"}),t.fire("enter",new Br(t,o.domEvent,{isSoft:o.shiftKey})),n&&n.stop.called&&e.stop()}})}observe(){}}class Nk extends jl{static get pluginName(){return"ShiftEnter"}init(){const e=this.editor,t=e.model.schema,o=e.conversion,n=e.editing.view,i=n.document;t.register("softBreak",{allowWhere:"$text",isInline:!0}),o.for("upcast").elementToElement({model:"softBreak",view:"br"}),o.for("downcast").elementToElement({model:"softBreak",view:(e,{writer:t})=>t.createEmptyElement("br")}),n.addObserver(Mk),e.commands.add("shiftEnter",new Ik(e)),this.listenTo(i,"enter",(t,o)=>{o.preventDefault(),o.isSoft&&(e.execute("shiftEnter"),n.scrollToTheSelection())},{priority:"low"})}}function zk(e){const t=e.t,o=e.config.get("codeBlock.languages");for(const e of o)"Plain text"===e.label&&(e.label=t("Plain text")),void 0===e.class&&(e.class="language-"+e.language);return o}function Bk(e,t,o){const n={};for(const i of e)"class"===t?n[i[t].split(" ").shift()]=i[o]:n[i[t]]=i[o];return n}function Fk(e){return e.data.match(/^(\s*)/)[0]}function Dk(e,t){const o=e.createDocumentFragment(),n=t.split("\n").map(t=>e.createText(t)),i=n[n.length-1];for(const t of n)e.append(t,o),t!==i&&e.appendElement("softBreak",o);return o}function Lk(e){const t=e.document.selection,o=[];if(t.isCollapsed)o.push(t.anchor);else{const n=t.getFirstRange().getWalker({ignoreElementEnd:!0,direction:"backward"});for(const{item:t}of n)if(t.is("$textProxy")&&t.parent.is("element","codeBlock")){const n=Fk(t.textNode),{parent:i,startOffset:r}=t.textNode,s=e.createPositionAt(i,r+n.length);o.push(s)}}return o}function Hk(e){const t=Pd(e.getSelectedBlocks());return t&&t.is("element","codeBlock")}class jk extends Vd{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor,o=t.model,n=o.document.selection,i=zk(t)[0],r=Array.from(n.getSelectedBlocks()),s=void 0===e.forceValue?!this.value:e.forceValue,a=e.language||i.language;o.change(e=>{s?this._applyCodeBlock(e,r,a):this._removeCodeBlock(e,r)})}_getValue(){const e=Pd(this.editor.model.document.selection.getSelectedBlocks());return!!!(!e||!e.is("element","codeBlock"))&&e.getAttribute("language")}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,o=Pd(e.getSelectedBlocks());return!!o&&Wk(t,o)}_applyCodeBlock(e,t,o){const n=this.editor.model.schema,i=t.filter(e=>Wk(n,e));for(const t of i)e.rename(t,"codeBlock"),e.setAttribute("language",o,t),n.removeDisallowedAttributes([t],e);i.reverse().forEach((t,o)=>{const n=i[o+1];t.previousSibling===n&&(e.appendElement("softBreak",n),e.merge(e.createPositionBefore(t)))})}_removeCodeBlock(e,t){const o=t.filter(e=>e.is("element","codeBlock"));for(const t of o){const o=e.createRangeOn(t);for(const t of Array.from(o.getItems()).reverse())if(t.is("element","softBreak")&&t.parent.is("element","codeBlock")){const{position:o}=e.split(e.createPositionBefore(t));e.rename(o.nodeAfter,"paragraph"),e.removeAttribute("language",o.nodeAfter),e.remove(t)}e.rename(t,"paragraph"),e.removeAttribute("language",t)}}}function Wk(e,t){return!t.is("rootElement")&&!e.isLimit(t)&&e.checkChild(t.parent,"codeBlock")}class qk extends Vd{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 o=Lk(e);for(const e of o)t.insertText(this._indentSequence,e)})}_checkEnabled(){return!!this._indentSequence&&Hk(this.editor.model.document.selection)}}class $k extends Vd{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 o=Lk(e);for(const e of o){const o=Uk(this.editor.model,e,this._indentSequence);o&&t.remove(o)}})}_checkEnabled(){if(!this._indentSequence)return!1;const e=this.editor.model;return!!Hk(e.document.selection)&&Lk(e).some(t=>Uk(e,t,this._indentSequence))}}function Uk(e,t,o){const n=function(e){let t=e.parent.getChild(e.index);t&&!t.is("element","softBreak")||(t=e.nodeBefore);if(!t||t.is("element","softBreak"))return null;return t}(t);if(!n)return null;const i=Fk(n),r=i.lastIndexOf(o);if(r+o.length!==i.length)return null;if(-1===r)return null;const{parent:s,startOffset:a}=n;return e.createRange(e.createPositionAt(s,a+r),e.createPositionAt(s,a+r+o.length))}function Gk(e,t,o=!1){const n=Bk(t,"language","class"),i=Bk(t,"language","label");return(t,r,s)=>{const{writer:a,mapper:l,consumable:c}=s;if(!c.consume(r.item,"insert"))return;const d=r.item.getAttribute("language"),h=l.toViewPosition(e.createPositionBefore(r.item)),u={};o&&(u["data-language"]=i[d],u.spellcheck="false");const m=a.createContainerElement("pre",u),g=a.createContainerElement("code",{class:n[d]||null});a.insert(a.createPositionAt(m,0),g),a.insert(h,m),l.bindElements(r.item,g)}}class Kk extends jl{static get pluginName(){return"CodeBlockEditing"}static get requires(){return[Nk]}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,o=e.model,n=zk(e);e.commands.add("codeBlock",new jk(e)),e.commands.add("indentCodeBlock",new qk(e)),e.commands.add("outdentCodeBlock",new $k(e));const i=e=>(t,o)=>{this.editor.commands.get(e).isEnabled&&(this.editor.execute(e),o())};e.keystrokes.set("Tab",i("indentCodeBlock")),e.keystrokes.set("Shift+Tab",i("outdentCodeBlock")),t.register("codeBlock",{allowWhere:"$block",isBlock:!0,allowAttributes:["language"]}),t.extend("$text",{allowIn:"codeBlock"}),t.addAttributeCheck(e=>{if(e.endsWith("codeBlock $text"))return!1}),e.editing.downcastDispatcher.on("insert:codeBlock",Gk(o,n,!0)),e.data.downcastDispatcher.on("insert:codeBlock",Gk(o,n)),e.data.downcastDispatcher.on("insert:softBreak",function(e){return(t,o,n)=>{if("codeBlock"!==o.item.parent.name)return;const{writer:i,mapper:r,consumable:s}=n;if(!s.consume(o.item,"insert"))return;const a=r.toViewPosition(e.createPositionBefore(o.item));i.insert(a,i.createText("\n"))}}(o),{priority:"high"}),e.data.upcastDispatcher.on("element:pre",function(e,t){const o=Bk(t,"class","language"),n=t[0].language;return(t,i,r)=>{const s=i.viewItem,a=s.getChild(0);if(!a||!a.is("element","code"))return;const{consumable:l,writer:c}=r;if(!l.test(s,{name:!0})||!l.test(a,{name:!0}))return;const d=c.createElement("codeBlock"),h=[...a.getClassNames()];h.length||h.push("");for(const e of h){const t=o[e];if(t){c.setAttribute("language",t,d);break}}d.hasAttribute("language")||c.setAttribute("language",n,d);const u=Dk(c,[...e.createRangeIn(a)].filter(e=>"text"===e.type).map(({item:e})=>e.data).join(""));c.append(u,d),r.safeInsert(d,i.modelCursor)&&(l.consume(s,{name:!0}),l.consume(a,{name:!0}),r.updateConversionResult(d,i))}}(e.editing.view,n)),this.listenTo(e.editing.view.document,"clipboardInput",(e,t)=>{const n=o.document.selection;if(!n.anchor.parent.is("element","codeBlock"))return;const i=t.dataTransfer.getData("text/plain");o.change(t=>{o.insertContent(Dk(t,i),n),e.stop()})}),this.listenTo(o,"getSelectedContent",(e,[n])=>{const i=n.anchor;!n.isCollapsed&&i.parent.is("element","codeBlock")&&i.hasSameParentAs(n.focus)&&o.change(o=>{const r=e.return;if(r.childCount>1||n.containsEntireContent(i.parent)){const t=o.createElement("codeBlock",i.parent.getAttributes());o.append(r,t);const n=o.createDocumentFragment();o.append(t,n),e.return=n}else{const e=r.getChild(0);t.checkAttribute(e,"code")&&o.setAttribute("code",!0,e)}})})}afterInit(){const e=this.editor,t=e.commands,o=t.get("indent"),n=t.get("outdent");o&&o.registerChildCommand(t.get("indentCodeBlock")),n&&n.registerChildCommand(t.get("outdentCodeBlock")),this.listenTo(e.editing.view.document,"enter",(t,o)=>{e.model.document.selection.getLastPosition().parent.is("element","codeBlock")&&(function(e,t){const o=e.model.document,n=e.editing.view,i=o.selection.getLastPosition(),r=i.nodeAfter;if(t||!o.selection.isCollapsed||!i.isAtStart)return!1;if(!r||!r.is("element","softBreak"))return!1;return e.model.change(t=>{e.execute("enter");const n=o.selection.anchor.parent.previousSibling;t.rename(n,"paragraph"),t.setSelection(n,"in"),e.model.schema.removeDisallowedAttributes([n],t),t.remove(r)}),n.scrollToTheSelection(),!0}(e,o.isSoft)||function(e,t){const o=e.model,n=o.document,i=e.editing.view,r=n.selection.getLastPosition(),s=r.nodeBefore;let a;if(t||!n.selection.isCollapsed||!r.isAtEnd||!s)return!1;if(s.is("element","softBreak"))a=o.createRangeOn(s);else{if(!s.is("$text")||s.data.match(/\S/)||!s.previousSibling||!s.previousSibling.is("element","softBreak"))return!1;a=o.createRange(o.createPositionBefore(s.previousSibling),o.createPositionAfter(s))}return e.model.change(t=>{t.remove(a),e.execute("enter");const o=n.selection.anchor.parent;t.rename(o,"paragraph"),e.model.schema.removeDisallowedAttributes([o],t)}),i.scrollToTheSelection(),!0}(e,o.isSoft)||function(e){const t=e.model.document,o=t.selection.getLastPosition(),n=o.nodeBefore||o.textNode;let i;n&&n.is("$text")&&(i=Fk(n));e.model.change(o=>{e.execute("shiftEnter"),i&&o.insertText(i,t.selection.anchor)})}(e),o.preventDefault(),t.stop())})}}o(120);class Jk extends jl{init(){const e=this.editor,t=e.t,o=e.ui.componentFactory,n=zk(e),i=n[0];o.add("codeBlock",o=>{const r=e.commands.get("codeBlock"),s=qc(o,Bu),a=s.buttonView;return a.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-.231l.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-2l-1.471 1H5v-1h2.197zM10 11v.095L8.668 12H7v-1h3zm4-2v1H7V9h7zm0-2v1H7V7h7zm-4-2v1H5V5h5zM6 3v1H3V3h3z"/></svg>',isToggleable:!0}),a.bind("isOn").to(r,"value",e=>!!e),a.on("execute",()=>{e.execute("codeBlock",{language:i.language}),e.editing.view.focus()}),s.on("execute",t=>{e.execute("codeBlock",{language:t.source._codeBlockLanguage,forceValue:!0}),e.editing.view.focus()}),s.class="ck-code-block-dropdown",s.bind("isEnabled").to(r),$c(s,this._getLanguageListItemDefinitions(n)),s})}_getLanguageListItemDefinitions(e){const t=this.editor.commands.get("codeBlock"),o=new Ao;for(const n of e){const e={type:"button",model:new bh({_codeBlockLanguage:n.language,label:n.label,withText:!0})};e.model.bind("isOn").to(t,"value",t=>t===e.model._codeBlockLanguage),o.add(e)}return o}}class Yk extends Vd{refresh(){const e=this.editor.model,t=e.document;this.isEnabled=e.schema.checkAttributeInSelection(t.selection,"mention")}execute(e){const t=this.editor.model,o=t.document.selection,n="string"==typeof e.mention?{id:e.mention}:e.mention,i=n.id,r=e.range||o.getFirstRange(),s=e.text||i,a=Xk({_text:s,id:i},n);if(1!=e.marker.length)throw new mo.b("mentioncommand-incorrect-marker: The marker must be a single character.",this);if(i.charAt(0)!=e.marker)throw new mo.b("mentioncommand-incorrect-id: The item id must start with the marker character.",this);t.change(e=>{const n=Bo(o.getAttributes()),i=new Map(n.entries());i.set("mention",a),t.insertContent(e.createText(s,i),r),t.insertContent(e.createText(" ",n),r.start.getShiftedBy(s.length))})}}class Qk extends jl{static get pluginName(){return"MentionEditing"}init(){const e=this.editor,t=e.model,o=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:Zk}}),e.conversion.for("downcast").attributeToElement({model:"mention",view:t_}),e.conversion.for("downcast").add(e_),o.registerPostFixer(e=>function(e,t,o){const n=t.differ.getChanges();let i=!1;for(const t of n){const n=t.position;if("$text"==t.name){const t=n.textNode&&n.textNode.nextSibling;i=n_(n.textNode,e)||i,i=n_(t,e)||i,i=n_(n.nodeBefore,e)||i,i=n_(n.nodeAfter,e)||i}if("$text"!=t.name&&"insert"==t.type){const t=n.nodeAfter;for(const o of e.createRangeIn(t).getItems())i=n_(o,e)||i}if("insert"==t.type&&o.isInline(t.name)){const t=n.nodeAfter&&n.nodeAfter.nextSibling;i=n_(n.nodeBefore,e)||i,i=n_(t,e)||i}}return i}(e,o,t.schema)),o.registerPostFixer(e=>function(e,t){const o=t.differ.getChanges();let n=!1;for(const t of o)if("attribute"===t.type&&"mention"!=t.attributeKey){const o=t.range.start.nodeBefore,i=t.range.end.nodeAfter;for(const r of[o,i])o_(r)&&r.getAttribute(t.attributeKey)!=t.attributeNewValue&&(e.setAttribute(t.attributeKey,t.attributeNewValue,r),n=!0)}return n}(e,o)),o.registerPostFixer(e=>function(e,t){const o=t.selection,n=o.focus;if(o.isCollapsed&&o.hasAttribute("mention")&&function(e){const t=e.isAtStart;return e.nodeBefore&&e.nodeBefore.is("$text")||t}(n))return e.removeSelectionAttribute("mention"),!0}(e,o)),e.commands.add("mention",new Yk(e))}}function Xk(e,t){return Object.assign({uid:ho()},e,t||{})}function Zk(e,t){const o=e.getAttribute("data-mention"),n=e.getChild(0);if(!n)return;return Xk({id:o,_text:n.data},t)}function e_(e){e.on("attribute:mention",(e,t,o)=>{const n=t.attributeNewValue;if(!t.item.is("$textProxy")||!n)return;const i=t.range.start;(i.textNode||i.nodeAfter).data!=n._text&&o.consumable.consume(t.item,e.name)},{priority:"highest"})}function t_(e,{writer:t}){if(!e)return;const o={class:"mention","data-mention":e.id},n={id:e.uid,priority:20};return t.createAttributeElement("span",o,n)}function o_(e){if(!e||!e.is("$text")&&!e.is("$textProxy")||!e.hasAttribute("mention"))return!1;return e.data!=e.getAttribute("mention")._text}function n_(e,t){return!!o_(e)&&(t.removeAttribute("mention",e),!0)}o(122);class i_ extends Dc{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 o=this.items.get(t);this.selected!==o&&(this.selected&&this.selected.removeHighlight(),o.highlight(),this.selected=o,this._isItemVisibleInScrolledArea(o)||(this.element.scrollTop=o.element.offsetTop))}executeSelected(){this.selected.fire("execute")}_isItemVisibleInScrolledArea(e){return new is(this.element).contains(new is(e.element))}}class r_ extends dc{constructor(e,t){super(e),this.template=!1,this.domElement=t,this.domElement.classList.add("ck-button"),this.set("isOn",!1),this.on("change:isOn",(e,t,o)=>{o?(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}}class s_ extends Lc{highlight(){this.children.first.isOn=!0}removeHighlight(){this.children.first.isOn=!1}}const a_=[pi.arrowup,pi.arrowdown,pi.enter,pi.tab,pi.esc];class l_ extends jl{static get pluginName(){return"MentionUI"}static get requires(){return[Pc]}constructor(e){super(e),this._mentionsView=this._createMentionView(),this._mentionsConfigurations=new Map,this._requestFeedDebounced=Jr(this._requestFeed,100),e.config.define("mention",{feeds:[]})}init(){const e=this.editor;this._balloon=e.plugins.get(Pc),e.editing.view.document.on("keydown",(e,t)=>{var o;o=t.keyCode,a_.includes(o)&&this._isUIVisible&&(t.preventDefault(),e.stop(),t.keyCode==pi.arrowdown&&this._mentionsView.selectNext(),t.keyCode==pi.arrowup&&this._mentionsView.selectPrevious(),t.keyCode!=pi.enter&&t.keyCode!=pi.tab||this._mentionsView.executeSelected(),t.keyCode==pi.esc&&this._hideUIAndRemoveMarker())},{priority:"highest"}),Wc({emitter:this._mentionsView,activator:()=>this._isUIVisible,contextElements:[this._balloon.view.element],callback:()=>this._hideUIAndRemoveMarker()});const t=e.config.get("mention.feeds");for(const e of t){const t=e.feed,o=e.marker;if(!u_(o))throw new mo.b("mentionconfig-incorrect-marker: The marker must be provided and it must be a single character.",null);const n=e.minimumCharacters||0,i="function"==typeof t?t.bind(this.editor):h_(t),r={watcher:this._setupTextWatcherForFeed(o,n),marker:o,feedCallback:i,itemRenderer:e.itemRenderer};this._mentionsConfigurations.set(o,r)}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 i_(e);return this._items=new Ao,t.items.bindTo(this._items).using(o=>{const{item:n,marker:i}=o,r=new s_(e),s=this._renderItem(n,i);return s.delegate("execute").to(r),r.children.add(s),r.item=n,r.marker=i,r.on("execute",()=>{t.fire("execute",{item:n,marker:i})}),r}),t.on("execute",(e,t)=>{const o=this.editor,n=o.model,i=t.item,r=t.marker,s=o.model.markers.get("mention"),a=n.createPositionAt(n.document.selection.focus),l=n.createPositionAt(s.getStart()),c=n.createRange(l,a);this._hideUIAndRemoveMarker(),o.execute("mention",{mention:i,text:i.text,marker:r,range:c}),o.editing.view.focus()}),t}_getItemRenderer(e){const{itemRenderer:t}=this._mentionsConfigurations.get(e);return t}_requestFeed(e,t){this._lastRequested=t;const{feedCallback:o}=this._mentionsConfigurations.get(e),n=o(t);n instanceof Promise?n.then(o=>{this._lastRequested==t?this.fire("requestFeed:response",{feed:o,marker:e,feedText:t}):this.fire("requestFeed:discarded",{feed:o,marker:e,feedText:t})}).catch(e=>{this.fire("requestFeed:error",{error:e}),console.warn(Object(mo.a)("mention-feed-callback-error: Could not obtain mention autocomplete feed."))}):this.fire("requestFeed:response",{feed:n,marker:e,feedText:t})}_setupTextWatcherForFeed(e,t){const o=this.editor,n=new ug(o.model,function(e,t){const o=d_(e,t);return e=>o.test(e)}(e,t));n.on("matched:data",(t,n)=>{const i=o.model.document.selection.focus;if(function(e){const t=e.textNode&&e.textNode.hasAttribute("mention"),o=e.nodeBefore;return t||o&&o.is("$text")&&o.hasAttribute("mention")}(i))return void this._hideUIAndRemoveMarker();const r=function(e,t){const o=d_(e,0);return t.match(o)[2]}(e,n.text),s=e.length+r.length,a=i.getShiftedBy(-s),l=i.getShiftedBy(-r.length),c=o.model.createRange(a,l);if(m_(o)){const e=o.model.markers.get("mention");o.model.change(t=>{t.updateMarker(e,{range:c})})}else o.model.change(e=>{e.addMarker("mention",{range:c,usingOperation:!1,affectsData:!1})});this._requestFeedDebounced(e,r)}),n.on("unmatched",()=>{this._hideUIAndRemoveMarker()});const i=o.commands.get("mention");return n.bind("isEnabled").to(i),n}_handleFeedResponse(e){const{feed:t,marker:o}=e;if(!m_(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:o})}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),withArrow:!1,singleViewMode:!0}),this._mentionsView.position=this._balloon.view.position,this._mentionsView.selectFirst()}_hideUIAndRemoveMarker(){this._balloon.hasView(this._mentionsView)&&this._balloon.remove(this._mentionsView),m_(this.editor)&&this.editor.model.change(e=>e.removeMarker("mention")),this._mentionsView.position=void 0}_renderItem(e,t){const o=this.editor;let n,i=e.id;const r=this._getItemRenderer(t);if(r){const t=r(e);"string"!=typeof t?n=new r_(o.locale,t):i=t}if(!n){const e=new Cc(o.locale);e.label=i,e.withText=!0,n=e}return n}_getBalloonPanelPositionData(e,t){const o=this.editor,n=o.editing,i=n.view.domConverter,r=n.mapper;return{target:()=>{let t=e.getRange();"$graveyard"==t.start.root.rootName&&(t=o.model.document.selection.getFirstRange());const n=r.toViewRange(t);return is.getDomRangeRects(i.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)}}}function c_(e){const t={caret_se:e=>({top:e.bottom+3,left:e.right,name:"caret_se"}),caret_ne:(e,t)=>({top:e.top-t.height-3,left:e.right,name:"caret_ne"}),caret_sw:(e,t)=>({top:e.bottom+3,left:e.right-t.width,name:"caret_sw"}),caret_nw:(e,t)=>({top:e.top-t.height-3,left:e.right-t.width,name:"caret_nw"})};return Object.prototype.hasOwnProperty.call(t,e)?[t[e]]:[t.caret_se,t.caret_sw,t.caret_ne,t.caret_nw]}function d_(e,t){const o=0==t?"*":`{${t},}`,n=mi.features.isRegExpUnicodePropertySupported?"\\p{Ps}\\p{Pi}\"'":"\\(\\[{\"'";return new RegExp(`(?:^|[= ${n}])([${e}])([^\\s=]${o})$`,"u")}function h_(e){return t=>e.filter(e=>("string"==typeof e?e:String(e.id)).toLowerCase().includes(t.toLowerCase())).slice(0,10)}function u_(e){return e&&1==e.length}function m_(e){return e.model.markers.has("mention")}o(124);class g_ extends Vd{constructor(e){super(e),this._childCommands=[]}refresh(){}execute(...e){return this._getFirstEnabledCommand().execute(e)}registerChildCommand(e){this._childCommands.push(e),e.on("change:isEnabled",()=>this._checkEnabled()),this._checkEnabled()}_checkEnabled(){this.isEnabled=!!this._getFirstEnabledCommand()}_getFirstEnabledCommand(){return this._childCommands.find(e=>e.isEnabled)}}class f_ extends jl{static get pluginName(){return"IndentEditing"}init(){const e=this.editor;e.commands.add("indent",new g_(e)),e.commands.add("outdent",new g_(e))}}var p_='<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.95L5.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>',b_='<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>';class w_ extends jl{static get pluginName(){return"IndentUI"}init(){const e=this.editor,t=e.locale,o=e.t,n="ltr"==t.uiLanguageDirection?p_:b_,i="ltr"==t.uiLanguageDirection?b_:p_;this._defineButton("indent",o("Increase indent"),n),this._defineButton("outdent",o("Decrease indent"),i)}_defineButton(e,t,o){const n=this.editor;n.ui.componentFactory.add(e,i=>{const r=n.commands.get(e),s=new Cc(i);return s.set({label:t,icon:o,tooltip:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),this.listenTo(s,"execute",()=>{n.execute(e),n.editing.view.focus()}),s})}}class k_ extends Vd{constructor(e,t){super(e),this._indentBehavior=t}refresh(){const e=this.editor.model,t=Pd(e.document.selection.getSelectedBlocks());t&&e.schema.checkAttribute(t,"blockIndent")?this.isEnabled=this._indentBehavior.checkEnabled(t.getAttribute("blockIndent")):this.isEnabled=!1}execute(){const e=this.editor.model,t=function(e){const t=e.document.selection,o=e.schema;return Array.from(t.getSelectedBlocks()).filter(e=>o.checkAttribute(e,"blockIndent"))}(e);e.change(e=>{for(const o of t){const t=o.getAttribute("blockIndent"),n=this._indentBehavior.getNextIndent(t);n?e.setAttribute("blockIndent",n,o):e.removeAttribute("blockIndent",o)}})}}class __{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 o=t+(this.isForward?this.offset:-this.offset);return o>0?o+this.unit:void 0}}class v_{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),o=this.isForward?1:-1;return this.classes[t+o]}}function y_(e){e.setNormalizer("margin",cb("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",ab("margin")),e.setStyleRelation("margin",["margin-top","margin-right","margin-bottom","margin-left"])}class x_ extends Vd{execute(){const e=this.editor.model,t=e.document.selection;let o=e.schema.getLimitElement(t);if(t.containsEntireContent(o)||!C_(e.schema,o))do{if(o=o.parent,!o)return}while(!C_(e.schema,o));e.change(e=>{e.setSelection(o,"in")})}}function C_(e,t){return e.isLimit(t)&&(e.checkChild(t,"$text")||e.checkChild(t,"paragraph"))}const A_=wi("Ctrl+A");class T_ extends jl{static get pluginName(){return"SelectAllEditing"}init(){const e=this.editor,t=e.editing.view.document;e.commands.add("selectAll",new x_(e)),this.listenTo(t,"keydown",(t,o)=>{bi(o)===A_&&(e.execute("selectAll"),o.preventDefault())})}}class P_ extends jl{static get pluginName(){return"SelectAllUI"}init(){const e=this.editor;e.ui.componentFactory.add("selectAll",t=>{const o=e.commands.get("selectAll"),n=new Cc(t),i=t.t;return n.set({label:i("Select all"),icon:'<svg width="20" height="20" xmlns="http://www.w3.org/2000/svg"><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",tooltip:!0}),n.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(n,"execute",()=>{e.execute("selectAll"),e.editing.view.focus()}),n})}}class S_ extends jl{static get requires(){return[T_,P_]}static get pluginName(){return"SelectAll"}}class E_ extends Vd{refresh(){this.isEnabled=function(e){const t=e.schema,o=e.document.selection;return function(e,t,o){const n=function(e,t){const o=Vh(e,t).parent;if(o.isEmpty&&!o.is("element","$root"))return o.parent;return o}(e,o);return t.checkChild(n,"horizontalLine")}(o,t,e)&&!function(e,t){const o=e.getSelectedElement();return o&&t.isObject(o)}(o,t)}(this.editor.model)}execute(){const e=this.editor.model;e.change(t=>{const o=t.createElement("horizontalLine");e.insertContent(o);let n=o.nextSibling;!(n&&e.schema.checkChild(n,"$text"))&&e.schema.checkChild(o.parent,"paragraph")&&(n=t.createElement("paragraph"),e.insertContent(n,t.createPositionAfter(o))),n&&t.setSelection(n,0)})}}o(126);class R_ extends jl{static get pluginName(){return"HorizontalLineEditing"}init(){const e=this.editor,t=e.model.schema,o=e.t,n=e.conversion;t.register("horizontalLine",{isObject:!0,allowWhere:"$block"}),n.for("dataDowncast").elementToElement({model:"horizontalLine",view:(e,{writer:t})=>t.createEmptyElement("hr")}),n.for("editingDowncast").elementToElement({model:"horizontalLine",view:(e,{writer:t})=>{const n=o("Horizontal line"),i=t.createContainerElement("div"),r=t.createEmptyElement("hr");return t.addClass("ck-horizontal-line",i),t.setCustomProperty("hr",!0,i),t.insert(t.createPositionAt(i,0),r),function(e,t,o){return t.setCustomProperty("horizontalLine",!0,e),Sh(e,t,{label:o})}(i,t,n)}}),n.for("upcast").elementToElement({view:"hr",model:"horizontalLine"}),e.commands.add("horizontalLine",new E_(e))}}class I_ extends jl{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("horizontalLine",o=>{const n=e.commands.get("horizontalLine"),i=new Cc(o);return i.set({label:t("Horizontal line"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 9h16v2H2z"/></svg>',tooltip:!0}),i.bind("isEnabled").to(n,"isEnabled"),this.listenTo(i,"execute",()=>{e.execute("horizontalLine"),e.editing.view.focus()}),i})}}class V_ extends Vd{execute(){const e=this.editor.model,t=e.document;e.change(o=>{!function(e,t,o,n){const i=o.isCollapsed,r=o.getFirstRange(),s=r.start.parent,a=r.end.parent;if(n.isLimit(s)||n.isLimit(a))return void(i||s!=a||e.deleteContent(o));if(i){const e=Rk(t.model.schema,o.getAttributes());O_(t,r.start),t.setSelectionAttribute(e)}else{const n=!(r.start.isAtStart&&r.end.isAtEnd),i=s==a;e.deleteContent(o,{leaveUnmerged:n}),n&&(i?O_(t,o.focus):t.setSelection(a,0))}}(this.editor.model,o,t.selection,e.schema),this.fire("afterExecute",{writer:o})})}}function O_(e,t){e.split(t),e.setSelection(t.parent.nextSibling,0)}class M_ extends Vd{constructor(e,t){super(e),this.direction=t,this._buffer=new _m(e.model,e.config.get("typing.undoStep"))}get buffer(){return this._buffer}execute(e={}){const t=this.editor.model,o=t.document;t.enqueueChange(this._buffer.batch,n=>{this._buffer.lock();const i=n.createSelection(e.selection||o.selection),r=i.isCollapsed;if(i.isCollapsed&&t.modifySelection(i,{direction:this.direction,unit:e.unit}),this._shouldEntireContentBeReplacedWithParagraph(e.sequence||1))return void this._replaceEntireContentWithParagraph(n);if(i.isCollapsed)return;let s=0;i.getFirstRange().getMinimalFlatRanges().forEach(e=>{s+=ni(e.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))}),t.deleteContent(i,{doNotResetEntireContent:r,direction:this.direction}),this._buffer.input(s),n.setSelection(i),this._buffer.unlock()})}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;const t=this.editor.model,o=t.document.selection,n=t.schema.getLimitElement(o);if(!(o.isCollapsed&&o.containsEntireContent(n)))return!1;if(!t.schema.checkChild(n,"paragraph"))return!1;const i=n.getChild(0);return!i||"paragraph"!==i.name}_replaceEntireContentWithParagraph(e){const t=this.editor.model,o=t.document.selection,n=t.schema.getLimitElement(o),i=e.createElement("paragraph");e.remove(e.createRangeIn(n)),e.insert(i,n),e.setSelection(i,0)}}class N_ extends br{constructor(e){super(e);const t=e.document;let o=0;function n(e,o,n){let i;t.once("delete",e=>i=e,{priority:Number.POSITIVE_INFINITY}),t.fire("delete",new Br(t,o,n)),i&&i.stop.called&&e.stop()}t.on("keyup",(e,t)=>{t.keyCode!=pi.delete&&t.keyCode!=pi.backspace||(o=0)}),t.on("keydown",(e,t)=>{const i={};if(t.keyCode==pi.delete)i.direction="forward",i.unit="character";else{if(t.keyCode!=pi.backspace)return;i.direction="backward",i.unit="codePoint"}const r=mi.isMac?t.altKey:t.ctrlKey;i.unit=r?"word":i.unit,i.sequence=++o,n(e,t.domEvent,i)}),mi.isAndroid&&t.on("beforeinput",(t,o)=>{if("deleteContentBackward"!=o.domEvent.inputType)return;const i={unit:"codepoint",direction:"backward",sequence:1},r=o.domTarget.ownerDocument.defaultView.getSelection();r.anchorNode==r.focusNode&&r.anchorOffset+1!=r.focusOffset&&(i.selectionToRemove=e.domConverter.domSelectionToView(r)),n(t,o.domEvent,i)})}observe(){}}class z_ extends jl{static get pluginName(){return"Delete"}init(){const e=this.editor,t=e.editing.view,o=t.document;if(t.addObserver(N_),e.commands.add("forwardDelete",new M_(e,"forward")),e.commands.add("delete",new M_(e,"backward")),this.listenTo(o,"delete",(o,n)=>{const i={unit:n.unit,sequence:n.sequence};if(n.selectionToRemove){const t=e.model.createSelection(),o=[];for(const t of n.selectionToRemove.getRanges())o.push(e.editing.mapper.toModelRange(t));t.setTo(o),i.selection=t}e.execute("forward"==n.direction?"forwardDelete":"delete",i),n.preventDefault(),t.scrollToTheSelection()}),mi.isAndroid){let e=null;this.listenTo(o,"delete",(t,o)=>{const n=o.domTarget.ownerDocument.defaultView.getSelection();e={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}},{priority:"lowest"}),this.listenTo(o,"keyup",(t,o)=>{if(e){const t=o.domTarget.ownerDocument.defaultView.getSelection();t.collapse(e.anchorNode,e.anchorOffset),t.extend(e.focusNode,e.focusOffset),e=null}})}}}const B_=new Map;function F_(e,t,o){let n=B_.get(e);n||(n=new Map,B_.set(e,n)),n.set(t,o)}function D_(e){return[e]}function L_(e,t,o={}){const n=function(e,t){const o=B_.get(e);return o&&o.has(t)?o.get(t):D_}(e.constructor,t.constructor);try{return n(e=e.clone(),t,o)}catch(e){throw e}}function H_(e,t,o){e=e.slice(),t=t.slice();const n=new j_(o.document,o.useRelations,o.forceWeakRemove);n.setOriginalOperations(e),n.setOriginalOperations(t);const i=n.originalOperations;if(0==e.length||0==t.length)return{operationsA:e,operationsB:t,originalOperations:i};const r=new WeakMap;for(const t of e)r.set(t,0);const s={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 o=e[a],i=r.get(o);if(i==t.length){a++;continue}const s=t[i],l=L_(o,s,n.getContext(o,s,!0)),c=L_(s,o,n.getContext(s,o,!1));n.updateRelation(o,s),n.setOriginalOperations(l,o),n.setOriginalOperations(c,s);for(const e of l)r.set(e,i+c.length);e.splice(a,1,...l),t.splice(i,1,...c)}if(o.padWithNoOps){const o=e.length-s.originalOperationsACount,n=t.length-s.originalOperationsBCount;q_(e,n-o),q_(t,o-n)}return W_(e,s.nextBaseVersionB),W_(t,s.nextBaseVersionA),{operationsA:e,operationsB:t,originalOperations:i}}class j_{constructor(e,t,o=!1){this.originalOperations=new Map,this._history=e.history,this._useRelations=t,this._forceWeakRemove=!!o,this._relations=new Map}setOriginalOperations(e,t=null){const o=t?this.originalOperations.get(t):null;for(const t of e)this.originalOperations.set(t,o||t)}updateRelation(e,t){switch(e.constructor){case Ua:switch(t.constructor){case Qa: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");break;case Ua:e.targetPosition.isEqual(t.sourcePosition)||e.targetPosition.isBefore(t.sourcePosition)?this._setRelation(e,t,"insertBefore"):this._setRelation(e,t,"insertAfter")}break;case Xa:switch(t.constructor){case Qa:e.splitPosition.isBefore(t.sourcePosition)&&this._setRelation(e,t,"splitBefore");break;case Ua:(e.splitPosition.isEqual(t.sourcePosition)||e.splitPosition.isBefore(t.sourcePosition))&&this._setRelation(e,t,"splitBefore")}break;case Qa:switch(t.constructor){case Qa: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");break;case Xa:e.sourcePosition.isEqual(t.splitPosition)&&this._setRelation(e,t,"splitAtSource")}break;case Ka:{const o=e.newRange;if(!o)return;switch(t.constructor){case Ua:{const n=Es._createFromPositionAndShift(t.sourcePosition,t.howMany),i=n.containsPosition(o.start)||n.start.isEqual(o.start),r=n.containsPosition(o.end)||n.end.isEqual(o.end);!i&&!r||n.containsRange(o)||this._setRelation(e,t,{side:i?"left":"right",path:i?o.start.path.slice():o.end.path.slice()});break}case Qa:{const n=o.start.isEqual(t.targetPosition),i=o.start.isEqual(t.deletionPosition),r=o.end.isEqual(t.deletionPosition),s=o.end.isEqual(t.sourcePosition);(n||i||r||s)&&this._setRelation(e,t,{wasInLeftElement:n,wasStartBeforeMergedElement:i,wasEndBeforeMergedElement:r,wasInRightElement:s});break}}break}}}getContext(e,t,o){return{aIsStrong:o,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 o=this.originalOperations.get(t),n=this._history.getUndoneOperation(o);if(!n)return null;const i=this.originalOperations.get(e),r=this._relations.get(i);return r&&r.get(n)||null}_setRelation(e,t,o){const n=this.originalOperations.get(e),i=this.originalOperations.get(t);let r=this._relations.get(n);r||(r=new Map,this._relations.set(n,r)),r.set(i,o)}}function W_(e,t){for(const o of e)o.baseVersion=t++}function q_(e,t){for(let o=0;o<t;o++)e.push(new bl(0))}function $_(e,t,o){const n=e.nodes.getNode(0).getAttribute(t);if(n==o)return null;const i=new Es(e.position,e.position.getShiftedBy(e.howMany));return new qa(i,t,n,o,0)}function U_(e,t){return null===e.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany)}function G_(e,t){const o=[];for(let n=0;n<e.length;n++){const i=e[n],r=new Ua(i.start,i.end.offset-i.start.offset,t,0);o.push(r);for(let t=n+1;t<e.length;t++)e[t]=e[t]._getTransformedByMove(r.sourcePosition,r.targetPosition,r.howMany)[0];t=t._getTransformedByMove(r.sourcePosition,r.targetPosition,r.howMany)}return o}F_(qa,qa,(e,t,o)=>{if(e.key===t.key&&e.range.start.hasSameParentAs(t.range.start)){const n=e.range.getDifference(t.range).map(t=>new qa(t,e.key,e.oldValue,e.newValue,0)),i=e.range.getIntersection(t.range);return i&&o.aIsStrong&&n.push(new qa(i,t.key,t.newValue,e.newValue,0)),0==n.length?[new bl(0)]:n}return[e]}),F_(qa,Ga,(e,t)=>{if(e.range.start.hasSameParentAs(t.position)&&e.range.containsPosition(t.position)){const o=e.range._getTransformedByInsertion(t.position,t.howMany,!t.shouldReceiveAttributes).map(t=>new qa(t,e.key,e.oldValue,e.newValue,e.baseVersion));if(t.shouldReceiveAttributes){const n=$_(t,e.key,e.oldValue);n&&o.unshift(n)}return o}return e.range=e.range._getTransformedByInsertion(t.position,t.howMany,!1)[0],[e]}),F_(qa,Qa,(e,t)=>{const o=[];e.range.start.hasSameParentAs(t.deletionPosition)&&(e.range.containsPosition(t.deletionPosition)||e.range.start.isEqual(t.deletionPosition))&&o.push(Es._createFromPositionAndShift(t.graveyardPosition,1));const n=e.range._getTransformedByMergeOperation(t);return n.isCollapsed||o.push(n),o.map(t=>new qa(t,e.key,e.oldValue,e.newValue,e.baseVersion))}),F_(qa,Ua,(e,t)=>function(e,t){const o=Es._createFromPositionAndShift(t.sourcePosition,t.howMany);let n=null,i=[];o.containsRange(e,!0)?n=e:e.start.hasSameParentAs(o.start)?(i=e.getDifference(o),n=e.getIntersection(o)):i=[e];const r=[];for(let e of i){e=e._getTransformedByDeletion(t.sourcePosition,t.howMany);const o=t.getMovedRangeStart(),n=e.start.hasSameParentAs(o);e=e._getTransformedByInsertion(o,t.howMany,n),r.push(...e)}n&&r.push(n._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany,!1)[0]);return r}(e.range,t).map(t=>new qa(t,e.key,e.oldValue,e.newValue,e.baseVersion))),F_(qa,Xa,(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 o=e.clone();return o.range=new Es(t.moveTargetPosition.clone(),e.range.end._getCombined(t.splitPosition,t.moveTargetPosition)),e.range.end=t.splitPosition.clone(),e.range.end.stickiness="toPrevious",[e,o]}return e.range=e.range._getTransformedBySplitOperation(t),[e]}),F_(Ga,qa,(e,t)=>{const o=[e];if(e.shouldReceiveAttributes&&e.position.hasSameParentAs(t.range.start)&&t.range.containsPosition(e.position)){const n=$_(e,t.key,t.newValue);n&&o.push(n)}return o}),F_(Ga,Ga,(e,t,o)=>(e.position.isEqual(t.position)&&o.aIsStrong||(e.position=e.position._getTransformedByInsertOperation(t)),[e])),F_(Ga,Ua,(e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e])),F_(Ga,Xa,(e,t)=>(e.position=e.position._getTransformedBySplitOperation(t),[e])),F_(Ga,Qa,(e,t)=>(e.position=e.position._getTransformedByMergeOperation(t),[e])),F_(Ka,Ga,(e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByInsertOperation(t)[0]),e.newRange&&(e.newRange=e.newRange._getTransformedByInsertOperation(t)[0]),[e])),F_(Ka,Ka,(e,t,o)=>{if(e.name==t.name){if(!o.aIsStrong)return[new bl(0)];e.oldRange=t.newRange?t.newRange.clone():null}return[e]}),F_(Ka,Qa,(e,t)=>(e.oldRange&&(e.oldRange=e.oldRange._getTransformedByMergeOperation(t)),e.newRange&&(e.newRange=e.newRange._getTransformedByMergeOperation(t)),[e])),F_(Ka,Ua,(e,t,o)=>{if(e.oldRange&&(e.oldRange=Es._createFromRanges(e.oldRange._getTransformedByMoveOperation(t))),e.newRange){if(o.abRelation){const n=Es._createFromRanges(e.newRange._getTransformedByMoveOperation(t));if("left"==o.abRelation.side&&t.targetPosition.isEqual(e.newRange.start))return e.newRange.start.path=o.abRelation.path,e.newRange.end=n.end,[e];if("right"==o.abRelation.side&&t.targetPosition.isEqual(e.newRange.end))return e.newRange.start=n.start,e.newRange.end.path=o.abRelation.path,[e]}e.newRange=Es._createFromRanges(e.newRange._getTransformedByMoveOperation(t))}return[e]}),F_(Ka,Xa,(e,t,o)=>{if(e.oldRange&&(e.oldRange=e.oldRange._getTransformedBySplitOperation(t)),e.newRange){if(o.abRelation){const n=e.newRange._getTransformedBySplitOperation(t);return e.newRange.start.isEqual(t.splitPosition)&&o.abRelation.wasStartBeforeMergedElement?e.newRange.start=As._createAt(t.insertionPosition):e.newRange.start.isEqual(t.splitPosition)&&!o.abRelation.wasInLeftElement&&(e.newRange.start=As._createAt(t.moveTargetPosition)),e.newRange.end.isEqual(t.splitPosition)&&o.abRelation.wasInRightElement?e.newRange.end=As._createAt(t.moveTargetPosition):e.newRange.end.isEqual(t.splitPosition)&&o.abRelation.wasEndBeforeMergedElement?e.newRange.end=As._createAt(t.insertionPosition):e.newRange.end=n.end,[e]}e.newRange=e.newRange._getTransformedBySplitOperation(t)}return[e]}),F_(Qa,Ga,(e,t)=>(e.sourcePosition.hasSameParentAs(t.position)&&(e.howMany+=t.howMany),e.sourcePosition=e.sourcePosition._getTransformedByInsertOperation(t),e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t),[e])),F_(Qa,Qa,(e,t,o)=>{if(e.sourcePosition.isEqual(t.sourcePosition)&&e.targetPosition.isEqual(t.targetPosition)){if(o.bWasUndone){const o=t.graveyardPosition.path.slice();return o.push(0),e.sourcePosition=new As(t.graveyardPosition.root,o),e.howMany=0,[e]}return[new bl(0)]}if(e.sourcePosition.isEqual(t.sourcePosition)&&!e.targetPosition.isEqual(t.targetPosition)&&!o.bWasUndone&&"splitAtSource"!=o.abRelation){const n="$graveyard"==e.targetPosition.root.rootName,i="$graveyard"==t.targetPosition.root.rootName,r=n&&!i;if(i&&!n||!r&&o.aIsStrong){const o=t.targetPosition._getTransformedByMergeOperation(t),n=e.targetPosition._getTransformedByMergeOperation(t);return[new Ua(o,e.howMany,n,0)]}return[new bl(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)&&o.aIsStrong||(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]}),F_(Qa,Ua,(e,t,o)=>{const n=Es._createFromPositionAndShift(t.sourcePosition,t.howMany);return"remove"==t.type&&!o.bWasUndone&&!o.forceWeakRemove&&e.deletionPosition.hasSameParentAs(t.sourcePosition)&&n.containsPosition(e.sourcePosition)?[new bl(0)]:(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.graveyardPosition.isEqual(t.targetPosition)||(e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(t)),[e])}),F_(Qa,Xa,(e,t,o)=>{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,i=t.graveyardPosition&&e.deletionPosition.isEqual(t.graveyardPosition);if(n||i||"mergeTargetNotMoved"==o.abRelation)return e.sourcePosition=e.sourcePosition._getTransformedBySplitOperation(t),[e]}if(e.sourcePosition.isEqual(t.splitPosition)){if("mergeSourceNotMoved"==o.abRelation)return e.howMany=0,e.targetPosition=e.targetPosition._getTransformedBySplitOperation(t),[e];if("mergeSameElement"==o.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]}),F_(Ua,Ga,(e,t)=>{const o=Es._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByInsertOperation(t,!1)[0];return e.sourcePosition=o.start,e.howMany=o.end.offset-o.start.offset,e.targetPosition.isEqual(t.position)||(e.targetPosition=e.targetPosition._getTransformedByInsertOperation(t)),[e]}),F_(Ua,Ua,(e,t,o)=>{const n=Es._createFromPositionAndShift(e.sourcePosition,e.howMany),i=Es._createFromPositionAndShift(t.sourcePosition,t.howMany);let r,s=o.aIsStrong,a=!o.aIsStrong;if("insertBefore"==o.abRelation||"insertAfter"==o.baRelation?a=!0:"insertAfter"!=o.abRelation&&"insertBefore"!=o.baRelation||(a=!1),r=e.targetPosition.isEqual(t.targetPosition)&&a?e.targetPosition._getTransformedByDeletion(t.sourcePosition,t.howMany):e.targetPosition._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),U_(e,t)&&U_(t,e))return[t.getReversed()];if(n.containsPosition(t.targetPosition)&&n.containsRange(i,!0))return n.start=n.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),n.end=n.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),G_([n],r);if(i.containsPosition(e.targetPosition)&&i.containsRange(n,!0))return n.start=n.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),n.end=n.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),G_([n],r);const l=Vo(e.sourcePosition.getParentPath(),t.sourcePosition.getParentPath());if("prefix"==l||"extension"==l)return n.start=n.start._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),n.end=n.end._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany),G_([n],r);"remove"!=e.type||"remove"==t.type||o.aWasUndone||o.forceWeakRemove?"remove"==e.type||"remove"!=t.type||o.bWasUndone||o.forceWeakRemove||(s=!1):s=!0;const c=[],d=n.getDifference(i);for(const e of d){e.start=e.start._getTransformedByDeletion(t.sourcePosition,t.howMany),e.end=e.end._getTransformedByDeletion(t.sourcePosition,t.howMany);const o="same"==Vo(e.start.getParentPath(),t.getMovedRangeStart().getParentPath()),n=e._getTransformedByInsertion(t.getMovedRangeStart(),t.howMany,o);c.push(...n)}const h=n.getIntersection(i);return null!==h&&s&&(h.start=h.start._getCombined(t.sourcePosition,t.getMovedRangeStart()),h.end=h.end._getCombined(t.sourcePosition,t.getMovedRangeStart()),0===c.length?c.push(h):1==c.length?i.start.isBefore(n.start)||i.start.isEqual(n.start)?c.unshift(h):c.push(h):c.splice(1,0,h)),0===c.length?[new bl(e.baseVersion)]:G_(c,r)}),F_(Ua,Xa,(e,t,o)=>{let n=e.targetPosition.clone();e.targetPosition.isEqual(t.insertionPosition)&&t.graveyardPosition&&"moveTargetAfter"!=o.abRelation||(n=e.targetPosition._getTransformedBySplitOperation(t));const i=Es._createFromPositionAndShift(e.sourcePosition,e.howMany);if(i.end.isEqual(t.insertionPosition))return t.graveyardPosition||e.howMany++,e.targetPosition=n,[e];if(i.start.hasSameParentAs(t.splitPosition)&&i.containsPosition(t.splitPosition)){let e=new Es(t.splitPosition,i.end);e=e._getTransformedBySplitOperation(t);return G_([new Es(i.start,t.splitPosition),e],n)}e.targetPosition.isEqual(t.splitPosition)&&"insertAtSource"==o.abRelation&&(n=t.moveTargetPosition),e.targetPosition.isEqual(t.insertionPosition)&&"insertBetween"==o.abRelation&&(n=e.targetPosition);const r=[i._getTransformedBySplitOperation(t)];if(t.graveyardPosition){const n=i.start.isEqual(t.graveyardPosition)||i.containsPosition(t.graveyardPosition);e.howMany>1&&n&&!o.aWasUndone&&r.push(Es._createFromPositionAndShift(t.insertionPosition,1))}return G_(r,n)}),F_(Ua,Qa,(e,t,o)=>{const n=Es._createFromPositionAndShift(e.sourcePosition,e.howMany);if(t.deletionPosition.hasSameParentAs(e.sourcePosition)&&n.containsPosition(t.sourcePosition))if("remove"!=e.type||o.forceWeakRemove){if(1==e.howMany)return o.bWasUndone?(e.sourcePosition=t.graveyardPosition.clone(),e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),[e]):[new bl(0)]}else if(!o.aWasUndone){const o=[];let n=t.graveyardPosition.clone(),i=t.targetPosition._getTransformedByMergeOperation(t);e.howMany>1&&(o.push(new Ua(e.sourcePosition,e.howMany-1,e.targetPosition,0)),n=n._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany-1),i=i._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany-1));const r=t.deletionPosition._getCombined(e.sourcePosition,e.targetPosition),s=new Ua(n,1,r,0),a=s.getMovedRangeStart().path.slice();a.push(0);const l=new As(s.targetPosition.root,a);i=i._getTransformedByMove(n,r,1);const c=new Ua(i,t.howMany,l,0);return o.push(s),o.push(c),o}const i=Es._createFromPositionAndShift(e.sourcePosition,e.howMany)._getTransformedByMergeOperation(t);return e.sourcePosition=i.start,e.howMany=i.end.offset-i.start.offset,e.targetPosition=e.targetPosition._getTransformedByMergeOperation(t),[e]}),F_(Ja,Ga,(e,t)=>(e.position=e.position._getTransformedByInsertOperation(t),[e])),F_(Ja,Qa,(e,t)=>e.position.isEqual(t.deletionPosition)?(e.position=t.graveyardPosition.clone(),e.position.stickiness="toNext",[e]):(e.position=e.position._getTransformedByMergeOperation(t),[e])),F_(Ja,Ua,(e,t)=>(e.position=e.position._getTransformedByMoveOperation(t),[e])),F_(Ja,Ja,(e,t,o)=>{if(e.position.isEqual(t.position)){if(!o.aIsStrong)return[new bl(0)];e.oldName=t.newName}return[e]}),F_(Ja,Xa,(e,t)=>{if("same"==Vo(e.position.path,t.splitPosition.getParentPath())&&!t.graveyardPosition){const t=new Ja(e.position.getShiftedBy(1),e.oldName,e.newName,0);return[e,t]}return e.position=e.position._getTransformedBySplitOperation(t),[e]}),F_(Ya,Ya,(e,t,o)=>{if(e.root===t.root&&e.key===t.key){if(!o.aIsStrong||e.newValue===t.newValue)return[new bl(0)];e.oldValue=t.newValue}return[e]}),F_(Xa,Ga,(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=Xa.getInsertionPosition(e.splitPosition),[e])),F_(Xa,Qa,(e,t,o)=>{if(!e.graveyardPosition&&!o.bWasUndone&&e.splitPosition.hasSameParentAs(t.sourcePosition)){const o=t.graveyardPosition.path.slice();o.push(0);const n=new As(t.graveyardPosition.root,o),i=Xa.getInsertionPosition(new As(t.graveyardPosition.root,o)),r=new Xa(n,0,null,0);return r.insertionPosition=i,e.splitPosition=e.splitPosition._getTransformedByMergeOperation(t),e.insertionPosition=Xa.getInsertionPosition(e.splitPosition),e.graveyardPosition=r.insertionPosition.clone(),e.graveyardPosition.stickiness="toNext",[r,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=Xa.getInsertionPosition(e.splitPosition),e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedByMergeOperation(t)),[e]}),F_(Xa,Ua,(e,t,o)=>{const n=Es._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.graveyardPosition){const i=n.start.isEqual(e.graveyardPosition)||n.containsPosition(e.graveyardPosition);if(!o.bWasUndone&&i){const o=e.splitPosition._getTransformedByMoveOperation(t),n=e.graveyardPosition._getTransformedByMoveOperation(t),i=n.path.slice();i.push(0);const r=new As(n.root,i);return[new Ua(o,e.howMany,r,0)]}e.graveyardPosition=e.graveyardPosition._getTransformedByMoveOperation(t)}if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&n.containsPosition(e.splitPosition)){const o=t.howMany-(e.splitPosition.offset-t.sourcePosition.offset);return e.howMany-=o,e.splitPosition.hasSameParentAs(t.targetPosition)&&e.splitPosition.offset<t.targetPosition.offset&&(e.howMany+=t.howMany),e.splitPosition=t.sourcePosition.clone(),e.insertionPosition=Xa.getInsertionPosition(e.splitPosition),[e]}return!e.splitPosition.isEqual(t.targetPosition)||"insertAtSource"!=o.baRelation&&"splitBefore"!=o.abRelation?(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=Xa.getInsertionPosition(e.splitPosition),[e]):(e.howMany+=t.howMany,e.splitPosition=e.splitPosition._getTransformedByDeletion(t.sourcePosition,t.howMany),e.insertionPosition=Xa.getInsertionPosition(e.splitPosition),[e])}),F_(Xa,Xa,(e,t,o)=>{if(e.splitPosition.isEqual(t.splitPosition)){if(!e.graveyardPosition&&!t.graveyardPosition)return[new bl(0)];if(e.graveyardPosition&&t.graveyardPosition&&e.graveyardPosition.isEqual(t.graveyardPosition))return[new bl(0)];if("splitBefore"==o.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,i="$graveyard"==t.splitPosition.root.rootName,r=n&&!i;if(i&&!n||!r&&o.aIsStrong){const o=[];return t.howMany&&o.push(new Ua(t.moveTargetPosition,t.howMany,t.splitPosition,0)),e.howMany&&o.push(new Ua(e.splitPosition,e.howMany,e.moveTargetPosition,0)),o}return[new bl(0)]}if(e.graveyardPosition&&(e.graveyardPosition=e.graveyardPosition._getTransformedBySplitOperation(t)),e.splitPosition.isEqual(t.insertionPosition)&&"splitBefore"==o.abRelation)return e.howMany++,[e];if(t.splitPosition.isEqual(e.insertionPosition)&&"splitBefore"==o.baRelation){const o=t.insertionPosition.path.slice();o.push(0);const n=new As(t.insertionPosition.root,o);return[e,new Ua(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=Xa.getInsertionPosition(e.splitPosition),[e]});class K_ extends Vd{constructor(e){super(e),this._stack=[],this._createdBatches=new WeakSet,this.refresh(),this.listenTo(e.data,"set",()=>this.clearStack())}refresh(){this.isEnabled=this._stack.length>0}addBatch(e){const t=this.editor.model.document.selection,o={ranges:t.hasOwnRange?Array.from(t.getRanges()):[],isBackward:t.isBackward};this._stack.push({batch:e,selection:o}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(e,t,o){const n=this.editor.model,i=n.document,r=[],s=e.map(e=>e.getTransformedByOperations(o)),a=s.flat();for(const e of s){const t=e.filter(e=>!Y_(e,a));J_(t);const o=t.find(e=>e.root!=i.graveyard);o&&r.push(o)}r.length&&n.change(e=>{e.setSelection(r,{backward:t})})}_undo(e,t){const o=this.editor.model,n=o.document;this._createdBatches.add(t);const i=e.operations.slice().filter(e=>e.isDocumentOperation);i.reverse();for(const e of i){const i=e.baseVersion+1,r=Array.from(n.history.getOperations(i)),s=H_([e.getReversed()],r,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(const i of s)t.addOperation(i),o.applyOperation(i),n.history.setOperationAsUndone(e,i)}}}function J_(e){e.sort((e,t)=>e.start.isBefore(t.start)?-1:1);for(let t=1;t<e.length;t++){const o=e[t-1].getJoined(e[t],!0);o&&(t--,e.splice(t,2,o))}}function Y_(e,t){return t.some(t=>t!==e&&t.containsRange(e,!0))}class Q_ extends K_{execute(e=null){const t=e?this._stack.findIndex(t=>t.batch==e):this._stack.length-1,o=this._stack.splice(t,1)[0],n=this.editor.model.createBatch("transparent");this.editor.model.enqueueChange(n,()=>{this._undo(o.batch,n);const e=this.editor.model.document.history.getOperations(o.batch.baseVersion);this._restoreSelection(o.selection.ranges,o.selection.isBackward,e),this.fire("revert",o.batch,n)}),this.refresh()}}class X_ extends K_{execute(){const e=this._stack.pop(),t=this.editor.model.createBatch("transparent");this.editor.model.enqueueChange(t,()=>{const o=e.batch.operations[e.batch.operations.length-1].baseVersion+1,n=this.editor.model.document.history.getOperations(o);this._restoreSelection(e.selection.ranges,e.selection.isBackward,n),this._undo(e.batch,t)}),this.refresh()}}class Z_ extends jl{static get pluginName(){return"UndoEditing"}constructor(e){super(e),this._batchRegistry=new WeakSet}init(){const e=this.editor;this._undoCommand=new Q_(e),this._redoCommand=new X_(e),e.commands.add("undo",this._undoCommand),e.commands.add("redo",this._redoCommand),this.listenTo(e.model,"applyOperation",(e,t)=>{const o=t[0];if(!o.isDocumentOperation)return;const n=o.batch,i=this._redoCommand._createdBatches.has(n),r=this._undoCommand._createdBatches.has(n);this._batchRegistry.has(n)||"transparent"==n.type&&!i&&!r||(i?this._undoCommand.addBatch(n):r||(this._undoCommand.addBatch(n),this._redoCommand.clearStack()),this._batchRegistry.add(n))},{priority:"highest"}),this.listenTo(this._undoCommand,"revert",(e,t,o)=>{this._redoCommand.addBatch(o)}),e.keystrokes.set("CTRL+Z","undo"),e.keystrokes.set("CTRL+Y","redo"),e.keystrokes.set("CTRL+SHIFT+Z","redo")}}var ev='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5.042 9.367l2.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>',tv='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M14.958 9.367l-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>';class ov extends jl{init(){const e=this.editor,t=e.locale,o=e.t,n="ltr"==t.uiLanguageDirection?ev:tv,i="ltr"==t.uiLanguageDirection?tv:ev;this._addButton("undo",o("Undo"),"CTRL+Z",n),this._addButton("redo",o("Redo"),"CTRL+Y",i)}_addButton(e,t,o,n){const i=this.editor;i.ui.componentFactory.add(e,r=>{const s=i.commands.get(e),a=new Cc(r);return a.set({label:t,icon:n,keystroke:o,tooltip:!0}),a.bind("isEnabled").to(s,"isEnabled"),this.listenTo(a,"execute",()=>{i.execute(e),i.editing.view.focus()}),a})}}class nv extends jl{static get pluginName(){return"RemoveFormatUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("removeFormat",o=>{const n=e.commands.get("removeFormat"),i=new Cc(o);return i.set({label:t("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>',tooltip:!0}),i.bind("isOn","isEnabled").to(n,"value","isEnabled"),this.listenTo(i,"execute",()=>{e.execute("removeFormat"),e.editing.view.focus()}),i})}}class iv extends Vd{refresh(){const e=this.editor.model;this.isEnabled=!!Pd(this._getFormattingItems(e.document.selection,e.schema))}execute(){const e=this.editor.model,t=e.schema;e.change(o=>{for(const n of this._getFormattingItems(e.document.selection,t))if(n.is("selection"))for(const e of this._getFormattingAttributes(n,t))o.removeSelectionAttribute(e);else{const e=o.createRangeOn(n);for(const i of this._getFormattingAttributes(n,t))o.removeAttribute(i,e)}})}*_getFormattingItems(e,t){const o=e=>!!Pd(this._getFormattingAttributes(e,t));for(const n of e.getRanges())for(const e of n.getItems())!t.isBlock(e)&&o(e)&&(yield e);for(const t of e.getSelectedBlocks())o(t)&&(yield t);o(e)&&(yield e)}*_getFormattingAttributes(e,t){for(const[o]of e.getAttributes()){const e=t.getAttributeProperties(o);e&&e.isFormatting&&(yield o)}}}class rv extends jl{static get pluginName(){return"RemoveFormatEditing"}init(){const e=this.editor;e.commands.add("removeFormat",new iv(e))}}class sv extends Vd{execute(e){const{model:t}=this.editor,{document:o}=t,{selection:n}=o,{mention:i}=e,r=e.range||n.getFirstRange();if(i.id.startsWith("#")||i.id.startsWith("~"))t.change(e=>{t.insertContent(e.createText(i.id,{}),r),t.insertContent(e.createText(" ",{}),r.start.getShiftedBy(i.id.length))});else if("create-note"===i.action){const e=this.editor.editing.view.getDomRoot();glob.getComponentByEl(e).createNoteForReferenceLink(i.noteTitle).then(e=>{this.insertReference(r,e)})}else this.insertReference(r,e.mention.notePath)}insertReference(e,t){const{model:o}=this.editor;o.change(n=>{o.insertContent(n.createText("",{}),e),this.editor.execute("referenceLink",{notePath:t})})}}class av{constructor(e){this.loader=e}upload(){return new Promise((e,t)=>{this._initRequest(),this._initListeners(e,t),this._sendRequest()})}abort(){this.xhr&&this.xhr.abort()}_initRequest(){const e=this.xhr=new XMLHttpRequest,{noteId:t}=glob.getActiveTabNote(),o="api/images?noteId="+t;e.open("POST",o,!0),e.responseType="json";const n=glob.getHeaders();for(const t in n)e.setRequestHeader(t,n[t])}async _initListeners(e,t){const o=this.xhr,n=this.loader,i=`Cannot upload file: ${(await n.file).name}.`;o.addEventListener("error",()=>t(i)),o.addEventListener("abort",()=>t()),o.addEventListener("load",()=>{const n=o.response;if(!n||!n.uploaded)return t(n&&n.error&&n.error.message?n.error.message:i);e({default:n.url})}),o.upload&&o.upload.addEventListener("progress",e=>{e.lengthComputable&&(n.uploadTotal=e.total,n.uploaded=e.loaded)})}async _sendRequest(){const e=new FormData;e.append("upload",await this.loader.file),this.xhr.send(e)}}class lv extends jl{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("includeNote",o=>{const n=e.commands.get("insertIncludeNote"),i=new Cc(o);return i.set({label:t("Include note"),icon:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19,3H5C3.897,3,3,3.897,3,5v14c0,1.103,0.897,2,2,2h8c0.131,0,0.26-0.026,0.381-0.076s0.232-0.123,0.326-0.217l7-7 c0.086-0.086,0.147-0.187,0.196-0.293c0.014-0.03,0.022-0.061,0.033-0.093c0.028-0.084,0.046-0.17,0.051-0.259 C20.989,13.041,21,13.021,21,13V5C21,3.897,20.103,3,19,3z M5,5h14v7h-6c-0.553,0-1,0.448-1,1v6H5V5z M14,17.586V14h3.586 L14,17.586z"/></svg>',tooltip:!0}),i.bind("isOn","isEnabled").to(n,"value","isEnabled"),this.listenTo(i,"execute",()=>e.execute("insertIncludeNote")),i})}}class cv extends jl{static get requires(){return[Zh]}init(){this._defineSchema(),this._defineConverters(),this.editor.commands.add("insertIncludeNote",new dv(this.editor))}_defineSchema(){this.editor.model.schema.register("includeNote",{isObject:!0,allowAttributes:["noteId","boxSize"],allowWhere:"$block"})}_defineConverters(){const e=this.editor,t=e.conversion;t.for("upcast").elementToElement({model:(e,{writer:t})=>t.createElement("includeNote",{noteId:e.getAttribute("data-note-id"),boxSize:e.getAttribute("data-box-size")}),view:{name:"section",classes:"include-note"}}),t.for("dataDowncast").elementToElement({model:"includeNote",view:(e,{writer:t})=>t.createContainerElement("section",{class:"include-note","data-note-id":e.getAttribute("noteId"),"data-box-size":e.getAttribute("boxSize")})}),t.for("editingDowncast").elementToElement({model:"includeNote",view:(t,{writer:o})=>{const n=t.getAttribute("noteId"),i=t.getAttribute("boxSize"),r=o.createContainerElement("section",{class:"include-note box-size-"+i,"data-note-id":n,"data-box-size":i}),s=o.createUIElement("div",{class:"include-note-wrapper"},(function(t){const o=this.toDomElement(t),i=e.editing.view.getDomRoot();return glob.getComponentByEl(i).loadIncludedNote(n,$(o)),function(e,t){function o(e){e.stopPropagation(),t.editing.view._renderer.isFocused=!1}e.addEventListener("mousedown",o,{capture:!0}),e.addEventListener("focus",o,{capture:!0}),e.addEventListener("keydown",o,{capture:!0})}(o,e),o}));return o.insert(o.createPositionAt(r,0),s),Sh(r,o,{label:"include note widget"})}})}}class dv extends Vd{execute(){const e=this.editor.editing.view.getDomRoot();glob.getComponentByEl(e).triggerCommand("addIncludeNoteToText")}refresh(){const e=this.editor.model,t=e.document.selection,o=e.schema.findAllowedParent(t.getFirstPosition(),"includeNote");this.isEnabled=null!==o}}class hv extends Vd{execute({notePath:e}){if(!e||!e.trim())return;const t=this.editor,o=e.split("/").pop();glob.treeCache.getNote(o,!0).then(()=>{t.model.change(o=>{o.createElement||console.log("BBBB");const n=o.createElement("reference",{notePath:e});t.model.insertContent(n),o.setSelection(n,"after")})})}refresh(){const e=this.editor.model,t=e.document.selection;this.isEnabled=e.schema.checkChild(t.focus.parent,"reference")}}class uv extends jl{static get requires(){return[Zh]}init(){var e,t;this._defineSchema(),this._defineConverters(),this.editor.commands.add("referenceLink",new hv(this.editor)),this.editor.editing.mapper.on("viewToModelPosition",(e=this.editor.model,t=e=>e.hasClass("reference-link"),(o,n)=>{const{mapper:i,viewPosition:r}=n,s=i.findMappedViewAncestor(r);if(!t(s))return;const a=i.toModelElement(s);n.modelPosition=e.createPositionAt(a,r.isAtStart?"before":"after")}))}_defineSchema(){this.editor.model.schema.register("reference",{allowWhere:"$text",isInline:!0,isObject:!0,allowAttributes:["notePath"]})}_defineConverters(){const e=this.editor,t=e.conversion;t.for("upcast").elementToElement({view:{name:"a",classes:["reference-link"]},model:(e,{writer:t})=>{const o=e.getAttribute("data-note-path");return t.createElement("reference",{notePath:o})}}),t.for("editingDowncast").elementToElement({model:"reference",view:(t,{writer:o})=>{const n=t.getAttribute("notePath"),i=o.createContainerElement("a",{href:"javascript:",class:"reference-link","data-note-path":n}),r=o.createUIElement("span",{},(function(t){const o=this.toDomElement(t),i=n.split("/").pop(),r=e.editing.view.getDomRoot();return glob.getComponentByEl(r).loadReferenceLinkTitle(i,$(o)),o}));return o.insert(o.createPositionAt(i,0),r),Sh(i,o)}}),t.for("dataDowncast").elementToElement({model:"reference",view:(e,{writer:t})=>{const o=e.getAttribute("notePath"),n=t.createContainerElement("a",{href:"#"+o,class:"reference-link","data-note-path":o}),i=o.split("/").pop(),r=glob.treeCache.getNoteFromCache(i);if(r){const e=t.createText(r.title);t.insert(t.createPositionAt(n,0),e)}return n}})}}class mv extends kd{}mv.builtinPlugins=[om,class extends jl{static get pluginName(){return"Enter"}init(){const e=this.editor,t=e.editing.view,o=t.document;t.addObserver(Mk),e.commands.add("enter",new V_(e)),this.listenTo(o,"enter",(o,n)=>{n.preventDefault(),n.isSoft||(e.execute("enter"),t.scrollToTheSelection())},{priority:"low"})}},S_,Nk,class extends jl{static get requires(){return[Pm,z_]}static get pluginName(){return"Typing"}},class extends jl{static get requires(){return[Z_,ov]}static get pluginName(){return"Undo"}},class extends jl{static get requires(){return[xd]}static get pluginName(){return"CKFinderUploadAdapter"}init(){const e=this.editor.config.get("ckfinder.uploadUrl");e&&(this.editor.plugins.get(xd).createUploadAdapter=t=>new Td(t,e,this.editor.t))}},class extends jl{static get pluginName(){return"Autoformat"}afterInit(){this._addListAutoformats(),this._addBasicStylesAutoformats(),this._addHeadingAutoformats(),this._addBlockQuoteAutoformats(),this._addCodeBlockAutoformats()}_addListAutoformats(){const e=this.editor.commands;e.get("bulletedList")&&Sd(this.editor,this,/^[*-]\s$/,"bulletedList"),e.get("numberedList")&&Sd(this.editor,this,/^1[.|)]\s$/,"numberedList")}_addBasicStylesAutoformats(){const e=this.editor.commands;if(e.get("bold")){const e=Id(this.editor,"bold");Ed(this.editor,this,/(\*\*)([^*]+)(\*\*)$/g,e),Ed(this.editor,this,/(__)([^_]+)(__)$/g,e)}if(e.get("italic")){const e=Id(this.editor,"italic");Ed(this.editor,this,/(?:^|[^*])(\*)([^*_]+)(\*)$/g,e),Ed(this.editor,this,/(?:^|[^_])(_)([^_]+)(_)$/g,e)}if(e.get("code")){const e=Id(this.editor,"code");Ed(this.editor,this,/(`)([^`]+)(`)$/g,e)}if(e.get("strikethrough")){const e=Id(this.editor,"strikethrough");Ed(this.editor,this,/(~~)([^~]+)(~~)$/g,e)}}_addHeadingAutoformats(){const e=this.editor.commands.get("heading");e&&e.modelElements.filter(e=>e.match(/^heading[1-6]$/)).forEach(t=>{const o=t[7],n=new RegExp(`^(#{${o}})\\s$`);Sd(this.editor,this,n,()=>{if(!e.isEnabled||e.value===t)return!1;this.editor.execute("heading",{value:t})})})}_addBlockQuoteAutoformats(){this.editor.commands.get("blockQuote")&&Sd(this.editor,this,/^>\s$/,"blockQuote")}_addCodeBlockAutoformats(){this.editor.commands.get("codeBlock")&&Sd(this.editor,this,/^```$/,"codeBlock")}},class extends jl{static get requires(){return[Nd,zd]}static get pluginName(){return"Bold"}},class extends jl{static get requires(){return[Bd,Fd]}static get pluginName(){return"Italic"}},class extends jl{static get requires(){return[Wd,qd]}static get pluginName(){return"Underline"}},class extends jl{static get requires(){return[$d,Ud]}static get pluginName(){return"Strikethrough"}},class extends jl{static get requires(){return[oh,nh]}static get pluginName(){return"Code"}},class extends jl{static get requires(){return[Dd,Ld]}static get pluginName(){return"Superscript"}},class extends jl{static get requires(){return[Hd,jd]}static get pluginName(){return"Subscript"}},class extends jl{static get requires(){return[lh,ch]}static get pluginName(){return"BlockQuote"}},class extends jl{static get requires(){return[ph,kh]}static get pluginName(){return"Heading"}},class extends jl{static get requires(){return[jh,Zh,gu]}static get pluginName(){return"Image"}},class extends jl{static get requires(){return[bu]}static get pluginName(){return"ImageCaption"}},class extends jl{static get requires(){return[Vu,Ou]}static get pluginName(){return"ImageStyle"}},class extends jl{static get requires(){return[Mu]}static get pluginName(){return"ImageToolbar"}afterInit(){const e=this.editor,t=e.t;e.plugins.get(Mu).register("image",{ariaLabel:t("Image toolbar"),items:e.config.get("image.toolbar")||[],getRelatedElement:Nh})}},class extends jl{static get pluginName(){return"ImageUpload"}static get requires(){return[sm,$u,Uu]}},class extends jl{static get requires(){return[cm,km,um]}static get pluginName(){return"ImageResize"}},class extends jl{static get requires(){return[tg,cg]}static get pluginName(){return"Link"}},class extends jl{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()}_enableTypingHandling(){const e=this.editor,t=new ug(e.model,e=>{if(!function(e){return e.length>4&&" "===e[e.length-1]&&" "!==e[e.length-2]}(e))return;const t=fg(e.substr(0,e.length-1));return t?{url:t}:void 0}),o=e.plugins.get("Input");t.on("matched:data",(t,n)=>{const{batch:i,range:r,url:s}=n;if(!o.isInput(i))return;const a=r.end.getShiftedBy(-1),l=a.getShiftedBy(-s.length),c=e.model.createRange(l,a);this._applyAutoLink(s,c)}),t.bind("isEnabled").to(this)}_enableEnterHandling(){const e=this.editor,t=e.model,o=e.commands.get("enter");o&&o.on("execute",()=>{const e=t.document.selection.getFirstPosition(),o=t.createRange(t.createPositionAt(e.parent.previousSibling,0),t.createPositionAt(e.parent.previousSibling,"end"));this._checkAndApplyAutoLinkOnRange(o)})}_enableShiftEnterHandling(){const e=this.editor,t=e.model,o=e.commands.get("shiftEnter");o&&o.on("execute",()=>{const e=t.document.selection.getFirstPosition(),o=t.createRange(t.createPositionAt(e.parent,0),e.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(o)})}_checkAndApplyAutoLinkOnRange(e){const t=this.editor.model,{text:o,range:n}=hg(e,t),i=fg(o);if(i){const e=t.createRange(n.end.getShiftedBy(-i.length),n.end);this._applyAutoLink(i,e)}}_applyAutoLink(e,t){const o=this.editor.model;this.isEnabled&&function(e,t){return t.schema.checkAttributeInSelection(t.createSelection(e),"linkHref")}(t,o)&&o.enqueueChange(o=>{const n=(i=e,gg.exec(i)?"mailto:"+e:e);var i;o.setAttribute("linkHref",n,t)})}},class extends jl{static get requires(){return[Hg,Wg]}static get pluginName(){return"List"}},class extends jl{static get requires(){return[Jg,Yg]}static get pluginName(){return"TodoList"}},mh,class extends jl{static get pluginName(){return"PasteFromOffice"}static get requires(){return[om]}init(){const e=this.editor,t=e.editing.view.document,o=[];o.push(new lf(t)),o.push(new tf(t)),e.plugins.get("Clipboard").on("inputTransformation",(e,t)=>{if(t.isTransformedWithPasteFromOffice)return;const n=t.dataTransfer.getData("text/html"),i=o.find(e=>e.isActive(n));i&&(i.execute(t),t.isTransformedWithPasteFromOffice=!0)},{priority:"high"})}},class extends jl{static get requires(){return[Cp,Pp,Ep,zp,Mp,Rp,Zh]}static get pluginName(){return"Table"}},class extends jl{static get requires(){return[Mu]}static get pluginName(){return"TableToolbar"}afterInit(){const e=this.editor,t=e.t,o=e.plugins.get(Mu),n=e.config.get("table.contentToolbar"),i=e.config.get("table.tableToolbar");n&&o.register("tableContent",{ariaLabel:t("Table toolbar"),items:n,getRelatedElement:Dp}),i&&o.register("table",{ariaLabel:t("Table toolbar"),items:i,getRelatedElement:Fp})}},class extends jl{static get pluginName(){return"TableProperties"}static get requires(){return[Lb,vw]}},class extends jl{static get pluginName(){return"TableCellProperties"}static get requires(){return[Dw,Tw]}},class extends jl{static get pluginName(){return"Indent"}static get requires(){return[f_,w_]}},class extends jl{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"),o=!t.classes||!t.classes.length,n=Object.assign({direction:"forward"},t),i=Object.assign({direction:"backward"},t);o?(e.data.addStyleProcessorRules(y_),this._setupConversionUsingOffset(e.conversion),e.commands.add("indentBlock",new k_(e,new __(n))),e.commands.add("outdentBlock",new k_(e,new __(i)))):(this._setupConversionUsingClasses(t.classes),e.commands.add("indentBlock",new k_(e,new v_(n))),e.commands.add("outdentBlock",new k_(e,new v_(i))))}afterInit(){const e=this.editor,t=e.model.schema,o=e.commands.get("indent"),n=e.commands.get("outdent");["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"].forEach(e=>{t.isRegistered(e)&&t.extend(e,{allowAttributes:"blockIndent"})}),t.setAttributeProperties("blockIndent",{isFormatting:!0}),o.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=>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 o of e)t.model.values.push(o),t.view[o]={key:"class",value:[o]};this.editor.conversion.attributeToAttribute(t)}},class extends jl{static get pluginName(){return"BlockToolbar"}constructor(e){super(e),this._blockToolbarConfig=Yc(this.editor.config.get("blockToolbar")),this.toolbarView=this._createToolbarView(),this.panelView=this._createPanelView(),this.buttonView=this._createButtonView(),this._resizeObserver=null,Wc({emitter:this.panelView,contextElements:[this.panelView.element,this.buttonView.element],activator:()=>this.panelView.isVisible,callback:()=>this._hidePanel()})}init(){const e=this.editor;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,o)=>{o?this.buttonView.listenTo(window,"resize",()=>this._updateButton()):(this.buttonView.stopListening(window,"resize"),this._hidePanel())})}afterInit(){const e=this.editor.ui.componentFactory,t=this._blockToolbarConfig;this.toolbarView.fillFromConfig(t.items,e);for(const e of this.toolbarView.items)e.on("execute",()=>this._hidePanel(!0),{priority:"high"});t.shouldNotGroupWhenFull||this.listenTo(this.editor,"ready",()=>{const e=this.editor.ui.view.editable.element;this._resizeObserver=new Oc(e,()=>{this.toolbarView.maxWidth=this._getToolbarMaxWidth()})})}destroy(){super.destroy(),this.panelView.destroy(),this.buttonView.destroy(),this.toolbarView.destroy(),this._resizeObserver&&this._resizeObserver.destroy()}_createToolbarView(){const e=!this._blockToolbarConfig.shouldNotGroupWhenFull,t=new Uc(this.editor.locale,{shouldGroupWhenFull:e});return t.extendTemplate({attributes:{class:["ck-toolbar_floating"]}}),t.focusTracker.on("change:isFocused",(e,t,o)=>{o||this._hidePanel()}),t}_createPanelView(){const e=this.editor,t=new wc(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,o=new jw(e.locale);return o.set({label:t("Edit block"),icon:'<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>',withText:!1}),o.bind("isOn").to(this.panelView,"isVisible"),o.bind("tooltip").to(this.panelView,"isVisible",e=>!e),this.listenTo(o,"execute",()=>{this.panelView.isVisible?this._hidePanel(!0):this._showPanel()}),e.ui.view.body.add(o),e.ui.focusTracker.add(o.element),o}_updateButton(){const e=this.editor,t=e.model,o=e.editing.view;if(!e.ui.focusTracker.isFocused)return void this._hideButton();if(e.isReadOnly)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 i=o.domConverter.mapViewToDom(e.editing.mapper.toViewElement(n));this.buttonView.isVisible=!0,this._attachButtonToElement(i),this.panelView.isVisible&&this._showPanel()}_hideButton(){this.buttonView.isVisible=!1}_showPanel(){const e=this.panelView.isVisible;this.panelView.show(),this.toolbarView.maxWidth=this._getToolbarMaxWidth(),this.panelView.pin({target:this.buttonView.element,limiter:this.editor.ui.getEditableElement()}),e||this.toolbarView.items.get(0).focus()}_hidePanel(e){this.panelView.isVisible=!1,e&&this.editor.editing.view.focus()}_attachButtonToElement(e){const t=window.getComputedStyle(e),o=new is(this.editor.ui.getEditableElement()),n=parseInt(t.paddingTop,10),i=parseInt(t.lineHeight,10)||1.2*parseInt(t.fontSize,10),r=hc({element:this.buttonView.element,target:e,positions:[(e,t)=>{let r;return r="ltr"===this.editor.locale.uiLanguageDirection?o.left-t.width:o.right,{top:e.top+n+(i-t.height)/2,left:r}}]});this.buttonView.top=r.top,this.buttonView.left=r.left}_getToolbarMaxWidth(){const e=this.editor.ui.view.editable.element,t=new is(e),o=new is(this.buttonView.element),n="rtl"===this.editor.locale.uiLanguageDirection?o.left-t.right+o.width:t.left-o.left;return Ww(t.width+n)}},class extends jl{init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("paragraph",o=>{const n=new Cc(o),i=e.commands.get("paragraph");return n.label=t("Paragraph"),n.icon='<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>',n.tooltip=!0,n.isToggleable=!0,n.bind("isEnabled").to(i),n.bind("isOn").to(i,"value"),n.on("execute",()=>{e.execute("paragraph")}),n})}},class extends jl{init(){wh(this.editor).filter(e=>"paragraph"!==e.model).map(e=>this._createButton(e))}_createButton(e){const t=this.editor;t.ui.componentFactory.add(e.model,o=>{const n=new Cc(o),i=t.commands.get("heading");return n.label=e.title,n.icon=e.icon||qw[e.model],n.tooltip=!0,n.isToggleable=!0,n.bind("isEnabled").to(i),n.bind("isOn").to(i,"value",t=>t==e.model),n.on("execute",()=>{t.execute("heading",{value:e.model}),t.editing.view.focus()}),n})}},class extends jl{static get requires(){return[xd]}static get pluginName(){return"UploadimagePlugin"}init(){this.editor.plugins.get("FileRepository").createUploadAdapter=e=>new av(e)}},class extends jl{init(){const e=this.editor;e.ui.componentFactory.add("internalLink",t=>{const o=new Cc(t);return o.set({label:"Internal Trilium link (CTRL-L)",icon:'<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n<svg\n xmlns:dc="http://purl.org/dc/elements/1.1/"\n xmlns:cc="http://creativecommons.org/ns#"\n xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\n xmlns:svg="http://www.w3.org/2000/svg"\n xmlns="http://www.w3.org/2000/svg"\n xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"\n xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\n version="1.1"\n x="0px"\n y="0px"\n viewBox="0 0 67.008179 71.908997"\n enable-background="new 0 0 100 100"\n xml:space="preserve"\n id="svg4"\n sodipodi:docname="trilium.svg"\n width="67.008179"\n height="71.908997"\n inkscape:version="0.92.3 (2405546, 2018-03-11)"><metadata\n id="metadata10"><rdf:RDF><cc:Work\n rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type\n rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs\n id="defs8" /><sodipodi:namedview\n pagecolor="#ffffff"\n bordercolor="#666666"\n borderopacity="1"\n objecttolerance="10"\n gridtolerance="10"\n guidetolerance="10"\n inkscape:pageopacity="0"\n inkscape:pageshadow="2"\n inkscape:window-width="1857"\n inkscape:window-height="1053"\n id="namedview6"\n showgrid="false"\n fit-margin-top="0"\n fit-margin-left="0"\n fit-margin-right="0"\n fit-margin-bottom="0"\n inkscape:zoom="2.36"\n inkscape:cx="33.504176"\n inkscape:cy="35.954"\n inkscape:window-x="63"\n inkscape:window-y="27"\n inkscape:window-maximized="1"\n inkscape:current-layer="svg4" /><path\n d="m 47.470176,30.998 c 0.008,-0.009 0.021,-0.021 0.027,-0.029 0.938,-1.156 -0.823,-13.453 -5.063,-20.125 -1.389,-2.186 -2.239,-3.423 -3.219,-4.719 -3.907,-5.166 -6,-6.125 -6,-6.125 0,0 -13.979,10.735 -13.562,30.27 -1.754,0.065 -11.2179997,7.528 -14.8259997,14.388 -1.206,2.291 -1.856,3.645 -2.493,5.141 -2.53899996,5.957 -2.32999996,8.25 -2.32999996,8.25 0,0 16.27099966,6.79 33.01399966,-3.294 0.007,0.021 0.013,0.046 0.02,0.063 0.537,1.389 12.08,5.979 19.976,5.621 2.587,-0.116 4.084,-0.238 5.696,-0.444 6.424,-0.818 8.298,-2.157 8.298,-2.157 0,0 -2.36,-17.487 -19.538,-26.84 z m -13.179,20.3 c 1.059,-1.183 4.648,-5.853 0.995,-11.315 -0.253,-0.377 -0.496,-0.236 -0.496,-0.236 0,0 0.063,10.822 -5.162,12.359 -5.225,1.537 -13.886,4.4 -20.4269997,0.455 -0.697,-0.42 1.2269997,-13 12.8469997,-19.377 0.546,1.599 2.836,6.854 9.292,6.409 0.453,-0.031 0.453,-0.313 0.453,-0.313 0,0 -9.422,-5.328 -8.156,-10.625 1.266,-5.297 3.089,-14.236 9.766,-17.948 0.714,-0.397 10.746,7.593 10.417,20.94 -1.606,-0.319 -7.377,-1.004 -10.226,4.864 -0.198,0.409 0.046,0.549 0.046,0.549 0,0 9.31,-5.521 13.275,-1.789 3.965,3.733 10.813,9.763 10.71,17.4 -0.01,0.817 -11.924,5.542 -23.334,-1.373 z M 19.117176,21.1 c 0,0 -0.991,3.241 -0.603,7.524 L 5.1211763,21.1 c 10e-4,0 6.2209997,-4.214 13.9959997,0 z M 4.6971763,21.985 18.041176,29.597 c -3.872,1.872 -6.142,4.388 -6.142,4.388 -7.6149997,-4.499 -7.2019997,-12 -7.2019997,-12 z M 55.791176,35.019 c 0,0 -2.321,-2.471 -6.23,-4.263 l 13.187,-7.881 c -10e-4,0 0.564,7.493 -6.957,12.144 z m 6.4,-12.951 -13.237,7.794 c 0.3,-4.291 -0.754,-7.511 -0.754,-7.511 7.687,-4.371 13.991,-0.283 13.991,-0.283 z m -36.611,37.665 c 0,0 3.309,-0.737 6.845,-3.185 l 0.056,15.361 c 0,10e-4 -6.733,-3.333 -6.901,-12.176 z m 7.88,12.11 0.044,-15.362 c 3.539,2.445 6.846,3.181 6.846,3.181 -0.16,8.844 -6.89,12.181 -6.89,12.181 z"\n id="path2"\n inkscape:connector-curvature="0" /></svg>',tooltip:!0}),o.bind("isEnabled").to(e,"isReadOnly",e=>!e),o.on("execute",()=>{const t=e.editing.view.getDomRoot();glob.getComponentByEl(t).triggerCommand("addLinkToText")}),o})}},class extends jl{init(){this.editor.ui.componentFactory.add("markdownImport",e=>{const t=new Cc(e);return t.set({label:"Markdown import from clipboard",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="208" height="128" viewBox="0 0 208 128"><rect width="198" height="118" x="5" y="5" ry="10" stroke="#000" stroke-width="10" fill="none"/><path d="M30 98V30h20l20 25 20-25h20v68H90V59L70 84 50 59v39zm125 0l-30-33h20V30h20v35h20z"/></svg>',tooltip:!0}),t.on("execute",()=>{glob.importMarkdownInline()}),t})}},class extends jl{init(){this.htmlDataProcessor=new Hl,this.editor.ui.componentFactory.add("cutToNote",e=>{const t=new Cc(e);return t.set({label:"Cut & paste selection to sub-note",icon:'<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- Svg Vector Icons : http://www.onlinewebfonts.com/icon --\x3e\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">\n<metadata> Svg Vector Icons : http://www.onlinewebfonts.com/icon </metadata>\n<g><g><path d="M853.9,754.9c-26-45.4-66.5-76.2-109.1-87.8c-33.7-9.2-68.7-6.4-98.9,10.7l-90-157.3C611.6,409.5,736.5,160.5,759,121.2C788,70.4,736,10,736,10L500,422.8L264,10c0,0-52,60.4-22.9,111.2c22.5,39.3,147.5,288.3,203.1,399.3l-89.9,157.3c-30.2-17.1-65.3-19.9-98.9-10.7c-42.7,11.6-83.1,42.3-109.1,87.8c-46.8,81.7-28.9,179.7,39.7,219c30.4,17.5,65.7,20.3,99.6,11.1c42.6-11.6,83.1-42.4,109.1-87.7c11.4-20,18.9-41,22.8-61.8v0c0-0.2,0-0.3,0.2-0.5c0.2-1.7,0.5-3.5,0.7-5.4c19.3-129.5,55.8-195.7,81.6-227.8c25.9,32.1,62.4,98.3,81.7,227.8c0.2,1.9,0.5,3.6,0.7,5.4c0.1,0.2,0.1,0.3,0.2,0.5v0c3.9,20.8,11.4,41.8,22.7,61.8c26,45.3,66.5,76.1,109.2,87.7c34,9.2,69.2,6.4,99.7-11.1C882.8,934.5,900.6,836.5,853.9,754.9z M327.9,858.9c-14.8,25.8-38.1,45.2-62.5,51.8c-10.8,3-26.7,4.7-41.3-3.6c-31.1-17.8-36.2-70.1-11.1-114c15-26,37.8-45,62.5-51.8c10.7-2.9,26.7-4.7,41.3,3.6C347.9,762.7,353,814.9,327.9,858.9z M775.9,907.1c-14.6,8.4-30.4,6.6-41.3,3.6c-24.4-6.6-47.7-26-62.5-51.8c-25.1-44-20-96.2,11.1-114c14.7-8.3,30.6-6.5,41.3-3.6C749.3,748,772.1,767,787,793C812.1,837,807.1,889.3,775.9,907.1z"/><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g></g>\n</svg>',tooltip:!0}),t.on("execute",()=>{const e=this.editor.editing.view.getDomRoot();glob.getComponentByEl(e).triggerCommand("cutIntoNote")}),t}),window.cutToNote={getSelectedHtml:()=>this.getSelectedHtml(),removeSelection:()=>this.removeSelection()}}getSelectedHtml(){const e=this.editor.model,t=e.document,o=this.editor.data.toView(e.getSelectedContent(t.selection));return this.htmlDataProcessor.toData(o)}async removeSelection(){const e=this.editor.model;e.deleteContent(e.document.selection);const t=glob.getComponentByEl(editorEl);await t.triggerCommand("saveNoteDetailNow")}},class extends jl{static get pluginName(){return"TextTransformation"}constructor(e){super(e),e.config.define("typing",{transformations:{include:Yw}})}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,o=e.plugins.get("Input"),n=function(e){const t=e.extra||[],o=e.remove||[],n=e=>!o.includes(e);return function(e){const t=new Set;for(const o of e)if(Jw[o])for(const e of Jw[o])t.add(e);else t.add(o);return Array.from(t)}(e.include.concat(t).filter(n)).filter(n).map(e=>Kw[e]||e).map(e=>({from:Qw(e.from),to:Xw(e.to)}))}(e.config.get("typing.transformations")),i=new ug(e.model,e=>{for(const t of n){if(t.from.test(e))return{normalizedTransformation:t}}});i.on("matched:data",(e,n)=>{if(!o.isInput(n.batch))return;const{from:i,to:r}=n.normalizedTransformation,s=i.exec(n.text),a=r(s.slice(1)),l=n.range;let c=s.index;t.enqueueChange(e=>{for(let o=1;o<s.length;o++){const n=s[o],i=a[o-1];if(null==i){c+=n.length;continue}const r=l.start.getShiftedBy(c),d=t.createRange(r,r.getShiftedBy(n.length)),h=Zw(r);t.insertContent(e.createText(i,h),d),c+=i.length}})}),i.bind("isEnabled").to(this)}},class extends jl{static get requires(){return[mk,_k,Ak,Ek]}static get pluginName(){return"Font"}},Ak,Ek,class extends jl{static get requires(){return[Kk,Jk]}static get pluginName(){return"CodeBlock"}},S_,class extends jl{static get requires(){return[R_,I_]}static get pluginName(){return"HorizontalLine"}},class extends jl{static get requires(){return[rv,nv]}static get pluginName(){return"RemoveFormat"}},class extends jl{toMentionAttribute(e,t){return Zk(e,t)}static get pluginName(){return"Mention"}static get requires(){return[Qk,l_]}},class extends jl{afterInit(){const e=this.editor;e.commands.add("mention",new sv(e))}},class extends jl{static get requires(){return[cv,lv]}},class extends jl{static get requires(){return[uv]}},function(e){e.keystrokes.set("Tab",(t,o)=>{const n=e.commands.get("indentBlock");n.isEnabled&&(n.execute(),o())}),e.keystrokes.set("Shift+Tab",(t,o)=>{const n=e.commands.get("outdentBlock");n.isEnabled&&(n.execute(),o())})},function(e){e.model.schema.setAttributeProperties("linkHref",{isFormatting:!0})}],mv.defaultConfig={toolbar:{items:["fontSize","bold","italic","underline","strikethrough","superscript","subscript","fontColor","fontBackgroundColor","code","link","removeFormat","internallink","cuttonote"]},image:{styles:["alignLeft","alignCenter","alignRight","full","side"],resizeOptions:[{name:"imageResize:original",value:null,icon:"original"},{name:"imageResize:25",value:"25",icon:"small"},{name:"imageResize:50",value:"50",icon:"medium"}],toolbar:["imageStyle:alignLeft","imageStyle:alignCenter","imageStyle:alignRight","|","imageResize:25","imageResize:50","imageResize:original"]},heading:{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading2",view:"h2",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h3",title:"Heading 3",class:"ck-heading_heading3"},{model:"heading4",view:"h4",title:"Heading 4",class:"ck-heading_heading4"},{model:"heading5",view:"h5",title:"Heading 5",class:"ck-heading_heading5"},{model:"heading6",view:"h6",title:"Heading 6",class:"ck-heading_heading6"}]},blockToolbar:["heading","|","bulletedList","numberedList","todoList","|","blockQuote","codeBlock","insertTable","includeNote","|","outdent","indent","horizontalLine","|","imageUpload","markdownImport"],table:{contentToolbar:["tableColumn","tableRow","mergeTableCells","tableProperties","tableCellProperties"]},link:{defaultProtocol:"https://"},language:"en"}}]).default}));
//# sourceMappingURL=libraries/ckeditor/ckeditor.js.map