From 8d1621cec14427afb5cd3d68797042ec6bc713f6 Mon Sep 17 00:00:00 2001 From: Ankita Date: Thu, 9 Sep 2021 14:19:08 +0530 Subject: [PATCH] word count --- .../script-slide/script-slide.component.html | 8 ++-- .../script-slide/script-slide.component.ts | 47 ++++++++++++++++++- .../script-view/script-view.component.html | 2 + .../script-view/script-view.component.ts | 3 +- scriptmanager/static/scriptmanager/main.js | 2 +- 5 files changed, 56 insertions(+), 6 deletions(-) diff --git a/scriptmanager/src/app/script/script-slide/script-slide.component.html b/scriptmanager/src/app/script/script-slide/script-slide.component.html index 4d21994..4b00c78 100644 --- a/scriptmanager/src/app/script/script-slide/script-slide.component.html +++ b/scriptmanager/src/app/script/script-slide/script-slide.component.html @@ -25,9 +25,10 @@

Visual Cue

- + +

Word Count : {{ visual_cue }}

@@ -39,8 +40,9 @@
+ (onBlur)="saveSlide(true)" [styles]="quillStyles" theme="snow" (ngModelChange)="onNarrationChange($event)"> +

Word Count : {{ narration }}

diff --git a/scriptmanager/src/app/script/script-slide/script-slide.component.ts b/scriptmanager/src/app/script/script-slide/script-slide.component.ts index 0b2b4ab..721a2fb 100644 --- a/scriptmanager/src/app/script/script-slide/script-slide.component.ts +++ b/scriptmanager/src/app/script/script-slide/script-slide.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; import { FormGroup, FormControl } from '@angular/forms'; // import * as ClassicEditor from '@ckeditor/ckeditor5-build-classic'; +//import { EditorChangeContent, EditorChangeSelection } from 'ngx-quill' @Component({ selector: 'app-script-slide', @@ -22,6 +23,8 @@ export class ScriptSlideComponent implements OnInit { public comment = false; public ckEditorCue: boolean = false; public ckEditorNarration: boolean = false; + public visual_cue : number = 0; + narration = 0; public quillStyles = { 'height': '200px', @@ -32,6 +35,44 @@ export class ScriptSlideComponent implements OnInit { editorForm: FormGroup; + + + onChange(event: any): void { + if(event == ''){ + this.visual_cue = 0; + }else + if(event == null){ + this.visual_cue = 0; + }else{ + var s = event; + var regex = /(<([^>]+)>)/ig; + s = s.replace(regex, " "); + var regex_space = /\s{2,}/ig; + s = s.trim().replace(regex_space,' ') + var len = s.split(" ").length; + this.visual_cue = len; + } +} + + onNarrationChange(event: any): void { + if(event == ''){ + this.narration = 0; + }else + if(event == null){ + this.narration = 0; + }else{ + var s = event; + var regex = /(<([^>]+)>)/ig; + s = s.replace(regex, " "); + var regex_space = /\s{2,}/ig; + s = s.trim().replace(regex_space,' ') + var len = s.split(" ").length; + this.narration = len; + } + } + + + // public Editor = ClassicEditor; // public ckeditorConfig = { // toolbar: ['heading', '|', 'bold', 'italic', 'bulletedList', 'numberedList', '|', 'undo', 'redo'] @@ -77,6 +118,7 @@ export class ScriptSlideComponent implements OnInit { public insertSlide() { this.insertSlideEmitter.emit(this.index + 1); + } public checkSlide() { @@ -109,13 +151,16 @@ export class ScriptSlideComponent implements OnInit { public changeNarrationToEditor() { this.ckEditorNarration = true; } - + + ngOnInit() { this.editorForm = new FormGroup({ 'cue': new FormControl(), 'narration': new FormControl() }) this.checkSlide() + } } + diff --git a/scriptmanager/src/app/script/script-view/script-view.component.html b/scriptmanager/src/app/script/script-view/script-view.component.html index 99a9494..2954106 100644 --- a/scriptmanager/src/app/script/script-view/script-view.component.html +++ b/scriptmanager/src/app/script/script-view/script-view.component.html @@ -80,9 +80,11 @@

  Updated On:
+

{{ visual_cue }}

+

{{ narration }}

diff --git a/scriptmanager/src/app/script/script-view/script-view.component.ts b/scriptmanager/src/app/script/script-view/script-view.component.ts index 5cb9f31..737dedc 100644 --- a/scriptmanager/src/app/script/script-view/script-view.component.ts +++ b/scriptmanager/src/app/script/script-view/script-view.component.ts @@ -65,7 +65,7 @@ export class ScriptViewComponent implements OnInit { console.error ); } - + public onPublishChange(status) { this.createscriptService.changeScriptStatus(this.domain, this.fid, this.tid, this.lid, this.vid, status) .subscribe( @@ -202,6 +202,7 @@ export class ScriptViewComponent implements OnInit { this.el2.nativeElement.classList.remove('is-active') } + public getRevison(i) { this.revisionsService.getRevisions( i diff --git a/scriptmanager/static/scriptmanager/main.js b/scriptmanager/static/scriptmanager/main.js index 57471b1..f6e0bd9 100644 --- a/scriptmanager/static/scriptmanager/main.js +++ b/scriptmanager/static/scriptmanager/main.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{"+tJ4":function(t,e,n){"use strict";n.d(e,"a",function(){return r});var r=function(t){return function(e){for(var n=0,r=t.length;n=0&&l.splice(e,1)}function p(t){var e=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var r=n.nc;r&&(t.attrs.nonce=r)}return g(e,t.attrs),h(t,e),e}function g(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function m(t,e){var n,r,i,o;if(e.transform&&t.css){if(!(o="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=o}if(e.singleton){var l=a++;n=s||(s=p(e)),r=y.bind(null,n,l,!1),i=y.bind(null,n,l,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",g(e,t.attrs),h(t,e),e}(e),r=(function(t,e,n){var r=n.css,i=n.sourceMap;(e.convertToAbsoluteUrls||void 0===e.convertToAbsoluteUrls&&i)&&(r=u(r)),i&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */");var o=new Blob([r],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(o),s&&URL.revokeObjectURL(s)}).bind(null,n,e),i=function(){f(n),n.href&&URL.revokeObjectURL(n.href)}):(n=p(e),r=(function(t,e){var n=e.css,r=e.media;if(r&&t.setAttribute("media",r),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}).bind(null,n),i=function(){f(n)});return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else i()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=i()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=d(t,e);return c(n,e),function(t){for(var i=[],o=0;o'},function(t,e){t.exports=function(t){if(!t.webpackPolyfill){var e=Object.create(t);e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),Object.defineProperty(e,"exports",{enumerable:!0}),e.webpackPolyfill=1}return e}},function(t,e){t.exports=''},function(t,e){t.exports=''},function(t,e){t.exports=''},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){var r=n(100);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e,n){"use strict";e.a=function(){return!1}},function(t,n,r){"use strict";(function(t){var i=r(4),o=e&&!e.nodeType&&e,s=o&&"object"==typeof t&&t&&!t.nodeType&&t,a=s&&s.exports===o?i.a.Buffer:void 0,l=a?a.allocUnsafe:void 0;n.a=function(t,e){if(e)return t.slice();var n=t.length,r=l?l(n):new t.constructor(n);return t.copy(r),r}}).call(this,r(12)(t))},function(t){t.exports={a:"12.2.0"}},function(t,e){t.exports=''},function(t,e){t.exports=''},function(t,e){t.exports=''},function(t,e){t.exports=''},function(t,e){t.exports=''},function(t,e){t.exports=''},function(t,e){t.exports=''},function(t,e){t.exports='\n'},function(t,e){t.exports='\n'},function(t,e){t.exports=''},function(t,e){t.exports=''},function(t,e){t.exports=''},function(t,e){t.exports=''},function(t,e){t.exports=''},function(t,e){t.exports=''},function(t,e){t.exports=''},function(t,e){t.exports=''},function(t,e){t.exports=''},function(t,e){t.exports=''},function(t,e){t.exports=''},function(t,e){t.exports=''},function(t,e){t.exports=''},function(t,e){t.exports=''},function(t,e){t.exports=''},function(t,e,n){var r=n(46);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.exports=".ck.ck-placeholder:before,.ck .ck-placeholder:before{content:attr(data-placeholder);pointer-events:none;cursor:text;color:var(--ck-color-engine-placeholder-text)}"},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,r=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,e){var i,o=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(o)?t:(i=0===o.indexOf("//")?o:0===o.indexOf("/")?n+o:r+o.replace(/^\.\//,""),"url("+JSON.stringify(i)+")")})}},function(t,e,n){var r=n(49);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.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:#47a4f5;--ck-color-focus-shadow:rgba(119,186,248,0.5);--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-on-background:var(--ck-color-button-action-background);--ck-color-switch-button-inner-background:var(--ck-color-base-background);--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-upload-infinite-background:rgba(0,0,0,0.1);--ck-color-link-default:#0000f0;--ck-color-link-selected-background:rgba(31,177,255,0.1);--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-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}: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(t,e,n){var r=n(51);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.exports=".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>:first-child{margin-top:var(--ck-spacing-large)}.ck.ck-editor__editable_inline>:last-child{margin-bottom:var(--ck-spacing-large)}.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(t,e,n){var r=n(53);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.exports=".ck.ck-label{display:block}.ck.ck-voice-label{display:none}.ck.ck-label{font-weight:700}"},function(t,e,n){var r=n(55);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.exports=".ck.ck-sticky-panel .ck-sticky-panel__content_sticky{z-index:var(--ck-z-modal);position:fixed;top:0}.ck.ck-sticky-panel .ck-sticky-panel__content_sticky_bottom-limit{top:auto;position:absolute}.ck.ck-sticky-panel .ck-sticky-panel__content_sticky{box-shadow:var(--ck-drop-shadow),0 0;border-width:0 1px 1px;border-top-left-radius:0;border-top-right-radius:0}"},function(t,e,n){var r=n(57);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.exports=".ck.ck-toolbar{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-flow:row wrap;align-items:center}.ck.ck-toolbar.ck-toolbar_vertical{flex-direction:column}.ck.ck-toolbar.ck-toolbar_floating{flex-wrap:nowrap}.ck.ck-toolbar__separator{display:inline-block}.ck.ck-toolbar__newline{display:block;width:100%}.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>*{margin-right:var(--ck-spacing-small);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{width:100%;margin:0;border-radius:0;border:0}.ck.ck-toolbar>:last-child{margin-right:0}.ck-toolbar-container .ck.ck-toolbar{border:0}.ck.ck-toolbar__separator{align-self:stretch;width:1px;margin-top:0;margin-bottom:0;background:var(--ck-color-toolbar-border)}.ck.ck-toolbar__newline{margin:0}"},function(t,e,n){var r=n(59);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.exports=".ck.ck-editor{position:relative}.ck.ck-editor .ck-editor__top .ck-sticky-panel .ck-toolbar{z-index:var(--ck-z-modal)}.ck.ck-editor__top .ck-sticky-panel .ck-toolbar{border-radius:0}.ck-rounded-corners .ck.ck-editor__top .ck-sticky-panel .ck-toolbar,.ck.ck-editor__top .ck-sticky-panel .ck-toolbar.ck-rounded-corners{border-radius:var(--ck-border-radius);border-bottom-left-radius:0;border-bottom-right-radius:0}.ck.ck-editor__top .ck-sticky-panel .ck-toolbar{border-bottom-width:0}.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content_sticky .ck-toolbar{border-bottom-width:1px;border-radius:0}.ck-rounded-corners .ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content_sticky .ck-toolbar,.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content_sticky .ck-toolbar.ck-rounded-corners{border-radius:var(--ck-border-radius);border-radius:0}.ck.ck-editor__main>.ck-editor__editable{background:var(--ck-color-base-background);border-radius:0}.ck-rounded-corners .ck.ck-editor__main>.ck-editor__editable,.ck.ck-editor__main>.ck-editor__editable.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0;border-top-right-radius:0}.ck.ck-editor__main>.ck-editor__editable:not(.ck-focused){border-color:var(--ck-color-base-border)}"},function(t,e,n){var r=n(61);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.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(t,e,n){var r=n(63);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.exports='.ck.ck-tooltip,.ck.ck-tooltip .ck-tooltip__text:after{position:absolute;pointer-events:none;-webkit-backface-visibility:hidden}.ck-tooltip{visibility:hidden;opacity:0;display:none;z-index:var(--ck-z-modal)}.ck-tooltip .ck-tooltip__text{display:inline-block}.ck-tooltip .ck-tooltip__text:after{content:"";width:0;height:0}:root{--ck-tooltip-arrow-size:5px}.ck.ck-tooltip{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)}.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{border-style:solid;left:50%}.ck.ck-tooltip,.ck.ck-tooltip .ck-tooltip__text:after{transition:opacity .2s ease-in-out .2s}'},function(t,e,n){var r=n(65);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.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_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 .ck-button__label,.ck.ck-button:focus:not(:hover) .ck-tooltip,a.ck.ck-button .ck-button__label,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;-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;border-color:transparent}.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-button_with-text,a.ck.ck-button.ck-button_with-text{padding:var(--ck-spacing-tiny) var(--ck-spacing-standard)}.ck.ck-button.ck-button_with-text .ck-button__icon,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)}.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 .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}.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(t,e,n){var r=n(67);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.exports=".ck-content blockquote{overflow:hidden;padding-right:1.5em;padding-left:1.5em;margin-left:0;font-style:italic;border-left:5px solid #ccc}"},function(t,e,n){var r=n(69);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.exports=".ck .ck-widget.ck-widget_with-selection-handler{position:relative}.ck .ck-widget.ck-widget_with-selection-handler .ck-widget__selection-handler{visibility:hidden;position:absolute}.ck .ck-widget.ck-widget_with-selection-handler .ck-widget__selection-handler .ck-icon{display:block}.ck .ck-widget.ck-widget_with-selection-handler.ck-widget_selected .ck-widget__selection-handler,.ck .ck-widget.ck-widget_with-selection-handler:hover .ck-widget__selection-handler{visibility:visible}: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-editor__editable>.ck-widget.ck-widget_with-selection-handler:first-child,.ck-editor__editable blockquote>.ck-widget.ck-widget_with-selection-handler:first-child{margin-top:calc(1em + var(--ck-widget-handler-icon-size))}.ck .ck-widget.ck-widget_with-selection-handler .ck-widget__selection-handler{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-handler .ck-widget__selection-handler:hover .ck-icon .ck-icon__selected-indicator{opacity:1}.ck .ck-widget.ck-widget_with-selection-handler .ck-widget__selection-handler .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-handler .ck-widget__selection-handler .ck-icon .ck-icon__selected-indicator{opacity:0;transition:opacity .3s var(--ck-widget-handler-animation-curve)}.ck .ck-widget.ck-widget_with-selection-handler.ck-widget_selected .ck-widget__selection-handler,.ck .ck-widget.ck-widget_with-selection-handler.ck-widget_selected:hover .ck-widget__selection-handler{opacity:1;background-color:var(--ck-color-focus-border)}.ck .ck-widget.ck-widget_with-selection-handler.ck-widget_selected .ck-widget__selection-handler .ck-icon .ck-icon__selected-indicator,.ck .ck-widget.ck-widget_with-selection-handler.ck-widget_selected:hover .ck-widget__selection-handler .ck-icon .ck-icon__selected-indicator{opacity:1}.ck .ck-widget.ck-widget_with-selection-handler:hover .ck-widget__selection-handler{opacity:1;background-color:var(--ck-color-widget-hover-border)}.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected,.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover{outline-color:var(--ck-color-widget-blurred-border)}.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected .ck-widget__selection-handler,.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected .ck-widget__selection-handler:hover,.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover .ck-widget__selection-handler,.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover .ck-widget__selection-handler:hover{background:var(--ck-color-widget-blurred-border)}.ck-editor__editable.ck-read-only .ck-widget{--ck-widget-outline-thickness:0}"},function(t,e,n){var r=n(71);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.exports=".ck.ck-labeled-input .ck-labeled-input__status{font-size:var(--ck-font-size-small);margin-top:var(--ck-spacing-small);white-space:normal}.ck.ck-labeled-input .ck-labeled-input__status_error{color:var(--ck-color-base-error)}"},function(t,e,n){var r=n(73);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.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-property:box-shadow,border;transition:.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(t,e,n){var r=n(75);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.exports=".ck.ck-text-alternative-form{display:flex;flex-direction:row;flex-wrap:nowrap}.ck.ck-text-alternative-form .ck-labeled-input{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-input{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}.ck.ck-text-alternative-form>:not(:first-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-input{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-text-alternative-form .ck-labeled-input .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);margin-left:0;border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border)}.ck.ck-text-alternative-form .ck-button:first-of-type{border-right:1px solid var(--ck-color-base-border)}}"},function(t,e,n){var r=n(77);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.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))}'},function(t,e,n){var r=n(79);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.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(t,e,n){var r=n(81);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.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(t,e,n){var r=n(83);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.exports=".ck-content .image{clear:both;text-align:center;margin:1em 0}.ck-content .image>img{display:block;margin:0 auto;max-width:100%}"},function(t,e,n){var r=n(85);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.exports=".ck-content .image{position:relative;overflow:hidden}.ck-content .image .ck-progress-bar{position:absolute;top:0;left:0}:root{--ck-image-upload-progress-line-width:30px}.ck-content .image.ck-appear{animation:fadeIn .7s}.ck-content .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(t,e,n){var r=n(87);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.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(t,e,n){var r=n(89);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.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(t,e,n){var r=n(91);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.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;will-change:transform}.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{transform:translate3d(0,100%,0)}.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}:root{--ck-dropdown-arrow-size:calc(0.5*var(--ck-icon-size))}.ck.ck-dropdown{font-size:inherit}.ck.ck-dropdown .ck-dropdown__arrow{right:var(--ck-spacing-standard);width:var(--ck-dropdown-arrow-size);margin-left:var(--ck-spacing-small)}.ck.ck-dropdown.ck-disabled .ck-dropdown__arrow{opacity:var(--ck-disabled-opacity)}.ck.ck-dropdown .ck-button.ck-dropdown__button:not(.ck-button_with-text){padding-left:var(--ck-spacing-small)}.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-button__label{width:7em;overflow:hidden;text-overflow:ellipsis}.ck.ck-dropdown__panel{box-shadow:var(--ck-drop-shadow),0 0;border-radius:0}.ck-rounded-corners .ck.ck-dropdown__panel,.ck.ck-dropdown__panel.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0}.ck.ck-dropdown__panel{background:var(--ck-color-dropdown-panel-background);border:1px solid var(--ck-color-dropdown-panel-border);bottom:0;min-width:100%}"},function(t,e,n){var r=n(93);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.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;border: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:hover:not(ck-disabled){background:var(--ck-color-list-button-on-background-focus)}.ck.ck-list__item .ck-button.ck-on:active{box-shadow:none}.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(t,e,n){var r=n(95);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.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.ck-button.ck-switchbutton .ck-button__label{margin-right:calc(2*var(--ck-spacing-large))}.ck.ck-button.ck-switchbutton.ck-disabled .ck-button__toggle{opacity:var(--ck-disabled-opacity)}.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)}.ck.ck-button.ck-switchbutton .ck-button__toggle{margin-left:auto;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:transform .3s ease}.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 .ck-button__toggle__inner{transform:translateX(1.3846153847em)}"},function(t,e,n){var r=n(97);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.exports=".ck.ck-toolbar-dropdown .ck-toolbar{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(t,e,n){var r=n(99);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.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(t,e){t.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(t,e,n){var r=n(102);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.exports=".ck-content .image>figcaption{color:#333;background-color:#f7f7f7;padding:.6em;font-size:.75em;outline-offset:-1px}"},function(t,e,n){var r=n(104);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.exports=":root{--ck-image-style-spacing:1.5em}.ck-content .image-style-align-center,.ck-content .image-style-align-left,.ck-content .image-style-align-right,.ck-content .image-style-side{max-width:50%}.ck-content .image-style-side{float:right;margin-left:var(--ck-image-style-spacing)}.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(t,e,n){var r=n(106);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.exports=".ck .ck-link_selected{background:var(--ck-color-link-selected-background)}"},function(t,e,n){var r=n(108);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.exports=".ck.ck-link-form{display:flex;flex-direction:row;flex-wrap:nowrap}.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-input{flex-basis:100%}.ck.ck-link-form .ck-button{flex-basis:50%}}.ck.ck-link-form{padding:var(--ck-spacing-standard)}.ck.ck-link-form:focus{outline:none}.ck.ck-link-form>:not(:first-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-input{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-link-form .ck-labeled-input .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);margin-left:0;border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border)}.ck.ck-link-form .ck-button:first-of-type{border-right:1px solid var(--ck-color-base-border)}}"},function(t,e,n){var r=n(110);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.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.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 .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:focus{outline:none}.ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){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);margin-left:0;border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border)}.ck.ck-link-actions .ck-button:not(.ck-link-actions__preview):first-of-type{border-right:1px solid var(--ck-color-base-border)}}"},function(t,e,n){var r=n(112);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.exports='.ck-media__wrapper .ck-media__placeholder{display:flex;flex-direction:column;align-items:center}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url .ck-tooltip{display:block}@media (hover:none){.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url .ck-tooltip{display:none}}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url{max-width:100%;position:relative}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url:hover .ck-tooltip{visibility:visible;opacity:1}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url .ck-media__placeholder__url__text{overflow:hidden;display:block}.ck-media__wrapper[data-oembed-url*="facebook.com"] .ck-media__placeholder__icon *,.ck-media__wrapper[data-oembed-url*="google.com/maps"] .ck-media__placeholder__icon *,.ck-media__wrapper[data-oembed-url*="instagram.com"] .ck-media__placeholder__icon *,.ck-media__wrapper[data-oembed-url*="twitter.com"] .ck-media__placeholder__icon *{display:none}.ck-editor__editable:not(.ck-read-only) .ck-media__wrapper>:not(.ck-media__placeholder){pointer-events:none}:root{--ck-media-embed-placeholder-icon-size:3em;--ck-color-media-embed-placeholder-url-text:#757575;--ck-color-media-embed-placeholder-url-text-hover:var(--ck-color-base-text)}.ck-media__wrapper{margin:0 auto}.ck-media__wrapper .ck-media__placeholder{padding:calc(3*var(--ck-spacing-standard));background:var(--ck-color-base-foreground)}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__icon{min-width:var(--ck-media-embed-placeholder-icon-size);height:var(--ck-media-embed-placeholder-icon-size);margin-bottom:var(--ck-spacing-large);background-position:50%;background-size:cover}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__icon .ck-icon{width:100%;height:100%}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url .ck-media__placeholder__url__text{color:var(--ck-color-media-embed-placeholder-url-text);white-space:nowrap;text-align:center;font-style:italic;text-overflow:ellipsis}.ck-media__wrapper .ck-media__placeholder .ck-media__placeholder__url .ck-media__placeholder__url__text:hover{color:var(--ck-color-media-embed-placeholder-url-text-hover);cursor:pointer;text-decoration:underline}.ck-media__wrapper[data-oembed-url*="open.spotify.com"]{max-width:300px;max-height:380px}.ck-media__wrapper[data-oembed-url*="twitter.com"] .ck.ck-media__placeholder{background:linear-gradient(90deg,#71c6f4,#0d70a5)}.ck-media__wrapper[data-oembed-url*="twitter.com"] .ck.ck-media__placeholder .ck-media__placeholder__icon{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0MDAgNDAwIj48cGF0aCBkPSJNNDAwIDIwMGMwIDExMC41LTg5LjUgMjAwLTIwMCAyMDBTMCAzMTAuNSAwIDIwMCA4OS41IDAgMjAwIDBzMjAwIDg5LjUgMjAwIDIwMHpNMTYzLjQgMzA1LjVjODguNyAwIDEzNy4yLTczLjUgMTM3LjItMTM3LjIgMC0yLjEgMC00LjItLjEtNi4yIDkuNC02LjggMTcuNi0xNS4zIDI0LjEtMjUtOC42IDMuOC0xNy45IDYuNC0yNy43IDcuNiAxMC02IDE3LjYtMTUuNCAyMS4yLTI2LjctOS4zIDUuNS0xOS42IDkuNS0zMC42IDExLjctOC44LTkuNC0yMS4zLTE1LjItMzUuMi0xNS4yLTI2LjYgMC00OC4yIDIxLjYtNDguMiA0OC4yIDAgMy44LjQgNy41IDEuMyAxMS00MC4xLTItNzUuNi0yMS4yLTk5LjQtNTAuNC00LjEgNy4xLTYuNSAxNS40LTYuNSAyNC4yIDAgMTYuNyA4LjUgMzEuNSAyMS41IDQwLjEtNy45LS4yLTE1LjMtMi40LTIxLjgtNnYuNmMwIDIzLjQgMTYuNiA0Mi44IDM4LjcgNDcuMy00IDEuMS04LjMgMS43LTEyLjcgMS43LTMuMSAwLTYuMS0uMy05LjEtLjkgNi4xIDE5LjIgMjMuOSAzMy4xIDQ1IDMzLjUtMTYuNSAxMi45LTM3LjMgMjAuNi01OS45IDIwLjYtMy45IDAtNy43LS4yLTExLjUtLjcgMjEuMSAxMy44IDQ2LjUgMjEuOCA3My43IDIxLjgiIGZpbGw9IiNmZmYiLz48L3N2Zz4=)}.ck-media__wrapper[data-oembed-url*="twitter.com"] .ck.ck-media__placeholder .ck-media__placeholder__url__text{color:#b8e6ff}.ck-media__wrapper[data-oembed-url*="twitter.com"] .ck.ck-media__placeholder .ck-media__placeholder__url__text:hover{color:#fff}.ck-media__wrapper[data-oembed-url*="google.com/maps"] .ck-media__placeholder__icon{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNTAuMzc4IiBoZWlnaHQ9IjI1NC4xNjciIHZpZXdCb3g9IjAgMCA2Ni4yNDYgNjcuMjQ4Ij48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTcyLjUzMSAtMjE4LjQ1NSkgc2NhbGUoLjk4MDEyKSI+PHJlY3Qgcnk9IjUuMjM4IiByeD0iNS4yMzgiIHk9IjIzMS4zOTkiIHg9IjE3Ni4wMzEiIGhlaWdodD0iNjAuMDk5IiB3aWR0aD0iNjAuMDk5IiBmaWxsPSIjMzRhNjY4IiBwYWludC1vcmRlcj0ibWFya2VycyBzdHJva2UgZmlsbCIvPjxwYXRoIGQ9Ik0yMDYuNDc3IDI2MC45bC0yOC45ODcgMjguOTg3YTUuMjE4IDUuMjE4IDAgMCAwIDMuNzggMS42MWg0OS42MjFjMS42OTQgMCAzLjE5LS43OTggNC4xNDYtMi4wMzd6IiBmaWxsPSIjNWM4OGM1Ii8+PHBhdGggZD0iTTIyNi43NDIgMjIyLjk4OGMtOS4yNjYgMC0xNi43NzcgNy4xNy0xNi43NzcgMTYuMDE0LjAwNyAyLjc2Mi42NjMgNS40NzQgMi4wOTMgNy44NzUuNDMuNzAzLjgzIDEuNDA4IDEuMTkgMi4xMDcuMzMzLjUwMi42NSAxLjAwNS45NSAxLjUwOC4zNDMuNDc3LjY3My45NTcuOTg4IDEuNDQgMS4zMSAxLjc2OSAyLjUgMy41MDIgMy42MzcgNS4xNjguNzkzIDEuMjc1IDEuNjgzIDIuNjQgMi40NjYgMy45OSAyLjM2MyA0LjA5NCA0LjAwNyA4LjA5MiA0LjYgMTMuOTE0di4wMTJjLjE4Mi40MTIuNTE2LjY2Ni44NzkuNjY3LjQwMy0uMDAxLjc2OC0uMzE0LjkzLS43OTkuNjAzLTUuNzU2IDIuMjM4LTkuNzI5IDQuNTg1LTEzLjc5NC43ODItMS4zNSAxLjY3My0yLjcxNSAyLjQ2NS0zLjk5IDEuMTM3LTEuNjY2IDIuMzI4LTMuNCAzLjYzOC01LjE2OS4zMTUtLjQ4Mi42NDUtLjk2Mi45ODgtMS40MzkuMy0uNTAzLjYxNy0xLjAwNi45NS0xLjUwOC4zNTktLjcuNzYtMS40MDQgMS4xOS0yLjEwNyAxLjQyNi0yLjQwMiAyLTUuMTE0IDIuMDA0LTcuODc1IDAtOC44NDQtNy41MTEtMTYuMDE0LTE2Ljc3Ni0xNi4wMTR6IiBmaWxsPSIjZGQ0YjNlIiBwYWludC1vcmRlcj0ibWFya2VycyBzdHJva2UgZmlsbCIvPjxlbGxpcHNlIHJ5PSI1LjU2NCIgcng9IjUuODI4IiBjeT0iMjM5LjAwMiIgY3g9IjIyNi43NDIiIGZpbGw9IiM4MDJkMjciIHBhaW50LW9yZGVyPSJtYXJrZXJzIHN0cm9rZSBmaWxsIi8+PHBhdGggZD0iTTE5MC4zMDEgMjM3LjI4M2MtNC42NyAwLTguNDU3IDMuODUzLTguNDU3IDguNjA2czMuNzg2IDguNjA3IDguNDU3IDguNjA3YzMuMDQzIDAgNC44MDYtLjk1OCA2LjMzNy0yLjUxNiAxLjUzLTEuNTU3IDIuMDg3LTMuOTEzIDIuMDg3LTYuMjkgMC0uMzYyLS4wMjMtLjcyMi0uMDY0LTEuMDc5aC04LjI1N3YzLjA0M2g0Ljg1Yy0uMTk3Ljc1OS0uNTMxIDEuNDUtMS4wNTggMS45ODYtLjk0Mi45NTgtMi4wMjggMS41NDgtMy45MDEgMS41NDgtMi44NzYgMC01LjIwOC0yLjM3Mi01LjIwOC01LjI5OSAwLTIuOTI2IDIuMzMyLTUuMjk5IDUuMjA4LTUuMjk5IDEuMzk5IDAgMi42MTguNDA3IDMuNTg0IDEuMjkzbDIuMzgxLTIuMzhjMC0uMDAyLS4wMDMtLjAwNC0uMDA0LS4wMDUtMS41ODgtMS41MjQtMy42Mi0yLjIxNS01Ljk1NS0yLjIxNXptNC40MyA1LjY2bC4wMDMuMDA2di0uMDAzeiIgZmlsbD0iI2ZmZiIgcGFpbnQtb3JkZXI9Im1hcmtlcnMgc3Ryb2tlIGZpbGwiLz48cGF0aCBkPSJNMjE1LjE4NCAyNTEuOTI5bC03Ljk4IDcuOTc5IDI4LjQ3NyAyOC40NzVhNS4yMzMgNS4yMzMgMCAwIDAgLjQ0OS0yLjEyM3YtMzEuMTY1Yy0uNDY5LjY3NS0uOTM0IDEuMzQ5LTEuMzgyIDIuMDA1LS43OTIgMS4yNzUtMS42ODIgMi42NC0yLjQ2NSAzLjk5LTIuMzQ3IDQuMDY1LTMuOTgyIDguMDM4LTQuNTg1IDEzLjc5NC0uMTYyLjQ4NS0uNTI3Ljc5OC0uOTMuNzk5LS4zNjMtLjAwMS0uNjk3LS4yNTUtLjg3OS0uNjY3di0uMDEyYy0uNTkzLTUuODIyLTIuMjM3LTkuODItNC42LTEzLjkxNC0uNzgzLTEuMzUtMS42NzMtMi43MTUtMi40NjYtMy45OS0xLjEzNy0xLjY2Ni0yLjMyNy0zLjQtMy42MzctNS4xNjlsLS4wMDItLjAwM3oiIGZpbGw9IiNjM2MzYzMiLz48cGF0aCBkPSJNMjEyLjk4MyAyNDguNDk1bC0zNi45NTIgMzYuOTUzdi44MTJhNS4yMjcgNS4yMjcgMCAwIDAgNS4yMzggNS4yMzhoMS4wMTVsMzUuNjY2LTM1LjY2NmExMzYuMjc1IDEzNi4yNzUgMCAwIDAtMi43NjQtMy45IDM3LjU3NSAzNy41NzUgMCAwIDAtLjk4OS0xLjQ0IDM1LjEyNyAzNS4xMjcgMCAwIDAtLjk1LTEuNTA4Yy0uMDgzLS4xNjItLjE3Ni0uMzI2LS4yNjQtLjQ4OXoiIGZpbGw9IiNmZGRjNGYiIHBhaW50LW9yZGVyPSJtYXJrZXJzIHN0cm9rZSBmaWxsIi8+PHBhdGggZD0iTTIxMS45OTggMjYxLjA4M2wtNi4xNTIgNi4xNTEgMjQuMjY0IDI0LjI2NGguNzgxYTUuMjI3IDUuMjI3IDAgMCAwIDUuMjM5LTUuMjM4di0xLjA0NXoiIGZpbGw9IiNmZmYiIHBhaW50LW9yZGVyPSJtYXJrZXJzIHN0cm9rZSBmaWxsIi8+PC9nPjwvc3ZnPg==)}.ck-media__wrapper[data-oembed-url*="facebook.com"] .ck-media__placeholder{background:#4268b3}.ck-media__wrapper[data-oembed-url*="facebook.com"] .ck-media__placeholder .ck-media__placeholder__icon{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAyNCIgaGVpZ2h0PSIxMDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik05NjcuNDg0IDBINTYuNTE3QzI1LjMwNCAwIDAgMjUuMzA0IDAgNTYuNTE3djkxMC45NjZDMCA5OTguNjk0IDI1LjI5NyAxMDI0IDU2LjUyMiAxMDI0SDU0N1Y2MjhINDE0VjQ3M2gxMzNWMzU5LjAyOWMwLTEzMi4yNjIgODAuNzczLTIwNC4yODIgMTk4Ljc1Ni0yMDQuMjgyIDU2LjUxMyAwIDEwNS4wODYgNC4yMDggMTE5LjI0NCA2LjA4OVYyOTlsLTgxLjYxNi4wMzdjLTYzLjk5MyAwLTc2LjM4NCAzMC40OTItNzYuMzg0IDc1LjIzNlY0NzNoMTUzLjQ4N2wtMTkuOTg2IDE1NUg3MDd2Mzk2aDI2MC40ODRjMzEuMjEzIDAgNTYuNTE2LTI1LjMwMyA1Ni41MTYtNTYuNTE2VjU2LjUxNUMxMDI0IDI1LjMwMyA5OTguNjk3IDAgOTY3LjQ4NCAwIiBmaWxsPSIjRkZGRkZFIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=)}.ck-media__wrapper[data-oembed-url*="facebook.com"] .ck-media__placeholder .ck-media__placeholder__url__text{color:#cdf}.ck-media__wrapper[data-oembed-url*="facebook.com"] .ck-media__placeholder .ck-media__placeholder__url__text:hover{color:#fff}.ck-media__wrapper[data-oembed-url*="instagram.com"] .ck-media__placeholder{background:linear-gradient(-135deg,#1400c8,#b900b4,#f50000)}.ck-media__wrapper[data-oembed-url*="instagram.com"] .ck-media__placeholder .ck-media__placeholder__icon{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTA0IiBoZWlnaHQ9IjUwNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGRlZnM+PHBhdGggaWQ9ImEiIGQ9Ik0wIC4xNTloNTAzLjg0MVY1MDMuOTRIMHoiLz48L2RlZnM+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48bWFzayBpZD0iYiIgZmlsbD0iI2ZmZiI+PHVzZSB4bGluazpocmVmPSIjYSIvPjwvbWFzaz48cGF0aCBkPSJNMjUxLjkyMS4xNTljLTY4LjQxOCAwLTc2Ljk5Ny4yOS0xMDMuODY3IDEuNTE2LTI2LjgxNCAxLjIyMy00NS4xMjcgNS40ODItNjEuMTUxIDExLjcxLTE2LjU2NiA2LjQzNy0zMC42MTUgMTUuMDUxLTQ0LjYyMSAyOS4wNTYtMTQuMDA1IDE0LjAwNi0yMi42MTkgMjguMDU1LTI5LjA1NiA0NC42MjEtNi4yMjggMTYuMDI0LTEwLjQ4NyAzNC4zMzctMTEuNzEgNjEuMTUxQy4yOSAxNzUuMDgzIDAgMTgzLjY2MiAwIDI1Mi4wOGMwIDY4LjQxNy4yOSA3Ni45OTYgMS41MTYgMTAzLjg2NiAxLjIyMyAyNi44MTQgNS40ODIgNDUuMTI3IDExLjcxIDYxLjE1MSA2LjQzNyAxNi41NjYgMTUuMDUxIDMwLjYxNSAyOS4wNTYgNDQuNjIxIDE0LjAwNiAxNC4wMDUgMjguMDU1IDIyLjYxOSA0NC42MjEgMjkuMDU3IDE2LjAyNCA2LjIyNyAzNC4zMzcgMTAuNDg2IDYxLjE1MSAxMS43MDkgMjYuODcgMS4yMjYgMzUuNDQ5IDEuNTE2IDEwMy44NjcgMS41MTYgNjguNDE3IDAgNzYuOTk2LS4yOSAxMDMuODY2LTEuNTE2IDI2LjgxNC0xLjIyMyA0NS4xMjctNS40ODIgNjEuMTUxLTExLjcwOSAxNi41NjYtNi40MzggMzAuNjE1LTE1LjA1MiA0NC42MjEtMjkuMDU3IDE0LjAwNS0xNC4wMDYgMjIuNjE5LTI4LjA1NSAyOS4wNTctNDQuNjIxIDYuMjI3LTE2LjAyNCAxMC40ODYtMzQuMzM3IDExLjcwOS02MS4xNTEgMS4yMjYtMjYuODcgMS41MTYtMzUuNDQ5IDEuNTE2LTEwMy44NjYgMC02OC40MTgtLjI5LTc2Ljk5Ny0xLjUxNi0xMDMuODY3LTEuMjIzLTI2LjgxNC01LjQ4Mi00NS4xMjctMTEuNzA5LTYxLjE1MS02LjQzOC0xNi41NjYtMTUuMDUyLTMwLjYxNS0yOS4wNTctNDQuNjIxLTE0LjAwNi0xNC4wMDUtMjguMDU1LTIyLjYxOS00NC42MjEtMjkuMDU2LTE2LjAyNC02LjIyOC0zNC4zMzctMTAuNDg3LTYxLjE1MS0xMS43MUMzMjguOTE3LjQ0OSAzMjAuMzM4LjE1OSAyNTEuOTIxLjE1OXptMCA0NS4zOTFjNjcuMjY1IDAgNzUuMjMzLjI1NyAxMDEuNzk3IDEuNDY5IDI0LjU2MiAxLjEyIDM3LjkwMSA1LjIyNCA0Ni43NzggOC42NzQgMTEuNzU5IDQuNTcgMjAuMTUxIDEwLjAyOSAyOC45NjYgMTguODQ1IDguODE2IDguODE1IDE0LjI3NSAxNy4yMDcgMTguODQ1IDI4Ljk2NiAzLjQ1IDguODc3IDcuNTU0IDIyLjIxNiA4LjY3NCA0Ni43NzggMS4yMTIgMjYuNTY0IDEuNDY5IDM0LjUzMiAxLjQ2OSAxMDEuNzk4IDAgNjcuMjY1LS4yNTcgNzUuMjMzLTEuNDY5IDEwMS43OTctMS4xMiAyNC41NjItNS4yMjQgMzcuOTAxLTguNjc0IDQ2Ljc3OC00LjU3IDExLjc1OS0xMC4wMjkgMjAuMTUxLTE4Ljg0NSAyOC45NjYtOC44MTUgOC44MTYtMTcuMjA3IDE0LjI3NS0yOC45NjYgMTguODQ1LTguODc3IDMuNDUtMjIuMjE2IDcuNTU0LTQ2Ljc3OCA4LjY3NC0yNi41NiAxLjIxMi0zNC41MjcgMS40NjktMTAxLjc5NyAxLjQ2OS02Ny4yNzEgMC03NS4yMzctLjI1Ny0xMDEuNzk4LTEuNDY5LTI0LjU2Mi0xLjEyLTM3LjkwMS01LjIyNC00Ni43NzgtOC42NzQtMTEuNzU5LTQuNTctMjAuMTUxLTEwLjAyOS0yOC45NjYtMTguODQ1LTguODE1LTguODE1LTE0LjI3NS0xNy4yMDctMTguODQ1LTI4Ljk2Ni0zLjQ1LTguODc3LTcuNTU0LTIyLjIxNi04LjY3NC00Ni43NzgtMS4yMTItMjYuNTY0LTEuNDY5LTM0LjUzMi0xLjQ2OS0xMDEuNzk3IDAtNjcuMjY2LjI1Ny03NS4yMzQgMS40NjktMTAxLjc5OCAxLjEyLTI0LjU2MiA1LjIyNC0zNy45MDEgOC42NzQtNDYuNzc4IDQuNTctMTEuNzU5IDEwLjAyOS0yMC4xNTEgMTguODQ1LTI4Ljk2NiA4LjgxNS04LjgxNiAxNy4yMDctMTQuMjc1IDI4Ljk2Ni0xOC44NDUgOC44NzctMy40NSAyMi4yMTYtNy41NTQgNDYuNzc4LTguNjc0IDI2LjU2NC0xLjIxMiAzNC41MzItMS40NjkgMTAxLjc5OC0xLjQ2OXoiIGZpbGw9IiNGRkYiIG1hc2s9InVybCgjYikiLz48cGF0aCBkPSJNMjUxLjkyMSAzMzYuMDUzYy00Ni4zNzggMC04My45NzQtMzcuNTk2LTgzLjk3NC04My45NzMgMC00Ni4zNzggMzcuNTk2LTgzLjk3NCA4My45NzQtODMuOTc0IDQ2LjM3NyAwIDgzLjk3MyAzNy41OTYgODMuOTczIDgzLjk3NCAwIDQ2LjM3Ny0zNy41OTYgODMuOTczLTgzLjk3MyA4My45NzN6bTAtMjEzLjMzOGMtNzEuNDQ3IDAtMTI5LjM2NSA1Ny45MTgtMTI5LjM2NSAxMjkuMzY1IDAgNzEuNDQ2IDU3LjkxOCAxMjkuMzY0IDEyOS4zNjUgMTI5LjM2NCA3MS40NDYgMCAxMjkuMzY0LTU3LjkxOCAxMjkuMzY0LTEyOS4zNjQgMC03MS40NDctNTcuOTE4LTEyOS4zNjUtMTI5LjM2NC0xMjkuMzY1ek00MTYuNjI3IDExNy42MDRjMCAxNi42OTYtMTMuNTM1IDMwLjIzLTMwLjIzMSAzMC4yMy0xNi42OTUgMC0zMC4yMy0xMy41MzQtMzAuMjMtMzAuMjMgMC0xNi42OTYgMTMuNTM1LTMwLjIzMSAzMC4yMy0zMC4yMzEgMTYuNjk2IDAgMzAuMjMxIDEzLjUzNSAzMC4yMzEgMzAuMjMxIiBmaWxsPSIjRkZGIi8+PC9nPjwvc3ZnPg==)}.ck-media__wrapper[data-oembed-url*="instagram.com"] .ck-media__placeholder .ck-media__placeholder__url__text{color:#ffe0fe}.ck-media__wrapper[data-oembed-url*="instagram.com"] .ck-media__placeholder .ck-media__placeholder__url__text:hover{color:#fff}'},function(t,e,n){var r=n(114);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.exports=".ck.ck-media-form{display:flex;align-items:flex-start;flex-direction:row;flex-wrap:nowrap}.ck.ck-media-form .ck-labeled-input{display:inline-block}.ck.ck-media-form .ck-label{display:none}@media screen and (max-width:600px){.ck.ck-media-form{flex-wrap:wrap}.ck.ck-media-form .ck-labeled-input{flex-basis:100%}.ck.ck-media-form .ck-button{flex-basis:50%}}.ck.ck-media-form{padding:var(--ck-spacing-standard)}.ck.ck-media-form:focus{outline:none}.ck.ck-media-form>:not(:first-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-media-form{padding:0;width:calc(0.8*var(--ck-input-text-width))}.ck.ck-media-form .ck-labeled-input{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-media-form .ck-labeled-input .ck-input-text{min-width:0;width:100%}.ck.ck-media-form .ck-labeled-input .ck-labeled-input__error{white-space:normal}.ck.ck-media-form .ck-button{padding:var(--ck-spacing-standard);margin-top:var(--ck-spacing-standard);margin-left:0;border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border)}.ck.ck-media-form .ck-button:first-of-type{border-right:1px solid var(--ck-color-base-border)}}"},function(t,e,n){var r=n(116);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.exports=".ck-content .media{clear:both;margin:1em 0;display:block;min-width:15em}"},function(t,e,n){var r=n(118);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.exports=":root{--ck-color-table-focused-cell-background:#f5fafe}.ck-widget.table td.ck-editor__nested-editable.ck-editor__nested-editable_focused,.ck-widget.table th.ck-editor__nested-editable.ck-editor__nested-editable_focused{background:var(--ck-color-table-focused-cell-background);border-style:none;outline:1px solid var(--ck-color-focus-border);outline-offset:-1px}"},function(t,e,n){var r=n(120);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.exports=":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-insert-table-dropdown-box-border-color:#bfbfbf;--ck-insert-table-dropdown-box-border-active-color:#53a0e4;--ck-insert-table-dropdown-box-active-background:#c7e5ff}.ck .ck-insert-table-dropdown__grid{display:flex;flex-direction:row;flex-wrap:wrap;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-insert-table-dropdown-box-border-color);border-radius:1px}.ck .ck-insert-table-dropdown-grid-box.ck-on{border-color:var(--ck-insert-table-dropdown-box-border-active-color);background:var(--ck-insert-table-dropdown-box-active-background)}"},function(t,e,n){var r=n(122);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{singleton:!0,hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e){t.exports=".ck-content .table{margin:1em auto;display:table}.ck-content .table table{border-collapse:collapse;border-spacing:0;border:1px double #b3b3b3}.ck-content .table table td,.ck-content .table table th{min-width:2em;padding:.4em;border-color:#d9d9d9}.ck-content .table table th{font-weight:700;background:#fafafa}"},function(t,e,n){"use strict";n.r(e);var r=n(4),i=r.a.Symbol,o=Object.prototype,s=o.hasOwnProperty,a=o.toString,l=i?i.toStringTag:void 0,u=Object.prototype.toString,c=i?i.toStringTag:void 0,d=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":c&&c in Object(t)?function(t){var e=s.call(t,l),n=t[l];try{t[l]=void 0;var r=!0}catch(t){}var i=a.call(t);return r&&(e?t[l]=n:delete t[l]),i}(t):function(t){return u.call(t)}(t)},h=function(t,e){return function(n){return t(e(n))}},f=h(Object.getPrototypeOf,Object),p=function(t){return null!=t&&"object"==typeof t},g=Function.prototype,m=Object.prototype,v=g.toString,y=m.hasOwnProperty,b=v.call(Object),w=function(t){if(!p(t)||"[object Object]"!=d(t))return!1;var e=f(t);if(null===e)return!0;var n=y.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&v.call(n)==b},_=function(t,e){return t===e||t!=t&&e!=e},k=function(t,e){for(var n=t.length;n--;)if(_(t[n][0],e))return n;return-1},x=Array.prototype.splice;function C(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e-1},C.prototype.set=function(t,e){var n=this.__data__,r=k(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};var A=C,S=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},E=function(t){if(!S(t))return!1;var e=d(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},O=r.a["__core-js_shared__"],P=function(){var t=/[^.]+$/.exec(O&&O.keys&&O.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),T=Function.prototype.toString,N=function(t){if(null!=t){try{return T.call(t)}catch(t){}try{return t+""}catch(t){}}return""},I=/^\[object .+?Constructor\]$/,M=Function.prototype,D=Object.prototype,j=RegExp("^"+M.toString.call(D.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),L=function(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!S(t)||function(t){return!!P&&P in t}(t))&&(E(t)?j:I).test(N(t))}(n)?n:void 0},R=L(r.a,"Map"),F=L(Object,"create"),B=Object.prototype.hasOwnProperty,V=Object.prototype.hasOwnProperty;function q(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e-1&&t%1==0&&t-1&&t%1==0&&t<=9007199254740991},ut={};ut["[object Float32Array]"]=ut["[object Float64Array]"]=ut["[object Int8Array]"]=ut["[object Int16Array]"]=ut["[object Int32Array]"]=ut["[object Uint8Array]"]=ut["[object Uint8ClampedArray]"]=ut["[object Uint16Array]"]=ut["[object Uint32Array]"]=!0,ut["[object Arguments]"]=ut["[object Array]"]=ut["[object ArrayBuffer]"]=ut["[object Boolean]"]=ut["[object DataView]"]=ut["[object Date]"]=ut["[object Error]"]=ut["[object Function]"]=ut["[object Map]"]=ut["[object Number]"]=ut["[object Object]"]=ut["[object RegExp]"]=ut["[object Set]"]=ut["[object String]"]=ut["[object WeakMap]"]=!1;var ct=function(t){return function(e){return t(e)}},dt=n(5),ht=dt.a&&dt.a.isTypedArray,ft=ht?ct(ht):function(t){return p(t)&<(t.length)&&!!ut[d(t)]},pt=Object.prototype.hasOwnProperty,gt=function(t,e){var n=it(t),r=!n&&rt(t),i=!n&&!r&&Object(ot.a)(t),o=!n&&!r&&!i&&ft(t),s=n||r||i||o,a=s?function(t,e){for(var n=-1,r=Array(t);++n{this._setToTarget(t,r,e[r],n)})}}function de(t){return ue(t)?t:void 0}var he=n(0),fe=function(){return function t(){t.called=!0}};class pe{constructor(t,e){this.source=t,this.name=e,this.path=[],this.stop=fe(),this.off=fe()}}function ge(){let t="e";for(let e=0;e<8;e++)t+=Math.floor(65536*(1+Math.random())).toString(16).substring(1);return t}var me={get(t){return"number"!=typeof t?this[t]||this.normal:t},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5};n(9);const ve=Symbol("listeningTo"),ye=Symbol("emitterId");var be={on(t,e,n={}){this.listenTo(this,t,e,n)},once(t,e,n){let r=!1;this.listenTo(this,t,function(t,...n){r||(r=!0,t.off(),e.call(this,t,...n))},n)},off(t,e){this.stopListening(this,t,e)},listenTo(t,e,n,r={}){let i,o;this[ve]||(this[ve]={});const s=this[ve];_e(t)||we(t);const a=_e(t);(i=s[a])||(i=s[a]={emitter:t,callbacks:{}}),(o=i.callbacks[e])||(o=i.callbacks[e]=[]),o.push(n),function(t,e){const n=ke(t);if(n[e])return;let r=e,i=null;const o=[];for(;""!==r&&!n[r];)n[r]={callbacks:[],childEvents:[]},o.push(n[r]),i&&n[r].childEvents.push(i),i=r,r=r.substr(0,r.lastIndexOf(":"));if(""!==r){for(const t of o)t.callbacks=n[r].callbacks.slice();n[r].childEvents.push(i)}}(t,e);const l=xe(t,e),u=me.get(r.priority),c={callback:n,priority:u};for(const d of l){let t=!1;for(let e=0;e-1?t(e,n.substr(0,n.lastIndexOf(":"))):null}(this,r);if(n.path.push(this),i){const t=[n,...e];i=Array.from(i);for(let e=0;e{this._delegations||(this._delegations=new Map),t.forEach(t=>{const r=this._delegations.get(t);r?r.set(e,n):this._delegations.set(t,new Map([[e,n]]))})}}},stopDelegating(t,e){if(this._delegations)if(t)if(e){const n=this._delegations.get(t);n&&n.delete(e)}else this._delegations.delete(t);else this._delegations.clear()}};function we(t,e){t[ye]||(t[ye]=e||ge())}function _e(t){return t[ye]}function ke(t){return t._events||Object.defineProperty(t,"_events",{value:{}}),t._events}function xe(t,e){const n=ke(t)[e];if(!n)return[];let r=[n.callbacks];for(let i=0;i{Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e)).forEach(n=>{if(n in t.prototype)return;const r=Object.getOwnPropertyDescriptor(e,n);r.enumerable=!1,Object.defineProperty(t.prototype,n,r)})})}function Ee(t,e){const n=Math.min(t.length,e.length);for(let r=0;rt.data.length)throw new he.b("view-textproxy-wrong-offsetintext: Given offsetInText value is incorrect.");if(n<0||e+n>t.data.length)throw new he.b("view-textproxy-wrong-length: Given length value is incorrect.");this.data=t.data.substring(e,e+n),this.offsetInText=e}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(t){return"textProxy"==t}getAncestors(t={includeSelf:!1,parentFirst:!1}){const e=[];let n=t.includeSelf?this.textNode:this.parent;for(;null!==n;)e[t.parentFirst?"push":"unshift"](n),n=n.parent;return e}}function Ie(t){const e=new Map;for(const n in t)e.set(n,t[n]);return e}function Me(t){return!(!t||!t[Symbol.iterator])}class De{constructor(...t){this._patterns=[],this.add(...t)}add(...t){for(let e of t)("string"==typeof e||e instanceof RegExp)&&(e={name:e}),e.classes&&("string"==typeof e.classes||e.classes instanceof RegExp)&&(e.classes=[e.classes]),this._patterns.push(e)}match(...t){for(const e of t)for(const t of this._patterns){const n=je(e,t);if(n)return{element:e,pattern:t,match:n}}return null}matchAll(...t){const e=[];for(const n of t)for(const t of this._patterns){const r=je(n,t);r&&e.push({element:n,pattern:t,match:r})}return e.length>0?e:null}getElementName(){if(1!==this._patterns.length)return null;const t=this._patterns[0],e=t.name;return"function"==typeof t||!e||e instanceof RegExp?null:e}}function je(t,e){if("function"==typeof e)return e(t);const n={};return e.name&&(n.name=function(t,e){return t instanceof RegExp?t.test(e):t===e}(e.name,t.name),!n.name)?null:e.attributes&&(n.attributes=function(t,e){const n=[];for(const r in t){const i=t[r];if(!e.hasAttribute(r))return null;{const t=e.getAttribute(r);if(!0===i)n.push(r);else if(i instanceof RegExp){if(!i.test(t))return null;n.push(r)}else{if(t!==i)return null;n.push(r)}}}return n}(e.attributes,t),!n.attributes)?null:!(e.classes&&(n.classes=function(t,e){const n=[];for(const r of t)if(r instanceof RegExp){const t=e.getClassNames();for(const e of t)r.test(e)&&n.push(e);if(0===n.length)return null}else{if(!e.hasClass(r))return null;n.push(r)}return n}(e.classes,t),!n.classes))&&!(e.styles&&(n.styles=function(t,e){const n=[];for(const r in t){const i=t[r];if(!e.hasStyle(r))return null;{const t=e.getStyle(r);if(i instanceof RegExp){if(!i.test(t))return null;n.push(r)}else{if(t!==i)return null;n.push(r)}}}return n}(e.styles,t),!n.styles))&&n}class Le extends Pe{constructor(t,e,n){if(super(),this.name=t,this._attrs=function(t){t=w(t)?Ie(t):new Map(t);for(const[e,n]of t)null===n?t.delete(e):"string"!=typeof n&&t.set(e,String(n));return t}(e),this._children=[],n&&this._insertChild(0,n),this._classes=new Set,this._attrs.has("class")){const t=this._attrs.get("class");Fe(this._classes,t),this._attrs.delete("class")}this._styles=new Map,this._attrs.has("style")&&(Re(this._styles,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(t,e=null){return e?"element"==t&&e==this.name:"element"==t||t==this.name||super.is(t)}getChild(t){return this._children[t]}getChildIndex(t){return this._children.indexOf(t)}getChildren(){return this._children[Symbol.iterator]()}*getAttributeKeys(){this._classes.size>0&&(yield"class"),this._styles.size>0&&(yield"style"),yield*this._attrs.keys()}*getAttributes(){yield*this._attrs.entries(),this._classes.size>0&&(yield["class",this.getAttribute("class")]),this._styles.size>0&&(yield["style",this.getAttribute("style")])}getAttribute(t){if("class"==t)return this._classes.size>0?[...this._classes].join(" "):void 0;if("style"!=t)return this._attrs.get(t);if(this._styles.size>0){let t="";for(const[e,n]of this._styles)t+=`${e}:${n};`;return t}}hasAttribute(t){return"class"==t?this._classes.size>0:"style"==t?this._styles.size>0:this._attrs.has(t)}isSimilar(t){if(!(t instanceof Le))return!1;if(this===t)return!0;if(this.name!=t.name)return!1;if(this._attrs.size!==t._attrs.size||this._classes.size!==t._classes.size||this._styles.size!==t._styles.size)return!1;for(const[e,n]of this._attrs)if(!t._attrs.has(e)||t._attrs.get(e)!==n)return!1;for(const e of this._classes)if(!t._classes.has(e))return!1;for(const[e,n]of this._styles)if(!t._styles.has(e)||t._styles.get(e)!==n)return!1;return!0}hasClass(...t){for(const e of t)if(!this._classes.has(e))return!1;return!0}getClassNames(){return this._classes.keys()}getStyle(t){return this._styles.get(t)}getStyleNames(){return this._styles.keys()}hasStyle(...t){for(const e of t)if(!this._styles.has(e))return!1;return!0}findAncestor(...t){const e=new De(...t);let n=this.parent;for(;n;){if(e.match(n))return n;n=n.parent}return null}getCustomProperty(t){return this._customProperties.get(t)}*getCustomProperties(){yield*this._customProperties.entries()}getIdentity(){const t=Array.from(this._classes).sort().join(","),e=Array.from(this._styles).map(t=>`${t[0]}:${t[1]}`).sort().join(";"),n=Array.from(this._attrs).map(t=>`${t[0]}="${t[1]}"`).sort().join(" ");return this.name+(""==t?"":` class="${t}"`)+(""==e?"":` style="${e}"`)+(""==n?"":` ${n}`)}_clone(t=!1){const e=[];if(t)for(const r of this.getChildren())e.push(r._clone(t));const n=new this.constructor(this.name,this._attrs,e);return n._classes=new Set(this._classes),n._styles=new Map(this._styles),n._customProperties=new Map(this._customProperties),n.getFillerOffset=this.getFillerOffset,n}_appendChild(t){return this._insertChild(this.childCount,t)}_insertChild(t,e){this._fireChange("children",this);let n=0;const r=function(t){return"string"==typeof t?[new Te(t)]:(Me(t)||(t=[t]),Array.from(t).map(t=>"string"==typeof t?new Te(t):t instanceof Ne?new Te(t.data):t))}(e);for(const i of r)null!==i.parent&&i._remove(),i.parent=this,this._children.splice(t,0,i),t++,n++;return n}_removeChildren(t,e=1){this._fireChange("children",this);for(let n=t;n0&&(this._classes.clear(),!0):"style"==t?this._styles.size>0&&(this._styles.clear(),!0):this._attrs.delete(t)}_addClass(t){this._fireChange("attributes",this),(t=Array.isArray(t)?t:[t]).forEach(t=>this._classes.add(t))}_removeClass(t){this._fireChange("attributes",this),(t=Array.isArray(t)?t:[t]).forEach(t=>this._classes.delete(t))}_setStyle(t,e){if(this._fireChange("attributes",this),w(t)){const e=Object.keys(t);for(const n of e)this._styles.set(n,t[n])}else this._styles.set(t,e)}_removeStyle(t){this._fireChange("attributes",this),(t=Array.isArray(t)?t:[t]).forEach(t=>this._styles.delete(t))}_setCustomProperty(t,e){this._customProperties.set(t,e)}_removeCustomProperty(t){return this._customProperties.delete(t)}}function Re(t,e){let n=null,r=0,i=0,o=null;if(t.clear(),""!==e){";"!=e.charAt(e.length-1)&&(e+=";");for(let s=0;st.add(e))}class Be extends Le{constructor(t,e,n){super(t,e,n),this.getFillerOffset=Ve}is(t,e=null){return e?"containerElement"==t&&e==this.name||super.is(t,e):"containerElement"==t||super.is(t)}}function Ve(){const t=[...this.getChildren()],e=t[this.childCount-1];if(e&&e.is("element","br"))return this.childCount;for(const n of t)if(!n.is("uiElement"))return null;return this.childCount}var qe=function(t){return t},ze=Math.max,Ue=function(t){return function(){return t}},He=Date.now,We=function(t){var e=0,n=0;return function(){var r=He(),i=16-(r-n);if(n=r,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(K?function(t,e){return K(t,"toString",{configurable:!0,enumerable:!1,value:Ue(e),writable:!0})}:qe),Ge=function(t){return function(t,e){return We(function(t,e,n){return e=ze(void 0===e?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=ze(r.length-e,0),s=Array(o);++i1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(o=t.length>3&&"function"==typeof o?(i--,o):void 0,s&&function(t,e,n){if(!S(n))return!1;var r=typeof e;return!!("number"==r?wt(n)&&at(e,n.length):"string"==r&&e in n)&&_(n[e],t)}(n[0],n[1],s)&&(o=i<3?void 0:o,i=1),e=Object(e);++r{this.set(e,t[e])},this);Je(this);const n=this[Ye];if(t in this&&!n.has(t))throw new he.b("observable-set-cannot-override: Cannot override an existing property.");Object.defineProperty(this,t,{enumerable:!0,configurable:!0,get:()=>n.get(t),set(e){const r=n.get(t);let i=this.fire("set:"+t,t,e,r);void 0===i&&(i=e),r===i&&n.has(t)||(n.set(t,i),this.fire("change:"+t,t,i,r))}}),this[t]=e},bind(...t){if(!t.length||!en(t))throw new he.b("observable-bind-wrong-properties: All properties must be strings.");if(new Set(t).size!==t.length)throw new he.b("observable-bind-duplicate-properties: Properties must be unique.");Je(this);const e=this[$e];t.forEach(t=>{if(e.has(t))throw new he.b("observable-bind-rebind: Cannot bind the same property more that once.")});const n=new Map;return t.forEach(t=>{const r={property:t,to:[]};e.set(t,r),n.set(t,r)}),{to:Xe,toMany:tn,_observable:this,_bindProperties:t,_to:[],_bindings:n}},unbind(...t){if(!(Ye in this))return;const e=this[$e],n=this[Ke];if(t.length){if(!en(t))throw new he.b("observable-unbind-wrong-properties: Properties must be strings.");t.forEach(t=>{const r=e.get(t);if(!r)return;let i,o,s,a;r.to.forEach(t=>{o=t[1],s=n.get(i=t[0]),(a=s[o]).delete(r),a.size||delete s[o],Object.keys(s).length||(n.delete(i),this.stopListening(i,"change"))}),e.delete(t)})}else n.forEach((t,e)=>{this.stopListening(e,"change")}),n.clear(),e.clear()},decorate(t){const e=this[t];if(!e)throw new he.b("observablemixin-cannot-decorate-undefined: Cannot decorate an undefined method.",{object:this,methodName:t});this.on(t,(t,n)=>{t.return=e.apply(this,n)}),this[t]=function(...e){return this.fire(t,e)}}};Ge(Ze,be);var Qe=Ze;function Je(t){Ye in t||(Object.defineProperty(t,Ye,{value:new Map}),Object.defineProperty(t,Ke,{value:new Map}),Object.defineProperty(t,$e,{value:new Map}))}function Xe(...t){const e=function(...t){if(!t.length)throw new he.b("observable-bind-to-parse-error: Invalid argument syntax in `to()`.");const e={to:[]};let n;return"function"==typeof t[t.length-1]&&(e.callback=t.pop()),t.forEach(t=>{if("string"==typeof t)n.properties.push(t);else{if("object"!=typeof t)throw new he.b("observable-bind-to-parse-error: Invalid argument syntax in `to()`.");e.to.push(n={observable:t,properties:[]})}}),e}(...t),n=Array.from(this._bindings.keys()),r=n.length;if(!e.callback&&e.to.length>1)throw new he.b("observable-bind-to-no-callback: Binding multiple observables only possible with callback.");if(r>1&&e.callback)throw new he.b("observable-bind-to-extra-callback: Cannot bind multiple properties and use a callback in one binding.");e.to.forEach(t=>{if(t.properties.length&&t.properties.length!==r)throw new he.b("observable-bind-to-properties-length: The number of properties must match.");t.properties.length||(t.properties=this._bindProperties)}),this._to=e.to,e.callback&&(this._bindings.get(n[0]).callback=e.callback),function(t,e){e.forEach(e=>{const n=t[Ke];let r;n.get(e.observable)||t.listenTo(e.observable,"change",(i,o)=>{(r=n.get(e.observable)[o])&&r.forEach(e=>{nn(t,e.property)})})})}(this._observable,this._to),function(t){let e;t._bindings.forEach((n,r)=>{t._to.forEach(i=>{e=i.properties[n.callback?0:t._bindProperties.indexOf(r)],n.to.push([i.observable,e]),function(t,e,n,r){const i=t[Ke],o=i.get(n),s=o||{};s[r]||(s[r]=new Set),s[r].add(e),o||i.set(n,s)}(t._observable,n,i.observable,e)})})}(this),this._bindProperties.forEach(t=>{nn(this._observable,t)})}function tn(t,e,n){if(this._bindings.size>1)throw new he.b("observable-bind-to-many-not-one-binding: Cannot bind multiple properties with toMany().");this.to(...function(t,e){const n=t.map(t=>[t,e]);return Array.prototype.concat.apply([],n)}(t,e),n)}function en(t){return t.every(t=>"string"==typeof t)}function nn(t,e){const n=t[$e].get(e);let r;r=n.callback?n.callback.apply(t,n.to.map(t=>t[0][t[1]])):(r=n.to[0])[0][r[1]],t.hasOwnProperty(e)?t[e]=r:t.set(e,r)}const rn=Symbol("document");class on extends Be{constructor(t,e,n){super(t,e,n),this.set("isReadOnly",!1),this.set("isFocused",!1)}is(t,e=null){return e?"editableElement"==t&&e==this.name||super.is(t,e):"editableElement"==t||super.is(t)}destroy(){this.stopListening()}get document(){return this.getCustomProperty(rn)}set _document(t){if(this.getCustomProperty(rn))throw new he.b("view-editableelement-document-already-set: View document is already set.");this._setCustomProperty(rn,t),this.bind("isReadOnly").to(t),this.bind("isFocused").to(t,"isFocused",e=>e&&t.selection.editableElement==this),this.listenTo(t.selection,"change",()=>{this.isFocused=t.isFocused&&t.selection.editableElement==this})}}Se(on,Qe);const sn=Symbol("rootName");class an extends on{constructor(t){super(t),this.rootName="main"}is(t,e=null){return e?"rootElement"==t&&e==this.name||super.is(t,e):"rootElement"==t||super.is(t)}get rootName(){return this.getCustomProperty(sn)}set rootName(t){this._setCustomProperty(sn,t)}set _name(t){this.name=t}}class ln{constructor(t={}){if(!t.boundaries&&!t.startPosition)throw new he.b("view-tree-walker-no-start-position: Neither boundaries nor starting position have been defined.");if(t.direction&&"forward"!=t.direction&&"backward"!=t.direction)throw new he.b("view-tree-walker-unknown-direction: Only `backward` and `forward` direction allowed.",{direction:t.direction});this.boundaries=t.boundaries||null,this.position=un._createAt(t.startPosition?t.startPosition:t.boundaries["backward"==t.direction?"end":"start"]),this.direction=t.direction||"forward",this.singleCharacters=!!t.singleCharacters,this.shallow=!!t.shallow,this.ignoreElementEnd=!!t.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null}[Symbol.iterator](){return this}skip(t){let e,n,r;do{r=this.position,({done:e,value:n}=this.next())}while(!e&&t(n));e||(this.position=r)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){let t=this.position.clone();const e=this.position,n=t.parent;if(null===n.parent&&t.offset===n.childCount)return{done:!0};if(n===this._boundaryEndParent&&t.offset==this.boundaries.end.offset)return{done:!0};let r;if(n instanceof Te){if(t.isAtEnd)return this.position=un._createAfter(n),this._next();r=n.data[t.offset]}else r=n.getChild(t.offset);if(r instanceof Le)return this.shallow?t.offset++:t=new un(r,0),this.position=t,this._formatReturnValue("elementStart",r,e,t,1);if(r instanceof Te){if(this.singleCharacters)return t=new un(r,0),this.position=t,this._next();{let n,i=r.data.length;return r==this._boundaryEndParent?(n=new Ne(r,0,i=this.boundaries.end.offset),t=un._createAfter(n)):(n=new Ne(r,0,r.data.length),t.offset++),this.position=t,this._formatReturnValue("text",n,e,t,i)}}if("string"==typeof r){let r;const i=new Ne(n,t.offset,r=this.singleCharacters?1:(n===this._boundaryEndParent?this.boundaries.end.offset:n.data.length)-t.offset);return t.offset+=r,this.position=t,this._formatReturnValue("text",i,e,t,r)}return t=un._createAfter(n),this.position=t,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",n,e,t)}_previous(){let t=this.position.clone();const e=this.position,n=t.parent;if(null===n.parent&&0===t.offset)return{done:!0};if(n==this._boundaryStartParent&&t.offset==this.boundaries.start.offset)return{done:!0};let r;if(n instanceof Te){if(t.isAtStart)return this.position=un._createBefore(n),this._previous();r=n.data[t.offset-1]}else r=n.getChild(t.offset-1);if(r instanceof Le)return this.shallow?(t.offset--,this.position=t,this._formatReturnValue("elementStart",r,e,t,1)):(t=new un(r,r.childCount),this.position=t,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",r,e,t));if(r instanceof Te){if(this.singleCharacters)return t=new un(r,r.data.length),this.position=t,this._previous();{let n,i=r.data.length;if(r==this._boundaryStartParent){const e=this.boundaries.start.offset;i=(n=new Ne(r,e,r.data.length-e)).data.length,t=un._createBefore(n)}else n=new Ne(r,0,r.data.length),t.offset--;return this.position=t,this._formatReturnValue("text",n,e,t,i)}}if("string"==typeof r){let r;t.offset-=r=this.singleCharacters?1:t.offset-(n===this._boundaryStartParent?this.boundaries.start.offset:0);const i=new Ne(n,t.offset,r);return this.position=t,this._formatReturnValue("text",i,e,t,r)}return t=un._createBefore(n),this.position=t,this._formatReturnValue("elementStart",n,e,t,1)}_formatReturnValue(t,e,n,r,i){return e instanceof Ne&&(e.offsetInText+e.data.length==e.textNode.data.length&&("forward"!=this.direction||this.boundaries&&this.boundaries.end.isEqual(this.position)?n=un._createAfter(e.textNode):(r=un._createAfter(e.textNode),this.position=r)),0===e.offsetInText&&("backward"!=this.direction||this.boundaries&&this.boundaries.start.isEqual(this.position)?n=un._createBefore(e.textNode):(r=un._createBefore(e.textNode),this.position=r))),{done:!1,value:{type:t,item:e,previousPosition:n,nextPosition:r,length:i}}}}class un{constructor(t,e){this.parent=t,this.offset=e}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 t=this.parent.is("text")?this.parent.data.length:this.parent.childCount;return this.offset===t}get root(){return this.parent.root}get editableElement(){let t=this.parent;for(;!(t instanceof on);){if(!t.parent)return null;t=t.parent}return t}getShiftedBy(t){const e=un._createAt(this),n=e.offset+t;return e.offset=n<0?0:n,e}getLastMatchingPosition(t,e={}){e.startPosition=this;const n=new ln(e);return n.skip(t),n.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(t){const e=this.getAncestors(),n=t.getAncestors();let r=0;for(;e[r]==n[r]&&e[r];)r++;return 0===r?null:e[r-1]}isEqual(t){return this.parent==t.parent&&this.offset==t.offset}isBefore(t){return"before"==this.compareWith(t)}isAfter(t){return"after"==this.compareWith(t)}compareWith(t){if(this.root!==t.root)return"different";if(this.isEqual(t))return"same";const e=this.parent.is("node")?this.parent.getPath():[],n=t.parent.is("node")?t.parent.getPath():[];e.push(this.offset),n.push(t.offset);const r=Ee(e,n);switch(r){case"prefix":return"before";case"extension":return"after";default:return e[r]0?new this(n,r):new this(r,n)}static _createIn(t){return this._createFromParentsAndOffsets(t,0,t,t.childCount)}static _createOn(t){const e=t.is("textProxy")?t.offsetSize:1;return this._createFromPositionAndShift(un._createBefore(t),e)}}function dn(t){return!(!t.item.is("attributeElement")&&!t.item.is("uiElement"))}function hn(t){let e=0;for(const n of t)e++;return e}class fn{constructor(t=null,e,n){this._ranges=[],this._lastRangeBackward=!1,this._isFake=!1,this._fakeSelectionLabel="",this.setTo(t,e,n)}get isFake(){return this._isFake}get fakeSelectionLabel(){return this._fakeSelectionLabel}get anchor(){if(!this._ranges.length)return null;const t=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?t.end:t.start).clone()}get focus(){if(!this._ranges.length)return null;const t=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?t.start:t.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 t of this._ranges)yield t.clone()}getFirstRange(){let t=null;for(const e of this._ranges)t&&!e.start.isBefore(t.start)||(t=e);return t?t.clone():null}getLastRange(){let t=null;for(const e of this._ranges)t&&!e.end.isAfter(t.end)||(t=e);return t?t.clone():null}getFirstPosition(){const t=this.getFirstRange();return t?t.start.clone():null}getLastPosition(){const t=this.getLastRange();return t?t.end.clone():null}isEqual(t){if(this.isFake!=t.isFake)return!1;if(this.isFake&&this.fakeSelectionLabel!=t.fakeSelectionLabel)return!1;if(this.rangeCount!=t.rangeCount)return!1;if(0===this.rangeCount)return!0;if(!this.anchor.isEqual(t.anchor)||!this.focus.isEqual(t.focus))return!1;for(const e of this._ranges){let n=!1;for(const r of t._ranges)if(e.isEqual(r)){n=!0;break}if(!n)return!1}return!0}isSimilar(t){if(this.isBackward!=t.isBackward)return!1;const e=hn(this.getRanges());if(e!=hn(t.getRanges()))return!1;if(0==e)return!0;for(let n of this.getRanges()){n=n.getTrimmed();let e=!1;for(let r of t.getRanges())if(r=r.getTrimmed(),n.start.isEqual(r.start)&&n.end.isEqual(r.end)){e=!0;break}if(!e)return!1}return!0}getSelectedElement(){if(1!==this.rangeCount)return null;const t=this.getFirstRange();let e=t.start.nodeAfter,n=t.end.nodeBefore;return t.start.parent.is("text")&&t.start.isAtEnd&&t.start.parent.nextSibling&&(e=t.start.parent.nextSibling),t.end.parent.is("text")&&t.end.isAtStart&&t.end.parent.previousSibling&&(n=t.end.parent.previousSibling),e instanceof Le&&e==n?e:null}setTo(t,e,n){if(null===t)this._setRanges([]),this._setFakeOptions(e);else if(t instanceof fn||t instanceof pn)this._setRanges(t.getRanges(),t.isBackward),this._setFakeOptions({fake:t.isFake,label:t.fakeSelectionLabel});else if(t instanceof cn)this._setRanges([t],e&&e.backward),this._setFakeOptions(e);else if(t instanceof un)this._setRanges([new cn(t)]),this._setFakeOptions(e);else if(t instanceof Pe){const r=!!n&&!!n.backward;let i;if(void 0===e)throw new he.b("view-selection-setTo-required-second-parameter: selection.setTo requires the second parameter when the first parameter is a node.");i="in"==e?cn._createIn(t):"on"==e?cn._createOn(t):new cn(un._createAt(t,e)),this._setRanges([i],r),this._setFakeOptions(n)}else{if(!Me(t))throw new he.b("view-selection-setTo-not-selectable: Cannot set selection to given place.");this._setRanges(t,e&&e.backward),this._setFakeOptions(e)}this.fire("change")}setFocus(t,e){if(null===this.anchor)throw new he.b("view-selection-setFocus-no-ranges: Cannot set selection focus if there are no ranges in selection.");const n=un._createAt(t,e);if("same"==n.compareWith(this.focus))return;const r=this.anchor;this._ranges.pop(),"before"==n.compareWith(r)?this._addRange(new cn(n,r),!0):this._addRange(new cn(r,n)),this.fire("change")}is(t){return"selection"==t}_setRanges(t,e=!1){t=Array.from(t),this._ranges=[];for(const n of t)this._addRange(n);this._lastRangeBackward=!!e}_setFakeOptions(t={}){this._isFake=!!t.fake,this._fakeSelectionLabel=t.fake&&t.label||""}_addRange(t,e=!1){if(!(t instanceof cn))throw new he.b("view-selection-add-range-not-range: Selection range set to an object that is not an instance of view.Range");this._pushRange(t),this._lastRangeBackward=!!e}_pushRange(t){for(const e of this._ranges)if(t.isIntersecting(e))throw new he.b("view-selection-range-intersects: Trying to add a range that intersects with another range from selection.",{addedRange:t,intersectingRange:e});this._ranges.push(new cn(t.start,t.end))}}Se(fn,be);class pn{constructor(t=null,e,n){this._selection=new fn,this._selection.delegate("change").to(this),this._selection.setTo(t,e,n)}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(t){return this._selection.isEqual(t)}isSimilar(t){return this._selection.isSimilar(t)}is(t){return"selection"==t||"documentSelection"==t}_setTo(t,e,n){this._selection.setTo(t,e,n)}_setFocus(t,e){this._selection.setFocus(t,e)}}Se(pn,be);class gn{constructor(t={}){this._items=[],this._itemMap=new Map,this._idProperty=t.idProperty||"id",this._bindToExternalToInternalMap=new WeakMap,this._bindToInternalToExternalMap=new WeakMap,this._skippedIndexesFromExternal=[]}get length(){return this._items.length}get first(){return this._items[0]||null}get last(){return this._items[this.length-1]||null}add(t,e){let n;const r=this._idProperty;if(r in t){if("string"!=typeof(n=t[r]))throw new he.b("collection-add-invalid-id");if(this.get(n))throw new he.b("collection-add-item-already-exists")}else t[r]=n=ge();if(void 0===e)e=this._items.length;else if(e>this._items.length||e<0)throw new he.b("collection-add-item-invalid-index");return this._items.splice(e,0,t),this._itemMap.set(n,t),this.fire("add",t,e),this}get(t){let e;if("string"==typeof t)e=this._itemMap.get(t);else{if("number"!=typeof t)throw new he.b("collection-get-invalid-arg: Index or id must be given.");e=this._items[t]}return e||null}has(t){return this._itemMap.has("string"==typeof t?t:t[this._idProperty])}getIndex(t){let e;return e="string"==typeof t?this._itemMap.get(t):t,this._items.indexOf(e)}remove(t){let e,n,r,i=!1;const o=this._idProperty;if("string"==typeof t?(i=!(r=this._itemMap.get(n=t)),r&&(e=this._items.indexOf(r))):"number"==typeof t?(i=!(r=this._items[e=t]),r&&(n=r[o])):(n=(r=t)[o],i=-1==(e=this._items.indexOf(r))||!this._itemMap.get(n)),i)throw new he.b("collection-remove-404: Item not found.");this._items.splice(e,1),this._itemMap.delete(n);const s=this._bindToInternalToExternalMap.get(r);return this._bindToInternalToExternalMap.delete(r),this._bindToExternalToInternalMap.delete(s),this.fire("remove",r,e),r}map(t,e){return this._items.map(t,e)}find(t,e){return this._items.find(t,e)}filter(t,e){return this._items.filter(t,e)}clear(){for(this._bindToCollection&&(this.stopListening(this._bindToCollection),this._bindToCollection=null);this.length;)this.remove(0)}bindTo(t){if(this._bindToCollection)throw new he.b("collection-bind-to-rebind: The collection cannot be bound more than once.");return this._bindToCollection=t,{as:t=>{this._setUpBindToBinding(e=>new t(e))},using:t=>{this._setUpBindToBinding("function"==typeof t?e=>t(e):e=>e[t])}}}_setUpBindToBinding(t){const e=this._bindToCollection,n=(n,r,i)=>{const o=e._bindToCollection==this,s=e._bindToInternalToExternalMap.get(r);if(o&&s)this._bindToExternalToInternalMap.set(r,s),this._bindToInternalToExternalMap.set(s,r);else{const n=t(r);if(!n)return void this._skippedIndexesFromExternal.push(i);let o=i;for(const t of this._skippedIndexesFromExternal)i>t&&o--;for(const t of e._skippedIndexesFromExternal)o>=t&&o++;this._bindToExternalToInternalMap.set(r,n),this._bindToInternalToExternalMap.set(n,r),this.add(n,o);for(let t=0;t{const r=this._bindToExternalToInternalMap.get(e);r&&this.remove(r),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce((t,e)=>(ne&&t.push(e),t),[])})}[Symbol.iterator](){return this._items[Symbol.iterator]()}}Se(gn,be);class mn{constructor(){this.selection=new pn,this.roots=new gn({idProperty:"rootName"}),this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isComposing",!1),this._postFixers=new Set}getRoot(t="main"){return this.roots.get(t)}registerPostFixer(t){this._postFixers.add(t)}destroy(){this.roots.map(t=>t.destroy()),this.stopListening()}_callPostFixers(t){let e=!1;do{for(const n of this._postFixers)if(e=n(t))break}while(e)}}Se(mn,Qe);const vn=10;class yn extends Le{constructor(t,e,n){super(t,e,n),this.getFillerOffset=bn,this._priority=vn,this._id=null,this._clonesGroup=null}get priority(){return this._priority}get id(){return this._id}getElementsWithSameId(){if(null===this.id)throw new he.b("attribute-element-get-elements-with-same-id-no-id: Cannot get elements with the same id for an attribute element without id.");return new Set(this._clonesGroup)}is(t,e=null){return e?"attributeElement"==t&&e==this.name||super.is(t,e):"attributeElement"==t||super.is(t)}isSimilar(t){return null!==this.id||null!==t.id?this.id===t.id:super.isSimilar(t)&&this.priority==t.priority}_clone(t){const e=super._clone(t);return e._priority=this._priority,e._id=this._id,e}}function bn(){if(wn(this))return null;let t=this.parent;for(;t&&t.is("attributeElement");){if(wn(t)>1)return null;t=t.parent}return!t||wn(t)>1?null:this.childCount}function wn(t){return Array.from(t.getChildren()).filter(t=>!t.is("uiElement")).length}yn.DEFAULT_PRIORITY=vn;class _n extends Le{constructor(t,e,n){super(t,e,n),this.getFillerOffset=kn}is(t,e=null){return e?"emptyElement"==t&&e==this.name||super.is(t,e):"emptyElement"==t||super.is(t)}_insertChild(t,e){if(e&&(e instanceof Pe||Array.from(e).length>0))throw new he.b("view-emptyelement-cannot-add: Cannot add child nodes to EmptyElement instance.")}}function kn(){return null}const xn=navigator.userAgent.toLowerCase();var Cn={isMac:xn.indexOf("macintosh")>-1,isEdge:!!xn.match(/edge\/(\d+.?\d*)/),isGecko:!!xn.match(/gecko\/\d+/),isSafari:function(t){return t.indexOf(" applewebkit/")>-1&&-1===t.indexOf("chrome")}(xn)};const An={"\u2318":"ctrl","\u21e7":"shift","\u2325":"alt"},Sn={ctrl:"\u2318",shift:"\u21e7",alt:"\u2325"},En=function(){const t={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 e=65;e<=90;e++)t[String.fromCharCode(e).toLowerCase()]=e;for(let e=48;e<=57;e++)t[e-48]=e;for(let e=112;e<=123;e++)t["f"+(e-111)]=e;return t}();function On(t){let e;if("string"==typeof t){if(!(e=En[t.toLowerCase()]))throw new he.b("keyboard-unknown-key: Unknown key name.",{key:t})}else e=t.keyCode+(t.altKey?En.alt:0)+(t.ctrlKey?En.ctrl:0)+(t.shiftKey?En.shift:0);return e}function Pn(t){return"string"==typeof t&&(t=Tn(t)),t.map(t=>"string"==typeof t?On(t):t).reduce((t,e)=>e+t,0)}function Tn(t){return t.split(/\s*\+\s*/)}class Nn extends Le{constructor(t,e,n){super(t,e,n),this.getFillerOffset=In}is(t,e=null){return e?"uiElement"==t&&e==this.name||super.is(t,e):"uiElement"==t||super.is(t)}_insertChild(t,e){if(e&&(e instanceof Pe||Array.from(e).length>0))throw new he.b("view-uielement-cannot-add: Cannot add child nodes to UIElement instance.")}render(t){return this.toDomElement(t)}toDomElement(t){const e=t.createElement(this.name);for(const n of this.getAttributeKeys())e.setAttribute(n,this.getAttribute(n));return e}}function In(){return null}class Mn{constructor(t){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(t){return"documentFragment"==t}_appendChild(t){return this._insertChild(this.childCount,t)}getChild(t){return this._children[t]}getChildIndex(t){return this._children.indexOf(t)}getChildren(){return this._children[Symbol.iterator]()}_insertChild(t,e){this._fireChange("children",this);let n=0;const r=function(t){return"string"==typeof t?[new Te(t)]:(Me(t)||(t=[t]),Array.from(t).map(t=>"string"==typeof t?new Te(t):t instanceof Ne?new Te(t.data):t))}(e);for(const i of r)null!==i.parent&&i._remove(),i.parent=this,this._children.splice(t,0,i),t++,n++;return n}_removeChildren(t,e=1){this._fireChange("children",this);for(let n=t;nn instanceof t))throw new he.b("view-writer-insert-invalid-node");n.is("text")||t(n.getChildren())}}(e=Me(e)?[...e]:[e]);const n=jn(t);if(!n)throw new he.b("view-writer-invalid-position-container");const r=this._breakAttributes(t,!0),i=n._insertChild(r.offset,e);for(const a of e)this._addToClonedElementsGroup(a);const o=r.getShiftedBy(i),s=this.mergeAttributes(r);if(0===i)return new cn(s,s);{s.isEqual(r)||o.offset--;const t=this.mergeAttributes(o);return new cn(s,t)}}remove(t){const e=t instanceof cn?t:cn._createOn(t);if(zn(e),e.isCollapsed)return new Mn;const{start:n,end:r}=this._breakAttributesRange(e,!0),i=n.parent._removeChildren(n.offset,r.offset-n.offset);for(const s of i)this._removeFromClonedElementsGroup(s);const o=this.mergeAttributes(n);return e.start=o,e.end=o.clone(),new Mn(i)}clear(t,e){zn(t);const n=t.getWalker({direction:"backward",ignoreElementEnd:!0});for(const r of n){const n=r.item;let i;if(n.is("element")&&e.isSimilar(n))i=cn._createOn(n);else if(!r.nextPosition.isAfter(t.start)&&n.is("textProxy")){const t=n.getAncestors().find(t=>t.is("element")&&e.isSimilar(t));t&&(i=cn._createIn(t))}i&&(i.end.isAfter(t.end)&&(i.end=t.end),i.start.isBefore(t.start)&&(i.start=t.start),this.remove(i))}}move(t,e){let n;if(e.isAfter(t.end)){const r=(e=this._breakAttributes(e,!0)).parent,i=r.childCount;t=this._breakAttributesRange(t,!0),n=this.remove(t),e.offset+=r.childCount-i}else n=this.remove(t);return this.insert(e,n)}wrap(t,e){if(!(e instanceof yn))throw new he.b("view-writer-wrap-invalid-attribute");if(zn(t),t.isCollapsed){let n=t.start;n.parent.is("element")&&!Array.from(n.parent.getChildren()).some(t=>!t.is("uiElement"))&&(n=n.getLastMatchingPosition(t=>t.item.is("uiElement"))),n=this._wrapPosition(n,e);const r=this.document.selection;return r.isCollapsed&&r.getFirstPosition().isEqual(t.start)&&this.setSelection(n),new cn(n)}return this._wrapRange(t,e)}unwrap(t,e){if(!(e instanceof yn))throw new he.b("view-writer-unwrap-invalid-attribute");if(zn(t),t.isCollapsed)return t;const{start:n,end:r}=this._breakAttributesRange(t,!0),i=this._unwrapChildren(n.parent,n.offset,r.offset,e),o=this.mergeAttributes(i.start);o.isEqual(i.start)||i.end.offset--;const s=this.mergeAttributes(i.end);return new cn(o,s)}rename(t,e){const n=new Be(t,e.getAttributes());return this.insert(un._createAfter(e),n),this.move(cn._createIn(e),un._createAt(n,0)),this.remove(cn._createOn(e)),n}clearClonedElementsGroup(t){this._cloneGroups.delete(t)}createPositionAt(t,e){return un._createAt(t,e)}createPositionAfter(t){return un._createAfter(t)}createPositionBefore(t){return un._createBefore(t)}createRange(t,e){return new cn(t,e)}createRangeOn(t){return cn._createOn(t)}createRangeIn(t){return cn._createIn(t)}createSelection(t,e,n){return new fn(t,e,n)}_wrapChildren(t,e,n,r){let i=e;const o=[];for(;i!1),t.parent._insertChild(t.offset,n);const r=new cn(t,t.getShiftedBy(1));this.wrap(r,e);const i=new un(n.parent,n.index);n._remove();const o=i.nodeBefore,s=i.nodeAfter;return o instanceof Te&&s instanceof Te?Bn(o,s):Rn(i)}_wrapAttributeElement(t,e){if(!Un(t,e))return!1;if(t.name!==e.name||t.priority!==e.priority)return!1;for(const n of t.getAttributeKeys())if("class"!==n&&"style"!==n&&e.hasAttribute(n)&&e.getAttribute(n)!==t.getAttribute(n))return!1;for(const n of t.getStyleNames())if(e.hasStyle(n)&&e.getStyle(n)!==t.getStyle(n))return!1;for(const n of t.getAttributeKeys())"class"!==n&&"style"!==n&&(e.hasAttribute(n)||this.setAttribute(n,t.getAttribute(n),e));for(const n of t.getStyleNames())e.hasStyle(n)||this.setStyle(n,t.getStyle(n),e);for(const n of t.getClassNames())e.hasClass(n)||this.addClass(n,e);return!0}_unwrapAttributeElement(t,e){if(!Un(t,e))return!1;if(t.name!==e.name||t.priority!==e.priority)return!1;for(const n of t.getAttributeKeys())if("class"!==n&&"style"!==n&&(!e.hasAttribute(n)||e.getAttribute(n)!==t.getAttribute(n)))return!1;if(!e.hasClass(...t.getClassNames()))return!1;for(const n of t.getStyleNames())if(!e.hasStyle(n)||e.getStyle(n)!==t.getStyle(n))return!1;for(const n of t.getAttributeKeys())"class"!==n&&"style"!==n&&this.removeAttribute(n,e);return this.removeClass(Array.from(t.getClassNames()),e),this.removeStyle(Array.from(t.getStyleNames()),e),!0}_breakAttributesRange(t,e=!1){const n=t.start,r=t.end;if(zn(t),t.isCollapsed){const n=this._breakAttributes(t.start,e);return new cn(n,n)}const i=this._breakAttributes(r,e),o=i.parent.childCount,s=this._breakAttributes(n,e);return i.offset+=i.parent.childCount-o,new cn(s,i)}_breakAttributes(t,e=!1){const n=t.offset,r=t.parent;if(t.parent.is("emptyElement"))throw new he.b("view-writer-cannot-break-empty-element");if(t.parent.is("uiElement"))throw new he.b("view-writer-cannot-break-ui-element");if(!e&&r.is("text")&&qn(r.parent))return t.clone();if(qn(r))return t.clone();if(r.is("text"))return this._breakAttributes(Fn(t),e);if(n==r.childCount){const t=new un(r.parent,r.index+1);return this._breakAttributes(t,e)}if(0===n){const t=new un(r.parent,r.index);return this._breakAttributes(t,e)}{const t=r.index+1,i=r._clone();r.parent._insertChild(t,i),this._addToClonedElementsGroup(i);const o=r._removeChildren(n,r.childCount-n);i._appendChild(o);const s=new un(r.parent,t);return this._breakAttributes(s,e)}}_addToClonedElementsGroup(t){if(!t.root.is("rootElement"))return;if(t.is("element"))for(const r of t.getChildren())this._addToClonedElementsGroup(r);const e=t.id;if(!e)return;let n=this._cloneGroups.get(e);n||(n=new Set,this._cloneGroups.set(e,n)),n.add(t),t._clonesGroup=n}_removeFromClonedElementsGroup(t){if(t.is("element"))for(const r of t.getChildren())this._removeFromClonedElementsGroup(r);const e=t.id;if(!e)return;const n=this._cloneGroups.get(e);n&&n.delete(t)}}function jn(t){let e=t.parent;for(;!qn(e);){if(!e)return;e=e.parent}return e}function Ln(t,e){return t.prioritye.priority)&&t.getIdentity(){const e=t.createElement("br");return e.dataset.ckeFiller=!0,e},Gn=t=>t.createTextNode("\xa0"),Yn=7;let Kn="";for(let kp=0;kp0&&(o=o.concat(Array(n).fill("equal"))),i-n>0&&(o=o.concat(Array(i-n).fill("insert"))),r-n>0&&(o=o.concat(Array(r-n).fill("delete"))),i0&&n.push({index:r,type:"insert",values:t.slice(r,o)}),i-r>0&&n.push({index:r+(o-r),type:"delete",howMany:i-r}),n}(e,i)}function nr(t,e,n){for(let r=0;r200||i>200||r+i>300)return ir.fastDiff(t,e,n,!0);let o,s;if(iu?-1:1;c[r+h]&&(c[r]=c[r+h].slice(0)),c[r]||(c[r]=[]),c[r].push(i>u?o:s);let f=Math.max(i,u),p=f-r;for(;pu;f--)d[f]=h(f);d[u]=h(u),p++}while(d[u]!==l);return c[u].slice(1)}function or(t,e,n){t.insertBefore(n,t.childNodes[e]||null)}function sr(t){const e=t.parentNode;e&&e.removeChild(t)}function ar(t){if(t){if(t.defaultView)return t instanceof t.defaultView.Document;if(t.ownerDocument&&t.ownerDocument.defaultView)return t instanceof t.ownerDocument.defaultView.Node}return!1}ir.fastDiff=er;class lr{constructor(t,e){this.domDocuments=new Set,this.domConverter=t,this.markedAttributes=new Set,this.markedChildren=new Set,this.markedTexts=new Set,this.selection=e,this.isFocused=!1,this._inlineFiller=null,this._fakeSelectionContainer=null}markToSync(t,e){if("text"===t)this.domConverter.mapViewToDom(e.parent)&&this.markedTexts.add(e);else{if(!this.domConverter.mapViewToDom(e))return;if("attributes"===t)this.markedAttributes.add(e);else{if("children"!==t)throw new he.b("view-renderer-unknown-type: Unknown type passed to Renderer.markToSync.");this.markedChildren.add(e)}}}render(){let t;for(const e of this.markedChildren)this._updateChildrenMappings(e);this._inlineFiller&&!this._isSelectionInInlineFiller()&&this._removeInlineFiller(),this._inlineFiller?t=this._getInlineFillerPosition():this._needsInlineFillerAtSelection()&&(t=this.selection.getFirstPosition(),this.markedChildren.add(t.parent));for(const e of this.markedAttributes)this._updateAttrs(e);for(const e of this.markedChildren)this._updateChildren(e,{inlineFillerPosition:t});for(const e of this.markedTexts)!this.markedChildren.has(e.parent)&&this.domConverter.mapViewToDom(e.parent)&&this._updateText(e,{inlineFillerPosition:t});if(t){const e=this.domConverter.viewPositionToDom(t),n=e.parent.ownerDocument;this._inlineFiller=$n(e.parent)?e.parent:ur(n,e.parent,e.offset)}else this._inlineFiller=null;this._updateSelection(),this._updateFocus(),this.markedTexts.clear(),this.markedAttributes.clear(),this.markedChildren.clear()}_updateChildrenMappings(t){const e=this.domConverter.mapViewToDom(t);if(!e)return;const n=this.domConverter.mapViewToDom(t).childNodes,r=Array.from(this.domConverter.viewChildrenToDom(t,e.ownerDocument,{withChildren:!1})),i=this._diffNodeLists(n,r),o=this._findReplaceActions(i,n,r);if(-1!==o.indexOf("replace")){const e={equal:0,insert:0,delete:0};for(const i of o)if("replace"===i){const i=e.equal+e.insert,o=e.equal+e.delete,s=t.getChild(i);s&&!s.is("uiElement")&&this._updateElementMappings(s,n[o]),sr(r[i]),e.equal++}else e[i]++}}_updateElementMappings(t,e){this.domConverter.unbindDomElement(e),this.domConverter.bindElements(e,t),this.markedChildren.add(t),this.markedAttributes.add(t)}_getInlineFillerPosition(){const t=this.selection.getFirstPosition();return t.parent.is("text")?un._createBefore(this.selection.getFirstPosition().parent):t}_isSelectionInInlineFiller(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return!1;const t=this.selection.getFirstPosition(),e=this.domConverter.viewPositionToDom(t);return!!(e&&Hn(e.parent)&&$n(e.parent))}_removeInlineFiller(){const t=this._inlineFiller;if(!$n(t))throw new he.b("view-renderer-filler-was-lost: The inline filler node was lost.");Zn(t)?t.parentNode.removeChild(t):t.data=t.data.substr(Yn),this._inlineFiller=null}_needsInlineFillerAtSelection(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return!1;const t=this.selection.getFirstPosition(),e=t.parent,n=t.offset;return!(!this.domConverter.mapViewToDom(e.root)||!e.is("element")||!function(t){if("false"==t.getAttribute("contenteditable"))return!1;const e=t.findAncestor(t=>t.hasAttribute("contenteditable"));return!e||"true"==e.getAttribute("contenteditable")}(e)||n===e.getFillerOffset()||t.nodeBefore instanceof Te||t.nodeAfter instanceof Te)}_updateText(t,e){const n=this.domConverter.findCorrespondingDomText(t),r=this.domConverter.viewToDom(t,n.ownerDocument),i=n.data;let o=r.data;const s=e.inlineFillerPosition;if(s&&s.parent==t.parent&&s.offset==t.index&&(o=Kn+o),i!=o){const t=er(i,o);for(const e of t)"insert"===e.type?n.insertData(e.index,e.values.join("")):n.deleteData(e.index,e.howMany)}}_updateAttrs(t){const e=this.domConverter.mapViewToDom(t);if(!e)return;const n=Array.from(e.attributes).map(t=>t.name),r=t.getAttributeKeys();for(const i of r)e.setAttribute(i,t.getAttribute(i));for(const i of n)t.hasAttribute(i)||e.removeAttribute(i)}_updateChildren(t,e){const n=this.domConverter.mapViewToDom(t);if(!n)return;const r=e.inlineFillerPosition,i=this.domConverter.mapViewToDom(t).childNodes,o=Array.from(this.domConverter.viewChildrenToDom(t,n.ownerDocument,{bind:!0,inlineFillerPosition:r}));r&&r.parent===t&&ur(n.ownerDocument,o,r.offset);const s=this._diffNodeLists(i,o);let a=0;const l=new Set;for(const u of s)"insert"===u?(or(n,a,o[a]),a++):"delete"===u?(l.add(i[a]),sr(i[a])):(this._markDescendantTextToSync(this.domConverter.domToView(o[a])),a++);for(const u of l)u.parentNode||this.domConverter.unbindDomElement(u)}_diffNodeLists(t,e){return ir(t=function(t,e){const n=Array.from(t);return 0!=n.length&&e?(n[n.length-1]==e&&n.pop(),n):n}(t,this._fakeSelectionContainer),e,(function(t,e,n){return e===n||(Hn(e)&&Hn(n)?e.data===n.data:!(!Xn(e,t)||!Xn(n,t)))}).bind(null,this.domConverter.blockFiller))}_findReplaceActions(t,e,n){if(-1===t.indexOf("insert")||-1===t.indexOf("delete"))return t;let r=[],i=[],o=[];const s={equal:0,insert:0,delete:0};for(const a of t)"insert"===a?o.push(n[s.equal+s.insert]):"delete"===a?i.push(e[s.equal+s.delete]):((r=r.concat(ir(i,o,cr).map(t=>"equal"===t?"replace":t))).push("equal"),i=[],o=[]),s[a]++;return r.concat(ir(i,o,cr).map(t=>"equal"===t?"replace":t))}_markDescendantTextToSync(t){if(t)if(t.is("text"))this.markedTexts.add(t);else if(t.is("element"))for(const e of t.getChildren())this._markDescendantTextToSync(e)}_updateSelection(){if(0===this.selection.rangeCount)return this._removeDomSelection(),void this._removeFakeSelection();const t=this.domConverter.mapViewToDom(this.selection.editableElement);this.isFocused&&t&&(this.selection.isFake?this._updateFakeSelection(t):(this._removeFakeSelection(),this._updateDomSelection(t)))}_updateFakeSelection(t){const e=t.ownerDocument;let n=this._fakeSelectionContainer;n||(this._fakeSelectionContainer=n=e.createElement("div"),Object.assign(n.style,{position:"fixed",top:0,left:"-9999px",width:"42px"}),n.textContent="\xa0"),n.parentElement&&n.parentElement==t||t.appendChild(n),n.textContent=this.selection.fakeSelectionLabel||"\xa0";const r=e.getSelection(),i=e.createRange();r.removeAllRanges(),i.selectNodeContents(n),r.addRange(i),this.domConverter.bindFakeSelection(n,this.selection)}_updateDomSelection(t){const e=t.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(e))return;const n=this.domConverter.viewPositionToDom(this.selection.anchor),r=this.domConverter.viewPositionToDom(this.selection.focus);t.focus(),e.collapse(n.parent,n.offset),e.extend(r.parent,r.offset),Cn.isGecko&&function(t,e){const n=t.parent;if(n.nodeType!=Node.ELEMENT_NODE||t.offset!=n.childNodes.length-1)return;const r=n.childNodes[t.offset];r&&"BR"==r.tagName&&e.addRange(e.getRangeAt(0))}(r,e)}_domSelectionNeedsUpdate(t){if(!this.domConverter.isDomSelectionCorrect(t))return!0;const e=t&&this.domConverter.domSelectionToView(t);return!(e&&this.selection.isEqual(e)||!this.selection.isCollapsed&&this.selection.isSimilar(e))}_removeDomSelection(){for(const t of this.domDocuments)if(t.getSelection().rangeCount){const e=t.activeElement,n=this.domConverter.mapDomToView(e);e&&n&&t.getSelection().removeAllRanges()}}_removeFakeSelection(){const t=this._fakeSelectionContainer;t&&t.remove()}_updateFocus(){if(this.isFocused){const t=this.selection.editableElement;t&&this.domConverter.focus(t)}}}function ur(t,e,n){const r=e instanceof Array?e:e.childNodes,i=r[n];if(Hn(i))return i.data=Kn+i.data,i;{const i=t.createTextNode(Kn);return Array.isArray(e)?r.splice(n,0,i):or(e,n,i),i}}function cr(t,e){return ar(t)&&ar(e)&&!Hn(t)&&!Hn(e)&&t.tagName.toLowerCase()===e.tagName.toLowerCase()}Se(lr,Qe);var dr={window:window,document:document};function hr(t){let e=0;for(;t.previousSibling;)t=t.previousSibling,e++;return e}function fr(t){const e=[];for(;t&&t.nodeType!=Node.DOCUMENT_NODE;)e.unshift(t),t=t.parentNode;return e}class pr{constructor(t={}){this.blockFiller=t.blockFiller||Wn,this.preElements=["pre"],this.blockElements=["p","div","h1","h2","h3","h4","h5","h6"],this._domToViewMapping=new WeakMap,this._viewToDomMapping=new WeakMap,this._fakeSelectionMapping=new WeakMap}bindFakeSelection(t,e){this._fakeSelectionMapping.set(t,new fn(e))}fakeSelectionToView(t){return this._fakeSelectionMapping.get(t)}bindElements(t,e){this._domToViewMapping.set(t,e),this._viewToDomMapping.set(e,t)}unbindDomElement(t){const e=this._domToViewMapping.get(t);if(e){this._domToViewMapping.delete(t),this._viewToDomMapping.delete(e);for(const e of Array.from(t.childNodes))this.unbindDomElement(e)}}bindDocumentFragments(t,e){this._domToViewMapping.set(t,e),this._viewToDomMapping.set(e,t)}viewToDom(t,e,n={}){if(t.is("text")){const n=this._processDataFromViewText(t);return e.createTextNode(n)}{if(this.mapViewToDom(t))return this.mapViewToDom(t);let r;if(t.is("documentFragment"))r=e.createDocumentFragment(),n.bind&&this.bindDocumentFragments(r,t);else{if(t.is("uiElement"))return r=t.render(e),n.bind&&this.bindElements(r,t),r;r=e.createElement(t.name),n.bind&&this.bindElements(r,t);for(const e of t.getAttributeKeys())r.setAttribute(e,t.getAttribute(e))}if(n.withChildren||void 0===n.withChildren)for(const i of this.viewChildrenToDom(t,e,n))r.appendChild(i);return r}}*viewChildrenToDom(t,e,n={}){const r=t.getFillerOffset&&t.getFillerOffset();let i=0;for(const o of t.getChildren())r===i&&(yield this.blockFiller(e)),yield this.viewToDom(o,e,n),i++;r===i&&(yield this.blockFiller(e))}viewRangeToDom(t){const e=this.viewPositionToDom(t.start),n=this.viewPositionToDom(t.end),r=document.createRange();return r.setStart(e.parent,e.offset),r.setEnd(n.parent,n.offset),r}viewPositionToDom(t){const e=t.parent;if(e.is("text")){const n=this.findCorrespondingDomText(e);if(!n)return null;let r=t.offset;return $n(n)&&(r+=Yn),{parent:n,offset:r}}{let n,r,i;if(0===t.offset){if(!(n=this.mapViewToDom(e)))return null;i=n.childNodes[0]}else{const e=t.nodeBefore;if(!(r=e.is("text")?this.findCorrespondingDomText(e):this.mapViewToDom(t.nodeBefore)))return null;n=r.parentNode,i=r.nextSibling}return Hn(i)&&$n(i)?{parent:i,offset:Yn}:{parent:n,offset:r?hr(r)+1:0}}}domToView(t,e={}){if(Xn(t,this.blockFiller))return null;const n=this.getParentUIElement(t,this._domToViewMapping);if(n)return n;if(Hn(t)){if(Zn(t))return null;{const e=this._processDataFromDomText(t);return""===e?null:new Te(e)}}if(this.isComment(t))return null;{if(this.mapDomToView(t))return this.mapDomToView(t);let n;if(this.isDocumentFragment(t))n=new Mn,e.bind&&this.bindDocumentFragments(t,n);else{const r=e.keepOriginalCase?t.tagName:t.tagName.toLowerCase();n=new Le(r),e.bind&&this.bindElements(t,n);const i=t.attributes;for(let t=i.length-1;t>=0;t--)n._setAttribute(i[t].name,i[t].value)}if(e.withChildren||void 0===e.withChildren)for(const r of this.domChildrenToView(t,e))n._appendChild(r);return n}}*domChildrenToView(t,e={}){for(let n=0;n{const{scrollLeft:e,scrollTop:n}=t;r.push([e,n])}),e.focus(),mr(e,t=>{const[e,n]=r.shift();t.scrollLeft=e,t.scrollTop=n}),dr.window.scrollTo(t,n)}}isElement(t){return t&&t.nodeType==Node.ELEMENT_NODE}isDocumentFragment(t){return t&&t.nodeType==Node.DOCUMENT_FRAGMENT_NODE}isComment(t){return t&&t.nodeType==Node.COMMENT_NODE}isDomSelectionBackward(t){if(t.isCollapsed)return!1;const e=document.createRange();e.setStart(t.anchorNode,t.anchorOffset),e.setEnd(t.focusNode,t.focusOffset);const n=e.collapsed;return e.detach(),n}getParentUIElement(t){const e=fr(t);for(e.pop();e.length;){const t=e.pop(),n=this._domToViewMapping.get(t);if(n&&n.is("uiElement"))return n}return null}isDomSelectionCorrect(t){return this._isDomSelectionPositionCorrect(t.anchorNode,t.anchorOffset)&&this._isDomSelectionPositionCorrect(t.focusNode,t.focusOffset)}_isDomSelectionPositionCorrect(t,e){if(Hn(t)&&$n(t)&&ethis.preElements.includes(t.name)))return e;if(" "==e.charAt(0)){const n=this._getTouchingViewTextNode(t,!1);(!n||!this._nodeEndsWithSpace(n))&&n||(e="\xa0"+e.substr(1))}return" "==e.charAt(e.length-1)&&(this._getTouchingViewTextNode(t,!0)||(e=e.substr(0,e.length-1)+"\xa0")),e.replace(/ {2}/g," \xa0")}_nodeEndsWithSpace(t){if(t.getAncestors().some(t=>this.preElements.includes(t.name)))return!1;const e=this._processDataFromViewText(t);return" "==e.charAt(e.length-1)}_processDataFromDomText(t){let e=t.data;if(gr(t,this.preElements))return Qn(t);e=e.replace(/[ \n\t\r]{1,}/g," ");const n=this._getTouchingInlineDomNode(t,!1),r=this._getTouchingInlineDomNode(t,!0),i=this._checkShouldLeftTrimDomText(n),o=this._checkShouldRightTrimDomText(t,r);return i&&(e=e.replace(/^ /,"")),o&&(e=e.replace(/ $/,"")),e=(e=Qn(new Text(e))).replace(/ \u00A0/g," "),i&&(e=e.replace(/^\u00A0/," ")),Hn(r)&&"\xa0"!=r.data.charAt(0)||(e=e.replace(/\u00A0( *)$/," $1")),e}_checkShouldLeftTrimDomText(t){return!t||!!ue(t)||/[^\S\u00A0]/.test(t.data.charAt(t.data.length-1))}_checkShouldRightTrimDomText(t,e){return!e&&!$n(t)}_getTouchingViewTextNode(t,e){const n=new ln({startPosition:e?un._createAfter(t):un._createBefore(t),direction:e?"forward":"backward"});for(const r of n){if(r.item.is("containerElement"))return null;if(r.item.is("br"))return null;if(r.item.is("textProxy"))return r.item}return null}_getTouchingInlineDomNode(t,e){if(!t.parentNode)return null;const n=e?"nextNode":"previousNode",r=t.ownerDocument,i=fr(t)[0],o=r.createTreeWalker(i,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT,{acceptNode:t=>Hn(t)?NodeFilter.FILTER_ACCEPT:"BR"==t.tagName?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});o.currentNode=t;const s=o[n]();if(null!==s){const e=function(t,e){const n=fr(t),r=fr(e);let i=0;for(;n[i]==r[i]&&n[i];)i++;return 0===i?null:n[i-1]}(t,s);if(e&&!gr(t,this.blockElements,e)&&!gr(s,this.blockElements,e))return s}return null}}function gr(t,e,n){let r=fr(t);return n&&(r=r.slice(r.indexOf(n)+1)),r.some(t=>t.tagName&&e.includes(t.tagName.toLowerCase()))}function mr(t,e){for(;t&&t!=dr.document;)e(t),t=t.parentNode}function vr(t){const e=Object.prototype.toString.apply(t);return"[object Window]"==e||"[object global]"==e}var yr=Ge({},be,{listenTo(t,...e){if(ar(t)||vr(t)){const n=this._getProxyEmitter(t)||new br(t);n.attach(...e),t=n}be.listenTo.call(this,t,...e)},stopListening(t,e,n){if(ar(t)||vr(t)){const e=this._getProxyEmitter(t);if(!e)return;t=e}be.stopListening.call(this,t,e,n),t instanceof br&&t.detach(e)},_getProxyEmitter(t){return function(t,e){return t[ve]&&t[ve][e]?t[ve][e].emitter:null}(this,wr(t))}});class br{constructor(t){we(this,wr(t)),this._domNode=t}}function wr(t){return t["data-ck-expando"]||(t["data-ck-expando"]=ge())}Ge(br.prototype,be,{attach(t,e,n={}){if(this._domListeners&&this._domListeners[t])return;const r=this._createDomListener(t,!!n.useCapture);this._domNode.addEventListener(t,r,!!n.useCapture),this._domListeners||(this._domListeners={}),this._domListeners[t]=r},detach(t){let e;!this._domListeners[t]||(e=this._events[t])&&e.callbacks.length||this._domListeners[t].removeListener()},_createDomListener(t,e){const n=e=>{this.fire(t,e)};return n.removeListener=(()=>{this._domNode.removeEventListener(t,n,e),delete this._domListeners[t]}),n}});class _r{constructor(t){this.view=t,this.document=t.document,this.isEnabled=!1}enable(){this.isEnabled=!0}disable(){this.isEnabled=!1}destroy(){this.disable(),this.stopListening()}}function kr(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new W;++ea))return!1;var u=o.get(t);if(u&&o.get(e))return u==e;var c=-1,d=!0,h=2&n?new xr:void 0;for(o.set(t,e),o.set(e,t);++c{this.listenTo(t,e,(t,e)=>{this.isEnabled&&this.onDomEvent(e)},{useCapture:this.useCapture})})}fire(t,e,n){this.isEnabled&&this.document.fire(t,new Br(this.view,e,n))}}class qr extends Vr{constructor(t){super(t),this.domEventType=["keydown","keyup"]}onDomEvent(t){this.fire(t.type,t,{keyCode:t.keyCode,altKey:t.altKey,ctrlKey:t.ctrlKey||t.metaKey,shiftKey:t.shiftKey,get keystroke(){return On(this)}})}}var zr=function(){return r.a.Date.now()},Ur=/^\s+|\s+$/g,Hr=/^[-+]0x[0-9a-f]+$/i,Wr=/^0b[01]+$/i,Gr=/^0o[0-7]+$/i,Yr=parseInt,Kr=function(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||p(t)&&"[object Symbol]"==d(t)}(t))return NaN;if(S(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=S(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(Ur,"");var n=Wr.test(t);return n||Gr.test(t)?Yr(t.slice(2),n?2:8):Hr.test(t)?NaN:+t},$r=Math.max,Zr=Math.min,Qr=function(t,e,n){var r,i,o,s,a,l,u=0,c=!1,d=!1,h=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){var n=r,o=i;return r=i=void 0,u=e,s=t.apply(o,n)}function p(t){var n=t-l;return void 0===l||n>=e||n<0||d&&t-u>=o}function g(){var t=zr();if(p(t))return m(t);a=setTimeout(g,function(t){var n=e-(t-l);return d?Zr(n,o-(t-u)):n}(t))}function m(t){return a=void 0,h&&r?f(t):(r=i=void 0,s)}function v(){var t=zr(),n=p(t);if(r=arguments,i=this,l=t,n){if(void 0===a)return function(t){return u=t,a=setTimeout(g,e),c?f(t):s}(l);if(d)return a=setTimeout(g,e),f(l)}return void 0===a&&(a=setTimeout(g,e)),s}return e=Kr(e)||0,S(n)&&(c=!!n.leading,o=(d="maxWait"in n)?$r(Kr(n.maxWait)||0,e):o,h="trailing"in n?!!n.trailing:h),v.cancel=function(){void 0!==a&&clearTimeout(a),u=0,r=l=i=a=void 0},v.flush=function(){return void 0===a?s:m(zr())},v};class Jr extends _r{constructor(t){super(t),this._fireSelectionChangeDoneDebounced=Qr(t=>this.document.fire("selectionChangeDone",t),200)}observe(){const t=this.document;t.on("keydown",(e,n)=>{t.selection.isFake&&function(t){return t==En.arrowright||t==En.arrowleft||t==En.arrowup||t==En.arrowdown}(n.keyCode)&&this.isEnabled&&(n.preventDefault(),this._handleSelectionMove(n.keyCode))},{priority:"lowest"})}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(t){const e=this.document.selection,n=new fn(e.getRanges(),{backward:e.isBackward,fake:!1});t!=En.arrowleft&&t!=En.arrowup||n.setTo(n.getFirstPosition()),t!=En.arrowright&&t!=En.arrowdown||n.setTo(n.getLastPosition());const r={oldSelection:e,newSelection:n,domSelection:null};this.document.fire("selectionChange",r),this._fireSelectionChangeDoneDebounced(r)}}var Xr=n(2);class ti extends _r{constructor(t){super(t),this.mutationObserver=t.getObserver(Fr),this.selection=this.document.selection,this.domConverter=t.domConverter,this._documents=new WeakSet,this._fireSelectionChangeDoneDebounced=Qr(t=>this.document.fire("selectionChangeDone",t),200),this._clearInfiniteLoopInterval=setInterval(()=>this._clearInfiniteLoop(),1e3),this._loopbackCounter=0}observe(t){const e=t.ownerDocument;this._documents.has(e)||(this.listenTo(e,"selectionchange",()=>{this._handleSelectionChange(e)}),this._documents.add(e))}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionChange(t){if(!this.isEnabled||!this.document.isFocused&&!this.document.isReadOnly)return;this.mutationObserver.flush();const e=t.defaultView.getSelection(),n=this.domConverter.domSelectionToView(e);if(!this.selection.isEqual(n)||!this.domConverter.isDomSelectionCorrect(e))if(++this._loopbackCounter>60)Xr.a.warn("selectionchange-infinite-loop: Selection change observer detected an infinite rendering loop.");else if(this.selection.isSimilar(n))this.view.forceRender();else{const t={oldSelection:this.selection,newSelection:n,domSelection:e};this.document.fire("selectionChange",t),this._fireSelectionChangeDoneDebounced(t)}}_clearInfiniteLoop(){this._loopbackCounter=0}}class ei extends Vr{constructor(t){super(t),this.domEventType=["focus","blur"],this.useCapture=!0;const e=this.document;e.on("focus",()=>{e.isFocused=!0,this._renderTimeoutId=setTimeout(()=>t.forceRender(),50)}),e.on("blur",(n,r)=>{const i=e.selection.editableElement;null!==i&&i!==r.target||(e.isFocused=!1,t.forceRender())})}onDomEvent(t){this.fire(t.type,t)}destroy(){this._renderTimeoutId&&clearTimeout(this._renderTimeoutId),super.destroy()}}class ni extends Vr{constructor(t){super(t),this.domEventType=["compositionstart","compositionupdate","compositionend"];const e=this.document;e.on("compositionstart",()=>{e.isComposing=!0}),e.on("compositionend",()=>{e.isComposing=!1})}onDomEvent(t){this.fire(t.type,t)}}function ri(t){return"[object Range]"==Object.prototype.toString.apply(t)}function ii(t){const e=t.ownerDocument.defaultView.getComputedStyle(t);return{top:parseInt(e.borderTopWidth,10),right:parseInt(e.borderRightWidth,10),bottom:parseInt(e.borderBottomWidth,10),left:parseInt(e.borderLeftWidth,10)}}const oi=["top","right","bottom","left","width","height"];class si{constructor(t){const e=ri(t);if(Object.defineProperty(this,"_source",{value:t._source||t,writable:!0,enumerable:!1}),ue(t)||e){const n=e?t.startContainer:t;n.ownerDocument&&n.ownerDocument.body.contains(n)||Xr.a.warn("rect-source-not-in-dom: The source of this rect does not belong to any rendered DOM tree.",{source:t}),ai(this,e?si.getDomRangeRects(t)[0]:t.getBoundingClientRect())}else if(vr(t)){const{innerWidth:e,innerHeight:n}=t;ai(this,{top:0,right:e,bottom:n,left:0,width:e,height:n})}else ai(this,t)}clone(){return new si(this)}moveTo(t,e){return this.top=e,this.right=t+this.width,this.bottom=e+this.height,this.left=t,this}moveBy(t,e){return this.top+=e,this.right+=t,this.left+=t,this.bottom+=e,this}getIntersection(t){const e={top:Math.max(this.top,t.top),right:Math.min(this.right,t.right),bottom:Math.min(this.bottom,t.bottom),left:Math.max(this.left,t.left)};return e.width=e.right-e.left,e.height=e.bottom-e.top,e.width<0||e.height<0?null:new si(e)}getIntersectionArea(t){const e=this.getIntersection(t);return e?e.getArea():0}getArea(){return this.width*this.height}getVisible(){const t=this._source;let e=this.clone();if(!li(t)){let n=t.parentNode||t.commonAncestorContainer;for(;n&&!li(n);){const t=new si(n),r=e.getIntersection(t);if(!r)return null;r.getArea()yi(t,r));const s=yi(t,r);if(ci(r,s,e),r.parent!=r){if(i=r.frameElement,r=r.parent,!i)return}else r=null}}function ci(t,e,n){const r=e.clone().moveBy(0,n),i=e.clone().moveBy(0,-n),o=new si(t).excludeScrollbarsAndBorders();if(![i,r].every(t=>o.contains(t))){let{scrollX:s,scrollY:a}=t;fi(i,o)?a-=o.top-e.top+n:hi(r,o)&&(a+=e.bottom-o.bottom+n),pi(e,o)?s-=o.left-e.left+n:gi(e,o)&&(s+=e.right-o.right+n),t.scrollTo(s,a)}}function di(t,e){const n=mi(t);let r,i;for(;t!=n.document.body;)i=e(),(r=new si(t).excludeScrollbarsAndBorders()).contains(i)||(fi(i,r)?t.scrollTop-=r.top-i.top:hi(i,r)&&(t.scrollTop+=i.bottom-r.bottom),pi(i,r)?t.scrollLeft-=r.left-i.left:gi(i,r)&&(t.scrollLeft+=i.right-r.right)),t=t.parentNode}function hi(t,e){return t.bottom>e.bottom}function fi(t,e){return t.tope.right}function mi(t){return ri(t)?t.startContainer.ownerDocument.defaultView:t.ownerDocument.defaultView}function vi(t){if(ri(t)){let e=t.commonAncestorContainer;return Hn(e)&&(e=e.parentNode),e}return t.parentNode}function yi(t,e){const n=mi(t),r=new si(t);if(n===e)return r;{let t=n;for(;t!=e;){const e=new si(t.frameElement).excludeScrollbarsAndBorders();r.moveBy(e.left,e.top),t=t.parent}}return r}Object.assign({},{scrollViewportToShowTarget:ui,scrollAncestorsToShowTarget:function(t){di(vi(t),()=>new si(t))}});class bi{constructor(){this.document=new mn,this.domConverter=new pr,this.domRoots=new Map,this.set("isRenderingInProgress",!1),this._renderer=new lr(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 Dn(this.document),this.addObserver(Fr),this.addObserver(ti),this.addObserver(ei),this.addObserver(qr),this.addObserver(Jr),this.addObserver(ni),this.document.on("keydown",tr),function(t){t.document.on("keydown",(e,n)=>(function(t,e,n){if(e.keyCode==En.arrowright){const t=e.domTarget.ownerDocument.defaultView.getSelection(),r=1==t.rangeCount&&t.getRangeAt(0).collapsed;if(r||e.shiftKey){const e=n.domPositionToView(t.focusNode,t.focusOffset);if(null===e)return;let i=!1;const o=e.getLastMatchingPosition(t=>(t.item.is("uiElement")&&(i=!0),!(!t.item.is("uiElement")&&!t.item.is("attributeElement"))));if(i){const e=n.viewPositionToDom(o);r?t.collapse(e.parent,e.offset):t.extend(e.parent,e.offset)}}}})(0,n,t.domConverter))}(this),this.on("render",()=>{this._render(),this.document.fire("layoutChanged"),this._hasChangedSinceTheLastRendering=!1}),this.listenTo(this.document.selection,"change",()=>{this._hasChangedSinceTheLastRendering=!0})}attachDomRoot(t,e="main"){const n=this.document.getRoot(e);n._name=t.tagName.toLowerCase();const r={};for(const{name:o,value:s}of Array.from(t.attributes))r[o]=s,"class"===o?this._writer.addClass(s.split(" "),n):this._writer.setAttribute(o,s,n);this._initialDomRootAttributes.set(t,r);const i=()=>{this._writer.setAttribute("contenteditable",!n.isReadOnly,n),n.isReadOnly?this._writer.addClass("ck-read-only",n):this._writer.removeClass("ck-read-only",n)};i(),this.domRoots.set(e,t),this.domConverter.bindElements(t,n),this._renderer.markToSync("children",n),this._renderer.markToSync("attributes",n),this._renderer.domDocuments.add(t.ownerDocument),n.on("change:children",(t,e)=>this._renderer.markToSync("children",e)),n.on("change:attributes",(t,e)=>this._renderer.markToSync("attributes",e)),n.on("change:text",(t,e)=>this._renderer.markToSync("text",e)),n.on("change:isReadOnly",()=>this.change(i)),n.on("change",()=>{this._hasChangedSinceTheLastRendering=!0});for(const o of this._observers.values())o.observe(t,e)}detachDomRoot(t){const e=this.domRoots.get(t);Array.from(e.attributes).forEach(({name:t})=>e.removeAttribute(t));const n=this._initialDomRootAttributes.get(e);for(const r in n)e.setAttribute(r,n[r]);this.domRoots.delete(t),this.domConverter.unbindDomElement(e)}getDomRoot(t="main"){return this.domRoots.get(t)}addObserver(t){let e=this._observers.get(t);if(e)return e;e=new t(this),this._observers.set(t,e);for(const[n,r]of this.domRoots)e.observe(r,n);return e.enable(),e}getObserver(t){return this._observers.get(t)}disableObservers(){for(const t of this._observers.values())t.disable()}enableObservers(){for(const t of this._observers.values())t.enable()}scrollToTheSelection(){const t=this.document.selection.getFirstRange();t&&ui({target:this.domConverter.viewRangeToDom(t),viewportOffset:20})}focus(){if(!this.document.isFocused){const t=this.document.selection.editableElement;t?(this.domConverter.focus(t),this.forceRender()):Xr.a.warn("view-focus-no-selection: There is no selection in any editable to focus.")}}change(t){if(this.isRenderingInProgress||this._postFixersInProgress)throw new he.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.");if(this._ongoingChange)return t(this._writer);this._ongoingChange=!0;const e=t(this._writer);return this._ongoingChange=!1,!this._renderingDisabled&&this._hasChangedSinceTheLastRendering&&(this._postFixersInProgress=!0,this.document._callPostFixers(this._writer),this._postFixersInProgress=!1,this.fire("render")),e}forceRender(){this._hasChangedSinceTheLastRendering=!0,this.change(()=>{})}destroy(){for(const t of this._observers.values())t.destroy();this.document.destroy(),this.stopListening()}createPositionAt(t,e){return un._createAt(t,e)}createPositionAfter(t){return un._createAfter(t)}createPositionBefore(t){return un._createBefore(t)}createRange(t,e){return new cn(t,e)}createRangeOn(t){return cn._createOn(t)}createRangeIn(t){return cn._createIn(t)}createSelection(t,e,n){return new fn(t,e,n)}_disableRendering(t){this._renderingDisabled=t,0==t&&this.change(()=>{})}_render(){this.isRenderingInProgress=!0,this.disableObservers(),this._renderer.render(),this.enableObservers(),this.isRenderingInProgress=!1}}function wi(t){return w(t)?Ie(t):new Map(t)}Se(bi,Qe);class _i{constructor(t){this.parent=null,this._attrs=wi(t)}get index(){let t;if(!this.parent)return null;if(null===(t=this.parent.getChildIndex(this)))throw new he.b("model-node-not-found-in-parent: The node's parent does not contain this node.");return t}get startOffset(){let t;if(!this.parent)return null;if(null===(t=this.parent.getChildStartOffset(this)))throw new he.b("model-node-not-found-in-parent: The node's parent does not contain this node.");return t}get offsetSize(){return 1}get endOffset(){return this.parent?this.startOffset+this.offsetSize:null}get nextSibling(){const t=this.index;return null!==t&&this.parent.getChild(t+1)||null}get previousSibling(){const t=this.index;return null!==t&&this.parent.getChild(t-1)||null}get root(){let t=this;for(;t.parent;)t=t.parent;return t}get document(){return this.root==this?null:this.root.document||null}getPath(){const t=[];let e=this;for(;e.parent;)t.unshift(e.startOffset),e=e.parent;return t}getAncestors(t={includeSelf:!1,parentFirst:!1}){const e=[];let n=t.includeSelf?this:this.parent;for(;n;)e[t.parentFirst?"push":"unshift"](n),n=n.parent;return e}getCommonAncestor(t,e={}){const n=this.getAncestors(e),r=t.getAncestors(e);let i=0;for(;n[i]==r[i]&&n[i];)i++;return 0===i?null:n[i-1]}isBefore(t){if(this==t)return!1;if(this.root!==t.root)return!1;const e=this.getPath(),n=t.getPath(),r=Ee(e,n);switch(r){case"prefix":return!0;case"extension":return!1;default:return e[r](t[e[0]]=e[1],t),{})),t}_clone(){return new _i(this._attrs)}_remove(){this.parent._removeChildren(this.index)}_setAttribute(t,e){this._attrs.set(t,e)}_setAttributesTo(t){this._attrs=wi(t)}_removeAttribute(t){return this._attrs.delete(t)}_clearAttributes(){this._attrs.clear()}is(t){return"node"==t}}class ki extends _i{constructor(t,e){super(e),this._data=t||""}get offsetSize(){return this.data.length}get data(){return this._data}is(t){return"text"==t||super.is(t)}toJSON(){const t=super.toJSON();return t.data=this.data,t}_clone(){return new ki(this.data,this.getAttributes())}static fromJSON(t){return new ki(t.data,t.attributes)}}class xi{constructor(t,e,n){if(this.textNode=t,e<0||e>t.offsetSize)throw new he.b("model-textproxy-wrong-offsetintext: Given offsetInText value is incorrect.");if(n<0||e+n>t.offsetSize)throw new he.b("model-textproxy-wrong-length: Given length value is incorrect.");this.data=t.data.substring(e,e+n),this.offsetInText=e}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}get document(){return this.textNode.document}is(t){return"textProxy"==t}getPath(){const t=this.textNode.getPath();return t.length>0&&(t[t.length-1]+=this.offsetInText),t}getAncestors(t={includeSelf:!1,parentFirst:!1}){const e=[];let n=t.includeSelf?this:this.parent;for(;n;)e[t.parentFirst?"push":"unshift"](n),n=n.parent;return e}hasAttribute(t){return this.textNode.hasAttribute(t)}getAttribute(t){return this.textNode.getAttribute(t)}getAttributes(){return this.textNode.getAttributes()}getAttributeKeys(){return this.textNode.getAttributeKeys()}}class Ci{constructor(t){this._nodes=[],t&&this._insertNodes(0,t)}[Symbol.iterator](){return this._nodes[Symbol.iterator]()}get length(){return this._nodes.length}get maxOffset(){return this._nodes.reduce((t,e)=>t+e.offsetSize,0)}getNode(t){return this._nodes[t]||null}getNodeIndex(t){const e=this._nodes.indexOf(t);return-1==e?null:e}getNodeStartOffset(t){const e=this.getNodeIndex(t);return null===e?null:this._nodes.slice(0,e).reduce((t,e)=>t+e.offsetSize,0)}indexToOffset(t){if(t==this._nodes.length)return this.maxOffset;const e=this._nodes[t];if(!e)throw new he.b("model-nodelist-index-out-of-bounds: Given index cannot be found in the node list.");return this.getNodeStartOffset(e)}offsetToIndex(t){let e=0;for(const n of this._nodes){if(t>=e&&tt.toJSON())}}class Ai extends _i{constructor(t,e,n){super(e),this.name=t,this._children=new Ci,n&&this._insertChild(0,n)}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return 0===this.childCount}is(t,e=null){return e?"element"==t&&e==this.name:"element"==t||t==this.name||super.is(t)}getChild(t){return this._children.getNode(t)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(t){return this._children.getNodeIndex(t)}getChildStartOffset(t){return this._children.getNodeStartOffset(t)}offsetToIndex(t){return this._children.offsetToIndex(t)}getNodeByPath(t){let e=this;for(const n of t)e=e.getChild(e.offsetToIndex(n));return e}toJSON(){const t=super.toJSON();if(t.name=this.name,this._children.length>0){t.children=[];for(const e of this._children)t.children.push(e.toJSON())}return t}_clone(t=!1){const e=t?Array.from(this._children).map(t=>t._clone(!0)):null;return new Ai(this.name,this.getAttributes(),e)}_appendChild(t){this._insertChild(this.childCount,t)}_insertChild(t,e){const n=function(t){return"string"==typeof t?[new ki(t)]:(Me(t)||(t=[t]),Array.from(t).map(t=>"string"==typeof t?new ki(t):t instanceof xi?new ki(t.data,t.getAttributes()):t))}(e);for(const r of n)null!==r.parent&&r._remove(),r.parent=this;this._children._insertNodes(t,n)}_removeChildren(t,e=1){const n=this._children._removeNodes(t,e);for(const r of n)r.parent=null;return n}static fromJSON(t){let e=null;if(t.children){e=[];for(const n of t.children)e.push(n.name?Ai.fromJSON(n):ki.fromJSON(n))}return new Ai(t.name,t.attributes,e)}}class Si{constructor(t={}){if(!t.boundaries&&!t.startPosition)throw new he.b("model-tree-walker-no-start-position: Neither boundaries nor starting position have been defined.");const e=t.direction||"forward";if("forward"!=e&&"backward"!=e)throw new he.b("model-tree-walker-unknown-direction: Only `backward` and `forward` direction allowed.",{direction:e});this.direction=e,this.boundaries=t.boundaries||null,this.position=t.startPosition?t.startPosition.clone():Pi._createAt(this.boundaries["backward"==this.direction?"end":"start"]),this.position.stickiness="toNone",this.singleCharacters=!!t.singleCharacters,this.shallow=!!t.shallow,this.ignoreElementEnd=!!t.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(t){let e,n,r,i;do{r=this.position,i=this._visitedParent,({done:e,value:n}=this.next())}while(!e&&t(n));e||(this.position=r,this._visitedParent=i)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){const t=this.position,e=this.position.clone(),n=this._visitedParent;if(null===n.parent&&e.offset===n.maxOffset)return{done:!0};if(n===this._boundaryEndParent&&e.offset==this.boundaries.end.offset)return{done:!0};const r=e.textNode?e.textNode:e.nodeAfter;if(r instanceof Ai)return this.shallow?e.offset++:(e.path.push(0),this._visitedParent=r),this.position=e,Ei("elementStart",r,t,e,1);if(r instanceof ki){let i;if(this.singleCharacters)i=1;else{let t=r.endOffset;this._boundaryEndParent==n&&this.boundaries.end.offsett&&(t=this.boundaries.start.offset),i=e.offset-t}const o=new xi(r,e.offset-r.startOffset-i,i);return e.offset-=i,this.position=e,Ei("text",o,t,e,i)}return e.path.pop(),this.position=e,this._visitedParent=n.parent,Ei("elementStart",n,t,e,1)}}function Ei(t,e,n,r,i){return{done:!1,value:{type:t,item:e,previousPosition:n,nextPosition:r,length:i}}}var Oi=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0};class Pi{constructor(t,e,n="toNone"){if(!t.is("element")&&!t.is("documentFragment"))throw new he.b("model-position-root-invalid: Position root invalid.");if(!(e instanceof Array)||0===e.length)throw new he.b("model-position-path-incorrect: Position path must be an array with at least one item.",{path:e});e=t.getPath().concat(e),this.root=t=t.root,this.path=e,this.stickiness=n}get offset(){return Oi(this.path)}set offset(t){this.path[this.path.length-1]=t}get parent(){let t=this.root;for(let e=0;en.path.length){if(e.offset!==r.maxOffset)return!1;e.path=e.path.slice(0,-1),r=r.parent,e.offset++}else{if(0!==n.offset)return!1;n.path=n.path.slice(0,-1)}}}hasSameParentAs(t){return this.root===t.root&&"same"==Ee(this.getParentPath(),t.getParentPath())}getTransformedByOperation(t){let e;switch(t.type){case"insert":e=this._getTransformedByInsertOperation(t);break;case"move":case"remove":case"reinsert":e=this._getTransformedByMoveOperation(t);break;case"split":e=this._getTransformedBySplitOperation(t);break;case"merge":e=this._getTransformedByMergeOperation(t);break;default:e=Pi._createAt(this)}return e}_getTransformedByInsertOperation(t){return this._getTransformedByInsertion(t.position,t.howMany)}_getTransformedByMoveOperation(t){return this._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany)}_getTransformedBySplitOperation(t){const e=t.movedRange;return e.containsPosition(this)||e.start.isEqual(this)&&"toNext"==this.stickiness?this._getCombined(t.splitPosition,t.moveTargetPosition):t.graveyardPosition?this._getTransformedByMove(t.graveyardPosition,t.insertionPosition,1):this._getTransformedByInsertion(t.insertionPosition,1)}_getTransformedByMergeOperation(t){const e=t.movedRange;let n;return e.containsPosition(this)||e.start.isEqual(this)?(n=this._getCombined(t.sourcePosition,t.targetPosition),t.sourcePosition.isBefore(t.targetPosition)&&(n=n._getTransformedByDeletion(t.deletionPosition,1))):n=this.isEqual(t.deletionPosition)?Pi._createAt(t.deletionPosition):this._getTransformedByMove(t.deletionPosition,t.graveyardPosition,1),n}_getTransformedByDeletion(t,e){const n=Pi._createAt(this);if(this.root!=t.root)return n;if("same"==Ee(t.getParentPath(),this.getParentPath())){if(t.offsetthis.offset)return null;n.offset-=e}}else if("prefix"==Ee(t.getParentPath(),this.getParentPath())){const r=t.path.length-1;if(t.offset<=this.path[r]){if(t.offset+e>this.path[r])return null;n.path[r]-=e}}return n}_getTransformedByInsertion(t,e){const n=Pi._createAt(this);if(this.root!=t.root)return n;if("same"==Ee(t.getParentPath(),this.getParentPath()))(t.offsete+1;){const e=r.maxOffset-n.offset;0!==e&&t.push(new Ti(n,n.getShiftedBy(e))),n.path=n.path.slice(0,-1),n.offset++,r=r.parent}for(;n.path.length<=this.end.path.length;){const e=this.end.path[n.path.length-1],r=e-n.offset;0!==r&&t.push(new Ti(n,n.getShiftedBy(r))),n.offset=e,n.path.push(0)}return t}getWalker(t={}){return t.boundaries=this,new Si(t)}*getItems(t={}){t.boundaries=this,t.ignoreElementEnd=!0;const e=new Si(t);for(const n of e)yield n.item}*getPositions(t={}){t.boundaries=this;const e=new Si(t);yield e.position;for(const n of e)yield n.nextPosition}getTransformedByOperation(t){switch(t.type){case"insert":return this._getTransformedByInsertOperation(t);case"move":case"remove":case"reinsert":return this._getTransformedByMoveOperation(t);case"split":return[this._getTransformedBySplitOperation(t)];case"merge":return[this._getTransformedByMergeOperation(t)]}return[new Ti(this.start,this.end)]}getTransformedByOperations(t){const e=[new Ti(this.start,this.end)];for(const n of t)for(let t=0;t0?new this(n,r):new this(r,n)}static _createIn(t){return new this(Pi._createAt(t,0),Pi._createAt(t,t.maxOffset))}static _createOn(t){return this._createFromPositionAndShift(Pi._createBefore(t),t.offsetSize)}static _createFromRanges(t){if(0===t.length)throw new he.b("range-create-from-ranges-empty-array: At least one range has to be passed.");if(1==t.length)return t[0].clone();const e=t[0];t.sort((t,e)=>t.start.isAfter(e.start)?1:-1);const n=t.indexOf(e),r=new this(e.start,e.end);if(n>0)for(let i=n-1;t[i].end.isEqual(r.start);i++)r.start=Pi._createAt(t[i].start);for(let i=n+1;i{if(e.viewPosition)return;const n=this._modelToViewMapping.get(e.modelPosition.parent);e.viewPosition=this._findPositionIn(n,e.modelPosition.offset)},{priority:"low"}),this.on("viewToModelPosition",(t,e)=>{if(e.modelPosition)return;const n=this.findMappedViewAncestor(e.viewPosition),r=this._viewToModelMapping.get(n),i=this._toModelOffset(e.viewPosition.parent,e.viewPosition.offset,n);e.modelPosition=Pi._createAt(r,i)},{priority:"low"})}bindElements(t,e){this._modelToViewMapping.set(t,e),this._viewToModelMapping.set(e,t)}unbindViewElement(t){const e=this.toModelElement(t);this._viewToModelMapping.delete(t),this._modelToViewMapping.get(e)==t&&this._modelToViewMapping.delete(e)}unbindModelElement(t){const e=this.toViewElement(t);this._modelToViewMapping.delete(t),this._viewToModelMapping.get(e)==t&&this._viewToModelMapping.delete(e)}bindElementToMarker(t,e){const n=this._markerNameToElements.get(e)||new Set;n.add(t),this._markerNameToElements.set(e,n)}unbindElementsFromMarkerName(t){this._markerNameToElements.delete(t)}clearBindings(){this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._markerNameToElements=new Map}toModelElement(t){return this._viewToModelMapping.get(t)}toViewElement(t){return this._modelToViewMapping.get(t)}toModelRange(t){return new Ti(this.toModelPosition(t.start),this.toModelPosition(t.end))}toViewRange(t){return new cn(this.toViewPosition(t.start),this.toViewPosition(t.end))}toModelPosition(t){const e={viewPosition:t,mapper:this};return this.fire("viewToModelPosition",e),e.modelPosition}toViewPosition(t,e={isPhantom:!1}){const n={modelPosition:t,mapper:this,isPhantom:e.isPhantom};return this.fire("modelToViewPosition",n),n.viewPosition}markerNameToElements(t){const e=this._markerNameToElements.get(t);if(!e)return null;const n=new Set;for(const r of e)if(r.is("attributeElement"))for(const t of r.getElementsWithSameId())n.add(t);else n.add(r);return n}registerViewToModelLength(t,e){this._viewToModelLengthCallbacks.set(t,e)}findMappedViewAncestor(t){let e=t.parent;for(;!this._viewToModelMapping.has(e);)e=e.parent;return e}_toModelOffset(t,e,n){if(n!=t)return this._toModelOffset(t.parent,t.index,n)+this._toModelOffset(t,e,t);if(t.is("text"))return e;let r=0;for(let i=0;i1?e[0]+":"+e[1]:e[0]}class Di{constructor(t={}){this.conversionApi=Ge({dispatcher:this},t)}convertChanges(t,e){for(const n of t.getMarkersToRemove())this.convertMarkerRemove(n.name,n.range,e);for(const n of t.getChanges())"insert"==n.type?this.convertInsert(Ti._createFromPositionAndShift(n.position,n.length),e):"remove"==n.type?this.convertRemove(n.position,n.length,n.name,e):this.convertAttribute(n.range,n.attributeKey,n.attributeOldValue,n.attributeNewValue,e);for(const n of t.getMarkersToAdd())this.convertMarkerAdd(n.name,n.range,e)}convertInsert(t,e){this.conversionApi.writer=e,this.conversionApi.consumable=this._createInsertConsumable(t);for(const n of t){const t=n.item,e={item:t,range:Ti._createFromPositionAndShift(n.previousPosition,n.length)};this._testAndFire("insert",e);for(const n of t.getAttributeKeys())e.attributeKey=n,e.attributeOldValue=null,e.attributeNewValue=t.getAttribute(n),this._testAndFire(`attribute:${n}`,e)}this._clearConversionApi()}convertRemove(t,e,n,r){this.conversionApi.writer=r,this.fire("remove:"+n,{position:t,length:e},this.conversionApi),this._clearConversionApi()}convertAttribute(t,e,n,r,i){this.conversionApi.writer=i,this.conversionApi.consumable=this._createConsumableForRange(t,`attribute:${e}`);for(const o of t){const t={item:o.item,range:Ti._createFromPositionAndShift(o.previousPosition,o.length),attributeKey:e,attributeOldValue:n,attributeNewValue:r};this._testAndFire(`attribute:${e}`,t)}this._clearConversionApi()}convertSelection(t,e,n){const r=Array.from(e.getMarkersAtPosition(t.getFirstPosition()));if(this.conversionApi.writer=n,this.conversionApi.consumable=this._createSelectionConsumable(t,r),this.fire("selection",{selection:t},this.conversionApi),t.isCollapsed){for(const e of r){const n=e.getRange();if(!ji(t.getFirstPosition(),e,this.conversionApi.mapper))continue;const r={item:t,markerName:e.name,markerRange:n};this.conversionApi.consumable.test(t,"addMarker:"+e.name)&&this.fire("addMarker:"+e.name,r,this.conversionApi)}for(const e of t.getAttributeKeys()){const n={item:t,range:t.getFirstRange(),attributeKey:e,attributeOldValue:null,attributeNewValue:t.getAttribute(e)};this.conversionApi.consumable.test(t,"attribute:"+n.attributeKey)&&this.fire("attribute:"+n.attributeKey+":$text",n,this.conversionApi)}this._clearConversionApi()}}convertMarkerAdd(t,e,n){if(!e.root.document||"$graveyard"==e.root.rootName)return;this.conversionApi.writer=n;const r="addMarker:"+t,i=new Ii;if(i.add(e,r),this.conversionApi.consumable=i,this.fire(r,{markerName:t,markerRange:e},this.conversionApi),i.test(e,r)){this.conversionApi.consumable=this._createConsumableForRange(e,r);for(const n of e.getItems()){if(!this.conversionApi.consumable.test(n,r))continue;const i={item:n,range:Ti._createOn(n),markerName:t,markerRange:e};this.fire(r,i,this.conversionApi)}this._clearConversionApi()}}convertMarkerRemove(t,e,n){e.root.document&&"$graveyard"!=e.root.rootName&&(this.conversionApi.writer=n,this.fire("removeMarker:"+t,{markerName:t,markerRange:e},this.conversionApi),this._clearConversionApi())}_createInsertConsumable(t){const e=new Ii;for(const n of t){const t=n.item;e.add(t,"insert");for(const n of t.getAttributeKeys())e.add(t,"attribute:"+n)}return e}_createConsumableForRange(t,e){const n=new Ii;for(const r of t.getItems())n.add(r,e);return n}_createSelectionConsumable(t,e){const n=new Ii;n.add(t,"selection");for(const r of e)n.add(t,"addMarker:"+r.name);for(const r of t.getAttributeKeys())n.add(t,"attribute:"+r);return n}_testAndFire(t,e){this.conversionApi.consumable.test(e.item,t)&&this.fire(t+":"+(e.item.name||"$text"),e,this.conversionApi)}_clearConversionApi(){delete this.conversionApi.writer,delete this.conversionApi.consumable}}function ji(t,e,n){const r=e.getRange(),i=Array.from(t.getAncestors());return i.shift(),i.reverse(),!i.some(t=>{if(r.containsItem(t))return!!n.toViewElement(t).getCustomProperty("addHighlight")})}Se(Di,be);class Li{constructor(t,e,n){this._lastRangeBackward=!1,this._ranges=[],this._attrs=new Map,t&&this.setTo(t,e,n)}get anchor(){if(this._ranges.length>0){const t=this._ranges[this._ranges.length-1];return this._lastRangeBackward?t.end:t.start}return null}get focus(){if(this._ranges.length>0){const t=this._ranges[this._ranges.length-1];return this._lastRangeBackward?t.start:t.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(t){if(this.rangeCount!=t.rangeCount)return!1;if(0===this.rangeCount)return!0;if(!this.anchor.isEqual(t.anchor)||!this.focus.isEqual(t.focus))return!1;for(const e of this._ranges){let n=!1;for(const r of t._ranges)if(e.isEqual(r)){n=!0;break}if(!n)return!1}return!0}*getRanges(){for(const t of this._ranges)yield new Ti(t.start,t.end)}getFirstRange(){let t=null;for(const e of this._ranges)t&&!e.start.isBefore(t.start)||(t=e);return t?new Ti(t.start,t.end):null}getLastRange(){let t=null;for(const e of this._ranges)t&&!e.end.isAfter(t.end)||(t=e);return t?new Ti(t.start,t.end):null}getFirstPosition(){const t=this.getFirstRange();return t?t.start.clone():null}getLastPosition(){const t=this.getLastRange();return t?t.end.clone():null}setTo(t,e,n){if(null===t)this._setRanges([]);else if(t instanceof Li)this._setRanges(t.getRanges(),t.isBackward);else if(t&&"function"==typeof t.getRanges)this._setRanges(t.getRanges(),t.isBackward);else if(t instanceof Ti)this._setRanges([t],!!e&&!!e.backward);else if(t instanceof Pi)this._setRanges([new Ti(t)]);else if(t instanceof _i){const r=!!n&&!!n.backward;let i;if("in"==e)i=Ti._createIn(t);else if("on"==e)i=Ti._createOn(t);else{if(void 0===e)throw new he.b("model-selection-setTo-required-second-parameter: selection.setTo requires the second parameter when the first parameter is a node.");i=new Ti(Pi._createAt(t,e))}this._setRanges([i],r)}else{if(!Me(t))throw new he.b("model-selection-setTo-not-selectable: Cannot set the selection to the given place.");this._setRanges(t,e&&!!e.backward)}}_setRanges(t,e=!1){const n=(t=Array.from(t)).some(t=>{if(!(t instanceof Ti))throw new he.b("model-selection-set-ranges-not-range: Selection range set to an object that is not an instance of model.Range.");return this._ranges.every(e=>!e.isEqual(t))});if(t.length!==this._ranges.length||n){this._removeAllRanges();for(const e of t)this._pushRange(e);this._lastRangeBackward=!!e,this.fire("change:range",{directChange:!0})}}setFocus(t,e){if(null===this.anchor)throw new he.b("model-selection-setFocus-no-ranges: Cannot set selection focus if there are no ranges in selection.");const n=Pi._createAt(t,e);if("same"==n.compareWith(this.focus))return;const r=this.anchor;this._ranges.length&&this._popRange(),"before"==n.compareWith(r)?(this._pushRange(new Ti(n,r)),this._lastRangeBackward=!0):(this._pushRange(new Ti(r,n)),this._lastRangeBackward=!1),this.fire("change:range",{directChange:!0})}getAttribute(t){return this._attrs.get(t)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}hasAttribute(t){return this._attrs.has(t)}removeAttribute(t){this.hasAttribute(t)&&(this._attrs.delete(t),this.fire("change:attribute",{attributeKeys:[t],directChange:!0}))}setAttribute(t,e){this.getAttribute(t)!==e&&(this._attrs.set(t,e),this.fire("change:attribute",{attributeKeys:[t],directChange:!0}))}getSelectedElement(){if(1!==this.rangeCount)return null;const t=this.getFirstRange(),e=t.start.nodeAfter;return e instanceof Ai&&e==t.end.nodeBefore?e:null}is(t){return"selection"==t}*getSelectedBlocks(){const t=new WeakSet;for(const e of this.getRanges()){const n=Fi(e.start,t);n&&(yield n);for(const i of e.getWalker())"elementEnd"==i.type&&Ri(i.item,t)&&(yield i.item);const r=Fi(e.end,t);r&&!e.end.isTouching(Pi._createAt(r,0))&&(yield r)}}*getTopMostBlocks(){const t=Array.from(this.getSelectedBlocks());for(const e of t){const n=Bi(e);n&&t.includes(n)||(yield e)}}containsEntireContent(t=this.anchor.root){const e=Pi._createAt(t,0),n=Pi._createAt(t,"end");return e.isTouching(this.getFirstPosition())&&n.isTouching(this.getLastPosition())}_pushRange(t){this._checkRange(t),this._ranges.push(new Ti(t.start,t.end))}_checkRange(t){for(let e=0;e0;)this._popRange()}_popRange(){this._ranges.pop()}}function Ri(t,e){return!e.has(t)&&(e.add(t),t.document.model.schema.isBlock(t)&&t.parent)}function Fi(t,e){const n=t.parent.document.model.schema,r=t.parent.getAncestors({parentFirst:!0,includeSelf:!0});let i=!1;const o=r.find(t=>!i&&!(i=n.isLimit(t))&&Ri(t,e));return r.forEach(t=>e.add(t)),o}function Bi(t){const e=t.document.model.schema;let n=t.parent;for(;n;){if(e.isBlock(n))return n;n=n.parent}}Se(Li,be);class Vi extends Ti{constructor(t,e){super(t,e),(function(){this.listenTo(this.root.document.model,"applyOperation",(t,e)=>{const n=e[0];n.isDocumentOperation&&(function(t){const e=this.getTransformedByOperation(t),n=Ti._createFromRanges(e),r=!n.isEqual(this),i=function(t,e){switch(e.type){case"insert":return t.containsPosition(e.position);case"move":case"remove":case"reinsert":case"merge":return t.containsPosition(e.sourcePosition)||t.start.isEqual(e.sourcePosition)||t.containsPosition(e.targetPosition);case"split":return t.containsPosition(e.splitPosition)||t.containsPosition(e.insertionPosition)}return!1}(this,t);let o=null;if(r){"$graveyard"==n.root.rootName&&(o="remove"==t.type?t.sourcePosition:t.deletionPosition);const e=this.toRange();this.start=n.start,this.end=n.end,this.fire("change:range",e,{deletionPosition:o})}else i&&this.fire("change:content",this.toRange(),{deletionPosition:o})}).call(this,n)},{priority:"low"})}).call(this)}detach(){this.stopListening()}toRange(){return new Ti(this.start,this.end)}static fromRange(t){return new Vi(t.start,t.end)}}Se(Vi,be);const qi="selection:";class zi{constructor(t){this._selection=new Ui(t),this._selection.delegate("change:range").to(this),this._selection.delegate("change:attribute").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()}getTopMostBlocks(){return this._selection.getTopMostBlocks()}getSelectedElement(){return this._selection.getSelectedElement()}containsEntireContent(t){return this._selection.containsEntireContent(t)}destroy(){this._selection.destroy()}getAttributeKeys(){return this._selection.getAttributeKeys()}getAttributes(){return this._selection.getAttributes()}getAttribute(t){return this._selection.getAttribute(t)}hasAttribute(t){return this._selection.hasAttribute(t)}refresh(){this._selection._updateMarkers(),this._selection._updateAttributes(!1)}is(t){return"selection"==t||"documentSelection"==t}_setFocus(t,e){this._selection.setFocus(t,e)}_setTo(t,e,n){this._selection.setTo(t,e,n)}_setAttribute(t,e){this._selection.setAttribute(t,e)}_removeAttribute(t){this._selection.removeAttribute(t)}_getStoredAttributes(){return this._selection._getStoredAttributes()}_overrideGravity(){return this._selection.overrideGravity()}_restoreGravity(t){this._selection.restoreGravity(t)}static _getStoreAttributeKey(t){return qi+t}static _isStoreAttributeKey(t){return t.startsWith(qi)}}Se(zi,be);class Ui extends Li{constructor(t){super(),this.markers=new gn({idProperty:"name"}),this._model=t.model,this._document=t,this._attributePriority=new Map,this._fixGraveyardRangesData=[],this._hasChangedRange=!1,this._overriddenGravityRegister=new Set,this.listenTo(this._model,"applyOperation",(t,e)=>{const n=e[0];if(n.isDocumentOperation&&"marker"!=n.type&&"rename"!=n.type&&"noop"!=n.type){for(;this._fixGraveyardRangesData.length;){const{liveRange:t,sourcePosition:e}=this._fixGraveyardRangesData.shift();this._fixGraveyardSelection(t,e)}this._hasChangedRange&&(this._hasChangedRange=!1,this.fire("change:range",{directChange:!1}))}},{priority:"lowest"}),this.on("change:range",()=>{for(const t of this.getRanges())if(!this._document._validateSelectionRange(t))throw new he.b("document-selection-wrong-position: Range from document selection starts or ends at incorrect position.",{range:t})}),this.listenTo(this._model.markers,"update",()=>this._updateMarkers()),this.listenTo(this._document,"change",(t,e)=>{!function(t,e){const n=t.document.differ;for(const r of n.getChanges()){if("insert"!=r.type)continue;const n=r.position.parent;r.length===n.maxOffset&&t.enqueueChange(e,t=>{const e=Array.from(n.getAttributeKeys()).filter(t=>t.startsWith(qi));for(const r of e)t.removeAttribute(r,n)})}}(this._model,e)})}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 t=0;t{this._hasChangedRange=!0,e.root==this._document.graveyard&&this._fixGraveyardRangesData.push({liveRange:e,sourcePosition:r.deletionPosition})}),e}_updateMarkers(){const t=[];for(const e of this._model.markers){const n=e.getRange();for(const r of this.getRanges())n.containsRange(r,!r.isCollapsed)&&t.push(e)}for(const e of t)this.markers.has(e)||this.markers.add(e);for(const e of Array.from(this.markers))t.includes(e)||this.markers.remove(e)}_updateAttributes(t){const e=wi(this._getSurroundingAttributes()),n=wi(this.getAttributes());if(t)this._attributePriority=new Map,this._attrs=new Map;else for(const[i,o]of this._attributePriority)"low"==o&&(this._attrs.delete(i),this._attributePriority.delete(i));this._setAttributesTo(e);const r=[];for(const[i,o]of this.getAttributes())n.has(i)&&n.get(i)===o||r.push(i);for(const[i]of n)this.hasAttribute(i)||r.push(i);r.length>0&&this.fire("change:attribute",{attributeKeys:r,directChange:!1})}_setAttribute(t,e,n=!0){const r=n?"normal":"low";return("low"!=r||"normal"!=this._attributePriority.get(t))&&super.getAttribute(t)!==e&&(this._attrs.set(t,e),this._attributePriority.set(t,r),!0)}_removeAttribute(t,e=!0){const n=e?"normal":"low";return!("low"==n&&"normal"==this._attributePriority.get(t)||(this._attributePriority.set(t,n),!super.hasAttribute(t)||(this._attrs.delete(t),0)))}_setAttributesTo(t){const e=new Set;for(const[n,r]of this.getAttributes())t.get(n)!==r&&this._removeAttribute(n,!1);for(const[n,r]of t)this._setAttribute(n,r,!1)&&e.add(n);return e}*_getStoredAttributes(){const t=this.getFirstPosition().parent;if(this.isCollapsed&&t.isEmpty)for(const e of t.getAttributeKeys())e.startsWith(qi)&&(yield[e.substr(qi.length),t.getAttribute(e)])}_getSurroundingAttributes(){const t=this.getFirstPosition(),e=this._model.schema;let n=null;if(this.isCollapsed){const e=t.textNode?t.textNode:t.nodeBefore,r=t.textNode?t.textNode:t.nodeAfter;if(this.isGravityOverridden||(n=Hi(e)),n||(n=Hi(r)),!this.isGravityOverridden&&!n){let t=e;for(;t&&!n;)n=Hi(t=t.previousSibling)}if(!n){let t=r;for(;t&&!n;)n=Hi(t=t.nextSibling)}n||(n=this._getStoredAttributes())}else{const t=this.getFirstRange();for(const r of t){if(r.item.is("element")&&e.isObject(r.item))break;if("text"==r.type){n=r.item.getAttributes();break}}}return n}_fixGraveyardSelection(t,e){const n=e.clone(),r=this._model.schema.getNearestSelectionRange(n),i=this._ranges.indexOf(t);if(this._ranges.splice(i,1),t.detach(),r){const t=this._prepareRange(r);this._ranges.splice(i,0,t)}}}function Hi(t){return t instanceof xi||t instanceof ki?t.getAttributes():null}class Wi{constructor(t){this._dispatchers=t}add(t){for(const e of this._dispatchers)t(e);return this}}var Gi=function(t){return ae(t,5)};class Yi extends Wi{elementToElement(t){return this.add(function(t){return(t=Gi(t)).view=$i(t.view,"container"),e=>{e.on("insert:"+t.model,function(t){return(e,n,r)=>{const i=t(n.item,r.writer);if(!i)return;if(!r.consumable.consume(n.item,"insert"))return;const o=r.mapper.toViewPosition(n.range.start);r.mapper.bindElements(n.item,i),r.writer.insert(o,i)}}(t.view),{priority:t.converterPriority||"normal"})}}(t))}attributeToElement(t){return this.add(function(t){let e="attribute:"+((t=Gi(t)).model.key?t.model.key:t.model);if(t.model.name&&(e+=":"+t.model.name),t.model.values)for(const r of t.model.values)t.view[r]=$i(t.view[r],"attribute");else t.view=$i(t.view,"attribute");const n=Zi(t);return r=>{r.on(e,function(t){return(e,n,r)=>{const i=t(n.attributeOldValue,r.writer),o=t(n.attributeNewValue,r.writer);if(!i&&!o)return;if(!r.consumable.consume(n.item,e.name))return;const s=r.writer;if(n.item instanceof Li||n.item instanceof zi)s.wrap(s.document.selection.getFirstRange(),o);else{let t=r.mapper.toViewRange(n.range);null!==n.attributeOldValue&&i&&(t=s.unwrap(t,i)),null!==n.attributeNewValue&&o&&s.wrap(t,o)}}}(n),{priority:t.converterPriority||"normal"})}}(t))}attributeToAttribute(t){return this.add(function(t){let e="attribute:"+((t=Gi(t)).model.key?t.model.key:t.model);if(t.model.name&&(e+=":"+t.model.name),t.model.values)for(const r of t.model.values)t.view[r]=Qi(t.view[r]);else t.view=Qi(t.view);const n=Zi(t);return r=>{r.on(e,function(t){return(e,n,r)=>{const i=t(n.attributeOldValue,n),o=t(n.attributeNewValue,n);if(!i&&!o)return;if(!r.consumable.consume(n.item,e.name))return;const s=r.mapper.toViewElement(n.item),a=r.writer;if(s){if(null!==n.attributeOldValue&&i)if("class"==i.key){const t=Array.isArray(i.value)?i.value:[i.value];for(const e of t)a.removeClass(e,s)}else if("style"==i.key){const t=Object.keys(i.value);for(const e of t)a.removeStyle(e,s)}else a.removeAttribute(i.key,s);if(null!==n.attributeNewValue&&o)if("class"==o.key){const t=Array.isArray(o.value)?o.value:[o.value];for(const e of t)a.addClass(e,s)}else if("style"==o.key){const t=Object.keys(o.value);for(const e of t)a.setStyle(e,o.value[e],s)}else a.setAttribute(o.key,o.value,s)}else Xr.a.warn("conversion-attribute-to-attribute-on-text: Trying to convert text node's attribute with attribute-to-attribute converter.")}}(n),{priority:t.converterPriority||"normal"})}}(t))}markerToElement(t){return this.add(function(t){return(t=Gi(t)).view=$i(t.view,"ui"),e=>{e.on("addMarker:"+t.model,function(t){return(e,n,r)=>{n.isOpening=!0;const i=t(n,r.writer);n.isOpening=!1;const o=t(n,r.writer);if(!i||!o)return;const s=n.markerRange;if(s.isCollapsed&&!r.consumable.consume(s,e.name))return;for(const t of s)if(!r.consumable.consume(t.item,e.name))return;const a=r.mapper,l=r.writer;l.insert(a.toViewPosition(s.start),i),r.mapper.bindElementToMarker(i,n.markerName),s.isCollapsed||(l.insert(a.toViewPosition(s.end),o),r.mapper.bindElementToMarker(o,n.markerName)),e.stop()}}(t.view),{priority:t.converterPriority||"normal"}),e.on("removeMarker:"+t.model,(t,e,n)=>{const r=n.mapper.markerNameToElements(e.markerName);if(r){n.mapper.unbindElementsFromMarkerName(e.markerName);for(const t of r)n.writer.clear(n.writer.createRangeOn(t),t);n.writer.clearClonedElementsGroup(e.markerName),t.stop()}},{priority:t.converterPriority||"normal"})}}(t))}markerToHighlight(t){return this.add(function(t){return e=>{e.on("addMarker:"+t.model,function(t){return(e,n,r)=>{if(!n.item)return;if(!(n.item instanceof Li||n.item instanceof zi||n.item.is("textProxy")))return;const i=Ji(t,n,r);if(!i)return;if(!r.consumable.consume(n.item,e.name))return;const o=Ki(i),s=r.writer,a=s.document.selection;if(n.item instanceof Li||n.item instanceof zi)s.wrap(a.getFirstRange(),o,a);else{const t=r.mapper.toViewRange(n.range),e=s.wrap(t,o);for(const i of e.getItems())if(i.is("attributeElement")&&i.isSimilar(o)){r.mapper.bindElementToMarker(i,n.markerName);break}}}}(t.view),{priority:t.converterPriority||"normal"}),e.on("addMarker:"+t.model,function(t){return(e,n,r)=>{if(!n.item)return;if(!(n.item instanceof Ai))return;const i=Ji(t,n,r);if(!i)return;if(!r.consumable.test(n.item,e.name))return;const o=r.mapper.toViewElement(n.item);if(o&&o.getCustomProperty("addHighlight")){r.consumable.consume(n.item,e.name);for(const t of Ti._createIn(n.item))r.consumable.consume(t.item,e.name);o.getCustomProperty("addHighlight")(o,i,r.writer),r.mapper.bindElementToMarker(o,n.markerName)}}}(t.view),{priority:t.converterPriority||"normal"}),e.on("removeMarker:"+t.model,function(t){return(e,n,r)=>{if(n.markerRange.isCollapsed)return;const i=Ji(t,n,r);if(!i)return;const o=Ki(i),s=r.mapper.markerNameToElements(n.markerName);if(s){r.mapper.unbindElementsFromMarkerName(n.markerName);for(const t of s)t.is("attributeElement")?r.writer.unwrap(r.writer.createRangeOn(t),o):t.getCustomProperty("removeHighlight")(t,i.id,r.writer);r.writer.clearClonedElementsGroup(n.markerName),e.stop()}}}(t.view),{priority:t.converterPriority||"normal"})}}(t))}}function Ki(t){const e=new yn("span",t.attributes);return t.classes&&e._addClass(t.classes),t.priority&&(e._priority=t.priority),e._id=t.id,e}function $i(t,e){return"function"==typeof t?t:(n,r)=>(function(t,e,n){let r;"string"==typeof t&&(t={name:t});const i=Object.assign({},t.attributes);if(r="container"==n?e.createContainerElement(t.name,i):"attribute"==n?e.createAttributeElement(t.name,i,{priority:t.priority||yn.DEFAULT_PRIORITY}):e.createUIElement(t.name,i),t.styles){const n=Object.keys(t.styles);for(const i of n)e.setStyle(i,t.styles[i],r)}if(t.classes){const n=t.classes;if("string"==typeof n)e.addClass(n,r);else for(const t of n)e.addClass(t,r)}return r})(t,r,e)}function Zi(t){return t.model.values?(e,n)=>{const r=t.view[e];return r?r(e,n):null}:t.view}function Qi(t){return"string"==typeof t?e=>({key:t,value:e}):"object"==typeof t?t.value?()=>t:e=>({key:t.key,value:e}):t}function Ji(t,e,n){const r="function"==typeof t?t(e,n):t;return r?(r.priority||(r.priority=10),r.id||(r.id=e.markerName),r):null}class Xi extends Wi{elementToElement(t){return this.add(to(t))}elementToAttribute(t){return this.add(function(t){no(t=Gi(t));const e=ro(t,!1),n=eo(t),r=n?"element:"+n:"element";return n=>{n.on(r,e,{priority:t.converterPriority||"low"})}}(t))}attributeToAttribute(t){return this.add(function(t){let e=null;("string"==typeof(t=Gi(t)).view||t.view.key)&&(e=function(t){"string"==typeof t.view&&(t.view={key:t.view});const e=t.view.key;let n;return n="class"==e||"style"==e?{["class"==e?"classes":"styles"]:t.view.value}:{attributes:{[e]:void 0===t.view.value?/[\s\S]*/:t.view.value}},t.view.name&&(n.name=t.view.name),t.view=n,e}(t)),no(t,e);const n=ro(t,!0);return e=>{e.on("element",n,{priority:t.converterPriority||"low"})}}(t))}elementToMarker(t){return this.add(function(t){return function(t){const e=t.model;t.model=((t,n)=>{const r="string"==typeof e?e:e(t);return n.createElement("$marker",{"data-name":r})})}(t=Gi(t)),to(t)}(t))}}function to(t){const e=function(t){const e=t.view?new De(t.view):null;return(n,r,i)=>{let o={};if(e){const t=e.match(r.viewItem);if(!t)return;o=t.match}o.name=!0;const s=function(t,e,n){return t instanceof Function?t(r.viewItem,n):n.createElement(t)}(t.model,0,i.writer);if(!s)return;if(!i.consumable.test(r.viewItem,o))return;const a=i.splitToAllowedParent(s,r.modelCursor);if(!a)return;i.writer.insert(s,a.position),i.convertChildren(r.viewItem,i.writer.createPositionAt(s,0)),i.consumable.consume(r.viewItem,o);const l=i.getSplitParts(s);r.modelRange=new Ti(i.writer.createPositionBefore(s),i.writer.createPositionAfter(l[l.length-1])),r.modelCursor=a.cursorParent?i.writer.createPositionAt(a.cursorParent,0):r.modelRange.end}}(t=Gi(t)),n=eo(t),r=n?"element:"+n:"element";return n=>{n.on(r,e,{priority:t.converterPriority||"normal"})}}function eo(t){return"string"==typeof t.view?t.view:"object"==typeof t.view&&"string"==typeof t.view.name?t.view.name:null}function no(t,e=null){const n=null===e||(t=>t.getAttribute(e));t.model={key:"object"!=typeof t.model?t.model:t.model.key,value:"object"!=typeof t.model||void 0===t.model.value?n:t.model.value}}function ro(t,e){const n=new De(t.view);return(r,i,o)=>{const s=n.match(i.viewItem);if(!s)return;const a=t.model.key,l="function"==typeof t.model.value?t.model.value(i.viewItem):t.model.value;null!==l&&(function(t){return!("object"==typeof t.view&&!eo(t)||t.view.classes||t.view.attributes||t.view.styles)}(t)?s.match.name=!0:delete s.match.name,o.consumable.test(i.viewItem,s.match)&&(i.modelRange||(i=Object.assign(i,o.convertChildren(i.viewItem,i.modelCursor))),function(t,e,n,r){let i=!1;for(const o of Array.from(t.getItems({shallow:n})))r.schema.checkAttribute(o,e.key)&&(r.writer.setAttribute(e.key,e.value,o),i=!0);return i}(i.modelRange,{key:a,value:l},e,o)&&o.consumable.consume(i.viewItem,s.match)))}}class io{constructor(t){this.model=t,this.view=new bi,this.mapper=new Ni,this.downcastDispatcher=new Di({mapper:this.mapper});const e=this.model.document,n=e.selection,r=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(e,"change",()=>{this.view.change(t=>{this.downcastDispatcher.convertChanges(e.differ,t),this.downcastDispatcher.convertSelection(n,r,t)})},{priority:"low"}),this.listenTo(this.view.document,"selectionChange",function(t,e){return(n,r)=>{const i=r.newSelection,o=new Li,s=[];for(const t of i.getRanges())s.push(e.toModelRange(t));o.setTo(s,{backward:i.isBackward}),o.isEqual(t.document.selection)||t.change(t=>{t.setSelection(o)})}}(this.model,this.mapper)),this.downcastDispatcher.on("insert:$text",(t,e,n)=>{if(!n.consumable.consume(e.item,"insert"))return;const r=n.writer,i=n.mapper.toViewPosition(e.range.start),o=r.createText(e.item.data);r.insert(i,o)},{priority:"lowest"}),this.downcastDispatcher.on("remove",(t,e,n)=>{const r=n.mapper.toViewPosition(e.position),i=e.position.getShiftedBy(e.length),o=n.mapper.toViewPosition(i,{isPhantom:!0}),s=n.writer.createRange(r,o),a=n.writer.remove(s.getTrimmed());for(const l of n.writer.createRangeIn(a).getItems())n.mapper.unbindViewElement(l)},{priority:"low"}),this.downcastDispatcher.on("selection",(t,e,n)=>{const r=n.writer,i=r.document.selection;for(const o of i.getRanges())o.isCollapsed&&o.end.parent.document&&n.writer.mergeAttributes(o.start);r.setSelection(null)},{priority:"low"}),this.downcastDispatcher.on("selection",(t,e,n)=>{const r=e.selection;if(r.isCollapsed)return;if(!n.consumable.consume(r,"selection"))return;const i=[];for(const o of r.getRanges()){const t=n.mapper.toViewRange(o);i.push(t)}n.writer.setSelection(i,{backward:r.isBackward})},{priority:"low"}),this.downcastDispatcher.on("selection",(t,e,n)=>{const r=e.selection;if(!r.isCollapsed)return;if(!n.consumable.consume(r,"selection"))return;const i=n.writer,o=r.getFirstPosition(),s=n.mapper.toViewPosition(o),a=i.breakAttributes(s);i.setSelection(a)},{priority:"low"}),this.view.document.roots.bindTo(this.model.document.roots).using(t=>{if("$graveyard"==t.rootName)return null;const e=new an(t.name);return e.rootName=t.rootName,e._document=this.view.document,this.mapper.bindElements(t,e),e})}destroy(){this.view.destroy(),this.stopListening()}}Se(io,Qe);class oo{constructor(t,e=[]){this._editor=t,this._availablePlugins=new Map,this._plugins=new Map;for(const n of e)this._availablePlugins.set(n,n),n.pluginName&&this._availablePlugins.set(n.pluginName,n)}*[Symbol.iterator](){for(const t of this._plugins)"function"==typeof t[0]&&(yield t)}get(t){const e=this._plugins.get(t);if(!e){let e=t;throw"function"==typeof t&&(e=t.pluginName||t.name),new he.b("plugincollection-plugin-not-loaded: The requested plugin is not loaded.",{plugin:e})}return e}has(t){return this._plugins.has(t)}init(t,e=[]){const n=this,r=this._editor,i=new Set,o=[],s=d(t),a=d(e),l=function(t){const e=[];for(const n of t)c(n)||e.push(n);return e.length?e:null}(t);if(l){const t="plugincollection-plugin-not-found: Some plugins are not available and could not be loaded.";return Xr.a.error(t,{plugins:l}),Promise.reject(new he.b(t,{plugins:l}))}return Promise.all(s.map(function t(s){if(!a.includes(s)&&!n._plugins.has(s)&&!i.has(s))return function(s){return new Promise(a=>{i.add(s),s.requires&&s.requires.forEach(n=>{const r=c(n);if(e.includes(r))throw new he.b("plugincollection-required: Cannot load a plugin because one of its dependencies is listed inthe `removePlugins` option.",{plugin:r,requiredBy:s});t(r)});const l=new s(r);n._add(s,l),o.push(l),a()})}(s).catch(t=>{throw Xr.a.error("plugincollection-load: It was not possible to load the plugin.",{plugin:s}),t})})).then(()=>u(o,"init")).then(()=>u(o,"afterInit")).then(()=>o);function u(t,e){return t.reduce((t,n)=>n[e]?t.then(n[e].bind(n)):t,Promise.resolve())}function c(t){return"function"==typeof t?t:n._availablePlugins.get(t)}function d(t){return t.map(t=>c(t)).filter(t=>!!t)}}destroy(){const t=Array.from(this).map(([,t])=>t).filter(t=>"function"==typeof t.destroy).map(t=>t.destroy());return Promise.all(t)}_add(t,e){this._plugins.set(t,e);const n=t.pluginName;n&&(this._plugins.has(n)?Xr.a.warn("plugincollection-plugin-name-conflict: Two plugins with the same name were loaded.",{pluginName:n,plugin1:this._plugins.get(n).constructor,plugin2:t}):this._plugins.set(n,e))}}Se(oo,be);class so{constructor(){this._commands=new Map}add(t,e){this._commands.set(t,e)}get(t){return this._commands.get(t)}execute(t,...e){const n=this.get(t);if(!n)throw new he.b("commandcollection-command-not-found: Command does not exist.",{commandName:t});n.execute(...e)}*names(){yield*this._commands.keys()}*commands(){yield*this._commands.values()}[Symbol.iterator](){return this._commands[Symbol.iterator]()}destroy(){for(const t of this.commands())t.destroy()}}window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={});class ao{constructor(t){this.language=t||"en",this.t=((...t)=>this._t(...t))}_t(t,e){let n=function(t,e){const n=Object.keys(window.CKEDITOR_TRANSLATIONS).length;return 1===n&&(t=Object.keys(window.CKEDITOR_TRANSLATIONS)[0]),0!==n&&function(t,e){return t in window.CKEDITOR_TRANSLATIONS&&e in window.CKEDITOR_TRANSLATIONS[t]}(t,e)?window.CKEDITOR_TRANSLATIONS[t][e].replace(/ \[context: [^\]]+\]$/,""):e.replace(/ \[context: [^\]]+\]$/,"")}(this.language,t);return e&&(n=n.replace(/%(\d+)/g,(t,n)=>n{e[0]=new ho(e[0])},{priority:"highest"}),this.on("checkChild",(t,e)=>{e[0]=new ho(e[0]),e[1]=this.getDefinition(e[1])},{priority:"highest"})}register(t,e){if(this._sourceDefinitions[t])throw new he.b("schema-cannot-register-item-twice: A single item cannot be registered twice in the schema.",{itemName:t});this._sourceDefinitions[t]=[Object.assign({},e)],this._clearCache()}extend(t,e){if(!this._sourceDefinitions[t])throw new he.b("schema-cannot-extend-missing-item: Cannot extend an item which was not registered yet.",{itemName:t});this._sourceDefinitions[t].push(Object.assign({},e)),this._clearCache()}getDefinitions(){return this._compiledDefinitions||this._compile(),this._compiledDefinitions}getDefinition(t){let e;return e="string"==typeof t?t:t.is&&(t.is("text")||t.is("textProxy"))?"$text":t.name,this.getDefinitions()[e]}isRegistered(t){return!!this.getDefinition(t)}isBlock(t){const e=this.getDefinition(t);return!(!e||!e.isBlock)}isLimit(t){const e=this.getDefinition(t);return!(!e||!e.isLimit&&!e.isObject)}isObject(t){const e=this.getDefinition(t);return!(!e||!e.isObject)}isInline(t){const e=this.getDefinition(t);return!(!e||!e.isInline)}checkChild(t,e){return!!e&&this._checkContextMatch(e,t)}checkAttribute(t,e){const n=this.getDefinition(t.last);return!!n&&n.allowAttributes.includes(e)}checkMerge(t,e=null){if(t instanceof Pi){const e=t.nodeBefore,n=t.nodeAfter;if(!(e instanceof Ai))throw new he.b("schema-check-merge-no-element-before: The node before the merge position must be an element.");if(!(n instanceof Ai))throw new he.b("schema-check-merge-no-element-after: The node after the merge position must be an element.");return this.checkMerge(e,n)}for(const n of e.getChildren())if(!this.checkChild(t,n))return!1;return!0}addChildCheck(t){this.on("checkChild",(e,[n,r])=>{if(!r)return;const i=t(n,r);"boolean"==typeof i&&(e.stop(),e.return=i)},{priority:"high"})}addAttributeCheck(t){this.on("checkAttribute",(e,[n,r])=>{const i=t(n,r);"boolean"==typeof i&&(e.stop(),e.return=i)},{priority:"high"})}setAttributeProperties(t,e){this._attributeProperties[t]=Object.assign(this.getAttributeProperties(t),e)}getAttributeProperties(t){return this._attributeProperties[t]||{}}getLimitElement(t){let e;for(e=t instanceof Pi?t.parent:(t instanceof Ti?[t]:Array.from(t.getRanges())).reduce((t,e)=>{const n=e.getCommonAncestor();return t?t.getCommonAncestor(n,{includeSelf:!0}):n},null);!this.isLimit(e)&&e.parent;)e=e.parent;return e}checkAttributeInSelection(t,e){if(t.isCollapsed){const n=[...t.getFirstPosition().getAncestors(),new ki("",t.getAttributes())];return this.checkAttribute(n,e)}{const n=t.getRanges();for(const t of n)for(const n of t)if(this.checkAttribute(n.item,e))return!0}return!1}*getValidRanges(t,e){t=function*(t){for(const e of t)yield*e.getMinimalFlatRanges()}(t);for(const n of t)yield*this._getValidRangesForRange(n,e)}getNearestSelectionRange(t,e="both"){if(this.checkChild(t,"$text"))return new Ti(t);let n,r;"both"!=e&&"backward"!=e||(n=new Si({startPosition:t,direction:"backward"})),"both"!=e&&"forward"!=e||(r=new Si({startPosition:t}));for(const i of function*(t,e){let n=!1;for(;!n;){if(n=!0,t){const e=t.next();e.done||(n=!1,yield{walker:t,value:e.value})}if(e){const t=e.next();t.done||(n=!1,yield{walker:e,value:t.value})}}}(n,r)){const t=i.value;if(t.type==(i.walker==n?"elementEnd":"elementStart")&&this.isObject(t.item))return Ti._createOn(t.item);if(this.checkChild(t.nextPosition,"$text"))return new Ti(t.nextPosition)}return null}findAllowedParent(t,e){let n=t.parent;for(;n;){if(this.checkChild(n,e))return n;if(this.isLimit(n))return null;n=n.parent}return null}removeDisallowedAttributes(t,e){for(const n of t){for(const t of n.getAttributeKeys())this.checkAttribute(n,t)||e.removeAttribute(t,n);n.is("element")&&this.removeDisallowedAttributes(n.getChildren(),e)}}createContext(t){return new ho(t)}_clearCache(){this._compiledDefinitions=null}_compile(){const t={},e=this._sourceDefinitions,n=Object.keys(e);for(const r of n)t[r]=fo(e[r],r);for(const r of n)po(t,r);for(const r of n)go(t,r);for(const r of n)mo(t,r),vo(t,r);for(const r of n)yo(t,r),bo(t,r);this._compiledDefinitions=t}_checkContextMatch(t,e,n=e.length-1){const r=e.getItem(n);if(t.allowIn.includes(r.name)){if(0==n)return!0;{const t=this.getDefinition(r);return this._checkContextMatch(t,e,n-1)}}return!1}*_getValidRangesForRange(t,e){let n=t.start,r=t.start;for(const i of t.getItems({shallow:!0}))i.is("element")&&(yield*this._getValidRangesForRange(Ti._createIn(i),e)),this.checkAttribute(i,e)||(n.isEqual(r)||(yield new Ti(n,r)),n=Pi._createAfter(i)),r=Pi._createAfter(i);n.isEqual(r)||(yield new Ti(n,r))}}Se(co,Qe);class ho{constructor(t){if(t instanceof ho)return t;"string"==typeof t?t=[t]:Array.isArray(t)||(t=t.getAncestors({includeSelf:!0})),t[0]&&"string"!=typeof t[0]&&t[0].is("documentFragment")&&t.shift(),this._items=t.map(ko)}get length(){return this._items.length}get last(){return this._items[this._items.length-1]}[Symbol.iterator](){return this._items[Symbol.iterator]()}push(t){const e=new ho([t]);return e._items=[...this._items,...e._items],e}getItem(t){return this._items[t]}*getNames(){yield*this._items.map(t=>t.name)}endsWith(t){return Array.from(this.getNames()).join(" ").endsWith(t)}}function fo(t,e){const n={name:e,allowIn:[],allowContentOf:[],allowWhere:[],allowAttributes:[],allowAttributesOf:[],inheritTypesFrom:[]};return function(t,e){for(const n of t){const t=Object.keys(n).filter(t=>t.startsWith("is"));for(const r of t)e[r]=n[r]}}(t,n),wo(t,n,"allowIn"),wo(t,n,"allowContentOf"),wo(t,n,"allowWhere"),wo(t,n,"allowAttributes"),wo(t,n,"allowAttributesOf"),wo(t,n,"inheritTypesFrom"),function(t,e){for(const n of t){const t=n.inheritAllFrom;t&&(e.allowContentOf.push(t),e.allowWhere.push(t),e.allowAttributesOf.push(t),e.inheritTypesFrom.push(t))}}(t,n),n}function po(t,e){for(const n of t[e].allowContentOf)t[n]&&_o(t,n).forEach(t=>{t.allowIn.push(e)});delete t[e].allowContentOf}function go(t,e){for(const n of t[e].allowWhere){const r=t[n];r&&t[e].allowIn.push(...r.allowIn)}delete t[e].allowWhere}function mo(t,e){for(const n of t[e].allowAttributesOf){const r=t[n];r&&t[e].allowAttributes.push(...r.allowAttributes)}delete t[e].allowAttributesOf}function vo(t,e){const n=t[e];for(const r of n.inheritTypesFrom){const e=t[r];if(e){const t=Object.keys(e).filter(t=>t.startsWith("is"));for(const r of t)r in n||(n[r]=e[r])}}delete n.inheritTypesFrom}function yo(t,e){const n=t[e],r=n.allowIn.filter(e=>t[e]);n.allowIn=Array.from(new Set(r))}function bo(t,e){const n=t[e];n.allowAttributes=Array.from(new Set(n.allowAttributes))}function wo(t,e,n){for(const r of t)"string"==typeof r[n]?e[n].push(r[n]):Array.isArray(r[n])&&e[n].push(...r[n])}function _o(t,e){const n=t[e];return function(t){return Object.keys(t).map(e=>t[e])}(t).filter(t=>t.allowIn.includes(n.name))}function ko(t){return"string"==typeof t?{name:t,*getAttributeKeys(){},getAttribute(){}}:{name:t.is("element")?t.name:"$text",*getAttributeKeys(){yield*t.getAttributeKeys()},getAttribute:e=>t.getAttribute(e)}}class xo{constructor(t={}){this._splitParts=new Map,this._modelCursor=null,this.conversionApi=Object.assign({},t),this.conversionApi.convertItem=this._convertItem.bind(this),this.conversionApi.convertChildren=this._convertChildren.bind(this),this.conversionApi.splitToAllowedParent=this._splitToAllowedParent.bind(this),this.conversionApi.getSplitParts=this._getSplitParts.bind(this)}convert(t,e,n=["$root"]){this.fire("viewCleanup",t),this._modelCursor=function(t,e){let n;for(const r of new ho(t)){const t={};for(const e of r.getAttributeKeys())t[e]=r.getAttribute(e);const i=e.createElement(r.name,t);n&&e.append(i,n),n=Pi._createAt(i,0)}return n}(n,e),this.conversionApi.writer=e,this.conversionApi.consumable=lo.createFrom(t),this.conversionApi.store={};const{modelRange:r}=this._convertItem(t,this._modelCursor),i=e.createDocumentFragment();if(r){this._removeEmptyElements();for(const t of Array.from(this._modelCursor.parent.getChildren()))e.append(t,i);i.markers=function(t,e){const n=new Set,r=new Map,i=Ti._createIn(t).getItems();for(const o of i)"$marker"==o.name&&n.add(o);for(const o of n){const t=o.getAttribute("data-name"),n=e.createPositionBefore(o);r.has(t)?r.get(t).end=n.clone():r.set(t,new Ti(n.clone())),e.remove(o)}return r}(i,e)}return this._modelCursor=null,this._splitParts.clear(),this.conversionApi.writer=null,this.conversionApi.store=null,i}_convertItem(t,e){const n=Object.assign({viewItem:t,modelCursor:e,modelRange:null});if(t.is("element")?this.fire("element:"+t.name,n,this.conversionApi):t.is("text")?this.fire("text",n,this.conversionApi):this.fire("documentFragment",n,this.conversionApi),n.modelRange&&!(n.modelRange instanceof Ti))throw new he.b("view-conversion-dispatcher-incorrect-result: Incorrect conversion result was dropped.");return{modelRange:n.modelRange,modelCursor:n.modelCursor}}_convertChildren(t,e){const n=new Ti(e);let r=e;for(const i of Array.from(t.getChildren())){const t=this._convertItem(i,r);t.modelRange instanceof Ti&&(n.end=t.modelRange.end,r=t.modelCursor)}return{modelRange:n,modelCursor:r}}_splitToAllowedParent(t,e){const n=this.conversionApi.schema.findAllowedParent(e,t);if(!n)return null;if(n===e.parent)return{position:e};if(this._modelCursor.parent.getAncestors().includes(n))return null;const r=this.conversionApi.writer.split(e,n),i=[];for(const o of r.range.getWalker())if("elementEnd"==o.type)i.push(o.item);else{const t=i.pop();this._registerSplitPair(t,o.item)}return{position:r.position,cursorParent:r.range.end.parent}}_registerSplitPair(t,e){this._splitParts.has(t)||this._splitParts.set(t,[t]);const n=this._splitParts.get(t);this._splitParts.set(e,n),n.push(e)}_getSplitParts(t){return this._splitParts.has(t)?this._splitParts.get(t):[t]}_removeEmptyElements(){let t=!1;for(const e of this._splitParts.keys())e.isEmpty&&(this.conversionApi.writer.remove(e),this._splitParts.delete(e),t=!0);t&&this._removeEmptyElements()}}Se(xo,be);class Co{constructor(t,e){this.model=t,this.processor=e,this.mapper=new Ni,this.downcastDispatcher=new Di({mapper:this.mapper}),this.downcastDispatcher.on("insert:$text",(t,e,n)=>{if(!n.consumable.consume(e.item,"insert"))return;const r=n.writer,i=n.mapper.toViewPosition(e.range.start),o=r.createText(e.item.data);r.insert(i,o)},{priority:"lowest"}),this.upcastDispatcher=new xo({schema:t.schema}),this.upcastDispatcher.on("text",(t,e,n)=>{if(n.schema.checkChild(e.modelCursor,"$text")&&n.consumable.consume(e.viewItem)){const t=n.writer.createText(e.viewItem.data);n.writer.insert(t,e.modelCursor),e.modelRange=Ti._createFromPositionAndShift(e.modelCursor,t.offsetSize),e.modelCursor=e.modelRange.end}},{priority:"lowest"}),this.upcastDispatcher.on("element",(t,e,n)=>{if(!e.modelRange&&n.consumable.consume(e.viewItem,{name:!0})){const{modelRange:t,modelCursor:r}=n.convertChildren(e.viewItem,e.modelCursor);e.modelRange=t,e.modelCursor=r}},{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",(t,e,n)=>{if(!e.modelRange&&n.consumable.consume(e.viewItem,{name:!0})){const{modelRange:t,modelCursor:r}=n.convertChildren(e.viewItem,e.modelCursor);e.modelRange=t,e.modelCursor=r}},{priority:"lowest"}),this.decorate("init"),this.on("init",()=>{this.fire("ready")},{priority:"lowest"})}get(t){const{rootName:e="main",trim:n="empty"}=t||{};if(!this._checkIfRootsExists([e]))throw new he.b("datacontroller-get-non-existent-root: Attempting to get data from a non-existing root.");const r=this.model.document.getRoot(e);return"empty"!==n||this.model.hasContent(r,{ignoreWhitespaces:!0})?this.stringify(r):""}stringify(t){const e=this.toView(t);return this.processor.toData(e)}toView(t){this.mapper.clearBindings();const e=Ti._createIn(t),n=new Mn,r=new Dn(new mn);if(this.mapper.bindElements(t,n),this.downcastDispatcher.convertInsert(e,r),!t.is("documentFragment")){const e=function(t){const e=[],n=t.root.document;if(!n)return[];const r=Ti._createIn(t);for(const i of n.model.markers){const t=r.getIntersection(i.getRange());t&&e.push([i.name,t])}return e}(t);for(const[t,n]of e)this.downcastDispatcher.convertMarkerAdd(t,n,r)}return n}init(t){if(this.model.document.version)throw new he.b("datacontroller-init-document-not-empty: Trying to set initial data to not empty document.");let e={};if("string"==typeof t?e.main=t:e=t,!this._checkIfRootsExists(Object.keys(e)))throw new he.b("datacontroller-init-non-existent-root: Attempting to init data on a non-existing root.");return this.model.enqueueChange("transparent",t=>{for(const n of Object.keys(e)){const r=this.model.document.getRoot(n);t.insert(this.parse(e[n],r),r,0)}}),Promise.resolve()}set(t){let e={};if("string"==typeof t?e.main=t:e=t,!this._checkIfRootsExists(Object.keys(e)))throw new he.b("datacontroller-set-non-existent-root: Attempting to set data on a non-existing root.");this.model.enqueueChange("transparent",t=>{t.setSelection(null),t.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());for(const n of Object.keys(e)){const r=this.model.document.getRoot(n);t.remove(t.createRangeIn(r)),t.insert(this.parse(e[n],r),r,0)}})}parse(t,e="$root"){const n=this.processor.toView(t);return this.toModel(n,e)}toModel(t,e="$root"){return this.model.change(n=>this.upcastDispatcher.convert(t,n,e))}destroy(){this.stopListening()}_checkIfRootsExists(t){for(const e of t)if(!this.model.document.getRootNames().includes(e))return!1;return!0}}Se(Co,Qe);class Ao{constructor(t,e){this._helpers=new Map,this._downcast=Array.isArray(t)?t:[t],this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=Array.isArray(e)?e:[e],this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:!1})}addAlias(t,e){const n=this._downcast.includes(e);if(!this._upcast.includes(e)&&!n)throw new he.b("conversion-add-alias-dispatcher-not-registered: Trying to register and alias for a dispatcher that nas not been registered.");this._createConversionHelpers({name:t,dispatchers:[e],isDowncast:n})}for(t){if(!this._helpers.has(t))throw new he.b("conversion-for-unknown-group: Trying to add a converter to an unknown dispatchers group.");return this._helpers.get(t)}elementToElement(t){this.for("downcast").elementToElement(t);for(const{model:e,view:n}of So(t))this.for("upcast").elementToElement({model:e,view:n,converterPriority:t.converterPriority})}attributeToElement(t){this.for("downcast").attributeToElement(t);for(const{model:e,view:n}of So(t))this.for("upcast").elementToAttribute({view:n,model:e,converterPriority:t.converterPriority})}attributeToAttribute(t){this.for("downcast").attributeToAttribute(t);for(const{model:e,view:n}of So(t))this.for("upcast").attributeToAttribute({view:n,model:e})}_createConversionHelpers({name:t,dispatchers:e,isDowncast:n}){if(this._helpers.has(t))throw new he.b("conversion-group-exists: Trying to register a group name that has already been registered.");const r=n?new Yi(e):new Xi(e);this._helpers.set(t,r)}}function*So(t){if(t.model.values)for(const e of t.model.values)yield*Eo({key:t.model.key,value:e},t.view[e],t.upcastAlso?t.upcastAlso[e]:void 0);else yield*Eo(t.model,t.view,t.upcastAlso)}function*Eo(t,e,n){if(yield{model:t,view:e},n){n=Array.isArray(n)?n:[n];for(const e of n)yield{model:t,view:e}}}class Oo{constructor(t="default"){this.operations=[],this.type=t}get baseVersion(){for(const t of this.operations)if(null!==t.baseVersion)return t.baseVersion;return null}addOperation(t){return t.batch=this,this.operations.push(t),t}}class Po{constructor(t){this.baseVersion=t,this.isDocumentOperation=null!==this.baseVersion,this.batch=null}_validate(){}toJSON(){const t=Object.assign({},this);return t.__className=this.constructor.className,delete t.batch,delete t.isDocumentOperation,t}static get className(){return"Operation"}static fromJSON(t){return new this(t.baseVersion)}}class To{constructor(t){this.markers=new Map,this._children=new Ci,t&&this._insertChild(0,t)}[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(t){return"documentFragment"==t}getChild(t){return this._children.getNode(t)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(t){return this._children.getNodeIndex(t)}getChildStartOffset(t){return this._children.getNodeStartOffset(t)}getPath(){return[]}getNodeByPath(t){let e=this;for(const n of t)e=e.getChild(e.offsetToIndex(n));return e}offsetToIndex(t){return this._children.offsetToIndex(t)}toJSON(){const t=[];for(const e of this._children)t.push(e.toJSON());return t}static fromJSON(t){const e=[];for(const n of t)e.push(n.name?Ai.fromJSON(n):ki.fromJSON(n));return new To(e)}_appendChild(t){this._insertChild(this.childCount,t)}_insertChild(t,e){const n=function(t){return"string"==typeof t?[new ki(t)]:(Me(t)||(t=[t]),Array.from(t).map(t=>"string"==typeof t?new ki(t):t instanceof xi?new ki(t.data,t.getAttributes()):t))}(e);for(const r of n)null!==r.parent&&r._remove(),r.parent=this;this._children._insertNodes(t,n)}_removeChildren(t,e=1){const n=this._children._removeNodes(t,e);for(const r of n)r.parent=null;return n}}function No(t,e){const n=(e=Do(e)).reduce((t,e)=>t+e.offsetSize,0),r=t.parent;Lo(t);const i=t.index;return r._insertChild(i,e),jo(r,i+e.length),jo(r,i),new Ti(t,t.getShiftedBy(n))}function Io(t){if(!t.isFlat)throw new he.b("operation-utils-remove-range-not-flat: Trying to remove a range which starts and ends in different element.");const e=t.start.parent;Lo(t.start),Lo(t.end);const n=e._removeChildren(t.start.index,t.end.index-t.start.index);return jo(e,t.start.index),n}function Mo(t,e){if(!t.isFlat)throw new he.b("operation-utils-move-range-not-flat: Trying to move a range which starts and ends in different element.");const n=Io(t);return No(e=e._getTransformedByDeletion(t.start,t.end.offset-t.start.offset),n)}function Do(t){const e=[];t instanceof Array||(t=[t]);for(let n=0;nt.maxOffset)throw new he.b("move-operation-nodes-do-not-exist: The nodes which should be moved do not exist.");if(t===e&&n=n&&this.targetPosition.path[t]t._clone(!0))),e=new zo(this.position,t,this.baseVersion);return e.shouldReceiveAttributes=this.shouldReceiveAttributes,e}getReversed(){const t=new Pi(this.position.root.document.graveyard,[0]);return new qo(this.position,this.nodes.maxOffset,t,this.baseVersion+1)}_validate(){const t=this.position.parent;if(!t||t.maxOffsett._clone(!0))),No(this.position,t)}toJSON(){const t=super.toJSON();return t.position=this.position.toJSON(),t.nodes=this.nodes.toJSON(),t}static get className(){return"InsertOperation"}static fromJSON(t,e){const n=[];for(const i of t.nodes)n.push(i.name?Ai.fromJSON(i):ki.fromJSON(i));const r=new zo(Pi.fromJSON(t.position,e),n,t.baseVersion);return r.shouldReceiveAttributes=t.shouldReceiveAttributes,r}}class Uo extends Po{constructor(t,e,n,r,i,o){super(o),this.name=t,this.oldRange=e?e.clone():null,this.newRange=n?n.clone():null,this.affectsData=i,this._markers=r}get type(){return"marker"}clone(){return new Uo(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new Uo(this.name,this.newRange,this.oldRange,this._markers,this.affectsData,this.baseVersion+1)}_execute(){this._markers[this.newRange?"_set":"_remove"](this.name,this.newRange,!0,this.affectsData)}toJSON(){const t=super.toJSON();return this.oldRange&&(t.oldRange=this.oldRange.toJSON()),this.newRange&&(t.newRange=this.newRange.toJSON()),delete t._markers,t}static get className(){return"MarkerOperation"}static fromJSON(t,e){return new Uo(t.name,t.oldRange?Ti.fromJSON(t.oldRange,e):null,t.newRange?Ti.fromJSON(t.newRange,e):null,e.model.markers,t.affectsData,t.baseVersion)}}class Ho extends Po{constructor(t,e,n,r){super(r),this.position=t,this.position.stickiness="toNext",this.oldName=e,this.newName=n}get type(){return"rename"}clone(){return new Ho(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new Ho(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){const t=this.position.nodeAfter;if(!(t instanceof Ai))throw new he.b("rename-operation-wrong-position: Given position is invalid or node after it is not an instance of Element.");if(t.name!==this.oldName)throw new he.b("rename-operation-wrong-name: Element to change has different name than operation's old name.")}_execute(){this.position.nodeAfter.name=this.newName}toJSON(){const t=super.toJSON();return t.position=this.position.toJSON(),t}static get className(){return"RenameOperation"}static fromJSON(t,e){return new Ho(Pi.fromJSON(t.position,e),t.oldName,t.newName,t.baseVersion)}}class Wo extends Po{constructor(t,e,n,r,i){super(i),this.root=t,this.key=e,this.oldValue=n,this.newValue=r}get type(){return null===this.oldValue?"addRootAttribute":null===this.newValue?"removeRootAttribute":"changeRootAttribute"}clone(){return new Wo(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new Wo(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is("documentFragment"))throw new he.b("rootattribute-operation-not-a-root: The element to change is not a root element.",{root:this.root,key:this.key});if(null!==this.oldValue&&this.root.getAttribute(this.key)!==this.oldValue)throw new he.b("rootattribute-operation-wrong-old-value: Changed node has different attribute value than operation's old attribute value.",{root:this.root,key:this.key});if(null===this.oldValue&&null!==this.newValue&&this.root.hasAttribute(this.key))throw new he.b("rootattribute-operation-attribute-exists: The attribute with given key already exists.",{root:this.root,key:this.key})}_execute(){null!==this.newValue?this.root._setAttribute(this.key,this.newValue):this.root._removeAttribute(this.key)}toJSON(){const t=super.toJSON();return t.root=this.root.toJSON(),t}static get className(){return"RootAttributeOperation"}static fromJSON(t,e){if(!e.getRoot(t.root))throw new he.b("rootattribute-operation-fromjson-no-root: Cannot create RootAttributeOperation. Root with specified name does not exist.",{rootName:t.root});return new Wo(e.getRoot(t.root),t.key,t.oldValue,t.newValue,t.baseVersion)}}class Go extends Po{constructor(t,e,n,r,i){super(i),this.sourcePosition=t.clone(),this.sourcePosition.stickiness="toPrevious",this.howMany=e,this.targetPosition=n.clone(),this.targetPosition.stickiness="toNext",this.graveyardPosition=r.clone()}get type(){return"merge"}get deletionPosition(){return new Pi(this.sourcePosition.root,this.sourcePosition.path.slice(0,-1))}get movedRange(){const t=this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);return new Ti(this.sourcePosition,t)}clone(){return new this.constructor(this.sourcePosition,this.howMany,this.targetPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const t=this.targetPosition._getTransformedByMergeOperation(this),e=this.sourcePosition.path.slice(0,-1),n=new Pi(this.sourcePosition.root,e)._getTransformedByMergeOperation(this),r=new Yo(t,this.howMany,this.graveyardPosition,this.baseVersion+1);return r.insertionPosition=n,r}_validate(){const t=this.sourcePosition.parent,e=this.targetPosition.parent;if(!(t&&t.is("element")&&t.parent))throw new he.b("merge-operation-source-position-invalid: Merge source position is invalid.");if(!(e&&e.is("element")&&e.parent))throw new he.b("merge-operation-target-position-invalid: Merge target position is invalid.");if(this.howMany!=t.maxOffset)throw new he.b("merge-operation-how-many-invalid: Merge operation specifies wrong number of nodes to move.")}_execute(){const t=this.sourcePosition.parent;Mo(Ti._createIn(t),this.targetPosition),Mo(Ti._createOn(t),this.graveyardPosition)}toJSON(){const t=super.toJSON();return t.sourcePosition=t.sourcePosition.toJSON(),t.targetPosition=t.targetPosition.toJSON(),t.graveyardPosition=t.graveyardPosition.toJSON(),t}static get className(){return"MergeOperation"}static fromJSON(t,e){const n=Pi.fromJSON(t.sourcePosition,e),r=Pi.fromJSON(t.targetPosition,e),i=Pi.fromJSON(t.graveyardPosition,e);return new this(n,t.howMany,r,i,t.baseVersion)}}class Yo extends Po{constructor(t,e,n,r){super(r),this.splitPosition=t.clone(),this.splitPosition.stickiness="toNext",this.howMany=e,this.insertionPosition=Yo.getInsertionPosition(t),this.insertionPosition.stickiness="toNone",this.graveyardPosition=n?n.clone():null,this.graveyardPosition&&(this.graveyardPosition.stickiness="toNext")}get type(){return"split"}get moveTargetPosition(){const t=this.insertionPosition.path.slice();return t.push(0),new Pi(this.insertionPosition.root,t)}get movedRange(){const t=this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);return new Ti(this.splitPosition,t)}clone(){const t=new this.constructor(this.splitPosition,this.howMany,this.graveyardPosition,this.baseVersion);return t.insertionPosition=this.insertionPosition,t}getReversed(){const t=new Pi(this.splitPosition.root.document.graveyard,[0]);return new Go(this.moveTargetPosition,this.howMany,this.splitPosition,t,this.baseVersion+1)}_validate(){const t=this.splitPosition.parent;if(!t||t.maxOffset{for(const e of t.getAttributeKeys())this.removeAttribute(e,t)};if(t instanceof Ti)for(const n of t.getItems())e(n);else e(t)}move(t,e,n){if(this._assertWriterUsedCorrectly(),!(t instanceof Ti))throw new he.b("writer-move-invalid-range: Invalid range to move.");if(!t.isFlat)throw new he.b("writer-move-range-not-flat: Range to move is not flat.");const r=Pi._createAt(e,n);if(r.isEqual(t.start))return;if(this._addOperationForAffectedMarkers("move",t),!ts(t.root,r.root))throw new he.b("writer-move-different-document: Range is going to be moved between different documents.");const i=new qo(t.start,t.end.offset-t.start.offset,r,t.root.document?t.root.document.version:null);this.batch.addOperation(i),this.model.applyOperation(i)}remove(t){this._assertWriterUsedCorrectly();const e=(t instanceof Ti?t:Ti._createOn(t)).getMinimalFlatRanges().reverse();for(const n of e)this._addOperationForAffectedMarkers("move",n),Xo(n.start,n.end.offset-n.start.offset,this.batch,this.model)}merge(t){this._assertWriterUsedCorrectly();const e=t.nodeBefore,n=t.nodeAfter;if(this._addOperationForAffectedMarkers("merge",t),!(e instanceof Ai))throw new he.b("writer-merge-no-element-before: Node before merge position must be an element.");if(!(n instanceof Ai))throw new he.b("writer-merge-no-element-after: Node after merge position must be an element.");t.root.document?this._merge(t):this._mergeDetached(t)}createPositionFromPath(t,e,n){return this.model.createPositionFromPath(t,e,n)}createPositionAt(t,e){return this.model.createPositionAt(t,e)}createPositionAfter(t){return this.model.createPositionAfter(t)}createPositionBefore(t){return this.model.createPositionBefore(t)}createRange(t,e){return this.model.createRange(t,e)}createRangeIn(t){return this.model.createRangeIn(t)}createRangeOn(t){return this.model.createRangeOn(t)}createSelection(t,e,n){return this.model.createSelection(t,e,n)}_mergeDetached(t){const e=t.nodeBefore,n=t.nodeAfter;this.move(Ti._createIn(n),Pi._createAt(e,"end")),this.remove(n)}_merge(t){const e=Pi._createAt(t.nodeBefore,"end"),n=Pi._createAt(t.nodeAfter,0),r=new Pi(t.root.document.graveyard,[0]),i=new Go(n,t.nodeAfter.maxOffset,e,r,t.root.document.version);this.batch.addOperation(i),this.model.applyOperation(i)}rename(t,e){if(this._assertWriterUsedCorrectly(),!(t instanceof Ai))throw new he.b("writer-rename-not-element-instance: Trying to rename an object which is not an instance of Element.");const n=t.root.document?t.root.document.version:null,r=new Ho(Pi._createBefore(t),t.name,e,n);this.batch.addOperation(r),this.model.applyOperation(r)}split(t,e){this._assertWriterUsedCorrectly();let n,r,i=t.parent;if(!i.parent)throw new he.b("writer-split-element-no-parent: Element with no parent can not be split.");if(e||(e=i.parent),!t.parent.getAncestors({includeSelf:!0}).includes(e))throw new he.b("writer-split-invalid-limit-element: Limit element is not a position ancestor.");do{const e=new Yo(t,i.maxOffset-t.offset,null,i.root.document?i.root.document.version:null);this.batch.addOperation(e),this.model.applyOperation(e),n||r||(n=i,r=t.parent.nextSibling),i=(t=this.createPositionAfter(t.parent)).parent}while(i!==e);return{position:t,range:new Ti(Pi._createAt(n,"end"),Pi._createAt(r,0))}}wrap(t,e){if(this._assertWriterUsedCorrectly(),!t.isFlat)throw new he.b("writer-wrap-range-not-flat: Range to wrap is not flat.");const n=e instanceof Ai?e:new Ai(e);if(n.childCount>0)throw new he.b("writer-wrap-element-not-empty: Element to wrap with is not empty.");if(null!==n.parent)throw new he.b("writer-wrap-element-attached: Element to wrap with is already attached to tree model.");this.insert(n,t.start);const r=new Ti(t.start.getShiftedBy(1),t.end.getShiftedBy(1));this.move(r,Pi._createAt(n,0))}unwrap(t){if(this._assertWriterUsedCorrectly(),null===t.parent)throw new he.b("writer-unwrap-element-no-parent: Trying to unwrap an element which has no parent.");this.move(Ti._createIn(t),this.createPositionAfter(t)),this.remove(t)}addMarker(t,e){if(this._assertWriterUsedCorrectly(),!e||"boolean"!=typeof e.usingOperation)throw new he.b("writer-addMarker-no-usingOperation: The options.usingOperation parameter is required when adding a new marker.");const n=e.usingOperation,r=e.range,i=void 0!==e.affectsData&&e.affectsData;if(this.model.markers.has(t))throw new he.b("writer-addMarker-marker-exists: Marker with provided name already exists.");if(!r)throw new he.b("writer-addMarker-no-range: Range parameter is required when adding a new marker.");return n?(Jo(this,t,null,r,i),this.model.markers.get(t)):this.model.markers._set(t,r,n,i)}updateMarker(t,e){this._assertWriterUsedCorrectly();const n="string"==typeof t?t:t.name,r=this.model.markers.get(n);if(!r)throw new he.b("writer-updateMarker-marker-not-exists: Marker with provided name does not exists.");if(!e)return void this.model.markers._refresh(r);const i="boolean"==typeof e.usingOperation,o="boolean"==typeof e.affectsData,s=o?e.affectsData:r.affectsData;if(!i&&!e.range&&!o)throw new he.b("writer-updateMarker-wrong-options: One of the options is required - provide range, usingOperations or affectsData.");const a=r.getRange(),l=e.range?e.range:a;i&&e.usingOperation!==r.managedUsingOperations?e.usingOperation?Jo(this,n,null,l,s):(Jo(this,n,a,null,s),this.model.markers._set(n,l,void 0,s)):r.managedUsingOperations?Jo(this,n,a,l,s):this.model.markers._set(n,l,void 0,s)}removeMarker(t){this._assertWriterUsedCorrectly();const e="string"==typeof t?t:t.name;if(!this.model.markers.has(e))throw new he.b("writer-removeMarker-no-marker: Trying to remove marker which does not exist.");const n=this.model.markers.get(e);n.managedUsingOperations?Jo(this,e,n.getRange(),null,n.affectsData):this.model.markers._remove(e)}setSelection(t,e,n){this._assertWriterUsedCorrectly(),this.model.document.selection._setTo(t,e,n)}setSelectionFocus(t,e){this._assertWriterUsedCorrectly(),this.model.document.selection._setFocus(t,e)}setSelectionAttribute(t,e){if(this._assertWriterUsedCorrectly(),"string"==typeof t)this._setSelectionAttribute(t,e);else for(const[n,r]of wi(t))this._setSelectionAttribute(n,r)}removeSelectionAttribute(t){if(this._assertWriterUsedCorrectly(),"string"==typeof t)this._removeSelectionAttribute(t);else for(const e of t)this._removeSelectionAttribute(e)}overrideSelectionGravity(){return this.model.document.selection._overrideGravity()}restoreSelectionGravity(t){this.model.document.selection._restoreGravity(t)}_setSelectionAttribute(t,e){const n=this.model.document.selection;if(n.isCollapsed&&n.anchor.parent.isEmpty){const r=zi._getStoreAttributeKey(t);this.setAttribute(r,e,n.anchor.parent)}n._setAttribute(t,e)}_removeSelectionAttribute(t){const e=this.model.document.selection;if(e.isCollapsed&&e.anchor.parent.isEmpty){const n=zi._getStoreAttributeKey(t);this.removeAttribute(n,e.anchor.parent)}e._removeAttribute(t)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new he.b("writer-incorrect-use: Trying to use a writer outside the change() block.")}_addOperationForAffectedMarkers(t,e){for(const n of this.model.markers){if(!n.managedUsingOperations)continue;const r=n.getRange();let i=!1;if("move"==t)i=e.containsPosition(r.start)||e.start.isEqual(r.start)||e.containsPosition(r.end)||e.end.isEqual(r.end);else{const t=e.nodeAfter,n=r.end.parent==t&&0==r.end.offset,o=r.end.nodeAfter==t,s=r.start.nodeAfter==t;i=r.start.parent==e.nodeBefore&&r.start.isAtEnd||n||o||s}i&&this.updateMarker(n.name,{range:r})}}}function Zo(t,e,n,r){const i=t.model,o=i.document;let s,a,l,u=r.start;for(const d of r.getWalker({shallow:!0}))l=d.item.getAttribute(e),s&&a!=l&&(a!=n&&c(),u=s),s=d.nextPosition,a=l;function c(){const r=new Ti(u,s),l=new Bo(r,e,a,n,r.root.document?o.version:null);t.batch.addOperation(l),i.applyOperation(l)}s instanceof Pi&&s!=u&&a!=n&&c()}function Qo(t,e,n,r){const i=t.model,o=i.document,s=r.getAttribute(e);let a,l;if(s!=n){if(r.root===r)l=new Wo(r,e,s,n,r.document?o.version:null);else{const i=(a=new Ti(Pi._createBefore(r),t.createPositionAfter(r))).root.document?o.version:null;l=new Bo(a,e,s,n,i)}t.batch.addOperation(l),i.applyOperation(l)}}function Jo(t,e,n,r,i){const o=t.model,s=new Uo(e,n,r,o.markers,i,o.document.version);t.batch.addOperation(s),o.applyOperation(s)}function Xo(t,e,n,r){let i;if(t.root.document){const n=r.document,o=new Pi(n.graveyard,[0]);i=new qo(t,e,o,n.version)}else i=new Vo(t,e);n.addOperation(i),r.applyOperation(i)}function ts(t,e){return t===e||t instanceof Ko&&e instanceof Ko}class es{constructor(t){this._markerCollection=t,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}bufferOperation(t){switch(t.type){case"insert":if(this._isInInsertedElement(t.position.parent))return;this._markInsert(t.position.parent,t.position.offset,t.nodes.maxOffset);break;case"addAttribute":case"removeAttribute":case"changeAttribute":for(const e of t.range.getItems())this._isInInsertedElement(e.parent)||this._markAttribute(e);break;case"remove":case"move":case"reinsert":{if(t.sourcePosition.isEqual(t.targetPosition)||t.sourcePosition.getShiftedBy(t.howMany).isEqual(t.targetPosition))return;const e=this._isInInsertedElement(t.sourcePosition.parent),n=this._isInInsertedElement(t.targetPosition.parent);e||this._markRemove(t.sourcePosition.parent,t.sourcePosition.offset,t.howMany),n||this._markInsert(t.targetPosition.parent,t.getMovedRangeStart().offset,t.howMany);break}case"rename":{if(this._isInInsertedElement(t.position.parent))return;this._markRemove(t.position.parent,t.position.offset,1),this._markInsert(t.position.parent,t.position.offset,1);const e=Ti._createFromPositionAndShift(t.position,1);for(const t of this._markerCollection.getMarkersIntersectingRange(e)){const e=t.getRange();this.bufferMarkerChange(t.name,e,e,t.affectsData)}break}case"split":{const e=t.splitPosition.parent;this._isInInsertedElement(e)||this._markRemove(e,t.splitPosition.offset,t.howMany),this._isInInsertedElement(t.insertionPosition.parent)||this._markInsert(t.insertionPosition.parent,t.insertionPosition.offset,1),t.graveyardPosition&&this._markRemove(t.graveyardPosition.parent,t.graveyardPosition.offset,1);break}case"merge":{const e=t.sourcePosition.parent;this._isInInsertedElement(e.parent)||this._markRemove(e.parent,e.startOffset,1),this._markInsert(t.graveyardPosition.parent,t.graveyardPosition.offset,1);const n=t.targetPosition.parent;this._isInInsertedElement(n)||this._markInsert(n,t.targetPosition.offset,e.maxOffset);break}}this._cachedChanges=null}bufferMarkerChange(t,e,n,r){const i=this._changedMarkers.get(t);i?(i.newRange=n,i.affectsData=r,null==i.oldRange&&null==i.newRange&&this._changedMarkers.delete(t)):this._changedMarkers.set(t,{oldRange:e,newRange:n,affectsData:r})}getMarkersToRemove(){const t=[];for(const[e,n]of this._changedMarkers)null!=n.oldRange&&t.push({name:e,range:n.oldRange});return t}getMarkersToAdd(){const t=[];for(const[e,n]of this._changedMarkers)null!=n.newRange&&t.push({name:e,range:n.newRange});return t}getChangedMarkers(){return Array.from(this._changedMarkers).map(t=>({name:t[0],data:{oldRange:t[1].oldRange,newRange:t[1].newRange}}))}hasDataChanges(){for(const[,t]of this._changedMarkers)if(t.affectsData)return!0;return this._changesInElement.size>0}getChanges(t={includeChangesInGraveyard:!1}){if(this._cachedChanges)return t.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice();const e=[];for(const n of this._changesInElement.keys()){const t=this._changesInElement.get(n).sort((t,e)=>t.offset===e.offset?t.type!=e.type?"remove"==t.type?-1:1:0:t.offsett.position.root!=e.position.root?t.position.root.rootNamen.offset){if(r>i){const t={type:"attribute",offset:i,howMany:r-i,count:this._changeCount++};this._handleChange(t,e),e.push(t)}t.nodesToHandle=n.offset-t.offset,t.howMany=t.nodesToHandle}else t.offset>=n.offset&&t.offseti?(t.nodesToHandle=r-i,t.offset=i):t.nodesToHandle=0);if("remove"==n.type&&t.offsetn.offset){const i={type:"attribute",offset:n.offset,howMany:r-n.offset,count:this._changeCount++};this._handleChange(i,e),e.push(i),t.nodesToHandle=n.offset-t.offset,t.howMany=t.nodesToHandle}"attribute"==n.type&&(t.offset>=n.offset&&r<=i?(t.nodesToHandle=0,t.howMany=0,t.offset=0):t.offset<=n.offset&&r>=i&&(n.howMany=0))}}t.howMany=t.nodesToHandle,delete t.nodesToHandle}_getInsertDiff(t,e,n){return{type:"insert",position:Pi._createAt(t,e),name:n,length:1,changeCount:this._changeCount++}}_getRemoveDiff(t,e,n){return{type:"remove",position:Pi._createAt(t,e),name:n,length:1,changeCount:this._changeCount++}}_getAttributesDiff(t,e,n){const r=[];n=new Map(n);for(const[i,o]of e){const e=n.has(i)?n.get(i):null;e!==o&&r.push({type:"attribute",position:t.start,range:t.clone(),length:1,attributeKey:i,attributeOldValue:o,attributeNewValue:e,changeCount:this._changeCount++}),n.delete(i)}for(const[i,o]of n)r.push({type:"attribute",position:t.start,range:t.clone(),length:1,attributeKey:i,attributeOldValue:null,attributeNewValue:o,changeCount:this._changeCount++});return r}_isInInsertedElement(t){const e=t.parent;if(!e)return!1;const n=this._changesInElement.get(e),r=t.startOffset;if(n)for(const i of n)if("insert"==i.type&&r>=i.offset&&rr&&(n.push(..."e".repeat(o.offset-r).split("")),i+=o.offset-r),"insert"==o.type?(n.push(..."i".repeat(o.howMany).split("")),r=o.offset+o.howMany):"remove"==o.type?(n.push(..."r".repeat(o.howMany).split("")),r=o.offset,i+=o.howMany):(n.push(..."a".repeat(o.howMany).split("")),r=o.offset+o.howMany,i+=o.howMany);return i{const n=e[0];if(n.isDocumentOperation&&n.baseVersion!==this.version)throw new he.b("model-document-applyOperation-wrong-version: Only operations with matching versions can be applied.",{operation:n})},{priority:"highest"}),this.listenTo(t,"applyOperation",(t,e)=>{const n=e[0];n.isDocumentOperation&&this.differ.bufferOperation(n)},{priority:"high"}),this.listenTo(t,"applyOperation",(t,e)=>{const n=e[0];n.isDocumentOperation&&(this.version++,this.history.addOperation(n))},{priority:"low"}),this.listenTo(this.selection,"change",()=>{this._hasSelectionChangedFromTheLastChangeBlock=!0}),this.listenTo(t.markers,"update",(t,e,n,r)=>{this.differ.bufferMarkerChange(e.name,n,r,e.affectsData),null===n&&e.on("change",(t,n)=>{this.differ.bufferMarkerChange(e.name,n,e.getRange(),e.affectsData)})})}get graveyard(){return this.getRoot(ls)}createRoot(t="$root",e="main"){if(this.roots.get(e))throw new he.b("model-document-createRoot-name-exists: Root with specified name already exists.",{name:e});const n=new Ko(this,t,e);return this.roots.add(n),n}destroy(){this.selection.destroy(),this.stopListening()}getRoot(t="main"){return this.roots.get(t)}getRootNames(){return Array.from(this.roots,t=>t.rootName).filter(t=>t!=ls)}registerPostFixer(t){this._postFixers.add(t)}toJSON(){const t=Oe(this);return t.selection="[engine.model.DocumentSelection]",t.model="[engine.model.Model]",t}_handleChangeBlock(t){this._hasDocumentChangedFromTheLastChangeBlock()&&(this._callPostFixers(t),this.selection.refresh(),this.differ.hasDataChanges()?this.fire("change:data",t.batch):this.fire("change",t.batch),this.selection.refresh(),this.differ.reset()),this._hasSelectionChangedFromTheLastChangeBlock=!1}_hasDocumentChangedFromTheLastChangeBlock(){return!this.differ.isEmpty||this._hasSelectionChangedFromTheLastChangeBlock}_getDefaultRoot(){for(const t of this.roots)if(t!==this.graveyard)return t;return this.graveyard}_getDefaultRange(){const t=this._getDefaultRoot(),e=this.model,n=e.schema,r=e.createPositionFromPath(t,[0]);return n.getNearestSelectionRange(r)||e.createRange(r)}_validateSelectionRange(t){return cs(t.start)&&cs(t.end)}_callPostFixers(t){let e=!1;do{for(const n of this._postFixers)if(this.selection.refresh(),e=n(t))break}while(e)}}function cs(t){const e=t.textNode;if(e){const n=e.data,r=t.offset-e.startOffset;return!ss(n,r)&&!as(n,r)}return!0}Se(us,be);class ds{constructor(){this._markers=new Map}[Symbol.iterator](){return this._markers.values()}has(t){return this._markers.has(t)}get(t){return this._markers.get(t)||null}_set(t,e,n=!1,r=!1){const i=t instanceof hs?t.name:t,o=this._markers.get(i);if(o){const t=o.getRange();let s=!1;return t.isEqual(e)||(o._attachLiveRange(Vi.fromRange(e)),s=!0),n!=o.managedUsingOperations&&(o._managedUsingOperations=n,s=!0),"boolean"==typeof r&&r!=o.affectsData&&(o._affectsData=r,s=!0),s&&this.fire("update:"+i,o,t,e),o}const s=Vi.fromRange(e),a=new hs(i,s,n,r);return this._markers.set(i,a),this.fire("update:"+i,a,null,e),a}_remove(t){const e=t instanceof hs?t.name:t,n=this._markers.get(e);return!!n&&(this._markers.delete(e),this.fire("update:"+e,n,n.getRange(),null),this._destroyMarker(n),!0)}_refresh(t){const e=t instanceof hs?t.name:t,n=this._markers.get(e);if(!n)throw new he.b("markercollection-refresh-marker-not-exists: Marker with provided name does not exists.");const r=n.getRange();this.fire("update:"+e,n,r,r,n.managedUsingOperations,n.affectsData)}*getMarkersAtPosition(t){for(const e of this)e.getRange().containsPosition(t)&&(yield e)}*getMarkersIntersectingRange(t){for(const e of this)null!==e.getRange().getIntersection(t)&&(yield e)}destroy(){for(const t of this._markers.values())this._destroyMarker(t);this._markers=null,this.stopListening()}*getMarkersGroup(t){for(const e of this._markers.values())e.name.startsWith(t+":")&&(yield e)}_destroyMarker(t){t.stopListening(),t._detachLiveRange()}}Se(ds,be);class hs{constructor(t,e,n,r){this.name=t,this._liveRange=this._attachLiveRange(e),this._managedUsingOperations=n,this._affectsData=r}get managedUsingOperations(){if(!this._liveRange)throw new he.b("marker-destroyed: Cannot use a destroyed marker instance.");return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new he.b("marker-destroyed: Cannot use a destroyed marker instance.");return this._affectsData}getStart(){if(!this._liveRange)throw new he.b("marker-destroyed: Cannot use a destroyed marker instance.");return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new he.b("marker-destroyed: Cannot use a destroyed marker instance.");return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new he.b("marker-destroyed: Cannot use a destroyed marker instance.");return this._liveRange.toRange()}_attachLiveRange(t){return this._liveRange&&this._detachLiveRange(),t.delegate("change:range").to(this),t.delegate("change:content").to(this),this._liveRange=t,t}_detachLiveRange(){this._liveRange.stopDelegating("change:range",this),this._liveRange.stopDelegating("change:content",this),this._liveRange.detach(),this._liveRange=null}}Se(hs,be);class fs extends Pi{constructor(t,e,n="toNone"){if(super(t,e,n),!this.root.is("rootElement"))throw new he.b("model-liveposition-root-not-rootelement: LivePosition's root has to be an instance of RootElement.");(function(){this.listenTo(this.root.document.model,"applyOperation",(t,e)=>{const n=e[0];n.isDocumentOperation&&(function(t){const e=this.getTransformedByOperation(t);if(!this.isEqual(e)){const t=this.toPosition();this.path=e.path,this.root=e.root,this.fire("change",t)}}).call(this,n)},{priority:"low"})}).call(this)}detach(){this.stopListening()}toPosition(){return new Pi(this.root,this.path.slice(),this.stickiness)}static fromPosition(t,e){return new this(t.root,t.path.slice(),e||t.stickiness)}}Se(fs,be);class ps{constructor(t,e,n){this.model=t,this.writer=e,this.position=n,this.canMergeWith=new Set([this.position.parent]),this.schema=t.schema,this._filterAttributesOf=[],this._affectedStart=null,this._affectedEnd=null}handleNodes(t,e){t=Array.from(t);for(let n=0;n!0);if(t.schema.checkChild(e.nextPosition,"$text"))return e.nextPosition}}function bs(t,e,n){return vs.includes(t.charAt(e+(n?0:-1)))}function ws(t,e,n){return e===(n?t.endOffset:0)}function _s(t,e){const n=[];Array.from(t.getItems({direction:"backward"})).map(t=>e.createRangeOn(t)).filter(e=>(e.start.isAfter(t.start)||e.start.isEqual(t.start))&&(e.end.isBefore(t.end)||e.end.isEqual(t.end))).forEach(t=>{n.push(t.start.parent),e.remove(t)}),n.forEach(t=>{let n=t;for(;n.parent&&n.isEmpty;){const t=e.createRangeOn(n);n=n.parent,e.remove(t)}})}function ks(t,e){return t.isCollapsed?function(t,e){const n=t.start,r=e.getNearestSelectionRange(n);if(!r)return null;const i=r.start;return n.isEqual(i)?null:i.nodeAfter&&e.isLimit(i.nodeAfter)?new Ti(i,Pi._createAfter(i.nodeAfter)):new Ti(i)}(t,e):function(t,e){const n=t.start,r=t.end,i=e.checkChild(n,"$text"),o=e.checkChild(r,"$text"),s=e.getLimitElement(n),a=e.getLimitElement(r);if(s===a){if(i&&o)return null;if(function(t,e,n){const r=t.nodeAfter&&!n.isLimit(t.nodeAfter)||n.checkChild(t,"$text"),i=e.nodeBefore&&!n.isLimit(e.nodeBefore)||n.checkChild(e,"$text");return r||i}(n,r,e)){const t=n.nodeAfter&&e.isObject(n.nodeAfter)?null:e.getNearestSelectionRange(n,"forward"),i=r.nodeBefore&&e.isObject(r.nodeBefore)?null:e.getNearestSelectionRange(r,"backward");return new Ti(t?t.start:n,i?i.start:r)}}const l=s&&!s.is("rootElement"),u=a&&!a.is("rootElement");if(l||u){const t=n.nodeAfter&&r.nodeBefore&&n.nodeAfter.parent===r.nodeBefore.parent,i=l&&(!t||!Cs(n.nodeAfter,e)),o=u&&(!t||!Cs(r.nodeBefore,e));let c=n,d=r;return i&&(c=Pi._createBefore(xs(s,e))),o&&(d=Pi._createAfter(xs(a,e))),new Ti(c,d)}return null}(t,e)}function xs(t,e){let n=t,r=n;for(;e.isLimit(r)&&r.parent;)n=r,r=r.parent;return n}function Cs(t,e){return t&&e.isObject(t)}class As{constructor(){var t;this.markers=new ds,this.document=new us(this),this.schema=new co,this._pendingChanges=[],this._currentWriter=null,["insertContent","deleteContent","modifySelection","getSelectedContent","applyOperation"].forEach(t=>this.decorate(t)),this.on("applyOperation",(t,e)=>{e[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}),this.schema.register("$clipboardHolder",{allowContentOf:"$root",isLimit:!0}),this.schema.extend("$text",{allowIn:"$clipboardHolder"}),this.schema.register("$marker"),this.schema.addChildCheck((t,e)=>{if("$marker"===e.name)return!0}),(t=this).document.registerPostFixer(e=>(function(t,e){const n=e.document.selection,r=e.schema,i=[];let o=!1;for(const s of n.getRanges()){const t=ks(s,r);t?(i.push(t),o=!0):i.push(s)}if(o){let e=i;i.length>1&&(e=[new Ti(i[0].start,i[i.length-1].end)]),t.setSelection(e,{backward:n.isBackward})}})(e,t))}change(t){return 0===this._pendingChanges.length?(this._pendingChanges.push({batch:new Oo,callback:t}),this._runPendingChanges()[0]):t(this._currentWriter)}enqueueChange(t,e){"string"==typeof t?t=new Oo(t):"function"==typeof t&&(e=t,t=new Oo),this._pendingChanges.push({batch:t,callback:e}),1==this._pendingChanges.length&&this._runPendingChanges()}applyOperation(t){t._execute()}insertContent(t,e,n){return function(t,e,n,r){return t.change(i=>{let o;const s=(o=n?n instanceof Li||n instanceof zi?n:i.createSelection(n,r):t.document.selection).getFirstPosition();o.isCollapsed||t.deleteContent(o,{doNotAutoparagraph:!0});const a=new ps(t,i,s);let l;l=e.is("documentFragment")?e.getChildren():[e],a.handleNodes(l,{isFirst:!0,isLast:!0});const u=a.getSelectionRange();u?o instanceof zi?i.setSelection(u):o.setTo(u):Xr.a.warn("insertcontent-no-range: Cannot determine a proper selection range after insertion.");const c=a.getAffectedRange()||t.createRange(s);return a.destroy(),c})}(this,t,e,n)}deleteContent(t,e){!function(t,e,n={}){if(e.isCollapsed)return;const r=e.getFirstRange();if("$graveyard"==r.root.rootName)return;const i=t.schema;t.change(t=>{if(!n.doNotResetEntireContent&&function(t,e){const n=t.getLimitElement(e);if(!e.containsEntireContent(n))return!1;const r=e.getFirstRange();return r.start.parent!=r.end.parent&&t.checkChild(n,"paragraph")}(i,e))return void function(t,e){const n=t.model.schema.getLimitElement(e);t.remove(t.createRangeIn(n)),gs(t,t.createPositionAt(n,0),e)}(t,e);const o=r.start,s=fs.fromPosition(r.end,"toNext");if(r.start.isTouching(r.end)||t.remove(r),n.leaveUnmerged||(function t(e,n,r){const i=n.parent,o=r.parent;if(i!=o&&!e.model.schema.isLimit(i)&&!e.model.schema.isLimit(o)&&function(t,e,n){const r=new Ti(t,e);for(const i of r.getWalker())if(n.isLimit(i.item))return!1;return!0}(n,r,e.model.schema)){for(n=e.createPositionAfter(i),(r=e.createPositionBefore(o)).isEqual(n)||e.insert(o,n),e.merge(n);r.parent.isEmpty;){const t=r.parent;r=e.createPositionBefore(t),e.remove(t)}t(e,n,r)}}(t,o,s),i.removeDisallowedAttributes(o.parent.getChildren(),t)),ms(t,e,o),function(t,e){const n=t.checkChild(e,"$text"),r=t.checkChild(e,"paragraph");return!n&&r}(i,o)){const r=i.getNearestSelectionRange(o);n.doNotAutoparagraph&&r?ms(t,e,r):gs(t,o,e)}s.detach()})}(this,t,e)}modifySelection(t,e){!function(t,e,n={}){const r=t.schema,i="backward"!=n.direction,o=n.unit?n.unit:"character",s=new Si({boundaries:function(t,e){const n=Pi._createAt(t.root,e?"end":0);return e?new Ti(t,n):new Ti(n,t)}(e.focus,i),singleCharacters:!0,direction:i?"forward":"backward"}),a={walker:s,schema:r,isForward:i,unit:o};let l;for(;l=s.next();){if(l.done)return;const n=ys(a,l.value);if(n)return void(e instanceof zi?t.change(t=>{t.setSelectionFocus(n)}):e.setFocus(n))}}(this,t,e)}getSelectedContent(t){return function(t,e){return t.change(t=>{const n=t.createDocumentFragment(),r=e.getFirstRange();if(!r||r.isCollapsed)return n;const i=r.start.root,o=r.start.getCommonPath(r.end),s=i.getNodeByPath(o);let a;const l=(a=r.start.parent==r.end.parent?r:t.createRange(t.createPositionAt(s,r.start.path[o.length]),t.createPositionAt(s,r.end.path[o.length]+1))).end.offset-a.start.offset;for(const e of a.getItems({shallow:!0}))e.is("textProxy")?t.appendText(e.data,e.getAttributes(),n):t.append(e._clone(!0),n);if(a!=r){const e=r._getTransformedByMove(a.start,t.createPositionAt(n,0),l)[0],i=t.createRange(t.createPositionAt(n,0),e.start);_s(t.createRange(e.end,t.createPositionAt(n,"end")),t),_s(i,t)}return n})}(this,t)}hasContent(t,e){const n=t instanceof Ai?Ti._createIn(t):t;if(n.isCollapsed)return!1;for(const i of this.markers.getMarkersIntersectingRange(n))if(i.affectsData)return!0;const{ignoreWhitespaces:r=!1}=e||{};for(const i of n.getItems())if(i.is("textProxy")){if(!r)return!0;if(-1!==i.data.search(/\S/))return!0}else if(this.schema.isObject(i))return!0;return!1}createPositionFromPath(t,e,n){return new Pi(t,e,n)}createPositionAt(t,e){return Pi._createAt(t,e)}createPositionAfter(t){return Pi._createAfter(t)}createPositionBefore(t){return Pi._createBefore(t)}createRange(t,e){return new Ti(t,e)}createRangeIn(t){return Ti._createIn(t)}createRangeOn(t){return Ti._createOn(t)}createSelection(t,e,n){return new Li(t,e,n)}createBatch(){return new Oo}destroy(){this.document.destroy(),this.stopListening()}_runPendingChanges(){const t=[];for(this.fire("_beforeChanges");this._pendingChanges.length;){this._currentWriter=new $o(this,this._pendingChanges[0].batch);const e=this._pendingChanges[0].callback(this._currentWriter);t.push(e),this.document._handleChangeBlock(this._currentWriter),this._pendingChanges.shift(),this._currentWriter=null}return this.fire("_afterChanges"),t}}Se(As,Qe);class Ss{constructor(){this._listener=Object.create(yr)}listenTo(t){this._listener.listenTo(t,"keydown",(t,e)=>{this._listener.fire("_keydown:"+On(e),e)})}set(t,e,n={}){const r=Pn(t);this._listener.listenTo(this._listener,"_keydown:"+r,(t,n)=>{e(n,()=>{n.preventDefault(),n.stopPropagation(),t.stop()}),t.return=!0},{priority:n.priority})}press(t){return!!this._listener.fire("_keydown:"+On(t),t)}destroy(){this._listener.stopListening()}}class Es extends Ss{constructor(t){super(),this.editor=t}set(t,e,n={}){if("string"==typeof e){const t=e;e=((e,n)=>{this.editor.execute(t),n()})}super.set(t,e,n)}}class Os{constructor(t){const e=this.constructor.builtinPlugins;this.config=new ce(t,this.constructor.defaultConfig),this.config.define("plugins",e),this.plugins=new oo(this,e),this.commands=new so,this.locale=new ao(this.config.get("language")),this.t=this.locale.t,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 As,this.data=new Co(this.model),this.editing=new io(this.model),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new Ao([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 Es(this),this.keystrokes.listenTo(this.editing.view.document)}initPlugins(){const t=this.config,e=t.get("plugins")||[],n=t.get("removePlugins")||[],r=t.get("extraPlugins")||[];return this.plugins.init(e.concat(r),n)}destroy(){let t=Promise.resolve();return"initializing"==this.state&&(t=new Promise(t=>this.once("ready",t))),t.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()})}execute(...t){this.commands.execute(...t)}}Se(Os,Qe);var Ps={setData(t){this.data.set(t)},getData(t){return this.data.get(t)}},Ts={updateSourceElement(){if(!this.sourceElement)throw new he.b("editor-missing-sourceelement: Cannot update the source element of a detached editor.");var t,e;t=this.sourceElement,e=this.data.get(),t instanceof HTMLTextAreaElement&&(t.value=e),t.innerHTML=e}};class Ns{getHtml(t){const e=document.implementation.createHTMLDocument("").createElement("div");return e.appendChild(t),e.innerHTML}}class Is{constructor(){this._domParser=new DOMParser,this._domConverter=new pr({blockFiller:Gn}),this._htmlWriter=new Ns}toData(t){const e=this._domConverter.viewToDom(t,document);return this._htmlWriter.getHtml(e)}toView(t){const e=this._toDom(t);return this._domConverter.domToView(e)}_toDom(t){const e=this._domParser.parseFromString(t,"text/html"),n=e.createDocumentFragment(),r=e.body.childNodes;for(;r.length>0;)n.appendChild(r[0]);return n}}class Ms{constructor(t){this.editor=t,this._components=new Map}*names(){for(const t of this._components.values())yield t.originalName}add(t,e){if(this.has(t))throw new he.b("componentfactory-item-exists: The item already exists in the component factory.",{name:t});this._components.set(Ds(t),{callback:e,originalName:t})}create(t){if(!this.has(t))throw new he.b("componentfactory-item-missing: The required component is not registered in the factory.",{name:t});return this._components.get(Ds(t)).callback(this.editor.locale)}has(t){return this._components.has(Ds(t))}}function Ds(t){return String(t).toLowerCase()}class js{constructor(){this.set("isFocused",!1),this.set("focusedElement",null),this._elements=new Set,this._nextEventLoopTimeout=null}add(t){if(this._elements.has(t))throw new he.b("focusTracker-add-element-already-exist");this.listenTo(t,"focus",()=>this._focus(t),{useCapture:!0}),this.listenTo(t,"blur",()=>this._blur(),{useCapture:!0}),this._elements.add(t)}remove(t){t===this.focusedElement&&this._blur(t),this._elements.has(t)&&(this.stopListening(t),this._elements.delete(t))}destroy(){this.stopListening()}_focus(t){clearTimeout(this._nextEventLoopTimeout),this.focusedElement=t,this.isFocused=!0}_blur(){clearTimeout(this._nextEventLoopTimeout),this._nextEventLoopTimeout=setTimeout(()=>{this.focusedElement=null,this.isFocused=!1},0)}}Se(js,yr),Se(js,Qe);class Ls{constructor(t){this.editor=t,this.componentFactory=new Ms(t),this.focusTracker=new js,this._editableElements=new Map,this.listenTo(t.editing.view.document,"layoutChanged",()=>this.update())}get element(){return null}update(){this.fire("update")}destroy(){this.stopListening(),this.focusTracker.destroy(),this._editableElements=new Map}getEditableElement(t="main"){return this._editableElements.get(t)}getEditableElementsNames(){return this._editableElements.keys()}}Se(Ls,be),n(45);const Rs=new WeakMap;function Fs(t){const{view:e,element:n,text:r,isDirectHost:i=!0}=t,o=e.document;Rs.has(o)||(Rs.set(o,new Map),o.registerPostFixer(t=>Bs(o,t))),Rs.get(o).set(n,{text:r,isDirectHost:i}),e.change(t=>Bs(o,t))}function Bs(t,e){const n=Rs.get(t);let r=!1;for(const[i,o]of n)Vs(e,i,o)&&(r=!0);return r}function Vs(t,e,n){const{text:r,isDirectHost:i}=n,o=i?e:function(t){if(1===t.childCount){const t=t.getChild(0);if(t.is("element")&&!t.is("uiElement"))return t}return null}();let s=!1;return!!o&&(n.hostElement=o,o.getAttribute("data-placeholder")!==r&&(t.setAttribute("data-placeholder",r,o),s=!0),function(t){const e=t.document;if(!e)return!1;const n=!Array.from(t.getChildren()).some(t=>!t.is("uiElement"));if(!e.isFocused&&n)return!0;const r=e.selection.anchor;return!(!n||!r||r.parent===t)}(o)?function(t,e){return!e.hasClass("ck-placeholder")&&(t.addClass("ck-placeholder",e),!0)}(t,o)&&(s=!0):function(t,e){return!!e.hasClass("ck-placeholder")&&(t.removeClass("ck-placeholder",e),!0)}(t,o)&&(s=!0),s)}class qs{constructor(){this._replacedElements=[]}replace(t,e){this._replacedElements.push({element:t,newElement:e}),t.style.display="none",e&&t.parentNode.insertBefore(e,t.nextSibling)}restore(){this._replacedElements.forEach(({element:t,newElement:e})=>{t.style.display="",e&&e.remove()}),this._replacedElements=[]}}class zs extends Ls{constructor(t,e){super(t),this.view=e,this._toolbarConfig=function(t){return Array.isArray(t)?{items:t}:t?Object.assign({items:[]},t):{items:[]}}(t.config.get("toolbar")),this._elementReplacer=new qs}get element(){return this.view.element}init(t){const e=this.view,n=this.editor.editing.view,r=e.editable,i=n.document.getRoot();r.name=i.rootName,e.render();const o=r.element;this._editableElements.set(r.name,o),this.focusTracker.add(o),e.editable.bind("isFocused").to(this.focusTracker),n.attachDomRoot(o),t&&this._elementReplacer.replace(t,this.element),this._initPlaceholder(),this._initToolbar(),this.fire("ready")}destroy(){const t=this.view,e=this.editor.editing.view;this._elementReplacer.restore(),e.detachDomRoot(t.editable.name),t.destroy(),super.destroy()}_initToolbar(){const t=this.editor,e=this.view,n=t.editing.view;e.stickyPanel.bind("isActive").to(this.focusTracker,"isFocused"),e.stickyPanel.limiterElement=e.element,this._toolbarConfig.viewportTopOffset&&(e.stickyPanel.viewportTopOffset=this._toolbarConfig.viewportTopOffset),e.toolbar.fillFromConfig(this._toolbarConfig.items,this.componentFactory),function({origin:t,originKeystrokeHandler:e,originFocusTracker:n,toolbar:r,beforeFocus:i,afterBlur:o}){n.add(r.element),e.set("Alt+F10",(t,e)=>{n.isFocused&&!r.focusTracker.isFocused&&(i&&i(),r.focus(),e())}),r.keystrokes.set("Esc",(e,n)=>{r.focusTracker.isFocused&&(t.focus(),o&&o(),n())})}({origin:n,originFocusTracker:this.focusTracker,originKeystrokeHandler:t.keystrokes,toolbar:e.toolbar})}_initPlaceholder(){const t=this.editor,e=t.editing.view,n=e.document.getRoot(),r=t.sourceElement,i=t.config.get("placeholder")||r&&"textarea"===r.tagName.toLowerCase()&&r.getAttribute("placeholder");i&&Fs({view:e,element:n,text:i,isDirectHost:!1})}}class Us extends gn{constructor(t){super({idProperty:"viewUid"}),this.on("add",(t,e,n)=>{e.isRendered||e.render(),e.element&&this._parentElement&&this._parentElement.insertBefore(e.element,this._parentElement.children[n])}),this.on("remove",(t,e)=>{e.element&&this._parentElement&&e.element.remove()}),this.locale=t,this._parentElement=null}destroy(){this.map(t=>t.destroy())}setParent(t){this._parentElement=t}delegate(...t){if(!t.length||!function(t){return t.every(t=>"string"==typeof t)}(t))throw new he.b("ui-viewcollection-delegate-wrong-events: All event names must be strings.");return{to:e=>{for(const n of this)for(const r of t)n.delegate(r).to(e);this.on("add",(n,r)=>{for(const i of t)r.delegate(i).to(e)}),this.on("remove",(n,r)=>{for(const i of t)r.stopDelegating(i,e)})}}}}const Hs="http://www.w3.org/1999/xhtml";class Ws{constructor(t){Object.assign(this,ta(Xs(t))),this._isRendered=!1,this._revertData=null}render(){const t=this._renderNode({intoFragment:!0});return this._isRendered=!0,t}apply(t){return this._revertData={children:[],bindings:[],attributes:{}},this._renderNode({node:t,isApplying:!0,revertData:this._revertData}),t}revert(t){if(!this._revertData)throw new he.b("ui-template-revert-not-applied: Attempting to revert a template which has not been applied yet.");this._revertTemplateFromNode(t,this._revertData)}*getViews(){yield*function*t(e){if(e.children)for(const n of e.children)oa(n)?yield n:sa(n)&&(yield*t(n))}(this)}static bind(t,e){return{to:(n,r)=>new Ys({eventNameOrFunction:n,attribute:n,observable:t,emitter:e,callback:r}),if:(n,r,i)=>new Ks({observable:t,emitter:e,attribute:n,valueIfTrue:r,callback:i})}}static extend(t,e){t._isRendered&&Xr.a.warn("template-extend-render: Attempting to extend a template which has already been rendered."),function t(e,n){if(n.attributes&&(e.attributes||(e.attributes={}),ra(e.attributes,n.attributes)),n.eventListeners&&(e.eventListeners||(e.eventListeners={}),ra(e.eventListeners,n.eventListeners)),n.text&&e.text.push(...n.text),n.children&&n.children.length){if(e.children.length!=n.children.length)throw new he.b("ui-template-extend-children-mismatch: The number of children in extended definition does not match.");let r=0;for(const i of n.children)t(e.children[r++],i)}}(t,ta(Xs(e)))}_renderNode(t){let e;if(e=t.node?this.tag&&this.text:this.tag?this.text:!this.text)throw new he.b('ui-template-wrong-syntax: Node definition must have either "tag" or "text" when rendering a new Node.');return this.text?this._renderText(t):this._renderElement(t)}_renderElement(t){let e=t.node;return e||(e=t.node=document.createElementNS(this.ns||Hs,this.tag)),this._renderAttributes(t),this._renderElementChildren(t),this._setUpListeners(t),e}_renderText(t){let e=t.node;return e?t.revertData.text=e.textContent:e=t.node=document.createTextNode(""),$s(this.text)?this._bindToObservable({schema:this.text,updater:function(t){return{set(e){t.textContent=e},remove(){t.textContent=""}}}(e),data:t}):e.textContent=this.text.join(""),e}_renderAttributes(t){let e,n,r,i;if(!this.attributes)return;const o=t.node,s=t.revertData;for(e in this.attributes)if(r=o.getAttribute(e),n=this.attributes[e],s&&(s.attributes[e]=r),i=S(n[0])&&n[0].ns?n[0].ns:null,$s(n)){const a=i?n[0].value:n;s&&la(e)&&a.unshift(r),this._bindToObservable({schema:a,updater:Qs(o,e,i),data:t})}else"style"==e&&"string"!=typeof n[0]?this._renderStyleAttribute(n[0],t):(s&&r&&la(e)&&n.unshift(r),ia(n=n.map(t=>t&&t.value||t).reduce((t,e)=>t.concat(e),[]).reduce(na,""))||o.setAttributeNS(i,e,n))}_renderStyleAttribute(t,e){const n=e.node;for(const r in t){const i=t[r];$s(i)?this._bindToObservable({schema:[i],updater:Js(n,r),data:e}):n.style[r]=i}}_renderElementChildren(t){const e=t.node,n=t.intoFragment?document.createDocumentFragment():e,r=t.isApplying;let i=0;for(const o of this.children)if(aa(o)){if(!r){o.setParent(e);for(const t of o)n.appendChild(t.element)}}else if(oa(o))r||(o.isRendered||o.render(),n.appendChild(o.element));else if(ar(o))n.appendChild(o);else if(r){const e={children:[],bindings:[],attributes:{}};t.revertData.children.push(e),o._renderNode({node:n.childNodes[i++],isApplying:!0,revertData:e})}else n.appendChild(o.render());t.intoFragment&&e.appendChild(n)}_setUpListeners(t){if(this.eventListeners)for(const e in this.eventListeners){const n=this.eventListeners[e].map(n=>{const[r,i]=e.split("@");return n.activateDomEventListener(r,i,t)});t.revertData&&t.revertData.bindings.push(n)}}_bindToObservable({schema:t,updater:e,data:n}){const r=n.revertData;Zs(t,e,n);const i=t.filter(t=>!ia(t)).filter(t=>t.observable).map(r=>r.activateAttributeListener(t,e,n));r&&r.bindings.push(i)}_revertTemplateFromNode(t,e){for(const n of e.bindings)for(const t of n)t();if(e.text)t.textContent=e.text;else{for(const n in e.attributes){const r=e.attributes[n];null===r?t.removeAttribute(n):t.setAttribute(n,r)}for(let n=0;nZs(t,e,n);return this.emitter.listenTo(this.observable,"change:"+this.attribute,r),()=>{this.emitter.stopListening(this.observable,"change:"+this.attribute,r)}}}class Ys extends Gs{activateDomEventListener(t,e,n){const r=(t,n)=>{e&&!n.target.matches(e)||("function"==typeof this.eventNameOrFunction?this.eventNameOrFunction(n):this.observable.fire(this.eventNameOrFunction,n))};return this.emitter.listenTo(n.node,t,r),()=>{this.emitter.stopListening(n.node,t,r)}}}class Ks extends Gs{getValue(t){return!ia(super.getValue(t))&&(this.valueIfTrue||!0)}}function $s(t){return!!t&&(t.value&&(t=t.value),Array.isArray(t)?t.some($s):t instanceof Gs)}function Zs(t,e,{node:n}){let r=function(t,e){return t.map(t=>t instanceof Gs?t.getValue(e):t)}(t,n);ia(r=1==t.length&&t[0]instanceof Ks?r[0]:r.reduce(na,""))?e.remove():e.set(r)}function Qs(t,e,n){return{set(r){t.setAttributeNS(n,e,r)},remove(){t.removeAttributeNS(n,e)}}}function Js(t,e){return{set(n){t.style[e]=n},remove(){t.style[e]=null}}}function Xs(t){return le(t,t=>{if(t&&(t instanceof Gs||sa(t)||oa(t)||aa(t)))return t})}function ta(t){if("string"==typeof t?t=function(t){return{text:[t]}}(t):t.text&&function(t){Array.isArray(t.text)||(t.text=[t.text])}(t),t.on&&(t.eventListeners=function(t){for(const e in t)ea(t,e);return t}(t.on),delete t.on),!t.text){t.attributes&&function(t){for(const e in t)t[e].value&&(t[e].value=[].concat(t[e].value)),ea(t,e)}(t.attributes);const e=[];if(t.children)if(aa(t.children))e.push(t.children);else for(const n of t.children)sa(n)||oa(n)||ar(n)?e.push(n):e.push(new Ws(n));t.children=e}return t}function ea(t,e){Array.isArray(t[e])||(t[e]=[t[e]])}function na(t,e){return ia(e)?t:ia(t)?e:`${t} ${e}`}function ra(t,e){for(const n in e)t[n]?t[n].push(...e[n]):t[n]=e[n]}function ia(t){return!t&&0!==t}function oa(t){return t instanceof ua}function sa(t){return t instanceof Ws}function aa(t){return t instanceof Us}function la(t){return"class"==t||"style"==t}n(48);class ua{constructor(t){this.element=null,this.isRendered=!1,this.locale=t,this.t=t&&t.t,this._viewCollections=new gn,this._unboundChildren=this.createCollection(),this._viewCollections.on("add",(e,n)=>{n.locale=t}),this.decorate("render")}get bindTemplate(){return this._bindTemplate?this._bindTemplate:this._bindTemplate=Ws.bind(this,this)}createCollection(){const t=new Us;return this._viewCollections.add(t),t}registerChild(t){Me(t)||(t=[t]);for(const e of t)this._unboundChildren.add(e)}deregisterChild(t){Me(t)||(t=[t]);for(const e of t)this._unboundChildren.remove(e)}setTemplate(t){this.template=new Ws(t)}extendTemplate(t){Ws.extend(this.template,t)}render(){if(this.isRendered)throw new he.b("ui-view-render-already-rendered: This View has already been rendered.");this.template&&(this.element=this.template.render(),this.registerChild(this.template.getViews())),this.isRendered=!0}destroy(){this.stopListening(),this._viewCollections.map(t=>t.destroy()),this.template&&this.template._revertData&&this.template.revert(this.element)}}Se(ua,yr),Se(ua,Qe),n(50);class ca extends ua{constructor(t){super(t),this.body=this.createCollection()}render(){super.render(),this._renderBodyCollection()}destroy(){return this._bodyCollectionContainer.remove(),super.destroy()}_renderBodyCollection(){const t=this._bodyCollectionContainer=new Ws({tag:"div",attributes:{class:["ck","ck-reset_all","ck-body","ck-rounded-corners"]},children:this.body}).render();document.body.appendChild(t)}}n(52);class da extends ua{constructor(t){super(t),this.set("text"),this.set("for");const e=this.bindTemplate;this.setTemplate({tag:"label",attributes:{class:["ck","ck-label"],for:e.to("for")},children:[{text:e.to("text")}]})}}class ha extends ca{constructor(t){super(t);const e=ge();this.top=this.createCollection(),this.main=this.createCollection(),this._voiceLabelView=this._createVoiceLabel(e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-editor","ck-rounded-corners"],role:"application",dir:"ltr",lang:t.language,"aria-labelledby":`ck-editor__aria-label_${e}`},children:[this._voiceLabelView,{tag:"div",attributes:{class:["ck","ck-editor__top","ck-reset_all"],role:"presentation"},children:this.top},{tag:"div",attributes:{class:["ck","ck-editor__main"],role:"presentation"},children:this.main}]})}_createVoiceLabel(t){const e=this.t,n=new da;return n.text=e("bg"),n.extendTemplate({attributes:{id:`ck-editor__aria-label_${t}`,class:"ck-voice-label"}}),n}}class fa extends ua{constructor(t,e,n){super(t),this.setTemplate({tag:"div",attributes:{class:["ck","ck-content","ck-editor__editable","ck-rounded-corners"]}}),this.name=null,this.set("isFocused",!1),this._editableElement=n,this._hasExternalElement=!!this._editableElement,this._editingView=e}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 t=this._editingView;function e(e){t.change(n=>{const r=t.document.getRoot(e.name);n.addClass(e.isFocused?"ck-focused":"ck-blurred",r),n.removeClass(e.isFocused?"ck-blurred":"ck-focused",r)})}t.isRenderingInProgress?function n(r){t.once("change:isRenderingInProgress",(t,i,o)=>{o?n(r):e(r)})}(this):e(this)}}class pa extends fa{constructor(t,e,n){super(t,e,n),this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}})}render(){super.render();const t=this._editingView,e=this.t;t.change(n=>{const r=t.document.getRoot(this.name);n.setAttribute("aria-label",e("bh",[this.name]),r)})}}function ga(t){return e=>e+t}n(54);const ma=ga("px");class va extends ua{constructor(t){super(t);const e=this.bindTemplate;this.set("isActive",!1),this.set("isSticky",!1),this.set("limiterElement",null),this.set("limiterBottomOffset",50),this.set("viewportTopOffset",0),this.set("_marginLeft",null),this.set("_isStickyToTheLimiter",!1),this.set("_hasViewportTopOffset",!1),this.content=this.createCollection(),this._contentPanelPlaceholder=new Ws({tag:"div",attributes:{class:["ck","ck-sticky-panel__placeholder"],style:{display:e.to("isSticky",t=>t?"block":"none"),height:e.to("isSticky",t=>t?ma(this._panelRect.height):null)}}}).render(),this._contentPanel=new Ws({tag:"div",attributes:{class:["ck","ck-sticky-panel__content",e.if("isSticky","ck-sticky-panel__content_sticky"),e.if("_isStickyToTheLimiter","ck-sticky-panel__content_sticky_bottom-limit")],style:{width:e.to("isSticky",t=>t?ma(this._contentPanelPlaceholder.getBoundingClientRect().width):null),top:e.to("_hasViewportTopOffset",t=>t?ma(this.viewportTopOffset):null),bottom:e.to("_isStickyToTheLimiter",t=>t?ma(this.limiterBottomOffset):null),marginLeft:e.to("_marginLeft")}},children:this.content}).render(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-sticky-panel"]},children:[this._contentPanelPlaceholder,this._contentPanel]})}render(){super.render(),this._checkIfShouldBeSticky(),this.listenTo(dr.window,"scroll",()=>{this._checkIfShouldBeSticky()}),this.listenTo(this,"change:isActive",()=>{this._checkIfShouldBeSticky()})}_checkIfShouldBeSticky(){const t=this._panelRect=this._contentPanel.getBoundingClientRect();let e;this.limiterElement?(e=this._limiterRect=this.limiterElement.getBoundingClientRect(),this.isSticky=this.isActive&&e.top{this[e](),n()})}}get first(){return this.focusables.find(ba)||null}get last(){return this.focusables.filter(ba).slice(-1)[0]||null}get next(){return this._getFocusableItem(1)}get previous(){return this._getFocusableItem(-1)}get current(){let t=null;return null===this.focusTracker.focusedElement?null:(this.focusables.find((e,n)=>{const r=e.element===this.focusTracker.focusedElement;return r&&(t=n),r}),t)}focusFirst(){this._focus(this.first)}focusLast(){this._focus(this.last)}focusNext(){this._focus(this.next)}focusPrevious(){this._focus(this.previous)}_focus(t){t&&t.focus()}_getFocusableItem(t){const e=this.current,n=this.focusables.length;if(!n)return null;if(null===e)return this[1===t?"first":"last"];let r=(e+n+t)%n;do{const e=this.focusables.get(r);if(ba(e))return e;r=(r+n+t)%n}while(r!==e);return null}}function ba(t){return!(!t.focus||"none"==dr.window.getComputedStyle(t.element).display)}class wa extends ua{constructor(t){super(t),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}})}}n(56);class _a extends ua{constructor(t){super(t);const e=this.bindTemplate;this.items=this.createCollection(),this.focusTracker=new js,this.keystrokes=new Ss,this.set("isVertical",!1),this.set("class"),this._focusCycler=new ya({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:["arrowleft","arrowup"],focusNext:["arrowright","arrowdown"]}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar",e.if("isVertical","ck-toolbar_vertical"),e.to("class")]},children:this.items,on:{mousedown:function(t){return t.bindTemplate.to(e=>{e.target===t.element&&e.preventDefault()})}(this)}})}render(){super.render();for(const t of this.items)this.focusTracker.add(t.element);this.items.on("add",(t,e)=>{this.focusTracker.add(e.element)}),this.items.on("remove",(t,e)=>{this.focusTracker.remove(e.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}fillFromConfig(t,e){t.map(t=>{"|"==t?this.items.add(new wa):e.has(t)?this.items.add(e.create(t)):Xr.a.warn("toolbarview-item-unavailable: The requested toolbar item is unavailable.",{name:t})})}}n(58);class ka extends ha{constructor(t,e){super(t),this.stickyPanel=new va(t),this.toolbar=new _a(t),this.editable=new pa(t,e)}render(){super.render(),this.stickyPanel.content.add(this.toolbar),this.top.add(this.stickyPanel),this.main.add(this.editable)}}class xa extends Os{constructor(t,e){super(e),ue(t)&&(this.sourceElement=t),this.data.processor=new Is,this.model.document.createRoot(),this.ui=new zs(this,new ka(this.locale,this.editing.view)),function(t){if(!E(t.updateSourceElement))throw new he.b("attachtoform-missing-elementapi-interface: Editor passed to attachToForm() must implement ElementApi.");const e=t.sourceElement;if(e&&"textarea"===e.tagName.toLowerCase()&&e.form){let n;const r=e.form,i=()=>t.updateSourceElement();E(r.submit)&&(n=r.submit,r.submit=(()=>{i(),n.apply(r)})),r.addEventListener("submit",i),t.on("destroy",()=>{r.removeEventListener("submit",i),n&&(r.submit=n)})}}(this)}destroy(){return this.sourceElement&&this.updateSourceElement(),this.ui.destroy(),super.destroy()}static create(t,e={}){return new Promise(n=>{const r=new this(t,e);n(r.initPlugins().then(()=>r.ui.init(ue(t)?t:null)).then(()=>{if(!ue(t)&&e.initialData)throw new he.b("editor-create-initial-data: The config.initialData option cannot be used together with initial data passed in Editor.create().");const n=e.initialData||function(t){return ue(t)?function(t){return t instanceof HTMLTextAreaElement?t.value:t.innerHTML}(t):t}(t);return r.data.init(n)}).then(()=>r.fire("ready")).then(()=>r))})}}Se(xa,Ps),Se(xa,Ts);class Ca{constructor(t){this.editor=t}destroy(){this.stopListening()}}Se(Ca,Qe);class Aa{constructor(t){this.files=function(t){const e=t.files?Array.from(t.files):[],n=t.items?Array.from(t.items):[];return e.length?e:n.filter(t=>"file"===t.kind).map(t=>t.getAsFile())}(t),this._native=t}get types(){return this._native.types}getData(t){return this._native.getData(t)}setData(t,e){this._native.setData(t,e)}}class Sa extends Vr{constructor(t){super(t);const e=this.document;function n(t,n){n.preventDefault();const r=n.dropRange?[n.dropRange]:Array.from(e.selection.getRanges()),i=new pe(e,"clipboardInput");e.fire(i,{dataTransfer:n.dataTransfer,targetRanges:r}),i.stop.called&&n.stopPropagation()}this.domEventType=["paste","copy","cut","drop","dragover"],this.listenTo(e,"paste",n,{priority:"low"}),this.listenTo(e,"drop",n,{priority:"low"})}onDomEvent(t){const e={dataTransfer:new Aa(t.clipboardData?t.clipboardData:t.dataTransfer)};"drop"==t.type&&(e.dropRange=function(t,e){const n=e.target.ownerDocument,r=e.clientX,i=e.clientY;let o;return n.caretRangeFromPoint&&n.caretRangeFromPoint(r,i)?o=n.caretRangeFromPoint(r,i):e.rangeParent&&((o=n.createRange()).setStart(e.rangeParent,e.rangeOffset),o.collapse(!0)),o?t.domConverter.domRangeToView(o):t.document.selection.getFirstRange()}(this.view,t)),this.fire(t.type,t,e)}}const Ea=["figcaption","li"];class Oa extends Ca{static get pluginName(){return"Clipboard"}init(){const t=this.editor,e=t.model.document,n=t.editing.view,r=n.document;function i(n,i){const o=i.dataTransfer;i.preventDefault();const s=t.data.toView(t.model.getSelectedContent(e.selection));r.fire("clipboardOutput",{dataTransfer:o,content:s,method:n.name})}this._htmlDataProcessor=new Is,n.addObserver(Sa),this.listenTo(r,"clipboardInput",e=>{t.isReadOnly&&e.stop()},{priority:"highest"}),this.listenTo(r,"clipboardInput",(t,e)=>{const r=e.dataTransfer;let i="";r.getData("text/html")?i=function(t){return r.getData("text/html").replace(/(\s+)<\/span>/g,(t,e)=>1==e.length?" ":e)}():r.getData("text/plain")&&(i=function(t){return(t=t.replace(//g,">").replace(/\n\n/g,"

").replace(/\n/g,"
").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g,"  ")).indexOf("

")>-1&&(t=`

${t}

`),t}(r.getData("text/plain"))),i=this._htmlDataProcessor.toView(i),this.fire("inputTransformation",{content:i,dataTransfer:r}),n.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(t,e)=>{if(!e.content.isEmpty){const t=this.editor.model,n=this.editor.data.toModel(e.content,"$clipboardHolder");if(0==n.childCount)return;t.insertContent(n)}},{priority:"low"}),this.listenTo(r,"copy",i,{priority:"low"}),this.listenTo(r,"cut",(e,n)=>{t.isReadOnly?n.preventDefault():i(e,n)},{priority:"low"}),this.listenTo(r,"clipboardOutput",(n,r)=>{r.content.isEmpty||(r.dataTransfer.setData("text/html",this._htmlDataProcessor.toData(r.content)),r.dataTransfer.setData("text/plain",function t(e){let n="";if(e.is("text")||e.is("textProxy"))n=e.data;else if(e.is("img")&&e.hasAttribute("alt"))n=e.getAttribute("alt");else{let r=null;for(const i of e.getChildren()){const e=t(i);r&&(r.is("containerElement")||i.is("containerElement"))&&(Ea.includes(r.name)||Ea.includes(i.name)?n+="\n":n+="\n\n"),n+=e,r=i}}return n}(r.content))),"cut"==r.method&&t.model.deleteContent(e.selection)},{priority:"low"})}}class Pa{constructor(t){this.editor=t,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",t=>{this.isEnabled||t.stop()},{priority:"high"}),this.listenTo(t,"change:isReadOnly",(t,e,n)=>{n?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")})}refresh(){this.isEnabled=!0}forceDisabled(t){this._disableStack.add(t),1==this._disableStack.size&&(this.on("set:isEnabled",Ta,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(t){this._disableStack.delete(t),0==this._disableStack.size&&(this.off("set:isEnabled",Ta),this.refresh())}execute(){}destroy(){this.stopListening()}}function Ta(t){t.return=!1,t.stop()}Se(Pa,Qe);class Na extends Pa{execute(){const t=this.editor.model,e=t.document;t.change(n=>{!function(t,e,n,r){const i=n.isCollapsed,o=n.getFirstRange(),s=o.start.parent,a=o.end.parent;if(r.isLimit(s)||r.isLimit(a))i||s!=a||t.deleteContent(n);else if(i)Ia(e,o.start);else{const r=!(o.start.isAtStart&&o.end.isAtEnd),i=s==a;t.deleteContent(n,{leaveUnmerged:r}),r&&(i?Ia(e,n.focus):e.setSelection(a,0))}}(this.editor.model,n,e.selection,t.schema),this.fire("afterExecute",{writer:n})})}}function Ia(t,e){t.split(e),t.setSelection(e.parent.nextSibling,0)}class Ma extends _r{constructor(t){super(t);const e=this.document;e.on("keydown",(t,n)=>{if(this.isEnabled&&n.keyCode==En.enter){let r;e.once("enter",t=>r=t,{priority:"highest"}),e.fire("enter",new Br(e,n.domEvent,{isSoft:n.shiftKey})),r&&r.stop.called&&t.stop()}})}observe(){}}class Da extends Ca{static get pluginName(){return"Enter"}init(){const t=this.editor,e=t.editing.view,n=e.document;e.addObserver(Ma),t.commands.add("enter",new Na(t)),this.listenTo(n,"enter",(n,r)=>{r.preventDefault(),r.isSoft||(t.execute("enter"),e.scrollToTheSelection())},{priority:"low"})}}class ja extends Pa{execute(){const t=this.editor.model,e=t.document;t.change(n=>{!function(t,e,n){const r=n.isCollapsed,i=n.getFirstRange(),o=i.end.parent,s=i.start.parent==o;if(r)La(e,i.end);else{const r=!(i.start.isAtStart&&i.end.isAtEnd);t.deleteContent(n,{leaveUnmerged:r}),s?La(e,n.focus):r&&e.setSelection(o,0)}}(t,n,e.selection),this.fire("afterExecute",{writer:n})})}refresh(){const t=this.editor.model;this.isEnabled=function(t,e){if(e.rangeCount>1)return!1;const n=e.anchor;if(!n||!t.checkChild(n,"softBreak"))return!1;const r=e.getFirstRange(),i=r.start.parent,o=r.end.parent;return!Ra(i,t)&&!Ra(o,t)||i===o}(t.schema,t.document.selection)}}function La(t,e){const n=t.createElement("softBreak");t.insert(n,e),t.setSelection(n,"after")}function Ra(t,e){return!t.is("rootElement")&&(e.isLimit(t)||Ra(t.parent,e))}class Fa extends Ca{static get pluginName(){return"ShiftEnter"}init(){const t=this.editor,e=t.conversion,n=t.editing.view,r=n.document;t.model.schema.register("softBreak",{allowWhere:"$text",isInline:!0}),e.for("upcast").elementToElement({model:"softBreak",view:"br"}),e.for("downcast").elementToElement({model:"softBreak",view:(t,e)=>e.createEmptyElement("br")}),n.addObserver(Ma),t.commands.add("shiftEnter",new ja(t)),this.listenTo(r,"enter",(e,r)=>{r.preventDefault(),r.isSoft&&(t.execute("shiftEnter"),n.scrollToTheSelection())},{priority:"low"})}}class Ba{constructor(t,e=20){this.model=t,this.size=0,this.limit=e,this.isLocked=!1,this._changeCallback=((t,e)=>{"transparent"!=e.type&&e!==this._batch&&this._reset(!0)}),this._selectionChangeCallback=(()=>{this._reset()}),this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch()),this._batch}input(t){this.size+=t,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(t){this.isLocked&&!t||(this._batch=null,this.size=0)}}class Va extends Pa{constructor(t,e){super(t),this._buffer=new Ba(t.model,e)}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(t={}){const e=this.editor.model,n=e.document,r=t.text||"",i=r.length,o=t.range||n.selection.getFirstRange(),s=t.resultRange;e.enqueueChange(this._buffer.batch,t=>{const a=o.isCollapsed;this._buffer.lock(),e.deleteContent(e.createSelection(o)),r&&e.insertContent(t.createText(r,n.selection.getAttributes()),o.start),s?t.setSelection(s):a&&t.setSelection(o.start.getShiftedBy(i)),this._buffer.unlock(),this._buffer.input(i)})}}const qa=[On("arrowUp"),On("arrowRight"),On("arrowDown"),On("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 kp=112;kp<=135;kp++)qa.push(kp);function za(t){if(0==t.length)return!1;for(const e of t)if("children"===e.type&&!Ua(e))return!0;return!1}function Ua(t){if(t.newChildren.length-t.oldChildren.length!=1)return;const e=function(t,e){const n=[];let r,i=0;return t.forEach(t=>{"equal"==t?(o(),i++):"insert"==t?(s("insert")?r.values.push(e[i]):(o(),r={type:"insert",index:i,values:[e[i]]}),i++):s("delete")?r.howMany++:(o(),r={type:"delete",index:i,howMany:1})}),o(),n;function o(){r&&(n.push(r),r=null)}function s(t){return r&&r.type==t}}(ir(t.oldChildren,t.newChildren,Ha),t.newChildren);if(e.length>1)return;const n=e[0];return n.values[0]&&n.values[0].is("text")?n:void 0}function Ha(t,e){return t&&t.is("text")&&e&&e.is("text")?t.data===e.data:t===e}class Wa{constructor(t){this.editor=t,this.editing=this.editor.editing}handle(t,e){if(za(t))this._handleContainerChildrenMutations(t,e);else for(const n of t)this._handleTextMutation(n,e),this._handleTextNodeInsertion(n)}_handleContainerChildrenMutations(t,e){const n=function(t){const e=t.map(t=>t.node).reduce((t,e)=>t.getCommonAncestor(e,{includeSelf:!0}));if(e)return e.getAncestors({includeSelf:!0,parentFirst:!0}).find(t=>t.is("containerElement")||t.is("rootElement"))}(t);if(!n)return;const r=this.editor.editing.view.domConverter.mapViewToDom(n),i=new pr,o=this.editor.data.toModel(i.domToView(r)).getChild(0),s=this.editor.editing.mapper.toModelElement(n);if(!s)return;const a=Array.from(o.getChildren()),l=Array.from(s.getChildren()),u=a[a.length-1],c=l[l.length-1];u&&u.is("softBreak")&&c&&!c.is("softBreak")&&a.pop();const d=this.editor.model.schema;if(!Ga(a,d)||!Ga(l,d))return;const h=a.map(t=>t.is("text")?t.data:"@").join("").replace(/\u00A0/g," "),f=l.map(t=>t.is("text")?t.data:"@").join("").replace(/\u00A0/g," ");if(f===h)return;const p=ir(f,h),{firstChangeAt:g,insertions:m,deletions:v}=Ya(p);let y=null;e&&(y=this.editing.mapper.toModelRange(e.getFirstRange()));const b=h.substr(g,m),w=this.editor.model.createRange(this.editor.model.createPositionAt(s,g),this.editor.model.createPositionAt(s,g+v));this.editor.execute("input",{text:b,range:w,resultRange:y})}_handleTextMutation(t,e){if("text"!=t.type)return;const n=t.newText.replace(/\u00A0/g," "),r=t.oldText.replace(/\u00A0/g," ");if(r===n)return;const i=ir(r,n),{firstChangeAt:o,insertions:s,deletions:a}=Ya(i);let l=null;e&&(l=this.editing.mapper.toModelRange(e.getFirstRange()));const u=this.editing.view.createPositionAt(t.node,o),c=this.editing.mapper.toModelPosition(u),d=this.editor.model.createRange(c,c.getShiftedBy(a)),h=n.substr(o,s);this.editor.execute("input",{text:h,range:d,resultRange:l})}_handleTextNodeInsertion(t){if("children"!=t.type)return;const e=Ua(t),n=this.editing.view.createPositionAt(t.node,e.index),r=this.editing.mapper.toModelPosition(n);this.editor.execute("input",{text:e.values[0].data.replace(/\u00A0/g," "),range:this.editor.model.createRange(r)})}}function Ga(t,e){return t.every(t=>e.isInline(t))}function Ya(t){let e=null,n=null;for(let o=0;o{n.deleteContent(n.document.selection)}),t.unlock()}r.document.on("keydown",(t,s)=>(function(t){const s=n.document,a=r.document.isComposing,l=e&&e.isEqual(s.selection);e=null,i.isEnabled&&(function(t){return!!t.ctrlKey||qa.includes(t.keyCode)}(t)||s.selection.isCollapsed||a&&229===t.keyCode||!a&&229===t.keyCode&&l||o())})(s),{priority:"lowest"}),r.document.on("compositionstart",function(){const t=n.document,e=1!==t.selection.rangeCount||t.selection.getFirstRange().isFlat;t.selection.isCollapsed||e||o()},{priority:"lowest"}),r.document.on("compositionend",()=>{e=n.createSelection(n.document.selection)},{priority:"lowest"})}(t),function(t){t.editing.view.document.on("mutations",(e,n,r)=>{new Wa(t).handle(n,r)})}(t)}}class $a extends Pa{constructor(t,e){super(t),this.direction=e,this._buffer=new Ba(t.model,t.config.get("typing.undoStep"))}get buffer(){return this._buffer}execute(t={}){const e=this.editor.model,n=e.document;e.enqueueChange(this._buffer.batch,r=>{this._buffer.lock();const i=r.createSelection(n.selection),o=i.isCollapsed;if(i.isCollapsed&&e.modifySelection(i,{direction:this.direction,unit:t.unit}),this._shouldEntireContentBeReplacedWithParagraph(t.sequence||1))return void this._replaceEntireContentWithParagraph(r);if(i.isCollapsed)return;let s=0;i.getFirstRange().getMinimalFlatRanges().forEach(t=>{s+=hn(t.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))}),e.deleteContent(i,{doNotResetEntireContent:o}),this._buffer.input(s),r.setSelection(i),this._buffer.unlock()})}_shouldEntireContentBeReplacedWithParagraph(t){if(t>1)return!1;const e=this.editor.model,n=e.document.selection,r=e.schema.getLimitElement(n);if(!n.isCollapsed||!n.containsEntireContent(r))return!1;if(!e.schema.checkChild(r,"paragraph"))return!1;const i=r.getChild(0);return!i||"paragraph"!==i.name}_replaceEntireContentWithParagraph(t){const e=this.editor.model,n=e.schema.getLimitElement(e.document.selection),r=t.createElement("paragraph");t.remove(t.createRangeIn(n)),t.insert(r,n),t.setSelection(r,0)}}class Za extends _r{constructor(t){super(t);const e=t.document;let n=0;e.on("keyup",(t,e)=>{e.keyCode!=En.delete&&e.keyCode!=En.backspace||(n=0)}),e.on("keydown",(t,r)=>{const i={};if(r.keyCode==En.delete)i.direction="forward",i.unit="character";else{if(r.keyCode!=En.backspace)return;i.direction="backward",i.unit="codePoint"}let o;i.unit=(Cn.isMac?r.altKey:r.ctrlKey)?"word":i.unit,i.sequence=++n,e.once("delete",t=>o=t,{priority:Number.POSITIVE_INFINITY});const s=new Br(e,r.domEvent,i);e.fire("delete",s),o&&o.stop.called&&t.stop()})}observe(){}}function Qa(t){return t.every(t=>t.is("containerElement"))}class Ja extends Ca{static get pluginName(){return"Delete"}init(){const t=this.editor,e=t.editing.view,n=e.document;e.addObserver(Za),t.commands.add("forwardDelete",new $a(t,"forward")),t.commands.add("delete",new $a(t,"backward")),this.listenTo(n,"delete",(n,r)=>{t.execute("forward"==r.direction?"forwardDelete":"delete",{unit:r.unit,sequence:r.sequence}),r.preventDefault(),e.scrollToTheSelection()}),function(t){const e=t.model,n=t.editing.view;let r=null,i=e.createSelection(e.document.selection),o=Date.now();e.document.selection.on("change",function(t){const n=e.createSelection(t.source);i.isEqual(n)||(r=i,i=n,o=Date.now())}),n.document.on("mutations",function(n,s){za(s)&&function(t){for(const e of t){if("children"!==e.type)continue;const t=e.oldChildren,n=e.newChildren;if(!Qa(t))continue;const r=ir(t,n),i=r.some(t=>"delete"===t),o=r.some(t=>"insert"===t);if(i&&!o)return!0}return!1}(s)&&(Date.now()-o<200&&r&&!r.isCollapsed&&i.isCollapsed&&i.getLastPosition().isEqual(r.getLastPosition())&&e.enqueueChange(t=>{t.setSelection(r)}),t.execute("delete"),n.stop())},{priority:"highest"})}(t)}}class Xa extends Ca{static get requires(){return[Ka,Ja]}static get pluginName(){return"Typing"}}class tl extends Po{get type(){return"noop"}clone(){return new tl(this.baseVersion)}getReversed(){return new tl(this.baseVersion+1)}_execute(){}static get className(){return"NoOperation"}}const el=new Map;function nl(t,e,n){let r=el.get(t);r||(r=new Map,el.set(t,r)),r.set(e,n)}function rl(t){return[t]}function il(t,e,n={}){const r=function(t,e){const n=el.get(t);return n&&n.has(e)?n.get(e):rl}(t.constructor,e.constructor);try{return r(t=t.clone(),e,n)}catch(r){throw Xr.a.error("Error during operation transformation!",r.message),Xr.a.error("Transformed operation",t),Xr.a.error("Operation transformed by",e),Xr.a.error("context.aIsStrong",n.aIsStrong),Xr.a.error("context.aWasUndone",n.aWasUndone),Xr.a.error("context.bWasUndone",n.bWasUndone),Xr.a.error("context.abRelation",n.abRelation),Xr.a.error("context.baRelation",n.baRelation),r}}function ol(t,e,n){if(t=t.slice(),e=e.slice(),0==t.length||0==e.length)return{operationsA:t,operationsB:e};const r=new WeakMap;for(const a of t)r.set(a,0);const i={nextBaseVersionA:t[t.length-1].baseVersion+1,nextBaseVersionB:e[e.length-1].baseVersion+1,originalOperationsACount:t.length,originalOperationsBCount:e.length},o=new sl(n.document,n.useRelations,n.forceWeakRemove);o.setOriginalOperations(t),o.setOriginalOperations(e);let s=0;for(;s{if(t.key===e.key){const r=t.range.getDifference(e.range).map(e=>new Bo(e,t.key,t.oldValue,t.newValue,0)),i=t.range.getIntersection(e.range);return i&&n.aIsStrong&&r.push(new Bo(i,e.key,e.newValue,t.newValue,0)),0==r.length?[new tl(0)]:r}return[t]}),nl(Bo,zo,(t,e)=>{if(t.range.start.hasSameParentAs(e.position)&&t.range.containsPosition(e.position)){const n=t.range._getTransformedByInsertion(e.position,e.howMany,!e.shouldReceiveAttributes).map(e=>new Bo(e,t.key,t.oldValue,t.newValue,t.baseVersion));if(e.shouldReceiveAttributes){const r=ul(e,t.key,t.oldValue);r&&n.unshift(r)}return n}return t.range=t.range._getTransformedByInsertion(e.position,e.howMany,!1)[0],[t]}),nl(Bo,Go,(t,e)=>{const n=[];t.range.start.hasSameParentAs(e.deletionPosition)&&(t.range.containsPosition(e.deletionPosition)||t.range.start.isEqual(e.deletionPosition))&&n.push(Ti._createFromPositionAndShift(e.graveyardPosition,1));const r=t.range._getTransformedByMergeOperation(e);return r.isCollapsed||n.push(r),n.map(e=>new Bo(e,t.key,t.oldValue,t.newValue,t.baseVersion))}),nl(Bo,qo,(t,e)=>(function(t,e){const n=Ti._createFromPositionAndShift(e.sourcePosition,e.howMany);let r=null,i=[];n.containsRange(t,!0)?r=t:t.start.hasSameParentAs(n.start)?(i=t.getDifference(n),r=t.getIntersection(n)):i=[t];const o=[];for(let s of i){s=s._getTransformedByDeletion(e.sourcePosition,e.howMany);const t=e.getMovedRangeStart(),n=s.start.hasSameParentAs(t);s=s._getTransformedByInsertion(t,e.howMany,n),o.push(...s)}return r&&o.push(r._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany,!1)[0]),o})(t.range,e).map(e=>new Bo(e,t.key,t.oldValue,t.newValue,t.baseVersion))),nl(Bo,Yo,(t,e)=>{if(t.range.end.isEqual(e.insertionPosition))return e.graveyardPosition||t.range.end.offset++,[t];if(t.range.start.hasSameParentAs(e.splitPosition)&&t.range.containsPosition(e.splitPosition)){const n=t.clone();return n.range=new Ti(e.moveTargetPosition.clone(),t.range.end._getCombined(e.splitPosition,e.moveTargetPosition)),t.range.end=e.splitPosition.clone(),t.range.end.stickiness="toPrevious",[t,n]}return t.range=t.range._getTransformedBySplitOperation(e),[t]}),nl(zo,Bo,(t,e)=>{const n=[t];if(t.shouldReceiveAttributes&&t.position.hasSameParentAs(e.range.start)&&e.range.containsPosition(t.position)){const r=ul(t,e.key,e.newValue);r&&n.push(r)}return n}),nl(zo,zo,(t,e,n)=>t.position.isEqual(e.position)&&n.aIsStrong?[t]:(t.position=t.position._getTransformedByInsertOperation(e),[t])),nl(zo,qo,(t,e)=>(t.position=t.position._getTransformedByMoveOperation(e),[t])),nl(zo,Yo,(t,e)=>(t.position=t.position._getTransformedBySplitOperation(e),[t])),nl(zo,Go,(t,e)=>(t.position=t.position._getTransformedByMergeOperation(e),[t])),nl(Uo,zo,(t,e)=>(t.oldRange&&(t.oldRange=t.oldRange._getTransformedByInsertOperation(e)[0]),t.newRange&&(t.newRange=t.newRange._getTransformedByInsertOperation(e)[0]),[t])),nl(Uo,Uo,(t,e,n)=>{if(t.name==e.name){if(!n.aIsStrong)return[new tl(0)];t.oldRange=e.newRange?e.newRange.clone():null}return[t]}),nl(Uo,Go,(t,e)=>(t.oldRange&&(t.oldRange=t.oldRange._getTransformedByMergeOperation(e)),t.newRange&&(t.newRange=t.newRange._getTransformedByMergeOperation(e)),[t])),nl(Uo,qo,(t,e,n)=>{if(t.oldRange&&(t.oldRange=Ti._createFromRanges(t.oldRange._getTransformedByMoveOperation(e))),t.newRange){if(n.abRelation){const r=Ti._createFromRanges(t.newRange._getTransformedByMoveOperation(e));if("left"==n.abRelation.side&&e.targetPosition.isEqual(t.newRange.start))return t.newRange.start.path=n.abRelation.path,t.newRange.end=r.end,[t];if("right"==n.abRelation.side&&e.targetPosition.isEqual(t.newRange.end))return t.newRange.start=r.start,t.newRange.end.path=n.abRelation.path,[t]}t.newRange=Ti._createFromRanges(t.newRange._getTransformedByMoveOperation(e))}return[t]}),nl(Uo,Yo,(t,e,n)=>{if(t.oldRange&&(t.oldRange=t.oldRange._getTransformedBySplitOperation(e)),t.newRange){if(n.abRelation){const r=t.newRange._getTransformedBySplitOperation(e);return t.newRange.start.isEqual(e.splitPosition)&&n.abRelation.wasStartBeforeMergedElement?t.newRange.start=Pi._createAt(e.insertionPosition):t.newRange.start.isEqual(e.splitPosition)&&!n.abRelation.wasInLeftElement&&(t.newRange.start=Pi._createAt(e.moveTargetPosition)),t.newRange.end=t.newRange.end.isEqual(e.splitPosition)&&n.abRelation.wasInRightElement?Pi._createAt(e.moveTargetPosition):t.newRange.end.isEqual(e.splitPosition)&&n.abRelation.wasEndBeforeMergedElement?Pi._createAt(e.insertionPosition):r.end,[t]}t.newRange=t.newRange._getTransformedBySplitOperation(e)}return[t]}),nl(Go,zo,(t,e)=>(t.sourcePosition.hasSameParentAs(e.position)&&(t.howMany+=e.howMany),t.sourcePosition=t.sourcePosition._getTransformedByInsertOperation(e),t.targetPosition=t.targetPosition._getTransformedByInsertOperation(e),[t])),nl(Go,Go,(t,e,n)=>{if(t.sourcePosition.isEqual(e.sourcePosition)&&t.targetPosition.isEqual(e.targetPosition)){if(n.bWasUndone){const n=e.graveyardPosition.path.slice();return n.push(0),t.sourcePosition=new Pi(e.graveyardPosition.root,n),t.howMany=0,[t]}return[new tl(0)]}if(t.sourcePosition.isEqual(e.sourcePosition)&&!t.targetPosition.isEqual(e.targetPosition)&&!n.bWasUndone&&"splitAtSource"!=n.abRelation){const r="$graveyard"==t.targetPosition.root.rootName,i="$graveyard"==e.targetPosition.root.rootName;if(i&&!r||(!r||i)&&n.aIsStrong){const n=e.targetPosition._getTransformedByMergeOperation(e),r=t.targetPosition._getTransformedByMergeOperation(e);return[new qo(n,t.howMany,r,0)]}return[new tl(0)]}return t.sourcePosition.hasSameParentAs(e.targetPosition)&&(t.howMany+=e.howMany),t.sourcePosition=t.sourcePosition._getTransformedByMergeOperation(e),t.targetPosition=t.targetPosition._getTransformedByMergeOperation(e),t.graveyardPosition.isEqual(e.graveyardPosition)&&n.aIsStrong||(t.graveyardPosition=t.graveyardPosition._getTransformedByMergeOperation(e)),[t]}),nl(Go,qo,(t,e,n)=>{const r=Ti._createFromPositionAndShift(e.sourcePosition,e.howMany);return"remove"==e.type&&!n.bWasUndone&&!n.forceWeakRemove&&t.deletionPosition.hasSameParentAs(e.sourcePosition)&&r.containsPosition(t.sourcePosition)?[new tl(0)]:(t.sourcePosition.hasSameParentAs(e.targetPosition)&&(t.howMany+=e.howMany),t.sourcePosition.hasSameParentAs(e.sourcePosition)&&(t.howMany-=e.howMany),t.sourcePosition=t.sourcePosition._getTransformedByMoveOperation(e),t.targetPosition=t.targetPosition._getTransformedByMoveOperation(e),t.graveyardPosition.isEqual(e.targetPosition)||(t.graveyardPosition=t.graveyardPosition._getTransformedByMoveOperation(e)),[t])}),nl(Go,Yo,(t,e,n)=>{if(e.graveyardPosition&&(t.graveyardPosition=t.graveyardPosition._getTransformedByDeletion(e.graveyardPosition,1),t.deletionPosition.isEqual(e.graveyardPosition)&&(t.howMany=e.howMany)),t.targetPosition.isEqual(e.splitPosition)){const r=0!=e.howMany,i=e.graveyardPosition&&t.deletionPosition.isEqual(e.graveyardPosition);if(r||i||"mergeTargetNotMoved"==n.abRelation)return t.sourcePosition=t.sourcePosition._getTransformedBySplitOperation(e),[t]}if(t.sourcePosition.isEqual(e.splitPosition)){if("mergeSourceNotMoved"==n.abRelation)return t.howMany=0,t.targetPosition=t.targetPosition._getTransformedBySplitOperation(e),[t];if("mergeSameElement"==n.abRelation||t.sourcePosition.offset>0)return t.sourcePosition=e.moveTargetPosition.clone(),t.targetPosition=t.targetPosition._getTransformedBySplitOperation(e),[t]}return t.sourcePosition.hasSameParentAs(e.splitPosition)&&(t.howMany=e.splitPosition.offset),t.sourcePosition=t.sourcePosition._getTransformedBySplitOperation(e),t.targetPosition=t.targetPosition._getTransformedBySplitOperation(e),[t]}),nl(qo,zo,(t,e)=>{const n=Ti._createFromPositionAndShift(t.sourcePosition,t.howMany)._getTransformedByInsertOperation(e,!1)[0];return t.sourcePosition=n.start,t.howMany=n.end.offset-n.start.offset,t.targetPosition.isEqual(e.position)||(t.targetPosition=t.targetPosition._getTransformedByInsertOperation(e)),[t]}),nl(qo,qo,(t,e,n)=>{const r=Ti._createFromPositionAndShift(t.sourcePosition,t.howMany),i=Ti._createFromPositionAndShift(e.sourcePosition,e.howMany);let o,s=n.aIsStrong,a=!n.aIsStrong;if("insertBefore"==n.abRelation||"insertAfter"==n.baRelation?a=!0:"insertAfter"!=n.abRelation&&"insertBefore"!=n.baRelation||(a=!1),o=t.targetPosition.isEqual(e.targetPosition)&&a?t.targetPosition._getTransformedByDeletion(e.sourcePosition,e.howMany):t.targetPosition._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),cl(t,e)&&cl(e,t))return[e.getReversed()];if(r.containsPosition(e.targetPosition)&&r.containsRange(i,!0))return r.start=r.start._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),r.end=r.end._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),dl([r],o);if(i.containsPosition(t.targetPosition)&&i.containsRange(r,!0))return r.start=r.start._getCombined(e.sourcePosition,e.getMovedRangeStart()),r.end=r.end._getCombined(e.sourcePosition,e.getMovedRangeStart()),dl([r],o);const l=Ee(t.sourcePosition.getParentPath(),e.sourcePosition.getParentPath());if("prefix"==l||"extension"==l)return r.start=r.start._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),r.end=r.end._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),dl([r],o);"remove"!=t.type||"remove"==e.type||n.aWasUndone||n.forceWeakRemove?"remove"==t.type||"remove"!=e.type||n.bWasUndone||n.forceWeakRemove||(s=!1):s=!0;const u=[],c=r.getDifference(i);for(const h of c){h.start=h.start._getTransformedByDeletion(e.sourcePosition,e.howMany),h.end=h.end._getTransformedByDeletion(e.sourcePosition,e.howMany);const t="same"==Ee(h.start.getParentPath(),e.getMovedRangeStart().getParentPath()),n=h._getTransformedByInsertion(e.getMovedRangeStart(),e.howMany,t);u.push(...n)}const d=r.getIntersection(i);return null!==d&&s&&(d.start=d.start._getCombined(e.sourcePosition,e.getMovedRangeStart()),d.end=d.end._getCombined(e.sourcePosition,e.getMovedRangeStart()),0===u.length?u.push(d):1==u.length?i.start.isBefore(r.start)||i.start.isEqual(r.start)?u.unshift(d):u.push(d):u.splice(1,0,d)),0===u.length?[new tl(t.baseVersion)]:dl(u,o)}),nl(qo,Yo,(t,e,n)=>{let r=t.targetPosition.clone();t.targetPosition.isEqual(e.insertionPosition)&&e.graveyardPosition&&"moveTargetAfter"!=n.abRelation||(r=t.targetPosition._getTransformedBySplitOperation(e));const i=Ti._createFromPositionAndShift(t.sourcePosition,t.howMany);if(i.end.isEqual(e.insertionPosition))return e.graveyardPosition||t.howMany++,t.targetPosition=r,[t];if(i.start.hasSameParentAs(e.splitPosition)&&i.containsPosition(e.splitPosition)){let t=new Ti(e.splitPosition,i.end);return t=t._getTransformedBySplitOperation(e),dl([new Ti(i.start,e.splitPosition),t],r)}t.targetPosition.isEqual(e.splitPosition)&&"insertAtSource"==n.abRelation&&(r=e.moveTargetPosition),t.targetPosition.isEqual(e.insertionPosition)&&"insertBetween"==n.abRelation&&(r=t.targetPosition);const o=[i._getTransformedBySplitOperation(e)];if(e.graveyardPosition){const r=i.start.isEqual(e.graveyardPosition)||i.containsPosition(e.graveyardPosition);t.howMany>1&&r&&!n.aWasUndone&&o.push(Ti._createFromPositionAndShift(e.insertionPosition,1))}return dl(o,r)}),nl(qo,Go,(t,e,n)=>{const r=Ti._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.deletionPosition.hasSameParentAs(t.sourcePosition)&&r.containsPosition(e.sourcePosition))if("remove"!=t.type||n.forceWeakRemove){if(1==t.howMany)return n.bWasUndone?(t.sourcePosition=e.graveyardPosition.clone(),t.targetPosition=t.targetPosition._getTransformedByMergeOperation(e),[t]):[new tl(0)]}else if(!n.aWasUndone){const n=[];let r=e.graveyardPosition.clone(),i=e.targetPosition._getTransformedByMergeOperation(e);t.howMany>1&&(n.push(new qo(t.sourcePosition,t.howMany-1,t.targetPosition,0)),r=r._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany-1),i=i._getTransformedByMove(t.sourcePosition,t.targetPosition,t.howMany-1));const o=e.deletionPosition._getCombined(t.sourcePosition,t.targetPosition),s=new qo(r,1,o,0),a=s.getMovedRangeStart().path.slice();a.push(0);const l=new Pi(s.targetPosition.root,a);i=i._getTransformedByMove(r,o,1);const u=new qo(i,e.howMany,l,0);return n.push(s),n.push(u),n}const i=Ti._createFromPositionAndShift(t.sourcePosition,t.howMany)._getTransformedByMergeOperation(e);return t.sourcePosition=i.start,t.howMany=i.end.offset-i.start.offset,t.targetPosition=t.targetPosition._getTransformedByMergeOperation(e),[t]}),nl(Ho,zo,(t,e)=>(t.position=t.position._getTransformedByInsertOperation(e),[t])),nl(Ho,Go,(t,e)=>t.position.isEqual(e.deletionPosition)?(t.position=e.graveyardPosition.clone(),t.position.stickiness="toNext",[t]):(t.position=t.position._getTransformedByMergeOperation(e),[t])),nl(Ho,qo,(t,e)=>(t.position=t.position._getTransformedByMoveOperation(e),[t])),nl(Ho,Ho,(t,e,n)=>{if(t.position.isEqual(e.position)){if(!n.aIsStrong)return[new tl(0)];t.oldName=e.newName}return[t]}),nl(Ho,Yo,(t,e)=>"same"!=Ee(t.position.path,e.splitPosition.getParentPath())||e.graveyardPosition?(t.position=t.position._getTransformedBySplitOperation(e),[t]):[t,new Ho(t.position.getShiftedBy(1),t.oldName,t.newName,0)]),nl(Wo,Wo,(t,e,n)=>{if(t.root===e.root&&t.key===e.key){if(!n.aIsStrong||t.newValue===e.newValue)return[new tl(0)];t.oldValue=e.newValue}return[t]}),nl(Yo,zo,(t,e)=>(t.splitPosition.hasSameParentAs(e.position)&&t.splitPosition.offset{if(!t.graveyardPosition&&!n.bWasUndone&&t.splitPosition.hasSameParentAs(e.sourcePosition)){const n=e.graveyardPosition.path.slice();n.push(0);const r=new Pi(e.graveyardPosition.root,n),i=Yo.getInsertionPosition(new Pi(e.graveyardPosition.root,n)),o=new Yo(r,0,null,0);return o.insertionPosition=i,t.splitPosition=t.splitPosition._getTransformedByMergeOperation(e),t.insertionPosition=Yo.getInsertionPosition(t.splitPosition),t.graveyardPosition=o.insertionPosition.clone(),t.graveyardPosition.stickiness="toNext",[o,t]}return t.splitPosition.hasSameParentAs(e.deletionPosition)&&!t.splitPosition.isAfter(e.deletionPosition)&&t.howMany--,t.splitPosition.hasSameParentAs(e.targetPosition)&&(t.howMany+=e.howMany),t.splitPosition=t.splitPosition._getTransformedByMergeOperation(e),t.insertionPosition=Yo.getInsertionPosition(t.splitPosition),t.graveyardPosition&&(t.graveyardPosition=t.graveyardPosition._getTransformedByMergeOperation(e)),[t]}),nl(Yo,qo,(t,e,n)=>{const r=Ti._createFromPositionAndShift(e.sourcePosition,e.howMany);if(t.graveyardPosition){const i=r.start.isEqual(t.graveyardPosition)||r.containsPosition(t.graveyardPosition);if(!n.bWasUndone&&i){const n=t.splitPosition._getTransformedByMoveOperation(e),r=t.graveyardPosition._getTransformedByMoveOperation(e),i=r.path.slice();i.push(0);const o=new Pi(r.root,i);return[new qo(n,t.howMany,o,0)]}t.graveyardPosition=t.graveyardPosition._getTransformedByMoveOperation(e)}return t.splitPosition.hasSameParentAs(e.sourcePosition)&&r.containsPosition(t.splitPosition)?(t.howMany-=e.howMany-(t.splitPosition.offset-e.sourcePosition.offset),t.splitPosition.hasSameParentAs(e.targetPosition)&&t.splitPosition.offset{if(t.splitPosition.isEqual(e.splitPosition)){if(!t.graveyardPosition&&!e.graveyardPosition)return[new tl(0)];if(t.graveyardPosition&&e.graveyardPosition&&t.graveyardPosition.isEqual(e.graveyardPosition))return[new tl(0)];if("splitBefore"==n.abRelation)return t.howMany=0,t.graveyardPosition=t.graveyardPosition._getTransformedBySplitOperation(e),[t]}if(t.graveyardPosition&&e.graveyardPosition&&t.graveyardPosition.isEqual(e.graveyardPosition)){const r="$graveyard"==t.splitPosition.root.rootName,i="$graveyard"==e.splitPosition.root.rootName;if(i&&!r||(!r||i)&&n.aIsStrong){const n=[];return e.howMany&&n.push(new qo(e.moveTargetPosition,e.howMany,e.splitPosition,0)),t.howMany&&n.push(new qo(t.splitPosition,t.howMany,t.moveTargetPosition,0)),n}return[new tl(0)]}if(t.graveyardPosition&&(t.graveyardPosition=t.graveyardPosition._getTransformedBySplitOperation(e)),t.splitPosition.isEqual(e.insertionPosition)&&"splitBefore"==n.abRelation)return t.howMany++,[t];if(e.splitPosition.isEqual(t.insertionPosition)&&"splitBefore"==n.baRelation){const n=e.insertionPosition.path.slice();n.push(0);const r=new Pi(e.insertionPosition.root,n);return[t,new qo(t.insertionPosition,1,r,0)]}return t.splitPosition.hasSameParentAs(e.splitPosition)&&t.splitPosition.offset0}addBatch(t){const e=this.editor.model.document.selection,n={ranges:e.hasOwnRange?Array.from(e.getRanges()):[],isBackward:e.isBackward};this._stack.push({batch:t,selection:n}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(t,e,n){const r=this.editor.model,i=r.document,o=[];for(const s of t){const t=fl(s,n).find(t=>t.start.root!=i.graveyard);t&&o.push(t)}o.length&&r.change(t=>{t.setSelection(o,{backward:e})})}_undo(t,e){const n=this.editor.model,r=n.document;this._createdBatches.add(e);const i=t.operations.slice().filter(t=>t.isDocumentOperation);i.reverse();for(const o of i){const t=Array.from(r.history.getOperations(o.baseVersion+1)),i=ol([o.getReversed()],t,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(const s of i)e.addOperation(s),n.applyOperation(s),r.history.setOperationAsUndone(o,s)}}}function fl(t,e){const n=t.getTransformedByOperations(e);n.sort((t,e)=>t.start.isBefore(e.start)?-1:1);for(let r=1;re.batch==t):this._stack.length-1,n=this._stack.splice(e,1)[0],r=this.editor.model.createBatch();this.editor.model.enqueueChange(r,()=>{this._undo(n.batch,r);const t=this.editor.model.document.history.getOperations(n.batch.baseVersion);this._restoreSelection(n.selection.ranges,n.selection.isBackward,t),this.fire("revert",n.batch,r)}),this.refresh()}}class gl extends hl{execute(){const t=this._stack.pop(),e=this.editor.model.createBatch();this.editor.model.enqueueChange(e,()=>{const n=this.editor.model.document.history.getOperations(t.batch.operations[t.batch.operations.length-1].baseVersion+1);this._restoreSelection(t.selection.ranges,t.selection.isBackward,n),this._undo(t.batch,e)}),this.refresh()}}class ml extends Ca{constructor(t){super(t),this._batchRegistry=new WeakSet}init(){const t=this.editor;this._undoCommand=new pl(t),this._redoCommand=new gl(t),t.commands.add("undo",this._undoCommand),t.commands.add("redo",this._redoCommand),this.listenTo(t.model,"applyOperation",(t,e)=>{const n=e[0];if(!n.isDocumentOperation)return;const r=n.batch;this._batchRegistry.has(r)||"transparent"==r.type||(this._redoCommand._createdBatches.has(r)?this._undoCommand.addBatch(r):this._undoCommand._createdBatches.has(r)||(this._undoCommand.addBatch(r),this._redoCommand.clearStack()),this._batchRegistry.add(r))},{priority:"highest"}),this.listenTo(this._undoCommand,"revert",(t,e,n)=>{this._redoCommand.addBatch(n)}),t.keystrokes.set("CTRL+Z","undo"),t.keystrokes.set("CTRL+Y","redo"),t.keystrokes.set("CTRL+SHIFT+Z","redo")}}n(60);class vl extends ua{constructor(){super();const t=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:t.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 t=(new DOMParser).parseFromString(this.content.trim(),"image/svg+xml").querySelector("svg"),e=t.getAttribute("viewBox");for(e&&(this.viewBox=e),this.element.innerHTML="";t.childNodes.length>0;)this.element.appendChild(t.childNodes[0])}}_colorFillPaths(){this.fillColor&&this.element.querySelectorAll(".ck-icon__fill").forEach(t=>{t.style.fill=this.fillColor})}}n(62);class yl extends ua{constructor(t){super(t),this.set("text",""),this.set("position","s");const e=this.bindTemplate;this.setTemplate({tag:"span",attributes:{class:["ck","ck-tooltip",e.to("position",t=>"ck-tooltip_"+t),e.if("text","ck-hidden",t=>!t.trim())]},children:[{tag:"span",attributes:{class:["ck","ck-tooltip__text"]},children:[{text:e.to("text")}]}]})}}n(64);class bl extends ua{constructor(t){super(t);const e=this.bindTemplate,n=ge();this.set("class"),this.set("labelStyle"),this.set("icon"),this.set("isEnabled",!0),this.set("isOn",!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.tooltipView=this._createTooltipView(),this.labelView=this._createLabelView(n),this.iconView=new vl,this.iconView.extendTemplate({attributes:{class:"ck-button__icon"}}),this.bind("_tooltipString").to(this,"tooltip",this,"label",this,"keystroke",this._getTooltipString.bind(this)),this.setTemplate({tag:"button",attributes:{class:["ck","ck-button",e.to("class"),e.if("isEnabled","ck-disabled",t=>!t),e.if("isVisible","ck-hidden",t=>!t),e.to("isOn",t=>t?"ck-on":"ck-off"),e.if("withText","ck-button_with-text")],type:e.to("type",t=>t||"button"),tabindex:e.to("tabindex"),"aria-labelledby":`ck-editor__aria-label_${n}`,"aria-disabled":e.if("isEnabled",!0,t=>!t),"aria-pressed":e.if("isOn",!0)},children:this.children,on:{mousedown:e.to(t=>{t.preventDefault()}),click:e.to(t=>{this.isEnabled?this.fire("execute"):t.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)}focus(){this.element.focus()}_createTooltipView(){const t=new yl;return t.bind("text").to(this,"_tooltipString"),t.bind("position").to(this,"tooltipPosition"),t}_createLabelView(t){const e=new ua;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__label"],style:this.bindTemplate.to("labelStyle"),id:`ck-editor__aria-label_${t}`},children:[{text:this.bindTemplate.to("label")}]}),e}_getTooltipString(t,e,n){return t?"string"==typeof t?t:(n&&(n=function(t){return Cn.isMac?Tn(t).map(t=>Sn[t.toLowerCase()]||t).reduce((t,e)=>t.slice(-1)in An?t+e:t+"+"+e):t}(n)),t instanceof Function?t(e,n):`${e}${n?` (${n})`:""}`):""}}var wl=n(21),_l=n.n(wl),kl=n(22),xl=n.n(kl);class Cl extends Ca{init(){const t=this.editor.t;this._addButton("undo",t("be"),"CTRL+Z",_l.a),this._addButton("redo",t("bf"),"CTRL+Y",xl.a)}_addButton(t,e,n,r){const i=this.editor;i.ui.componentFactory.add(t,o=>{const s=i.commands.get(t),a=new bl(o);return a.set({label:e,icon:r,keystroke:n,tooltip:!0}),a.bind("isEnabled").to(s,"isEnabled"),this.listenTo(a,"execute",()=>i.execute(t)),a})}}class Al extends Ca{static get requires(){return[ml,Cl]}static get pluginName(){return"Undo"}}class Sl extends Ca{static get pluginName(){return"PendingActions"}init(){this.set("hasAny",!1),this._actions=new gn({idProperty:"_id"}),this._actions.delegate("add","remove").to(this)}add(t){if("string"!=typeof t)throw new he.b("pendingactions-add-invalid-message: The message must be a string.");const e=Object.create(Qe);return e.set("message",t),this._actions.add(e),this.hasAny=!0,e}remove(t){this._actions.remove(t),this.hasAny=!!this._actions.length}get first(){return this._actions.get(0)}[Symbol.iterator](){return this._actions[Symbol.iterator]()}}class El{constructor(){const t=new window.FileReader;this._reader=t,this.set("loaded",0),t.onprogress=(t=>{this.loaded=t.loaded})}get error(){return this._reader.error}read(t){const e=this._reader;return this.total=t.size,new Promise((n,r)=>{e.onload=(()=>{n(e.result)}),e.onerror=(()=>{r("error")}),e.onabort=(()=>{r("aborted")}),this._reader.readAsDataURL(t)})}abort(){this._reader.abort()}}Se(El,Qe);class Ol extends Ca{static get pluginName(){return"FileRepository"}static get requires(){return[Sl]}init(){this.loaders=new gn,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",(t,e)=>e?t/e*100:0)}getLoader(t){return this._loadersMap.get(t)||null}createLoader(t){if(!this.createUploadAdapter)return Xr.a.error("filerepository-no-upload-adapter: Upload adapter is not defined."),null;const e=new Pl(Promise.resolve(t),this.createUploadAdapter);return this.loaders.add(e),this._loadersMap.set(t,e),t instanceof Promise&&e.file.then(t=>{this._loadersMap.set(t,e)}),e.file.catch(()=>{}),e.on("change:uploaded",()=>{let t=0;for(const e of this.loaders)t+=e.uploaded;this.uploaded=t}),e.on("change:uploadTotal",()=>{let t=0;for(const e of this.loaders)e.uploadTotal&&(t+=e.uploadTotal);this.uploadTotal=t}),e}destroyLoader(t){const e=t instanceof Pl?t:this.getLoader(t);e._destroy(),this.loaders.remove(e),this._loadersMap.forEach((t,n)=>{t===e&&this._loadersMap.delete(n)})}_updatePendingAction(){const t=this.editor.plugins.get(Sl);if(this.loaders.length){if(!this._pendingAction){const e=this.editor.t,n=t=>`${e("at")} ${parseInt(t)}%.`;this._pendingAction=t.add(n(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",n)}}else t.remove(this._pendingAction),this._pendingAction=null}}Se(Ol,Qe);class Pl{constructor(t,e){this.id=ge(),this._filePromiseWrapper=this._createFilePromiseWrapper(t),this._adapter=e(this),this._reader=new El,this.set("status","idle"),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(t,e)=>e?t/e*100:0),this.set("uploadResponse",null)}get file(){return this._filePromiseWrapper?this._filePromiseWrapper.promise.then(t=>this._filePromiseWrapper?t:null):Promise.resolve(null)}read(){if("idle"!=this.status)throw new he.b("filerepository-read-wrong-status: You cannot call read if the status is different than idle.");return this.status="reading",this._filePromiseWrapper.promise.then(t=>this._reader.read(t)).then(t=>(this.status="idle",t)).catch(t=>{if("aborted"===t)throw this.status="aborted","aborted";throw this.status="error",this._reader.error?this._reader.error:t})}upload(){if("idle"!=this.status)throw new he.b("filerepository-upload-wrong-status: You cannot call upload if the status is different than idle.");return this.status="uploading",this._filePromiseWrapper.promise.then(()=>this._adapter.upload()).then(t=>(this.uploadResponse=t,this.status="idle",t)).catch(t=>{if("aborted"===this.status)throw"aborted";throw this.status="error",t})}abort(){const t=this.status;this.status="aborted",this._filePromiseWrapper.isFulfilled?"reading"==t?this._reader.abort():"uploading"==t&&this._adapter.abort&&this._adapter.abort():this._filePromiseWrapper.rejecter("aborted"),this._destroy()}_destroy(){this._filePromiseWrapper=void 0,this._reader=void 0,this._adapter=void 0,this.data=void 0,this.uploadResponse=void 0}_createFilePromiseWrapper(t){const e={};return e.promise=new Promise((n,r)=>{e.resolver=n,e.rejecter=r,e.isFulfilled=!1,t.then(t=>{e.isFulfilled=!0,n(t)}).catch(t=>{e.isFulfilled=!0,r(t)})}),e}}Se(Pl,Qe);const Tl="ckCsrfToken",Nl=40,Il="abcdefghijklmnopqrstuvwxyz0123456789";class Ml extends Ca{static get requires(){return[Ol]}static get pluginName(){return"CKFinderUploadAdapter"}init(){const t=this.editor.config.get("ckfinder.uploadUrl");t&&(this.editor.plugins.get(Ol).createUploadAdapter=(e=>new Dl(e,t,this.editor.t)))}}class Dl{constructor(t,e,n){this.loader=t,this.url=e,this.t=n}upload(){return this.loader.file.then(t=>new Promise((e,n)=>{this._initRequest(),this._initListeners(e,n,t),this._sendRequest(t)}))}abort(){this.xhr&&this.xhr.abort()}_initRequest(){const t=this.xhr=new XMLHttpRequest;t.open("POST",this.url,!0),t.responseType="json"}_initListeners(t,e,n){const r=this.xhr,i=this.loader,o=(0,this.t)("a")+` ${n.name}.`;r.addEventListener("error",()=>e(o)),r.addEventListener("abort",()=>e()),r.addEventListener("load",()=>{const n=r.response;if(!n||!n.uploaded)return e(n&&n.error&&n.error.message?n.error.message:o);t({default:n.url})}),r.upload&&r.upload.addEventListener("progress",t=>{t.lengthComputable&&(i.uploadTotal=t.total,i.uploaded=t.loaded)})}_sendRequest(t){const e=new FormData;e.append("upload",t),e.append("ckCsrfToken",function(){let t=function(t){t=t.toLowerCase();const e=document.cookie.split(";");for(const n of e){const e=n.split("=");if(decodeURIComponent(e[0].trim().toLowerCase())===t)return decodeURIComponent(e[1])}return null}(Tl);return t&&t.length==Nl||(t=function(t){let e="";const n=new Uint8Array(Nl);window.crypto.getRandomValues(n);for(let r=0;r.5?t.toUpperCase():t}return e}(),e=t,document.cookie=encodeURIComponent(Tl)+"="+encodeURIComponent(e)+";path=/"),t;var e}()),this.xhr.send(e)}}class jl{constructor(t,e,n){let r,i=null;"function"==typeof n?r=n:(i=t.commands.get(n),r=(()=>{t.execute(n)})),t.model.document.on("change",(n,o)=>{if(i&&!i.isEnabled)return;if("transparent"==o.type)return;const s=Array.from(t.model.document.differ.getChanges()),a=s[0];if(1!=s.length||"insert"!==a.type||"$text"!=a.name||1!=a.length)return;const l=a.position.textNode||a.position.nodeAfter;if(!l.parent.is("paragraph"))return;const u=e.exec(l.data);u&&t.model.enqueueChange(t=>{const e=t.createPositionAt(l.parent,0),n=t.createPositionAt(l.parent,u[0].length),i=new Vi(e,n);!1!==r({match:u})&&t.remove(i),i.detach()})})}}class Ll{constructor(t,e,n){let r,i,o,s;e instanceof RegExp?r=e:o=e,"string"==typeof n?i=n:s=n,o=o||(t=>{let e;const n=[],i=[];for(;null!==(e=r.exec(t))&&!(e&&e.length<4);){let{index:t,1:r,2:o,3:s}=e;const a=[t+=e[0].length-(r+o+s).length,t+r.length],l=[t+r.length+o.length,t+r.length+o.length+s.length];n.push(a),n.push(l),i.push([t+r.length,t+r.length+o.length])}return{remove:n,format:i}}),s=s||((e,n)=>{const r=t.model.schema.getValidRanges(n,i);for(const t of r)e.setAttribute(i,!0,t);e.removeSelectionAttribute(i)}),t.model.document.on("change",(e,n)=>{if("transparent"==n.type)return;const r=t.model.document.selection;if(!r.isCollapsed)return;const i=Array.from(t.model.document.differ.getChanges()),a=i[0];if(1!=i.length||"insert"!==a.type||"$text"!=a.name||1!=a.length)return;const l=r.focus.parent,u=function(t){return Array.from(l.getChildren()).reduce((t,e)=>t+e.data,"")}().slice(0,r.focus.offset),c=o(u),d=Rl(l,c.format,t.model),h=Rl(l,c.remove,t.model);d.length&&h.length&&t.model.enqueueChange(t=>{if(!1!==s(t,d))for(const e of h.reverse())t.remove(e)})})}}function Rl(t,e,n){return e.filter(t=>void 0!==t[0]&&void 0!==t[1]).map(e=>n.createRange(n.createPositionAt(t,e[0]),n.createPositionAt(t,e[1])))}function Fl(t,e){return(n,r)=>{if(!t.commands.get(e).isEnabled)return!1;const i=t.model.schema.getValidRanges(r,e);for(const t of i)n.setAttribute(e,!0,t);n.removeSelectionAttribute(e)}}class Bl extends Pa{constructor(t,e){super(t),this.attributeKey=e}refresh(){const t=this.editor.model,e=t.document;this.value=this._getValueFromFirstAllowedNode(),this.isEnabled=t.schema.checkAttributeInSelection(e.selection,this.attributeKey)}execute(t={}){const e=this.editor.model,n=e.document.selection,r=void 0===t.forceValue?!this.value:t.forceValue;e.change(t=>{if(n.isCollapsed)r?t.setSelectionAttribute(this.attributeKey,!0):t.removeSelectionAttribute(this.attributeKey);else{const i=e.schema.getValidRanges(n.getRanges(),this.attributeKey);for(const e of i)r?t.setAttribute(this.attributeKey,r,e):t.removeAttribute(this.attributeKey,e)}})}_getValueFromFirstAllowedNode(){const t=this.editor.model,e=t.schema,n=t.document.selection;if(n.isCollapsed)return n.hasAttribute(this.attributeKey);for(const r of n.getRanges())for(const t of r.getItems())if(e.checkAttribute(t,this.attributeKey))return t.hasAttribute(this.attributeKey);return!1}}const Vl="bold";class ql extends Ca{init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:Vl}),t.model.schema.setAttributeProperties(Vl,{isFormatting:!0}),t.conversion.attributeToElement({model:Vl,view:"strong",upcastAlso:["b",{styles:{"font-weight":"bold"}}]}),t.commands.add(Vl,new Bl(t,Vl)),t.keystrokes.set("CTRL+B",Vl)}}var zl=n(23),Ul=n.n(zl);const Hl="bold";class Wl extends Ca{init(){const t=this.editor,e=t.t;t.ui.componentFactory.add(Hl,n=>{const r=t.commands.get(Hl),i=new bl(n);return i.set({label:e("b"),icon:Ul.a,keystroke:"CTRL+B",tooltip:!0}),i.bind("isOn","isEnabled").to(r,"value","isEnabled"),this.listenTo(i,"execute",()=>t.execute(Hl)),i})}}const Gl="italic";class Yl extends Ca{init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:Gl}),t.model.schema.setAttributeProperties(Gl,{isFormatting:!0}),t.conversion.attributeToElement({model:Gl,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),t.commands.add(Gl,new Bl(t,Gl)),t.keystrokes.set("CTRL+I",Gl)}}var Kl=n(24),$l=n.n(Kl);const Zl="italic";class Ql extends Ca{init(){const t=this.editor,e=t.t;t.ui.componentFactory.add(Zl,n=>{const r=t.commands.get(Zl),i=new bl(n);return i.set({label:e("g"),icon:$l.a,keystroke:"CTRL+I",tooltip:!0}),i.bind("isOn","isEnabled").to(r,"value","isEnabled"),this.listenTo(i,"execute",()=>t.execute(Zl)),i})}}function Jl(t){const e=t.next();return e.done?null:e.value}class Xl extends Pa{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(t={}){const e=this.editor.model,n=e.schema,r=Array.from(e.document.selection.getTopMostBlocks()),i=void 0===t.forceValue?!this.value:t.forceValue;e.change(t=>{if(i){const e=r.filter(t=>tu(t)||nu(n,t));this._applyQuote(t,e)}else this._removeQuote(t,r.filter(tu))})}_getValue(){const t=Jl(this.editor.model.document.selection.getTopMostBlocks());return!(!t||!tu(t))}_checkEnabled(){if(this.value)return!0;const t=this.editor.model.schema,e=Jl(this.editor.model.document.selection.getSelectedBlocks());return!!e&&nu(t,e)}_removeQuote(t,e){eu(t,e).reverse().forEach(e=>{if(e.start.isAtStart&&e.end.isAtEnd)return void t.unwrap(e.start.parent);if(e.start.isAtStart){const n=t.createPositionBefore(e.start.parent);return void t.move(e,n)}e.end.isAtEnd||t.split(e.end);const n=t.createPositionAfter(e.end.parent);t.move(e,n)})}_applyQuote(t,e){const n=[];eu(t,e).reverse().forEach(e=>{let r=tu(e.start);r||(r=t.createElement("blockQuote"),t.wrap(e,r)),n.push(r)}),n.reverse().reduce((e,n)=>e.nextSibling==n?(t.merge(t.createPositionAfter(e)),e):n)}}function tu(t){return"blockQuote"==t.parent.name?t.parent:null}function eu(t,e){let n,r=0;const i=[];for(;r{if(t.endsWith("blockQuote")&&"blockQuote"==e.name)return!1}),t.conversion.elementToElement({model:"blockQuote",view:"blockquote"}),t.model.document.registerPostFixer(n=>{const r=t.model.document.differ.getChanges();for(const t of r)if("insert"==t.type){const r=t.position.nodeAfter;if(!r)continue;if(r.is("blockQuote")&&r.isEmpty)return n.remove(r),!0;if(r.is("blockQuote")&&!e.checkChild(t.position,r))return n.unwrap(r),!0;if(r.is("element")){const t=n.createRangeIn(r);for(const r of t.getItems())if(r.is("blockQuote")&&!e.checkChild(n.createPositionBefore(r),r))return n.unwrap(r),!0}}else if("remove"==t.type){const e=t.position.parent;if(e.is("blockQuote")&&e.isEmpty)return n.remove(e),!0}return!1})}afterInit(){const t=this.editor.commands.get("blockQuote");this.listenTo(this.editor.editing.view.document,"enter",(e,n)=>{const r=this.editor.model.document,i=r.selection.getLastPosition().parent;r.selection.isCollapsed&&i.isEmpty&&t.value&&(this.editor.execute("blockQuote"),this.editor.editing.view.scrollToTheSelection(),n.preventDefault(),e.stop())})}}var iu=n(25),ou=n.n(iu);n(66);class su extends Ca{init(){const t=this.editor,e=t.t;t.ui.componentFactory.add("blockQuote",n=>{const r=t.commands.get("blockQuote"),i=new bl(n);return i.set({label:e("c"),icon:ou.a,tooltip:!0}),i.bind("isOn","isEnabled").to(r,"value","isEnabled"),this.listenTo(i,"execute",()=>t.execute("blockQuote")),i})}}var au=n(26),lu=n.n(au);class uu extends Ca{static get pluginName(){return"CKFinderUI"}init(){const t=this.editor,e=t.t;t.ui.componentFactory.add("ckfinder",n=>{const r=t.commands.get("ckfinder"),i=new bl(n);return i.set({label:e("d"),icon:lu.a,tooltip:!0}),i.bind("isEnabled").to(r),i.on("execute",()=>{t.execute("ckfinder"),t.editing.view.focus()}),i})}}class cu extends Ca{static get pluginName(){return"Notification"}init(){this.on("show:warning",(t,e)=>{window.alert(e.message)},{priority:"lowest"})}showSuccess(t,e={}){this._showNotification({message:t,type:"success",namespace:e.namespace,title:e.title})}showInfo(t,e={}){this._showNotification({message:t,type:"info",namespace:e.namespace,title:e.title})}showWarning(t,e={}){this._showNotification({message:t,type:"warning",namespace:e.namespace,title:e.title})}_showNotification(t){this.fire(`show:${t.type}`+(t.namespace?`:${t.namespace}`:""),{message:t.message,type:t.type,title:t.title||""})}}class du extends Pa{constructor(t){super(t),this.stopListening(this.editor.model.document,"change"),this.listenTo(this.editor.model.document,"change",()=>this.refresh(),{priority:"low"})}refresh(){const t=this.editor.commands.get("imageUpload"),e=this.editor.commands.get("link");this.isEnabled=t&&e&&(t.isEnabled||e.isEnabled)}execute(){const t=this.editor,e=this.editor.config.get("ckfinder.openerMethod")||"modal";if("popup"!=e&&"modal"!=e)throw new he.b('ckfinder-unknown-openerMethod: The openerMethod config option must by "popup" or "modal".');const n=this.editor.config.get("ckfinder.options")||{};n.chooseFiles=!0;const r=n.onInit;n.language||(n.language=t.locale.language),n.onInit=(e=>{r&&r(),e.on("files:choose",n=>{const r=n.data.files.toArray(),i=r.filter(t=>!t.isImage()),o=r.filter(t=>t.isImage());for(const e of i)t.execute("link",e.getUrl());const s=[];for(const t of o){const n=t.getUrl();s.push(n||e.request("file:getProxyUrl",{file:t}))}s.length&&hu(t,s)}),e.on("file:choose:resizedImage",e=>{const n=e.data.resizedUrl;if(n)hu(t,[n]);else{const e=t.plugins.get("Notification"),n=t.locale.t;e.showWarning(n("ap"),{title:n("aq"),namespace:"ckfinder"})}})}),window.CKFinder[e](n)}}function hu(t,e){if(t.commands.get("imageUpload").isEnabled)t.execute("imageInsert",{source:e});else{const e=t.plugins.get("Notification"),n=t.locale.t;e.showWarning(n("ar"),{title:n("as"),namespace:"ckfinder"})}}class fu extends Ca{static get pluginName(){return"CKFinderEditing"}static get requires(){return[cu]}init(){const t=this.editor;t.commands.add("ckfinder",new du(t))}}const pu=/^data:(\S*?);base64,/;class gu{constructor(t,e,n){if(!t)throw new Error("File must be provided");if(!e)throw new Error("Token must be provided");if(!n)throw new Error("Api address must be provided");this.file=function(t){if("string"!=typeof t)return!1;const e=t.match(pu);return!(!e||!e.length)}(t)?function(t,e=512){try{const n=t.match(pu)[1],r=atob(t.replace(pu,"")),i=[];for(let t=0;tt(n)),this}onError(t){return this.once("error",(e,n)=>t(n)),this}abort(){this.xhr.abort()}send(){return this._prepareRequest(),this._attachXHRListeners(),this._sendRequest()}_prepareRequest(){const t=new XMLHttpRequest;t.open("POST",this._apiAddress),t.setRequestHeader("Authorization",this._token.value),t.responseType="json",this.xhr=t}_attachXHRListeners(){const t=this,e=this.xhr;function n(e){return()=>t.fire("error",e)}e.addEventListener("error",n("Network Error")),e.addEventListener("abort",n("Abort")),e.upload&&e.upload.addEventListener("progress",t=>{t.lengthComputable&&this.fire("progress",{total:t.total,uploaded:t.loaded})}),e.addEventListener("load",()=>{const t=e.status,n=e.response;if(t<200||t>299)return this.fire("error",n.message||n.error)})}_sendRequest(){const t=new FormData,e=this.xhr;return t.append("file",this.file),new Promise((n,r)=>{e.addEventListener("load",()=>{const t=e.status,i=e.response;return t<200||t>299?r(i.message?new Error(i.message):i.error):n(i)}),e.addEventListener("error",()=>r(new Error("Network Error"))),e.addEventListener("abort",()=>r(new Error("Abort"))),e.send(t)})}}Se(gu,be);var mu=gu;const vu={refreshInterval:36e5,autoRefresh:!0};class yu{constructor(t,e=vu){if(!t)throw new Error("A `tokenUrl` must be provided as the first constructor argument.");this.set("value",e.initValue),this._refresh="function"==typeof t?t:()=>(function(t){return new Promise((e,n)=>{const r=new XMLHttpRequest;r.open("GET",t),r.addEventListener("load",()=>{const t=r.status,i=r.response;return t<200||t>299?n(new Error("Cannot download new token!")):e(i)}),r.addEventListener("error",()=>n(new Error("Network Error"))),r.addEventListener("abort",()=>n(new Error("Abort"))),r.send()})})(t),this._options=Object.assign({},vu,e)}init(){return new Promise((t,e)=>{this._options.autoRefresh&&this._startRefreshing(),this.value?t(this):this._refreshToken().then(t).catch(e)})}_refreshToken(){return this._refresh().then(t=>this.set("value",t)).then(()=>this)}destroy(){this._stopRefreshing()}_startRefreshing(){this._refreshInterval=setInterval(()=>this._refreshToken(),this._options.refreshInterval)}_stopRefreshing(){clearInterval(this._refreshInterval)}static create(t,e=vu){return new yu(t,e).init()}}Se(yu,Qe);class bu extends Ca{static get pluginName(){return"CloudServices"}init(){const t=this.editor.config.get("cloudServices")||{};for(const e in t)this[e]=t[e];if(this.tokenUrl)return this.token=new bu.Token(this.tokenUrl),this.token.init();this.token=null}}bu.Token=yu;class wu extends Ca{static get requires(){return[Ol,bu]}init(){const t=this.editor,e=t.plugins.get(bu),n=e.token;n&&(this._uploadGateway=new wu._UploadGateway(n,e.uploadUrl),t.plugins.get(Ol).createUploadAdapter=(t=>new _u(this._uploadGateway,t)))}}class _u{constructor(t,e){this.uploadGateway=t,this.loader=e}upload(){return this.loader.file.then(t=>(this.fileUploader=this.uploadGateway.upload(t),this.fileUploader.on("progress",(t,e)=>{this.loader.uploadTotal=e.total,this.loader.uploaded=e.uploaded}),this.fileUploader.send()))}abort(){this.fileUploader.abort()}}wu._UploadGateway=class{constructor(t,e){if(!t)throw new Error("Token must be provided");if(!e)throw new Error("Api address must be provided");this._token=t,this._apiAddress=e}upload(t){return new mu(t,this._token,this._apiAddress)}};class ku extends _r{constructor(t){super(t),this._observedElements=new Set}observe(t,e){this.document.getRoot(e).on("change:children",(e,n)=>{this.view.once("render",()=>this._updateObservedElements(t,n))})}_updateObservedElements(t,e){if(!e.is("element")||e.is("attributeElement"))return;const n=this.view.domConverter.mapViewToDom(e);if(n){for(const t of n.querySelectorAll("img"))this._observedElements.has(t)||(this.listenTo(t,"load",(t,e)=>this._fireEvents(e)),this._observedElements.add(t));for(const e of this._observedElements)t.contains(e)||(this.stopListening(e),this._observedElements.delete(e))}}_fireEvents(t){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",t))}destroy(){this._observedElements.clear(),super.destroy()}}function xu(t){return n=>{n.on(`attribute:${t}:image`,e)};function e(t,e,n){if(!n.consumable.consume(e.item,t.name))return;const r=n.writer,i=n.mapper.toViewElement(e.item).getChild(0);null!==e.attributeNewValue?r.setAttribute(e.attributeKey,e.attributeNewValue,i):r.removeAttribute(e.attributeKey,i)}}class Cu{constructor(){this._stack=[]}add(t,e){const n=this._stack,r=n[0];this._insertDescriptor(t);const i=n[0];r===i||Au(r,i)||this.fire("change:top",{oldDescriptor:r,newDescriptor:i,writer:e})}remove(t,e){const n=this._stack,r=n[0];this._removeDescriptor(t);const i=n[0];r===i||Au(r,i)||this.fire("change:top",{oldDescriptor:r,newDescriptor:i,writer:e})}_insertDescriptor(t){const e=this._stack,n=e.findIndex(e=>e.id===t.id);if(Au(t,e[n]))return;n>-1&&e.splice(n,1);let r=0;for(;e[r]&&Su(e[r],t);)r++;e.splice(r,0,t)}_removeDescriptor(t){const e=this._stack,n=e.findIndex(e=>e.id===t);n>-1&&e.splice(n,1)}}function Au(t,e){return t&&e&&t.priority==e.priority&&Eu(t.classes)==Eu(e.classes)}function Su(t,e){return t.priority>e.priority||!(t.priorityEu(e.classes)}function Eu(t){return Array.isArray(t)?t.sort().join(","):t}Se(Cu,be);var Ou=n(27),Pu=n.n(Ou);const Tu="ck-widget",Nu="ck-widget_selected";function Iu(t){return!!t.is("element")&&!!t.getCustomProperty("widget")}function Mu(t,e,n={}){return Cn.isEdge||e.setAttribute("contenteditable","false",t),e.addClass(Tu,t),e.setCustomProperty("widget",!0,t),t.getFillerOffset=Ru,n.label&&function(t,e,n){n.setCustomProperty("widgetLabel",e,t)}(t,n.label,e),n.hasSelectionHandler&&function(t,e){const n=e.createUIElement("div",{class:"ck ck-widget__selection-handler"},function(t){const e=this.toDomElement(t),n=new vl;return n.set("content",Pu.a),n.render(),e.appendChild(n.element),e});e.insert(e.createPositionAt(t,0),n),e.addClass(["ck-widget_with-selection-handler"],t)}(t,e),function(t,e,n,r){const i=new Cu;i.on("change:top",(e,i)=>{i.oldDescriptor&&r(t,i.oldDescriptor,i.writer),i.newDescriptor&&n(t,i.newDescriptor,i.writer)}),e.setCustomProperty("addHighlight",(t,e,n)=>i.add(e,n),t),e.setCustomProperty("removeHighlight",(t,e,n)=>i.remove(e,n),t)}(t,e,(t,e,n)=>n.addClass(r(e.classes),t),(t,e,n)=>n.removeClass(r(e.classes),t)),t;function r(t){return Array.isArray(t)?t:[t]}}function Du(t){const e=t.getCustomProperty("widgetLabel");return e?"function"==typeof e?e():e:""}function ju(t,e){return e.addClass(["ck-editor__editable","ck-editor__nested-editable"],t),Cn.isEdge||(e.setAttribute("contenteditable",t.isReadOnly?"false":"true",t),t.on("change:isReadOnly",(n,r,i)=>{e.setAttribute("contenteditable",i?"false":"true",t)})),t.on("change:isFocused",(n,r,i)=>{i?e.addClass("ck-editor__nested-editable_focused",t):e.removeClass("ck-editor__nested-editable_focused",t)}),t}function Lu(t,e){const n=t.getSelectedElement();if(n&&e.schema.isBlock(n))return e.createPositionAfter(n);const r=t.getSelectedBlocks().next().value;if(r){if(r.isEmpty)return e.createPositionAt(r,0);const n=e.createPositionAfter(r);return t.focus.isTouching(n)?n:e.createPositionBefore(r)}return t.focus}function Ru(){return null}function Fu(t){const e=t.getSelectedElement();return e&&function(t){return!!t.getCustomProperty("image")&&Iu(t)}(e)?e:null}function Bu(t){return!!t&&t.is("image")}function Vu(t,e,n={}){const r=t.createElement("image",n),i=Lu(e.document.selection,e);e.insertContent(r,i),r.parent&&t.setSelection(r,"on")}function qu(t){const e=t.schema,n=t.document.selection;return function(t,e,n){const r=function(t,e){const n=Lu(t,e).parent;return n.isEmpty&&!n.is("$root")?n.parent:n}(t,n);return e.checkChild(r,"image")}(n,e,t)&&!function(t,e){const n=t.getSelectedElement();return n&&e.isObject(n)}(n,e)&&[...n.focus.getAncestors()].every(t=>!t.is("image"))}class zu extends Pa{refresh(){this.isEnabled=qu(this.editor.model)}execute(t){const e=this.editor.model;e.change(n=>{const r=Array.isArray(t.source)?t.source:[t.source];for(const t of r)Vu(n,e,{src:t})})}}class Uu extends Ca{init(){const t=this.editor,e=t.model.schema,n=t.t,r=t.conversion;t.editing.view.addObserver(ku),e.register("image",{isObject:!0,isBlock:!0,allowWhere:"$block",allowAttributes:["alt","src","srcset"]}),r.for("dataDowncast").elementToElement({model:"image",view:(t,e)=>Hu(e)}),r.for("editingDowncast").elementToElement({model:"image",view:(t,e)=>(function(t,e,n){return e.setCustomProperty("image",!0,t),Mu(t,e,{label:function(){const e=t.getChild(0).getAttribute("alt");return e?`${e} ${n}`:n}})})(Hu(e),e,n("h"))}),r.for("downcast").add(xu("src")).add(xu("alt")).add(function(){return e=>{e.on("attribute:srcset:image",t)};function t(t,e,n){if(!n.consumable.consume(e.item,t.name))return;const r=n.writer,i=n.mapper.toViewElement(e.item).getChild(0);if(null===e.attributeNewValue){const t=e.attributeOldValue;t.data&&(r.removeAttribute("srcset",i),r.removeAttribute("sizes",i),t.width&&r.removeAttribute("width",i))}else{const t=e.attributeNewValue;t.data&&(r.setAttribute("srcset",t.data,i),r.setAttribute("sizes","100vw",i),t.width&&r.setAttribute("width",t.width,i))}}}()),r.for("upcast").elementToElement({view:{name:"img",attributes:{src:!0}},model:(t,e)=>e.createElement("image",{src:t.getAttribute("src")})}).attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:{key:"srcset",value:t=>{const e={data:t.getAttribute("srcset")};return t.hasAttribute("width")&&(e.width=t.getAttribute("width")),e}}}).add(function(){return e=>{e.on("element:figure",t)};function t(t,e,n){if(!n.consumable.test(e.viewItem,{name:!0,classes:"image"}))return;const r=Array.from(e.viewItem.getChildren()).find(t=>t.is("img"));if(!r||!r.hasAttribute("src")||!n.consumable.test(r,{name:!0}))return;const i=n.convertItem(r,e.modelCursor),o=Jl(i.modelRange.getItems());o&&(n.convertChildren(e.viewItem,n.writer.createPositionAt(o,0)),e.modelRange=i.modelRange,e.modelCursor=i.modelCursor)}}()),t.commands.add("imageInsert",new zu(t))}}function Hu(t){const e=t.createEmptyElement("img"),n=t.createContainerElement("figure",{class:"image"});return t.insert(t.createPositionAt(n,0),e),n}class Wu extends Vr{constructor(t){super(t),this.domEventType="mousedown"}onDomEvent(t){this.fire(t.type,t)}}n(68);const Gu=Pn("Ctrl+A");class Yu extends Ca{static get pluginName(){return"Widget"}init(){const t=this.editor.editing.view,e=t.document;this._previouslySelected=new Set,this.editor.editing.downcastDispatcher.on("selection",(t,e,n)=>{this._clearPreviouslySelectedWidgets(n.writer);const r=n.writer,i=r.document.selection,o=i.getSelectedElement();let s=null;for(const a of i.getRanges())for(const t of a){const e=t.item;Iu(e)&&!Ku(e,s)&&(r.addClass(Nu,e),this._previouslySelected.add(e),s=e,e==o&&r.setSelection(i.getRanges(),{fake:!0,label:Du(o)}))}},{priority:"low"}),t.addObserver(Wu),this.listenTo(e,"mousedown",(...t)=>this._onMousedown(...t)),this.listenTo(e,"keydown",(...t)=>this._onKeydown(...t),{priority:"high"}),this.listenTo(e,"delete",(t,e)=>{this._handleDelete("forward"==e.direction)&&(e.preventDefault(),t.stop())},{priority:"high"})}_onMousedown(t,e){const n=this.editor,r=n.editing.view,i=r.document;let o=e.target;if(function(t){for(;t;){if(t.is("editableElement")&&!t.is("rootElement"))return!0;if(Iu(t))return!1;t=t.parent}return!1}(o)){if(Cn.isSafari&&e.domEvent.detail>=3){const t=n.editing.mapper.toModelElement(o);this.editor.model.change(n=>{e.preventDefault(),n.setSelection(t,"in")})}return}if(!Iu(o)&&!(o=o.findAncestor(Iu)))return;e.preventDefault(),i.isFocused||r.focus();const s=n.editing.mapper.toModelElement(o);this._setSelectionOverElement(s)}_onKeydown(t,e){const n=e.keyCode,r=n==En.arrowdown||n==En.arrowright;let i=!1;n!=En.arrowright&&n!=En.arrowleft&&n!=En.arrowup&&n!=En.arrowdown?On(e)==Gu?i=this._selectAllNestedEditableContent()||this._selectAllContent():n===En.enter&&(i=this._handleEnterKey(e.shiftKey)):i=this._handleArrowKeys(r),i&&(e.preventDefault(),t.stop())}_handleDelete(t){if(this.editor.isReadOnly)return;const e=this.editor.model.document.selection;if(!e.isCollapsed)return;const n=this._getObjectElementNextToSelection(t);return n?(this.editor.model.change(t=>{let r=e.anchor.parent;for(;r.isEmpty;){const e=r;r=e.parent,t.remove(e)}this._setSelectionOverElement(n)}),!0):void 0}_handleArrowKeys(t){const e=this.editor.model,n=e.schema,r=e.document.selection,i=r.getSelectedElement();if(i&&n.isObject(i)){const i=t?r.getLastPosition():r.getFirstPosition(),o=n.getNearestSelectionRange(i,t?"forward":"backward");return o&&e.change(t=>{t.setSelection(o)}),!0}if(!r.isCollapsed)return;const o=this._getObjectElementNextToSelection(t);return o&&n.isObject(o)?(this._setSelectionOverElement(o),!0):void 0}_handleEnterKey(t){const e=this.editor.model,n=e.document.selection.getSelectedElement();if(function(t,e){return t&&e.isObject(t)&&!e.isInline(t)}(n,e.schema))return e.change(r=>{let i=r.createPositionAt(n,t?"before":"after");const o=r.createElement("paragraph");if(e.schema.isBlock(n.parent)){const t=e.schema.findAllowedParent(i,o);i=r.split(i,t).position}r.insert(o,i),r.setSelection(o,"in")}),!0}_selectAllNestedEditableContent(){const t=this.editor.model,e=t.document.selection,n=t.schema.getLimitElement(e);return e.getFirstRange().root!=n&&(t.change(t=>{t.setSelection(t.createRangeIn(n))}),!0)}_selectAllContent(){const t=this.editor.model,e=this.editor.editing,n=e.view.document.selection.getSelectedElement();if(n&&Iu(n)){const r=e.mapper.toModelElement(n.parent);return t.change(t=>{t.setSelection(t.createRangeIn(r))}),!0}return!1}_setSelectionOverElement(t){this.editor.model.change(e=>{e.setSelection(e.createRangeOn(t))})}_getObjectElementNextToSelection(t){const e=this.editor.model,n=e.schema,r=e.createSelection(e.document.selection);e.modifySelection(r,{direction:t?"forward":"backward"});const i=t?r.focus.nodeBefore:r.focus.nodeAfter;return i&&n.isObject(i)?i:null}_clearPreviouslySelectedWidgets(t){for(const e of this._previouslySelected)t.removeClass(Nu,e);this._previouslySelected.clear()}}function Ku(t,e){return!!e&&Array.from(t.getAncestors()).includes(e)}class $u extends Pa{refresh(){const t=this.editor.model.document.selection.getSelectedElement();this.isEnabled=Bu(t),this.value=!(!Bu(t)||!t.hasAttribute("alt"))&&t.getAttribute("alt")}execute(t){const e=this.editor.model,n=e.document.selection.getSelectedElement();e.change(e=>{e.setAttribute("alt",t.newValue,n)})}}class Zu extends Ca{init(){this.editor.commands.add("imageTextAlternative",new $u(this.editor))}}function Qu({emitter:t,activator:e,callback:n,contextElements:r}){t.listenTo(document,"mousedown",(t,{target:i})=>{if(e()){for(const t of r)if(t.contains(i))return;n()}})}n(70);class Ju extends ua{constructor(t,e){super(t);const n=`ck-input-${ge()}`,r=`ck-status-${ge()}`;this.set("label"),this.set("value"),this.set("isReadOnly",!1),this.set("errorText",null),this.set("infoText",null),this.labelView=this._createLabelView(n),this.inputView=this._createInputView(e,n,r),this.statusView=this._createStatusView(r),this.bind("_statusText").to(this,"errorText",this,"infoText",(t,e)=>t||e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-input",this.bindTemplate.if("isReadOnly","ck-disabled")]},children:[this.labelView,this.inputView,this.statusView]})}_createLabelView(t){const e=new da(this.locale);return e.for=t,e.bind("text").to(this,"label"),e}_createInputView(t,e,n){const r=new t(this.locale,n);return r.id=e,r.ariaDescribedById=n,r.bind("value").to(this),r.bind("isReadOnly").to(this),r.bind("hasError").to(this,"errorText",t=>!!t),r.on("input",()=>{this.errorText=null}),r}_createStatusView(t){const e=new ua(this.locale),n=this.bindTemplate;return e.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-input__status",n.if("errorText","ck-labeled-input__status_error"),n.if("_statusText","ck-hidden",t=>!t)],id:t},children:[{text:n.to("_statusText")}]}),e}select(){this.inputView.select()}focus(){this.inputView.focus()}}n(72);class Xu extends ua{constructor(t){super(t),this.set("value"),this.set("id"),this.set("placeholder"),this.set("isReadOnly",!1),this.set("hasError",!1),this.set("ariaDescribedById");const e=this.bindTemplate;this.setTemplate({tag:"input",attributes:{type:"text",class:["ck","ck-input","ck-input-text",e.if("hasError","ck-error")],id:e.to("id"),placeholder:e.to("placeholder"),readonly:e.to("isReadOnly"),"aria-invalid":e.if("hasError",!0),"aria-describedby":e.to("ariaDescribedById")},on:{input:e.to("input")}})}render(){super.render();const t=t=>{this.element.value=t||0===t?t:""};t(this.value),this.on("change:value",(e,n,r)=>{t(r)})}select(){this.element.select()}focus(){this.element.focus()}}function tc({view:t}){t.listenTo(t.element,"submit",(e,n)=>{n.preventDefault(),t.fire("submit")},{useCapture:!0})}var ec=n(7),nc=n.n(ec),rc=n(8),ic=n.n(rc);n(74);class oc extends ua{constructor(t){super(t);const e=this.locale.t;this.focusTracker=new js,this.keystrokes=new Ss,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(e("ay"),nc.a,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(e("az"),ic.a,"ck-button-cancel","cancel"),this._focusables=new Us,this._focusCycler=new ya({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),tc({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element)})}_createButton(t,e,n,r){const i=new bl(this.locale);return i.set({label:t,icon:e,tooltip:!0}),i.extendTemplate({attributes:{class:n}}),r&&i.delegate("execute").to(this,r),i}_createLabeledInputView(){const t=this.locale.t,e=new Ju(this.locale,Xu);return e.label=t("bt"),e.inputView.placeholder=t("bt"),e}}function sc({element:t,target:e,positions:n,limiter:r,fitInViewport:i}){E(e)&&(e=e()),E(r)&&(r=r());const o=function(t){for(;t&&"html"!=t.tagName.toLowerCase();){if("static"!=dr.window.getComputedStyle(t).position)return t;t=t.parentElement}return null}(t.parentElement),s=new si(t),a=new si(e);let l,u;if(r||i){const t=r&&new si(r).getVisible(),e=i&&new si(dr.window);[u,l]=function(t,e,n,r,i){let o,s,a=0,l=0;const u=n.getArea();return t.some(t=>{const[c,d]=ac(t,e,n);let h,f;if(r)if(i){const t=r.getIntersection(i);h=t?t.getIntersectionArea(d):0}else h=r.getIntersectionArea(d);function p(){l=f,a=h,o=d,s=c}return i&&(f=i.getIntersectionArea(d)),i&&!r?f>l&&p():!i&&r?h>a&&p():f>l&&h>=a?p():f>=l&&h>a&&p(),h===u}),o?[s,o]:null}(n,a,s,t,e)||ac(n[0],a,s)}else[u,l]=ac(n[0],a,s);let{left:c,top:d}=lc(l);if(o){const t=lc(new si(o)),e=ii(o);c-=t.left,d-=t.top,c+=o.scrollLeft,d+=o.scrollTop,c-=e.left,d-=e.top}return{left:c,top:d,name:u}}function ac(t,e,n){const{left:r,top:i,name:o}=t(e,n);return[o,n.clone().moveTo(r,i)]}function lc({left:t,top:e}){const{scrollX:n,scrollY:r}=dr.window;return{left:t+n,top:e+r}}n(76);const uc=ga("px"),cc=dr.document.body;class dc extends ua{constructor(t){super(t);const e=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",e.to("position",t=>`ck-balloon-panel_${t}`),e.if("isVisible","ck-balloon-panel_visible"),e.if("withArrow","ck-balloon-panel_with-arrow"),e.to("class")],style:{top:e.to("top",uc),left:e.to("left",uc)}},children:this.content})}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(t){this.show();const e=dc.defaultPositions,n=Object.assign({},{element:this.element,positions:[e.southArrowNorth,e.southArrowNorthWest,e.southArrowNorthEast,e.northArrowSouth,e.northArrowSouthWest,e.northArrowSouthEast],limiter:cc,fitInViewport:!0},t),r=dc._getOptimalPosition(n),i=parseInt(r.left),o=parseInt(r.top);Object.assign(this,{top:o,left:i,position:r.name})}pin(t){this.unpin(),this._pinWhenIsVisibleCallback=(()=>{this.isVisible?this._startPinning(t):this._stopPinning()}),this._startPinning(t),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(t){this.attachTo(t);const e=hc(t.target),n=t.limiter?hc(t.limiter):cc;this.listenTo(dr.document,"scroll",(r,i)=>{const o=i.target,s=e&&o.contains(e),a=n&&o.contains(n);!s&&!a&&e&&n||this.attachTo(t)},{useCapture:!0}),this.listenTo(dr.window,"resize",()=>{this.attachTo(t)})}_stopPinning(){this.stopListening(dr.document,"scroll"),this.stopListening(dr.window,"resize")}}function hc(t){return ue(t)?t:ri(t)?t.commonAncestorContainer:"function"==typeof t?hc(t()):null}function fc(t,e){return t.top-e.height-dc.arrowVerticalOffset}function pc(t){return t.bottom+dc.arrowVerticalOffset}dc.arrowHorizontalOffset=25,dc.arrowVerticalOffset=10,dc._getOptimalPosition=sc,dc.defaultPositions={northArrowSouth:(t,e)=>({top:fc(t,e),left:t.left+t.width/2-e.width/2,name:"arrow_s"}),northArrowSouthEast:(t,e)=>({top:fc(t,e),left:t.left+t.width/2-e.width+dc.arrowHorizontalOffset,name:"arrow_se"}),northArrowSouthWest:(t,e)=>({top:fc(t,e),left:t.left+t.width/2-dc.arrowHorizontalOffset,name:"arrow_sw"}),northWestArrowSouth:(t,e)=>({top:fc(t,e),left:t.left-e.width/2,name:"arrow_s"}),northWestArrowSouthWest:(t,e)=>({top:fc(t,e),left:t.left-dc.arrowHorizontalOffset,name:"arrow_sw"}),northWestArrowSouthEast:(t,e)=>({top:fc(t,e),left:t.left-e.width+dc.arrowHorizontalOffset,name:"arrow_se"}),northEastArrowSouth:(t,e)=>({top:fc(t,e),left:t.right-e.width/2,name:"arrow_s"}),northEastArrowSouthEast:(t,e)=>({top:fc(t,e),left:t.right-e.width+dc.arrowHorizontalOffset,name:"arrow_se"}),northEastArrowSouthWest:(t,e)=>({top:fc(t,e),left:t.right-dc.arrowHorizontalOffset,name:"arrow_sw"}),southArrowNorth:(t,e)=>({top:pc(t),left:t.left+t.width/2-e.width/2,name:"arrow_n"}),southArrowNorthEast:(t,e)=>({top:pc(t),left:t.left+t.width/2-e.width+dc.arrowHorizontalOffset,name:"arrow_ne"}),southArrowNorthWest:(t,e)=>({top:pc(t),left:t.left+t.width/2-dc.arrowHorizontalOffset,name:"arrow_nw"}),southWestArrowNorth:(t,e)=>({top:pc(t),left:t.left-e.width/2,name:"arrow_n"}),southWestArrowNorthWest:(t,e)=>({top:pc(t),left:t.left-dc.arrowHorizontalOffset,name:"arrow_nw"}),southWestArrowNorthEast:(t,e)=>({top:pc(t),left:t.left-e.width+dc.arrowHorizontalOffset,name:"arrow_ne"}),southEastArrowNorth:(t,e)=>({top:pc(t),left:t.right-e.width/2,name:"arrow_n"}),southEastArrowNorthEast:(t,e)=>({top:pc(t),left:t.right-e.width+dc.arrowHorizontalOffset,name:"arrow_ne"}),southEastArrowNorthWest:(t,e)=>({top:pc(t),left:t.right-dc.arrowHorizontalOffset,name:"arrow_nw"})};var gc=n(28),mc=n.n(gc),vc=n(29),yc=n.n(vc);n(78),n(80);const bc=ga("px");class wc extends Ca{static get pluginName(){return"ContextualBalloon"}constructor(t){super(t),this.positionLimiter=(()=>{const t=this.editor.editing.view,e=t.document.selection.editableElement;return e?t.domConverter.mapViewToDom(e.root):null}),this.set("visibleView",null),this.view=new dc(t.locale),t.ui.view.body.add(this.view),t.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(t){return Array.from(this._viewToStack.keys()).includes(t)}add(t){if(this.hasView(t.view))throw new he.b("contextualballoon-add-view-exist: Cannot add configuration of the same view twice.");const e=t.stackId||"main";if(!this._idToStack.has(e))return this._idToStack.set(e,new Map([[t.view,t]])),this._viewToStack.set(t.view,this._idToStack.get(e)),this._numberOfStacks=this._idToStack.size,void(this._visibleStack&&!t.singleViewMode||this.showStack(e));const n=this._idToStack.get(e);t.singleViewMode&&this.showStack(e),n.set(t.view,t),this._viewToStack.set(t.view,n),n===this._visibleStack&&this._showView(t)}remove(t){if(!this.hasView(t))throw new he.b("contextualballoon-remove-view-not-exist: Cannot remove configuration of not existing view.");const e=this._viewToStack.get(t);this._singleViewMode&&this.visibleView===t&&(this._singleViewMode=!1),this.visibleView===t&&(1===e.size?this._idToStack.size>1?this._showNextStack():(this.view.hide(),this.visibleView=null,this._rotatorView.hideView()):this._showView(Array.from(e.values())[e.size-2])),1===e.size?(this._idToStack.delete(this._getStackId(e)),this._numberOfStacks=this._idToStack.size):e.delete(t),this._viewToStack.delete(t)}updatePosition(t){t&&(this._visibleStack.get(this.visibleView).position=t),this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition()}showStack(t){this.visibleStack=t;const e=this._idToStack.get(t);if(!e)throw new he.b("contextualballoon-showstack-stack-not-exist: Cannot show not existing stack.");this._visibleStack!==e&&this._showView(Array.from(e.values()).pop())}get _visibleStack(){return this._viewToStack.get(this.visibleView)}_getStackId(t){return Array.from(this._idToStack.entries()).find(e=>e[1]===t)[0]}_showNextStack(){const t=Array.from(this._idToStack.values());let e=t.indexOf(this._visibleStack)+1;t[e]||(e=0),this.showStack(this._getStackId(t[e]))}_showPrevStack(){const t=Array.from(this._idToStack.values());let e=t.indexOf(this._visibleStack)-1;t[e]||(e=t.length-1),this.showStack(this._getStackId(t[e]))}_createRotatorView(){const t=new _c(this.editor.locale),e=this.editor.locale.t;return this.view.content.add(t),t.bind("isNavigationVisible").to(this,"_numberOfStacks",this,"_singleViewMode",(t,e)=>!e&&t>1),t.on("change:isNavigationVisible",()=>this.updatePosition(),{priority:"low"}),t.bind("counter").to(this,"visibleView",this,"_numberOfStacks",(t,n)=>{if(n<2)return"";const r=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return e("bi",[r,n])}),t.buttonNextView.on("execute",()=>{t.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showNextStack()}),t.buttonPrevView.on("execute",()=>{t.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showPrevStack()}),t}_createFakePanelsView(){const t=new kc(this.editor.locale,this.view);return t.bind("numberOfPanels").to(this,"_numberOfStacks",this,"_singleViewMode",(t,e)=>!e&&t>=2?Math.min(t-1,2):0),t.listenTo(this.view,"change:top",()=>t.updatePosition()),t.listenTo(this.view,"change:left",()=>t.updatePosition()),this.editor.ui.view.body.add(t),t}_showView({view:t,balloonClassName:e="",withArrow:n=!0,singleViewMode:r=!1}){this.view.class=e,this.view.withArrow=n,this._rotatorView.showView(t),this.visibleView=t,this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition(),r&&(this._singleViewMode=!0)}_getBalloonPosition(){let t=Array.from(this._visibleStack.values()).pop().position;return t&&!t.limiter&&(t=Object.assign({},t,{limiter:this.positionLimiter})),t}}class _c extends ua{constructor(t){super(t);const e=t.t,n=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new js,this.buttonPrevView=this._createButtonView(e("bj"),mc.a),this.buttonNextView=this._createButtonView(e("bk"),yc.a),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",n.to("isNavigationVisible",t=>t?"":"ck-hidden")]},children:[this.buttonPrevView,{tag:"span",attributes:{class:["ck-balloon-rotator__counter"]},children:[{text:n.to("counter")}]},this.buttonNextView]},{tag:"div",attributes:{class:"ck-balloon-rotator__content"},children:this.content}]})}render(){super.render(),this.focusTracker.add(this.element)}showView(t){this.hideView(),this.content.add(t)}hideView(){this.content.clear()}_createButtonView(t,e){const n=new bl(this.locale);return n.set({label:t,icon:e,tooltip:!0}),n}}class kc extends ua{constructor(t,e){super(t);const n=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=e,this.setTemplate({tag:"div",attributes:{class:["ck-fake-panel",n.to("numberOfPanels",t=>t?"":"ck-hidden")],style:{top:n.to("top",bc),left:n.to("left",bc),width:n.to("width",bc),height:n.to("height",bc)}},children:this.content}),this.on("change:numberOfPanels",(t,e,n,r)=>{n>r?this._addPanels(n-r):this._removePanels(r-n),this.updatePosition()})}_addPanels(t){for(;t--;){const t=new ua;t.setTemplate({tag:"div"}),this.content.add(t),this.registerChild(t)}}_removePanels(t){for(;t--;){const t=this.content.last;this.content.remove(t),this.deregisterChild(t),t.destroy()}}updatePosition(){if(this.numberOfPanels){const{top:t,left:e}=this._balloonPanelView,{width:n,height:r}=new si(this._balloonPanelView.element);Object.assign(this,{top:t,left:e,width:n,height:r})}}}var xc=n(30),Cc=n.n(xc);function Ac(t){const e=t.editing.view,n=dc.defaultPositions;return{target:e.domConverter.viewToDom(e.document.selection.getSelectedElement()),positions:[n.northArrowSouth,n.northArrowSouthWest,n.northArrowSouthEast,n.southArrowNorth,n.southArrowNorthWest,n.southArrowNorthEast]}}class Sc extends Ca{static get requires(){return[wc]}static get pluginName(){return"ImageTextAlternativeUI"}init(){this._createButton(),this._createForm()}destroy(){super.destroy(),this._form.destroy()}_createButton(){const t=this.editor,e=t.t;t.ui.componentFactory.add("imageTextAlternative",n=>{const r=t.commands.get("imageTextAlternative"),i=new bl(n);return i.set({label:e("bl"),icon:Cc.a,tooltip:!0}),i.bind("isEnabled").to(r,"isEnabled"),this.listenTo(i,"execute",()=>this._showForm()),i})}_createForm(){const t=this.editor,e=t.editing.view.document;this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new oc(t.locale),this._form.render(),this.listenTo(this._form,"submit",()=>{t.execute("imageTextAlternative",{newValue:this._form.labeledInput.inputView.element.value}),this._hideForm(!0)}),this.listenTo(this._form,"cancel",()=>{this._hideForm(!0)}),this._form.keystrokes.set("Esc",(t,e)=>{this._hideForm(!0),e()}),this.listenTo(t.ui,"update",()=>{Fu(e.selection)?this._isVisible&&function(t){const e=t.plugins.get("ContextualBalloon");if(Fu(t.editing.view.document.selection)){const n=Ac(t);e.updatePosition(n)}}(t):this._hideForm(!0)}),Qu({emitter:this._form,activator:()=>this._isVisible,contextElements:[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;const t=this.editor,e=t.commands.get("imageTextAlternative"),n=this._form.labeledInput;this._balloon.hasView(this._form)||this._balloon.add({view:this._form,position:Ac(t)}),n.value=n.inputView.element.value=e.value||"",this._form.labeledInput.select()}_hideForm(t){this._isVisible&&(this._form.saveButtonView.focus(),this._balloon.remove(this._form),t&&this.editor.editing.view.focus())}get _isVisible(){return this._balloon.visibleView==this._form}}class Ec extends Ca{static get requires(){return[Zu,Sc]}static get pluginName(){return"ImageTextAlternative"}}n(82);class Oc extends Ca{static get requires(){return[Uu,Yu,Ec]}static get pluginName(){return"Image"}}class Pc extends ua{constructor(t){super(t),this.buttonView=new bl(t),this._fileInputView=new Tc(t),this._fileInputView.bind("acceptedType").to(this),this._fileInputView.bind("allowMultipleFiles").to(this),this._fileInputView.delegate("done").to(this),this.setTemplate({tag:"span",attributes:{class:"ck-file-dialog-button"},children:[this.buttonView,this._fileInputView]}),this.buttonView.on("execute",()=>{this._fileInputView.open()})}focus(){this.buttonView.focus()}}class Tc extends ua{constructor(t){super(t),this.set("acceptedType"),this.set("allowMultipleFiles",!1);const e=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:e.to("acceptedType"),multiple:e.to("allowMultipleFiles")},on:{change:e.to(()=>{this.element&&this.element.files&&this.element.files.length&&this.fire("done",this.element.files),this.element.value=""})}})}open(){this.element.click()}}var Nc=n(31),Ic=n.n(Nc);function Mc(t){return/^image\/(jpeg|png|gif|bmp)$/.test(t.type)}function Dc(t){return new Promise((e,n)=>{const r=t.getAttribute("src");fetch(r).then(t=>t.blob()).then(t=>{const i=function(t,e){return t.type?t.type:e.match(/data:(image\/\w+);base64/)?e.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}(t,r),o=function(t,e,n){try{return new File([t],e,{type:n})}catch(t){return null}}(t,`image.${i.replace("image/","")}`,i);o?e(o):n()}).catch(n)})}class jc extends Ca{init(){const t=this.editor,e=t.t;t.ui.componentFactory.add("imageUpload",n=>{const r=new Pc(n),i=t.commands.get("imageUpload");return r.set({acceptedType:"image/*",allowMultipleFiles:!0}),r.buttonView.set({label:e("i"),icon:Ic.a,tooltip:!0}),r.buttonView.bind("isEnabled").to(i),r.on("done",(e,n)=>{const r=Array.from(n).filter(Mc);r.length&&t.execute("imageUpload",{file:r})}),r})}}var Lc=n(32),Rc=n.n(Lc);n(84),n(86),n(88);class Fc extends Ca{constructor(t){super(t),this.placeholder="data:image/svg+xml;utf8,"+encodeURIComponent(Rc.a)}init(){this.editor.editing.downcastDispatcher.on("attribute:uploadStatus:image",(...t)=>this.uploadStatusChange(...t))}uploadStatusChange(t,e,n){const r=this.editor,i=e.item,o=i.getAttribute("uploadId");if(!n.consumable.consume(e.item,t.name))return;const s=r.plugins.get(Ol),a=o?e.attributeNewValue:null,l=this.placeholder,u=r.editing.mapper.toViewElement(i),c=n.writer;if("reading"==a)return Bc(u,c),void Vc(l,u,c);if("uploading"==a){const t=s.loaders.get(o);return Bc(u,c),void(t?(qc(u,c),function(t,e,n,r){const i=function(t){const e=t.createUIElement("div",{class:"ck-progress-bar"});return t.setCustomProperty("progressBar",!0,e),e}(e);e.insert(e.createPositionAt(t,"end"),i),n.on("change:uploadedPercent",(t,e,n)=>{r.change(t=>{t.setStyle("width",n+"%",i)})})}(u,c,t,r.editing.view)):Vc(l,u,c))}"complete"==a&&s.loaders.get(o)&&!Cn.isEdge&&function(t,e,n){const r=e.createUIElement("div",{class:"ck-image-upload-complete-icon"});e.insert(e.createPositionAt(t,"end"),r),setTimeout(()=>{n.change(t=>t.remove(t.createRangeOn(r)))},3e3)}(u,c,r.editing.view),Uc(u,c,"progressBar"),qc(u,c),c.removeClass("ck-appear",u)}}function Bc(t,e){t.hasClass("ck-appear")||e.addClass("ck-appear",t)}function Vc(t,e,n){e.hasClass("ck-image-upload-placeholder")||n.addClass("ck-image-upload-placeholder",e);const r=e.getChild(0);r.getAttribute("src")!==t&&n.setAttribute("src",t,r),zc(e,"placeholder")||n.insert(n.createPositionAfter(r),function(t){const e=t.createUIElement("div",{class:"ck-upload-placeholder-loader"});return t.setCustomProperty("placeholder",!0,e),e}(n))}function qc(t,e){t.hasClass("ck-image-upload-placeholder")&&e.removeClass("ck-image-upload-placeholder",t),Uc(t,e,"placeholder")}function zc(t,e){for(const n of t.getChildren())if(n.getCustomProperty(e))return n}function Uc(t,e,n){const r=zc(t,n);r&&e.remove(e.createRangeOn(r))}class Hc{createDocumentFragment(t){return new Mn(t)}createElement(t,e,n){return new Le(t,e,n)}createText(t){return new Te(t)}clone(t,e=!1){return t._clone(e)}appendChild(t,e){return e._appendChild(t)}insertChild(t,e,n){return n._insertChild(t,e)}removeChildren(t,e,n){return n._removeChildren(t,e)}remove(t){const e=t.parent;return e?this.removeChildren(e.getChildIndex(t),1,e):[]}replace(t,e){const n=t.parent;if(n){const r=n.getChildIndex(t);return this.removeChildren(r,1,n),this.insertChild(r,e,n),!0}return!1}rename(t,e){const n=new Le(t,e.getAttributes(),e.getChildren());return this.replace(e,n)?n:null}setAttribute(t,e,n){n._setAttribute(t,e)}removeAttribute(t,e){e._removeAttribute(t)}addClass(t,e){e._addClass(t)}removeClass(t,e){e._removeClass(t)}setStyle(t,e,n){w(t)&&void 0===n&&(n=e),n._setStyle(t,e)}removeStyle(t,e){e._removeStyle(t)}setCustomProperty(t,e,n){n._setCustomProperty(t,e)}removeCustomProperty(t,e){return e._removeCustomProperty(t)}createPositionAt(t,e){return un._createAt(t,e)}createPositionAfter(t){return un._createAfter(t)}createPositionBefore(t){return un._createBefore(t)}createRange(t,e){return new cn(t,e)}createRangeOn(t){return cn._createOn(t)}createRangeIn(t){return cn._createIn(t)}createSelection(t,e,n){return new fn(t,e,n)}}class Wc extends Pa{refresh(){this.isEnabled=qu(this.editor.model)}execute(t){const e=this.editor,n=e.model,r=e.plugins.get(Ol);n.change(e=>{const i=Array.isArray(t.file)?t.file:[t.file];for(const t of i)Gc(e,n,r,t)})}}function Gc(t,e,n,r){const i=n.createLoader(r);i&&Vu(t,e,{uploadId:i.id})}class Yc extends Ca{static get requires(){return[Ol,cu]}init(){const t=this.editor,e=t.model.document,n=t.model.schema,r=t.conversion,i=t.plugins.get(Ol);n.extend("image",{allowAttributes:["uploadId","uploadStatus"]}),t.commands.add("imageUpload",new Wc(t)),r.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(t.editing.view.document,"clipboardInput",(e,n)=>{if(function(t){return Array.from(t.types).includes("text/html")&&""!==t.getData("text/html")}(n.dataTransfer))return;const r=Array.from(n.dataTransfer.files).filter(t=>!!t&&Mc(t)),i=n.targetRanges.map(e=>t.editing.mapper.toModelRange(e));t.model.change(n=>{n.setSelection(i),r.length&&(e.stop(),t.model.enqueueChange("default",()=>{t.execute("imageUpload",{file:r})}))})}),t.plugins.has("Clipboard")&&this.listenTo(t.plugins.get("Clipboard"),"inputTransformation",(e,n)=>{const r=Array.from(t.editing.view.createRangeIn(n.content)).filter(t=>(function(t){return!(!t.is("element","img")||!t.getAttribute("src"))&&(t.getAttribute("src").match(/^data:image\/\w+;base64,/g)||t.getAttribute("src").match(/^blob:/g))})(t.item)&&!t.item.getAttribute("uploadProcessed")).map(t=>({promise:Dc(t.item),imageElement:t.item}));if(!r.length)return;const o=new Hc;for(const t of r){o.setAttribute("uploadProcessed",!0,t.imageElement);const e=i.createLoader(t.promise);e&&(o.setAttribute("src","",t.imageElement),o.setAttribute("uploadId",e.id,t.imageElement))}}),t.editing.view.document.on("dragover",(t,e)=>{e.preventDefault()}),e.on("change",()=>{const t=e.differ.getChanges({includeChangesInGraveyard:!0});for(const e of t)if("insert"==e.type&&"image"==e.name){const t=e.position.nodeAfter,n="$graveyard"==e.position.root.rootName,r=t.getAttribute("uploadId");if(!r)continue;const o=i.loaders.get(r);if(!o)continue;n?o.abort():"idle"==o.status&&this._readAndUpload(o,t)}})}_readAndUpload(t,e){const n=this.editor,r=n.model,i=n.locale.t,o=n.plugins.get(Ol),s=n.plugins.get(cu);return r.enqueueChange("transparent",t=>{t.setAttribute("uploadStatus","reading",e)}),t.read().then(i=>{const o=n.editing.mapper.toViewElement(e).getChild(0),s=t.upload();return n.editing.view.change(t=>{t.setAttribute("src",i,o)}),r.enqueueChange("transparent",t=>{t.setAttribute("uploadStatus","uploading",e)}),s}).then(t=>{r.enqueueChange("transparent",n=>{n.setAttributes({uploadStatus:"complete",src:t.default},e),this._parseAndSetSrcsetAttributeOnImage(t,e,n)}),a()}).catch(n=>{if("error"!==t.status&&"aborted"!==t.status)throw n;"error"==t.status&&n&&s.showWarning(n,{title:i("ai"),namespace:"upload"}),a(),r.enqueueChange("transparent",t=>{t.remove(e)})});function a(){r.enqueueChange("transparent",t=>{t.removeAttribute("uploadId",e),t.removeAttribute("uploadStatus",e)}),o.destroyLoader(t)}}_parseAndSetSrcsetAttributeOnImage(t,e,n){let r=0;const i=Object.keys(t).filter(t=>{const e=parseInt(t,10);if(!isNaN(e))return r=Math.max(r,e),!0}).map(e=>`${t[e]} ${e}w`).join(", ");""!=i&&n.setAttribute("srcset",{data:i,width:r},e)}}class Kc extends Ca{static get pluginName(){return"ImageUpload"}static get requires(){return[Yc,jc,Fc]}}class $c extends Pa{refresh(){const t=this.editor.model,e=Jl(t.document.selection.getSelectedBlocks());this.value=!!e&&e.is("paragraph"),this.isEnabled=!!e&&Zc(e,t.schema)}execute(t={}){const e=this.editor.model,n=e.document;e.change(r=>{const i=(t.selection||n.selection).getSelectedBlocks();for(const t of i)!t.is("paragraph")&&Zc(t,e.schema)&&r.rename(t,"paragraph")})}}function Zc(t,e){return e.checkChild(t.parent,"paragraph")&&!e.isObject(t)}class Qc extends Ca{static get pluginName(){return"Paragraph"}init(){const t=this.editor,e=t.model,n=t.data;t.commands.add("paragraph",new $c(t)),e.schema.register("paragraph",{inheritAllFrom:"$block"}),t.conversion.elementToElement({model:"paragraph",view:"p"}),t.conversion.for("upcast").elementToElement({model:(t,e)=>Qc.paragraphLikeElements.has(t.name)?t.isEmpty?null:e.createElement("paragraph"):null,converterPriority:"low"}),n.upcastDispatcher.on("element",(t,e,n)=>{n.consumable.test(e.viewItem,{name:e.viewItem.name})&&Xc(e.viewItem,e.modelCursor,n.schema)&&Object.assign(e,Jc(e.viewItem,e.modelCursor,n))},{priority:"low"}),n.upcastDispatcher.on("text",(t,e,n)=>{e.modelRange||Xc(e.viewItem,e.modelCursor,n.schema)&&Object.assign(e,Jc(e.viewItem,e.modelCursor,n))},{priority:"lowest"}),e.document.registerPostFixer(t=>this._autoparagraphEmptyRoots(t)),t.data.on("ready",()=>{e.enqueueChange("transparent",t=>this._autoparagraphEmptyRoots(t))},{priority:"lowest"})}_autoparagraphEmptyRoots(t){const e=this.editor.model;for(const n of e.document.getRootNames()){const r=e.document.getRoot(n);if(r.isEmpty&&"$graveyard"!=r.rootName&&e.schema.checkChild(r,"paragraph"))return t.insertElement("paragraph",r),!0}}}function Jc(t,e,n){const r=n.writer.createElement("paragraph");return n.writer.insert(r,e),n.convertItem(t,n.writer.createPositionAt(r,0))}function Xc(t,e,n){const r=n.createContext(e);return!!n.checkChild(r,"paragraph")&&!!n.checkChild(r.push("paragraph"),t)}Qc.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td"]);class td extends Pa{constructor(t,e){super(t),this.modelElements=e}refresh(){const t=Jl(this.editor.model.document.selection.getSelectedBlocks());this.value=!!t&&this.modelElements.includes(t.name)&&t.name,this.isEnabled=!!t&&this.modelElements.some(e=>ed(t,e,this.editor.model.schema))}execute(t){const e=this.editor.model,n=e.document,r=t.value;e.change(t=>{const i=Array.from(n.selection.getSelectedBlocks()).filter(t=>ed(t,r,e.schema));for(const e of i)e.is(r)||t.rename(e,r)})}}function ed(t,e,n){return n.checkChild(t.parent,e)&&!n.isObject(t)}const nd="paragraph";class rd extends Ca{constructor(t){super(t),t.config.define("heading",{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading1",view:"h2",title:"Heading 1",class:"ck-heading_heading1"},{model:"heading2",view:"h3",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h4",title:"Heading 3",class:"ck-heading_heading3"}]})}static get requires(){return[Qc]}init(){const t=this.editor,e=t.config.get("heading.options"),n=[];for(const r of e)r.model!==nd&&(t.model.schema.register(r.model,{inheritAllFrom:"$block"}),t.conversion.elementToElement(r),n.push(r.model));this._addDefaultH1Conversion(t),t.commands.add("heading",new td(t,n))}afterInit(){const t=this.editor,e=t.commands.get("enter"),n=t.config.get("heading.options");e&&this.listenTo(e,"afterExecute",(e,r)=>{const i=t.model.document.selection.getFirstPosition().parent;n.some(t=>i.is(t.model))&&!i.is(nd)&&0===i.childCount&&r.writer.rename(i,nd)})}_addDefaultH1Conversion(t){t.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:me.get("low")+1})}}class id{constructor(t,e){e&&Ge(this,e),t&&this.set(t)}}Se(id,Qe);class od extends ua{constructor(t){super(t);const e=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",e.to("position",t=>`ck-dropdown__panel_${t}`),e.if("isVisible","ck-dropdown__panel-visible")]},children:this.children,on:{selectstart:e.to(t=>t.preventDefault())}})}focus(){this.children.length&&this.children.first.focus()}focusLast(){if(this.children.length){const t=this.children.last;"function"==typeof t.focusLast?t.focusLast():t.focus()}}}n(90);class sd extends ua{constructor(t,e,n){super(t);const r=this.bindTemplate;this.buttonView=e,this.panelView=n,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("class"),this.set("panelPosition","auto"),this.focusTracker=new js,this.keystrokes=new Ss,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",r.to("class"),r.if("isEnabled","ck-disabled",t=>!t)]},children:[e,n]}),e.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",()=>{if(this.isOpen)if("auto"===this.panelPosition){const t=sd.defaultPanelPositions;this.panelView.position=sc({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:[t.southEast,t.southWest,t.northEast,t.northWest]}).name}else this.panelView.position=this.panelPosition}),this.keystrokes.listenTo(this.element),this.focusTracker.add(this.element);const t=(t,e)=>{this.isOpen&&(this.buttonView.focus(),this.isOpen=!1,e())};this.keystrokes.set("arrowdown",(t,e)=>{this.buttonView.isEnabled&&!this.isOpen&&(this.isOpen=!0,e())}),this.keystrokes.set("arrowright",(t,e)=>{this.isOpen&&e()}),this.keystrokes.set("arrowleft",t),this.keystrokes.set("esc",t)}focus(){this.buttonView.focus()}}sd.defaultPanelPositions={southEast:t=>({top:t.bottom,left:t.left,name:"se"}),southWest:(t,e)=>({top:t.bottom,left:t.left-e.width+t.width,name:"sw"}),northEast:(t,e)=>({top:t.top-e.height,left:t.left,name:"ne"}),northWest:(t,e)=>({top:t.bottom-e.height,left:t.left-e.width+t.width,name:"nw"})};var ad=n(33),ld=n.n(ad);class ud extends bl{constructor(t){super(t),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 t=new vl;return t.content=ld.a,t.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),t}}n(92);class cd extends ua{constructor(){super(),this.items=this.createCollection(),this.focusTracker=new js,this.keystrokes=new Ss,this._focusCycler=new ya({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 t of this.items)this.focusTracker.add(t.element);this.items.on("add",(t,e)=>{this.focusTracker.add(e.element)}),this.items.on("remove",(t,e)=>{this.focusTracker.remove(e.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}class dd extends ua{constructor(t){super(t),this.children=this.createCollection(),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__item"]},children:this.children})}focus(){this.children.first.focus()}}class hd extends ua{constructor(t){super(t),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}})}}n(94);class fd extends bl{constructor(t){super(t),this.toggleSwitchView=this._createToggleView(),this.extendTemplate({attributes:{class:"ck-switchbutton"}})}render(){super.render(),this.children.add(this.toggleSwitchView)}_createToggleView(){const t=new ua;return t.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),t}}function pd(t,e=ud){const n=new e(t),r=new od(t),i=new sd(t,n,r);return n.bind("isEnabled").to(i),n instanceof ud?n.bind("isOn").to(i,"isOpen"):n.arrowView.bind("isOn").to(i,"isOpen"),function(t){(function(t){t.on("render",()=>{Qu({emitter:t,activator:()=>t.isOpen,callback:()=>{t.isOpen=!1},contextElements:[t.element]})})})(t),function(t){t.on("execute",e=>{e.source instanceof fd||(t.isOpen=!1)})}(t),function(t){t.keystrokes.set("arrowdown",(e,n)=>{t.isOpen&&(t.panelView.focus(),n())}),t.keystrokes.set("arrowup",(e,n)=>{t.isOpen&&(t.panelView.focusLast(),n())})}(t)}(i),i}function gd(t,e){const n=t.locale,r=t.listView=new cd(n);r.items.bindTo(e).using(({type:t,model:e})=>{if("separator"===t)return new hd(n);if("button"===t||"switchbutton"===t){const r=new dd(n);let i;return(i="button"===t?new bl(n):new fd(n)).bind(...Object.keys(e)).to(e),i.delegate("execute").to(r),r.children.add(i),r}}),t.panelView.children.add(r),r.items.delegate("execute").to(t)}n(96),n(98),n(17);class md extends Ca{init(){const t=this.editor,e=t.t,n=function(t){const e=t.t,n={Paragraph:e("bm"),"Heading 1":e("bn"),"Heading 2":e("bo"),"Heading 3":e("bp"),"Heading 4":e("bq"),"Heading 5":e("br"),"Heading 6":e("bs")};return t.config.get("heading.options").map(t=>{const e=n[t.title];return e&&e!=t.title&&(t.title=e),t})}(t),r=e("e"),i=e("f");t.ui.componentFactory.add("heading",e=>{const o={},s=new gn,a=t.commands.get("heading"),l=t.commands.get("paragraph"),u=[a];for(const t of n){const e={type:"button",model:new id({label:t.title,class:t.class,withText:!0})};"paragraph"===t.model?(e.model.bind("isOn").to(l,"value"),e.model.set("commandName","paragraph"),u.push(l)):(e.model.bind("isOn").to(a,"value",e=>e===t.model),e.model.set({commandName:"heading",commandValue:t.model})),s.add(e),o[t.model]=t.title}const c=pd(e);return gd(c,s),c.buttonView.set({isOn:!1,withText:!0,tooltip:i}),c.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),c.bind("isEnabled").toMany(u,"isEnabled",(...t)=>t.some(t=>t)),c.buttonView.bind("label").to(a,"value",l,"value",(t,e)=>{const n=t||e&&"paragraph";return o[n]?o[n]:r}),this.listenTo(c,"execute",e=>{t.execute(e.source.commandName,e.source.commandValue?{value:e.source.commandValue}:void 0),t.editing.view.focus()}),c})}}function vd(t){for(const e of t.getChildren())if(e&&e.is("caption"))return e;return null}function yd(t){const e=t.parent;return"figcaption"==t.name&&e&&"figure"==e.name&&e.hasClass("image")?{name:!0}:null}class bd extends Ca{init(){const t=this.editor,e=t.editing.view,n=t.data,r=t.editing,i=t.t;t.model.schema.register("caption",{allowIn:"image",allowContentOf:"$block",isLimit:!0}),t.model.document.registerPostFixer(t=>this._insertMissingModelCaptionElement(t)),t.conversion.for("upcast").elementToElement({view:yd,model:"caption"}),n.downcastDispatcher.on("insert:caption",wd(t=>t.createContainerElement("figcaption"),!1));const o=function(t,e){return n=>{const r=n.createEditableElement("figcaption");return n.setCustomProperty("imageCaption",!0,r),Fs({view:t,element:r,text:e}),ju(r,n)}}(e,i("aj"));r.downcastDispatcher.on("insert:caption",wd(o)),r.downcastDispatcher.on("insert",this._fixCaptionVisibility(t=>t.item),{priority:"high"}),r.downcastDispatcher.on("remove",this._fixCaptionVisibility(t=>t.position.parent),{priority:"high"}),e.document.registerPostFixer(t=>this._updateCaptionVisibility(t))}_updateCaptionVisibility(t){const e=this.editor.editing.mapper,n=this._lastSelectedCaption;let r;const i=this.editor.model.document.selection,o=i.getSelectedElement();if(o&&o.is("image")){const t=vd(o);r=e.toViewElement(t)}const s=_d(i.getFirstPosition().parent);if(s&&(r=e.toViewElement(s)),r)return n?n===r?xd(r,t):(kd(n,t),this._lastSelectedCaption=r,xd(r,t)):(this._lastSelectedCaption=r,xd(r,t));if(n){const e=kd(n,t);return this._lastSelectedCaption=null,e}return!1}_fixCaptionVisibility(t){return(e,n,r)=>{const i=_d(t(n)),o=r.writer;if(i){const t=this.editor.editing.mapper.toViewElement(i);t&&(i.childCount?o.removeClass("ck-hidden",t):o.addClass("ck-hidden",t))}}}_insertMissingModelCaptionElement(t){const e=this.editor.model,n=e.document.differ.getChanges(),r=[];for(const i of n)if("insert"==i.type&&"$text"!=i.name){const t=i.position.nodeAfter;if(t.is("image")&&!vd(t)&&r.push(t),!t.is("image")&&t.childCount)for(const n of e.createRangeIn(t).getItems())n.is("image")&&!vd(n)&&r.push(n)}for(const i of r)t.appendElement("caption",i);return!!r.length}}function wd(t,e=!0){return(n,r,i)=>{const o=r.item;if((o.childCount||e)&&Bu(o.parent)){if(!i.consumable.consume(r.item,"insert"))return;const e=i.mapper.toViewElement(r.range.start.parent),n=t(i.writer),s=i.writer;o.childCount||s.addClass("ck-hidden",n),function(t,e,n,r){const i=r.writer.createPositionAt(n,"end");r.writer.insert(i,t),r.mapper.bindElements(e,t)}(n,r.item,e,i)}}}function _d(t){const e=t.getAncestors({includeSelf:!0}).find(t=>"caption"==t.name);return e&&e.parent&&"image"==e.parent.name?e:null}function kd(t,e){return!t.childCount&&!t.hasClass("ck-hidden")&&(e.addClass("ck-hidden",t),!0)}function xd(t,e){return!!t.hasClass("ck-hidden")&&(e.removeClass("ck-hidden",t),!0)}n(101);class Cd extends Pa{constructor(t,e){super(t),this.defaultStyle=!1,this.styles=e.reduce((t,e)=>(t[e.name]=e,e.isDefault&&(this.defaultStyle=e.name),t),{})}refresh(){const t=this.editor.model.document.selection.getSelectedElement();if(this.isEnabled=Bu(t),t)if(t.hasAttribute("imageStyle")){const e=t.getAttribute("imageStyle");this.value=!!this.styles[e]&&e}else this.value=this.defaultStyle;else this.value=!1}execute(t){const e=t.value,n=this.editor.model,r=n.document.selection.getSelectedElement();n.change(t=>{this.styles[e].isDefault?t.removeAttribute("imageStyle",r):t.setAttribute("imageStyle",e,r)})}}function Ad(t,e){for(const n of e)if(n.name===t)return n}var Sd=n(13),Ed=n.n(Sd),Od=n(14),Pd=n.n(Od),Td=n(15),Nd=n.n(Td),Id=n(11),Md=n.n(Id);const Dd={full:{name:"full",title:"Full size image",icon:Ed.a,isDefault:!0},side:{name:"side",title:"Side image",icon:Md.a,className:"image-style-side"},alignLeft:{name:"alignLeft",title:"Left aligned image",icon:Pd.a,className:"image-style-align-left"},alignCenter:{name:"alignCenter",title:"Centered image",icon:Nd.a,className:"image-style-align-center"},alignRight:{name:"alignRight",title:"Right aligned image",icon:Md.a,className:"image-style-align-right"}},jd={full:Ed.a,left:Pd.a,right:Md.a,center:Nd.a};function Ld(t=[]){return t.map(Rd)}function Rd(t){if("string"==typeof t){const e=t;Dd[e]?t=Object.assign({},Dd[e]):(Xr.a.warn("image-style-not-found: There is no such image style of given name.",{name:e}),t={name:e})}else if(Dd[t.name]){const e=Dd[t.name],n=Object.assign({},t);for(const r in e)t.hasOwnProperty(r)||(n[r]=e[r]);t=n}return"string"==typeof t.icon&&jd[t.icon]&&(t.icon=jd[t.icon]),t}class Fd extends Ca{static get pluginName(){return"ImageStyleEditing"}init(){const t=this.editor,e=t.model.schema,n=t.data,r=t.editing;t.config.define("image.styles",["full","side"]);const i=Ld(t.config.get("image.styles"));e.extend("image",{allowAttributes:"imageStyle"});const o=function(t){return(e,n,r)=>{if(!r.consumable.consume(n.item,e.name))return;const i=Ad(n.attributeNewValue,t),o=Ad(n.attributeOldValue,t),s=r.mapper.toViewElement(n.item),a=r.writer;o&&a.removeClass(o.className,s),i&&a.addClass(i.className,s)}}(i);r.downcastDispatcher.on("attribute:imageStyle:image",o),n.downcastDispatcher.on("attribute:imageStyle:image",o),n.upcastDispatcher.on("element:figure",function(t){const e=i.filter(t=>!t.isDefault);return(t,n,r)=>{if(!n.modelRange)return;const i=n.viewItem,o=Jl(n.modelRange.getItems());if(r.schema.checkAttribute(o,"imageStyle"))for(const s of e)r.consumable.consume(i,{classes:s.className})&&r.writer.setAttribute("imageStyle",s.name,o)}}(),{priority:"low"}),t.commands.add("imageStyle",new Cd(t,i))}}n(103);class Bd extends Ca{static get pluginName(){return"ImageStyleUI"}get localizedDefaultStylesTitles(){const t=this.editor.t;return{"Full size image":t("j"),"Side image":t("k"),"Left aligned image":t("l"),"Centered image":t("m"),"Right aligned image":t("n")}}init(){const t=function(t,e){for(const n of t)e[n.title]&&(n.title=e[n.title]);return t}(Ld(this.editor.config.get("image.styles")),this.localizedDefaultStylesTitles);for(const e of t)this._createButton(e)}_createButton(t){const e=this.editor;e.ui.componentFactory.add(`imageStyle:${t.name}`,n=>{const r=e.commands.get("imageStyle"),i=new bl(n);return i.set({label:t.title,icon:t.icon,tooltip:!0}),i.bind("isEnabled").to(r,"isEnabled"),i.bind("isOn").to(r,"value",e=>e===t.name),this.listenTo(i,"execute",()=>e.execute("imageStyle",{value:t.name})),i})}}class Vd extends Ca{static get requires(){return[wc]}static get pluginName(){return"WidgetToolbarRepository"}init(){const t=this.editor;if(t.plugins.has("BalloonToolbar")){const e=t.plugins.get("BalloonToolbar");this.listenTo(e,"show",e=>{(function(t){const e=t.getSelectedElement();return!(!e||!Iu(e))})(t.editing.view.document.selection)&&e.stop()},{priority:"high"})}this._toolbarDefinitions=new Map,this._balloon=this.editor.plugins.get("ContextualBalloon"),this.listenTo(t.ui,"update",()=>{this._updateToolbarsVisibility()}),this.listenTo(t.ui.focusTracker,"change:isFocused",()=>{this._updateToolbarsVisibility()},{priority:"low"})}destroy(){super.destroy();for(const t of this._toolbarDefinitions.values())t.view.destroy()}register(t,{items:e,getRelatedElement:n,balloonClassName:r="ck-toolbar-container"}){const i=this.editor,o=new _a;if(this._toolbarDefinitions.has(t))throw new he.b("widget-toolbar-duplicated: Toolbar with the given id was already added.",{toolbarId:t});o.fillFromConfig(e,i.ui.componentFactory),this._toolbarDefinitions.set(t,{view:o,getRelatedElement:n,balloonClassName:r})}_updateToolbarsVisibility(){let t=0,e=null,n=null;for(const r of this._toolbarDefinitions.values()){const i=r.getRelatedElement(this.editor.editing.view.document.selection);if(this.editor.ui.focusTracker.isFocused)if(i){const o=i.getAncestors().length;o>t&&(t=o,e=i,n=r)}else this._isToolbarInBalloon(r)&&this._hideToolbar(r);else this._isToolbarVisible(r)&&this._hideToolbar(r)}n&&this._showToolbar(n,e)}_hideToolbar(t){this._balloon.remove(t.view)}_showToolbar(t,e){this._isToolbarVisible(t)?function(t,e){const n=t.plugins.get("ContextualBalloon"),r=qd(t,e);n.updatePosition(r)}(this.editor,e):this._isToolbarInBalloon(t)||this._balloon.add({view:t.view,position:qd(this.editor,e),balloonClassName:t.balloonClassName})}_isToolbarVisible(t){return this._balloon.visibleView===t.view}_isToolbarInBalloon(t){return this._balloon.hasView(t.view)}}function qd(t,e){const n=dc.defaultPositions;return{target:t.editing.view.domConverter.viewToDom(e),positions:[n.northArrowSouth,n.northArrowSouthWest,n.northArrowSouthEast,n.southArrowNorth,n.southArrowNorthWest,n.southArrowNorthEast]}}function zd(t,e,n){return n.createRange(Ud(t,e,!0,n),Ud(t,e,!1,n))}function Ud(t,e,n,r){let i=t.textNode||(n?t.nodeBefore:t.nodeAfter),o=null;for(;i&&i.getAttribute("linkHref")==e;)o=i,i=n?i.previousSibling:i.nextSibling;return o?r.createPositionAt(o,n?"before":"after"):t}class Hd extends Pa{refresh(){const t=this.editor.model,e=t.document;this.value=e.selection.getAttribute("linkHref"),this.isEnabled=t.schema.checkAttributeInSelection(e.selection,"linkHref")}execute(t){const e=this.editor.model,n=e.document.selection;e.change(r=>{if(n.isCollapsed){const i=n.getFirstPosition();if(n.hasAttribute("linkHref")){const i=zd(n.getFirstPosition(),n.getAttribute("linkHref"),e);r.setAttribute("linkHref",t,i),r.setSelection(i)}else if(""!==t){const o=wi(n.getAttributes());o.set("linkHref",t);const s=r.createText(t,o);e.insertContent(s,i),r.setSelection(r.createRangeOn(s))}}else{const i=e.schema.getValidRanges(n.getRanges(),"linkHref");for(const e of i)r.setAttribute("linkHref",t,e)}})}}class Wd extends Pa{refresh(){this.isEnabled=this.editor.model.document.selection.hasAttribute("linkHref")}execute(){const t=this.editor.model,e=t.document.selection;t.change(n=>{const r=e.isCollapsed?[zd(e.getFirstPosition(),e.getAttribute("linkHref"),t)]:e.getRanges();for(const t of r)n.removeAttribute("linkHref",t)})}}const Gd=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,Yd=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i;function Kd(t,e){const n=e.createAttributeElement("a",{href:t},{priority:5});return e.setCustomProperty("link",!0,n),n}function $d(t){return function(t){return t.replace(Gd,"").match(Yd)}(t=String(t))?t:"#"}class Zd{constructor(t,e,n){this.model=t,this.attribute=n,this._modelSelection=t.document.selection,this._overrideUid=null,this._isNextGravityRestorationSkipped=!1,e.listenTo(this._modelSelection,"change:range",(t,e)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!e.directChange&&Qd(this._modelSelection.getFirstPosition(),n)||this._restoreGravity())})}handleForwardMovement(t,e){const n=this.attribute;if(!(this._isGravityOverridden||t.isAtStart&&this._hasSelectionAttribute))return th(t,n)&&this._hasSelectionAttribute?(this._preventCaretMovement(e),this._removeSelectionAttribute(),!0):Jd(t,n)?(this._preventCaretMovement(e),this._overrideGravity(),!0):Xd(t,n)&&this._hasSelectionAttribute?(this._preventCaretMovement(e),this._overrideGravity(),!0):void 0}handleBackwardMovement(t,e){const n=this.attribute;return this._isGravityOverridden?th(t,n)&&this._hasSelectionAttribute?(this._preventCaretMovement(e),this._restoreGravity(),this._removeSelectionAttribute(),!0):(this._preventCaretMovement(e),this._restoreGravity(),t.isAtStart&&this._removeSelectionAttribute(),!0):th(t,n)&&!this._hasSelectionAttribute?(this._preventCaretMovement(e),this._setSelectionAttributeFromTheNodeBefore(t),!0):t.isAtEnd&&Xd(t,n)?this._hasSelectionAttribute?void(eh(t,n)&&(this._skipNextAutomaticGravityRestoration(),this._overrideGravity())):(this._preventCaretMovement(e),this._setSelectionAttributeFromTheNodeBefore(t),!0):t.isAtStart?this._hasSelectionAttribute?(this._removeSelectionAttribute(),this._preventCaretMovement(e),!0):void 0:void(eh(t,n)&&(this._skipNextAutomaticGravityRestoration(),this._overrideGravity()))}get _isGravityOverridden(){return!!this._overrideUid}get _hasSelectionAttribute(){return this._modelSelection.hasAttribute(this.attribute)}_overrideGravity(){this._overrideUid=this.model.change(t=>t.overrideSelectionGravity())}_restoreGravity(){this.model.change(t=>{t.restoreSelectionGravity(this._overrideUid),this._overrideUid=null})}_preventCaretMovement(t){t.preventDefault()}_removeSelectionAttribute(){this.model.change(t=>{t.removeSelectionAttribute(this.attribute)})}_setSelectionAttributeFromTheNodeBefore(t){const e=this.attribute;this.model.change(n=>{n.setSelectionAttribute(this.attribute,t.nodeBefore.getAttribute(e))})}_skipNextAutomaticGravityRestoration(){this._isNextGravityRestorationSkipped=!0}}function Qd(t,e){return Jd(t,e)||Xd(t,e)}function Jd(t,e){const{nodeBefore:n,nodeAfter:r}=t,i=!!n&&n.hasAttribute(e);return!!r&&r.hasAttribute(e)&&(!i||n.getAttribute(e)!==r.getAttribute(e))}function Xd(t,e){const{nodeBefore:n,nodeAfter:r}=t,i=!!n&&n.hasAttribute(e),o=!!r&&r.hasAttribute(e);return i&&(!o||n.getAttribute(e)!==r.getAttribute(e))}function th(t,e){const{nodeBefore:n,nodeAfter:r}=t,i=!!n&&n.hasAttribute(e);if(r&&r.hasAttribute(e)&&i)return r.getAttribute(e)!==n.getAttribute(e)}function eh(t,e){return Qd(t.getShiftedBy(-1),e)}n(105);const nh="ck-link_selected";class rh extends Ca{init(){const t=this.editor;t.model.schema.extend("$text",{allowAttributes:"linkHref"}),t.conversion.for("dataDowncast").attributeToElement({model:"linkHref",view:Kd}),t.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(t,e)=>Kd($d(t),e)}),t.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:t=>t.getAttribute("href")}}),t.commands.add("link",new Hd(t)),t.commands.add("unlink",new Wd(t)),function(t,e,n,r){const i=new Zd(e,n,"linkHref"),o=e.document.selection;n.listenTo(t.document,"keydown",(t,e)=>{if(!o.isCollapsed)return;if(e.shiftKey||e.altKey||e.ctrlKey)return;const n=e.keyCode==En.arrowright;if(!n&&e.keyCode!=En.arrowleft)return;const r=o.getFirstPosition();let s;(s=n?i.handleForwardMovement(r,e):i.handleBackwardMovement(r,e))&&t.stop()},{priority:me.get("high")+1})}(t.editing.view,t.model,this),this._setupLinkHighlight()}_setupLinkHighlight(){const t=this.editor,e=t.editing.view,n=new Set;e.document.registerPostFixer(e=>{const r=t.model.document.selection;if(r.hasAttribute("linkHref")){const i=zd(r.getFirstPosition(),r.getAttribute("linkHref"),t.model),o=t.editing.mapper.toViewRange(i);for(const t of o.getItems())t.is("a")&&(e.addClass(nh,t),n.add(t))}}),t.conversion.for("editingDowncast").add(t=>{function r(){e.change(t=>{for(const e of n.values())t.removeClass(nh,e),n.delete(e)})}t.on("insert",r,{priority:"highest"}),t.on("remove",r,{priority:"highest"}),t.on("attribute",r,{priority:"highest"}),t.on("selection",r,{priority:"highest"})})}}class ih extends Vr{constructor(t){super(t),this.domEventType="click"}onDomEvent(t){this.fire(t.type,t)}}n(107);class oh extends ua{constructor(t){super(t);const e=t.t;this.focusTracker=new js,this.keystrokes=new Ss,this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(e("ay"),nc.a,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(e("az"),ic.a,"ck-button-cancel","cancel"),this._focusables=new Us,this._focusCycler=new ya({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-link-form"],tabindex:"-1"},children:[this.urlInputView,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),tc({view:this}),[this.urlInputView,this.saveButtonView,this.cancelButtonView].forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}_createUrlInput(){const t=this.locale.t,e=new Ju(this.locale,Xu);return e.label=t("ba"),e.inputView.placeholder="https://example.com",e}_createButton(t,e,n,r){const i=new bl(this.locale);return i.set({label:t,icon:e,tooltip:!0}),i.extendTemplate({attributes:{class:n}}),r&&i.delegate("execute").to(this,r),i}}var sh=n(34),ah=n.n(sh),lh=n(35),uh=n.n(lh);n(109);class ch extends ua{constructor(t){super(t);const e=t.t;this.focusTracker=new js,this.keystrokes=new Ss,this.previewButtonView=this._createPreviewButton(),this.unlinkButtonView=this._createButton(e("au"),ah.a,"unlink"),this.editButtonView=this._createButton(e("av"),uh.a,"edit"),this.set("href"),this._focusables=new Us,this._focusCycler=new ya({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(t=>{this._focusables.add(t),this.focusTracker.add(t.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}_createButton(t,e,n){const r=new bl(this.locale);return r.set({label:t,icon:e,tooltip:!0}),r.delegate("execute").to(this,n),r}_createPreviewButton(){const t=new bl(this.locale),e=this.bindTemplate,n=this.t;return t.set({withText:!0,tooltip:n("aw")}),t.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:e.to("href",t=>t&&$d(t)),target:"_blank"}}),t.bind("label").to(this,"href",t=>t||n("ax")),t.bind("isEnabled").to(this,"href",t=>!!t),t.template.tag="a",t.template.eventListeners={},t}}var dh=n(36),hh=n.n(dh);const fh="Ctrl+K";class ph extends Ca{static get requires(){return[wc]}static get pluginName(){return"LinkUI"}init(){const t=this.editor;t.editing.view.addObserver(ih),this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._balloon=t.plugins.get(wc),this._createToolbarLinkButton(),this._enableUserBalloonInteractions()}destroy(){super.destroy(),this.formView.destroy()}_createActionsView(){const t=this.editor,e=new ch(t.locale),n=t.commands.get("link"),r=t.commands.get("unlink");return e.bind("href").to(n,"value"),e.editButtonView.bind("isEnabled").to(n),e.unlinkButtonView.bind("isEnabled").to(r),this.listenTo(e,"edit",()=>{this._addFormView()}),this.listenTo(e,"unlink",()=>{t.execute("unlink"),this._hideUI()}),e.keystrokes.set("Esc",(t,e)=>{this._hideUI(),e()}),e.keystrokes.set(fh,(t,e)=>{this._addFormView(),e()}),e}_createFormView(){const t=this.editor,e=new oh(t.locale),n=t.commands.get("link");return e.urlInputView.bind("value").to(n,"value"),e.urlInputView.bind("isReadOnly").to(n,"isEnabled",t=>!t),e.saveButtonView.bind("isEnabled").to(n),this.listenTo(e,"submit",()=>{t.execute("link",e.urlInputView.inputView.element.value),this._closeFormView()}),this.listenTo(e,"cancel",()=>{this._closeFormView()}),e.keystrokes.set("Esc",(t,e)=>{this._closeFormView(),e()}),e}_createToolbarLinkButton(){const t=this.editor,e=t.commands.get("link"),n=t.t;t.keystrokes.set(fh,(t,n)=>{n(),e.isEnabled&&this._showUI(!0)}),t.ui.componentFactory.add("link",t=>{const r=new bl(t);return r.isEnabled=!0,r.label=n("ao"),r.icon=hh.a,r.keystroke=fh,r.tooltip=!0,r.bind("isOn","isEnabled").to(e,"value","isEnabled"),this.listenTo(r,"execute",()=>this._showUI(!0)),r})}_enableUserBalloonInteractions(){this.listenTo(this.editor.editing.view.document,"click",()=>{this._getSelectedLinkElement()&&this._showUI()}),this.editor.keystrokes.set("Tab",(t,e)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),e())},{priority:"high"}),this.editor.keystrokes.set("Esc",(t,e)=>{this._isUIVisible&&(this._hideUI(),e())}),Qu({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 t=this.editor.commands.get("link");this._balloon.add({view:this.formView,position:this._getBalloonPositionData()}),this._balloon.visibleView===this.formView&&this.formView.urlInputView.select(),this.formView.urlInputView.inputView.element.value=t.value||""}_closeFormView(){void 0!==this.editor.commands.get("link").value?this._removeFormView():this._hideUI()}_removeFormView(){this._isFormInPanel&&(this.formView.saveButtonView.focus(),this._balloon.remove(this.formView),this.editor.editing.view.focus())}_showUI(t=!1){this.editor.commands.get("link").isEnabled&&(this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),t&&this._balloon.showStack("main")):(this._addActionsView(),t&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI())}_hideUI(){if(!this._isUIInPanel)return;const t=this.editor;this.stopListening(t.ui,"update"),t.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView)}_startUpdatingUI(){const t=this.editor,e=t.editing.view.document;let n=this._getSelectedLinkElement(),r=i();function i(){return e.selection.focus.getAncestors().reverse().find(t=>t.is("element"))}this.listenTo(t.ui,"update",()=>{const t=this._getSelectedLinkElement(),e=i();n&&!t||!n&&e!==r?this._hideUI():this._balloon.updatePosition(this._getBalloonPositionData()),n=t,r=e})}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 t=this.editor.editing.view,e=t.document,n=this._getSelectedLinkElement();return{target:n?t.domConverter.mapViewToDom(n):t.domConverter.viewRangeToDom(e.selection.getFirstRange())}}_getSelectedLinkElement(){const t=this.editor.editing.view,e=t.document.selection;if(e.isCollapsed)return gh(e.getFirstPosition());{const n=e.getFirstRange().getTrimmed(),r=gh(n.start),i=gh(n.end);return r&&r==i&&t.createRangeIn(r).getTrimmed().isEqual(n)?r:null}}}function gh(t){return t.getAncestors().find(t=>(function(t){return t.is("attributeElement")&&!!t.getCustomProperty("link")})(t))}class mh extends Pa{constructor(t,e){super(t),this.type="bulleted"==e?"bulleted":"numbered"}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model,e=Array.from(t.document.selection.getSelectedBlocks()).filter(e=>yh(e,t.schema)),n=!0===this.value;t.change(t=>{if(n){let n=e[e.length-1].nextSibling,r=Number.POSITIVE_INFINITY,i=[];for(;n&&"listItem"==n.name&&0!==n.getAttribute("listIndent");){const t=n.getAttribute("listIndent");t=n;)o>i.getAttribute("listIndent")&&(o=i.getAttribute("listIndent")),i.getAttribute("listIndent")==o&&t[e?"unshift":"push"](i),i=i[e?"previousSibling":"nextSibling"]}}function yh(t,e){return e.checkChild(t.parent,"listItem")&&!e.isObject(t)}class bh extends Pa{constructor(t,e){super(t),this._indentBy="forward"==e?1:-1}refresh(){this.isEnabled=this._checkEnabled()}execute(){const t=this.editor.model;let e=Array.from(t.document.selection.getSelectedBlocks());t.change(t=>{const n=e[e.length-1];let r=n.nextSibling;for(;r&&"listItem"==r.name&&r.getAttribute("listIndent")>n.getAttribute("listIndent");)e.push(r),r=r.nextSibling;this._indentBy<0&&(e=e.reverse());for(const i of e){const e=i.getAttribute("listIndent")+this._indentBy;e<0?t.rename(i,"paragraph"):t.setAttribute("listIndent",e,i)}})}_checkEnabled(){const t=Jl(this.editor.model.document.selection.getSelectedBlocks());if(!t||!t.is("listItem"))return!1;if(this._indentBy>0){const e=t.getAttribute("listIndent"),n=t.getAttribute("listType");let r=t.previousSibling;for(;r&&r.is("listItem")&&r.getAttribute("listIndent")>=e;){if(r.getAttribute("listIndent")==e)return r.getAttribute("listType")==n;r=r.previousSibling}return!1}return!0}}function wh(){const t=!this.isEmpty&&("ul"==this.getChild(0).name||"ol"==this.getChild(0).name);return this.isEmpty||t?0:Ve.call(this)}function _h(t){return(e,n,r)=>{const i=r.consumable;if(!i.test(n.item,"insert")||!i.test(n.item,"attribute:listType")||!i.test(n.item,"attribute:listIndent"))return;i.consume(n.item,"insert"),i.consume(n.item,"attribute:listType"),i.consume(n.item,"attribute:listIndent");const o=n.item;jh(o,function(t,e){const n=e.mapper,r=e.writer,i="numbered"==t.getAttribute("listType")?"ol":"ul",o=function(t){const e=r.createContainerElement("li");return e.getFillerOffset=wh,e}(),s=r.createContainerElement(i,null);return r.insert(r.createPositionAt(s,0),o),n.bindElements(t,o),o}(o,r),r,t)}}function kh(t){return(e,n,r)=>{const i=r.mapper.toViewPosition(n.position).getLastMatchingPosition(t=>!t.item.is("li")).nodeAfter,o=r.writer;o.breakContainer(o.createPositionBefore(i)),o.breakContainer(o.createPositionAfter(i));const s=i.parent,a=s.previousSibling,l=o.createRangeOn(s),u=o.remove(l);a&&a.nextSibling&&Dh(o,a,a.nextSibling),Lh(r.mapper.toModelElement(i).getAttribute("listIndent")+1,n.position,l.start,i,r,t);for(const t of o.createRangeIn(u).getItems())r.mapper.unbindViewElement(t);e.stop()}}function xh(t,e,n){if(!n.consumable.consume(e.item,"attribute:listType"))return;const r=n.mapper.toViewElement(e.item),i=n.writer;i.breakContainer(i.createPositionBefore(r)),i.breakContainer(i.createPositionAfter(r));let o=r.parent;Dh(i,o=i.rename("numbered"==e.attributeNewValue?"ol":"ul",o),o.nextSibling),Dh(i,o.previousSibling,o);for(const s of e.item.getChildren())n.consumable.consume(s,"insert")}function Ch(t){return(e,n,r)=>{if(!r.consumable.consume(n.item,"attribute:listIndent"))return;const i=r.mapper.toViewElement(n.item),o=r.writer;o.breakContainer(o.createPositionBefore(i)),o.breakContainer(o.createPositionAfter(i));const s=i.parent,a=s.previousSibling,l=o.createRangeOn(s);o.remove(l),a&&a.nextSibling&&Dh(o,a,a.nextSibling),Lh(n.attributeOldValue+1,n.range.start,l.start,i,r,t),jh(n.item,i,r,t);for(const t of n.item.getChildren())r.consumable.consume(t,"insert")}}function Ah(t,e,n){if("listItem"!=e.item.name){let t=n.mapper.toViewPosition(e.range.start);const r=n.writer,i=[];for(;("ul"==t.parent.name||"ol"==t.parent.name)&&"li"==(t=r.breakContainer(t)).parent.name;){const e=t,n=r.createPositionAt(t.parent,"end");if(!e.isEqual(n)){const t=r.remove(r.createRange(e,n));i.push(t)}t=r.createPositionAfter(t.parent)}if(i.length>0){for(let e=0;e0){const e=Dh(r,n,n.nextSibling);e&&e.parent==n&&t.offset--}}Dh(r,t.nodeBefore,t.nodeAfter)}}}function Sh(t,e,n){const r=n.mapper.toViewPosition(e.position);Dh(n.writer,r.nodeBefore,r.nodeAfter)}function Eh(t,e,n){if(n.consumable.consume(e.viewItem,{name:!0})){const t=n.writer,r=this.conversionApi.store,i=t.createElement("listItem");r.indent=r.indent||0,t.setAttribute("listIndent",r.indent,i),t.setAttribute("listType",e.viewItem.parent&&"ol"==e.viewItem.parent.name?"numbered":"bulleted",i),r.indent++;const o=n.splitToAllowedParent(i,e.modelCursor);if(!o)return;t.insert(i,o.position);const s=function(t,e,n){const{writer:r,schema:i}=n;let o=r.createPositionAfter(t);for(const s of e)if("ul"==s.name||"ol"==s.name)o=n.convertItem(s,o).modelCursor;else{const e=n.convertItem(s,r.createPositionAt(t,"end")),a=e.modelRange.start.nodeAfter;a&&a.is("element")&&!i.checkChild(t,a.name)&&(t=e.modelCursor.parent.is("listItem")?e.modelCursor.parent:Ih(e.modelCursor),o=r.createPositionAfter(t))}return o}(i,e.viewItem.getChildren(),n);r.indent--,e.modelRange=t.createRange(e.modelCursor,s),e.modelCursor=o.cursorParent?t.createPositionAt(o.cursorParent,0):e.modelRange.end}}function Oh(t,e,n){if(n.consumable.test(e.viewItem,{name:!0})){const t=Array.from(e.viewItem.getChildren());for(const e of t)e.is("li")||e._remove()}}function Ph(t,e,n){if(n.consumable.test(e.viewItem,{name:!0})){if(0===e.viewItem.childCount)return;const t=[...e.viewItem.getChildren()];let n=!1,r=!0;for(const e of t)!n||e.is("ul")||e.is("ol")||e._remove(),e.is("text")?(r&&(e._data=e.data.replace(/^\s+/,"")),(!e.nextSibling||e.nextSibling.is("ul")||e.nextSibling.is("ol"))&&(e._data=e.data.replace(/\s+$/,""))):(e.is("ul")||e.is("ol"))&&(n=!0),r=!1}}function Th(t){return(e,n)=>{if(n.isPhantom)return;const r=n.modelPosition.nodeBefore;if(r&&r.is("listItem")){const e=n.mapper.toViewElement(r),i=e.getAncestors().find(t=>t.is("ul")||t.is("ol")),o=t.createPositionAt(e,0).getWalker();for(const t of o){if("elementStart"==t.type&&t.item.is("li")){n.viewPosition=t.previousPosition;break}if("elementEnd"==t.type&&t.item==i){n.viewPosition=t.nextPosition;break}}}}}function Nh(t,[e,n]){let r,i=e.is("documentFragment")?e.getChild(0):e;if(r=n?this.createSelection(n):this.document.selection,i&&i.is("listItem")){const t=r.getFirstPosition();let e=null;if(t.parent.is("listItem")?e=t.parent:t.nodeBefore&&t.nodeBefore.is("listItem")&&(e=t.nodeBefore),e){const t=e.getAttribute("listIndent");if(t>0)for(;i&&i.is("listItem");)i._setAttribute("listIndent",i.getAttribute("listIndent")+t),i=i.nextSibling}}}function Ih(t){const e=new Si({startPosition:t});let n;do{n=e.next()}while(!n.value.item.is("listItem"));return n.value.item}function Mh(t,e){const n=!!e.sameIndent,r=!!e.smallerIndent,i=e.listIndent;let o=t;for(;o&&"listItem"==o.name;){const t=o.getAttribute("listIndent");if(n&&i==t||r&&i>t)return o;o=o.previousSibling}return null}function Dh(t,e,n){return e&&n&&("ul"==e.name||"ol"==e.name)&&e.name==n.name?t.mergeContainers(t.createPositionAfter(e)):null}function jh(t,e,n,r){const i=e.parent,o=n.mapper,s=n.writer;let a=o.toViewPosition(r.createPositionBefore(t));const l=Mh(t.previousSibling,{sameIndent:!0,smallerIndent:!0,listIndent:t.getAttribute("listIndent")}),u=t.previousSibling;if(l&&l.getAttribute("listIndent")==t.getAttribute("listIndent")){const t=o.toViewElement(l);a=s.breakContainer(s.createPositionAfter(t))}else a=o.toViewPosition(u&&"listItem"==u.name?r.createPositionAt(u,"end"):r.createPositionBefore(t));if(a=Rh(a),s.insert(a,i),u&&"listItem"==u.name){const t=o.toViewElement(u),n=s.createRange(s.createPositionAt(t,0),a).getWalker({ignoreElementEnd:!0});for(const r of n)if(r.item.is("li")){const t=s.breakContainer(s.createPositionBefore(r.item)),i=r.item.parent,o=s.createPositionAt(e,"end");Dh(s,o.nodeBefore,o.nodeAfter),s.move(s.createRangeOn(i),o),n.position=t}}else{const n=i.nextSibling;if(n&&(n.is("ul")||n.is("ol"))){let r=null;for(const e of n.getChildren()){const n=o.toModelElement(e);if(!(n&&n.getAttribute("listIndent")>t.getAttribute("listIndent")))break;r=e}r&&(s.breakContainer(s.createPositionAfter(r)),s.move(s.createRangeOn(r.parent),s.createPositionAt(e,"end")))}}Dh(s,i,i.nextSibling),Dh(s,i.previousSibling,i)}function Lh(t,e,n,r,i,o){const s=Mh(e.nodeBefore,{sameIndent:!0,smallerIndent:!0,listIndent:t,foo:"b"}),a=i.mapper,l=i.writer,u=s?s.getAttribute("listIndent"):null;let c;if(s)if(u==t){const t=a.toViewElement(s).parent;c=l.createPositionAfter(t)}else{const t=o.createPositionAt(s,"end");c=a.toViewPosition(t)}else c=n;c=Rh(c);for(const d of[...r.getChildren()])(d.is("ul")||d.is("ol"))&&(c=l.move(l.createRangeOn(d),c).end,Dh(l,d,d.nextSibling),Dh(l,d.previousSibling,d))}function Rh(t){return t.getLastMatchingPosition(t=>t.item.is("uiElement"))}class Fh extends Ca{static get requires(){return[Qc]}init(){const t=this.editor;t.model.schema.register("listItem",{inheritAllFrom:"$block",allowAttributes:["listType","listIndent"]});const e=t.data,n=t.editing;t.model.document.registerPostFixer(e=>(function(t,e){const n=t.document.differ.getChanges(),r=new Map;let i=!1;for(const l of n)if("insert"==l.type&&"listItem"==l.name)o(l.position);else if("insert"==l.type&&"listItem"!=l.name){if("$text"!=l.name){const t=l.position.nodeAfter;t.hasAttribute("listIndent")&&(e.removeAttribute("listIndent",t),i=!0),t.hasAttribute("listType")&&(e.removeAttribute("listType",t),i=!0)}o(l.position.getShiftedBy(l.length))}else"remove"==l.type&&"listItem"==l.name?o(l.position):"attribute"==l.type&&"listIndent"==l.attributeKey?o(l.range.start):"attribute"==l.type&&"listType"==l.attributeKey&&o(l.range.start);for(const l of r.values())s(l),a(l);return i;function o(t){const e=t.nodeBefore;if(e&&e.is("listItem")){let n=e;if(r.has(n))return;for(;n.previousSibling&&n.previousSibling.is("listItem");)if(r.has(n=n.previousSibling))return;r.set(t.nodeBefore,n)}else{const e=t.nodeAfter;e&&e.is("listItem")&&r.set(e,e)}}function s(t){let n=0,r=null;for(;t&&t.is("listItem");){const o=t.getAttribute("listIndent");if(o>n){let s;null===r?(r=o-n,s=n):(r>o&&(r=o),s=o-r),e.setAttribute("listIndent",s,t),i=!0}else r=null,n=t.getAttribute("listIndent")+1;t=t.nextSibling}}function a(t){let n=[],r=null;for(;t&&t.is("listItem");){const o=t.getAttribute("listIndent");if(r&&r.getAttribute("listIndent")>o&&(n=n.slice(0,o+1)),0!=o)if(n[o]){const r=n[o];t.getAttribute("listType")!=r&&(e.setAttribute("listType",r,t),i=!0)}else n[o]=t.getAttribute("listType");r=t,t=t.nextSibling}}})(t.model,e)),n.mapper.registerViewToModelLength("li",Bh),e.mapper.registerViewToModelLength("li",Bh),n.mapper.on("modelToViewPosition",Th(n.view)),n.mapper.on("viewToModelPosition",function(t){return(e,n)=>{const r=n.viewPosition,i=r.parent,o=n.mapper;if("ul"==i.name||"ol"==i.name){if(r.isAtEnd){const e=o.toModelElement(r.nodeBefore),i=o.getModelLength(r.nodeBefore);n.modelPosition=t.createPositionBefore(e).getShiftedBy(i)}else{const e=o.toModelElement(r.nodeAfter);n.modelPosition=t.createPositionBefore(e)}e.stop()}else if("li"==i.name&&r.nodeBefore&&("ul"==r.nodeBefore.name||"ol"==r.nodeBefore.name)){const s=o.toModelElement(i);let a=1,l=r.nodeBefore;for(;l&&(l.is("ul")||l.is("ol"));)a+=o.getModelLength(l),l=l.previousSibling;n.modelPosition=t.createPositionBefore(s).getShiftedBy(a),e.stop()}}}(t.model)),e.mapper.on("modelToViewPosition",Th(n.view)),n.downcastDispatcher.on("insert",Ah,{priority:"high"}),n.downcastDispatcher.on("insert:listItem",_h(t.model)),e.downcastDispatcher.on("insert",Ah,{priority:"high"}),e.downcastDispatcher.on("insert:listItem",_h(t.model)),n.downcastDispatcher.on("attribute:listType:listItem",xh),e.downcastDispatcher.on("attribute:listType:listItem",xh),n.downcastDispatcher.on("attribute:listIndent:listItem",Ch(t.model)),e.downcastDispatcher.on("attribute:listIndent:listItem",Ch(t.model)),n.downcastDispatcher.on("remove:listItem",kh(t.model)),n.downcastDispatcher.on("remove",Sh,{priority:"low"}),e.downcastDispatcher.on("remove:listItem",kh(t.model)),e.downcastDispatcher.on("remove",Sh,{priority:"low"}),e.upcastDispatcher.on("element:ul",Oh,{priority:"high"}),e.upcastDispatcher.on("element:ol",Oh,{priority:"high"}),e.upcastDispatcher.on("element:li",Ph,{priority:"high"}),e.upcastDispatcher.on("element:li",Eh),t.model.on("insertContent",Nh,{priority:"high"}),t.commands.add("numberedList",new mh(t,"numbered")),t.commands.add("bulletedList",new mh(t,"bulleted")),t.commands.add("indentList",new bh(t,"forward")),t.commands.add("outdentList",new bh(t,"backward"));const r=this.editor.editing.view.document;this.listenTo(r,"enter",(t,e)=>{const n=this.editor.model.document,r=n.selection.getLastPosition().parent;n.selection.isCollapsed&&"listItem"==r.name&&r.isEmpty&&(this.editor.execute("outdentList"),e.preventDefault(),t.stop())}),this.listenTo(r,"delete",(t,e)=>{if("backward"!==e.direction)return;const n=this.editor.model.document.selection;if(!n.isCollapsed)return;const r=n.getFirstPosition();if(!r.isAtStart)return;const i=r.parent;"listItem"===i.name&&(i.previousSibling&&"listItem"===i.previousSibling.name||(this.editor.execute("outdentList"),e.preventDefault(),t.stop()))},{priority:"high"});const i=t=>(e,n)=>{this.editor.commands.get(t).isEnabled&&(this.editor.execute(t),n())};this.editor.keystrokes.set("Tab",i("indentList")),this.editor.keystrokes.set("Shift+Tab",i("outdentList"))}}function Bh(t){let e=1;for(const n of t.getChildren())if("ul"==n.name||"ol"==n.name)for(const t of n.getChildren())e+=Bh(t);return e}var Vh=n(37),qh=n.n(Vh),zh=n(38),Uh=n.n(zh);class Hh extends Ca{init(){const t=this.editor.t;this._addButton("numberedList",t("o"),qh.a),this._addButton("bulletedList",t("p"),Uh.a)}_addButton(t,e,n){const r=this.editor;r.ui.componentFactory.add(t,i=>{const o=r.commands.get(t),s=new bl(i);return s.set({label:e,icon:n,tooltip:!0}),s.bind("isOn","isEnabled").to(o,"value","isEnabled"),this.listenTo(s,"execute",()=>r.execute(t)),s})}}function Wh(t,e){return t=>{t.on("attribute:url:media",n)};function n(n,r,i){if(!i.consumable.consume(r.item,n.name))return;const o=r.attributeNewValue,s=i.writer,a=i.mapper.toViewElement(r.item);s.remove(s.createRangeIn(a));const l=t.getMediaViewElement(s,o,e);s.insert(s.createPositionAt(a,0),l)}}function Gh(t,e,n,r){const i=t.createContainerElement("figure",{class:"media"});return i.getFillerOffset=$h,t.insert(t.createPositionAt(i,0),e.getMediaViewElement(t,n,r)),i}function Yh(t){const e=t.getSelectedElement();return e&&e.is("media")?e:null}function Kh(t,e,n){t.change(r=>{const i=r.createElement("media",{url:e});t.insertContent(i,n),r.setSelection(i,"on")})}function $h(){return null}class Zh extends Pa{refresh(){const t=this.editor.model,e=t.document.selection,n=t.schema,r=e.getFirstPosition(),i=Yh(e);let o=r.parent;o!=o.root&&(o=o.parent),this.value=i?i.getAttribute("url"):null,this.isEnabled=n.checkChild(o,"media")}execute(t){const e=this.editor.model,n=e.document.selection,r=Yh(n);if(r)e.change(e=>{e.setAttribute("url",t,r)});else{const r=Lu(n,e);Kh(e,t,r)}}}var Qh=n(39),Jh=n.n(Qh);const Xh="0 0 64 42";class tf{constructor(t,e){const n=e.providers,r=e.extraProviders||[],i=new Set(e.removeProviders),o=n.concat(r).filter(t=>{const e=t.name;return e?!i.has(e):(Xr.a.warn("media-embed-no-provider-name: The configured media provider has no name and cannot be used.",{provider:t}),!1)});this.locale=t,this.providerDefinitions=o}hasMedia(t){return!!this._getMedia(t)}getMediaViewElement(t,e,n){return this._getMedia(e).getViewElement(t,n)}_getMedia(t){if(!t)return new ef(this.locale);t=t.trim();for(const e of this.providerDefinitions){const n=e.html;let r=e.url;Array.isArray(r)||(r=[r]);for(const e of r){const r=this._getUrlMatches(t,e);if(r)return new ef(this.locale,t,r,n)}}return null}_getUrlMatches(t,e){let n=t.match(e);if(n)return n;let r=t.replace(/^https?:\/\//,"");return(n=r.match(e))?n:(n=(r=r.replace(/^www\./,"")).match(e))||null}}class ef{constructor(t,e,n,r){this.url=this._getValidUrl(e),this._t=t.t,this._match=n,this._previewRenderer=r}getViewElement(t,e){const n={};if(e.renderForEditingView||e.renderMediaPreview&&this.url&&this._previewRenderer){this.url&&(n["data-oembed-url"]=this.url),e.renderForEditingView&&(n.class="ck-media__wrapper");const r=this._getPreviewHtml(e);return t.createUIElement("div",n,function(t){const e=this.toDomElement(t);return e.innerHTML=r,e})}return this.url&&(n.url=this.url),t.createEmptyElement("oembed",n)}_getPreviewHtml(t){return this._previewRenderer?this._previewRenderer(this._match):this.url&&t.renderForEditingView?this._getPlaceholderHtml():""}_getPlaceholderHtml(){const t=new yl,e=new vl;return t.text=this._t("Open media in new tab"),e.content=Jh.a,e.viewBox=Xh,new Ws({tag:"div",attributes:{class:"ck ck-reset_all ck-media__placeholder"},children:[{tag:"div",attributes:{class:"ck-media__placeholder__icon"},children:[e]},{tag:"a",attributes:{class:"ck-media__placeholder__url",target:"new",href:this.url},children:[{tag:"span",attributes:{class:"ck-media__placeholder__url__text"},children:[this.url]},t]}]}).render().outerHTML}_getValidUrl(t){return t?t.match(/^https?/)?t:"https://"+t:null}}n(111);class nf extends Ca{static get pluginName(){return"MediaEmbedEditing"}constructor(t){super(t),t.config.define("mediaEmbed",{providers:[{name:"dailymotion",url:/^dailymotion\.com\/video\/(\w+)/,html:t=>'
'+`
'},{name:"spotify",url:[/^open\.spotify\.com\/(artist\/\w+)/,/^open\.spotify\.com\/(album\/\w+)/,/^open\.spotify\.com\/(track\/\w+)/],html:t=>'
'+`
'},{name:"youtube",url:[/^(?:m\.)?youtube\.com\/watch\?v=([\w-]+)/,/^(?:m\.)?youtube\.com\/v\/([\w-]+)/,/^youtube\.com\/embed\/([\w-]+)/,/^youtu\.be\/([\w-]+)/],html:t=>'
'+`
'},{name:"vimeo",url:[/^vimeo\.com\/(\d+)/,/^vimeo\.com\/[^\/]+\/[^\/]+\/video\/(\d+)/,/^vimeo\.com\/album\/[^\/]+\/video\/(\d+)/,/^vimeo\.com\/channels\/[^\/]+\/(\d+)/,/^vimeo\.com\/groups\/[^\/]+\/videos\/(\d+)/,/^vimeo\.com\/ondemand\/[^\/]+\/(\d+)/,/^player\.vimeo\.com\/video\/(\d+)/],html:t=>'
'+`
'},{name:"instagram",url:/^instagram\.com\/p\/(\w+)/},{name:"twitter",url:/^twitter\.com/},{name:"googleMaps",url:/^google\.com\/maps/},{name:"flickr",url:/^flickr\.com/},{name:"facebook",url:/^facebook\.com/}]}),this.registry=new tf(t.locale,t.config.get("mediaEmbed"))}init(){const t=this.editor,e=t.model.schema,n=t.t,r=t.conversion,i=t.config.get("mediaEmbed.previewsInData"),o=this.registry;t.commands.add("mediaEmbed",new Zh(t)),e.register("media",{isObject:!0,isBlock:!0,allowWhere:"$block",allowAttributes:["url"]}),r.for("dataDowncast").elementToElement({model:"media",view:(t,e)=>{const n=t.getAttribute("url");return Gh(e,o,n,{renderMediaPreview:n&&i})}}),r.for("dataDowncast").add(Wh(o,{renderMediaPreview:i})),r.for("editingDowncast").elementToElement({model:"media",view:(t,e)=>{const r=t.getAttribute("url");return function(t,e,n){return e.setCustomProperty("media",!0,t),Mu(t,e,{label:n})}(Gh(e,o,r,{renderForEditingView:!0}),e,n("ak"))}}),r.for("editingDowncast").add(Wh(o,{renderForEditingView:!0})),r.for("upcast").elementToElement({view:{name:"oembed",attributes:{url:!0}},model:(t,e)=>{const n=t.getAttribute("url");if(o.hasMedia(n))return e.createElement("media",{url:n})}}).elementToElement({view:{name:"div",attributes:{"data-oembed-url":!0}},model:(t,e)=>{const n=t.getAttribute("data-oembed-url");if(o.hasMedia(n))return e.createElement("media",{url:n})}})}}const rf=/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:\/?#[\]@!$&'()*+,;=]+$/;class of extends Ca{static get requires(){return[Oa,Al]}static get pluginName(){return"AutoMediaEmbed"}constructor(t){super(t),this._timeoutId=null,this._positionToInsert=null}init(){const t=this.editor,e=t.model.document;this.listenTo(t.plugins.get(Oa),"inputTransformation",()=>{const t=e.selection.getFirstRange(),n=fs.fromPosition(t.start);n.stickiness="toPrevious";const r=fs.fromPosition(t.end);r.stickiness="toNext",e.once("change:data",()=>{this._embedMediaBetweenPositions(n,r),n.detach(),r.detach()},{priority:"high"})}),t.commands.get("undo").on("execute",()=>{this._timeoutId&&(dr.window.clearTimeout(this._timeoutId),this._positionToInsert.detach(),this._timeoutId=null,this._positionToInsert=null)},{priority:"high"})}_embedMediaBetweenPositions(t,e){const n=this.editor,r=n.plugins.get(nf).registry,i=new Vi(t,e),o=i.getWalker({ignoreElementEnd:!0});let s="";for(const a of o)a.item.is("textProxy")&&(s+=a.item.data);(s=s.trim()).match(rf)&&r.hasMedia(s)&&n.commands.get("mediaEmbed").isEnabled&&(this._positionToInsert=fs.fromPosition(t),this._timeoutId=dr.window.setTimeout(()=>{n.model.change(t=>{let e;this._timeoutId=null,t.remove(i),"$graveyard"!==this._positionToInsert.root.rootName&&(e=this._positionToInsert),Kh(n.model,s,e),this._positionToInsert.detach(),this._positionToInsert=null})},100))}}n(113);class sf extends ua{constructor(t,e){super(e);const n=e.t;this.focusTracker=new js,this.keystrokes=new Ss,this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(n("ay"),nc.a,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(n("az"),ic.a,"ck-button-cancel","cancel"),this._focusables=new Us,this._focusCycler=new ya({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this._validators=t,this.setTemplate({tag:"form",attributes:{class:["ck","ck-media-form"],tabindex:"-1"},children:[this.urlInputView,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),tc({view:this}),[this.urlInputView,this.saveButtonView,this.cancelButtonView].forEach(t=>{this._focusables.add(t),this.focusTracker.add(t.element)}),this.keystrokes.listenTo(this.element);const t=t=>t.stopPropagation();this.keystrokes.set("arrowright",t),this.keystrokes.set("arrowleft",t),this.keystrokes.set("arrowup",t),this.keystrokes.set("arrowdown",t),this.listenTo(this.urlInputView.element,"selectstart",(t,e)=>{e.stopPropagation()},{priority:"high"})}focus(){this._focusCycler.focusFirst()}get url(){return this.urlInputView.inputView.element.value.trim()}set url(t){this.urlInputView.inputView.element.value=t.trim()}isValid(){this.resetFormStatus();for(const t of this._validators){const e=t(this);if(e)return this.urlInputView.errorText=e,!1}return!0}resetFormStatus(){this.urlInputView.errorText=null,this.urlInputView.infoText=this._urlInputViewInfoDefault}_createUrlInput(){const t=this.locale.t,e=new Ju(this.locale,Xu),n=e.inputView;return this._urlInputViewInfoDefault=t("bb"),this._urlInputViewInfoTip=t("bc"),e.label=t("bd"),e.infoText=this._urlInputViewInfoDefault,n.placeholder="https://example.com",n.on("input",()=>{e.infoText=n.element.value?this._urlInputViewInfoTip:this._urlInputViewInfoDefault}),e}_createButton(t,e,n,r){const i=new bl(this.locale);return i.set({label:t,icon:e,tooltip:!0}),i.extendTemplate({attributes:{class:n}}),r&&i.delegate("execute").to(this,r),i}}var af=n(40),lf=n.n(af);class uf extends Ca{static get requires(){return[nf]}static get pluginName(){return"MediaEmbedUI"}init(){const t=this.editor,e=t.commands.get("mediaEmbed"),n=t.plugins.get(nf).registry;this.form=new sf(function(t,e){return[e=>{if(!e.url.length)return t("am")},n=>{if(!e.hasMedia(n.url))return t("an")}]}(t.t,n),t.locale),t.ui.componentFactory.add("mediaEmbed",n=>{const r=pd(n);return this._setUpDropdown(r,this.form,e,t),this._setUpForm(this.form,r,e),r})}_setUpDropdown(t,e,n){const r=this.editor,i=r.t,o=t.buttonView;function s(){r.editing.view.focus(),t.isOpen=!1}t.bind("isEnabled").to(n),t.panelView.children.add(e),o.set({label:i("al"),icon:lf.a,tooltip:!0}),o.on("open",()=>{e.url=n.value||"",e.urlInputView.select(),e.focus()},{priority:"low"}),t.on("submit",()=>{e.isValid()&&(r.execute("mediaEmbed",e.url),s())}),t.on("change:isOpen",()=>e.resetFormStatus()),t.on("cancel",()=>s())}_setUpForm(t,e,n){t.delegate("submit","cancel").to(e),t.urlInputView.bind("value").to(n,"value"),t.urlInputView.bind("isReadOnly").to(n,"isEnabled",t=>!t),t.saveButtonView.bind("isEnabled").to(n)}}function cf(t){return t.replace(/(\s+)<\/span>/g,(t,e)=>1===e.length?" ":Array(e.length+1).join("\xa0 ").substr(0,e.length))}function df(t){const e={},n=t.getStyle("mso-list");return n&&(e.id=parseInt(n.match(/(^|\s+)l(\d+)/i)[2]),e.order=parseInt(n.match(/\s*lfo(\d+)/i)[1]),e.indent=parseInt(n.match(/\s*level(\d+)/i)[1])),e}function hf(t){return btoa(t.match(/\w{2}/g).map(t=>String.fromCharCode(parseInt(t,16))).join(""))}function ff(t,e){let n=e.parent;for(;n;){if(n.name===t)return n;n=n.parent}}function pf(t,e,n,r,i=1){e>i?r.setAttribute(t,e,n):r.removeAttribute(t,n)}function gf(t,e,n={}){const r=t.createElement("tableCell",n);t.insertElement("paragraph",r),t.insert(r,e)}function mf(t){return e=>{e.on(`element:${t}`,(t,e,n)=>{const r=e.viewItem;if(!n.consumable.test(r,{name:!0}))return;const i=n.writer.createElement("tableCell"),o=n.splitToAllowedParent(i,e.modelCursor);if(!o)return;n.writer.insert(i,o.position),n.consumable.consume(r,{name:!0});const s=n.writer.createPositionAt(i,0);n.convertChildren(r,s),i.childCount||n.writer.insertElement("paragraph",s),e.modelRange=n.writer.createRange(n.writer.createPositionBefore(i),n.writer.createPositionAfter(i)),e.modelCursor=e.modelRange.end})}}function vf(t){let e=0,n=0;const r=Array.from(t.getChildren()).filter(t=>"th"===t.name||"td"===t.name);for(;n1||r>1)&&this._recordSpans(this._row,this._column,r,n);const i=this._column,o=this._formatOutValue(e,i,r,n);return this._column++,this._cell++,this._shouldSkipRow()||this._shouldSkipColumn(i,n)?this.next():o}skipRow(t){this._skipRows.add(t)}_isOverEndRow(){return void 0!==this.endRow&&this._row>this.endRow}_formatOutValue(t,e,n=1,r=1){return{done:!1,value:{cell:t,row:this._row,column:e,rowspan:n,colspan:r,cellIndex:this._cell}}}_shouldSkipRow(){const t=this._rowthis.column)}_isSpanned(t,e){return!!this._spannedCells.has(t)&&this._spannedCells.get(t).has(e)}_recordSpans(t,e,n,r){for(let i=e+1;i<=e+r-1;i++)this._markSpannedCell(t,i);for(let i=t+1;ie.on("insert:table",(e,n,r)=>{const i=n.item;if(!r.consumable.consume(i,"insert"))return;r.consumable.consume(i,"attribute:headingRows:table"),r.consumable.consume(i,"attribute:headingColumns:table");const o=t&&t.asWidget,s=r.writer.createContainerElement("figure",{class:"table"}),a=r.writer.createContainerElement("table");let l;r.writer.insert(r.writer.createPositionAt(s,0),a),o&&(l=function(t,e){return e.setCustomProperty("table",!0,t),Mu(t,e,{hasSelectionHandler:!0})}(s,r.writer));const u=new yf(i),c={headingRows:i.getAttribute("headingRows")||0,headingColumns:i.getAttribute("headingColumns")||0},d=new Map;for(const f of u){const{row:e,cell:n}=f,o=Mf(If(e,c),a,r),s=i.getChild(e),l=d.get(e)||Tf(s,e,o,r);d.set(e,l),r.consumable.consume(n,"insert"),Pf(f,c,r.writer.createPositionAt(l,"end"),r,t)}const h=r.mapper.toViewPosition(n.range.start);r.mapper.bindElements(i,o?l:s),r.writer.insert(h,o?l:s)})}function xf(t={}){return e=>e.on("insert:tableRow",(e,n,r)=>{const i=n.item;if(!r.consumable.consume(i,"insert"))return;const o=i.parent,s=Rf(r.mapper.toViewElement(o)),a=o.getChildIndex(i),l=new yf(o,{startRow:a,endRow:a}),u={headingRows:o.getAttribute("headingRows")||0,headingColumns:o.getAttribute("headingColumns")||0},c=new Map;for(const d of l){const e=Mf(If(a,u),s,r),n=c.get(a)||Tf(i,a,e,r);c.set(a,n),r.consumable.consume(d.cell,"insert"),Pf(d,u,r.writer.createPositionAt(n,"end"),r,t)}})}function Cf(t={}){return e=>e.on("insert:tableCell",(e,n,r)=>{const i=n.item;if(!r.consumable.consume(i,"insert"))return;const o=i.parent,s=o.parent,a=s.getChildIndex(o),l=new yf(s,{startRow:a,endRow:a}),u={headingRows:s.getAttribute("headingRows")||0,headingColumns:s.getAttribute("headingColumns")||0};for(const c of l)if(c.cell===i){const e=r.mapper.toViewElement(o);return void Pf(c,u,r.writer.createPositionAt(e,o.getChildIndex(i)),r,t)}})}function Af(t={}){const e=!!t.asWidget;return t=>t.on("attribute:headingRows:table",(t,n,r)=>{const i=n.item;if(!r.consumable.consume(n.item,t.name))return;const o=Rf(r.mapper.toViewElement(i)),s=n.attributeOldValue,a=n.attributeNewValue;if(a>s){const t=Array.from(i.getChildren()).filter(({index:t})=>l(t,s-1,a));Lf(t,Mf("thead",o,r),r,"end");for(const n of t)for(const t of n.getChildren())Ef(t,"th",r,e);jf("tbody",o,r)}else{Lf(Array.from(i.getChildren()).filter(({index:t})=>l(t,a-1,s)).reverse(),Mf("tbody",o,r),r,0);const t=new yf(i,{startRow:a?a-1:a,endRow:s-1}),n={headingRows:i.getAttribute("headingRows")||0,headingColumns:i.getAttribute("headingColumns")||0};for(const i of t)Of(i,n,r,e);jf("thead",o,r)}function l(t,e,n){return t>e&&tt.on("attribute:headingColumns:table",(t,n,r)=>{const i=n.item;if(!r.consumable.consume(n.item,t.name))return;const o={headingRows:i.getAttribute("headingRows")||0,headingColumns:i.getAttribute("headingColumns")||0},s=n.attributeOldValue,a=n.attributeNewValue,l=(s>a?s:a)-1;for(const u of new yf(i))u.column>l||Of(u,o,r,e)})}function Ef(t,e,n,r){const i=n.writer,o=n.mapper.toViewElement(t);if(!o)return;let s;r?(s=ju(i.createEditableElement(e,o.getAttributes()),i),i.insert(i.createPositionAfter(o),s),i.move(i.createRangeIn(o),i.createPositionAt(s,0)),i.remove(i.createRangeOn(o))):s=i.rename(e,o),n.mapper.bindElements(t,s)}function Of(t,e,n,r){const{cell:i}=t,o=Nf(t,e),s=n.mapper.toViewElement(i);s&&s.name!==o&&Ef(i,o,n,r)}function Pf(t,e,n,r,i){const o=i&&i.asWidget,s=Nf(t,e),a=o?ju(r.writer.createEditableElement(s),r.writer):r.writer.createContainerElement(s),l=t.cell,u=l.getChild(0),c=1===l.childCount&&"paragraph"===u.name;if(r.writer.insert(n,a),c&&![...u.getAttributeKeys()].length){const t=l.getChild(0),e=r.writer.createPositionAt(a,"end");if(r.consumable.consume(t,"insert"),i.asWidget){const n=r.writer.createContainerElement("span");r.mapper.bindElements(t,n),r.writer.insert(e,n),r.mapper.bindElements(l,a)}else r.mapper.bindElements(l,a),r.mapper.bindElements(t,a)}else r.mapper.bindElements(l,a)}function Tf(t,e,n,r){r.consumable.consume(t,"insert");const i=r.writer.createContainerElement("tr");r.mapper.bindElements(t,i);const o=t.parent.getAttribute("headingRows")||0,s=r.writer.createPositionAt(n,o>0&&e>=o?e-o:e);return r.writer.insert(s,i),i}function Nf(t,e){const{row:n,column:r}=t,{headingColumns:i,headingRows:o}=e;return o&&o>n?"th":i&&i>r?"th":"td"}function If(t,e){return t{const n=r.createTable(t,i,o);e.insertContent(n,s),t.setSelection(t.createPositionAt(n.getNodeByPath([0,0,0]),0))})}}class Bf extends Pa{constructor(t,e={}){super(t),this.order=e.order||"below"}refresh(){const t=ff("table",this.editor.model.document.selection.getFirstPosition());this.isEnabled=!!t}execute(){const t=this.editor,e=t.model.document.selection,n=t.plugins.get("TableUtils"),r=ff("tableCell",e.getFirstPosition()).parent,i=r.parent,o=i.getChildIndex(r);n.insertRows(i,{rows:1,at:"below"===this.order?o+1:o})}}class Vf extends Pa{constructor(t,e={}){super(t),this.order=e.order||"right"}refresh(){const t=ff("table",this.editor.model.document.selection.getFirstPosition());this.isEnabled=!!t}execute(){const t=this.editor,e=t.model.document.selection,n=t.plugins.get("TableUtils"),r=ff("tableCell",e.getFirstPosition()),i=r.parent.parent,{column:o}=n.getCellLocation(r);n.insertColumns(i,{columns:1,at:"right"===this.order?o+1:o})}}class qf extends Pa{constructor(t,e={}){super(t),this.direction=e.direction||"horizontally"}refresh(){const t=ff("tableCell",this.editor.model.document.selection.getFirstPosition());this.isEnabled=!!t}execute(){const t=ff("tableCell",this.editor.model.document.selection.getFirstPosition()),e="horizontally"===this.direction,n=this.editor.plugins.get("TableUtils");e?n.splitCellHorizontally(t,2):n.splitCellVertically(t,2)}}class zf extends Pa{constructor(t,e){super(t),this.direction=e.direction,this.isHorizontal="right"==this.direction||"left"==this.direction}refresh(){const t=this._getMergeableCell();this.isEnabled=!!t,this.value=t}execute(){const t=this.editor.model,e=ff("tableCell",t.document.selection.getFirstPosition()),n=this.value,r=this.direction;t.change(t=>{const i="right"==r||"down"==r,o=i?e:n,s=i?n:e,a=s.parent;!function(t,e,n){Uf(t)||(Uf(e)&&n.remove(n.createRangeIn(e)),n.move(n.createRangeIn(t),n.createPositionAt(e,"end"))),n.remove(t)}(s,o,t);const l=this.isHorizontal?"colspan":"rowspan",u=parseInt(e.getAttribute(l)||1),c=parseInt(n.getAttribute(l)||1);t.setAttribute(l,u+c,o),t.setSelection(t.createRangeIn(o)),a.childCount||function(t,e){const n=t.parent,r=n.getChildIndex(t);for(const{cell:i,row:o,rowspan:s}of new yf(n,{endRow:r}))o+s-1>=r&&pf("rowspan",s-1,i,e);e.remove(t)}(a,t)})}_getMergeableCell(){const t=ff("tableCell",this.editor.model.document.selection.getFirstPosition());if(!t)return;const e=this.editor.plugins.get("TableUtils"),n=this.isHorizontal?function(t,e,n){const r="right"==e?t.nextSibling:t.previousSibling;if(!r)return;const i="right"==e?t:r,o="right"==e?r:t,{column:s}=n.getCellLocation(i),{column:a}=n.getCellLocation(o);return s+parseInt(i.getAttribute("colspan")||1)===a?r:void 0}(t,this.direction,e):function(t,e){const n=t.parent,r=n.parent,i=r.getChildIndex(n);if("down"==e&&i===r.childCount-1||"up"==e&&0===i)return;const o=parseInt(t.getAttribute("rowspan")||1),s=r.getAttribute("headingRows")||0;if(s&&("down"==e&&i+o===s||"up"==e&&i===s))return;const a=parseInt(t.getAttribute("rowspan")||1),l="down"==e?i+a:i,u=[...new yf(r,{endRow:l})],c=u.find(e=>e.cell===t).column,d=u.find(({row:t,rowspan:n,column:r})=>r===c&&("down"==e?t===l:l===t+n));return d&&d.cell}(t,this.direction);if(!n)return;const r=this.isHorizontal?"rowspan":"colspan",i=parseInt(t.getAttribute(r)||1);return parseInt(n.getAttribute(r)||1)===i?n:void 0}}function Uf(t){return 1==t.childCount&&t.getChild(0).is("paragraph")&&t.getChild(0).isEmpty}class Hf extends Pa{refresh(){const t=ff("tableCell",this.editor.model.document.selection.getFirstPosition());this.isEnabled=!!t&&t.parent.parent.childCount>1}execute(){const t=this.editor.model,e=ff("tableCell",t.document.selection.getFirstPosition()).parent,n=e.parent,r=n.getChildIndex(e),i=n.getAttribute("headingRows")||0;t.change(t=>{i&&r<=i&&pf("headingRows",i-1,n,t,0);const o=[...new yf(n,{endRow:r})],s=new Map;o.filter(({row:t,rowspan:e})=>t===r&&e>1).forEach(({column:t,cell:e,rowspan:n})=>s.set(t,{cell:e,rowspanToSet:n-1})),o.filter(({row:t,rowspan:e})=>t<=r-1&&t+e>r).forEach(({cell:e,rowspan:n})=>pf("rowspan",n-1,e,t));const a=r+1,l=new yf(n,{includeSpanned:!0,startRow:a,endRow:a});let u;for(const{row:e,column:r,cell:i}of[...l])if(s.has(r)){const{cell:i,rowspanToSet:o}=s.get(r),a=u?t.createPositionAfter(u):t.createPositionAt(n.getChild(e),0);t.move(t.createRangeOn(i),a),pf("rowspan",o,i,t),u=i}else u=i;t.remove(e)})}}class Wf extends Pa{refresh(){const t=this.editor,e=t.model.document.selection,n=t.plugins.get("TableUtils"),r=ff("tableCell",e.getFirstPosition());this.isEnabled=!!r&&n.getColumns(r.parent.parent)>1}execute(){const t=this.editor.model,e=ff("tableCell",t.document.selection.getFirstPosition()),n=e.parent,r=n.parent,i=r.getAttribute("headingColumns")||0,o=r.getChildIndex(n),s=[...new yf(r)],a=s.find(t=>t.cell===e).column;t.change(t=>{i&&o<=i&&t.setAttribute("headingColumns",i-1,r);for(const{cell:e,column:n,colspan:r}of s)n<=a&&r>1&&n+r>a?pf("colspan",r-1,e,t):n===a&&t.remove(e)})}}class Gf extends Pa{refresh(){const t=ff("tableCell",this.editor.model.document.selection.getFirstPosition()),e=!!t;this.isEnabled=e,this.value=e&&this._isInHeading(t,t.parent.parent)}execute(){const t=this.editor.model,e=ff("tableCell",t.document.selection.getFirstPosition()).parent,n=e.parent,r=n.getAttribute("headingRows")||0,i=e.index,o=r>i?i:i+1;t.change(t=>{if(o){const e=function(t,e,n){const r=[],i=new yf(t,{startRow:e>n?n:0,endRow:e-1});for(const{row:o,rowspan:s,cell:a}of i)s>1&&o+s>e&&r.push(a);return r}(n,o,r);for(const n of e)Yf(n,o,t)}pf("headingRows",o,n,t,0)})}_isInHeading(t,e){const n=parseInt(e.getAttribute("headingRows")||0);return!!n&&t.parent.index1&&(s.rowspan=a);const l=i.getChildIndex(r),u=l+o,c=[...new yf(i,{startRow:l,endRow:u,includeSpanned:!0})];let d;for(const{row:h,column:f,cell:p,colspan:g,cellIndex:m}of c)if(p===t&&(d=f,g>1&&(s.colspan=g)),void 0!==d&&d===f&&h===u){const t=i.getChild(h);gf(n,n.createPositionAt(t,m),s)}pf("rowspan",o,t,n)}class Kf extends Pa{refresh(){const t=ff("tableCell",this.editor.model.document.selection.getFirstPosition()),e=!!t;this.isEnabled=e,this.value=e&&this._isInHeading(t,t.parent.parent)}execute(){const t=this.editor.model,e=t.document.selection,n=this.editor.plugins.get("TableUtils"),r=ff("tableCell",e.getFirstPosition().parent),i=r.parent.parent,o=parseInt(i.getAttribute("headingColumns")||0),{column:s}=n.getCellLocation(r),a=o>s?s:s+1;t.change(t=>{pf("headingColumns",a,i,t,0)})}_isInHeading(t,e){const n=parseInt(e.getAttribute("headingColumns")||0),r=this.editor.plugins.get("TableUtils"),{column:i}=r.getCellLocation(t);return!!n&&i{const i=t.getAttribute("headingRows")||0;if(i>n&&e.setAttribute("headingRows",i+r,t),0===n||n===t.childCount)return void Zf(e,t,n,r,this.getColumns(t));const o=new yf(t,{endRow:n});let s=0;for(const{row:t,rowspan:a,colspan:l,cell:u}of o)tn&&e.setAttribute("rowspan",a+r,u),t===n&&(s+=l);Zf(e,t,n,r,s)})}insertColumns(t,e={}){const n=e.at||0,r=e.columns||1;this.editor.model.change(e=>{const i=t.getAttribute("headingColumns");n1)for(let t=a+1;t{if(o>1){const{newCellsSpan:r,updatedSpan:s}=Jf(o,e);pf("colspan",s,t,n);const a={};r>1&&(a.colspan=r),i>1&&(a.rowspan=i),Qf(o>e?e-1:o-1,n,n.createPositionAfter(t),a)}if(oe===t),u=a.filter(({cell:e,colspan:n,column:r})=>e!==t&&r===l||rl);for(const{cell:t,colspan:e}of u)n.setAttribute("colspan",e+s,t);const c={};i>1&&(c.rowspan=i),Qf(s,n,n.createPositionAfter(t),c);const d=r.getAttribute("headingColumns")||0;d>l&&pf("headingColumns",d+s,r,n)}})}splitCellHorizontally(t,e=2){const n=this.editor.model,r=t.parent,i=r.parent,o=i.getChildIndex(r),s=parseInt(t.getAttribute("rowspan")||1),a=parseInt(t.getAttribute("colspan")||1);n.change(n=>{if(s>1){const r=[...new yf(i,{startRow:o,endRow:o+s-1,includeSpanned:!0})],{newCellsSpan:l,updatedSpan:u}=Jf(s,e);pf("rowspan",u,t,n);const{column:c}=r.find(({cell:e})=>e===t),d={};l>1&&(d.rowspan=l),a>1&&(d.colspan=a);for(const{column:t,row:e,cellIndex:s}of r)e>=o+u&&t===c&&(e+o+u)%l==0&&Qf(1,n,n.createPositionAt(i.getChild(e),s),d)}if(so&&n.setAttribute("rowspan",i+r,e);const u={};a>1&&(u.colspan=a),Zf(n,i,o+1,r,1,u);const c=i.getAttribute("headingRows")||0;c>o&&pf("headingRows",c+r,i,n)}})}getColumns(t){return[...t.getChild(0).getChildren()].reduce((t,e)=>t+parseInt(e.getAttribute("colspan")||1),0)}}function Zf(t,e,n,r,i,o={}){for(let s=0;st&&r.push({cell:s,rowspan:t-i})}return r}(t);if(r.length){n=!0;for(const t of r)pf("rowspan",t.rowspan,t.cell,e,1)}return n}function tp(t,e){let n=!1;const r=function(t){const e={};for(const{row:n}of new yf(t,{includeSpanned:!0}))e[n]||(e[n]=0),e[n]+=1;return e}(t),i=r[0];if(!Object.values(r).every(t=>t===i)){const i=Object.values(r).reduce((t,e)=>e>t?e:t,0);for(const[o,s]of Object.entries(r)){const r=i-s;if(r){for(let n=0;nt.is("text"));for(const r of n)e.wrap(e.createRangeOn(r),"paragraph");return!!n.length}function op(t,e,n){if(!t.root.is("rootElement"))return!1;const r=e.toModelElement(t),i=function(t,e){const n=t.childCount>1,r=!![...e.getAttributes()].length;return n||r?"p":"span"}(r.parent,r);if(t.name!==i){e.unbindViewElement(t);const o=n.rename(i,t);return e.bindElements(r,o),!0}return!1}function sp(t){return t.is("p")||t.is("span")}function ap(t){return t.is("td")||t.is("th")}n(117);class lp extends Ca{init(){const t=this.editor,e=t.model,n=e.schema,r=t.conversion;n.register("table",{allowWhere:"$block",allowAttributes:["headingRows","headingColumns"],isLimit:!0,isObject:!0,isBlock:!0}),n.register("tableRow",{allowIn:"table",isLimit:!0}),n.register("tableCell",{allowIn:"tableRow",allowAttributes:["colspan","rowspan"],isLimit:!0}),n.extend("$block",{allowIn:"tableCell"}),n.addChildCheck((t,e)=>{if("table"==e.name&&Array.from(t.getNames()).includes("table"))return!1}),r.for("upcast").add(t=>{t.on("element:table",(t,e,n)=>{const r=e.viewItem;if(!n.consumable.test(r,{name:!0}))return;const{rows:i,headingRows:o,headingColumns:s}=function(t){const e={headingRows:0,headingColumns:0},n=[],r=[];let i;for(const o of Array.from(t.getChildren()))if("tbody"===o.name||"thead"===o.name||"tfoot"===o.name){"thead"!==o.name||i||(i=o);const t=Array.from(o.getChildren()).filter(t=>t.is("element","tr"));for(const o of t)if("thead"===o.parent.name&&o.parent===i)e.headingRows++,n.push(o);else{r.push(o);const t=vf(o);t>e.headingColumns&&(e.headingColumns=t)}}return e.rows=[...n,...r],e}(r),a={};s&&(a.headingColumns=s),o&&(a.headingRows=o);const l=n.writer.createElement("table",a),u=n.splitToAllowedParent(l,e.modelCursor);if(u){if(n.writer.insert(l,u.position),n.consumable.consume(r,{name:!0}),i.length)i.forEach(t=>n.convertItem(t,n.writer.createPositionAt(l,"end")));else{const t=n.writer.createElement("tableRow");n.writer.insert(t,n.writer.createPositionAt(l,"end")),gf(n.writer,n.writer.createPositionAt(t,"end"))}e.modelRange=n.writer.createRange(n.writer.createPositionBefore(l),n.writer.createPositionAfter(l)),e.modelCursor=u.cursorParent?n.writer.createPositionAt(u.cursorParent,0):e.modelRange.end}})}),r.for("editingDowncast").add(kf({asWidget:!0})),r.for("dataDowncast").add(kf()),r.for("upcast").elementToElement({model:"tableRow",view:"tr"}),r.for("editingDowncast").add(xf({asWidget:!0})),r.for("dataDowncast").add(xf()),r.for("downcast").add(t=>t.on("remove:tableRow",(t,e,n)=>{t.stop();const r=n.writer,i=n.mapper,o=i.toViewPosition(e.position).getLastMatchingPosition(t=>!t.item.is("tr")).nodeAfter,s=o.parent,a=r.createRangeOn(o),l=r.remove(a);for(const u of r.createRangeIn(l).getItems())i.unbindViewElement(u);s.childCount||r.remove(r.createRangeOn(s))},{priority:"higher"})),r.for("upcast").add(mf("td")),r.for("upcast").add(mf("th")),r.for("editingDowncast").add(Cf({asWidget:!0})),r.for("dataDowncast").add(Cf()),r.attributeToAttribute({model:"colspan",view:"colspan"}),r.attributeToAttribute({model:"rowspan",view:"rowspan"}),r.for("editingDowncast").add(Sf({asWidget:!0})),r.for("dataDowncast").add(Sf()),r.for("editingDowncast").add(Af({asWidget:!0})),r.for("dataDowncast").add(Af()),function(t,e){e.view.document.registerPostFixer(n=>(function(t,e,n,r){let i=!1;const o=function(t){const e=Array.from(t._renderer.markedAttributes).filter(t=>!!t.parent).filter(sp).filter(t=>ap(t.parent)),n=Array.from(t._renderer.markedChildren).filter(t=>!!t.parent).filter(ap).reduce((t,e)=>[...t,...Array.from(e.getChildren()).filter(sp)],[]);return[...e,...n]}(r);for(const s of o)i=op(s,n,t)||i;return i&&function(t){const e=t.focus;return t.rangeCount&&(!t.anchor.root.is("rootElement")||!e.root.is("rootElement"))}(r.document.selection)&&function(t,e,n){const r=Array.from(t.getRanges()).map(t=>e.toViewRange(t));n.setSelection(r,{backward:t.isBackward})}(e.document.selection,n,t),i})(n,t,e.mapper,e.view))}(t.model,t.editing),t.commands.add("insertTable",new Ff(t)),t.commands.add("insertTableRowAbove",new Bf(t,{order:"above"})),t.commands.add("insertTableRowBelow",new Bf(t,{order:"below"})),t.commands.add("insertTableColumnLeft",new Vf(t,{order:"left"})),t.commands.add("insertTableColumnRight",new Vf(t,{order:"right"})),t.commands.add("removeTableRow",new Hf(t)),t.commands.add("removeTableColumn",new Wf(t)),t.commands.add("splitTableCellVertically",new qf(t,{direction:"vertically"})),t.commands.add("splitTableCellHorizontally",new qf(t,{direction:"horizontally"})),t.commands.add("mergeTableCellRight",new zf(t,{direction:"right"})),t.commands.add("mergeTableCellLeft",new zf(t,{direction:"left"})),t.commands.add("mergeTableCellDown",new zf(t,{direction:"down"})),t.commands.add("mergeTableCellUp",new zf(t,{direction:"up"})),t.commands.add("setTableColumnHeader",new Kf(t)),t.commands.add("setTableRowHeader",new Gf(t)),function(t){t.document.registerPostFixer(e=>(function(t,e){const n=e.document.differ.getChanges();let r=!1;const i=new Set;for(const o of n){let e;"table"==o.name&&"insert"==o.type&&(e=o.position.nodeAfter),"tableRow"!=o.name&&"tableCell"!=o.name||(e=ff("table",o.position)),ep(o)&&(e=ff("table",o.range.start)),e&&!i.has(e)&&(r=Xf(e,t)||r,r=tp(e,t)||r,i.add(e))}return r})(e,t))}(e),function(t){t.document.registerPostFixer(e=>(function(t,e){const n=e.document.differ.getChanges();let r=!1;for(const i of n)"remove"==i.type&&i.position.parent.is("tableCell")&&(r=ip(i.position.parent,t)||r),"insert"==i.type&&("table"==i.name&&(r=np(i.position.nodeAfter,t)||r),"tableRow"==i.name&&(r=rp(i.position.nodeAfter,t)||r),"tableCell"==i.name&&(r=ip(i.position.nodeAfter,t)||r));return r})(e,t))}(e),this.editor.keystrokes.set("Tab",(...t)=>this._handleTabOnSelectedTable(...t),{priority:"low"}),this.editor.keystrokes.set("Tab",this._getTabHandler(!0),{priority:"low"}),this.editor.keystrokes.set("Shift+Tab",this._getTabHandler(!1),{priority:"low"})}static get requires(){return[$f]}_handleTabOnSelectedTable(t,e){const n=this.editor,r=n.model.document.selection;if(!r.isCollapsed&&1===r.rangeCount&&r.getFirstRange().isFlat){const t=r.getSelectedElement();if(!t||!t.is("table"))return;e(),n.model.change(e=>{e.setSelection(e.createRangeIn(t.getChild(0).getChild(0)))})}}_getTabHandler(t){const e=this.editor;return(n,r)=>{const i=ff("tableCell",e.model.document.selection.getFirstPosition());if(!i)return;r();const o=i.parent,s=o.parent,a=s.getChildIndex(o),l=o.getChildIndex(i),u=0===l;if(!t&&u&&0===a)return;const c=l===o.childCount-1;if(t&&a===s.childCount-1&&c&&(e.execute("insertTableRowBelow"),a===s.childCount-1))return;let d;if(t&&c){const t=s.getChild(a+1);d=t.getChild(0)}else if(!t&&u){const t=s.getChild(a-1);d=t.getChild(t.childCount-1)}else d=o.getChild(l+(t?1:-1));e.model.change(t=>{t.setSelection(t.createRangeIn(d))})}}}n(119);class up extends ua{constructor(t){super(t);const e=this.bindTemplate;this.items=this.createCollection(),this.set("rows",0),this.set("columns",0),this.bind("label").to(this,"columns",this,"rows",(t,e)=>`${e} x ${t}`),this.setTemplate({tag:"div",attributes:{class:["ck"]},children:[{tag:"div",attributes:{class:["ck-insert-table-dropdown__grid"]},children:this.items},{tag:"div",attributes:{class:["ck-insert-table-dropdown__label"]},children:[{text:e.to("label")}]}],on:{mousedown:e.to(t=>{t.preventDefault()}),click:e.to(()=>{this.fire("execute")})}});for(let n=0;n<100;n++){const t=new cp;t.on("over",()=>{const t=Math.floor(n/10),e=n%10;this.set("rows",t+1),this.set("columns",e+1)}),this.items.add(t)}this.on("change:columns",()=>{this._highlightGridBoxes()}),this.on("change:rows",()=>{this._highlightGridBoxes()})}focus(){}focusLast(){}_highlightGridBoxes(){const t=this.rows,e=this.columns;this.items.map((n,r)=>{const i=Math.floor(r/10){const r=t.commands.get("insertTable"),i=pd(n);i.bind("isEnabled").to(r),i.buttonView.set({icon:hp.a,label:e("q"),tooltip:!0});const o=new up(n);return i.panelView.children.add(o),o.delegate("execute").to(i),i.buttonView.on("open",()=>{o.rows=0,o.columns=0}),i.on("execute",()=>{t.execute("insertTable",{rows:o.rows,columns:o.columns}),t.editing.view.focus()}),i}),t.ui.componentFactory.add("tableColumn",t=>{const n=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:e("r"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:"insertTableColumnLeft",label:e("s")}},{type:"button",model:{commandName:"insertTableColumnRight",label:e("t")}},{type:"button",model:{commandName:"removeTableColumn",label:e("u")}}];return this._prepareDropdown(e("v"),pp.a,n,t)}),t.ui.componentFactory.add("tableRow",t=>{const n=[{type:"switchbutton",model:{commandName:"setTableRowHeader",label:e("w"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:"insertTableRowBelow",label:e("x")}},{type:"button",model:{commandName:"insertTableRowAbove",label:e("y")}},{type:"button",model:{commandName:"removeTableRow",label:e("z")}}];return this._prepareDropdown(e("aa"),mp.a,n,t)}),t.ui.componentFactory.add("mergeTableCells",t=>{const n=[{type:"button",model:{commandName:"mergeTableCellUp",label:e("ab")}},{type:"button",model:{commandName:"mergeTableCellRight",label:e("ac")}},{type:"button",model:{commandName:"mergeTableCellDown",label:e("ad")}},{type:"button",model:{commandName:"mergeTableCellLeft",label:e("ae")}},{type:"separator"},{type:"button",model:{commandName:"splitTableCellVertically",label:e("af")}},{type:"button",model:{commandName:"splitTableCellHorizontally",label:e("ag")}}];return this._prepareDropdown(e("ah"),yp.a,n,t)})}_prepareDropdown(t,e,n,r){const i=this.editor,o=pd(r),s=[],a=new gn;for(const l of n)wp(l,i,s,a);return gd(o,a),o.buttonView.set({label:t,icon:e,tooltip:!0}),o.bind("isEnabled").toMany(s,"isEnabled",(...t)=>t.some(t=>t)),this.listenTo(o,"execute",t=>{i.execute(t.source.commandName),i.editing.view.focus()}),o}}function wp(t,e,n,r){const i=t.model=new id(t.model),{commandName:o,bindIsOn:s}=t.model;if("separator"!==t.type){const t=e.commands.get(o);n.push(t),i.set({commandName:o}),i.bind("isEnabled").to(t),s&&i.bind("isOn").to(t,"value")}i.set({withText:!0}),r.add(t)}n(121),n.d(e,"default",function(){return _p});class _p extends xa{}_p.builtinPlugins=[class extends Ca{static get requires(){return[Oa,Da,Fa,Xa,Al]}static get pluginName(){return"Essentials"}},Ml,class extends Ca{static get pluginName(){return"Autoformat"}afterInit(){this._addListAutoformats(),this._addBasicStylesAutoformats(),this._addHeadingAutoformats(),this._addBlockQuoteAutoformats()}_addListAutoformats(){const t=this.editor.commands;t.get("bulletedList")&&new jl(this.editor,/^[*-]\s$/,"bulletedList"),t.get("numberedList")&&new jl(this.editor,/^1[.|)]\s$/,"numberedList")}_addBasicStylesAutoformats(){const t=this.editor.commands;if(t.get("bold")){const t=Fl(this.editor,"bold");new Ll(this.editor,/(\*\*)([^*]+)(\*\*)$/g,t),new Ll(this.editor,/(__)([^_]+)(__)$/g,t)}if(t.get("italic")){const t=Fl(this.editor,"italic");new Ll(this.editor,/(?:^|[^*])(\*)([^*_]+)(\*)$/g,t),new Ll(this.editor,/(?:^|[^_])(_)([^_]+)(_)$/g,t)}if(t.get("code")){const t=Fl(this.editor,"code");new Ll(this.editor,/(`)([^`]+)(`)$/g,t)}}_addHeadingAutoformats(){const t=this.editor.commands.get("heading");t&&t.modelElements.filter(t=>t.match(/^heading[1-6]$/)).forEach(e=>{const n=new RegExp(`^(#{${e[7]}})\\s$`);new jl(this.editor,n,()=>{if(!t.isEnabled)return!1;this.editor.execute("heading",{value:e})})})}_addBlockQuoteAutoformats(){this.editor.commands.get("blockQuote")&&new jl(this.editor,/^>\s$/,"blockQuote")}},class extends Ca{static get requires(){return[ql,Wl]}static get pluginName(){return"Bold"}},class extends Ca{static get requires(){return[Yl,Ql]}static get pluginName(){return"Italic"}},class extends Ca{static get requires(){return[ru,su]}static get pluginName(){return"BlockQuote"}},class extends Ca{static get pluginName(){return"CKFinder"}static get requires(){return[fu,uu,Ml]}},class extends Ca{static get requires(){return[wu,Oc,Kc]}static get pluginName(){return"EasyImage"}},class extends Ca{static get requires(){return[rd,md]}static get pluginName(){return"Heading"}},Oc,class extends Ca{static get requires(){return[bd]}static get pluginName(){return"ImageCaption"}},class extends Ca{static get requires(){return[Fd,Bd]}static get pluginName(){return"ImageStyle"}},class extends Ca{static get requires(){return[Vd]}static get pluginName(){return"ImageToolbar"}afterInit(){const t=this.editor;t.plugins.get(Vd).register("image",{items:t.config.get("image.toolbar")||[],getRelatedElement:Fu})}},Kc,class extends Ca{static get requires(){return[rh,ph]}static get pluginName(){return"Link"}},class extends Ca{static get requires(){return[Fh,Hh]}static get pluginName(){return"List"}},class extends Ca{static get requires(){return[nf,uf,of,Yu]}static get pluginName(){return"MediaEmbed"}},Qc,class extends Ca{static get pluginName(){return"PasteFromOffice"}init(){this.listenTo(this.editor.plugins.get("Clipboard"),"inputTransformation",(t,e)=>{const n=e.dataTransfer.getData("text/html");!0!==e.pasteFromOfficeProcessed&&function(t){return!(!t||!t.match(//gi)&&!t.match(/xmlns:o="urn:schemas-microsoft-com/gi))}(n)&&(e.content=this._normalizeWordInput(n,e.dataTransfer),e.pasteFromOfficeProcessed=!0)},{priority:"high"})}_normalizeWordInput(t,e){const{body:n,stylesString:r}=function(t){const e=new DOMParser,n=function(t){return cf(cf(t)).replace(/([\s]*?)[\r\n]+(\s*<\/span>)/g,"$1$2").replace(/<\/span>/g,"").replace(/ <\//g,"\xa0<\/o:p>/g,"\xa0").replace(/>(\s*[\r\n]\s*)<")}(function(t){const e=t.match(/<\/body>(.*?)(<\/html>|$)/);return e&&e[1]&&(t=t.slice(0,e.index)+t.slice(e.index).replace(e[1],"")),t}(t=t.replace(/