From 0e795b29787d2489aa097347007d9439a4f3690d Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 21 Sep 2020 22:08:54 +0200 Subject: [PATCH] create note inline, #1237 --- libraries/ckeditor/ckeditor.js | 2 +- libraries/ckeditor/ckeditor.js.map | 2 +- src/public/app/dialogs/add_link.js | 2 -- src/public/app/dialogs/jump_to_note.js | 2 +- src/public/app/services/note_autocomplete.js | 27 ++++++++++++++--- src/public/app/widgets/attribute_detail.js | 2 +- src/public/app/widgets/attribute_editor.js | 27 ++++++++--------- src/public/app/widgets/promoted_attributes.js | 4 +-- .../app/widgets/type_widgets/editable_text.js | 29 +++---------------- src/public/app/widgets/type_widgets/empty.js | 2 +- 10 files changed, 46 insertions(+), 53 deletions(-) diff --git a/libraries/ckeditor/ckeditor.js b/libraries/ckeditor/ckeditor.js index 011530a30..5f9b66fe6 100644 --- a/libraries/ckeditor/ckeditor.js +++ b/libraries/ckeditor/ckeditor.js @@ -2,5 +2,5 @@ * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md. */ -!function(e){const t=e.en=e.en||{};t.dictionary=Object.assign(t.dictionary||{},{"%0 of %1":"%0 of %1","Align cell text to the bottom":"Align cell text to the bottom","Align cell text to the center":"Align cell text to the center","Align cell text to the left":"Align cell text to the left","Align cell text to the middle":"Align cell text to the middle","Align cell text to the right":"Align cell text to the right","Align cell text to the top":"Align cell text to the top","Align table to the left":"Align table to the left","Align table to the right":"Align table to the right",Alignment:"Alignment",Aquamarine:"Aquamarine",Background:"Background",Big:"Big",Black:"Black","Block quote":"Block quote",Blue:"Blue",Bold:"Bold",Border:"Border","Bulleted List":"Bulleted List",Cancel:"Cancel","Cannot upload file:":"Cannot upload file:","Cell properties":"Cell properties","Center table":"Center table","Centered image":"Centered image","Change image text alternative":"Change image text alternative","Choose heading":"Choose heading",Code:"Code",Color:"Color","Color picker":"Color picker",Column:"Column",Dashed:"Dashed","Decrease indent":"Decrease indent",Default:"Default","Delete column":"Delete column","Delete row":"Delete row","Dim grey":"Dim grey",Dimensions:"Dimensions","Document colors":"Document colors",Dotted:"Dotted",Double:"Double",Downloadable:"Downloadable","Dropdown toolbar":"Dropdown toolbar","Edit block":"Edit block","Edit link":"Edit link","Editor toolbar":"Editor toolbar","Enter image caption":"Enter image caption","Font Background Color":"Font Background Color","Font Color":"Font Color","Font Family":"Font Family","Font Size":"Font Size","Full size image":"Full size image",Green:"Green",Grey:"Grey",Groove:"Groove","Header column":"Header column","Header row":"Header row",Heading:"Heading","Heading 1":"Heading 1","Heading 2":"Heading 2","Heading 3":"Heading 3","Heading 4":"Heading 4","Heading 5":"Heading 5","Heading 6":"Heading 6",Height:"Height","Horizontal line":"Horizontal line","Horizontal text alignment toolbar":"Horizontal text alignment toolbar",Huge:"Huge","Image resize list":"Image resize list","Image toolbar":"Image toolbar","image widget":"image widget","Increase indent":"Increase indent",Insert:"Insert","Insert code block":"Insert code block","Insert column left":"Insert column left","Insert column right":"Insert column right","Insert image":"Insert image","Insert image via URL":"Insert image via URL","Insert paragraph after block":"Insert paragraph after block","Insert paragraph before block":"Insert paragraph before block","Insert row above":"Insert row above","Insert row below":"Insert row below","Insert table":"Insert table",Inset:"Inset",Italic:"Italic","Justify cell text":"Justify cell text","Left aligned image":"Left aligned image","Light blue":"Light blue","Light green":"Light green","Light grey":"Light grey",Link:"Link","Link URL":"Link URL","Merge cell down":"Merge cell down","Merge cell left":"Merge cell left","Merge cell right":"Merge cell right","Merge cell up":"Merge cell up","Merge cells":"Merge cells",Next:"Next",None:"None","Numbered List":"Numbered List","Open in a new tab":"Open in a new tab","Open link in new tab":"Open link in new tab",Orange:"Orange",Original:"Original",Outset:"Outset",Padding:"Padding",Paragraph:"Paragraph","Paste the image source URL.":"Paste the image source URL.","Plain text":"Plain text",Previous:"Previous",Purple:"Purple",Red:"Red",Redo:"Redo","Remove color":"Remove color","Remove Format":"Remove Format","Resize image":"Resize image","Resize image to %0":"Resize image to %0","Resize image to the original size":"Resize image to the original size","Rich Text Editor, %0":"Rich Text Editor, %0",Ridge:"Ridge","Right aligned image":"Right aligned image",Row:"Row",Save:"Save","Select all":"Select all","Select column":"Select column","Select row":"Select row","Show more items":"Show more items","Side image":"Side image",Small:"Small",Solid:"Solid","Split cell horizontally":"Split cell horizontally","Split cell vertically":"Split cell vertically",Strikethrough:"Strikethrough",Style:"Style",Subscript:"Subscript",Superscript:"Superscript","Table alignment toolbar":"Table alignment toolbar","Table cell text alignment":"Table cell text alignment","Table properties":"Table properties","Table toolbar":"Table toolbar","Text alternative":"Text alternative",'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".':'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".','The value is invalid. Try "10px" or "2em" or simply "2".':'The value is invalid. Try "10px" or "2em" or simply "2".',"This link has no URL":"This link has no URL",Tiny:"Tiny","To-do List":"To-do List",Turquoise:"Turquoise",Underline:"Underline",Undo:"Undo",Unlink:"Unlink",Update:"Update","Upload failed":"Upload failed","Upload in progress":"Upload in progress","Vertical text alignment toolbar":"Vertical text alignment toolbar",White:"White","Widget toolbar":"Widget toolbar",Width:"Width",Yellow:"Yellow"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.BalloonEditor=t():e.BalloonEditor=t()}(window,(function(){return function(e){var t={};function o(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,o),i.l=!0,i.exports}return o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(n,i,function(t){return e[t]}.bind(null,i));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=128)}([function(e,t,o){"use strict";o.d(t,"b",(function(){return n})),o.d(t,"a",(function(){return i}));class n extends Error{constructor(e,t,o){e=i(e),o&&(e+=" "+JSON.stringify(o)),super(e),this.name="CKEditorError",this.context=t,this.data=o}is(e){return"CKEditorError"===e}static rethrowUnexpectedError(e,t){if(e.is&&e.is("CKEditorError"))throw e;const o=new n(e.message,t);throw o.stack=e.stack,o}}function i(e){const t=e.match(/^([^:]+):/);return t?e+` Read more: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-${t[1]}\n`:e}},function(e,t,o){"use strict";var n,i=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},r=function(){var e={};return function(t){if(void 0===e[t]){var o=document.querySelector(t);if(window.HTMLIFrameElement&&o instanceof window.HTMLIFrameElement)try{o=o.contentDocument.head}catch(e){o=null}e[t]=o}return e[t]}}(),s=[];function a(e){for(var t=-1,o=0;o*{margin-right:var(--ck-spacing-small);margin-top:var(--ck-spacing-small);margin-bottom:var(--ck-spacing-small)}.ck .ck-balloon-rotator__navigation .ck-balloon-rotator__counter{margin-right:var(--ck-spacing-standard);margin-left:var(--ck-spacing-small)}.ck .ck-balloon-rotator__content .ck.ck-annotation-wrapper{box-shadow:none}"},function(e,t,o){var n=o(1),i=o(29);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck .ck-fake-panel{position:absolute;z-index:calc(var(--ck-z-modal) - 1)}.ck .ck-fake-panel div{position:absolute}.ck .ck-fake-panel div:first-child{z-index:2}.ck .ck-fake-panel div:nth-child(2){z-index:1}:root{--ck-balloon-fake-panel-offset-horizontal:6px;--ck-balloon-fake-panel-offset-vertical:6px}.ck .ck-fake-panel div{box-shadow:var(--ck-drop-shadow),0 0;min-height:15px;background:var(--ck-color-panel-background);border:1px solid var(--ck-color-panel-border);border-radius:var(--ck-border-radius);width:100%;height:100%}.ck .ck-fake-panel div:first-child{margin-left:var(--ck-balloon-fake-panel-offset-horizontal);margin-top:var(--ck-balloon-fake-panel-offset-vertical)}.ck .ck-fake-panel div:nth-child(2){margin-left:calc(var(--ck-balloon-fake-panel-offset-horizontal)*2);margin-top:calc(var(--ck-balloon-fake-panel-offset-vertical)*2)}.ck .ck-fake-panel div:nth-child(3){margin-left:calc(var(--ck-balloon-fake-panel-offset-horizontal)*3);margin-top:calc(var(--ck-balloon-fake-panel-offset-vertical)*3)}.ck .ck-balloon-panel_arrow_s+.ck-fake-panel,.ck .ck-balloon-panel_arrow_se+.ck-fake-panel,.ck .ck-balloon-panel_arrow_sw+.ck-fake-panel{--ck-balloon-fake-panel-offset-vertical:-6px}"},function(e,t,o){var n=o(1),i=o(31);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-dropdown{display:inline-block;position:relative}.ck.ck-dropdown .ck-dropdown__arrow{pointer-events:none;z-index:var(--ck-z-default)}.ck.ck-dropdown .ck-button.ck-dropdown__button{width:100%}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-on .ck-tooltip{display:none}.ck.ck-dropdown .ck-dropdown__panel{-webkit-backface-visibility:hidden;display:none;z-index:var(--ck-z-modal);position:absolute}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel-visible{display:inline-block}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_ne,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nw{bottom:100%}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_se,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sw{top:100%;bottom:auto}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_ne,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_se{left:0}.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_nw,.ck.ck-dropdown .ck-dropdown__panel.ck-dropdown__panel_sw{right:0}.ck.ck-toolbar .ck-dropdown__panel{z-index:calc(var(--ck-z-modal) + 1)}:root{--ck-dropdown-arrow-size:calc(0.5*var(--ck-icon-size))}.ck.ck-dropdown{font-size:inherit}.ck.ck-dropdown .ck-dropdown__arrow{width:var(--ck-dropdown-arrow-size)}[dir=ltr] .ck.ck-dropdown .ck-dropdown__arrow{right:var(--ck-spacing-standard);margin-left:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-dropdown .ck-dropdown__arrow{left:var(--ck-spacing-standard);margin-right:var(--ck-spacing-small)}.ck.ck-dropdown.ck-disabled .ck-dropdown__arrow{opacity:var(--ck-disabled-opacity)}[dir=ltr] .ck.ck-dropdown .ck-button.ck-dropdown__button:not(.ck-button_with-text){padding-left:var(--ck-spacing-small)}[dir=rtl] .ck.ck-dropdown .ck-button.ck-dropdown__button:not(.ck-button_with-text){padding-right:var(--ck-spacing-small)}.ck.ck-dropdown .ck-button.ck-dropdown__button .ck-button__label{width:7em;overflow:hidden;text-overflow:ellipsis}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-disabled .ck-button__label{opacity:var(--ck-disabled-opacity)}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-on{border-bottom-left-radius:0;border-bottom-right-radius:0}.ck.ck-dropdown .ck-button.ck-dropdown__button.ck-dropdown__button_label-width_auto .ck-button__label{width:auto}.ck.ck-dropdown__panel{border-radius:0}.ck-rounded-corners .ck.ck-dropdown__panel,.ck.ck-dropdown__panel.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-dropdown__panel{box-shadow:var(--ck-drop-shadow),0 0;background:var(--ck-color-dropdown-panel-background);border:1px solid var(--ck-color-dropdown-panel-border);bottom:0;min-width:100%}.ck.ck-dropdown__panel.ck-dropdown__panel_se{border-top-left-radius:0}.ck.ck-dropdown__panel.ck-dropdown__panel_sw{border-top-right-radius:0}.ck.ck-dropdown__panel.ck-dropdown__panel_ne{border-bottom-left-radius:0}.ck.ck-dropdown__panel.ck-dropdown__panel_nw{border-bottom-right-radius:0}"},function(e,t,o){var n=o(1),i=o(33);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-list{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-direction:column}.ck.ck-list .ck-list__item,.ck.ck-list .ck-list__separator{display:block}.ck.ck-list .ck-list__item>:focus{position:relative;z-index:var(--ck-z-default)}.ck.ck-list{border-radius:0}.ck-rounded-corners .ck.ck-list,.ck.ck-list.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-list{list-style-type:none;background:var(--ck-color-list-background)}.ck.ck-list__item{cursor:default;min-width:12em}.ck.ck-list__item .ck-button{min-height:unset;width:100%;text-align:left;border-radius:0;padding:calc(0.2*var(--ck-line-height-base)*var(--ck-font-size-base)) calc(0.4*var(--ck-line-height-base)*var(--ck-font-size-base))}.ck.ck-list__item .ck-button .ck-button__label{line-height:calc(1.2*var(--ck-line-height-base)*var(--ck-font-size-base))}.ck.ck-list__item .ck-button:active{box-shadow:none}.ck.ck-list__item .ck-button.ck-on{background:var(--ck-color-list-button-on-background);color:var(--ck-color-list-button-on-text)}.ck.ck-list__item .ck-button.ck-on:active{box-shadow:none}.ck.ck-list__item .ck-button.ck-on:hover:not(.ck-disabled){background:var(--ck-color-list-button-on-background-focus)}.ck.ck-list__item .ck-button.ck-on:focus:not(.ck-disabled){border-color:var(--ck-color-base-background)}.ck.ck-list__item .ck-button:hover:not(.ck-disabled){background:var(--ck-color-list-button-hover-background)}.ck.ck-list__item .ck-switchbutton.ck-on{background:var(--ck-color-list-background);color:inherit}.ck.ck-list__item .ck-switchbutton.ck-on:hover:not(.ck-disabled){background:var(--ck-color-list-button-hover-background);color:inherit}.ck.ck-list__separator{height:1px;width:100%;background:var(--ck-color-base-border)}"},function(e,t,o){var n=o(1),i=o(35);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-button.ck-switchbutton .ck-button__toggle,.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner{display:block}:root{--ck-switch-button-toggle-width:2.6153846154em;--ck-switch-button-toggle-inner-size:1.0769230769em;--ck-switch-button-toggle-spacing:1px;--ck-switch-button-translation:calc(var(--ck-switch-button-toggle-width) - var(--ck-switch-button-toggle-inner-size) - 2*var(--ck-switch-button-toggle-spacing))}[dir=ltr] .ck.ck-button.ck-switchbutton .ck-button__label{margin-right:calc(2*var(--ck-spacing-large))}[dir=rtl] .ck.ck-button.ck-switchbutton .ck-button__label{margin-left:calc(2*var(--ck-spacing-large))}.ck.ck-button.ck-switchbutton .ck-button__toggle{border-radius:0}.ck-rounded-corners .ck.ck-button.ck-switchbutton .ck-button__toggle,.ck.ck-button.ck-switchbutton .ck-button__toggle.ck-rounded-corners{border-radius:var(--ck-border-radius)}[dir=ltr] .ck.ck-button.ck-switchbutton .ck-button__toggle{margin-left:auto}[dir=rtl] .ck.ck-button.ck-switchbutton .ck-button__toggle{margin-right:auto}.ck.ck-button.ck-switchbutton .ck-button__toggle{transition:background .4s ease;width:var(--ck-switch-button-toggle-width);background:var(--ck-color-switch-button-off-background)}.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner{border-radius:0}.ck-rounded-corners .ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner,.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner.ck-rounded-corners{border-radius:var(--ck-border-radius);border-radius:calc(0.5*var(--ck-border-radius))}.ck.ck-button.ck-switchbutton .ck-button__toggle .ck-button__toggle__inner{margin:var(--ck-switch-button-toggle-spacing);width:var(--ck-switch-button-toggle-inner-size);height:var(--ck-switch-button-toggle-inner-size);background:var(--ck-color-switch-button-inner-background);transition:all .3s ease}.ck.ck-button.ck-switchbutton .ck-button__toggle:hover{background:var(--ck-color-switch-button-off-hover-background)}.ck.ck-button.ck-switchbutton .ck-button__toggle:hover .ck-button__toggle__inner{box-shadow:0 0 0 5px var(--ck-color-switch-button-inner-shadow)}.ck.ck-button.ck-switchbutton.ck-disabled .ck-button__toggle{opacity:var(--ck-disabled-opacity)}.ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle{background:var(--ck-color-switch-button-on-background)}.ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle:hover{background:var(--ck-color-switch-button-on-hover-background)}[dir=ltr] .ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle .ck-button__toggle__inner{transform:translateX(var(--ck-switch-button-translation))}[dir=rtl] .ck.ck-button.ck-switchbutton.ck-on .ck-button__toggle .ck-button__toggle__inner{transform:translateX(calc(-1*var(--ck-switch-button-translation)))}"},function(e,t,o){var n=o(1),i=o(37);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-toolbar-dropdown .ck.ck-toolbar .ck.ck-toolbar__items{flex-wrap:nowrap}.ck.ck-toolbar-dropdown .ck-dropdown__panel .ck-button:focus{z-index:calc(var(--ck-z-default) + 1)}.ck.ck-toolbar-dropdown .ck-toolbar{border:0}"},function(e,t,o){var n=o(1),i=o(39);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-dropdown .ck-dropdown__panel .ck-list{border-radius:0}.ck-rounded-corners .ck.ck-dropdown .ck-dropdown__panel .ck-list,.ck.ck-dropdown .ck-dropdown__panel .ck-list.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0}.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:first-child .ck-button{border-radius:0}.ck-rounded-corners .ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:first-child .ck-button,.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:first-child .ck-button.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0;border-bottom-left-radius:0;border-bottom-right-radius:0}.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:last-child .ck-button{border-radius:0}.ck-rounded-corners .ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:last-child .ck-button,.ck.ck-dropdown .ck-dropdown__panel .ck-list .ck-list__item:last-child .ck-button.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:0;border-top-right-radius:0}"},function(e,t,o){var n=o(1),i=o(41);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-toolbar{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-flow:row nowrap;align-items:center}.ck.ck-toolbar>.ck-toolbar__items{display:flex;flex-flow:row wrap;align-items:center;flex-grow:1}.ck.ck-toolbar .ck.ck-toolbar__separator{display:inline-block}.ck.ck-toolbar .ck.ck-toolbar__separator:first-child,.ck.ck-toolbar .ck.ck-toolbar__separator:last-child{display:none}.ck.ck-toolbar.ck-toolbar_grouping>.ck-toolbar__items{flex-wrap:nowrap}.ck.ck-toolbar.ck-toolbar_vertical>.ck-toolbar__items{flex-direction:column}.ck.ck-toolbar.ck-toolbar_floating>.ck-toolbar__items{flex-wrap:nowrap}.ck.ck-toolbar>.ck.ck-toolbar__grouped-dropdown>.ck-dropdown__button .ck-dropdown__arrow{display:none}.ck.ck-toolbar{border-radius:0}.ck-rounded-corners .ck.ck-toolbar,.ck.ck-toolbar.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-toolbar{background:var(--ck-color-toolbar-background);padding:0 var(--ck-spacing-small);border:1px solid var(--ck-color-toolbar-border)}.ck.ck-toolbar .ck.ck-toolbar__separator{align-self:stretch;width:1px;min-width:1px;background:var(--ck-color-toolbar-border);margin-top:var(--ck-spacing-small);margin-bottom:var(--ck-spacing-small)}.ck.ck-toolbar>.ck-toolbar__items>*{margin-top:var(--ck-spacing-small);margin-bottom:var(--ck-spacing-small);margin-right:var(--ck-spacing-small)}.ck.ck-toolbar>.ck-toolbar__items:empty+.ck.ck-toolbar__separator{display:none}.ck.ck-toolbar>.ck-toolbar__items>*,.ck.ck-toolbar>.ck.ck-toolbar__grouped-dropdown{margin-top:var(--ck-spacing-small);margin-bottom:var(--ck-spacing-small)}.ck.ck-toolbar.ck-toolbar_vertical{padding:0}.ck.ck-toolbar.ck-toolbar_vertical>.ck-toolbar__items>.ck{width:100%;margin:0;border-radius:0;border:0}.ck.ck-toolbar.ck-toolbar_compact{padding:0}.ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>*{margin:0}.ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>:not(:first-child):not(:last-child){border-radius:0}.ck.ck-toolbar>.ck.ck-toolbar__grouped-dropdown>.ck.ck-button.ck-dropdown__button{padding-left:var(--ck-spacing-tiny)}.ck-toolbar-container .ck.ck-toolbar{border:0}.ck.ck-toolbar[dir=rtl]>.ck-toolbar__items>.ck,[dir=rtl] .ck.ck-toolbar>.ck-toolbar__items>.ck{margin-right:0}.ck.ck-toolbar[dir=rtl]:not(.ck-toolbar_compact)>.ck-toolbar__items>.ck,[dir=rtl] .ck.ck-toolbar:not(.ck-toolbar_compact)>.ck-toolbar__items>.ck{margin-left:var(--ck-spacing-small)}.ck.ck-toolbar[dir=rtl]>.ck-toolbar__items>.ck:last-child,[dir=rtl] .ck.ck-toolbar>.ck-toolbar__items>.ck:last-child{margin-left:0}.ck.ck-toolbar[dir=rtl].ck-toolbar_compact>.ck-toolbar__items>.ck:first-child,[dir=rtl] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.ck.ck-toolbar[dir=rtl].ck-toolbar_compact>.ck-toolbar__items>.ck:last-child,[dir=rtl] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:last-child{border-top-right-radius:0;border-bottom-right-radius:0}.ck.ck-toolbar[dir=rtl]>.ck.ck-toolbar__separator,[dir=rtl] .ck.ck-toolbar>.ck.ck-toolbar__separator{margin-left:var(--ck-spacing-small)}.ck.ck-toolbar[dir=rtl].ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child),[dir=rtl] .ck.ck-toolbar.ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child){margin-left:var(--ck-spacing-small)}.ck.ck-toolbar[dir=ltr]>.ck-toolbar__items>.ck:last-child,[dir=ltr] .ck.ck-toolbar>.ck-toolbar__items>.ck:last-child{margin-right:0}.ck.ck-toolbar[dir=ltr].ck-toolbar_compact>.ck-toolbar__items>.ck:first-child,[dir=ltr] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:first-child{border-top-right-radius:0;border-bottom-right-radius:0}.ck.ck-toolbar[dir=ltr].ck-toolbar_compact>.ck-toolbar__items>.ck:last-child,[dir=ltr] .ck.ck-toolbar.ck-toolbar_compact>.ck-toolbar__items>.ck:last-child{border-top-left-radius:0;border-bottom-left-radius:0}.ck.ck-toolbar[dir=ltr]>.ck.ck-toolbar__separator,[dir=ltr] .ck.ck-toolbar>.ck.ck-toolbar__separator{margin-right:var(--ck-spacing-small)}.ck.ck-toolbar[dir=ltr].ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child),[dir=ltr] .ck.ck-toolbar.ck-toolbar_grouping>.ck-toolbar__items:not(:empty):not(:only-child){margin-right:var(--ck-spacing-small)}"},function(e,t,o){var n=o(1),i=o(43);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-placeholder:before,.ck .ck-placeholder:before{content:attr(data-placeholder);pointer-events:none}.ck.ck-read-only .ck-placeholder:before{display:none}.ck.ck-placeholder:before,.ck .ck-placeholder:before{cursor:text;color:var(--ck-color-engine-placeholder-text)}"},function(e,t,o){var n=o(1),i=o(45);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=":root{--ck-color-editable-blur-selection:#d9d9d9}.ck.ck-editor__editable:not(.ck-editor__nested-editable){border-radius:0}.ck-rounded-corners .ck.ck-editor__editable:not(.ck-editor__nested-editable),.ck.ck-editor__editable:not(.ck-editor__nested-editable).ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-editor__editable:not(.ck-editor__nested-editable).ck-focused{outline:none;border:var(--ck-focus-ring);box-shadow:var(--ck-inner-shadow),0 0}.ck.ck-editor__editable_inline{overflow:auto;padding:0 var(--ck-spacing-standard);border:1px solid transparent}.ck.ck-editor__editable_inline[dir=ltr]{text-align:left}.ck.ck-editor__editable_inline[dir=rtl]{text-align:right}.ck.ck-editor__editable_inline>:first-child{margin-top:var(--ck-spacing-large)}.ck.ck-editor__editable_inline>:last-child{margin-bottom:var(--ck-spacing-large)}.ck.ck-editor__editable_inline.ck-blurred ::selection{background:var(--ck-color-editable-blur-selection)}.ck.ck-balloon-panel.ck-toolbar-container[class*=arrow_n]:after{border-bottom-color:var(--ck-color-base-foreground)}.ck.ck-balloon-panel.ck-toolbar-container[class*=arrow_s]:after{border-top-color:var(--ck-color-base-foreground)}"},function(e,t){e.exports=".ck-content code{background-color:hsla(0,0%,78%,.3);padding:.15em;border-radius:2px}.ck.ck-editor__editable .ck-code_selected{background-color:hsla(0,0%,78%,.5)}"},function(e,t,o){var n=o(1),i=o(48);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck-content blockquote{overflow:hidden;padding-right:1.5em;padding-left:1.5em;margin-left:0;margin-right:0;font-style:italic;border-left:5px solid #ccc}.ck-content[dir=rtl] blockquote{border-left:0;border-right:5px solid #ccc}"},function(e,t){e.exports=".ck.ck-heading_heading1{font-size:20px}.ck.ck-heading_heading2{font-size:17px}.ck.ck-heading_heading3{font-size:14px}.ck[class*=ck-heading_heading]{font-weight:700}.ck.ck-dropdown.ck-heading-dropdown .ck-dropdown__button .ck-button__label{width:8em}.ck.ck-dropdown.ck-heading-dropdown .ck-dropdown__panel .ck-list__item{min-width:18em}"},function(e,t,o){var n=o(1),i=o(51);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports='.ck .ck-widget .ck-widget__type-around__button{display:block;position:absolute;overflow:hidden;z-index:var(--ck-z-default)}.ck .ck-widget .ck-widget__type-around__button svg{position:absolute;top:50%;left:50%;z-index:calc(var(--ck-z-default) + 2)}.ck .ck-widget .ck-widget__type-around__button.ck-widget__type-around__button_before{top:calc(-0.5*var(--ck-widget-outline-thickness));left:min(10%,30px);transform:translateY(-50%)}.ck .ck-widget .ck-widget__type-around__button.ck-widget__type-around__button_after{bottom:calc(-0.5*var(--ck-widget-outline-thickness));right:min(10%,30px);transform:translateY(50%)}.ck .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button:after,.ck .ck-widget>.ck-widget__type-around>.ck-widget__type-around__button:hover:after{content:"";display:block;position:absolute;top:1px;left:1px;z-index:calc(var(--ck-z-default) + 1)}.ck .ck-widget>.ck-widget__type-around>.ck-widget__type-around__fake-caret{display:none;position:absolute;left:0;right:0}.ck .ck-widget:hover>.ck-widget__type-around>.ck-widget__type-around__fake-caret{left:calc(-1*var(--ck-widget-outline-thickness));right:calc(-1*var(--ck-widget-outline-thickness))}.ck .ck-widget.ck-widget_type-around_show-fake-caret_before>.ck-widget__type-around>.ck-widget__type-around__fake-caret{top:calc(-1*var(--ck-widget-outline-thickness) - 1px);display:block}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after>.ck-widget__type-around>.ck-widget__type-around__fake-caret{bottom:calc(-1*var(--ck-widget-outline-thickness) - 1px);display:block}.ck.ck-editor__editable.ck-read-only .ck-widget__type-around,.ck.ck-editor__editable.ck-restricted-editing_mode_restricted .ck-widget__type-around,.ck.ck-editor__editable.ck-widget__type-around_disabled .ck-widget__type-around{display:none}:root{--ck-widget-type-around-button-size:20px;--ck-color-widget-type-around-button-active:var(--ck-color-focus-border);--ck-color-widget-type-around-button-hover:var(--ck-color-widget-hover-border);--ck-color-widget-type-around-button-blurred-editable:var(--ck-color-widget-blurred-border);--ck-color-widget-type-around-button-radar-start-alpha:0;--ck-color-widget-type-around-button-radar-end-alpha:.3;--ck-color-widget-type-around-button-icon:var(--ck-color-base-background)}.ck .ck-widget .ck-widget__type-around__button{width:var(--ck-widget-type-around-button-size);height:var(--ck-widget-type-around-button-size);background:var(--ck-color-widget-type-around-button);border-radius:100px;transition:opacity var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve),background var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve);opacity:0;pointer-events:none}.ck .ck-widget .ck-widget__type-around__button svg{width:10px;height:8px;transform:translate(-50%,-50%);transition:transform .5s ease;margin-top:1px}.ck .ck-widget .ck-widget__type-around__button svg *{stroke-dasharray:10;stroke-dashoffset:0;fill:none;stroke:var(--ck-color-widget-type-around-button-icon);stroke-width:1.5px;stroke-linecap:round;stroke-linejoin:round}.ck .ck-widget .ck-widget__type-around__button svg line{stroke-dasharray:7}.ck .ck-widget .ck-widget__type-around__button:hover{animation:ck-widget-type-around-button-sonar 1s ease infinite}.ck .ck-widget .ck-widget__type-around__button:hover svg polyline{animation:ck-widget-type-around-arrow-dash 2s linear}.ck .ck-widget .ck-widget__type-around__button:hover svg line{animation:ck-widget-type-around-arrow-tip-dash 2s linear}.ck .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button,.ck .ck-widget:hover>.ck-widget__type-around>.ck-widget__type-around__button{opacity:1;pointer-events:auto}.ck .ck-widget:not(.ck-widget_selected)>.ck-widget__type-around>.ck-widget__type-around__button{background:var(--ck-color-widget-type-around-button-hover)}.ck .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button,.ck .ck-widget>.ck-widget__type-around>.ck-widget__type-around__button:hover{background:var(--ck-color-widget-type-around-button-active)}.ck .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button:after,.ck .ck-widget>.ck-widget__type-around>.ck-widget__type-around__button:hover:after{width:calc(var(--ck-widget-type-around-button-size) - 2px);height:calc(var(--ck-widget-type-around-button-size) - 2px);border-radius:100px;background:linear-gradient(135deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.3))}.ck .ck-widget.ck-widget_with-selection-handle>.ck-widget__type-around>.ck-widget__type-around__button_before{margin-left:20px}.ck .ck-widget .ck-widget__type-around__fake-caret{pointer-events:none;height:1px;animation:ck-widget-type-around-fake-caret-pulse 1s linear infinite normal forwards;outline:1px solid hsla(0,0%,100%,.5);background:var(--ck-color-base-text)}.ck .ck-widget.ck-widget_selected.ck-widget_type-around_show-fake-caret_after,.ck .ck-widget.ck-widget_selected.ck-widget_type-around_show-fake-caret_before{outline-color:transparent}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after.ck-widget_selected:hover,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before.ck-widget_selected:hover{outline-color:var(--ck-color-widget-hover-border)}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after>.ck-widget__type-around>.ck-widget__type-around__button,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before>.ck-widget__type-around>.ck-widget__type-around__button{opacity:0;pointer-events:none}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after.ck-widget_with-selection-handle.ck-widget_selected:hover>.ck-widget__selection-handle,.ck .ck-widget.ck-widget_type-around_show-fake-caret_after.ck-widget_with-selection-handle.ck-widget_selected>.ck-widget__selection-handle,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before.ck-widget_with-selection-handle.ck-widget_selected:hover>.ck-widget__selection-handle,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before.ck-widget_with-selection-handle.ck-widget_selected>.ck-widget__selection-handle{opacity:0}.ck .ck-widget.ck-widget_type-around_show-fake-caret_after.ck-widget_selected.ck-widget_with-resizer>.ck-widget__resizer,.ck .ck-widget.ck-widget_type-around_show-fake-caret_before.ck-widget_selected.ck-widget_with-resizer>.ck-widget__resizer{opacity:0}.ck-editor__nested-editable.ck-editor__editable_selected .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button,.ck-editor__nested-editable.ck-editor__editable_selected .ck-widget:hover>.ck-widget__type-around>.ck-widget__type-around__button{opacity:0;pointer-events:none}.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button:not(:hover){background:var(--ck-color-widget-type-around-button-blurred-editable)}.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected>.ck-widget__type-around>.ck-widget__type-around__button:not(:hover) svg *{stroke:#999}@keyframes ck-widget-type-around-arrow-dash{0%{stroke-dashoffset:10}20%,to{stroke-dashoffset:0}}@keyframes ck-widget-type-around-arrow-tip-dash{0%,20%{stroke-dashoffset:7}40%,to{stroke-dashoffset:0}}@keyframes ck-widget-type-around-button-sonar{0%{box-shadow:0 0 0 0 hsla(var(--ck-color-focus-border-coordinates),var(--ck-color-widget-type-around-button-radar-start-alpha))}50%{box-shadow:0 0 0 5px hsla(var(--ck-color-focus-border-coordinates),var(--ck-color-widget-type-around-button-radar-end-alpha))}to{box-shadow:0 0 0 5px hsla(var(--ck-color-focus-border-coordinates),var(--ck-color-widget-type-around-button-radar-start-alpha))}}@keyframes ck-widget-type-around-fake-caret-pulse{0%{opacity:1}49%{opacity:1}50%{opacity:0}99%{opacity:0}to{opacity:1}}'},function(e,t,o){var n=o(1),i=o(53);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=":root{--ck-color-resizer:var(--ck-color-focus-border);--ck-resizer-size:10px;--ck-resizer-border-width:1px;--ck-resizer-border-radius:2px;--ck-resizer-offset:calc(var(--ck-resizer-size)/-2 - 2px);--ck-resizer-tooltip-offset:10px;--ck-color-resizer-tooltip-background:#262626;--ck-color-resizer-tooltip-text:#f2f2f2}.ck .ck-widget,.ck .ck-widget.ck-widget_with-selection-handle{position:relative}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle{position:absolute}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle .ck-icon{display:block}.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected .ck-widget__selection-handle,.ck .ck-widget.ck-widget_with-selection-handle:hover .ck-widget__selection-handle{visibility:visible}.ck .ck-size-view{background:var(--ck-color-resizer-tooltip-background);color:var(--ck-color-resizer-tooltip-text);border:1px solid var(--ck-color-resizer-tooltip-text);border-radius:var(--ck-resizer-border-radius);font-size:var(--ck-font-size-tiny);display:block;padding:var(--ck-spacing-small)}.ck .ck-size-view.ck-orientation-bottom-left,.ck .ck-size-view.ck-orientation-bottom-right,.ck .ck-size-view.ck-orientation-top-left,.ck .ck-size-view.ck-orientation-top-right{position:absolute}.ck .ck-size-view.ck-orientation-top-left{top:var(--ck-resizer-tooltip-offset);left:var(--ck-resizer-tooltip-offset)}.ck .ck-size-view.ck-orientation-top-right{top:var(--ck-resizer-tooltip-offset);right:var(--ck-resizer-tooltip-offset)}.ck .ck-size-view.ck-orientation-bottom-right{bottom:var(--ck-resizer-tooltip-offset);right:var(--ck-resizer-tooltip-offset)}.ck .ck-size-view.ck-orientation-bottom-left{bottom:var(--ck-resizer-tooltip-offset);left:var(--ck-resizer-tooltip-offset)}:root{--ck-widget-outline-thickness:3px;--ck-widget-handler-icon-size:16px;--ck-widget-handler-animation-duration:200ms;--ck-widget-handler-animation-curve:ease;--ck-color-widget-blurred-border:#dedede;--ck-color-widget-hover-border:#ffc83d;--ck-color-widget-editable-focus-background:var(--ck-color-base-background);--ck-color-widget-drag-handler-icon-color:var(--ck-color-base-background)}.ck .ck-widget{outline-width:var(--ck-widget-outline-thickness);outline-style:solid;outline-color:transparent;transition:outline-color var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve)}.ck .ck-widget.ck-widget_selected,.ck .ck-widget.ck-widget_selected:hover{outline:var(--ck-widget-outline-thickness) solid var(--ck-color-focus-border)}.ck .ck-widget:hover{outline-color:var(--ck-color-widget-hover-border)}.ck .ck-editor__nested-editable{border:1px solid transparent}.ck .ck-editor__nested-editable.ck-editor__nested-editable_focused,.ck .ck-editor__nested-editable:focus{outline:none;border:var(--ck-focus-ring);box-shadow:var(--ck-inner-shadow),0 0;background-color:var(--ck-color-widget-editable-focus-background)}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle{padding:4px;box-sizing:border-box;background-color:transparent;opacity:0;transition:background-color var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve),visibility var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve),opacity var(--ck-widget-handler-animation-duration) var(--ck-widget-handler-animation-curve);border-radius:var(--ck-border-radius) var(--ck-border-radius) 0 0;transform:translateY(-100%);left:calc(0px - var(--ck-widget-outline-thickness))}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle .ck-icon{width:var(--ck-widget-handler-icon-size);height:var(--ck-widget-handler-icon-size);color:var(--ck-color-widget-drag-handler-icon-color)}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle .ck-icon .ck-icon__selected-indicator{opacity:0;transition:opacity .3s var(--ck-widget-handler-animation-curve)}.ck .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle:hover .ck-icon .ck-icon__selected-indicator{opacity:1}.ck .ck-widget.ck-widget_with-selection-handle:hover .ck-widget__selection-handle{opacity:1;background-color:var(--ck-color-widget-hover-border)}.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected .ck-widget__selection-handle,.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected:hover .ck-widget__selection-handle{opacity:1;background-color:var(--ck-color-focus-border)}.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected .ck-widget__selection-handle .ck-icon .ck-icon__selected-indicator,.ck .ck-widget.ck-widget_with-selection-handle.ck-widget_selected:hover .ck-widget__selection-handle .ck-icon .ck-icon__selected-indicator{opacity:1}.ck[dir=rtl] .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle{left:auto;right:calc(0px - var(--ck-widget-outline-thickness))}.ck.ck-editor__editable.ck-read-only .ck-widget{transition:none}.ck.ck-editor__editable.ck-read-only .ck-widget:not(.ck-widget_selected){--ck-widget-outline-thickness:0px}.ck.ck-editor__editable.ck-read-only .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle,.ck.ck-editor__editable.ck-read-only .ck-widget.ck-widget_with-selection-handle .ck-widget__selection-handle:hover{background:var(--ck-color-widget-blurred-border)}.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected,.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover{outline-color:var(--ck-color-widget-blurred-border)}.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected.ck-widget_with-selection-handle .ck-widget__selection-handle,.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected.ck-widget_with-selection-handle .ck-widget__selection-handle:hover,.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover.ck-widget_with-selection-handle .ck-widget__selection-handle,.ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover.ck-widget_with-selection-handle .ck-widget__selection-handle:hover{background:var(--ck-color-widget-blurred-border)}.ck.ck-editor__editable>.ck-widget.ck-widget_with-selection-handle:first-child,.ck.ck-editor__editable blockquote>.ck-widget.ck-widget_with-selection-handle:first-child{margin-top:calc(1em + var(--ck-widget-handler-icon-size))}"},function(e,t,o){var n=o(1),i=o(55);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-label{display:block}.ck.ck-voice-label{display:none}.ck.ck-label{font-weight:700}"},function(e,t,o){var n=o(1),i=o(57);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-labeled-field-view .ck-labeled-field-view__status{font-size:var(--ck-font-size-small);margin-top:var(--ck-spacing-small);white-space:normal}.ck.ck-labeled-field-view .ck-labeled-field-view__status_error{color:var(--ck-color-base-error)}.ck.ck-labeled-field-view>.ck.ck-label{width:100%;text-overflow:ellipsis;overflow:hidden}"},function(e,t,o){var n=o(1),i=o(59);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=":root{--ck-input-text-width:18em}.ck.ck-input-text{border-radius:0}.ck-rounded-corners .ck.ck-input-text,.ck.ck-input-text.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-input-text{box-shadow:var(--ck-inner-shadow),0 0;background:var(--ck-color-input-background);border:1px solid var(--ck-color-input-border);padding:var(--ck-spacing-extra-tiny) var(--ck-spacing-medium);min-width:var(--ck-input-text-width);min-height:var(--ck-ui-component-min-height);transition:box-shadow .2s ease-in-out,border .2s ease-in-out}.ck.ck-input-text:focus{outline:none;border:var(--ck-focus-ring);box-shadow:var(--ck-focus-outer-shadow),var(--ck-inner-shadow)}.ck.ck-input-text[readonly]{border:1px solid var(--ck-color-input-disabled-border);background:var(--ck-color-input-disabled-background);color:var(--ck-color-input-disabled-text)}.ck.ck-input-text[readonly]:focus{box-shadow:var(--ck-focus-disabled-outer-shadow),var(--ck-inner-shadow)}.ck.ck-input-text.ck-error{border-color:var(--ck-color-input-error-border);animation:ck-text-input-shake .3s ease both}.ck.ck-input-text.ck-error:focus{box-shadow:var(--ck-focus-error-outer-shadow),var(--ck-inner-shadow)}@keyframes ck-text-input-shake{20%{transform:translateX(-2px)}40%{transform:translateX(2px)}60%{transform:translateX(-1px)}80%{transform:translateX(1px)}}"},function(e,t,o){var n=o(1),i=o(61);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-text-alternative-form{display:flex;flex-direction:row;flex-wrap:nowrap}.ck.ck-text-alternative-form .ck-labeled-field-view{display:inline-block}.ck.ck-text-alternative-form .ck-label{display:none}@media screen and (max-width:600px){.ck.ck-text-alternative-form{flex-wrap:wrap}.ck.ck-text-alternative-form .ck-labeled-field-view{flex-basis:100%}.ck.ck-text-alternative-form .ck-button{flex-basis:50%}}.ck.ck-text-alternative-form{padding:var(--ck-spacing-standard)}.ck.ck-text-alternative-form:focus{outline:none}[dir=ltr] .ck.ck-text-alternative-form>:not(:first-child),[dir=rtl] .ck.ck-text-alternative-form>:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-text-alternative-form{padding:0;width:calc(0.8*var(--ck-input-text-width))}.ck.ck-text-alternative-form .ck-labeled-field-view{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-text-alternative-form .ck-labeled-field-view .ck-input-text{min-width:0;width:100%}.ck.ck-text-alternative-form .ck-button{padding:var(--ck-spacing-standard);margin-top:var(--ck-spacing-standard);border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border)}[dir=ltr] .ck.ck-text-alternative-form .ck-button{margin-left:0}[dir=ltr] .ck.ck-text-alternative-form .ck-button:first-of-type{border-right:1px solid var(--ck-color-base-border)}[dir=rtl] .ck.ck-text-alternative-form .ck-button{margin-left:0}[dir=rtl] .ck.ck-text-alternative-form .ck-button:last-of-type{border-right:1px solid var(--ck-color-base-border)}}"},function(e,t,o){var n=o(1),i=o(63);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck-content .image{display:table;clear:both;text-align:center;margin:1em auto}.ck-content .image img{display:block;margin:0 auto;max-width:100%;min-width:50px}"},function(e,t,o){var n=o(1),i=o(65);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck-content .image>figcaption{display:table-caption;caption-side:bottom;word-break:break-word;color:#333;background-color:#f7f7f7;padding:.6em;font-size:.75em;outline-offset:-1px}"},function(e,t,o){var n=o(1),i=o(67);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=":root{--ck-image-style-spacing:1.5em}.ck-content .image-style-side{float:right;margin-left:var(--ck-image-style-spacing);max-width:50%}.ck-content .image-style-align-left{float:left;margin-right:var(--ck-image-style-spacing)}.ck-content .image-style-align-center{margin-left:auto;margin-right:auto}.ck-content .image-style-align-right{float:right;margin-left:var(--ck-image-style-spacing)}"},function(e,t,o){var n=o(1),i=o(69);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-splitbutton{font-size:inherit}.ck.ck-splitbutton .ck-splitbutton__action:focus{z-index:calc(var(--ck-z-default) + 1)}.ck.ck-splitbutton.ck-splitbutton_open>.ck-button .ck-tooltip{display:none}:root{--ck-color-split-button-hover-background:#ebebeb;--ck-color-split-button-hover-border:#b3b3b3}[dir=ltr] .ck.ck-splitbutton>.ck-splitbutton__action{border-top-right-radius:unset;border-bottom-right-radius:unset}[dir=rtl] .ck.ck-splitbutton>.ck-splitbutton__action{border-top-left-radius:unset;border-bottom-left-radius:unset}.ck.ck-splitbutton>.ck-splitbutton__arrow{min-width:unset}[dir=ltr] .ck.ck-splitbutton>.ck-splitbutton__arrow{border-radius:0}.ck-rounded-corners [dir=ltr] .ck.ck-splitbutton>.ck-splitbutton__arrow,[dir=ltr] .ck.ck-splitbutton>.ck-splitbutton__arrow.ck-rounded-corners{border-radius:var(--ck-border-radius);border-top-left-radius:unset;border-bottom-left-radius:unset}[dir=rtl] .ck.ck-splitbutton>.ck-splitbutton__arrow{border-top-right-radius:unset;border-bottom-right-radius:unset}.ck.ck-splitbutton>.ck-splitbutton__arrow svg{width:var(--ck-dropdown-arrow-size)}.ck.ck-splitbutton.ck-splitbutton_open>.ck-button:not(.ck-on):not(.ck-disabled):not(:hover),.ck.ck-splitbutton:hover>.ck-button:not(.ck-on):not(.ck-disabled):not(:hover){background:var(--ck-color-split-button-hover-background)}[dir=ltr] .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled),[dir=ltr] .ck.ck-splitbutton:hover>.ck-splitbutton__arrow:not(.ck-disabled){border-left-color:var(--ck-color-split-button-hover-border)}[dir=rtl] .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__arrow:not(.ck-disabled),[dir=rtl] .ck.ck-splitbutton:hover>.ck-splitbutton__arrow:not(.ck-disabled){border-right-color:var(--ck-color-split-button-hover-border)}.ck.ck-splitbutton.ck-splitbutton_open{border-radius:0}.ck-rounded-corners .ck.ck-splitbutton.ck-splitbutton_open,.ck.ck-splitbutton.ck-splitbutton_open.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck-rounded-corners .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__action,.ck.ck-splitbutton.ck-splitbutton_open.ck-rounded-corners>.ck-splitbutton__action{border-bottom-left-radius:0}.ck-rounded-corners .ck.ck-splitbutton.ck-splitbutton_open>.ck-splitbutton__arrow,.ck.ck-splitbutton.ck-splitbutton_open.ck-rounded-corners>.ck-splitbutton__arrow{border-bottom-right-radius:0}"},function(e,t,o){var n=o(1),i=o(71);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-form__row{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between}.ck.ck-form__row>:not(.ck-label){flex-grow:1}.ck.ck-form__row.ck-image-upload-form__action-row{margin-top:var(--ck-spacing-standard)}.ck.ck-form__row.ck-image-upload-form__action-row .ck-button-cancel,.ck.ck-form__row.ck-image-upload-form__action-row .ck-button-save{justify-content:center}.ck.ck-form__row.ck-image-upload-form__action-row .ck-button .ck-button__label{color:var(--ck-color-text)}"},function(e,t,o){var n=o(1),i=o(73);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-image-upload__panel{padding:var(--ck-spacing-standard)}.ck.ck-image-upload__ck-finder-button{display:block;width:100%;margin:var(--ck-spacing-standard) auto;border:1px solid #ccc;border-radius:var(--ck-border-radius)}"},function(e,t,o){var n=o(1),i=o(75);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-editor__editable .image{position:relative}.ck.ck-editor__editable .image .ck-progress-bar{position:absolute;top:0;left:0}.ck.ck-editor__editable .image.ck-appear{animation:fadeIn .7s}.ck.ck-editor__editable .image .ck-progress-bar{height:2px;width:0;background:var(--ck-color-upload-bar-background);transition:width .1s}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}"},function(e,t,o){var n=o(1),i=o(77);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports='.ck-image-upload-complete-icon{display:block;position:absolute;top:10px;right:10px;border-radius:50%}.ck-image-upload-complete-icon:after{content:"";position:absolute}:root{--ck-color-image-upload-icon:#fff;--ck-color-image-upload-icon-background:#008a00;--ck-image-upload-icon-size:20px;--ck-image-upload-icon-width:2px}.ck-image-upload-complete-icon{width:var(--ck-image-upload-icon-size);height:var(--ck-image-upload-icon-size);opacity:0;background:var(--ck-color-image-upload-icon-background);animation-name:ck-upload-complete-icon-show,ck-upload-complete-icon-hide;animation-fill-mode:forwards,forwards;animation-duration:.5s,.5s;font-size:var(--ck-image-upload-icon-size);animation-delay:0ms,3s}.ck-image-upload-complete-icon:after{left:25%;top:50%;opacity:0;height:0;width:0;transform:scaleX(-1) rotate(135deg);transform-origin:left top;border-top:var(--ck-image-upload-icon-width) solid var(--ck-color-image-upload-icon);border-right:var(--ck-image-upload-icon-width) solid var(--ck-color-image-upload-icon);animation-name:ck-upload-complete-icon-check;animation-duration:.5s;animation-delay:.5s;animation-fill-mode:forwards;box-sizing:border-box}@keyframes ck-upload-complete-icon-show{0%{opacity:0}to{opacity:1}}@keyframes ck-upload-complete-icon-hide{0%{opacity:1}to{opacity:0}}@keyframes ck-upload-complete-icon-check{0%{opacity:1;width:0;height:0}33%{width:.3em;height:0}to{opacity:1;width:.3em;height:.45em}}'},function(e,t,o){var n=o(1),i=o(79);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports='.ck .ck-upload-placeholder-loader{position:absolute;display:flex;align-items:center;justify-content:center;top:0;left:0}.ck .ck-upload-placeholder-loader:before{content:"";position:relative}:root{--ck-color-upload-placeholder-loader:#b3b3b3;--ck-upload-placeholder-loader-size:32px}.ck .ck-image-upload-placeholder{width:100%;margin:0}.ck .ck-upload-placeholder-loader{width:100%;height:100%}.ck .ck-upload-placeholder-loader:before{width:var(--ck-upload-placeholder-loader-size);height:var(--ck-upload-placeholder-loader-size);border-radius:50%;border-top:3px solid var(--ck-color-upload-placeholder-loader);border-right:2px solid transparent;animation:ck-upload-placeholder-loader 1s linear infinite}@keyframes ck-upload-placeholder-loader{to{transform:rotate(1turn)}}'},function(e,t,o){var n=o(1),i=o(81);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck .ck-widget_with-resizer{position:relative}.ck .ck-widget__resizer{display:none;position:absolute;pointer-events:none;left:0;top:0;outline:1px solid var(--ck-color-resizer)}.ck-focused .ck-widget_with-resizer.ck-widget_selected>.ck-widget__resizer{display:block}.ck .ck-widget__resizer__handle{position:absolute;pointer-events:all;width:var(--ck-resizer-size);height:var(--ck-resizer-size);background:var(--ck-color-focus-border);border:var(--ck-resizer-border-width) solid #fff;border-radius:var(--ck-resizer-border-radius)}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-top-left{top:var(--ck-resizer-offset);left:var(--ck-resizer-offset);cursor:nwse-resize}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-top-right{top:var(--ck-resizer-offset);right:var(--ck-resizer-offset);cursor:nesw-resize}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-bottom-right{bottom:var(--ck-resizer-offset);right:var(--ck-resizer-offset);cursor:nwse-resize}.ck .ck-widget__resizer__handle.ck-widget__resizer__handle-bottom-left{bottom:var(--ck-resizer-offset);left:var(--ck-resizer-offset);cursor:nesw-resize}"},function(e,t,o){var n=o(1),i=o(83);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck-content .image.image_resized{max-width:100%;display:block;box-sizing:border-box}.ck-content .image.image_resized img{width:100%}.ck-content .image.image_resized>figcaption{display:block}[dir=ltr] .ck.ck-button.ck-button_with-text.ck-resize-image-button .ck-button__icon{margin-right:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-button.ck-button_with-text.ck-resize-image-button .ck-button__icon{margin-left:var(--ck-spacing-standard)}.ck.ck-dropdown .ck-button.ck-resize-image-button .ck-button__label{width:4em}"},function(e,t,o){var n=o(1),i=o(85);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck .ck-link_selected{background:var(--ck-color-link-selected-background)}.ck .ck-fake-link-selection{background:var(--ck-color-link-fake-selection)}.ck .ck-fake-link-selection_collapsed{height:100%;border-right:1px solid var(--ck-color-base-text);margin-right:-1px;outline:1px solid hsla(0,0%,100%,.5)}"},function(e,t,o){var n=o(1),i=o(87);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-link-form{display:flex}.ck.ck-link-form .ck-label{display:none}@media screen and (max-width:600px){.ck.ck-link-form{flex-wrap:wrap}.ck.ck-link-form .ck-labeled-field-view{flex-basis:100%}.ck.ck-link-form .ck-button{flex-basis:50%}}.ck.ck-link-form_layout-vertical{display:block}.ck.ck-link-form{padding:var(--ck-spacing-standard)}.ck.ck-link-form:focus{outline:none}[dir=ltr] .ck.ck-link-form>:not(:first-child),[dir=rtl] .ck.ck-link-form>:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-link-form{padding:0;width:calc(0.8*var(--ck-input-text-width))}.ck.ck-link-form .ck-labeled-field-view{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-link-form .ck-labeled-field-view .ck-input-text{min-width:0;width:100%}.ck.ck-link-form .ck-button{padding:var(--ck-spacing-standard);margin-top:var(--ck-spacing-standard);border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border)}[dir=ltr] .ck.ck-link-form .ck-button{margin-left:0}[dir=ltr] .ck.ck-link-form .ck-button:first-of-type{border-right:1px solid var(--ck-color-base-border)}[dir=rtl] .ck.ck-link-form .ck-button{margin-left:0}[dir=rtl] .ck.ck-link-form .ck-button:last-of-type{border-right:1px solid var(--ck-color-base-border)}}.ck.ck-link-form_layout-vertical{padding:0;min-width:var(--ck-input-text-width)}.ck.ck-link-form_layout-vertical .ck-labeled-field-view{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) var(--ck-spacing-small)}.ck.ck-link-form_layout-vertical .ck-labeled-field-view .ck-input-text{min-width:0;width:100%}.ck.ck-link-form_layout-vertical .ck-button{padding:var(--ck-spacing-standard);margin:0;border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border);width:50%}[dir=ltr] .ck.ck-link-form_layout-vertical .ck-button{margin-left:0}[dir=ltr] .ck.ck-link-form_layout-vertical .ck-button:first-of-type{border-right:1px solid var(--ck-color-base-border)}[dir=rtl] .ck.ck-link-form_layout-vertical .ck-button{margin-left:0}[dir=rtl] .ck.ck-link-form_layout-vertical .ck-button:last-of-type{border-right:1px solid var(--ck-color-base-border)}.ck.ck-link-form_layout-vertical .ck.ck-list{margin-left:0}.ck.ck-link-form_layout-vertical .ck.ck-list .ck-button.ck-switchbutton{border:0;width:100%}.ck.ck-link-form_layout-vertical .ck.ck-list .ck-button.ck-switchbutton:hover{background:none}"},function(e,t,o){var n=o(1),i=o(89);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-link-actions{display:flex;flex-direction:row;flex-wrap:nowrap}.ck.ck-link-actions .ck-link-actions__preview{display:inline-block}.ck.ck-link-actions .ck-link-actions__preview .ck-button__label{overflow:hidden}@media screen and (max-width:600px){.ck.ck-link-actions{flex-wrap:wrap}.ck.ck-link-actions .ck-link-actions__preview{flex-basis:100%}.ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){flex-basis:50%}}.ck.ck-link-actions{padding:var(--ck-spacing-standard)}.ck.ck-link-actions .ck-button.ck-link-actions__preview{padding-left:0;padding-right:0}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label{padding:0 var(--ck-spacing-medium);color:var(--ck-color-link-default);text-overflow:ellipsis;cursor:pointer;max-width:var(--ck-input-text-width);min-width:3em;text-align:center}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label:hover{text-decoration:underline}.ck.ck-link-actions .ck-button.ck-link-actions__preview,.ck.ck-link-actions .ck-button.ck-link-actions__preview:active,.ck.ck-link-actions .ck-button.ck-link-actions__preview:focus,.ck.ck-link-actions .ck-button.ck-link-actions__preview:hover{background:none}.ck.ck-link-actions .ck-button.ck-link-actions__preview:active{box-shadow:none}.ck.ck-link-actions .ck-button.ck-link-actions__preview:focus .ck-button__label{text-decoration:underline}.ck.ck-link-actions:focus{outline:none}[dir=ltr] .ck.ck-link-actions .ck-button:not(:first-child),[dir=rtl] .ck.ck-link-actions .ck-button:not(:last-child){margin-left:var(--ck-spacing-standard)}@media screen and (max-width:600px){.ck.ck-link-actions{padding:0;width:calc(0.8*var(--ck-input-text-width))}.ck.ck-link-actions .ck-button.ck-link-actions__preview{margin:var(--ck-spacing-standard) var(--ck-spacing-standard) 0}.ck.ck-link-actions .ck-button.ck-link-actions__preview .ck-button__label{min-width:0;max-width:100%}.ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){padding:var(--ck-spacing-standard);margin-top:var(--ck-spacing-standard);border-radius:0;border:0;border-top:1px solid var(--ck-color-base-border)}[dir=ltr] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){margin-left:0}[dir=ltr] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview):first-of-type{border-right:1px solid var(--ck-color-base-border)}[dir=rtl] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview){margin-left:0}[dir=rtl] .ck.ck-link-actions .ck-button:not(.ck-link-actions__preview):last-of-type{border-right:1px solid var(--ck-color-base-border)}}"},function(e,t,o){var n=o(1),i=o(91);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=':root{--ck-todo-list-checkmark-size:16px}.ck-content .todo-list{list-style:none}.ck-content .todo-list li{margin-bottom:5px}.ck-content .todo-list li .todo-list{margin-top:5px}.ck-content .todo-list .todo-list__label>input{-webkit-appearance:none;display:inline-block;position:relative;width:var(--ck-todo-list-checkmark-size);height:var(--ck-todo-list-checkmark-size);vertical-align:middle;border:0;left:-25px;margin-right:-15px;right:0;margin-left:0}.ck-content .todo-list .todo-list__label>input:before{display:block;position:absolute;box-sizing:border-box;content:"";width:100%;height:100%;border:1px solid #333;border-radius:2px;transition:box-shadow .25s ease-in-out,background .25s ease-in-out,border .25s ease-in-out}.ck-content .todo-list .todo-list__label>input:after{display:block;position:absolute;box-sizing:content-box;pointer-events:none;content:"";left:calc(var(--ck-todo-list-checkmark-size)/3);top:calc(var(--ck-todo-list-checkmark-size)/5.3);width:calc(var(--ck-todo-list-checkmark-size)/5.3);height:calc(var(--ck-todo-list-checkmark-size)/2.6);border-left:0 solid transparent;border-bottom:calc(var(--ck-todo-list-checkmark-size)/8) solid transparent;border-right:calc(var(--ck-todo-list-checkmark-size)/8) solid transparent;border-top:0 solid transparent;transform:rotate(45deg)}.ck-content .todo-list .todo-list__label>input[checked]:before{background:#26ab33;border-color:#26ab33}.ck-content .todo-list .todo-list__label>input[checked]:after{border-color:#fff}.ck-content .todo-list .todo-list__label .todo-list__label__description{vertical-align:middle}[dir=rtl] .todo-list .todo-list__label>input{left:0;margin-right:0;right:-25px;margin-left:-15px}.ck-editor__editable .todo-list .todo-list__label>input{cursor:pointer}.ck-editor__editable .todo-list .todo-list__label>input:hover:before{box-shadow:0 0 0 5px rgba(0,0,0,.1)}'},function(e,t,o){var n=o(1),i=o(93);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=":root{--ck-color-table-focused-cell-background:rgba(158,207,250,0.3)}.ck-widget.table td.ck-editor__nested-editable.ck-editor__nested-editable_focused,.ck-widget.table td.ck-editor__nested-editable:focus,.ck-widget.table th.ck-editor__nested-editable.ck-editor__nested-editable_focused,.ck-widget.table th.ck-editor__nested-editable:focus{background:var(--ck-color-table-focused-cell-background);border-style:none;outline:1px solid var(--ck-color-focus-border);outline-offset:-1px}"},function(e,t,o){var n=o(1),i=o(95);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck .ck-insert-table-dropdown__grid{display:flex;flex-direction:row;flex-wrap:wrap}:root{--ck-insert-table-dropdown-padding:10px;--ck-insert-table-dropdown-box-height:11px;--ck-insert-table-dropdown-box-width:12px;--ck-insert-table-dropdown-box-margin:1px}.ck .ck-insert-table-dropdown__grid{width:calc(var(--ck-insert-table-dropdown-box-width)*10 + var(--ck-insert-table-dropdown-box-margin)*20 + var(--ck-insert-table-dropdown-padding)*2);padding:var(--ck-insert-table-dropdown-padding) var(--ck-insert-table-dropdown-padding) 0}.ck .ck-insert-table-dropdown__label{text-align:center}.ck .ck-insert-table-dropdown-grid-box{width:var(--ck-insert-table-dropdown-box-width);height:var(--ck-insert-table-dropdown-box-height);margin:var(--ck-insert-table-dropdown-box-margin);border:1px solid var(--ck-color-base-border);border-radius:1px}.ck .ck-insert-table-dropdown-grid-box.ck-on{border-color:var(--ck-color-focus-border);background:var(--ck-color-focus-outer-shadow)}"},function(e,t,o){var n=o(1),i=o(97);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=':root{--ck-table-selected-cell-background:rgba(158,207,250,0.3)}.ck.ck-editor__editable .table table td.ck-editor__editable_selected,.ck.ck-editor__editable .table table th.ck-editor__editable_selected{position:relative;caret-color:transparent;outline:unset;box-shadow:unset}.ck.ck-editor__editable .table table td.ck-editor__editable_selected:after,.ck.ck-editor__editable .table table th.ck-editor__editable_selected:after{content:"";pointer-events:none;background-color:var(--ck-table-selected-cell-background);position:absolute;top:0;left:0;right:0;bottom:0}.ck.ck-editor__editable .table table td.ck-editor__editable_selected ::selection,.ck.ck-editor__editable .table table td.ck-editor__editable_selected:focus,.ck.ck-editor__editable .table table th.ck-editor__editable_selected ::selection,.ck.ck-editor__editable .table table th.ck-editor__editable_selected:focus{background-color:transparent}.ck.ck-editor__editable .table table td.ck-editor__editable_selected .ck-widget_selected,.ck.ck-editor__editable .table table th.ck-editor__editable_selected .ck-widget_selected{outline:unset}'},function(e,t,o){var n=o(1),i=o(99);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck-content .table{margin:1em auto;display:table}.ck-content .table table{border-collapse:collapse;border-spacing:0;width:100%;height:100%;border:1px double #b3b3b3}.ck-content .table table td,.ck-content .table table th{min-width:2em;padding:.4em;border:1px solid #bfbfbf}.ck-content .table table th{font-weight:700;background:hsla(0,0%,0%,5%)}.ck-content[dir=rtl] .table th{text-align:right}.ck-content[dir=ltr] .table th{text-align:left}"},function(e,t,o){var n=o(1),i=o(101);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-color-grid{display:grid}:root{--ck-color-grid-tile-size:24px;--ck-color-color-grid-check-icon:#000}.ck.ck-color-grid{grid-gap:5px;padding:8px}.ck.ck-color-grid__tile{width:var(--ck-color-grid-tile-size);height:var(--ck-color-grid-tile-size);min-width:var(--ck-color-grid-tile-size);min-height:var(--ck-color-grid-tile-size);padding:0;transition:box-shadow .2s ease;border:0}.ck.ck-color-grid__tile.ck-disabled{cursor:unset;transition:unset}.ck.ck-color-grid__tile.ck-color-table__color-tile_bordered{box-shadow:0 0 0 1px var(--ck-color-base-border)}.ck.ck-color-grid__tile .ck.ck-icon{display:none;color:var(--ck-color-color-grid-check-icon)}.ck.ck-color-grid__tile.ck-on{box-shadow:inset 0 0 0 1px var(--ck-color-base-background),0 0 0 2px var(--ck-color-base-text)}.ck.ck-color-grid__tile.ck-on .ck.ck-icon{display:block}.ck.ck-color-grid__tile.ck-on,.ck.ck-color-grid__tile:focus:not(.ck-disabled),.ck.ck-color-grid__tile:hover:not(.ck-disabled){border:0}.ck.ck-color-grid__tile:focus:not(.ck-disabled),.ck.ck-color-grid__tile:hover:not(.ck-disabled){box-shadow:inset 0 0 0 1px var(--ck-color-base-background),0 0 0 2px var(--ck-color-focus-border)}.ck.ck-color-grid__label{padding:0 var(--ck-spacing-standard)}"},function(e,t,o){var n=o(1),i=o(103);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-input-color{width:100%;display:flex}.ck.ck-input-color>input.ck.ck-input-text{min-width:auto;flex-grow:1}.ck.ck-input-color>input.ck.ck-input-text:active,.ck.ck-input-color>input.ck.ck-input-text:focus{z-index:var(--ck-z-default)}.ck.ck-input-color>div.ck.ck-dropdown{min-width:auto}.ck.ck-input-color>div.ck.ck-dropdown>.ck-input-color__button .ck-dropdown__arrow{display:none}.ck.ck-input-color .ck.ck-input-color__button .ck.ck-input-color__button__preview{position:relative;overflow:hidden}.ck.ck-input-color .ck.ck-input-color__button .ck.ck-input-color__button__preview>.ck.ck-input-color__button__preview__no-color-indicator{position:absolute;display:block}[dir=ltr] .ck.ck-input-color>.ck.ck-input-text{border-top-right-radius:0;border-bottom-right-radius:0}[dir=rtl] .ck.ck-input-color>.ck.ck-input-text{border-top-left-radius:0;border-bottom-left-radius:0}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button{padding:0}[dir=ltr] .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button{border-top-left-radius:0;border-bottom-left-radius:0;margin-left:-1px}[dir=rtl] .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button{border-top-right-radius:0;border-bottom-right-radius:0;margin-right:-1px}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button.ck-disabled{background:var(--ck-color-input-disabled-background)}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button>.ck.ck-input-color__button__preview{border-radius:0}.ck-rounded-corners .ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button>.ck.ck-input-color__button__preview,.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button>.ck.ck-input-color__button__preview.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button>.ck.ck-input-color__button__preview{width:20px;height:20px;border:1px solid var(--ck-color-input-border)}.ck.ck-input-color>.ck.ck-dropdown>.ck.ck-input-color__button>.ck.ck-input-color__button__preview>.ck.ck-input-color__button__preview__no-color-indicator{top:-30%;left:50%;height:150%;width:8%;background:red;border-radius:2px;transform:rotate(45deg);transform-origin:50%}.ck.ck-input-color .ck.ck-input-color__remove-color{width:100%;border-bottom:1px solid var(--ck-color-input-border);padding:calc(var(--ck-spacing-standard)/2) var(--ck-spacing-standard);border-bottom-left-radius:0;border-bottom-right-radius:0}[dir=ltr] .ck.ck-input-color .ck.ck-input-color__remove-color{border-top-right-radius:0}[dir=rtl] .ck.ck-input-color .ck.ck-input-color__remove-color{border-top-left-radius:0}.ck.ck-input-color .ck.ck-input-color__remove-color .ck.ck-icon{margin-right:var(--ck-spacing-standard)}[dir=rtl] .ck.ck-input-color .ck.ck-input-color__remove-color .ck.ck-icon{margin-right:0;margin-left:var(--ck-spacing-standard)}"},function(e,t,o){var n=o(1),i=o(105);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-form__row{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between}.ck.ck-form__row>:not(.ck-label){flex-grow:1}.ck.ck-form__row.ck-table-form__action-row .ck-button-cancel,.ck.ck-form__row.ck-table-form__action-row .ck-button-save{justify-content:center}.ck.ck-form__row{padding:var(--ck-spacing-standard) var(--ck-spacing-large) 0}[dir=ltr] .ck.ck-form__row>:not(.ck-label)+*{margin-left:var(--ck-spacing-large)}[dir=rtl] .ck.ck-form__row>:not(.ck-label)+*{margin-right:var(--ck-spacing-large)}.ck.ck-form__row>.ck-label{width:100%;min-width:100%}.ck.ck-form__row.ck-table-form__action-row{margin-top:var(--ck-spacing-large)}.ck.ck-form__row.ck-table-form__action-row .ck-button .ck-button__label{color:var(--ck-color-text)}"},function(e,t,o){var n=o(1),i=o(107);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-form__header{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:center;justify-content:space-between}:root{--ck-form-header-height:38px}.ck.ck-form__header{padding:var(--ck-spacing-small) var(--ck-spacing-large);height:var(--ck-form-header-height);line-height:var(--ck-form-header-height);border-bottom:1px solid var(--ck-color-base-border)}.ck.ck-form__header .ck-form__header__label{font-weight:700}"},function(e,t){e.exports=".ck.ck-form{padding:0 0 var(--ck-spacing-large)}.ck.ck-form:focus{outline:none}.ck.ck-form .ck.ck-input-text{min-width:100%;width:0}.ck.ck-form .ck.ck-dropdown{min-width:100%}.ck.ck-form .ck.ck-dropdown .ck-dropdown__button:not(:focus){border:1px solid var(--ck-color-base-border)}.ck.ck-form .ck.ck-dropdown .ck-dropdown__button .ck-button__label{width:100%}"},function(e,t){e.exports='.ck.ck-table-form .ck-form__row.ck-table-form__border-row{flex-wrap:wrap}.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-labeled-field-view{display:flex;flex-direction:column-reverse}.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-labeled-field-view .ck.ck-dropdown,.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-table-form__border-style,.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-table-form__border-width{flex-grow:0}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row{flex-wrap:wrap;align-items:center}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-labeled-field-view{display:flex;flex-direction:column-reverse;align-items:center}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-labeled-field-view .ck.ck-dropdown,.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimension-operator{flex-grow:0}.ck.ck-table-form .ck.ck-labeled-field-view{position:relative}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{position:absolute;left:50%;bottom:calc(-1*var(--ck-table-properties-error-arrow-size));transform:translate(-50%,100%);z-index:1}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status:after{content:"";position:absolute;top:calc(-1*var(--ck-table-properties-error-arrow-size));left:50%;transform:translateX(-50%)}:root{--ck-table-properties-error-arrow-size:6px;--ck-table-properties-min-error-width:150px}.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-labeled-field-view>.ck-label{font-size:var(--ck-font-size-tiny);text-align:center}.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-table-form__border-style{width:80px;min-width:80px}.ck.ck-table-form .ck-form__row.ck-table-form__border-row .ck-table-form__border-width{width:50px;min-width:50px}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row{padding:0}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-labeled-field-view>.ck-label{font-size:10px;text-align:center}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimensions-row__height,.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimensions-row__width{margin:0}.ck.ck-table-form .ck-form__row.ck-table-form__dimensions-row .ck-table-form__dimension-operator{align-self:start;display:inline-block;height:var(--ck-ui-component-min-height);line-height:var(--ck-ui-component-min-height);margin:0 var(--ck-spacing-small)}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{border-radius:0}.ck-rounded-corners .ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status,.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status.ck-rounded-corners{border-radius:var(--ck-border-radius)}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{background:var(--ck-color-base-error);color:var(--ck-color-base-background);padding:var(--ck-spacing-small) var(--ck-spacing-medium);min-width:var(--ck-table-properties-min-error-width);text-align:center}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status:after{border-left:var(--ck-table-properties-error-arrow-size) solid transparent;border-bottom:var(--ck-table-properties-error-arrow-size) solid var(--ck-color-base-error);border-right:var(--ck-table-properties-error-arrow-size) solid transparent;border-top:0 solid transparent}.ck.ck-table-form .ck.ck-labeled-field-view .ck.ck-labeled-field-view__status{animation:ck-table-form-labeled-view-status-appear .15s ease both}.ck.ck-table-form .ck.ck-labeled-field-view .ck-input.ck-error:not(:focus)+.ck.ck-labeled-field-view__status{display:none}@keyframes ck-table-form-labeled-view-status-appear{0%{opacity:0}to{opacity:1}}'},function(e,t,o){var n=o(1),i=o(111);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row{flex-wrap:wrap;flex-basis:0;align-content:baseline}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar .ck-toolbar__items{flex-wrap:nowrap}.ck.ck-table-properties-form{width:320px}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row{padding:0}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar{background:none}.ck.ck-table-properties-form .ck-form__row.ck-table-properties-form__alignment-row .ck.ck-toolbar .ck-toolbar__items>*{width:40px}"},function(e,t,o){var n=o(1),i=o(113);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row{flex-wrap:wrap}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row .ck.ck-toolbar{flex-grow:0}.ck.ck-table-cell-properties-form{width:320px}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__padding-row{padding:0;width:35%}.ck.ck-table-cell-properties-form .ck-form__row.ck-table-cell-properties-form__alignment-row .ck.ck-toolbar{background:none}"},function(e,t,o){var n=o(1),i=o(115);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck.ck-block-toolbar-button{position:absolute;z-index:var(--ck-z-default)}:root{--ck-color-block-toolbar-button:var(--ck-color-text);--ck-block-toolbar-button-size:var(--ck-font-size-normal)}.ck.ck-block-toolbar-button{color:var(--ck-color-block-toolbar-button);font-size:var(--ck-block-toolbar-size)}"},function(e,t,o){var n=o(1),i=o(117);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck .ck-button.ck-color-table__remove-color{display:flex;align-items:center;width:100%}label.ck.ck-color-grid__label{font-weight:unset}.ck .ck-button.ck-color-table__remove-color{padding:calc(var(--ck-spacing-standard)/2) var(--ck-spacing-standard);border-bottom-left-radius:0;border-bottom-right-radius:0}.ck .ck-button.ck-color-table__remove-color:not(:focus){border-bottom:1px solid var(--ck-color-base-border)}[dir=ltr] .ck .ck-button.ck-color-table__remove-color .ck.ck-icon{margin-right:var(--ck-spacing-standard)}[dir=rtl] .ck .ck-button.ck-color-table__remove-color .ck.ck-icon{margin-left:var(--ck-spacing-standard)}"},function(e,t,o){var n=o(1),i=o(119);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck-content .text-tiny{font-size:.7em}.ck-content .text-small{font-size:.85em}.ck-content .text-big{font-size:1.4em}.ck-content .text-huge{font-size:1.8em}"},function(e,t,o){var n=o(1),i=o(121);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck-content pre{padding:1em;color:#353535;background:hsla(0,0%,78%,.3);border:1px solid #c4c4c4;border-radius:2px;text-align:left;direction:ltr;tab-size:4;white-space:pre-wrap;font-style:normal;min-width:200px}.ck-content pre code{background:unset;padding:0;border-radius:0}.ck.ck-editor__editable pre{position:relative}.ck.ck-editor__editable pre[data-language]:after{content:attr(data-language);position:absolute}:root{--ck-color-code-block-label-background:#757575}.ck.ck-editor__editable pre[data-language]:after{top:-1px;right:10px;background:var(--ck-color-code-block-label-background);font-size:10px;font-family:var(--ck-font-face);line-height:16px;padding:var(--ck-spacing-tiny) var(--ck-spacing-medium);color:#fff;white-space:nowrap}.ck.ck-code-block-dropdown .ck-dropdown__panel{max-height:250px;overflow-y:auto;overflow-x:hidden}"},function(e,t,o){var n=o(1),i=o(123);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=":root{--ck-mention-list-max-height:300px}.ck.ck-mentions{max-height:var(--ck-mention-list-max-height);overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain}.ck.ck-mentions>.ck-list__item{overflow:hidden;flex-shrink:0}"},function(e,t,o){var n=o(1),i=o(125);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=":root{--ck-color-mention-background:rgba(153,0,48,0.1);--ck-color-mention-text:#990030}.ck-content .mention{background:var(--ck-color-mention-background);color:var(--ck-color-mention-text)}"},function(e,t,o){var n=o(1),i=o(127);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[e.i,i,""]]);var r={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};n(i,r);e.exports=i.locals||{}},function(e,t){e.exports=".ck-editor__editable .ck-horizontal-line{display:flow-root}.ck-content hr{margin:15px 0;height:4px;background:#dedede;border:0}"},function(e,t,o){"use strict";o.r(t),o.d(t,"default",(function(){return mv}));var n=o(3),i=n.a.Symbol,r=Object.prototype,s=r.hasOwnProperty,a=r.toString,l=i?i.toStringTag:void 0;var c=function(e){var t=s.call(e,l),o=e[l];try{e[l]=void 0;var n=!0}catch(e){}var i=a.call(e);return n&&(t?e[l]=o:delete e[l]),i},d=Object.prototype.toString;var h=function(e){return d.call(e)},u=i?i.toStringTag:void 0;var m=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":u&&u in Object(e)?c(e):h(e)};var g=function(e,t){return function(o){return e(t(o))}},f=g(Object.getPrototypeOf,Object);var p=function(e){return null!=e&&"object"==typeof e},b=Function.prototype,w=Object.prototype,k=b.toString,_=w.hasOwnProperty,v=k.call(Object);var y=function(e){if(!p(e)||"[object Object]"!=m(e))return!1;var t=f(e);if(null===t)return!0;var o=_.call(t,"constructor")&&t.constructor;return"function"==typeof o&&o instanceof o&&k.call(o)==v};var x=function(){this.__data__=[],this.size=0};var C=function(e,t){return e===t||e!=e&&t!=t};var A=function(e,t){for(var o=e.length;o--;)if(C(e[o][0],t))return o;return-1},T=Array.prototype.splice;var P=function(e){var t=this.__data__,o=A(t,e);return!(o<0)&&(o==t.length-1?t.pop():T.call(t,o,1),--this.size,!0)};var S=function(e){var t=this.__data__,o=A(t,e);return o<0?void 0:t[o][1]};var E=function(e){return A(this.__data__,e)>-1};var R=function(e,t){var o=this.__data__,n=A(o,e);return n<0?(++this.size,o.push([e,t])):o[n][1]=t,this};function I(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991},He={};He["[object Float32Array]"]=He["[object Float64Array]"]=He["[object Int8Array]"]=He["[object Int16Array]"]=He["[object Int32Array]"]=He["[object Uint8Array]"]=He["[object Uint8ClampedArray]"]=He["[object Uint16Array]"]=He["[object Uint32Array]"]=!0,He["[object Arguments]"]=He["[object Array]"]=He["[object ArrayBuffer]"]=He["[object Boolean]"]=He["[object DataView]"]=He["[object Date]"]=He["[object Error]"]=He["[object Function]"]=He["[object Map]"]=He["[object Number]"]=He["[object Object]"]=He["[object RegExp]"]=He["[object Set]"]=He["[object String]"]=He["[object WeakMap]"]=!1;var je=function(e){return p(e)&&Le(e.length)&&!!He[m(e)]};var We=function(e){return function(t){return e(t)}},qe=o(5),$e=qe.a&&qe.a.isTypedArray,Ue=$e?We($e):je,Ge=Object.prototype.hasOwnProperty;var Ke=function(e,t){var o=ze(e),n=!o&&Ne(e),i=!o&&!n&&Object(Be.a)(e),r=!o&&!n&&!i&&Ue(e),s=o||n||i||r,a=s?Re(e.length,String):[],l=a.length;for(var c in e)!t&&!Ge.call(e,c)||s&&("length"==c||i&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||De(c,l))||a.push(c);return a},Je=Object.prototype;var Ye=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Je)},Qe=g(Object.keys,Object),Xe=Object.prototype.hasOwnProperty;var Ze=function(e){if(!Ye(e))return Qe(e);var t=[];for(var o in Object(e))Xe.call(e,o)&&"constructor"!=o&&t.push(o);return t};var et=function(e){return null!=e&&Le(e.length)&&!D(e)};var tt=function(e){return et(e)?Ke(e):Ze(e)};var ot=function(e,t){return e&&Ee(t,tt(t),e)};var nt=function(e){var t=[];if(null!=e)for(var o in Object(e))t.push(o);return t},it=Object.prototype.hasOwnProperty;var rt=function(e){if(!B(e))return nt(e);var t=Ye(e),o=[];for(var n in e)("constructor"!=n||!t&&it.call(e,n))&&o.push(n);return o};var st=function(e){return et(e)?Ke(e,!0):rt(e)};var at=function(e,t){return e&&Ee(t,st(t),e)},lt=o(8);var ct=function(e,t){var o=-1,n=e.length;for(t||(t=Array(n));++o{this._setToTarget(e,n,t[n],o)})}}function ro(e){return oo(e,so)}function so(e){return no(e)?e:void 0}var ao=function(){return function e(){e.called=!0}};class lo{constructor(e,t){this.source=e,this.name=t,this.path=[],this.stop=ao(),this.off=ao()}}const co=new Array(256).fill().map((e,t)=>("0"+t.toString(16)).slice(-2));function ho(){const e=4294967296*Math.random()>>>0,t=4294967296*Math.random()>>>0,o=4294967296*Math.random()>>>0,n=4294967296*Math.random()>>>0;return"e"+co[e>>0&255]+co[e>>8&255]+co[e>>16&255]+co[e>>24&255]+co[t>>0&255]+co[t>>8&255]+co[t>>16&255]+co[t>>24&255]+co[o>>0&255]+co[o>>8&255]+co[o>>16&255]+co[o>>24&255]+co[n>>0&255]+co[n>>8&255]+co[n>>16&255]+co[n>>24&255]}var uo={get(e){return"number"!=typeof e?this[e]||this.normal:e},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5},mo=(o(6),o(0));const go=Symbol("listeningTo"),fo=Symbol("emitterId");var po={on(e,t,o={}){this.listenTo(this,e,t,o)},once(e,t,o){let n=!1;this.listenTo(this,e,(function(e,...o){n||(n=!0,e.off(),t.call(this,e,...o))}),o)},off(e,t){this.stopListening(this,e,t)},listenTo(e,t,o,n={}){let i,r;this[go]||(this[go]={});const s=this[go];wo(e)||bo(e);const a=wo(e);(i=s[a])||(i=s[a]={emitter:e,callbacks:{}}),(r=i.callbacks[t])||(r=i.callbacks[t]=[]),r.push(o),function(e,t){const o=ko(e);if(o[t])return;let n=t,i=null;const r=[];for(;""!==n&&!o[n];)o[n]={callbacks:[],childEvents:[]},r.push(o[n]),i&&o[n].childEvents.push(i),i=n,n=n.substr(0,n.lastIndexOf(":"));if(""!==n){for(const e of r)e.callbacks=o[n].callbacks.slice();o[n].childEvents.push(i)}}(e,t);const l=_o(e,t),c=uo.get(n.priority),d={callback:o,priority:c};for(const e of l){let t=!1;for(let o=0;o-1?e(t,o.substr(0,o.lastIndexOf(":"))):null;return n.callbacks}(this,n);if(o.path.push(this),i){const e=[o,...t];i=Array.from(i);for(let t=0;t{this._delegations||(this._delegations=new Map),e.forEach(e=>{const n=this._delegations.get(e);n?n.set(t,o):this._delegations.set(e,new Map([[t,o]]))})}}},stopDelegating(e,t){if(this._delegations)if(e)if(t){const o=this._delegations.get(e);o&&o.delete(t)}else this._delegations.delete(e);else this._delegations.clear()}};function bo(e,t){e[fo]||(e[fo]=t||ho())}function wo(e){return e[fo]}function ko(e){return e._events||Object.defineProperty(e,"_events",{value:{}}),e._events}function _o(e,t){const o=ko(e)[t];if(!o)return[];let n=[o.callbacks];for(let t=0;t{Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t)).forEach(o=>{if(o in e.prototype)return;const n=Object.getOwnPropertyDescriptor(t,o);n.enumerable=!1,Object.defineProperty(e.prototype,o,n)})})}class Ao{constructor(e={},t={}){const o=xo(e);if(o||(t=e),this._items=[],this._itemMap=new Map,this._idProperty=t.idProperty||"id",this._bindToExternalToInternalMap=new WeakMap,this._bindToInternalToExternalMap=new WeakMap,this._skippedIndexesFromExternal=[],o)for(const t of e)this._items.push(t),this._itemMap.set(this._getItemIdBeforeAdding(t),t)}get length(){return this._items.length}get first(){return this._items[0]||null}get last(){return this._items[this.length-1]||null}add(e,t){return this.addMany([e],t)}addMany(e,t){if(void 0===t)t=this._items.length;else if(t>this._items.length||t<0)throw new mo.b("collection-add-item-invalid-index: The index passed to Collection#addMany() is invalid.",this);for(let o=0;o{this._setUpBindToBinding(t=>new e(t))},using:e=>{"function"==typeof e?this._setUpBindToBinding(t=>e(t)):this._setUpBindToBinding(t=>t[e])}}}_setUpBindToBinding(e){const t=this._bindToCollection,o=(o,n,i)=>{const r=t._bindToCollection==this,s=t._bindToInternalToExternalMap.get(n);if(r&&s)this._bindToExternalToInternalMap.set(n,s),this._bindToInternalToExternalMap.set(s,n);else{const o=e(n);if(!o)return void this._skippedIndexesFromExternal.push(i);let r=i;for(const e of this._skippedIndexesFromExternal)i>e&&r--;for(const e of t._skippedIndexesFromExternal)r>=e&&r++;this._bindToExternalToInternalMap.set(n,o),this._bindToInternalToExternalMap.set(o,n),this.add(o,r);for(let e=0;e{const n=this._bindToExternalToInternalMap.get(t);n&&this.remove(n),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce((e,t)=>(ot&&e.push(t),e),[])})}_getItemIdBeforeAdding(e){const t=this._idProperty;let o;if(t in e){if(o=e[t],"string"!=typeof o)throw new mo.b("collection-add-invalid-id: This item's id should be a string.",this);if(this.get(o))throw new mo.b("collection-add-item-already-exists: This item already exists in the collection.",this)}else e[t]=o=ho();return o}_remove(e){let t,o,n,i=!1;const r=this._idProperty;if("string"==typeof e?(o=e,n=this._itemMap.get(o),i=!n,n&&(t=this._items.indexOf(n))):"number"==typeof e?(t=e,n=this._items[t],i=!n,n&&(o=n[r])):(n=e,o=n[r],t=this._items.indexOf(n),i=-1==t||!this._itemMap.get(o)),i)throw new mo.b("collection-remove-404: Item not found.",this);this._items.splice(t,1),this._itemMap.delete(o);const s=this._bindToInternalToExternalMap.get(n);return this._bindToInternalToExternalMap.delete(n),this._bindToExternalToInternalMap.delete(s),this.fire("remove",n,t),[n,t]}[Symbol.iterator](){return this._items[Symbol.iterator]()}}Co(Ao,po);class To{constructor(e,t=[],o=[]){this._context=e,this._plugins=new Map,this._availablePlugins=new Map;for(const e of t)e.pluginName&&this._availablePlugins.set(e.pluginName,e);this._contextPlugins=new Map;for(const[e,t]of o)this._contextPlugins.set(e,t),this._contextPlugins.set(t,e),e.pluginName&&this._availablePlugins.set(e.pluginName,e)}*[Symbol.iterator](){for(const e of this._plugins)"function"==typeof e[0]&&(yield e)}get(e){const t=this._plugins.get(e);if(!t){const t="plugincollection-plugin-not-loaded: The requested plugin is not loaded.";let o=e;throw"function"==typeof e&&(o=e.pluginName||e.name),new mo.b(t,this._context,{plugin:o})}return t}has(e){return this._plugins.has(e)}init(e,t=[]){const o=this,n=this._context,i=new Set,r=[],s=u(e),a=u(t),l=function(e){const t=[];for(const o of e)h(o)||t.push(o);return t.length?t:null}(e);if(l){const e="plugincollection-plugin-not-found: Some plugins are not available and could not be loaded.";return console.error(Object(mo.a)(e),{plugins:l}),Promise.reject(new mo.b(e,n,{plugins:l}))}return Promise.all(s.map(c)).then(()=>d(r,"init")).then(()=>d(r,"afterInit")).then(()=>r);function c(e){if(!a.includes(e)&&!o._plugins.has(e)&&!i.has(e))return function(e){return new Promise(s=>{i.add(e),e.requires&&e.requires.forEach(o=>{const i=h(o);if(e.isContextPlugin&&!i.isContextPlugin)throw new mo.b("plugincollection-context-required: Context plugin can not require plugin which is not a context plugin",null,{plugin:i.name,requiredBy:e.name});if(t.includes(i))throw new mo.b("plugincollection-required: Cannot load a plugin because one of its dependencies is listed inthe `removePlugins` option.",n,{plugin:i.name,requiredBy:e.name});c(i)});const a=o._contextPlugins.get(e)||new e(n);o._add(e,a),r.push(a),s()})}(e).catch(t=>{throw console.error(Object(mo.a)("plugincollection-load: It was not possible to load the plugin."),{plugin:e}),t})}function d(e,t){return e.reduce((e,n)=>n[t]?o._contextPlugins.has(n)?e:e.then(n[t].bind(n)):e,Promise.resolve())}function h(e){return"function"==typeof e?e:o._availablePlugins.get(e)}function u(e){return e.map(e=>h(e)).filter(e=>!!e)}}destroy(){const e=[];for(const[,t]of this)"function"!=typeof t.destroy||this._contextPlugins.has(t)||e.push(t.destroy());return Promise.all(e)}_add(e,t){this._plugins.set(e,t);const o=e.pluginName;if(o){if(this._plugins.has(o))throw new mo.b("plugincollection-plugin-name-conflict: Two plugins with the same name were loaded.",null,{pluginName:o,plugin1:this._plugins.get(o).constructor,plugin2:e});this._plugins.set(o,t)}}}function Po(e,t,o=1){if("number"!=typeof o)throw new mo.b("translation-service-quantity-not-a-number: Expecting `quantity` to be a number.",null,{quantity:o});const n=Object.keys(window.CKEDITOR_TRANSLATIONS).length;1===n&&(e=Object.keys(window.CKEDITOR_TRANSLATIONS)[0]);const i=t.id||t.string;if(0===n||!function(e,t){return!!window.CKEDITOR_TRANSLATIONS[e]&&!!window.CKEDITOR_TRANSLATIONS[e].dictionary[t]}(e,i))return 1!==o?t.plural:t.string;const r=window.CKEDITOR_TRANSLATIONS[e].dictionary,s=window.CKEDITOR_TRANSLATIONS[e].getPluralForm||(e=>1===e?0:1);if("string"==typeof r[i])return r[i];const a=Number(s(o));return r[i][a]}Co(To,po),window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={});const So=["ar","fa","he","ku","ug"];class Eo{constructor(e={}){this.uiLanguage=e.uiLanguage||"en",this.contentLanguage=e.contentLanguage||this.uiLanguage,this.uiLanguageDirection=Ro(this.uiLanguage),this.contentLanguageDirection=Ro(this.contentLanguage),this.t=(e,t)=>this._t(e,t)}get language(){return console.warn("locale-deprecated-language-property: The Locale#language property has been deprecated and will be removed in the near future. Please use #uiLanguage and #contentLanguage properties instead."),this.uiLanguage}_t(e,t=[]){Array.isArray(t)||(t=[t]),"string"==typeof e&&(e={string:e});const o=!!e.plural?t[0]:1;return function(e,t){return e.replace(/%(\d+)/g,(e,o)=>oe.destroy())).then(()=>this.plugins.destroy())}_addEditor(e,t){if(this._contextOwner)throw new mo.b("context-addEditor-private-context: Cannot add multiple editors to the context which is created by the editor.");this.editors.add(e),t&&(this._contextOwner=e)}_removeEditor(e){return this.editors.has(e)&&this.editors.remove(e),this._contextOwner===e?this.destroy():Promise.resolve()}_getEditorConfig(){const e={};for(const t of this.config.names())["plugins","removePlugins","extraPlugins"].includes(t)||(e[t]=this.config.get(t));return e}static create(e){return new Promise(t=>{const o=new this(e);t(o.initPlugins().then(()=>o))})}}function Vo(e,t){const o=Math.min(e.length,t.length);for(let n=0;ne.data.length)throw new mo.b("view-textproxy-wrong-offsetintext: Given offsetInText value is incorrect.",this);if(o<0||t+o>e.data.length)throw new mo.b("view-textproxy-wrong-length: Given length value is incorrect.",this);this.data=e.data.substring(t,t+o),this.offsetInText=t}get offsetSize(){return this.data.length}get isPartial(){return this.data.length!==this.textNode.data.length}get parent(){return this.textNode.parent}get root(){return this.textNode.root}get document(){return this.textNode.document}is(e){return"$textProxy"===e||"view:$textProxy"===e||"textProxy"===e||"view:textProxy"===e}getAncestors(e={includeSelf:!1,parentFirst:!1}){const t=[];let o=e.includeSelf?this.textNode:this.parent;for(;null!==o;)t[e.parentFirst?"push":"unshift"](o),o=o.parent;return t}}function Bo(e){return xo(e)?new Map(e):function(e){const t=new Map;for(const o in e)t.set(o,e[o]);return t}(e)}class Fo{constructor(...e){this._patterns=[],this.add(...e)}add(...e){for(let t of e)("string"==typeof t||t instanceof RegExp)&&(t={name:t}),t.classes&&("string"==typeof t.classes||t.classes instanceof RegExp)&&(t.classes=[t.classes]),this._patterns.push(t)}match(...e){for(const t of e)for(const e of this._patterns){const o=Do(t,e);if(o)return{element:t,pattern:e,match:o}}return null}matchAll(...e){const t=[];for(const o of e)for(const e of this._patterns){const n=Do(o,e);n&&t.push({element:o,pattern:e,match:n})}return t.length>0?t:null}getElementName(){if(1!==this._patterns.length)return null;const e=this._patterns[0],t=e.name;return"function"==typeof e||!t||t instanceof RegExp?null:t}}function Do(e,t){if("function"==typeof t)return t(e);const o={};return t.name&&(o.name=function(e,t){if(e instanceof RegExp)return e.test(t);return e===t}(t.name,e.name),!o.name)||t.attributes&&(o.attributes=function(e,t){const o=[];for(const n in e){const i=e[n];if(!t.hasAttribute(n))return null;{const e=t.getAttribute(n);if(!0===i)o.push(n);else if(i instanceof RegExp){if(!i.test(e))return null;o.push(n)}else{if(e!==i)return null;o.push(n)}}}return o}(t.attributes,e),!o.attributes)?null:!(t.classes&&(o.classes=function(e,t){const o=[];for(const n of e)if(n instanceof RegExp){const e=t.getClassNames();for(const t of e)n.test(t)&&o.push(t);if(0===o.length)return null}else{if(!t.hasClass(n))return null;o.push(n)}return o}(t.classes,e),!o.classes))&&(!(t.styles&&(o.styles=function(e,t){const o=[];for(const n in e){const i=e[n];if(!t.hasStyle(n))return null;{const e=t.getStyle(n);if(i instanceof RegExp){if(!i.test(e))return null;o.push(n)}else{if(e!==i)return null;o.push(n)}}}return o}(t.styles,e),!o.styles))&&o)}var Lo=function(e){return"symbol"==typeof e||p(e)&&"[object Symbol]"==m(e)},Ho=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,jo=/^\w*$/;var Wo=function(e,t){if(ze(e))return!1;var o=typeof e;return!("number"!=o&&"symbol"!=o&&"boolean"!=o&&null!=e&&!Lo(e))||(jo.test(e)||!Ho.test(e)||null!=t&&e in Object(t))};function qo(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var o=function(){var n=arguments,i=t?t.apply(this,n):n[0],r=o.cache;if(r.has(i))return r.get(i);var s=e.apply(this,n);return o.cache=r.set(i,s)||r,s};return o.cache=new(qo.Cache||_e),o}qo.Cache=_e;var $o=qo;var Uo=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Go=/\\(\\)?/g,Ko=function(e){var t=$o(e,(function(e){return 500===o.size&&o.clear(),e})),o=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Uo,(function(e,o,n,i){t.push(n?i.replace(Go,"$1"):o||e)})),t}));var Jo=function(e,t){for(var o=-1,n=null==e?0:e.length,i=Array(n);++oi?0:i+t),(o=o>i?i:o)<0&&(o+=i),i=t>o?0:o-t>>>0,t>>>=0;for(var r=Array(i);++n0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(yn);var An=function(e,t){return Cn(_n(e,t,bn),e+"")};var Tn=function(e,t,o){if(!B(o))return!1;var n=typeof t;return!!("number"==n?et(o)&&De(t,o.length):"string"==n&&t in o)&&C(o[t],e)};var Pn=function(e){return An((function(t,o){var n=-1,i=o.length,r=i>1?o[i-1]:void 0,s=i>2?o[2]:void 0;for(r=e.length>3&&"function"==typeof r?(i--,r):void 0,s&&Tn(o[0],o[1],s)&&(r=i<3?void 0:r,i=1),t=Object(t);++nt===e);return Array.isArray(t)}set(e,t){if(B(e))for(const[t,o]of Object.entries(e))this._styleProcessor.toNormalizedForm(t,o,this._styles);else this._styleProcessor.toNormalizedForm(e,t,this._styles)}remove(e){const t=On(e);ln(this._styles,t),delete this._styles[e],this._cleanEmptyObjectsOnPath(t)}getNormalized(e){return this._styleProcessor.getNormalized(e,this._styles)}toString(){return this.isEmpty?"":this._getStylesEntries().map(e=>e.join(":")).sort().join(";")+";"}getAsString(e){if(this.isEmpty)return;if(this._styles[e]&&!B(this._styles[e]))return this._styles[e];const t=this._styleProcessor.getReducedForm(e,this._styles).find(([t])=>t===e);return Array.isArray(t)?t[1]:void 0}getStyleNames(){if(this.isEmpty)return[];return this._getStylesEntries().map(([e])=>e)}clear(){this._styles={}}_getStylesEntries(){const e=[],t=Object.keys(this._styles);for(const o of t)e.push(...this._styleProcessor.getReducedForm(o,this._styles));return e}_cleanEmptyObjectsOnPath(e){const t=e.split(".");if(!(t.length>1))return;const o=t.splice(0,t.length-1).join("."),n=cn(this._styles,o);if(!n)return;!Array.from(Object.keys(n)).length&&this.remove(o)}}class Vn{constructor(){this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(e,t,o){if(B(t))Mn(o,On(e),t);else if(this._normalizers.has(e)){const n=this._normalizers.get(e),{path:i,value:r}=n(t);Mn(o,i,r)}else Mn(o,e,t)}getNormalized(e,t){if(!e)return Sn({},t);if(void 0!==t[e])return t[e];if(this._extractors.has(e)){const o=this._extractors.get(e);if("string"==typeof o)return cn(t,o);const n=o(e,t);if(n)return n}return cn(t,On(e))}getReducedForm(e,t){const o=this.getNormalized(e,t);if(void 0===o)return[];if(this._reducers.has(e)){return this._reducers.get(e)(o)}return[[e,o]]}getRelatedStyles(e){return this._consumables.get(e)||[]}setNormalizer(e,t){this._normalizers.set(e,t)}setExtractor(e,t){this._extractors.set(e,t)}setReducer(e,t){this._reducers.set(e,t)}setStyleRelation(e,t){this._mapStyleNames(e,t);for(const o of t)this._mapStyleNames(o,[e])}_mapStyleNames(e,t){this._consumables.has(e)||this._consumables.set(e,[]),this._consumables.get(e).push(...t)}}function On(e){return e.replace("-",".")}function Mn(e,t,o){let n=o;B(o)&&(n=Sn({},cn(e,t),o)),Rn(e,t,n)}class Nn extends Mo{constructor(e,t,o,n){if(super(e),this.name=t,this._attrs=function(e){e=Bo(e);for(const[t,o]of e)null===o?e.delete(t):"string"!=typeof o&&e.set(t,String(o));return e}(o),this._children=[],n&&this._insertChild(0,n),this._classes=new Set,this._attrs.has("class")){const e=this._attrs.get("class");zn(this._classes,e),this._attrs.delete("class")}this._styles=new In(this.document.stylesProcessor),this._attrs.has("style")&&(this._styles.setTo(this._attrs.get("style")),this._attrs.delete("style")),this._customProperties=new Map}get childCount(){return this._children.length}get isEmpty(){return 0===this._children.length}is(e,t=null){return t?t===this.name&&("element"===e||"view:element"===e):"element"===e||"view:element"===e||"node"===e||"view:node"===e}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}*getAttributeKeys(){this._classes.size>0&&(yield"class"),this._styles.isEmpty||(yield"style"),yield*this._attrs.keys()}*getAttributes(){yield*this._attrs.entries(),this._classes.size>0&&(yield["class",this.getAttribute("class")]),this._styles.isEmpty||(yield["style",this.getAttribute("style")])}getAttribute(e){if("class"==e)return this._classes.size>0?[...this._classes].join(" "):void 0;if("style"==e){const e=this._styles.toString();return""==e?void 0:e}return this._attrs.get(e)}hasAttribute(e){return"class"==e?this._classes.size>0:"style"==e?!this._styles.isEmpty:this._attrs.has(e)}isSimilar(e){if(!(e instanceof Nn))return!1;if(this===e)return!0;if(this.name!=e.name)return!1;if(this._attrs.size!==e._attrs.size||this._classes.size!==e._classes.size||this._styles.size!==e._styles.size)return!1;for(const[t,o]of this._attrs)if(!e._attrs.has(t)||e._attrs.get(t)!==o)return!1;for(const t of this._classes)if(!e._classes.has(t))return!1;for(const t of this._styles.getStyleNames())if(!e._styles.has(t)||e._styles.getAsString(t)!==this._styles.getAsString(t))return!1;return!0}hasClass(...e){for(const t of e)if(!this._classes.has(t))return!1;return!0}getClassNames(){return this._classes.keys()}getStyle(e){return this._styles.getAsString(e)}getNormalizedStyle(e){return this._styles.getNormalized(e)}getStyleNames(){return this._styles.getStyleNames()}hasStyle(...e){for(const t of e)if(!this._styles.has(t))return!1;return!0}findAncestor(...e){const t=new Fo(...e);let o=this.parent;for(;o;){if(t.match(o))return o;o=o.parent}return null}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}getIdentity(){const e=Array.from(this._classes).sort().join(","),t=this._styles.toString(),o=Array.from(this._attrs).map(e=>`${e[0]}="${e[1]}"`).sort().join(" ");return this.name+(""==e?"":` class="${e}"`)+(t?` style="${t}"`:"")+(""==o?"":" "+o)}_clone(e=!1){const t=[];if(e)for(const o of this.getChildren())t.push(o._clone(e));const o=new this.constructor(this.document,this.name,this._attrs,t);return o._classes=new Set(this._classes),o._styles.set(this._styles.getNormalized()),o._customProperties=new Map(this._customProperties),o.getFillerOffset=this.getFillerOffset,o}_appendChild(e){return this._insertChild(this.childCount,e)}_insertChild(e,t){this._fireChange("children",this);let o=0;const n=function(e,t){if("string"==typeof t)return[new No(e,t)];xo(t)||(t=[t]);return Array.from(t).map(t=>"string"==typeof t?new No(e,t):t instanceof zo?new No(e,t.data):t)}(this.document,t);for(const t of n)null!==t.parent&&t._remove(),t.parent=this,t.document=this.document,this._children.splice(e,0,t),e++,o++;return o}_removeChildren(e,t=1){this._fireChange("children",this);for(let o=e;o0&&(this._classes.clear(),!0):"style"==e?!this._styles.isEmpty&&(this._styles.clear(),!0):this._attrs.delete(e)}_addClass(e){this._fireChange("attributes",this),(e=Array.isArray(e)?e:[e]).forEach(e=>this._classes.add(e))}_removeClass(e){this._fireChange("attributes",this),(e=Array.isArray(e)?e:[e]).forEach(e=>this._classes.delete(e))}_setStyle(e,t){this._fireChange("attributes",this),this._styles.set(e,t)}_removeStyle(e){this._fireChange("attributes",this),(e=Array.isArray(e)?e:[e]).forEach(e=>this._styles.remove(e))}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}}function zn(e,t){const o=t.split(/\s+/);e.clear(),o.forEach(t=>e.add(t))}class Bn extends Nn{constructor(e,t,o,n){super(e,t,o,n),this.getFillerOffset=Fn}is(e,t=null){return t?t===this.name&&("containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e):"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e}}function Fn(){const e=[...this.getChildren()],t=e[this.childCount-1];if(t&&t.is("element","br"))return this.childCount;for(const t of e)if(!t.is("uiElement"))return null;return this.childCount}var Dn=Pn((function(e,t){Ee(t,st(t),e)}));const Ln=Symbol("observableProperties"),Hn=Symbol("boundObservables"),jn=Symbol("boundProperties"),Wn={set(e,t){if(B(e))return void Object.keys(e).forEach(t=>{this.set(t,e[t])},this);$n(this);const o=this[Ln];if(e in this&&!o.has(e))throw new mo.b("observable-set-cannot-override: Cannot override an existing property.",this);Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>o.get(e),set(t){const n=o.get(e);let i=this.fire("set:"+e,e,t,n);void 0===i&&(i=t),n===i&&o.has(e)||(o.set(e,i),this.fire("change:"+e,e,i,n))}}),this[e]=t},bind(...e){if(!e.length||!Kn(e))throw new mo.b("observable-bind-wrong-properties: All properties must be strings.",this);if(new Set(e).size!==e.length)throw new mo.b("observable-bind-duplicate-properties: Properties must be unique.",this);$n(this);const t=this[jn];e.forEach(e=>{if(t.has(e))throw new mo.b("observable-bind-rebind: Cannot bind the same property more than once.",this)});const o=new Map;return e.forEach(e=>{const n={property:e,to:[]};t.set(e,n),o.set(e,n)}),{to:Un,toMany:Gn,_observable:this,_bindProperties:e,_to:[],_bindings:o}},unbind(...e){if(!this[Ln])return;const t=this[jn],o=this[Hn];if(e.length){if(!Kn(e))throw new mo.b("observable-unbind-wrong-properties: Properties must be strings.",this);e.forEach(e=>{const n=t.get(e);if(!n)return;let i,r,s,a;n.to.forEach(e=>{i=e[0],r=e[1],s=o.get(i),a=s[r],a.delete(n),a.size||delete s[r],Object.keys(s).length||(o.delete(i),this.stopListening(i,"change"))}),t.delete(e)})}else o.forEach((e,t)=>{this.stopListening(t,"change")}),o.clear(),t.clear()},decorate(e){const t=this[e];if(!t)throw new mo.b("observablemixin-cannot-decorate-undefined: Cannot decorate an undefined method.",this,{object:this,methodName:e});this.on(e,(e,o)=>{e.return=t.apply(this,o)}),this[e]=function(...t){return this.fire(e,t)}}};Dn(Wn,po);var qn=Wn;function $n(e){e[Ln]||(Object.defineProperty(e,Ln,{value:new Map}),Object.defineProperty(e,Hn,{value:new Map}),Object.defineProperty(e,jn,{value:new Map}))}function Un(...e){const t=function(...e){if(!e.length)throw new mo.b("observable-bind-to-parse-error: Invalid argument syntax in `to()`.",null);const t={to:[]};let o;"function"==typeof e[e.length-1]&&(t.callback=e.pop());return e.forEach(e=>{if("string"==typeof e)o.properties.push(e);else{if("object"!=typeof e)throw new mo.b("observable-bind-to-parse-error: Invalid argument syntax in `to()`.",null);o={observable:e,properties:[]},t.to.push(o)}}),t}(...e),o=Array.from(this._bindings.keys()),n=o.length;if(!t.callback&&t.to.length>1)throw new mo.b("observable-bind-to-no-callback: Binding multiple observables only possible with callback.",this);if(n>1&&t.callback)throw new mo.b("observable-bind-to-extra-callback: Cannot bind multiple properties and use a callback in one binding.",this);var i;t.to.forEach(e=>{if(e.properties.length&&e.properties.length!==n)throw new mo.b("observable-bind-to-properties-length: The number of properties must match.",this);e.properties.length||(e.properties=this._bindProperties)}),this._to=t.to,t.callback&&(this._bindings.get(o[0]).callback=t.callback),i=this._observable,this._to.forEach(e=>{const t=i[Hn];let o;t.get(e.observable)||i.listenTo(e.observable,"change",(n,r)=>{o=t.get(e.observable)[r],o&&o.forEach(e=>{Jn(i,e.property)})})}),function(e){let t;e._bindings.forEach((o,n)=>{e._to.forEach(i=>{t=i.properties[o.callback?0:e._bindProperties.indexOf(n)],o.to.push([i.observable,t]),function(e,t,o,n){const i=e[Hn],r=i.get(o),s=r||{};s[n]||(s[n]=new Set);s[n].add(t),r||i.set(o,s)}(e._observable,o,i.observable,t)})})}(this),this._bindProperties.forEach(e=>{Jn(this._observable,e)})}function Gn(e,t,o){if(this._bindings.size>1)throw new mo.b("observable-bind-to-many-not-one-binding: Cannot bind multiple properties with toMany().",this);this.to(...function(e,t){const o=e.map(e=>[e,t]);return Array.prototype.concat.apply([],o)}(e,t),o)}function Kn(e){return e.every(e=>"string"==typeof e)}function Jn(e,t){const o=e[jn].get(t);let n;o.callback?n=o.callback.apply(e,o.to.map(e=>e[0][e[1]])):(n=o.to[0],n=n[0][n[1]]),Object.prototype.hasOwnProperty.call(e,t)?e[t]=n:e.set(t,n)}class Yn extends Bn{constructor(e,t,o,n){super(e,t,o,n),this.set("isReadOnly",!1),this.set("isFocused",!1),this.bind("isReadOnly").to(e),this.bind("isFocused").to(e,"isFocused",t=>t&&e.selection.editableElement==this),this.listenTo(e.selection,"change",()=>{this.isFocused=e.isFocused&&e.selection.editableElement==this})}is(e,t=null){return t?t===this.name&&("editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e):"editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e}destroy(){this.stopListening()}}Co(Yn,qn);const Qn=Symbol("rootName");class Xn extends Yn{constructor(e,t){super(e,t),this.rootName="main"}is(e,t=null){return t?t===this.name&&("rootElement"===e||"view:rootElement"===e||"editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e):"rootElement"===e||"view:rootElement"===e||"editableElement"===e||"view:editableElement"===e||"containerElement"===e||"view:containerElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e}get rootName(){return this.getCustomProperty(Qn)}set rootName(e){this._setCustomProperty(Qn,e)}set _name(e){this.name=e}}class Zn{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new mo.b("view-tree-walker-no-start-position: Neither boundaries nor starting position have been defined.",null);if(e.direction&&"forward"!=e.direction&&"backward"!=e.direction)throw new mo.b("view-tree-walker-unknown-direction: Only `backward` and `forward` direction allowed.",e.startPosition,{direction:e.direction});this.boundaries=e.boundaries||null,e.startPosition?this.position=ei._createAt(e.startPosition):this.position=ei._createAt(e.boundaries["backward"==e.direction?"end":"start"]),this.direction=e.direction||"forward",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null}[Symbol.iterator](){return this}skip(e){let t,o,n;do{n=this.position,({done:t,value:o}=this.next())}while(!t&&e(o));t||(this.position=n)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){let e=this.position.clone();const t=this.position,o=e.parent;if(null===o.parent&&e.offset===o.childCount)return{done:!0};if(o===this._boundaryEndParent&&e.offset==this.boundaries.end.offset)return{done:!0};let n;if(o instanceof No){if(e.isAtEnd)return this.position=ei._createAfter(o),this._next();n=o.data[e.offset]}else n=o.getChild(e.offset);if(n instanceof Nn)return this.shallow?e.offset++:e=new ei(n,0),this.position=e,this._formatReturnValue("elementStart",n,t,e,1);if(n instanceof No){if(this.singleCharacters)return e=new ei(n,0),this.position=e,this._next();{let o,i=n.data.length;return n==this._boundaryEndParent?(i=this.boundaries.end.offset,o=new zo(n,0,i),e=ei._createAfter(o)):(o=new zo(n,0,n.data.length),e.offset++),this.position=e,this._formatReturnValue("text",o,t,e,i)}}if("string"==typeof n){let n;if(this.singleCharacters)n=1;else{n=(o===this._boundaryEndParent?this.boundaries.end.offset:o.data.length)-e.offset}const i=new zo(o,e.offset,n);return e.offset+=n,this.position=e,this._formatReturnValue("text",i,t,e,n)}return e=ei._createAfter(o),this.position=e,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",o,t,e)}_previous(){let e=this.position.clone();const t=this.position,o=e.parent;if(null===o.parent&&0===e.offset)return{done:!0};if(o==this._boundaryStartParent&&e.offset==this.boundaries.start.offset)return{done:!0};let n;if(o instanceof No){if(e.isAtStart)return this.position=ei._createBefore(o),this._previous();n=o.data[e.offset-1]}else n=o.getChild(e.offset-1);if(n instanceof Nn)return this.shallow?(e.offset--,this.position=e,this._formatReturnValue("elementStart",n,t,e,1)):(e=new ei(n,n.childCount),this.position=e,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",n,t,e));if(n instanceof No){if(this.singleCharacters)return e=new ei(n,n.data.length),this.position=e,this._previous();{let o,i=n.data.length;if(n==this._boundaryStartParent){const t=this.boundaries.start.offset;o=new zo(n,t,n.data.length-t),i=o.data.length,e=ei._createBefore(o)}else o=new zo(n,0,n.data.length),e.offset--;return this.position=e,this._formatReturnValue("text",o,t,e,i)}}if("string"==typeof n){let n;if(this.singleCharacters)n=1;else{const t=o===this._boundaryStartParent?this.boundaries.start.offset:0;n=e.offset-t}e.offset-=n;const i=new zo(o,e.offset,n);return this.position=e,this._formatReturnValue("text",i,t,e,n)}return e=ei._createBefore(o),this.position=e,this._formatReturnValue("elementStart",o,t,e,1)}_formatReturnValue(e,t,o,n,i){return t instanceof zo&&(t.offsetInText+t.data.length==t.textNode.data.length&&("forward"!=this.direction||this.boundaries&&this.boundaries.end.isEqual(this.position)?o=ei._createAfter(t.textNode):(n=ei._createAfter(t.textNode),this.position=n)),0===t.offsetInText&&("backward"!=this.direction||this.boundaries&&this.boundaries.start.isEqual(this.position)?o=ei._createBefore(t.textNode):(n=ei._createBefore(t.textNode),this.position=n))),{done:!1,value:{type:e,item:t,previousPosition:o,nextPosition:n,length:i}}}}class ei{constructor(e,t){this.parent=e,this.offset=t}get nodeAfter(){return this.parent.is("$text")?null:this.parent.getChild(this.offset)||null}get nodeBefore(){return this.parent.is("$text")?null:this.parent.getChild(this.offset-1)||null}get isAtStart(){return 0===this.offset}get isAtEnd(){const e=this.parent.is("$text")?this.parent.data.length:this.parent.childCount;return this.offset===e}get root(){return this.parent.root}get editableElement(){let e=this.parent;for(;!(e instanceof Yn);){if(!e.parent)return null;e=e.parent}return e}getShiftedBy(e){const t=ei._createAt(this),o=t.offset+e;return t.offset=o<0?0:o,t}getLastMatchingPosition(e,t={}){t.startPosition=this;const o=new Zn(t);return o.skip(e),o.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(e){const t=this.getAncestors(),o=e.getAncestors();let n=0;for(;t[n]==o[n]&&t[n];)n++;return 0===n?null:t[n-1]}is(e){return"position"===e||"view:position"===e}isEqual(e){return this.parent==e.parent&&this.offset==e.offset}isBefore(e){return"before"==this.compareWith(e)}isAfter(e){return"after"==this.compareWith(e)}compareWith(e){if(this.root!==e.root)return"different";if(this.isEqual(e))return"same";const t=this.parent.is("node")?this.parent.getPath():[],o=e.parent.is("node")?e.parent.getPath():[];t.push(this.offset),o.push(e.offset);const n=Vo(t,o);switch(n){case"prefix":return"before";case"extension":return"after";default:return t[n]0?new this(o,n):new this(n,o)}static _createIn(e){return this._createFromParentsAndOffsets(e,0,e,e.childCount)}static _createOn(e){const t=e.is("$textProxy")?e.offsetSize:1;return this._createFromPositionAndShift(ei._createBefore(e),t)}}function oi(e){return!(!e.item.is("attributeElement")&&!e.item.is("uiElement"))}function ni(e){let t=0;for(const o of e)t++;return t}class ii{constructor(e=null,t,o){this._ranges=[],this._lastRangeBackward=!1,this._isFake=!1,this._fakeSelectionLabel="",this.setTo(e,t,o)}get isFake(){return this._isFake}get fakeSelectionLabel(){return this._fakeSelectionLabel}get anchor(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.end:e.start).clone()}get focus(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.start:e.end).clone()}get isCollapsed(){return 1===this.rangeCount&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}get editableElement(){return this.anchor?this.anchor.editableElement:null}*getRanges(){for(const e of this._ranges)yield e.clone()}getFirstRange(){let e=null;for(const t of this._ranges)e&&!t.start.isBefore(e.start)||(e=t);return e?e.clone():null}getLastRange(){let e=null;for(const t of this._ranges)e&&!t.end.isAfter(e.end)||(e=t);return e?e.clone():null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}isEqual(e){if(this.isFake!=e.isFake)return!1;if(this.isFake&&this.fakeSelectionLabel!=e.fakeSelectionLabel)return!1;if(this.rangeCount!=e.rangeCount)return!1;if(0===this.rangeCount)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let o=!1;for(const n of e._ranges)if(t.isEqual(n)){o=!0;break}if(!o)return!1}return!0}isSimilar(e){if(this.isBackward!=e.isBackward)return!1;const t=ni(this.getRanges());if(t!=ni(e.getRanges()))return!1;if(0==t)return!0;for(let t of this.getRanges()){t=t.getTrimmed();let o=!1;for(let n of e.getRanges())if(n=n.getTrimmed(),t.start.isEqual(n.start)&&t.end.isEqual(n.end)){o=!0;break}if(!o)return!1}return!0}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}setTo(e,t,o){if(null===e)this._setRanges([]),this._setFakeOptions(t);else if(e instanceof ii||e instanceof ri)this._setRanges(e.getRanges(),e.isBackward),this._setFakeOptions({fake:e.isFake,label:e.fakeSelectionLabel});else if(e instanceof ti)this._setRanges([e],t&&t.backward),this._setFakeOptions(t);else if(e instanceof ei)this._setRanges([new ti(e)]),this._setFakeOptions(t);else if(e instanceof Mo){const n=!!o&&!!o.backward;let i;if(void 0===t)throw new mo.b("view-selection-setTo-required-second-parameter: selection.setTo requires the second parameter when the first parameter is a node.",this);i="in"==t?ti._createIn(e):"on"==t?ti._createOn(e):new ti(ei._createAt(e,t)),this._setRanges([i],n),this._setFakeOptions(o)}else{if(!xo(e))throw new mo.b("view-selection-setTo-not-selectable: Cannot set selection to given place.",this);this._setRanges(e,t&&t.backward),this._setFakeOptions(t)}this.fire("change")}setFocus(e,t){if(null===this.anchor)throw new mo.b("view-selection-setFocus-no-ranges: Cannot set selection focus if there are no ranges in selection.",this);const o=ei._createAt(e,t);if("same"==o.compareWith(this.focus))return;const n=this.anchor;this._ranges.pop(),"before"==o.compareWith(n)?this._addRange(new ti(o,n),!0):this._addRange(new ti(n,o)),this.fire("change")}is(e){return"selection"===e||"view:selection"===e}_setRanges(e,t=!1){e=Array.from(e),this._ranges=[];for(const t of e)this._addRange(t);this._lastRangeBackward=!!t}_setFakeOptions(e={}){this._isFake=!!e.fake,this._fakeSelectionLabel=e.fake&&e.label||""}_addRange(e,t=!1){if(!(e instanceof ti))throw new mo.b("view-selection-add-range-not-range: Selection range set to an object that is not an instance of view.Range",this);this._pushRange(e),this._lastRangeBackward=!!t}_pushRange(e){for(const t of this._ranges)if(e.isIntersecting(t))throw new mo.b("view-selection-range-intersects: Trying to add a range that intersects with another range from selection.",this,{addedRange:e,intersectingRange:t});this._ranges.push(new ti(e.start,e.end))}}Co(ii,po);class ri{constructor(e=null,t,o){this._selection=new ii,this._selection.delegate("change").to(this),this._selection.setTo(e,t,o)}get isFake(){return this._selection.isFake}get fakeSelectionLabel(){return this._selection.fakeSelectionLabel}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get isCollapsed(){return this._selection.isCollapsed}get rangeCount(){return this._selection.rangeCount}get isBackward(){return this._selection.isBackward}get editableElement(){return this._selection.editableElement}get _ranges(){return this._selection._ranges}*getRanges(){yield*this._selection.getRanges()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getSelectedElement(){return this._selection.getSelectedElement()}isEqual(e){return this._selection.isEqual(e)}isSimilar(e){return this._selection.isSimilar(e)}is(e){return"selection"===e||"documentSelection"==e||"view:selection"==e||"view:documentSelection"==e}_setTo(e,t,o){this._selection.setTo(e,t,o)}_setFocus(e,t){this._selection.setFocus(e,t)}}Co(ri,po);class si{constructor(e){this.selection=new ri,this.roots=new Ao({idProperty:"rootName"}),this.stylesProcessor=e,this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isComposing",!1),this._postFixers=new Set}getRoot(e="main"){return this.roots.get(e)}registerPostFixer(e){this._postFixers.add(e)}destroy(){this.roots.map(e=>e.destroy()),this.stopListening()}_callPostFixers(e){let t=!1;do{for(const o of this._postFixers)if(t=o(e),t)break}while(t)}}Co(si,qn);class ai extends Nn{constructor(e,t,o,n){super(e,t,o,n),this.getFillerOffset=li,this._priority=10,this._id=null,this._clonesGroup=null}get priority(){return this._priority}get id(){return this._id}getElementsWithSameId(){if(null===this.id)throw new mo.b("attribute-element-get-elements-with-same-id-no-id: Cannot get elements with the same id for an attribute element without id.",this);return new Set(this._clonesGroup)}is(e,t=null){return t?t===this.name&&("attributeElement"===e||"view:attributeElement"===e||"element"===e||"view:element"===e):"attributeElement"===e||"view:attributeElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e}isSimilar(e){return null!==this.id||null!==e.id?this.id===e.id:super.isSimilar(e)&&this.priority==e.priority}_clone(e){const t=super._clone(e);return t._priority=this._priority,t._id=this._id,t}}function li(){if(ci(this))return null;let e=this.parent;for(;e&&e.is("attributeElement");){if(ci(e)>1)return null;e=e.parent}return!e||ci(e)>1?null:this.childCount}function ci(e){return Array.from(e.getChildren()).filter(e=>!e.is("uiElement")).length}ai.DEFAULT_PRIORITY=10;class di extends Nn{constructor(e,t,o,n){super(e,t,o,n),this.getFillerOffset=hi}is(e,t=null){return t?t===this.name&&("emptyElement"===e||"view:emptyElement"===e||"element"===e||"view:element"===e):"emptyElement"===e||"view:emptyElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e}_insertChild(e,t){if(t&&(t instanceof Mo||Array.from(t).length>0))throw new mo.b("view-emptyelement-cannot-add: Cannot add child nodes to EmptyElement instance.",[this,t])}}function hi(){return null}const ui=navigator.userAgent.toLowerCase();var mi={isMac:function(e){return e.indexOf("macintosh")>-1}(ui),isGecko:function(e){return!!e.match(/gecko\/\d+/)}(ui),isSafari:function(e){return e.indexOf(" applewebkit/")>-1&&-1===e.indexOf("chrome")}(ui),isAndroid:function(e){return e.indexOf("android")>-1}(ui),features:{isRegExpUnicodePropertySupported:function(){let e=!1;try{e=0==="ć".search(new RegExp("[\\p{L}]","u"))}catch(e){}return e}()}};const gi={"⌘":"ctrl","⇧":"shift","⌥":"alt"},fi={ctrl:"⌘",shift:"⇧",alt:"⌥"},pi=function(){const e={arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,backspace:8,delete:46,enter:13,space:32,esc:27,tab:9,ctrl:1114112,cmd:1114112,shift:2228224,alt:4456448};for(let t=65;t<=90;t++){const o=String.fromCharCode(t);e[o.toLowerCase()]=t}for(let t=48;t<=57;t++)e[t-48]=t;for(let t=112;t<=123;t++)e["f"+(t-111)]=t;return e}();function bi(e){let t;if("string"==typeof e){if(t=pi[e.toLowerCase()],!t)throw new mo.b("keyboard-unknown-key: Unknown key name.",null,{key:e})}else t=e.keyCode+(e.altKey?pi.alt:0)+(e.ctrlKey?pi.ctrl:0)+(e.shiftKey?pi.shift:0);return t}function wi(e){return"string"==typeof e&&(e=xi(e)),e.map(e=>"string"==typeof e?bi(e):e).reduce((e,t)=>t+e,0)}function ki(e){return mi.isMac?xi(e).map(e=>fi[e.toLowerCase()]||e).reduce((e,t)=>e.slice(-1)in gi?e+t:e+"+"+t):e}function _i(e){return e==pi.arrowright||e==pi.arrowleft||e==pi.arrowup||e==pi.arrowdown}function vi(e,t){const o="ltr"===t;switch(e){case pi.arrowleft:return o?"left":"right";case pi.arrowright:return o?"right":"left";case pi.arrowup:return"up";case pi.arrowdown:return"down"}}function yi(e,t){const o=vi(e,t);return"down"===o||"right"===o}function xi(e){return e.split(/\s*\+\s*/)}class Ci extends Nn{constructor(e,t,o,n){super(e,t,o,n),this.getFillerOffset=Ti}is(e,t=null){return t?t===this.name&&("uiElement"===e||"view:uiElement"===e||"element"===e||"view:element"===e):"uiElement"===e||"view:uiElement"===e||"element"===e||"view:element"===e||"node"===e||"view:node"===e}_insertChild(e,t){if(t&&(t instanceof Mo||Array.from(t).length>0))throw new mo.b("view-uielement-cannot-add: Cannot add child nodes to UIElement instance.",this)}render(e){return this.toDomElement(e)}toDomElement(e){const t=e.createElement(this.name);for(const e of this.getAttributeKeys())t.setAttribute(e,this.getAttribute(e));return t}}function Ai(e){e.document.on("keydown",(t,o)=>function(e,t,o){if(t.keyCode==pi.arrowright){const e=t.domTarget.ownerDocument.defaultView.getSelection(),n=1==e.rangeCount&&e.getRangeAt(0).collapsed;if(n||t.shiftKey){const t=e.focusNode,i=e.focusOffset,r=o.domPositionToView(t,i);if(null===r)return;let s=!1;const a=r.getLastMatchingPosition(e=>(e.item.is("uiElement")&&(s=!0),!(!e.item.is("uiElement")&&!e.item.is("attributeElement"))));if(s){const t=o.viewPositionToDom(a);n?e.collapse(t.parent,t.offset):e.extend(t.parent,t.offset)}}}}(0,o,e.domConverter))}function Ti(){return null}class Pi extends Nn{constructor(e,t,o,n){super(e,t,o,n),this.getFillerOffset=Si}is(e,t=null){return t?t===this.name&&("rawElement"===e||"view:rawElement"===e||"element"===e||"view:element"===e):"rawElement"===e||"view:rawElement"===e||e===this.name||e==="view:"+this.name||"element"===e||"view:element"===e||"node"===e||"view:node"===e}_insertChild(e,t){if(t&&(t instanceof Mo||Array.from(t).length>0))throw new mo.b("view-rawelement-cannot-add: Cannot add child nodes to a RawElement instance.",[this,t])}}function Si(){return null}class Ei{constructor(e,t){this.document=e,this._children=[],t&&this._insertChild(0,t)}[Symbol.iterator](){return this._children[Symbol.iterator]()}get childCount(){return this._children.length}get isEmpty(){return 0===this.childCount}get root(){return this}get parent(){return null}is(e){return"documentFragment"===e||"view:documentFragment"===e}_appendChild(e){return this._insertChild(this.childCount,e)}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}_insertChild(e,t){this._fireChange("children",this);let o=0;const n=function(e,t){if("string"==typeof t)return[new No(e,t)];xo(t)||(t=[t]);return Array.from(t).map(t=>"string"==typeof t?new No(e,t):t instanceof zo?new No(e,t.data):t)}(this.document,t);for(const t of n)null!==t.parent&&t._remove(),t.parent=this,this._children.splice(e,0,t),e++,o++;return o}_removeChildren(e,t=1){this._fireChange("children",this);for(let o=e;o{}),n}setAttribute(e,t,o){o._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,o){y(e)&&void 0===o&&(o=t),o._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,o){o._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}breakAttributes(e){return e instanceof ei?this._breakAttributes(e):this._breakAttributesRange(e)}breakContainer(e){const t=e.parent;if(!t.is("containerElement"))throw new mo.b("view-writer-break-non-container-element: Trying to break an element which is not a container element.",this.document);if(!t.parent)throw new mo.b("view-writer-break-root: Trying to break root element.",this.document);if(e.isAtStart)return ei._createBefore(t);if(!e.isAtEnd){const o=t._clone(!1);this.insert(ei._createAfter(t),o);const n=new ti(e,ei._createAt(t,"end")),i=new ei(o,0);this.move(n,i)}return ei._createAfter(t)}mergeAttributes(e){const t=e.offset,o=e.parent;if(o.is("$text"))return e;if(o.is("attributeElement")&&0===o.childCount){const e=o.parent,t=o.index;return o._remove(),this._removeFromClonedElementsGroup(o),this.mergeAttributes(new ei(e,t))}const n=o.getChild(t-1),i=o.getChild(t);if(!n||!i)return e;if(n.is("$text")&&i.is("$text"))return Ni(n,i);if(n.is("attributeElement")&&i.is("attributeElement")&&n.isSimilar(i)){const e=n.childCount;return n._appendChild(i.getChildren()),i._remove(),this._removeFromClonedElementsGroup(i),this.mergeAttributes(new ei(n,e))}return e}mergeContainers(e){const t=e.nodeBefore,o=e.nodeAfter;if(!(t&&o&&t.is("containerElement")&&o.is("containerElement")))throw new mo.b("view-writer-merge-containers-invalid-position: Element before and after given position cannot be merged.",this.document);const n=t.getChild(t.childCount-1),i=n instanceof No?ei._createAt(n,"end"):ei._createAt(t,"end");return this.move(ti._createIn(o),ei._createAt(t,"end")),this.remove(ti._createOn(o)),i}insert(e,t){(function e(t,o){for(const n of t){if(!zi.some(e=>n instanceof e))throw new mo.b("view-writer-insert-invalid-node-type: One of the nodes to be inserted is of invalid type.",o);n.is("$text")||e(n.getChildren(),o)}})(t=xo(t)?[...t]:[t],this.document);const o=Ii(e);if(!o)throw new mo.b("view-writer-invalid-position-container: Position's parent container cannot be found.",this.document);const n=this._breakAttributes(e,!0),i=o._insertChild(n.offset,t);for(const e of t)this._addToClonedElementsGroup(e);const r=n.getShiftedBy(i),s=this.mergeAttributes(n);if(0===i)return new ti(s,s);{s.isEqual(n)||r.offset--;const e=this.mergeAttributes(r);return new ti(s,e)}}remove(e){const t=e instanceof ti?e:ti._createOn(e);if(Fi(t,this.document),t.isCollapsed)return new Ei(this.document);const{start:o,end:n}=this._breakAttributesRange(t,!0),i=o.parent,r=n.offset-o.offset,s=i._removeChildren(o.offset,r);for(const e of s)this._removeFromClonedElementsGroup(e);const a=this.mergeAttributes(o);return t.start=a,t.end=a.clone(),new Ei(this.document,s)}clear(e,t){Fi(e,this.document);const o=e.getWalker({direction:"backward",ignoreElementEnd:!0});for(const n of o){const o=n.item;let i;if(o.is("element")&&t.isSimilar(o))i=ti._createOn(o);else if(!n.nextPosition.isAfter(e.start)&&o.is("$textProxy")){const e=o.getAncestors().find(e=>e.is("element")&&t.isSimilar(e));e&&(i=ti._createIn(e))}i&&(i.end.isAfter(e.end)&&(i.end=e.end),i.start.isBefore(e.start)&&(i.start=e.start),this.remove(i))}}move(e,t){let o;if(t.isAfter(e.end)){const n=(t=this._breakAttributes(t,!0)).parent,i=n.childCount;e=this._breakAttributesRange(e,!0),o=this.remove(e),t.offset+=n.childCount-i}else o=this.remove(e);return this.insert(t,o)}wrap(e,t){if(!(t instanceof ai))throw new mo.b("view-writer-wrap-invalid-attribute: DowncastWriter#wrap() must be called with an attribute element.",this.document);if(Fi(e,this.document),e.isCollapsed){let n=e.start;n.parent.is("element")&&(o=n.parent,!Array.from(o.getChildren()).some(e=>!e.is("uiElement")))&&(n=n.getLastMatchingPosition(e=>e.item.is("uiElement"))),n=this._wrapPosition(n,t);const i=this.document.selection;return i.isCollapsed&&i.getFirstPosition().isEqual(e.start)&&this.setSelection(n),new ti(n)}return this._wrapRange(e,t);var o}unwrap(e,t){if(!(t instanceof ai))throw new mo.b("view-writer-unwrap-invalid-attribute: DowncastWriter#unwrap() must be called with an attribute element.",this.document);if(Fi(e,this.document),e.isCollapsed)return e;const{start:o,end:n}=this._breakAttributesRange(e,!0),i=o.parent,r=this._unwrapChildren(i,o.offset,n.offset,t),s=this.mergeAttributes(r.start);s.isEqual(r.start)||r.end.offset--;const a=this.mergeAttributes(r.end);return new ti(s,a)}rename(e,t){const o=new Bn(this.document,e,t.getAttributes());return this.insert(ei._createAfter(t),o),this.move(ti._createIn(t),ei._createAt(o,0)),this.remove(ti._createOn(t)),o}clearClonedElementsGroup(e){this._cloneGroups.delete(e)}createPositionAt(e,t){return ei._createAt(e,t)}createPositionAfter(e){return ei._createAfter(e)}createPositionBefore(e){return ei._createBefore(e)}createRange(e,t){return new ti(e,t)}createRangeOn(e){return ti._createOn(e)}createRangeIn(e){return ti._createIn(e)}createSelection(e,t,o){return new ii(e,t,o)}_wrapChildren(e,t,o,n){let i=t;const r=[];for(;i!1,e.parent._insertChild(e.offset,o);const n=new ti(e,e.getShiftedBy(1));this.wrap(n,t);const i=new ei(o.parent,o.index);o._remove();const r=i.nodeBefore,s=i.nodeAfter;return r instanceof No&&s instanceof No?Ni(r,s):Oi(i)}_wrapAttributeElement(e,t){if(!Di(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const o of e.getAttributeKeys())if("class"!==o&&"style"!==o&&t.hasAttribute(o)&&t.getAttribute(o)!==e.getAttribute(o))return!1;for(const o of e.getStyleNames())if(t.hasStyle(o)&&t.getStyle(o)!==e.getStyle(o))return!1;for(const o of e.getAttributeKeys())"class"!==o&&"style"!==o&&(t.hasAttribute(o)||this.setAttribute(o,e.getAttribute(o),t));for(const o of e.getStyleNames())t.hasStyle(o)||this.setStyle(o,e.getStyle(o),t);for(const o of e.getClassNames())t.hasClass(o)||this.addClass(o,t);return!0}_unwrapAttributeElement(e,t){if(!Di(e,t))return!1;if(e.name!==t.name||e.priority!==t.priority)return!1;for(const o of e.getAttributeKeys())if("class"!==o&&"style"!==o&&(!t.hasAttribute(o)||t.getAttribute(o)!==e.getAttribute(o)))return!1;if(!t.hasClass(...e.getClassNames()))return!1;for(const o of e.getStyleNames())if(!t.hasStyle(o)||t.getStyle(o)!==e.getStyle(o))return!1;for(const o of e.getAttributeKeys())"class"!==o&&"style"!==o&&this.removeAttribute(o,t);return this.removeClass(Array.from(e.getClassNames()),t),this.removeStyle(Array.from(e.getStyleNames()),t),!0}_breakAttributesRange(e,t=!1){const o=e.start,n=e.end;if(Fi(e,this.document),e.isCollapsed){const o=this._breakAttributes(e.start,t);return new ti(o,o)}const i=this._breakAttributes(n,t),r=i.parent.childCount,s=this._breakAttributes(o,t);return i.offset+=i.parent.childCount-r,new ti(s,i)}_breakAttributes(e,t=!1){const o=e.offset,n=e.parent;if(e.parent.is("emptyElement"))throw new mo.b("view-writer-cannot-break-empty-element: Cannot break an EmptyElement instance.",this.document);if(e.parent.is("uiElement"))throw new mo.b("view-writer-cannot-break-ui-element: Cannot break a UIElement instance.",this.document);if(e.parent.is("rawElement"))throw new mo.b("view-writer-cannot-break-raw-element: Cannot break a RawElement instance.",this.document);if(!t&&n.is("$text")&&Bi(n.parent))return e.clone();if(Bi(n))return e.clone();if(n.is("$text"))return this._breakAttributes(Mi(e),t);if(o==n.childCount){const e=new ei(n.parent,n.index+1);return this._breakAttributes(e,t)}if(0===o){const e=new ei(n.parent,n.index);return this._breakAttributes(e,t)}{const e=n.index+1,i=n._clone();n.parent._insertChild(e,i),this._addToClonedElementsGroup(i);const r=n.childCount-o,s=n._removeChildren(o,r);i._appendChild(s);const a=new ei(n.parent,e);return this._breakAttributes(a,t)}}_addToClonedElementsGroup(e){if(!e.root.is("rootElement"))return;if(e.is("element"))for(const t of e.getChildren())this._addToClonedElementsGroup(t);const t=e.id;if(!t)return;let o=this._cloneGroups.get(t);o||(o=new Set,this._cloneGroups.set(t,o)),o.add(e),e._clonesGroup=o}_removeFromClonedElementsGroup(e){if(e.is("element"))for(const t of e.getChildren())this._removeFromClonedElementsGroup(t);const t=e.id;if(!t)return;const o=this._cloneGroups.get(t);o&&o.delete(e)}}function Ii(e){let t=e.parent;for(;!Bi(t);){if(!t)return;t=t.parent}return t}function Vi(e,t){return e.priorityt.priority)&&e.getIdentity()e.createTextNode(" "),ji=e=>{const t=e.createElement("br");return t.dataset.ckeFiller=!0,t},Wi=(()=>{let e="";for(let t=0;t<7;t++)e+="​";return e})();function qi(e){return Li(e)&&e.data.substr(0,7)===Wi}function $i(e){return 7==e.data.length&&qi(e)}function Ui(e){return qi(e)?e.data.slice(7):e.data}function Gi(e,t){if(t.keyCode==pi.arrowleft){const e=t.domTarget.ownerDocument.defaultView.getSelection();if(1==e.rangeCount&&e.getRangeAt(0).collapsed){const t=e.getRangeAt(0).startContainer,o=e.getRangeAt(0).startOffset;qi(t)&&o<=7&&e.collapse(t,0)}}}function Ki(e,t,o,n=!1){o=o||function(e,t){return e===t},Array.isArray(e)||(e=Array.prototype.slice.call(e)),Array.isArray(t)||(t=Array.prototype.slice.call(t));const i=function(e,t,o){const n=Ji(e,t,o);if(-1===n)return{firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};const i=Yi(e,n),r=Yi(t,n),s=Ji(i,r,o),a=e.length-s,l=t.length-s;return{firstIndex:n,lastIndexOld:a,lastIndexNew:l}}(e,t,o);return n?function(e,t){const{firstIndex:o,lastIndexOld:n,lastIndexNew:i}=e;if(-1===o)return Array(t).fill("equal");let r=[];o>0&&(r=r.concat(Array(o).fill("equal")));i-o>0&&(r=r.concat(Array(i-o).fill("insert")));n-o>0&&(r=r.concat(Array(n-o).fill("delete")));i0&&o.push({index:n,type:"insert",values:e.slice(n,r)});i-n>0&&o.push({index:n+(r-n),type:"delete",howMany:i-n});return o}(t,i)}function Ji(e,t,o){for(let n=0;n200||i>200||n+i>300)return Qi.fastDiff(e,t,o,!0);let r,s;if(ic?-1:1;d[n+u]&&(d[n]=d[n+u].slice(0)),d[n]||(d[n]=[]),d[n].push(i>c?r:s);let m=Math.max(i,c),g=m-n;for(;gc;m--)h[m]=u(m);h[c]=u(c),g++}while(h[c]!==l);return d[c].slice(1)}function Xi(e,t,o){e.insertBefore(o,e.childNodes[t]||null)}function Zi(e){const t=e.parentNode;t&&t.removeChild(e)}function er(e){if(e){if(e.defaultView)return e instanceof e.defaultView.Document;if(e.ownerDocument&&e.ownerDocument.defaultView)return e instanceof e.ownerDocument.defaultView.Node}return!1}Qi.fastDiff=Ki;class tr{constructor(e,t){this.domDocuments=new Set,this.domConverter=e,this.markedAttributes=new Set,this.markedChildren=new Set,this.markedTexts=new Set,this.selection=t,this.isFocused=!1,this._inlineFiller=null,this._fakeSelectionContainer=null}markToSync(e,t){if("text"===e)this.domConverter.mapViewToDom(t.parent)&&this.markedTexts.add(t);else{if(!this.domConverter.mapViewToDom(t))return;if("attributes"===e)this.markedAttributes.add(t);else{if("children"!==e)throw new mo.b("view-renderer-unknown-type: Unknown type passed to Renderer.markToSync.",this);this.markedChildren.add(t)}}}render(){let e;for(const e of this.markedChildren)this._updateChildrenMappings(e);this._inlineFiller&&!this._isSelectionInInlineFiller()&&this._removeInlineFiller(),this._inlineFiller?e=this._getInlineFillerPosition():this._needsInlineFillerAtSelection()&&(e=this.selection.getFirstPosition(),this.markedChildren.add(e.parent));for(const e of this.markedAttributes)this._updateAttrs(e);for(const t of this.markedChildren)this._updateChildren(t,{inlineFillerPosition:e});for(const t of this.markedTexts)!this.markedChildren.has(t.parent)&&this.domConverter.mapViewToDom(t.parent)&&this._updateText(t,{inlineFillerPosition:e});if(e){const t=this.domConverter.viewPositionToDom(e),o=t.parent.ownerDocument;qi(t.parent)?this._inlineFiller=t.parent:this._inlineFiller=or(o,t.parent,t.offset)}else this._inlineFiller=null;this._updateSelection(),this._updateFocus(),this.markedTexts.clear(),this.markedAttributes.clear(),this.markedChildren.clear()}_updateChildrenMappings(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const o=this.domConverter.mapViewToDom(e).childNodes,n=Array.from(this.domConverter.viewChildrenToDom(e,t.ownerDocument,{withChildren:!1})),i=this._diffNodeLists(o,n),r=this._findReplaceActions(i,o,n);if(-1!==r.indexOf("replace")){const t={equal:0,insert:0,delete:0};for(const i of r)if("replace"===i){const i=t.equal+t.insert,r=t.equal+t.delete,s=e.getChild(i);!s||s.is("uiElement")||s.is("rawElement")||this._updateElementMappings(s,o[r]),Zi(n[i]),t.equal++}else t[i]++}}_updateElementMappings(e,t){this.domConverter.unbindDomElement(t),this.domConverter.bindElements(t,e),this.markedChildren.add(e),this.markedAttributes.add(e)}_getInlineFillerPosition(){const e=this.selection.getFirstPosition();return e.parent.is("$text")?ei._createBefore(this.selection.getFirstPosition().parent):e}_isSelectionInInlineFiller(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=this.domConverter.viewPositionToDom(e);return!!(t&&Li(t.parent)&&qi(t.parent))}_removeInlineFiller(){const e=this._inlineFiller;if(!qi(e))throw new mo.b("view-renderer-filler-was-lost: The inline filler node was lost.",this);$i(e)?e.parentNode.removeChild(e):e.data=e.data.substr(7),this._inlineFiller=null}_needsInlineFillerAtSelection(){if(1!=this.selection.rangeCount||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=e.parent,o=e.offset;if(!this.domConverter.mapViewToDom(t.root))return!1;if(!t.is("element"))return!1;if(!function(e){if("false"==e.getAttribute("contenteditable"))return!1;const t=e.findAncestor(e=>e.hasAttribute("contenteditable"));return!t||"true"==t.getAttribute("contenteditable")}(t))return!1;if(o===t.getFillerOffset())return!1;const n=e.nodeBefore,i=e.nodeAfter;return!(n instanceof No||i instanceof No)}_updateText(e,t){const o=this.domConverter.findCorrespondingDomText(e),n=this.domConverter.viewToDom(e,o.ownerDocument),i=o.data;let r=n.data;const s=t.inlineFillerPosition;if(s&&s.parent==e.parent&&s.offset==e.index&&(r=Wi+r),i!=r){const e=Ki(i,r);for(const t of e)"insert"===t.type?o.insertData(t.index,t.values.join("")):o.deleteData(t.index,t.howMany)}}_updateAttrs(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const o=Array.from(t.attributes).map(e=>e.name),n=e.getAttributeKeys();for(const o of n)t.setAttribute(o,e.getAttribute(o));for(const n of o)e.hasAttribute(n)||t.removeAttribute(n)}_updateChildren(e,t){const o=this.domConverter.mapViewToDom(e);if(!o)return;const n=t.inlineFillerPosition,i=this.domConverter.mapViewToDom(e).childNodes,r=Array.from(this.domConverter.viewChildrenToDom(e,o.ownerDocument,{bind:!0,inlineFillerPosition:n}));n&&n.parent===e&&or(o.ownerDocument,r,n.offset);const s=this._diffNodeLists(i,r);let a=0;const l=new Set;for(const e of s)"delete"===e?(l.add(i[a]),Zi(i[a])):"equal"===e&&a++;a=0;for(const e of s)"insert"===e?(Xi(o,a,r[a]),a++):"equal"===e&&(this._markDescendantTextToSync(this.domConverter.domToView(r[a])),a++);for(const e of l)e.parentNode||this.domConverter.unbindDomElement(e)}_diffNodeLists(e,t){return Qi(e=function(e,t){const o=Array.from(e);if(0==o.length||!t)return o;o[o.length-1]==t&&o.pop();return o}(e,this._fakeSelectionContainer),t,ir.bind(null,this.domConverter))}_findReplaceActions(e,t,o){if(-1===e.indexOf("insert")||-1===e.indexOf("delete"))return e;let n=[],i=[],r=[];const s={equal:0,insert:0,delete:0};for(const a of e)"insert"===a?r.push(o[s.equal+s.insert]):"delete"===a?i.push(t[s.equal+s.delete]):(n=n.concat(Qi(i,r,nr).map(e=>"equal"===e?"replace":e)),n.push("equal"),i=[],r=[]),s[a]++;return n.concat(Qi(i,r,nr).map(e=>"equal"===e?"replace":e))}_markDescendantTextToSync(e){if(e)if(e.is("$text"))this.markedTexts.add(e);else if(e.is("element"))for(const t of e.getChildren())this._markDescendantTextToSync(t)}_updateSelection(){if(0===this.selection.rangeCount)return this._removeDomSelection(),void this._removeFakeSelection();const e=this.domConverter.mapViewToDom(this.selection.editableElement);this.isFocused&&e&&(this.selection.isFake?this._updateFakeSelection(e):(this._removeFakeSelection(),this._updateDomSelection(e)))}_updateFakeSelection(e){const t=e.ownerDocument;this._fakeSelectionContainer||(this._fakeSelectionContainer=function(e){const t=e.createElement("div");return Object.assign(t.style,{position:"fixed",top:0,left:"-9999px",width:"42px"}),t.textContent=" ",t}(t));const o=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(o,this.selection),!this._fakeSelectionNeedsUpdate(e))return;o.parentElement&&o.parentElement==e||e.appendChild(o),o.textContent=this.selection.fakeSelectionLabel||" ";const n=t.getSelection(),i=t.createRange();n.removeAllRanges(),i.selectNodeContents(o),n.addRange(i)}_updateDomSelection(e){const t=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(t))return;const o=this.domConverter.viewPositionToDom(this.selection.anchor),n=this.domConverter.viewPositionToDom(this.selection.focus);e.focus(),t.collapse(o.parent,o.offset),t.extend(n.parent,n.offset),mi.isGecko&&function(e,t){const o=e.parent;if(o.nodeType!=Node.ELEMENT_NODE||e.offset!=o.childNodes.length-1)return;const n=o.childNodes[e.offset];n&&"BR"==n.tagName&&t.addRange(t.getRangeAt(0))}(n,t)}_domSelectionNeedsUpdate(e){if(!this.domConverter.isDomSelectionCorrect(e))return!0;const t=e&&this.domConverter.domSelectionToView(e);return(!t||!this.selection.isEqual(t))&&!(!this.selection.isCollapsed&&this.selection.isSimilar(t))}_fakeSelectionNeedsUpdate(e){const t=this._fakeSelectionContainer,o=e.ownerDocument.getSelection();return!t||t.parentElement!==e||(o.anchorNode!==t&&!t.contains(o.anchorNode)||t.textContent!==this.selection.fakeSelectionLabel)}_removeDomSelection(){for(const e of this.domDocuments){if(e.getSelection().rangeCount){const t=e.activeElement,o=this.domConverter.mapDomToView(t);t&&o&&e.getSelection().removeAllRanges()}}}_removeFakeSelection(){const e=this._fakeSelectionContainer;e&&e.remove()}_updateFocus(){if(this.isFocused){const e=this.selection.editableElement;e&&this.domConverter.focus(e)}}}function or(e,t,o){const n=t instanceof Array?t:t.childNodes,i=n[o];if(Li(i))return i.data=Wi+i.data,i;{const i=e.createTextNode(Wi);return Array.isArray(t)?n.splice(o,0,i):Xi(t,o,i),i}}function nr(e,t){return er(e)&&er(t)&&!Li(e)&&!Li(t)&&e.nodeType!==Node.COMMENT_NODE&&t.nodeType!==Node.COMMENT_NODE&&e.tagName.toLowerCase()===t.tagName.toLowerCase()}function ir(e,t,o){return t===o||(Li(t)&&Li(o)?t.data===o.data:!(!e.isBlockFiller(t)||!e.isBlockFiller(o)))}Co(tr,qn);var rr={window:window,document:document};function sr(e){let t=0;for(;e.previousSibling;)e=e.previousSibling,t++;return t}function ar(e){const t=[];for(;e&&e.nodeType!=Node.DOCUMENT_NODE;)t.unshift(e),e=e.parentNode;return t}const lr=ji(document);class cr{constructor(e,t={}){this.document=e,this.blockFillerMode=t.blockFillerMode||"br",this.preElements=["pre"],this.blockElements=["p","div","h1","h2","h3","h4","h5","h6","li","dd","dt","figcaption","td","th"],this._blockFiller="br"==this.blockFillerMode?ji:Hi,this._domToViewMapping=new WeakMap,this._viewToDomMapping=new WeakMap,this._fakeSelectionMapping=new WeakMap}bindFakeSelection(e,t){this._fakeSelectionMapping.set(e,new ii(t))}fakeSelectionToView(e){return this._fakeSelectionMapping.get(e)}bindElements(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}unbindDomElement(e){const t=this._domToViewMapping.get(e);if(t){this._domToViewMapping.delete(e),this._viewToDomMapping.delete(t);for(const t of e.childNodes)this.unbindDomElement(t)}}bindDocumentFragments(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}viewToDom(e,t,o={}){if(e.is("$text")){const o=this._processDataFromViewText(e);return t.createTextNode(o)}{if(this.mapViewToDom(e))return this.mapViewToDom(e);let n;if(e.is("documentFragment"))n=t.createDocumentFragment(),o.bind&&this.bindDocumentFragments(n,e);else{if(e.is("uiElement"))return n=e.render(t),o.bind&&this.bindElements(n,e),n;n=e.hasAttribute("xmlns")?t.createElementNS(e.getAttribute("xmlns"),e.name):t.createElement(e.name),e.is("rawElement")&&e.render(n),o.bind&&this.bindElements(n,e);for(const t of e.getAttributeKeys())n.setAttribute(t,e.getAttribute(t))}if(o.withChildren||void 0===o.withChildren)for(const i of this.viewChildrenToDom(e,t,o))n.appendChild(i);return n}}*viewChildrenToDom(e,t,o={}){const n=e.getFillerOffset&&e.getFillerOffset();let i=0;for(const r of e.getChildren())n===i&&(yield this._blockFiller(t)),yield this.viewToDom(r,t,o),i++;n===i&&(yield this._blockFiller(t))}viewRangeToDom(e){const t=this.viewPositionToDom(e.start),o=this.viewPositionToDom(e.end),n=document.createRange();return n.setStart(t.parent,t.offset),n.setEnd(o.parent,o.offset),n}viewPositionToDom(e){const t=e.parent;if(t.is("$text")){const o=this.findCorrespondingDomText(t);if(!o)return null;let n=e.offset;return qi(o)&&(n+=7),{parent:o,offset:n}}{let o,n,i;if(0===e.offset){if(o=this.mapViewToDom(t),!o)return null;i=o.childNodes[0]}else{const t=e.nodeBefore;if(n=t.is("$text")?this.findCorrespondingDomText(t):this.mapViewToDom(e.nodeBefore),!n)return null;o=n.parentNode,i=n.nextSibling}if(Li(i)&&qi(i))return{parent:i,offset:7};return{parent:o,offset:n?sr(n)+1:0}}}domToView(e,t={}){if(this.isBlockFiller(e,this.blockFillerMode))return null;const o=this.getHostViewElement(e,this._domToViewMapping);if(o)return o;if(Li(e)){if($i(e))return null;{const t=this._processDataFromDomText(e);return""===t?null:new No(this.document,t)}}if(this.isComment(e))return null;{if(this.mapDomToView(e))return this.mapDomToView(e);let o;if(this.isDocumentFragment(e))o=new Ei(this.document),t.bind&&this.bindDocumentFragments(e,o);else{const n=t.keepOriginalCase?e.tagName:e.tagName.toLowerCase();o=new Nn(this.document,n),t.bind&&this.bindElements(e,o);const i=e.attributes;for(let e=i.length-1;e>=0;e--)o._setAttribute(i[e].name,i[e].value)}if(t.withChildren||void 0===t.withChildren)for(const n of this.domChildrenToView(e,t))o._appendChild(n);return o}}*domChildrenToView(e,t={}){for(let o=0;o{const{scrollLeft:t,scrollTop:o}=e;n.push([t,o])}),t.focus(),hr(t,e=>{const[t,o]=n.shift();e.scrollLeft=t,e.scrollTop=o}),rr.window.scrollTo(e,o)}}isElement(e){return e&&e.nodeType==Node.ELEMENT_NODE}isDocumentFragment(e){return e&&e.nodeType==Node.DOCUMENT_FRAGMENT_NODE}isComment(e){return e&&e.nodeType==Node.COMMENT_NODE}isBlockFiller(e){return"br"==this.blockFillerMode?e.isEqualNode(lr):!("BR"!==e.tagName||!ur(e,this.blockElements)||1!==e.parentNode.childNodes.length)||function(e,t){return Li(e)&&" "==e.data&&ur(e,t)&&1===e.parentNode.childNodes.length}(e,this.blockElements)}isDomSelectionBackward(e){if(e.isCollapsed)return!1;const t=document.createRange();t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset);const o=t.collapsed;return t.detach(),o}getHostViewElement(e){const t=ar(e);for(t.pop();t.length;){const e=t.pop(),o=this._domToViewMapping.get(e);if(o&&(o.is("uiElement")||o.is("rawElement")))return o}return null}isDomSelectionCorrect(e){return this._isDomSelectionPositionCorrect(e.anchorNode,e.anchorOffset)&&this._isDomSelectionPositionCorrect(e.focusNode,e.focusOffset)}_isDomSelectionPositionCorrect(e,t){if(Li(e)&&qi(e)&&t<7)return!1;if(this.isElement(e)&&qi(e.childNodes[t]))return!1;const o=this.mapDomToView(e);return!o||!o.is("uiElement")&&!o.is("rawElement")}_processDataFromViewText(e){let t=e.data;if(e.getAncestors().some(e=>this.preElements.includes(e.name)))return t;if(" "==t.charAt(0)){const o=this._getTouchingViewTextNode(e,!1);!(o&&this._nodeEndsWithSpace(o))&&o||(t=" "+t.substr(1))}if(" "==t.charAt(t.length-1)){const o=this._getTouchingViewTextNode(e,!0);" "!=t.charAt(t.length-2)&&o&&" "!=o.data.charAt(0)||(t=t.substr(0,t.length-1)+" ")}return t.replace(/ {2}/g,"  ")}_nodeEndsWithSpace(e){if(e.getAncestors().some(e=>this.preElements.includes(e.name)))return!1;const t=this._processDataFromViewText(e);return" "==t.charAt(t.length-1)}_processDataFromDomText(e){let t=e.data;if(dr(e,this.preElements))return Ui(e);t=t.replace(/[ \n\t\r]{1,}/g," ");const o=this._getTouchingInlineDomNode(e,!1),n=this._getTouchingInlineDomNode(e,!0),i=this._checkShouldLeftTrimDomText(o),r=this._checkShouldRightTrimDomText(e,n);return i&&(t=t.replace(/^ /,"")),r&&(t=t.replace(/ $/,"")),t=Ui(new Text(t)),t=t.replace(/ \u00A0/g," "),(/( |\u00A0)\u00A0$/.test(t)||!n||n.data&&" "==n.data.charAt(0))&&(t=t.replace(/\u00A0$/," ")),i&&(t=t.replace(/^\u00A0/," ")),t}_checkShouldLeftTrimDomText(e){return!e||(!!no(e)||/[^\S\u00A0]/.test(e.data.charAt(e.data.length-1)))}_checkShouldRightTrimDomText(e,t){return!t&&!qi(e)}_getTouchingViewTextNode(e,t){const o=new Zn({startPosition:t?ei._createAfter(e):ei._createBefore(e),direction:t?"forward":"backward"});for(const e of o){if(e.item.is("containerElement"))return null;if(e.item.is("element","br"))return null;if(e.item.is("$textProxy"))return e.item}return null}_getTouchingInlineDomNode(e,t){if(!e.parentNode)return null;const o=t?"nextNode":"previousNode",n=e.ownerDocument,i=ar(e)[0],r=n.createTreeWalker(i,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT,{acceptNode:e=>Li(e)||"BR"==e.tagName?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});r.currentNode=e;const s=r[o]();if(null!==s){const t=function(e,t){const o=ar(e),n=ar(t);let i=0;for(;o[i]==n[i]&&o[i];)i++;return 0===i?null:o[i-1]}(e,s);if(t&&!dr(e,this.blockElements,t)&&!dr(s,this.blockElements,t))return s}return null}}function dr(e,t,o){let n=ar(e);return o&&(n=n.slice(n.indexOf(o)+1)),n.some(e=>e.tagName&&t.includes(e.tagName.toLowerCase()))}function hr(e,t){for(;e&&e!=rr.document;)t(e),e=e.parentNode}function ur(e,t){const o=e.parentNode;return o&&o.tagName&&t.includes(o.tagName.toLowerCase())}function mr(e){const t=Object.prototype.toString.apply(e);return"[object Window]"==t||"[object global]"==t}var gr=Dn({},po,{listenTo(e,...t){if(er(e)||mr(e)){const o=this._getProxyEmitter(e)||new fr(e);o.attach(...t),e=o}po.listenTo.call(this,e,...t)},stopListening(e,t,o){if(er(e)||mr(e)){const t=this._getProxyEmitter(e);if(!t)return;e=t}po.stopListening.call(this,e,t,o),e instanceof fr&&e.detach(t)},_getProxyEmitter(e){return t=this,o=pr(e),t[go]&&t[go][o]?t[go][o].emitter:null;var t,o}});class fr{constructor(e){bo(this,pr(e)),this._domNode=e}}function pr(e){return e["data-ck-expando"]||(e["data-ck-expando"]=ho())}Dn(fr.prototype,po,{attach(e,t,o={}){if(this._domListeners&&this._domListeners[e])return;const n={capture:!!o.useCapture,passive:!!o.usePassive},i=this._createDomListener(e,n);this._domNode.addEventListener(e,i,n),this._domListeners||(this._domListeners={}),this._domListeners[e]=i},detach(e){let t;!this._domListeners[e]||(t=this._events[e])&&t.callbacks.length||this._domListeners[e].removeListener()},_createDomListener(e,t){const o=t=>{this.fire(e,t)};return o.removeListener=()=>{this._domNode.removeEventListener(e,o,t),delete this._domListeners[e]},o}});class br{constructor(e){this.view=e,this.document=e.document,this.isEnabled=!1}enable(){this.isEnabled=!0}disable(){this.isEnabled=!1}destroy(){this.disable(),this.stopListening()}}Co(br,gr);var wr=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};var kr=function(e){return this.__data__.has(e)};function _r(e){var t=-1,o=null==e?0:e.length;for(this.__data__=new _e;++ta))return!1;var c=r.get(e);if(c&&r.get(t))return c==t;var d=-1,h=!0,u=2&o?new vr:void 0;for(r.set(e,t),r.set(t,e);++d{this.listenTo(e,t,(e,t)=>{this.isEnabled&&this.onDomEvent(t)},{useCapture:this.useCapture})})}fire(e,t,o){this.isEnabled&&this.document.fire(e,new Br(this.view,t,o))}}class Dr extends Fr{constructor(e){super(e),this.domEventType=["keydown","keyup"]}onDomEvent(e){this.fire(e.type,e,{keyCode:e.keyCode,altKey:e.altKey,ctrlKey:e.ctrlKey||e.metaKey,shiftKey:e.shiftKey,get keystroke(){return bi(this)}})}}var Lr=function(){return n.a.Date.now()},Hr=/^\s+|\s+$/g,jr=/^[-+]0x[0-9a-f]+$/i,Wr=/^0b[01]+$/i,qr=/^0o[0-7]+$/i,$r=parseInt;var Ur=function(e){if("number"==typeof e)return e;if(Lo(e))return NaN;if(B(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=B(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Hr,"");var o=Wr.test(e);return o||qr.test(e)?$r(e.slice(2),o?2:8):jr.test(e)?NaN:+e},Gr=Math.max,Kr=Math.min;var Jr=function(e,t,o){var n,i,r,s,a,l,c=0,d=!1,h=!1,u=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function m(t){var o=n,r=i;return n=i=void 0,c=t,s=e.apply(r,o)}function g(e){return c=e,a=setTimeout(p,t),d?m(e):s}function f(e){var o=e-l;return void 0===l||o>=t||o<0||h&&e-c>=r}function p(){var e=Lr();if(f(e))return b(e);a=setTimeout(p,function(e){var o=t-(e-l);return h?Kr(o,r-(e-c)):o}(e))}function b(e){return a=void 0,u&&n?m(e):(n=i=void 0,s)}function w(){var e=Lr(),o=f(e);if(n=arguments,i=this,l=e,o){if(void 0===a)return g(l);if(h)return clearTimeout(a),a=setTimeout(p,t),m(l)}return void 0===a&&(a=setTimeout(p,t)),s}return t=Ur(t)||0,B(o)&&(d=!!o.leading,r=(h="maxWait"in o)?Gr(Ur(o.maxWait)||0,t):r,u="trailing"in o?!!o.trailing:u),w.cancel=function(){void 0!==a&&clearTimeout(a),c=0,n=l=i=a=void 0},w.flush=function(){return void 0===a?s:b(Lr())},w};class Yr extends br{constructor(e){super(e),this._fireSelectionChangeDoneDebounced=Jr(e=>this.document.fire("selectionChangeDone",e),200)}observe(){const e=this.document;e.on("keydown",(t,o)=>{var n;e.selection.isFake&&((n=o.keyCode)==pi.arrowright||n==pi.arrowleft||n==pi.arrowup||n==pi.arrowdown)&&this.isEnabled&&(o.preventDefault(),this._handleSelectionMove(o.keyCode))},{priority:"lowest"})}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(e){const t=this.document.selection,o=new ii(t.getRanges(),{backward:t.isBackward,fake:!1});e!=pi.arrowleft&&e!=pi.arrowup||o.setTo(o.getFirstPosition()),e!=pi.arrowright&&e!=pi.arrowdown||o.setTo(o.getLastPosition());const n={oldSelection:t,newSelection:o,domSelection:null};this.document.fire("selectionChange",n),this._fireSelectionChangeDoneDebounced(n)}}class Qr extends br{constructor(e){super(e),this.mutationObserver=e.getObserver(zr),this.selection=this.document.selection,this.domConverter=e.domConverter,this._documents=new WeakSet,this._fireSelectionChangeDoneDebounced=Jr(e=>this.document.fire("selectionChangeDone",e),200),this._clearInfiniteLoopInterval=setInterval(()=>this._clearInfiniteLoop(),1e3),this._loopbackCounter=0}observe(e){const t=e.ownerDocument;this._documents.has(t)||(this.listenTo(t,"selectionchange",()=>{this._handleSelectionChange(t)}),this._documents.add(t))}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionChange(e){if(!this.isEnabled)return;this.mutationObserver.flush();const t=e.defaultView.getSelection(),o=this.domConverter.domSelectionToView(t);if(0!=o.rangeCount){if(this.view.hasDomSelection=!0,!(this.selection.isEqual(o)&&this.domConverter.isDomSelectionCorrect(t)||++this._loopbackCounter>60))if(this.selection.isSimilar(o))this.view.forceRender();else{const e={oldSelection:this.selection,newSelection:o,domSelection:t};this.document.fire("selectionChange",e),this._fireSelectionChangeDoneDebounced(e)}}else this.view.hasDomSelection=!1}_clearInfiniteLoop(){this._loopbackCounter=0}}class Xr extends Fr{constructor(e){super(e),this.domEventType=["focus","blur"],this.useCapture=!0;const t=this.document;t.on("focus",()=>{t.isFocused=!0,this._renderTimeoutId=setTimeout(()=>e.forceRender(),50)}),t.on("blur",(o,n)=>{const i=t.selection.editableElement;null!==i&&i!==n.target||(t.isFocused=!1,e.forceRender())})}onDomEvent(e){this.fire(e.type,e)}destroy(){this._renderTimeoutId&&clearTimeout(this._renderTimeoutId),super.destroy()}}class Zr extends Fr{constructor(e){super(e),this.domEventType=["compositionstart","compositionupdate","compositionend"];const t=this.document;t.on("compositionstart",()=>{t.isComposing=!0}),t.on("compositionend",()=>{t.isComposing=!1})}onDomEvent(e){this.fire(e.type,e)}}class es extends Fr{constructor(e){super(e),this.domEventType=["beforeinput"]}onDomEvent(e){this.fire(e.type,e)}}function ts(e){return"[object Range]"==Object.prototype.toString.apply(e)}function os(e){const t=e.ownerDocument.defaultView.getComputedStyle(e);return{top:parseInt(t.borderTopWidth,10),right:parseInt(t.borderRightWidth,10),bottom:parseInt(t.borderBottomWidth,10),left:parseInt(t.borderLeftWidth,10)}}const ns=["top","right","bottom","left","width","height"];class is{constructor(e){const t=ts(e);if(Object.defineProperty(this,"_source",{value:e._source||e,writable:!0,enumerable:!1}),no(e)||t)if(t){const t=is.getDomRangeRects(e);rs(this,is.getBoundingRect(t))}else rs(this,e.getBoundingClientRect());else if(mr(e)){const{innerWidth:t,innerHeight:o}=e;rs(this,{top:0,right:t,bottom:o,left:0,width:t,height:o})}else rs(this,e)}clone(){return new is(this)}moveTo(e,t){return this.top=t,this.right=e+this.width,this.bottom=t+this.height,this.left=e,this}moveBy(e,t){return this.top+=t,this.right+=e,this.left+=e,this.bottom+=t,this}getIntersection(e){const t={top:Math.max(this.top,e.top),right:Math.min(this.right,e.right),bottom:Math.min(this.bottom,e.bottom),left:Math.max(this.left,e.left)};return t.width=t.right-t.left,t.height=t.bottom-t.top,t.width<0||t.height<0?null:new is(t)}getIntersectionArea(e){const t=this.getIntersection(e);return t?t.getArea():0}getArea(){return this.width*this.height}getVisible(){const e=this._source;let t=this.clone();if(!ss(e)){let o=e.parentNode||e.commonAncestorContainer;for(;o&&!ss(o);){const e=new is(o),n=t.getIntersection(e);if(!n)return null;n.getArea()ps(e,n));const s=ps(e,n);if(ls(n,s,t),n.parent!=n){if(i=n.frameElement,n=n.parent,!i)return}else n=null}}function ls(e,t,o){const n=t.clone().moveBy(0,o),i=t.clone().moveBy(0,-o),r=new is(e).excludeScrollbarsAndBorders();if(![i,n].every(e=>r.contains(e))){let{scrollX:s,scrollY:a}=e;hs(i,r)?a-=r.top-t.top+o:ds(n,r)&&(a+=t.bottom-r.bottom+o),us(t,r)?s-=r.left-t.left+o:ms(t,r)&&(s+=t.right-r.right+o),e.scrollTo(s,a)}}function cs(e,t){const o=gs(e);let n,i;for(;e!=o.document.body;)i=t(),n=new is(e).excludeScrollbarsAndBorders(),n.contains(i)||(hs(i,n)?e.scrollTop-=n.top-i.top:ds(i,n)&&(e.scrollTop+=i.bottom-n.bottom),us(i,n)?e.scrollLeft-=n.left-i.left:ms(i,n)&&(e.scrollLeft+=i.right-n.right)),e=e.parentNode}function ds(e,t){return e.bottom>t.bottom}function hs(e,t){return e.topt.right}function gs(e){return ts(e)?e.startContainer.ownerDocument.defaultView:e.ownerDocument.defaultView}function fs(e){if(ts(e)){let t=e.commonAncestorContainer;return Li(t)&&(t=t.parentNode),t}return e.parentNode}function ps(e,t){const o=gs(e),n=new is(e);if(o===t)return n;{let e=o;for(;e!=t;){const t=e.frameElement,o=new is(t).excludeScrollbarsAndBorders();n.moveBy(o.left,o.top),e=e.parent}}return n}Object.assign({},{scrollViewportToShowTarget:as,scrollAncestorsToShowTarget:function(e){cs(fs(e),()=>new is(e))}});class bs{constructor(e){this.document=new si(e),this.domConverter=new cr(this.document),this.domRoots=new Map,this.set("isRenderingInProgress",!1),this.set("hasDomSelection",!1),this._renderer=new tr(this.domConverter,this.document.selection),this._renderer.bind("isFocused").to(this.document),this._initialDomRootAttributes=new WeakMap,this._observers=new Map,this._ongoingChange=!1,this._postFixersInProgress=!1,this._renderingDisabled=!1,this._hasChangedSinceTheLastRendering=!1,this._writer=new Ri(this.document),this.addObserver(zr),this.addObserver(Qr),this.addObserver(Xr),this.addObserver(Dr),this.addObserver(Yr),this.addObserver(Zr),mi.isAndroid&&this.addObserver(es),this.document.on("keydown",Gi),Ai(this),this.on("render",()=>{this._render(),this.document.fire("layoutChanged"),this._hasChangedSinceTheLastRendering=!1}),this.listenTo(this.document.selection,"change",()=>{this._hasChangedSinceTheLastRendering=!0})}attachDomRoot(e,t="main"){const o=this.document.getRoot(t);o._name=e.tagName.toLowerCase();const n={};for(const{name:t,value:i}of Array.from(e.attributes))n[t]=i,"class"===t?this._writer.addClass(i.split(" "),o):this._writer.setAttribute(t,i,o);this._initialDomRootAttributes.set(e,n);const i=()=>{this._writer.setAttribute("contenteditable",!o.isReadOnly,o),o.isReadOnly?this._writer.addClass("ck-read-only",o):this._writer.removeClass("ck-read-only",o)};i(),this.domRoots.set(t,e),this.domConverter.bindElements(e,o),this._renderer.markToSync("children",o),this._renderer.markToSync("attributes",o),this._renderer.domDocuments.add(e.ownerDocument),o.on("change:children",(e,t)=>this._renderer.markToSync("children",t)),o.on("change:attributes",(e,t)=>this._renderer.markToSync("attributes",t)),o.on("change:text",(e,t)=>this._renderer.markToSync("text",t)),o.on("change:isReadOnly",()=>this.change(i)),o.on("change",()=>{this._hasChangedSinceTheLastRendering=!0});for(const o of this._observers.values())o.observe(e,t)}detachDomRoot(e){const t=this.domRoots.get(e);Array.from(t.attributes).forEach(({name:e})=>t.removeAttribute(e));const o=this._initialDomRootAttributes.get(t);for(const e in o)t.setAttribute(e,o[e]);this.domRoots.delete(e),this.domConverter.unbindDomElement(t)}getDomRoot(e="main"){return this.domRoots.get(e)}addObserver(e){let t=this._observers.get(e);if(t)return t;t=new e(this),this._observers.set(e,t);for(const[e,o]of this.domRoots)t.observe(o,e);return t.enable(),t}getObserver(e){return this._observers.get(e)}disableObservers(){for(const e of this._observers.values())e.disable()}enableObservers(){for(const e of this._observers.values())e.enable()}scrollToTheSelection(){const e=this.document.selection.getFirstRange();e&&as({target:this.domConverter.viewRangeToDom(e),viewportOffset:20})}focus(){if(!this.document.isFocused){const e=this.document.selection.editableElement;e&&(this.domConverter.focus(e),this.forceRender())}}change(e){if(this.isRenderingInProgress||this._postFixersInProgress)throw new mo.b("cannot-change-view-tree: Attempting to make changes to the view when it is in an incorrect state: rendering or post-fixers are in progress. This may cause some unexpected behavior and inconsistency between the DOM and the view.",this);try{if(this._ongoingChange)return e(this._writer);this._ongoingChange=!0;const t=e(this._writer);return this._ongoingChange=!1,!this._renderingDisabled&&this._hasChangedSinceTheLastRendering&&(this._postFixersInProgress=!0,this.document._callPostFixers(this._writer),this._postFixersInProgress=!1,this.fire("render")),t}catch(e){mo.b.rethrowUnexpectedError(e,this)}}forceRender(){this._hasChangedSinceTheLastRendering=!0,this.change(()=>{})}destroy(){for(const e of this._observers.values())e.destroy();this.document.destroy(),this.stopListening()}createPositionAt(e,t){return ei._createAt(e,t)}createPositionAfter(e){return ei._createAfter(e)}createPositionBefore(e){return ei._createBefore(e)}createRange(e,t){return new ti(e,t)}createRangeOn(e){return ti._createOn(e)}createRangeIn(e){return ti._createIn(e)}createSelection(e,t,o){return new ii(e,t,o)}_disableRendering(e){this._renderingDisabled=e,0==e&&this.change(()=>{})}_render(){this.isRenderingInProgress=!0,this.disableObservers(),this._renderer.render(),this.enableObservers(),this.isRenderingInProgress=!1}}Co(bs,qn);class ws{constructor(e){this.parent=null,this._attrs=Bo(e)}get index(){let e;if(!this.parent)return null;if(null===(e=this.parent.getChildIndex(this)))throw new mo.b("model-node-not-found-in-parent: The node's parent does not contain this node.",this);return e}get startOffset(){let e;if(!this.parent)return null;if(null===(e=this.parent.getChildStartOffset(this)))throw new mo.b("model-node-not-found-in-parent: The node's parent does not contain this node.",this);return e}get offsetSize(){return 1}get endOffset(){return this.parent?this.startOffset+this.offsetSize:null}get nextSibling(){const e=this.index;return null!==e&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return null!==e&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.root.is("rootElement")}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.startOffset),t=t.parent;return e}getAncestors(e={includeSelf:!1,parentFirst:!1}){const t=[];let o=e.includeSelf?this:this.parent;for(;o;)t[e.parentFirst?"push":"unshift"](o),o=o.parent;return t}getCommonAncestor(e,t={}){const o=this.getAncestors(t),n=e.getAncestors(t);let i=0;for(;o[i]==n[i]&&o[i];)i++;return 0===i?null:o[i-1]}isBefore(e){if(this==e)return!1;if(this.root!==e.root)return!1;const t=this.getPath(),o=e.getPath(),n=Vo(t,o);switch(n){case"prefix":return!0;case"extension":return!1;default:return t[n](e[t[0]]=t[1],e),{})),e}is(e){return"node"===e||"model:node"===e}_clone(){return new ws(this._attrs)}_remove(){this.parent._removeChildren(this.index)}_setAttribute(e,t){this._attrs.set(e,t)}_setAttributesTo(e){this._attrs=Bo(e)}_removeAttribute(e){return this._attrs.delete(e)}_clearAttributes(){this._attrs.clear()}}class ks extends ws{constructor(e,t){super(t),this._data=e||""}get offsetSize(){return this.data.length}get data(){return this._data}is(e){return"$text"===e||"model:$text"===e||"text"===e||"model:text"===e||"node"===e||"model:node"===e}toJSON(){const e=super.toJSON();return e.data=this.data,e}_clone(){return new ks(this.data,this.getAttributes())}static fromJSON(e){return new ks(e.data,e.attributes)}}class _s{constructor(e,t,o){if(this.textNode=e,t<0||t>e.offsetSize)throw new mo.b("model-textproxy-wrong-offsetintext: Given offsetInText value is incorrect.",this);if(o<0||t+o>e.offsetSize)throw new mo.b("model-textproxy-wrong-length: Given length value is incorrect.",this);this.data=e.data.substring(t,t+o),this.offsetInText=t}get startOffset(){return null!==this.textNode.startOffset?this.textNode.startOffset+this.offsetInText:null}get offsetSize(){return this.data.length}get endOffset(){return null!==this.startOffset?this.startOffset+this.offsetSize:null}get isPartial(){return this.offsetSize!==this.textNode.offsetSize}get parent(){return this.textNode.parent}get root(){return this.textNode.root}is(e){return"$textProxy"===e||"model:$textProxy"===e||"textProxy"===e||"model:textProxy"===e}getPath(){const e=this.textNode.getPath();return e.length>0&&(e[e.length-1]+=this.offsetInText),e}getAncestors(e={includeSelf:!1,parentFirst:!1}){const t=[];let o=e.includeSelf?this:this.parent;for(;o;)t[e.parentFirst?"push":"unshift"](o),o=o.parent;return t}hasAttribute(e){return this.textNode.hasAttribute(e)}getAttribute(e){return this.textNode.getAttribute(e)}getAttributes(){return this.textNode.getAttributes()}getAttributeKeys(){return this.textNode.getAttributeKeys()}}class vs{constructor(e){this._nodes=[],e&&this._insertNodes(0,e)}[Symbol.iterator](){return this._nodes[Symbol.iterator]()}get length(){return this._nodes.length}get maxOffset(){return this._nodes.reduce((e,t)=>e+t.offsetSize,0)}getNode(e){return this._nodes[e]||null}getNodeIndex(e){const t=this._nodes.indexOf(e);return-1==t?null:t}getNodeStartOffset(e){const t=this.getNodeIndex(e);return null===t?null:this._nodes.slice(0,t).reduce((e,t)=>e+t.offsetSize,0)}indexToOffset(e){if(e==this._nodes.length)return this.maxOffset;const t=this._nodes[e];if(!t)throw new mo.b("model-nodelist-index-out-of-bounds: Given index cannot be found in the node list.",this);return this.getNodeStartOffset(t)}offsetToIndex(e){let t=0;for(const o of this._nodes){if(e>=t&&ee.toJSON())}}class ys extends ws{constructor(e,t,o){super(t),this.name=e,this._children=new vs,o&&this._insertChild(0,o)}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return 0===this.childCount}is(e,t=null){return t?t===this.name&&("element"===e||"model:element"===e):"element"===e||"model:element"===e||"node"===e||"model:node"===e}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}offsetToIndex(e){return this._children.offsetToIndex(e)}getNodeByPath(e){let t=this;for(const o of e)t=t.getChild(t.offsetToIndex(o));return t}findAncestor(e,t={includeSelf:!1}){let o=t.includeSelf?this:this.parent;for(;o;){if(o.name===e)return o;o=o.parent}return null}toJSON(){const e=super.toJSON();if(e.name=this.name,this._children.length>0){e.children=[];for(const t of this._children)e.children.push(t.toJSON())}return e}_clone(e=!1){const t=e?Array.from(this._children).map(e=>e._clone(!0)):null;return new ys(this.name,this.getAttributes(),t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const o=function(e){if("string"==typeof e)return[new ks(e)];xo(e)||(e=[e]);return Array.from(e).map(e=>"string"==typeof e?new ks(e):e instanceof _s?new ks(e.data,e.getAttributes()):e)}(t);for(const e of o)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,o)}_removeChildren(e,t=1){const o=this._children._removeNodes(e,t);for(const e of o)e.parent=null;return o}static fromJSON(e){let t=null;if(e.children){t=[];for(const o of e.children)o.name?t.push(ys.fromJSON(o)):t.push(ks.fromJSON(o))}return new ys(e.name,e.attributes,t)}}class xs{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new mo.b("model-tree-walker-no-start-position: Neither boundaries nor starting position have been defined.",null);const t=e.direction||"forward";if("forward"!=t&&"backward"!=t)throw new mo.b("model-tree-walker-unknown-direction: Only `backward` and `forward` direction allowed.",e,{direction:t});this.direction=t,this.boundaries=e.boundaries||null,e.startPosition?this.position=e.startPosition.clone():this.position=As._createAt(this.boundaries["backward"==this.direction?"end":"start"]),this.position.stickiness="toNone",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null,this._visitedParent=this.position.parent}[Symbol.iterator](){return this}skip(e){let t,o,n,i;do{n=this.position,i=this._visitedParent,({done:t,value:o}=this.next())}while(!t&&e(o));t||(this.position=n,this._visitedParent=i)}next(){return"forward"==this.direction?this._next():this._previous()}_next(){const e=this.position,t=this.position.clone(),o=this._visitedParent;if(null===o.parent&&t.offset===o.maxOffset)return{done:!0};if(o===this._boundaryEndParent&&t.offset==this.boundaries.end.offset)return{done:!0};const n=t.parent,i=Ts(t,n),r=i||Ps(t,n,i);if(r instanceof ys)return this.shallow?t.offset++:(t.path.push(0),this._visitedParent=r),this.position=t,Cs("elementStart",r,e,t,1);if(r instanceof ks){let n;if(this.singleCharacters)n=1;else{let e=r.endOffset;this._boundaryEndParent==o&&this.boundaries.end.offsete&&(e=this.boundaries.start.offset),n=t.offset-e}const i=t.offset-r.startOffset,s=new _s(r,i-n,n);return t.offset-=n,this.position=t,Cs("text",s,e,t,n)}return t.path.pop(),this.position=t,this._visitedParent=o.parent,Cs("elementStart",o,e,t,1)}}function Cs(e,t,o,n,i){return{done:!1,value:{type:e,item:t,previousPosition:o,nextPosition:n,length:i}}}class As{constructor(e,t,o="toNone"){if(!e.is("element")&&!e.is("documentFragment"))throw new mo.b("model-position-root-invalid: Position root invalid.",e);if(!(t instanceof Array)||0===t.length)throw new mo.b("model-position-path-incorrect-format: Position path must be an array with at least one item.",e,{path:t});e.is("rootElement")?t=t.slice():(t=[...e.getPath(),...t],e=e.root),this.root=e,this.path=t,this.stickiness=o}get offset(){return this.path[this.path.length-1]}set offset(e){this.path[this.path.length-1]=e}get parent(){let e=this.root;for(let t=0;to.path.length){if(t.offset!==n.maxOffset)return!1;t.path=t.path.slice(0,-1),n=n.parent,t.offset++}else{if(0!==o.offset)return!1;o.path=o.path.slice(0,-1)}}}is(e){return"position"===e||"model:position"===e}hasSameParentAs(e){if(this.root!==e.root)return!1;return"same"==Vo(this.getParentPath(),e.getParentPath())}getTransformedByOperation(e){let t;switch(e.type){case"insert":t=this._getTransformedByInsertOperation(e);break;case"move":case"remove":case"reinsert":t=this._getTransformedByMoveOperation(e);break;case"split":t=this._getTransformedBySplitOperation(e);break;case"merge":t=this._getTransformedByMergeOperation(e);break;default:t=As._createAt(this)}return t}_getTransformedByInsertOperation(e){return this._getTransformedByInsertion(e.position,e.howMany)}_getTransformedByMoveOperation(e){return this._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany)}_getTransformedBySplitOperation(e){const t=e.movedRange;return t.containsPosition(this)||t.start.isEqual(this)&&"toNext"==this.stickiness?this._getCombined(e.splitPosition,e.moveTargetPosition):e.graveyardPosition?this._getTransformedByMove(e.graveyardPosition,e.insertionPosition,1):this._getTransformedByInsertion(e.insertionPosition,1)}_getTransformedByMergeOperation(e){const t=e.movedRange;let o;return t.containsPosition(this)||t.start.isEqual(this)?(o=this._getCombined(e.sourcePosition,e.targetPosition),e.sourcePosition.isBefore(e.targetPosition)&&(o=o._getTransformedByDeletion(e.deletionPosition,1))):o=this.isEqual(e.deletionPosition)?As._createAt(e.deletionPosition):this._getTransformedByMove(e.deletionPosition,e.graveyardPosition,1),o}_getTransformedByDeletion(e,t){const o=As._createAt(this);if(this.root!=e.root)return o;if("same"==Vo(e.getParentPath(),this.getParentPath())){if(e.offsetthis.offset)return null;o.offset-=t}}else if("prefix"==Vo(e.getParentPath(),this.getParentPath())){const n=e.path.length-1;if(e.offset<=this.path[n]){if(e.offset+t>this.path[n])return null;o.path[n]-=t}}return o}_getTransformedByInsertion(e,t){const o=As._createAt(this);if(this.root!=e.root)return o;if("same"==Vo(e.getParentPath(),this.getParentPath()))(e.offsett+1;){const t=n.maxOffset-o.offset;0!==t&&e.push(new Es(o,o.getShiftedBy(t))),o.path=o.path.slice(0,-1),o.offset++,n=n.parent}for(;o.path.length<=this.end.path.length;){const t=this.end.path[o.path.length-1],n=t-o.offset;0!==n&&e.push(new Es(o,o.getShiftedBy(n))),o.offset=t,o.path.push(0)}return e}getWalker(e={}){return e.boundaries=this,new xs(e)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new xs(e);for(const e of t)yield e.item}*getPositions(e={}){e.boundaries=this;const t=new xs(e);yield t.position;for(const e of t)yield e.nextPosition}getTransformedByOperation(e){switch(e.type){case"insert":return this._getTransformedByInsertOperation(e);case"move":case"remove":case"reinsert":return this._getTransformedByMoveOperation(e);case"split":return[this._getTransformedBySplitOperation(e)];case"merge":return[this._getTransformedByMergeOperation(e)]}return[new Es(this.start,this.end)]}getTransformedByOperations(e){const t=[new Es(this.start,this.end)];for(const o of e)for(let e=0;e0?new this(o,n):new this(n,o)}static _createIn(e){return new this(As._createAt(e,0),As._createAt(e,e.maxOffset))}static _createOn(e){return this._createFromPositionAndShift(As._createBefore(e),e.offsetSize)}static _createFromRanges(e){if(0===e.length)throw new mo.b("range-create-from-ranges-empty-array: At least one range has to be passed.",null);if(1==e.length)return e[0].clone();const t=e[0];e.sort((e,t)=>e.start.isAfter(t.start)?1:-1);const o=e.indexOf(t),n=new this(t.start,t.end);if(o>0)for(let t=o-1;e[t].end.isEqual(n.start);t++)n.start=As._createAt(e[t].start);for(let t=o+1;t{if(t.viewPosition)return;const o=this._modelToViewMapping.get(t.modelPosition.parent);t.viewPosition=this.findPositionIn(o,t.modelPosition.offset)},{priority:"low"}),this.on("viewToModelPosition",(e,t)=>{if(t.modelPosition)return;const o=this.findMappedViewAncestor(t.viewPosition),n=this._viewToModelMapping.get(o),i=this._toModelOffset(t.viewPosition.parent,t.viewPosition.offset,o);t.modelPosition=As._createAt(n,i)},{priority:"low"})}bindElements(e,t){this._modelToViewMapping.set(e,t),this._viewToModelMapping.set(t,e)}unbindViewElement(e){const t=this.toModelElement(e);if(this._viewToModelMapping.delete(e),this._elementToMarkerNames.has(e))for(const t of this._elementToMarkerNames.get(e))this._unboundMarkerNames.add(t);this._modelToViewMapping.get(t)==e&&this._modelToViewMapping.delete(t)}unbindModelElement(e){const t=this.toViewElement(e);this._modelToViewMapping.delete(e),this._viewToModelMapping.get(t)==e&&this._viewToModelMapping.delete(t)}bindElementToMarker(e,t){const o=this._markerNameToElements.get(t)||new Set;o.add(e);const n=this._elementToMarkerNames.get(e)||new Set;n.add(t),this._markerNameToElements.set(t,o),this._elementToMarkerNames.set(e,n)}unbindElementFromMarkerName(e,t){const o=this._markerNameToElements.get(t);o&&(o.delete(e),0==o.size&&this._markerNameToElements.delete(t));const n=this._elementToMarkerNames.get(e);n&&(n.delete(t),0==n.size&&this._elementToMarkerNames.delete(e))}flushUnboundMarkerNames(){const e=Array.from(this._unboundMarkerNames);return this._unboundMarkerNames.clear(),e}clearBindings(){this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._unboundMarkerNames=new Set}toModelElement(e){return this._viewToModelMapping.get(e)}toViewElement(e){return this._modelToViewMapping.get(e)}toModelRange(e){return new Es(this.toModelPosition(e.start),this.toModelPosition(e.end))}toViewRange(e){return new ti(this.toViewPosition(e.start),this.toViewPosition(e.end))}toModelPosition(e){const t={viewPosition:e,mapper:this};return this.fire("viewToModelPosition",t),t.modelPosition}toViewPosition(e,t={isPhantom:!1}){const o={modelPosition:e,mapper:this,isPhantom:t.isPhantom};return this.fire("modelToViewPosition",o),o.viewPosition}markerNameToElements(e){const t=this._markerNameToElements.get(e);if(!t)return null;const o=new Set;for(const e of t)if(e.is("attributeElement"))for(const t of e.getElementsWithSameId())o.add(t);else o.add(e);return o}registerViewToModelLength(e,t){this._viewToModelLengthCallbacks.set(e,t)}findMappedViewAncestor(e){let t=e.parent;for(;!this._viewToModelMapping.has(t);)t=t.parent;return t}_toModelOffset(e,t,o){if(o!=e){return this._toModelOffset(e.parent,e.index,o)+this._toModelOffset(e,t,e)}if(e.is("$text"))return t;let n=0;for(let o=0;o1?t[0]+":"+t[1]:t[0]}class Os{constructor(e){this.conversionApi=Object.assign({dispatcher:this},e)}convertChanges(e,t,o){for(const t of e.getMarkersToRemove())this.convertMarkerRemove(t.name,t.range,o);for(const t of e.getChanges())"insert"==t.type?this.convertInsert(Es._createFromPositionAndShift(t.position,t.length),o):"remove"==t.type?this.convertRemove(t.position,t.length,t.name,o):this.convertAttribute(t.range,t.attributeKey,t.attributeOldValue,t.attributeNewValue,o);for(const e of this.conversionApi.mapper.flushUnboundMarkerNames()){const n=t.get(e).getRange();this.convertMarkerRemove(e,n,o),this.convertMarkerAdd(e,n,o)}for(const t of e.getMarkersToAdd())this.convertMarkerAdd(t.name,t.range,o)}convertInsert(e,t){this.conversionApi.writer=t,this.conversionApi.consumable=this._createInsertConsumable(e);for(const t of e){const e=t.item,o={item:e,range:Es._createFromPositionAndShift(t.previousPosition,t.length)};this._testAndFire("insert",o);for(const t of e.getAttributeKeys())o.attributeKey=t,o.attributeOldValue=null,o.attributeNewValue=e.getAttribute(t),this._testAndFire("attribute:"+t,o)}this._clearConversionApi()}convertRemove(e,t,o,n){this.conversionApi.writer=n,this.fire("remove:"+o,{position:e,length:t},this.conversionApi),this._clearConversionApi()}convertAttribute(e,t,o,n,i){this.conversionApi.writer=i,this.conversionApi.consumable=this._createConsumableForRange(e,"attribute:"+t);for(const i of e){const e={item:i.item,range:Es._createFromPositionAndShift(i.previousPosition,i.length),attributeKey:t,attributeOldValue:o,attributeNewValue:n};this._testAndFire("attribute:"+t,e)}this._clearConversionApi()}convertSelection(e,t,o){const n=Array.from(t.getMarkersAtPosition(e.getFirstPosition()));if(this.conversionApi.writer=o,this.conversionApi.consumable=this._createSelectionConsumable(e,n),this.fire("selection",{selection:e},this.conversionApi),e.isCollapsed){for(const t of n){const o=t.getRange();if(!Ms(e.getFirstPosition(),t,this.conversionApi.mapper))continue;const n={item:e,markerName:t.name,markerRange:o};this.conversionApi.consumable.test(e,"addMarker:"+t.name)&&this.fire("addMarker:"+t.name,n,this.conversionApi)}for(const t of e.getAttributeKeys()){const o={item:e,range:e.getFirstRange(),attributeKey:t,attributeOldValue:null,attributeNewValue:e.getAttribute(t)};this.conversionApi.consumable.test(e,"attribute:"+o.attributeKey)&&this.fire("attribute:"+o.attributeKey+":$text",o,this.conversionApi)}this._clearConversionApi()}}convertMarkerAdd(e,t,o){if(!t.root.document||"$graveyard"==t.root.rootName)return;this.conversionApi.writer=o;const n="addMarker:"+e,i=new Is;if(i.add(t,n),this.conversionApi.consumable=i,this.fire(n,{markerName:e,markerRange:t},this.conversionApi),i.test(t,n)){this.conversionApi.consumable=this._createConsumableForRange(t,n);for(const o of t.getItems()){if(!this.conversionApi.consumable.test(o,n))continue;const i={item:o,range:Es._createOn(o),markerName:e,markerRange:t};this.fire(n,i,this.conversionApi)}this._clearConversionApi()}}convertMarkerRemove(e,t,o){t.root.document&&"$graveyard"!=t.root.rootName&&(this.conversionApi.writer=o,this.fire("removeMarker:"+e,{markerName:e,markerRange:t},this.conversionApi),this._clearConversionApi())}_createInsertConsumable(e){const t=new Is;for(const o of e){const e=o.item;t.add(e,"insert");for(const o of e.getAttributeKeys())t.add(e,"attribute:"+o)}return t}_createConsumableForRange(e,t){const o=new Is;for(const n of e.getItems())o.add(n,t);return o}_createSelectionConsumable(e,t){const o=new Is;o.add(e,"selection");for(const n of t)o.add(e,"addMarker:"+n.name);for(const t of e.getAttributeKeys())o.add(e,"attribute:"+t);return o}_testAndFire(e,t){if(!this.conversionApi.consumable.test(t.item,e))return;const o=t.item.name||"$text";this.fire(e+":"+o,t,this.conversionApi)}_clearConversionApi(){delete this.conversionApi.writer,delete this.conversionApi.consumable}}function Ms(e,t,o){const n=t.getRange(),i=Array.from(e.getAncestors());i.shift(),i.reverse();return!i.some(e=>{if(n.containsItem(e)){return!!o.toViewElement(e).getCustomProperty("addHighlight")}})}Co(Os,po);class Ns{constructor(e,t,o){this._lastRangeBackward=!1,this._ranges=[],this._attrs=new Map,e&&this.setTo(e,t,o)}get anchor(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.end:e.start}return null}get focus(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.start:e.end}return null}get isCollapsed(){return 1===this._ranges.length&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}isEqual(e){if(this.rangeCount!=e.rangeCount)return!1;if(0===this.rangeCount)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let o=!1;for(const n of e._ranges)if(t.isEqual(n)){o=!0;break}if(!o)return!1}return!0}*getRanges(){for(const e of this._ranges)yield new Es(e.start,e.end)}getFirstRange(){let e=null;for(const t of this._ranges)e&&!t.start.isBefore(e.start)||(e=t);return e?new Es(e.start,e.end):null}getLastRange(){let e=null;for(const t of this._ranges)e&&!t.end.isAfter(e.end)||(e=t);return e?new Es(e.start,e.end):null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}setTo(e,t,o){if(null===e)this._setRanges([]);else if(e instanceof Ns)this._setRanges(e.getRanges(),e.isBackward);else if(e&&"function"==typeof e.getRanges)this._setRanges(e.getRanges(),e.isBackward);else if(e instanceof Es)this._setRanges([e],!!t&&!!t.backward);else if(e instanceof As)this._setRanges([new Es(e)]);else if(e instanceof ws){const n=!!o&&!!o.backward;let i;if("in"==t)i=Es._createIn(e);else if("on"==t)i=Es._createOn(e);else{if(void 0===t)throw new mo.b("model-selection-setTo-required-second-parameter: selection.setTo requires the second parameter when the first parameter is a node.",[this,e]);i=new Es(As._createAt(e,t))}this._setRanges([i],n)}else{if(!xo(e))throw new mo.b("model-selection-setTo-not-selectable: Cannot set the selection to the given place.",[this,e]);this._setRanges(e,t&&!!t.backward)}}_setRanges(e,t=!1){const o=(e=Array.from(e)).some(t=>{if(!(t instanceof Es))throw new mo.b("model-selection-set-ranges-not-range: Selection range set to an object that is not an instance of model.Range.",[this,e]);return this._ranges.every(e=>!e.isEqual(t))});if(e.length!==this._ranges.length||o){this._removeAllRanges();for(const t of e)this._pushRange(t);this._lastRangeBackward=!!t,this.fire("change:range",{directChange:!0})}}setFocus(e,t){if(null===this.anchor)throw new mo.b("model-selection-setFocus-no-ranges: Cannot set selection focus if there are no ranges in selection.",[this,e]);const o=As._createAt(e,t);if("same"==o.compareWith(this.focus))return;const n=this.anchor;this._ranges.length&&this._popRange(),"before"==o.compareWith(n)?(this._pushRange(new Es(o,n)),this._lastRangeBackward=!0):(this._pushRange(new Es(n,o)),this._lastRangeBackward=!1),this.fire("change:range",{directChange:!0})}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}hasAttribute(e){return this._attrs.has(e)}removeAttribute(e){this.hasAttribute(e)&&(this._attrs.delete(e),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}setAttribute(e,t){this.getAttribute(e)!==t&&(this._attrs.set(e,t),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}getSelectedElement(){return 1!==this.rangeCount?null:this.getFirstRange().getContainedElement()}is(e){return"selection"===e||"model:selection"===e}*getSelectedBlocks(){const e=new WeakSet;for(const t of this.getRanges()){const o=Fs(t.start,e);o&&Ds(o,t)&&(yield o);for(const o of t.getWalker()){const n=o.item;"elementEnd"==o.type&&Bs(n,e,t)&&(yield n)}const n=Fs(t.end,e);n&&!t.end.isTouching(As._createAt(n,0))&&Ds(n,t)&&(yield n)}}containsEntireContent(e=this.anchor.root){const t=As._createAt(e,0),o=As._createAt(e,"end");return t.isTouching(this.getFirstPosition())&&o.isTouching(this.getLastPosition())}_pushRange(e){this._checkRange(e),this._ranges.push(new Es(e.start,e.end))}_checkRange(e){for(let t=0;t0;)this._popRange()}_popRange(){this._ranges.pop()}}function zs(e,t){return!t.has(e)&&(t.add(e),e.root.document.model.schema.isBlock(e)&&e.parent)}function Bs(e,t,o){return zs(e,t)&&Ds(e,o)}function Fs(e,t){const o=e.parent.root.document.model.schema,n=e.parent.getAncestors({parentFirst:!0,includeSelf:!0});let i=!1;const r=n.find(e=>!i&&(i=o.isLimit(e),!i&&zs(e,t)));return n.forEach(e=>t.add(e)),r}function Ds(e,t){const o=function(e){const t=e.root.document.model.schema;let o=e.parent;for(;o;){if(t.isBlock(o))return o;o=o.parent}}(e);if(!o)return!0;return!t.containsRange(Es._createOn(o),!0)}Co(Ns,po);class Ls extends Es{constructor(e,t){super(e,t),Hs.call(this)}detach(){this.stopListening()}is(e){return"liveRange"===e||"model:liveRange"===e||"range"==e||"model:range"===e}toRange(){return new Es(this.start,this.end)}static fromRange(e){return new Ls(e.start,e.end)}}function Hs(){this.listenTo(this.root.document.model,"applyOperation",(e,t)=>{const o=t[0];o.isDocumentOperation&&js.call(this,o)},{priority:"low"})}function js(e){const t=this.getTransformedByOperation(e),o=Es._createFromRanges(t),n=!o.isEqual(this),i=function(e,t){switch(t.type){case"insert":return e.containsPosition(t.position);case"move":case"remove":case"reinsert":case"merge":return e.containsPosition(t.sourcePosition)||e.start.isEqual(t.sourcePosition)||e.containsPosition(t.targetPosition);case"split":return e.containsPosition(t.splitPosition)||e.containsPosition(t.insertionPosition)}return!1}(this,e);let r=null;if(n){"$graveyard"==o.root.rootName&&(r="remove"==e.type?e.sourcePosition:e.deletionPosition);const t=this.toRange();this.start=o.start,this.end=o.end,this.fire("change:range",t,{deletionPosition:r})}else i&&this.fire("change:content",this.toRange(),{deletionPosition:r})}Co(Ls,po);class Ws{constructor(e){this._selection=new qs(e),this._selection.delegate("change:range").to(this),this._selection.delegate("change:attribute").to(this),this._selection.delegate("change:marker").to(this)}get isCollapsed(){return this._selection.isCollapsed}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get rangeCount(){return this._selection.rangeCount}get hasOwnRange(){return this._selection.hasOwnRange}get isBackward(){return this._selection.isBackward}get isGravityOverridden(){return this._selection.isGravityOverridden}get markers(){return this._selection.markers}get _ranges(){return this._selection._ranges}getRanges(){return this._selection.getRanges()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getSelectedBlocks(){return this._selection.getSelectedBlocks()}getSelectedElement(){return this._selection.getSelectedElement()}containsEntireContent(e){return this._selection.containsEntireContent(e)}destroy(){this._selection.destroy()}getAttributeKeys(){return this._selection.getAttributeKeys()}getAttributes(){return this._selection.getAttributes()}getAttribute(e){return this._selection.getAttribute(e)}hasAttribute(e){return this._selection.hasAttribute(e)}refresh(){this._selection._updateMarkers(),this._selection._updateAttributes(!1)}is(e){return"selection"===e||"model:selection"==e||"documentSelection"==e||"model:documentSelection"==e}_setFocus(e,t){this._selection.setFocus(e,t)}_setTo(e,t,o){this._selection.setTo(e,t,o)}_setAttribute(e,t){this._selection.setAttribute(e,t)}_removeAttribute(e){this._selection.removeAttribute(e)}_getStoredAttributes(){return this._selection._getStoredAttributes()}_overrideGravity(){return this._selection.overrideGravity()}_restoreGravity(e){this._selection.restoreGravity(e)}static _getStoreAttributeKey(e){return"selection:"+e}static _isStoreAttributeKey(e){return e.startsWith("selection:")}}Co(Ws,po);class qs extends Ns{constructor(e){super(),this.markers=new Ao({idProperty:"name"}),this._model=e.model,this._document=e,this._attributePriority=new Map,this._selectionRestorePosition=null,this._hasChangedRange=!1,this._overriddenGravityRegister=new Set,this.listenTo(this._model,"applyOperation",(e,t)=>{const o=t[0];o.isDocumentOperation&&"marker"!=o.type&&"rename"!=o.type&&"noop"!=o.type&&(0==this._ranges.length&&this._selectionRestorePosition&&this._fixGraveyardSelection(this._selectionRestorePosition),this._selectionRestorePosition=null,this._hasChangedRange&&(this._hasChangedRange=!1,this.fire("change:range",{directChange:!1})))},{priority:"lowest"}),this.on("change:range",()=>{for(const e of this.getRanges())if(!this._document._validateSelectionRange(e))throw new mo.b("document-selection-wrong-position: Range from document selection starts or ends at incorrect position.",this,{range:e})}),this.listenTo(this._model.markers,"update",()=>this._updateMarkers()),this.listenTo(this._document,"change",(e,t)=>{!function(e,t){const o=e.document.differ;for(const n of o.getChanges()){if("insert"!=n.type)continue;const o=n.position.parent;n.length===o.maxOffset&&e.enqueueChange(t,e=>{const t=Array.from(o.getAttributeKeys()).filter(e=>e.startsWith("selection:"));for(const n of t)e.removeAttribute(n,o)})}}(this._model,t)})}get isCollapsed(){return 0===this._ranges.length?this._document._getDefaultRange().isCollapsed:super.isCollapsed}get anchor(){return super.anchor||this._document._getDefaultRange().start}get focus(){return super.focus||this._document._getDefaultRange().end}get rangeCount(){return this._ranges.length?this._ranges.length:1}get hasOwnRange(){return this._ranges.length>0}get isGravityOverridden(){return!!this._overriddenGravityRegister.size}destroy(){for(let e=0;e{if(this._hasChangedRange=!0,t.root==this._document.graveyard){this._selectionRestorePosition=n.deletionPosition;const e=this._ranges.indexOf(t);this._ranges.splice(e,1),t.detach()}}),t}_updateMarkers(){const e=[];let t=!1;for(const t of this._model.markers){const o=t.getRange();for(const n of this.getRanges())o.containsRange(n,!n.isCollapsed)&&e.push(t)}const o=Array.from(this.markers);for(const o of e)this.markers.has(o)||(this.markers.add(o),t=!0);for(const o of Array.from(this.markers))e.includes(o)||(this.markers.remove(o),t=!0);t&&this.fire("change:marker",{oldMarkers:o,directChange:!1})}_updateAttributes(e){const t=Bo(this._getSurroundingAttributes()),o=Bo(this.getAttributes());if(e)this._attributePriority=new Map,this._attrs=new Map;else for(const[e,t]of this._attributePriority)"low"==t&&(this._attrs.delete(e),this._attributePriority.delete(e));this._setAttributesTo(t);const n=[];for(const[e,t]of this.getAttributes())o.has(e)&&o.get(e)===t||n.push(e);for(const[e]of o)this.hasAttribute(e)||n.push(e);n.length>0&&this.fire("change:attribute",{attributeKeys:n,directChange:!1})}_setAttribute(e,t,o=!0){const n=o?"normal":"low";if("low"==n&&"normal"==this._attributePriority.get(e))return!1;return super.getAttribute(e)!==t&&(this._attrs.set(e,t),this._attributePriority.set(e,n),!0)}_removeAttribute(e,t=!0){const o=t?"normal":"low";return("low"!=o||"normal"!=this._attributePriority.get(e))&&(this._attributePriority.set(e,o),!!super.hasAttribute(e)&&(this._attrs.delete(e),!0))}_setAttributesTo(e){const t=new Set;for(const[t,o]of this.getAttributes())e.get(t)!==o&&this._removeAttribute(t,!1);for(const[o,n]of e){this._setAttribute(o,n,!1)&&t.add(o)}return t}*_getStoredAttributes(){const e=this.getFirstPosition().parent;if(this.isCollapsed&&e.isEmpty)for(const t of e.getAttributeKeys())if(t.startsWith("selection:")){const o=t.substr("selection:".length);yield[o,e.getAttribute(t)]}}_getSurroundingAttributes(){const e=this.getFirstPosition(),t=this._model.schema;let o=null;if(this.isCollapsed){const n=e.textNode?e.textNode:e.nodeBefore,i=e.textNode?e.textNode:e.nodeAfter;if(this.isGravityOverridden||(o=$s(n)),o||(o=$s(i)),!this.isGravityOverridden&&!o){let e=n;for(;e&&!t.isInline(e)&&!o;)e=e.previousSibling,o=$s(e)}if(!o){let e=i;for(;e&&!t.isInline(e)&&!o;)e=e.nextSibling,o=$s(e)}o||(o=this._getStoredAttributes())}else{const e=this.getFirstRange();for(const n of e){if(n.item.is("element")&&t.isObject(n.item))break;if("text"==n.type){o=n.item.getAttributes();break}}}return o}_fixGraveyardSelection(e){const t=this._model.schema.getNearestSelectionRange(e);t&&this._pushRange(t)}}function $s(e){return e instanceof _s||e instanceof ks?e.getAttributes():null}class Us{constructor(e){this._dispatchers=e}add(e){for(const t of this._dispatchers)e(t);return this}}var Gs=function(e){return to(e,5)};class Ks extends Us{elementToElement(e){return this.add(function(e){return(e=Gs(e)).view=Qs(e.view,"container"),t=>{var o;t.on("insert:"+e.model,(o=e.view,(e,t,n)=>{const i=o(t.item,n);if(!i)return;if(!n.consumable.consume(t.item,"insert"))return;const r=n.mapper.toViewPosition(t.range.start);n.mapper.bindElements(t.item,i),n.writer.insert(r,i)}),{priority:e.converterPriority||"normal"})}}(e))}attributeToElement(e){return this.add(function(e){e=Gs(e);let t="attribute:"+(e.model.key?e.model.key:e.model);e.model.name&&(t+=":"+e.model.name);if(e.model.values)for(const t of e.model.values)e.view[t]=Qs(e.view[t],"attribute");else e.view=Qs(e.view,"attribute");const o=Xs(e);return n=>{n.on(t,function(e){return(t,o,n)=>{const i=e(o.attributeOldValue,n),r=e(o.attributeNewValue,n);if(!i&&!r)return;if(!n.consumable.consume(o.item,t.name))return;const s=n.writer,a=s.document.selection;if(o.item instanceof Ns||o.item instanceof Ws)s.wrap(a.getFirstRange(),r);else{let e=n.mapper.toViewRange(o.range);null!==o.attributeOldValue&&i&&(e=s.unwrap(e,i)),null!==o.attributeNewValue&&r&&s.wrap(e,r)}}}(o),{priority:e.converterPriority||"normal"})}}(e))}attributeToAttribute(e){return this.add(function(e){e=Gs(e);let t="attribute:"+(e.model.key?e.model.key:e.model);e.model.name&&(t+=":"+e.model.name);if(e.model.values)for(const t of e.model.values)e.view[t]=Zs(e.view[t]);else e.view=Zs(e.view);const o=Xs(e);return n=>{var i;n.on(t,(i=o,(e,t,o)=>{const n=i(t.attributeOldValue,o),r=i(t.attributeNewValue,o);if(!n&&!r)return;if(!o.consumable.consume(t.item,e.name))return;const s=o.mapper.toViewElement(t.item),a=o.writer;if(!s)throw new mo.b("conversion-attribute-to-attribute-on-text: Trying to convert text node's attribute with attribute-to-attribute converter.",[t,o]);if(null!==t.attributeOldValue&&n)if("class"==n.key){const e=Array.isArray(n.value)?n.value:[n.value];for(const t of e)a.removeClass(t,s)}else if("style"==n.key){const e=Object.keys(n.value);for(const t of e)a.removeStyle(t,s)}else a.removeAttribute(n.key,s);if(null!==t.attributeNewValue&&r)if("class"==r.key){const e=Array.isArray(r.value)?r.value:[r.value];for(const t of e)a.addClass(t,s)}else if("style"==r.key){const e=Object.keys(r.value);for(const t of e)a.setStyle(t,r.value[t],s)}else a.setAttribute(r.key,r.value,s)}),{priority:e.converterPriority||"normal"})}}(e))}markerToElement(e){return this.add(function(e){return(e=Gs(e)).view=Qs(e.view,"ui"),t=>{var o;t.on("addMarker:"+e.model,(o=e.view,(e,t,n)=>{t.isOpening=!0;const i=o(t,n);t.isOpening=!1;const r=o(t,n);if(!i||!r)return;const s=t.markerRange;if(s.isCollapsed&&!n.consumable.consume(s,e.name))return;for(const t of s)if(!n.consumable.consume(t.item,e.name))return;const a=n.mapper,l=n.writer;l.insert(a.toViewPosition(s.start),i),n.mapper.bindElementToMarker(i,t.markerName),s.isCollapsed||(l.insert(a.toViewPosition(s.end),r),n.mapper.bindElementToMarker(r,t.markerName)),e.stop()}),{priority:e.converterPriority||"normal"}),t.on("removeMarker:"+e.model,(e.view,(e,t,o)=>{const n=o.mapper.markerNameToElements(t.markerName);if(n){for(const e of n)o.mapper.unbindElementFromMarkerName(e,t.markerName),o.writer.clear(o.writer.createRangeOn(e),e);o.writer.clearClonedElementsGroup(t.markerName),e.stop()}}),{priority:e.converterPriority||"normal"})}}(e))}markerToHighlight(e){return this.add(function(e){return t=>{var o;t.on("addMarker:"+e.model,(o=e.view,(e,t,n)=>{if(!t.item)return;if(!(t.item instanceof Ns||t.item instanceof Ws||t.item.is("$textProxy")))return;const i=ea(o,t,n);if(!i)return;if(!n.consumable.consume(t.item,e.name))return;const r=n.writer,s=Js(r,i),a=r.document.selection;if(t.item instanceof Ns||t.item instanceof Ws)r.wrap(a.getFirstRange(),s,a);else{const e=n.mapper.toViewRange(t.range),o=r.wrap(e,s);for(const e of o.getItems())if(e.is("attributeElement")&&e.isSimilar(s)){n.mapper.bindElementToMarker(e,t.markerName);break}}}),{priority:e.converterPriority||"normal"}),t.on("addMarker:"+e.model,function(e){return(t,o,n)=>{if(!o.item)return;if(!(o.item instanceof ys))return;const i=ea(e,o,n);if(!i)return;if(!n.consumable.test(o.item,t.name))return;const r=n.mapper.toViewElement(o.item);if(r&&r.getCustomProperty("addHighlight")){n.consumable.consume(o.item,t.name);for(const e of Es._createIn(o.item))n.consumable.consume(e.item,t.name);r.getCustomProperty("addHighlight")(r,i,n.writer),n.mapper.bindElementToMarker(r,o.markerName)}}}(e.view),{priority:e.converterPriority||"normal"}),t.on("removeMarker:"+e.model,function(e){return(t,o,n)=>{if(o.markerRange.isCollapsed)return;const i=ea(e,o,n);if(!i)return;const r=Js(n.writer,i),s=n.mapper.markerNameToElements(o.markerName);if(s){for(const e of s)n.mapper.unbindElementFromMarkerName(e,o.markerName),e.is("attributeElement")?n.writer.unwrap(n.writer.createRangeOn(e),r):e.getCustomProperty("removeHighlight")(e,i.id,n.writer);n.writer.clearClonedElementsGroup(o.markerName),t.stop()}}}(e.view),{priority:e.converterPriority||"normal"})}}(e))}markerToData(e){return this.add(function(e){const t=(e=Gs(e)).model;e.view||(e.view=o=>({group:t,name:o.substr(e.model.length+1)}));return o=>{var n;o.on("addMarker:"+t,(n=e.view,(e,t,o)=>{const i=n(t.markerName,o);if(!i)return;const r=t.markerRange;o.consumable.consume(r,e.name)&&(Ys(r,!1,o,t,i),Ys(r,!0,o,t,i),e.stop())}),{priority:e.converterPriority||"normal"}),o.on("removeMarker:"+t,function(e){return(t,o,n)=>{const i=e(o.markerName,n);if(!i)return;const r=n.mapper.markerNameToElements(o.markerName);if(r){for(const e of r)n.mapper.unbindElementFromMarkerName(e,o.markerName),e.is("containerElement")?(s(`data-${i.group}-start-before`,e),s(`data-${i.group}-start-after`,e),s(`data-${i.group}-end-before`,e),s(`data-${i.group}-end-after`,e)):n.writer.clear(n.writer.createRangeOn(e),e);n.writer.clearClonedElementsGroup(o.markerName),t.stop()}function s(e,t){if(t.hasAttribute(e)){const o=new Set(t.getAttribute(e).split(","));o.delete(i.name),0==o.size?n.writer.removeAttribute(e,t):n.writer.setAttribute(e,Array.from(o).join(","),t)}}}}(e.view),{priority:e.converterPriority||"normal"})}}(e))}}function Js(e,t){const o=e.createAttributeElement("span",t.attributes);return t.classes&&o._addClass(t.classes),t.priority&&(o._priority=t.priority),o._id=t.id,o}function Ys(e,t,o,n,i){const r=t?e.start:e.end;if(o.schema.checkChild(r,"$text")){!function(e,t,o,n,i){const r=`${i.group}-${t?"start":"end"}`,s=i.name?{name:i.name}:null,a=o.writer.createUIElement(r,s);o.writer.insert(e,a),o.mapper.bindElementToMarker(a,n.markerName)}(o.mapper.toViewPosition(r),t,o,n,i)}else{let e,s;t&&r.nodeAfter||!t&&!r.nodeBefore?(e=r.nodeAfter,s=!0):(e=r.nodeBefore,s=!1);!function(e,t,o,n,i,r){const s=`data-${r.group}-${t?"start":"end"}-${o?"before":"after"}`,a=e.hasAttribute(s)?e.getAttribute(s).split(","):[];a.unshift(r.name),n.writer.setAttribute(s,a.join(","),e),n.mapper.bindElementToMarker(e,i.markerName)}(o.mapper.toViewElement(e),t,s,o,n,i)}}function Qs(e,t){return"function"==typeof e?e:(o,n)=>function(e,t,o){"string"==typeof e&&(e={name:e});let n;const i=t.writer,r=Object.assign({},e.attributes);if("container"==o)n=i.createContainerElement(e.name,r);else if("attribute"==o){const t={priority:e.priority||ai.DEFAULT_PRIORITY};n=i.createAttributeElement(e.name,r,t)}else n=i.createUIElement(e.name,r);if(e.styles){const t=Object.keys(e.styles);for(const o of t)i.setStyle(o,e.styles[o],n)}if(e.classes){const t=e.classes;if("string"==typeof t)i.addClass(t,n);else for(const e of t)i.addClass(e,n)}return n}(e,n,t)}function Xs(e){return e.model.values?(t,o)=>{const n=e.view[t];return n?n(t,o):null}:e.view}function Zs(e){return"string"==typeof e?t=>({key:e,value:t}):"object"==typeof e?e.value?()=>e:t=>({key:e.key,value:t}):e}function ea(e,t,o){const n="function"==typeof e?e(t,o):e;return n?(n.priority||(n.priority=10),n.id||(n.id=t.markerName),n):null}function ta(e){const{schema:t,document:o}=e.model;for(const n of o.getRootNames()){const i=o.getRoot(n);if(i.isEmpty&&!t.checkChild(i,"$text")&&t.checkChild(i,"paragraph"))return e.insertElement("paragraph",i),!0}return!1}function oa(e,t,o){const n=o.createContext(e);return!!o.checkChild(n,"paragraph")&&!!o.checkChild(n.push("paragraph"),t)}function na(e,t){const o=t.createElement("paragraph");return t.insert(o,e),t.createPositionAt(o,0)}class ia extends Us{elementToElement(e){return this.add(ra(e))}elementToAttribute(e){return this.add(function(e){la(e=Gs(e));const t=ca(e,!1),o=sa(e.view),n=o?"element:"+o:"element";return o=>{o.on(n,t,{priority:e.converterPriority||"low"})}}(e))}attributeToAttribute(e){return this.add(function(e){e=Gs(e);let t=null;("string"==typeof e.view||e.view.key)&&(t=function(e){"string"==typeof e.view&&(e.view={key:e.view});const t=e.view.key;let o;if("class"==t||"style"==t){o={["class"==t?"classes":"styles"]:e.view.value}}else{const n=void 0===e.view.value?/[\s\S]*/:e.view.value;o={attributes:{[t]:n}}}e.view.name&&(o.name=e.view.name);return e.view=o,t}(e));la(e,t);const o=ca(e,!0);return t=>{t.on("element",o,{priority:e.converterPriority||"low"})}}(e))}elementToMarker(e){return console.warn(Object(mo.a)("upcast-helpers-element-to-marker-deprecated: The UpcastHelpers#elementToMarker() method was deprecated and will be removed in the near future. Please use UpcastHelpers#dataToMarker() instead.")),this.add(function(e){return function(e){const t=e.model;e.model=(e,o)=>{const n="string"==typeof t?t:t(e,o);return o.writer.createElement("$marker",{"data-name":n})}}(e=Gs(e)),ra(e)}(e))}dataToMarker(e){return this.add(function(e){(e=Gs(e)).model||(e.model=t=>t?e.view+":"+t:e.view);const t=aa(da(e,"start")),o=aa(da(e,"end"));return n=>{n.on("element:"+e.view+"-start",t,{priority:e.converterPriority||"normal"}),n.on("element:"+e.view+"-end",o,{priority:e.converterPriority||"normal"});const i=uo.get("low"),r=uo.get("highest"),s=uo.get(e.converterPriority)/r;n.on("element",function(e){return(t,o,n)=>{const i="data-"+e.view;function r(t,i){for(const r of i){const i=e.model(r,n),s=n.writer.createElement("$marker",{"data-name":i});n.writer.insert(s,t),o.modelCursor.isEqual(t)?o.modelCursor=o.modelCursor.getShiftedBy(1):o.modelCursor=o.modelCursor._getTransformedByInsertion(t,1),o.modelRange=o.modelRange._getTransformedByInsertion(t,1)[0]}}o.modelRange||(o=Object.assign(o,n.convertChildren(o.viewItem,o.modelCursor))),n.consumable.consume(o.viewItem,{attributes:i+"-end-after"})&&r(o.modelRange.end,o.viewItem.getAttribute(i+"-end-after").split(",")),n.consumable.consume(o.viewItem,{attributes:i+"-start-after"})&&r(o.modelRange.end,o.viewItem.getAttribute(i+"-start-after").split(",")),n.consumable.consume(o.viewItem,{attributes:i+"-end-before"})&&r(o.modelRange.start,o.viewItem.getAttribute(i+"-end-before").split(",")),n.consumable.consume(o.viewItem,{attributes:i+"-start-before"})&&r(o.modelRange.start,o.viewItem.getAttribute(i+"-start-before").split(","))}}(e),{priority:i+s})}}(e))}}function ra(e){const t=aa(e=Gs(e)),o=sa(e.view),n=o?"element:"+o:"element";return o=>{o.on(n,t,{priority:e.converterPriority||"normal"})}}function sa(e){return"string"==typeof e?e:"object"==typeof e&&"string"==typeof e.name?e.name:null}function aa(e){const t=new Fo(e.view);return(o,n,i)=>{const r=t.match(n.viewItem);if(!r)return;const s=r.match;if(s.name=!0,!i.consumable.test(n.viewItem,s))return;const a=function(e,t,o){return e instanceof Function?e(t,o):o.writer.createElement(e)}(e.model,n.viewItem,i);a&&i.safeInsert(a,n.modelCursor)&&(i.consumable.consume(n.viewItem,s),i.convertChildren(n.viewItem,a),i.updateConversionResult(a,n))}}function la(e,t=null){const o=null===t||(e=>e.getAttribute(t)),n="object"!=typeof e.model?e.model:e.model.key,i="object"!=typeof e.model||void 0===e.model.value?o:e.model.value;e.model={key:n,value:i}}function ca(e,t){const o=new Fo(e.view);return(n,i,r)=>{const s=o.match(i.viewItem);if(!s)return;const a=e.model.key,l="function"==typeof e.model.value?e.model.value(i.viewItem,r):e.model.value;if(null===l)return;if(!function(e,t){const o="function"==typeof e?e(t):e;if("object"==typeof o&&!sa(o))return!1;return!o.classes&&!o.attributes&&!o.styles}(e.view,i.viewItem)?delete s.match.name:s.match.name=!0,!r.consumable.test(i.viewItem,s.match))return;i.modelRange||(i=Object.assign(i,r.convertChildren(i.viewItem,i.modelCursor)));(function(e,t,o,n){let i=!1;for(const r of Array.from(e.getItems({shallow:o})))n.schema.checkAttribute(r,t.key)&&(n.writer.setAttribute(t.key,t.value,r),i=!0);return i})(i.modelRange,{key:a,value:l},t,r)&&r.consumable.consume(i.viewItem,s.match)}}function da(e,t){const o={};return o.view=e.view+"-"+t,o.model=(t,o)=>{const n=t.getAttribute("name"),i=e.model(n,o);return o.writer.createElement("$marker",{"data-name":i})},o}class ha{constructor(e,t){this.model=e,this.view=new bs(t),this.mapper=new Rs,this.downcastDispatcher=new Os({mapper:this.mapper,schema:e.schema});const o=this.model.document,n=o.selection,i=this.model.markers;this.listenTo(this.model,"_beforeChanges",()=>{this.view._disableRendering(!0)},{priority:"highest"}),this.listenTo(this.model,"_afterChanges",()=>{this.view._disableRendering(!1)},{priority:"lowest"}),this.listenTo(o,"change",()=>{this.view.change(e=>{this.downcastDispatcher.convertChanges(o.differ,i,e),this.downcastDispatcher.convertSelection(n,i,e)})},{priority:"low"}),this.listenTo(this.view.document,"selectionChange",function(e,t){return(o,n)=>{const i=n.newSelection,r=[];for(const e of i.getRanges())r.push(t.toModelRange(e));const s=e.createSelection(r,{backward:i.isBackward});s.isEqual(e.document.selection)||e.change(e=>{e.setSelection(s)})}}(this.model,this.mapper)),this.downcastDispatcher.on("insert:$text",(e,t,o)=>{if(!o.consumable.consume(t.item,"insert"))return;const n=o.writer,i=o.mapper.toViewPosition(t.range.start),r=n.createText(t.item.data);n.insert(i,r)},{priority:"lowest"}),this.downcastDispatcher.on("remove",(e,t,o)=>{const n=o.mapper.toViewPosition(t.position),i=t.position.getShiftedBy(t.length),r=o.mapper.toViewPosition(i,{isPhantom:!0}),s=o.writer.createRange(n,r),a=o.writer.remove(s.getTrimmed());for(const e of o.writer.createRangeIn(a).getItems())o.mapper.unbindViewElement(e)},{priority:"low"}),this.downcastDispatcher.on("selection",(e,t,o)=>{const n=o.writer,i=n.document.selection;for(const e of i.getRanges())e.isCollapsed&&e.end.parent.isAttached()&&o.writer.mergeAttributes(e.start);n.setSelection(null)},{priority:"low"}),this.downcastDispatcher.on("selection",(e,t,o)=>{const n=t.selection;if(n.isCollapsed)return;if(!o.consumable.consume(n,"selection"))return;const i=[];for(const e of n.getRanges()){const t=o.mapper.toViewRange(e);i.push(t)}o.writer.setSelection(i,{backward:n.isBackward})},{priority:"low"}),this.downcastDispatcher.on("selection",(e,t,o)=>{const n=t.selection;if(!n.isCollapsed)return;if(!o.consumable.consume(n,"selection"))return;const i=o.writer,r=n.getFirstPosition(),s=o.mapper.toViewPosition(r),a=i.breakAttributes(s);i.setSelection(a)},{priority:"low"}),this.view.document.roots.bindTo(this.model.document.roots).using(e=>{if("$graveyard"==e.rootName)return null;const t=new Xn(this.view.document,e.name);return t.rootName=e.rootName,this.mapper.bindElements(e,t),t})}destroy(){this.view.destroy(),this.stopListening()}}Co(ha,qn);class ua{constructor(){this._commands=new Map}add(e,t){this._commands.set(e,t)}get(e){return this._commands.get(e)}execute(e,...t){const o=this.get(e);if(!o)throw new mo.b("commandcollection-command-not-found: Command does not exist.",this,{commandName:e});return o.execute(...t)}*names(){yield*this._commands.keys()}*commands(){yield*this._commands.values()}[Symbol.iterator](){return this._commands[Symbol.iterator]()}destroy(){for(const e of this.commands())e.destroy()}}class ma{constructor(){this._consumables=new Map}add(e,t){let o;e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):(this._consumables.has(e)?o=this._consumables.get(e):(o=new ga(e),this._consumables.set(e,o)),o.add(t))}test(e,t){const o=this._consumables.get(e);return void 0===o?null:e.is("$text")||e.is("documentFragment")?o:o.test(t)}consume(e,t){return!!this.test(e,t)&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!1):this._consumables.get(e).consume(t),!0)}revert(e,t){const o=this._consumables.get(e);void 0!==o&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):o.revert(t))}static consumablesFromElement(e){const t={element:e,name:!0,attributes:[],classes:[],styles:[]},o=e.getAttributeKeys();for(const e of o)"style"!=e&&"class"!=e&&t.attributes.push(e);const n=e.getClassNames();for(const e of n)t.classes.push(e);const i=e.getStyleNames();for(const e of i)t.styles.push(e);return t}static createFrom(e,t){if(t||(t=new ma(e)),e.is("$text"))return t.add(e),t;e.is("element")&&t.add(e,ma.consumablesFromElement(e)),e.is("documentFragment")&&t.add(e);for(const o of e.getChildren())t=ma.createFrom(o,t);return t}}class ga{constructor(e){this.element=e,this._canConsumeName=null,this._consumables={attributes:new Map,styles:new Map,classes:new Map}}add(e){e.name&&(this._canConsumeName=!0);for(const t in this._consumables)t in e&&this._add(t,e[t])}test(e){if(e.name&&!this._canConsumeName)return this._canConsumeName;for(const t in this._consumables)if(t in e){const o=this._test(t,e[t]);if(!0!==o)return o}return!0}consume(e){e.name&&(this._canConsumeName=!1);for(const t in this._consumables)t in e&&this._consume(t,e[t])}revert(e){e.name&&(this._canConsumeName=!0);for(const t in this._consumables)t in e&&this._revert(t,e[t])}_add(e,t){const o=ze(t)?t:[t],n=this._consumables[e];for(const t of o){if("attributes"===e&&("class"===t||"style"===t))throw new mo.b("viewconsumable-invalid-attribute: Classes and styles should be handled separately.",this);if(n.set(t,!0),"styles"===e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(t))n.set(e,!0)}}_test(e,t){const o=ze(t)?t:[t],n=this._consumables[e];for(const t of o)if("attributes"!==e||"class"!==t&&"style"!==t){const e=n.get(t);if(void 0===e)return null;if(!e)return!1}else{const e="class"==t?"classes":"styles",o=this._test(e,[...this._consumables[e].keys()]);if(!0!==o)return o}return!0}_consume(e,t){const o=ze(t)?t:[t],n=this._consumables[e];for(const t of o)if("attributes"!==e||"class"!==t&&"style"!==t){if(n.set(t,!1),"styles"==e)for(const e of this.element.document.stylesProcessor.getRelatedStyles(t))n.set(e,!1)}else{const e="class"==t?"classes":"styles";this._consume(e,[...this._consumables[e].keys()])}}_revert(e,t){const o=ze(t)?t:[t],n=this._consumables[e];for(const t of o)if("attributes"!==e||"class"!==t&&"style"!==t){!1===n.get(t)&&n.set(t,!0)}else{const e="class"==t?"classes":"styles";this._revert(e,[...this._consumables[e].keys()])}}}class fa{constructor(){this._sourceDefinitions={},this._attributeProperties={},this.decorate("checkChild"),this.decorate("checkAttribute"),this.on("checkAttribute",(e,t)=>{t[0]=new pa(t[0])},{priority:"highest"}),this.on("checkChild",(e,t)=>{t[0]=new pa(t[0]),t[1]=this.getDefinition(t[1])},{priority:"highest"})}register(e,t){if(this._sourceDefinitions[e])throw new mo.b("schema-cannot-register-item-twice: A single item cannot be registered twice in the schema.",this,{itemName:e});this._sourceDefinitions[e]=[Object.assign({},t)],this._clearCache()}extend(e,t){if(!this._sourceDefinitions[e])throw new mo.b("schema-cannot-extend-missing-item: Cannot extend an item which was not registered yet.",this,{itemName:e});this._sourceDefinitions[e].push(Object.assign({},t)),this._clearCache()}getDefinitions(){return this._compiledDefinitions||this._compile(),this._compiledDefinitions}getDefinition(e){let t;return t="string"==typeof e?e:e.is&&(e.is("$text")||e.is("$textProxy"))?"$text":e.name,this.getDefinitions()[t]}isRegistered(e){return!!this.getDefinition(e)}isBlock(e){const t=this.getDefinition(e);return!(!t||!t.isBlock)}isLimit(e){const t=this.getDefinition(e);return!!t&&!(!t.isLimit&&!t.isObject)}isObject(e){const t=this.getDefinition(e);return!!t&&!!(t.isObject||t.isLimit&&t.isSelectable&&t.isContent)}isInline(e){const t=this.getDefinition(e);return!(!t||!t.isInline)}isSelectable(e){const t=this.getDefinition(e);return!!t&&!(!t.isSelectable&&!t.isObject)}isContent(e){const t=this.getDefinition(e);return!!t&&!(!t.isContent&&!t.isObject)}checkChild(e,t){return!!t&&this._checkContextMatch(t,e)}checkAttribute(e,t){const o=this.getDefinition(e.last);return!!o&&o.allowAttributes.includes(t)}checkMerge(e,t=null){if(e instanceof As){const t=e.nodeBefore,o=e.nodeAfter;if(!(t instanceof ys))throw new mo.b("schema-check-merge-no-element-before: The node before the merge position must be an element.",this);if(!(o instanceof ys))throw new mo.b("schema-check-merge-no-element-after: The node after the merge position must be an element.",this);return this.checkMerge(t,o)}for(const o of t.getChildren())if(!this.checkChild(e,o))return!1;return!0}addChildCheck(e){this.on("checkChild",(t,[o,n])=>{if(!n)return;const i=e(o,n);"boolean"==typeof i&&(t.stop(),t.return=i)},{priority:"high"})}addAttributeCheck(e){this.on("checkAttribute",(t,[o,n])=>{const i=e(o,n);"boolean"==typeof i&&(t.stop(),t.return=i)},{priority:"high"})}setAttributeProperties(e,t){this._attributeProperties[e]=Object.assign(this.getAttributeProperties(e),t)}getAttributeProperties(e){return this._attributeProperties[e]||{}}getLimitElement(e){let t;if(e instanceof As)t=e.parent;else{t=(e instanceof Es?[e]:Array.from(e.getRanges())).reduce((e,t)=>{const o=t.getCommonAncestor();return e?e.getCommonAncestor(o,{includeSelf:!0}):o},null)}for(;!this.isLimit(t)&&t.parent;)t=t.parent;return t}checkAttributeInSelection(e,t){if(e.isCollapsed){const o=[...e.getFirstPosition().getAncestors(),new ks("",e.getAttributes())];return this.checkAttribute(o,t)}{const o=e.getRanges();for(const e of o)for(const o of e)if(this.checkAttribute(o.item,t))return!0}return!1}*getValidRanges(e,t){e=function*(e){for(const t of e)yield*t.getMinimalFlatRanges()}(e);for(const o of e)yield*this._getValidRangesForRange(o,t)}getNearestSelectionRange(e,t="both"){if(this.checkChild(e,"$text"))return new Es(e);let o,n;const i=e.getAncestors().reverse().find(e=>this.isLimit(e))||e.root;"both"!=t&&"backward"!=t||(o=new xs({boundaries:Es._createIn(i),startPosition:e,direction:"backward"})),"both"!=t&&"forward"!=t||(n=new xs({boundaries:Es._createIn(i),startPosition:e}));for(const e of function*(e,t){let o=!1;for(;!o;){if(o=!0,e){const t=e.next();t.done||(o=!1,yield{walker:e,value:t.value})}if(t){const e=t.next();e.done||(o=!1,yield{walker:t,value:e.value})}}}(o,n)){const t=e.walker==o?"elementEnd":"elementStart",n=e.value;if(n.type==t&&this.isObject(n.item))return Es._createOn(n.item);if(this.checkChild(n.nextPosition,"$text"))return new Es(n.nextPosition)}return null}findAllowedParent(e,t){let o=e.parent;for(;o;){if(this.checkChild(o,t))return o;if(this.isLimit(o))return null;o=o.parent}return null}removeDisallowedAttributes(e,t){for(const o of e)if(o.is("$text"))Pa(this,o,t);else{const e=Es._createIn(o).getPositions();for(const o of e){Pa(this,o.nodeBefore||o.parent,t)}}}createContext(e){return new pa(e)}_clearCache(){this._compiledDefinitions=null}_compile(){const e={},t=this._sourceDefinitions,o=Object.keys(t);for(const n of o)e[n]=ba(t[n],n);for(const t of o)wa(e,t);for(const t of o)ka(e,t);for(const t of o)_a(e,t),va(e,t);for(const t of o)ya(e,t),xa(e,t);this._compiledDefinitions=e}_checkContextMatch(e,t,o=t.length-1){const n=t.getItem(o);if(e.allowIn.includes(n.name)){if(0==o)return!0;{const e=this.getDefinition(n);return this._checkContextMatch(e,t,o-1)}}return!1}*_getValidRangesForRange(e,t){let o=e.start,n=e.start;for(const i of e.getItems({shallow:!0}))i.is("element")&&(yield*this._getValidRangesForRange(Es._createIn(i),t)),this.checkAttribute(i,t)||(o.isEqual(n)||(yield new Es(o,n)),o=As._createAfter(i)),n=As._createAfter(i);o.isEqual(n)||(yield new Es(o,n))}}Co(fa,qn);class pa{constructor(e){if(e instanceof pa)return e;"string"==typeof e?e=[e]:Array.isArray(e)||(e=e.getAncestors({includeSelf:!0})),e[0]&&"string"!=typeof e[0]&&e[0].is("documentFragment")&&e.shift(),this._items=e.map(Ta)}get length(){return this._items.length}get last(){return this._items[this._items.length-1]}[Symbol.iterator](){return this._items[Symbol.iterator]()}push(e){const t=new pa([e]);return t._items=[...this._items,...t._items],t}getItem(e){return this._items[e]}*getNames(){yield*this._items.map(e=>e.name)}endsWith(e){return Array.from(this.getNames()).join(" ").endsWith(e)}startsWith(e){return Array.from(this.getNames()).join(" ").startsWith(e)}}function ba(e,t){const o={name:t,allowIn:[],allowContentOf:[],allowWhere:[],allowAttributes:[],allowAttributesOf:[],inheritTypesFrom:[]};return function(e,t){for(const o of e){const e=Object.keys(o).filter(e=>e.startsWith("is"));for(const n of e)t[n]=o[n]}}(e,o),Ca(e,o,"allowIn"),Ca(e,o,"allowContentOf"),Ca(e,o,"allowWhere"),Ca(e,o,"allowAttributes"),Ca(e,o,"allowAttributesOf"),Ca(e,o,"inheritTypesFrom"),function(e,t){for(const o of e){const e=o.inheritAllFrom;e&&(t.allowContentOf.push(e),t.allowWhere.push(e),t.allowAttributesOf.push(e),t.inheritTypesFrom.push(e))}}(e,o),o}function wa(e,t){for(const o of e[t].allowContentOf)if(e[o]){Aa(e,o).forEach(e=>{e.allowIn.push(t)})}delete e[t].allowContentOf}function ka(e,t){for(const o of e[t].allowWhere){const n=e[o];if(n){const o=n.allowIn;e[t].allowIn.push(...o)}}delete e[t].allowWhere}function _a(e,t){for(const o of e[t].allowAttributesOf){const n=e[o];if(n){const o=n.allowAttributes;e[t].allowAttributes.push(...o)}}delete e[t].allowAttributesOf}function va(e,t){const o=e[t];for(const t of o.inheritTypesFrom){const n=e[t];if(n){const e=Object.keys(n).filter(e=>e.startsWith("is"));for(const t of e)t in o||(o[t]=n[t])}}delete o.inheritTypesFrom}function ya(e,t){const o=e[t],n=o.allowIn.filter(t=>e[t]);o.allowIn=Array.from(new Set(n))}function xa(e,t){const o=e[t];o.allowAttributes=Array.from(new Set(o.allowAttributes))}function Ca(e,t,o){for(const n of e)"string"==typeof n[o]?t[o].push(n[o]):Array.isArray(n[o])&&t[o].push(...n[o])}function Aa(e,t){const o=e[t];return(n=e,Object.keys(n).map(e=>n[e])).filter(e=>e.allowIn.includes(o.name));var n}function Ta(e){return"string"==typeof e?{name:e,*getAttributeKeys(){},getAttribute(){}}:{name:e.is("element")?e.name:"$text",*getAttributeKeys(){yield*e.getAttributeKeys()},getAttribute:t=>e.getAttribute(t)}}function Pa(e,t,o){for(const n of t.getAttributeKeys())e.checkAttribute(t,n)||o.removeAttribute(n,t)}class Sa{constructor(e={}){this._splitParts=new Map,this._cursorParents=new Map,this._modelCursor=null,this.conversionApi=Object.assign({},e),this.conversionApi.convertItem=this._convertItem.bind(this),this.conversionApi.convertChildren=this._convertChildren.bind(this),this.conversionApi.safeInsert=this._safeInsert.bind(this),this.conversionApi.updateConversionResult=this._updateConversionResult.bind(this),this.conversionApi.splitToAllowedParent=this._splitToAllowedParent.bind(this),this.conversionApi.getSplitParts=this._getSplitParts.bind(this)}convert(e,t,o=["$root"]){this.fire("viewCleanup",e),this._modelCursor=function(e,t){let o;for(const n of new pa(e)){const e={};for(const t of n.getAttributeKeys())e[t]=n.getAttribute(t);const i=t.createElement(n.name,e);o&&t.append(i,o),o=As._createAt(i,0)}return o}(o,t),this.conversionApi.writer=t,this.conversionApi.consumable=ma.createFrom(e),this.conversionApi.store={};const{modelRange:n}=this._convertItem(e,this._modelCursor),i=t.createDocumentFragment();if(n){this._removeEmptyElements();for(const e of Array.from(this._modelCursor.parent.getChildren()))t.append(e,i);i.markers=function(e,t){const o=new Set,n=new Map,i=Es._createIn(e).getItems();for(const e of i)"$marker"==e.name&&o.add(e);for(const e of o){const o=e.getAttribute("data-name"),i=t.createPositionBefore(e);n.has(o)?n.get(o).end=i.clone():n.set(o,new Es(i.clone())),t.remove(e)}return n}(i,t)}return this._modelCursor=null,this._splitParts.clear(),this._cursorParents.clear(),this.conversionApi.writer=null,this.conversionApi.store=null,i}_convertItem(e,t){const o=Object.assign({viewItem:e,modelCursor:t,modelRange:null});if(e.is("element")?this.fire("element:"+e.name,o,this.conversionApi):e.is("$text")?this.fire("text",o,this.conversionApi):this.fire("documentFragment",o,this.conversionApi),o.modelRange&&!(o.modelRange instanceof Es))throw new mo.b("view-conversion-dispatcher-incorrect-result: Incorrect conversion result was dropped.",this);return{modelRange:o.modelRange,modelCursor:o.modelCursor}}_convertChildren(e,t){let o=t.is("position")?t:As._createAt(t,0);const n=new Es(o);for(const t of Array.from(e.getChildren())){const e=this._convertItem(t,o);e.modelRange instanceof Es&&(n.end=e.modelRange.end,o=e.modelCursor)}return{modelRange:n,modelCursor:o}}_safeInsert(e,t){const o=this._splitToAllowedParent(e,t);return!!o&&(this.conversionApi.writer.insert(e,o.position),!0)}_updateConversionResult(e,t){const o=this._getSplitParts(e),n=this.conversionApi.writer;t.modelRange||(t.modelRange=n.createRange(n.createPositionBefore(e),n.createPositionAfter(o[o.length-1])));const i=this._cursorParents.get(e);t.modelCursor=i?n.createPositionAt(i,0):t.modelRange.end}_splitToAllowedParent(e,t){const{schema:o,writer:n}=this.conversionApi;let i=o.findAllowedParent(t,e);if(i){if(i===t.parent)return{position:t};this._modelCursor.parent.getAncestors().includes(i)&&(i=null)}if(!i)return oa(t,e,o)?{position:na(t,n)}:null;const r=this.conversionApi.writer.split(t,i),s=[];for(const e of r.range.getWalker())if("elementEnd"==e.type)s.push(e.item);else{const t=s.pop(),o=e.item;this._registerSplitPair(t,o)}const a=r.range.end.parent;return this._cursorParents.set(e,a),{position:r.position,cursorParent:a}}_registerSplitPair(e,t){this._splitParts.has(e)||this._splitParts.set(e,[e]);const o=this._splitParts.get(e);this._splitParts.set(t,o),o.push(t)}_getSplitParts(e){let t;return t=this._splitParts.has(e)?this._splitParts.get(e):[e],t}_removeEmptyElements(){let e=!1;for(const t of this._splitParts.keys())t.isEmpty&&(this.conversionApi.writer.remove(t),this._splitParts.delete(t),e=!0);e&&this._removeEmptyElements()}}Co(Sa,po);class Ea{constructor(e,t){this.model=e,this.stylesProcessor=t,this.processor,this.mapper=new Rs,this.downcastDispatcher=new Os({mapper:this.mapper,schema:e.schema}),this.downcastDispatcher.on("insert:$text",(e,t,o)=>{if(!o.consumable.consume(t.item,"insert"))return;const n=o.writer,i=o.mapper.toViewPosition(t.range.start),r=n.createText(t.item.data);n.insert(i,r)},{priority:"lowest"}),this.upcastDispatcher=new Sa({schema:e.schema}),this.viewDocument=new si(t),this._viewWriter=new Ri(this.viewDocument),this.upcastDispatcher.on("text",(e,t,{schema:o,consumable:n,writer:i})=>{let r=t.modelCursor;if(!n.test(t.viewItem))return;if(!o.checkChild(r,"$text")){if(!oa(r,"$text",o))return;r=na(r,i)}n.consume(t.viewItem);const s=i.createText(t.viewItem.data);i.insert(s,r),t.modelRange=i.createRange(r,r.getShiftedBy(s.offsetSize)),t.modelCursor=t.modelRange.end},{priority:"lowest"}),this.upcastDispatcher.on("element",(e,t,o)=>{if(!t.modelRange&&o.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:n}=o.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=n}},{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",(e,t,o)=>{if(!t.modelRange&&o.consumable.consume(t.viewItem,{name:!0})){const{modelRange:e,modelCursor:n}=o.convertChildren(t.viewItem,t.modelCursor);t.modelRange=e,t.modelCursor=n}},{priority:"lowest"}),this.decorate("init"),this.decorate("set"),this.on("init",()=>{this.fire("ready")},{priority:"lowest"}),this.on("ready",()=>{this.model.enqueueChange("transparent",ta)},{priority:"lowest"})}get(e={}){const{rootName:t="main",trim:o="empty"}=e;if(!this._checkIfRootsExists([t]))throw new mo.b("datacontroller-get-non-existent-root: Attempting to get data from a non-existing root.",this);const n=this.model.document.getRoot(t);return"empty"!==o||this.model.hasContent(n,{ignoreWhitespaces:!0})?this.stringify(n,e):""}stringify(e,t){const o=this.toView(e,t);return this.processor.toData(o)}toView(e,t){const o=this.viewDocument,n=this._viewWriter;this.mapper.clearBindings();const i=Es._createIn(e),r=new Ei(o);if(this.mapper.bindElements(e,r),this.downcastDispatcher.conversionApi.options=t,this.downcastDispatcher.convertInsert(i,n),!e.is("documentFragment")){const t=function(e){const t=[],o=e.root.document;if(!o)return[];const n=Es._createIn(e);for(const e of o.model.markers){const o=n.getIntersection(e.getRange());o&&t.push([e.name,o])}return t}(e);for(const[e,o]of t)this.downcastDispatcher.convertMarkerAdd(e,o,n)}return delete this.downcastDispatcher.conversionApi.options,r}init(e){if(this.model.document.version)throw new mo.b("datacontroller-init-document-not-empty: Trying to set initial data to not empty document.",this);let t={};if("string"==typeof e?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new mo.b("datacontroller-init-non-existent-root: Attempting to init data on a non-existing root.",this);return this.model.enqueueChange("transparent",e=>{for(const o of Object.keys(t)){const n=this.model.document.getRoot(o);e.insert(this.parse(t[o],n),n,0)}}),Promise.resolve()}set(e){let t={};if("string"==typeof e?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new mo.b("datacontroller-set-non-existent-root: Attempting to set data on a non-existing root.",this);this.model.enqueueChange("transparent",e=>{e.setSelection(null),e.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());for(const o of Object.keys(t)){const n=this.model.document.getRoot(o);e.remove(e.createRangeIn(n)),e.insert(this.parse(t[o],n),n,0)}})}parse(e,t="$root"){const o=this.processor.toView(e);return this.toModel(o,t)}toModel(e,t="$root"){return this.model.change(o=>this.upcastDispatcher.convert(e,o,t))}addStyleProcessorRules(e){e(this.stylesProcessor)}destroy(){this.stopListening()}_checkIfRootsExists(e){for(const t of e)if(!this.model.document.getRootNames().includes(t))return!1;return!0}}Co(Ea,qn);class Ra{constructor(e,t){this._helpers=new Map,this._downcast=Array.isArray(e)?e:[e],this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=Array.isArray(t)?t:[t],this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:!1})}addAlias(e,t){const o=this._downcast.includes(t);if(!this._upcast.includes(t)&&!o)throw new mo.b("conversion-add-alias-dispatcher-not-registered: Trying to register and alias for a dispatcher that nas not been registered.",this);this._createConversionHelpers({name:e,dispatchers:[t],isDowncast:o})}for(e){if(!this._helpers.has(e))throw new mo.b("conversion-for-unknown-group: Trying to add a converter to an unknown dispatchers group.",this);return this._helpers.get(e)}elementToElement(e){this.for("downcast").elementToElement(e);for(const{model:t,view:o}of Ia(e))this.for("upcast").elementToElement({model:t,view:o,converterPriority:e.converterPriority})}attributeToElement(e){this.for("downcast").attributeToElement(e);for(const{model:t,view:o}of Ia(e))this.for("upcast").elementToAttribute({view:o,model:t,converterPriority:e.converterPriority})}attributeToAttribute(e){this.for("downcast").attributeToAttribute(e);for(const{model:t,view:o}of Ia(e))this.for("upcast").attributeToAttribute({view:o,model:t})}_createConversionHelpers({name:e,dispatchers:t,isDowncast:o}){if(this._helpers.has(e))throw new mo.b("conversion-group-exists: Trying to register a group name that has already been registered.",this);const n=o?new Ks(t):new ia(t);this._helpers.set(e,n)}}function*Ia(e){if(e.model.values)for(const t of e.model.values){const o={key:e.model.key,value:t},n=e.view[t],i=e.upcastAlso?e.upcastAlso[t]:void 0;yield*Va(o,n,i)}else yield*Va(e.model,e.view,e.upcastAlso)}function*Va(e,t,o){if(yield{model:e,view:t},o){o=Array.isArray(o)?o:[o];for(const t of o)yield{model:e,view:t}}}class Oa{constructor(e="default"){this.operations=[],this.type=e}get baseVersion(){for(const e of this.operations)if(null!==e.baseVersion)return e.baseVersion;return null}addOperation(e){return e.batch=this,this.operations.push(e),e}}class Ma{constructor(e){this.baseVersion=e,this.isDocumentOperation=null!==this.baseVersion,this.batch=null}_validate(){}toJSON(){const e=Object.assign({},this);return e.__className=this.constructor.className,delete e.batch,delete e.isDocumentOperation,e}static get className(){return"Operation"}static fromJSON(e){return new this(e.baseVersion)}}class Na{constructor(e){this.markers=new Map,this._children=new vs,e&&this._insertChild(0,e)}[Symbol.iterator](){return this.getChildren()}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return 0===this.childCount}get root(){return this}get parent(){return null}is(e){return"documentFragment"===e||"model:documentFragment"===e}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}getPath(){return[]}getNodeByPath(e){let t=this;for(const o of e)t=t.getChild(t.offsetToIndex(o));return t}offsetToIndex(e){return this._children.offsetToIndex(e)}toJSON(){const e=[];for(const t of this._children)e.push(t.toJSON());return e}static fromJSON(e){const t=[];for(const o of e)o.name?t.push(ys.fromJSON(o)):t.push(ks.fromJSON(o));return new Na(t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const o=function(e){if("string"==typeof e)return[new ks(e)];xo(e)||(e=[e]);return Array.from(e).map(e=>"string"==typeof e?new ks(e):e instanceof _s?new ks(e.data,e.getAttributes()):e)}(t);for(const e of o)null!==e.parent&&e._remove(),e.parent=this;this._children._insertNodes(e,o)}_removeChildren(e,t=1){const o=this._children._removeNodes(e,t);for(const e of o)e.parent=null;return o}}function za(e,t){const o=(t=Da(t)).reduce((e,t)=>e+t.offsetSize,0),n=e.parent;Ha(e);const i=e.index;return n._insertChild(i,t),La(n,i+t.length),La(n,i),new Es(e,e.getShiftedBy(o))}function Ba(e){if(!e.isFlat)throw new mo.b("operation-utils-remove-range-not-flat: Trying to remove a range which starts and ends in different element.",this);const t=e.start.parent;Ha(e.start),Ha(e.end);const o=t._removeChildren(e.start.index,e.end.index-e.start.index);return La(t,e.start.index),o}function Fa(e,t){if(!e.isFlat)throw new mo.b("operation-utils-move-range-not-flat: Trying to move a range which starts and ends in different element.",this);const o=Ba(e);return za(t=t._getTransformedByDeletion(e.start,e.end.offset-e.start.offset),o)}function Da(e){const t=[];e instanceof Array||(e=[e]);for(let o=0;oe.maxOffset)throw new mo.b("move-operation-nodes-do-not-exist: The nodes which should be moved do not exist.",this);if(e===t&&o=o&&this.targetPosition.path[e]e._clone(!0))),t=new Ga(this.position,e,this.baseVersion);return t.shouldReceiveAttributes=this.shouldReceiveAttributes,t}getReversed(){const e=this.position.root.document.graveyard,t=new As(e,[0]);return new Ua(this.position,this.nodes.maxOffset,t,this.baseVersion+1)}_validate(){const e=this.position.parent;if(!e||e.maxOffsete._clone(!0))),za(this.position,e)}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e.nodes=this.nodes.toJSON(),e}static get className(){return"InsertOperation"}static fromJSON(e,t){const o=[];for(const t of e.nodes)t.name?o.push(ys.fromJSON(t)):o.push(ks.fromJSON(t));const n=new Ga(As.fromJSON(e.position,t),o,e.baseVersion);return n.shouldReceiveAttributes=e.shouldReceiveAttributes,n}}class Ka extends Ma{constructor(e,t,o,n,i,r){super(r),this.name=e,this.oldRange=t?t.clone():null,this.newRange=o?o.clone():null,this.affectsData=i,this._markers=n}get type(){return"marker"}clone(){return new Ka(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new Ka(this.name,this.newRange,this.oldRange,this._markers,this.affectsData,this.baseVersion+1)}_execute(){const e=this.newRange?"_set":"_remove";this._markers[e](this.name,this.newRange,!0,this.affectsData)}toJSON(){const e=super.toJSON();return this.oldRange&&(e.oldRange=this.oldRange.toJSON()),this.newRange&&(e.newRange=this.newRange.toJSON()),delete e._markers,e}static get className(){return"MarkerOperation"}static fromJSON(e,t){return new Ka(e.name,e.oldRange?Es.fromJSON(e.oldRange,t):null,e.newRange?Es.fromJSON(e.newRange,t):null,t.model.markers,e.affectsData,e.baseVersion)}}class Ja extends Ma{constructor(e,t,o,n){super(n),this.position=e,this.position.stickiness="toNext",this.oldName=t,this.newName=o}get type(){return"rename"}clone(){return new Ja(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new Ja(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){const e=this.position.nodeAfter;if(!(e instanceof ys))throw new mo.b("rename-operation-wrong-position: Given position is invalid or node after it is not an instance of Element.",this);if(e.name!==this.oldName)throw new mo.b("rename-operation-wrong-name: Element to change has different name than operation's old name.",this)}_execute(){this.position.nodeAfter.name=this.newName}toJSON(){const e=super.toJSON();return e.position=this.position.toJSON(),e}static get className(){return"RenameOperation"}static fromJSON(e,t){return new Ja(As.fromJSON(e.position,t),e.oldName,e.newName,e.baseVersion)}}class Ya extends Ma{constructor(e,t,o,n,i){super(i),this.root=e,this.key=t,this.oldValue=o,this.newValue=n}get type(){return null===this.oldValue?"addRootAttribute":null===this.newValue?"removeRootAttribute":"changeRootAttribute"}clone(){return new Ya(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new Ya(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is("documentFragment"))throw new mo.b("rootattribute-operation-not-a-root: The element to change is not a root element.",this,{root:this.root,key:this.key});if(null!==this.oldValue&&this.root.getAttribute(this.key)!==this.oldValue)throw new mo.b("rootattribute-operation-wrong-old-value: Changed node has different attribute value than operation's old attribute value.",this,{root:this.root,key:this.key});if(null===this.oldValue&&null!==this.newValue&&this.root.hasAttribute(this.key))throw new mo.b("rootattribute-operation-attribute-exists: The attribute with given key already exists.",this,{root:this.root,key:this.key})}_execute(){null!==this.newValue?this.root._setAttribute(this.key,this.newValue):this.root._removeAttribute(this.key)}toJSON(){const e=super.toJSON();return e.root=this.root.toJSON(),e}static get className(){return"RootAttributeOperation"}static fromJSON(e,t){if(!t.getRoot(e.root))throw new mo.b("rootattribute-operation-fromjson-no-root: Cannot create RootAttributeOperation. Root with specified name does not exist.",this,{rootName:e.root});return new Ya(t.getRoot(e.root),e.key,e.oldValue,e.newValue,e.baseVersion)}}class Qa extends Ma{constructor(e,t,o,n,i){super(i),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toPrevious",this.howMany=t,this.targetPosition=o.clone(),this.targetPosition.stickiness="toNext",this.graveyardPosition=n.clone()}get type(){return"merge"}get deletionPosition(){return new As(this.sourcePosition.root,this.sourcePosition.path.slice(0,-1))}get movedRange(){const e=this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);return new Es(this.sourcePosition,e)}clone(){return new this.constructor(this.sourcePosition,this.howMany,this.targetPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.targetPosition._getTransformedByMergeOperation(this),t=this.sourcePosition.path.slice(0,-1),o=new As(this.sourcePosition.root,t)._getTransformedByMergeOperation(this),n=new Xa(e,this.howMany,this.graveyardPosition,this.baseVersion+1);return n.insertionPosition=o,n}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent;if(!e.parent)throw new mo.b("merge-operation-source-position-invalid: Merge source position is invalid.",this);if(!t.parent)throw new mo.b("merge-operation-target-position-invalid: Merge target position is invalid.",this);if(this.howMany!=e.maxOffset)throw new mo.b("merge-operation-how-many-invalid: Merge operation specifies wrong number of nodes to move.",this)}_execute(){const e=this.sourcePosition.parent;Fa(Es._createIn(e),this.targetPosition),Fa(Es._createOn(e),this.graveyardPosition)}toJSON(){const e=super.toJSON();return e.sourcePosition=e.sourcePosition.toJSON(),e.targetPosition=e.targetPosition.toJSON(),e.graveyardPosition=e.graveyardPosition.toJSON(),e}static get className(){return"MergeOperation"}static fromJSON(e,t){const o=As.fromJSON(e.sourcePosition,t),n=As.fromJSON(e.targetPosition,t),i=As.fromJSON(e.graveyardPosition,t);return new this(o,e.howMany,n,i,e.baseVersion)}}class Xa extends Ma{constructor(e,t,o,n){super(n),this.splitPosition=e.clone(),this.splitPosition.stickiness="toNext",this.howMany=t,this.insertionPosition=Xa.getInsertionPosition(e),this.insertionPosition.stickiness="toNone",this.graveyardPosition=o?o.clone():null,this.graveyardPosition&&(this.graveyardPosition.stickiness="toNext")}get type(){return"split"}get moveTargetPosition(){const e=this.insertionPosition.path.slice();return e.push(0),new As(this.insertionPosition.root,e)}get movedRange(){const e=this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);return new Es(this.splitPosition,e)}clone(){const e=new this.constructor(this.splitPosition,this.howMany,this.graveyardPosition,this.baseVersion);return e.insertionPosition=this.insertionPosition,e}getReversed(){const e=this.splitPosition.root.document.graveyard,t=new As(e,[0]);return new Qa(this.moveTargetPosition,this.howMany,this.splitPosition,t,this.baseVersion+1)}_validate(){const e=this.splitPosition.parent,t=this.splitPosition.offset;if(!e||e.maxOffset{for(const t of e.getAttributeKeys())this.removeAttribute(t,e)};if(e instanceof Es)for(const o of e.getItems())t(o);else t(e)}move(e,t,o){if(this._assertWriterUsedCorrectly(),!(e instanceof Es))throw new mo.b("writer-move-invalid-range: Invalid range to move.",this);if(!e.isFlat)throw new mo.b("writer-move-range-not-flat: Range to move is not flat.",this);const n=As._createAt(t,o);if(n.isEqual(e.start))return;if(this._addOperationForAffectedMarkers("move",e),!rl(e.root,n.root))throw new mo.b("writer-move-different-document: Range is going to be moved between different documents.",this);const i=e.root.document?e.root.document.version:null,r=new Ua(e.start,e.end.offset-e.start.offset,n,i);this.batch.addOperation(r),this.model.applyOperation(r)}remove(e){this._assertWriterUsedCorrectly();const t=(e instanceof Es?e:Es._createOn(e)).getMinimalFlatRanges().reverse();for(const e of t)this._addOperationForAffectedMarkers("move",e),il(e.start,e.end.offset-e.start.offset,this.batch,this.model)}merge(e){this._assertWriterUsedCorrectly();const t=e.nodeBefore,o=e.nodeAfter;if(this._addOperationForAffectedMarkers("merge",e),!(t instanceof ys))throw new mo.b("writer-merge-no-element-before: Node before merge position must be an element.",this);if(!(o instanceof ys))throw new mo.b("writer-merge-no-element-after: Node after merge position must be an element.",this);e.root.document?this._merge(e):this._mergeDetached(e)}createPositionFromPath(e,t,o){return this.model.createPositionFromPath(e,t,o)}createPositionAt(e,t){return this.model.createPositionAt(e,t)}createPositionAfter(e){return this.model.createPositionAfter(e)}createPositionBefore(e){return this.model.createPositionBefore(e)}createRange(e,t){return this.model.createRange(e,t)}createRangeIn(e){return this.model.createRangeIn(e)}createRangeOn(e){return this.model.createRangeOn(e)}createSelection(e,t,o){return this.model.createSelection(e,t,o)}_mergeDetached(e){const t=e.nodeBefore,o=e.nodeAfter;this.move(Es._createIn(o),As._createAt(t,"end")),this.remove(o)}_merge(e){const t=As._createAt(e.nodeBefore,"end"),o=As._createAt(e.nodeAfter,0),n=e.root.document.graveyard,i=new As(n,[0]),r=e.root.document.version,s=new Qa(o,e.nodeAfter.maxOffset,t,i,r);this.batch.addOperation(s),this.model.applyOperation(s)}rename(e,t){if(this._assertWriterUsedCorrectly(),!(e instanceof ys))throw new mo.b("writer-rename-not-element-instance: Trying to rename an object which is not an instance of Element.",this);const o=e.root.document?e.root.document.version:null,n=new Ja(As._createBefore(e),e.name,t,o);this.batch.addOperation(n),this.model.applyOperation(n)}split(e,t){this._assertWriterUsedCorrectly();let o,n,i=e.parent;if(!i.parent)throw new mo.b("writer-split-element-no-parent: Element with no parent can not be split.",this);if(t||(t=i.parent),!e.parent.getAncestors({includeSelf:!0}).includes(t))throw new mo.b("writer-split-invalid-limit-element: Limit element is not a position ancestor.",this);do{const t=i.root.document?i.root.document.version:null,r=i.maxOffset-e.offset,s=new Xa(e,r,null,t);this.batch.addOperation(s),this.model.applyOperation(s),o||n||(o=i,n=e.parent.nextSibling),i=(e=this.createPositionAfter(e.parent)).parent}while(i!==t);return{position:e,range:new Es(As._createAt(o,"end"),As._createAt(n,0))}}wrap(e,t){if(this._assertWriterUsedCorrectly(),!e.isFlat)throw new mo.b("writer-wrap-range-not-flat: Range to wrap is not flat.",this);const o=t instanceof ys?t:new ys(t);if(o.childCount>0)throw new mo.b("writer-wrap-element-not-empty: Element to wrap with is not empty.",this);if(null!==o.parent)throw new mo.b("writer-wrap-element-attached: Element to wrap with is already attached to tree model.",this);this.insert(o,e.start);const n=new Es(e.start.getShiftedBy(1),e.end.getShiftedBy(1));this.move(n,As._createAt(o,0))}unwrap(e){if(this._assertWriterUsedCorrectly(),null===e.parent)throw new mo.b("writer-unwrap-element-no-parent: Trying to unwrap an element which has no parent.",this);this.move(Es._createIn(e),this.createPositionAfter(e)),this.remove(e)}addMarker(e,t){if(this._assertWriterUsedCorrectly(),!t||"boolean"!=typeof t.usingOperation)throw new mo.b("writer-addMarker-no-usingOperation: The options.usingOperation parameter is required when adding a new marker.",this);const o=t.usingOperation,n=t.range,i=void 0!==t.affectsData&&t.affectsData;if(this.model.markers.has(e))throw new mo.b("writer-addMarker-marker-exists: Marker with provided name already exists.",this);if(!n)throw new mo.b("writer-addMarker-no-range: Range parameter is required when adding a new marker.",this);return o?(nl(this,e,null,n,i),this.model.markers.get(e)):this.model.markers._set(e,n,o,i)}updateMarker(e,t){this._assertWriterUsedCorrectly();const o="string"==typeof e?e:e.name,n=this.model.markers.get(o);if(!n)throw new mo.b("writer-updateMarker-marker-not-exists: Marker with provided name does not exists.",this);if(!t)return void this.model.markers._refresh(n);const i="boolean"==typeof t.usingOperation,r="boolean"==typeof t.affectsData,s=r?t.affectsData:n.affectsData;if(!i&&!t.range&&!r)throw new mo.b("writer-updateMarker-wrong-options: One of the options is required - provide range, usingOperations or affectsData.",this);const a=n.getRange(),l=t.range?t.range:a;i&&t.usingOperation!==n.managedUsingOperations?t.usingOperation?nl(this,o,null,l,s):(nl(this,o,a,null,s),this.model.markers._set(o,l,void 0,s)):n.managedUsingOperations?nl(this,o,a,l,s):this.model.markers._set(o,l,void 0,s)}removeMarker(e){this._assertWriterUsedCorrectly();const t="string"==typeof e?e:e.name;if(!this.model.markers.has(t))throw new mo.b("writer-removeMarker-no-marker: Trying to remove marker which does not exist.",this);const o=this.model.markers.get(t);if(!o.managedUsingOperations)return void this.model.markers._remove(t);nl(this,t,o.getRange(),null,o.affectsData)}setSelection(e,t,o){this._assertWriterUsedCorrectly(),this.model.document.selection._setTo(e,t,o)}setSelectionFocus(e,t){this._assertWriterUsedCorrectly(),this.model.document.selection._setFocus(e,t)}setSelectionAttribute(e,t){if(this._assertWriterUsedCorrectly(),"string"==typeof e)this._setSelectionAttribute(e,t);else for(const[t,o]of Bo(e))this._setSelectionAttribute(t,o)}removeSelectionAttribute(e){if(this._assertWriterUsedCorrectly(),"string"==typeof e)this._removeSelectionAttribute(e);else for(const t of e)this._removeSelectionAttribute(t)}overrideSelectionGravity(){return this.model.document.selection._overrideGravity()}restoreSelectionGravity(e){this.model.document.selection._restoreGravity(e)}_setSelectionAttribute(e,t){const o=this.model.document.selection;if(o.isCollapsed&&o.anchor.parent.isEmpty){const n=Ws._getStoreAttributeKey(e);this.setAttribute(n,t,o.anchor.parent)}o._setAttribute(e,t)}_removeSelectionAttribute(e){const t=this.model.document.selection;if(t.isCollapsed&&t.anchor.parent.isEmpty){const o=Ws._getStoreAttributeKey(e);this.removeAttribute(o,t.anchor.parent)}t._removeAttribute(e)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new mo.b("writer-incorrect-use: Trying to use a writer outside the change() block.",this)}_addOperationForAffectedMarkers(e,t){for(const o of this.model.markers){if(!o.managedUsingOperations)continue;const n=o.getRange();let i=!1;if("move"===e)i=t.containsPosition(n.start)||t.start.isEqual(n.start)||t.containsPosition(n.end)||t.end.isEqual(n.end);else{const e=t.nodeBefore,o=t.nodeAfter,r=n.start.parent==e&&n.start.isAtEnd,s=n.end.parent==o&&0==n.end.offset,a=n.end.nodeAfter==o,l=n.start.nodeAfter==o;i=r||s||a||l}i&&this.updateMarker(o.name,{range:n})}}}function tl(e,t,o,n){const i=e.model,r=i.document;let s,a,l,c=n.start;for(const e of n.getWalker({shallow:!0}))l=e.item.getAttribute(t),s&&a!=l&&(a!=o&&d(),c=s),s=e.nextPosition,a=l;function d(){const n=new Es(c,s),l=n.root.document?r.version:null,d=new qa(n,t,a,o,l);e.batch.addOperation(d),i.applyOperation(d)}s instanceof As&&s!=c&&a!=o&&d()}function ol(e,t,o,n){const i=e.model,r=i.document,s=n.getAttribute(t);let a,l;if(s!=o){if(n.root===n){const e=n.document?r.version:null;l=new Ya(n,t,s,o,e)}else{a=new Es(As._createBefore(n),e.createPositionAfter(n));const i=a.root.document?r.version:null;l=new qa(a,t,s,o,i)}e.batch.addOperation(l),i.applyOperation(l)}}function nl(e,t,o,n,i){const r=e.model,s=r.document,a=new Ka(t,o,n,r.markers,i,s.version);e.batch.addOperation(a),r.applyOperation(a)}function il(e,t,o,n){let i;if(e.root.document){const o=n.document,r=new As(o.graveyard,[0]);i=new Ua(e,t,r,o.version)}else i=new $a(e,t);o.addOperation(i),n.applyOperation(i)}function rl(e,t){return e===t||e instanceof Za&&t instanceof Za}class sl{constructor(e){this._markerCollection=e,this._changesInElement=new Map,this._elementSnapshots=new Map,this._changedMarkers=new Map,this._changeCount=0,this._cachedChanges=null,this._cachedChangesWithGraveyard=null}get isEmpty(){return 0==this._changesInElement.size&&0==this._changedMarkers.size}refreshItem(e){if(this._isInInsertedElement(e.parent))return;this._markRemove(e.parent,e.startOffset,e.offsetSize),this._markInsert(e.parent,e.startOffset,e.offsetSize);const t=Es._createOn(e);for(const e of this._markerCollection.getMarkersIntersectingRange(t)){const t=e.getRange();this.bufferMarkerChange(e.name,t,t,e.affectsData)}this._cachedChanges=null}bufferOperation(e){switch(e.type){case"insert":if(this._isInInsertedElement(e.position.parent))return;this._markInsert(e.position.parent,e.position.offset,e.nodes.maxOffset);break;case"addAttribute":case"removeAttribute":case"changeAttribute":for(const t of e.range.getItems({shallow:!0}))this._isInInsertedElement(t.parent)||this._markAttribute(t);break;case"remove":case"move":case"reinsert":{if(e.sourcePosition.isEqual(e.targetPosition)||e.sourcePosition.getShiftedBy(e.howMany).isEqual(e.targetPosition))return;const t=this._isInInsertedElement(e.sourcePosition.parent),o=this._isInInsertedElement(e.targetPosition.parent);t||this._markRemove(e.sourcePosition.parent,e.sourcePosition.offset,e.howMany),o||this._markInsert(e.targetPosition.parent,e.getMovedRangeStart().offset,e.howMany);break}case"rename":{if(this._isInInsertedElement(e.position.parent))return;this._markRemove(e.position.parent,e.position.offset,1),this._markInsert(e.position.parent,e.position.offset,1);const t=Es._createFromPositionAndShift(e.position,1);for(const e of this._markerCollection.getMarkersIntersectingRange(t)){const t=e.getRange();this.bufferMarkerChange(e.name,t,t,e.affectsData)}break}case"split":{const t=e.splitPosition.parent;this._isInInsertedElement(t)||this._markRemove(t,e.splitPosition.offset,e.howMany),this._isInInsertedElement(e.insertionPosition.parent)||this._markInsert(e.insertionPosition.parent,e.insertionPosition.offset,1),e.graveyardPosition&&this._markRemove(e.graveyardPosition.parent,e.graveyardPosition.offset,1);break}case"merge":{const t=e.sourcePosition.parent;this._isInInsertedElement(t.parent)||this._markRemove(t.parent,t.startOffset,1);const o=e.graveyardPosition.parent;this._markInsert(o,e.graveyardPosition.offset,1);const n=e.targetPosition.parent;this._isInInsertedElement(n)||this._markInsert(n,e.targetPosition.offset,t.maxOffset);break}}this._cachedChanges=null}bufferMarkerChange(e,t,o,n){const i=this._changedMarkers.get(e);i?(i.newRange=o,i.affectsData=n,null==i.oldRange&&null==i.newRange&&this._changedMarkers.delete(e)):this._changedMarkers.set(e,{oldRange:t,newRange:o,affectsData:n})}getMarkersToRemove(){const e=[];for(const[t,o]of this._changedMarkers)null!=o.oldRange&&e.push({name:t,range:o.oldRange});return e}getMarkersToAdd(){const e=[];for(const[t,o]of this._changedMarkers)null!=o.newRange&&e.push({name:t,range:o.newRange});return e}getChangedMarkers(){return Array.from(this._changedMarkers).map(e=>({name:e[0],data:{oldRange:e[1].oldRange,newRange:e[1].newRange}}))}hasDataChanges(){for(const[,e]of this._changedMarkers)if(e.affectsData)return!0;return this._changesInElement.size>0}getChanges(e={includeChangesInGraveyard:!1}){if(this._cachedChanges)return e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice();const t=[];for(const e of this._changesInElement.keys()){const o=this._changesInElement.get(e).sort((e,t)=>e.offset===t.offset?e.type!=t.type?"remove"==e.type?-1:1:0:e.offsete.position.root!=t.position.root?e.position.root.rootNameo.offset){if(n>i){const e={type:"attribute",offset:i,howMany:n-i,count:this._changeCount++};this._handleChange(e,t),t.push(e)}e.nodesToHandle=o.offset-e.offset,e.howMany=e.nodesToHandle}else e.offset>=o.offset&&e.offseti?(e.nodesToHandle=n-i,e.offset=i):e.nodesToHandle=0);if("remove"==o.type&&e.offseto.offset){const i={type:"attribute",offset:o.offset,howMany:n-o.offset,count:this._changeCount++};this._handleChange(i,t),t.push(i),e.nodesToHandle=o.offset-e.offset,e.howMany=e.nodesToHandle}"attribute"==o.type&&(e.offset>=o.offset&&n<=i?(e.nodesToHandle=0,e.howMany=0,e.offset=0):e.offset<=o.offset&&n>=i&&(o.howMany=0))}}e.howMany=e.nodesToHandle,delete e.nodesToHandle}_getInsertDiff(e,t,o){return{type:"insert",position:As._createAt(e,t),name:o,length:1,changeCount:this._changeCount++}}_getRemoveDiff(e,t,o){return{type:"remove",position:As._createAt(e,t),name:o,length:1,changeCount:this._changeCount++}}_getAttributesDiff(e,t,o){const n=[];o=new Map(o);for(const[i,r]of t){const t=o.has(i)?o.get(i):null;t!==r&&n.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:i,attributeOldValue:r,attributeNewValue:t,changeCount:this._changeCount++}),o.delete(i)}for(const[t,i]of o)n.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:t,attributeOldValue:null,attributeNewValue:i,changeCount:this._changeCount++});return n}_isInInsertedElement(e){const t=e.parent;if(!t)return!1;const o=this._changesInElement.get(t),n=e.startOffset;if(o)for(const e of o)if("insert"==e.type&&n>=e.offset&&nn){for(let t=0;t{const o=t[0];if(o.isDocumentOperation&&o.baseVersion!==this.version)throw new mo.b("model-document-applyOperation-wrong-version: Only operations with matching versions can be applied.",this,{operation:o})},{priority:"highest"}),this.listenTo(e,"applyOperation",(e,t)=>{const o=t[0];o.isDocumentOperation&&this.differ.bufferOperation(o)},{priority:"high"}),this.listenTo(e,"applyOperation",(e,t)=>{const o=t[0];o.isDocumentOperation&&(this.version++,this.history.addOperation(o))},{priority:"low"}),this.listenTo(this.selection,"change",()=>{this._hasSelectionChangedFromTheLastChangeBlock=!0}),this.listenTo(e.markers,"update",(e,t,o,n)=>{this.differ.bufferMarkerChange(t.name,o,n,t.affectsData),null===o&&t.on("change",(e,o)=>{this.differ.bufferMarkerChange(t.name,o,t.getRange(),t.affectsData)})})}get graveyard(){return this.getRoot("$graveyard")}createRoot(e="$root",t="main"){if(this.roots.get(t))throw new mo.b("model-document-createRoot-name-exists: Root with specified name already exists.",this,{name:t});const o=new Za(this,e,t);return this.roots.add(o),o}destroy(){this.selection.destroy(),this.stopListening()}getRoot(e="main"){return this.roots.get(e)}getRootNames(){return Array.from(this.roots,e=>e.rootName).filter(e=>"$graveyard"!=e)}registerPostFixer(e){this._postFixers.add(e)}toJSON(){const e=Oo(this);return e.selection="[engine.model.DocumentSelection]",e.model="[engine.model.Model]",e}_handleChangeBlock(e){this._hasDocumentChangedFromTheLastChangeBlock()&&(this._callPostFixers(e),this.selection.refresh(),this.differ.hasDataChanges()?this.fire("change:data",e.batch):this.fire("change",e.batch),this.selection.refresh(),this.differ.reset()),this._hasSelectionChangedFromTheLastChangeBlock=!1}_hasDocumentChangedFromTheLastChangeBlock(){return!this.differ.isEmpty||this._hasSelectionChangedFromTheLastChangeBlock}_getDefaultRoot(){for(const e of this.roots)if(e!==this.graveyard)return e;return this.graveyard}_getDefaultRange(){const e=this._getDefaultRoot(),t=this.model,o=t.schema,n=t.createPositionFromPath(e,[0]);return o.getNearestSelectionRange(n)||t.createRange(n)}_validateSelectionRange(e){return gl(e.start)&&gl(e.end)}_callPostFixers(e){let t=!1;do{for(const o of this._postFixers)if(this.selection.refresh(),t=o(e),t)break}while(t)}}function gl(e){const t=e.textNode;if(t){const o=t.data,n=e.offset-t.startOffset;return!hl(o,n)&&!ul(o,n)}return!0}Co(ml,po);class fl{constructor(){this._markers=new Map}[Symbol.iterator](){return this._markers.values()}has(e){return this._markers.has(e)}get(e){return this._markers.get(e)||null}_set(e,t,o=!1,n=!1){const i=e instanceof pl?e.name:e;if(i.includes(","))throw new mo.b('markercollection-incorrect-marker-name: Marker name cannot contain the "," character.',this);const r=this._markers.get(i);if(r){const e=r.getRange();let s=!1;return e.isEqual(t)||(r._attachLiveRange(Ls.fromRange(t)),s=!0),o!=r.managedUsingOperations&&(r._managedUsingOperations=o,s=!0),"boolean"==typeof n&&n!=r.affectsData&&(r._affectsData=n,s=!0),s&&this.fire("update:"+i,r,e,t),r}const s=Ls.fromRange(t),a=new pl(i,s,o,n);return this._markers.set(i,a),this.fire("update:"+i,a,null,t),a}_remove(e){const t=e instanceof pl?e.name:e,o=this._markers.get(t);return!!o&&(this._markers.delete(t),this.fire("update:"+t,o,o.getRange(),null),this._destroyMarker(o),!0)}_refresh(e){const t=e instanceof pl?e.name:e,o=this._markers.get(t);if(!o)throw new mo.b("markercollection-refresh-marker-not-exists: Marker with provided name does not exists.",this);const n=o.getRange();this.fire("update:"+t,o,n,n,o.managedUsingOperations,o.affectsData)}*getMarkersAtPosition(e){for(const t of this)t.getRange().containsPosition(e)&&(yield t)}*getMarkersIntersectingRange(e){for(const t of this)null!==t.getRange().getIntersection(e)&&(yield t)}destroy(){for(const e of this._markers.values())this._destroyMarker(e);this._markers=null,this.stopListening()}*getMarkersGroup(e){for(const t of this._markers.values())t.name.startsWith(e+":")&&(yield t)}_destroyMarker(e){e.stopListening(),e._detachLiveRange()}}Co(fl,po);class pl{constructor(e,t,o,n){this.name=e,this._liveRange=this._attachLiveRange(t),this._managedUsingOperations=o,this._affectsData=n}get managedUsingOperations(){if(!this._liveRange)throw new mo.b("marker-destroyed: Cannot use a destroyed marker instance.",this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new mo.b("marker-destroyed: Cannot use a destroyed marker instance.",this);return this._affectsData}getStart(){if(!this._liveRange)throw new mo.b("marker-destroyed: Cannot use a destroyed marker instance.",this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new mo.b("marker-destroyed: Cannot use a destroyed marker instance.",this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new mo.b("marker-destroyed: Cannot use a destroyed marker instance.",this);return this._liveRange.toRange()}is(e){return"marker"===e||"model:marker"===e}_attachLiveRange(e){return this._liveRange&&this._detachLiveRange(),e.delegate("change:range").to(this),e.delegate("change:content").to(this),this._liveRange=e,e}_detachLiveRange(){this._liveRange.stopDelegating("change:range",this),this._liveRange.stopDelegating("change:content",this),this._liveRange.detach(),this._liveRange=null}}Co(pl,po);class bl extends Ma{get type(){return"noop"}clone(){return new bl(this.baseVersion)}getReversed(){return new bl(this.baseVersion+1)}_execute(){}static get className(){return"NoOperation"}}const wl={};wl[qa.className]=qa,wl[Ga.className]=Ga,wl[Ka.className]=Ka,wl[Ua.className]=Ua,wl[bl.className]=bl,wl[Ma.className]=Ma,wl[Ja.className]=Ja,wl[Ya.className]=Ya,wl[Xa.className]=Xa,wl[Qa.className]=Qa;class kl extends As{constructor(e,t,o="toNone"){if(super(e,t,o),!this.root.is("rootElement"))throw new mo.b("model-liveposition-root-not-rootelement: LivePosition's root has to be an instance of RootElement.",e);_l.call(this)}detach(){this.stopListening()}is(e){return"livePosition"===e||"model:livePosition"===e||"position"==e||"model:position"===e}toPosition(){return new As(this.root,this.path.slice(),this.stickiness)}static fromPosition(e,t){return new this(e.root,e.path.slice(),t||e.stickiness)}}function _l(){this.listenTo(this.root.document.model,"applyOperation",(e,t)=>{const o=t[0];o.isDocumentOperation&&vl.call(this,o)},{priority:"low"})}function vl(e){const t=this.getTransformedByOperation(e);if(!this.isEqual(t)){const e=this.toPosition();this.path=t.path,this.root=t.root,this.fire("change",e)}}Co(kl,po);class yl{constructor(e,t,o){this.model=e,this.writer=t,this.position=o,this.canMergeWith=new Set([this.position.parent]),this.schema=e.schema,this._filterAttributesOf=[],this._affectedStart=null,this._affectedEnd=null}handleNodes(e,t){e=Array.from(e);for(let o=0;o{if(!o.doNotResetEntireContent&&function(e,t){const o=e.getLimitElement(t);if(!t.containsEntireContent(o))return!1;const n=t.getFirstRange();if(n.start.parent==n.end.parent)return!1;return e.checkChild(o,"paragraph")}(i,t))return void function(e,t){const o=e.model.schema.getLimitElement(t);e.remove(e.createRangeIn(o)),Al(e,e.createPositionAt(o,0),t)}(e,t);const[r,s]=function(e){const t=e.root.document.model,o=e.start;let n=e.end;if(t.hasContent(e,{ignoreMarkers:!0})){const o=function(e){const t=e.parent,o=t.root.document.model.schema,n=t.getAncestors({parentFirst:!0,includeSelf:!0});for(const e of n){if(o.isLimit(e))return null;if(o.isBlock(e))return e}}(n);if(o&&n.isTouching(t.createPositionAt(o,0))){const o=t.createSelection(e);t.modifySelection(o,{direction:"backward"}),n=o.getLastPosition()}}return[kl.fromPosition(o,"toPrevious"),kl.fromPosition(n,"toNext")]}(n);n.start.isTouching(n.end)||e.remove(n),o.leaveUnmerged||(!function(e,t,o){const n=e.model;if(!Cl(e.model.schema,t,o))return;const[i,r]=function(e,t){const o=e.getAncestors(),n=t.getAncestors();let i=0;for(;o[i]&&o[i]==n[i];)i++;return[o[i],n[i]]}(t,o);!n.hasContent(i,{ignoreMarkers:!0})&&n.hasContent(r,{ignoreMarkers:!0})?function e(t,o,n,i){const r=o.parent,s=n.parent;if(r==i||s==i)return;o=t.createPositionAfter(r),(n=t.createPositionBefore(s)).isEqual(o)||t.insert(r,n);for(;o.parent.isEmpty;){const e=o.parent;o=t.createPositionBefore(e),t.remove(e)}if(n=t.createPositionBefore(s),function(e,t){const o=t.nodeBefore,n=t.nodeAfter;o.name!=n.name&&e.rename(o,n.name);e.clearAttributes(o),e.setAttributes(Object.fromEntries(n.getAttributes()),o),e.merge(t)}(t,n),!Cl(t.model.schema,o,n))return;e(t,o,n,i)}(e,t,o,i.parent):function e(t,o,n,i){const r=o.parent,s=n.parent;if(r==i||s==i)return;o=t.createPositionAfter(r),(n=t.createPositionBefore(s)).isEqual(o)||t.insert(s,o);t.merge(o);for(;n.parent.isEmpty;){const e=n.parent;n=t.createPositionBefore(e),t.remove(e)}if(!Cl(t.model.schema,o,n))return;e(t,o,n,i)}(e,t,o,i.parent)}(e,r,s),i.removeDisallowedAttributes(r.parent.getChildren(),e)),Tl(e,t,r),!o.doNotAutoparagraph&&function(e,t){const o=e.checkChild(t,"$text"),n=e.checkChild(t,"paragraph");return!o&&n}(i,r)&&Al(e,r,t),r.detach(),s.detach()})}function Cl(e,t,o){const n=t.parent,i=o.parent;return n!=i&&(!e.isLimit(n)&&!e.isLimit(i)&&function(e,t,o){const n=new Es(e,t);for(const e of n.getWalker())if(o.isLimit(e.item))return!1;return!0}(t,o,e))}function Al(e,t,o){const n=e.createElement("paragraph");e.insert(n,t),Tl(e,o,e.createPositionAt(n,0))}function Tl(e,t,o){t instanceof Ws?e.setSelection(o):t.setTo(o)}function Pl(e,t){const{isForward:o,walker:n,unit:i,schema:r}=e,{type:s,item:a,nextPosition:l}=t;if("text"==s)return"word"===e.unit?function(e,t){let o=e.position.textNode;if(o){let n=e.position.offset-o.startOffset;for(;!El(o.data,n,t)&&!Rl(o,n,t);){e.next();const i=t?e.position.nodeAfter:e.position.nodeBefore;if(i&&i.is("$text")){const n=i.data.charAt(t?0:i.data.length-1);' ,.?!:;"-()'.includes(n)||(e.next(),o=e.position.textNode)}n=e.position.offset-o.startOffset}}return e.position}(n,o):function(e,t){const o=e.position.textNode;if(o){const n=o.data;let i=e.position.offset-o.startOffset;for(;hl(n,i)||"character"==t&&ul(n,i);)e.next(),i=e.position.offset-o.startOffset}return e.position}(n,i);if(s==(o?"elementStart":"elementEnd")){if(r.isSelectable(a))return As._createAt(a,o?"after":"before");if(r.checkChild(l,"$text"))return l}else{if(r.isLimit(a))return void n.skip(()=>!0);if(r.checkChild(l,"$text"))return l}}function Sl(e,t){const o=e.root,n=As._createAt(o,t?"end":0);return t?new Es(e,n):new Es(n,e)}function El(e,t,o){const n=t+(o?0:-1);return' ,.?!:;"-()'.includes(e.charAt(n))}function Rl(e,t,o){return t===(o?e.endOffset:0)}function Il(e,t){const o=[];Array.from(e.getItems({direction:"backward"})).map(e=>t.createRangeOn(e)).filter(t=>(t.start.isAfter(e.start)||t.start.isEqual(e.start))&&(t.end.isBefore(e.end)||t.end.isEqual(e.end))).forEach(e=>{o.push(e.start.parent),t.remove(e)}),o.forEach(e=>{let o=e;for(;o.parent&&o.isEmpty;){const e=t.createRangeOn(o);o=o.parent,t.remove(e)}})}function Vl(e){e.document.registerPostFixer(t=>function(e,t){const o=t.document.selection,n=t.schema,i=[];let r=!1;for(const e of o.getRanges()){const t=Ol(e,n);t&&!t.isEqual(e)?(i.push(t),r=!0):i.push(e)}r&&e.setSelection(function(e){const t=[];t.push(e.shift());for(const o of e){const e=t.pop();if(o.isIntersecting(e)){const n=e.start.isAfter(o.start)?o.start:e.start,i=e.end.isAfter(o.end)?e.end:o.end,r=new Es(n,i);t.push(r)}else t.push(e),t.push(o)}return t}(i),{backward:o.isBackward})}(t,e))}function Ol(e,t){return e.isCollapsed?function(e,t){const o=e.start,n=t.getNearestSelectionRange(o);if(!n)return null;if(!n.isCollapsed)return n;const i=n.start;if(o.isEqual(i))return null;return new Es(i)}(e,t):function(e,t){const{start:o,end:n}=e,i=t.checkChild(o,"$text"),r=t.checkChild(n,"$text"),s=t.getLimitElement(o),a=t.getLimitElement(n);if(s===a){if(i&&r)return null;if(function(e,t,o){const n=e.nodeAfter&&!o.isLimit(e.nodeAfter)||o.checkChild(e,"$text"),i=t.nodeBefore&&!o.isLimit(t.nodeBefore)||o.checkChild(t,"$text");return n||i}(o,n,t)){const e=o.nodeAfter&&t.isSelectable(o.nodeAfter)?null:t.getNearestSelectionRange(o,"forward"),i=n.nodeBefore&&t.isSelectable(n.nodeBefore)?null:t.getNearestSelectionRange(n,"backward"),r=e?e.start:o,s=i?i.start:n;return new Es(r,s)}}const l=s&&!s.is("rootElement"),c=a&&!a.is("rootElement");if(l||c){const e=o.nodeAfter&&n.nodeBefore&&o.nodeAfter.parent===n.nodeBefore.parent,i=l&&(!e||!Nl(o.nodeAfter,t)),r=c&&(!e||!Nl(n.nodeBefore,t));let d=o,h=n;return i&&(d=As._createBefore(Ml(s,t))),r&&(h=As._createAfter(Ml(a,t))),new Es(d,h)}return null}(e,t)}function Ml(e,t){let o=e,n=o;for(;t.isLimit(n)&&n.parent;)o=n,n=n.parent;return o}function Nl(e,t){return e&&t.isSelectable(e)}class zl{constructor(){this.markers=new fl,this.document=new ml(this),this.schema=new fa,this._pendingChanges=[],this._currentWriter=null,["insertContent","deleteContent","modifySelection","getSelectedContent","applyOperation"].forEach(e=>this.decorate(e)),this.on("applyOperation",(e,t)=>{t[0]._validate()},{priority:"highest"}),this.schema.register("$root",{isLimit:!0}),this.schema.register("$block",{allowIn:"$root",isBlock:!0}),this.schema.register("$text",{allowIn:"$block",isInline:!0,isContent:!0}),this.schema.register("$clipboardHolder",{allowContentOf:"$root",isLimit:!0}),this.schema.extend("$text",{allowIn:"$clipboardHolder"}),this.schema.register("$marker"),this.schema.addChildCheck((e,t)=>{if("$marker"===t.name)return!0}),Vl(this),this.document.registerPostFixer(ta)}change(e){try{return 0===this._pendingChanges.length?(this._pendingChanges.push({batch:new Oa,callback:e}),this._runPendingChanges()[0]):e(this._currentWriter)}catch(e){mo.b.rethrowUnexpectedError(e,this)}}enqueueChange(e,t){try{"string"==typeof e?e=new Oa(e):"function"==typeof e&&(t=e,e=new Oa),this._pendingChanges.push({batch:e,callback:t}),1==this._pendingChanges.length&&this._runPendingChanges()}catch(e){mo.b.rethrowUnexpectedError(e,this)}}applyOperation(e){e._execute()}insertContent(e,t,o){return function(e,t,o,n){return e.change(i=>{let r;r=o?o instanceof Ns||o instanceof Ws?o:i.createSelection(o,n):e.document.selection,r.isCollapsed||e.deleteContent(r,{doNotAutoparagraph:!0});const s=new yl(e,i,r.anchor);let a;a=t.is("documentFragment")?t.getChildren():[t],s.handleNodes(a,{isFirst:!0,isLast:!0});const l=s.getSelectionRange();l&&(r instanceof Ws?i.setSelection(l):r.setTo(l));const c=s.getAffectedRange()||e.createRange(r.anchor);return s.destroy(),c})}(this,e,t,o)}deleteContent(e,t){xl(this,e,t)}modifySelection(e,t){!function(e,t,o={}){const n=e.schema,i="backward"!=o.direction,r=o.unit?o.unit:"character",s=t.focus,a=new xs({boundaries:Sl(s,i),singleCharacters:!0,direction:i?"forward":"backward"}),l={walker:a,schema:n,isForward:i,unit:r};let c;for(;c=a.next();){if(c.done)return;const o=Pl(l,c.value);if(o)return void(t instanceof Ws?e.change(e=>{e.setSelectionFocus(o)}):t.setFocus(o))}}(this,e,t)}getSelectedContent(e){return function(e,t){return e.change(e=>{const o=e.createDocumentFragment(),n=t.getFirstRange();if(!n||n.isCollapsed)return o;const i=n.start.root,r=n.start.getCommonPath(n.end),s=i.getNodeByPath(r);let a;a=n.start.parent==n.end.parent?n:e.createRange(e.createPositionAt(s,n.start.path[r.length]),e.createPositionAt(s,n.end.path[r.length]+1));const l=a.end.offset-a.start.offset;for(const t of a.getItems({shallow:!0}))t.is("$textProxy")?e.appendText(t.data,t.getAttributes(),o):e.append(e.cloneElement(t,!0),o);if(a!=n){const t=n._getTransformedByMove(a.start,e.createPositionAt(o,0),l)[0],i=e.createRange(e.createPositionAt(o,0),t.start);Il(e.createRange(t.end,e.createPositionAt(o,"end")),e),Il(i,e)}return o})}(this,e)}hasContent(e,t={}){const o=e instanceof ys?Es._createIn(e):e;if(o.isCollapsed)return!1;const{ignoreWhitespaces:n=!1,ignoreMarkers:i=!1}=t;if(!i)for(const e of this.markers.getMarkersIntersectingRange(o))if(e.affectsData)return!0;for(const e of o.getItems())if(this.schema.isContent(e)){if(!e.is("$textProxy"))return!0;if(!n)return!0;if(-1!==e.data.search(/\S/))return!0}return!1}createPositionFromPath(e,t,o){return new As(e,t,o)}createPositionAt(e,t){return As._createAt(e,t)}createPositionAfter(e){return As._createAfter(e)}createPositionBefore(e){return As._createBefore(e)}createRange(e,t){return new Es(e,t)}createRangeIn(e){return Es._createIn(e)}createRangeOn(e){return Es._createOn(e)}createSelection(e,t,o){return new Ns(e,t,o)}createBatch(e){return new Oa(e)}createOperationFromJSON(e){return class{static fromJSON(e,t){return wl[e.__className].fromJSON(e,t)}}.fromJSON(e,this.document)}destroy(){this.document.destroy(),this.stopListening()}_runPendingChanges(){const e=[];for(this.fire("_beforeChanges");this._pendingChanges.length;){const t=this._pendingChanges[0].batch;this._currentWriter=new el(this,t);const o=this._pendingChanges[0].callback(this._currentWriter);e.push(o),this.document._handleChangeBlock(this._currentWriter),this._pendingChanges.shift(),this._currentWriter=null}return this.fire("_afterChanges"),e}}Co(zl,qn);class Bl{constructor(){this._listener=Object.create(gr)}listenTo(e){this._listener.listenTo(e,"keydown",(e,t)=>{this._listener.fire("_keydown:"+bi(t),t)})}set(e,t,o={}){const n=wi(e),i=o.priority;this._listener.listenTo(this._listener,"_keydown:"+n,(e,o)=>{t(o,()=>{o.preventDefault(),o.stopPropagation(),e.stop()}),e.return=!0},{priority:i})}press(e){return!!this._listener.fire("_keydown:"+bi(e),e)}destroy(){this._listener.stopListening()}}class Fl extends Bl{constructor(e){super(),this.editor=e}set(e,t,o={}){if("string"==typeof t){const e=t;t=(t,o)=>{this.editor.execute(e),o()}}super.set(e,t,o)}}class Dl{constructor(e={}){this._context=e.context||new Io({language:e.language}),this._context._addEditor(this,!e.context);const t=Array.from(this.constructor.builtinPlugins||[]);this.config=new io(e,this.constructor.defaultConfig),this.config.define("plugins",t),this.config.define(this._context._getEditorConfig()),this.plugins=new To(this,t,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this.commands=new ua,this.set("state","initializing"),this.once("ready",()=>this.state="ready",{priority:"high"}),this.once("destroy",()=>this.state="destroyed",{priority:"high"}),this.set("isReadOnly",!1),this.model=new zl;const o=new Vn;this.data=new Ea(this.model,o),this.editing=new ha(this.model,o),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new Ra([this.editing.downcastDispatcher,this.data.downcastDispatcher],this.data.upcastDispatcher),this.conversion.addAlias("dataDowncast",this.data.downcastDispatcher),this.conversion.addAlias("editingDowncast",this.editing.downcastDispatcher),this.keystrokes=new Fl(this),this.keystrokes.listenTo(this.editing.view.document)}initPlugins(){const e=this.config,t=e.get("plugins"),o=e.get("removePlugins")||[],n=e.get("extraPlugins")||[];return this.plugins.init(t.concat(n),o)}destroy(){let e=Promise.resolve();return"initializing"==this.state&&(e=new Promise(e=>this.once("ready",e))),e.then(()=>{this.fire("destroy"),this.stopListening(),this.commands.destroy()}).then(()=>this.plugins.destroy()).then(()=>{this.model.destroy(),this.data.destroy(),this.editing.destroy(),this.keystrokes.destroy()}).then(()=>this._context._removeEditor(this))}execute(...e){try{return this.commands.execute(...e)}catch(e){mo.b.rethrowUnexpectedError(e,this)}}}Co(Dl,qn);class Ll{getHtml(e){const t=document.implementation.createHTMLDocument("").createElement("div");return t.appendChild(e),t.innerHTML}}class Hl{constructor(e){this._domParser=new DOMParser,this._domConverter=new cr(e,{blockFillerMode:"nbsp"}),this._htmlWriter=new Ll}toData(e){const t=this._domConverter.viewToDom(e,document);return this._htmlWriter.getHtml(t)}toView(e){const t=this._toDom(e);return this._domConverter.domToView(t)}_toDom(e){const t=this._domParser.parseFromString(e,"text/html"),o=t.createDocumentFragment(),n=t.body.childNodes;for(;n.length>0;)o.appendChild(n[0]);return o}}class jl{constructor(e){this.editor=e,this.set("isEnabled",!0),this._disableStack=new Set}forceDisabled(e){this._disableStack.add(e),1==this._disableStack.size&&(this.on("set:isEnabled",Wl,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),0==this._disableStack.size&&(this.off("set:isEnabled",Wl),this.isEnabled=!0)}destroy(){this.stopListening()}static get isContextPlugin(){return!1}}function Wl(e){e.return=!1,e.stop()}Co(jl,qn);class ql extends Ao{constructor(e=[]){super(e,{idProperty:"viewUid"}),this.on("add",(e,t,o)=>{this._renderViewIntoCollectionParent(t,o)}),this.on("remove",(e,t)=>{t.element&&this._parentElement&&t.element.remove()}),this._parentElement=null}destroy(){this.map(e=>e.destroy())}setParent(e){this._parentElement=e;for(const e of this)this._renderViewIntoCollectionParent(e)}delegate(...e){if(!e.length||!e.every(e=>"string"==typeof e))throw new mo.b("ui-viewcollection-delegate-wrong-events: All event names must be strings.",this);return{to:t=>{for(const o of this)for(const n of e)o.delegate(n).to(t);this.on("add",(o,n)=>{for(const o of e)n.delegate(o).to(t)}),this.on("remove",(o,n)=>{for(const o of e)n.stopDelegating(o,t)})}}}_renderViewIntoCollectionParent(e,t){e.isRendered||e.render(),e.element&&this._parentElement&&this._parentElement.insertBefore(e.element,this._parentElement.children[t])}}class $l{constructor(e){Object.assign(this,tc(ec(e))),this._isRendered=!1,this._revertData=null}render(){const e=this._renderNode({intoFragment:!0});return this._isRendered=!0,e}apply(e){return this._revertData={children:[],bindings:[],attributes:{}},this._renderNode({node:e,isApplying:!0,revertData:this._revertData}),e}revert(e){if(!this._revertData)throw new mo.b("ui-template-revert-not-applied: Attempting to revert a template which has not been applied yet.",[this,e]);this._revertTemplateFromNode(e,this._revertData)}*getViews(){yield*function*e(t){if(t.children)for(const o of t.children)sc(o)?yield o:ac(o)&&(yield*e(o))}(this)}static bind(e,t){return{to:(o,n)=>new Gl({eventNameOrFunction:o,attribute:o,observable:e,emitter:t,callback:n}),if:(o,n,i)=>new Kl({observable:e,emitter:t,attribute:o,valueIfTrue:n,callback:i})}}static extend(e,t){if(e._isRendered)throw new mo.b("template-extend-render: Attempting to extend a template which has already been rendered.",[this,e]);!function e(t,o){o.attributes&&(t.attributes||(t.attributes={}),ic(t.attributes,o.attributes));o.eventListeners&&(t.eventListeners||(t.eventListeners={}),ic(t.eventListeners,o.eventListeners));o.text&&t.text.push(...o.text);if(o.children&&o.children.length){if(t.children.length!=o.children.length)throw new mo.b("ui-template-extend-children-mismatch: The number of children in extended definition does not match.",t);let n=0;for(const i of o.children)e(t.children[n++],i)}}(e,tc(ec(t)))}_renderNode(e){let t;if(t=e.node?this.tag&&this.text:this.tag?this.text:!this.text,t)throw new mo.b('ui-template-wrong-syntax: Node definition must have either "tag" or "text" when rendering a new Node.',this);return this.text?this._renderText(e):this._renderElement(e)}_renderElement(e){let t=e.node;return t||(t=e.node=document.createElementNS(this.ns||"http://www.w3.org/1999/xhtml",this.tag)),this._renderAttributes(e),this._renderElementChildren(e),this._setUpListeners(e),t}_renderText(e){let t=e.node;return t?e.revertData.text=t.textContent:t=e.node=document.createTextNode(""),Jl(this.text)?this._bindToObservable({schema:this.text,updater:Ql(t),data:e}):t.textContent=this.text.join(""),t}_renderAttributes(e){let t,o,n,i;if(!this.attributes)return;const r=e.node,s=e.revertData;for(t in this.attributes)if(n=r.getAttribute(t),o=this.attributes[t],s&&(s.attributes[t]=n),i=B(o[0])&&o[0].ns?o[0].ns:null,Jl(o)){const a=i?o[0].value:o;s&&cc(t)&&a.unshift(n),this._bindToObservable({schema:a,updater:Xl(r,t,i),data:e})}else"style"==t&&"string"!=typeof o[0]?this._renderStyleAttribute(o[0],e):(s&&n&&cc(t)&&o.unshift(n),o=o.map(e=>e&&e.value||e).reduce((e,t)=>e.concat(t),[]).reduce(nc,""),rc(o)||r.setAttributeNS(i,t,o))}_renderStyleAttribute(e,t){const o=t.node;for(const n in e){const i=e[n];Jl(i)?this._bindToObservable({schema:[i],updater:Zl(o,n),data:t}):o.style[n]=i}}_renderElementChildren(e){const t=e.node,o=e.intoFragment?document.createDocumentFragment():t,n=e.isApplying;let i=0;for(const r of this.children)if(lc(r)){if(!n){r.setParent(t);for(const e of r)o.appendChild(e.element)}}else if(sc(r))n||(r.isRendered||r.render(),o.appendChild(r.element));else if(er(r))o.appendChild(r);else if(n){const t={children:[],bindings:[],attributes:{}};e.revertData.children.push(t),r._renderNode({node:o.childNodes[i++],isApplying:!0,revertData:t})}else o.appendChild(r.render());e.intoFragment&&t.appendChild(o)}_setUpListeners(e){if(this.eventListeners)for(const t in this.eventListeners){const o=this.eventListeners[t].map(o=>{const[n,i]=t.split("@");return o.activateDomEventListener(n,i,e)});e.revertData&&e.revertData.bindings.push(o)}}_bindToObservable({schema:e,updater:t,data:o}){const n=o.revertData;Yl(e,t,o);const i=e.filter(e=>!rc(e)).filter(e=>e.observable).map(n=>n.activateAttributeListener(e,t,o));n&&n.bindings.push(i)}_revertTemplateFromNode(e,t){for(const e of t.bindings)for(const t of e)t();if(t.text)e.textContent=t.text;else{for(const o in t.attributes){const n=t.attributes[o];null===n?e.removeAttribute(o):e.setAttribute(o,n)}for(let o=0;oYl(e,t,o);return this.emitter.listenTo(this.observable,"change:"+this.attribute,n),()=>{this.emitter.stopListening(this.observable,"change:"+this.attribute,n)}}}class Gl extends Ul{activateDomEventListener(e,t,o){const n=(e,o)=>{t&&!o.target.matches(t)||("function"==typeof this.eventNameOrFunction?this.eventNameOrFunction(o):this.observable.fire(this.eventNameOrFunction,o))};return this.emitter.listenTo(o.node,e,n),()=>{this.emitter.stopListening(o.node,e,n)}}}class Kl extends Ul{getValue(e){return!rc(super.getValue(e))&&(this.valueIfTrue||!0)}}function Jl(e){return!!e&&(e.value&&(e=e.value),Array.isArray(e)?e.some(Jl):e instanceof Ul)}function Yl(e,t,{node:o}){let n=function(e,t){return e.map(e=>e instanceof Ul?e.getValue(t):e)}(e,o);n=1==e.length&&e[0]instanceof Kl?n[0]:n.reduce(nc,""),rc(n)?t.remove():t.set(n)}function Ql(e){return{set(t){e.textContent=t},remove(){e.textContent=""}}}function Xl(e,t,o){return{set(n){e.setAttributeNS(o,t,n)},remove(){e.removeAttributeNS(o,t)}}}function Zl(e,t){return{set(o){e.style[t]=o},remove(){e.style[t]=null}}}function ec(e){return oo(e,e=>{if(e&&(e instanceof Ul||ac(e)||sc(e)||lc(e)))return e})}function tc(e){if("string"==typeof e?e=function(e){return{text:[e]}}(e):e.text&&function(e){Array.isArray(e.text)||(e.text=[e.text])}(e),e.on&&(e.eventListeners=function(e){for(const t in e)oc(e,t);return e}(e.on),delete e.on),!e.text){e.attributes&&function(e){for(const t in e)e[t].value&&(e[t].value=[].concat(e[t].value)),oc(e,t)}(e.attributes);const t=[];if(e.children)if(lc(e.children))t.push(e.children);else for(const o of e.children)ac(o)||sc(o)||er(o)?t.push(o):t.push(new $l(o));e.children=t}return e}function oc(e,t){Array.isArray(e[t])||(e[t]=[e[t]])}function nc(e,t){return rc(t)?e:rc(e)?t:`${e} ${t}`}function ic(e,t){for(const o in t)e[o]?e[o].push(...t[o]):e[o]=t[o]}function rc(e){return!e&&0!==e}function sc(e){return e instanceof dc}function ac(e){return e instanceof $l}function lc(e){return e instanceof ql}function cc(e){return"class"==e||"style"==e}o(16);class dc{constructor(e){this.element=null,this.isRendered=!1,this.locale=e,this.t=e&&e.t,this._viewCollections=new Ao,this._unboundChildren=this.createCollection(),this._viewCollections.on("add",(t,o)=>{o.locale=e}),this.decorate("render")}get bindTemplate(){return this._bindTemplate?this._bindTemplate:this._bindTemplate=$l.bind(this,this)}createCollection(e){const t=new ql(e);return this._viewCollections.add(t),t}registerChild(e){xo(e)||(e=[e]);for(const t of e)this._unboundChildren.add(t)}deregisterChild(e){xo(e)||(e=[e]);for(const t of e)this._unboundChildren.remove(t)}setTemplate(e){this.template=new $l(e)}extendTemplate(e){$l.extend(this.template,e)}render(){if(this.isRendered)throw new mo.b("ui-view-render-already-rendered: This View has already been rendered.",this);this.template&&(this.element=this.template.render(),this.registerChild(this.template.getViews())),this.isRendered=!0}destroy(){this.stopListening(),this._viewCollections.map(e=>e.destroy()),this.template&&this.template._revertData&&this.template.revert(this.element)}}function hc({element:e,target:t,positions:o,limiter:n,fitInViewport:i}){D(t)&&(t=t()),D(n)&&(n=n());const r=function(e){return e&&e.parentNode?e.offsetParent===rr.document.body?null:e.offsetParent:null}(e),s=new is(e),a=new is(t);let l,c;if(n||i){const e=function(e,t){const{elementRect:o,viewportRect:n}=t,i=o.getArea(),r=function(e,{targetRect:t,elementRect:o,limiterRect:n,viewportRect:i}){const r=[],s=o.getArea();for(const a of e){const e=uc(a,t,o);if(!e)continue;const[l,c]=e;let d=0,h=0;if(n)if(i){const e=n.getIntersection(i);e&&(d=e.getIntersectionArea(c))}else d=n.getIntersectionArea(c);i&&(h=i.getIntersectionArea(c));const u={positionName:l,positionRect:c,limiterIntersectArea:d,viewportIntersectArea:h};if(d===s)return[u];r.push(u)}return r}(e,t);if(n){const e=mc(r.filter(({viewportIntersectArea:e})=>e===i),i);if(e)return e}return mc(r,i)}(o,{targetRect:a,elementRect:s,limiterRect:n&&new is(n).getVisible(),viewportRect:i&&new is(rr.window)});[c,l]=e||uc(o[0],a,s)}else[c,l]=uc(o[0],a,s);let d=gc(l);return r&&(d=function({left:e,top:t},o){const n=gc(new is(o)),i=os(o);return e-=n.left,t-=n.top,e+=o.scrollLeft,t+=o.scrollTop,e-=i.left,t-=i.top,{left:e,top:t}}(d,r)),{left:d.left,top:d.top,name:c}}function uc(e,t,o){const n=e(t,o);if(!n)return null;const{left:i,top:r,name:s}=n;return[s,o.clone().moveTo(i,r)]}function mc(e,t){let o,n,i=0;for(const{positionName:r,positionRect:s,limiterIntersectArea:a,viewportIntersectArea:l}of e){if(a===t)return[r,s];const e=l**2+a**2;e>i&&(i=e,o=s,n=r)}return o?[n,o]:null}function gc({left:e,top:t}){const{scrollX:o,scrollY:n}=rr.window;return{left:e+o,top:t+n}}function fc(e){return t=>t+e}Co(dc,gr),Co(dc,qn);o(18);const pc=fc("px"),bc=rr.document.body;class wc extends dc{constructor(e){super(e);const t=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("position","arrow_nw"),this.set("isVisible",!1),this.set("withArrow",!0),this.set("class"),this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-panel",t.to("position",e=>"ck-balloon-panel_"+e),t.if("isVisible","ck-balloon-panel_visible"),t.if("withArrow","ck-balloon-panel_with-arrow"),t.to("class")],style:{top:t.to("top",pc),left:t.to("left",pc)}},children:this.content})}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(e){this.show();const t=wc.defaultPositions,o=Object.assign({},{element:this.element,positions:[t.southArrowNorth,t.southArrowNorthMiddleWest,t.southArrowNorthMiddleEast,t.southArrowNorthWest,t.southArrowNorthEast,t.northArrowSouth,t.northArrowSouthMiddleWest,t.northArrowSouthMiddleEast,t.northArrowSouthWest,t.northArrowSouthEast],limiter:bc,fitInViewport:!0},e),n=wc._getOptimalPosition(o),i=parseInt(n.left),r=parseInt(n.top),s=n.name;Object.assign(this,{top:r,left:i,position:s})}pin(e){this.unpin(),this._pinWhenIsVisibleCallback=()=>{this.isVisible?this._startPinning(e):this._stopPinning()},this._startPinning(e),this.listenTo(this,"change:isVisible",this._pinWhenIsVisibleCallback)}unpin(){this._pinWhenIsVisibleCallback&&(this._stopPinning(),this.stopListening(this,"change:isVisible",this._pinWhenIsVisibleCallback),this._pinWhenIsVisibleCallback=null,this.hide())}_startPinning(e){this.attachTo(e);const t=kc(e.target),o=e.limiter?kc(e.limiter):bc;this.listenTo(rr.document,"scroll",(n,i)=>{const r=i.target,s=t&&r.contains(t),a=o&&r.contains(o);!s&&!a&&t&&o||this.attachTo(e)},{useCapture:!0}),this.listenTo(rr.window,"resize",()=>{this.attachTo(e)})}_stopPinning(){this.stopListening(rr.document,"scroll"),this.stopListening(rr.window,"resize")}}function kc(e){return no(e)?e:ts(e)?e.commonAncestorContainer:"function"==typeof e?kc(e()):null}function _c(e,t){return e.top-t.height-wc.arrowVerticalOffset}function vc(e){return e.bottom+wc.arrowVerticalOffset}wc.arrowHorizontalOffset=25,wc.arrowVerticalOffset=10,wc._getOptimalPosition=hc,wc.defaultPositions={northWestArrowSouthWest:(e,t)=>({top:_c(e,t),left:e.left-wc.arrowHorizontalOffset,name:"arrow_sw"}),northWestArrowSouthMiddleWest:(e,t)=>({top:_c(e,t),left:e.left-.25*t.width-wc.arrowHorizontalOffset,name:"arrow_smw"}),northWestArrowSouth:(e,t)=>({top:_c(e,t),left:e.left-t.width/2,name:"arrow_s"}),northWestArrowSouthMiddleEast:(e,t)=>({top:_c(e,t),left:e.left-.75*t.width+wc.arrowHorizontalOffset,name:"arrow_sme"}),northWestArrowSouthEast:(e,t)=>({top:_c(e,t),left:e.left-t.width+wc.arrowHorizontalOffset,name:"arrow_se"}),northArrowSouthWest:(e,t)=>({top:_c(e,t),left:e.left+e.width/2-wc.arrowHorizontalOffset,name:"arrow_sw"}),northArrowSouthMiddleWest:(e,t)=>({top:_c(e,t),left:e.left+e.width/2-.25*t.width-wc.arrowHorizontalOffset,name:"arrow_smw"}),northArrowSouth:(e,t)=>({top:_c(e,t),left:e.left+e.width/2-t.width/2,name:"arrow_s"}),northArrowSouthMiddleEast:(e,t)=>({top:_c(e,t),left:e.left+e.width/2-.75*t.width+wc.arrowHorizontalOffset,name:"arrow_sme"}),northArrowSouthEast:(e,t)=>({top:_c(e,t),left:e.left+e.width/2-t.width+wc.arrowHorizontalOffset,name:"arrow_se"}),northEastArrowSouthWest:(e,t)=>({top:_c(e,t),left:e.right-wc.arrowHorizontalOffset,name:"arrow_sw"}),northEastArrowSouthMiddleWest:(e,t)=>({top:_c(e,t),left:e.right-.25*t.width-wc.arrowHorizontalOffset,name:"arrow_smw"}),northEastArrowSouth:(e,t)=>({top:_c(e,t),left:e.right-t.width/2,name:"arrow_s"}),northEastArrowSouthMiddleEast:(e,t)=>({top:_c(e,t),left:e.right-.75*t.width+wc.arrowHorizontalOffset,name:"arrow_sme"}),northEastArrowSouthEast:(e,t)=>({top:_c(e,t),left:e.right-t.width+wc.arrowHorizontalOffset,name:"arrow_se"}),southWestArrowNorthWest:(e,t)=>({top:vc(e),left:e.left-wc.arrowHorizontalOffset,name:"arrow_nw"}),southWestArrowNorthMiddleWest:(e,t)=>({top:vc(e),left:e.left-.25*t.width-wc.arrowHorizontalOffset,name:"arrow_nmw"}),southWestArrowNorth:(e,t)=>({top:vc(e),left:e.left-t.width/2,name:"arrow_n"}),southWestArrowNorthMiddleEast:(e,t)=>({top:vc(e),left:e.left-.75*t.width+wc.arrowHorizontalOffset,name:"arrow_nme"}),southWestArrowNorthEast:(e,t)=>({top:vc(e),left:e.left-t.width+wc.arrowHorizontalOffset,name:"arrow_ne"}),southArrowNorthWest:(e,t)=>({top:vc(e),left:e.left+e.width/2-wc.arrowHorizontalOffset,name:"arrow_nw"}),southArrowNorthMiddleWest:(e,t)=>({top:vc(e),left:e.left+e.width/2-.25*t.width-wc.arrowHorizontalOffset,name:"arrow_nmw"}),southArrowNorth:(e,t)=>({top:vc(e),left:e.left+e.width/2-t.width/2,name:"arrow_n"}),southArrowNorthMiddleEast:(e,t)=>({top:vc(e),left:e.left+e.width/2-.75*t.width+wc.arrowHorizontalOffset,name:"arrow_nme"}),southArrowNorthEast:(e,t)=>({top:vc(e),left:e.left+e.width/2-t.width+wc.arrowHorizontalOffset,name:"arrow_ne"}),southEastArrowNorthWest:(e,t)=>({top:vc(e),left:e.right-wc.arrowHorizontalOffset,name:"arrow_nw"}),southEastArrowNorthMiddleWest:(e,t)=>({top:vc(e),left:e.right-.25*t.width-wc.arrowHorizontalOffset,name:"arrow_nmw"}),southEastArrowNorth:(e,t)=>({top:vc(e),left:e.right-t.width/2,name:"arrow_n"}),southEastArrowNorthMiddleEast:(e,t)=>({top:vc(e),left:e.right-.75*t.width+wc.arrowHorizontalOffset,name:"arrow_nme"}),southEastArrowNorthEast:(e,t)=>({top:vc(e),left:e.right-t.width+wc.arrowHorizontalOffset,name:"arrow_ne"})};o(20);class yc extends dc{constructor(){super();const e=this.bindTemplate;this.set("content",""),this.set("viewBox","0 0 20 20"),this.set("fillColor",""),this.setTemplate({tag:"svg",ns:"http://www.w3.org/2000/svg",attributes:{class:["ck","ck-icon"],viewBox:e.to("viewBox")}})}render(){super.render(),this._updateXMLContent(),this._colorFillPaths(),this.on("change:content",()=>{this._updateXMLContent(),this._colorFillPaths()}),this.on("change:fillColor",()=>{this._colorFillPaths()})}_updateXMLContent(){if(this.content){const e=(new DOMParser).parseFromString(this.content.trim(),"image/svg+xml").querySelector("svg"),t=e.getAttribute("viewBox");for(t&&(this.viewBox=t),this.element.innerHTML="";e.childNodes.length>0;)this.element.appendChild(e.childNodes[0])}}_colorFillPaths(){this.fillColor&&this.element.querySelectorAll(".ck-icon__fill").forEach(e=>{e.style.fill=this.fillColor})}}o(22);class xc extends dc{constructor(e){super(e),this.set("text",""),this.set("position","s");const t=this.bindTemplate;this.setTemplate({tag:"span",attributes:{class:["ck","ck-tooltip",t.to("position",e=>"ck-tooltip_"+e),t.if("text","ck-hidden",e=>!e.trim())]},children:[{tag:"span",attributes:{class:["ck","ck-tooltip__text"]},children:[{text:t.to("text")}]}]})}}o(24);class Cc extends dc{constructor(e){super(e);const t=this.bindTemplate,o=ho();this.set("class"),this.set("labelStyle"),this.set("icon"),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isVisible",!0),this.set("isToggleable",!1),this.set("keystroke"),this.set("label"),this.set("tabindex",-1),this.set("tooltip"),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.set("withKeystroke",!1),this.children=this.createCollection(),this.tooltipView=this._createTooltipView(),this.labelView=this._createLabelView(o),this.iconView=new yc,this.iconView.extendTemplate({attributes:{class:"ck-button__icon"}}),this.keystrokeView=this._createKeystrokeView(),this.bind("_tooltipString").to(this,"tooltip",this,"label",this,"keystroke",this._getTooltipString.bind(this)),this.setTemplate({tag:"button",attributes:{class:["ck","ck-button",t.to("class"),t.if("isEnabled","ck-disabled",e=>!e),t.if("isVisible","ck-hidden",e=>!e),t.to("isOn",e=>e?"ck-on":"ck-off"),t.if("withText","ck-button_with-text"),t.if("withKeystroke","ck-button_with-keystroke")],type:t.to("type",e=>e||"button"),tabindex:t.to("tabindex"),"aria-labelledby":"ck-editor__aria-label_"+o,"aria-disabled":t.if("isEnabled",!0,e=>!e),"aria-pressed":t.to("isOn",e=>!!this.isToggleable&&String(e))},children:this.children,on:{mousedown:t.to(e=>{e.preventDefault()}),click:t.to(e=>{this.isEnabled?this.fire("execute"):e.preventDefault()})}})}render(){super.render(),this.icon&&(this.iconView.bind("content").to(this,"icon"),this.children.add(this.iconView)),this.children.add(this.tooltipView),this.children.add(this.labelView),this.withKeystroke&&this.children.add(this.keystrokeView)}focus(){this.element.focus()}_createTooltipView(){const e=new xc;return e.bind("text").to(this,"_tooltipString"),e.bind("position").to(this,"tooltipPosition"),e}_createLabelView(e){const t=new dc,o=this.bindTemplate;return t.setTemplate({tag:"span",attributes:{class:["ck","ck-button__label"],style:o.to("labelStyle"),id:"ck-editor__aria-label_"+e},children:[{text:this.bindTemplate.to("label")}]}),t}_createKeystrokeView(){const e=new dc;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__keystroke"]},children:[{text:this.bindTemplate.to("keystroke",e=>ki(e))}]}),e}_getTooltipString(e,t,o){return e?"string"==typeof e?e:(o&&(o=ki(o)),e instanceof Function?e(t,o):`${t}${o?` (${o})`:""}`):""}}class Ac{constructor(){this.set("isFocused",!1),this.set("focusedElement",null),this._elements=new Set,this._nextEventLoopTimeout=null}add(e){if(this._elements.has(e))throw new mo.b("focusTracker-add-element-already-exist: This element is already tracked by FocusTracker.",this);this.listenTo(e,"focus",()=>this._focus(e),{useCapture:!0}),this.listenTo(e,"blur",()=>this._blur(),{useCapture:!0}),this._elements.add(e)}remove(e){e===this.focusedElement&&this._blur(e),this._elements.has(e)&&(this.stopListening(e),this._elements.delete(e))}destroy(){this.stopListening()}_focus(e){clearTimeout(this._nextEventLoopTimeout),this.focusedElement=e,this.isFocused=!0}_blur(){clearTimeout(this._nextEventLoopTimeout),this._nextEventLoopTimeout=setTimeout(()=>{this.focusedElement=null,this.isFocused=!1},0)}}Co(Ac,gr),Co(Ac,qn);o(26),o(28);const Tc=fc("px");class Pc extends jl{static get pluginName(){return"ContextualBalloon"}constructor(e){super(e),this.positionLimiter=()=>{const e=this.editor.editing.view,t=e.document.selection.editableElement;return t?e.domConverter.mapViewToDom(t.root):null},this.set("visibleView",null),this.view=new wc(e.locale),e.ui.view.body.add(this.view),e.ui.focusTracker.add(this.view.element),this._viewToStack=new Map,this._idToStack=new Map,this.set("_numberOfStacks",0),this.set("_singleViewMode",!1),this._rotatorView=this._createRotatorView(),this._fakePanelsView=this._createFakePanelsView()}hasView(e){return Array.from(this._viewToStack.keys()).includes(e)}add(e){if(this.hasView(e.view))throw new mo.b("contextualballoon-add-view-exist: Cannot add configuration of the same view twice.",[this,e]);const t=e.stackId||"main";if(!this._idToStack.has(t))return this._idToStack.set(t,new Map([[e.view,e]])),this._viewToStack.set(e.view,this._idToStack.get(t)),this._numberOfStacks=this._idToStack.size,void(this._visibleStack&&!e.singleViewMode||this.showStack(t));const o=this._idToStack.get(t);e.singleViewMode&&this.showStack(t),o.set(e.view,e),this._viewToStack.set(e.view,o),o===this._visibleStack&&this._showView(e)}remove(e){if(!this.hasView(e))throw new mo.b("contextualballoon-remove-view-not-exist: Cannot remove the configuration of a non-existent view.",[this,e]);const t=this._viewToStack.get(e);this._singleViewMode&&this.visibleView===e&&(this._singleViewMode=!1),this.visibleView===e&&(1===t.size?this._idToStack.size>1?this._showNextStack():(this.view.hide(),this.visibleView=null,this._rotatorView.hideView()):this._showView(Array.from(t.values())[t.size-2])),1===t.size?(this._idToStack.delete(this._getStackId(t)),this._numberOfStacks=this._idToStack.size):t.delete(e),this._viewToStack.delete(e)}updatePosition(e){e&&(this._visibleStack.get(this.visibleView).position=e),this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition()}showStack(e){this.visibleStack=e;const t=this._idToStack.get(e);if(!t)throw new mo.b("contextualballoon-showstack-stack-not-exist: Cannot show a stack that does not exist.",this);this._visibleStack!==t&&this._showView(Array.from(t.values()).pop())}get _visibleStack(){return this._viewToStack.get(this.visibleView)}_getStackId(e){return Array.from(this._idToStack.entries()).find(t=>t[1]===e)[0]}_showNextStack(){const e=Array.from(this._idToStack.values());let t=e.indexOf(this._visibleStack)+1;e[t]||(t=0),this.showStack(this._getStackId(e[t]))}_showPrevStack(){const e=Array.from(this._idToStack.values());let t=e.indexOf(this._visibleStack)-1;e[t]||(t=e.length-1),this.showStack(this._getStackId(e[t]))}_createRotatorView(){const e=new Sc(this.editor.locale),t=this.editor.locale.t;return this.view.content.add(e),e.bind("isNavigationVisible").to(this,"_numberOfStacks",this,"_singleViewMode",(e,t)=>!t&&e>1),e.on("change:isNavigationVisible",()=>this.updatePosition(),{priority:"low"}),e.bind("counter").to(this,"visibleView",this,"_numberOfStacks",(e,o)=>{if(o<2)return"";const n=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return t("%0 of %1",[n,o])}),e.buttonNextView.on("execute",()=>{e.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showNextStack()}),e.buttonPrevView.on("execute",()=>{e.focusTracker.isFocused&&this.editor.editing.view.focus(),this._showPrevStack()}),e}_createFakePanelsView(){const e=new Ec(this.editor.locale,this.view);return e.bind("numberOfPanels").to(this,"_numberOfStacks",this,"_singleViewMode",(e,t)=>!t&&e>=2?Math.min(e-1,2):0),e.listenTo(this.view,"change:top",()=>e.updatePosition()),e.listenTo(this.view,"change:left",()=>e.updatePosition()),this.editor.ui.view.body.add(e),e}_showView({view:e,balloonClassName:t="",withArrow:o=!0,singleViewMode:n=!1}){this.view.class=t,this.view.withArrow=o,this._rotatorView.showView(e),this.visibleView=e,this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition(),n&&(this._singleViewMode=!0)}_getBalloonPosition(){let e=Array.from(this._visibleStack.values()).pop().position;return e&&!e.limiter&&(e=Object.assign({},e,{limiter:this.positionLimiter})),e}}class Sc extends dc{constructor(e){super(e);const t=e.t,o=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new Ac,this.buttonPrevView=this._createButtonView(t("Previous"),''),this.buttonNextView=this._createButtonView(t("Next"),''),this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-rotator"],"z-index":"-1"},children:[{tag:"div",attributes:{class:["ck-balloon-rotator__navigation",o.to("isNavigationVisible",e=>e?"":"ck-hidden")]},children:[this.buttonPrevView,{tag:"span",attributes:{class:["ck-balloon-rotator__counter"]},children:[{text:o.to("counter")}]},this.buttonNextView]},{tag:"div",attributes:{class:"ck-balloon-rotator__content"},children:this.content}]})}render(){super.render(),this.focusTracker.add(this.element)}showView(e){this.hideView(),this.content.add(e)}hideView(){this.content.clear()}_createButtonView(e,t){const o=new Cc(this.locale);return o.set({label:e,icon:t,tooltip:!0}),o}}class Ec extends dc{constructor(e,t){super(e);const o=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("height",0),this.set("width",0),this.set("numberOfPanels",0),this.content=this.createCollection(),this._balloonPanelView=t,this.setTemplate({tag:"div",attributes:{class:["ck-fake-panel",o.to("numberOfPanels",e=>e?"":"ck-hidden")],style:{top:o.to("top",Tc),left:o.to("left",Tc),width:o.to("width",Tc),height:o.to("height",Tc)}},children:this.content}),this.on("change:numberOfPanels",(e,t,o,n)=>{o>n?this._addPanels(o-n):this._removePanels(n-o),this.updatePosition()})}_addPanels(e){for(;e--;){const e=new dc;e.setTemplate({tag:"div"}),this.content.add(e),this.registerChild(e)}}_removePanels(e){for(;e--;){const e=this.content.last;this.content.remove(e),this.deregisterChild(e),e.destroy()}}updatePosition(){if(this.numberOfPanels){const{top:e,left:t}=this._balloonPanelView,{width:o,height:n}=new is(this._balloonPanelView.element);Object.assign(this,{top:e,left:t,width:o,height:n})}}}class Rc{constructor(e){if(Object.assign(this,e),e.actions&&e.keystrokeHandler)for(const t in e.actions){let o=e.actions[t];"string"==typeof o&&(o=[o]);for(const n of o)e.keystrokeHandler.set(n,(e,o)=>{this[t](),o()})}}get first(){return this.focusables.find(Ic)||null}get last(){return this.focusables.filter(Ic).slice(-1)[0]||null}get next(){return this._getFocusableItem(1)}get previous(){return this._getFocusableItem(-1)}get current(){let e=null;return null===this.focusTracker.focusedElement?null:(this.focusables.find((t,o)=>{const n=t.element===this.focusTracker.focusedElement;return n&&(e=o),n}),e)}focusFirst(){this._focus(this.first)}focusLast(){this._focus(this.last)}focusNext(){this._focus(this.next)}focusPrevious(){this._focus(this.previous)}_focus(e){e&&e.focus()}_getFocusableItem(e){const t=this.current,o=this.focusables.length;if(!o)return null;if(null===t)return this[1===e?"first":"last"];let n=(t+o+e)%o;do{const t=this.focusables.get(n);if(Ic(t))return t;n=(n+o+e)%o}while(n!==t);return null}}function Ic(e){return!(!e.focus||"none"==rr.window.getComputedStyle(e.element).display)}class Vc extends dc{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}})}}class Oc{constructor(e,t){Oc._observerInstance||Oc._createObserver(),this._element=e,this._callback=t,Oc._addElementCallback(e,t),Oc._observerInstance.observe(e)}destroy(){Oc._deleteElementCallback(this._element,this._callback)}static _addElementCallback(e,t){Oc._elementCallbacks||(Oc._elementCallbacks=new Map);let o=Oc._elementCallbacks.get(e);o||(o=new Set,Oc._elementCallbacks.set(e,o)),o.add(t)}static _deleteElementCallback(e,t){const o=Oc._getElementCallbacks(e);o&&(o.delete(t),o.size||(Oc._elementCallbacks.delete(e),Oc._observerInstance.unobserve(e))),Oc._elementCallbacks&&!Oc._elementCallbacks.size&&(Oc._observerInstance=null,Oc._elementCallbacks=null)}static _getElementCallbacks(e){return Oc._elementCallbacks?Oc._elementCallbacks.get(e):null}static _createObserver(){let e;e="function"==typeof rr.window.ResizeObserver?rr.window.ResizeObserver:Mc,Oc._observerInstance=new e(e=>{for(const t of e){const e=Oc._getElementCallbacks(t.target);if(e)for(const o of e)o(t)}})}}Oc._observerInstance=null,Oc._elementCallbacks=null;class Mc{constructor(e){this._callback=e,this._elements=new Set,this._previousRects=new Map,this._periodicCheckTimeout=null}observe(e){this._elements.add(e),this._checkElementRectsAndExecuteCallback(),1===this._elements.size&&this._startPeriodicCheck()}unobserve(e){this._elements.delete(e),this._previousRects.delete(e),this._elements.size||this._stopPeriodicCheck()}_startPeriodicCheck(){const e=()=>{this._checkElementRectsAndExecuteCallback(),this._periodicCheckTimeout=setTimeout(e,100)};this.listenTo(rr.window,"resize",()=>{this._checkElementRectsAndExecuteCallback()}),this._periodicCheckTimeout=setTimeout(e,100)}_stopPeriodicCheck(){clearTimeout(this._periodicCheckTimeout),this.stopListening(),this._previousRects.clear()}_checkElementRectsAndExecuteCallback(){const e=[];for(const t of this._elements)this._hasRectChanged(t)&&e.push({target:t,contentRect:this._previousRects.get(t)});e.length&&this._callback(e)}_hasRectChanged(e){if(!e.ownerDocument.body.contains(e))return!1;const t=new is(e),o=this._previousRects.get(e),n=!o||!o.isEqual(t);return this._previousRects.set(e,t),n}}Co(Mc,gr);class Nc extends dc{constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!1),this.set("position","se"),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-reset","ck-dropdown__panel",t.to("position",e=>"ck-dropdown__panel_"+e),t.if("isVisible","ck-dropdown__panel-visible")]},children:this.children,on:{selectstart:t.to(e=>e.preventDefault())}})}focus(){this.children.length&&this.children.first.focus()}focusLast(){if(this.children.length){const e=this.children.last;"function"==typeof e.focusLast?e.focusLast():e.focus()}}}o(30);class zc extends dc{constructor(e,t,o){super(e);const n=this.bindTemplate;this.buttonView=t,this.panelView=o,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("class"),this.set("id"),this.set("panelPosition","auto"),this.keystrokes=new Bl,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",n.to("class"),n.if("isEnabled","ck-disabled",e=>!e)],id:n.to("id"),"aria-describedby":n.to("ariaDescribedById")},children:[t,o]}),t.extendTemplate({attributes:{class:["ck-dropdown__button"]}})}render(){super.render(),this.listenTo(this.buttonView,"open",()=>{this.isOpen=!this.isOpen}),this.panelView.bind("isVisible").to(this,"isOpen"),this.on("change:isOpen",()=>{this.isOpen&&("auto"===this.panelPosition?this.panelView.position=zc._getOptimalPosition({element:this.panelView.element,target:this.buttonView.element,fitInViewport:!0,positions:this._panelPositions}).name:this.panelView.position=this.panelPosition)}),this.keystrokes.listenTo(this.element);const e=(e,t)=>{this.isOpen&&(this.buttonView.focus(),this.isOpen=!1,t())};this.keystrokes.set("arrowdown",(e,t)=>{this.buttonView.isEnabled&&!this.isOpen&&(this.isOpen=!0,t())}),this.keystrokes.set("arrowright",(e,t)=>{this.isOpen&&t()}),this.keystrokes.set("arrowleft",e),this.keystrokes.set("esc",e)}focus(){this.buttonView.focus()}get _panelPositions(){const{southEast:e,southWest:t,northEast:o,northWest:n}=zc.defaultPanelPositions;return"ltr"===this.locale.uiLanguageDirection?[e,t,o,n]:[t,e,n,o]}}zc.defaultPanelPositions={southEast:e=>({top:e.bottom,left:e.left,name:"se"}),southWest:(e,t)=>({top:e.bottom,left:e.left-t.width+e.width,name:"sw"}),northEast:(e,t)=>({top:e.top-t.height,left:e.left,name:"ne"}),northWest:(e,t)=>({top:e.bottom-t.height,left:e.left-t.width+e.width,name:"nw"})},zc._getOptimalPosition=hc;var Bc='';class Fc extends Cc{constructor(e){super(e),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{"aria-haspopup":!0}}),this.delegate("execute").to(this,"open")}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new yc;return e.content=Bc,e.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),e}}o(32);class Dc extends dc{constructor(){super(),this.items=this.createCollection(),this.focusTracker=new Ac,this.keystrokes=new Bl,this._focusCycler=new Rc({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowup",focusNext:"arrowdown"}}),this.setTemplate({tag:"ul",attributes:{class:["ck","ck-reset","ck-list"]},children:this.items})}render(){super.render();for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",(e,t)=>{this.focusTracker.add(t.element)}),this.items.on("remove",(e,t)=>{this.focusTracker.remove(t.element)}),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}class Lc extends dc{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__item"]},children:this.children})}focus(){this.children.first.focus()}}class Hc extends dc{constructor(e){super(e),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}})}}o(34);class jc extends Cc{constructor(e){super(e),this.isToggleable=!0,this.toggleSwitchView=this._createToggleView(),this.extendTemplate({attributes:{class:"ck-switchbutton"}})}render(){super.render(),this.children.add(this.toggleSwitchView)}_createToggleView(){const e=new dc;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),e}}function Wc({emitter:e,activator:t,callback:o,contextElements:n}){e.listenTo(document,"mousedown",(e,i)=>{if(!t())return;const r="function"==typeof i.composedPath?i.composedPath():[];for(const e of n)if(e.contains(i.target)||r.includes(e))return;o()})}o(36),o(38);function qc(e,t=Fc){const o=new t(e),n=new Nc(e),i=new zc(e,o,n);return o.bind("isEnabled").to(i),o instanceof Fc?o.bind("isOn").to(i,"isOpen"):o.arrowView.bind("isOn").to(i,"isOpen"),function(e){(function(e){e.on("render",()=>{Wc({emitter:e,activator:()=>e.isOpen,callback:()=>{e.isOpen=!1},contextElements:[e.element]})})})(e),function(e){e.on("execute",t=>{t.source instanceof jc||(e.isOpen=!1)})}(e),function(e){e.keystrokes.set("arrowdown",(t,o)=>{e.isOpen&&(e.panelView.focus(),o())}),e.keystrokes.set("arrowup",(t,o)=>{e.isOpen&&(e.panelView.focusLast(),o())})}(e)}(i),i}function $c(e,t){const o=e.locale,n=e.listView=new Dc(o);n.items.bindTo(t).using(({type:e,model:t})=>{if("separator"===e)return new Hc(o);if("button"===e||"switchbutton"===e){const n=new Lc(o);let i;return i="button"===e?new Cc(o):new jc(o),i.bind(...Object.keys(t)).to(t),i.delegate("execute").to(n),n.children.add(i),n}}),e.panelView.children.add(n),n.items.delegate("execute").to(e)}o(40);class Uc extends dc{constructor(e,t){super(e);const o=this.bindTemplate,n=this.t;var i;this.options=t||{},this.set("ariaLabel",n("Editor toolbar")),this.set("maxWidth","auto"),this.items=this.createCollection(),this.focusTracker=new Ac,this.keystrokes=new Bl,this.set("class"),this.set("isCompact",!1),this.itemsView=new Gc(e),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection(),this._focusCycler=new Rc({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:["arrowleft","arrowup"],focusNext:["arrowright","arrowdown"]}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar",o.to("class"),o.if("isCompact","ck-toolbar_compact")],role:"toolbar","aria-label":o.to("ariaLabel"),style:{maxWidth:o.to("maxWidth")}},children:this.children,on:{mousedown:(i=this,i.bindTemplate.to(e=>{e.target===i.element&&e.preventDefault()}))}}),this._behavior=this.options.shouldGroupWhenFull?new Jc(this):new Kc(this)}render(){super.render();for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",(e,t)=>{this.focusTracker.add(t.element)}),this.items.on("remove",(e,t)=>{this.focusTracker.remove(t.element)}),this.keystrokes.listenTo(this.element),this._behavior.render(this)}destroy(){return this._behavior.destroy(),super.destroy()}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}fillFromConfig(e,t){this.items.addMany(e.map(e=>"|"==e?new Vc:t.has(e)?t.create(e):void console.warn(Object(mo.a)("toolbarview-item-unavailable: The requested toolbar item is unavailable."),{name:e})).filter(e=>void 0!==e))}}class Gc extends dc{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children})}}class Kc{constructor(e){const t=e.bindTemplate;e.set("isVertical",!1),e.itemsView.children.bindTo(e.items).using(e=>e),e.focusables.bindTo(e.items).using(e=>e),e.extendTemplate({attributes:{class:[t.if("isVertical","ck-toolbar_vertical")]}})}render(){}destroy(){}}class Jc{constructor(e){this.view=e,this.viewChildren=e.children,this.viewFocusables=e.focusables,this.viewItemsView=e.itemsView,this.viewFocusTracker=e.focusTracker,this.viewLocale=e.locale,this.ungroupedItems=e.createCollection(),this.groupedItems=e.createCollection(),this.groupedItemsDropdown=this._createGroupedItemsDropdown(),this.resizeObserver=null,this.cachedPadding=null,this.shouldUpdateGroupingOnNextResize=!1,e.itemsView.children.bindTo(this.ungroupedItems).using(e=>e),this.ungroupedItems.on("add",this._updateFocusCycleableItems.bind(this)),this.ungroupedItems.on("remove",this._updateFocusCycleableItems.bind(this)),e.children.on("add",this._updateFocusCycleableItems.bind(this)),e.children.on("remove",this._updateFocusCycleableItems.bind(this)),e.items.on("change",(e,t)=>{const o=t.index;for(const e of t.removed)o>=this.ungroupedItems.length?this.groupedItems.remove(e):this.ungroupedItems.remove(e);for(let e=o;ethis.ungroupedItems.length?this.groupedItems.add(n,e-this.ungroupedItems.length):this.ungroupedItems.add(n,e)}this._updateGrouping()}),e.extendTemplate({attributes:{class:["ck-toolbar_grouping"]}})}render(e){this.viewElement=e.element,this._enableGroupingOnResize(),this._enableGroupingOnMaxWidthChange(e)}destroy(){this.groupedItemsDropdown.destroy(),this.resizeObserver.destroy()}_updateGrouping(){if(!this.viewElement.ownerDocument.body.contains(this.viewElement))return;if(!this.viewElement.offsetParent)return void(this.shouldUpdateGroupingOnNextResize=!0);const e=this.groupedItems.length;let t;for(;this._areItemsOverflowing;)this._groupLastItem(),t=!0;if(!t&&this.groupedItems.length){for(;this.groupedItems.length&&!this._areItemsOverflowing;)this._ungroupFirstItem();this._areItemsOverflowing&&this._groupLastItem()}this.groupedItems.length!==e&&this.view.fire("groupedItemsUpdate")}get _areItemsOverflowing(){if(!this.ungroupedItems.length)return!1;const e=this.viewElement,t=this.viewLocale.uiLanguageDirection,o=new is(e.lastChild),n=new is(e);if(!this.cachedPadding){const o=rr.window.getComputedStyle(e),n="ltr"===t?"paddingRight":"paddingLeft";this.cachedPadding=Number.parseInt(o[n])}return"ltr"===t?o.right>n.right-this.cachedPadding:o.left{e&&e===t.contentRect.width&&!this.shouldUpdateGroupingOnNextResize||(this.shouldUpdateGroupingOnNextResize=!1,this._updateGrouping(),e=t.contentRect.width)}),this._updateGrouping()}_enableGroupingOnMaxWidthChange(e){e.on("change:maxWidth",()=>{this._updateGrouping()})}_groupLastItem(){this.groupedItems.length||(this.viewChildren.add(new Vc),this.viewChildren.add(this.groupedItemsDropdown),this.viewFocusTracker.add(this.groupedItemsDropdown.element)),this.groupedItems.add(this.ungroupedItems.remove(this.ungroupedItems.last),0)}_ungroupFirstItem(){this.ungroupedItems.add(this.groupedItems.remove(this.groupedItems.first)),this.groupedItems.length||(this.viewChildren.remove(this.groupedItemsDropdown),this.viewChildren.remove(this.viewChildren.last),this.viewFocusTracker.remove(this.groupedItemsDropdown.element))}_createGroupedItemsDropdown(){const e=this.viewLocale,t=e.t,o=qc(e);return o.class="ck-toolbar__grouped-dropdown",o.panelPosition="ltr"===e.uiLanguageDirection?"sw":"se",function(e,t){const o=e.locale,n=o.t,i=e.toolbarView=new Uc(o);i.set("ariaLabel",n("Dropdown toolbar")),e.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),t.map(e=>i.items.add(e)),e.panelView.children.add(i),i.items.delegate("execute").to(e)}(o,[]),o.buttonView.set({label:t("Show more items"),tooltip:!0,icon:''}),o.toolbarView.items.bindTo(this.groupedItems).using(e=>e),o}_updateFocusCycleableItems(){this.viewFocusables.clear(),this.ungroupedItems.map(e=>{this.viewFocusables.add(e)}),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}}function Yc(e){return Array.isArray(e)?{items:e}:e?Object.assign({items:[]},e):{items:[]}}const Qc=fc("px");class Xc extends jl{static get pluginName(){return"BalloonToolbar"}static get requires(){return[Pc]}constructor(e){super(e),this._balloonConfig=Yc(e.config.get("balloonToolbar")),this.toolbarView=this._createToolbarView(),this.focusTracker=new Ac,e.ui.once("ready",()=>{this.focusTracker.add(e.ui.getEditableElement()),this.focusTracker.add(this.toolbarView.element)}),this._resizeObserver=null,this._balloon=e.plugins.get(Pc),this._fireSelectionChangeDebounced=Jr(()=>this.fire("_selectionChangeDebounced"),200),this.decorate("show")}init(){const e=this.editor,t=e.model.document.selection;this.listenTo(this.focusTracker,"change:isFocused",(e,t,o)=>{const n=this._balloon.visibleView===this.toolbarView;!o&&n?this.hide():o&&this.show()}),this.listenTo(t,"change:range",(e,o)=>{(o.directChange||t.isCollapsed)&&this.hide(),this._fireSelectionChangeDebounced()}),this.listenTo(this,"_selectionChangeDebounced",()=>{this.editor.editing.view.document.isFocused&&this.show()}),this._balloonConfig.shouldNotGroupWhenFull||this.listenTo(e,"ready",()=>{const t=e.ui.view.editable.element;this._resizeObserver=new Oc(t,()=>{this.toolbarView.maxWidth=Qc(.9*new is(t).width)})}),this.listenTo(this.toolbarView,"groupedItemsUpdate",()=>{this._updatePosition()})}afterInit(){const e=this.editor.ui.componentFactory;this.toolbarView.fillFromConfig(this._balloonConfig.items,e)}_createToolbarView(){const e=!this._balloonConfig.shouldNotGroupWhenFull,t=new Uc(this.editor.locale,{shouldGroupWhenFull:e});return t.extendTemplate({attributes:{class:["ck-toolbar_floating"]}}),t.render(),t}show(){const e=this.editor,t=e.model.document.selection,o=e.model.schema;this._balloon.hasView(this.toolbarView)||t.isCollapsed||function(e,t){if(1===e.rangeCount)return!1;return[...e.getRanges()].every(e=>{const o=e.getContainedElement();return o&&t.isSelectable(o)})}(t,o)||Array.from(this.toolbarView.items).every(e=>void 0!==e.isEnabled&&!e.isEnabled)||(this.listenTo(this.editor.ui,"update",()=>{this._updatePosition()}),this._balloon.add({view:this.toolbarView,position:this._getBalloonPositionData(),balloonClassName:"ck-toolbar-container"}))}hide(){this._balloon.hasView(this.toolbarView)&&(this.stopListening(this.editor.ui,"update"),this._balloon.remove(this.toolbarView))}_getBalloonPositionData(){const e=this.editor.editing.view,t=e.document,o=t.selection,n=t.selection.isBackward;return{target:()=>{const t=n?o.getFirstRange():o.getLastRange(),i=is.getDomRangeRects(e.domConverter.viewRangeToDom(t));return n?i[0]:(i.length>1&&0===i[i.length-1].width&&i.pop(),i[i.length-1])},positions:Zc(n)}}_updatePosition(){this._balloon.updatePosition(this._getBalloonPositionData())}destroy(){super.destroy(),this.stopListening(),this._fireSelectionChangeDebounced.cancel(),this.toolbarView.destroy(),this.focusTracker.destroy(),this._resizeObserver&&this._resizeObserver.destroy()}}function Zc(e){const t=wc.defaultPositions;return e?[t.northWestArrowSouth,t.northWestArrowSouthWest,t.northWestArrowSouthEast,t.northWestArrowSouthMiddleEast,t.northWestArrowSouthMiddleWest,t.southWestArrowNorth,t.southWestArrowNorthWest,t.southWestArrowNorthEast,t.southWestArrowNorthMiddleWest,t.southWestArrowNorthMiddleEast]:[t.southEastArrowNorth,t.southEastArrowNorthEast,t.southEastArrowNorthWest,t.southEastArrowNorthMiddleEast,t.southEastArrowNorthMiddleWest,t.northEastArrowSouth,t.northEastArrowSouthEast,t.northEastArrowSouthWest,t.northEastArrowSouthMiddleEast,t.northEastArrowSouthMiddleWest]}class ed{constructor(e){this.editor=e,this._components=new Map}*names(){for(const e of this._components.values())yield e.originalName}add(e,t){this._components.set(td(e),{callback:t,originalName:e})}create(e){if(!this.has(e))throw new mo.b("componentfactory-item-missing: The required component is not registered in the factory.",this,{name:e});return this._components.get(td(e)).callback(this.editor.locale)}has(e){return this._components.has(td(e))}}function td(e){return String(e).toLowerCase()}class od{constructor(e){this.editor=e,this.componentFactory=new ed(e),this.focusTracker=new Ac,this._editableElementsMap=new Map,this.listenTo(e.editing.view.document,"layoutChanged",()=>this.update())}get element(){return null}update(){this.fire("update")}destroy(){this.stopListening(),this.focusTracker.destroy();for(const e of this._editableElementsMap.values())e.ckeditorInstance=null;this._editableElementsMap=new Map}setEditableElement(e,t){this._editableElementsMap.set(e,t),t.ckeditorInstance||(t.ckeditorInstance=this.editor)}getEditableElement(e="main"){return this._editableElementsMap.get(e)}getEditableElementsNames(){return this._editableElementsMap.keys()}get _editableElements(){return console.warn("editor-ui-deprecated-editable-elements: The EditorUI#_editableElements property has been deprecated and will be removed in the near future.",{editorUI:this}),this._editableElementsMap}}Co(od,po);o(42);const nd=new WeakMap;function id(e){const{view:t,element:o,text:n,isDirectHost:i=!0}=e,r=t.document;nd.has(r)||(nd.set(r,new Map),r.registerPostFixer(e=>sd(r,e))),nd.get(r).set(o,{text:n,isDirectHost:i}),t.change(e=>sd(r,e))}function rd(e,t){return!!t.hasClass("ck-placeholder")&&(e.removeClass("ck-placeholder",t),!0)}function sd(e,t){const o=nd.get(e);let n=!1;for(const[e,i]of o)ad(t,e,i)&&(n=!0);return n}function ad(e,t,o){const{text:n,isDirectHost:i}=o,r=i?t:function(e){if(1===e.childCount){const t=e.getChild(0);if(t.is("element")&&!t.is("uiElement"))return t}return null}(t);let s=!1;return!!r&&(o.hostElement=r,r.getAttribute("data-placeholder")!==n&&(e.setAttribute("data-placeholder",n,r),s=!0),!function(e){if(!e.isAttached())return!1;const t=!Array.from(e.getChildren()).some(e=>!e.is("uiElement")),o=e.document;if(!o.isFocused&&t)return!0;const n=o.selection.anchor;return!(!t||!n||n.parent===e)}(r)?rd(e,r)&&(s=!0):function(e,t){return!t.hasClass("ck-placeholder")&&(e.addClass("ck-placeholder",t),!0)}(e,r)&&(s=!0),s)}class ld extends od{constructor(e,t){super(e),this.view=t}get element(){return this.view.editable.element}init(){const e=this.editor,t=this.view,o=e.plugins.get("BalloonToolbar"),n=e.editing.view,i=t.editable,r=n.document.getRoot();i.name=r.rootName,t.render();const s=i.element;this.setEditableElement(i.name,s),this.focusTracker.add(s),i.bind("isFocused").to(this.focusTracker),n.attachDomRoot(s),function({origin:e,originKeystrokeHandler:t,originFocusTracker:o,toolbar:n,beforeFocus:i,afterBlur:r}){o.add(n.element),t.set("Alt+F10",(e,t)=>{o.isFocused&&!n.focusTracker.isFocused&&(i&&i(),n.focus(),t())}),n.keystrokes.set("Esc",(t,o)=>{n.focusTracker.isFocused&&(e.focus(),r&&r(),o())})}({origin:n,originFocusTracker:this.focusTracker,originKeystrokeHandler:e.keystrokes,toolbar:o.toolbarView,beforeFocus(){o.show()},afterBlur(){o.hide()}}),this._initPlaceholder(),this.fire("ready")}destroy(){const e=this.view;this.editor.editing.view.detachDomRoot(e.editable.name),e.destroy(),super.destroy()}_initPlaceholder(){const e=this.editor,t=e.editing.view,o=t.document.getRoot(),n=e.sourceElement,i=e.config.get("placeholder")||n&&"textarea"===n.tagName.toLowerCase()&&n.getAttribute("placeholder");i&&id({view:t,element:o,text:i,isDirectHost:!1})}}var cd=function(e){return"string"==typeof e||!ze(e)&&p(e)&&"[object String]"==m(e)};function dd(e,t,o={},n=[]){const i=o&&o.xmlns,r=i?e.createElementNS(i,t):e.createElement(t);for(const e in o)r.setAttribute(e,o[e]);!cd(n)&&xo(n)||(n=[n]);for(let t of n)cd(t)&&(t=e.createTextNode(t)),r.appendChild(t);return r}class hd extends ql{constructor(e,t=[]){super(t),this.locale=e}attachToDom(){this._bodyCollectionContainer=new $l({tag:"div",attributes:{class:["ck","ck-reset_all","ck-body","ck-rounded-corners"],dir:this.locale.uiLanguageDirection},children:this}).render();let e=document.querySelector(".ck-body-wrapper");e||(e=dd(document,"div",{class:"ck-body-wrapper"}),document.body.appendChild(e)),e.appendChild(this._bodyCollectionContainer)}detachFromDom(){super.destroy(),this._bodyCollectionContainer&&this._bodyCollectionContainer.remove();const e=document.querySelector(".ck-body-wrapper");e&&0==e.childElementCount&&e.remove()}}o(44);class ud extends dc{constructor(e){super(e),this.body=new hd(e)}render(){super.render(),this.body.attachToDom()}destroy(){return this.body.detachFromDom(),super.destroy()}}class md extends dc{constructor(e,t,o){super(e),this.setTemplate({tag:"div",attributes:{class:["ck","ck-content","ck-editor__editable","ck-rounded-corners"],lang:e.contentLanguage,dir:e.contentLanguageDirection}}),this.name=null,this.set("isFocused",!1),this._editableElement=o,this._hasExternalElement=!!this._editableElement,this._editingView=t}render(){super.render(),this._hasExternalElement?this.template.apply(this.element=this._editableElement):this._editableElement=this.element,this.on("change:isFocused",()=>this._updateIsFocusedClasses()),this._updateIsFocusedClasses()}destroy(){this._hasExternalElement&&this.template.revert(this._editableElement),super.destroy()}_updateIsFocusedClasses(){const e=this._editingView;function t(t){e.change(o=>{const n=e.document.getRoot(t.name);o.addClass(t.isFocused?"ck-focused":"ck-blurred",n),o.removeClass(t.isFocused?"ck-blurred":"ck-focused",n)})}e.isRenderingInProgress?function o(n){e.once("change:isRenderingInProgress",(e,i,r)=>{r?o(n):t(n)})}(this):t(this)}}class gd extends md{constructor(e,t,o){super(e,t,o),this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}})}render(){super.render();const e=this._editingView,t=this.t;e.change(o=>{const n=e.document.getRoot(this.name);o.setAttribute("aria-label",t("Rich Text Editor, %0",[this.name]),n)})}}class fd extends ud{constructor(e,t,o){super(e),this.editable=new gd(e,t,o)}render(){super.render(),this.registerChild(this.editable)}}function pd(e,t){e instanceof HTMLTextAreaElement&&(e.value=t),e.innerHTML=t}var bd={setData(e){this.data.set(e)},getData(e){return this.data.get(e)}};var wd={updateSourceElement(){if(!this.sourceElement)throw new mo.b("editor-missing-sourceelement: Cannot update the source element of a detached editor.",this);pd(this.sourceElement,this.data.get())}};class kd extends Dl{constructor(e,t){super(t),no(e)&&(this.sourceElement=e,function(e){const t=e.sourceElement;if(t){if(t.ckeditorInstance)throw new mo.b("editor-source-element-already-used: The DOM element cannot be used to create multiple editor instances.",e);t.ckeditorInstance=e,e.once("destroy",()=>{delete t.ckeditorInstance})}}(this));const o=this.config.get("plugins");o.push(Xc),this.config.set("plugins",o),this.config.define("balloonToolbar",this.config.get("toolbar")),this.data.processor=new Hl(this.data.viewDocument),this.model.document.createRoot();const n=new fd(this.locale,this.editing.view,this.sourceElement);this.ui=new ld(this,n),function(e){if(!D(e.updateSourceElement))throw new mo.b("attachtoform-missing-elementapi-interface: Editor passed to attachToForm() must implement ElementApi.",e);const t=e.sourceElement;if(t&&"textarea"===t.tagName.toLowerCase()&&t.form){let o;const n=t.form,i=()=>e.updateSourceElement();D(n.submit)&&(o=n.submit,n.submit=()=>{i(),o.apply(n)}),n.addEventListener("submit",i),e.on("destroy",()=>{n.removeEventListener("submit",i),o&&(n.submit=o)})}}(this)}destroy(){const e=this.getData();return this.ui.destroy(),super.destroy().then(()=>{this.sourceElement&&pd(this.sourceElement,e)})}static create(e,t={}){return new Promise(o=>{const n=no(e);if(n&&"TEXTAREA"===e.tagName)throw new mo.b("editor-wrong-element: This type of editor cannot be initialized inside